@vesium/plot 1.0.1-beta.42 → 1.0.1-beta.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var le=Object.defineProperty,ce=(i,e,t)=>e in i?le(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,w=(i,e,t)=>ce(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("cesium"),S=require("@vueuse/core"),g=require("vue"),C=require("@vesium/shared"),de=Symbol("CREATE_VIEWER_INJECTION_KEY"),ue=new WeakMap;async function j(i,e={}){try{const{raw:t=!0}=e;let o;if(C.isFunction(i))o=await i();else{const n=g.toValue(i);o=C.isPromise(n)?await n:n}return t?g.toRaw(o):o}catch(t){throw console.error(t),t}}function H(i,e,t={}){const o=g.toRef(t.isActive??!0),n=g.watchEffect(r=>{const u=g.toValue(i),c=Array.isArray(u)?u:[u];if(c&&c.length&&o.value){const v=c.map(l=>{const f=g.toValue(l);return f?.addEventListener(e,f)});r(()=>v.forEach(l=>l?.()))}});return S.tryOnScopeDispose(n.stop),n.stop}function I(){const i=g.getCurrentScope(),e=i?ue.get(i):void 0;if(e)return e;{const t=g.inject(de);if(!t)throw new Error("The `Viewer` instance injected by `createViewer` was not found in the current component or its ancestor components. Have you called `createViewer`?");return t}}function $(i,e,t){const o=g.shallowReactive(new Set),n=(v,...l)=>{const f=i(v,...l);return C.isPromise(f)?new Promise((h,s)=>{f.then(d=>{o.add(d),h(d)}).catch(d=>s(d))}):(o.add(f),f)},r=(v,...l)=>(o.delete(v),e(v,...l)),u=(v,...l)=>{o.forEach(f=>{v(f)&&r(f,...l)})},c=(...v)=>{o.forEach(l=>{r(l,...v)})};return S.tryOnScopeDispose(()=>c(...t)),{scope:g.shallowReadonly(o),add:n,remove:r,removeWhere:u,removeScope:c}}function Q(i,e={}){const{destroyOnRemove:t,collection:o,isActive:n=!0,evaluating:r}=e,u=S.computedAsync(()=>j(i),void 0,{evaluating:r}),c=I();return g.watchEffect(v=>{var l;if(g.toValue(n)){const h=Array.isArray(u.value)?[...u.value]:[u.value],s=o??((l=c.value)==null?void 0:l.dataSources);h.forEach(d=>d&&s?.add(d)),v(()=>{const d=g.toValue(t);!s?.isDestroyed()&&h.forEach(m=>m&&s?.remove(m,d))})}}),u}function X(i={}){const{collection:e}=i,t=I(),o=g.computed(()=>{var h;return g.toValue(e)??((h=t.value)==null?void 0:h.entities)}),n=h=>{if(!o.value)throw new Error("collection is not defined");return o.value.contains(h)||o.value.add(h),h},r=h=>{var s;return!!((s=o.value)!=null&&s.remove(h))},{scope:u,add:c,remove:v,removeWhere:l,removeScope:f}=$(n,r,[]);return{scope:u,add:c,remove:v,removeWhere:l,removeScope:f}}const Z=new WeakMap;function ee(i,e={}){const{width:t=3,height:o=3,throttled:n=8}=e,r=g.toRef(e.isActive??!0),u=I(),c=S.refThrottled(g.computed(()=>{var l;return(l=g.toValue(i))==null?void 0:l.clone()}),n,!1,!0),v=g.shallowRef();return g.watchEffect(()=>{var l;if(u.value&&c.value&&r.value){const f=Z.get(u.value);f&&f[0].equals(c.value)?v.value=f[1]:(Z.set(u.value,[c.value.clone(),v.value]),v.value=(l=u.value)==null?void 0:l.scene.pick(c.value,g.toValue(t),g.toValue(o)))}}),v}function A(i,e,t={}){const{modifier:o}=t,n=I(),r=g.toRef(t.isActive??!0),u=g.computed(()=>{var f,h;if((h=(f=n.value)==null?void 0:f.cesiumWidget)!=null&&h.canvas)return new a.ScreenSpaceEventHandler(n.value.cesiumWidget.canvas)}),c=g.watch(u,(f,h)=>{var s;(s=n.value)!=null&&s.cesiumWidget&&h?.destroy()}),v=g.watchEffect(f=>{const h=g.toValue(i),s=g.toValue(o),d=g.toValue(u);!d||!r.value||!e||C.isDef(h)&&(d.setInputAction(e,h,s),f(()=>d.removeInputAction(h,s)))}),l=()=>{c(),v()};return S.tryOnScopeDispose(l),l}function ve(i){const e=g.shallowRef(),t=ee(e),o=g.shallowRef(),n=g.ref(!1),r=I(),u=g.ref(!1);g.watch(u,d=>{r.value&&(r.value.scene.screenSpaceCameraController.enableRotate=!d)});const c=()=>{u.value=!0},v=(d,m,p)=>{i({event:{startPosition:m.clone(),endPosition:p.clone()},pick:d,dragging:n.value,lockCamera:c}),g.nextTick(()=>{!n.value&&u.value&&(u.value=!1)})},l=A(a.ScreenSpaceEventType.LEFT_DOWN,d=>{n.value=!0,e.value=d.position.clone()}),f=A(a.ScreenSpaceEventType.MOUSE_MOVE,C.throttle(({startPosition:d,endPosition:m})=>{var p;o.value={startPosition:((p=o.value)==null?void 0:p.endPosition.clone())||d.clone(),endPosition:m.clone()}},8,!1,!0));g.watch([t,o],([d,m])=>{if(d&&m){const{startPosition:p,endPosition:_}=m;n.value&&v(d,p,_)}});const h=A(a.ScreenSpaceEventType.LEFT_UP,d=>{n.value=!1,t.value&&o.value&&v(t.value,o.value.endPosition,d.position),e.value=void 0,o.value=void 0}),s=()=>{l(),f(),h()};return S.tryOnScopeDispose(s),s}function he(i){const e=g.shallowRef(),t=ee(()=>{var n;return(n=e.value)==null?void 0:n.endPosition}),o=(n,r,u,c)=>{i({event:{startPosition:r.clone(),endPosition:u.clone()},pick:n,hovering:c})};A(a.ScreenSpaceEventType.MOUSE_MOVE,({startPosition:n,endPosition:r})=>{var u,c;(!n.equals((u=e.value)==null?void 0:u.startPosition)||!r.equals((c=e.value)==null?void 0:c.endPosition))&&(e.value={startPosition:n.clone(),endPosition:r.clone()})}),g.watch([t,e],([n,r])=>{if(n&&r){const{startPosition:u,endPosition:c}=r;o(n,u,c,!0)}}),g.watch(t,(n,r)=>{if(r&&e.value){const{startPosition:u,endPosition:c}=e.value;o(r,u,c,!1)}})}const pe={LEFT_DOWN:a.ScreenSpaceEventType.LEFT_DOWN,LEFT_UP:a.ScreenSpaceEventType.LEFT_UP,LEFT_CLICK:a.ScreenSpaceEventType.LEFT_CLICK,LEFT_DOUBLE_CLICK:a.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,RIGHT_DOWN:a.ScreenSpaceEventType.RIGHT_DOWN,RIGHT_UP:a.ScreenSpaceEventType.RIGHT_UP,RIGHT_CLICK:a.ScreenSpaceEventType.RIGHT_CLICK,MIDDLE_DOWN:a.ScreenSpaceEventType.MIDDLE_DOWN,MIDDLE_UP:a.ScreenSpaceEventType.MIDDLE_UP,MIDDLE_CLICK:a.ScreenSpaceEventType.MIDDLE_CLICK};function fe(i,e){const t=pe[i],o=I();A(t,n=>{var r;const u=n.position,c=(r=o.value)==null?void 0:r.scene.pick(u);c&&u&&e({event:{position:u},pick:c})})}const N=Symbol("GLOBAL_GRAPHIC_SYMBOL"),me=["LEFT_DOWN","LEFT_UP","LEFT_CLICK","LEFT_DOUBLE_CLICK","RIGHT_DOWN","RIGHT_UP","RIGHT_CLICK","MIDDLE_DOWN","MIDDLE_UP","MIDDLE_CLICK"];function ge(){const i=new WeakMap,e=new WeakMap,t=new WeakMap,o=(v,l,f)=>{var h,s,d,m,p,_,E,y,P,L,x,O,Y,M,G,b,J,W,R;const D=v==="global"?N:v;(s=(h=i?.get(D))==null?void 0:h.get(l))==null||s.delete(f),(m=(d=e?.get(D))==null?void 0:d.get(l))==null||m.delete(f),((_=(p=i?.get(D))==null?void 0:p.get(l))==null?void 0:_.size)===0&&i.get(D).delete(l),((E=i.get(D))==null?void 0:E.size)===0&&i.delete(D),(P=(y=e?.get(D))==null?void 0:y.get(l))==null||P.delete(f),((x=(L=e?.get(D))==null?void 0:L.get(l))==null?void 0:x.size)===0&&((O=e?.get(D))==null||O.delete(l)),((Y=e?.get(D))==null?void 0:Y.size)===0&&e?.delete(D),(G=(M=t?.get(D))==null?void 0:M.get(l))==null||G.delete(f),((J=(b=t?.get(D))==null?void 0:b.get(l))==null?void 0:J.size)===0&&((W=t?.get(D))==null||W.delete(l)),((R=t?.get(D))==null?void 0:R.size)===0&&t?.delete(D)},n=(v,l,f,h={})=>{const s=v==="global"?N:v;i.get(s)??i.set(s,new Map);const d=i.get(s);d.get(l)??d.set(l,new Set),d.get(l).add(f);let{cursor:p="pointer",dragCursor:_}=h;if(C.isDef(p)){const E=C.isFunction(p)?p:()=>p;e.get(s)??e.set(s,new Map),e.get(s).get(l)??e.get(s).set(l,new Map),e.get(s).get(l).set(f,E)}if(l==="DRAG"&&(_??(_=E=>E?.dragging?"crosshair":void 0)),C.isDef(_)){const E=C.isFunction(_)?_:()=>_;t.get(s)??t.set(s,new Map),t.get(s).get(l)??t.get(s).set(l,new Map),t.get(s).get(l).set(f,E)}return()=>o(v,l,f)},r=(v,l)=>{var f,h,s,d,m,p;const _=v==="global"?N:v;if(l==="all"){i.delete(_),e.delete(_),t.delete(_);return}(f=i.get(_))==null||f.delete(l),((h=i.get(_))==null?void 0:h.size)===0&&i.delete(_),(s=e?.get(_))==null||s.delete(l),(d=t?.get(_))==null||d.delete(l),((m=e?.get(_))==null?void 0:m.size)===0&&e?.delete(_),((p=t?.get(_))==null?void 0:p.size)===0&&t?.delete(_)};for(const v of me)fe(v,l=>{C.resolvePick(l.pick).concat(N).forEach(h=>{var s,d;(d=(s=i.get(h))==null?void 0:s.get(v))==null||d.forEach(m=>{var p;return(p=C.tryRun(m))==null?void 0:p(l)})})});const u=g.ref(!1),c=I();return he(v=>{C.resolvePick(v.pick).concat(N).forEach(f=>{var h,s,d;(s=(h=i.get(f))==null?void 0:h.get("HOVER"))==null||s.forEach(m=>{var p;return(p=C.tryRun(m))==null?void 0:p(v)}),u.value||(d=e.get(f))==null||d.forEach(m=>{m.forEach(p=>{var _,E;const y=v.hovering?C.tryRun(p)(v):"";(E=(_=c.value)==null?void 0:_.canvas.style)==null||E.setProperty("cursor",y)})})})}),ve(v=>{const l=C.resolvePick(v.pick).concat(N);u.value=v.dragging,l.forEach(f=>{var h,s,d;(s=(h=i.get(f))==null?void 0:h.get("DRAG"))==null||s.forEach(m=>C.tryRun(m)(v)),(d=t.get(f))==null||d.forEach(m=>{m.forEach(p=>{var _,E;const y=v.dragging?C.tryRun(p)(v):"";(E=(_=c.value)==null?void 0:_.canvas.style)==null||E.setProperty("cursor",y)})})})}),{addGraphicEvent:n,removeGraphicEvent:o,clearGraphicEvent:r}}function te(i,e={}){const{collection:t,isActive:o=!0,evaluating:n}=e,r=S.computedAsync(()=>j(i),void 0,{evaluating:n}),u=I();return g.watchEffect(c=>{var v,l;if(g.toValue(o)){const h=Array.isArray(r.value)?[...r.value]:[r.value],s=t==="ground"?(v=u.value)==null?void 0:v.scene.groundPrimitives:t??((l=u.value)==null?void 0:l.scene.primitives);h.forEach(d=>d&&s?.add(d)),c(()=>{!s?.isDestroyed()&&h.forEach(d=>d&&s?.remove(d))})}}),r}function ie(i={}){const{collection:e}=i,t=I(),o=g.computed(()=>{var h;return g.toValue(e)??((h=t.value)==null?void 0:h.scene.primitives)}),n=h=>{if(!o.value)throw new Error("collection is not defined");return o.value.add(h)},r=h=>{var s;return!!((s=o.value)!=null&&s.remove(h))},{scope:u,add:c,remove:v,removeWhere:l,removeScope:f}=$(n,r,[]);return{scope:u,add:c,remove:v,removeWhere:l,removeScope:f}}const ne=class F{constructor(e){w(this,"type"),w(this,"complete"),w(this,"forceComplete"),w(this,"definingCursor"),w(this,"skeletons"),w(this,"initEntites"),w(this,"initPrimitives"),w(this,"initGroundPrimitives"),w(this,"render");var t;this.type=e.type,this.complete=e.complete,this.forceComplete=e.forceComplete,this.definingCursor=e.definingCursor??"crosshair",this.skeletons=((t=e.skeletons)==null?void 0:t.map(o=>o()))??[],this.initEntites=e.initEntites,this.initPrimitives=e.initPrimitives,this.initGroundPrimitives=e.initGroundPrimitives,this.render=e.render}static getCacheTypes(){return[...this._record.keys()]}static getCache(e){return F._record.get(e)}static setCache(e){C.assertError(!e.type,"`scheme.type` is required"),F._record.set(e.type,e)}static resolve(e){if(typeof e=="string"){const t=F.getCache(e);return S.assert(!!t,`scheme ${e} not found`),t}else return e instanceof F?e:new F(e)}};w(ne,"_record",new Map);let k=ne;var oe=(i=>(i[i.NEAR=0]="NEAR",i[i.CYCLE=1]="CYCLE",i[i.STRICT=2]="STRICT",i))(oe||{});const _e=(i,e,t,o)=>{var n,r,u;return o===0?{time:i,positions:(n=e.positions)==null?void 0:n.map(c=>c.clone()),derivative:e.derivative}:o===1?{time:i,positions:(r=t.positions)==null?void 0:r.map(c=>c.clone()),derivative:e.derivative}:{time:i,positions:(u=t.positions)==null?void 0:u.map((c,v)=>{var l;const f=(l=e.positions)==null?void 0:l[v];return f?a.Cartesian3.lerp(f,c,o,new a.Cartesian3):c}),derivative:e.derivative}},se=class ae{constructor(e){w(this,"strategy"),w(this,"interpolationAlgorithm"),w(this,"_times",[]),w(this,"_sampleds",[]),w(this,"_derivatives",[]),w(this,"_definitionChanged",new a.Event);var t;this.interpolationAlgorithm=e?.interpolationAlgorithm,this.strategy=e?.strategy??0,(t=e?.packables)==null||t.forEach(o=>this.setSample(o)),this._times.length||this.setSample({time:a.JulianDate.now(),positions:[],derivative:void 0})}get isConstant(){return this._times.length===0}get definitionChanged(){return this._definitionChanged}getTimes(){return this._times.map(e=>e.clone())}getIndexScope(e){if(!this._times.length)return;const t=this._times[0],o=this._times[this._times.length-1];if(a.JulianDate.lessThan(e,t)||a.JulianDate.greaterThan(e,o))switch(this.strategy){case 2:return;case 0:{e=a.JulianDate.lessThan(e,this._times[0])?this._times[0].clone():this._times[this._times.length-1].clone();break}case 1:{const l=a.JulianDate.toDate(this._times[0]).getTime(),h=a.JulianDate.toDate(this._times[this._times.length-1]).getTime()-l,d=(a.JulianDate.toDate(e).getTime()-l)%h,m=new Date(l+d);e=a.JulianDate.fromDate(m);break}}const n=this._times.findIndex(l=>a.JulianDate.lessThanOrEquals(e,l)),r=Math.min(n,this._times.length-1),u=a.JulianDate.toDate(this._times[n]).getTime(),c=a.JulianDate.toDate(this._times[r]).getTime(),v=a.JulianDate.toDate(e).getTime();return{prevIndex:n,nextIndex:r,proportion:(v-u)/(c-u)||0}}getValue(e,t){var o,n;if(t??(t={time:e}),Object.assign(t,{time:e.clone(),positions:void 0,derivative:void 0}),!e)return t.time=(o=this._times[0])==null?void 0:o.clone(),t.positions=(n=this._sampleds[0])==null?void 0:n.map(s=>s.clone(s)),t.derivative=this._derivatives[0],t;const r=this.getIndexScope(e);if(!r)return t;t.time=e;const{prevIndex:u,nextIndex:c,proportion:v}=r,l={time:this._times[u],positions:this._sampleds[u],derivative:this._derivatives[u]},f={time:this._times[c],positions:this._sampleds[c],derivative:this._derivatives[c]},h=(this.interpolationAlgorithm||ae.defaultInterpolationAlgorithm)(e,l,f,v);return Object.assign(t,h),t}setSample(e){var t;const o=e.time.clone(),n=((t=e.positions)==null?void 0:t.map(c=>c.clone()))??[],r=e.derivative,u=this._times.findIndex(c=>a.JulianDate.equals(o,c));u!==-1?(this._times[u]=o,this._sampleds[u]=n,this._derivatives[u]=e.derivative):this._times.length===0?(this._times[0]=o,this._sampleds[0]=n,this._derivatives[0]=e.derivative):a.JulianDate.lessThan(o,this._times[0])?(this._times.splice(0,0,o),this._sampleds.splice(0,0,n),this._derivatives.splice(0,0,r)):a.JulianDate.greaterThan(o,this._times[this._times.length-1])&&(this._times.push(o),this._sampleds.push(n),this._derivatives.push(r)),this.definitionChanged.raiseEvent(this)}setSamples(e){e.forEach(t=>this.setSample(t))}removeSample(e){const t=this._times.findIndex(o=>o.equals(e));return t!==-1&&(this._sampleds.splice(t,1),this._derivatives.splice(t,1),this._times.splice(t,1).length)?(this._definitionChanged.raiseEvent(this),!0):!1}removeSamples(e){for(let t=0;t<this._times.length;t++){const o=this._times[t];a.TimeInterval.contains(e,o)&&this.removeSample(o)}}equals(e){return e===this}};w(se,"defaultInterpolationAlgorithm",_e);let z=se;class V{constructor(e){w(this,"_id"),w(this,"_scheme"),w(this,"_definitionChanged"),w(this,"_defining"),w(this,"_disabled"),w(this,"_sampled"),w(this,"_entities"),w(this,"_primitives"),w(this,"_groundPrimitives"),w(this,"_skeletons");var t,o,n,r,u,c;const{id:v,disabled:l=!1,sampled:f}=e;this._id=v||a.createGuid(),this._scheme=k.resolve(e.scheme),this._definitionChanged=new a.Event,this._defining=!0,this._disabled=l,this._sampled=f instanceof z?f:new z(f),this._sampled.definitionChanged.addEventListener(h=>this._definitionChanged.raiseEvent(this,"sampled",h,h),this),this._entities=[...((o=(t=this._scheme).initEntites)==null?void 0:o.call(t))??[]],this._primitives=[...((r=(n=this._scheme).initPrimitives)==null?void 0:r.call(n))??[]],this._groundPrimitives=[...((c=(u=this._scheme).initGroundPrimitives)==null?void 0:c.call(u))??[]],this._skeletons=[]}get id(){return this._id}get scheme(){return this._scheme}get definitionChanged(){return this._definitionChanged}get defining(){return this._defining}static setDefining(e,t){e._defining!==t&&(e._definitionChanged.raiseEvent(e,"defining",t,e._defining),e._defining=t)}get disabled(){return this._disabled}set disabled(e){this.disabled=e}get sampled(){return this._sampled}get entities(){return this._entities}set entities(e){this._definitionChanged.raiseEvent(this,"entities",e,this._entities),this._entities=e}get primitives(){return this._primitives}set primitives(e){this._definitionChanged.raiseEvent(this,"primitives",e,this._primitives),this._primitives=e}get groundPrimitives(){return this._groundPrimitives}set groundPrimitives(e){this._definitionChanged.raiseEvent(this,"groundPrimitives",e,this._groundPrimitives),this._groundPrimitives=e}get skeletons(){return this._skeletons}set skeletons(e){this._definitionChanged.raiseEvent(this,"skeletons",e,this._skeletons),this._skeletons=e}}class Ee{constructor(e={}){w(this,"_id"),w(this,"_isDestroyed");const{id:t}=e;this._id=t||a.createGuid(),this._isDestroyed=!1}get id(){return this._id}get collectionChanged(){return this._collectionChanged}get values(){return Array.from(this._values)}add(e){if(this._isDestroyed)throw new Error("PlotFeatureCollection is isDestroyed");return this._values.has(e)?!1:!!this._values.add(e)}remove(e){return this._values.delete(e)}get entities(){return this._dataSource.entities}get primitives(){return this._primitives}get groundPrimitives(){return this._groundPrimitives}get skeletons(){return this._skeletonDataSource.entities}isDestroyed(){return this._isDestroyed}destroy(){this._isDestroyed||(this._viewer.dataSources.remove(this._dataSource),this._viewer.dataSources.remove(this._skeletonDataSource),this._viewer.scene.primitives.remove(this._primitives),this._viewer.scene.groundPrimitives.remove(this._groundPrimitives),this._viewer.dataSources.remove(this._skeletonDataSource),this._isDestroyed=!0)}}var T=(i=>(i[i.IDLE=0]="IDLE",i[i.HOVER=1]="HOVER",i[i.ACTIVE=2]="ACTIVE",i))(T||{});class U extends a.Entity{constructor(e){super(e)}}function Ce(i,e,t){const o=I(),n=te(new a.PrimitiveCollection),r=te(new a.PrimitiveCollection,{collection:"ground"}),u=Q(new a.CustomDataSource),c=X({collection:()=>u.value.entities}),v=ie({collection:()=>n.value}),l=ie({collection:()=>r.value}),f=g.shallowRef();A(a.ScreenSpaceEventType.MOUSE_MOVE,s=>{f.value=C.canvasCoordToCartesian(s?.endPosition,o.value.scene)}),S.watchArray(i,(s,d,m,p=[])=>{p.forEach(_=>{c.removeWhere(E=>_.entities.includes(E)),v.removeWhere(E=>_.primitives.includes(E)),l.removeWhere(E=>_.groundPrimitives.includes(E))}),m.forEach(_=>{_.entities.forEach(E=>c.add(E)),_.primitives.forEach(E=>v.add(E)),_.groundPrimitives.forEach(E=>l.add(E))})},{immediate:!0,flush:"post"}),H(()=>i.value.map(s=>s.definitionChanged),(s,d,m,p)=>{if(d==="entities"){const{added:_,removed:E}=C.arrayDiff(m,p);_.forEach(y=>c.add(y)),E.forEach(y=>c.remove(y))}else if(d==="primitives"){const{added:_,removed:E}=C.arrayDiff(m,p);_.forEach(y=>v.add(y)),E.forEach(y=>v.remove(y))}else if(d==="groundPrimitives"){const{added:_,removed:E}=C.arrayDiff(m,p);_.forEach(y=>l.add(y)),E.forEach(y=>l.remove(y))}});const h=async s=>{var d,m;const p=await((m=(d=s.scheme).render)==null?void 0:m.call(d,{packable:s.sampled.getValue(t()),mouse:s.defining?f.value:void 0,defining:s.defining,previous:{entities:s.entities,primitives:s.primitives,groundPrimitives:s.groundPrimitives}}));s.entities=p?.entities??[],s.primitives=p?.primitives??[],s.groundPrimitives=p?.groundPrimitives??[]};return g.watch(e,(s,d)=>{d&&h(d)}),H(()=>i.value.map(s=>s.definitionChanged),(s,d)=>{["disabled","defining","scheme","sampled","time"].includes(d)&&h(s)}),g.watch(f,()=>{i.value.forEach(s=>s.defining&&h(s))}),{primitives:g.computed(()=>Array.from(v.scope)),groundPrimitives:g.computed(()=>Array.from(v.scope)),entities:g.computed(()=>Array.from(c.scope))}}function we(i,e){const t=I(),o=g.ref(!1),n=g.computed(()=>{var c;return(c=i.value)==null?void 0:c.sampled.getValue(e())});A(a.ScreenSpaceEventType.LEFT_CLICK,async c=>{var v,l;if(await S.promiseTimeout(1),!i.value||!n.value||o.value)return;const{scheme:f,defining:h,sampled:s}=i.value;if(!h)return;const d=C.canvasCoordToCartesian(c.position,t.value.scene);if(!d)return;(v=n.value).positions??(v.positions=[]),n.value.positions.push(d),s.setSample(n.value),((l=f.complete)==null?void 0:l.call(f,n.value))&&V.setDefining(i.value,!1)}),A(a.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,async c=>{var v;if(!i.value||!n.value)return;o.value=!0,await S.promiseTimeout(2),o.value=!1;const{scheme:l,defining:f}=i.value;if(!f||!C.canvasCoordToCartesian(c.position,t.value.scene))return;((v=l.forceComplete)==null?void 0:v.call(l,n.value))&&V.setDefining(i.value,!1)}),A(a.ScreenSpaceEventType.RIGHT_CLICK,async()=>{var c;if(!i.value||!n.value)return;const{defining:v,sampled:l}=i.value;v&&((c=n.value).positions??(c.positions=[]),n.value.positions.length!==0&&(n.value.positions.splice(n.value.positions.length-1,1),l.setSample(n.value)))});const r=g.ref(),u=()=>{var c,v;if(!((c=i.value)!=null&&c.defining))r.value&&(r.value=void 0,t.value.container.parentElement.style.removeProperty("cursor"));else{const l=i.value.scheme.definingCursor;r.value=C.isFunction(l)?l(n.value):l,r.value&&((v=t.value)==null||v.container.parentElement.style.setProperty("cursor",r.value))}};H(()=>{var c;return(c=i.value)==null?void 0:c.definitionChanged},(c,v)=>{(v==="defining"||v==="sampled")&&u()}),g.watch(i,()=>u())}function ye(i,e,t){const o=I(),n=Q(new a.CustomDataSource),r=X({collection:()=>n.value.entities}),u=g.shallowRef(),c=g.shallowRef(),v=h=>{var s,d;return h?((s=c.value)==null?void 0:s.id)===h.id?T.ACTIVE:((d=u.value)==null?void 0:d.id)===h.id?T.HOVER:T.IDLE:T.IDLE},l=(h,s)=>{const d=h.skeletons,m=[];if(s||h.disabled)h.skeletons=[];else{const p=h.sampled.getValue(t()),_=h.defining,E=e.value===h;h.scheme.skeletons.forEach(P=>{var L;if(C.isFunction(P.disabled)?P.disabled({active:E,defining:_}):P.disabled)return;const O=((L=P.format)==null?void 0:L.call(P,p))??p?.positions??[];O.forEach((Y,M)=>{var G;let b=d.find(R=>R.index===M&&R.skeleton===P);const J=(G=P.render)==null?void 0:G.call(P,{defining:_,active:E,index:M,packable:p,positions:O,position:Y,action:v(b)}),W=new U(J??{});b?W.propertyNames.forEach(R=>{R!=="id"&&(b[R]=W[R])}):b=W,b.plot=h,b.skeleton=P,b.index=M,m.push(b)})})}h.skeletons=m},{addGraphicEvent:f}=ge();return g.watchEffect(h=>{const s=f("global","DRAG",({event:d,pick:m,dragging:p,lockCamera:_})=>{var E;if(m.id instanceof U&&r.scope.has(m.id)){const y=m.id,P=y.plot;if(P.defining)return;c.value=y;const L=y.skeleton,x=y.index,O=P.sampled.getValue(t());(E=L.onDrag)==null||E.call(L,{viewer:o.value,sampled:P.sampled,packable:O,active:e.value===P,index:x,event:d,dragging:p,lockCamera:_})}else c.value=void 0},{cursor:({pick:d})=>{var m;if(!((m=e.value)!=null&&m.defining)&&r.scope.has(d.id)){const p=d.id.skeleton;return C.isFunction(p?.cursor)?p.cursor(d):g.toValue(p?.cursor)}},dragCursor:({pick:d})=>{var m;if(!((m=e.value)!=null&&m.defining)&&r.scope.has(d.id)){const p=d.id.skeleton;return C.isFunction(p?.dragCursor)?p.dragCursor(d):g.toValue(p?.dragCursor)}}});h(s)}),S.onKeyStroke(h=>{var s;if(c.value){const d=c.value,m=d.plot,p=d.skeleton,_=d.index,E=m.sampled.getValue(t());(s=p.onKeyPressed)==null||s.call(p,{viewer:o.value,sampled:m.sampled,packable:E,index:_,keyEvent:h})}}),g.watchEffect(h=>{const s=f("global","HOVER",({hovering:d,pick:m})=>{if(d&&m.id instanceof U&&r.scope.has(m.id)){const p=m.id;u.value=p}else u.value=void 0});h(s)}),g.watchEffect(h=>{const s=f("global","LEFT_CLICK",({event:d,pick:m})=>{var p;if(m.id instanceof U&&r.scope.has(m.id)){const _=m.id;c.value=_;const E=_.plot,y=_.skeleton,P=_.index,L=E.sampled.getValue(t());(p=y.onLeftClick)==null||p.call(y,{viewer:o.value,sampled:E.sampled,packable:L,active:e.value===E,defining:E.defining,index:P,event:d})}else c.value=void 0});h(s)}),S.watchArray(i,(h,s,d,m=[])=>{d.forEach(p=>l(p)),m.forEach(p=>l(p,!0))}),H(()=>i.value.map(h=>h.definitionChanged),(h,s,d,m)=>{if(["disabled","defining","scheme","sampled","time"].includes(s))g.nextTick(()=>l(h));else if(s==="skeletons"){const{added:p,removed:_}=C.arrayDiff(d,m);p.forEach(E=>r.add(E)),_.forEach(E=>r.remove(E))}}),g.watch(e,(h,s)=>{h&&l(h),s&&l(s)}),{dataSource:n}}function Pe(i){const e=i?.time||g.shallowRef(),t=I(),o=()=>{var s,d,m;return((s=e.value)==null?void 0:s.clone())||((m=(d=t.value)==null?void 0:d.clock.currentTime)==null?void 0:m.clone())||a.JulianDate.now()},n=g.shallowReactive(new Set),r=g.computed(()=>Array.from(n)),u=g.shallowRef(),c=g.shallowRef();H([()=>{var s;return(s=u.value)==null?void 0:s.sampled.definitionChanged}],()=>{var s;c.value=(s=u.value)==null?void 0:s.sampled.getValue(o())}),we(u,o),Ce(r,u,o),ye(r,u,o),A(a.ScreenSpaceEventType.LEFT_CLICK,s=>{var d,m,p;if((d=u.value)!=null&&d.defining)return;const _=(m=t.value)==null?void 0:m.scene.pick(s.position.clone());if(!(((p=_?.id)==null?void 0:p.plot)instanceof V)){if(!_){u.value=void 0;return}u.value=r.value.find(E=>C.pickHitGraphic(_,[...E.entities,...E.primitives,...E.groundPrimitives]))}});let v,l;return g.watch(u,(s,d)=>{var m,p;if(d&&d.defining){const _=d.sampled.getValue(o());((p=(m=d.scheme).forceComplete)==null?void 0:p.call(m,_))?(V.setDefining(d,!1),v?.(d)):n.delete(d)}}),{plots:r,time:e,operate:async s=>new Promise((d,m)=>{v=d,l=m;const p=s instanceof V?s:new V(s);return n.has(p)||n.add(p),u.value=p,d(p)}),remove:s=>(s===u.value&&(u.value=void 0),n.has(s)?(n.delete(s),!0):!1),cancel:l}}function B(){return{disabled:({active:i})=>!i,cursor:"pointer",dragCursor:"crosshair",onDrag({viewer:i,sampled:e,packable:t,event:o,index:n,lockCamera:r}){r();const u=C.canvasCoordToCartesian(o.endPosition,i.scene);if(u){const c=[...t.positions??[]];c[n]=u,e.setSample({time:t.time,derivative:t.derivative,positions:c})}},onKeyPressed({viewer:i,keyEvent:e,sampled:t,packable:o,index:n}){var r;const u=(r=C.toCartographic(i.camera.position))==null?void 0:r.height;if(!u||!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(e.key))return;e.preventDefault();let c=0;switch(e.key){case"ArrowRight":c=Math.PI/2;break;case"ArrowDown":c=Math.PI;break;case"ArrowLeft":c=-Math.PI/2;break;case"ArrowUp":c=0;break}const v=(i.camera.heading+c)%(2*Math.PI),l=[...o.positions??[]],f=C.toCartographic(l[n]),s=u/1e5*Math.PI/180/1e3;f.latitude+=s*Math.cos(v),f.longitude+=s*Math.sin(v),l[n]=C.toCartesian3(f),t.setSample({time:o.time,derivative:o.derivative,positions:l})},render:({position:i,action:e})=>{const t={[T.IDLE]:a.Color.BLUE.withAlpha(.4),[T.HOVER]:a.Color.BLUE.withAlpha(.6),[T.ACTIVE]:a.Color.AQUA.withAlpha(1)};return{position:i,point:{pixelSize:8,color:t[e],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:a.Color.WHITE.withAlpha(.4)}}}}}function q(){let i=-1;return{disabled:({active:e,defining:t})=>!e||t,cursor:"pointer",dragCursor:"crosshair",format(e){const t=e.positions??[];return t.length<2?[]:t.map((o,n)=>{const r=n===t.length-1?t[0]:t[n+1];return a.Cartesian3.midpoint(o,r,new a.Cartesian3)})},onDrag({viewer:e,sampled:t,packable:o,event:n,index:r,lockCamera:u,dragging:c}){u();const v=C.canvasCoordToCartesian(n.endPosition,e.scene);if(!v)return;const l=[...o.positions??[]];i===-1?(i=r,l.splice(r+1,0,v)):l[i+1]=v,c||(i=-1),t.setSample({time:o.time,derivative:o.derivative,positions:l})},render:({position:e,action:t,active:o})=>{if(!o)return;const n={[T.IDLE]:a.Color.GREEN.withAlpha(.4),[T.HOVER]:a.Color.GREEN.withAlpha(.6),[T.ACTIVE]:a.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:n[t],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:a.Color.WHITE.withAlpha(.4)}}}}}function re(){let i=-1;return{disabled:({active:e,defining:t})=>!e||t,cursor:"pointer",dragCursor:"crosshair",format(e){const t=e.positions??[];if(t.length<2)return[];const o=[];for(let n=0;n<t.length-1;n++)o.push(a.Cartesian3.midpoint(t[n],t[n+1],new a.Cartesian3));return o},onDrag({viewer:e,sampled:t,packable:o,event:n,index:r,lockCamera:u,dragging:c}){u();const v=C.canvasCoordToCartesian(n.endPosition,e.scene);if(!v)return;const l=[...o.positions??[]];i===-1?(i=r,l.splice(r+1,0,v)):l[i+1]=v,c||(i=-1),t.setSample({time:o.time,derivative:o.derivative,positions:l})},render:({position:e,action:t})=>{const o={[T.IDLE]:a.Color.GREEN.withAlpha(.4),[T.HOVER]:a.Color.GREEN.withAlpha(.6),[T.ACTIVE]:a.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:o[t],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:a.Color.WHITE.withAlpha(.4)}}}}}const Te=`data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6"/></svg>')}`;function K(){return{disabled:({active:i,defining:e})=>!i||e,cursor:"pointer",dragCursor:"crosshair",format(i){const e=i.positions??[];if(e.length===0)return[];if(e.length===1)return[e[0]];{const t=a.Rectangle.center(a.Rectangle.fromCartesianArray(e));return[C.toCartesian3(t)]}},onDrag({viewer:i,sampled:e,packable:t,event:o,lockCamera:n,dragging:r}){r&&n();const u=C.canvasCoordToCartesian(o.startPosition,i.scene),c=C.canvasCoordToCartesian(o.endPosition,i.scene);if(!u||!c)return;const v=a.Cartesian3.subtract(c,u,new a.Cartesian3),l=[...t.positions??[]];e.setSample({time:t.time,derivative:t.derivative,positions:l.map(f=>a.Cartesian3.add(f,v,new a.Cartesian3))})},render:({position:i,action:e})=>{const t={[T.IDLE]:a.Color.WHITE,[T.HOVER]:a.Color.WHITE,[T.ACTIVE]:a.Color.AQUA.withAlpha(1)};return{position:i,billboard:{image:Te,width:20,height:20,color:t[e],pixelOffset:new a.Cartesian3(0,-20),horizontalOrigin:a.HorizontalOrigin.CENTER,verticalOrigin:a.VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}}}}}function De(i){if(i.length<3)throw new Error("positions must >= 3");if(i.length===3)return[[i[0].clone(),i[1].clone(),i[2].clone()]];const e=a.CoplanarPolygonGeometry.createGeometry(a.CoplanarPolygonGeometry.fromPositions({positions:i,vertexFormat:a.VertexFormat.POSITION_ONLY}));if(!e)throw new Error("positions\u65E0\u6CD5\u7EC4\u6210\u6709\u6548\u7684geometry,\u68C0\u67E5\u70B9\u4F4D\u662F\u5426\u9519\u8BEF");const t=e.attributes.position.values,o=e.indices,n=[];for(let r=0;r<o.length;r+=3){const u=a.Cartesian3.unpack(t,o[r]*3,new a.Cartesian3),c=a.Cartesian3.unpack(t,o[r+1]*3,new a.Cartesian3),v=a.Cartesian3.unpack(t,o[r+2]*3,new a.Cartesian3);n.push([u,c,v])}return n}function Se(i,e,t){const o=a.Cartesian3.subtract(i,e,new a.Cartesian3),n=a.Cartesian3.subtract(t,e,new a.Cartesian3),r=a.Cartesian3.cross(o,n,o);return a.Cartesian3.magnitude(r)*.5}function Ie(i){const t=a.ClassificationType.BOTH,o=Math.floor(10);return{scene:i?.scene,clampToGround:!1,classificationType:t,terrainProvider:i?.terrainProvider,density:o}}async function be(i,e){if(i.length<2)throw new Error("positions.length must >= 2");const{density:t}=Ie(e);if(t<=0)throw new Error("options.density must > 0");return De(i).reduce((n,r)=>n+=Se(...r),0)}const Le=new k({type:"measureArea",forceComplete:i=>i.positions.length>=3,skeletons:[B,q],initEntites:()=>[new a.Entity({label:{font:"14pt"},polyline:{material:a.Color.YELLOW.withAlpha(.5)},polygon:{material:a.Color.YELLOW.withAlpha(.5)}})],render(i){var e;const{mouse:t,packable:o}=i,n=((e=i.previous.entities)==null?void 0:e[0])??new a.Entity({label:{font:"14pt"},polyline:{material:a.Color.YELLOW.withAlpha(.5)},polygon:{material:a.Color.YELLOW.withAlpha(.5)}}),r=[...o.positions??[]];return t&&r.push(t),r.length===2?(n.position=void 0,n.label.text=void 0,n.polygon.hierarchy=void 0,n.polyline.positions=new a.CallbackProperty(()=>r,!1)):r.length>=3?(r.push(r[0]),n.position=new a.ConstantPositionProperty(C.toCartesian3(a.Rectangle.center(a.Rectangle.fromCartesianArray(r)))),n.label.text=new a.ConstantProperty(""),be(r).then(u=>{let c="";u/1e3/1e3>10?c=`${(u/1e3/1e3).toFixed(2)}km\xB2`:c=`${(+u).toFixed(2)}m\xB2`,n.label.text=new a.ConstantProperty(c)}),n.polyline.positions=void 0,n.polygon.hierarchy=new a.CallbackProperty(()=>r.length>=3?new a.PolygonHierarchy([...r]):void 0,!1)):(n.position=void 0,n.polygon.hierarchy=void 0,n.polyline.positions=void 0),{entities:[n]}}}),Ae=new k({type:"billboard",complete:i=>i.positions.length>=1,skeletons:[K],initEntites:()=>[new a.Entity({billboard:{image:"/favicon.svg",width:32,height:32}})],render(i){var e,t;const{mouse:o,packable:n}=i,r=((e=i.previous.entities)==null?void 0:e[0])??new a.Entity({billboard:{}}),u=((t=n.positions)==null?void 0:t[0])??o;return r.position=new a.CallbackPositionProperty(()=>u,!0),{entities:[r]}}}),Re=new k({type:"label",complete:i=>i.positions.length>=1,skeletons:[K],initEntites:()=>[new a.Entity({label:{text:"Label"}})],render(i){var e,t;const{mouse:o,packable:n}=i,r=((e=i.previous.entities)==null?void 0:e[0])??new a.Entity({label:{}}),u=((t=n.positions)==null?void 0:t[0])??o;return r.position=new a.CallbackPositionProperty(()=>u,!0),{entities:[r]}}}),Oe=new k({type:"polygon",forceComplete:i=>i.positions.length>=3,skeletons:[B,q,K],initEntites:()=>[new a.Entity({polyline:{material:a.Color.YELLOW.withAlpha(.5)},polygon:{material:a.Color.YELLOW.withAlpha(.5)}})],render(i){var e;const{mouse:t,packable:o}=i,n=((e=i.previous.entities)==null?void 0:e[0])??new a.Entity({polyline:{material:a.Color.YELLOW.withAlpha(.5)},polygon:{material:a.Color.YELLOW.withAlpha(.5)}}),r=[...o.positions??[]];return t&&r.push(t),r.length===2?(n.polygon.hierarchy=void 0,n.polyline.positions=new a.CallbackProperty(()=>r,!1)):r.length>=3?(n.polyline.positions=void 0,n.polygon.hierarchy=new a.CallbackProperty(()=>(r.push(r[0]),r.length>=3?new a.PolygonHierarchy([...r]):void 0),!1)):(n.polygon.hierarchy=void 0,n.polyline.positions=void 0),{entities:[n]}}}),ke=new k({type:"polyline",forceComplete:i=>i.positions.length>=2,skeletons:[B,re,K],initEntites:()=>[new a.Entity({polyline:{width:1}})],render(i){var e;const{mouse:t,packable:o}=i,n=((e=i.previous.entities)==null?void 0:e[0])??new a.Entity({polyline:{}});return n.polyline.positions=new a.CallbackProperty(()=>{const r=[...o.positions??[]].concat(t?[t]:[]);return r.length>=2?r:[]},!1),{entities:[n]}}});exports.PlotAction=T,exports.PlotFeature=V,exports.PlotFeatureCollection=Ee,exports.PlotScheme=k,exports.PlotSkeletonEntity=U,exports.SampledPlotProperty=z,exports.SampledPlotStrategy=oe,exports.control=B,exports.interval=q,exports.intervalNonclosed=re,exports.moved=K,exports.schemeBillboard=Ae,exports.schemeLabel=Re,exports.schemeMeasureArea=Le,exports.schemePolygon=Oe,exports.schemePolyline=ke,exports.usePlot=Pe;
1
+ "use strict";var $=Object.defineProperty,Q=(t,e,i)=>e in t?$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,C=(t,e,i)=>Q(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("cesium"),w=require("@vesium/core"),y=require("@vesium/shared"),k=require("@vueuse/core"),E=require("vue"),Y=class O{constructor(e){C(this,"type"),C(this,"complete"),C(this,"forceComplete"),C(this,"definingCursor"),C(this,"skeletons"),C(this,"initEntites"),C(this,"initPrimitives"),C(this,"initGroundPrimitives"),C(this,"render");var i;this.type=e.type,this.complete=e.complete,this.forceComplete=e.forceComplete,this.definingCursor=e.definingCursor??"crosshair",this.skeletons=((i=e.skeletons)==null?void 0:i.map(o=>o()))??[],this.initEntites=e.initEntites,this.initPrimitives=e.initPrimitives,this.initGroundPrimitives=e.initGroundPrimitives,this.render=e.render}static getCacheTypes(){return[...this._record.keys()]}static getCache(e){return O._record.get(e)}static setCache(e){y.assertError(!e.type,"`scheme.type` is required"),O._record.set(e.type,e)}static resolve(e){if(typeof e=="string"){const i=O.getCache(e);return k.assert(!!i,`scheme ${e} not found`),i}else return e instanceof O?e:new O(e)}};C(Y,"_record",new Map);let I=Y;var q=(t=>(t[t.NEAR=0]="NEAR",t[t.CYCLE=1]="CYCLE",t[t.STRICT=2]="STRICT",t))(q||{});const X=(t,e,i,o)=>{var s,r,c;return o===0?{time:t,positions:(s=e.positions)==null?void 0:s.map(l=>l.clone()),derivative:e.derivative}:o===1?{time:t,positions:(r=i.positions)==null?void 0:r.map(l=>l.clone()),derivative:e.derivative}:{time:t,positions:(c=i.positions)==null?void 0:c.map((l,m)=>{var h;const _=(h=e.positions)==null?void 0:h[m];return _?n.Cartesian3.lerp(_,l,o,new n.Cartesian3):l}),derivative:e.derivative}},U=class K{constructor(e){C(this,"strategy"),C(this,"interpolationAlgorithm"),C(this,"_times",[]),C(this,"_sampleds",[]),C(this,"_derivatives",[]),C(this,"_definitionChanged",new n.Event);var i;this.interpolationAlgorithm=e?.interpolationAlgorithm,this.strategy=e?.strategy??0,(i=e?.packables)==null||i.forEach(o=>this.setSample(o)),this._times.length||this.setSample({time:n.JulianDate.now(),positions:[],derivative:void 0})}get isConstant(){return this._times.length===0}get definitionChanged(){return this._definitionChanged}getTimes(){return this._times.map(e=>e.clone())}getIndexScope(e){if(!this._times.length)return;const i=this._times[0],o=this._times[this._times.length-1];if(n.JulianDate.lessThan(e,i)||n.JulianDate.greaterThan(e,o))switch(this.strategy){case 2:return;case 0:{e=n.JulianDate.lessThan(e,this._times[0])?this._times[0].clone():this._times[this._times.length-1].clone();break}case 1:{const h=n.JulianDate.toDate(this._times[0]).getTime(),p=n.JulianDate.toDate(this._times[this._times.length-1]).getTime()-h,d=(n.JulianDate.toDate(e).getTime()-h)%p,v=new Date(h+d);e=n.JulianDate.fromDate(v);break}}const s=this._times.findIndex(h=>n.JulianDate.lessThanOrEquals(e,h)),r=Math.min(s,this._times.length-1),c=n.JulianDate.toDate(this._times[s]).getTime(),l=n.JulianDate.toDate(this._times[r]).getTime(),m=n.JulianDate.toDate(e).getTime();return{prevIndex:s,nextIndex:r,proportion:(m-c)/(l-c)||0}}getValue(e,i){var o,s;if(i??(i={time:e}),Object.assign(i,{time:e.clone(),positions:void 0,derivative:void 0}),!e)return i.time=(o=this._times[0])==null?void 0:o.clone(),i.positions=(s=this._sampleds[0])==null?void 0:s.map(a=>a.clone(a)),i.derivative=this._derivatives[0],i;const r=this.getIndexScope(e);if(!r)return i;i.time=e;const{prevIndex:c,nextIndex:l,proportion:m}=r,h={time:this._times[c],positions:this._sampleds[c],derivative:this._derivatives[c]},_={time:this._times[l],positions:this._sampleds[l],derivative:this._derivatives[l]},p=(this.interpolationAlgorithm||K.defaultInterpolationAlgorithm)(e,h,_,m);return Object.assign(i,p),i}setSample(e){var i;const o=e.time.clone(),s=((i=e.positions)==null?void 0:i.map(l=>l.clone()))??[],r=e.derivative,c=this._times.findIndex(l=>n.JulianDate.equals(o,l));c!==-1?(this._times[c]=o,this._sampleds[c]=s,this._derivatives[c]=e.derivative):this._times.length===0?(this._times[0]=o,this._sampleds[0]=s,this._derivatives[0]=e.derivative):n.JulianDate.lessThan(o,this._times[0])?(this._times.splice(0,0,o),this._sampleds.splice(0,0,s),this._derivatives.splice(0,0,r)):n.JulianDate.greaterThan(o,this._times[this._times.length-1])&&(this._times.push(o),this._sampleds.push(s),this._derivatives.push(r)),this.definitionChanged.raiseEvent(this)}setSamples(e){e.forEach(i=>this.setSample(i))}removeSample(e){const i=this._times.findIndex(o=>o.equals(e));return i!==-1&&(this._sampleds.splice(i,1),this._derivatives.splice(i,1),this._times.splice(i,1).length)?(this._definitionChanged.raiseEvent(this),!0):!1}removeSamples(e){for(let i=0;i<this._times.length;i++){const o=this._times[i];n.TimeInterval.contains(e,o)&&this.removeSample(o)}}equals(e){return e===this}};C(U,"defaultInterpolationAlgorithm",X);let F=U;class A{constructor(e){C(this,"_id"),C(this,"_scheme"),C(this,"_definitionChanged"),C(this,"_defining"),C(this,"_disabled"),C(this,"_sampled"),C(this,"_entities"),C(this,"_primitives"),C(this,"_groundPrimitives"),C(this,"_skeletons");var i,o,s,r,c,l;const{id:m,disabled:h=!1,sampled:_}=e;this._id=m||n.createGuid(),this._scheme=I.resolve(e.scheme),this._definitionChanged=new n.Event,this._defining=!0,this._disabled=h,this._sampled=_ instanceof F?_:new F(_),this._sampled.definitionChanged.addEventListener(p=>this._definitionChanged.raiseEvent(this,"sampled",p,p),this),this._entities=[...((o=(i=this._scheme).initEntites)==null?void 0:o.call(i))??[]],this._primitives=[...((r=(s=this._scheme).initPrimitives)==null?void 0:r.call(s))??[]],this._groundPrimitives=[...((l=(c=this._scheme).initGroundPrimitives)==null?void 0:l.call(c))??[]],this._skeletons=[]}get id(){return this._id}get scheme(){return this._scheme}get definitionChanged(){return this._definitionChanged}get defining(){return this._defining}static setDefining(e,i){e._defining!==i&&(e._definitionChanged.raiseEvent(e,"defining",i,e._defining),e._defining=i)}get disabled(){return this._disabled}set disabled(e){this.disabled=e}get sampled(){return this._sampled}get entities(){return this._entities}set entities(e){this._definitionChanged.raiseEvent(this,"entities",e,this._entities),this._entities=e}get primitives(){return this._primitives}set primitives(e){this._definitionChanged.raiseEvent(this,"primitives",e,this._primitives),this._primitives=e}get groundPrimitives(){return this._groundPrimitives}set groundPrimitives(e){this._definitionChanged.raiseEvent(this,"groundPrimitives",e,this._groundPrimitives),this._groundPrimitives=e}get skeletons(){return this._skeletons}set skeletons(e){this._definitionChanged.raiseEvent(this,"skeletons",e,this._skeletons),this._skeletons=e}}class Z{constructor(e={}){C(this,"_id"),C(this,"_isDestroyed");const{id:i}=e;this._id=i||n.createGuid(),this._isDestroyed=!1}get id(){return this._id}get collectionChanged(){return this._collectionChanged}get values(){return Array.from(this._values)}add(e){if(this._isDestroyed)throw new Error("PlotFeatureCollection is isDestroyed");return this._values.has(e)?!1:!!this._values.add(e)}remove(e){return this._values.delete(e)}get entities(){return this._dataSource.entities}get primitives(){return this._primitives}get groundPrimitives(){return this._groundPrimitives}get skeletons(){return this._skeletonDataSource.entities}isDestroyed(){return this._isDestroyed}destroy(){this._isDestroyed||(this._viewer.dataSources.remove(this._dataSource),this._viewer.dataSources.remove(this._skeletonDataSource),this._viewer.scene.primitives.remove(this._primitives),this._viewer.scene.groundPrimitives.remove(this._groundPrimitives),this._viewer.dataSources.remove(this._skeletonDataSource),this._isDestroyed=!0)}}var b=(t=>(t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.ACTIVE=2]="ACTIVE",t))(b||{});class x extends n.Entity{constructor(e){super(e)}}function ee(t,e,i){const o=w.useViewer(),s=w.usePrimitive(new n.PrimitiveCollection),r=w.usePrimitive(new n.PrimitiveCollection,{collection:"ground"}),c=w.useDataSource(new n.CustomDataSource),l=w.useEntityScope({collection:()=>c.value.entities}),m=w.usePrimitiveScope({collection:()=>s.value}),h=w.usePrimitiveScope({collection:()=>r.value}),_=E.shallowRef();w.useScreenSpaceEventHandler(n.ScreenSpaceEventType.MOUSE_MOVE,a=>{_.value=y.canvasCoordToCartesian(a?.endPosition,o.value.scene)}),k.watchArray(t,(a,d,v,u=[])=>{u.forEach(g=>{l.removeWhere(f=>g.entities.includes(f)),m.removeWhere(f=>g.primitives.includes(f)),h.removeWhere(f=>g.groundPrimitives.includes(f))}),v.forEach(g=>{g.entities.forEach(f=>l.add(f)),g.primitives.forEach(f=>m.add(f)),g.groundPrimitives.forEach(f=>h.add(f))})},{immediate:!0,flush:"post"}),w.useCesiumEventListener(()=>t.value.map(a=>a.definitionChanged),(a,d,v,u)=>{if(d==="entities"){const{added:g,removed:f}=y.arrayDiff(v,u);g.forEach(P=>l.add(P)),f.forEach(P=>l.remove(P))}else if(d==="primitives"){const{added:g,removed:f}=y.arrayDiff(v,u);g.forEach(P=>m.add(P)),f.forEach(P=>m.remove(P))}else if(d==="groundPrimitives"){const{added:g,removed:f}=y.arrayDiff(v,u);g.forEach(P=>h.add(P)),f.forEach(P=>h.remove(P))}});const p=async a=>{var d,v;const u=await((v=(d=a.scheme).render)==null?void 0:v.call(d,{packable:a.sampled.getValue(i()),mouse:a.defining?_.value:void 0,defining:a.defining,previous:{entities:a.entities,primitives:a.primitives,groundPrimitives:a.groundPrimitives}}));a.entities=u?.entities??[],a.primitives=u?.primitives??[],a.groundPrimitives=u?.groundPrimitives??[]};return E.watch(e,(a,d)=>{d&&p(d)}),w.useCesiumEventListener(()=>t.value.map(a=>a.definitionChanged),(a,d)=>{["disabled","defining","scheme","sampled","time"].includes(d)&&p(a)}),E.watch(_,()=>{t.value.forEach(a=>a.defining&&p(a))}),{primitives:E.computed(()=>Array.from(m.scope)),groundPrimitives:E.computed(()=>Array.from(m.scope)),entities:E.computed(()=>Array.from(l.scope))}}function ie(t,e){const i=w.useViewer(),o=E.ref(!1),s=E.computed(()=>{var l;return(l=t.value)==null?void 0:l.sampled.getValue(e())});w.useScreenSpaceEventHandler(n.ScreenSpaceEventType.LEFT_CLICK,async l=>{var m,h;if(await k.promiseTimeout(1),!t.value||!s.value||o.value)return;const{scheme:_,defining:p,sampled:a}=t.value;if(!p)return;const d=y.canvasCoordToCartesian(l.position,i.value.scene);if(!d)return;(m=s.value).positions??(m.positions=[]),s.value.positions.push(d),a.setSample(s.value),((h=_.complete)==null?void 0:h.call(_,s.value))&&A.setDefining(t.value,!1)}),w.useScreenSpaceEventHandler(n.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,async l=>{var m;if(!t.value||!s.value)return;o.value=!0,await k.promiseTimeout(2),o.value=!1;const{scheme:h,defining:_}=t.value;if(!_||!y.canvasCoordToCartesian(l.position,i.value.scene))return;((m=h.forceComplete)==null?void 0:m.call(h,s.value))&&A.setDefining(t.value,!1)}),w.useScreenSpaceEventHandler(n.ScreenSpaceEventType.RIGHT_CLICK,async()=>{var l;if(!t.value||!s.value)return;const{defining:m,sampled:h}=t.value;m&&((l=s.value).positions??(l.positions=[]),s.value.positions.length!==0&&(s.value.positions.splice(s.value.positions.length-1,1),h.setSample(s.value)))});const r=E.ref(),c=()=>{var l,m;if(!((l=t.value)!=null&&l.defining))r.value&&(r.value=void 0,i.value.container.parentElement.style.removeProperty("cursor"));else{const h=t.value.scheme.definingCursor;r.value=y.isFunction(h)?h(s.value):h,r.value&&((m=i.value)==null||m.container.parentElement.style.setProperty("cursor",r.value))}};w.useCesiumEventListener(()=>{var l;return(l=t.value)==null?void 0:l.definitionChanged},(l,m)=>{(m==="defining"||m==="sampled")&&c()}),E.watch(t,()=>c())}function te(t,e,i){const o=w.useViewer(),s=w.useDataSource(new n.CustomDataSource),r=w.useEntityScope({collection:()=>s.value.entities}),c=E.shallowRef(),l=E.shallowRef(),m=p=>{var a,d;return p?((a=l.value)==null?void 0:a.id)===p.id?b.ACTIVE:((d=c.value)==null?void 0:d.id)===p.id?b.HOVER:b.IDLE:b.IDLE},h=(p,a)=>{const d=p.skeletons,v=[];if(a||p.disabled)p.skeletons=[];else{const u=p.sampled.getValue(i()),g=p.defining,f=e.value===p;p.scheme.skeletons.forEach(S=>{var T;if(y.isFunction(S.disabled)?S.disabled({active:f,defining:g}):S.disabled)return;const V=((T=S.format)==null?void 0:T.call(S,u))??u?.positions??[];V.forEach((j,H)=>{var J;let D=d.find(L=>L.index===H&&L.skeleton===S);const z=(J=S.render)==null?void 0:J.call(S,{defining:g,active:f,index:H,packable:u,positions:V,position:j,action:m(D)}),M=new x(z??{});D?M.propertyNames.forEach(L=>{L!=="id"&&(D[L]=M[L])}):D=M,D.plot=p,D.skeleton=S,D.index=H,v.push(D)})})}p.skeletons=v},{addGraphicEvent:_}=w.useGraphicEvent();return E.watchEffect(p=>{const a=_("global","DRAG",({event:d,pick:v,dragging:u,lockCamera:g})=>{var f;if(v.id instanceof x&&r.scope.has(v.id)){const P=v.id,S=P.plot;if(S.defining)return;l.value=P;const T=P.skeleton,W=P.index,V=S.sampled.getValue(i());(f=T.onDrag)==null||f.call(T,{viewer:o.value,sampled:S.sampled,packable:V,active:e.value===S,index:W,event:d,dragging:u,lockCamera:g})}else l.value=void 0},{cursor:({pick:d})=>{var v;if(!((v=e.value)!=null&&v.defining)&&r.scope.has(d.id)){const u=d.id.skeleton;return y.isFunction(u?.cursor)?u.cursor(d):E.toValue(u?.cursor)}},dragCursor:({pick:d})=>{var v;if(!((v=e.value)!=null&&v.defining)&&r.scope.has(d.id)){const u=d.id.skeleton;return y.isFunction(u?.dragCursor)?u.dragCursor(d):E.toValue(u?.dragCursor)}}});p(a)}),k.onKeyStroke(p=>{var a;if(l.value){const d=l.value,v=d.plot,u=d.skeleton,g=d.index,f=v.sampled.getValue(i());(a=u.onKeyPressed)==null||a.call(u,{viewer:o.value,sampled:v.sampled,packable:f,index:g,keyEvent:p})}}),E.watchEffect(p=>{const a=_("global","HOVER",({hovering:d,pick:v})=>{if(d&&v.id instanceof x&&r.scope.has(v.id)){const u=v.id;c.value=u}else c.value=void 0});p(a)}),E.watchEffect(p=>{const a=_("global","LEFT_CLICK",({event:d,pick:v})=>{var u;if(v.id instanceof x&&r.scope.has(v.id)){const g=v.id;l.value=g;const f=g.plot,P=g.skeleton,S=g.index,T=f.sampled.getValue(i());(u=P.onLeftClick)==null||u.call(P,{viewer:o.value,sampled:f.sampled,packable:T,active:e.value===f,defining:f.defining,index:S,event:d})}else l.value=void 0});p(a)}),k.watchArray(t,(p,a,d,v=[])=>{d.forEach(u=>h(u)),v.forEach(u=>h(u,!0))}),w.useCesiumEventListener(()=>t.value.map(p=>p.definitionChanged),(p,a,d,v)=>{if(["disabled","defining","scheme","sampled","time"].includes(a))E.nextTick(()=>h(p));else if(a==="skeletons"){const{added:u,removed:g}=y.arrayDiff(d,v);u.forEach(f=>r.add(f)),g.forEach(f=>r.remove(f))}}),E.watch(e,(p,a)=>{p&&h(p),a&&h(a)}),{dataSource:s}}function ne(t){const e=t?.time||E.shallowRef(),i=w.useViewer(),o=()=>{var a,d,v;return((a=e.value)==null?void 0:a.clone())||((v=(d=i.value)==null?void 0:d.clock.currentTime)==null?void 0:v.clone())||n.JulianDate.now()},s=E.shallowReactive(new Set),r=E.computed(()=>Array.from(s)),c=E.shallowRef(),l=E.shallowRef();w.useCesiumEventListener([()=>{var a;return(a=c.value)==null?void 0:a.sampled.definitionChanged}],()=>{var a;l.value=(a=c.value)==null?void 0:a.sampled.getValue(o())}),ie(c,o),ee(r,c,o),te(r,c,o),w.useScreenSpaceEventHandler(n.ScreenSpaceEventType.LEFT_CLICK,a=>{var d,v,u;if((d=c.value)!=null&&d.defining)return;const g=(v=i.value)==null?void 0:v.scene.pick(a.position.clone());if(!(((u=g?.id)==null?void 0:u.plot)instanceof A)){if(!g){c.value=void 0;return}c.value=r.value.find(f=>y.pickHitGraphic(g,[...f.entities,...f.primitives,...f.groundPrimitives]))}});let m,h;return E.watch(c,(a,d)=>{var v,u;if(d&&d.defining){const g=d.sampled.getValue(o());((u=(v=d.scheme).forceComplete)==null?void 0:u.call(v,g))?(A.setDefining(d,!1),m?.(d)):s.delete(d)}}),{plots:r,time:e,operate:async a=>new Promise((d,v)=>{m=d,h=v;const u=a instanceof A?a:new A(a);return s.has(u)||s.add(u),c.value=u,d(u)}),remove:a=>(a===c.value&&(c.value=void 0),s.has(a)?(s.delete(a),!0):!1),cancel:h}}function N(){return{disabled:({active:t})=>!t,cursor:"pointer",dragCursor:"crosshair",onDrag({viewer:t,sampled:e,packable:i,event:o,index:s,lockCamera:r}){r();const c=y.canvasCoordToCartesian(o.endPosition,t.scene);if(c){const l=[...i.positions??[]];l[s]=c,e.setSample({time:i.time,derivative:i.derivative,positions:l})}},onKeyPressed({viewer:t,keyEvent:e,sampled:i,packable:o,index:s}){var r;const c=(r=y.toCartographic(t.camera.position))==null?void 0:r.height;if(!c||!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(e.key))return;e.preventDefault();let l=0;switch(e.key){case"ArrowRight":l=Math.PI/2;break;case"ArrowDown":l=Math.PI;break;case"ArrowLeft":l=-Math.PI/2;break;case"ArrowUp":l=0;break}const m=(t.camera.heading+l)%(2*Math.PI),h=[...o.positions??[]],_=y.toCartographic(h[s]),a=c/1e5*Math.PI/180/1e3;_.latitude+=a*Math.cos(m),_.longitude+=a*Math.sin(m),h[s]=y.toCartesian3(_),i.setSample({time:o.time,derivative:o.derivative,positions:h})},render:({position:t,action:e})=>{const i={[b.IDLE]:n.Color.BLUE.withAlpha(.4),[b.HOVER]:n.Color.BLUE.withAlpha(.6),[b.ACTIVE]:n.Color.AQUA.withAlpha(1)};return{position:t,point:{pixelSize:8,color:i[e],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:n.Color.WHITE.withAlpha(.4)}}}}}function G(){let t=-1;return{disabled:({active:e,defining:i})=>!e||i,cursor:"pointer",dragCursor:"crosshair",format(e){const i=e.positions??[];return i.length<2?[]:i.map((o,s)=>{const r=s===i.length-1?i[0]:i[s+1];return n.Cartesian3.midpoint(o,r,new n.Cartesian3)})},onDrag({viewer:e,sampled:i,packable:o,event:s,index:r,lockCamera:c,dragging:l}){c();const m=y.canvasCoordToCartesian(s.endPosition,e.scene);if(!m)return;const h=[...o.positions??[]];t===-1?(t=r,h.splice(r+1,0,m)):h[t+1]=m,l||(t=-1),i.setSample({time:o.time,derivative:o.derivative,positions:h})},render:({position:e,action:i,active:o})=>{if(!o)return;const s={[b.IDLE]:n.Color.GREEN.withAlpha(.4),[b.HOVER]:n.Color.GREEN.withAlpha(.6),[b.ACTIVE]:n.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:s[i],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:n.Color.WHITE.withAlpha(.4)}}}}}function B(){let t=-1;return{disabled:({active:e,defining:i})=>!e||i,cursor:"pointer",dragCursor:"crosshair",format(e){const i=e.positions??[];if(i.length<2)return[];const o=[];for(let s=0;s<i.length-1;s++)o.push(n.Cartesian3.midpoint(i[s],i[s+1],new n.Cartesian3));return o},onDrag({viewer:e,sampled:i,packable:o,event:s,index:r,lockCamera:c,dragging:l}){c();const m=y.canvasCoordToCartesian(s.endPosition,e.scene);if(!m)return;const h=[...o.positions??[]];t===-1?(t=r,h.splice(r+1,0,m)):h[t+1]=m,l||(t=-1),i.setSample({time:o.time,derivative:o.derivative,positions:h})},render:({position:e,action:i})=>{const o={[b.IDLE]:n.Color.GREEN.withAlpha(.4),[b.HOVER]:n.Color.GREEN.withAlpha(.6),[b.ACTIVE]:n.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:o[i],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:n.Color.WHITE.withAlpha(.4)}}}}}const se=`data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6"/></svg>')}`;function R(){return{disabled:({active:t,defining:e})=>!t||e,cursor:"pointer",dragCursor:"crosshair",format(t){const e=t.positions??[];if(e.length===0)return[];if(e.length===1)return[e[0]];{const i=n.Rectangle.center(n.Rectangle.fromCartesianArray(e));return[y.toCartesian3(i)]}},onDrag({viewer:t,sampled:e,packable:i,event:o,lockCamera:s,dragging:r}){r&&s();const c=y.canvasCoordToCartesian(o.startPosition,t.scene),l=y.canvasCoordToCartesian(o.endPosition,t.scene);if(!c||!l)return;const m=n.Cartesian3.subtract(l,c,new n.Cartesian3),h=[...i.positions??[]];e.setSample({time:i.time,derivative:i.derivative,positions:h.map(_=>n.Cartesian3.add(_,m,new n.Cartesian3))})},render:({position:t,action:e})=>{const i={[b.IDLE]:n.Color.WHITE,[b.HOVER]:n.Color.WHITE,[b.ACTIVE]:n.Color.AQUA.withAlpha(1)};return{position:t,billboard:{image:se,width:20,height:20,color:i[e],pixelOffset:new n.Cartesian3(0,-20),horizontalOrigin:n.HorizontalOrigin.CENTER,verticalOrigin:n.VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}}}}}function oe(t){if(t.length<3)throw new Error("positions must >= 3");if(t.length===3)return[[t[0].clone(),t[1].clone(),t[2].clone()]];const e=n.CoplanarPolygonGeometry.createGeometry(n.CoplanarPolygonGeometry.fromPositions({positions:t,vertexFormat:n.VertexFormat.POSITION_ONLY}));if(!e)throw new Error("positions\u65E0\u6CD5\u7EC4\u6210\u6709\u6548\u7684geometry,\u68C0\u67E5\u70B9\u4F4D\u662F\u5426\u9519\u8BEF");const i=e.attributes.position.values,o=e.indices,s=[];for(let r=0;r<o.length;r+=3){const c=n.Cartesian3.unpack(i,o[r]*3,new n.Cartesian3),l=n.Cartesian3.unpack(i,o[r+1]*3,new n.Cartesian3),m=n.Cartesian3.unpack(i,o[r+2]*3,new n.Cartesian3);s.push([c,l,m])}return s}function re(t,e,i){const o=n.Cartesian3.subtract(t,e,new n.Cartesian3),s=n.Cartesian3.subtract(i,e,new n.Cartesian3),r=n.Cartesian3.cross(o,s,o);return n.Cartesian3.magnitude(r)*.5}function ae(t){const i=n.ClassificationType.BOTH,o=Math.floor(10);return{scene:t?.scene,clampToGround:!1,classificationType:i,terrainProvider:t?.terrainProvider,density:o}}async function le(t,e){if(t.length<2)throw new Error("positions.length must >= 2");const{density:i}=ae(e);if(i<=0)throw new Error("options.density must > 0");return oe(t).reduce((s,r)=>s+=re(...r),0)}const ce=new I({type:"measureArea",forceComplete:t=>t.positions.length>=3,skeletons:[N,G],initEntites:()=>[new n.Entity({label:{font:"14pt"},polyline:{material:n.Color.YELLOW.withAlpha(.5)},polygon:{material:n.Color.YELLOW.withAlpha(.5)}})],render(t){var e;const{mouse:i,packable:o}=t,s=((e=t.previous.entities)==null?void 0:e[0])??new n.Entity({label:{font:"14pt"},polyline:{material:n.Color.YELLOW.withAlpha(.5)},polygon:{material:n.Color.YELLOW.withAlpha(.5)}}),r=[...o.positions??[]];return i&&r.push(i),r.length===2?(s.position=void 0,s.label.text=void 0,s.polygon.hierarchy=void 0,s.polyline.positions=new n.CallbackProperty(()=>r,!1)):r.length>=3?(r.push(r[0]),s.position=new n.ConstantPositionProperty(w.toCartesian3(n.Rectangle.center(n.Rectangle.fromCartesianArray(r)))),s.label.text=new n.ConstantProperty(""),le(r).then(c=>{let l="";c/1e3/1e3>10?l=`${(c/1e3/1e3).toFixed(2)}km\xB2`:l=`${(+c).toFixed(2)}m\xB2`,s.label.text=new n.ConstantProperty(l)}),s.polyline.positions=void 0,s.polygon.hierarchy=new n.CallbackProperty(()=>r.length>=3?new n.PolygonHierarchy([...r]):void 0,!1)):(s.position=void 0,s.polygon.hierarchy=void 0,s.polyline.positions=void 0),{entities:[s]}}}),de=new I({type:"billboard",complete:t=>t.positions.length>=1,skeletons:[R],initEntites:()=>[new n.Entity({billboard:{image:"/favicon.svg",width:32,height:32}})],render(t){var e,i;const{mouse:o,packable:s}=t,r=((e=t.previous.entities)==null?void 0:e[0])??new n.Entity({billboard:{}}),c=((i=s.positions)==null?void 0:i[0])??o;return r.position=new n.CallbackPositionProperty(()=>c,!0),{entities:[r]}}}),ue=new I({type:"label",complete:t=>t.positions.length>=1,skeletons:[R],initEntites:()=>[new n.Entity({label:{text:"Label"}})],render(t){var e,i;const{mouse:o,packable:s}=t,r=((e=t.previous.entities)==null?void 0:e[0])??new n.Entity({label:{}}),c=((i=s.positions)==null?void 0:i[0])??o;return r.position=new n.CallbackPositionProperty(()=>c,!0),{entities:[r]}}}),he=new I({type:"polygon",forceComplete:t=>t.positions.length>=3,skeletons:[N,G,R],initEntites:()=>[new n.Entity({polyline:{material:n.Color.YELLOW.withAlpha(.5)},polygon:{material:n.Color.YELLOW.withAlpha(.5)}})],render(t){var e;const{mouse:i,packable:o}=t,s=((e=t.previous.entities)==null?void 0:e[0])??new n.Entity({polyline:{material:n.Color.YELLOW.withAlpha(.5)},polygon:{material:n.Color.YELLOW.withAlpha(.5)}}),r=[...o.positions??[]];return i&&r.push(i),r.length===2?(s.polygon.hierarchy=void 0,s.polyline.positions=new n.CallbackProperty(()=>r,!1)):r.length>=3?(s.polyline.positions=void 0,s.polygon.hierarchy=new n.CallbackProperty(()=>(r.push(r[0]),r.length>=3?new n.PolygonHierarchy([...r]):void 0),!1)):(s.polygon.hierarchy=void 0,s.polyline.positions=void 0),{entities:[s]}}}),ve=new I({type:"polyline",forceComplete:t=>t.positions.length>=2,skeletons:[N,B,R],initEntites:()=>[new n.Entity({polyline:{width:1}})],render(t){var e;const{mouse:i,packable:o}=t,s=((e=t.previous.entities)==null?void 0:e[0])??new n.Entity({polyline:{}});return s.polyline.positions=new n.CallbackProperty(()=>{const r=[...o.positions??[]].concat(i?[i]:[]);return r.length>=2?r:[]},!1),{entities:[s]}}});exports.PlotAction=b,exports.PlotFeature=A,exports.PlotFeatureCollection=Z,exports.PlotScheme=I,exports.PlotSkeletonEntity=x,exports.SampledPlotProperty=F,exports.SampledPlotStrategy=q,exports.control=N,exports.interval=G,exports.intervalNonclosed=B,exports.moved=R,exports.schemeBillboard=de,exports.schemeLabel=ue,exports.schemeMeasureArea=ce,exports.schemePolygon=he,exports.schemePolyline=ve,exports.usePlot=ne;
2
2
  //# sourceMappingURL=index.min.cjs.map