"use strict";(self.webpackChunkfirebird=self.webpackChunkfirebird||[]).push([[2855],{2855:(v,m,d)=>{d.r(m),d.d(m,{TWebPaintingPainter:()=>M});var C=d(467),y=d(6823),E=d(675),A=d(5680),B=d(6998),j=d(6370);class M extends E.JW{updateObject(e){return!!this.matchObjectType(e)&&(this.assignObject(e),!0)}getMenuHeader(){return this.getObject()?.fClassName||"TWebPainting"}fillContextMenu(e){const t=this.getMenuHeader();return e.header(t,`${B.urlClassPrefix}${t}.html`),!0}handleMouseClick(e){const t=(0,A.Wn)(e,this.draw_g.node()),n=this.getPadPainter(),a=n?.getPadRect();n&&a&&this.snapid&&n.selectObjectPainter(this,{x:t[0]+a.x,y:t[1]+a.y})}redraw(){var e=this;return(0,C.A)(function*(){const t=e.getObject(),n=e.getAxisToSvgFunc();if(!t?.fOper||!n)return e;let h,P,i,a=0,s={},g=null,O="none",x="";const o=t.fOper.split(";"),u=r=>{if(r!==O&&(g&&(g.attr("d",x),x="",g=null,O="none"),r))switch(O=r,g=e.draw_g.append("svg:path").attr("d",""),r){case"f":g.call(e.fillatt.func);break;case"l":g.call(e.lineatt.func).style("fill","none");break;case"m":g.call(e.markeratt.func)}},p=(r,_)=>{let f=0;const l={_typename:"any"};for(let c=0;c<_.length;++c){const T=r.indexOf(":",f+1);l[_[c]]=parseInt(r.slice(f+1,T>f?T:void 0)),f=T}return l},b=r=>{for(;++r<o.length;)switch(h=o[r][0],h){case"z":e.createAttLine({attr:p(o[r],["fLineColor","fLineStyle","fLineWidth"]),force:!0}),u();continue;case"y":e.createAttFill({attr:p(o[r],["fFillColor","fFillStyle"]),force:!0}),u();continue;case"x":e.createAttMarker({attr:p(o[r],["fMarkerColor","fMarkerStyle","fMarkerSize"]),force:!0}),u();continue;case"o":s=p(o[r],["fTextColor","fTextFont","fTextSize","fTextAlign","fTextAngle"]),s.fTextSize<0&&(s.fTextSize*=-.001),u();continue;case"r":case"b":{u("b"===h?"f":"l");const _=n.x(t.fBuf[a++]),f=n.y(t.fBuf[a++]),l=n.x(t.fBuf[a++]),c=n.y(t.fBuf[a++]);x+=`M${_},${f}h${l-_}v${c-f}h${_-l}z`;continue}case"l":case"f":for(u(h),P=parseInt(o[r].slice(1)),i=0;i<P;++i)x+=`${i>0?"L":"M"}${n.x(t.fBuf[a++])},${n.y(t.fBuf[a++])}`;"f"===h&&(x+="Z");continue;case"m":for(u(h),P=parseInt(o[r].slice(1)),e.markeratt.resetPos(),i=0;i<P;++i)x+=e.markeratt.create(n.x(t.fBuf[a++]),n.y(t.fBuf[a++]));continue;case"h":case"t":if(s.fTextSize){u();const _=s.fTextSize>1?s.fTextSize:e.getPadPainter().getPadHeight()*s.fTextSize,f=e.draw_g.append("svg:g");return e.startTextDrawingAsync(s.fTextFont,_,f).then(()=>{let l=o[r].slice(1),c=s.fTextAngle;if(c>=360&&(c-=360*Math.floor(c/360)),"h"===h){let T="";for(i=0;i<l.length;i+=2)T+=String.fromCharCode(parseInt(l.slice(i,i+2),16));l=T}return e.drawText({align:s.fTextAlign,x:n.x(t.fBuf[a++]),y:n.y(t.fBuf[a++]),rotate:-c,text:l,color:(0,y.oU)(s.fTextColor),latex:0,draw_g:f}),e.finishTextDrawing(f)}).then(()=>b(r))}continue;default:console.log(`unsupported operation ${h}`)}return Promise.resolve(!0)};return e.createG(),b(-1).then(()=>(u(),(0,j.wh)(e),e.isBatchMode()||e.draw_g.on("click",r=>e.handleMouseClick(r)),e))})()}static draw(e,t){return(0,C.A)(function*(){const n=new M(e,t);return n.addToPadPrimitives(),n.redraw()})()}}}}]);