@caojinyu111/vue-bim-viewer 0.3.2 → 0.3.3

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/index.cjs CHANGED
@@ -1,4 +1,25 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dist-DSgZUDDY.cjs");let t=require("vue"),n=require("three"),r=require("three/addons/loaders/GLTFLoader.js"),i=require("three/addons/controls/OrbitControls.js"),a=require("three/addons/postprocessing/EffectComposer.js"),o=require("three/addons/postprocessing/OutlinePass.js"),s=require("three/addons/postprocessing/OutputPass.js"),c=require("three/addons/postprocessing/RenderPass.js");function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){let t=2166136261,n=2246822507;for(let r of e){for(let e of[0,8,16,24]){let i=r.length>>>e&255;t=Math.imul(t^i,16777619),n=Math.imul(n^i,3266489909)}for(let e of r)t=Math.imul(t^e,16777619),n=Math.imul(n^e,3266489909)}return`resource-${(t>>>0).toString(16).padStart(8,`0`)}${(n>>>0).toString(16).padStart(8,`0`)}`}function d(e){let t=new Set,r=new Set,i=new Set,a=new Set;e.traverse(e=>{if(e instanceof n.Mesh){t.add(e.geometry);for(let t of Array.isArray(e.material)?e.material:[e.material]){r.add(t);for(let e of Object.values(t))e instanceof n.Texture&&i.add(e)}}}),t.forEach(e=>e.dispose()),r.forEach(e=>e.dispose()),i.forEach(e=>{let t=e.source.data;for(let e of Array.isArray(t)?t:[t])typeof ImageBitmap<`u`&&e instanceof ImageBitmap&&a.add(e);e.dispose()}),a.forEach(e=>e.close()),e.removeFromParent()}async function f(e,t){let n=await fetch(e,{signal:t,cache:`no-store`});if(!n.ok)throw Error(`资源读取失败(HTTP ${n.status}):${e}`);if(n.headers.get(`content-type`)?.includes(`text/html`))throw Error(`资源返回了 HTML:${e}`);return new Uint8Array(await n.arrayBuffer())}function p(e){return JSON.parse(new TextDecoder().decode(e))}function m(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length>=20&&t.getUint32(0,!0)===1179937895){let n=t.getUint32(12,!0);return p(e.subarray(20,20+n))}let n=p(e);if(!l(n))throw Error(`glTF 根节点无效`);return n}async function h(e,t,i){let a=new URL(e.manifestUrl,globalThis.location?.href).href;if(!/^https?:/.test(a))throw Error(`Manifest 必须是 HTTP/HTTPS 地址`);i(`正在读取模型清单`);let o=await f(a,t),s=p(o);if(!l(s)||s.version!==`1.0.0`||typeof s.entry!=`string`)throw Error(`Manifest 格式无效或版本不支持`);let c=new URL(s.entry,a).href;if(!/\.(glb|gltf)$/i.test(new URL(c).pathname))throw Error(`本版支持 GLB 和 glTF 模型`);let h=[],g=async e=>{let n=s[e];if(typeof n!=`string`)return new Uint8Array;try{let r=await f(new URL(n,a).href,t),i=p(r);if(e===`properties`&&!l(i))throw Error(`properties 必须是按构件名称索引的对象`);if(e===`hierarchy`){let e=Array.isArray(i)?i:l(i)?i.root:null;if(!Array.isArray(e))throw Error(`hierarchy 必须提供 root 数组或根节点数组`);let t=[...e];for(;t.length;){let e=t.pop();if(!l(e)||e.name!==void 0&&typeof e.name!=`string`||e.children!==void 0&&!Array.isArray(e.children))throw Error(`hierarchy 节点格式无效`);Array.isArray(e.children)&&t.push(...e.children)}}return r}catch(n){return t.throwIfAborted(),h.push(`${e} 未能读取,已继续加载模型:${n instanceof Error?n.message:String(n)}`),new Uint8Array}};i(`正在下载模型和属性`);let[_,v,y]=await Promise.all([f(c,t),g(`hierarchy`),g(`properties`)]);t.throwIfAborted();let b=m(_),x=[o,_,v,y],S=[],C=new n.LoadingManager;C.onError=e=>h.push(`贴图加载失败:${e.startsWith(`blob:`)?`内嵌贴图`:e}`);let w;try{let e=[...Array.isArray(b.buffers)?b.buffers:[],...Array.isArray(b.images)?b.images:[]].filter(e=>l(e)&&typeof e.uri==`string`&&!/^(data:|blob:)/i.test(e.uri)),o=new Map,m=new Map,g=await Promise.all(e.map(async e=>{let n=new URL(String(e.uri),c).href;return m.has(n)||m.set(n,f(n,t)),{url:n,bytes:await m.get(n),mime:typeof e.mimeType==`string`?e.mimeType:/\.png(?:[?#]|$)/i.test(n)?`image/png`:/\.jpe?g(?:[?#]|$)/i.test(n)?`image/jpeg`:`application/octet-stream`}}));t.throwIfAborted();for(let e of g){if(x.push(e.bytes),o.has(e.url))continue;let t=URL.createObjectURL(new Blob([e.bytes],{type:e.mime}));S.push(t),o.set(e.url,t)}C.setURLModifier(e=>/^(data:|blob:)/i.test(e)?e:o.get(new URL(e,c).href)??e),i(`正在解析模型`),w=await new r.GLTFLoader(C).parseAsync(_.buffer,new URL(`./`,c).href),t.throwIfAborted();let T=w.scene,E=new n.Group;E.name=`viewer-display-wrapper`,E.add(T),E.updateMatrixWorld(!0);let D=new n.Box3().setFromObject(T,!0);if(D.isEmpty()||![...D.min.toArray(),...D.max.toArray()].every(Number.isFinite))throw Error(`模型没有有效几何`);let O=D.getCenter(new n.Vector3).negate();E.position.copy(O),E.updateMatrixWorld(!0);let k=0,A=0;T.traverse(e=>{e instanceof n.Mesh&&(k++,A+=(e.geometry.index?.count??e.geometry.getAttribute(`position`)?.count??0)/3)});let j=v.length?p(v):{},ee=Array.isArray(j)?j:l(j)&&Array.isArray(j.root)?j.root:[],te=y.length?p(y):{},M=new Map;for(let[e,t]of w.parser.associations)`isObject3D`in e&&M.set(e,t);let N=!1;return{root:E,scene:T,offset:O,associations:M,sourceNames:Array.isArray(b.nodes)?b.nodes.map(e=>l(e)&&typeof e.name==`string`?e.name:``):[],metadata:{hierarchy:ee.filter(l),properties:l(te)?te:{}},modelId:typeof s.modelId==`string`?s.modelId:a,revision:u(x),manifestUrl:a,label:typeof s.label==`string`?s.label:`BIM 模型`,stats:{meshes:k,triangles:Math.round(A),bytes:_.byteLength},warnings:h,dispose(){N||(N=!0,d(E))}}}catch(e){throw w&&d(w.scene),e}finally{S.forEach(e=>URL.revokeObjectURL(e))}}var g=e=>({x:e.x,y:e.y,z:e.z});function _(e){let t=[],n=[...e?.roots||[]].reverse();for(;n.length;){let e=n.pop();t.push(e);for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}return t}function v(e){let t=new Map,n=_(e);for(let e of n)t.set(e,{...e,bounds:e.bounds?structuredClone(e.bounds):null,metadata:structuredClone(e.metadata),children:[]});for(let e of n)t.get(e).children=e.children.map(e=>t.get(e));return{...e,roots:e.roots.map(e=>t.get(e))}}function y(e){return v({schemaVersion:1,modelId:``,revision:``,roots:[e]}).roots[0]}function b(e,t){let r=t.offset||new n.Vector3,i=[],a=[],o=[...e].reverse();for(;o.length;){let e=o.pop();a.push(e);for(let t=e.children.length-1;t>=0;t--)o.push(e.children[t])}let s=new Map,c=new Map,u=[...t.metadata?.hierarchy||[]].reverse();for(;u.length;){let e=u.pop();e.name&&s.set(e.name,[...s.get(e.name)||[],e]);let t=e.componentId??e.uuid;t!==void 0&&c.set(String(t),[...c.get(String(t))||[],e]),u.push(...(e.children||[]).slice().reverse())}let d=e=>{let n=t.associations?.get(e)?.nodes;return n===void 0?e.name:t.sourceNames?.[n]||e.name},f=new Map;a.forEach(e=>f.set(d(e),(f.get(d(e))||0)+1));let p=new Map,m=new Map,h=new Map,_=new Map;for(let e=a.length-1;e>=0;e--){let t=a[e],r=new n.Box3;t instanceof n.InstancedMesh?(t.computeBoundingBox(),t.boundingBox&&r.copy(t.boundingBox).applyMatrix4(t.matrixWorld)):t instanceof n.Mesh&&(t.geometry.boundingBox||t.geometry.computeBoundingBox(),t.geometry.boundingBox&&r.copy(t.geometry.boundingBox).applyMatrix4(t.matrixWorld)),t.children.forEach(e=>{let t=_.get(e);t&&r.union(t)}),_.set(t,r)}for(let[e,o]of a.entries()){let a=d(o),u=s.get(a)||[],v=[`componentId`,`externalId`,`elementId`,`uuid`].map(e=>o.userData[e]).find(e=>typeof e==`string`&&e.trim().length>0||typeof e==`number`&&Number.isFinite(e)),y=v===void 0?[]:c.get(String(v))||[],b=y.length===1?y[0]:u.length===1&&f.get(a)===1?u[0]:void 0;u.length&&!b&&v===void 0&&i.push(`名称重复,未按名称映射:${a}`);let x=t.associations?.get(o)?.nodes,S=`${t.revision}:node:${x??`scene-${e}`}`,C=String(v??b?.componentId??b?.uuid??S);if(p.has(C)){i.push(`构件 ID 重复 ${C},当前节点改用版本内 ID`),C=S;let e=1;for(;p.has(C);)C=`${S}:${e++}`}let w=f.get(a)===1?t.metadata?.properties[a]:void 0,T=_.get(o),E=T.isEmpty()?null:{min:g(T.min.clone().sub(r)),max:g(T.max.clone().sub(r)),center:g(T.getCenter(new n.Vector3).sub(r))},D={id:C,name:a||o.type,type:o.type,parentId:null,children:[],hasGeometry:o instanceof n.Mesh,bounds:E,metadata:{...structuredClone(o.userData),...l(w)?structuredClone(w):{},...b?{sourceHierarchy:{name:b.name,uuid:b.uuid,componentId:b.componentId}}:{},sourceNodeIndex:x??null}};p.set(C,D),m.set(o,C),h.set(C,o)}for(let e of a){let t=p.get(m.get(e)),n=e.parent&&m.get(e.parent);n&&(t.parentId=n,p.get(n).children.push(t))}return{tree:{schemaVersion:1,modelId:t.modelId,revision:t.revision,roots:e.map(e=>p.get(m.get(e)))},byId:p,byObject:m,renderObjects:h,warnings:i,getAnchor:(e,t=`origin`)=>{let i=h.get(e),a=p.get(e);return!i||!a?null:t===`origin`?g(i.getWorldPosition(new n.Vector3).sub(r)):!a.bounds||![`center`,`bounds-top`].includes(t)?null:{...a.bounds.center,y:t===`bounds-top`?a.bounds.max.y:a.bounds.center.y}}}}function x(e){let t=v(e.tree);for(let e of _(t))e.metadata={sourceNodeIndex:e.metadata.sourceNodeIndex};return t}var S=[`visible`,`opacity`,`color`],C=()=>({changedIds:[],unknownIds:[],skipped:[]});function w(e,t=()=>{}){let r=_(e.tree),i=new Map,a=new Map,o=new Map,s=new Map;for(let t of r){let r=e.renderObjects.get(t.id);a.set(t.id,{visible:r.visible&&t.metadata.visible!==!1,opacity:1,color:null}),r instanceof n.Mesh&&s.set(r,r.material)}function c(){return{schemaVersion:1,modelId:e.tree.modelId,revision:e.tree.revision,overrides:[...i].map(([e,t])=>({id:e,original:Object.fromEntries(S.filter(e=>e in t).map(t=>[t,a.get(e)[t]])),current:{...t}}))}}function u(){for(let t of r){let r=a.get(t.id),c=i.get(t.id)||{},l=t.parentId?o.get(t.parentId):void 0,u={visible:(l?.visible??!0)&&(c.visible??r.visible),opacity:(l?.opacity??1)*(c.opacity??r.opacity),color:c.color??l?.color??null};o.set(t.id,u);let f=e.renderObjects.get(t.id);if(f.visible=u.visible,!(f instanceof n.Mesh))continue;let p=s.get(f);if(u.opacity===1&&u.color===null){f.material=p;continue}let m=(Array.isArray(p)?p:[p]).map(e=>{let r=`${t.id}:${e.uuid}`,i=d.get(r);return i||(i=e.clone(),d.set(r,i)),i.opacity=e.opacity*u.opacity,i.transparent=e.transparent||i.opacity<1,i.depthWrite=i.opacity<1?!1:e.depthWrite,`color`in i&&i.color instanceof n.Color&&`color`in e&&e.color instanceof n.Color&&(i.color.copy(e.color),u.color&&i.color.set(u.color)),i.needsUpdate=!0,i});f.material=Array.isArray(p)?m:m[0]}}let d=new Map;function f(e){return!l(e)||!Object.keys(e).length?`patch 必须包含外观字段`:Object.keys(e).some(e=>!S.includes(e))?`包含未知外观字段`:`visible`in e&&e.visible!==null&&typeof e.visible!=`boolean`?`visible 必须为布尔值或 null`:`opacity`in e&&e.opacity!==null&&(typeof e.opacity!=`number`||!Number.isFinite(e.opacity)||e.opacity<0||e.opacity>1)?`opacity 必须在 0–1 之间或为 null`:`color`in e&&e.color!==null&&(typeof e.color!=`string`||!/^#[\da-f]{6}$/i.test(e.color))?`color 必须是 #RRGGBB 或 null`:null}function p(n,r=`api`){let o=C(),s=c();if(!Array.isArray(n))return{...o,error:`updates 必须是数组`};for(let t of n){if(!l(t)||typeof t.id!=`string`){o.skipped.push({id:``,reason:`修改项必须包含构件 ID`});continue}if(!e.byId.has(t.id)){o.unknownIds.push(t.id);continue}let n=f(t.patch);if(n){o.skipped.push({id:t.id,reason:n});continue}let r=i.get(t.id)||{},s={...r},c=a.get(t.id);for(let e of S){if(!(e in t.patch))continue;let n=t.patch[e];e===`color`&&typeof n==`string`&&(n=n.toLowerCase()),n===null||n===c[e]?delete s[e]:Object.assign(s,{[e]:n})}S.every(e=>r[e]===s[e])||(Object.keys(s).length?i.set(t.id,s):i.delete(t.id),o.changedIds.push(t.id))}return o.changedIds=[...new Set(o.changedIds)],o.unknownIds=[...new Set(o.unknownIds)],o.changedIds.length&&(u(),t({source:r,before:s,after:c(),result:o})),o}function m(t){if(!l(t)||t.schemaVersion!==1||!Array.isArray(t.overrides))return{...C(),error:`外观文件格式无效`};if(t.modelId!==e.tree.modelId||t.revision!==e.tree.revision)return{...C(),error:`模型身份或版本不匹配,未应用任何修改`};let n=[];for(let e of t.overrides){if(!l(e)||typeof e.id!=`string`||f(e.current))return{...C(),error:`外观文件包含无效修改,未应用任何修改`};n.push({id:e.id,patch:e.current})}return p(n,`import`)}function h(e){return p((e===void 0?[...i.keys()]:[e]).map(e=>({id:e,patch:{visible:null,opacity:null,color:null}})),`restore`)}return u(),{changes:c,apply:p,importChanges:m,restore:h,get(e){let t=a.get(e),n=o.get(e);return t&&n?{own:{...i.get(e)},initial:{...t},effective:{...n}}:null},dispose(){s.forEach((e,t)=>{t.material=e,t.visible=!0}),r.forEach(t=>{e.renderObjects.get(t.id).visible=a.get(t.id).visible}),d.forEach(e=>e.dispose()),d.clear(),i.clear(),o.clear()}}}function T(e,t,r){let i=new n.Color(`#f4f7fb`),a=new n.TextureLoader().setCrossOrigin(`anonymous`),o,s=``,c=0,l=!1,u=1,d=1,f=1;e.background=i;function p(){if(!o)return;let e=d/f;o.repeat.set(Math.min(1,e/u),Math.min(1,u/e)),o.offset.set((1-o.repeat.x)/2,(1-o.repeat.y)/2)}async function m(s,d){let f;try{if(f=await a.loadAsync(s),l||d!==c){f.dispose();return}let r=f.image;if(!r||!Number.isFinite(r.width)||!Number.isFinite(r.height)||r.width<=0||r.height<=0)throw Error(`背景图片尺寸无效`);u=r.width/r.height,f.colorSpace=n.SRGBColorSpace,o=f,p(),e.background=o,t()}catch{if(f?.dispose(),l||d!==c)return;e.background=i,r({message:`背景图片加载失败,请检查图片地址、格式及跨域配置`}),t()}}return{set(n){if(l)return;let a=n?.color,u=a===void 0||typeof a==`string`&&/^#[\da-f]{6}$/i.test(a);i.set(u&&a!==void 0?a:`#f4f7fb`),u||r({message:`背景颜色必须为 #RRGGBB,已使用默认颜色 #f4f7fb`});let d=n?.imageUrl,f=d===void 0||typeof d==`string`,p=f&&d?.trim()||``;if(f||r({message:`背景图片地址必须为字符串,已使用纯色背景`}),p===s){e.background=o||i,t();return}s=p;let h=++c;o?.dispose(),o=void 0,e.background=i,t(),s&&m(s,h)},resize(e,n){l||!Number.isFinite(e)||!Number.isFinite(n)||e<=0||n<=0||(d=e,f=n,p(),o&&t())},dispose(){l||(l=!0,c++,o?.dispose(),o=void 0,e.background=null)}}}function E(e,t){let r;function i(n){e.near=n.near,e.far=n.far,t.minDistance=n.minDistance,t.maxDistance=n.maxDistance,e.updateProjectionMatrix()}function a(){if(!r)return;let n=e.position.distanceTo(t.target);t.minDistance=Math.min(r.view.minDistance,n),t.maxDistance=Math.max(r.view.maxDistance,n),r=void 0}return{cancel:a,moveTo(o,s={}){let c=s.duration??800;if(!Number.isFinite(c)||c<0)return!1;a();let l=e.position.clone(),u=t.target.clone(),d=t.enableDamping;if(t.enableDamping=!1,t.update(),e.position.copy(l),t.target.copy(u),t.minDistance=Math.min(t.minDistance,o.minDistance),t.maxDistance=Math.max(t.maxDistance,o.maxDistance,l.distanceTo(u)),e.near=Math.min(e.near,o.near),e.far=Math.max(e.far,o.far+l.distanceTo(o.position)),e.updateProjectionMatrix(),t.update(),t.enableDamping=d,c===0||globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)e.position.copy(o.position),t.target.copy(o.target),i(o),t.update(),t.saveState();else{let e=new n.Spherical().setFromVector3(l.clone().sub(u)),t=new n.Spherical().setFromVector3(o.position.clone().sub(o.target));t.theta=e.theta+Math.atan2(Math.sin(t.theta-e.theta),Math.cos(t.theta-e.theta)),r={from:e,to:t,target:u,view:o,started:performance.now(),duration:c}}return!0},update(a){if(!r)return!1;let o=Math.max(0,Math.min(1,(a-r.started)/r.duration)),s=o*o*(3-2*o);t.target.lerpVectors(r.target,r.view.target,s);let{from:c,to:l}=r,u=new n.Spherical(c.radius+(l.radius-c.radius)*s,c.phi+(l.phi-c.phi)*s,c.theta+(l.theta-c.theta)*s);return e.position.setFromSpherical(u).add(t.target),o===1&&(e.position.copy(r.view.position),i(r.view),r=void 0,t.update(),t.saveState()),!!r}}}var D=[{negative:`left`,positive:`right`,labels:[`左`,`右`]},{negative:`bottom`,positive:`top`,labels:[`下`,`上`]},{negative:`back`,positive:`front`,labels:[`后`,`前`]}],O=[];for(let e of[-1,0,1])for(let t of[-1,0,1])for(let r of[-1,0,1]){let i=[e,t,r],a=i.filter(Boolean).length;if(!a)continue;let o=new n.Vector3(e,t,r).normalize(),s=i.flatMap((e,t)=>e?[D[t][e>0?`positive`:`negative`]]:[]),c=i.flatMap((e,t)=>e?[D[t].labels[+(e>0)]]:[]).join(``),l=Math.abs(t)===1&&a===1?new n.Vector3(0,0,t>0?-1:1):new n.Vector3(0,1,0),u=l.clone().cross(o).normalize();l.copy(o).cross(u),O.push({id:s.join(`-`),label:c,kind:[`face`,`edge`,`corner`][a-1],direction:i,normal:o,up:l,right:u,distance:[1,1.9,2.65][a-1]/Math.sqrt(a)})}for(let e of O){let t=e.normal.clone().multiplyScalar(e.distance),n=[[-3,-3],[3,-3],[3,3],[-3,3]].map(([n,r])=>t.clone().addScaledVector(e.right,n).addScaledVector(e.up,r));for(let t of O){if(t===e)continue;let r=[];for(let e=0;e<n.length;e++){let i=n[e],a=n[(e+1)%n.length],o=t.normal.dot(i)-t.distance,s=t.normal.dot(a)-t.distance;o<=1e-8&&r.push(i),(o<-1e-8&&s>1e-8||o>1e-8&&s<-1e-8)&&r.push(i.clone().lerp(a,o/(o-s)))}n=r}e.vertices=n,e.center=t}function k(e,t=!1){let r=O.find(n=>n.id===e&&(!t||n.kind===`face`));return r?new n.Vector3(...r.direction).normalize():null}function A(e){let t=[`x`,`y`,`z`,`w`].map(t=>e?.[t]),r=new n.Quaternion;t.every(Number.isFinite)&&t.some(e=>e!==0)&&r.fromArray(t).normalize().invert();let i=e=>({x:64+e.x*32,y:76-e.y*32});return O.flatMap(e=>{if(e.normal.clone().applyQuaternion(r).z<=1e-6)return[];let t=e.center.clone().applyQuaternion(r),n=e.right.clone().applyQuaternion(r),a=e.up.clone().applyQuaternion(r),o=i(t);return[{id:e.id,label:e.label,kind:e.kind,depth:t.z,points:e.vertices.map(e=>{let t=i(e.clone().applyQuaternion(r));return`${t.x.toFixed(4)},${t.y.toFixed(4)}`}).join(` `),textTransform:`matrix(${n.x*32},${-n.y*32},${-a.x*32},${a.y*32},${o.x},${o.y})`}]}).sort((e,t)=>e.depth-t.depth)}function j(e){let t=e?.home!==!1,n=e?.cube!==!1;return{home:t,cube:n,height:n?150:t?44:0}}function ee(e,t,n){function r(r,i,a){let o=k(r,a),s=e.position.distanceTo(t.target);return!o||!Number.isFinite(s)||s<=0?!1:(Math.abs(o.y)===1&&(o.z=1e-6),o.normalize().multiplyScalar(s),n.moveTo({position:t.target.clone().add(o),target:t.target.clone(),near:e.near,far:e.far,minDistance:t.minDistance,maxDistance:t.maxDistance},i))}return{setViewDirection:(e,t)=>r(e,t,!0),navigate:(e,t)=>r(e,t,!1)}}function te(e,t,r,i,a,o,s){let c=[],l=[],u=new Set;for(let d of e)try{if(!d.id||u.has(d.id))throw Error(`Marker ID 缺失或重复`);u.add(d.id);let e=d.position,l;if(e.type===`model`)l={x:e.x,y:e.y,z:e.z};else if(e.type===`component`){if(r.get(e.componentId)?.effective.visible===!1)continue;if(l=t.getAnchor(e.componentId,e.anchor||`origin`),!l)throw Error(`构件或锚点不存在`);let n=e.offset||{x:0,y:0,z:0};l={x:l.x+n.x,y:l.y+n.y,z:l.z+n.z}}else throw Error(`不支持的定位类型`);if(!Object.values(l).every(Number.isFinite))throw Error(`模型坐标必须是有限数值`);if(d.screenOffset&&![d.screenOffset.x,d.screenOffset.y].every(Number.isFinite))throw Error(`屏幕偏移必须是有限数值`);let f=new n.Vector3(l.x,l.y,l.z).add(i),p=f.clone().project(a),m=f.clone().applyMatrix4(a.matrixWorldInverse).z<0,h=(p.x+1)/2*o+(d.screenOffset?.x||0),_=(1-p.y)/2*s+(d.screenOffset?.y||0),v=m&&Math.abs(p.z)<=1&&h>=0&&h<=o&&_>=0&&_<=s;c.push({...d,modelPosition:g(new n.Vector3(l.x,l.y,l.z)),x:h,y:_,visible:v})}catch(e){l.push(`标记 ${d?.id||`unknown`}:${e instanceof Error?e.message:String(e)}`)}return{markers:c,issues:l,width:o,height:s}}function M(e){e(`EPSG:4326`,`+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees`),e(`EPSG:4269`,`+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees`),e(`EPSG:3857`,`+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs`);for(var t=1;t<=60;++t)e(`EPSG:`+(32600+t),`+proj=utm +zone=`+t+` +datum=WGS84 +units=m`),e(`EPSG:`+(32700+t),`+proj=utm +zone=`+t+` +south +datum=WGS84 +units=m`);e(`EPSG:5041`,`+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e(`EPSG:5042`,`+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e.WGS84=e[`EPSG:4326`],e[`EPSG:3785`]=e[`EPSG:3857`],e.GOOGLE=e[`EPSG:3857`],e[`EPSG:900913`]=e[`EPSG:3857`],e[`EPSG:102113`]=e[`EPSG:3857`]}var N=6378137,P=6356752.314,ne=.0066943799901413165,F=484813681109536e-20,I=Math.PI/2,re=.16666666666666666,ie=.04722222222222222,ae=.022156084656084655,oe=1e-10,L=.017453292519943295,R=57.29577951308232,z=Math.PI/4,se=Math.PI*2,B=3.14159265359,V={};V.greenwich=0,V.lisbon=-9.131906111111,V.paris=2.337229166667,V.bogota=-74.080916666667,V.madrid=-3.687938888889,V.rome=12.452333333333,V.bern=7.439583333333,V.jakarta=106.807719444444,V.ferro=-17.666666666667,V.brussels=4.367975,V.stockholm=18.058277777778,V.athens=23.7163375,V.oslo=10.722916666667;var ce={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},le=/[\s_\-\/\(\)]/g;function ue(e,t){if(e[t])return e[t];for(var n=Object.keys(e),r=t.toLowerCase().replace(le,``),i=-1,a,o;++i<n.length;)if(a=n[i],o=a.toLowerCase().replace(le,``),o===r)return e[a]}function de(e){var t={},n=e.split(`+`).map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var n=t.split(`=`);return n.push(!0),e[n[0].toLowerCase()]=n[1],e},{}),r,i,a,o={proj:function(e){t.projName=[`lonlat`,`latlon`,`latlong`].includes(e)?`longlat`:e},datum:`datumCode`,rf:function(e){t.rf=parseFloat(e)},lat_0:function(e){t.lat0=e*L},lat_1:function(e){t.lat1=e*L},lat_2:function(e){t.lat2=e*L},lat_ts:function(e){t.lat_ts=e*L},lon_0:function(e){t.long0=e*L},lon_wrap:function(e){t.long_wrap=parseFloat(e)*L},lon_1:function(e){t.long1=e*L},lon_2:function(e){t.long2=e*L},alpha:function(e){t.alpha=parseFloat(e)*L},gamma:function(e){t.rectified_grid_angle=parseFloat(e)*L},lonc:function(e){t.longc=e*L},x_0:function(e){t.x0=parseFloat(e)},y_0:function(e){t.y0=parseFloat(e)},k_0:function(e){t.k0=parseFloat(e)},k:function(e){t.k0=parseFloat(e)},a:function(e){t.a=parseFloat(e)},b:function(e){t.b=parseFloat(e)},r:function(e){t.a=t.b=parseFloat(e)},r_a:function(){t.R_A=!0},zone:function(e){t.zone=parseInt(e,10)},south:function(){t.utmSouth=!0},towgs84:function(e){t.datum_params=e.split(`,`).map(function(e){return parseFloat(e)})},to_meter:function(e){t.to_meter=parseFloat(e)},units:function(e){t.units=e;var n=ue(ce,e);n&&(t.to_meter=n.to_meter)},from_greenwich:function(e){t.from_greenwich=e*L},pm:function(e){t.from_greenwich=(ue(V,e)||parseFloat(e))*L},nadgrids:function(e){e===`@null`?t.datumCode=`none`:t.nadgrids=e},axis:function(e){var n=`ewnsud`;e.length===3&&n.indexOf(e.substr(0,1))!==-1&&n.indexOf(e.substr(1,1))!==-1&&n.indexOf(e.substr(2,1))!==-1&&(t.axis=e)},approx:function(){t.approx=!0},over:function(){t.over=!0}};for(r in n)i=n[r],r in o?(a=o[r],typeof a==`function`?a(i):t[a]=i):t[r]=i;return typeof t.datumCode==`string`&&t.datumCode!==`WGS84`&&(t.datumCode=t.datumCode.toLowerCase()),t.projStr=e,t}var fe=class{static getId(e){let t=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t=`unit`){if(!e||e.length<3)return{type:t,name:`unknown`,conversion_factor:null};let n=e[1],r=parseFloat(e[2])||null,i=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return{type:t,name:n,conversion_factor:r,id:i?{authority:i[1],code:parseInt(i[2],10)}:null}}static convertAxis(e){let t=e[1]||`Unknown`,n,r=t.match(/^\((.)\)$/);if(r){let t=r[1].toUpperCase();if(t===`E`)n=`east`;else if(t===`N`)n=`north`;else if(t===`U`)n=`up`;else if(e[2])n=e[2];else throw Error(`Unknown axis abbreviation: ${t}`)}else n=e[2]||`unknown`;let i=e.find(e=>Array.isArray(e)&&e[0]===`ORDER`),a=i?parseInt(i[1],10):null,o=e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`)),s=this.convertUnit(o);return{name:t,direction:n,unit:s,order:a}}static extractAxes(e){return e.filter(e=>Array.isArray(e)&&e[0]===`AXIS`).map(e=>this.convertAxis(e)).sort((e,t)=>(e.order||0)-(t.order||0))}static convert(e,t={}){switch(e[0]){case`PROJCRS`:t.type=`ProjectedCRS`,t.name=e[1],t.base_crs=e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)):null,t.conversion=e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)):null;let n=e.find(e=>Array.isArray(e)&&e[0]===`CS`);n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`);if(r){let e=this.convertUnit(r);t.coordinate_system.unit=e}t.id=this.getId(e);break;case`BASEGEOGCRS`:case`GEOGCRS`:case`GEODCRS`:t.type=e[0]===`GEODCRS`?`GeodeticCRS`:`GeographicCRS`,t.name=e[1];let i=e.find(e=>Array.isArray(e)&&(e[0]===`DATUM`||e[0]===`ENSEMBLE`));if(i){let n=this.convert(i);i[0]===`ENSEMBLE`?t.datum_ensemble=n:t.datum=n;let r=e.find(e=>Array.isArray(e)&&e[0]===`PRIMEM`);r&&r[1]!==`Greenwich`&&(n.prime_meridian={name:r[1],longitude:parseFloat(r[2])})}let a=e.find(e=>Array.isArray(e)&&e[0]===`CS`);t.coordinate_system={subtype:a?a[1]:`ellipsoidal`,axis:this.extractAxes(e)},t.id=this.getId(e);break;case`DATUM`:t.type=`GeodeticReferenceFrame`,t.name=e[1],t.ellipsoid=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)):null;break;case`ENSEMBLE`:t.type=`DatumEnsemble`,t.name=e[1],t.members=e.filter(e=>Array.isArray(e)&&e[0]===`MEMBER`).map(e=>({type:`DatumEnsembleMember`,name:e[1],id:this.getId(e)}));let o=e.find(e=>Array.isArray(e)&&e[0]===`ENSEMBLEACCURACY`);o&&(t.accuracy=parseFloat(o[1]));let s=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`);s&&(t.ellipsoid=this.convert(s)),t.id=this.getId(e);break;case`ELLIPSOID`:t.type=`Ellipsoid`,t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`)&&this.convert(e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`),t);break;case`CONVERSION`:t.type=`Conversion`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&e[0]===`PARAMETER`).map(e=>this.convert(e));break;case`METHOD`:t.type=`Method`,t.name=e[1],t.id=this.getId(e);break;case`PARAMETER`:t.type=`Parameter`,t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`))),t.id=this.getId(e);break;case`BOUNDCRS`:t.type=`BoundCRS`;let c=e.find(e=>Array.isArray(e)&&e[0]===`SOURCECRS`);if(c){let e=c.find(e=>Array.isArray(e));t.source_crs=e?this.convert(e):null}let l=e.find(e=>Array.isArray(e)&&e[0]===`TARGETCRS`);if(l){let e=l.find(e=>Array.isArray(e));t.target_crs=e?this.convert(e):null}let u=e.find(e=>Array.isArray(e)&&e[0]===`ABRIDGEDTRANSFORMATION`);t.transformation=u?this.convert(u):null;break;case`ABRIDGEDTRANSFORMATION`:if(t.type=`Transformation`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&(e[0]===`PARAMETER`||e[0]===`PARAMETERFILE`)).map(e=>{if(e[0]===`PARAMETER`)return this.convert(e);if(e[0]===`PARAMETERFILE`)return{name:e[1],value:e[2],id:{authority:`EPSG`,code:8656}}}),t.parameters.length===7){let e=t.parameters[6];e.name===`Scale difference`&&(e.value=Math.round((e.value-1)*0xe8d4a51000)/1e6)}t.id=this.getId(e);break;case`AXIS`:t.coordinate_system||={type:`unspecified`,axis:[]},t.coordinate_system.axis.push(this.convertAxis(e));break;case`LENGTHUNIT`:let d=this.convertUnit(e,`LinearUnit`);t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(e=>{e.unit||=d}),d.conversion_factor&&d.conversion_factor!==1&&(t.semi_major_axis&&={value:t.semi_major_axis,unit:d});break;default:t.keyword=e[0]}return t}};function pe(e){return fe.convert(e)}function me(e){let t=e.toUpperCase();return t.includes(`PROJCRS`)||t.includes(`GEOGCRS`)||t.includes(`BOUNDCRS`)||t.includes(`VERTCRS`)||t.includes(`LENGTHUNIT`)||t.includes(`ANGLEUNIT`)||t.includes(`SCALEUNIT`)?`WKT2`:(t.includes(`PROJCS`)||t.includes(`GEOGCS`)||t.includes(`LOCAL_CS`)||t.includes(`VERT_CS`)||t.includes(`UNIT`),`WKT1`)}var he=Oe,ge=1,_e=2,ve=3,ye=4,be=5,xe=-1,Se=/\s/,Ce=/[A-Za-z]/,we=/[A-Za-z84_]/,Te=/[,\]]/,Ee=/[\d\.E\-\+]/;function De(e){if(typeof e!=`string`)throw Error(`not a string`);this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=ge}De.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==ye)for(;Se.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case ge:return this.neutral(e);case _e:return this.keyword(e);case ye:return this.quoted(e);case be:return this.afterquote(e);case ve:return this.number(e);case xe:return}},De.prototype.afterquote=function(e){if(e===`"`)this.word+=`"`,this.state=ye;else if(Te.test(e))this.word=this.word.trim(),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in afterquote yet, index `+this.place)},De.prototype.afterItem=function(e){e===`,`?(this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=ge):e===`]`&&(this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=ge,this.currentObject=this.stack.pop(),this.currentObject||(this.state=xe))},De.prototype.number=function(e){if(Ee.test(e))this.word+=e;else if(Te.test(e))this.word=parseFloat(this.word),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in number yet, index `+this.place)},De.prototype.quoted=function(e){e===`"`?this.state=be:this.word+=e},De.prototype.keyword=function(e){if(we.test(e))this.word+=e;else if(e===`[`){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=ge}else if(Te.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in keyword yet, index `+this.place)},De.prototype.neutral=function(e){if(Ce.test(e))this.word=e,this.state=_e;else if(e===`"`)this.word=``,this.state=ye;else if(Ee.test(e))this.word=e,this.state=ve;else if(Te.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in neutral yet, index `+this.place)},De.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===xe)return this.root;throw Error(`unable to parse string "`+this.text+`". State is `+this.state)};function Oe(e){return new De(e).output()}function ke(e,t,n){Array.isArray(t)&&(n.unshift(t),t=null);var r=t?{}:e,i=n.reduce(function(e,t){return Ae(t,e),e},r);t&&(e[t]=i)}function Ae(e,t){if(!Array.isArray(e))t[e]=!0;else{var n=e.shift();if(n===`PARAMETER`&&(n=e.shift()),e.length===1){if(Array.isArray(e[0])){t[n]={},Ae(e[0],t[n]);return}t[n]=e[0]}else if(!e.length)t[n]=!0;else if(n===`TOWGS84`)t[n]=e;else if(n===`AXIS`)n in t||(t[n]=[]),t[n].push(e);else{Array.isArray(n)||(t[n]={});var r;switch(n){case`UNIT`:case`PRIMEM`:case`VERT_DATUM`:t[n]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&Ae(e[2],t[n]);return;case`SPHEROID`:case`ELLIPSOID`:t[n]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Ae(e[3],t[n]);return;case`EDATUM`:case`ENGINEERINGDATUM`:case`LOCAL_DATUM`:case`DATUM`:case`VERT_CS`:case`VERTCRS`:case`VERTICALCRS`:e[0]=[`name`,e[0]],ke(t,n,e);return;case`COMPD_CS`:case`COMPOUNDCRS`:case`FITTED_CS`:case`PROJECTEDCRS`:case`PROJCRS`:case`GEOGCS`:case`GEOCCS`:case`PROJCS`:case`LOCAL_CS`:case`GEODCRS`:case`GEODETICCRS`:case`GEODETICDATUM`:case`ENGCRS`:case`ENGINEERINGCRS`:e[0]=[`name`,e[0]],ke(t,n,e),t[n].type=n;return;default:for(r=-1;++r<e.length;)if(!Array.isArray(e[r]))return Ae(e,t[n]);return ke(t,n,e)}}}}var je=.017453292519943295;function H(e){return e*je}function Me(e){let t=(e.projName||``).toLowerCase().replace(/_/g,` `);e.long0===void 0&&e.longc!==void 0&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(t===`stereographic south pole`||t===`polar stereographic (variant b)`)?(e.lat0=H(e.lat1>0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t===`polar stereographic`||t===`polar stereographic (variant a)`)&&(e.lat_ts=e.lat0,e.lat0=H(e.lat0>0?90:-90),delete e.lat1)}function Ne(e){let t={units:null,to_meter:void 0};return typeof e==`string`?(t.units=e.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.units===`meter`&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.to_meter=e.conversion_factor),t}function Pe(e){return typeof e==`object`?e.value*e.unit.conversion_factor:e}function Fe(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=Pe(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening===void 0?e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Pe(e.ellipsoid.semi_minor_axis))):t.rf=e.ellipsoid.inverse_flattening)}function Ie(e,t={}){return!e||typeof e!=`object`?e:e.type===`BoundCRS`?(Ie(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name===`NTv2`?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(e=>e.value)),t):(Object.keys(e).forEach(n=>{let r=e[n];if(r!==null)switch(n){case`name`:if(t.srsCode)break;t.name=r,t.srsCode=r;break;case`type`:r===`GeographicCRS`?t.projName=`longlat`:r===`GeodeticCRS`?t.projName=e.coordinate_system&&e.coordinate_system.subtype===`Cartesian`?`geocent`:`longlat`:r===`ProjectedCRS`&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case`datum`:case`datum_ensemble`:r.ellipsoid&&(t.ellps=r.ellipsoid.name,Fe(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case`ellipsoid`:t.ellps=r.name,Fe(r,t);break;case`prime_meridian`:t.long0=(r.longitude||0)*Math.PI/180;break;case`coordinate_system`:if(r.axis){let e={east:`e`,north:`n`,west:`w`,south:`s`,up:`u`,down:`d`,geocentricx:`e`,geocentricy:`n`,geocentricz:`u`},n=r.axis.map(t=>e[t.direction.toLowerCase()]);if(n.every(Boolean)&&(t.axis=n.join(``),t.axis.length===2&&(t.axis+=`u`)),r.unit){let{units:e,to_meter:n}=Ne(r.unit);t.units=e,t.to_meter=n}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:n}=Ne(r.axis[0].unit);t.units=e,t.to_meter=n}}break;case`id`:r.authority&&r.code&&(t.title=r.authority+`:`+r.code);break;case`conversion`:r.method&&r.method.name&&(t.projName=r.method.name),r.parameters&&r.parameters.forEach(e=>{let n=e.name.toLowerCase().replace(/\s+/g,`_`),r=e.value;t[n]=e.unit&&e.unit.conversion_factor?r*e.unit.conversion_factor:e.unit===`degree`?r*Math.PI/180:r});break;case`unit`:r.name&&(t.units=r.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`)),r.conversion_factor&&(t.to_meter=r.conversion_factor);break;case`base_crs`:Ie(r,t),t.datumCode=r.id?r.id.authority+`_`+r.id.code:r.name}}),!t.datumCode&&(e.type===`GeographicCRS`||e.type===`GeodeticCRS`)&&e.id&&(t.datumCode=e.id.authority+`_`+e.id.code),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),Me(t),t)}var Le=[`PROJECTEDCRS`,`PROJCRS`,`GEOGCS`,`GEOCCS`,`PROJCS`,`LOCAL_CS`,`GEODCRS`,`GEODETICCRS`,`GEODETICDATUM`,`ENGCRS`,`ENGINEERINGCRS`];function Re(e,t){var n=t[0],r=t[1];!(n in e)&&r in e&&(e[n]=e[r],t.length===3&&(e[n]=t[2](e[n])))}function ze(e){for(var t=Object.keys(e),n=0,r=t.length;n<r;++n){var i=t[n];Le.indexOf(i)!==-1&&Be(e[i]),typeof e[i]==`object`&&ze(e[i])}}function Be(e){if(e.AUTHORITY){var t=Object.keys(e.AUTHORITY)[0];t&&t in e.AUTHORITY&&(e.title=t+`:`+e.AUTHORITY[t])}if(e.type===`GEOGCS`?e.projName=`longlat`:e.type===`LOCAL_CS`?(e.projName=`identity`,e.local=!0):e.projName=typeof e.PROJECTION==`object`?Object.keys(e.PROJECTION)[0]:e.PROJECTION,e.AXIS){for(var n=``,r=0,i=e.AXIS.length;r<i;++r){var a=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];a[0].indexOf(`north`)!==-1||(a[0]===`y`||a[0]===`lat`)&&a[1]===`north`?n+=`n`:a[0].indexOf(`south`)!==-1||(a[0]===`y`||a[0]===`lat`)&&a[1]===`south`?n+=`s`:a[0].indexOf(`east`)!==-1||(a[0]===`x`||a[0]===`lon`)&&a[1]===`east`?n+=`e`:(a[0].indexOf(`west`)!==-1||(a[0]===`x`||a[0]===`lon`)&&a[1]===`west`)&&(n+=`w`)}n.length===2&&(n+=`u`),n.length===3&&(e.axis=n)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units===`metre`&&(e.units=`meter`),e.UNIT.convert&&(e.type===`GEOGCS`?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var o=e.GEOGCS;e.type===`GEOGCS`&&(o=e),o&&(o.PRIMEM&&o.PRIMEM.convert&&(e.from_greenwich=H(o.PRIMEM.convert)),e.datumCode=o.DATUM?o.DATUM.name.toLowerCase():o.name.toLowerCase(),e.datumCode.slice(0,2)===`d_`&&(e.datumCode=e.datumCode.slice(2)),e.datumCode===`new_zealand_1949`&&(e.datumCode=`nzgd49`),(e.datumCode===`wgs_1984`||e.datumCode===`world_geodetic_system_1984`)&&(e.PROJECTION===`Mercator_Auxiliary_Sphere`&&(e.sphere=!0),e.datumCode=`wgs84`),e.datumCode===`belge_1972`&&(e.datumCode=`rnb72`),o.DATUM&&o.DATUM.SPHEROID&&(e.ellps=o.DATUM.SPHEROID.name.replace(`_19`,``).replace(/[Cc]larke\_18/,`clrk`),e.ellps.toLowerCase().slice(0,13)===`international`&&(e.ellps=`intl`),e.a=o.DATUM.SPHEROID.a,e.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(e.datum_params=o.DATUM.TOWGS84),~e.datumCode.indexOf(`osgb_1936`)&&(e.datumCode=`osgb36`),~e.datumCode.indexOf(`osni_1952`)&&(e.datumCode=`osni52`),(~e.datumCode.indexOf(`tm65`)||~e.datumCode.indexOf(`geodetic_datum_of_1965`))&&(e.datumCode=`ire65`),e.datumCode===`ch1903+`&&(e.datumCode=`ch1903`),~e.datumCode.indexOf(`israel`)&&(e.datumCode=`isr93`)),e.b&&!isFinite(e.b)&&(e.b=e.a),e.rectified_grid_angle&&=H(e.rectified_grid_angle);function s(t){return t*(e.to_meter||1)}[[`standard_parallel_1`,`Standard_Parallel_1`],[`standard_parallel_1`,`Latitude of 1st standard parallel`],[`standard_parallel_2`,`Standard_Parallel_2`],[`standard_parallel_2`,`Latitude of 2nd standard parallel`],[`false_easting`,`False_Easting`],[`false_easting`,`False easting`],[`false-easting`,`Easting at false origin`],[`false_northing`,`False_Northing`],[`false_northing`,`False northing`],[`false_northing`,`Northing at false origin`],[`central_meridian`,`Central_Meridian`],[`central_meridian`,`Longitude of natural origin`],[`central_meridian`,`Longitude of false origin`],[`latitude_of_origin`,`Latitude_Of_Origin`],[`latitude_of_origin`,`Central_Parallel`],[`latitude_of_origin`,`Latitude of natural origin`],[`latitude_of_origin`,`Latitude of false origin`],[`scale_factor`,`Scale_Factor`],[`k0`,`scale_factor`],[`latitude_of_center`,`Latitude_Of_Center`],[`latitude_of_center`,`Latitude_of_center`],[`lat0`,`latitude_of_center`,H],[`longitude_of_center`,`Longitude_Of_Center`],[`longitude_of_center`,`Longitude_of_center`],[`longc`,`longitude_of_center`,H],[`x0`,`false_easting`,s],[`y0`,`false_northing`,s],[`long0`,`central_meridian`,H],[`lat0`,`latitude_of_origin`,H],[`lat0`,`standard_parallel_1`,H],[`lat1`,`standard_parallel_1`,H],[`lat2`,`standard_parallel_2`,H],[`azimuth`,`Azimuth`],[`alpha`,`azimuth`,H],[`srsCode`,`name`]].forEach(function(t){return Re(e,t)}),Me(e)}function Ve(e){if(typeof e==`object`)return Ie(e);let t=me(e);var n=he(e);if(t===`WKT2`)return Ie(pe(n));var r=n[0],i={};return Ae(n,i),ze(i),i[r]}function U(e){var t=this;if(arguments.length===2){var n=arguments[1];typeof n==`string`?U[e]=n.charAt(0)===`+`?de(arguments[1]):Ve(arguments[1]):n&&typeof n==`object`&&!(`projName`in n)?U[e]=Ve(arguments[1]):(U[e]=n,n||delete U[e])}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(e){return Array.isArray(e)?U.apply(t,e):U(e)});if(typeof e==`string`){if(e in U)return U[e]}else`EPSG`in e?U[`EPSG:`+e.EPSG]=e:`ESRI`in e?U[`ESRI:`+e.ESRI]=e:`IAU2000`in e?U[`IAU2000:`+e.IAU2000]=e:console.log(e);return}}M(U);function He(e){return typeof e==`string`}function Ue(e){return e in U}function We(e){return e.indexOf(`+`)!==0&&e.indexOf(`[`)!==-1||typeof e==`object`&&!(`srsCode`in e)}var Ge=[`3857`,`900913`,`3785`,`102113`];function Ke(e){if(e.title)return e.title.toLowerCase().indexOf(`epsg:`)===0&&Ge.indexOf(e.title.substr(5))>-1;var t=ue(e,`authority`);if(t){var n=ue(t,`epsg`);return n&&Ge.indexOf(n)>-1}}function qe(e){var t=ue(e,`extension`);if(t)return ue(t,`proj4`)}function Je(e){return e[0]===`+`}function Ye(e){let t;if(He(e)){if(Ue(e))t=U[e];else if(We(e)){t=Ve(e);var n=qe(t);n&&(t=de(n))}else Je(e)&&(t=de(e))}else t=`projName`in e?e:Ve(e);return t&&Ke(t)?U[`EPSG:3857`]:t}function Xe(e,t){e||={};var n,r;if(!t)return e;for(r in t)n=t[r],n!==void 0&&(e[r]=n);return e}function Ze(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}function Qe(e){return e<0?-1:1}function W(e,t){return t||Math.abs(e)<=3.14159265359?e:e-Qe(e)*se}function G(e,t,n){var r=e*n,i=.5*e;return r=((1-r)/(1+r))**i,Math.tan(.5*(I-t))/r}function $e(e,t){for(var n=.5*e,r,i,a=I-2*Math.atan(t),o=0;o<=15;o++)if(r=e*Math.sin(a),i=I-2*Math.atan(t*((1-r)/(1+r))**n)-a,a+=i,Math.abs(i)<=1e-10)return a;return-9999}function et(){var e=this.b/this.a;this.es=1-e*e,`x0`in this||(this.x0=0),`y0`in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.k0=this.sphere?Math.cos(this.lat_ts):Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||=this.k?this.k:1}function tt(e){var t=e.x,n=e.y;if(n*57.29577951308232>90&&n*57.29577951308232<-90&&t*57.29577951308232>180&&t*57.29577951308232<-180)return null;var r,i;if(Math.abs(Math.abs(n)-I)<=1e-10)return null;if(this.sphere)r=this.x0+this.a*this.k0*W(t-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(z+.5*n));else{var a=Math.sin(n),o=G(this.e,n,a);r=this.x0+this.a*this.k0*W(t-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=r,e.y=i,e}function nt(e){var t=e.x-this.x0,n=e.y-this.y0,r,i;if(this.sphere)i=I-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var a=Math.exp(-n/(this.a*this.k0));if(i=$e(this.e,a),i===-9999)return null}return r=W(this.long0+t/(this.a*this.k0),this.over),e.x=r,e.y=i,e}var rt={init:et,forward:tt,inverse:nt,names:[`Mercator`,`Popular Visualisation Pseudo Mercator`,`Mercator_1SP`,`Mercator_Auxiliary_Sphere`,`Mercator_Variant_A`,`merc`]};function it(){}function at(e){return e}var ot=[`longlat`,`identity`,`lonlat`,`latlon`,`latlong`],st=[rt,{init:it,forward:at,inverse:at,names:ot}],ct={},lt=[];function ut(e,t){var n=lt.length;return e.names?(lt[n]=e,e.names.forEach(function(e){ct[e.toLowerCase()]=n}),this):(console.log(t),!0)}function dt(e){return e.replace(/[-\(\)\s]+/g,` `).trim().replace(/ /g,`_`)}function ft(e){if(!e)return!1;var t=e.toLowerCase();if(ct[t]!==void 0&&lt[ct[t]]||(t=dt(t),t in ct&&lt[ct[t]]))return lt[ct[t]]}function pt(){st.forEach(ut)}var mt={start:pt,add:ut,get:ft},ht={MERIT:{a:6378137,rf:298.257,ellipseName:`MERIT 1983`},SGS85:{a:6378136,rf:298.257,ellipseName:`Soviet Geodetic System 85`},GRS80:{a:6378137,rf:298.257222101,ellipseName:`GRS 1980(IUGG, 1980)`},IAU76:{a:6378140,rf:298.257,ellipseName:`IAU 1976`},airy:{a:6377563.396,b:6356256.91,ellipseName:`Airy 1830`},APL4:{a:6378137,rf:298.25,ellipseName:`Appl. Physics. 1965`},NWL9D:{a:6378145,rf:298.25,ellipseName:`Naval Weapons Lab., 1965`},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:`Modified Airy`},andrae:{a:6377104.43,rf:300,ellipseName:`Andrae 1876 (Den., Iclnd.)`},aust_SA:{a:6378160,rf:298.25,ellipseName:`Australian Natl & S. Amer. 1969`},GRS67:{a:6378160,rf:298.247167427,ellipseName:`GRS 67(IUGG 1967)`},bessel:{a:6377397.155,rf:299.1528128,ellipseName:`Bessel 1841`},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:`Bessel 1841 (Namibia)`},clrk66:{a:6378206.4,b:6356583.8,ellipseName:`Clarke 1866`},clrk80:{a:6378249.145,rf:293.4663,ellipseName:`Clarke 1880 mod.`},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:`Clarke 1880 (IGN)`},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:`Clarke 1858`},CPM:{a:6375738.7,rf:334.29,ellipseName:`Comm. des Poids et Mesures 1799`},delmbr:{a:6376428,rf:311.5,ellipseName:`Delambre 1810 (Belgium)`},engelis:{a:6378136.05,rf:298.2566,ellipseName:`Engelis 1985`},evrst30:{a:6377276.345,rf:300.8017,ellipseName:`Everest 1830`},evrst48:{a:6377304.063,rf:300.8017,ellipseName:`Everest 1948`},evrst56:{a:6377301.243,rf:300.8017,ellipseName:`Everest 1956`},evrst69:{a:6377295.664,rf:300.8017,ellipseName:`Everest 1969`},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:`Everest (Sabah & Sarawak)`},fschr60:{a:6378166,rf:298.3,ellipseName:`Fischer (Mercury Datum) 1960`},fschr60m:{a:6378155,rf:298.3,ellipseName:`Fischer 1960`},fschr68:{a:6378150,rf:298.3,ellipseName:`Fischer 1968`},helmert:{a:6378200,rf:298.3,ellipseName:`Helmert 1906`},hough:{a:6378270,rf:297,ellipseName:`Hough`},intl:{a:6378388,rf:297,ellipseName:`International 1909 (Hayford)`},kaula:{a:6378163,rf:298.24,ellipseName:`Kaula 1961`},lerch:{a:6378139,rf:298.257,ellipseName:`Lerch 1979`},mprts:{a:6397300,rf:191,ellipseName:`Maupertius 1738`},new_intl:{a:6378157.5,b:6356772.2,ellipseName:`New International 1967`},plessis:{a:6376523,b:6355863,ellipseName:`Plessis 1817 (France)`},krass:{a:6378245,rf:298.3,ellipseName:`Krassovsky, 1942`},SEasia:{a:6378155,b:6356773.3205,ellipseName:`Southeast Asia`},walbeck:{a:6376896,b:6355834.8467,ellipseName:`Walbeck`},WGS60:{a:6378165,rf:298.3,ellipseName:`WGS 60`},WGS66:{a:6378145,rf:298.25,ellipseName:`WGS 66`},WGS7:{a:6378135,rf:298.26,ellipseName:`WGS 72`},WGS84:{a:6378137,rf:298.257223563,ellipseName:`WGS 84`},sphere:{a:6370997,b:6370997,ellipseName:`Normal Sphere (r=6370997)`}},gt=ht.WGS84;function _t(e,t,n,r){var i=e*e,a=t*t,o=(i-a)/i,s=0;r?(e*=1-o*(re+o*(ie+o*ae)),i=e*e,o=0):s=Math.sqrt(o);var c=(i-a)/a;return{es:o,e:s,ep2:c}}function vt(e,t,n,r,i){if(!e){var a=ue(ht,r);a||=gt,e=a.a,t=a.b,n=a.rf}return n&&!t&&(t=(1-1/n)*e),(n===0||Math.abs(e-t)<1e-10)&&(i=!0,t=e),{a:e,b:t,rf:n,sphere:i}}var yt={wgs84:{towgs84:`0,0,0`,ellipse:`WGS84`,datumName:`WGS84`},ch1903:{towgs84:`674.374,15.056,405.346`,ellipse:`bessel`,datumName:`swiss`},ggrs87:{towgs84:`-199.87,74.79,246.62`,ellipse:`GRS80`,datumName:`Greek_Geodetic_Reference_System_1987`},nad83:{towgs84:`0,0,0`,ellipse:`GRS80`,datumName:`North_American_Datum_1983`},nad27:{nadgrids:`@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat`,ellipse:`clrk66`,datumName:`North_American_Datum_1927`},potsdam:{towgs84:`598.1,73.7,418.2,0.202,0.045,-2.455,6.7`,ellipse:`bessel`,datumName:`Potsdam Rauenberg 1950 DHDN`},carthage:{towgs84:`-263.0,6.0,431.0`,ellipse:`clrk80ign`,datumName:`Carthage 1934 Tunisia`},hermannskogel:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Hermannskogel`},mgi:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Militar-Geographische Institut`},osni52:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`airy`,datumName:`Irish National`},ire65:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`mod_airy`,datumName:`Ireland 1965`},rassadiran:{towgs84:`-133.63,-157.5,-158.62`,ellipse:`intl`,datumName:`Rassadiran`},nzgd49:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`,ellipse:`intl`,datumName:`New Zealand Geodetic Datum 1949`},osgb36:{towgs84:`446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894`,ellipse:`airy`,datumName:`Ordnance Survey of Great Britain 1936`},s_jtsk:{towgs84:`589,76,480`,ellipse:`bessel`,datumName:`S-JTSK (Ferro)`},beduaram:{towgs84:`-106,-87,188`,ellipse:`clrk80`,datumName:`Beduaram`},gunung_segara:{towgs84:`-403,684,41`,ellipse:`bessel`,datumName:`Gunung Segara Jakarta`},rnb72:{towgs84:`106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1`,ellipse:`intl`,datumName:`Reseau National Belge 1972`},EPSG_5451:{towgs84:`6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649`},IGNF_LURESG:{towgs84:`-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43`},EPSG_4614:{towgs84:`-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065`},EPSG_4615:{towgs84:`-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748`},ESRI_37241:{towgs84:`-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031`},ESRI_37249:{towgs84:`-440.296,58.548,296.265,1.128,10.202,4.559,-0.438`},ESRI_37245:{towgs84:`-511.151,-181.269,139.609,1.05,2.703,1.798,3.071`},EPSG_4178:{towgs84:`24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01`},EPSG_4622:{towgs84:`-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984`},EPSG_4625:{towgs84:`126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227`},EPSG_5252:{towgs84:`0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439`},EPSG_4314:{towgs84:`597.1,71.4,412.1,0.894,0.068,-1.563,7.58`},EPSG_4282:{towgs84:`-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166`},EPSG_4231:{towgs84:`-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218`},EPSG_4274:{towgs84:`-230.994,102.591,25.199,0.633,-0.239,0.9,1.95`},EPSG_4134:{towgs84:`-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006`},EPSG_4254:{towgs84:`18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013`},EPSG_4159:{towgs84:`-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175`},EPSG_4687:{towgs84:`0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093`},EPSG_4227:{towgs84:`-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225`},EPSG_4746:{towgs84:`599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46`},EPSG_4745:{towgs84:`612.4,77,440.2,-0.054,0.057,-2.797,2.55`},EPSG_6311:{towgs84:`8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926`},EPSG_4289:{towgs84:`565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244`},EPSG_4230:{towgs84:`-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4`},EPSG_4154:{towgs84:`-123.02,-158.95,-168.47`},EPSG_4156:{towgs84:`570.8,85.7,462.8,4.998,1.587,5.261,3.56`},EPSG_4299:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4179:{towgs84:`33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84`},EPSG_4313:{towgs84:`-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747`},EPSG_4194:{towgs84:`163.511,127.533,-159.789`},EPSG_4195:{towgs84:`105,326,-102.5`},EPSG_4196:{towgs84:`-45,417,-3.5`},EPSG_4611:{towgs84:`-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246`},EPSG_4633:{towgs84:`137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824`},EPSG_4641:{towgs84:`-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993`},EPSG_4643:{towgs84:`-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002`},EPSG_4300:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4188:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4660:{towgs84:`982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805`},EPSG_4662:{towgs84:`97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259`},EPSG_3906:{towgs84:`577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664`},EPSG_4307:{towgs84:`-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547`},EPSG_6892:{towgs84:`-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686`},EPSG_4690:{towgs84:`221.597,152.441,176.523,2.403,1.3893,0.884,11.4648`},EPSG_4691:{towgs84:`218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817`},EPSG_4629:{towgs84:`72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653`},EPSG_4630:{towgs84:`165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111`},EPSG_4692:{towgs84:`217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093`},EPSG_9333:{towgs84:`0,0,0,-0.008393,0.000749,-0.010276,0`},EPSG_9059:{towgs84:`0,0,0`},EPSG_4312:{towgs84:`601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887`},EPSG_4123:{towgs84:`-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496`},EPSG_4309:{towgs84:`-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365`},ESRI_104106:{towgs84:`-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058`},EPSG_4281:{towgs84:`-219.247,-73.802,269.529`},EPSG_4322:{towgs84:`0,0,4.5`},EPSG_4324:{towgs84:`0,0,1.9`},EPSG_4284:{towgs84:`43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549`},EPSG_4277:{towgs84:`446.448,-125.157,542.06,0.15,0.247,0.842,-20.489`},EPSG_4207:{towgs84:`-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46`},EPSG_4688:{towgs84:`347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647`},EPSG_4689:{towgs84:`410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218`},EPSG_4720:{towgs84:`0,0,4.5`},EPSG_4273:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},EPSG_4240:{towgs84:`204.64,834.74,293.8`},EPSG_4817:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},ESRI_104131:{towgs84:`426.62,142.62,460.09,4.98,4.49,-12.42,-17.1`},EPSG_4265:{towgs84:`-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68`},EPSG_4263:{towgs84:`-111.92,-87.85,114.5,1.875,0.202,0.219,0.032`},EPSG_4298:{towgs84:`-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536`},EPSG_4270:{towgs84:`-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424`},EPSG_4229:{towgs84:`-121.8,98.1,-10.7`},EPSG_4220:{towgs84:`-55.5,-348,-229.2`},EPSG_4214:{towgs84:`12.646,-155.176,-80.863`},EPSG_4232:{towgs84:`-345,3,223`},EPSG_4238:{towgs84:`-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037`},EPSG_4168:{towgs84:`-170,33,326`},EPSG_4131:{towgs84:`199,931,318.9`},EPSG_4152:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_5228:{towgs84:`572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378`},EPSG_8351:{towgs84:`485.021,169.465,483.839,7.786342,4.397554,4.102655,0`},EPSG_4683:{towgs84:`-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06`},EPSG_4133:{towgs84:`0,0,0`},EPSG_7373:{towgs84:`0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693`},EPSG_9075:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9072:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9294:{towgs84:`1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388`},EPSG_4212:{towgs84:`-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492`},EPSG_4191:{towgs84:`-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703`},EPSG_4237:{towgs84:`52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191`},EPSG_4740:{towgs84:`-1.08,-0.27,-0.9`},EPSG_4124:{towgs84:`419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496`},EPSG_5681:{towgs84:`584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922`},EPSG_4141:{towgs84:`23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262`},EPSG_4204:{towgs84:`-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194`},EPSG_4319:{towgs84:`226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798`},EPSG_4200:{towgs84:`24.82,-131.21,-82.66`},EPSG_4130:{towgs84:`0,0,0`},EPSG_4127:{towgs84:`-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359`},EPSG_4149:{towgs84:`674.374,15.056,405.346`},EPSG_4617:{towgs84:`-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0`},EPSG_4663:{towgs84:`-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485`},EPSG_4664:{towgs84:`-211.939,137.626,58.3,-0.089,0.251,0.079,0.384`},EPSG_4665:{towgs84:`-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048`},EPSG_4666:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},EPSG_4756:{towgs84:`-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188`},EPSG_4723:{towgs84:`-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925`},EPSG_4726:{towgs84:`8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081`},EPSG_4267:{towgs84:`-8.0,160.0,176.0`},EPSG_5365:{towgs84:`-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693`},EPSG_4218:{towgs84:`304.5,306.5,-318.1`},EPSG_4242:{towgs84:`-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95`},EPSG_4216:{towgs84:`-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289`},ESRI_104105:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},ESRI_104129:{towgs84:`0,0,0`},EPSG_4673:{towgs84:`174.05,-25.49,112.57`},EPSG_4202:{towgs84:`-124,-60,154`},EPSG_4203:{towgs84:`-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191`},EPSG_3819:{towgs84:`595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408`},EPSG_8694:{towgs84:`-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169`},EPSG_4145:{towgs84:`275.57,676.78,229.6`},EPSG_4283:{towgs84:`0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994`},EPSG_4317:{towgs84:`2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063`},EPSG_4272:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`},EPSG_4248:{towgs84:`-307.7,265.3,-363.5`},EPSG_5561:{towgs84:`24,-121,-76`},EPSG_5233:{towgs84:`-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338`},ESRI_104130:{towgs84:`-86,-98,-119`},ESRI_104102:{towgs84:`682,-203,480`},ESRI_37207:{towgs84:`7,-10,-26`},EPSG_4675:{towgs84:`59.935,118.4,-10.871`},ESRI_104109:{towgs84:`-89.121,-348.182,260.871`},ESRI_104112:{towgs84:`-185.583,-230.096,281.361`},ESRI_104113:{towgs84:`25.1,-275.6,222.6`},IGNF_WGS72G:{towgs84:`0,12,6`},IGNF_NTFG:{towgs84:`-168,-60,320`},IGNF_EFATE57G:{towgs84:`-127,-769,472`},IGNF_PGP50G:{towgs84:`324.8,153.6,172.1`},IGNF_REUN47G:{towgs84:`94,-948,-1262`},IGNF_CSG67G:{towgs84:`-186,230,110`},IGNF_GUAD48G:{towgs84:`-467,-16,-300`},IGNF_TAHI51G:{towgs84:`162,117,154`},IGNF_TAHAAG:{towgs84:`65,342,77`},IGNF_NUKU72G:{towgs84:`84,274,65`},IGNF_PETRELS72G:{towgs84:`365,194,166`},IGNF_WALL78G:{towgs84:`253,-133,-127`},IGNF_MAYO50G:{towgs84:`-382,-59,-262`},IGNF_TANNAG:{towgs84:`-139,-967,436`},IGNF_IGN72G:{towgs84:`-13,-348,292`},IGNF_ATIGG:{towgs84:`1118,23,66`},IGNF_FANGA84G:{towgs84:`150.57,158.33,118.32`},IGNF_RUSAT84G:{towgs84:`202.13,174.6,-15.74`},IGNF_KAUE70G:{towgs84:`126.74,300.1,-75.49`},IGNF_MOP90G:{towgs84:`-10.8,-1.8,12.77`},IGNF_MHPF67G:{towgs84:`338.08,212.58,-296.17`},IGNF_TAHI79G:{towgs84:`160.61,116.05,153.69`},IGNF_ANAA92G:{towgs84:`1.5,3.84,4.81`},IGNF_MARQUI72G:{towgs84:`330.91,-13.92,58.56`},IGNF_APAT86G:{towgs84:`143.6,197.82,74.05`},IGNF_TUBU69G:{towgs84:`237.17,171.61,-77.84`},IGNF_STPM50G:{towgs84:`11.363,424.148,373.13`},EPSG_4150:{towgs84:`674.374,15.056,405.346`},EPSG_4754:{towgs84:`-208.4058,-109.8777,-2.5764`},ESRI_104101:{towgs84:`372.87,149.23,585.29`},EPSG_4693:{towgs84:`0,-0.15,0.68`},EPSG_6207:{towgs84:`293.17,726.18,245.36`},EPSG_4153:{towgs84:`-133.63,-157.5,-158.62`},EPSG_4132:{towgs84:`-241.54,-163.64,396.06`},EPSG_4221:{towgs84:`-154.5,150.7,100.4`},EPSG_4266:{towgs84:`-80.7,-132.5,41.1`},EPSG_4193:{towgs84:`-70.9,-151.8,-41.4`},EPSG_5340:{towgs84:`-0.41,0.46,-0.35`},EPSG_4246:{towgs84:`-294.7,-200.1,525.5`},EPSG_4318:{towgs84:`-3.2,-5.7,2.8`},EPSG_4121:{towgs84:`-199.87,74.79,246.62`},EPSG_4223:{towgs84:`-260.1,5.5,432.2`},EPSG_4158:{towgs84:`-0.465,372.095,171.736`},EPSG_4285:{towgs84:`-128.16,-282.42,21.93`},EPSG_4613:{towgs84:`-404.78,685.68,45.47`},EPSG_4607:{towgs84:`195.671,332.517,274.607`},EPSG_4475:{towgs84:`-381.788,-57.501,-256.673`},EPSG_4208:{towgs84:`-157.84,308.54,-146.6`},EPSG_4743:{towgs84:`70.995,-335.916,262.898`},EPSG_4710:{towgs84:`-323.65,551.39,-491.22`},EPSG_7881:{towgs84:`-0.077,0.079,0.086`},EPSG_4682:{towgs84:`283.729,735.942,261.143`},EPSG_4739:{towgs84:`-156,-271,-189`},EPSG_4679:{towgs84:`-80.01,253.26,291.19`},EPSG_4750:{towgs84:`-56.263,16.136,-22.856`},EPSG_4644:{towgs84:`-10.18,-350.43,291.37`},EPSG_4695:{towgs84:`-103.746,-9.614,-255.95`},EPSG_4292:{towgs84:`-355,21,72`},EPSG_4302:{towgs84:`-61.702,284.488,472.052`},EPSG_4143:{towgs84:`-124.76,53,466.79`},EPSG_4606:{towgs84:`-153,153,307`},EPSG_4699:{towgs84:`-770.1,158.4,-498.2`},EPSG_4247:{towgs84:`-273.5,110.6,-357.9`},EPSG_4160:{towgs84:`8.88,184.86,106.69`},EPSG_4161:{towgs84:`-233.43,6.65,173.64`},EPSG_9251:{towgs84:`-9.5,122.9,138.2`},EPSG_9253:{towgs84:`-78.1,101.6,133.3`},EPSG_4297:{towgs84:`-198.383,-240.517,-107.909`},EPSG_4269:{towgs84:`0,0,0`},EPSG_4301:{towgs84:`-147,506,687`},EPSG_4618:{towgs84:`-59,-11,-52`},EPSG_4612:{towgs84:`0,0,0`},EPSG_4678:{towgs84:`44.585,-131.212,-39.544`},EPSG_4250:{towgs84:`-130,29,364`},EPSG_4144:{towgs84:`214,804,268`},EPSG_4147:{towgs84:`-17.51,-108.32,-62.39`},EPSG_4259:{towgs84:`-254.1,-5.36,-100.29`},EPSG_4164:{towgs84:`-76,-138,67`},EPSG_4211:{towgs84:`-378.873,676.002,-46.255`},EPSG_4182:{towgs84:`-422.651,-172.995,84.02`},EPSG_4224:{towgs84:`-143.87,243.37,-33.52`},EPSG_4225:{towgs84:`-205.57,168.77,-4.12`},EPSG_5527:{towgs84:`-67.35,3.88,-38.22`},EPSG_4752:{towgs84:`98,390,-22`},EPSG_4310:{towgs84:`-30,190,89`},EPSG_9248:{towgs84:`-192.26,65.72,132.08`},EPSG_4680:{towgs84:`124.5,-63.5,-281`},EPSG_4701:{towgs84:`-79.9,-158,-168.9`},EPSG_4706:{towgs84:`-146.21,112.63,4.05`},EPSG_4805:{towgs84:`682,-203,480`},EPSG_4201:{towgs84:`-165,-11,206`},EPSG_4210:{towgs84:`-157,-2,-299`},EPSG_4183:{towgs84:`-104,167,-38`},EPSG_4139:{towgs84:`11,72,-101`},EPSG_4668:{towgs84:`-86,-98,-119`},EPSG_4717:{towgs84:`-2,151,181`},EPSG_4732:{towgs84:`102,52,-38`},EPSG_4280:{towgs84:`-377,681,-50`},EPSG_4209:{towgs84:`-138,-105,-289`},EPSG_4261:{towgs84:`31,146,47`},EPSG_4658:{towgs84:`-73,46,-86`},EPSG_4721:{towgs84:`265.025,384.929,-194.046`},EPSG_4222:{towgs84:`-136,-108,-292`},EPSG_4601:{towgs84:`-255,-15,71`},EPSG_4602:{towgs84:`725,685,536`},EPSG_4603:{towgs84:`72,213.7,93`},EPSG_4605:{towgs84:`9,183,236`},EPSG_4621:{towgs84:`137,248,-430`},EPSG_4657:{towgs84:`-28,199,5`},EPSG_4316:{towgs84:`103.25,-100.4,-307.19`},EPSG_4642:{towgs84:`-13,-348,292`},EPSG_4698:{towgs84:`145,-187,103`},EPSG_4192:{towgs84:`-206.1,-174.7,-87.7`},EPSG_4311:{towgs84:`-265,120,-358`},EPSG_4135:{towgs84:`58,-283,-182`},ESRI_104138:{towgs84:`198,-226,-347`},EPSG_4245:{towgs84:`-11,851,5`},EPSG_4142:{towgs84:`-125,53,467`},EPSG_4213:{towgs84:`-106,-87,188`},EPSG_4253:{towgs84:`-133,-77,-51`},EPSG_4129:{towgs84:`-132,-110,-335`},EPSG_4713:{towgs84:`-77,-128,142`},EPSG_4239:{towgs84:`217,823,299`},EPSG_4146:{towgs84:`295,736,257`},EPSG_4155:{towgs84:`-83,37,124`},EPSG_4165:{towgs84:`-173,253,27`},EPSG_4672:{towgs84:`175,-38,113`},EPSG_4236:{towgs84:`-637,-549,-203`},EPSG_4251:{towgs84:`-90,40,88`},EPSG_4271:{towgs84:`-2,374,172`},EPSG_4175:{towgs84:`-88,4,101`},EPSG_4716:{towgs84:`298,-304,-375`},EPSG_4315:{towgs84:`-23,259,-9`},EPSG_4744:{towgs84:`-242.2,-144.9,370.3`},EPSG_4244:{towgs84:`-97,787,86`},EPSG_4293:{towgs84:`616,97,-251`},EPSG_4714:{towgs84:`-127,-769,472`},EPSG_4736:{towgs84:`260,12,-147`},EPSG_6883:{towgs84:`-235,-110,393`},EPSG_6894:{towgs84:`-63,176,185`},EPSG_4205:{towgs84:`-43,-163,45`},EPSG_4256:{towgs84:`41,-220,-134`},EPSG_4262:{towgs84:`639,405,60`},EPSG_4604:{towgs84:`174,359,365`},EPSG_4169:{towgs84:`-115,118,426`},EPSG_4620:{towgs84:`-106,-129,165`},EPSG_4184:{towgs84:`-203,141,53`},EPSG_4616:{towgs84:`-289,-124,60`},EPSG_9403:{towgs84:`-307,-92,127`},EPSG_4684:{towgs84:`-133,-321,50`},EPSG_4708:{towgs84:`-491,-22,435`},EPSG_4707:{towgs84:`114,-116,-333`},EPSG_4709:{towgs84:`145,75,-272`},EPSG_4712:{towgs84:`-205,107,53`},EPSG_4711:{towgs84:`124,-234,-25`},EPSG_4718:{towgs84:`230,-199,-752`},EPSG_4719:{towgs84:`211,147,111`},EPSG_4724:{towgs84:`208,-435,-229`},EPSG_4725:{towgs84:`189,-79,-202`},EPSG_4735:{towgs84:`647,1777,-1124`},EPSG_4722:{towgs84:`-794,119,-298`},EPSG_4728:{towgs84:`-307,-92,127`},EPSG_4734:{towgs84:`-632,438,-609`},EPSG_4727:{towgs84:`912,-58,1227`},EPSG_4729:{towgs84:`185,165,42`},EPSG_4730:{towgs84:`170,42,84`},EPSG_4733:{towgs84:`276,-57,149`},ESRI_37218:{towgs84:`230,-199,-752`},ESRI_37240:{towgs84:`-7,215,225`},ESRI_37221:{towgs84:`252,-209,-751`},ESRI_4305:{towgs84:`-123,-206,219`},ESRI_104139:{towgs84:`-73,-247,227`},EPSG_4748:{towgs84:`51,391,-36`},EPSG_4219:{towgs84:`-384,664,-48`},EPSG_4255:{towgs84:`-333,-222,114`},EPSG_4257:{towgs84:`-587.8,519.75,145.76`},EPSG_4646:{towgs84:`-963,510,-359`},EPSG_6881:{towgs84:`-24,-203,268`},EPSG_6882:{towgs84:`-183,-15,273`},EPSG_4715:{towgs84:`-104,-129,239`},IGNF_RGF93GDD:{towgs84:`0,0,0`},IGNF_RGM04GDD:{towgs84:`0,0,0`},IGNF_RGSPM06GDD:{towgs84:`0,0,0`},IGNF_RGTAAF07GDD:{towgs84:`0,0,0`},IGNF_RGFG95GDD:{towgs84:`0,0,0`},IGNF_RGNCG:{towgs84:`0,0,0`},IGNF_RGPFGDD:{towgs84:`0,0,0`},IGNF_ETRS89G:{towgs84:`0,0,0`},IGNF_RGR92GDD:{towgs84:`0,0,0`},EPSG_4173:{towgs84:`0,0,0`},EPSG_4180:{towgs84:`0,0,0`},EPSG_4619:{towgs84:`0,0,0`},EPSG_4667:{towgs84:`0,0,0`},EPSG_4075:{towgs84:`0,0,0`},EPSG_6706:{towgs84:`0,0,0`},EPSG_7798:{towgs84:`0,0,0`},EPSG_4661:{towgs84:`0,0,0`},EPSG_4669:{towgs84:`0,0,0`},EPSG_8685:{towgs84:`0,0,0`},EPSG_4151:{towgs84:`0,0,0`},EPSG_9702:{towgs84:`0,0,0`},EPSG_4758:{towgs84:`0,0,0`},EPSG_4761:{towgs84:`0,0,0`},EPSG_4765:{towgs84:`0,0,0`},EPSG_8997:{towgs84:`0,0,0`},EPSG_4023:{towgs84:`0,0,0`},EPSG_4670:{towgs84:`0,0,0`},EPSG_4694:{towgs84:`0,0,0`},EPSG_4148:{towgs84:`0,0,0`},EPSG_4163:{towgs84:`0,0,0`},EPSG_4167:{towgs84:`0,0,0`},EPSG_4189:{towgs84:`0,0,0`},EPSG_4190:{towgs84:`0,0,0`},EPSG_4176:{towgs84:`0,0,0`},EPSG_4659:{towgs84:`0,0,0`},EPSG_3824:{towgs84:`0,0,0`},EPSG_3889:{towgs84:`0,0,0`},EPSG_4046:{towgs84:`0,0,0`},EPSG_4081:{towgs84:`0,0,0`},EPSG_4558:{towgs84:`0,0,0`},EPSG_4483:{towgs84:`0,0,0`},EPSG_5013:{towgs84:`0,0,0`},EPSG_5264:{towgs84:`0,0,0`},EPSG_5324:{towgs84:`0,0,0`},EPSG_5354:{towgs84:`0,0,0`},EPSG_5371:{towgs84:`0,0,0`},EPSG_5373:{towgs84:`0,0,0`},EPSG_5381:{towgs84:`0,0,0`},EPSG_5393:{towgs84:`0,0,0`},EPSG_5489:{towgs84:`0,0,0`},EPSG_5593:{towgs84:`0,0,0`},EPSG_6135:{towgs84:`0,0,0`},EPSG_6365:{towgs84:`0,0,0`},EPSG_5246:{towgs84:`0,0,0`},EPSG_7886:{towgs84:`0,0,0`},EPSG_8431:{towgs84:`0,0,0`},EPSG_8427:{towgs84:`0,0,0`},EPSG_8699:{towgs84:`0,0,0`},EPSG_8818:{towgs84:`0,0,0`},EPSG_4757:{towgs84:`0,0,0`},EPSG_9140:{towgs84:`0,0,0`},EPSG_8086:{towgs84:`0,0,0`},EPSG_4686:{towgs84:`0,0,0`},EPSG_4737:{towgs84:`0,0,0`},EPSG_4702:{towgs84:`0,0,0`},EPSG_4747:{towgs84:`0,0,0`},EPSG_4749:{towgs84:`0,0,0`},EPSG_4674:{towgs84:`0,0,0`},EPSG_4755:{towgs84:`0,0,0`},EPSG_4759:{towgs84:`0,0,0`},EPSG_4762:{towgs84:`0,0,0`},EPSG_4763:{towgs84:`0,0,0`},EPSG_4764:{towgs84:`0,0,0`},EPSG_4166:{towgs84:`0,0,0`},EPSG_4170:{towgs84:`0,0,0`},EPSG_5546:{towgs84:`0,0,0`},EPSG_7844:{towgs84:`0,0,0`},EPSG_4818:{towgs84:`589,76,480`},EPSG_10328:{towgs84:`0,0,0`},EPSG_9782:{towgs84:`0,0,0`},EPSG_9777:{towgs84:`0,0,0`},EPSG_10690:{towgs84:`0,0,0`},EPSG_10639:{towgs84:`0,0,0`},EPSG_10739:{towgs84:`0,0,0`},EPSG_7686:{towgs84:`0,0,0`},EPSG_8900:{towgs84:`0,0,0`},EPSG_5886:{towgs84:`0,0,0`},EPSG_7683:{towgs84:`0,0,0`},EPSG_6668:{towgs84:`0,0,0`},EPSG_20046:{towgs84:`0,0,0`},EPSG_10299:{towgs84:`0,0,0`},EPSG_10310:{towgs84:`0,0,0`},EPSG_10475:{towgs84:`0,0,0`},EPSG_4742:{towgs84:`0,0,0`},EPSG_10671:{towgs84:`0,0,0`},EPSG_10762:{towgs84:`0,0,0`},EPSG_10725:{towgs84:`0,0,0`},EPSG_10791:{towgs84:`0,0,0`},EPSG_10800:{towgs84:`0,0,0`},EPSG_10305:{towgs84:`0,0,0`},EPSG_10941:{towgs84:`0,0,0`},EPSG_10968:{towgs84:`0,0,0`},EPSG_10875:{towgs84:`0,0,0`},EPSG_6318:{towgs84:`0,0,0`},EPSG_10910:{towgs84:`0,0,0`}};for(var bt in yt){var xt=yt[bt];xt.datumName&&(yt[xt.datumName]=xt)}function St(e,t,n,r,i,a,o){var s={};return s.datum_type=5,t&&(s.datum_type=4,s.datum_params=t.map(parseFloat),(s.datum_params[0]!==0||s.datum_params[1]!==0||s.datum_params[2]!==0)&&(s.datum_type=1),s.datum_params.length>3&&(s.datum_params[3]!==0||s.datum_params[4]!==0||s.datum_params[5]!==0||s.datum_params[6]!==0)&&(s.datum_type=2,s.datum_params[3]*=F,s.datum_params[4]*=F,s.datum_params[5]*=F,s.datum_params[6]=s.datum_params[6]/1e6+1)),o&&(s.datum_type=3,s.grids=o),s.a=n,s.b=r,s.es=i,s.ep2=a,s}var Ct={};function wt(e,t,n){return t instanceof ArrayBuffer?Tt(e,t,n):{ready:Et(e,t)}}function Tt(e,t,n){var r=!0;n!==void 0&&n.includeErrorFields===!1&&(r=!1);var i=new DataView(t),a=jt(i),o=Mt(i,a),s={header:o,subgrids:Pt(i,o,a,r)};return Ct[e]=s,s}async function Et(e,t){for(var n=[],r=await t.getImageCount(),i=r-1;i>=0;i--){var a=await t.getImage(i),o=await a.readRasters(),s=[a.getWidth(),a.getHeight()],c=a.getBoundingBox().map(kt),l=typeof a.fileDirectory.getValue==`function`?a.fileDirectory.getValue(`ModelPixelScale`):a.fileDirectory.ModelPixelScale,u=[l[0],l[1]].map(kt),d=c[0]+(s[0]-1)*u[0],f=c[3]-(s[1]-1)*u[1],p=o[0],m=o[1],h=[];for(let e=s[1]-1;e>=0;e--)for(let t=s[0]-1;t>=0;t--){var g=e*s[0]+t;h.push([-At(m[g]),At(p[g])])}n.push({del:u,lim:s,ll:[-d,f],cvs:h})}var _={header:{nSubgrids:r},subgrids:n};return Ct[e]=_,_}function Dt(e){return e===void 0?null:e.split(`,`).map(Ot)}function Ot(e){if(e.length===0)return null;var t=e[0]===`@`;return t&&(e=e.slice(1)),e===`null`?{name:`null`,mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:Ct[e]||null,isNull:!1}}function kt(e){return e*Math.PI/180}function At(e){return e/3600*Math.PI/180}function jt(e){var t=e.getInt32(8,!1);return t!==11&&(t=e.getInt32(8,!0),t!==11&&console.warn(`Failed to detect nadgrid endian-ness, defaulting to little-endian`),!0)}function Mt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Nt(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function Nt(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function Pt(e,t,n,r){for(var i=176,a=[],o=0;o<t.nSubgrids;o++){var s=It(e,i,n),c=Lt(e,i,s,n,r),l=Math.round(1+(s.upperLongitude-s.lowerLongitude)/s.longitudeInterval),u=Math.round(1+(s.upperLatitude-s.lowerLatitude)/s.latitudeInterval);a.push({ll:[At(s.lowerLongitude),At(s.lowerLatitude)],del:[At(s.longitudeInterval),At(s.latitudeInterval)],lim:[l,u],count:s.gridNodeCount,cvs:Ft(c)});var d=16;r===!1&&(d=8),i+=176+s.gridNodeCount*d}return a}function Ft(e){return e.map(function(e){return[At(e.longitudeShift),At(e.latitudeShift)]})}function It(e,t,n){return{name:Nt(e,t+8,t+16).trim(),parent:Nt(e,t+24,t+24+8).trim(),lowerLatitude:e.getFloat64(t+72,n),upperLatitude:e.getFloat64(t+88,n),lowerLongitude:e.getFloat64(t+104,n),upperLongitude:e.getFloat64(t+120,n),latitudeInterval:e.getFloat64(t+136,n),longitudeInterval:e.getFloat64(t+152,n),gridNodeCount:e.getInt32(t+168,n)}}function Lt(e,t,n,r,i){var a=t+176,o=16;i===!1&&(o=8);for(var s=[],c=0;c<n.gridNodeCount;c++){var l={latitudeShift:e.getFloat32(a+c*o,r),longitudeShift:e.getFloat32(a+c*o+4,r)};i!==!1&&(l.latitudeAccuracy=e.getFloat32(a+c*o+8,r),l.longitudeAccuracy=e.getFloat32(a+c*o+12,r)),s.push(l)}return s}function K(e,t){if(!(this instanceof K))return new K(e);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,t||=function(e){if(e)throw e};var n=Ye(e);if(typeof n!=`object`)t(`Could not parse to valid json: `+e);else{var r=K.projections.get(n.projName);if(!r)t(`Could not get projection name from: `+e);else{if(n.datumCode&&n.datumCode!==`none`){var i=ue(yt,n.datumCode);i&&(n.datum_params=n.datum_params||(i.towgs84?i.towgs84.split(`,`):null),n.ellps=i.ellipse,n.datumName=i.datumName?i.datumName:n.datumCode)}n.axis=n.axis||`enu`,n.ellps=n.ellps||`wgs84`,n.lat1=n.lat1||n.lat0;var a=vt(n.a,n.b,n.rf,n.ellps,n.sphere),o=_t(a.a,a.b,a.rf,n.R_A),s=Dt(n.nadgrids),c=n.datum||St(n.datumCode,n.datum_params,a.a,a.b,o.es,o.ep2,s);Xe(this,n),Xe(this,r),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=c,`init`in this&&typeof this.init==`function`&&this.init(),this.k0||=1,t(null,this)}}}K.projections=mt,K.projections.start();function Rt(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===1?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type!==2||e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]}function zt(e,t,n){var r=e.x,i=e.y,a=e.z?e.z:0,o,s,c,l;if(i<-I&&i>-1.001*I)i=-I;else if(i>I&&i<1.001*I)i=I;else if(i<-I)return{x:-1/0,y:-1/0,z:e.z};else if(i>I)return{x:1/0,y:1/0,z:e.z};return r>Math.PI&&(r-=2*Math.PI),s=Math.sin(i),l=Math.cos(i),c=s*s,o=n/Math.sqrt(1-t*c),{x:(o+a)*l*Math.cos(r),y:(o+a)*l*Math.sin(r),z:(o*(1-t)+a)*s}}function Bt(e,t,n,r){var i=1e-12,a=i*i,o=30,s,c,l,u,d,f,p,m,h,g,_,v,y,b=e.x,x=e.y,S=e.z?e.z:0,C,w,T;if(s=Math.sqrt(b*b+x*x),c=Math.sqrt(b*b+x*x+S*S),s/n<i){if(C=0,c/n<i)return w=I,T=-r,{x:e.x,y:e.y,z:e.z}}else C=Math.atan2(x,b);l=S/c,u=s/c,d=1/Math.sqrt(1-t*(2-t)*u*u),m=u*(1-t)*d,h=l*d,y=0;do y++,p=n/Math.sqrt(1-t*h*h),T=s*m+S*h-p*(1-t*h*h),f=t*p/(p+T),d=1/Math.sqrt(1-f*(2-f)*u*u),g=u*(1-f)*d,_=l*d,v=_*m-g*h,m=g,h=_;while(v*v>a&&y<o);return w=Math.atan(_/Math.abs(g)),{x:C,y:w,z:T}}function Vt(e,t,n){if(t===1)return{x:e.x+n[0],y:e.y+n[1],z:e.z+n[2]};if(t===2){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6];return{x:l*(e.x-c*e.y+s*e.z)+r,y:l*(c*e.x+e.y-o*e.z)+i,z:l*(-s*e.x+o*e.y+e.z)+a}}}function Ht(e,t,n){if(t===1)return{x:e.x-n[0],y:e.y-n[1],z:e.z-n[2]};if(t===2){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=(e.x-r)/l,d=(e.y-i)/l,f=(e.z-a)/l;return{x:u+c*d-s*f,y:-c*u+d+o*f,z:s*u-o*d+f}}}function Ut(e){return e===1||e===2}function Wt(e,t,n){if(Rt(e,t)||e.datum_type===5||t.datum_type===5)return n;var r=e.a,i=e.es;if(e.datum_type===3){if(Gt(e,!1,n)!==0)return;r=N,i=ne}var a=t.a,o=t.b,s=t.es;if(t.datum_type===3&&(a=N,o=P,s=ne),i===s&&r===a&&!Ut(e.datum_type)&&!Ut(t.datum_type)||(n=zt(n,i,r),Ut(e.datum_type)&&(n=Vt(n,e.datum_type,e.datum_params)),Ut(t.datum_type)&&(n=Ht(n,t.datum_type,t.datum_params)),n=Bt(n,s,a,o),t.datum_type!==3||Gt(t,!0,n)===0))return n}function Gt(e,t,n){if(e.grids===null||e.grids.length===0)return console.log(`Grid shift grids not found`),-1;var r={x:-n.x,y:n.y},i={x:NaN,y:NaN},a=[];outer:for(var o=0;o<e.grids.length;o++){var s=e.grids[o];if(a.push(s.name),s.isNull){i=r;break}if(s.grid===null){if(s.mandatory)return console.log(`Unable to find mandatory grid '`+s.name+`'`),-1}else for(var c=s.grid.subgrids,l=0,u=c.length;l<u;l++){var d=c[l],f=(Math.abs(d.del[1])+Math.abs(d.del[0]))/1e4,p=d.ll[0]-f,m=d.ll[1]-f,h=d.ll[0]+(d.lim[0]-1)*d.del[0]+f,g=d.ll[1]+(d.lim[1]-1)*d.del[1]+f;if(!(m>r.y||p>r.x||g<r.y||h<r.x)&&(i=Kt(r,t,d),!isNaN(i.x)))break outer}}return isNaN(i.x)?(console.log(`Failed to find a grid shift table for location '`+-r.x*R+` `+r.y*R+` tried: '`+a+`'`),-1):(n.x=-i.x,n.y=i.y,0)}function Kt(e,t,n){var r={x:NaN,y:NaN};if(isNaN(e.x))return r;var i={x:e.x,y:e.y};i.x-=n.ll[0],i.y-=n.ll[1],i.x=W(i.x-Math.PI)+Math.PI;var a=qt(i,n);if(t){if(isNaN(a.x))return r;a.x=i.x-a.x,a.y=i.y-a.y;var o=9,s=1e-12,c,l;do{if(l=qt(a,n),isNaN(l.x)){console.log(`Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.`);break}c={x:i.x-(l.x+a.x),y:i.y-(l.y+a.y)},a.x+=c.x,a.y+=c.y}while(o--&&Math.abs(c.x)>s&&Math.abs(c.y)>s);if(o<0)return console.log(`Inverse grid shift iterator failed to converge.`),r;r.x=W(a.x+n.ll[0]),r.y=a.y+n.ll[1]}else isNaN(a.x)||(r.x=e.x+a.x,r.y=e.y+a.y);return r}function qt(e,t){var n={x:e.x/t.del[0],y:e.y/t.del[1]},r={x:Math.floor(n.x),y:Math.floor(n.y)},i={x:n.x-1*r.x,y:n.y-1*r.y},a={x:NaN,y:NaN},o;if(r.x<0||r.x>=t.lim[0]||r.y<0||r.y>=t.lim[1])return a;o=r.y*t.lim[0]+r.x;var s={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var l={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var u={x:t.cvs[o][0],y:t.cvs[o][1]},d=i.x*i.y,f=i.x*(1-i.y),p=(1-i.x)*(1-i.y),m=(1-i.x)*i.y;return a.x=p*s.x+f*c.x+m*u.x+d*l.x,a.y=p*s.y+f*c.y+m*u.y+d*l.y,a}var Jt=[`x`,`y`,`z`];function Yt(e,t){let n={};for(let r=0,i=e.axis.length;r<i;r++){if(r===2&&t.z===void 0)continue;let i=t[Jt[r]];switch(e.axis[r]){case`e`:n.x=i;break;case`w`:n.x=-i;break;case`n`:n.y=i;break;case`s`:n.y=-i;break;case`u`:n.z=i;break;case`d`:n.z=-i;break;default:return null}}return n}function Xt(e,t){let n={};for(let r=0,i=e.axis.length;r<i;r++)if(r!==2||t.z!==void 0)switch(e.axis[r]){case`e`:n[Jt[r]]=t.x;break;case`w`:n[Jt[r]]=-t.x;break;case`n`:n[Jt[r]]=t.y;break;case`s`:n[Jt[r]]=-t.y;break;case`u`:n[Jt[r]]=t.z;break;case`d`:n[Jt[r]]=-t.z;break;default:return null}return n}function Zt(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function Qt(e){$t(e.x),$t(e.y)}function $t(e){if(typeof Number.isFinite==`function`){if(Number.isFinite(e))return;throw TypeError(`coordinates must be finite numbers`)}if(typeof e!=`number`||e!==e||!isFinite(e))throw TypeError(`coordinates must be finite numbers`)}function en(e,t){return(e.datum.datum_type===1||e.datum.datum_type===2||e.datum.datum_type===3)&&t.datumCode!==`WGS84`||(t.datum.datum_type===1||t.datum.datum_type===2||t.datum.datum_type===3)&&e.datumCode!==`WGS84`}function tn(e,t,n,r){var i,a=n.z!==void 0;if(Qt(n),e.datum&&t.datum&&en(e,t)&&(i=new K(`WGS84`),n=tn(e,i,n,r),e=i),r&&e.axis!==`enu`&&(n=Yt(e,n)),e.projName===`longlat`)n={x:n.x*L,y:n.y*L,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),n=e.inverse(n),!n)return;if(e.from_greenwich&&(n.x+=e.from_greenwich),n=Wt(e.datum,t.datum,n),n)return n=n,t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),t.projName===`longlat`?(t.long_wrap!==void 0&&(n.x=t.long_wrap+W(n.x-t.long_wrap)),n={x:n.x*R,y:n.y*R,z:n.z||0}):(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),r&&t.axis!==`enu`?Xt(t,n):(n&&!a&&t.projName!==`geocent`&&delete n.z,n)}function nn(e,t,n,r){return tn(e,t,Array.isArray(n)?Zt(n):{x:n.x,y:n.y,z:n.z,m:n.m},r)}var rn=K(`WGS84`);function an(e,t,n,r){var i,a,o;return Array.isArray(n)?(i=tn(e,t,Zt(n),r)||{x:NaN,y:NaN},n.length>2?(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,a?typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y,n[2]].concat(n.slice(3)):r&&typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y].concat(n.slice(2))):[i.x,i.y]):(i=tn(e,t,{x:n.x,y:n.y,z:n.z,m:n.m},r)||{x:NaN,y:NaN},o=Object.keys(n),o.length===2||(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,o.forEach(function(e){e!==`x`&&e!==`y`&&(e!==`z`||!a&&!r)&&(i[e]=n[e])})),i)}function on(e){return e instanceof K?e:typeof e==`object`&&`oProj`in e?e.oProj:K(e)}function sn(e,t,n){var r,i,a=!1,o;return t===void 0?(i=on(e),r=rn,a=!0):(t.x!==void 0||Array.isArray(t))&&(n=t,i=on(e),r=rn,a=!0),r||=on(e),i||=on(t),n?an(r,i,n):(o={forward:function(e,t){return an(r,i,e,t)},inverse:function(e,t){return an(i,r,e,t)}},a&&(o.oProj=i),o)}var cn=6,ln=`AJSAJS`,un=`AFAFAF`,dn=65,q=73,J=79,fn=86,pn=90,mn={forward:hn,inverse:gn,toPoint:_n};function hn(e,t){return t||=5,Cn(bn({lat:e[1],lon:e[0]}),t)}function gn(e){var t=xn(Dn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function _n(e){var t=xn(Dn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function vn(e){return Math.PI/180*e}function yn(e){return e/Math.PI*180}function bn(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,a=.9996,o,s,c,l,u,d,f,p=vn(t),m=vn(n),h,g=Math.floor((n+180)/6)+1;n===180&&(g=60),t>=56&&t<64&&n>=3&&n<12&&(g=32),t>=72&&t<84&&(n>=0&&n<9?g=31:n>=9&&n<21?g=33:n>=21&&n<33?g=35:n>=33&&n<42&&(g=37)),o=(g-1)*6-180+3,h=vn(o),s=i/(1-i),c=r/Math.sqrt(1-i*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),u=s*Math.cos(p)*Math.cos(p),d=Math.cos(p)*(m-h),f=r*((1-i/4-3*i*i/64-5*i*i*i/256)*p-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*p)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*p)-35*i*i*i/3072*Math.sin(6*p));var _=a*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-58*s)*d*d*d*d*d/120)+5e5,v=a*(f+c*Math.tan(p)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-330*s)*d*d*d*d*d*d/720));return t<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(_),zoneNumber:g,zoneLetter:Sn(t)}}function xn(e){var t=e.northing,n=e.easting,r=e.zoneLetter,i=e.zoneNumber;if(i<0||i>60)return null;var a=.9996,o=6378137,s=.00669438,c,l=(1-Math.sqrt(1-s))/(1+Math.sqrt(1-s)),u,d,f,p,m,h,g,_,v,y=n-5e5,b=t;r<`N`&&(b-=1e7),g=(i-1)*6-180+3,c=s/(1-s),h=b/a,_=h/(o*(1-s/4-3*s*s/64-5*s*s*s/256)),v=_+(3*l/2-27*l*l*l/32)*Math.sin(2*_)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*_)+151*l*l*l/96*Math.sin(6*_),u=o/Math.sqrt(1-s*Math.sin(v)*Math.sin(v)),d=Math.tan(v)*Math.tan(v),f=c*Math.cos(v)*Math.cos(v),p=o*(1-s)/(1-s*Math.sin(v)*Math.sin(v))**1.5,m=y/(u*a);var x=v-u*Math.tan(v)/p*(m*m/2-(5+3*d+10*f-4*f*f-9*c)*m*m*m*m/24+(61+90*d+298*f+45*d*d-252*c-3*f*f)*m*m*m*m*m*m/720);x=yn(x);var S=(m-(1+2*d+f)*m*m*m/6+(5-2*f+28*d-3*f*f+8*c+24*d*d)*m*m*m*m*m/120)/Math.cos(v);S=g+yn(S);var C;if(e.accuracy){var w=xn({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});C={top:w.lat,right:w.lon,bottom:x,left:S}}else C={lat:x,lon:S};return C}function Sn(e){var t=`Z`;return 84>=e&&e>=72?t=`X`:72>e&&e>=64?t=`W`:64>e&&e>=56?t=`V`:56>e&&e>=48?t=`U`:48>e&&e>=40?t=`T`:40>e&&e>=32?t=`S`:32>e&&e>=24?t=`R`:24>e&&e>=16?t=`Q`:16>e&&e>=8?t=`P`:8>e&&e>=0?t=`N`:0>e&&e>=-8?t=`M`:-8>e&&e>=-16?t=`L`:-16>e&&e>=-24?t=`K`:-24>e&&e>=-32?t=`J`:-32>e&&e>=-40?t=`H`:-40>e&&e>=-48?t=`G`:-48>e&&e>=-56?t=`F`:-56>e&&e>=-64?t=`E`:-64>e&&e>=-72?t=`D`:-72>e&&e>=-80&&(t=`C`),t}function Cn(e,t){var n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+wn(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function wn(e,t,n){var r=Tn(n);return En(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}function Tn(e){var t=e%cn;return t===0&&(t=cn),t}function En(e,t,n){var r=n-1,i=ln.charCodeAt(r),a=un.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>pn&&(o=o-pn+dn-1,c=!0),(o===q||i<q&&o>q||(o>q||i<q)&&c)&&o++,(o===J||i<J&&o>J||(o>J||i<J)&&c)&&(o++,o===q&&o++),o>pn&&(o=o-pn+dn-1),s>fn?(s=s-fn+dn-1,c=!0):c=!1,(s===q||a<q&&s>q||(s>q||a<q)&&c)&&s++,(s===J||a<J&&s>J||(s>J||a<J)&&c)&&(s++,s===q&&s++),s>fn&&(s=s-fn+dn-1),String.fromCharCode(o)+String.fromCharCode(s)}function Dn(e){if(e&&e.length===0)throw`MGRSPoint coverting from nothing`;for(var t=e.length,n=null,r=``,i,a=0;!/[A-Z]/.test(i=e.charAt(a));){if(a>=2)throw`MGRSPoint bad conversion from: `+e;r+=i,a++}var o=parseInt(r,10);if(a===0||a+3>t)throw`MGRSPoint bad conversion from: `+e;var s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw`MGRSPoint zone letter `+s+` not handled: `+e;n=e.substring(a,a+=2);for(var c=Tn(o),l=On(n.charAt(0),c),u=kn(n.charAt(1),c);u<An(s);)u+=2e6;var d=t-a;if(d%2!=0)throw`MGRSPoint has to have an even number
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dist-DSgZUDDY.cjs");let t=require("vue"),n=require("three"),r=require("three/addons/loaders/GLTFLoader.js"),i=require("three/addons/controls/OrbitControls.js"),a=require("three/addons/postprocessing/EffectComposer.js"),o=require("three/addons/postprocessing/OutputPass.js"),s=require("three/addons/postprocessing/RenderPass.js"),c=require("three/addons/postprocessing/OutlinePass.js");function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){let t=2166136261,n=2246822507;for(let r of e){for(let e of[0,8,16,24]){let i=r.length>>>e&255;t=Math.imul(t^i,16777619),n=Math.imul(n^i,3266489909)}for(let e of r)t=Math.imul(t^e,16777619),n=Math.imul(n^e,3266489909)}return`resource-${(t>>>0).toString(16).padStart(8,`0`)}${(n>>>0).toString(16).padStart(8,`0`)}`}function d(e){let t=new Set,n=new Set,r=new Set,i=new Set;e.traverse(e=>{if(e?.isMesh===!0){t.add(e.geometry);for(let t of Array.isArray(e.material)?e.material:[e.material]){n.add(t);for(let e of Object.values(t))e?.isTexture===!0&&r.add(e)}}}),t.forEach(e=>e.dispose()),n.forEach(e=>e.dispose()),r.forEach(e=>{let t=e.source.data;for(let e of Array.isArray(t)?t:[t])typeof ImageBitmap<`u`&&e instanceof ImageBitmap&&i.add(e);e.dispose()}),i.forEach(e=>e.close()),e.removeFromParent()}async function f(e,t){let n=await fetch(e,{signal:t,cache:`no-store`});if(!n.ok)throw Error(`资源读取失败(HTTP ${n.status}):${e}`);if(n.headers.get(`content-type`)?.includes(`text/html`))throw Error(`资源返回了 HTML:${e}`);return new Uint8Array(await n.arrayBuffer())}function p(e){return JSON.parse(new TextDecoder().decode(e))}function m(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length>=20&&t.getUint32(0,!0)===1179937895){let n=t.getUint32(12,!0);return p(e.subarray(20,20+n))}let n=p(e);if(!l(n))throw Error(`glTF 根节点无效`);return n}async function h(e,t,i){let a=new URL(e.manifestUrl,globalThis.location?.href).href;if(!/^https?:/.test(a))throw Error(`Manifest 必须是 HTTP/HTTPS 地址`);i(`正在读取模型清单`);let o=await f(a,t),s=p(o);if(!l(s)||s.version!==`1.0.0`||typeof s.entry!=`string`)throw Error(`Manifest 格式无效或版本不支持`);let c=new URL(s.entry,a).href;if(!/\.(glb|gltf)$/i.test(new URL(c).pathname))throw Error(`本版支持 GLB 和 glTF 模型`);let h=[],g=async e=>{let n=s[e];if(typeof n!=`string`)return new Uint8Array;try{let r=await f(new URL(n,a).href,t),i=p(r);if(e===`properties`&&!l(i))throw Error(`properties 必须是按构件名称索引的对象`);if(e===`hierarchy`){let e=Array.isArray(i)?i:l(i)?i.root:null;if(!Array.isArray(e))throw Error(`hierarchy 必须提供 root 数组或根节点数组`);let t=[...e];for(;t.length;){let e=t.pop();if(!l(e)||e.name!==void 0&&typeof e.name!=`string`||e.children!==void 0&&!Array.isArray(e.children))throw Error(`hierarchy 节点格式无效`);Array.isArray(e.children)&&t.push(...e.children)}}return r}catch(n){return t.throwIfAborted(),h.push(`${e} 未能读取,已继续加载模型:${n instanceof Error?n.message:String(n)}`),new Uint8Array}};i(`正在下载模型和属性`);let[_,v,y]=await Promise.all([f(c,t),g(`hierarchy`),g(`properties`)]);t.throwIfAborted();let b=m(_),x=[o,_,v,y],S=[],C=new n.LoadingManager;C.onError=e=>h.push(`贴图加载失败:${e.startsWith(`blob:`)?`内嵌贴图`:e}`);let w;try{let e=[...Array.isArray(b.buffers)?b.buffers:[],...Array.isArray(b.images)?b.images:[]].filter(e=>l(e)&&typeof e.uri==`string`&&!/^(data:|blob:)/i.test(e.uri)),o=new Map,m=new Map,g=await Promise.all(e.map(async e=>{let n=new URL(String(e.uri),c).href;return m.has(n)||m.set(n,f(n,t)),{url:n,bytes:await m.get(n),mime:typeof e.mimeType==`string`?e.mimeType:/\.png(?:[?#]|$)/i.test(n)?`image/png`:/\.jpe?g(?:[?#]|$)/i.test(n)?`image/jpeg`:`application/octet-stream`}}));t.throwIfAborted();for(let e of g){if(x.push(e.bytes),o.has(e.url))continue;let t=URL.createObjectURL(new Blob([e.bytes],{type:e.mime}));S.push(t),o.set(e.url,t)}C.setURLModifier(e=>/^(data:|blob:)/i.test(e)?e:o.get(new URL(e,c).href)??e),i(`正在解析模型`),w=await new r.GLTFLoader(C).parseAsync(_.buffer,new URL(`./`,c).href),t.throwIfAborted();let T=w.scene,E=new n.Group;E.name=`viewer-display-wrapper`,E.add(T),E.updateMatrixWorld(!0);let D=new n.Box3().setFromObject(T,!0);if(D.isEmpty()||![...D.min.toArray(),...D.max.toArray()].every(Number.isFinite))throw Error(`模型没有有效几何`);let O=D.getCenter(new n.Vector3).negate();E.position.copy(O),E.updateMatrixWorld(!0);let k=0,A=0;T.traverse(e=>{e?.isMesh===!0&&(k++,A+=(e.geometry.index?.count??e.geometry.getAttribute(`position`)?.count??0)/3)});let j=v.length?p(v):{},M=Array.isArray(j)?j:l(j)&&Array.isArray(j.root)?j.root:[],N=y.length?p(y):{},P=new Map;for(let[e,t]of w.parser.associations)`isObject3D`in e&&P.set(e,t);let F=!1;return{root:E,scene:T,offset:O,associations:P,sourceNames:Array.isArray(b.nodes)?b.nodes.map(e=>l(e)&&typeof e.name==`string`?e.name:``):[],metadata:{hierarchy:M.filter(l),properties:l(N)?N:{}},modelId:typeof s.modelId==`string`?s.modelId:a,revision:u(x),manifestUrl:a,label:typeof s.label==`string`?s.label:`BIM 模型`,stats:{meshes:k,triangles:Math.round(A),bytes:_.byteLength},warnings:h,dispose(){F||(F=!0,d(E))}}}catch(e){throw w&&d(w.scene),e}finally{S.forEach(e=>URL.revokeObjectURL(e))}}var g=e=>({x:e.x,y:e.y,z:e.z});function _(e){let t=[],n=[...e?.roots||[]].reverse();for(;n.length;){let e=n.pop();t.push(e);for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}return t}function v(e){let t=new Map,n=_(e);for(let e of n)t.set(e,{...e,bounds:e.bounds?structuredClone(e.bounds):null,metadata:structuredClone(e.metadata),children:[]});for(let e of n)t.get(e).children=e.children.map(e=>t.get(e));return{...e,roots:e.roots.map(e=>t.get(e))}}function y(e){return v({schemaVersion:1,modelId:``,revision:``,roots:[e]}).roots[0]}function b(e,t){let r=t.offset||new n.Vector3,i=[],a=[],o=[...e].reverse();for(;o.length;){let e=o.pop();a.push(e);for(let t=e.children.length-1;t>=0;t--)o.push(e.children[t])}let s=new Map,c=new Map,u=[...t.metadata?.hierarchy||[]].reverse();for(;u.length;){let e=u.pop();e.name&&s.set(e.name,[...s.get(e.name)||[],e]);let t=e.componentId??e.uuid;t!==void 0&&c.set(String(t),[...c.get(String(t))||[],e]),u.push(...(e.children||[]).slice().reverse())}let d=e=>{let n=t.associations?.get(e)?.nodes;return n===void 0?e.name:t.sourceNames?.[n]||e.name},f=new Map;a.forEach(e=>f.set(d(e),(f.get(d(e))||0)+1));let p=new Map,m=new Map,h=new Map,_=new Map;for(let e=a.length-1;e>=0;e--){let t=a[e],r=new n.Box3;t?.isInstancedMesh===!0?(t.computeBoundingBox(),t.boundingBox&&r.copy(t.boundingBox).applyMatrix4(t.matrixWorld)):t?.isMesh===!0&&(t.geometry.boundingBox||t.geometry.computeBoundingBox(),t.geometry.boundingBox&&r.copy(t.geometry.boundingBox).applyMatrix4(t.matrixWorld)),t.children.forEach(e=>{let t=_.get(e);t&&r.union(t)}),_.set(t,r)}for(let[e,o]of a.entries()){let a=d(o),u=s.get(a)||[],v=[`componentId`,`externalId`,`elementId`,`uuid`].map(e=>o.userData[e]).find(e=>typeof e==`string`&&e.trim().length>0||typeof e==`number`&&Number.isFinite(e)),y=v===void 0?[]:c.get(String(v))||[],b=y.length===1?y[0]:u.length===1&&f.get(a)===1?u[0]:void 0;u.length&&!b&&v===void 0&&i.push(`名称重复,未按名称映射:${a}`);let x=t.associations?.get(o)?.nodes,S=`${t.revision}:node:${x??`scene-${e}`}`,C=String(v??b?.componentId??b?.uuid??S);if(p.has(C)){i.push(`构件 ID 重复 ${C},当前节点改用版本内 ID`),C=S;let e=1;for(;p.has(C);)C=`${S}:${e++}`}let w=f.get(a)===1?t.metadata?.properties[a]:void 0,T=_.get(o),E=T.isEmpty()?null:{min:g(T.min.clone().sub(r)),max:g(T.max.clone().sub(r)),center:g(T.getCenter(new n.Vector3).sub(r))},D={id:C,name:a||o.type,type:o.type,parentId:null,children:[],hasGeometry:o?.isMesh===!0,bounds:E,metadata:{...structuredClone(o.userData),...l(w)?structuredClone(w):{},...b?{sourceHierarchy:{name:b.name,uuid:b.uuid,componentId:b.componentId}}:{},sourceNodeIndex:x??null}};p.set(C,D),m.set(o,C),h.set(C,o)}for(let e of a){let t=p.get(m.get(e)),n=e.parent&&m.get(e.parent);n&&(t.parentId=n,p.get(n).children.push(t))}return{tree:{schemaVersion:1,modelId:t.modelId,revision:t.revision,roots:e.map(e=>p.get(m.get(e)))},byId:p,byObject:m,renderObjects:h,warnings:i,getAnchor:(e,t=`origin`)=>{let i=h.get(e),a=p.get(e);return!i||!a?null:t===`origin`?g(i.getWorldPosition(new n.Vector3).sub(r)):!a.bounds||![`center`,`bounds-top`].includes(t)?null:{...a.bounds.center,y:t===`bounds-top`?a.bounds.max.y:a.bounds.center.y}}}}function x(e){let t=v(e.tree);for(let e of _(t))e.metadata={sourceNodeIndex:e.metadata.sourceNodeIndex};return t}var S=[`visible`,`opacity`,`color`],C=()=>({changedIds:[],unknownIds:[],skipped:[]});function w(e,t=()=>{}){let n=_(e.tree),r=new Map,i=new Map,a=new Map,o=new Map;for(let t of n){let n=e.renderObjects.get(t.id);i.set(t.id,{visible:n.visible&&t.metadata.visible!==!1,opacity:1,color:null}),n?.isMesh===!0&&o.set(n,n.material)}function s(){return{schemaVersion:1,modelId:e.tree.modelId,revision:e.tree.revision,overrides:[...r].map(([e,t])=>({id:e,original:Object.fromEntries(S.filter(e=>e in t).map(t=>[t,i.get(e)[t]])),current:{...t}}))}}function c(){for(let t of n){let n=i.get(t.id),s=r.get(t.id)||{},c=t.parentId?a.get(t.parentId):void 0,l={visible:(c?.visible??!0)&&(s.visible??n.visible),opacity:(c?.opacity??1)*(s.opacity??n.opacity),color:s.color??c?.color??null};a.set(t.id,l);let d=e.renderObjects.get(t.id);if(d.visible=l.visible,d?.isMesh!==!0)continue;let f=o.get(d);if(l.opacity===1&&l.color===null){d.material=f;continue}let p=(Array.isArray(f)?f:[f]).map(e=>{let n=`${t.id}:${e.uuid}`,r=u.get(n);return r||(r=e.clone(),u.set(n,r)),r.opacity=e.opacity*l.opacity,r.transparent=e.transparent||r.opacity<1,r.depthWrite=r.opacity<1?!1:e.depthWrite,`color`in r&&r.color?.isColor===!0&&`color`in e&&e.color?.isColor===!0&&(r.color.copy(e.color),l.color&&r.color.set(l.color)),r.needsUpdate=!0,r});d.material=Array.isArray(f)?p:p[0]}}let u=new Map;function d(e){return!l(e)||!Object.keys(e).length?`patch 必须包含外观字段`:Object.keys(e).some(e=>!S.includes(e))?`包含未知外观字段`:`visible`in e&&e.visible!==null&&typeof e.visible!=`boolean`?`visible 必须为布尔值或 null`:`opacity`in e&&e.opacity!==null&&(typeof e.opacity!=`number`||!Number.isFinite(e.opacity)||e.opacity<0||e.opacity>1)?`opacity 必须在 0–1 之间或为 null`:`color`in e&&e.color!==null&&(typeof e.color!=`string`||!/^#[\da-f]{6}$/i.test(e.color))?`color 必须是 #RRGGBB 或 null`:null}function f(n,a=`api`){let o=C(),u=s();if(!Array.isArray(n))return{...o,error:`updates 必须是数组`};for(let t of n){if(!l(t)||typeof t.id!=`string`){o.skipped.push({id:``,reason:`修改项必须包含构件 ID`});continue}if(!e.byId.has(t.id)){o.unknownIds.push(t.id);continue}let n=d(t.patch);if(n){o.skipped.push({id:t.id,reason:n});continue}let a=r.get(t.id)||{},s={...a},c=i.get(t.id);for(let e of S){if(!(e in t.patch))continue;let n=t.patch[e];e===`color`&&typeof n==`string`&&(n=n.toLowerCase()),n===null||n===c[e]?delete s[e]:Object.assign(s,{[e]:n})}S.every(e=>a[e]===s[e])||(Object.keys(s).length?r.set(t.id,s):r.delete(t.id),o.changedIds.push(t.id))}return o.changedIds=[...new Set(o.changedIds)],o.unknownIds=[...new Set(o.unknownIds)],o.changedIds.length&&(c(),t({source:a,before:u,after:s(),result:o})),o}function p(t){if(!l(t)||t.schemaVersion!==1||!Array.isArray(t.overrides))return{...C(),error:`外观文件格式无效`};if(t.modelId!==e.tree.modelId||t.revision!==e.tree.revision)return{...C(),error:`模型身份或版本不匹配,未应用任何修改`};let n=[];for(let e of t.overrides){if(!l(e)||typeof e.id!=`string`||d(e.current))return{...C(),error:`外观文件包含无效修改,未应用任何修改`};n.push({id:e.id,patch:e.current})}return f(n,`import`)}function m(t){return typeof t!=`string`||!t.trim()?{...C(),error:`restoreComponent 需要传入当前模型中的有效构件 ID`}:e.byId.has(t)?f([{id:t,patch:{visible:null,opacity:null,color:null}}],`restore`):{...C(),unknownIds:[t]}}function h(){return f([...r.keys()].map(e=>({id:e,patch:{visible:null,opacity:null,color:null}})),`restore`)}return c(),{changes:s,apply:f,importChanges:p,restore:m,restoreAll:h,get(e){let t=i.get(e),n=a.get(e);return t&&n?{own:{...r.get(e)},initial:{...t},effective:{...n}}:null},dispose(){o.forEach((e,t)=>{t.material=e,t.visible=!0}),n.forEach(t=>{e.renderObjects.get(t.id).visible=i.get(t.id).visible}),u.forEach(e=>e.dispose()),u.clear(),r.clear(),a.clear()}}}function T(e,t,r){let i=new n.Color(`#f4f7fb`),a=new n.TextureLoader().setCrossOrigin(`anonymous`),o,s=``,c=0,l=!1,u=1,d=1,f=1;e.background=i;function p(){if(!o)return;let e=d/f;o.repeat.set(Math.min(1,e/u),Math.min(1,u/e)),o.offset.set((1-o.repeat.x)/2,(1-o.repeat.y)/2)}async function m(s,d){let f;try{if(f=await a.loadAsync(s),l||d!==c){f.dispose();return}let r=f.image;if(!r||!Number.isFinite(r.width)||!Number.isFinite(r.height)||r.width<=0||r.height<=0)throw Error(`背景图片尺寸无效`);u=r.width/r.height,f.colorSpace=n.SRGBColorSpace,o=f,p(),e.background=o,t()}catch{if(f?.dispose(),l||d!==c)return;e.background=i,r({message:`背景图片加载失败,请检查图片地址、格式及跨域配置`}),t()}}return{set(n){if(l)return;let a=n?.color,u=a===void 0||typeof a==`string`&&/^#[\da-f]{6}$/i.test(a);i.set(u&&a!==void 0?a:`#f4f7fb`),u||r({message:`背景颜色必须为 #RRGGBB,已使用默认颜色 #f4f7fb`});let d=n?.imageUrl,f=d===void 0||typeof d==`string`,p=f&&d?.trim()||``;if(f||r({message:`背景图片地址必须为字符串,已使用纯色背景`}),p===s){e.background=o||i,t();return}s=p;let h=++c;o?.dispose(),o=void 0,e.background=i,t(),s&&m(s,h)},resize(e,n){l||!Number.isFinite(e)||!Number.isFinite(n)||e<=0||n<=0||(d=e,f=n,p(),o&&t())},dispose(){l||(l=!0,c++,o?.dispose(),o=void 0,e.background=null)}}}var E=new n.Color(`#28c99a`),D=.65,O=class extends c.OutlinePass{_updateSelectionCache(){this._selectionCache.clear(),this.selectedObjects.forEach(e=>this._selectionCache.add(e))}};function k(e,t){let r=new O(new n.Vector2(1,1),e,t);r.visibleEdgeColor.set(`#b4fff0`),r.hiddenEdgeColor.set(`#000000`),r.edgeStrength=2,r.edgeThickness=1,r.edgeGlow=0,r.pulsePeriod=0;let i=new Map,a=null;function o(e){for(let[t,n]of i)e?.has(t)||(n.material.dispose(),i.delete(t))}function s(e,t){if(!e.visible||e.opacity<=0||!e.color?.isColor)return e;t.add(e);let n=i.get(e);return n||(n={material:e.clone(),version:-1},i.set(e,n)),n.version!==e.version&&(n.material.copy(e),n.material.onBeforeCompile=(t,r)=>{e.onBeforeCompile.call(n.material,t,r),t.uniforms.selectionTint={value:E},t.fragmentShader=`uniform vec3 selectionTint;
2
+ `+t.fragmentShader.replace(`#include <color_fragment>`,`#include <color_fragment>\ndiffuseColor.rgb = mix(diffuseColor.rgb, selectionTint, ${D});`)},n.material.customProgramCacheKey=()=>`${e.customProgramCacheKey()}:bim-selection-tint`,n.material.needsUpdate=!0,n.version=e.version),n.material}return{pass:r,select(e){a!==e&&(a=e,r.selectedObjects=[],o())},render(e,t,n){let i=[],c=!!(a&&e&&t);for(let e=a;e&&c;e=e.parent)c=e.visible;c&&a.traverseVisible(n=>{if(!n.isMesh)return;let r=t.get(e.byObject.get(n)||``)?.effective,a=Array.isArray(n.material)?n.material:[n.material];r?.visible&&r.opacity>0&&a.some(e=>e.visible&&e.opacity>0)&&i.push(n)}),r.selectedObjects=i;let l=new Map,u=new Set;try{for(let e of i){let t=e.material;l.set(e,t),e.material=Array.isArray(t)?t.map(e=>s(e,u)):s(t,u)}n(i.length>0)}finally{l.forEach((e,t)=>{t.material=e}),o(u)}},dispose(){a=null,r.selectedObjects=[],o(),r.dispose()}}}function A(e,t){let r;function i(n){e.near=n.near,e.far=n.far,t.minDistance=n.minDistance,t.maxDistance=n.maxDistance,e.updateProjectionMatrix()}function a(){if(!r)return;let n=e.position.distanceTo(t.target);t.minDistance=Math.min(r.view.minDistance,n),t.maxDistance=Math.max(r.view.maxDistance,n),r=void 0}return{cancel:a,moveTo(o,s={}){let c=s.duration??800;if(!Number.isFinite(c)||c<0)return!1;a();let l=e.position.clone(),u=t.target.clone(),d=t.enableDamping;if(t.enableDamping=!1,t.update(),e.position.copy(l),t.target.copy(u),t.minDistance=Math.min(t.minDistance,o.minDistance),t.maxDistance=Math.max(t.maxDistance,o.maxDistance,l.distanceTo(u)),e.near=Math.min(e.near,o.near),e.far=Math.max(e.far,o.far+l.distanceTo(o.position)),e.updateProjectionMatrix(),t.update(),t.enableDamping=d,c===0||globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)e.position.copy(o.position),t.target.copy(o.target),i(o),t.update(),t.saveState();else{let e=new n.Spherical().setFromVector3(l.clone().sub(u)),t=new n.Spherical().setFromVector3(o.position.clone().sub(o.target));t.theta=e.theta+Math.atan2(Math.sin(t.theta-e.theta),Math.cos(t.theta-e.theta)),r={from:e,to:t,target:u,view:o,started:performance.now(),duration:c}}return!0},update(a){if(!r)return!1;let o=Math.max(0,Math.min(1,(a-r.started)/r.duration)),s=o*o*(3-2*o);t.target.lerpVectors(r.target,r.view.target,s);let{from:c,to:l}=r,u=new n.Spherical(c.radius+(l.radius-c.radius)*s,c.phi+(l.phi-c.phi)*s,c.theta+(l.theta-c.theta)*s);return e.position.setFromSpherical(u).add(t.target),o===1&&(e.position.copy(r.view.position),i(r.view),r=void 0,t.update(),t.saveState()),!!r}}}var j=[{negative:`left`,positive:`right`,labels:[`左`,`右`]},{negative:`bottom`,positive:`top`,labels:[`下`,`上`]},{negative:`back`,positive:`front`,labels:[`后`,`前`]}],M=[];for(let e of[-1,0,1])for(let t of[-1,0,1])for(let r of[-1,0,1]){let i=[e,t,r],a=i.filter(Boolean).length;if(!a)continue;let o=new n.Vector3(e,t,r).normalize(),s=i.flatMap((e,t)=>e?[j[t][e>0?`positive`:`negative`]]:[]),c=i.flatMap((e,t)=>e?[j[t].labels[+(e>0)]]:[]).join(``),l=Math.abs(t)===1&&a===1?new n.Vector3(0,0,t>0?-1:1):new n.Vector3(0,1,0),u=l.clone().cross(o).normalize();l.copy(o).cross(u),M.push({id:s.join(`-`),label:c,kind:[`face`,`edge`,`corner`][a-1],direction:i,normal:o,up:l,right:u,distance:[1,1.9,2.65][a-1]/Math.sqrt(a)})}for(let e of M){let t=e.normal.clone().multiplyScalar(e.distance),n=[[-3,-3],[3,-3],[3,3],[-3,3]].map(([n,r])=>t.clone().addScaledVector(e.right,n).addScaledVector(e.up,r));for(let t of M){if(t===e)continue;let r=[];for(let e=0;e<n.length;e++){let i=n[e],a=n[(e+1)%n.length],o=t.normal.dot(i)-t.distance,s=t.normal.dot(a)-t.distance;o<=1e-8&&r.push(i),(o<-1e-8&&s>1e-8||o>1e-8&&s<-1e-8)&&r.push(i.clone().lerp(a,o/(o-s)))}n=r}e.vertices=n,e.center=t}function N(e,t=!1){let r=M.find(n=>n.id===e&&(!t||n.kind===`face`));return r?new n.Vector3(...r.direction).normalize():null}function P(e){let t=[`x`,`y`,`z`,`w`].map(t=>e?.[t]),r=new n.Quaternion;t.every(Number.isFinite)&&t.some(e=>e!==0)&&r.fromArray(t).normalize().invert();let i=e=>({x:64+e.x*32,y:76-e.y*32});return M.flatMap(e=>{if(e.normal.clone().applyQuaternion(r).z<=1e-6)return[];let t=e.center.clone().applyQuaternion(r),n=e.right.clone().applyQuaternion(r),a=e.up.clone().applyQuaternion(r),o=i(t);return[{id:e.id,label:e.label,kind:e.kind,depth:t.z,points:e.vertices.map(e=>{let t=i(e.clone().applyQuaternion(r));return`${t.x.toFixed(4)},${t.y.toFixed(4)}`}).join(` `),textTransform:`matrix(${n.x*32},${-n.y*32},${-a.x*32},${a.y*32},${o.x},${o.y})`}]}).sort((e,t)=>e.depth-t.depth)}function F(e){let t=e?.home!==!1,n=e?.cube!==!1;return{home:t,cube:n,componentTree:e?.componentTree!==!1,height:n?150:t?44:0}}function ee(e,t,n){function r(r,i,a){let o=N(r,a),s=e.position.distanceTo(t.target);return!o||!Number.isFinite(s)||s<=0?!1:(Math.abs(o.y)===1&&(o.z=1e-6),o.normalize().multiplyScalar(s),n.moveTo({position:t.target.clone().add(o),target:t.target.clone(),near:e.near,far:e.far,minDistance:t.minDistance,maxDistance:t.maxDistance},i))}return{setViewDirection:(e,t)=>r(e,t,!0),navigate:(e,t)=>r(e,t,!1)}}function te(e,t,r,i,a,o,s){let c=[],l=[],u=new Set;for(let d of e)try{if(!d.id||u.has(d.id))throw Error(`Marker ID 缺失或重复`);u.add(d.id);let e=d.position,l;if(e.type===`model`)l={x:e.x,y:e.y,z:e.z};else if(e.type===`component`){if(r.get(e.componentId)?.effective.visible===!1)continue;if(l=t.getAnchor(e.componentId,e.anchor||`origin`),!l)throw Error(`构件或锚点不存在`);let n=e.offset||{x:0,y:0,z:0};l={x:l.x+n.x,y:l.y+n.y,z:l.z+n.z}}else throw Error(`不支持的定位类型`);if(!Object.values(l).every(Number.isFinite))throw Error(`模型坐标必须是有限数值`);if(d.screenOffset&&![d.screenOffset.x,d.screenOffset.y].every(Number.isFinite))throw Error(`屏幕偏移必须是有限数值`);let f=new n.Vector3(l.x,l.y,l.z).add(i),p=f.clone().project(a),m=f.clone().applyMatrix4(a.matrixWorldInverse).z<0,h=(p.x+1)/2*o+(d.screenOffset?.x||0),_=(1-p.y)/2*s+(d.screenOffset?.y||0),v=m&&Math.abs(p.z)<=1&&h>=0&&h<=o&&_>=0&&_<=s;c.push({...d,modelPosition:g(new n.Vector3(l.x,l.y,l.z)),x:h,y:_,visible:v})}catch(e){l.push(`标记 ${d?.id||`unknown`}:${e instanceof Error?e.message:String(e)}`)}return{markers:c,issues:l,width:o,height:s}}function I(e){e(`EPSG:4326`,`+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees`),e(`EPSG:4269`,`+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees`),e(`EPSG:3857`,`+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs`);for(var t=1;t<=60;++t)e(`EPSG:`+(32600+t),`+proj=utm +zone=`+t+` +datum=WGS84 +units=m`),e(`EPSG:`+(32700+t),`+proj=utm +zone=`+t+` +south +datum=WGS84 +units=m`);e(`EPSG:5041`,`+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e(`EPSG:5042`,`+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e.WGS84=e[`EPSG:4326`],e[`EPSG:3785`]=e[`EPSG:3857`],e.GOOGLE=e[`EPSG:3857`],e[`EPSG:900913`]=e[`EPSG:3857`],e[`EPSG:102113`]=e[`EPSG:3857`]}var ne=6378137,re=6356752.314,L=.0066943799901413165,R=484813681109536e-20,z=Math.PI/2,ie=.16666666666666666,ae=.04722222222222222,oe=.022156084656084655,B=1e-10,V=.017453292519943295,H=57.29577951308232,U=Math.PI/4,se=Math.PI*2,W=3.14159265359,G={};G.greenwich=0,G.lisbon=-9.131906111111,G.paris=2.337229166667,G.bogota=-74.080916666667,G.madrid=-3.687938888889,G.rome=12.452333333333,G.bern=7.439583333333,G.jakarta=106.807719444444,G.ferro=-17.666666666667,G.brussels=4.367975,G.stockholm=18.058277777778,G.athens=23.7163375,G.oslo=10.722916666667;var ce={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},le=/[\s_\-\/\(\)]/g;function ue(e,t){if(e[t])return e[t];for(var n=Object.keys(e),r=t.toLowerCase().replace(le,``),i=-1,a,o;++i<n.length;)if(a=n[i],o=a.toLowerCase().replace(le,``),o===r)return e[a]}function de(e){var t={},n=e.split(`+`).map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var n=t.split(`=`);return n.push(!0),e[n[0].toLowerCase()]=n[1],e},{}),r,i,a,o={proj:function(e){t.projName=[`lonlat`,`latlon`,`latlong`].includes(e)?`longlat`:e},datum:`datumCode`,rf:function(e){t.rf=parseFloat(e)},lat_0:function(e){t.lat0=e*V},lat_1:function(e){t.lat1=e*V},lat_2:function(e){t.lat2=e*V},lat_ts:function(e){t.lat_ts=e*V},lon_0:function(e){t.long0=e*V},lon_wrap:function(e){t.long_wrap=parseFloat(e)*V},lon_1:function(e){t.long1=e*V},lon_2:function(e){t.long2=e*V},alpha:function(e){t.alpha=parseFloat(e)*V},gamma:function(e){t.rectified_grid_angle=parseFloat(e)*V},lonc:function(e){t.longc=e*V},x_0:function(e){t.x0=parseFloat(e)},y_0:function(e){t.y0=parseFloat(e)},k_0:function(e){t.k0=parseFloat(e)},k:function(e){t.k0=parseFloat(e)},a:function(e){t.a=parseFloat(e)},b:function(e){t.b=parseFloat(e)},r:function(e){t.a=t.b=parseFloat(e)},r_a:function(){t.R_A=!0},zone:function(e){t.zone=parseInt(e,10)},south:function(){t.utmSouth=!0},towgs84:function(e){t.datum_params=e.split(`,`).map(function(e){return parseFloat(e)})},to_meter:function(e){t.to_meter=parseFloat(e)},units:function(e){t.units=e;var n=ue(ce,e);n&&(t.to_meter=n.to_meter)},from_greenwich:function(e){t.from_greenwich=e*V},pm:function(e){t.from_greenwich=(ue(G,e)||parseFloat(e))*V},nadgrids:function(e){e===`@null`?t.datumCode=`none`:t.nadgrids=e},axis:function(e){var n=`ewnsud`;e.length===3&&n.indexOf(e.substr(0,1))!==-1&&n.indexOf(e.substr(1,1))!==-1&&n.indexOf(e.substr(2,1))!==-1&&(t.axis=e)},approx:function(){t.approx=!0},over:function(){t.over=!0}};for(r in n)i=n[r],r in o?(a=o[r],typeof a==`function`?a(i):t[a]=i):t[r]=i;return typeof t.datumCode==`string`&&t.datumCode!==`WGS84`&&(t.datumCode=t.datumCode.toLowerCase()),t.projStr=e,t}var fe=class{static getId(e){let t=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t=`unit`){if(!e||e.length<3)return{type:t,name:`unknown`,conversion_factor:null};let n=e[1],r=parseFloat(e[2])||null,i=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return{type:t,name:n,conversion_factor:r,id:i?{authority:i[1],code:parseInt(i[2],10)}:null}}static convertAxis(e){let t=e[1]||`Unknown`,n,r=t.match(/^\((.)\)$/);if(r){let t=r[1].toUpperCase();if(t===`E`)n=`east`;else if(t===`N`)n=`north`;else if(t===`U`)n=`up`;else if(e[2])n=e[2];else throw Error(`Unknown axis abbreviation: ${t}`)}else n=e[2]||`unknown`;let i=e.find(e=>Array.isArray(e)&&e[0]===`ORDER`),a=i?parseInt(i[1],10):null,o=e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`)),s=this.convertUnit(o);return{name:t,direction:n,unit:s,order:a}}static extractAxes(e){return e.filter(e=>Array.isArray(e)&&e[0]===`AXIS`).map(e=>this.convertAxis(e)).sort((e,t)=>(e.order||0)-(t.order||0))}static convert(e,t={}){switch(e[0]){case`PROJCRS`:t.type=`ProjectedCRS`,t.name=e[1],t.base_crs=e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)):null,t.conversion=e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)):null;let n=e.find(e=>Array.isArray(e)&&e[0]===`CS`);n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`);if(r){let e=this.convertUnit(r);t.coordinate_system.unit=e}t.id=this.getId(e);break;case`BASEGEOGCRS`:case`GEOGCRS`:case`GEODCRS`:t.type=e[0]===`GEODCRS`?`GeodeticCRS`:`GeographicCRS`,t.name=e[1];let i=e.find(e=>Array.isArray(e)&&(e[0]===`DATUM`||e[0]===`ENSEMBLE`));if(i){let n=this.convert(i);i[0]===`ENSEMBLE`?t.datum_ensemble=n:t.datum=n;let r=e.find(e=>Array.isArray(e)&&e[0]===`PRIMEM`);r&&r[1]!==`Greenwich`&&(n.prime_meridian={name:r[1],longitude:parseFloat(r[2])})}let a=e.find(e=>Array.isArray(e)&&e[0]===`CS`);t.coordinate_system={subtype:a?a[1]:`ellipsoidal`,axis:this.extractAxes(e)},t.id=this.getId(e);break;case`DATUM`:t.type=`GeodeticReferenceFrame`,t.name=e[1],t.ellipsoid=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)):null;break;case`ENSEMBLE`:t.type=`DatumEnsemble`,t.name=e[1],t.members=e.filter(e=>Array.isArray(e)&&e[0]===`MEMBER`).map(e=>({type:`DatumEnsembleMember`,name:e[1],id:this.getId(e)}));let o=e.find(e=>Array.isArray(e)&&e[0]===`ENSEMBLEACCURACY`);o&&(t.accuracy=parseFloat(o[1]));let s=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`);s&&(t.ellipsoid=this.convert(s)),t.id=this.getId(e);break;case`ELLIPSOID`:t.type=`Ellipsoid`,t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`)&&this.convert(e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`),t);break;case`CONVERSION`:t.type=`Conversion`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&e[0]===`PARAMETER`).map(e=>this.convert(e));break;case`METHOD`:t.type=`Method`,t.name=e[1],t.id=this.getId(e);break;case`PARAMETER`:t.type=`Parameter`,t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`))),t.id=this.getId(e);break;case`BOUNDCRS`:t.type=`BoundCRS`;let c=e.find(e=>Array.isArray(e)&&e[0]===`SOURCECRS`);if(c){let e=c.find(e=>Array.isArray(e));t.source_crs=e?this.convert(e):null}let l=e.find(e=>Array.isArray(e)&&e[0]===`TARGETCRS`);if(l){let e=l.find(e=>Array.isArray(e));t.target_crs=e?this.convert(e):null}let u=e.find(e=>Array.isArray(e)&&e[0]===`ABRIDGEDTRANSFORMATION`);t.transformation=u?this.convert(u):null;break;case`ABRIDGEDTRANSFORMATION`:if(t.type=`Transformation`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&(e[0]===`PARAMETER`||e[0]===`PARAMETERFILE`)).map(e=>{if(e[0]===`PARAMETER`)return this.convert(e);if(e[0]===`PARAMETERFILE`)return{name:e[1],value:e[2],id:{authority:`EPSG`,code:8656}}}),t.parameters.length===7){let e=t.parameters[6];e.name===`Scale difference`&&(e.value=Math.round((e.value-1)*0xe8d4a51000)/1e6)}t.id=this.getId(e);break;case`AXIS`:t.coordinate_system||={type:`unspecified`,axis:[]},t.coordinate_system.axis.push(this.convertAxis(e));break;case`LENGTHUNIT`:let d=this.convertUnit(e,`LinearUnit`);t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(e=>{e.unit||=d}),d.conversion_factor&&d.conversion_factor!==1&&(t.semi_major_axis&&={value:t.semi_major_axis,unit:d});break;default:t.keyword=e[0]}return t}};function pe(e){return fe.convert(e)}function me(e){let t=e.toUpperCase();return t.includes(`PROJCRS`)||t.includes(`GEOGCRS`)||t.includes(`BOUNDCRS`)||t.includes(`VERTCRS`)||t.includes(`LENGTHUNIT`)||t.includes(`ANGLEUNIT`)||t.includes(`SCALEUNIT`)?`WKT2`:(t.includes(`PROJCS`)||t.includes(`GEOGCS`)||t.includes(`LOCAL_CS`)||t.includes(`VERT_CS`)||t.includes(`UNIT`),`WKT1`)}var he=Oe,ge=1,_e=2,ve=3,ye=4,be=5,xe=-1,Se=/\s/,Ce=/[A-Za-z]/,we=/[A-Za-z84_]/,Te=/[,\]]/,Ee=/[\d\.E\-\+]/;function De(e){if(typeof e!=`string`)throw Error(`not a string`);this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=ge}De.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==ye)for(;Se.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case ge:return this.neutral(e);case _e:return this.keyword(e);case ye:return this.quoted(e);case be:return this.afterquote(e);case ve:return this.number(e);case xe:return}},De.prototype.afterquote=function(e){if(e===`"`)this.word+=`"`,this.state=ye;else if(Te.test(e))this.word=this.word.trim(),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in afterquote yet, index `+this.place)},De.prototype.afterItem=function(e){e===`,`?(this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=ge):e===`]`&&(this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=ge,this.currentObject=this.stack.pop(),this.currentObject||(this.state=xe))},De.prototype.number=function(e){if(Ee.test(e))this.word+=e;else if(Te.test(e))this.word=parseFloat(this.word),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in number yet, index `+this.place)},De.prototype.quoted=function(e){e===`"`?this.state=be:this.word+=e},De.prototype.keyword=function(e){if(we.test(e))this.word+=e;else if(e===`[`){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=ge}else if(Te.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in keyword yet, index `+this.place)},De.prototype.neutral=function(e){if(Ce.test(e))this.word=e,this.state=_e;else if(e===`"`)this.word=``,this.state=ye;else if(Ee.test(e))this.word=e,this.state=ve;else if(Te.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in neutral yet, index `+this.place)},De.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===xe)return this.root;throw Error(`unable to parse string "`+this.text+`". State is `+this.state)};function Oe(e){return new De(e).output()}function ke(e,t,n){Array.isArray(t)&&(n.unshift(t),t=null);var r=t?{}:e,i=n.reduce(function(e,t){return Ae(t,e),e},r);t&&(e[t]=i)}function Ae(e,t){if(!Array.isArray(e))t[e]=!0;else{var n=e.shift();if(n===`PARAMETER`&&(n=e.shift()),e.length===1){if(Array.isArray(e[0])){t[n]={},Ae(e[0],t[n]);return}t[n]=e[0]}else if(!e.length)t[n]=!0;else if(n===`TOWGS84`)t[n]=e;else if(n===`AXIS`)n in t||(t[n]=[]),t[n].push(e);else{Array.isArray(n)||(t[n]={});var r;switch(n){case`UNIT`:case`PRIMEM`:case`VERT_DATUM`:t[n]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&Ae(e[2],t[n]);return;case`SPHEROID`:case`ELLIPSOID`:t[n]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Ae(e[3],t[n]);return;case`EDATUM`:case`ENGINEERINGDATUM`:case`LOCAL_DATUM`:case`DATUM`:case`VERT_CS`:case`VERTCRS`:case`VERTICALCRS`:e[0]=[`name`,e[0]],ke(t,n,e);return;case`COMPD_CS`:case`COMPOUNDCRS`:case`FITTED_CS`:case`PROJECTEDCRS`:case`PROJCRS`:case`GEOGCS`:case`GEOCCS`:case`PROJCS`:case`LOCAL_CS`:case`GEODCRS`:case`GEODETICCRS`:case`GEODETICDATUM`:case`ENGCRS`:case`ENGINEERINGCRS`:e[0]=[`name`,e[0]],ke(t,n,e),t[n].type=n;return;default:for(r=-1;++r<e.length;)if(!Array.isArray(e[r]))return Ae(e,t[n]);return ke(t,n,e)}}}}var je=.017453292519943295;function Me(e){return e*je}function Ne(e){let t=(e.projName||``).toLowerCase().replace(/_/g,` `);e.long0===void 0&&e.longc!==void 0&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(t===`stereographic south pole`||t===`polar stereographic (variant b)`)?(e.lat0=Me(e.lat1>0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t===`polar stereographic`||t===`polar stereographic (variant a)`)&&(e.lat_ts=e.lat0,e.lat0=Me(e.lat0>0?90:-90),delete e.lat1)}function Pe(e){let t={units:null,to_meter:void 0};return typeof e==`string`?(t.units=e.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.units===`meter`&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.to_meter=e.conversion_factor),t}function Fe(e){return typeof e==`object`?e.value*e.unit.conversion_factor:e}function Ie(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=Fe(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening===void 0?e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Fe(e.ellipsoid.semi_minor_axis))):t.rf=e.ellipsoid.inverse_flattening)}function Le(e,t={}){return!e||typeof e!=`object`?e:e.type===`BoundCRS`?(Le(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name===`NTv2`?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(e=>e.value)),t):(Object.keys(e).forEach(n=>{let r=e[n];if(r!==null)switch(n){case`name`:if(t.srsCode)break;t.name=r,t.srsCode=r;break;case`type`:r===`GeographicCRS`?t.projName=`longlat`:r===`GeodeticCRS`?t.projName=e.coordinate_system&&e.coordinate_system.subtype===`Cartesian`?`geocent`:`longlat`:r===`ProjectedCRS`&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case`datum`:case`datum_ensemble`:r.ellipsoid&&(t.ellps=r.ellipsoid.name,Ie(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case`ellipsoid`:t.ellps=r.name,Ie(r,t);break;case`prime_meridian`:t.long0=(r.longitude||0)*Math.PI/180;break;case`coordinate_system`:if(r.axis){let e={east:`e`,north:`n`,west:`w`,south:`s`,up:`u`,down:`d`,geocentricx:`e`,geocentricy:`n`,geocentricz:`u`},n=r.axis.map(t=>e[t.direction.toLowerCase()]);if(n.every(Boolean)&&(t.axis=n.join(``),t.axis.length===2&&(t.axis+=`u`)),r.unit){let{units:e,to_meter:n}=Pe(r.unit);t.units=e,t.to_meter=n}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:n}=Pe(r.axis[0].unit);t.units=e,t.to_meter=n}}break;case`id`:r.authority&&r.code&&(t.title=r.authority+`:`+r.code);break;case`conversion`:r.method&&r.method.name&&(t.projName=r.method.name),r.parameters&&r.parameters.forEach(e=>{let n=e.name.toLowerCase().replace(/\s+/g,`_`),r=e.value;t[n]=e.unit&&e.unit.conversion_factor?r*e.unit.conversion_factor:e.unit===`degree`?r*Math.PI/180:r});break;case`unit`:r.name&&(t.units=r.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`)),r.conversion_factor&&(t.to_meter=r.conversion_factor);break;case`base_crs`:Le(r,t),t.datumCode=r.id?r.id.authority+`_`+r.id.code:r.name}}),!t.datumCode&&(e.type===`GeographicCRS`||e.type===`GeodeticCRS`)&&e.id&&(t.datumCode=e.id.authority+`_`+e.id.code),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),Ne(t),t)}var Re=[`PROJECTEDCRS`,`PROJCRS`,`GEOGCS`,`GEOCCS`,`PROJCS`,`LOCAL_CS`,`GEODCRS`,`GEODETICCRS`,`GEODETICDATUM`,`ENGCRS`,`ENGINEERINGCRS`];function ze(e,t){var n=t[0],r=t[1];!(n in e)&&r in e&&(e[n]=e[r],t.length===3&&(e[n]=t[2](e[n])))}function Be(e){for(var t=Object.keys(e),n=0,r=t.length;n<r;++n){var i=t[n];Re.indexOf(i)!==-1&&Ve(e[i]),typeof e[i]==`object`&&Be(e[i])}}function Ve(e){if(e.AUTHORITY){var t=Object.keys(e.AUTHORITY)[0];t&&t in e.AUTHORITY&&(e.title=t+`:`+e.AUTHORITY[t])}if(e.type===`GEOGCS`?e.projName=`longlat`:e.type===`LOCAL_CS`?(e.projName=`identity`,e.local=!0):e.projName=typeof e.PROJECTION==`object`?Object.keys(e.PROJECTION)[0]:e.PROJECTION,e.AXIS){for(var n=``,r=0,i=e.AXIS.length;r<i;++r){var a=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];a[0].indexOf(`north`)!==-1||(a[0]===`y`||a[0]===`lat`)&&a[1]===`north`?n+=`n`:a[0].indexOf(`south`)!==-1||(a[0]===`y`||a[0]===`lat`)&&a[1]===`south`?n+=`s`:a[0].indexOf(`east`)!==-1||(a[0]===`x`||a[0]===`lon`)&&a[1]===`east`?n+=`e`:(a[0].indexOf(`west`)!==-1||(a[0]===`x`||a[0]===`lon`)&&a[1]===`west`)&&(n+=`w`)}n.length===2&&(n+=`u`),n.length===3&&(e.axis=n)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units===`metre`&&(e.units=`meter`),e.UNIT.convert&&(e.type===`GEOGCS`?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var o=e.GEOGCS;e.type===`GEOGCS`&&(o=e),o&&(o.PRIMEM&&o.PRIMEM.convert&&(e.from_greenwich=Me(o.PRIMEM.convert)),e.datumCode=o.DATUM?o.DATUM.name.toLowerCase():o.name.toLowerCase(),e.datumCode.slice(0,2)===`d_`&&(e.datumCode=e.datumCode.slice(2)),e.datumCode===`new_zealand_1949`&&(e.datumCode=`nzgd49`),(e.datumCode===`wgs_1984`||e.datumCode===`world_geodetic_system_1984`)&&(e.PROJECTION===`Mercator_Auxiliary_Sphere`&&(e.sphere=!0),e.datumCode=`wgs84`),e.datumCode===`belge_1972`&&(e.datumCode=`rnb72`),o.DATUM&&o.DATUM.SPHEROID&&(e.ellps=o.DATUM.SPHEROID.name.replace(`_19`,``).replace(/[Cc]larke\_18/,`clrk`),e.ellps.toLowerCase().slice(0,13)===`international`&&(e.ellps=`intl`),e.a=o.DATUM.SPHEROID.a,e.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(e.datum_params=o.DATUM.TOWGS84),~e.datumCode.indexOf(`osgb_1936`)&&(e.datumCode=`osgb36`),~e.datumCode.indexOf(`osni_1952`)&&(e.datumCode=`osni52`),(~e.datumCode.indexOf(`tm65`)||~e.datumCode.indexOf(`geodetic_datum_of_1965`))&&(e.datumCode=`ire65`),e.datumCode===`ch1903+`&&(e.datumCode=`ch1903`),~e.datumCode.indexOf(`israel`)&&(e.datumCode=`isr93`)),e.b&&!isFinite(e.b)&&(e.b=e.a),e.rectified_grid_angle&&=Me(e.rectified_grid_angle);function s(t){return t*(e.to_meter||1)}[[`standard_parallel_1`,`Standard_Parallel_1`],[`standard_parallel_1`,`Latitude of 1st standard parallel`],[`standard_parallel_2`,`Standard_Parallel_2`],[`standard_parallel_2`,`Latitude of 2nd standard parallel`],[`false_easting`,`False_Easting`],[`false_easting`,`False easting`],[`false-easting`,`Easting at false origin`],[`false_northing`,`False_Northing`],[`false_northing`,`False northing`],[`false_northing`,`Northing at false origin`],[`central_meridian`,`Central_Meridian`],[`central_meridian`,`Longitude of natural origin`],[`central_meridian`,`Longitude of false origin`],[`latitude_of_origin`,`Latitude_Of_Origin`],[`latitude_of_origin`,`Central_Parallel`],[`latitude_of_origin`,`Latitude of natural origin`],[`latitude_of_origin`,`Latitude of false origin`],[`scale_factor`,`Scale_Factor`],[`k0`,`scale_factor`],[`latitude_of_center`,`Latitude_Of_Center`],[`latitude_of_center`,`Latitude_of_center`],[`lat0`,`latitude_of_center`,Me],[`longitude_of_center`,`Longitude_Of_Center`],[`longitude_of_center`,`Longitude_of_center`],[`longc`,`longitude_of_center`,Me],[`x0`,`false_easting`,s],[`y0`,`false_northing`,s],[`long0`,`central_meridian`,Me],[`lat0`,`latitude_of_origin`,Me],[`lat0`,`standard_parallel_1`,Me],[`lat1`,`standard_parallel_1`,Me],[`lat2`,`standard_parallel_2`,Me],[`azimuth`,`Azimuth`],[`alpha`,`azimuth`,Me],[`srsCode`,`name`]].forEach(function(t){return ze(e,t)}),Ne(e)}function He(e){if(typeof e==`object`)return Le(e);let t=me(e);var n=he(e);if(t===`WKT2`)return Le(pe(n));var r=n[0],i={};return Ae(n,i),Be(i),i[r]}function K(e){var t=this;if(arguments.length===2){var n=arguments[1];typeof n==`string`?K[e]=n.charAt(0)===`+`?de(arguments[1]):He(arguments[1]):n&&typeof n==`object`&&!(`projName`in n)?K[e]=He(arguments[1]):(K[e]=n,n||delete K[e])}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(e){return Array.isArray(e)?K.apply(t,e):K(e)});if(typeof e==`string`){if(e in K)return K[e]}else`EPSG`in e?K[`EPSG:`+e.EPSG]=e:`ESRI`in e?K[`ESRI:`+e.ESRI]=e:`IAU2000`in e?K[`IAU2000:`+e.IAU2000]=e:console.log(e);return}}I(K);function Ue(e){return typeof e==`string`}function We(e){return e in K}function Ge(e){return e.indexOf(`+`)!==0&&e.indexOf(`[`)!==-1||typeof e==`object`&&!(`srsCode`in e)}var Ke=[`3857`,`900913`,`3785`,`102113`];function qe(e){if(e.title)return e.title.toLowerCase().indexOf(`epsg:`)===0&&Ke.indexOf(e.title.substr(5))>-1;var t=ue(e,`authority`);if(t){var n=ue(t,`epsg`);return n&&Ke.indexOf(n)>-1}}function Je(e){var t=ue(e,`extension`);if(t)return ue(t,`proj4`)}function Ye(e){return e[0]===`+`}function Xe(e){let t;if(Ue(e)){if(We(e))t=K[e];else if(Ge(e)){t=He(e);var n=Je(t);n&&(t=de(n))}else Ye(e)&&(t=de(e))}else t=`projName`in e?e:He(e);return t&&qe(t)?K[`EPSG:3857`]:t}function Ze(e,t){e||={};var n,r;if(!t)return e;for(r in t)n=t[r],n!==void 0&&(e[r]=n);return e}function Qe(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}function $e(e){return e<0?-1:1}function q(e,t){return t||Math.abs(e)<=3.14159265359?e:e-$e(e)*se}function et(e,t,n){var r=e*n,i=.5*e;return r=((1-r)/(1+r))**i,Math.tan(.5*(z-t))/r}function tt(e,t){for(var n=.5*e,r,i,a=z-2*Math.atan(t),o=0;o<=15;o++)if(r=e*Math.sin(a),i=z-2*Math.atan(t*((1-r)/(1+r))**n)-a,a+=i,Math.abs(i)<=1e-10)return a;return-9999}function nt(){var e=this.b/this.a;this.es=1-e*e,`x0`in this||(this.x0=0),`y0`in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.k0=this.sphere?Math.cos(this.lat_ts):Qe(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||=this.k?this.k:1}function rt(e){var t=e.x,n=e.y;if(n*57.29577951308232>90&&n*57.29577951308232<-90&&t*57.29577951308232>180&&t*57.29577951308232<-180)return null;var r,i;if(Math.abs(Math.abs(n)-z)<=1e-10)return null;if(this.sphere)r=this.x0+this.a*this.k0*q(t-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(U+.5*n));else{var a=Math.sin(n),o=et(this.e,n,a);r=this.x0+this.a*this.k0*q(t-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=r,e.y=i,e}function it(e){var t=e.x-this.x0,n=e.y-this.y0,r,i;if(this.sphere)i=z-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var a=Math.exp(-n/(this.a*this.k0));if(i=tt(this.e,a),i===-9999)return null}return r=q(this.long0+t/(this.a*this.k0),this.over),e.x=r,e.y=i,e}var at={init:nt,forward:rt,inverse:it,names:[`Mercator`,`Popular Visualisation Pseudo Mercator`,`Mercator_1SP`,`Mercator_Auxiliary_Sphere`,`Mercator_Variant_A`,`merc`]};function ot(){}function st(e){return e}var ct=[`longlat`,`identity`,`lonlat`,`latlon`,`latlong`],lt=[at,{init:ot,forward:st,inverse:st,names:ct}],ut={},dt=[];function ft(e,t){var n=dt.length;return e.names?(dt[n]=e,e.names.forEach(function(e){ut[e.toLowerCase()]=n}),this):(console.log(t),!0)}function pt(e){return e.replace(/[-\(\)\s]+/g,` `).trim().replace(/ /g,`_`)}function mt(e){if(!e)return!1;var t=e.toLowerCase();if(ut[t]!==void 0&&dt[ut[t]]||(t=pt(t),t in ut&&dt[ut[t]]))return dt[ut[t]]}function ht(){lt.forEach(ft)}var gt={start:ht,add:ft,get:mt},_t={MERIT:{a:6378137,rf:298.257,ellipseName:`MERIT 1983`},SGS85:{a:6378136,rf:298.257,ellipseName:`Soviet Geodetic System 85`},GRS80:{a:6378137,rf:298.257222101,ellipseName:`GRS 1980(IUGG, 1980)`},IAU76:{a:6378140,rf:298.257,ellipseName:`IAU 1976`},airy:{a:6377563.396,b:6356256.91,ellipseName:`Airy 1830`},APL4:{a:6378137,rf:298.25,ellipseName:`Appl. Physics. 1965`},NWL9D:{a:6378145,rf:298.25,ellipseName:`Naval Weapons Lab., 1965`},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:`Modified Airy`},andrae:{a:6377104.43,rf:300,ellipseName:`Andrae 1876 (Den., Iclnd.)`},aust_SA:{a:6378160,rf:298.25,ellipseName:`Australian Natl & S. Amer. 1969`},GRS67:{a:6378160,rf:298.247167427,ellipseName:`GRS 67(IUGG 1967)`},bessel:{a:6377397.155,rf:299.1528128,ellipseName:`Bessel 1841`},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:`Bessel 1841 (Namibia)`},clrk66:{a:6378206.4,b:6356583.8,ellipseName:`Clarke 1866`},clrk80:{a:6378249.145,rf:293.4663,ellipseName:`Clarke 1880 mod.`},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:`Clarke 1880 (IGN)`},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:`Clarke 1858`},CPM:{a:6375738.7,rf:334.29,ellipseName:`Comm. des Poids et Mesures 1799`},delmbr:{a:6376428,rf:311.5,ellipseName:`Delambre 1810 (Belgium)`},engelis:{a:6378136.05,rf:298.2566,ellipseName:`Engelis 1985`},evrst30:{a:6377276.345,rf:300.8017,ellipseName:`Everest 1830`},evrst48:{a:6377304.063,rf:300.8017,ellipseName:`Everest 1948`},evrst56:{a:6377301.243,rf:300.8017,ellipseName:`Everest 1956`},evrst69:{a:6377295.664,rf:300.8017,ellipseName:`Everest 1969`},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:`Everest (Sabah & Sarawak)`},fschr60:{a:6378166,rf:298.3,ellipseName:`Fischer (Mercury Datum) 1960`},fschr60m:{a:6378155,rf:298.3,ellipseName:`Fischer 1960`},fschr68:{a:6378150,rf:298.3,ellipseName:`Fischer 1968`},helmert:{a:6378200,rf:298.3,ellipseName:`Helmert 1906`},hough:{a:6378270,rf:297,ellipseName:`Hough`},intl:{a:6378388,rf:297,ellipseName:`International 1909 (Hayford)`},kaula:{a:6378163,rf:298.24,ellipseName:`Kaula 1961`},lerch:{a:6378139,rf:298.257,ellipseName:`Lerch 1979`},mprts:{a:6397300,rf:191,ellipseName:`Maupertius 1738`},new_intl:{a:6378157.5,b:6356772.2,ellipseName:`New International 1967`},plessis:{a:6376523,b:6355863,ellipseName:`Plessis 1817 (France)`},krass:{a:6378245,rf:298.3,ellipseName:`Krassovsky, 1942`},SEasia:{a:6378155,b:6356773.3205,ellipseName:`Southeast Asia`},walbeck:{a:6376896,b:6355834.8467,ellipseName:`Walbeck`},WGS60:{a:6378165,rf:298.3,ellipseName:`WGS 60`},WGS66:{a:6378145,rf:298.25,ellipseName:`WGS 66`},WGS7:{a:6378135,rf:298.26,ellipseName:`WGS 72`},WGS84:{a:6378137,rf:298.257223563,ellipseName:`WGS 84`},sphere:{a:6370997,b:6370997,ellipseName:`Normal Sphere (r=6370997)`}},vt=_t.WGS84;function yt(e,t,n,r){var i=e*e,a=t*t,o=(i-a)/i,s=0;r?(e*=1-o*(ie+o*(ae+o*oe)),i=e*e,o=0):s=Math.sqrt(o);var c=(i-a)/a;return{es:o,e:s,ep2:c}}function bt(e,t,n,r,i){if(!e){var a=ue(_t,r);a||=vt,e=a.a,t=a.b,n=a.rf}return n&&!t&&(t=(1-1/n)*e),(n===0||Math.abs(e-t)<1e-10)&&(i=!0,t=e),{a:e,b:t,rf:n,sphere:i}}var xt={wgs84:{towgs84:`0,0,0`,ellipse:`WGS84`,datumName:`WGS84`},ch1903:{towgs84:`674.374,15.056,405.346`,ellipse:`bessel`,datumName:`swiss`},ggrs87:{towgs84:`-199.87,74.79,246.62`,ellipse:`GRS80`,datumName:`Greek_Geodetic_Reference_System_1987`},nad83:{towgs84:`0,0,0`,ellipse:`GRS80`,datumName:`North_American_Datum_1983`},nad27:{nadgrids:`@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat`,ellipse:`clrk66`,datumName:`North_American_Datum_1927`},potsdam:{towgs84:`598.1,73.7,418.2,0.202,0.045,-2.455,6.7`,ellipse:`bessel`,datumName:`Potsdam Rauenberg 1950 DHDN`},carthage:{towgs84:`-263.0,6.0,431.0`,ellipse:`clrk80ign`,datumName:`Carthage 1934 Tunisia`},hermannskogel:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Hermannskogel`},mgi:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Militar-Geographische Institut`},osni52:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`airy`,datumName:`Irish National`},ire65:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`mod_airy`,datumName:`Ireland 1965`},rassadiran:{towgs84:`-133.63,-157.5,-158.62`,ellipse:`intl`,datumName:`Rassadiran`},nzgd49:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`,ellipse:`intl`,datumName:`New Zealand Geodetic Datum 1949`},osgb36:{towgs84:`446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894`,ellipse:`airy`,datumName:`Ordnance Survey of Great Britain 1936`},s_jtsk:{towgs84:`589,76,480`,ellipse:`bessel`,datumName:`S-JTSK (Ferro)`},beduaram:{towgs84:`-106,-87,188`,ellipse:`clrk80`,datumName:`Beduaram`},gunung_segara:{towgs84:`-403,684,41`,ellipse:`bessel`,datumName:`Gunung Segara Jakarta`},rnb72:{towgs84:`106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1`,ellipse:`intl`,datumName:`Reseau National Belge 1972`},EPSG_5451:{towgs84:`6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649`},IGNF_LURESG:{towgs84:`-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43`},EPSG_4614:{towgs84:`-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065`},EPSG_4615:{towgs84:`-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748`},ESRI_37241:{towgs84:`-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031`},ESRI_37249:{towgs84:`-440.296,58.548,296.265,1.128,10.202,4.559,-0.438`},ESRI_37245:{towgs84:`-511.151,-181.269,139.609,1.05,2.703,1.798,3.071`},EPSG_4178:{towgs84:`24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01`},EPSG_4622:{towgs84:`-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984`},EPSG_4625:{towgs84:`126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227`},EPSG_5252:{towgs84:`0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439`},EPSG_4314:{towgs84:`597.1,71.4,412.1,0.894,0.068,-1.563,7.58`},EPSG_4282:{towgs84:`-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166`},EPSG_4231:{towgs84:`-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218`},EPSG_4274:{towgs84:`-230.994,102.591,25.199,0.633,-0.239,0.9,1.95`},EPSG_4134:{towgs84:`-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006`},EPSG_4254:{towgs84:`18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013`},EPSG_4159:{towgs84:`-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175`},EPSG_4687:{towgs84:`0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093`},EPSG_4227:{towgs84:`-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225`},EPSG_4746:{towgs84:`599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46`},EPSG_4745:{towgs84:`612.4,77,440.2,-0.054,0.057,-2.797,2.55`},EPSG_6311:{towgs84:`8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926`},EPSG_4289:{towgs84:`565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244`},EPSG_4230:{towgs84:`-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4`},EPSG_4154:{towgs84:`-123.02,-158.95,-168.47`},EPSG_4156:{towgs84:`570.8,85.7,462.8,4.998,1.587,5.261,3.56`},EPSG_4299:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4179:{towgs84:`33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84`},EPSG_4313:{towgs84:`-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747`},EPSG_4194:{towgs84:`163.511,127.533,-159.789`},EPSG_4195:{towgs84:`105,326,-102.5`},EPSG_4196:{towgs84:`-45,417,-3.5`},EPSG_4611:{towgs84:`-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246`},EPSG_4633:{towgs84:`137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824`},EPSG_4641:{towgs84:`-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993`},EPSG_4643:{towgs84:`-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002`},EPSG_4300:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4188:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4660:{towgs84:`982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805`},EPSG_4662:{towgs84:`97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259`},EPSG_3906:{towgs84:`577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664`},EPSG_4307:{towgs84:`-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547`},EPSG_6892:{towgs84:`-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686`},EPSG_4690:{towgs84:`221.597,152.441,176.523,2.403,1.3893,0.884,11.4648`},EPSG_4691:{towgs84:`218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817`},EPSG_4629:{towgs84:`72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653`},EPSG_4630:{towgs84:`165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111`},EPSG_4692:{towgs84:`217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093`},EPSG_9333:{towgs84:`0,0,0,-0.008393,0.000749,-0.010276,0`},EPSG_9059:{towgs84:`0,0,0`},EPSG_4312:{towgs84:`601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887`},EPSG_4123:{towgs84:`-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496`},EPSG_4309:{towgs84:`-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365`},ESRI_104106:{towgs84:`-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058`},EPSG_4281:{towgs84:`-219.247,-73.802,269.529`},EPSG_4322:{towgs84:`0,0,4.5`},EPSG_4324:{towgs84:`0,0,1.9`},EPSG_4284:{towgs84:`43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549`},EPSG_4277:{towgs84:`446.448,-125.157,542.06,0.15,0.247,0.842,-20.489`},EPSG_4207:{towgs84:`-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46`},EPSG_4688:{towgs84:`347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647`},EPSG_4689:{towgs84:`410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218`},EPSG_4720:{towgs84:`0,0,4.5`},EPSG_4273:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},EPSG_4240:{towgs84:`204.64,834.74,293.8`},EPSG_4817:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},ESRI_104131:{towgs84:`426.62,142.62,460.09,4.98,4.49,-12.42,-17.1`},EPSG_4265:{towgs84:`-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68`},EPSG_4263:{towgs84:`-111.92,-87.85,114.5,1.875,0.202,0.219,0.032`},EPSG_4298:{towgs84:`-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536`},EPSG_4270:{towgs84:`-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424`},EPSG_4229:{towgs84:`-121.8,98.1,-10.7`},EPSG_4220:{towgs84:`-55.5,-348,-229.2`},EPSG_4214:{towgs84:`12.646,-155.176,-80.863`},EPSG_4232:{towgs84:`-345,3,223`},EPSG_4238:{towgs84:`-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037`},EPSG_4168:{towgs84:`-170,33,326`},EPSG_4131:{towgs84:`199,931,318.9`},EPSG_4152:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_5228:{towgs84:`572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378`},EPSG_8351:{towgs84:`485.021,169.465,483.839,7.786342,4.397554,4.102655,0`},EPSG_4683:{towgs84:`-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06`},EPSG_4133:{towgs84:`0,0,0`},EPSG_7373:{towgs84:`0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693`},EPSG_9075:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9072:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9294:{towgs84:`1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388`},EPSG_4212:{towgs84:`-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492`},EPSG_4191:{towgs84:`-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703`},EPSG_4237:{towgs84:`52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191`},EPSG_4740:{towgs84:`-1.08,-0.27,-0.9`},EPSG_4124:{towgs84:`419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496`},EPSG_5681:{towgs84:`584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922`},EPSG_4141:{towgs84:`23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262`},EPSG_4204:{towgs84:`-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194`},EPSG_4319:{towgs84:`226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798`},EPSG_4200:{towgs84:`24.82,-131.21,-82.66`},EPSG_4130:{towgs84:`0,0,0`},EPSG_4127:{towgs84:`-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359`},EPSG_4149:{towgs84:`674.374,15.056,405.346`},EPSG_4617:{towgs84:`-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0`},EPSG_4663:{towgs84:`-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485`},EPSG_4664:{towgs84:`-211.939,137.626,58.3,-0.089,0.251,0.079,0.384`},EPSG_4665:{towgs84:`-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048`},EPSG_4666:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},EPSG_4756:{towgs84:`-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188`},EPSG_4723:{towgs84:`-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925`},EPSG_4726:{towgs84:`8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081`},EPSG_4267:{towgs84:`-8.0,160.0,176.0`},EPSG_5365:{towgs84:`-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693`},EPSG_4218:{towgs84:`304.5,306.5,-318.1`},EPSG_4242:{towgs84:`-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95`},EPSG_4216:{towgs84:`-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289`},ESRI_104105:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},ESRI_104129:{towgs84:`0,0,0`},EPSG_4673:{towgs84:`174.05,-25.49,112.57`},EPSG_4202:{towgs84:`-124,-60,154`},EPSG_4203:{towgs84:`-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191`},EPSG_3819:{towgs84:`595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408`},EPSG_8694:{towgs84:`-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169`},EPSG_4145:{towgs84:`275.57,676.78,229.6`},EPSG_4283:{towgs84:`0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994`},EPSG_4317:{towgs84:`2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063`},EPSG_4272:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`},EPSG_4248:{towgs84:`-307.7,265.3,-363.5`},EPSG_5561:{towgs84:`24,-121,-76`},EPSG_5233:{towgs84:`-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338`},ESRI_104130:{towgs84:`-86,-98,-119`},ESRI_104102:{towgs84:`682,-203,480`},ESRI_37207:{towgs84:`7,-10,-26`},EPSG_4675:{towgs84:`59.935,118.4,-10.871`},ESRI_104109:{towgs84:`-89.121,-348.182,260.871`},ESRI_104112:{towgs84:`-185.583,-230.096,281.361`},ESRI_104113:{towgs84:`25.1,-275.6,222.6`},IGNF_WGS72G:{towgs84:`0,12,6`},IGNF_NTFG:{towgs84:`-168,-60,320`},IGNF_EFATE57G:{towgs84:`-127,-769,472`},IGNF_PGP50G:{towgs84:`324.8,153.6,172.1`},IGNF_REUN47G:{towgs84:`94,-948,-1262`},IGNF_CSG67G:{towgs84:`-186,230,110`},IGNF_GUAD48G:{towgs84:`-467,-16,-300`},IGNF_TAHI51G:{towgs84:`162,117,154`},IGNF_TAHAAG:{towgs84:`65,342,77`},IGNF_NUKU72G:{towgs84:`84,274,65`},IGNF_PETRELS72G:{towgs84:`365,194,166`},IGNF_WALL78G:{towgs84:`253,-133,-127`},IGNF_MAYO50G:{towgs84:`-382,-59,-262`},IGNF_TANNAG:{towgs84:`-139,-967,436`},IGNF_IGN72G:{towgs84:`-13,-348,292`},IGNF_ATIGG:{towgs84:`1118,23,66`},IGNF_FANGA84G:{towgs84:`150.57,158.33,118.32`},IGNF_RUSAT84G:{towgs84:`202.13,174.6,-15.74`},IGNF_KAUE70G:{towgs84:`126.74,300.1,-75.49`},IGNF_MOP90G:{towgs84:`-10.8,-1.8,12.77`},IGNF_MHPF67G:{towgs84:`338.08,212.58,-296.17`},IGNF_TAHI79G:{towgs84:`160.61,116.05,153.69`},IGNF_ANAA92G:{towgs84:`1.5,3.84,4.81`},IGNF_MARQUI72G:{towgs84:`330.91,-13.92,58.56`},IGNF_APAT86G:{towgs84:`143.6,197.82,74.05`},IGNF_TUBU69G:{towgs84:`237.17,171.61,-77.84`},IGNF_STPM50G:{towgs84:`11.363,424.148,373.13`},EPSG_4150:{towgs84:`674.374,15.056,405.346`},EPSG_4754:{towgs84:`-208.4058,-109.8777,-2.5764`},ESRI_104101:{towgs84:`372.87,149.23,585.29`},EPSG_4693:{towgs84:`0,-0.15,0.68`},EPSG_6207:{towgs84:`293.17,726.18,245.36`},EPSG_4153:{towgs84:`-133.63,-157.5,-158.62`},EPSG_4132:{towgs84:`-241.54,-163.64,396.06`},EPSG_4221:{towgs84:`-154.5,150.7,100.4`},EPSG_4266:{towgs84:`-80.7,-132.5,41.1`},EPSG_4193:{towgs84:`-70.9,-151.8,-41.4`},EPSG_5340:{towgs84:`-0.41,0.46,-0.35`},EPSG_4246:{towgs84:`-294.7,-200.1,525.5`},EPSG_4318:{towgs84:`-3.2,-5.7,2.8`},EPSG_4121:{towgs84:`-199.87,74.79,246.62`},EPSG_4223:{towgs84:`-260.1,5.5,432.2`},EPSG_4158:{towgs84:`-0.465,372.095,171.736`},EPSG_4285:{towgs84:`-128.16,-282.42,21.93`},EPSG_4613:{towgs84:`-404.78,685.68,45.47`},EPSG_4607:{towgs84:`195.671,332.517,274.607`},EPSG_4475:{towgs84:`-381.788,-57.501,-256.673`},EPSG_4208:{towgs84:`-157.84,308.54,-146.6`},EPSG_4743:{towgs84:`70.995,-335.916,262.898`},EPSG_4710:{towgs84:`-323.65,551.39,-491.22`},EPSG_7881:{towgs84:`-0.077,0.079,0.086`},EPSG_4682:{towgs84:`283.729,735.942,261.143`},EPSG_4739:{towgs84:`-156,-271,-189`},EPSG_4679:{towgs84:`-80.01,253.26,291.19`},EPSG_4750:{towgs84:`-56.263,16.136,-22.856`},EPSG_4644:{towgs84:`-10.18,-350.43,291.37`},EPSG_4695:{towgs84:`-103.746,-9.614,-255.95`},EPSG_4292:{towgs84:`-355,21,72`},EPSG_4302:{towgs84:`-61.702,284.488,472.052`},EPSG_4143:{towgs84:`-124.76,53,466.79`},EPSG_4606:{towgs84:`-153,153,307`},EPSG_4699:{towgs84:`-770.1,158.4,-498.2`},EPSG_4247:{towgs84:`-273.5,110.6,-357.9`},EPSG_4160:{towgs84:`8.88,184.86,106.69`},EPSG_4161:{towgs84:`-233.43,6.65,173.64`},EPSG_9251:{towgs84:`-9.5,122.9,138.2`},EPSG_9253:{towgs84:`-78.1,101.6,133.3`},EPSG_4297:{towgs84:`-198.383,-240.517,-107.909`},EPSG_4269:{towgs84:`0,0,0`},EPSG_4301:{towgs84:`-147,506,687`},EPSG_4618:{towgs84:`-59,-11,-52`},EPSG_4612:{towgs84:`0,0,0`},EPSG_4678:{towgs84:`44.585,-131.212,-39.544`},EPSG_4250:{towgs84:`-130,29,364`},EPSG_4144:{towgs84:`214,804,268`},EPSG_4147:{towgs84:`-17.51,-108.32,-62.39`},EPSG_4259:{towgs84:`-254.1,-5.36,-100.29`},EPSG_4164:{towgs84:`-76,-138,67`},EPSG_4211:{towgs84:`-378.873,676.002,-46.255`},EPSG_4182:{towgs84:`-422.651,-172.995,84.02`},EPSG_4224:{towgs84:`-143.87,243.37,-33.52`},EPSG_4225:{towgs84:`-205.57,168.77,-4.12`},EPSG_5527:{towgs84:`-67.35,3.88,-38.22`},EPSG_4752:{towgs84:`98,390,-22`},EPSG_4310:{towgs84:`-30,190,89`},EPSG_9248:{towgs84:`-192.26,65.72,132.08`},EPSG_4680:{towgs84:`124.5,-63.5,-281`},EPSG_4701:{towgs84:`-79.9,-158,-168.9`},EPSG_4706:{towgs84:`-146.21,112.63,4.05`},EPSG_4805:{towgs84:`682,-203,480`},EPSG_4201:{towgs84:`-165,-11,206`},EPSG_4210:{towgs84:`-157,-2,-299`},EPSG_4183:{towgs84:`-104,167,-38`},EPSG_4139:{towgs84:`11,72,-101`},EPSG_4668:{towgs84:`-86,-98,-119`},EPSG_4717:{towgs84:`-2,151,181`},EPSG_4732:{towgs84:`102,52,-38`},EPSG_4280:{towgs84:`-377,681,-50`},EPSG_4209:{towgs84:`-138,-105,-289`},EPSG_4261:{towgs84:`31,146,47`},EPSG_4658:{towgs84:`-73,46,-86`},EPSG_4721:{towgs84:`265.025,384.929,-194.046`},EPSG_4222:{towgs84:`-136,-108,-292`},EPSG_4601:{towgs84:`-255,-15,71`},EPSG_4602:{towgs84:`725,685,536`},EPSG_4603:{towgs84:`72,213.7,93`},EPSG_4605:{towgs84:`9,183,236`},EPSG_4621:{towgs84:`137,248,-430`},EPSG_4657:{towgs84:`-28,199,5`},EPSG_4316:{towgs84:`103.25,-100.4,-307.19`},EPSG_4642:{towgs84:`-13,-348,292`},EPSG_4698:{towgs84:`145,-187,103`},EPSG_4192:{towgs84:`-206.1,-174.7,-87.7`},EPSG_4311:{towgs84:`-265,120,-358`},EPSG_4135:{towgs84:`58,-283,-182`},ESRI_104138:{towgs84:`198,-226,-347`},EPSG_4245:{towgs84:`-11,851,5`},EPSG_4142:{towgs84:`-125,53,467`},EPSG_4213:{towgs84:`-106,-87,188`},EPSG_4253:{towgs84:`-133,-77,-51`},EPSG_4129:{towgs84:`-132,-110,-335`},EPSG_4713:{towgs84:`-77,-128,142`},EPSG_4239:{towgs84:`217,823,299`},EPSG_4146:{towgs84:`295,736,257`},EPSG_4155:{towgs84:`-83,37,124`},EPSG_4165:{towgs84:`-173,253,27`},EPSG_4672:{towgs84:`175,-38,113`},EPSG_4236:{towgs84:`-637,-549,-203`},EPSG_4251:{towgs84:`-90,40,88`},EPSG_4271:{towgs84:`-2,374,172`},EPSG_4175:{towgs84:`-88,4,101`},EPSG_4716:{towgs84:`298,-304,-375`},EPSG_4315:{towgs84:`-23,259,-9`},EPSG_4744:{towgs84:`-242.2,-144.9,370.3`},EPSG_4244:{towgs84:`-97,787,86`},EPSG_4293:{towgs84:`616,97,-251`},EPSG_4714:{towgs84:`-127,-769,472`},EPSG_4736:{towgs84:`260,12,-147`},EPSG_6883:{towgs84:`-235,-110,393`},EPSG_6894:{towgs84:`-63,176,185`},EPSG_4205:{towgs84:`-43,-163,45`},EPSG_4256:{towgs84:`41,-220,-134`},EPSG_4262:{towgs84:`639,405,60`},EPSG_4604:{towgs84:`174,359,365`},EPSG_4169:{towgs84:`-115,118,426`},EPSG_4620:{towgs84:`-106,-129,165`},EPSG_4184:{towgs84:`-203,141,53`},EPSG_4616:{towgs84:`-289,-124,60`},EPSG_9403:{towgs84:`-307,-92,127`},EPSG_4684:{towgs84:`-133,-321,50`},EPSG_4708:{towgs84:`-491,-22,435`},EPSG_4707:{towgs84:`114,-116,-333`},EPSG_4709:{towgs84:`145,75,-272`},EPSG_4712:{towgs84:`-205,107,53`},EPSG_4711:{towgs84:`124,-234,-25`},EPSG_4718:{towgs84:`230,-199,-752`},EPSG_4719:{towgs84:`211,147,111`},EPSG_4724:{towgs84:`208,-435,-229`},EPSG_4725:{towgs84:`189,-79,-202`},EPSG_4735:{towgs84:`647,1777,-1124`},EPSG_4722:{towgs84:`-794,119,-298`},EPSG_4728:{towgs84:`-307,-92,127`},EPSG_4734:{towgs84:`-632,438,-609`},EPSG_4727:{towgs84:`912,-58,1227`},EPSG_4729:{towgs84:`185,165,42`},EPSG_4730:{towgs84:`170,42,84`},EPSG_4733:{towgs84:`276,-57,149`},ESRI_37218:{towgs84:`230,-199,-752`},ESRI_37240:{towgs84:`-7,215,225`},ESRI_37221:{towgs84:`252,-209,-751`},ESRI_4305:{towgs84:`-123,-206,219`},ESRI_104139:{towgs84:`-73,-247,227`},EPSG_4748:{towgs84:`51,391,-36`},EPSG_4219:{towgs84:`-384,664,-48`},EPSG_4255:{towgs84:`-333,-222,114`},EPSG_4257:{towgs84:`-587.8,519.75,145.76`},EPSG_4646:{towgs84:`-963,510,-359`},EPSG_6881:{towgs84:`-24,-203,268`},EPSG_6882:{towgs84:`-183,-15,273`},EPSG_4715:{towgs84:`-104,-129,239`},IGNF_RGF93GDD:{towgs84:`0,0,0`},IGNF_RGM04GDD:{towgs84:`0,0,0`},IGNF_RGSPM06GDD:{towgs84:`0,0,0`},IGNF_RGTAAF07GDD:{towgs84:`0,0,0`},IGNF_RGFG95GDD:{towgs84:`0,0,0`},IGNF_RGNCG:{towgs84:`0,0,0`},IGNF_RGPFGDD:{towgs84:`0,0,0`},IGNF_ETRS89G:{towgs84:`0,0,0`},IGNF_RGR92GDD:{towgs84:`0,0,0`},EPSG_4173:{towgs84:`0,0,0`},EPSG_4180:{towgs84:`0,0,0`},EPSG_4619:{towgs84:`0,0,0`},EPSG_4667:{towgs84:`0,0,0`},EPSG_4075:{towgs84:`0,0,0`},EPSG_6706:{towgs84:`0,0,0`},EPSG_7798:{towgs84:`0,0,0`},EPSG_4661:{towgs84:`0,0,0`},EPSG_4669:{towgs84:`0,0,0`},EPSG_8685:{towgs84:`0,0,0`},EPSG_4151:{towgs84:`0,0,0`},EPSG_9702:{towgs84:`0,0,0`},EPSG_4758:{towgs84:`0,0,0`},EPSG_4761:{towgs84:`0,0,0`},EPSG_4765:{towgs84:`0,0,0`},EPSG_8997:{towgs84:`0,0,0`},EPSG_4023:{towgs84:`0,0,0`},EPSG_4670:{towgs84:`0,0,0`},EPSG_4694:{towgs84:`0,0,0`},EPSG_4148:{towgs84:`0,0,0`},EPSG_4163:{towgs84:`0,0,0`},EPSG_4167:{towgs84:`0,0,0`},EPSG_4189:{towgs84:`0,0,0`},EPSG_4190:{towgs84:`0,0,0`},EPSG_4176:{towgs84:`0,0,0`},EPSG_4659:{towgs84:`0,0,0`},EPSG_3824:{towgs84:`0,0,0`},EPSG_3889:{towgs84:`0,0,0`},EPSG_4046:{towgs84:`0,0,0`},EPSG_4081:{towgs84:`0,0,0`},EPSG_4558:{towgs84:`0,0,0`},EPSG_4483:{towgs84:`0,0,0`},EPSG_5013:{towgs84:`0,0,0`},EPSG_5264:{towgs84:`0,0,0`},EPSG_5324:{towgs84:`0,0,0`},EPSG_5354:{towgs84:`0,0,0`},EPSG_5371:{towgs84:`0,0,0`},EPSG_5373:{towgs84:`0,0,0`},EPSG_5381:{towgs84:`0,0,0`},EPSG_5393:{towgs84:`0,0,0`},EPSG_5489:{towgs84:`0,0,0`},EPSG_5593:{towgs84:`0,0,0`},EPSG_6135:{towgs84:`0,0,0`},EPSG_6365:{towgs84:`0,0,0`},EPSG_5246:{towgs84:`0,0,0`},EPSG_7886:{towgs84:`0,0,0`},EPSG_8431:{towgs84:`0,0,0`},EPSG_8427:{towgs84:`0,0,0`},EPSG_8699:{towgs84:`0,0,0`},EPSG_8818:{towgs84:`0,0,0`},EPSG_4757:{towgs84:`0,0,0`},EPSG_9140:{towgs84:`0,0,0`},EPSG_8086:{towgs84:`0,0,0`},EPSG_4686:{towgs84:`0,0,0`},EPSG_4737:{towgs84:`0,0,0`},EPSG_4702:{towgs84:`0,0,0`},EPSG_4747:{towgs84:`0,0,0`},EPSG_4749:{towgs84:`0,0,0`},EPSG_4674:{towgs84:`0,0,0`},EPSG_4755:{towgs84:`0,0,0`},EPSG_4759:{towgs84:`0,0,0`},EPSG_4762:{towgs84:`0,0,0`},EPSG_4763:{towgs84:`0,0,0`},EPSG_4764:{towgs84:`0,0,0`},EPSG_4166:{towgs84:`0,0,0`},EPSG_4170:{towgs84:`0,0,0`},EPSG_5546:{towgs84:`0,0,0`},EPSG_7844:{towgs84:`0,0,0`},EPSG_4818:{towgs84:`589,76,480`},EPSG_10328:{towgs84:`0,0,0`},EPSG_9782:{towgs84:`0,0,0`},EPSG_9777:{towgs84:`0,0,0`},EPSG_10690:{towgs84:`0,0,0`},EPSG_10639:{towgs84:`0,0,0`},EPSG_10739:{towgs84:`0,0,0`},EPSG_7686:{towgs84:`0,0,0`},EPSG_8900:{towgs84:`0,0,0`},EPSG_5886:{towgs84:`0,0,0`},EPSG_7683:{towgs84:`0,0,0`},EPSG_6668:{towgs84:`0,0,0`},EPSG_20046:{towgs84:`0,0,0`},EPSG_10299:{towgs84:`0,0,0`},EPSG_10310:{towgs84:`0,0,0`},EPSG_10475:{towgs84:`0,0,0`},EPSG_4742:{towgs84:`0,0,0`},EPSG_10671:{towgs84:`0,0,0`},EPSG_10762:{towgs84:`0,0,0`},EPSG_10725:{towgs84:`0,0,0`},EPSG_10791:{towgs84:`0,0,0`},EPSG_10800:{towgs84:`0,0,0`},EPSG_10305:{towgs84:`0,0,0`},EPSG_10941:{towgs84:`0,0,0`},EPSG_10968:{towgs84:`0,0,0`},EPSG_10875:{towgs84:`0,0,0`},EPSG_6318:{towgs84:`0,0,0`},EPSG_10910:{towgs84:`0,0,0`}};for(var St in xt){var Ct=xt[St];Ct.datumName&&(xt[Ct.datumName]=Ct)}function wt(e,t,n,r,i,a,o){var s={};return s.datum_type=5,t&&(s.datum_type=4,s.datum_params=t.map(parseFloat),(s.datum_params[0]!==0||s.datum_params[1]!==0||s.datum_params[2]!==0)&&(s.datum_type=1),s.datum_params.length>3&&(s.datum_params[3]!==0||s.datum_params[4]!==0||s.datum_params[5]!==0||s.datum_params[6]!==0)&&(s.datum_type=2,s.datum_params[3]*=R,s.datum_params[4]*=R,s.datum_params[5]*=R,s.datum_params[6]=s.datum_params[6]/1e6+1)),o&&(s.datum_type=3,s.grids=o),s.a=n,s.b=r,s.es=i,s.ep2=a,s}var Tt={};function Et(e,t,n){return t instanceof ArrayBuffer?Dt(e,t,n):{ready:Ot(e,t)}}function Dt(e,t,n){var r=!0;n!==void 0&&n.includeErrorFields===!1&&(r=!1);var i=new DataView(t),a=Nt(i),o=Pt(i,a),s={header:o,subgrids:It(i,o,a,r)};return Tt[e]=s,s}async function Ot(e,t){for(var n=[],r=await t.getImageCount(),i=r-1;i>=0;i--){var a=await t.getImage(i),o=await a.readRasters(),s=[a.getWidth(),a.getHeight()],c=a.getBoundingBox().map(jt),l=typeof a.fileDirectory.getValue==`function`?a.fileDirectory.getValue(`ModelPixelScale`):a.fileDirectory.ModelPixelScale,u=[l[0],l[1]].map(jt),d=c[0]+(s[0]-1)*u[0],f=c[3]-(s[1]-1)*u[1],p=o[0],m=o[1],h=[];for(let e=s[1]-1;e>=0;e--)for(let t=s[0]-1;t>=0;t--){var g=e*s[0]+t;h.push([-Mt(m[g]),Mt(p[g])])}n.push({del:u,lim:s,ll:[-d,f],cvs:h})}var _={header:{nSubgrids:r},subgrids:n};return Tt[e]=_,_}function kt(e){return e===void 0?null:e.split(`,`).map(At)}function At(e){if(e.length===0)return null;var t=e[0]===`@`;return t&&(e=e.slice(1)),e===`null`?{name:`null`,mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:Tt[e]||null,isNull:!1}}function jt(e){return e*Math.PI/180}function Mt(e){return e/3600*Math.PI/180}function Nt(e){var t=e.getInt32(8,!1);return t!==11&&(t=e.getInt32(8,!0),t!==11&&console.warn(`Failed to detect nadgrid endian-ness, defaulting to little-endian`),!0)}function Pt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Ft(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function Ft(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function It(e,t,n,r){for(var i=176,a=[],o=0;o<t.nSubgrids;o++){var s=Rt(e,i,n),c=zt(e,i,s,n,r),l=Math.round(1+(s.upperLongitude-s.lowerLongitude)/s.longitudeInterval),u=Math.round(1+(s.upperLatitude-s.lowerLatitude)/s.latitudeInterval);a.push({ll:[Mt(s.lowerLongitude),Mt(s.lowerLatitude)],del:[Mt(s.longitudeInterval),Mt(s.latitudeInterval)],lim:[l,u],count:s.gridNodeCount,cvs:Lt(c)});var d=16;r===!1&&(d=8),i+=176+s.gridNodeCount*d}return a}function Lt(e){return e.map(function(e){return[Mt(e.longitudeShift),Mt(e.latitudeShift)]})}function Rt(e,t,n){return{name:Ft(e,t+8,t+16).trim(),parent:Ft(e,t+24,t+24+8).trim(),lowerLatitude:e.getFloat64(t+72,n),upperLatitude:e.getFloat64(t+88,n),lowerLongitude:e.getFloat64(t+104,n),upperLongitude:e.getFloat64(t+120,n),latitudeInterval:e.getFloat64(t+136,n),longitudeInterval:e.getFloat64(t+152,n),gridNodeCount:e.getInt32(t+168,n)}}function zt(e,t,n,r,i){var a=t+176,o=16;i===!1&&(o=8);for(var s=[],c=0;c<n.gridNodeCount;c++){var l={latitudeShift:e.getFloat32(a+c*o,r),longitudeShift:e.getFloat32(a+c*o+4,r)};i!==!1&&(l.latitudeAccuracy=e.getFloat32(a+c*o+8,r),l.longitudeAccuracy=e.getFloat32(a+c*o+12,r)),s.push(l)}return s}function Bt(e,t){if(!(this instanceof Bt))return new Bt(e);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,t||=function(e){if(e)throw e};var n=Xe(e);if(typeof n!=`object`)t(`Could not parse to valid json: `+e);else{var r=Bt.projections.get(n.projName);if(!r)t(`Could not get projection name from: `+e);else{if(n.datumCode&&n.datumCode!==`none`){var i=ue(xt,n.datumCode);i&&(n.datum_params=n.datum_params||(i.towgs84?i.towgs84.split(`,`):null),n.ellps=i.ellipse,n.datumName=i.datumName?i.datumName:n.datumCode)}n.axis=n.axis||`enu`,n.ellps=n.ellps||`wgs84`,n.lat1=n.lat1||n.lat0;var a=bt(n.a,n.b,n.rf,n.ellps,n.sphere),o=yt(a.a,a.b,a.rf,n.R_A),s=kt(n.nadgrids),c=n.datum||wt(n.datumCode,n.datum_params,a.a,a.b,o.es,o.ep2,s);Ze(this,n),Ze(this,r),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=c,`init`in this&&typeof this.init==`function`&&this.init(),this.k0||=1,t(null,this)}}}Bt.projections=gt,Bt.projections.start();function Vt(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===1?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type!==2||e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]}function Ht(e,t,n){var r=e.x,i=e.y,a=e.z?e.z:0,o,s,c,l;if(i<-z&&i>-1.001*z)i=-z;else if(i>z&&i<1.001*z)i=z;else if(i<-z)return{x:-1/0,y:-1/0,z:e.z};else if(i>z)return{x:1/0,y:1/0,z:e.z};return r>Math.PI&&(r-=2*Math.PI),s=Math.sin(i),l=Math.cos(i),c=s*s,o=n/Math.sqrt(1-t*c),{x:(o+a)*l*Math.cos(r),y:(o+a)*l*Math.sin(r),z:(o*(1-t)+a)*s}}function Ut(e,t,n,r){var i=1e-12,a=i*i,o=30,s,c,l,u,d,f,p,m,h,g,_,v,y,b=e.x,x=e.y,S=e.z?e.z:0,C,w,T;if(s=Math.sqrt(b*b+x*x),c=Math.sqrt(b*b+x*x+S*S),s/n<i){if(C=0,c/n<i)return w=z,T=-r,{x:e.x,y:e.y,z:e.z}}else C=Math.atan2(x,b);l=S/c,u=s/c,d=1/Math.sqrt(1-t*(2-t)*u*u),m=u*(1-t)*d,h=l*d,y=0;do y++,p=n/Math.sqrt(1-t*h*h),T=s*m+S*h-p*(1-t*h*h),f=t*p/(p+T),d=1/Math.sqrt(1-f*(2-f)*u*u),g=u*(1-f)*d,_=l*d,v=_*m-g*h,m=g,h=_;while(v*v>a&&y<o);return w=Math.atan(_/Math.abs(g)),{x:C,y:w,z:T}}function Wt(e,t,n){if(t===1)return{x:e.x+n[0],y:e.y+n[1],z:e.z+n[2]};if(t===2){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6];return{x:l*(e.x-c*e.y+s*e.z)+r,y:l*(c*e.x+e.y-o*e.z)+i,z:l*(-s*e.x+o*e.y+e.z)+a}}}function Gt(e,t,n){if(t===1)return{x:e.x-n[0],y:e.y-n[1],z:e.z-n[2]};if(t===2){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=(e.x-r)/l,d=(e.y-i)/l,f=(e.z-a)/l;return{x:u+c*d-s*f,y:-c*u+d+o*f,z:s*u-o*d+f}}}function Kt(e){return e===1||e===2}function qt(e,t,n){if(Vt(e,t)||e.datum_type===5||t.datum_type===5)return n;var r=e.a,i=e.es;if(e.datum_type===3){if(Jt(e,!1,n)!==0)return;r=ne,i=L}var a=t.a,o=t.b,s=t.es;if(t.datum_type===3&&(a=ne,o=re,s=L),i===s&&r===a&&!Kt(e.datum_type)&&!Kt(t.datum_type)||(n=Ht(n,i,r),Kt(e.datum_type)&&(n=Wt(n,e.datum_type,e.datum_params)),Kt(t.datum_type)&&(n=Gt(n,t.datum_type,t.datum_params)),n=Ut(n,s,a,o),t.datum_type!==3||Jt(t,!0,n)===0))return n}function Jt(e,t,n){if(e.grids===null||e.grids.length===0)return console.log(`Grid shift grids not found`),-1;var r={x:-n.x,y:n.y},i={x:NaN,y:NaN},a=[];outer:for(var o=0;o<e.grids.length;o++){var s=e.grids[o];if(a.push(s.name),s.isNull){i=r;break}if(s.grid===null){if(s.mandatory)return console.log(`Unable to find mandatory grid '`+s.name+`'`),-1}else for(var c=s.grid.subgrids,l=0,u=c.length;l<u;l++){var d=c[l],f=(Math.abs(d.del[1])+Math.abs(d.del[0]))/1e4,p=d.ll[0]-f,m=d.ll[1]-f,h=d.ll[0]+(d.lim[0]-1)*d.del[0]+f,g=d.ll[1]+(d.lim[1]-1)*d.del[1]+f;if(!(m>r.y||p>r.x||g<r.y||h<r.x)&&(i=Yt(r,t,d),!isNaN(i.x)))break outer}}return isNaN(i.x)?(console.log(`Failed to find a grid shift table for location '`+-r.x*H+` `+r.y*H+` tried: '`+a+`'`),-1):(n.x=-i.x,n.y=i.y,0)}function Yt(e,t,n){var r={x:NaN,y:NaN};if(isNaN(e.x))return r;var i={x:e.x,y:e.y};i.x-=n.ll[0],i.y-=n.ll[1],i.x=q(i.x-Math.PI)+Math.PI;var a=Xt(i,n);if(t){if(isNaN(a.x))return r;a.x=i.x-a.x,a.y=i.y-a.y;var o=9,s=1e-12,c,l;do{if(l=Xt(a,n),isNaN(l.x)){console.log(`Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.`);break}c={x:i.x-(l.x+a.x),y:i.y-(l.y+a.y)},a.x+=c.x,a.y+=c.y}while(o--&&Math.abs(c.x)>s&&Math.abs(c.y)>s);if(o<0)return console.log(`Inverse grid shift iterator failed to converge.`),r;r.x=q(a.x+n.ll[0]),r.y=a.y+n.ll[1]}else isNaN(a.x)||(r.x=e.x+a.x,r.y=e.y+a.y);return r}function Xt(e,t){var n={x:e.x/t.del[0],y:e.y/t.del[1]},r={x:Math.floor(n.x),y:Math.floor(n.y)},i={x:n.x-1*r.x,y:n.y-1*r.y},a={x:NaN,y:NaN},o;if(r.x<0||r.x>=t.lim[0]||r.y<0||r.y>=t.lim[1])return a;o=r.y*t.lim[0]+r.x;var s={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var l={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var u={x:t.cvs[o][0],y:t.cvs[o][1]},d=i.x*i.y,f=i.x*(1-i.y),p=(1-i.x)*(1-i.y),m=(1-i.x)*i.y;return a.x=p*s.x+f*c.x+m*u.x+d*l.x,a.y=p*s.y+f*c.y+m*u.y+d*l.y,a}var Zt=[`x`,`y`,`z`];function Qt(e,t){let n={};for(let r=0,i=e.axis.length;r<i;r++){if(r===2&&t.z===void 0)continue;let i=t[Zt[r]];switch(e.axis[r]){case`e`:n.x=i;break;case`w`:n.x=-i;break;case`n`:n.y=i;break;case`s`:n.y=-i;break;case`u`:n.z=i;break;case`d`:n.z=-i;break;default:return null}}return n}function $t(e,t){let n={};for(let r=0,i=e.axis.length;r<i;r++)if(r!==2||t.z!==void 0)switch(e.axis[r]){case`e`:n[Zt[r]]=t.x;break;case`w`:n[Zt[r]]=-t.x;break;case`n`:n[Zt[r]]=t.y;break;case`s`:n[Zt[r]]=-t.y;break;case`u`:n[Zt[r]]=t.z;break;case`d`:n[Zt[r]]=-t.z;break;default:return null}return n}function en(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function tn(e){nn(e.x),nn(e.y)}function nn(e){if(typeof Number.isFinite==`function`){if(Number.isFinite(e))return;throw TypeError(`coordinates must be finite numbers`)}if(typeof e!=`number`||e!==e||!isFinite(e))throw TypeError(`coordinates must be finite numbers`)}function rn(e,t){return(e.datum.datum_type===1||e.datum.datum_type===2||e.datum.datum_type===3)&&t.datumCode!==`WGS84`||(t.datum.datum_type===1||t.datum.datum_type===2||t.datum.datum_type===3)&&e.datumCode!==`WGS84`}function an(e,t,n,r){var i,a=n.z!==void 0;if(tn(n),e.datum&&t.datum&&rn(e,t)&&(i=new Bt(`WGS84`),n=an(e,i,n,r),e=i),r&&e.axis!==`enu`&&(n=Qt(e,n)),e.projName===`longlat`)n={x:n.x*V,y:n.y*V,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),n=e.inverse(n),!n)return;if(e.from_greenwich&&(n.x+=e.from_greenwich),n=qt(e.datum,t.datum,n),n)return n=n,t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),t.projName===`longlat`?(t.long_wrap!==void 0&&(n.x=t.long_wrap+q(n.x-t.long_wrap)),n={x:n.x*H,y:n.y*H,z:n.z||0}):(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),r&&t.axis!==`enu`?$t(t,n):(n&&!a&&t.projName!==`geocent`&&delete n.z,n)}function on(e,t,n,r){return an(e,t,Array.isArray(n)?en(n):{x:n.x,y:n.y,z:n.z,m:n.m},r)}var sn=Bt(`WGS84`);function cn(e,t,n,r){var i,a,o;return Array.isArray(n)?(i=an(e,t,en(n),r)||{x:NaN,y:NaN},n.length>2?(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,a?typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y,n[2]].concat(n.slice(3)):r&&typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y].concat(n.slice(2))):[i.x,i.y]):(i=an(e,t,{x:n.x,y:n.y,z:n.z,m:n.m},r)||{x:NaN,y:NaN},o=Object.keys(n),o.length===2||(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,o.forEach(function(e){e!==`x`&&e!==`y`&&(e!==`z`||!a&&!r)&&(i[e]=n[e])})),i)}function ln(e){return e instanceof Bt?e:typeof e==`object`&&`oProj`in e?e.oProj:Bt(e)}function un(e,t,n){var r,i,a=!1,o;return t===void 0?(i=ln(e),r=sn,a=!0):(t.x!==void 0||Array.isArray(t))&&(n=t,i=ln(e),r=sn,a=!0),r||=ln(e),i||=ln(t),n?cn(r,i,n):(o={forward:function(e,t){return cn(r,i,e,t)},inverse:function(e,t){return cn(i,r,e,t)}},a&&(o.oProj=i),o)}var dn=6,fn=`AJSAJS`,pn=`AFAFAF`,mn=65,J=73,hn=79,gn=86,_n=90,vn={forward:yn,inverse:bn,toPoint:xn};function yn(e,t){return t||=5,Dn(wn({lat:e[1],lon:e[0]}),t)}function bn(e){var t=Tn(jn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function xn(e){var t=Tn(jn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function Sn(e){return Math.PI/180*e}function Cn(e){return e/Math.PI*180}function wn(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,a=.9996,o,s,c,l,u,d,f,p=Sn(t),m=Sn(n),h,g=Math.floor((n+180)/6)+1;n===180&&(g=60),t>=56&&t<64&&n>=3&&n<12&&(g=32),t>=72&&t<84&&(n>=0&&n<9?g=31:n>=9&&n<21?g=33:n>=21&&n<33?g=35:n>=33&&n<42&&(g=37)),o=(g-1)*6-180+3,h=Sn(o),s=i/(1-i),c=r/Math.sqrt(1-i*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),u=s*Math.cos(p)*Math.cos(p),d=Math.cos(p)*(m-h),f=r*((1-i/4-3*i*i/64-5*i*i*i/256)*p-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*p)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*p)-35*i*i*i/3072*Math.sin(6*p));var _=a*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-58*s)*d*d*d*d*d/120)+5e5,v=a*(f+c*Math.tan(p)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-330*s)*d*d*d*d*d*d/720));return t<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(_),zoneNumber:g,zoneLetter:En(t)}}function Tn(e){var t=e.northing,n=e.easting,r=e.zoneLetter,i=e.zoneNumber;if(i<0||i>60)return null;var a=.9996,o=6378137,s=.00669438,c,l=(1-Math.sqrt(1-s))/(1+Math.sqrt(1-s)),u,d,f,p,m,h,g,_,v,y=n-5e5,b=t;r<`N`&&(b-=1e7),g=(i-1)*6-180+3,c=s/(1-s),h=b/a,_=h/(o*(1-s/4-3*s*s/64-5*s*s*s/256)),v=_+(3*l/2-27*l*l*l/32)*Math.sin(2*_)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*_)+151*l*l*l/96*Math.sin(6*_),u=o/Math.sqrt(1-s*Math.sin(v)*Math.sin(v)),d=Math.tan(v)*Math.tan(v),f=c*Math.cos(v)*Math.cos(v),p=o*(1-s)/(1-s*Math.sin(v)*Math.sin(v))**1.5,m=y/(u*a);var x=v-u*Math.tan(v)/p*(m*m/2-(5+3*d+10*f-4*f*f-9*c)*m*m*m*m/24+(61+90*d+298*f+45*d*d-252*c-3*f*f)*m*m*m*m*m*m/720);x=Cn(x);var S=(m-(1+2*d+f)*m*m*m/6+(5-2*f+28*d-3*f*f+8*c+24*d*d)*m*m*m*m*m/120)/Math.cos(v);S=g+Cn(S);var C;if(e.accuracy){var w=Tn({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});C={top:w.lat,right:w.lon,bottom:x,left:S}}else C={lat:x,lon:S};return C}function En(e){var t=`Z`;return 84>=e&&e>=72?t=`X`:72>e&&e>=64?t=`W`:64>e&&e>=56?t=`V`:56>e&&e>=48?t=`U`:48>e&&e>=40?t=`T`:40>e&&e>=32?t=`S`:32>e&&e>=24?t=`R`:24>e&&e>=16?t=`Q`:16>e&&e>=8?t=`P`:8>e&&e>=0?t=`N`:0>e&&e>=-8?t=`M`:-8>e&&e>=-16?t=`L`:-16>e&&e>=-24?t=`K`:-24>e&&e>=-32?t=`J`:-32>e&&e>=-40?t=`H`:-40>e&&e>=-48?t=`G`:-48>e&&e>=-56?t=`F`:-56>e&&e>=-64?t=`E`:-64>e&&e>=-72?t=`D`:-72>e&&e>=-80&&(t=`C`),t}function Dn(e,t){var n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+On(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function On(e,t,n){var r=kn(n);return An(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}function kn(e){var t=e%dn;return t===0&&(t=dn),t}function An(e,t,n){var r=n-1,i=fn.charCodeAt(r),a=pn.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>_n&&(o=o-_n+mn-1,c=!0),(o===J||i<J&&o>J||(o>J||i<J)&&c)&&o++,(o===hn||i<hn&&o>hn||(o>hn||i<hn)&&c)&&(o++,o===J&&o++),o>_n&&(o=o-_n+mn-1),s>gn?(s=s-gn+mn-1,c=!0):c=!1,(s===J||a<J&&s>J||(s>J||a<J)&&c)&&s++,(s===hn||a<hn&&s>hn||(s>hn||a<hn)&&c)&&(s++,s===J&&s++),s>gn&&(s=s-gn+mn-1),String.fromCharCode(o)+String.fromCharCode(s)}function jn(e){if(e&&e.length===0)throw`MGRSPoint coverting from nothing`;for(var t=e.length,n=null,r=``,i,a=0;!/[A-Z]/.test(i=e.charAt(a));){if(a>=2)throw`MGRSPoint bad conversion from: `+e;r+=i,a++}var o=parseInt(r,10);if(a===0||a+3>t)throw`MGRSPoint bad conversion from: `+e;var s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw`MGRSPoint zone letter `+s+` not handled: `+e;n=e.substring(a,a+=2);for(var c=kn(o),l=Mn(n.charAt(0),c),u=Nn(n.charAt(1),c);u<Pn(s);)u+=2e6;var d=t-a;if(d%2!=0)throw`MGRSPoint has to have an even number
2
3
  of digits after the zone letter and two 100km letters - front
3
4
  half for easting meters, second half for
4
- northing meters`+e;var f=d/2,p=0,m=0,h,g,_,v,y;return f>0&&(h=1e5/10**f,g=e.substring(a,a+f),p=parseFloat(g)*h,_=e.substring(a+f),m=parseFloat(_)*h),v=p+l,y=m+u,{easting:v,northing:y,zoneLetter:s,zoneNumber:o,accuracy:h}}function On(e,t){for(var n=ln.charCodeAt(t-1),r=1e5,i=!1;n!==e.charCodeAt(0);){if(n++,n===q&&n++,n===J&&n++,n>pn){if(i)throw`Bad character: `+e;n=dn,i=!0}r+=1e5}return r}function kn(e,t){if(e>`V`)throw`MGRSPoint given invalid Northing `+e;for(var n=un.charCodeAt(t-1),r=0,i=!1;n!==e.charCodeAt(0);){if(n++,n===q&&n++,n===J&&n++,n>fn){if(i)throw`Bad character: `+e;n=dn,i=!0}r+=1e5}return r}function An(e){var t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw`Invalid zone letter: `+e}function jn(e,t,n){if(!(this instanceof jn))return new jn(e,t,n);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==`object`)this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==`string`&&t===void 0){var r=e.split(`,`);this.x=parseFloat(r[0]),this.y=parseFloat(r[1]),this.z=parseFloat(r[2])||0}else this.x=e,this.y=t,this.z=n||0;console.warn(`proj4.Point will be removed in version 3, use proj4.toPoint`)}jn.fromMGRS=function(e){return new jn(_n(e))},jn.prototype.toMGRS=function(e){return hn([this.x,this.y],e)};var Mn=1,Nn=.25,Pn=.046875,Fn=.01953125,In=.01068115234375,Ln=.75,Rn=.46875,zn=.013020833333333334,Bn=.007120768229166667,Vn=.3645833333333333,Hn=.005696614583333333,Un=.3076171875;function Wn(e){var t=[];t[0]=Mn-e*(Nn+e*(Pn+e*(Fn+e*In))),t[1]=e*(Ln-e*(Pn+e*(Fn+e*In)));var n=e*e;return t[2]=n*(Rn-e*(zn+e*Bn)),n*=e,t[3]=n*(Vn-e*Hn),t[4]=n*e*Un,t}function Gn(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}var Kn=20;function qn(e,t,n){for(var r=1/(1-t),i=e,a=Kn;a;--a){var o=Math.sin(i),s=1-t*o*o;if(s=(Gn(i,o,Math.cos(i),n)-e)*(s*Math.sqrt(s))*r,i-=s,Math.abs(s)<1e-10)return i}return i}function Jn(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.es&&(this.en=Wn(this.es),this.ml0=Gn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Yn(e){var t=e.x,n=e.y,r=W(t-this.long0,this.over),i,a,o,s=Math.sin(n),c=Math.cos(n);if(this.es){var l=c*r,u=l**2,d=this.ep2*c**2,f=d**2,p=(Math.abs(c)>1e-10?Math.tan(n):0)**2,m=p**2;i=1-this.es*s**2,l/=Math.sqrt(i);var h=Gn(n,s,c,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+d+u/20*(5-18*p+m+14*d-58*p*d+u/42*(61+179*m-m*p-479*p)))))+this.x0,o=this.a*(this.k0*(h-this.ml0+s*r*l/2*(1+u/12*(5-p+9*d+4*f+u/30*(61+m-58*p+270*d-330*p*d+u/56*(1385+543*m-m*p-3111*p))))))+this.y0}else{var g=c*Math.sin(r);if(Math.abs(Math.abs(g)-1)<1e-10)return 93;if(a=.5*this.a*this.k0*Math.log((1+g)/(1-g))+this.x0,o=c*Math.cos(r)/Math.sqrt(1-g**2),g=Math.abs(o),g>=1){if(g-1>1e-10)return 93;o=0}else o=Math.acos(o);n<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=a,e.y=o,e}function Xn(e){var t,n,r,i,a=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(!this.es){var s=Math.exp(a/this.k0),c=.5*(s-1/s),l=this.lat0+o/this.k0,u=Math.cos(l);t=Math.sqrt((1-u**2)/(1+c**2)),r=Math.asin(t),o<0&&(r=-r),i=c===0&&u===0?0:W(Math.atan2(c,u)+this.long0,this.over)}else if(t=this.ml0+o/this.k0,n=qn(t,this.es,this.en),Math.abs(n)<I){var d=Math.sin(n),f=Math.cos(n),p=Math.abs(f)>1e-10?Math.tan(n):0,m=this.ep2*f**2,h=m**2,g=p**2,_=g**2;t=1-this.es*d**2;var v=a*Math.sqrt(t)/this.k0,y=v**2;t*=p,r=n-t*y/(1-this.es)*.5*(1-y/12*(5+3*g-9*m*g+m-4*h-y/30*(61+90*g-252*m*g+45*_+46*m-y/56*(1385+3633*g+4095*_+1574*_*g)))),i=W(this.long0+v*(1-y/6*(1+2*g+m-y/20*(5+28*g+24*_+8*m*g+6*m-y/42*(61+662*g+1320*_+720*_*g))))/f,this.over)}else r=I*Qe(o),i=0;return e.x=i,e.y=r,e}var Zn={init:Jn,forward:Yn,inverse:Xn,names:[`Fast_Transverse_Mercator`,`Fast Transverse Mercator`]};function Qn(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Y(e,t){e=Math.abs(e),t=Math.abs(t);var n=Math.max(e,t),r=Math.min(e,t)/(n||1);return n*Math.sqrt(1+r**2)}function $n(e){var t=1+e,n=t-1;return n===0?e:e*Math.log(t)/n}function er(e){var t=Math.abs(e);return t=$n(t*(1+t/(Y(1,t)+1))),e<0?-t:t}function tr(e,t){for(var n=2*Math.cos(2*t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return t+o*Math.sin(2*t)}function nr(e,t){for(var n=2*Math.cos(t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return Math.sin(t)*o}function rr(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function ir(e,t,n){for(var r=Math.sin(t),i=Math.cos(t),a=Qn(n),o=rr(n),s=2*i*o,c=-2*r*a,l=e.length-1,u=e[l],d=0,f=0,p=0,m,h;--l>=0;)m=f,h=d,f=u,d=p,u=-m+s*f-c*d+e[l],p=-h+c*f+s*d;return s=r*o,c=i*a,[s*u-c*p,s*p+c*u]}function ar(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw Error(`Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.`);this.approx&&(Zn.init.apply(this),this.forward=Zn.forward,this.inverse=Zn.inverse),this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.k0=this.k0===void 0?1:this.k0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+-2854/675*t))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))),n*=t,this.cgb[1]=n*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+2323/945*t)))),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=n*(-26/15+t*(34/21+t*(8/5+-12686/2835*t))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=n*(1237/630+t*(-12/5+-24832/14175*t)),n*=t,this.cgb[4]=n*(4174/315+-144838/6237*t),this.cbg[4]=n*(-734/315+109598/31185*t),n*=t,this.cgb[5]=601676/22275*n,this.cbg[5]=444337/155925*n,n=t**2,this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=n*(13/48+t*(-3/5+t*(557/1440+t*(281/630+-1983433/1935360*t)))),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=n*(49561/161280+t*(-179/168+6601661/7257600*t)),n*=t,this.utg[4]=n*(-4583/161280+108847/3991680*t),this.gtu[4]=n*(34729/80640+-3418889/1995840*t),n*=t,this.utg[5]=-20648693/638668800*n,this.gtu[5]=212378941/319334400*n;var r=tr(this.cbg,this.lat0);this.Zb=-this.Qn*(r+nr(this.gtu,2*r))}function or(e){var t=W(e.x-this.long0,this.over),n=e.y;n=tr(this.cbg,n);var r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t);n=Math.atan2(r,o*i),t=Math.atan2(a*i,Y(r,i*o)),t=er(Math.tan(t));var s=ir(this.gtu,2*n,2*t);n+=s[0],t+=s[1];var c,l;return Math.abs(t)<=2.623395162778?(c=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*n+this.Zb)+this.y0):(c=1/0,l=1/0),e.x=c,e.y=l,e}function sr(e){var t=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn,t/=this.Qn;var r,i;if(Math.abs(t)<=2.623395162778){var a=ir(this.utg,2*n,2*t);n+=a[0],t+=a[1],t=Math.atan(Qn(t));var o=Math.sin(n),s=Math.cos(n),c=Math.sin(t),l=Math.cos(t);n=Math.atan2(o*l,Y(c,l*s)),t=Math.atan2(c,l*s),r=W(t+this.long0,this.over),i=tr(this.cgb,n)}else r=1/0,i=1/0;return e.x=r,e.y=i,e}var cr={init:ar,forward:or,inverse:sr,names:[`Extended_Transverse_Mercator`,`Extended Transverse Mercator`,`etmerc`,`Transverse_Mercator`,`Transverse Mercator`,`Gauss Kruger`,`Gauss_Kruger`,`tmerc`]};function lr(e,t){if(e===void 0){if(e=Math.floor((W(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var ur=`etmerc`;function dr(){var e=lr(this.zone,this.long0);if(e===void 0)throw Error(`unknown utm zone`);this.lat0=0,this.long0=(6*Math.abs(e)-183)*L,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,cr.init.apply(this),this.forward=cr.forward,this.inverse=cr.inverse}var fr={init:dr,names:[`Universal Transverse Mercator System`,`utm`],dependsOn:ur};function pr(e,t){return((1-e)/(1+e))**t}var mr=20;function hr(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+z)/(Math.tan(.5*this.lat0+z)**+this.C*pr(this.e*e,this.ratexp))}function gr(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.tan(.5*n+z)**+this.C*pr(this.e*Math.sin(n),this.ratexp))-I,e.x=this.C*t,e}function _r(e){for(var t=1e-14,n=e.x/this.C,r=e.y,i=(Math.tan(.5*r+z)/this.K)**(1/this.C),a=mr;a>0&&(r=2*Math.atan(i*pr(this.e*Math.sin(e.y),-.5*this.e))-I,!(Math.abs(r-e.y)<t));--a)e.y=r;return a?(e.x=n,e.y=r,e):null}var vr={init:hr,forward:gr,inverse:_r,names:[`gauss`]};function yr(){vr.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||=`Oblique Stereographic Alternative`)}function br(e){var t,n,r,i;return e.x=W(e.x-this.long0,this.over),vr.forward.apply(this,[e]),t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*n*r),e.x=i*n*Math.sin(e.x),e.y=i*(this.cosc0*t-this.sinc0*n*r),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function xr(e){var t,n,r,i,a;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,a=Y(e.x,e.y)){var o=2*Math.atan2(a,this.R2);t=Math.sin(o),n=Math.cos(o),i=Math.asin(n*this.sinc0+e.y*t*this.cosc0/a),r=Math.atan2(e.x*t,a*this.cosc0*n-e.y*this.sinc0*t)}else i=this.phic0,r=0;return e.x=r,e.y=i,vr.inverse.apply(this,[e]),e.x=W(e.x+this.long0,this.over),e}var Sr={init:yr,forward:br,inverse:xr,names:[`Stereographic_North_Pole`,`Oblique_Stereographic`,`sterea`,`Oblique Stereographic Alternative`,`Double_Stereographic`]};function Cr(e,t,n){return t*=n,Math.tan(.5*(I+e))*((1-t)/(1+t))**(.5*n)}function wr(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&(this.k0=.5*(1+Qe(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=1e-10&&(this.con=this.lat0>0?1:-1),this.cons=Math.sqrt((1+this.e)**+(1+this.e)*(1-this.e)**(1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&Math.abs(Math.cos(this.lat_ts))>1e-10&&(this.k0=.5*this.cons*Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/G(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Ze(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Cr(this.lat0,this.sinlat0,this.e))-I,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Tr(e){var t=e.x,n=e.y,r=Math.sin(n),i=Math.cos(n),a,o,s,c,l,u,d=W(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=1e-10&&Math.abs(n+this.lat0)<=1e-10?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*r+this.coslat0*i*Math.cos(d)),e.x=this.a*a*i*Math.sin(d)+this.x0,e.y=this.a*a*(this.coslat0*r-this.sinlat0*i*Math.cos(d))+this.y0,e):(o=2*Math.atan(Cr(n,r,this.e))-I,c=Math.cos(o),s=Math.sin(o),Math.abs(this.coslat0)<=1e-10?(l=G(this.e,n*this.con,this.con*r),u=2*this.a*this.k0*l/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<1e-10?(a=2*this.a*this.k0/(1+c*Math.cos(d)),e.y=a*s):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*c*Math.cos(d))),e.y=a*(this.cosX0*s-this.sinX0*c*Math.cos(d))+this.y0),e.x=a*c*Math.sin(d)+this.x0,e))}function Er(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var s=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,n=this.lat0,o<=1e-10?(e.x=t,e.y=n,e):(n=Math.asin(Math.cos(s)*this.sinlat0+e.y*Math.sin(s)*this.coslat0/o),t=Math.abs(this.coslat0)<1e-10?this.lat0>0?W(this.long0+Math.atan2(e.x,-1*e.y),this.over):W(this.long0+Math.atan2(e.x,e.y),this.over):W(this.long0+Math.atan2(e.x*Math.sin(s),o*this.coslat0*Math.cos(s)-e.y*this.sinlat0*Math.sin(s)),this.over),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=1e-10){if(o<=1e-10)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,r=o*this.cons/(2*this.a*this.k0),n=this.con*$e(this.e,r),t=this.con*W(this.con*this.long0+Math.atan2(e.x,-1*e.y),this.over)}else i=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=1e-10?a=this.X0:(a=Math.asin(Math.cos(i)*this.sinX0+e.y*Math.sin(i)*this.cosX0/o),t=W(this.long0+Math.atan2(e.x*Math.sin(i),o*this.cosX0*Math.cos(i)-e.y*this.sinX0*Math.sin(i)),this.over)),n=-1*$e(this.e,Math.tan(.5*(I+a)));return e.x=t,e.y=n,e}var Dr={init:wr,forward:Tr,inverse:Er,names:[`stere`,`Stereographic_South_Pole`,`Polar_Stereographic_variant_A`,`Polar_Stereographic_variant_B`,`Polar_Stereographic`],ssfn_:Cr};function Or(){this.k0||=1;var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),n=this.a,r=1/this.rf,i=2*r-r**2,a=this.e=Math.sqrt(i);this.R=this.k0*n*Math.sqrt(1-i)/(1-i*t**2),this.alpha=Math.sqrt(1+i/(1-i)*Math.cos(e)**4),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+e/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*s+this.alpha*a/2*c}function kr(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),r=-this.alpha*(t+n)+this.K,i=2*(Math.atan(Math.exp(r))-Math.PI/4),a=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(i)+Math.cos(this.b0)*Math.cos(a))),s=Math.asin(Math.cos(this.b0)*Math.sin(i)-Math.sin(this.b0)*Math.cos(i)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,e.x=this.R*o+this.x0,e}function Ar(e){for(var t=e.x-this.x0,n=e.y-this.y0,r=t/this.R,i=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(i)+Math.sin(this.b0)*Math.cos(i)*Math.cos(r)),o=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(i))),s=this.lambda0+o/this.alpha,c=0,l=a,u=-1e3,d=0;Math.abs(l-u)>1e-7;){if(++d>20)return;c=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(c))-Math.PI/2}return e.x=s,e.y=l,e}var jr={init:Or,forward:kr,inverse:Ar,names:[`somerc`]},Mr=1e-7;function Nr(e){var t=[`Hotine_Oblique_Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`],n=typeof e.projName==`object`?Object.keys(e.projName)[0]:e.projName;return`no_uoff`in e||`no_off`in e||t.indexOf(n)!==-1||t.indexOf(dt(n))!==-1}function Pr(){var e,t,n,r,i,a,o,s,c,l,u=0,d,f=0,p=0,m=0,h=0,g=0,_=0;this.k0||=1,this.no_off=Nr(this),this.no_rot=`no_rot`in this;var v=!1;`alpha`in this&&(v=!0);var y=!1;if(`rectified_grid_angle`in this&&(y=!0),v&&(_=this.alpha),y&&(u=this.rectified_grid_angle,v||=(_=0,!0)),v||y)f=this.longc;else if(p=this.long1,h=this.lat1,m=this.long2,g=this.lat2,Math.abs(h-g)<=Mr||(e=Math.abs(h))<=Mr||Math.abs(e-I)<=Mr||Math.abs(Math.abs(this.lat0)-I)<=Mr||Math.abs(Math.abs(g)-I)<=Mr)throw Error();var b=1-this.es;t=Math.sqrt(b),Math.abs(this.lat0)>1e-10?(s=Math.sin(this.lat0),n=Math.cos(this.lat0),e=1-this.es*s*s,this.B=n*n,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*t/e,r=this.B*t/(n*Math.sqrt(e)),i=r*r-1,i<=0?i=0:(i=Math.sqrt(i),this.lat0<0&&(i=-i)),this.E=i+=r,this.E*=G(this.e,this.lat0,s)**+this.B):(this.B=1/t,this.A=this.k0,this.E=r=i=1),v||y?(v?(d=Math.asin(Math.sin(_)/r),y||(u=_)):(d=u,_=Math.asin(r*Math.sin(d))),this.lam0=f-Math.asin(.5*(i-1/i)*Math.tan(d))/this.B):(a=G(this.e,h,Math.sin(h))**+this.B,o=G(this.e,g,Math.sin(g))**+this.B,i=this.E/a,c=(o-a)/(o+a),l=this.E*this.E,l=(l-o*a)/(l+o*a),e=p-m,e<-Math.PI?m-=se:e>Math.PI&&(m+=se),this.lam0=W(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/c)/this.B,this.over),d=Math.atan(2*Math.sin(this.B*W(p-this.lam0,this.over))/(i-1/i)),u=_=Math.asin(r*Math.sin(d))),this.singam=Math.sin(d),this.cosgam=Math.cos(d),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(_))),this.lat0<0&&(this.u_0=-this.u_0)),i=.5*d,this.v_pole_n=this.ArB*Math.log(Math.tan(z-i)),this.v_pole_s=this.ArB*Math.log(Math.tan(z+i))}function Fr(e){var t={},n,r,i,a,o,s,c,l;if(e.x-=this.lam0,Math.abs(Math.abs(e.y)-I)>1e-10){if(o=this.E/G(this.e,e.y,Math.sin(e.y))**+this.B,s=1/o,n=.5*(o-s),r=.5*(o+s),a=Math.sin(this.B*e.x),i=(n*this.singam-a*this.cosgam)/r,Math.abs(Math.abs(i)-1)<1e-10)throw Error();l=.5*this.ArB*Math.log((1-i)/(1+i)),s=Math.cos(this.B*e.x),c=Math.abs(s)<Mr?this.A*e.x:this.ArB*Math.atan2(n*this.cosgam+a*this.singam,s)}else l=e.y>0?this.v_pole_n:this.v_pole_s,c=this.ArB*e.y;return this.no_rot?(t.x=c,t.y=l):(c-=this.u_0,t.x=l*this.cosrot+c*this.sinrot,t.y=c*this.cosrot-l*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}function Ir(e){var t,n,r,i,a,o,s,c={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(n=e.y,t=e.x):(n=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),r=Math.exp(-this.BrA*n),i=.5*(r-1/r),a=.5*(r+1/r),o=Math.sin(this.BrA*t),s=(o*this.cosgam+i*this.singam)/a,Math.abs(Math.abs(s)-1)<1e-10)c.x=0,c.y=s<0?-I:I;else{if(c.y=this.E/Math.sqrt((1+s)/(1-s)),c.y=$e(this.e,c.y**(1/this.B)),c.y===1/0)throw Error();c.x=-this.rB*Math.atan2(i*this.cosgam-o*this.singam,Math.cos(this.BrA*t))}return c.x+=this.lam0,e.z!==void 0&&(c.z=e.z),e.m!==void 0&&(c.m=e.m),c}var Lr={init:Pr,forward:Fr,inverse:Ir,names:[`Hotine_Oblique_Mercator`,`Hotine Oblique Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Variant_B`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`,`Hotine_Oblique_Mercator_Two_Point_Natural_Origin`,`Hotine_Oblique_Mercator_Azimuth_Center`,`Oblique_Mercator`,`omerc`]};function Rr(){if(this.lat2||=this.lat1,this.k0||=1,this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<1e-10)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),n=Math.cos(this.lat1),r=Ze(this.e,t,n),i=G(this.e,this.lat1,t),a=Math.sin(this.lat2),o=Math.cos(this.lat2),s=Ze(this.e,a,o),c=G(this.e,this.lat2,a),l=G(this.e,this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>1e-10?Math.log(r/s)/Math.log(i/c):t,isNaN(this.ns)&&(this.ns=t),this.f0=r/(this.ns*i**+this.ns),this.rh=Math.abs(Math.abs(this.lat0)-I)<1e-10?0:this.a*this.f0*l**+this.ns,this.title||=`Lambert Conformal Conic`}}function zr(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=Qe(n)*(I-2*oe));var r=Math.abs(Math.abs(n)-I),i,a;if(r>1e-10)i=G(this.e,n,Math.sin(n)),a=this.a*this.f0*i**+this.ns;else{if(r=n*this.ns,r<=0)return null;a=0}var o=this.ns*W(t-this.long0,this.over);return e.x=this.k0*(a*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(o))+this.y0,e}function Br(e){var t,n,r,i,a,o=(e.x-this.x0)/this.k0,s=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+s*s),n=1):(t=-Math.sqrt(o*o+s*s),n=-1);var c=0;if(t!==0&&(c=Math.atan2(n*o,n*s)),t!==0||this.ns>0){if(n=1/this.ns,r=(t/(this.a*this.f0))**+n,i=$e(this.e,r),i===-9999)return null}else i=-I;return a=W(c/this.ns+this.long0,this.over),e.x=a,e.y=i,e}var Vr={init:Rr,forward:zr,inverse:Br,names:[`Lambert Tangential Conformal Conic Projection`,`Lambert_Conformal_Conic`,`Lambert_Conformal_Conic_1SP`,`Lambert_Conformal_Conic_2SP`,`lcc`,`Lambert Conic Conformal (1SP)`,`Lambert Conic Conformal (2SP)`]};function Hr(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||=.863937979737193,this.long0||=.4334234309119251,this.k0||=.9999,this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.cos(this.fi0)**4/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)))**(this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.tan(this.fi0/2+this.s45)**+this.alfa*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.sin(this.fi0)**2),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Ur(e){var t,n,r,i,a,o,s,c=e.x,l=e.y,u=W(c-this.long0,this.over);return t=((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)))**(this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.tan(l/2+this.s45)**+this.alfa/t)-this.s45),r=-u*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),a=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),o=this.n*a,s=this.ro0*Math.tan(this.s0/2+this.s45)**+this.n/Math.tan(i/2+this.s45)**+this.n,e.y=s*Math.cos(o)/1,e.x=s*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Wr(e){var t,n,r,i,a,o,s,c,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),i=a/Math.sin(this.s0),r=2*(Math.atan((this.ro0/o)**(1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(t)),e.x=this.long0-n/this.alfa,s=t,c=0;var u=0;do e.y=2*(Math.atan(this.k**(-1/this.alfa)*Math.tan(t/2+this.s45)**(1/this.alfa)*((1+this.e*Math.sin(s))/(1-this.e*Math.sin(s)))**(this.e/2))-this.s45),Math.abs(s-e.y)<1e-10&&(c=1),s=e.y,u+=1;while(c===0&&u<15);return u>=15?null:e}var Gr={init:Hr,forward:Ur,inverse:Wr,names:[`Krovak`,`Krovak Modified`,`Krovak (North Orientated)`,`Krovak Modified (North Orientated)`,`krovak`]};function X(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}function Kr(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function qr(e){return .375*e*(1+.25*e*(1+.46875*e))}function Jr(e){return .05859375*e*e*(1+.75*e)}function Yr(e){return e*e*e*(35/3072)}function Xr(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}function Zr(e){return Math.abs(e)<I?e:e-Qe(e)*Math.PI}function Qr(e,t,n,r,i){for(var a=e/t,o,s=0;s<15;s++)if(o=(e-(t*a-n*Math.sin(2*a)+r*Math.sin(4*a)-i*Math.sin(6*a)))/(t-2*n*Math.cos(2*a)+4*r*Math.cos(4*a)-6*i*Math.cos(6*a)),a+=o,Math.abs(o)<=1e-10)return a;return NaN}function $r(){this.sphere||(this.e0=Kr(this.es),this.e1=qr(this.es),this.e2=Jr(this.es),this.e3=Yr(this.es),this.ml0=this.a*X(this.e0,this.e1,this.e2,this.e3,this.lat0))}function ei(e){var t,n,r=e.x,i=e.y;if(r=W(r-this.long0,this.over),this.sphere)t=this.a*Math.asin(Math.cos(i)*Math.sin(r)),n=this.a*(Math.atan2(Math.tan(i),Math.cos(r))-this.lat0);else{var a=Math.sin(i),o=Math.cos(i),s=Xr(this.a,this.e,a),c=Math.tan(i)*Math.tan(i),l=r*Math.cos(i),u=l*l,d=this.es*o*o/(1-this.es),f=this.a*X(this.e0,this.e1,this.e2,this.e3,i);t=s*l*(1-u*c*(1/6-(8-c+8*d)*u/120)),n=f-this.ml0+s*a/o*u*(.5+(5-c+6*d)*u/24)}return e.x=t+this.x0,e.y=n+this.y0,e}function ti(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i;if(this.sphere){var a=n+this.lat0;r=Math.asin(Math.sin(a)*Math.cos(t)),i=Math.atan2(Math.tan(t),Math.cos(a))}else{var o=Qr(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-I)<=1e-10)return e.x=this.long0,e.y=I,n<0&&(e.y*=-1),e;var s=Xr(this.a,this.e,Math.sin(o)),c=s*s*s/this.a/this.a*(1-this.es),l=Math.tan(o)**2,u=t*this.a/s,d=u*u;r=o-s*Math.tan(o)/c*u*u*(.5-(1+3*l)*u*u/24),i=u*(1-d*(l/3+(1+3*l)*l*d/15))/Math.cos(o)}return e.x=W(i+this.long0,this.over),e.y=Zr(r),e}var ni={init:$r,forward:ei,inverse:ti,names:[`Cassini`,`Cassini_Soldner`,`cass`]};function ri(e,t){var n;return e>1e-7?(n=e*t,(1-e*e)*(t/(1-n*n)-.5/e*Math.log((1-n)/(1+n)))):2*t}var ii=.3333333333333333,ai=.17222222222222222,oi=.10257936507936508,si=.06388888888888888,ci=.0664021164021164,li=.016415012942191543;function ui(e){var t,n=[];return n[0]=e*ii,t=e*e,n[0]+=t*ai,n[1]=t*si,t*=e,n[0]+=t*oi,n[1]+=t*ci,n[2]=t*li,n}function di(e,t){var n=e+e;return e+t[0]*Math.sin(n)+t[1]*Math.sin(n+n)+t[2]*Math.sin(n+n+n)}function fi(){var e=Math.abs(this.lat0);if(this.mode=Math.abs(e-I)<1e-10?this.lat0<0?1:2:Math.abs(e)<1e-10?3:4,this.es>0){var t;switch(this.qp=ri(this.e,1),this.mmf=.5/(1-this.es),this.apa=ui(this.es),this.mode){case 2:this.dd=1;break;case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=ri(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===4&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function pi(e){var t,n,r,i,a,o,s,c,l,u,d=e.x,f=e.y;if(d=W(d-this.long0,this.over),this.sphere){if(a=Math.sin(f),u=Math.cos(f),r=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n=this.mode===this.EQUIT?1+u*r:1+this.sinph0*a+this.cosph0*u*r,n<=1e-10)return null;n=Math.sqrt(2/n),t=n*u*Math.sin(d),n*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(f+this.lat0)<1e-10)return null;n=z-f*.5,n=2*(this.mode===this.S_POLE?Math.cos(n):Math.sin(n)),t=n*Math.sin(d),n*=r}}else{switch(s=0,c=0,l=0,r=Math.cos(d),i=Math.sin(d),a=Math.sin(f),o=ri(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(s=o/this.qp,c=Math.sqrt(1-s*s)),this.mode){case this.OBLIQ:l=1+this.sinb1*s+this.cosb1*c*r;break;case this.EQUIT:l=1+c*r;break;case this.N_POLE:l=I+f,o=this.qp-o;break;case this.S_POLE:l=f-I,o=this.qp+o}if(Math.abs(l)<1e-10)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),n=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*s-this.sinb1*c*r):(l=Math.sqrt(2/(1+c*r)))*s*this.ymf,t=this.xmf*l*c*i;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*i,n=r*(this.mode===this.S_POLE?l:-l)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e}function mi(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i,a,o,s,c,l;if(this.sphere){var u=0,d,f=0;if(d=Math.sqrt(t*t+n*n),i=d*.5,i>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(d)<=1e-10?0:Math.asin(n*f/d),t*=f,n=u*d;break;case this.OBLIQ:i=Math.abs(d)<=1e-10?this.lat0:Math.asin(u*this.sinph0+n*f*this.cosph0/d),t*=f*this.cosph0,n=(u-Math.sin(i)*this.sinph0)*d;break;case this.N_POLE:n=-n,i=I-i;break;case this.S_POLE:i-=I}r=n===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,n)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,n*=this.dd,c=Math.sqrt(t*t+n*n),c<1e-10)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*c/this.rq),a=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=a*this.sinb1+n*o*this.cosb1/c,s=this.qp*l,n=c*this.cosb1*a-n*this.sinb1*o):(l=n*o/c,s=this.qp*l,n=c*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),s=t*t+n*n,!s)return e.x=this.long0,e.y=this.lat0,e;l=1-s/this.qp,this.mode===this.S_POLE&&(l=-l)}r=Math.atan2(t,n),i=di(Math.asin(l),this.apa)}return e.x=W(this.long0+r,this.over),e.y=i,e}var hi={init:fi,forward:pi,inverse:mi,names:[`Lambert Azimuthal Equal Area`,`Lambert_Azimuthal_Equal_Area`,`laea`],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function gi(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function _i(){Math.abs(this.lat1+this.lat2)<1e-10||(this.temp=this.b/this.a,this.es=1-this.temp**2,this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Ze(this.e3,this.sin_po,this.cos_po),this.qs1=ri(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Ze(this.e3,this.sin_po,this.cos_po),this.qs2=ri(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=ri(this.e3,this.sin_po),this.ns0=Math.abs(this.lat1-this.lat2)>1e-10?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function vi(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=ri(this.e3,this.sin_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*W(t-this.long0,this.over),o=i*Math.sin(a)+this.x0,s=this.rh-i*Math.cos(a)+this.y0;return e.x=o,e.y=s,e}function yi(e){var t,n,r,i,a,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),i=0,t!==0&&(i=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,o=this.phi1z(this.e3,n)),a=W(i/this.ns0+this.long0,this.over),e.x=a,e.y=o,e}function bi(e,t){var n,r,i,a,o,s=gi(.5*t);if(e<1e-10)return s;for(var c=e*e,l=1;l<=25;l++)if(n=Math.sin(s),r=Math.cos(s),i=e*n,a=1-i*i,o=.5*a*a/r*(t/(1-c)-n/a+.5/e*Math.log((1-i)/(1+i))),s+=o,Math.abs(o)<=1e-7)return s;return null}var xi={init:_i,forward:vi,inverse:yi,names:[`Albers_Conic_Equal_Area`,`Albers_Equal_Area`,`Albers`,`aea`],phi1z:bi};function Si(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Ci(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=W(l-this.long0,this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,o>0||Math.abs(o)<=1e-10?(s=this.x0+this.a*a*n*Math.sin(r)/o,c=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)/o):(s=this.x0+this.infinity_dist*n*Math.sin(r),c=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function wi(e){var t,n,r,i,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(i=Math.atan2(t,this.rc),n=Math.sin(i),r=Math.cos(i),o=gi(r*this.sin_p14+e.y*n*this.cos_p14/t),a=Math.atan2(e.x*n,t*this.cos_p14*r-e.y*this.sin_p14*n),a=W(this.long0+a,this.over)):(o=this.phic0,a=0),e.x=a,e.y=o,e}var Ti={init:Si,forward:Ci,inverse:wi,names:[`gnom`]};function Ei(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*I:I;for(var r=Math.asin(.5*t),i,a,o,s,c=0;c<30;c++)if(a=Math.sin(r),o=Math.cos(r),s=e*a,i=(1-s*s)**2/(2*o)*(t/(1-e*e)-a/(1-s*s)+.5/e*Math.log((1-s)/(1+s))),r+=i,Math.abs(i)<=1e-10)return r;return NaN}function Di(){this.sphere||(this.k0=Ze(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Oi(e){var t=e.x,n=e.y,r,i,a=W(t-this.long0,this.over);if(this.sphere)r=this.x0+this.a*a*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=ri(this.e,Math.sin(n));r=this.x0+this.a*this.k0*a,i=this.y0+this.a*o*.5/this.k0}return e.x=r,e.y=i,e}function ki(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=W(this.long0+e.x/this.a/Math.cos(this.lat_ts),this.over),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=Ei(this.e,2*e.y*this.k0/this.a),t=W(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=n,e}var Ai={init:Di,forward:Oi,inverse:ki,names:[`cea`]};function ji(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Equidistant Cylindrical (Plate Carre)`,this.rc=Math.cos(this.lat_ts)}function Mi(e){var t=e.x,n=e.y,r=W(t-this.long0,this.over),i=Zr(n-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*i,e}function Ni(e){var t=e.x,n=e.y;return e.x=W(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=Zr(this.lat0+(n-this.y0)/this.a),e}var Pi={init:ji,forward:Mi,inverse:Ni,names:[`Equirectangular`,`Equidistant_Cylindrical`,`Equidistant_Cylindrical_Spherical`,`eqc`]},Fi=20;function Ii(){this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=Kr(this.es),this.e1=qr(this.es),this.e2=Jr(this.es),this.e3=Yr(this.es),this.ml0=this.a*X(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Li(e){var t=e.x,n=e.y,r,i,a,o=W(t-this.long0,this.over);if(a=o*Math.sin(n),this.sphere)Math.abs(n)<=1e-10?(r=this.a*o,i=-1*this.a*this.lat0):(r=this.a*Math.sin(a)/Math.tan(n),i=this.a*(Zr(n-this.lat0)+(1-Math.cos(a))/Math.tan(n)));else if(Math.abs(n)<=1e-10)r=this.a*o,i=-1*this.ml0;else{var s=Xr(this.a,this.e,Math.sin(n))/Math.tan(n);r=s*Math.sin(a),i=this.a*X(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+s*(1-Math.cos(a))}return e.x=r+this.x0,e.y=i+this.y0,e}function Ri(e){var t,n,r=e.x-this.x0,i=e.y-this.y0,a,o,s,c,l;if(this.sphere){if(Math.abs(i+this.a*this.lat0)<=1e-10)t=W(r/this.a+this.long0,this.over),n=0;else{o=this.lat0+i/this.a,s=r*r/this.a/this.a+o*o,c=o;var u;for(a=Fi;a;--a)if(u=Math.tan(c),l=-1*(o*(c*u+1)-c-.5*(c*c+s)*u)/((c-o)/u-1),c+=l,Math.abs(l)<=1e-10){n=c;break}t=W(this.long0+Math.asin(r*Math.tan(c)/this.a)/Math.sin(n),this.over)}}else if(Math.abs(i+this.ml0)<=1e-10)n=0,t=W(this.long0+r/this.a,this.over);else{o=(this.ml0+i)/this.a,s=r*r/this.a/this.a+o*o,c=o;var d,f,p,m,h;for(a=Fi;a;--a)if(h=this.e*Math.sin(c),d=Math.sqrt(1-h*h)*Math.tan(c),f=this.a*X(this.e0,this.e1,this.e2,this.e3,c),p=this.e0-2*this.e1*Math.cos(2*c)+4*this.e2*Math.cos(4*c)-6*this.e3*Math.cos(6*c),m=f/this.a,l=(o*(d*m+1)-m-.5*d*(m*m+s))/(this.es*Math.sin(2*c)*(m*m+s-2*o*m)/(4*d)+(o-m)*(d*p-2/Math.sin(2*c))-p),c-=l,Math.abs(l)<=1e-10){n=c;break}d=Math.sqrt(1-this.es*Math.sin(n)**2)*Math.tan(n),t=W(this.long0+Math.asin(r*d/this.a)/Math.sin(n),this.over)}return e.x=t,e.y=n,e}var zi={init:Ii,forward:Li,inverse:Ri,names:[`Polyconic`,`American_Polyconic`,`poly`]};function Bi(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Vi(e){var t,n=e.x,r=e.y-this.lat0,i=n-this.long0,a=r/F*1e-5,o=i,s=1,c=0;for(t=1;t<=10;t++)s*=a,c+=this.A[t]*s;var l=c,u=o,d=1,f=0,p,m,h=0,g=0;for(t=1;t<=6;t++)p=d*l-f*u,m=f*l+d*u,d=p,f=m,h=h+this.B_re[t]*d-this.B_im[t]*f,g=g+this.B_im[t]*d+this.B_re[t]*f;return e.x=g*this.a+this.x0,e.y=h*this.a+this.y0,e}function Hi(e){var t,n=e.x,r=e.y,i=n-this.x0,a=(r-this.y0)/this.a,o=i/this.a,s=1,c=0,l,u,d=0,f=0;for(t=1;t<=6;t++)l=s*a-c*o,u=c*a+s*o,s=l,c=u,d=d+this.C_re[t]*s-this.C_im[t]*c,f=f+this.C_im[t]*s+this.C_re[t]*c;for(var p=0;p<this.iterations;p++){var m=d,h=f,g,_,v=a,y=o;for(t=2;t<=6;t++)g=m*d-h*f,_=h*d+m*f,m=g,h=_,v+=(t-1)*(this.B_re[t]*m-this.B_im[t]*h),y+=(t-1)*(this.B_im[t]*m+this.B_re[t]*h);m=1,h=0;var b=this.B_re[1],x=this.B_im[1];for(t=2;t<=6;t++)g=m*d-h*f,_=h*d+m*f,m=g,h=_,b+=t*(this.B_re[t]*m-this.B_im[t]*h),x+=t*(this.B_im[t]*m+this.B_re[t]*h);var S=b*b+x*x;d=(v*b+y*x)/S,f=(y*b-v*x)/S}var C=d,w=f,T=1,E=0;for(t=1;t<=9;t++)T*=C,E+=this.D[t]*T;var D=this.lat0+E*F*1e5;return e.x=this.long0+w,e.y=D,e}var Ui={init:Bi,forward:Vi,inverse:Hi,names:[`New_Zealand_Map_Grid`,`nzmg`],iterations:1};function Wi(){}function Gi(e){var t=e.x,n=e.y,r=W(t-this.long0,this.over),i=this.x0+this.a*r,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return e.x=i,e.y=a,e}function Ki(e){e.x-=this.x0,e.y-=this.y0;var t=W(this.long0+e.x/this.a,this.over),n=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=n,e}var qi={init:Wi,forward:Gi,inverse:Ki,names:[`Miller_Cylindrical`,`mill`]},Ji=20;function Yi(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Wn(this.es)}function Xi(e){var t,n,r=e.x,i=e.y;if(r=W(r-this.long0,this.over),this.sphere){if(!this.m)i=this.n===1?i:Math.asin(this.n*Math.sin(i));else for(var a=this.n*Math.sin(i),o=Ji;o;--o){var s=(this.m*i+Math.sin(i)-a)/(this.m+Math.cos(i));if(i-=s,Math.abs(s)<1e-10)break}t=this.a*this.C_x*r*(this.m+Math.cos(i)),n=this.a*this.C_y*i}else{var c=Math.sin(i),l=Math.cos(i);n=this.a*Gn(i,c,l,this.en),t=this.a*r*l/Math.sqrt(1-this.es*c*c)}return e.x=t,e.y=n,e}function Zi(e){var t,n,r,i;return e.x-=this.x0,r=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,r/=this.C_x*(this.m+Math.cos(t)),this.m?t=gi((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=gi(Math.sin(t)/this.n)),r=W(r+this.long0,this.over),t=Zr(t)):(t=qn(e.y/this.a,this.es,this.en),i=Math.abs(t),i<I?(i=Math.sin(t),n=this.long0+e.x*Math.sqrt(1-this.es*i*i)/(this.a*Math.cos(t)),r=W(n,this.over)):i-1e-10<I&&(r=this.long0)),e.x=r,e.y=t,e}var Qi={init:Yi,forward:Xi,inverse:Zi,names:[`Sinusoidal`,`sinu`]};function $i(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var ea={init:$i,forward:Xi,inverse:Zi,names:[`Eckert_VI`,`eck6`]};function ta(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0}function na(e){for(var t=e.x,n=e.y,r=W(t-this.long0,this.over),i=n,a=Math.PI*Math.sin(n);;){var o=-(i+Math.sin(i)-a)/(1+Math.cos(i));if(i+=o,Math.abs(o)<1e-10)break}i/=2,Math.PI/2-Math.abs(n)<1e-10&&(r=0);var s=.900316316158*this.a*r*Math.cos(i)+this.x0,c=1.4142135623731*this.a*Math.sin(i)+this.y0;return e.x=s,e.y=c,e}function ra(e){var t,n;e.x-=this.x0,e.y-=this.y0,n=e.y/(1.4142135623731*this.a),Math.abs(n)>.999999999999&&(n=.999999999999),t=Math.asin(n);var r=W(this.long0+e.x/(.900316316158*this.a*Math.cos(t)),this.over);r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var i=Math.asin(n);return e.x=r,e.y=i,e}var ia={init:ta,forward:na,inverse:ra,names:[`Mollweide`,`moll`]};function aa(){Math.abs(this.lat1+this.lat2)<1e-10||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=Kr(this.es),this.e1=qr(this.es),this.e2=Jr(this.es),this.e3=Yr(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Ze(this.e,this.sin_phi,this.cos_phi),this.ml1=X(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<1e-10?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Ze(this.e,this.sin_phi,this.cos_phi),this.ml2=X(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=X(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function oa(e){var t=e.x,n=e.y,r;if(this.sphere)r=this.a*(this.g-n);else{var i=X(this.e0,this.e1,this.e2,this.e3,n);r=this.a*(this.g-i)}var a=this.ns*W(t-this.long0,this.over),o=this.x0+r*Math.sin(a),s=this.y0+this.rh-r*Math.cos(a);return e.x=o,e.y=s,e}function sa(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,n,r,i;this.ns>=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var a=0;return n!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere?(i=W(this.long0+a/this.ns,this.over),r=Zr(this.g-n/this.a),e.x=i,e.y=r,e):(r=Qr(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),i=W(this.long0+a/this.ns,this.over),e.x=i,e.y=r,e)}var ca={init:aa,forward:oa,inverse:sa,names:[`Equidistant_Conic`,`eqdc`]};function la(){this.R=this.a}function ua(e){var t=e.x,n=e.y,r=W(t-this.long0,this.over),i,a;if(Math.abs(n)<=1e-10)return i=this.x0+this.R*r,a=this.y0,e.x=i,e.y=a,e;var o=gi(2*Math.abs(n/Math.PI));if(Math.abs(r)<=1e-10||Math.abs(Math.abs(n)-I)<=1e-10)return i=this.x0,a=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),e.x=i,e.y=a,e;var s=.5*Math.abs(Math.PI/r-r/Math.PI),c=s*s,l=Math.sin(o),u=Math.cos(o),d=u/(l+u-1),f=d*d,p=d*(2/l-1),m=p*p,h=Math.PI*this.R*(s*(d-m)+Math.sqrt(c*(d-m)*(d-m)-(m+c)*(f-m)))/(m+c);r<0&&(h=-h),i=this.x0+h;var g=c+d;return h=Math.PI*this.R*(p*g-s*Math.sqrt((m+c)*(c+1)-g*g))/(m+c),a=n>=0?this.y0+h:this.y0-h,e.x=i,e.y=a,e}function da(e){var t,n,r,i,a,o,s,c,l,u,d,f,p;return e.x-=this.x0,e.y-=this.y0,d=Math.PI*this.R,r=e.x/d,i=e.y/d,a=r*r+i*i,o=-Math.abs(i)*(1+a),s=o-2*i*i+r*r,c=-2*o+1+2*i*i+a*a,p=i*i/c+(2*s*s*s/c/c/c-9*o*s/c/c)/27,l=(o-s*s/3/c)/c,u=2*Math.sqrt(-l/3),d=3*p/l/u,Math.abs(d)>1&&(d=d>=0?1:-1),f=Math.acos(d)/3,n=e.y>=0?(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI:-(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI,t=Math.abs(r)<1e-10?this.long0:W(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(r*r-i*i)+a*a))/2/r,this.over),e.x=t,e.y=n,e}var fa={init:la,forward:ua,inverse:da,names:[`Van_der_Grinten_I`,`VanDerGrinten`,`Van_der_Grinten`,`vandg`]};function pa(e,t,n,r,i,a){let o=r-t,s=Math.atan((1-a)*Math.tan(e)),c=Math.atan((1-a)*Math.tan(n)),l=Math.sin(s),u=Math.cos(s),d=Math.sin(c),f=Math.cos(c),p=o,m,h=100,g,_,v,y,b,x,S,C,w,T,E,D,O,k;do{if(g=Math.sin(p),_=Math.cos(p),v=Math.sqrt(f*g*(f*g)+(u*d-l*f*_)*(u*d-l*f*_)),v===0)return{azi1:0,s12:0};y=l*d+u*f*_,b=Math.atan2(v,y),x=u*f*g/v,S=1-x*x,C=S===0?0:y-2*l*d/S,w=a/16*S*(4+a*(4-3*S)),m=p,p=o+(1-w)*a*x*(b+w*v*(C+w*y*(-1+2*C*C)))}while(Math.abs(p-m)>1e-12&&--h>0);return h===0?{azi1:NaN,s12:NaN}:(T=S*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),E=1+T/16384*(4096+T*(-768+T*(320-175*T))),D=T/1024*(256+T*(-128+T*(74-47*T))),O=D*v*(C+D/4*(y*(-1+2*C*C)-D/6*C*(-3+4*v*v)*(-3+4*C*C))),k=i*(1-a)*E*(b-O),{azi1:Math.atan2(f*g,u*d-l*f*_),s12:k})}function ma(e,t,n,r,i,a){let o=Math.atan((1-a)*Math.tan(e)),s=Math.sin(o),c=Math.cos(o),l=Math.sin(n),u=Math.cos(n),d=Math.atan2(s,c*u),f=c*l,p=1-f*f,m=p*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),h=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m))),_=r/(i*(1-a)*h),v,y=100,b,x,S,C;do b=Math.cos(2*d+_),x=Math.sin(_),S=Math.cos(_),C=g*x*(b+g/4*(S*(-1+2*b*b)-g/6*b*(-3+4*x*x)*(-3+4*b*b))),v=_,_=r/(i*(1-a)*h)+C;while(Math.abs(_-v)>1e-12&&--y>0);if(y===0)return{lat2:NaN,lon2:NaN};let w=s*x-c*S*u,T=Math.atan2(s*S+c*x*u,(1-a)*Math.sqrt(f*f+w*w)),E=Math.atan2(x*l,c*S-s*x*u),D=a/16*p*(4+a*(4-3*p));return{lat2:T,lon2:t+(E-(1-D)*a*f*(_+D*x*(b+D*S*(-1+2*b*b))))}}function ha(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function ga(e){var t=e.x,n=e.y,r=Math.sin(e.y),i=Math.cos(e.y),a=W(t-this.long0,this.over),o,s,c,l,u,d,f,p,m,h,g;return this.sphere?Math.abs(this.sin_p12-1)<=1e-10?(e.x=this.x0+this.a*(I-n)*Math.sin(a),e.y=this.y0-this.a*(I-n)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(e.x=this.x0+this.a*(I+n)*Math.sin(a),e.y=this.y0+this.a*(I+n)*Math.cos(a),e):(m=this.sin_p12*r+this.cos_p12*i*Math.cos(a),f=Math.acos(m),p=f?f/Math.sin(f):1,e.x=this.x0+this.a*p*i*Math.sin(a),e.y=this.y0+this.a*p*(this.cos_p12*r-this.sin_p12*i*Math.cos(a)),e):(o=Kr(this.es),s=qr(this.es),c=Jr(this.es),l=Yr(this.es),Math.abs(this.sin_p12-1)<=1e-10?(u=this.a*X(o,s,c,l,I),d=this.a*X(o,s,c,l,n),e.x=this.x0+(u-d)*Math.sin(a),e.y=this.y0-(u-d)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(u=this.a*X(o,s,c,l,I),d=this.a*X(o,s,c,l,n),e.x=this.x0+(u+d)*Math.sin(a),e.y=this.y0+(u+d)*Math.cos(a),e):Math.abs(t)<1e-10&&Math.abs(n-this.lat0)<1e-10?(e.x=this.x0,e.y=this.y0,e):(h=pa(this.lat0,this.long0,n,t,this.a,this.f),g=h.azi1,e.x=this.x0+h.s12*Math.sin(g),e.y=this.y0+h.s12*Math.cos(g),e))}function _a(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*I*this.a?void 0:(n=t/this.a,r=Math.sin(n),i=Math.cos(n),a=this.long0,Math.abs(t)<=1e-10?o=this.lat0:(o=gi(i*this.sin_p12+e.y*r*this.cos_p12/t),s=Math.abs(this.lat0)-I,a=Math.abs(s)<=1e-10?this.lat0>=0?W(this.long0+Math.atan2(e.x,-e.y),this.over):W(this.long0-Math.atan2(-e.x,e.y),this.over):W(this.long0+Math.atan2(e.x*r,t*this.cos_p12*i-e.y*this.sin_p12*r),this.over)),e.x=a,e.y=o,e)):(c=Kr(this.es),l=qr(this.es),u=Jr(this.es),d=Yr(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*X(c,l,u,d,I),t=Math.sqrt(e.x*e.x+e.y*e.y),p=f-t,o=Qr(p/this.a,c,l,u,d),a=W(this.long0+Math.atan2(e.x,-1*e.y),this.over),e.x=a,e.y=o,e):Math.abs(this.sin_p12+1)<=1e-10?(f=this.a*X(c,l,u,d,I),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-f,o=Qr(p/this.a,c,l,u,d),a=W(this.long0+Math.atan2(e.x,e.y),this.over),e.x=a,e.y=o,e):(m=Math.atan2(e.x,e.y),h=Math.sqrt(e.x*e.x+e.y*e.y),g=ma(this.lat0,this.long0,m,h,this.a,this.f),e.x=g.lon2,e.y=g.lat2,e))}var va={init:ha,forward:ga,inverse:_a,names:[`Azimuthal_Equidistant`,`aeqd`]};function ya(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function ba(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=W(l-(this.long0||0),this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,(o>0||Math.abs(o)<=1e-10)&&(s=(this.x0||0)+this.a*a*n*Math.sin(r),c=(this.y0||0)+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function xa(e){var t,n,r,i,a,o,s,c,l;return e.x-=this.x0||0,e.y-=this.y0||0,t=Math.sqrt(e.x*e.x+e.y*e.y),n=gi(t/this.a),r=Math.sin(n),i=Math.cos(n),c=this.long0||0,l=this.lat0||0,o=c,Math.abs(t)<=1e-10?(s=l,e.x=o,e.y=s,e):(s=gi(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.abs(l)-I,Math.abs(a)<=1e-10?(o=W(l>=0?c+Math.atan2(e.x,-e.y):c-Math.atan2(-e.x,e.y),this.over),e.x=o,e.y=s,e):(o=W(c+Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),this.over),e.x=o,e.y=s,e))}var Sa={init:ya,forward:ba,inverse:xa,names:[`ortho`]},Z={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Q={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Ca(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Quadrilateralized Spherical Cube`,this.face=this.lat0>=I-z/2?Z.TOP:this.lat0<=-(I-z/2)?Z.BOTTOM:Math.abs(this.long0)<=z?Z.FRONT:Math.abs(this.long0)<=I+z?this.long0>0?Z.RIGHT:Z.LEFT:Z.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function wa(e){var t={x:0,y:0},n,r,i,a,o,s,c={value:0};if(e.x-=this.long0,n=this.es===0?e.y:Math.atan(this.one_minus_f_squared*Math.tan(e.y)),r=e.x,this.face===Z.TOP)a=I-n,r>=z&&r<=I+z?(c.value=Q.AREA_0,i=r-I):r>I+z||r<=-(I+z)?(c.value=Q.AREA_1,i=r>0?r-B:r+B):r>-(I+z)&&r<=-z?(c.value=Q.AREA_2,i=r+I):(c.value=Q.AREA_3,i=r);else if(this.face===Z.BOTTOM)a=I+n,r>=z&&r<=I+z?(c.value=Q.AREA_0,i=-r+I):r<z&&r>=-z?(c.value=Q.AREA_1,i=-r):r<-z&&r>=-(I+z)?(c.value=Q.AREA_2,i=-r-I):(c.value=Q.AREA_3,i=r>0?-r+B:-r-B);else{var l,u,d,f,p,m,h;this.face===Z.RIGHT?r=Da(r,+I):this.face===Z.BACK?r=Da(r,+B):this.face===Z.LEFT&&(r=Da(r,-I)),f=Math.sin(n),p=Math.cos(n),m=Math.sin(r),h=Math.cos(r),l=p*h,u=p*m,d=f,this.face===Z.FRONT?(a=Math.acos(l),i=Ea(a,d,u,c)):this.face===Z.RIGHT?(a=Math.acos(u),i=Ea(a,d,-l,c)):this.face===Z.BACK?(a=Math.acos(-l),i=Ea(a,d,-u,c)):this.face===Z.LEFT?(a=Math.acos(-u),i=Ea(a,d,l,c)):(a=i=0,c.value=Q.AREA_0)}return s=Math.atan(12/B*(i+Math.acos(Math.sin(i)*Math.cos(z))-I)),o=Math.sqrt((1-Math.cos(a))/(Math.cos(s)*Math.cos(s))/(1-Math.cos(Math.atan(1/Math.cos(i))))),c.value===Q.AREA_1?s+=I:c.value===Q.AREA_2?s+=B:c.value===Q.AREA_3&&(s+=1.5*B),t.x=o*Math.cos(s),t.y=o*Math.sin(s),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Ta(e){var t={lam:0,phi:0},n,r,i,a,o,s,c,l,u,d={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,r=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),n=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?d.value=Q.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(d.value=Q.AREA_1,n-=I):e.x<0&&-e.x>=Math.abs(e.y)?(d.value=Q.AREA_2,n=n<0?n+B:n-B):(d.value=Q.AREA_3,n+=I),u=B/12*Math.tan(n),o=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),s=Math.atan(o),i=Math.cos(n),a=Math.tan(r),c=1-i*i*a*a*(1-Math.cos(Math.atan(1/Math.cos(s)))),c<-1?c=-1:c>1&&(c=1),this.face===Z.TOP)l=Math.acos(c),t.phi=I-l,t.lam=d.value===Q.AREA_0?s+I:d.value===Q.AREA_1?s<0?s+B:s-B:d.value===Q.AREA_2?s-I:s;else if(this.face===Z.BOTTOM)l=Math.acos(c),t.phi=l-I,t.lam=d.value===Q.AREA_0?-s+I:d.value===Q.AREA_1?-s:d.value===Q.AREA_2?-s-I:s<0?-s-B:-s+B;else{var f=c,p,m;u=f*f,m=u>=1?0:Math.sqrt(1-u)*Math.sin(s),u+=m*m,p=u>=1?0:Math.sqrt(1-u),d.value===Q.AREA_1?(u=p,p=-m,m=u):d.value===Q.AREA_2?(p=-p,m=-m):d.value===Q.AREA_3&&(u=p,p=m,m=-u),this.face===Z.RIGHT?(u=f,f=-p,p=u):this.face===Z.BACK?(f=-f,p=-p):this.face===Z.LEFT&&(u=f,f=p,p=-u),t.phi=Math.acos(-m)-I,t.lam=Math.atan2(p,f),this.face===Z.RIGHT?t.lam=Da(t.lam,-I):this.face===Z.BACK?t.lam=Da(t.lam,-B):this.face===Z.LEFT&&(t.lam=Da(t.lam,+I))}if(this.es!==0){var h=+(t.phi<0),g=Math.tan(t.phi),_=this.b/Math.sqrt(g*g+this.one_minus_f_squared);t.phi=Math.atan(Math.sqrt(this.a*this.a-_*_)/(this.one_minus_f*_)),h&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Ea(e,t,n,r){var i;return e<1e-10?(r.value=Q.AREA_0,i=0):(i=Math.atan2(t,n),Math.abs(i)<=z?r.value=Q.AREA_0:i>z&&i<=I+z?(r.value=Q.AREA_1,i-=I):i>I+z||i<=-(I+z)?(r.value=Q.AREA_2,i=i>=0?i-B:i+B):(r.value=Q.AREA_3,i+=I)),i}function Da(e,t){var n=e+t;return n<-3.14159265359?n+=se:n>3.14159265359&&(n-=se),n}var Oa={init:Ca,forward:wa,inverse:Ta,names:[`Quadrilateralized Spherical Cube`,`Quadrilateralized_Spherical_Cube`,`qsc`]},ka=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Aa=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,422642e-15],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ja=.8487,Ma=1.3523,Na=R/5,Pa=1/Na,Fa=18,Ia=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},La=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function Ra(e,t,n,r){for(var i=t;r;--r){var a=e(i);if(i-=a,Math.abs(a)<n)break}return i}function za(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||`Robinson`}function Ba(e){var t=W(e.x-this.long0,this.over),n=Math.abs(e.y),r=Math.floor(n*Na);r<0?r=0:r>=Fa&&(r=Fa-1),n=R*(n-Pa*r);var i={x:Ia(ka[r],n)*t,y:Ia(Aa[r],n)};return e.y<0&&(i.y=-i.y),i.x=i.x*this.a*ja+this.x0,i.y=i.y*this.a*Ma+this.y0,e.z!==void 0&&(i.z=e.z),e.m!==void 0&&(i.m=e.m),i}function Va(e){var t={x:(e.x-this.x0)/(this.a*ja),y:Math.abs(e.y-this.y0)/(this.a*Ma)};if(t.y>=1)t.x/=ka[Fa][0],t.y=e.y<0?-I:I;else{var n=Math.floor(t.y*Fa);for(n<0?n=0:n>=Fa&&(n=Fa-1);;)if(Aa[n][0]>t.y)--n;else if(Aa[n+1][0]<=t.y)++n;else break;var r=Aa[n],i=5*(t.y-r[0])/(Aa[n+1][0]-r[0]);i=Ra(function(e){return(Ia(r,e)-t.y)/La(r,e)},i,oe,100),t.x/=Ia(ka[n],i),t.y=(5*n+i)*L,e.y<0&&(t.y=-t.y)}return t.x=W(t.x+this.long0,this.over),e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}var Ha={init:za,forward:Ba,inverse:Va,names:[`Robinson`,`robin`]};function Ua(){this.name=`geocent`}function Wa(e){return zt(e,this.es,this.a)}function Ga(e){return Bt(e,this.es,this.a,this.b)}var Ka={init:Ua,forward:Wa,inverse:Ga,names:[`Geocentric`,`geocentric`,`geocent`,`Geocent`]},$={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},qa={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Ja(){if(Object.keys(qa).forEach(function(e){if(this[e]===void 0)this[e]=qa[e].def;else if(qa[e].num&&isNaN(this[e]))throw Error(`Invalid parameter value, must be numeric `+e+` = `+this[e]);else qa[e].num&&(this[e]=parseFloat(this[e]));qa[e].degrees&&(this[e]=this[e]*L)}.bind(this)),Math.abs(Math.abs(this.lat0)-I)<1e-10?this.mode=this.lat0<0?$.S_POLE:$.N_POLE:Math.abs(this.lat0)<1e-10?this.mode=$.EQUIT:(this.mode=$.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw Error(`Invalid height`);this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function Ya(e){e.x-=this.long0;var t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i,a;switch(this.mode){case $.OBLIQ:a=this.sinph0*t+this.cosph0*n*r;break;case $.EQUIT:a=n*r;break;case $.S_POLE:a=-t;break;case $.N_POLE:a=t}switch(a=this.pn1/(this.p-a),i=a*n*Math.sin(e.x),this.mode){case $.OBLIQ:a*=this.cosph0*t-this.sinph0*n*r;break;case $.EQUIT:a*=t;break;case $.N_POLE:a*=-(n*r);break;case $.S_POLE:a*=n*r}var o=a*this.cg+i*this.sg,s=1/(o*this.sw*this.h1+this.cw);return i=(i*this.cg-a*this.sg)*this.cw*s,a=o*s,e.x=i*this.a,e.y=a*this.a,e}function Xa(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},n,r,i=1/(this.pn1-e.y*this.sw);n=this.pn1*e.x*i,r=this.pn1*e.y*this.cw*i,e.x=n*this.cg+r*this.sg,e.y=r*this.cg-n*this.sg;var a=Y(e.x,e.y);if(Math.abs(a)<1e-10)t.x=0,t.y=e.y;else{var o,s=1-a*a*this.pfact;switch(s=(this.p-Math.sqrt(s))/(this.pn1/a+a/this.pn1),o=Math.sqrt(1-s*s),this.mode){case $.OBLIQ:t.y=Math.asin(o*this.sinph0+e.y*s*this.cosph0/a),e.y=(o-this.sinph0*Math.sin(t.y))*a,e.x*=s*this.cosph0;break;case $.EQUIT:t.y=Math.asin(e.y*s/a),e.y=o*a,e.x*=s;break;case $.N_POLE:t.y=Math.asin(o),e.y=-e.y;break;case $.S_POLE:t.y=-Math.asin(o)}t.x=Math.atan2(e.x,e.y)}return e.x=t.x+this.long0,e.y=t.y,e}var Za={init:Ja,forward:Ya,inverse:Xa,names:[`Tilted_Perspective`,`tpers`]};function Qa(){if(this.flip_axis=+(this.sweep===`x`),this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw Error();if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=`ellipse`}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=`sphere`;this.title||=`Geostationary Satellite View`}function $a(e){var t=e.x,n=e.y,r,i,a,o;if(t-=this.long0,this.shape===`ellipse`){n=Math.atan(this.radius_p2*Math.tan(n));var s=this.radius_p/Y(this.radius_p*Math.cos(n),Math.sin(n));if(i=s*Math.cos(t)*Math.cos(n),a=s*Math.sin(t)*Math.cos(n),o=s*Math.sin(n),(this.radius_g-i)*i-a*a-o*o*this.radius_p_inv2<0)return e.x=NaN,e.y=NaN,e;r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/Y(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/Y(a,r)))}else this.shape===`sphere`&&(r=Math.cos(n),i=Math.cos(t)*r,a=Math.sin(t)*r,o=Math.sin(n),r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/Y(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/Y(a,r))));return e.x*=this.a,e.y*=this.a,e}function eo(e){var t=-1,n=0,r=0,i,a,o,s;if(e.x/=this.a,e.y/=this.a,this.shape===`ellipse`){this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Y(1,r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Y(1,n));var c=r/this.radius_p;if(i=n*n+c*c+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===`sphere`){if(this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+r*r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+n*n)),i=n*n+r*r+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t)}return e.x+=this.long0,e}var to={init:Qa,forward:$a,inverse:eo,names:[`Geostationary Satellite View`,`Geostationary_Satellite`,`geos`]},no=1.340264,ro=-.081106,io=893e-6,ao=.003796,oo=Math.sqrt(3)/2;function so(){this.long0=this.long0===void 0?0:this.long0,this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.es!==0&&(this.apa=ui(this.es),this.qp=ri(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function co(e){var t=W(e.x-this.long0,this.over),n=e.y,r=Math.sin(n);this.es!==0&&(r=ri(this.e,r)/this.qp);var i=Math.asin(oo*r),a=i*i,o=a*a*a;return e.x=t*Math.cos(i)/(oo*(no+3*ro*a+o*(7*io+9*ao*a))),e.y=i*(no+ro*a+o*(io+ao*a)),this.es!==0&&(e.x*=this.rqda,e.y*=this.rqda),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function lo(e){e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,this.es!==0&&(e.x/=this.rqda,e.y/=this.rqda);for(var t=1e-9,n=12,r=e.y,i,a,o,s,c,l=0;l<n&&(i=r*r,a=i*i*i,o=r*(no+ro*i+a*(io+ao*i))-e.y,s=no+3*ro*i+a*(7*io+9*ao*i),r-=c=o/s,!(Math.abs(c)<t));++l);return i=r*r,a=i*i*i,e.x=oo*e.x*(no+3*ro*i+a*(7*io+9*ao*i))/Math.cos(r),e.y=Math.asin(Math.sin(r)/oo),this.es!==0&&(e.y=di(e.y,this.apa)),e.x=W(e.x+this.long0,this.over),e}var uo={init:so,forward:co,inverse:lo,names:[`eqearth`,`Equal Earth`,`Equal_Earth`]},fo=1e-10;function po(){var e;if(this.phi1=this.lat1,Math.abs(this.phi1)<fo)throw Error();this.es?(this.en=Wn(this.es),this.m1=Gn(this.phi1,this.am1=Math.sin(this.phi1),e=Math.cos(this.phi1),this.en),this.am1=e/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=ho,this.forward=mo):(this.cphi1=Math.abs(this.phi1)+fo>=I?0:1/Math.tan(this.phi1),this.inverse=_o,this.forward=go)}function mo(e){var t=W(e.x-(this.long0||0),this.over),n=e.y,r=this.am1+this.m1-Gn(n,i=Math.sin(n),a=Math.cos(n),this.en),i=a*t/(r*Math.sqrt(1-this.es*i*i)),a;return e.x=r*Math.sin(i),e.y=this.am1-r*Math.cos(i),e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function ho(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n=Y(e.x,e.y=this.am1-e.y),r,i=qn(this.am1+this.m1-n,this.es,this.en);if((t=Math.abs(i))<I)t=Math.sin(i),r=n*Math.atan2(e.x,e.y)*Math.sqrt(1-this.es*t*t)/Math.cos(i);else if(Math.abs(t-I)<=fo)r=0;else throw Error();return e.x=W(r+(this.long0||0),this.over),e.y=Zr(i),e}function go(e){var t=W(e.x-(this.long0||0),this.over),n=e.y,r,i=this.cphi1+this.phi1-n;return Math.abs(i)>fo?(e.x=i*Math.sin(r=t*Math.cos(n)/i),e.y=this.cphi1-i*Math.cos(r)):e.x=e.y=0,e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function _o(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n,r=Y(e.x,e.y=this.cphi1-e.y);if(n=this.cphi1+this.phi1-r,Math.abs(n)>I)throw Error();return t=Math.abs(Math.abs(n)-I)<=fo?0:r*Math.atan2(e.x,e.y)/Math.cos(n),e.x=W(t+(this.long0||0),this.over),e.y=Zr(n),e}var vo={init:po,names:[`bonne`,`Bonne (Werner lat_1=90)`]},yo={OBLIQUE:{forward:To,inverse:Do},TRANSVERSE:{forward:Eo,inverse:Oo}},bo={ROTATE:{o_alpha:`oAlpha`,o_lon_c:`oLongC`,o_lat_c:`oLatC`},NEW_POLE:{o_lat_p:`oLatP`,o_lon_p:`oLongP`},NEW_EQUATOR:{o_lon_1:`oLong1`,o_lat_1:`oLat1`,o_lon_2:`oLong2`,o_lat_2:`oLat2`}};function xo(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||`General Oblique Transformation`,this.isIdentity=ot.includes(this.o_proj),!this.o_proj)throw Error(`Missing parameter: o_proj`);if(this.o_proj===`ob_tran`)throw Error(`Invalid value for o_proj: `+this.o_proj);let e=K(this.projStr.replace(`+proj=ob_tran`,``).replace(`+o_proj=`,`+proj=`).trim());if(!e)throw Error(`Invalid parameter: o_proj. Unknown projection `+this.o_proj);e.long0=0,this.obliqueProjection=e;let t,n=Object.keys(bo),r=e=>{if(this[e]===void 0)return;let t=parseFloat(this[e])*L;if(isNaN(t))throw Error(`Invalid value for `+e+`: `+this[e]);return t};for(let e=0;e<n.length;e++){let i=bo[n[e]],a=Object.entries(i);if(a.some(([e])=>this[e]!==void 0)){t=i;for(let e=0;e<a.length;e++){let[t,n]=a[e],i=r(t);if(i===void 0)throw Error(`Missing parameter: `+t+`.`);this[n]=i}break}}if(!t)throw Error(`No valid parameters provided for ob_tran projection.`);let{lamp:i,phip:a}=wo(this,t);this.lamp=i,Math.abs(a)>1e-10?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=yo.OBLIQUE):this.projectionType=yo.TRANSVERSE}function So(e){return this.projectionType.forward(this,e)}function Co(e){return this.projectionType.inverse(this,e)}function wo(e,t){let n,r;if(t===bo.ROTATE){let t=e.oLongC,i=e.oLatC,a=e.oAlpha;if(Math.abs(Math.abs(i)-I)<=1e-10)throw Error(`Invalid value for o_lat_c: `+e.o_lat_c+` should be < 90°`);r=t+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(i)),n=Math.asin(Math.cos(i)*Math.sin(a))}else if(t===bo.NEW_POLE)r=e.oLongP,n=e.oLatP;else{let t=e.oLong1,i=e.oLat1,a=e.oLong2,o=e.oLat2,s=Math.abs(i);if(Math.abs(i)>I-1e-10)throw Error(`Invalid value for o_lat_1: `+e.o_lat_1+` should be < 90°`);if(Math.abs(o)>I-1e-10)throw Error(`Invalid value for o_lat_2: `+e.o_lat_2+` should be < 90°`);if(Math.abs(i-o)<1e-10)throw Error(`Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2`);if(s<1e-10)throw Error(`Invalid value for o_lat_1: o_lat_1 should be different from zero`);r=Math.atan2(Math.cos(i)*Math.sin(o)*Math.cos(t)-Math.sin(i)*Math.cos(o)*Math.cos(a),Math.sin(i)*Math.cos(o)*Math.sin(a)-Math.cos(i)*Math.sin(o)*Math.sin(t)),n=Math.atan(-1*Math.cos(r-t)/Math.tan(i))}return{lamp:r,phip:n}}function To(e,t){let{x:n,y:r}=t;n=W(n-e.long0,e.over);let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=W(Math.atan2(o*Math.sin(n),e.sphip*o*i+e.cphip*a)+e.lamp),t.y=Math.asin(e.sphip*a-e.cphip*o*i);let s=e.obliqueProjection.forward(t);return e.isIdentity&&(s.x*=R,s.y*=R),s}function Eo(e,t){let{x:n,y:r}=t;n=W(n-e.long0,e.over);let i=Math.cos(r),a=Math.cos(n);t.x=W(Math.atan2(i*Math.sin(n),Math.sin(r))+e.lamp),t.y=Math.asin(-1*i*a);let o=e.obliqueProjection.forward(t);return e.isIdentity&&(o.x*=R,o.y*=R),o}function Do(e,t){e.isIdentity&&(t.x*=L,t.y*=L);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n<Number.MAX_VALUE){n-=e.lamp;let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=Math.atan2(o*Math.sin(n),e.sphip*o*i-e.cphip*a),t.y=Math.asin(e.sphip*a+e.cphip*o*i)}return t.x=W(t.x+e.long0),t}function Oo(e,t){e.isIdentity&&(t.x*=L,t.y*=L);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n<Number.MAX_VALUE){let i=Math.cos(r);n-=e.lamp,t.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),t.y=Math.asin(i*Math.cos(n))}return t.x=W(t.x+e.long0),t}var ko={init:xo,forward:So,inverse:Co,names:[`General Oblique Transformation`,`General_Oblique_Transformation`,`ob_tran`]};function Ao(e){e.Proj.projections.add(Zn),e.Proj.projections.add(cr),e.Proj.projections.add(fr),e.Proj.projections.add(Sr),e.Proj.projections.add(Dr),e.Proj.projections.add(jr),e.Proj.projections.add(Lr),e.Proj.projections.add(Vr),e.Proj.projections.add(Gr),e.Proj.projections.add(ni),e.Proj.projections.add(hi),e.Proj.projections.add(xi),e.Proj.projections.add(Ti),e.Proj.projections.add(Ai),e.Proj.projections.add(Pi),e.Proj.projections.add(zi),e.Proj.projections.add(Ui),e.Proj.projections.add(qi),e.Proj.projections.add(Qi),e.Proj.projections.add(ea),e.Proj.projections.add(ia),e.Proj.projections.add(ca),e.Proj.projections.add(fa),e.Proj.projections.add(va),e.Proj.projections.add(Sa),e.Proj.projections.add(Oa),e.Proj.projections.add(Ha),e.Proj.projections.add(Ka),e.Proj.projections.add(Za),e.Proj.projections.add(to),e.Proj.projections.add(uo),e.Proj.projections.add(vo),e.Proj.projections.add(ko)}var jo=Object.assign(sn,{defaultDatum:`WGS84`,Proj:K,WGS84:new K(`WGS84`),Point:jn,toPoint:Zt,defs:U,nadgrid:wt,transform:nn,mgrs:mn,version:`__VERSION__`});Ao(jo);var Mo=Math.PI/180,No=85.0511287798066;function Po(e,t,n){let r=2**n,i=Math.max(-85.0511287798066,Math.min(No,t));return{x:(e+180)/360*r,y:(1-Math.asinh(Math.tan(i*Mo))/Math.PI)/2*r}}function Fo(e,t,n){let r=2**n;return{longitude:e/r*360-180,latitude:Math.atan(Math.sinh(Math.PI*(1-2*t/r)))/Mo}}function Io(e,t,r){if(e.isEmpty())throw Error(`模型没有可用于确定地图范围的几何`);for(let e of[t.localMatrix,t.ecefMatrix])if(e?.length!==16||!e.every(Number.isFinite))throw Error(`GIS 配准矩阵必须包含 16 个有限数值`);let i=new n.Matrix4().fromArray(t.localMatrix),a=new n.Matrix4().fromArray(t.ecefMatrix);if(Math.abs(i.determinant())<1e-20||Math.abs(a.determinant())<1e-20)throw Error(`GIS 配准矩阵不可逆`);let o=i.clone().invert(),s=a.clone().multiply(o),c=s.clone().invert(),l=t.sourceCrs===`EPSG:4326`?`WGS84`:`GRS80`,u=jo(`+proj=longlat +ellps=${l} +no_defs`,`+proj=geocent +ellps=${l} +units=m +no_defs`),d=e.clone().applyMatrix4(i);d.min.x-=1e3,d.min.y-=1e3,d.max.x+=1e3,d.max.y+=1e3;let f=[[d.min.x,d.min.y],[d.min.x,d.max.y],[d.max.x,d.min.y],[d.max.x,d.max.y]].map(([e,t])=>{let r=new n.Vector3(e,t,0).applyMatrix4(s),[i,a]=u.inverse(r.toArray());return{longitude:i,latitude:a}});if(Math.max(...f.map(e=>e.longitude))-Math.min(...f.map(e=>e.longitude))>180)throw Error(`当前局部影像层不支持跨越日期变更线的范围`);let p=[];for(let e=16;e>=0;e--){let t=f.map(t=>Po(t.longitude,t.latitude,e)),n=2**e-1,r=e=>Math.max(0,Math.min(n,Math.floor(e))),i=r(Math.min(...t.map(e=>e.x))),a=r(Math.max(...t.map(e=>e.x))),o=r(Math.min(...t.map(e=>e.y))),s=r(Math.max(...t.map(e=>e.y)));if(!((a-i+1)*(s-o+1)>256)){for(let t=o;t<=s;t++)for(let n=i;n<=a;n++)p.push({x:n,y:t,zoom:e});break}}let m=(e,t,i=0,a=!1)=>{let s=new n.Vector3(...u.forward([e,t,a?i:0])).applyMatrix4(c);return a||(s.z=i),s.applyMatrix4(o).add(r)},h=new n.Box3;for(let e of p)for(let[t,n]of[[0,0],[0,1],[1,0],[1,1]]){let r=Fo(e.x+t,e.y+n,e.zoom);h.expandByPoint(m(r.longitude,r.latitude))}return{tiles:p,project:m,bounds:h,reference:t.reference,heightResolved:t.heightResolved}}function Lo(e,t){let r=new n.PlaneGeometry(1,1,8,8),i=r.getAttribute(`position`),a=r.getAttribute(`uv`);for(let n=0;n<i.count;n++){let r=Fo(e.x+a.getX(n),e.y+1-a.getY(n),e.zoom),o=t(r.longitude,r.latitude);i.setXYZ(n,o.x,o.y,o.z)}return r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function Ro(){let e=new AbortController,t=[],n=0,r=()=>new DOMException(`地图请求已取消`,`AbortError`);function i(){for(;!e.signal.aborted&&n<6&&t.length;){let{task:r,resolve:a,reject:o}=t.shift();n++;let s=AbortSignal.any([e.signal,AbortSignal.timeout(15e3)]);Promise.resolve().then(()=>r(s)).then(a,o).finally(()=>{n--,i()})}}return{get stopped(){return e.signal.aborted},run(n){return e.signal.aborted?Promise.reject(r()):new Promise((e,r)=>{t.push({task:n,resolve:e,reject:r}),i()})},dispose(){e.abort(),t.splice(0).forEach(({reject:e})=>e(r()))}}}async function zo(e,t){if(!e)throw Error(`地图服务返回空数据`);let n=e.getReader(),r=[],i=0;try{for(;;){let{value:e,done:a}=await n.read();if(a)break;if(i+=e.byteLength,i>t)throw Error(`地图数据超过大小限制`);r.push(e)}}catch(e){throw await n.cancel().catch(()=>{}),e}finally{n.releaseLock()}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.byteLength;return a}var Bo=150,Vo=12,Ho=67108864;async function Uo(e){if(e.length<2||e[0]!==120||((e[0]<<8)+e[1])%31)throw Error(`天地图 DEM 不是受支持的 zlib 高程栅格`);if(typeof DecompressionStream>`u`)throw Error(`当前浏览器不支持 DEM 解压`);let t=await zo(new Blob([e]).stream().pipeThrough(new DecompressionStream(`deflate`)),45e3);if(t.byteLength!==45e3)throw Error(`天地图 DEM 栅格长度不正确`);let n=new DataView(t.buffer),r=new Float32Array(22500);for(let e=0;e<r.length;e++){let t=n.getUint16(e*2,!0);r[e]=t<=1e4?t:NaN}return r}function Wo(e,t,n){let r=2**n,i=(e+180)/360*r,a=(90-t)/360*r,o=(e,t)=>Math.max(0,Math.min(t,Math.ceil(e-1e-10)-1)),s=o(i,r-1),c=o(a,r/2-1);return{x:s,y:c,level:n,u:Math.max(0,Math.min(1,i-s)),v:Math.max(0,Math.min(1,a-c))}}function Go(e,t,n){let r=Math.max(0,Math.min(149,t*149)),i=Math.max(0,Math.min(149,n*149)),a=Math.min(148,Math.floor(r)),o=Math.min(148,Math.floor(i)),s=r-a,c=i-o,l=o*Bo+a,u=s+c<=1?[[e[l],1-s-c],[e[l+1],s],[e[l+Bo],c]]:[[e[l+Bo+1],s+c-1],[e[l+Bo],1-s],[e[l+1],1-c]],d=0;for(let[e,t]of u)if(!(t<=1e-12)){if(!Number.isFinite(e))throw Error(`DEM 采样点缺少有效高程`);d+=e*t}return d}function Ko(e,t,n,r){let i=Math.min(Vo,e.tiles[0].zoom);if(i<6)throw Error(`当前地图范围过大,DEM 仅支持影像级别 6 及以上`);if(t.mode===`absolute`&&(!e.heightResolved||typeof t.toEllipsoidHeight!=`function`))throw Error(`真实高程模式需要可靠高程配准和 toEllipsoidHeight 转换函数`);let a=new Map,o=0,s=!1,c;function l(){for(let[e,t]of a){if(o<=Ho)break;!t.refs&&t.data&&(o-=t.data.byteLength,a.delete(e))}}function u(e){let t=`${e.x}/${e.y}`,c=a.get(t);return c?(a.delete(t),a.set(t,c)):(c={refs:0},a.set(t,c),c.promise=r.run(async t=>{let r=new URL(`https://t0.tianditu.gov.cn/mapservice/swdx`);r.search=new URLSearchParams({T:`elv_c`,tk:n,x:e.x,y:e.y,l:i});let a=await fetch(r,{signal:t});if(!a.ok)throw Error(`DEM 请求失败`);let u=await Uo(await zo(a.body,1048576));if(s||t.aborted)throw Error(`DEM 请求已取消`);return c.data=u,o+=u.byteLength,l(),u})),c.refs++,{promise:c.promise,release(){c.refs--,l()}}}async function d(e,t){let n=Wo(e,t,i),r=u(n);try{return Go(await r.promise,n.u,n.v)}finally{r.release()}}return{async prepare(n){t.mode!==`absolute`&&(c??=d(e.reference.longitude,e.reference.latitude).catch(()=>{throw Error(`DEM 基准高程获取失败,整层保持平面影像`)}));let r=c?await c:0;if(s)throw Error(`DEM 已关闭`);let a=[],o=new Map;try{for(let e=0;e<=32;e++)for(let t=0;t<=32;t++){let r=Fo(n.x+t/32,n.y+e/32,n.zoom),s=Wo(r.longitude,r.latitude,i),c=`${s.x}/${s.y}`;o.has(c)||o.set(c,u(s)),a.push({...r,...s,id:c})}let e=await Promise.all([...o].map(async([e,t])=>[e,await t.promise]));if(s)throw Error(`DEM 已关闭`);let c=new Map(e),l=new Float64Array(a.length);return a.forEach((e,n)=>{let i=Go(c.get(e.id),e.u,e.v);if(t.mode===`absolute`){try{l[n]=t.toEllipsoidHeight({longitude:e.longitude,latitude:e.latitude,height:i})}catch{throw Error(`DEM 高程基准转换失败`)}if(!Number.isFinite(l[n]))throw Error(`DEM 高程转换必须返回有限的椭球高`)}else l[n]=i-r}),l}finally{o.forEach(e=>e.release())}},dispose(){s=!0,a.clear(),o=0}}}function qo(e,t,r,i){let a=[],o=[],s=[],c=[];for(let n=0;n<=32;n++)for(let l=0;l<=32;l++){let u=Fo(e.x+l/32,e.y+n/32,e.zoom);c.push(u);let d=t.project(u.longitude,u.latitude,r[n*33+l],i);if(a.push(d.x,d.y,d.z),o.push(l/32,1-n/32),n<32&&l<32){let e=n*33+l;s.push(e,e+33,e+1,e+1,e+33,e+34)}}let l=[Array.from({length:33},(e,t)=>t),Array.from({length:33},(e,t)=>t*33+32),Array.from({length:33},(e,t)=>1088-t),Array.from({length:33},(e,t)=>(32-t)*33)],u=l.map(e=>e.map(e=>{let t=a.length/3;return a.push(...a.slice(e*3,e*3+3),...a.slice(e*3,e*3+3)),o.push(...o.slice(e*2,e*2+2),...o.slice(e*2,e*2+2)),t})),d=s.length;for(let e of u)for(let t=0;t<32;t++){let n=e[t],r=e[t+1];s.push(n,n+1,r,r,n+1,r+1)}let f=new n.BufferGeometry;f.setAttribute(`position`,new n.Float32BufferAttribute(a,3)),f.setAttribute(`uv`,new n.Float32BufferAttribute(o,2)),f.setIndex(s);let p={geometry:f,edges:l.map(e=>e.map(e=>r[e])),neighbors:[],updateSkirts(e={}){Object.assign(p.neighbors,e);let n=f.getAttribute(`position`);l.forEach((e,a)=>{let o=p.edges[a],l=p.neighbors[a]?.slice().reverse(),m=Math.max(0,...o.map((e,t)=>Math.abs(e-(l?.[t]??0))))+10,h=l&&o.every((e,t)=>Math.abs(e-l[t])<1e-6),g=d+a*32*6;for(let e=g;e<g+192;e++)f.index.setX(e,h?0:s[e]);e.forEach((e,o)=>{let s=c[e],l=t.project(s.longitude,s.latitude,r[e]-m,i);n.setXYZ(u[a][o]+1,l.x,l.y,l.z)})}),n.needsUpdate=!0,f.index.needsUpdate=!0,f.computeVertexNormals(),f.computeBoundingBox(),f.computeBoundingSphere()}};return p.updateSkirts(),p}var Jo=class extends e.s{get manager(){return this.localManager??=new e.i}async updateMaterial(e,t){let n,r={...e,source:this.imgSource[0]};r.created=e=>n=e;try{n=await this.images.load(r),this.stopped?n.dispose():(n.opacity=this.imgSource[0].opacity,n.map.needsUpdate=!0,t.syncMaterials([n]))}catch{throw n?.dispose(),Error(`影像加载失败,请检查天地图 Key、网络、跨域或服务权限`)}return!0}async updateGeometry(e,t){return this.stopped||t.setGeometry(Lo({...e,zoom:e.z},this.project)),!0}},Yo=class extends e.t{createMaterial(e){let t=super.createMaterial(e);return e.created(t),t}};function Xo(e){e.removeFromParent(),e.geometry.dispose(),e.material.forEach(e=>e.dispose()),e.material.length=0}var Zo=class extends e.n{addEventListener(e,t){(this.listeners??=[]).push([e,t]),super.addEventListener(e,t)}constructor(e,t,r,i,a){super(),this.plan=e,this.onStatus=t,this.invalidate=r,this.content=new n.Group,this.add(this.content),this.cursor=this.loaded=this.failed=0,this.pending=new Set,this.stopped=!1,this.terrainOptions=i,this.onTerrainStatus=a,this.terrainLoaded=this.terrainFailed=0,this.terrainMeshes=new Map}emitTerrain(e=this.terrainMessage){if(this.stopped)return;let t=this.terrainOptions?.enabled,n=t?this.plan.tiles.length:0,r=this.terrainLoaded+this.terrainFailed===n;this.onTerrainStatus?.({status:t?r?this.terrainFailed?this.terrainLoaded?`partial`:`error`:`ready`:`loading`:`disabled`,mode:this.terrainOptions?.mode===`absolute`?`absolute`:`relative`,loaded:this.terrainLoaded,failed:this.terrainFailed,total:n,...e||this.terrainFailed?{message:e||`DEM 加载或采样失败,对应瓦片保留平面影像;请检查天地图权限、覆盖范围和网络`}:{}})}prepareTerrain(e,t){this.terrain&&!this.stopped&&this.terrain.prepare(e).then(n=>{if(!this.stopped){if(t.parent){let r=qo(e,this.plan,n,this.terrainOptions.mode===`absolute`),i=`${e.x}/${e.y}`;this.terrainMeshes.set(i,r),t.setGeometry(r.geometry),t.syncGroups();let a=[[e.x,e.y-1],[e.x+1,e.y],[e.x,e.y+1],[e.x-1,e.y]].map(([e,t])=>this.terrainMeshes.get(`${e}/${t}`));r.updateSkirts(a.map((e,t)=>e?.edges[(t+2)%4])),this.plan.bounds.union(r.geometry.boundingBox),a.forEach((e,t)=>{if(!e)return;let n=(t+2)%4;e.updateSkirts({[n]:r.edges[t]}),this.plan.bounds.union(e.geometry.boundingBox)})}this.terrainLoaded++,this.emitTerrain(),this.invalidate()}}).catch(e=>{if(this.stopped)return;this.terrainFailed++;let t={"DEM 基准高程获取失败,整层保持平面影像":`DEM 基准高程获取失败,整层保持平面影像`,"DEM 采样点缺少有效高程":`天地图 DEM 在部分采样位置缺测,对应瓦片保留平面影像`,"DEM 高程基准转换失败":`DEM 高程基准转换失败,对应瓦片保留平面影像`,"DEM 高程转换必须返回有限的椭球高":`DEM 高程转换必须返回有限的椭球高,对应瓦片保留平面影像`};this.terrainMessage=t[e?.message]||this.terrainMessage,this.emitTerrain(this.terrainMessage),this.invalidate()})}emit(){if(this.stopped)return;let e=this.plan.tiles.length,t=this.loaded+this.failed===e;this.onStatus({status:t?this.failed?this.loaded?`partial`:`error`:`ready`:`loading`,loaded:this.loaded,failed:this.failed,total:e,...this.failed?{message:`影像加载失败,请检查天地图 Key、网络、跨域或服务权限`}:{}})}update({loader:t}){if(!this.stopped)for(;this.pending.size<t.maxThreads&&this.cursor<this.plan.tiles.length;){let n=this.plan.tiles[this.cursor++],r=new e.o;this.pending.add(r),t.update({x:n.x,y:n.y,z:n.zoom},r).then(()=>{this.stopped||(this.content.add(r),this.loaded++)}).catch(()=>{this.stopped||this.failed++}).finally(()=>{this.pending.delete(r),(this.stopped||!r.parent)&&Xo(r),this.stopped||(this.prepareTerrain(n,r),this.emit(),this.invalidate())})}}reload(e=!0){return e&&this.content.children.slice().forEach(Xo),this}};function Qo(t,r,i=.65,a,o,s,c){let l=Ro(),u=new Jo;u.project=t.project,u.images=new Yo,u.images.loader.manager=u.manager,u.images.loader.loadAsync=e=>l.run(async t=>{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`影像请求失败`);let r=await createImageBitmap(await n.blob(),{imageOrientation:`flipY`,premultiplyAlpha:`none`,colorSpaceConversion:`none`});if(l.stopped||t.aborted)throw r.close(),Error(`影像请求已取消`);return r}),u.images.material=new n.MeshBasicMaterial({transparent:!0,side:n.DoubleSide,depthWrite:!1,toneMapped:!1});let d=new Zo(t,a,o,s,c);if(s?.enabled)try{if(![`relative`,`absolute`].includes(s.mode??`relative`))throw Error(`DEM 模式必须为 relative 或 absolute`);let e=s.key??r;if(!e?.trim())throw Error(`请配置天地图 DEM Key`);d.terrain=Ko(t,s,e,l)}catch(e){d.terrainFailed=t.tiles.length,d.emitTerrain(e.message)}let f=new n.Group;f.name=`GIS imagery`;let p;return Promise.resolve().then(()=>require("./plugin-Cs6eHojx.cjs")).then(({TDTSource:n})=>{if(d.stopped)return;let a=new n({token:r,style:`img_w`,minLevel:t.tiles[0].zoom,maxLevel:t.tiles[0].zoom,opacity:i,transparent:!0});p=e.a.create({loader:u,rootTile:d,imgSource:a}),p.autoUpdate=!1,p.updateInterval=0,p.maxThreads=6,d.scale.set(1,1,1),d.updateMatrixWorld(!0),f.add(p),o()}).catch(()=>{d.stopped||(d.failed=t.tiles.length,d.emit(),s?.enabled&&!d.terrainFailed&&(d.terrainFailed=t.tiles.length,d.emitTerrain(`地图初始化失败,无法准备 DEM`)),o())}),d.emit(),d.terrainFailed||d.emitTerrain(),{root:f,bounds:t.bounds,update(e){d.stopped||p?.update(e)},setOpacity(e){d.stopped||(i=e,p&&(p.imgSource[0].opacity=e),d.content.children.forEach(t=>{t.material.forEach(t=>t.opacity=e)}),o())},dispose(){if(!d.stopped){d.stopped=u.stopped=!0,l.dispose(),d.terrain?.dispose(),d.terrainMeshes.clear(),f.removeFromParent(),p?.dispose(),d.listeners?.forEach(([e,t])=>d.removeEventListener(e,t)),d.listeners=[],u.images.material.dispose(),u._errorMaterial.dispose();for(let e of[`onStart`,`onLoad`,`onProgress`,`onError`,`onParseEnd`])u.manager[e]=void 0;f.clear()}}}}function $o(e,t,r,l,u,d,f){let p=new n.Scene,m=new n.PerspectiveCamera(42,1,.01,1e5),h=new n.WebGLRenderer({antialias:!0});h.outputColorSpace=n.SRGBColorSpace,h.setPixelRatio(Math.min(window.devicePixelRatio,2)),h.domElement.setAttribute(`aria-label`,`三维模型:拖动旋转,滚轮缩放,右键平移`),h.domElement.setAttribute(`role`,`img`),e.appendChild(h.domElement);let g=new i.OrbitControls(m,h.domElement);g.enableDamping=!0,g.dampingFactor=.09;let _=E(m,g),v=ee(m,g,_);g.addEventListener(`start`,_.cancel),p.add(new n.HemisphereLight(`#e5efff`,`#758096`,2.6));let y=new n.DirectionalLight(`#fff2dc`,2.7);y.position.set(3,6,5),p.add(y);let b=new n.DirectionalLight(`#a0c7ff`,1.5);b.position.set(-4,1,-2),p.add(b);let x=new a.EffectComposer(h),S=new c.RenderPass(p,m),C=new o.OutlinePass(new n.Vector2(1,1),p,m);C.visibleEdgeColor.set(`#66d9c0`),C.hiddenEdgeColor.set(`#244f46`),C.edgeStrength=3;let w=new s.OutputPass;x.addPass(S),x.addPass(C),x.addPass(w);let D,O,k,A=[],j=0,M=0,N=0,P=!1,ne={},F=null,I,re=``,ie,ae=!1,oe,L=!0,R=T(p,B,u);function z(){I?.dispose(),I=void 0,re=``,ie=void 0}function se(){if(!I)return;let e=I.bounds,t=m.position.distanceTo(e.getCenter(new n.Vector3))+e.getSize(new n.Vector3).length();m.far<t&&(m.far=t,m.updateProjectionMatrix())}function B(){!N&&!P&&(N=requestAnimationFrame(V))}function V(e){if(N=0,P)return;let n=_.update(e);if(g.update(),ae&&D&&(!oe||!m.quaternion.equals(oe))){oe=m.quaternion.clone();let{x:e,y:t,z:n,w:r}=oe;d?.({x:e,y:t,z:n,w:r})}se(),I?.update(m);let r=F&&O&&k&&k.get(O.byObject.get(F)||``)?.effective.visible;C.selectedObjects=F&&r?[F]:[],C.selectedObjects.length?x.render():h.render(p,m),D&&O&&k&&t(te(A,O,k,D.offset,m,j,M)),n&&B()}g.addEventListener(`change`,B);function ce(){let t=e.getBoundingClientRect();t.width&&t.height&&(t.width!==j||t.height!==M)&&(j=t.width,M=t.height,h.setSize(j,M,!1),x.setSize(j,M),m.aspect=j/M,m.updateProjectionMatrix(),R.resize(j,M),B())}let le=new ResizeObserver(ce);le.observe(e),ce();let ue=e=>{e.preventDefault(),L=!1,_.cancel(),P||r()};h.domElement.addEventListener(`webglcontextlost`,ue);function de(e,t,r){let i=new n.Box3().setFromObject(e,!0);if(i.isEmpty()){let t=e.getWorldPosition(new n.Vector3);i=new n.Box3().setFromCenterAndSize(t,new n.Vector3(10,10,10))}let a=Math.max(i.getSize(new n.Vector3).length()/2,.01),o=i.getCenter(new n.Vector3),s=ne.direction||{x:1.15,y:.72,z:1.35},c=t?new n.Vector3(s.x,s.y,s.z):m.position.clone().sub(g.target);c.toArray().every(Number.isFinite)&&c.lengthSq()||(c=new n.Vector3(1.15,.72,1.35)),c.normalize();let l=Math.min(m.fov*Math.PI/180,2*Math.atan(Math.tan(m.fov*Math.PI/360)*m.aspect)),u=Number.isFinite(ne.fitPadding)&&(ne.fitPadding||0)>0?ne.fitPadding:1.35,d=a/Math.tan(l/2)*u,f=_.moveTo({position:o.clone().addScaledVector(c,d),target:o,near:Math.max(a/1e4,.001),far:d+a*30,minDistance:Math.max(a/1e3,.01),maxDistance:d*10},r);return f&&B(),f}return{setBackground(e){R.set(e)},show(e,t,n,r={}){z(),l({status:`disabled`,loaded:0,failed:0,total:0}),f?.({status:`disabled`,mode:`relative`,loaded:0,failed:0,total:0}),D?.root.removeFromParent(),F=null,C.selectedObjects=[],D=e,O=t,k=n,ne=r,oe=void 0,p.add(e.root),h.renderLists.dispose(),de(e.root,!0,{duration:0})},setGis(e){if(!P){if(!D||!e?.enabled)z(),l({status:`disabled`,loaded:0,failed:0,total:0}),f?.({status:`disabled`,mode:e?.terrain?.mode??`relative`,loaded:0,failed:0,total:0}),B();else try{let t=e.opacity??.65;if(!Number.isFinite(t)||t<0||t>1)throw Error(`地图透明度必须是 0–1 的数值`);if(!e.imagery?.key?.trim())throw Error(`请在宿主配置天地图 Key`);let r=e.placement,i=JSON.stringify([r.sourceCrs,r.reference,r.localMatrix,r.ecefMatrix,e.imagery.key,r.heightResolved,e.terrain?.enabled??!1,e.terrain?.enabled?e.terrain.mode??`relative`:null,e.terrain?.enabled?e.terrain.key??null:null]),a=e.terrain?.enabled?e.terrain.toEllipsoidHeight:void 0;if(I&&re===i&&ie===a){I.setOpacity(t);return}z(),I=Qo(Io(new n.Box3().setFromObject(D.root,!0).translate(D.offset.clone().negate()),r,D.offset),e.imagery.key,t,l,B,e.terrain?{...e.terrain}:void 0,f),re=i,ie=a,p.add(I.root),se(),B()}catch(t){z(),l({status:`error`,loaded:0,failed:0,total:0,message:t instanceof Error?t.message:`地图配置无效`}),f?.({status:e.terrain?.enabled?`error`:`disabled`,mode:e.terrain?.mode??`relative`,loaded:0,failed:0,total:0,...e.terrain?.enabled?{message:`地图配置无效,无法准备 DEM`}:{}}),B()}}},setMarkers(e){A=e,B()},select(e){F=e,B()},focus(e,t){return de(e,!1,t)},reset(e){return D&&!P&&L?de(D.root,!0,e):!1},setNavigationVisible(e){P||ae===e||(ae=e,oe=void 0,e&&B())},setViewDirection(e,t){if(!D||P||!L)return!1;let n=v.setViewDirection(e,t);return n&&B(),n},navigate(e,t){if(!D||P||!L)return!1;let n=v.navigate(e,t);return n&&B(),n},pick(e,t){if(!D)return null;let r=h.domElement.getBoundingClientRect(),i=new n.Raycaster;return i.setFromCamera(new n.Vector2((e-r.left)/r.width*2-1,-(t-r.top)/r.height*2+1),m),i.intersectObject(D.root,!0).find(e=>{let t=O?.byObject.get(e.object);return t&&k?.get(t)?.effective.visible&&(k.get(t)?.effective.opacity||0)>0})?.object||null},refresh:B,dispose(){P=!0,_.cancel(),z(),R.dispose(),cancelAnimationFrame(N),le.disconnect(),g.removeEventListener(`change`,B),g.removeEventListener(`start`,_.cancel),g.dispose(),h.domElement.removeEventListener(`webglcontextlost`,ue),C.dispose(),w.dispose(),x.dispose(),h.dispose(),h.forceContextLoss(),h.domElement.remove(),D=void 0,O=void 0,k=void 0}}}var es=[`disabled`],ts={__name:`HomeButton`,props:{disabled:{type:Boolean,default:!1}},emits:[`home`],setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{type:`button`,class:`mv-navigation-home`,disabled:e.disabled,title:`主视角`,"aria-label":`Home:恢复初始全模型视角`,onClick:r[0]||=(0,t.withModifiers)(e=>n.$emit(`home`),[`stop`])},[...r[1]||=[(0,t.createElementVNode)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`},[(0,t.createElementVNode)(`path`,{d:`M2 11 12 2l10 9h-4v10h-4v-7h-4v7H6V11Z`})],-1)]],8,es))}},ns=[`data-direction`,`tabindex`,`aria-disabled`,`aria-label`,`onClick`,`onKeydown`,`onFocus`],rs=[`points`],is=[`transform`],as={__name:`ViewCube`,props:{orientation:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:[`navigate`,`restore-focus`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>A(r.orientation)),o=(0,t.ref)(),s=(0,t.ref)(null);(0,t.watch)(a,async e=>{let n=s.value;n&&o.value?.contains(document.activeElement)&&(await(0,t.nextTick)(),o.value&&(e.some(e=>e.id===n)?o.value.querySelector(`[data-direction="${n}"]`)?.focus({preventScroll:!0}):i(`restore-focus`)))},{flush:`pre`});function c(e){r.disabled||i(`navigate`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{ref_key:`cube`,ref:o,class:`mv-navigation-cube`,viewBox:`0 0 150 150`,role:`group`,"aria-label":`26方向视角骰子`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:n.id,class:(0,t.normalizeClass)([`mv-navigation-region`,`mv-navigation-${n.kind}`]),"data-direction":n.id,role:`button`,tabindex:e.disabled?-1:0,"aria-disabled":e.disabled,"aria-label":`${n.label}视角`,onClick:(0,t.withModifiers)(e=>c(n.id),[`stop`]),onKeydown:[(0,t.withKeys)((0,t.withModifiers)(e=>c(n.id),[`prevent`,`stop`]),[`enter`]),(0,t.withKeys)((0,t.withModifiers)(e=>c(n.id),[`prevent`,`stop`]),[`space`])],onFocus:e=>s.value=n.id,onBlur:r[0]||=e=>s.value=null},[(0,t.createElementVNode)(`title`,null,(0,t.toDisplayString)(n.label)+`视角`,1),(0,t.createElementVNode)(`polygon`,{points:n.points},null,8,rs),n.kind===`face`?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{key:0,transform:n.textTransform,"text-anchor":`middle`,"dominant-baseline":`central`,"aria-hidden":`true`},(0,t.toDisplayString)(n.label),9,is)):(0,t.createCommentVNode)(``,!0)],42,ns))),128))],512))}},os={__name:`CameraNavigation`,props:{options:{type:Object},orientation:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:[`home`,`navigate`],setup(e){let n=e,r=(0,t.computed)(()=>j(n.options)),i=(0,t.ref)();return(n,a)=>r.value.height?((0,t.openBlock)(),(0,t.createElementBlock)(`nav`,{key:0,ref_key:`container`,ref:i,class:(0,t.normalizeClass)([`mv-navigation`,{"mv-navigation-home-only":!r.value.cube}]),tabindex:`-1`,"aria-label":`视角导航`,onPointerdown:a[3]||=(0,t.withModifiers)(()=>{},[`stop`]),onPointerup:a[4]||=(0,t.withModifiers)(()=>{},[`stop`]),onDblclick:a[5]||=(0,t.withModifiers)(()=>{},[`stop`]),onWheel:a[6]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`])},[r.value.cube?((0,t.openBlock)(),(0,t.createBlock)(as,{key:0,orientation:e.orientation,disabled:e.disabled,onNavigate:a[0]||=e=>n.$emit(`navigate`,e),onRestoreFocus:a[1]||=e=>i.value?.focus({preventScroll:!0})},null,8,[`orientation`,`disabled`])):(0,t.createCommentVNode)(``,!0),r.value.home?((0,t.openBlock)(),(0,t.createBlock)(ts,{key:1,disabled:e.disabled,onHome:a[2]||=e=>n.$emit(`home`)},null,8,[`disabled`])):(0,t.createCommentVNode)(``,!0)],34)):(0,t.createCommentVNode)(``,!0)}},ss={class:`mv-markers`},cs=[`aria-label`,`aria-pressed`,`onClick`],ls=[`aria-label`],us={key:0,class:`mv-status`,role:`status`},ds={key:1,class:`mv-map-credit`,href:`https://www.tianditu.gov.cn/`,target:`_blank`,rel:`noopener noreferrer`},fs={key:2,class:`mv-error`,role:`alert`},ps=[`disabled`],ms={key:3,class:`mv-notices`},hs={__name:`MineViewer`,props:{modelSource:{type:Object,required:!0},markers:{type:Array,default:()=>[]},initialView:{type:Object,default:()=>({})},cameraTransition:{type:Object},gis:{type:Object},background:{type:Object},navigation:{type:Object}},emits:[`model-loaded`,`model-error`,`component-tree-ready`,`component-select`,`appearance-change`,`marker-click`,`gis-status`,`terrain-status`,`background-error`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(),s=(0,t.ref)(!1),c=(0,t.shallowRef)({x:0,y:0,z:0,w:1}),l=(0,t.computed)(()=>j(i.navigation)),u=(0,t.ref)(!1),d=(0,t.ref)(``),f=(0,t.ref)(`准备加载`),p=(0,t.ref)(null),m=(0,t.shallowRef)({markers:[],issues:[],width:0,height:0}),g=(0,t.shallowRef)([]),_=(0,t.shallowRef)({status:`disabled`,loaded:0,failed:0,total:0}),S,C=!0,T,E,D,O,k=0;(0,t.watch)(()=>l.value.cube,e=>S?.setNavigationVisible(e));let A=(0,t.computed)(()=>m.value.markers.find(e=>e.id===p.value&&e.visible));(0,t.watch)(A,e=>{e||(p.value=null)}),(0,t.watch)(()=>i.modelSource.manifestUrl,()=>{ee()}),(0,t.watch)(()=>i.markers,e=>S?.setMarkers(e),{deep:!0}),(0,t.watch)(()=>i.gis,e=>S?.setGis(e),{deep:!0,flush:`post`}),(0,t.watch)(()=>i.background,e=>S?.setBackground(e),{deep:!0});async function ee(){if(!S)return;let e=++k;O?.abort(),O=new AbortController;let n=O.signal;u.value=!0,d.value=``,p.value=null;let r,o;try{if(r=await h(i.modelSource,n,t=>{e===k&&(f.value=t)}),n.aborted||e!==k||!S){r.dispose();return}let c=b([r.scene],r);o=w(c,e=>{S?.refresh(),a(`appearance-change`,e)});let l=T,u=D;S.show(r,c,o,i.initialView),s.value=C,T=r,E=c,D=o,u?.dispose(),l?.dispose(),g.value=[...r.warnings,...c.warnings],S.setMarkers(i.markers),a(`component-tree-ready`,v(c.tree)),a(`component-select`,null),a(`model-loaded`,{modelId:r.modelId,revision:r.revision,label:r.label,manifestUrl:r.manifestUrl,stats:{...r.stats},warnings:[...g.value]}),await(0,t.nextTick)(),e===k&&!n.aborted&&S?.setGis(i.gis)}catch(t){if(o?.dispose(),r?.dispose(),n.aborted||e!==k)return;O?.abort(),d.value=t instanceof Error?t.message:String(t),a(`model-error`,{message:d.value})}finally{e===k&&(u.value=!1)}}let te=()=>({changedIds:[],unknownIds:[],skipped:[],error:`模型尚未就绪`});function M(e){if(e&&!E?.byId.has(e))return!1;S?.select(e&&E?.renderObjects.get(e)||null);let t=e?E?.byId.get(e):null;return a(`component-select`,t?y(t):null),!!(S&&E)}let N;function P(e){if(!N||e.button!==0||Math.hypot(e.clientX-N.x,e.clientY-N.y)>5)return;let t=S?.pick(e.clientX,e.clientY);M(t&&E?.byObject.get(t)||null),N=void 0}function ne(e){p.value=p.value===e.id?null:e.id,a(`marker-click`,e)}function F(e,t){let n=Math.min(300,Math.max(0,m.value.width-32)),r=Math.max(16,Math.min(e+24,m.value.width-n-16)),a=Math.max(16,Math.min(t+24,m.value.height-240)),o=l.value.height,s=l.value.cube?150:44,c=i.gis?.enabled&&_.value.loaded,u=(o?o+24:16)+(c?32:0),d=Math.max(o?s:0,c?150:0);return d&&r+n>m.value.width-d-16&&a<u&&(a=u),{left:`${r}px`,top:`${a}px`,width:`${n}px`,maxHeight:`${Math.min(320,Math.max(40,m.value.height-a-16))}px`}}let I={getComponentTree:()=>E?v(E.tree):null,getSceneTree:()=>E?x(E):null,getSceneRoot:()=>T?.scene||null,getComponentId:e=>E?.byObject.get(e)||null,getComponent:e=>{let t=E?.byId.get(e);return t?y(t):null},getComponentAnchor:(e,t=`origin`)=>E?.getAnchor(e,t)||null,getComponentAppearance:e=>D?.get(e)||null,setComponentAppearance:(e,t)=>D?.apply([{id:e,patch:t}])||te(),setComponentAppearances:e=>D?.apply(e)||te(),getAppearanceChanges:()=>D?.changes()||null,applyAppearanceChanges:e=>D?.importChanges(e)||te(),restoreComponent:e=>D?.restore(e)||te(),restoreAllComponents:()=>D?.restore()||te(),selectComponent:M,focusComponent:(e,t)=>{let n=E?.renderObjects.get(e);return n&&S?.focus(n,{...i.cameraTransition,...t})||!1},resetView:e=>S?.reset({...i.cameraTransition,...e})||!1,setViewDirection:(e,t)=>S?.setViewDirection(e,{...i.cameraTransition,...t})||!1,reload:ee};return n(I),(0,t.onMounted)(()=>{try{S=$o(o.value,e=>{m.value=e},()=>{C=!1,s.value=!1,O?.abort(),d.value=`图形上下文已中断,请重新打开页面`,a(`model-error`,{message:d.value})},e=>{_.value=e,a(`gis-status`,e)},e=>a(`background-error`,e),e=>{c.value=e},e=>a(`terrain-status`,e)),S.setNavigationVisible(l.value.cube),S.setBackground(i.background),ee()}catch(e){d.value=`无法创建三维视窗:${e instanceof Error?e.message:String(e)}`,a(`model-error`,{message:d.value})}}),(0,t.onBeforeUnmount)(()=>{k++,O?.abort(),S?.dispose(),D?.dispose(),T?.dispose(),E=void 0,D=void 0,T=void 0,S=void 0}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{class:`mv-viewer`,style:(0,t.normalizeStyle)({"--mv-map-credit-top":`${l.value.height?l.value.height+24:16}px`}),"aria-label":`BIM 模型查看器`,onKeydown:r[4]||=(0,t.withKeys)(e=>p.value=null,[`esc`])},[(0,t.createElementVNode)(`div`,{ref_key:`viewport`,ref:o,class:`mv-viewport`,onPointerdown:r[0]||=e=>(0,t.isRef)(N)?N.value={x:e.clientX,y:e.clientY}:N={x:e.clientX,y:e.clientY},onPointerup:P},null,544),(0,t.createElementVNode)(`div`,ss,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value.markers.filter(e=>e.visible),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.id,class:`mv-marker`,style:(0,t.normalizeStyle)({left:`${e.x}px`,top:`${e.y}px`}),"aria-label":e.label,"aria-pressed":p.value===e.id,onClick:(0,t.withModifiers)(t=>ne(e),[`stop`])},[(0,t.renderSlot)(n.$slots,`marker`,{marker:e,selected:p.value===e.id},()=>[r[5]||=(0,t.createElementVNode)(`span`,{class:`mv-dot`},null,-1),(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)])],12,cs))),128)),A.value?((0,t.openBlock)(),(0,t.createElementBlock)(`article`,{key:0,role:`dialog`,"aria-label":A.value.label,class:`mv-popup`,style:(0,t.normalizeStyle)(F(A.value.x,A.value.y))},[(0,t.renderSlot)(n.$slots,`marker-popup`,{marker:A.value,close:()=>{p.value=null}},()=>[(0,t.createElementVNode)(`header`,null,[(0,t.createElementVNode)(`strong`,null,(0,t.toDisplayString)(A.value.label),1),(0,t.createElementVNode)(`button`,{"aria-label":`关闭标记信息`,onClick:r[1]||=e=>p.value=null},`关闭`)]),(0,t.createElementVNode)(`p`,null,(0,t.toDisplayString)(A.value.modelPosition),1)])],12,ls)):(0,t.createCommentVNode)(``,!0)]),u.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,us,(0,t.toDisplayString)(f.value)+`…`,1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(os,{options:e.navigation,orientation:c.value,disabled:!s.value,onHome:r[2]||=e=>I.resetView(),onNavigate:r[3]||=e=>(0,t.unref)(S)?.navigate(e,i.cameraTransition)},null,8,[`options`,`orientation`,`disabled`]),e.gis?.enabled&&_.value.loaded?((0,t.openBlock)(),(0,t.createElementBlock)(`a`,ds,`影像 © 天地图`)):(0,t.createCommentVNode)(``,!0),d.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,fs,[(0,t.createElementVNode)(`p`,null,(0,t.toDisplayString)(d.value),1),(0,t.createElementVNode)(`button`,{disabled:u.value,onClick:ee},(0,t.toDisplayString)(u.value?`正在重试…`:`重试加载`),9,ps)])):(0,t.createCommentVNode)(``,!0),!d.value&&!u.value&&(g.value.length||m.value.issues.length)?((0,t.openBlock)(),(0,t.createElementBlock)(`details`,ms,[(0,t.createElementVNode)(`summary`,null,`加载提示(`+(0,t.toDisplayString)(g.value.length+m.value.issues.length)+`)`,1),(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)([...g.value,...m.value.issues],e=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:e},(0,t.toDisplayString)(e),1))),128))])])):(0,t.createCommentVNode)(``,!0)],36))}},gs=`+proj=longlat +ellps=GRS80 +no_defs`,_s=`+proj=longlat +datum=WGS84 +no_defs`,vs=`+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=41500000 +y_0=0 +ellps=GRS80 +units=m +no_defs`;function ys(e,t){if(!Number.isFinite(e))throw Error(`${t} 必须是有限数值`)}function bs(e){if(!e)throw Error(`缺少模型坐标`);return ys(e.x,`模型 x`),ys(e.y,`模型 y`),ys(e.z,`模型 z`),new n.Vector3(e.x,e.y,e.z)}function xs(e){if(ys(e.longitude,`经度`),ys(e.latitude,`纬度`),Math.abs(e.longitude)>180||Math.abs(e.latitude)>90)throw Error(`经纬度超出有效范围`);return e.height!==void 0&&ys(e.height,`高程`),{...e}}function Ss(e){return e.reduce((e,t)=>e.add(t),new n.Vector3).divideScalar(e.length)}function Cs(e,t,n){let r=0,i=0,a=0;for(let n of e){let e=n.x-t.x,o=n.y-t.y;r+=e*e,i+=o*o,a+=e*o}if(r+i<1e-12||r*i-a*a<=1e-12*(r+i)**2)throw Error(`${n}在水平面上重合、共线或过于接近共线,请选择分散的控制点`)}function ws(e){if(!e||!Array.isArray(e.controlPoints)||e.controlPoints.length<3)throw Error(`GIS 配准至少需要三个模型与地图的对应控制点`);let{sourceCrs:t}=e;if(![`EPSG:4490`,`EPSG:4326`,`EPSG:4529`].includes(t))throw Error(`不支持的坐标系,请显式指定 EPSG:4490、EPSG:4326 或 EPSG:4529`);let r=e.modelUpAxis??`y`,i=e.horizontalAlignment??`least-squares`;if(![`least-squares`,`first-point`].includes(i))throw Error(`horizontalAlignment 仅支持 least-squares 或 first-point`);if(r!==`y`&&r!==`z`)throw Error(`modelUpAxis 仅支持 y 或 z`);let a=e.metersPerUnit??1;if(ys(a,`metersPerUnit`),a<=0)throw Error(`metersPerUnit 必须大于 0`);let o=e.fallbackHeight??0;if(ys(o,`fallbackHeight`),e.maxErrorMeters!==void 0&&(ys(e.maxErrorMeters,`maxErrorMeters`),e.maxErrorMeters<0))throw Error(`maxErrorMeters 不能为负数`);let s=t===`EPSG:4326`?_s:gs,c=jo(vs,gs),l=jo(s,`+proj=geocent +ellps=${t===`EPSG:4326`?`WGS84`:`GRS80`} +units=m +no_defs`),u=e.controlPoints.map(e=>{let n=bs(e?.model);if(!e.map)throw Error(`缺少地图坐标`);let r;if(t===`EPSG:4529`){let t=e.map;if(ys(t.northing,`northing(测量 X)`),ys(t.easting,`easting(测量 Y)`),Math.floor(t.easting/1e6)!==41)throw Error(`EPSG:4529 的 easting(测量 Y)必须包含 41 带号`);let[n,i]=c.forward([t.easting,t.northing]);r=xs({longitude:n,latitude:i,height:t.height})}else r=xs(e.map);return{model:n,map:r}}),d={longitude:u[0].map.longitude,latitude:u[0].map.latitude,height:0},f=Math.PI/180,p=d.longitude*f,m=d.latitude*f,h=Math.sin(p),g=Math.cos(p),_=Math.sin(m),v=Math.cos(m),y=(e,t)=>new n.Vector3(...l.forward([e.longitude,e.latitude,t])),b=y(d,0),x=new n.Matrix4().set(-h,-_*g,v*g,b.x,g,-_*h,v*h,b.y,0,v,_,b.z,0,0,0,1),S=x.clone().invert(),C=r===`y`?new n.Matrix4().makeRotationX(Math.PI/2):new n.Matrix4,w=u.map(({model:e})=>e.clone().applyMatrix4(C).multiplyScalar(a)),T=u.map(({map:e})=>y(e,0).applyMatrix4(S)),E=Ss(w),D=Ss(T);i===`least-squares`&&(Cs(w,E,`模型控制点`),Cs(T,D,`地图控制点`));let O=i===`first-point`?w[0]:E,k=i===`first-point`?T[0]:D,A=0,j=0;for(let e=+(i===`first-point`);e<w.length;e++){let t=w[e].clone().sub(O),n=T[e].clone().sub(k);if(i===`first-point`){let e=Math.hypot(t.x,t.y),r=Math.hypot(n.x,n.y);if(e<1e-6||r<1e-6)throw Error(`方向控制点不能与首点在水平面上重合`);t.divideScalar(e),n.divideScalar(r)}A+=t.x*n.x+t.y*n.y,j+=t.x*n.y-t.y*n.x}let ee=i===`first-point`?1e-8*(w.length-1):1e-12;if(Math.hypot(A,j)<ee)throw Error(`控制点无法确定一致的水平旋转`);let te=Math.atan2(j,A),M=new n.Matrix4().makeRotationZ(te),N=k.clone().sub(O.clone().applyMatrix4(M)),P=u.flatMap(({map:e},t)=>e.height===void 0?[]:[{index:t,z:y(e,e.height).applyMatrix4(S).z}]),ne=P.length>0;N.z=ne?P.reduce((e,t)=>e+t.z-w[t.index].z,0)/P.length:o;let F=new n.Matrix4().makeTranslation(N.x,N.y,N.z).multiply(M).multiply(C).scale(new n.Vector3(a,a,a)),I=x.clone().multiply(F),re=e=>{let t=bs(e).applyMatrix4(I),[n,r,i]=l.inverse(t.toArray());return xs({longitude:n,latitude:r,...ne?{height:i}:{}})},ie=u.map(({model:e,map:t},n)=>{let r=re(e),i=y(r,0).applyMatrix4(S),a=t.height===void 0?null:r.height-t.height;return{index:n,horizontalError:Math.hypot(i.x-T[n].x,i.y-T[n].y),verticalError:a}}),ae=Math.sqrt(ie.reduce((e,t)=>e+t.horizontalError**2,0)/ie.length),oe=Math.max(...ie.map(e=>e.horizontalError));if(e.maxErrorMeters!==void 0&&oe>e.maxErrorMeters)throw Error(`控制点最大水平误差 ${oe.toFixed(4)} 米超过允许值`);let L=ie.filter(e=>e.verticalError!==null);return{sourceCrs:t,reference:{...d},position:re({x:0,y:0,z:0}),rotationDegrees:te/f,metersPerUnit:a,heightResolved:ne,localMatrix:F.toArray(),ecefMatrix:I.toArray(),horizontalRmse:ae,maxHorizontalError:oe,verticalRmse:L.length?Math.sqrt(L.reduce((e,t)=>e+t.verticalError**2,0)/L.length):null,residuals:ie,toGeographic:re}}exports.MineViewer=hs,exports.createGisPlacement=ws,exports.flattenComponentTree=_;
5
+ northing meters`+e;var f=d/2,p=0,m=0,h,g,_,v,y;return f>0&&(h=1e5/10**f,g=e.substring(a,a+f),p=parseFloat(g)*h,_=e.substring(a+f),m=parseFloat(_)*h),v=p+l,y=m+u,{easting:v,northing:y,zoneLetter:s,zoneNumber:o,accuracy:h}}function Mn(e,t){for(var n=fn.charCodeAt(t-1),r=1e5,i=!1;n!==e.charCodeAt(0);){if(n++,n===J&&n++,n===hn&&n++,n>_n){if(i)throw`Bad character: `+e;n=mn,i=!0}r+=1e5}return r}function Nn(e,t){if(e>`V`)throw`MGRSPoint given invalid Northing `+e;for(var n=pn.charCodeAt(t-1),r=0,i=!1;n!==e.charCodeAt(0);){if(n++,n===J&&n++,n===hn&&n++,n>gn){if(i)throw`Bad character: `+e;n=mn,i=!0}r+=1e5}return r}function Pn(e){var t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw`Invalid zone letter: `+e}function Fn(e,t,n){if(!(this instanceof Fn))return new Fn(e,t,n);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==`object`)this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==`string`&&t===void 0){var r=e.split(`,`);this.x=parseFloat(r[0]),this.y=parseFloat(r[1]),this.z=parseFloat(r[2])||0}else this.x=e,this.y=t,this.z=n||0;console.warn(`proj4.Point will be removed in version 3, use proj4.toPoint`)}Fn.fromMGRS=function(e){return new Fn(xn(e))},Fn.prototype.toMGRS=function(e){return yn([this.x,this.y],e)};var In=1,Ln=.25,Rn=.046875,zn=.01953125,Bn=.01068115234375,Vn=.75,Hn=.46875,Un=.013020833333333334,Wn=.007120768229166667,Gn=.3645833333333333,Kn=.005696614583333333,qn=.3076171875;function Jn(e){var t=[];t[0]=In-e*(Ln+e*(Rn+e*(zn+e*Bn))),t[1]=e*(Vn-e*(Rn+e*(zn+e*Bn)));var n=e*e;return t[2]=n*(Hn-e*(Un+e*Wn)),n*=e,t[3]=n*(Gn-e*Kn),t[4]=n*e*qn,t}function Yn(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}var Xn=20;function Zn(e,t,n){for(var r=1/(1-t),i=e,a=Xn;a;--a){var o=Math.sin(i),s=1-t*o*o;if(s=(Yn(i,o,Math.cos(i),n)-e)*(s*Math.sqrt(s))*r,i-=s,Math.abs(s)<1e-10)return i}return i}function Qn(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.es&&(this.en=Jn(this.es),this.ml0=Yn(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function $n(e){var t=e.x,n=e.y,r=q(t-this.long0,this.over),i,a,o,s=Math.sin(n),c=Math.cos(n);if(this.es){var l=c*r,u=l**2,d=this.ep2*c**2,f=d**2,p=(Math.abs(c)>1e-10?Math.tan(n):0)**2,m=p**2;i=1-this.es*s**2,l/=Math.sqrt(i);var h=Yn(n,s,c,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+d+u/20*(5-18*p+m+14*d-58*p*d+u/42*(61+179*m-m*p-479*p)))))+this.x0,o=this.a*(this.k0*(h-this.ml0+s*r*l/2*(1+u/12*(5-p+9*d+4*f+u/30*(61+m-58*p+270*d-330*p*d+u/56*(1385+543*m-m*p-3111*p))))))+this.y0}else{var g=c*Math.sin(r);if(Math.abs(Math.abs(g)-1)<1e-10)return 93;if(a=.5*this.a*this.k0*Math.log((1+g)/(1-g))+this.x0,o=c*Math.cos(r)/Math.sqrt(1-g**2),g=Math.abs(o),g>=1){if(g-1>1e-10)return 93;o=0}else o=Math.acos(o);n<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=a,e.y=o,e}function er(e){var t,n,r,i,a=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(!this.es){var s=Math.exp(a/this.k0),c=.5*(s-1/s),l=this.lat0+o/this.k0,u=Math.cos(l);t=Math.sqrt((1-u**2)/(1+c**2)),r=Math.asin(t),o<0&&(r=-r),i=c===0&&u===0?0:q(Math.atan2(c,u)+this.long0,this.over)}else if(t=this.ml0+o/this.k0,n=Zn(t,this.es,this.en),Math.abs(n)<z){var d=Math.sin(n),f=Math.cos(n),p=Math.abs(f)>1e-10?Math.tan(n):0,m=this.ep2*f**2,h=m**2,g=p**2,_=g**2;t=1-this.es*d**2;var v=a*Math.sqrt(t)/this.k0,y=v**2;t*=p,r=n-t*y/(1-this.es)*.5*(1-y/12*(5+3*g-9*m*g+m-4*h-y/30*(61+90*g-252*m*g+45*_+46*m-y/56*(1385+3633*g+4095*_+1574*_*g)))),i=q(this.long0+v*(1-y/6*(1+2*g+m-y/20*(5+28*g+24*_+8*m*g+6*m-y/42*(61+662*g+1320*_+720*_*g))))/f,this.over)}else r=z*$e(o),i=0;return e.x=i,e.y=r,e}var tr={init:Qn,forward:$n,inverse:er,names:[`Fast_Transverse_Mercator`,`Fast Transverse Mercator`]};function nr(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Y(e,t){e=Math.abs(e),t=Math.abs(t);var n=Math.max(e,t),r=Math.min(e,t)/(n||1);return n*Math.sqrt(1+r**2)}function rr(e){var t=1+e,n=t-1;return n===0?e:e*Math.log(t)/n}function ir(e){var t=Math.abs(e);return t=rr(t*(1+t/(Y(1,t)+1))),e<0?-t:t}function ar(e,t){for(var n=2*Math.cos(2*t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return t+o*Math.sin(2*t)}function or(e,t){for(var n=2*Math.cos(t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return Math.sin(t)*o}function sr(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function cr(e,t,n){for(var r=Math.sin(t),i=Math.cos(t),a=nr(n),o=sr(n),s=2*i*o,c=-2*r*a,l=e.length-1,u=e[l],d=0,f=0,p=0,m,h;--l>=0;)m=f,h=d,f=u,d=p,u=-m+s*f-c*d+e[l],p=-h+c*f+s*d;return s=r*o,c=i*a,[s*u-c*p,s*p+c*u]}function lr(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw Error(`Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.`);this.approx&&(tr.init.apply(this),this.forward=tr.forward,this.inverse=tr.inverse),this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.k0=this.k0===void 0?1:this.k0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+-2854/675*t))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))),n*=t,this.cgb[1]=n*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+2323/945*t)))),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=n*(-26/15+t*(34/21+t*(8/5+-12686/2835*t))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=n*(1237/630+t*(-12/5+-24832/14175*t)),n*=t,this.cgb[4]=n*(4174/315+-144838/6237*t),this.cbg[4]=n*(-734/315+109598/31185*t),n*=t,this.cgb[5]=601676/22275*n,this.cbg[5]=444337/155925*n,n=t**2,this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=n*(13/48+t*(-3/5+t*(557/1440+t*(281/630+-1983433/1935360*t)))),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=n*(49561/161280+t*(-179/168+6601661/7257600*t)),n*=t,this.utg[4]=n*(-4583/161280+108847/3991680*t),this.gtu[4]=n*(34729/80640+-3418889/1995840*t),n*=t,this.utg[5]=-20648693/638668800*n,this.gtu[5]=212378941/319334400*n;var r=ar(this.cbg,this.lat0);this.Zb=-this.Qn*(r+or(this.gtu,2*r))}function ur(e){var t=q(e.x-this.long0,this.over),n=e.y;n=ar(this.cbg,n);var r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t);n=Math.atan2(r,o*i),t=Math.atan2(a*i,Y(r,i*o)),t=ir(Math.tan(t));var s=cr(this.gtu,2*n,2*t);n+=s[0],t+=s[1];var c,l;return Math.abs(t)<=2.623395162778?(c=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*n+this.Zb)+this.y0):(c=1/0,l=1/0),e.x=c,e.y=l,e}function dr(e){var t=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn,t/=this.Qn;var r,i;if(Math.abs(t)<=2.623395162778){var a=cr(this.utg,2*n,2*t);n+=a[0],t+=a[1],t=Math.atan(nr(t));var o=Math.sin(n),s=Math.cos(n),c=Math.sin(t),l=Math.cos(t);n=Math.atan2(o*l,Y(c,l*s)),t=Math.atan2(c,l*s),r=q(t+this.long0,this.over),i=ar(this.cgb,n)}else r=1/0,i=1/0;return e.x=r,e.y=i,e}var fr={init:lr,forward:ur,inverse:dr,names:[`Extended_Transverse_Mercator`,`Extended Transverse Mercator`,`etmerc`,`Transverse_Mercator`,`Transverse Mercator`,`Gauss Kruger`,`Gauss_Kruger`,`tmerc`]};function pr(e,t){if(e===void 0){if(e=Math.floor((q(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var mr=`etmerc`;function hr(){var e=pr(this.zone,this.long0);if(e===void 0)throw Error(`unknown utm zone`);this.lat0=0,this.long0=(6*Math.abs(e)-183)*V,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,fr.init.apply(this),this.forward=fr.forward,this.inverse=fr.inverse}var gr={init:hr,names:[`Universal Transverse Mercator System`,`utm`],dependsOn:mr};function _r(e,t){return((1-e)/(1+e))**t}var vr=20;function yr(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+U)/(Math.tan(.5*this.lat0+U)**+this.C*_r(this.e*e,this.ratexp))}function br(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.tan(.5*n+U)**+this.C*_r(this.e*Math.sin(n),this.ratexp))-z,e.x=this.C*t,e}function xr(e){for(var t=1e-14,n=e.x/this.C,r=e.y,i=(Math.tan(.5*r+U)/this.K)**(1/this.C),a=vr;a>0&&(r=2*Math.atan(i*_r(this.e*Math.sin(e.y),-.5*this.e))-z,!(Math.abs(r-e.y)<t));--a)e.y=r;return a?(e.x=n,e.y=r,e):null}var Sr={init:yr,forward:br,inverse:xr,names:[`gauss`]};function Cr(){Sr.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||=`Oblique Stereographic Alternative`)}function wr(e){var t,n,r,i;return e.x=q(e.x-this.long0,this.over),Sr.forward.apply(this,[e]),t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*n*r),e.x=i*n*Math.sin(e.x),e.y=i*(this.cosc0*t-this.sinc0*n*r),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Tr(e){var t,n,r,i,a;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,a=Y(e.x,e.y)){var o=2*Math.atan2(a,this.R2);t=Math.sin(o),n=Math.cos(o),i=Math.asin(n*this.sinc0+e.y*t*this.cosc0/a),r=Math.atan2(e.x*t,a*this.cosc0*n-e.y*this.sinc0*t)}else i=this.phic0,r=0;return e.x=r,e.y=i,Sr.inverse.apply(this,[e]),e.x=q(e.x+this.long0,this.over),e}var Er={init:Cr,forward:wr,inverse:Tr,names:[`Stereographic_North_Pole`,`Oblique_Stereographic`,`sterea`,`Oblique Stereographic Alternative`,`Double_Stereographic`]};function Dr(e,t,n){return t*=n,Math.tan(.5*(z+e))*((1-t)/(1+t))**(.5*n)}function Or(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&(this.k0=.5*(1+$e(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=1e-10&&(this.con=this.lat0>0?1:-1),this.cons=Math.sqrt((1+this.e)**+(1+this.e)*(1-this.e)**(1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&Math.abs(Math.cos(this.lat_ts))>1e-10&&(this.k0=.5*this.cons*Qe(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/et(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Qe(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Dr(this.lat0,this.sinlat0,this.e))-z,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function kr(e){var t=e.x,n=e.y,r=Math.sin(n),i=Math.cos(n),a,o,s,c,l,u,d=q(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=1e-10&&Math.abs(n+this.lat0)<=1e-10?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*r+this.coslat0*i*Math.cos(d)),e.x=this.a*a*i*Math.sin(d)+this.x0,e.y=this.a*a*(this.coslat0*r-this.sinlat0*i*Math.cos(d))+this.y0,e):(o=2*Math.atan(Dr(n,r,this.e))-z,c=Math.cos(o),s=Math.sin(o),Math.abs(this.coslat0)<=1e-10?(l=et(this.e,n*this.con,this.con*r),u=2*this.a*this.k0*l/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<1e-10?(a=2*this.a*this.k0/(1+c*Math.cos(d)),e.y=a*s):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*c*Math.cos(d))),e.y=a*(this.cosX0*s-this.sinX0*c*Math.cos(d))+this.y0),e.x=a*c*Math.sin(d)+this.x0,e))}function Ar(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var s=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,n=this.lat0,o<=1e-10?(e.x=t,e.y=n,e):(n=Math.asin(Math.cos(s)*this.sinlat0+e.y*Math.sin(s)*this.coslat0/o),t=Math.abs(this.coslat0)<1e-10?this.lat0>0?q(this.long0+Math.atan2(e.x,-1*e.y),this.over):q(this.long0+Math.atan2(e.x,e.y),this.over):q(this.long0+Math.atan2(e.x*Math.sin(s),o*this.coslat0*Math.cos(s)-e.y*this.sinlat0*Math.sin(s)),this.over),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=1e-10){if(o<=1e-10)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,r=o*this.cons/(2*this.a*this.k0),n=this.con*tt(this.e,r),t=this.con*q(this.con*this.long0+Math.atan2(e.x,-1*e.y),this.over)}else i=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=1e-10?a=this.X0:(a=Math.asin(Math.cos(i)*this.sinX0+e.y*Math.sin(i)*this.cosX0/o),t=q(this.long0+Math.atan2(e.x*Math.sin(i),o*this.cosX0*Math.cos(i)-e.y*this.sinX0*Math.sin(i)),this.over)),n=-1*tt(this.e,Math.tan(.5*(z+a)));return e.x=t,e.y=n,e}var jr={init:Or,forward:kr,inverse:Ar,names:[`stere`,`Stereographic_South_Pole`,`Polar_Stereographic_variant_A`,`Polar_Stereographic_variant_B`,`Polar_Stereographic`],ssfn_:Dr};function Mr(){this.k0||=1;var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),n=this.a,r=1/this.rf,i=2*r-r**2,a=this.e=Math.sqrt(i);this.R=this.k0*n*Math.sqrt(1-i)/(1-i*t**2),this.alpha=Math.sqrt(1+i/(1-i)*Math.cos(e)**4),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+e/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*s+this.alpha*a/2*c}function Nr(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),r=-this.alpha*(t+n)+this.K,i=2*(Math.atan(Math.exp(r))-Math.PI/4),a=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(i)+Math.cos(this.b0)*Math.cos(a))),s=Math.asin(Math.cos(this.b0)*Math.sin(i)-Math.sin(this.b0)*Math.cos(i)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,e.x=this.R*o+this.x0,e}function Pr(e){for(var t=e.x-this.x0,n=e.y-this.y0,r=t/this.R,i=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(i)+Math.sin(this.b0)*Math.cos(i)*Math.cos(r)),o=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(i))),s=this.lambda0+o/this.alpha,c=0,l=a,u=-1e3,d=0;Math.abs(l-u)>1e-7;){if(++d>20)return;c=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(c))-Math.PI/2}return e.x=s,e.y=l,e}var Fr={init:Mr,forward:Nr,inverse:Pr,names:[`somerc`]},Ir=1e-7;function Lr(e){var t=[`Hotine_Oblique_Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`],n=typeof e.projName==`object`?Object.keys(e.projName)[0]:e.projName;return`no_uoff`in e||`no_off`in e||t.indexOf(n)!==-1||t.indexOf(pt(n))!==-1}function Rr(){var e,t,n,r,i,a,o,s,c,l,u=0,d,f=0,p=0,m=0,h=0,g=0,_=0;this.k0||=1,this.no_off=Lr(this),this.no_rot=`no_rot`in this;var v=!1;`alpha`in this&&(v=!0);var y=!1;if(`rectified_grid_angle`in this&&(y=!0),v&&(_=this.alpha),y&&(u=this.rectified_grid_angle,v||=(_=0,!0)),v||y)f=this.longc;else if(p=this.long1,h=this.lat1,m=this.long2,g=this.lat2,Math.abs(h-g)<=Ir||(e=Math.abs(h))<=Ir||Math.abs(e-z)<=Ir||Math.abs(Math.abs(this.lat0)-z)<=Ir||Math.abs(Math.abs(g)-z)<=Ir)throw Error();var b=1-this.es;t=Math.sqrt(b),Math.abs(this.lat0)>1e-10?(s=Math.sin(this.lat0),n=Math.cos(this.lat0),e=1-this.es*s*s,this.B=n*n,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*t/e,r=this.B*t/(n*Math.sqrt(e)),i=r*r-1,i<=0?i=0:(i=Math.sqrt(i),this.lat0<0&&(i=-i)),this.E=i+=r,this.E*=et(this.e,this.lat0,s)**+this.B):(this.B=1/t,this.A=this.k0,this.E=r=i=1),v||y?(v?(d=Math.asin(Math.sin(_)/r),y||(u=_)):(d=u,_=Math.asin(r*Math.sin(d))),this.lam0=f-Math.asin(.5*(i-1/i)*Math.tan(d))/this.B):(a=et(this.e,h,Math.sin(h))**+this.B,o=et(this.e,g,Math.sin(g))**+this.B,i=this.E/a,c=(o-a)/(o+a),l=this.E*this.E,l=(l-o*a)/(l+o*a),e=p-m,e<-Math.PI?m-=se:e>Math.PI&&(m+=se),this.lam0=q(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/c)/this.B,this.over),d=Math.atan(2*Math.sin(this.B*q(p-this.lam0,this.over))/(i-1/i)),u=_=Math.asin(r*Math.sin(d))),this.singam=Math.sin(d),this.cosgam=Math.cos(d),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(_))),this.lat0<0&&(this.u_0=-this.u_0)),i=.5*d,this.v_pole_n=this.ArB*Math.log(Math.tan(U-i)),this.v_pole_s=this.ArB*Math.log(Math.tan(U+i))}function zr(e){var t={},n,r,i,a,o,s,c,l;if(e.x-=this.lam0,Math.abs(Math.abs(e.y)-z)>1e-10){if(o=this.E/et(this.e,e.y,Math.sin(e.y))**+this.B,s=1/o,n=.5*(o-s),r=.5*(o+s),a=Math.sin(this.B*e.x),i=(n*this.singam-a*this.cosgam)/r,Math.abs(Math.abs(i)-1)<1e-10)throw Error();l=.5*this.ArB*Math.log((1-i)/(1+i)),s=Math.cos(this.B*e.x),c=Math.abs(s)<Ir?this.A*e.x:this.ArB*Math.atan2(n*this.cosgam+a*this.singam,s)}else l=e.y>0?this.v_pole_n:this.v_pole_s,c=this.ArB*e.y;return this.no_rot?(t.x=c,t.y=l):(c-=this.u_0,t.x=l*this.cosrot+c*this.sinrot,t.y=c*this.cosrot-l*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}function Br(e){var t,n,r,i,a,o,s,c={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(n=e.y,t=e.x):(n=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),r=Math.exp(-this.BrA*n),i=.5*(r-1/r),a=.5*(r+1/r),o=Math.sin(this.BrA*t),s=(o*this.cosgam+i*this.singam)/a,Math.abs(Math.abs(s)-1)<1e-10)c.x=0,c.y=s<0?-z:z;else{if(c.y=this.E/Math.sqrt((1+s)/(1-s)),c.y=tt(this.e,c.y**(1/this.B)),c.y===1/0)throw Error();c.x=-this.rB*Math.atan2(i*this.cosgam-o*this.singam,Math.cos(this.BrA*t))}return c.x+=this.lam0,e.z!==void 0&&(c.z=e.z),e.m!==void 0&&(c.m=e.m),c}var Vr={init:Rr,forward:zr,inverse:Br,names:[`Hotine_Oblique_Mercator`,`Hotine Oblique Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Variant_B`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`,`Hotine_Oblique_Mercator_Two_Point_Natural_Origin`,`Hotine_Oblique_Mercator_Azimuth_Center`,`Oblique_Mercator`,`omerc`]};function Hr(){if(this.lat2||=this.lat1,this.k0||=1,this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<1e-10)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),n=Math.cos(this.lat1),r=Qe(this.e,t,n),i=et(this.e,this.lat1,t),a=Math.sin(this.lat2),o=Math.cos(this.lat2),s=Qe(this.e,a,o),c=et(this.e,this.lat2,a),l=et(this.e,this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>1e-10?Math.log(r/s)/Math.log(i/c):t,isNaN(this.ns)&&(this.ns=t),this.f0=r/(this.ns*i**+this.ns),this.rh=Math.abs(Math.abs(this.lat0)-z)<1e-10?0:this.a*this.f0*l**+this.ns,this.title||=`Lambert Conformal Conic`}}function Ur(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=$e(n)*(z-2*B));var r=Math.abs(Math.abs(n)-z),i,a;if(r>1e-10)i=et(this.e,n,Math.sin(n)),a=this.a*this.f0*i**+this.ns;else{if(r=n*this.ns,r<=0)return null;a=0}var o=this.ns*q(t-this.long0,this.over);return e.x=this.k0*(a*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(o))+this.y0,e}function Wr(e){var t,n,r,i,a,o=(e.x-this.x0)/this.k0,s=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+s*s),n=1):(t=-Math.sqrt(o*o+s*s),n=-1);var c=0;if(t!==0&&(c=Math.atan2(n*o,n*s)),t!==0||this.ns>0){if(n=1/this.ns,r=(t/(this.a*this.f0))**+n,i=tt(this.e,r),i===-9999)return null}else i=-z;return a=q(c/this.ns+this.long0,this.over),e.x=a,e.y=i,e}var Gr={init:Hr,forward:Ur,inverse:Wr,names:[`Lambert Tangential Conformal Conic Projection`,`Lambert_Conformal_Conic`,`Lambert_Conformal_Conic_1SP`,`Lambert_Conformal_Conic_2SP`,`lcc`,`Lambert Conic Conformal (1SP)`,`Lambert Conic Conformal (2SP)`]};function Kr(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||=.863937979737193,this.long0||=.4334234309119251,this.k0||=.9999,this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.cos(this.fi0)**4/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)))**(this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.tan(this.fi0/2+this.s45)**+this.alfa*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.sin(this.fi0)**2),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function qr(e){var t,n,r,i,a,o,s,c=e.x,l=e.y,u=q(c-this.long0,this.over);return t=((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)))**(this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.tan(l/2+this.s45)**+this.alfa/t)-this.s45),r=-u*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),a=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),o=this.n*a,s=this.ro0*Math.tan(this.s0/2+this.s45)**+this.n/Math.tan(i/2+this.s45)**+this.n,e.y=s*Math.cos(o)/1,e.x=s*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Jr(e){var t,n,r,i,a,o,s,c,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),i=a/Math.sin(this.s0),r=2*(Math.atan((this.ro0/o)**(1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(t)),e.x=this.long0-n/this.alfa,s=t,c=0;var u=0;do e.y=2*(Math.atan(this.k**(-1/this.alfa)*Math.tan(t/2+this.s45)**(1/this.alfa)*((1+this.e*Math.sin(s))/(1-this.e*Math.sin(s)))**(this.e/2))-this.s45),Math.abs(s-e.y)<1e-10&&(c=1),s=e.y,u+=1;while(c===0&&u<15);return u>=15?null:e}var Yr={init:Kr,forward:qr,inverse:Jr,names:[`Krovak`,`Krovak Modified`,`Krovak (North Orientated)`,`Krovak Modified (North Orientated)`,`krovak`]};function X(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}function Xr(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Zr(e){return .375*e*(1+.25*e*(1+.46875*e))}function Qr(e){return .05859375*e*e*(1+.75*e)}function $r(e){return e*e*e*(35/3072)}function ei(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}function ti(e){return Math.abs(e)<z?e:e-$e(e)*Math.PI}function ni(e,t,n,r,i){for(var a=e/t,o,s=0;s<15;s++)if(o=(e-(t*a-n*Math.sin(2*a)+r*Math.sin(4*a)-i*Math.sin(6*a)))/(t-2*n*Math.cos(2*a)+4*r*Math.cos(4*a)-6*i*Math.cos(6*a)),a+=o,Math.abs(o)<=1e-10)return a;return NaN}function ri(){this.sphere||(this.e0=Xr(this.es),this.e1=Zr(this.es),this.e2=Qr(this.es),this.e3=$r(this.es),this.ml0=this.a*X(this.e0,this.e1,this.e2,this.e3,this.lat0))}function ii(e){var t,n,r=e.x,i=e.y;if(r=q(r-this.long0,this.over),this.sphere)t=this.a*Math.asin(Math.cos(i)*Math.sin(r)),n=this.a*(Math.atan2(Math.tan(i),Math.cos(r))-this.lat0);else{var a=Math.sin(i),o=Math.cos(i),s=ei(this.a,this.e,a),c=Math.tan(i)*Math.tan(i),l=r*Math.cos(i),u=l*l,d=this.es*o*o/(1-this.es),f=this.a*X(this.e0,this.e1,this.e2,this.e3,i);t=s*l*(1-u*c*(1/6-(8-c+8*d)*u/120)),n=f-this.ml0+s*a/o*u*(.5+(5-c+6*d)*u/24)}return e.x=t+this.x0,e.y=n+this.y0,e}function ai(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i;if(this.sphere){var a=n+this.lat0;r=Math.asin(Math.sin(a)*Math.cos(t)),i=Math.atan2(Math.tan(t),Math.cos(a))}else{var o=ni(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-z)<=1e-10)return e.x=this.long0,e.y=z,n<0&&(e.y*=-1),e;var s=ei(this.a,this.e,Math.sin(o)),c=s*s*s/this.a/this.a*(1-this.es),l=Math.tan(o)**2,u=t*this.a/s,d=u*u;r=o-s*Math.tan(o)/c*u*u*(.5-(1+3*l)*u*u/24),i=u*(1-d*(l/3+(1+3*l)*l*d/15))/Math.cos(o)}return e.x=q(i+this.long0,this.over),e.y=ti(r),e}var oi={init:ri,forward:ii,inverse:ai,names:[`Cassini`,`Cassini_Soldner`,`cass`]};function si(e,t){var n;return e>1e-7?(n=e*t,(1-e*e)*(t/(1-n*n)-.5/e*Math.log((1-n)/(1+n)))):2*t}var ci=.3333333333333333,li=.17222222222222222,ui=.10257936507936508,di=.06388888888888888,fi=.0664021164021164,pi=.016415012942191543;function mi(e){var t,n=[];return n[0]=e*ci,t=e*e,n[0]+=t*li,n[1]=t*di,t*=e,n[0]+=t*ui,n[1]+=t*fi,n[2]=t*pi,n}function hi(e,t){var n=e+e;return e+t[0]*Math.sin(n)+t[1]*Math.sin(n+n)+t[2]*Math.sin(n+n+n)}function gi(){var e=Math.abs(this.lat0);if(this.mode=Math.abs(e-z)<1e-10?this.lat0<0?1:2:Math.abs(e)<1e-10?3:4,this.es>0){var t;switch(this.qp=si(this.e,1),this.mmf=.5/(1-this.es),this.apa=mi(this.es),this.mode){case 2:this.dd=1;break;case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=si(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===4&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function _i(e){var t,n,r,i,a,o,s,c,l,u,d=e.x,f=e.y;if(d=q(d-this.long0,this.over),this.sphere){if(a=Math.sin(f),u=Math.cos(f),r=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n=this.mode===this.EQUIT?1+u*r:1+this.sinph0*a+this.cosph0*u*r,n<=1e-10)return null;n=Math.sqrt(2/n),t=n*u*Math.sin(d),n*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(f+this.lat0)<1e-10)return null;n=U-f*.5,n=2*(this.mode===this.S_POLE?Math.cos(n):Math.sin(n)),t=n*Math.sin(d),n*=r}}else{switch(s=0,c=0,l=0,r=Math.cos(d),i=Math.sin(d),a=Math.sin(f),o=si(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(s=o/this.qp,c=Math.sqrt(1-s*s)),this.mode){case this.OBLIQ:l=1+this.sinb1*s+this.cosb1*c*r;break;case this.EQUIT:l=1+c*r;break;case this.N_POLE:l=z+f,o=this.qp-o;break;case this.S_POLE:l=f-z,o=this.qp+o}if(Math.abs(l)<1e-10)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),n=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*s-this.sinb1*c*r):(l=Math.sqrt(2/(1+c*r)))*s*this.ymf,t=this.xmf*l*c*i;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*i,n=r*(this.mode===this.S_POLE?l:-l)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e}function vi(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i,a,o,s,c,l;if(this.sphere){var u=0,d,f=0;if(d=Math.sqrt(t*t+n*n),i=d*.5,i>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(d)<=1e-10?0:Math.asin(n*f/d),t*=f,n=u*d;break;case this.OBLIQ:i=Math.abs(d)<=1e-10?this.lat0:Math.asin(u*this.sinph0+n*f*this.cosph0/d),t*=f*this.cosph0,n=(u-Math.sin(i)*this.sinph0)*d;break;case this.N_POLE:n=-n,i=z-i;break;case this.S_POLE:i-=z}r=n===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,n)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,n*=this.dd,c=Math.sqrt(t*t+n*n),c<1e-10)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*c/this.rq),a=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=a*this.sinb1+n*o*this.cosb1/c,s=this.qp*l,n=c*this.cosb1*a-n*this.sinb1*o):(l=n*o/c,s=this.qp*l,n=c*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),s=t*t+n*n,!s)return e.x=this.long0,e.y=this.lat0,e;l=1-s/this.qp,this.mode===this.S_POLE&&(l=-l)}r=Math.atan2(t,n),i=hi(Math.asin(l),this.apa)}return e.x=q(this.long0+r,this.over),e.y=i,e}var yi={init:gi,forward:_i,inverse:vi,names:[`Lambert Azimuthal Equal Area`,`Lambert_Azimuthal_Equal_Area`,`laea`],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function bi(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function xi(){Math.abs(this.lat1+this.lat2)<1e-10||(this.temp=this.b/this.a,this.es=1-this.temp**2,this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Qe(this.e3,this.sin_po,this.cos_po),this.qs1=si(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Qe(this.e3,this.sin_po,this.cos_po),this.qs2=si(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=si(this.e3,this.sin_po),this.ns0=Math.abs(this.lat1-this.lat2)>1e-10?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Si(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=si(this.e3,this.sin_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*q(t-this.long0,this.over),o=i*Math.sin(a)+this.x0,s=this.rh-i*Math.cos(a)+this.y0;return e.x=o,e.y=s,e}function Ci(e){var t,n,r,i,a,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),i=0,t!==0&&(i=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,o=this.phi1z(this.e3,n)),a=q(i/this.ns0+this.long0,this.over),e.x=a,e.y=o,e}function wi(e,t){var n,r,i,a,o,s=bi(.5*t);if(e<1e-10)return s;for(var c=e*e,l=1;l<=25;l++)if(n=Math.sin(s),r=Math.cos(s),i=e*n,a=1-i*i,o=.5*a*a/r*(t/(1-c)-n/a+.5/e*Math.log((1-i)/(1+i))),s+=o,Math.abs(o)<=1e-7)return s;return null}var Ti={init:xi,forward:Si,inverse:Ci,names:[`Albers_Conic_Equal_Area`,`Albers_Equal_Area`,`Albers`,`aea`],phi1z:wi};function Ei(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Di(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=q(l-this.long0,this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,o>0||Math.abs(o)<=1e-10?(s=this.x0+this.a*a*n*Math.sin(r)/o,c=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)/o):(s=this.x0+this.infinity_dist*n*Math.sin(r),c=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Oi(e){var t,n,r,i,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(i=Math.atan2(t,this.rc),n=Math.sin(i),r=Math.cos(i),o=bi(r*this.sin_p14+e.y*n*this.cos_p14/t),a=Math.atan2(e.x*n,t*this.cos_p14*r-e.y*this.sin_p14*n),a=q(this.long0+a,this.over)):(o=this.phic0,a=0),e.x=a,e.y=o,e}var ki={init:Ei,forward:Di,inverse:Oi,names:[`gnom`]};function Ai(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*z:z;for(var r=Math.asin(.5*t),i,a,o,s,c=0;c<30;c++)if(a=Math.sin(r),o=Math.cos(r),s=e*a,i=(1-s*s)**2/(2*o)*(t/(1-e*e)-a/(1-s*s)+.5/e*Math.log((1-s)/(1+s))),r+=i,Math.abs(i)<=1e-10)return r;return NaN}function ji(){this.sphere||(this.k0=Qe(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Mi(e){var t=e.x,n=e.y,r,i,a=q(t-this.long0,this.over);if(this.sphere)r=this.x0+this.a*a*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=si(this.e,Math.sin(n));r=this.x0+this.a*this.k0*a,i=this.y0+this.a*o*.5/this.k0}return e.x=r,e.y=i,e}function Ni(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=q(this.long0+e.x/this.a/Math.cos(this.lat_ts),this.over),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=Ai(this.e,2*e.y*this.k0/this.a),t=q(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=n,e}var Pi={init:ji,forward:Mi,inverse:Ni,names:[`cea`]};function Fi(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Equidistant Cylindrical (Plate Carre)`,this.rc=Math.cos(this.lat_ts)}function Ii(e){var t=e.x,n=e.y,r=q(t-this.long0,this.over),i=ti(n-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*i,e}function Li(e){var t=e.x,n=e.y;return e.x=q(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=ti(this.lat0+(n-this.y0)/this.a),e}var Ri={init:Fi,forward:Ii,inverse:Li,names:[`Equirectangular`,`Equidistant_Cylindrical`,`Equidistant_Cylindrical_Spherical`,`eqc`]},zi=20;function Bi(){this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=Xr(this.es),this.e1=Zr(this.es),this.e2=Qr(this.es),this.e3=$r(this.es),this.ml0=this.a*X(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Vi(e){var t=e.x,n=e.y,r,i,a,o=q(t-this.long0,this.over);if(a=o*Math.sin(n),this.sphere)Math.abs(n)<=1e-10?(r=this.a*o,i=-1*this.a*this.lat0):(r=this.a*Math.sin(a)/Math.tan(n),i=this.a*(ti(n-this.lat0)+(1-Math.cos(a))/Math.tan(n)));else if(Math.abs(n)<=1e-10)r=this.a*o,i=-1*this.ml0;else{var s=ei(this.a,this.e,Math.sin(n))/Math.tan(n);r=s*Math.sin(a),i=this.a*X(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+s*(1-Math.cos(a))}return e.x=r+this.x0,e.y=i+this.y0,e}function Hi(e){var t,n,r=e.x-this.x0,i=e.y-this.y0,a,o,s,c,l;if(this.sphere){if(Math.abs(i+this.a*this.lat0)<=1e-10)t=q(r/this.a+this.long0,this.over),n=0;else{o=this.lat0+i/this.a,s=r*r/this.a/this.a+o*o,c=o;var u;for(a=zi;a;--a)if(u=Math.tan(c),l=-1*(o*(c*u+1)-c-.5*(c*c+s)*u)/((c-o)/u-1),c+=l,Math.abs(l)<=1e-10){n=c;break}t=q(this.long0+Math.asin(r*Math.tan(c)/this.a)/Math.sin(n),this.over)}}else if(Math.abs(i+this.ml0)<=1e-10)n=0,t=q(this.long0+r/this.a,this.over);else{o=(this.ml0+i)/this.a,s=r*r/this.a/this.a+o*o,c=o;var d,f,p,m,h;for(a=zi;a;--a)if(h=this.e*Math.sin(c),d=Math.sqrt(1-h*h)*Math.tan(c),f=this.a*X(this.e0,this.e1,this.e2,this.e3,c),p=this.e0-2*this.e1*Math.cos(2*c)+4*this.e2*Math.cos(4*c)-6*this.e3*Math.cos(6*c),m=f/this.a,l=(o*(d*m+1)-m-.5*d*(m*m+s))/(this.es*Math.sin(2*c)*(m*m+s-2*o*m)/(4*d)+(o-m)*(d*p-2/Math.sin(2*c))-p),c-=l,Math.abs(l)<=1e-10){n=c;break}d=Math.sqrt(1-this.es*Math.sin(n)**2)*Math.tan(n),t=q(this.long0+Math.asin(r*d/this.a)/Math.sin(n),this.over)}return e.x=t,e.y=n,e}var Ui={init:Bi,forward:Vi,inverse:Hi,names:[`Polyconic`,`American_Polyconic`,`poly`]};function Wi(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Gi(e){var t,n=e.x,r=e.y-this.lat0,i=n-this.long0,a=r/R*1e-5,o=i,s=1,c=0;for(t=1;t<=10;t++)s*=a,c+=this.A[t]*s;var l=c,u=o,d=1,f=0,p,m,h=0,g=0;for(t=1;t<=6;t++)p=d*l-f*u,m=f*l+d*u,d=p,f=m,h=h+this.B_re[t]*d-this.B_im[t]*f,g=g+this.B_im[t]*d+this.B_re[t]*f;return e.x=g*this.a+this.x0,e.y=h*this.a+this.y0,e}function Ki(e){var t,n=e.x,r=e.y,i=n-this.x0,a=(r-this.y0)/this.a,o=i/this.a,s=1,c=0,l,u,d=0,f=0;for(t=1;t<=6;t++)l=s*a-c*o,u=c*a+s*o,s=l,c=u,d=d+this.C_re[t]*s-this.C_im[t]*c,f=f+this.C_im[t]*s+this.C_re[t]*c;for(var p=0;p<this.iterations;p++){var m=d,h=f,g,_,v=a,y=o;for(t=2;t<=6;t++)g=m*d-h*f,_=h*d+m*f,m=g,h=_,v+=(t-1)*(this.B_re[t]*m-this.B_im[t]*h),y+=(t-1)*(this.B_im[t]*m+this.B_re[t]*h);m=1,h=0;var b=this.B_re[1],x=this.B_im[1];for(t=2;t<=6;t++)g=m*d-h*f,_=h*d+m*f,m=g,h=_,b+=t*(this.B_re[t]*m-this.B_im[t]*h),x+=t*(this.B_im[t]*m+this.B_re[t]*h);var S=b*b+x*x;d=(v*b+y*x)/S,f=(y*b-v*x)/S}var C=d,w=f,T=1,E=0;for(t=1;t<=9;t++)T*=C,E+=this.D[t]*T;var D=this.lat0+E*R*1e5;return e.x=this.long0+w,e.y=D,e}var qi={init:Wi,forward:Gi,inverse:Ki,names:[`New_Zealand_Map_Grid`,`nzmg`],iterations:1};function Ji(){}function Yi(e){var t=e.x,n=e.y,r=q(t-this.long0,this.over),i=this.x0+this.a*r,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return e.x=i,e.y=a,e}function Xi(e){e.x-=this.x0,e.y-=this.y0;var t=q(this.long0+e.x/this.a,this.over),n=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=n,e}var Zi={init:Ji,forward:Yi,inverse:Xi,names:[`Miller_Cylindrical`,`mill`]},Qi=20;function $i(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Jn(this.es)}function ea(e){var t,n,r=e.x,i=e.y;if(r=q(r-this.long0,this.over),this.sphere){if(!this.m)i=this.n===1?i:Math.asin(this.n*Math.sin(i));else for(var a=this.n*Math.sin(i),o=Qi;o;--o){var s=(this.m*i+Math.sin(i)-a)/(this.m+Math.cos(i));if(i-=s,Math.abs(s)<1e-10)break}t=this.a*this.C_x*r*(this.m+Math.cos(i)),n=this.a*this.C_y*i}else{var c=Math.sin(i),l=Math.cos(i);n=this.a*Yn(i,c,l,this.en),t=this.a*r*l/Math.sqrt(1-this.es*c*c)}return e.x=t,e.y=n,e}function ta(e){var t,n,r,i;return e.x-=this.x0,r=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,r/=this.C_x*(this.m+Math.cos(t)),this.m?t=bi((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=bi(Math.sin(t)/this.n)),r=q(r+this.long0,this.over),t=ti(t)):(t=Zn(e.y/this.a,this.es,this.en),i=Math.abs(t),i<z?(i=Math.sin(t),n=this.long0+e.x*Math.sqrt(1-this.es*i*i)/(this.a*Math.cos(t)),r=q(n,this.over)):i-1e-10<z&&(r=this.long0)),e.x=r,e.y=t,e}var na={init:$i,forward:ea,inverse:ta,names:[`Sinusoidal`,`sinu`]};function ra(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var ia={init:ra,forward:ea,inverse:ta,names:[`Eckert_VI`,`eck6`]};function aa(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0}function oa(e){for(var t=e.x,n=e.y,r=q(t-this.long0,this.over),i=n,a=Math.PI*Math.sin(n);;){var o=-(i+Math.sin(i)-a)/(1+Math.cos(i));if(i+=o,Math.abs(o)<1e-10)break}i/=2,Math.PI/2-Math.abs(n)<1e-10&&(r=0);var s=.900316316158*this.a*r*Math.cos(i)+this.x0,c=1.4142135623731*this.a*Math.sin(i)+this.y0;return e.x=s,e.y=c,e}function sa(e){var t,n;e.x-=this.x0,e.y-=this.y0,n=e.y/(1.4142135623731*this.a),Math.abs(n)>.999999999999&&(n=.999999999999),t=Math.asin(n);var r=q(this.long0+e.x/(.900316316158*this.a*Math.cos(t)),this.over);r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var i=Math.asin(n);return e.x=r,e.y=i,e}var ca={init:aa,forward:oa,inverse:sa,names:[`Mollweide`,`moll`]};function la(){Math.abs(this.lat1+this.lat2)<1e-10||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=Xr(this.es),this.e1=Zr(this.es),this.e2=Qr(this.es),this.e3=$r(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Qe(this.e,this.sin_phi,this.cos_phi),this.ml1=X(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<1e-10?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Qe(this.e,this.sin_phi,this.cos_phi),this.ml2=X(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=X(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function ua(e){var t=e.x,n=e.y,r;if(this.sphere)r=this.a*(this.g-n);else{var i=X(this.e0,this.e1,this.e2,this.e3,n);r=this.a*(this.g-i)}var a=this.ns*q(t-this.long0,this.over),o=this.x0+r*Math.sin(a),s=this.y0+this.rh-r*Math.cos(a);return e.x=o,e.y=s,e}function da(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,n,r,i;this.ns>=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var a=0;return n!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere?(i=q(this.long0+a/this.ns,this.over),r=ti(this.g-n/this.a),e.x=i,e.y=r,e):(r=ni(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),i=q(this.long0+a/this.ns,this.over),e.x=i,e.y=r,e)}var fa={init:la,forward:ua,inverse:da,names:[`Equidistant_Conic`,`eqdc`]};function pa(){this.R=this.a}function ma(e){var t=e.x,n=e.y,r=q(t-this.long0,this.over),i,a;if(Math.abs(n)<=1e-10)return i=this.x0+this.R*r,a=this.y0,e.x=i,e.y=a,e;var o=bi(2*Math.abs(n/Math.PI));if(Math.abs(r)<=1e-10||Math.abs(Math.abs(n)-z)<=1e-10)return i=this.x0,a=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),e.x=i,e.y=a,e;var s=.5*Math.abs(Math.PI/r-r/Math.PI),c=s*s,l=Math.sin(o),u=Math.cos(o),d=u/(l+u-1),f=d*d,p=d*(2/l-1),m=p*p,h=Math.PI*this.R*(s*(d-m)+Math.sqrt(c*(d-m)*(d-m)-(m+c)*(f-m)))/(m+c);r<0&&(h=-h),i=this.x0+h;var g=c+d;return h=Math.PI*this.R*(p*g-s*Math.sqrt((m+c)*(c+1)-g*g))/(m+c),a=n>=0?this.y0+h:this.y0-h,e.x=i,e.y=a,e}function ha(e){var t,n,r,i,a,o,s,c,l,u,d,f,p;return e.x-=this.x0,e.y-=this.y0,d=Math.PI*this.R,r=e.x/d,i=e.y/d,a=r*r+i*i,o=-Math.abs(i)*(1+a),s=o-2*i*i+r*r,c=-2*o+1+2*i*i+a*a,p=i*i/c+(2*s*s*s/c/c/c-9*o*s/c/c)/27,l=(o-s*s/3/c)/c,u=2*Math.sqrt(-l/3),d=3*p/l/u,Math.abs(d)>1&&(d=d>=0?1:-1),f=Math.acos(d)/3,n=e.y>=0?(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI:-(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI,t=Math.abs(r)<1e-10?this.long0:q(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(r*r-i*i)+a*a))/2/r,this.over),e.x=t,e.y=n,e}var ga={init:pa,forward:ma,inverse:ha,names:[`Van_der_Grinten_I`,`VanDerGrinten`,`Van_der_Grinten`,`vandg`]};function _a(e,t,n,r,i,a){let o=r-t,s=Math.atan((1-a)*Math.tan(e)),c=Math.atan((1-a)*Math.tan(n)),l=Math.sin(s),u=Math.cos(s),d=Math.sin(c),f=Math.cos(c),p=o,m,h=100,g,_,v,y,b,x,S,C,w,T,E,D,O,k;do{if(g=Math.sin(p),_=Math.cos(p),v=Math.sqrt(f*g*(f*g)+(u*d-l*f*_)*(u*d-l*f*_)),v===0)return{azi1:0,s12:0};y=l*d+u*f*_,b=Math.atan2(v,y),x=u*f*g/v,S=1-x*x,C=S===0?0:y-2*l*d/S,w=a/16*S*(4+a*(4-3*S)),m=p,p=o+(1-w)*a*x*(b+w*v*(C+w*y*(-1+2*C*C)))}while(Math.abs(p-m)>1e-12&&--h>0);return h===0?{azi1:NaN,s12:NaN}:(T=S*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),E=1+T/16384*(4096+T*(-768+T*(320-175*T))),D=T/1024*(256+T*(-128+T*(74-47*T))),O=D*v*(C+D/4*(y*(-1+2*C*C)-D/6*C*(-3+4*v*v)*(-3+4*C*C))),k=i*(1-a)*E*(b-O),{azi1:Math.atan2(f*g,u*d-l*f*_),s12:k})}function va(e,t,n,r,i,a){let o=Math.atan((1-a)*Math.tan(e)),s=Math.sin(o),c=Math.cos(o),l=Math.sin(n),u=Math.cos(n),d=Math.atan2(s,c*u),f=c*l,p=1-f*f,m=p*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),h=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m))),_=r/(i*(1-a)*h),v,y=100,b,x,S,C;do b=Math.cos(2*d+_),x=Math.sin(_),S=Math.cos(_),C=g*x*(b+g/4*(S*(-1+2*b*b)-g/6*b*(-3+4*x*x)*(-3+4*b*b))),v=_,_=r/(i*(1-a)*h)+C;while(Math.abs(_-v)>1e-12&&--y>0);if(y===0)return{lat2:NaN,lon2:NaN};let w=s*x-c*S*u,T=Math.atan2(s*S+c*x*u,(1-a)*Math.sqrt(f*f+w*w)),E=Math.atan2(x*l,c*S-s*x*u),D=a/16*p*(4+a*(4-3*p));return{lat2:T,lon2:t+(E-(1-D)*a*f*(_+D*x*(b+D*S*(-1+2*b*b))))}}function ya(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function ba(e){var t=e.x,n=e.y,r=Math.sin(e.y),i=Math.cos(e.y),a=q(t-this.long0,this.over),o,s,c,l,u,d,f,p,m,h,g;return this.sphere?Math.abs(this.sin_p12-1)<=1e-10?(e.x=this.x0+this.a*(z-n)*Math.sin(a),e.y=this.y0-this.a*(z-n)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(e.x=this.x0+this.a*(z+n)*Math.sin(a),e.y=this.y0+this.a*(z+n)*Math.cos(a),e):(m=this.sin_p12*r+this.cos_p12*i*Math.cos(a),f=Math.acos(m),p=f?f/Math.sin(f):1,e.x=this.x0+this.a*p*i*Math.sin(a),e.y=this.y0+this.a*p*(this.cos_p12*r-this.sin_p12*i*Math.cos(a)),e):(o=Xr(this.es),s=Zr(this.es),c=Qr(this.es),l=$r(this.es),Math.abs(this.sin_p12-1)<=1e-10?(u=this.a*X(o,s,c,l,z),d=this.a*X(o,s,c,l,n),e.x=this.x0+(u-d)*Math.sin(a),e.y=this.y0-(u-d)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(u=this.a*X(o,s,c,l,z),d=this.a*X(o,s,c,l,n),e.x=this.x0+(u+d)*Math.sin(a),e.y=this.y0+(u+d)*Math.cos(a),e):Math.abs(t)<1e-10&&Math.abs(n-this.lat0)<1e-10?(e.x=this.x0,e.y=this.y0,e):(h=_a(this.lat0,this.long0,n,t,this.a,this.f),g=h.azi1,e.x=this.x0+h.s12*Math.sin(g),e.y=this.y0+h.s12*Math.cos(g),e))}function xa(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*z*this.a?void 0:(n=t/this.a,r=Math.sin(n),i=Math.cos(n),a=this.long0,Math.abs(t)<=1e-10?o=this.lat0:(o=bi(i*this.sin_p12+e.y*r*this.cos_p12/t),s=Math.abs(this.lat0)-z,a=Math.abs(s)<=1e-10?this.lat0>=0?q(this.long0+Math.atan2(e.x,-e.y),this.over):q(this.long0-Math.atan2(-e.x,e.y),this.over):q(this.long0+Math.atan2(e.x*r,t*this.cos_p12*i-e.y*this.sin_p12*r),this.over)),e.x=a,e.y=o,e)):(c=Xr(this.es),l=Zr(this.es),u=Qr(this.es),d=$r(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*X(c,l,u,d,z),t=Math.sqrt(e.x*e.x+e.y*e.y),p=f-t,o=ni(p/this.a,c,l,u,d),a=q(this.long0+Math.atan2(e.x,-1*e.y),this.over),e.x=a,e.y=o,e):Math.abs(this.sin_p12+1)<=1e-10?(f=this.a*X(c,l,u,d,z),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-f,o=ni(p/this.a,c,l,u,d),a=q(this.long0+Math.atan2(e.x,e.y),this.over),e.x=a,e.y=o,e):(m=Math.atan2(e.x,e.y),h=Math.sqrt(e.x*e.x+e.y*e.y),g=va(this.lat0,this.long0,m,h,this.a,this.f),e.x=g.lon2,e.y=g.lat2,e))}var Sa={init:ya,forward:ba,inverse:xa,names:[`Azimuthal_Equidistant`,`aeqd`]};function Ca(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function wa(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=q(l-(this.long0||0),this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,(o>0||Math.abs(o)<=1e-10)&&(s=(this.x0||0)+this.a*a*n*Math.sin(r),c=(this.y0||0)+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Ta(e){var t,n,r,i,a,o,s,c,l;return e.x-=this.x0||0,e.y-=this.y0||0,t=Math.sqrt(e.x*e.x+e.y*e.y),n=bi(t/this.a),r=Math.sin(n),i=Math.cos(n),c=this.long0||0,l=this.lat0||0,o=c,Math.abs(t)<=1e-10?(s=l,e.x=o,e.y=s,e):(s=bi(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.abs(l)-z,Math.abs(a)<=1e-10?(o=q(l>=0?c+Math.atan2(e.x,-e.y):c-Math.atan2(-e.x,e.y),this.over),e.x=o,e.y=s,e):(o=q(c+Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),this.over),e.x=o,e.y=s,e))}var Ea={init:Ca,forward:wa,inverse:Ta,names:[`ortho`]},Z={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Q={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Da(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Quadrilateralized Spherical Cube`,this.face=this.lat0>=z-U/2?Z.TOP:this.lat0<=-(z-U/2)?Z.BOTTOM:Math.abs(this.long0)<=U?Z.FRONT:Math.abs(this.long0)<=z+U?this.long0>0?Z.RIGHT:Z.LEFT:Z.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Oa(e){var t={x:0,y:0},n,r,i,a,o,s,c={value:0};if(e.x-=this.long0,n=this.es===0?e.y:Math.atan(this.one_minus_f_squared*Math.tan(e.y)),r=e.x,this.face===Z.TOP)a=z-n,r>=U&&r<=z+U?(c.value=Q.AREA_0,i=r-z):r>z+U||r<=-(z+U)?(c.value=Q.AREA_1,i=r>0?r-W:r+W):r>-(z+U)&&r<=-U?(c.value=Q.AREA_2,i=r+z):(c.value=Q.AREA_3,i=r);else if(this.face===Z.BOTTOM)a=z+n,r>=U&&r<=z+U?(c.value=Q.AREA_0,i=-r+z):r<U&&r>=-U?(c.value=Q.AREA_1,i=-r):r<-U&&r>=-(z+U)?(c.value=Q.AREA_2,i=-r-z):(c.value=Q.AREA_3,i=r>0?-r+W:-r-W);else{var l,u,d,f,p,m,h;this.face===Z.RIGHT?r=ja(r,+z):this.face===Z.BACK?r=ja(r,+W):this.face===Z.LEFT&&(r=ja(r,-z)),f=Math.sin(n),p=Math.cos(n),m=Math.sin(r),h=Math.cos(r),l=p*h,u=p*m,d=f,this.face===Z.FRONT?(a=Math.acos(l),i=Aa(a,d,u,c)):this.face===Z.RIGHT?(a=Math.acos(u),i=Aa(a,d,-l,c)):this.face===Z.BACK?(a=Math.acos(-l),i=Aa(a,d,-u,c)):this.face===Z.LEFT?(a=Math.acos(-u),i=Aa(a,d,l,c)):(a=i=0,c.value=Q.AREA_0)}return s=Math.atan(12/W*(i+Math.acos(Math.sin(i)*Math.cos(U))-z)),o=Math.sqrt((1-Math.cos(a))/(Math.cos(s)*Math.cos(s))/(1-Math.cos(Math.atan(1/Math.cos(i))))),c.value===Q.AREA_1?s+=z:c.value===Q.AREA_2?s+=W:c.value===Q.AREA_3&&(s+=1.5*W),t.x=o*Math.cos(s),t.y=o*Math.sin(s),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function ka(e){var t={lam:0,phi:0},n,r,i,a,o,s,c,l,u,d={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,r=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),n=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?d.value=Q.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(d.value=Q.AREA_1,n-=z):e.x<0&&-e.x>=Math.abs(e.y)?(d.value=Q.AREA_2,n=n<0?n+W:n-W):(d.value=Q.AREA_3,n+=z),u=W/12*Math.tan(n),o=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),s=Math.atan(o),i=Math.cos(n),a=Math.tan(r),c=1-i*i*a*a*(1-Math.cos(Math.atan(1/Math.cos(s)))),c<-1?c=-1:c>1&&(c=1),this.face===Z.TOP)l=Math.acos(c),t.phi=z-l,t.lam=d.value===Q.AREA_0?s+z:d.value===Q.AREA_1?s<0?s+W:s-W:d.value===Q.AREA_2?s-z:s;else if(this.face===Z.BOTTOM)l=Math.acos(c),t.phi=l-z,t.lam=d.value===Q.AREA_0?-s+z:d.value===Q.AREA_1?-s:d.value===Q.AREA_2?-s-z:s<0?-s-W:-s+W;else{var f=c,p,m;u=f*f,m=u>=1?0:Math.sqrt(1-u)*Math.sin(s),u+=m*m,p=u>=1?0:Math.sqrt(1-u),d.value===Q.AREA_1?(u=p,p=-m,m=u):d.value===Q.AREA_2?(p=-p,m=-m):d.value===Q.AREA_3&&(u=p,p=m,m=-u),this.face===Z.RIGHT?(u=f,f=-p,p=u):this.face===Z.BACK?(f=-f,p=-p):this.face===Z.LEFT&&(u=f,f=p,p=-u),t.phi=Math.acos(-m)-z,t.lam=Math.atan2(p,f),this.face===Z.RIGHT?t.lam=ja(t.lam,-z):this.face===Z.BACK?t.lam=ja(t.lam,-W):this.face===Z.LEFT&&(t.lam=ja(t.lam,+z))}if(this.es!==0){var h=+(t.phi<0),g=Math.tan(t.phi),_=this.b/Math.sqrt(g*g+this.one_minus_f_squared);t.phi=Math.atan(Math.sqrt(this.a*this.a-_*_)/(this.one_minus_f*_)),h&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Aa(e,t,n,r){var i;return e<1e-10?(r.value=Q.AREA_0,i=0):(i=Math.atan2(t,n),Math.abs(i)<=U?r.value=Q.AREA_0:i>U&&i<=z+U?(r.value=Q.AREA_1,i-=z):i>z+U||i<=-(z+U)?(r.value=Q.AREA_2,i=i>=0?i-W:i+W):(r.value=Q.AREA_3,i+=z)),i}function ja(e,t){var n=e+t;return n<-3.14159265359?n+=se:n>3.14159265359&&(n-=se),n}var Ma={init:Da,forward:Oa,inverse:ka,names:[`Quadrilateralized Spherical Cube`,`Quadrilateralized_Spherical_Cube`,`qsc`]},Na=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Pa=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,422642e-15],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Fa=.8487,Ia=1.3523,La=H/5,Ra=1/La,za=18,Ba=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Va=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function Ha(e,t,n,r){for(var i=t;r;--r){var a=e(i);if(i-=a,Math.abs(a)<n)break}return i}function Ua(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||`Robinson`}function Wa(e){var t=q(e.x-this.long0,this.over),n=Math.abs(e.y),r=Math.floor(n*La);r<0?r=0:r>=za&&(r=za-1),n=H*(n-Ra*r);var i={x:Ba(Na[r],n)*t,y:Ba(Pa[r],n)};return e.y<0&&(i.y=-i.y),i.x=i.x*this.a*Fa+this.x0,i.y=i.y*this.a*Ia+this.y0,e.z!==void 0&&(i.z=e.z),e.m!==void 0&&(i.m=e.m),i}function Ga(e){var t={x:(e.x-this.x0)/(this.a*Fa),y:Math.abs(e.y-this.y0)/(this.a*Ia)};if(t.y>=1)t.x/=Na[za][0],t.y=e.y<0?-z:z;else{var n=Math.floor(t.y*za);for(n<0?n=0:n>=za&&(n=za-1);;)if(Pa[n][0]>t.y)--n;else if(Pa[n+1][0]<=t.y)++n;else break;var r=Pa[n],i=5*(t.y-r[0])/(Pa[n+1][0]-r[0]);i=Ha(function(e){return(Ba(r,e)-t.y)/Va(r,e)},i,B,100),t.x/=Ba(Na[n],i),t.y=(5*n+i)*V,e.y<0&&(t.y=-t.y)}return t.x=q(t.x+this.long0,this.over),e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}var Ka={init:Ua,forward:Wa,inverse:Ga,names:[`Robinson`,`robin`]};function qa(){this.name=`geocent`}function Ja(e){return Ht(e,this.es,this.a)}function Ya(e){return Ut(e,this.es,this.a,this.b)}var Xa={init:qa,forward:Ja,inverse:Ya,names:[`Geocentric`,`geocentric`,`geocent`,`Geocent`]},$={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Za={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function Qa(){if(Object.keys(Za).forEach(function(e){if(this[e]===void 0)this[e]=Za[e].def;else if(Za[e].num&&isNaN(this[e]))throw Error(`Invalid parameter value, must be numeric `+e+` = `+this[e]);else Za[e].num&&(this[e]=parseFloat(this[e]));Za[e].degrees&&(this[e]=this[e]*V)}.bind(this)),Math.abs(Math.abs(this.lat0)-z)<1e-10?this.mode=this.lat0<0?$.S_POLE:$.N_POLE:Math.abs(this.lat0)<1e-10?this.mode=$.EQUIT:(this.mode=$.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw Error(`Invalid height`);this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function $a(e){e.x-=this.long0;var t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i,a;switch(this.mode){case $.OBLIQ:a=this.sinph0*t+this.cosph0*n*r;break;case $.EQUIT:a=n*r;break;case $.S_POLE:a=-t;break;case $.N_POLE:a=t}switch(a=this.pn1/(this.p-a),i=a*n*Math.sin(e.x),this.mode){case $.OBLIQ:a*=this.cosph0*t-this.sinph0*n*r;break;case $.EQUIT:a*=t;break;case $.N_POLE:a*=-(n*r);break;case $.S_POLE:a*=n*r}var o=a*this.cg+i*this.sg,s=1/(o*this.sw*this.h1+this.cw);return i=(i*this.cg-a*this.sg)*this.cw*s,a=o*s,e.x=i*this.a,e.y=a*this.a,e}function eo(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},n,r,i=1/(this.pn1-e.y*this.sw);n=this.pn1*e.x*i,r=this.pn1*e.y*this.cw*i,e.x=n*this.cg+r*this.sg,e.y=r*this.cg-n*this.sg;var a=Y(e.x,e.y);if(Math.abs(a)<1e-10)t.x=0,t.y=e.y;else{var o,s=1-a*a*this.pfact;switch(s=(this.p-Math.sqrt(s))/(this.pn1/a+a/this.pn1),o=Math.sqrt(1-s*s),this.mode){case $.OBLIQ:t.y=Math.asin(o*this.sinph0+e.y*s*this.cosph0/a),e.y=(o-this.sinph0*Math.sin(t.y))*a,e.x*=s*this.cosph0;break;case $.EQUIT:t.y=Math.asin(e.y*s/a),e.y=o*a,e.x*=s;break;case $.N_POLE:t.y=Math.asin(o),e.y=-e.y;break;case $.S_POLE:t.y=-Math.asin(o)}t.x=Math.atan2(e.x,e.y)}return e.x=t.x+this.long0,e.y=t.y,e}var to={init:Qa,forward:$a,inverse:eo,names:[`Tilted_Perspective`,`tpers`]};function no(){if(this.flip_axis=+(this.sweep===`x`),this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw Error();if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=`ellipse`}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=`sphere`;this.title||=`Geostationary Satellite View`}function ro(e){var t=e.x,n=e.y,r,i,a,o;if(t-=this.long0,this.shape===`ellipse`){n=Math.atan(this.radius_p2*Math.tan(n));var s=this.radius_p/Y(this.radius_p*Math.cos(n),Math.sin(n));if(i=s*Math.cos(t)*Math.cos(n),a=s*Math.sin(t)*Math.cos(n),o=s*Math.sin(n),(this.radius_g-i)*i-a*a-o*o*this.radius_p_inv2<0)return e.x=NaN,e.y=NaN,e;r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/Y(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/Y(a,r)))}else this.shape===`sphere`&&(r=Math.cos(n),i=Math.cos(t)*r,a=Math.sin(t)*r,o=Math.sin(n),r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/Y(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/Y(a,r))));return e.x*=this.a,e.y*=this.a,e}function io(e){var t=-1,n=0,r=0,i,a,o,s;if(e.x/=this.a,e.y/=this.a,this.shape===`ellipse`){this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Y(1,r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Y(1,n));var c=r/this.radius_p;if(i=n*n+c*c+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===`sphere`){if(this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+r*r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+n*n)),i=n*n+r*r+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t)}return e.x+=this.long0,e}var ao={init:no,forward:ro,inverse:io,names:[`Geostationary Satellite View`,`Geostationary_Satellite`,`geos`]},oo=1.340264,so=-.081106,co=893e-6,lo=.003796,uo=Math.sqrt(3)/2;function fo(){this.long0=this.long0===void 0?0:this.long0,this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.es!==0&&(this.apa=mi(this.es),this.qp=si(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function po(e){var t=q(e.x-this.long0,this.over),n=e.y,r=Math.sin(n);this.es!==0&&(r=si(this.e,r)/this.qp);var i=Math.asin(uo*r),a=i*i,o=a*a*a;return e.x=t*Math.cos(i)/(uo*(oo+3*so*a+o*(7*co+9*lo*a))),e.y=i*(oo+so*a+o*(co+lo*a)),this.es!==0&&(e.x*=this.rqda,e.y*=this.rqda),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function mo(e){e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,this.es!==0&&(e.x/=this.rqda,e.y/=this.rqda);for(var t=1e-9,n=12,r=e.y,i,a,o,s,c,l=0;l<n&&(i=r*r,a=i*i*i,o=r*(oo+so*i+a*(co+lo*i))-e.y,s=oo+3*so*i+a*(7*co+9*lo*i),r-=c=o/s,!(Math.abs(c)<t));++l);return i=r*r,a=i*i*i,e.x=uo*e.x*(oo+3*so*i+a*(7*co+9*lo*i))/Math.cos(r),e.y=Math.asin(Math.sin(r)/uo),this.es!==0&&(e.y=hi(e.y,this.apa)),e.x=q(e.x+this.long0,this.over),e}var ho={init:fo,forward:po,inverse:mo,names:[`eqearth`,`Equal Earth`,`Equal_Earth`]},go=1e-10;function _o(){var e;if(this.phi1=this.lat1,Math.abs(this.phi1)<go)throw Error();this.es?(this.en=Jn(this.es),this.m1=Yn(this.phi1,this.am1=Math.sin(this.phi1),e=Math.cos(this.phi1),this.en),this.am1=e/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=yo,this.forward=vo):(this.cphi1=Math.abs(this.phi1)+go>=z?0:1/Math.tan(this.phi1),this.inverse=xo,this.forward=bo)}function vo(e){var t=q(e.x-(this.long0||0),this.over),n=e.y,r=this.am1+this.m1-Yn(n,i=Math.sin(n),a=Math.cos(n),this.en),i=a*t/(r*Math.sqrt(1-this.es*i*i)),a;return e.x=r*Math.sin(i),e.y=this.am1-r*Math.cos(i),e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function yo(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n=Y(e.x,e.y=this.am1-e.y),r,i=Zn(this.am1+this.m1-n,this.es,this.en);if((t=Math.abs(i))<z)t=Math.sin(i),r=n*Math.atan2(e.x,e.y)*Math.sqrt(1-this.es*t*t)/Math.cos(i);else if(Math.abs(t-z)<=go)r=0;else throw Error();return e.x=q(r+(this.long0||0),this.over),e.y=ti(i),e}function bo(e){var t=q(e.x-(this.long0||0),this.over),n=e.y,r,i=this.cphi1+this.phi1-n;return Math.abs(i)>go?(e.x=i*Math.sin(r=t*Math.cos(n)/i),e.y=this.cphi1-i*Math.cos(r)):e.x=e.y=0,e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function xo(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n,r=Y(e.x,e.y=this.cphi1-e.y);if(n=this.cphi1+this.phi1-r,Math.abs(n)>z)throw Error();return t=Math.abs(Math.abs(n)-z)<=go?0:r*Math.atan2(e.x,e.y)/Math.cos(n),e.x=q(t+(this.long0||0),this.over),e.y=ti(n),e}var So={init:_o,names:[`bonne`,`Bonne (Werner lat_1=90)`]},Co={OBLIQUE:{forward:ko,inverse:jo},TRANSVERSE:{forward:Ao,inverse:Mo}},wo={ROTATE:{o_alpha:`oAlpha`,o_lon_c:`oLongC`,o_lat_c:`oLatC`},NEW_POLE:{o_lat_p:`oLatP`,o_lon_p:`oLongP`},NEW_EQUATOR:{o_lon_1:`oLong1`,o_lat_1:`oLat1`,o_lon_2:`oLong2`,o_lat_2:`oLat2`}};function To(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||`General Oblique Transformation`,this.isIdentity=ct.includes(this.o_proj),!this.o_proj)throw Error(`Missing parameter: o_proj`);if(this.o_proj===`ob_tran`)throw Error(`Invalid value for o_proj: `+this.o_proj);let e=Bt(this.projStr.replace(`+proj=ob_tran`,``).replace(`+o_proj=`,`+proj=`).trim());if(!e)throw Error(`Invalid parameter: o_proj. Unknown projection `+this.o_proj);e.long0=0,this.obliqueProjection=e;let t,n=Object.keys(wo),r=e=>{if(this[e]===void 0)return;let t=parseFloat(this[e])*V;if(isNaN(t))throw Error(`Invalid value for `+e+`: `+this[e]);return t};for(let e=0;e<n.length;e++){let i=wo[n[e]],a=Object.entries(i);if(a.some(([e])=>this[e]!==void 0)){t=i;for(let e=0;e<a.length;e++){let[t,n]=a[e],i=r(t);if(i===void 0)throw Error(`Missing parameter: `+t+`.`);this[n]=i}break}}if(!t)throw Error(`No valid parameters provided for ob_tran projection.`);let{lamp:i,phip:a}=Oo(this,t);this.lamp=i,Math.abs(a)>1e-10?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=Co.OBLIQUE):this.projectionType=Co.TRANSVERSE}function Eo(e){return this.projectionType.forward(this,e)}function Do(e){return this.projectionType.inverse(this,e)}function Oo(e,t){let n,r;if(t===wo.ROTATE){let t=e.oLongC,i=e.oLatC,a=e.oAlpha;if(Math.abs(Math.abs(i)-z)<=1e-10)throw Error(`Invalid value for o_lat_c: `+e.o_lat_c+` should be < 90°`);r=t+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(i)),n=Math.asin(Math.cos(i)*Math.sin(a))}else if(t===wo.NEW_POLE)r=e.oLongP,n=e.oLatP;else{let t=e.oLong1,i=e.oLat1,a=e.oLong2,o=e.oLat2,s=Math.abs(i);if(Math.abs(i)>z-1e-10)throw Error(`Invalid value for o_lat_1: `+e.o_lat_1+` should be < 90°`);if(Math.abs(o)>z-1e-10)throw Error(`Invalid value for o_lat_2: `+e.o_lat_2+` should be < 90°`);if(Math.abs(i-o)<1e-10)throw Error(`Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2`);if(s<1e-10)throw Error(`Invalid value for o_lat_1: o_lat_1 should be different from zero`);r=Math.atan2(Math.cos(i)*Math.sin(o)*Math.cos(t)-Math.sin(i)*Math.cos(o)*Math.cos(a),Math.sin(i)*Math.cos(o)*Math.sin(a)-Math.cos(i)*Math.sin(o)*Math.sin(t)),n=Math.atan(-1*Math.cos(r-t)/Math.tan(i))}return{lamp:r,phip:n}}function ko(e,t){let{x:n,y:r}=t;n=q(n-e.long0,e.over);let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=q(Math.atan2(o*Math.sin(n),e.sphip*o*i+e.cphip*a)+e.lamp),t.y=Math.asin(e.sphip*a-e.cphip*o*i);let s=e.obliqueProjection.forward(t);return e.isIdentity&&(s.x*=H,s.y*=H),s}function Ao(e,t){let{x:n,y:r}=t;n=q(n-e.long0,e.over);let i=Math.cos(r),a=Math.cos(n);t.x=q(Math.atan2(i*Math.sin(n),Math.sin(r))+e.lamp),t.y=Math.asin(-1*i*a);let o=e.obliqueProjection.forward(t);return e.isIdentity&&(o.x*=H,o.y*=H),o}function jo(e,t){e.isIdentity&&(t.x*=V,t.y*=V);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n<Number.MAX_VALUE){n-=e.lamp;let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=Math.atan2(o*Math.sin(n),e.sphip*o*i-e.cphip*a),t.y=Math.asin(e.sphip*a+e.cphip*o*i)}return t.x=q(t.x+e.long0),t}function Mo(e,t){e.isIdentity&&(t.x*=V,t.y*=V);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n<Number.MAX_VALUE){let i=Math.cos(r);n-=e.lamp,t.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),t.y=Math.asin(i*Math.cos(n))}return t.x=q(t.x+e.long0),t}var No={init:To,forward:Eo,inverse:Do,names:[`General Oblique Transformation`,`General_Oblique_Transformation`,`ob_tran`]};function Po(e){e.Proj.projections.add(tr),e.Proj.projections.add(fr),e.Proj.projections.add(gr),e.Proj.projections.add(Er),e.Proj.projections.add(jr),e.Proj.projections.add(Fr),e.Proj.projections.add(Vr),e.Proj.projections.add(Gr),e.Proj.projections.add(Yr),e.Proj.projections.add(oi),e.Proj.projections.add(yi),e.Proj.projections.add(Ti),e.Proj.projections.add(ki),e.Proj.projections.add(Pi),e.Proj.projections.add(Ri),e.Proj.projections.add(Ui),e.Proj.projections.add(qi),e.Proj.projections.add(Zi),e.Proj.projections.add(na),e.Proj.projections.add(ia),e.Proj.projections.add(ca),e.Proj.projections.add(fa),e.Proj.projections.add(ga),e.Proj.projections.add(Sa),e.Proj.projections.add(Ea),e.Proj.projections.add(Ma),e.Proj.projections.add(Ka),e.Proj.projections.add(Xa),e.Proj.projections.add(to),e.Proj.projections.add(ao),e.Proj.projections.add(ho),e.Proj.projections.add(So),e.Proj.projections.add(No)}var Fo=Object.assign(un,{defaultDatum:`WGS84`,Proj:Bt,WGS84:new Bt(`WGS84`),Point:Fn,toPoint:en,defs:K,nadgrid:Et,transform:on,mgrs:vn,version:`__VERSION__`});Po(Fo);var Io=Math.PI/180,Lo=85.0511287798066;function Ro(e,t,n){let r=2**n,i=Math.max(-85.0511287798066,Math.min(Lo,t));return{x:(e+180)/360*r,y:(1-Math.asinh(Math.tan(i*Io))/Math.PI)/2*r}}function zo(e,t,n){let r=2**n;return{longitude:e/r*360-180,latitude:Math.atan(Math.sinh(Math.PI*(1-2*t/r)))/Io}}function Bo(e,t,r){if(e.isEmpty())throw Error(`模型没有可用于确定地图范围的几何`);for(let e of[t.localMatrix,t.ecefMatrix])if(e?.length!==16||!e.every(Number.isFinite))throw Error(`GIS 配准矩阵必须包含 16 个有限数值`);let i=new n.Matrix4().fromArray(t.localMatrix),a=new n.Matrix4().fromArray(t.ecefMatrix);if(Math.abs(i.determinant())<1e-20||Math.abs(a.determinant())<1e-20)throw Error(`GIS 配准矩阵不可逆`);let o=i.clone().invert(),s=a.clone().multiply(o),c=s.clone().invert(),l=t.sourceCrs===`EPSG:4326`?`WGS84`:`GRS80`,u=Fo(`+proj=longlat +ellps=${l} +no_defs`,`+proj=geocent +ellps=${l} +units=m +no_defs`),d=e.clone().applyMatrix4(i);d.min.x-=1e3,d.min.y-=1e3,d.max.x+=1e3,d.max.y+=1e3;let f=[[d.min.x,d.min.y],[d.min.x,d.max.y],[d.max.x,d.min.y],[d.max.x,d.max.y]].map(([e,t])=>{let r=new n.Vector3(e,t,0).applyMatrix4(s),[i,a]=u.inverse(r.toArray());return{longitude:i,latitude:a}});if(Math.max(...f.map(e=>e.longitude))-Math.min(...f.map(e=>e.longitude))>180)throw Error(`当前局部影像层不支持跨越日期变更线的范围`);let p=[];for(let e=16;e>=0;e--){let t=f.map(t=>Ro(t.longitude,t.latitude,e)),n=2**e-1,r=e=>Math.max(0,Math.min(n,Math.floor(e))),i=r(Math.min(...t.map(e=>e.x))),a=r(Math.max(...t.map(e=>e.x))),o=r(Math.min(...t.map(e=>e.y))),s=r(Math.max(...t.map(e=>e.y)));if(!((a-i+1)*(s-o+1)>256)){for(let t=o;t<=s;t++)for(let n=i;n<=a;n++)p.push({x:n,y:t,zoom:e});break}}let m=(e,t,i=0,a=!1)=>{let s=new n.Vector3(...u.forward([e,t,a?i:0])).applyMatrix4(c);return a||(s.z=i),s.applyMatrix4(o).add(r)},h=new n.Box3;for(let e of p)for(let[t,n]of[[0,0],[0,1],[1,0],[1,1]]){let r=zo(e.x+t,e.y+n,e.zoom);h.expandByPoint(m(r.longitude,r.latitude))}return{tiles:p,project:m,bounds:h,reference:t.reference,heightResolved:t.heightResolved}}function Vo(e,t){let r=new n.PlaneGeometry(1,1,8,8),i=r.getAttribute(`position`),a=r.getAttribute(`uv`);for(let n=0;n<i.count;n++){let r=zo(e.x+a.getX(n),e.y+1-a.getY(n),e.zoom),o=t(r.longitude,r.latitude);i.setXYZ(n,o.x,o.y,o.z)}return r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}function Ho(){let e=new AbortController,t=[],n=0,r=()=>new DOMException(`地图请求已取消`,`AbortError`);function i(){for(;!e.signal.aborted&&n<6&&t.length;){let{task:r,resolve:a,reject:o}=t.shift();n++;let s=AbortSignal.any([e.signal,AbortSignal.timeout(15e3)]);Promise.resolve().then(()=>r(s)).then(a,o).finally(()=>{n--,i()})}}return{get stopped(){return e.signal.aborted},run(n){return e.signal.aborted?Promise.reject(r()):new Promise((e,r)=>{t.push({task:n,resolve:e,reject:r}),i()})},dispose(){e.abort(),t.splice(0).forEach(({reject:e})=>e(r()))}}}async function Uo(e,t){if(!e)throw Error(`地图服务返回空数据`);let n=e.getReader(),r=[],i=0;try{for(;;){let{value:e,done:a}=await n.read();if(a)break;if(i+=e.byteLength,i>t)throw Error(`地图数据超过大小限制`);r.push(e)}}catch(e){throw await n.cancel().catch(()=>{}),e}finally{n.releaseLock()}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.byteLength;return a}var Wo=150,Go=12,Ko=67108864;async function qo(e){if(e.length<2||e[0]!==120||((e[0]<<8)+e[1])%31)throw Error(`天地图 DEM 不是受支持的 zlib 高程栅格`);if(typeof DecompressionStream>`u`)throw Error(`当前浏览器不支持 DEM 解压`);let t=await Uo(new Blob([e]).stream().pipeThrough(new DecompressionStream(`deflate`)),45e3);if(t.byteLength!==45e3)throw Error(`天地图 DEM 栅格长度不正确`);let n=new DataView(t.buffer),r=new Float32Array(22500);for(let e=0;e<r.length;e++){let t=n.getUint16(e*2,!0);r[e]=t<=1e4?t:NaN}return r}function Jo(e,t,n){let r=2**n,i=(e+180)/360*r,a=(90-t)/360*r,o=(e,t)=>Math.max(0,Math.min(t,Math.ceil(e-1e-10)-1)),s=o(i,r-1),c=o(a,r/2-1);return{x:s,y:c,level:n,u:Math.max(0,Math.min(1,i-s)),v:Math.max(0,Math.min(1,a-c))}}function Yo(e,t,n){let r=Math.max(0,Math.min(149,t*149)),i=Math.max(0,Math.min(149,n*149)),a=Math.min(148,Math.floor(r)),o=Math.min(148,Math.floor(i)),s=r-a,c=i-o,l=o*Wo+a,u=s+c<=1?[[e[l],1-s-c],[e[l+1],s],[e[l+Wo],c]]:[[e[l+Wo+1],s+c-1],[e[l+Wo],1-s],[e[l+1],1-c]],d=0;for(let[e,t]of u)if(!(t<=1e-12)){if(!Number.isFinite(e))throw Error(`DEM 采样点缺少有效高程`);d+=e*t}return d}function Xo(e,t,n,r){let i=Math.min(Go,e.tiles[0].zoom);if(i<6)throw Error(`当前地图范围过大,DEM 仅支持影像级别 6 及以上`);if(t.mode===`absolute`&&(!e.heightResolved||typeof t.toEllipsoidHeight!=`function`))throw Error(`真实高程模式需要可靠高程配准和 toEllipsoidHeight 转换函数`);let a=new Map,o=0,s=!1,c;function l(){for(let[e,t]of a){if(o<=Ko)break;!t.refs&&t.data&&(o-=t.data.byteLength,a.delete(e))}}function u(e){let t=`${e.x}/${e.y}`,c=a.get(t);return c?(a.delete(t),a.set(t,c)):(c={refs:0},a.set(t,c),c.promise=r.run(async t=>{let r=new URL(`https://t0.tianditu.gov.cn/mapservice/swdx`);r.search=new URLSearchParams({T:`elv_c`,tk:n,x:e.x,y:e.y,l:i});let a=await fetch(r,{signal:t});if(!a.ok)throw Error(`DEM 请求失败`);let u=await qo(await Uo(a.body,1048576));if(s||t.aborted)throw Error(`DEM 请求已取消`);return c.data=u,o+=u.byteLength,l(),u})),c.refs++,{promise:c.promise,release(){c.refs--,l()}}}async function d(e,t){let n=Jo(e,t,i),r=u(n);try{return Yo(await r.promise,n.u,n.v)}finally{r.release()}}return{async prepare(n){t.mode!==`absolute`&&(c??=d(e.reference.longitude,e.reference.latitude).catch(()=>{throw Error(`DEM 基准高程获取失败,整层保持平面影像`)}));let r=c?await c:0;if(s)throw Error(`DEM 已关闭`);let a=[],o=new Map;try{for(let e=0;e<=32;e++)for(let t=0;t<=32;t++){let r=zo(n.x+t/32,n.y+e/32,n.zoom),s=Jo(r.longitude,r.latitude,i),c=`${s.x}/${s.y}`;o.has(c)||o.set(c,u(s)),a.push({...r,...s,id:c})}let e=await Promise.all([...o].map(async([e,t])=>[e,await t.promise]));if(s)throw Error(`DEM 已关闭`);let c=new Map(e),l=new Float64Array(a.length);return a.forEach((e,n)=>{let i=Yo(c.get(e.id),e.u,e.v);if(t.mode===`absolute`){let r;try{r=t.toEllipsoidHeight({longitude:e.longitude,latitude:e.latitude,height:i})}catch{throw Error(`DEM 高程基准转换失败`)}if(typeof r!=`number`||!Number.isFinite(r))throw Error(`DEM 高程转换必须返回有限的椭球高`);l[n]=r}else l[n]=i-r}),l}finally{o.forEach(e=>e.release())}},dispose(){s=!0,a.clear(),o=0}}}function Zo(e,t,r,i){let a=[],o=[],s=[],c=[];for(let n=0;n<=32;n++)for(let l=0;l<=32;l++){let u=zo(e.x+l/32,e.y+n/32,e.zoom);c.push(u);let d=t.project(u.longitude,u.latitude,r[n*33+l],i);if(a.push(d.x,d.y,d.z),o.push(l/32,1-n/32),n<32&&l<32){let e=n*33+l;s.push(e,e+33,e+1,e+1,e+33,e+34)}}let l=[Array.from({length:33},(e,t)=>t),Array.from({length:33},(e,t)=>t*33+32),Array.from({length:33},(e,t)=>1088-t),Array.from({length:33},(e,t)=>(32-t)*33)],u=l.map(e=>e.map(e=>{let t=a.length/3;return a.push(...a.slice(e*3,e*3+3),...a.slice(e*3,e*3+3)),o.push(...o.slice(e*2,e*2+2),...o.slice(e*2,e*2+2)),t})),d=s.length;for(let e of u)for(let t=0;t<32;t++){let n=e[t],r=e[t+1];s.push(n,n+1,r,r,n+1,r+1)}let f=new n.BufferGeometry;f.setAttribute(`position`,new n.Float32BufferAttribute(a,3)),f.setAttribute(`uv`,new n.Float32BufferAttribute(o,2)),f.setIndex(s);let p={geometry:f,edges:l.map(e=>e.map(e=>r[e])),neighbors:[],updateSkirts(e={}){Object.assign(p.neighbors,e);let n=f.getAttribute(`position`);l.forEach((e,a)=>{let o=p.edges[a],l=p.neighbors[a]?.slice().reverse(),m=Math.max(0,...o.map((e,t)=>Math.abs(e-(l?.[t]??0))))+10,h=l&&o.every((e,t)=>Math.abs(e-l[t])<1e-6),g=d+a*32*6;for(let e=g;e<g+192;e++)f.index.setX(e,h?0:s[e]);e.forEach((e,o)=>{let s=c[e],l=t.project(s.longitude,s.latitude,r[e]-m,i);n.setXYZ(u[a][o]+1,l.x,l.y,l.z)})}),n.needsUpdate=!0,f.index.needsUpdate=!0,f.computeVertexNormals(),f.computeBoundingBox(),f.computeBoundingSphere()}};return p.updateSkirts(),p}var Qo=class extends e.s{get manager(){return this.localManager??=new e.i}async updateMaterial(e,t){let n,r={...e,source:this.imgSource[0]};r.created=e=>n=e;try{n=await this.images.load(r),this.stopped?n.dispose():(n.opacity=this.imgSource[0].opacity,n.map.needsUpdate=!0,t.syncMaterials([n]))}catch{throw n?.dispose(),Error(`影像加载失败,请检查天地图 Key、网络、跨域或服务权限`)}return!0}async updateGeometry(e,t){return this.stopped||t.setGeometry(Vo({...e,zoom:e.z},this.project)),!0}},$o=class extends e.t{createMaterial(e){let t=super.createMaterial(e);return e.created(t),t}};function es(e){e.removeFromParent(),e.geometry.dispose(),e.material.forEach(e=>e.dispose()),e.material.length=0}var ts=class extends e.n{addEventListener(e,t){(this.listeners??=[]).push([e,t]),super.addEventListener(e,t)}constructor(e,t,r,i,a){super(),this.plan=e,this.onStatus=t,this.invalidate=r,this.content=new n.Group,this.add(this.content),this.cursor=this.loaded=this.failed=0,this.pending=new Set,this.stopped=!1,this.terrainOptions=i,this.onTerrainStatus=a,this.terrainLoaded=this.terrainFailed=0,this.terrainMeshes=new Map}emitTerrain(e=this.terrainMessage){if(this.stopped)return;let t=this.terrainOptions?.enabled,n=t?this.plan.tiles.length:0,r=this.terrainLoaded+this.terrainFailed===n;this.onTerrainStatus?.({status:t?r?this.terrainFailed?this.terrainLoaded?`partial`:`error`:`ready`:`loading`:`disabled`,mode:this.terrainOptions?.mode===`absolute`?`absolute`:`relative`,loaded:this.terrainLoaded,failed:this.terrainFailed,total:n,...e||this.terrainFailed?{message:e||`DEM 加载或采样失败,对应瓦片保留平面影像;请检查天地图权限、覆盖范围和网络`}:{}})}prepareTerrain(e,t){this.terrain&&!this.stopped&&this.terrain.prepare(e).then(n=>{if(!this.stopped){if(t.parent){let r=Zo(e,this.plan,n,this.terrainOptions.mode===`absolute`),i=`${e.x}/${e.y}`;this.terrainMeshes.set(i,r),t.setGeometry(r.geometry),t.syncGroups();let a=[[e.x,e.y-1],[e.x+1,e.y],[e.x,e.y+1],[e.x-1,e.y]].map(([e,t])=>this.terrainMeshes.get(`${e}/${t}`));r.updateSkirts(a.map((e,t)=>e?.edges[(t+2)%4])),this.plan.bounds.union(r.geometry.boundingBox),a.forEach((e,t)=>{if(!e)return;let n=(t+2)%4;e.updateSkirts({[n]:r.edges[t]}),this.plan.bounds.union(e.geometry.boundingBox)})}this.terrainLoaded++,this.emitTerrain(),this.invalidate()}}).catch(e=>{if(this.stopped)return;this.terrainFailed++;let t={"DEM 基准高程获取失败,整层保持平面影像":`DEM 基准高程获取失败,整层保持平面影像`,"DEM 采样点缺少有效高程":`天地图 DEM 在部分采样位置缺测,对应瓦片保留平面影像`,"DEM 高程基准转换失败":`DEM 高程基准转换失败,对应瓦片保留平面影像`,"DEM 高程转换必须返回有限的椭球高":`DEM 高程转换必须返回有限的椭球高,对应瓦片保留平面影像`};this.terrainMessage=t[e?.message]||this.terrainMessage,this.emitTerrain(this.terrainMessage),this.invalidate()})}emit(){if(this.stopped)return;let e=this.plan.tiles.length,t=this.loaded+this.failed===e;this.onStatus({status:t?this.failed?this.loaded?`partial`:`error`:`ready`:`loading`,loaded:this.loaded,failed:this.failed,total:e,...this.failed?{message:`影像加载失败,请检查天地图 Key、网络、跨域或服务权限`}:{}})}update({loader:t}){if(!this.stopped)for(;this.pending.size<t.maxThreads&&this.cursor<this.plan.tiles.length;){let n=this.plan.tiles[this.cursor++],r=new e.o;this.pending.add(r),t.update({x:n.x,y:n.y,z:n.zoom},r).then(()=>{this.stopped||(this.content.add(r),this.loaded++)}).catch(()=>{this.stopped||this.failed++}).finally(()=>{this.pending.delete(r),(this.stopped||!r.parent)&&es(r),this.stopped||(this.prepareTerrain(n,r),this.emit(),this.invalidate())})}}reload(e=!0){return e&&this.content.children.slice().forEach(es),this}};function ns(t,r,i=.65,a,o,s,c){let l=Ho(),u=new Qo;u.project=t.project,u.images=new $o,u.images.loader.manager=u.manager,u.images.loader.loadAsync=e=>l.run(async t=>{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`影像请求失败`);let r=await createImageBitmap(await n.blob(),{imageOrientation:`flipY`,premultiplyAlpha:`none`,colorSpaceConversion:`none`});if(l.stopped||t.aborted)throw r.close(),Error(`影像请求已取消`);return r}),u.images.material=new n.MeshBasicMaterial({transparent:!0,side:n.DoubleSide,depthWrite:!1,toneMapped:!1});let d=new ts(t,a,o,s,c);if(s?.enabled)try{if(![`relative`,`absolute`].includes(s.mode??`relative`))throw Error(`DEM 模式必须为 relative 或 absolute`);let e=s.key??r;if(!e?.trim())throw Error(`请配置天地图 DEM Key`);d.terrain=Xo(t,s,e,l)}catch(e){d.terrainFailed=t.tiles.length,d.emitTerrain(e.message)}let f=new n.Group;f.name=`GIS imagery`;let p;return Promise.resolve().then(()=>require("./plugin-Cs6eHojx.cjs")).then(({TDTSource:n})=>{if(d.stopped)return;let a=new n({token:r,style:`img_w`,minLevel:t.tiles[0].zoom,maxLevel:t.tiles[0].zoom,opacity:i,transparent:!0});p=e.a.create({loader:u,rootTile:d,imgSource:a}),p.autoUpdate=!1,p.updateInterval=0,p.maxThreads=6,d.scale.set(1,1,1),d.updateMatrixWorld(!0),f.add(p),o()}).catch(()=>{d.stopped||(d.failed=t.tiles.length,d.emit(),s?.enabled&&!d.terrainFailed&&(d.terrainFailed=t.tiles.length,d.emitTerrain(`地图初始化失败,无法准备 DEM`)),o())}),d.emit(),d.terrainFailed||d.emitTerrain(),{root:f,bounds:t.bounds,update(e){d.stopped||p?.update(e)},setOpacity(e){d.stopped||(i=e,p&&(p.imgSource[0].opacity=e),d.content.children.forEach(t=>{t.material.forEach(t=>t.opacity=e)}),o())},dispose(){if(!d.stopped){d.stopped=u.stopped=!0,l.dispose(),d.terrain?.dispose(),d.terrainMeshes.clear(),f.removeFromParent(),p?.dispose(),d.listeners?.forEach(([e,t])=>d.removeEventListener(e,t)),d.listeners=[],u.images.material.dispose(),u._errorMaterial.dispose();for(let e of[`onStart`,`onLoad`,`onProgress`,`onError`,`onParseEnd`])u.manager[e]=void 0;f.clear()}}}}function rs(e,t,r,c,l,u,d){let f=new n.Scene,p=new n.PerspectiveCamera(42,1,.01,1e5),m=new n.WebGLRenderer({antialias:!0});m.outputColorSpace=n.SRGBColorSpace,m.setPixelRatio(Math.min(window.devicePixelRatio,2)),m.domElement.setAttribute(`aria-label`,`三维模型:拖动旋转,滚轮缩放,右键平移`),m.domElement.setAttribute(`role`,`img`),e.appendChild(m.domElement);let h=new i.OrbitControls(p,m.domElement);h.enableDamping=!0,h.dampingFactor=.09;let g=A(p,h),_=ee(p,h,g);h.addEventListener(`start`,g.cancel),f.add(new n.HemisphereLight(`#e5efff`,`#758096`,2.6));let v=new n.DirectionalLight(`#fff2dc`,2.7);v.position.set(3,6,5),f.add(v);let y=new n.DirectionalLight(`#a0c7ff`,1.5);y.position.set(-4,1,-2),f.add(y);let b=new a.EffectComposer(m),x=new s.RenderPass(f,p),S=k(f,p),C=new o.OutputPass;b.addPass(x),b.addPass(S.pass),b.addPass(C);let w,E,D,O=[],j=0,M=0,N=0,P=!1,F={},I,ne=``,re,L=!1,R,z=!0,ie=T(f,B,l);function ae(){I?.dispose(),I=void 0,ne=``,re=void 0}function oe(){if(!I)return;let e=I.bounds,t=p.position.distanceTo(e.getCenter(new n.Vector3))+e.getSize(new n.Vector3).length();p.far<t&&(p.far=t,p.updateProjectionMatrix())}function B(){!N&&!P&&(N=requestAnimationFrame(V))}function V(e){if(N=0,P)return;let n=g.update(e);if(h.update(),L&&w&&(!R||!p.quaternion.equals(R))){R=p.quaternion.clone();let{x:e,y:t,z:n,w:r}=R;u?.({x:e,y:t,z:n,w:r})}oe(),I?.update(p),S.render(E,D,e=>{e?b.render():m.render(f,p)}),w&&E&&D&&t(te(O,E,D,w.offset,p,j,M)),n&&B()}h.addEventListener(`change`,B);function H(){let t=e.getBoundingClientRect();t.width&&t.height&&(t.width!==j||t.height!==M)&&(j=t.width,M=t.height,m.setSize(j,M,!1),b.setSize(j,M),p.aspect=j/M,p.updateProjectionMatrix(),ie.resize(j,M),B())}let U=new ResizeObserver(H);U.observe(e),H();let se=e=>{e.preventDefault(),z=!1,g.cancel(),P||r()};m.domElement.addEventListener(`webglcontextlost`,se);function W(e,t,r){let i=new n.Box3().setFromObject(e,!0);if(i.isEmpty()){let t=e.getWorldPosition(new n.Vector3);i=new n.Box3().setFromCenterAndSize(t,new n.Vector3(10,10,10))}let a=Math.max(i.getSize(new n.Vector3).length()/2,.01),o=i.getCenter(new n.Vector3),s=F.direction||{x:1.15,y:.72,z:1.35},c=t?new n.Vector3(s.x,s.y,s.z):p.position.clone().sub(h.target);c.toArray().every(Number.isFinite)&&c.lengthSq()||(c=new n.Vector3(1.15,.72,1.35)),c.normalize();let l=Math.min(p.fov*Math.PI/180,2*Math.atan(Math.tan(p.fov*Math.PI/360)*p.aspect)),u=Number.isFinite(F.fitPadding)&&(F.fitPadding||0)>0?F.fitPadding:1.35,d=a/Math.tan(l/2)*u,f=g.moveTo({position:o.clone().addScaledVector(c,d),target:o,near:Math.max(a/1e4,.001),far:d+a*30,minDistance:Math.max(a/1e3,.01),maxDistance:d*10},r);return f&&B(),f}return{setBackground(e){ie.set(e)},show(e,t,n,r={}){ae(),c({status:`disabled`,loaded:0,failed:0,total:0}),d?.({status:`disabled`,mode:`relative`,loaded:0,failed:0,total:0}),w?.root.removeFromParent(),S.select(null),w=e,E=t,D=n,F=r,R=void 0,f.add(e.root),m.renderLists.dispose(),W(e.root,!0,{duration:0})},setGis(e){if(!P){if(!w||!e?.enabled)ae(),c({status:`disabled`,loaded:0,failed:0,total:0}),d?.({status:`disabled`,mode:e?.terrain?.mode??`relative`,loaded:0,failed:0,total:0}),B();else try{let t=e.opacity??.65;if(!Number.isFinite(t)||t<0||t>1)throw Error(`地图透明度必须是 0–1 的数值`);if(!e.imagery?.key?.trim())throw Error(`请在宿主配置天地图 Key`);let r=e.placement,i=JSON.stringify([r.sourceCrs,r.reference,r.localMatrix,r.ecefMatrix,e.imagery.key,r.heightResolved,e.terrain?.enabled??!1,e.terrain?.enabled?e.terrain.mode??`relative`:null,e.terrain?.enabled?e.terrain.key??null:null]),a=e.terrain?.enabled?e.terrain.toEllipsoidHeight:void 0;if(I&&ne===i&&re===a){I.setOpacity(t);return}ae(),I=ns(Bo(new n.Box3().setFromObject(w.root,!0).translate(w.offset.clone().negate()),r,w.offset),e.imagery.key,t,c,B,e.terrain?{...e.terrain}:void 0,d),ne=i,re=a,f.add(I.root),oe(),B()}catch(t){ae(),c({status:`error`,loaded:0,failed:0,total:0,message:t instanceof Error?t.message:`地图配置无效`}),d?.({status:e.terrain?.enabled?`error`:`disabled`,mode:e.terrain?.mode??`relative`,loaded:0,failed:0,total:0,...e.terrain?.enabled?{message:`地图配置无效,无法准备 DEM`}:{}}),B()}}},setMarkers(e){O=e,B()},select(e){S.select(e),B()},focus(e,t){return W(e,!1,t)},reset(e){return w&&!P&&z?W(w.root,!0,e):!1},setNavigationVisible(e){P||L===e||(L=e,R=void 0,e&&B())},setViewDirection(e,t){if(!w||P||!z)return!1;let n=_.setViewDirection(e,t);return n&&B(),n},navigate(e,t){if(!w||P||!z)return!1;let n=_.navigate(e,t);return n&&B(),n},pick(e,t){if(!w)return null;let r=m.domElement.getBoundingClientRect(),i=new n.Raycaster;return i.setFromCamera(new n.Vector2((e-r.left)/r.width*2-1,-(t-r.top)/r.height*2+1),p),i.intersectObject(w.root,!0).find(e=>{let t=E?.byObject.get(e.object);return t&&D?.get(t)?.effective.visible&&(D.get(t)?.effective.opacity||0)>0})?.object||null},refresh:B,dispose(){P=!0,g.cancel(),ae(),ie.dispose(),cancelAnimationFrame(N),U.disconnect(),h.removeEventListener(`change`,B),h.removeEventListener(`start`,g.cancel),h.dispose(),m.domElement.removeEventListener(`webglcontextlost`,se),S.dispose(),C.dispose(),b.dispose(),m.dispose(),m.forceContextLoss(),m.domElement.remove(),w=void 0,E=void 0,D=void 0}}}var is=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},as=[`innerHTML`],os=is({__name:`SvgIcon`,props:{source:{type:String,required:!0}},setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{class:`mv-svg-icon`,"aria-hidden":`true`,innerHTML:e.source},null,8,as))}},[[`__scopeId`,`data-v-1bcb7ca3`]]),ss=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
6
+ <path d="M2 11 12 2l10 9h-4v10h-4v-7h-4v7H6V11Z" />
7
+ </svg>
8
+ `,cs=[`disabled`],ls={__name:`HomeButton`,props:{disabled:{type:Boolean,default:!1}},emits:[`home`],setup(e){return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{type:`button`,class:`mv-navigation-home`,disabled:e.disabled,title:`主视角`,"aria-label":`Home:恢复初始全模型视角`,onClick:r[0]||=(0,t.withModifiers)(e=>n.$emit(`home`),[`stop`])},[(0,t.createVNode)(os,{source:(0,t.unref)(ss)},null,8,[`source`])],8,cs))}},us=[`data-direction`,`tabindex`,`aria-disabled`,`aria-label`,`onClick`,`onKeydown`,`onFocus`],ds=[`points`],fs=[`transform`],ps={__name:`ViewCube`,props:{orientation:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:[`navigate`,`restore-focus`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.computed)(()=>P(r.orientation)),o=(0,t.ref)(),s=(0,t.ref)(null);(0,t.watch)(a,async e=>{let n=s.value;n&&o.value?.contains(document.activeElement)&&(await(0,t.nextTick)(),o.value&&(e.some(e=>e.id===n)?o.value.querySelector(`[data-direction="${n}"]`)?.focus({preventScroll:!0}):i(`restore-focus`)))},{flush:`pre`});function c(e){r.disabled||i(`navigate`,e)}return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{ref_key:`cube`,ref:o,class:`mv-navigation-cube`,viewBox:`0 0 150 150`,role:`group`,"aria-label":`26方向视角骰子`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:n.id,class:(0,t.normalizeClass)([`mv-navigation-region`,`mv-navigation-${n.kind}`]),"data-direction":n.id,role:`button`,tabindex:e.disabled?-1:0,"aria-disabled":e.disabled,"aria-label":`${n.label}视角`,onClick:(0,t.withModifiers)(e=>c(n.id),[`stop`]),onKeydown:[(0,t.withKeys)((0,t.withModifiers)(e=>c(n.id),[`prevent`,`stop`]),[`enter`]),(0,t.withKeys)((0,t.withModifiers)(e=>c(n.id),[`prevent`,`stop`]),[`space`])],onFocus:e=>s.value=n.id,onBlur:r[0]||=e=>s.value=null},[(0,t.createElementVNode)(`title`,null,(0,t.toDisplayString)(n.label)+`视角`,1),(0,t.createElementVNode)(`polygon`,{points:n.points},null,8,ds),n.kind===`face`?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{key:0,transform:n.textTransform,"text-anchor":`middle`,"dominant-baseline":`central`,"aria-hidden":`true`},(0,t.toDisplayString)(n.label),9,fs)):(0,t.createCommentVNode)(``,!0)],42,us))),128))],512))}},ms={__name:`CameraNavigation`,props:{options:{type:Object},orientation:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:[`home`,`navigate`],setup(e){let n=e,r=(0,t.computed)(()=>F(n.options)),i=(0,t.ref)();return(n,a)=>r.value.height?((0,t.openBlock)(),(0,t.createElementBlock)(`nav`,{key:0,ref_key:`container`,ref:i,class:(0,t.normalizeClass)([`mv-navigation`,{"mv-navigation-home-only":!r.value.cube}]),tabindex:`-1`,"aria-label":`视角导航`,onPointerdown:a[3]||=(0,t.withModifiers)(()=>{},[`stop`]),onPointerup:a[4]||=(0,t.withModifiers)(()=>{},[`stop`]),onDblclick:a[5]||=(0,t.withModifiers)(()=>{},[`stop`]),onWheel:a[6]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`])},[r.value.cube?((0,t.openBlock)(),(0,t.createBlock)(ps,{key:0,orientation:e.orientation,disabled:e.disabled,onNavigate:a[0]||=e=>n.$emit(`navigate`,e),onRestoreFocus:a[1]||=e=>i.value?.focus({preventScroll:!0})},null,8,[`orientation`,`disabled`])):(0,t.createCommentVNode)(``,!0),r.value.home?((0,t.openBlock)(),(0,t.createBlock)(ls,{key:1,disabled:e.disabled,onHome:a[2]||=e=>n.$emit(`home`)},null,8,[`disabled`])):(0,t.createCommentVNode)(``,!0)],34)):(0,t.createCommentVNode)(``,!0)}},hs=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
9
+ <path d="M12 7v5M5 17v-5h14v5M12 12v5" />
10
+ <path fill="currentColor" stroke="none" d="M9 2h6v5H9zM2 17h6v5H2zM9 17h6v5H9zM16 17h6v5h-6z" />
11
+ </svg>
12
+ `,gs=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
13
+ <path d="m5 5 14 14M19 5 5 19" />
14
+ </svg>
15
+ `,_s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
16
+ <circle cx="10" cy="10" r="6" />
17
+ <path d="m15 15 5 5" />
18
+ </svg>
19
+ `,vs=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" focusable="false">
20
+ <path d="m6 3 5 5-5 5" />
21
+ </svg>
22
+ `,ys=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" focusable="false">
23
+ <path d="m10 1 8 4.5v9L10 19l-8-4.5v-9zM2 5.5l8 4.5 8-4.5M10 10v9" />
24
+ </svg>
25
+ `;function bs(e){let t=_(e),n=new Map(t.map(e=>[e.id,e])),r=new Map,i=(e,t)=>e.forEach((n,i)=>r.set(n.id,{depth:t,position:i+1,size:e.length}));i(e?.roots||[],0);for(let e of t)i(e.children,r.get(e.id).depth+1);return{nodes:t,byId:n,layout:r,roots:e?.roots||[]}}function xs(e,t){let n=t.trim().toLocaleLowerCase();if(!n)return null;let r=new Set,i=new Set;for(let t=e.nodes.length-1;t>=0;t--){let a=e.nodes[t];a.name.toLocaleLowerCase().includes(n)&&r.add(a.id),r.has(a.id)&&a.parentId&&(r.add(a.parentId),i.add(a.parentId))}return{included:r,expanded:i}}function Ss(e,t,n){let r=[],i=[...e.roots].reverse();for(;i.length;){let a=i.pop();if(n&&!n.included.has(a.id))continue;let o=a.children.filter(e=>!n||n.included.has(e.id));if(r.push({node:a,...e.layout.get(a.id),branch:o.length>0}),t.has(a.id))for(let e=o.length-1;e>=0;e--)i.push(o[e])}return r}function Cs(e,t){let n=new Map;for(let r=e.nodes.length-1;r>=0;r--){let i=e.nodes[r],a=+!!i.hasGeometry,o=i.hasGeometry&&t(i.id)?.effective.visible?1:0;for(let e of i.children){let t=n.get(e.id);a+=t.total,o+=t.shown}n.set(i.id,{total:a,shown:o,checked:a>0&&o===a,mixed:o>0&&o<a})}return n}function ws(e,t,n,r){let i=e.byId.get(t);if(!i)return[];let a=new Map;for(let e of _({roots:[i]}))a.set(e.id,n);if(n){let t=i;for(;t.parentId;){let n=e.byId.get(t.parentId);for(let e of n.children)e.id!==t.id&&!r(e.id)?.effective.visible&&a.set(e.id,!1);a.set(n.id,!0),t=n}}return[...a].map(([e,t])=>({id:e,patch:{visible:t}}))}var Ts=[`aria-expanded`,`aria-controls`],Es=[`id`],Ds={class:`mv-tree-search`},Os={key:0,class:`mv-tree-empty`,role:`status`},ks={key:1,class:`mv-tree-empty`,role:`status`},As=[`aria-level`,`aria-posinset`,`aria-setsize`,`aria-selected`,`aria-expanded`,`aria-checked`,`aria-label`],js=[`aria-label`,`onClick`],Ms={key:1,class:`mv-tree-spacer`},Ns={class:`mv-tree-check`},Ps=[`aria-label`,`checked`,`indeterminate`,`disabled`,`onChange`],Fs=[`title`,`onClick`],Is={class:`mv-tree-label`},Ls={key:3,class:`mv-tree-message`,role:`status`},Rs=is({__name:`ComponentTreePanel`,props:{enabled:{type:Boolean,default:!0},tree:{type:Object,default:null},selectedId:{type:String,default:null},selectionRevision:{type:Number,default:0},appearanceRevision:{type:Number,default:0},getAppearance:{type:Function,required:!0},loading:{type:Boolean,default:!1}},emits:[`select`,`visibility`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.useId)(),o=(0,t.ref)(!1),s=(0,t.ref)(``),c=(0,t.ref)(),l=(0,t.ref)(),u=(0,t.ref)(),d=(0,t.ref)(),f=(0,t.ref)(),p=(0,t.shallowRef)({left:16,top:16}),m=null,h,g=(0,t.shallowRef)(new Set),_=(0,t.shallowRef)(new Set),v=new Map,y=(0,t.computed)(()=>bs(r.tree)),b=(0,t.computed)(()=>xs(y.value,s.value)),x=(0,t.computed)(()=>b.value?_.value:g.value),S=(0,t.computed)(()=>Ss(y.value,x.value,b.value)),C=(0,t.computed)(()=>(r.appearanceRevision,Cs(y.value,r.getAppearance))),w=(0,t.computed)(()=>y.value.byId.get(r.selectedId)),T=(0,t.computed)(()=>w.value&&b.value&&!b.value.included.has(r.selectedId)?`选中构件不在搜索结果中`:w.value&&!w.value.bounds?`选中构件没有可定位几何`:``);(0,t.watch)(()=>r.tree,()=>{s.value=``,g.value=new Set(y.value.roots.map(e=>e.id)),_.value=new Set},{immediate:!0}),(0,t.watch)(b,e=>{_.value=new Set(e?.expanded)}),(0,t.watch)(()=>r.enabled,e=>{e||(N(),o.value=!1)}),(0,t.watch)([l,o],([e,t])=>{N(),h?.disconnect(),e&&t&&(h=new ResizeObserver(()=>{N(),A()}),h.observe(e))},{flush:`post`}),(0,t.onBeforeUnmount)(()=>{N(),h?.disconnect()}),(0,t.watch)([()=>r.selectedId,()=>r.selectionRevision,o],async()=>{if(!o.value||!w.value||b.value&&!b.value.included.has(r.selectedId))return;let e=new Set(x.value),n=w.value.parentId;for(;n;)e.add(n),n=y.value.byId.get(n)?.parentId;E(e),await(0,t.nextTick)();let i=v.get(r.selectedId),a=f.value;if(!i||!a)return;let s=i.getBoundingClientRect(),c=a.getBoundingClientRect();s.top<c.top?a.scrollTop-=c.top-s.top:s.bottom>c.bottom&&(a.scrollTop+=s.bottom-c.bottom)},{flush:`post`});function E(e){b.value?_.value=e:g.value=e}function D(e){let t=new Set(x.value);t.has(e)?t.delete(e):t.add(e),E(t)}async function O(){if(o.value)return k();o.value=!0,await(0,t.nextTick)(),A(),d.value?.focus()}async function k(){N(),o.value=!1,await(0,t.nextTick)(),c.value?.focus()}function A(e=p.value.left,t=p.value.top){if(!l.value||!u.value)return;let n=Math.max(16,l.value.clientWidth-u.value.offsetWidth-16),r=Math.max(16,l.value.clientHeight-u.value.offsetHeight-16);p.value={left:Math.min(n,Math.max(16,e)),top:Math.min(r,Math.max(16,t))}}function j(e){if(m||!e.isPrimary||e.button!==0)return;e.preventDefault();let t=l.value,n=t.getBoundingClientRect();m={id:e.pointerId,handle:e.currentTarget,x:e.clientX,y:e.clientY,left:p.value.left,top:p.value.top,scaleX:n.width/t.clientWidth||1,scaleY:n.height/t.clientHeight||1},m.handle.setPointerCapture(m.id)}function M(e){m&&m.id===e.pointerId&&A(m.left+(e.clientX-m.x)/m.scaleX,m.top+(e.clientY-m.y)/m.scaleY)}function N(e){if(!m||e&&e.pointerId!==m.id)return;let{handle:t,id:n}=m;m=null,t.hasPointerCapture(n)&&t.releasePointerCapture(n)}function P(e,t){t?v.set(e,t):v.delete(e)}function F(e){i(`select`,e)}function ee(e){let t=C.value.get(e);t?.total&&i(`visibility`,{id:e,visible:!t.checked})}return(n,r)=>e.enabled?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref_key:`container`,ref:l,class:`mv-tree-ui`,onPointerdown:r[2]||=(0,t.withModifiers)(()=>{},[`stop`]),onPointerup:r[3]||=(0,t.withModifiers)(()=>{},[`stop`]),onClick:r[4]||=(0,t.withModifiers)(()=>{},[`stop`]),onDblclick:r[5]||=(0,t.withModifiers)(()=>{},[`stop`]),onWheel:r[6]||=(0,t.withModifiers)(()=>{},[`stop`]),onContextmenu:r[7]||=(0,t.withModifiers)(()=>{},[`stop`])},[(0,t.withDirectives)((0,t.createElementVNode)(`button`,{ref_key:`trigger`,ref:c,class:`mv-tree-trigger`,type:`button`,title:`构件目录`,"aria-label":`构件目录`,"aria-expanded":o.value,"aria-controls":(0,t.unref)(a),onClick:O},[(0,t.createVNode)(os,{source:(0,t.unref)(hs)},null,8,[`source`])],8,Ts),[[t.vShow,!o.value]]),o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{key:0,id:(0,t.unref)(a),ref_key:`panel`,ref:u,class:`mv-tree-panel`,style:(0,t.normalizeStyle)({left:`${p.value.left}px`,top:`${p.value.top}px`}),"aria-label":`构件目录`},[(0,t.createElementVNode)(`header`,{class:`mv-tree-header`,onPointerdown:(0,t.withModifiers)(j,[`stop`]),onPointermove:(0,t.withModifiers)(M,[`stop`]),onPointerup:(0,t.withModifiers)(N,[`stop`]),onPointercancel:(0,t.withModifiers)(N,[`stop`]),onLostpointercapture:N},[r[8]||=(0,t.createElementVNode)(`strong`,null,`构件目录`,-1),(0,t.createElementVNode)(`button`,{class:`mv-tree-close`,type:`button`,"aria-label":`关闭构件目录`,onPointerdown:r[0]||=(0,t.withModifiers)(()=>{},[`stop`]),onClick:k},[(0,t.createVNode)(os,{source:(0,t.unref)(gs)},null,8,[`source`])],32)],32),(0,t.createElementVNode)(`div`,Ds,[(0,t.createVNode)(os,{source:(0,t.unref)(_s)},null,8,[`source`]),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{ref_key:`searchInput`,ref:d,"onUpdate:modelValue":r[1]||=e=>s.value=e,type:`search`,"aria-label":`搜索目录构件`,placeholder:`搜索构件名称`},null,512),[[t.vModelText,s.value]])]),e.tree?S.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:2,ref_key:`list`,ref:f,class:`mv-tree-list`,role:`tree`,"aria-label":`模型构件目录`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(S.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n.node.id,ref_for:!0,ref:e=>P(n.node.id,e),class:(0,t.normalizeClass)([`mv-tree-row`,{"mv-tree-row-selected":e.selectedId===n.node.id}]),style:(0,t.normalizeStyle)({"--mv-tree-depth":Math.min(n.depth,12)}),role:`treeitem`,"aria-level":n.depth+1,"aria-posinset":n.position,"aria-setsize":n.size,"aria-selected":e.selectedId===n.node.id,"aria-expanded":n.branch?x.value.has(n.node.id):void 0,"aria-checked":C.value.get(n.node.id).total?C.value.get(n.node.id).mixed?`mixed`:C.value.get(n.node.id).checked:void 0,"aria-label":n.node.name},[n.branch?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,class:`mv-tree-expand`,type:`button`,"aria-label":`${x.value.has(n.node.id)?`折叠`:`展开`} ${n.node.name}`,onClick:e=>D(n.node.id)},[(0,t.createVNode)(os,{source:(0,t.unref)(vs),class:(0,t.normalizeClass)({"mv-tree-expanded":x.value.has(n.node.id)})},null,8,[`source`,`class`])],8,js)):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Ms)),(0,t.createElementVNode)(`label`,Ns,[(0,t.createElementVNode)(`input`,{type:`checkbox`,"aria-label":`显示 ${n.node.name}`,checked:C.value.get(n.node.id).checked,indeterminate:C.value.get(n.node.id).mixed,disabled:!C.value.get(n.node.id).total,onChange:e=>ee(n.node.id)},null,40,Ps)]),(0,t.createElementVNode)(`button`,{class:`mv-tree-name`,type:`button`,title:n.node.name,onClick:e=>F(n.node.id)},[(0,t.createVNode)(os,{source:(0,t.unref)(ys)},null,8,[`source`]),(0,t.createElementVNode)(`span`,Is,(0,t.toDisplayString)(n.node.name),1)],8,Fs)],14,As))),128))],512)):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,ks,`没有匹配的构件`)):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,Os,(0,t.toDisplayString)(e.loading?`正在读取构件…`:`暂无模型构件`),1)),T.value?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,Ls,(0,t.toDisplayString)(T.value),1)):(0,t.createCommentVNode)(``,!0)],12,Es)):(0,t.createCommentVNode)(``,!0)],544)):(0,t.createCommentVNode)(``,!0)}},[[`__scopeId`,`data-v-a59718c1`]]),zs={class:`mv-markers`},Bs=[`aria-label`,`aria-pressed`,`onClick`],Vs=[`aria-label`],Hs={key:0,class:`mv-status`,role:`status`},Us={key:1,class:`mv-map-credit`,href:`https://www.tianditu.gov.cn/`,target:`_blank`,rel:`noopener noreferrer`},Ws={key:2,class:`mv-error`,role:`alert`},Gs=[`disabled`],Ks={key:3,class:`mv-notices`},qs={__name:`MineViewer`,props:{modelSource:{type:Object,required:!0},markers:{type:Array,default:()=>[]},initialView:{type:Object,default:()=>({})},cameraTransition:{type:Object},gis:{type:Object},background:{type:Object},navigation:{type:Object}},emits:[`model-loaded`,`model-error`,`component-tree-ready`,`component-select`,`appearance-change`,`marker-click`,`gis-status`,`terrain-status`,`background-error`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(),s=(0,t.ref)(!1),c=(0,t.shallowRef)({x:0,y:0,z:0,w:1}),l=(0,t.computed)(()=>F(i.navigation)),u=(0,t.shallowRef)(null),d=(0,t.ref)(null),f=(0,t.ref)(0),p=(0,t.ref)(0),m=(0,t.ref)(!1),g=(0,t.ref)(``),_=(0,t.ref)(`准备加载`),S=(0,t.ref)(null),C=(0,t.shallowRef)({markers:[],issues:[],width:0,height:0}),T=(0,t.shallowRef)([]),E=(0,t.shallowRef)({status:`disabled`,loaded:0,failed:0,total:0}),D,O=!0,k,A,j,M,N=0;(0,t.watch)(()=>l.value.cube,e=>D?.setNavigationVisible(e));let P=(0,t.computed)(()=>C.value.markers.find(e=>e.id===S.value&&e.visible));(0,t.watch)(P,e=>{e||(S.value=null)}),(0,t.watch)(()=>i.modelSource.manifestUrl,()=>{ee()}),(0,t.watch)(()=>i.markers,e=>D?.setMarkers(e),{deep:!0}),(0,t.watch)(()=>i.gis,e=>D?.setGis(e),{deep:!0,flush:`post`}),(0,t.watch)(()=>i.background,e=>D?.setBackground(e),{deep:!0});async function ee(){if(!D)return;let e=++N;M?.abort(),M=new AbortController;let n=M.signal;m.value=!0,g.value=``,S.value=null;let r,o;try{if(r=await h(i.modelSource,n,t=>{e===N&&(_.value=t)}),n.aborted||e!==N||!D){r.dispose();return}let c=b([r.scene],r);o=w(c,e=>{p.value++,D?.refresh(),a(`appearance-change`,e)});let l=k,f=j;D.show(r,c,o,i.initialView),s.value=O,k=r,A=c,j=o,u.value=v(c.tree),d.value=null,p.value++,f?.dispose(),l?.dispose(),T.value=[...r.warnings,...c.warnings],D.setMarkers(i.markers),a(`component-tree-ready`,v(c.tree)),a(`component-select`,null),a(`model-loaded`,{modelId:r.modelId,revision:r.revision,label:r.label,manifestUrl:r.manifestUrl,stats:{...r.stats},warnings:[...T.value]}),await(0,t.nextTick)(),e===N&&!n.aborted&&D?.setGis(i.gis)}catch(t){if(o?.dispose(),r?.dispose(),n.aborted||e!==N)return;M?.abort(),g.value=t instanceof Error?t.message:String(t),a(`model-error`,{message:g.value})}finally{e===N&&(m.value=!1)}}let te=()=>({changedIds:[],unknownIds:[],skipped:[],error:`模型尚未就绪`});function I(e){if(e&&!A?.byId.has(e))return!1;D?.select(e&&A?.renderObjects.get(e)||null);let t=e?A?.byId.get(e):null;return d.value=t?.id||null,f.value++,a(`component-select`,t?y(t):null),!!(D&&A)}function ne(e){I(e)&&A?.byId.get(e)?.bounds&&ae.focusComponent(e)}function re({id:e,visible:t}){A&&j&&j.apply(ws(bs(A.tree),e,t,j.get))}let L;function R(e){if(!L||e.button!==0||Math.hypot(e.clientX-L.x,e.clientY-L.y)>5)return;let t=D?.pick(e.clientX,e.clientY);I(t&&A?.byObject.get(t)||null),L=void 0}function z(e){S.value=S.value===e.id?null:e.id,a(`marker-click`,e)}function ie(e,t){let n=Math.min(300,Math.max(0,C.value.width-32)),r=Math.max(16,Math.min(e+24,C.value.width-n-16)),a=Math.max(16,Math.min(t+24,C.value.height-240)),o=l.value.height,s=l.value.cube?150:44,c=i.gis?.enabled&&E.value.loaded,u=(o?o+24:16)+(c?32:0),d=Math.max(o?s:0,c?150:0);return d&&r+n>C.value.width-d-16&&a<u&&(a=u),{left:`${r}px`,top:`${a}px`,width:`${n}px`,maxHeight:`${Math.min(320,Math.max(40,C.value.height-a-16))}px`}}let ae={getComponentTree:()=>A?v(A.tree):null,getSceneTree:()=>A?x(A):null,getSceneRoot:()=>k?.scene||null,getComponentId:e=>A?.byObject.get(e)||null,getComponent:e=>{let t=A?.byId.get(e);return t?y(t):null},getComponentAnchor:(e,t=`origin`)=>A?.getAnchor(e,t)||null,getComponentAppearance:e=>j?.get(e)||null,setComponentAppearance:(e,t)=>j?.apply([{id:e,patch:t}])||te(),setComponentAppearances:e=>j?.apply(e)||te(),getAppearanceChanges:()=>j?.changes()||null,applyAppearanceChanges:e=>j?.importChanges(e)||te(),restoreComponent:e=>j?typeof e!=`string`||!e.trim()?{changedIds:[],unknownIds:[],skipped:[],error:`restoreComponent 需要传入当前模型中的有效构件 ID`}:j.restore(e):te(),restoreAllComponents:()=>j?.restoreAll()||te(),selectComponent:I,focusComponent:(e,t)=>{let n=A?.renderObjects.get(e);return n&&D?.focus(n,{...i.cameraTransition,...t})||!1},resetView:e=>D?.reset({...i.cameraTransition,...e})||!1,setViewDirection:(e,t)=>D?.setViewDirection(e,{...i.cameraTransition,...t})||!1,reload:ee};return n(ae),(0,t.onMounted)(()=>{try{D=rs(o.value,e=>{C.value=e},()=>{O=!1,s.value=!1,M?.abort(),g.value=`图形上下文已中断,请重新打开页面`,a(`model-error`,{message:g.value})},e=>{E.value=e,a(`gis-status`,e)},e=>a(`background-error`,e),e=>{c.value=e},e=>a(`terrain-status`,e)),D.setNavigationVisible(l.value.cube),D.setBackground(i.background),ee()}catch(e){g.value=`无法创建三维视窗:${e instanceof Error?e.message:String(e)}`,a(`model-error`,{message:g.value})}}),(0,t.onBeforeUnmount)(()=>{N++,M?.abort(),D?.dispose(),j?.dispose(),k?.dispose(),A=void 0,j=void 0,k=void 0,D=void 0}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`section`,{class:`mv-viewer`,style:(0,t.normalizeStyle)({"--mv-map-credit-top":`${l.value.height?l.value.height+24:16}px`}),"aria-label":`BIM 模型查看器`,onKeydown:r[4]||=(0,t.withKeys)(e=>S.value=null,[`esc`])},[(0,t.createElementVNode)(`div`,{ref_key:`viewport`,ref:o,class:`mv-viewport`,onPointerdown:r[0]||=e=>(0,t.isRef)(L)?L.value={x:e.clientX,y:e.clientY}:L={x:e.clientX,y:e.clientY},onPointerup:R},null,544),(0,t.createElementVNode)(`div`,zs,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(C.value.markers.filter(e=>e.visible),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.id,class:`mv-marker`,style:(0,t.normalizeStyle)({left:`${e.x}px`,top:`${e.y}px`}),"aria-label":e.label,"aria-pressed":S.value===e.id,onClick:(0,t.withModifiers)(t=>z(e),[`stop`])},[(0,t.renderSlot)(n.$slots,`marker`,{marker:e,selected:S.value===e.id},()=>[r[5]||=(0,t.createElementVNode)(`span`,{class:`mv-dot`},null,-1),(0,t.createTextVNode)((0,t.toDisplayString)(e.label),1)])],12,Bs))),128)),P.value?((0,t.openBlock)(),(0,t.createElementBlock)(`article`,{key:0,role:`dialog`,"aria-label":P.value.label,class:`mv-popup`,style:(0,t.normalizeStyle)(ie(P.value.x,P.value.y))},[(0,t.renderSlot)(n.$slots,`marker-popup`,{marker:P.value,close:()=>{S.value=null}},()=>[(0,t.createElementVNode)(`header`,null,[(0,t.createElementVNode)(`strong`,null,(0,t.toDisplayString)(P.value.label),1),(0,t.createElementVNode)(`button`,{"aria-label":`关闭标记信息`,onClick:r[1]||=e=>S.value=null},`关闭`)]),(0,t.createElementVNode)(`p`,null,(0,t.toDisplayString)(P.value.modelPosition),1)])],12,Vs)):(0,t.createCommentVNode)(``,!0)]),m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Hs,(0,t.toDisplayString)(_.value)+`…`,1)):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(ms,{options:e.navigation,orientation:c.value,disabled:!s.value,onHome:r[2]||=e=>ae.resetView(),onNavigate:r[3]||=e=>(0,t.unref)(D)?.navigate(e,i.cameraTransition)},null,8,[`options`,`orientation`,`disabled`]),(0,t.createVNode)(Rs,{enabled:l.value.componentTree,tree:u.value,"selected-id":d.value,"selection-revision":f.value,"appearance-revision":p.value,"get-appearance":ae.getComponentAppearance,loading:m.value,onSelect:ne,onVisibility:re},null,8,[`enabled`,`tree`,`selected-id`,`selection-revision`,`appearance-revision`,`get-appearance`,`loading`]),e.gis?.enabled&&E.value.loaded?((0,t.openBlock)(),(0,t.createElementBlock)(`a`,Us,`影像 © 天地图`)):(0,t.createCommentVNode)(``,!0),g.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ws,[(0,t.createElementVNode)(`p`,null,(0,t.toDisplayString)(g.value),1),(0,t.createElementVNode)(`button`,{disabled:m.value,onClick:ee},(0,t.toDisplayString)(m.value?`正在重试…`:`重试加载`),9,Gs)])):(0,t.createCommentVNode)(``,!0),!g.value&&!m.value&&(T.value.length||C.value.issues.length)?((0,t.openBlock)(),(0,t.createElementBlock)(`details`,Ks,[(0,t.createElementVNode)(`summary`,null,`加载提示(`+(0,t.toDisplayString)(T.value.length+C.value.issues.length)+`)`,1),(0,t.createElementVNode)(`ul`,null,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)([...T.value,...C.value.issues],e=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:e},(0,t.toDisplayString)(e),1))),128))])])):(0,t.createCommentVNode)(``,!0)],36))}},Js=`+proj=longlat +ellps=GRS80 +no_defs`,Ys=`+proj=longlat +datum=WGS84 +no_defs`,Xs=`+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=41500000 +y_0=0 +ellps=GRS80 +units=m +no_defs`;function Zs(e,t){if(!Number.isFinite(e))throw Error(`${t} 必须是有限数值`)}function Qs(e){if(!e)throw Error(`缺少模型坐标`);return Zs(e.x,`模型 x`),Zs(e.y,`模型 y`),Zs(e.z,`模型 z`),new n.Vector3(e.x,e.y,e.z)}function $s(e){if(Zs(e.longitude,`经度`),Zs(e.latitude,`纬度`),Math.abs(e.longitude)>180||Math.abs(e.latitude)>90)throw Error(`经纬度超出有效范围`);return e.height!==void 0&&Zs(e.height,`高程`),{...e}}function ec(e){return e.reduce((e,t)=>e.add(t),new n.Vector3).divideScalar(e.length)}function tc(e,t,n){let r=0,i=0,a=0;for(let n of e){let e=n.x-t.x,o=n.y-t.y;r+=e*e,i+=o*o,a+=e*o}if(r+i<1e-12||r*i-a*a<=1e-12*(r+i)**2)throw Error(`${n}在水平面上重合、共线或过于接近共线,请选择分散的控制点`)}function nc(e){if(!e||!Array.isArray(e.controlPoints)||e.controlPoints.length<3)throw Error(`GIS 配准至少需要三个模型与地图的对应控制点`);let{sourceCrs:t}=e;if(![`EPSG:4490`,`EPSG:4326`,`EPSG:4529`].includes(t))throw Error(`不支持的坐标系,请显式指定 EPSG:4490、EPSG:4326 或 EPSG:4529`);let r=e.modelUpAxis??`y`,i=e.horizontalAlignment??`least-squares`;if(![`least-squares`,`first-point`].includes(i))throw Error(`horizontalAlignment 仅支持 least-squares 或 first-point`);if(r!==`y`&&r!==`z`)throw Error(`modelUpAxis 仅支持 y 或 z`);let a=e.metersPerUnit??1;if(Zs(a,`metersPerUnit`),a<=0)throw Error(`metersPerUnit 必须大于 0`);let o=e.fallbackHeight??0;if(Zs(o,`fallbackHeight`),e.maxErrorMeters!==void 0&&(Zs(e.maxErrorMeters,`maxErrorMeters`),e.maxErrorMeters<0))throw Error(`maxErrorMeters 不能为负数`);let s=t===`EPSG:4326`?Ys:Js,c=Fo(Xs,Js),l=Fo(s,`+proj=geocent +ellps=${t===`EPSG:4326`?`WGS84`:`GRS80`} +units=m +no_defs`),u=e.controlPoints.map(e=>{let n=Qs(e?.model);if(!e.map)throw Error(`缺少地图坐标`);let r;if(t===`EPSG:4529`){let t=e.map;if(Zs(t.northing,`northing(测量 X)`),Zs(t.easting,`easting(测量 Y)`),Math.floor(t.easting/1e6)!==41)throw Error(`EPSG:4529 的 easting(测量 Y)必须包含 41 带号`);let[n,i]=c.forward([t.easting,t.northing]);r=$s({longitude:n,latitude:i,height:t.height})}else r=$s(e.map);return{model:n,map:r}}),d={longitude:u[0].map.longitude,latitude:u[0].map.latitude,height:0},f=Math.PI/180,p=d.longitude*f,m=d.latitude*f,h=Math.sin(p),g=Math.cos(p),_=Math.sin(m),v=Math.cos(m),y=(e,t)=>new n.Vector3(...l.forward([e.longitude,e.latitude,t])),b=y(d,0),x=new n.Matrix4().set(-h,-_*g,v*g,b.x,g,-_*h,v*h,b.y,0,v,_,b.z,0,0,0,1),S=x.clone().invert(),C=r===`y`?new n.Matrix4().makeRotationX(Math.PI/2):new n.Matrix4,w=u.map(({model:e})=>e.clone().applyMatrix4(C).multiplyScalar(a)),T=u.map(({map:e})=>y(e,0).applyMatrix4(S)),E=ec(w),D=ec(T);i===`least-squares`&&(tc(w,E,`模型控制点`),tc(T,D,`地图控制点`));let O=i===`first-point`?w[0]:E,k=i===`first-point`?T[0]:D,A=0,j=0;for(let e=+(i===`first-point`);e<w.length;e++){let t=w[e].clone().sub(O),n=T[e].clone().sub(k);if(i===`first-point`){let e=Math.hypot(t.x,t.y),r=Math.hypot(n.x,n.y);if(e<1e-6||r<1e-6)throw Error(`方向控制点不能与首点在水平面上重合`);t.divideScalar(e),n.divideScalar(r)}A+=t.x*n.x+t.y*n.y,j+=t.x*n.y-t.y*n.x}let M=i===`first-point`?1e-8*(w.length-1):1e-12;if(Math.hypot(A,j)<M)throw Error(`控制点无法确定一致的水平旋转`);let N=Math.atan2(j,A),P=new n.Matrix4().makeRotationZ(N),F=k.clone().sub(O.clone().applyMatrix4(P)),ee=u.flatMap(({map:e},t)=>e.height===void 0?[]:[{index:t,z:y(e,e.height).applyMatrix4(S).z}]),te=ee.length>0;F.z=te?ee.reduce((e,t)=>e+t.z-w[t.index].z,0)/ee.length:o;let I=new n.Matrix4().makeTranslation(F.x,F.y,F.z).multiply(P).multiply(C).scale(new n.Vector3(a,a,a)),ne=x.clone().multiply(I),re=e=>{let t=Qs(e).applyMatrix4(ne),[n,r,i]=l.inverse(t.toArray());return $s({longitude:n,latitude:r,...te?{height:i}:{}})},L=u.map(({model:e,map:t},n)=>{let r=re(e),i=y(r,0).applyMatrix4(S),a=t.height===void 0?null:r.height-t.height;return{index:n,horizontalError:Math.hypot(i.x-T[n].x,i.y-T[n].y),verticalError:a}}),R=Math.sqrt(L.reduce((e,t)=>e+t.horizontalError**2,0)/L.length),z=Math.max(...L.map(e=>e.horizontalError));if(e.maxErrorMeters!==void 0&&z>e.maxErrorMeters)throw Error(`控制点最大水平误差 ${z.toFixed(4)} 米超过允许值`);let ie=L.filter(e=>e.verticalError!==null);return{sourceCrs:t,reference:{...d},position:re({x:0,y:0,z:0}),rotationDegrees:N/f,metersPerUnit:a,heightResolved:te,localMatrix:I.toArray(),ecefMatrix:ne.toArray(),horizontalRmse:R,maxHorizontalError:z,verticalRmse:ie.length?Math.sqrt(ie.reduce((e,t)=>e+t.verticalError**2,0)/ie.length):null,residuals:L,toGeographic:re}}exports.MineViewer=qs,exports.createGisPlacement=nc,exports.flattenComponentTree=_;