UNPKG

superrfjs

Version:

12 lines 4.04 MB
/*! * * SpreadJS Library 17.0.7 * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the SpreadJS Commercial License. * us.sales@mescius.com * https://developer.mescius.com/spreadjs * */ var GC;!function(){var e,i,t;function r(t){var n,n,n=i[t];return void 0!==n||(n=i[t]={exports:{}},e[t].call(n.exports,n,n.exports,r)),n.exports}e={"./all.entry.js":function(t,n,e){(GC=GC||{}).Spread=GC.Spread||{},GC.Spread=e("./node_modules_local/@spreadjs/js-sheets-common/index.js"),GC.Spread.CalcEngine=e("./node_modules_local/@spreadjs/js-calc/index.js"),GC.Spread.CalcEngine.BasicFunctions=e("./node_modules_local/@spreadjs/js-calc-basicfunctions/index.js"),GC.Spread.CalcEngine.AdvancedFunctions=e("./node_modules_local/@spreadjs/js-calc-advancedfunctions/index.js"),GC.Data=e("./node_modules_local/@spreadjs/js-data-manager/index.js"),GC.Spread.Sheets=e("./dist/core/core.entry.js"),GC.Spread.Sheets.Bindings=e("./dist/plugins/data/data.entry.js"),GC.Spread.Sheets.Outlines=e("./dist/plugins/group/group.entry.js"),GC.Spread.Sheets.CalcEngine=e("./dist/plugins/sheetsCalc/sheetsCalc.entry.js"),GC.Spread.Sheets.ConditionalFormatting=e("./dist/plugins/conditional/conditional.entry.js"),GC.Spread.Sheets.DataValidation=e("./dist/plugins/validation/datavalidation.entry.js"),GC.Spread.Sheets.Search=e("./dist/plugins/search/search.entry.js"),GC.Spread.Sheets.Touch=e("./dist/plugins/touch/touch.entry.js"),GC.Spread.Sheets.FloatingObjects=e("./dist/plugins/floatingObject/floatingobject.entry.js"),GC.Spread.Sheets.Sparklines=e("./dist/plugins/sparkline/sparkline-wrapper.entry.js"),GC.Spread.Sheets.Comments=e("./dist/plugins/comment/comment.entry.js"),GC.Spread.Sheets.CellState=e("./dist/plugins/cellState/cellstate.entry.js"),GC.Spread.Sheets.CellTypes=e("./dist/plugins/celltype/celltypes.entry.js"),GC.Spread.Sheets.Filter=e("./dist/plugins/filter/filter.entry.js"),GC.Spread.Sheets.Tables=e("./dist/plugins/table/table.entry.js"),GC.Spread.Sheets.Fill=e("./dist/plugins/fill/fill.entry.js"),GC.Spread.Sheets.ContextMenu=e("./dist/plugins/contextMenu/context-menu.entry.js"),GC.Spread.Sheets.FormulaTextBox=e("./dist/plugins/formulaTextbox/formulaTextBox.entry.js"),GC.Spread.Sheets.OutlineColumn=e("./dist/plugins/outlineColumn/outlineColumn.entry.js"),GC.Spread.Sheets.DragMerge=e("./dist/plugins/dragMerge/dragMerge.entry.js"),GC.Spread.Sheets.StatusBar=e("./dist/plugins/statusBar/statusBar.entry.js"),GC.Spread.Sheets.AutoMerge=e("./dist/plugins/autoMerge/autoMerge.js"),GC.Spread.Sheets.Hyperlink=e("./dist/plugins/hyperlink/hyperlink.js"),GC.Spread.Sheets.NameBox=e("./dist/plugins/namebox/namebox.entry.js"),GC.Spread.Sheets.InputMask=e("./dist/plugins/inputMask/inputMask.entry.js"),t.exports=GC.Spread},"./dist/core/celltype/basecelltype.js":function(n,u,t){"use strict";var c,v,ht,dt,m,Z,e,l,h,d,p,t,W,o,Q,Mt,J,vt,y,M,K,L,et,C,F,S,A,X,q,$,_,tt,b,j,I,mt,N,gt,pt,Ct,i,bt,r,s,T,wt,St,D,O,k,E,R,B,P,G,x,U,a,H;function nt(t){var n=t.isPrinting,t=t.printZoomFactor;return n&&typeof t===b&&1!==t}function V(t){var n;return!(t instanceof CanvasRenderingContext2D)&&!C(t._ae)}function z(t,n){var e,i,r,e=0,i=t.font+n,r=!V(t);return r&&O[i]?e=O[i]:(e=K(t,t.font,n),r&&(O[i]=e)),e}function w(){}function Y(t,n){var e;return n/2-t/2+(8<t?mt((t-8)/5+2):1)-1}function it(t,n,e){return W(t.x)||(t.x+=n.width),t.width=t.width-n.width-e.width,t}function rt(t,n,e,i,r){var o,a,o=e+" - "+n+" - "+t;return u.wordWrapInfoCache||(u.wordWrapInfoCache={}),a=2e3,C(u.clearCacheTimer)&&(u.clearCacheTimer=setTimeout(function(){u.wordWrapInfoCache=null,u.clearCacheTimer=null},a)),u.wordWrapInfoCache[o]||(u.wordWrapInfoCache[o]=ht.q.un(t,n,e,!1,r)),u.wordWrapInfoCache[o]}function ot(t,n){return dt.W.gfe(t,Z.IconPosition.left)&&(n+=1),dt.W.gfe(t,Z.IconPosition.right)&&(n+=2),n}function at(t,n){return dt.W.gfe(t,Z.IconPosition.left)&&--n,dt.W.gfe(t,Z.IconPosition.right)&&(n-=2),n}function Tt(t,n,e,i,r,o){var n=new ht.Rect(t?t.x:n+1,t?t.y:e+1,t?t.width:i-2,t?t.height:r-2);return n=o?n.getIntersectRect(o):n}function f(){this.allowOverflow=!1,this.typeName="0"}function ut(t,n,e,i){var r,o,r=t.conditionalFormats;return r&&(o=t.getValue(n,e,i),r.O(n,e,i))&&r.U(t,n,e,o,i).iconSet}function st(t,n,e){for(var i,r,o,i=0,r=0;r<t.length;r++)o=void 0,o=t[r].style&&t[r].style.font?t[r].style.font:n,i=Math.max(Q(o,I,J(t[r].text))/e,i),(t[r].style&&1===t[r].style.vertAlign||2===t[r].style.vertAlign)&&(i=Math.max(Q(o,I,J(t[r].text))/e+2*dt.W.V(o,D).fontSize*.218,i));return i}function ct(t,n,e,i,r){var o,a,u,s,c,f,o=ht.q.J();if(!o)return 0;for(u=a=0;u<t.length;u++)s=void 0,s=t[u].style&&t[u].style.font?t[u].style.font:n,t[u].style&&t[u].style.vertAlign&&(s=dt.W.V(s,D).font),vt(o,s),c="",c=u===t.length-1&&r?ht.q.tt(t[u].text):t[u].text,f=0,i?f=Q(s)*c.length/e:W(t[u].text)||(f=K(o,s,t[u].text)/e),a+=f;return a}function ft(t,n,e,i,r){var o,a,u,o;if(!ht.q.J())return 0;for(u=a=0;u<t.length;u++)a+=ct(t[u],n,e,i,r);return a}function lt(t,n,e,i,r,o,a,u,s){var c,f,l,h,d,v,m,g,p,b,s,a,m,g,w,y,M,C,S,T,p,b,c=a.backColor,f=a.backgroundImage,l=a.textOrientation,h=a.isVerticalText,d=a.textIndent&&0!==a.textIndent,v=a.backgroundImageLayout,m=s.row,g=s.col,p=s.sheet,b=p.Jt,s=s.sheet&&s.sheet.getSpan(m,g,s.sheetArea),a=a&&(a.borderLeft||a.borderTop||a.borderRight||a.borderBottom),w=0,y=n;t.save(),g+1<p.getColumnCount()&&(S=b.qt(m,g+1)),0<=g-1&&(T=b.qt(m,g-1)),p=function(t){return t!==I&&t&&-90<=t&&t<=90},b=function(){t.fillRect(n,e,i,r)},l&&0!==l&&a&&u&&!s&&!h&&!d&&(m=bt(l*Math.PI/180),g=Ct(m),w=mt(r/g),-90<l&&l<0&&(S&&!p(S.textOrientation)&&(C=S.backColor),y=n-w),0<l&&l<90&&(T&&!p(T.textOrientation)&&(C=T.backColor),y=n+w),M=function(){t.beginPath(),t.moveTo(y,e),t.lineTo(y+i,e),t.lineTo(n+i,e+r),t.lineTo(n,e+r),t.fill()}),(c||f)&&(C&&dt.W.setFillStyle(t,C,n,e,i,r,b),M?dt.W.setFillStyle(t,c,Math.min(y,n),e,i+w,r,M):c&&dt.W.setFillStyle(t,c,n,e,i,r,b),x.nt(t,n,e,i,r,f,v,o)),t.restore()}function At(t,n,e,i,r,o,a){var t;(0===t||5===t||a)&&ut(n,e,i,r)&&(t=It(n),o.x+=t,o.width-=t)}function It(t){return parseInt(_*t.zoom(),10)}function yt(t,n,e,i){var r=t.cellPadding,o=0,t=t.labelOptions;return(r=e?t?t.margin:"0":r)&&(o=typeof(o=parseInt(Ot(r)[n],10))===b&&0<o?o:0),i===I?o:o*i}function xt(t){var n={context:t,value:0};return a.et(t.sheet,"getOutlineColumnOffset",n),n.value}function Nt(t,n){var n={context:t,value:0,cellStyle:n};return a.et(t.sheet,"getCellButtonAutoWidth",n),n.value}function kt(t,n){var n={context:t,value:0,cellStyle:n};return dn(n),a.et(t.sheet,"getSpecialIconsAutoWidth",n),n.value}function _t(t,n){var n={context:t,value:0,cellStyle:n};return a.et(t.sheet,"getCellButtonAutoHeight",n),n.value}function Dt(t,n){var n={context:t,value:0,cellStyle:n};return vn(n),a.et(t.sheet,"getSpecialIconsAutoHeight",n),n.value}function jt(t,n,e,i){var r,i,r,n,o,r=i&&i.sheet;r&&e&&(i=i.canvasOffset||r.rt.it(),r=r.ot(),(n=(n=n.backColor||"white").stops?(o=n.stops)[0]&&o[0].color:n).backgroundColor&&(n=n.backgroundColor),(0,v.GC$)(t).width(e.width).height(e.height).css({top:i.top+r.y+e.y-2,left:i.left+r.x+e.x-2,"background-color":n}))}function Ot(t){var n,t,e,i,r,n=["0","0","0","0"];return typeof t===tt&&(r=i=void 0,1===(e=(t=t.split(" ",4)).length)?n=[i=t[0],i,i,i]:2===e?n=[i=t[0],r=t[1],i,r]:3===e?(r=t[1],n=[t[0],r,t[2],r]):4===e&&(n=[t[0],t[1],t[2],t[3]])),n}function Et(t,n){var e,i,r,o,a,e=yt(t,0),i=yt(t,2),r=yt(t,0,!0),o=yt(t,2,!0);if(!(yt(t,3,!0)+yt(t,1,!0)>=n.width))if(0===(a=(a=t.labelOptions.alignment)===I?t.labelOptions.alignment=0:a)||1===a||2===a){if(0<e&&r+o<e)return 1}else if((3===a||4===a||5===a)&&e<n.height&&0<i&&r+o<i)return 1}function Rt(t,n){var e,i,r,o,a,e=yt(n,0),i=yt(n,3,!0),r=yt(n,2,!0),o=t.clone(),a=n.labelOptions.alignment;return 0===a||1===a||2===a?e<t.height&&(o.height=e-r+1):3!==a&&4!==a&&5!==a||(o.height=t.height-r),o.x+=i,o.width-=i+yt(n,1,!0),o}function Lt(t){var n="left";return 1===t||4===t?n="center":2!==t&&5!==t||(n="right"),n}function Ft(t,n,e,i){var r,e,o,a,u,s,c,t,f,l,h,i,d,v,r=new ht.Point(t.x,t.y),e=parseInt(e.fontSize,10),o=yt(n,0),a=yt(n,2),u=yt(n,3,!0),s=yt(n,1,!0),c=t.width,t=t.height,f,l,h=8<e?1:2,i=i-(i/2-e/2+(8<e?Math.floor((e-8)/5+2):1)-1)+yt(n,0,!0),d=i+1,v=t<o+a?o+i:t-a+i-1;switch(n.labelOptions.alignment){case 0:r.x+=u+h+1,r.y+=d;break;case 1:r.x+=u+(c-u-s)/2,r.y+=d;break;case 2:r.x+=c-s-2,r.y+=d;break;case 3:r.x+=u+h+1,r.y+=v;break;case 4:r.x+=u+(c-u-s)/2,r.y+=v;break;case 5:r.x+=c-s-2,r.y+=v}return r}function Bt(t,n){var e,i,r,o,a,u,e=yt(n,3,!0),i=yt(n,1,!0),r=yt(n,0,!0),o=yt(n,2,!0),a=t.clone(),u=n.labelOptions.alignment;return a.x=e+1,a.width-=e+i,0===u||1===u||2===u?(a.y=r,a.height=yt(n,0)-r-o):3!==u&&4!==u&&5!==u||(a.y=t.height-yt(n,2)+r,a.height=yt(n,2)-r-o),2!==u&&5!==u||(a.width-=2),a}function Pt(t,n,e){var i,r;if(o(n,tt))return z(t,n);if(e&&n&&n[0]&&n[0].value)return n[0].value.length*Q(t.font);for(r=i=0;r<n.length;r++)"fillingChar"!==n[r].type&&(i+=z(t,n[r].value));return i}function Gt(t){for(var n,e,i,r,o,n=t[0].type,e=0,i=[t[0]],r=1;r<t.length;r++)o=t[r],n===T&&o.type===T?i[e].value+=o.value:(i.push(o),n=o.type,e++);return i}function Ut(t,n,e,i,r){var i,i=i?Math.floor(n/r):Math.floor(n/K(t,t.font,e));return new Array(i+1).join(e)}function Ht(t){var t=t.clone();return t.width--,t.height--,t}function Vt(t,n,e,i){for(var r,o,a,r=0;r<t.length;r++)o=void 0,t[r].style=t[r].style||{},(a=t[r].style).font?(o=dt.W.V(a.font,e).font,W(i)||(o=dt.W.V(o,i).font)):o="object"==typeof n?n.font:n,a.font=o}function zt(t,n,e,i,r){var o=e*pt(-i)+r*gt(-i),e=e*pt(-i)+r*gt(-i),a,u;return new ht.Rect(t-o/2,n-e/2,o,e)}function Yt(t){return"string"==typeof t.src&&0<t.src.length&&-1===t.src.indexOf("<script")}function Zt(t,n,e,i){var r,r,r,o;C(e)||(a.et(i.sheet,"beforePaintDecoration",o={context:i,style:e}),null!=(r=e.decoration)&&r.cornerFold&&Wt(t,n,e.decoration.cornerFold,i),0<(null==(r=null==(r=e.decoration)?void 0:r.icons)?void 0:r.length)&&Qt(t,n,e.decoration.icons.filter(Yt),e.vAlign,i))}function Wt(t,n,e,i){var r,o,e,a,u,s,n,c,r,i,e,f,l,h,d,r=e.size,o=e.position,e=e.color;C(r)&&(r=6),C(o)&&(o=m.CornerPosition.leftTop),a=n.x,u=n.y,s=n.height,n=n.width,r=r*(c=i.sheet).zoom(),t&&0<n&&0<s&&(t.save(),t.rect(a,u,n,s),t.clip(),t.fillStyle=e||"#FF3D00",t.beginPath(),t.fillStyle=e,d=h=l=f=e=i=void 0,o&m.CornerPosition.leftTop&&(f=i=a,l=(e=u)+r,h=i+r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),o&m.CornerPosition.rightBottom&&(l=(e=u+s)-r,h=(f=i=a+n)-r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),o&m.CornerPosition.leftBottom&&(f=i=a,l=(e=u+s)-r,h=i+r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),o&m.CornerPosition.rightTop&&(l=(e=u)+r,h=(f=i=a+n)-r,d=e,t.moveTo(i,e),t.lineTo(f,l),t.lineTo(h,d),t.fill()),t.closePath(),t.restore())}function Qt(t,n,e,i,r){var o,e,a,a,u,s,c;!r.cellOverflowLayout&&0<e.length&&(o=e.filter(function(t){return C(t.position)||t.position===Z.IconPosition.left}),e=e.filter(function(t){return t.position===Z.IconPosition.right}),0<(a=o.concat(e)).length)&&(ln(a,r),t)&&(a=hn(n.clone(),r),t.save(),t.rect(a.x,a.y,a.width,a.height),t.clip(),t.beginPath(),s=u=a.x,c=a.x+a.width,0<o.length&&(s=u=tn(t,o,a,i,r)),0<e.length&&(c=u=qt(t,e,a,i,r)),t.restore(),n.width=n.x+n.width-(a.x+a.width-c)-s,n.x=s)}function Jt(t,n,e,i,r){var o,e,a,u;t&&0<e.length&&(o=e.filter(function(t){return t.position===Z.IconPosition.outsideLeft&&Yt(t)}),e=e.filter(function(t){return t.position===Z.IconPosition.outsideRight&&Yt(t)}),a=3,u=n.x,0<o.length||0<e.length)&&(ln(o,r),ln(e,r),2===r.columnHeaderFitMode&&r.cornerX&&((n=n.clone()).height=n.height-(r.cornerY-n.y)-1,n.y=r.cornerY-1),0<o.length&&(n.x=u-3,Kt(t,o,n,i,r)),0<e.length)&&(n.x=u+3,Xt(t,e,n,i,r))}function Kt(t,n,e,i,r){$t(t,n,e.x,e,i,r)}function Xt(t,n,e,i,r){nn(t,n,e.x+e.width,e,i,r)}function qt(t,n,e,i,r){return $t(t,n,e.x+e.width,e,i,r)}function $t(t,n,e,i,r,o){var a,u,s,c,a,u;for(e-=cn(o),s=n.length-1;0<=s;s--)e-=c=g(o,n[s],"width"),rn(t,n[s],e,i.y,c,i.height,o,i,r);return e}function tn(t,n,e,i,r){return nn(t,n,e.x,e,i,r)}function nn(t,n,e,i,r,o){var a,u,s,c,a,u;for(e+=cn(o),s=0;s<n.length;s++)c=g(o,n[s],"width"),rn(t,n[s],e,i.y,c,i.height,o,i,r),e+=c;return e}function en(t,n){var e,i,r,o,n,a,t,u,u,n,e=n.ctx,i=n.style,r=n.context,o=n.textRect,n=n.availRect;!C(i.decoration)&&e&&(a="beforeFillTextArea"===t?Z.IconPosition.leftOfText:Z.IconPosition.rightOfText,t=i.decoration.icons&&i.decoration.icons.filter(function(t){return t.position===a&&Yt(t)}))&&0<t.length&&(ln(t,r),2===r.columnHeaderFitMode&&r.cornerX&&(u=r.cellRect.x+r.cellRect.width-(n.x+n.width),(n=n.clone()).width=r.cornerX-n.x-u,n.height=n.height-(r.cornerY-n.y)-1,n.y=r.cornerY-1),u=void 0,n=un(n,o,a),e.save(),e.rect(n.x,n.y,n.width,n.height),e.clip(),e.beginPath(),a===Z.IconPosition.leftOfText?(u=qt(e,t,n,i.vAlign,r),o.x=u):(u=tn(e,t,n,i.vAlign,r),o.width=u-o.x),e.restore())}function rn(t,n,e,i,r,o,a,u,s){var c,f,l,e,r,o,h,s,n,a,n,h,i,d;t.save(),t.beginPath(),t.rect(e,i,r,o),t.clip(),c=0,f=fn(a),l=n.src,f.getState(l)?f.qh(l)&&(e=new ht.Rect(e,i,r,o),r=g(a,n,"width"),o=g(a,n,"height"),s=sn(e,h=new ht.Rect(0,0,r,o),s,cn(a)),n.position!==Z.IconPosition.leftOfText&&n.position!==Z.IconPosition.rightOfText||((n=a.textRect)&&(s.y=wt(n.y-n.height/2-h.height/2,i+4)),s.y+s.height>e.y+e.height&&(s.y=wt(s.y-(s.y+s.height-e.y-e.height),e.y))),n=(a=f.getImage(l)).width,h=a.height,ht.mt.Tt.msie&&(E[l]||(a.style.position="absolute",a.style.left="-10000px",a.style.top="-100000px",document.body.appendChild(a),E[l]={width:a.width,height:a.height},document.body.removeChild(a)),n=E[l].width,h=E[l].height),u&&ht.mt.Tt.msie&&s.x+s.width>u.x+u.width?0<(i=c=u.x+u.width-s.x)&&t.drawImage(a,0,0,i*(d=n/r),h,N(s.x),N(s.y),i,o):(c=r,t.drawImage(a,0,0,n,h,N(s.x),N(s.y),c,o))):f.addImage(l,"anonymous"),t.restore()}function on(t){var n=t.context,e=t.style,t=t.externals;dt.W.Xue(e)&&(t.left=t.left.concat(an(n,e,Z.IconPosition.leftOfText)),t.right=t.right.concat(an(n,e,Z.IconPosition.rightOfText)))}function an(n,t,e){for(var i,r,o,a,i=!1,r=0,o=t.decoration.icons;r<o.length;r++)if((a=o[r]).v_i){i=!0;break}return t.decoration.icons.filter(function(t){return t.position===e&&(!n.cellOverflowLayout||i)}).map(function(t){return{width:g(n,t,"width"),height:g(n,t,"height"),isStick:t.v_i}})}function un(t,n,e){switch(e){case Z.IconPosition.leftOfText:return new ht.Rect(t.x,t.y,n.x-t.x,t.height);case Z.IconPosition.rightOfText:return new ht.Rect(n.x+n.width,t.y,t.x+t.width-n.x-n.width,t.height)}}function sn(t,n,e,i){var r,o=2*i;switch(e){case Z.VerticalAlign.top:r=0+o;break;case Z.VerticalAlign.bottom:r=Math.max(0,t.height-n.height)-o;break;default:r=Math.max(0,(t.height-n.height)/2)}return new ht.Rect(t.x,t.y+r,Math.min(n.width,t.width),Math.min(n.height,t.height))}function cn(t){return nt(t)?t.printZoomFactor:t.sheet.zoom()}function g(t,n,e){var n=n[e],e=cn(t);return(n=C(n)||isNaN(n)||n<=0?12:n)*e}function fn(t){var n=t.sheet,e;return n.MC||t.imageLoader||n.BO()}function ln(t,n){for(var e,i,r,e=fn(n),i=0;i<t.length;i++)(r=t[i].src)&&e.addImage(r,"anonymous")}function hn(t,n){return 2===n.columnHeaderFitMode&&n.cornerX&&(t.width=n.cornerX-t.x,t.height=t.height-(n.cornerY-t.y)-1,t.y=n.cornerY-1),t}function dn(t){mn(t,"width")}function vn(t){mn(t,"height")}function mn(t,n){var e,i,r,o,a,e=t.cellStyle;if(e.decoration&&e.decoration.icons&&0!==e.decoration.icons.length){for(i=e.decoration.icons,o=r=0;o<i.length;o++)a=i[o],dt.W.Kue(a)&&(r+=g(t.context,a,n));t.value=r}}function gn(t,n,e){var n,i,t,r,o,e,i,n=(t.length-1)*n,i=t[0],t=t[t.length-1],r,o=document.createElement("canvas").getContext("2d");return o.font=e.font,e=o.measureText(i),i=o.measureText(t),{height:n=e.actualBoundingBoxAscent+i.actualBoundingBoxDescent+n,descenderHeight:i.actualBoundingBoxDescent}}function pn(t,n,e,i,r,o,a,u){var s,c,f,l,h,s=e.content;if(s&&0<s.length)for(l=0<(l=o-a-(f=Pt(t,s,!0))-2)?l:0,h=void 0,c=0;c<s.length;c++)"fillingChar"===s[c].type||"numberPlaceholder"===s[c].type?r+=l:"placeholder"===s[c].type?r+=s[c].value?s[c].value.length*u:0:r+=h=s[c].value?s[c].value.length*u:0;else if(n)for(c=0;c<n.length;c++)r=bn(t,n[c],i,r).y;return r}function bn(t,n,e,i){var t,r,o,a;if(n&&0<n.length)for(t=t.font,r=Q(t,I,J(n)),o=Y(dt.W.V(t,1).fontSize,r),a=0;a<n.length;a++)i=i+r-o,i+=o;return{x:e,y:i}}Object.defineProperty(u,"__esModule",{value:!0}),u.Context=u.Base=u.paintStyleDecorationOutSideIcons=u.paintDecoration=u.clearCacheTimer=u.wordWrapInfoCache=void 0,c=t("Common"),v=t("./dist/core/util/domUtil.js"),ht=t("./dist/core/util/common.js"),dt=t("./dist/core/worksheet/stylehelper.js"),m=t("./dist/core/core.interface.js"),Z=t("./dist/core/core.enum.js"),e=t("./dist/core/celltype/celltype.ns.js"),l=t("CalcEngine"),h=c.Common.CultureManager,d=c.Common.st,p=c.Common.ct,t=c.Common.lt,W=t.ht,o=t.dt,Q=ht.mt.vt,Mt=ht.mt.gt,J=ht.mt.pt,vt=ht.mt.bt,y=ht.mt.yt,M=ht.mt.wt,K=ht.mt.Mt,L=ht.mt.Ct,et=ht.mt.St,C=c.Common.lt.ht,F=v.GC$.extend,S=ht.mt.Tt,A="left",X="right",q="center",$="alphabetic",_=16,tt="string",b="number",j=null,I=void 0,mt=Math.floor,N=Math.ceil,gt=Math.sin,pt=Math.cos,Ct=Math.tan,i=Math.PI,bt=Math.abs,r="none",s="General",T="text",wt=Math.max,St=Math.min,D=.7,O={},k="...",E={},B=" ",P=new RegExp(R="\xa0","g"),H=G={top:0,0:"top",right:1,1:"right",bottom:2,2:"bottom",left:3,3:"left"},w.At=function(t){var t,n,e,t=t.split("e")[1];if(t&&0<t.length&&("+"===t[0]?n=!0:"-"===t[0]&&(n=!1),e=t.slice(1)),void 0!==n)return{isAdd:n,length:e}},w.It=function(t,n,e){var i,r,i=w.xt,r=i[n+e];return r||(r=K(t,n,e),i[n+e]=r),r},w.Nt=function(t,n,e,i,r){var o,r,a,a,r,a,u,s,s,c,u,f,a,l,h,o,d,v,m,g,p,o=i.font;if(e=e-1-at(i,3)*r,r=i.textIndent&&0!==i.textIndent,a=i.isVerticalText,typeof n!==b||!0===i.shrinkToFit||a||r)return i._autoFormatter;if(a=n<0,n=bt(n),r=a?w.It(t,o,"-"):0,a=n.toString(),(u=w.At(a))&&!1===u.isAdd&&(s=ht.mt.toPlainString(n)).split(".")[1].length<10&&(a=s,u=I),s=void 0,c=w.Dt(i._autoFormatter,n),u)return s=u.length.toString().length,s=wt(s,2),w._t(t,e,i,s,r,u.isAdd,c);if(u=r,f=w.It(t,o,"0"),a=a.split("."),u+=h=f*(l=Math.round(n).toString().length),o=w.It(t,o,"."),d=void 0,h<=e){if(!a[1]||0===a[1].length)return i._autoFormatter;if((u=u+a[1].length*f+o)<=e)return i._autoFormatter;if(n<.001)return s=a[1].length.toString().length,s=wt(s,2),w._t(t,e,i,s,r,!1,c);for(m=Math.floor((v=e-r-h-o)/f),d="0",0<(m=Math.min(m,a[1].length))&&(d+="."),g=0;g<m;g++)d+="0";return d}return s=(p=Math.round(n)).toString().length.toString().length,s=wt(s,2),w._t(t,e,i,s,r,!0,c)},w._t=function(t,n,e,i,r,o,a){var e,u,s,c,f,l,h,n,r,d,v,m,e=e.font,u=w.It(t,e,"0"),s=w.It(t,e,"E"),c=w.It(t,e,"+"),f=w.It(t,e,"-"),l,h,n=n-r-i*u-s-(o?c:f)-u,r=n-w.It(t,e,".");if(r<=u)return o?"0E+00":0<n?"0E-00":"0";for(d=Math.floor(r/u),d=Math.min(d,a),v="0",m=0;m<d;m++)0===m&&(v+="."),v+="0";return v+=o?"E+00":"E-00"},w.Et=function(t,n,e,i,r){var o,r,a,u,s,i,c,f,l,o=i.font;if(e=e-1-at(i,3)*r,r=i.textIndent||0,u=e,(u=1!==(a=i.hAlign)&&0<r?e-8*r:e)<(s=K(t,o,n))){for(i=w.It(t,o,"#"),c=Math.floor(e/i),f="",l=0;l<c;l++)f+="#";return f}return n},w.nt=function(t,n,e,i,r,o,a,u){var s,c,f,l,h,d,v,m,g,p,b,w;if(o&&"none"!==o&&u)try{u.getState(o)?(s=u.getImage(o),c=void 0,S.msie&&((c=document.createElement("div")).appendChild(s),document.body.appendChild(c)),f=s.width,l=s.height,S.msie&&(c.removeChild(s),document.body.removeChild(c)),d=h=0,v=f,m=l,g=i,p=r,b=n,w=e,1===a?(v=f<=i?f:i,m=l<=r?l:r,b=f<i&&0<f?N(n+i/2-f/2):n,w=l<r&&0<l?N(e+r/2-l/2):e,g=v,p=m):2===a?0<r&&0<l&&f/l<i/r?b=n+i/2-(g=f/l*r)/2:0<i&&0<f&&l/f<r/i&&(w=e+r/2-(p=l/f*i)/2):3===a&&(g=v=f<=i?f:i,p=m=l<=r?l:r),t.drawImage(s,0,0,v,m,b,w,g,p)):u.addImage(o)}catch(t){}},w.Bt=function(t,n,e,i,r){var o,a,u,s,c,f,l,h,d,v,m,g,p,b,w,b,y,M,C,S,C,T,A,I,S,t,C,x,N,k,t,o=0,a=r&&r.sheet,u=r.sheetArea,s=r.row,c=r.col,f=e.textIndent,l=e.hAlign,h=e.isVerticalText,d,v=1===u&&1===a.Lt(c)?-90:e.textOrientation,m=e.borderTop||e.borderBottom||e.borderLeft||e.borderRight,w=e.font;if(v&&-90<=v&&v<=90&&(b=bt(v*Math.PI/180),p=gt(b),b=pt(b)),a&&typeof n===tt&&n)if(y=[],M=void 0,t&&t.richText)if(C=e.formatter||e._autoFormatter,C=(S=a.getCellType(s,c,u)).Ft(C,t.text),Vt(M=F(!0,[],S.Pt(t,n,C,w,e.foreColor)),w,i),h)if(e.wordWrap||5===l){if(T=a.Gt(s,u),(A=a.Ut.findSpan(s,c,u))&&A.row>=s&&A.col>=c&&1<A.rowCount)for(I=s+1;I<s+A.rowCount;I++)T+=a.Gt(I,u);for((S=0)<f&&(S=8*f*i),0<(t=yt(e,0))&&(T-=t),0<(C=yt(e,2))&&(T-=C),y=ht.q.Ht(n,++T-at(e,3)-S,w,M,h),g=0;g<y.length;g++)o+=st(y[g].textInfos,w,i)}else o=st(M,w,i);else{if(e.wordWrap||5===l){for(x=n.split(/\r\n|\r|\n/),g=0;g<x.length;g++)y.push((0,ht.zt)(x[g]));for(y=ht.q.Vt(y,ht.q.Yt(M)),g=0;g<y.length;g++)o=Math.max(o,ft(y[g],w,i,h,!0))}else o=ct(M,w,i);0<f&&4!==l&&(o+=1===l||5===l?8*f*2:8*f),ut(a,s,c,r.sheetArea)&&(o+=It(a))}else if(y=n.split(/\r\n|\r|\n/),k=Q(N=w)/i,h)if(e.wordWrap||5===l)for(g=0;g<y.length;g++)o+=k;else o=k;else{if(e.wordWrap||5===l){if(v)return t=a.Gt(s,u),ht.q.Zt(s,c,p,b,n,N,t);for(g=0;g<y.length;g++)o=Math.max(o,ht.q.Wt(y[g],N,!0)/i)}else o=v?m?(4+k)/p:b*(a.Qt(n,N)/i)+k*p:4===e.hAlign?a.Jt.Kt(c,u):a.Qt(n,N)/i;0<f&&4!==l&&(o+=1===l||5===l?8*f*2:8*f),ut(a,s,c,r.sheetArea)&&(o+=_)}return o},w.Xt=function(t,n,e,i){for(var r,o,a,u,r=t.Jt.Kt(e,i),o=e+1;o<t.getColumnCount(i)&&(a=t.Jt.qt(n,o,i),u=t.Jt.$t(n,o,i,1,a),C(u))&&!a.watermark&&!(a.cellType&&"1"!==a.cellType.typeName||a.cellButtons&&0<a.cellButtons.length||dt.W.Jue(a))&&4===a.hAlign;o++)r+=t.Jt.Kt(o,i);return r},w.tn=function(t,n,e,i,r){var o,a,u,s,c,f,l,h,d,v,m,g,p,b,w,y,M,C,S,T,A,h,I,x,N,h,k,h,A,_,A,D,_,j,O,l,E,R,o=0,u=r&&r.sheet,s=e.font,c=e.isVerticalText,f=e.textIndent,l=e.vAlign,h=e.hAlign,d=e.textOrientation,v=r.row,m=r.col,g=r.sheetArea,N=0<f?8*f*i:0;if(1!==h&&5!==h||(N*=2),d&&-90<=d&&d<=90&&(h=bt(d*Math.PI/180),I=gt(h),x=pt(h)),u&&typeof n===tt&&n)if(k=[],h=void 0,t&&t.richText)if(A=e.formatter||e._autoFormatter,A=(_=u.getCellType(v,m,g)).Ft(A,t.text),Vt(h=F(!0,[],_.Pt(t,n,A,s,e.foreColor)),s,i),c){if(e.wordWrap||5===e.hAlign){for(D=n.split(/\r\n|\r|\n/),a=0;a<D.length;a++)k.push((0,ht.zt)(D[a]));for(k=ht.q.Vt(k,ht.q.Yt(h)),a=0;a<k.length;a++)o=Math.max(o,ft(k[a],s,i,c,!0))}else o=ct(h,s,i,c);0<f&&(o+=1===l?8*f*2:8*f)}else if(e.wordWrap||5===e.hAlign){if(p=u.nn(m,g),(y=u.Ut.findSpan(v,m,g))&&y.row>=v&&y.col>=m&&1<y.colCount)for(M=m+1;M<m+y.colCount;M++)p+=u.nn(M,g);for(S=yt(e,1),0<(T=yt(e,3))&&(p-=T),0<S&&(p-=S),k=ht.q.Ht(n,++p-at(e,3)-N,s,h),a=0;a<k.length;a++)o+=st(k[a].textInfos,s,i)}else o=st(h,s,i);else if(_=e.font,j=Q(_)/i,c){if(e.wordWrap||5===e.hAlign)for(k=n.split(/\r\n|\r|\n/),a=0;a<k.length;a++)O=k[a].length*j,o=Math.max(o,O);else o=n.length*j;0<f&&(o+=1===l?8*f*2:8*f)}else if(e.wordWrap||5===e.hAlign){if(g=r.sheetArea,p=4===e.hAlign?this.Xt(r.sheet,v,m,g):u.nn(m,g),b=u.Gt(v,g),(y=u.Ut.findSpan(v,m,g))&&y.row>=v&&y.col>=m&&1<y.colCount){for(M=m+1;M<m+y.colCount;M++)p+=u.nn(M,g);for(C=v+1;C<v+y.colCount;C++)b+=u.Gt(C,g)}if(S=yt(e,1),0<(T=yt(e,3))&&(p-=T),0<S&&(p-=S),0<(A=yt(e,0))&&(b-=A),0<(h=yt(e,2))&&(b-=h),e.cellButtons&&0<e.cellButtons.length&&(p-=Nt(r,e)),dt.W.Jue(e)&&(p-=kt(r,e)),e.cellType&&e.cellType.Tfe&&(p-=e.cellType.Tfe(i)),1===g&&(E=!!((l=u.rowFilter&&u.rowFilter())&&l.rn(v,m,g)&&l.filterButtonVisible(m)))&&(p-=u.an(new ht.Rect(0,0,p,b),g).width),d)return k=ht.q.un(n,R=(b-j*x)/I,_),o=I*(w=u.Qt(k[0],_)/i)+j*x;o=(k=L(t)?[n]:ht.q.un(n,p-at(e,3)-N,_)).length*j}else o=d?I*(w=u.Qt(n,_)/i)+j*x:j;return o},w.cn=function(t,n,e,i,r,o,a,u,s,c,f){var l;1===s?(t.beginPath(),(l=t.createLinearGradient(n,e+1,n,e+r-2)).addColorStop(0,u.borderLeftColor),l.addColorStop(1,u.borderRightColor),t.strokeStyle!==l&&(t.strokeStyle=l),o.borderLeft||(t.moveTo(n+.5,e),t.lineTo(n+.5,e+r)),o.borderRight||(t.moveTo(n+i-.5,e),t.lineTo(n+i-.5,e+r)),c&&!o.borderTop&&(t.moveTo(n,e+.5),t.lineTo(n+i,e+.5)),t.stroke(),u.borderBottomWidth&&!o.borderBottom&&(t.beginPath(),t.strokeStyle!==u.borderBottomColor&&(t.strokeStyle=u.borderBottomColor),t.moveTo(n+1,e+r-.5),t.lineTo(n+i,e+r-.5),t.stroke())):(t.beginPath(),(l=t.createLinearGradient(n,e,n+i-2,e)).addColorStop(0,u.borderTopColor),l.addColorStop(1,u.borderBottomColor),t.strokeStyle!==l&&(t.strokeStyle=l),o.borderTop||(t.moveTo(n,e+.5),t.lineTo(n+i,e+.5)),o.borderBottom||(t.moveTo(n,e+r-.5),t.lineTo(n+i,e+r-.5)),f&&!o.borderLeft&&(t.moveTo(n+.5,e),t.lineTo(n+.5,e+r)),t.stroke(),u.borderRightWidth&&!o.borderRight&&(t.beginPath(),t.strokeStyle!==u.borderRightColor&&(t.strokeStyle=u.borderRightColor),t.moveTo(n+i-.5,e+1),t.lineTo(n+i-.5,e+r),t.stroke()))},w.hn=function(t,n){var n,n=2===n?"active":4===n?"inactive":0===n?"disabled":"auto";(0,v.GC$)(t).css("ime-mode",n)},w.dn=function(t,n,e,i,r,o,a){var u,s,s,c,f;return!!(n&&"SparklineExValue"===n.typeName&&(s=(u=a.sheet)&&u.parent)&&(s=s.getSparklineEx(n.name)))&&(f={zoomFactor:c=nt(a)?a.printZoomFactor:u.zoom(),sheet:u,rowIndex:a.row,columnIndex:a.col},2===a.columnHeaderFitMode&&(r=u.getColumnWidth(a.col,a.sheetArea)+1),s.paint(t,n.value,e,i,r,o,f),!0)},w.xt={},w.Dt=function(t,n){var e,t,n,n,t,t;return t&&t.vn&&(t=(e=t.vn(n)).format(n))&&t[1]&&"decimalSeparator"===t[1].type?(n=t[2])&&n.type===b?(n=n.value,t=(t=t[3])&&"exponent"===t.type&&t.value&&-1<t.value.indexOf("E"),!W(n)&&t?n.length:5):0:5},w.gn=yt,x=w,u.Context=x,U={"\u2329":1,"\u232a":1,"\u27e8":1,"\u27e9":1,"\u276c":1,"\u276d":1,"\u2770":1,"\u2771":1,"\u3008":1,"\u3009":1,"\u23a1":1,"\u23a6":1,"\u300c":1,"\u300d":1,"\uff62":1,"\uff63":1,"(":1,")":1,"[":1,"]":1,"\uff3b":1,"\uff3d":1,"{":1,"}":1,"\u2774":1,"\u2775":1,"\ufe5b":1,"\ufe5c":1,"\uff5b":1,"\uff5d":1,"\u3016":1,"\u3017":1,"\u2772":1,"\u2773":1,"\u3014":1,"\u3015":1,"\ufe5d":1,"\ufe5e":1,"\u3010":1,"\u3011":1,"\u27ea":1,"\u27eb":1,"\u300a":1,"\u300b":1,"\u300e":1,"\u300f":1},f.prototype.Rge=function(t,n){var e;f.et(t.sheet,"beforePaintCellContent",{context:t,style:n})},f.prototype.pn=function(t,n,e,i){var t={ctx:t,options:{rect:n,context:e,value:i}};return f.et(e.sheet,"paintCellPadding",t),t.options.rect},f.prototype.bn=function(t,n,e){var n={context:t,options:{dom:n,cellRect:e,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)}};return f.et(t.sheet,"onCreateCellEditor",n),n.options.dom},f.prototype.yn=function(t,n,e){var n={ctx:null,options:{rect:n.clone(),context:t,value:null,style:e}};return f.et(t.sheet,"getCellButtonRect",n),n.options.rect},f.prototype.wn=function(t,n,e,i){var n={context:t,options:{dom:n,cellRect:e,cellStyle:i,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)}};return f.et(t.sheet,"onActivateCellEditor",n),n},f.prototype.Mn=function(t,n,e,i){var n={context:t,contentContainer:n,editorBounds:e,cellStyle:i,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)};return f.et(t.sheet,"onUpdateContainer",n),n},f.prototype.Cn=function(t,n,e){var n={context:t,options:{dom:n,cellRect:e,contentRect:e.clone(),leftExternalRect:new ht.Rect(0,0,0,0),rightExternalRect:new ht.Rect(0,0,0,0)}};return f.et(t.sheet,"onDeactivateCellEditor",n),n.options.dom},f.prototype.Sn=function(t,n,e){var i=this;i.deactivateEditor(t,n),i.Cn(n,t,e)},f.prototype.Tn=function(t,n,e,i){var r,o,a,u,i,u,o,i,o,u,s,r=e.labelOptions;r&&(o=i.sheet,a=e.watermark)&&(u=r.visibility,i=o.getText(i.row,i.col,i.sheetArea),1!==u)&&(2!==u&&u!==I||""!==i)&&(u=o.zoom(),i=void 0,i=(o=r.font)?dt.W.V(o,u):dt.W.Lge(e,1),o=Q(i.font),u=Rt(n,e),s=void 0,s=Et(e,n)?Ft(n,e,i,o):s)&&(t.save(),t.textAlign=Lt(r.alignment),t.textBaseline="alphabetic",vt(t,i.font),t.fillStyle=r.foreColor||e.foreColor||"grey",t.rect(u.x,u.y,u.width,u.height),t.clip(),t.beginPath(),t.fillText(a,s.x,s.y),t.restore())},f.prototype.An=function(t,n,e){var i,r,o,a,n,i=t.clone(),r=yt(n,0,!1,e),o=yt(n,1,!1,e),a=yt(n,2,!1,e),n=yt(n,3,!1,e);return 0<r&&(i.y+=r,i.height-=r),0<a&&(i.height-=a),0<n&&(i.x+=n,i.width-=n),0<o&&(i.width-=o),o+n>=t.width&&(i.width=0),r+a>=t.height&&(i.height=0),i},f.prototype.In=function(t,n,e,i){var r,o,r,r=this,o=nt(i)?i.printZoomFactor:i.sheet.zoom();return n=r.An(n,e,o),f.et(i.sheet,"getCellPaddingRect",r={ctx:t,options:{rect:n,context:i}}),r.options.rect},f.prototype.xn=function(t,n,e,i){var r,o,i,a,u,s,c,o,f,l,n,a,h,d,r=e.labelOptions;r&&(i=(o=i.sheet).getText(i.row,i.col,i.sheetArea),a=e.watermark,1!==(u=r.visibility))&&a&&(s=r.font||e.font||o.Dn.Nn(),1!==(c=o.zoom())&&(s=o.Dn._n(s)),o=Q(s),f=Et(e,n)?Bt(n,e):f)&&((l=(0,v.GC$)(ht.mt.En("span"))).text(a),n=(2===u||u===I)&&""===i,a=f.height-o,h=f.y+(n&&0<a?a:0),l.css({display:"block",position:"absolute",left:f.x,top:h,width:f.width,height:f.height,font:y(s),color:r.foreColor||e.foreColor||"grey",textAlign:Lt(r.alignment),overflow:"hidden",whiteSpace:"nowrap"}).attr("gcUIElement","gcEditorLabel"),(0,v.GC$)(t).append(l),n)&&(d=setInterval(function(){h--,l.css("top",h),h<=f.y&&clearInterval(d)},20))},f.prototype.jn=function(t){var n,e,i,r,i,n=this,e=ht.mt.En("div");return e.style.cssText="position: absolute; margin: 0;padding: 0 ;overflow: hidden; box-sizing: content-box;resize: none;outline: none;border: 2px #5292f7 solid;box-shadow: 1px 2px 5px rgba(0,0,0,0.4);background-color: white",(i=ht.mt.En("div")).style.cssText="position: absolute; outline: none; border: none",(0,v.GC$)(e).append((0,v.GC$)(i)),(r=n.createEditorElement(t,e))&&(0,v.GC$)(i).append((0,v.GC$)(r)),i=t.sheetArea,n.bn(t,e,t.sheet.getCellRect(t.row,t.col,1===i?-1:I,2===i?-1:I)),e},f.prototype.On=function(t,n,e,i){var r,e,e,o,a,u,e,s,o,c;t&&t.firstChild&&(r=this,jt(t,n,e=Ht(e),i),o=(e=r.wn(i,t,e,n)).options.contentRect,a=e.options.cellRect,u=e.options.leftExternalRect,e=e.options.rightExternalRect,r.xn&&r.xn(t,o,n,i),s=i.sheet.zoom(),o=it(o=r.An?r.An(o,n,s):o,u,e),c=t.firstChild,(0,v.GC$)(c).css({left:(+(0,v.GC$)(c).css("left").replace("px","")||0)+yt(n,3,!1,s),top:(+(0,v.GC$)(c).css("top").replace("px","")||0)+yt(n,0,!1,s)}),r.activateEditor(t.firstChild.firstChild,n,o,i,a,u,e))},f.prototype.updateEditorContainer=function(t,n,e,i,r,o,a){var n,t,n,u,s,t;t&&n&&(t=(n=t.parentNode)?n.parentNode:I)&&r&&(n=(0,v.GC$)(t),u=r.width,s=r.height,0<u&&(n.width(u),t=t.lastChild,e)&&"gcEditorLabel"===t.getAttribute("gcUIElement")&&(0,v.GC$)(t).width(u-yt(e,3,!0)-yt(e,1,!0)-2),0<s&&n.height(s),W(r.x)||n.css("left",r.x+"px"),W(r.y)||n.css("top",r.y+"px"))},f.prototype.Rn=function(t,n,e,i){var r,o,e,t,e,a,u,t,o,a,a,u,t,s,c,e,r=this,o=t.firstChild,e=Ht(e);jt(t,n,e,i),e=(t=r.Mn(i,o,e,n)).editorBounds,a=t.contentRect,u=t.leftExternalRect,t=t.rightExternalRect,o=o.firstChild,a=it(a=r.An?r.An(a,n,i.sheet.zoom()):a,u,t),a=r.updateEditor(o,n,a,i,e,u,t),u={width:u.width,height:u.height},t={width:t.width,height:t.height},c=!isNaN(a&&a.width)&&a.width+u.width+t.width>e.width?a.width+u.width+t.width:e.width,e=!isNaN(a&&a.height)&&a.height+u.height+t.height>e.height?a.height+u.height+t.height:e.height,r.updateEditorContainer(o,a,n,i,s={width:c,height:e},u,t)},f.prototype.Bn=function(t,n,e,i,r){return this.getCellAndPaddingHitInfo(t,n,e,i,r)},f.prototype.Ln=function(t,n,e,i,r){var o,t,o=Nt(r,e)+xt(r)+kt(r,e),t=this.getAutoFitWidth(t,n,e,i,r);return 0<t&&(o+=t+yt(e,3,!1)+yt(e,1,!1)),o},f.prototype.Fn=function(t,n,e,i,r){var o,t,o=0,t=this.getAutoFitHeight(t,n,e,i,r);return 0<t&&(o+=t+yt(e,0,!1)+yt(e,2,!1)),o=Math.max(Dt(r,e),o),Math.max(_t(r,e),o)},f.prototype.paintValue=function(t,n,e,i,r,o,a,u){var s,c,f,l,l,s=this,c={};u.quotePrefix=a.quotePrefix,(f=this.format(M(n),a.formatter||a._autoFormatter,c,u))&&(l=new ht.Rect(e,i,r,o),this.adjustRectForIconSet(a.hAlign,u.sheet,u.row,u.col,u.sheetArea,l,c.content&&this.hasInfilling(c.content)),e=l.x,r=l.width,l=s.Pn(t,f,a,u,e,i,r,o),this.paintText(t,n,e,i,r,o,a,u,f,c,I,l.externals))},f.prototype.Gn=function(t,n,e,i){var t=0<t?8*t*i:0;return t=n&&n.Un(e)?0:t},f.prototype.Ft=function(t,n){return!!(!t||o(t,tt)&&t===s||t&&t.formatString&&t.formatString()===s)||!(n&&(!isNaN(n)||"TRUE"===n.toUpperCase()||"FALSE"===n.toUpperCase())&&"@"!==t)},f.prototype.Hn=function(t){for(var n,e,n=0,e=0;e<t.length;e++)n+=t[e].width;return n},f.prototype.Fge=function(t){for(var n,t,e,i,r,o,a,n=t.left,t=t.right,e=0,i=n;e<i.length;e++)if((r=i[e]).isStick)return!0;for(o=0,a=t;o<a.length;o++)if((r=a[o]).isStick)return!0;return!1},f.prototype.zn=function(t){for(var n,e,n=0,e=0;e<t.length;e++)n+=t[e].height;return n},f.prototype.Vn=function(t,n,e,i,r){var o;f.et(n.sheet,"beforePaintLabel",{ctx:t,options:{rect:e,context:n,value:i,style:r}})},f.prototype.Pn=function(t,n,e,i,r,o,a,u){var t={ctx:t,text:n,rect:new ht.Rect(r,o,a,u),style:e,context:i,externals:{left:[],right:[]}};return f.et(i.sheet,"beforePaintText",t),on(t),t},f.prototype.Yn=function(t,n,e,i,r,o,a,u,s){var t={ctx:t,style:n,context:e,textRect:new ht.Rect(i,r,o,a),availRect:u};return f.et(e.sheet,s,t),en(s,t),t},f.prototype.Zn=function(t,n,e,i,r,o,a,u){return this.Yn(t,n,e,i,r,o,a,u,"beforeFillTextArea")},f.prototype.Wn=function(t,n,e,i,r,o,a,u){return this.Yn(t,n,e,i,r,o,a,u,"afterFillTextArea")},f.prototype.paintText=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,m,g,p,b,w,y,M,w,y,p,h=this;t.save(),t.beginPath(),d=a.textOrientation,v=a.textIndent&&0!==a.textIndent,m=a.hAlign,g=a.isVerticalText&&4!==m,4===m&&(d=0,v=!1),p=u.sheet,b=u.sheetArea,w=p.rowFilter&&p.rowFilter(),y=u.columnHeaderFitMode,!(M=!!(w&&w.rn(u.row,u.col,b)&&w.filterButtonVisible(u.col)))||y!==Z.ColumnHeaderFitMode.normal&&y!==Z.ColumnHeaderFitMode.vertical||(C(u.cornerX)||(r=u.cornerX-e),r-=p.an(new ht.Rect(e,i,r,o),b).width),w=a.wordWrap,y=a.shrinkToFit,p=a.showEllipsis,5===m&&(u.sheet.options.showFormulas&&u.isFormula?(a.hAlign=1,a.wordWrap=!1):a.wordWrap=!0,a.shrinkToFit=!1,a.showEllipsis=!1),n&&n.richText&&0<n.richText.length&&n.text===s||g?h.Qn(t,n,e,i,r,o,a,u,s,c,f,l):0!==d&&!W(d)&&-90<=d&&d<=90&&!v&&!g?h.Kn(t,n,e,i,r,o,a,u,s,c,f,l):h.Jn(t,n,e,i,r,o,a,u,s,c,f,l),5===m&&(a.hAlign=5,a.wordWrap=w,a.shrinkToFit=y,a.showEllipsis=p),t.restore()},f.prototype.Xn=function(t,n,e,i,r,o,a,u,s,c){for(var f,l,h,d,v,m,g,p,b,w,y,M,C,S,T,A,I,x,f=n.sheet,l=n.row,h=n.col,d=r.vAlign,v=n.sheetArea,m=0;m<e.length;m++)if(g=e[m].text,p=i[m].lineHeight,b=1===d?0:u,w=this.qn(t,"0"),y="",(M=o)-1-2-b<g.length*p){if(M<3*w)c.push(0),y=k;else if(C=mt((M-1-2-3*w-(1===d?0:u))/p),(S=0)===d){for(T=0;T<C;T++)y+=g[T];A=y.length,3*w+((y+=k).length-3)*p+u>M-1-2?(y=y.substring(0,y.length-4)+k,c.push(y.split(k)[0].length)):c.push(A)}else if(1===d){for(I=0;I<N(C/2);I++)y+=x=g.charAt(I),S=I;for(A=y.length,y+=k,I=N(g.length-C/2);I<g.length;I++)y+=x=g.charAt(I);3*w+(y.length-3)*p+u>M-1-2?(y=y.replace(g[S],""),c.push(y.split(k)[0].length)):c.push(A),s[m].y=a+(o-(3*w+(y.length-3)*p))/2}else{for(c.push(0),T=g.length-1;T>=g.length-C;T--)y=g[T]+y;3*w+((y=k+y).length-3)*p+u>M-1-2&&(y=y.replace(g[g.length-C],"")),s[m].y=a+o-u-(3*w+(y.length-3)*p)-2}e[m].textInfos[0].text=y,f.Ut.$n(l,h,g,v)}else f.Ut.$n(l,h,null,v)},f.prototype.Qn=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,m,g,p,b,w,y,M,C,w,S,v,m,T,l,v,A,I,m,T,x,N,k,p,C,_,D,h=this,d=new ht.Rect(e,i,r,o),v=u.sheet?u.sheet.zoom():1,m=u.printZoomFactor;if(m=nt(u)?m:j,g=h.Gn(a.textIndent,u.sheet.outlineColumn,u.col,m?m*v:v),p=u.cellOverflowLayout&&u.cellOverflowLayout.expandedWidth,b=a.hAlign,w=a.formatter||a._autoFormatter,3===b&&(b=Mt(b,n,w)),M=!!(y=a.isVerticalText&&4!==b)&&J(s),C=a.font,w=h.Ft(w,n.text),S=F(!0,[],h.Pt(n,s,w,C,a.foreColor)),(0,ht.resetFillStyle)(t,u.sheet,a,f),n&&n.richText&&0<n.richText.length&&h.te(S,C,v,m),m=v=0,l&&(v=h.Hn(l.left),m=h.Hn(l.right),T=h.Fge(l)),l=v+m,v={left:v,right:m,isStick:T},!a.wordWrap&&a.shrinkToFit&&(4===a.hAlign?h.ne(S,p-l,o,a,C,1,y):h.ne(S,r-l,o,a,C,1,y)),A=h.ee(t,s,a.font,y?o:r-l,g,y?a.vAlign:a.hAlign,a.wordWrap,y,S),I=h.re(A,a,b,f),m=h.oe(t,a,e,i,r,o,a.wordWrap,u.cellOverflowLayout,b,g,y,A[0].textLength,I[0].lineHeight,u.clipRect),T=!1,a.showEllipsis&&y&&!n.richText&&(T=!0),x=[],x=4===b?h.ae(e,i,u.cellOverflowLayout.expandedWidth,o,b,a.vAlign,g,y,M,A,I,v,T,a):h.ae(e,i,r,o,b,a.vAlign,g,y,M,A,I,v,T,a),N=A.length,k=[],T&&c&&(c.content&&1===c.content.length&&"text"===c.content[0].type||!c.content&&1===A.length&&A[0].text)&&this.Xn(t,u,A,I,a,o,i,g,x,k),1===N&&c&&!w)h.ue(t,u.sheet,s,c,x[0].x,x[0].y,r,o,b,a,m.width,m.height,g,y,A[0].textLength,u,v,d);else{for(p=h.se(A),C=x[0].x,t.textAlign===q?C-=p/2:t.textAlign===X&&(C-=p),h.Zn(t,a,u,x[0].x,x[0].y,p,0,d),_=r-l-4-2*g,D=0;D<N;D++)h.ce(t,u.sheet,x[D].x,x[D].y,I[D],b,A[D],k[D],_);h.Zn(t,a,u,C,x[0].x,p,0,d)}},f.prototype.se=function(t){for(var n,e,n=t[0].textLength,e=0;e<t.length;e++)n=wt(n,t[e].textLength);return n},f.prototype.qn=z,f.prototype.fe=function(t,n,e,i,r,o,a){var u,s,e,c,f,t,l,h,r,d,v,m,g,p,b,w,y,M,C,S,C,s=t.sheetArea,u=e,e=this.qn(i,u),c=t.sheet,f=t.row,t=t.col,l=r,h=0,r=this.qn(i,"0"),d;if(h=this.qn(i,k),l-1-2-(v=1===o?0:a)<e){if(m="",2===o)for(g=u.length-1;0<=g;g--){if(l-1-2-a<h){p=m.length,m=k+m.substring(1,p);break}m=(b=u.charAt(g))+m,h+=w=this.qn(i,b)}else if(1===o){for(y=N((l-h)/r),g=0;g<y/2;g++)m+=b=u.charAt(g);for(m+=k,g=mt(u.length-y/2);g<u.length;g++)m+=b=u.charAt(g);for(M=this.qn(i,m);l-1-2<M&&m!==k;)S=(C=m.split(k))[0],C=C[1],m=S.length>C.length?S.substring(0,S.length-1)+k+C:S+k+C.substring(1,C.length),M=this.qn(i,m)}else for(g=0;g<u.length;g++){if(l-1-2-a<h){p=m.length,m=m.substring(0,p-1)+k;break}m+=b=u.charAt(g),h+=w=this.qn(i,b)}n.content=[{value:m,type:"text"}],c.Ut.$n(f,t,u,s)}},f.prototype.Jn=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,m,g,p,b,L,w,y,M,C,F,S,T,A,I,B,P,x,N,f,v,f,k,_,G,l,U,H,V,D,z,_,A,b,Y,k,w,b,p,k,v,b,j,p,O,m,E,R,R,E,o,f,n,_,R,E,m,h=this,d=0,v=a.textIndent,m=a.wordWrap,g=a.hAlign,p=a.vAlign,b=a.shrinkToFit,L=a.textDecoration,w="left",y=2,M=2,C=a.font,F=0,S=[],T=0,A=u.sheet,I=new ht.Rect(e,i,r,o),B=u.cellOverflowLayout&&u.cellOverflowLayout.expandedWidth,P=u.offsetX;if(P=P||0,4===g&&(v=0),W(u.fontInfo)&&(u.fontInfo=dt.W.Lge(a,A.zoom()),nt(u))&&(u.fontInfo=dt.W.V(u.fontInfo.font,u.printZoomFactor)),x=parseInt(u.fontInfo.fontSize,10),W(u.lineHeight)&&(u.lineHeight=Q(dt.W.Lge(a,A.zoom()).font,!1,J(s))),N=u.lineHeight,(0,ht.resetFillStyle)(t,A,a,f),f=A.zoom()||1,nt(u)&&(f*=u.printZoomFactor),0<v&&(d=8*v*f),A.outlineColumn&&A.outlineColumn.Un(u.col)&&(d=0),3===g&&(g=Mt(g,n,a.formatter||a._autoFormatter)),v=1,vt(t,C),k=f=0,l&&(f=h.Hn(l.left),k=h.Hn(l.right),_=h.Fge(l)),G=f+k,l={left:f,right:k,isStick:_},!m&&b){for(H={value:!1},V=void(U=0),D=0;D<3&&!1===H.value&&(z=t.measureText(s).width,U=wt(0,r-4-(1===g?0:d)-G),(U=4===g?wt(0,B-4-d-G):U)<z);D++)C=(V=dt.W.V(C,U/z,H,!0)).font,vt(t,C);V&&(v=x/V.fontSize,x=V.fontSize)}if(_=(_=A.parent&&A.parent.options.numbersFitMode===Z.NumbersFitMode.overflow||!1)||(c&&c.content?!(!c.content||1!==c.content.length||"text"!==c.content[0].type):"string"==typeof n&&n===s),!m&&!b&&a.showEllipsis&&_&&this.fe(u,c,s,t,r,g,d),y+=d+f,1===g||4===g||5===g?(y=(r+f-k)/2,w=q):2===g&&(y=r-k-1-2,w=X,y=ot(a,y-=d)),t.textAlign!==w&&(t.textAlign=w),A=0,m&&(A=r-G-(b=at(a,3))-(1===g||5===g?2*d:d),4===g&&(A=B-G-b-d),--A,1<(T=(S=u.isPrinting?ht.q.un(s,A,C,!1,t):rt(s,A,C,!1,t)).length))&&0!==p&&(F=(T-1)*N),M=(M+(N-(k=N/2-x/2+(Y=8<x?mt((x-8)/5+2):1)-1)))/v,1===p?M=(o-F)/2+N/2-k:2===p&&(M=o-(F+2+k)/v),t.textBaseline!==$&&(t.textBaseline=$),p=Tt(b=(w=u.cellOverflowLayout)&&w.layout,e,i,r,o,u.clipRect))if(w&&4===g&&(y+=(w.expandedWidth-r)/2),y+=P,k=b&&b.width>r||4===g,v=p.x,b=p.y,j=p.width,p=p.height,m)if(t.rect(v,b,j,p),t.clip(),t.beginPath(),O=i+M,1<T||5===g)if(m=e+y,t.textAlign===q?m-=A/2:t.textAlign===X&&(m-=A),R=O,(E=gn(S,N,a)).descenderHeight&&(R+=E.descenderHeight),u.textRect=new ht.Rect(m,St(R+(S.length-1)*N,i+o),A,St(E.height,o)),5===g)R=y,E=2+d+f+P,!_&&!et(a.formatter)&&typeof a.formatter===tt&&"object"!=typeof n||_&&1===T&&!h.Bge(S[0])?h.he(t,s,c,e+R,i+M,1,j,d,L,Y,x,u,a,l,I,k):(h.Zn(t,a,u,m,O,A,N*T,I),h.Pge(t,S,e,O,A,R,E,N,a,x,Y),h.Wn(t,a,u,m,O,A,N*T,I));else{for(h.Zn(t,a,u,m,O,A,N*T,I),D=0;D<T;D++)t.fillText(S[D],e+y,O),L&&(z=t.measureText(S[D]).width,h.le(t,L,e+y,O,z,x,Y)),O+=N;h.Wn(t,a,u,m,O,A,N*T,I)}else h.he(t,s,c,e+y,i+M,g,j,d,L,Y,x,u,a,l,I,k);else f=j-(e+1-v)<(o=K(t,t.font,s)+G)||p<N||0!==P,4===g&&(f=!0),n=yt(a,0),_=yt(a,1),R=yt(a,2),E=yt(a,3),f||(1===g||4===g?w&&((m=o/2)>w.backgroundLeftWidth||m>w.backgroundRightWidth)&&(f=!0):(j<o+d+n+R||p<F+E+_)&&(f=!0)),f&&(t.rect(v,b,j,p),t.clip(),t.beginPath()),h.he(t,s,c,e+y,i+M,g,j,d,L,Y,x,u,a,l,I,k)},f.prototype.Bge=function(t){var t=ht.q.Gge(t);return 1<t.length||1===t.length&&0<t[0].prefixSpaceCount},f.prototype.Pge=function(t,n,e,i,r,o,a,u,s,c,f){for(var l,h,d,v,m,g,p,b,w,y,w,M,C,S,T,T,l=n.length,h=i,d=s.textDecoration,v=this,m=r,g=0;g<l;g++){if(p=n[g]){if(1===(b=ht.q.Gge(p)).length)t.textAlign=q,t.fillText(p,e+o,h),d&&(w=t.measureText(p).width,v.le(t,d,e+o,h,w,c,f));else for(t.textAlign=A,y=t.measureText(" ").width,w=t.measureText(p).width,M=e+a,(C=0)<b[0].prefixSpaceCount?M+=C=(m-w)/b.length:C=(m-w)/(b.length-1),S=0;S<b.length;S++)M+=(T=b[S]).prefixSpaceCount*y,t.fillText(T.word,M,h),T=t.measureText(T.word).width,d&&v.le(t,d,M,h,T,c,f),M+=T+C}h+=u}},f.prototype.Kn=function(t,L,F,n,e,i,r,o,a,u,B,P){var G,s,c,f,U,H,V,l,h,d,z,v,m,g,Y,p,Z,b,W,w,w,y,M,Q,C,J,S,T,A,I,w,K,X,x,w,N,k,q,$,_,D,j,tt,nt,O,et,it,rt,ot,at,E,R,ut,st,ct,ft,lt,u,B,L,P,H,J,U,c,s=this,c=r.wordWrap,f=r.hAlign,U=r.vAlign,H=r.shrinkToFit,V=r.textDecoration,l=2,h=2,d=r.font,z=[],v=0,p=parseInt(o.fontInfo.fontSize,10),Z=o.sheet,W=new ht.Rect(F,n,e,i),w=o.cellOverflowLayout,w=w&&w.layout,y=r&&(r.borderLeft||r.borderTop||r.borderRight||r.borderBottom)&&!Z.getSpan(o.row,o.col,o.sheetArea),M=r.textOrientation,Q=M*Math.PI/180,C=bt(Q),J=pt(C),S=gt(C),T=Ct(C),A=o.lineHeight,I=90===M||-90===M;if(y&&(-90<M&&M<0&&(b=!1),0<M)&&M<90&&(b=!0),w=Tt(w,F,n,e,i,o.clipRect)){if(K=w.x,X=w.y,x=w.width,w=w.height,N=A/2*gt(C),k=A/2*pt(C),$=A/2-p/2+(q=8<p?mt((p-8)/5+2):1)-1,u&&u.content&&0<u.content.length&&!H&&(a=s.de(t,u.content,i-4,d)),_=Z.Qt(a,d),(0,ht.resetFillStyle)(t,Z,r,B),3===f&&(f=Mt(f,L,r.formatter||r._autoFormatter,M)),vt(t,d),j=D=0,P&&(D=s.Hn(P.left),j=s.Hn(P.right)),!c&&H)for(nt={value:!1},O=tt=0;O<3&&!1===nt.value&&(tt=wt(0,(i-4-2*k)/S))<_;O++)d=dt.W.V(d,tt/_,nt,!0).font,vt(t,d),p=null!=(G=r.Uge)?G:parseInt(o.fontInfo.fontSize,10),_=Z.Qt(a,d),N=(A=ht.mt.vt(d))/2*gt(C),k=A/2*pt(C);if(it=et=0,c)for(v=(z=ht.q.un(a,it=(i-4-2*k)/S,d,!1,t)).length,_=Z.Qt(z[0],d),rt=0;rt<v;rt++)et<(ot=Z.Qt(z[rt],d))&&(et=ot);switch(m=_/2*J,g=(c?et:_)/2*S,5===f&&(M<0&&(f=2,I)&&1===v&&(j=(x-A)/2),0<M&&(f=0,I)&&1===v&&(D=(x-A)/2),I)&&1<v&&(A=(x-A)/(v-1))<o.lineHeight&&(A=o.lineHeight),at=""+f+(U=i<=(Y=(c?et:_)*S+2*k)?2:U)){case"00":l+=m+N+D,h+=g,I||(h+=k),y&&(l=(i-h)/T*(b?1:-1)+(A/2+2)/S+D);break;case"01":l+=m+N+D,h=i/2,y&&(l=(i-h)/T*(b?1:-1)+(A/2+2)/S+D);break;case"02":l+=m+N+D,h+=g,I||(h+=k),y&&(l=h/T*(b?1:-1)+(A/2+2)/S+D),h=i-h;break;case"10":l=(e+D-j)/2,h+=g,I||(h+=k),y&&(l+=(b?1:-1)*(i-h)/T);break;case"11":l=(e+D-j)/2,h=i/2,y&&(l+=(b?1:-1)*(i-h)/T);break;case"12":l=(e+D-j)/2,h+=g,I||(h+=k),y&&(l+=(b?1:-1)*h/T),h=i-h;break;case"20":l=e-2-m-N-j,h+=g,I||(h+=k),y&&(l=e+(i-h)/T*(b?1:-1)-(A/2+2)/S-j);break;case"21":l=e-2-m-N-j,h=i/2,y&&(l=e+(i-h)/T*(b?1:-1)-(A/2+2)/S-j);break;case"22":l=e-2-m-N-j,h+=g,I||(h+=k),y&&(l=e+h/T*(b?1:-1)-(A/2+2)/S-j),h=i-h}if(c)if(E=F+l,R=A/S,ut=void 0,90===Math.abs(M)&&(ft=x<_*v+(st=yt(r,1))+(ct=yt(r,3)))&&(t.rect(K,X,x,w),t.clip()),1<v){for(1===f&&(E-=(lt=v%2!=0)?R*(v-1)/2:v/2*R-.5*R),B=(u=zt(E,n+h,_,Q,A)).width+R*(v-1),L=u.height,P=u.y,H=u.x-R*(v-1),o.textRect=new ht.Rect(H,St(n+2*h,W.y+W.height),B,2*h-A/2),s.Zn(t,r,o,H,P,B,L,W),O=0;O<v;O++)ut=O,(0<r.textOrientation&&2===f||r.textOrientation<0&&(0===f||1===f))&&(ut=v-O-1),s.ve(t,Q,z[ut],E,n+h,V,p,q,$),E=2===f?E-R:E+R;s.Zn(t,r,o,H,P,B,L,W)}else s.me(t,a,F,n,l,h,o,r,_,Q,V,p,q,A,$,W);else J=_*S+p*S+2,U=yt(r,0),c=yt(r,2),(ft=w-(n+1-X)<J||w<A||w<J+U+c)&&(t.rect(K,X,x,w),t.clip()),s.me(t,a,F,n,l,h,o,r,_,Q,V,p,q,A,$,W)}},f.prototype.me=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d,v,m){var g,p,b,w,y,p,M,g=this,p=zt(e,i,s,c,d),b=p.width,w=p.height,y=p.x,p=p.y;(dt.W.Hge(u)||dt.W.Vge(u))&&(M=bt(c),y=e+r-(b=s*pt(M)+d*gt(M))/2,p=i+o-(w=s*gt(M)+d*pt(M))/2),a.textRect=new ht.Rect(y,St(p+w,m.height+m.y),b,w),g.Zn(t,u,a,y,p,b,w,m),g.ve(t,c,n,e+r,i+o,f,l,h,v),g.Wn(t,u,a,y,p,b,w,m)},f.prototype.te=function(t,n,e,i){Vt(t,n,e,i)},f.prototype.ne=function(t,n,e,i,r,o,a){for(var u,s,c,f,l,u=0,s={value:!1},c=0;c<3&&!1===s.value&&(f=ct(t,r,o,a),u=wt(0,(a?e:n)-4),(u=(a?i.vAlign:1!==i.hAlign&&i.textIndent)?wt(0,u-8*i.textIndent*o):u)<f);c++)for(l=0;l<t.length;l++)t[l].style.font=dt.W.V(t[l].style.font,u/f,s,!0).font},f.prototype.Pt=function(t,n,e,i,r){var t=t.richText;return t=!W(t)&&e?t:[{style:{font:i,foreColor:r},text:n}]},f.prototype.oe=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d){var v,r,o,d,m,g,p,v,r=Tt(u&&u.layout,e,i,r,o,d);if(r)return o=r.x,d=r.y,m=r.width,g=r.height,(a||(p=this.ge(n,s,n.vAlign,e,i,g,m,o,d,l,h,c,f,u)))&&(t.rect(o,d,m,g),t.clip(),t.beginPath()),r},f.prototype.ge=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d){var v,m,g,p,t,h,m=yt(t,0),g=yt(t,1),p=yt(t,2),t=yt(t,3);return h?(!(v=o-(r+1-s)<c||a<f)&&1!==e&&o<c+l+m+p||a<f+t+g)&&(v=!0):(v=a-(i+1-u)<c||o<f)||(1===n?d&&((h=c/2)>d.backgroundLeftWidth||h>d.backgroundRightWidth)&&(v=!0):(a<c+l+t+g||o<f+m+p)&&(v=!0)),v},f.prototype.ee=function(t,n,e,i,r,o,a,u,s){var c,f,l,h,h;if(i=1===o||5===o?i-3-2*r:i-3-r,a)return ht.q.Ht(n,i,e,s,u,t);for(f=c=0;f<s.length;f++)l=s[f].text,u?c+=Q(s[f].style.font)*(l?l.length:0):(h=dt.W.V(s[f].style.font,1),h=s[f].style.vertAlign?h.fontSize*D+"px "+h.fontFamily:s[f].style.font,c+=K(t,h,l));return[{textLength:c,text:n,textInfos:s}]},f.prototype.ue=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d,v,m,g,p){var b,w,y,b=dt.W.Lge(c,1).fontSize,w=8<b?mt((b-8)/5+2):1;this.pe(t,n,c),d?this.be(t,e,i,c,r,o,l,h,l,m,g,p):this.he(t,e,i,r,o,s,f,h,c.textDecoration,w,b,m,c,g,p,y=a<f,v)},f.prototype.be=function(t,n,e,i,r,o,a,u,s,c,f,l){var h,d,v,m,g,p,b,w,h=this,d=e.content,m=o;if(c.textRect=new ht.Rect(r,m,s,pn(t,n,e,r,o,a,u,s)-m),h.Zn(t,i,c,r,m,s,s*n.length,l),d&&0<d.length)for(p=0<(p=a-u-(g=Pt(t,d,!0))-2)?p:0,b=void 0,v=0;v<d.length;v++)"fillingChar"===d[v].type?(w=Ut(t,p,d[v].value,!0),this.ye(t,w,r,o),o+=p):"placeholder"===d[v].type?o+=d[v].value?d[v].value.length*s:0:"numberPlaceholder"===d[v].type?o+=s:(this.ye(t,d[v].value,r,o),o+=b=d[v].value?d[v].value.length*s:0);else if(n)for(v=0;v<n.length;v++)o=this.ye(t,n[v],r,o,s).y;h.Wn(t,i,c,r,m,s,o-m,l)},f.prototype.we=function(t){var n=A;return 1===t?n=q:2===t&&(n=X),n},f.prototype.ce=function(t,n,e,i,r,o,a,u,s){for(var c,f,l,h,d,c=[],f=a.textInfos,l=0;l<f.length;l++)c.push(F(!0,{},r,f[l].style));for(h=0,!r.isVerticalText&&5===o&&1<a.textInfos.length&&a.text.includes(" ")&&s&&(h=(s-a.textLength)/(a.textInfos.length-1))<0&&(h=0),l=0;l<f.length;l++)e=(d=this.Me(t,n,e,i,c[l],f[l].text,u)).x+h,i=d.y},f.prototype.re=function(t,n,e,i){for(var r,o,a,u,r=[],o=t.length,a=0;a<o;a++)u=this.Ce(n,e,i,t[a].textInfos),r.push(u);return r},f.prototype.Ce=function(t,n,e,i){var r,o,a,u,s,c,f,r=this,o=0,a=0;if(i)for(u=0;u<i.length;u++)s=void 0,s=(i[u].style&&i[u].style.font&&i[u].text?i[u].style:t).font,o=Math.max(Q(s,I,J(i[u].text)),o),a=Math.max(dt.W.V(s,1).fontSize,a),(i[u].style&&1===i[u].style.vertAlign||2===i[u].style.vertAlign)&&(o=Math.max(Q(s,I,J(i[u].text))+2*dt.W.V(s,D).fontSize*.218,o));return{lineHeight:o,fontSize:a,baselineOffset:c=8<a?mt((a-8)/5+2):1,lineOffset:f=o/2-a/2+c-1,font:t.font,foreColor:t.foreColor,textDecoration:t.textDecoration,isVerticalText:t.isVerticalText,textAlign:r.we(n),textBaseline:$,opacity:e}},f.prototype.Se=function(t,n,e){for(var i=0,r=0,o,o=0;o<t.length;o++)r+=n[o].lineHeight,i=Math.max(t[o].textLength,i);return{width:e?r:i,height:e?i:r}},f.prototype.ae=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d){var v,m,g,p,b,w,y,v,v=this.Se(c,f,u),m=v.height,g=v.width,p=[];if(u)for(y=0,5===(w=r)&&(1===c.length?w=1:(w=0,g<(v=e-4-l.left-l.right)&&(y=(v-g)/(c.length-1)))),b=0;b<c.length;b++)p.push(this.Te(t,n,e,i,w,o,a,g,c[b].textLength,f[b].lineHeight,f[b].lineOffset,s,l,c[b],h,d)),s?t-=f[b].lineHeight+y:t+=f[b].lineHeight+y;else for(b=0;b<c.length;b++)5===(w=r)&&(w=c[b].text.includes(" ")?0:1),p.push(this.Ae(t,n,e,i,w,o,a,c[b].textLength,m,f[b].lineHeight,f[b].lineOffset,l,d)),n+=f[b].lineHeight;return p},f.prototype.Ae=function(t,n,e,i,r,o,a,u,s,c,f,l,h){var d,v,m,l,d=0,v=0,m=l.left,l=l.right;return v=1===o?(i-s)/2+c-f:2===o?i-s-2+c-f:2+c-f,1===r||4===r?d=(e-u+m-l)/2:2===r?(d=ot(h,d=e-1-2-u-l),d-=a):d=2+a+m,{x:t+d,y:n+v}},f.prototype.Te=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d,v,m){var g,p,b,w,h,g=0,p=0,w=h.left,h=h.right;return l?0===r?g=2+u+h-c/2:1===r?g=(e-w+h+u)/2-c/2:2===r&&(g=ot(m,g=e-w-1-2-c/2)):1===r?g=(e-u+w-h)/2+c/2:2===r?g=ot(m,g=e-1-2-h-u+c/2):0===r&&(g=2+w+c/2),{x:t+g,y:n+(p=1===o?(i-s)/2:2===o?i-a-s-2:2+a)}},f.prototype.Me=function(t,n,e,i,r,o,a){var n,a;return t.save(),this.pe(t,n,r),n=r.vertAlign,a=r.isVerticalText?this.ye(t,o,e,i,r.textDecoration,r.baselineOffset,a):this.Ie(t,e,i,r,o,n),t.restore(),a},f.prototype.pe=function(t,n,e){(0,ht.resetFillStyle)(t,n,e);var n=e.vertAlign?this.xe(e.font):e.font;W(e.textBaseline)||t.textBaseline===e.textBaseline?W(t.textBaseline)&&t.textBaseline!==$&&(t.textBaseline=$):t.textBaseline=e.textBaseline,e.isVerticalText?t.textAlign!==q&&(t.textAlign=q):t.textAlign!==A&&(t.textAlign=A),vt(t,n)},f.prototype.xe=function(t){var t,n,t=dt.W.Ne(t),n=parseFloat(t.fontSize)*D;return t.fontSize=n+"px",this.ke(t)},f.prototype.ke=function(t){var n,e,i,r,o,a,t,n="",e="normal",i,r=t.fontStyle,o=t.fontSize,a=t.fontWeight,t=t.fontFamily;return n=void 0!==r?r:e,n=(n=(n+=void 0!==a?(n?" ":"")+a:(n?" ":"")+e)+((n?" ":"")+o))+(void 0!==t?(n?" ":"")+t:(n?" ":"")+"Calibri")},f.prototype.OCe=function(t,n,e,i,r,o){n.save(),n.translate(e+o-r/2,i+o-r/2),n.rotate(Math.PI/2),n.fillText(t,0,0),n.restore()},f.prototype.ye=function(t,n,e,i,r,o,a){var u,s,c,f,l,h,d,v,m,g,m;if(n&&0<n.length)for(u=this,s=t.font,c=Q(s,I,J(n)),f=Y(dt.W.V(s,1).fontSize,c),h=(l=u.qn(t,"0"))/2,d=0;d<n.length;d++)v=n[d],i=i+(g=(m=void 0!==a&&a<=d&&d<=a+2&&(a+3===n.length||0===a&&a+3<n.length||0!==a&&a+3<n.length))?l:c)-(m=m?h:f),U[v]?u.OCe(v,t,e,i,c,f):t.fillText(v,e,i),this.De(t,r,e,i,K(t,t.font,v),dt.W.V(t.font,1).fontSize,o),i+=m;return{x:e,y:i}},f.prototype.De=function(t,n,e,i,r,o,a){var u,s,c,f,s;t.strokeStyle!==t.fillStyle&&(t.strokeStyle=t.fillStyle),s=u=0,c=.5,s=mt(((f=o<=1