(function(Ve,Z){typeof exports=="object"&&typeof module<"u"?Z(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],Z):(Ve=typeof globalThis<"u"?globalThis:Ve||self,Z(Ve["cesium-plotting-symbol"]={},Ve.Cesium))})(this,function(Ve,Z){"use strict";var Om=Object.defineProperty;var Rm=(Ve,Z,vn)=>Z in Ve?Om(Ve,Z,{enumerable:!0,configurable:!0,writable:!0,value:vn}):Ve[Z]=vn;var Y=(Ve,Z,vn)=>(Rm(Ve,typeof Z!="symbol"?Z+"":Z,vn),vn);function vn(u){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const r in u)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(u,r);Object.defineProperty(i,r,a.get?a:{enumerable:!0,get:()=>u[r]})}}return i.default=u,Object.freeze(i)}const L=vn(Z);var Ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bi(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}function bl(u){if(u.__esModule)return u;var i=u.default;if(typeof i=="function"){var r=function a(){if(this instanceof a){var o=[null];o.push.apply(o,arguments);var l=Function.bind.apply(i,o);return new l}return i.apply(this,arguments)};r.prototype=i.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(u).forEach(function(a){var o=Object.getOwnPropertyDescriptor(u,a);Object.defineProperty(r,a,o.get?o:{enumerable:!0,get:function(){return u[a]}})}),r}var la={exports:{}};(function(u,i){(function(r,a){u.exports=a()})(Ht,function(){function r(b){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?r=function(w){return typeof w}:r=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},r(b)}function a(b,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")}function o(b,w){for(var p=0;pb.length)&&(w=b.length);for(var p=0,y=new Array(w);p-1&&S.splice(G,1)}if(S.length!==0)return!1}return!0}},{key:"_checkSubCombo",value:function(p,y,_){p=p.slice(0),_=_.slice(y);for(var R=y,S=0;S-1&&(p.splice(S,1),S-=1,G>R&&(R=G),p.length===0))return R}return-1}}]),b}();T.comboDeliminator=">",T.keyDeliminator="+",T.parseComboStr=function(b){for(var w=T._splitStr(b,T.comboDeliminator),p=[],y=0;y0&&p[S]===y&&p[S-1]!=="\\"&&(R.push(_.trim()),_="",S+=1),_+=p[S];return _&&R.push(_.trim()),R};var I=function(){function b(w){a(this,b),this.localeName=w,this.activeTargetKeys=[],this.pressedKeys=[],this._appliedMacros=[],this._keyMap={},this._killKeyCodes=[],this._macros=[]}return l(b,[{key:"bindKeyCode",value:function(p,y){typeof y=="string"&&(y=[y]),this._keyMap[p]=y}},{key:"bindMacro",value:function(p,y){typeof y=="string"&&(y=[y]);var _=null;typeof y=="function"&&(_=y,y=null);var R={keyCombo:new T(p),keyNames:y,handler:_};this._macros.push(R)}},{key:"getKeyCodes",value:function(p){var y=[];for(var _ in this._keyMap){var R=this._keyMap[_].indexOf(p);R>-1&&y.push(_|0)}return y}},{key:"getKeyNames",value:function(p){return this._keyMap[p]||[]}},{key:"setKillKey",value:function(p){if(typeof p=="string"){for(var y=this.getKeyCodes(p),_=0;_-1&&this.pressedKeys.splice(W,1)}this.activeTargetKeys.length=0,this._clearMacros()}}},{key:"_applyMacros",value:function(){for(var p=this._macros.slice(0),y=0;y-1&&this.pressedKeys.splice(R,1)}y.handler&&(y.keyNames=null),this._appliedMacros.splice(p,1),p-=1}}}}]),b}(),z=function(){function b(w,p,y,_){a(this,b),this._locale=null,this._currentContext="",this._contexts={},this._listeners=[],this._appliedListeners=[],this._locales={},this._targetElement=null,this._targetWindow=null,this._targetPlatform="",this._targetUserAgent="",this._isModernBrowser=!1,this._targetKeyDownBinding=null,this._targetKeyUpBinding=null,this._targetResetBinding=null,this._paused=!1,this._contexts.global={listeners:this._listeners,targetWindow:w,targetElement:p,targetPlatform:y,targetUserAgent:_},this.setContext("global")}return l(b,[{key:"setLocale",value:function(p,y){var _=null;return typeof p=="string"?y?(_=new I(p),y(_,this._targetPlatform,this._targetUserAgent)):_=this._locales[p]||null:(_=p,p=_._localeName),this._locale=_,this._locales[p]=_,_&&(this._locale.pressedKeys=_.pressedKeys),this}},{key:"getLocale",value:function(p){return p||(p=this._locale.localeName),this._locales[p]||null}},{key:"bind",value:function(p,y,_,R){if((p===null||typeof p=="function")&&(R=_,_=y,y=p,p=null),p&&r(p)==="object"&&typeof p.length=="number"){for(var S=0;S"]),b.bindMacro("shift + /",["questionmark","?"]),w.match("Mac")?b.bindMacro("command",["mod","modifier"]):b.bindMacro("ctrl",["mod","modifier"]);for(var y=65;y<=90;y+=1){var _=String.fromCharCode(y+32),R=String.fromCharCode(y);b.bindKeyCode(y,_),b.bindMacro("shift + "+_,R),b.bindMacro("capslock + "+_,R)}var S=p.match("Firefox")?59:186,k=p.match("Firefox")?173:189,W=p.match("Firefox")?61:187,G,$;w.match("Mac")&&(p.match("Safari")||p.match("Chrome"))?(G=91,$=93):w.match("Mac")&&p.match("Opera")?(G=17,$=17):w.match("Mac")&&p.match("Firefox")&&(G=224,$=224),b.bindKeyCode(S,["semicolon",";"]),b.bindKeyCode(k,["dash","-"]),b.bindKeyCode(W,["equal","equalsign","="]),b.bindKeyCode(G,["command","windows","win","super","leftcommand","leftwindows","leftwin","leftsuper"]),b.bindKeyCode($,["command","windows","win","super","rightcommand","rightwindows","rightwin","rightsuper"]),b.setKillKey("command")}var q=new z;return q.setLocale("us",F),q.Keyboard=z,q.Locale=I,q.KeyCombo=T,q})})(la);var Cl=la.exports;const mt=bi(Cl);class Pl{constructor(i){Y(this,"scene");Y(this,"handler");this.scene=i,this.handler=new L.ScreenSpaceEventHandler(i.canvas)}getHandler(){return(!this.handler||this.handler.isDestroyed())&&(this.handler=new L.ScreenSpaceEventHandler(this.scene.canvas)),this.handler}destory(){this.handler.destroy()}setLeftClick(i){this.getHandler().setInputAction(i,L.ScreenSpaceEventType.LEFT_CLICK)}setMiddleClick(i){this.getHandler().setInputAction(i,L.ScreenSpaceEventType.MIDDLE_CLICK)}setRightClick(i){this.getHandler().setInputAction(i,L.ScreenSpaceEventType.RIGHT_CLICK)}setMove(i){this.getHandler().setInputAction(i,L.ScreenSpaceEventType.MOUSE_MOVE)}}var Wt=(u=>(u[u.View=0]="View",u[u.Create=1]="Create",u[u.Select=2]="Select",u[u.Edit=3]="Edit",u[u.CtlEdit=4]="CtlEdit",u))(Wt||{}),rn=(u=>(u[u.Start=0]="Start",u[u.Create=1]="Create",u[u.Finish=2]="Finish",u[u.Select=3]="Select",u[u.UnSelect=4]="UnSelect",u[u.Pickup=5]="Pickup",u[u.PickDown=6]="PickDown",u[u.PickReset=7]="PickReset",u))(rn||{}),ha=(u=>(u[u.auto=0]="auto",u[u.crosshair=1]="crosshair",u[u.pointer=2]="pointer",u))(ha||{});class fa{constructor(i,r,a){Y(this,"layer");Y(this,"scene");Y(this,"mouseHandler");Y(this,"graphSelectHandler");Y(this,"graphFinishHandler");Y(this,"mode",0);Y(this,"currentEditEnt");Y(this,"hoveredEnt");Y(this,"pickedctl");Y(this,"modeCursor",{View:0,Create:1,Select:2,Edit:1,CtlEdit:1});Y(this,"lastPickPos",new L.Cartesian3(0,0,0));console.log("create editmode: ",r,a),this.initKeyboard(),this.layer=a,this.scene=i,this.mouseHandler=new Pl(i)}initKeyboard(){this.initKeyboardView(),this.initKeyboardCreate(),this.initKeyboardSelect(),this.initKeyboardEdit(),this.initKeyboardCtledit()}start(){this.nextMode(0,{})}finish(){this.nextMode(2,{})}setGraphSelectHandler(i){this.graphSelectHandler=i}setGraphFinishHandler(i){this.graphFinishHandler=i}create(i){return this.nextMode(1,{newEntity:i}),i}draw(i){return this.nextMode(1,{newEntity:i}),this.nextMode(2,{}),i}nextMode(i,r){switch(console.log(`mode changed from '${Wt[this.mode]}' by action '${rn[i]}'`),this.mode){case 0:switch(i){case 0:this.selectMode();break;case 1:this.createMode(r.newEntity);break;default:throw new Error(`invalid action: mode=${Wt[this.mode]}, act=${rn[i]}`)}break;case 2:switch(i){case 1:this.clearSelect(),this.createMode(r.newEntity);break;case 3:this.setSelectEntity(r.entity),this.editMode();break;case 2:this.clearSelect(),this.viewMode();break;default:throw new Error(`invalid action: mode=${Wt[this.mode]}, act=${rn[i]}`)}break;case 1:switch(i){case 2:this.clearCreate(),this.selectMode();break;case 1:this.clearCreate(),this.createMode(r.newEntity);break;default:throw new Error(`invalid action: mode=${Wt[this.mode]}, act=${rn[i]}`)}break;case 3:switch(i){case 4:this.clearEdit(),this.selectMode();break;case 1:this.clearEdit(),this.createMode(r.newEntity);break;case 5:this.ctlEditMode();break;default:throw new Error(`invalid action: mode=${Wt[this.mode]}, act=${rn[i]}`)}break;case 4:switch(i){case 6:this.clearCtlEdit(!1),this.editMode();break;case 7:this.clearCtlEdit(!0),this.editMode();break;default:throw new Error(`invalid action: mode=${Wt[this.mode]}, act=${rn[i]}`)}break;default:throw new Error(`invalid mode: mode=${Wt[this.mode]}, act=${rn[i]}`)}}viewMode(){this.setMode(0),this.mouseHandler.destory()}createMode(i){this.setMode(1),this.currentEditEnt=i;let r=this.currentEditEnt.addCtlPointCar(new L.Cartesian3);this.pickUpCtl(r),this.setMouseMove(),this.mouseHandler.setLeftClick(a=>{let o=this.pickPos(a.position);this.pickDownCtl(r),this.currentEditEnt.ishaveMaxCtls()?this.nextMode(2):(r=this.currentEditEnt.addCtlPointCar(o),this.pickUpCtl(r))}),this.mouseHandler.setMiddleClick(a=>this.currentEditEnt.deleteLastPoint()),this.mouseHandler.setRightClick(a=>{this.currentEditEnt.deleteLastPoint(),this.nextMode(2)})}clearCreate(){let i=this.currentEditEnt;i.isCtlNumValid()?(i.finish(),this.graphFinishHandler&&this.graphFinishHandler(i)):i.delete()}selectMode(){this.setMode(2),this.hoveredEnt=void 0,this.setMouseHieghtMove(),this.mouseHandler.setLeftClick(i=>{if(this.hoveredEnt){let r=this.hoveredEnt.id.graph;this.nextMode(3,{entity:r})}}),this.mouseHandler.setRightClick(i=>this.nextMode(2))}clearSelect(){this.hoveredEnt&&this.hoveredEnt.id.graph.lowLight()}setSelectEntity(i){i.lowLight(),this.currentEditEnt=i,i.selected(),i.toEdit(),this.callSelectHandler(i)}editMode(){this.setMode(3),this.setMouseMove(),this.mouseHandler.setLeftClick(i=>{this.drillCtl(i.position)&&this.nextMode(5)}),this.mouseHandler.setRightClick(i=>{this.nextMode(4)})}clearEdit(){this.currentEditEnt.finish(),this.graphFinishHandler&&this.graphFinishHandler(this.currentEditEnt),this.currentEditEnt=void 0}ctlEditMode(){this.setMode(4),this.pickUpCtl(this.pickedctl),this.setMouseMove(),this.mouseHandler.setLeftClick(i=>this.nextMode(6)),this.mouseHandler.setRightClick(i=>this.nextMode(7)),this.mouseHandler.setMiddleClick(i=>this.nextMode(7))}clearCtlEdit(i){this.pickedctl&&(i?this.pickResetCtl(this.pickedctl):this.pickDownCtl(this.pickedctl),this.pickedctl=void 0)}setMode(i){this.mode=i,mt.setContext(i),this.setCursor(this.modeCursor[Wt[i]]),console.log(`into ${Wt[this.mode]} mode`)}callSelectHandler(i){this.graphSelectHandler&&this.graphSelectHandler(i)}initKeyboardCreate(){mt.withContext(1,()=>{mt.bind("1",i=>console.log("create: ",i,this))})}initKeyboardSelect(){mt.withContext(2,()=>{mt.bind("1",i=>console.log("select: ",i,this)),mt.bind(["ctrl+shift+d","shift+delete"],i=>{this.deleteAllGraph()})})}initKeyboardView(){mt.withContext(0,()=>{mt.bind("1",i=>console.log("view: ",i,this))})}initKeyboardEdit(){mt.withContext(3,()=>{mt.bind("1",i=>console.log("edit: ",i,this)),mt.bind(["delete","ctrl+d"],i=>{this.deleteSelectGraph()})})}initKeyboardCtledit(){mt.withContext(4,()=>{mt.bind("1",i=>console.log("ctledit: ",i,this))})}deleteSelectGraph(){if(this.currentEditEnt){let i=this.currentEditEnt;return this.currentEditEnt.delete(),this.nextMode(2),i}else{console.log("no graph selected.");return}}drillCtl(i){let r=this.scene.drillPick(i);if(L.defined(r)){let a=r.filter(o=>this.currentEditEnt.ctls.indexOf(o.id)>=0);return a.length>0?(this.pickedctl=a[0].id,console.log("click on a ctl point: ",this.pickedctl),this.pickedctl):void 0}else return}setMouseHieghtMove(){this.mouseHandler.setMove(i=>{let r=this.scene.drillPick(i.endPosition);if(L.defined(r))if(this.hoveredEnt===void 0&&r.length>0){let a=r.reduce((o,l)=>l.id.level.getValue()>o.id.level.getValue()?l:o,r[0]);console.debug("moved to ent:",a),a.id.graph.highLight(),this.setCursor(2),this.hoveredEnt=a}else if(this.hoveredEnt!==void 0&&r.length>0){let a=r.reduce((o,l)=>l.id.level.getValue()>o.id.level.getValue()?l:o,r[0]);this.hoveredEnt===a||(console.debug("moved from ent1 to ent2: ",this.hoveredEnt,a),this.hoveredEnt.id.graph.lowLight(),a.id.graph.highLight(),this.setCursor(2),this.hoveredEnt=a)}else this.hoveredEnt!==void 0&&r.length===0&&(console.debug("moved out of ent: ",this.hoveredEnt),this.hoveredEnt.id.graph.lowLight(),this.setCursor(0),this.hoveredEnt=void 0)})}setMouseMove(){this.mouseHandler.setMove(i=>{window.cursorPos=this.pickPos(i.endPosition)})}setCursor(i){this.scene.canvas.style.cursor=ha[i]}pickPos(i){let r=this.scene.camera.getPickRay(i),a=this.scene.globe.pick(r,this.scene);return a?(this.lastPickPos=a,a):this.lastPickPos}pickUpCtl(i){i.label.text=new L.CallbackProperty((r,a)=>{if(window.cursorPos){let o=L.Cartographic.fromCartesian(window.cursorPos);if(o)return"Lon: "+L.Math.toDegrees(o.longitude).toPrecision(5)+`° Lat: `+L.Math.toDegrees(o.latitude).toPrecision(5)+`° Hei: `+o.height.toPrecision(5)+"m"}return""},!1),i.position=new L.CallbackProperty((r,a)=>window.cursorPos,!1)}pickDownCtl(i){i.label.text=i.label.text.getValue(L.JulianDate.now()),i.position=i.position.getValue(L.JulianDate.now())}pickResetCtl(i){i.label.text=i.label.text.getValue(L.JulianDate.now()),i.position=i.position.getValue(L.JulianDate.now())}}Y(fa,"seq",new Date().getTime());const Rr=class{constructor(i,r,a){Y(this,"entities");Y(this,"viewer");Y(this,"maxPointNum",1/0);Y(this,"minPointNum",1);Y(this,"isHideTempLine",!0);Y(this,"graph");Y(this,"ctls",[]);Y(this,"shapes",[]);Y(this,"tempShapes",[]);Y(this,"highLighted",!1);Y(this,"propDefs",[{name:"name",title:"名称",type:"string",editable:!0},{name:"type",title:"类型",type:"string",editable:!1},{name:"description",title:"描述",type:"string",editable:!0},{name:"level",title:"层",type:"number",editable:!0,min:-10,max:10,step:1},{name:"color",title:"颜色",type:"color",editable:!0},{name:"alpha",title:"透明度",type:"number",editable:!0,step:.05,max:1,min:0}]);Y(this,"props",{name:"",description:"",level:1,type:"graph",color:"#00ff00",alpha:.8,ctls:[]});Y(this,"selectHandler");Y(this,"finishHandler");if(!r)throw"get null viewer.";this.viewer=r,this.entities=a.entities,Object.assign(this.props,i),this.graph=this.entities.add({id:a.name+"_graph_"+Rr.seq++}),this.initRootEntity(a),this.initShape(),this.initTempShape(),this.initCtls(i.ctls),this.initHandler(i)}initHandler(i){this.selectHandler=i.selectHandler,this.finishHandler=i.finishHandler}initCtls(i){i&&(i.forEach(r=>{if(r instanceof Array)if(r.length===2){let a=L.Cartesian3.fromDegrees(r[0],r[1]);this.addCtlPointCar(a).finish()}else if(r.length===3){let a=L.Cartesian3.fromDegrees(r[0],r[1],r[2]);this.addCtlPointCar(a).finish()}else console.log("invalid pos array length: ",r);else{let a=L.Cartesian3.fromDegrees(r.longitude,r.latitude,r.height);this.addCtlPointCar(a).finish()}}),this.finish())}initRootEntity(i){}initShape(){console.log("init shape.",this.ctls)}increaseShape(i){console.log("update current shape for increase a ctl. ",i)}decreaseShape(i){console.log("update current shape for decrease a ctl: ",i)}initTempShape(){console.log("init temp shape",this.ctls)}increaseTempShape(i){console.log("update temp shape for increase a ctl: ",i)}decreaseTempShape(i){console.log("update temp shape for decrease a ctl: ",i)}getProperties(){let i={obj:this.constructor.name,ctls:this.getCtlPositionsPos()};return Object.assign(i,this.props),i}getCtlPositionsPos(){return this.getCtlPositions().map(i=>this.Cartesian3ToPosition(i))}getCtlPositions(){return this.ctls.map(i=>{let r=i.position.getValue(L.JulianDate.now());if(r)return r})}addCtlPointCar(i){console.log("in add ctl Pos");let r=this.entities.add({id:this.graph.id+"_ctlpoint_"+Rr.seq++,graph:this,point:{pixelSize:8,heightReference:L.HeightReference.CLAMP_TO_GROUND,color:L.Color.fromBytes(255,255,255,70),outlineWidth:1,outlineColor:L.Color.AQUA},label:{font:"10px sans-serif",style:L.LabelStyle.FILL,showBackground:!0,backgroundColor:L.Color.BLACK.withAlpha(.3),backgroundPadding:new L.Cartesian2(3,2),horizontalOrigin:L.HorizontalOrigin.CENTER,verticalOrigin:L.VerticalOrigin.BOTTOM,pixelOffset:new L.Cartesian2(0,-10),outlineWidth:0,heightReference:L.HeightReference.CLAMP_TO_GROUND,text:""},position:i});return this.ctls.push(r),console.log("added a ctl: ",r,this.ctls),this.increaseShape(r),this.increaseTempShape(r),r}fillShape(i){i.graph=this,this.shapes.push(i),i.level=new L.CallbackProperty((r,a)=>this.props.level,!0)}highLight(){this.highLighted=!0}lowLight(){this.highLighted=!1}ishaveMaxCtls(){return this.ctls.length>=this.maxPointNum}isCtlNumValid(){let i=this.ctls.length;return this.maxPointNum===1/0?i>=this.minPointNum:i>=this.maxPointNum}toEdit(){this.highLighted=!1,this.ctls.map(i=>{i.show=!0}),this.initTempShape()}finish(){console.log("finish current graph: ",this),this.ctls.map(i=>{i.show=!1}),this.finishHandler&&this.finishHandler(this),this.tempShapes.map(i=>{this.entities.remove(i)}),this.tempShapes=[]}selected(){this.selectHandler&&this.selectHandler(this)}delete(){this.entities.remove(this.graph),this.ctls.map(i=>{this.entities.remove(i)}),this.shapes.map(i=>{this.entities.remove(i)}),this.tempShapes.map(i=>{this.entities.remove(i)})}deleteLastPoint(){let i=this.ctls.pop();i!==void 0?(this.entities.remove(i),console.log("remove last control point: ",i),this.decreaseTempShape(i),this.decreaseShape(i)):console.log("no last point")}Cartesian3ToPosition(i){if(!i)return;let r=L.Cartographic.fromCartesian(i,this.viewer.scene.globe.ellipsoid);return r?{longitude:L.Math.toDegrees(r.longitude),latitude:L.Math.toDegrees(r.latitude),height:r.height}:void 0}};let Ut=Rr;Y(Ut,"seq",new Date().getTime());var rt=63710088e-1,ca={centimeters:rt*100,centimetres:rt*100,degrees:rt/111325,feet:rt*3.28084,inches:rt*39.37,kilometers:rt/1e3,kilometres:rt/1e3,meters:rt,metres:rt,miles:rt/1609.344,millimeters:rt*1e3,millimetres:rt*1e3,nauticalmiles:rt/1852,radians:1,yards:rt*1.0936};function yn(u,i,r){r===void 0&&(r={});var a={type:"Feature"};return(r.id===0||r.id)&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.properties=i||{},a.geometry=u,a}function Je(u,i,r){if(r===void 0&&(r={}),!u)throw new Error("coordinates is required");if(!Array.isArray(u))throw new Error("coordinates must be an Array");if(u.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Mr(u[0])||!Mr(u[1]))throw new Error("coordinates must contain numbers");var a={type:"Point",coordinates:u};return yn(a,i,r)}function Rn(u,i,r){r===void 0&&(r={});for(var a=0,o=u;a=0))throw new Error("length must be a positive number");return pa(da(u,i),r)}function Mr(u){return!isNaN(u)&&u!==null&&!Array.isArray(u)}function ga(u){return!!u&&u.constructor===Object}function kn(u,i,r){if(u!==null)for(var a,o,l,f,d,m,x,E=0,M=0,T,I=u.type,z=I==="FeatureCollection",F=I==="Feature",q=z?u.features.length:1,b=0;bm||z>x||F>E){d=M,m=a,x=z,E=F,l=0;return}var q=vt([d,M],r.properties);if(i(q,a,o,F,l)===!1)return!1;l++,d=M})===!1)return!1}}})}function Ce(u){if(!u)throw new Error("coord is required");if(!Array.isArray(u)){if(u.type==="Feature"&&u.geometry!==null&&u.geometry.type==="Point")return u.geometry.coordinates;if(u.type==="Point")return u.coordinates}if(Array.isArray(u)&&u.length>=2&&!Array.isArray(u[0])&&!Array.isArray(u[1]))return u;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Pi(u){if(Array.isArray(u))return u;if(u.type==="Feature"){if(u.geometry!==null)return u.geometry.coordinates}else if(u.coordinates)return u.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function va(u,i,r){if(!u)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!u||u.type!=="Feature"||!u.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!u.geometry||u.geometry.type!==i)throw new Error("Invalid input to "+r+": must be a "+i+", given "+u.geometry.type)}function Al(u){return u.type==="Feature"?u.geometry:u}function Ll(u,i){return u.type==="FeatureCollection"?"FeatureCollection":u.type==="GeometryCollection"?"GeometryCollection":u.type==="Feature"&&u.geometry!==null?u.geometry.type:u.type}var Mi={exports:{}},ya={exports:{}};(function(u,i){(function(r,a){u.exports=a()})(Ht,function(){function r(w,p,y,_,R){(function S(k,W,G,$,Q){for(;$>G;){if($-G>600){var re=$-G+1,ae=W-G+1,He=Math.log(re),ve=.5*Math.exp(2*He/3),ye=.5*Math.sqrt(He*ve*(re-ve)/re)*(ae-re/2<0?-1:1),we=Math.max(G,Math.floor(W-ae*ve/re+ye)),Qe=Math.min($,Math.floor(W+(re-ae)*ve/re+ye));S(k,W,we,Qe,Q)}var J=k[W],ie=G,ce=$;for(a(k,G,W),Q(k[$],J)>0&&a(k,G,$);ie0;)ce--}Q(k[G],J)===0?a(k,G,ce):a(k,++ce,$),ce<=W&&(G=ce+1),W<=ce&&($=ce-1)}})(w,p,y||0,_||w.length-1,R||o)}function a(w,p,y){var _=w[p];w[p]=w[y],w[y]=_}function o(w,p){return wp?1:0}var l=function(w){w===void 0&&(w=9),this._maxEntries=Math.max(4,w),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function f(w,p,y){if(!y)return p.indexOf(w);for(var _=0;_=w.minX&&p.maxY>=w.minY}function q(w){return{children:w,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function b(w,p,y,_,R){for(var S=[p,y];S.length;)if(!((y=S.pop())-(p=S.pop())<=_)){var k=p+Math.ceil((y-p)/_/2)*_;r(w,k,p,y,R),S.push(p,k,k,y)}}return l.prototype.all=function(){return this._all(this.data,[])},l.prototype.search=function(w){var p=this.data,y=[];if(!F(w,p))return y;for(var _=this.toBBox,R=[];p;){for(var S=0;S=0&&R[p].children.length>this._maxEntries;)this._split(R,p),p--;this._adjustParentBBoxes(_,R,p)},l.prototype._split=function(w,p){var y=w[p],_=y.children.length,R=this._minEntries;this._chooseSplitAxis(y,R,_);var S=this._chooseSplitIndex(y,R,_),k=q(y.children.splice(S,y.children.length-S));k.height=y.height,k.leaf=y.leaf,d(y,this.toBBox),d(k,this.toBBox),p?w[p-1].children.push(k):this._splitRoot(y,k)},l.prototype._splitRoot=function(w,p){this.data=q([w,p]),this.data.height=w.height+1,this.data.leaf=!1,d(this.data,this.toBBox)},l.prototype._chooseSplitIndex=function(w,p,y){for(var _,R,S,k,W,G,$,Q=1/0,re=1/0,ae=p;ae<=y-p;ae++){var He=m(w,0,ae,this.toBBox),ve=m(w,ae,y,this.toBBox),ye=(R=He,S=ve,k=void 0,W=void 0,G=void 0,$=void 0,k=Math.max(R.minX,S.minX),W=Math.max(R.minY,S.minY),G=Math.min(R.maxX,S.maxX),$=Math.min(R.maxY,S.maxY),Math.max(0,G-k)*Math.max(0,$-W)),we=T(He)+T(ve);ye=p;Q--){var re=w.children[Q];x(k,w.leaf?R(re):re),W+=I(k)}return W},l.prototype._adjustParentBBoxes=function(w,p,y){for(var _=y;_>=0;_--)x(p[_],w)},l.prototype._condense=function(w){for(var p=w.length-1,y=void 0;p>=0;p--)w[p].children.length===0?p>0?(y=w[p-1].children).splice(y.indexOf(w[p]),1):this.clear():d(w[p],this.toBBox)},l})})(ya);var Tl=ya.exports;class Ol{constructor(i=[],r=Rl){if(this.data=i,this.length=this.data.length,this.compare=r,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:r,compare:a}=this,o=r[i];for(;i>0;){const l=i-1>>1,f=r[l];if(a(o,f)>=0)break;r[i]=f,i=l}r[i]=o}_down(i){const{data:r,compare:a}=this,o=this.length>>1,l=r[i];for(;i=0)break;r[i]=d,i=f}r[i]=l}}function Rl(u,i){return ui?1:0}const kl=bl(Object.freeze(Object.defineProperty({__proto__:null,default:Ol},Symbol.toStringTag,{value:"Module"})));var Er={exports:{}},Dl=function(i,r,a,o){var l=i[0],f=i[1],d=!1;a===void 0&&(a=0),o===void 0&&(o=r.length);for(var m=(o-a)/2,x=0,E=m-1;xf!=z>f&&l<(I-M)*(f-T)/(z-T)+M;F&&(d=!d)}return d},Il=function(i,r,a,o){var l=i[0],f=i[1],d=!1;a===void 0&&(a=0),o===void 0&&(o=r.length);for(var m=o-a,x=0,E=m-1;xf!=z>f&&l<(I-M)*(f-T)/(z-T)+M;F&&(d=!d)}return d},_a=Dl,wa=Il;Er.exports=function(i,r,a,o){return r.length>0&&Array.isArray(r[0])?wa(i,r,a,o):_a(i,r,a,o)},Er.exports.nested=wa,Er.exports.flat=_a;var Kl=Er.exports,Ei={exports:{}};(function(u,i){(function(r,a){a(i)})(Ht,function(r){const o=33306690738754706e-32;function l(F,q,b,w,p){let y,_,R,S,k=q[0],W=w[0],G=0,$=0;W>k==W>-k?(y=k,k=q[++G]):(y=W,W=w[++$]);let Q=0;if(Gk==W>-k?(R=y-((_=k+y)-k),k=q[++G]):(R=y-((_=W+y)-W),W=w[++$]),y=_,R!==0&&(p[Q++]=R);Gk==W>-k?(R=y-((_=y+k)-(S=_-y))+(k-S),k=q[++G]):(R=y-((_=y+W)-(S=_-y))+(W-S),W=w[++$]),y=_,R!==0&&(p[Q++]=R);for(;G0!=R>0)return S;const k=Math.abs(_+R);return Math.abs(S)>=d*k?S:-function(W,G,$,Q,re,ae,He){let ve,ye,we,Qe,J,ie,ce,Ye,Ee,Re,pe,Ie,Xe,Ke,ft,je,yt,ot;const ke=W-re,et=$-re,_t=G-ae,Be=Q-ae;J=(ft=(Ye=ke-(ce=(ie=134217729*ke)-(ie-ke)))*(Re=Be-(Ee=(ie=134217729*Be)-(ie-Be)))-((Ke=ke*Be)-ce*Ee-Ye*Ee-ce*Re))-(pe=ft-(yt=(Ye=_t-(ce=(ie=134217729*_t)-(ie-_t)))*(Re=et-(Ee=(ie=134217729*et)-(ie-et)))-((je=_t*et)-ce*Ee-Ye*Ee-ce*Re))),E[0]=ft-(pe+J)+(J-yt),J=(Xe=Ke-((Ie=Ke+pe)-(J=Ie-Ke))+(pe-J))-(pe=Xe-je),E[1]=Xe-(pe+J)+(J-je),J=(ot=Ie+pe)-Ie,E[2]=Ie-(ot-J)+(pe-J),E[3]=ot;let Kt=function(Kn,kr){let on=kr[0];for(let or=1;or=wn||-Kt>=wn||(ve=W-(ke+(J=W-ke))+(J-re),we=$-(et+(J=$-et))+(J-re),ye=G-(_t+(J=G-_t))+(J-ae),Qe=Q-(Be+(J=Q-Be))+(J-ae),ve===0&&ye===0&&we===0&&Qe===0)||(wn=x*He+o*Math.abs(Kt),(Kt+=ke*Qe+Be*ve-(_t*we+et*ye))>=wn||-Kt>=wn))return Kt;J=(ft=(Ye=ve-(ce=(ie=134217729*ve)-(ie-ve)))*(Re=Be-(Ee=(ie=134217729*Be)-(ie-Be)))-((Ke=ve*Be)-ce*Ee-Ye*Ee-ce*Re))-(pe=ft-(yt=(Ye=ye-(ce=(ie=134217729*ye)-(ie-ye)))*(Re=et-(Ee=(ie=134217729*et)-(ie-et)))-((je=ye*et)-ce*Ee-Ye*Ee-ce*Re))),z[0]=ft-(pe+J)+(J-yt),J=(Xe=Ke-((Ie=Ke+pe)-(J=Ie-Ke))+(pe-J))-(pe=Xe-je),z[1]=Xe-(pe+J)+(J-je),J=(ot=Ie+pe)-Ie,z[2]=Ie-(ot-J)+(pe-J),z[3]=ot;const xn=l(4,E,4,z,M);J=(ft=(Ye=ke-(ce=(ie=134217729*ke)-(ie-ke)))*(Re=Qe-(Ee=(ie=134217729*Qe)-(ie-Qe)))-((Ke=ke*Qe)-ce*Ee-Ye*Ee-ce*Re))-(pe=ft-(yt=(Ye=_t-(ce=(ie=134217729*_t)-(ie-_t)))*(Re=we-(Ee=(ie=134217729*we)-(ie-we)))-((je=_t*we)-ce*Ee-Ye*Ee-ce*Re))),z[0]=ft-(pe+J)+(J-yt),J=(Xe=Ke-((Ie=Ke+pe)-(J=Ie-Ke))+(pe-J))-(pe=Xe-je),z[1]=Xe-(pe+J)+(J-je),J=(ot=Ie+pe)-Ie,z[2]=Ie-(ot-J)+(pe-J),z[3]=ot;const wt=l(xn,M,4,z,T);J=(ft=(Ye=ve-(ce=(ie=134217729*ve)-(ie-ve)))*(Re=Qe-(Ee=(ie=134217729*Qe)-(ie-Qe)))-((Ke=ve*Qe)-ce*Ee-Ye*Ee-ce*Re))-(pe=ft-(yt=(Ye=ye-(ce=(ie=134217729*ye)-(ie-ye)))*(Re=we-(Ee=(ie=134217729*we)-(ie-we)))-((je=ye*we)-ce*Ee-Ye*Ee-ce*Re))),z[0]=ft-(pe+J)+(J-yt),J=(Xe=Ke-((Ie=Ke+pe)-(J=Ie-Ke))+(pe-J))-(pe=Xe-je),z[1]=Xe-(pe+J)+(J-je),J=(ot=Ie+pe)-Ie,z[2]=Ie-(ot-J)+(pe-J),z[3]=ot;const bn=l(wt,T,4,z,I);return I[bn-1]}(F,q,b,w,p,y,k)},r.orient2dfast=function(F,q,b,w,p,y){return(q-y)*(b-p)-(F-p)*(w-y)},Object.defineProperty(r,"__esModule",{value:!0})})})(Ei,Ei.exports);var zl=Ei.exports,xa=Tl,Sr=kl,Bl=Kl,Nl=zl.orient2d;Sr.default&&(Sr=Sr.default),Mi.exports=ba,Mi.exports.default=ba;function ba(u,i,r){i=Math.max(0,i===void 0?2:i),r=r||0;var a=Gl(u),o=new xa(16);o.toBBox=function(w){return{minX:w[0],minY:w[1],maxX:w[0],maxY:w[1]}},o.compareMinX=function(w,p){return w[0]-p[0]},o.compareMinY=function(w,p){return w[1]-p[1]},o.load(u);for(var l=[],f=0,d;fl||d.push({node:E,dist:M})}for(;d.length&&!d.peek().node.children;){var T=d.pop(),I=T.node,z=Li(I,i,r),F=Li(I,a,o);if(T.dist=i.minX&&u[0]<=i.maxX&&u[1]>=i.minY&&u[1]<=i.maxY}function Pa(u,i,r){for(var a=Math.min(u[0],i[0]),o=Math.min(u[1],i[1]),l=Math.max(u[0],i[0]),f=Math.max(u[1],i[1]),d=r.search({minX:a,minY:o,maxX:l,maxY:f}),m=0;m0!=Dn(u,i,a)>0&&Dn(r,a,u)>0!=Dn(r,a,i)>0}function Si(u){var i=u.p,r=u.next.p;return u.minX=Math.min(i[0],r[0]),u.minY=Math.min(i[1],r[1]),u.maxX=Math.max(i[0],r[0]),u.maxY=Math.max(i[1],r[1]),u}function Gl(u){for(var i=u[0],r=u[0],a=u[0],o=u[0],l=0;la[0]&&(a=f),f[1]o[1]&&(o=f)}var d=[i,r,a,o],m=d.slice();for(l=0;l1?(a=r[0],o=r[1]):d>0&&(a+=l*d,o+=f*d)}return l=u[0]-a,f=u[1]-o,l*l+f*f}function Ar(u,i,r,a,o,l,f,d){var m=r-u,x=a-i,E=f-o,M=d-l,T=u-o,I=i-l,z=m*m+x*x,F=m*E+x*M,q=E*E+M*M,b=m*T+x*I,w=E*T+M*I,p=z*q-F*F,y,_,R,S,k=p,W=p;p===0?(_=0,k=1,S=w,W=q):(_=F*w-q*b,S=z*w-F*b,_<0?(_=0,S=w,W=q):_>k&&(_=k,S=w+F,W=q)),S<0?(S=0,-b<0?_=0:-b>z?_=k:(_=-b,k=z)):S>W&&(S=W,-b+F<0?_=0:-b+F>z?_=k:(_=-b+F,k=z)),y=_===0?0:_/k,R=S===0?0:S/W;var G=(1-y)*u+y*r,$=(1-y)*i+y*a,Q=(1-R)*o+R*f,re=(1-R)*l+R*d,ae=Q-G,He=re-$;return ae*ae+He*He}function ql(u,i){return u[0]===i[0]?u[1]-i[1]:u[0]-i[0]}function Yl(u){u.sort(ql);for(var i=[],r=0;r=2&&Dn(i[i.length-2],i[i.length-1],u[r])<=0;)i.pop();i.push(u[r])}for(var a=[],o=u.length-1;o>=0;o--){for(;a.length>=2&&Dn(a[a.length-2],a[a.length-1],u[o])<=0;)a.pop();a.push(u[o])}return a.pop(),i.pop(),i.concat(a)}var Xl=Mi.exports;const $l=bi(Xl);function Vl(u,i){i===void 0&&(i={}),i.concavity=i.concavity||1/0;var r=[];if(kn(u,function(o){r.push([o[0],o[1]])}),!r.length)return null;var a=$l(r,i.concavity);return a.length>3?Rn([a]):null}function Te(u,i,r){r===void 0&&(r={});var a=Ce(u),o=Ce(i),l=Ze(o[1]-a[1]),f=Ze(o[0]-a[0]),d=Ze(a[1]),m=Ze(o[1]),x=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(d)*Math.cos(m);return pa(2*Math.atan2(Math.sqrt(x),Math.sqrt(1-x)),r.units)}function Jl(u){if(!u)throw new Error("geojson is required");switch(u.type){case"Feature":return Ea(u);case"FeatureCollection":return Zl(u);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ti(u);default:throw new Error("unknown GeoJSON type")}}function Ea(u){var i={type:"Feature"};return Object.keys(u).forEach(function(r){switch(r){case"type":case"properties":case"geometry":return;default:i[r]=u[r]}}),i.properties=Sa(u.properties),i.geometry=Ti(u.geometry),i}function Sa(u){var i={};return u&&Object.keys(u).forEach(function(r){var a=u[r];typeof a=="object"?a===null?i[r]=null:Array.isArray(a)?i[r]=a.map(function(o){return o}):i[r]=Sa(a):i[r]=a}),i}function Zl(u){var i={type:"FeatureCollection"};return Object.keys(u).forEach(function(r){switch(r){case"type":case"features":return;default:i[r]=u[r]}}),i.features=u.features.map(function(r){return Ea(r)}),i}function Ti(u){var i={type:u.type};return u.bbox&&(i.bbox=u.bbox),u.type==="GeometryCollection"?(i.geometries=u.geometries.map(function(r){return Ti(r)}),i):(i.coordinates=Aa(u.coordinates),i)}function Aa(u){var i=u;return typeof i[0]!="object"?i.slice():i.map(function(r){return Aa(r)})}var Ql=function(){function u(i){this.points=i.points||[],this.duration=i.duration||1e4,this.sharpness=i.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=i.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;ri&&(r.push(o),a=l)}return r},u.prototype.vector=function(i){var r=this.pos(i+10),a=this.pos(i-10);return{angle:180*Math.atan2(r.y-a.y,r.x-a.x)/3.14,speed:Math.sqrt((a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y)+(a.z-r.z)*(a.z-r.z))}},u.prototype.pos=function(i){var r=i-this.delay;r<0&&(r=0),r>this.duration&&(r=this.duration-1);var a=r/this.duration;if(a>=1)return this.points[this.length-1];var o=Math.floor((this.points.length-1)*a),l=(this.length-1)*a-o;return jl(l,this.points[o],this.controls[o][1],this.controls[o+1][0],this.points[o+1])},u}();function jl(u,i,r,a,o){var l=eh(u),f={x:o.x*l[0]+a.x*l[1]+r.x*l[2]+i.x*l[3],y:o.y*l[0]+a.y*l[1]+r.y*l[2]+i.y*l[3],z:o.z*l[0]+a.z*l[1]+r.z*l[2]+i.z*l[3]};return f}function eh(u){var i=u*u,r=i*u;return[r,3*i*(1-u),3*u*(1-u)*(1-u),(1-u)*(1-u)*(1-u)]}function Qn(u,i){i===void 0&&(i={});for(var r=i.resolution||1e4,a=i.sharpness||.85,o=[],l=Al(u).coordinates.map(function(x){return{x:x[0],y:x[1]}}),f=new Ql({duration:r,points:l,sharpness:a}),d=function(x){var E=f.pos(x);Math.floor(x/100)%2===0&&o.push([E.x,E.y])},m=0;m180?-360:a[0]-o[0]>180?360:0;var l=nh(a,o),f=Ci(l,"meters",r.units);return f}function nh(u,i,r){r=r===void 0?rt:Number(r);var a=r,o=u[1]*Math.PI/180,l=i[1]*Math.PI/180,f=l-o,d=Math.abs(i[0]-u[0])*Math.PI/180;d>Math.PI&&(d-=2*Math.PI);var m=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),x=Math.abs(m)>1e-11?f/m:Math.cos(o),E=Math.sqrt(f*f+x*x*d*d),M=E*a;return M}function rh(u,i,r){if(r===void 0&&(r={}),r.method||(r.method="geodesic"),r.units||(r.units="kilometers"),!u)throw new Error("pt is required");if(Array.isArray(u)?u=Je(u):u.type==="Point"?u=yn(u):va(u,"Point","point"),!i)throw new Error("line is required");Array.isArray(i)?i=vt(i):i.type==="LineString"?i=yn(i):va(i,"LineString","line");var a=1/0,o=u.geometry.coordinates;return Sl(i,function(l){var f=l.geometry.coordinates[0],d=l.geometry.coordinates[1],m=ih(o,f,d,r);m0){i+=Math.abs(Da(u[0]));for(var r=1;r2){for(d=0;dE&&T.push(se(u,i,E,o).geometry.coordinates),vt(T,m)}function Ia(u){var i=u%360;return i<0&&(i+=360),i}function oh(u,i,r){r===void 0&&(r={});var a;r.final?a=Ka(Ce(i),Ce(u)):a=Ka(Ce(u),Ce(i));var o=a>180?-(360-a):a;return o}function Ka(u,i){var r=Ze(u[1]),a=Ze(i[1]),o=Ze(i[0]-u[0]);o>Math.PI&&(o-=2*Math.PI),o<-Math.PI&&(o+=2*Math.PI);var l=Math.log(Math.tan(a/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),f=Math.atan2(o,l);return(Pr(f)+360)%360}function zi(u,i,r,a){a===void 0&&(a={});var o=i<0,l=Ci(Math.abs(i),a.units,"meters");o&&(l=-Math.abs(l));var f=Ce(u),d=uh(f,l,r);return d[0]+=d[0]-f[0]>180?-360:f[0]-d[0]>180?360:0,Je(d,a.properties)}function uh(u,i,r,a){a=a===void 0?rt:Number(a);var o=i/a,l=u[0]*Math.PI/180,f=Ze(u[1]),d=Ze(r),m=o*Math.cos(d),x=f+m;Math.abs(x)>Math.PI/2&&(x=x>0?Math.PI-x:-Math.PI-x);var E=Math.log(Math.tan(x/2+Math.PI/4)/Math.tan(f/2+Math.PI/4)),M=Math.abs(E)>1e-11?m/E:Math.cos(f),T=o*Math.sin(d)/M,I=l+T;return[(I*180/Math.PI+540)%360-180,x*180/Math.PI]}function za(u){for(var i=Pi(u),r=0,a=1,o,l;a0}function lh(u,i,r){if(r=r||{},!ga(r))throw new Error("options is invalid");var a=r.pivot,o=r.mutate;if(!u)throw new Error("geojson is required");if(i==null||isNaN(i))throw new Error("angle is required");return i===0||(a||(a=Ri(u)),(o===!1||o===void 0)&&(u=Jl(u)),kn(u,function(l){var f=oh(a,l),d=f+i,m=Ta(a,l),x=Pi(zi(a,m,d));l[0]=x[0],l[1]=x[1]})),u}function hh(u,i,r,a){a=a||{};var o=a.steps||64,l=a.units||"kilometers",f=a.angle||0,d=a.pivot||u,m=a.properties||u.properties||{};if(!u)throw new Error("center is required");if(!i)throw new Error("xSemiAxis is required");if(!r)throw new Error("ySemiAxis is required");if(!ga(a))throw new Error("options must be an object");if(!Mr(o))throw new Error("steps must be a number");if(!Mr(f))throw new Error("angle must be a number");var x=Ce(u);if(l==="degrees")var E=Ze(f);else i=zi(u,i,90,{units:l}),r=zi(u,r,0,{units:l}),i=Ce(i)[0]-x[0],r=Ce(r)[1]-x[1];for(var M=[],T=0;T=-270&&(z=-z),I<-180&&I>=-360&&(F=-F),l==="degrees"){var q=z*Math.cos(E)+F*Math.sin(E),b=F*Math.cos(E)-z*Math.sin(E);z=q,F=b}M.push([z+x[0],F+x[1]])}return M.push(M[0]),l==="degrees"?Rn([M],m):lh(Rn([M],m),f,{pivot:d})}function Ba(u){var i=u*Math.PI/180;return Math.tan(i)}function Ge(u,i){return L.Cartesian3.fromDegrees(u[0],u[1],i,L.Ellipsoid.WGS84)}function qe(u){var r=L.Ellipsoid.WGS84.cartesianToCartographic(u);if(r){let a=L.Math.toDegrees(r.longitude),o=L.Math.toDegrees(r.latitude);return[a,o]}else return[0,0]}function jn(u){return u||(u=new Date),L.JulianDate.fromDate(u)}function Lr(u){let i=qe(u);return Je(i)}function fh(u){return u.geometry.coordinates[0].map(r=>Ge(r,void 0))}class it extends Ut{constructor(r,a,o){super({rotation:0,material:"",fill:!0,outline:!0,outlineColor:"#aaaaaa",outlineWidth:2,clamp:!1,...r},a,o);Y(this,"minPointNum",3);this.propDefs.push({name:"rotation",title:"旋转",type:"number",editable:!0,min:-360,max:360,step:1},{name:"material",title:"贴图",type:"string",editable:!1},{name:"fill",title:"填充",type:"boolean",editable:!0},{name:"outline",title:"边框",type:"boolean",editable:!0},{name:"outlineColor",title:"边框颜色",type:"color",editable:!0},{name:"outlineWidth",title:"边框宽度",type:"number",editable:!0,step:1,min:1,max:100})}addTempLine(r){let a=new L.Entity({polyline:{width:1,material:L.Color.BLUE.withAlpha(.7),positions:r}});return this.tempShapes.push(this.entities.add(a)),a}initShape(){let r=this.props.material,a=this.entities.add(new L.Entity({polygon:{fill:new L.CallbackProperty((o,l)=>this.props.fill,!0),material:new L.ImageMaterialProperty({image:r!==void 0&&r!==""&&r.slice(0,10)==="data:image"?r:"data:image/jpeg;base64,"+r,color:new L.CallbackProperty(()=>{let o=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return this.highLighted?o.brighten(.6,new L.Color):o},!0)}),stRotation:new L.CallbackProperty((o,l)=>this.props.rotation*3.14/180,!1),outline:new L.CallbackProperty((o,l)=>this.props.outline,!0),outlineColor:new L.CallbackProperty(()=>{let o=L.Color.fromCssColorString(this.props.outlineColor).withAlpha(this.props.alpha);return a.highLighted?o.brighten(.6,new L.Color):o},!0),outlineWidth:new L.CallbackProperty((o,l)=>this.props.outlineWidth,!0),hierarchy:new L.CallbackProperty((o,l)=>{let f=this.calcuteShape(this.ctls,o);return new L.PolygonHierarchy(f,[])},!0),perPositionHeight:!this.props.clamp,heightReference:this.props.clamp?L.HeightReference.CLAMP_TO_GROUND:void 0},parent:this.graph}));this.fillShape(a)}calcuteShape(r,a){return r.lengtho.position.getValue(a))}toEdit(){super.toEdit();let r=this.shapes[0];r.polygon.hierarchy=new L.CallbackProperty((a,o)=>new L.PolygonHierarchy(this.calcuteShape(this.ctls,a),[]),!1)}finish(){if(super.finish(),this.shapes.length>0){let r=this.shapes[0];r.polygon.hierarchy=new L.PolygonHierarchy(this.calcuteShape(this.ctls,jn(new Date)),[])}}}class Na extends it{constructor(r,a,o){super({type:"矩形",...r},a,o);Y(this,"maxPointNum",2);Y(this,"minPointNum",2)}calcuteShape(r,a){if(r.lengththis.Cartesian3ToPosition(m.position.getValue(a))),l=o[0],f=o[1],d=[l.longitude,l.latitude,l.height,l.longitude,f.latitude,l.height,f.longitude,f.latitude,f.height,f.longitude,l.latitude,f.height];return Z.Cartesian3.fromDegreesArrayHeights(d)}}class Fa extends Na{constructor(i,r,a){super({type:"图",image:"image/th1.jpg",outline:!1,...i},r,a),this.propDefs.push({name:"image",title:"图形",type:"string",editable:!0})}initShape(){let i=this.entities.add(new Z.Entity({polygon:{}}));super.fillShape(i),Object.assign(i.polygon,{fill:new Z.CallbackProperty((r,a)=>this.props.fill,!0),material:new Z.ImageMaterialProperty({image:new Z.CallbackProperty((r,a)=>"/"+this.props.image,!0),color:new Z.CallbackProperty((r,a)=>{let o=Z.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return i.highLighted?o.brighten(.6,new Z.Color):o},!0),transparent:!0}),outline:new Z.CallbackProperty((r,a)=>this.props.outline,!0),outlineColor:new Z.CallbackProperty((r,a)=>Z.Color.fromCssColorString(this.props.outlineColor).withAlpha(this.props.alpha),!0),height:0,outlineWidth:new Z.CallbackProperty((r,a)=>this.props.outlineWidth,!0),hierarchy:new Z.CallbackProperty((r,a)=>{let o=this.calcuteShape(this.ctls,r);return new Z.PolygonHierarchy(o,[])},!1)})}}class ch extends Fa{constructor(i,r,a){super({type:"红旗",image:"image/redflag1.png",...i},r,a)}}class Ha extends Ut{constructor(r,a,o){super({type:"3D模型",scale:30,uri:"station.gltf",...r},a,o);Y(this,"maxPointNum",1);Y(this,"minPointNum",1);this.propDefs.push({name:"scale",title:"缩放",type:"number",editable:!0,min:10,max:100,step:1},{name:"uri",title:"模型",type:"string",editable:!1})}initShape(){let r=this.entities.add(new L.Entity({model:{}}));this.fillShape(r),Object.assign(r.model,{uri:new L.CallbackProperty((a,o)=>"/model/"+this.props.uri,!0),scale:new L.CallbackProperty((a,o)=>this.props.scale,!0),color:new L.CallbackProperty((a,o)=>{let l=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return this.highLighted?l.brighten(.6,new L.Color):l},!0)})}calcuteShape(r,a){return r.lengththis.calcuteShape(this.ctls,r),!0)}finish(){this.shapes.length>0&&(super.finish(),this.shapes[0].position=this.calcuteShape(this.ctls,jn(new Date)))}}class ph extends Ha{constructor(i,r,a){super({type:"卫星",uri:"satellite.gltf",scale:3e4,height:7e5,...i},r,a),this.propDefs.push({name:"height",title:"高度",type:"number",min:1,max:3e7,step:1,unit:"米"})}calcuteShape(i,r){if(i.lengththis.props.pixelSize,!0),heightReference:L.HeightReference.CLAMP_TO_GROUND,color:new L.CallbackProperty((a,o)=>{let l=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return r.highLighted?l.brighten(.6,new L.Color):l},!0),outlineColor:new L.CallbackProperty(()=>{let a=L.Color.fromCssColorString(this.props.outlineColor).withAlpha(this.props.alpha);return r.highLighted?a.brighten(.6,new L.Color):a},!0),outlineWidth:new L.CallbackProperty((a,o)=>this.props.outlineWidth,!0)},position:new L.CallbackProperty((a,o)=>this.calcuteShape(this.ctls,a),!0)}));this.fillShape(r)}calcuteShape(r,a){return r.lengththis.calcuteShape(this.ctls,a),!0)}finish(){this.shapes.length>0&&(super.finish(),this.shapes[0].position=this.calcuteShape(this.ctls,jn()))}}class Bi extends Ut{constructor(r,a,o){super({type:"钉",rotation:0,scale:1,width:30,height:30,...r},a,o);Y(this,"maxPointNum",1);Y(this,"minPointNum",1);Y(this,"pinBuilder",new L.PinBuilder);this.propDefs.push({name:"rotation",title:"旋转",type:"number",editable:!0,step:1,max:360,min:-360},{name:"scale",title:"缩放",type:"number",editable:!0,min:.5,step:.1,max:100},{name:"width",title:"宽度",type:"number",editable:!0,step:1,min:0,max:1e4},{name:"height",title:"高度",type:"number",editable:!0,step:1,min:0,max:1e4})}calcuteShape(r,a){return r.lengththis.calcuteShape(this.ctls,a),!1)}finish(){this.shapes.length>0&&(super.finish(),this.shapes[0].position=this.calcuteShape(this.ctls,jn()))}}class gh extends Bi{constructor(i,r,a){super({type:"BillBoard",image:"/facility.gif",color:"#ff0",alpha:.8,width:30,height:30,...i},r,a),this.propDefs.push({name:"image",title:"图片",type:"string",editable:!1})}initShape(){let i=this.entities.add(new L.Entity({billboard:{}}));this.fillShape(i),Object.assign(i.billboard,{image:new L.CallbackProperty((r,a)=>this.props.image,!0),color:new L.CallbackProperty((r,a)=>{let o=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return i.highLighted?o.brighten(.6,new L.Color):o},!0),rotation:new L.CallbackProperty((r,a)=>(360-this.props.rotation)*3.14/180,!0),scale:new L.CallbackProperty((r,a)=>this.props.scale,!0),width:new L.CallbackProperty((r,a)=>this.props.width,!0),height:new L.CallbackProperty((r,a)=>this.props.height,!0),heightReference:L.HeightReference.CLAMP_TO_GROUND,verticalOrigin:L.VerticalOrigin.BOTTOM}),i.position=new L.CallbackProperty((r,a)=>this.calcuteShape(this.ctls.concat(window.cursor),r),!1)}}class mh extends Bi{constructor(r,a,o){super({type:"图标板",icon:"hospital",...r},a,o);Y(this,"pinBuilder",new L.PinBuilder);this.propDefs.push({name:"icon",title:"图标名",type:"string",editable:!0})}initShape(){let r=this.entities.add(new L.Entity({billboard:{}}));this.fillShape(r),this.props.icon,Object.assign(r.billboard,{image:new L.CallbackProperty((a,o)=>{let l=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return this.pinBuilder.fromMakiIconId(this.props.icon,l,this.props.height)},!0),rotation:new L.CallbackProperty((a,o)=>(360-this.props.rotation)*3.14/180,!0),scale:new L.CallbackProperty((a,o)=>this.props.scale,!0),width:new L.CallbackProperty((a,o)=>this.props.width,!0),height:new L.CallbackProperty((a,o)=>this.props.height,!0),heightReference:L.HeightReference.CLAMP_TO_GROUND,verticalOrigin:L.VerticalOrigin.BOTTOM}),r.position=new L.CallbackProperty((a,o)=>this.calcuteShape(this.ctls.concat(window.cursor),a),!1)}}class vh extends Bi{constructor(r,a,o){super({type:"文字板",text:"A",...r},a,o);Y(this,"pinBuilder",new L.PinBuilder);this.propDefs.push({name:"text",title:"文本",type:"string",editable:!0})}initShape(){let r=this.entities.add(new L.Entity({billboard:{}}));this.fillShape(r),Object.assign(r.billboard,{image:new L.CallbackProperty((a,o)=>{let l=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return this.pinBuilder.fromText(this.props.text,l,this.props.height).toDataURL()},!0),rotation:new L.CallbackProperty((a,o)=>(360-this.props.rotation)*3.14/180,!0),scale:new L.CallbackProperty((a,o)=>this.props.scale,!0),width:new L.CallbackProperty((a,o)=>this.props.width,!0),height:new L.CallbackProperty((a,o)=>this.props.height,!0),heightReference:L.HeightReference.CLAMP_TO_GROUND,verticalOrigin:L.VerticalOrigin.BOTTOM}),r.position=new L.CallbackProperty((a,o)=>this.calcuteShape(this.ctls.concat(window.cursor),a),!1)}}let yh=class extends it{constructor(r,a,o){super({type:"单箭头",...r},a,o);Y(this,"maxPointNum",2);Y(this,"minPointNum",2);Y(this,"options",{units:"kilometers"});this.propDefs.push()}calcuteShape(r,a){if(r.lengthf.position.getValue(a)).map(f=>{let d=qe(f);return Je(d)});if(l.length>1){let f=[],d=l[0],m=l[1],x=Oe(d,m),E=Te(d,m,this.options),M=E/10,T=E/10,I=170,z=T*.9,F=160,q=T*1.41;return f.push(se(d,M,x-90,this.options)),f.push(se(d,M,x,this.options)),f.push(se(d,M,x+90,this.options)),f.push(se(m,z,x+I,this.options)),f.push(se(m,q,x+F,this.options)),f.push(se(m,0,x,this.options)),f.push(se(m,q,x-F,this.options)),f.push(se(m,z,x-I,this.options)),f.map(b=>Ge(Ce(b)))}else return[]}};class _h extends it{constructor(r,a,o){super({type:"圆",...r},a,o);Y(this,"maxPointNum",2);Y(this,"minPointNum",2)}calcuteShape(r,a){if(r.lengthLr(d.position.getValue(a))),l=Te(o[0],o[1],{units:"kilometers"}),f=Oi(o[0],l,{units:"kilometers"});return fh(f)}initTempShape(){this.addTempLine(new Z.CallbackProperty((r,a)=>this.ctls.map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(r)}),!1))}}class wh extends it{constructor(r,a,o){super({type:"圆弧面",...r},a,o);Y(this,"maxPointNum",3);Y(this,"minPointNum",3)}calcuteShape(r,a){if(r.length{let I=qe(T.position.getValue(a));return Je(I)}),l=Oe(o[0],o[1]),f=Oe(o[0],o[2]),d=Te(o[0],o[1],{units:"kilometers"}),m=Te(o[0],o[2],{units:"kilometers"}),x=d>m?d:m;return Ki(o[0],x,l,f).geometry.coordinates.map(T=>Ge(T))}initTempShape(){this.addTempLine(new Z.CallbackProperty((r,a)=>{let o=this.ctls;return o.length==2?[o[1],o[0]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):o.length==3?[o[1],o[0],o[2]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):[]},!1))}}class xh extends it{constructor(r,a,o){super({type:"椭圆",...r},a,o);Y(this,"maxPointNum",3);Y(this,"minPointNum",2);Y(this,"option",{units:"kilometers"})}calcuteShape(r,a){if(r.lengthLr(f.position.getValue(a))),l;if(r.length===this.minPointNum){let f=Te(o[0],o[1],this.option);l=Oi(o[0],f,this.option)}else{let f=Te(o[0],o[1],this.option),d=Te(o[0],o[2],this.option);l=hh(o[0],f,d,this.option)}return Pi(l)[0].map(f=>Ge(f))}}initTempShape(){this.addTempLine(new L.CallbackProperty((r,a)=>{let o=this.ctls;return o.length==2?[o[1],o[0]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):o.length==3?[o[1],o[0],o[2],o[1]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):[]},!1))}}class bh extends it{constructor(r,a,o){super({type:"四角旗",...r},a,o);Y(this,"maxPointNum",2);Y(this,"minPointNum",2)}calcuteShape(r,a){if(r.length{let q=qe(F.position.getValue(a));return Je(q)}),l=o[0],f=o[1],d=La(l,f),m=Te(l,f),x=Oe(l,f);const E=se(f,m/2,x+90),M=se(d,m/50,x+90),T=se(d,m/2,x+90),I=se(l,m/50,x+90);return[l,I,M,T,E,f,d].map(F=>Ge(F.geometry.coordinates))}}class Ch extends it{constructor(r,a,o){super({type:"三角旗",...r},a,o);Y(this,"maxPointNum",2);Y(this,"minPointNum",2);Y(this,"options",{units:"meters"})}calcuteShape(r,a){if(r.length{let F=qe(z.position.getValue(a));return Je(F)}),l=o[0],f=o[1],d=La(l,f),m=Te(l,f),x=Oe(l,f);const E=se(l,m/50,x+90),M=se(d,m/2,x+90),T=se(d,m/50,x+90);return[l,E,T,M,f,d,l].map(z=>Ge(z.geometry.coordinates))}}class Ph extends it{constructor(r,a,o){super({type:"多段箭头",headWidth:5,tailWidth:20,...r},a,o);Y(this,"minPointNum",2);Y(this,"options",{units:"kilometers"});this.propDefs.push({name:"headWidth",title:"头部宽度",type:"number",editable:!0,step:1,min:1,max:100},{name:"tailWidth",title:"尾部宽度",type:"number",editable:!0,step:1,min:1,max:100})}getStartPoints(r,a,o){let l=Oe(r,a);return Te(r,a,this.options),[se(r,o,l-90,this.options),se(r,o,l,this.options),se(r,o,l+90,this.options)]}getEndPoints(r,a,o){let l=Oe(r,a);Te(r,a,this.options);let f=160,d=o/2/Math.cos((f-90)/180*Math.PI),m=150,x=o/Math.cos((m-90)/180*Math.PI);return[se(a,d,l+f,this.options),se(a,x,l+m,this.options),se(a,0,l,this.options),se(a,x,l-m,this.options),se(a,d,l-f,this.options)]}genMidPoints(r,a,o,l){let f=Oe(r,a),d=Oe(a,o);Te(a,o,this.options);let m=-(180-f-d)/2,x=(180+f+d)/2,E=se(a,l,m,this.options);return za(vt([a.geometry.coordinates,E.geometry.coordinates,o.geometry.coordinates,a.geometry.coordinates]))?{left:se(a,l,m,this.options),right:se(a,l,x,this.options)}:{right:se(a,l,m,this.options),left:se(a,l,x,this.options)}}calcuteShape(r,a){if(r.lengthf.position.getValue(a)).map(f=>{let d=qe(f);return Je(d)});if(l.length>1){l.map(b=>b.geometry.coordinates);let f=Te(l[0],l[1],this.options),d=f/10,m=f/10,x=this.getStartPoints(l[0],l[1],d),E=this.getEndPoints(l[l.length-2],l[l.length-1],m),M=[];if(l.length>2)for(let b=0;bb.right),E[0]].map(b=>b.geometry.coordinates),z=Qn(vt(I)).geometry.coordinates,F=[E[4],...M.reverse().map(b=>b.left),x[0]].map(b=>b.geometry.coordinates),q=Qn(vt(F)).geometry.coordinates;return T.push(...x.map(b=>b.geometry.coordinates)),T.push(...z),T.push(...E.map(b=>b.geometry.coordinates)),T.push(...q),T.map(b=>Ge(Ce(b)))}else return[]}}const{abs:er,cos:Xt,sin:In,acos:Mh,atan2:tr,sqrt:sn,pow:St}=Math;function nr(u){return u<0?-St(-u,1/3):St(u,1/3)}const Ua=Math.PI,Tr=2*Ua,an=Ua/2,Eh=1e-6,Ni=Number.MAX_SAFE_INTEGER||9007199254740991,Fi=Number.MIN_SAFE_INTEGER||-9007199254740991,Sh={x:0,y:0,z:0},U={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(u,i){const r=i(u);let a=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(a+=r.z*r.z),sn(a)},compute:function(u,i,r){if(u===0)return i[0].t=0,i[0];const a=i.length-1;if(u===1)return i[a].t=1,i[a];const o=1-u;let l=i;if(a===0)return i[0].t=u,i[0];if(a===1){const d={x:o*l[0].x+u*l[1].x,y:o*l[0].y+u*l[1].y,t:u};return r&&(d.z=o*l[0].z+u*l[1].z),d}if(a<4){let d=o*o,m=u*u,x,E,M,T=0;a===2?(l=[l[0],l[1],l[2],Sh],x=d,E=o*u*2,M=m):a===3&&(x=d*o,E=d*u*3,M=o*m*3,T=u*m);const I={x:x*l[0].x+E*l[1].x+M*l[2].x+T*l[3].x,y:x*l[0].y+E*l[1].y+M*l[2].y+T*l[3].y,t:u};return r&&(I.z=x*l[0].z+E*l[1].z+M*l[2].z+T*l[3].z),I}const f=JSON.parse(JSON.stringify(i));for(;f.length>1;){for(let d=0;d1;o--,l--){const f=[];for(let d=0,m;d"u")u=.5;else if(u===0||u===1)return u;const r=St(u,i)+St(1-u,i),a=r-1;return er(a/r)},projectionratio:function(u,i){if(i!==2&&i!==3)return!1;if(typeof u>"u")u=.5;else if(u===0||u===1)return u;const r=St(1-u,i),a=St(u,i)+r;return r/a},lli8:function(u,i,r,a,o,l,f,d){const m=(u*a-i*r)*(o-f)-(u-r)*(o*d-l*f),x=(u*a-i*r)*(l-d)-(i-a)*(o*d-l*f),E=(u-r)*(l-d)-(i-a)*(o-f);return E==0?!1:{x:m/E,y:x/E}},lli4:function(u,i,r,a){const o=u.x,l=u.y,f=i.x,d=i.y,m=r.x,x=r.y,E=a.x,M=a.y;return U.lli8(o,l,f,d,m,x,E,M)},lli:function(u,i){return U.lli4(u,u.c,i,i.c)},makeline:function(u,i){return new Me(u.x,u.y,(u.x+i.x)/2,(u.y+i.y)/2,i.x,i.y)},findbbox:function(u){let i=Ni,r=Ni,a=Fi,o=Fi;return u.forEach(function(l){const f=l.bbox();i>f.x.min&&(i=f.x.min),r>f.y.min&&(r=f.y.min),a0&&(E.c1=m,E.c2=x,E.s1=u,E.s2=r,l.push(E))})}),l},makeshape:function(u,i,r){const a=i.points.length,o=u.points.length,l=U.makeline(i.points[a-1],u.points[0]),f=U.makeline(u.points[o-1],i.points[0]),d={startcap:l,forward:u,back:i,endcap:f,bbox:U.findbbox([l,u,i,f])};return d.intersections=function(m){return U.shapeintersections(d,d.bbox,m,m.bbox,r)},d},getminmax:function(u,i,r){if(!r)return{min:0,max:0};let a=Ni,o=Fi,l,f;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let d=0,m=r.length;do&&(o=f[i]);return{min:a,mid:(a+o)/2,max:o,size:o-a}},align:function(u,i){const r=i.p1.x,a=i.p1.y,o=-tr(i.p2.y-a,i.p2.x-r),l=function(f){return{x:(f.x-r)*Xt(o)-(f.y-a)*In(o),y:(f.x-r)*In(o)+(f.y-a)*Xt(o)}};return u.map(l)},roots:function(u,i){i=i||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=u.length-1,a=U.align(u,i),o=function(S){return 0<=S&&S<=1};if(r===2){const S=a[0].y,k=a[1].y,W=a[2].y,G=S-2*k+W;if(G!==0){const $=-sn(k*k-S*W),Q=-S+k,re=-($+Q)/G,ae=-(-$+Q)/G;return[re,ae].filter(o)}else if(k!==W&&G===0)return[(2*k-W)/(2*k-2*W)].filter(o);return[]}const l=a[0].y,f=a[1].y,d=a[2].y,m=a[3].y;let x=-l+3*f-3*d+m,E=3*l-6*f+3*d,M=-3*l+3*f,T=l;if(U.approximately(x,0)){if(U.approximately(E,0))return U.approximately(M,0)?[]:[-T/M].filter(o);const S=sn(M*M-4*E*T),k=2*E;return[(S-M)/k,(-M-S)/k].filter(o)}E/=x,M/=x,T/=x;const I=(3*M-E*E)/3,z=I/3,F=(2*E*E*E-9*E*M+27*T)/27,q=F/2,b=q*q+z*z*z;let w,p,y,_,R;if(b<0){const S=-I/3,k=S*S*S,W=sn(k),G=-F/(2*W),$=G<-1?-1:G>1?1:G,Q=Mh($),re=nr(W),ae=2*re;return y=ae*Xt(Q/3)-E/3,_=ae*Xt((Q+Tr)/3)-E/3,R=ae*Xt((Q+2*Tr)/3)-E/3,[y,_,R].filter(o)}else{if(b===0)return w=q<0?nr(-q):-nr(q),y=2*w-E/3,_=-w-E/3,[y,_].filter(o);{const S=sn(b);return w=nr(-q+S),p=nr(q+S),[w-p-E/3].filter(o)}}},droots:function(u){if(u.length===3){const i=u[0],r=u[1],a=u[2],o=i-2*r+a;if(o!==0){const l=-sn(r*r-i*a),f=-i+r,d=-(l+f)/o,m=-(-l+f)/o;return[d,m]}else if(r!==a&&o===0)return[(2*r-a)/(2*(r-a))];return[]}if(u.length===2){const i=u[0],r=u[1];return i!==r?[i/(i-r)]:[]}return[]},curvature:function(u,i,r,a,o){let l,f,d,m,x=0,E=0;const M=U.compute(u,i),T=U.compute(u,r),I=M.x*M.x+M.y*M.y;if(a?(l=sn(St(M.y*T.z-T.y*M.z,2)+St(M.z*T.x-T.z*M.x,2)+St(M.x*T.y-T.x*M.y,2)),f=St(I+M.z*M.z,3/2)):(l=M.x*T.y-M.y*T.x,f=St(I,3/2)),l===0||f===0)return{k:0,r:0};if(x=l/f,E=f/l,!o){const z=U.curvature(u-.001,i,r,a,!0).k,F=U.curvature(u+.001,i,r,a,!0).k;m=(F-x+(x-z))/2,d=(er(F-x)+er(x-z))/2}return{k:x,r:E,dk:m,adk:d}},inflections:function(u){if(u.length<4)return[];const i=U.align(u,{p1:u[0],p2:u.slice(-1)[0]}),r=i[2].x*i[1].y,a=i[3].x*i[1].y,o=i[1].x*i[2].y,l=i[3].x*i[2].y,f=18*(-3*r+2*a+3*o-l),d=18*(3*r-a-3*o),m=18*(o-r);if(U.approximately(f,0)){if(!U.approximately(d,0)){let T=-m/d;if(0<=T&&T<=1)return[T]}return[]}const x=2*f;if(U.approximately(x,0))return[];const E=d*d-4*f*m;if(E<0)return[];const M=Math.sqrt(E);return[(M-d)/x,-(d+M)/x].filter(function(T){return 0<=T&&T<=1})},bboxoverlap:function(u,i){const r=["x","y"],a=r.length;for(let o=0,l,f,d,m;o=m)return!1;return!0},expandbox:function(u,i){i.x.minu.x.max&&(u.x.max=i.x.max),i.y.max>u.y.max&&(u.y.max=i.y.max),i.z&&i.z.max>u.z.max&&(u.z.max=i.z.max),u.x.mid=(u.x.min+u.x.max)/2,u.y.mid=(u.y.min+u.y.max)/2,u.z&&(u.z.mid=(u.z.min+u.z.max)/2),u.x.size=u.x.max-u.x.min,u.y.size=u.y.max-u.y.min,u.z&&(u.z.size=u.z.max-u.z.min)},pairiteration:function(u,i,r){const a=u.bbox(),o=i.bbox(),l=1e5,f=r||.5;if(a.x.size+a.y.sizeR||R>S)&&(_+=Tr),_>S&&(k=S,S=_,_=k)):S4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(l!==6&&l!==8&&l!==9&&l!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const f=this._3d=!o&&(l===9||l===12)||i&&i[0]&&typeof i[0].z<"u",d=this.points=[];for(let I=0,z=f?3:2;II+ir(z.y),0)"u"&&(o=.5),o===0)return new Me(r,r,a);if(o===1)return new Me(i,r,r);const l=Me.getABC(2,i,r,a,o);return new Me(i,l.A,a)}static cubicFromPoints(i,r,a,o,l){typeof o>"u"&&(o=.5);const f=Me.getABC(3,i,r,a,o);typeof l>"u"&&(l=U.dist(r,f.C));const d=l*(1-o)/o,m=U.dist(i,a),x=(a.x-i.x)/m,E=(a.y-i.y)/m,M=l*x,T=l*E,I=d*x,z=d*E,F={x:r.x-M,y:r.y-T},q={x:r.x+I,y:r.y+z},b=f.A,w={x:b.x+(F.x-b.x)/(1-o),y:b.y+(F.y-b.y)/(1-o)},p={x:b.x+(q.x-b.x)/o,y:b.y+(q.y-b.y)/o},y={x:i.x+(w.x-i.x)/o,y:i.y+(w.y-i.y)/o},_={x:a.x+(p.x-a.x)/(1-o),y:a.y+(p.y-a.y)/(1-o)};return new Me(i,y,_,a)}static getUtils(){return U}getUtils(){return Me.getUtils()}static get PolyBezier(){return rr}valueOf(){return this.toString()}toString(){return U.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const i=this.points,r=i[0].x,a=i[0].y,o=["M",r,a,this.order===2?"Q":"C"];for(let l=1,f=i.length;l0}length(){return U.length(this.derivative.bind(this))}static getABC(i=2,r,a,o,l=.5){const f=U.projectionratio(l,i),d=1-f,m={x:f*r.x+d*o.x,y:f*r.y+d*o.y},x=U.abcratio(l,i);return{A:{x:a.x+(a.x-m.x)/x,y:a.y+(a.y-m.y)/x},B:a,C:m,S:r,E:o}}getABC(i,r){r=r||this.get(i);let a=this.points[0],o=this.points[this.order];return Me.getABC(this.order,a,r,o,i)}getLUT(i){if(this.verify(),i=i||100,this._lut.length===i+1)return this._lut;this._lut=[],i++,this._lut=[];for(let r=0,a,o;r1?1:M,T=this.compute(M),T.t=M,T.d=x,T}get(i){return this.compute(i)}point(i){return this.points[i]}compute(i){return this.ratios?U.computeWithRatios(i,this.points,this.ratios,this._3d):U.compute(i,this.points,this._3d,this.ratios)}raise(){const i=this.points,r=[i[0]],a=i.length;for(let o=1,l,f;o1;){a=[];for(let f=0,d,m=r.length-1;f=0&&f<=1}),r=r.concat(i[a].sort(U.numberSort))}.bind(this)),i.values=r.sort(U.numberSort).filter(function(a,o){return r.indexOf(a)===o}),i}bbox(){const i=this.extrema(),r={};return this.dims.forEach(function(a){r[a]=U.getminmax(this,a,i[a])}.bind(this)),r}overlaps(i){const r=this.bbox(),a=i.bbox();return U.bboxoverlap(r,a)}offset(i,r){if(typeof r<"u"){const a=this.get(i),o=this.normal(i),l={c:a,n:o,x:a.x+o.x*r,y:a.y+o.y*r};return this._3d&&(l.z=a.z+o.z*r),l}if(this._linear){const a=this.normal(0),o=this.points.map(function(l){const f={x:l.x+i*a.x,y:l.y+i*a.y};return l.z&&a.z&&(f.z=l.z+i*a.z),f});return[new Me(o)]}return this.reduce().map(function(a){return a._linear?a.offset(i)[0]:a.scale(i)})}simple(){if(this.order===3){const o=U.angle(this.points[0],this.points[3],this.points[1]),l=U.angle(this.points[0],this.points[3],this.points[2]);if(o>0&&l<0||o<0&&l>0)return!1}const i=this.normal(0),r=this.normal(1);let a=i.x*r.x+i.y*r.y;return this._3d&&(a+=i.z*r.z),ir(Th(a))(1-d/o)*r+d/o*a);return new Me(this.points.map((f,d)=>({x:f.x+i.x*l[d],y:f.y+i.y*l[d]})))}scale(i){const r=this.order;let a=!1;if(typeof i=="function"&&(a=i),a&&r===2)return this.raise().scale(a);const o=this.clockwise,l=this.points;if(this._linear)return this.translate(this.normal(0),a?a(0):i,a?a(1):i);const f=a?a(0):i,d=a?a(1):i,m=[this.offset(0,10),this.offset(1,10)],x=[],E=U.lli4(m[0],m[0].c,m[1],m[1].c);if(!E)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(M){const T=x[M*r]=U.copy(l[M*r]);T.x+=(M?d:f)*m[M].n.x,T.y+=(M?d:f)*m[M].n.y}),a?([0,1].forEach(function(M){if(!(r===2&&M)){var T=l[M+1],I={x:T.x-E.x,y:T.y-E.y},z=a?a((M+1)/r):i;a&&!o&&(z=-z);var F=sr(I.x*I.x+I.y*I.y);I.x/=F,I.y/=F,x[M+1]={x:T.x+z*I.x,y:T.y+z*I.y}}}),new Me(x)):([0,1].forEach(M=>{if(r===2&&M)return;const T=x[M*r],I=this.derivative(M),z={x:T.x+I.x,y:T.y+I.y};x[M+1]=U.lli4(T,z,E,l[M+1])}),new Me(x))}outline(i,r,a,o){if(r=r===void 0?i:r,this._linear){const _=this.normal(0),R=this.points[0],S=this.points[this.points.length-1];let k,W,G;a===void 0&&(a=i,o=r),k={x:R.x+_.x*i,y:R.y+_.y*i},G={x:S.x+_.x*a,y:S.y+_.y*a},W={x:(k.x+G.x)/2,y:(k.y+G.y)/2};const $=[k,W,G];k={x:R.x-_.x*r,y:R.y-_.y*r},G={x:S.x-_.x*o,y:S.y-_.y*o},W={x:(k.x+G.x)/2,y:(k.y+G.y)/2};const Q=[G,W,k],re=U.makeline(Q[2],$[0]),ae=U.makeline($[2],Q[0]),He=[re,new Me($),ae,new Me(Q)];return new rr(He)}const l=this.reduce(),f=l.length,d=[];let m=[],x,E=0,M=this.length();const T=typeof a<"u"&&typeof o<"u";function I(_,R,S,k,W){return function(G){const $=k/S,Q=(k+W)/S,re=R-_;return U.map(G,0,1,_+$*re,_+Q*re)}}l.forEach(function(_){const R=_.length();T?(d.push(_.scale(I(i,a,M,E,R))),m.push(_.scale(I(-r,-o,M,E,R)))):(d.push(_.scale(i)),m.push(_.scale(-r))),E+=R}),m=m.map(function(_){return x=_.points,x[3]?_.points=[x[3],x[2],x[1],x[0]]:_.points=[x[2],x[1],x[0]],_}).reverse();const z=d[0].points[0],F=d[f-1].points[d[f-1].points.length-1],q=m[f-1].points[m[f-1].points.length-1],b=m[0].points[0],w=U.makeline(q,z),p=U.makeline(F,b),y=[w].concat(d).concat([p]).concat(m);return new rr(y)}outlineshapes(i,r,a){r=r||i;const o=this.outline(i,r).curves,l=[];for(let f=1,d=o.length;f1,m.endcap.virtual=f{var d=this.get(f);return U.between(d.x,r,o)&&U.between(d.y,a,l)})}selfintersects(i){const r=this.reduce(),a=r.length-2,o=[];for(let l=0,f,d,m;l0&&(l=l.concat(d))}),l}arcs(i){return i=i||.5,this._iterate(i,[])}_error(i,r,a,o){const l=(o-a)/4,f=this.get(a+l),d=this.get(o-l),m=U.dist(i,r),x=U.dist(i,f),E=U.dist(i,d);return ir(x-m)+ir(E-m)}_iterate(i,r){let a=0,o=1,l;do{l=0,o=1;let f=this.get(a),d,m,x,E,M=!1,T=!1,I,z=o,F=1;do if(T=M,E=x,z=(a+o)/2,d=this.get(z),m=this.get(o),x=U.getccenter(f,d,m),x.interval={start:a,end:o},M=this._error(x,f,a,o)<=i,I=T&&!M,I||(F=o),M){if(o>=1){if(x.interval.end=F=1,E=x,o>1){let b={x:x.x+x.r*Ah(x.e),y:x.y+x.r*Lh(x.e)};x.e+=U.angle({x:x.x,y:x.y},b,this.get(1))}break}o=o+(o-a)/2}else o=z;while(!I&&l++<100);if(l>=100)break;E=E||x,r.push(E),a=F}while(o<1);return r}}class Rh extends it{constructor(r,a,o){super({type:"钳击",arrowWidth:10,...r},a,o);Y(this,"minPointNum",2);Y(this,"maxPointNum",9);Y(this,"options",{units:"kilometers"});this.propDefs.push({name:"arrowWidth",title:"箭头宽度",type:"number",editable:!0,step:1,min:1,max:100})}createEndArrow(r,a,o){let l=160,f=o/2/Math.cos((l-90)/180*Math.PI),d=150,m=o/Math.cos((d-90)/180*Math.PI);return[se(r,f,a+l,this.options),se(r,m,a+d,this.options),se(r,0,a,this.options),se(r,m,a-d,this.options),se(r,f,a-l,this.options)]}calcEdge2(r){let a=r.filter(l=>l!=null).map(l=>{let f=Ce(l);return{x:f[0],y:f[1]}});return new Me(a).getLUT().map(l=>[l.x,l.y])}calcMid(r){let a=r.filter(l=>l!=null).map(l=>Ce(l)).map(l=>({x:l[0],y:l[1]}));return new Me(a).getLUT().map(l=>[l.x,l.y])}calcuteShape(r,a){if(r.lengtho.position.getValue(a));{let l=r.map(d=>d.position.getValue(a)).map(d=>{let m=qe(d);return Je(m)}),f=[];if(l.length>=7){let d=l[0],m=l[1];const x=Te(d,m);let E=l[2],M=l[3],T=l[4],I=l[5],z=l.slice(6,l.length),F=Oe(M,E),q=this.createEndArrow(E,F,x/10),b=this.calcEdge2([m,M,q[0]]),w=Oe(I,T),p=this.createEndArrow(T,w,x/10),y=this.calcEdge2([d,I,p[4]]).reverse(),_=this.calcMid([q[4]].concat(z).concat(p[0]));f=[...b,...q,..._,...p,...y]}else if(l.length==6){let d=l[0],m=l[1];const x=Te(d,m);let E=l[2],M=l[3],T=l[4],I=l[5],z=Oe(M,E),F=this.createEndArrow(E,z,x/10),q=this.calcEdge2([m,M,F[0]]),b=Oe(I,T),w=this.createEndArrow(T,b,x/10),p=this.calcEdge2([d,I,w[4]]).reverse();f=[...q,...F,...w,...p]}else if(l.length>=4){let d=l[0],m=l[1];const x=Te(d,m);let E=l[2],M=l[3],T=Oe(M,E),I=this.createEndArrow(E,T,x/10);f=[...this.calcEdge2([m,M,I[0]]),...I]}return f.map(d=>Ge(Ce(d)))}}initTempShape(){this.addTempLine(new L.CallbackProperty((r,a)=>{let o=this.ctls;return o.length>=2?[o[0],o[1]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):[]},!1)),this.addTempLine(new L.CallbackProperty((r,a)=>{let o=this.ctls;return o.length>=4?[o[2],o[3]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):[]},!1)),this.addTempLine(new L.CallbackProperty((r,a)=>{let o=this.ctls;return o.length>=6?[o[5],o[4]].map(l=>{var f;return(f=l.position)==null?void 0:f.getValue(r)}):[]},!1)),this.addTempLine(new L.CallbackProperty((r,a)=>{let o=this.ctls;if(o.length>=7){let l=o.slice(6,o.length);return[o[2]].concat(l).concat(o[4]).map(f=>{var d;return(d=f.position)==null?void 0:d.getValue(r)})}else return[]},!1))}}class kh extends it{constructor(r,a,o){super({type:"扇形",...r},a,o);Y(this,"maxPointNum",3);Y(this,"minPointNum",3)}calcuteShape(r,a){if(r.length{let I=qe(T.position.getValue(a));return Je(I)}),l=Oe(o[0],o[1]),f=Oe(o[0],o[2]),d=Te(o[0],o[1],{units:"kilometers"}),m=Te(o[0],o[2],{units:"kilometers"}),x=d>m?d:m;return Ki(o[0],x,l,f).geometry.coordinates.concat([o[0].geometry.coordinates]).map(T=>Ge(T))}initTempShape(){this.addTempLine(new Z.CallbackProperty((r,a)=>this.ctls.length==2?[this.ctls[1],this.ctls[0]].map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(r)}):this.ctls.length==3?[this.ctls[1],this.ctls[0],this.ctls[2]].map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(r)}):[],!1))}}class Dh extends it{constructor(r,a,o){super({type:"平滑面",...r},a,o);Y(this,"minPointNum",3);this.propDefs.push()}calcuteShape(r,a){if(r.lengtho.position.getValue(a));{let o=r.map(m=>qe(m.position.getValue(a)));o.push(o[0]);let l=vt(o);return Qn(l).geometry.coordinates.map(m=>Ge(m))}}}class Ih extends it{constructor(r,a,o){super({type:"单方型箭头",arrowWidth:10,...r},a,o);Y(this,"maxPointNum",2);Y(this,"minPointNum",2);Y(this,"options",{units:"kilometers"});this.propDefs.push({name:"arrowWidth",title:"箭头宽度",type:"number",editable:!0,step:1,min:1,max:100})}calcuteShape(r,a){if(r.lengthf.position.getValue(a)).map(f=>{let d=qe(f);return Je(d)});if(l.length>1){let f=[],d=l[0],m=l[1],x=Oe(d,m),M=Te(d,m,this.options)/10,T=157.5,I=M,z=135,F=M*2.732/2;return f.push(se(d,M/2,x-90,this.options)),f.push(se(d,M/2,x+90,this.options)),f.push(se(m,I,x+T,this.options)),f.push(se(m,F,x+z,this.options)),f.push(se(m,0,x,this.options)),f.push(se(m,F,x-z,this.options)),f.push(se(m,I,x-T,this.options)),f.map(q=>Ge(Ce(q)))}else return[]}}class _n extends Ut{constructor(r,a,o){super({type:"折线",width:5,fill:!0,clamp:!0,...r},a,o);Y(this,"minPointNum",2);this.propDefs.push({name:"width",title:"线宽",type:"number",editable:!0,min:1,max:256},{name:"fill",title:"是否填充",type:"boolean",editable:!0},{name:"clamp",title:"是否贴地",type:"boolean",editable:!0})}addTempLine(r){let a=new L.Entity({polyline:{width:1,material:L.Color.BLUE.withAlpha(.7),positions:r}});return this.tempShapes.push(this.entities.add(a)),a}initShape(){let r=this.entities.add(new L.Entity({name:"画线",polyline:{width:new L.CallbackProperty((a,o)=>this.props.width,!0),material:new L.ColorMaterialProperty(new L.CallbackProperty(()=>{let a=L.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return this.highLighted?a.brighten(.6,new L.Color):a},!0)),positions:new L.CallbackProperty((a,o)=>this.calcuteShape(this.ctls,a),!1),clampToGround:new L.CallbackProperty((a,o)=>this.props.clamp==!0,!0)}}));this.fillShape(r)}calcuteShape(r,a){return r.map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(a)})}toEdit(){super.toEdit();let r=this.shapes[0];r.polyline.positions=new L.CallbackProperty((a,o)=>this.calcuteShape(this.ctls,a),!1)}finish(){super.finish(),this.shapes.length>0&&(this.shapes[0].polyline.positions=this.calcuteShape(this.ctls,jn(new Date)))}}class Hi extends _n{constructor(i,r,a){super({type:"n阶bezier曲线",...i},r,a)}calcuteShape(i,r){if(i.length{var o;return(o=a.position)==null?void 0:o.getValue(r)});{let o=i.map(f=>qe(f.position.getValue(r))).map(f=>({x:f[0],y:f[1]}));return new Me(o).getLUT().map(f=>Ge([f.x,f.y]))}}initTempShape(){this.addTempLine(new Z.CallbackProperty((i,r)=>this.ctls.map(a=>{var o;return(o=a.position)==null?void 0:o.getValue(i)}),!1))}}class Kh extends Hi{constructor(r,a,o){super({type:"2阶bezier曲线",...r},a,o);Y(this,"maxPointNum",3)}}class zh extends Hi{constructor(r,a,o){super({type:"3阶bezier曲线",...r},a,o);Y(this,"maxPointNum",4)}}class Bh extends _n{constructor(i,r,a){super({type:"平滑bezier曲线",...i},r,a)}calcuteShape(i,r){if(i.lengthqe(d.position.getValue(r))),o=vt(a);return Qn(o).geometry.coordinates.map(d=>Ge(d))}initTempShape(){this.addTempLine(new L.CallbackProperty((i,r)=>this.ctls.map(a=>{var o;return(o=a.position)==null?void 0:o.getValue(i)}),!1))}}class Nh extends _n{constructor(r,a,o){super({type:"圆弧线",...r},a,o);Y(this,"maxPointNum",3);Y(this,"minPointNum",3)}calcuteShape(r,a){if(r.length{let I=qe(T.position.getValue(a));return Je(I)}),l=Oe(o[0],o[1]),f=Oe(o[0],o[2]),d=Te(o[0],o[1],{units:"kilometers"}),m=Te(o[0],o[2],{units:"kilometers"}),x=d>m?d:m;return Ki(o[0],x,l,f).geometry.coordinates.map(T=>Ge(T))}initTempShape(){this.addTempLine(new Z.CallbackProperty((r,a)=>this.ctls.length==2?[this.ctls[1],this.ctls[0]].map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(r)}):this.ctls.length==3?[this.ctls[1],this.ctls[0],this.ctls[2]].map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(r)}):[],!1))}}class ar extends _n{constructor(i,r,a){super({type:"顶点折线",pointPixelSize:12,pointColor:"#00FF00",pointAlpha:.8,...i},r,a),this.propDefs.push({name:"pointColor",title:"顶点颜色",type:"color",editable:!0},{name:"pointAlpha",title:"顶点透明度",type:"number",editable:!0,step:.05,max:1,min:0},{name:"pointPixelSize",title:"顶点大小",type:"number",editable:!0,min:1,max:256,step:1})}increaseShape(i){let r=this.entities.add(new L.Entity({point:{}}));this.fillShape(r),Object.assign(r.point,{pixelSize:new L.CallbackProperty((a,o)=>this.props.pointPixelSize,!0),color:new L.CallbackProperty((a,o)=>{let l=L.Color.fromCssColorString(this.props.pointColor).withAlpha(this.props.pointAlpha);return this.highLighted?l.brighten(.6,new L.Color):l},!0),heightReference:L.HeightReference.CLAMP_TO_GROUND}),r.position=new L.CallbackProperty((a,o)=>i.position.getValue(L.JulianDate.fromDate(new Date)),!0)}decreaseShape(i){let r=this.shapes.pop();this.entities.remove(r)}}class Fh extends ar{constructor(i,r,a){super({type:"顶点平滑曲线",...i},r,a)}calcuteShape(i,r){if(i.lengthqe(d.position.getValue(r))),o=vt(a);return Qn(o).geometry.coordinates.map(d=>Ge(d))}initTempShape(){this.addTempLine(new L.CallbackProperty((i,r)=>this.ctls.map(a=>{var o;return(o=a.position)==null?void 0:o.getValue(i)}),!1))}}class Hh extends _n{constructor(r,a,o){super({type:"线段",...r},a,o);Y(this,"maxPointNum",2)}}class Wh extends ar{constructor(i,r,a){super({type:"距离测量",...i},r,a)}initShape(){super.initShape(),this.ctls.map((i,r,a)=>{let o=i,l=r>0?a[r-1]:void 0;l&&this.createDistanceText(o,l)})}increaseShape(i){if(super.increaseShape(i),this.ctls.length>1){let r=i,a=this.ctls[this.ctls.length-2];this.createDistanceText(r,a)}}decreaseShape(i){super.decreaseShape(i);let r=this.shapes.pop();this.entities.remove(r)}createDistanceText(i,r){this.shapes.push(this.entities.add(new L.Entity({position:new L.CallbackProperty((a,o)=>i.position.getValue(a),!1),label:{text:new L.CallbackProperty((a,o)=>{let l=L.Cartesian3.distance(i.position.getValue(L.JulianDate.fromDate(new Date)),r.position.getValue(L.JulianDate.fromDate(new Date)));return l<1e3?"距离: "+l.toFixed(3)+" m":l<1e4?"距离: "+l.toFixed(2)+" m":"距离: "+(l/1e3).toFixed(1)+" km"},!1),font:"12px monospace",horizontalOrigin:L.HorizontalOrigin.LEFT,verticalOrigin:L.VerticalOrigin.BOTTOM,pixelOffset:new L.Cartesian2(15,-10)}})))}}class Uh extends it{constructor(i,r,a){super({type:"面积测量",...i},r,a)}initShape(){super.initShape(),this.createAreaText()}createAreaText(){this.shapes.push(this.entities.add(new L.Entity({position:new L.CallbackProperty((i,r)=>{if(!(this.ctls.length<3)){let a=this.ctls.map(l=>qe(l.position.getValue(i)));a.push(a[0]);let o=Ce(ki(Rn([a])));return Ge(o)}},!1),label:{text:new L.CallbackProperty((i,r)=>{if(this.ctls.length<3)return"";{let a=this.ctls.map(f=>qe(f.position.getValue(i)));a.push(a[0]);let o=Rn([a]);ki(o);let l=sh(o);return l<1e3?"面积"+l.toFixed(3)+" m2":l<1e6?"面积"+l.toFixed(2)+" m2":"面积"+(l/1e6).toFixed(1)+" km2"}},!1),font:"18px monospace",horizontalOrigin:L.HorizontalOrigin.CENTER,verticalOrigin:L.VerticalOrigin.CENTER,pixelOffset:new L.Cartesian2(0,0),fillColor:L.Color.RED.withAlpha(.9)}})))}}class Gh extends ar{constructor(i,r,a){super({type:"角度测量",...i},r,a)}initShape(){super.initShape(),this.ctls.map((i,r,a)=>{let o=i,l=r>0?a[r-1]:void 0;l&&this.createAngleText(l,o)})}increaseShape(i){if(super.increaseShape(i),this.ctls.length>1){let r=i,a=this.ctls[this.ctls.length-2];this.createAngleText(a,r)}}decreaseShape(i){super.decreaseShape(i);let r=this.shapes.pop();this.entities.remove(r)}createAngleText(i,r){this.shapes.push(this.entities.add(new L.Entity({position:new L.CallbackProperty((a,o)=>i.position.getValue(a),!1),label:{text:new L.CallbackProperty((a,o)=>{let l=Lr(i.position.getValue(a)),f=Lr(r.position.getValue(a));return Oe(l,f).toFixed(2)+"°"},!1),font:"12px monospace",horizontalOrigin:L.HorizontalOrigin.LEFT,verticalOrigin:L.VerticalOrigin.BOTTOM,pixelOffset:new L.Cartesian2(15,-10)}})))}}class qh extends ar{constructor(r,a,o){super({type:"三角测量",...r},a,o);Y(this,"maxPointNum",2)}initShape(){super.initShape();let r=this.shapes[0];r.polyline.clampToGround=!1,this.createDistanceLine(),this.createDistanceText()}isLowThen(r,a){let o=this.getCartographic(r).height,l=this.getCartographic(a).height;return o-l}getPx(r){let a=r.map(l=>l.position.getValue(L.JulianDate.now())).map(l=>this.Cartesian3ToCartographic(l)).sort((l,f)=>l.height-f.height),o=L.Cartographic.fromRadians(a[0].longitude,a[0].latitude,a[1].height);return[a[0],o,a[1]].map(l=>this.CartographicToCartesian3(l))}createDistanceLine(){let r=this.entities.add(new L.Entity({polyline:{width:1,material:L.Color.BLUE.withAlpha(.7),positions:new L.CallbackProperty((a,o)=>this.ctls.length>1?this.getPx(this.ctls):[],!1)}}));super.fillShape(r)}createDistanceText(){let r=this.entities.add(new L.Entity({position:new L.CallbackProperty((a,o)=>this.ctls.length>1?this.getPx(this.ctls)[1]:void 0,!1),label:{text:new L.CallbackProperty((a,o)=>{if(this.ctls.length>1){let l=this.getPx(this.ctls),f=L.Cartesian3.distance(this.ctls[0].position.getValue(a),this.ctls[1].position.getValue(a)),d=L.Cartesian3.distance(l[1],l[2]),m=this.isLowThen(this.ctls[0],this.ctls[1]);return m=Math.abs(m),f<1e3?"两地距离:"+f.toFixed(3)+` 米 水平距离:`+d.toFixed(3)+` 米 高度差:`+m.toFixed(3)+" 米":f<1e4?"两地距离:"+f.toFixed(2)+` 米 水平距离:`+d.toFixed(2)+` 米 高度差:`+m.toFixed(2)+" 米":"两地距离:"+(f/1e3).toFixed(1)+` 千米 水平距离:`+(d/1e3).toFixed(1)+` 千米 高度差:`+m.toFixed(2)+" 米"}else return""},!1),font:"12px monospace",horizontalOrigin:L.HorizontalOrigin.CENTER,verticalOrigin:L.VerticalOrigin.CENTER,pixelOffset:new L.Cartesian2(0,0)}}));super.fillShape(r)}}class Yh extends Ut{constructor(i,r,a){super({type:"视域线",maskedColor:"#ff0000",clamp:!1,...i},r,a),this.propDefs.push({name:"maskedColor",title:"不可视段颜色",type:"color",editable:!0})}getSightPoints(i,r){var x,E;let a=(x=i.position)==null?void 0:x.getValue(Z.JulianDate.now()),o=(E=r.position)==null?void 0:E.getValue(Z.JulianDate.now()),l=Z.Cartesian3.subtract(o,a,new Z.Cartesian3);if(Z.Cartesian3.magnitude(l)==0)return o;let f=Z.Cartesian3.normalize(l,new Z.Cartesian3),d=r.ray?r.ray:new Z.Ray;d.direction=f,d.origin=a;let m=this.viewer.scene.globe.pick(d,this.viewer.scene,new Z.Cartesian3);return m||o}addSightLine(i,r){this.shapes.push(this.entities.add(new Z.Entity({name:"不可视部分",polyline:{width:new Z.CallbackProperty((o,l)=>this.props.width,!0),material:new Z.ColorMaterialProperty(new Z.CallbackProperty(()=>{let o=Z.Color.fromCssColorString(this.props.maskedColor).withAlpha(this.props.alpha);return this.highLighted?o.brighten(.6,new Z.Color):o},!0)),positions:new Z.CallbackProperty((o,l)=>[this.getSightPoints(i,r),r.position.getValue(o)],!1),classificationType:Z.ClassificationType.TERRAIN,clampToGround:!1}})));let a=this.entities.add(new Z.Entity({name:"可视范围",polyline:{width:new Z.CallbackProperty((o,l)=>this.props.width,!0),material:new Z.ColorMaterialProperty(new Z.CallbackProperty(()=>{let o=Z.Color.fromCssColorString(this.props.color).withAlpha(this.props.alpha);return this.highLighted?o.brighten(.6,new Z.Color):o},!0)),positions:new Z.CallbackProperty((o,l)=>[i.position.getValue(o),this.getSightPoints(i,r)],!1),clampToGround:!1}}));this.fillShape(a)}increaseShape(i){this.ctls.length>1?this.addSightLine(this.ctls[0],i):console.log("add origin point",i)}decreaseShape(i){super.decreaseShape(i),this.entities.remove(this.shapes.pop()),this.entities.remove(this.shapes.pop())}increaseTempShape(i){this.ctls.length>1&&this.tempShapes.push(this.entities.add(new Z.Entity({name:"遮挡点",point:{pixelSize:19,color:Z.Color.fromCssColorString("#ff0000"),heightReference:Z.HeightReference.CLAMP_TO_GROUND},position:new Z.CallbackProperty((r,a)=>this.getSightPoints(this.ctls[0],i),!1)})))}decreaseTempShape(i){this.entities.remove(this.tempShapes.pop())}}var Or={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */Or.exports,function(u,i){(function(){var r,a="4.17.21",o=200,l="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",f="Expected a function",d="Invalid `variable` option passed into `_.template`",m="__lodash_hash_undefined__",x=500,E="__lodash_placeholder__",M=1,T=2,I=4,z=1,F=2,q=1,b=2,w=4,p=8,y=16,_=32,R=64,S=128,k=256,W=512,G=30,$="...",Q=800,re=16,ae=1,He=2,ve=3,ye=1/0,we=9007199254740991,Qe=17976931348623157e292,J=0/0,ie=4294967295,ce=ie-1,Ye=ie>>>1,Ee=[["ary",S],["bind",q],["bindKey",b],["curry",p],["curryRight",y],["flip",W],["partial",_],["partialRight",R],["rearg",k]],Re="[object Arguments]",pe="[object Array]",Ie="[object AsyncFunction]",Xe="[object Boolean]",Ke="[object Date]",ft="[object DOMException]",je="[object Error]",yt="[object Function]",ot="[object GeneratorFunction]",ke="[object Map]",et="[object Number]",_t="[object Null]",Be="[object Object]",Kt="[object Promise]",wn="[object Proxy]",xn="[object RegExp]",wt="[object Set]",bn="[object String]",Kn="[object Symbol]",kr="[object Undefined]",on="[object WeakMap]",or="[object WeakSet]",ur="[object ArrayBuffer]",zn="[object DataView]",Wi="[object Float32Array]",Ui="[object Float64Array]",Gi="[object Int8Array]",qi="[object Int16Array]",Yi="[object Int32Array]",Xi="[object Uint8Array]",$i="[object Uint8ClampedArray]",Vi="[object Uint16Array]",Ji="[object Uint32Array]",Zh=/\b__p \+= '';/g,Qh=/\b(__p \+=) '' \+/g,jh=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ya=/&(?:amp|lt|gt|quot|#39);/g,Xa=/[&<>"']/g,ef=RegExp(Ya.source),tf=RegExp(Xa.source),nf=/<%-([\s\S]+?)%>/g,rf=/<%([\s\S]+?)%>/g,$a=/<%=([\s\S]+?)%>/g,sf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,af=/^\w*$/,of=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Zi=/[\\^$.*+?()[\]{}|]/g,uf=RegExp(Zi.source),Qi=/^\s+/,lf=/\s/,hf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ff=/\{\n\/\* \[wrapped with (.+)\] \*/,cf=/,? & /,pf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,df=/[()=,{}\[\]\/\s]/,gf=/\\(\\)?/g,mf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Va=/\w*$/,vf=/^[-+]0x[0-9a-f]+$/i,yf=/^0b[01]+$/i,_f=/^\[object .+?Constructor\]$/,wf=/^0o[0-7]+$/i,xf=/^(?:0|[1-9]\d*)$/,bf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Dr=/($^)/,Cf=/['\n\r\u2028\u2029\\]/g,Ir="\\ud800-\\udfff",Pf="\\u0300-\\u036f",Mf="\\ufe20-\\ufe2f",Ef="\\u20d0-\\u20ff",Ja=Pf+Mf+Ef,Za="\\u2700-\\u27bf",Qa="a-z\\xdf-\\xf6\\xf8-\\xff",Sf="\\xac\\xb1\\xd7\\xf7",Af="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Lf="\\u2000-\\u206f",Tf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ja="A-Z\\xc0-\\xd6\\xd8-\\xde",eo="\\ufe0e\\ufe0f",to=Sf+Af+Lf+Tf,ji="['’]",Of="["+Ir+"]",no="["+to+"]",Kr="["+Ja+"]",ro="\\d+",Rf="["+Za+"]",io="["+Qa+"]",so="[^"+Ir+to+ro+Za+Qa+ja+"]",es="\\ud83c[\\udffb-\\udfff]",kf="(?:"+Kr+"|"+es+")",ao="[^"+Ir+"]",ts="(?:\\ud83c[\\udde6-\\uddff]){2}",ns="[\\ud800-\\udbff][\\udc00-\\udfff]",Bn="["+ja+"]",oo="\\u200d",uo="(?:"+io+"|"+so+")",Df="(?:"+Bn+"|"+so+")",lo="(?:"+ji+"(?:d|ll|m|re|s|t|ve))?",ho="(?:"+ji+"(?:D|LL|M|RE|S|T|VE))?",fo=kf+"?",co="["+eo+"]?",If="(?:"+oo+"(?:"+[ao,ts,ns].join("|")+")"+co+fo+")*",Kf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",zf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",po=co+fo+If,Bf="(?:"+[Rf,ts,ns].join("|")+")"+po,Nf="(?:"+[ao+Kr+"?",Kr,ts,ns,Of].join("|")+")",Ff=RegExp(ji,"g"),Hf=RegExp(Kr,"g"),rs=RegExp(es+"(?="+es+")|"+Nf+po,"g"),Wf=RegExp([Bn+"?"+io+"+"+lo+"(?="+[no,Bn,"$"].join("|")+")",Df+"+"+ho+"(?="+[no,Bn+uo,"$"].join("|")+")",Bn+"?"+uo+"+"+lo,Bn+"+"+ho,zf,Kf,ro,Bf].join("|"),"g"),Uf=RegExp("["+oo+Ir+Ja+eo+"]"),Gf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qf=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yf=-1,Ae={};Ae[Wi]=Ae[Ui]=Ae[Gi]=Ae[qi]=Ae[Yi]=Ae[Xi]=Ae[$i]=Ae[Vi]=Ae[Ji]=!0,Ae[Re]=Ae[pe]=Ae[ur]=Ae[Xe]=Ae[zn]=Ae[Ke]=Ae[je]=Ae[yt]=Ae[ke]=Ae[et]=Ae[Be]=Ae[xn]=Ae[wt]=Ae[bn]=Ae[on]=!1;var Se={};Se[Re]=Se[pe]=Se[ur]=Se[zn]=Se[Xe]=Se[Ke]=Se[Wi]=Se[Ui]=Se[Gi]=Se[qi]=Se[Yi]=Se[ke]=Se[et]=Se[Be]=Se[xn]=Se[wt]=Se[bn]=Se[Kn]=Se[Xi]=Se[$i]=Se[Vi]=Se[Ji]=!0,Se[je]=Se[yt]=Se[on]=!1;var Xf={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},$f={"&":"&","<":"<",">":">",'"':""","'":"'"},Vf={"&":"&","<":"<",">":">",""":'"',"'":"'"},Jf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Zf=parseFloat,Qf=parseInt,go=typeof Ht=="object"&&Ht&&Ht.Object===Object&&Ht,jf=typeof self=="object"&&self&&self.Object===Object&&self,tt=go||jf||Function("return this")(),is=i&&!i.nodeType&&i,Cn=is&&!0&&u&&!u.nodeType&&u,mo=Cn&&Cn.exports===is,ss=mo&&go.process,At=function(){try{var A=Cn&&Cn.require&&Cn.require("util").types;return A||ss&&ss.binding&&ss.binding("util")}catch{}}(),vo=At&&At.isArrayBuffer,yo=At&&At.isDate,_o=At&&At.isMap,wo=At&&At.isRegExp,xo=At&&At.isSet,bo=At&&At.isTypedArray;function xt(A,K,D){switch(D.length){case 0:return A.call(K);case 1:return A.call(K,D[0]);case 2:return A.call(K,D[0],D[1]);case 3:return A.call(K,D[0],D[1],D[2])}return A.apply(K,D)}function ec(A,K,D,V){for(var oe=-1,_e=A==null?0:A.length;++oe<_e;){var We=A[oe];K(V,We,D(We),A)}return V}function Lt(A,K){for(var D=-1,V=A==null?0:A.length;++D-1}function as(A,K,D){for(var V=-1,oe=A==null?0:A.length;++V-1;);return D}function To(A,K){for(var D=A.length;D--&&Nn(K,A[D],0)>-1;);return D}function lc(A,K){for(var D=A.length,V=0;D--;)A[D]===K&&++V;return V}var hc=hs(Xf),fc=hs($f);function cc(A){return"\\"+Jf[A]}function pc(A,K){return A==null?r:A[K]}function Fn(A){return Uf.test(A)}function dc(A){return Gf.test(A)}function gc(A){for(var K,D=[];!(K=A.next()).done;)D.push(K.value);return D}function ds(A){var K=-1,D=Array(A.size);return A.forEach(function(V,oe){D[++K]=[oe,V]}),D}function Oo(A,K){return function(D){return A(K(D))}}function hn(A,K){for(var D=-1,V=A.length,oe=0,_e=[];++D-1}function np(e,n){var s=this.__data__,h=ei(s,e);return h<0?(++this.size,s.push([e,n])):s[h][1]=n,this}$t.prototype.clear=Qc,$t.prototype.delete=jc,$t.prototype.get=ep,$t.prototype.has=tp,$t.prototype.set=np;function Vt(e){var n=-1,s=e==null?0:e.length;for(this.clear();++n=n?e:n)),e}function Rt(e,n,s,h,c,v){var C,P=n&M,O=n&T,B=n&I;if(s&&(C=c?s(e,h,c,v):s(e)),C!==r)return C;if(!De(e))return e;var N=ue(e);if(N){if(C=ad(e),!P)return ct(e,C)}else{var H=at(e),X=H==yt||H==ot;if(mn(e))return pu(e,P);if(H==Be||H==Re||X&&!c){if(C=O||X?{}:Ru(e),!P)return O?Vp(e,yp(C,e)):$p(e,Uo(C,e))}else{if(!Se[H])return c?e:{};C=od(e,H,P)}}v||(v=new Bt);var j=v.get(e);if(j)return j;v.set(e,C),ol(e)?e.forEach(function(ne){C.add(Rt(ne,n,s,ne,e,v))}):sl(e)&&e.forEach(function(ne,de){C.set(de,Rt(ne,n,s,de,e,v))});var te=B?O?Fs:Ns:O?dt:$e,he=N?r:te(e);return Lt(he||e,function(ne,de){he&&(de=ne,ne=e[de]),gr(C,de,Rt(ne,n,s,de,e,v))}),C}function _p(e){var n=$e(e);return function(s){return Go(s,e,n)}}function Go(e,n,s){var h=s.length;if(e==null)return!h;for(e=Pe(e);h--;){var c=s[h],v=n[c],C=e[c];if(C===r&&!(c in e)||!v(C))return!1}return!0}function qo(e,n,s){if(typeof e!="function")throw new Tt(f);return br(function(){e.apply(r,s)},n)}function mr(e,n,s,h){var c=-1,v=zr,C=!0,P=e.length,O=[],B=n.length;if(!P)return O;s&&(n=Le(n,bt(s))),h?(v=as,C=!1):n.length>=o&&(v=lr,C=!1,n=new En(n));e:for(;++cc?0:c+s),h=h===r||h>c?c:le(h),h<0&&(h+=c),h=s>h?0:ll(h);s0&&s(P)?n>1?nt(P,n-1,s,h,c):ln(c,P):h||(c[c.length]=P)}return c}var xs=_u(),$o=_u(!0);function Gt(e,n){return e&&xs(e,n,$e)}function bs(e,n){return e&&$o(e,n,$e)}function ni(e,n){return un(n,function(s){return en(e[s])})}function An(e,n){n=dn(n,e);for(var s=0,h=n.length;e!=null&&sn}function bp(e,n){return e!=null&&be.call(e,n)}function Cp(e,n){return e!=null&&n in Pe(e)}function Pp(e,n,s){return e>=st(n,s)&&e=120&&N.length>=120)?new En(C&&N):r}N=e[0];var H=-1,X=P[0];e:for(;++H-1;)P!==e&&Xr.call(P,O,1),Xr.call(e,O,1);return e}function su(e,n){for(var s=e?n.length:0,h=s-1;s--;){var c=n[s];if(s==h||c!==v){var v=c;jt(c)?Xr.call(e,c,1):Rs(e,c)}}return e}function Ls(e,n){return e+Jr(No()*(n-e+1))}function zp(e,n,s,h){for(var c=-1,v=Ue(Vr((n-e)/(s||1)),0),C=D(v);v--;)C[h?v:++c]=e,e+=s;return C}function Ts(e,n){var s="";if(!e||n<1||n>we)return s;do n%2&&(s+=e),n=Jr(n/2),n&&(e+=e);while(n);return s}function fe(e,n){return Xs(Iu(e,n,gt),e+"")}function Bp(e){return Wo(Zn(e))}function Np(e,n){var s=Zn(e);return pi(s,Sn(n,0,s.length))}function _r(e,n,s,h){if(!De(e))return e;n=dn(n,e);for(var c=-1,v=n.length,C=v-1,P=e;P!=null&&++cc?0:c+n),s=s>c?c:s,s<0&&(s+=c),c=n>s?0:s-n>>>0,n>>>=0;for(var v=D(c);++h>>1,C=e[v];C!==null&&!Pt(C)&&(s?C<=n:C=o){var B=n?null:jp(e);if(B)return Nr(B);C=!1,c=lr,O=new En}else O=n?[]:P;e:for(;++h=h?e:kt(e,n,s)}var cu=Tc||function(e){return tt.clearTimeout(e)};function pu(e,n){if(n)return e.slice();var s=e.length,h=Do?Do(s):new e.constructor(s);return e.copy(h),h}function Ks(e){var n=new e.constructor(e.byteLength);return new qr(n).set(new qr(e)),n}function Gp(e,n){var s=n?Ks(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function qp(e){var n=new e.constructor(e.source,Va.exec(e));return n.lastIndex=e.lastIndex,n}function Yp(e){return dr?Pe(dr.call(e)):{}}function du(e,n){var s=n?Ks(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function gu(e,n){if(e!==n){var s=e!==r,h=e===null,c=e===e,v=Pt(e),C=n!==r,P=n===null,O=n===n,B=Pt(n);if(!P&&!B&&!v&&e>n||v&&C&&O&&!P&&!B||h&&C&&O||!s&&O||!c)return 1;if(!h&&!v&&!B&&e=P)return O;var B=s[h];return O*(B=="desc"?-1:1)}}return e.index-n.index}function mu(e,n,s,h){for(var c=-1,v=e.length,C=s.length,P=-1,O=n.length,B=Ue(v-C,0),N=D(O+B),H=!h;++P1?s[c-1]:r,C=c>2?s[2]:r;for(v=e.length>3&&typeof v=="function"?(c--,v):r,C&<(s[0],s[1],C)&&(v=c<3?r:v,c=1),n=Pe(n);++h-1?c[v?n[C]:C]:r}}function bu(e){return Qt(function(n){var s=n.length,h=s,c=Ot.prototype.thru;for(e&&n.reverse();h--;){var v=n[h];if(typeof v!="function")throw new Tt(f);if(c&&!C&&fi(v)=="wrapper")var C=new Ot([],!0)}for(h=C?h:s;++h1&&me.reverse(),N&&OP))return!1;var B=v.get(e),N=v.get(n);if(B&&N)return B==n&&N==e;var H=-1,X=!0,j=s&F?new En:r;for(v.set(e,n),v.set(n,e);++H1?"& ":"")+n[h],n=n.join(s>2?", ":" "),e.replace(hf,`{ /* [wrapped with `+n+`] */ `)}function ld(e){return ue(e)||On(e)||!!(zo&&e&&e[zo])}function jt(e,n){var s=typeof e;return n=n??we,!!n&&(s=="number"||s!="symbol"&&xf.test(e))&&e>-1&&e%1==0&&e0){if(++n>=Q)return arguments[0]}else n=0;return e.apply(r,arguments)}}function pi(e,n){var s=-1,h=e.length,c=h-1;for(n=n===r?h:n;++s1?e[n-1]:r;return s=typeof s=="function"?(e.pop(),s):r,Xu(e,s)});function $u(e){var n=g(e);return n.__chain__=!0,n}function w0(e,n){return n(e),e}function di(e,n){return n(e)}var x0=Qt(function(e){var n=e.length,s=n?e[0]:0,h=this.__wrapped__,c=function(v){return ws(v,e)};return n>1||this.__actions__.length||!(h instanceof ge)||!jt(s)?this.thru(c):(h=h.slice(s,+s+(n?1:0)),h.__actions__.push({func:di,args:[c],thisArg:r}),new Ot(h,this.__chain__).thru(function(v){return n&&!v.length&&v.push(r),v}))});function b0(){return $u(this)}function C0(){return new Ot(this.value(),this.__chain__)}function P0(){this.__values__===r&&(this.__values__=ul(this.value()));var e=this.__index__>=this.__values__.length,n=e?r:this.__values__[this.__index__++];return{done:e,value:n}}function M0(){return this}function E0(e){for(var n,s=this;s instanceof jr;){var h=Hu(s);h.__index__=0,h.__values__=r,n?c.__wrapped__=h:n=h;var c=h;s=s.__wrapped__}return c.__wrapped__=e,n}function S0(){var e=this.__wrapped__;if(e instanceof ge){var n=e;return this.__actions__.length&&(n=new ge(this)),n=n.reverse(),n.__actions__.push({func:di,args:[$s],thisArg:r}),new Ot(n,this.__chain__)}return this.thru($s)}function A0(){return hu(this.__wrapped__,this.__actions__)}var L0=ai(function(e,n,s){be.call(e,s)?++e[s]:Jt(e,s,1)});function T0(e,n,s){var h=ue(e)?Co:wp;return s&<(e,n,s)&&(n=r),h(e,ee(n,3))}function O0(e,n){var s=ue(e)?un:Xo;return s(e,ee(n,3))}var R0=xu(Wu),k0=xu(Uu);function D0(e,n){return nt(gi(e,n),1)}function I0(e,n){return nt(gi(e,n),ye)}function K0(e,n,s){return s=s===r?1:le(s),nt(gi(e,n),s)}function Vu(e,n){var s=ue(e)?Lt:cn;return s(e,ee(n,3))}function Ju(e,n){var s=ue(e)?tc:Yo;return s(e,ee(n,3))}var z0=ai(function(e,n,s){be.call(e,s)?e[s].push(n):Jt(e,s,[n])});function B0(e,n,s,h){e=pt(e)?e:Zn(e),s=s&&!h?le(s):0;var c=e.length;return s<0&&(s=Ue(c+s,0)),wi(e)?s<=c&&e.indexOf(n,s)>-1:!!c&&Nn(e,n,s)>-1}var N0=fe(function(e,n,s){var h=-1,c=typeof n=="function",v=pt(e)?D(e.length):[];return cn(e,function(C){v[++h]=c?xt(n,C,s):vr(C,n,s)}),v}),F0=ai(function(e,n,s){Jt(e,s,n)});function gi(e,n){var s=ue(e)?Le:jo;return s(e,ee(n,3))}function H0(e,n,s,h){return e==null?[]:(ue(n)||(n=n==null?[]:[n]),s=h?r:s,ue(s)||(s=s==null?[]:[s]),ru(e,n,s))}var W0=ai(function(e,n,s){e[s?0:1].push(n)},function(){return[[],[]]});function U0(e,n,s){var h=ue(e)?os:So,c=arguments.length<3;return h(e,ee(n,4),s,c,cn)}function G0(e,n,s){var h=ue(e)?nc:So,c=arguments.length<3;return h(e,ee(n,4),s,c,Yo)}function q0(e,n){var s=ue(e)?un:Xo;return s(e,yi(ee(n,3)))}function Y0(e){var n=ue(e)?Wo:Bp;return n(e)}function X0(e,n,s){(s?lt(e,n,s):n===r)?n=1:n=le(n);var h=ue(e)?gp:Np;return h(e,n)}function $0(e){var n=ue(e)?mp:Hp;return n(e)}function V0(e){if(e==null)return 0;if(pt(e))return wi(e)?Hn(e):e.length;var n=at(e);return n==ke||n==wt?e.size:Es(e).length}function J0(e,n,s){var h=ue(e)?us:Wp;return s&<(e,n,s)&&(n=r),h(e,ee(n,3))}var Z0=fe(function(e,n){if(e==null)return[];var s=n.length;return s>1&<(e,n[0],n[1])?n=[]:s>2&<(n[0],n[1],n[2])&&(n=[n[0]]),ru(e,nt(n,1),[])}),mi=Oc||function(){return tt.Date.now()};function Q0(e,n){if(typeof n!="function")throw new Tt(f);return e=le(e),function(){if(--e<1)return n.apply(this,arguments)}}function Zu(e,n,s){return n=s?r:n,n=e&&n==null?e.length:n,Zt(e,S,r,r,r,r,n)}function Qu(e,n){var s;if(typeof n!="function")throw new Tt(f);return e=le(e),function(){return--e>0&&(s=n.apply(this,arguments)),e<=1&&(n=r),s}}var Js=fe(function(e,n,s){var h=q;if(s.length){var c=hn(s,Vn(Js));h|=_}return Zt(e,h,n,s,c)}),ju=fe(function(e,n,s){var h=q|b;if(s.length){var c=hn(s,Vn(ju));h|=_}return Zt(n,h,e,s,c)});function el(e,n,s){n=s?r:n;var h=Zt(e,p,r,r,r,r,r,n);return h.placeholder=el.placeholder,h}function tl(e,n,s){n=s?r:n;var h=Zt(e,y,r,r,r,r,r,n);return h.placeholder=tl.placeholder,h}function nl(e,n,s){var h,c,v,C,P,O,B=0,N=!1,H=!1,X=!0;if(typeof e!="function")throw new Tt(f);n=It(n)||0,De(s)&&(N=!!s.leading,H="maxWait"in s,v=H?Ue(It(s.maxWait)||0,n):v,X="trailing"in s?!!s.trailing:X);function j(Fe){var Ft=h,nn=c;return h=c=r,B=Fe,C=e.apply(nn,Ft),C}function te(Fe){return B=Fe,P=br(de,n),N?j(Fe):C}function he(Fe){var Ft=Fe-O,nn=Fe-B,xl=n-Ft;return H?st(xl,v-nn):xl}function ne(Fe){var Ft=Fe-O,nn=Fe-B;return O===r||Ft>=n||Ft<0||H&&nn>=v}function de(){var Fe=mi();if(ne(Fe))return me(Fe);P=br(de,he(Fe))}function me(Fe){return P=r,X&&h?j(Fe):(h=c=r,C)}function Mt(){P!==r&&cu(P),B=0,h=O=c=P=r}function ht(){return P===r?C:me(mi())}function Et(){var Fe=mi(),Ft=ne(Fe);if(h=arguments,c=this,O=Fe,Ft){if(P===r)return te(O);if(H)return cu(P),P=br(de,n),j(O)}return P===r&&(P=br(de,n)),C}return Et.cancel=Mt,Et.flush=ht,Et}var j0=fe(function(e,n){return qo(e,1,n)}),eg=fe(function(e,n,s){return qo(e,It(n)||0,s)});function tg(e){return Zt(e,W)}function vi(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new Tt(f);var s=function(){var h=arguments,c=n?n.apply(this,h):h[0],v=s.cache;if(v.has(c))return v.get(c);var C=e.apply(this,h);return s.cache=v.set(c,C)||v,C};return s.cache=new(vi.Cache||Vt),s}vi.Cache=Vt;function yi(e){if(typeof e!="function")throw new Tt(f);return function(){var n=arguments;switch(n.length){case 0:return!e.call(this);case 1:return!e.call(this,n[0]);case 2:return!e.call(this,n[0],n[1]);case 3:return!e.call(this,n[0],n[1],n[2])}return!e.apply(this,n)}}function ng(e){return Qu(2,e)}var rg=Up(function(e,n){n=n.length==1&&ue(n[0])?Le(n[0],bt(ee())):Le(nt(n,1),bt(ee()));var s=n.length;return fe(function(h){for(var c=-1,v=st(h.length,s);++c=n}),On=Jo(function(){return arguments}())?Jo:function(e){return ze(e)&&be.call(e,"callee")&&!Ko.call(e,"callee")},ue=D.isArray,yg=vo?bt(vo):Ep;function pt(e){return e!=null&&_i(e.length)&&!en(e)}function Ne(e){return ze(e)&&pt(e)}function _g(e){return e===!0||e===!1||ze(e)&&ut(e)==Xe}var mn=kc||ua,wg=yo?bt(yo):Sp;function xg(e){return ze(e)&&e.nodeType===1&&!Cr(e)}function bg(e){if(e==null)return!0;if(pt(e)&&(ue(e)||typeof e=="string"||typeof e.splice=="function"||mn(e)||Jn(e)||On(e)))return!e.length;var n=at(e);if(n==ke||n==wt)return!e.size;if(xr(e))return!Es(e).length;for(var s in e)if(be.call(e,s))return!1;return!0}function Cg(e,n){return yr(e,n)}function Pg(e,n,s){s=typeof s=="function"?s:r;var h=s?s(e,n):r;return h===r?yr(e,n,r,s):!!h}function Qs(e){if(!ze(e))return!1;var n=ut(e);return n==je||n==ft||typeof e.message=="string"&&typeof e.name=="string"&&!Cr(e)}function Mg(e){return typeof e=="number"&&Bo(e)}function en(e){if(!De(e))return!1;var n=ut(e);return n==yt||n==ot||n==Ie||n==wn}function il(e){return typeof e=="number"&&e==le(e)}function _i(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=we}function De(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}function ze(e){return e!=null&&typeof e=="object"}var sl=_o?bt(_o):Lp;function Eg(e,n){return e===n||Ms(e,n,Ws(n))}function Sg(e,n,s){return s=typeof s=="function"?s:r,Ms(e,n,Ws(n),s)}function Ag(e){return al(e)&&e!=+e}function Lg(e){if(cd(e))throw new oe(l);return Zo(e)}function Tg(e){return e===null}function Og(e){return e==null}function al(e){return typeof e=="number"||ze(e)&&ut(e)==et}function Cr(e){if(!ze(e)||ut(e)!=Be)return!1;var n=Yr(e);if(n===null)return!0;var s=be.call(n,"constructor")&&n.constructor;return typeof s=="function"&&s instanceof s&&Wr.call(s)==Sc}var js=wo?bt(wo):Tp;function Rg(e){return il(e)&&e>=-we&&e<=we}var ol=xo?bt(xo):Op;function wi(e){return typeof e=="string"||!ue(e)&&ze(e)&&ut(e)==bn}function Pt(e){return typeof e=="symbol"||ze(e)&&ut(e)==Kn}var Jn=bo?bt(bo):Rp;function kg(e){return e===r}function Dg(e){return ze(e)&&at(e)==on}function Ig(e){return ze(e)&&ut(e)==or}var Kg=hi(Ss),zg=hi(function(e,n){return e<=n});function ul(e){if(!e)return[];if(pt(e))return wi(e)?zt(e):ct(e);if(hr&&e[hr])return gc(e[hr]());var n=at(e),s=n==ke?ds:n==wt?Nr:Zn;return s(e)}function tn(e){if(!e)return e===0?e:0;if(e=It(e),e===ye||e===-ye){var n=e<0?-1:1;return n*Qe}return e===e?e:0}function le(e){var n=tn(e),s=n%1;return n===n?s?n-s:n:0}function ll(e){return e?Sn(le(e),0,ie):0}function It(e){if(typeof e=="number")return e;if(Pt(e))return J;if(De(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=De(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Ao(e);var s=yf.test(e);return s||wf.test(e)?Qf(e.slice(2),s?2:8):vf.test(e)?J:+e}function hl(e){return qt(e,dt(e))}function Bg(e){return e?Sn(le(e),-we,we):e===0?e:0}function xe(e){return e==null?"":Ct(e)}var Ng=Xn(function(e,n){if(xr(n)||pt(n)){qt(n,$e(n),e);return}for(var s in n)be.call(n,s)&&gr(e,s,n[s])}),fl=Xn(function(e,n){qt(n,dt(n),e)}),xi=Xn(function(e,n,s,h){qt(n,dt(n),e,h)}),Fg=Xn(function(e,n,s,h){qt(n,$e(n),e,h)}),Hg=Qt(ws);function Wg(e,n){var s=Yn(e);return n==null?s:Uo(s,n)}var Ug=fe(function(e,n){e=Pe(e);var s=-1,h=n.length,c=h>2?n[2]:r;for(c&<(n[0],n[1],c)&&(h=1);++s1),v}),qt(e,Fs(e),s),h&&(s=Rt(s,M|T|I,ed));for(var c=n.length;c--;)Rs(s,n[c]);return s});function o1(e,n){return pl(e,yi(ee(n)))}var u1=Qt(function(e,n){return e==null?{}:Ip(e,n)});function pl(e,n){if(e==null)return{};var s=Le(Fs(e),function(h){return[h]});return n=ee(n),iu(e,s,function(h,c){return n(h,c[0])})}function l1(e,n,s){n=dn(n,e);var h=-1,c=n.length;for(c||(c=1,e=r);++hn){var h=e;e=n,n=h}if(s||e%1||n%1){var c=No();return st(e+c*(n-e+Zf("1e-"+((c+"").length-1))),n)}return Ls(e,n)}var w1=$n(function(e,n,s){return n=n.toLowerCase(),e+(s?ml(n):n)});function ml(e){return na(xe(e).toLowerCase())}function vl(e){return e=xe(e),e&&e.replace(bf,hc).replace(Hf,"")}function x1(e,n,s){e=xe(e),n=Ct(n);var h=e.length;s=s===r?h:Sn(le(s),0,h);var c=s;return s-=n.length,s>=0&&e.slice(s,c)==n}function b1(e){return e=xe(e),e&&tf.test(e)?e.replace(Xa,fc):e}function C1(e){return e=xe(e),e&&uf.test(e)?e.replace(Zi,"\\$&"):e}var P1=$n(function(e,n,s){return e+(s?"-":"")+n.toLowerCase()}),M1=$n(function(e,n,s){return e+(s?" ":"")+n.toLowerCase()}),E1=wu("toLowerCase");function S1(e,n,s){e=xe(e),n=le(n);var h=n?Hn(e):0;if(!n||h>=n)return e;var c=(n-h)/2;return li(Jr(c),s)+e+li(Vr(c),s)}function A1(e,n,s){e=xe(e),n=le(n);var h=n?Hn(e):0;return n&&h>>0,s?(e=xe(e),e&&(typeof n=="string"||n!=null&&!js(n))&&(n=Ct(n),!n&&Fn(e))?gn(zt(e),0,s):e.split(n,s)):[]}var I1=$n(function(e,n,s){return e+(s?" ":"")+na(n)});function K1(e,n,s){return e=xe(e),s=s==null?0:Sn(le(s),0,e.length),n=Ct(n),e.slice(s,s+n.length)==n}function z1(e,n,s){var h=g.templateSettings;s&<(e,n,s)&&(n=r),e=xe(e),n=xi({},n,h,Su);var c=xi({},n.imports,h.imports,Su),v=$e(c),C=ps(c,v),P,O,B=0,N=n.interpolate||Dr,H="__p += '",X=gs((n.escape||Dr).source+"|"+N.source+"|"+(N===$a?mf:Dr).source+"|"+(n.evaluate||Dr).source+"|$","g"),j="//# sourceURL="+(be.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yf+"]")+` `;e.replace(X,function(ne,de,me,Mt,ht,Et){return me||(me=Mt),H+=e.slice(B,Et).replace(Cf,cc),de&&(P=!0,H+=`' + __e(`+de+`) + '`),ht&&(O=!0,H+=`'; `+ht+`; __p += '`),me&&(H+=`' + ((__t = (`+me+`)) == null ? '' : __t) + '`),B=Et+ne.length,ne}),H+=`'; `;var te=be.call(n,"variable")&&n.variable;if(!te)H=`with (obj) { `+H+` } `;else if(df.test(te))throw new oe(d);H=(O?H.replace(Zh,""):H).replace(Qh,"$1").replace(jh,"$1;"),H="function("+(te||"obj")+`) { `+(te?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(P?", __e = _.escape":"")+(O?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+H+`return __p }`;var he=_l(function(){return _e(v,j+"return "+H).apply(r,C)});if(he.source=H,Qs(he))throw he;return he}function B1(e){return xe(e).toLowerCase()}function N1(e){return xe(e).toUpperCase()}function F1(e,n,s){if(e=xe(e),e&&(s||n===r))return Ao(e);if(!e||!(n=Ct(n)))return e;var h=zt(e),c=zt(n),v=Lo(h,c),C=To(h,c)+1;return gn(h,v,C).join("")}function H1(e,n,s){if(e=xe(e),e&&(s||n===r))return e.slice(0,Ro(e)+1);if(!e||!(n=Ct(n)))return e;var h=zt(e),c=To(h,zt(n))+1;return gn(h,0,c).join("")}function W1(e,n,s){if(e=xe(e),e&&(s||n===r))return e.replace(Qi,"");if(!e||!(n=Ct(n)))return e;var h=zt(e),c=Lo(h,zt(n));return gn(h,c).join("")}function U1(e,n){var s=G,h=$;if(De(n)){var c="separator"in n?n.separator:c;s="length"in n?le(n.length):s,h="omission"in n?Ct(n.omission):h}e=xe(e);var v=e.length;if(Fn(e)){var C=zt(e);v=C.length}if(s>=v)return e;var P=s-Hn(h);if(P<1)return h;var O=C?gn(C,0,P).join(""):e.slice(0,P);if(c===r)return O+h;if(C&&(P+=O.length-P),js(c)){if(e.slice(P).search(c)){var B,N=O;for(c.global||(c=gs(c.source,xe(Va.exec(c))+"g")),c.lastIndex=0;B=c.exec(N);)var H=B.index;O=O.slice(0,H===r?P:H)}}else if(e.indexOf(Ct(c),P)!=P){var X=O.lastIndexOf(c);X>-1&&(O=O.slice(0,X))}return O+h}function G1(e){return e=xe(e),e&&ef.test(e)?e.replace(Ya,_c):e}var q1=$n(function(e,n,s){return e+(s?" ":"")+n.toUpperCase()}),na=wu("toUpperCase");function yl(e,n,s){return e=xe(e),n=s?r:n,n===r?dc(e)?bc(e):sc(e):e.match(n)||[]}var _l=fe(function(e,n){try{return xt(e,r,n)}catch(s){return Qs(s)?s:new oe(s)}}),Y1=Qt(function(e,n){return Lt(n,function(s){s=Yt(s),Jt(e,s,Js(e[s],e))}),e});function X1(e){var n=e==null?0:e.length,s=ee();return e=n?Le(e,function(h){if(typeof h[1]!="function")throw new Tt(f);return[s(h[0]),h[1]]}):[],fe(function(h){for(var c=-1;++cwe)return[];var s=ie,h=st(e,ie);n=ee(n),e-=ie;for(var c=cs(h,n);++s0||n<0)?new ge(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),n!==r&&(n=le(n),s=n<0?s.dropRight(-n):s.take(n-e)),s)},ge.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ge.prototype.toArray=function(){return this.take(ie)},Gt(ge.prototype,function(e,n){var s=/^(?:filter|find|map|reject)|While$/.test(n),h=/^(?:head|last)$/.test(n),c=g[h?"take"+(n=="last"?"Right":""):n],v=h||/^find/.test(n);c&&(g.prototype[n]=function(){var C=this.__wrapped__,P=h?[1]:arguments,O=C instanceof ge,B=P[0],N=O||ue(C),H=function(de){var me=c.apply(g,ln([de],P));return h&&X?me[0]:me};N&&s&&typeof B=="function"&&B.length!=1&&(O=N=!1);var X=this.__chain__,j=!!this.__actions__.length,te=v&&!X,he=O&&!j;if(!v&&N){C=he?C:new ge(this);var ne=e.apply(C,P);return ne.__actions__.push({func:di,args:[H],thisArg:r}),new Ot(ne,X)}return te&&he?e.apply(this,P):(ne=this.thru(H),te?h?ne.value()[0]:ne.value():ne)})}),Lt(["pop","push","shift","sort","splice","unshift"],function(e){var n=Fr[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",h=/^(?:pop|shift)$/.test(e);g.prototype[e]=function(){var c=arguments;if(h&&!this.__chain__){var v=this.value();return n.apply(ue(v)?v:[],c)}return this[s](function(C){return n.apply(ue(C)?C:[],c)})}}),Gt(ge.prototype,function(e,n){var s=g[n];if(s){var h=s.name+"";be.call(qn,h)||(qn[h]=[]),qn[h].push({name:n,func:s})}}),qn[oi(r,b).name]=[{name:"wrapper",func:r}],ge.prototype.clone=Gc,ge.prototype.reverse=qc,ge.prototype.value=Yc,g.prototype.at=x0,g.prototype.chain=b0,g.prototype.commit=C0,g.prototype.next=P0,g.prototype.plant=E0,g.prototype.reverse=S0,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=A0,g.prototype.first=g.prototype.head,hr&&(g.prototype[hr]=M0),g},Wn=Cc();Cn?((Cn.exports=Wn)._=Wn,is._=Wn):tt._=Wn}).call(Ht)}(Or,Or.exports);var Xh=Or.exports;const $h=bi(Xh);class Vh extends it{constructor(r,a,o){super({type:"3点矩形",...r},a,o);Y(this,"maxPointNum",3);Y(this,"minPointNum",3);Y(this,"options",{units:"kilometers"})}calcuteShape(r,a){switch(r.length){case 0:return[];case 1:return[];case 2:return[];case 3:{let l=r.map(F=>F.position.getValue(a)).map(F=>{let q=qe(F);return Je(q)}),f=l[0],d=l[1],m=l[2],x=Oe(f,d,this.options),E=vt([Ce(f),Ce(d)],this.options),M=rh(m,E,{method:"planar",...this.options}),T=za(vt([f,d,m,f].map(F=>Ce(F)))),I=se(d,M,x+(T?90:-90),this.options),z=se(f,M,x+(T?90:-90),this.options);return[f,d,I,z].map(F=>Ge(Ce(F)))}}}initTempShape(){this.addTempLine(new Z.CallbackProperty((r,a)=>this.ctls.map(o=>{var l;return(l=o.position)==null?void 0:l.getValue(r)}),!1))}}class Jh{constructor(i,r){Y(this,"viewer");Y(this,"config",{propEditor:void 0,layerId:"biaohui",editAfterCreate:!1});Y(this,"layer");Y(this,"em");this.viewer=i,Object.assign(this.config,r),console.log("create GraphManager: ",i,this.config),this.layer=new L.CustomDataSource(this.config.layerId),this.em=new fa(i.scene,this.config.propEditor,this.layer,this.config.editAfterCreate),this.viewer.dataSources.add(this.layer)}start(){this.em.start()}finish(){this.em.finish()}destroyHandler(){this.em.destroyHandler()}create(i){let r=this.createObj(i);return this.em.create(r)}draw(i){let r=this.createObj(i);return this.em.draw(r)}findById(i){return this.layer.entities.getById(i)}findByType(i){return $h.find(this.layer.entities.values,r=>r.propx.type.value===i)}delete(i){let r;i?(i.delete(),r=i):r=this.em.deleteSelectGraph(),console.log("deleted graph: ",r)}clean(){this.layer.entities.removeAll()}deleteAll(){this.clean()}load(i){return i.map(r=>this.draw(r))}save(){return this.graphList.map(r=>r.getProperties())}createObj(i){switch(console.log("createObj from json: ",i),i.obj){case"RedFlag":return new ch(i,this.viewer,this.layer);case"Image":return new Fa(i,this.viewer,this.layer);case"Point":return new Wa(i,this.viewer,this.layer);case"Satellite":return new ph(i,this.viewer,this.layer);case"Station":return new dh(i,this.viewer,this.layer);case"PinText":return new vh(i,this.viewer,this.layer);case"PinIcon":return new mh(i,this.viewer,this.layer);case"PinImage":return new gh(i,this.viewer,this.layer);case"Polygon":return new it(i,this.viewer,this.layer);case"Arrow1":return new yh(i,this.viewer,this.layer);case"Circle":return new _h(i,this.viewer,this.layer);case"Ellipse":return new xh(i,this.viewer,this.layer);case"Rectangle":return new Na(i,this.viewer,this.layer);case"SquareArrow":return new Ih(i,this.viewer,this.layer);case"CircleArcArea":return new wh(i,this.viewer,this.layer);case"SectorArea":return new kh(i,this.viewer,this.layer);case"FlagTriangle":return new Ch(i,this.viewer,this.layer);case"FlagRectangle":return new bh(i,this.viewer,this.layer);case"MultiPartArrow":return new Ph(i,this.viewer,this.layer);case"SplineArea":return new Dh(i,this.viewer,this.layer);case"PincerAttack":return new Rh(i,this.viewer,this.layer);case"AreaMeasure":return new Uh(i,this.viewer,this.layer);case"ThreePointRectangle":return new Vh(i,this.viewer,this.layer);case"Polyline":return new _n(i,this.viewer,this.layer);case"Bezier1":return new Kh(i,this.viewer,this.layer);case"Bezier2":return new zh(i,this.viewer,this.layer);case"BezierN":return new Hi(i,this.viewer,this.layer);case"BezierSpline":return new Bh(i,this.viewer,this.layer);case"CircleArc":return new Nh(i,this.viewer,this.layer);case"PointLine":return new ar(i,this.viewer,this.layer);case"PointSpline":return new Fh(i,this.viewer,this.layer);case"DistanceMeasure":return new Wh(i,this.viewer,this.layer);case"AngleMeasure":return new Gh(i,this.viewer,this.layer);case"TriangleMeasure":return new qh(i,this.viewer,this.layer);case"BeeLine":return new Hh(i,this.viewer,this.layer);case"SightLine":return new Yh(i,this.viewer,this.layer);default:console.log("invalid type");return}}setGraphSelectHandler(i){this.em.setGraphSelectHandler(i)}setGraphFinishHandler(i){this.em.setGraphFinishHandler(i)}}Ve.Graph=Ut,Ve.GraphManager=Jh,Ve.Point=Wa,Ve.Polygon=it,Ve.Polyline=_n,Object.defineProperty(Ve,Symbol.toStringTag,{value:"Module"})});