/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):(t="undefined"!=typeof globalThis?globalThis:t||self,o(t.exontrol||{}))}(this,function(t){"use strict";function o(){return Math.max.apply(0,arguments)}function i(){return Math.min.apply(null,arguments)}function e(t){return null!=t}function r(t){return t instanceof s.Pivot}function n(t,o){var i=new s.Lay.Container(t,o);return i.local=!0,i}var s=s||window.exontrol,a=s.G;s.Mrg(s,function(){function t(t,o){this.init(t,o)}return Object.addPrototypeOf(t.prototype,s.Tree.prototype),t.version="3.2",t.type="Pivot",t.Def={filter:"filter",excludeFilter:"exclude"},t.PivotBarVisibleEnum={exPivotBarHidden:0,exPivotBarVisible:1,exPivotBarSizable:2,exPivotBarFloat:4,exPivotBarAutoFit:8,exPivotBarShowTotals:16,exPivotBarAutoHide:32,exPivotBarAllowValues:64,exPivotBarAllowFormatAppearance:128,exPivotBarAllowFormatConditionalAppearance:16777216,exPivotBarAllowFormatContent:256,exPivotBarAutoUpdate:512,exPivotBarAllowUndoRedo:1024,exPivotBarAllowResizeColumns:2048,exPivotBarHideAddNew:4096,exPivotBarContextSortAscending:65536,exPivotBarContextSortReverse:1048576,exPivotBarReadOnly:268435456},t.prototype.init=function(o){return function(i,e){o.call(this,i,e),this.oCW.SetCanvas=function(o){return function(){var i=[this],e=arguments;this.oT instanceof t&&(i=this.oT.all().map(function(t){return t.oCW})),i.forEach(function(t){o.apply(t,e)})}}(this.oCW.SetCanvas),this.Aggregates=s.Tree.CellF.Total.Agg,this.oFC=new t.FormatContents(this),this.oFA=new t.FormatAppearances(this),this.oFCA=new t.FormatConditionalAppearances(this),this.oLF=null,this.addR(i,e),this.oR&&this.showP()}}(t.prototype.init),t.prototype.iLts=function(t){return function(){t.apply(this,arguments),this.oLts.add("ondolayout")}}(t.prototype.iLts),t.prototype.initCW=function(t){function o(){return s.Tree.TV.rurColEF()}return function(){var i=t.apply(this,arguments),e=this.oTV,r=this.oCW,n=(r.W("control")||r).Add("pivotbar",{Dock:1,Control:this.oPB=new s.Tree.TV.PivotBar(e)});return n.GetVisible=e.showPB.bind(e),n.GetResizable=e.sizePB.bind(e),this.aSizeW(n),this.aHideW(n),function(){this.oCW.onHovI=function(t){return function(){t.apply(this,arguments),this.oT.visP().oPB.onmIO(!1)}}(this.oCW.onHovI),this.oCW.onHovO=function(t){return function(){t.apply(this,arguments),this.oT.visP().oPB.onmIO(!0)}}(this.oCW.onHovO)}.call(this),this.addCFB("pivotfloatbar",this.oPCFB=new s.Tree.TV.PivotFloatBar(e),"showPCFB",{Dock:4}),function(){this.oCW.rurEv=function(t){return function(){return t.apply(this,arguments)||o()}}(this.oCW.rurEv);var t=this.CC();t.rurEv==s.CC.prototype.rurEv&&(t.rurEv=function(t){return function(){return t.apply(this,arguments)||o()}}(t.rurEv))}.call(this),i}}(t.prototype.initCW),t.prototype.defAA=function(t){return function(){return t.apply(this,arguments)+",format(RButton)"}}(t.prototype.defAA),t.prototype.srur=function(t){return function(){t.apply(this,arguments);var o=this.oCW.W("pivotfloatbar");o&&(o.bR2d=!0)}}(t.prototype.srur),t.prototype.resLCV=function(t){return function(){this.oPB.resHVO(),this.oPCFB.resHVO(),t.apply(this,arguments)}}(t.prototype.resLCV),t.prototype.onSCR=function(t){return function(){t.apply(this,arguments),this.alignCFBN("pivotfloatbar")}}(t.prototype.onSCR),t.prototype.ondrop=function(t){return function(){var o=this.src();o.showP(),t.apply(o,arguments)}}(t.prototype.ondrop),t.prototype.onmFI=function(t){return function(){if(this.oI.rgFI){var o=this.oI.mFI,i=new Map;this.oI.rgFI.forEach(function(t){(!o||o.has(t))&&i.set(t,1)},this),this.oI.mFI=i}return t.apply(this,arguments)}}(t.prototype.onmFI),t.prototype.fU=function(t){return function(){t.apply(this,arguments),!this.oR&&this.vF(!0)&&this.oC.GetCount()&&this.format()}}(t.prototype.fU),t.prototype.onLoad=function(t){return function(){this.oPB.onPL(),t.apply(this,arguments)}}(t.prototype.onLoad),t.prototype.onlayout=function(t){return function(o){var i=o.IsSave();i||(this.oLts.lock(),this.lES++,this.bU()),t.apply(this.visP(),arguments),o.local||(i?(o.Add("pr",this.GetPivotRows()),o.Add("pc",this.GetPivotColumns()),o.Add("pt",this.GetPivotTotals())):(this.SetPivotRows(o.GetValue("pr")),this.SetPivotColumns(o.GetValue("pc")),this.SetPivotTotals(o.GetValue("pt")))),i||(this.eU(),--this.lES,this.oLts.unlock())}}(t.prototype.onlayout),t.prototype.BeginUpdate=function(){this.oPB.bU(),this.all().forEach(function(t){s.Tree.prototype.bU.call(t)})},t.prototype.bU=t.prototype.cwbU=t.prototype.BeginUpdate,t.prototype.EndUpdate=function(){this.all().forEach(function(t){s.Tree.prototype.eU.call(t)}),this.oPB.eU()},t.prototype.eU=t.prototype.cweU=t.prototype.EndUpdate,t.prototype.Update=function(t,o){this.bU(),t&&t.call(o||this),this.eU()},t.lR=0,t.prototype.addR=function(o,i){if(!t.lR++){this.oR=new t(o,i),this.oR.opR=this,this.oR.oLts=this.oR.oTV.oLts=this.oLts,["Add","Remove","RemoveOf","Clear","Lock","Unlock"].forEach(function(t){this.oCW.oSts.oT=this,this.oCW.oSts[t]=function(t){return function(){t.apply(this,arguments),t.apply(this.oT.oR.oCW.oSts,arguments)}}(this.oCW.oSts[t])},this),this.oCW.SetSBs=function(t){return function(){t.apply(this,arguments),t.apply(this.oT.oR.oCW,arguments)}}(this.oCW.SetSBs),Object.defineProperty(this,"ScrollBars",{set:this.SetScrollBars=this.oCW.SetSBs.bind(this.oCW)}),this.oR.Aggregates=this.Aggregates,["onRL","resLCV","oCW.onUI"].forEach(function(t){function o(t,o){for(var i=o.split("."),e=0,r=i.length;e1?t.apply(this,arguments):null}}(this.oR.oC.getTC)}t.lR--},t.prototype.onCol=function(){this.all().forEach(function(t){t.oPB.onPL(),t.oPCFB.resHVO()})},t.prototype.GetCanvas=function(){return this.oCW.GetCanvas()},t.prototype.CC=function(){return s.CC.c2CC(this.GetCanvas())},t.prototype.showP=function(t){var o=(t=t||this).oCW,i=this.CC(),e=i&&!(1==i.rgC.len()&&i.rgC.first()==o)&&i.rgC||null;if(e){var r,a=o.CWs(),h=[],l=new s.Arr;if(e.forEach(function(t){t!=o&&h.push(t),t.CWs().forEach(function(t){l.push(t.ctx),s.EShow(t.canvas,a.has(t)),t._ctx=t.ctx,t.ctx=null})}),l.forEach(function(t){t.gAO()&&t.gAO().clear()}),e.removeRange(h),e.add(o),r=h[0],a.forEach(function(t){s.EShow(t.canvas,!0),t.CWs().forEach(function(t){t.ctx=t._ctx||t.ctx,t._ctx=void 0})}),r&&(!function(t,o){var i=t.Column(0),e=o.Column(0);i&&e&&e.SetWidth(i.getWidth()),o.oPB.npW=t.oPB.npW,o.oPB.resHVO()}(r.oT,t),o.oPtr=r.oPtr),i.resize(),r){o.lHovWC();var c=n(null,"*hscroll *vscroll");c.bSv=!0,r.onlayout(c),c.bSv=!1,o.onlayout(c),o.uHovWC(!0)}}},t.prototype.isVisP=function(){var t=this.CC();return t&&t.rgC.has(this.oCW)||!1},t.prototype.visP=function(){var t=this.CC();return(t&&t.rgC.first()||this.oCW).oT||this},t.prototype.src=function(){return this.opR||this},t.prototype.run=function(){return this.oR||this},t.prototype.all=function(){return[this.src(),this.run()]},t.prototype.showD=function(t){var o=this.src(),i=this.run(),e=this.visP(),r=t?o:i;e._scr=e.GetScrollPos(),r.bU(),o.oI.rgFI=t,o.onFilter(),o.showP(r),r.SetScrollPos(r._scr),r.eU()},t.prototype.showS=function(){return this.showD(null)},t.prototype.ISOf=function(t,o){var i=t&&t.rgIS;if(i&&o){var e=[],r=o.length;i.forEach(function(t){(function(t){for(var i,e=!0,n=0;e&&n("+a+")"),a},t.prototype.addPT=function(t,o,i,e){var r=(t?this.oI:this.LIOf(o)).Add({parent:t,value:this.capPC({t:i}),sortable:!1,selectable:!1});r.oAgg=i;for(var n,s=this.oC.GetCount(),a=1;a=0&&function(){return h.GetCount()=0){var s=(i=i||new Map).get(n);!s&&i.set(n,s={}),s[t]=o}}},this)},this),i&&h.forEach(function(t){var e=i.get(t.getLevel());e&&(o.call(this,t,e,!1),o.call(this,t,e,!0))},this)}}.call(this))}this.format(!0),function(t){t.bSv=!1,this.onlayout(t)}.call(this,s),this.eU(),this.oLts.unlock()},t.prototype.format=function(t){var o="content",i=this.src().aggDefFmt(),e=this.GetConditionalFormats(),r=this.getL(),n=this.oC.GetCount();this.bU(),e.Clear(),!t&&function(){(function(){this.oC.forEach(function(t){t.oAgg&&t.SetFormat(i)})}).call(this),function(){[this.oI,this.oIT,this.oIB].forEach(function(t){t.forEach(function(t){t.GetShape()&&t.SetShape(null);for(var o,i=0;i=0){var r=t.substr(e+1).trim().toLowerCase();i="a"==r?1:"d"==r?2:0,t=t.substr(0,e)}return(o=a.Item(t))&&{c:o,s:i||0}}function n(){i&&i.r&&(this.r=function(t){var o=null;return t&&a.GetCount()&&t.splitP(",").forEach(function(t){if(t=t.trim()){var i=s.B.split(t)[0]||{},e=r(i.caption);e&&(e.s=e.s||1,e.o=i.flags,(o=o||new s.Pivot.CAr).add(e))}},this),o&&(o.t="row"),o}.call(this,i.r),this.c=this.r&&function(t){var o=null,i=this.oS.oPB.allowV();return t&&a.GetCount()&&t.splitP(",").forEach(function(t){if(t=t.trim()){var n,a=t.splitP("/"),h=s.B.split(a[0])[0]||{},l=r(h.subText),c=h.caption.trim();if(e.call(this,c)&&l){if(l.a=c,l.o=h.flags,l.s=0,n={a:l,v:new s.Pivot.CAr},i)for(var u=1,p=a.length;u=0&&c=0},Object.addPrototypeOf(i.prototype,s.Arr.prototype),i.prototype.add=function(t){return function(o){var i=null;return!this.lA&&o instanceof s.Pivot.Layout&&(this.removeAt(this.iQ+1,this.len()-this.iQ),i=t.call(this,o.encPL()),this.iQ=this.len()-1),i}}(i.prototype.add),i.prototype.doQ=function(t){var o=this.at(this.iQ);return o&&(this.lA++,t.oPB.bL(),t.cwbU(),t.SetPivotRows(o.r),t.SetPivotColumns(o.c),t.SetPivotTotals(o.t),t.cweU(),t.oPB.eL(!1),this.lA--),e(o)},i.prototype.canUndo=function(){return this.len()&&this.iQ>0},i.prototype.undo=function(t){this.canUndo()&&(--this.iQ,this.doQ(t))},i.prototype.canRedo=function(){return this.iQ+1 0"}]},Object.addPrototypeOf(l.prototype,r.prototype),l.prototype.isValid=function(t){return function(o){return t.apply(this,arguments)&&s.Tree.CellF.Create(s.ToS(o.expression)).IsValid()}}(l.prototype.isValid),l.prototype.def=function(){return[{key:"numeric",expression:"int(value) = value ? (value or `0`) : (value format ``)"},{key:"currency",expression:"currency(value)"},{key:"date",expression:"date(value)"}]},c.prototype.encPL=function(){function t(t){return s.ToS(t,"")}function o(t){return s.B.quoteF(t)}function i(i,e,r){var n="";return n+=t(i),n+=function(t){var o="";return t&&(1==t?o=":A":2==t&&(o=":D")),o}(e),n+=o(r)}var e={r:function(t){var o="";return t&&t.forEach(function(t){o&&(o+=","),o+=i(t.c.GetIndex(),2==t.s&&t.s||null,t.o)}),o}.call(this,this.r),c:function(e){var r="";return e&&e.forEach(function(e){e.a&&(r&&(r+=","),r+=e.a.a,r+="(",r+=t(e.a.c.GetIndex()),r+=")",r+=o(e.a.o),e.v.isEmpty()||(r&&(r+="/"),e.v.forEach(function(t,o){o&&(r+=";"),r+=i(t.c.GetIndex(),t.s,t.o)})))}),r}.call(this,this.c),t:function(t){function i(t){var i="";return t&&t.forEach(function(t,e){var r=e&&"("+e.GetIndex()+")"||"";t.forEach(function(t){i&&(i+=","),i+=t.a,i+=r,i+=o(t.o)})}),i}var e="";return t&&(e+=i(t.d),t.u&&(e+="/",e+=i(t.u))),e}.call(this,this.t)};return e.r||(e.c=""),e.c||(e.t=""),e},c.prototype.isEmpty=function(){return!this.r},c.prototype.cmpPO=function(t){function o(t,o){(h=t&&o&&t.c==o.c&&t.s==o.s&&s.ToS(t.a)==s.ToS(o.a)&&function(t,o){return(t&&t.get(n)||"")==(o&&o.get(n)||"")&&(t&&t.has(a)?1:0)==(o&&o.has(a)?1:0)}(t.o,o.o))&&l.set(o,t)}function i(t,i){if((h=!!t==!!i)&&t&&(h=t.len()==i.len()))for(var e=0,r=t.len();h&&e↻"}},t.apply(this,arguments)}}(r.prototype.init),r.prototype.isClkAble=function(){return this.oTV.isClkAble()},r.prototype.setTimeout=function(){return s.setTimeout.apply(this,arguments)},r.prototype.onsize=function(t){return function(){var o=this.resHVO;this.resHVO=function(){},t.apply(this,arguments),this.resHVO=o}}(r.prototype.onsize),r.prototype.onmIO=function(t){this.autoAddNew()&&(this.hmIO&&clearTimeout(this.hmIO),this.hmIO=this.setTimeout(function(){this.invHVO()},t?512:256))},r.prototype.isHov=function(){return this.oW==this.oW.oCW.oHovW},r.prototype.ondown=function(t){return function(o){if(o.altKey&&o.ctrlKey){var i=this.oTV.oT;return i.showP(i.oR||i.opR),!0}return t.apply(this,arguments)}}(r.prototype.ondown),r.prototype.showGlyphs=function(t){return function(){var o=t.apply(this,arguments);return o.e=!1,o}}(r.prototype.showGlyphs),r.prototype.onAObj=(r.prototype.onAObj,function(t,o){var i;o.t&&function(o){var e=this.toShapes(this.getType("total"));e&&(!s.EyO(e.hover)&&t.set({owner:this,id:o.idAOH||(o.idAOH={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2T([t,e])},duration:this.getSmooth()}),!s.EyO(e.click)&&t.set({owner:this,id:o.idAOC||(o.idAOC={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2T([t,e])},actOn:i==o?1:4,duration:this.getSmooth()}))}.call(this,o),o.n&&function(o){var e=this.toShapes(this.getType("addNew"));e&&(!s.EyO(e.hover)&&t.set({owner:this,id:o.idAOH||(o.idAOH={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2N([t,e])},duration:this.getSmooth()}),!s.EyO(e.click)&&t.set({owner:this,id:o.idAOC||(o.idAOC={}),inv:this.inv,hitTest:function(t,e){return i?i==o:this.isAP(t,e)&&o==this.p2N([t,e])},actOn:i==o?1:4,duration:this.getSmooth()}))}.call(this,o)}),r.prototype.alignBR=function(t,o){if(t&&t.length){o=o||this.dclient;var i=this.getPad(),e=i[0],r=i[1],n=s.ROf(o)-e,a=s.BOf(o)-r;t.forEach(function(t){t&&(n=(t[0]=n-t[2])-e,t[1]=a-t[3])})}},r.prototype.drawH=function(t){return function(o,i){function e(t){var o=r.get(t);o&&s.push(o)}var r=this.getHVO().lock,n=this.src().oPB,s=[];e(n.btnR),e(n.btnT),this.dclient=i,this.alignBR(s),t.apply(this,arguments),this.drawTGL(o,r.rgTL)}}(r.prototype.drawH),r.prototype.drawCH=function(t){return function(o,i,r,n){function h(e){var r=e.c;if(r){var a=r.isSort,h=r.getCaption,l=r.hasFilter;r.getCaption=function(){var t=this.oC.oT.src(),o=t.capPC(e),i=t.capFO(e,!0);return o+(i?" "+i:"")},r.isSort=function(){return e.s},r.hasFilter=function(){return e.o&&e.o.has(s.Pivot.Def.filter)},t.call(this,o,i,e,n),r.isSort=a,r.hasFilter=l,r.getCaption=h}return r}(function(t){return t.t&&(this.drawT(o,i,t,n)||t.t)||null}).call(this,r)||function(t){var i=null;if(t.a&&(i=t.c)){var e=i.gCnt,r=this.showGlyphs,s=this.hasAG(t);s&&(i.gCnt=function(t,o){return(t=t.slice())[2]-=s.rtG[2],e.call(this,t,o)}),this.showGlyphs=function(){},h.call(this,t),s&&this.drawAG(o,s.rtG,s,n),this.showGlyphs=r,i.gCnt=e}return i}.call(this,r)||h.call(this,r)||function(t){var e=null;return t.tc&&(e=t.tc.c)&&o.drawHTMLText(this.oTV.oT.capPC(t),s.PRt(i.slice(),this.getPad(),-1),e.getFormatText()),e}.call(this,r)||function(t){return e(t.id)&&(this.drawID(o,i,t,n)||t)||null}.call(this,r)||function(t){return t.n&&(this.drawN(o,i,t,n)||t.n)||null}.call(this,r)||function(t){var e,r=s.ToS(t);if(e=r.sWith("h")){var n="h"==r,h=a.R2C(i,36);this.drawGL(o,a.R2C(i,33),h,n),n&&this.drawGL(o,h,[a.X(a.R2C(this.dclient,36)),a.Y(h)])}return e}.call(this,r)||function(t){var e,r=s.ToS(t);if(e=r.sWith("v")){var n="v"==r,h=a.R2C(i,18);this.drawGL(o,h,[a.X(h),a.Y(a.R2C(this.dclient,66))],n)}return e}.call(this,r)||o.drawFrameRect(s.IRt(i.slice(),2,2))}}(r.prototype.drawCH),r.prototype.drawGL=function(t,o,i,e){t.save(),t.beginPath(),this.oTV.pGL(t),e&&(t.strokeStyle="#000000",t.strokeStyle="rgba(0,0,0,0.5)",t.setLineDash([]),t.lineWidth+=.5),t.moveTo(a.X(o),a.Y(o)),t.lineTo(a.X(i),a.Y(i)),t.stroke(),t.restore()},r.prototype.drawTGL=function(t,o){function e(t,i){for(var e,r=i,n=o.len();i=t;i++)r=i;return r}var r=1;if(o.len()>1)for(var n,s,h=this.oTV.getIndent(),l=0,c=o.len();l0){var u=o.at(l),p=o.at(s),f=a.R2C(u.rtL,33),v=a.R2C(p.rtL,33),d=i(a.X(f)+h*u.d,a.X(v)+h*p.d)-h/2,g=a.Y(f),y=a.Y(v);this.drawGL(t,[d,g],[d,y],!0),this.drawGL(t,[d,g],[d+h/3,g],!0),this.drawGL(t,[d,y],[d+h/3,y],!0)}r++}},r.prototype.drawT=function(t,o,i,e){if(i&&i.t){var r,n=this.t2Inf(i),a=this.getPad(),h=this.toShapes(n.s)||{},l=h.normal||h,c=n.e,u=this.oTV.oT.src(),p=u.capPC(i),f=u.capFO(i,!0);c?e&&(s.EyO(h.hover)||(r=e.get(this,i.idAOH))&&(l=s.R.Shape(r.state,r.range,{from:l,to:h.hover})),s.EyO(h.click)||(r=e.get(this,i.idAOC))&&(l=s.R.Shape(r.state,r.range,{from:l,to:h.click}))):s.EyO(h.disabled)||(l=s.Inh(h.disabled,l)),function(o,i,r){t.drawShape(o,l,{text:i,formatText:n.b?5:this.oTV.getFormatText(),padText:[-a[0],-a[1]],clientText:r?"[,,width-"+r.rtG[2]+a[1]+"]":null}),r&&this.drawAG(t,r.rtG,r,e)}.call(this,o,p+(f?" "+f:""),this.hasAG(i))}},r.prototype.drawN=function(t,o,i,e){function r(o){function i(t,o,i,e){var r=s.IRt(i.slice(),.2*-i[2],.2*-i[2]),n=t.lineWidth,a=function(t){if(t){var o=s.C.Convert(t);t=s.C.C2S(255-o.r,255-o.g,255-o.b,o.a)}return t}(this.fillColor)||"black";t.lineWidth=2,t.drawHLine([r[0],r[1]+r[3]/2],r[2],a),t.drawVLine([r[0]+r[2]/2,r[1]],r[3],a),t.lineWidth=n}var e=!h.text&&!h.draw;e&&(h.draw=i),t.drawShape(o,h),e&&(h.draw=null)}if(i&&i.n){var n,a=this.toShapes(this.getType("addNew"))||{},h=a.normal||a;this.isEnabled()?e&&(s.EyO(a.hover)||(n=e.get(this,i.idAOH))&&(h=s.R.Shape(n.state,n.range,{from:h,to:a.hover})),s.EyO(a.click)||(n=e.get(this,i.idAOC))&&(h=s.R.Shape(n.state,n.range,{from:h,to:a.click}))):s.EyO(a.disabled)||(h=s.Inh(a.disabled,h)),r.call(this,o)}},r.prototype.drawAG=function(t,o,i,e){if(o){var r=this.toShape(this.getType("aggregate"),!i.e)||{};t.drawShape(o,r,{text:s.ToS(r.text,"Σ")})}},r.prototype.drawID=function(t,o,i,e){if(o){var r=this.toShape(this.getType("idem"))||{};t.drawShape(o,r,{text:s.ToS(r.text,"”")})}},r.prototype.getCursor=function(t){return function(o){var i=t.apply(this,arguments);if(this.isClkAble()&&!i){var e,r=this.getCursors();(e=this.p2N(o))?i=s.GP.Get(this.getType("addNew"),r):((e=this.p2AG(o))&&e.e&&(i=s.GP.Get(this.getType("aggregate"),r)),!i&&(e=this.p2T(o))&&(i=s.GP.Get((this.t2Inf(e)||{}).s,r)))}return i||null}}(r.prototype.getCursor),r.prototype.p2CR=function(t){return this.isClkAble()&&this.allowCR()&&function(t){var o=this.p2Vl(t);return o&&{c:{o:this,i:~~o.substr(1),c:this.i2C(~~o.substr(1))instanceof s.Tree.Column,getWidth:function(){var t=this.o.gpWidth(this.i);if(!this.c)for(var o=1;o=h&&r<(h=s.ROf(o))&&(l=c);return l},r.prototype.rtPCxOf=function(t,i){var e,r=this.getL(),n=this.getHVO().lock,a=n.get("v"+(t||""));if(a){var h,l,c=this.oTV,u=this.getPad(),p=u[0],f=u[1],v=this.gpWidth(t),d=c.getIndent(),g=c.getHeaderHeight(),y=[s.ROf(a)-v+p,f,v-2*p,g];switch(i){case"all":(e=y.slice())[3]=o(0,this.rtCA(this.GetClientRect())[3]-2*f);break;case"new":t?(h=r.c&&r.c.item(t-1))?(e=n.get(h.a),(l=n.get(h.v.last()))&&((e=s.ORt(l.slice(),d,g+f))[2]-=d)):e=s.ORt(y.slice(),0,(g+f)*(r.l.uC-1)):(l=r.r&&n.get(r.r.last()))?(e=s.ORt(l.slice(),d,g+f))[2]-=d:e=y.slice();break;case"agg":t&&(e=(h=r.c&&r.c.item(t-1))?n.get(h.a):s.ORt(y.slice(),0,(g+f)*(r.l.uC-1)))}}return e},r.prototype.p2PLx=function(t,o){var i=-1;if(o)for(var e,r=this.ptCA(t),n=this.GetScroll(),h=a.Y(r)-n.y,l=this.getHVO().lock,c=0,u=o.len();c=s.TOf(e=l.get(o.item(c)));c++)i=c,h>s.BOf(e)&&i++;return i},r.prototype.p2TL=function(t,r){function n(t,r){function n(t){var o=a.at(t);return o&&o.o.t&&o}var s,a=this.getHVO().lock.rgTL,h=a.len(),l=a.at(t),c=l&&l.d||0;if(h&&e(r)&&t>=0&&(!l||l.o.t)){if(t>=h-1)s={m:0,M:a.at(i(t,h)-1).d};else{var u=n(i(t,h)-1),p=n(i(t,h)+1),f=u||p,v=u&&p;f&&(s={m:i(v?u.d:c,v?p.d:f.d),M:o(v?u.d:c,v?p.d:f.d)})}s&&(c=o(i(o(0,~~r),s.M),s.m))}return c}var h=this.oTV.getIndent(),l=h&&e(r)?~~(this.scaled(r-this.GetClientRect()[0])/h):void 0,c=this.getL().t?function(t){var o=this.ptCA(t),i=this.GetScroll(),e=a.Y(o)-i.y,r=-1;return this.getTL().forEachU(function(t){if(e>=s.TOf(t.rtL))return r=t.l,e>=s.BOf(t.rtL)&&r++,e=s.LOf(t)-r&&n=0:!(i.tlx==v.tlx&&i.d==v.d))&&(a={a:p?"pivot-addtot":"pivot-postot",h:l,o:n,tlx:v.tlx,d:v.d,rtD:h.h2V(this,r(v.rtD))})}}else if(u)a={a:"pivot-delcol",h:l,o:i.o};else if(i.o&&i.o.a&&e.pcx>0&&i.pcx>0)i.pcx!=e.pcx&&(a={a:"pivot-pcxcol",h:l,o:i.o,pcx:i.pcx,tcx:e.pcx,rtD:h.h2V(this,r(this.rtPCxOf(e.pcx,"agg")))});else{var d=this.getL(),g=d.r,y=d.c;if(g){var C=e.pcx,T=1+(y&&y.len()||0);if(C<0||C==T)a={a:"pivot-aggcol",h:l,c:i.c,rtD:h.h2V(this,r(this.rtPCxOf(T,"new")))};else{var P,m,w=C?y.item(C-1).v:g;((m=!w.has(i))||w.oHas(e.o)&&i.c!=e.c)&&(a={a:m?"pivot-addcol":"pivot-poscol",h:l,c:i.c,car:w,p:P=o(0,this.p2PLx(this.gPtr(t),w)),rtD:h.h2V(this,r(P=0)&&(p=i.car.item(u),i.car.setPos(p,i.p));break;case"pivot-addcol":var p=i.car.add({c:i.c});(e=!!p)&&i.car.setPos(p,i.p);break;case"pivot-delcol":h.oHas(n)&&(e=h.remove(n))||l&&l.forEachU(function(t){return e=t.a==n&&l.remove(t)||t.v.oHas(n)&&t.v.remove(n)});break;case"pivot-pcxcol":(e=!!l)&&(l.item(i.tcx-1)?l.setPos(l.item(i.pcx-1),i.tcx-1):l.add(s.Cpy(l.item(i.pcx-1))));break;case"pivot-deltot":var f=i.o.t,v=a.t2O(f);e=!(!v||!v.o.remove(f));break;case"pivot-addtot":case"pivot-postot":var f=i.o.t,d=(a.t2O(f)||{}).o,g=a.tlx2O(this.getTL(),i.tlx,i.d);(e=!!g)&&(g.o!=d&&(d&&d.remove(f),g.o.add(f)),g.o.setPos(f,g.p))}this.eL(e)}},r.prototype.onRurScrollD=function(t){t.dx=0,t.dy=0},r.prototype.defSts=function(t){return function(o){t.apply(this,arguments),this.oTV.isDef()&&(o.Add("CTRL + Z",this.undo,this,"undoes the last action within the pivot rows, columns or totals"),o.Add("CTRL + Y",this.redo,this,"redoes the last undo action within the pivot rows, columns or totals"))}}(r.prototype.defSts),r.prototype.c2Vrt=function(t){var o=this.GetCanvas(),i=this.GetClientRect(),e=s.EArtC(o),r=s.CSSzom(o);return[e[0]+i[0]+t[0]/r,e[1]+i[1]+t[1]/r,t[2]/r,t[3]/r]},r.prototype.onlayout=function(t){if(!t.local){var o,i;t.IsSave()?(o=this.aSize())&&(t.Add("aw",o.width),t.Add("ah",o.height)):(e(i=t.GetValue("aw"))&&((o=o||{}).width=i),e(i=t.GetValue("ah"))&&((o=o||{}).height=i),o&&this.aSize(o))}},{PivotFloatBar:t,PivotBar:r}}()),s.Tree.TV.prototype.init=function(t){return function(){t.apply(this,arguments),this.oPB=this.oT.oPB,this.oPCFB=this.oT.oPCFB}}(s.Tree.TV.prototype.init),s.Tree.TV.prototype.defShp=function(t){return function(){return t.apply(this,arguments)+",Button(pivotBar-total,pivotBar-refresh,pivotBar-addNew,pivotBar-aggregate),Border(itemTot,itemSub)"}}(s.Tree.TV.prototype.defShp),s.Tree.TV.prototype.defCrs=function(t){return function(){return t.apply(this,arguments)+",pointer(pivotBar-total,pivotBar-refresh,pivotBar-addNew,pivotBar-aggregate)"}}(s.Tree.TV.prototype.defCrs),s.Tree.TV.prototype.SetReadOnly=function(t){return function(){return r(this.oT)&&this.oT.all().forEach(function(t){t.oPB.resHVO()}),t.apply(this,arguments)}}(s.Tree.TV.prototype.SetReadOnly),s.Tree.TV.prototype.wCH=function(t){return function(){return this._wCH||(this._wCH=function(){var o=t.apply(this,arguments);return o.push(this.oPB),o.push(this.oPCFB),o}.apply(this,arguments))}}(s.Tree.TV.prototype.wCH),s.Tree.TV.prototype.e2V=function(t){return function(o){return t.call(r(this.oT)?this.oT.visP().oTV:this,o)}}(s.Tree.TV.prototype.e2V),s.Tree.TV.prototype.wAO=function(t){return function(){return this._wAO||(this._wAO=function(){var o=t.apply(this,arguments);return o.push(this.oPB),o.push(this.oPCFB),o}.apply(this,arguments))}}(s.Tree.TV.prototype.wAO),s.Tree.TV.prototype.e2CH=function(t){return function(o){var i,e,r,n=t.apply(this,arguments);return n&&(i=n.h)instanceof s.Tree.TV.PivotBar&&(e=i.gPtr(o),n.o=i.p2O(e),n.pcx=i.p2PCx(e),r=i.p2TL(e),n.tlx=r.tlx,n.d=r.d),n}}(s.Tree.TV.prototype.e2CH),s.Tree.TV.prototype.rurColDraw=function(t){return function(o,i,e){o&&o.h instanceof s.Tree.TV.PivotBar?o.h.drawCH(i,e,o.o):t.apply(this,arguments)}}(s.Tree.TV.prototype.rurColDraw),s.Tree.TV.prototype.rurCol=function(t){return function(o){var i,e=t.apply(this,arguments);return!e&&o&&(i=o.h)instanceof s.Tree.TV.PivotBar&&o.o&&o.o.t&&(o.rtC=this.h2V(i,i.getHVO().lock.get(o.o)),e=!0),e}}(s.Tree.TV.prototype.rurCol),s.Tree.TV.prototype.defSts=function(t){return function(o){t.apply(this,arguments),this.isDef()&&o.Add("Escape",this.oT.showS,this.oT,"shows the source-pivot")}}(s.Tree.TV.prototype.defSts),s.Tree.TV.prototype.onDblClk=function(t){return function(o){var i,e=this.oT;if(r(e))if(!this.getShowDataOnDblClick()||e==e.src()&&!e.oI.rgFI)i=t.apply(this,arguments);else{var n=this.e2IC(o);e.showD(e.ISOf(n&&n.oI||this.e2I(o),n&&n.oC.oAgg&&n.oC.oAgg.v)),i=!0}return i}}(s.Tree.TV.prototype.onDblClk),s.Tree.TV.prototype.e2IEC=function(t){return function(){return this.oI.rgFI?null:t.apply(this,arguments)}}(s.Tree.TV.prototype.e2IEC),s.Tree.TV.prototype.onChange=function(t){return function(o,i){var e=this.oT;return"change-cell"==o&&e==e.src()&&!e.getL().isEmpty()&&this.setTimeout(function(){var t=e.run(),o=t.showP;t.showP=function(){},e.oPB.onPL(),t.showP=o}),t.apply(this,arguments)}}(s.Tree.TV.prototype.onChange),s.Tree.TV.prototype.drawI=function(t){return function(o,i,e,r,n){var a;e.oAgg&&(a=s.Tree.bSCTX(o,function(t){return this.toShape(t.oAgg.c?"itemSub":"itemTot",!t.isEnabled())}.call(this,e),i)),t.apply(this,arguments),a&&s.Tree.eSCTX(o,a)}}(s.Tree.TV.prototype.drawI),s.Tree.TV.prototype.getL=function(){return this.oPB.getL()},s.Tree.Options.pivotColumnsFloatBarVisible=null,s.Tree.TV.prototype.GetPivotColumnsFloatBarVisible=function(){return this.oO.pivotColumnsFloatBarVisible},s.Tree.TV.prototype.SetPivotColumnsFloatBarVisible=function(t){this.cwbU(),this.oO.pivotColumnsFloatBarVisible=t;var o=256&this.showPCFB()?0:4,i=this.oT.run();r(this.oT)&&this.oT.all().forEach(function(t){if(t){var e=t.oCW,r=e.W("control"),n=e.W("pivotfloatbar");n&&(o||t==i)&&e.Dock(n,r,o,n.oCW.w2R(n)),t.oPCFB.resHVO()}},this),this.cweU()},s.Tree.TV.prototype.showPCFB=function(){return this.opt("pivotColumnsFloatBarVisible",s.Tree.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisible)},s.Tree.Options.pivotBarVisible=null,s.Tree.TV.prototype.GetPivotBarVisible=function(){return this.oO.pivotBarVisible},s.Tree.TV.prototype.SetPivotBarVisible=function(t){var o=s.Pivot.PivotBarVisibleEnum,i=this.showPB();this.cwbU(),this.oO.pivotBarVisible=t;var e=this.showPB(),n=this.oT.run(),a=e&o.exPivotBarFloat?0:1;r(this.oT)&&this.oT.all().forEach(function(t){if(t){var o=t.oCW,i=o.W("control"),e=o.W("pivotbar");e&&(a||t==n)&&o.Dock(e,i,a,e.oCW.w2R(e)),t.oPB.resHVO(),o.onUI()}},this),(16777616&i)!=(16777616&e)&&this.oPB.onPL(),this.cweU()},s.Tree.TV.prototype.showPB=function(){return function(t,o,i){return function(t){return null==t}(t)?~~i:s.s2F(t,o)}(this.opt("pivotBarVisible"),s.Pivot.PivotBarVisibleEnum,s.Pivot.PivotBarVisibleEnum.exPivotBarVisible|s.Pivot.PivotBarVisibleEnum.exPivotBarSizable|s.Pivot.PivotBarVisibleEnum.exPivotBarAutoFit|s.Pivot.PivotBarVisibleEnum.exPivotBarShowTotals|s.Pivot.PivotBarVisibleEnum.exPivotBarAllowValues|s.Pivot.PivotBarVisibleEnum.exPivotBarAllowFormatAppearance|s.Pivot.PivotBarVisibleEnum.exPivotBarAllowFormatConditionalAppearance|s.Pivot.PivotBarVisibleEnum.exPivotBarAllowFormatContent|s.Pivot.PivotBarVisibleEnum.exPivotBarAutoUpdate|s.Pivot.PivotBarVisibleEnum.exPivotBarAllowUndoRedo|s.Pivot.PivotBarVisibleEnum.exPivotBarAllowResizeColumns)},s.Tree.TV.prototype.sizePB=function(){return this.showPB()&s.Pivot.PivotBarVisibleEnum.exPivotBarSizable},s.Tree.Options.pivotRows=null,s.Tree.TV.prototype.GetPivotRows=function(){return this.oO.pivotRows},s.Tree.TV.prototype.SetPivotRows=function(t){this.cwbU(),this.oO.pivotRows=t,!s.ToS(t).trim()&&this.SetPivotColumns(""),this.oPB.onPL(),this.cweU()},s.Tree.Options.pivotColumns=null,s.Tree.TV.prototype.GetPivotColumns=function(){return this.oO.pivotColumns},s.Tree.TV.prototype.SetPivotColumns=function(t){this.cwbU(),this.oO.pivotColumns=t,!s.ToS(t).trim()&&this.SetPivotTotals(""),this.oPB.onPL(),this.cweU()},s.Tree.Options.pivotTotals=null,s.Tree.TV.prototype.GetPivotTotals=function(){return this.oO.pivotTotals},s.Tree.TV.prototype.SetPivotTotals=function(t){this.cwbU(),this.oO.pivotTotals=t,this.oPB.onPL(),this.cweU()},s.Tree.TV.prototype.gpLayout=function(){return{r:s.ToS(this.GetPivotRows()).trim(),c:s.ToS(this.GetPivotColumns()).trim(),t:s.ToS(this.GetPivotTotals()).trim()}},s.Tree.TV.prototype.isClkAble=function(){return this.isSelectable()&&(!this.oPB||!this.oPB.isReadOnly())},s.Tree.TV.prototype.rurActionClick=function(t){return function(o,i){var e,r=this.e2V(i);if(this.isClkAble()&&r instanceof s.Tree.TV.PivotBar){var n=r.gPtr(i);!e&&(e=r.p2N(n))&&this.onClickN(e,i),!e&&(e=r.p2AG(n))&&this.onClickAG(e,i),!e&&(e=r.p2R(n))&&this.onClickR(e,i),!e&&(e=r.p2PO(n))&&(this.onClickPO(e,i)||(e=null)),!e&&(e=r.hasAG(r.p2O(n)))&&this.onClickAG(e,i)}!e&&t.apply(this,arguments)}}(s.Tree.TV.prototype.rurActionClick),s.Tree.TV.prototype.norurAction=function(t){return function(o,i){var e=t.apply(this,arguments);return e||(e=r(this.oT)&&this.onClickPO(this.p2PO(this.gPtr(o)),o)),e}}(s.Tree.TV.prototype.norurAction),s.Tree.TV.prototype.onClickCF=function(t){return function(o,i,r){var n=!0,a=s.Pivot.Def,h=a.filter,l=a.excludeFilter,c=o.o;if(c instanceof s.Tree.TV.PivotBar){var u=c.p2O(this.gPtr(i));(n=this.isClkAble()&&u&&u.c)&&((r=r||{}).f=u.o&&u.o.get(h)||null,r.e=u.o&&u.o.has(l)||!1,r.s=u.s||1,r.cbkF=function(t,o){void 0===t&&void 0===o||(c.bL(),u.o=u.o||new Map,t?u.o.set(l,null):u.o.delete(l),void 0!==o&&(e(o)?u.o.set(h,o):u.o.delete(h)),u.o.size||(u.o=null),c.eL())})}n&&t.call(this,o,i,r)}}(s.Tree.TV.prototype.onClickCF),s.Tree.TV.prototype.onClickC=function(t){return function(o,i){var e=this.e2V(i);if(e instanceof s.Tree.TV.PivotBar){if(this.isClkAble()){var r=e.p2O(e.gPtr(i));if(r&&r.c&&!r.a){e.bL();var n=e.getL().r.has(r);r.s=n?1+((r.s-1||0)+1)%2:((r.s||0)+1)%3,e.eL()}}}else t.apply(this,arguments)}}(s.Tree.TV.prototype.onClickC),s.Tree.TV.prototype.rurColDrop=function(t){return function(o,i,e){var r=s.Tree.TV.PivotBar,n=e&&e.h instanceof r||i.h instanceof r,a=this.Smooth;n&&(this.Smooth=this.Smoothless),t.call(this,o,i,e),n&&(this.Smooth=a)}}(s.Tree.TV.prototype.rurColDrop),s.Tree.TV.prototype.onA=function(t){return function(o){t.apply(this,arguments),r(this.oT)&&s.H.VisitA((this.oT.opR||this.oT.oR).oTV,o)}}(s.Tree.TV.prototype.onA),s.Tree.TV.prototype.getCMA=function(t,o){var i=s.Tree.TV.cbkEsc(),e=this.oT.src().Aggregates,r="";for(var n in e)r&&(r+=","),r+=i(n)+"[id="+n+"][rad"+(t==n?"=1":"")+"][show=-1][grp=agg]",o&&(r+="[close=-1]");return r},s.Tree.TV.prototype.getCMC=function(t,o){var i,e,r=s.Tree.TV.cbkEsc(),n=t instanceof s.Arr,a=this.oPCFB.cols(),h="",l=this.oPB.reqSort();return o&&(e=this.oPCFB.cols(function(t){return 1==(15&t.getSortType())})).length&&(a=e),l&&(i=s.Cmp.S,2==l&&(i=s.Cmp.R(i)),a.sort(function(t,o){return i(t.pc(),o.pc())})),a.forEach(function(o){h&&(h+=","),h+=r(o.GetCaption())+"[id="+o.GetIndex()+"][grp=col]",n?h+="[show=-1][chk="+(t.has(o)?1:0)+"]":o==t&&(h+="[shapes=shitem.checked(item)]")}),h},s.Tree.TV.prototype.runAG=function(t,o,i){var e,r=this,n=r.oPB,a=s.IRt(s.ORt(t.rtG.slice(),this.getPad()[0],0),0,(this.getHeaderHeight()-t.rtG[3])/2),h=0!=this.oPCFB.cols(function(t){return 1==(15&t.getSortType())}).length,l=n.c2Vrt(a);this.runCM({items:function(){var o,i="",e=t.a.a,r=this.getCMA(e,t.t);return!t.t&&(o=t.a.c)&&(i&&(i+=","),i+="Column[id=c-s](",i+=this.getCMC(o,this.oT.aggNumCol(e)),i+=")"),r&&(i&&(i+=",[sep],"),i+=r),i}.call(this),x:s.ROf(l),y:s.BOf(l),alignContextMenu:0,cbkS:function(o){if(h){var i=this.Item("c-s");i&&o.flags&&o.flags.has("rad")&&i.set(r.getCMC(t.a.c,r.oT.aggNumCol(o.id)))}e=o},cbkM:function(t){if(!t&&!this.esc){var r=this.forEachU(function(t){return t.getState()&&t.flags&&"agg"==t.flags.get("grp")&&t.caption||""}),n=e&&e.flags&&"col"==e.flags.get("grp")&&this.oR.oT.src().Column(e.id);o&&o.call(i||this,r,n)}}})},s.Tree.TV.prototype.onClickAG=function(t,o){return this.runAG(t,function(o,i){var e,r=this.oPB,n=r.src().oPB.btnT==t.t;!n&&r.bL(),e=t.a.a!=o,t.a.a=o,i&&(e|=t.a.c!=i,t.a.c=i),!n&&r.eL(e),n&&e&&r.invAO()},this)},s.Tree.TV.prototype.onClickN=function(t,o){function i(t){var o=function(t){var o=new s.Arr;return t instanceof s.Pivot.CAr&&t.forEach(function(t){o.ann(t.c)}),o}.call(this,t),i={items:this.getCMC(o)};return i.cbkM=function(t){if(!t&&!this.esc){var o=!1,i=this.oR.n,e=this.oR.oT,r=this.oR.oT.oPB,n=e.src(),a=function(){var t=[];return this.forEachU(function(o){o.flags&&"col"==o.flags.get("grp")&&o.getState()&&t.push(o.id)}),t}.call(this);if(r.bL(),i instanceof s.Pivot.CAr)if(a.length||"row"!=i.t){var h=function(t,o){var i;return o.forEach(function(o){t.indexOf({c:n.Column(o)})<0&&(i=i||[]).push(o)}),i}.call(this,i,a),l=function(t,o){var i,e;return t.forEach(function(t){o.indexOf(i=t.c.GetIndex())<0&&(e=e||[]).push(i)}),e}.call(this,i,a);(o=!(!h&&!l))&&(h&&h.forEach(function(t){i.add({c:n.Column(t)})}),l&&l.forEach(function(t){i.remove({c:n.Column(t)})}))}else n.SetPivotRows("");else"row"==i.t&&n.SetPivotRows(a.join(","));r.eL(o)}},i}var e=this.oPB,r=t.n,n=this.oPB.getHVO().lock.get(t),a=e.c2Vrt(n);r&&("value"==r.t?this.runAG({a:{a:e.btnT.t.a,c:"new"},rtG:n},function(t,o){if(o){var i=this.oPB,e=this.oT.src(),r=e.GetPivotColumns()||"";r&&(r+=","),r+=t+"("+o.GetIndex()+")",i.bL(),e.SetPivotColumns(r),i.eL(!1)}},this):this.runCM(s.Mrg({n:r,x:s.ROf(a),y:s.BOf(a),alignContextMenu:0},i.call(this,r))))},s.Tree.TV.prototype.onClickR=function(t,o){this.oT.src().oPB.doL()},s.Tree.TV.prototype.p2PO=function(t){return this.HTl(t,function(){function o(t){var o;if(t.oAgg)o=t.oAgg;else{var i,e=this.getL();e.r&&(i=e.r.at(t.getLevel()))&&(o=i)}return o}function i(t){return t&&t.o&&t.o.size}var e,r=this.p2ICHT(t),n=r&&r.c;if(n){var s=n.oC;if(s.oAgg){if(e=s.oAgg.a,!i(e)){var a=o.call(this,n.oI);i(a)&&(e=a)}}else s.GetIndex()||(e=o.call(this,n.oI))}return e})},s.Tree.TV.prototype.onClickPO=function(t,o){function i(o){return t.o&&t.o.get(o)}function r(o,i){return t.o&&t.o.set(o,i)}function n(o){var i,e=o.mvF||o.mF;return t.o&&t.o.forEach(function(t,o){e.has(o)&&(i=i||new s.Arr).add(o)}),i}function h(o){var e=i(g),n=function(o){return t.o&&t.o.has(o)}(y);!f.oLF&&(f.oLF=f.getL()),u.oPB.bL(),t.o=new Map,s.ToS(o).split(P).forEach(function(t){if(t=t.trim()){var o=t.indexOf(m),i=(o<0?t:t.substr(0,o)).trim(),e=(o<0?"":t.substr(o+1)).trim()||null;i&&r(i,e)}}),e&&r(g,e),n&&r(y,null),t.o.size||(t.o=null),u.oPB.eL()}function l(){var r=this.c2V(this.gPtr(o)),l=this.runCM({items:function(){var o="",e="";return v.allowFC()&&(e=p.oFC.getCM({group:C,sel:i(C)}))&&(o+=(o?",":"")+C,o+="(",o+=e,o+=")"),v.allowFA()&&(e=p.oFA.getCM({sel:n.call(this,p.oFA)}))&&(o+=o?",[sep],":"",o+=e),t.a&&!u.oPB.getL().t2O(t)&&v.allowFCA()&&(e=p.oFCA.getCM({sel:n.call(this,p.oFCA)}))&&(o+=(o?",[sep],":"")+T,o+="(",o+=e,o+=")"),o}.call(this),x:a.X(r),y:a.Y(r),alignContextMenu:0,cbkS:function(i){if(t){h(function(t){function o(t,o){(t=s.ToS(t).trim())&&(i+=(i?P:"")+t,e(o)&&(i+=m+o))}var i="";return t.forEachU(function(t){t.flags&&(t.flags.get("chk")&&o(t.caption),t.caption&&t.flags.get("rad")&&o(t.flags.get("grp"),t.caption))}),i}(this)),t=null;var r=u.e2V(o);r&&r.p2PO&&(t=r.p2PO(r.gPtr(o)))}},cbkM:function(t){!t&&c&&(this.drawItem=c)}}),c=l&&l.drawItem;c&&(l.drawItem=function(t,o,i,e){var r,n,a=e.get("item");if(a){l.getCriFlat()&&((a=a.slice())[2]=l.getFlatWidth(),a=s.IRt(a,-1,-1));var h,f,v=i.oP&&i.oP.caption;v==T&&(h=p.oFCA.mvF||p.oFCA.mF),v||i.rgCI.length||i.flags&&i.flags.has("sep")||(h=p.oFA.mvF||p.oFA.mF),h&&(f=h.get(i.caption))&&f.shape&&(n=u.toShapes(f.shape))}n&&(r=s.Tree.bSCTX(o,n,a)),c.apply(this,arguments),r&&s.Tree.eSCTX(o,r)},l.Refresh())}var c=!1,u=this,p=this.oT.src(),f=this.oT.run(),v=p.oPB,d=s.Pivot.Def,g=d.filter,y=d.excludeFilter,C="content",T="conditional",P=",",m="=",w=o.drag&&(o.drag.long?1:2==o.drag.click?2:0)||0;return(c=t&&this.gAA().CanDo(o,w,"format"))&&(s.Menu?l:function(){var o,i=p.capFO(t);(o=s.ToS(prompt("format",i),i))!=i&&h(o)}).call(this),c},s.Tree.Options.showDataOnDblClick=null,s.Tree.TV.prototype.GetShowDataOnDblClick=function(){return this.oO.showDataOnDblClick},s.Tree.TV.prototype.SetShowDataOnDblClick=function(t){this.cwbU(),this.oO.showDataOnDblClick=t,this.cweU()},s.Tree.TV.prototype.getShowDataOnDblClick=function(){return this.opt("showDataOnDblClick",!0)},s.Tree.Options.displayPivotFields=null,s.Tree.TV.prototype.GetDisplayPivotFields=function(){return this.oO.displayPivotFields},s.Tree.TV.prototype.SetDisplayPivotFields=function(t){this.cwbU(),this.oO.displayPivotFields=t,this.oPB.onPL(),this.cweU()},s.Tree.TV.prototype.getDisplayPivotFields=function(){return this.opt("displayPivotFields",256)},s.Tree.Options.displayPivotRows=null,s.Tree.TV.prototype.GetDisplayPivotRows=function(){return this.oO.displayPivotRows},s.Tree.TV.prototype.SetDisplayPivotRows=function(t){this.cwbU(),this.oO.displayPivotRows=t,this.oPB.onPL(),this.cweU()},s.Tree.TV.prototype.getDisplayPivotRows=function(){return this.opt("displayPivotRows",16384)},s.Tree.Options.formatPivotHeader=null,s.Tree.TV.prototype.GetFormatPivotHeader=function(){return this.oO.formatPivotHeader},s.Tree.TV.prototype.SetFormatPivotHeader=function(t){this.cwbU(),this.oExPF=void 0,this.oO.formatPivotHeader=t,this.cweU()},s.Tree.TV.prototype.getFormatPivotHeader=function(){return this.opt("formatPivotHeader","ilevel >= 0 ? (aggregate = `sum` ? (ilevel > 1 ? `Subtotal` : `Total`) : proper(aggregate)) : (aggregate and caption ? (proper(aggregate) + ' of ' + caption) : proper(aggregate) or caption)")},s.Tree.Cell.prototype.i=s.Tree.Cell.prototype.getImage=function(t){return function(){var o,i=this.oC;return this.oC.oCS&&(i=this.oC.oCS,this.oC.oCS.length&&(i=this.oC.oCS[this.oI.getLevel()])),(o=i.getFormatImage())?o.Evaluate(this):t.apply(this)}}(s.Tree.Cell.prototype.getImage),s.Shapes.Pivot=s.Shapes.Tree,t.Pivot=s.Pivot});