"use strict";(self.webpackChunkfirebird=self.webpackChunkfirebird||[]).push([[4330],{4330:(P,u,s)=>{s.r(u),s.d(u,{TGraphTimePainter:()=>h,drawRooPlot:()=>p});var a=s(467),m=s(6998),l=s(9041),d=s(675),c=s(2953),o=s(6207);class h extends d.JW{redraw(){void 0===this.step&&this.startDrawing()}decodeOptions(e){const t=new l.nC(e||"REPEAT");this.options||(this.options={}),Object.assign(this.options,{once:t.check("ONCE"),repeat:t.check("REPEAT"),first:t.check("FIRST")}),this.storeDrawOpt(e)}drawPrimitives(e){var t=this;return(0,a.A)(function*(){e||(e=0,t._doing_primitives=!0);const i=t.getObject()?.fSteps.arr[t.step];if(i&&!(e>=i.arr.length))return(0,o.$2)(t.getPadPainter(),i.arr[e],i.opt[e]).then(r=>(r&&(r.$grtimeid=t.selfid,r.$grstep=t.step),t.drawPrimitives(e+1)));delete t._doing_primitives})()}continueDrawing(){if(!this.options)return;const e=this.getObject();if(this.options.first)delete this.step;else if(this.wait_animation_frame){delete this.wait_animation_frame;const t=this.getPadPainter();if(!t)return void delete this.step;this.drawPrimitives().then(()=>{t.cleanPrimitives(i=>i.$grtimeid===this.selfid&&i.$grstep!==this.step),this.continueDrawing()})}else if(this.running_timeout)clearTimeout(this.running_timeout),delete this.running_timeout,this.wait_animation_frame=!0,requestAnimationFrame(()=>this.continueDrawing());else{let t=Math.max(e.fSleepTime,10);if(++this.step>e.fSteps.arr.length){if(!this.options.repeat)return void delete this.step;this.step=0,t=Math.max(5e3,5*t)}this.running_timeout=setTimeout(()=>this.continueDrawing(),t)}}startDrawing(){return this.step=0,this.drawPrimitives().then(()=>(this.continueDrawing(),this))}static draw(e,t,i){return(0,a.A)(function*(){if(!t.fFrame)return console.error("Frame histogram not exists"),null;const r=new h(e,t);if(r.getMainPainter())return console.error("Cannot draw graph time on top of other histograms"),null;if(r.decodeOptions(i),!t.fFrame.fTitle&&t.fTitle){const n=t.fTitle.split(";");t.fFrame.fTitle=n[0],n[1]&&(t.fFrame.fXaxis.fTitle=n[1]),n[2]&&(t.fFrame.fYaxis.fTitle=n[2])}return r.selfid="grtime_"+m.internals.id_counter++,c.N.draw(e,t.fFrame,"").then(()=>(r.addToPadPrimitives(),r.startDrawing()))})()}}function p(f,e){return _.apply(this,arguments)}function _(){return _=(0,a.A)(function*(f,e){return(0,o.$2)(f,e._hist,"hist").then(function(){var t=(0,a.A)(function*(i){const r=[];for(let n=0;n<e._items.arr.length;++n)r.push((0,o.$2)(f,e._items.arr[n],e._items.opt[n]));return Promise.all(r).then(()=>i)});return function(i){return t.apply(this,arguments)}}())}),_.apply(this,arguments)}}}]);