From da8327589e377bf0f4229c4afd780937f43627b5 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 25 Mar 2021 13:50:05 +0100 Subject: [PATCH] New OO build to fix slide issues --- .../onlyoffice/v4/sdkjs/slide/sdk-all.js | 2 +- .../apps/presentationeditor/main/app.js | 29 ++----------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/www/common/onlyoffice/v4/sdkjs/slide/sdk-all.js b/www/common/onlyoffice/v4/sdkjs/slide/sdk-all.js index a01b791a7..ddd6ca2fe 100644 --- a/www/common/onlyoffice/v4/sdkjs/slide/sdk-all.js +++ b/www/common/onlyoffice/v4/sdkjs/slide/sdk-all.js @@ -8409,7 +8409,7 @@ oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.ima oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image= new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i, cb){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img, -img.src)});console.error("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,url);oThis.map_image_index[url]=oImage}if(typeof cb==="function")cb()})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i'},disabled:!1,template:e.template(['
','
','
','
','
',"
","<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.thumbs=[],e.options.el&&e.render()},render:function(t){var i=this;i.rendered?this.cmpEl=this.$el:(this.cmpEl=$(this.template({items:this.options.values,thumbTemplate:this.options.thumbTemplate})),t?(this.setElement(t,!1),t.html(this.cmpEl)):this.$el.html(this.cmpEl));var n=this.cmpEl;n.find(".track-center").width(i.options.width-14),n.width(i.options.width);var o=function(t){t.preventDefault(),t.stopPropagation();var n=t.data.index,o=i.thumbs[n].value,s=n-1<0?0:i.thumbs[n-1].position,a=n+1a,c=Math.max(0,Math.min(100,l)),d=c/i.delta+i.minValue;if(i.isRemoveThumb){if(i.thumbs.length<3)return $(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),void(i._dragstart=void 0);i.trigger("removethumb",i,e.findIndex(i.thumbs,{index:n})),i.trigger("change",i,d,o),i.trigger("changecomplete",i,d,o)}else i.setThumbPosition(n,c),i.thumbs[n].value=d,r&&i.sortThumbs();$(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),i._dragstart=void 0,!i.isRemoveThumb&&i.trigger("changecomplete",i,d,o),i.isRemoveThumb=void 0},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=t.data.index,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1s,r=Math.max(0,Math.min(100,a)),c=r/i.delta+i.minValue;i.setThumbPosition(e,r),i.thumbs[e].value=c,l&&i.sortThumbs();var d=t.pageY*Common.Utils.zoom()-i.cmpEl.offset().top;i.isRemoveThumb=d>i.cmpEl.height()||d<0,i.setRemoveThumb(e,i.isRemoveThumb),Math.abs(c-n)>.001&&i.trigger("change",i,c,n)}},a=function(t){if(!i.disabled){var n=t.data.index,o=i.thumbs[n].thumb;i._dragstart=t.pageX*Common.Utils.zoom()-o.offset().left-o.width()/2,i.setActiveThumb(n),e.each(i.thumbs,function(t,e){n==e?t.thumb.css("z-index",500):t.thumb.css("z-index","")}),$(document).on("mouseup",null,t.data,i.binding.onMouseUp),$(document).on("mousemove",null,t.data,i.binding.onMouseMove)}},l=function(t){if(!(i.disabled||!e.isUndefined(i._dragstart)||i.thumbs.length>9)){var n=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100))),o=r(n),s=(i.thumbs[o].colorValue,i.thumbs[o].value,n/i.delta+i.minValue);i.addThumb();var a=i.thumbs.length-1;i.setThumbPosition(a,n),i.thumbs[a].value=s,i.trigger("addthumb",i,a,n),i.trigger("change",i),i.trigger("changecomplete",i)}},r=function(t){for(var e,n=100,o=0,s=i.thumbs.length,a=0;al.position)continue;o=a,n=e}return o};return this.binding={onMouseUp:e.bind(o,this),onMouseMove:e.bind(s,this),onMouseDown:e.bind(a,this)},this.$thumbs=n.find(".thumb"),e.each(this.$thumbs,function(t,e){var n=$(t);i.thumbs.push({thumb:n,index:e}),i.setValue(e,i.options.values[e]),n.on("mousedown",null,i.thumbs[e],i.binding.onMouseDown)}),i.setActiveThumb(0,!0),i.rendered||n.on("mouseup",".track",l),i.rendered=!0,this},setActiveThumb:function(t,e){this.currentThumb=t,this.$thumbs=this.cmpEl.find(".thumb"),this.$thumbs.removeClass("active"),this.thumbs[t].thumb.addClass("active"),!0!==e&&this.trigger("thumbclick",this,t)},setRemoveThumb:function(t,i){-1!==e.findIndex(this.thumbs,{index:t})&&(i&&this.thumbs.length>2?this.$el.find(".active").addClass("remove"):this.$el.find(".remove").removeClass("remove"))},setThumbPosition:function(t,e){this.thumbs[t].position=e,this.thumbs[t].thumb.css({left:e+"%"})},setValue:function(t,e){this.thumbs[t].value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(t,Math.round((e-this.minValue)*this.delta))},getValue:function(t){return this.thumbs[t].value},getValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.value)}),t},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t},sortThumbs:function(){this.thumbs.sort(function(t,e){return t.position-e.position});var t=[];return e.each(this.thumbs,function(e,i){t.push(e.index),e.index=i}),t},setThumbs:function(t){var e=this.thumbs.length;if(e!=t)for(var i=0;i0&&this.setValue(i,this.getValue(i-1)),e.on("mousedown",null,this.thumbs[i],this.binding.onMouseDown)},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),t>0&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1))}})}),void 0===Common)var Common={};define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(t,e){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0,thumbTemplate:'
'},disabled:!1,template:e.template(['
','
',"<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","
"].join("")),initialize:function(t){this.styleStr={},Common.UI.MultiSlider.prototype.initialize.call(this,t)},render:function(t){Common.UI.MultiSlider.prototype.render.call(this,t);var i=this;i.trackEl=i.cmpEl.find(".track");for(var n=0;n div"),i.setColorValue(i.options.colorValues[n],n);i.changeSliderStyle(),i.changeGradientStyle(),i.on("change",e.bind(i.changeGradientStyle,i))},setColorValue:function(t,e){var i=void 0!==e?e:this.currentThumb;this.thumbs[i].colorValue=t,this.thumbs[i].thumbcolor.css("background-color",t),this.changeGradientStyle()},getColorValue:function(t){var e=void 0!==t?t:this.currentThumb;return this.thumbs[e].colorValue},setValue:function(t,e){Common.UI.MultiSlider.prototype.setValue.call(this,t,e),this.changeGradientStyle()},getColorValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.colorValue)}),t},changeGradientStyle:function(){if(this.rendered){var t;this.styleStr.specific&&(t=Common.Utils.String.format(this.styleStr.specific,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t)),Common.Utils.isIE&&(t=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.getColorValue(0),this.getColorValue(this.thumbs.length-1)),this.trackEl.css("filter",t)),this.styleStr.common&&(t=Common.Utils.String.format(this.styleStr.common,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t))}},sortThumbs:function(){var t=Common.UI.MultiSlider.prototype.sortThumbs.call(this);return this.trigger("sortthumbs",this,t),t},findLeftThumb:function(t){for(var e,i=this,n=100,o=0,s=this.thumbs.length,a=0;a0&&e<=n){var l=i.thumbs[a+1],r=i.thumbs[a-1];if(void 0!==r&&tl.position)continue;o=a,n=e}return o},calculationNewColor:function(t,e,i){var n=i?i/100:.5,o=1-n,s=Common.Utils.ThemeColor.getRgbColor(t),a=Common.Utils.ThemeColor.getRgbColor(e),l=[Math.round(s.get_r()*o+a.get_r()*n),Math.round(s.get_g()*o+a.get_g()*n),Math.round(s.get_b()*o+a.get_b()*n)];return Common.Utils.ThemeColor.getHexColor(l[0],l[1],l[2])},addThumb:function(){Common.UI.MultiSlider.prototype.addThumb.call(this);var t=this,e=t.thumbs.length-1;t.thumbs[e].thumb.on("dblclick",null,function(){t.trigger("thumbdblclick",t)}),t.thumbs[e].thumbcolor=t.thumbs[e].thumb.find("> div"),e>0&&this.setColorValue(this.getColorValue(e-1),e),t.changeSliderStyle()},addNewThumb:function(t,i,n){var o,s=this,a=this.findLeftThumb(i),t=t;if(e.isUndefined(n)){var l=100*(i-this.thumbs[a].value)/(this.thumbs[a+1].value-this.thumbs[a].value);o=l<0?this.thumbs[a].colorValue:this.calculationNewColor(this.thumbs[a].colorValue,this.thumbs[a===t-1?a:a+1].colorValue,l)}else{this.addThumb(),t=this.thumbs.length-1,o=this.calculationNewColor(this.thumbs[a].colorValue,this.thumbs[a===t-1?a:a+1].colorValue),this.setThumbPosition(t,i);var r=i/this.delta+this.minValue;this.thumbs[t].value=r}return s.thumbs[t].thumbcolor=s.thumbs[t].thumb.find("> div"),t>0&&this.setColorValue("#"+o,t),s.sortThumbs(),s.changeSliderStyle(),s.changeGradientStyle(),o},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),this.thumbs.length>2&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1),this.sortThumbs(),this.changeSliderStyle())},changeSliderStyle:function(){this.styleStr={specific:"",common:"linear-gradient(to right"},Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr.specific="-webkit-gradient(linear, left top, right top":Common.Utils.isChrome||Common.Utils.isSafari?this.styleStr.specific="-webkit-linear-gradient(left":Common.Utils.isGecko?this.styleStr.specific="-moz-linear-gradient(left":Common.Utils.isOpera&&Common.Utils.operaVersion>11?this.styleStr.specific="-o-linear-gradient(left":Common.Utils.isIE&&(this.styleStr.specific="-ms-linear-gradient(left");for(var t=0;t=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_fill(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.asc_CShapeProperty,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.put_fill(l),this.api.ShapeApply(a)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.put_fill(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_CShapeProperty,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i),t.put_fill(e),this.api.ShapeApply(t),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=Common.Utils.String.parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_CShapeProperty,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.put_stroke(i),this.api.ShapeApply(e)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){s.fireEvent("editcomplete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(t,e){if(this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},setImageUrl:function(t,e){if(null!==this.BlipFillType){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),n.get_fill().put_url(t,e),i.put_fill(n),this.api.ShapeApply(i)}},insertImageFromStorage:function(t){t&&t.url&&"fill"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","fill"):(this.api&&this.api.ChangeShapeImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this))},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Shape==n){new PE.Views.ShapeSettingsAdvanced({shapeProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.ShapeApply(i.shapeProps),e.fireEvent("editcomplete",e)}}).show();break}}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),t){this._originalProps=t,this._noApply=!0;var n=t.asc_getType();this.disableControls(1==this._locked,!0!==t.get_CanFill()),this.hideShapeOnlySettings(t.get_FromChart()||t.get_FromImage());var o=t.get_FromChart()||"line"==n||"bentConnector2"==n||"bentConnector3"==n||"bentConnector4"==n||"bentConnector5"==n||"curvedConnector2"==n||"curvedConnector3"==n||"curvedConnector4"==n||"curvedConnector5"==n||"straightConnector1"==n;this.hideChangeTypeSettings(o),this._state.isFromImage=!!t.get_FromImage(),!o&&this.btnChangeShape.menu.items.length&&(this.btnChangeShape.menu.items[0].setVisible(t.get_FromImage()),this.btnChangeShape.menu.items[1].setVisible(!t.get_FromImage()));var s=null,a=t.get_fill(),l=a.get_type(),r=null,c=a.get_transparent();if((Math.abs(this._state.Transparency-c)>.001||Math.abs(this.numTransparency.getNumberValue()-c)>.001||(null===this._state.Transparency||null===c)&&(this._state.Transparency!==c||this.numTransparency.getNumberValue()!==c))&&(void 0!==c&&(this.sldrTransparency.setValue(null===c?100:c/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=c),null===a||null===l)this.OriginalFillType=null;else if(l==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(l==Asc.c_oAscFill.FILL_TYPE_SOLID)a=a.get_fill(),r=a.get_color(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(l==Asc.c_oAscFill.FILL_TYPE_BLIP)a=a.get_fill(),this.BlipFillType=a.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(l==Asc.c_oAscFill.FILL_TYPE_PATT){if(a=a.get_fill(),this.PatternFillType=a.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var s=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(s),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}r=a.get_color_fg(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.FGColor={Value:1,Color:"000000"},r=a.get_color_bg(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.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[this.GradColor.colors.length-1]="ffffff"}else if(l==Asc.c_oAscFill.FILL_TYPE_GRAD){a=a.get_fill();var d=a.get_grad_type();if(this._state.GradFillType===d&&this.GradFillType===d||(this.GradFillType=d,s=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),s=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,s.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var h=Math.floor(a.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-h)>.001){this.GradLinearDirectionType=h;var p=this.mnuDirectionPicker.store.findWhere({type:h});this.mnuDirectionPicker.selectRecord(p,!0),p?this.btnDirection.setIconCls("item-gradient "+p.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(h,!0)}}else this.numGradientAngle.setValue(0,!0);var u=this,m=a.get_colors(),g=a.get_positions(),f=m?m.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(f),this.GradColor.colors.length>f&&(this.GradColor.colors.splice(f,this.GradColor.colors.length-f),this.GradColor.values.splice(f,this.GradColor.colors.length-f),this.GradColor.currentIdx=0),m&&m.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(u.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(u.GradColor.colors[e])):u.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):u.GradColor.colors[e]="000000";var i=g[e];null!==i&&(i/=1e3,u.GradColor.values[e]=i)});for(var b=0;b=this.GradColor.colors.length)&&(u.GradColor.currentIdx=0),this.sldrGradient.setActiveThumb(u.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var C=typeof this.ShapeColor.Color,v=typeof this._state.ShapeColor;if(C!==v||"object"==C&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=C&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),_=!0;break}_||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var w,x=t.get_stroke(),S=x.get_type(),A="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(x?(S==Asc.c_oAscStrokeType.STROKE_COLOR?(r=x.get_color(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},w=x.asc_getPrstDash()):(S=null,this.BorderColor={Value:0,Color:"transparent"}),C=typeof this.BorderColor.Color,v=typeof this._state.StrokeColor,A||C!==v||"object"==C&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=C&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),_=!0;break}_||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==S||S==Asc.c_oAscStrokeType.STROKE_COLOR){if(S==Asc.c_oAscStrokeType.STROKE_COLOR){var T=x.get_width(),k=Math.abs(this._state.StrokeWidth-T)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-T)>1e-5||k||(null===this._state.StrokeWidth||null===T)&&this._state.StrokeWidth!==T){this._state.StrokeWidth=T,null!==T&&(T=this._mm2pt(T));var I=null===T?T:i.find(this.cmbBorderSize.store.models,function(t){if(Tt.attributes.value-1e-5)return!0});I?this.cmbBorderSize.selectRecord(I):this.cmbBorderSize.setValue(null!==T?parseFloat(T.toFixed(2))+" "+this.txtPt:""),this.BorderSize=T}}else S==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=S}if(this._state.StrokeBorderType!==w&&(this.BorderType=this._state.StrokeBorderType=w,this.cmbBorderType.setValue(w)),C=typeof this.FGColor.Color,v=typeof this._state.FGColor,C!==v||"object"==C&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=C&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),_=!0;break}_||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(C=typeof this.BGColor.Color,v=typeof this._state.BGColor,C!==v||"object"==C&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=C&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),_=!0;break}_||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(r=this.GradColor.colors[this.GradColor.currentIdx],C=typeof r,v=typeof this._state.GradColor,C!==v||"object"==C&&(r.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(r.color)<0)||"object"!=C&&this._state.GradColor.indexOf(r)<0){if(this.btnGradColor.setColor(r),"object"==typeof r){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==r.effectValue){this.colorsGrad.select(r,!0),_=!0;break}_||this.colorsGrad.clearSelection()}else this.colorsGrad.select(r,!0);this._state.GradColor=r}this.chShadow.setValue(!!t.asc_getShadow(),!0),this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#shape-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.fillControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
','',"
"].join("")),this.cmbPattern.render(e("#shape-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.fillControls.push(this.cmbPattern),this.btnSelectImage=new Common.UI.Button({parentEl:e("#shape-button-replace"),cls:"btn-text-menu-default",caption:this.textSelectImage,style:"width:100%;",menu:new Common.UI.Menu({style:"min-width: 194px;",maxHeight:200,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.fillControls.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",i.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage||this.mode.fileChoiceUrl&&this.mode.fileChoiceUrl.indexOf("{documentType}")>-1),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#shape-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.fillControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#shape-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.numTransparency.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.fillControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#shape-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.fillControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#shape-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#shape-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#shape-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.fillControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-shape-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
')})}),this.btnDirection.render(e("#shape-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.fillControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#shape-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.fillControls.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#shape-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked}),this.fillControls.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#shape-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.fillControls.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#shape-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.fillControls.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#shape-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked}),this.fillControls.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#shape-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#shape-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnChangeShape=new Common.UI.Button({parentEl:e("#shape-btn-change"),cls:"btn-icon-default",iconCls:"btn-change-shape",menu:new Common.UI.Menu({menuAlign:"tr-br",cls:"menu-shapes",items:[]})}),this.lockedControls.push(this.btnChangeShape),this.btnRotate270=new Common.UI.Button({parentEl:e("#shape-button-270",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({parentEl:e("#shape-button-90",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({parentEl:e("#shape-button-flipv",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({parentEl:e("#shape-button-fliph",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),this.chShadow=new Common.UI.CheckBox({el:e("#shape-checkbox-shadow"),labelText:this.strShadow}),this.chShadow.on("change",i.bind(this.onCheckShadow,this)),this.lockedControls.push(this.chShadow),this.linkAdvanced=e("#shape-advanced-link"),e(this.el).on("click","#shape-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.onApiAutoShapes(),this.UpdateThemeColors()},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#shape-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
')}]}),this.textureMenu.render(e("#shape-combo-fill-texture")),this.fillControls.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-shape-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.put_fill(s),this.api.ShapeApply(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},onCheckShadow:function(t,e,i,n){if(this.api){var o=new Asc.asc_CShapeProperty;o.asc_putShadow("checked"==t.getValue()?new Asc.asc_CShadowProperty:null),this.api.ShapeApply(o)}this.fireEvent("editcomplete",this)},onApiAutoShapes:function(){var t=this,e=function(i){t.fillAutoShapes(),i.off("show:before",e)};t.btnChangeShape.menu.on("show:before",e)},fillAutoShapes:function(){var t=this,n=this.application.getCollection("ShapeGroups"),o=n.length,s=function(a){for(var l=-1;l0;l++){var r=n.at(l>-1?l:0).get("groupStore");l<0&&(r=r.clone(),r.shift());new Common.UI.DataViewSimple({el:e("#id-shape-menu-shapegroup"+(l+1),a.items[l+1].$el),store:r,parentMenu:a.items[l+1].menu,itemTemplate:i.template('
')}).on("item:click",function(e,i,n,o){t.api&&(t.api.ChangeShapeType(n.get("data").shapeType),t.fireEvent("editcomplete",t)),"click"!==o.type&&t.btnChangeShape.menu.hide()})}a.off("show:after",s)};t.btnChangeShape.menu.on("show:after",s);for(var a=-1;a0;a++){var l=n.at(a>-1?a:a+1),r=new Common.UI.MenuItem({caption:l.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tr-tl",items:[{template:i.template('')}]})});t.btnChangeShape.menu.addItem(r)}t.btnChangeShape.menu.items[0].setVisible(t._state.isFromImage),t.btnChangeShape.menu.items[1].setVisible(!t._state.isFromImage)},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#shape-back-color-btn"),transparent:!0,color:"transparent"}),this.fillControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#shape-foreground-color-btn"),color:"000000"}),this.fillControls.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#shape-background-color-btn"),color:"ffffff"}),this.fillControls.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#shape-gradient-color-btn"),color:"000000"}),this.fillControls.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#shape-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=this.btnBorderColor.getPicker(),this.btnBorderColor.on("color:select",i.bind(this.onColorsBorderSelect,this))),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()))},onBtnRotateClick:function(t){var e=new Asc.asc_CShapeProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.api.ShapeApply(e),this.fireEvent("editcomplete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CShapeProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ShapeApply(e),this.fireEvent("editcomplete",this)},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},disableFillPanels:function(t){this._state.DisabledFillPanels!==t&&(this._state.DisabledFillPanels=t,i.each(this.fillControls,function(e){e.setDisabled(t)}),this.lblTransparencyStart.toggleClass("disabled",t),this.lblTransparencyEnd.toggleClass("disabled",t),this.numGradientAngle.setDisabled(t||this.GradFillType!==Asc.c_oAscFillGradType.GRAD_LINEAR))},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t,e){this._initSettings||(this.disableFillPanels(t||e),this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)))},hideShapeOnlySettings:function(t){this._state.HideShapeOnlySettings!==t&&(this._state.HideShapeOnlySettings=t,this.ShapeOnlySettings.toggleClass("hidden",1==t))},hideChangeTypeSettings:function(t){this._state.HideChangeTypeSettings!==t&&(this._state.HideChangeTypeSettings=t,this.CanChangeType.toggleClass("hidden",1==t))},onPositionChange:function(t){var e=t.getNumberValue(),i=this.GradColor.currentIdx-1<0?0:this.GradColor.values[this.GradColor.currentIdx-1],n=this.GradColor.currentIdx+1n;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=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);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_fill(a),this.api.ShapeApply(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_fill(s),this.api.ShapeApply(o)}},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",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 Points",textBorderSizeErr:"The entered value is incorrect.
Please enter a value between 0 pt and 1584 pt.",strType:"Type",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",strShadow:"Show shadow",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.ShapeSettings||{}))}),define("text!presentationeditor/main/app/template/SlideSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
'}),define("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(t,e,i,n){"use strict";PE.Views.SlideSettings=n.View.extend(i.extend({el:"#id-slide-settings",template:i.template(t),events:{},options:{alias:"SlideSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,this._noApply=!0,this._sendUndoPoint=!0,this._sliderChanged=!1,this._texturearray=null,this.FillItems=[],this._locked={background:!1,effects:!1,timing:!1,header:!1},this._stateDisabled={},this._state={FillType:void 0,SlideColor:"ffffff",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR},this.OriginalFillType=void 0,this.SlideColor={Value:1,Color:"ffffff"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.Effect=Asc.c_oAscSlideTransitionTypes.None,this.EffectType=void 0,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();var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#slide-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc,disabled:!0}),this.cmbFillSrc.setValue(Asc.c_oAscFill.FILL_TYPE_SOLID),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#slide-back-color-btn"),disabled:!0,transparent:!0,menu:!0,color:"ffffff"}),this.FillItems.push(this.btnBackColor),this.FillColorContainer=e("#slide-panel-color-fill"),this.FillImageContainer=e("#slide-panel-image-fill"),this.FillPatternContainer=e("#slide-panel-pattern-fill"),this.FillGradientContainer=e("#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:e("#slide-combo-effect-name"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrEffectName,disabled:!0}),this.cmbEffectName.setValue(""),this.cmbEffectName.on("selected",i.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:e("#slide-combo-effect-type"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrEffectType,disabled:!0}),this.cmbEffectType.setValue(""),this.cmbEffectType.on("selected",i.bind(this.onEffectTypeSelect,this)),this.numDuration=new Common.UI.MetricSpinner({el:e("#slide-spin-duration"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDuration.on("change",i.bind(this.onDurationChange,this)),this.numDuration.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.numDelay=new Common.UI.MetricSpinner({el:e("#slide-spin-delay"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDelay.on("change",i.bind(this.onDelayChange,this)),this.numDelay.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.chStartOnClick=new Common.UI.CheckBox({el:e("#slide-checkbox-start-click"),labelText:this.strStartOnClick,disabled:!0}),this.chStartOnClick.on("change",i.bind(this.onStartOnClickChange,this)),this.chDelay=new Common.UI.CheckBox({el:e("#slide-checkbox-delay"),labelText:this.strDelay,disabled:!0}),this.chDelay.on("change",i.bind(this.onCheckDelayChange,this)),this.btnPreview=new Common.UI.Button({el:e("#slide-button-preview"),disabled:!0}),this.btnPreview.on("click",i.bind(function(t){this.api&&this.api.SlideTransitionPlay(),this.fireEvent("editcomplete",this)},this)),this.btnApplyToAll=new Common.UI.Button({el:e("#slide-button-apply-all"),disabled:!0}),this.btnApplyToAll.on("click",i.bind(function(t){this.api&&this.api.SlideTimingApplyToAll(),this.fireEvent("editcomplete",this)},this)),this.chSlideNum=new Common.UI.CheckBox({el:e("#slide-checkbox-slidenum"),labelText:this.strSlideNum,disabled:!0}),this.chSlideNum.on("change",i.bind(this.onHeaderChange,this,"slidenum")),this.chDateTime=new Common.UI.CheckBox({el:e("#slide-checkbox-datetime"),labelText:this.strDateTime,disabled:!0}),this.chDateTime.on("change",i.bind(this.onHeaderChange,this,"datetime"))},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.SetInterfaceDrawImagePlaceSlide("slide-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),Common.NotificationCenter.on("storage:image-insert",i.bind(this.insertImageFromStorage,this)),this},setMode:function(t){this.mode=t},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.SlideColor.Color?{color:"4f81bd",effectId:24}:this.SlideColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;if(n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.put_background(n),this.api.SetSlideProps(i)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.SlideColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;"transparent"==this.SlideColor.Color?(n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.SlideColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(t,e){if(this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(t,e){if(this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(this.GradLinearDirectionType,!0),this.numGradientAngle.setDisabled(this._locked.background)}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(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.CAscSlideProps,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.put_background(l),this.api.SetSlideProps(a)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.CAscSlideProps,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i)),t.put_background(e),this.api.SetSlideProps(t),this._sliderChanged=!1}},setImageUrl:function(t,e){if(null!==this.BlipFillType){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),n.get_fill().put_url(t,e),i.put_background(n),this.api.SetSlideProps(i)}},insertImageFromStorage:function(t){t&&t.url&&"slide"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","slide"):(this.api&&this.api.ChangeSlideImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this))},createDelayedControls:function(){var t=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=i.template(['
','',"
"].join("")),this.cmbPattern.render(e("#slide-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.FillItems.push(this.cmbPattern),this.btnSelectImage=new Common.UI.Button({parentEl:e("#slide-button-replace"),cls:"btn-text-menu-default",caption:this.textSelectImage,style:"width:100%;",menu:new Common.UI.Menu({style:"min-width: 194px;",maxHeight:200,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.FillItems.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",i.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage||this.mode.fileChoiceUrl&&this.mode.fileChoiceUrl.indexOf("{documentType}")>-1),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#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",i.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:e("#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",i.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:i.template('
')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-slide-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
')})}),this.btnDirection.render(e("#slide-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.FillItems.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#slide-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n), -t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.FillItems.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#slide-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked.background,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.FillItems.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked.background,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.FillItems.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#slide-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)})},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.UpdateThemeColors()},onInitStandartTextures:function(t){ - - var n=this; - if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){ - console.log(t, t.get_image()); - n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1}) - })),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){ - this.btnTexture=new Common.UI.ComboBox({el:e("#slide-combo-fill-texture"),template:i.template(['"].join(""))}) - ,this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
')}]}), - this.textureMenu.render(e("#slide-combo-fill-texture")), - this.FillItems.push(this.btnTexture); - var o=function(t){ - new Common.UI.DataView({ - el:e("#id-slide-menu-texture"), - restoreHeight:174, - parentMenu:t,showLast:!1, - store:new Common.UI.DataViewStore(n._texturearray||[]), - itemTemplate:i.template('
') - }).on("item:click",i.bind(n.onSelectTexture,n)), - t.off("show:before",o) - }; - this.textureMenu.on("show:before",o) - } -}, - -onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.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(n.get("type")),o.put_background(s),this.api.SetSlideProps(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillEffectTypeCombo:function(t){var e=[];switch(t){case Asc.c_oAscSlideTransitionTypes.Fade:e.push(this._arrEffectType[0],this._arrEffectType[1]);break;case Asc.c_oAscSlideTransitionTypes.Push:e=this._arrEffectType.slice(2,6);break;case Asc.c_oAscSlideTransitionTypes.Wipe:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Split:e=this._arrEffectType.slice(10,14);break;case Asc.c_oAscSlideTransitionTypes.UnCover:case Asc.c_oAscSlideTransitionTypes.Cover:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Clock:e=this._arrEffectType.slice(14,17);break;case Asc.c_oAscSlideTransitionTypes.Zoom:e=this._arrEffectType.slice(17)}e.length>0?(this.cmbEffectType.store.reset(e),this.cmbEffectType.setValue(e[0].value),this.EffectType=e[0].value):(this.cmbEffectType.store.reset(),this.EffectType=void 0),this.cmbEffectType.setDisabled(e.length<1||this._locked.effects),this.numDuration.setDisabled(e.length<1||this._locked.effects),this.btnPreview.setDisabled(e.length<1||this._locked.effects)},onEffectNameSelect:function(t,e){var i=e.value;if(this.Effect!==i&&(this.Effect!==Asc.c_oAscSlideTransitionTypes.Wipe&&this.Effect!==Asc.c_oAscSlideTransitionTypes.UnCover&&this.Effect!==Asc.c_oAscSlideTransitionTypes.Cover||i!==Asc.c_oAscSlideTransitionTypes.Wipe&&i!==Asc.c_oAscSlideTransitionTypes.UnCover&&i!==Asc.c_oAscSlideTransitionTypes.Cover)&&this.fillEffectTypeCombo(i),this.Effect=i,this.api&&!this._noApply){var n=new Asc.CAscSlideProps,o=new Asc.CAscSlideTiming;o.put_TransitionType(i),o.put_TransitionOption(this.EffectType),n.put_timing(o),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onEffectTypeSelect:function(t,e){if(this.EffectType=e.value,this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.CAscSlideTiming;n.put_TransitionType(this.Effect),n.put_TransitionOption(this.EffectType),i.put_timing(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onDurationChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_TransitionDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onDelayChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onStartOnClickChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceOnMouseClick("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onCheckDelayChange:function(t,e,i,n){if(this.numDelay.setDisabled("checked"!==t.getValue()),this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceAfter("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onHeaderChange:function(t,e,i,n,o){if(this.api&&!this._noApply){var s=this.api.asc_getHeaderFooterProperties();s.get_Slide()["slidenum"==t?"put_ShowSlideNum":"put_ShowDateTime"]("checked"==e.getValue()),this.api.asc_setHeaderFooterProperties(s)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.colorsBack||(this.btnBackColor.setMenu(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.colorsBack=this.btnBackColor.getPicker(),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#slide-foreground-color-btn"),color:"000000"}),this.FillItems.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#slide-background-color-btn"),color:"ffffff"}),this.FillItems.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#slide-gradient-color-btn"),color:"000000"}),this.FillItems.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this))),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(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD)},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.SetSlideDisabled(this._locked.background,this._locked.effects,this._locked.timing,this._locked.header),t){this._originalProps=t,this._noApply=!0;var n=null,o=t.get_background(),s=o.get_type(),a=null;if(null===o||null===s||s==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(s==Asc.c_oAscFill.FILL_TYPE_SOLID)o=o.get_fill(),a=o.get_color(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.SlideColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.SlideColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.SlideColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.SlideColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(s==Asc.c_oAscFill.FILL_TYPE_BLIP)o=o.get_fill(),this.BlipFillType=o.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(s==Asc.c_oAscFill.FILL_TYPE_PATT){if(o=o.get_fill(),this.PatternFillType=o.get_pattern_type(),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}a=o.get_color_fg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.FGColor={Value:1,Color:"000000"},a=o.get_color_bg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.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[this.GradColor.colors.length-1]="ffffff"}else if(s==Asc.c_oAscFill.FILL_TYPE_GRAD){o=o.get_fill();var l=o.get_grad_type();if(this._state.GradFillType===l&&this.GradFillType===l||(this.GradFillType=l,n=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),n=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,n.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var r=Math.floor(o.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-r)>.001){this.GradLinearDirectionType=r;var c=this.mnuDirectionPicker.store.findWhere({type:r});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(r,!0)}}else this.numGradientAngle.setValue(0,!0);var d=this,h=o.get_colors(),p=o.get_positions(),u=h?h.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(u),this.GradColor.colors.length>u&&(this.GradColor.colors.splice(u,this.GradColor.colors.length-u),this.GradColor.values.splice(u,this.GradColor.colors.length-u),this.GradColor.currentIdx=0),h&&h.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(d.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(d.GradColor.colors[e])):d.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):d.GradColor.colors[e]="000000";var i=p[e];null!==i&&(i/=1e3,d.GradColor.values[e]=i)});for(var m=0;m=this.GradColor.colors.length)&&(d.GradColor.currentIdx=0),d.sldrGradient.setActiveThumb(d.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),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)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var g=typeof this.SlideColor.Color,f=typeof this._state.SlideColor;if(g!==f||"object"==g&&(this.SlideColor.Color.effectValue!==this._state.SlideColor.effectValue||this._state.SlideColor.color.indexOf(this.SlideColor.Color.color)<0)||"object"!=g&&this._state.SlideColor.indexOf(this.SlideColor.Color)<0){if(this.btnBackColor.setColor(this.SlideColor.Color),"object"==typeof this.SlideColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.SlideColor.Color.effectValue){this.colorsBack.select(this.SlideColor.Color,!0),b=!0;break}b||this.colorsBack.clearSelection()}else this.colorsBack.select(this.SlideColor.Color,!0);this._state.SlideColor=this.SlideColor.Color}var v=t.get_timing();if(v){var r=v.get_TransitionType(),_=!1;if(this._state.Effect!==r){var y=this.cmbEffectName.store.findWhere({value:r});y?(_=!0,this.cmbEffectName.setValue(y.get("value"))):this.cmbEffectName.setValue(""),this.fillEffectTypeCombo(_?r:void 0),this.Effect=r,this._state.Effect=r}r=v.get_TransitionOption(),(this._state.EffectType!==r||_)&&(_=!1,y=this.cmbEffectType.store.findWhere({value:r}),y?(_=!0,this.cmbEffectType.setValue(y.get("value"))):this.cmbEffectType.setValue(""),this._state.EffectType=r),r=v.get_TransitionDuration(),(Math.abs(this._state.Duration-r)>.001||(null===this._state.Duration||null===r)&&this._state.Duration!==r||(void 0===this._state.Duration||void 0===r)&&this._state.Duration!==r)&&(this.numDuration.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Duration=r),r=v.get_SlideAdvanceDuration(),(Math.abs(this._state.Delay-r)>.001||(null===this._state.Delay||null===r)&&this._state.Delay!==r||(void 0===this._state.Delay||void 0===r)&&this._state.Delay!==r)&&(this.numDelay.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Delay=r),r=v.get_SlideAdvanceOnMouseClick(),this._state.OnMouseClick!==r&&(this.chStartOnClick.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this._state.OnMouseClick=r),r=v.get_SlideAdvanceAfter(),this._state.AdvanceAfter!==r&&(this.chDelay.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this.numDelay.setDisabled("checked"!==this.chDelay.getValue()),this._state.AdvanceAfter=r)}if(g=typeof this.FGColor.Color,f=typeof this._state.FGColor,g!==f||"object"==g&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=g&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),b=!0;break}b||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(g=typeof this.BGColor.Color,f=typeof this._state.BGColor,g!==f||"object"==g&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=g&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),b=!0;break}b||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(a=this.GradColor.colors[this.GradColor.currentIdx],g=typeof a,f=typeof this._state.GradColor,g!==f||"object"==g&&(a.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(a.color)<0)||"object"!=g&&this._state.GradColor.indexOf(a)<0){if(this.btnGradColor.setColor(a),"object"==typeof a){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==a.effectValue){this.colorsGrad.select(a,!0),b=!0;break}b||this.colorsGrad.clearSelection()}else this.colorsGrad.select(a,!0);this._state.GradColor=a}if(r=this.api.asc_getHeaderFooterProperties()){var w=r.get_Slide()||new AscCommonSlide.CAscHFProps;this.chSlideNum.setValue(!!w.get_ShowSlideNum(),!0),this.chDateTime.setValue(!!w.get_ShowDateTime(),!0)}this._noApply=!1}},setLocked:function(t,e,i,n){this._locked={background:t,effects:e,timing:i,header:n}},SetSlideDisabled:function(t,e,i,n){if(this._locked={background:t,effects:e,timing:i,header:n},!this._initSettings){if(t!==this._stateDisabled.background){this.cmbFillSrc.setDisabled(t);for(var o=0;on;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=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);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_background(a),this.api.SetSlideProps(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_background(s),this.api.SetSlideProps(o)}},strColor:"Color",strFill:"Background",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",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 Points",textSec:"s",strSlideNum:"Show Slide Number",strDateTime:"Show Date and Time",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.SlideSettings||{}))}),define("text!presentationeditor/main/app/template/TextArtSettings.template",[],function(){ +t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.FillItems.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#slide-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked.background,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.FillItems.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked.background,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.FillItems.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#slide-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)})},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.UpdateThemeColors()},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#slide-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
')}]}),this.textureMenu.render(e("#slide-combo-fill-texture")),this.FillItems.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-slide-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.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(n.get("type")),o.put_background(s),this.api.SetSlideProps(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillEffectTypeCombo:function(t){var e=[];switch(t){case Asc.c_oAscSlideTransitionTypes.Fade:e.push(this._arrEffectType[0],this._arrEffectType[1]);break;case Asc.c_oAscSlideTransitionTypes.Push:e=this._arrEffectType.slice(2,6);break;case Asc.c_oAscSlideTransitionTypes.Wipe:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Split:e=this._arrEffectType.slice(10,14);break;case Asc.c_oAscSlideTransitionTypes.UnCover:case Asc.c_oAscSlideTransitionTypes.Cover:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Clock:e=this._arrEffectType.slice(14,17);break;case Asc.c_oAscSlideTransitionTypes.Zoom:e=this._arrEffectType.slice(17)}e.length>0?(this.cmbEffectType.store.reset(e),this.cmbEffectType.setValue(e[0].value),this.EffectType=e[0].value):(this.cmbEffectType.store.reset(),this.EffectType=void 0),this.cmbEffectType.setDisabled(e.length<1||this._locked.effects),this.numDuration.setDisabled(e.length<1||this._locked.effects),this.btnPreview.setDisabled(e.length<1||this._locked.effects)},onEffectNameSelect:function(t,e){var i=e.value;if(this.Effect!==i&&(this.Effect!==Asc.c_oAscSlideTransitionTypes.Wipe&&this.Effect!==Asc.c_oAscSlideTransitionTypes.UnCover&&this.Effect!==Asc.c_oAscSlideTransitionTypes.Cover||i!==Asc.c_oAscSlideTransitionTypes.Wipe&&i!==Asc.c_oAscSlideTransitionTypes.UnCover&&i!==Asc.c_oAscSlideTransitionTypes.Cover)&&this.fillEffectTypeCombo(i),this.Effect=i,this.api&&!this._noApply){var n=new Asc.CAscSlideProps,o=new Asc.CAscSlideTiming;o.put_TransitionType(i),o.put_TransitionOption(this.EffectType),n.put_timing(o),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onEffectTypeSelect:function(t,e){if(this.EffectType=e.value,this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.CAscSlideTiming;n.put_TransitionType(this.Effect),n.put_TransitionOption(this.EffectType),i.put_timing(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onDurationChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_TransitionDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onDelayChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onStartOnClickChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceOnMouseClick("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onCheckDelayChange:function(t,e,i,n){if(this.numDelay.setDisabled("checked"!==t.getValue()),this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceAfter("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onHeaderChange:function(t,e,i,n,o){if(this.api&&!this._noApply){var s=this.api.asc_getHeaderFooterProperties();s.get_Slide()["slidenum"==t?"put_ShowSlideNum":"put_ShowDateTime"]("checked"==e.getValue()),this.api.asc_setHeaderFooterProperties(s)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.colorsBack||(this.btnBackColor.setMenu(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.colorsBack=this.btnBackColor.getPicker(),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#slide-foreground-color-btn"),color:"000000"}),this.FillItems.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#slide-background-color-btn"),color:"ffffff"}),this.FillItems.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#slide-gradient-color-btn"),color:"000000"}),this.FillItems.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this))),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(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD)},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.SetSlideDisabled(this._locked.background,this._locked.effects,this._locked.timing,this._locked.header),t){this._originalProps=t,this._noApply=!0;var n=null,o=t.get_background(),s=o.get_type(),a=null;if(null===o||null===s||s==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(s==Asc.c_oAscFill.FILL_TYPE_SOLID)o=o.get_fill(),a=o.get_color(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.SlideColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.SlideColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.SlideColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.SlideColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(s==Asc.c_oAscFill.FILL_TYPE_BLIP)o=o.get_fill(),this.BlipFillType=o.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(s==Asc.c_oAscFill.FILL_TYPE_PATT){if(o=o.get_fill(),this.PatternFillType=o.get_pattern_type(),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}a=o.get_color_fg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.FGColor={Value:1,Color:"000000"},a=o.get_color_bg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.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[this.GradColor.colors.length-1]="ffffff"}else if(s==Asc.c_oAscFill.FILL_TYPE_GRAD){o=o.get_fill();var l=o.get_grad_type();if(this._state.GradFillType===l&&this.GradFillType===l||(this.GradFillType=l,n=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),n=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,n.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var r=Math.floor(o.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-r)>.001){this.GradLinearDirectionType=r;var c=this.mnuDirectionPicker.store.findWhere({type:r});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(r,!0)}}else this.numGradientAngle.setValue(0,!0);var d=this,h=o.get_colors(),p=o.get_positions(),u=h?h.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(u),this.GradColor.colors.length>u&&(this.GradColor.colors.splice(u,this.GradColor.colors.length-u),this.GradColor.values.splice(u,this.GradColor.colors.length-u),this.GradColor.currentIdx=0),h&&h.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(d.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(d.GradColor.colors[e])):d.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):d.GradColor.colors[e]="000000";var i=p[e];null!==i&&(i/=1e3,d.GradColor.values[e]=i)});for(var m=0;m=this.GradColor.colors.length)&&(d.GradColor.currentIdx=0),d.sldrGradient.setActiveThumb(d.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),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)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var g=typeof this.SlideColor.Color,f=typeof this._state.SlideColor;if(g!==f||"object"==g&&(this.SlideColor.Color.effectValue!==this._state.SlideColor.effectValue||this._state.SlideColor.color.indexOf(this.SlideColor.Color.color)<0)||"object"!=g&&this._state.SlideColor.indexOf(this.SlideColor.Color)<0){if(this.btnBackColor.setColor(this.SlideColor.Color),"object"==typeof this.SlideColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.SlideColor.Color.effectValue){this.colorsBack.select(this.SlideColor.Color,!0),b=!0;break}b||this.colorsBack.clearSelection()}else this.colorsBack.select(this.SlideColor.Color,!0);this._state.SlideColor=this.SlideColor.Color}var v=t.get_timing();if(v){var r=v.get_TransitionType(),_=!1;if(this._state.Effect!==r){var y=this.cmbEffectName.store.findWhere({value:r});y?(_=!0,this.cmbEffectName.setValue(y.get("value"))):this.cmbEffectName.setValue(""),this.fillEffectTypeCombo(_?r:void 0),this.Effect=r,this._state.Effect=r}r=v.get_TransitionOption(),(this._state.EffectType!==r||_)&&(_=!1,y=this.cmbEffectType.store.findWhere({value:r}),y?(_=!0,this.cmbEffectType.setValue(y.get("value"))):this.cmbEffectType.setValue(""),this._state.EffectType=r),r=v.get_TransitionDuration(),(Math.abs(this._state.Duration-r)>.001||(null===this._state.Duration||null===r)&&this._state.Duration!==r||(void 0===this._state.Duration||void 0===r)&&this._state.Duration!==r)&&(this.numDuration.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Duration=r),r=v.get_SlideAdvanceDuration(),(Math.abs(this._state.Delay-r)>.001||(null===this._state.Delay||null===r)&&this._state.Delay!==r||(void 0===this._state.Delay||void 0===r)&&this._state.Delay!==r)&&(this.numDelay.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Delay=r),r=v.get_SlideAdvanceOnMouseClick(),this._state.OnMouseClick!==r&&(this.chStartOnClick.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this._state.OnMouseClick=r),r=v.get_SlideAdvanceAfter(),this._state.AdvanceAfter!==r&&(this.chDelay.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this.numDelay.setDisabled("checked"!==this.chDelay.getValue()),this._state.AdvanceAfter=r)}if(g=typeof this.FGColor.Color,f=typeof this._state.FGColor,g!==f||"object"==g&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=g&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),b=!0;break}b||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(g=typeof this.BGColor.Color,f=typeof this._state.BGColor,g!==f||"object"==g&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=g&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),b=!0;break}b||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(a=this.GradColor.colors[this.GradColor.currentIdx],g=typeof a,f=typeof this._state.GradColor,g!==f||"object"==g&&(a.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(a.color)<0)||"object"!=g&&this._state.GradColor.indexOf(a)<0){if(this.btnGradColor.setColor(a),"object"==typeof a){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==a.effectValue){this.colorsGrad.select(a,!0),b=!0;break}b||this.colorsGrad.clearSelection()}else this.colorsGrad.select(a,!0);this._state.GradColor=a}if(r=this.api.asc_getHeaderFooterProperties()){var w=r.get_Slide()||new AscCommonSlide.CAscHFProps;this.chSlideNum.setValue(!!w.get_ShowSlideNum(),!0),this.chDateTime.setValue(!!w.get_ShowDateTime(),!0)}this._noApply=!1}},setLocked:function(t,e,i,n){this._locked={background:t,effects:e,timing:i,header:n}},SetSlideDisabled:function(t,e,i,n){if(this._locked={background:t,effects:e,timing:i,header:n},!this._initSettings){if(t!==this._stateDisabled.background){this.cmbFillSrc.setDisabled(t);for(var o=0;on;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=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);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_background(a),this.api.SetSlideProps(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_background(s),this.api.SetSlideProps(o)}},strColor:"Color",strFill:"Background",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",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 Points",textSec:"s",strSlideNum:"Show Slide Number",strDateTime:"Show Date and Time",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.SlideSettings||{}))}),define("text!presentationeditor/main/app/template/TextArtSettings.template",[],function(){ return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
'}),define("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(t,e,i,n){"use strict";PE.Views.TextArtSettings=n.View.extend(i.extend({el:"#id-textart-settings",template:i.template(t),events:{},options:{alias:"TextArtSettings"},initialize:function(){this._initSettings=!0,this._noApply=!0,this.shapeprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this._texturearray=null,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,FormId:null,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this.FillColorContainer=e("#textart-panel-color-fill"),this.FillImageContainer=e("#textart-panel-image-fill"),this.FillPatternContainer=e("#textart-panel-pattern-fill"),this.FillGradientContainer=e("#textart-panel-gradient-fill"),this.TransparencyContainer=e("#textart-panel-transparent-fill"),PE.getCollection("Common.Collections.TextArt").bind({reset:this.fillTextArt.bind(this)})},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.SetInterfaceDrawImagePlaceTextArt("textart-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.ShapeColor.Color?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;if(n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.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:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.ShapeColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;"transparent"==this.ShapeColor.Color?(n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(t,e){if(this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(t,e){if(this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onNumTransparencyChange:function(t,e,i,n){if(this.sldrTransparency.setValue(t.getNumberValue(),!0),this.api){var o=t.getNumberValue(),s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_transparent(2.55*o),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops)}},onTransparencyChange:function(t,e,n){this._sliderChanged=e,this.numTransparency.setValue(e,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=e,this._sendUndoPoint||(this.api.setEndPointHistory(),this._transparencyApplyFunc()),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(void 0!==this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_transparent(2.55*this._sliderChanged),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops),this._sliderChanged=void 0}},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(this.GradLinearDirectionType,!0),this.numGradientAngle.setDisabled(this._locked)}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(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.asc_TextArtProperties,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.asc_putFill(l),this.shapeprops.put_TextArtProperties(a),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i)),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=Common.Utils.String.parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_TextArtProperties,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.asc_putLine(i),this.shapeprops.put_TextArtProperties(e),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){s.fireEvent("editcomplete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(t,e){if(this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)&&null!==t.BlipFillType){var s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),a.put_fill(new Asc.asc_CFillBlip),a.get_fill().put_type(t.BlipFillType),a.get_fill().put_url(o),s.asc_putFill(a),t.shapeprops.put_TextArtProperties(s),t.api.ShapeApply(t.shapeprops)}}t.fireEvent("editcomplete",t)}}).show()},ChangeSettings:function(t){if(null==this.shapeprops&&(this.shapeprops=new Asc.asc_CShapeProperty),this._initSettings&&this.createDelayedElements(),t&&t.get_TextArtProperties()){var n=t.get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var o=null,s=n.asc_getFill(),a=s?s.get_type():null,l=null;if(s){var r=s.get_transparent();(Math.abs(this._state.Transparency-r)>.001||Math.abs(this.numTransparency.getNumberValue()-r)>.001||(null===this._state.Transparency||null===r)&&(this._state.Transparency!==r||this.numTransparency.getNumberValue()!==r))&&(void 0!==r&&(this.sldrTransparency.setValue(null===r?100:r/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=r)}if(null===s||void 0===s||null===a)this.OriginalFillType=null;else if(a==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(a==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.get_fill(),l=s.get_color(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(a==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(a==Asc.c_oAscFill.FILL_TYPE_PATT){if(s=s.get_fill(),this.PatternFillType=s.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var o=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(o),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}l=s.get_color_fg(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.FGColor={Value:1,Color:"000000"},l=s.get_color_bg(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.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[this.GradColor.colors.length-1]="ffffff"}else if(a==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.get_fill();var c=s.get_grad_type();if(this._state.GradFillType===c&&this.GradFillType===c||(this.GradFillType=c,o=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),o=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,o.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var d=Math.floor(s.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-d)>.001){this.GradLinearDirectionType=d;var h=this.mnuDirectionPicker.store.findWhere({type:d});this.mnuDirectionPicker.selectRecord(h,!0),h?this.btnDirection.setIconCls("item-gradient "+h.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(d,!0)}}else this.numGradientAngle.setValue(0,!0);var p=this,u=s.get_colors(),m=s.get_positions(),g=u?u.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(g),this.GradColor.colors.length>g&&(this.GradColor.colors.splice(g,this.GradColor.colors.length-g),this.GradColor.values.splice(g,this.GradColor.colors.length-g),this.GradColor.currentIdx=0),u&&u.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(p.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(p.GradColor.colors[e])):p.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):p.GradColor.colors[e]="000000";var i=m[e];null!==i&&(i/=1e3,p.GradColor.values[e]=i)});for(var f=0;f=this.GradColor.colors.length)&&(p.GradColor.currentIdx=0),p.sldrGradient.setActiveThumb(p.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var b=typeof this.ShapeColor.Color,C=typeof this._state.ShapeColor;if(b!==C||"object"==b&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=b&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),v=!0;break}v||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var y,w=n.asc_getLine(),x=w?w.get_type():null,S="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(w?(x==Asc.c_oAscStrokeType.STROKE_COLOR?(l=w.get_color(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},y=w.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},b=typeof this.BorderColor.Color,C=typeof this._state.StrokeColor,S||b!==C||"object"==b&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=b&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),v=!0;break}v||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==x||x==Asc.c_oAscStrokeType.STROKE_COLOR){if(x==Asc.c_oAscStrokeType.STROKE_COLOR){var A=w.get_width(),T=Math.abs(this._state.StrokeWidth-A)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-A)>1e-5||T||(null===this._state.StrokeWidth||null===A)&&this._state.StrokeWidth!==A){this._state.StrokeWidth=A,null!==A&&(A=this._mm2pt(A));var k=null===A?A:i.find(this.cmbBorderSize.store.models,function(t){if(At.attributes.value-1e-5)return!0});k?this.cmbBorderSize.selectRecord(k):this.cmbBorderSize.setValue(null!==A?parseFloat(A.toFixed(2))+" "+this.txtPt:""),this.BorderSize=A}}else x==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=x}if(this._state.StrokeBorderType!==y&&(this.BorderType=this._state.StrokeBorderType=y,this.cmbBorderType.setValue(y)),b=typeof this.FGColor.Color,C=typeof this._state.FGColor,b!==C||"object"==b&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=b&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),v=!0;break}v||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(b=typeof this.BGColor.Color,C=typeof this._state.BGColor,b!==C||"object"==b&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=b&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),v=!0;break}v||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(l=this.GradColor.colors[this.GradColor.currentIdx],b=typeof l,C=typeof this._state.GradColor,b!==C||"object"==b&&(l.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(l.color)<0)||"object"!=b&&this._state.GradColor.indexOf(l)<0){if(this.btnGradColor.setColor(l),"object"==typeof l){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==l.effectValue){this.colorsGrad.select(l,!0),v=!0;break}v||this.colorsGrad.clearSelection()}else this.colorsGrad.select(l,!0);this._state.GradColor=l}var I=n.asc_getForm();if(this._state.FormId!==I){this.cmbTransform.suspendEvents();var o=this.cmbTransform.menuPicker.store.findWhere({type:I});this.cmbTransform.menuPicker.selectRecord(o),this.cmbTransform.resumeEvents(),this._state.FormId=I}this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#textart-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.lockedControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
','',"
"].join("")),this.cmbPattern.render(e("#textart-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:e("#textart-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:e("#textart-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",i.bind(function(t){this.api&&this.api.ChangeArtImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#textart-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.lockedControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#textart-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.numTransparency.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#textart-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.lockedControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#textart-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#textart-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#textart-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.lockedControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-textart-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
')})}),this.btnDirection.render(e("#textart-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.lockedControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#textart-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.lockedControls.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#textart-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked}),this.lockedControls.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#textart-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.lockedControls.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#textart-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.lockedControls.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#textart-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked}),this.lockedControls.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#textart-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#textart-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.cmbTransform=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-textart"}),this.cmbTransform.render(e("#textart-combo-transform")),this.cmbTransform.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTransform.on("click",i.bind(this.onTransformSelect,this)),this.cmbTransform.openButton.menu.on("show:after",function(){t.cmbTransform.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTransform)},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this.onInitStandartTextures(),this.fillTextArt(),this.fillTransform(this.api.asc_getPropertyEditorTextArts())},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#textart-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
')}]}),this.textureMenu.render(e("#textart-combo-fill-texture")),this.lockedControls.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-textart-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.ShapeApply(this.shapeprops)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillTextArt:function(){if(!this._initSettings){var t=this;this.cmbTextArt||(this.cmbTextArt=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,showLast:!1,cls:"combo-textart"}),this.cmbTextArt.render(e("#textart-combo-template")),this.cmbTextArt.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTextArt.on("click",i.bind(this.onTextArtSelect,this)),this.cmbTextArt.openButton.menu.on("show:after",function(){t.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTextArt));var n=this.application.getCollection("Common.Collections.TextArt").models,o=this.cmbTextArt.menuPicker.store.length;if(n.length<1)return void PE.getController("Main").fillTextArt(this.api.asc_getTextArtPreviews());if(o>0&&o==n.length){var s=this.cmbTextArt.menuPicker.store.models;i.each(n,function(t,e){s[e].set("imageUrl",t.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(n),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))}},onTextArtSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putStyle(e.get("data")),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},fillTransform:function(t){if(t&&t.length>1&&t[1]){for(var e=[],n=t[1],o=0;o0&&i.each(s,function(t){e.push({imageUrl:t.Image,type:t.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(e),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putForm(e.get("type")),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#textart-back-color-btn"),transparent:!0,color:"transparent"}),this.lockedControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#textart-foreground-color-btn"),color:"000000"}),this.lockedControls.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#textart-background-color-btn"),color:"ffffff"}),this.lockedControls.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#textart-gradient-color-btn"),color:"000000"}),this.lockedControls.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#textart-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=this.btnBorderColor.getPicker(),this.btnBorderColor.on("color:select",i.bind(this.onColorsBorderSelect,this))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.numGradientAngle.setDisabled(t||this.GradFillType!==Asc.c_oAscFillGradType.GRAD_LINEAR))},onPositionChange:function(t){var e=t.getNumberValue(),i=this.GradColor.currentIdx-1<0?0:this.GradColor.values[this.GradColor.currentIdx-1],n=this.GradColor.currentIdx+1n;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=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);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.ShapeApply(this.shapeprops)}},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",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 Points",textBorderSizeErr:"The entered value is incorrect.
Please enter a value between 0 pt and 1584 pt.",textTransform:"Transform",textTemplate:"Template",strType:"Type",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.TextArtSettings||{}))}),define("text!presentationeditor/main/app/template/SignatureSettings.template",[],function(){return'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n \n
\n
\n
\n \n
'}),define("presentationeditor/main/app/view/SignatureSettings",["text!presentationeditor/main/app/template/SignatureSettings.template","jquery","underscore","backbone","common/main/lib/component/Button"],function(t,e,i,n){"use strict";PE.Views.SignatureSettings=n.View.extend(i.extend({el:"#id-signature-settings",template:i.template(t),events:{},options:{alias:"SignatureSettings"},initialize:function(){this._state={DisabledEditing:!1,ready:!1,hasValid:!1,hasInvalid:!1,tip:void 0},this._locked=!1,this.render()},render:function(){this.$el.html(this.template({scope:this}));var t=PE.getController("Common.Controllers.Protection").getView();this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#signature-invisible-sign")),this.viewValidList=new Common.UI.DataView({el:e("#signature-valid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['
','
nomargin<% } %>">
','
<%= Common.Utils.String.htmlEncode(name) %>
','
<%= Common.Utils.String.htmlEncode(date) %>
',"
"].join(""))}),this.viewInvalidList=new Common.UI.DataView({el:e("#signature-invalid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['
','
nomargin<% } %>">
','
<%= Common.Utils.String.htmlEncode(name) %>
','
<%= Common.Utils.String.htmlEncode(date) %>
',"
"].join(""))}),this.viewValidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewInvalidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewValidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.viewInvalidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.signatureMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.strDetails,value:1},{caption:this.strDelete,value:3}]}),this.signatureMenu.on("item:click",i.bind(this.onMenuSignatureClick,this))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateSignatures",i.bind(this.onApiUpdateSignatures,this)),Common.NotificationCenter.on("document:ready",i.bind(this.onDocumentReady,this)),this},ChangeSettings:function(t){this._state.hasValid||this._state.hasInvalid||this.updateSignatures(this.api.asc_getSignatures())},setLocked:function(t){this._locked=t},setMode:function(t){this.mode=t},onApiUpdateSignatures:function(t){this._state.ready&&(this.updateSignatures(t),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid))},updateSignatures:function(t){var e=this,n=[],o=[];i.each(t,function(t,e){var s=t.asc_getDate(),a={name:t.asc_getSigner1(),certificateId:t.asc_getId(),guid:t.asc_getGuid(),date:i.isEmpty(s)?"":new Date(s).toLocaleString(),invisible:!t.asc_getVisible()};0==t.asc_getValid()?n.push(a):o.push(a)}),e._state.hasValid=n.length>0,e._state.hasInvalid=o.length>0,this.viewValidList.store.reset(n),this.viewInvalidList.store.reset(o),this.$el.find(".valid").toggleClass("hidden",!e._state.hasValid),this.$el.find(".invalid").toggleClass("hidden",!e._state.hasInvalid),e.disableEditing(e._state.hasValid||e._state.hasInvalid)},onItemContextMenu:function(t,n,o,s){var a=this.signatureMenu;a.isVisible()&&a.hide();var l=e(this.el).offset(),r=[s.clientX*Common.Utils.zoom()-l.left+5,s.clientY*Common.Utils.zoom()-l.top+5];this.showSignatureMenu(o,r),a.menuAlign="tl-bl",a.menuAlignEl=null,a.setOffset(15,5),a.show(),i.delay(function(){a.cmpEl.focus()},10)},onSelectSignature:function(t,n,o,s){if(o){ var a=e(s.target);if(a&&a.hasClass("caret")){var l=this.signatureMenu;if(l.isVisible())return void l.hide();var r=e(s.currentTarget),c=r.offset(),d=e(this.el).offset(),h=[c.left-d.left+r.width(),c.top-d.top+r.height()/2];this.showSignatureMenu(o,h),l.menuAlign="tr-br",l.menuAlignEl=r,l.setOffset(-20,-r.height()/2+3),l.show(),i.delay(function(){l.cmpEl.focus()},10),s.stopPropagation(),s.preventDefault()}}},showSignatureMenu:function(t,i){this.api.asc_gotoSignature(t.get("guid"));var n=this.signatureMenu,o=e(this.el),s=o.find("#menu-signature-container");n.rendered||(s.length<1&&(s=e('',n.id),o.append(s)),n.render(s),n.cmpEl.attr({tabindex:"-1"}),n.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),n.items[1].setDisabled(this._locked),n.items[0].cmpEl.attr("data-value",t.get("certificateId")),n.cmpEl.attr("data-value",t.get("guid")),s.css({left:i[0],top:i[1]})},onMenuSignatureClick:function(t,e){var i=t.cmpEl.attr("data-value");switch(e.value){case 1:this.api.asc_ViewCertificate(e.cmpEl.attr("data-value"));break;case 3:this.api.asc_RemoveSignature(i)}},onDocumentReady:function(){this._state.ready=!0,this.updateSignatures(this.api.asc_getSignatures(),this.api.asc_getRequestSignatures()),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid)},showSignatureTooltip:function(t,e){var i=this,n=i._state.tip;if(!t&&!e)return void(n&&n.isVisible()&&(n.close(),i._state.tip=void 0));var o=t||e,s=e?i.txtSignedInvalid:t?i.txtSigned:"";n&&n.isVisible()&&(s!==n.text||o!==n.showLink)&&(n.close(),i._state.tip=void 0),i._state.tip||(n=new Common.UI.SynchronizeTip({target:PE.getController("RightMenu").getView("RightMenu").btnSignature.btnEl,text:s,showLink:o,textLink:this.txtContinueEditing,placement:"left"}),n.on({dontshowclick:function(){Common.UI.warning({title:i.notcriticalErrorTitle,msg:i.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(t){"ok"==t&&(n.close(),i._state.tip=void 0,i.api.asc_RemoveAllSignatures())}})},closeclick:function(){n.close(),i._state.tip=void 0}}),i._state.tip=n,n.show())},disableEditing:function(t){if(this._state.DisabledEditing!=t){this._state.DisabledEditing=t;var e=PE.getController("RightMenu");t&&"id-signature-settings"!==e.rightmenu.GetActivePane()&&e.rightmenu.clearSelection(),e.SetDisabled(t,!0),PE.getController("Toolbar").DisableToolbar(t,t),PE.getController("Statusbar").getView("Statusbar").SetDisabled(t),PE.getController("Common.Controllers.ReviewChanges").SetDisabled(t),PE.getController("DocumentHolder").getView("DocumentHolder").SetDisabled(t),PE.getController("LeftMenu").setPreviewMode(t);var i=PE.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t)}},strSignature:"Signature",strValid:"Valid signatures",strInvalid:"Invalid signatures",strDetails:"Signature Details",txtSigned:"Valid signatures has been added to the presentation. The presentation is protected from editing.",txtSignedInvalid:"Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.",txtContinueEditing:"Edit anyway",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the presentation.
Are you sure you want to continue?",strDelete:"Remove Signature"},PE.Views.SignatureSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;if(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","presentationeditor/main/app/view/SignatureSettings","common/main/lib/component/Scroller"],function(t,e,i,n){"use strict";PE.Views.RightMenu=n.View.extend(i.extend({el:"#right-menu",template:i.template(t),events:{},initialize:function(){return this.minimizedMode=!0,this.btnText=new Common.UI.Button({hint:this.txtParagraphSettings,asctype:Common.Utils.documentSettingsType.Paragraph,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTable=new Common.UI.Button({hint:this.txtTableSettings,asctype:Common.Utils.documentSettingsType.Table,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnImage=new Common.UI.Button({hint:this.txtImageSettings,asctype:Common.Utils.documentSettingsType.Image,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.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(t){var n=e(this.el);this.trigger("render:before",this),this.defaultHideRightMenu=t.customization&&!!t.customization.hideRightMenu;var o=!Common.localStorage.getBool("pe-hide-right-settings",this.defaultHideRightMenu);return n.css("width",(o?MENU_SCALE_PART:SCALE_MIN)+"px"),n.show(),n.html(this.template({})),this.btnText.setElement(e("#id-right-menu-text"),!1),this.btnText.render(),this.btnTable.setElement(e("#id-right-menu-table"),!1),this.btnTable.render(),this.btnImage.setElement(e("#id-right-menu-image"),!1),this.btnImage.render(),this.btnSlide.setElement(e("#id-right-menu-slide"),!1),this.btnSlide.render(),this.btnChart.setElement(e("#id-right-menu-chart"),!1),this.btnChart.render(),this.btnShape.setElement(e("#id-right-menu-shape"),!1),this.btnShape.render(),this.btnTextArt.setElement(e("#id-right-menu-textart"),!1),this.btnTextArt.render(),this.btnText.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",i.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSlide.on("click",i.bind(this.onBtnMenuClick,this)),this.btnChart.on("click",i.bind(this.onBtnMenuClick,this)),this.btnShape.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTextArt.on("click",i.bind(this.onBtnMenuClick,this)),this.paragraphSettings=new 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,t&&t.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({hint:this.txtSignatureSettings,asctype:Common.Utils.documentSettingsType.Signature,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings[Common.Utils.documentSettingsType.Signature]={panel:"id-signature-settings",btn:this.btnSignature},this.btnSignature.setElement(e("#id-right-menu-signature"),!1),this.btnSignature.render().setVisible(!0),this.btnSignature.on("click",i.bind(this.onBtnMenuClick,this)),this.signatureSettings=new PE.Views.SignatureSettings),i.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),o&&(e("#id-slide-settings").parent().css("display","inline-block"),e("#id-slide-settings").addClass("active")),this.trigger("render:after",this),this},setApi:function(t){this.api=t;var e=function(){this.fireEvent("editcomplete",this)};this.paragraphSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.slideSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.imageSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.chartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.tableSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.shapeSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.textartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.signatureSettings&&this.signatureSettings.setApi(t).on("editcomplete",i.bind(e,this))},setMode:function(t){this.imageSettings&&this.imageSettings.setMode(t),this.shapeSettings&&this.shapeSettings.setMode(t),this.slideSettings&&this.slideSettings.setMode(t)},onBtnMenuClick:function(t,i){var n=e("#"+this._settings[t.options.asctype].panel),o=n.parent();t.pressed?(this.minimizedMode&&(e(this.el).width(MENU_SCALE_PART),o.css("display","inline-block"),this.minimizedMode=!1,Common.localStorage.setItem("pe-hide-right-settings",0)),o.find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&this.scroller.scrollTop(0),this._settings[Common.Utils.documentSettingsType.Slide].isCurrent=t.options.asctype==Common.Utils.documentSettingsType.Slide):(o.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.localStorage.setItem("pe-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,t.options.asctype,this.minimizedMode])},SetActivePane:function(t,i){if(!(this.minimizedMode&&!0!==i||void 0===this._settings[t]))if(this.minimizedMode)this._settings[t].btn.toggle(!0,!1),this._settings[t].btn.trigger("click",this._settings[t].btn);else{var n=e("#"+this._settings[t].panel);n.hasClass("active")||(n.parent().find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&(this.scroller.update(),this.scroller.scrollTop(0))),this._settings[t].btn.isActive()||this._settings[t].btn.toggle(!0,!1)}},GetActivePane:function(){return this.minimizedMode?null:this.$el.find(".settings-panel.active")[0].id},clearSelection:function(){var t=e(".right-panel");t.find("> .active").removeClass("active"),this._settings.forEach(function(t){t.btn.isActive()&&t.btn.toggle(!1,!0)}),t.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.NotificationCenter.trigger("layout:changed","rightmenu")},txtParagraphSettings:"Text Settings",txtImageSettings:"Image Settings",txtTableSettings:"Table Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtSlideSettings:"Slide Settings",txtChartSettings:"Chart Settings",txtSignatureSettings:"Signature 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:void 0},this._initSettings=!0,this.addListeners({RightMenu:{rightmenuclick:this.onRightMenuClick}})},onLaunch:function(){this.rightmenu=this.createView("RightMenu"),this.rightmenu.on("render:after",_.bind(this.onRightMenuAfterRender,this))},onRightMenuAfterRender:function(t){t.shapeSettings.application=t.textartSettings.application=this.getApplication(),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panelId:"id-paragraph-settings",panel:t.paragraphSettings,btn:t.btnText,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Table]={panelId:"id-table-settings",panel:t.tableSettings,btn:t.btnTable,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Image]={panelId:"id-image-settings",panel:t.imageSettings,btn:t.btnImage,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Slide]={panelId:"id-slide-settings",panel:t.slideSettings,btn:t.btnSlide,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Shape]={panelId:"id-shape-settings",panel:t.shapeSettings,btn:t.btnShape,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.TextArt]={panelId:"id-textart-settings",panel:t.textartSettings,btn:t.btnTextArt,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Chart]={panelId:"id-chart-settings",panel:t.chartSettings,btn:t.btnChart,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Signature]={panelId:"id-signature-settings",panel:t.signatureSettings,btn:t.btnSignature,hidden:1,props:{},locked:!1}},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this)),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(t){this.editMode=t.isEdit},onRightMenuClick:function(t,e,i){if(!i&&this.editMode){var n=this._settings[e].panel,o=this._settings[e].props;o&&n&&n.ChangeSettings.call(n,e==Common.Utils.documentSettingsType.Signature?void 0:o)}Common.NotificationCenter.trigger("layout:changed","rightmenu"),this.rightmenu.fireEvent("editcomplete",this.rightmenu)},onFocusObject:function(t){if(this.editMode){var e=!!this._initSettings&&!Common.localStorage.getBool("pe-hide-right-settings",this.rightmenu.defaultHideRightMenu);this._initSettings=!1;for(var i=0;i0?0:1,this._settings[Common.Utils.documentSettingsType.Signature].locked=!1,i=0;i=this._settings.length||void 0===this._settings[o])){var s=t[i].get_ObjectValue();this._settings[o].props=s,this._settings[o].hidden=0,o==Common.Utils.documentSettingsType.Slide?(this._settings[o].locked=s.get_LockDelete(),this._settings[o].lockedBackground=s.get_LockBackground(),this._settings[o].lockedEffects=s.get_LockTranzition(),this._settings[o].lockedTiming=s.get_LockTiming(),this._settings[o].lockedHeader=!!s.get_LockHeader&&s.get_LockHeader()):(this._settings[o].locked=s.get_Locked(),o==Common.Utils.documentSettingsType.Shape&&s.asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=s,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=s.get_Locked()))}}if(this._settings[Common.Utils.documentSettingsType.Slide].locked)for(i=0;i-1?r:a>=0?a:l>=0?l:Common.Utils.documentSettingsType.Slide,void 0!==h&&(this.rightmenu.SetActivePane(h,e),h!=Common.Utils.documentSettingsType.Signature?this._settings[h].panel.ChangeSettings.call(this._settings[h].panel,this._settings[h].props):this._settings[h].panel.ChangeSettings.call(this._settings[h].panel))}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.SetDisabled(!0),this.setMode({isEdit:!1})},SetDisabled:function(t,e){if(this.setMode({isEdit:!t}),this.rightmenu&&this.rightmenu.paragraphSettings)if(this.rightmenu.slideSettings.SetSlideDisabled(t,t,t,t),this.rightmenu.paragraphSettings.disableControls(t),this.rightmenu.shapeSettings.disableControls(t),this.rightmenu.textartSettings.disableControls(t),this.rightmenu.tableSettings.disableControls(t),this.rightmenu.imageSettings.disableControls(t),this.rightmenu.chartSettings.disableControls(t),!e&&this.rightmenu.signatureSettings&&this.rightmenu.btnSignature.setDisabled(t),t)this.rightmenu.btnSlide.setDisabled(t),this.rightmenu.btnText.setDisabled(t),this.rightmenu.btnTable.setDisabled(t),this.rightmenu.btnImage.setDisabled(t),this.rightmenu.btnShape.setDisabled(t),this.rightmenu.btnTextArt.setDisabled(t),this.rightmenu.btnChart.setDisabled(t);else{var i=this.api.getSelectedElements();i.length>0&&this.onFocusObject(i)}},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(),this.rightmenu.tableSettings.updateMetricUnit()},createDelayedElements:function(){if(this.editMode&&this.api){this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this));var t=this.api.getSelectedElements();t.length>0&&this.onFocusObject(t)}},onDoubleClickOnObject:function(t){if(this.editMode){var e=t.get_ObjectType(),i=this.getDocumentSettingsType(e);void 0===i||i>=this._settings.length||void 0===this._settings[i]||i!==Common.Utils.documentSettingsType.Paragraph&&(this.rightmenu.SetActivePane(i,!0),this._settings[i].panel.ChangeSettings.call(this._settings[i].panel,this._settings[i].props))}},onApiUpdateSignatures:function(t){if(this.rightmenu.signatureSettings){var e=!t||t.length<1,i=Common.Utils.documentSettingsType.Signature;this._settings[i].hidden=e?1:0,this._settings[i].btn.setDisabled(e),this._settings[i].panel.setLocked(this._settings[i].locked)}},onApiCountPages:function(t){this._state.no_slides!==t<=0&&this.editMode&&(this._state.no_slides=t<=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(t){switch(t){case Asc.c_oAscTypeSelectElement.Paragraph:return Common.Utils.documentSettingsType.Paragraph;case Asc.c_oAscTypeSelectElement.Table:return Common.Utils.documentSettingsType.Table;case Asc.c_oAscTypeSelectElement.Image:return Common.Utils.documentSettingsType.Image;case Asc.c_oAscTypeSelectElement.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(t){function e(t,e){for(var i=t.length;i--;)if(t[i]===e)return i;return-1}function i(t,e){if(t.length!=e.length)return!1;for(var i=0;i0;for(s in A)(!A[s]&&e(o.mods,+s)>-1||A[s]&&-1==e(o.mods,+s))&&(r=!1);(0!=o.mods.length||A[16]||A[18]||A[17]||A[91])&&!r||(!0===x||o.locked||!1===o.method(t,o))&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function s(t){var i,n=t.keyCode,o=e(P,n);if(o>=0&&P.splice(o,1),93!=n&&224!=n||(n=91),n in A){A[n]=!1;for(i in k)k[i]==n&&(l[i]=!1)}}function a(){for(w in A)A[w]=!1;for(w in k)l[w]=!1}function l(t,e,i){var n,o;n=g(t),void 0===i&&(i=e,e="all");for(var s=0;s1&&(o=f(t),t=[t[t.length-1]]),t=t[0],t=E(t),t in S||(S[t]=[]),S[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:o})}function r(t,e){var n,o,s,a,l,r=[];for(n=g(t),a=0;a1&&(r=f(o),t=o[o.length-1]),t=E(t),void 0===e&&(e=u()),!S[t])return;for(s in S[t])l=S[t][s],l.scope===e&&i(l.mods,r)&&(S[t][s]={})}}function c(t){return"string"==typeof t&&(t=E(t)),-1!=e(P,t)}function d(){return P.slice(0)}function h(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function p(t){T=t||"all"}function u(){return T||"all"}function m(t){var e,i,n;for(e in S)for(i=S[e],n=0;n1&&(r=f(s),t=s[s.length-1]),t=E(t),void 0===e&&(e=u()),S[t])for(a in S[t])l=S[t][a],l.scope===e&&i(l.mods,r)&&(S[t][a][n]=o)}function _(t,e){t?v(t,e,"locked",!0):x=!0}function y(t,e){t?v(t,e,"locked",!1):x=!1}var w,x,S={},A={16:!1,18:!1,17:!1,91:!1},T="all",k={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},I={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220,"ff-":173,"ff=":61},E=function(t){return I[t]||t.toUpperCase().charCodeAt(0)},P=[];for(w=1;w<20;w++)I["f"+w]=111+w;var M={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(w in k)l[w]=!1;b(document,"keydown",function(t){o(t)}),b(document,"keyup",s),b(window,"focus",a);var U=t.key;t.key=l,t.key.setScope=p,t.key.getScope=u,t.key.deleteScope=m,t.key.filter=h,t.key.isPressed=c,t.key.getPressedKeyCodes=d,t.key.noConflict=C,t.key.unbind=r,t.key.suspend=_,t.key.resume=y,"undefined"!=typeof module&&(module.exports=key)}(this),define("keymaster",function(){}),void 0===Common)var Common={};if(Common.util=Common.util||{},define("common/main/lib/util/Shortcuts",["backbone","keymaster"],function(t){"use strict";var e=function(t){return this.cid=_.uniqueId("shortcuts"),this.initialize.apply(this,arguments),this};_.extend(e.prototype,t.Events,{initialize:function(){window.key.filter=function(t){return!0},Common.NotificationCenter.on({"modal:show":function(t){window.key.suspend()},"modal:close":function(t,e){e&&window.key.resume()},"modal:hide":function(t,e){e&&window.key.resume()}})},delegateShortcuts:function(t){if(t&&t.shortcuts){this.removeShortcuts(t);var e,i,n,o,s,a,l=[];for(s in t.shortcuts){if(e=t.shortcuts[s],_.isFunction(e))n=e;else if(!(n=t[e]))throw new Error("Method "+e+" does not exist");i=s.match(/^(\S+)\s*(.*)$/),a=i[1],o=i[2].length?i[2]:"all",n=_.bind(n,this),l.push(window.key(a,o,n))}}},removeShortcuts:function(t){if(t&&t.shortcuts){var e,i,n,o;for(n in t.shortcuts)e=n.match(/^(\S+)\s*(.*)$/),o=e[1],i=e[2].length?e[2]:"all",window.key.unbind(o,i)}},suspendEvents:function(t,e){window.key.suspend(t,e)},resumeEvents:function(t,e){window.key.resume(t,e)}}),e.extend=t.View.extend,Common.util.Shortcuts=new e}),define("common/main/lib/view/SaveAsDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SaveAsDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:420,height:681,header:!0},t),this.template=['
'].join(""),e.tpl=_.template(this.template)(e),this.saveFolderUrl=t.saveFolderUrl||"",this.saveFileUrl=t.saveFileUrl||"",this.defFileName=t.defFileName||"",this.saveFolderUrl=this.saveFolderUrl.replace("{title}",encodeURIComponent(this.defFileName)).replace("{fileuri}",encodeURIComponent(this.saveFileUrl)),Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=645,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-saveas-folder-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-saveas-folder-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.saveFolderUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(_.isEmpty(t.error)?_.isEmpty(t.message)||Common.NotificationCenter.trigger("showmessage",{msg:t.message}):this.trigger("saveaserror",this,t.error),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Folder for save",textLoading:"Loading"},Common.Views.SaveAsDlg||{}))}),define("text!presentationeditor/main/app/template/LeftMenu.template",[],function(){return'
\r\n
\r\n \r\n \r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n \r\n \r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n \r\n \r\n \r\n
\r\n
\r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n \r\n \r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n \r\n
\r\n
'}),define("common/main/lib/view/About",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.Views.About=Common.UI.BaseView.extend(_.extend({menu:void 0,rendered:!1,options:{alias:"Common.Views.About"},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.txtVersionNum="0.0.0", @@ -81,4 +56,4 @@ Common.Views.ReviewPopover=Common.UI.Window.extend(_.extend({initialize:function i.groupCollection[t]||(i.groupCollection[t]=new Backbone.Collection([],{model:Common.Models.Comment})),n=n.concat(i.groupCollection[t].models)}),this.collection.reset(n),this.collection.groups=this.filter,!e){this.getPopover()&&this.getPopover().hide(),this.view.needUpdateFilter=!1;for(var o=!0,s=this.collection.length-1;s>=0;--s)o?this.collection.at(s).set("last",!0,{silent:!0}):this.collection.at(s).get("last")&&this.collection.at(s).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.update()}}},onAppAddComment:function(t,e){this.api.can_AddQuotedComment&&!1===this.api.can_AddQuotedComment()||e||this.addDummyComment()},addCommentToGroupCollection:function(t){var e=t.get("groupName");this.groupCollection[e]||(this.groupCollection[e]=new Backbone.Collection([],{model:Common.Models.Comment})),this.groupCollection[e].push(t)},onApiAddComment:function(t,e){var i=this.readSDKComment(t,e);i&&(i.get("groupName")?(this.addCommentToGroupCollection(i),_.indexOf(this.collection.groups,i.get("groupName"))>-1&&this.collection.push(i)):this.collection.push(i),this.updateComments(!0),this.showPopover&&(null!==e.asc_getQuoteText()&&(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)),this.showPopover=void 0,this.editPopover=!1))},onApiAddComments:function(t){for(var e=0;e100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=void 0,n.updateCommentsView(t,e,i))},25))},updateCommentsView:function(t,e,i){if(t&&!this.view.isVisible())return this.view.needRender=t,void this.onUpdateFilter(this.filter,!0);var n,o=!0;if(_.isUndefined(e)&&this.collection.sort(),t){for(this.onUpdateFilter(this.filter,!0),n=this.collection.length-1;n>=0;--n)o?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.needRender=!1}this.view.update(),i&&this.view.loadText()},findComment:function(t){return this.collection.findWhere({uid:t})},findPopupComment:function(t){return this.popoverComments.findWhere({id:t})},findCommentInGroup:function(t){for(var e in this.groupCollection){var i=this.groupCollection[e],n=i.findWhere({uid:t});if(n)return n}},closeEditing:function(t){if(!_.isUndefined(t)){var e=this.findPopupComment(t);e&&(e.set("editTextInPopover",!1),e.set("showReplyInPopover",!1)),this.subEditStrings[t]&&delete this.subEditStrings[t],this.subEditStrings[t+"-R"]&&delete this.subEditStrings[t+"-R"]}this.collection.clearEditing(),this.collection.each(function(t){var e=_.clone(t.get("replys"));t.get("replys").length=0,e.forEach(function(t){t.get("editText")&&t.set("editText",!1),t.get("editTextInPopover")&&t.set("editTextInPopover",!1)}),t.set("replys",e)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(t){t&&this.mode.canComments&&(t.set("hint",!1),this.api.asc_showComment(t.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(t){this.isSelectedComment=t,t&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return _.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({commentsStore:this.popoverComments,renderTo:this.sdkViewName,canRequestUsers:this.mode?this.mode.canRequestUsers:void 0,canRequestSendNotify:this.mode?this.mode.canRequestSendNotify:void 0,mentionShare:!this.mode||this.mode.mentionShare}),this.popover.setCommentsStore(this.popoverComments)),this.popover},onUpdateUsers:function(){var t=this.userCollection,e=!1;for(var i in this.groupCollection)e=!0,this.groupCollection[i].each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")});!e&&this.collection.each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")})},readSDKComment:function(t,e){var i=e.asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getOnlyOfficeTime())):""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),n=this.userCollection.findOriginalUser(e.asc_getUserId()),o=t.substr(0,t.lastIndexOf("_")+1).match(/^(doc|sheet[0-9_]+)_/),s=new Common.Models.Comment({uid:t,guid:e.asc_getGuid(),userid:e.asc_getUserId(),username:e.asc_getUserName(),usercolor:n?n.get("color"):null,date:this.dateToLocaleTimeString(i),quote:e.asc_getQuoteText(),comment:e.asc_getText(),resolved:e.asc_getSolved(),unattached:!_.isUndefined(e.asc_getDocumentFlag)&&e.asc_getDocumentFlag(),userdata:e.asc_getUserData(),id:Common.UI.getId(),time:i.getTime(),showReply:!1,editText:!1,last:void 0,editTextInPopover:!!this.editPopover,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?!!this.showPopover:this.hidereply,scope:this.view,editable:this.mode.canEditComments||e.asc_getUserId()==this.currentUserId,hint:!this.mode.canComments,groupName:o&&o.length>1?o[1]:null});if(s){var a=this.readSDKReplies(e);a.length&&s.set("replys",a)}return s},readSDKReplies:function(t){var e=0,i=[],n=null,o=t.asc_getRepliesCount();if(o)for(e=0;e0){var i=t();i&&(this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hideComments(),this.isDummyComment=!1,i.asc_putText(e),i.asc_putTime(this.utcDateToString(new Date)),i.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),i.asc_putUserId(this.currentUserId),i.asc_putUserName(this.currentUserName),i.asc_putSolved(!1),_.isUndefined(i.asc_putDocumentFlag)||i.asc_putDocumentFlag(!1),this.api.asc_addComment(i),this.view.showEditContainer(!1),this.mode&&this.mode.canRequestSendNotify&&this.view.pickEMail(i.asc_getGuid(),e),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(t){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var e=this.getPopover();e&&(t&&e.clearDummyText(),e.saveDummyText(),e.handlerHide=function(){},e.isVisible()&&e.hideComments()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1),Common.NotificationCenter.trigger("comments:cleardummy")}},onEditComments:function(t){if(this.api){var e=0,i=this,n=null,o=this.api.asc_getAnchorPosition();if(o){for(this.isSelectedComment=!0,this.popoverComments.reset(),e=0;e0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(o.asc_getX()+o.asc_getWidth(),o.asc_getY(),this.hintmode?o.asc_getX():void 0),this.getPopover().showComments(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var t=$(".new-comment-ct",this.view.el);t&&t.length&&"none"!==t.css("display")&&this.view.txtComment.focus(),this.view.needRender?this.updateComments(!0):this.view.needUpdateFilter&&this.onUpdateFilter(this.view.needUpdateFilter),this.view.update()}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:6e4*(new Date).getTimezoneOffset(),stringOOToLocalDate:function(t){return"string"==typeof t?parseInt(t):0},ooDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?t.getTime().toString():""},stringUtcToLocalDate:function(t){return"string"==typeof t?parseInt(t)+this.timeZoneOffsetInMs:0},utcDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?(t.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,t&&(this.prevcanComments=this.mode.canComments),this.mode.canComments=!t&&this.prevcanComments,this.closeEditing(),this.setMode(this.mode),this.updateComments(!0),this.getPopover()&&(t?this.getPopover().hide():this.getPopover().update(!0)))},clearCollections:function(){this.collection.reset(),this.groupCollection=[]}},Common.Controllers.Comments||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/User",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.User=e.Model.extend({defaults:function(){return{iid:Common.UI.getId(),id:void 0,idOriginal:void 0,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(t){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=t.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var t=0;return this.each(function(e){e.get("online")&&++t}),t},getEditingCount:function(){return this.filter(function(t){return t.get("online")&&!t.get("view")}).length},getEditingOriginalCount:function(){return this.chain().filter(function(t){return t.get("online")&&!t.get("view")}).groupBy(function(t){return t.get("idOriginal")}).size().value()},findUser:function(t){return this.find(function(e){return e.get("id")==t})},findOriginalUser:function(t){return this.find(function(e){return e.get("idOriginal")==t})}}),Common.Collections.HistoryUsers=t.Collection.extend({model:Common.Models.User,findUser:function(t){return this.find(function(e){return e.get("id")==t})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(t){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=t.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(t){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=t.Collection.extend({model:Common.Models.ChatMessage})}),define("common/main/lib/controller/Chat",["core","common/main/lib/collection/Users","common/main/lib/collection/ChatMessages","common/main/lib/view/Chat"],function(){"use strict";Common.Controllers.Chat=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Users","Common.Collections.ChatMessages"],views:["Common.Views.Chat"],initialize:function(){this.addListeners({"Common.Views.Chat":{"message:add":_.bind(this.onSendMessage,this)}});var t=this;Common.NotificationCenter.on("layout:changed",function(e){Common.Utils.asyncCall(function(e){"toolbar"!=e&&"status"!=e||!t.panelChat.$el.is(":visible")||(t.panelChat.updateLayout(!0),t.panelChat.setupAutoSizingTextBox())},this,e)})},events:{},onLaunch:function(){this.panelChat=this.createView("Common.Views.Chat",{storeUsers:this.getApplication().getCollection("Common.Collections.Users"),storeMessages:this.getApplication().getCollection("Common.Collections.ChatMessages")})},setMode:function(t){return this.mode=t,this.api&&(this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onReceiveMessage,this)),this.mode.isEditDiagram||this.mode.isEditMailMerge||(this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onUsersChanged,this)),this.api.asc_registerCallback("asc_onConnectionStateChanged",_.bind(this.onUserConnection,this)),this.api.asc_coAuthoringGetUsers()),this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_coAuthoringChatGetMessages()),this},setApi:function(t){return this.api=t,this},onUsersChanged:function(t,e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var i=0;for(o in t)void 0!==o&&i++;if(i>1&&void 0==this._isCoAuthoringStopped)return this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),void Common.NotificationCenter.trigger("api:disconnect")}var n=this.getApplication().getCollection("Common.Collections.Users");if(n){var o,s,a=[];for(o in t)if(void 0!==o&&(s=t[o])){var l=new Common.Models.User({id:s.asc_getId(),idOriginal:s.asc_getIdOriginal(),username:s.asc_getUserName(),online:!0,color:s.asc_getColor(),view:s.asc_getView()});a[s.asc_getId()==e?"unshift":"push"](l)}n[n.size()>0?"add":"reset"](a)}},onUserConnection:function(t){var e=this.getApplication().getCollection("Common.Collections.Users");if(e){var i=e.findUser(t.asc_getId());i?i.set({online:t.asc_getState()}):e.add(new Common.Models.User({id:t.asc_getId(),idOriginal:t.asc_getIdOriginal(),username:t.asc_getUserName(),online:t.asc_getState(),color:t.asc_getColor(),view:t.asc_getView()}))}},onReceiveMessage:function(t,e){var i=this.getApplication().getCollection("Common.Collections.ChatMessages");if(i){var n=[];t.forEach(function(t){n.push(new Common.Models.ChatMessage({userid:t.useridoriginal,message:t.message,username:t.username}))}),i[i.size()<1||e?"reset":"add"](n)}},onSendMessage:function(t,e){if(e.length>0){var i=this;(function(t,e){for(var i=[];t;){if(t.length .group",e.$toolbarPanelPlugins),o=$('').appendTo(n);i.render(o)}},onResetPlugins:function(t){var e=this;if(e.appOptions.canPlugins=!t.isEmpty(),e.$toolbarPanelPlugins){e.$toolbarPanelPlugins.empty();var i=$('
'),n=-1,o=0;t.each(function(t){var s=t.get("groupRank");s!==n&&n>-1&&o>0&&(i.appendTo(e.$toolbarPanelPlugins),$('
').appendTo(e.$toolbarPanelPlugins),i=$('
'),o=0);var a=e.panelPlugins.createPluginButton(t);if(a){var l=$('').appendTo(i);a.render(l),o++}n=s}),i.appendTo(e.$toolbarPanelPlugins)}else console.error("toolbar panel isnot created")},onSelectPlugin:function(t,e,i,n){var o=$(n.target);if(o&&o.hasClass("plugin-caret")){var s=this.panelPlugins.pluginMenu;if(s.isVisible())return void s.hide();var a,l=this,r=$(n.currentTarget),c=$(this.panelPlugins.el),d=r.offset(),h=c.offset();if(a=[d.left-h.left+r.width(),d.top-h.top+r.height()/2],void 0!=i){for(var p=0;p0?m.get("description"):l.panelPlugins.textStart,value:parseInt(m.get("index"))}).on("click",function(t,e){l.api&&l.api.asc_pluginRun(i.get("guid"),t.value,"")});s.addItem(g)}}var f=c.find("#menu-plugin-container");s.rendered||(f.length<1&&(f=$('',s.id),c.append(f)),s.render(f),s.cmpEl.attr({tabindex:"-1"}),s.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),f.css({left:a[0],top:a[1]}),s.menuAlignEl=r,s.setOffset(-20,-r.height()/2-3),s.show(),_.delay(function(){s.cmpEl.focus()},10),n.stopPropagation(),n.preventDefault()}else this.api.asc_pluginRun(i.get("guid"),0,"")},onPluginShow:function(t,e,i,n){var o=t.get_Variations()[e];if(o.get_Visual()){var s=o.get_Url();if(s=(0==t.get_BaseUrl().length?s:t.get_BaseUrl())+s,n&&(s+=n),o.get_InsideMode())this.panelPlugins.openInsideMode(t.get_Name(),s,i)||this.api.asc_pluginButtonClick(-1);else{var a=this,l=o.get_CustomWindow(),r=o.get_Buttons(),c=[],d=o.get_Size();(!d||d.length<2)&&(d=[800,600]),_.isArray(r)&&_.each(r,function(t,e){t.visible&&(c[e]={caption:t.text,value:e,primary:t.primary})});var h=o.get_Help();a.pluginDlg=new Common.Views.PluginDlg({cls:l?"plain":"",header:!l,title:t.get_Name(),width:d[0],height:d[1],url:s,frameId:i,buttons:l?void 0:c,toolcallback:_.bind(this.onToolClose,this),help:!!h}),a.pluginDlg.on({"render:after":function(t){t.getChild(".footer .dlg-btn").on("click",_.bind(a.onDlgBtnClick,a)),a.pluginContainer=a.pluginDlg.$window.find("#id-plugin-container")},close:function(t){a.pluginDlg=void 0},drag:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},resize:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},help:function(){h&&window.open(h,"_blank")}}),a.pluginDlg.show()}}this.panelPlugins.openedPluginMode(t.get_Guid())},onPluginClose:function(t){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin&&this.panelPlugins.closeInsideMode(),this.panelPlugins.closedPluginMode(t.get_Guid()),this.runAutoStartPlugins()},onPluginResize:function(t,e,i,n){if(this.pluginDlg){var o=e&&e.length>1&&i&&i.length>1&&(i[0]>e[0]||i[1]>e[1]||0==i[0]||0==i[1]);this.pluginDlg.setResizable(o,e,i),this.pluginDlg.setInnerSize(t[0],t[1]),n&&n.call()}},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.api.asc_pluginButtonClick(parseInt(e))},onToolClose:function(){this.api.asc_pluginButtonClick(-1)},onPluginMouseUp:function(t,e){this.pluginDlg?(this.pluginDlg.binding.dragStop&&this.pluginDlg.binding.dragStop(), this.pluginDlg.binding.resizeStop&&this.pluginDlg.binding.resizeStop()):Common.NotificationCenter.trigger("frame:mouseup",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginMouseMove:function(t,e){if(this.pluginDlg){var i=this.pluginContainer.offset();this.pluginDlg.binding.drag&&this.pluginDlg.binding.drag({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top}),this.pluginDlg.binding.resize&&this.pluginDlg.binding.resize({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top})}else Common.NotificationCenter.trigger("frame:mousemove",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginsInit:function(t){!(t instanceof Array)&&(t=t.pluginsData),this.parsePlugins(t)},runAutoStartPlugins:function(){this.autostart&&this.autostart.length>0&&this.api.asc_pluginRun(this.autostart.shift(),0,"")},resetPluginsList:function(){this.getApplication().getCollection("Common.Collections.Plugins").reset()},applyUICustomization:function(){var me=this;return new Promise(function(resolve,reject){var timer_sl=setInterval(function(){if(me.customPluginsComplete){clearInterval(timer_sl);try{me.configPlugins.UIplugins&&me.configPlugins.UIplugins.forEach(function(c){c.code&&eval(c.code)})}catch(t){}resolve()}},10)})},parsePlugins:function(t,e){var i=this,n=this.getApplication().getCollection("Common.Collections.Plugins"),o=i.appOptions.isEdit,s=i.editor;if(t instanceof Array){var a=[],l=[],r=i.appOptions.lang.split(/[\-_]/)[0];t.forEach(function(t){if(!(a.some(function(e){return e.get("baseUrl")==t.baseUrl||e.get("guid")==t.guid})||n.findWhere({baseUrl:t.baseUrl})||n.findWhere({guid:t.guid}))){var e=[],i=!1;if(t.variations.forEach(function(n){var a=(o||n.isViewer&&!1!==n.isDisplayedInViewer)&&_.contains(n.EditorsSupport,s)&&!n.isSystem;if(a&&(i=!0),t.isUICustomizer)a&&l.push({url:t.baseUrl+n.url});else{var c=new Common.Models.PluginVariation(n),d=n.description;"object"==typeof n.descriptionLocale&&(d=n.descriptionLocale[r]||n.descriptionLocale.en||d||""),_.each(n.buttons,function(t,e){"object"==typeof t.textLocale&&(t.text=t.textLocale[r]||t.textLocale.en||t.text||""),t.visible=o||!1!==t.isViewer}),c.set({description:d,index:e.length,url:n.url,icons:n.icons,buttons:n.buttons,visible:a,help:n.help}),e.push(c)}}),e.length>0&&!t.isUICustomizer){var c=t.name;"object"==typeof t.nameLocale&&(c=t.nameLocale[r]||t.nameLocale.en||c||""),a.push(new Common.Models.Plugin({name:c,guid:t.guid,baseUrl:t.baseUrl,variations:e,currentVariation:0,visible:i,groupName:t.group?t.group.name:"",groupRank:t.group?t.group.rank:0}))}}}),!1!==e&&(i.configPlugins.UIplugins=l),!e&&n&&(a=n.models.concat(a),a.sort(function(t,e){var i=t.get("groupRank"),n=e.get("groupRank");return in?0==n?-1:1:0}),n.reset(a),this.appOptions.canPlugins=!n.isEmpty())}else e||(this.appOptions.canPlugins=!1);e||this.getApplication().getController("LeftMenu").enablePlugins(),this.appOptions.canPlugins&&(this.refreshPluginsList(),this.runAutoStartPlugins())},getPlugins:function(t,e){if(!t||t.length<1)return Promise.resolve([]);e=e||function(t){return fetch(t).then(function(e){return e.ok?e.json():Promise.reject(t)}).then(function(e){return e.baseUrl=t.substring(0,t.lastIndexOf("config.json")),e})};var i=[];return t.map(e).reduce(function(t,e){return t.then(function(){return e}).then(function(t){return i.push(t),Promise.resolve(t)}).catch(function(t){return Promise.resolve(t)})},Promise.resolve()).then(function(){return Promise.resolve(i)})},mergePlugins:function(){if(void 0!==this.serverPlugins.plugins&&void 0!==this.configPlugins.plugins){var t=[],e=[],i=this.configPlugins,n=!1;i.plugins&&i.plugins.length>0&&(e=i.plugins);var o=i.config.autostart||i.config.autoStartGuid;"string"==typeof o&&(o=[o]),n=!!i.config.autoStartGuid,t=o||[],i=this.serverPlugins,i.plugins&&i.plugins.length>0&&(e=e.concat(i.plugins)),o=i.config.autostart||i.config.autoStartGuid,"string"==typeof o&&(o=[o]),(n||i.config.autoStartGuid)&&console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration."),t=t.concat(o||[]),this.autostart=t,this.parsePlugins(e,!1)}},getAppCustomPlugins:function(t){var e=this,i=function(){e.customPluginsComplete=!0};t.config?this.getPlugins(t.config.UIpluginsData).then(function(n){e.parsePlugins(n,!0),e.getPlugins(t.UIplugins,function(t){return fetch(t.url).then(function(t){return t.ok?t.text():Promise.reject()}).then(function(e){return t.code=e,e})}).then(i,i)},i):i()}},Common.Controllers.Plugins||{}))}),define("common/main/lib/view/ExternalDiagramEditor",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ExternalDiagramEditor=Common.UI.Window.extend(_.extend({initialize:function(t){var e={},i=Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top");_.extend(e,{title:this.textTitle,width:910,height:i-700<0?i:700,cls:"advanced-settings-dlg",header:!0,toolclose:"hide",toolcallback:_.bind(this.onToolClose,this)},t),this.template=['
','
',"
",'
','"].join(""),e.tpl=_.template(this.template)(e),this.handler=e.handler,this._chartData=null,this._isNewChart=!0,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnSave=new Common.UI.Button({el:$("#id-btn-diagram-editor-apply"),disabled:!0}),this.btnCancel=new Common.UI.Button({el:$("#id-btn-diagram-editor-cancel")}),this.$window.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this))},show:function(){this.setPlaceholder(),Common.UI.Window.prototype.show.apply(this,arguments)},setChartData:function(t){this._chartData=t,this._isExternalDocReady&&this.fireEvent("setchartdata",this)},setEditMode:function(t){this._isNewChart=!t},isEditMode:function(){return!this._isNewChart},setControlsDisabled:function(t){this.btnSave.setDisabled(t),this.btnCancel.setDisabled(t),t?this.$window.find(".tool.close").addClass("disabled"):this.$window.find(".tool.close").removeClass("disabled")},onDlgBtnClick:function(t){if(this.handler)return void this.handler.call(this,t.currentTarget.attributes.result.value);this.hide()},onToolClose:function(){if(this.handler)return void this.handler.call(this,"cancel");this.hide()},setHeight:function(t){if(t>=0){var e=parseInt(this.$window.css("min-height"));t .header").css("height")):0;this.$window.find("> .body").css("height",t-i),this.$window.find("> .body > .box").css("height",t-85);var n=(Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top")-parseInt(t))/2,o=(Common.Utils.innerWidth()-parseInt(this.initConfig.width))/2;this.$window.css("left",o),this.$window.css("top",Common.Utils.InternalSettings.get("window-inactive-area-top")+n)}},setPlaceholder:function(t){this._placeholder=t},getPlaceholder:function(){return this._placeholder},textSave:"Save & Exit",textClose:"Close",textTitle:"Chart Editor"},Common.Views.ExternalDiagramEditor||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ExternalDiagramEditor",["core","common/main/lib/view/ExternalDiagramEditor"],function(){"use strict";Common.Controllers.ExternalDiagramEditor=Backbone.Controller.extend(_.extend(function(){var t="en",e=void 0,i="",n=null,o=!0,s=function(){n=new DocsAPI.DocEditor("id-diagram-editor-placeholder",{width:"100%",height:"100%",documentType:"cell",document:{url:"_chart_",permissions:{edit:!0,download:!1}},editorConfig:{mode:"editdiagram",targetApp:i,lang:t,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:e,user:{id:"uid-"+Date.now()}},events:{onAppReady:function(){},onDocumentStateChange:function(){},onError:function(){},onInternalMessage:_.bind(this.onInternalMessage,this)}}),Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this))};return{views:["Common.Views.ExternalDiagramEditor"],initialize:function(){this.addListeners({"Common.Views.ExternalDiagramEditor":{setchartdata:_.bind(this.setChartData,this),drag:_.bind(function(t,e){n&&n.serviceCommand("window:drag","start"==e)},this),show:_.bind(function(t){var e=this.diagramEditorView.getHeight(),i=Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top");(i>e&&e<700||i
<%= caption %>
<% if (options.description !== null) { %><% } %>');this.btnReviewView=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-reviewview",caption:this.txtView,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.txtMarkupCap,checkable:!0,toggleGroup:"menuReviewView",checked:!0,value:"markup",template:e,description:this.txtMarkup},{caption:this.txtFinalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtFinal,value:"final"},{caption:this.txtOriginalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtOriginal,value:"original"}]})})}(this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length||this.appConfig.canRequestSharingSettings)&&!0!==this._readonlyRights&&(this.btnSharing=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-sharing",caption:this.txtSharing})),this.appConfig.isEdit&&!this.appConfig.isOffline&&this.appConfig.canCoAuthoring&&(this.btnCoAuthMode=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-coedit",caption:this.txtCoAuthMode,menu:!0})),this.btnsSpelling=[],this.btnsDocLang=[],this.appConfig.canUseHistory&&!this.appConfig.isDisconnected&&(this.btnHistory=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-history",caption:this.txtHistory})),this.appConfig.canCoAuthoring&&this.appConfig.canChat&&(this.btnChat=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-chat",caption:this.txtChat,enableToggle:!0})),this.appConfig.canCoAuthoring&&this.appConfig.canComments&&(this.btnCommentRemove=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",caption:this.txtCommentRemove,split:!0,iconCls:"toolbar__icon btn-rem-comment"}));var i=Common.localStorage.getKeysFilter();this.appPrefix=i&&i.length?i.split(",")[0]:"",Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(t){var i=this;new Promise(function(t,e){t()}).then(function(){var n=_.template('
<%= caption %>
<% if (options.description !== null) { %><% } %>
');if(t.canReview&&(i.btnTurnOn.updateHint(i.tipReview),i.appConfig.canUseReviewPermissions||(i.btnAccept.setMenu(new Common.UI.Menu({items:[{caption:i.txtAcceptCurrent,value:"current"},{caption:i.txtAcceptAll,value:"all"}]})),i.btnReject.setMenu(new Common.UI.Menu({items:[{caption:i.txtRejectCurrent,value:"current"},{caption:i.txtRejectAll,value:"all"}]}))),i.btnAccept.updateHint([i.tipAcceptCurrent,i.txtAcceptChanges]),i.btnReject.updateHint([i.tipRejectCurrent,i.txtRejectChanges]),t.canFeatureComparison&&(i.btnCompare.setMenu(new Common.UI.Menu({items:[{caption:i.mniFromFile,value:"file"},{caption:i.mniFromUrl,value:"url"},{caption:i.mniFromStorage,value:"storage"}]})),i.btnCompare.menu.items[2].setVisible(i.appConfig.canRequestCompareFile||i.appConfig.fileChoiceUrl&&i.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1),i.btnCompare.updateHint(i.tipCompare)),i.btnAccept.setDisabled(t.isReviewOnly),i.btnReject.setDisabled(t.isReviewOnly)),i.appConfig.canViewReview&&(i.btnPrev.updateHint(i.hintPrev),i.btnNext.updateHint(i.hintNext),i.btnReviewView&&i.btnReviewView.updateHint(i.tipReviewView)),i.btnSharing&&i.btnSharing.updateHint(i.tipSharing),i.btnHistory&&i.btnHistory.updateHint(i.tipHistory),i.btnChat&&i.btnChat.updateHint(i.txtChat+Common.Utils.String.platformKey("Alt+Q")),i.btnCoAuthMode){i.btnCoAuthMode.setMenu(new Common.UI.Menu({cls:"ppm-toolbar",style:"max-width: 220px;",items:[{caption:i.strFast,checkable:!0,toggleGroup:"menuCoauthMode",checked:!0,template:n,description:i.strFastDesc,value:1},{caption:i.strStrict,checkable:!0,toggleGroup:"menuCoauthMode",checked:!1,template:n,description:i.strStrictDesc,value:0}]})),i.btnCoAuthMode.updateHint(i.tipCoAuthMode);var o=Common.localStorage.getItem(i.appPrefix+"settings-coauthmode");null===o&&!Common.localStorage.itemExists(i.appPrefix+"settings-autosave")&&t.customization&&!1===t.customization.autosave&&(o=0),i.turnCoAuthMode((null===o||1==parseInt(o))&&!(t.isDesktopApp&&t.isOffline)&&t.canCoAuthoring)}if(i.btnCommentRemove){var s=[{caption:t.canEditComments?i.txtCommentRemCurrent:i.txtCommentRemMyCurrent,value:"current"},{caption:i.txtCommentRemMy,value:"my"}];t.canEditComments&&s.push({caption:i.txtCommentRemAll,value:"all"}),i.btnCommentRemove.setMenu(new Common.UI.Menu({items:s})),i.btnCommentRemove.updateHint([i.tipCommentRemCurrent,i.tipCommentRem])}var a,l=i.btnSharing||i.btnCoAuthMode?".separator.sharing":i.$el.find(".separator.sharing"),r=t.canComments&&t.canCoAuthoring?".separator.comments":i.$el.find(".separator.comments"),c=t.canReview||t.canViewReview?".separator.review":i.$el.find(".separator.review"),d=t.canReview&&t.canFeatureComparison?".separator.compare":i.$el.find(".separator.compare"),h=i.btnChat?".separator.chat":i.$el.find(".separator.chat");"object"==typeof l?l.hide().prev(".group").hide():a=l,"object"==typeof r?r.hide().prev(".group").hide():a=r,"object"==typeof c?c.hide().prevUntil(".separator.comments").hide():a=c,"object"==typeof d?d.hide().prev(".group").hide():a=d,"object"==typeof h?h.hide().prev(".group").hide():a=h,!i.btnHistory&&a&&i.$el.find(a).hide(),Common.NotificationCenter.trigger("tab:visible","review",t.isEdit||t.canViewReview||t.canCoAuthoring&&t.canComments),e.call(i)})},getPanel:function(){return this.$el=$(_.template('
')({})),this.appConfig.canReview&&(this.btnAccept.render(this.$el.find("#btn-change-accept")),this.btnReject.render(this.$el.find("#btn-change-reject")),this.appConfig.canFeatureComparison&&this.btnCompare.render(this.$el.find("#btn-compare")),this.btnTurnOn.render(this.$el.find("#btn-review-on"))),this.btnPrev&&this.btnPrev.render(this.$el.find("#btn-change-prev")),this.btnNext&&this.btnNext.render(this.$el.find("#btn-change-next")),this.btnReviewView&&this.btnReviewView.render(this.$el.find("#btn-review-view")),this.btnSharing&&this.btnSharing.render(this.$el.find("#slot-btn-sharing")),this.btnCoAuthMode&&this.btnCoAuthMode.render(this.$el.find("#slot-btn-coauthmode")),this.btnHistory&&this.btnHistory.render(this.$el.find("#slot-btn-history")),this.btnChat&&this.btnChat.render(this.$el.find("#slot-btn-chat")),this.btnCommentRemove&&this.btnCommentRemove.render(this.$el.find("#slot-comment-remove")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){if("turn"==t&&"statusbar"==e){var i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-review",hintAnchor:"top",hint:this.tipReview,enableToggle:!0});return this.btnsTurnReview.push(i),i}return"spelling"==t?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-docspell",hintAnchor:"top",hint:this.tipSetSpelling,enableToggle:!0}),this.btnsSpelling.push(i),i):"doclang"==t&&"statusbar"==e?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-doclang",hintAnchor:"top",hint:this.tipSetDocLang,disabled:!0}),this.btnsDocLang.push(i),i):void 0},getUserName:function(t){return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(t))},turnChanges:function(t){this.btnsTurnReview.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},markChanges:function(t){this.btnsTurnReview.forEach(function(e){if(e){$(".icon",e.cmpEl)[t?"addClass":"removeClass"]("btn-ic-changes")}},this)},turnSpelling:function(t){this.btnsSpelling.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},turnCoAuthMode:function(t){this.btnCoAuthMode&&(this.btnCoAuthMode.menu.items[0].setChecked(t,!0),this.btnCoAuthMode.menu.items[1].setChecked(!t,!0))},turnChat:function(t){this.btnChat&&this.btnChat.toggle(t,!0)},turnDisplayMode:function(t){this.btnReviewView&&(this.btnReviewView.menu.items[0].setChecked("markup"==t,!0),this.btnReviewView.menu.items[1].setChecked("final"==t,!0),this.btnReviewView.menu.items[2].setChecked("original"==t,!0))},SetDisabled:function(t,e){this.btnsSpelling&&this.btnsSpelling.forEach(function(e){e&&e.setDisabled(t)},this),this.btnsDocLang&&this.btnsDocLang.forEach(function(i){i&&i.setDisabled(t||e&&e.length<1)},this),this.btnsTurnReview&&this.btnsTurnReview.forEach(function(e){e&&e.setDisabled(t)},this),this.btnCommentRemove&&this.btnCommentRemove.setDisabled(t||!Common.Utils.InternalSettings.get(this.appPrefix+"settings-livecomment"))},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this.btnSharing&&this.btnSharing.setDisabled(!0)},txtAccept:"Accept",txtAcceptCurrent:"Accept current Changes",txtAcceptAll:"Accept all Changes",txtReject:"Reject",txtRejectCurrent:"Reject current Changes",txtRejectAll:"Reject all Changes",hintNext:"To Next Change",hintPrev:"To Previous Change",txtPrev:"Previous",txtNext:"Next",txtTurnon:"Turn On",txtSpelling:"Spell checking",txtDocLang:"Language",tipSetDocLang:"Set Document Language",tipSetSpelling:"Spell checking",tipReview:"Review",txtAcceptChanges:"Accept Changes",txtRejectChanges:"Reject Changes",txtView:"Display Mode",txtMarkup:"Text with changes (Editing)",txtFinal:"All changes like accept (Preview)",txtOriginal:"Text without changes (Preview)",tipReviewView:"Select the way you want the changes to be displayed",tipAcceptCurrent:"Accept current changes",tipRejectCurrent:"Reject current changes",txtSharing:"Sharing",tipSharing:"Manage document access rights",txtCoAuthMode:"Co-editing Mode",tipCoAuthMode:"Set co-editing mode",strFast:"Fast",strStrict:"Strict",txtHistory:"Version History",tipHistory:"Show version history",txtChat:"Chat",txtMarkupCap:"Markup",txtFinalCap:"Final",txtOriginalCap:"Original",strFastDesc:"Real-time co-editing. All changes are saved automatically.",strStrictDesc:"Use the 'Save' button to sync the changes you and others make.",txtCompare:"Compare",tipCompare:"Compare current document with another one",mniFromFile:"Document from File",mniFromUrl:"Document from URL",mniFromStorage:"Document from Storage",mniSettings:"Comparison Settings",txtCommentRemove:"Remove",tipCommentRemCurrent:"Remove current comments",tipCommentRem:"Remove comments",txtCommentRemCurrent:"Remove Current Comments",txtCommentRemMyCurrent:"Remove My Current Comments",txtCommentRemMy:"Remove My Comments",txtCommentRemAll:"Remove All Comments"}}(),Common.Views.ReviewChanges||{})),Common.Views.ReviewChangesDialog=Common.UI.Window.extend(_.extend({options:{width:330,height:90,title:"Review Changes",modal:!1,cls:"review-changes modal-dlg",alias:"Common.Views.ReviewChangesDialog"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','
','
','
','
',"
","
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.popoverChanges=this.options.popoverChanges,this.mode=this.options.mode,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnPrev=new Common.UI.Button({cls:"dlg-btn iconic",iconCls:"img-commonctrl prev",hint:this.txtPrev,hintAnchor:"top"}),this.btnPrev.render(this.$window.find("#id-review-button-prev")),this.btnNext=new Common.UI.Button({cls:" dlg-btn iconic",iconCls:"img-commonctrl next",hint:this.txtNext,hintAnchor:"top"}),this.btnNext.render(this.$window.find("#id-review-button-next")),this.btnAccept=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtAccept,split:!0,disabled:this.mode.isReviewOnly,menu:!this.mode.canUseReviewPermissions&&new Common.UI.Menu({items:[this.mnuAcceptCurrent=new Common.UI.MenuItem({caption:this.txtAcceptCurrent,value:"current"}),this.mnuAcceptAll=new Common.UI.MenuItem({caption:this.txtAcceptAll,value:"all"})]})}),this.btnAccept.render(this.$window.find("#id-review-button-accept")),this.btnReject=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtReject,split:!0,disabled:this.mode.isReviewOnly,menu:!this.mode.canUseReviewPermissions&&new Common.UI.Menu({items:[this.mnuRejectCurrent=new Common.UI.MenuItem({caption:this.txtRejectCurrent,value:"current"}),this.mnuRejectAll=new Common.UI.MenuItem({caption:this.txtRejectAll,value:"all"})]})}),this.btnReject.render(this.$window.find("#id-review-button-reject"));var t=this;return this.btnPrev.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnPrev,"prev"])}),this.btnNext.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnNext,"next"])}),this.btnAccept.on("click",function(e){t.fireEvent("reviewchange:accept",[t.btnAccept,"current"])}),this.btnAccept.menu&&this.btnAccept.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:accept",[e,i])}),this.btnReject.on("click",function(e){t.fireEvent("reviewchange:reject",[t.btnReject,"current"])}),this.btnReject.menu&&this.btnReject.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:reject",[e,i])}),this},textTitle:"Review Changes",txtPrev:"To previous change",txtNext:"To next change",txtAccept:"Accept",txtAcceptCurrent:"Accept Current Change",txtAcceptAll:"Accept All Changes",txtReject:"Reject",txtRejectCurrent:"Reject Current Change",txtRejectAll:"Reject All Changes"},Common.Views.ReviewChangesDialog||{}))}), define("common/main/lib/view/OptionsDialog",["common/main/lib/component/Window","common/main/lib/component/RadioBox"],function(){"use strict";Common.Views.OptionsDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",items:[],buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
','<% if (typeof label !== "undefined" && label !=="") { %>','',"<% } %>","<% _.each(items, function(item, index) { %>","<% if (!item.id) item.id = Common.UI.getId(); %>",'
',"<% }) %>","
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.radio=[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=t.getChild(),i=this.options.items,n=!0,o=-1;if(i){for(var s=0;s=0&&this.radio[o].setValue(!0)}e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.currentCell},onPrimary:function(){return this._handleInput("ok"),!1}},Common.Views.OptionsDialog||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ReviewChanges",["core","common/main/lib/model/ReviewChange","common/main/lib/collection/ReviewChanges","common/main/lib/view/ReviewChanges","common/main/lib/view/ReviewPopover","common/main/lib/view/LanguageDialog","common/main/lib/view/OptionsDialog"],function(){"use strict";Common.Controllers.ReviewChanges=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.ReviewChanges"],views:["Common.Views.ReviewChanges","Common.Views.ReviewPopover"],sdkViewName:"#id_main",initialize:function(){this.addListeners({FileMenu:{"settings:apply":this.applySettings.bind(this)},LeftMenu:{"comments:show":_.bind(this.commentsShowHide,this,"show"),"comments:hide":_.bind(this.commentsShowHide,this,"hide")},"Common.Views.ReviewChanges":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this),"reviewchange:view":_.bind(this.onReviewViewClick,this),"reviewchange:compare":_.bind(this.onCompareClick,this),"lang:document":_.bind(this.onDocLanguage,this),"collaboration:coauthmode":_.bind(this.onCoAuthMode,this)},"Common.Views.ReviewChangesDialog":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this)},"Common.Views.ReviewPopover":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:goto":_.bind(this.onGotoClick,this)}})},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.ReviewChanges"),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this._state={posx:-1e3,posy:-1e3,popoverVisible:!1,previewMode:!1,compareSettings:null},Common.NotificationCenter.on("reviewchanges:turn",this.onTurnPreview.bind(this)),Common.NotificationCenter.on("spelling:turn",this.onTurnSpelling.bind(this)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("collaboration:sharing",this.changeAccessRights.bind(this)),Common.NotificationCenter.on("collaboration:sharingdeny",this.onLostEditRights.bind(this)),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this))},setConfig:function(t,e){if(this.setApi(e),t){if(this.currentUserId=t.config.user.id,this.appConfig&&this.appConfig.canUseReviewPermissions){var i=this.appConfig.customization.reviewPermissions,n=[],o=Common.Utils.UserInfoParser.getParsedGroups(t.config.user.fullname);o&&o.forEach(function(t){var e=i[t.trim()];e&&(n=n.concat(e))}),this.currentUserGroups=n}this.sdkViewName=t.sdkviewname||this.sdkViewName}return this},setApi:function(t){t&&(this.api=t,(this.appConfig.canReview||this.appConfig.canViewReview)&&(this.api.asc_registerCallback("asc_onShowRevisionsChange",_.bind(this.onApiShowChange,this)),this.api.asc_registerCallback("asc_onUpdateRevisionsChangesPosition",_.bind(this.onApiUpdateChangePosition,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onAuthParticipantsChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onAuthParticipantsChanged,this))),this.api.asc_registerCallback("asc_onAcceptChangesBeforeCompare",_.bind(this.onAcceptChangesBeforeCompare,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.Gateway.on("setrevisedfile",_.bind(this.setRevisedFile,this)))},setMode:function(t){return this.appConfig=t,this.popoverChanges=new Common.Collections.ReviewChanges,this.view=this.createView("Common.Views.ReviewChanges",{mode:t}),(this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length||this.appConfig.canRequestSharingSettings)&&(Common.Gateway.on("showsharingsettings",_.bind(this.changeAccessRights,this)),Common.Gateway.on("setsharingsettings",_.bind(this.setSharingSettings,this))),this},loadDocument:function(t){this.document=t.doc},SetDisabled:function(t){this.dlgChanges&&this.dlgChanges.close(),this.view&&this.view.SetDisabled(t,this.langs),this.setPreviewMode(t)},setPreviewMode:function(t){if(this.viewmode!==t){this.viewmode=t,t&&(this.prevcanReview=this.appConfig.canReview),this.appConfig.canReview=!t&&this.prevcanReview;var e=this;this.popoverChanges&&this.popoverChanges.each(function(t){t.set("hint",!e.appConfig.canReview)})}},onApiShowChange:function(t){if(this.getPopover())if(t&&t.length>0){var e=this.readSDKChange(t),i=t[0].get_X(),n=t[0].get_Y(),o=Math.abs(this._state.posx-i)>.001||Math.abs(this._state.posy-n)>.001||t.length!==this._state.changes_length,s=null!==t[0].get_LockUserId(),a=this.getUserName(t[0].get_LockUserId()),l=e[0].get("editable");this.getPopover().hideTips(),this.popoverChanges.reset(e),o&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i,n)),this.getPopover().showReview(o,s,a);var r=s||!l;this.appConfig.canReview&&!this.appConfig.isReviewOnly&&this._state.lock!==r&&(this.view.btnAccept.setDisabled(r),this.view.btnReject.setDisabled(r),this.dlgChanges&&(this.dlgChanges.btnAccept.setDisabled(r),this.dlgChanges.btnReject.setDisabled(r)),this._state.lock=r),this._state.posx=i,this._state.posy=n,this._state.changes_length=t.length,this._state.popoverVisible=!0}else this._state.popoverVisible&&(this._state.posx=this._state.posy=-1e3,this._state.changes_length=0,this._state.popoverVisible=!1,this.getPopover().hideTips(),this.popoverChanges.reset(),this.getPopover().hideReview())},onApiUpdateChangePosition:function(t,e){this.getPopover()&&(e<0||this.getPopover().sdkBounds.height0&&(this.getPopover().isVisible()||this.getPopover().show(!1),this.getPopover().setLeftTop(t,e)))},findChange:function(t,e){return _.isUndefined(t)?this.collection.findWhere({id:e}):this.collection.findWhere({uid:t})},getPopover:function(){return(this.appConfig.canReview||this.appConfig.canViewReview)&&_.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({reviewStore:this.popoverChanges,renderTo:this.sdkViewName}),this.popover.setReviewStore(this.popoverChanges)),this.popover},readSDKChange:function(t){var e=this,i=[];return _.each(t,function(t){var n="",o="",s=t.get_Value(),a=t.get_MoveType();switch(t.get_Type()){case Asc.c_oAscRevisionsChangeType.TextAdd:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textInserted:e.textParaMoveTo,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.TextRem:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textDeleted:t.is_MovedDown()?e.textParaMoveFromDown:e.textParaMoveFromUp,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.ParaAdd:n=e.textParaInserted;break;case Asc.c_oAscRevisionsChangeType.ParaRem:n=e.textParaDeleted;break;case Asc.c_oAscRevisionsChangeType.TextPr:n=""+e.textFormatted,void 0!==s.Get_Bold()&&(o+=(s.Get_Bold()?"":e.textNot)+e.textBold+", "),void 0!==s.Get_Italic()&&(o+=(s.Get_Italic()?"":e.textNot)+e.textItalic+", "),void 0!==s.Get_Underline()&&(o+=(s.Get_Underline()?"":e.textNot)+e.textUnderline+", "),void 0!==s.Get_Strikeout()&&(o+=(s.Get_Strikeout()?"":e.textNot)+e.textStrikeout+", "),void 0!==s.Get_DStrikeout()&&(o+=(s.Get_DStrikeout()?"":e.textNot)+e.textDStrikeout+", "),void 0!==s.Get_Caps()&&(o+=(s.Get_Caps()?"":e.textNot)+e.textCaps+", "),void 0!==s.Get_SmallCaps()&&(o+=(s.Get_SmallCaps()?"":e.textNot)+e.textSmallCaps+", "),void 0!==s.Get_VertAlign()&&(o+=(1==s.Get_VertAlign()?e.textSuperScript:2==s.Get_VertAlign()?e.textSubScript:e.textBaseline)+", "),void 0!==s.Get_Color()&&(o+=e.textColor+", "),void 0!==s.Get_Highlight()&&(o+=e.textHighlight+", "),void 0!==s.Get_Shd()&&(o+=e.textShd+", "),void 0!==s.Get_FontFamily()&&(o+=s.Get_FontFamily()+", "),void 0!==s.Get_FontSize()&&(o+=s.Get_FontSize()+", "),void 0!==s.Get_Spacing()&&(o+=e.textSpacing+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Spacing()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Position()&&(o+=e.textPosition+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Position()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Lang()&&(o+=Common.util.LanguageInfo.getLocalLanguageName(s.Get_Lang())[1]+", "),_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="",n+=o;break;case Asc.c_oAscRevisionsChangeType.ParaPr:if(n=""+e.textParaFormatted,s.Get_ContextualSpacing()&&(o+=(s.Get_ContextualSpacing()?e.textContextual:e.textNoContextual)+", "),void 0!==s.Get_IndLeft()&&(o+=e.textIndentLeft+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndLeft()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndRight()&&(o+=e.textIndentRight+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndRight()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndFirstLine()&&(o+=e.textFirstLine+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndFirstLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Jc())switch(s.Get_Jc()){case 0:o+=e.textRight+", ";break;case 1:o+=e.textLeft+", ";break;case 2:o+=e.textCenter+", ";break;case 3:o+=e.textJustify+", "}if(void 0!==s.Get_KeepLines()&&(o+=(s.Get_KeepLines()?e.textKeepLines:e.textNoKeepLines)+", "),s.Get_KeepNext()&&(o+=(s.Get_KeepNext()?e.textKeepNext:e.textNoKeepNext)+", "),s.Get_PageBreakBefore()&&(o+=(s.Get_PageBreakBefore()?e.textBreakBefore:e.textNoBreakBefore)+", "),void 0!==s.Get_SpacingLineRule()&&void 0!==s.Get_SpacingLine()&&(o+=e.textLineSpacing,o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_LEAST?e.textAtLeast:s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?e.textMultiple:e.textExact)+" ",o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?s.Get_SpacingLine():Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName())+", "),s.Get_SpacingBeforeAutoSpacing()?o+=e.textSpacingBefore+" "+e.textAuto+", ":void 0!==s.Get_SpacingBefore()&&(o+=e.textSpacingBefore+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingBefore()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_SpacingAfterAutoSpacing()?o+=e.textSpacingAfter+" "+e.textAuto+", ":void 0!==s.Get_SpacingAfter()&&(o+=e.textSpacingAfter+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingAfter()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_WidowControl()&&(o+=(s.Get_WidowControl()?e.textWidow:e.textNoWidow)+", "),void 0!==s.Get_Tabs()&&(o+=e.textTabs+", "),void 0!==s.Get_NumPr()&&(o+=e.textNum+", "),void 0!==s.Get_PStyle()){var l=e.api.asc_GetStyleNameById(s.Get_PStyle());_.isEmpty(l)||(o+=l+", ")}_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="",n+=o;break;case Asc.c_oAscRevisionsChangeType.TablePr:n=e.textTableChanged;break;case Asc.c_oAscRevisionsChangeType.RowsAdd:n=e.textTableRowsAdd;break;case Asc.c_oAscRevisionsChangeType.RowsRem:n=e.textTableRowsDel}var r=""==t.get_DateTime()?new Date:new Date(t.get_DateTime()),c=e.userCollection.findOriginalUser(t.get_UserId()),d=new Common.Models.ReviewChange({uid:Common.UI.getId(),userid:t.get_UserId(),username:t.get_UserName(),usercolor:c?c.get("color"):null,date:e.dateToLocaleTimeString(r),changetext:n,id:Common.UI.getId(),lock:null!==t.get_LockUserId(),lockuser:e.getUserName(t.get_LockUserId()),type:t.get_Type(),changedata:t,scope:e.view,hint:!e.appConfig.canReview,goto:t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveTo||t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveFrom,editable:e.appConfig.isReviewOnly&&t.get_UserId()==e.currentUserId||!e.appConfig.isReviewOnly&&(!e.appConfig.canUseReviewPermissions||e.checkUserGroups(t.get_UserName()))});i.push(d)}),i},checkUserGroups:function(t){var e=Common.Utils.UserInfoParser.getParsedGroups(t);return this.currentUserGroups&&e&&_.intersection(this.currentUserGroups,e.length>0?e:[""]).length>0},getUserName:function(t){if(this.userCollection&&null!==t){var e=this.userCollection.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"))}return""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},onBtnPreviewClick:function(t,e){switch(e){case"prev":this.api.asc_GetPrevRevisionsChange();break;case"next":this.api.asc_GetNextRevisionsChange()}Common.NotificationCenter.trigger("edit:complete",this.view)},onAcceptClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_AcceptAllChanges():this.api.asc_AcceptChanges():this.api.asc_AcceptChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onRejectClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_RejectAllChanges():this.api.asc_RejectChanges():this.api.asc_RejectChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onDeleteClick:function(t){this.api&&this.api.asc_RejectChanges(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onGotoClick:function(t){this.api&&this.api.asc_FollowRevisionMove(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onTurnPreview:function(t){this.appConfig.isReviewOnly?this.view.turnChanges(!0):this.appConfig.canReview&&(t="on"==t,Common.localStorage.setItem(this.view.appPrefix+"track-changes-"+(this.appConfig.fileKey||""),t?1:0),this.api.asc_SetTrackRevisions(t),this.view.turnChanges(t))},onTurnSpelling:function(t){t="on"==t,this.view.turnSpelling(t),Common.localStorage.setItem(this.view.appPrefix+"settings-spellcheck",t?1:0),this.api.asc_setSpellCheck(t),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-spellcheck",t)},onReviewViewClick:function(t,e,i){this.turnDisplayMode(e.value),!this.appConfig.canReview&&Common.localStorage.setItem(this.view.appPrefix+"review-mode",e.value),Common.NotificationCenter.trigger("edit:complete",this.view)},onCompareClick:function(t){if(this.api){var e=this;if(this._state.compareSettings||(this._state.compareSettings=new AscCommonWord.ComparisonOptions,this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"))),"file"===t)this.api&&this.api.asc_CompareDocumentFile(this._state.compareSettings),Common.NotificationCenter.trigger("edit:complete",this.view);else if("url"===t)new Common.Views.ImageFromUrlDialog({title:e.textUrl,handler:function(t,i){if("ok"==t){if(e.api){var n=i.replace(/ /g,"");_.isEmpty(n)||e.api.asc_CompareDocumentUrl(n,e._state.compareSettings)}Common.NotificationCenter.trigger("edit:complete",e.view)}}}).show();else if("storage"===t)this.appConfig.canRequestCompareFile?Common.Gateway.requestCompareFile():new Common.Views.SelectFileDlg({fileChoiceUrl:this.appConfig.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","DocumentsOnly")}).on("selectfile",function(t,i){e.setRevisedFile(i,e._state.compareSettings)}).show();else if("settings"===t){var i=!e._state.compareSettings||e._state.compareSettings.getWords();new Common.Views.OptionsDialog({title:e.textTitleComparison,items:[{caption:e.textChar,value:!1,checked:!1===i},{caption:e.textWord,value:!0,checked:!1!==i}],label:e.textShow,handler:function(t,i){"ok"==i&&(e._state.compareSettings=new AscCommonWord.ComparisonOptions,e._state.compareSettings.putWords(t.getSettings())),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",this.view)},setRevisedFile:function(t){this._state.compareSettings||(this._state.compareSettings=new AscCommonWord.ComparisonOptions,this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"))),t&&t.url&&this.api.asc_CompareDocumentUrl(t.url,this._state.compareSettings,t.token)},onAcceptChangesBeforeCompare:function(t){Common.UI.warning({width:550,msg:this.textAcceptBeforeCompare,buttons:["yes","no"],primary:"yes",callback:function(e){_.defer(function(){t&&t("yes"==e)}),Common.NotificationCenter.trigger("edit:complete",this.view)}})},turnDisplayMode:function(t){this.api&&("final"===t?this.api.asc_BeginViewModeInReview(!0):"original"===t?this.api.asc_BeginViewModeInReview(!1):this.api.asc_EndViewModeInReview()),this.disableEditing("final"==t||"original"==t),this._state.previewMode="final"==t||"original"==t},isPreviewChangesMode:function(){return this._state.previewMode},onCoAuthMode:function(t,e,i){if(Common.localStorage.setItem(this.view.appPrefix+"settings-coauthmode",e.value),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-coauthmode",e.value),this.api){if(this.api.asc_SetFastCollaborative(1==e.value),this.api.SetCollaborativeMarksShowType){var n=Common.localStorage.getItem(e.value?this.view.appPrefix+"settings-showchanges-fast":this.view.appPrefix+"settings-showchanges-strict");null!==n?this.api.SetCollaborativeMarksShowType("all"==n?Asc.c_oAscCollaborativeMarksShowType.All:"none"==n?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges):this.api.SetCollaborativeMarksShowType(e.value?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges)}n=Common.localStorage.getItem(this.view.appPrefix+"settings-autosave"),null===n&&this.appConfig.customization&&!1===this.appConfig.customization.autosave&&(n=0),n=e.value||null===n?1:parseInt(n),Common.localStorage.setItem(this.view.appPrefix+"settings-autosave",n),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-autosave",n),this.api.asc_setAutoSaveGap(n)}Common.NotificationCenter.trigger("edit:complete",this.view),this.view.fireEvent("settings:apply",[this])},disableEditing:function(t){var e=this.getApplication();e.getController("Toolbar").DisableToolbar(t,!1,!0),e.getController("DocumentHolder").getView().SetDisabled(t),this.appConfig.canReview&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("RightMenu").SetDisabled(t,!1),e.getController("Statusbar").getView("Statusbar").SetDisabled(t),e.getController("Navigation")&&e.getController("Navigation").SetDisabled(t),e.getController("Common.Controllers.Plugins").getView("Common.Views.Plugins").disableControls(t));var i=e.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t);var n=e.getController("LeftMenu");n.leftMenu.getMenu("file").getButton("protect").setDisabled(t),n.setPreviewMode(t),this.view&&(this.view.$el.find(".no-group-mask.review").css("opacity",1),this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(e){e&&e.setDisabled(t||!this.langs||this.langs.length<1)},this))},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){var e=this;if(e.view&&Common.localStorage.getBool(e.view.appPrefix+"settings-spellcheck",!(t.customization&&!1===t.customization.spellcheck))&&e.view.turnSpelling(!0),t.canReview)new Promise(function(t){t()}).then(function(){var i="object"==typeof e.appConfig.customization?e.appConfig.customization.trackChanges:void 0,n=t.isReviewOnly||!0===i||!1!==i&&Common.localStorage.getBool(e.view.appPrefix+"track-changes-"+(t.fileKey||""));if(e.api.asc_HaveRevisionsChanges()&&e.view.markChanges(!0),function(t){e.view.turnChanges(t),e.api.asc_SetTrackRevisions(t)}(n),"object"==typeof e.appConfig.customization&&1==e.appConfig.customization.showReviewChanges){e.dlgChanges=new Common.Views.ReviewChangesDialog({popoverChanges:e.popoverChanges,mode:e.appConfig});var o=$("#editor_sdk"),s=o.offset();e.dlgChanges.show(Math.max(10,s.left+o.width()-300),Math.max(10,s.top+o.height()-150))}});else if(t.canViewReview&&(t.canViewReview=t.isEdit||e.api.asc_HaveRevisionsChanges(!0),t.canViewReview)){var i=Common.localStorage.getItem(e.view.appPrefix+"review-mode");null===i&&(i=e.appConfig.customization&&/^(original|final|markup)$/i.test(e.appConfig.customization.reviewDisplay)?e.appConfig.customization.reviewDisplay.toLocaleLowerCase():"original"),e.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i),e.view.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i)}e.view&&e.view.btnChat&&e.getApplication().getController("LeftMenu").leftMenu.btnChat.on("toggle",function(t,i){i!==e.view.btnChat.pressed&&e.view.turnChat(i)}),e.view&&e.view.btnCommentRemove&&e.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(e.view.appPrefix+"settings-livecomment",!0))},applySettings:function(t){this.view&&this.view.turnSpelling(Common.localStorage.getBool(this.view.appPrefix+"settings-spellcheck",!0)),this.view&&this.view.turnCoAuthMode(Common.localStorage.getBool(this.view.appPrefix+"settings-coauthmode",!0))},synchronizeChanges:function(){this.appConfig&&this.appConfig.canReview&&this.view.markChanges(this.api.asc_HaveRevisionsChanges())},setLanguages:function(t){this.langs=t,this.view&&this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(t){t&&t.setDisabled(this.langs.length<1)},this)},onDocLanguage:function(){var t=this;new Common.Views.LanguageDialog({languages:t.langs,current:t.api.asc_getDefaultLanguage(),handler:function(e,i){if("ok"==e){var n=_.findWhere(t.langs,{value:i});n&&t.api.asc_setDefaultLanguage(n.code)}}}).show()},onLostEditRights:function(){this._readonlyRights=!0,this.view&&this.view.onLostEditRights()},changeAccessRights:function(t,e,i){if(!this._docAccessDlg&&!this._readonlyRights)if(this.appConfig.canRequestSharingSettings)Common.Gateway.requestSharingSettings();else{var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.appConfig.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.setSharingSettings({sharingSettings:e})}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},setSharingSettings:function(t){t&&(this.document.info.sharingSettings=t.sharingSettings,Common.NotificationCenter.trigger("collaboration:sharingupdate",t.sharingSettings),Common.NotificationCenter.trigger("mentions:clearusers",this))},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)},onUpdateUsers:function(){var t=this.userCollection;this.popoverChanges&&this.popoverChanges.each(function(e){var i=t.findOriginalUser(e.get("userid"));e.set("usercolor",i?i.get("color"):null)})},onAuthParticipantsChanged:function(t){if(this.view&&this.view.btnCompare){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this.view.btnCompare.setDisabled(e>1||this.viewmode)}},commentsShowHide:function(t){if(this.view){var e=Common.Utils.InternalSettings.get(this.view.appPrefix+"settings-livecomment");void 0!==e&&this.view.btnCommentRemove&&this.view.btnCommentRemove.setDisabled("show"!=t&&!e)}},textInserted:"Inserted:",textDeleted:"Deleted:",textParaInserted:"Paragraph Inserted ",textParaDeleted:"Paragraph Deleted ",textFormatted:"Formatted",textParaFormatted:"Paragraph Formatted",textNot:"Not ",textBold:"Bold",textItalic:"Italic",textStrikeout:"Strikeout",textUnderline:"Underline",textColor:"Font color",textBaseline:"Baseline",textSuperScript:"Superscript",textSubScript:"Subscript",textHighlight:"Highlight color",textSpacing:"Spacing",textDStrikeout:"Double strikeout",textCaps:"All caps",textSmallCaps:"Small caps",textPosition:"Position",textFontSize:"Font size",textShd:"Background color",textContextual:"Don't add interval between paragraphs of the same style",textNoContextual:"Add interval between paragraphs of the same style",textIndentLeft:"Indent left",textIndentRight:"Indent right",textFirstLine:"First line",textRight:"Align right",textLeft:"Align left",textCenter:"Align center",textJustify:"Align justify",textBreakBefore:"Page break before",textKeepNext:"Keep with next",textKeepLines:"Keep lines together",textNoBreakBefore:"No page break before",textNoKeepNext:"Don't keep with next",textNoKeepLines:"Don't keep lines together",textLineSpacing:"Line Spacing: ",textMultiple:"multiple",textAtLeast:"at least",textExact:"exactly",textSpacingBefore:"Spacing before",textSpacingAfter:"Spacing after",textAuto:"auto",textWidow:"Widow control",textNoWidow:"No widow control",textTabs:"Change tabs",textNum:"Change numbering",textEquation:"Equation",textImage:"Image",textChart:"Chart",textShape:"Shape",textTableChanged:"Table Settings Changed",textTableRowsAdd:"Table Rows Added",textTableRowsDel:"Table Rows Deleted",textParaMoveTo:"Moved:",textParaMoveFromUp:"Moved Up:",textParaMoveFromDown:"Moved Down:",textUrl:"Paste a document URL",textAcceptBeforeCompare:"In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?",textTitleComparison:"Comparison Settings",textShow:"Show changes at",textChar:"Character level",textWord:"Word level"},Common.Controllers.ReviewChanges||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Protection",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Protection=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.appConfig.isPasswordSupport&&(this.btnsAddPwd.concat(this.btnsChangePwd).forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"add"])})}),this.btnsDelPwd.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"delete"])})}),this.btnPwd.menu.on("item:click",function(e,i,n){t.fireEvent("protect:password",[e,i.value])})),t.appConfig.isSignatureSupport&&(this.btnSignature.menu&&this.btnSignature.menu.on("item:click",function(e,i,n){t.fireEvent("protect:signature",[i.value,!1])}),this.btnsInvisibleSignature.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:signature",["invisible"])})})),t._isSetEvents=!0}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.btnsInvisibleSignature=[],this.btnsAddPwd=[],this.btnsDelPwd=[],this.btnsChangePwd=[],this._state={disabled:!1,hasPassword:!1,disabledPassword:!1,invisibleSignDisabled:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.appConfig.isPasswordSupport&&(this.btnAddPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-protect",caption:this.txtEncrypt}),this.btnsAddPwd.push(this.btnAddPwd),this.btnPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-protect",caption:this.txtEncrypt,menu:!0,visible:!1})),this.appConfig.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-signature",caption:this.txtSignature,menu:"pe-"!==this.appPrefix}),this.btnSignature.menu||this.btnsInvisibleSignature.push(this.btnSignature)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){e.canProtect&&(e.isPasswordSupport&&(i.btnAddPwd.updateHint(i.hintAddPwd),i.btnPwd.updateHint(i.hintPwd),i.btnPwd.setMenu(new Common.UI.Menu({items:[{caption:i.txtChangePwd,value:"add"},{caption:i.txtDeletePwd,value:"delete"}]}))),i.btnSignature&&(i.btnSignature.updateHint(i.btnSignature.menu?i.hintSignature:i.txtInvisibleSignature),i.btnSignature.menu&&i.btnSignature.setMenu(new Common.UI.Menu({items:[{caption:i.txtInvisibleSignature,value:"invisible"},{caption:i.txtSignatureLine,value:"visible",disabled:i._state.disabled}]}))),Common.NotificationCenter.trigger("tab:visible","protect",!0)),t.call(i)})},getPanel:function(){return this.$el=$(_.template('
')({})),this.appConfig.canProtect&&(this.btnAddPwd&&this.btnAddPwd.render(this.$el.find("#slot-btn-add-password")),this.btnPwd&&this.btnPwd.render(this.$el.find("#slot-btn-change-password")),this.btnSignature&&this.btnSignature.render(this.$el.find("#slot-btn-signature"))),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){var i=this;if("signature"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtInvisibleSignature,disabled:this._state.invisibleSignDisabled});return this.btnsInvisibleSignature.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:signature",["invisible"])}),n}if("add-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtAddPwd,disabled:this._state.disabled||this._state.disabledPassword,visible:!this._state.hasPassword});return this.btnsAddPwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"add"])}),n}if("del-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtDeletePwd, -disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsDelPwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"delete"])}),n}if("change-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtChangePwd,disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsChangePwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"add"])}),n}},SetDisabled:function(t,e){this._state.disabled=t,this._state.invisibleSignDisabled=t&&!e,this.btnsInvisibleSignature&&this.btnsInvisibleSignature.forEach(function(i){i&&i.setDisabled(t&&!e)},this),this.btnSignature&&this.btnSignature.menu&&(this.btnSignature.menu.items&&this.btnSignature.menu.items[1].setDisabled(t),this.btnSignature.setDisabled(t&&!e)),this.btnsAddPwd.concat(this.btnsDelPwd,this.btnsChangePwd).forEach(function(e){e&&e.setDisabled(t||this._state.disabledPassword)},this)},onDocumentPassword:function(t,e){this._state.hasPassword=t,this._state.disabledPassword=!!e;var i=this._state.disabledPassword||this._state.disabled;this.btnsAddPwd&&this.btnsAddPwd.forEach(function(e){e&&(e.setVisible(!t),e.setDisabled(i))},this),this.btnsDelPwd.concat(this.btnsChangePwd).forEach(function(e){e&&(e.setVisible(t),e.setDisabled(i))},this),this.btnPwd.setVisible(t)},txtEncrypt:"Encrypt",txtSignature:"Signature",hintAddPwd:"Encrypt with password",hintPwd:"Change or delete password",hintSignature:"Add digital signature or signature line",txtChangePwd:"Change password",txtDeletePwd:"Delete password",txtAddPwd:"Add password",txtInvisibleSignature:"Add digital signature",txtSignatureLine:"Add Signature line"}}(),Common.Views.Protection||{}))}),define("common/main/lib/view/PasswordDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.PasswordDialog=Common.UI.Window.extend(_.extend({applyFunction:void 0,initialize:function(t){var e=this,i={};_.extend(i,{width:395,height:270,header:!0,cls:"modal-dlg",contentTemplate:"",title:e.txtTitle,buttons:["ok","cancel"]},t),this.template=t.template||['
','
',"","
",'
',"","
",'
','
',"","
",'
',"","
"].join(""),this.handler=t.handler,this.settings=t.settings,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.repeatPwd=new Common.UI.InputField({el:$("#id-repeat-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}})}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.handler){if("ok"==t){if(!0!==this.inputPwd.checkValidate())return void this.inputPwd.cmpEl.find("input").focus();if(this.inputPwd.getValue()!==this.repeatPwd.getValue())return this.repeatPwd.checkValidate(),void this.repeatPwd.cmpEl.find("input").focus()}this.handler.call(this,t,this.inputPwd.getValue())}this.close()},txtTitle:"Set Password",txtPassword:"Password",txtDescription:"A Password is required to open this document",txtRepeat:"Repeat password",txtIncorrectPwd:"Confirmation password is not identical",txtWarning:"Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place."},Common.Views.PasswordDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts"],function(){"use strict";Common.Views.SignDialog=Common.UI.Window.extend(_.extend({options:{width:370,style:"min-width: 350px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.api=this.options.api,this.signType=this.options.signType||"invisible",this.signSize=this.options.signSize||{width:0,height:0},this.certificateId=null,this.signObject=null,this.fontStore=this.options.fontStore,this.font={size:11,name:"Arial",bold:!1,italic:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.template=['
','
','
',"","
",'
',"
",'
','
',"","
",'
','
','
','
','
','
',"","
",'",'
','","
",'
',"
",'',"",'","",'',"
","
"].join(""),this.templateCertificate=_.template(['',''].join("")),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputPurpose=new Common.UI.InputField({el:$("#id-dlg-sign-purpose"),style:"width: 100%;"}),t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-name"),style:"width: 100%;",validateOnChange:!0}).on("changing",_.bind(t.onChangeName,t)),t.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#id-dlg-sign-fonts"),cls:"input-group-nr",style:"width: 234px;",menuCls:"scrollable-menu",menuStyle:"min-width: 234px;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,takeFocusOnClose:!0,hint:t.tipFontName}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),i.name,t.font.size,t.font.italic,t.font.bold),t.font.name=i.name}),this.cmbFontSize=new Common.UI.ComboBox({el:$("#id-dlg-sign-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,takeFocusOnClose:!0,data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,i.value,t.font.italic,t.font.bold),t.font.size=i.value}),this.cmbFontSize.setValue(this.font.size),this.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.btnBold=new Common.UI.Button({parentEl:$("#id-dlg-sign-bold"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0,hint:t.textBold}),t.btnBold.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,t.font.italic,e.pressed),t.font.bold=e.pressed}),t.btnItalic=new Common.UI.Button({parentEl:$("#id-dlg-sign-italic"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0,hint:t.textItalic}),t.btnItalic.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,e.pressed,t.font.bold),t.font.italic=e.pressed}),t.btnSelectImage=new Common.UI.Button({el:"#id-dlg-sign-image"}),t.btnSelectImage.on("click",_.bind(t.onSelectImage,t)),t.btnChangeCertificate=new Common.UI.Button({el:"#id-dlg-sign-change"}),t.btnChangeCertificate.on("click",_.bind(t.onChangeCertificate,t)),t.btnOk=new Common.UI.Button({el:e.find(".primary"),disabled:!0}),t.cntCertificate=$("#id-dlg-sign-certificate"),t.cntVisibleSign=$("#id-dlg-sign-visible"),t.cntInvisibleSign=$("#id-dlg-sign-invisible"),"visible"==t.signType?t.cntInvisibleSign.addClass("hidden"):t.cntVisibleSign.addClass("hidden"),e.find(".dlg-btn").on("click",_.bind(t.onBtnClick,t)),t.afterRender()},getFocusedComponents:function(){return[this.inputPurpose,this.inputName,this.cmbFonts,this.cmbFontSize]},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){("visible"==t.signType?t.inputName:t.inputPurpose).cmpEl.find("input").focus()},500)},close:function(){this.api.asc_unregisterCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_unregisterCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),Common.UI.Window.prototype.close.apply(this,arguments),this.signObject&&this.signObject.destroy()},afterRender:function(){this.api&&(this.binding||(this.binding={}),this.binding.certificateChanged=_.bind(this.onCertificateChanged,this),this.api.asc_registerCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_registerCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),this.api.asc_GetDefaultCertificate()),"visible"==this.signType&&(this.cmbFonts.fillFonts(this.fontStore),this.cmbFonts.selectRecord(this.fontStore.findWhere({name:this.font.name})||this.fontStore.at(0)),this.signObject=new AscCommon.CSignatureDrawer("signature-preview-img",this.api,this.signSize.width,this.signSize.height))},getSettings:function(){var t={};return t.certificateId=this.certificateId,"invisible"==this.signType?t.purpose=this.inputPurpose.getValue():t.images=this.signObject?this.signObject.getImages():[null,null],t},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t&&(this.btnOk.isDisabled()||this.signObject&&!this.signObject.isValid()))return void(this.btnOk.isDisabled()||(this.inputName.showError([this.textNameError]),this.inputName.focus()));this.options.handler.call(this,this,t)}this.close()},onChangeCertificate:function(){this.api.asc_SelectCertificate()},onCertificateChanged:function(t){this.certificateId=t.id;var e=t.date,i="string"==typeof e?e.split(" - "):["",""];this.cntCertificate.html(this.templateCertificate({name:t.name,valid:this.textValid.replace("%1",i[0]).replace("%2",i[1])})),this.cntCertificate.toggleClass("hidden",_.isEmpty(this.certificateId)||this.certificateId<0),this.btnChangeCertificate.setCaption(_.isEmpty(this.certificateId)||this.certificateId<0?this.textSelect:this.textChange),this.btnOk.setDisabled(_.isEmpty(this.certificateId)||this.certificateId<0)},onSelectImage:function(){this.signObject&&(this.signObject.selectImage(),this.inputName.setValue(""))},onChangeName:function(t,e){this.signObject&&this.signObject.setText(e,this.font.name,this.font.size,this.font.italic,this.font.bold)},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(i.value)))return o=e.getValue(),e.setRawValue(o),n.preventDefault(),!1}else{var s="sse-"==this.appPrefix?409:300;o=Common.Utils.String.parseFloat(i.value),o=o>s?s:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.signObject&&this.signObject.setText(this.inputName.getValue(),this.font.name,o,this.font.italic,this.font.bold),this.font.size=o}},textTitle:"Sign Document",textPurpose:"Purpose for signing this document",textCertificate:"Certificate",textValid:"Valid from %1 to %2",textChange:"Change",textInputName:"Input signer name",textUseImage:"or click 'Select Image' to use a picture as signature",textSelectImage:"Select Image",textSignature:"Signature looks as",tipFontName:"Font Name",tipFontSize:"Font Size",textBold:"Bold",textItalic:"Italic",textSelect:"Select",textNameError:"Signer name must not be empty."},Common.Views.SignDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/CheckBox","common/main/lib/component/Window"],function(){"use strict";Common.Views.SignSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 350px;",cls:"modal-dlg",type:"edit"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
',"","
",'
',"","
",'
','
',"","
",'
','
',"","
",'
','
',"","
",'','
',"
",'"].join(""),this.api=this.options.api,this.type=this.options.type||"edit",this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-settings-name"),style:"width: 100%;",disabled:"view"==this.type}),t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-sign-settings-title"),style:"width: 100%;",disabled:"view"==this.type}),t.inputEmail=new Common.UI.InputField({el:$("#id-dlg-sign-settings-email"),style:"width: 100%;",disabled:"view"==this.type}),t.textareaInstructions=this.$window.find("textarea"),t.textareaInstructions.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation()}),"view"==this.type?this.textareaInstructions.attr("disabled","disabled"):this.textareaInstructions.removeAttr("disabled"),this.textareaInstructions.toggleClass("disabled","view"==this.type),this.chDate=new Common.UI.CheckBox({el:$("#id-dlg-sign-settings-date"),labelText:this.textShowDate,disabled:"view"==this.type}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.inputName,this.inputTitle,this.inputEmail,this.textareaInstructions]},getDefaultFocusableComponent:function(){return this.inputName},setSettings:function(t){if(t){var e=this,i=t.asc_getSigner1();e.inputName.setValue(i||""),i=t.asc_getSigner2(),e.inputTitle.setValue(i||""),i=t.asc_getEmail(),e.inputEmail.setValue(i||""),i=t.asc_getInstructions(),e.textareaInstructions.val(i||""),e.chDate.setValue(t.asc_getShowDate()),e._currentGuid=t.asc_getGuid()}},getSettings:function(){var t=this,e=new AscCommon.asc_CSignatureLine;return e.asc_setSigner1(t.inputName.getValue()),e.asc_setSigner2(t.inputTitle.getValue()),e.asc_setEmail(t.inputEmail.getValue()),e.asc_setInstructions(t.textareaInstructions.val()),e.asc_setShowDate("checked"==t.chDate.getValue()),void 0!==t._currentGuid&&e.asc_setGuid(t._currentGuid),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},textInfo:"Signer Info",textInfoName:"Name",textInfoTitle:"Signer Title",textInfoEmail:"E-mail",textInstructions:"Instructions for Signer",txtEmpty:"This field is required",textAllowComment:"Allow signer to add comment in the signature dialog",textShowDate:"Show sign date in signature line",textTitle:"Signature Setup"},Common.Views.SignSettingsDialog||{}))}),void 0===Common)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Protection",["core","common/main/lib/view/Protection","common/main/lib/view/PasswordDialog","common/main/lib/view/SignDialog","common/main/lib/view/SignSettingsDialog"],function(){"use strict";Common.Controllers.Protection=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Common.Views.Protection"],sdkViewName:"#id_main",initialize:function(){this.addListeners({"Common.Views.Protection":{"protect:password":_.bind(this.onPasswordClick,this),"protect:signature":_.bind(this.onSignatureClick,this)}})},onLaunch:function(){this._state={},Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.appConfig.isPasswordSupport&&this.api.asc_registerCallback("asc_onDocumentPassword",_.bind(this.onDocumentPassword,this)),this.appConfig.isSignatureSupport&&(Common.NotificationCenter.on("protect:sign",_.bind(this.onSignatureRequest,this)),Common.NotificationCenter.on("protect:signature",_.bind(this.onSignatureClick,this)),this.api.asc_registerCallback("asc_onSignatureClick",_.bind(this.onSignatureSign,this)),this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)))},setMode:function(t){return this.appConfig=t,this.view=this.createView("Common.Views.Protection",{mode:t}),this},onDocumentPassword:function(t,e){this.view&&this.view.onDocumentPassword(t,e)},SetDisabled:function(t,e){this.view&&this.view.SetDisabled(t,e)},onPasswordClick:function(t,e){switch(e){case"add":this.addPassword();break;case"delete":this.deletePassword()}Common.NotificationCenter.trigger("edit:complete",this.view)},onSignatureRequest:function(t){this.api.asc_RequestSign(t)},onSignatureClick:function(t,e,i){switch(t){case"invisible":this.onSignatureRequest("unvisibleAdd");break;case"visible":this.addVisibleSignature(e,i)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){},addPassword:function(){var t=this;new Common.Views.PasswordDialog({api:t.api,signType:"invisible",handler:function(e,i){"ok"==e&&t.api.asc_setCurrentPassword(i),Common.NotificationCenter.trigger("edit:complete")}}).show()},deletePassword:function(){this.api.asc_resetPassword()},addInvisibleSignature:function(){var t=this;new Common.Views.SignDialog({api:t.api,signType:"invisible",handler:function(e,i){if("ok"==i){var n=e.getSettings();t.api.asc_Sign(n.certificateId)}Common.NotificationCenter.trigger("edit:complete")}}).show()},addVisibleSignature:function(t,e){var i=this,n=new Common.Views.SignSettingsDialog({type:t?"view":"edit",handler:function(e,n){t||"ok"!=n||i.api.asc_AddSignatureLine2(e.getSettings()),Common.NotificationCenter.trigger("edit:complete")}});n.show(),e&&n.setSettings(this.api.asc_getSignatureSetup(e))},signVisibleSignature:function(t,e,i){var n=this;if(_.isUndefined(n.fontStore)){n.fontStore=new Common.Collections.Fonts;var o=n.getApplication().getController("Toolbar").getView("Toolbar").cmbFontName.store.toJSON(),s=[];_.each(o,function(t,e){t.cloneid||s.push(_.clone(t))}),n.fontStore.add(s)}new Common.Views.SignDialog({api:n.api,signType:"visible",fontStore:n.fontStore,signSize:{width:e||0,height:i||0},handler:function(e,i){if("ok"==i){var o=e.getSettings();n.api.asc_Sign(o.certificateId,t,o.images[0],o.images[1])}Common.NotificationCenter.trigger("edit:complete")}}).show()},onSignatureSign:function(t,e,i,n){n?this.signVisibleSignature(t,e,i):this.addInvisibleSignature()},onApiUpdateSignatures:function(t,e){this.SetDisabled(t&&t.length>0,!0)},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)}},Common.Controllers.Protection||{}))}),define("common/main/lib/controller/Desktop",["core"],function(){"use strict";var t=window.AscDesktopEditor;!!t&&t.execCommand("webapps:features",JSON.stringify({version:"0.0.0",eventloading:!0,titlebuttons:!0}));var e=function(){var e,i={version:"0.0.0"},n=window.DE||window.PE||window.SSE,o={"btn-save":"save","btn-save-coauth":"coauth","btn-synch":"synch"};if(t){if(window.on_native_message=function(o,s){if(/^style:change/.test(o)){var a=JSON.parse(s);if("toolbar"==a.element)"off"==a.action&&"native-color"==a.style&&$(".toolbar").removeClass("editor-native-color");else if("body"==a.element&&"merge"==a.action){var r=document.createElement("style");r.innerHTML=a.style,document.body.appendChild(r)}}else if(/window:features/.test(o)){var a=JSON.parse(s);_.isNumber(a.skiptoparea)&&($(".asc-window.modal").length&&$(".asc-window.modal").position().top','
',"","
",'
',"","
",'
','
',"","
",'
',"",""].join(""),this.handler=t.handler,this.settings=t.settings,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.repeatPwd=new Common.UI.InputField({el:$("#id-repeat-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}})}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.handler){if("ok"==t){if(!0!==this.inputPwd.checkValidate())return void this.inputPwd.cmpEl.find("input").focus();if(this.inputPwd.getValue()!==this.repeatPwd.getValue())return this.repeatPwd.checkValidate(),void this.repeatPwd.cmpEl.find("input").focus()}this.handler.call(this,t,this.inputPwd.getValue())}this.close()},txtTitle:"Set Password",txtPassword:"Password",txtDescription:"A Password is required to open this document",txtRepeat:"Repeat password",txtIncorrectPwd:"Confirmation password is not identical",txtWarning:"Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place."},Common.Views.PasswordDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts"],function(){"use strict";Common.Views.SignDialog=Common.UI.Window.extend(_.extend({options:{width:370,style:"min-width: 350px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.api=this.options.api,this.signType=this.options.signType||"invisible",this.signSize=this.options.signSize||{width:0,height:0},this.certificateId=null,this.signObject=null,this.fontStore=this.options.fontStore,this.font={size:11,name:"Arial",bold:!1,italic:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.template=['
','
','
',"","
",'
',"
",'
','
',"","
",'
','
','
','
','
','
',"","
",'",'
','","
",'
',"
",'',"",'","",'',"
","
"].join(""),this.templateCertificate=_.template(['',''].join("")),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputPurpose=new Common.UI.InputField({el:$("#id-dlg-sign-purpose"),style:"width: 100%;"}),t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-name"),style:"width: 100%;",validateOnChange:!0}).on("changing",_.bind(t.onChangeName,t)),t.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#id-dlg-sign-fonts"),cls:"input-group-nr",style:"width: 234px;",menuCls:"scrollable-menu",menuStyle:"min-width: 234px;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,takeFocusOnClose:!0,hint:t.tipFontName}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),i.name,t.font.size,t.font.italic,t.font.bold),t.font.name=i.name}),this.cmbFontSize=new Common.UI.ComboBox({el:$("#id-dlg-sign-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,takeFocusOnClose:!0,data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,i.value,t.font.italic,t.font.bold),t.font.size=i.value}),this.cmbFontSize.setValue(this.font.size),this.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.btnBold=new Common.UI.Button({parentEl:$("#id-dlg-sign-bold"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0,hint:t.textBold}),t.btnBold.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,t.font.italic,e.pressed),t.font.bold=e.pressed}),t.btnItalic=new Common.UI.Button({parentEl:$("#id-dlg-sign-italic"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0,hint:t.textItalic}),t.btnItalic.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,e.pressed,t.font.bold),t.font.italic=e.pressed}),t.btnSelectImage=new Common.UI.Button({el:"#id-dlg-sign-image"}),t.btnSelectImage.on("click",_.bind(t.onSelectImage,t)),t.btnChangeCertificate=new Common.UI.Button({el:"#id-dlg-sign-change"}),t.btnChangeCertificate.on("click",_.bind(t.onChangeCertificate,t)),t.btnOk=new Common.UI.Button({el:e.find(".primary"),disabled:!0}),t.cntCertificate=$("#id-dlg-sign-certificate"),t.cntVisibleSign=$("#id-dlg-sign-visible"),t.cntInvisibleSign=$("#id-dlg-sign-invisible"),"visible"==t.signType?t.cntInvisibleSign.addClass("hidden"):t.cntVisibleSign.addClass("hidden"),e.find(".dlg-btn").on("click",_.bind(t.onBtnClick,t)),t.afterRender()},getFocusedComponents:function(){return[this.inputPurpose,this.inputName,this.cmbFonts,this.cmbFontSize]},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){("visible"==t.signType?t.inputName:t.inputPurpose).cmpEl.find("input").focus()},500)},close:function(){this.api.asc_unregisterCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_unregisterCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),Common.UI.Window.prototype.close.apply(this,arguments),this.signObject&&this.signObject.destroy()},afterRender:function(){this.api&&(this.binding||(this.binding={}),this.binding.certificateChanged=_.bind(this.onCertificateChanged,this),this.api.asc_registerCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_registerCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),this.api.asc_GetDefaultCertificate()),"visible"==this.signType&&(this.cmbFonts.fillFonts(this.fontStore),this.cmbFonts.selectRecord(this.fontStore.findWhere({name:this.font.name})||this.fontStore.at(0)),this.signObject=new AscCommon.CSignatureDrawer("signature-preview-img",this.api,this.signSize.width,this.signSize.height))},getSettings:function(){var t={};return t.certificateId=this.certificateId,"invisible"==this.signType?t.purpose=this.inputPurpose.getValue():t.images=this.signObject?this.signObject.getImages():[null,null],t},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t&&(this.btnOk.isDisabled()||this.signObject&&!this.signObject.isValid()))return void(this.btnOk.isDisabled()||(this.inputName.showError([this.textNameError]),this.inputName.focus()));this.options.handler.call(this,this,t)}this.close()},onChangeCertificate:function(){this.api.asc_SelectCertificate()},onCertificateChanged:function(t){this.certificateId=t.id;var e=t.date,i="string"==typeof e?e.split(" - "):["",""];this.cntCertificate.html(this.templateCertificate({name:t.name,valid:this.textValid.replace("%1",i[0]).replace("%2",i[1])})),this.cntCertificate.toggleClass("hidden",_.isEmpty(this.certificateId)||this.certificateId<0),this.btnChangeCertificate.setCaption(_.isEmpty(this.certificateId)||this.certificateId<0?this.textSelect:this.textChange),this.btnOk.setDisabled(_.isEmpty(this.certificateId)||this.certificateId<0)},onSelectImage:function(){this.signObject&&(this.signObject.selectImage(),this.inputName.setValue(""))},onChangeName:function(t,e){this.signObject&&this.signObject.setText(e,this.font.name,this.font.size,this.font.italic,this.font.bold)},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(i.value)))return o=e.getValue(),e.setRawValue(o),n.preventDefault(),!1}else{var s="sse-"==this.appPrefix?409:300;o=Common.Utils.String.parseFloat(i.value),o=o>s?s:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.signObject&&this.signObject.setText(this.inputName.getValue(),this.font.name,o,this.font.italic,this.font.bold),this.font.size=o}},textTitle:"Sign Document",textPurpose:"Purpose for signing this document",textCertificate:"Certificate",textValid:"Valid from %1 to %2",textChange:"Change",textInputName:"Input signer name",textUseImage:"or click 'Select Image' to use a picture as signature",textSelectImage:"Select Image",textSignature:"Signature looks as",tipFontName:"Font Name",tipFontSize:"Font Size",textBold:"Bold",textItalic:"Italic",textSelect:"Select",textNameError:"Signer name must not be empty."},Common.Views.SignDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/CheckBox","common/main/lib/component/Window"],function(){"use strict";Common.Views.SignSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 350px;",cls:"modal-dlg",type:"edit"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
',"","
",'
',"","
",'
','
',"","
",'
','
',"","
",'
','
',"","
",'','
',"
",'"].join(""),this.api=this.options.api,this.type=this.options.type||"edit",this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-settings-name"),style:"width: 100%;",disabled:"view"==this.type}),t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-sign-settings-title"),style:"width: 100%;",disabled:"view"==this.type}),t.inputEmail=new Common.UI.InputField({el:$("#id-dlg-sign-settings-email"),style:"width: 100%;",disabled:"view"==this.type}),t.textareaInstructions=this.$window.find("textarea"),t.textareaInstructions.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation()}),"view"==this.type?this.textareaInstructions.attr("disabled","disabled"):this.textareaInstructions.removeAttr("disabled"),this.textareaInstructions.toggleClass("disabled","view"==this.type),this.chDate=new Common.UI.CheckBox({el:$("#id-dlg-sign-settings-date"),labelText:this.textShowDate,disabled:"view"==this.type}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.inputName,this.inputTitle,this.inputEmail,this.textareaInstructions]},getDefaultFocusableComponent:function(){return this.inputName},setSettings:function(t){if(t){var e=this,i=t.asc_getSigner1();e.inputName.setValue(i||""),i=t.asc_getSigner2(),e.inputTitle.setValue(i||""),i=t.asc_getEmail(),e.inputEmail.setValue(i||""),i=t.asc_getInstructions(),e.textareaInstructions.val(i||""),e.chDate.setValue(t.asc_getShowDate()),e._currentGuid=t.asc_getGuid()}},getSettings:function(){var t=this,e=new AscCommon.asc_CSignatureLine;return e.asc_setSigner1(t.inputName.getValue()),e.asc_setSigner2(t.inputTitle.getValue()),e.asc_setEmail(t.inputEmail.getValue()),e.asc_setInstructions(t.textareaInstructions.val()),e.asc_setShowDate("checked"==t.chDate.getValue()),void 0!==t._currentGuid&&e.asc_setGuid(t._currentGuid),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},textInfo:"Signer Info",textInfoName:"Name",textInfoTitle:"Signer Title",textInfoEmail:"E-mail",textInstructions:"Instructions for Signer",txtEmpty:"This field is required",textAllowComment:"Allow signer to add comment in the signature dialog",textShowDate:"Show sign date in signature line",textTitle:"Signature Setup"},Common.Views.SignSettingsDialog||{}))}),void 0===Common)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Protection",["core","common/main/lib/view/Protection","common/main/lib/view/PasswordDialog","common/main/lib/view/SignDialog","common/main/lib/view/SignSettingsDialog"],function(){"use strict";Common.Controllers.Protection=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Common.Views.Protection"],sdkViewName:"#id_main",initialize:function(){this.addListeners({"Common.Views.Protection":{"protect:password":_.bind(this.onPasswordClick,this),"protect:signature":_.bind(this.onSignatureClick,this)}})},onLaunch:function(){this._state={},Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.appConfig.isPasswordSupport&&this.api.asc_registerCallback("asc_onDocumentPassword",_.bind(this.onDocumentPassword,this)),this.appConfig.isSignatureSupport&&(Common.NotificationCenter.on("protect:sign",_.bind(this.onSignatureRequest,this)),Common.NotificationCenter.on("protect:signature",_.bind(this.onSignatureClick,this)),this.api.asc_registerCallback("asc_onSignatureClick",_.bind(this.onSignatureSign,this)),this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)))},setMode:function(t){return this.appConfig=t,this.view=this.createView("Common.Views.Protection",{mode:t}),this},onDocumentPassword:function(t,e){this.view&&this.view.onDocumentPassword(t,e)},SetDisabled:function(t,e){this.view&&this.view.SetDisabled(t,e)},onPasswordClick:function(t,e){switch(e){case"add":this.addPassword();break;case"delete":this.deletePassword()}Common.NotificationCenter.trigger("edit:complete",this.view)},onSignatureRequest:function(t){this.api.asc_RequestSign(t)},onSignatureClick:function(t,e,i){switch(t){case"invisible":this.onSignatureRequest("unvisibleAdd");break;case"visible":this.addVisibleSignature(e,i)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){},addPassword:function(){var t=this;new Common.Views.PasswordDialog({api:t.api,signType:"invisible",handler:function(e,i){"ok"==e&&t.api.asc_setCurrentPassword(i),Common.NotificationCenter.trigger("edit:complete")}}).show()},deletePassword:function(){this.api.asc_resetPassword()},addInvisibleSignature:function(){var t=this;new Common.Views.SignDialog({api:t.api,signType:"invisible",handler:function(e,i){if("ok"==i){var n=e.getSettings();t.api.asc_Sign(n.certificateId)}Common.NotificationCenter.trigger("edit:complete")}}).show()},addVisibleSignature:function(t,e){var i=this,n=new Common.Views.SignSettingsDialog({type:t?"view":"edit",handler:function(e,n){t||"ok"!=n||i.api.asc_AddSignatureLine2(e.getSettings()),Common.NotificationCenter.trigger("edit:complete")}});n.show(),e&&n.setSettings(this.api.asc_getSignatureSetup(e))},signVisibleSignature:function(t,e,i){var n=this;if(_.isUndefined(n.fontStore)){n.fontStore=new Common.Collections.Fonts;var o=n.getApplication().getController("Toolbar").getView("Toolbar").cmbFontName.store.toJSON(),s=[];_.each(o,function(t,e){t.cloneid||s.push(_.clone(t))}),n.fontStore.add(s)}new Common.Views.SignDialog({api:n.api,signType:"visible",fontStore:n.fontStore,signSize:{width:e||0,height:i||0},handler:function(e,i){if("ok"==i){var o=e.getSettings();n.api.asc_Sign(o.certificateId,t,o.images[0],o.images[1])}Common.NotificationCenter.trigger("edit:complete")}}).show()},onSignatureSign:function(t,e,i,n){n?this.signVisibleSignature(t,e,i):this.addInvisibleSignature()},onApiUpdateSignatures:function(t,e){this.SetDisabled(t&&t.length>0,!0)},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)}},Common.Controllers.Protection||{}))}),define("common/main/lib/controller/Desktop",["core"],function(){"use strict";var t=window.AscDesktopEditor;!!t&&t.execCommand("webapps:features",JSON.stringify({version:"0.0.0",eventloading:!0,titlebuttons:!0}));var e=function(){var e,i={version:"0.0.0"},n=window.DE||window.PE||window.SSE,o={"btn-save":"save","btn-save-coauth":"coauth","btn-synch":"synch"};if(t){if(window.on_native_message=function(o,s){if(/^style:change/.test(o)){var a=JSON.parse(s);if("toolbar"==a.element)"off"==a.action&&"native-color"==a.style&&$(".toolbar").removeClass("editor-native-color");else if("body"==a.element&&"merge"==a.action){var r=document.createElement("style");r.innerHTML=a.style,document.body.appendChild(r)}}else if(/window:features/.test(o)){var a=JSON.parse(s);_.isNumber(a.skiptoparea)&&($(".asc-window.modal").length&&$(".asc-window.modal").position().top