"use strict";(self.webpackChunkfirebird=self.webpackChunkfirebird||[]).push([[8524],{8524:(I,L,o)=>{o.r(L),o.d(L,{TF3Painter:()=>A});var X=o(467),x=o(6998),b=o(4149),p=o(3693),O=o(230),H=o(9041),j=o(675),W=o(3277);function D(C,t,e=0){for(let i=C.length-2;i>=0;--i){const r=t[i],_=t[i+1],s=C[i],l=C[i+1];if(r===e)return s;if(_===e)return l;if(r<e!=_<e)return s+(e-r)/(_-r)*(l-s)}return C[0]-1}class A extends b.TH2Painter{#e;getObjectName(){return this.$func?.fName??"func"}getClassName(){return this.$func?._typename??x.clTF3}isTF1(){return!0}getPrimaryObject(){return this.$func}updateObject(t){if(!t||this.getClassName()!==t._typename)return!1;delete t.evalPar;const e=this.getHisto();if(this.webcanv_hist){const i=this.getPadPainter()?.findInPrimitives("Func",x.clTH2F);i&&this.updateAxes(e,i,this.getFramePainter())}return this.$func=t,this.createTF3Histogram(t,e),this.scanContent(),!0}redraw(t){return!this.#e&&("logx"===t||"logy"===t||"logy"===t||"zoom"===t)&&(this.createTF3Histogram(this.$func,this.getHisto()),this.scanContent()),super.redraw(t)}createTF3Histogram(t,e){const i=t.fSave.length-9;this.#e=i>0&&(x.settings.PreferSavedPoints||this.use_saved>1);const r=this.getFramePainter(),_=this.getPadPainter()?.getRootPad(!0),s=_?.fLogx,l=_?.fLogy,a=r?.getGrFuncs(this.second_x,this.second_y);let M=t.fXmin,v=t.fXmax,y=t.fYmin,P=t.fYmax,h=t.fZmin,S=t.fZmax,g=Math.max(t.fNpx,20),c=Math.max(t.fNpy,20),f=Math.max(t.fNpz,20);if(a?.zoom_xmin!==a?.zoom_xmax){const m=(v-M)/g;M<a.zoom_xmin&&a.zoom_xmin<v&&(M=Math.max(M,a.zoom_xmin-m)),M<a.zoom_xmax&&a.zoom_xmax<v&&(v=Math.min(v,a.zoom_xmax+m))}if(a?.zoom_ymin!==a?.zoom_ymax){const m=(P-y)/c;y<a.zoom_ymin&&a.zoom_ymin<P&&(y=Math.max(y,a.zoom_ymin-m)),y<a.zoom_ymax&&a.zoom_ymax<P&&(P=Math.min(P,a.zoom_ymax+m))}a?.zoom_zmin!==a?.zoom_zmax&&(h<a.zoom_zmin&&a.zoom_zmin<S&&(h=a.zoom_zmin),h<a.zoom_zmax&&a.zoom_zmax<S&&(S=a.zoom_zmax));const N=(m,z)=>{e.fNcells!==(m+2)*(z+2)&&(e.fNcells=(m+2)*(z+2),e.fArray=new Float32Array(e.fNcells)),e.fArray.fill(0),e.fXaxis.fNbins=m,e.fXaxis.fXbins=[],e.fYaxis.fNbins=z,e.fYaxis.fXbins=[],e.fXaxis.fXmin=M,e.fXaxis.fXmax=v,e.fYaxis.fXmin=y,e.fYaxis.fXmax=P,e.fMinimum=h,e.fMaximum=S};if(delete this._fail_eval,!this.#e){let m=!1;!t.evalPar&&!(0,p.Dx)(t)&&(m=!0),N(g,c),s&&(0,O.produceTAxisLogScale)(e.fXaxis,g,M,v),l&&(0,O.produceTAxisLogScale)(e.fYaxis,c,y,P);const z=new Array(f),u=new Array(f);for(let n=0;n<f;++n)u[n]=h+n/(f-1)*(S-h);for(let n=0;n<c&&!m;++n)for(let d=0;d<g&&!m;++d){const E=e.fXaxis.GetBinCenter(d+1),T=e.fYaxis.GetBinCenter(n+1);let B=0;try{for(let F=0;F<f;++F)z[F]=t.evalPar(E,T,u[F]);B=D(u,z)}catch{m=!0}m||e.setBinContent(e.getBin(d+1,n+1),Number.isFinite(B)?B:0)}m&&(this._fail_eval=!0),m&&i>0&&(this.#e=!0)}if(this.#e){M=t.fSave[i],v=t.fSave[i+1],y=t.fSave[i+2],P=t.fSave[i+3],h=t.fSave[i+4],S=t.fSave[i+5],g=Math.round(t.fSave[i+6]),c=Math.round(t.fSave[i+7]),f=Math.round(t.fSave[i+8]);const m=(S-h)/f;N(g+1,c+1);const z=new Array(f+1),u=new Array(f+1);for(let n=0;n<=f;n++)u[n]=h+n*m;for(let n=0;n<=g;++n)for(let d=0;d<=c;++d){for(let T=0;T<=f;T++)z[T]=t.fSave[n+(g+1)*(d+(c+1)*T)];const E=D(u,z);e.setBinContent(e.getBin(n+1,d+1),Number.isFinite(E)?E:0)}}return e.fName="Func",(0,x.setHistogramTitle)(e,t.fTitle),e.fLineColor=t.fLineColor,e.fLineStyle=t.fLineStyle,e.fLineWidth=t.fLineWidth,e.fFillColor=t.fFillColor,e.fFillStyle=t.fFillStyle,e.fMarkerColor=t.fMarkerColor,e.fMarkerStyle=t.fMarkerStyle,e.fMarkerSize=t.fMarkerSize,e.fBits|=x.kNoStats,e}extractAxesProperties(t){super.extractAxesProperties(t);const e=this.$func,i=e?.fSave.length??0;i>9&&this.#e&&(this.xmin=Math.min(this.xmin,e.fSave[i-9]),this.xmax=Math.max(this.xmax,e.fSave[i-8]),this.ymin=Math.min(this.ymin,e.fSave[i-7]),this.ymax=Math.max(this.ymax,e.fSave[i-6]),this.zmin=Math.min(this.zmin,e.fSave[i-5]),this.zmax=Math.max(this.zmax,e.fSave[i-4])),e&&(this.xmin=Math.min(this.xmin,e.fXmin),this.xmax=Math.max(this.xmax,e.fXmax),this.ymin=Math.min(this.ymin,e.fYmin),this.ymax=Math.max(this.ymax,e.fYmax),this.zmin=Math.min(this.zmin,e.fZmin),this.zmax=Math.max(this.zmax,e.fZmax))}fillWebObjectOptions(t){t.fcust=this._fail_eval&&!this.use_saved?"func_fail":""}static draw(t,e,i){return(0,X.A)(function*(){const r=(0,O.scanTF1Options)(i);i=r.opt,delete r.opt;const _=new H.nC(i);let s;_.empty()||"gl"===i?i="surf1":"SAME"===_.opt&&(i="surf1 same"),r.webcanv_hist&&(s=new j.JW(t).getPadPainter()?.findInPrimitives("Func",x.clTH2F)),s||(s=(0,x.createHistogram)(x.clTH2F,20,20),s.fBits|=x.kNoStats);const l=new A(t,s);return l.$func=e,Object.assign(l,r),l.createTF3Histogram(e,s),W.mf._drawHist(l,i)})()}}}}]);