@grapecity/spread-sheets
Version:
A Complete Microsoft Excel-like JavaScript Spreadsheet for Enterprise Applications
10 lines • 5.08 MB
JavaScript
/*!
*
* SpreadJS Library 18.2.4
*
* Copyright(c) of respective holders. All rights reserved.
*
* Licensed under the SpreadJS Commercial License.
*
*/
var GC;!function(){var t,n={"./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.Components=e("./dist/plugins/components/index.js"),GC.Spread.Sheets.InputMask=e("./dist/plugins/inputMask/inputMask.entry.js"),GC.Spread.Sheets.Spacing=e("./dist/plugins/spacing/spacing.entry.js"),GC.Spread.Sheets.DataRange=e("./dist/plugins/dataRange/dataRange.entry.js"),t.exports=GC.Spread},"./dist/core/celltype/basecelltype.js":function(t,n,e){"use strict";var i,r,o,a,u,s,c,f,l,h,d,v,p,g,m,b,y,w,M,C,S,T,x,A,I,k,N,j,D,_,O,E,R,L,F,B,P,G,U,H,V,z,Y,Z,W,Q,K,J,X,q,$,tt,nt,et,it,rt,ot,at,ut;function st(t){var n=t.isPrinting,e=t.printZoomFactor;return n&&typeof e===L&&1!==e}function ct(t){var n;return!(t instanceof CanvasRenderingContext2D)&&!I(t._ae)}function ft(t,n){var e=0,i=t.font+n,r=!ct(t);return r&&J[i]?e=J[i]:(e=T(t,t.font,n),r&&(J[i]=e)),e}function lt(t,n){var e;return n/2-t/2+(t>8?P((t-8)/5+2):1)-1}function ht(t,n){var e=(0,c.rotatedCharsForVertical)(),i=e[t]&&e[t][n];return p(i)&&(i=ot[n]),i}function dt(t,n,e){return p(t.x)||(t.x+=n.width),t.width=t.width-n.width-e.width,t}function vt(t,e,i,r,a){var u,s=i+" - "+e+" - "+t;return n.wordWrapInfoCache||(n.wordWrapInfoCache={}),u=2e3,I(n.clearCacheTimer)&&(n.clearCacheTimer=setTimeout((function(){n.wordWrapInfoCache=null,n.clearCacheTimer=null}),u)),n.wordWrapInfoCache[s]||(n.wordWrapInfoCache[s]=o.q.un(t,e,i,!1,a)),n.wordWrapInfoCache[s]}function pt(t,n){return a.W.gfe(t,s.IconPosition.left)&&(n+=1),a.W.gfe(t,s.IconPosition.right)&&(n+=2),n}function gt(t,n){return a.W.gfe(t,s.IconPosition.left)&&(n-=1),a.W.gfe(t,s.IconPosition.right)&&(n-=2),n}function mt(t,n,e){var i=t.text;return e&&(i=(0,o.W3e)(i)),i===n}function bt(t){return!!t&&(o.util.Yf(t)||o.util.Hcr(t))}function yt(t,n){var e="inherit";return n&&"="!==n[0]&&(t===s.TextDirectionType.rightToLeft||t===s.TextDirectionType.context&&bt(n))&&(e="rtl"),e}function wt(t,n,e,i){var r,o=t.conditionalFormats;if(o)return r=t.getValue(n,e,i),o.O(n,e,i)&&o.U(t,n,e,r,i).iconSet}function Mt(t,n,e){var i,r,o=0;for(i=0;i<t.length;i++)r=void 0,r=t[i].style&&t[i].style.font?t[i].style.font:n,o=Math.max(b(r,t[i].text)/e,o),(t[i].style&&1===t[i].style.vertAlign||2===t[i].style.vertAlign)&&(o=Math.max(b(r,t[i].text)/e+2*a.W.V(r,K).fontSize*.218,o));return o}function Ct(t,n,e,i,r){var u,s,c,f,l,h=o.q.J();if(!h)return 0;for(u=0,s=0;s<t.length;s++)c=void 0,c=t[s].style&&t[s].style.font?t[s].style.font:n,t[s].style&&t[s].style.vertAlign&&(c=a.W.V(c,K).font),M(h,c),f="",f=s===t.length-1&&r?o.q.tt(t[s].text):t[s].text,l=0,i?l=b(c,f)*f.length/e:p(t[s].text)||(l=T(h,c,t[s].text)/e),u+=l;return u}function St(t,n,e,i,r){var a,u,s=o.q.J();if(!s)return 0;for(a=0,u=0;u<t.length;u++)a+=Ct(t[u],n,e,i,r);return a}function Tt(t,n,e,i,r,o,u,s,c){var f,l,h,d,v,p,g,m,b=u.backColor,y=u.backgroundImage,w=u.isVerticalText,M=u.textIndent&&0!==u.textIndent,C=u.backgroundImageLayout,S=c.row,T=c.col,x=c.sheet,A=x.Jt,I=c.sheet&&c.sheet.getSpan(S,T,c.sheetArea),k=u&&(u.borderLeft||u.borderTop||u.borderRight||u.borderBottom),N=0,j=n,D=x.options.rightToLeft&&z(u.textOrientation)<90?-u.textOrientation:u.textOrientation;t.save(),T+1<x.getColumnCount()&&(v=A.qt(S,T+1)),T-1>=0&&(p=A.qt(S,T-1)),g=function(t){return t!==B&&t&&-90<=t&&t<=90},m=function(){t.fillRect(n,e,i,r)},D&&0!==D&&k&&s&&!I&&!w&&!M&&(f=z(D*Math.PI/180),l=V(f),N=P(r/l),D>-90&&D<0&&(v&&!g(v.textOrientation)&&(d=v.backColor),j=n-N),D>0&&D<90&&(p&&!g(p.textOrientation)&&(d=p.backColor),j=n+N),h=function(){t.beginPath(),t.moveTo(j,e),t.lineTo(j+i,e),t.lineTo(n+i,e+r),t.lineTo(n,e+r),t.fill()}),b&&(d&&a.W.setFillStyle(t,d,n,e,i,r,m),h?a.W.setFillStyle(t,b,Math.min(j,n),e,i+N,r,h):b!==c.parentBackColor&&a.W.setFillStyle(t,b,n,e,i,r,m)),it.nt(t,n,e,i,r,y,C,o),t.restore()}function xt(t,n,e,i,r,o,a){if((0===t||5===t||a)&&wt(n,e,i,r)){var u=At(n);o.x+=u,o.width-=u}}function At(t){return parseInt(E*t.zoom(),10)}function It(t,n,e,i){var r=t.cellPadding,o=0,a=t.labelOptions;return e&&(r=a?a.margin:"0"),r&&(o=typeof(o=parseInt(Rt(r)[n],10))===L&&o>0?o:0),i===B?o:o*i}function kt(t){var n={context:t,value:0};return ut.et(t.sheet,"getOutlineColumnOffset",n),n.value}function Nt(t,n){var e={context:t,value:0,cellStyle:n};return ut.et(t.sheet,"getCellButtonAutoWidth",e),e.value}function jt(t,n){var e={context:t,value:0,cellStyle:n};return gn(e),ut.et(t.sheet,"getSpecialIconsAutoWidth",e),e.value}function Dt(t,n){var e={context:t,value:0,cellStyle:n};return ut.et(t.sheet,"getCellButtonAutoHeight",e),e.value}function _t(t,n){var e={context:t,value:0,cellStyle:n};return mn(e),ut.et(t.sheet,"getSpecialIconsAutoHeight",e),e.value}function Ot(t,n){var e,i,r,o,a=n&&n.sheet;if(a&&t)return e=n.canvasOffset||a.rt.it(),i=a.ot(),{top:r=e.top+i.y+t.y-2,left:o=e.left+i.x+t.x-2}}function Et(t,n,e,i){var o,a,u,s,c,f=i&&i.sheet;f&&e&&(a=(o=Ot(e,i)).left,u=o.top,(s=n.backColor||"white").stops&&(s=(c=s.stops)[0]&&c[0].color),s.backgroundColor&&(s=s.backgroundColor),(0,r.GC$)(t).width(e.width).height(e.height).css({top:u,left:a,"background-color":s}))}function Rt(t){var n,e,i,r,o=["0","0","0","0"];return typeof t===R&&(i=void 0,r=void 0,1===(e=(n=t.split(" ",4)).length)?o=[i=n[0],i,i,i]:2===e?o=[i=n[0],r=n[1],i,r]:3===e?(r=n[1],o=[n[0],r,n[2],r]):4===e&&(o=[n[0],n[1],n[2],n[3]])),o}function Lt(t,n){var e,i=It(t,0),r=It(t,2),o=It(t,0,!0),a=It(t,2,!0);if(It(t,3,!0)+It(t,1,!0)>=n.width)return!1;if((e=t.labelOptions.alignment)===B&&(e=t.labelOptions.alignment=0),0===e||1===e||2===e){if(i>0&&o+a<i)return!0}else if((3===e||4===e||5===e)&&i<n.height&&r>0&&o+a<r)return!0;return!1}function Ft(t,n){var e=It(n,0),i=It(n,3,!0),r=It(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+It(n,1,!0),o}function Bt(t){var n="left";return 1===t||4===t?n="center":2!==t&&5!==t||(n="right"),n}function Pt(t,n,e,i){var r=new o.Point(t.x,t.y),a=parseInt(e.fontSize,10),u=It(n,0),s=It(n,2),c=It(n,3,!0),f=It(n,1,!0),l=t.width,h=t.height,d=a>8?Math.floor((a-8)/5+2):1,v=i/2-a/2+d-1,p=a>8?1:2,g=i-v+It(n,0,!0),m=g+1,b=u+s>h?u+g:h-s+g-1;switch(n.labelOptions.alignment){case 0:r.x+=c+p+1,r.y+=m;break;case 1:r.x+=c+(l-c-f)/2,r.y+=m;break;case 2:r.x+=l-f-2,r.y+=m;break;case 3:r.x+=c+p+1,r.y+=b;break;case 4:r.x+=c+(l-c-f)/2,r.y+=b;break;case 5:r.x+=l-f-2,r.y+=b}return r}function Gt(t,n){var e=It(n,3,!0),i=It(n,1,!0),r=It(n,0,!0),o=It(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=It(n,0)-r-o):3!==u&&4!==u&&5!==u||(a.y=t.height-It(n,2)+r,a.height=It(n,2)-r-o),2!==u&&5!==u||(a.width-=2),a}function Ut(t,n,e,i){var r,a;if(g(n,R))return ft(t,n);if(e&&n&&n[0]&&n[0].value)return n[0].value.length*b(t.font,n[0].value);for(i&&Array.isArray(n)&&(n=(0,o.getTextContentWithoutEndBlank)(n)),r=0,a=0;a<n.length;a++)"fillingChar"!==n[a].type&&(r+=ft(t,n[a].value));return r}function Ht(t){var n,e,i,r=null===(n=t[0])||void 0===n?void 0:n.type,o=0,a=[t[0]];for(e=1;e<t.length;e++)i=t[e],r===Z&&i.type===Z?a[o].value+=i.value:(a.push(i),r=i.type,o++);return a}function Vt(t,n,e,i,r){var o;return o=i?Math.floor(n/r):Math.floor(n/T(t,t.font,e)),new Array(o+1).join(e)}function zt(t){var n=t.clone();return n.width--,n.height--,n}function Yt(t,n,e,i){var r,o,u;for(r=0;r<t.length;r++)o=void 0,t[r].style=t[r].style||{},(u=t[r].style).font?(o=a.W.V(u.font,e).font,p(i)||(o=a.W.V(o,i).font)):o="object"==typeof n?n.font:n,u.font=o}function Zt(t,n,e,i,r){var a=e*H(-i)+r*U(-i),u=e*H(-i)+r*U(-i),s=t-a/2,c=n-u/2;return new o.Rect(s,c,a,u)}function Wt(t){return"string"==typeof t.src&&t.src.length>0&&-1===t.src.indexOf("<script")}function Qt(t,n,e,i){var r,o,a,u;I(e)||(u={context:i,style:e},ut.et(i.sheet,"beforePaintDecoration",u),(null===(r=e.decoration)||void 0===r?void 0:r.cornerFold)&&Kt(t,n,e.decoration.cornerFold,i),(null===(a=null===(o=e.decoration)||void 0===o?void 0:o.icons)||void 0===a?void 0:a.length)>0&&Jt(t,n,e.decoration.icons.filter((function(t){return Wt(t)})),e.vAlign,i))}function Kt(t,n,e,i){var r,o,a,s,c,f,l,h,d,v,p,g,m=e.size,b=e.position,y=e.color;I(m)&&(m=6),I(b)&&(b=u.CornerPosition.leftTop),r=n.x,o=n.y,a=n.height,s=n.width,f=m*(c=i.sheet).zoom(),t&&s>0&&a>0&&(t.save(),t.rect(r,o,s,a),t.clip(),t.fillStyle=y||"#FF3D00",t.beginPath(),t.fillStyle=y,l=void 0,h=void 0,d=void 0,v=void 0,p=void 0,g=void 0,b&u.CornerPosition.leftTop&&(d=r,v=(h=o)+f,p=(l=r)+f,g=h,t.moveTo(l,h),t.lineTo(d,v),t.lineTo(p,g),t.fill()),b&u.CornerPosition.rightBottom&&(d=l=r+s,v=(h=o+a)-f,p=l-f,g=h,t.moveTo(l,h),t.lineTo(d,v),t.lineTo(p,g),t.fill()),b&u.CornerPosition.leftBottom&&(d=r,v=(h=o+a)-f,p=(l=r)+f,g=h,t.moveTo(l,h),t.lineTo(d,v),t.lineTo(p,g),t.fill()),b&u.CornerPosition.rightTop&&(d=l=r+s,v=(h=o)+f,p=l-f,g=h,t.moveTo(l,h),t.lineTo(d,v),t.lineTo(p,g),t.fill()),t.closePath(),t.restore())}function Jt(t,n,e,i,r){var o,a,u,c,f,l,h;if(!r.cellOverflowLayout&&e.length>0&&(o=e.filter((function(t){return I(t.position)||t.position===s.IconPosition.left})),a=e.filter((function(t){return t.position===s.IconPosition.right})),(u=o.concat(a)).length>0)){if(vn(u,r),!t)return;c=pn(n.clone(),r),t.save(),t.rect(c.x,c.y,c.width,c.height),t.clip(),t.beginPath(),l=f=c.x,h=c.x+c.width,o.length>0&&(l=f=en(t,o,c,i,r)),a.length>0&&(h=f=tn(t,a,c,i,r)),t.restore(),n.width=n.x+n.width-(c.x+c.width-h)-l,n.x=l}}function Xt(t,n,e,i,r){if(t&&e.length>0){var o=e.filter((function(t){return t.position===s.IconPosition.outsideLeft&&Wt(t)})),a=e.filter((function(t){return t.position===s.IconPosition.outsideRight&&Wt(t)})),u=3,c=n.x;(o.length>0||a.length>0)&&(vn(o,r),vn(a,r),2===r.columnHeaderFitMode&&r.cornerX&&((n=n.clone()).height=n.height-(r.cornerY-n.y)-1,n.y=r.cornerY-1),o.length>0&&(n.x=c-3,qt(t,o,n,i,r)),a.length>0&&(n.x=c+3,$t(t,a,n,i,r)))}}function qt(t,n,e,i,r){nn(t,n,e.x,e,i,r)}function $t(t,n,e,i,r){rn(t,n,e.x+e.width,e,i,r)}function tn(t,n,e,i,r){return nn(t,n,e.x+e.width,e,i,r)}function nn(t,n,e,i,r,o){var a,u,s=ln(o),c=s;for(e-=c,a=n.length-1;a>=0;a--)e-=u=hn(o,n[a],"width"),an(t,n[a],e,i.y,u,i.height,o,i,r);return e}function en(t,n,e,i,r){return rn(t,n,e.x,e,i,r)}function rn(t,n,e,i,r,o){var a,u,s=ln(o),c=s;for(e+=c,a=0;a<n.length;a++)u=hn(o,n[a],"width"),an(t,n[a],e,i.y,u,i.height,o,i,r),e+=u;return e}function on(t,n){var e,i,r,o,a,u=n.ctx,c=n.style,f=n.context,l=n.textRect,h=n.availRect;!I(c.decoration)&&u&&(e="beforeFillTextArea"===t?s.IconPosition.leftOfText:s.IconPosition.rightOfText,(i=c.decoration.icons&&c.decoration.icons.filter((function(t){return t.position===e&&Wt(t)})))&&i.length>0&&(vn(i,f),2===f.columnHeaderFitMode&&f.cornerX&&(r=f.cellRect.x+f.cellRect.width-(h.x+h.width),(h=h.clone()).width=f.cornerX-h.x-r,h.height=h.height-(f.cornerY-h.y)-1,h.y=f.cornerY-1),o=void 0,a=cn(h,l,e),u.save(),u.rect(a.x,a.y,a.width,a.height),u.clip(),u.beginPath(),e===s.IconPosition.leftOfText?(o=tn(u,i,a,c.vAlign,f),l.x=o):(o=en(u,i,a,c.vAlign,f),l.width=o-l.x),u.restore()))}function an(t,n,e,i,r,a,u,c,f){var l,h,d,v,p,g,m,b,y,w,M,C,S,T;return t.save(),t.beginPath(),t.rect(e,i,r,a),t.clip(),l=0,h=dn(u),d=n.src,h.getState(d)?h.qh(d)&&(v=new o.Rect(e,i,r,a),p=hn(u,n,"width"),g=hn(u,n,"height"),b=fn(v,m=new o.Rect(0,0,p,g),f,ln(u)),n.position!==s.IconPosition.leftOfText&&n.position!==s.IconPosition.rightOfText||((y=u.textRect)&&(b.y=W(y.y-y.height/2-m.height/2,i+4)),b.y+b.height>v.y+v.height&&(b.y=W(b.y-(b.y+b.height-v.y-v.height),v.y))),M=(w=h.getImage(d)).width,C=w.height,o.mt.Tt.msie&&(q[d]||(w.style.position="absolute",w.style.left="-10000px",w.style.top="-100000px",document.body.appendChild(w),q[d]={width:w.width,height:w.height},document.body.removeChild(w)),M=q[d].width,C=q[d].height),c&&o.mt.Tt.msie&&b.x+b.width>c.x+c.width?(S=l=c.x+c.width-b.x)>0&&(T=M/p,t.drawImage(w,0,0,S*T,C,G(b.x),G(b.y),S,g)):(l=p,t.drawImage(w,0,0,M,C,G(b.x),G(b.y),l,g))):h.addImage(d,"anonymous"),t.restore(),l}function un(t){var n=t.context,e=t.style,i=t.externals;a.W.Xue(e)&&(i.left=i.left.concat(sn(n,e,s.IconPosition.leftOfText)),i.right=i.right.concat(sn(n,e,s.IconPosition.rightOfText)))}function sn(t,n,e){var i,r,o,a=!1;for(i=0,r=n.decoration.icons;i<r.length;i++)if((o=r[i]).Ltr){a=!0;break}return n.decoration.icons.filter((function(n){return n.position===e&&(!t.cellOverflowLayout||a)})).map((function(n){return{width:hn(t,n,"width"),height:hn(t,n,"height"),isStick:n.Ltr}}))}function cn(t,n,e){switch(e){case s.IconPosition.leftOfText:return new o.Rect(t.x,t.y,n.x-t.x,t.height);case s.IconPosition.rightOfText:return new o.Rect(n.x+n.width,t.y,t.x+t.width-n.x-n.width,t.height)}}function fn(t,n,e,i){var r,a=2*i;switch(e){case s.VerticalAlign.top:r=0+a;break;case s.VerticalAlign.bottom:r=Math.max(0,t.height-n.height)-a;break;default:r=Math.max(0,(t.height-n.height)/2)}return new o.Rect(t.x,t.y+r,Math.min(n.width,t.width),Math.min(n.height,t.height))}function ln(t){return st(t)?t.printZoomFactor:t.sheet.zoom()}function hn(t,n,e){var i=n[e],r=ln(t);return(I(i)||isNaN(i)||i<=0)&&(i=12),i*r}function dn(t){var n=t.sheet,e;return n.MC||t.imageLoader||n.BO()}function vn(t,n){var e,i,r=dn(n);for(e=0;e<t.length;e++)(i=t[e].src)&&r.addImage(i,"anonymous")}function pn(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 gn(t){bn(t,"width")}function mn(t){bn(t,"height")}function bn(t,n){var e,i,r,o,u=t.cellStyle;if(u.decoration&&u.decoration.icons&&0!==u.decoration.icons.length){for(e=u.decoration.icons,i=0,r=0;r<e.length;r++)o=e[r],a.W.Kue(o)&&(i+=hn(t.context,o,n));t.value=i}}function yn(t,n,e){var i,r,o=(t.length-1)*n,a=t[0],u=t[t.length-1],s=document.createElement("canvas"),c=s.getContext("2d");return c.font=e.font,i=c.measureText(a),r=c.measureText(u),{height:o=i.actualBoundingBoxAscent+r.actualBoundingBoxDescent+o,descenderHeight:r.actualBoundingBoxDescent}}function wn(t,n,e,i,r,o,a,u){var s,c,f,l,h=e.content;if(h&&h.length>0)for(f=(f=o-a-(c=Ut(t,h,!0))-2)>0?f:0,l=void 0,s=0;s<h.length;s++)"fillingChar"===h[s].type||"numberPlaceholder"===h[s].type?r+=f:"placeholder"===h[s].type?r+=h[s].value?h[s].value.length*u:0:r+=l=h[s].value?h[s].value.length*u:0;else if(n)for(s=0;s<n.length;s++)r=Mn(t,n[s],i,r).y;return r}function Mn(t,n,e,i){var r,o,u,s;if(n&&n.length>0)for(r=t.font,o=b(r,n),u=lt(a.W.V(r,1).fontSize,o),s=0;s<n.length;s++)i=i+o-u,i+=u;return{x:e,y:i}}Object.defineProperty(n,"__esModule",{value:!0}),n.Context=n.Base=n.paintStyleDecorationOutSideIcons=n.paintDecoration=n.getEditorPosition=n.cellTypeContext_paintBackground=n.clearCacheTimer=n.wordWrapInfoCache=n.getRotatedCharType=n.isPrintZoomFactorExist=void 0,i=e("Common"),r=e("./dist/core/util/domUtil.js"),o=e("./dist/core/util/common.js"),a=e("./dist/core/worksheet/stylehelper.js"),u=e("./dist/core/core.interface.js"),s=e("./dist/core/core.enum.js"),c=e("./dist/core/celltype/celltype.ns.js"),f=e("CalcEngine"),l=i.Common.CultureManager,h=i.Common.st,d=i.Common.ct,v=i.Common.lt,p=v.ht,g=v.dt,m=o.mt.vt,b=o.mt.qao,y=o.mt.gt,w=o.mt.pt,M=o.mt.bt,C=o.mt.yt,S=o.mt.wt,T=o.mt.Mt,x=o.mt.Ct,A=o.mt.St,I=i.Common.lt.ht,k=r.GC$.extend,N=o.mt.Tt,j="left",D="right",_="center",O="alphabetic",E=16,R="string",L="number",F=null,B=void 0,P=Math.floor,G=Math.ceil,U=Math.sin,H=Math.cos,V=Math.tan,z=Math.abs,Y="General",Z="text",W=Math.max,Q=Math.min,K=.7,J={},X="...",q={},tt=" ",nt=new RegExp($="\xa0","g"),function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(et||(et={})),n.isPrintZoomFactorExist=st,it=function(){function t(){}return t.At=function(t){var n,e,i=t.split("e")[1];if(i&&i.length>0&&("+"===i[0]?n=!0:"-"===i[0]&&(n=!1),e=i.slice(1)),void 0!==n)return{isAdd:n,length:e}},t.It=function(n,e,i){var r=t.xt,o=r[e+i];return o||(o=T(n,e,i),r[e+i]=o),o},t.Nt=function(n,e,i,r,a){var u,s,c,f,l,h,d,v,p,g,m,b,y,w,M,C,S,T,x,A,I=r.font;if(i=i-1-gt(r,3)*a,u=r.textIndent&&0!==r.textIndent,s=r.isVerticalText,typeof e===L&&!0!==r.shrinkToFit&&!s&&!u){if(c=e<0,e=z(e),f=c?t.It(n,I,"-"):0,l=e.toString(),(h=t.At(l))&&!1===h.isAdd&&(d=o.mt.toPlainString(e)).split(".")[1].length<10&&(l=d,h=B),v=void 0,p=t.Dt(r._autoFormatter,e),h)return v=h.length.toString().length,v=W(v,2),t._t(n,i,r,v,f,h.isAdd,p);if(g=f,m=t.It(n,I,"0"),b=l.split("."),g+=w=m*(y=Math.round(e).toString().length),M=t.It(n,I,"."),C=void 0,w<=i){if(!b[1]||0===b[1].length)return r._autoFormatter;if((g=g+b[1].length*m+M)<=i)return r._autoFormatter;if(e<.001)return v=b[1].length.toString().length,v=W(v,2),t._t(n,i,r,v,f,!1,p);for(S=i-f-w-M,T=Math.floor(S/m),C="0",(T=Math.min(T,b[1].length))>0&&(C+="."),x=0;x<T;x++)C+="0";return C}return v=(A=Math.round(e)).toString().length.toString().length,v=W(v,2),t._t(n,i,r,v,f,!0,p)}return r._autoFormatter},t._t=function(n,e,i,r,o,a,u){var s,c,f,l=i.font,h=t.It(n,l,"0"),d=t.It(n,l,"E"),v=t.It(n,l,"+"),p=t.It(n,l,"-"),g=a?v:p,m=t.It(n,l,"."),b=e-o-r*h-d-g-h,y=b-m;if(y<=h)return a?"0E+00":b>0?"0E-00":"0";for(s=Math.floor(y/h),s=Math.min(s,u),c="0",f=0;f<s;f++)0===f&&(c+="."),c+="0";return c+=a?"E+00":"E-00"},t.Et=function(n,e,i,r,o){var a,u,s,c,f,l,h,d,v=r.font;if(i=i-1-gt(r,3)*o,a=r.textIndent||0,s=i,1!==(u=r.hAlign)&&a>0&&(s=i-8*a),s<(c=T(n,v,e))){for(f=t.It(n,v,"#"),l=Math.floor(i/f),h="",d=0;d<l;d++)h+="#";return h}return e},t.nt=function(t,n,e,i,r,o,a,u){var s,c,f,l,h,d,v,p,g,m,b,y;if(o&&"none"!==o&&u)try{u.getState(o)?(s=u.getImage(o),c=void 0,N.msie&&((c=document.createElement("div")).appendChild(s),document.body.appendChild(c)),f=s.width,l=s.height,N.msie&&(c.removeChild(s),document.body.removeChild(c)),h=0,d=0,v=f,p=l,g=i,m=r,b=n,y=e,1===a?(v=i>=f?f:i,p=r>=l?l:r,b=i>f&&f>0?G(n+i/2-f/2):n,y=r>l&&l>0?G(e+r/2-l/2):e,g=v,m=p):2===a?r>0&&l>0&&i/r>f/l?b=n+i/2-(g=f/l*r)/2:i>0&&f>0&&r/i>l/f&&(y=e+r/2-(m=l/f*i)/2):3===a&&(g=v=i>=f?f:i,m=p=r>=l?l:r),t.drawImage(s,h,d,v,p,b,y,g,m)):u.addImage(o)}catch(t){}},t.Bt=function(t,n,e,i,r){var a,u,s,c,f,l,h,d,v,p,g,b,y,w,M,C,S,T,x,A=0,I=r&&r.sheet,N=r.sheetArea,j=r.row,D=r.col,_=e.textIndent,O=e.hAlign,L=e.isVerticalText,F=1===N&&1===I.Lt(D),B=F?-90:e.textOrientation,P=e.borderTop||e.borderBottom||e.borderLeft||e.borderRight,G=e.font;if(B&&-90<=B&&B<=90&&(c=z(B*Math.PI/180),u=U(c),s=H(c)),I&&typeof n===R&&n)if(f=[],l=void 0,t&&t.richText)if(t.converted||(t=o.util.g0(t)),t={text:t.text,richText:t.converted},h=e.formatter||e._autoFormatter,v=(d=I.getCellType(j,D,N)).Ft(h,t.text),Yt(l=k(!0,[],d.Pt(t,n,v,G,e.foreColor)),G,i),L)if(e.wordWrap||5===O){if(p=I.Gt(j,N),(g=I.getSpan(j,D,N))&&g.row>=j&&g.col>=D&&g.rowCount>1)for(b=j+1;b<j+g.rowCount;b++)p+=I.Gt(b,N);for(y=0,_>0&&(y=8*_*i),(w=It(e,0))>0&&(p-=w),(M=It(e,2))>0&&(p-=M),p++,f=o.q.Ht((0,o.W3e)(n),p-gt(e,3)-y,G,l,L),a=0;a<f.length;a++)A+=Mt(f[a].textInfos,G,i)}else A=Mt(l,G,i);else{if(e.wordWrap||5===O){for(C=(0,o.W3e)(n).split(/\r\n|\r|\n/),a=0;a<C.length;a++)f.push((0,o.zt)(C[a]));for(f=o.q.Vt(f,o.q.Yt(l)),a=0;a<f.length;a++)A=Math.max(A,St(f[a],G,i,L,!0))}else A=Ct(l,G,i);_>0&&4!==O&&(A+=1===O||5===O?8*_*2:8*_),wt(I,j,D,r.sheetArea)&&(A+=At(I))}else if(f=(0,o.W3e)(n).split(/\r\n|\r|\n/),T=m(S=G)/i,L)if(e.wordWrap||5===O)for(a=0;a<f.length;a++)A+=T;else A=T;else{if(e.wordWrap||5===O){if(B)return x=I.Gt(j,N),o.q.Zt(j,D,u,s,n,S,x);for(a=0;a<f.length;a++)A=Math.max(A,o.q.Wt(f[a],S,!0)/i)}else A=B?P?(T+4)/u:s*(I.Qt(n,S)/i)+T*u:4===e.hAlign?I.Jt.Kt(D,N):I.Qt(n,S)/i;_>0&&4!==O&&(A+=1===O||5===O?8*_*2:8*_),wt(I,j,D,r.sheetArea)&&(A+=E)}return A},t.Xt=function(t,n,e,i){var r,o,u,s=t.Jt.Kt(e,i);for(r=e+1;r<t.getColumnCount(i)&&(o=t.Jt.qt(n,r,i),u=t.Jt.$t(n,r,i,1,{style:o}),I(u))&&!o.watermark&&!(o.cellType&&"1"!==o.cellType.typeName||o.cellButtons&&o.cellButtons.length>0||a.W.Jue(o))&&4===o.hAlign;r++)s+=t.Jt.Kt(r,i);return s},t.tn=function(t,n,e,i,r){var u,c,f,l,h,d,v,p,g,y,w,M,C,S,T,A,I,N,j,D,_,O,E,L,F,B,P,G,V,Y,Z=0,W=r&&r.sheet,Q=e.font,K=e.isVerticalText,J=e.textIndent,X=e.vAlign,q=e.hAlign,$=e.textOrientation,tt=r.row,nt=r.col,et=r.sheetArea,it=W.outlineColumn&&W.outlineColumn.Un(nt),rt=0;if(J>0&&(rt=8*J*i),1!==q&&5!==q||(rt*=2),$&&-90<=$&&$<=90&&(S=z($*Math.PI/180),M=U(S),C=H(S)),W&&typeof n===R&&n)if(T=[],A=void 0,t&&t.richText)if(t.converted||(t=o.util.g0(t)),t={text:t.text,richText:t.converted},I=e.formatter||e._autoFormatter,j=(N=W.getCellType(tt,nt,et)).Ft(I,t.text),Yt(A=k(!0,[],N.Pt(t,n,j,Q,e.foreColor)),Q,i),K){if(e.wordWrap||5===e.hAlign){for(D=(0,o.W3e)(n).split(/\r\n|\r|\n/),u=0;u<D.length;u++)T.push((0,o.zt)(D[u]));for(T=o.q.Vt(T,o.q.Yt(A)),u=0;u<T.length;u++)Z=Math.max(Z,St(T[u],Q,i,K,!0))}else Z=Ct(A,Q,i,K);J>0&&(Z+=1===X?8*J*2:8*J)}else if(e.wordWrap||5===e.hAlign){if(c=W.nn(nt,et),(h=W.getSpan(tt,nt,et))&&h.row>=tt&&h.col>=nt&&h.colCount>1)for(d=nt+1;d<nt+h.colCount;d++)c+=W.nn(d,et);for(p=It(e,1),(g=It(e,3))>0&&(c-=g),p>0&&(c-=p),c++,T=o.q.Ht((0,o.W3e)(n),c-gt(e,3)-rt,Q,A),u=0;u<T.length;u++)Z+=Mt(T[u].textInfos,Q,i)}else Z=Mt(A,Q,i);else if(_=e.font,O=m(_)/i,K){if(e.wordWrap||5===e.hAlign)for(T=(0,o.W3e)(n).split(/\r\n|\r|\n/),u=0;u<T.length;u++)E=T[u].length*b(_,T[u]),Z=Math.max(Z,E);else Z=n.length*b(_,n);J>0&&(Z+=1===X?8*J*2:8*J)}else if(e.wordWrap||5===e.hAlign){if(et=r.sheetArea,c=4===e.hAlign?this.Xt(r.sheet,tt,nt,et):W.nn(nt,et),f=W.Gt(tt,et),(h=W.getSpan(tt,nt,et))&&h.row>=tt&&h.col>=nt&&h.colCount>1){for(d=nt+1;d<nt+h.colCount;d++)c+=W.nn(d,et);for(v=tt+1;v<tt+h.rowCount;v++)f+=W.Gt(v,et)}if(p=It(e,1),(g=It(e,3))>0&&(c-=g),p>0&&(c-=p),(y=It(e,0))>0&&(f-=y),(w=It(e,2))>0&&(f-=w),e.cellButtons&&e.cellButtons.length>0&&(c-=Nt(r,e)),a.W.Jue(e)&&(c-=jt(r,e)),e.cellType&&e.cellType.Tfe&&(c-=e.cellType.Tfe(i)),1===et&&(F=!!((L=W.rowFilter&&W.rowFilter())&&L.rn(tt,nt,et)&&L.filterButtonVisible(nt)))&&(c-=W.an(new o.Rect(0,0,c,f),et).width),$)return B=(f-O*C)/M,T=o.q.un((0,o.W3e)(n),B,_),Z=M*(l=W.Qt(T[0],_)/i)+O*C;x(t)?T=[n]:(P=rt,!it||et===s.SheetArea.colHeader&&W.NMi||(G=W.outlineColumn.ost())&&(V=G[tt])&&(Y=V.cellContent)&&"number"==typeof Y.left&&(P=Y.left),T=o.q.un((0,o.W3e)(n),c-gt(e,3)-P,_)),Z=T.length*O}else Z=$?M*(l=W.Qt(n,_)/i)+O*C:O;return Z},t.cn=function(t,n,e,i,r,o,a,u,s,c,f,l){var h;1===s?(t.beginPath(),(h=t.createLinearGradient(n,e+1,n,e+r-2)).addColorStop(0,u.borderLeftColor),h.addColorStop(1,u.borderRightColor),t.strokeStyle!==h&&(t.strokeStyle=h),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(),(h=t.createLinearGradient(n,e,n+i-2,e)).addColorStop(0,u.borderTopColor),h.addColorStop(1,u.borderBottomColor),t.strokeStyle!==h&&(t.strokeStyle=h),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||l||(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()))},t.hn=function(t,n){var e;e=2===n?"active":4===n?"inactive":0===n?"disabled":"auto",(0,r.GC$)(t).css("ime-mode",e)},t.dn=function(t,n,e,i,r,o,a){var u,s,c,f,l;return!!(n&&"SparklineExValue"===n.typeName&&(s=(u=a.sheet)&&u.parent)&&(c=s.getSparklineEx(n.name)))&&(l={zoomFactor:f=st(a)?a.printZoomFactor:u.zoom(),sheet:u,rowIndex:a.row,columnIndex:a.col,isPrinting:a.isPrinting},2===a.columnHeaderFitMode&&(r=u.getColumnWidth(a.col,a.sheetArea)+1),c.paint(t,n.value,e,i,r,o,l),!0)},t.xt={},t.Dt=function(t,n){var e,i,r,o,a,u;return t&&t.vn&&(i=(e=t.vn(n)).format(n))&&i[1]&&"decimalSeparator"===i[1].type?(r=i[2])&&r.type===L?(o=r.value,u=(a=i[3])&&"exponent"===a.type&&a.value&&a.value.indexOf("E")>-1,!p(o)&&u?o.length:5):0:5},t.gn=It,t}(),n.Context=it,rt=['"\uff2d\uff33 \u30b4\u30b7\u30c3\u30af"','"\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af"','"\uff2d\uff33 \u660e\u671d"','"\uff2d\uff33 \uff30\u660e\u671d"','"MS UI Gothic"',"\u30e1\u30a4\u30ea\u30aa","Meiryo",'"Meiryo UI"','"Yu Gothic"','"Yu Gothic UI"','"Yu Mincho"',"\u6e38\u30b4\u30b7\u30c3\u30af","\u6e38\u660e\u671d",'"MS Gothic"','"MS PGothic"','"MS Mincho"','"MS PMincho"'],ot={"\uff1c":c.VCRT.NORMAL,"\uff1e":c.VCRT.NORMAL,"\uff0f":c.VCRT.NORMAL,"\uff1a":c.VCRT.NORMAL,"\uff1b":c.VCRT.NORMAL,"\uff01":c.VCRT.NORMAL,"\uff1f":c.VCRT.NORMAL,"\u201c":c.VCRT.NORMAL,"\u201d":c.VCRT.NORMAL,"\u2018":c.VCRT.NORMAL,"\u2019":c.VCRT.NORMAL,"\u3008":c.VCRT.DEG90,"\u3009":c.VCRT.DEG90,"\u300c":c.VCRT.DEG90,"\u300d":c.VCRT.DEG90,"\uff62":c.VCRT.DEG90,"\uff63":c.VCRT.DEG90,"(":c.VCRT.DEG90,")":c.VCRT.DEG90,"[":c.VCRT.DEG90,"]":c.VCRT.DEG90,"\uff3b":c.VCRT.DEG90,"\uff3d":c.VCRT.DEG90,"{":c.VCRT.DEG90,"}":c.VCRT.DEG90,"\uff5b":c.VCRT.DEG90,"\uff5d":c.VCRT.DEG90,"\u3016":c.VCRT.DEG90,"\u3017":c.VCRT.DEG90,"\u3014":c.VCRT.DEG90,"\u3015":c.VCRT.DEG90,"\u3010":c.VCRT.DEG90,"\u3011":c.VCRT.DEG90,"\u300a":c.VCRT.DEG90,"\u300b":c.VCRT.DEG90,"\u300e":c.VCRT.DEG90,"\u300f":c.VCRT.DEG90,"\uff08":c.VCRT.DEG90,"\uff09":c.VCRT.DEG90,"\uff1d":c.VCRT.DEG90,"\uff3f":c.VCRT.DEG90,"\uff5c":c.VCRT.DEG90,"\u2015":c.VCRT.DEG90,"\uff5e":c.VCRT.DEG90_FLIP_V,"\u30fc":c.VCRT.DEG90,"<":c.VCRT.DEG90,">":c.VCRT.DEG90,"\u3001":c.VCRT.TRANSFORM_TOP_RIGHT,"\u3002":c.VCRT.TRANSFORM_TOP_RIGHT,"\uff0e":c.VCRT.TRANSFORM_TOP_RIGHT,"\uff0c":c.VCRT.TRANSFORM_TOP_RIGHT,"\u2026":c.VCRT.DEG90},at={},rt.forEach((function(t){at[t]={},at[t]["\ufe5b"]=c.VCRT.DEG90,at[t]["\ufe5c"]=c.VCRT.DEG90,at[t]["\ufe5d"]=c.VCRT.DEG90,at[t]["\ufe5e"]=c.VCRT.DEG90,at[t]["\u2015"]=c.VCRT.DEG90})),["\u7b49\u7ebf",'"\u7b49\u7ebf Light"'].forEach((function(t){at[t]={},at[t]["\uff5e"]=c.VCRT.DEG90})),["Aptos",'"Aptos Light"',"Calibri",'"Calibri Light"',"\u5b8b\u4f53"].forEach((function(t){at[t]={},at[t]["\u2015"]=c.VCRT.DEG90})),(0,c.rotatedCharsForVertical)(at),n.getRotatedCharType=ht,ut=function(){function t(){this.allowOverflow=!1,this.typeName="0"}return t.prototype.Bye=function(n,e){var i={context:n,style:e};t.et(n.sheet,"beforePaintCellContent",i)},t.prototype.pn=function(n,e,i,r){var o={ctx:n,options:{rect:e,context:i,value:r}};return t.et(i.sheet,"paintCellPadding",o),o.options.rect},t.prototype.bn=function(n,e,i){var r={context:n,options:{dom:e,cellRect:i,contentRect:i.clone(),leftExternalRect:new o.Rect(0,0,0,0),rightExternalRect:new o.Rect(0,0,0,0)}};return t.et(n.sheet,"onCreateCellEditor",r),r.options.dom},t.prototype.yn=function(n,e,i){var r={ctx:null,options:{rect:e.clone(),context:n,value:null,style:i}};return t.et(n.sheet,"getCellButtonRect",r),r.options.rect},t.prototype.wn=function(n,e,i,r){var a={context:n,options:{dom:e,cellRect:i,cellStyle:r,contentRect:i.clone(),leftExternalRect:new o.Rect(0,0,0,0),rightExternalRect:new o.Rect(0,0,0,0)}};return t.et(n.sheet,"onActivateCellEditor",a),a},t.prototype.Mn=function(n,e,i,r){var a={context:n,contentContainer:e,editorBounds:i,cellStyle:r,contentRect:i.clone(),leftExternalRect:new o.Rect(0,0,0,0),rightExternalRect:new o.Rect(0,0,0,0)};return t.et(n.sheet,"onUpdateContainer",a),a},t.prototype.Cn=function(n,e,i){var r={context:n,options:{dom:e,cellRect:i,contentRect:i.clone(),leftExternalRect:new o.Rect(0,0,0,0),rightExternalRect:new o.Rect(0,0,0,0)}};return t.et(n.sheet,"onDeactivateCellEditor",r),r.options.dom},t.prototype.Sn=function(t,n,e){var i=this;i.deactivateEditor(t,n),i.Cn(n,t,e)},t.prototype.Tn=function(t,n,e,i){var r,o,u,s,c,f,l,h,d,v,p=e.labelOptions;if(p&&(r=i.sheet,o=e.watermark)){if(u=p.visibility,s=r.getText(i.row,i.col,i.sheetArea),1===u||(2===u||u===B)&&""===s)return;c=r.zoom(),l=void 0,l=(f=p.font)?a.W.V(f,c):a.W.x2e(e,1),h=m(l.font),d=Ft(n,e),v=void 0,Lt(e,n)&&(v=Pt(n,e,l,h)),v&&(t.save(),t.textAlign=Bt(p.alignment),t.textBaseline="alphabetic",M(t,l.font),t.fillStyle=p.foreColor||e.foreColor||"grey",t.rect(d.x,d.y,d.width,d.height),t.clip(),t.beginPath(),t.fillText(o,v.x,v.y),t.restore())}},t.prototype.An=function(t,n,e){var i=t.clone(),r=It(n,0,!1,e),o=It(n,1,!1,e),a=It(n,2,!1,e),u=It(n,3,!1,e);return r>0&&(i.y+=r,i.height-=r),a>0&&(i.height-=a),u>0&&(i.x+=u,i.width-=u),o>0&&(i.width-=o),o+u>=t.width&&(i.width=0),r+a>=t.height&&(i.height=0),i},t.prototype.In=function(n,e,i,r){var o,a=this,u=st(r)?r.printZoomFactor:r.sheet.zoom();return o={ctx:n,options:{rect:e=a.An(e,i,u),context:r}},t.et(r.sheet,"getCellPaddingRect",o),o.options.rect},t.prototype.xn=function(t,n,e,i){var a,u,s,c,f,l,h,d,v,p,g,b,y,w=e.labelOptions;w&&(u=(a=i.sheet).getText(i.row,i.col,i.sheetArea),s=e.watermark,1!==(c=w.visibility)&&s&&(f=w.font||e.font||a.Dn.Nn(),1!==(l=a.zoom())&&(f=a.Dn._n(f)),h=m(f),Lt(e,n)&&(d=Gt(n,e)),d&&((v=(0,r.GC$)(o.mt.En("span"))).text(s),p=(2===c||c===B)&&""===u,g=d.height-h,b=d.y+(p&&g>0?g:0),v.css({display:"block",position:"absolute",left:d.x,top:b,width:d.width,height:d.height,font:C(f),color:w.foreColor||e.foreColor||"grey",textAlign:Bt(w.alignment),overflow:"hidden",whiteSpace:"nowrap"}).attr("gcUIElement","gcEditorLabel"),(0,r.GC$)(t).append(v),p&&(y=setInterval((function(){b--,v.css("top",b),b<=d.y&&clearInterval(y)}),20)))))},t.prototype.jn=function(t){var n,e,i,a=this,u=o.mt.En("div");return u.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",(n=o.mt.En("div")).style.cssText="position: absolute; outline: none; border: none;",(0,r.GC$)(u).append((0,r.GC$)(n)),(e=a.createEditorElement(t,u))&&(0,r.GC$)(n).append((0,r.GC$)(e)),i=t.sheetArea,a.bn(t,u,t.sheet.getCellRect(t.row,t.col,1===i?-1:B,2===i?-1:B)),u},t.prototype.On=function(t,n,e,i){var o,a,u,c,f,l,h,d,v,p,g;t&&t.firstChild&&(o=this,Et(t,n,a=zt(e),i),c=(u=o.wn(i,t,a,n)).options.contentRect,f=u.options.cellRect,l=u.options.leftExternalRect,h=u.options.rightExternalRect,o.xn&&o.xn(t,c,n,i),d=i.sheet.zoom(),v=dt(c=o.An?o.An(c,n,d):c,l,h),p=t.firstChild,g=yt(n.textDirection,n.textDirection===s.TextDirectionType.context?i.sheet.getValue(i.row,i.col):F),(0,r.GC$)(p).css({left:(+(0,r.GC$)(p).css("left").replace("px","")||0)+It(n,3,!1,d),top:(+(0,r.GC$)(p).css("top").replace("px","")||0)+It(n,0,!1,d),direction:g}),o.activateEditor(t.firstChild.firstChild,n,v,i,f,l,h))},t.prototype.updateEditorContainer=function(t,n,e,i,o,a,u){var s,c,f,l,h,d;t&&n&&(c=(s=t.parentNode)?s.parentNode:B)&&o&&(f=(0,r.GC$)(c),l=o.width,h=o.height,l>0&&(f.width(l),d=c.lastChild,e&&"gcEditorLabel"===d.getAttribute("gcUIElement")&&(0,r.GC$)(d).width(l-It(e,3,!0)-It(e,1,!0)-2)),h>0&&f.height(h),p(o.x)||f.css("left",o.x+"px"),p(o.y)||f.css("top",o.y+"px"))},t.prototype.Rn=function(t,n,e,i){var r,o,a,u,s,c,f,l,h,d,v,p,g,m=this,b=t.firstChild,y=zt(e);Et(t,n,y,i),o=(r=m.Mn(i,b,y,n)).editorBounds,a=r.contentRect,u=r.leftExternalRect,s=r.rightExternalRect,c=b.firstChild,f=dt(a=m.An?m.An(a,n,i.sheet.zoom()):a,u,s),l=m.updateEditor(c,n,f,i,o,u,s),h={width:u.width,height:u.height},d={width:s.width,height:s.height},v={width:p=!isNaN(l&&l.width)&&l.width+h.width+d.width>o.width?l.width+h.width+d.width:o.width,height:g=!isNaN(l&&l.height)&&l.height+h.height+d.height>o.height?l.height+h.height+d.height:o.height},m.updateEditorContainer(c,l,n,i,v,h,d)},t.prototype.Bn=function(t,n,e,i,r){return this.getCellAndPaddingHitInfo(t,n,e,i,r)},t.prototype.Ln=function(t,n,e,i,r){var o=Nt(r,e)+kt(r)+jt(r,e),a=this.getAutoFitWidth(t,n,e,i,r);return a>0&&(o+=a+It(e,3,!1)+It(e,1,!1)),o},t.prototype.Fn=function(t,n,e,i,r){var o=0,a=this.getAutoFitHeight(t,n,e,i,r);return a>0&&(o+=a+It(e,0,!1)+It(e,2,!1)),o=Math.max(_t(r,e),o),Math.max(Dt(r,e),o)},t.prototype.paintValue=function(t,n,e,i,r,a,u,s){var c,f,l,h=this,d={};s.quotePrefix=u.quotePrefix,(c=this.format(S(n),u.formatter||u._autoFormatter,d,s))&&(c=this.RUr(c,d,u,s),f=new o.Rect(e,i,r,a),this.adjustRectForIconSet(u.hAlign,s.sheet,s.row,s.col,s.sheetArea,f,d.content&&this.hasInfilling(d.content)),e=f.x,r=f.width,l=h.Pn(t,c,u,s,e,i,r,a),this.paintText(t,n,e,i,r,a,u,s,c,d,B,l.externals))},t.prototype.RUr=function(t,n,e,i){var r=(0,o.isIgnoreEndBlank)(e,i),a=t;return t&&t.endsWith(tt)&&r&&(a=(0,o.W3e)(t),(0,o.removeEndSpaceOfFormattedData)(n)),a},t.prototype.Gn=function(t,n,e,i){var r=0;return t>0&&(r=8*t*i),n&&n.Un(e)&&(r=0),r},t.prototype.Ft=function(t,n){return!!(!t||g(t,R)&&t===Y||t&&t.formatString&&t.formatString()===Y)||!(n&&(!isNaN(n)||"TRUE"===n.toUpperCase()||"FALSE"===n.toUpperCase())&&"@"!==t)},t.prototype.Hn=function(t){var n,e=0;for(n=0;n<t.length;n++)e+=t[n].width;return e},t.prototype.Iye=function(t){var n,e,i,r,o,a=t.left,u=t.right;for(n=0,e=a;n<e.length;n++)if((i=e[n]).isStick)return!0;for(r=0,o=u;r<o.length;r++)if((i=o[r]).isStick)return!0;return!1},t.prototype.zn=function(t){var n,e=0;for(n=0;n<t.length;n++)e+=t[n].height;return e},t.prototype.Vn=function(n,e,i,r,o){var a={ctx:n,options:{rect:i,context:e,value:r,style:o}};t.et(e.sheet,"beforePaintLabel",a)},t.prototype.mao=function(n){t.et(n.context.sheet,"beforePaintBackColor",n)},t.prototype.Pn=function(n,e,i,r,a,u,s,c){var f={ctx:n,text:e,rect:new o.Rect(a,u,s,c),style:i,context:r,externals:{left:[],right:[]}};return t.et(r.sheet,"beforePaintText",f),un(f),f},t.prototype.Yn=function(n,e,i,r,a,u,s,c,f){var l={ctx:n,style:e,context:i,textRect:new o.Rect(r,a,u,s),availRect:c};return t.et(i.sheet,f,l),on(f,l),l},t.prototype.Zn=function(t,n,e,i,r,o,a,u){return this.Yn(t,n,e,i,r,o,a,u,"beforeFillTextArea")},t.prototype.Wn=function(t,n,e,i,r,o,a,u){return this.Yn(t,n,e,i,r,o,a,u,"afterFillTextArea")},t.prototype.paintText=function(t,n,e,i,r,a,u,c,f,l,h,d){var v,g,m,b,y,w,M,C,S,T,x,A,k=this;t.save(),t.beginPath(),v=u.textOrientation,g=u.textIndent&&0!==u.textIndent,m=u.hAlign,b=u.isVerticalText&&4!==m,4===m&&(v=0,g=!1),y=c.sheet,w=c.sheetArea,M=y.rowFilter&&y.rowFilter(),C=c.columnHeaderFitMode,!(S=!!(M&&M.rn(c.row,c.col,w)&&M.filterButtonVisible(c.col)))||C!==s.ColumnHeaderFitMode.normal&&C!==s.ColumnHeaderFitMode.vertical||(I(c.cornerX)||(r=c.cornerX-e),r-=y.an(new o.Rect(e,i,r,a),w).width),T=u.wordWrap,x=u.shrinkToFit,A=u.showEllipsis,5===m&&(c.sheet.options.showFormulas&&c.isFormula?(u.hAlign=1,u.wordWrap=!1):u.wordWrap=!0,u.shrinkToFit=!1,u.showEllipsis=!1),n&&n.richText&&n.richText.length>0&&mt(n,f,u.wordWrap)||b?k.Qn(t,n,e,i,r,a,u,c,f,l,h,d):0!==v&&!p(v)&&-90<=v&&v<=90&&!g&&!b?k.Kn(t,n,e,i,r,a,u,c,f,l,h,d):k.Jn(t,n,e,i,r,a,u,c,f,l,h,d),5===m&&(u.hAlign=5,u.wordWrap=T,u.shrinkToFit=x,u.showEllipsis=A),t.restore()},t.prototype.Xn=function(t,n,e,i,r,o,a,u,s,c){var f,l,h,d,v,p,g,m,b,y,w,M,C,S=n.sheet,T=n.row,x=n.col,A=r.vAlign,I=n.sheetArea;for(f=0;f<e.length;f++)if(l=e[f].text,h=i[f].lineHeight,d=1===A?0:u,v=this.qn(t,"0"),p="",(g=o)-1-2-d<l.length*h){if(g<3*v)c.push(0),p=X;else if(m=P((g-1-2-3*v-(1===A?0:u))/h),b=0,0===A){for(y=0;y<m;y++)p+=l[y];w=p.length,3*v+((p+=X).length-3)*h+u>g-1-2?(p=p.substring(0,p.length-4)+X,c.push(p.split(X)[0].length)):c.push(w)}else if(1===A){for(M=0;M<G(m/2);M++)p+=C=l.charAt(M),b=M;for(w=p.length,p+=X,M=G(l.length-m/2);M<l.length;M++)p+=C=l.charAt(M);3*v+(p.length-3)*h+u>g-1-2?(p=p.replace(l[b],""),c.push(p.split(X)[0].length)):c.push(w),s[f].y=a+(o-(3*v+(p.length-3)*h))/2}else{for(c.push(0),y=l.length-1;y>=l.length-m;y--)p=l[y]+p;3*v+((p=X+p).length-3)*h+u>g-1-2&&(p=p.replace(l[l.length-m],"")),s[f].y=a+o-u-(3*v+(p.length-3)*h)-2}e[f].textInfos[0].text=p,S.Ut.$n(T,x,l,I)}else S.Ut.$n(T,x,null,I)},t.prototype.Qn=function(t,n,e,i,r,a,u,s,c,f,l,h){var d,v,p,g,m,b,M,C,S,T,x,A,I,N,j,D,_,O,E,R,L,B,P,G,U,H,V,z,Y,Z,W,Q,K,J,X;if(n&&n.richText&&(n.converted||(n=o.util.g0(n)),n={text:n.text,richText:n.converted}),b=this,M=new o.Rect(e,i,r,a),C=s.sheet?s.sheet.zoom():1,S=s.printZoomFactor,S=st(s)?S:F,T=b.Gn(u.textIndent,s.sheet.outlineColumn,s.col,S?S*C:C),x=s.cellOverflowLayout&&s.cellOverflowLayout.expandedWidth,A=u.hAlign,I=u.formatter||u._autoFormatter,3===A&&(A=y(A,n,I)),j=!!(N=u.isVerticalText&&4!==A)&&w(c),D=u.font,_=b.Ft(I,n&&n.text),O=k(!0,[],b.Pt(n,c,_,D,u.foreColor)),(0,o.resetFillStyle)(t,s.sheet,u,l),n&&n.richText&&n.richText.length>0&&b.te(O,D,C,S),E=0,R=0,h&&(E=b.Hn(h.left),R=b.Hn(h.right),L=b.Iye(h)),B=E+R,P={left:E,right:R,isStick:L},!u.wordWrap&&u.shrinkToFit&&(4===u.hAlign?b.ne(O,x-B,a,u,D,1,N):b.ne(O,r-B,a,u,D,1,N)),G=b.ee(t,c,u.font,N?a:r-B,T,N?u.vAlign:u.hAlign,u.wordWrap,N,O),U=b.re(G,u,A,l),H=b.oe(t,u,e,i,r,a,u.wordWrap,s.cellOverflowLayout,A,T,N,(null===(d=G[0])||void 0===d?void 0:d.textLength)||0,(null===(v=U[0])||void 0===v?void 0:v.lineHeight)||0),V=!1,u.showEllipsis&&N&&n&&!n.richText&&(V=!0),z=[],z=4===A?b.ae(e,i,null===(p=s.cellOverflowLayout)||void 0===p?void 0:p.expandedWidth,a,A,u.vAlign,T,N,j,G,U,P,V,u):b.ae(e,i,r,a,A,u.vAlign,T,N,null!==(m=null===(g=null==s?void 0:s.paintInfo)||void 0===g?void 0:g.rightToLeft)&&void 0!==m?m:j,G,U,P,V,u),Y=G.length,Z=[],V&&f&&(f.content&&1===f.content.length&&"text"===f.content[0].type||!f.content&&1===G.length&&G[0].text)&&this.Xn(t,s,G,U,u,a,i,T,z,Z),1===Y&&f&&!_)b.ue(t,s.sheet,c,f,z[0].x,z[0].y,r,a,A,u,H?H.width:0,H?H.height:0,T,N,G[0].textLength,s,P,M);else{for(Q=(W=b.se(G,z)).textWidth,K=W.textStart,b.Zn(t,u,s,K,z[0].y,Q,0,M),J=r-B-4-2*T,X=0;X<Y;X++)b.ce(t,s.sheet,z[X].x,z[X].y,U[X],A,G[X],Z[X],J,s.cellRect,0===X);b.Wn(t,u,s,K,z[0].y,Q,0,M)}},t.prototype.se=function(t,n){var e,i,r;if(!t||0===t.length||!n||0===n.length)return{textWidth:0,textStart:(null==n?void 0:n[0].x)||0};for(e=t[0].textLength,i=n[0].x,r=0;r<t.length;r++)t[r].textLength>e&&(e=t[r].textLength,i=n[r].x);return{textWidth:e,textStart:i}},t.prototype.qn=function(t,n){return ft(t,n)},t.prototype.fe=function(t,n,e,i,r,o,a){var u,s,c,f,l,h,d,v,p,g,m,b=t.sheetArea,y=e,w=this.qn(i,y),M=t.sheet,C=t.row,S=t.col,T=r,x=0,A=this.qn(i,"0"),I=this.qn(i,X);if(x=I,w>T-1-2-(u=1===o?0:a)){if(s="",2===o)for(c=y.length-1;c>=0;c--){if(x>T-1-2-a){f=s.length,s=X+s.substring(1,f);break}s=(l=y.charAt(c))+s,x+=h=this.qn(i,l)}else if(1===o){for(d=G((T-x)/A),c=0;c<d/2;c++)s+=l=y.charAt(c);for(s+=X,c=P(y.length-d/2);c<y.length;c++)s+=l=y.charAt(c);for(v=this.qn(i,s);v>T-1-2&&s!==X;)g=(p=s.split(X))[0],m=p[1],s=g.length>m.length?g.substring(0,g.length-1)+X+m:g+X+m.substring(1,m.length),v=this.qn(i,s)}else for(c=0;c<y.length;c++){if(x>T-1-2-a){f=s.length,s=s.substring(0,f-1)+X;break}s+=l=y.charAt(c),x+=h=this.qn(i,l)}n.content=[{value:s,type:"text"}],M.Ut.$n(C,S,y,b)}},t.prototype.Jn=function(t,n,e,i,r,u,c,f,l,h,d,v){var g,b,C,S,x,I,k,N,j,E,L,F,B,G,U,H,V,z,Y,Z,K,J,X,q,$,tt,nt,et,it,rt,ot,at,ut,ct,ft,lt,ht,dt,mt,bt,wt,Mt,Ct=this,St=0,Tt=c.textIndent,xt=c.wordWrap,At=c.hAlign,kt=c.vAlign,Nt=c.shrinkToFit,jt=c.textDecoration,Dt="left",_t=2,Ot=2,Et=c.font,Rt=0,Lt=[],Ft=0,Bt=f.sheet,Pt=new o.Rect(e,i,r,u),Gt=f.cellOverflowLayout&&f.cellOverflowLayout.expandedWidth,Ut=f.offsetX;if(Ut||(Ut=0),4===At&&(Tt=0),p(f.fontInfo)&&(f.fontInfo=a.W.x2e(c,Bt.zoom()),st(f)&&(f.fontInfo=a.W.V(f.fontInfo.font,f.printZoomFactor))),g=parseInt(f.fontInfo.fontSize,10),p(f.lineHeight)&&(f.lineHeight=m(a.W.x2e(c,Bt.zoom()).font,!1,w(l))),b=f.lineHeight,(0,o.resetFillStyle)(t,Bt,c,d),C=Bt.zoom()||1,st(f)&&(C*=f.printZoomFactor),Tt>0&&(St=8*Tt*C),Bt.outlineColumn&&Bt.outlineColumn.Un(f.col)&&(St=0),3===At&&(At=y(At,n,c.formatter||c._autoFormatter)),S=1,M(t,Et),x=0,I=0,v&&(x=Ct.Hn(v.left),I=Ct.Hn(v.right),k=Ct.Iye(v)),N=x+I,j={left:x,right:I,isStick:k},!xt&&Nt){for(E=0,L={value:!1},F=void 0,B=0;B<3&&!1===L.value&&(G=t.measureText(l).width,E=W(0,r-4-(1===At?0:St)-N),4===At&&(E=W(0,Gt-4-St-N)),E<G);B++)Et=(F=a.W.V(Et,E/G,L,!0)).font,M(t,Et);F&&(S=g/F.fontSize,g=F.fontSize)}if((U=Bt.parent&&Bt.parent.options.numbersFitMode===s.NumbersFitMode.overflow||!1)||(U=h&&h.content?!(!h.content||1!==h.content.length||"text"!==h.content[0].type):"string"==typeof n),!xt&&!Nt&&c.showEllipsis&&U&&this.fe(f,h,l,t,r,At,St),_t+=St+x,1===At||4===At||5===At?(_t=(r+x-I)/2,Dt=_):2===At&&(_t=r-I-1-2,Dt=D,_t=pt(c,_t-=St)),t.textAlign!==Dt&&(t.textAlign=Dt),H=0,xt&&(H=r-N-(V=gt(c,3))-(1===At||5===At?2*St:St),4===At&&(H=Gt-N-V-St),H-=1,(Ft=(Lt=f.isPrinting?o.q.un(l,H,Et,!1,t):vt(l,H,Et,!1,t)).length)>1&&0!==kt&&(Rt=(Ft-1)*b)),Ot+=b-(Y=b/2-g/2+(z=g>8?P((g-8)/5+2):1)-1),Ot/=S,1===kt?Ot=(u-Rt)/2+b/2-Y:2===kt&&(Ot=u-(Rt+2+Y)/S),t.textBaseline!==O&&(t.textBaseline=O),K=(Z=f.cellOverflowLayout)&&Z.layout,J=4===At&&Bt.options.rightToLeft,X={x:K?J?e+r-K.width:K.x:e+1,y:K?K.y:i+1,width:K?K.width:r-2,height:K?K.height:u-2},Z&&4===At&&(_t+=(Z.expandedWidth-r)/2),_t+=Ut,q=K&&K.width>r||4===At,$=X.x,tt=X.y,nt=X.width,et=X.height,xt)if(t.rect($,tt,nt,et),t.clip(),t.beginPath(),it=i+Ot,Ft>1||5===At)if(rt=e+_t,t.textAlign===_?rt-=H/2:t.textAlign===D&&(rt-=H),at=it,(ot=yn(Lt,b,c)).descenderHeight&&(at+=ot.descenderHeight),f.textRect=new o.Rect(rt,Q(at+(Lt.length-1)*b,i+u),H,Q(ot.height,u)),5===At)ut=_t,ct=2+St+x+Ut,!U&&!A(c.formatter)&&typeof c.formatter===R&&"object"!=typeof n||U&&1===Ft&&!Ct.SAe(Lt[0])?Ct.he(t,l,h,e+ut,i+Ot,1,nt,St,jt,z,g,f,c,j,Pt,q):(Ct.Zn(t,c,f,rt,it,H,b*Ft,Pt),Ct.Z3e(t,Lt,e,it,H,ut,ct,b,c,g,z),Ct.Wn(t,c,f,rt,it,H,b*Ft,Pt));else{for(Ct.Zn(t,c,f,rt,it,H,b*Ft,Pt),B=0;B<Ft;B++)t.direction=yt(c.textDirection,Lt[B]),t.fillText(Lt[B],e+_t,it),jt&&(G=t.measureText(Lt[B]).width,Ct.le(t,jt,e+_t,it,G,g,z)),it+=b;Ct.Wn(t,c,f,rt,it,H,b*Ft,Pt)}else Ct.he(t,l,h,e+_t,i+Ot,At,nt,St,jt,z,g,f,c,j,Pt,q);else lt=(ft=f.ysr=T(t,t.font,l)+N)>nt-(e+1-$)||b>et||0!==Ut,4===At&&(lt=!0),ht=It(c,0),dt=It(c,1),mt=It(c,2),bt=It(c,3),lt||(1===At||4===At?Z&&((wt=ft/2)>Z.backgroundLeftWidth||wt>Z.backgroundRightWidth)&&(lt=!0):(ft+St+ht+mt>nt||Rt+bt+dt>et)&&(lt=!0)),lt&&(t.rect($,tt,nt,et),t.clip(),t.beginPath()),Mt=J?e+r-_t:e+_t,Ct.he(t,l,h,Mt,i+Ot,At,nt,St,jt,z,g,f,c,j,Pt,q)},t.prototype.SAe=function(t){var n=o.q.Q3e(t);return n.length>1||1===n.length&&n[0].prefixSpaceCount>0},t.prototype.Z3e=function(t,n,e,i,r,a,u,s,c,f,l){var h,d,v,p,g,m,b,y,w,M,C,S=n.length,T=i,x=c.textDecoration,A=this,I=r;for(h=0;h<S;h++)if(d=n[h]){if(1===(v=o.q.Q3e(d)).length)t.textAlign=_,t.fillText(d,e+a,T),x&&(p=t.measureText(d).width,A.le(t,x,e+a,T,p,f,l));else for(t.textAlign=j,g=t.measureText(" ").width,m=t.measureText(d).width,b=e+u,y=0,v[0].prefixSpaceCount>0?b+=y=(I-m)/v.length:y=(I-m)/(v.length-1),w=0;w<v.length;w++)b+=(M=v[w]).prefixSpaceCount*g,t.fillText(M.word,b,T),C=t.measureText(M.word).width,x&&A.le(t,x,b,T,C,f,l),b+=C+y;T+=s}else T+=s},t.prototype.Uro=function(t,n,e){var i=_,r=0;return-90===t?e===s.VerticalAlign.top?(i=j,r-=n):e===s.VerticalAlign.bottom&&(i=D,r+=n):90===t&&(e===s.VerticalAlign.top?(i=D,r-=n):e===s.VerticalAlign.bottom&&(i=j,r+=n)),{textAlign:i,yOffset:r}},t.prototype.Kn=function(t,n,e,i,r,u,s,c,f,l,h,d){var v,p,g,m,b,w,C,S,T,x,A,I,k,N,j,D,_,O,E,R,L,F,B,G,Y,Z,K,J,X,q,$,tt,nt,et,it,rt,ot,at,ut,st,ct,ft,lt,ht,dt=this,vt=s.wordWrap,pt=s.hAlign,gt=s.vAlign,mt=s.shrinkToFit,bt=s.textDecoration,yt=2,wt=2,Mt=s.font,Ct=[],St=0,Tt=parseInt(c.fontInfo.fontSize,10),xt=c.sheet,At=new o.Rect(e,i,r,u),kt=c.cellOverflowLayout,Nt=kt&&kt.layout,jt=s&&(s.borderLeft||s.borderTop||s.borderRight||s.borderBottom)&&!xt.getSpan(c.row,c.col,c.sheetArea),Dt=xt.options.rightToLeft&&z(s.textOrientation)<90?-s.textOrientation:s.textOrientation,_t=Dt*Math.PI/180,Ot=z(_t),Et=H(Ot),Rt=U(Ot),Lt=V(Ot),Ft=c.lineHeight,Bt=90===Dt||-90===Dt;if(jt&&(Dt>-90&&Dt<0&&(w=!1),Dt>0&&Dt<90&&(w=!0)),S=(C={x:Nt?Nt.x:e+1,y:Nt?Nt.y:i+1,width:Nt?Nt.width:r-2,height:Nt?Nt.height:u-2}).x,T=C.y,x=C.width,A=C.height,I=Ft/2*U(Ot),k=Ft/2*H(Ot),j=Ft/2-Tt/2+(N=Tt>8?P((Tt-8)/5+2):1)-1,l&&l.content&&l.content.length>0&&!mt&&(f=dt.de(t,l.content,u-4,Mt)),D=xt.Qt(f,Mt),(0,o.resetFillStyle)(t,xt,s,h),3===pt&&(pt=y(pt,n,s.formatter||s._autoFormatter,Dt)),M(t,Mt),_=0,O=0,d&&(_=dt.Hn(d.left),O=dt.Hn(d.right)),!vt&&mt)for(E=0,R={value:!1},L=0;L<3&&!1===R.value&&(E=W(0,(u-4-2*k)/Rt))<D;L++)Mt=a.W.V(Mt,E/D,R,!0).font,M(t,Mt),Tt=null!==(v=s._fontSizeDigit)&&void 0!==v?v:parseInt(c.fontInfo.fontSize,10),D=xt.Qt(f,Mt),I=(Ft=o.mt.vt(Mt))/2*U(Ot),k=Ft/2*H(Ot);if(F=0,B=0,vt)for(B=(u-4-2*k)/Rt,St=(Ct=o.q.un(f,B,Mt,!1,t)).length,D=xt.Qt(Ct[0],Mt),G=0;G<St;G++)(Y=xt.Qt(Ct[G],Mt))>F&&(F=Y);switch(u<=(b=(vt?F:D)*Rt+2*k)&&(gt=2),g=D/2*Et,m=(vt?F:D)/2*Rt,5===pt&&(Dt<0&&(pt=2,Bt&&1===St&&(O=(x-Ft)/2)),Dt>0&&(pt=0,Bt&&1===St&&(_=(x-Ft)/2)),Bt&&St>1&&(Ft=(x-Ft)/(St-1))<c.lineHeight&&(Ft=c.lineHeight)),Z=""+pt+gt){case"00":yt+=g+I+_,wt+=m,Bt||(wt+=k),jt&&(yt=(u-wt)/Lt*(w?1:-1)+(Ft/2+2)/Rt+_);break;case"01":yt+=g+I+_,wt=u/2,jt&&(yt=(u-wt)/Lt*(w?1:-1)+(Ft/2+2)/Rt+_);break;case"02":yt+=g+I+_,wt+=m,Bt||(wt+=k),jt&&(yt=wt/Lt*(w?1:-1)+(Ft/2+2)/Rt+_),wt=u-wt;break;case"10":yt=(r+_-O)/2,wt+=m,Bt||(wt+=k),jt&&(yt+=(w?1:-1)*(u-wt)/Lt);break;case"11":yt=(r+_-O)/2,wt=u/2,jt&&(yt+=(w?1:-1)*(u-wt)/Lt);break;case"12":yt=(r+_-O)/2,wt+=m,Bt||(wt+=k),jt&&(yt+=(w?1:-1)*wt/Lt),wt=u-wt;break;case"20":yt=r-2-g-I-O,wt+=m,Bt||(wt+=k),jt&&(yt=r+(u-wt)/Lt*(w?1:-1)-(Ft/2+2)/Rt-O);break;case"21":yt=r-2-g-I-O,wt=u/2,jt&&(yt=r+(u-wt)/Lt*(w?1:-1)-(Ft/2+2)/Rt-O);break;case"22":yt=r-2-g-I-O,wt+=m,Bt||(wt+=k),jt&&(yt=r+wt/Lt*(w?1:-1)-(Ft/2+2)/Rt-O),wt=u-wt}if(vt)if(K=e+yt,J=Ft/Rt,X=void 0,90===Math.abs(Dt)&&(tt=D*St+(q=It(s,1))+($=It(s,3))>x)&&(t.rect(S,T,x,A),t.clip()),St>1){for(1===pt&&(K-=(nt=St%2!=0)?J*(St-1)/2:J*(St/2)-.5*J),it=(et=Zt(K,i+wt,D,_t,Ft)).width+J*(St-1),rt=et.height,ot=et.y,at=et.x-J*(St-1),c.textRect=new o.Rect(at,Q(i+2*wt,At.y+At.height),it,2*wt-Ft/2),dt.Zn(t,s,c,at,ot,it,rt,At),st=(ut=dt.Uro(Dt,m,gt)).textAlign,ct=ut.yOffset,-90===Dt&&!1===(null===(p=null==c?void 0:c.paintInfo)||void 0===p?void 0:p.rightToLeft)&&(Ct=Ct.reverse()),L=0;L<St;L++)X=L,(s.textOrientation>0&&2===pt||s.textOrientation<0&&(0===pt||1===pt))&&(X=St-L-1),dt.ve(t,_t,Ct[X],K,i+wt+ct,bt,Tt,N,j,st),K=2===pt?K-J:K+J;dt.Wn(t,s,c,at,ot,it,rt,At)}else dt.me(t,f,e,i,yt,wt,c,s,D,_t,bt,Tt,N,Ft,j,At);else ft=D*Rt+Tt*Rt+2,lt=It(s,0),ht=It(s,2),(tt=ft>A-(i+1-T)||Ft>A||ft+lt+ht>A)&&(t.rect(S,T,x,A),t.clip()),dt.me(t,f,e,i,yt,wt,c,s,D,_t,bt,Tt,N,Ft,j,At)},t.prototype.me=function(t,n,e,i,r,u,s,c,f,l,h,d,v,p,g,m){var b,y=this,w=Zt(e,i,f,l,p),M=w.width,C=w.height,S=w.x,T=w.y;(a.W.qme(c)||a.W.$me(c))&&(b=z(l),S=e+r-(M=f*H(b)+p*U(b))/2,T=i+u-(C=f*U(b)+p*H(b))/2),s.textRect=new o.Rect(S,Q(T+C,m.height+m.y),M,C),y.Zn(t,c,s,S,T,M,C,m),y.ve(t,l,n,e+r,i+u,h,d,v,g),y.Wn(t,c,s,S,T,M,C,m)},t.prototype.te=function(t,n,e,i){Yt(t,n,e,i)},t.prototype.ne=function(t,n,e,i,r,o,u){var s,c,f,l=0,h={value:!1};for(s=0;s<3&&!1===h.value&&(c=Ct(t,r,o,u),l=W(0,(u?e:n)-4),(u?i.vAlign:1!==i.hAlign&&i.textIndent)&&(l=W(0,l-8*i.textIndent*o)),l<c);s++)for(f=0;f<t.length;f++)t[f].style.font=a.W.V(t[f].style.font,l/c,h,!0).font},t.prototype.Pt=function(t,n,e,i,r){var o=t&&t.richText;return!p(o)&&e||(o=[{style:{font:i,foreColor:r},text:n}]),o},t.prototype.oe=function(t,n,e,i,r,o,a,u,s,c,f,l,h){var d,v=u&&u.layout,p={x:v?v.x:e+1,y:v?v.y:i+1,width:v?v.width:r-2,height:v?v.height:o-2},g=p.x,m=p.y,b=p.width,y=p.height;return(a||(d=this.ge(n,s,n.vAlign,e,i,y,b,g,m,l,h,c,f,u)))&&(t.rect(g,m,b,y),t.clip(),t.beginPath()),p},t.prototype.ge=function(t,n,e,i,r,o,a,u,s,c,f,l,h,d){var v,p,g=It(t,0),m=It(t,1),b=It(t,2),y=It(t,3);return h?(!(v=c>o-(r+1-s)||f>a)&&1!==e&&c+l+g+b>o||f+y+m>a)&&(v=!0):(v=c>a-(i+1-u)||f>o)||(1===n?d&&((p=c/2)>d.backgroundLeftWidth||p>d.backgroundRightWidth)&&(v=!0):(c+l+y+m>a||f+g+b>o)&&(v=!0)),v},t.prototype.ee=function(t,n,e,i,r,u,s,c,f){var l,h,d,v,p;if(i=1===u||5===u?i-3-2*r:i-3-r,s&&n)return o.q.Ht(n,i,e,f,c,t);for(l=0,h=0;h<f.length;h++)d=f[h].text,c?l+=b(f[h].style.font,d)*(d?d.length:0):(v=a.W.V(f[h].style.font,1),p=f[h].style.vertAlign?v.fontSize*K+"px "+v.fontFamily:f[h].style.font,l+=T(t,p,d));return[{textLength:l,text:n,textInfos:f}]},t.prototype.ue=function(t,n,e,i,r,o,u,s,c,f,l,h,d,v,p,g,m,b){var y,w=a.W.x2e(f,1).fontSize,M=w>8?P((w-8)/5+2):1;this.pe(t,n,f),v?this.be(t,e,i,f,r,o,h,d,h,g,m,