ino-cesium 0.0.21-beta.3 → 0.0.22-beta.0
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.
- package/dist/assets/images/ground-clip/poly-soil.jpg +0 -0
- package/dist/assets/images/ground-clip/wall.jpg +0 -0
- package/dist/ino-cesium-full.js +23 -6
- package/dist/ino-cesium.d.ts +187 -61
- package/dist/ino-cesium.js +18 -1
- package/package.json +9 -9
- /package/dist/assets/{ground-skybox → images/ground-skybox}/nx.jpg +0 -0
- /package/dist/assets/{ground-skybox → images/ground-skybox}/ny.jpg +0 -0
- /package/dist/assets/{ground-skybox → images/ground-skybox}/nz.jpg +0 -0
- /package/dist/assets/{ground-skybox → images/ground-skybox}/px.jpg +0 -0
- /package/dist/assets/{ground-skybox → images/ground-skybox}/py.jpg +0 -0
- /package/dist/assets/{ground-skybox → images/ground-skybox}/pz.jpg +0 -0
package/dist/ino-cesium.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
import*as e from"cesium";export{e as Cesium};var t=Object.freeze({__proto__:null});let i=1;const n=(t,i)=>{i||(i={token:""}),i.token&&(e.Ion.defaultAccessToken=i.token),e.Camera.DEFAULT_VIEW_RECTANGLE=e.Rectangle.fromDegrees(90,-20,110,90);const n={...l,...i},o=new e.Viewer(t,n);return o.imageryLayers.remove(o.imageryLayers.get(0)),o._cesiumWidget._creditContainer.style.display="none",o.scene.postProcessStages.fxaa.enabled=!0,o.scene.msaaSamples=8,o.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),o.scene.globe.depthTestAgainstTerrain=!0,o.scene.globe.showGroundAtmosphere=!0,o.scene.globe.enableLighting=!1,o.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),o},o=(t,i)=>{const n=i?1:0;t.scene.skyBox.show=i,t.scene.skyAtmosphere.show=i,t.scene.globe.dynamicAtmosphereLighting=i,t.scene.globe.dynamicAtmosphereLightingFromSun=i,t.scene.globe.translucency.backFaceAlpha=n,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${n})`),t.scene.globe.showGroundAtmosphere=i,i?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${n})`),t.scene.globe.material=void 0,t.scene.globe.translucency.enabled=!1):(t.scene.globe.translucency.enabled=!1,t.scene.globe.undergroundColor=e.Color.fromCssColorString(`rgba(0, 0, 0,${n})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${n})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${n})`)}}}))},r=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},a=e=>{i=e},s=()=>i,l={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!0,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!1,scene3DOnly:!0,navigation:!1,navigationInstructionsInitiallyVisible:!1,showRenderLoopErrors:!0,orderIndependentTranslucency:!1,contextOptions:{webgl:{alpha:!0}}},c=t=>{let i=0;for(let n=0;n<t.length;n++){const o=t[n],r=t[(n+1)%t.length];i+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return i>0?t.reverse():t},d=t=>{let i=0;for(let n=0;n<t.length;n++){const o=t[n],r=t[(n+1)%t.length];i+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return i<0?t.reverse():t},p=e=>e.map(e=>h(e)),h=t=>{const i=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(i.longitude),latitude:e.Math.toDegrees(i.latitude),height:i.height}},u=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),m=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),g=e=>{const t=e[0],i=e[e.length-1];return t.x===i.x&&t.y===i.y&&t.z===i.z?e:[...e,e[0]]},f=e=>{const t=[];return e.forEach(e=>{t.push({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{height:e.height}})}),{type:"FeatureCollection",features:t}},v=e=>{const t=[];return e.forEach((i,n)=>{0!==n&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[n-1].longitude,e[n-1].latitude],[i.longitude,i.latitude]]},properties:{height:i.height}})}),{type:"FeatureCollection",features:t}},y=e=>{const t=[];return t.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e.map(e=>[e.longitude,e.latitude])]},properties:{heights:e.map(e=>e.height)}}),{type:"FeatureCollection",features:t}},C=t=>({heading:e.Math.toRadians(t.yaw+(t.offsetYaw||0)),pitch:e.Math.toRadians(t.pitch),roll:e.Math.toRadians(t.roll)}),w=t=>{const{lng:i,lat:n,height:o,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(i,n,o||1e4)})},b=t=>{const{lng:i,lat:n,height:o,viewer:r}=t;r.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(i,n,o||1e4)})},P=e=>{const{position:t,viewer:i}=e;i.scene.camera.flyTo({destination:t})};function _(t){const i=t.camera.heading,n=t.camera.pitch,o=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:i,pitch:n,roll:o}}}function x(e,t){e&&t.scene.camera.flyTo({...e})}function M(e,t){const i=t.dataSources.getByName(e);i.length>0&&t.flyTo(i[0])}function E(e,t){e&&t.flyTo(e)}function D(e,t){t.flyTo(e)}function A(t,i){const n=new e.Cartesian3(t[0],t[1],t[2]),o=new e.BoundingSphere(n,t[3]);i.camera.flyToBoundingSphere(o,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const S=(t,i,n,o,r)=>{if(n<=t||o<=i)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const a={destination:e.Rectangle.fromDegrees(t,i,n,o),duration:3,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}};r.camera.flyTo(a)},I=t=>{t.camera.flyTo({destination:t.scene.camera.position,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0},duration:1.5})};function T(t){const i=t.scene.canvas,n=i.clientWidth/2,o=i.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(n,o))}const z=t=>{let i=!1;let n;const o=t.camera;let r=o.pitch,a=0,s=!1;function l(){if(!i||!n)return;let e=o.heading;s?e+=.005:e-=.005,t.camera.setView({destination:n,orientation:{heading:e,pitch:r}}),t.camera.moveBackward(a),requestAnimationFrame(l)}return{start:(c,d)=>{n=c||T(t),r=o.pitch,s=!!d,a=e.Cartesian3.distance(o.position,n),i=!0,l(),t.scene.screenSpaceCameraController.enableInputs=!1},end:()=>{i=!1,t.scene.screenSpaceCameraController.enableInputs=!0}}},F=e=>{let t=!1;let i=!1;function n(){if(!t)return;let o=e.camera.heading;i?o+=.001:o-=.001,e.camera.setView({orientation:{heading:o,pitch:e.camera.pitch}}),requestAnimationFrame(n)}t=!0;return{start:e=>{t=!0,i=!!e,n()},end:()=>{t=!1}}};function R(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const O=(t,i)=>{console.log("sdfjdsklf"),i||(i=1e5);let n=!1;t.camera.moveEnd.addEventListener(function(){if(n)return;const o=t.camera,r=t.camera.positionCartographic.height;console.log("cameraEnd",r);const a=o.heading,s=o.roll;if(r>i){n=!0;const i=t.camera.computeViewRectangle();if(!i)return void(n=!0);const o={longitude:0,latitude:0},l=e.Rectangle.center(i);o.longitude=e.Math.toDegrees(l.longitude),o.latitude=e.Math.toDegrees(l.latitude),t.camera.flyTo({destination:m(new e.Cartographic(o.longitude,o.latitude,r)),orientation:{heading:a,pitch:-1.5,roll:s},duration:1,complete:()=>{}})}else n=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},L=(t,i)=>{const n=t.scene,o=new e.ScreenSpaceEventHandler(n.canvas);o.setInputAction(e=>{if(i.LEFT_POSITION){const o=n.pickPosition(e.position);k(e.position,o,i.LEFT_POSITION,t)}i.PICK_FEATURE&&B(t,e.position,i.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(e=>{if(i.MOVE_POSITION){const o=n.pickPosition(e.endPosition);k(e.endPosition,o,i.MOVE_POSITION,t)}i.MOVE_PICK_FEATURE&&B(t,e.endPosition,i.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},B=(t,i,n)=>{const o=t.scene.pickPosition(i),r=t.scene.pick(i),a={};if(r){if(t._element.style.cursor="pointer",r instanceof e.Cesium3DTileFeature){r.getPropertyIds().forEach(e=>{a[e]=r.getProperty(e)})}else r.id instanceof e.Cesium3DTileContent?(t._element.style.cursor="pointer",Object.assign(a,{name:"sdfjldks"})):r.id instanceof e.Entity?t._element.style.cursor="pointer":r.primitive&&Object.assign(a,r.primitive.properties);n({position:o,...r},a)}else n(void 0,{})},k=(t,i,n,o)=>{i||(i=e.Cartesian3.fromDegrees(0,0,0));const r=e.Cartographic.fromCartesian(i);n({windowPosition:t,position:i,lnglat:{lng:e.Math.toDegrees(r.longitude),lat:e.Math.toDegrees(r.latitude),height:r.height},cameraView:_(o)})},N=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,G=()=>window.INO_CESIUM_BASE_URL;class U{static tooltip;_title;_div;_message;constructor(e){const t=document.createElement("DIV");t.id="tooltip",t.className="twipsy right";const i=document.createElement("DIV");i.className="twipsy-inner",t.appendChild(i),this._div=t,this._title=i,this._message="";const n=e._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(t),t.onmousemove=e=>{this.showAt({x:e.clientX,y:e.clientY},this._message)}}showAt(e,t){e&&t&&(this.setVisible(!0),this._title.innerHTML=t,this._div.style.left=`${e.x+10}px`,this._div.style.top=e.y-this._div.clientHeight/2+"px",this._message=t)}setVisible(e){this._div.style.display=e?"block":"none"}static createToolTip(e){return U.tooltip||(U.tooltip=new U(e)),U.tooltip}destroy(){U.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),U.tooltip=null)}}class V{static popup;_div;viewer;offset=new e.Cartesian2(140,150);position=e.Cartesian3.ZERO;constructor(e,t,i){this.viewer=e,i&&(this.offset=i),this._div=t,this._div.style.position="absolute",this._div.style.left="0",this._div.style.top="0",this._div.style.display="none";const n=e._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(t),this.renderPosition()}showAt(e){this.position=e,e&&this.setVisible(!0)}setVisible(e){this._div.style.display=e?"block":"none"}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(!this.position.equals(e.Cartesian3.ZERO)){const e=this.viewer.scene.cartesianToCanvasCoordinates(this.position);this._div.style.left=e.x-this.offset.x+"px",this._div.style.top=e.y-this.offset.y+"px"}})}static createPupup(e,t,i){return V.popup||(V.popup=new V(e,t,i)),V.popup}destroy(){V.popup&&(this._div&&this._div.parentNode.removeChild(this._div),V.popup=null)}}const $=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let o=0;o<e;o++){const e=H(t),o=H(i);n.push({type:"Feature",geometry:{type:"Point",coordinates:[e,o]},properties:{}})}return{type:"FeatureCollection",features:n}};function H(e){const[t,i]=e;return Math.random()*(i-t)+t}function W(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const q=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let o=0;o<e;o++){const e=Math.floor(H([3,10])),o=[];for(let n=0;n<e;n++){const e=H(t),n=H(i);o.push([e,n])}n.push({type:"Feature",geometry:{type:"LineString",coordinates:o},properties:{}})}return{type:"FeatureCollection",features:n}},j=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let o=0;o<e;o++){const e=Z(t,i);n.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:n}};function Z(e,t){const i=Math.floor(H([3,10])),n=H(e),o=H(t),r=H([1,5]),a=[];for(let e=0;e<i;e++){const t=e/i*2*Math.PI,s=H([.8*r,r]),l=n+s*Math.cos(t),c=o+s*Math.sin(t);a.push([l,c])}return a.push(a[0]),a}const Y=(t,i)=>{let n=!1;const o=new e.Viewer(t,{...l,scene3DOnly:!1});o.scene.mode=2;const r=o.scene.screenSpaceCameraController;r.enableRotate=!1,r.enableTranslate=!1,r.enableZoom=!1,r.enableTilt=!1,r.enableLook=!1,i.entities.add({position:e.Cartesian3.fromDegrees(0,0),label:{text:new e.CallbackProperty(()=>(a(),""),!0)}});const a=function(){n||o.camera.flyTo({destination:i.camera.position,orientation:{heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},duration:0})};return{viewer:o,open:()=>{n=!1},close:()=>{n=!0}}},J=t=>{const i=[],n=e=>{t.scene.splitPosition=e},o=(e,t)=>{i.push(e),e.splitDirection=t};return{set:()=>{n(.5),function(){let e=document.getElementById("vertical-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="vertical-slider";const i=t._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(e)}(),function(){const e=document.getElementById("vertical-slider");function i(){document.removeEventListener("mousemove",o,!1)}function n(){document.addEventListener("mousemove",o,!1)}function o(i){i.preventDefault?i.preventDefault():i.returnValue=!1,e.style.left=`${i.clientX}px`;const n=i.clientX/e.parentElement.offsetWidth;t.scene.splitPosition=n}e.addEventListener("mousedown",n,!1),document.addEventListener("mouseup",i,!1)}()},remove:()=>{i.forEach(t=>{o(t,e.SplitDirection.NONE)});document.getElementById("vertical-slider").style.display="none"},setSplitPosition:n,setSplitDirection:o}},K=t=>{const i=t;let o;const r={},a=()=>{const e=i.container;e.style.display="flex";e.getElementsByClassName("cesium-viewer")[0].style.width="50%";const t=document.createElement("div");t.style={width:"50%",height:"100%"},t.id="right-screen-viewer",e.appendChild(t),o=n(t.id),r[1]=o,l(),i.camera.changed.addEventListener(()=>s(i,o)),i.scene.preRender.addEventListener(()=>s(i,o)),i.camera.percentageChanged=.01,o.camera.changed.addEventListener(()=>s(o,i)),o.scene.preRender.addEventListener(()=>s(o,i)),o.camera.percentageChanged=.01,o._splitNumber=1};function s(t,i){const n=e.Cartographic.toCartesian(t.camera.positionCartographic);i.camera.setView({destination:new e.Cartesian3(n.x,n.y,n.z),orientation:{direction:t.scene.camera._direction,up:t.scene.camera.up,heading:t.scene.camera.heading,pitch:t.scene.camera.pitch,roll:t.scene.camera.roll}})}const l=()=>{i.imageryLayers._layers.forEach(e=>{e.splitScreenBaseLayer&&o.imageryLayers.addImageryProvider(e.imageryProvider)})};return{set:()=>{a(),function(){let e=document.getElementById("split-screen-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="split-screen-slider";const i=t._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(e)}(),i._splitNumber=-1,r[-1]=i},viewerMap:r,getViewerFromKey:e=>r[e],remove:()=>{document.getElementById("split-screen-slider").style.display="none";i.container.getElementsByClassName("cesium-viewer")[0].style.width="100%",o.container.remove(),delete r[1]},setLayer:(e,t)=>{},updateBaseLayers:l}};var X=6371008.8,Q={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*X,kilometers:6371.0088,kilometres:6371.0088,meters:X,metres:X,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:X/1852,radians:1,yards:6967335.223679999};function ee(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}function te(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!se(e[0])||!se(e[1]))throw new Error("coordinates must contain numbers");return ee({type:"Point",coordinates:e},t,i)}function ie(e,t,i={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return ee({type:"Polygon",coordinates:e},t,i)}function ne(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return ee({type:"LineString",coordinates:e},t,i)}function oe(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function re(e){return 180*(e%(2*Math.PI))/Math.PI}function ae(e){return e%360*Math.PI/180}function se(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function le(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ce(e){return"Feature"===e.type?e.geometry:e}function de(e,t,i={}){if(!0===i.final)return function(e,t){let i=de(t,e);return i=(i+180)%360,i}(e,t);const n=le(e),o=le(t),r=ae(n[0]),a=ae(o[0]),s=ae(n[1]),l=ae(o[1]),c=Math.sin(a-r)*Math.cos(l),d=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-r);return re(Math.atan2(c,d))}function pe(e,t,i,n={}){const o=le(e),r=ae(o[0]),a=ae(o[1]),s=ae(i),l=function(e,t="kilometers"){const i=Q[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,n.units),c=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(s));return te([re(r+Math.atan2(Math.sin(s)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(c))),re(c)],n.properties)}function he(e,t,i={}){var n=le(e),o=le(t),r=ae(o[1]-n[1]),a=ae(o[0]-n[0]),s=ae(n[1]),l=ae(o[1]),c=Math.pow(Math.sin(r/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return function(e,t="kilometers"){const i=Q[t];if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function ue(e,t,i){if(null!==e)for(var n,o,r,a,s,l,c,d,p=0,h=0,u=e.type,m="FeatureCollection"===u,g="Feature"===u,f=m?e.features.length:1,v=0;v<f;v++){s=(d=!!(c=m?e.features[v].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var C=0,w=0;if(null!==(a=d?c.geometries[y]:c)){l=a.coordinates;var b=a.type;switch(p=!i||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===t(l,h,v,C,w))return!1;h++,C++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],h,v,C,w))return!1;h++,"MultiPoint"===b&&C++}"LineString"===b&&C++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(o=0;o<l[n].length-p;o++){if(!1===t(l[n][o],h,v,C,w))return!1;h++}"MultiLineString"===b&&C++,"Polygon"===b&&w++}"Polygon"===b&&C++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(w=0,o=0;o<l[n].length;o++){for(r=0;r<l[n][o].length-p;r++){if(!1===t(l[n][o][r],h,v,C,w))return!1;h++}w++}C++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(!1===ue(a.geometries[n],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function me(e,t){var i,n,o,r,a,s,l,c,d,p,h=0,u="FeatureCollection"===e.type,m="Feature"===e.type,g=u?e.features.length:1;for(i=0;i<g;i++){for(s=u?e.features[i].geometry:m?e.geometry:e,c=u?e.features[i].properties:m?e.properties:{},d=u?e.features[i].bbox:m?e.bbox:void 0,p=u?e.features[i].id:m?e.id:void 0,a=(l=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,o=0;o<a;o++)if(null!==(r=l?s.geometries[o]:s))switch(r.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(r,h,c,d,p))return!1;break;case"GeometryCollection":for(n=0;n<r.geometries.length;n++)if(!1===t(r.geometries[n],h,c,d,p))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,h,c,d,p))return!1;h++}}function ge(e){return function(e,t,i){var n=i;return me(e,function(e,o,r,a,s){n=0===o&&void 0===i?e:t(n,e,o,r,a,s)}),n}(e,(e,t)=>e+function(e){let t,i=0;switch(e.type){case"Polygon":return fe(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)i+=fe(e.coordinates[t]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}function fe(e){let t=0;if(e&&e.length>0){t+=Math.abs(Ce(e[0]));for(let i=1;i<e.length;i++)t-=Math.abs(Ce(e[i]))}return t}var ve=20294876564838.72,ye=Math.PI/180;function Ce(e){const t=e.length-1;if(t<=2)return 0;let i=0,n=0;for(;n<t;){const o=e[n],r=e[n+1===t?0:n+1],a=e[n+2>=t?(n+2)%t:n+2],s=o[0]*ye,l=r[1]*ye;i+=(a[0]*ye-s)*Math.sin(l),n++}return i*ve}function we(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return ue(e,e=>{i[0]>e[0]&&(i[0]=e[0]),i[1]>e[1]&&(i[1]=e[1]),i[2]<e[0]&&(i[2]=e[0]),i[3]<e[1]&&(i[3]=e[1])}),i}const be=11102230246251565e-32,Pe=134217729,_e=(3+8*be)*be;function xe(e,t,i,n,o){let r,a,s,l,c=t[0],d=n[0],p=0,h=0;d>c==d>-c?(r=c,c=t[++p]):(r=d,d=n[++h]);let u=0;if(p<e&&h<i)for(d>c==d>-c?(a=c+r,s=r-(a-c),c=t[++p]):(a=d+r,s=r-(a-d),d=n[++h]),r=a,0!==s&&(o[u++]=s);p<e&&h<i;)d>c==d>-c?(a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p]):(a=r+d,l=a-r,s=r-(a-l)+(d-l),d=n[++h]),r=a,0!==s&&(o[u++]=s);for(;p<e;)a=r+c,l=a-r,s=r-(a-l)+(c-l),c=t[++p],r=a,0!==s&&(o[u++]=s);for(;h<i;)a=r+d,l=a-r,s=r-(a-l)+(d-l),d=n[++h],r=a,0!==s&&(o[u++]=s);return 0===r&&0!==u||(o[u++]=r),u}function Me(e){return new Float64Array(e)}const Ee=Me(4),De=Me(8),Ae=Me(12),Se=Me(16),Ie=Me(4);function Te(e,t,i,n,o,r){const a=(t-r)*(i-o),s=(e-o)*(n-r),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,n,o,r,a){let s,l,c,d,p,h,u,m,g,f,v,y,C,w,b,P,_,x;const M=e-o,E=i-o,D=t-r,A=n-r;w=M*A,h=Pe*M,u=h-(h-M),m=M-u,h=Pe*A,g=h-(h-A),f=A-g,b=m*f-(w-u*g-m*g-u*f),P=D*E,h=Pe*D,u=h-(h-D),m=D-u,h=Pe*E,g=h-(h-E),f=E-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ee[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ee[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ee[2]=y-(x-p)+(v-p),Ee[3]=x;let S=function(e,t){let i=t[0];for(let n=1;n<e;n++)i+=t[n];return i}(4,Ee),I=22204460492503146e-32*a;if(S>=I||-S>=I)return S;if(p=e-M,s=e-(M+p)+(p-o),p=i-E,c=i-(E+p)+(p-o),p=t-D,l=t-(D+p)+(p-r),p=n-A,d=n-(A+p)+(p-r),0===s&&0===l&&0===c&&0===d)return S;if(I=11093356479670487e-47*a+_e*Math.abs(S),S+=M*d+A*s-(D*c+E*l),S>=I||-S>=I)return S;w=s*A,h=Pe*s,u=h-(h-s),m=s-u,h=Pe*A,g=h-(h-A),f=A-g,b=m*f-(w-u*g-m*g-u*f),P=l*E,h=Pe*l,u=h-(h-l),m=l-u,h=Pe*E,g=h-(h-E),f=E-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ie[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ie[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ie[2]=y-(x-p)+(v-p),Ie[3]=x;const T=xe(4,Ee,4,Ie,De);w=M*d,h=Pe*M,u=h-(h-M),m=M-u,h=Pe*d,g=h-(h-d),f=d-g,b=m*f-(w-u*g-m*g-u*f),P=D*c,h=Pe*D,u=h-(h-D),m=D-u,h=Pe*c,g=h-(h-c),f=c-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ie[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ie[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ie[2]=y-(x-p)+(v-p),Ie[3]=x;const z=xe(T,De,4,Ie,Ae);w=s*d,h=Pe*s,u=h-(h-s),m=s-u,h=Pe*d,g=h-(h-d),f=d-g,b=m*f-(w-u*g-m*g-u*f),P=l*c,h=Pe*l,u=h-(h-l),m=l-u,h=Pe*c,g=h-(h-c),f=c-g,_=m*f-(P-u*g-m*g-u*f),v=b-_,p=b-v,Ie[0]=b-(v+p)+(p-_),y=w+v,p=y-w,C=w-(y-p)+(v-p),v=C-P,p=C-v,Ie[1]=C-(v+p)+(p-P),x=y+v,p=x-y,Ie[2]=y-(x-p)+(v-p),Ie[3]=x;const F=xe(z,Ae,4,Ie,Se);return Se[F-1]}(e,t,i,n,o,r,c)}function ze(e,t){var i,n,o,r,a,s,l,c,d,p=0,h=e[0],u=e[1],m=t.length;for(i=0;i<m;i++){n=0;var g=t[i],f=g.length-1;if((c=g[0])[0]!==g[f][0]&&c[1]!==g[f][1])throw new Error("First and last coordinates in a ring must be the same");for(r=c[0]-h,a=c[1]-u;n<f;n++){if(s=(d=g[n+1])[0]-h,l=d[1]-u,0===a&&0===l){if(s<=0&&r>=0||r<=0&&s>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(o=Te(r,s,a,l,0,0)))return 0;(o>0&&l>0&&a<=0||o<0&&l<=0&&a>0)&&p++}c=d,a=l,r=s}}return p%2!=0}function Fe(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const n=le(e),o=ce(t),r=o.type,a=t.bbox;let s=o.coordinates;if(a&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(n,a))return!1;"Polygon"===r&&(s=[s]);let l=!1;for(var c=0;c<s.length;++c){const e=ze(n,s[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}function Re(e,t,i={}){const n=le(e),o=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(t);for(let e=0;e<o.length-1;e++){let t=!1;if(i.ignoreEndVertices&&(0===e&&(t="start"),e===o.length-2&&(t="end"),0===e&&e+1===o.length-1&&(t="both")),Oe(o[e],o[e+1],n,t,void 0===i.epsilon?null:i.epsilon))return!0}return!1}function Oe(e,t,i,n,o){const r=i[0],a=i[1],s=e[0],l=e[1],c=t[0],d=t[1],p=c-s,h=d-l,u=(i[0]-s)*h-(i[1]-l)*p;if(null!==o){if(Math.abs(u)>o)return!1}else if(0!==u)return!1;return Math.abs(p)===Math.abs(h)&&0===Math.abs(p)?!n&&(i[0]===e[0]&&i[1]===e[1]):n?"start"===n?Math.abs(p)>=Math.abs(h)?p>0?s<r&&r<=c:c<=r&&r<s:h>0?l<a&&a<=d:d<=a&&a<l:"end"===n?Math.abs(p)>=Math.abs(h)?p>0?s<=r&&r<c:c<r&&r<=s:h>0?l<=a&&a<d:d<a&&a<=l:"both"===n&&(Math.abs(p)>=Math.abs(h)?p>0?s<r&&r<c:c<r&&r<s:h>0?l<a&&a<d:d<a&&a<l):Math.abs(p)>=Math.abs(h)?p>0?s<=r&&r<=c:c<=r&&r<=s:h>0?l<=a&&a<=d:d<=a&&a<=l}function Le(e,t){var i=ce(e),n=ce(t),o=i.type,r=n.type;switch(o){case"Point":switch(r){case"MultiPoint":return function(e,t){var i,n=!1;for(i=0;i<t.coordinates.length;i++)if(ke(t.coordinates[i],e.coordinates)){n=!0;break}return n}(i,n);case"LineString":return Re(i,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Fe(i,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+r+" geometry not supported")}case"MultiPoint":switch(r){case"MultiPoint":return function(e,t){for(var i=0;i<e.coordinates.length;i++){for(var n=!1,o=0;o<t.coordinates.length;o++)ke(e.coordinates[i],t.coordinates[o])&&(n=!0);if(!n)return!1}return!0}(i,n);case"LineString":return function(e,t){for(var i=!1,n=0;n<e.coordinates.length;n++){if(!Re(e.coordinates[n],t))return!1;i||(i=Re(e.coordinates[n],t,{ignoreEndVertices:!0}))}return i}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){for(var i=!0,n=!1,o=0;o<e.coordinates.length;o++){if(!(n=Fe(e.coordinates[o],t))){i=!1;break}n=Fe(e.coordinates[o],t,{ignoreBoundary:!0})}return i&&n}(i,n);default:throw new Error("feature2 "+r+" geometry not supported")}case"LineString":switch(r){case"LineString":return function(e,t){for(var i=0;i<e.coordinates.length;i++)if(!Re(e.coordinates[i],t))return!1;return!0}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){var i=we(t),n=we(e);if(!Be(i,n))return!1;for(var o=!1,r=0;r<e.coordinates.length;r++){if(!Fe(e.coordinates[r],t))return!1;if(o||(o=Fe(e.coordinates[r],t,{ignoreBoundary:!0})),!o&&r<e.coordinates.length-1)o=Fe(Ne(e.coordinates[r],e.coordinates[r+1]),t,{ignoreBoundary:!0})}return o}(i,n);default:throw new Error("feature2 "+r+" geometry not supported")}case"Polygon":switch(r){case"Polygon":case"MultiPolygon":return function(e,t){var i=we(e);if(!Be(we(t),i))return!1;for(var n=0;n<e.coordinates[0].length;n++)if(!Fe(e.coordinates[0][n],t))return!1;return!0}(i,n);default:throw new Error("feature2 "+r+" geometry not supported")}default:throw new Error("feature1 "+o+" geometry not supported")}}function Be(e,t){return!(e[0]>t[0])&&(!(e[2]<t[2])&&(!(e[1]>t[1])&&!(e[3]<t[3])))}function ke(e,t){return e[0]===t[0]&&e[1]===t[1]}function Ne(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function Ge(e,t={}){let i=0,n=0,o=0;return ue(e,function(e){i+=e[0],n+=e[1],o++},!0),te([i/o,n/o],t.properties)}function Ue(e){return function(e,t={}){const i=Number(e[0]),n=Number(e[1]),o=Number(e[2]),r=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const a=[i,n];return ie([[a,[o,n],[o,r],[i,r],a]],t.properties,{bbox:e,id:t.id})}(we(e))}function Ve(e,t,i,n,o={}){const r=o.steps||64,a=$e(i),s=$e(n),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(a===s)return ne(function(e,t,i={}){const n=i.steps||64,o=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},r=[];for(let o=0;o<n;o++)r.push(pe(e,t,-360*o/n,i).geometry.coordinates);return r.push(r[0]),ie([r],o)}(e,t,o).geometry.coordinates[0],l);const c=a,d=a<s?s:s+360;let p=c;const h=[];let u=0;const m=(d-c)/r;for(;p<=d;)h.push(pe(e,t,p,o).geometry.coordinates),u++,p=c+u*m;return ne(h,l)}function $e(e){let t=e%360;return t<0&&(t+=360),t}function He(e,t){const i=[];return function(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}(e,function(e){let n=!1;if("Point"===e.geometry.type)me(t,function(t){Fe(e,t)&&(n=!0)}),n&&i.push(e);else{if("MultiPoint"!==e.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var o=[];me(t,function(t){ue(e,function(e){Fe(e,t)&&(n=!0,o.push(e))})}),n&&i.push(function(e,t,i={}){return ee({type:"MultiPoint",coordinates:e},t,i)}(o,e.properties))}}),oe(i)}const We=(t,i)=>{const n=e.Cartographic.fromCartesian(t),o=e.Cartographic.fromCartesian(i),r=new e.EllipsoidGeodesic;r.setEndPoints(n,o);let a=r.surfaceDistance;return a=Math.sqrt(a**2+(o.height-n.height)**2),a};function qe(e){let t=0;return e.forEach((i,n)=>{if(n===e.length-1)return;const o=We(i,e[n+1]);t+=o}),t}function je(t,i,n){const{EllipsoidGeodesic:o,Ellipsoid:r}=e;return new o((n=n||r.WGS84).cartesianToCartographic(t),n.cartesianToCartographic(i)).surfaceDistance}function Ze(e){let t=0;return e.forEach((i,n)=>{if(n===e.length-1)return;const o=je(i,e[n+1]);t+=o}),t}const Ye=t=>{if(t.length<4)return e.BoundingSphere.fromPoints(t).center;const i=ie([t.map(e=>[e.x,e.y])]),n=e.BoundingSphere.fromPoints(t).center,o=Ge(i);return new e.Cartesian3(o.geometry.coordinates[0],o.geometry.coordinates[1],n.z)};function Je(t){let i=0;const{CoplanarPolygonGeometry:n,VertexFormat:o,defined:r,Cartesian3:a}=e,s=n.createGeometry(n.fromPositions({positions:t,vertexFormat:o.POSITION_ONLY}));if(r(s)){const e=s.indices,t=s.attributes.position.values;for(let n=0;n<e.length;n+=3){const o=e[n],r=e[n+1],s=e[n+2];i+=Ke(a.unpack(t,3*o,{}),a.unpack(t,3*r,{}),a.unpack(t,3*s,{}))}}return i}const Ke=(t,i,n)=>{const{Cartesian3:o}=e,r=o.subtract(t,i,{}),a=o.subtract(n,i,{}),s=o.cross(r,a,r);return.5*o.magnitude(s)},Xe=async(t,i)=>{const n=i.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,n)},Qe=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),et=(t,i,n,o)=>{const r=[],a=e.Cartographic.fromCartesian(t),s=e.Cartographic.fromCartesian(i),l=180*a.longitude/Math.PI,c=180*a.latitude/Math.PI,d=180*s.longitude/Math.PI,p=180*s.latitude/Math.PI,h=Math.sqrt((l-d)*(l-d)+(c-p)*(c-p))*n,u=e.Cartesian3.clone(t),m=e.Cartesian3.clone(i),g=e.Cartesian3.distance(u,e.Cartesian3.ZERO),f=e.Cartesian3.distance(m,e.Cartesian3.ZERO);if(e.Cartesian3.normalize(u,u),e.Cartesian3.normalize(m,m),!e.Cartesian3.distance(u,m))return r;const v=e.Cartesian3.angleBetween(u,m);r.push(t);for(let t=1;t<o-1;t++){const i=1*t/(o-1),n=1-i,a=Math.sin(n*v)/Math.sin(v),s=Math.sin(i*v)/Math.sin(v),l=e.Cartesian3.multiplyByScalar(u,a,new e.Cartesian3),c=e.Cartesian3.multiplyByScalar(m,s,new e.Cartesian3);let d=e.Cartesian3.add(l,c,new e.Cartesian3);const p=i*Math.PI,y=g*n+f*i+Math.sin(p)*h;d=e.Cartesian3.multiplyByScalar(d,y,d),r.push(d)}return r.push(i),r},tt=e=>{const t=e.positionCartographic.height,i=-40467.74;return Math.round(i+80955.31/(1+(t/91610.74)**7096758e-11))},it=e=>e,nt=(t,i)=>{const n=[];let o=0,r=0,a=0;const s=[];for(let i=0;i<t.length-1;++i)o+=e.Cartesian3.distance(t[i],t[i+1]);for(let i=0;i<t.length;i++)0===i?r=0:(a+=e.Cartesian3.distance(t[i-1],t[i]),r=a/o),n.push(r);const l=new e.LinearSpline({times:n,points:t});for(let e=0;e<=i;e++){const t=l.evaluate(e/i);s.push(t)}return s},ot=t=>{const i=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,i),i};class rt{_primitive;_promise;appearance;geometryInstance;drawCommand;shapePositions;needUpdate=!1;constructor(){this._primitive=void 0,this.appearance=void 0,this.geometryInstance=void 0,this._promise=null,this.drawCommand=null,this.needUpdate=!1,this.shapePositions=[]}update(e){const t=this.getPrimitive();if(t){this._primitive=t;this._primitive.update(e)}}then(e=null){return this._promise?.then(e)}catch(e=null){return this._promise?.catch(e)}isDestroyed(){return!!this._primitive}destroy(){this._primitive=void 0}setShapePositions(e){this.shapePositions=e}}class at{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const st=e.BoxGeometry,lt=e.Cartesian3,ct=e.defaultValue,dt=e.defined,pt=e.destroyObject,ht=e.DeveloperError,ut=e.GeometryPipeline,mt=e.Matrix3,gt=e.Matrix4,ft=e.Transforms,vt=e.VertexFormat,yt=e.BufferUsage,Ct=e.CubeMap,wt=e.DrawCommand,bt=e.loadCubeMap,Pt=e.RenderState,_t=e.VertexArray,xt=e.BlendingState,Mt=e.SceneMode,Et=e.ShaderProgram,Dt=e.ShaderSource,At=new mt;class St{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=ct(t.show,!0),this._command=new wt({modelMatrix:gt.clone(gt.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}update(e,t){const i=this;if(!this.show)return;if(e.mode!==Mt.SCENE3D&&e.mode!==Mt.MORPHING)return;if(!e.passes.render)return;const n=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(dt(e.positiveX)&&dt(e.negativeX)&&dt(e.positiveY)&&dt(e.negativeY)&&dt(e.positiveZ)&&dt(e.negativeZ)))throw new ht("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new ht("this.sources properties must all be the same type.");"string"==typeof e.positiveX?bt(n,this._sources).then(e=>{i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Ct({context:n,source:e}))}const o=this._command;if(o.modelMatrix=ft.eastNorthUpToFixedFrame(e.camera._positionWC),!dt(o.vertexArray)){o.uniformMap={u_cubeMap:()=>i._cubeMap,u_rotateMatrix:()=>gt.getRotation(o.modelMatrix,At)};const e=st.createGeometry(st.fromDimensions({dimensions:new lt(2,2,2),vertexFormat:vt.POSITION_ONLY})),t=this._attributeLocations=ut.createAttributeLocations(e);o.vertexArray=_t.fromGeometry({context:n,geometry:e,attributeLocations:t,bufferUsage:yt._DRAW}),o.renderState=Pt.fromCache({blending:xt.ALPHA_BLEND})}if(!dt(o.shaderProgram)||this._useHdr!==t){const e=new Dt({defines:[t?"HDR":""],sources:["precision highp float;\n\nuniform samplerCube u_cubeMap;\nin vec3 v_texCoord;\nout vec4 fragColor;\n\nvoid main() {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n fragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}"]});o.shaderProgram=Et.fromCache({context:n,vertexShaderSource:"#version 300 es\n\nprecision highp float;\n\nin vec3 position;\nout vec3 v_texCoord;\n\nuniform mat3 u_rotateMatrix;\n\nvoid main() {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return dt(this._cubeMap)?o:void 0}isDestroyed(){return!1}destroy(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),pt(this)}}const It=t=>{const{viewer:i,sources:n}=t;return i.scene.skyBox=new e.SkyBox({sources:n}),i.scene.skyBox},Tt=t=>{let{viewer:i,sources:n}=t;const o=t.height?t.height:225705,r=i.scene.skyBox,a=i.scene.skyAtmosphere.show;n||(n={positiveX:`${G()}/assets/ground-skybox/px.jpg`,negativeX:`${G()}/assets/ground-skybox/nx.jpg`,positiveY:`${G()}/assets/ground-skybox/py.jpg`,negativeY:`${G()}/assets/ground-skybox/ny.jpg`,positiveZ:`${G()}/assets/ground-skybox/pz.jpg`,negativeZ:`${G()}/assets/ground-skybox/nz.jpg`});const s=new St({sources:n});i.scene.postRender.addEventListener(()=>{const t=i.camera.position;e.Cartographic.fromCartesian(t).height<o?(i.scene.skyBox=s,i.scene.skyAtmosphere.show=!1):(i.scene.skyBox=r,i.scene.skyAtmosphere.show=a)})},zt=t=>{const i=[];let n,o;t.clock.shouldAnimate=!0;const r={},a=(e,i)=>{if(s(),e.entity.cylinder){const i=e.entity.cylinder;i.roamId=e.id,e.entity.cylinder=void 0,o=t.entities.add({position:e.property,cylinder:i})}t.trackedEntity=e.entity,i&&(n=e)},s=()=>{if(o){t.entities.remove(o);const e=i.find(e=>e.id===o.cylinder.roamId);e&&(e.entity.cylinder=o.cylinder),o=void 0}},l=()=>{t.trackedEntity=void 0,n=void 0,s()},c=e=>{t.trackedEntity?.id===e.entity.id&&l(),t.entities.remove(e.entity);const n=i.findIndex(t=>t.id===e.id);n>-1&&i.splice(n,1)},d=(e,t)=>{const i=e.property.getValue(t);if(i&&(e.status="ROAMING",m.roaming&&m.roaming(e,{time:t,position:i})),e.stopTime.secondsOfDay<t.secondsOfDay&&"END"!==e.status&&(e.status="END",m.end&&m.end(e),e.loop?p(e):l()),e.flyParams.hpr){const n=r[e.id].find(e=>e.time>t.secondsOfDay);n&&u(e,n,i)}},p=i=>{const{property:n,startTime:o,stopTime:r}=h(i);i.stopTime=r,i.startTime=o,i.property=n,i.flyParams.hpr||(i.entity.orientation=new e.VelocityOrientationProperty(n)),i.entity.position=n,i.status="START",t.clock.currentTime=o,t.clock.multiplier=1,m.reStart&&m.reStart(i)},h=t=>{const i=[],{positions:n,flyParams:o}=t,a=new e.SampledPositionProperty;let s=0;const l=e.JulianDate.now();let c=l.clone();return n.forEach((t,r)=>{let d=e.JulianDate.now();if(r){let i=0;if(o.speed){i=e.Cartesian3.distance(t,n[r-1])/(1e3*o.speed/3600)}o.times&&(i=(o.times[r]-o.times[r-1])/1e3),s+=i,d=e.JulianDate.addSeconds(l,s,new e.JulianDate)}else d=l;c=d,a.addSample(d,t),o.hpr&&i.push({time:d.secondsOfDay,heading:o.hpr[r].heading,pitch:o.hpr[r].pitch,roll:o.hpr[r].roll})}),r[t.id]=i,{property:a,startTime:l,stopTime:c}},u=(t,i,n)=>{if(!n)return;const{heading:o,pitch:r,roll:a}=i,s=new e.HeadingPitchRoll(o,r,a);t.entity.orientation=Transforms.headingPitchRollQuaternion(n,s)};t.scene.preRender.addEventListener((o,r)=>{if(i.forEach(e=>{d(e,r)}),!n)return;const a=n.entity.computeModelMatrix(t.clock.currentTime);a&&t.camera.lookAtTransform(a,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:n=>{const{entity:o}=n;n.id=N(),t.entities.add(o);const{property:r,startTime:a,stopTime:s}=h(n);n.flyParams.hpr||(o.orientation=new e.VelocityOrientationProperty(r)),o.position=r;const l={...n,startTime:a,stopTime:s,property:r,status:"START"};return t.clock.currentTime=a,t.clock.multiplier=1,i.push(l),l.status="START",m.start&&m.start(l),l},tracked:a,stopTracked:l,remove:c,frameRoam:d,trackedByEntityId:(e,t)=>{const n=i.find(t=>t.entity.id===e);n&&a(n,t)},removeAll:()=>{i.forEach(e=>{c(e)}),i.length=0},Event:m,lockCameraView:e=>{n=e},updateRoamAttitude:(t,i)=>{"UP"!==i&&"DOWN"!==i||(t.entity.orientation=void 0),"front"!==i&&"back"!==i||(t.entity.orientation=new e.VelocityOrientationProperty(t.property))}}};var Ft=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))(Ft||{}),Rt=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(Rt||{});let Ot=100,Lt="",Bt="0";const kt=t=>{const{viewer:i}=t,n=document.createElement("div");n.className="bottom-status-bar";const o=document.createElement("div");o.className="scale-bar",o.innerHTML="";const r=document.createElement("div");r.className="scale-label",r.innerHTML="",o.appendChild(r),n.appendChild(o);const a=document.createElement("div");a.id="bottom-status-bar-camera",t.clickCopy&&(a.style.pointerEvents="auto",a.style.cursor="pointer"),n.appendChild(a),a.style.display="flex";const s=document.createElement("div"),l=document.createElement("div"),c=i._element.getElementsByClassName("cesium-widget")[0];if(!c)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");c.appendChild(n),L(i,{MOVE_POSITION(e){a.innerHTML=`\n 经度:${e.lnglat.lng.toFixed(6)} \n 纬度:${e.lnglat.lat.toFixed(6)} \n 高程:${e.lnglat.height.toFixed(2)} \n `,t.clickCopy&&_(i),a.appendChild(l),a.appendChild(s)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),p=0;const h=()=>{requestAnimationFrame(()=>{if(p+=1,p>=30){const e=Date.now(),t=e-d,i=Math.round(1e3/(t/p));d=e,p=0,s.innerHTML=`${i} FPS`}t.hpr?l.innerHTML=`\n 方位角:${e.Math.toDegrees(i.camera.heading).toFixed(1)}° \n 俯仰角:${e.Math.toDegrees(i.camera.pitch).toFixed(1)}° \n 翻滚角:${e.Math.toDegrees(i.camera.roll).toFixed(1)}° \n `:l.innerHTML="",l.innerHTML+=`\n 视高:${i.camera.positionCartographic.height.toFixed(0)}m \n `;const n=Nt(i);r.innerHTML=`${n.distanceLabel}`,h()})};h()},Nt=t=>{const i=t.camera.positionCartographic.height.toFixed(0);if(i===Bt)return{barWidth:Ot,distanceLabel:Lt};Bt=i;const n=new e.EllipsoidGeodesic,o=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],r=t.scene,a=r.canvas.clientWidth,s=r.canvas.clientHeight,l=r.camera.getPickRay(new e.Cartesian2(a/2|0,s-1)),c=r.camera.getPickRay(new e.Cartesian2(1+a/2|0,s-1)),d=r.globe,p=d.pick(l,r),h=d.pick(c,r);if(!e.defined(p)||!e.defined(h))return{barWidth:Ot,distanceLabel:Lt};const u=d.ellipsoid.cartesianToCartographic(p),m=d.ellipsoid.cartesianToCartographic(h);n.setEndPoints(u,m);const g=n.surfaceDistance;let f;for(let t=o.length-1;!e.defined(f)&&t>=0;--t)o[t]/g<100&&(f=o[t]);if(e.defined(f)){const e=f>=1e3?`${(f/1e3).toString()} km`:`${f.toString()} m`;Ot=f/g|0,Lt=e}else Ot=0,Lt="1 m";return{barWidth:Ot,distanceLabel:Lt}},Gt=t=>new Promise(i=>{const{viewer:n,center:o}=t;let r=o.lng,a=1,s=null;const l=t=>{null===s&&(s=t);r-=(t-s)/2e4*2,r<-180&&(r=180,a+=1),2===a&&r>o.lng?n.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{n.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,o.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{i(!0)}})}}):(n.camera.setView({destination:e.Cartesian3.fromDegrees(r,o.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(l))};requestAnimationFrame(l)}),Ut=(t,i,n)=>{const o=new Float64Array(24);for(let e=0;e<8;e++)o[3*e]=t[e].x,o[3*e+1]=t[e].y,o[3*e+2]=t[e].z;const r=new Uint16Array([0,1,2,0,2,3,4,6,5,4,7,6,0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4]),a={position:new e.GeometryAttribute({componentDatatype:e.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:o})},s=new e.Geometry({indices:r,attributes:a,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(o)});return new e.GeometryInstance({geometry:s,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${n}`})},Vt=(t,i,n)=>{const[o,r,a,s,l,c,d,p]=t,h=[o,r,r,a,a,s,s,o,l,c,c,d,d,p,p,l,o,l,l,c,c,r,r,o,s,p,p,d,d,a,a,s,o,s,s,p,p,l,l,o,r,c,c,d,d,a,a,r];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:h,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${n}`})},$t=(t,i)=>[e.Cartesian3.fromDegrees(t.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,t.height)],Ht=(t,i,n,o,r,a)=>[e.Cartesian3.fromDegrees(t,t,r),e.Cartesian3.fromDegrees(i,i,r),e.Cartesian3.fromDegrees(n,n,r),e.Cartesian3.fromDegrees(o,o,r),e.Cartesian3.fromDegrees(t,t,a),e.Cartesian3.fromDegrees(i,i,a),e.Cartesian3.fromDegrees(n,n,a),e.Cartesian3.fromDegrees(o,o,a)],Wt=3e3*Math.PI/180,qt=Math.PI,jt=6378245,Zt=.006693421622965943,Yt=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),Jt=(e,t)=>{let i=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*qt)+20*Math.sin(2*e*qt))/3,i+=2*(20*Math.sin(t*qt)+40*Math.sin(t/3*qt))/3,i+=2*(160*Math.sin(t/12*qt)+320*Math.sin(t*qt/30))/3,i},Kt=(e,t)=>{let i=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*qt)+20*Math.sin(2*e*qt))/3,i+=2*(20*Math.sin(e*qt)+40*Math.sin(e/3*qt))/3,i+=2*(150*Math.sin(e/12*qt)+300*Math.sin(e/30*qt))/3,i},Xt=(e,t)=>{if(Yt(e,t))return[e,t];let i=Jt(e-105,t-35),n=Kt(e-105,t-35);const o=t/180*qt;let r=Math.sin(o);r=1-Zt*r*r;const a=Math.sqrt(r);i=180*i/(jt*(1-Zt)/(r*a)*qt),n=180*n/(jt/a*Math.cos(o)*qt);return[e+n,t+i]},Qt=(e,t)=>{if(Yt(e,t))return[e,t];let i=Jt(e-105,t-35),n=Kt(e-105,t-35);const o=t/180*qt;let r=Math.sin(o);r=1-Zt*r*r;const a=Math.sqrt(r);i=180*i/(jt*(1-Zt)/(r*a)*qt),n=180*n/(jt/a*Math.cos(o)*qt);return[2*e-(e+n),2*t-(t+i)]},ei=(e,t)=>{const i=e,n=t,o=Math.sqrt(i*i+n*n)+2e-5*Math.sin(n*Wt),r=Math.atan2(n,i)+3e-6*Math.cos(i*Wt);return[o*Math.cos(r)+.0065,o*Math.sin(r)+.006]},ti=(e,t)=>{const i=e-.0065,n=t-.006,o=Math.sqrt(i*i+n*n)-2e-5*Math.sin(n*Wt),r=Math.atan2(n,i)-3e-6*Math.cos(i*Wt);return[o*Math.cos(r),o*Math.sin(r)]};class ii{static wgs84ToGcj02(e){const[t,i]=Xt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToWgs84(e){const[t,i]=Qt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToBd09(e){const[t,i]=ei(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToGcj02(e){const[t,i]=ti(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToWgs84(e){const[t,i]=((e,t)=>{const[i,n]=ti(e,t);return Qt(i,n)})(e.lng,e.lat);return{lng:t,lat:i}}static wgs84ToBd09(e){const[t,i]=((e,t)=>{const[i,n]=Xt(e,t);return ei(i,n)})(e.lng,e.lat);return{lng:t,lat:i}}}const ni=t=>{const{viewer:i,token:n}=t,o=t.vec?"vec":"img",r=[],a=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/${o}_w/wmts?tk=${n}`,layer:o,style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));if(r.push(a),t.label){const t=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/cia_w/wmts?tk=${n}`,layer:"cia",style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));r.push(t)}return{layers:r,remove:()=>{r.forEach(e=>{i.imageryLayers.remove(e)})},setOpacity:e=>{r.forEach(t=>{t.alpha=e})}}};function oi(t,i){i||(i={}),console.log(i.filterColor);const n=t.imageryLayers.get(0);if(!n)return;n.brightness=i.brightness??.6,n.contrast=i.contrast??1.8,n.gamma=i.gamma??.3,n.hue=i.hue??1,n.saturation=i.saturation||0;const o=t.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<o.length;t++){const n="color = czm_saturation(color, textureSaturation);\n#endif\n";let r="color = czm_saturation(color, textureSaturation);\n#endif\n";i.invertColor||(r+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n "),i.filterColor||(i.filterColor=e.Color.fromCssColorString("rgba(100,138,230,0.5)")),r+=`\n color.r = color.r * ${i.filterColor.red.toFixed(2)};\n color.g = color.g * ${i.filterColor.green.toFixed(2)};\n color.b = color.b * ${i.filterColor.blue.toFixed(2)};\n // color.a = color.a * ${i.filterColor.alpha.toFixed(2)};\n `,o[t]=o[t].replace(n,r)}t.scene.requestRender()}const ri={cacheBytes:4294967296,maximumCacheOverflowBytes:5368709120},ai=async t=>{const{viewer:i,url:n,options:o}=t,r=await e.Cesium3DTileset.fromUrl(n,{...ri,...o});i.scene.primitives.add(r);return{tileset:r,setHeightOffset:e=>{si(r,e)},remove:()=>{i.scene.primitives.remove(r)},flyTo:()=>{i.flyTo(r)}}},si=(t,i)=>{di(t,e.Cartesian3.fromElements(0,0,i,new e.Cartesian3))},li=async e=>{const t=[];function i(e){if(console.log(e),!e.content||!e.content.featuresLength)return;const n=e.content;for(let e=0;e<n.featuresLength;e++)t.push(n.getFeature(e));e.children?.forEach(i)}return new Promise(n=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),n(t)})})},ci=e=>{const t=[];function i(e){t.push(e),e.children?.forEach(i)}return new Promise(n=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),n(t)})})},di=(t,i)=>{if(i.equals(e.Cartesian3.ZERO))return;const n=t.boundingSphere.center,o=e.Transforms.eastNorthUpToFixedFrame(n),r=e.Matrix4.multiplyByPoint(o,i,new e.Cartesian3),a=e.Cartesian3.subtract(r,n,new e.Cartesian3),s=e.Matrix4.fromTranslation(a);t.modelMatrix=e.Matrix4.multiply(s,t.modelMatrix,new e.Matrix4)},pi={translate:di,scale:(t,i)=>{if(i.equals(e.Cartesian3.ZERO)||i.equals(e.Cartesian3.ONE))return;const n=t.boundingSphere.center,o=e.Transforms.eastNorthUpToFixedFrame(n),r=e.Matrix4.inverse(o,new e.Matrix4),a=e.Matrix4.fromScale(i),s=e.Matrix4.multiply(a,r,new e.Matrix4),l=e.Matrix4.multiply(o,s,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(l,t.modelMatrix,new e.Matrix4)},rotate:(t,i)=>{const{x:n,y:o,z:r}=i,a=t.boundingSphere.center,s=e.Transforms.eastNorthUpToFixedFrame(a),l=e.Matrix4.inverse(s,new e.Matrix4),c=e.Matrix4.clone(e.Matrix4.IDENTITY);if(0!==n){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationX(e.Math.toRadians(n)));e.Matrix4.multiply(t,c,c)}if(0!==o){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationY(e.Math.toRadians(o)));e.Matrix4.multiply(t,c,c)}if(0!==r){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationZ(e.Math.toRadians(r)));e.Matrix4.multiply(t,c,c)}const d=e.Matrix4.multiply(c,l,new e.Matrix4),p=e.Matrix4.multiply(s,d,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(p,t.modelMatrix,new e.Matrix4)}},hi=async t=>{const{viewer:i,url:n}=t,o=await e.CesiumTerrainProvider.fromUrl(n,{requestWaterMask:!0,requestVertexNormals:!0});i.scene.terrainProvider=o;return{terrainProvider:o,remove:()=>{i.scene.terrainProvider=new e.EllipsoidTerrainProvider}}},ui=t=>{t.scene.terrainProvider=new e.EllipsoidTerrainProvider},mi=async()=>await e.CesiumTerrainProvider.fromIonAssetId(1,{requestWaterMask:!0,requestVertexNormals:!0}),gi=()=>{},fi=()=>{},vi=async t=>{const{viewer:i,url:n,options:o}=t,r=await e.I3SDataProvider.fromUrl(n,o);i.scene.primitives.add(r);return{i3sProvider:r,setHeightOffset:e=>{r.layers.forEach(t=>{const i=t.tileset;i&&si(i,e)})},remove:()=>{i.scene.primitives.remove(r)},flyTo:t=>{const n=e.Rectangle.center(r.extent);n.height=t;let o=r.data;e.defined(o.layers)&&o.layers.length>0&&(o=o.layers[0]),e.defined(o.fullExtent)&&e.defined(o.fullExtent.zmax)&&(n.height+=o.fullExtent.zmax);const a=e.Ellipsoid.WGS84.cartographicToCartesian(n);i.camera.flyTo({destination:a,orientation:{}})}}},yi=(t,i=e.Color.YELLOW)=>{const n=t.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 highlight;\n void main() {\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (czm_selected()) {\n vec3 highlighted = highlight.a * highlight.rgb + (1.0 - highlight.a) * color.rgb;\n out_FragColor = mix(color, vec4(highlighted,0.5), 0.3);\n } else {\n out_FragColor = color;\n }\n }\n ",uniforms:{highlight:()=>i}}));n.selected=[];return{stage:n,remove:()=>{t.scene.postProcessStages.remove(n)}}},Ci=t=>{const i=e.PostProcessStageLibrary.createEdgeDetectionStage(),n=new e.PostProcessStage({name:"skyline",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n void main() { float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (depth < 1.0 - 0.000001) {\n out_FragColor = color;\n } else {\n out_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n }\n }"}),o=new e.PostProcessStage({name:"mix",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D redTexture;\n uniform sampler2D silhouetteTexture;\n in vec2 v_textureCoordinates;\n\n void main() {\n vec4 redColor = texture(redTexture, v_textureCoordinates);\n vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (redColor.r == 1.0) {\n out_FragColor = mix(color, vec4(5.0, 0.0, 0.0, 1.0), silhouetteColor.a);\n } else {\n out_FragColor = color;\n }\n }",uniforms:{redTexture:n.name,silhouetteTexture:i.name}}),r=new e.PostProcessStageComposite({stages:[i,n,o],inputPreviousStageTexture:!1,uniforms:i.uniforms});t.scene.postProcessStages.add(r);return{stage:r,remove:()=>{t.scene.postProcessStages.remove(r)}}},wi=(t,i=e.Color.YELLOW)=>{const n=t.scene.postProcessStages,o=e.PostProcessStageLibrary.createEdgeDetectionStage();o.uniforms.color=i,o.uniforms.length=1,o.selected=[];const r=e.PostProcessStageLibrary.createEdgeDetectionStage();r.uniforms.color=i,r.selected=[];const a=n.add(e.PostProcessStageLibrary.createSilhouetteStage([o,r]));a.selected=[];return{stage:a,remove:()=>{t.scene.postProcessStages.remove(a)}}},bi=t=>{const i=t.viewer,n=new e.PostProcessStage({name:"SnowEffectCover",fragmentShader:"\n vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth)\n {\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\n return eyeCoordinate.xyz / eyeCoordinate.w;\n }\n vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset, sampler2D depthMap) {\n vec2 glFragCoordXY = gl_FragCoord.xy;\n float upOrRightLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\n float downOrLeftLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\n bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\n\n float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\n float useDownOrLeft = float(useUpOrRight == 0.0);\n vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\n vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\n return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n }\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float intensity;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n\n float logDepthOrDepth = czm_unpackDepth(texture(depthTexture, v_textureCoordinates));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0), depthTexture);\n vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0), depthTexture);\n vec3 normalEC = normalize(cross(leftRight, downUp));\n vec3 normalMC = normalize((czm_inverseView * vec4(normalEC, 0.0)).xyz);\n vec3 ellipsoidNormal = normalize(worldCoordinate);\n float dotProd = dot(ellipsoidNormal, normalMC);\n if(dotProd < 0.3){\n out_FragColor = sceneColor;\n } else {\n out_FragColor = mix(sceneColor, vec4(1.0), dotProd * intensity);\n }\n if (czm_selected()) {\n out_FragColor = sceneColor;\n }\n }\n ",forcePowerOfTwo:!1,textureScale:1,uniforms:{intensity:()=>t.intensity||.8}});i.scene.postProcessStages.add(n);return n.selected=[],{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},Pi=t=>{const i=t.viewer,n=i.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture; //输入的场景渲染照片\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float scale;\n\n float snow(vec2 uv, float thisScale) {\n float time = czm_frameNumber * speed / 1000.0;\n float wMars3D = smoothstep(1.0, 0.0, -uv.y * (thisScale / 10.0));\n if(wMars3D < 0.1)\n return 0.0;\n uv += time / thisScale;\n uv.y += time * 2.0 / thisScale;\n uv.x += sin(uv.y + time * 0.5) / thisScale;\n uv *= thisScale;\n\n vec2 s = floor(uv), f = fract(uv), p;\n float k = 3.0, d;\n p = 0.5 + 0.35 * sin(11.0 * fract(sin((s + p + thisScale) * mat2(7, 3, 6, 5)) * 5.0)) - f;\n d = length(p);\n k = min(d, k);\n k = smoothstep(0.0, k, sin(f.x + f.y) * 0.01);\n return k * wMars3D;\n }\n void main(void) {\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n\n float c = 0.0;\n float step = 1.0/(scale*0.1);\n for(float i = 1.0; i < 12.0; i += 1.0) {\n c += snow(uv, i*step);\n }\n vec3 finalColor = vec3(c); //屏幕上雪的颜色\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雪和三维场景融合\n }",uniforms:{scale:()=>t.scale||5,speed:()=>t.speed||16}}));n.selected=[];return{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},_i=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float alpha;\n uniform float height;\n uniform vec3 oneOverRadii;\n uniform vec3 oneOverRadiiSquared;\n uniform float centerToleranceSquared;\n uniform float EPSILON12;\n uniform float earthRadius;\n\n in vec2 v_textureCoordinates;\n out vec4 glColor;\n\n vec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n }\n float getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n }\n\n\n vec3 getWorldCoordinateFromDepth(in vec4 currD){\n float depth = czm_unpackDepth(currD);\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n return worldCoordinate;\n }\n\n float magnitude(in vec3 v){\n return sqrt(v.x * v.x + v.y * v.y + v.z * v.z);\n }\n\n // 沿大地表面法线缩放提供的笛卡尔位置,使其位于该椭球体的表面上\n vec3 scaleToGeodeticSurface(in vec3 cartesian){\n float positionX = cartesian.x;\n float positionY = cartesian.y;\n float positionZ = cartesian.z;\n float x2 = cartesian.x * cartesian.x * oneOverRadii.x * oneOverRadii.x;\n float y2 = cartesian.y * cartesian.y * oneOverRadii.y * oneOverRadii.y;\n float z2 = cartesian.z * cartesian.z * oneOverRadii.z * oneOverRadii.z;\n\n float squaredNorm = x2 + y2 + z2;\n float ratio = sqrt(1.0 / squaredNorm);\n vec3 intersection = cartesian * ratio;\n\n float oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n float oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n float oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n vec3 gradient = vec3(intersection.x * oneOverRadiiSquaredX * 2.0,intersection.y * oneOverRadiiSquaredY * 2.0,intersection.z * oneOverRadiiSquaredZ * 2.0);\n\n float lambda = ((1.0 - ratio) * magnitude(cartesian) ) / (0.5 * magnitude(gradient));\n float correction = 0.0;\n float func = 0.0;\n float denominator = 0.0;\n float xMultiplier = 0.0;\n float yMultiplier = 0.0;\n float zMultiplier = 0.0;\n float xMultiplier2 = 0.0;\n float yMultiplier2 = 0.0;\n float zMultiplier2 = 0.0;\n float xMultiplier3 = 0.0;\n float yMultiplier3 = 0.0;\n float zMultiplier3 = 0.0;\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n xMultiplier2 = xMultiplier * xMultiplier;\n yMultiplier2 = yMultiplier * yMultiplier;\n zMultiplier2 = zMultiplier * zMultiplier;\n\n xMultiplier3 = xMultiplier2 * xMultiplier;\n yMultiplier3 = yMultiplier2 * yMultiplier;\n zMultiplier3 = zMultiplier2 * zMultiplier;\n\n float func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n float denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n float derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (abs(func) > EPSILON12);\n return vec3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);\n }\n\n vec3 multiplyComponents(in vec3 left,in vec3 right){\n return vec3(left.x * right.x, left.y * right.y, left.z * right.z);\n }\n\n\n // 将世界坐标转为经纬度高度\n vec3 getCartographicFromCartesian3(in vec3 cartesian){\n vec3 p = scaleToGeodeticSurface(cartesian);\n vec3 n = multiplyComponents(p,oneOverRadiiSquared);\n n = normalize(n);\n vec3 h = cartesian - p;\n\n float longitude = atan(n.y, n.x);\n float latitude = asin(n.z);\n float height = sign(dot(h, cartesian)) * magnitude(h);\n\n return vec3(longitude,latitude,height);\n }\n\n // 计算每个像素点的高度 通过计算相机所在位置的地球半径作为每个点的地球半径,然后用每个点的length减去半径得到近似的高度\n float getHeight(in vec4 currD){\n // 传入每个点的世界坐标\n float altitude = 0.0;\n float depth = czm_unpackDepth(currD);\n if (depth == 0.0) {\n altitude = czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n float distance = -eyeCoordinate.z / eyeCoordinate.w;\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n altitude = length(worldCoordinate.xyz) - earthRadius;\n return altitude;\n }\n\n void main(){\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n glColor = color;\n return;\n }\n // 此方法有问题 会闪烁\n float depth = getDepth(currD);\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec4 positionWC = czm_inverseView * positionEC;\n // 获取当前点的高度\n // vec3 positionWC = getWorldCoordinateFromDepth(currD);\n vec3 cartographic = getCartographicFromCartesian3(vec3(positionWC.x,positionWC.y,positionWC.z));\n // 高度加了10之后 就不闪烁了\n float pointHeight = cartographic.z + 10.;\n // 当前点高度越高,雾浓度越小,高度达到设定高度,雾浓度为0,同时乘以深度,距离越远,浓度越大\n float fog = (height/pointHeight - 1.);\n fog = clamp(fog, 0.0, 1.0);\n glColor = mix(color,vec4(1.0,1.,1.,1),fog*alpha);\n }",uniforms:{EPSILON12:()=>t.EPSILON12||1e-12,alpha:()=>t.alpha||.88,centerToleranceSquared:()=>t.centerToleranceSquared||.1,height:()=>t.height||100,oneOverRadii:()=>t.oneOverRadii||{x:1.567855942887398e-7,y:1.567855942887398e-7,z:1.573130351105623e-7},oneOverRadiiSquared:()=>t.oneOverRadiiSquared||{x:2458172257647332e-29,y:2458172257647332e-29,z:24747391015697002e-30}}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},xi=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\nfloat getDistance(sampler2D depthTexture, vec2 texCoords) {\n float depth = czm_unpackDepth(texture(depthTexture, texCoords));\n if(depth == 0.0) {\n return czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n return -eyeCoordinate.z / eyeCoordinate.w;\n}\nfloat interpolateByDistanceMars3D(vec4 nearFarScalar, float distance) {\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) {\n return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform vec4 fogByDistance;\nuniform vec4 fogColor;\nin vec2 v_textureCoordinates;\nvoid main(void) {\n float distance = getDistance(depthTexture, v_textureCoordinates);\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n float blendAmount = interpolateByDistanceMars3D(fogByDistance, distance);\n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);\n out_FragColor = alphaBlend(finalFogColor, sceneColor);\n}\n ",uniforms:{fogColor:()=>t.fogColor||e.Color.WHITE,fogByDistance:()=>t.fogByDistance||new e.Cartesian4(100,0,9e3,.9)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Mi=t=>{const i=new e.PostProcessStageComposite({name:"undefinedcontrast_bias_blur",stages:[new e.PostProcessStage({name:"undefinedcontrast_bias",fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float contrast;\n uniform float brightness;\n void main(void)\n {\n vec4 texture1 = texture(colorTexture, v_textureCoordinates);\n vec3 sceneColor = texture1.rgb;\n\n sceneColor = czm_RGBToHSB(sceneColor);\n sceneColor.z += brightness;\n sceneColor = czm_HSBToRGB(sceneColor);\n float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\n sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\n out_FragColor = vec4(sceneColor, texture1.a);\n }\n ",uniforms:{contrast:()=>128,brightness:()=>-.3}}),new e.PostProcessStageComposite({name:"undefined_blur_comp",stages:[new e.PostProcessStage({name:"undefinedhigh",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform float threshold;\n uniform float smoothWidth;\n\n in vec2 v_textureCoordinates;\n void main() {\n vec4 marstexel = texture( colorTexture, v_textureCoordinates );\n\n #ifdef CZM_SELECTED_FEATURE\n if (!czm_selected()) {\n marstexel = vec4(0.);\n }\n #endif\n\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float marsv = dot( marstexel.xyz, luma );\n float alpha = smoothstep(threshold, threshold + smoothWidth, marsv);\n\n vec4 outputColor = vec4(0.0,0.0,0.0,0.0);\n out_FragColor = mix( outputColor, marstexel, alpha );\n }\n ",uniforms:{threshold:()=>0,smoothWidth:()=>.01}})]})]}),n=t.scene.postProcessStages.add(new e.PostProcessStageComposite({name:"bloom_target",inputPreviousStageTexture:!1,stages:[i,new e.PostProcessStage({name:"undefinedgenerate_composite",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D bloomTexture;\n uniform float ratio;\n uniform vec4 color;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 color1 = texture(colorTexture, v_textureCoordinates);\n vec4 bloom = texture(bloomTexture, v_textureCoordinates);\n bloom *= color;\n if (czm_selected()) {\n bloom *= ratio;\n out_FragColor = bloom + color1;\n } else {\n out_FragColor = color1;\n }\n }\n ",uniforms:{bloomTexture:()=>"undefinedcontrast_bias_blur",color:()=>e.Color.GREEN,ratio:()=>2}})]}));n.enabled=!1;return n.selected=[],{stage:n,remove:()=>{t.scene.postProcessStages.remove(n)}}},Ei=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float size;\n uniform float direction;\n\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n\n void main(void) {\n\n float time = czm_frameNumber * speed / 1000.0;\n vec2 resolution = czm_viewport.zw;\n\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 finalColor = vec3(.6, .7, .8);//粒子的颜色\n\n float siMars3D = sin(direction), co = cos(direction);\n uv *= mat2(co, -siMars3D, siMars3D, co);\n uv *= length(uv + vec2(0, 4.9))*(20.0/size) + 1.0;\n\n float v = 1. - sin(hash(floor(uv.x * 100.0)) * 2.0);\n float b = clamp(abs(sin(20.0 * time * v + uv.y * (5. / (2.0 + v)))) - .95, 0.0, 1.0) * 20.0;\n finalColor *= v * b; //屏幕上雨的颜色\n\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雨和三维场景融合\n }\n ",uniforms:{speed:()=>t.speed||16,size:()=>t.size||20,direction:()=>360+(t.direction||30)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Di=t=>{const i=t.viewer,n=new e.PostProcessStage({fragmentShader:"\n#extension GL_OES_standard_derivatives:enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nin vec2 v_textureCoordinates;\nvec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n}\nfloat getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n}\nvec3 guussColor(vec2 uv){\n vec2 pixelSize = 1.0 / czm_viewport.zw;\n float dx0 = -pixelSize.x;\n float dy0 = -pixelSize.y;\n float dx1 = pixelSize.x;\n float dy1 = pixelSize.y;\n vec4 gc = (\n texture(colorTexture, uv)+\n texture(colorTexture, uv + vec2(dx0, dy0)) +\n texture(colorTexture, uv + vec2(0.0, dy0)) +\n texture(colorTexture, uv + vec2(dx1, dy0)) +\n texture(colorTexture, uv + vec2(dx0, 0.0)) +\n texture(colorTexture, uv + vec2(dx1, 0.0)) +\n texture(colorTexture, uv + vec2(dx0, dy1)) +\n texture(colorTexture, uv + vec2(0.0, dy1)) +\n texture(colorTexture, uv + vec2(dx1, dy1))\n ) * (1.0 / 9.0);\n return gc.rgb;\n}\nvoid main(){\n float offset = 0.0;\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n out_FragColor = color;\n return;\n }\n float depth = getDepth(currD);\n\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec3 dx = dFdx(positionEC.xyz);\n vec3 dy = dFdy(positionEC.xyz);\n vec3 normal = normalize(cross(dx,dy));\n\n vec4 positionWC = normalize(czm_inverseView * positionEC);\n vec3 normalWC = normalize(czm_inverseViewRotation * normal);\n float fotNumWC = dot(positionWC.xyz,normalWC);\n if(fotNumWC<=0.5){\n out_FragColor = color;\n return;\n }\n\n vec3 viewDir = normalize(positionEC.xyz);\n vec3 reflectDir = reflect(viewDir, normal);\n vec3 viewReflectDir = reflectDir;\n\n float step = 0.05;\n int stepNum = int(20.0 / step);\n vec3 pos;\n vec3 albedo;\n bool jd = false;\n for(int i = 1;i <= 400;i++)\n {\n float delta = step * float(i) + offset;\n pos = positionEC.xyz + viewReflectDir * delta;\n float d = -pos.z;\n\n vec4 tmp = czm_projection * vec4(pos,1.0);\n vec3 screenPos = tmp.xyz / tmp.w;\n vec2 uv = vec2(screenPos.x, screenPos.y) * 0.5 + vec2(0.5, 0.5);\n\n if(uv.x > 0.0 && uv.x < 1.0 && uv.y > 0.0 && uv.y < 1.0){\n float dd = getDepth(texture(depthTexture, uv));\n vec4 jzc = toEye(uv, dd);\n dd = -jzc.z;\n if(d>dd){\n if(abs(abs(d) - abs(dd)) <=step){\n jd = true;\n // albedo = texture(colorTexture, uv).rgb;\n albedo = guussColor(uv);\n }\n break;\n }\n }\n }\n if(jd){\n out_FragColor = vec4(mix(color.xyz,albedo,0.5),1.0);\n }else{\n out_FragColor = color;\n }\n}\n",uniforms:{}});i.scene.postProcessStages.add(n);return{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},Ai=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n float hash(float x)\n {\n return fract(21654.6512 * sin(385.51 * x));\n }\n float hash(vec2 p)\n {\n return fract(1654.65157 * sin(15.5134763 * p.x + 45.5173247 * p.y + 5.21789));\n }\n vec2 hash2(vec2 p)\n {\n return vec2(hash(p * .754), hash(1.5743 * p + 4.5476351));\n }\n vec2 add = vec2(1.0, 0.0);\n vec2 noise2(vec2 x)\n {\n vec2 p = floor(x);\n vec2 f = fract(x);\n f = f * f * (3.0 - 2.0 * f);\n vec2 res = mix(mix(hash2(p),\n hash2(p + add.xy), f.x),\n mix(hash2(p + add.yx), hash2(p + add.xx), f.x), f.y);\n return res;\n }\n vec2 fbm2(vec2 x)\n {\n vec2 r = vec2(0.0);\n float a = 1.0;\n for (int i = 0; i < 8; i++)\n {\n r += noise2(x) * a;\n x *= 2.;\n a *= .5;\n }\n return r;\n }\n float dseg(vec2 ba, vec2 pa)\n {\n float h = clamp(dot(pa, ba) / dot(ba, ba), -0.2, 1.);\n return length(pa - ba * h);\n }\n uniform sampler2D colorTexture;\n uniform float fallInterval;\n uniform float mixFactor;\n in vec2 v_textureCoordinates;\n void main(void){\n vec2 uv = gl_FragCoord.xy;\n float iTime = czm_frameNumber * fallInterval * clamp(fallInterval * 0.1, 0.01, 0.1);\n vec2 p = uv / czm_viewport.zw;\n vec2 d;\n vec2 tgt = vec2(1., -1.);\n float c = 0.;\n if (p.y >= 0.)\n c = (1. - (fbm2((p + .2) * p.y + .1 * iTime)).x) * p.y;\n else\n c = (1. - (fbm2(p + .2 + .1 * iTime)).x) * p.y * p.y;\n vec3 col = vec3(0.);\n vec3 col1 = c * vec3(.3, .5, 1.);\n float mdist = 100000.;\n float t = hash(floor(5. * iTime));\n tgt += 4. * hash2(tgt + t) - 1.5;\n if (hash(t + 2.3) > .6)\n for (int i = 0; i < 100; i++) {\n vec2 dtgt = tgt - p;\n d = .05 * (vec2(-.5, -1.) + hash2(vec2(float(i), t)));\n float dist = dseg(d, dtgt);\n mdist = min(mdist, dist);\n tgt -= d;\n c = exp(-1.2 * dist) + exp(-55. * mdist);\n col = c * vec3(.7, .8, 1.);\n }\n col += col1;\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(col, 0.0), mixFactor);\n}\n ",uniforms:{mixFactor:()=>t.mixFactor||.1,fallInterval:()=>t.fallInterval||.8}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Si=t=>new e.CustomShader({vertexShaderText:Ii,fragmentShaderText:Ti,translucencyMode:0,lightingModel:e.LightingModel.UNLIT,uniforms:{colorEnable:{type:e.UniformType.BOOL,value:t.colorEnable||!0},glowEnable:{type:e.UniformType.BOOL,value:t.glowEnable||!0},baseHeight:{type:e.UniformType.FLOAT,value:t.baseHeight||100},glowRange:{type:e.UniformType.FLOAT,value:t.glowRange||100},uColor:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE},glowTime:{type:e.UniformType.FLOAT,value:t.glowTime||1}}}),Ii="\n void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {\n vsOutput.positionMC += 0.1 * vsInput.attributes.normalMC;\n }\n",Ti="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)\n {\n vec4 position = czm_inverseModelView * vec4(fsInput.attributes.positionEC,1); // 位置 \n vec4 color = uColor;\n color *= vec4(vec3(position.z / baseHeight), 0.5); // 渐变\n bool glEnable = glowEnable;\n // if(position.z > baseHeight) {\n // material.diffuse = vec3(1.0,0.0,0.0);\n // return;\n // }\n if(position.z < 40.0) {\n glEnable = false;\n }\n if(!glEnable){\n material.diffuse = color.rgb;\n return; \n }\n \n // 动态光环\n float time = fract(czm_frameNumber / (360.0 * glowTime));\n time = abs(time - 0.5) * 2.0;\n float diff = step(0.005, abs(clamp(position.z / glowRange, 0.0, 1.0) - time));\n color.rgb += color.rgb * (1.0 - diff);\n material.diffuse = color.rgb;\n } \n",zi=t=>new e.CustomShader({fragmentShaderText:Fi,uniforms:{color:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE}}}),Fi="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {\n vec4 originColor = vec4(material.diffuse,1.0);\n material.diffuse = vec3(mix(originColor,color,0.3));\n material.alpha = 0.8;\n }\n",Ri=t=>{const i=t.scene.postProcessStages.add(e.PostProcessStageLibrary.createSilhouetteStage());i.uniforms.color=e.Color.YELLOW,i.selected=[];return{stage:i,remove:()=>{}}};var Oi=(e=>(e.DRAW_ADD="drawAdd",e.DRAW_MOVE="drawMove",e.DRAW_PICK="drawPick",e.DRAW_DB_CLICK="drawDbClick",e.DRAW_RIGHT_CLICK="drawRightClick",e))(Oi||{}),Li=Object.freeze({__proto__:null,DrawEventType:Oi});const Bi={drawStart:{circle:"单击左键绘制圆的中心点,单机右键取消绘制。",rectangle:"单击左键绘制矩形左上角。",point:"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。",default:"单击左键绘制第一个节点,单机右键取消绘制。"},drawMove:{circle:"单击左键确定圆的半径并结束绘制,单机右键取消绘制。",rectangle:"单击左键结束绘制,单机右键取消绘制。","vertical-line":"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。","default-dbclick":"单机左键绘制下一个节点,双击左键结束绘制,单机右键撤销上次绘制。",default:"单机左键绘制下一个节点,单机右键撤销上次绘制。"},drawEnd:"单击左键结束绘制,单机右键取消上次绘制",pointEnter:"双击左键编辑节点。",drawEditMove:{default:"移动鼠标修改节点,单击左键确定修改,单机右键取消修改。"}},ki={point:{color:"rgba(255,255,0,0.8)",pixelSize:8,outlineColor:"rgba(255,255,255,0.8)",outlineWidth:2,disableDepthTestDistance:Number.POSITIVE_INFINITY},polyline:{width:2,color:"rgba(81,255,0,0.8)",depthFailColor:"rgba(255,0,0,0.5)"},polygon:{color:"rgba(255,255,54,0.3)",depthFailColor:"rgba(255,0,0,0.3)"}};class Ni extends rt{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=p(t).map(e=>te([e.longitude,e.latitude])),n=h(t[0]).height,o=We(t[0],t[1]),[r,a,s]=[i[0],i[1],i[2]],l=Ve(r,o/1e3,de(r,a),de(r,s)).geometry.coordinates.map(e=>[e[0],e[1],n]);l.push([...r.geometry.coordinates,n]),l.unshift([...r.geometry.coordinates,n]),this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(l.flat()),this.setShapePositions(this.drawData.shapePositions)}}const Gi=(e,t)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),Ui=e=>{let t=0;return e&&Array.isArray(e)&&e.length>0&&e.forEach((i,n)=>{n<e.length-1&&(t+=Gi(i,e[n+1]))}),t},Vi=e=>Ui(e)**.99,$i=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Hi=(e,t)=>{let i;const n=Math.asin(Math.abs(t[1]-e[1])/Gi(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=n+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=2*Math.PI-n:t[1]<e[1]&&t[0]<e[0]?i=n:t[1]<e[1]&&t[0]>=e[0]&&(i=Math.PI-n),i},Wi=(e,t,i)=>{const n=Hi(t,e)-Hi(t,i);return n<0?n+2*Math.PI:n},qi=(e,t,i,n,o)=>{const r=Hi(e,t),a=o?r+i:r-i,s=n*Math.cos(a),l=n*Math.sin(a);return[t[0]+s,t[1]+l]},ji=function(e){if(e.length<=2)return e;const t=[],i=e.length-1;for(let n=0;n<=1;n+=.01){let[o,r]=[0,0];for(let t=0;t<=i;t++){const a=Yi(i,t),s=n**t,l=(1-n)**(i-t);o+=a*s*l*e[t][0],r+=a*s*l*e[t][1]}t.push([o,r])}return t.push(e[i]),t},Zi=e=>{let t=1;switch(e){case e<=1:t=1;break;case 2===e:t=2;break;case 3===e:t=6;break;case 24===e:t=24;break;case 5===e:t=120;break;default:for(let i=1;i<=e;i++)t*=i}return t},Yi=(e,t)=>Zi(e)/(Zi(t)*Zi(e-t));class Ji extends rt{positions;drawData;depthFailAppearance;connPoint;tempPoint4;llBodyPnts=[];rrBodyPnts=[];isClockWise;neckWidthFactor;headWidthFactor;headHeightFactor;neckHeightFactor;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance(),this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.connPoint=[0,0],this.tempPoint4=[0,0],this.isClockWise=!1}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=[],n=p(t).map(e=>(i.push(e.height),[e.longitude,e.latitude])),o=Math.max(...i),[r,a,s]=[n[0],n[1],n[2]],l=n.length;let c,d;3===l?(this.tempPoint4=this.getTempPoint4(r,a,s),this.connPoint=$i(r,a)):4===l?(this.tempPoint4=n[3],this.connPoint=$i(r,a)):(this.tempPoint4=n[3],this.connPoint=n[4]),this.isClockWise=((e,t,i)=>(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0]))(r,a,s),this.isClockWise?(c=this.getArrowPoints(r,this.connPoint,this.tempPoint4,!1),d=this.getArrowPoints(this.connPoint,a,s,!0)):(c=this.getArrowPoints(a,this.connPoint,s,!1),d=this.getArrowPoints(this.connPoint,r,this.tempPoint4,!0));const h=c.length,m=(h-5)/2,g=c.slice(0,m),f=c.slice(m,m+5);let v=c.slice(m+5,h);this.llBodyPnts=g;let y=d.slice(0,m);const C=d.slice(m,m+5),w=d.slice(m+5,h);this.rrBodyPnts=w,y=ji(y);const b=ji(w.concat(g.slice(1)));v=ji(v);const P=y.concat(C,b,f,v).filter(e=>e[0]&&e[1]).map(t=>new e.Cartographic(t[0],t[1],o)),_=u(P);this.drawData.shapePositions=_,this.drawData.shapePositions.push(_[0]),this.setShapePositions(this.drawData.shapePositions)}getTempPoint4(e,t,i){const n=$i(e,t),o=Gi(n,i),r=Wi(e,n,i);let a,s,l,c=[0,0];return r<Math.PI/2?(a=o*Math.sin(r),s=o*Math.cos(r),l=qi(e,n,Math.PI/2,a,!1),c=qi(n,l,Math.PI/2,s,!0)):r>=Math.PI/2&&r<Math.PI?(a=o*Math.sin(Math.PI-r),s=o*Math.cos(Math.PI-r),l=qi(e,n,Math.PI/2,a,!1),c=qi(n,l,Math.PI/2,s,!1)):r>=Math.PI&&r<1.5*Math.PI?(a=o*Math.sin(r-Math.PI),s=o*Math.cos(r-Math.PI),l=qi(e,n,Math.PI/2,a,!0),c=qi(n,l,Math.PI/2,s,!0)):(a=o*Math.sin(2*Math.PI-r),s=o*Math.cos(2*Math.PI-r),l=qi(e,n,Math.PI/2,a,!0),c=qi(n,l,Math.PI/2,s,!1)),c}getArrowPoints(e,t,i,n){const o=$i(e,t),r=Gi(o,i);let a=qi(i,o,0,.3*r,!0),s=qi(i,o,0,.5*r,!0);a=qi(o,a,Math.PI/2,r/5,n),s=qi(o,s,Math.PI/2,r/4,n);const l=[o,a,s,i],c=this.getArrowHeadPoints(l);if(!(c&&Array.isArray(c)&&c.length>0))throw new Error("Interpolation Error");{const i=c[0],n=c[4],o=Gi(e,t)/Vi(l)/2,r=this.getArrowBodyPoints(l,i,n,o);if(r){const o=r.length;let a=r.slice(0,o/2),s=r.slice(o/2,o);return a.push(i),s.push(n),a=a.reverse(),a.push(t),s=s.reverse(),s.push(e),a.reverse().concat(c,s)}}}getArrowBodyPoints(e,t,i,n){const o=Ui(e),r=Vi(e)*n,a=(r-Gi(t,i))/2;let s=0;const l=[],c=[];for(let t=1;t<e.length-1;t++){const i=Wi(e[t-1],e[t],e[t+1])/2;s+=Gi(e[t-1],e[t]);const n=(r/2-s/o*a)/Math.sin(i),d=qi(e[t-1],e[t],Math.PI-i,n,!0),p=qi(e[t-1],e[t],i,n,!1);l.push(d),c.push(p)}return l.concat(c)}getArrowHeadPoints(e){const t=Vi(e)*this.headHeightFactor,i=e[e.length-1],n=t*this.headWidthFactor,o=t*this.neckWidthFactor,r=t*this.neckHeightFactor,a=qi(e[e.length-2],i,0,t,!0),s=qi(e[e.length-2],i,0,r,!0),l=qi(i,a,Math.PI/2,n,!1),c=qi(i,a,Math.PI/2,n,!0);return[qi(i,s,Math.PI/2,o,!1),l,i,c,qi(i,s,Math.PI/2,o,!0)]}}class Ki extends rt{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<2)return;const i=p(t).map(e=>te([e.longitude,e.latitude])),n=h(t[0]).height,o=qe(t)/1e3,[r,a]=[i[0],i[1]],s=de(r,a),l=pe(r,.1*o,s-90,{units:"kilometers"}),c=pe(r,.1*o,s+90,{units:"kilometers"}),d=pe(r,.8*o,s-5,{units:"kilometers"}),u=pe(r,.8*o,s+5,{units:"kilometers"}),m=pe(r,.75*o,s-13,{units:"kilometers"}),g=pe(r,.75*o,s+13,{units:"kilometers"}),f=[...l.geometry.coordinates,n,...d.geometry.coordinates,n,...m.geometry.coordinates,n,...a.geometry.coordinates,n,...g.geometry.coordinates,n,...u.geometry.coordinates,n,...c.geometry.coordinates,n,...l.geometry.coordinates,n];this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(f.flat()),this.setShapePositions(this.drawData.shapePositions)}}const Xi=e=>{const t=new Ni(e);e.primitives.add(t)},Qi=e=>{const t=new Ji(e);e.primitives.add(t)},en=e=>{const t=new Ki(e);e.primitives.add(t)},tn="cm",nn="厘米",on="m",rn="米",an="km",sn="千米",ln="公里",cn="㎡",dn="平方厘米",pn="㎡",hn="平方米",un="km²",mn="平方千米",gn="平方公里",fn="亩",vn="公顷",yn={cm:"cm²",m:"㎡",km:"km²","米":"平方米","千米":"平方千米","公里":"平方公里"},Cn=(e,t,i)=>t===i?e:e*Pn(i),wn=(e,t,i)=>t===i?e:e*function(e){switch(e){case cn:return 1e4;case pn:return 1;case un:return 1e-6;case dn:return 1e4;case hn:return 1;case mn:case gn:return 1e-6;case fn:return.0015;case vn:return 1e-4;default:return 1}}(i),bn=e=>yn[e],Pn=e=>{switch(e){case on:return 1;case tn:case nn:return 100;case an:return.001;case rn:return 1;case sn:case ln:return.001;default:return 1}};const _n=(t,i)=>{let n=t;if("vertical-surface-line"===i&&t.length>=1){const i=t[0],o=e.Cartographic.fromCartesian(i),r=e.Math.toDegrees(o.longitude),a=e.Math.toDegrees(o.latitude),s=0;n=[e.Cartesian3.fromDegrees(r,a,o.height),e.Cartesian3.fromDegrees(r,a,s)]}if("vertical-line"===i&&t.length>=2){const i=t[0],o=t[1],r=h(i),a=h(o);let s=r,l=a;r.height>a.height&&(s=a,l=r),console.log(s.longitude,s.latitude,l.height);const c=m(new e.Cartographic(s.longitude,s.latitude,l.height));n=[m(s),c,m(l),m(s)]}return i.startsWith("curve")&&t.length>2&&(n=En(t)),n},xn=(e,t,i,n,o)=>{i.push(...e.map((i,o)=>{const r=e[o+1];if(r){let e=t?je(i,r):We(i,r);return e=Cn(e,"m",n),{value:Number(e.toFixed(2)),unit:n,position:Ye([i,r]),positions:[i,r]}}return null}).filter(e=>e&&e.value>0))},Mn=e=>{if(2===e.length)return e;let[t,i]=e;return i||(i=bn(t)),[t,i]},En=t=>{const i=t.length,n=Ze(t),o=Math.floor(n/5),r=[];for(let e=0;e<i;e++)r.push(1.5*e);const a=new e.CatmullRomSpline({points:t,times:r}),s=[],l=r[0],c=r[r.length-1];for(let t=0;t<o;t++){const i=t/(o-1),n=e.Math.lerp(l,c,i),r=a.evaluate(n);s.push(r)}return s},Dn=(t,i=1e3)=>{if(t.length<2)return console.warn("至少需要2个点才能生成箭头"),[];const n=t[t.length-1],o=t[t.length-2],r=h(n),a=h(o),s=r.height,l=r.longitude-a.longitude,c=r.latitude-a.latitude,d=Math.sqrt(l**2+c**2);if(d<1e-12)return console.warn("最后两点经纬度重合,无法生成箭头"),[];const p=l/d,u=c/d,g=(t=>{const i=e.Math.toRadians(.5),n=m(t),o=m(new e.Cartographic(t.longitude+i,t.latitude,t.height)),r=2*e.Cartesian3.distance(n,o),a=m(new e.Cartographic(t.longitude,t.latitude+i,t.height));return{lon:r,lat:2*e.Cartesian3.distance(n,a)}})(r),f=i/g.lon*e.Math.RADIANS_PER_DEGREE,v=i/g.lat*e.Math.RADIANS_PER_DEGREE,y=Math.PI/6,C=i*Math.tan(y),w=C/g.lon*e.Math.RADIANS_PER_DEGREE,b=C/g.lat*e.Math.RADIANS_PER_DEGREE,P=r.longitude-p*f-u*w,_=r.latitude-u*v+p*b,x=r.longitude-p*f+u*w,M=r.latitude-u*v-p*b,E=m(new e.Cartographic(P,_,s)),D=m(new e.Cartographic(x,M,s));return[E,m(new e.Cartographic(r.longitude,r.latitude,s)),D]};class An extends rt{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=_n(this.positions,this.drawData.shape);if(this.drawData.shapePositions=t,"vertical-surface-line"===this.drawData.shape){const e=this.drawData.pointPrimitives.get(1);e&&(e.position=this.drawData.shapePositions[1])}if(this.setShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:ki.polyline.width}):new e.PolylineGeometry({positions:t,width:ki.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(ki.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(ki.polyline.depthFailColor)})}))}}class Sn extends rt{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=JSON.parse(JSON.stringify(this.positions));if(this.calcShapePositions(t),this.positions.length<3)return;const i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(e){const t=[...e,e[0]];this.drawData.shapePositions=t,this.setShapePositions(this.drawData.shapePositions)}}class In extends rt{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return;this.primitiveCollection.removeAll(),this.calcShapePositions(this.positions);const t=JSON.parse(JSON.stringify(this.positions)),i=this.drawData.clampToGround?je(t[0],t[1]):We(t[0],t[1]);if(!i)return;const n=e.Cartographic.fromCartesian(t[0]).height,o=[new e.GeometryInstance({geometry:new e.CircleGeometry({center:t[0],height:n,radius:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:o,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:o,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const n=We(t[0],t[1]),o=e.Cartographic.fromCartesian(t[0]).height,r=new e.CircleOutlineGeometry({center:t[0],height:o,radius:n}),a=e.CircleOutlineGeometry.createGeometry(r);let s=[];if(a){const t=[].slice.call(a.attributes.position.values);s=e.Cartesian3.unpackArray(t),s.push(s[0]),i=s}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class Tn extends rt{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return this.primitiveCollection;this.primitiveCollection.removeAll();const t=JSON.parse(JSON.stringify(this.positions));t.length=2,this.calcShapePositions(t);const i=e.Cartographic.fromCartesian(t[0]).height,n=e.Rectangle.fromCartesianArray(t),o=[new e.GeometryInstance({geometry:new e.RectangleGeometry({rectangle:n,height:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:o,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:o,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(ki.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const n=e.Cartographic.fromCartesian(t[0]).height,o=e.Rectangle.fromCartesianArray(t),r=new e.RectangleOutlineGeometry({rectangle:o,height:n}),a=e.RectangleOutlineGeometry.createGeometry(r);let s=[];if(a){const t=[].slice.call(a.attributes.position.values);s=e.Cartesian3.unpackArray(t),s.push(s[0]),i=s}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class zn extends rt{drawData;labelCollection;measureDivs;cesiumWidget;viewer;constructor(t,i){super(),this.viewer=i,this.cesiumWidget=i._element.getElementsByClassName("cesium-widget")[0],this.drawData=t,this.labelCollection=new e.LabelCollection({scene:i.scene}),this.drawData.measureLabel&&this.setAppearance(),this.measureDivs=[],this.renderDivPosition()}getPrimitive(){return this.drawData.isEditing&&this.drawData.measureLabel?"point"===this.drawData.shape?(this.updatePointDivLabel(),this.labelCollection):this.drawData.shapePositions&&this.drawData.shapePositions.length>=2?(this.updateUnit(this.drawData.measureUnit),this.labelCollection):void 0:this.labelCollection}updateUnit(e){if("point"===this.drawData.shape)return;this.drawData.measureUnit=e,this.clearAllDiv();const t=(e=>{let{shapePositions:t,positions:i,shape:n,clampToGround:o,measureUnit:r}=e;t||(t=i),o||(o=!1);const[a,s]=Mn(r),l=bn("m");e.measureUnit=[a,s];const c=[];if("polyline"===n&&(xn(i,o,c,a),c.push({value:0,unit:a,position:i[0],positions:i,prefixText:"起点"}),c.push({value:Number(c.reduce((e,t)=>e+t.value,0).toFixed(2)),unit:a,position:i[i.length-1],positions:i})),"vertical-surface-line"===n&&xn(t,o,c,a),"vertical-line"===n&&(xn(t,o,c,a),c.forEach((e,t)=>{0===t&&(e.prefixText="高度"),1===t&&(e.prefixText="水平距离"),2===t&&(e.prefixText="空间距离")})),"polygon"===n){xn(t,o,c,a);const e=wn(Je(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:Ye(t),positions:t})}if("rectangle"===n){xn(t,o,c,a);const e=wn(Je(t),l,s);c.push({value:Number(e.toFixed(2)),unit:s,position:Ye(t),positions:t})}if("circle"===n){const e=o?je(i[0],i[1]):We(i[0],i[1]);c.push({value:Number(Cn(e,"m",a).toFixed(2)),unit:a,position:i[1],positions:i,prefixText:"半径"});const t=wn(e*e*Math.PI,l,s);e>0&&c.push({value:Number(t.toFixed(2)),unit:s,position:i[0],positions:i})}return c})(this.drawData);this.drawData.measureResult=t,t.forEach((e,t)=>{let i="";e.prefixText?(i=`${e.prefixText}`,e.value&&(i+=`:${e.value}${e.unit}`)):i+=`${e.value}${e.unit}`;const n=this.createDiv(`measure-label-${this.drawData.id}-${t}`,i);this.measureDivs.push({position:e.position,divEle:n})})}updatePointDivLabel(){this.clearAllDiv(),this.drawData.positions.forEach(e=>{const t=h(e),i=this.createDiv(`measure-label-${this.drawData.id}-0`,`经度:${t.longitude.toFixed(6)}\n纬度:${t.latitude.toFixed(6)}\n高度:${t.height.toFixed(6)}`);this.measureDivs.push({position:e,divEle:i})})}renderDivPosition(){this.viewer.scene.postRender.addEventListener(()=>{this.measureDivs.forEach(e=>{const t=this.viewer.scene.cartesianToCanvasCoordinates(e.position);if(t){e.divEle.style.display="block";const i=e.divEle.getBoundingClientRect();e.divEle.style.left=t.x-i.width/2+"px",e.divEle.style.top=t.y-i.height+"px"}else e.divEle.style.display="none"})})}destroy(){super.destroy(),this.clearAllDiv()}setAppearance(){}clearAllDiv(){this.measureDivs.forEach(e=>{e.divEle.remove()}),this.measureDivs=[]}createDiv(e,t,i=48){const n=`\n <div style="\n background: rgba(0, 0, 0, 0.6);\n color: white;\n border-radius: 5px;\n padding: 0 10px 0 10px;\n font-size: 14px;\n white-space: nowrap;\n pointer-events: none;\n ">\n ${t.split("\n").map(e=>`\n <div style="height: 24px; line-height: 24px">\n ${e}\n </div>\n `).join(" ")}\n </div>\n <div style="\n height: ${i}px;\n width: 2px;\n background: rgba(0, 0, 0, 0.6);\n margin: auto;\n ">\n </div>\n `,o=document.createElement("div");return o.id=e,o.innerHTML=n,o.style.position="absolute",o.style.pointerEvents="none",o.className=`measure-label measure-label-${this.drawData.id}`,this.cesiumWidget.appendChild(o),o}calcShapePositions(e){this.setShapePositions(e)}}class Fn extends rt{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;viewer;arrowLengthScale;constructor(t,i){super(),this.arrowLengthScale=5,this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.viewer=i,this.setAppearance()}getGeometry(){if(this.positions.length<2)return;let t=this.positions;t=_n(t,this.drawData.shape);let i=Ze(t)/this.arrowLengthScale;return i>3e6&&(i=3e6),t=Dn(t,i/2),this.calcShapePositions(t),t.length<2?void 0:(this.setShapePositions(t),this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:ki.polyline.width}):new e.PolylineGeometry({positions:t,width:ki.polyline.width}))}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:this.drawData.id});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(ki.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(ki.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}class Rn extends rt{drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=this.drawData.shapePositions||[];if(this.calcShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:ki.polyline.width}):new e.PolylineGeometry({positions:t,width:ki.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(ki.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(ki.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}const On={point:1,circle:2,rectangle:2,sector:3,"vertical-surface-line":1,"vertical-line":2},Ln={},Bn=e=>{const{type:t,action:i,outline:n,pointCount:o}=e;Ln[t]=(e,t)=>{i(e,t),n&&Gn(e)},o&&(On[t]=o)},kn=(e,t,i)=>{Ln[t]&&Ln[t](i,e)},Nn=e=>{const t=new An(e);e.primitives.add(t)},Gn=e=>{const t=new Rn(e);e.primitives.add(t)},Un=(e,t)=>{const i=new Fn(e,t);e.primitives.add(i)},Vn=e=>{const t=new Sn(e);e.primitives.add(t)},$n=e=>{const t=new In(e);e.primitives.add(t)},Hn=e=>{const t=new Tn(e);e.primitives.add(t)},Wn=(e,t)=>{const i=new zn(e,t);e.primitives.add(i),e.measurePrimitive=i,e.primitives.raiseToTop(i)},qn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAQBJREFUWEft2MsNgkAQBuAZtABCBctBErvATryiRRibkKudGKvgwMFtQGIBumOAYAxCArsTs4fZ8w758032wSJ4PtDzfCABXTvEKhjmhXpka+0a6rueNWB0KgmAdLVLYq6QbAHDvEwDgksdzOAz5pKUgK6tFkERnCogq3iq1Ng8ERRBS4HBjTrKywMAqjnfJCKFAGlTg3ieU9vOJV1lq2O/bjhgcyv59yBt8LXpXzLYBFsE2toKojHX+z75kWc8iwsV0PLm8XVLArotivp/RFrsYiiCLnp1rQiKoKWAHHWWcJ8yZsFF8zbj5eNRt9VwPRp1hGyCrq0cq5eArrLeC74BlkT4KR3TrCoAAAAASUVORK5CYII=",jn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAY9JREFUWEftmNFRwzAMhiVYAMoC5Y50jjAJ9LFliMIQNI/NJtA1CA9hAHIsgMWZYC5xHVtNajcHzqtl+ctvSZaNMPIPR84HEXDoDv1tBc/XxRMCpFaVEPNqcTXvq6RTwbOsSE8FTfUFBOKNE05NQsxRiK3u4/MEy49F8myDdwJOstcNEN32VWCouhHQu4JetnYPp84tVr4uHl8OGofvd7Ocw8kGnKwL4jjk2lTLhLU2y0guGgE7pI8KdsVkuBhEzDtPGstYEEAkmstyMcmKFRDcN9WyjUk774AKQEE1IW1jyt47IACV1XJ22VRNQqKgN70Im9qyAIASbRdST4qunjEQoB3S1tAGBATQY05iy7ObEDdHLzMmOFPi6KBBFLTBuSC9A5rg6pijqSm79TrpHRC021o7IdrZfbwy8wNpztYacgRlhtuitu38b3E/rt9Z/w+Q9czBVtV9RCpX7I7adTKw2QBAIFy7njz2Bvy+OGXFighS9pvMDjWVdXlKHrg/xFaQ6/DQdhFwqKJRwaEKfgEJRgs46ima/wAAAABJRU5ErkJggg==",Zn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAMdJREFUWEdjZBjkgHGQu49h1IGUxtBoCI6GIKUhQKn+0TQ4GoKUhgCl+kfT4GgIUhoClOofTYM0DUGh6bfrGRgYFSi1BJ9+xn//Dr7NVluASw3eKBaadvs/LR0HM/sfI4Pjh0zVA9jswulAgenXFZj+s9ynjwP/KH7I1HxAkgNBioWn3kr4z8RkT1tH/n/wLlO1kawopq3DiDN9tJghLpxwqxoNwdEQpDQEKNU/mgZHQ5DSEKBU/2gaHA1BSkOAUv2jaXDYhyAAbjwcKU1UyjYAAAAASUVORK5CYII=",Yn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAkJJREFUWEftl19SwkAMxpPCARAvgDPijKewnER4BA8hHEJ5FE8CnsIZccZ6AJEDMF1Ny5Zu/6bNMvQBXmk3vyZfvmQRGv7DhvPBGVBaIasZ7M4/XwhoM74eScH0+9YAAzilhuHByttMbq5sQFoBNOE0lh1IMeDF83qJAG52tuSQIsBiODuZrA14+fQxVIhBUwSqA1hFmURcHPQIAIiLuo1TG5CguvP14z/Z1EcYtHzVi4ARpj7sXh3V/iLw30l/ULdhRIAUtDN/723Ht56RUYTpZtyf6f/qwtF7YkAdPAtQAmbdB08KSMF/Hm4WRRmpCkjeyWmc0hJHVlLSiaQ3gHYv/IidR7rM+6CDPZX7ZCFg0ueoW7fj/kqiLfoQ6u7DGcWQuYDHgNNQVSAzAZNwgQkjpDJHXldUSm1DDrTv01nHnmHmOQtGCpA3vsJwnJJ35mvXUbBkySJD5ylAPR04B54EMD7C4kJGBbMkdJn16BK3/FZq21GOc8eZ17lNYmZSeeHA76cgOZlOPpMse9G8zgUMOo3ErWC631c8H3Fk22bKlolCHzQgLRq1rk4ZHGtZIEjSUJneqo46zvhkAXI1VhWQe27pLOYe1FhAXapGLqzhddN3yYLQV9/myg9vwQQR3EdEGkz6pAL09KXJuECFUYIrAFcu8edqazDtk9nhOVZSBF4b0NhUIjM3Q0nhRCU2djtj4uznjvC6qc8XZTCer7gmbWTOOqDegpQCV3JRT+rRWgbrdCjnnTMgJ0tHsxlpcM77f6iGZThXF5iUAAAAAElFTkSuQmCC";class Jn{static editUI;_editUi;viewer;_editUiPosition=null;_editPointPrimitive=null;_drawEditEvent;elementId="draw-edit-ui";constructor(e,t){this._editUi=null,this.viewer=e,this.create(),this.setVisible(!1),this.renderPosition(),this._drawEditEvent=t}create(){if(this._editUi=document.getElementById(this.elementId),this._editUi)return this._editUi;const e=document.createElement("DIV");e.id=this.elementId,e.className="draw-edit-ui";const t=document.createElement("DIV");t.title="点击移动节点";const i=document.createElement("img");i.src=Yn,i.className="draw-edit-icon",t.appendChild(i),t.addEventListener("click",()=>{this._drawEditEvent.drawEditMove&&this._drawEditEvent.drawEditMove(this._editPointPrimitive)});const n=document.createElement("DIV");n.id="addPoint";const o=document.createElement("img");o.src=qn,o.title="点击添加节点",o.className="draw-edit-icon",n.appendChild(o),n.addEventListener("click",()=>{this._drawEditEvent.drawEditAdd&&this._drawEditEvent.drawEditAdd(this._editPointPrimitive)});const r=document.createElement("DIV"),a=document.createElement("img");r.id="removePoint",a.src=Zn,a.title="点击删除节点",a.className="draw-edit-icon",r.appendChild(a),r.addEventListener("click",()=>{this._drawEditEvent.drawEditRemove&&this._drawEditEvent.drawEditRemove(this._editPointPrimitive)});const s=document.createElement("DIV"),l=document.createElement("img");l.src=jn,l.title="点击删除绘制",l.className="draw-edit-icon",s.appendChild(l),s.addEventListener("click",()=>{this._drawEditEvent.drawDelete&&this._drawEditEvent.drawDelete(this._editPointPrimitive)}),e.appendChild(t),e.appendChild(n),e.appendChild(r),e.appendChild(s),document.body.appendChild(e),this._editUi=e}setAddElementStatus(e){const t=document.getElementById("addPoint"),i=document.getElementById("removePoint");t&&(t.style.display=e?"block":"none"),i&&(i.style.display=e?"block":"none")}static createEditUi(e,t){return Jn.editUI||(Jn.editUI=new Jn(e,t)),Jn.editUI}showAt(e,t,i){this.setVisible(!0),this._editUiPosition=e,this._editPointPrimitive=t,this.setAddElementStatus(!On[i])}setVisible(e){this._editUi&&(this._editUi.style.display=e?"flex":"none")}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(this._editUiPosition&&this._editUi&&"flex"===this._editUi.style.display){const e=this.viewer.scene.cartesianToCanvasCoordinates(this._editUiPosition);this._editUi.style.position="fixed",this._editUi.style.top=e.y-28+"px",this._editUi.style.left=`${e.x+15}px`}})}destroy(){Jn.editUI&&(this._editUi&&this._editUi.parentNode.removeChild(this._editUi),this._editUi=null)}}Ln.polyline=e=>{Nn(e)},Ln["polyline-arrow"]=(e,t)=>{Nn(e),Un(e,t)},Ln.curve=e=>{Nn(e)},Ln["curve-arrow"]=(e,t)=>{Nn(e),Un(e,t)},Ln["vertical-line"]=e=>{e.clampToGround=!1,Nn(e)},Ln["vertical-surface-line"]=e=>{e.clampToGround=!1,Nn(e)},Ln.polygon=e=>{Vn(e),Gn(e)},Ln.circle=e=>{$n(e),Gn(e)},Ln.rectangle=e=>{Hn(e),Gn(e)},Bn({type:"sector",action:Xi,outline:!0,pointCount:3}),Bn({type:"db-arrow",action:Qi,outline:!0,pointCount:4}),Bn({type:"fine-arrow",action:en,outline:!0,pointCount:2});const Kn=t=>{let i;const n=[];let o=new e.Cartesian3(0,0,0);const r=[];let a,s,l;const c=U.createToolTip(t),d=ki.point;let p=!1;((t,i)=>{const n=t.scene,o=new e.ScreenSpaceEventHandler(n.canvas);let r;t.cesiumWidget.screenSpaceEventHandler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),o.setInputAction(e=>{const o=n.pickPosition(e.position),a=(new Date).getTime();if(r&&a-r<270){const n=t.scene.pick(e.position);return void i(Oi.DRAW_DB_CLICK,{position:o,pickPrimitive:n?.primitive,windowPosition:e.position})}i(Oi.DRAW_ADD,{position:o}),r=(new Date).getTime()},e.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(e=>{const o=t.scene.pick(e.endPosition),r=n.pickPosition(e.endPosition);i(Oi.DRAW_MOVE,{position:r,pickPrimitive:o?.primitive,windowPosition:e.endPosition}),o&&i(Oi.DRAW_PICK,{position:r,pickPrimitive:o?.primitive,windowPosition:e.endPosition})},e.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(()=>{i(Oi.DRAW_RIGHT_CLICK,{})},e.ScreenSpaceEventType.RIGHT_CLICK)})(t,(e,t)=>{a&&(["drawDbClick","drawPick","drawMove","drawRightClick"].includes(e)||a.isEditing)&&v[e]?.(t)});const h=new e.PrimitiveCollection;h.destroyPrimitives=!1,t.scene.primitives.add(h);const u=()=>{a&&(a.isEditing=!1,a.isDisAdd=!0,w(),P.id===a.id?g():(m(a.id),a={}))},m=e=>{const t=r.findIndex(t=>t.id===e);if(-1===t)return;const i=r[t];i.positions.length=0,r.splice(t,1),A.drawRemove&&A.drawRemove(i),setTimeout(()=>{i.measurePrimitive?.clearAllDiv(),h.remove(i?.primitives)},300)},g=()=>{if(P.id)return P.id="",a.isDisAdd=!0,a.isEditing=!0,P.originPosition?(a.positions.splice(P.index,1,P.originPosition),P.pointPrimitive.position=P.originPosition):a?.positions.splice(P.index,1),A.drawEditEnd&&A.drawEditEnd(a),setTimeout(()=>{a.isEditing=!1,a.isDisAdd=!1},300),o=new e.Cartesian3(0,0,0),s=void 0,void w();if((!On[a.shape]||On[a.shape]>2)&&a.positions&&a.positions.length>2){const e=p?2:1,t=a.pointPrimitives.get(a.positions.length-e);return a.pointPrimitives.remove(t),void a?.positions.splice(a.positions.length-e,1)}o=new e.Cartesian3(0,0,0),s=void 0,m(a.id),a={},w()},f=i=>{i||(i=a),t._element.style.cursor="default",o=new e.Cartesian3(0,0,0),i.positions.pop(),i.isDisAdd=!0,setTimeout(()=>{i.isEditing=!1,i.isDisAdd=!1,A.drawEnd&&A.drawEnd(i),a={}},300),s=void 0,l&&(i.pointPrimitives.remove(l),l=void 0),w()},v={drawAdd:({position:e})=>{if(a.positions.push(e),p=!1,P.id)return A.drawEditEnd&&A.drawEditEnd(a),P.id="",void f();E(e,a),A.drawAdd&&A.drawAdd(e,a),a.positions.length>On[a.shape]&&f()},drawMove:({position:e,windowPosition:t})=>{if(p=!0,b(),e&&!a.isDisAdd&&a.isEditing){if(w(t),P.id)a.positions.splice(P.index,1,e),P.pointPrimitive.position=e;else{const t=a.positions.findIndex(e=>e.x===o.x&&e.y===o.y&&e.z===o.z);a.positions.push(e),-1!==t&&a.positions.splice(t,1),l&&a.pointPrimitives.remove(l),l=E(e,a)}o=e,A.drawMove&&A.drawMove(e,a)}},drawPick:({pickPrimitive:t,windowPosition:i})=>{a.isEditing||t instanceof e.PointPrimitive&&y(t,i)},drawDbClick:({position:e,windowPosition:t,pickPrimitive:i})=>{if(a.isEditing){if(On[a.shape])return;f()}else!a.isEditing&&i&&C(e,t,i)},drawRightClick:()=>{a.isEditing?g():i.setVisible(!1)}},y=(e,i)=>{const o=e.id.split("-")[1],a=r.find(e=>e.id===o);n.includes(e.id)||a&&a.edit&&(t._element.style.cursor="pointer",e.pixelSize=1.5*d.pixelSize,e.outlineWidth=1.5*d.outlineWidth,s=e,c.showAt(i,Bi.pointEnter),c.setVisible(!0))},C=(t,o,a)=>{if(a instanceof e.PointPrimitive){if(n.includes(a.id))return;const e=a.id.split("-")[1],o=r.find(t=>t.id===e);if(!o)return;if(!o.edit)return;console.log(a),i.showAt(t,a,o.shape),A.drawEditStart&&A.drawEditStart(o)}},w=e=>{if(!c)return void(t._element.style.cursor="default");if(!e||!a.positions)return t._element.style.cursor="default",void c.setVisible(!1);const i=On[a.shape]?"default":"default-dbclick";P.id?c.showAt(e,Bi.drawEditMove[a.shape]||Bi.drawEditMove.default):On[a.shape]!==a.positions.length?a.positions.length>1?c.showAt(e,Bi.drawMove[i]||Bi.drawMove[i]):c.showAt(e,Bi.drawStart[i]||Bi.drawStart.default):c.showAt(e,Bi.drawEnd)},b=()=>{s&&(s.pixelSize=d.pixelSize,s.outlineWidth=d.outlineWidth,w())},P={},_={drawEditAdd:n=>{i.setVisible(!1);const{id:o,index:r,drawData:s}=x(n),l=new e.Cartesian3(n.position.x,n.position.y,n.position.z);s?.positions.splice(r,0,l),a=s;const c=E(l,a);t._element.style.cursor="move",Object.assign(P,{id:o,index:r+1,pointPrimitive:c,originPosition:l}),a.isEditing=!0},drawEditMove:n=>{i.setVisible(!1),t._element.style.cursor="move";const{id:o,index:r,drawData:s}=x(n);a=s,Object.assign(P,{id:o,index:r,pointPrimitive:n,originPosition:new e.Cartesian3(n.position.x,n.position.y,n.position.z)}),a.isEditing=!0},drawEditRemove:e=>{i.setVisible(!1);const{index:t,drawData:n}=x(e);n.isEditing=!0,n.isDisAdd=!0,n?.positions.splice(t,1),n?.pointPrimitives.remove(e),A.drawEditEnd&&A.drawEditEnd(n),setTimeout(()=>{n.isEditing=!1,n.isDisAdd=!1},300)},drawDelete:e=>{i.setVisible(!1);const{id:t}=x(e);m(t)}};i=Jn.createEditUi(t,_);const x=e=>{const t=e.id.split("-")[1],i=r.find(e=>e.id===t),n=i.positions.findIndex(t=>t.x===e.position.x&&t.y===e.position.y&&t.z===e.position.z);return{id:t,drawData:i,index:n}},M=(t,i)=>{const n=new e.PrimitiveCollection,o=new e.PointPrimitiveCollection;n.add(o);const r={id:t.id,edit:t.edit||!1,measure:t.measure||!1,measureLabel:t.measureLabel||!1,disDepthFail:t.disDepthFail||!1,measureUnit:t.measureUnit||["m"],isEditing:!0,shape:t.shape,positions:i,clampToGround:t.clampToGround,pointPrimitives:o,primitives:n};return h.add(n),i.forEach(e=>{E(e,r)}),r},E=(t,i)=>i.pointPrimitives.add({id:`draw-${i.id}-${N()}`,position:t,...d,color:e.Color.fromCssColorString(d.color),outlineColor:e.Color.fromCssColorString(d.outlineColor)}),D=e=>{const i=M({...e},e.positions);i.positions.push(i.positions[i.positions.length-1]),a=i,r.push(i),kn(t,e.shape,i),e.measure&&Wn(i,t),i.primitives.raiseToTop(i.pointPrimitives),f(i)},A={};return{draw:e=>{t._element.style.cursor="crosshair",s=void 0,e.id=N();const i=M(e,[]);a=i,A.drawStart&&A.drawStart(i),r.push(i),kn(t,e.shape,i),e.measure&&Wn(i,t),i.primitives.raiseToTop(i.pointPrimitives)},removeEditing:u,remove:e=>{m(e.id),w()},removeAll:()=>{r.forEach(e=>{e.measurePrimitive?.clearAllDiv()}),h.removeAll(),r.length=0,u()},setDrawStyle:e=>{Object.assign(ki.point,e.point),Object.assign(ki.polyline,e.polyline),Object.assign(ki.polygon,e.polygon)},Event:A,updateMeasureUnit:(e,t)=>{if(-1===r.findIndex(t=>t.id===e.id))throw new Error("绘制对象不存在");const i=e.primitives._primitives.find(e=>e instanceof zn);i&&i.updateUnit(t)},reShowDrawData:D,reShowDrawDatas:e=>{e.forEach(e=>{D(e)})}}};var Xn=Object.freeze({__proto__:null});const Qn={PolylineFlow:"PolylineFlow",PolylineTrail:"PolylineTrail",CircleWave:"CircleWave",CircleRaderWave:"CircleRaderWave",CircleRaderFan:"CircleRaderFan",LightWall:"LightWall",CircleAperture:"CircleAperture",RadarScanCircle:"RadarScanCircle",EllipsoidElectric:"EllipsoidElectric",EllipsoidVScan:"EllipsoidVScan",EllipsoidHScan:"EllipsoidHScan",Corridor:"Corridor",Zaps:"Zaps"};(()=>{for(const t in Qn)e.Material[t]=Qn[t]})();const eo={color:"rgba(255,255,255,1)",speed:6*Math.random()};class to extends at{speed;color;name="";image="";constructor(t){super(),this.createPropertyDescriptors();const i={...eo,...t};this.image=i.image,this.name=`${Qn.PolylineTrail}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.speed=this.speed,i.image=this.image,i}equals(t){return this===t||t instanceof to&&this.speed===t.speed&&e.Property.equals(this.color,t.color)&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{image:this.image,color:e.Color.fromCssColorString("#ff0000"),speed:this.speed},source:no},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const io=t=>{const i={...eo,...t};return new e.Material({fabric:{type:`${Qn.PolylineTrail}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed},source:no},translucent:!0})},no="\n uniform sampler2D image;\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec4 colorImage = texture(image,st);\n vec3 fragColor = color.rgb;\n if(st.t > 0.45 && st.t < 0.55 ) {\n fragColor = vec3(1.0);\n }\n if(color.a == 0.0){\n material.alpha = colorImage.a * 1.5 * fract(st.s - time);\n material.diffuse = colorImage.rgb;\n }else{\n material.alpha = colorImage.a * color.a * 1.5 * smoothstep(.0,1., fract(st.s - time));\n material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);\n }\n return material;\n }\n\n",oo={color:"rgba(255,255,255,1)",speed:6,repeatCount:4,blendColor:!0};class ro extends at{repeatCount;image;speed;color;blend;name="";constructor(t){super(),this.createPropertyDescriptors();const i={...oo,...t};this.name=`${Qn.PolylineFlow}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.image=i.image,this.repeatCount=i.repeatCount,this.blend=i.blendColor?1:0,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.image=this.image,i.blend=this.blend,i.speed=this.speed,i.repeatCount=this.repeatCount,i}equals(e){return this===e||e instanceof ro&&this.speed===e.speed&&this.repeatCount===e.repeatCount&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:e.Color.fromCssColorString("#ffffff"),image:"",speed:this.speed,count:this.repeatCount,blend:this.blend},source:so},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const ao=t=>{const i={...oo,...t};return new e.Material({fabric:{type:Qn.PolylineFlow+N(),uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed,count:i.repeatCount,blend:i.blendColor?1:0},source:so},translucent:!0})},so="\n uniform vec4 color;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec2 st = materialInput.st;\n vec4 colorImage = texture(image, vec2(fract( count * st.s - time),fract(st.t)));\n material.alpha = colorImage.a * color.a;\n if(blend > 0.5) {\n material.diffuse = (colorImage.rgb + color.rgb) * 2.0;\n } else {\n material.diffuse = color.rgb * 2.0 ;\n }\n return material;\n }\n",lo={color:"rgba(255,255,0,0.3)",speed:8,count:5,gradient:.3};class co extends at{count;speed;gradient;color;name="";constructor(t){super(),t||(t={});const i={...lo,...t};this.name=`${Qn.CircleWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.count=i.count,this.gradient=i.gradient,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i.repeatCount=this.count||lo.count,i}equals(t){return this===t||t instanceof co&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.count===t.count&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed,count:this.count,gradient:this.gradient},source:ho},translucent:()=>!0})}}const po=t=>{const i={...lo,...t};return{material:new e.Material({fabric:{type:`${Qn.CircleWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed,count:i.count,gradient:i.gradient},source:ho},translucent:!0})}},ho="\n uniform vec4 color;\n uniform float speed;\n uniform float count;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(czm_frameNumber * speed / 1000.0);\n if(count == 1.0){\n if(dis > per * 0.5){\n discard;\n }else {\n material.alpha = color.a * dis / per / 2.0;\n }\n } else {\n vec3 str = materialInput.str;\n if(abs(str.z) > 0.001){\n discard;\n }\n if(dis > 0.5){\n discard;\n } else {\n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n for(int i = 0; i <= 999; i++){\n if(float(i) <= count){\n disNum = perDis * float(i) - dis + per / count;\n if(disNum > 0.0){\n if(disNum < perDis){\n bl = 1.0 - disNum / perDis;\n }\n else if(disNum - perDis < perDis){\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));\n }\n }\n }\n }\n }\n return material;\n }\n",uo={color:"rgba(255,255,255,1)",speed:8};class mo extends at{speed;color;name="";constructor(t){super();const i={...uo,...t};this.name=`${Qn.CircleRaderWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof mo&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:fo},translucent:()=>!0})}}const go=t=>{const i={...uo,...t};return{material:new e.Material({fabric:{type:`${Qn.CircleRaderWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:fo},translucent:!0})}},fo="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n float rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 pos = st - vec2(0.5);\n float time = czm_frameNumber * speed / 1000.0 ;\n float r = length(pos);\n float t = atan(pos.y, pos.x) - time * 2.5;\n float a = (atan(sin(t), cos(t)) + PI)/(2.0*PI);\n float ta = 0.5;\n float v = smoothstep(ta-0.05,ta+0.05,a) * smoothstep(ta+0.05,ta-0.05,a);\n vec3 flagColor = color.rgb * v;\n float blink = pow(sin(time*1.5)*0.5+0.5, 0.8);\n flagColor = color.rgb * pow(a, 4.0*(.2+blink))*(sin(r*500.0)*.5+.5) ;\n flagColor = flagColor * pow(r, 0.4);\n material.alpha = length(flagColor) * 1.3;\n material.diffuse = flagColor * 3.0;\n return material;\n }\n",vo={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class yo extends at{speed;color;name="";constructor(t){super();const i={...vo,...t};this.name=`${Qn.CircleRaderFan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof yo&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:wo},translucent:()=>!0})}}const Co=t=>{const i={...vo,...t};return{material:new e.Material({fabric:{type:`${Qn.CircleRaderFan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:wo},translucent:!0})}},wo="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // 绘制边线\n float dis = distance(materialInput.st, vec2(0.5));\n float alpha = step((0.5- 0.01), dis);\n\n material.alpha = alpha;\n material.diffuse = color.rgb;\n\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n float per = czm_frameNumber * speed / PI * 3.0 / 200.0;\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + per;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = (alpha + color.a) * dis;\n material.diffuse = color.rgb;\n }\n return material;\n }\n",bo={color:"rgba(255,255,0,0.3)",speed:8};class Po extends at{speed;color;name="";constructor(t){super(),t||(t={});const i={...bo,...t};this.name=`${Qn.CircleAperture}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i}equals(t){return this===t||t instanceof Po&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed},source:xo},translucent:()=>!0})}}const _o=t=>{const i={...bo,...t};return new e.Material({fabric:{type:`${Qn.CircleAperture}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:xo},translucent:!0})},xo="\n uniform vec4 color;\n uniform float speed;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float d = distance(st, vec2(0.5, 0.5));\n float alpha = step(.15, d) * step(d, .17) + step(.49, d) * step(d, 0.5) + d * d * step(d, 0.5);\n float movingCircleD = fract(czm_frameNumber * speed / 1000.0);\n alpha += step(movingCircleD, d) * step(d, movingCircleD + .015);\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n",Mo=t=>{t||(t={});return new e.Material({fabric:{type:`${Qn.RadarScanCircle}-${N()}`,uniforms:{radians:3*Math.PI/8,bgColor:e.Color.fromCssColorString(t.bgColor||"rgba(0,255,0,0.2)"),sectorColor:e.Color.fromCssColorString(t.sectorColor||"rgba(152,18,8,.1)"),width:t.width||.003,offset:t.offset||0,count:t.count||3},source:Eo},translucent:!0})},Eo="\n uniform vec4 bgColor;\n uniform vec4 sectorColor;\n uniform float count;\n uniform float radians;\n uniform float width;\n uniform float offset;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n\n float alpha;\n vec3 diffuse;\n // 绘制圆圈\n float sp = 1.0 / count / 2.0;\n float m = mod(dis, sp);\n alpha = step(sp * (1.0 - width * 10.0), m);\n // alpha = clamp(alpha, 0.2, 1.0);\n if (alpha < bgColor.a){\n alpha = bgColor.a;\n diffuse = bgColor.rgb;\n } else {\n diffuse = bgColor.rgb;\n }\n material.alpha = alpha;\n material.diffuse = diffuse;\n // 绘制十字线\n if ((st.s > 0.5 - width / 2.0 && st.s < 0.5 + width / 2.0) || (st.t > 0.5 - width / 2.0 && st.t < 0.5 + width / 2.0)) {\n material.alpha = 0.8;\n material.diffuse = bgColor.rgb;\n return material;\n }\n // 绘制光晕\n float ma = mod(dis + offset, 0.5);\n if (ma < 0.25){\n alpha = ma * 3.0 + alpha;\n } else{\n alpha = 3.0 * (0.5 - ma) + alpha;\n }\n material.alpha = alpha;\n material.diffuse = bgColor.rgb;\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + radians;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = alpha + sectorColor.a;\n material.diffuse = sectorColor.rgb;\n }\n return material;\n }\n",Do={color:"rgba(255,255,255,1)",count:3,duration:1500};class Ao extends at{duration;count;vertical;direction;color;_time;image;name="";constructor(t){super();const i={...Do,...t};Object.prototype.hasOwnProperty.call(i,"vertical")||(i.vertical=1),this.name=`LightWall-${N()}`,this._time=(new Date).getTime(),this.color=e.Color.fromCssColorString(i.color),this.duration=i.duration,this.count=i.count,this.vertical=i.vertical,this.image=i.image,this.direction=i.direction,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.image=this.image,i.vertical=this.vertical,i.direction=this.direction,i.count=this.count,i.duration=this.duration,this.duration&&(i.time=((new Date).getTime()-this._time)%this.duration/this.duration),i}equals(t){return this===t||t instanceof Ao&&e.Property.equals(this.color,t.color)&&this.name===t.name&&this.image===t.image&&this.vertical===t.vertical&&this.direction===t.direction&&this.count===t.count&&this.duration===t.duration}init(){const t=Io({count:this.count,vertical:this.vertical,direction:this.direction});e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,duration:this.duration,vertical:this.vertical,image:this.image,count:this.count,time:-20},source:t},translucent:()=>!0})}}const So=t=>{const i={...Do,...t};return{material:new e.Material({fabric:{type:`LightWall${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),duration:i.duration,vertical:i.vertical,image:i.image,count:i.count,time:-20},source:Io({count:i.count,vertical:i.vertical,direction:i.direction})}})}},Io=e=>{const t=e.vertical?"vertical":"standard",i=e.direction?"+":"-";let n="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";return n+="vertical"===t?`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.t ${i} time)),fract(st.s));\n `:`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.s ${i} time), fract(st.t)));\n `,n+="vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a * color.a;\n material.emission = fragColor.rgb;\n return material;\n }",n},To={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class zo extends at{speed;color;name="";constructor(t){super();const i={...To,...t};this.name=`${Qn.EllipsoidElectric}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof zo&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Ro},translucent:()=>!0})}}const Fo=t=>{const i={...To,...t};return{material:new e.Material({fabric:{type:`${Qn.EllipsoidElectric}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Ro},translucent:!0})}},Ro="\n uniform vec4 color;\n uniform float speed;\n #define pi 3.1415926535\n #define PI2RAD 0.01745329252\n #define TWO_PI (2. * PI)\n\n float rands(float p){\n return fract(sin(p) * 10000.0);\n }\n\n float noise(vec2 p){\n float time = fract( czm_frameNumber * speed / 1000.0);\n float t = time / 20000.0;\n\n if(t > 1.0) t -= floor(t);\n return rands(p.x * 14. + p.y * sin(t) * 0.5);\n }\n\n vec2 sw(vec2 p){\n return vec2(floor(p.x), floor(p.y));\n }\n\n vec2 se(vec2 p){\n return vec2(ceil(p.x), floor(p.y));\n }\n\n vec2 nw(vec2 p){\n return vec2(floor(p.x), ceil(p.y));\n }\n\n vec2 ne(vec2 p){\n return vec2(ceil(p.x), ceil(p.y));\n }\n\n float smoothNoise(vec2 p){\n vec2 inter = smoothstep(0.0, 1.0, fract(p));\n float s = mix(noise(sw(p)), noise(se(p)), inter.x);\n float n = mix(noise(nw(p)), noise(ne(p)), inter.x);\n return mix(s, n, inter.y);\n }\n\n float fbm(vec2 p){\n float z = 2.0;\n float rz = 0.0;\n vec2 bp = p;\n for(float i = 1.0; i < 6.0; i++){\n rz += abs((smoothNoise(p) - 0.5)* 2.0) / z;\n z *= 2.0;\n p *= 2.0;\n }\n return rz;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 st2 = materialInput.st;\n float time = fract( czm_frameNumber * speed / 1000.0);\n if (st.t < 0.5) {\n discard;\n }\n st *= 4.;\n float rz = fbm(st);\n st /= exp(mod( time * 2.0, pi));\n rz *= pow(15., 0.9);\n vec4 temp = vec4(0);\n temp = mix( color / rz, vec4(color.rgb, 0.1), 0.2);\n if (st2.s < 0.05) {\n temp = mix(vec4(color.rgb, 0.1), temp, st2.s / 0.05);\n }\n if (st2.s > 0.95){\n temp = mix(temp, vec4(color.rgb, 0.1), (st2.s - 0.95) / 0.05);\n }\n material.diffuse = temp.rgb;\n material.alpha = temp.a * 2.0;\n return material;\n }\n",Oo={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Lo extends at{speed;color;name="";constructor(t){super();const i={...Oo,...t};this.name=`${Qn.EllipsoidVScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof Lo&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:ko},translucent:()=>!0})}}const Bo=t=>{const i={...Oo,...t};return{material:new e.Material({fabric:{type:`${Qn.EllipsoidVScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:ko},translucent:!0})}},ko="\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n float alpha = abs(smoothstep(0.5,1.,fract( -st.t - time)));\n alpha += .1;\n material.alpha = alpha;\n material.diffuse = color.rgb;\n return material;\n }\n",No={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Go extends at{speed;color;name="";constructor(t){super();const i={...No,...t};this.name=`${Qn.EllipsoidHScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof Go&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Vo},translucent:()=>!0})}}const Uo=t=>{const i={...No,...t};return{material:new e.Material({fabric:{type:`${Qn.EllipsoidHScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Vo},translucent:!0})}},Vo="\nuniform vec4 color; \nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st; \n float t = fract( czm_frameNumber * speed / 1000.0);; \n t *= 1.03;\n float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s); \n alpha += 0.1;\n alpha *= step(-0.5, -abs(0.5-st.t)); \n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n}\n",$o={color:"rgba(255,255,255,1)",speed:1};class Ho extends at{color;speed;name="";constructor(t){super();const i={...$o,...t};this.name=Qn.Zaps,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i}equals(t){return this===t||t instanceof Ho&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(Qn.Zaps,{fabric:{type:Qn.Zaps,uniforms:{uColor:this.color,speed:this.speed,uResolution:new e.Cartesian2(1024,1024)},source:qo},translucent:()=>!0})}}const Wo=t=>{const i={...$o,...t};return{material:new e.Material({fabric:{type:Qn.Zaps,uniforms:{uColor:e.Color.fromCssColorString(i.color),uSpeed:i.speed,uResolution:new e.Cartesian2(1024,1024)},source:qo}})}},qo="\n uniform float uSpeed;\n uniform vec4 uColor;\n uniform vec2 uResolution;\n\n void mainImage(out vec4 o, vec2 u, float time)\n {\n vec2 v = uResolution.xy;\n u = .2*(u+u-v)/v.y;\n\n vec4 z = o = vec4(1,2,3,0);\n for (float a = .5, t = time, i;\n ++i < 19.;\n o += (1. + cos(z+t))\n / length((1.+i*dot(v,v))\n * sin(1.5*u/(.5-dot(u,u)) - 9.*u.yx + t))\n )\n v = cos(++t - 7.*u*pow(a += .03, i)) - 5.*u,\n // use stanh here if shader has black artifacts\n // vvvv\n u += tanh(40. * dot(u *= mat2(cos(i + .02*t - vec4(0,11,33,0)))\n ,u)\n * cos(1e2*u.yx + t)) / 2e2\n + .2 * a * u\n + cos(4./exp(dot(o,o)/1e2) + t) / 3e2;\n\n o = 25.6 / (min(o, 13.) + 164. / o)\n - dot(u, u) / 250.;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput) {\n float time = fract(czm_frameNumber * speed / 1000.0);\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec4 color = vec4(0.0,0.0,0.0,1.0);\n mainImage(color,materialInput.st * uResolution,time);\n\n material.diffuse = color.rgb * uColor.rgb;\n material.alpha = 0.33 + (sin(time * 0.3) + 1.0) / 3.0;\n return material;\n }\n ";class jo extends rt{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){t?this.appearance=t:(this.appearance=new e.MaterialAppearance({material:Mo(this.options.materialOptions||{}),flat:!1,faceForward:!1,translucent:!0,closed:!1,...this.options.appearanceOptions||{}}),this.options.viewer.scene.preRender.addEventListener(()=>{this.appearance.material.uniforms.radians+=3*Math.PI/300}))}}const Zo=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];let Yo=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const o=n>>4;if(1!==o)throw new Error(`Got v${o} data when expected v1.`);const r=Zo[15&n];if(!r)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,a,r,t)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const o=Zo.indexOf(this.ArrayType),r=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+r+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Jo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:r,nodeSize:a}=this,s=[0,o.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,d=s.pop()||0,p=s.pop()||0;if(d-p<=a){for(let a=p;a<=d;a++){const s=r[2*a],c=r[2*a+1];s>=e&&s<=i&&c>=t&&c<=n&&l.push(o[a])}continue}const h=p+d>>1,u=r[2*h],m=r[2*h+1];u>=e&&u<=i&&m>=t&&m<=n&&l.push(o[h]),(0===c?e<=u:t<=m)&&(s.push(p),s.push(h-1),s.push(1-c)),(0===c?i>=u:n>=m)&&(s.push(h+1),s.push(d),s.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:r}=this,a=[0,n.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,d=a.pop()||0,p=a.pop()||0;if(d-p<=r){for(let i=p;i<=d;i++)er(o[2*i],o[2*i+1],e,t)<=l&&s.push(n[i]);continue}const h=p+d>>1,u=o[2*h],m=o[2*h+1];er(u,m,e,t)<=l&&s.push(n[h]),(0===c?e-i<=u:t-i<=m)&&(a.push(p),a.push(h-1),a.push(1-c)),(0===c?e+i>=u:t+i>=m)&&(a.push(h+1),a.push(d),a.push(1-c))}return s}};function Jo(e,t,i,n,o,r){if(o-n<=i)return;const a=n+o>>1;Ko(e,t,a,n,o,r),Jo(e,t,i,n,a-1,1-r),Jo(e,t,i,a+1,o,1-r)}function Ko(e,t,i,n,o,r){for(;o>n;){if(o-n>600){const a=o-n+1,s=i-n+1,l=Math.log(a),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Ko(e,t,i,Math.max(n,Math.floor(i-s*c/a+d)),Math.min(o,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=n,l=o;for(Xo(e,t,n,i),t[2*o+r]>a&&Xo(e,t,n,o);s<l;){for(Xo(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*n+r]===a?Xo(e,t,n,l):(l++,Xo(e,t,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function Xo(e,t,i,n){Qo(e,i,n),Qo(t,2*i,2*n),Qo(t,2*i+1,2*n+1)}function Qo(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function er(e,t,i,n){const o=e-i,r=t-n;return o*o+r*r}const tr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},ir=Math.fround||(nr=new Float32Array(1),e=>(nr[0]=+e,nr[0]));var nr;class or{constructor(e){this.options=Object.assign(Object.create(tr),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const o=`prepare ${e.length} points`;t&&console.time(o),this.points=e;const r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[n,o]=i.geometry.coordinates,a=ir(sr(n)),s=ir(lr(o));r.push(a,s,1/0,t,-1,1),this.options.reduce&&r.push(0)}let a=this.trees[n+1]=this._createTree(r);t&&console.timeEnd(o);for(let e=n;e>=i;e--){const i=+Date.now();a=this.trees[e]=this._createTree(this._cluster(a,e)),t&&console.log("z%d: %d clusters in %dms",e,a.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let o=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,o=180;else if(i>o){const e=this.getClusters([i,n,180,r],t),a=this.getClusters([-180,n,o,r],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(sr(i),lr(r),sr(o),lr(n)),l=a.data,c=[];for(const e of s){const t=this.stride*e;c.push(l[t+5]>1?rr(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",o=this.trees[i];if(!o)throw new Error(n);const r=o.data;if(t*this.stride>=r.length)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r[t*this.stride],l=r[t*this.stride+1],c=o.within(s,l,a),d=[];for(const t of c){const i=t*this.stride;r[i+4]===e&&d.push(r[i+5]>1?rr(r,i,this.clusterProps):this.points[r[i+3]])}if(0===d.length)throw new Error(n);return d}getLeaves(e,t,i){t=t||10,i=i||0;const n=[];return this._appendLeaves(n,e,t,i,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:r,radius:a}=this.options,s=a/r,l=(i-s)/o,c=(i+1+s)/o,d={features:[]};return this._addTileFeatures(n.range((t-s)/o,l,(t+1+s)/o,c),n.data,t,i,o,d),0===t&&this._addTileFeatures(n.range(1-s/o,l,1,c),n.data,o,i,o,d),t===o-1&&this._addTileFeatures(n.range(0,l,s/o,c),n.data,-1,i,o,d),d.features.length?d:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,o){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?o+r.point_count<=n?o+=r.point_count:o=this._appendLeaves(e,r.cluster_id,i,n,o):o<n?o++:e.push(t),e.length===i)break}return o}_createTree(e){const t=new Yo(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,i,n,o,r){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,d;if(s)l=ar(t,e,this.clusterProps),c=t[e],d=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[n,o]=i.geometry.coordinates;c=sr(n),d=lr(o)}const p={type:1,geometry:[[Math.round(this.options.extent*(c*o-i)),Math.round(this.options.extent*(d*o-n))]],tags:l};let h;h=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==h&&(p.id=h),r.features.push(p)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:n,reduce:o,minPoints:r}=this.options,a=i/(n*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=t)continue;s[i+2]=t;const n=s[i],d=s[i+1],p=e.within(s[i],s[i+1],a),h=s[i+5];let u=h;for(const e of p){const i=e*c;s[i+2]>t&&(u+=s[i+5])}if(u>h&&u>=r){let e,r=n*h,a=d*h,m=-1;const g=(i/c<<5)+(t+1)+this.points.length;for(const n of p){const l=n*c;if(s[l+2]<=t)continue;s[l+2]=t;const d=s[l+5];r+=s[l]*d,a+=s[l+1]*d,s[l+4]=g,o&&(e||(e=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),o(e,this._map(s,l)))}s[i+4]=g,l.push(r/u,a/u,1/0,g,-1,u),o&&l.push(m)}else{for(let e=0;e<c;e++)l.push(s[i+e]);if(u>1)for(const e of p){const i=e*c;if(!(s[i+2]<=t)){s[i+2]=t;for(let e=0;e<c;e++)l.push(s[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].properties,o=this.options.map(n);return i&&o===n?Object.assign({},o):o}}function rr(e,t,i){return{type:"Feature",id:e[t+3],properties:ar(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),cr(e[t+1])]}};var n}function ar(e,t,i){const n=e[t+5],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,r=e[t+6],a=-1===r?{}:Object.assign({},i[r]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:o})}function sr(e){return e/360+.5}function lr(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function cr(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}class dr extends rt{options;pointPrimitives=new e.PrimitiveCollection;boundingSphere=new e.BoundingSphere(e.Cartesian3.ZERO,0);pointCollection;labelCollection;billboardCollection;clusterImageCache={};supercluster;constructor(t){super(),this.options=t,this.clacBoundingSphere(this.options.geoJson),this.options.point&&(this.pointCollection=new e.PointPrimitiveCollection,this.pointPrimitives.add(this.pointCollection)),this.options.billboard&&(this.billboardCollection=new e.BillboardCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.billboardCollection)),this.options.label&&(this.labelCollection=new e.LabelCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.labelCollection)),t.cluster?(this.supercluster=new or({radius:this.options.cluster?.radius||mr.radius,maxZoom:this.options.cluster?.maxZoom||mr.maxZoom}),this.initCluster(this.options.viewer,this.options.geoJson)):this.initCollection(this.options.geoJson)}initCollection=async t=>{await this.calcPointHeight(this.options.viewer,t);const i=[];t.features.forEach(t=>{if(i.push(e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),this.options.point){this.pointCollection.add(this.createPoint(t)).properties=t.properties||{}}if(this.options.billboard){this.billboardCollection.add(this.createBillboard(t)).properties=t.properties||{}}if(this.options.label){this.labelCollection.add(this.createLabel(t)).properties=t.properties||{}}})};clacBoundingSphere(t){const i=t.features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0));e.BoundingSphere.fromPoints(i,this.boundingSphere)}createPoint(t){const i={...pr,...this.options.point,...t.properties?.style?.point};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]),color:e.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,outlineColor:e.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createBillboard(t){const i={...ur,...this.options.billboard,...t.properties?.style?.billboard};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),image:i.image,scale:i.scale,width:t.properties?.cluster?void 0:i.width,height:t.properties?.cluster?void 0:i.height,color:t.properties?.cluster?void 0:e.Color.fromCssColorString(i.color),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i.heightReference,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createLabel(t){const i={...hr,...this.options.label,...t.properties?.style?.label};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),text:t.properties?.[i?.field]||i?.field,font:i?.font,fillColor:e.Color.fromCssColorString(i?.fillColor),outlineColor:e.Color.fromCssColorString(i?.outlineColor),outlineWidth:i?.outlineWidth,style:i?.style,scale:i?.scale,showBackground:i?.showBackground,backgroundColor:e.Color.fromCssColorString(i?.backgroundColor),backgroundPadding:e.Cartesian2.fromArray(i?.backgroundPadding),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i?.heightReference,scaleByDistance:i?.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i?.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}initCluster=async(t,i)=>{this.supercluster.load(i.features);let n=e.getTimestamp();this.loadCluster(t),t.camera.changed.addEventListener(()=>{e.getTimestamp()-n<=500||(n=e.getTimestamp(),this.loadCluster(t))})};flyToChildByClusterId(t){const i=this.supercluster?.getChildren(t),n=i?.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),o=e.BoundingSphere.fromPoints(n);return this.options.viewer.camera.flyToBoundingSphere(o),i}loadCluster=t=>{const i=tt(t.camera),n=t.camera.computeViewRectangle(),o=this.supercluster.getClusters([e.Math.toDegrees(n.west),e.Math.toDegrees(n.south),e.Math.toDegrees(n.east),e.Math.toDegrees(n.north)],i);this.clearCollection();const r=this.options.cluster.colorsByRate||mr.colorsByRate,a={type:"FeatureCollection",features:o.map(e=>{const t=e.properties.point_count/this.options.geoJson.features.length,n=Object.keys(r).find(e=>t>Number(e))||"#ff0000";if(e.properties.cluster){const t=this.getClusterImageByCount(r[n],e.properties.point_count,i),o=16*(String(e.properties.point_count).length+1);e.properties.style={...e.properties.style,billboard:{...e.properties.style?.billboard,image:t,pixelOffset:[0,-o/12]}}}return e})};this.initCollection(a)};getClusterImageByCount(t,i,n){if(!this.clusterImageCache[i+t]){const o=16*(String(i).length+1);let r=-Math.PI/12;const a=Math.PI/2,s=Math.PI/6,l=document.createElement("canvas");l.width=o,l.height=o;const c=l.getContext("2d");c.save(),c.scale(o/24,o/24),c.beginPath(),c.arc(12,12,6,0,2*Math.PI),c.fillStyle=t,c.fill(),c.closePath(),c.lineWidth=2,c.fillStyle="rgba(255,255,255,1)",c.font=`${this.calcfontSize(n)}px Microsoft YaHei`,c.textAlign="center",c.textBaseline="middle",c.fillText(`${i}`,11.5,12.5);for(let i=0;i<3;i++)c.beginPath(),c.arc(12,12,8,r,r+a,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.4).toCssColorString(),c.stroke(),c.arc(12,12,11,r,r+a,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.2).toCssColorString(),c.stroke(),c.closePath(),r=r+a+s;c.restore(),this.clusterImageCache[i+t]=l.toDataURL()}return this.clusterImageCache[i+t]}calcfontSize(e){return e<4?4:e-1}async calcPointHeight(t,i){if(this.options.calcHeight)if(t.scene.terrainProvider instanceof e.EllipsoidTerrainProvider)i.features.forEach(e=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=0:e.geometry.coordinates.push(0)});else{const n=t.scene.terrainProvider,o=i.features.map(t=>e.Cartographic.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1])),r=await e.sampleTerrainMostDetailed(n,o);i.features.forEach((e,t)=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=r[t].height:e.geometry.coordinates.push(r[t].height)})}}clearCollection(){this.pointCollection?.removeAll(),this.billboardCollection?.removeAll(),this.labelCollection?.removeAll()}remove(){}removeAll(){this.clearCollection(),this.pointPrimitives.removeAll()}getPrimitive(){return this.pointPrimitives}}const pr={color:"rgba(81,255,0,0.8)",pixelSize:10,outlineColor:"rgba(255,0,0,0.8)",outlineWidth:1},hr={font:"20px sans-serif",fillColor:"rgba(255,255,255,0.8)",outlineColor:"rgba(0,0,0,0.8)",backgroundColor:"rgba(0,0,0,1)",outlineWidth:2,pixelOffset:[0,0],backgroundPadding:[0,0],scale:1,disableDepthTestDistance:0,horizontalOrigin:0,verticalOrigin:0,heightReference:e.HeightReference.CLAMP_TO_GROUND},ur={image:"/icons/cesium-marker.png",scale:1,color:"rgba(255,0,0,1)",rotation:0,width:32,height:32,horizontalOrigin:0,verticalOrigin:0,pixelOffset:[0,-16],heightReference:e.HeightReference.CLAMP_TO_GROUND},mr={radius:60,maxZoom:25,colorsByRate:{.1:"#ff0000",.01:"#ff00ff",.001:"blue",1e-4:"#00ff00"}},gr={width:2,color:"rgba(0,255,0,0.8)"};class fr extends rt{options;polylinePrimitives;constructor(e){super(),this.options=e,this.polylinePrimitives=void 0,this.options.material&&this.setMaterialAppearance(),this.initCollection()}initCollection(){const t=[],i=[];let n;this.options.geoJson.features.forEach(e=>{"MultiLineString"===e.geometry.type?e.geometry.coordinates.forEach(t=>{i.push({coordinates:t,properties:e.properties})}):i.push({coordinates:e.geometry.coordinates,properties:e.properties})}),i.forEach(i=>{const n=i.coordinates.map(t=>e.Cartesian3.fromDegrees(t[0],t[1],t[2])),o={...gr,...this.options?.line,...i.properties?.style?.line};t.push(new e.GeometryInstance({id:N(),geometry:new e.GroundPolylineGeometry({positions:n,width:o?.width}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(o.color))}}))}),n=this.appearance?this.appearance:new e.PolylineColorAppearance,this.polylinePrimitives=new e.GroundPolylinePrimitive({geometryInstances:t,appearance:n})}getPrimitive(){return this.polylinePrimitives}setMaterialAppearance(){this.appearance=new e.MaterialAppearance({material:this.options.material})}}const vr={width:2,color:"rgba(0,255,0,0.8)"};class yr extends rt{options;primitives;constructor(e){super(),this.options=e,this.primitives=void 0,this.initCollection()}initCollection(){const t=[];this.options.geoJson.features.forEach(i=>{let n;n="Polygon"===i.geometry.type?new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(i.geometry.coordinates[0].flat())):Cr(i.geometry);const o={...vr,...this.options?.line,...i.properties?.style?.line},r=N();i.properties&&(i.properties.id=r);const a=new e.GeometryInstance({id:r,geometry:new e.PolygonGeometry({polygonHierarchy:n}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(o.color))}});t.push(a),a.properties=i.properties}),this.primitives=new e.GroundPrimitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({})})}getPrimitive(){return this.primitives}getAppearance(t){this.appearance=t||new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("rgba(81,255,0,0.8)")})})}}const Cr=t=>new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(t.coordinates[0][0].flat()));function wr(e,t,i,n,o,r){if(o-n<=i)return;const a=n+o>>1;br(e,t,a,n,o,r%2),wr(e,t,i,n,a-1,r+1),wr(e,t,i,a+1,o,r+1)}function br(e,t,i,n,o,r){for(;o>n;){if(o-n>600){const a=o-n+1,s=i-n+1,l=Math.log(a),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);br(e,t,i,Math.max(n,Math.floor(i-s*c/a+d)),Math.min(o,Math.floor(i+(a-s)*c/a+d)),r)}const a=t[2*i+r];let s=n,l=o;for(Pr(e,t,n,i),t[2*o+r]>a&&Pr(e,t,n,o);s<l;){for(Pr(e,t,s,l),s++,l--;t[2*s+r]<a;)s++;for(;t[2*l+r]>a;)l--}t[2*n+r]===a?Pr(e,t,n,l):(l++,Pr(e,t,l,o)),l<=i&&(n=l+1),i<=l&&(o=l-1)}}function Pr(e,t,i,n){_r(e,i,n),_r(t,2*i,2*n),_r(t,2*i+1,2*n+1)}function _r(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function xr(e,t,i,n){const o=e-i,r=t-n;return o*o+r*r}const Mr=e=>e[0],Er=e=>e[1];class Dr{constructor(e,t=Mr,i=Er,n=64,o=Float64Array){this.nodeSize=n,this.points=e;const r=e.length<65536?Uint16Array:Uint32Array,a=this.ids=new r(e.length),s=this.coords=new o(2*e.length);for(let n=0;n<e.length;n++)a[n]=n,s[2*n]=t(e[n]),s[2*n+1]=i(e[n]);wr(a,s,n,0,a.length-1,0)}range(e,t,i,n){return function(e,t,i,n,o,r,a){const s=[0,e.length-1,0],l=[];let c,d;for(;s.length;){const p=s.pop(),h=s.pop(),u=s.pop();if(h-u<=a){for(let a=u;a<=h;a++)c=t[2*a],d=t[2*a+1],c>=i&&c<=o&&d>=n&&d<=r&&l.push(e[a]);continue}const m=Math.floor((u+h)/2);c=t[2*m],d=t[2*m+1],c>=i&&c<=o&&d>=n&&d<=r&&l.push(e[m]);const g=(p+1)%2;(0===p?i<=c:n<=d)&&(s.push(u),s.push(m-1),s.push(g)),(0===p?o>=c:r>=d)&&(s.push(m+1),s.push(h),s.push(g))}return l}(this.ids,this.coords,e,t,i,n,this.nodeSize)}within(e,t,i){return function(e,t,i,n,o,r){const a=[0,e.length-1,0],s=[],l=o*o;for(;a.length;){const c=a.pop(),d=a.pop(),p=a.pop();if(d-p<=r){for(let o=p;o<=d;o++)xr(t[2*o],t[2*o+1],i,n)<=l&&s.push(e[o]);continue}const h=Math.floor((p+d)/2),u=t[2*h],m=t[2*h+1];xr(u,m,i,n)<=l&&s.push(e[h]);const g=(c+1)%2;(0===c?i-o<=u:n-o<=m)&&(a.push(p),a.push(h-1),a.push(g)),(0===c?i+o>=u:n+o>=m)&&(a.push(h+1),a.push(d),a.push(g))}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}function Ar(t){t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT),this._enabled=e.defaultValue(t.enabled,!1),this._pixelRange=e.defaultValue(t.pixelRange,80),this._minimumClusterSize=e.defaultValue(t.minimumClusterSize,2),this._clusterBillboards=e.defaultValue(t.clusterBillboards,!0),this._clusterLabels=e.defaultValue(t.clusterLabels,!0),this._clusterPoints=e.defaultValue(t.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=e.defaultValue(t.show,!0)}function Sr(e){return e.coord.x}function Ir(e){return e.coord.y}function Tr(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const zr=new e.BoundingRectangle;function Fr(t,i,n,o,r){if(e.defined(t._labelCollection)&&o._clusterLabels?r=e.Label.getScreenSpaceBoundingBox(t,i,r):e.defined(t._billboardCollection)&&o._clusterBillboards?r=e.Billboard.getScreenSpaceBoundingBox(t,i,r):e.defined(t._pointPrimitiveCollection)&&o._clusterPoints&&(r=e.PointPrimitive.getScreenSpaceBoundingBox(t,i,r)),Tr(r,n),o._clusterLabels&&!e.defined(t._labelCollection)&&e.defined(t.id)&&Lr(o,t.id.id)&&e.defined(t.id._label)){const a=o._collectionIndicesByEntity[t.id.id].labelIndex,s=o._labelCollection.get(a),l=e.Label.getScreenSpaceBoundingBox(s,i,zr);Tr(l,n),r=e.BoundingRectangle.union(r,l,r)}return r}function Rr(t,i){if(t.clusterShow=!0,!e.defined(t._labelCollection)&&e.defined(t.id)&&Lr(i,t.id.id)&&e.defined(t.id._label)){const e=i._collectionIndicesByEntity[t.id.id].labelIndex;i._labelCollection.get(e).clusterShow=!0}}function Or(e,t,i,n){const o={billboard:n._clusterBillboardCollection.add(),label:n._clusterLabelCollection.add(),point:n._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=i,o.billboard.position=o.label.position=o.point.position=e,n._clusterEvent.raiseEvent(i,o)}function Lr(t,i){return e.defined(t)&&e.defined(t._collectionIndicesByEntity[i])&&e.defined(t._collectionIndicesByEntity[i].labelIndex)}function Br(t,i,n,o,r){if(!e.defined(t))return;const a=t.length;for(let s=0;s<a;++s){const a=t.get(s);if(a.clusterShow=!1,!a.show||r._scene.mode===e.SceneMode.SCENE3D&&!o.isPointVisible(a.position))continue;const l=a.computeScreenSpacePosition(n);e.defined(l)&&i.push({index:s,collection:t,clustered:!1,coord:l})}}const kr=new e.BoundingRectangle,Nr=new e.BoundingRectangle,Gr=new e.BoundingRectangle;function Ur(t,i,n,o){return function(r){let a=this[t];e.defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s,l,c=this._collectionIndicesByEntity[r.id];if(e.defined(c)||(c=this._collectionIndicesByEntity[r.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),e.defined(a)&&e.defined(c[o]))return a.get(c[o]);e.defined(a)||(a=this[t]=new i({scene:this._scene}));const d=this[n];return d.length>0?(s=d.pop(),l=a.get(s)):(l=a.add(),s=a.length-1),c[o]=s,Promise.resolve().then(()=>{this._clusterDirty=!0}),l}}function Vr(t,i){const n=t._collectionIndicesByEntity[i];e.defined(n.billboardIndex)||e.defined(n.labelIndex)||e.defined(n.pointIndex)||delete t._collectionIndicesByEntity[i]}function $r(t){if(!e.defined(t))return;const i=t.length;for(let e=0;e<i;++e)t.get(e).clusterShow=!0}Ar.prototype._initialize=function(t){this._scene=t;const i=(n=this,function(t){if(e.defined(t)&&t<.05||!n.enabled)return;const i=n._scene,o=n._labelCollection,r=n._billboardCollection,a=n._pointCollection;if(!e.defined(o)&&!e.defined(r)&&!e.defined(a)||!n._clusterBillboards&&!n._clusterLabels&&!n._clusterPoints)return;let s=n._clusterLabelCollection,l=n._clusterBillboardCollection,c=n._clusterPointCollection;e.defined(s)?s.removeAll():s=n._clusterLabelCollection=new e.LabelCollection({scene:i}),e.defined(l)?l.removeAll():l=n._clusterBillboardCollection=new e.BillboardCollection({scene:i}),e.defined(c)?c.removeAll():c=n._clusterPointCollection=new e.PointPrimitiveCollection;const d=n._pixelRange,p=n._minimumClusterSize,h=n._previousClusters,u=[],m=n._previousHeight,g=i.camera.positionCartographic.height,f=i.mapProjection.ellipsoid,v=i.camera.positionWC,y=new e.EllipsoidalOccluder(f,v),C=[];let w,b,P,_,x,M,E,D,A,S,I,T;n._clusterLabels&&Br(o,C,i,y,n),n._clusterBillboards&&Br(r,C,i,y,n),n._clusterPoints&&Br(a,C,i,y,n);const z=new Dr(C,Sr,Ir,64,Int32Array);if(g<m)for(P=h.length,w=0;w<P;++w){const t=h[w];if(!y.isPointVisible(t.position))continue;const o=e.Billboard._computeScreenSpacePosition(e.Matrix4.IDENTITY,t.position,e.Cartesian3.ZERO,e.Cartesian2.ZERO,i);if(!e.defined(o))continue;const r=1-g/m;let a=t.width=t.width*r,s=t.height=t.height*r;a=Math.max(a,t.minimumWidth),s=Math.max(s,t.minimumHeight);const l=o.x-.5*a,c=o.y-.5*s,d=o.x+a,f=o.y+s;for(x=z.range(l,c,d,f),M=x.length,S=0,A=[],b=0;b<M;++b)E=x[b],D=C[E],D.clustered||(++S,I=D.collection,T=D.index,A.push(I.get(T).id));if(S>=p)for(Or(t.position,S,A,n),u.push(t),b=0;b<M;++b)C[x[b]].clustered=!0}for(P=C.length,w=0;w<P;++w){const t=C[w];if(t.clustered)continue;t.clustered=!0,I=t.collection,T=t.index;const i=I.get(T);_=Fr(i,t.coord,d,n,kr);const o=e.BoundingRectangle.clone(_,Nr);x=z.range(_.x,_.y,_.x+_.width,_.y+_.height),M=x.length;const r=e.Cartesian3.clone(i.position);for(S=1,A=[i.id],b=0;b<M;++b)if(E=x[b],D=C[E],!D.clustered){const t=D.collection.get(D.index),i=Fr(t,D.coord,d,n,Gr);e.Cartesian3.add(t.position,r,r),e.BoundingRectangle.union(o,i,o),++S,A.push(t.id)}if(S>=p){const t=e.Cartesian3.multiplyByScalar(r,1/S,r);for(Or(t,S,A,n),u.push({position:t,width:o.width,height:o.height,minimumWidth:_.width,minimumHeight:_.height}),b=0;b<M;++b)C[x[b]].clustered=!0}else Rr(i,n)}0===s.length&&(s.destroy(),n._clusterLabelCollection=void 0),0===l.length&&(l.destroy(),n._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),n._clusterPointCollection=void 0),n._previousClusters=u,n._previousHeight=g});var n;this._cluster=i,this._removeEventListener=t.camera.changed.addEventListener(i)},Object.defineProperties(Ar.prototype,{enabled:{get(){return this._enabled},set(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get(){return this._pixelRange},set(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get(){return this._minimumClusterSize},set(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get(){return this._clusterEvent}},clusterBillboards:{get(){return this._clusterBillboards},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get(){return this._clusterLabels},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get(){return this._clusterPoints},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),Ar.prototype.getLabel=Ur("_labelCollection",e.LabelCollection,"_unusedLabelIndices","labelIndex"),Ar.prototype.removeLabel=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._labelCollection)||!e.defined(i)||!e.defined(i.labelIndex))return;const n=i.labelIndex;i.labelIndex=void 0,Vr(this,t.id);const o=this._labelCollection.get(n);o.show=!1,o.text="",o.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0},Ar.prototype.getBillboard=Ur("_billboardCollection",e.BillboardCollection,"_unusedBillboardIndices","billboardIndex"),Ar.prototype.removeBillboard=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._billboardCollection)||!e.defined(i)||!e.defined(i.billboardIndex))return;const n=i.billboardIndex;i.billboardIndex=void 0,Vr(this,t.id);const o=this._billboardCollection.get(n);o.id=void 0,o.show=!1,o.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0},Ar.prototype.getPoint=Ur("_pointCollection",e.PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),Ar.prototype.removePoint=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._pointCollection)||!e.defined(i)||!e.defined(i.pointIndex))return;const n=i.pointIndex;i.pointIndex=void 0,Vr(this,t.id);const o=this._pointCollection.get(n);o.show=!1,o.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0},Ar.prototype.update=function(t){if(!this.show)return;let i;var n;e.defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(i=t.commandList,t.commandList=[],this._labelCollection.update(t),t.commandList=i),e.defined(this._billboardCollection)&&this._billboardCollection.length>0&&!e.defined(this._billboardCollection.get(0).width)&&(i=t.commandList,t.commandList=[],this._billboardCollection.update(t),t.commandList=i),this._enabledDirty&&(this._enabledDirty=!1,(n=this).enabled||(e.defined(n._clusterLabelCollection)&&n._clusterLabelCollection.destroy(),e.defined(n._clusterBillboardCollection)&&n._clusterBillboardCollection.destroy(),e.defined(n._clusterPointCollection)&&n._clusterPointCollection.destroy(),n._clusterLabelCollection=void 0,n._clusterBillboardCollection=void 0,n._clusterPointCollection=void 0,$r(n._labelCollection),$r(n._billboardCollection),$r(n._pointCollection)),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),e.defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(t),e.defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(t),e.defined(this._clusterPointCollection)&&this._clusterPointCollection.update(t),e.defined(this._labelCollection)&&this._labelCollection.update(t),e.defined(this._billboardCollection)&&this._billboardCollection.update(t),e.defined(this._pointCollection)&&this._pointCollection.update(t)},Ar.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),e.defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};class Hr extends rt{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;this.needUpdate=!1;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){this.appearance=t||new e.MaterialAppearance({material:_o(this.options.materialOptions),flat:!1,faceForward:!1,translucent:!0,closed:!1})}}class Wr extends rt{gridPrimitiveCollection=new e.PrimitiveCollection;polygonPrimitive;outlinePrimitive;options;constructor(t){super(),this.options=t,this.gridPrimitiveCollection=new e.PrimitiveCollection,this.polygonPrimitive=this.createGridPolygonPrimitive(),this.outlinePrimitive=this.createGridOutlinePrimitive()}createGridPolygonPrimitive(){if(!this.options.fill)return;const t=[];this.options.vertices.forEach(i=>{const n=e.Color.fromCssColorString(this.options.fillColor),o=Ut(i.positions,n,`grid-${i.id}`);t.push(o)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({flat:!0,translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}createGridOutlinePrimitive(){if(!this.options.outline)return;const t=[];this.options.vertices.forEach(i=>{const n=e.Color.fromCssColorString(this.options.outlineColor),o=Vt(i.positions,n,`grid-${i.id}`);t.push(o)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PolylineColorAppearance({translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}getPrimitive(){return this.gridPrimitiveCollection}selectGrids(t){const i=e.Color.fromCssColorString(this.options.fillSelectColor),n=e.Color.fromCssColorString(this.options.outlineSelectColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(n)}})}unSelectGrids(t){const i=e.Color.fromCssColorString(this.options.fillColor),n=e.Color.fromCssColorString(this.options.outlineColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(n)}})}}const qr=t=>{const i=[],n={LEFT_CLICK:[]};return t.scene.postRender.addEventListener(()=>{i.forEach(i=>{if(i.distanceDisplayCondition){const n=e.Cartesian3.distance(i.position,t.camera.position);if(n>=i.distanceDisplayCondition.far||n<=i.distanceDisplayCondition.near)return void(i.divEle.style.display="none")}const n=t.scene.cartesianToCanvasCoordinates(i.position);if(n){i.divEle.style.display="block";const e=i.divEle.getBoundingClientRect();let t=2;"left"===i.align&&(t=e.width+i.offset.x),"right"===i.align&&(t=1),i.divEle.style.left=n.x/i.autoFit.x-(e.width+i.offset.x)/i.autoFit.x/t+"px",i.divEle.style.top=n.y/i.autoFit.y-(e.height+i.offset.y)/i.autoFit.y+"px"}else i.divEle.style.display="none"})}),{divLabels:i,set:o=>{const r={id:o.divEle.id||N(),...o};return r.autoFit||(r.autoFit=e.Cartesian2.fromElements(1,1)),r.offset||(r.offset=e.Cartesian2.fromElements(0,0)),r.align||(r.align="center"),r.divEle.id=r.id,r.divEle.style.position="absolute",r.userSelect||(r.divEle.style.userSelect="none"),r.parentEle?(r.parentEle.style.position="relative",r.parentEle.appendChild(r.divEle)):(t._element.style.position="relative",t._element.appendChild(r.divEle)),i.push(r),r.divEle.addEventListener("click",()=>{n.LEFT_CLICK.forEach(e=>{e(r)})}),r},setPosition:(e,t)=>{const n=i.findIndex(t=>t.id===e);if(-1!==n){i[n].position=t}},remove:e=>{const t=i.findIndex(t=>t.id===e.id);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},removeAll:()=>{i.forEach(e=>{e.divEle.remove()}),i.length=0},removeById:e=>{const t=i.findIndex(t=>t.id===e);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},addEventListener:(e,t)=>{n[e]&&n[e].push(t)}}},jr=t=>{const i=new e.ClippingPlaneCollection({edgeColor:e.Color.YELLOW,enabled:!0,modelMatrix:e.Matrix4.IDENTITY,edgeWidth:2});t.scene.globe.clippingPlanes=i,t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{Object.assign(t,{unionClippingRegions:!1,...t}),i.unionClippingRegions=t.unionClippingRegions||!1,i.removeAll();let n=t?.positions;n=t.unionClippingRegions?c(n):d(n),n.forEach((t,o)=>{const r=(o+1)%n.length,a=n[r];let s=e.Cartesian3.add(t,a,new e.Cartesian3);s=e.Cartesian3.multiplyByScalar(s,.5,s);const l=e.Cartesian3.normalize(s,new e.Cartesian3);let c=e.Cartesian3.subtract(a,s,new e.Cartesian3);c=e.Cartesian3.normalize(c,c);let d=e.Cartesian3.cross(c,l,new e.Cartesian3);d=e.Cartesian3.normalize(d,d);const p=new e.Plane(d,0),h=e.Plane.getPointDistance(p,s);i.add(new e.ClippingPlane(d,h))})},remove:()=>{i.removeAll()},removeAll:()=>{i.removeAll()},destroy:()=>{}}},Zr=t=>{const i=new e.ClippingPolygonCollection;t.scene.globe.clippingPolygons=i;const n=new e.CustomDataSource("clipPolygon");t.dataSources.add(n),t.scene.globe.backFaceCulling=!1,t.scene.globe.showSkirts=!1;return{set:t=>{t={inverse:!1,...t};const o=t?.positions,r=new e.ClippingPolygon({positions:o});i.add(r);const a=u(p(o).map(e=>(e.height=-t.depth,e))),s=n.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});n.entities.add({polygon:{hierarchy:a,perPositionHeight:!0,extrudedHeight:t.depth,material:new e.ImageMaterialProperty({image:"/icons/terrain/poly-soil.jpg"})}});return{id:N(),polygon:r,bottomEntity:s}},remove:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,n.entities.removeAll()},removeAll:()=>{i.isDestroyed()||i.removeAll(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection,n.entities.removeAll()},destroy:()=>{}}},Yr=t=>{const i=new e.CustomDataSource("flood-analysis");t.dataSources.add(i);return{set:e=>{const{positions:t,type:i,speed:n}=e;return console.log(t,e,i,n),{id:N()}},remove:()=>{},removeAll:()=>{i.entities.removeAll()},destroy:()=>{t.dataSources.remove(i)}}},Jr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1}),n=new e.PrimitiveCollection({destroyPrimitives:!1}),o=new e.PointPrimitiveCollection,r=new e.LabelCollection;n.add(o),i.add(r),i.add(n),t.scene.primitives.add(i);const a=(t,i)=>{t.forEach(t=>{i.add({position:t,color:e.Color.TRANSPARENT})})},s=(t,i)=>{const n=new e.GroundPolylineGeometry({positions:t,width:3}),o=new e.GeometryInstance({geometry:n});i.add(new e.GroundPolylinePrimitive({geometryInstances:o,asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#ff00ff").withAlpha(.5)})})}))},l=(t,i)=>{const n=new e.WallGeometry({positions:t}),o=e.WallGeometry.createGeometry(n),r=new e.GeometryInstance({geometry:o});i.add(new e.Primitive({geometryInstances:[r],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#00ff00").withAlpha(.5)})})}))},c=(t,i,n)=>{const o=new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),height:i}),r=new e.GeometryInstance({geometry:o});n.add(new e.Primitive({geometryInstances:[r],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#0088ff").withAlpha(.5)})})}))},d=(t,i,n,o,r)=>{const a=t.map(t=>e.Cartographic.fromCartesian(t).height),s=Math.min(...a),l=Math.max(...a);let c=0;for(let e=0;e<a.length;e++)c+=(a[e]-s)*i*i;const d=e.Cartesian3.fromDegrees(n.geometry.coordinates[0],n.geometry.coordinates[1],l),p={},u=r*l;c?p["挖方体积"]=`${h(c)}方\n`:c=0,u&&(p["填方体积"]=`${h(u-c)}方\n`),r&&(p["横切面积"]=`${h(r)}平方米\n`),s&&(p["最小高程"]=`${h(s)}米\n`),l&&(p["最大高程"]=`${h(l)}米\n`),s&&(p["基准面高程"]=`${h(s)}米`);let m="";Object.keys(p).forEach(e=>{m+=`${e}:${p[e]}`}),o.add({position:d,text:m,font:"16px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})},p=(t,i,n)=>{t.forEach((t,o)=>{n.add({position:t,text:`高程:${h(i[o].height)}米`,font:"14px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})})},h=e=>{const t=["","万","百万","千万","亿"];let i=0;for(;e>=1e4&&i<t.length-1;)e/=1e4,i++;return`${e.toFixed(2).replace(/\.?0+$/,"")}${t[i]}`};return{set:h=>{const u=g(h.positions),m=u.map(t=>{const i=e.Cartographic.fromCartesian(t);return{lng:e.Math.toDegrees(i.longitude),lat:e.Math.toDegrees(i.latitude),height:i.height}}),f=Math.min(...m.map(e=>e.height)),v=ie([m.map(e=>[e.lng,e.lat])]),y=ge(v),C=Math.sqrt(ge(v)/200),w=Ue(v),b=Ge(v),P=function(e,t,i={}){i.mask&&!i.units&&(i.units="kilometers");for(var n=[],o=e[0],r=e[1],a=e[2],s=e[3],l=t/he([o,r],[a,r],i)*(a-o),c=t/he([o,r],[o,s],i)*(s-r),d=a-o,p=s-r,h=Math.floor(d/l),u=(p-Math.floor(p/c)*c)/2,m=o+(d-h*l)/2;m<=a;){for(var g=r+u;g<=s;){var f=te([m,g],i.properties);i.mask?Le(f,i.mask)&&n.push(f):n.push(f),g+=c}m+=l}return oe(n)}(we(w),C,{units:"meters"}),_=He(P,v).features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1]));return t.scene.clampToHeightMostDetailed(_).then(e=>{a(e,o),c(u,f,i),s(u,n),l(u,i),d(e,C,b,r,y),p(u,m,r)}),{id:N()}},remove:()=>{},removeAll:()=>{r.removeAll(),o.removeAll(),n.removeAll(),i.removeAll(),n.add(o),i.add(n),i.add(r)},destroy:()=>{}}},Kr=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1});let n,o="/icons/markers/mark-icon.png";const r=[];t.scene.primitives.add(i);const a=i=>{if(!i)return n&&t.entities.remove(n),void(n=void 0);n||(n=t.entities.add({position:m(new e.Cartographic(i.longitude,i.latitude,i.height)),billboard:{image:o,scale:.5,verticalOrigin:e.VerticalOrigin.BOTTOM,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),n.position=m(new e.Cartographic(i.longitude,i.latitude,i.height))};return{set:async e=>{e.tipMarkerUrl&&(o=e.tipMarkerUrl);const{positions:i}=e;let n=Ze(i);const a=Math.floor(n/e.pointDistance);let s=nt(i,a);s=await t.scene.clampToHeightMostDetailed(s),n=0;const l=s.map((e,t)=>{let i=0;t>0&&(i=je(s[t-1],e),n+=i);return{...h(e),distance:i,allDistance:n}}),c={id:N(),datas:l};return r.push(c),c},remove:e=>{const t=r.findIndex(t=>t.id===e.id);-1!==t&&r.splice(t,1),a()},removeAll:()=>{i.removeAll(),a()},destroy:()=>{t.scene.primitives.remove(i)},changeTipPoint:a}},Xr=e=>{const t=new PrimitiveCollection({destroyPrimitives:!1});let i=null,n="";const o=[];e.scene.primitives.add(t);const r=async(t,i,n)=>{const o=JSON.parse(JSON.stringify(t));await e.scene.clampToHeightMostDetailed(o)},a=t=>{if(!t)return i&&e.entities.remove(i),void(i=void 0);i||(i=e.entities.add({position:m(new Cartographic(t.longitude,t.latitude,t.height)),billboard:{image:n,scale:.5,verticalOrigin:VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),i.position=m(new Cartographic(t.longitude,t.latitude,t.height))};return{set:async t=>{t.tipMarkerUrl&&(n=t.tipMarkerUrl);const i=t.layers;return e.terrainProvider instanceof EllipsoidTerrainProvider||(e.terrainProvider,e.terrainProvider=new EllipsoidTerrainProvider),i.forEach(e=>{e.visible=!1}),new Promise(e=>{setTimeout(()=>{const{positions:i}=t,n=Ze(i),o=Math.floor(n/t.pointDistance),a=nt(i,o).filter(e=>e&&e.x&&e.y&&e.z),s={id:N(),datas:[]};r(a),e(s)},500)})},remove:e=>{const t=o.findIndex(t=>t.id===e.id);-1!==t&&o.splice(t,1),a(void 0)},removeAll:()=>{t.removeAll(),a(void 0)},destroy:()=>{e.scene.primitives.remove(t)},changeTipPoint:a}};export{at as BaseMaterialProperty,rt as BasePrimitive,Po as CircleApertureMaterialProperty,Hr as CircleAperturePrimitive,yo as CircleRaderFanMaterialProperty,mo as CircleRaderWaveMaterialProperty,co as CircleWaveMaterialProperty,t as Common,ii as CoordinateTransformer,l as DefaultViewerOptions,Li as Draw,Oi as DrawEventType,ki as DrawStyle,zo as EllipsoidElectricMaterialProperty,Go as EllipsoidHScanMaterialProperty,Lo as EllipsoidVScanMaterialProperty,Ft as FlyAttitude,Wr as GridPrimitives,yr as GroundPolygonPrimitives,fr as GroundPolylinePrimitives,Ao as LightWallMaterialProperty,Xn as Material,Ar as PointClusterPrimitives,dr as PointPrimitives,ro as PolylineFlowMaterialProperty,to as PolylineTrailMaterialProperty,V as Popup,jo as RadereScanPrimitive,Rt as RoamStatus,U as Tooltip,pi as TransformsFor3dtiles,Ho as ZapsMaterialProperty,Bn as addDrawActions,Je as calcArea,ot as calcBoundingSphereFromPositions,it as calcCameraHeightFromZoom,je as calcGeodesicDistance,Ze as calcGeodesicDistances,nt as calcLerpPosition,Ye as calcPoistionCenter,Qe as calcSceneHeightFromPositions,We as calcSpaceDistance,qe as calcSpaceDistances,Xe as calcTerrainHeightFromPositions,Ke as calcTriangleArea,tt as calcZoomFromCameraHeight,et as clacPositionsForParabola,Mi as createBloomTargetStage,kt as createBottomStatusBar,_o as createCircleApertureMaterial,Co as createCircleRaderFanMaterial,po as createCircleWaveMaterial,jr as createClipPlaneAnalysis,Zr as createClipPolygonAnalysis,qr as createDivLabelHandler,Kn as createDrawHandler,zi as createDroneAnimCustomShader,Y as createEagleEye,Fo as createEllipsoidElectricMaterial,Uo as createEllipsoidHScanMaterial,Bo as createEllipsoidVScanMaterial,Jr as createFillAndDigAnalysis,Yr as createFloodAnalysis,xi as createFogStage,_i as createHeightFogStage,yi as createHighLightStage,Si as createLightBandCustomShader,So as createLightWallMaterial,Ai as createLightningStage,Xr as createModelProfileAnalysis,Gt as createOpenAnim,Ri as createOutLineEffect,wi as createOutlineStage,ao as createPoylineFlowMaterial,Kr as createProfileAnalysis,go as createRaderWaveMaterial,Di as createRainCoverStage,Ei as createRainStage,zt as createRoamHandler,J as createRollerShutterHandler,Mo as createScanRadarMaterial,It as createSkyBox,Tt as createSkyBoxOnGround,Ci as createSkylineStage,bi as createSnowCoverStage,Pi as createSnowStage,K as createSplitScreenHandler,io as createTrailMaterial,Wo as createZapsMaterial,F as flyByRotateOut,z as flyByRotatePoint,x as flyToCameraView,D as flyToCesium3DTile,M as flyToDataSource,A as flyToFromSphere,E as flyToImagery,b as flyToLnglat,I as flyToNorth,P as flyToPosition,S as flyToRectangleBounds,li as getAllFeaturesFrom3dTiles,ci as getAllTilesFrom3dTiles,_ as getCameraView,s as getCesiumForAutoFitScale,G as getInoCesiumBaseUrl,T as getScreenCenterPoint,n as initCesium,L as initCesiumEvent,ai as load3dTiles,vi as loadI3s,gi as loadModel,hi as loadTerrain,mi as loadTerrainFromCesium,ni as loadTianDiTu,fi as loads3m,$t as makeGridFromElevationExtrema,Ut as makeGridToInstanceForBox,Vt as makeGridToInstanceForLine,m as makeLnglatToPosition,v as makeLnglatsToLineGeojson,f as makeLnglatsToPointGeojson,y as makeLnglatsToPolygonGeojson,u as makeLnglatsToPositions,g as makePositionsClose,d as makePositionsForAntiClockwise,c as makePositionsForClockwise,p as makePositionsToLnglats,h as makePositiontoLnglat,C as makeYawPitchRollToHeadingPitchRoll,Ht as mekeGridPolygonAndHeight,N as numberId,W as randomColor,$ as randomPointToGeoJson,j as randomPolygonToGeoJson,q as randomPolylineToGeoJson,ui as removeTerrain,O as setCameraAutoBackTiltToZero,a as setCesiumForAutoFitScale,o as setGlobeEnabled,r as setGlobeOpatity,si as setHeightOffsetFor3dTiles,oi as setImageLayerTheme,w as setViewToLnglat,R as twinkleModel};
|
|
1
|
+
import*as e from"cesium";export{e as Cesium};var t=Object.freeze({__proto__:null});let i=1;const n=(t,i)=>{i||(i={token:""}),i.token&&(e.Ion.defaultAccessToken=i.token),e.Camera.DEFAULT_VIEW_RECTANGLE=e.Rectangle.fromDegrees(90,-20,110,90);const n={...l,...i},r=new e.Viewer(t,n);return r.imageryLayers.remove(r.imageryLayers.get(0)),r._cesiumWidget._creditContainer.style.display="none",r.scene.postProcessStages.fxaa.enabled=!0,r.scene.msaaSamples=8,r.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),r.scene.globe.depthTestAgainstTerrain=!0,r.scene.globe.showGroundAtmosphere=!0,r.scene.globe.enableLighting=!1,r.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),r},r=(t,i)=>{const n=i?1:0;t.scene.skyBox.show=i,t.scene.skyAtmosphere.show=i,t.scene.globe.dynamicAtmosphereLighting=i,t.scene.globe.dynamicAtmosphereLightingFromSun=i,t.scene.globe.translucency.backFaceAlpha=n,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${n})`),t.scene.globe.showGroundAtmosphere=i,i?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${n})`),t.scene.globe.material=void 0,t.scene.globe.translucency.enabled=!1):(t.scene.globe.translucency.enabled=!1,t.scene.globe.undergroundColor=e.Color.fromCssColorString(`rgba(0, 0, 0,${n})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${n})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${n})`)}}}))},o=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},s=e=>{i=e},a=()=>i,l={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!0,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!1,scene3DOnly:!0,navigation:!1,navigationInstructionsInitiallyVisible:!1,showRenderLoopErrors:!0,orderIndependentTranslucency:!1,contextOptions:{webgl:{alpha:!0}}},c=t=>{let i=0;for(let n=0;n<t.length;n++){const r=t[n],o=t[(n+1)%t.length];i+=e.Cartesian3.cross(r,o,new e.Cartesian3).z}return i>0?t.reverse():t},d=t=>{let i=0;for(let n=0;n<t.length;n++){const r=t[n],o=t[(n+1)%t.length];i+=e.Cartesian3.cross(r,o,new e.Cartesian3).z}return i<0?t.reverse():t},u=e=>e.map(e=>h(e)),h=t=>{const i=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(i.longitude),latitude:e.Math.toDegrees(i.latitude),height:i.height}},p=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),m=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),f=e=>{const t=e[0],i=e[e.length-1];return t.x===i.x&&t.y===i.y&&t.z===i.z?e:[...e,e[0]]},g=e=>{const t=[];return e.forEach(e=>{t.push({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{height:e.height}})}),{type:"FeatureCollection",features:t}},v=e=>{const t=[];return e.forEach((i,n)=>{0!==n&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[n-1].longitude,e[n-1].latitude],[i.longitude,i.latitude]]},properties:{height:i.height}})}),{type:"FeatureCollection",features:t}},y=e=>{const t=[];return t.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e.map(e=>[e.longitude,e.latitude])]},properties:{heights:e.map(e=>e.height)}}),{type:"FeatureCollection",features:t}},_=t=>({heading:e.Math.toRadians(t.yaw+(t.offsetYaw||0)),pitch:e.Math.toRadians(t.pitch),roll:e.Math.toRadians(t.roll)}),C=t=>{const{lng:i,lat:n,height:r,viewer:o}=t;o.scene.camera.setView({destination:e.Cartesian3.fromDegrees(i,n,r||1e4)})},w=t=>{const{lng:i,lat:n,height:r,viewer:o}=t;o.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(i,n,r||1e4)})},b=e=>{const{position:t,viewer:i}=e;i.scene.camera.flyTo({destination:t})};function x(t){const i=t.camera.heading,n=t.camera.pitch,r=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:i,pitch:n,roll:r}}}function P(e,t){e&&t.scene.camera.flyTo({...e})}function M(e,t){const i=t.dataSources.getByName(e);i.length>0&&t.flyTo(i[0])}function D(e,t){e&&t.flyTo(e)}function T(e,t){t.flyTo(e)}function E(t,i){const n=new e.Cartesian3(t[0],t[1],t[2]),r=new e.BoundingSphere(n,t[3]);i.camera.flyToBoundingSphere(r,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const A=(t,i,n,r,o)=>{if(n<=t||r<=i)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const s={destination:e.Rectangle.fromDegrees(t,i,n,r),duration:3,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}};o.camera.flyTo(s)},S=t=>{t.camera.flyTo({destination:t.scene.camera.position,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0},duration:1.5})};function I(t){const i=t.scene.canvas,n=i.clientWidth/2,r=i.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(n,r))}const O=t=>{let i=!1;let n;const r=t.camera;let o=r.pitch,s=0,a=!1;function l(){if(!i||!n)return;let e=r.heading;a?e+=.005:e-=.005,t.camera.setView({destination:n,orientation:{heading:e,pitch:o}}),t.camera.moveBackward(s),requestAnimationFrame(l)}return{start:(c,d)=>{n=c||I(t),o=r.pitch,a=!!d,s=e.Cartesian3.distance(r.position,n),i=!0,l(),t.scene.screenSpaceCameraController.enableInputs=!1},end:()=>{i=!1,t.scene.screenSpaceCameraController.enableInputs=!0}}},z=e=>{let t=!1;let i=!1;function n(){if(!t)return;let r=e.camera.heading;i?r+=.001:r-=.001,e.camera.setView({orientation:{heading:r,pitch:e.camera.pitch}}),requestAnimationFrame(n)}t=!0;return{start:e=>{t=!0,i=!!e,n()},end:()=>{t=!1}}};function F(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const R=(t,i)=>{console.log("sdfjdsklf"),i||(i=1e5);let n=!1;t.camera.moveEnd.addEventListener(function(){if(n)return;const r=t.camera,o=t.camera.positionCartographic.height;console.log("cameraEnd",o);const s=r.heading,a=r.roll;if(o>i){n=!0;const i=t.camera.computeViewRectangle();if(!i)return void(n=!0);const r={longitude:0,latitude:0},l=e.Rectangle.center(i);r.longitude=e.Math.toDegrees(l.longitude),r.latitude=e.Math.toDegrees(l.latitude),t.camera.flyTo({destination:m(new e.Cartographic(r.longitude,r.latitude,o)),orientation:{heading:s,pitch:-1.5,roll:a},duration:1,complete:()=>{}})}else n=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},k=(t,i)=>{const n=t.scene,r=new e.ScreenSpaceEventHandler(n.canvas);r.setInputAction(e=>{if(i.LEFT_POSITION){const r=n.pickPosition(e.position);B(e.position,r,i.LEFT_POSITION,t)}i.PICK_FEATURE&&L(t,e.position,i.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),r.setInputAction(e=>{if(i.MOVE_POSITION){const r=n.pickPosition(e.endPosition);B(e.endPosition,r,i.MOVE_POSITION,t)}i.MOVE_PICK_FEATURE&&L(t,e.endPosition,i.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},L=(t,i,n)=>{const r=t.scene.pickPosition(i),o=t.scene.pick(i),s={};if(o){if(t._element.style.cursor="pointer",o instanceof e.Cesium3DTileFeature){o.getPropertyIds().forEach(e=>{s[e]=o.getProperty(e)})}else o.id instanceof e.Cesium3DTileContent?(t._element.style.cursor="pointer",Object.assign(s,{name:"sdfjldks"})):o.id instanceof e.Entity?t._element.style.cursor="pointer":o.primitive&&Object.assign(s,o.primitive.properties);n({position:r,...o},s)}else n(void 0,{})},B=(t,i,n,r)=>{i||(i=e.Cartesian3.fromDegrees(0,0,0));const o=e.Cartographic.fromCartesian(i);n({windowPosition:t,position:i,lnglat:{lng:e.Math.toDegrees(o.longitude),lat:e.Math.toDegrees(o.latitude),height:o.height},cameraView:x(r)})},N=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,G=()=>window.INO_CESIUM_BASE_URL,U=e=>new Promise(t=>setTimeout(t,e));class V{static tooltip;_title;_div;_message;constructor(e){const t=document.createElement("DIV");t.id="tooltip",t.className="twipsy right";const i=document.createElement("DIV");i.className="twipsy-inner",t.appendChild(i),this._div=t,this._title=i,this._message="";const n=e._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(t),t.onmousemove=e=>{this.showAt({x:e.clientX,y:e.clientY},this._message)}}showAt(e,t){e&&t&&(this.setVisible(!0),this._title.innerHTML=t,this._div.style.left=`${e.x+10}px`,this._div.style.top=e.y-this._div.clientHeight/2+"px",this._message=t)}setVisible(e){this._div.style.display=e?"block":"none"}static createToolTip(e){return V.tooltip||(V.tooltip=new V(e)),V.tooltip}destroy(){V.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),V.tooltip=null)}}class H{static popup;_div;viewer;offset=new e.Cartesian2(140,150);position=e.Cartesian3.ZERO;constructor(e,t,i){this.viewer=e,i&&(this.offset=i),this._div=t,this._div.style.position="absolute",this._div.style.left="0",this._div.style.top="0",this._div.style.display="none";const n=e._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(t),this.renderPosition()}showAt(e){this.position=e,e&&this.setVisible(!0)}setVisible(e){this._div.style.display=e?"block":"none"}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(!this.position.equals(e.Cartesian3.ZERO)){const e=this.viewer.scene.cartesianToCanvasCoordinates(this.position);this._div.style.left=e.x-this.offset.x+"px",this._div.style.top=e.y-this.offset.y+"px"}})}static createPupup(e,t,i){return H.popup||(H.popup=new H(e,t,i)),H.popup}destroy(){H.popup&&(this._div&&this._div.parentNode.removeChild(this._div),H.popup=null)}}const $=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let r=0;r<e;r++){const e=W(t),r=W(i);n.push({type:"Feature",geometry:{type:"Point",coordinates:[e,r]},properties:{}})}return{type:"FeatureCollection",features:n}};function W(e){const[t,i]=e;return Math.random()*(i-t)+t}function q(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const j=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let r=0;r<e;r++){const e=Math.floor(W([3,10])),r=[];for(let n=0;n<e;n++){const e=W(t),n=W(i);r.push([e,n])}n.push({type:"Feature",geometry:{type:"LineString",coordinates:r},properties:{}})}return{type:"FeatureCollection",features:n}},Y=(e,t=[-180,180],i=[-90,90])=>{const n=[];for(let r=0;r<e;r++){const e=Z(t,i);n.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:n}};function Z(e,t){const i=Math.floor(W([3,10])),n=W(e),r=W(t),o=W([1,5]),s=[];for(let e=0;e<i;e++){const t=e/i*2*Math.PI,a=W([.8*o,o]),l=n+a*Math.cos(t),c=r+a*Math.sin(t);s.push([l,c])}return s.push(s[0]),s}const X=(t,i)=>{let n=!1;const r=new e.Viewer(t,{...l,scene3DOnly:!1});r.scene.mode=2;const o=r.scene.screenSpaceCameraController;o.enableRotate=!1,o.enableTranslate=!1,o.enableZoom=!1,o.enableTilt=!1,o.enableLook=!1,i.entities.add({position:e.Cartesian3.fromDegrees(0,0),label:{text:new e.CallbackProperty(()=>(s(),""),!0)}});const s=function(){n||r.camera.flyTo({destination:i.camera.position,orientation:{heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},duration:0})};return{viewer:r,open:()=>{n=!1},close:()=>{n=!0}}},J=t=>{const i=[],n=e=>{t.scene.splitPosition=e},r=(e,t)=>{i.push(e),e.splitDirection=t};return{set:()=>{n(.5),function(){let e=document.getElementById("vertical-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="vertical-slider";const i=t._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(e)}(),function(){const e=document.getElementById("vertical-slider");function i(){document.removeEventListener("mousemove",r,!1)}function n(){document.addEventListener("mousemove",r,!1)}function r(i){i.preventDefault?i.preventDefault():i.returnValue=!1,e.style.left=`${i.clientX}px`;const n=i.clientX/e.parentElement.offsetWidth;t.scene.splitPosition=n}e.addEventListener("mousedown",n,!1),document.addEventListener("mouseup",i,!1)}()},remove:()=>{i.forEach(t=>{r(t,e.SplitDirection.NONE)});document.getElementById("vertical-slider").style.display="none"},setSplitPosition:n,setSplitDirection:r}},K=t=>{const i=t;let r;const o={},s=()=>{const e=i.container;e.style.display="flex";e.getElementsByClassName("cesium-viewer")[0].style.width="50%";const t=document.createElement("div");t.style={width:"50%",height:"100%"},t.id="right-screen-viewer",e.appendChild(t),r=n(t.id),o[1]=r,l(),i.camera.changed.addEventListener(()=>a(i,r)),i.scene.preRender.addEventListener(()=>a(i,r)),i.camera.percentageChanged=.01,r.camera.changed.addEventListener(()=>a(r,i)),r.scene.preRender.addEventListener(()=>a(r,i)),r.camera.percentageChanged=.01,r._splitNumber=1};function a(t,i){const n=e.Cartographic.toCartesian(t.camera.positionCartographic);i.camera.setView({destination:new e.Cartesian3(n.x,n.y,n.z),orientation:{direction:t.scene.camera._direction,up:t.scene.camera.up,heading:t.scene.camera.heading,pitch:t.scene.camera.pitch,roll:t.scene.camera.roll}})}const l=()=>{i.imageryLayers._layers.forEach(e=>{e.splitScreenBaseLayer&&r.imageryLayers.addImageryProvider(e.imageryProvider)})};return{set:()=>{s(),function(){let e=document.getElementById("split-screen-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="split-screen-slider";const i=t._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(e)}(),i._splitNumber=-1,o[-1]=i},viewerMap:o,getViewerFromKey:e=>o[e],remove:()=>{document.getElementById("split-screen-slider").style.display="none";i.container.getElementsByClassName("cesium-viewer")[0].style.width="100%",r.container.remove(),delete o[1]},setLayer:(e,t)=>{},updateBaseLayers:l}};var Q=6371008.8,ee={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*Q,kilometers:6371.0088,kilometres:6371.0088,meters:Q,metres:Q,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:Q/1852,radians:1,yards:6967335.223679999};function te(e,t,i={}){const n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}function ie(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!le(e[0])||!le(e[1]))throw new Error("coordinates must contain numbers");return te({type:"Point",coordinates:e},t,i)}function ne(e,t,i={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return te({type:"Polygon",coordinates:e},t,i)}function re(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return te({type:"LineString",coordinates:e},t,i)}function oe(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function se(e){return 180*(e%(2*Math.PI))/Math.PI}function ae(e){return e%360*Math.PI/180}function le(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function ce(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function de(e){return"Feature"===e.type?e.geometry:e}function ue(e,t,i={}){if(!0===i.final)return function(e,t){let i=ue(t,e);return i=(i+180)%360,i}(e,t);const n=ce(e),r=ce(t),o=ae(n[0]),s=ae(r[0]),a=ae(n[1]),l=ae(r[1]),c=Math.sin(s-o)*Math.cos(l),d=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return se(Math.atan2(c,d))}function he(e,t,i,n={}){const r=ce(e),o=ae(r[0]),s=ae(r[1]),a=ae(i),l=function(e,t="kilometers"){const i=ee[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,n.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return ie([se(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c))),se(c)],n.properties)}function pe(e,t,i={}){var n=ce(e),r=ce(t),o=ae(r[1]-n[1]),s=ae(r[0]-n[0]),a=ae(n[1]),l=ae(r[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(e,t="kilometers"){const i=ee[t];if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function me(e,t,i){if(null!==e)for(var n,r,o,s,a,l,c,d,u=0,h=0,p=e.type,m="FeatureCollection"===p,f="Feature"===p,g=m?e.features.length:1,v=0;v<g;v++){a=(d=!!(c=m?e.features[v].geometry:f?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<a;y++){var _=0,C=0;if(null!==(s=d?c.geometries[y]:c)){l=s.coordinates;var w=s.type;switch(u=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":if(!1===t(l,h,v,_,C))return!1;h++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],h,v,_,C))return!1;h++,"MultiPoint"===w&&_++}"LineString"===w&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-u;r++){if(!1===t(l[n][r],h,v,_,C))return!1;h++}"MultiLineString"===w&&_++,"Polygon"===w&&C++}"Polygon"===w&&_++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(C=0,r=0;r<l[n].length;r++){for(o=0;o<l[n][r].length-u;o++){if(!1===t(l[n][r][o],h,v,_,C))return!1;h++}C++}_++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===me(s.geometries[n],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function fe(e,t){var i,n,r,o,s,a,l,c,d,u,h=0,p="FeatureCollection"===e.type,m="Feature"===e.type,f=p?e.features.length:1;for(i=0;i<f;i++){for(a=p?e.features[i].geometry:m?e.geometry:e,c=p?e.features[i].properties:m?e.properties:{},d=p?e.features[i].bbox:m?e.bbox:void 0,u=p?e.features[i].id:m?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,r=0;r<s;r++)if(null!==(o=l?a.geometries[r]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,h,c,d,u))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===t(o.geometries[n],h,c,d,u))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,h,c,d,u))return!1;h++}}function ge(e){return function(e,t,i){var n=i;return fe(e,function(e,r,o,s,a){n=0===r&&void 0===i?e:t(n,e,r,o,s,a)}),n}(e,(e,t)=>e+function(e){let t,i=0;switch(e.type){case"Polygon":return ve(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)i+=ve(e.coordinates[t]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}function ve(e){let t=0;if(e&&e.length>0){t+=Math.abs(Ce(e[0]));for(let i=1;i<e.length;i++)t-=Math.abs(Ce(e[i]))}return t}var ye=20294876564838.72,_e=Math.PI/180;function Ce(e){const t=e.length-1;if(t<=2)return 0;let i=0,n=0;for(;n<t;){const r=e[n],o=e[n+1===t?0:n+1],s=e[n+2>=t?(n+2)%t:n+2],a=r[0]*_e,l=o[1]*_e;i+=(s[0]*_e-a)*Math.sin(l),n++}return i*ye}function we(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return me(e,e=>{i[0]>e[0]&&(i[0]=e[0]),i[1]>e[1]&&(i[1]=e[1]),i[2]<e[0]&&(i[2]=e[0]),i[3]<e[1]&&(i[3]=e[1])}),i}const be=11102230246251565e-32,xe=134217729,Pe=(3+8*be)*be;function Me(e,t,i,n,r){let o,s,a,l,c=t[0],d=n[0],u=0,h=0;d>c==d>-c?(o=c,c=t[++u]):(o=d,d=n[++h]);let p=0;if(u<e&&h<i)for(d>c==d>-c?(s=c+o,a=o-(s-c),c=t[++u]):(s=d+o,a=o-(s-d),d=n[++h]),o=s,0!==a&&(r[p++]=a);u<e&&h<i;)d>c==d>-c?(s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++u]):(s=o+d,l=s-o,a=o-(s-l)+(d-l),d=n[++h]),o=s,0!==a&&(r[p++]=a);for(;u<e;)s=o+c,l=s-o,a=o-(s-l)+(c-l),c=t[++u],o=s,0!==a&&(r[p++]=a);for(;h<i;)s=o+d,l=s-o,a=o-(s-l)+(d-l),d=n[++h],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function De(e){return new Float64Array(e)}const Te=De(4),Ee=De(8),Ae=De(12),Se=De(16),Ie=De(4);function Oe(e,t,i,n,r,o){const s=(t-o)*(i-r),a=(e-r)*(n-o),l=s-a,c=Math.abs(s+a);return Math.abs(l)>=33306690738754716e-32*c?l:-function(e,t,i,n,r,o,s){let a,l,c,d,u,h,p,m,f,g,v,y,_,C,w,b,x,P;const M=e-r,D=i-r,T=t-o,E=n-o;C=M*E,h=xe*M,p=h-(h-M),m=M-p,h=xe*E,f=h-(h-E),g=E-f,w=m*g-(C-p*f-m*f-p*g),b=T*D,h=xe*T,p=h-(h-T),m=T-p,h=xe*D,f=h-(h-D),g=D-f,x=m*g-(b-p*f-m*f-p*g),v=w-x,u=w-v,Te[0]=w-(v+u)+(u-x),y=C+v,u=y-C,_=C-(y-u)+(v-u),v=_-b,u=_-v,Te[1]=_-(v+u)+(u-b),P=y+v,u=P-y,Te[2]=y-(P-u)+(v-u),Te[3]=P;let A=function(e,t){let i=t[0];for(let n=1;n<e;n++)i+=t[n];return i}(4,Te),S=22204460492503146e-32*s;if(A>=S||-A>=S)return A;if(u=e-M,a=e-(M+u)+(u-r),u=i-D,c=i-(D+u)+(u-r),u=t-T,l=t-(T+u)+(u-o),u=n-E,d=n-(E+u)+(u-o),0===a&&0===l&&0===c&&0===d)return A;if(S=11093356479670487e-47*s+Pe*Math.abs(A),A+=M*d+E*a-(T*c+D*l),A>=S||-A>=S)return A;C=a*E,h=xe*a,p=h-(h-a),m=a-p,h=xe*E,f=h-(h-E),g=E-f,w=m*g-(C-p*f-m*f-p*g),b=l*D,h=xe*l,p=h-(h-l),m=l-p,h=xe*D,f=h-(h-D),g=D-f,x=m*g-(b-p*f-m*f-p*g),v=w-x,u=w-v,Ie[0]=w-(v+u)+(u-x),y=C+v,u=y-C,_=C-(y-u)+(v-u),v=_-b,u=_-v,Ie[1]=_-(v+u)+(u-b),P=y+v,u=P-y,Ie[2]=y-(P-u)+(v-u),Ie[3]=P;const I=Me(4,Te,4,Ie,Ee);C=M*d,h=xe*M,p=h-(h-M),m=M-p,h=xe*d,f=h-(h-d),g=d-f,w=m*g-(C-p*f-m*f-p*g),b=T*c,h=xe*T,p=h-(h-T),m=T-p,h=xe*c,f=h-(h-c),g=c-f,x=m*g-(b-p*f-m*f-p*g),v=w-x,u=w-v,Ie[0]=w-(v+u)+(u-x),y=C+v,u=y-C,_=C-(y-u)+(v-u),v=_-b,u=_-v,Ie[1]=_-(v+u)+(u-b),P=y+v,u=P-y,Ie[2]=y-(P-u)+(v-u),Ie[3]=P;const O=Me(I,Ee,4,Ie,Ae);C=a*d,h=xe*a,p=h-(h-a),m=a-p,h=xe*d,f=h-(h-d),g=d-f,w=m*g-(C-p*f-m*f-p*g),b=l*c,h=xe*l,p=h-(h-l),m=l-p,h=xe*c,f=h-(h-c),g=c-f,x=m*g-(b-p*f-m*f-p*g),v=w-x,u=w-v,Ie[0]=w-(v+u)+(u-x),y=C+v,u=y-C,_=C-(y-u)+(v-u),v=_-b,u=_-v,Ie[1]=_-(v+u)+(u-b),P=y+v,u=P-y,Ie[2]=y-(P-u)+(v-u),Ie[3]=P;const z=Me(O,Ae,4,Ie,Se);return Se[z-1]}(e,t,i,n,r,o,c)}function ze(e,t){var i,n,r,o,s,a,l,c,d,u=0,h=e[0],p=e[1],m=t.length;for(i=0;i<m;i++){n=0;var f=t[i],g=f.length-1;if((c=f[0])[0]!==f[g][0]&&c[1]!==f[g][1])throw new Error("First and last coordinates in a ring must be the same");for(o=c[0]-h,s=c[1]-p;n<g;n++){if(a=(d=f[n+1])[0]-h,l=d[1]-p,0===s&&0===l){if(a<=0&&o>=0||o<=0&&a>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(0===(r=Oe(o,a,s,l,0,0)))return 0;(r>0&&l>0&&s<=0||r<0&&l<=0&&s>0)&&u++}c=d,s=l,o=a}}return u%2!=0}function Fe(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const n=ce(e),r=de(t),o=r.type,s=t.bbox;let a=r.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(n,s))return!1;"Polygon"===o&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){const e=ze(n,a[c]);if(0===e)return!i.ignoreBoundary;e&&(l=!0)}return l}function Re(e,t,i={}){const n=ce(e),r=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(t);for(let e=0;e<r.length-1;e++){let t=!1;if(i.ignoreEndVertices&&(0===e&&(t="start"),e===r.length-2&&(t="end"),0===e&&e+1===r.length-1&&(t="both")),ke(r[e],r[e+1],n,t,void 0===i.epsilon?null:i.epsilon))return!0}return!1}function ke(e,t,i,n,r){const o=i[0],s=i[1],a=e[0],l=e[1],c=t[0],d=t[1],u=c-a,h=d-l,p=(i[0]-a)*h-(i[1]-l)*u;if(null!==r){if(Math.abs(p)>r)return!1}else if(0!==p)return!1;return Math.abs(u)===Math.abs(h)&&0===Math.abs(u)?!n&&(i[0]===e[0]&&i[1]===e[1]):n?"start"===n?Math.abs(u)>=Math.abs(h)?u>0?a<o&&o<=c:c<=o&&o<a:h>0?l<s&&s<=d:d<=s&&s<l:"end"===n?Math.abs(u)>=Math.abs(h)?u>0?a<=o&&o<c:c<o&&o<=a:h>0?l<=s&&s<d:d<s&&s<=l:"both"===n&&(Math.abs(u)>=Math.abs(h)?u>0?a<o&&o<c:c<o&&o<a:h>0?l<s&&s<d:d<s&&s<l):Math.abs(u)>=Math.abs(h)?u>0?a<=o&&o<=c:c<=o&&o<=a:h>0?l<=s&&s<=d:d<=s&&s<=l}function Le(e,t){var i=de(e),n=de(t),r=i.type,o=n.type;switch(r){case"Point":switch(o){case"MultiPoint":return function(e,t){var i,n=!1;for(i=0;i<t.coordinates.length;i++)if(Ne(t.coordinates[i],e.coordinates)){n=!0;break}return n}(i,n);case"LineString":return Re(i,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Fe(i,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(e,t){for(var i=0;i<e.coordinates.length;i++){for(var n=!1,r=0;r<t.coordinates.length;r++)Ne(e.coordinates[i],t.coordinates[r])&&(n=!0);if(!n)return!1}return!0}(i,n);case"LineString":return function(e,t){for(var i=!1,n=0;n<e.coordinates.length;n++){if(!Re(e.coordinates[n],t))return!1;i||(i=Re(e.coordinates[n],t,{ignoreEndVertices:!0}))}return i}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){for(var i=!0,n=!1,r=0;r<e.coordinates.length;r++){if(!(n=Fe(e.coordinates[r],t))){i=!1;break}n=Fe(e.coordinates[r],t,{ignoreBoundary:!0})}return i&&n}(i,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(e,t){for(var i=0;i<e.coordinates.length;i++)if(!Re(e.coordinates[i],t))return!1;return!0}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){var i=we(t),n=we(e);if(!Be(i,n))return!1;for(var r=!1,o=0;o<e.coordinates.length;o++){if(!Fe(e.coordinates[o],t))return!1;if(r||(r=Fe(e.coordinates[o],t,{ignoreBoundary:!0})),!r&&o<e.coordinates.length-1)r=Fe(Ge(e.coordinates[o],e.coordinates[o+1]),t,{ignoreBoundary:!0})}return r}(i,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(e,t){var i=we(e);if(!Be(we(t),i))return!1;for(var n=0;n<e.coordinates[0].length;n++)if(!Fe(e.coordinates[0][n],t))return!1;return!0}(i,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+r+" geometry not supported")}}function Be(e,t){return!(e[0]>t[0])&&(!(e[2]<t[2])&&(!(e[1]>t[1])&&!(e[3]<t[3])))}function Ne(e,t){return e[0]===t[0]&&e[1]===t[1]}function Ge(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function Ue(e,t={}){let i=0,n=0,r=0;return me(e,function(e){i+=e[0],n+=e[1],r++},!0),ie([i/r,n/r],t.properties)}function Ve(e){return function(e,t={}){const i=Number(e[0]),n=Number(e[1]),r=Number(e[2]),o=Number(e[3]);if(6===e.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");const s=[i,n];return ne([[s,[r,n],[r,o],[i,o],s]],t.properties,{bbox:e,id:t.id})}(we(e))}function He(e,t,i,n,r={}){const o=r.steps||64,s=$e(i),a=$e(n),l=Array.isArray(e)||"Feature"!==e.type?{}:e.properties;if(s===a)return re(function(e,t,i={}){const n=i.steps||64,r=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},o=[];for(let r=0;r<n;r++)o.push(he(e,t,-360*r/n,i).geometry.coordinates);return o.push(o[0]),ne([o],r)}(e,t,r).geometry.coordinates[0],l);const c=s,d=s<a?a:a+360;let u=c;const h=[];let p=0;const m=(d-c)/o;for(;u<=d;)h.push(he(e,t,u,r).geometry.coordinates),p++,u=c+p*m;return re(h,l)}function $e(e){let t=e%360;return t<0&&(t+=360),t}function We(e,t){const i=[];return function(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}(e,function(e){let n=!1;if("Point"===e.geometry.type)fe(t,function(t){Fe(e,t)&&(n=!0)}),n&&i.push(e);else{if("MultiPoint"!==e.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var r=[];fe(t,function(t){me(e,function(e){Fe(e,t)&&(n=!0,r.push(e))})}),n&&i.push(function(e,t,i={}){return te({type:"MultiPoint",coordinates:e},t,i)}(r,e.properties))}}),oe(i)}const qe=(t,i)=>{const n=e.Cartographic.fromCartesian(t),r=e.Cartographic.fromCartesian(i),o=new e.EllipsoidGeodesic;o.setEndPoints(n,r);let s=o.surfaceDistance;return s=Math.sqrt(s**2+(r.height-n.height)**2),s};function je(e){let t=0;return e.forEach((i,n)=>{if(n===e.length-1)return;const r=qe(i,e[n+1]);t+=r}),t}function Ye(t,i,n){const{EllipsoidGeodesic:r,Ellipsoid:o}=e;return new r((n=n||o.WGS84).cartesianToCartographic(t),n.cartesianToCartographic(i)).surfaceDistance}function Ze(e){let t=0;return e.forEach((i,n)=>{if(n===e.length-1)return;const r=Ye(i,e[n+1]);t+=r}),t}const Xe=t=>{if(t.length<4)return e.BoundingSphere.fromPoints(t).center;const i=ne([t.map(e=>[e.x,e.y])]),n=e.BoundingSphere.fromPoints(t).center,r=Ue(i);return new e.Cartesian3(r.geometry.coordinates[0],r.geometry.coordinates[1],n.z)};function Je(t){let i=0;const{CoplanarPolygonGeometry:n,VertexFormat:r,defined:o,Cartesian3:s}=e,a=n.createGeometry(n.fromPositions({positions:t,vertexFormat:r.POSITION_ONLY}));if(o(a)){const e=a.indices,t=a.attributes.position.values;for(let n=0;n<e.length;n+=3){const r=e[n],o=e[n+1],a=e[n+2];i+=Ke(s.unpack(t,3*r,{}),s.unpack(t,3*o,{}),s.unpack(t,3*a,{}))}}return i}const Ke=(t,i,n)=>{const{Cartesian3:r}=e,o=r.subtract(t,i,{}),s=r.subtract(n,i,{}),a=r.cross(o,s,o);return.5*r.magnitude(a)},Qe=async(t,i)=>{const n=i.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,n)},et=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),tt=(t,i,n,r)=>{const o=[],s=e.Cartographic.fromCartesian(t),a=e.Cartographic.fromCartesian(i),l=180*s.longitude/Math.PI,c=180*s.latitude/Math.PI,d=180*a.longitude/Math.PI,u=180*a.latitude/Math.PI,h=Math.sqrt((l-d)*(l-d)+(c-u)*(c-u))*n,p=e.Cartesian3.clone(t),m=e.Cartesian3.clone(i),f=e.Cartesian3.distance(p,e.Cartesian3.ZERO),g=e.Cartesian3.distance(m,e.Cartesian3.ZERO);if(e.Cartesian3.normalize(p,p),e.Cartesian3.normalize(m,m),!e.Cartesian3.distance(p,m))return o;const v=e.Cartesian3.angleBetween(p,m);o.push(t);for(let t=1;t<r-1;t++){const i=1*t/(r-1),n=1-i,s=Math.sin(n*v)/Math.sin(v),a=Math.sin(i*v)/Math.sin(v),l=e.Cartesian3.multiplyByScalar(p,s,new e.Cartesian3),c=e.Cartesian3.multiplyByScalar(m,a,new e.Cartesian3);let d=e.Cartesian3.add(l,c,new e.Cartesian3);const u=i*Math.PI,y=f*n+g*i+Math.sin(u)*h;d=e.Cartesian3.multiplyByScalar(d,y,d),o.push(d)}return o.push(i),o},it=e=>{const t=e.positionCartographic.height,i=-40467.74;return Math.round(i+80955.31/(1+(t/91610.74)**7096758e-11))},nt=e=>e,rt=(t,i)=>{const n=[];let r=0,o=0,s=0;const a=[];for(let i=0;i<t.length-1;++i)r+=e.Cartesian3.distance(t[i],t[i+1]);for(let i=0;i<t.length;i++)0===i?o=0:(s+=e.Cartesian3.distance(t[i-1],t[i]),o=s/r),n.push(o);const l=new e.LinearSpline({times:n,points:t});for(let e=0;e<=i;e++){const t=l.evaluate(e/i);a.push(t)}return a},ot=t=>{const i=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,i),i};class st{_primitive;_promise;appearance;geometryInstance;drawCommand;shapePositions;needUpdate=!1;constructor(){this._primitive=void 0,this.appearance=void 0,this.geometryInstance=void 0,this._promise=null,this.drawCommand=null,this.needUpdate=!1,this.shapePositions=[]}update(e){const t=this.getPrimitive();if(t){this._primitive=t;this._primitive.update(e)}}then(e=null){return this._promise?.then(e)}catch(e=null){return this._promise?.catch(e)}isDestroyed(){return!!this._primitive}destroy(){this._primitive=void 0}setShapePositions(e){this.shapePositions=e}}class at{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const lt=e.BoxGeometry,ct=e.Cartesian3,dt=e.defaultValue,ut=e.defined,ht=e.destroyObject,pt=e.DeveloperError,mt=e.GeometryPipeline,ft=e.Matrix3,gt=e.Matrix4,vt=e.Transforms,yt=e.VertexFormat,_t=e.BufferUsage,Ct=e.CubeMap,wt=e.DrawCommand,bt=e.loadCubeMap,xt=e.RenderState,Pt=e.VertexArray,Mt=e.BlendingState,Dt=e.SceneMode,Tt=e.ShaderProgram,Et=e.ShaderSource,At=new ft;class St{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=dt(t.show,!0),this._command=new wt({modelMatrix:gt.clone(gt.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}update(e,t){const i=this;if(!this.show)return;if(e.mode!==Dt.SCENE3D&&e.mode!==Dt.MORPHING)return;if(!e.passes.render)return;const n=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(ut(e.positiveX)&&ut(e.negativeX)&&ut(e.positiveY)&&ut(e.negativeY)&&ut(e.positiveZ)&&ut(e.negativeZ)))throw new pt("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new pt("this.sources properties must all be the same type.");"string"==typeof e.positiveX?bt(n,this._sources).then(e=>{i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Ct({context:n,source:e}))}const r=this._command;if(r.modelMatrix=vt.eastNorthUpToFixedFrame(e.camera._positionWC),!ut(r.vertexArray)){r.uniformMap={u_cubeMap:()=>i._cubeMap,u_rotateMatrix:()=>gt.getRotation(r.modelMatrix,At)};const e=lt.createGeometry(lt.fromDimensions({dimensions:new ct(2,2,2),vertexFormat:yt.POSITION_ONLY})),t=this._attributeLocations=mt.createAttributeLocations(e);r.vertexArray=Pt.fromGeometry({context:n,geometry:e,attributeLocations:t,bufferUsage:_t._DRAW}),r.renderState=xt.fromCache({blending:Mt.ALPHA_BLEND})}if(!ut(r.shaderProgram)||this._useHdr!==t){const e=new Et({defines:[t?"HDR":""],sources:["precision highp float;\n\nuniform samplerCube u_cubeMap;\nin vec3 v_texCoord;\nout vec4 fragColor;\n\nvoid main() {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n fragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}"]});r.shaderProgram=Tt.fromCache({context:n,vertexShaderSource:"#version 300 es\n\nprecision highp float;\n\nin vec3 position;\nout vec3 v_texCoord;\n\nuniform mat3 u_rotateMatrix;\n\nvoid main() {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return ut(this._cubeMap)?r:void 0}isDestroyed(){return!1}destroy(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),ht(this)}}const It=t=>{const{viewer:i,sources:n}=t;return i.scene.skyBox=new e.SkyBox({sources:n}),i.scene.skyBox},Ot=t=>{let{viewer:i,sources:n}=t;const r=t.height?t.height:225705,o=i.scene.skyBox,s=i.scene.skyAtmosphere.show;n||(n={positiveX:`${G()}/assets/images/ground-skybox/px.jpg`,negativeX:`${G()}/assets/images/ground-skybox/nx.jpg`,positiveY:`${G()}/assets/images/ground-skybox/py.jpg`,negativeY:`${G()}/assets/images/ground-skybox/ny.jpg`,positiveZ:`${G()}/assets/images/ground-skybox/pz.jpg`,negativeZ:`${G()}/assets/images/ground-skybox/nz.jpg`});const a=new St({sources:n});i.scene.postRender.addEventListener(()=>{const t=i.camera.position;e.Cartographic.fromCartesian(t).height<r?(i.scene.skyBox=a,i.scene.skyAtmosphere.show=!1):(i.scene.skyBox=o,i.scene.skyAtmosphere.show=s)})},zt=t=>{const i=[];let n,r;t.clock.shouldAnimate=!0;const o={},s=(e,i)=>{if(a(),e.entity.cylinder){const i=e.entity.cylinder;i.roamId=e.id,e.entity.cylinder=void 0,r=t.entities.add({position:e.property,cylinder:i})}t.trackedEntity=e.entity,i&&(n=e)},a=()=>{if(r){t.entities.remove(r);const e=i.find(e=>e.id===r.cylinder.roamId);e&&(e.entity.cylinder=r.cylinder),r=void 0}},l=()=>{t.trackedEntity=void 0,n=void 0,a()},c=e=>{t.trackedEntity?.id===e.entity.id&&l(),t.entities.remove(e.entity);const n=i.findIndex(t=>t.id===e.id);n>-1&&i.splice(n,1)},d=(e,t)=>{const i=e.property.getValue(t);if(i&&(e.status="ROAMING",m.roaming&&m.roaming(e,{time:t,position:i})),e.stopTime.secondsOfDay<t.secondsOfDay&&"END"!==e.status&&(e.status="END",m.end&&m.end(e),e.loop?u(e):l()),e.flyParams.hpr){const n=o[e.id].find(e=>e.time>t.secondsOfDay);n&&p(e,n,i)}},u=i=>{const{property:n,startTime:r,stopTime:o}=h(i);i.stopTime=o,i.startTime=r,i.property=n,i.flyParams.hpr||(i.entity.orientation=new e.VelocityOrientationProperty(n)),i.entity.position=n,i.status="START",t.clock.currentTime=r,t.clock.multiplier=1,m.reStart&&m.reStart(i)},h=t=>{const i=[],{positions:n,flyParams:r}=t,s=new e.SampledPositionProperty;let a=0;const l=e.JulianDate.now();let c=l.clone();return n.forEach((t,o)=>{let d=e.JulianDate.now();if(o){let i=0;if(r.speed){i=e.Cartesian3.distance(t,n[o-1])/(1e3*r.speed/3600)}r.times&&(i=(r.times[o]-r.times[o-1])/1e3),a+=i,d=e.JulianDate.addSeconds(l,a,new e.JulianDate)}else d=l;c=d,s.addSample(d,t),r.hpr&&i.push({time:d.secondsOfDay,heading:r.hpr[o].heading,pitch:r.hpr[o].pitch,roll:r.hpr[o].roll})}),o[t.id]=i,{property:s,startTime:l,stopTime:c}},p=(t,i,n)=>{if(!n)return;const{heading:r,pitch:o,roll:s}=i,a=new e.HeadingPitchRoll(r,o,s);t.entity.orientation=Transforms.headingPitchRollQuaternion(n,a)};t.scene.preRender.addEventListener((r,o)=>{if(i.forEach(e=>{d(e,o)}),!n)return;const s=n.entity.computeModelMatrix(t.clock.currentTime);s&&t.camera.lookAtTransform(s,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:n=>{const{entity:r}=n;n.id=N(),t.entities.add(r);const{property:o,startTime:s,stopTime:a}=h(n);n.flyParams.hpr||(r.orientation=new e.VelocityOrientationProperty(o)),r.position=o;const l={...n,startTime:s,stopTime:a,property:o,status:"START"};return t.clock.currentTime=s,t.clock.multiplier=1,i.push(l),l.status="START",m.start&&m.start(l),l},tracked:s,stopTracked:l,remove:c,frameRoam:d,trackedByEntityId:(e,t)=>{const n=i.find(t=>t.entity.id===e);n&&s(n,t)},removeAll:()=>{i.forEach(e=>{c(e)}),i.length=0},Event:m,lockCameraView:e=>{n=e},updateRoamAttitude:(t,i)=>{"UP"!==i&&"DOWN"!==i||(t.entity.orientation=void 0),"front"!==i&&"back"!==i||(t.entity.orientation=new e.VelocityOrientationProperty(t.property))}}};var Ft=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))(Ft||{}),Rt=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(Rt||{});let kt=100,Lt="",Bt="0";const Nt=t=>{const{viewer:i}=t,n=document.createElement("div");n.className="bottom-status-bar";const r=document.createElement("div");r.className="scale-bar",r.innerHTML="";const o=document.createElement("div");o.className="scale-label",o.innerHTML="",r.appendChild(o),n.appendChild(r);const s=document.createElement("div");s.id="bottom-status-bar-camera",t.clickCopy&&(s.style.pointerEvents="auto",s.style.cursor="pointer"),n.appendChild(s),s.style.display="flex";const a=document.createElement("div"),l=document.createElement("div"),c=i._element.getElementsByClassName("cesium-widget")[0];if(!c)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");c.appendChild(n),k(i,{MOVE_POSITION(e){s.innerHTML=`\n 经度:${e.lnglat.lng.toFixed(6)} \n 纬度:${e.lnglat.lat.toFixed(6)} \n 高程:${e.lnglat.height.toFixed(2)} \n `,t.clickCopy&&x(i),s.appendChild(l),s.appendChild(a)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),u=0;const h=()=>{requestAnimationFrame(()=>{if(u+=1,u>=30){const e=Date.now(),t=e-d,i=Math.round(1e3/(t/u));d=e,u=0,a.innerHTML=`${i} FPS`}t.hpr?l.innerHTML=`\n 方位角:${e.Math.toDegrees(i.camera.heading).toFixed(1)}° \n 俯仰角:${e.Math.toDegrees(i.camera.pitch).toFixed(1)}° \n 翻滚角:${e.Math.toDegrees(i.camera.roll).toFixed(1)}° \n `:l.innerHTML="",l.innerHTML+=`\n 视高:${i.camera.positionCartographic.height.toFixed(0)}m \n `;const n=Gt(i);o.innerHTML=`${n.distanceLabel}`,h()})};h()},Gt=t=>{const i=t.camera.positionCartographic.height.toFixed(0);if(i===Bt)return{barWidth:kt,distanceLabel:Lt};Bt=i;const n=new e.EllipsoidGeodesic,r=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],o=t.scene,s=o.canvas.clientWidth,a=o.canvas.clientHeight,l=o.camera.getPickRay(new e.Cartesian2(s/2|0,a-1)),c=o.camera.getPickRay(new e.Cartesian2(1+s/2|0,a-1)),d=o.globe,u=d.pick(l,o),h=d.pick(c,o);if(!e.defined(u)||!e.defined(h))return{barWidth:kt,distanceLabel:Lt};const p=d.ellipsoid.cartesianToCartographic(u),m=d.ellipsoid.cartesianToCartographic(h);n.setEndPoints(p,m);const f=n.surfaceDistance;let g;for(let t=r.length-1;!e.defined(g)&&t>=0;--t)r[t]/f<100&&(g=r[t]);if(e.defined(g)){const e=g>=1e3?`${(g/1e3).toString()} km`:`${g.toString()} m`;kt=g/f|0,Lt=e}else kt=0,Lt="1 m";return{barWidth:kt,distanceLabel:Lt}},Ut=t=>new Promise(i=>{const{viewer:n,center:r}=t;let o=r.lng,s=1,a=null;const l=t=>{null===a&&(a=t);o-=(t-a)/2e4*2,o<-180&&(o=180,s+=1),2===s&&o>r.lng?n.camera.flyTo({destination:e.Cartesian3.fromDegrees(r.lng,r.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{n.camera.flyTo({destination:e.Cartesian3.fromDegrees(r.lng,r.lat,r.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{i(!0)}})}}):(n.camera.setView({destination:e.Cartesian3.fromDegrees(o,r.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(l))};requestAnimationFrame(l)}),Vt=(t,i,n)=>{const r=new Float64Array(24);for(let e=0;e<8;e++)r[3*e]=t[e].x,r[3*e+1]=t[e].y,r[3*e+2]=t[e].z;const o=new Uint16Array([0,1,2,0,2,3,4,6,5,4,7,6,0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4]),s={position:new e.GeometryAttribute({componentDatatype:e.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:r})},a=new e.Geometry({indices:o,attributes:s,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(r)});return new e.GeometryInstance({geometry:a,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${n}`})},Ht=(t,i,n)=>{const[r,o,s,a,l,c,d,u]=t,h=[r,o,o,s,s,a,a,r,l,c,c,d,d,u,u,l,r,l,l,c,c,o,o,r,a,u,u,d,d,s,s,a,r,a,a,u,u,l,l,r,o,c,c,d,d,s,s,o];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:h,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(i)},id:`${n}`})},$t=(t,i)=>[e.Cartesian3.fromDegrees(t.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,i.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,i.height),e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),e.Cartesian3.fromDegrees(t.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,i.latitude,t.height),e.Cartesian3.fromDegrees(i.longitude,t.latitude,t.height)],Wt=(t,i,n,r,o,s)=>[e.Cartesian3.fromDegrees(t,t,o),e.Cartesian3.fromDegrees(i,i,o),e.Cartesian3.fromDegrees(n,n,o),e.Cartesian3.fromDegrees(r,r,o),e.Cartesian3.fromDegrees(t,t,s),e.Cartesian3.fromDegrees(i,i,s),e.Cartesian3.fromDegrees(n,n,s),e.Cartesian3.fromDegrees(r,r,s)],qt=3e3*Math.PI/180,jt=Math.PI,Yt=6378245,Zt=.006693421622965943,Xt=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),Jt=(e,t)=>{let i=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*jt)+20*Math.sin(2*e*jt))/3,i+=2*(20*Math.sin(t*jt)+40*Math.sin(t/3*jt))/3,i+=2*(160*Math.sin(t/12*jt)+320*Math.sin(t*jt/30))/3,i},Kt=(e,t)=>{let i=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*jt)+20*Math.sin(2*e*jt))/3,i+=2*(20*Math.sin(e*jt)+40*Math.sin(e/3*jt))/3,i+=2*(150*Math.sin(e/12*jt)+300*Math.sin(e/30*jt))/3,i},Qt=(e,t)=>{if(Xt(e,t))return[e,t];let i=Jt(e-105,t-35),n=Kt(e-105,t-35);const r=t/180*jt;let o=Math.sin(r);o=1-Zt*o*o;const s=Math.sqrt(o);i=180*i/(Yt*(1-Zt)/(o*s)*jt),n=180*n/(Yt/s*Math.cos(r)*jt);return[e+n,t+i]},ei=(e,t)=>{if(Xt(e,t))return[e,t];let i=Jt(e-105,t-35),n=Kt(e-105,t-35);const r=t/180*jt;let o=Math.sin(r);o=1-Zt*o*o;const s=Math.sqrt(o);i=180*i/(Yt*(1-Zt)/(o*s)*jt),n=180*n/(Yt/s*Math.cos(r)*jt);return[2*e-(e+n),2*t-(t+i)]},ti=(e,t)=>{const i=e,n=t,r=Math.sqrt(i*i+n*n)+2e-5*Math.sin(n*qt),o=Math.atan2(n,i)+3e-6*Math.cos(i*qt);return[r*Math.cos(o)+.0065,r*Math.sin(o)+.006]},ii=(e,t)=>{const i=e-.0065,n=t-.006,r=Math.sqrt(i*i+n*n)-2e-5*Math.sin(n*qt),o=Math.atan2(n,i)-3e-6*Math.cos(i*qt);return[r*Math.cos(o),r*Math.sin(o)]};class ni{static wgs84ToGcj02(e){const[t,i]=Qt(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToWgs84(e){const[t,i]=ei(e.lng,e.lat);return{lng:t,lat:i}}static gcj02ToBd09(e){const[t,i]=ti(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToGcj02(e){const[t,i]=ii(e.lng,e.lat);return{lng:t,lat:i}}static bd09ToWgs84(e){const[t,i]=((e,t)=>{const[i,n]=ii(e,t);return ei(i,n)})(e.lng,e.lat);return{lng:t,lat:i}}static wgs84ToBd09(e){const[t,i]=((e,t)=>{const[i,n]=Qt(e,t);return ti(i,n)})(e.lng,e.lat);return{lng:t,lat:i}}}let ri;const oi=t=>new Promise(i=>{document.body.style.cursor="pointer",t._element.style.cursor="pointer",ri||(ri=new e.ScreenSpaceEventHandler(t.scene.canvas)),ri.setInputAction(async n=>{const r=t.scene.pickPosition(n.position);await t.scene.clampToHeightMostDetailed([r]);const o=h(r);t._element.style.cursor="default",ri.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),i({position:r,lnglat:o})},e.ScreenSpaceEventType.LEFT_CLICK)}),si=(e,t)=>{const i={},n=t.getFeature(e);return n?ai(n):i},ai=e=>{const t={};return e.getPropertyIds().forEach(i=>{t[i]=e.getProperty(i)}),t},li=t=>{const{viewer:i,token:n}=t,r=t.vec?"vec":"img",o=[],s=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/${r}_w/wmts?tk=${n}`,layer:r,style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));if(o.push(s),t.label){const t=i.imageryLayers.addImageryProvider(new e.WebMapTileServiceImageryProvider({url:`//t{s}.tianditu.gov.cn/cia_w/wmts?tk=${n}`,layer:"cia",style:"default",tileMatrixSetID:"w",format:"tiles",maximumLevel:18,subdomains:["0","1","2","3","4","5","6","7"]}));o.push(t)}return{layers:o,remove:()=>{o.forEach(e=>{i.imageryLayers.remove(e)})},setOpacity:e=>{o.forEach(t=>{t.alpha=e})}}};function ci(t,i){i||(i={}),console.log(i.filterColor);const n=t.imageryLayers.get(0);if(!n)return;n.brightness=i.brightness??.6,n.contrast=i.contrast??1.8,n.gamma=i.gamma??.3,n.hue=i.hue??1,n.saturation=i.saturation||0;const r=t.scene.globe._surfaceShaderSet.baseFragmentShaderSource.sources;for(let t=0;t<r.length;t++){const n="color = czm_saturation(color, textureSaturation);\n#endif\n";let o="color = czm_saturation(color, textureSaturation);\n#endif\n";i.invertColor||(o+="\n color.r = 1.0 - color.r;\n color.g = 1.0 - color.g;\n color.b = 1.0 - color.b;\n "),i.filterColor||(i.filterColor=e.Color.fromCssColorString("rgba(100,138,230,0.5)")),o+=`\n color.r = color.r * ${i.filterColor.red.toFixed(2)};\n color.g = color.g * ${i.filterColor.green.toFixed(2)};\n color.b = color.b * ${i.filterColor.blue.toFixed(2)};\n // color.a = color.a * ${i.filterColor.alpha.toFixed(2)};\n `,r[t]=r[t].replace(n,o)}t.scene.requestRender()}const di={cacheBytes:4294967296,maximumCacheOverflowBytes:5368709120},ui=async t=>{const{viewer:i,url:n,options:r}=t,o=await e.Cesium3DTileset.fromUrl(n,{...di,...r});i.scene.primitives.add(o);return{tileset:o,setHeightOffset:e=>{hi(o,e)},remove:()=>{i.scene.primitives.remove(o)},flyTo:()=>{i.flyTo(o)}}},hi=(t,i)=>{fi(t,e.Cartesian3.fromElements(0,0,i,new e.Cartesian3))},pi=async e=>{const t=[];function i(e){if(console.log(e),!e.content||!e.content.featuresLength)return;const n=e.content;for(let e=0;e<n.featuresLength;e++)t.push(n.getFeature(e));e.children?.forEach(i)}return new Promise(n=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),n(t)})})},mi=e=>{const t=[];function i(e){t.push(e),e.children?.forEach(i)}return new Promise(n=>{e.allTilesLoaded.addEventListener(()=>{i(e.root),n(t)})})},fi=(t,i)=>{if(i.equals(e.Cartesian3.ZERO))return;const n=t.boundingSphere.center,r=e.Transforms.eastNorthUpToFixedFrame(n),o=e.Matrix4.multiplyByPoint(r,i,new e.Cartesian3),s=e.Cartesian3.subtract(o,n,new e.Cartesian3),a=e.Matrix4.fromTranslation(s);t.modelMatrix=e.Matrix4.multiply(a,t.modelMatrix,new e.Matrix4)},gi={translate:fi,scale:(t,i)=>{if(i.equals(e.Cartesian3.ZERO)||i.equals(e.Cartesian3.ONE))return;const n=t.boundingSphere.center,r=e.Transforms.eastNorthUpToFixedFrame(n),o=e.Matrix4.inverse(r,new e.Matrix4),s=e.Matrix4.fromScale(i),a=e.Matrix4.multiply(s,o,new e.Matrix4),l=e.Matrix4.multiply(r,a,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(l,t.modelMatrix,new e.Matrix4)},rotate:(t,i)=>{const{x:n,y:r,z:o}=i,s=t.boundingSphere.center,a=e.Transforms.eastNorthUpToFixedFrame(s),l=e.Matrix4.inverse(a,new e.Matrix4),c=e.Matrix4.clone(e.Matrix4.IDENTITY);if(0!==n){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationX(e.Math.toRadians(n)));e.Matrix4.multiply(t,c,c)}if(0!==r){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationY(e.Math.toRadians(r)));e.Matrix4.multiply(t,c,c)}if(0!==o){const t=e.Matrix4.fromRotation(e.Matrix3.fromRotationZ(e.Math.toRadians(o)));e.Matrix4.multiply(t,c,c)}const d=e.Matrix4.multiply(c,l,new e.Matrix4),u=e.Matrix4.multiply(a,d,new e.Matrix4);t.modelMatrix=e.Matrix4.multiply(u,t.modelMatrix,new e.Matrix4)}},vi=async t=>{const{viewer:i,url:n}=t,r=await e.CesiumTerrainProvider.fromUrl(n,{requestWaterMask:!0,requestVertexNormals:!0});i.scene.terrainProvider=r;return{terrainProvider:r,remove:()=>{i.scene.terrainProvider=new e.EllipsoidTerrainProvider}}},yi=t=>{t.scene.terrainProvider=new e.EllipsoidTerrainProvider},_i=async()=>await e.CesiumTerrainProvider.fromIonAssetId(1,{requestWaterMask:!0,requestVertexNormals:!0}),Ci=()=>{},wi=()=>{},bi=async t=>{const{viewer:i,url:n,options:r}=t,o=await e.I3SDataProvider.fromUrl(n,r);i.scene.primitives.add(o);return{i3sProvider:o,setHeightOffset:e=>{o.layers.forEach(t=>{const i=t.tileset;i&&hi(i,e)})},remove:()=>{i.scene.primitives.remove(o)},flyTo:t=>{const n=e.Rectangle.center(o.extent);n.height=t;let r=o.data;e.defined(r.layers)&&r.layers.length>0&&(r=r.layers[0]),e.defined(r.fullExtent)&&e.defined(r.fullExtent.zmax)&&(n.height+=r.fullExtent.zmax);const s=e.Ellipsoid.WGS84.cartographicToCartesian(n);i.camera.flyTo({destination:s,orientation:{}})}}},xi=(t,i=e.Color.YELLOW)=>{const n=t.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform vec4 highlight;\n void main() {\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (czm_selected()) {\n vec3 highlighted = highlight.a * highlight.rgb + (1.0 - highlight.a) * color.rgb;\n out_FragColor = mix(color, vec4(highlighted,0.5), 0.3);\n } else {\n out_FragColor = color;\n }\n }\n ",uniforms:{highlight:()=>i}}));n.selected=[];return{stage:n,remove:()=>{t.scene.postProcessStages.remove(n)}}},Pi=t=>{const i=e.PostProcessStageLibrary.createEdgeDetectionStage(),n=new e.PostProcessStage({name:"skyline",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n in vec2 v_textureCoordinates;\n void main() { float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (depth < 1.0 - 0.000001) {\n out_FragColor = color;\n } else {\n out_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n }\n }"}),r=new e.PostProcessStage({name:"mix",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D redTexture;\n uniform sampler2D silhouetteTexture;\n in vec2 v_textureCoordinates;\n\n void main() {\n vec4 redColor = texture(redTexture, v_textureCoordinates);\n vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);\n vec4 color = texture(colorTexture, v_textureCoordinates);\n if (redColor.r == 1.0) {\n out_FragColor = mix(color, vec4(5.0, 0.0, 0.0, 1.0), silhouetteColor.a);\n } else {\n out_FragColor = color;\n }\n }",uniforms:{redTexture:n.name,silhouetteTexture:i.name}}),o=new e.PostProcessStageComposite({stages:[i,n,r],inputPreviousStageTexture:!1,uniforms:i.uniforms});t.scene.postProcessStages.add(o);return{stage:o,remove:()=>{t.scene.postProcessStages.remove(o)}}},Mi=(t,i=e.Color.YELLOW)=>{const n=t.scene.postProcessStages,r=e.PostProcessStageLibrary.createEdgeDetectionStage();r.uniforms.color=i,r.uniforms.length=1,r.selected=[];const o=e.PostProcessStageLibrary.createEdgeDetectionStage();o.uniforms.color=i,o.selected=[];const s=n.add(e.PostProcessStageLibrary.createSilhouetteStage([r,o]));s.selected=[];return{stage:s,remove:()=>{t.scene.postProcessStages.remove(s)}}},Di=t=>{const i=t.viewer,n=new e.PostProcessStage({name:"SnowEffectCover",fragmentShader:"\n vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth)\n {\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\n return eyeCoordinate.xyz / eyeCoordinate.w;\n }\n vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset, sampler2D depthMap) {\n vec2 glFragCoordXY = gl_FragCoord.xy;\n float upOrRightLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\n float downOrLeftLogDepth = czm_unpackDepth(texture(depthMap, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\n bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\n\n float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\n float useDownOrLeft = float(useUpOrRight == 0.0);\n vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\n vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\n return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n }\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float intensity;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n\n float logDepthOrDepth = czm_unpackDepth(texture(depthTexture, v_textureCoordinates));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0), depthTexture);\n vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0), depthTexture);\n vec3 normalEC = normalize(cross(leftRight, downUp));\n vec3 normalMC = normalize((czm_inverseView * vec4(normalEC, 0.0)).xyz);\n vec3 ellipsoidNormal = normalize(worldCoordinate);\n float dotProd = dot(ellipsoidNormal, normalMC);\n if(dotProd < 0.3){\n out_FragColor = sceneColor;\n } else {\n out_FragColor = mix(sceneColor, vec4(1.0), dotProd * intensity);\n }\n if (czm_selected()) {\n out_FragColor = sceneColor;\n }\n }\n ",forcePowerOfTwo:!1,textureScale:1,uniforms:{intensity:()=>t.intensity||.8}});i.scene.postProcessStages.add(n);return n.selected=[],{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},Ti=t=>{const i=t.viewer,n=i.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture; //输入的场景渲染照片\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float scale;\n\n float snow(vec2 uv, float thisScale) {\n float time = czm_frameNumber * speed / 1000.0;\n float wMars3D = smoothstep(1.0, 0.0, -uv.y * (thisScale / 10.0));\n if(wMars3D < 0.1)\n return 0.0;\n uv += time / thisScale;\n uv.y += time * 2.0 / thisScale;\n uv.x += sin(uv.y + time * 0.5) / thisScale;\n uv *= thisScale;\n\n vec2 s = floor(uv), f = fract(uv), p;\n float k = 3.0, d;\n p = 0.5 + 0.35 * sin(11.0 * fract(sin((s + p + thisScale) * mat2(7, 3, 6, 5)) * 5.0)) - f;\n d = length(p);\n k = min(d, k);\n k = smoothstep(0.0, k, sin(f.x + f.y) * 0.01);\n return k * wMars3D;\n }\n void main(void) {\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n\n float c = 0.0;\n float step = 1.0/(scale*0.1);\n for(float i = 1.0; i < 12.0; i += 1.0) {\n c += snow(uv, i*step);\n }\n vec3 finalColor = vec3(c); //屏幕上雪的颜色\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雪和三维场景融合\n }",uniforms:{scale:()=>t.scale||5,speed:()=>t.speed||16}}));n.selected=[];return{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},Ei=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float alpha;\n uniform float height;\n uniform vec3 oneOverRadii;\n uniform vec3 oneOverRadiiSquared;\n uniform float centerToleranceSquared;\n uniform float EPSILON12;\n uniform float earthRadius;\n\n in vec2 v_textureCoordinates;\n out vec4 glColor;\n\n vec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n }\n float getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n }\n\n\n vec3 getWorldCoordinateFromDepth(in vec4 currD){\n float depth = czm_unpackDepth(currD);\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n return worldCoordinate;\n }\n\n float magnitude(in vec3 v){\n return sqrt(v.x * v.x + v.y * v.y + v.z * v.z);\n }\n\n // 沿大地表面法线缩放提供的笛卡尔位置,使其位于该椭球体的表面上\n vec3 scaleToGeodeticSurface(in vec3 cartesian){\n float positionX = cartesian.x;\n float positionY = cartesian.y;\n float positionZ = cartesian.z;\n float x2 = cartesian.x * cartesian.x * oneOverRadii.x * oneOverRadii.x;\n float y2 = cartesian.y * cartesian.y * oneOverRadii.y * oneOverRadii.y;\n float z2 = cartesian.z * cartesian.z * oneOverRadii.z * oneOverRadii.z;\n\n float squaredNorm = x2 + y2 + z2;\n float ratio = sqrt(1.0 / squaredNorm);\n vec3 intersection = cartesian * ratio;\n\n float oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n float oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n float oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n vec3 gradient = vec3(intersection.x * oneOverRadiiSquaredX * 2.0,intersection.y * oneOverRadiiSquaredY * 2.0,intersection.z * oneOverRadiiSquaredZ * 2.0);\n\n float lambda = ((1.0 - ratio) * magnitude(cartesian) ) / (0.5 * magnitude(gradient));\n float correction = 0.0;\n float func = 0.0;\n float denominator = 0.0;\n float xMultiplier = 0.0;\n float yMultiplier = 0.0;\n float zMultiplier = 0.0;\n float xMultiplier2 = 0.0;\n float yMultiplier2 = 0.0;\n float zMultiplier2 = 0.0;\n float xMultiplier3 = 0.0;\n float yMultiplier3 = 0.0;\n float zMultiplier3 = 0.0;\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n xMultiplier2 = xMultiplier * xMultiplier;\n yMultiplier2 = yMultiplier * yMultiplier;\n zMultiplier2 = zMultiplier * zMultiplier;\n\n xMultiplier3 = xMultiplier2 * xMultiplier;\n yMultiplier3 = yMultiplier2 * yMultiplier;\n zMultiplier3 = zMultiplier2 * zMultiplier;\n\n float func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n float denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n float derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (abs(func) > EPSILON12);\n return vec3(positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);\n }\n\n vec3 multiplyComponents(in vec3 left,in vec3 right){\n return vec3(left.x * right.x, left.y * right.y, left.z * right.z);\n }\n\n\n // 将世界坐标转为经纬度高度\n vec3 getCartographicFromCartesian3(in vec3 cartesian){\n vec3 p = scaleToGeodeticSurface(cartesian);\n vec3 n = multiplyComponents(p,oneOverRadiiSquared);\n n = normalize(n);\n vec3 h = cartesian - p;\n\n float longitude = atan(n.y, n.x);\n float latitude = asin(n.z);\n float height = sign(dot(h, cartesian)) * magnitude(h);\n\n return vec3(longitude,latitude,height);\n }\n\n // 计算每个像素点的高度 通过计算相机所在位置的地球半径作为每个点的地球半径,然后用每个点的length减去半径得到近似的高度\n float getHeight(in vec4 currD){\n // 传入每个点的世界坐标\n float altitude = 0.0;\n float depth = czm_unpackDepth(currD);\n if (depth == 0.0) {\n altitude = czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n float distance = -eyeCoordinate.z / eyeCoordinate.w;\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n altitude = length(worldCoordinate.xyz) - earthRadius;\n return altitude;\n }\n\n void main(){\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n glColor = color;\n return;\n }\n // 此方法有问题 会闪烁\n float depth = getDepth(currD);\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec4 positionWC = czm_inverseView * positionEC;\n // 获取当前点的高度\n // vec3 positionWC = getWorldCoordinateFromDepth(currD);\n vec3 cartographic = getCartographicFromCartesian3(vec3(positionWC.x,positionWC.y,positionWC.z));\n // 高度加了10之后 就不闪烁了\n float pointHeight = cartographic.z + 10.;\n // 当前点高度越高,雾浓度越小,高度达到设定高度,雾浓度为0,同时乘以深度,距离越远,浓度越大\n float fog = (height/pointHeight - 1.);\n fog = clamp(fog, 0.0, 1.0);\n glColor = mix(color,vec4(1.0,1.,1.,1),fog*alpha);\n }",uniforms:{EPSILON12:()=>t.EPSILON12||1e-12,alpha:()=>t.alpha||.88,centerToleranceSquared:()=>t.centerToleranceSquared||.1,height:()=>t.height||100,oneOverRadii:()=>t.oneOverRadii||{x:1.567855942887398e-7,y:1.567855942887398e-7,z:1.573130351105623e-7},oneOverRadiiSquared:()=>t.oneOverRadiiSquared||{x:2458172257647332e-29,y:2458172257647332e-29,z:24747391015697002e-30}}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Ai=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\nfloat getDistance(sampler2D depthTexture, vec2 texCoords) {\n float depth = czm_unpackDepth(texture(depthTexture, texCoords));\n if(depth == 0.0) {\n return czm_infinity;\n }\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);\n return -eyeCoordinate.z / eyeCoordinate.w;\n}\nfloat interpolateByDistanceMars3D(vec4 nearFarScalar, float distance) {\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\nvec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) {\n return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);\n}\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform vec4 fogByDistance;\nuniform vec4 fogColor;\nin vec2 v_textureCoordinates;\nvoid main(void) {\n float distance = getDistance(depthTexture, v_textureCoordinates);\n vec4 sceneColor = texture(colorTexture, v_textureCoordinates);\n float blendAmount = interpolateByDistanceMars3D(fogByDistance, distance);\n vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);\n out_FragColor = alphaBlend(finalFogColor, sceneColor);\n}\n ",uniforms:{fogColor:()=>t.fogColor||e.Color.WHITE,fogByDistance:()=>t.fogByDistance||new e.Cartesian4(100,0,9e3,.9)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Si=t=>{const i=new e.PostProcessStageComposite({name:"undefinedcontrast_bias_blur",stages:[new e.PostProcessStage({name:"undefinedcontrast_bias",fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float contrast;\n uniform float brightness;\n void main(void)\n {\n vec4 texture1 = texture(colorTexture, v_textureCoordinates);\n vec3 sceneColor = texture1.rgb;\n\n sceneColor = czm_RGBToHSB(sceneColor);\n sceneColor.z += brightness;\n sceneColor = czm_HSBToRGB(sceneColor);\n float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\n sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\n out_FragColor = vec4(sceneColor, texture1.a);\n }\n ",uniforms:{contrast:()=>128,brightness:()=>-.3}}),new e.PostProcessStageComposite({name:"undefined_blur_comp",stages:[new e.PostProcessStage({name:"undefinedhigh",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform float threshold;\n uniform float smoothWidth;\n\n in vec2 v_textureCoordinates;\n void main() {\n vec4 marstexel = texture( colorTexture, v_textureCoordinates );\n\n #ifdef CZM_SELECTED_FEATURE\n if (!czm_selected()) {\n marstexel = vec4(0.);\n }\n #endif\n\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float marsv = dot( marstexel.xyz, luma );\n float alpha = smoothstep(threshold, threshold + smoothWidth, marsv);\n\n vec4 outputColor = vec4(0.0,0.0,0.0,0.0);\n out_FragColor = mix( outputColor, marstexel, alpha );\n }\n ",uniforms:{threshold:()=>0,smoothWidth:()=>.01}})]})]}),n=t.scene.postProcessStages.add(new e.PostProcessStageComposite({name:"bloom_target",inputPreviousStageTexture:!1,stages:[i,new e.PostProcessStage({name:"undefinedgenerate_composite",fragmentShader:"\n uniform sampler2D colorTexture;\n uniform sampler2D bloomTexture;\n uniform float ratio;\n uniform vec4 color;\n in vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 color1 = texture(colorTexture, v_textureCoordinates);\n vec4 bloom = texture(bloomTexture, v_textureCoordinates);\n bloom *= color;\n if (czm_selected()) {\n bloom *= ratio;\n out_FragColor = bloom + color1;\n } else {\n out_FragColor = color1;\n }\n }\n ",uniforms:{bloomTexture:()=>"undefinedcontrast_bias_blur",color:()=>e.Color.GREEN,ratio:()=>2}})]}));n.enabled=!1;return n.selected=[],{stage:n,remove:()=>{t.scene.postProcessStages.remove(n)}}},Ii=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n uniform sampler2D colorTexture;\n in vec2 v_textureCoordinates;\n uniform float speed;\n uniform float size;\n uniform float direction;\n\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n\n void main(void) {\n\n float time = czm_frameNumber * speed / 1000.0;\n vec2 resolution = czm_viewport.zw;\n\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 finalColor = vec3(.6, .7, .8);//粒子的颜色\n\n float siMars3D = sin(direction), co = cos(direction);\n uv *= mat2(co, -siMars3D, siMars3D, co);\n uv *= length(uv + vec2(0, 4.9))*(20.0/size) + 1.0;\n\n float v = 1. - sin(hash(floor(uv.x * 100.0)) * 2.0);\n float b = clamp(abs(sin(20.0 * time * v + uv.y * (5. / (2.0 + v)))) - .95, 0.0, 1.0) * 20.0;\n finalColor *= v * b; //屏幕上雨的颜色\n\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor, 1.0), 0.5); //将雨和三维场景融合\n }\n ",uniforms:{speed:()=>t.speed||16,size:()=>t.size||20,direction:()=>360+(t.direction||30)}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Oi=t=>{const i=t.viewer,n=new e.PostProcessStage({fragmentShader:"\n#extension GL_OES_standard_derivatives:enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nin vec2 v_textureCoordinates;\nvec4 toEye(in vec2 uv, in float depth){\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera =posInCamera / posInCamera.w;\n return posInCamera;\n}\nfloat getDepth(in vec4 depth){\n float z_window = czm_unpackDepth(depth);\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n}\nvec3 guussColor(vec2 uv){\n vec2 pixelSize = 1.0 / czm_viewport.zw;\n float dx0 = -pixelSize.x;\n float dy0 = -pixelSize.y;\n float dx1 = pixelSize.x;\n float dy1 = pixelSize.y;\n vec4 gc = (\n texture(colorTexture, uv)+\n texture(colorTexture, uv + vec2(dx0, dy0)) +\n texture(colorTexture, uv + vec2(0.0, dy0)) +\n texture(colorTexture, uv + vec2(dx1, dy0)) +\n texture(colorTexture, uv + vec2(dx0, 0.0)) +\n texture(colorTexture, uv + vec2(dx1, 0.0)) +\n texture(colorTexture, uv + vec2(dx0, dy1)) +\n texture(colorTexture, uv + vec2(0.0, dy1)) +\n texture(colorTexture, uv + vec2(dx1, dy1))\n ) * (1.0 / 9.0);\n return gc.rgb;\n}\nvoid main(){\n float offset = 0.0;\n vec4 color = texture(colorTexture, v_textureCoordinates);\n vec4 currD = texture(depthTexture, v_textureCoordinates);\n if(currD.r>=1.0){\n out_FragColor = color;\n return;\n }\n float depth = getDepth(currD);\n\n vec4 positionEC = toEye(v_textureCoordinates, depth);\n vec3 dx = dFdx(positionEC.xyz);\n vec3 dy = dFdy(positionEC.xyz);\n vec3 normal = normalize(cross(dx,dy));\n\n vec4 positionWC = normalize(czm_inverseView * positionEC);\n vec3 normalWC = normalize(czm_inverseViewRotation * normal);\n float fotNumWC = dot(positionWC.xyz,normalWC);\n if(fotNumWC<=0.5){\n out_FragColor = color;\n return;\n }\n\n vec3 viewDir = normalize(positionEC.xyz);\n vec3 reflectDir = reflect(viewDir, normal);\n vec3 viewReflectDir = reflectDir;\n\n float step = 0.05;\n int stepNum = int(20.0 / step);\n vec3 pos;\n vec3 albedo;\n bool jd = false;\n for(int i = 1;i <= 400;i++)\n {\n float delta = step * float(i) + offset;\n pos = positionEC.xyz + viewReflectDir * delta;\n float d = -pos.z;\n\n vec4 tmp = czm_projection * vec4(pos,1.0);\n vec3 screenPos = tmp.xyz / tmp.w;\n vec2 uv = vec2(screenPos.x, screenPos.y) * 0.5 + vec2(0.5, 0.5);\n\n if(uv.x > 0.0 && uv.x < 1.0 && uv.y > 0.0 && uv.y < 1.0){\n float dd = getDepth(texture(depthTexture, uv));\n vec4 jzc = toEye(uv, dd);\n dd = -jzc.z;\n if(d>dd){\n if(abs(abs(d) - abs(dd)) <=step){\n jd = true;\n // albedo = texture(colorTexture, uv).rgb;\n albedo = guussColor(uv);\n }\n break;\n }\n }\n }\n if(jd){\n out_FragColor = vec4(mix(color.xyz,albedo,0.5),1.0);\n }else{\n out_FragColor = color;\n }\n}\n",uniforms:{}});i.scene.postProcessStages.add(n);return{stage:n,remove:()=>{i.scene.postProcessStages.remove(n)}}},zi=t=>{const i=t.viewer.scene.postProcessStages.add(new e.PostProcessStage({fragmentShader:"\n float hash(float x)\n {\n return fract(21654.6512 * sin(385.51 * x));\n }\n float hash(vec2 p)\n {\n return fract(1654.65157 * sin(15.5134763 * p.x + 45.5173247 * p.y + 5.21789));\n }\n vec2 hash2(vec2 p)\n {\n return vec2(hash(p * .754), hash(1.5743 * p + 4.5476351));\n }\n vec2 add = vec2(1.0, 0.0);\n vec2 noise2(vec2 x)\n {\n vec2 p = floor(x);\n vec2 f = fract(x);\n f = f * f * (3.0 - 2.0 * f);\n vec2 res = mix(mix(hash2(p),\n hash2(p + add.xy), f.x),\n mix(hash2(p + add.yx), hash2(p + add.xx), f.x), f.y);\n return res;\n }\n vec2 fbm2(vec2 x)\n {\n vec2 r = vec2(0.0);\n float a = 1.0;\n for (int i = 0; i < 8; i++)\n {\n r += noise2(x) * a;\n x *= 2.;\n a *= .5;\n }\n return r;\n }\n float dseg(vec2 ba, vec2 pa)\n {\n float h = clamp(dot(pa, ba) / dot(ba, ba), -0.2, 1.);\n return length(pa - ba * h);\n }\n uniform sampler2D colorTexture;\n uniform float fallInterval;\n uniform float mixFactor;\n in vec2 v_textureCoordinates;\n void main(void){\n vec2 uv = gl_FragCoord.xy;\n float iTime = czm_frameNumber * fallInterval * clamp(fallInterval * 0.1, 0.01, 0.1);\n vec2 p = uv / czm_viewport.zw;\n vec2 d;\n vec2 tgt = vec2(1., -1.);\n float c = 0.;\n if (p.y >= 0.)\n c = (1. - (fbm2((p + .2) * p.y + .1 * iTime)).x) * p.y;\n else\n c = (1. - (fbm2(p + .2 + .1 * iTime)).x) * p.y * p.y;\n vec3 col = vec3(0.);\n vec3 col1 = c * vec3(.3, .5, 1.);\n float mdist = 100000.;\n float t = hash(floor(5. * iTime));\n tgt += 4. * hash2(tgt + t) - 1.5;\n if (hash(t + 2.3) > .6)\n for (int i = 0; i < 100; i++) {\n vec2 dtgt = tgt - p;\n d = .05 * (vec2(-.5, -1.) + hash2(vec2(float(i), t)));\n float dist = dseg(d, dtgt);\n mdist = min(mdist, dist);\n tgt -= d;\n c = exp(-1.2 * dist) + exp(-55. * mdist);\n col = c * vec3(.7, .8, 1.);\n }\n col += col1;\n out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(col, 0.0), mixFactor);\n}\n ",uniforms:{mixFactor:()=>t.mixFactor||.1,fallInterval:()=>t.fallInterval||.8}}));i.selected=[];return{stage:i,remove:()=>{t.viewer.scene.postProcessStages.remove(i)}}},Fi=t=>new e.CustomShader({vertexShaderText:Ri,fragmentShaderText:ki,translucencyMode:0,lightingModel:e.LightingModel.UNLIT,uniforms:{colorEnable:{type:e.UniformType.BOOL,value:t.colorEnable||!0},glowEnable:{type:e.UniformType.BOOL,value:t.glowEnable||!0},baseHeight:{type:e.UniformType.FLOAT,value:t.baseHeight||100},glowRange:{type:e.UniformType.FLOAT,value:t.glowRange||100},uColor:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE},glowTime:{type:e.UniformType.FLOAT,value:t.glowTime||1}}}),Ri="\n void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput) {\n vsOutput.positionMC += 0.1 * vsInput.attributes.normalMC;\n }\n",ki="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)\n {\n vec4 position = czm_inverseModelView * vec4(fsInput.attributes.positionEC,1); // 位置 \n vec4 color = uColor;\n color *= vec4(vec3(position.z / baseHeight), 0.5); // 渐变\n bool glEnable = glowEnable;\n // if(position.z > baseHeight) {\n // material.diffuse = vec3(1.0,0.0,0.0);\n // return;\n // }\n if(position.z < 40.0) {\n glEnable = false;\n }\n if(!glEnable){\n material.diffuse = color.rgb;\n return; \n }\n \n // 动态光环\n float time = fract(czm_frameNumber / (360.0 * glowTime));\n time = abs(time - 0.5) * 2.0;\n float diff = step(0.005, abs(clamp(position.z / glowRange, 0.0, 1.0) - time));\n color.rgb += color.rgb * (1.0 - diff);\n material.diffuse = color.rgb;\n } \n",Li=t=>new e.CustomShader({fragmentShaderText:Bi,uniforms:{color:{type:e.UniformType.VEC4,value:t.color||e.Color.PURPLE}}}),Bi="\n void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {\n vec4 originColor = vec4(material.diffuse,1.0);\n material.diffuse = vec3(mix(originColor,color,0.3));\n material.alpha = 0.8;\n }\n",Ni=t=>{const i=t.scene.postProcessStages.add(e.PostProcessStageLibrary.createSilhouetteStage());i.uniforms.color=e.Color.YELLOW,i.selected=[];return{stage:i,remove:()=>{}}};var Gi=(e=>(e.DRAW_ADD="drawAdd",e.DRAW_MOVE="drawMove",e.DRAW_PICK="drawPick",e.DRAW_DB_CLICK="drawDbClick",e.DRAW_RIGHT_CLICK="drawRightClick",e))(Gi||{}),Ui=Object.freeze({__proto__:null,DrawEventType:Gi});const Vi={drawStart:{circle:"单击左键绘制圆的中心点,单机右键取消绘制。",rectangle:"单击左键绘制矩形左上角。",point:"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。",default:"单击左键绘制第一个节点,单机右键取消绘制。"},drawMove:{circle:"单击左键确定圆的半径并结束绘制,单机右键取消绘制。",rectangle:"单击左键结束绘制,单机右键取消绘制。","vertical-line":"单击左键结束绘制,单机右键取消绘制。","vertical-surface-line":"单击左键结束绘制,单机右键取消绘制。","default-dbclick":"单机左键绘制下一个节点,双击左键结束绘制,单机右键撤销上次绘制。",default:"单机左键绘制下一个节点,单机右键撤销上次绘制。"},drawEnd:"单击左键结束绘制,单机右键取消上次绘制",pointEnter:"双击左键编辑节点。",drawEditMove:{default:"移动鼠标修改节点,单击左键确定修改,单机右键取消修改。"}},Hi={point:{color:"rgba(255,255,0,0.8)",pixelSize:8,outlineColor:"rgba(255,255,255,0.8)",outlineWidth:3,disableDepthTestDistance:Number.POSITIVE_INFINITY},polyline:{width:5,color:"rgba(81,255,0,0.8)",depthFailColor:"rgba(255,0,0,0.5)"},polygon:{color:"rgba(255,255,54,0.3)",depthFailColor:"rgba(255,0,0,0.3)"}};class $i extends st{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.drawData.__needUpdateAppearance&&this.setAppearance(),this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=u(t).map(e=>ie([e.longitude,e.latitude])),n=h(t[0]).height,r=qe(t[0],t[1]),[o,s,a]=[i[0],i[1],i[2]],l=He(o,r/1e3,ue(o,s),ue(o,a)).geometry.coordinates.map(e=>[e[0],e[1],n]);l.push([...o.geometry.coordinates,n]),l.unshift([...o.geometry.coordinates,n]),this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(l.flat()),this.setShapePositions(this.drawData.shapePositions)}}const Wi=(e,t)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),qi=e=>{let t=0;return e&&Array.isArray(e)&&e.length>0&&e.forEach((i,n)=>{n<e.length-1&&(t+=Wi(i,e[n+1]))}),t},ji=e=>qi(e)**.99,Yi=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],Zi=(e,t)=>{let i;const n=Math.asin(Math.abs(t[1]-e[1])/Wi(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=n+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=2*Math.PI-n:t[1]<e[1]&&t[0]<e[0]?i=n:t[1]<e[1]&&t[0]>=e[0]&&(i=Math.PI-n),i},Xi=(e,t,i)=>{const n=Zi(t,e)-Zi(t,i);return n<0?n+2*Math.PI:n},Ji=(e,t,i,n,r)=>{const o=Zi(e,t),s=r?o+i:o-i,a=n*Math.cos(s),l=n*Math.sin(s);return[t[0]+a,t[1]+l]},Ki=function(e){if(e.length<=2)return e;const t=[],i=e.length-1;for(let n=0;n<=1;n+=.01){let[r,o]=[0,0];for(let t=0;t<=i;t++){const s=en(i,t),a=n**t,l=(1-n)**(i-t);r+=s*a*l*e[t][0],o+=s*a*l*e[t][1]}t.push([r,o])}return t.push(e[i]),t},Qi=e=>{let t=1;switch(e){case e<=1:t=1;break;case 2===e:t=2;break;case 3===e:t=6;break;case 24===e:t=24;break;case 5===e:t=120;break;default:for(let i=1;i<=e;i++)t*=i}return t},en=(e,t)=>Qi(e)/(Qi(t)*Qi(e-t));class tn extends st{positions;drawData;depthFailAppearance;connPoint;tempPoint4;llBodyPnts=[];rrBodyPnts=[];isClockWise;neckWidthFactor;headWidthFactor;headHeightFactor;neckHeightFactor;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance(),this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.connPoint=[0,0],this.tempPoint4=[0,0],this.isClockWise=!1}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.drawData.__needUpdateAppearance&&this.setAppearance(),this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<3)return this.drawData.shapePositions=t,void this.setShapePositions(this.drawData.shapePositions);const i=[],n=u(t).map(e=>(i.push(e.height),[e.longitude,e.latitude])),r=Math.max(...i),[o,s,a]=[n[0],n[1],n[2]],l=n.length;let c,d;3===l?(this.tempPoint4=this.getTempPoint4(o,s,a),this.connPoint=Yi(o,s)):4===l?(this.tempPoint4=n[3],this.connPoint=Yi(o,s)):(this.tempPoint4=n[3],this.connPoint=n[4]),this.isClockWise=((e,t,i)=>(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0]))(o,s,a),this.isClockWise?(c=this.getArrowPoints(o,this.connPoint,this.tempPoint4,!1),d=this.getArrowPoints(this.connPoint,s,a,!0)):(c=this.getArrowPoints(s,this.connPoint,a,!1),d=this.getArrowPoints(this.connPoint,o,this.tempPoint4,!0));const h=c.length,m=(h-5)/2,f=c.slice(0,m),g=c.slice(m,m+5);let v=c.slice(m+5,h);this.llBodyPnts=f;let y=d.slice(0,m);const _=d.slice(m,m+5),C=d.slice(m+5,h);this.rrBodyPnts=C,y=Ki(y);const w=Ki(C.concat(f.slice(1)));v=Ki(v);const b=y.concat(_,w,g,v).filter(e=>e[0]&&e[1]).map(t=>new e.Cartographic(t[0],t[1],r)),x=p(b);this.drawData.shapePositions=x,this.drawData.shapePositions.push(x[0]),this.setShapePositions(this.drawData.shapePositions)}getTempPoint4(e,t,i){const n=Yi(e,t),r=Wi(n,i),o=Xi(e,n,i);let s,a,l,c=[0,0];return o<Math.PI/2?(s=r*Math.sin(o),a=r*Math.cos(o),l=Ji(e,n,Math.PI/2,s,!1),c=Ji(n,l,Math.PI/2,a,!0)):o>=Math.PI/2&&o<Math.PI?(s=r*Math.sin(Math.PI-o),a=r*Math.cos(Math.PI-o),l=Ji(e,n,Math.PI/2,s,!1),c=Ji(n,l,Math.PI/2,a,!1)):o>=Math.PI&&o<1.5*Math.PI?(s=r*Math.sin(o-Math.PI),a=r*Math.cos(o-Math.PI),l=Ji(e,n,Math.PI/2,s,!0),c=Ji(n,l,Math.PI/2,a,!0)):(s=r*Math.sin(2*Math.PI-o),a=r*Math.cos(2*Math.PI-o),l=Ji(e,n,Math.PI/2,s,!0),c=Ji(n,l,Math.PI/2,a,!1)),c}getArrowPoints(e,t,i,n){const r=Yi(e,t),o=Wi(r,i);let s=Ji(i,r,0,.3*o,!0),a=Ji(i,r,0,.5*o,!0);s=Ji(r,s,Math.PI/2,o/5,n),a=Ji(r,a,Math.PI/2,o/4,n);const l=[r,s,a,i],c=this.getArrowHeadPoints(l);if(!(c&&Array.isArray(c)&&c.length>0))throw new Error("Interpolation Error");{const i=c[0],n=c[4],r=Wi(e,t)/ji(l)/2,o=this.getArrowBodyPoints(l,i,n,r);if(o){const r=o.length;let s=o.slice(0,r/2),a=o.slice(r/2,r);return s.push(i),a.push(n),s=s.reverse(),s.push(t),a=a.reverse(),a.push(e),s.reverse().concat(c,a)}}}getArrowBodyPoints(e,t,i,n){const r=qi(e),o=ji(e)*n,s=(o-Wi(t,i))/2;let a=0;const l=[],c=[];for(let t=1;t<e.length-1;t++){const i=Xi(e[t-1],e[t],e[t+1])/2;a+=Wi(e[t-1],e[t]);const n=(o/2-a/r*s)/Math.sin(i),d=Ji(e[t-1],e[t],Math.PI-i,n,!0),u=Ji(e[t-1],e[t],i,n,!1);l.push(d),c.push(u)}return l.concat(c)}getArrowHeadPoints(e){const t=ji(e)*this.headHeightFactor,i=e[e.length-1],n=t*this.headWidthFactor,r=t*this.neckWidthFactor,o=t*this.neckHeightFactor,s=Ji(e[e.length-2],i,0,t,!0),a=Ji(e[e.length-2],i,0,o,!0),l=Ji(i,s,Math.PI/2,n,!1),c=Ji(i,s,Math.PI/2,n,!0);return[Ji(i,a,Math.PI/2,r,!1),l,i,c,Ji(i,a,Math.PI/2,r,!0)]}}class nn extends st{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.drawData.__needUpdateAppearance&&this.setAppearance(),this.calcShapePositions(this.positions),this.positions.length<2)return this._primitive;const t=JSON.parse(JSON.stringify(this.drawData.shapePositions||[])),i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.depthFailColor)})})}calcShapePositions(t){if(t.length<2)return;const i=u(t).map(e=>ie([e.longitude,e.latitude])),n=h(t[0]).height,r=je(t)/1e3,[o,s]=[i[0],i[1]],a=ue(o,s),l=he(o,.1*r,a-90,{units:"kilometers"}),c=he(o,.1*r,a+90,{units:"kilometers"}),d=he(o,.8*r,a-5,{units:"kilometers"}),p=he(o,.8*r,a+5,{units:"kilometers"}),m=he(o,.75*r,a-13,{units:"kilometers"}),f=he(o,.75*r,a+13,{units:"kilometers"}),g=[...l.geometry.coordinates,n,...d.geometry.coordinates,n,...m.geometry.coordinates,n,...s.geometry.coordinates,n,...f.geometry.coordinates,n,...p.geometry.coordinates,n,...c.geometry.coordinates,n,...l.geometry.coordinates,n];this.drawData.shapePositions=e.Cartesian3.fromDegreesArrayHeights(g.flat()),this.setShapePositions(this.drawData.shapePositions)}}const rn=e=>{const t=new $i(e);e.primitives.add(t)},on=e=>{const t=new tn(e);e.primitives.add(t)},sn=e=>{const t=new nn(e);e.primitives.add(t)},an="cm",ln="厘米",cn="m",dn="米",un="km",hn="千米",pn="公里",mn="㎡",fn="平方厘米",gn="㎡",vn="平方米",yn="km²",_n="平方千米",Cn="平方公里",wn="亩",bn="公顷",xn={cm:"cm²",m:"㎡",km:"km²","米":"平方米","千米":"平方千米","公里":"平方公里"},Pn=(e,t,i)=>t===i?e:e*Tn(i),Mn=(e,t,i)=>t===i?e:e*function(e){switch(e){case mn:return 1e4;case gn:return 1;case yn:return 1e-6;case fn:return 1e4;case vn:return 1;case _n:case Cn:return 1e-6;case wn:return.0015;case bn:return 1e-4;default:return 1}}(i),Dn=e=>xn[e],Tn=e=>{switch(e){case cn:return 1;case an:case ln:return 100;case un:return.001;case dn:return 1;case hn:case pn:return.001;default:return 1}};const En=(t,i)=>{let n=t;if("vertical-surface-line"===i&&t.length>=1){const i=t[0],r=e.Cartographic.fromCartesian(i),o=e.Math.toDegrees(r.longitude),s=e.Math.toDegrees(r.latitude),a=0;n=[e.Cartesian3.fromDegrees(o,s,r.height),e.Cartesian3.fromDegrees(o,s,a)]}if("vertical-line"===i&&t.length>=2){const i=t[0],r=t[1],o=h(i),s=h(r);let a=o,l=s;o.height>s.height&&(a=s,l=o),console.log(a.longitude,a.latitude,l.height);const c=m(new e.Cartographic(a.longitude,a.latitude,l.height));n=[m(a),c,m(l),m(a)]}return i.startsWith("curve")&&t.length>2&&(n=In(t)),n},An=(e,t,i,n,r)=>{i.push(...e.map((i,r)=>{const o=e[r+1];if(o){let e=t?Ye(i,o):qe(i,o);return e=Pn(e,"m",n),{value:Number(e.toFixed(2)),unit:n,position:Xe([i,o]),positions:[i,o]}}return null}).filter(e=>e&&e.value>0))},Sn=e=>{if(2===e.length)return e;let[t,i]=e;return i||(i=Dn(t)),[t,i]},In=t=>{const i=t.length,n=Ze(t),r=Math.floor(n/5),o=[];for(let e=0;e<i;e++)o.push(1.5*e);const s=new e.CatmullRomSpline({points:t,times:o}),a=[],l=o[0],c=o[o.length-1];for(let t=0;t<r;t++){const i=t/(r-1),n=e.Math.lerp(l,c,i),o=s.evaluate(n);a.push(o)}return a},On=(t,i=1e3)=>{if(t.length<2)return console.warn("至少需要2个点才能生成箭头"),[];const n=t[t.length-1],r=t[t.length-2],o=h(n),s=h(r),a=o.height,l=o.longitude-s.longitude,c=o.latitude-s.latitude,d=Math.sqrt(l**2+c**2);if(d<1e-12)return console.warn("最后两点经纬度重合,无法生成箭头"),[];const u=l/d,p=c/d,f=(t=>{const i=e.Math.toRadians(.5),n=m(t),r=m(new e.Cartographic(t.longitude+i,t.latitude,t.height)),o=2*e.Cartesian3.distance(n,r),s=m(new e.Cartographic(t.longitude,t.latitude+i,t.height));return{lon:o,lat:2*e.Cartesian3.distance(n,s)}})(o),g=i/f.lon*e.Math.RADIANS_PER_DEGREE,v=i/f.lat*e.Math.RADIANS_PER_DEGREE,y=Math.PI/6,_=i*Math.tan(y),C=_/f.lon*e.Math.RADIANS_PER_DEGREE,w=_/f.lat*e.Math.RADIANS_PER_DEGREE,b=o.longitude-u*g-p*C,x=o.latitude-p*v+u*w,P=o.longitude-u*g+p*C,M=o.latitude-p*v-u*w,D=m(new e.Cartographic(b,x,a)),T=m(new e.Cartographic(P,M,a));return[D,m(new e.Cartographic(o.longitude,o.latitude,a)),T]};class zn extends st{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=En(this.positions,this.drawData.shape);if(this.drawData.shapePositions=t,"vertical-surface-line"===this.drawData.shape){const e=this.drawData.pointPrimitives.get(1);e&&(e.position=this.drawData.shapePositions[1])}if(this.setShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:this.drawData.style.polyline.width}):new e.PolylineGeometry({positions:t,width:this.drawData.style.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;this.drawData.__needUpdateAppearance&&this.setAppearance();const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(this.drawData.style.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(this.drawData.style.polyline.depthFailColor)})}))}}class Fn extends st{positions;drawData;depthFailAppearance;constructor(e){super(),this.drawData=e,this.positions=e.positions,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;this.drawData.__needUpdateAppearance&&this.setAppearance();const t=JSON.parse(JSON.stringify(this.positions));if(this.calcShapePositions(t),this.positions.length<3)return;const i=[new e.GeometryInstance({geometry:new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),perPositionHeight:!0}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?new e.GroundPrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):new e.Primitive({geometryInstances:i,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.depthFailColor)})})}calcShapePositions(e){const t=[...e,e[0]];this.drawData.shapePositions=t,this.setShapePositions(this.drawData.shapePositions)}}class Rn extends st{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return;this.drawData.__needUpdateAppearance&&this.setAppearance(),this.primitiveCollection.removeAll(),this.calcShapePositions(this.positions);const t=JSON.parse(JSON.stringify(this.positions)),i=this.drawData.clampToGround?Ye(t[0],t[1]):qe(t[0],t[1]);if(!i)return;const n=e.Cartographic.fromCartesian(t[0]).height,r=[new e.GeometryInstance({geometry:new e.CircleGeometry({center:t[0],height:n,radius:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:r,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:r,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const n=qe(t[0],t[1]),r=e.Cartographic.fromCartesian(t[0]).height,o=new e.CircleOutlineGeometry({center:t[0],height:r,radius:n}),s=e.CircleOutlineGeometry.createGeometry(o);let a=[];if(s){const t=[].slice.call(s.attributes.position.values);a=e.Cartesian3.unpackArray(t),a.push(a[0]),i=a}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class kn extends st{positions;drawData;depthFailAppearance;primitiveCollection;constructor(t){super(),this.drawData=t,this.positions=t.positions,this.primitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;if(this.positions.length<2)return this.primitiveCollection;this.primitiveCollection.removeAll(),this.drawData.__needUpdateAppearance&&this.setAppearance();const t=JSON.parse(JSON.stringify(this.positions));t.length=2,this.calcShapePositions(t);const i=e.Cartographic.fromCartesian(t[0]).height,n=e.Rectangle.fromCartesianArray(t),r=[new e.GeometryInstance({geometry:new e.RectangleGeometry({rectangle:n,height:i}),id:`draw-${this.drawData.id}`})];return this.drawData.clampToGround?this.primitiveCollection.add(new e.GroundPrimitive({geometryInstances:r,appearance:this.appearance,asynchronous:!1})):this.primitiveCollection.add(new e.Primitive({geometryInstances:r,appearance:this.appearance,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.primitiveCollection}setAppearance(){this.appearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.color)})}),this.depthFailAppearance=new e.MaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString(this.drawData.style.polygon.depthFailColor)})})}calcShapePositions(t){let i=t;const n=e.Cartographic.fromCartesian(t[0]).height,r=e.Rectangle.fromCartesianArray(t),o=new e.RectangleOutlineGeometry({rectangle:r,height:n}),s=e.RectangleOutlineGeometry.createGeometry(o);let a=[];if(s){const t=[].slice.call(s.attributes.position.values);a=e.Cartesian3.unpackArray(t),a.push(a[0]),i=a}this.drawData.shapePositions=i,this.setShapePositions(this.drawData.shapePositions)}}class Ln extends st{drawData;labelCollection;measureDivs;cesiumWidget;viewer;constructor(t,i){super(),this.viewer=i,this.cesiumWidget=i._element.getElementsByClassName("cesium-widget")[0],this.drawData=t,this.labelCollection=new e.LabelCollection({scene:i.scene}),this.drawData.measureLabel&&this.setAppearance(),this.measureDivs=[],this.renderDivPosition()}getPrimitive(){return this.drawData.isEditing&&this.drawData.measureLabel?"point"===this.drawData.shape?(this.updatePointDivLabel(),this.labelCollection):this.drawData.shapePositions&&this.drawData.shapePositions.length>=2?(this.updateUnit(this.drawData.measureUnit),this.labelCollection):void 0:this.labelCollection}updateUnit(e){if("point"===this.drawData.shape)return;this.drawData.measureUnit=e,this.clearAllDiv();const t=(e=>{let{shapePositions:t,positions:i,shape:n,clampToGround:r,measureUnit:o}=e;t||(t=i),r||(r=!1);const[s,a]=Sn(o),l=Dn("m");e.measureUnit=[s,a];const c=[];if("polyline"===n&&(An(i,r,c,s),c.push({value:0,unit:s,position:i[0],positions:i,prefixText:"起点"}),c.push({value:Number(c.reduce((e,t)=>e+t.value,0).toFixed(2)),unit:s,position:i[i.length-1],positions:i})),"vertical-surface-line"===n&&An(t,r,c,s),"vertical-line"===n&&(An(t,r,c,s),c.forEach((e,t)=>{0===t&&(e.prefixText="高度"),1===t&&(e.prefixText="水平距离"),2===t&&(e.prefixText="空间距离")})),"polygon"===n){An(t,r,c,s);const e=Mn(Je(t),l,a);c.push({value:Number(e.toFixed(2)),unit:a,position:Xe(t),positions:t})}if("rectangle"===n){An(t,r,c,s);const e=Mn(Je(t),l,a);c.push({value:Number(e.toFixed(2)),unit:a,position:Xe(t),positions:t})}if("circle"===n){const e=r?Ye(i[0],i[1]):qe(i[0],i[1]);c.push({value:Number(Pn(e,"m",s).toFixed(2)),unit:s,position:i[1],positions:i,prefixText:"半径"});const t=Mn(e*e*Math.PI,l,a);e>0&&c.push({value:Number(t.toFixed(2)),unit:a,position:i[0],positions:i})}return c})(this.drawData);this.drawData.measureResult=t,t.forEach((e,t)=>{let i="";e.prefixText?(i=`${e.prefixText}`,e.value&&(i+=`:${e.value}${e.unit}`)):i+=`${e.value}${e.unit}`;const n=this.createDiv(`measure-label-${this.drawData.id}-${t}`,i);this.measureDivs.push({position:e.position,divEle:n})})}updatePointDivLabel(){this.clearAllDiv(),this.drawData.positions.forEach(e=>{const t=h(e),i=this.createDiv(`measure-label-${this.drawData.id}-0`,`经度:${t.longitude.toFixed(6)}\n纬度:${t.latitude.toFixed(6)}\n高度:${t.height.toFixed(6)}`);this.measureDivs.push({position:e,divEle:i})})}renderDivPosition(){this.viewer.scene.postRender.addEventListener(()=>{this.measureDivs.forEach(e=>{const t=this.viewer.scene.cartesianToCanvasCoordinates(e.position);if(t){e.divEle.style.display="block";const i=e.divEle.getBoundingClientRect();e.divEle.style.left=t.x-i.width/2+"px",e.divEle.style.top=t.y-i.height+"px"}else e.divEle.style.display="none"})})}destroy(){super.destroy(),this.clearAllDiv()}setAppearance(){}clearAllDiv(){this.measureDivs.forEach(e=>{e.divEle.remove()}),this.measureDivs=[]}createDiv(e,t,i=48){const n=`\n <div style="\n background: rgba(0, 0, 0, 0.6);\n color: white;\n border-radius: 5px;\n padding: 0 10px 0 10px;\n font-size: 14px;\n white-space: nowrap;\n pointer-events: none;\n ">\n ${t.split("\n").map(e=>`\n <div style="height: 24px; line-height: 24px">\n ${e}\n </div>\n `).join(" ")}\n </div>\n <div style="\n height: ${i}px;\n width: 2px;\n background: rgba(0, 0, 0, 0.6);\n margin: auto;\n ">\n </div>\n `,r=document.createElement("div");return r.id=e,r.innerHTML=n,r.style.position="absolute",r.style.pointerEvents="none",r.className=`measure-label measure-label-${this.drawData.id}`,this.cesiumWidget.appendChild(r),r}calcShapePositions(e){this.setShapePositions(e)}}class Bn extends st{positions;drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;viewer;arrowLengthScale;constructor(t,i){super(),this.arrowLengthScale=5,this.drawData=t,this.positions=t.positions,this.linePrimitiveCollection=new e.PrimitiveCollection,this.viewer=i,this.setAppearance()}getGeometry(){if(this.positions.length<2)return;let t=this.positions;t=En(t,this.drawData.shape);let i=Ze(t)/this.arrowLengthScale;return i>3e6&&(i=3e6),t=On(t,i/2),this.calcShapePositions(t),t.length<2?void 0:(this.setShapePositions(t),this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:this.drawData.style.polyline.width}):new e.PolylineGeometry({positions:t,width:this.drawData.style.polyline.width}))}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;this.drawData.__needUpdateAppearance&&this.setAppearance();const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:this.drawData.id});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(this.drawData.style.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(this.drawData.style.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}class Nn extends st{drawData;appearanceTran;depthFailAppearance;linePrimitiveCollection;constructor(t){super(),this.drawData=t,this.linePrimitiveCollection=new e.PrimitiveCollection,this.setAppearance()}getGeometry(){const t=this.drawData.shapePositions||[];if(this.calcShapePositions(t),!(t.length<2))return this.drawData.clampToGround?new e.GroundPolylineGeometry({positions:t,width:this.drawData.style.polyline.width}):new e.PolylineGeometry({positions:t,width:this.drawData.style.polyline.width})}getPrimitive(){if(!this.drawData.isEditing)return this._primitive;this.drawData.__needUpdateAppearance&&this.setAppearance();const t=this.getGeometry();if(!t)return;const i=new e.GeometryInstance({geometry:t,id:`draw-${this.drawData.id}`});return t?this.drawData.clampToGround?new e.GroundPolylinePrimitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1}):(this.linePrimitiveCollection.removeAll(),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearance,asynchronous:!1})),this.linePrimitiveCollection.add(new e.Primitive({geometryInstances:i,appearance:this.appearanceTran,depthFailAppearance:this.drawData.disDepthFail?void 0:this.depthFailAppearance,asynchronous:!1})),this.linePrimitiveCollection):void 0}setAppearance(t){t?this.appearance=t:(this.appearance=new e.PolylineMaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(this.drawData.style.polyline.color)}}})}),this.appearanceTran=new e.MaterialAppearance({material:new e.Material({fabric:{type:"Color",uniforms:{color:new e.Color(0,0,0,0)}}})}),this.depthFailAppearance=new e.PolylineMaterialAppearance({material:e.Material.fromType(e.Material.PolylineDashType,{color:e.Color.fromCssColorString(this.drawData.style.polyline.depthFailColor)})}))}calcShapePositions(e){this.setShapePositions(e)}}const Gn={point:1,circle:2,rectangle:2,sector:3,"vertical-surface-line":1,"vertical-line":2},Un={},Vn=e=>{const{type:t,action:i,outline:n,pointCount:r}=e;Un[t]=(e,t)=>{i(e,t),n&&Wn(e)},r&&(Gn[t]=r)},Hn=(e,t,i)=>{Un[t]&&Un[t](i,e)},$n=e=>{const t=new zn(e);e.primitives.add(t)},Wn=e=>{const t=new Nn(e);e.primitives.add(t)},qn=(e,t)=>{const i=new Bn(e,t);e.primitives.add(i)},jn=e=>{const t=new Fn(e);e.primitives.add(t)},Yn=e=>{const t=new Rn(e);e.primitives.add(t)},Zn=e=>{const t=new kn(e);e.primitives.add(t)},Xn=(e,t)=>{const i=new Ln(e,t);e.primitives.add(i),e.measurePrimitive=i,e.primitives.raiseToTop(i)},Jn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAQBJREFUWEft2MsNgkAQBuAZtABCBctBErvATryiRRibkKudGKvgwMFtQGIBumOAYAxCArsTs4fZ8w758032wSJ4PtDzfCABXTvEKhjmhXpka+0a6rueNWB0KgmAdLVLYq6QbAHDvEwDgksdzOAz5pKUgK6tFkERnCogq3iq1Ng8ERRBS4HBjTrKywMAqjnfJCKFAGlTg3ieU9vOJV1lq2O/bjhgcyv59yBt8LXpXzLYBFsE2toKojHX+z75kWc8iwsV0PLm8XVLArotivp/RFrsYiiCLnp1rQiKoKWAHHWWcJ8yZsFF8zbj5eNRt9VwPRp1hGyCrq0cq5eArrLeC74BlkT4KR3TrCoAAAAASUVORK5CYII=",Kn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAY9JREFUWEftmNFRwzAMhiVYAMoC5Y50jjAJ9LFliMIQNI/NJtA1CA9hAHIsgMWZYC5xHVtNajcHzqtl+ctvSZaNMPIPR84HEXDoDv1tBc/XxRMCpFaVEPNqcTXvq6RTwbOsSE8FTfUFBOKNE05NQsxRiK3u4/MEy49F8myDdwJOstcNEN32VWCouhHQu4JetnYPp84tVr4uHl8OGofvd7Ocw8kGnKwL4jjk2lTLhLU2y0guGgE7pI8KdsVkuBhEzDtPGstYEEAkmstyMcmKFRDcN9WyjUk774AKQEE1IW1jyt47IACV1XJ22VRNQqKgN70Im9qyAIASbRdST4qunjEQoB3S1tAGBATQY05iy7ObEDdHLzMmOFPi6KBBFLTBuSC9A5rg6pijqSm79TrpHRC021o7IdrZfbwy8wNpztYacgRlhtuitu38b3E/rt9Z/w+Q9czBVtV9RCpX7I7adTKw2QBAIFy7njz2Bvy+OGXFighS9pvMDjWVdXlKHrg/xFaQ6/DQdhFwqKJRwaEKfgEJRgs46ima/wAAAABJRU5ErkJggg==",Qn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAMdJREFUWEdjZBjkgHGQu49h1IGUxtBoCI6GIKUhQKn+0TQ4GoKUhgCl+kfT4GgIUhoClOofTYM0DUGh6bfrGRgYFSi1BJ9+xn//Dr7NVluASw3eKBaadvs/LR0HM/sfI4Pjh0zVA9jswulAgenXFZj+s9ynjwP/KH7I1HxAkgNBioWn3kr4z8RkT1tH/n/wLlO1kawopq3DiDN9tJghLpxwqxoNwdEQpDQEKNU/mgZHQ5DSEKBU/2gaHA1BSkOAUv2jaXDYhyAAbjwcKU1UyjYAAAAASUVORK5CYII=",er="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAkJJREFUWEftl19SwkAMxpPCARAvgDPijKewnER4BA8hHEJ5FE8CnsIZccZ6AJEDMF1Ny5Zu/6bNMvQBXmk3vyZfvmQRGv7DhvPBGVBaIasZ7M4/XwhoM74eScH0+9YAAzilhuHByttMbq5sQFoBNOE0lh1IMeDF83qJAG52tuSQIsBiODuZrA14+fQxVIhBUwSqA1hFmURcHPQIAIiLuo1TG5CguvP14z/Z1EcYtHzVi4ARpj7sXh3V/iLw30l/ULdhRIAUtDN/723Ht56RUYTpZtyf6f/qwtF7YkAdPAtQAmbdB08KSMF/Hm4WRRmpCkjeyWmc0hJHVlLSiaQ3gHYv/IidR7rM+6CDPZX7ZCFg0ueoW7fj/kqiLfoQ6u7DGcWQuYDHgNNQVSAzAZNwgQkjpDJHXldUSm1DDrTv01nHnmHmOQtGCpA3vsJwnJJ35mvXUbBkySJD5ylAPR04B54EMD7C4kJGBbMkdJn16BK3/FZq21GOc8eZ17lNYmZSeeHA76cgOZlOPpMse9G8zgUMOo3ErWC631c8H3Fk22bKlolCHzQgLRq1rk4ZHGtZIEjSUJneqo46zvhkAXI1VhWQe27pLOYe1FhAXapGLqzhddN3yYLQV9/myg9vwQQR3EdEGkz6pAL09KXJuECFUYIrAFcu8edqazDtk9nhOVZSBF4b0NhUIjM3Q0nhRCU2djtj4uznjvC6qc8XZTCer7gmbWTOOqDegpQCV3JRT+rRWgbrdCjnnTMgJ0tHsxlpcM77f6iGZThXF5iUAAAAAElFTkSuQmCC";class tr{static editUI;_editUi;viewer;_editUiPosition=null;_editPointPrimitive=null;_drawEditEvent;elementId="draw-edit-ui";constructor(e,t){this._editUi=null,this.viewer=e,this.create(),this.setVisible(!1),this.renderPosition(),this._drawEditEvent=t}create(){if(this._editUi=document.getElementById(this.elementId),this._editUi)return this._editUi;const e=document.createElement("DIV");e.id=this.elementId,e.className="draw-edit-ui";const t=document.createElement("DIV");t.title="点击移动节点";const i=document.createElement("img");i.src=er,i.className="draw-edit-icon",t.appendChild(i),t.addEventListener("click",()=>{this._drawEditEvent.drawEditMove&&this._drawEditEvent.drawEditMove(this._editPointPrimitive)});const n=document.createElement("DIV");n.id="addPoint";const r=document.createElement("img");r.src=Jn,r.title="点击添加节点",r.className="draw-edit-icon",n.appendChild(r),n.addEventListener("click",()=>{this._drawEditEvent.drawEditAdd&&this._drawEditEvent.drawEditAdd(this._editPointPrimitive)});const o=document.createElement("DIV"),s=document.createElement("img");o.id="removePoint",s.src=Qn,s.title="点击删除节点",s.className="draw-edit-icon",o.appendChild(s),o.addEventListener("click",()=>{this._drawEditEvent.drawEditRemove&&this._drawEditEvent.drawEditRemove(this._editPointPrimitive)});const a=document.createElement("DIV"),l=document.createElement("img");l.src=Kn,l.title="点击删除绘制",l.className="draw-edit-icon",a.appendChild(l),a.addEventListener("click",()=>{this._drawEditEvent.drawDelete&&this._drawEditEvent.drawDelete(this._editPointPrimitive)}),e.appendChild(t),e.appendChild(n),e.appendChild(o),e.appendChild(a),document.body.appendChild(e),this._editUi=e}setAddElementStatus(e){const t=document.getElementById("addPoint"),i=document.getElementById("removePoint");t&&(t.style.display=e?"block":"none"),i&&(i.style.display=e?"block":"none")}static createEditUi(e,t){return tr.editUI||(tr.editUI=new tr(e,t)),tr.editUI}showAt(e,t,i){this.setVisible(!0),this._editUiPosition=e,this._editPointPrimitive=t,this.setAddElementStatus(!Gn[i])}setVisible(e){this._editUi&&(this._editUi.style.display=e?"flex":"none")}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(this._editUiPosition&&this._editUi&&"flex"===this._editUi.style.display){const e=this.viewer.scene.cartesianToCanvasCoordinates(this._editUiPosition);this._editUi.style.position="fixed",this._editUi.style.top=e.y-28+"px",this._editUi.style.left=`${e.x+15}px`}})}destroy(){tr.editUI&&(this._editUi&&this._editUi.parentNode.removeChild(this._editUi),this._editUi=null)}}Un.polyline=e=>{$n(e)},Un["polyline-arrow"]=(e,t)=>{$n(e),qn(e,t)},Un.curve=e=>{$n(e)},Un["curve-arrow"]=(e,t)=>{$n(e),qn(e,t)},Un["vertical-line"]=e=>{e.clampToGround=!1,$n(e)},Un["vertical-surface-line"]=e=>{e.clampToGround=!1,$n(e)},Un.polygon=e=>{jn(e),Wn(e)},Un.circle=e=>{Yn(e),Wn(e)},Un.rectangle=e=>{Zn(e),Wn(e)},Vn({type:"sector",action:rn,outline:!0,pointCount:3}),Vn({type:"db-arrow",action:on,outline:!0,pointCount:4}),Vn({type:"fine-arrow",action:sn,outline:!0,pointCount:2});const ir=t=>{let i;const n=[];let r=new e.Cartesian3(0,0,0);const o=[];let s,a,l;const c=V.createToolTip(t);let d=!1;((t,i)=>{const n=t.scene,r=new e.ScreenSpaceEventHandler(n.canvas);let o;t.cesiumWidget.screenSpaceEventHandler.removeInputAction(e.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),r.setInputAction(e=>{const r=n.pickPosition(e.position),s=(new Date).getTime();if(o&&s-o<270){const n=t.scene.pick(e.position);return void i(Gi.DRAW_DB_CLICK,{position:r,pickPrimitive:n?.primitive,windowPosition:e.position})}i(Gi.DRAW_ADD,{position:r}),o=(new Date).getTime()},e.ScreenSpaceEventType.LEFT_CLICK),r.setInputAction(e=>{const r=t.scene.pick(e.endPosition),o=n.pickPosition(e.endPosition);i(Gi.DRAW_MOVE,{position:o,pickPrimitive:r?.primitive,windowPosition:e.endPosition}),r&&i(Gi.DRAW_PICK,{position:o,pickPrimitive:r?.primitive,windowPosition:e.endPosition})},e.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(()=>{i(Gi.DRAW_RIGHT_CLICK,{})},e.ScreenSpaceEventType.RIGHT_CLICK)})(t,(e,t)=>{s&&(["drawDbClick","drawPick","drawMove","drawRightClick"].includes(e)||s.isEditing)&&g[e]?.(t)});const u=new e.PrimitiveCollection;u.destroyPrimitives=!1,t.scene.primitives.add(u);const h=()=>{s&&(s.isEditing=!1,s.isDisAdd=!0,_(),w.id===s.id?m():(p(s.id),s={}))},p=e=>{const t=o.findIndex(t=>t.id===e);if(-1===t)return;const i=o[t];i.positions.length=0,o.splice(t,1),T.drawRemove&&T.drawRemove(i),setTimeout(()=>{i.measurePrimitive?.clearAllDiv(),u.remove(i?.primitives)},300)},m=()=>{if(w.id)return w.id="",s.isDisAdd=!0,s.isEditing=!0,w.originPosition?(s.positions.splice(w.index,1,w.originPosition),w.pointPrimitive.position=w.originPosition):s?.positions.splice(w.index,1),T.drawEditEnd&&T.drawEditEnd(s),setTimeout(()=>{s.isEditing=!1,s.isDisAdd=!1},300),r=new e.Cartesian3(0,0,0),a=void 0,void _();if((!Gn[s.shape]||Gn[s.shape]>2)&&s.positions&&s.positions.length>2){const e=d?2:1,t=s.pointPrimitives.get(s.positions.length-e);return s.pointPrimitives.remove(t),void s?.positions.splice(s.positions.length-e,1)}r=new e.Cartesian3(0,0,0),a=void 0,p(s.id),s={},_()},f=i=>{i||(i=s),t._element.style.cursor="default",r=new e.Cartesian3(0,0,0),i.positions.pop(),i.isDisAdd=!0,setTimeout(()=>{i.isEditing=!1,i.isDisAdd=!1,T.drawEnd&&T.drawEnd(i),s={}},300),a=void 0,l&&(i.pointPrimitives.remove(l),l=void 0),_()},g={drawAdd:({position:e})=>{if(s.positions.push(e),d=!1,w.id)return T.drawEditEnd&&T.drawEditEnd(s),w.id="",void f();M(e,s),T.drawAdd&&T.drawAdd(e,s),s.positions.length>Gn[s.shape]&&f()},drawMove:({position:e,windowPosition:t})=>{if(d=!0,C(),e&&!s.isDisAdd&&s.isEditing){if(_(t),w.id)s.positions.splice(w.index,1,e),w.pointPrimitive.position=e;else{const t=s.positions.findIndex(e=>e.x===r.x&&e.y===r.y&&e.z===r.z);s.positions.push(e),-1!==t&&s.positions.splice(t,1),l&&s.pointPrimitives.remove(l),l=M(e,s)}r=e,T.drawMove&&T.drawMove(e,s)}},drawPick:({pickPrimitive:t,windowPosition:i})=>{s.isEditing||t instanceof e.PointPrimitive&&v(t,i)},drawDbClick:({position:e,windowPosition:t,pickPrimitive:i})=>{if(s.isEditing){if(Gn[s.shape])return;f()}else!s.isEditing&&i&&y(e,t,i)},drawRightClick:()=>{s.isEditing?m():i.setVisible(!1)}},v=(e,i)=>{const r=e.id.split("-")[1],s=o.find(e=>e.id===r);if(n.includes(e.id))return;if(!s)return;if(!s.edit)return;t._element.style.cursor="pointer";const l=s.style.point;e.pixelSize=1.5*l.pixelSize,e.outlineWidth=1.5*l.outlineWidth,a=e,c.showAt(i,Vi.pointEnter),c.setVisible(!0)},y=(t,r,s)=>{if(s instanceof e.PointPrimitive){if(n.includes(s.id))return;const e=s.id.split("-")[1],r=o.find(t=>t.id===e);if(!r)return;if(!r.edit)return;console.log(s),i.showAt(t,s,r.shape),T.drawEditStart&&T.drawEditStart(r)}},_=e=>{if(!c)return void(t._element.style.cursor="default");if(!e||!s.positions)return t._element.style.cursor="default",void c.setVisible(!1);const i=Gn[s.shape]?"default":"default-dbclick";w.id?c.showAt(e,Vi.drawEditMove[s.shape]||Vi.drawEditMove.default):Gn[s.shape]!==s.positions.length?s.positions.length>1?c.showAt(e,Vi.drawMove[i]||Vi.drawMove[i]):c.showAt(e,Vi.drawStart[i]||Vi.drawStart.default):c.showAt(e,Vi.drawEnd)},C=()=>{if(a){const e=a.id.split("-")[1],t=o.find(t=>t.id===e);if(!t)return;const i=t.style.point;a.pixelSize=i.pixelSize,a.outlineWidth=i.outlineWidth,_()}},w={},b={drawEditAdd:n=>{i.setVisible(!1);const{id:r,index:o,drawData:a}=x(n),l=new e.Cartesian3(n.position.x,n.position.y,n.position.z);a?.positions.splice(o,0,l),s=a;const c=M(l,s);t._element.style.cursor="move",Object.assign(w,{id:r,index:o+1,pointPrimitive:c,originPosition:l}),s.isEditing=!0},drawEditMove:n=>{i.setVisible(!1),t._element.style.cursor="move";const{id:r,index:o,drawData:a}=x(n);s=a,Object.assign(w,{id:r,index:o,pointPrimitive:n,originPosition:new e.Cartesian3(n.position.x,n.position.y,n.position.z)}),s.isEditing=!0},drawEditRemove:e=>{i.setVisible(!1);const{index:t,drawData:n}=x(e);n.isEditing=!0,n.isDisAdd=!0,n?.positions.splice(t,1),n?.pointPrimitives.remove(e),T.drawEditEnd&&T.drawEditEnd(n),setTimeout(()=>{n.isEditing=!1,n.isDisAdd=!1},300)},drawDelete:e=>{i.setVisible(!1);const{id:t}=x(e);p(t)}};i=tr.createEditUi(t,b);const x=e=>{const t=e.id.split("-")[1],i=o.find(e=>e.id===t),n=i.positions.findIndex(t=>t.x===e.position.x&&t.y===e.position.y&&t.z===e.position.z);return{id:t,drawData:i,index:n}},P=(t,i)=>{const n=new e.PrimitiveCollection,r=new e.PointPrimitiveCollection;n.add(r);const o=JSON.parse(JSON.stringify(Hi));t.style&&(Object.assign(o.point,t.style.point||{}),Object.assign(o.polyline,t.style.polyline||{}),Object.assign(o.polygon,t.style.polygon||{}));const s={id:t.id,edit:t.edit||!1,measure:t.measure||!1,measureLabel:t.measureLabel||!1,disDepthFail:t.disDepthFail||!1,measureUnit:t.measureUnit||["m"],isEditing:!0,shape:t.shape,positions:i,clampToGround:t.clampToGround,pointPrimitives:r,primitives:n,style:o};return u.add(n),i.forEach(e=>{M(e,s)}),s},M=(t,i)=>{const n=i.style.point;return i.pointPrimitives.add({id:`draw-${i.id}-${N()}`,position:t,...n,color:e.Color.fromCssColorString(n.color),outlineColor:e.Color.fromCssColorString(n.outlineColor),disableDepthTestDistance:Number.POSITIVE_INFINITY})},D=e=>{const i=P({...e},e.positions);i.positions.push(i.positions[i.positions.length-1]),s=i,o.push(i),Hn(t,e.shape,i),e.measure&&Xn(i,t),i.primitives.raiseToTop(i.pointPrimitives),f(i)},T={};return{draw:e=>{t._element.style.cursor="crosshair",a=void 0,e.id=N();const i=P(e,[]);s=i,T.drawStart&&T.drawStart(i),o.push(i),Hn(t,e.shape,i),e.measure&&Xn(i,t),i.primitives.raiseToTop(i.pointPrimitives)},removeEditing:h,remove:e=>{p(e.id),_()},removeAll:()=>{o.forEach(e=>{e.measurePrimitive?.clearAllDiv()}),u.removeAll(),o.length=0,h()},setDrawStyle:e=>{Object.assign(Hi.point,e.point),Object.assign(Hi.polyline,e.polyline),Object.assign(Hi.polygon,e.polygon)},setDrawItemStyle:(t,i)=>{if(-1===o.findIndex(e=>e.id===t.id))throw new Error("绘制对象不存在");Object.assign(t.style.point,i.point||{}),Object.assign(t.style.polyline,i.polyline||{}),Object.assign(t.style.polygon,i.polygon||{}),console.log(t.pointPrimitives),t.__needUpdateAppearance=!0,t.isEditing=!0,t.pointPrimitives._pointPrimitives.forEach(i=>{i.pixelSize=t.style.point.pixelSize,i.outlineWidth=t.style.point.outlineWidth,i.color=e.Color.fromCssColorString(t.style.point.color),i.outlineColor=e.Color.fromCssColorString(t.style.point.outlineColor)}),setTimeout(()=>{t.isEditing=!1,t.__needUpdateAppearance=!1},100)},setClampToGround:(e,t)=>{if(-1===o.findIndex(t=>t.id===e.id))throw new Error("绘制对象不存在");e.clampToGround=t,e.isEditing=!0,setTimeout(()=>{e.isEditing=!1,e.__needUpdateAppearance=!1},100)},Event:T,updateMeasureUnit:(e,t)=>{if(-1===o.findIndex(t=>t.id===e.id))throw new Error("绘制对象不存在");const i=e.primitives._primitives.find(e=>e instanceof Ln);i&&i.updateUnit(t)},reShowDrawData:D,reShowDrawDatas:e=>{e.forEach(e=>{console.log("reshow",e),D(e)})}}};var nr=Object.freeze({__proto__:null});const rr={PolylineFlow:"PolylineFlow",PolylineTrail:"PolylineTrail",CircleWave:"CircleWave",CircleRaderWave:"CircleRaderWave",CircleRaderFan:"CircleRaderFan",LightWall:"LightWall",CircleAperture:"CircleAperture",RadarScanCircle:"RadarScanCircle",EllipsoidElectric:"EllipsoidElectric",EllipsoidVScan:"EllipsoidVScan",EllipsoidHScan:"EllipsoidHScan",Corridor:"Corridor",Zaps:"Zaps"};(()=>{for(const t in rr)e.Material[t]=rr[t]})();const or={color:"rgba(255,255,255,1)",speed:6*Math.random()};class sr extends at{speed;color;name="";image="";constructor(t){super(),this.createPropertyDescriptors();const i={...or,...t};this.image=i.image,this.name=`${rr.PolylineTrail}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.speed=this.speed,i.image=this.image,i}equals(t){return this===t||t instanceof sr&&this.speed===t.speed&&e.Property.equals(this.color,t.color)&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{image:this.image,color:e.Color.fromCssColorString("#ff0000"),speed:this.speed},source:lr},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const ar=t=>{const i={...or,...t};return new e.Material({fabric:{type:`${rr.PolylineTrail}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed},source:lr},translucent:!0})},lr="\n uniform sampler2D image;\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec4 colorImage = texture(image,st);\n vec3 fragColor = color.rgb;\n if(st.t > 0.45 && st.t < 0.55 ) {\n fragColor = vec3(1.0);\n }\n if(color.a == 0.0){\n material.alpha = colorImage.a * 1.5 * fract(st.s - time);\n material.diffuse = colorImage.rgb;\n }else{\n material.alpha = colorImage.a * color.a * 1.5 * smoothstep(.0,1., fract(st.s - time));\n material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);\n }\n return material;\n }\n\n",cr={color:"rgba(255,255,255,1)",speed:6,repeatCount:4,blendColor:!0};class dr extends at{repeatCount;image;speed;color;blend;name="";constructor(t){super(),this.createPropertyDescriptors();const i={...cr,...t};this.name=`${rr.PolylineFlow}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.image=i.image,this.repeatCount=i.repeatCount,this.blend=i.blendColor?1:0,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=e.Property.getValueOrClonedDefault(this.color,t,e.Color.WHITE,i.color),i.image=this.image,i.blend=this.blend,i.speed=this.speed,i.repeatCount=this.repeatCount,i}equals(e){return this===e||e instanceof dr&&this.speed===e.speed&&this.repeatCount===e.repeatCount&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:e.Color.fromCssColorString("#ffffff"),image:"",speed:this.speed,count:this.repeatCount,blend:this.blend},source:hr},translucent:()=>!0})}createPropertyDescriptors(){Object.defineProperties(this,{color:e.createPropertyDescriptor("color")})}}const ur=t=>{const i={...cr,...t};return new e.Material({fabric:{type:rr.PolylineFlow+N(),uniforms:{color:e.Color.fromCssColorString(i.color),image:i.image,speed:i.speed,count:i.repeatCount,blend:i.blendColor?1:0},source:hr},translucent:!0})},hr="\n uniform vec4 color;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n float time = fract(czm_frameNumber * speed / 1000.0);\n vec2 st = materialInput.st;\n vec4 colorImage = texture(image, vec2(fract( count * st.s - time),fract(st.t)));\n material.alpha = colorImage.a * color.a;\n if(blend > 0.5) {\n material.diffuse = (colorImage.rgb + color.rgb) * 2.0;\n } else {\n material.diffuse = color.rgb * 2.0 ;\n }\n return material;\n }\n",pr={color:"rgba(255,255,0,0.3)",speed:8,count:5,gradient:.3};class mr extends at{count;speed;gradient;color;name="";constructor(t){super(),t||(t={});const i={...pr,...t};this.name=`${rr.CircleWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.count=i.count,this.gradient=i.gradient,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i.repeatCount=this.count||pr.count,i}equals(t){return this===t||t instanceof mr&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.count===t.count&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed,count:this.count,gradient:this.gradient},source:gr},translucent:()=>!0})}}const fr=t=>{const i={...pr,...t};return{material:new e.Material({fabric:{type:`${rr.CircleWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed,count:i.count,gradient:i.gradient},source:gr},translucent:!0})}},gr="\n uniform vec4 color;\n uniform float speed;\n uniform float count;\n uniform float gradient;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(czm_frameNumber * speed / 1000.0);\n if(count == 1.0){\n if(dis > per * 0.5){\n discard;\n }else {\n material.alpha = color.a * dis / per / 2.0;\n }\n } else {\n vec3 str = materialInput.str;\n if(abs(str.z) > 0.001){\n discard;\n }\n if(dis > 0.5){\n discard;\n } else {\n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n for(int i = 0; i <= 999; i++){\n if(float(i) <= count){\n disNum = perDis * float(i) - dis + per / count;\n if(disNum > 0.0){\n if(disNum < perDis){\n bl = 1.0 - disNum / perDis;\n }\n else if(disNum - perDis < perDis){\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));\n }\n }\n }\n }\n }\n return material;\n }\n",vr={color:"rgba(255,255,255,1)",speed:8};class yr extends at{speed;color;name="";constructor(t){super();const i={...vr,...t};this.name=`${rr.CircleRaderWave}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof yr&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Cr},translucent:()=>!0})}}const _r=t=>{const i={...vr,...t};return{material:new e.Material({fabric:{type:`${rr.CircleRaderWave}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Cr},translucent:!0})}},Cr="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n float rand(vec2 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 pos = st - vec2(0.5);\n float time = czm_frameNumber * speed / 1000.0 ;\n float r = length(pos);\n float t = atan(pos.y, pos.x) - time * 2.5;\n float a = (atan(sin(t), cos(t)) + PI)/(2.0*PI);\n float ta = 0.5;\n float v = smoothstep(ta-0.05,ta+0.05,a) * smoothstep(ta+0.05,ta-0.05,a);\n vec3 flagColor = color.rgb * v;\n float blink = pow(sin(time*1.5)*0.5+0.5, 0.8);\n flagColor = color.rgb * pow(a, 4.0*(.2+blink))*(sin(r*500.0)*.5+.5) ;\n flagColor = flagColor * pow(r, 0.4);\n material.alpha = length(flagColor) * 1.3;\n material.diffuse = flagColor * 3.0;\n return material;\n }\n",wr={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class br extends at{speed;color;name="";constructor(t){super();const i={...wr,...t};this.name=`${rr.CircleRaderFan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof br&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Pr},translucent:()=>!0})}}const xr=t=>{const i={...wr,...t};return{material:new e.Material({fabric:{type:`${rr.CircleRaderFan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Pr},translucent:!0})}},Pr="\n uniform vec4 color;\n uniform float speed;\n #define PI 3.14159265359\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // 绘制边线\n float dis = distance(materialInput.st, vec2(0.5));\n float alpha = step((0.5- 0.01), dis);\n\n material.alpha = alpha;\n material.diffuse = color.rgb;\n\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n float per = czm_frameNumber * speed / PI * 3.0 / 200.0;\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + per;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = (alpha + color.a) * dis;\n material.diffuse = color.rgb;\n }\n return material;\n }\n",Mr={color:"rgba(255,255,0,0.3)",speed:8};class Dr extends at{speed;color;name="";constructor(t){super(),t||(t={});const i={...Mr,...t};this.name=`${rr.CircleAperture}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.speed=this.speed,i}equals(t){return this===t||t instanceof Dr&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:new e.Color(1,0,0,.5),speed:this.speed},source:Er},translucent:()=>!0})}}const Tr=t=>{const i={...Mr,...t};return new e.Material({fabric:{type:`${rr.CircleAperture}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Er},translucent:!0})},Er="\n uniform vec4 color;\n uniform float speed;\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float d = distance(st, vec2(0.5, 0.5));\n float alpha = step(.15, d) * step(d, .17) + step(.49, d) * step(d, 0.5) + d * d * step(d, 0.5);\n float movingCircleD = fract(czm_frameNumber * speed / 1000.0);\n alpha += step(movingCircleD, d) * step(d, movingCircleD + .015);\n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n }\n",Ar=t=>{t||(t={});return new e.Material({fabric:{type:`${rr.RadarScanCircle}-${N()}`,uniforms:{radians:3*Math.PI/8,bgColor:e.Color.fromCssColorString(t.bgColor||"rgba(0,255,0,0.2)"),sectorColor:e.Color.fromCssColorString(t.sectorColor||"rgba(152,18,8,.1)"),width:t.width||.003,offset:t.offset||0,count:t.count||3},source:Sr},translucent:!0})},Sr="\n uniform vec4 bgColor;\n uniform vec4 sectorColor;\n uniform float count;\n uniform float radians;\n uniform float width;\n uniform float offset;\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float dis = distance(st, vec2(0.5));\n\n float alpha;\n vec3 diffuse;\n // 绘制圆圈\n float sp = 1.0 / count / 2.0;\n float m = mod(dis, sp);\n alpha = step(sp * (1.0 - width * 10.0), m);\n // alpha = clamp(alpha, 0.2, 1.0);\n if (alpha < bgColor.a){\n alpha = bgColor.a;\n diffuse = bgColor.rgb;\n } else {\n diffuse = bgColor.rgb;\n }\n material.alpha = alpha;\n material.diffuse = diffuse;\n // 绘制十字线\n if ((st.s > 0.5 - width / 2.0 && st.s < 0.5 + width / 2.0) || (st.t > 0.5 - width / 2.0 && st.t < 0.5 + width / 2.0)) {\n material.alpha = 0.8;\n material.diffuse = bgColor.rgb;\n return material;\n }\n // 绘制光晕\n float ma = mod(dis + offset, 0.5);\n if (ma < 0.25){\n alpha = ma * 3.0 + alpha;\n } else{\n alpha = 3.0 * (0.5 - ma) + alpha;\n }\n material.alpha = alpha;\n material.diffuse = bgColor.rgb;\n // 绘制扇区\n vec2 xy = materialInput.st;\n float rx = xy.x - 0.5;\n float ry = xy.y - 0.5;\n float at = atan(ry, rx);\n // 半径\n float radius = sqrt(rx * rx + ry * ry);\n // 扇区叠加旋转角度\n float current_radians = at + radians;\n xy = vec2(cos(current_radians) * radius, sin(current_radians) * radius);\n xy = vec2(xy.x + 0.5, xy.y + 0.5);\n // 扇区渐变色渲染\n if (xy.y - xy.x < 0.0 && xy.x > 0.5 && xy.y > 0.5){\n material.alpha = alpha + sectorColor.a;\n material.diffuse = sectorColor.rgb;\n }\n return material;\n }\n",Ir={color:"rgba(255,255,255,1)",count:3,duration:1500};class Or extends at{duration;count;vertical;direction;color;_time;image;name="";constructor(t){super();const i={...Ir,...t};Object.prototype.hasOwnProperty.call(i,"vertical")||(i.vertical=1),this.name=`LightWall-${N()}`,this._time=(new Date).getTime(),this.color=e.Color.fromCssColorString(i.color),this.duration=i.duration,this.count=i.count,this.vertical=i.vertical,this.image=i.image,this.direction=i.direction,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i.image=this.image,i.vertical=this.vertical,i.direction=this.direction,i.count=this.count,i.duration=this.duration,this.duration&&(i.time=((new Date).getTime()-this._time)%this.duration/this.duration),i}equals(t){return this===t||t instanceof Or&&e.Property.equals(this.color,t.color)&&this.name===t.name&&this.image===t.image&&this.vertical===t.vertical&&this.direction===t.direction&&this.count===t.count&&this.duration===t.duration}init(){const t=Fr({count:this.count,vertical:this.vertical,direction:this.direction});e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,duration:this.duration,vertical:this.vertical,image:this.image,count:this.count,time:-20},source:t},translucent:()=>!0})}}const zr=t=>{const i={...Ir,...t};return{material:new e.Material({fabric:{type:`LightWall${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),duration:i.duration,vertical:i.vertical,image:i.image,count:i.count,time:-20},source:Fr({count:i.count,vertical:i.vertical,direction:i.direction})}})}},Fr=e=>{const t=e.vertical?"vertical":"standard",i=e.direction?"+":"-";let n="czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";return n+="vertical"===t?`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.t ${i} time)),fract(st.s));\n `:`vec4 colorImage = texture(image, vec2(fract(float(${e.count})*st.s ${i} time), fract(st.t)));\n `,n+="vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a * color.a;\n material.emission = fragColor.rgb;\n return material;\n }",n},Rr={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class kr extends at{speed;color;name="";constructor(t){super();const i={...Rr,...t};this.name=`${rr.EllipsoidElectric}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof kr&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Br},translucent:()=>!0})}}const Lr=t=>{const i={...Rr,...t};return{material:new e.Material({fabric:{type:`${rr.EllipsoidElectric}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Br},translucent:!0})}},Br="\n uniform vec4 color;\n uniform float speed;\n #define pi 3.1415926535\n #define PI2RAD 0.01745329252\n #define TWO_PI (2. * PI)\n\n float rands(float p){\n return fract(sin(p) * 10000.0);\n }\n\n float noise(vec2 p){\n float time = fract( czm_frameNumber * speed / 1000.0);\n float t = time / 20000.0;\n\n if(t > 1.0) t -= floor(t);\n return rands(p.x * 14. + p.y * sin(t) * 0.5);\n }\n\n vec2 sw(vec2 p){\n return vec2(floor(p.x), floor(p.y));\n }\n\n vec2 se(vec2 p){\n return vec2(ceil(p.x), floor(p.y));\n }\n\n vec2 nw(vec2 p){\n return vec2(floor(p.x), ceil(p.y));\n }\n\n vec2 ne(vec2 p){\n return vec2(ceil(p.x), ceil(p.y));\n }\n\n float smoothNoise(vec2 p){\n vec2 inter = smoothstep(0.0, 1.0, fract(p));\n float s = mix(noise(sw(p)), noise(se(p)), inter.x);\n float n = mix(noise(nw(p)), noise(ne(p)), inter.x);\n return mix(s, n, inter.y);\n }\n\n float fbm(vec2 p){\n float z = 2.0;\n float rz = 0.0;\n vec2 bp = p;\n for(float i = 1.0; i < 6.0; i++){\n rz += abs((smoothNoise(p) - 0.5)* 2.0) / z;\n z *= 2.0;\n p *= 2.0;\n }\n return rz;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 st2 = materialInput.st;\n float time = fract( czm_frameNumber * speed / 1000.0);\n if (st.t < 0.5) {\n discard;\n }\n st *= 4.;\n float rz = fbm(st);\n st /= exp(mod( time * 2.0, pi));\n rz *= pow(15., 0.9);\n vec4 temp = vec4(0);\n temp = mix( color / rz, vec4(color.rgb, 0.1), 0.2);\n if (st2.s < 0.05) {\n temp = mix(vec4(color.rgb, 0.1), temp, st2.s / 0.05);\n }\n if (st2.s > 0.95){\n temp = mix(temp, vec4(color.rgb, 0.1), (st2.s - 0.95) / 0.05);\n }\n material.diffuse = temp.rgb;\n material.alpha = temp.a * 2.0;\n return material;\n }\n",Nr={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class Gr extends at{speed;color;name="";constructor(t){super();const i={...Nr,...t};this.name=`${rr.EllipsoidVScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof Gr&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:Vr},translucent:()=>!0})}}const Ur=t=>{const i={...Nr,...t};return{material:new e.Material({fabric:{type:`${rr.EllipsoidVScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:Vr},translucent:!0})}},Vr="\n uniform vec4 color;\n uniform float speed;\n czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float time = fract(czm_frameNumber * speed / 1000.0);\n float alpha = abs(smoothstep(0.5,1.,fract( -st.t - time)));\n alpha += .1;\n material.alpha = alpha;\n material.diffuse = color.rgb;\n return material;\n }\n",Hr={name:"circle-fan",color:"rgba(255,255,255,1)",speed:8};class $r extends at{speed;color;name="";constructor(t){super();const i={...Hr,...t};this.name=`${rr.EllipsoidHScan}-${N()}`,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return`${this.name}`}getValue(t,i){return e.defined(i)||(i={}),i.speed=this.speed,i}equals(e){return this===e||e instanceof $r&&this.speed===e.speed&&this.name===e.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(this.name,{fabric:{type:this.name,uniforms:{color:this.color,speed:6},source:qr},translucent:()=>!0})}}const Wr=t=>{const i={...Hr,...t};return{material:new e.Material({fabric:{type:`${rr.EllipsoidHScan}-${N()}`,uniforms:{color:e.Color.fromCssColorString(i.color),speed:i.speed},source:qr},translucent:!0})}},qr="\nuniform vec4 color; \nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st; \n float t = fract( czm_frameNumber * speed / 1000.0);; \n t *= 1.03;\n float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s); \n alpha += 0.1;\n alpha *= step(-0.5, -abs(0.5-st.t)); \n material.diffuse = color.rgb;\n material.alpha = alpha;\n return material;\n}\n",jr={color:"rgba(255,255,255,1)",speed:1};class Yr extends at{color;speed;name="";constructor(t){super();const i={...jr,...t};this.name=rr.Zaps,this.color=e.Color.fromCssColorString(i.color),this.speed=i.speed,this.init()}get isConstant(){return!1}get definitionChanged(){return this._definitionChanged}getType(){return this.name}getValue(t,i){return e.defined(i)||(i={}),i.color=this.color,i}equals(t){return this===t||t instanceof Yr&&e.Property.equals(this.color,t.color)&&this.speed===t.speed&&this.name===t.name}init(){e.Material[this.name]=this.name,e.Material._materialCache.addMaterial(rr.Zaps,{fabric:{type:rr.Zaps,uniforms:{uColor:this.color,speed:this.speed,uResolution:new e.Cartesian2(1024,1024)},source:Xr},translucent:()=>!0})}}const Zr=t=>{const i={...jr,...t};return{material:new e.Material({fabric:{type:rr.Zaps,uniforms:{uColor:e.Color.fromCssColorString(i.color),uSpeed:i.speed,uResolution:new e.Cartesian2(1024,1024)},source:Xr}})}},Xr="\n uniform float uSpeed;\n uniform vec4 uColor;\n uniform vec2 uResolution;\n\n void mainImage(out vec4 o, vec2 u, float time)\n {\n vec2 v = uResolution.xy;\n u = .2*(u+u-v)/v.y;\n\n vec4 z = o = vec4(1,2,3,0);\n for (float a = .5, t = time, i;\n ++i < 19.;\n o += (1. + cos(z+t))\n / length((1.+i*dot(v,v))\n * sin(1.5*u/(.5-dot(u,u)) - 9.*u.yx + t))\n )\n v = cos(++t - 7.*u*pow(a += .03, i)) - 5.*u,\n // use stanh here if shader has black artifacts\n // vvvv\n u += tanh(40. * dot(u *= mat2(cos(i + .02*t - vec4(0,11,33,0)))\n ,u)\n * cos(1e2*u.yx + t)) / 2e2\n + .2 * a * u\n + cos(4./exp(dot(o,o)/1e2) + t) / 3e2;\n\n o = 25.6 / (min(o, 13.) + 164. / o)\n - dot(u, u) / 250.;\n }\n\n czm_material czm_getMaterial(czm_materialInput materialInput) {\n float time = fract(czm_frameNumber * speed / 1000.0);\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec4 color = vec4(0.0,0.0,0.0,1.0);\n mainImage(color,materialInput.st * uResolution,time);\n\n material.diffuse = color.rgb * uColor.rgb;\n material.alpha = 0.33 + (sin(time * 0.3) + 1.0) / 3.0;\n return material;\n }\n ";class Jr extends st{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){t?this.appearance=t:(this.appearance=new e.MaterialAppearance({material:Ar(this.options.materialOptions||{}),flat:!1,faceForward:!1,translucent:!0,closed:!1,...this.options.appearanceOptions||{}}),this.options.viewer.scene.preRender.addEventListener(()=>{this.appearance.material.uniforms.radians+=3*Math.PI/300}))}}const Kr=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];let Qr=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(t,0,2);if(219!==i)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const o=Kr[15&n];if(!o)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new e(a,s,o,t)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const r=Kr.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return eo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:s}=this,a=[0,r.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,d=a.pop()||0,u=a.pop()||0;if(d-u<=s){for(let s=u;s<=d;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=n&&l.push(r[s])}continue}const h=u+d>>1,p=o[2*h],m=o[2*h+1];p>=e&&p<=i&&m>=t&&m<=n&&l.push(r[h]),(0===c?e<=p:t<=m)&&(a.push(u),a.push(h-1),a.push(1-c)),(0===c?i>=p:n>=m)&&(a.push(h+1),a.push(d),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:o}=this,s=[0,n.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,d=s.pop()||0,u=s.pop()||0;if(d-u<=o){for(let i=u;i<=d;i++)ro(r[2*i],r[2*i+1],e,t)<=l&&a.push(n[i]);continue}const h=u+d>>1,p=r[2*h],m=r[2*h+1];ro(p,m,e,t)<=l&&a.push(n[h]),(0===c?e-i<=p:t-i<=m)&&(s.push(u),s.push(h-1),s.push(1-c)),(0===c?e+i>=p:t+i>=m)&&(s.push(h+1),s.push(d),s.push(1-c))}return a}};function eo(e,t,i,n,r,o){if(r-n<=i)return;const s=n+r>>1;to(e,t,s,n,r,o),eo(e,t,i,n,s-1,1-o),eo(e,t,i,s+1,r,1-o)}function to(e,t,i,n,r,o){for(;r>n;){if(r-n>600){const s=r-n+1,a=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);to(e,t,i,Math.max(n,Math.floor(i-a*c/s+d)),Math.min(r,Math.floor(i+(s-a)*c/s+d)),o)}const s=t[2*i+o];let a=n,l=r;for(io(e,t,n,i),t[2*r+o]>s&&io(e,t,n,r);a<l;){for(io(e,t,a,l),a++,l--;t[2*a+o]<s;)a++;for(;t[2*l+o]>s;)l--}t[2*n+o]===s?io(e,t,n,l):(l++,io(e,t,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function io(e,t,i,n){no(e,i,n),no(t,2*i,2*n),no(t,2*i+1,2*n+1)}function no(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function ro(e,t,i,n){const r=e-i,o=t-n;return r*r+o*o}const oo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},so=Math.fround||(ao=new Float32Array(1),e=>(ao[0]=+e,ao[0]));var ao;class lo{constructor(e){this.options=Object.assign(Object.create(oo),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const r=`prepare ${e.length} points`;t&&console.time(r),this.points=e;const o=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[n,r]=i.geometry.coordinates,s=so(ho(n)),a=so(po(r));o.push(s,a,1/0,t,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[n+1]=this._createTree(o);t&&console.timeEnd(r);for(let e=n;e>=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,r=180;else if(i>r){const e=this.getClusters([i,n,180,o],t),s=this.getClusters([-180,n,r,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(ho(i),po(o),ho(r),po(n)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+5]>1?co(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.data;if(t*this.stride>=o.length)throw new Error(n);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=o[t*this.stride],l=o[t*this.stride+1],c=r.within(a,l,s),d=[];for(const t of c){const i=t*this.stride;o[i+4]===e&&d.push(o[i+5]>1?co(o,i,this.clusterProps):this.points[o[i+3]])}if(0===d.length)throw new Error(n);return d}getLeaves(e,t,i){t=t||10,i=i||0;const n=[];return this._appendLeaves(n,e,t,i,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/r,c=(i+1+a)/r,d={features:[]};return this._addTileFeatures(n.range((t-a)/r,l,(t+1+a)/r,c),n.data,t,i,r,d),0===t&&this._addTileFeatures(n.range(1-a/r,l,1,c),n.data,r,i,r,d),t===r-1&&this._addTileFeatures(n.range(0,l,a/r,c),n.data,-1,i,r,d),d.features.length?d:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,r){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(e,o.cluster_id,i,n,r):r<n?r++:e.push(t),e.length===i)break}return r}_createTree(e){const t=new Qr(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,i,n,r,o){for(const s of e){const e=s*this.stride,a=t[e+5]>1;let l,c,d;if(a)l=uo(t,e,this.clusterProps),c=t[e],d=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[n,r]=i.geometry.coordinates;c=ho(n),d=po(r)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*r-i)),Math.round(this.options.extent*(d*r-n))]],tags:l};let h;h=a||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==h&&(u.id=h),o.features.push(u)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:n,reduce:r,minPoints:o}=this.options,s=i/(n*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;i<a.length;i+=c){if(a[i+2]<=t)continue;a[i+2]=t;const n=a[i],d=a[i+1],u=e.within(a[i],a[i+1],s),h=a[i+5];let p=h;for(const e of u){const i=e*c;a[i+2]>t&&(p+=a[i+5])}if(p>h&&p>=o){let e,o=n*h,s=d*h,m=-1;const f=(i/c<<5)+(t+1)+this.points.length;for(const n of u){const l=n*c;if(a[l+2]<=t)continue;a[l+2]=t;const d=a[l+5];o+=a[l]*d,s+=a[l+1]*d,a[l+4]=f,r&&(e||(e=this._map(a,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),r(e,this._map(a,l)))}a[i+4]=f,l.push(o/p,s/p,1/0,f,-1,p),r&&l.push(m)}else{for(let e=0;e<c;e++)l.push(a[i+e]);if(p>1)for(const e of u){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e<c;e++)l.push(a[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].properties,r=this.options.map(n);return i&&r===n?Object.assign({},r):r}}function co(e,t,i){return{type:"Feature",id:e[t+3],properties:uo(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),mo(e[t+1])]}};var n}function uo(e,t,i){const n=e[t+5],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=e[t+6],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:r})}function ho(e){return e/360+.5}function po(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function mo(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}class fo extends st{options;pointPrimitives=new e.PrimitiveCollection;boundingSphere=new e.BoundingSphere(e.Cartesian3.ZERO,0);pointCollection;labelCollection;billboardCollection;clusterImageCache={};supercluster;constructor(t){super(),this.options=t,this.clacBoundingSphere(this.options.geoJson),this.options.point&&(this.pointCollection=new e.PointPrimitiveCollection,this.pointPrimitives.add(this.pointCollection)),this.options.billboard&&(this.billboardCollection=new e.BillboardCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.billboardCollection)),this.options.label&&(this.labelCollection=new e.LabelCollection({scene:t.viewer.scene}),this.pointPrimitives.add(this.labelCollection)),t.cluster?(this.supercluster=new lo({radius:this.options.cluster?.radius||_o.radius,maxZoom:this.options.cluster?.maxZoom||_o.maxZoom}),this.initCluster(this.options.viewer,this.options.geoJson)):this.initCollection(this.options.geoJson)}initCollection=async t=>{await this.calcPointHeight(this.options.viewer,t);const i=[];t.features.forEach(t=>{if(i.push(e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),this.options.point){this.pointCollection.add(this.createPoint(t)).properties=t.properties||{}}if(this.options.billboard){this.billboardCollection.add(this.createBillboard(t)).properties=t.properties||{}}if(this.options.label){this.labelCollection.add(this.createLabel(t)).properties=t.properties||{}}})};clacBoundingSphere(t){const i=t.features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0));e.BoundingSphere.fromPoints(i,this.boundingSphere)}createPoint(t){const i={...go,...this.options.point,...t.properties?.style?.point};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]),color:e.Color.fromCssColorString(i.color),pixelSize:i.pixelSize,outlineColor:e.Color.fromCssColorString(i.outlineColor),outlineWidth:i.outlineWidth,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createBillboard(t){const i={...yo,...this.options.billboard,...t.properties?.style?.billboard};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),image:i.image,scale:i.scale,width:t.properties?.cluster?void 0:i.width,height:t.properties?.cluster?void 0:i.height,color:t.properties?.cluster?void 0:e.Color.fromCssColorString(i.color),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i.heightReference,scaleByDistance:i.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}createLabel(t){const i={...vo,...this.options.label,...t.properties?.style?.label};return{id:N(),position:e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],t.geometry.coordinates[2]||0),text:t.properties?.[i?.field]||i?.field,font:i?.font,fillColor:e.Color.fromCssColorString(i?.fillColor),outlineColor:e.Color.fromCssColorString(i?.outlineColor),outlineWidth:i?.outlineWidth,style:i?.style,scale:i?.scale,showBackground:i?.showBackground,backgroundColor:e.Color.fromCssColorString(i?.backgroundColor),backgroundPadding:e.Cartesian2.fromArray(i?.backgroundPadding),pixelOffset:e.Cartesian2.fromArray(i?.pixelOffset),horizontalOrigin:i.horizontalOrigin,verticalOrigin:i.verticalOrigin,heightReference:i?.heightReference,scaleByDistance:i?.scaleByDistance,translucencyByDistance:i.translucencyByDistance,disableDepthTestDistance:i?.disableDepthTestDistance,distanceDisplayCondition:i.distanceDisplayCondition}}initCluster=async(t,i)=>{this.supercluster.load(i.features);let n=e.getTimestamp();this.loadCluster(t),t.camera.changed.addEventListener(()=>{e.getTimestamp()-n<=500||(n=e.getTimestamp(),this.loadCluster(t))})};flyToChildByClusterId(t){const i=this.supercluster?.getChildren(t),n=i?.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],0)),r=e.BoundingSphere.fromPoints(n);return this.options.viewer.camera.flyToBoundingSphere(r),i}loadCluster=t=>{const i=it(t.camera),n=t.camera.computeViewRectangle(),r=this.supercluster.getClusters([e.Math.toDegrees(n.west),e.Math.toDegrees(n.south),e.Math.toDegrees(n.east),e.Math.toDegrees(n.north)],i);this.clearCollection();const o=this.options.cluster.colorsByRate||_o.colorsByRate,s={type:"FeatureCollection",features:r.map(e=>{const t=e.properties.point_count/this.options.geoJson.features.length,n=Object.keys(o).find(e=>t>Number(e))||"#ff0000";if(e.properties.cluster){const t=this.getClusterImageByCount(o[n],e.properties.point_count,i),r=16*(String(e.properties.point_count).length+1);e.properties.style={...e.properties.style,billboard:{...e.properties.style?.billboard,image:t,pixelOffset:[0,-r/12]}}}return e})};this.initCollection(s)};getClusterImageByCount(t,i,n){if(!this.clusterImageCache[i+t]){const r=16*(String(i).length+1);let o=-Math.PI/12;const s=Math.PI/2,a=Math.PI/6,l=document.createElement("canvas");l.width=r,l.height=r;const c=l.getContext("2d");c.save(),c.scale(r/24,r/24),c.beginPath(),c.arc(12,12,6,0,2*Math.PI),c.fillStyle=t,c.fill(),c.closePath(),c.lineWidth=2,c.fillStyle="rgba(255,255,255,1)",c.font=`${this.calcfontSize(n)}px Microsoft YaHei`,c.textAlign="center",c.textBaseline="middle",c.fillText(`${i}`,11.5,12.5);for(let i=0;i<3;i++)c.beginPath(),c.arc(12,12,8,o,o+s,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.4).toCssColorString(),c.stroke(),c.arc(12,12,11,o,o+s,!1),c.strokeStyle=e.Color.fromCssColorString(t).withAlpha(.2).toCssColorString(),c.stroke(),c.closePath(),o=o+s+a;c.restore(),this.clusterImageCache[i+t]=l.toDataURL()}return this.clusterImageCache[i+t]}calcfontSize(e){return e<4?4:e-1}async calcPointHeight(t,i){if(this.options.calcHeight)if(t.scene.terrainProvider instanceof e.EllipsoidTerrainProvider)i.features.forEach(e=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=0:e.geometry.coordinates.push(0)});else{const n=t.scene.terrainProvider,r=i.features.map(t=>e.Cartographic.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1])),o=await e.sampleTerrainMostDetailed(n,r);i.features.forEach((e,t)=>{3===e.geometry.coordinates.length?e.geometry.coordinates[2]=o[t].height:e.geometry.coordinates.push(o[t].height)})}}clearCollection(){this.pointCollection?.removeAll(),this.billboardCollection?.removeAll(),this.labelCollection?.removeAll()}remove(){}removeAll(){this.clearCollection(),this.pointPrimitives.removeAll()}getPrimitive(){return this.pointPrimitives}}const go={color:"rgba(81,255,0,0.8)",pixelSize:10,outlineColor:"rgba(255,0,0,0.8)",outlineWidth:1},vo={font:"20px sans-serif",fillColor:"rgba(255,255,255,0.8)",outlineColor:"rgba(0,0,0,0.8)",backgroundColor:"rgba(0,0,0,1)",outlineWidth:2,pixelOffset:[0,0],backgroundPadding:[0,0],scale:1,disableDepthTestDistance:0,horizontalOrigin:0,verticalOrigin:0,heightReference:e.HeightReference.CLAMP_TO_GROUND},yo={image:"/icons/cesium-marker.png",scale:1,color:"rgba(255,0,0,1)",rotation:0,width:32,height:32,horizontalOrigin:0,verticalOrigin:0,pixelOffset:[0,-16],heightReference:e.HeightReference.CLAMP_TO_GROUND},_o={radius:60,maxZoom:25,colorsByRate:{.1:"#ff0000",.01:"#ff00ff",.001:"blue",1e-4:"#00ff00"}},Co={width:2,color:"rgba(0,255,0,0.8)"};class wo extends st{options;polylinePrimitives;constructor(e){super(),this.options=e,this.polylinePrimitives=void 0,this.options.material&&this.setMaterialAppearance(),this.initCollection()}initCollection(){const t=[],i=[];let n;this.options.geoJson.features.forEach(e=>{"MultiLineString"===e.geometry.type?e.geometry.coordinates.forEach(t=>{i.push({coordinates:t,properties:e.properties})}):i.push({coordinates:e.geometry.coordinates,properties:e.properties})}),i.forEach(i=>{const n=i.coordinates.map(t=>e.Cartesian3.fromDegrees(t[0],t[1],t[2])),r={...Co,...this.options?.line,...i.properties?.style?.line};t.push(new e.GeometryInstance({id:N(),geometry:new e.GroundPolylineGeometry({positions:n,width:r?.width}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(r.color))}}))}),n=this.appearance?this.appearance:new e.PolylineColorAppearance,this.polylinePrimitives=new e.GroundPolylinePrimitive({geometryInstances:t,appearance:n})}getPrimitive(){return this.polylinePrimitives}setMaterialAppearance(){this.appearance=new e.MaterialAppearance({material:this.options.material})}}const bo={width:2,color:"rgba(0,255,0,0.8)"};class xo extends st{options;primitives;constructor(e){super(),this.options=e,this.primitives=void 0,this.initCollection()}initCollection(){const t=[];this.options.geoJson.features.forEach(i=>{let n;n="Polygon"===i.geometry.type?new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(i.geometry.coordinates[0].flat())):Po(i.geometry);const r={...bo,...this.options?.line,...i.properties?.style?.line},o=N();i.properties&&(i.properties.id=o);const s=new e.GeometryInstance({id:o,geometry:new e.PolygonGeometry({polygonHierarchy:n}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(e.Color.fromCssColorString(r.color))}});t.push(s),s.properties=i.properties}),this.primitives=new e.GroundPrimitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({})})}getPrimitive(){return this.primitives}getAppearance(t){this.appearance=t||new e.PolylineMaterialAppearance({material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("rgba(81,255,0,0.8)")})})}}const Po=t=>new e.PolygonHierarchy(e.Cartesian3.fromDegreesArray(t.coordinates[0][0].flat()));function Mo(e,t,i,n,r,o){if(r-n<=i)return;const s=n+r>>1;Do(e,t,s,n,r,o%2),Mo(e,t,i,n,s-1,o+1),Mo(e,t,i,s+1,r,o+1)}function Do(e,t,i,n,r,o){for(;r>n;){if(r-n>600){const s=r-n+1,a=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),d=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);Do(e,t,i,Math.max(n,Math.floor(i-a*c/s+d)),Math.min(r,Math.floor(i+(s-a)*c/s+d)),o)}const s=t[2*i+o];let a=n,l=r;for(To(e,t,n,i),t[2*r+o]>s&&To(e,t,n,r);a<l;){for(To(e,t,a,l),a++,l--;t[2*a+o]<s;)a++;for(;t[2*l+o]>s;)l--}t[2*n+o]===s?To(e,t,n,l):(l++,To(e,t,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function To(e,t,i,n){Eo(e,i,n),Eo(t,2*i,2*n),Eo(t,2*i+1,2*n+1)}function Eo(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function Ao(e,t,i,n){const r=e-i,o=t-n;return r*r+o*o}const So=e=>e[0],Io=e=>e[1];class Oo{constructor(e,t=So,i=Io,n=64,r=Float64Array){this.nodeSize=n,this.points=e;const o=e.length<65536?Uint16Array:Uint32Array,s=this.ids=new o(e.length),a=this.coords=new r(2*e.length);for(let n=0;n<e.length;n++)s[n]=n,a[2*n]=t(e[n]),a[2*n+1]=i(e[n]);Mo(s,a,n,0,s.length-1,0)}range(e,t,i,n){return function(e,t,i,n,r,o,s){const a=[0,e.length-1,0],l=[];let c,d;for(;a.length;){const u=a.pop(),h=a.pop(),p=a.pop();if(h-p<=s){for(let s=p;s<=h;s++)c=t[2*s],d=t[2*s+1],c>=i&&c<=r&&d>=n&&d<=o&&l.push(e[s]);continue}const m=Math.floor((p+h)/2);c=t[2*m],d=t[2*m+1],c>=i&&c<=r&&d>=n&&d<=o&&l.push(e[m]);const f=(u+1)%2;(0===u?i<=c:n<=d)&&(a.push(p),a.push(m-1),a.push(f)),(0===u?r>=c:o>=d)&&(a.push(m+1),a.push(h),a.push(f))}return l}(this.ids,this.coords,e,t,i,n,this.nodeSize)}within(e,t,i){return function(e,t,i,n,r,o){const s=[0,e.length-1,0],a=[],l=r*r;for(;s.length;){const c=s.pop(),d=s.pop(),u=s.pop();if(d-u<=o){for(let r=u;r<=d;r++)Ao(t[2*r],t[2*r+1],i,n)<=l&&a.push(e[r]);continue}const h=Math.floor((u+d)/2),p=t[2*h],m=t[2*h+1];Ao(p,m,i,n)<=l&&a.push(e[h]);const f=(c+1)%2;(0===c?i-r<=p:n-r<=m)&&(s.push(u),s.push(h-1),s.push(f)),(0===c?i+r>=p:n+r>=m)&&(s.push(h+1),s.push(d),s.push(f))}return a}(this.ids,this.coords,e,t,i,this.nodeSize)}}function zo(t){t=e.defaultValue(t,e.defaultValue.EMPTY_OBJECT),this._enabled=e.defaultValue(t.enabled,!1),this._pixelRange=e.defaultValue(t.pixelRange,80),this._minimumClusterSize=e.defaultValue(t.minimumClusterSize,2),this._clusterBillboards=e.defaultValue(t.clusterBillboards,!0),this._clusterLabels=e.defaultValue(t.clusterLabels,!0),this._clusterPoints=e.defaultValue(t.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Event,this.show=e.defaultValue(t.show,!0)}function Fo(e){return e.coord.x}function Ro(e){return e.coord.y}function ko(e,t){e.x-=t,e.y-=t,e.width+=2*t,e.height+=2*t}const Lo=new e.BoundingRectangle;function Bo(t,i,n,r,o){if(e.defined(t._labelCollection)&&r._clusterLabels?o=e.Label.getScreenSpaceBoundingBox(t,i,o):e.defined(t._billboardCollection)&&r._clusterBillboards?o=e.Billboard.getScreenSpaceBoundingBox(t,i,o):e.defined(t._pointPrimitiveCollection)&&r._clusterPoints&&(o=e.PointPrimitive.getScreenSpaceBoundingBox(t,i,o)),ko(o,n),r._clusterLabels&&!e.defined(t._labelCollection)&&e.defined(t.id)&&Uo(r,t.id.id)&&e.defined(t.id._label)){const s=r._collectionIndicesByEntity[t.id.id].labelIndex,a=r._labelCollection.get(s),l=e.Label.getScreenSpaceBoundingBox(a,i,Lo);ko(l,n),o=e.BoundingRectangle.union(o,l,o)}return o}function No(t,i){if(t.clusterShow=!0,!e.defined(t._labelCollection)&&e.defined(t.id)&&Uo(i,t.id.id)&&e.defined(t.id._label)){const e=i._collectionIndicesByEntity[t.id.id].labelIndex;i._labelCollection.get(e).clusterShow=!0}}function Go(e,t,i,n){const r={billboard:n._clusterBillboardCollection.add(),label:n._clusterLabelCollection.add(),point:n._clusterPointCollection.add()};r.billboard.show=!1,r.point.show=!1,r.label.show=!0,r.label.text=t.toLocaleString(),r.label.id=i,r.billboard.position=r.label.position=r.point.position=e,n._clusterEvent.raiseEvent(i,r)}function Uo(t,i){return e.defined(t)&&e.defined(t._collectionIndicesByEntity[i])&&e.defined(t._collectionIndicesByEntity[i].labelIndex)}function Vo(t,i,n,r,o){if(!e.defined(t))return;const s=t.length;for(let a=0;a<s;++a){const s=t.get(a);if(s.clusterShow=!1,!s.show||o._scene.mode===e.SceneMode.SCENE3D&&!r.isPointVisible(s.position))continue;const l=s.computeScreenSpacePosition(n);e.defined(l)&&i.push({index:a,collection:t,clustered:!1,coord:l})}}const Ho=new e.BoundingRectangle,$o=new e.BoundingRectangle,Wo=new e.BoundingRectangle;function qo(t,i,n,r){return function(o){let s=this[t];e.defined(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let a,l,c=this._collectionIndicesByEntity[o.id];if(e.defined(c)||(c=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),e.defined(s)&&e.defined(c[r]))return s.get(c[r]);e.defined(s)||(s=this[t]=new i({scene:this._scene}));const d=this[n];return d.length>0?(a=d.pop(),l=s.get(a)):(l=s.add(),a=s.length-1),c[r]=a,Promise.resolve().then(()=>{this._clusterDirty=!0}),l}}function jo(t,i){const n=t._collectionIndicesByEntity[i];e.defined(n.billboardIndex)||e.defined(n.labelIndex)||e.defined(n.pointIndex)||delete t._collectionIndicesByEntity[i]}function Yo(t){if(!e.defined(t))return;const i=t.length;for(let e=0;e<i;++e)t.get(e).clusterShow=!0}zo.prototype._initialize=function(t){this._scene=t;const i=(n=this,function(t){if(e.defined(t)&&t<.05||!n.enabled)return;const i=n._scene,r=n._labelCollection,o=n._billboardCollection,s=n._pointCollection;if(!e.defined(r)&&!e.defined(o)&&!e.defined(s)||!n._clusterBillboards&&!n._clusterLabels&&!n._clusterPoints)return;let a=n._clusterLabelCollection,l=n._clusterBillboardCollection,c=n._clusterPointCollection;e.defined(a)?a.removeAll():a=n._clusterLabelCollection=new e.LabelCollection({scene:i}),e.defined(l)?l.removeAll():l=n._clusterBillboardCollection=new e.BillboardCollection({scene:i}),e.defined(c)?c.removeAll():c=n._clusterPointCollection=new e.PointPrimitiveCollection;const d=n._pixelRange,u=n._minimumClusterSize,h=n._previousClusters,p=[],m=n._previousHeight,f=i.camera.positionCartographic.height,g=i.mapProjection.ellipsoid,v=i.camera.positionWC,y=new e.EllipsoidalOccluder(g,v),_=[];let C,w,b,x,P,M,D,T,E,A,S,I;n._clusterLabels&&Vo(r,_,i,y,n),n._clusterBillboards&&Vo(o,_,i,y,n),n._clusterPoints&&Vo(s,_,i,y,n);const O=new Oo(_,Fo,Ro,64,Int32Array);if(f<m)for(b=h.length,C=0;C<b;++C){const t=h[C];if(!y.isPointVisible(t.position))continue;const r=e.Billboard._computeScreenSpacePosition(e.Matrix4.IDENTITY,t.position,e.Cartesian3.ZERO,e.Cartesian2.ZERO,i);if(!e.defined(r))continue;const o=1-f/m;let s=t.width=t.width*o,a=t.height=t.height*o;s=Math.max(s,t.minimumWidth),a=Math.max(a,t.minimumHeight);const l=r.x-.5*s,c=r.y-.5*a,d=r.x+s,g=r.y+a;for(P=O.range(l,c,d,g),M=P.length,A=0,E=[],w=0;w<M;++w)D=P[w],T=_[D],T.clustered||(++A,S=T.collection,I=T.index,E.push(S.get(I).id));if(A>=u)for(Go(t.position,A,E,n),p.push(t),w=0;w<M;++w)_[P[w]].clustered=!0}for(b=_.length,C=0;C<b;++C){const t=_[C];if(t.clustered)continue;t.clustered=!0,S=t.collection,I=t.index;const i=S.get(I);x=Bo(i,t.coord,d,n,Ho);const r=e.BoundingRectangle.clone(x,$o);P=O.range(x.x,x.y,x.x+x.width,x.y+x.height),M=P.length;const o=e.Cartesian3.clone(i.position);for(A=1,E=[i.id],w=0;w<M;++w)if(D=P[w],T=_[D],!T.clustered){const t=T.collection.get(T.index),i=Bo(t,T.coord,d,n,Wo);e.Cartesian3.add(t.position,o,o),e.BoundingRectangle.union(r,i,r),++A,E.push(t.id)}if(A>=u){const t=e.Cartesian3.multiplyByScalar(o,1/A,o);for(Go(t,A,E,n),p.push({position:t,width:r.width,height:r.height,minimumWidth:x.width,minimumHeight:x.height}),w=0;w<M;++w)_[P[w]].clustered=!0}else No(i,n)}0===a.length&&(a.destroy(),n._clusterLabelCollection=void 0),0===l.length&&(l.destroy(),n._clusterBillboardCollection=void 0),0===c.length&&(c.destroy(),n._clusterPointCollection=void 0),n._previousClusters=p,n._previousHeight=f});var n;this._cluster=i,this._removeEventListener=t.camera.changed.addEventListener(i)},Object.defineProperties(zo.prototype,{enabled:{get(){return this._enabled},set(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get(){return this._pixelRange},set(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get(){return this._minimumClusterSize},set(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get(){return this._clusterEvent}},clusterBillboards:{get(){return this._clusterBillboards},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get(){return this._clusterLabels},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get(){return this._clusterPoints},set(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}}),zo.prototype.getLabel=qo("_labelCollection",e.LabelCollection,"_unusedLabelIndices","labelIndex"),zo.prototype.removeLabel=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._labelCollection)||!e.defined(i)||!e.defined(i.labelIndex))return;const n=i.labelIndex;i.labelIndex=void 0,jo(this,t.id);const r=this._labelCollection.get(n);r.show=!1,r.text="",r.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0},zo.prototype.getBillboard=qo("_billboardCollection",e.BillboardCollection,"_unusedBillboardIndices","billboardIndex"),zo.prototype.removeBillboard=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._billboardCollection)||!e.defined(i)||!e.defined(i.billboardIndex))return;const n=i.billboardIndex;i.billboardIndex=void 0,jo(this,t.id);const r=this._billboardCollection.get(n);r.id=void 0,r.show=!1,r.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0},zo.prototype.getPoint=qo("_pointCollection",e.PointPrimitiveCollection,"_unusedPointIndices","pointIndex"),zo.prototype.removePoint=function(t){const i=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[t.id];if(!e.defined(this._pointCollection)||!e.defined(i)||!e.defined(i.pointIndex))return;const n=i.pointIndex;i.pointIndex=void 0,jo(this,t.id);const r=this._pointCollection.get(n);r.show=!1,r.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0},zo.prototype.update=function(t){if(!this.show)return;let i;var n;e.defined(this._labelCollection)&&this._labelCollection.length>0&&0===this._labelCollection.get(0)._glyphs.length&&(i=t.commandList,t.commandList=[],this._labelCollection.update(t),t.commandList=i),e.defined(this._billboardCollection)&&this._billboardCollection.length>0&&!e.defined(this._billboardCollection.get(0).width)&&(i=t.commandList,t.commandList=[],this._billboardCollection.update(t),t.commandList=i),this._enabledDirty&&(this._enabledDirty=!1,(n=this).enabled||(e.defined(n._clusterLabelCollection)&&n._clusterLabelCollection.destroy(),e.defined(n._clusterBillboardCollection)&&n._clusterBillboardCollection.destroy(),e.defined(n._clusterPointCollection)&&n._clusterPointCollection.destroy(),n._clusterLabelCollection=void 0,n._clusterBillboardCollection=void 0,n._clusterPointCollection=void 0,Yo(n._labelCollection),Yo(n._billboardCollection),Yo(n._pointCollection)),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),e.defined(this._clusterLabelCollection)&&this._clusterLabelCollection.update(t),e.defined(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(t),e.defined(this._clusterPointCollection)&&this._clusterPointCollection.update(t),e.defined(this._labelCollection)&&this._labelCollection.update(t),e.defined(this._billboardCollection)&&this._billboardCollection.update(t),e.defined(this._pointCollection)&&this._pointCollection.update(t)},zo.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),e.defined(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};class Zo extends st{position;options;constructor(e){super(),this.options=e,this.position=e.position,this.setAppearance()}getGeometry(){return new e.CircleGeometry({center:this.position,radius:this.options.radius})}getPrimitive(){if(!this.needUpdate&&this._primitive)return this._primitive;this.needUpdate=!1;const t=this.getGeometry();if(!t)return;const i={geometryInstances:new e.GeometryInstance({geometry:t}),appearance:this.appearance,asynchronous:!1};return this.options.ground?new e.GroundPrimitive(i):new e.Primitive(i)}setAppearance(t){this.appearance=t||new e.MaterialAppearance({material:Tr(this.options.materialOptions),flat:!1,faceForward:!1,translucent:!0,closed:!1})}}class Xo extends st{gridPrimitiveCollection=new e.PrimitiveCollection;polygonPrimitive;outlinePrimitive;options;constructor(t){super(),this.options=t,this.gridPrimitiveCollection=new e.PrimitiveCollection,this.polygonPrimitive=this.createGridPolygonPrimitive(),this.outlinePrimitive=this.createGridOutlinePrimitive()}createGridPolygonPrimitive(){if(!this.options.fill)return;const t=[];this.options.vertices.forEach(i=>{const n=e.Color.fromCssColorString(this.options.fillColor),r=Vt(i.positions,n,`grid-${i.id}`);t.push(r)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PerInstanceColorAppearance({flat:!0,translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}createGridOutlinePrimitive(){if(!this.options.outline)return;const t=[];this.options.vertices.forEach(i=>{const n=e.Color.fromCssColorString(this.options.outlineColor),r=Ht(i.positions,n,`grid-${i.id}`);t.push(r)});const i=new e.Primitive({geometryInstances:t,appearance:new e.PolylineColorAppearance({translucent:!0}),asynchronous:!1});return this.gridPrimitiveCollection.add(i),i}getPrimitive(){return this.gridPrimitiveCollection}selectGrids(t){const i=e.Color.fromCssColorString(this.options.fillSelectColor),n=e.Color.fromCssColorString(this.options.outlineSelectColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(n)}})}unSelectGrids(t){const i=e.Color.fromCssColorString(this.options.fillColor),n=e.Color.fromCssColorString(this.options.outlineColor);t.forEach(t=>{if(this.polygonPrimitive){this.polygonPrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(i)}if(this.outlinePrimitive){this.outlinePrimitive.getGeometryInstanceAttributes(t).color=e.ColorGeometryInstanceAttribute.toValue(n)}})}}const Jo=t=>{const i=[],n={LEFT_CLICK:[]};return t.scene.postRender.addEventListener(()=>{i.forEach(i=>{if(i.distanceDisplayCondition){const n=e.Cartesian3.distance(i.position,t.camera.position);if(n>=i.distanceDisplayCondition.far||n<=i.distanceDisplayCondition.near)return void(i.divEle.style.display="none")}const n=t.scene.cartesianToCanvasCoordinates(i.position);if(n){i.divEle.style.display="block";const e=i.divEle.getBoundingClientRect();let t=2;"left"===i.align&&(t=e.width+i.offset.x),"right"===i.align&&(t=1),i.divEle.style.left=n.x/i.autoFit.x-(e.width+i.offset.x)/i.autoFit.x/t+"px",i.divEle.style.top=n.y/i.autoFit.y-(e.height+i.offset.y)/i.autoFit.y+"px"}else i.divEle.style.display="none"})}),{divLabels:i,set:r=>{const o={id:r.divEle.id||N(),...r};return o.autoFit||(o.autoFit=e.Cartesian2.fromElements(1,1)),o.offset||(o.offset=e.Cartesian2.fromElements(0,0)),o.align||(o.align="center"),o.divEle.id=o.id,o.divEle.style.position="absolute",o.userSelect||(o.divEle.style.userSelect="none"),o.parentEle?(o.parentEle.style.position="relative",o.parentEle.appendChild(o.divEle)):(t._element.style.position="relative",t._element.appendChild(o.divEle)),i.push(o),o.divEle.addEventListener("click",()=>{n.LEFT_CLICK.forEach(e=>{e(o)})}),o},setPosition:(e,t)=>{const n=i.findIndex(t=>t.id===e);if(-1!==n){i[n].position=t}},remove:e=>{const t=i.findIndex(t=>t.id===e.id);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},removeAll:()=>{i.forEach(e=>{e.divEle.remove()}),i.length=0},removeById:e=>{const t=i.findIndex(t=>t.id===e);if(-1!==t){i[t].divEle.remove(),i.splice(t,1)}},addEventListener:(e,t)=>{n[e]&&n[e].push(t)}}},Ko=t=>{const i=[],n=()=>{i.forEach(e=>{e.vloumePrimitive.removeAll(),t.scene.primitives.remove(e.vloumePrimitive)}),i.length=0};return{set:async n=>{const r=f(n.positions),o=new e.PrimitiveCollection({destroyPrimitives:!1}),s=new e.PrimitiveCollection({destroyPrimitives:!1}),a=new e.PointPrimitiveCollection,l=new e.LabelCollection;s.add(a),o.add(l),o.add(s),t.scene.primitives.add(o);const c=N();let d={};const u=r.map(t=>{const i=e.Cartographic.fromCartesian(t);return{lng:e.Math.toDegrees(i.longitude),lat:e.Math.toDegrees(i.latitude),height:i.height}}),h=Math.min(...u.map(e=>e.height)),p=ne([u.map(e=>[e.lng,e.lat])]),m=ge(p),g=Math.sqrt(ge(p)/200),v=Ve(p),y=Ue(p),_=function(e,t,i={}){i.mask&&!i.units&&(i.units="kilometers");for(var n=[],r=e[0],o=e[1],s=e[2],a=e[3],l=t/pe([r,o],[s,o],i)*(s-r),c=t/pe([r,o],[r,a],i)*(a-o),d=s-r,u=a-o,h=Math.floor(d/l),p=(u-Math.floor(u/c)*c)/2,m=r+(d-h*l)/2;m<=s;){for(var f=o+p;f<=a;){var g=ie([m,f],i.properties);i.mask?Le(g,i.mask)&&n.push(g):n.push(g),f+=c}m+=l}return oe(n)}(we(v),g,{units:"meters"}),C=We(_,p).features.map(t=>e.Cartesian3.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1])),w=await t.scene.clampToHeightMostDetailed(C),{maxHeight:b,minHeight:x,digVolume:P,fillVolume:M,volumeLabel:D}=es(w,g,y,l,m,h),T=Qo(r,h,o);return function(t,i,n,r){const o=e.WallGeometry.fromConstantHeights({positions:t,minimumHeight:n,maximumHeight:i}),s=e.WallGeometry.createGeometry(o),a=new e.GeometryInstance({geometry:s});r.add(new e.Primitive({geometryInstances:[a],asynchronous:!1,appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#00ff00").withAlpha(.5)})})}))}(r,b,x,o),function(t,i,n){t.forEach((t,r)=>{n.add({position:t,text:`高程:${ts(i[r].height)}米`,font:"14px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})})}(r,u,l),d={id:c,maxHeight:b,minHeight:x,baseHeight:h,digVolume:P,fillVolume:M,cellsize:g,positions:r,centroid:y,area:m,heightPositions:w,polygonPrimitive:T,linePrimitive:s,labelPrimitive:l,vloumePrimitive:o,volumeLabel:D},i.push(d),d},changeBaseHeight:async e=>{const n=i.findIndex(t=>t.id===e.id);if(-1===n)return;const r=i[n];let o=(await oi(t)).lnglat.height;o>e.maxHeight&&(o=e.maxHeight),o<e.minHeight&&(o=e.minHeight),r.baseHeight=Number(o.toFixed(2));const s=r.vloumePrimitive,a=r.labelPrimitive;r.polygonPrimitive&&s.remove(r.polygonPrimitive),r.volumeLabel&&a.remove(r.volumeLabel);const{positions:l,baseHeight:c,heightPositions:d,cellsize:u,centroid:h,area:p}=r,m=Qo(l,c,s),{digVolume:f,fillVolume:g,volumeLabel:v}=es(d,u,h,a,p,c);i[n]={...r,digVolume:f,fillVolume:g,polygonPrimitive:m,volumeLabel:v}},remove:e=>{const n=i.findIndex(t=>t.id===e.id);-1!==n&&(e.vloumePrimitive.removeAll(),t.scene.primitives.remove(e.vloumePrimitive),i.splice(n,1))},removeAll:n,destroy:()=>{n()}}};function Qo(t,i,n){const r=new e.PolygonGeometry({polygonHierarchy:new e.PolygonHierarchy(t),height:i}),o=new e.GeometryInstance({geometry:r});return n.add(new e.Primitive({allowPicking:!1,asynchronous:!1,geometryInstances:[o],appearance:new e.MaterialAppearance({translucent:!0,faceForward:!0,material:e.Material.fromType("Color",{color:e.Color.fromCssColorString("#0088ff").withAlpha(.5)})})}))}function es(t,i,n,r,o,s){const a=t.map(t=>e.Cartographic.fromCartesian(t).height),l=Math.min(...a),c=Math.max(...a);let d=0;for(let e=0;e<a.length;e++)a[e]-s>0&&(d+=(a[e]-s)*i*i);let u=0;for(let e=0;e<a.length;e++)s-a[e]>0&&(u+=(s-a[e])*i*i);const h=e.Cartesian3.fromDegrees(n.geometry.coordinates[0],n.geometry.coordinates[1],c),p={};d?p["挖方体积"]=`${ts(d)}方\n`:d=0,u?p["填方体积"]=`${ts(u)}方\n`:u=0,o&&(p["横切面积"]=`${ts(o)}平方米\n`),l&&(p["最小高程"]=`${ts(l)}米\n`),c&&(p["最大高程"]=`${ts(c)}米\n`),l&&(p["基准面高程"]=`${ts(s)}米`);let m="";Object.keys(p).forEach(e=>{m+=`${e}:${p[e]}`});return{maxHeight:c,minHeight:l,digVolume:d,fillVolume:u,volumeLabel:r.add({position:h,text:m,font:"16px sans-serif",fillColor:e.Color.WHITE,showBackground:!0,style:e.LabelStyle.FILL_AND_OUTLINE,disableDepthTestDistance:Number.POSITIVE_INFINITY})}}function ts(e){const t=["","万","百万","千万","亿"];let i=0;for(;e>=1e4&&i<t.length-1;)e/=1e4,i++;return`${e.toFixed(2).replace(/\.?0+$/,"")}${t[i]}`}const is=t=>{const i=new e.ClippingPolygonCollection({polygons:[]});t.scene.globe.clippingPolygons=i;const n=[],r=new e.CustomDataSource("ground-clip");t.dataSources.add(r);const o=()=>{i.isDestroyed()||i.removeAll(),n.length=0,r.entities.removeAll()};return{set:async o=>{if(i.isDestroyed())throw new Error("对象已被销毁");o={interCount:50,...o};let s=rt(f(o.positions),o.interCount);s=await t.scene.clampToHeightMostDetailed(s);const a=[],l=p(u(s).map(e=>(a.push(e.height),e.height=-o.depth,e))),c=a.map(e=>e-o.depth),d=Math.min(...c),h=Array.from({length:c.length}).fill(d),m=r.entities.add({wall:{positions:l,minimumHeights:h,maximumHeights:a,material:new e.ImageMaterialProperty({image:`${window.INO_CESIUM_BASE_URL}/assets/images/ground-clip/wall.jpg`})},polygon:{hierarchy:l,height:d,material:new e.ImageMaterialProperty({image:`${window.INO_CESIUM_BASE_URL}/assets/images/ground-clip/poly-soil.jpg`})}}),g=new e.ClippingPolygon({positions:s});i.add(g);const v={id:N(),positions:s,clipPolygon:g,clipEntity:m};return n.push(v),v},remove:e=>{const i=n.findIndex(t=>t.id===e.id);-1!==i&&(n.splice(i,1),r.entities.remove(e.clipEntity),t.scene.globe.clippingPolygons.remove(e.clipPolygon))},removeAll:o,destroy:()=>{o(),i.destroy(),t.scene.globe.clippingPolygons=new e.ClippingPolygonCollection}}};function ns(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rs(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}
|
|
2
|
+
/*!
|
|
3
|
+
* GSAP 3.13.0
|
|
4
|
+
* https://gsap.com
|
|
5
|
+
*
|
|
6
|
+
* @license Copyright 2008-2025, GreenSock. All rights reserved.
|
|
7
|
+
* Subject to the terms at https://gsap.com/standard-license
|
|
8
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
9
|
+
*/var os,ss,as,ls,cs,ds,us,hs,ps,ms,fs,gs,vs,ys,_s,Cs,ws,bs={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},xs={duration:.5,overwrite:!1,delay:0},Ps=1e8,Ms=1e-8,Ds=2*Math.PI,Ts=Ds/4,Es=0,As=Math.sqrt,Ss=Math.cos,Is=Math.sin,Os=function(e){return"string"==typeof e},zs=function(e){return"function"==typeof e},Fs=function(e){return"number"==typeof e},Rs=function(e){return void 0===e},ks=function(e){return"object"==typeof e},Ls=function(e){return!1!==e},Bs=function(){return"undefined"!=typeof window},Ns=function(e){return zs(e)||Os(e)},Gs="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Us=Array.isArray,Vs=/(?:-?\.?\d|\.)+/gi,Hs=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,$s=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Ws=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,qs=/[+-]=-?[.\d]+/,js=/[^,'"\[\]\s]+/gi,Ys=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Zs={},Xs={},Js=function(e){return(Xs=Ta(e,Zs))&&Ec},Ks=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Qs=function(e,t){return!t&&console.warn(e)},ea=function(e,t){return e&&(Zs[e]=t)&&Xs&&(Xs[e]=t)||Zs},ta=function(){return 0},ia={suppressEvents:!0,isStart:!0,kill:!1},na={suppressEvents:!0,kill:!1},ra={suppressEvents:!0},oa={},sa=[],aa={},la={},ca={},da=30,ua=[],ha="",pa=function(e){var t,i,n=e[0];if(ks(n)||zs(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(i=ua.length;i--&&!ua[i].targetTest(n););t=ua[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new Vl(e[i],t)))||e.splice(i,1);return e},ma=function(e){return e._gsap||pa(ol(e))[0]._gsap},fa=function(e,t,i){return(i=e[t])&&zs(i)?e[t]():Rs(i)&&e.getAttribute&&e.getAttribute(t)||i},ga=function(e,t){return(e=e.split(",")).forEach(t)||e},va=function(e){return Math.round(1e5*e)/1e5||0},ya=function(e){return Math.round(1e7*e)/1e7||0},_a=function(e,t){var i=t.charAt(0),n=parseFloat(t.substr(2));return e=parseFloat(e),"+"===i?e+n:"-"===i?e-n:"*"===i?e*n:e/n},Ca=function(e,t){for(var i=t.length,n=0;e.indexOf(t[n])<0&&++n<i;);return n<i},wa=function(){var e,t,i=sa.length,n=sa.slice(0);for(aa={},sa.length=0,e=0;e<i;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},ba=function(e){return!!(e._initted||e._startAt||e.add)},xa=function(e,t,i,n){sa.length&&!ss&&wa(),e.render(t,i,!!(ss&&t<0&&ba(e))),sa.length&&!ss&&wa()},Pa=function(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(js).length<2?t:Os(e)?e.trim():e},Ma=function(e){return e},Da=function(e,t){for(var i in t)i in e||(e[i]=t[i]);return e},Ta=function(e,t){for(var i in t)e[i]=t[i];return e},Ea=function e(t,i){for(var n in i)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(t[n]=ks(i[n])?e(t[n]||(t[n]={}),i[n]):i[n]);return t},Aa=function(e,t){var i,n={};for(i in e)i in t||(n[i]=e[i]);return n},Sa=function(e){var t,i=e.parent||ls,n=e.keyframes?(t=Us(e.keyframes),function(e,i){for(var n in i)n in e||"duration"===n&&t||"ease"===n||(e[n]=i[n])}):Da;if(Ls(e.inherit))for(;i;)n(e,i.vars.defaults),i=i.parent||i._dp;return e},Ia=function(e,t,i,n,r){var o,s=e[n];if(r)for(o=t[r];s&&s[r]>o;)s=s._prev;return s?(t._next=s._next,s._next=t):(t._next=e[i],e[i]=t),t._next?t._next._prev=t:e[n]=t,t._prev=s,t.parent=t._dp=e,t},Oa=function(e,t,i,n){void 0===i&&(i="_first"),void 0===n&&(n="_last");var r=t._prev,o=t._next;r?r._next=o:e[i]===t&&(e[i]=o),o?o._prev=r:e[n]===t&&(e[n]=r),t._next=t._prev=t.parent=null},za=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},Fa=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var i=e;i;)i._dirty=1,i=i.parent;return e},Ra=function(e,t,i,n){return e._startAt&&(ss?e._startAt.revert(na):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,n))},ka=function e(t){return!t||t._ts&&e(t.parent)},La=function(e){return e._repeat?Ba(e._tTime,e=e.duration()+e._rDelay)*e:0},Ba=function(e,t){var i=Math.floor(e=ya(e/t));return e&&i===e?i-1:i},Na=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Ga=function(e){return e._end=ya(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ms)||0))},Ua=function(e,t){var i=e._dp;return i&&i.smoothChildTiming&&e._ts&&(e._start=ya(i._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Ga(e),i._dirty||Fa(i,e)),e},Va=function(e,t){var i;if((t._time||!t._dur&&t._initted||t._start<e._time&&(t._dur||!t.add))&&(i=Na(e.rawTime(),t),(!t._dur||el(0,t.totalDuration(),i)-t._tTime>Ms)&&t.render(i,!0)),Fa(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(i=e;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;e._zTime=-1e-8}},Ha=function(e,t,i,n){return t.parent&&za(t),t._start=ya((Fs(i)?i:i||e!==ls?Ja(e,i,t):e._time)+t._delay),t._end=ya(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),Ia(e,t,"_first","_last",e._sort?"_start":0),ja(t)||(e._recent=t),n||Va(e,t),e._ts<0&&Ua(e,e._tTime),e},$a=function(e,t){return(Zs.ScrollTrigger||Ks("scrollTrigger",t))&&Zs.ScrollTrigger.create(t,e)},Wa=function(e,t,i,n,r){return Xl(e,t,r),e._initted?!i&&e._pt&&!ss&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&ps!==Al.frame?(sa.push(e),e._lazy=[r,n],1):void 0:1},qa=function e(t){var i=t.parent;return i&&i._ts&&i._initted&&!i._lock&&(i.rawTime()<0||e(i))},ja=function(e){var t=e.data;return"isFromStart"===t||"isStart"===t},Ya=function(e,t,i,n){var r=e._repeat,o=ya(t)||0,s=e._tTime/e._tDur;return s&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=r?r<0?1e10:ya(o*(r+1)+e._rDelay*r):o,s>0&&!n&&Ua(e,e._tTime=e._tDur*s),e.parent&&Ga(e),i||Fa(e.parent,e),e},Za=function(e){return e instanceof $l?Fa(e):Ya(e,e._dur)},Xa={_start:0,endTime:ta,totalDuration:ta},Ja=function e(t,i,n){var r,o,s,a=t.labels,l=t._recent||Xa,c=t.duration()>=Ps?l.endTime(!1):t._dur;return Os(i)&&(isNaN(i)||i in a)?(o=i.charAt(0),s="%"===i.substr(-1),r=i.indexOf("="),"<"===o||">"===o?(r>=0&&(i=i.replace(/=/,"")),("<"===o?l._start:l.endTime(l._repeat>=0))+(parseFloat(i.substr(1))||0)*(s?(r<0?l:n).totalDuration()/100:1)):r<0?(i in a||(a[i]=c),a[i]):(o=parseFloat(i.charAt(r-1)+i.substr(r+1)),s&&n&&(o=o/100*(Us(n)?n[0]:n).totalDuration()),r>1?e(t,i.substr(0,r-1),n)+o:c+o)):null==i?c:+i},Ka=function(e,t,i){var n,r,o=Fs(t[1]),s=(o?2:1)+(e<2?0:1),a=t[s];if(o&&(a.duration=t[1]),a.parent=i,e){for(n=a,r=i;r&&!("immediateRender"in n);)n=r.vars.defaults||{},r=Ls(r.vars.inherit)&&r.parent;a.immediateRender=Ls(n.immediateRender),e<2?a.runBackwards=1:a.startAt=t[s-1]}return new tc(t[0],a,t[s+1])},Qa=function(e,t){return e||0===e?t(e):t},el=function(e,t,i){return i<e?e:i>t?t:i},tl=function(e,t){return Os(e)&&(t=Ys.exec(e))?t[1]:""},il=[].slice,nl=function(e,t){return e&&ks(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&ks(e[0]))&&!e.nodeType&&e!==cs},rl=function(e,t,i){return void 0===i&&(i=[]),e.forEach(function(e){var n;return Os(e)&&!t||nl(e,1)?(n=i).push.apply(n,ol(e)):i.push(e)})||i},ol=function(e,t,i){return as&&!t&&as.selector?as.selector(e):!Os(e)||i||!ds&&Sl()?Us(e)?rl(e,i):nl(e)?il.call(e,0):e?[e]:[]:il.call((t||us).querySelectorAll(e),0)},sl=function(e){return e=ol(e)[0]||Qs("Invalid scope")||{},function(t){var i=e.current||e.nativeElement||e;return ol(t,i.querySelectorAll?i:i===e?Qs("Invalid scope")||us.createElement("div"):e)}},al=function(e){return e.sort(function(){return.5-Math.random()})},ll=function(e){if(zs(e))return e;var t=ks(e)?e:{each:e},i=Ll(t.ease),n=t.from||0,r=parseFloat(t.base)||0,o={},s=n>0&&n<1,a=isNaN(n)||s,l=t.axis,c=n,d=n;return Os(n)?c=d={center:.5,edges:.5,end:1}[n]||0:!s&&a&&(c=n[0],d=n[1]),function(e,s,u){var h,p,m,f,g,v,y,_,C,w=(u||t).length,b=o[w];if(!b){if(!(C="auto"===t.grid?0:(t.grid||[1,Ps])[1])){for(y=-1e8;y<(y=u[C++].getBoundingClientRect().left)&&C<w;);C<w&&C--}for(b=o[w]=[],h=a?Math.min(C,w)*c-.5:n%C,p=C===Ps?0:a?w*d/C-.5:n/C|0,y=0,_=Ps,v=0;v<w;v++)m=v%C-h,f=p-(v/C|0),b[v]=g=l?Math.abs("y"===l?f:m):As(m*m+f*f),g>y&&(y=g),g<_&&(_=g);"random"===n&&al(b),b.max=y-_,b.min=_,b.v=w=(parseFloat(t.amount)||parseFloat(t.each)*(C>w?w-1:l?"y"===l?w/C:C:Math.max(C,w/C))||0)*("edges"===n?-1:1),b.b=w<0?r-w:r,b.u=tl(t.amount||t.each)||0,i=i&&w<0?Rl(i):i}return w=(b[e]-b.min)/b.max||0,ya(b.b+(i?i(w):w)*b.v)+b.u}},cl=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(i){var n=ya(Math.round(parseFloat(i)/e)*e*t);return(n-n%1)/t+(Fs(i)?0:tl(i))}},dl=function(e,t){var i,n,r=Us(e);return!r&&ks(e)&&(i=r=e.radius||Ps,e.values?(e=ol(e.values),(n=!Fs(e[0]))&&(i*=i)):e=cl(e.increment)),Qa(t,r?zs(e)?function(t){return n=e(t),Math.abs(n-t)<=i?n:t}:function(t){for(var r,o,s=parseFloat(n?t.x:t),a=parseFloat(n?t.y:0),l=Ps,c=0,d=e.length;d--;)(r=n?(r=e[d].x-s)*r+(o=e[d].y-a)*o:Math.abs(e[d]-s))<l&&(l=r,c=d);return c=!i||l<=i?e[c]:t,n||c===t||Fs(t)?c:c+tl(t)}:cl(e))},ul=function(e,t,i,n){return Qa(Us(e)?!t:!0===i?!!(i=0):!n,function(){return Us(e)?e[~~(Math.random()*e.length)]:(i=i||1e-5)&&(n=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((e-i/2+Math.random()*(t-e+.99*i))/i)*i*n)/n})},hl=function(e,t,i){return Qa(i,function(i){return e[~~t(i)]})},pl=function(e){for(var t,i,n,r,o=0,s="";~(t=e.indexOf("random(",o));)n=e.indexOf(")",t),r="["===e.charAt(t+7),i=e.substr(t+7,n-t-7).match(r?js:Vs),s+=e.substr(o,t-o)+ul(r?i:+i[0],r?0:+i[1],+i[2]||1e-5),o=n+1;return s+e.substr(o,e.length-o)},ml=function(e,t,i,n,r){var o=t-e,s=n-i;return Qa(r,function(t){return i+((t-e)/o*s||0)})},fl=function(e,t,i){var n,r,o,s=e.labels,a=Ps;for(n in s)(r=s[n]-t)<0==!!i&&r&&a>(r=Math.abs(r))&&(o=n,a=r);return o},gl=function(e,t,i){var n,r,o,s=e.vars,a=s[t],l=as,c=e._ctx;if(a)return n=s[t+"Params"],r=s.callbackScope||e,i&&sa.length&&wa(),c&&(as=c),o=n?a.apply(r,n):a.call(r),as=l,o},vl=function(e){return za(e),e.scrollTrigger&&e.scrollTrigger.kill(!!ss),e.progress()<1&&gl(e,"onInterrupt"),e},yl=[],_l=function(e){if(e)if(e=!e.name&&e.default||e,Bs()||e.headless){var t=e.name,i=zs(e),n=t&&!i&&e.init?function(){this._props=[]}:e,r={init:ta,render:dc,add:Yl,kill:hc,modifier:uc,rawVars:0},o={targetTest:0,get:0,getSetter:sc,aliases:{},register:0};if(Sl(),e!==n){if(la[t])return;Da(n,Da(Aa(e,r),o)),Ta(n.prototype,Ta(r,Aa(e,o))),la[n.prop=t]=n,e.targetTest&&(ua.push(n),oa[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}ea(t,n),e.register&&e.register(Ec,n,fc)}else yl.push(e)},Cl=255,wl={aqua:[0,Cl,Cl],lime:[0,Cl,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Cl],navy:[0,0,128],white:[Cl,Cl,Cl],olive:[128,128,0],yellow:[Cl,Cl,0],orange:[Cl,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Cl,0,0],pink:[Cl,192,203],cyan:[0,Cl,Cl],transparent:[Cl,Cl,Cl,0]},bl=function(e,t,i){return(6*(e+=e<0?1:e>1?-1:0)<1?t+(i-t)*e*6:e<.5?i:3*e<2?t+(i-t)*(2/3-e)*6:t)*Cl+.5|0},xl=function(e,t,i){var n,r,o,s,a,l,c,d,u,h,p=e?Fs(e)?[e>>16,e>>8&Cl,e&Cl]:0:wl.black;if(!p){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),wl[e])p=wl[e];else if("#"===e.charAt(0)){if(e.length<6&&(n=e.charAt(1),r=e.charAt(2),o=e.charAt(3),e="#"+n+n+r+r+o+o+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(p=parseInt(e.substr(1,6),16))>>16,p>>8&Cl,p&Cl,parseInt(e.substr(7),16)/255];p=[(e=parseInt(e.substr(1),16))>>16,e>>8&Cl,e&Cl]}else if("hsl"===e.substr(0,3))if(p=h=e.match(Vs),t){if(~e.indexOf("="))return p=e.match(Hs),i&&p.length<4&&(p[3]=1),p}else s=+p[0]%360/360,a=+p[1]/100,n=2*(l=+p[2]/100)-(r=l<=.5?l*(a+1):l+a-l*a),p.length>3&&(p[3]*=1),p[0]=bl(s+1/3,n,r),p[1]=bl(s,n,r),p[2]=bl(s-1/3,n,r);else p=e.match(Vs)||wl.transparent;p=p.map(Number)}return t&&!h&&(n=p[0]/Cl,r=p[1]/Cl,o=p[2]/Cl,l=((c=Math.max(n,r,o))+(d=Math.min(n,r,o)))/2,c===d?s=a=0:(u=c-d,a=l>.5?u/(2-c-d):u/(c+d),s=c===n?(r-o)/u+(r<o?6:0):c===r?(o-n)/u+2:(n-r)/u+4,s*=60),p[0]=~~(s+.5),p[1]=~~(100*a+.5),p[2]=~~(100*l+.5)),i&&p.length<4&&(p[3]=1),p},Pl=function(e){var t=[],i=[],n=-1;return e.split(Dl).forEach(function(e){var r=e.match($s)||[];t.push.apply(t,r),i.push(n+=r.length+1)}),t.c=i,t},Ml=function(e,t,i){var n,r,o,s,a="",l=(e+a).match(Dl),c=t?"hsla(":"rgba(",d=0;if(!l)return e;if(l=l.map(function(e){return(e=xl(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"}),i&&(o=Pl(e),(n=i.c).join(a)!==o.c.join(a)))for(s=(r=e.replace(Dl,"1").split($s)).length-1;d<s;d++)a+=r[d]+(~n.indexOf(d)?l.shift()||c+"0,0,0,0)":(o.length?o:l.length?l:i).shift());if(!r)for(s=(r=e.split(Dl)).length-1;d<s;d++)a+=r[d]+l[d];return a+r[s]},Dl=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in wl)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Tl=/hsl[a]?\(/,El=function(e){var t,i=e.join(" ");if(Dl.lastIndex=0,Dl.test(i))return t=Tl.test(i),e[1]=Ml(e[1],t),e[0]=Ml(e[0],t,Pl(e[1])),!0},Al=function(){var e,t,i,n,r,o,s=Date.now,a=500,l=33,c=s(),d=c,u=1e3/240,h=u,p=[],m=function i(m){var f,g,v,y,_=s()-d,C=!0===m;if((_>a||_<0)&&(c+=_-l),((f=(v=(d+=_)-c)-h)>0||C)&&(y=++n.frame,r=v-1e3*n.time,n.time=v/=1e3,h+=f+(f>=u?4:u-f),g=1),C||(e=t(i)),g)for(o=0;o<p.length;o++)p[o](v,r,y,m)};return n={time:0,frame:0,tick:function(){m(!0)},deltaRatio:function(e){return r/(1e3/(e||60))},wake:function(){hs&&(!ds&&Bs()&&(cs=ds=window,us=cs.document||{},Zs.gsap=Ec,(cs.gsapVersions||(cs.gsapVersions=[])).push(Ec.version),Js(Xs||cs.GreenSockGlobals||!cs.gsap&&cs||{}),yl.forEach(_l)),i="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame,e&&n.sleep(),t=i||function(e){return setTimeout(e,h-1e3*n.time+1|0)},fs=1,m(2))},sleep:function(){(i?cancelAnimationFrame:clearTimeout)(e),fs=0,t=ta},lagSmoothing:function(e,t){a=e||1/0,l=Math.min(t||33,a)},fps:function(e){u=1e3/(e||240),h=1e3*n.time+u},add:function(e,t,i){var r=t?function(t,i,o,s){e(t,i,o,s),n.remove(r)}:e;return n.remove(e),p[i?"unshift":"push"](r),Sl(),r},remove:function(e,t){~(t=p.indexOf(e))&&p.splice(t,1)&&o>=t&&o--},_listeners:p}}(),Sl=function(){return!fs&&Al.wake()},Il={},Ol=/^[\d.\-M][\d.\-,\s]/,zl=/["']/g,Fl=function(e){for(var t,i,n,r={},o=e.substr(1,e.length-3).split(":"),s=o[0],a=1,l=o.length;a<l;a++)i=o[a],t=a!==l-1?i.lastIndexOf(","):i.length,n=i.substr(0,t),r[s]=isNaN(n)?n.replace(zl,"").trim():+n,s=i.substr(t+1).trim();return r},Rl=function(e){return function(t){return 1-e(1-t)}},kl=function e(t,i){for(var n,r=t._first;r;)r instanceof $l?e(r,i):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===i||(r.timeline?e(r.timeline,i):(n=r._ease,r._ease=r._yEase,r._yEase=n,r._yoyo=i)),r=r._next},Ll=function(e,t){return e&&(zs(e)?e:Il[e]||function(e){var t,i,n,r,o=(e+"").split("("),s=Il[o[0]];return s&&o.length>1&&s.config?s.config.apply(null,~e.indexOf("{")?[Fl(o[1])]:(t=e,i=t.indexOf("(")+1,n=t.indexOf(")"),r=t.indexOf("(",i),t.substring(i,~r&&r<n?t.indexOf(")",n+1):n)).split(",").map(Pa)):Il._CE&&Ol.test(e)?Il._CE("",e):s}(e))||t},Bl=function(e,t,i,n){void 0===i&&(i=function(e){return 1-t(1-e)}),void 0===n&&(n=function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2});var r,o={easeIn:t,easeOut:i,easeInOut:n};return ga(e,function(e){for(var t in Il[e]=Zs[e]=o,Il[r=e.toLowerCase()]=i,o)Il[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Il[e+"."+t]=o[t]}),o},Nl=function(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}},Gl=function e(t,i,n){var r=i>=1?i:1,o=(n||(t?.3:.45))/(i<1?i:1),s=o/Ds*(Math.asin(1/r)||0),a=function(e){return 1===e?1:r*Math.pow(2,-10*e)*Is((e-s)*o)+1},l="out"===t?a:"in"===t?function(e){return 1-a(1-e)}:Nl(a);return o=Ds/o,l.config=function(i,n){return e(t,i,n)},l},Ul=function e(t,i){void 0===i&&(i=1.70158);var n=function(e){return e?--e*e*((i+1)*e+i)+1:0},r="out"===t?n:"in"===t?function(e){return 1-n(1-e)}:Nl(n);return r.config=function(i){return e(t,i)},r};ga("Linear,Quad,Cubic,Quart,Quint,Strong",function(e,t){var i=t<5?t+1:t;Bl(e+",Power"+(i-1),t?function(e){return Math.pow(e,i)}:function(e){return e},function(e){return 1-Math.pow(1-e,i)},function(e){return e<.5?Math.pow(2*e,i)/2:1-Math.pow(2*(1-e),i)/2})}),Il.Linear.easeNone=Il.none=Il.Linear.easeIn,Bl("Elastic",Gl("in"),Gl("out"),Gl()),gs=7.5625,_s=2*(ys=1/(vs=2.75)),Cs=2.5*ys,Bl("Bounce",function(e){return 1-ws(1-e)},ws=function(e){return e<ys?gs*e*e:e<_s?gs*Math.pow(e-1.5/vs,2)+.75:e<Cs?gs*(e-=2.25/vs)*e+.9375:gs*Math.pow(e-2.625/vs,2)+.984375}),Bl("Expo",function(e){return Math.pow(2,10*(e-1))*e+e*e*e*e*e*e*(1-e)}),Bl("Circ",function(e){return-(As(1-e*e)-1)}),Bl("Sine",function(e){return 1===e?1:1-Ss(e*Ts)}),Bl("Back",Ul("in"),Ul("out"),Ul()),Il.SteppedEase=Il.steps=Zs.SteppedEase={config:function(e,t){void 0===e&&(e=1);var i=1/e,n=e+(t?0:1),r=t?1:0;return function(e){return((n*el(0,.99999999,e)|0)+r)*i}}},xs.ease=Il["quad.out"],ga("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(e){return ha+=e+","+e+"Params,"});var Vl=function(e,t){this.id=Es++,e._gsap=this,this.target=e,this.harness=t,this.get=t?t.get:fa,this.set=t?t.getSetter:sc},Hl=function(){function e(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,Ya(this,+e.duration,1,1),this.data=e.data,as&&(this._ctx=as,as.data.push(this)),fs||Al.wake()}var t=e.prototype;return t.delay=function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay},t.duration=function(e){return arguments.length?this.totalDuration(this._repeat>0?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur},t.totalDuration=function(e){return arguments.length?(this._dirty=0,Ya(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(e,t){if(Sl(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(Ua(this,e),!i._dp||i.parent||Va(i,this);i&&i.parent;)i.parent._time!==i._start+(i._ts>=0?i._tTime/i._ts:(i.totalDuration()-i._tTime)/-i._ts)&&i.totalTime(i._tTime,!0),i=i.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&e<this._tDur||this._ts<0&&e>0||!this._tDur&&!e)&&Ha(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ms||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),xa(this,e,t)),this},t.time=function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+La(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time},t.totalProgress=function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},t.progress=function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+La(this),t):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(e,t){var i=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*i,t):this._repeat?Ba(this._tTime,i)+1:1},t.timeScale=function(e,t){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===e)return this;var i=this.parent&&this._ts?Na(this.parent._time,this):this._tTime;return this._rts=+e||0,this._ts=this._ps||-1e-8===e?0:this._rts,this.totalTime(el(-Math.abs(this._delay),this.totalDuration(),i),!1!==t),Ga(this),function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e}(this)},t.paused=function(e){return arguments.length?(this._ps!==e&&(this._ps=e,e?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Sl(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ms&&(this._tTime-=Ms)))),this):this._ps},t.startTime=function(e){if(arguments.length){this._start=e;var t=this.parent||this._dp;return t&&(t._sort||!this.parent)&&Ha(t,this,e-this._delay),this}return this._start},t.endTime=function(e){return this._start+(Ls(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Na(t.rawTime(e),this):this._tTime:this._tTime},t.revert=function(e){void 0===e&&(e=ra);var t=ss;return ss=e,ba(this)&&(this.timeline&&this.timeline.revert(e),this.totalTime(-.01,e.suppressEvents)),"nested"!==this.data&&!1!==e.kill&&this.kill(),ss=t,this},t.globalTime=function(e){for(var t=this,i=arguments.length?e:t.rawTime();t;)i=t._start+i/(Math.abs(t._ts)||1),t=t._dp;return!this.parent&&this._sat?this._sat.globalTime(e):i},t.repeat=function(e){return arguments.length?(this._repeat=e===1/0?-2:e,Za(this)):-2===this._repeat?1/0:this._repeat},t.repeatDelay=function(e){if(arguments.length){var t=this._time;return this._rDelay=e,Za(this),t?this.time(t):this}return this._rDelay},t.yoyo=function(e){return arguments.length?(this._yoyo=e,this):this._yoyo},t.seek=function(e,t){return this.totalTime(Ja(this,e),Ls(t))},t.restart=function(e,t){return this.play().totalTime(e?-this._delay:0,Ls(t)),this._dur||(this._zTime=-1e-8),this},t.play=function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)},t.reverse=function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)},t.pause=function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-1e-8:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},t.isActive=function(){var e,t=this.parent||this._dp,i=this._start;return!(t&&!(this._ts&&this._initted&&t.isActive()&&(e=t.rawTime(!0))>=i&&e<this.endTime(!0)-Ms))},t.eventCallback=function(e,t,i){var n=this.vars;return arguments.length>1?(t?(n[e]=t,i&&(n[e+"Params"]=i),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]},t.then=function(e){var t=this;return new Promise(function(i){var n=zs(e)?e:Ma,r=function(){var e=t.then;t.then=null,zs(n)&&(n=n(t))&&(n.then||n===t)&&(t.then=e),i(n),t.then=e};t._initted&&1===t.totalProgress()&&t._ts>=0||!t._tTime&&t._ts<0?r():t._prom=r})},t.kill=function(){vl(this)},e}();Da(Hl.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var $l=function(e){function t(t,i){var n;return void 0===t&&(t={}),(n=e.call(this,t)||this).labels={},n.smoothChildTiming=!!t.smoothChildTiming,n.autoRemoveChildren=!!t.autoRemoveChildren,n._sort=Ls(t.sortChildren),ls&&Ha(t.parent||ls,ns(n),i),t.reversed&&n.reverse(),t.paused&&n.paused(!0),t.scrollTrigger&&$a(ns(n),t.scrollTrigger),n}rs(t,e);var i=t.prototype;return i.to=function(e,t,i){return Ka(0,arguments,this),this},i.from=function(e,t,i){return Ka(1,arguments,this),this},i.fromTo=function(e,t,i,n){return Ka(2,arguments,this),this},i.set=function(e,t,i){return t.duration=0,t.parent=this,Sa(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new tc(e,t,Ja(this,i),1),this},i.call=function(e,t,i){return Ha(this,tc.delayedCall(0,e,t),i)},i.staggerTo=function(e,t,i,n,r,o,s){return i.duration=t,i.stagger=i.stagger||n,i.onComplete=o,i.onCompleteParams=s,i.parent=this,new tc(e,i,Ja(this,r)),this},i.staggerFrom=function(e,t,i,n,r,o,s){return i.runBackwards=1,Sa(i).immediateRender=Ls(i.immediateRender),this.staggerTo(e,t,i,n,r,o,s)},i.staggerFromTo=function(e,t,i,n,r,o,s,a){return n.startAt=i,Sa(n).immediateRender=Ls(n.immediateRender),this.staggerTo(e,t,n,r,o,s,a)},i.render=function(e,t,i){var n,r,o,s,a,l,c,d,u,h,p,m,f=this._time,g=this._dirty?this.totalDuration():this._tDur,v=this._dur,y=e<=0?0:ya(e),_=this._zTime<0!=e<0&&(this._initted||!v);if(this!==ls&&y>g&&e>=0&&(y=g),y!==this._tTime||i||_){if(f!==this._time&&v&&(y+=this._time-f,e+=this._time-f),n=y,u=this._start,l=!(d=this._ts),_&&(v||(f=this._zTime),(e||!t)&&(this._zTime=e)),this._repeat){if(p=this._yoyo,a=v+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,i);if(n=ya(y%a),y===g?(s=this._repeat,n=v):((s=~~(h=ya(y/a)))&&s===h&&(n=v,s--),n>v&&(n=v)),h=Ba(this._tTime,a),!f&&this._tTime&&h!==s&&this._tTime-h*a-this._dur<=0&&(h=s),p&&1&s&&(n=v-n,m=1),s!==h&&!this._lock){var C=p&&1&h,w=C===(p&&1&s);if(s<h&&(C=!C),f=C?0:y%v?v:y,this._lock=1,this.render(f||(m?0:ya(s*a)),t,!v)._lock=0,this._tTime=y,!t&&this.parent&&gl(this,"onRepeat"),this.vars.repeatRefresh&&!m&&(this.invalidate()._lock=1),f&&f!==this._time||l!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(v=this._dur,g=this._tDur,w&&(this._lock=2,f=C?v:-1e-4,this.render(f,!0),this.vars.repeatRefresh&&!m&&this.invalidate()),this._lock=0,!this._ts&&!l)return this;kl(this,m)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(c=function(e,t,i){var n;if(i>t)for(n=e._first;n&&n._start<=i;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=i;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,ya(f),ya(n)),c&&(y-=n-(n=c._start))),this._tTime=y,this._time=n,this._act=!d,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,f=0),!f&&y&&!t&&!h&&(gl(this,"onStart"),this._tTime!==y))return this;if(n>=f&&e>=0)for(r=this._first;r;){if(o=r._next,(r._act||n>=r._start)&&r._ts&&c!==r){if(r.parent!==this)return this.render(e,t,i);if(r.render(r._ts>0?(n-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(n-r._start)*r._ts,t,i),n!==this._time||!this._ts&&!l){c=0,o&&(y+=this._zTime=-1e-8);break}}r=o}else{r=this._last;for(var b=e<0?e:n;r;){if(o=r._prev,(r._act||b<=r._end)&&r._ts&&c!==r){if(r.parent!==this)return this.render(e,t,i);if(r.render(r._ts>0?(b-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(b-r._start)*r._ts,t,i||ss&&ba(r)),n!==this._time||!this._ts&&!l){c=0,o&&(y+=this._zTime=b?-1e-8:Ms);break}}r=o}}if(c&&!t&&(this.pause(),c.render(n>=f?0:-1e-8)._zTime=n>=f?1:-1,this._ts))return this._start=u,Ga(this),this.render(e,t,i);this._onUpdate&&!t&&gl(this,"onUpdate",!0),(y===g&&this._tTime>=this.totalDuration()||!y&&f)&&(u!==this._start&&Math.abs(d)===Math.abs(this._ts)||this._lock||((e||!v)&&(y===g&&this._ts>0||!y&&this._ts<0)&&za(this,1),t||e<0&&!f||!y&&!f&&g||(gl(this,y===g&&e>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(y<g&&this.timeScale()>0)&&this._prom())))}return this},i.add=function(e,t){var i=this;if(Fs(t)||(t=Ja(this,t,e)),!(e instanceof Hl)){if(Us(e))return e.forEach(function(e){return i.add(e,t)}),this;if(Os(e))return this.addLabel(e,t);if(!zs(e))return this;e=tc.delayedCall(0,e)}return this!==e?Ha(this,e,t):this},i.getChildren=function(e,t,i,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===n&&(n=-1e8);for(var r=[],o=this._first;o;)o._start>=n&&(o instanceof tc?t&&r.push(o):(i&&r.push(o),e&&r.push.apply(r,o.getChildren(!0,t,i)))),o=o._next;return r},i.getById=function(e){for(var t=this.getChildren(1,1,1),i=t.length;i--;)if(t[i].vars.id===e)return t[i]},i.remove=function(e){return Os(e)?this.removeLabel(e):zs(e)?this.killTweensOf(e):(e.parent===this&&Oa(this,e),e===this._recent&&(this._recent=this._last),Fa(this))},i.totalTime=function(t,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ya(Al.time-(this._ts>0?t/this._ts:(this.totalDuration()-t)/-this._ts))),e.prototype.totalTime.call(this,t,i),this._forcing=0,this):this._tTime},i.addLabel=function(e,t){return this.labels[e]=Ja(this,t),this},i.removeLabel=function(e){return delete this.labels[e],this},i.addPause=function(e,t,i){var n=tc.delayedCall(0,t||ta,i);return n.data="isPause",this._hasPause=1,Ha(this,n,Ja(this,e))},i.removePause=function(e){var t=this._first;for(e=Ja(this,e);t;)t._start===e&&"isPause"===t.data&&za(t),t=t._next},i.killTweensOf=function(e,t,i){for(var n=this.getTweensOf(e,i),r=n.length;r--;)Wl!==n[r]&&n[r].kill(e,t);return this},i.getTweensOf=function(e,t){for(var i,n=[],r=ol(e),o=this._first,s=Fs(t);o;)o instanceof tc?Ca(o._targets,r)&&(s?(!Wl||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(i=o.getTweensOf(r,t)).length&&n.push.apply(n,i),o=o._next;return n},i.tweenTo=function(e,t){t=t||{};var i,n=this,r=Ja(n,e),o=t,s=o.startAt,a=o.onStart,l=o.onStartParams,c=o.immediateRender,d=tc.to(n,Da({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:t.duration||Math.abs((r-(s&&"time"in s?s.time:n._time))/n.timeScale())||Ms,onStart:function(){if(n.pause(),!i){var e=t.duration||Math.abs((r-(s&&"time"in s?s.time:n._time))/n.timeScale());d._dur!==e&&Ya(d,e,0,1).render(d._time,!0,!0),i=1}a&&a.apply(d,l||[])}},t));return c?d.render(0):d},i.tweenFromTo=function(e,t,i){return this.tweenTo(t,Da({startAt:{time:Ja(this,e)}},i))},i.recent=function(){return this._recent},i.nextLabel=function(e){return void 0===e&&(e=this._time),fl(this,Ja(this,e))},i.previousLabel=function(e){return void 0===e&&(e=this._time),fl(this,Ja(this,e),1)},i.currentLabel=function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ms)},i.shiftChildren=function(e,t,i){void 0===i&&(i=0);for(var n,r=this._first,o=this.labels;r;)r._start>=i&&(r._start+=e,r._end+=e),r=r._next;if(t)for(n in o)o[n]>=i&&(o[n]+=e);return Fa(this)},i.invalidate=function(t){var i=this._first;for(this._lock=0;i;)i.invalidate(t),i=i._next;return e.prototype.invalidate.call(this,t)},i.clear=function(e){void 0===e&&(e=!0);for(var t,i=this._first;i;)t=i._next,this.remove(i),i=t;return this._dp&&(this._time=this._tTime=this._pTime=0),e&&(this.labels={}),Fa(this)},i.totalDuration=function(e){var t,i,n,r=0,o=this,s=o._last,a=Ps;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(i=s._start)>a&&o._sort&&s._ts&&!o._lock?(o._lock=1,Ha(o,s,i-s._delay,1)._lock=0):a=i,i<0&&s._ts&&(r-=i,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=i/o._ts,o._time-=i,o._tTime-=i),o.shiftChildren(-i,!1,-1/0),a=0),s._end>r&&s._ts&&(r=s._end),s=t;Ya(o,o===ls&&o._time>r?o._time:r,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(e){if(ls._ts&&(xa(ls,Na(e,ls)),ps=Al.frame),Al.frame>=da){da+=bs.autoSleep||120;var t=ls._first;if((!t||!t._ts)&&bs.autoSleep&&Al._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Al.sleep()}}},t}(Hl);Da($l.prototype,{_lock:0,_hasPause:0,_forcing:0});var Wl,ql,jl=function(e,t,i,n,r,o,s){var a,l,c,d,u,h,p,m,f=new fc(this._pt,e,t,0,1,cc,null,r),g=0,v=0;for(f.b=i,f.e=n,i+="",(p=~(n+="").indexOf("random("))&&(n=pl(n)),o&&(o(m=[i,n],e,t),i=m[0],n=m[1]),l=i.match(Ws)||[];a=Ws.exec(n);)d=a[0],u=n.substring(g,a.index),c?c=(c+1)%5:"rgba("===u.substr(-5)&&(c=1),d!==l[v++]&&(h=parseFloat(l[v-1])||0,f._pt={_next:f._pt,p:u||1===v?u:",",s:h,c:"="===d.charAt(1)?_a(h,d)-h:parseFloat(d)-h,m:c&&c<4?Math.round:0},g=Ws.lastIndex);return f.c=g<n.length?n.substring(g,n.length):"",f.fp=s,(qs.test(n)||p)&&(f.e=0),this._pt=f,f},Yl=function(e,t,i,n,r,o,s,a,l,c){zs(n)&&(n=n(r||0,e,o));var d,u=e[t],h="get"!==i?i:zs(u)?l?e[t.indexOf("set")||!zs(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():u,p=zs(u)?l?rc:nc:ic;if(Os(n)&&(~n.indexOf("random(")&&(n=pl(n)),"="===n.charAt(1)&&((d=_a(h,n)+(tl(h)||0))||0===d)&&(n=d)),!c||h!==n||ql)return isNaN(h*n)||""===n?(!u&&!(t in e)&&Ks(t,n),jl.call(this,e,t,h,n,p,a||bs.stringFilter,l)):(d=new fc(this._pt,e,t,+h||0,n-(h||0),"boolean"==typeof u?lc:ac,0,p),l&&(d.fp=l),s&&d.modifier(s,this,e),this._pt=d)},Zl=function(e,t,i,n,r,o){var s,a,l,c;if(la[e]&&!1!==(s=new la[e]).init(r,s.rawVars?t[e]:function(e,t,i,n,r){if(zs(e)&&(e=Kl(e,r,t,i,n)),!ks(e)||e.style&&e.nodeType||Us(e)||Gs(e))return Os(e)?Kl(e,r,t,i,n):e;var o,s={};for(o in e)s[o]=Kl(e[o],r,t,i,n);return s}(t[e],n,r,o,i),i,n,o)&&(i._pt=a=new fc(i._pt,r,e,0,1,s.render,s,0,s.priority),i!==ms))for(l=i._ptLookup[i._targets.indexOf(r)],c=s._props.length;c--;)l[s._props[c]]=a;return s},Xl=function e(t,i,n){var r,o,s,a,l,c,d,u,h,p,m,f,g,v=t.vars,y=v.ease,_=v.startAt,C=v.immediateRender,w=v.lazy,b=v.onUpdate,x=v.runBackwards,P=v.yoyoEase,M=v.keyframes,D=v.autoRevert,T=t._dur,E=t._startAt,A=t._targets,S=t.parent,I=S&&"nested"===S.data?S.vars.targets:A,O="auto"===t._overwrite&&!os,z=t.timeline;if(z&&(!M||!y)&&(y="none"),t._ease=Ll(y,xs.ease),t._yEase=P?Rl(Ll(!0===P?y:P,xs.ease)):0,P&&t._yoyo&&!t._repeat&&(P=t._yEase,t._yEase=t._ease,t._ease=P),t._from=!z&&!!v.runBackwards,!z||M&&!v.stagger){if(f=(u=A[0]?ma(A[0]).harness:0)&&v[u.prop],r=Aa(v,oa),E&&(E._zTime<0&&E.progress(1),i<0&&x&&C&&!D?E.render(-1,!0):E.revert(x&&T?na:ia),E._lazy=0),_){if(za(t._startAt=tc.set(A,Da({data:"isStart",overwrite:!1,parent:S,immediateRender:!0,lazy:!E&&Ls(w),startAt:null,delay:0,onUpdate:b&&function(){return gl(t,"onUpdate")},stagger:0},_))),t._startAt._dp=0,t._startAt._sat=t,i<0&&(ss||!C&&!D)&&t._startAt.revert(na),C&&T&&i<=0&&n<=0)return void(i&&(t._zTime=i))}else if(x&&T&&!E)if(i&&(C=!1),s=Da({overwrite:!1,data:"isFromStart",lazy:C&&!E&&Ls(w),immediateRender:C,stagger:0,parent:S},r),f&&(s[u.prop]=f),za(t._startAt=tc.set(A,s)),t._startAt._dp=0,t._startAt._sat=t,i<0&&(ss?t._startAt.revert(na):t._startAt.render(-1,!0)),t._zTime=i,C){if(!i)return}else e(t._startAt,Ms,Ms);for(t._pt=t._ptCache=0,w=T&&Ls(w)||w&&!T,o=0;o<A.length;o++){if(d=(l=A[o])._gsap||pa(A)[o]._gsap,t._ptLookup[o]=p={},aa[d.id]&&sa.length&&wa(),m=I===A?o:I.indexOf(l),u&&!1!==(h=new u).init(l,f||r,t,m,I)&&(t._pt=a=new fc(t._pt,l,h.name,0,1,h.render,h,0,h.priority),h._props.forEach(function(e){p[e]=a}),h.priority&&(c=1)),!u||f)for(s in r)la[s]&&(h=Zl(s,r,t,m,l,I))?h.priority&&(c=1):p[s]=a=Yl.call(t,l,s,"get",r[s],m,I,0,v.stringFilter);t._op&&t._op[o]&&t.kill(l,t._op[o]),O&&t._pt&&(Wl=t,ls.killTweensOf(l,p,t.globalTime(i)),g=!t.parent,Wl=0),t._pt&&w&&(aa[d.id]=1)}c&&mc(t),t._onInit&&t._onInit(t)}t._onUpdate=b,t._initted=(!t._op||t._pt)&&!g,M&&i<=0&&z.render(Ps,!0,!0)},Jl=function(e,t,i,n){var r,o,s=t.ease||n||"power1.inOut";if(Us(t))o=i[e]||(i[e]=[]),t.forEach(function(e,i){return o.push({t:i/(t.length-1)*100,v:e,e:s})});else for(r in t)o=i[r]||(i[r]=[]),"ease"===r||o.push({t:parseFloat(e),v:t[r],e:s})},Kl=function(e,t,i,n,r){return zs(e)?e.call(t,i,n,r):Os(e)&&~e.indexOf("random(")?pl(e):e},Ql=ha+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",ec={};ga(Ql+",id,stagger,delay,duration,paused,scrollTrigger",function(e){return ec[e]=1});var tc=function(e){function t(t,i,n,r){var o;"number"==typeof i&&(n.duration=i,i=n,n=null);var s,a,l,c,d,u,h,p,m=(o=e.call(this,r?i:Sa(i))||this).vars,f=m.duration,g=m.delay,v=m.immediateRender,y=m.stagger,_=m.overwrite,C=m.keyframes,w=m.defaults,b=m.scrollTrigger,x=m.yoyoEase,P=i.parent||ls,M=(Us(t)||Gs(t)?Fs(t[0]):"length"in i)?[t]:ol(t);if(o._targets=M.length?pa(M):Qs("GSAP target "+t+" not found. https://gsap.com",!bs.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=_,C||y||Ns(f)||Ns(g)){if(i=o.vars,(s=o.timeline=new $l({data:"nested",defaults:w||{},targets:P&&"nested"===P.data?P.vars.targets:M})).kill(),s.parent=s._dp=ns(o),s._start=0,y||Ns(f)||Ns(g)){if(c=M.length,h=y&&ll(y),ks(y))for(d in y)~Ql.indexOf(d)&&(p||(p={}),p[d]=y[d]);for(a=0;a<c;a++)(l=Aa(i,ec)).stagger=0,x&&(l.yoyoEase=x),p&&Ta(l,p),u=M[a],l.duration=+Kl(f,ns(o),a,u,M),l.delay=(+Kl(g,ns(o),a,u,M)||0)-o._delay,!y&&1===c&&l.delay&&(o._delay=g=l.delay,o._start+=g,l.delay=0),s.to(u,l,h?h(a,u,M):0),s._ease=Il.none;s.duration()?f=g=0:o.timeline=0}else if(C){Sa(Da(s.vars.defaults,{ease:"none"})),s._ease=Ll(C.ease||i.ease||"none");var D,T,E,A=0;if(Us(C))C.forEach(function(e){return s.to(M,e,">")}),s.duration();else{for(d in l={},C)"ease"===d||"easeEach"===d||Jl(d,C[d],l,C.easeEach);for(d in l)for(D=l[d].sort(function(e,t){return e.t-t.t}),A=0,a=0;a<D.length;a++)(E={ease:(T=D[a]).e,duration:(T.t-(a?D[a-1].t:0))/100*f})[d]=T.v,s.to(M,E,A),A+=E.duration;s.duration()<f&&s.to({},{duration:f-s.duration()})}}f||o.duration(f=s.duration())}else o.timeline=0;return!0!==_||os||(Wl=ns(o),ls.killTweensOf(M),Wl=0),Ha(P,ns(o),n),i.reversed&&o.reverse(),i.paused&&o.paused(!0),(v||!f&&!C&&o._start===ya(P._time)&&Ls(v)&&ka(ns(o))&&"nested"!==P.data)&&(o._tTime=-1e-8,o.render(Math.max(0,-g)||0)),b&&$a(ns(o),b),o}rs(t,e);var i=t.prototype;return i.render=function(e,t,i){var n,r,o,s,a,l,c,d,u,h=this._time,p=this._tDur,m=this._dur,f=e<0,g=e>p-Ms&&!f?p:e<Ms?0:e;if(m){if(g!==this._tTime||!e||i||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==f||this._lazy){if(n=g,d=this.timeline,this._repeat){if(s=m+this._rDelay,this._repeat<-1&&f)return this.totalTime(100*s+e,t,i);if(n=ya(g%s),g===p?(o=this._repeat,n=m):(o=~~(a=ya(g/s)))&&o===a?(n=m,o--):n>m&&(n=m),(l=this._yoyo&&1&o)&&(u=this._yEase,n=m-n),a=Ba(this._tTime,s),n===h&&!i&&this._initted&&o===a)return this._tTime=g,this;o!==a&&(d&&this._yEase&&kl(d,l),this.vars.repeatRefresh&&!l&&!this._lock&&n!==s&&this._initted&&(this._lock=i=1,this.render(ya(s*o),!0).invalidate()._lock=0))}if(!this._initted){if(Wa(this,f?e:n,i,t,g))return this._tTime=0,this;if(!(h===this._time||i&&this.vars.repeatRefresh&&o!==a))return this;if(m!==this._dur)return this.render(e,t,i)}if(this._tTime=g,this._time=n,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=c=(u||this._ease)(n/m),this._from&&(this.ratio=c=1-c),!h&&g&&!t&&!a&&(gl(this,"onStart"),this._tTime!==g))return this;for(r=this._pt;r;)r.r(c,r.d),r=r._next;d&&d.render(e<0?e:d._dur*d._ease(n/this._dur),t,i)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(f&&Ra(this,e,0,i),gl(this,"onUpdate")),this._repeat&&o!==a&&this.vars.onRepeat&&!t&&this.parent&&gl(this,"onRepeat"),g!==this._tDur&&g||this._tTime!==g||(f&&!this._onUpdate&&Ra(this,e,0,!0),(e||!m)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&za(this,1),t||f&&!h||!(g||h||l)||(gl(this,g===p?"onComplete":"onReverseComplete",!0),this._prom&&!(g<p&&this.timeScale()>0)&&this._prom()))}}else!function(e,t,i,n){var r,o,s,a=e.ratio,l=t<0||!t&&(!e._start&&qa(e)&&(e._initted||!ja(e))||(e._ts<0||e._dp._ts<0)&&!ja(e))?0:1,c=e._rDelay,d=0;if(c&&e._repeat&&(d=el(0,e._tDur,t),o=Ba(d,c),e._yoyo&&1&o&&(l=1-l),o!==Ba(e._tTime,c)&&(a=1-l,e.vars.repeatRefresh&&e._initted&&e.invalidate())),l!==a||ss||n||e._zTime===Ms||!t&&e._zTime){if(!e._initted&&Wa(e,t,n,i,d))return;for(s=e._zTime,e._zTime=t||(i?Ms:0),i||(i=t&&!s),e.ratio=l,e._from&&(l=1-l),e._time=0,e._tTime=d,r=e._pt;r;)r.r(l,r.d),r=r._next;t<0&&Ra(e,t,0,!0),e._onUpdate&&!i&&gl(e,"onUpdate"),d&&e._repeat&&!i&&e.parent&&gl(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===l&&(l&&za(e,1),i||ss||(gl(e,l?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)}(this,e,t,i);return this},i.targets=function(){return this._targets},i.invalidate=function(t){return(!t||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),e.prototype.invalidate.call(this,t)},i.resetTo=function(e,t,i,n,r){fs||Al.wake(),this._ts||this.play();var o=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Xl(this,o),function(e,t,i,n,r,o,s,a){var l,c,d,u,h=(e._pt&&e._ptCache||(e._ptCache={}))[t];if(!h)for(h=e._ptCache[t]=[],d=e._ptLookup,u=e._targets.length;u--;){if((l=d[u][t])&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==t&&l.fp!==t;)l=l._next;if(!l)return ql=1,e.vars[t]="+=0",Xl(e,s),ql=0,a?Qs(t+" not eligible for reset"):1;h.push(l)}for(u=h.length;u--;)(l=(c=h[u])._pt||c).s=!n&&0!==n||r?l.s+(n||0)+o*l.c:n,l.c=i-l.s,c.e&&(c.e=va(i)+tl(c.e)),c.b&&(c.b=l.s+tl(c.b))}(this,e,t,i,n,this._ease(o/this._dur),o,r)?this.resetTo(e,t,i,n,1):(Ua(this,0),this.parent||Ia(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},i.kill=function(e,t){if(void 0===t&&(t="all"),!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?vl(this):this.scrollTrigger&&this.scrollTrigger.kill(!!ss),this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(e,t,Wl&&!0!==Wl.vars.overwrite)._first||vl(this),this.parent&&i!==this.timeline.totalDuration()&&Ya(this,this._dur*this.timeline._tDur/i,0,1),this}var n,r,o,s,a,l,c,d=this._targets,u=e?ol(e):d,h=this._ptLookup,p=this._pt;if((!t||"all"===t)&&function(e,t){for(var i=e.length,n=i===t.length;n&&i--&&e[i]===t[i];);return i<0}(d,u))return"all"===t&&(this._pt=0),vl(this);for(n=this._op=this._op||[],"all"!==t&&(Os(t)&&(a={},ga(t,function(e){return a[e]=1}),t=a),t=function(e,t){var i,n,r,o,s=e[0]?ma(e[0]).harness:0,a=s&&s.aliases;if(!a)return t;for(n in i=Ta({},t),a)if(n in i)for(r=(o=a[n].split(",")).length;r--;)i[o[r]]=i[n];return i}(d,t)),c=d.length;c--;)if(~u.indexOf(d[c]))for(a in r=h[c],"all"===t?(n[c]=t,s=r,o={}):(o=n[c]=n[c]||{},s=t),s)(l=r&&r[a])&&("kill"in l.d&&!0!==l.d.kill(a)||Oa(this,l,"_pt"),delete r[a]),"all"!==o&&(o[a]=1);return this._initted&&!this._pt&&p&&vl(this),this},t.to=function(e,i){return new t(e,i,arguments[2])},t.from=function(e,t){return Ka(1,arguments)},t.delayedCall=function(e,i,n,r){return new t(i,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:i,onReverseComplete:i,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:r})},t.fromTo=function(e,t,i){return Ka(2,arguments)},t.set=function(e,i){return i.duration=0,i.repeatDelay||(i.repeat=0),new t(e,i)},t.killTweensOf=function(e,t,i){return ls.killTweensOf(e,t,i)},t}(Hl);Da(tc.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ga("staggerTo,staggerFrom,staggerFromTo",function(e){tc[e]=function(){var t=new $l,i=il.call(arguments,0);return i.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,i)}});var ic=function(e,t,i){return e[t]=i},nc=function(e,t,i){return e[t](i)},rc=function(e,t,i,n){return e[t](n.fp,i)},oc=function(e,t,i){return e.setAttribute(t,i)},sc=function(e,t){return zs(e[t])?nc:Rs(e[t])&&e.setAttribute?oc:ic},ac=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},lc=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},cc=function(e,t){var i=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;i;)n=i.p+(i.m?i.m(i.s+i.c*e):Math.round(1e4*(i.s+i.c*e))/1e4)+n,i=i._next;n+=t.c}t.set(t.t,t.p,n,t)},dc=function(e,t){for(var i=t._pt;i;)i.r(e,i.d),i=i._next},uc=function(e,t,i,n){for(var r,o=this._pt;o;)r=o._next,o.p===n&&o.modifier(e,t,i),o=r},hc=function(e){for(var t,i,n=this._pt;n;)i=n._next,n.p===e&&!n.op||n.op===e?Oa(this,n,"_pt"):n.dep||(t=1),n=i;return!t},pc=function(e,t,i,n){n.mSet(e,t,n.m.call(n.tween,i,n.mt),n)},mc=function(e){for(var t,i,n,r,o=e._pt;o;){for(t=o._next,i=n;i&&i.pr>o.pr;)i=i._next;(o._prev=i?i._prev:r)?o._prev._next=o:n=o,(o._next=i)?i._prev=o:r=o,o=t}e._pt=n},fc=function(){function e(e,t,i,n,r,o,s,a,l){this.t=t,this.s=n,this.c=r,this.p=i,this.r=o||ac,this.d=s||this,this.set=a||ic,this.pr=l||0,this._next=e,e&&(e._prev=this)}return e.prototype.modifier=function(e,t,i){this.mSet=this.mSet||this.set,this.set=pc,this.m=e,this.mt=i,this.tween=t},e}();ga(ha+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(e){return oa[e]=1}),Zs.TweenMax=Zs.TweenLite=tc,Zs.TimelineLite=Zs.TimelineMax=$l,ls=new $l({sortChildren:!1,defaults:xs,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),bs.stringFilter=El;var gc=[],vc={},yc=[],_c=0,Cc=0,wc=function(e){return(vc[e]||yc).map(function(e){return e()})},bc=function(){var e=Date.now(),t=[];e-_c>2&&(wc("matchMediaInit"),gc.forEach(function(e){var i,n,r,o,s=e.queries,a=e.conditions;for(n in s)(i=cs.matchMedia(s[n]).matches)&&(r=1),i!==a[n]&&(a[n]=i,o=1);o&&(e.revert(),r&&t.push(e))}),wc("matchMediaRevert"),t.forEach(function(e){return e.onMatch(e,function(t){return e.add(null,t)})}),_c=e,wc("matchMedia"))},xc=function(){function e(e,t){this.selector=t&&sl(t),this.data=[],this._r=[],this.isReverted=!1,this.id=Cc++,e&&this.add(e)}var t=e.prototype;return t.add=function(e,t,i){zs(e)&&(i=t,t=e,e=zs);var n=this,r=function(){var e,r=as,o=n.selector;return r&&r!==n&&r.data.push(n),i&&(n.selector=sl(i)),as=n,e=t.apply(n,arguments),zs(e)&&n._r.push(e),as=r,n.selector=o,n.isReverted=!1,e};return n.last=r,e===zs?r(n,function(e){return n.add(null,e)}):e?n[e]=r:r},t.ignore=function(e){var t=as;as=null,e(this),as=t},t.getTweens=function(){var t=[];return this.data.forEach(function(i){return i instanceof e?t.push.apply(t,i.getTweens()):i instanceof tc&&!(i.parent&&"nested"===i.parent.data)&&t.push(i)}),t},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(e,t){var i=this;if(e?function(){for(var t,n=i.getTweens(),r=i.data.length;r--;)"isFlip"===(t=i.data[r]).data&&(t.revert(),t.getChildren(!0,!0,!1).forEach(function(e){return n.splice(n.indexOf(e),1)}));for(n.map(function(e){return{g:e._dur||e._delay||e._sat&&!e._sat.vars.immediateRender?e.globalTime(0):-1/0,t:e}}).sort(function(e,t){return t.g-e.g||-1/0}).forEach(function(t){return t.t.revert(e)}),r=i.data.length;r--;)(t=i.data[r])instanceof $l?"nested"!==t.data&&(t.scrollTrigger&&t.scrollTrigger.revert(),t.kill()):!(t instanceof tc)&&t.revert&&t.revert(e);i._r.forEach(function(t){return t(e,i)}),i.isReverted=!0}():this.data.forEach(function(e){return e.kill&&e.kill()}),this.clear(),t)for(var n=gc.length;n--;)gc[n].id===this.id&&gc.splice(n,1)},t.revert=function(e){this.kill(e||{})},e}(),Pc=function(){function e(e){this.contexts=[],this.scope=e,as&&as.data.push(this)}var t=e.prototype;return t.add=function(e,t,i){ks(e)||(e={matches:e});var n,r,o,s=new xc(0,i||this.scope),a=s.conditions={};for(r in as&&!s.selector&&(s.selector=as.selector),this.contexts.push(s),t=s.add("onMatch",t),s.queries=e,e)"all"===r?o=1:(n=cs.matchMedia(e[r]))&&(gc.indexOf(s)<0&&gc.push(s),(a[r]=n.matches)&&(o=1),n.addListener?n.addListener(bc):n.addEventListener("change",bc));return o&&t(s,function(e){return s.add(null,e)}),this},t.revert=function(e){this.kill(e||{})},t.kill=function(e){this.contexts.forEach(function(t){return t.kill(e,!0)})},e}(),Mc={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t.forEach(function(e){return _l(e)})},timeline:function(e){return new $l(e)},getTweensOf:function(e,t){return ls.getTweensOf(e,t)},getProperty:function(e,t,i,n){Os(e)&&(e=ol(e)[0]);var r=ma(e||{}).get,o=i?Ma:Pa;return"native"===i&&(i=""),e?t?o((la[t]&&la[t].get||r)(e,t,i,n)):function(t,i,n){return o((la[t]&&la[t].get||r)(e,t,i,n))}:e},quickSetter:function(e,t,i){if((e=ol(e)).length>1){var n=e.map(function(e){return Ec.quickSetter(e,t,i)}),r=n.length;return function(e){for(var t=r;t--;)n[t](e)}}e=e[0]||{};var o=la[t],s=ma(e),a=s.harness&&(s.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;ms._pt=0,n.init(e,i?t+i:t,ms,0,[e]),n.render(1,n),ms._pt&&dc(1,ms)}:s.set(e,a);return o?l:function(t){return l(e,a,i?t+i:t,s,1)}},quickTo:function(e,t,i){var n,r=Ec.to(e,Da(((n={})[t]="+=0.1",n.paused=!0,n.stagger=0,n),i||{})),o=function(e,i,n){return r.resetTo(t,e,i,n)};return o.tween=r,o},isTweening:function(e){return ls.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Ll(e.ease,xs.ease)),Ea(xs,e||{})},config:function(e){return Ea(bs,e||{})},registerEffect:function(e){var t=e.name,i=e.effect,n=e.plugins,r=e.defaults,o=e.extendTimeline;(n||"").split(",").forEach(function(e){return e&&!la[e]&&!Zs[e]&&Qs(t+" effect requires "+e+" plugin.")}),ca[t]=function(e,t,n){return i(ol(e),Da(t||{},r),n)},o&&($l.prototype[t]=function(e,i,n){return this.add(ca[t](e,ks(i)?i:(n=i)&&{},this),n)})},registerEase:function(e,t){Il[e]=Ll(t)},parseEase:function(e,t){return arguments.length?Ll(e,t):Il},getById:function(e){return ls.getById(e)},exportRoot:function(e,t){void 0===e&&(e={});var i,n,r=new $l(e);for(r.smoothChildTiming=Ls(e.smoothChildTiming),ls.remove(r),r._dp=0,r._time=r._tTime=ls._time,i=ls._first;i;)n=i._next,!t&&!i._dur&&i instanceof tc&&i.vars.onComplete===i._targets[0]||Ha(r,i,i._start-i._delay),i=n;return Ha(ls,r,0),r},context:function(e,t){return e?new xc(e,t):as},matchMedia:function(e){return new Pc(e)},matchMediaRefresh:function(){return gc.forEach(function(e){var t,i,n=e.conditions;for(i in n)n[i]&&(n[i]=!1,t=1);t&&e.revert()})||bc()},addEventListener:function(e,t){var i=vc[e]||(vc[e]=[]);~i.indexOf(t)||i.push(t)},removeEventListener:function(e,t){var i=vc[e],n=i&&i.indexOf(t);n>=0&&i.splice(n,1)},utils:{wrap:function e(t,i,n){var r=i-t;return Us(t)?hl(t,e(0,t.length),i):Qa(n,function(e){return(r+(e-t)%r)%r+t})},wrapYoyo:function e(t,i,n){var r=i-t,o=2*r;return Us(t)?hl(t,e(0,t.length-1),i):Qa(n,function(e){return t+((e=(o+(e-t)%o)%o||0)>r?o-e:e)})},distribute:ll,random:ul,snap:dl,normalize:function(e,t,i){return ml(e,t,0,1,i)},getUnit:tl,clamp:function(e,t,i){return Qa(i,function(i){return el(e,t,i)})},splitColor:xl,toArray:ol,selector:sl,mapRange:ml,pipe:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e){return t.reduce(function(e,t){return t(e)},e)}},unitize:function(e,t){return function(i){return e(parseFloat(i))+(t||tl(i))}},interpolate:function e(t,i,n,r){var o=isNaN(t+i)?0:function(e){return(1-e)*t+e*i};if(!o){var s,a,l,c,d,u=Os(t),h={};if(!0===n&&(r=1)&&(n=null),u)t={p:t},i={p:i};else if(Us(t)&&!Us(i)){for(l=[],c=t.length,d=c-2,a=1;a<c;a++)l.push(e(t[a-1],t[a]));c--,o=function(e){e*=c;var t=Math.min(d,~~e);return l[t](e-t)},n=i}else r||(t=Ta(Us(t)?[]:{},t));if(!l){for(s in i)Yl.call(h,t,s,"get",i[s]);o=function(e){return dc(e,h)||(u?t.p:t)}}}return Qa(n,o)},shuffle:al},install:Js,effects:ca,ticker:Al,updateRoot:$l.updateRoot,plugins:la,globalTimeline:ls,core:{PropTween:fc,globals:ea,Tween:tc,Timeline:$l,Animation:Hl,getCache:ma,_removeLinkedListItem:Oa,reverting:function(){return ss},context:function(e){return e&&as&&(as.data.push(e),e._ctx=as),as},suppressOverwrites:function(e){return os=e}}};ga("to,from,fromTo,delayedCall,set,killTweensOf",function(e){return Mc[e]=tc[e]}),Al.add($l.updateRoot),ms=Mc.to({},{duration:0});var Dc=function(e,t){for(var i=e._pt;i&&i.p!==t&&i.op!==t&&i.fp!==t;)i=i._next;return i},Tc=function(e,t){return{name:e,headless:1,rawVars:1,init:function(e,i,n){n._onInit=function(e){var n,r;if(Os(i)&&(n={},ga(i,function(e){return n[e]=1}),i=n),t){for(r in n={},i)n[r]=t(i[r]);i=n}!function(e,t){var i,n,r,o=e._targets;for(i in t)for(n=o.length;n--;)(r=e._ptLookup[n][i])&&(r=r.d)&&(r._pt&&(r=Dc(r,i)),r&&r.modifier&&r.modifier(t[i],e,o[n],i))}(e,i)}}}},Ec=Mc.registerPlugin({name:"attr",init:function(e,t,i,n,r){var o,s,a;for(o in this.tween=i,t)a=e.getAttribute(o)||"",(s=this.add(e,"setAttribute",(a||0)+"",t[o],n,r,0,0,o)).op=o,s.b=a,this._props.push(o)},render:function(e,t){for(var i=t._pt;i;)ss?i.set(i.t,i.p,i.b,i):i.r(e,i.d),i=i._next}},{name:"endArray",headless:1,init:function(e,t){for(var i=t.length;i--;)this.add(e,i,e[i]||0,t[i],0,0,0,0,0,1)}},Tc("roundProps",cl),Tc("modifiers"),Tc("snap",dl))||Mc;tc.version=$l.version=Ec.version="3.13.0",hs=1,Bs()&&Sl(),Il.Power0,Il.Power1,Il.Power2,Il.Power3,Il.Power4,Il.Linear,Il.Quad,Il.Cubic,Il.Quart,Il.Quint,Il.Strong,Il.Elastic,Il.Back,Il.SteppedEase,Il.Bounce,Il.Sine,Il.Expo,Il.Circ;
|
|
10
|
+
/*!
|
|
11
|
+
* CSSPlugin 3.13.0
|
|
12
|
+
* https://gsap.com
|
|
13
|
+
*
|
|
14
|
+
* Copyright 2008-2025, GreenSock. All rights reserved.
|
|
15
|
+
* Subject to the terms at https://gsap.com/standard-license
|
|
16
|
+
* @author: Jack Doyle, jack@greensock.com
|
|
17
|
+
*/
|
|
18
|
+
var Ac,Sc,Ic,Oc,zc,Fc,Rc,kc,Lc={},Bc=180/Math.PI,Nc=Math.PI/180,Gc=Math.atan2,Uc=/([A-Z])/g,Vc=/(left|right|width|margin|padding|x)/i,Hc=/[\s,\(]\S/,$c={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Wc=function(e,t){return t.set(t.t,t.p,Math.round(1e4*(t.s+t.c*e))/1e4+t.u,t)},qc=function(e,t){return t.set(t.t,t.p,1===e?t.e:Math.round(1e4*(t.s+t.c*e))/1e4+t.u,t)},jc=function(e,t){return t.set(t.t,t.p,e?Math.round(1e4*(t.s+t.c*e))/1e4+t.u:t.b,t)},Yc=function(e,t){var i=t.s+t.c*e;t.set(t.t,t.p,~~(i+(i<0?-.5:.5))+t.u,t)},Zc=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},Xc=function(e,t){return t.set(t.t,t.p,1!==e?t.b:t.e,t)},Jc=function(e,t,i){return e.style[t]=i},Kc=function(e,t,i){return e.style.setProperty(t,i)},Qc=function(e,t,i){return e._gsap[t]=i},ed=function(e,t,i){return e._gsap.scaleX=e._gsap.scaleY=i},td=function(e,t,i,n,r){var o=e._gsap;o.scaleX=o.scaleY=i,o.renderTransform(r,o)},id=function(e,t,i,n,r){var o=e._gsap;o[t]=i,o.renderTransform(r,o)},nd="transform",rd=nd+"Origin",od=function e(t,i){var n=this,r=this.target,o=r.style,s=r._gsap;if(t in Lc&&o){if(this.tfm=this.tfm||{},"transform"===t)return $c.transform.split(",").forEach(function(t){return e.call(n,t,i)});if(~(t=$c[t]||t).indexOf(",")?t.split(",").forEach(function(e){return n.tfm[e]=xd(r,e)}):this.tfm[t]=s.x?s[t]:xd(r,t),t===rd&&(this.tfm.zOrigin=s.zOrigin),this.props.indexOf(nd)>=0)return;s.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(rd,i,"")),t=nd}(o||i)&&this.props.push(t,i,o[t])},sd=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},ad=function(){var e,t,i=this.props,n=this.target,r=n.style,o=n._gsap;for(e=0;e<i.length;e+=3)i[e+1]?2===i[e+1]?n[i[e]](i[e+2]):n[i[e]]=i[e+2]:i[e+2]?r[i[e]]=i[e+2]:r.removeProperty("--"===i[e].substr(0,2)?i[e]:i[e].replace(Uc,"-$1").toLowerCase());if(this.tfm){for(t in this.tfm)o[t]=this.tfm[t];o.svg&&(o.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),(e=Rc())&&e.isStart||r[nd]||(sd(r),o.zOrigin&&r[rd]&&(r[rd]+=" "+o.zOrigin+"px",o.zOrigin=0,o.renderTransform()),o.uncache=1)}},ld=function(e,t){var i={target:e,props:[],revert:ad,save:od};return e._gsap||Ec.core.getCache(e),t&&e.style&&e.nodeType&&t.split(",").forEach(function(e){return i.save(e)}),i},cd=function(e,t){var i=Sc.createElementNS?Sc.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):Sc.createElement(e);return i&&i.style?i:Sc.createElement(e)},dd=function e(t,i,n){var r=getComputedStyle(t);return r[i]||r.getPropertyValue(i.replace(Uc,"-$1").toLowerCase())||r.getPropertyValue(i)||!n&&e(t,hd(i)||i,1)||""},ud="O,Moz,ms,Ms,Webkit".split(","),hd=function(e,t,i){var n=(t||zc).style,r=5;if(e in n&&!i)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);r--&&!(ud[r]+e in n););return r<0?null:(3===r?"ms":r>=0?ud[r]:"")+e},pd=function(){"undefined"!=typeof window&&window.document&&(Ac=window,Sc=Ac.document,Ic=Sc.documentElement,zc=cd("div")||{style:{}},cd("div"),nd=hd(nd),rd=nd+"Origin",zc.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",kc=!!hd("perspective"),Rc=Ec.core.reverting,Oc=1)},md=function(e){var t,i=e.ownerSVGElement,n=cd("svg",i&&i.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=e.cloneNode(!0);r.style.display="block",n.appendChild(r),Ic.appendChild(n);try{t=r.getBBox()}catch(e){}return n.removeChild(r),Ic.removeChild(n),t},fd=function(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])},gd=function(e){var t,i;try{t=e.getBBox()}catch(n){t=md(e),i=1}return t&&(t.width||t.height)||i||(t=md(e)),!t||t.width||t.x||t.y?t:{x:+fd(e,["x","cx","x1"])||0,y:+fd(e,["y","cy","y1"])||0,width:0,height:0}},vd=function(e){return!(!e.getCTM||e.parentNode&&!e.ownerSVGElement||!gd(e))},yd=function(e,t){if(t){var i,n=e.style;t in Lc&&t!==rd&&(t=nd),n.removeProperty?("ms"!==(i=t.substr(0,2))&&"webkit"!==t.substr(0,6)||(t="-"+t),n.removeProperty("--"===i?t:t.replace(Uc,"-$1").toLowerCase())):n.removeAttribute(t)}},_d=function(e,t,i,n,r,o){var s=new fc(e._pt,t,i,0,1,o?Xc:Zc);return e._pt=s,s.b=n,s.e=r,e._props.push(i),s},Cd={deg:1,rad:1,turn:1},wd={grid:1,flex:1},bd=function e(t,i,n,r){var o,s,a,l,c=parseFloat(n)||0,d=(n+"").trim().substr((c+"").length)||"px",u=zc.style,h=Vc.test(i),p="svg"===t.tagName.toLowerCase(),m=(p?"client":"offset")+(h?"Width":"Height"),f=100,g="px"===r,v="%"===r;if(r===d||!c||Cd[r]||Cd[d])return c;if("px"!==d&&!g&&(c=e(t,i,n,"px")),l=t.getCTM&&vd(t),(v||"%"===d)&&(Lc[i]||~i.indexOf("adius")))return o=l?t.getBBox()[h?"width":"height"]:t[m],va(v?c/o*f:c/100*o);if(u[h?"width":"height"]=f+(g?d:r),s="rem"!==r&&~i.indexOf("adius")||"em"===r&&t.appendChild&&!p?t:t.parentNode,l&&(s=(t.ownerSVGElement||{}).parentNode),s&&s!==Sc&&s.appendChild||(s=Sc.body),(a=s._gsap)&&v&&a.width&&h&&a.time===Al.time&&!a.uncache)return va(c/a.width*f);if(!v||"height"!==i&&"width"!==i)(v||"%"===d)&&!wd[dd(s,"display")]&&(u.position=dd(t,"position")),s===t&&(u.position="static"),s.appendChild(zc),o=zc[m],s.removeChild(zc),u.position="absolute";else{var y=t.style[i];t.style[i]=f+r,o=t[m],y?t.style[i]=y:yd(t,i)}return h&&v&&((a=ma(s)).time=Al.time,a.width=s[m]),va(g?o*c/f:o&&c?f/o*c:0)},xd=function(e,t,i,n){var r;return Oc||pd(),t in $c&&"transform"!==t&&~(t=$c[t]).indexOf(",")&&(t=t.split(",")[0]),Lc[t]&&"transform"!==t?(r=Rd(e,n),r="transformOrigin"!==t?r[t]:r.svg?r.origin:kd(dd(e,rd))+" "+r.zOrigin+"px"):(!(r=e.style[t])||"auto"===r||n||~(r+"").indexOf("calc("))&&(r=Ed[t]&&Ed[t](e,t,i)||dd(e,t)||fa(e,t)||("opacity"===t?1:0)),i&&!~(r+"").trim().indexOf(" ")?bd(e,t,r,i)+i:r},Pd=function(e,t,i,n){if(!i||"none"===i){var r=hd(t,e,1),o=r&&dd(e,r,1);o&&o!==i?(t=r,i=o):"borderColor"===t&&(i=dd(e,"borderTopColor"))}var s,a,l,c,d,u,h,p,m,f,g,v=new fc(this._pt,e.style,t,0,1,cc),y=0,_=0;if(v.b=i,v.e=n,i+="","var(--"===(n+="").substring(0,6)&&(n=dd(e,n.substring(4,n.indexOf(")")))),"auto"===n&&(u=e.style[t],e.style[t]=n,n=dd(e,t)||n,u?e.style[t]=u:yd(e,t)),El(s=[i,n]),n=s[1],l=(i=s[0]).match($s)||[],(n.match($s)||[]).length){for(;a=$s.exec(n);)h=a[0],m=n.substring(y,a.index),d?d=(d+1)%5:"rgba("!==m.substr(-5)&&"hsla("!==m.substr(-5)||(d=1),h!==(u=l[_++]||"")&&(c=parseFloat(u)||0,g=u.substr((c+"").length),"="===h.charAt(1)&&(h=_a(c,h)+g),p=parseFloat(h),f=h.substr((p+"").length),y=$s.lastIndex-f.length,f||(f=f||bs.units[t]||g,y===n.length&&(n+=f,v.e+=f)),g!==f&&(c=bd(e,t,u,f)||0),v._pt={_next:v._pt,p:m||1===_?m:",",s:c,c:p-c,m:d&&d<4||"zIndex"===t?Math.round:0});v.c=y<n.length?n.substring(y,n.length):""}else v.r="display"===t&&"none"===n?Xc:Zc;return qs.test(n)&&(v.e=0),this._pt=v,v},Md={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Dd=function(e){var t=e.split(" "),i=t[0],n=t[1]||"50%";return"top"!==i&&"bottom"!==i&&"left"!==n&&"right"!==n||(e=i,i=n,n=e),t[0]=Md[i]||i,t[1]=Md[n]||n,t.join(" ")},Td=function(e,t){if(t.tween&&t.tween._time===t.tween._dur){var i,n,r,o=t.t,s=o.style,a=t.u,l=o._gsap;if("all"===a||!0===a)s.cssText="",n=1;else for(r=(a=a.split(",")).length;--r>-1;)i=a[r],Lc[i]&&(n=1,i="transformOrigin"===i?rd:nd),yd(o,i);n&&(yd(o,nd),l&&(l.svg&&o.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",Rd(o,1),l.uncache=1,sd(s)))}},Ed={clearProps:function(e,t,i,n,r){if("isFromStart"!==r.data){var o=e._pt=new fc(e._pt,t,i,0,0,Td);return o.u=n,o.pr=-10,o.tween=r,e._props.push(i),1}}},Ad=[1,0,0,1,0,0],Sd={},Id=function(e){return"matrix(1, 0, 0, 1, 0, 0)"===e||"none"===e||!e},Od=function(e){var t=dd(e,nd);return Id(t)?Ad:t.substr(7).match(Hs).map(va)},zd=function(e,t){var i,n,r,o,s=e._gsap||ma(e),a=e.style,l=Od(e);return s.svg&&e.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(r=e.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?Ad:l:(l!==Ad||e.offsetParent||e===Ic||s.svg||(r=a.display,a.display="block",(i=e.parentNode)&&(e.offsetParent||e.getBoundingClientRect().width)||(o=1,n=e.nextElementSibling,Ic.appendChild(e)),l=Od(e),r?a.display=r:yd(e,"display"),o&&(n?i.insertBefore(e,n):i?i.appendChild(e):Ic.removeChild(e))),t&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},Fd=function(e,t,i,n,r,o){var s,a,l,c=e._gsap,d=r||zd(e,!0),u=c.xOrigin||0,h=c.yOrigin||0,p=c.xOffset||0,m=c.yOffset||0,f=d[0],g=d[1],v=d[2],y=d[3],_=d[4],C=d[5],w=t.split(" "),b=parseFloat(w[0])||0,x=parseFloat(w[1])||0;i?d!==Ad&&(a=f*y-g*v)&&(l=b*(-g/a)+x*(f/a)-(f*C-g*_)/a,b=b*(y/a)+x*(-v/a)+(v*C-y*_)/a,x=l):(b=(s=gd(e)).x+(~w[0].indexOf("%")?b/100*s.width:b),x=s.y+(~(w[1]||w[0]).indexOf("%")?x/100*s.height:x)),n||!1!==n&&c.smooth?(_=b-u,C=x-h,c.xOffset=p+(_*f+C*v)-_,c.yOffset=m+(_*g+C*y)-C):c.xOffset=c.yOffset=0,c.xOrigin=b,c.yOrigin=x,c.smooth=!!n,c.origin=t,c.originIsAbsolute=!!i,e.style[rd]="0px 0px",o&&(_d(o,c,"xOrigin",u,b),_d(o,c,"yOrigin",h,x),_d(o,c,"xOffset",p,c.xOffset),_d(o,c,"yOffset",m,c.yOffset)),e.setAttribute("data-svg-origin",b+" "+x)},Rd=function(e,t){var i=e._gsap||new Vl(e);if("x"in i&&!t&&!i.uncache)return i;var n,r,o,s,a,l,c,d,u,h,p,m,f,g,v,y,_,C,w,b,x,P,M,D,T,E,A,S,I,O,z,F,R=e.style,k=i.scaleX<0,L="px",B="deg",N=getComputedStyle(e),G=dd(e,rd)||"0";return n=r=o=l=c=d=u=h=p=0,s=a=1,i.svg=!(!e.getCTM||!vd(e)),N.translate&&("none"===N.translate&&"none"===N.scale&&"none"===N.rotate||(R[nd]=("none"!==N.translate?"translate3d("+(N.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==N.rotate?"rotate("+N.rotate+") ":"")+("none"!==N.scale?"scale("+N.scale.split(" ").join(",")+") ":"")+("none"!==N[nd]?N[nd]:"")),R.scale=R.rotate=R.translate="none"),g=zd(e,i.svg),i.svg&&(i.uncache?(T=e.getBBox(),G=i.xOrigin-T.x+"px "+(i.yOrigin-T.y)+"px",D=""):D=!t&&e.getAttribute("data-svg-origin"),Fd(e,D||G,!!D||i.originIsAbsolute,!1!==i.smooth,g)),m=i.xOrigin||0,f=i.yOrigin||0,g!==Ad&&(C=g[0],w=g[1],b=g[2],x=g[3],n=P=g[4],r=M=g[5],6===g.length?(s=Math.sqrt(C*C+w*w),a=Math.sqrt(x*x+b*b),l=C||w?Gc(w,C)*Bc:0,(u=b||x?Gc(b,x)*Bc+l:0)&&(a*=Math.abs(Math.cos(u*Nc))),i.svg&&(n-=m-(m*C+f*b),r-=f-(m*w+f*x))):(F=g[6],O=g[7],A=g[8],S=g[9],I=g[10],z=g[11],n=g[12],r=g[13],o=g[14],c=(v=Gc(F,I))*Bc,v&&(D=P*(y=Math.cos(-v))+A*(_=Math.sin(-v)),T=M*y+S*_,E=F*y+I*_,A=P*-_+A*y,S=M*-_+S*y,I=F*-_+I*y,z=O*-_+z*y,P=D,M=T,F=E),d=(v=Gc(-b,I))*Bc,v&&(y=Math.cos(-v),z=x*(_=Math.sin(-v))+z*y,C=D=C*y-A*_,w=T=w*y-S*_,b=E=b*y-I*_),l=(v=Gc(w,C))*Bc,v&&(D=C*(y=Math.cos(v))+w*(_=Math.sin(v)),T=P*y+M*_,w=w*y-C*_,M=M*y-P*_,C=D,P=T),c&&Math.abs(c)+Math.abs(l)>359.9&&(c=l=0,d=180-d),s=va(Math.sqrt(C*C+w*w+b*b)),a=va(Math.sqrt(M*M+F*F)),v=Gc(P,M),u=Math.abs(v)>2e-4?v*Bc:0,p=z?1/(z<0?-z:z):0),i.svg&&(D=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!Id(dd(e,nd)),D&&e.setAttribute("transform",D))),Math.abs(u)>90&&Math.abs(u)<270&&(k?(s*=-1,u+=l<=0?180:-180,l+=l<=0?180:-180):(a*=-1,u+=u<=0?180:-180)),t=t||i.uncache,i.x=n-((i.xPercent=n&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-n)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+L,i.y=r-((i.yPercent=r&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-r)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+L,i.z=o+L,i.scaleX=va(s),i.scaleY=va(a),i.rotation=va(l)+B,i.rotationX=va(c)+B,i.rotationY=va(d)+B,i.skewX=u+B,i.skewY=h+B,i.transformPerspective=p+L,(i.zOrigin=parseFloat(G.split(" ")[2])||!t&&i.zOrigin||0)&&(R[rd]=kd(G)),i.xOffset=i.yOffset=0,i.force3D=bs.force3D,i.renderTransform=i.svg?Hd:kc?Vd:Bd,i.uncache=0,i},kd=function(e){return(e=e.split(" "))[0]+" "+e[1]},Ld=function(e,t,i){var n=tl(t);return va(parseFloat(t)+parseFloat(bd(e,"x",i+"px",n)))+n},Bd=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,Vd(e,t)},Nd="0deg",Gd="0px",Ud=") ",Vd=function(e,t){var i=t||this,n=i.xPercent,r=i.yPercent,o=i.x,s=i.y,a=i.z,l=i.rotation,c=i.rotationY,d=i.rotationX,u=i.skewX,h=i.skewY,p=i.scaleX,m=i.scaleY,f=i.transformPerspective,g=i.force3D,v=i.target,y=i.zOrigin,_="",C="auto"===g&&e&&1!==e||!0===g;if(y&&(d!==Nd||c!==Nd)){var w,b=parseFloat(c)*Nc,x=Math.sin(b),P=Math.cos(b);b=parseFloat(d)*Nc,w=Math.cos(b),o=Ld(v,o,x*w*-y),s=Ld(v,s,-Math.sin(b)*-y),a=Ld(v,a,P*w*-y+y)}f!==Gd&&(_+="perspective("+f+Ud),(n||r)&&(_+="translate("+n+"%, "+r+"%) "),(C||o!==Gd||s!==Gd||a!==Gd)&&(_+=a!==Gd||C?"translate3d("+o+", "+s+", "+a+") ":"translate("+o+", "+s+Ud),l!==Nd&&(_+="rotate("+l+Ud),c!==Nd&&(_+="rotateY("+c+Ud),d!==Nd&&(_+="rotateX("+d+Ud),u===Nd&&h===Nd||(_+="skew("+u+", "+h+Ud),1===p&&1===m||(_+="scale("+p+", "+m+Ud),v.style[nd]=_||"translate(0, 0)"},Hd=function(e,t){var i,n,r,o,s,a=t||this,l=a.xPercent,c=a.yPercent,d=a.x,u=a.y,h=a.rotation,p=a.skewX,m=a.skewY,f=a.scaleX,g=a.scaleY,v=a.target,y=a.xOrigin,_=a.yOrigin,C=a.xOffset,w=a.yOffset,b=a.forceCSS,x=parseFloat(d),P=parseFloat(u);h=parseFloat(h),p=parseFloat(p),(m=parseFloat(m))&&(p+=m=parseFloat(m),h+=m),h||p?(h*=Nc,p*=Nc,i=Math.cos(h)*f,n=Math.sin(h)*f,r=Math.sin(h-p)*-g,o=Math.cos(h-p)*g,p&&(m*=Nc,s=Math.tan(p-m),r*=s=Math.sqrt(1+s*s),o*=s,m&&(s=Math.tan(m),i*=s=Math.sqrt(1+s*s),n*=s)),i=va(i),n=va(n),r=va(r),o=va(o)):(i=f,o=g,n=r=0),(x&&!~(d+"").indexOf("px")||P&&!~(u+"").indexOf("px"))&&(x=bd(v,"x",d,"px"),P=bd(v,"y",u,"px")),(y||_||C||w)&&(x=va(x+y-(y*i+_*r)+C),P=va(P+_-(y*n+_*o)+w)),(l||c)&&(s=v.getBBox(),x=va(x+l/100*s.width),P=va(P+c/100*s.height)),s="matrix("+i+","+n+","+r+","+o+","+x+","+P+")",v.setAttribute("transform",s),b&&(v.style[nd]=s)},$d=function(e,t,i,n,r){var o,s,a=360,l=Os(r),c=parseFloat(r)*(l&&~r.indexOf("rad")?Bc:1)-n,d=n+c+"deg";return l&&("short"===(o=r.split("_")[1])&&(c%=a)!==c%180&&(c+=c<0?a:-360),"cw"===o&&c<0?c=(c+36e9)%a-~~(c/a)*a:"ccw"===o&&c>0&&(c=(c-36e9)%a-~~(c/a)*a)),e._pt=s=new fc(e._pt,t,i,n,c,qc),s.e=d,s.u="deg",e._props.push(i),s},Wd=function(e,t){for(var i in t)e[i]=t[i];return e},qd=function(e,t,i){var n,r,o,s,a,l,c,d=Wd({},i._gsap),u=i.style;for(r in d.svg?(o=i.getAttribute("transform"),i.setAttribute("transform",""),u[nd]=t,n=Rd(i,1),yd(i,nd),i.setAttribute("transform",o)):(o=getComputedStyle(i)[nd],u[nd]=t,n=Rd(i,1),u[nd]=o),Lc)(o=d[r])!==(s=n[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(a=tl(o)!==(c=tl(s))?bd(i,r,o,c):parseFloat(o),l=parseFloat(s),e._pt=new fc(e._pt,n,r,a,l-a,Wc),e._pt.u=c||0,e._props.push(r));Wd(n,d)};ga("padding,margin,Width,Radius",function(e,t){var i="Top",n="Right",r="Bottom",o="Left",s=(t<3?[i,n,r,o]:[i+o,i+n,r+n,r+o]).map(function(i){return t<2?e+i:"border"+i+e});Ed[t>1?"border"+e:e]=function(e,t,i,n,r){var o,a;if(arguments.length<4)return o=s.map(function(t){return xd(e,t,i)}),5===(a=o.join(" ")).split(o[0]).length?o[0]:a;o=(n+"").split(" "),a={},s.forEach(function(e,t){return a[e]=o[t]=o[t]||o[(t-1)/2|0]}),e.init(t,a,r)}});var jd,Yd,Zd,Xd={name:"css",register:pd,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,n,r){var o,s,a,l,c,d,u,h,p,m,f,g,v,y,_,C,w=this._props,b=e.style,x=i.vars.startAt;for(u in Oc||pd(),this.styles=this.styles||ld(e),C=this.styles.props,this.tween=i,t)if("autoRound"!==u&&(s=t[u],!la[u]||!Zl(u,t,i,n,e,r)))if(c=typeof s,d=Ed[u],"function"===c&&(c=typeof(s=s.call(i,n,e,r))),"string"===c&&~s.indexOf("random(")&&(s=pl(s)),d)d(this,e,u,s,i)&&(_=1);else if("--"===u.substr(0,2))o=(getComputedStyle(e).getPropertyValue(u)+"").trim(),s+="",Dl.lastIndex=0,Dl.test(o)||(h=tl(o),p=tl(s)),p?h!==p&&(o=bd(e,u,o,p)+p):h&&(s+=h),this.add(b,"setProperty",o,s,n,r,0,0,u),w.push(u),C.push(u,0,b[u]);else if("undefined"!==c){if(x&&u in x?(o="function"==typeof x[u]?x[u].call(i,n,e,r):x[u],Os(o)&&~o.indexOf("random(")&&(o=pl(o)),tl(o+"")||"auto"===o||(o+=bs.units[u]||tl(xd(e,u))||""),"="===(o+"").charAt(1)&&(o=xd(e,u))):o=xd(e,u),l=parseFloat(o),(m="string"===c&&"="===s.charAt(1)&&s.substr(0,2))&&(s=s.substr(2)),a=parseFloat(s),u in $c&&("autoAlpha"===u&&(1===l&&"hidden"===xd(e,"visibility")&&a&&(l=0),C.push("visibility",0,b.visibility),_d(this,b,"visibility",l?"inherit":"hidden",a?"inherit":"hidden",!a)),"scale"!==u&&"transform"!==u&&~(u=$c[u]).indexOf(",")&&(u=u.split(",")[0])),f=u in Lc)if(this.styles.save(u),"string"===c&&"var(--"===s.substring(0,6)&&(s=dd(e,s.substring(4,s.indexOf(")"))),a=parseFloat(s)),g||((v=e._gsap).renderTransform&&!t.parseTransform||Rd(e,t.parseTransform),y=!1!==t.smoothOrigin&&v.smooth,(g=this._pt=new fc(this._pt,b,nd,0,1,v.renderTransform,v,0,-1)).dep=1),"scale"===u)this._pt=new fc(this._pt,v,"scaleY",v.scaleY,(m?_a(v.scaleY,m+a):a)-v.scaleY||0,Wc),this._pt.u=0,w.push("scaleY",u),u+="X";else{if("transformOrigin"===u){C.push(rd,0,b[rd]),s=Dd(s),v.svg?Fd(e,s,0,y,0,this):((p=parseFloat(s.split(" ")[2])||0)!==v.zOrigin&&_d(this,v,"zOrigin",v.zOrigin,p),_d(this,b,u,kd(o),kd(s)));continue}if("svgOrigin"===u){Fd(e,s,1,y,0,this);continue}if(u in Sd){$d(this,v,u,l,m?_a(l,m+s):s);continue}if("smoothOrigin"===u){_d(this,v,"smooth",v.smooth,s);continue}if("force3D"===u){v[u]=s;continue}if("transform"===u){qd(this,s,e);continue}}else u in b||(u=hd(u)||u);if(f||(a||0===a)&&(l||0===l)&&!Hc.test(s)&&u in b)a||(a=0),(h=(o+"").substr((l+"").length))!==(p=tl(s)||(u in bs.units?bs.units[u]:h))&&(l=bd(e,u,o,p)),this._pt=new fc(this._pt,f?v:b,u,l,(m?_a(l,m+a):a)-l,f||"px"!==p&&"zIndex"!==u||!1===t.autoRound?Wc:Yc),this._pt.u=p||0,h!==p&&"%"!==p&&(this._pt.b=o,this._pt.r=jc);else if(u in b)Pd.call(this,e,u,o,m?m+s:s);else if(u in e)this.add(e,u,o||e[u],m?m+s:s,n,r);else if("parseTransform"!==u){Ks(u,s);continue}f||(u in b?C.push(u,0,b[u]):"function"==typeof e[u]?C.push(u,2,e[u]()):C.push(u,1,o||e[u])),w.push(u)}_&&mc(this)},render:function(e,t){if(t.tween._time||!Rc())for(var i=t._pt;i;)i.r(e,i.d),i=i._next;else t.styles.revert()},get:xd,aliases:$c,getSetter:function(e,t,i){var n=$c[t];return n&&n.indexOf(",")<0&&(t=n),t in Lc&&t!==rd&&(e._gsap.x||xd(e,"x"))?i&&Fc===i?"scale"===t?ed:Qc:(Fc=i||{})&&("scale"===t?td:id):e.style&&!Rs(e.style[t])?Jc:~t.indexOf("-")?Kc:sc(e,t)},core:{_removeProperty:yd,_getMatrix:zd}};Ec.utils.checkPrefix=hd,Ec.core.getStyleSaver=ld,Zd=ga((jd="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Yd="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(e){Lc[e]=1}),ga(Yd,function(e){bs.units[e]="deg",Sd[e]=1}),$c[Zd[13]]=jd+","+Yd,ga("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(e){var t=e.split(":");$c[t[1]]=Zd[t[0]]}),ga("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(e){bs.units[e]="px"}),Ec.registerPlugin(Xd);var Jd=Ec.registerPlugin(Xd)||Ec;Jd.core.Tween;const Kd=t=>{const i=[];t.scene.logarithmicDepthBuffer=!1;const n=t=>{const{tiles:i,fromHeight:n,toHeight:r}=t;return new Promise(o=>{const s=[];console.log(i),i.forEach((i,n)=>{const o=e.Cartesian3.fromElements(0,0,r*(n+1),new e.Cartesian3),a=e.Matrix4.fromTranslation(o),l=e.BoundingSphere.clone(t.originBoundingSpheres[n]),c=e.BoundingSphere.transform(l,a);s.push(c)});const a=i[0].tileset;s.push(a.boundingSphere),a._newBoundingSphere=e.BoundingSphere.fromBoundingSpheres(s);const l={value:r},c={value:n};Jd.to(c,{...l,duration:2,delay:.5,onUpdate:()=>{i.forEach((t,i)=>{const n=c.value*(i+1),r=e.Cartesian3.fromElements(0,0,n,new e.Cartesian3),o=e.Matrix4.fromTranslation(r);t.transform=o})},onComplete:()=>{}}),o(!0)})},r=()=>{i.forEach(e=>{e.fromHeight=e.toHeight,e.toHeight=0,n(e),e.tiles[0].tileset._newBoundingSphere=void 0}),i.length=0};return{set:async t=>{const{tiles:r,height:o}=t,s=r.map(t=>e.BoundingSphere.clone(t.boundingSphere)),a={id:N(),tiles:r,originBoundingSpheres:s,fromHeight:0,toHeight:o};return r.length&&o?(await n(a),i.push(a),a):a},changeHeight:async(e,t)=>{e.fromHeight=e.toHeight,e.toHeight=t,e.toHeight!==e.fromHeight&&await n(e)},remove:async e=>{const t=i.findIndex(t=>t.id===e.id);-1!==t&&(e.fromHeight=e.toHeight,e.toHeight=0,await n(e),e.tiles[0].tileset._newBoundingSphere=void 0,i.splice(t,1))},removeAll:r,destroy:()=>{r()}}},Qd=t=>{const i=[];let n;const r=()=>{i.length=0};return{set:async n=>{const{tileSetLoader:r}=n,o=r.getFeatures();let s=r.tileset.root.children;o.length||(s=[s[0]]);const a={id:N(),tiles:s,results:[]};if(!s.length||!n.positions.length)return a;n.distance||(n.distance=10);const l=n.positions,c=Ze(l),d=Math.floor(c/n.distance),u=rt(l,d),h=[];let p=0,m=null;t.terrainProvider instanceof e.EllipsoidTerrainProvider||(m=t.terrainProvider,t.terrainProvider=new e.EllipsoidTerrainProvider);const f=s.map(e=>e._tileId);for(const i of s){r.setVisibleByTileId(f,!1),n.progress&&n.progress(p,i),await U(1e3),r.setVisibleByTileId([i._tileId],!0);let o=JSON.parse(JSON.stringify(u));o=await t.scene.clampToHeightMostDetailed(o);let s=0;const a=o.map((t,i)=>{const n=e.Cartographic.fromCartesian(t);return i>0&&(s+=Ye(o[i-1],t)),{height:n.height,distance:s,positionIndex:i,position:t,allDistance:c}});p+=1,h.push({datas:a,name:i._tileId,index:p})}return a.results=h,i.push(a),m&&(t.terrainProvider=m),a},changeTipPoint:i=>{if(!i)return n&&t.entities.remove(n),void(n=void 0);n||(n=t.entities.add({position:i.position,billboard:{image:"/earth/images/marker-2d.png",scale:.5,verticalOrigin:e.VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),n.position=i.position},remove:e=>{const t=i.findIndex(t=>t.id===e.id);-1!==t&&i.splice(t,1)},removeAll:r,destroy:()=>{r()}}},eu=t=>{const i=[],n=async r=>{if(!r.tileset)return(async i=>{const r=t.scene.primitives._primitives.filter(t=>t instanceof e.Cesium3DTileset),o=[];for(const e of r){const t=await n({positions:i.positions,inverse:i.inverse,tileset:e});o.push(t)}return o})(r);const o=r.positions,s=new e.ClippingPolygon({positions:o});r.tileset.clippingPolygons?r.tileset.clippingPolygons.add(s):r.tileset.clippingPolygons=new e.ClippingPolygonCollection({polygons:[s],inverse:r.inverse});const a={id:N(),tileset:r.tileset,clipPolygon:s};return i.push(a),a},r=e=>{e?e.clippingPolygons.removeAll():(i.forEach(e=>{e.tileset.clippingPolygons.removeAll()}),i.length=0)},o=(t,i)=>{i?i.tileset.clippingPolygons&&(i.tileset.clippingPolygons=new e.ClippingPolygonCollection({polygons:i.tileset.clippingPolygons._polygons,inverse:t})):s(t)},s=e=>{i.forEach(t=>{o(e,t)})};return{set:n,remove:e=>{e.clipPolygon&&e.tileset.clippingPolygons.remove(e.clipPolygon)},setInverse:o,setInverseAll:s,removeAll:r,destroy:()=>{r()}}},tu=t=>{const i=new e.PrimitiveCollection({destroyPrimitives:!1});let n,r="/icons/markers/mark-icon.png";const o=[];t.scene.primitives.add(i);const s=i=>{if(!i)return n&&t.entities.remove(n),void(n=void 0);n||(n=t.entities.add({position:m(new e.Cartographic(i.longitude,i.latitude,i.height)),billboard:{image:r,scale:.5,verticalOrigin:e.VerticalOrigin.BOTTOM,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}})),n.position=m(new e.Cartographic(i.longitude,i.latitude,i.height))};return{set:async e=>{e.tipMarkerUrl&&(r=e.tipMarkerUrl);const{positions:i}=e;let n=Ze(i);const s=Math.floor(n/e.pointDistance);let a=rt(i,s);a=await t.scene.clampToHeightMostDetailed(a),n=0;const l=a.map((e,t)=>{let i=0;t>0&&(i=Ye(a[t-1],e),n+=i);return{...h(e),distance:i,allDistance:n}}),c={id:N(),datas:l};return o.push(c),c},remove:e=>{const t=o.findIndex(t=>t.id===e.id);-1!==t&&o.splice(t,1),s()},removeAll:()=>{i.removeAll(),s()},destroy:()=>{t.scene.primitives.remove(i)},changeTipPoint:s}};export{at as BaseMaterialProperty,st as BasePrimitive,Dr as CircleApertureMaterialProperty,Zo as CircleAperturePrimitive,br as CircleRaderFanMaterialProperty,yr as CircleRaderWaveMaterialProperty,mr as CircleWaveMaterialProperty,t as Common,ni as CoordinateTransformer,l as DefaultViewerOptions,Ui as Draw,Gi as DrawEventType,Hi as DrawStyle,kr as EllipsoidElectricMaterialProperty,$r as EllipsoidHScanMaterialProperty,Gr as EllipsoidVScanMaterialProperty,Ft as FlyAttitude,Xo as GridPrimitives,xo as GroundPolygonPrimitives,wo as GroundPolylinePrimitives,Or as LightWallMaterialProperty,nr as Material,zo as PointClusterPrimitives,fo as PointPrimitives,dr as PolylineFlowMaterialProperty,sr as PolylineTrailMaterialProperty,H as Popup,Jr as RadereScanPrimitive,Rt as RoamStatus,V as Tooltip,gi as TransformsFor3dtiles,Yr as ZapsMaterialProperty,Vn as addDrawActions,Je as calcArea,ot as calcBoundingSphereFromPositions,nt as calcCameraHeightFromZoom,Ye as calcGeodesicDistance,Ze as calcGeodesicDistances,rt as calcLerpPosition,Xe as calcPoistionCenter,et as calcSceneHeightFromPositions,qe as calcSpaceDistance,je as calcSpaceDistances,Qe as calcTerrainHeightFromPositions,Ke as calcTriangleArea,it as calcZoomFromCameraHeight,tt as clacPositionsForParabola,Si as createBloomTargetStage,Nt as createBottomStatusBar,Tr as createCircleApertureMaterial,xr as createCircleRaderFanMaterial,fr as createCircleWaveMaterial,Jo as createDivLabelHandler,ir as createDrawHandler,Li as createDroneAnimCustomShader,X as createEagleEye,Lr as createEllipsoidElectricMaterial,Wr as createEllipsoidHScanMaterial,Ur as createEllipsoidVScanMaterial,Ko as createFillVolumeHandler,Ai as createFogStage,is as createGroundClipHandler,Ei as createHeightFogStage,xi as createHighLightStage,Fi as createLightBandCustomShader,zr as createLightWallMaterial,zi as createLightningStage,Ut as createOpenAnim,Ni as createOutLineEffect,Mi as createOutlineStage,ur as createPoylineFlowMaterial,tu as createProfileAnalysis,_r as createRaderWaveMaterial,Oi as createRainCoverStage,Ii as createRainStage,zt as createRoamHandler,J as createRollerShutterHandler,Ar as createScanRadarMaterial,It as createSkyBox,Ot as createSkyBoxOnGround,Pi as createSkylineStage,Di as createSnowCoverStage,Ti as createSnowStage,K as createSplitScreenHandler,Kd as createTilesExplodeHandler,Qd as createTilesProfileHandler,eu as createTilesetClipHandler,ar as createTrailMaterial,Zr as createZapsMaterial,U as delayTime,z as flyByRotateOut,O as flyByRotatePoint,P as flyToCameraView,T as flyToCesium3DTile,M as flyToDataSource,E as flyToFromSphere,D as flyToImagery,w as flyToLnglat,S as flyToNorth,b as flyToPosition,A as flyToRectangleBounds,pi as getAllFeaturesFrom3dTiles,mi as getAllTilesFrom3dTiles,x as getCameraView,a as getCesiumForAutoFitScale,si as getFeaturesFromTileContent,ai as getFeaturesFromTileFeature,G as getInoCesiumBaseUrl,I as getScreenCenterPoint,n as initCesium,k as initCesiumEvent,ui as load3dTiles,bi as loadI3s,Ci as loadModel,vi as loadTerrain,_i as loadTerrainFromCesium,li as loadTianDiTu,wi as loads3m,$t as makeGridFromElevationExtrema,Vt as makeGridToInstanceForBox,Ht as makeGridToInstanceForLine,m as makeLnglatToPosition,v as makeLnglatsToLineGeojson,g as makeLnglatsToPointGeojson,y as makeLnglatsToPolygonGeojson,p as makeLnglatsToPositions,f as makePositionsClose,d as makePositionsForAntiClockwise,c as makePositionsForClockwise,u as makePositionsToLnglats,h as makePositiontoLnglat,_ as makeYawPitchRollToHeadingPitchRoll,Wt as mekeGridPolygonAndHeight,N as numberId,oi as pickPoint,q as randomColor,$ as randomPointToGeoJson,Y as randomPolygonToGeoJson,j as randomPolylineToGeoJson,yi as removeTerrain,R as setCameraAutoBackTiltToZero,s as setCesiumForAutoFitScale,r as setGlobeEnabled,o as setGlobeOpatity,hi as setHeightOffsetFor3dTiles,ci as setImageLayerTheme,C as setViewToLnglat,F as twinkleModel};
|