"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7528],{64523(t,e,s){s.d(e,{O:()=>m});var n=s(5482),r=s(76061),i=s(55537),a=s(88885),l=s(95213),h=s(83661),o=s(5247);class m{getOperatorType(){return 10204}supportsCurves(){return!0}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,n){return new c(t,e,s,n)}execute(t,e,s,n){return t||(0,i.a)("null param is not allowed."),new c(null,e,s,n).generalize(t)}}class c extends r.G{constructor(t,e,s,n){super(),this.m_pline=null,this.m_point=new l.P,this.m_stack=[],this.m_resultstack=[],this.m_callCount=0,this.m_progressTracker=n,this.m_geoms=t,this.m_maxDeviation=e,this.m_bRemoveDegenerateParts=s}tock(){return!0}getRank(){return 1}next(){const t=this.m_geoms.next();return null===t?null:((0,i.c)(t),this.generalize(t))}getGeometryID(){return this.m_geoms.getGeometryID()}generalize(t){const e=t.getGeometryType();if((0,i.e)(e))return t;if(e===i.G.enumEnvelope){const e=new a.a({vd:t.getDescription()});return e.addEnvelope(t,!1),this.generalize(e)}if((0,i.f)(e)){const e=new a.P({vd:t.getDescription()});return e.addSegment(t,!0),this.generalize(e)}if((0,i.h)(e)||(0,i.t)(""),t.isEmpty()||this.m_maxDeviation<=0)return t;const s=(new o.O).execute(t,0,.05*this.m_maxDeviation,0,this.m_progressTracker);t.hasNonLinearSegments()&&(this.m_maxDeviation*=.95);const r=s,l=t.createInstance();l.getGeometryType()===i.G.enumPolygon&&l.setFillRule(t.getFillRule()),this.m_xy=r.getAttributeStreamRef(0);{const t={stack:[],error:void 0,hasError:!1};try{const e=new a.L;this.m_pline=e,(0,n.mS)(t,(0,h.h)(()=>{this.m_pline=null},!1),!1);for(let t=0,e=r.getPathCount();t<e;t++)this.generalizePath(r.getImpl(),t,l.getImpl())}catch(e){t.error=e,t.hasError=!0}finally{(0,n.hk)(t)}}return this.m_resultstack.length=0,this.m_stack.length=0,l}generalizePath(t,e,s){if(t.getPathSize(e)<2)return;this.m_resultstack.length=0,this.m_stack.length=0;const n=t.getPathStart(e),r=t.getPathEnd(e)-1,i=t.isClosedPath(e),a=t.isClosedPathInXYPlane(e);let l=0,o=-1;this.m_stack.push(i?n:r),this.m_stack.push(n);let m=!1,c=!1;for(!this.m_bRemoveDegenerateParts&&a&&(m=!0,c=!0);this.m_stack.length>1;){const e=this.m_stack.at(-1);this.m_stack.pop();const s=this.m_stack.at(-1);let n=t.getXY(e);this.m_pline.setStartXY(n),n=t.getXY(s),this.m_pline.setEndXY(n);const i=[Number.NaN];let a=this.findGreatestDistance(e,s,r,i);a>=0&&(m?m=!1:(c&&i[0]>l&&(l=i[0],o=a),i[0]<=this.m_maxDeviation&&(a=-1))),a>=0?(this.m_stack.push(a),this.m_stack.push(e)):this.m_resultstack.push(e)}i||this.m_resultstack.push(this.m_stack[0]);const u=this.m_resultstack.length;if(u===t.getPathSize(e)&&u===this.m_stack.length)s.addPath(t,e,!0);else if(this.m_resultstack.length>0){if(this.m_bRemoveDegenerateParts&&this.m_resultstack.length<=2){if(i||1===this.m_resultstack.length)return;if(h.P.distance(t.getXY(this.m_resultstack[0]),t.getXY(this.m_resultstack[1]))<=this.m_maxDeviation)return}if(c&&o>=0&&l<=this.m_maxDeviation){const t=this.m_resultstack.at(-1)>o;this.m_resultstack.push(o),t&&(this.m_resultstack[this.m_resultstack.length-2]=(0,h.c)(this.m_resultstack[this.m_resultstack.length-1],this.m_resultstack[this.m_resultstack.length-1]=this.m_resultstack[this.m_resultstack.length-2]))}for(let e=0,n=this.m_resultstack.length;e<n;e++)t.getPointByVal(this.m_resultstack[e],this.m_point),0===e?s.startPathPoint(this.m_point):s.lineToPoint(this.m_point);if(i){for(let t=this.m_resultstack.length;t<3;t++)s.lineToPoint(this.m_point);s.closePathWithLine()}}}findGreatestDistance(t,e,s,n){let r=e-1;e<=t&&(r=s);let i=-1,a=0;const l=new h.P;for(let e=t+1;e<=r;e++){this.m_xy.queryPoint2D(2*e,l);const t=l.x,s=l.y,n=this.m_pline.getClosestCoordinate(l,!1);l.assign(this.m_pline.getCoord2D(n)),l.x-=t,l.y-=s;const r=l.length();r>a&&(i=e,a=r),this.m_callCount++}return n[0]=a,i}}},70787(t,e,s){s.d(e,{fz:()=>l,g7:()=>i,zo:()=>a});var n=s(76061);const r=new(s(64523).O);function i(t,e,s){return r.execute(t,e,s,null)}function a(t,e,s){const i=r.executeMany(new n.S(t),e,s,null);return Array.from(i)}function l(){return r.supportsCurves()}},97528(t,e,s){s.r(e),s.d(e,{execute:()=>a,executeMany:()=>l});var n=s(86211),r=s(70787),i=s(83299);function a(t,e,s={}){const{removeDegenerateParts:a=!1,unit:l}=s,h=(0,i.getSpatialReference)(t);l&&h&&(e=(0,n.UW)(e,l,h));const o=(0,i.fromGeometry)(t),m=(0,r.g7)(o.getGeometry(),e,a);return null==m?null:(0,i.toGeometry)(m,o.getSpatialReference())}function l(t,e,s={}){const{removeDegenerateParts:a=!1,unit:l}=s,h=(0,i.getSpatialReference)(t);l&&h&&(e=(0,n.UW)(e,l,h));const[o,m]=(0,i.fromGeometries)(t);return(0,r.zo)(o,e,a).map(t=>(0,i.toGeometry)(t,m))}}}]);