import{t as l,iw as I,e2 as C,ju as c,_ as t,$ as i,a7 as w,gr as O,a0 as f,a1 as P,ix as H,a as n,ct as m,df as Z,R as E,cG as L,cF as F,b4 as b,k as R,jv as k,dX as G,jw as M,jx as X,eC as B,eE as D,cu as J}from"./index.6c049565.js";import{c as K}from"./Analysis.d5074123.js";import{g as h}from"./persistable.1b6e46c5.js";import"./multiOriginJSONSupportUtils.38b69b9c.js";function S(e,s){return j(e)===j(s)}function j(e){if(l(e))return null;const s=e.layer!=null?e.layer.id:"";let r=null;return r=e.objectId!=null?e.objectId:e.layer!=null&&"objectIdField"in e.layer&&e.layer.objectIdField!=null&&e.attributes!=null?e.attributes[e.layer.objectIdField]:e.uid,r==null?null:`o-${s}-${r}`}const z={json:{write:{writer:Q,target:{"feature.layerId":{type:[Number,String]},"feature.objectId":{type:[Number,String]}}},origins:{"web-scene":{read:U}}}};function Q(e,s){var r;l(e)||((r=e.layer)==null?void 0:r.objectIdField)==null||e.attributes==null||(s.feature={layerId:e.layer.id,objectId:e.attributes[e.layer.objectIdField]})}function U(e){if(e.layerId!=null&&e.objectId!=null)return{uid:null,layer:{id:e.layerId,objectIdField:"ObjectId"},attributes:{ObjectId:e.objectId}}}let u=class extends I(C(P)){constructor(e){super(e),this.position=null,this.elevationInfo=null,this.feature=null}equals(e){return c(this.position,e.position)&&c(this.elevationInfo,e.elevationInfo)&&S(this.feature,e.feature)}};t([i({type:w}),h()],u.prototype,"position",void 0),t([i({type:O}),h()],u.prototype,"elevationInfo",void 0),t([i(z)],u.prototype,"feature",void 0),u=t([f("esri.analysis.LineOfSightAnalysisObserver")],u);const _=u;let p=class extends I(H){constructor(e){super(e),this.position=null,this.elevationInfo=null,this.feature=null}equals(e){return c(this.position,e.position)&&c(this.elevationInfo,e.elevationInfo)&&S(this.feature,e.feature)}};t([i({type:w}),h()],p.prototype,"position",void 0),t([i({type:O}),h()],p.prototype,"elevationInfo",void 0),t([i(z)],p.prototype,"feature",void 0),p=t([f("esri.analysis.LineOfSightAnalysisTarget")],p);const A=p;function V(e){return e?ee:te}function W(e,s){return l(s)||!s.mode?V(e).mode:s.mode}function Y(e,s){return W(!!n(e)&&e.hasZ,s)}const ee={mode:"absolute-height",offset:0},te={mode:"on-the-ground",offset:null},v=m.ofType(A);let a=class extends K{constructor(e){super(e),this.type="line-of-sight",this.observer=null,this.extent=null}initialize(){this.addHandles(E(()=>this._computeExtent(),e=>{(l(e)||l(e.pending))&&this._set("extent",n(e)?e.extent:null)},L))}get targets(){return this._get("targets")||new v}set targets(e){this._set("targets",F(e,this.targets,v))}get spatialReference(){return n(this.observer)&&n(this.observer.position)?this.observer.position.spatialReference:null}get requiredPropertiesForEditing(){return[b(this.observer,e=>e.position)]}async waitComputeExtent(){const e=this._computeExtent();return n(e)?R(e.pending):null}_computeExtent(){const e=this.spatialReference;if(l(this.observer)||l(this.observer.position)||l(e))return null;const s=y=>Y(y.position,y.elevationInfo)==="absolute-height",r=this.observer.position,$=k(r.x,r.y,r.z,r.x,r.y,r.z);for(const y of this.targets)if(n(y.position)){const d=G(y.position,e);if(n(d.pending))return{pending:d.pending,extent:null};if(n(d.geometry)){const{x:T,y:q,z:N}=d.geometry;M($,[T,q,N])}}const g=X($,e);return s(this.observer)&&this.targets.every(s)||(g.zmin=null,g.zmax=null),{pending:null,extent:g}}clear(){this.observer=null,this.targets.removeAll()}};t([i({type:["line-of-sight"]})],a.prototype,"type",void 0),t([i({type:_,json:{read:!0,write:!0}})],a.prototype,"observer",void 0),t([i({cast:Z,type:v,nonNullable:!0,json:{read:!0,write:!0}})],a.prototype,"targets",null),t([i({value:null,readOnly:!0})],a.prototype,"extent",void 0),t([i({readOnly:!0})],a.prototype,"spatialReference",null),t([i({readOnly:!0})],a.prototype,"requiredPropertiesForEditing",null),a=t([f("esri.analysis.LineOfSightAnalysis")],a);const x=a,se=m.ofType(A);let o=class extends B(D(J)){constructor(e){super(e),this.type="line-of-sight",this.operationalLayerType="LineOfSightLayer",this.analysis=new x,this.opacity=1}initialize(){this.addHandles(E(()=>this.analysis,(e,s)=>{n(s)&&s.parent===this&&(s.parent=null),n(e)&&(e.parent=this)},L))}async load(){return n(this.analysis)&&this.addResolvingPromise(this.analysis.waitComputeExtent()),this}get observer(){return b(this.analysis,e=>e.observer)}set observer(e){b(this.analysis,s=>s.observer=e)}get targets(){return n(this.analysis)?this.analysis.targets:new m}set targets(e){var s;F(e,(s=this.analysis)==null?void 0:s.targets)}get fullExtent(){return n(this.analysis)?this.analysis.extent:null}get spatialReference(){return n(this.analysis)?R(this.analysis.spatialReference):null}releaseAnalysis(e){this.analysis===e&&(this.analysis=new x)}};t([i({json:{read:!1},readOnly:!0})],o.prototype,"type",void 0),t([i({type:["LineOfSightLayer"]})],o.prototype,"operationalLayerType",void 0),t([i({type:_,json:{read:!0,write:{ignoreOrigin:!0}}})],o.prototype,"observer",null),t([i({type:se,json:{read:!0,write:{ignoreOrigin:!0}}})],o.prototype,"targets",null),t([i({nonNullable:!0,json:{read:!1,write:!1}})],o.prototype,"analysis",void 0),t([i({readOnly:!0})],o.prototype,"fullExtent",null),t([i({readOnly:!0})],o.prototype,"spatialReference",null),t([i({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],o.prototype,"opacity",void 0),t([i({type:["show","hide"]})],o.prototype,"listMode",void 0),o=t([f("esri.layers.LineOfSightLayer")],o);const ae=o;export{ae as default};