/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{JSONMap as e}from"../../../core/jsonMap.js";import{getMetersPerUnitForSR as t}from"../../../core/units.js";import{geographicToWebMercator as r}from"../../../geometry/support/webMercatorUtils.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as i,ConstantElevation as o,ElevationSource as s}from"./ElevationSourceDefinitions.js";function l(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function a(e,t,r){let{url:n}=e;return n?(n=l(n,t,r),new s({...e,url:n})):null}function c(e,t,r){return e?i(e)?new o(e):a(e,t,r):e}const u=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),f=new e({Feet:"feet",Meter:"meter"}),p=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),h=new Map;function m(e){const[t,r,n,i,o,s,l,a,c,u,f,p,h,m,g,y,v,w,D,z,I,W]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...d([c,u,f,p,h,m],[y,v],[w,D,z],[I,W],g)}}h.set("1",y),h.set("3",v),h.set("2",m),h.set("4",w);const g=e=>{const t=e.map(e=>parseFloat(e)).filter(e=>!isNaN(e));if(t.length===e.length)return t};function d(e,t,r,n,i){const o=g(e),s=g(t),l=g(r),a=g(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function y(e){const[t,r,n,i,o,s,l,a,c,u,f,p,h,m,g,y,v,w,D,z,I,W]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...d([c,u,f,p,h,m],[y,v],[w,D,z],[I,W],g)}}function v(e){const[t,r,n,i,o,s,l,a,c,u,f,p,h,m,g,y,v,w,D,z,I,W]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...d([c,u,f,p,h,m],[y,v],[w,D,z],[I,W],g)}}function w(e){const[t,r,i,o,s,...l]=e.slice(1),a=h.get(s),c=n.get(s)?.constructor;if(!a||!c)return null;return{latitude:t,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new c(a([s,"",...l]))}}function D(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const r=n.get(t[0]);if(!r)return null;const i=h.get(t[0]);if(!i)return null;return new(0,r.constructor)(i(t))}function z(e){return Array.isArray(e)&&e?.length>5&&!e.some(isNaN)}function I(e){for(e=e.slice(0,8);e.length<8;)e.push(0);return e}function W(e){return e.spatialReference.isGeographic?r(e):e.clone()}function j(e){return e.isGeographic?1:t(e)}function K(e){const t=e.match(/^(.*)\/rest\/services\/(.*)$/);return t?t[1]:null}export{l as appendPrefixAndSuffix,W as convertGeographicToWebMercator,D as createCameraOrientation,K as getArcGISServerUrl,c as getEffectiveElevationSource,j as getMetersPerUnitOfSR,z as isOrientationAccuracy,p as orientedImageryTypeMap,I as padAccuracyArray,a as processElevationSource,u as timeIntervalUnitTypeMap,h as transformersRegistry,f as verticalMeasurementTypeMap};
