function modalWindow(n){function f(n){n||(n=$(".modal.___opened-modal-dialog"));n.removeClass("___opened-modal-dialog");n.fadeOut(null,null,function(){var n=i.pop();n?(n.addClass("___opened-modal-dialog"),n.fadeIn("slow")):(t.removeClass("___is-modal-open"),u.removeClass("___noscroll"),r.fadeOut(),$(".modal").fadeOut())})}var t=$(".page"),u=$("body"),r=n||$(".modal__backdrop"),i;n||(r.hide(),t.removeClass("___is-modal-open"),n=$(document));i=[];n.on("click","[data-modal]",function(){var s=$(this).attr("data-modal"),f,n,e,o;if(!s)return!1;if(f=$.parseJSON(s),n=$("#"+f.target),f.action==="open")e=$(".modal.___opened-modal-dialog"),e.length>0&&(e.removeClass("___opened-modal-dialog"),i.push(e)),$(".modal")&&$(".modal").hide(),t.addClass("___is-modal-open"),u.addClass("___noscroll"),n.trigger("modalOpened",[$(this).attr("id")]),r.fadeIn(),n.addClass("___opened-modal-dialog"),n.fadeIn("slow",function(){n.trigger("modalShowed",[$(this).attr("id")])});else if(f.action==="close")n.removeClass("___opened-modal-dialog"),o=i.pop(),o?(o.addClass("___opened-modal-dialog"),n.hide(),o.fadeIn("slow")):(t.removeClass("___is-modal-open"),u.removeClass("___noscroll"),r.fadeOut(),n.fadeOut());else return!1});$(document).on("keyup",function(n){var i=n.keyCode||n.which,t;i===13&&$(".page").hasClass("___is-modal-open")&&(t=$("#loginForm").css("display")==="none",t||$("#loginForm").hasClass("submited")||$("#loginForm").submit())});$("#loginForm").submit(function(){$.trim($(".user-login").val())&&$.trim($(".user-password").val())&&$("#loginForm").addClass("submited")});n.on("click",".modal__close-button",function(n){n.stopPropagation();n.preventDefault();f($(n.target).closest(".modal.___opened-modal-dialog"))});n.on("click",".modal__backdrop",function(n){!$(n.target).is(".modal")&&t.hasClass("___is-modal-open")&&$(".modal.___no-close:visible").length===0&&f()});n.on("click",".modal",function(n){n.stopPropagation()});$(document).on("close-all-modal-dialogs",function(){i.forEach(function(n){n.removeClass("___opened-modal-dialog");n.hide()});i=[];t.removeClass("___is-modal-open");u.removeClass("___noscroll");r.fadeOut();f()});$(document).on("close-top-modal-dialog",function(){f()});$(".modal").on("modalShowed",function(n){var t=$(n.currentTarget).find("button[type=submit]").eq(0);t&&t.focus()})}var UserInfo={isAuthenticated:!1,fullName:"Анонимный пользователь",roles:[],level:-1,email:"",orgRegCode:-1,orgRoles:{isOrganVlasti:!1,isSubject:!1,isObject:!1,isGabs:!1}},Utils,daeProto,BrowserInfo;UserInfo.getSelectSubjectEnabled=function(){var n=this.orgRoles;return this.level===Utils.UsersLevelEnum.Federal&&(n.isOrganVlasti||n.isSubject)?!0:(this.level===Utils.UsersLevelEnum.Municipal||this.level===Utils.UsersLevelEnum.Municipal)&&n.isOrganVlasti||n.isGabs?!0:!1};Utils=Utils||{_mainNgControllerNode:'[ng-controller="mainController as mainCtrl"]',_firstDayOfYear:null,_currentYear:null,_currentDate:null,_loader:null,_loaderCounter:0,formVariables:{textboxPlaceholder:"Ничего не введено",selectPlaceholder:"Ничего не выбрано"},AuditEventType:{InternalAudit:null,Audit:21,ExpertAnalitical:22},AuditType:{Planned:4,Unplanned:5},AuditControlKind:{ExternalGovernment:2,InternalGovernment:3,InternalFinance:4},OrgReestrTypes:{subject:1,object:2,organVlasti:3,glavAdmin:4},SavingTypes:{update:1,offer:2,approve:3,reject:4,recover:5},SurveyStatus:{Created:2,Signed:310,Published:3,Closed:4,Archive:510},SurveyUserStatus:{UnPassed:1,Passed:2,Closed:3},SurveyType:{Public:2,Private:3,Targeted:4},SurveyPage:{Input:1,Output:2,Archive:3},SurveyPageNew:{Archive:3,My:4,Available:5,Passed:6,Expired:7},TypeSurveyQuestion:{PrivateListSelectOneOption:3,PrivateListSelectMultipleOptions:4,OpenListSelectOneOption:5,OpenListSelectMultipleOptions:6,FreeResponse:9},EmptyQuestionName:"Пропустить вопрос",UsersLevelEnum:{Federal:2,Municipal:3,Regional:4},DataStatusEnum:{Draft:2,OnAgreement:3,Included:4,Rejected:5},ControlObjectDataStatusEnum:{Draft:1,OnAgreement:2,Rejected:3,Included:4},SurveyViewMode:{Preview:1,Participate:2,ViewAnwsers:3,ConditionalSkip:4,FilterAnwsers:5},AuditEventDocumentKind:{AuditAct:432,InspectionAct:612,Submission:2,InformationLetter:14,InformationLetterExecution:15,Requirement:3,BudgetaryMeasuresNotice:4,ProtocolOnAdministrativeOffense:5,ExpertAnalyticalEventReport:9,AuditResultsReport:442,RequirementSubmissionAnswer:10,RegulationsImplementationDocument:11,BudgetaryMeasuresExecution:12,AdministrativeOffenseOrdinance:13,TransactionsSuspensionAppeal:65,AccountsTransactionsSuspend:66,FinancialPaymentSuspendDecision:67,TransactionsSuspendDecision:68,AdministrativeFinePaymentInformation:820,ContactingLawEnforcementAgencies:830,AppealToLawEnforcementAgenciesResponse:840,OtherKind:412,LatestInformation:162,Conclusion:422,AnalyticalNote:2292,AnalyticalReport:2302},FavoritesButtonState:{None:0,Checked:1,Disabled:2},SurveyEditRequestStateEnum:{Create:1,Refuse:2,Execute:3,Cancel:4},LegalActApplyingEnum:{LegalBasisViolationsQualification:2,ResponsibilityMeasure:3,AdministrativeOffensesType:320},RequestType:{GET:"GET",POST:"POST",HEAD:"HEAD"},SpecialOrgCodes:{AccountsChamberOrganizationId:266201,FederalTreasuryOrganizationId:266822},BudgetaryMeasureEnforcement:{indisputablePenalty:2,indisputablePenaltyForUseBudget:3,indisputableLatePaymentPenalties:4},BudgetKind:{sources:54,incomingBudgetCredits:55,cashPaymentsBudgetCredits:56,paymentForGettingValuesSovereignFund:315456932,incomings:45,taxAndNonTaxRevenues:46,transfersFromDifferentLevelBudgets:47,expanses:48,budgetaryAppropriations:49,transfersDifferentLevelBudgets:50,shareCapitalPayment:51,subsidies:52,publicDebtManagment:53,extensionSubsidiesLegalPerson:1040046732,another:302},ViewBudgetClassification:{viewSources:1,viewExpanses:2,viewIncomings:3},RequirementStatusId:{completed:1,notFullyCompleted:2,notCompleted:3,inProgress:4},ExecutionStateInternalPlan:{excluded:4,complete:3,InProgress:2,planning:1},PlanStatus:{isDraft:0,finalDraftWithSignature:1,finalDraftWithCommit:2,isDraftWithNoValidSignature:3},CharacterOfViolation:{unenumerated:552},TakenMeasureType:{repaymentToBudget:8},DocumentExecutionStatus:{proceedingsStoppedBySupervisorInitiative:10},HistoryStatus:{PlanSign:1,PlanConfirm:2,PlanConfirmSign:3,Edit:4,EditDataSign:5,EditDataConfirm:6,ExclusionSign:7,ExclusionConfirm:8,ExclusionEditConfirm:9,ExclusionEditSign:10,Restore:11,ResultSign:12,ResultConfirm:13,ResultConfirmSign:14,CreateDraft:15,EditDraft:16,FirstSigned:17,EditedReSigned:18,EditedSigned:19,FirstConfirm:20,EditedReConfirmed:21,EditedConfirmed:22,CreateDraftKM:23,EditDraftKM:24,FirstSignedKM:25,EditedReSignedKM:26,EditedSignedKM:27,CreateDocKM:28,EditDocKM:29,DeleteDocKM:30,SignDocKM:31,MigrateData:34,AutoDraft:35,CreateReportDraft:36,FirstSignReport:37,ReSignReport:38,SignedReportToDraft:39,FirstApproveReport:40,ReApproveReport:41,ApprovedReportToDraft:42,EditReportDraft:43,CreatedByService:44,EditByService:45,CreateDocKMByService:46,EditDocKMByService:47}};Utils.setBreadcrumbUrl=function(n){$("#breadcrumb-url").val(n).change()};Utils.getSurveyBreadcrumbUrl=function(n,t){switch(n){case Utils.SurveyStatus.Published:return t===Utils.SurveyUserStatus.Passed?"/surveys/passed":"/surveys/available";case Utils.SurveyStatus.Closed:return"/surveys/expired";case Utils.SurveyStatus.Archive:return"/surveys/archive"}return""};Utils.showAlertMessage=function(n,t,i){i=i||{};var e=Math.floor(Math.random()*1e6+1),u=i.selector?i.selector:"#"+e,o=i.AutoClose!==!1,s=i.AutoCloseTime||5e3,f=i.onCloseCallback,r=$(['<div role="alertdialog" class="popup__alert__body {0}">'.format(t),'<button class="pull-right js___alert-close icons-fgis icons-fgis_white icon-close"><\/button>',"<table>","<tr>","<td>",'<i class="icons-fgis icons-fgis_white icons-32 icon-info"><\/i>',"<\/td>","<td>",'<h3 role="alert" class="h3 alert-text">{0}<\/h3>'.format(n),"<\/td>","<\/tr>","<\/table>","<\/div>"].join(""));$("body").prepend('<div role="alertdialog" class="popup popup__alert" id="'+u.replace("#","")+'"><\/div>');$(u).html(r);setTimeout(function(){r.addClass("show")},1);r.click(function(){r.removeClass("show");setTimeout(function(){$(u).remove()},500);typeof f=="function"&&f()});$(document).on("click",".js___alert-close",function(){return $(u).remove(),!1});o&&setTimeout(function(){r.find(".js___alert-close").click()},s)};Utils.DigitalSignatureStatusDictionaryForVFA=[{Content:"Подписано ЭП",Value:Utils.PlanStatus.finalDraftWithSignature,IconClass:"icons-fgis icons-fgis_blue icon-checked"},{Content:"Подтверждено",Value:Utils.PlanStatus.finalDraftWithCommit,IconClass:"icons-fgis icons-fgis_blue icon-stamp"},{Content:"ЭП недействительна",Value:Utils.PlanStatus.isDraftWithNoValidSignature,IconClass:"icons-fgis icons-fgis_blue icon-unchecked"},{Content:"Черновик",Value:Utils.PlanStatus.isDraft,IconClass:"icons-panel icons-panel_blue icon-draft"}];Utils.DigitalSignatureStatusDictionary=[{Content:"Подписано",Value:3,ImageIndex:42},{Content:"Невалидна",Value:2,ImageIndex:43},{Content:"Пусто",Value:1,ImageIndex:37},{Content:"Не задано",Value:0,ImageIndex:5}];jQuery.fn.extend({applyNotValidCSS:function(){this.addClass("not-invalid-control")},applyValidCSS:function(){this.removeClass("not-invalid-control")}});Utils.getNgInjector=function(){if(!window.angular)throw"Не загружен модуль Angular";var t=window.angular.element(document.body),n=t.injector();if(!n)throw"Не удалось инициализировать Angular Injector";return n};Utils.launchCallback=function(n,t){n&&(n.fire?n.fire(this,t):n(t))};Utils.getErrorMessage=function(n){var i=$("<div>").html(n).find(".page__content"),t=i.find("h1").html().trim()||"Ошибка";t.length>0&&t[t.length-1]==="."&&(t=t.substr(0,t.length-1));var e=(i.find("h2").html()||"").trim()||"Во время обработки запроса произошла ошибка.",r=(i.find("h3").html()||"").trim(),u=(i.find("#details").html()||"").trim(),f=null;return r&&u&&(f="<pre><strong>"+r+"<\/strong>\n\n"+u+"<\/pre>"),{message:r,stackTrace:f}};Utils.callServiceFunction=function(n,t,i,r,u){var f={cache:t.Cache?t.Cache:!1,url:"{0}/{1}".format(t.Controller?Utils.URLGenerator.getSiteRoot()+t.Controller:Utils.URLGenerator.getAuthorizedDataServiceURL(),n),type:t.RequestType||"GET"},a,o,c,s,v,e,l,h,y;return i==="Registration"&&(f.url="{0}/{1}".format(Utils.URLGenerator.getAuthorizedRegistrationCtrlURL(),n)),f.url=Utils.URLGenerator.checkIsCache(f.url),a=t.Fail,o=function(n){if(typeof n=="object"&&(n||{}).IsResponseData===!0){Utils.showResponseMessage(n);var t=(n||{}).Data;if(typeof t=="object"&&(t||{}).IsResponseData===!0)return o(t),t}else n&&n.HasError&&n.Errors&&Utils.showErrorMessage(n.Errors.map(function(n){return n.ErrorMessage}).join("<br>"));return n},f.error=function(n,t,i){n=o(n);Utils.launchCallback(a,{response:n,textStatus:t,errorThrown:i});n.status===403&&Utils.setCookie("PPSESSIONID","",{expires:-1})},c=t.Success,f.success=function(n){n=o(Utils._convertResponseToData(n));typeof u!="undefined"&&u.success&&u.success(c,n);Utils.launchCallback(c,n)},t.Loader!==!1&&(s=Utils.getNgInjector(),s!=null?(v=s.get("$q"),e=s.get("$rootScope"),f.beforeSend=Utils.safeGet(t,"Loader.BeginAction",function(){l=v.defer();e.ajaxCalls.push(l.promise);e.$$phase!="$apply"&&e.$$phase!="$digest"&&e.$apply()}),f.complete=Utils.safeGet(t,"Loader.EndAction",function(){l.resolve(!0);e.$$phase!="$apply"&&e.$$phase!="$digest"&&e.$apply()})):(f.beforeSend=Utils.safeGet(t,"Loader.BeginAction",function(){Utils.showDefaultLoader()}),f.complete=Utils.safeGet(t,"Loader.EndAction",function(){Utils.hideDefaultLoader()}))),h=t.Data||{},f.type==Utils.RequestType.POST?(f.dataType="json",f.contentType="application/json; charset=utf-8",f.data=JSON.stringify(h)):(y=Object.keys(h).map(function(n){return"{0}={1}".format(n,h[n])}).join("&"),f.url="{0}?{1}".format(f.url,y)),Utils.isNullOrUndefined(t.async)||t.async||(f.async=t.async),$.ajax(f)};Utils.getDateTimeManagerService=function(){return Utils.getNgInjector().get(DateTimeManagerService.getModuleName())};Utils.getDataManagerService=function(){return Utils.getNgInjector().get(DataManagerService.getModuleName())};Utils.popValueByKey=function(n,t){var i=n[t];return delete n[t],i};Utils.getUriParameterByName=function(n,t){n=n.toLowerCase();t=typeof t=="undefined"?"":t;n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+n+"=([^&#]*)"),i=r.exec(location.search.toLowerCase());return i===null?t:decodeURIComponent(i[1].replace(/\+/g," "))};Utils.changeUrlParam=function(n,t){var r,o;n=n.toLowerCase();var i=(window.location.href+"&").toLowerCase(),f=new RegExp("\\b("+n+"=).*?(&|$)"),e="";if(e=i.search(f)>=0?i.replace(f,"$1"+t+"$2"):i+(i.indexOf("?")>0?"&":"?")+n+"="+t,r=Utils.getUriParameterByName(n),r!==null&&r!==""||(r==null||r=="")&&i.indexOf(n+"=")>-1)try{window.history.replaceState("","",e.slice(0,-1))}catch(u){console.log(u)}else if(o=window.location.href,o.indexOf("?")!==-1)try{window.history.replaceState("","",i.slice(0,-1)+"&"+n+"="+t)}catch(u){console.log(u)}else try{window.history.replaceState("","",i.slice(0,-1)+"?"+n+"="+t)}catch(u){console.log(u)}};Utils.formatToDmyDate=function(n,t){return t||(t="."),[Utils.fillZerosBeforeNumber(n.getDate(),2),Utils.fillZerosBeforeNumber(n.getMonth()+1,2),n.getFullYear()].join(t)};Utils.fillZerosBeforeNumber=function(n,t){for(var i=n.toString(),r=[i],u=0;u<t-i.length;u++)r.unshift("0");return r.join("")};Utils.getDateFromUnixUTC=function(n){return new Date((n+new Date(n*1e3).getTimezoneOffset()*60)*1e3)};Utils.getDateFromCSHARP=function(n){return new Date(parseInt(n.replace(/[^0-9 +]/g,"")))};Utils.safeGet=function(n,t,i){var r,u;return Utils.isNullOrUndefined(n)?i:(r=t.indexOf("."),r<0?(n=n[t],Utils.isNullOrUndefined(n)?i:n):(u=t.substring(0,r),Utils.safeGet(n[u],t.substring(r+1),i)))};Utils.arrayContains=function(n,t){for(var i=0;i<n.length;i++)if(t(n[i]))return!0;return!1};Utils.indexOfObjectInArray=function(n,t){for(var i=0;i<n.length;i++)if(Utils.isEqual(n[i],t))return i;return-1};Utils.isEqual=function(n,t){var i,u,f,r;if(typeof n==typeof t){if(typeof n!="object")return n==t;if(n instanceof Array){if(n.length!=t.length)return!1;for(i=n.length-1;i>=0;i--)if(Utils.indexOfObjectInArray(t,n[i])==-1)return!1;return!0}if(n instanceof Date)return t instanceof Date?n.toUnixUTCTime()==t.toUnixUTCTime():!1;if(u=Utils.isNullOrUndefined(n)?[]:Object.keys(n),f=Utils.isNullOrUndefined(t)?[]:Object.keys(t),u.length!=f.length)return!1;for(r in n)if(!Utils.isEqual(n[r],t[r]))return!1}else return!1;return!0};Utils.getFirstDayOfYear=function(){return this._firstDayOfYear||(this._firstDayOfYear=new Date((new Date).getFullYear(),0,1)),this._firstDayOfYear};Utils.getCurrentYear=function(){return this._currentYear||(this._currentYear=(new Date).getFullYear()),this._currentYear};Utils.getCurrentDate=function(){if(!this._currentDate){var n=new Date;this._currentDate=new Date(n.getFullYear(),n.getMonth(),n.getDate())}return this._currentDate};Utils.isNullOrUndefined=function(n){return n===null||typeof n=="undefined"};Utils.isNullOrEmpty=function(n){return n===null||n==""};Utils.getStringByteLength=function(n){if(typeof n!="string")return 0;var u=n,f=u.length,r=0,i=0,t=0;for(i;i<f;i++)t=u.charCodeAt(i),t<=127?r++:r+=t<=2047?2:t<=65535?3:t<=2097151?4:t<=67108863?5:6;return r};Utils.round=function(n,t,i,r){return(typeof n=="string"&&(n=parseFloat(n)),!n||isNaN(n)||n===0)?0:(t=t||0,i&&r?n.toFixed(t).replace(i,r):n.toFixed(t))};Utils.exportWithOptions=function(n){Utils.showOptionsDialog("Выберите формат экспорта",[{Value:2,Content:"XML"}],{SubmitText:"Экспорт",CancelText:"Отмена",Success:function(t,i){i===1?Utils.exportDataFromClassifier(n,"xls"):Utils.exportDataFromClassifier(n,"xml")}})};Utils.formatNumber=function(n){var t=n?kendo.toString(n,"#,#.#####"):"";return isNaN(parseInt(t))?"0":t.replace(",",".")};Utils.convertToBillion=function(n,t){var u,f,r,i;if(u=t===!0?parseInt(n.replace(/\s/g,""))/1e6:parseInt(n)/1e6,u>0)if(u<.01){for(r=String(u).split(""),f=["0.0"],i=3;i<r.length;i++)if(r[i]==="0")f.push(r[i]);else if(r[i]===".")continue;else{f.push(r[i]);break}n=f.join("")}else n=u.toFixed(2);else n=0;return n};Utils.getRandomArbitary=function(n,t){return Math.floor(Math.random()*(t-n))+n};Utils.getRandomString=function(n){return n>10&&(n=10),Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,n)};Utils.showDefaultLoader=function(n){n||this._loaderCounter++;this._loader||(this._loader=new CanvasLoader("canvasloader-container"),this._loader.setColor("#1CA6C0"),this._loader.setShape("spiral"),this._loader.setDiameter(70),this._loader.setDensity(38),this._loader.setRange(1));this._loader.show()};Utils.hideDefaultLoader=function(n){(!n&&this._loaderCounter>0&&this._loaderCounter--,this._loader)&&(n||this._loaderCounter===0)&&this._loader.hide()};Utils.firstOrDefault=function(n){return n=n||[],n.length>0?n[0]:null};Utils.escapeJS=function(n){return n==null?"":n.toString().replace(/<script>/gi,"&lt;script&gt;").replace(/<\/script>/gi,"&lt;/script&gt;")};String.prototype.format=function(){var n=arguments;return this.replace(/\{(\d+)\}/g,function(t,i){return typeof n[i]!="undefined"?n[i]:t})};String.prototype.endsWith=function(n){var t=this.indexOf(n);return t!=-1&&t==this.length-n.length};String.prototype.urlEndsWith=function(n){var t=this.split("?")[0].replace(/\/+$/,"");return t.endsWith(n)};String.prototype.normalizeSlashes=function(){return this.replace(/([\/\\]{2,})|(\\)/g,"/")};String.prototype.removeTrailingSymbol=function(n){return this.length>0&&this.substr(-1)===n?this.substr(0,this.length-1):this.toString()};String.prototype.removeInitialSymbol=function(n){return this.length>0&&this.substr(0,1)===n?this.substr(1,this.length-1):this.toString()};Number.prototype.leadingZeros=function(n){var t=this.toString();return new Array(n-t.length+1).join("0")+t};Array.prototype.getObjectIndexByParam=function(n,t){if(this.length>0)for(var i=0;i<this.length;i++)if(Utils.isEqual(Utils.safeGet(this[i],n,null),t))return i;return-1};Array.prototype.max=function(n){for(var i,r=-1,u=null,t=0;t<this.length;t++)i=n(this[t]),i>r&&(r=i,u=this[t]);return u};Array.prototype.mapProperty=function(n){return this.map(function(t){return t[n]})};Array.prototype.find=Array.prototype.find||function(n){var t;if(this==null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof n!="function")throw new TypeError("predicate must be a function");var i=Object(this),u=i.length>>>0,f=arguments[1],r;for(t=0;t<u;t++)if(r=i[t],n.call(f,r,t,i))return r;return undefined};Date.prototype.toShortDateString=function(){var t=this.getMonth()+1,i=this.getDate(),n=function(n){return n>9?n:"0"+n};return"{0}.{1}.{2}".format(this.getFullYear(),n(t),n(i))};Date.prototype.toShortDateTimeString=function(n){var i=this.getMonth()+1,r=this.getDate(),t=function(n){return n>9?n:"0"+n},u="{0}.{1}.{2}".format(t(r),t(i),this.getFullYear()),f=typeof n=="undefined"?"{0} {1}:{2}":"{0}<br /> {1}:{2}",t=function(n){return n>9?n:"0"+n};return f.format(u,t(this.getHours()),t(this.getMinutes()))};Date.prototype.dateFormat=function(n){return n=n.replace("dd",(this.getDate()<10?"0":"")+this.getDate()),n=n.replace("mm",(this.getMonth()<9?"0":"")+(this.getMonth()+1)),n=n.replace("yyyy",this.getFullYear()),n=n.replace("hh",(this.getHours()<10?"0":"")+this.getHours()),n.replace("mi",(this.getMinutes()<10?"0":"")+this.getMinutes())};Date.prototype.toUnixUTCTime=function(){return this.getTime()/1e3-this.getTimezoneOffset()*60};Utils.moveArrayItem=function(n,t,i){n&&n.splice(i,0,n.splice(t,1)[0])};Utils.compareDates=function(n,t){var i=n?moment(n,"DD.MM.YYYY").toDate():moment("01.01.0001","DD.MM.YYYY").toDate(),r=t?moment(t,"DD.MM.YYYY").toDate():moment("01.01.0001","DD.MM.YYYY").toDate();return i<r?-1:i>r?1:0};Utils.URLGenerator={_siteRoot:"",_authorizedDataServiceURL:"",_authorizedRegistrationCtrlURL:"",getSiteRoot:function(){return this._siteRoot.length===0&&(this._siteRoot=$("#site-root-url").val()),this._siteRoot},getAuthorizedDataServiceURL:function(){return this._authorizedDataServiceURL.length===0&&(this._authorizedDataServiceURL="{0}data".format(Utils.URLGenerator.getSiteRoot())),this._authorizedDataServiceURL},checkIsCache:function(n){if(window.cacheUrl==null)return n;var i=!1,r=null,u=null,f=null,t=n.split("/").filter(function(n){if(n!="")return n});switch(t.length){case 4:r=t[1];u=t[2];f=t[3];break;case 3:r=null;u=t[1];f=t[2]}return cacheUrl!=null,cacheActions.forEach(function(n){n.area===r&&n.controller===u&&(typeof n.actions=="string"&&n.actions=="*"?i=!0:typeof n.actions=="object"&&n.actions&&n.actions.forEach(function(n){n===f&&(i=!0)}))}),t[0]=i?cacheUrl.substr(0,cacheUrl.length-1):"/{0}".format(t[0]),t.join("/")},getNonAuthorizedDataServiceURL:function(){return"{0}AuditResults/File".format(Utils.URLGenerator.getSiteRoot())},getAuthorizedRegistrationCtrlURL:function(){return this._authorizedRegistrationCtrlURL.length===0&&(this._authorizedRegistrationCtrlURL="{0}Registration".format(Utils.URLGenerator.getSiteRoot())),this._authorizedRegistrationCtrlURL},getPageUrl:function(){var t=document.URL.toLowerCase(),n=Utils.URLGenerator.getSiteRoot().removeTrailingSymbol("/").toLowerCase();return n===""&&(n=location.host),result=t.substr(t.indexOf(n)+n.length),result||(result="/"),result!=="/"&&(result=result.removeTrailingSymbol("/")),result},getPagePart:function(){var t=this.getPageUrl(),i,n;return t=="/"?n=window.location.pathname:(i=t.split("?"),n=i[0]),n.removeInitialSymbol("/")},generateURL:function(n,t){return this._generateURL(n,t)},_generateURL:function(n,t){t=t||{};var i=$.param(t),r=n.indexOf("?")>=0;return"{0}{1}{2}".format(this.getSiteRoot(),n,i.length>0?"{0}{1}".format(r?"&":"?",i):"")},ViolationDescription:function(n){return this._generateURL("violations/show",n)},ViolationEdit:function(n){return this._generateURL("violations/edit",n)},ViolationNew:function(n){return this._generateURL("violations/new",n)},ViolationCopy:function(n){return this._generateURL("violations/copy",n)},ViolationsClassifier:function(n){return this._generateURL("violations",n)},ViolationTypesDescription:function(n){return this._generateURL("violations/type-show",n)},ViolationTypesEdit:function(n){return this._generateURL("violations/type-edit",n)},LegalActs:function(n){return this._generateURL("#/rds/legal-acts-list",n)},LegalActDescription:function(n){return this._generateURL("legalacts/show",n)},LegalActEdit:function(n){return this._generateURL("legalacts/edit",n)},LegalActArticleDescription:function(n){return this._generateURL("legalactarticles/show",n)},LegalActArticleEdit:function(n){return this._generateURL("legalactarticles/edit",n)},OrgSvodReestrDescription:function(n){return this._generateURL("classifiers/show",n)},OrgSvodReestrClassifier:function(n){return n.classifier=="3"?this._generateURL("#/rds/organizations-list"):this._generateURL("classifiers",n)},OrgSvodReestrEdit:function(n){return this._generateURL("classifiers/roleedit",n)},OrgSvodReestrUnifiedClassifierEdit:function(n){return this._generateURL("classifiers/unifiedclassifieredit",n)},OrgSvodReestrSimpleCreate:function(n){return this._generateURL("classifiers/create",n)},OrgSvodReestrSimpleEdit:function(n){return this._generateURL("classifiers/edit",n)},MapTopobaseSvg:function(n){return this._generateURL("Content/img/Topobase/SVG",n)},ExpertAnalyticalResultsList:function(n){return this._generateURL("#/expert-analytical-audit-results",n)},ExpertAnalyticalResultView:function(n){return this._generateURL("AnalyticalAudit/Results/Details",n)},ExpertAnalyticalResultEdit:function(n){return this._generateURL("AnalyticalAudit/Results/Edit",n)},ExpertAnalyticalResultCreate:function(n){return this._generateURL("AnalyticalAudit/Results/Create",n)},AuditResultReport:function(n){return this._generateURL("AuditResults/Reporting",n)},AnalyticalAndControlAuditPlansList:function(n){return this._generateURL("Plans/AnalyticalAndControlAudit",n)},PlansList:function(n){return this._generateURL("Plans/ControlAudit",n)},PlanView:function(n){return this._generateURL("Plans/ControlAudit/Details",n)},PlanCreate:function(n){return this._generateURL("Plans/ControlAudit/Create",n)},PlanEdit:function(n){return this._generateURL("Plans/ControlAudit/Edit",n)},AnalyticalAuditPlansList:function(n){return this._generateURL("Plans/AnalyticalAudit",n)},AnalyticalAuditPlanView:function(n){return this._generateURL("Plans/AnalyticalAudit/Details",n)},AnalyticalAuditPlanCreate:function(n){return this._generateURL("Plans/AnalyticalAudit/Create",n)},AnalyticalAuditPlanEdit:function(n){return this._generateURL("Plans/AnalyticalAudit/Edit",n)},InternalAuditPlansList:function(n){return this._generateURL("InternalAudit/Plans",n)},InternalAuditPlanView:function(n){return this._generateURL("InternalAudit/Plans/Details",n)},InternalAuditPlanCreate:function(n){return this._generateURL("InternalAudit/Plans/Create",n)},InternalAuditPlanEdit:function(n){return this._generateURL("InternalAudit/Plans/Edit",n)},AuditResultsList:function(n){return this._generateURL("#/audit-results",n)},AuditResultView:function(n){return this._generateURL("ControlAudit/Results/Details",n)},AuditResultCreate:function(n){return this._generateURL("ControlAudit/Results/Create",n)},AuditResultEdit:function(n){return this._generateURL("ControlAudit/Results/Edit",n)},AuditResultDocuments:function(n){return this._generateURL("ControlAudit/Results/AuditResultDocuments",n)},InternalAuditResultsList:function(n){return this._generateURL("InternalAudit/Results",n)},InternalAuditResultView:function(n){return this._generateURL("InternalAudit/Results/Details",n)},InternalAuditResultCreate:function(n){return this._generateURL("InternalAudit/Results/Create",n)},InternalAuditResultEdit:function(n){return this._generateURL("InternalAudit/Results/Edit",n)},NotificationAdminView:function(n){return this._generateURL("Adminpanel/NotificationAdmin/Details",n)},NotificationAdminCreate:function(n){return this._generateURL("Adminpanel/NotificationAdmin/Create",n)},NotificationAdminEdit:function(n){return this._generateURL("Adminpanel/NotificationAdmin/Edit",n)},NotificationAdminList:function(){return this._generateURL("Adminpanel/NotificationAdmin/Index")},LogOff:function(){return this._generateURL("account/LogOff")},ReAuthorize:function(){return this._generateURL("account/logoff?reauthorize=true")},SurveyCreate:function(n){return this._generateURL("surveys/create",n)},SurveyEdit:function(n){return this._generateURL("surveys/edit",n)},SurveyResults:function(n){return this._generateURL("surveys",n)},AvailableSurveys:function(n){return this._generateURL("surveys/available",n)},PassedSurveys:function(n){return this._generateURL("surveys/passed",n)},ExpiredSurveys:function(n){return this._generateURL("surveys/expired",n)},MySurveys:function(n){return this._generateURL("surveys/my",n)},ArchiveSurveys:function(n){return this._generateURL("surveys/archive",n)},embeddedSurvey:function(n){return this._generateURL("surveys/SurveyForIframe",n)},SurveyParticipate:function(n){return this._generateURL("surveys/participate",n)},SurveyPassed:function(n){return this._generateURL("surveys/passedsurvey",n)},SurveyDetails:function(n){return this._generateURL("surveys/details",n)},SurveyStatistics:function(n){return this._generateURL("surveys/statistics",n)},SurveyView:function(n){return this._generateURL("surveys/preview",n)},SurveyAnswers:function(n){return this._generateURL("surveys/answers",n)},SurveyAnswerDetails:function(n){return this._generateURL("surveys/answerdetails",n)},NewsList:function(n){return this._generateURL("news",n)},NewsNew:function(n){return this._generateURL("news/edit",n)},NewsRedactor:function(n){return this._generateURL("news/newsredactor",n)},NewsImages:function(n){return n?"{0}{1}{2}".format(Utils.URLGenerator.getAuthorizedDataServiceURL(),"/GetImageData?id=",n):""},CreateUser:function(){return this._generateURL("adminpanel/users/create")},EditUser:function(n){return this._generateURL("adminpanel/users/edit",n)},DeleteUser:function(n){return this._generateURL("adminpanel/users/delete",n)},GetAllUsersXML:function(n){return this._generateURL("data/GetAllUsersXML",n)},UserRequestView:function(n){return this._generateURL("Registration/UserRequestView",n)},UserRequestForm:function(n){return this._generateURL("Registration",n)},getCertByDsLink:function(n){n=n||{};var t=$.param(n);return"{0}/getcert{1}".format(Utils.URLGenerator.getAuthorizedDataServiceURL(),t.length>0?"?{0}".format(t):"")},KB:function(n){return this._generateURL("kb",n)},EditFAQ:function(n){return this._generateURL("kb/editfaq",n)},FAQ:function(n){return this._generateURL("kb/faq",n)},FAQDetails:function(n){return this._generateURL("kb/showfaq",n)},EditGlossary:function(n){return this._generateURL("kb/editglossary",n)},Glossary:function(n){return this._generateURL("kb/glossary",n)},GlossaryDetails:function(n){return this._generateURL("kb/showglossary",n)},EditStandard:function(n){return this._generateURL("kb/editstandard",n)},EditOpenData:function(n){return this._generateURL("opendata/edit",n)},Standard:function(n){return this._generateURL("kb/standard",n)},OpenData:function(n){return this._generateURL("opendata",n)},OpenDataUrl:function(n){return Utils.URLGenerator.getSiteRoot()+"OpenData/"+n},ViewOpenData:function(n){return this._generateURL("opendata/view",n)},StandardDetails:function(n){return this._generateURL("kb/showstandard",n)},Help:function(n){return this._generateURL("kb/system",n)},HelpDetails:function(n){return this._generateURL("kb/showsystem",n)},EditHelp:function(n){return this._generateURL("kb/editsystem",n)},UploadFile:function(n){return"{0}/{1}?{2}".format(Utils.URLGenerator.getAuthorizedDataServiceURL(),typeof Uint8Array=="undefined"?"UploadFileUint8Array":"UploadFile",$.param({isPublic:n}))},DownloadFile:function(n){n=n||{};var t=$.param(n);return"{0}/downloadfile{1}".format(Utils.URLGenerator.getAuthorizedDataServiceURL(),t.length>0?"?{0}".format(t):"")},DownloadFileForAllUsers:function(n){n=n||{};var t=$.param(n);return"{0}/DownloadFileForAllUsers{1}".format(Utils.URLGenerator.getAuthorizedDataServiceURL(),t.length>0?"?{0}".format(t):"")},DownloadFileById:function(n){n=n||{};var t=n.filekey,i="{0}/GetFileById/{1}".format(Utils.URLGenerator.getNonAuthorizedDataServiceURL(),t>0?"{0}".format(t):"");return n.toOpen&&(i="{0}/GetFileById/{1}{2}".format(Utils.URLGenerator.getNonAuthorizedDataServiceURL(),t>0?"{0}".format(t):"","?toOpen=true")),i},DownloadFileByGuid:function(n){n=n||{};var t=n.filekey;return"{0}/GetFileByGuid/{1}".format(Utils.URLGenerator.getNonAuthorizedDataServiceURL(),t?"{0}".format(t):"")},DownloadUserCertificateFile:function(n){return this._generateURL("data/getusercertificatefile",n)},GetAccessProtocol:function(n){return this._generateURL("AccessProtocol/GetAccessProtocol",n)},GetOrgSvodReestrXML:function(n){return this._generateURL("data/GetOrgSvodReestrXML",n)},GetOrgSvodReestrXLS:function(n){return this._generateURL("data/GetOrgSvodReestrXLS",n)},GetOrgSvodReestrItemXML:function(n){return this._generateURL("data/GetOrgSvodReestrItemXML",n)},GetObjOrgSvodReestrXML:function(n){return this._generateURL("data/GetControlObjectsExport",n)},GetAllObjOrgSvodReestrXML:function(n){return this._generateURL("data/GetAllControlObjectsExport",n)},GetSubjOrgSvodReestrXML:function(n){return this._generateURL("data/GetControlSubjectsExport",n)},GetAllSubjOrgSvodReestrXML:function(n){return this._generateURL("data/GetAllControlSubjectsExport",n)},GetOpenDataXML:function(n){return this._generateURL("OpenedData/XmlExport/GetOpenDataDictionaries",n)},GetOpenDataCSV:function(n){return this._generateURL("OpenedData/CsvExport/GetOpenDataDictionaries",n)},MapDetails:function(n){return this._generateURL("#/audit-geography/list",n)},ClassifiersList:function(n){return this._generateURL("rds/list",n)},RegistrationList:function(n){return this._generateURL("registration/requests",n)}};Utils.getOffsetRect=function(n){var r=n.getBoundingClientRect(),t=document.body,i=document.documentElement,u=window.pageYOffset||i.scrollTop||t.scrollTop,f=window.pageXOffset||i.scrollLeft||t.scrollLeft,e=i.clientTop||t.clientTop||0,o=i.clientLeft||t.clientLeft||0,s=r.top+u-e,h=r.left+f-o;return{top:Math.round(s),left:Math.round(h)}};Utils.setCookie=function(n,t,i){$.cookie(n,t,{expires:3e3,path:"/"});i&&i.expires===-1&&localStorage.removeItem(n)};Utils.getCookie=function(n){return $.cookie(n)};Utils.utf8_to_b64=function(n){return window.btoa(unescape(encodeURIComponent(n)))};Utils.b64_to_utf8=function(n){return decodeURIComponent(escape(window.atob(n)))};Utils.parameterMap=function(n){var t={};return t.sort=n.sort?$.map(n.sort,function(n){return n.field+"-"+n.dir}).join("~"):"",n.page&&(t.page=n.page),n.pageSize&&(t.pageSize=n.pageSize),t.group=n.group?$.map(n.group,function(n){return n.field+"-"+n.dir}).join("~"):"",n.aggregate&&(t.aggregate=$.map(n.aggregate,function(n){return n.field+"-"+n.aggregate}).join("~"),delete n.aggregate),n.filter?(t.filter=Utils.serializeFilter(n.filter,!1),delete n.filter):(t.filter="",delete n.filter),t};Utils.dateToUtcIso=function(n){return n==null?null:new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())).toISOString()};SessStor={ClearData:function(n){return sessionStorage[n]?delete sessionStorage[n]:{}},GetData:function(n){var t=sessionStorage[n]?$.parseJSON(sessionStorage[n]):{};if(UserInfo.isAuthenticated){if(t.user===UserInfo.email)return t}else if(t.user==="anonymous")return t;return{}},SaveData:function(n,t,i){var r=SessStor.GetData(n),u;r&&(r[t]=i);UserInfo.isAuthenticated?UserInfo&&UserInfo.email&&(r.user=UserInfo.email):r.user="anonymous";u=JSON.stringify(r);sessionStorage.setItem(n,u)},GetDataColumns:function(n,t){var i=SessStor.GetData(t),r;if(!i||!i.DataColumn)return{};for(r=0;r<i.DataColumn.length;r++)if(n.Caption===i.DataColumn[r].Caption){n.Visible=i.DataColumn[r].Visible;n.Width=i.DataColumn[r].Width;break}return n},ApplyStorageColumnSettings:function(n,t){for(var i=0;i<n.length;i++){var r=n[i],f=t.filter(function(n){return n.Field===r.field}),u=f.length>0?f[0]:null;u&&(r.hidden=typeof u.Visible!="undefined"?!u.Visible:typeof r.hidden!="undefined"?r.hidden:!1)}}};Utils.setNgTimeout=function(n,t){var i=Utils.getNgInjector("$timeout").get("$timeout");return i(n,t)};Utils._convertResponseToData=function(n){var t=n;return t.getItems=function(){return Array.isArray(t)||typeof t.Items=="undefined"?t:t.Items},t};Utils.DictionaryApiExport=function(n){this.key=n.key;this.exportExcel=n.exportExcel;this.exportXml=n.exportXml;this.filter=n.filter;this.params=null;this.init()};daeProto=Utils.DictionaryApiExport.prototype;daeProto.init=function(){var n;this.formatType={None:0,Xls:1,Xml:2,XlsXsd:3,Docx:4,Zip:5};this.exportExcel&&this.key!=null&&parseInt(this.key)>0&&(n=this,$("#"+this.exportExcel).attr("href","#").click(function(){n.checkFile()}));this.exportXml&&this.key!=null&&parseInt(this.key)>0&&(n=this,$("#"+this.exportXml).attr("href","#").click(function(){n.exportFileXml()}))};daeProto.getParams=function(n){this.setParamsFromFilter();return{dictionaryKeys:[this.key],exportFormat:n||-1,filters:this.params!=null?JSON.stringify(this.params):null}};daeProto.setParamsFromFilter=function(){this.filter!=null&&this.filter._getFilterData&&(this.params=this.filter._getFilterData())};daeProto.checkFile=function(){var n=this;Utils.callServiceFunction("CheckFileBeforeDownload",{Controller:"Rds",Data:this.getParams(this.formatType.Xml),Success:function(t){n._onCheckFile(t)},RequestType:"POST"},undefined,!0)};daeProto._onCheckFile=function(n){if(n.Data.length==0)this.exportFile(this.formatType.Xls);else{var t=this;Utils.getNgInjector().get(ModalWindowService.getNameAsString()).showConfirmWindow("Справочник содержит большое количество записей и не может быть выгружен в формате Xls.<br/>Выгрузить возможно в формате Xml, продолжить?","Внимание","Да","Нет",{callback:function(){t.exportFileXml()}})}};daeProto.exportFileXml=function(){this.exportFile(this.formatType.Xml)};daeProto.exportFile=function(n){Utils.callServiceFunction("GetTokenForDownload",{Controller:"Rds",Data:this.getParams(n),Success:function(){},RequestType:"POST"},undefined,!0).then(function(n){var t="token={0}".format(n),i="{0}{1}".format(cacheUrl==null?Utils.URLGenerator.getSiteRoot():cacheUrl,"File/DownloadTempFileByToken"),r="{0}?{1}".format(i,t),u=$('<form method="post" action="{0}"><\/form>'.format(r));u.appendTo(document.body).submit().remove()})};daeProto=null;Utils.CheckChangesPlansItem=function(n,t){var i=[],r=!1;return t.forEach(function(n){var t=typeof n=="number"?n:n.Key;i.push(t)}),n.forEach(function(n){var t=typeof n=="number"?n:n.Key;r=!(i.indexOf(t)>-1)}),n.length!=t.length||r};Utils.CheckArrayObjectsForDeletedPP=function(n,t,i){var r=[],e=t||[],u,f;return n.CmPunkts.forEach(function(n){n.Objects&&n.Objects.length>0&&n.Objects.forEach(function(n){r.indexOf(n)==-1&&r.push(n)})}),u=[],r.forEach(function(n){e.indexOf(n)==-1&&u.push(n)}),f=!0,i&&i.length>0&&i.forEach(function(n){n.objectKey&&n.objectKey!=null&&u.indexOf(n.objectKey)==-1&&(f=!1)}),f};Utils.GetDefaultValueForResponsiveList=function(n){var t=[];return Array.isArray(n)&&(n.forEach(function(n){n.EmployeeValid||(n.AgencyOldValue=n.Agency,n.EmployeeOldValue=n.EmployeeId)}),t=n),t};Utils.GetValueForResponsiveList=function(n){var t=[];return Array.isArray(n)&&(t=n.filter(function(n){return n.Agency!=null}),t.forEach(function(n){typeof n.EmployeeId=="string"&&(n.EmployeeId=n.EmployeeOldValue);typeof n.Agency=="string"&&(n.Agency=n.AgencyOldValue)})),t};Utils.isDOMNode=function(n){try{return n instanceof window.Node}catch(t){return n!==null&&typeof n=="object"&&typeof n.nodeType=="number"&&typeof n.style=="object"&&typeof n.ownerDocument=="object"}};Utils.isDefined=function(n){return typeof n!="undefined"};Utils.Label=function(n){return this._Class=n.Class||"",this._ToolTip=n.ToolTip||"",'<span title="{0}" class="text"><div class="{1}"><\/div><\/span>'.format(this._ToolTip,this._Class)};Utils.checkObjectValue=function(n,t){for(key in n)if(n[key]===t)return!0;return!1};Utils.addFlash=function(n){var t=SessStor.GetData("ApplicationStorage")&&SessStor.GetData("ApplicationStorage").Messages?SessStor.GetData("ApplicationStorage").Messages:[];t.push(n);SessStor.SaveData("ApplicationStorage","Messages",t)};Utils.showFlashes=function(){var t={AutoCloseTime:5e3,onCloseCallback:function(){SessStor.ClearData("ApplicationStorage")}},n=SessStor.GetData("ApplicationStorage")&&SessStor.GetData("ApplicationStorage").Messages?SessStor.GetData("ApplicationStorage").Messages:[];n.length>0&&Utils.showSuccessMessage(n.join("<br />"),t)};Utils.numberCompare=function(n,t){var i=n!=null?n.replace(/[^0-9\.]/g,""):"",r=t!=null?t.replace(/[^0-9\.]/g,""):"",u="",f="";return(i=i!=""&&i!="."?i.split("."):null,r=r!=""&&r!="."?r.split("."):null,i==null&&r!=null)?1:i!=null&&r==null?-1:i==null&&r==null?0:(u=Utils.getNumberFilledZeros(i),f=Utils.getNumberFilledZeros(r),parseInt(u)<parseInt(f))?-1:parseInt(u)>parseInt(f)?1:0};Utils.getNumberFilledZeros=function(n){var r="",t,i;if(Array.isArray(n))for(t=0;t<n.length;t++)if(n[t]!=""){for(i=n[t];i.length<4;)i="0"+i;r+=i}return r};Utils.placeCompare=function(n,t){var i=n.match(/\d+/g),r=t.match(/\d+/g),f,u;if(i==null&&r!=null)return 1;if(i!=null&&r==null)return-1;if(i==null&&r==null)return n>t?1:n<t?-1:0;for(f=Math.min(i.length,r.length),u=0;u<f;u++){if(parseInt(i[u])>parseInt(r[u]))return 1;if(parseInt(i[u])<parseInt(r[u]))return-1}return i.length>r.length?1:i.length<r.length?-1:0};Utils.prepareDataForPageableTreeList=function(n,t){t.sort!=null&&(n=kendo.data.Query.process(n,{sort:t.sort}).data);var i=n.filter(function(n){return n.ParentKey===0||n.ParentKey==null}),r=((t.page||1)-1)*t.pageSize,u=i.slice(r,r+t.pageSize),f=function e(t){var u=t.reduce(function(n,t){return n[t.Key]=!0,n},{}),i=n.filter(function(n){return u[n.ParentKey]}),r=i.filter(function(n){return n.ChildrenCount>0});return r.length>0?i.concat(e(r)):i}(u);return{Data:u.concat(f),Total:i.length}};Utils.getControlById=function(n,t){var i=n.filter(function(n){return n.ContainerId==t});if(Array.isArray(i)&&i.length>0)return i[0]};Utils.debounce=function(n,t){var i;return function(){clearTimeout(i);i=setTimeout(t,n)}};Utils.getFormatLocalDateTimeForSign=function(n){if(n&&n.length>0){var t="DD.MM.YYYY HH:mm:ss";return moment(moment.utc(n,t).toDate()).format(t)}};Utils.scrollToTreeNodeByIndex=function(n,t){var i=n.element.find("tbody tr:eq("+t+")"),r=$(n.element.find(".k-grid-content"));r.scrollTop(i.position().top)};Utils.initPanelFilterWithOuterScope=function(n,t){Object.defineProperty(outerScope,"isCompact",{get:function(){return $(window).innerWidth()<LayoutConsts.tabletMaxWidth}});outerScope.toggleVisibleFilters=function(){outerScope.visibleFilters=!outerScope.visibleFilters;t&&SessStor.SaveData(t,"buttonFilter",outerScope.visibleFilters);outerScope.$applyAsync()};outerScope.visibleFilters=outerScope.isCompact?!1:!!(n.pageState&&n.pageState.buttonFilter);outerScope.$applyAsync()},function(n,t,i,r,u,f){function lr(n,t,i,r,u){return ii(n,n,i,r,t,n.defaultView.pageXOffset,n.defaultView.pageYOffset).then(function(f){var e,s;o("Document cloned");e=kt+u;s="["+e+"='"+u+"']";n.querySelector(s).removeAttribute(e);var h=f.contentWindow,c=h.document.querySelector(s),l=typeof t.onclone=="function"?Promise.resolve(t.onclone(h.document)):Promise.resolve(!0);return l.then(function(){return dt(c,f,t,i,r)})})}function dt(n,i,r,u,f){var e=i.contentWindow,a=new lt(e.document),v=new l(r,a),c=st(n),y=r.type==="view"?u:vr(e.document),p=r.type==="view"?f:yr(e.document),h=new r.renderer(y,p,v,r,t),w=new s(n,h,a,v,r);return w.ready.then(function(){o("Finished rendering");var t;return t=r.type==="view"?gt(h.canvas,{width:h.canvas.width,height:h.canvas.height,top:0,left:0,x:0,y:0}):n===e.document.body||n===e.document.documentElement||r.canvas!=null?h.canvas:gt(h.canvas,{width:r.width!=null?r.width:c.width,height:r.height!=null?r.height:c.height,top:c.top,left:c.left,x:e.pageXOffset,y:e.pageYOffset}),ar(i,r),t})}function ar(n,t){t.removeContainer&&(n.parentNode.removeChild(n),o("Cleaned up container"))}function gt(n,i){var f=t.createElement("canvas"),r=Math.min(n.width-1,Math.max(0,i.left)),e=Math.min(n.width,Math.max(1,i.left+i.width)),u=Math.min(n.height-1,Math.max(0,i.top)),s=Math.min(n.height,Math.max(1,i.top+i.height));return f.width=i.width,f.height=i.height,o("Cropping canvas at:","left:",i.left,"top:",i.top,"width:",e-r,"height:",s-u),o("Resulting crop with width",i.width,"and height",i.height," with x",r,"and y",u),f.getContext("2d").drawImage(n,r,u,e-r,s-u,i.x,i.y,e-r,s-u),f}function vr(n){return Math.max(Math.max(n.body.scrollWidth,n.documentElement.scrollWidth),Math.max(n.body.offsetWidth,n.documentElement.offsetWidth),Math.max(n.body.clientWidth,n.documentElement.clientWidth))}function yr(n){return Math.max(Math.max(n.body.scrollHeight,n.documentElement.scrollHeight),Math.max(n.body.offsetHeight,n.documentElement.offsetHeight),Math.max(n.body.clientHeight,n.documentElement.clientHeight))}function ni(){return"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}function pr(){return t.documentMode&&t.documentMode<=9}function ti(n,i){for(var u=n.nodeType===3?t.createTextNode(n.nodeValue):n.cloneNode(!1),r=n.firstChild;r;)(i===!0||r.nodeType!==1||r.nodeName!=="SCRIPT")&&u.appendChild(ti(r,i)),r=r.nextSibling;return u}function ii(n,t,i,r,u,f,e){kr(n);var s=pr()?ti(n.documentElement,u.javascriptEnabled):n.documentElement.cloneNode(!0),o=t.createElement("iframe");return o.className="html2canvas-container",o.style.visibility="hidden",o.style.position="fixed",o.style.left="-10000px",o.style.top="0px",o.style.border="0",o.width=i,o.height=r,o.scrolling="no",t.body.appendChild(o),new Promise(function(t){var i=o.contentWindow.document;ri(n.documentElement,s,"textarea");ri(n.documentElement,s,"select");o.contentWindow.onload=o.onload=function(){var r=setInterval(function(){i.body.childNodes.length>0&&(dr(n,i),clearInterval(r),u.type==="view"&&o.contentWindow.scrollTo(f,e),t(o))},50)};i.open();i.write("<!DOCTYPE html><html><\/html>");wr(n,f,e);i.replaceChild(u.javascriptEnabled===!0?i.adoptNode(s):fi(i.adoptNode(s)),i.documentElement);i.close()})}function ri(n,t,i){for(var u=n.getElementsByTagName(i),f=t.getElementsByTagName(i),e=u.length,r=0;r<e;r++)f[r].value=u[r].value}function wr(n,t,i){n.defaultView&&(t!==n.defaultView.pageXOffset||i!==n.defaultView.pageYOffset)&&n.defaultView.scrollTo(t,i)}function ui(t,i,r,u,f,e){return new uf(t,i,n.document).then(br(t)).then(function(n){return ii(n,r,u,f,e,0,0)})}function br(n){return function(i){var e=new DOMParser,r,u,f;try{r=e.parseFromString(i,"text/html")}catch(s){o("DOMParser not supported, falling back to createHTMLDocument");r=t.implementation.createHTMLDocument("");try{r.open();r.write(i);r.close()}catch(h){o("createHTMLDocument write not supported, falling back to document.body.innerHTML");r.body.innerHTML=i}}return u=r.querySelector("base"),u&&u.href.host||(f=r.createElement("base"),f.href=n,r.head.insertBefore(f,r.head.firstChild)),r}}function kr(n){[].slice.call(n.querySelectorAll("canvas"),0).forEach(function(n){n.setAttribute(d,"canvas-"+hr++)})}function dr(n,t){[].slice.call(n.querySelectorAll("["+d+"]"),0).forEach(function(n){try{var i=t.querySelector("["+d+'="'+n.getAttribute(d)+'"]');i&&(i.width=n.width,i.height=n.height,i.getContext("2d").putImageData(n.getContext("2d").getImageData(0,0,n.width,n.height),0,0))}catch(r){o("Unable to copy canvas content from",n,r)}n.removeAttribute(d)})}function fi(n){return[].slice.call(n.childNodes,0).filter(gr).forEach(function(t){t.tagName==="SCRIPT"?n.removeChild(t):fi(t)}),n}function gr(n){return n.nodeType===Node.ELEMENT_NODE}function nu(n){var i=t.createElement("a");return i.href=n,i.href=i.href,i}function h(n){this.r=0;this.g=0;this.b=0;this.a=null;var t=this.fromArray(n)||this.namedColor(n)||this.rgb(n)||this.rgba(n)||this.hex6(n)||this.hex3(n)}function g(n){if(this.src=n,o("DummyImageContainer for",n),!this.promise||!this.image){o("Initiating DummyImageContainer");g.prototype.image=new Image;var t=this.image;g.prototype.promise=new Promise(function(n,i){t.onload=n;t.onerror=i;t.src=ni();t.complete===!0&&n(t)})}}function tu(n,i){var r=t.createElement("div"),u=t.createElement("img"),f=t.createElement("span"),e="Hidden Text",o,s;r.style.visibility="hidden";r.style.fontFamily=n;r.style.fontSize=i;r.style.margin=0;r.style.padding=0;t.body.appendChild(r);u.src=ni();u.width=1;u.height=1;u.style.margin=0;u.style.padding=0;u.style.verticalAlign="baseline";f.style.fontFamily=n;f.style.fontSize=i;f.style.margin=0;f.style.padding=0;f.appendChild(t.createTextNode(e));r.appendChild(f);r.appendChild(u);o=u.offsetTop-f.offsetTop+1;r.removeChild(f);r.appendChild(t.createTextNode(e));r.style.lineHeight="normal";u.style.verticalAlign="super";s=u.offsetTop-r.offsetTop+1;t.body.removeChild(r);this.baseline=o;this.lineWidth=1;this.middle=s}function li(){this.data={}}function ai(n,t,i){this.image=null;this.src=n;var r=this,u=st(n);this.promise=(t?new Promise(function(t){n.contentWindow.document.URL==="about:blank"||n.contentWindow.document.documentElement==null?n.contentWindow.onload=n.onload=function(){t(n)}:t(n)}):this.proxyLoad(i.proxy,u,i)).then(function(n){return html2canvas(n.contentWindow.document.documentElement,{type:"view",width:n.width,height:n.height,proxy:i.proxy,javascriptEnabled:i.javascriptEnabled,removeContainer:i.removeContainer,allowTaint:i.allowTaint,imageTimeout:i.imageTimeout/2})}).then(function(n){return r.image=n})}function nt(n){this.src=n.value;this.colorStops=[];this.type=null;this.x0=.5;this.y0=.5;this.x1=.5;this.y1=.5;this.promise=Promise.resolve(!0)}function at(n,t){this.src=n;this.image=new Image;var i=this;this.tainted=null;this.promise=new Promise(function(r,u){i.image.onload=r;i.image.onerror=u;t&&(i.image.crossOrigin="anonymous");i.image.src=n;i.image.complete===!0&&r(i.image)})}function l(t,i){this.link=null;this.options=t;this.support=i;this.origin=this.getOrigin(n.location.href)}function et(n){nt.apply(this,arguments);this.type=this.TYPES.LINEAR;var t=n.args[0].match(this.stepRegExp)===null;t?n.args[0].split(" ").reverse().forEach(function(n){switch(n){case"left":this.x0=0;this.x1=1;break;case"top":this.y0=0;this.y1=1;break;case"right":this.x0=1;this.x1=0;break;case"bottom":this.y0=1;this.y1=0;break;case"to":var t=this.y0,i=this.x0;this.y0=this.y1;this.x0=this.x1;this.x1=i;this.y1=t}},this):(this.y0=0,this.y1=1);this.colorStops=n.args.slice(t?1:0).map(function(n){var t=n.match(this.stepRegExp);return t!=null?{color:new h(t[1]),stop:t[3]==="%"?t[2]/100:null}:{color:new h("255, 255, 255"),stop:1}},this);this.colorStops[0].stop===null&&(this.colorStops[0].stop=0);this.colorStops[this.colorStops.length-1].stop===null&&(this.colorStops[this.colorStops.length-1].stop=1);this.colorStops.forEach(function(n,t){n.stop===null&&this.colorStops.slice(t).some(function(i,r){return i.stop!==null?(n.stop=(i.stop-this.colorStops[t-1].stop)/(r+1)+this.colorStops[t-1].stop,!0):!1},this)},this)}function o(){n.html2canvas.logging&&n.console&&n.console.log&&Function.prototype.bind.call(n.console.log,n.console).apply(n.console,[Date.now()-n.html2canvas.start+"ms","html2canvas:"].concat([].slice.call(arguments,0)))}function e(n,t){this.node=n;this.parent=t;this.stack=null;this.bounds=null;this.borders=null;this.clip=[];this.backgroundClip=[];this.offsetBounds=null;this.visible=null;this.computedStyles=null;this.colors={};this.styles={};this.backgroundImages=null;this.transformData=null;this.transformMatrix=null;this.isPseudoElement=!1;this.opacity=null}function iu(n){var t=n.options[n.selectedIndex||0];return t?t.text||"":""}function ru(n){if(n&&n[1]==="matrix")return n[2].split(",").map(function(n){return parseFloat(n.trim())})}function ot(n){return n.toString().indexOf("%")!==-1}function vi(n){var a=" \r\n\t",t,i,o,h,u,l=[],r=0,s=0,f,e,c=function(){t&&(i.substr(0,1)==='"'&&(i=i.substr(1,i.length-2)),i&&e.push(i),t.substr(0,1)==="-"&&(h=t.indexOf("-",1)+1)>0&&(o=t.substr(0,h),t=t.substr(h)),l.push({prefix:o,method:t.toLowerCase(),value:u,args:e,image:null}));e=[];t=o=i=u=""};return e=[],t=o=i=u="",n.split("").forEach(function(n){if(r!==0||!(a.indexOf(n)>-1)){switch(n){case'"':f?f===n&&(f=null):f=n;break;case"(":if(f)break;else{if(r===0){r=1;u+=n;return}s++}break;case")":if(f)break;else if(r===1){if(s===0){r=0;u+=n;c();return}s--}break;case",":if(f)break;else{if(r===0){c();return}if(r===1&&s===0&&!t.match(/^url$/i)){e.push(i);i="";u+=n;return}}}u+=n;r===0?t+=n:i+=n}}),c(),l}function uu(n){return n.replace("px","")}function fu(n){return parseFloat(n)}function st(n){if(n.getBoundingClientRect){var t=n.getBoundingClientRect(),i=n.offsetWidth==null?t.width:n.offsetWidth;return{top:t.top,bottom:t.bottom||t.top+t.height,right:t.left+i,left:t.left,width:i,height:n.offsetHeight==null?t.height:n.offsetHeight}}return{}}function vt(n){var t=n.offsetParent?vt(n.offsetParent):{top:0,left:0};return{top:n.offsetTop+t.top,bottom:n.offsetTop+n.offsetHeight+t.top,right:n.offsetLeft+t.left+n.offsetWidth,left:n.offsetLeft+t.left,width:n.offsetWidth,height:n.offsetHeight}}function s(n,t,i,r,u){var f,s;o("Starting NodeParser");this.renderer=t;this.options=u;this.range=null;this.support=i;this.renderQueue=[];this.stack=new ft(!0,1,n.ownerDocument,null);f=new e(n,null);u.background&&t.rectangle(0,0,t.width,t.height,new h(u.background));n===n.ownerDocument.documentElement&&(s=new e(f.color("backgroundColor").isTransparent()?n.ownerDocument.body:n.ownerDocument.documentElement,null),t.rectangle(0,0,t.width,t.height,s.color("backgroundColor")));f.visibile=f.isElementVisible();this.createPseudoHideStyles(n.ownerDocument);this.disableAnimations(n.ownerDocument);this.nodes=bt([f].concat(this.getChildren(f)).filter(function(n){return n.visible=n.isElementVisible()}).map(this.getPseudoElements,this));this.fontMetrics=new li;o("Fetched nodes, total:",this.nodes.length);o("Calculate overflow clips");this.calculateOverflowClips();o("Start fetching images");this.images=r.fetch(this.nodes.filter(rt));this.ready=this.images.ready.then(ct(function(){return o("Images loaded, starting parsing"),o("Creating stacking contexts"),this.createStackingContexts(),o("Sorting stacking contexts"),this.sortStackingContexts(this.stack),this.parse(this.stack),o("Render queue created with "+this.renderQueue.length+" items"),new Promise(ct(function(n){u.async?typeof u.async=="function"?u.async.call(this,this.renderQueue,n):this.renderQueue.length>0?(this.renderIndex=0,this.asyncRenderer(this.renderQueue,n)):n():(this.renderQueue.forEach(this.paint,this),n())},this))},this))}function yi(n){return n.parent&&n.parent.clip.length}function eu(n){return n.replace(/(\-[a-z])/g,function(n){return n.toUpperCase().replace("-","")})}function pi(){}function wi(n,t,i,r){return n.map(function(u,f){if(u.width>0){var o=t.left,e=t.top,s=t.width,h=t.height-n[2].width;switch(f){case 0:h=n[0].width;u.args=ht({c1:[o,e],c2:[o+s,e],c3:[o+s-n[1].width,e+h],c4:[o+n[3].width,e+h]},r[0],r[1],i.topLeftOuter,i.topLeftInner,i.topRightOuter,i.topRightInner);break;case 1:o=t.left+t.width-n[1].width;s=n[1].width;u.args=ht({c1:[o+s,e],c2:[o+s,e+h+n[2].width],c3:[o,e+h],c4:[o,e+n[0].width]},r[1],r[2],i.topRightOuter,i.topRightInner,i.bottomRightOuter,i.bottomRightInner);break;case 2:e=e+t.height-n[2].width;h=n[2].width;u.args=ht({c1:[o+s,e+h],c2:[o,e+h],c3:[o+n[3].width,e],c4:[o+s-n[3].width,e]},r[2],r[3],i.bottomRightOuter,i.bottomRightInner,i.bottomLeftOuter,i.bottomLeftInner);break;case 3:s=n[3].width;u.args=ht({c1:[o,e+h+n[2].width],c2:[o,e],c3:[o+s,e+n[0].width],c4:[o+s,e+h]},r[3],r[0],i.bottomLeftOuter,i.bottomLeftInner,i.topLeftOuter,i.topLeftInner)}}return u})}function p(n,t,i,r){var s=4*((Math.sqrt(2)-1)/3),e=i*s,o=r*s,u=n+i,f=t+r;return{topLeft:b({x:n,y:f},{x:n,y:f-o},{x:u-e,y:t},{x:u,y:t}),topRight:b({x:n,y:t},{x:n+e,y:t},{x:u,y:f-o},{x:u,y:f}),bottomRight:b({x:u,y:t},{x:u,y:t+o},{x:n+e,y:f},{x:n,y:f}),bottomLeft:b({x:u,y:f},{x:u-e,y:f},{x:n,y:t+o},{x:n,y:t})}}function bi(n,t,i){var r=n.left,u=n.top,f=n.width,e=n.height,a=t[0][0],v=t[0][1],o=t[1][0],y=t[1][1],s=t[2][0],h=t[2][1],w=t[3][0],c=t[3][1],l=f-o,b=e-h,k=f-s,d=e-c;return{topLeftOuter:p(r,u,a,v).topLeft.subdivide(.5),topLeftInner:p(r+i[3].width,u+i[0].width,Math.max(0,a-i[3].width),Math.max(0,v-i[0].width)).topLeft.subdivide(.5),topRightOuter:p(r+l,u,o,y).topRight.subdivide(.5),topRightInner:p(r+Math.min(l,f+i[3].width),u+i[0].width,l>f+i[3].width?0:o-i[3].width,y-i[0].width).topRight.subdivide(.5),bottomRightOuter:p(r+k,u+b,s,h).bottomRight.subdivide(.5),bottomRightInner:p(r+Math.min(k,f-i[3].width),u+Math.min(b,e+i[0].width),Math.max(0,s-i[1].width),h-i[2].width).bottomRight.subdivide(.5),bottomLeftOuter:p(r,u+d,w,c).bottomLeft.subdivide(.5),bottomLeftInner:p(r+i[3].width,u+d,Math.max(0,w-i[3].width),c-i[2].width).bottomLeft.subdivide(.5)}}function b(n,t,i,r){var u=function(n,t,i){return{x:n.x+(t.x-n.x)*i,y:n.y+(t.y-n.y)*i}};return{start:n,startControl:t,endControl:i,end:r,subdivide:function(f){var e=u(n,t,f),o=u(t,i,f),s=u(i,r,f),h=u(e,o,f),c=u(o,s,f),l=u(h,c,f);return[b(n,e,h,l),b(l,c,s,r)]},curveTo:function(n){n.push(["bezierCurve",t.x,t.y,i.x,i.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",i.x,i.y,t.x,t.y,n.x,n.y])}}}function ht(n,t,i,r,u,f,e){var o=[];return t[0]>0||t[1]>0?(o.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(o)):o.push(["line",n.c1[0],n.c1[1]]),i[0]>0||i[1]>0?(o.push(["line",f[0].start.x,f[0].start.y]),f[0].curveTo(o),o.push(["line",e[0].end.x,e[0].end.y]),e[0].curveToReversed(o)):(o.push(["line",n.c2[0],n.c2[1]]),o.push(["line",n.c3[0],n.c3[1]])),t[0]>0||t[1]>0?(o.push(["line",u[1].end.x,u[1].end.y]),u[1].curveToReversed(o)):o.push(["line",n.c4[0],n.c4[1]]),o}function w(n,t,i,r,u,f,e){t[0]>0||t[1]>0?(n.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(n),r[1].curveTo(n)):n.push(["line",f,e]);(i[0]>0||i[1]>0)&&n.push(["line",u[0].start.x,u[0].start.y])}function ou(n){return n.cssInt("zIndex")<0}function su(n){return n.cssInt("zIndex")>0}function ki(n){return n.cssInt("zIndex")===0}function di(n){return["inline","inline-block","inline-table"].indexOf(n.css("display"))!==-1}function gi(n){return n instanceof ft}function hu(n){return n.node.data.trim().length>0}function cu(n){return/^(normal|none|0px)$/.test(n.parent.css("letterSpacing"))}function lu(n){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(t){var r=n.css("border"+t+"Radius"),i=r.split(" ");return i.length<=1&&(i[1]=i[0]),i.map(bu)})}function au(n){return n.nodeType===Node.TEXT_NODE||n.nodeType===Node.ELEMENT_NODE}function vu(n){var t=n.css("position"),i=["absolute","relative","fixed"].indexOf(t)!==-1?n.css("zIndex"):"auto";return i!=="auto"}function tt(n){return n.css("position")!=="static"}function pt(n){return n.css("float")!=="none"}function yu(n){return["inline-block","inline-table"].indexOf(n.css("display"))!==-1}function it(n){var t=this;return function(){return!n.apply(t,arguments)}}function rt(n){return n.node.nodeType===Node.ELEMENT_NODE}function ut(n){return n.isPseudoElement===!0}function wt(n){return n.node.nodeType===Node.TEXT_NODE}function pu(n){return function(t,i){return t.cssInt("zIndex")+n.indexOf(t)/n.length-(i.cssInt("zIndex")+n.indexOf(i)/n.length)}}function wu(n){return n.getOpacity()<1}function ct(n,t){return function(){return n.apply(t,arguments)}}function bu(n){return parseInt(n,10)}function ku(n){return n.width}function du(n){return n.node.nodeType!==Node.ELEMENT_NODE||["SCRIPT","HEAD","TITLE","OBJECT","BR","OPTION"].indexOf(n.node.nodeName)===-1}function bt(n){return[].concat.apply([],n)}function gu(n){var t=n.substr(0,1);return t===n.substr(n.length-1)&&t.match(/'|"/)?n.substr(1,n.length-2):n}function nf(t){for(var u=[],i=0,f=!1,r;t.length;)tf(t[i])===f?(r=t.splice(0,i),r.length&&u.push(n.html2canvas.punycode.ucs2.encode(r)),f=!f,i=0):i++,i>=t.length&&(r=t.splice(0,i),r.length&&u.push(n.html2canvas.punycode.ucs2.encode(r)));return u}function tf(n){return[32,13,10,9,45].indexOf(n)!==-1}function rf(n){return/[^\u0000-\u00ff]/.test(n)}function uf(n,t,i){if(!t)return Promise.reject("No proxy configured");var r=rr(nr),u=ur(t,n,r);return nr?sr(u):ir(i,u,r).then(function(n){return fr(n.content)})}function ef(n,t,i){var r=rr(tr),u=ur(t,n,r);return tr?Promise.resolve(u):ir(i,u,r).then(function(n){return"data:"+n.type+";base64,"+n.content})}function ir(t,i,r){return new Promise(function(u,f){var e=t.createElement("script"),o=function(){delete n.html2canvas.proxy[r];t.body.removeChild(e)};n.html2canvas.proxy[r]=function(n){o();u(n)};e.src=i;e.onerror=function(n){o();f(n)};t.body.appendChild(e)})}function rr(n){return n?"":"html2canvas_"+Date.now()+"_"+ ++ff+"_"+Math.round(Math.random()*1e5)}function ur(n,t,i){return n+"?url="+encodeURIComponent(t)+(i.length?"&callback=html2canvas.proxy."+i:"")}function of(n,i){var f=t.createElement("script"),u=t.createElement("a"),r;u.href=n;n=u.href;this.src=n;this.image=new Image;r=this;this.promise=new Promise(function(u,f){r.image.crossOrigin="Anonymous";r.image.onload=u;r.image.onerror=f;new ef(n,i,t).then(function(n){r.image.src=n})["catch"](f)})}function a(n,t,i){e.call(this,n,t);this.isPseudoElement=!0;this.before=i===":before"}function v(n,t,i,r,u){this.width=n;this.height=t;this.images=i;this.options=r;this.document=u}function ft(n,t,i,r){e.call(this,i,r);this.ownStacking=n;this.contexts=[];this.children=[];this.opacity=(this.parent?this.parent.stack.opacity:1)*t}function lt(n){this.rangeBounds=this.testRangeBounds(n);this.cors=this.testCORS();this.svg=this.testSVG()}function y(n){this.src=n;this.image=null;var t=this;this.promise=this.hasFabric().then(function(){return t.isInline(n)?Promise.resolve(t.inlineFormatting(n)):sr(n)}).then(function(n){return new Promise(function(i){html2canvas.fabric.loadSVGFromString(n,t.createCanvas.call(t,i))})})}function fr(n){for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=n.length,s,e,r,u,f,o,h,c="",t=0;t<l;t+=4)s=i.indexOf(n[t]),e=i.indexOf(n[t+1]),r=i.indexOf(n[t+2]),u=i.indexOf(n[t+3]),f=s<<2|e>>4,o=(e&15)<<4|r>>2,h=(r&3)<<6|u,c+=r===64?String.fromCharCode(f):u===64||u===-1?String.fromCharCode(f,o):String.fromCharCode(f,o,h);return c}function er(n,t){this.src=n;this.image=null;var i=this;this.promise=t?new Promise(function(t,r){i.image=new Image;i.image.onload=t;i.image.onerror=r;i.image.src="data:image/svg+xml,"+(new XMLSerializer).serializeToString(n);i.image.complete===!0&&t(i.image)}):this.hasFabric().then(function(){return new Promise(function(t){html2canvas.fabric.parseSVGDocument(n,i.createCanvas.call(i,t))})})}function k(n,t){e.call(this,n,t)}function sf(n,t,i){if(n.length>0)return t+i.toUpperCase()}function or(n){nt.apply(this,arguments);this.type=n.args[0]==="linear"?this.TYPES.LINEAR:this.TYPES.RADIAL}function sr(n){return new Promise(function(t,i){var r=new XMLHttpRequest;r.open("GET",n);r.onload=function(){r.status===200?t(r.responseText):i(new Error(r.statusText))};r.onerror=function(){i(new Error("Network Error"))};r.send()})}function c(n,t){v.apply(this,arguments);this.canvas=this.options.canvas||this.document.createElement("canvas");this.options.canvas||(this.canvas.width=n,this.canvas.height=t);this.ctx=this.canvas.getContext("2d");this.taintCtx=this.document.createElement("canvas").getContext("2d");this.ctx.textBaseline="bottom";this.variables={};o("Initialized CanvasRenderer with size",n,"x",t)}function hf(n){return n.length>0}var ei,oi,si,hi,ci,yt;if(function(){function a(n,t){l[c]=n;l[c+1]=t;c+=2;2===c&&ut()}function y(n){return"function"==typeof n}function et(){return function(){process.nextTick(p)}}function ot(){var n=0,r=new rt(p),i=t.createTextNode("");return r.observe(i,{characterData:!0}),function(){i.data=n=++n%2}}function st(){var n=new MessageChannel;return n.port1.onmessage=p,function(){n.port2.postMessage(0)}}function ht(){return function(){setTimeout(p,1)}}function p(){for(var n=0;n<c;n+=2)l[n](l[n+1]),l[n]=void 0,l[n+1]=void 0;c=0}function s(){}function ct(n,t,i,r){try{n.call(t,i,r)}catch(u){return u}}function lt(n,t,r){a(function(n){var u=!1,e=ct(r,t,function(i){u||(u=!0,t!==i?h(n,i):f(n,i))},function(t){u||(u=!0,i(n,t))});!u&&e&&(u=!0,i(n,e))},n)}function at(n,t){1===t.a?f(n,t.b):2===n.a?i(n,t.b):w(t,void 0,function(t){h(n,t)},function(t){i(n,t)})}function h(n,t){if(n===t)i(n,new TypeError("You cannot resolve a promise with itself"));else if("function"==typeof t||"object"==typeof t&&null!==t)if(t.constructor===n.constructor)at(n,t);else{var r;try{r=t.then}catch(u){v.error=u;r=v}r===v?i(n,v.error):void 0===r?f(n,t):y(r)?lt(n,t,r):f(n,t)}else f(n,t)}function vt(n){n.f&&n.f(n.b);d(n)}function f(n,t){void 0===n.a&&(n.b=t,n.a=1,0!==n.e.length&&a(d,n))}function i(n,t){void 0===n.a&&(n.a=2,n.b=t,a(vt,n))}function w(n,t,i,r){var u=n.e,f=u.length;n.f=null;u[f]=t;u[f+1]=i;u[f+2]=r;0===f&&n.a&&a(d,n)}function d(n){var i=n.e,e=n.a,r,u,f,t;if(0!==i.length){for(f=n.b,t=0;t<i.length;t+=3)r=i[t],u=i[t+e],r?tt(e,r,u,f):u(f);n.e.length=0}}function nt(){this.error=null}function tt(n,t,r,u){var s=y(r),e,c,o,l;if(s){try{e=r(u)}catch(a){b.error=a;e=b}if(e===b?(l=!0,c=e.error,e=null):o=!0,t===e){i(t,new TypeError("A promises callback cannot return that same promise."));return}}else e=u,o=!0;void 0===t.a&&(s&&o?h(t,e):l?i(t,c):1===n?f(t,e):2===n&&i(t,e))}function yt(n,t){try{t(function(t){h(n,t)},function(t){i(n,t)})}catch(r){i(n,r)}}function e(n,t,r,u){this.n=n;this.c=new n(s,u);this.i=r;this.o(t)?(this.m=t,this.d=this.length=t.length,this.l(),0===this.length?f(this.c,this.b):(this.length=this.length||0,this.k(),0===this.d&&f(this.c,this.b))):i(this.c,this.p())}function o(n){if(ft++,this.b=this.a=void 0,this.e=[],s!==n){if(!y(n))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof o))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");yt(this,n)}}var it=Array.isArray?Array.isArray:function(n){return"[object Array]"===Object.prototype.toString.call(n)},c=0,g="undefined"!=typeof n?n:{},rt=g.MutationObserver||g.WebKitMutationObserver,g="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,l=Array(1e3),ut,v,b,ft,k;ut="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?et():rt?ot():g?st():ht();v=new nt;b=new nt;e.prototype.o=function(n){return it(n)};e.prototype.p=function(){return Error("Array Methods must be provided an Array")};e.prototype.l=function(){this.b=Array(this.length)};e.prototype.k=function(){for(var t=this.length,i=this.c,r=this.m,n=0;void 0===i.a&&n<t;n++)this.j(r[n],n)};e.prototype.j=function(n,t){var i=this.n;"object"==typeof n&&null!==n?n.constructor===i&&void 0!==n.a?(n.f=null,this.g(n.a,t,n.b)):this.q(i.resolve(n),t):(this.d--,this.b[t]=this.h(n))};e.prototype.g=function(n,t,r){var u=this.c;void 0===u.a&&(this.d--,this.i&&2===n?i(u,r):this.b[t]=this.h(r));0===this.d&&f(u,this.b)};e.prototype.h=function(n){return n};e.prototype.q=function(n,t){var i=this;w(n,void 0,function(n){i.g(1,t,n)},function(n){i.g(2,t,n)})};ft=0;o.all=function(n,t){return new e(this,n,!0,t).c};o.race=function(n,t){function e(n){h(r,n)}function o(n){i(r,n)}var r=new this(s,t),f,u;if(!it(n))return i(r,new TypeError("You must pass an array to race.")),r;for(f=n.length,u=0;void 0===r.a&&u<f;u++)w(this.resolve(n[u]),void 0,e,o);return r};o.resolve=function(n,t){if(n&&"object"==typeof n&&n.constructor===this)return n;var i=new this(s,t);return h(i,n),i};o.reject=function(n,t){var r=new this(s,t);return i(r,n),r};o.prototype={constructor:o,then:function(n,t){var i=this.a,r,u,f;return 1===i&&!n||2===i&&!t?this:(r=new this.constructor(s),u=this.b,i?(f=arguments[i-1],a(function(){tt(i,r,f,u)})):w(this,r,n,t),r)},"catch":function(n){return this.then(null,n)}};k={Promise:o,polyfill:function(){var t;t="undefined"!=typeof r?r:"undefined"!=typeof n&&n.document?n:self;"Promise"in t&&"resolve"in t.Promise&&"reject"in t.Promise&&"all"in t.Promise&&"race"in t.Promise&&function(){var n;return new t.Promise(function(t){n=t}),y(n)}()||(t.Promise=o)}};"function"==typeof u&&u.amd?u(function(){return k}):"undefined"!=typeof module&&module.exports?module.exports=k:"undefined"!=typeof this&&(this.ES6Promise=k)}.call(n),n&&n.ES6Promise.polyfill(),typeof t=="undefined"||typeof Object.create!="function"||typeof t.createElement("canvas").getContext!="function"){(n||module.exports).html2canvas=function(){return Promise.reject("No canvas support")};return}(function(n){function s(n){throw RangeError(at[n]);}function g(n,t){for(var i=n.length,r=[];i--;)r[i]=t(n[i]);return r}function nt(n,t){var i=n.split("@"),r="",u,f;return i.length>1&&(r=i[0]+"@",n=i[1]),u=n.split(lt),f=g(u,t).join("."),r+f}function tt(n){for(var r=[],i=0,f=n.length,t,u;i<f;)t=n.charCodeAt(i++),t>=55296&&t<=56319&&i<f?(u=n.charCodeAt(i++),(u&64512)==56320?r.push(((t&1023)<<10)+(u&1023)+65536):(r.push(t),i--)):r.push(t);return r}function it(n){return g(n,function(n){var t="";return n>65535&&(n-=65536,t+=l(n>>>10&1023|55296),n=56320|n&1023),t+l(n)}).join("")}function vt(n){return n-48<10?n-22:n-65<26?n-65:n-97<26?n-97:t}function rt(n,t){return n+22+75*(n<26)-((t!=0)<<5)}function ut(n,i,r){var u=0;for(n=r?f(n/st):n>>1,n+=f(n/i);n>p*c>>1;u+=t)n=f(n/p);return f(u+(p+1)*n/(n+ot))}function ft(n){var v=[],ft=n.length,u,i=0,g=k,p=b,r,e,w,nt,o,l,a,tt,rt;for(r=n.lastIndexOf(d),r<0&&(r=0),e=0;e<r;++e)n.charCodeAt(e)>=128&&s("not-basic"),v.push(n.charCodeAt(e));for(w=r>0?r+1:0;w<ft;){for(nt=i,o=1,l=t;;l+=t){if(w>=ft&&s("invalid-input"),a=vt(n.charCodeAt(w++)),(a>=t||a>f((h-i)/o))&&s("overflow"),i+=a*o,tt=l<=p?y:l>=p+c?c:l-p,a<tt)break;rt=t-tt;o>f(h/rt)&&s("overflow");o*=rt}u=v.length+1;p=ut(i-nt,u,nt==0);f(i/u)>h-g&&s("overflow");g+=f(i/u);i%=u;v.splice(i++,0,g)}return it(v)}function et(n){var u,e,v,et,p,i,o,w,g,nt,r,a=[],it,ft,ot,st;for(n=tt(n),it=n.length,u=k,e=0,p=b,i=0;i<it;++i)r=n[i],r<128&&a.push(l(r));for(v=et=a.length,et&&a.push(d);v<it;){for(o=h,i=0;i<it;++i)r=n[i],r>=u&&r<o&&(o=r);for(ft=v+1,o-u>f((h-e)/ft)&&s("overflow"),e+=(o-u)*ft,u=o,i=0;i<it;++i)if(r=n[i],r<u&&++e>h&&s("overflow"),r==u){for(w=e,g=t;;g+=t){if(nt=g<=p?y:g>=p+c?c:g-p,w<nt)break;st=w-nt;ot=t-nt;a.push(l(rt(nt+st%ot,0)));w=f(st/ot)}a.push(l(rt(w,0)));p=ut(e,ft,v==et);e=0;++v}++e;++u}return a.join("")}function yt(n){return nt(n,function(n){return ht.test(n)?ft(n.slice(4).toLowerCase()):n})}function pt(n){return nt(n,function(n){return ct.test(n)?"xn--"+et(n):n})}var v=typeof i=="object"&&i&&!i.nodeType&&i,w=typeof module=="object"&&module&&!module.nodeType&&module,e=typeof r=="object"&&r;(e.global===e||e.window===e||e.self===e)&&(n=e);var o,h=2147483647,t=36,y=1,c=26,ot=38,st=700,b=72,k=128,d="-",ht=/^xn--/,ct=/[^\x20-\x7E]/,lt=/[\x2E\u3002\uFF0E\uFF61]/g,at={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=t-y,f=Math.floor,l=String.fromCharCode,a;if(o={version:"1.3.1",ucs2:{decode:tt,encode:it},decode:ft,encode:et,toASCII:pt,toUnicode:yt},typeof u=="function"&&typeof u.amd=="object"&&u.amd)u("punycode",function(){return o});else if(v&&w)if(module.exports==v)w.exports=o;else for(a in o)o.hasOwnProperty(a)&&(v[a]=o[a]);else n.punycode=o})(this);var kt="data-html2canvas-node",d="data-html2canvas-canvas-clone",hr=0,cr=0;n.html2canvas=function(i,r){var e=cr++,s,h,u;return(r=r||{},r.logging&&(n.html2canvas.logging=!0,n.html2canvas.start=Date.now()),r.async=typeof r.async=="undefined"?!0:r.async,r.allowTaint=typeof r.allowTaint=="undefined"?!1:r.allowTaint,r.removeContainer=typeof r.removeContainer=="undefined"?!0:r.removeContainer,r.javascriptEnabled=typeof r.javascriptEnabled=="undefined"?!1:r.javascriptEnabled,r.imageTimeout=typeof r.imageTimeout=="undefined"?1e4:r.imageTimeout,r.renderer=typeof r.renderer=="function"?r.renderer:c,r.strict=!!r.strict,typeof i=="string")?typeof r.proxy!="string"?Promise.reject("Proxy must be used when rendering url"):(s=r.width!=null?r.width:n.innerWidth,h=r.height!=null?r.height:n.innerHeight,ui(nu(i),r.proxy,t,s,h,r).then(function(n){return dt(n.contentWindow.document.documentElement,n,r,s,h)})):(u=(i===f?[t.documentElement]:i.length?i:[i])[0],u.setAttribute(kt+e,e),lr(u.ownerDocument,r,u.ownerDocument.defaultView.innerWidth,u.ownerDocument.defaultView.innerHeight,e).then(function(n){if(typeof r.onrendered=="function"){o("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas");r.onrendered(n)}return n}))};n.html2canvas.punycode=this.punycode;n.html2canvas.proxy={};h.prototype.darken=function(n){var t=1-n;return new h([Math.round(this.r*t),Math.round(this.g*t),Math.round(this.b*t),this.a])};h.prototype.isTransparent=function(){return this.a===0};h.prototype.isBlack=function(){return this.r===0&&this.g===0&&this.b===0};h.prototype.fromArray=function(n){return Array.isArray(n)&&(this.r=Math.min(n[0],255),this.g=Math.min(n[1],255),this.b=Math.min(n[2],255),n.length>3&&(this.a=n[3])),Array.isArray(n)};ei=/^#([a-f0-9]{3})$/i;h.prototype.hex3=function(n){var t=null;return(t=n.match(ei))!==null&&(this.r=parseInt(t[1][0]+t[1][0],16),this.g=parseInt(t[1][1]+t[1][1],16),this.b=parseInt(t[1][2]+t[1][2],16)),t!==null};oi=/^#([a-f0-9]{6})$/i;h.prototype.hex6=function(n){var t=null;return(t=n.match(oi))!==null&&(this.r=parseInt(t[1].substring(0,2),16),this.g=parseInt(t[1].substring(2,4),16),this.b=parseInt(t[1].substring(4,6),16)),t!==null};si=/^rgb\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3})\)$/;h.prototype.rgb=function(n){var t=null;return(t=n.match(si))!==null&&(this.r=Number(t[1]),this.g=Number(t[2]),this.b=Number(t[3])),t!==null};hi=/^rgba\((\d{1,3}) *, *(\d{1,3}) *, *(\d{1,3}) *, *(\d+\.?\d*)\)$/;h.prototype.rgba=function(n){var t=null;return(t=n.match(hi))!==null&&(this.r=Number(t[1]),this.g=Number(t[2]),this.b=Number(t[3]),this.a=Number(t[4])),t!==null};h.prototype.toString=function(){return this.a!==null&&this.a!==1?"rgba("+[this.r,this.g,this.b,this.a].join(",")+")":"rgb("+[this.r,this.g,this.b].join(",")+")"};h.prototype.namedColor=function(n){var t=ci[n.toLowerCase()];if(t)this.r=t[0],this.g=t[1],this.b=t[2];else if(n.toLowerCase()==="transparent")return this.r=this.g=this.b=this.a=0,!0;return!!t};h.prototype.isColor=!0;ci={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};li.prototype.getMetrics=function(n,t){return this.data[n+"-"+t]===f&&(this.data[n+"-"+t]=new tu(n,t)),this.data[n+"-"+t]};ai.prototype.proxyLoad=function(n,t,i){var r=this.src;return ui(r.src,n,r.ownerDocument,t.width,t.height,i)};nt.prototype.TYPES={LINEAR:1,RADIAL:2};l.prototype.findImages=function(n){var t=[];return n.reduce(function(n,t){switch(t.node.nodeName){case"IMG":return n.concat([{args:[t.node.src],method:"url"}]);case"svg":case"IFRAME":return n.concat([{args:[t.node],method:t.node.nodeName}])}return n},[]).forEach(this.addImage(t,this.loadImage),this),t};l.prototype.findBackgroundImage=function(n,t){return t.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(n,this.loadImage),this),n};l.prototype.addImage=function(n,t){return function(i){i.args.forEach(function(r){this.imageExists(n,r)||(n.splice(0,0,t.call(this,i)),o("Added image #"+n.length,typeof r=="string"?r.substring(0,100):r))},this)}};l.prototype.hasImageBackground=function(n){return n.method!=="none"};l.prototype.loadImage=function(n){if(n.method==="url"){var t=n.args[0];return!this.isSVG(t)||this.support.svg||this.options.allowTaint?t.match(/data:image\/.*;base64,/i)?new at(t.replace(/url\(['"]{0,}|['"]{0,}\)$/ig,""),!1):this.isSameOrigin(t)||this.options.allowTaint===!0||this.isSVG(t)?new at(t,!1):this.support.cors&&!this.options.allowTaint&&this.options.useCORS?new at(t,!0):this.options.proxy?new of(t,this.options.proxy):new g(t):new y(t)}return n.method==="linear-gradient"?new et(n):n.method==="gradient"?new or(n):n.method==="svg"?new er(n.args[0],this.support.svg):n.method==="IFRAME"?new ai(n.args[0],this.isSameOrigin(n.args[0].src),this.options):new g(n)};l.prototype.isSVG=function(n){return n.substring(n.length-3).toLowerCase()==="svg"||y.prototype.isInline(n)};l.prototype.imageExists=function(n,t){return n.some(function(n){return n.src===t})};l.prototype.isSameOrigin=function(n){return this.getOrigin(n)===this.origin};l.prototype.getOrigin=function(n){var i=this.link||(this.link=t.createElement("a"));return i.href=n,i.href=i.href,i.protocol+i.hostname+i.port};l.prototype.getPromise=function(n){return this.timeout(n,this.options.imageTimeout)["catch"](function(){var t=new g(n.src);return t.promise.then(function(t){n.image=t})})};l.prototype.get=function(n){var t=null;return this.images.some(function(i){return(t=i).src===n})?t:null};l.prototype.fetch=function(n){return this.images=n.reduce(ct(this.findBackgroundImage,this),this.findImages(n)),this.images.forEach(function(n,t){n.promise.then(function(){o("Succesfully loaded image #"+(t+1),n)},function(i){o("Failed loading image #"+(t+1),n,i)})}),this.ready=Promise.all(this.images.map(this.getPromise,this)),o("Finished searching images"),this};l.prototype.timeout=function(n,t){var i,r=Promise.race([n.promise,new Promise(function(r,u){i=setTimeout(function(){o("Timed out loading image",n);u(n)},t)})]).then(function(n){return clearTimeout(i),n});return r["catch"](function(){clearTimeout(i)}),r};et.prototype=Object.create(nt.prototype);et.prototype.stepRegExp=/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/;e.prototype.cloneTo=function(n){n.visible=this.visible;n.borders=this.borders;n.bounds=this.bounds;n.clip=this.clip;n.backgroundClip=this.backgroundClip;n.computedStyles=this.computedStyles;n.styles=this.styles;n.backgroundImages=this.backgroundImages;n.opacity=this.opacity};e.prototype.getOpacity=function(){return this.opacity===null?this.opacity=this.cssFloat("opacity"):this.opacity};e.prototype.assignStack=function(n){this.stack=n;n.children.push(this)};e.prototype.isElementVisible=function(){return this.node.nodeType===Node.TEXT_NODE?this.parent.visible:this.css("display")!=="none"&&this.css("visibility")!=="hidden"&&!this.node.hasAttribute("data-html2canvas-ignore")&&(this.node.nodeName!=="INPUT"||this.node.getAttribute("type")!=="hidden")};e.prototype.css=function(n){return this.computedStyles||(this.computedStyles=this.isPseudoElement?this.parent.computedStyle(this.before?":before":":after"):this.computedStyle(null)),this.styles[n]||(this.styles[n]=this.computedStyles[n])};e.prototype.prefixedCss=function(n){var t=this.css(n);return t===f&&["webkit","moz","ms","o"].some(function(i){return t=this.css(i+n.substr(0,1).toUpperCase()+n.substr(1)),t!==f},this),t===f?null:t};e.prototype.computedStyle=function(n){return this.node.ownerDocument.defaultView.getComputedStyle(this.node,n)};e.prototype.cssInt=function(n){var t=parseInt(this.css(n),10);return isNaN(t)?0:t};e.prototype.color=function(n){return this.colors[n]||(this.colors[n]=new h(this.css(n)))};e.prototype.cssFloat=function(n){var t=parseFloat(this.css(n));return isNaN(t)?0:t};e.prototype.fontWeight=function(){var n=this.css("fontWeight");switch(parseInt(n,10)){case 401:n="bold";break;case 400:n="normal"}return n};e.prototype.parseClip=function(){var n=this.css("clip").match(this.CLIP);return n?{top:parseInt(n[1],10),right:parseInt(n[2],10),bottom:parseInt(n[3],10),left:parseInt(n[4],10)}:null};e.prototype.parseBackgroundImages=function(){return this.backgroundImages||(this.backgroundImages=vi(this.css("backgroundImage")))};e.prototype.cssList=function(n,t){var i=(this.css(n)||"").split(",");return i=i[t||0]||i[0]||"auto",i=i.trim().split(" "),i.length===1&&(i=[i[0],i[0]]),i};e.prototype.parseBackgroundSize=function(n,t,i){var r=this.cssList("backgroundSize",i),u,e,o,f;if(ot(r[0]))u=n.width*parseFloat(r[0])/100;else{if(/contain|cover/.test(r[0]))return o=n.width/n.height,f=t.width/t.height,o<f^r[0]==="contain"?{width:n.height*f,height:n.height}:{width:n.width,height:n.width/f};u=parseInt(r[0],10)}return e=r[0]==="auto"&&r[1]==="auto"?t.height:r[1]==="auto"?u/t.width*t.height:ot(r[1])?n.height*parseFloat(r[1])/100:parseInt(r[1],10),r[0]==="auto"&&(u=e/t.height*t.width),{width:u,height:e}};e.prototype.parseBackgroundPosition=function(n,t,i,r){var u=this.cssList("backgroundPosition",i),f,e;return f=ot(u[0])?(n.width-(r||t).width)*(parseFloat(u[0])/100):parseInt(u[0],10),e=u[1]==="auto"?f/t.width*t.height:ot(u[1])?(n.height-(r||t).height)*parseFloat(u[1])/100:parseInt(u[1],10),u[0]==="auto"&&(f=e/t.height*t.width),{left:f,top:e}};e.prototype.parseBackgroundRepeat=function(n){return this.cssList("backgroundRepeat",n)[0]};e.prototype.parseTextShadows=function(){var r=this.css("textShadow"),u=[],t,i,n;if(r&&r!=="none")for(t=r.match(this.TEXT_SHADOW_PROPERTY),i=0;t&&i<t.length;i++)n=t[i].match(this.TEXT_SHADOW_VALUES),u.push({color:new h(n[0]),offsetX:n[1]?parseFloat(n[1].replace("px","")):0,offsetY:n[2]?parseFloat(n[2].replace("px","")):0,blur:n[3]?n[3].replace("px",""):0});return u};e.prototype.parseTransform=function(){if(!this.transformData)if(this.hasTransform()){var t=this.parseBounds(),n=this.prefixedCss("transformOrigin").split(" ").map(uu).map(fu);n[0]+=t.left;n[1]+=t.top;this.transformData={origin:n,matrix:this.parseTransformMatrix()}}else this.transformData={origin:[0,0],matrix:[1,0,0,1,0,0]};return this.transformData};e.prototype.parseTransformMatrix=function(){if(!this.transformMatrix){var n=this.prefixedCss("transform"),t=n?ru(n.match(this.MATRIX_PROPERTY)):null;this.transformMatrix=t?t:[1,0,0,1,0,0]}return this.transformMatrix};e.prototype.parseBounds=function(){return this.bounds||(this.bounds=this.hasTransform()?vt(this.node):st(this.node))};e.prototype.hasTransform=function(){return this.parseTransformMatrix().join(",")!=="1,0,0,1,0,0"||this.parent&&this.parent.hasTransform()};e.prototype.getValue=function(){var n=this.node.value||"";return this.node.tagName==="SELECT"?n=iu(this.node):this.node.type==="password"&&(n=Array(n.length+1).join("•")),n.length===0?this.node.placeholder||"":n};e.prototype.MATRIX_PROPERTY=/(matrix)\((.+)\)/;e.prototype.TEXT_SHADOW_PROPERTY=/((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;e.prototype.TEXT_SHADOW_VALUES=/(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;e.prototype.CLIP=/^rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)$/;s.prototype.calculateOverflowClips=function(){this.nodes.forEach(function(n){if(rt(n)){ut(n)&&n.appendToDOM();n.borders=this.parseBorders(n);var i=n.css("overflow")==="hidden"?[n.borders.clip]:[],t=n.parseClip();t&&["absolute","fixed"].indexOf(n.css("position"))!==-1&&i.push([["rect",n.bounds.left+t.left,n.bounds.top+t.top,t.right-t.left,t.bottom-t.top]]);n.clip=yi(n)?n.parent.clip.concat(i):i;n.backgroundClip=n.css("overflow")!=="hidden"?n.clip.concat([n.borders.clip]):n.clip;ut(n)&&n.cleanDOM()}else wt(n)&&(n.clip=yi(n)?n.parent.clip:[]);ut(n)||(n.bounds=null)},this)};s.prototype.asyncRenderer=function(n,t,i){i=i||Date.now();this.paint(n[this.renderIndex++]);n.length===this.renderIndex?t():i+20>Date.now()?this.asyncRenderer(n,t,i):setTimeout(ct(function(){this.asyncRenderer(n,t)},this),0)};s.prototype.createPseudoHideStyles=function(n){this.createStyles(n,"."+a.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+':before { content: "" !important; display: none !important; }.'+a.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER+':after { content: "" !important; display: none !important; }')};s.prototype.disableAnimations=function(n){this.createStyles(n,"* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}")};s.prototype.createStyles=function(n,t){var i=n.createElement("style");i.innerHTML=t;n.body.appendChild(i)};s.prototype.getPseudoElements=function(n){var t=[[n]],i,r;return n.node.nodeType===Node.ELEMENT_NODE&&(i=this.getPseudoElement(n,":before"),r=this.getPseudoElement(n,":after"),i&&t.push(i),r&&t.push(r)),bt(t)};s.prototype.getPseudoElement=function(n,i){var r=n.computedStyle(i),f,s,h;if(!r||!r.content||r.content==="none"||r.content==="-moz-alt-content"||r.display==="none")return null;var e=gu(r.content),c=e.substr(0,3)==="url",u=t.createElement(c?"img":"html2canvaspseudoelement"),o=new a(u,n,i);for(f=r.length-1;f>=0;f--)s=eu(r.item(f)),u.style[s]=r[s];return u.className=a.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE+" "+a.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER,c?(u.src=vi(e)[0].args[0],[o]):(h=t.createTextNode(e),u.appendChild(h),[o,new k(h,o)])};s.prototype.getChildren=function(n){return bt([].filter.call(n.node.childNodes,au).map(function(t){var i=[t.nodeType===Node.TEXT_NODE?new k(t,n):new e(t,n)].filter(du);return t.nodeType===Node.ELEMENT_NODE&&i.length&&t.tagName!=="TEXTAREA"?i[0].isElementVisible()?i.concat(this.getChildren(i[0])):[]:i},this))};s.prototype.newStackingContext=function(n,t){var i=new ft(t,n.getOpacity(),n.node,n.parent),r;n.cloneTo(i);r=t?i.getParentStack(this):i.parent.stack;r.contexts.push(i);n.stack=i};s.prototype.createStackingContexts=function(){this.nodes.forEach(function(n){rt(n)&&(this.isRootElement(n)||wu(n)||vu(n)||this.isBodyWithTransparentRoot(n)||n.hasTransform())?this.newStackingContext(n,!0):rt(n)&&(tt(n)&&ki(n)||yu(n)||pt(n))?this.newStackingContext(n,!1):n.assignStack(n.parent.stack)},this)};s.prototype.isBodyWithTransparentRoot=function(n){return n.node.nodeName==="BODY"&&n.parent.color("backgroundColor").isTransparent()};s.prototype.isRootElement=function(n){return n.parent===null};s.prototype.sortStackingContexts=function(n){n.contexts.sort(pu(n.contexts.slice(0)));n.contexts.forEach(this.sortStackingContexts,this)};s.prototype.parseTextBounds=function(n){return function(t,i,r){var u,f,e;if(n.parent.css("textDecoration").substr(0,4)!=="none"||t.trim().length!==0){if(this.support.rangeBounds&&!n.parent.hasTransform())return u=r.slice(0,i).join("").length,this.getRangeBounds(n.node,u,t.length);if(n.node&&typeof n.node.data=="string")return f=n.node.splitText(t.length),e=this.getWrapperBounds(n.node,n.parent.hasTransform()),n.node=f,e}else(!this.support.rangeBounds||n.parent.hasTransform())&&(n.node=n.node.splitText(t.length));return{}}};s.prototype.getWrapperBounds=function(n,t){var i=n.ownerDocument.createElement("html2canvaswrapper"),r=n.parentNode,f=n.cloneNode(!0),u;return i.appendChild(n.cloneNode(!0)),r.replaceChild(i,n),u=t?vt(i):st(i),r.replaceChild(f,i),u};s.prototype.getRangeBounds=function(n,t,i){var r=this.range||(this.range=n.ownerDocument.createRange());return r.setStart(n,t),r.setEnd(n,t+i),r.getBoundingClientRect()};s.prototype.parse=function(n){var r=n.contexts.filter(ou),i=n.children.filter(rt),t=i.filter(it(pt)),u=t.filter(it(tt)).filter(it(di)),f=i.filter(it(tt)).filter(pt),e=t.filter(it(tt)).filter(di),o=n.contexts.concat(t.filter(tt)).filter(ki),s=n.children.filter(wt).filter(hu),h=n.contexts.filter(su);r.concat(u).concat(f).concat(e).concat(o).concat(s).concat(h).forEach(function(n){this.renderQueue.push(n);gi(n)&&(this.parse(n),this.renderQueue.push(new pi))},this)};s.prototype.paint=function(n){try{n instanceof pi?this.renderer.ctx.restore():wt(n)?(ut(n.parent)&&n.parent.appendToDOM(),this.paintText(n),ut(n.parent)&&n.parent.cleanDOM()):this.paintNode(n)}catch(t){if(o(t),this.options.strict)throw t;}};s.prototype.paintNode=function(n){gi(n)&&(this.renderer.setOpacity(n.opacity),this.renderer.ctx.save(),n.hasTransform()&&this.renderer.setTransform(n.parseTransform()));n.node.nodeName==="INPUT"&&n.node.type==="checkbox"?this.paintCheckbox(n):n.node.nodeName==="INPUT"&&n.node.type==="radio"?this.paintRadio(n):this.paintElement(n)};s.prototype.paintElement=function(n){var t=n.parseBounds();this.renderer.clip(n.backgroundClip,function(){this.renderer.renderBackground(n,t,n.borders.borders.map(ku))},this);this.renderer.clip(n.clip,function(){this.renderer.renderBorders(n.borders.borders)},this);this.renderer.clip(n.backgroundClip,function(){var i,r;switch(n.node.nodeName){case"svg":case"IFRAME":i=this.images.get(n.node);i?this.renderer.renderImage(n,t,n.borders,i):o("Error loading <"+n.node.nodeName+">",n.node);break;case"IMG":r=this.images.get(n.node.src);r?this.renderer.renderImage(n,t,n.borders,r):o("Error loading <img>",n.node.src);break;case"CANVAS":this.renderer.renderImage(n,t,n.borders,{image:n.node});break;case"SELECT":case"INPUT":case"TEXTAREA":this.paintFormValue(n)}},this)};s.prototype.paintCheckbox=function(n){var r=n.parseBounds(),i=Math.min(r.width,r.height),t={width:i-1,height:i-1,top:r.top,left:r.left},u=[3,3],f=[u,u,u,u],e=[1,1,1,1].map(function(n){return{color:new h("#A5A5A5"),width:n}}),o=bi(t,f,e);this.renderer.clip(n.backgroundClip,function(){this.renderer.rectangle(t.left+1,t.top+1,t.width-2,t.height-2,new h("#DEDEDE"));this.renderer.renderBorders(wi(e,t,o,f));n.node.checked&&(this.renderer.font(new h("#424242"),"normal","normal","bold",i-3+"px","arial"),this.renderer.text("✔",t.left+i/6,t.top+i-1))},this)};s.prototype.paintRadio=function(n){var t=n.parseBounds(),i=Math.min(t.width,t.height)-2;this.renderer.clip(n.backgroundClip,function(){this.renderer.circleStroke(t.left+1,t.top+1,i,new h("#DEDEDE"),1,new h("#A5A5A5"));n.node.checked&&this.renderer.circle(Math.ceil(t.left+i/4)+1,Math.ceil(t.top+i/4)+1,Math.floor(i/2),new h("#424242"))},this)};s.prototype.paintFormValue=function(n){var u=n.getValue(),r;if(u.length>0){var i=n.node.ownerDocument,t=i.createElement("html2canvaswrapper");["lineHeight","textAlign","fontFamily","fontWeight","fontSize","color","paddingLeft","paddingTop","paddingRight","paddingBottom","width","height","borderLeftStyle","borderTopStyle","borderLeftWidth","borderTopWidth","boxSizing","whiteSpace","wordWrap"].forEach(function(i){try{t.style[i]=n.css(i)}catch(r){o("html2canvas: Parse: Exception caught in renderFormValue: "+r.message)}});r=n.parseBounds();t.style.position="fixed";t.style.left=r.left+"px";t.style.top=r.top+"px";t.textContent=u;i.body.appendChild(t);this.paintText(new k(t.firstChild,n));i.body.removeChild(t)}};s.prototype.paintText=function(t){t.applyTextTransform();var r=n.html2canvas.punycode.ucs2.decode(t.node.data),u=(!this.options.letterRendering||cu(t))&&!rf(t.node.data)?nf(r):r.map(function(t){return n.html2canvas.punycode.ucs2.encode([t])}),o=t.parent.fontWeight(),f=t.parent.css("fontSize"),e=t.parent.css("fontFamily"),i=t.parent.parseTextShadows();this.renderer.font(t.parent.color("color"),t.parent.css("fontStyle"),t.parent.css("fontVariant"),o,f,e);i.length?this.renderer.fontShadow(i[0].color,i[0].offsetX,i[0].offsetY,i[0].blur):this.renderer.clearShadow();this.renderer.clip(t.parent.clip,function(){u.map(this.parseTextBounds(t),this).forEach(function(n,i){n&&(this.renderer.text(u[i],n.left,n.bottom),this.renderTextDecoration(t.parent,n,this.fontMetrics.getMetrics(e,f)))},this)},this)};s.prototype.renderTextDecoration=function(n,t,i){switch(n.css("textDecoration").split(" ")[0]){case"underline":this.renderer.rectangle(t.left,Math.round(t.top+i.baseline+i.lineWidth),t.width,1,n.color("color"));break;case"overline":this.renderer.rectangle(t.left,Math.round(t.top),t.width,1,n.color("color"));break;case"line-through":this.renderer.rectangle(t.left,Math.ceil(t.top+i.middle+i.lineWidth),t.width,1,n.color("color"))}};yt={inset:[["darken",.6],["darken",.1],["darken",.1],["darken",.6]]};s.prototype.parseBorders=function(n){var t=n.parseBounds(),i=lu(n),r=["Top","Right","Bottom","Left"].map(function(t,i){var f=n.css("border"+t+"Style"),r=n.color("border"+t+"Color"),u;return f==="inset"&&r.isBlack()&&(r=new h([255,255,255,r.a])),u=yt[f]?yt[f][i]:null,{width:n.cssInt("border"+t+"Width"),color:u?r[u[0]](u[1]):r,args:null}}),u=bi(t,i,r);return{clip:this.parseBackgroundClip(n,u,r,i,t),borders:wi(r,t,u,i)}};s.prototype.parseBackgroundClip=function(n,t,i,r,u){var e=n.css("backgroundClip"),f=[];switch(e){case"content-box":case"padding-box":w(f,r[0],r[1],t.topLeftInner,t.topRightInner,u.left+i[3].width,u.top+i[0].width);w(f,r[1],r[2],t.topRightInner,t.bottomRightInner,u.left+u.width-i[1].width,u.top+i[0].width);w(f,r[2],r[3],t.bottomRightInner,t.bottomLeftInner,u.left+u.width-i[1].width,u.top+u.height-i[2].width);w(f,r[3],r[0],t.bottomLeftInner,t.topLeftInner,u.left+i[3].width,u.top+u.height-i[2].width);break;default:w(f,r[0],r[1],t.topLeftOuter,t.topRightOuter,u.left,u.top);w(f,r[1],r[2],t.topRightOuter,t.bottomRightOuter,u.left+u.width,u.top);w(f,r[2],r[3],t.bottomRightOuter,t.bottomLeftOuter,u.left+u.width,u.top+u.height);w(f,r[3],r[0],t.bottomLeftOuter,t.topLeftOuter,u.left,u.top+u.height)}return f};var ff=0,nr="withCredentials"in new XMLHttpRequest,tr="crossOrigin"in new Image;a.prototype.cloneTo=function(n){a.prototype.cloneTo.call(this,n);n.isPseudoElement=!0;n.before=this.before};a.prototype=Object.create(e.prototype);a.prototype.appendToDOM=function(){this.before?this.parent.node.insertBefore(this.node,this.parent.node.firstChild):this.parent.node.appendChild(this.node);this.parent.node.className+=" "+this.getHideClass()};a.prototype.cleanDOM=function(){this.node.parentNode.removeChild(this.node);this.parent.node.className=this.parent.node.className.replace(this.getHideClass(),"")};a.prototype.getHideClass=function(){return this["PSEUDO_HIDE_ELEMENT_CLASS_"+(this.before?"BEFORE":"AFTER")]};a.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE="___html2canvas___pseudoelement_before";a.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER="___html2canvas___pseudoelement_after";v.prototype.renderImage=function(n,t,i,r){var f=n.cssInt("paddingLeft"),e=n.cssInt("paddingTop"),h=n.cssInt("paddingRight"),c=n.cssInt("paddingBottom"),u=i.borders,o=t.width-(u[1].width+u[3].width+f+h),s=t.height-(u[0].width+u[2].width+e+c);this.drawImage(r,0,0,r.image.width||o,r.image.height||s,t.left+f+u[3].width,t.top+e+u[0].width,o,s)};v.prototype.renderBackground=function(n,t,i){t.height>0&&t.width>0&&(this.renderBackgroundColor(n,t),this.renderBackgroundImage(n,t,i))};v.prototype.renderBackgroundColor=function(n,t){var i=n.color("backgroundColor");i.isTransparent()||this.rectangle(t.left,t.top,t.width,t.height,i)};v.prototype.renderBorders=function(n){n.forEach(this.renderBorder,this)};v.prototype.renderBorder=function(n){n.color.isTransparent()||n.args===null||this.drawShape(n.args,n.color)};v.prototype.renderBackgroundImage=function(n,t,i){var r=n.parseBackgroundImages();r.reverse().forEach(function(r,u,f){var e,s;switch(r.method){case"url":e=this.images.get(r.args[0]);e?this.renderBackgroundRepeating(n,t,e,f.length-(u+1),i):o("Error loading background-image",r.args[0]);break;case"linear-gradient":case"gradient":s=this.images.get(r.value);s?this.renderBackgroundGradient(s,t,i):o("Error loading background-image",r.args[0]);break;case"none":break;default:o("Unknown background-image type",r.args[0])}},this)};v.prototype.renderBackgroundRepeating=function(n,t,i,r,u){var f=n.parseBackgroundSize(t,i.image,r),e=n.parseBackgroundPosition(t,i.image,r,f),o=n.parseBackgroundRepeat(r);switch(o){case"repeat-x":case"repeat no-repeat":this.backgroundRepeatShape(i,e,f,t,t.left+u[3],t.top+e.top+u[0],99999,f.height,u);break;case"repeat-y":case"no-repeat repeat":this.backgroundRepeatShape(i,e,f,t,t.left+e.left+u[3],t.top+u[0],f.width,99999,u);break;case"no-repeat":this.backgroundRepeatShape(i,e,f,t,t.left+e.left+u[3],t.top+e.top+u[0],f.width,f.height,u);break;default:this.renderBackgroundRepeat(i,e,f,{top:t.top,left:t.left},u[3],u[0])}};ft.prototype=Object.create(e.prototype);ft.prototype.getParentStack=function(n){var t=this.parent?this.parent.stack:null;return t?t.ownStacking?t:t.getParentStack(n):n.stack};lt.prototype.testRangeBounds=function(n){var i,t,r,u,f=!1;return n.createRange&&(i=n.createRange(),i.getBoundingClientRect&&(t=n.createElement("boundtest"),t.style.height="123px",t.style.display="block",n.body.appendChild(t),i.selectNode(t),r=i.getBoundingClientRect(),u=r.height,u===123&&(f=!0),n.body.removeChild(t))),f};lt.prototype.testCORS=function(){return typeof(new Image).crossOrigin!="undefined"};lt.prototype.testSVG=function(){var n=new Image,i=t.createElement("canvas"),r=i.getContext("2d");n.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'><\/svg>";try{r.drawImage(n,0,0);i.toDataURL()}catch(u){return!1}return!0};y.prototype.hasFabric=function(){return html2canvas.fabric?Promise.resolve():Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg"))};y.prototype.inlineFormatting=function(n){return/^data:image\/svg\+xml;base64,/.test(n)?this.decode64(this.removeContentType(n)):this.removeContentType(n)};y.prototype.removeContentType=function(n){return n.replace(/^data:image\/svg\+xml(;base64)?,/,"")};y.prototype.isInline=function(n){return/^data:image\/svg\+xml/i.test(n)};y.prototype.createCanvas=function(n){var t=this;return function(i,r){var u=new html2canvas.fabric.StaticCanvas("c");t.image=u.lowerCanvasEl;u.setWidth(r.width).setHeight(r.height).add(html2canvas.fabric.util.groupSVGElements(i,r)).renderAll();n(u.lowerCanvasEl)}};y.prototype.decode64=function(t){return typeof n.atob=="function"?n.atob(t):fr(t)};er.prototype=Object.create(y.prototype);k.prototype=Object.create(e.prototype);k.prototype.applyTextTransform=function(){this.node.data=this.transform(this.parent.css("textTransform"))};k.prototype.transform=function(n){var t=this.node.data;switch(n){case"lowercase":return t.toLowerCase();case"capitalize":return t.replace(/(^|\s|:|-|\(|\))([a-z])/g,sf);case"uppercase":return t.toUpperCase();default:return t}};or.prototype=Object.create(nt.prototype);c.prototype=Object.create(v.prototype);c.prototype.setFillStyle=function(n){return this.ctx.fillStyle=typeof n=="object"&&!!n.isColor?n.toString():n,this.ctx};c.prototype.rectangle=function(n,t,i,r,u){this.setFillStyle(u).fillRect(n,t,i,r)};c.prototype.circle=function(n,t,i,r){this.setFillStyle(r);this.ctx.beginPath();this.ctx.arc(n+i/2,t+i/2,i/2,0,Math.PI*2,!0);this.ctx.closePath();this.ctx.fill()};c.prototype.circleStroke=function(n,t,i,r,u,f){this.circle(n,t,i,r);this.ctx.strokeStyle=f.toString();this.ctx.stroke()};c.prototype.drawShape=function(n,t){this.shape(n);this.setFillStyle(t).fill()};c.prototype.taints=function(n){if(n.tainted===null){this.taintCtx.drawImage(n.image,0,0);try{this.taintCtx.getImageData(0,0,1,1);n.tainted=!1}catch(i){this.taintCtx=t.createElement("canvas").getContext("2d");n.tainted=!0}}return n.tainted};c.prototype.drawImage=function(n,t,i,r,u,f,e,o,s){(!this.taints(n)||this.options.allowTaint)&&this.ctx.drawImage(n.image,t,i,r,u,f,e,o,s)};c.prototype.clip=function(n,t,i){this.ctx.save();n.filter(hf).forEach(function(n){this.shape(n).clip()},this);t.call(i);this.ctx.restore()};c.prototype.shape=function(n){return this.ctx.beginPath(),n.forEach(function(n,t){n[0]==="rect"?this.ctx.rect.apply(this.ctx,n.slice(1)):this.ctx[t===0?"moveTo":n[0]+"To"].apply(this.ctx,n.slice(1))},this),this.ctx.closePath(),this.ctx};c.prototype.font=function(n,t,i,r,u,f){this.setFillStyle(n).font=[t,i,r,u,f].join(" ").split(",")[0]};c.prototype.fontShadow=function(n,t,i,r){this.setVariable("shadowColor",n.toString()).setVariable("shadowOffsetY",t).setVariable("shadowOffsetX",i).setVariable("shadowBlur",r)};c.prototype.clearShadow=function(){this.setVariable("shadowColor","rgba(0,0,0,0)")};c.prototype.setOpacity=function(n){this.ctx.globalAlpha=n};c.prototype.setTransform=function(n){this.ctx.translate(n.origin[0],n.origin[1]);this.ctx.transform.apply(this.ctx,n.matrix);this.ctx.translate(-n.origin[0],-n.origin[1])};c.prototype.setVariable=function(n,t){return this.variables[n]!==t&&(this.variables[n]=this.ctx[n]=t),this};c.prototype.text=function(n,t,i){this.ctx.fillText(n,t,i)};c.prototype.backgroundRepeatShape=function(n,t,i,r,u,f,e,o,s){var h=[["line",Math.round(u),Math.round(f)],["line",Math.round(u+e),Math.round(f)],["line",Math.round(u+e),Math.round(o+f)],["line",Math.round(u),Math.round(o+f)]];this.clip([h],function(){this.renderBackgroundRepeat(n,t,i,r,s[3],s[0])},this)};c.prototype.renderBackgroundRepeat=function(n,t,i,r,u,f){var e=Math.round(r.left+t.left+u),o=Math.round(r.top+t.top+f);this.setFillStyle(this.ctx.createPattern(this.resizeImage(n,i),"repeat"));this.ctx.translate(e,o);this.ctx.fill();this.ctx.translate(-e,-o)};c.prototype.renderBackgroundGradient=function(n,t){if(n instanceof et){var i=this.ctx.createLinearGradient(t.left+t.width*n.x0,t.top+t.height*n.y0,t.left+t.width*n.x1,t.top+t.height*n.y1);n.colorStops.forEach(function(n){i.addColorStop(n.stop,n.color.toString())});this.rectangle(t.left,t.top,t.width,t.height,i)}};c.prototype.resizeImage=function(n,i){var r=n.image,f,u;return r.width===i.width&&r.height===i.height?r:(u=t.createElement("canvas"),u.width=i.width,u.height=i.height,f=u.getContext("2d"),f.drawImage(r,0,0,r.width,r.height,0,0,i.width,i.height),u)}}.call({},typeof window!="undefined"?window:undefined,typeof document!="undefined"?document:undefined),function(n){"use strict";var t,i;if(n.URL=n.URL||n.webkitURL,n.Blob&&n.URL)try{new Blob;return}catch(r){}t=n.BlobBuilder||n.WebKitBlobBuilder||n.MozBlobBuilder||function(n){var s=function(n){return Object.prototype.toString.call(n).match(/^\[object\s(.*)\]$/)[1]},h=function(){this.data=[]},t=function(n,t,i){this.data=n;this.size=n.length;this.type=t;this.encoding=i},u=h.prototype,r=t.prototype,c=n.FileReaderSync,l=function(n){this.code=this[this.name=n]},a="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),f=a.length,i=n.URL||n.webkitURL||n,v=i.createObjectURL,y=i.revokeObjectURL,e=i,p=n.btoa,w=n.atob,b=n.ArrayBuffer,o=n.Uint8Array,k=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(t.fake=r.fake=!0;f--;)l.prototype[a[f]]=f+1;return i.createObjectURL||(e=n.URL=function(n){var t=document.createElementNS("http://www.w3.org/1999/xhtml","a"),i;return t.href=n,"origin"in t||(t.protocol.toLowerCase()==="data:"?t.origin=null:(i=n.match(k),t.origin=i&&i[1])),t}),e.createObjectURL=function(n){var u=n.type,r;return(u===null&&(u="application/octet-stream"),n instanceof t)?(r="data:"+u,n.encoding==="base64")?r+";base64,"+n.data:n.encoding==="URI"?r+","+decodeURIComponent(n.data):p?r+";base64,"+p(n.data):r+","+encodeURIComponent(n.data):v?v.call(i,n):void 0},e.revokeObjectURL=function(n){n.substring(0,5)!=="data:"&&y&&y.call(i,n)},u.append=function(n){var i=this.data,e;if(o&&(n instanceof b||n instanceof o)){for(var u="",f=new o(n),r=0,h=f.length;r<h;r++)u+=String.fromCharCode(f[r]);i.push(u)}else if(s(n)==="Blob"||s(n)==="File")if(c)e=new c,i.push(e.readAsBinaryString(n));else throw new l("NOT_READABLE_ERR");else n instanceof t?n.encoding==="base64"&&w?i.push(w(n.data)):n.encoding==="URI"?i.push(decodeURIComponent(n.data)):n.encoding==="raw"&&i.push(n.data):(typeof n!="string"&&(n+=""),i.push(unescape(encodeURIComponent(n))))},u.getBlob=function(n){return arguments.length||(n=null),new t(this.data.join(""),n,"raw")},u.toString=function(){return"[object BlobBuilder]"},r.slice=function(n,i,r){var u=arguments.length;return u<3&&(r=null),new t(this.data.slice(n,u>1?i:this.data.length),r,this.encoding)},r.toString=function(){return"[object Blob]"},r.close=function(){this.size=0;delete this.data},h}(n);n.Blob=function(n,i){var o=i?i.type||"":"",f=new t,r,e,u;if(n)for(r=0,e=n.length;r<e;r++)Uint8Array&&n[r]instanceof Uint8Array?f.append(n[r].buffer):f.append(n[r]);return u=f.getBlob(o),!u.slice&&u.webkitSlice&&(u.slice=u.webkitSlice),u};i=Object.getPrototypeOf||function(n){return n.__proto__};n.Blob.prototype=i(new n.Blob)}(typeof self!="undefined"&&self||typeof window!="undefined"&&window||this.content||this),function(n){"use strict";var i=n.Uint8Array,r=n.HTMLCanvasElement,t=r&&r.prototype,e=/\s*;\s*base64\s*(?:;|$)/i,u="toDataURL",f,o=function(n){for(var c=n.length,u=new i(c/4*3|0),l=0,o=0,t=[0,0],s=0,r=0,e,h,a;c--;)h=n.charCodeAt(l++),e=f[h-43],e!==255&&e!==a&&(t[1]=t[0],t[0]=h,r=r<<6|e,s++,s===4&&(u[o++]=r>>>16,t[1]!==61&&(u[o++]=r>>>8),t[0]!==61&&(u[o++]=r),s=0));return u};i&&(f=new i([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]));r&&!t.toBlob&&(t.toBlob=function(n,t){if(t||(t="image/png"),this.mozGetAsFile){n(this.mozGetAsFile("canvas",t));return}if(this.msToBlob&&/^\s*image\/png\s*(?:$|;)/i.test(t)){n(this.msToBlob());return}var l=Array.prototype.slice.call(arguments,1),s=this[u].apply(this,l),h=s.indexOf(","),f=s.substring(h+1),c=e.test(s.substring(0,h)),r;Blob.fake||Blob.prototype&&Blob.prototype.fake?(r=new Blob,r.encoding=c?"base64":"URI",r.data=f,r.size=f.length):i&&(r=c?new Blob([o(f)],{type:t}):new Blob([decodeURIComponent(f)],{type:t}));n(r)},t.toBlobHD=t.toDataURLHD?function(){u="toDataURLHD";var n=this.toBlob();return u="toDataURL",n}:t.toBlob)}(typeof self!="undefined"&&self||typeof window!="undefined"&&window||this.content||this);BrowserInfo=BrowserInfo||{_userAgent:window.navigator.userAgent,_browserCode:undefined,_versionStr:null,_patterns:null,_regExp:null,_matcher:null,_candidateCode:null,_initialized:!1,_knownBrowsers:undefined};BrowserInfo.init=function(){this._initialized=!0;var n=this,i,t;this._knownBrowsers={ch:{getNameToDisplay:function(){return"Chrome {0}".format(n._versionStr)},minimalVersion:22,patterns:[/Chrome\/(\S+)/,/CriOS\/(\S+)/]},ff:{getNameToDisplay:function(){return"FireFox {0}".format(n._versionStr)},minimalVersion:15,patterns:[/Firefox\/(\S+)/]},ie:{getNameToDisplay:function(){var i=parseFloat(n._versionStr),r=userAgent.match(/Trident\/(\S+);/),u="Internet Explorer {0}".format(i),f,t;return r&&(f=r[1],t={"4.0":8,"5.0":9,"6.0":10,"7.0":11}[f],t&&t!=i&&(u="Internet Explorer {0} in Internet Explorer {1} Compatibility View Mode".format(t,i))),u},minimalVersion:9,patterns:[/MSIE (\S+);/,/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/]},sa:{getNameToDisplay:function(){return"Safari {0}".format(n._versionStr)},minimalVersion:5.2,patterns:[/Version\/(\S+).* Safari\/\S+/]},op:{getNameToDisplay:function(){return"Opera {0}".format(n._versionStr)},minimalVersion:24,patterns:[/Opera\/(\S+)/]}};for(t in this._knownBrowsers){for(this._patterns=this._knownBrowsers[t].patterns;i=this._patterns.shift();)if(this._matcher=this._userAgent.match(i),this._matcher){this._browserCode=t;this._versionStr=this._matcher[1].match(new RegExp("[^.]+(?:.[^.]+){0,1}"))[0];break}if(this._browserCode!==undefined)break}};BrowserInfo.isFf=function(){return this._initialized||this.init(),this._browserCode==="ff"};BrowserInfo.isIe=function(){return this._initialized||this.init(),this._browserCode==="ie"};BrowserInfo.isCh=function(){return this._initialized||this.init(),this._browserCode==="ch"};BrowserInfo.isSa=function(){return this._initialized||this.init(),this._browserCode==="sa"};BrowserInfo.isOp=function(){return this._initialized||this.init(),this._browserCode==="ch"};BrowserInfo.isKnown=function(){return this._initialized||this.init(),Boolean(this._browserCode)};BrowserInfo.isSupported=function(){var n;if(this._initialized||this.init(),n=Boolean(this._browserCode&&parseFloat(this._versionStr)>=this._knownBrowsers[this._browserCode].minimalVersion),!n){var t=function(){i={AutoClose:!1,onCloseCallback:function(){Utils.setCookie("OldBrowserMessageClosed",new Date)}};Utils.showAlertMessage("Вы используете устаревшую версию браузера, могут быть ошибки совместимости при просмотре графики.","alert-warn old-browser",i)},i={},r=Utils.getCookie("OldBrowserMessageClosed");if(r){var u=new Date(r),f=new Date(u.getTime()+18e5);f<new Date&&t()}else t()}};BrowserInfo.getBrowserName=function(){var n,t;return this._initialized||this.init(),this._browserCode?(t=this,n=this._knownBrowsers[this._browserCode].getNameToDisplay()):n="",n}