@antv/aimapui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aimapui.css +1 -0
- package/dist/deflate-CKwHDg50.js +11 -0
- package/dist/deflate-Cq-pPdUv.cjs +1 -0
- package/dist/geotiff-DgvKp-KZ.cjs +8 -0
- package/dist/geotiff-PfJx4HFE.js +3921 -0
- package/dist/index.cjs.js +30 -0
- package/dist/index.d.ts +3117 -0
- package/dist/index.es.js +7408 -0
- package/dist/jpeg-Cl2NW-cY.cjs +1 -0
- package/dist/jpeg-MQp7oMmw.js +614 -0
- package/dist/lerc-AFFztCrB.cjs +1 -0
- package/dist/lerc-Dvdjzjn6.js +1040 -0
- package/dist/lzw-C8QOYcsP.js +87 -0
- package/dist/lzw-D_DqLmmY.cjs +1 -0
- package/dist/packbits-8Fw6ZvFU.cjs +1 -0
- package/dist/packbits-CD5k4UmY.js +25 -0
- package/dist/pako.esm-Bx5X36Wo.js +1074 -0
- package/dist/pako.esm-DZC2QrbJ.cjs +1 -0
- package/dist/raw-BDe9dy08.cjs +1 -0
- package/dist/raw-Dy8BlXYp.js +10 -0
- package/dist/webimage-5Mm5RWK-.js +36 -0
- package/dist/webimage-DwMB2kar.cjs +1 -0
- package/dist/zstd-4hT92z0t.js +66 -0
- package/dist/zstd-CS7WJjVM.cjs +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";var On=Object.create;var or=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var $n=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty;var Zn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $n(t))!Bn.call(e,o)&&o!==r&&or(e,o,{get:()=>t[o],enumerable:!(n=Fn(t,o))||n.enumerable});return e};var je=(e,t,r)=>(r=e!=null?On(Dn(e)):{},Zn(t||!e||!e.__esModule?or(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),Vn=require("@antv/l7"),wt=require("react-dom");var Ge={exports:{}},Be={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var sr;function Hn(){if(sr)return Be;sr=1;var e=d,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(c,a,u){var f,m={},h=null,g=null;u!==void 0&&(h=""+u),a.key!==void 0&&(h=""+a.key),a.ref!==void 0&&(g=a.ref);for(f in a)n.call(a,f)&&!i.hasOwnProperty(f)&&(m[f]=a[f]);if(c&&c.defaultProps)for(f in a=c.defaultProps,a)m[f]===void 0&&(m[f]=a[f]);return{$$typeof:t,type:c,key:h,ref:g,props:m,_owner:o.current}}return Be.Fragment=r,Be.jsx=l,Be.jsxs=l,Be}var Ze={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ir;function Un(){return ir||(ir=1,process.env.NODE_ENV!=="production"&&(function(){var e=d,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y=Symbol.iterator,x="@@iterator";function b(p){if(p===null||typeof p!="object")return null;var N=y&&p[y]||p[x];return typeof N=="function"?N:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(p){{for(var N=arguments.length,$=new Array(N>1?N-1:0),Y=1;Y<N;Y++)$[Y-1]=arguments[Y];j("error",p,$)}}function j(p,N,$){{var Y=v.ReactDebugCurrentFrame,te=Y.getStackAddendum();te!==""&&(N+="%s",$=$.concat([te]));var oe=$.map(function(Q){return String(Q)});oe.unshift("Warning: "+N),Function.prototype.apply.call(console[p],console,oe)}}var _=!1,L=!1,z=!1,w=!1,k=!1,O;O=Symbol.for("react.module.reference");function M(p){return!!(typeof p=="string"||typeof p=="function"||p===n||p===i||k||p===o||p===u||p===f||w||p===g||_||L||z||typeof p=="object"&&p!==null&&(p.$$typeof===h||p.$$typeof===m||p.$$typeof===l||p.$$typeof===c||p.$$typeof===a||p.$$typeof===O||p.getModuleId!==void 0))}function A(p,N,$){var Y=p.displayName;if(Y)return Y;var te=N.displayName||N.name||"";return te!==""?$+"("+te+")":$}function T(p){return p.displayName||"Context"}function S(p){if(p==null)return null;if(typeof p.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p;switch(p){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case o:return"StrictMode";case u:return"Suspense";case f:return"SuspenseList"}if(typeof p=="object")switch(p.$$typeof){case c:var N=p;return T(N)+".Consumer";case l:var $=p;return T($._context)+".Provider";case a:return A(p,p.render,"ForwardRef");case m:var Y=p.displayName||null;return Y!==null?Y:S(p.type)||"Memo";case h:{var te=p,oe=te._payload,Q=te._init;try{return S(Q(oe))}catch{return null}}}return null}var E=Object.assign,R=0,P,B,D,F,G,H,V;function U(){}U.__reactDisabledLog=!0;function W(){{if(R===0){P=console.log,B=console.info,D=console.warn,F=console.error,G=console.group,H=console.groupCollapsed,V=console.groupEnd;var p={configurable:!0,enumerable:!0,value:U,writable:!0};Object.defineProperties(console,{info:p,log:p,warn:p,error:p,group:p,groupCollapsed:p,groupEnd:p})}R++}}function I(){{if(R--,R===0){var p={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:E({},p,{value:P}),info:E({},p,{value:B}),warn:E({},p,{value:D}),error:E({},p,{value:F}),group:E({},p,{value:G}),groupCollapsed:E({},p,{value:H}),groupEnd:E({},p,{value:V})})}R<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var q=v.ReactCurrentDispatcher,J;function Z(p,N,$){{if(J===void 0)try{throw Error()}catch(te){var Y=te.stack.trim().match(/\n( *(at )?)/);J=Y&&Y[1]||""}return`
|
|
18
|
+
`+J+p}}var ue=!1,ne;{var de=typeof WeakMap=="function"?WeakMap:Map;ne=new de}function ie(p,N){if(!p||ue)return"";{var $=ne.get(p);if($!==void 0)return $}var Y;ue=!0;var te=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var oe;oe=q.current,q.current=null,W();try{if(N){var Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(ge){Y=ge}Reflect.construct(p,[],Q)}else{try{Q.call()}catch(ge){Y=ge}p.call(Q.prototype)}}else{try{throw Error()}catch(ge){Y=ge}p()}}catch(ge){if(ge&&Y&&typeof ge.stack=="string"){for(var K=ge.stack.split(`
|
|
19
|
+
`),he=Y.stack.split(`
|
|
20
|
+
`),pe=K.length-1,me=he.length-1;pe>=1&&me>=0&&K[pe]!==he[me];)me--;for(;pe>=1&&me>=0;pe--,me--)if(K[pe]!==he[me]){if(pe!==1||me!==1)do if(pe--,me--,me<0||K[pe]!==he[me]){var be=`
|
|
21
|
+
`+K[pe].replace(" at new "," at ");return p.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",p.displayName)),typeof p=="function"&&ne.set(p,be),be}while(pe>=1&&me>=0);break}}}finally{ue=!1,q.current=oe,I(),Error.prepareStackTrace=te}var Pe=p?p.displayName||p.name:"",Ne=Pe?Z(Pe):"";return typeof p=="function"&&ne.set(p,Ne),Ne}function X(p,N,$){return ie(p,!1)}function le(p){var N=p.prototype;return!!(N&&N.isReactComponent)}function ae(p,N,$){if(p==null)return"";if(typeof p=="function")return ie(p,le(p));if(typeof p=="string")return Z(p);switch(p){case u:return Z("Suspense");case f:return Z("SuspenseList")}if(typeof p=="object")switch(p.$$typeof){case a:return X(p.render);case m:return ae(p.type,N,$);case h:{var Y=p,te=Y._payload,oe=Y._init;try{return ae(oe(te),N,$)}catch{}}}return""}var se=Object.prototype.hasOwnProperty,Le={},ke=v.ReactDebugCurrentFrame;function xe(p){if(p){var N=p._owner,$=ae(p.type,p._source,N?N.type:null);ke.setExtraStackFrame($)}else ke.setExtraStackFrame(null)}function $e(p,N,$,Y,te){{var oe=Function.call.bind(se);for(var Q in p)if(oe(p,Q)){var K=void 0;try{if(typeof p[Q]!="function"){var he=Error((Y||"React class")+": "+$+" type `"+Q+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof p[Q]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw he.name="Invariant Violation",he}K=p[Q](N,Q,Y,$,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(pe){K=pe}K&&!(K instanceof Error)&&(xe(te),C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",$,Q,typeof K),xe(null)),K instanceof Error&&!(K.message in Le)&&(Le[K.message]=!0,xe(te),C("Failed %s type: %s",$,K.message),xe(null))}}}var ee=Array.isArray;function Se(p){return ee(p)}function Ye(p){{var N=typeof Symbol=="function"&&Symbol.toStringTag,$=N&&p[Symbol.toStringTag]||p.constructor.name||"Object";return $}}function De(p){try{return qe(p),!1}catch{return!0}}function qe(p){return""+p}function Yt(p){if(De(p))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ye(p)),qe(p)}var qt=v.ReactCurrentOwner,bn={key:!0,ref:!0,__self:!0,__source:!0},Gt,Jt;function vn(p){if(se.call(p,"ref")){var N=Object.getOwnPropertyDescriptor(p,"ref").get;if(N&&N.isReactWarning)return!1}return p.ref!==void 0}function wn(p){if(se.call(p,"key")){var N=Object.getOwnPropertyDescriptor(p,"key").get;if(N&&N.isReactWarning)return!1}return p.key!==void 0}function jn(p,N){typeof p.ref=="string"&&qt.current}function Cn(p,N){{var $=function(){Gt||(Gt=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",N))};$.isReactWarning=!0,Object.defineProperty(p,"key",{get:$,configurable:!0})}}function Sn(p,N){{var $=function(){Jt||(Jt=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",N))};$.isReactWarning=!0,Object.defineProperty(p,"ref",{get:$,configurable:!0})}}var _n=function(p,N,$,Y,te,oe,Q){var K={$$typeof:t,type:p,key:N,ref:$,props:Q,_owner:oe};return K._store={},Object.defineProperty(K._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(K,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(K,"_source",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.freeze&&(Object.freeze(K.props),Object.freeze(K)),K};function En(p,N,$,Y,te){{var oe,Q={},K=null,he=null;$!==void 0&&(Yt($),K=""+$),wn(N)&&(Yt(N.key),K=""+N.key),vn(N)&&(he=N.ref,jn(N,te));for(oe in N)se.call(N,oe)&&!bn.hasOwnProperty(oe)&&(Q[oe]=N[oe]);if(p&&p.defaultProps){var pe=p.defaultProps;for(oe in pe)Q[oe]===void 0&&(Q[oe]=pe[oe])}if(K||he){var me=typeof p=="function"?p.displayName||p.name||"Unknown":p;K&&Cn(Q,me),he&&Sn(Q,me)}return _n(p,K,he,te,Y,qt.current,Q)}}var it=v.ReactCurrentOwner,Kt=v.ReactDebugCurrentFrame;function Ae(p){if(p){var N=p._owner,$=ae(p.type,p._source,N?N.type:null);Kt.setExtraStackFrame($)}else Kt.setExtraStackFrame(null)}var at;at=!1;function lt(p){return typeof p=="object"&&p!==null&&p.$$typeof===t}function Xt(){{if(it.current){var p=S(it.current.type);if(p)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+p+"`."}return""}}function Ln(p){return""}var Qt={};function kn(p){{var N=Xt();if(!N){var $=typeof p=="string"?p:p.displayName||p.name;$&&(N=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+$+">.")}return N}}function er(p,N){{if(!p._store||p._store.validated||p.key!=null)return;p._store.validated=!0;var $=kn(N);if(Qt[$])return;Qt[$]=!0;var Y="";p&&p._owner&&p._owner!==it.current&&(Y=" It was passed a child from "+S(p._owner.type)+"."),Ae(p),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',$,Y),Ae(null)}}function tr(p,N){{if(typeof p!="object")return;if(Se(p))for(var $=0;$<p.length;$++){var Y=p[$];lt(Y)&&er(Y,N)}else if(lt(p))p._store&&(p._store.validated=!0);else if(p){var te=b(p);if(typeof te=="function"&&te!==p.entries)for(var oe=te.call(p),Q;!(Q=oe.next()).done;)lt(Q.value)&&er(Q.value,N)}}}function Mn(p){{var N=p.type;if(N==null||typeof N=="string")return;var $;if(typeof N=="function")$=N.propTypes;else if(typeof N=="object"&&(N.$$typeof===a||N.$$typeof===m))$=N.propTypes;else return;if($){var Y=S(N);$e($,p.props,"prop",Y,p)}else if(N.PropTypes!==void 0&&!at){at=!0;var te=S(N);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",te||"Unknown")}typeof N.getDefaultProps=="function"&&!N.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Tn(p){{for(var N=Object.keys(p.props),$=0;$<N.length;$++){var Y=N[$];if(Y!=="children"&&Y!=="key"){Ae(p),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),Ae(null);break}}p.ref!==null&&(Ae(p),C("Invalid attribute `ref` supplied to `React.Fragment`."),Ae(null))}}var rr={};function nr(p,N,$,Y,te,oe){{var Q=M(p);if(!Q){var K="";(p===void 0||typeof p=="object"&&p!==null&&Object.keys(p).length===0)&&(K+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var he=Ln();he?K+=he:K+=Xt();var pe;p===null?pe="null":Se(p)?pe="array":p!==void 0&&p.$$typeof===t?(pe="<"+(S(p.type)||"Unknown")+" />",K=" Did you accidentally export a JSX literal instead of a component?"):pe=typeof p,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",pe,K)}var me=En(p,N,$,te,oe);if(me==null)return me;if(Q){var be=N.children;if(be!==void 0)if(Y)if(Se(be)){for(var Pe=0;Pe<be.length;Pe++)tr(be[Pe],p);Object.freeze&&Object.freeze(be)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else tr(be,p)}if(se.call(N,"key")){var Ne=S(p),ge=Object.keys(N).filter(function(zn){return zn!=="key"}),ct=ge.length>0?"{key: someKey, "+ge.join(": ..., ")+": ...}":"{key: someKey}";if(!rr[Ne+ct]){var Pn=ge.length>0?"{"+ge.join(": ..., ")+": ...}":"{}";C(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,ct,Ne,Pn,Ne),rr[Ne+ct]=!0}}return p===n?Tn(me):Mn(me),me}}function Nn(p,N,$){return nr(p,N,$,!0)}function Rn(p,N,$){return nr(p,N,$,!1)}var In=Rn,An=Nn;Ze.Fragment=n,Ze.jsx=In,Ze.jsxs=An})()),Ze}var ar;function Wn(){return ar||(ar=1,process.env.NODE_ENV==="production"?Ge.exports=Hn():Ge.exports=Un()),Ge.exports}var s=Wn();const ve={basemap:"map",center:[105,35],zoom:4,pitch:0,rotation:0};function nt(e){return{basemap:e.basemap??ve.basemap,token:e.token,style:e.style,center:e.center??[...ve.center],zoom:e.zoom??ve.zoom,pitch:e.pitch??ve.pitch,rotation:e.rotation??ve.rotation,minZoom:e.minZoom,maxZoom:e.maxZoom,bounds:e.bounds,gestureConfig:e.gestureConfig}}let Yn=0;function qn(){return`aimap-layer-${++Yn}`}function _r(e){return{id:e.id??qn(),type:e.type,name:e.name??e.type,visible:e.visible??!0,zIndex:e.zIndex??0,minZoom:e.minZoom,maxZoom:e.maxZoom,autoFit:e.autoFit??!1,source:e.source,sourceType:e.sourceType,sourceConfig:e.sourceConfig,color:e.color,colorField:e.colorField,colorValues:e.colorValues,size:e.size,sizeField:e.sizeField,sizeValues:e.sizeValues,shape:e.shape,shapeField:e.shapeField,shapeValues:e.shapeValues,style:e.style,filterField:e.filterField,filterValues:e.filterValues,animate:e.animate,active:e.active,select:e.select,events:e.events}}const Gn={zoom:"topright",scale:"bottomleft",fullscreen:"topright",geoLocate:"topright",mapTheme:"topright",mouseLocation:"bottomright",exportImage:"topright",layerSwitch:"topright"};function Er(e){return{type:e.type,position:e.position??Gn[e.type]??"topright",options:e.options}}const Jn={breakpoint:768};function Kn(e){return{breakpoint:(e==null?void 0:e.breakpoint)??Jn.breakpoint,mobile:e==null?void 0:e.mobile}}function jt(e){return{map:nt(e.map),layers:(e.layers??[]).map(_r),controls:(e.controls??[]).map(Er),interactions:e.interactions??[],legends:e.legends??[],responsive:e.responsive?Kn(e.responsive):void 0,events:e.events}}function Lr(e){return jt(e)}function Xn(e){const t=[];if(e.basemap||t.push("map.basemap is required"),e.center){const[r,n]=e.center;(r<-180||r>180)&&t.push("map.center[0] (longitude) must be between -180 and 180"),(n<-90||n>90)&&t.push("map.center[1] (latitude) must be between -90 and 90")}return t}function Qn(e,t){const r=[];return e.type||r.push(`layers[${t}].type is required`),e.source===void 0&&e.source,e.colorField&&!e.colorValues&&e.color,r}function eo(e){const t=[];return t.push(...Xn(e.map)),(e.layers??[]).forEach((r,n)=>{t.push(...Qn(r,n))}),{valid:t.length===0,errors:t}}const kr=d.createContext(null);function Mr({schema:e,children:t}){return s.jsx(kr.Provider,{value:e,children:t})}function to(){return d.useContext(kr)}class Tr{constructor(){this.listeners=new Map}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{var n;(n=this.listeners.get(t))==null||n.delete(r)}}once(t,r){const n=(...i)=>{r(...i),o()},o=this.on(t,n);return o}emit(t,...r){const n=this.listeners.get(t);n&&n.forEach(o=>{try{o(...r)}catch(i){console.error(`[aimapui EventBus] Error in event "${t}":`,i)}})}off(t){this.listeners.delete(t)}clear(){this.listeners.clear()}}function Nr(){return new Tr}const Rr=d.createContext(null);function Ir({events:e,children:t}){const r=d.useRef(null);return r.current||(r.current=Nr()),d.useEffect(()=>{if(!e||!r.current)return;const n=r.current,o=[];for(const[i,l]of Object.entries(e))l&&o.push(n.on(i,l));return()=>{o.forEach(i=>i())}},[e]),s.jsx(Rr.Provider,{value:r.current,children:t})}function Ct(){const e=d.useContext(Rr);if(!e)throw new Error("[aimapui] useEventBus must be used within an EventBusProvider");return e}const Ar=d.createContext({resolvedTheme:"light",theme:"light",setTheme:()=>{},toggleTheme:()=>{}});function Pr({defaultTheme:e="light",target:t="container",children:r}){const[n,o]=d.useState(e),[i,l]=d.useState("light");d.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)");l(f.matches?"dark":"light");const m=h=>{l(h.matches?"dark":"light")};return f.addEventListener("change",m),()=>f.removeEventListener("change",m)},[]);const c=n==="system"?i:n,a=d.useCallback(()=>{o(f=>f==="system"?i==="light"?"dark":"light":f==="light"?"dark":"light")},[i]);d.useEffect(()=>{t==="root"&&document.documentElement.setAttribute("data-theme",c)},[c,t]);const u=d.useMemo(()=>({resolvedTheme:c,theme:n,setTheme:o,toggleTheme:a}),[c,n,a]);return s.jsx(Ar.Provider,{value:u,children:t==="container"?s.jsx("div",{"data-theme":c,style:{display:"contents"},children:r}):r})}function zr(){return d.useContext(Ar)}const ro=d.createContext({isMobile:!1,breakpoint:768,width:typeof window<"u"?window.innerWidth:1024,schema:void 0});function no({responsive:e,children:t}){const[r,n]=d.useState(typeof window<"u"?window.innerWidth:1024);d.useEffect(()=>{let c;const a=()=>{cancelAnimationFrame(c),c=requestAnimationFrame(()=>n(window.innerWidth))};return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(c)}},[]);const o=(e==null?void 0:e.breakpoint)??768,i=r<o,l=d.useMemo(()=>({isMobile:i,breakpoint:o,width:r,schema:e}),[i,o,r,e]);return s.jsx(ro.Provider,{value:l,children:t})}const Or=d.createContext(null);function Fr({scene:e,children:t}){const r=d.useRef(e);return r.current=e,s.jsx(Or.Provider,{value:r.current,children:t})}function fe(){return d.useContext(Or)}async function $r(e){var i,l,c;const t=e.basemap??ve.basemap,r=e.token??"",n=e.style??"normal",o={center:e.center??ve.center,zoom:e.zoom??ve.zoom,pitch:e.pitch??ve.pitch,rotation:e.rotation??ve.rotation,minZoom:e.minZoom,maxZoom:e.maxZoom,dragEnable:((i=e.gestureConfig)==null?void 0:i.dragPan)??!0,zoomEnable:((l=e.gestureConfig)==null?void 0:l.pinchZoom)??!0,rotateEnable:((c=e.gestureConfig)==null?void 0:c.dragRotate)??!0};switch(t){case"gaode":{const{GaodeMap:a}=await import("@antv/l7-maps");return new a({...o,style:oo(n),token:r})}case"mapbox":{const{Mapbox:a}=await import("@antv/l7-maps");return new a({...o,style:so(n),token:r})}case"tianditu":{const{TMap:a}=await import("@antv/l7-maps");return new a({...o,token:r})}case"tencent":{const{TencentMap:a}=await import("@antv/l7-maps");return new a({...o,token:r})}case"baidu":{const{BaiduMap:a}=await import("@antv/l7-maps");return new a({...o,style:io(n),token:r})}case"maplibre":{const{MapLibre:a}=await import("@antv/l7-maps");return new a({...o,style:lo(n),token:r})}case"google":{const{GoogleMap:a}=await import("@antv/l7-maps"),u=new a({...o,style:ao(n),token:r});return co(u),u}case"map":default:{const{Map:a}=await import("@antv/l7-maps");return new a({center:e.center??ve.center,zoom:e.zoom??ve.zoom})}}}function oo(e){return{light:"light",dark:"dark",normal:"normal",darkblue:"dark",satellite:"satellite"}[e]??e}function so(e){return{light:"https://tiles.openfreemap.org/styles/positron",dark:"https://tiles.openfreemap.org/styles/dark",normal:"https://tiles.openfreemap.org/styles/bright",liberty:"https://tiles.openfreemap.org/styles/liberty",fiord:"https://tiles.openfreemap.org/styles/fiord"}[e]??e}function io(e){return{light:"light",dark:"dark",normal:"normal",darkblue:"dark",satellite:"satellite"}[e]??e}function ao(e){return{light:"roadmap",dark:"roadmap",normal:"roadmap",darkblue:"roadmap",satellite:"satellite",hybrid:"hybrid",terrain:"terrain"}[e]??"roadmap"}function lo(e){return{light:"https://tiles.openfreemap.org/styles/positron",dark:"https://tiles.openfreemap.org/styles/dark",normal:"https://tiles.openfreemap.org/styles/bright",liberty:"https://tiles.openfreemap.org/styles/liberty",fiord:"https://tiles.openfreemap.org/styles/fiord"}[e]??e}function co(e){const t=["zoomControl","mapTypeControl","streetViewControl","fullscreenControl","scaleControl","rotateControl","panControl"],r={};for(const l of t)r[l]=!1;const n=()=>{const l=e.map;if(!l||typeof l.setOptions!="function")return!1;l.setOptions(r);const c=l.setOptions.bind(l);return l.setOptions=a=>{const u={...a};for(const f of t)f in u&&delete u[f];c(u)},!0};if(n())return;let o=0;const i=setInterval(()=>{o+=1,(n()||o>40)&&clearInterval(i)},100)}function Dr({mapSchema:e,children:t,onSceneReady:r,mapEventHandlers:n,events:o,className:i,style:l}){const c=d.useRef(null),a=d.useRef(null),[u,f]=d.useState(null),m=d.useRef(r);m.current=r;const h=d.useRef(n);h.current=n;const g=Ct(),y=d.useCallback((C,j)=>{var w,k,O;if(j.basemap==="map")return;const _=((w=j.gestureConfig)==null?void 0:w.dragPan)??!0,L=((k=j.gestureConfig)==null?void 0:k.pinchZoom)??!0,z=((O=j.gestureConfig)==null?void 0:O.dragRotate)??!0;try{const M=C.mapService;M&&typeof M.setMapStatus=="function"&&M.setMapStatus({dragEnable:_,zoomEnable:L,rotateEnable:z,doubleClickZoom:L})}catch{}},[]);d.useEffect(()=>{if(!c.current)return;let C=!1;const j=nt(e);$r(j).then(L=>{if(C||!c.current)return;const z=new Vn.Scene({id:c.current,map:L});a.current=z,z.on("loaded",()=>{var w;C||(y(z,j),f(z),(w=m.current)==null||w.call(m,z),_(z))}),j.bounds&&z.on("loaded",()=>{try{const[w,k]=j.bounds;z.fitBounds([w[0],w[1],k[0],k[1]])}catch{}})});function _(L){L.on("mapmove",()=>{var w,k;const z={originalEvent:null,center:[L.getCenter().lng,L.getCenter().lat],zoom:L.getZoom(),pitch:L.getPitch(),rotation:L.getRotation()};(k=(w=h.current)==null?void 0:w.onMove)==null||k.call(w,z),o!=null&&o.mapMove&&g.emit(o.mapMove,z)}),L.on("zoomchange",()=>{var w,k;const z={originalEvent:null,center:[L.getCenter().lng,L.getCenter().lat],zoom:L.getZoom(),pitch:L.getPitch(),rotation:L.getRotation()};(k=(w=h.current)==null?void 0:w.onZoom)==null||k.call(w,z),o!=null&&o.mapZoom&&g.emit(o.mapZoom,z)})}return()=>{if(C=!0,a.current){try{a.current.destroy()}catch{}a.current=null}f(null)}},[e.basemap,y]);const x=JSON.stringify(e.center),b=JSON.stringify(e.gestureConfig);d.useEffect(()=>{if(!u)return;const C=nt(e);try{u.setCenter(C.center)}catch{}try{u.setZoom(C.zoom)}catch{}try{u.setPitch(C.pitch)}catch{}try{u.setRotation(C.rotation)}catch{}y(u,C)},[u,x,e.zoom,e.pitch,e.rotation,b,y]);const v=d.useCallback(()=>{if(a.current)try{const C=a.current.map;C&&typeof C.resize=="function"&&C.resize()}catch{}},[]);return d.useEffect(()=>(window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)),[v]),s.jsx("div",{ref:c,className:i??"aimapui-container",style:l??{width:"100%",height:"100%"},children:u&&s.jsx(Fr,{scene:u,children:t})})}function Br(e){if(e.colorField)return{field:e.colorField,values:e.colorValues};if(e.color)return{values:e.color}}function uo(e){if(e.sizeField)return{field:e.sizeField,values:e.sizeValues};if(e.size!==void 0)return{values:e.size}}function Zr(e){if(e.shapeField)return{field:e.shapeField,values:e.shapeValues};if(e.shape)return{values:e.shape}}function St(e){return{color:Br(e),size:uo(e),shape:Zr(e),style:e.style?{...e.style}:void 0}}function fo(e){var t,r;return{data:e.source,options:{parser:{type:"json",x:((t=e.sourceConfig)==null?void 0:t.x)??"lng",y:((r=e.sourceConfig)==null?void 0:r.y)??"lat"}}}}function po(e){var t,r;return{data:e.source,options:{parser:{type:"csv",x:(t=e.sourceConfig)==null?void 0:t.x,y:(r=e.sourceConfig)==null?void 0:r.y}}}}function _t(e){return{data:e.source,options:void 0}}function mo(e){var t;return(t=e.sourceConfig)!=null&&t.parser?{data:e.source,options:{parser:e.sourceConfig.parser}}:e.sourceType==="geojson"?_t(e):e.sourceType==="csv"?po(e):fo(e)}function Vr(e){return{type:"PointLayer",sourceConfig:mo(e),visual:St(e),schema:e}}function Hr(e){return{type:"LineLayer",sourceConfig:ho(e),visual:St(e),schema:e}}function ho(e){var t,r,n,o,i,l,c,a,u,f;return(t=e.sourceConfig)!=null&&t.parser?{data:e.source,options:{parser:e.sourceConfig.parser}}:e.sourceType==="geojson"?_t(e):e.sourceType==="csv"?{data:e.source,options:{parser:{type:"csv",x:(r=e.sourceConfig)==null?void 0:r.x,y:(n=e.sourceConfig)==null?void 0:n.y,x1:(o=e.sourceConfig)==null?void 0:o.x1,y1:(i=e.sourceConfig)==null?void 0:i.y1}}}:{data:e.source,options:{parser:{type:"json",x:((l=e.sourceConfig)==null?void 0:l.x)??"lng",y:((c=e.sourceConfig)==null?void 0:c.y)??"lat",x1:(a=e.sourceConfig)==null?void 0:a.x1,y1:(u=e.sourceConfig)==null?void 0:u.y1,coordinates:(f=e.sourceConfig)==null?void 0:f.coordinates}}}}function Ur(e){return{type:"PolygonLayer",sourceConfig:go(e),visual:St(e),schema:e}}function go(e){var t;return e.sourceType==="geojson"?_t(e):{data:e.source,options:{parser:{type:"json",coordinates:((t=e.sourceConfig)==null?void 0:t.coordinates)??"coordinates"}}}}function Wr(e){return{type:"HeatmapLayer",sourceConfig:yo(e),visual:xo(e),schema:e}}function yo(e){var t,r,n,o,i,l,c,a;return(t=e.sourceConfig)!=null&&t.parser?{data:e.source,options:{parser:e.sourceConfig.parser,...e.sourceConfig.transforms?{transforms:e.sourceConfig.transforms}:{}}}:e.sourceType==="geojson"?{data:e.source,options:(r=e.sourceConfig)!=null&&r.transforms?{transforms:e.sourceConfig.transforms}:void 0}:e.sourceType==="csv"?{data:e.source,options:{parser:{type:"csv",x:(n=e.sourceConfig)==null?void 0:n.x,y:(o=e.sourceConfig)==null?void 0:o.y},...(i=e.sourceConfig)!=null&&i.transforms?{transforms:e.sourceConfig.transforms}:{}}}:{data:e.source,options:{parser:{type:"json",x:((l=e.sourceConfig)==null?void 0:l.x)??"lng",y:((c=e.sourceConfig)==null?void 0:c.y)??"lat"},...(a=e.sourceConfig)!=null&&a.transforms?{transforms:e.sourceConfig.transforms}:{}}}}function xo(e){const t=e.sizeField?{field:e.sizeField,values:e.sizeValues}:void 0,r=Br(e),n=Zr(e),o=e.style?{...e.style}:void 0;return{color:r,size:t,shape:n,style:o}}function Yr(e){return{type:"RasterLayer",sourceConfig:bo(e),visual:vo(e),schema:e}}function bo(e){var t;return(t=e.sourceConfig)!=null&&t.parser?{data:e.source,options:{parser:e.sourceConfig.parser}}:{data:e.source,options:e.sourceType==="raster"?{parser:{type:"raster",extent:[73.482190241,3.82501784112,135.106618732,53.557926206]}}:e.sourceType==="rasterTile"?{parser:{type:"rasterTile",tileSize:256,zoomOffset:1}}:void 0}}function vo(e){return{color:void 0,size:void 0,shape:void 0,style:e.style?{...e.style}:void 0}}function qr(e){var t;return{type:"ImageLayer",sourceConfig:{data:e.source,options:{parser:((t=e.sourceConfig)==null?void 0:t.parser)??(e.sourceType==="image"?{type:"image"}:void 0)}},visual:{color:void 0,size:void 0,shape:void 0,style:e.style?{...e.style}:void 0},schema:e}}function Et(e,t,r,n){const o=d.useRef(t),i=d.useRef(r);o.current=t,i.current=r;const l=d.useRef(n);l.current=n;const c=d.useRef(null),a=d.useRef(e);a.current=e;const u=d.useCallback(()=>{const m=a.current;if(m)try{const h=m.mapService;if(h){const g=h.lngLatToContainer([o.current,i.current]);g&&l.current(g.x,g.y)}else{const g=m.lngLatToContainer([o.current,i.current]);g&&l.current(g.x,g.y)}}catch{}},[]),f=d.useCallback(()=>{u()},[u]);d.useEffect(()=>{if(!e)return;const m=()=>{setTimeout(()=>u(),0)};return e.loaded?m():e.on("loaded",m),()=>{e.off("loaded",m)}},[e,u]),d.useEffect(()=>{u()},[t,r,u]),d.useEffect(()=>{if(e){try{const m=e.mapService;if(m)return m.on("camerachange",f),m.on("viewchange",f),()=>{m.off("camerachange",f),m.off("viewchange",f)}}catch{}return e.on("camerachange",f),e.on("resize",f),()=>{e.off("camerachange",f),e.off("resize",f)}}},[e,f]),d.useEffect(()=>()=>{c.current!==null&&(cancelAnimationFrame(c.current),c.current=null)},[])}function Gr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Gr(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function wo(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Gr(e))&&(n&&(n+=" "),n+=t);return n}function re(...e){return wo(e)}function jo(e,t=1){const r=e.replace("#","").match(/.{2}/g);if(!r||r.length<3)return e;const[n,o,i]=r.map(l=>parseInt(l,16));return`rgba(${n}, ${o}, ${i}, ${t})`}function Je(e){return typeof e=="string"&&/<[a-zA-Z][^>]*>/.test(e)}let We=null;const gt=new Set;function Co(e,t){We&&We!==e&>.forEach(r=>r(e)),We=e}function So(e){We===e&&(We=null)}function lr(e,t,r,n,o,i,l,c){if(l!=="auto")return ze(l,c);const a=t,u=i-t,f=e,m=o-e,h=8;if(a>=n+c+h)return ze("top",c);if(u>=n+c+h)return ze("bottom",c);if(m>=r+c+h)return ze("right",c);if(f>=r+c+h)return ze("left",c);const y=Object.entries({top:a,bottom:u,right:m,left:f}).sort((x,b)=>b[1]-x[1])[0][0];return ze(y,c)}function ze(e,t){switch(e){case"top":return{placement:"top",transform:`translate(-50%, -100%) translateY(-${t}px)`};case"bottom":return{placement:"bottom",transform:`translate(-50%, 0) translateY(${t}px)`};case"left":return{placement:"left",transform:`translate(-100%, -50%) translateX(-${t}px)`};case"right":return{placement:"right",transform:`translate(0, -50%) translateX(${t}px)`}}}function rt({onClick:e}){return s.jsx("button",{onClick:t=>{t.stopPropagation(),e()},className:"aimapui-popup-close-btn absolute top-2 right-2 size-8 flex items-center justify-center text-on-surface-variant rounded-lg transition-[color,background] duration-200 cursor-pointer bg-transparent border-none p-0 hover:text-on-surface hover:bg-surface-container-high [&_.material-symbols-outlined]:text-xl","aria-label":"关闭",children:s.jsx("span",{className:"material-symbols-outlined",children:"close"})})}const _o={top:"M0 0L8 8L16 0",bottom:"M0 8L8 0L16 8",left:"M0 0L8 8L0 16",right:"M8 0L0 8L8 16"};function Ke({placement:e}){const t=e==="top"||e==="bottom",r=t?16:8,n=t?8:16,o=t?"0 0 16 8":"0 0 8 16",i=_o[e];return s.jsx("div",{className:`aimapui-popup-tip-arrow aimapui-popup-tip-arrow--${e==="top"?"bottom":e==="bottom"?"top":e}`,children:s.jsxs("svg",{width:r,height:n,viewBox:o,fill:"none",children:[s.jsx("path",{d:i,fill:"rgba(248, 249, 255, 0.95)"}),s.jsx("path",{d:i,stroke:"rgba(195, 198, 215, 0.3)",strokeWidth:"0.5",fill:"none"})]})})}function Eo({header:e,onClose:t}){return e.coverUrl?s.jsxs("div",{className:"aimapui-popup-cover relative aspect-video overflow-hidden",children:[s.jsx("img",{src:e.coverUrl,alt:e.title,className:"w-full h-full object-cover"}),s.jsx("button",{className:"absolute top-2 right-2 size-8 bg-black/30 backdrop-blur-sm text-white flex items-center justify-center rounded-full border-none cursor-pointer transition-colors duration-200 z-10 hover:bg-black/50 [&_.material-symbols-outlined]:text-lg","aria-label":"关闭",onClick:r=>{r.stopPropagation(),t()},children:s.jsx("span",{className:"material-symbols-outlined",children:"close"})}),e.statusLabel&&s.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1.5 px-2 py-0.5 bg-surface/90 backdrop-blur-sm rounded-md shadow-sm text-[10px] font-semibold uppercase tracking-wide text-on-surface",children:[s.jsx("div",{className:"size-2 rounded-full",style:{background:e.statusColor||"#10b981"}}),s.jsx("span",{children:e.statusLabel})]})]}):null}function Lo({header:e,onClose:t,hasCover:r,showStatusDot:n}){return s.jsxs("div",{className:re("relative flex items-center p-4",!r&&"pr-10"),children:[n&&e.statusDot&&s.jsx("div",{className:"size-2 rounded-full shrink-0 mr-2 animate-pulse",style:{background:e.statusDot}}),s.jsx("h3",{className:"text-xl leading-7 font-semibold text-on-surface m-0 flex-1 min-w-0 truncate",children:e.title}),!r&&s.jsx(rt,{onClick:t})]})}function ko({attributes:e,size:t}){const r=t==="compact",n=t==="detailed",o=r?1:2;return s.jsx("div",{className:re(r?"flex flex-col":"grid gap-2"),style:r?void 0:{gridTemplateColumns:`repeat(${o}, 1fr)`},children:e.map((i,l)=>n&&i.icon?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-12 rounded-lg bg-surface-container-highest flex items-center justify-center text-primary shrink-0 [&_.material-symbols-outlined]:text-[28px]",children:s.jsx("span",{className:"material-symbols-outlined",children:i.icon})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm leading-5 text-on-surface-variant m-0",children:i.label}),s.jsx("p",{className:"text-sm leading-5 font-medium text-on-surface m-0",style:i.valueColor?{color:i.valueColor}:void 0,children:i.value})]})]},l):s.jsxs("div",{className:re("flex justify-between items-baseline gap-2",r&&"py-2 border-b border-outline-variant/30 last:border-b-0 last:pb-0 first:pt-0"),children:[s.jsx("p",{className:"text-sm leading-5 text-on-surface-variant m-0",children:i.label}),s.jsx("p",{className:"text-sm leading-5 font-medium text-on-surface m-0 text-right",style:i.valueColor?{color:i.valueColor}:void 0,children:i.value})]},l))})}function Mo({actions:e}){return s.jsx("div",{className:"flex gap-3 px-4 pb-4",children:e.map((t,r)=>s.jsx("button",{className:re("flex-1 py-2.5 text-sm leading-5 font-semibold rounded-lg border-none cursor-pointer transition-all duration-150 active:scale-[0.98]",t.variant==="secondary"?"bg-transparent text-on-surface border-2 border-solid border-outline-variant hover:bg-surface-container-low":"bg-primary text-on-primary shadow-sm hover:shadow-[0_4px_12px_rgba(0,74,198,0.3)]"),onClick:t.onClick,children:t.label},r))})}function Lt({longitude:e,latitude:t,content:r,closeButton:n=!0,size:o="standard",placement:i="auto",offset:l=8,header:c,attributes:a,actions:u,visible:f,singleton:m=!1,overlayContainer:h,onClose:g,className:y}){const x=fe(),b=f!==void 0,[v,C]=d.useState(!0),j=b?f:v,[_,L]=d.useState(!1),[z,w]=d.useState("top"),k=d.useRef(null),O=d.useRef(!0);d.useRef(!1);const M=d.useRef(Symbol("popup")),[A,T]=d.useState(null);d.useEffect(()=>{if(h||!x)return;const H=()=>{try{const U=x.mapService;if(U&&typeof U.getMarkerContainer=="function"){const W=U.getMarkerContainer();if(W)return T(W),!0}}catch{}return!1};if(H())return;const V=()=>{H()};return x.loaded?V():x.on("loaded",V),()=>{x.off("loaded",V)}},[x,h]);const S=h??A,E=d.useCallback(()=>{_||(L(!0),setTimeout(()=>{b||C(!1),g==null||g(),L(!1)},150))},[b,g,_]);d.useEffect(()=>{if(!m||!j)return;const H=M.current;return Co(H),()=>So(H)},[m,j,E]),d.useEffect(()=>{if(!m)return;const H=M.current,V=U=>{U!==H&&j&&E()};return gt.add(V),()=>{gt.delete(V)}},[m,j,E]);const R=d.useCallback(()=>{var V;const H=k.current;if(!(!H||!x))try{const U=x.mapService,W=U?U.lngLatToContainer([e,t]):x.lngLatToContainer([e,t]);if(W){const I=Math.round(W.x),q=Math.round(W.y);H.style.left="0",H.style.top="0";let J=0,Z=0;try{if(U){const ae=(V=U.getContainer)==null?void 0:V.call(U);ae&&(J=ae.scrollWidth||ae.clientWidth,Z=ae.scrollHeight||ae.clientHeight)}}catch{}const ue=H.querySelector(".aimapui-popup-content"),ne=(ue==null?void 0:ue.offsetWidth)||320,de=(ue==null?void 0:ue.offsetHeight)||200,{placement:ie,transform:X}=lr(I,q,ne,de,J,Z,i,l);w(ie),H.style.transform=`translate3d(${I}px, ${q}px, 0) ${X}`;let le=!0;J>0&&Z>0&&(le=I>=0&&I<=J&&q>=0&&q<=Z),O.current=le,H.style.visibility=le?"visible":"hidden"}}catch{}},[x,e,t,i,l]);if(d.useEffect(()=>{if(!S||!j)return;const H=requestAnimationFrame(()=>{R()});return()=>cancelAnimationFrame(H)},[S,j,R]),d.useEffect(()=>{if(!j)return;const H=V=>{V.key==="Escape"&&E()};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[j,E]),d.useEffect(()=>{var W;if(!j||!S)return;const H=I=>{const q=k.current;if(!q||q.contains(I.target))return;const J=I.target;J.closest(".aimapui-marker")||J.closest("[data-marker]")||E()};let V=null;try{const I=x==null?void 0:x.mapService;I&&(V=(W=I.getContainer)==null?void 0:W.call(I))}catch{}const U=V||S.parentElement||S;return U.addEventListener("click",H,!0),()=>U.removeEventListener("click",H,!0)},[j,S,x,E]),Et(x,e,t,(H,V)=>{var le;const U=k.current;if(!U)return;const W=Math.round(H),I=Math.round(V);let q=0,J=0;try{const ae=x==null?void 0:x.mapService;if(ae){const se=(le=ae.getContainer)==null?void 0:le.call(ae);se&&(q=se.scrollWidth||se.clientWidth,J=se.scrollHeight||se.clientHeight)}}catch{}const Z=U.querySelector(".aimapui-popup-content"),ue=(Z==null?void 0:Z.offsetWidth)||320,ne=(Z==null?void 0:Z.offsetHeight)||200,{placement:de,transform:ie}=lr(W,I,ue,ne,q,J,i,l);w(de);let X=!0;q>0&&J>0&&(X=W>=0&&W<=q&&I>=0&&I<=J),O.current=X,U.style.left="0",U.style.top="0",U.style.transform=`translate3d(${W}px, ${I}px, 0) ${ie}`,U.style.visibility=X?"visible":"hidden"}),!j||!S)return null;const P=c||a||u,B=!!(c!=null&&c.coverUrl),D=z==="left"||z==="right",F=()=>P?s.jsxs(s.Fragment,{children:[c&&B&&s.jsx(Eo,{header:c,onClose:E}),c&&s.jsx(Lo,{header:c,onClose:E,hasCover:B,showStatusDot:o==="compact"}),s.jsxs("div",{className:re("aimapui-popup-body relative p-4 text-sm leading-5 text-on-surface break-words whitespace-normal",!c&&n&&"pr-10"),children:[!c&&n&&s.jsx(rt,{onClick:E}),r&&!Je(r)&&typeof r!="string"&&s.jsx("div",{children:r}),r&&Je(r)&&s.jsx("div",{dangerouslySetInnerHTML:{__html:r}}),r&&!Je(r)&&typeof r=="string"&&s.jsx("div",{children:r}),!r&&!(a!=null&&a.length)&&!(u!=null&&u.length)&&!c&&s.jsx("div",{style:{color:"var(--color-on-surface-variant)"},children:"无内容"}),a&&a.length>0&&s.jsx(ko,{attributes:a,size:o})]}),u&&u.length>0&&s.jsx(Mo,{actions:u})]}):Je(r)?s.jsxs("div",{className:"aimapui-popup-body relative p-4 pt-2 pr-10 text-sm leading-5 text-on-surface break-words whitespace-normal",children:[n&&s.jsx(rt,{onClick:E}),s.jsx("div",{dangerouslySetInnerHTML:{__html:r}})]}):s.jsxs("div",{className:"aimapui-popup-body relative p-4 pt-2 pr-10 text-sm leading-5 text-on-surface break-words whitespace-normal",children:[n&&s.jsx(rt,{onClick:E}),s.jsx("div",{children:r??""})]}),G=D?{display:"flex",alignItems:"center"}:{display:"flex",flexDirection:"column",alignItems:"center"};return wt.createPortal(s.jsxs("div",{ref:k,className:re("aimapui-popup",`aimapui-popup--${o}`),style:{position:"absolute",left:0,top:0,transform:"translate(-9999px, -9999px)",visibility:"hidden",zIndex:30,pointerEvents:"auto",...G},children:[z==="bottom"&&s.jsx(Ke,{placement:z}),z==="right"&&s.jsx(Ke,{placement:z}),s.jsx("div",{className:re("aimapui-popup-content overflow-hidden rounded-xl",_&&"aimapui-popup-content--exit",y),children:F()}),z==="top"&&s.jsx(Ke,{placement:z}),z==="left"&&s.jsx(Ke,{placement:z})]}),S)}const To={top:"bottom",bottom:"top",left:"right",right:"left"},cr={top:"translate(-50%, -100%)",bottom:"translate(-50%, 0)",left:"translate(-100%, -50%)",right:"translate(0, -50%)"};function Jr({content:e,variant:t="dark",longitude:r,latitude:n,targetElement:o,placement:i="top",offset:l=8,trigger:c="hover",visible:a,title:u,items:f,overlayContainer:m,className:h}){const{resolvedTheme:g}=zr(),y=fe(),x=a!==void 0,[b,v]=d.useState(!1),C=x?a:b,j=d.useRef(null),_=d.useRef(null),L=r!==void 0&&n!==void 0;d.useEffect(()=>{if(L||!o||x)return;const S=()=>{_.current=setTimeout(()=>v(!0),100)},E=()=>{_.current&&(clearTimeout(_.current),_.current=null),v(!1)},R=()=>{_.current&&clearTimeout(_.current),v(P=>!P)};return c==="hover"?(o.addEventListener("mouseenter",S),o.addEventListener("mouseleave",E)):o.addEventListener("click",R),()=>{_.current&&clearTimeout(_.current),o.removeEventListener("mouseenter",S),o.removeEventListener("mouseleave",E),o.removeEventListener("click",R)}},[o,c,L,x]);const z=d.useCallback(()=>{if(!o||!j.current)return;const S=o.getBoundingClientRect(),E=j.current.getBoundingClientRect();let R=0,P=0;switch(i){case"right":R=S.right+l,P=S.top+S.height/2-E.height/2;break;case"bottom":R=S.left+S.width/2-E.width/2,P=S.bottom+l;break;case"left":R=S.left-E.width-l,P=S.top+S.height/2-E.height/2;break;case"top":default:R=S.left+S.width/2-E.width/2,P=S.top-E.height-l;break}const B=8;R=Math.max(B,Math.min(R,window.innerWidth-E.width-B)),P=Math.max(B,Math.min(P,window.innerHeight-E.height-B)),j.current.style.left=`${R}px`,j.current.style.top=`${P}px`},[o,i,l]);d.useEffect(()=>{if(L||!C||!o)return;z();const S=()=>z();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[C,o,L,z]);const w=d.useCallback(()=>{var S,E,R;if(!y)return{left:0,top:0};try{const P=y.mapService,B=((S=P==null?void 0:P.getMarkerContainer)==null?void 0:S.call(P))??((E=y.getMapContainer)==null?void 0:E.call(y))??y.container??((R=y.getContainer)==null?void 0:R.call(y));if(B instanceof HTMLElement){const D=B.getBoundingClientRect();return{left:D.left,top:D.top}}}catch{}return{left:0,top:0}},[y]),k=d.useCallback(()=>{const S=j.current;if(!(!S||!y||!L))try{const E=y.mapService,R=E?E.lngLatToContainer([r,n]):y.lngLatToContainer([r,n]);if(!R||isNaN(R.x)||isNaN(R.y))return;let P=0,B=0;switch(i){case"top":B=-l;break;case"bottom":B=l;break;case"left":P=-l;break;case"right":P=l;break}const D=w(),F=Math.round(R.x+P+D.left),G=Math.round(R.y+B+D.top),H=cr[i];S.style.transform=`translate3d(${F}px, ${G}px, 0) ${H}`,S.style.visibility="visible"}catch{}},[y,r,n,i,l,L,w]);if(d.useEffect(()=>{if(!L||!C)return;const S=requestAnimationFrame(()=>k());return()=>cancelAnimationFrame(S)},[C,L,k]),Et(L?y:null,r??0,n??0,(S,E)=>{const R=j.current;if(!R||!L)return;let P=0,B=0;switch(i){case"top":B=-l;break;case"bottom":B=l;break;case"left":P=-l;break;case"right":P=l;break}const D=w(),F=Math.round(S+P+D.left),G=Math.round(E+B+D.top),H=cr[i];R.style.transform=`translate3d(${F}px, ${G}px, 0) ${H}`,R.style.visibility="visible"}),!C)return null;const O=To[i],M=u||f&&f.length>0,A=()=>e?typeof e=="string"?s.jsx("span",{dangerouslySetInnerHTML:{__html:e}}):e:M?s.jsxs(s.Fragment,{children:[u&&s.jsx("p",{className:"font-sans text-xs leading-4 font-semibold m-0 mb-0.5",children:u}),f&&f.length>0&&s.jsx("div",{className:"flex flex-col gap-0.5",children:f.map((S,E)=>s.jsxs("div",{className:"flex justify-between items-center gap-3",children:[s.jsx("span",{className:"text-xs leading-4 font-normal opacity-70 m-0",children:S.label}),s.jsx("span",{className:"font-mono text-xs leading-4 font-[450] text-right m-0",children:S.value})]},E))})]}):null,T=s.jsxs("div",{ref:j,"data-theme":g,className:re("aimapui-tooltip",t!=="dark"&&`aimapui-tooltip--${t}`),style:{position:"fixed",left:0,top:0,transform:"translate(-9999px, -9999px)",visibility:"hidden",zIndex:9999,pointerEvents:"none"},children:[s.jsx("div",{className:re("aimapui-tooltip-content",h),children:A()}),s.jsx("div",{className:`aimapui-tooltip-arrow aimapui-tooltip-arrow--${O}`})]});return wt.createPortal(T,document.body)}function No(e,t){let r;switch(e.type){case"point":r=Vr(e);break;case"line":r=Hr(e);break;case"polygon":r=Ur(e);break;case"heatmap":r=Wr(e);break;case"raster":r=Yr(e);break;case"image":r=qr(e);break;default:return console.warn(`[aimapui] Unknown layer type: ${e.type}`),null}return Ro(r)}async function Ro(e,t){var m;const n=(await import("@antv/l7"))[e.type];if(!n)throw new Error(`[aimapui] L7 layer class "${e.type}" not found`);const o=new n({...e.schema.zIndex!==void 0?{zIndex:e.schema.zIndex}:{},...e.schema.name?{name:e.schema.name}:{}}),{data:i,options:l}=e.sourceConfig;l?o.source(i,l):o.source(i);const{color:c,size:a,shape:u,style:f}=e.visual;if(c&&(c.field&&c.values?o.color(c.field,c.values):c.values&&o.color(c.values)),a&&(a.field&&a.values?o.size(a.field,a.values):a.values!==void 0&&o.size(a.values)),u&&(u.field&&u.values?o.shape(u.field,u.values):u.values&&o.shape(u.values)),f&&Object.keys(f).length>0&&o.style(f),e.type==="PointLayer"&&!u&&o.shape("circle"),e.type==="LineLayer"&&!u&&o.shape("line"),e.schema.filterField&&e.schema.filterValues){const h=e.schema.filterField,g=e.schema.filterValues;o.filter(h,y=>g.includes(y))}return(m=e.schema.animate)!=null&&m.enable&&o.animate(!0,e.schema.animate),e.schema.active&&o.active(e.schema.active),e.schema.select&&o.select(e.schema.select),e.schema.opacity!==void 0&&o.style({opacity:e.schema.opacity}),e.schema.blend&&o.blend(e.schema.blend),e.schema.visible===!1&&o.hide(),e.schema.minZoom!==void 0&&o.minZoom(e.schema.minZoom),e.schema.maxZoom!==void 0&&o.maxZoom(e.schema.maxZoom),o}function Xe(e,t,r){var c,a,u,f,m,h,g,y;const n=r,o=Number.isFinite((c=n==null?void 0:n.lnglat)==null?void 0:c.lng)?n.lnglat.lng:Number.isFinite((a=n==null?void 0:n.lngLat)==null?void 0:a.lng)?n.lngLat.lng:Number.isFinite((u=n==null?void 0:n.coordinate)==null?void 0:u.lng)?n.coordinate.lng:0,i=Number.isFinite((f=n==null?void 0:n.lnglat)==null?void 0:f.lat)?n.lnglat.lat:Number.isFinite((m=n==null?void 0:n.lngLat)==null?void 0:m.lat)?n.lngLat.lat:Number.isFinite((h=n==null?void 0:n.coordinate)==null?void 0:h.lat)?n.coordinate.lat:0,l=((g=n==null?void 0:n.feature)==null?void 0:g.properties)??(n==null?void 0:n.feature)??((y=n==null?void 0:n.data)==null?void 0:y.properties)??(n==null?void 0:n.data)??void 0;return{layerId:e,layerType:t,originalEvent:r,lng:o,lat:i,feature:l}}function Ie({schema:e,scene:t,eventHandlers:r}){const n=d.useRef(null),o=Ct(),i=d.useRef(r);i.current=r;const l=d.useMemo(()=>{const{source:u,...f}=e;let m;if(ArrayBuffer.isView(u))m=`TypedArray:${u.length}`;else if(u&&typeof u=="object"&&"width"in u){const h=u;m=`Rasters:${h.width}x${h.height}:${h.length}`}else if(typeof u=="string")m=u;else try{m=JSON.stringify(u)}catch{m=String(u)}return m+"|"+Io(f)},[e]),[c,a]=d.useState({visible:!1,lng:0,lat:0,content:"",trigger:"click"});return d.useEffect(()=>{var f;let u=!1;return(f=No(e))==null||f.then(m=>{var z,w,k,O;if(u)return;n.current=m;const h=e.id??e.name??`layer-${e.type}`,g=e.events,y=!!(g!=null&&g.enablePopup),x=(g==null?void 0:g.popupTrigger)??"click",b=M=>{if(!y)return;const A=M.feature;if(!A)return;const T=Ao(A,g==null?void 0:g.popupFields,g==null?void 0:g.popupTemplate);a({visible:!0,lng:M.lng,lat:M.lat,content:T,trigger:x})},v=()=>{a(M=>({...M,visible:!1}))},C=!!((z=i.current)!=null&&z.onClick||g!=null&&g.click||y&&x==="click"),j=!!((w=i.current)!=null&&w.onMouseMove||g!=null&&g.mousemove||y&&x==="hover"),_=!!((k=i.current)!=null&&k.onMouseEnter||g!=null&&g.mouseenter),L=!!((O=i.current)!=null&&O.onMouseLeave||g!=null&&g.mouseleave||y&&x==="hover");C&&m.on("click",M=>{var T,S;const A=Xe(h,e.type,M);(S=(T=i.current)==null?void 0:T.onClick)==null||S.call(T,A),g!=null&&g.click&&o.emit(g.click,A),x==="click"&&b(A)}),j&&m.on("mousemove",M=>{var T,S;const A=Xe(h,e.type,M);(S=(T=i.current)==null?void 0:T.onMouseMove)==null||S.call(T,A),x==="hover"&&b(A),g!=null&&g.mousemove&&o.emit(g.mousemove,A)}),_&&m.on("mouseenter",M=>{var T,S;const A=Xe(h,e.type,M);(S=(T=i.current)==null?void 0:T.onMouseEnter)==null||S.call(T,A),g!=null&&g.mouseenter&&o.emit(g.mouseenter,A)}),L&&m.on("mouseleave",M=>{var T,S;const A=Xe(h,e.type,M);(S=(T=i.current)==null?void 0:T.onMouseLeave)==null||S.call(T,A),x==="hover"&&v(),g!=null&&g.mouseleave&&o.emit(g.mouseleave,A)}),t.addLayer(m),m.on("inited",()=>{u||(e.autoFit&&t.fitBounds(m.getBounds()),t.render())})}).catch(m=>{u||console.error(`[aimapui] Failed to create layer "${e.id??e.name??e.type}":`,m)}),()=>{if(u=!0,n.current){try{t.removeLayer(n.current)}catch{}n.current=null}a(m=>({...m,visible:!1}))}},[l,t,o]),d.useEffect(()=>{n.current&&(e.visible===!1?n.current.hide():n.current.show(),e.zIndex!==void 0&&n.current.zIndex(e.zIndex))},[e.visible,e.zIndex]),c.visible?c.trigger==="hover"?s.jsx(Jr,{longitude:c.lng,latitude:c.lat,content:c.content,variant:"dark",placement:"top",visible:!0}):s.jsx(Lt,{longitude:c.lng,latitude:c.lat,content:c.content,closeButton:!0,size:"compact",onClose:()=>a(u=>({...u,visible:!1}))}):null}function Io(e){return JSON.stringify(yt(e))}function yt(e){if(ArrayBuffer.isView(e))return`[TypedArray:${e.length}]`;if(e instanceof ArrayBuffer)return`[ArrayBuffer:${e.byteLength}]`;if(Array.isArray(e))return e.length>1e3?`[Array:${e.length}]`:e.map(yt);if(e&&typeof e=="object"){const t=e,r=Object.keys(t).sort(),n={};return r.forEach(o=>{n[o]=yt(t[o])}),n}return e}function Ao(e,t,r){return r?r.replace(/\{\{(\w+)\}\}/g,(i,l)=>String(e[l]??"")):`<table style="font-size:12px">${(t??Object.keys(e).filter(i=>!["_id","id","geometry","coordinates"].includes(i))).map(i=>`<tr><td style="font-weight:600;padding-right:8px">${i}</td><td>${e[i]??""}</td></tr>`).join("")}</table>`}function Kr({layers:e,eventHandlers:t}){const r=fe();return r?s.jsx(s.Fragment,{children:e.map((n,o)=>s.jsx(Ie,{schema:n,scene:r,eventHandlers:t},n.id??`layer-${o}`))}):null}const Xr=d.createContext(!1);function _e(){return d.useContext(Xr)}const ut=new Set,we={mark(e){e&&typeof e=="object"&&"$$typeof"in e&&ut.add(e),e&&typeof e=="function"&&ut.add(e)},check(e){if("position"in e.props)return!0;const t=e.type;if(ut.has(t))return!0;const r=t==null?void 0:t.displayName;return!!(typeof r=="string"&&r.endsWith("Control"))}};function kt({children:e,className:t,style:r}){const{controlGroups:n,otherChildren:o}=Po(e);return s.jsx(Xr.Provider,{value:!0,children:s.jsxs("div",{className:`l7-control-container${t?` ${t}`:""}`,style:r,children:[Object.entries(n).map(([i,l])=>{const c=Oo(i);return s.jsx("div",{className:`l7-control-anchor ${c}`,children:l},i)}),o]})})}function Po(e){const t={},r=[];return d.Children.forEach(e,(n,o)=>{var i;if(!d.isValidElement(n)){r.push(n);return}if(we.check(n)){const l=((i=n.props)==null?void 0:i.position)??"topright";t[l]||(t[l]=[]),t[l].push(n)}else r.push(d.isValidElement(n)?d.cloneElement(n,{key:n.key??`non-ctrl-${o}`}):n)}),{controlGroups:t,otherChildren:r}}function zo(e){switch(e){case"topleft":return{vSide:"top",hSide:"left",direction:"column"};case"topright":return{vSide:"top",hSide:"right",direction:"column"};case"bottomleft":return{vSide:"bottom",hSide:"left",direction:"column"};case"bottomright":return{vSide:"bottom",hSide:"right",direction:"column"};case"topcenter":return{vSide:"top",hSide:"left",direction:"row"};case"bottomcenter":return{vSide:"bottom",hSide:"left",direction:"row"};case"lefttop":return{vSide:"top",hSide:"left",direction:"row"};case"leftbottom":return{vSide:"bottom",hSide:"left",direction:"row"};case"righttop":return{vSide:"top",hSide:"right",direction:"row"};case"rightbottom":return{vSide:"bottom",hSide:"right",direction:"row"};default:return{vSide:"top",hSide:"right",direction:"column"}}}function Oo(e){if(e==="rightcenter")return"l7-rightcenter l7-column";if(e==="leftcenter")return"l7-leftcenter l7-column";const{vSide:t,hSide:r,direction:n}=zo(e);return`l7-${t} l7-${r} l7-${n}`}function Ee(e){const t=fe(),r=d.useMemo(()=>{if(!t)return null;try{return t.mapService??null}catch{return null}},[t]),n=d.useCallback(()=>{var i;if(!t)return null;try{return r&&typeof r.getContainer=="function"?r.getContainer():((i=t.getContainer)==null?void 0:i.call(t))??null}catch{return null}},[t,r]),o=d.useMemo(()=>{if(e==="rightcenter")return"l7-rightcenter l7-column";if(e==="leftcenter")return"l7-leftcenter l7-column";const{vSide:i,hSide:l,direction:c}=Fo(e??"topright");return`l7-${i} l7-${l} l7-${c}`},[e]);return{scene:t,mapsService:r,getMapContainer:n,positionClassName:o}}function Fo(e){switch(e){case"topleft":return{vSide:"top",hSide:"left",direction:"column"};case"topright":return{vSide:"top",hSide:"right",direction:"column"};case"bottomleft":return{vSide:"bottom",hSide:"left",direction:"column"};case"bottomright":return{vSide:"bottom",hSide:"right",direction:"column"};case"topcenter":return{vSide:"top",hSide:"left",direction:"row"};case"bottomcenter":return{vSide:"bottom",hSide:"left",direction:"row"};case"lefttop":return{vSide:"top",hSide:"left",direction:"row"};case"leftbottom":return{vSide:"bottom",hSide:"left",direction:"row"};case"righttop":return{vSide:"top",hSide:"right",direction:"row"};case"rightbottom":return{vSide:"bottom",hSide:"right",direction:"row"};case"rightcenter":return{vSide:"top",hSide:"right",direction:"column"};case"leftcenter":return{vSide:"top",hSide:"left",direction:"column"};default:return{vSide:"top",hSide:"right",direction:"column"}}}function Mt({position:e="bottomright",zoomInText:t,zoomInTitle:r="Zoom in",zoomOutText:n,zoomOutTitle:o="Zoom out",showZoom:i=!1,className:l,style:c}){const{mapsService:a,positionClassName:u}=Ee(e),f=_e(),[m,h]=d.useState(0),[g,y]=d.useState(!0),[x,b]=d.useState(!0),v=d.useRef(()=>{if(!a)return;const L=Math.floor(a.getZoom());h(L),y(a.getZoom()<a.getMaxZoom()),b(a.getZoom()>a.getMinZoom())});d.useEffect(()=>{if(!a)return;v.current();const L=()=>v.current();return a.on("zoomend",L),a.on("zoomchange",L),()=>{a.off("zoomend",L),a.off("zoomchange",L)}},[a]);const C=()=>{a&&a.getZoom()<a.getMaxZoom()&&a.zoomIn()},j=()=>{a&&a.getZoom()>a.getMinZoom()&&a.zoomOut()},_=s.jsxs("div",{className:`l7-control l7-control-zoom l7-control--glass${l?` ${l}`:""}`,style:c,children:[s.jsx("button",{className:"l7-button-control",onClick:C,disabled:!g,title:r,"aria-label":r,children:t??s.jsx("span",{className:"material-symbols-outlined",children:"add"})}),i&&s.jsx("button",{className:"l7-button-control l7-control-zoom__number",disabled:!0,children:m}),s.jsx("button",{className:"l7-button-control",onClick:j,disabled:!x,title:o,"aria-label":o,children:n??s.jsx("span",{className:"material-symbols-outlined",children:"remove"})})]});return f?_:s.jsx("div",{className:`l7-control-anchor ${u}`,children:_})}we.mark(Mt);function $o(e,t){const[r,n]=e,[o,i]=t,l=63710088e-1,c=(i-n)*Math.PI/180,a=(o-r)*Math.PI/180,u=Math.sin(c/2)*Math.sin(c/2)+Math.cos(n*Math.PI/180)*Math.cos(i*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2),f=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u));return l*f}function dt(e){const t=Math.pow(10,Math.floor(Math.abs(e)).toString().length-1);let r=e/t;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:1,t*r}function Tt({position:e="bottomleft",maxWidth:t=100,metric:r=!0,imperial:n=!1,updateWhenIdle:o=!1,className:i,style:l}){const{mapsService:c,positionClassName:a}=Ee(e),u=_e(),[f,m]=d.useState([]),h=d.useRef(()=>{if(c)try{const x=c.getSize()[1]/2,b=c.containerToLngLat([0,x]),v=c.containerToLngLat([t,x]);if(!b||!v)return;const C=$o([b.lng,b.lat],[v.lng,v.lat]),j=[];if(r&&C){const _=dt(C),L=_<1e3?`${_} m`:`${_/1e3} km`;j.push({text:L,width:Math.round(t*(_/C))})}if(n&&C){const _=C*3.2808399;if(_>5280){const L=_/5280,z=dt(L);j.push({text:`${z} mi`,width:Math.round(t*(z/L))})}else{const L=dt(_);j.push({text:`${L} ft`,width:Math.round(t*(L/_))})}}m(j)}catch{}});d.useEffect(()=>{if(!c)return;h.current();const y=()=>h.current(),x=o?"moveend":"mapmove",b=o?"zoomend":"zoomchange";return c.on(x,y),c.on(b,y),()=>{c.off(x,y),c.off(b,y)}},[c,t,r,n,o]);const g=s.jsx("div",{className:`l7-control l7-control-scale l7-control--glass${i?` ${i}`:""}`,style:l,children:f.map((y,x)=>s.jsx("div",{className:"l7-control-scale-line",style:{width:y.width},children:y.text},x))});return u?g:s.jsx("div",{className:`l7-control-anchor ${a}`,children:g})}we.mark(Tt);function Nt({position:e="topright",container:t,className:r,style:n}){const{getMapContainer:o,positionClassName:i}=Ee(e),l=_e(),[c,a]=d.useState(!1),u=d.useCallback(()=>t??o()??document.documentElement,[t,o]),f=d.useCallback(()=>{const h=u();c?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():h.requestFullscreen?h.requestFullscreen():h.webkitRequestFullscreen&&h.webkitRequestFullscreen()},[c,u]);d.useEffect(()=>{const h=()=>{a(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",h),()=>document.removeEventListener("fullscreenchange",h)},[]);const m=s.jsx("div",{className:`l7-control l7-control--glass${r?` ${r}`:""}`,style:n,children:s.jsx("button",{className:"l7-button-control",onClick:f,title:c?"退出全屏":"全屏","aria-label":c?"退出全屏":"全屏",children:s.jsx("span",{className:"material-symbols-outlined",children:c?"fullscreen_exit":"fullscreen"})})});return l?m:s.jsx("div",{className:`l7-control-anchor ${i}`,children:m})}we.mark(Nt);function Rt({position:e="topright",transform:t,className:r,style:n}){const{mapsService:o,positionClassName:i}=Ee(e),l=_e(),c=d.useCallback(async()=>{if(!window.navigator.geolocation){console.warn("[aimapui] Geolocation is not supported by this browser");return}if(o)try{const u=await new Promise((x,b)=>{window.navigator.geolocation.getCurrentPosition(({coords:v})=>x(v),v=>b(v))}),{longitude:f,latitude:m}=u;if(isNaN(f)||isNaN(m))return;const h=[f,m],g=t?await t(h):h,y=o.getZoom();o.setZoomAndCenter(y>15?y:15,g)}catch(u){console.warn("[aimapui] Geolocation error:",u)}},[o,t]),a=s.jsx("div",{className:`l7-control l7-control--glass${r?` ${r}`:""}`,style:n,children:s.jsx("button",{className:"l7-button-control",onClick:c,title:"定位","aria-label":"定位",children:s.jsx("span",{className:"material-symbols-outlined",children:"my_location"})})});return l?a:s.jsx("div",{className:`l7-control-anchor ${i}`,children:a})}we.mark(Rt);const xt=[{text:"Standard",value:"normal",preview:"linear-gradient(135deg, #e8e8e8 0%, #c8d8e8 40%, #a8c8d8 100%)"},{text:"Light",value:"light",preview:"linear-gradient(135deg, #f0f4f8 0%, #d6e4f0 40%, #e8eff5 100%)"},{text:"Dark",value:"dark",preview:"linear-gradient(135deg, #0d1b2a 0%, #1b2838 40%, #162032 100%)"},{text:"Dark Blue",value:"darkblue",preview:"linear-gradient(135deg, #0a1628 0%, #0f2040 40%, #091a30 100%)"},{text:"Satellite",value:"satellite",preview:"linear-gradient(135deg, #1a3a1a 0%, #2d5a2d 40%, #1d4a2d 100%)"},{text:"Fresh",value:"fresh",preview:"linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 40%, #d4edda 100%)"}],Do=[{text:"Positron",value:"https://tiles.openfreemap.org/styles/positron",preview:"linear-gradient(135deg, #f2f3f0 0%, #d8dcd6 40%, #e8ebe5 100%)"},{text:"Bright",value:"https://tiles.openfreemap.org/styles/bright",preview:"linear-gradient(135deg, #e8e8e8 0%, #c8d8e8 40%, #a8c8d8 100%)"},{text:"Dark",value:"https://tiles.openfreemap.org/styles/dark",preview:"linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%)"},{text:"Liberty",value:"https://tiles.openfreemap.org/styles/liberty",preview:"linear-gradient(135deg, #f0ece2 0%, #dfd7c8 40%, #c8bfad 100%)"},{text:"Fiord",value:"https://tiles.openfreemap.org/styles/fiord",preview:"linear-gradient(135deg, #2c3e50 0%, #34495e 40%, #415b76 100%)"}],Bo=[{text:"Light",value:"light",preview:"linear-gradient(135deg, #f0f4f8 0%, #d6e4f0 40%, #e8eff5 100%)"},{text:"Dark",value:"dark",preview:"linear-gradient(135deg, #0d1b2a 0%, #1b2838 40%, #162032 100%)"},{text:"Normal",value:"normal",preview:"linear-gradient(135deg, #e8e8e8 0%, #c8d8e8 40%, #a8c8d8 100%)"}];function It({position:e="topright",options:t,defaultValue:r,onThemeChange:n,className:o,style:i}){const{mapsService:l,positionClassName:c}=Ee(e),a=_e(),[u,f]=d.useState(!1),[m,h]=d.useState(r??""),[g,y]=d.useState(t??[]),x=d.useRef(null);d.useEffect(()=>{var j;if(t&&t.length>0){y(t);return}if(l){try{const _=(j=l.getMapStyleConfig)==null?void 0:j.call(l);if(_&&typeof _=="object"){const L=Object.entries(_).filter(([,z])=>typeof z=="string").map(([z,w])=>{const k=xt.find(O=>O.value===w);return{text:z,value:w,preview:k==null?void 0:k.preview}});if(L.length>0){y(L);return}}}catch{}y(xt)}},[l,t]),d.useEffect(()=>{var j;if(r){h(r);return}if(l)try{const _=(j=l.getMapStyle)==null?void 0:j.call(l);_&&h(_)}catch{}},[l,r]),d.useEffect(()=>{if(!u)return;const j=_=>{x.current&&!x.current.contains(_.target)&&f(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[u]);const b=d.useCallback(j=>{if(h(j),l)try{l.setMapStyle(j)}catch{}n==null||n(j)},[l,n]),v=Zo(e),C=s.jsxs("div",{ref:x,className:`l7-control l7-control--glass${o?` ${o}`:""}`,style:i,children:[s.jsx("button",{className:"l7-button-control",onClick:()=>f(!u),title:"地图样式","aria-label":"地图样式",children:s.jsx("span",{className:"material-symbols-outlined",children:"palette"})}),u&&g.length>0&&s.jsx("div",{className:`l7-popper ${v}`,children:s.jsxs("div",{className:"l7-popper-content l7-theme-panel",children:[s.jsxs("div",{className:"l7-theme-panel__title",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"palette"}),"Map Themes"]}),s.jsx("div",{className:"l7-theme-panel__grid",children:g.map(j=>{const _=m===j.value,L=j.preview??"linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%)";return s.jsxs("button",{className:`l7-theme-card${_?" l7-theme-card--active":""}`,onClick:()=>b(j.value),title:j.text,children:[s.jsx("div",{className:"l7-theme-card__preview",style:{background:L}}),_&&s.jsx("span",{className:"material-symbols-outlined l7-theme-card__check",style:{fontVariationSettings:"'FILL' 1"},children:"check_circle"}),s.jsx("span",{className:"l7-theme-card__label",children:j.text})]},j.value)})})]})})]});return a?C:s.jsx("div",{className:`l7-control-anchor ${c}`,children:C})}function Zo(e){switch(e){case"topleft":return"l7-popper-right l7-popper-start";case"topright":return"l7-popper-left l7-popper-start";case"bottomleft":return"l7-popper-right l7-popper-end";case"bottomright":return"l7-popper-left l7-popper-end";case"lefttop":return"l7-popper-bottom l7-popper-start";case"leftbottom":return"l7-popper-top l7-popper-start";case"righttop":return"l7-popper-bottom l7-popper-end";case"rightbottom":return"l7-popper-top l7-popper-end";default:return"l7-popper-bottom"}}we.mark(It);function At({position:e="bottomleft",precision:t=6,transform:r,className:n,style:o}){const l=r??(([h,g])=>[+h.toFixed(t),+g.toFixed(t)]),{mapsService:c,positionClassName:a}=Ee(e),u=_e(),f=d.useRef(null);d.useEffect(()=>{if(!c)return;const h=g=>{const y=g.lngLat??g.lnglat;if(!y)return;const x=[y.lng,y.lat],b=l(x);f.current&&(f.current.innerText=b.join(", "))};return c.on("mousemove",h),()=>{c.off("mousemove",h)}},[c,l]);const m=s.jsx("div",{ref:f,className:`l7-control l7-control-mouse-location l7-control--glass${n?` ${n}`:""}`,style:o,children:" "});return u?m:s.jsx("div",{className:`l7-control-anchor ${a}`,children:m})}we.mark(At);function Pt({position:e="topright",format:t="png",onExport:r,className:n,style:o}){const{scene:i,mapsService:l,positionClassName:c}=Ee(e),a=_e(),u=t==="jpg"?"jpeg":"png",f=d.useCallback(async()=>{var g,y;try{const x=l?await((g=l.exportMap)==null?void 0:g.call(l,u)):void 0,b=i?await((y=i.exportPng)==null?void 0:y.call(i,u)):void 0,v=[x,b].filter(C=>!!C);return v.length===0?void 0:v.length===1?v[0]:Vo(v,u)}catch{return}},[i,l,u]),m=d.useCallback(async()=>{var y;const g=await f();if(r&&g){r(g);return}if(g){const x=document.createElement("a");x.download=`aimap-export.${u==="jpeg"?"jpg":"png"}`,x.href=g,x.click()}else try{if(l){const x=(y=l.getContainer)==null?void 0:y.call(l),b=x==null?void 0:x.querySelector("canvas");if(b&&typeof b.toDataURL=="function"){const v=b.toDataURL(`image/${u}`),C=document.createElement("a");C.download=`aimap-export.${u==="jpeg"?"jpg":"png"}`,C.href=v,C.click()}}}catch(x){console.warn("[aimapui] Export image failed:",x)}},[f,r,u,l]),h=s.jsx("div",{className:`l7-control l7-control--glass${n?` ${n}`:""}`,style:o,children:s.jsx("button",{className:"l7-button-control",onClick:m,title:"导出图片","aria-label":"导出图片",children:s.jsx("span",{className:"material-symbols-outlined",children:"photo_camera"})})});return a?h:s.jsx("div",{className:`l7-control-anchor ${c}`,children:h})}async function Vo(e,t){const r=document.querySelector(".l7-map")||document.documentElement,{width:n=0,height:o=0}=r.getBoundingClientRect(),i=document.createElement("canvas");i.width=n,i.height=o;const l=i.getContext("2d");return(await Promise.all(e.map(a=>new Promise(u=>{const f=new Image;f.onload=()=>u(f),f.src=a})))).forEach(a=>{l==null||l.drawImage(a,0,0,n,o)}),i.toDataURL(`image/${t}`)}we.mark(Pt);function zt({position:e="topright",layers:t,onToggle:r,onOpacityChange:n,className:o,style:i}){const[l,c]=d.useState(!1),a=d.useRef(null),[u,f]=d.useState(()=>{const b={};return t.forEach(v=>{b[v.id]=v.opacity??1}),b});d.useEffect(()=>{f(b=>{const v={...b};return t.forEach(C=>{C.opacity!==void 0&&(v[C.id]=C.opacity)}),v})},[t]);const{positionClassName:m}=Ee(e),h=_e();if(d.useEffect(()=>{if(!l)return;const b=v=>{a.current&&!a.current.contains(v.target)&&c(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!t.length)return null;const g=Ho(e),y=(b,v)=>{f(C=>({...C,[b]:v})),n==null||n(b,v)},x=s.jsxs("div",{ref:a,className:`l7-control l7-control--glass${o?` ${o}`:""}`,style:i,children:[s.jsx("button",{className:"l7-button-control",onClick:()=>c(!l),title:"图层控制","aria-label":"图层控制",children:s.jsx("span",{className:"material-symbols-outlined",children:"layers"})}),l&&s.jsx("div",{className:`l7-popper ${g}`,children:s.jsxs("div",{className:"l7-popper-content l7-layer-panel",children:[s.jsxs("div",{className:"l7-layer-panel__title",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"layers"}),"Layers"]}),s.jsx("div",{className:"l7-layer-panel__list",children:t.map(b=>{const v=b.visible!==!1,C=u[b.id]??b.opacity??1,j=b.icon??"layers";return s.jsxs("div",{className:`l7-layer-item${v?"":" l7-layer-item--disabled"}`,children:[s.jsxs("div",{className:"l7-layer-item__header",children:[s.jsx("span",{className:"material-symbols-outlined l7-layer-item__icon",children:j}),s.jsx("span",{className:"l7-layer-item__name",children:b.name??b.id}),s.jsxs("label",{className:"l7-layer-toggle",children:[s.jsx("input",{type:"checkbox",checked:v,onChange:()=>r(b.id,!v)}),s.jsx("span",{className:"l7-layer-toggle__track"})]})]}),n&&s.jsxs("div",{className:"l7-layer-item__slider",children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"opacity"}),s.jsx("input",{type:"range",min:0,max:100,value:Math.round(C*100),onChange:_=>y(b.id,+_.target.value/100),className:"l7-layer-slider"})]})]},b.id)})})]})})]});return h?x:s.jsx("div",{className:`l7-control-anchor ${m}`,children:x})}function Ho(e){switch(e){case"topleft":return"l7-popper-right l7-popper-start";case"topright":return"l7-popper-left l7-popper-start";case"bottomleft":return"l7-popper-right l7-popper-end";case"bottomright":return"l7-popper-left l7-popper-end";case"lefttop":return"l7-popper-bottom l7-popper-start";case"leftbottom":return"l7-popper-top l7-popper-start";case"righttop":return"l7-popper-bottom l7-popper-end";case"rightbottom":return"l7-popper-top l7-popper-end";default:return"l7-popper-bottom"}}we.mark(zt);function Qr({controls:e,layers:t,onLayerToggle:r,containerRef:n}){const o=fe();return s.jsx(kt,{children:e.map((i,l)=>s.jsx(Uo,{control:i,layers:t,onLayerToggle:r,scene:o,containerRef:n},`${i.type}-${l}`))})}function Uo({control:e,layers:t,onLayerToggle:r,scene:n,containerRef:o}){var l,c,a,u,f;const i=e.position??void 0;switch(e.type){case"zoom":return s.jsx(Mt,{position:i??"bottomright"});case"scale":return s.jsx(Tt,{position:i??"bottomleft",maxWidth:(l=e.options)==null?void 0:l.maxWidth,metric:((c=e.options)==null?void 0:c.unit)!=="imperial",imperial:((a=e.options)==null?void 0:a.unit)==="imperial"});case"fullscreen":return s.jsx(Nt,{position:i??"topright",container:o==null?void 0:o.current});case"geoLocate":return s.jsx(Rt,{position:i??"topright"});case"mapTheme":return s.jsx(It,{position:i??"topright"});case"mouseLocation":return s.jsx(At,{position:i??"bottomleft",precision:(u=e.options)==null?void 0:u.precision});case"exportImage":return s.jsx(Pt,{position:i??"topright",format:(f=e.options)==null?void 0:f.format});case"layerSwitch":return s.jsx(zt,{position:i??"topright",layers:t.map((m,h)=>({id:m.id??`layer-${h}`,name:m.name,visible:m.visible})),onToggle:r??(()=>{})});default:return null}}var Oe={},ur;function Wo(){if(ur)return Oe;ur=1;var e=wt;if(process.env.NODE_ENV==="production")Oe.createRoot=e.createRoot,Oe.hydrateRoot=e.hydrateRoot;else{var t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Oe.createRoot=function(r,n){t.usingClientEntryPoint=!0;try{return e.createRoot(r,n)}finally{t.usingClientEntryPoint=!1}},Oe.hydrateRoot=function(r,n,o){t.usingClientEntryPoint=!0;try{return e.hydrateRoot(r,n,o)}finally{t.usingClientEntryPoint=!1}}}return Oe}var Yo=Wo();const st={primary:{fill:"#2563eb",bg:"rgba(37, 99, 235, 0.2)",ring:"rgba(37, 99, 235, 0.2)"},success:{fill:"#00854d",bg:"rgba(0, 133, 77, 0.2)",ring:"rgba(0, 133, 77, 0.2)"},warning:{fill:"#943700",bg:"rgba(148, 55, 0, 0.2)",ring:"rgba(148, 55, 0, 0.2)"},error:{fill:"#ba1a1a",bg:"rgba(186, 26, 26, 0.2)",ring:"rgba(186, 26, 26, 0.2)"}};function qo(e){return typeof e=="string"&&/<[a-zA-Z][^>]*>/.test(e)}function dr({color:e="primary"}){const{fill:t}=st[e];return s.jsxs("svg",{viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:32,height:40,display:"block"},className:"aimapui-marker-pin block drop-shadow-md",children:[s.jsx("path",{d:"M16 0C7.16344 0 0 7.16344 0 16C0 24.8366 16 40 16 40C16 40 32 24.8366 32 16C32 7.16344 24.8366 0 16 0Z",fill:t,stroke:"white",strokeWidth:1.5}),s.jsx("circle",{cx:"16",cy:"16",r:"4",fill:"white"})]})}function Go({icon:e,color:t="primary"}){const{fill:r}=st[t];return s.jsxs("div",{className:"aimapui-marker-pin aimapui-marker-pin--icon relative inline-flex items-start justify-center drop-shadow-md",style:{width:32,height:40},children:[s.jsx("svg",{viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{position:"absolute",inset:0,width:"100%",height:"100%"},children:s.jsx("path",{d:"M16 0C7.16344 0 0 7.16344 0 16C0 24.8366 16 40 16 40C16 40 32 24.8366 32 16C32 7.16344 24.8366 0 16 0Z",fill:r,stroke:"white",strokeWidth:1.5})}),s.jsx("span",{className:"material-symbols-outlined",style:{position:"relative",zIndex:1,fontSize:14,color:"white",fontVariationSettings:"'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28},children:e})]})}function Jo({color:e="primary"}){const{fill:t,bg:r}=st[e];return s.jsx("div",{className:"aimapui-marker-circle size-6 rounded-full border-[1.5px] border-white shadow-md flex items-center justify-center relative",style:{background:r,borderColor:t},children:s.jsx("div",{className:"aimapui-marker-circle__inner size-1.5 rounded-full",style:{background:t}})})}function Ko({color:e="primary"}){const{fill:t}=st[e];return s.jsx("div",{className:"aimapui-marker-dot size-2 rounded-full border-[1.5px] border-white shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{background:t}})}function Xo({text:e}){return s.jsx("div",{className:"aimapui-marker-label absolute top-[calc(100%+4px)] left-1/2 -translate-x-1/2 font-mono text-xs leading-4 font-[450] text-on-surface whitespace-nowrap pointer-events-none [text-shadow:-1px_-1px_0_white,1px_-1px_0_white,-1px_1px_0_white,1px_1px_0_white,0_0_2px_white,0_0_4px_rgba(255,255,255,0.5)]",children:e})}const fr={center:"translate(-50%, -50%)",top:"translate(-50%, 0)",bottom:"translate(-50%, -100%)",left:"translate(0, -50%)",right:"translate(-100%, -50%)","top-left":"translate(0, 0)","top-right":"translate(-100%, 0)","bottom-left":"translate(0, -100%)","bottom-right":"translate(-100%, -100%)"},Qo=[0,0];function es(e,t,r,n){let o;switch(e){case"pin":o=s.jsx(dr,{color:t});break;case"circle":o=s.jsx(Jo,{color:t});break;case"icon":o=s.jsx(Go,{icon:r||"location_on",color:t});break;case"dot":o=s.jsx(Ko,{color:t});break;default:o=s.jsx(dr,{color:t})}return n?s.jsxs("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column",alignItems:"center"},children:[o,s.jsx(Xo,{text:n})]}):o}function Fe({longitude:e,latitude:t,variant:r="pin",color:n="primary",icon:o,label:i,content:l,children:c,draggable:a=!1,className:u,overlayContainer:f,onClick:m,onMouseEnter:h,onMouseLeave:g,onDoubleClick:y,onDragEnd:x,onDragging:b,onDragStart:v,selected:C=!1,inactive:j=!1,anchor:_="bottom",offsets:L=Qo,overflowHide:z=!0}){const w=fe(),k=d.useRef(null),O=d.useRef(null),M=d.useRef({lng:e,lat:t}),A=d.useRef({width:0,height:0}),T=L[0]??0,S=L[1]??0,E=d.useRef(null),R=d.useMemo(()=>{const D=["aimapui-marker"];return C&&D.push("aimapui-marker--selected"),j&&D.push("aimapui-marker--inactive"),D.push(`aimapui-marker--${n}`),u&&D.push(u),D.join(" ")},[C,j,n,u]),P=d.useMemo(()=>l||c||es(r,n,o,i),[l,c,r,n,o,i]),B=D=>{const F=k.current;if(!F||!D)return;const{lng:G,lat:H}=M.current;if(isNaN(G)||isNaN(H))return;let V;try{V=D.lngLatToContainer([G,H])}catch{return}if(!V||isNaN(V.x)||isNaN(V.y))return;const U=V.x+T,W=V.y-S,I=fr[_]||fr.bottom,q=Math.round(U),J=Math.round(W);if(F.style.left="0",F.style.top="0",F.style.transform=`translate3d(${q}px, ${J}px, 0) ${I}`,z){const{width:Z,height:ue}=A.current;F.style.visibility=U<0||U>Z||W<0||W>ue?"hidden":"visible"}};return d.useEffect(()=>{if(!w)return;let D=!1;const F=w.mapService;if(!F){console.error("[Marker] mapService not available");return}const G=()=>{var q;const I=(q=F.getContainer)==null?void 0:q.call(F);I&&(A.current={width:I.scrollWidth||I.clientWidth||0,height:I.scrollHeight||I.clientHeight||0})},H=()=>{k.current&&B(F)},V=(I,q,J)=>{var Z;try{(Z=I==null?void 0:I.on)==null||Z.call(I,q,J)}catch{}},U=(I,q,J)=>{var Z;try{(Z=I==null?void 0:I.off)==null||Z.call(I,q,J)}catch{}};return G(),V(F,"camerachange",H),V(F,"viewchange",H),V(w,"resize",G),(async()=>{var ie;if(w.loaded||await new Promise(X=>{w.once("loaded",()=>X())}),D)return;const I=document.createElement("div");I.className=R,I.style.position="absolute",I.style.left="0",I.style.top="0",I.style.whiteSpace="nowrap",I.style.pointerEvents="auto",k.current=I;const q=f??((ie=F.getMarkerContainer)==null?void 0:ie.call(F));if(q)q.appendChild(I);else{console.error("[Marker] getMarkerContainer not available");return}B(F);let J=!1,Z={lng:0,lat:0};const ue=X=>{var se;if(!a)return;J=!0,F.setMapStatus({dragEnable:!1,zoomEnable:!1});const le=F.getContainer(),ae=(se=le==null?void 0:le.getClientRects())==null?void 0:se[0];if(ae){const Le=ae.left,ke=ae.top,xe=X.x||X.clientX,$e=X.y||X.clientY;Z=F.containerToLngLat([xe-Le,$e-ke])}F.on("mousemove",ne),document.addEventListener("mouseup",de),v&&v(M.current.lng,M.current.lat)},ne=X=>{if(!J)return;const le=X.lngLat||X.lnglat,{lng:ae,lat:se}=Z,{lng:Le,lat:ke}=le,xe={lng:M.current.lng+Le-ae,lat:M.current.lat+ke-se};M.current=xe,Z=le,B(F),b&&b(xe.lng,xe.lat)},de=()=>{J&&(J=!1,F.setMapStatus({dragEnable:!0,zoomEnable:!0}),F.off("mousemove",ne),document.removeEventListener("mouseup",de),x&&x(M.current.lng,M.current.lat))};m&&I.addEventListener("click",X=>m(X)),h&&I.addEventListener("mouseenter",X=>h(X)),g&&I.addEventListener("mouseleave",X=>g(X)),y&&I.addEventListener("dblclick",X=>y(X)),a&&I.addEventListener("mousedown",ue),E.current={updatePosition:H,handleDragStart:ue,handleDragMove:ne,handleDragEnd:de}})(),()=>{if(D=!0,U(F,"camerachange",H),U(F,"viewchange",H),U(w,"resize",G),E.current&&a&&F.setMapStatus({dragEnable:!0,zoomEnable:!0}),k.current){const q=O.current,J=k.current;O.current=null,k.current=null,queueMicrotask(()=>{q&&q.unmount(),J.parentNode&&J.parentNode.removeChild(J)})}E.current=null}},[w,R,_,T,S,z,a,f]),d.useEffect(()=>{if(!k.current)return;const D=k.current;qo(P)?D.innerHTML=P:(O.current||(O.current=Yo.createRoot(D)),O.current.render(s.jsx(s.Fragment,{children:P})))},[P]),d.useEffect(()=>{k.current&&(k.current.className=R)},[R]),d.useEffect(()=>{if(M.current={lng:e,lat:t},w&&k.current){const D=w.mapService;D&&B(D)}},[e,t,w]),null}function en({interactions:e}){const t=fe(),[r,n]=d.useState(null);d.useEffect(()=>{if(!t)return;const l=()=>{try{const a=t.mapService;if(a&&typeof a.getMarkerContainer=="function"){const u=a.getMarkerContainer();if(u){n(u);return}}}catch{}const c=setTimeout(()=>{try{const a=t.mapService;if(a&&typeof a.getMarkerContainer=="function"){const u=a.getMarkerContainer();u&&n(u)}}catch{}},100);return()=>clearTimeout(c)};return t.loaded?l():(t.on("loaded",l),()=>{t.off("loaded",l)})},[t]);const o=e.filter(l=>l.type==="marker"),i=e.filter(l=>l.type==="popup");return s.jsxs(s.Fragment,{children:[r&&o.map((l,c)=>s.jsx(Fe,{...l,overlayContainer:r},`marker-${c}`)),r&&i.map((l,c)=>s.jsx(Lt,{...l,overlayContainer:r},`popup-${c}`))]})}function Ot({title:e,labels:t,colors:r,swatchShape:n="square",grid:o=!1,className:i,interaction:l}){const[c,a]=d.useState(-1),[u,f]=d.useState(new Set),m=y=>{var x;a(y),(x=l==null?void 0:l.onHover)==null||x.call(l,y)},h=()=>{var y;a(-1),(y=l==null?void 0:l.onHover)==null||y.call(l,-1)},g=y=>{var x;f(b=>{const v=new Set(b);return v.has(y)?v.delete(y):v.add(y),v}),(x=l==null?void 0:l.onToggle)==null||x.call(l,y)};return s.jsxs("div",{className:re(i),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsx("div",{className:re("flex flex-col gap-1",o&&"grid grid-cols-2 gap-x-3 gap-y-1"),children:t.map((y,x)=>{const b=c>=0?c!==x:u.has(x);return s.jsxs("div",{className:re("flex items-center gap-2 rounded px-1 py-0.5 cursor-pointer select-none transition-[background,opacity] duration-150 hover:bg-primary/[0.06]",b&&"opacity-35"),onMouseEnter:()=>m(x),onMouseLeave:h,onClick:()=>g(x),children:[s.jsx("span",{className:re("size-3 shrink-0 rounded-sm shadow-[inset_0_0_0_1px_rgba(0,0,0,0.08)] transition-opacity duration-150",n==="circle"&&"rounded-full"),style:{backgroundColor:r[x]??"#ccc"}}),s.jsx("span",{className:"text-xs leading-4 text-on-surface truncate",children:y})]},x)})})]})}function Ft({title:e,labels:t,colors:r,isContinuous:n=!1,showTicks:o=!1,brushable:i=!1,className:l,interaction:c}){const[a,u]=d.useState([0,100]),f=d.useRef(null),m=r.join(", "),h=d.useCallback(g=>y=>{y.stopPropagation(),y.preventDefault();const x=f.current;if(!x)return;const b=x.getBoundingClientRect().width,v=j=>{const _=x.getBoundingClientRect(),L=j.clientX-_.left,z=Math.max(0,Math.min(100,L/b*100));u(w=>{var O;let k;return g==="left"?k=[Math.min(z,w[1]-5),w[1]]:k=[w[0],Math.max(z,w[0]+5)],(O=c==null?void 0:c.onBrush)==null||O.call(c,k),k})},C=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",C)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",C)},[c,f]);return s.jsxs("div",{className:re(l),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsxs("div",{className:"flex flex-col gap-1",ref:f,children:[s.jsx("div",{className:re("flex h-3 rounded overflow-hidden shadow-[inset_0_0_0_1px_rgba(0,0,0,0.06)]",n&&"bg-[length:100%_100%]"),style:n?{background:`linear-gradient(to right, ${m})`}:void 0,children:!n&&r.map((g,y)=>s.jsx("div",{className:"flex-1 relative",style:{backgroundColor:g}},y))}),o&&s.jsx("div",{className:"flex justify-between h-1.5 mt-0.5",children:r.map((g,y)=>y===0?null:s.jsx("div",{className:"w-px h-full bg-outline-variant",style:{position:"absolute",left:`${y/(r.length-1)*100}%`}},y))}),s.jsxs("div",{className:"flex justify-between font-mono text-[11px] leading-3.5 font-[450] text-on-surface-variant",children:[s.jsx("span",{children:t[0]}),t.length>2&&s.jsx("span",{children:t[Math.floor(t.length/2)]}),s.jsx("span",{children:t[t.length-1]})]}),i&&s.jsxs("div",{className:"relative h-3 mt-1 cursor-ew-resize",children:[s.jsx("div",{className:"absolute top-0 h-full border-2 border-primary rounded-sm bg-primary/10 pointer-events-none",style:{left:`${a[0]}%`,width:`${a[1]-a[0]}%`}}),s.jsx("div",{className:"absolute top-1/2 w-2 h-4 bg-primary rounded-sm -translate-x-1/2 -translate-y-1/2 cursor-ew-resize shadow-sm hover:shadow-md hover:shadow-primary/30 transition-shadow duration-150",style:{left:`${a[0]}%`},onMouseDown:h("left")}),s.jsx("div",{className:"absolute top-1/2 w-2 h-4 bg-primary rounded-sm -translate-x-1/2 -translate-y-1/2 cursor-ew-resize shadow-sm hover:shadow-md hover:shadow-primary/30 transition-shadow duration-150",style:{left:`${a[1]}%`},onMouseDown:h("right")})]})]})]})}function $t({title:e,colors:t,labels:r,middleLabel:n,className:o}){const i=t.join(", ");return s.jsxs("div",{className:re(o),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{style:{position:"relative"},children:[s.jsx("div",{className:"flex h-3 rounded overflow-hidden shadow-[inset_0_0_0_1px_rgba(0,0,0,0.06)]",style:{background:`linear-gradient(to right, ${i})`}}),s.jsx("div",{style:{position:"absolute",top:-4,left:"50%",transform:"translateX(-50%)",width:1,height:20,background:"var(--color-outline-variant, #c3c6d7)"}}),n&&s.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 -bottom-[18px] font-mono text-[11px] text-on-surface-variant whitespace-nowrap",children:n})]}),s.jsxs("div",{className:"flex justify-between font-mono text-[11px] leading-3.5 font-[450] text-on-surface-variant",style:n?{marginBottom:12}:void 0,children:[s.jsx("span",{children:r[0]}),s.jsx("span",{children:r[1]})]})]})]})}function Dt({title:e,ranges:t,colors:r,className:n,interaction:o}){const[i,l]=d.useState(-1),[c,a]=d.useState(new Set),u=h=>{var g;l(h),(g=o==null?void 0:o.onHover)==null||g.call(o,h)},f=()=>{var h;l(-1),(h=o==null?void 0:o.onHover)==null||h.call(o,-1)},m=h=>{var g;a(y=>{const x=new Set(y);return x.has(h)?x.delete(h):x.add(h),x}),(g=o==null?void 0:o.onToggle)==null||g.call(o,h)};return s.jsxs("div",{className:re(n),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsx("div",{className:"flex flex-col gap-1.5",children:t.map(([h,g],y)=>{const x=i>=0?i!==y:c.has(y);return s.jsxs("div",{className:re("flex items-center gap-2 cursor-pointer select-none transition-opacity duration-150 hover:opacity-80",x&&"opacity-35"),onMouseEnter:()=>u(y),onMouseLeave:f,onClick:()=>m(y),children:[s.jsx("span",{className:"w-6 h-3 shrink-0 rounded-sm shadow-[inset_0_0_0_1px_rgba(0,0,0,0.06)]",style:{backgroundColor:r[y]??"#ccc"}}),s.jsxs("span",{className:"font-mono text-[11px] leading-3.5 text-on-surface-variant",children:["[",h,", ",g,")"]})]},y)})})]})}function Bt({title:e,fillColor:t="#4A90D9",items:r,className:n}){const o=Math.max(...r.map(i=>i.size),1);return s.jsxs("div",{className:re(n),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"flex items-end gap-2 px-1",children:r.map((i,l)=>s.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-end",height:o},children:s.jsx("div",{className:"rounded-full shrink-0 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.06)]",style:{width:i.size,height:i.size,backgroundColor:t,opacity:.85}})},l))}),s.jsx("div",{className:"flex items-end gap-2 mt-1",children:r.map((i,l)=>s.jsx("span",{className:"font-mono text-[11px] leading-3.5 text-on-surface-variant whitespace-nowrap",children:i.label},l))})]})]})}function Zt({title:e,color:t="#4A90D9",items:r,className:n,interaction:o}){const[i,l]=d.useState(-1),[c,a]=d.useState(new Set),u=h=>{var g;l(h),(g=o==null?void 0:o.onHover)==null||g.call(o,h)},f=()=>{var h;l(-1),(h=o==null?void 0:o.onHover)==null||h.call(o,-1)},m=h=>{var g;a(y=>{const x=new Set(y);return x.has(h)?x.delete(h):x.add(h),x}),(g=o==null?void 0:o.onToggle)==null||g.call(o,h)};return s.jsxs("div",{className:re(n),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsx("div",{className:"flex flex-col gap-1.5",children:r.map((h,g)=>{const y=i>=0?i!==g:c.has(g);return s.jsxs("div",{className:re("flex items-center gap-2.5 py-0.5 cursor-pointer select-none transition-opacity duration-150 hover:opacity-80",y&&"opacity-35"),onMouseEnter:()=>u(g),onMouseLeave:f,onClick:()=>m(g),children:[s.jsx("div",{className:"w-7 shrink-0 rounded-full shadow-[0_0_0_1px_rgba(0,0,0,0.06)]",style:{height:h.width,backgroundColor:t,opacity:.85}}),s.jsx("span",{className:"text-xs leading-4 text-on-surface whitespace-nowrap",children:h.label})]},g)})})]})}function Vt({title:e,labels:t,fillColor:r="#4A90D9",className:n}){return s.jsxs("div",{className:re(n),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"flex items-end gap-2 px-1",children:t.map(([l,c],a)=>{const f=6+a/Math.max(t.length-1,1)*18;return s.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-end",height:24},children:s.jsx("div",{className:"rounded-full shrink-0 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.06)]",style:{width:f,height:f,backgroundColor:r,opacity:.85}})},a)})}),s.jsx("div",{className:"flex items-end gap-2 mt-1",children:t.map(([l,c],a)=>s.jsxs("span",{className:"font-mono text-[11px] leading-3.5 text-on-surface-variant whitespace-nowrap",children:[l,"–",c]},a))})]})]})}function Ht({title:e,items:t,className:r,interaction:n}){const[o,i]=d.useState(-1),[l,c]=d.useState(new Set),a=m=>{var h;i(m),(h=n==null?void 0:n.onHover)==null||h.call(n,m)},u=()=>{var m;i(-1),(m=n==null?void 0:n.onHover)==null||m.call(n,-1)},f=m=>{var h;c(g=>{const y=new Set(g);return y.has(m)?y.delete(m):y.add(m),y}),(h=n==null?void 0:n.onToggle)==null||h.call(n,m)};return s.jsxs("div",{className:re(r),children:[e&&s.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-on-surface-variant",children:e}),s.jsx("div",{className:"flex flex-col gap-1",children:t.map((m,h)=>{const g=o>=0?o!==h:l.has(h);return s.jsxs("div",{className:re("flex items-center gap-2 px-1 py-0.5 rounded cursor-pointer select-none transition-[background,opacity] duration-150 hover:bg-primary/[0.06]",g&&"opacity-35"),onMouseEnter:()=>a(h),onMouseLeave:u,onClick:()=>f(h),children:[s.jsx("img",{src:m.icon,alt:m.label,className:"size-5 object-contain shrink-0",onError:y=>{const x=y.target;x.style.display="none";const b=x.nextElementSibling;b&&(b.style.display="flex")}}),s.jsx("span",{className:"size-5 hidden items-center justify-center shrink-0 text-base leading-none text-on-surface-variant",children:"□"}),s.jsx("span",{className:"text-xs leading-4 text-on-surface",children:m.label})]},h)})})]})}function tn({legends:e,className:t,style:r,interaction:n}){return e.length?s.jsx("div",{className:re("absolute z-20 bottom-6 left-6 max-h-[40%] overflow-y-auto rounded-xl border border-outline-variant/30 bg-surface/80 backdrop-blur-md p-3 px-3.5 text-on-surface shadow-lg scrollbar-thin scrollbar-track-transparent scrollbar-thumb-outline-variant",t),style:r,children:s.jsx("div",{className:"flex flex-col gap-4 [&>*+*]:border-t [&>*+*]:border-outline-variant/20 [&>*+*]:pt-4",children:e.map((o,i)=>s.jsx(ts,{legend:o,interaction:n},`legend-${i}`))})}):null}function ts({legend:e,interaction:t}){switch(e.type){case"categories":return s.jsx(Ot,{...e,interaction:t});case"ramp":return s.jsx(Ft,{...e,interaction:t});case"diverging":return s.jsx($t,{...e,interaction:t});case"threshold":return s.jsx(Dt,{...e,interaction:t});case"size":return s.jsx(Bt,{...e,interaction:t});case"lineWidth":return s.jsx(Zt,{...e,interaction:t});case"proportion":return s.jsx(Vt,{...e,interaction:t});case"icon":return s.jsx(Ht,{...e,interaction:t});default:return null}}const rn=d.createContext({isMobile:!1,breakpoint:768,width:typeof window<"u"?window.innerWidth:1024,schema:void 0});function rs({responsive:e,children:t}){const[r,n]=d.useState(typeof window<"u"?window.innerWidth:1024);d.useEffect(()=>{const c=()=>n(window.innerWidth);return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]);const o=(e==null?void 0:e.breakpoint)??768,i=r<o,l=d.useMemo(()=>({isMobile:i,breakpoint:o,width:r,schema:e}),[i,o,r,e]);return s.jsx(rn.Provider,{value:l,children:t})}function nn(){return d.useContext(rn)}function on({config:e,className:t}){const r=fe(),{items:n,position:o="bottom"}=e,i=o==="top"?"top-0 left-0 right-0":"bottom-0 left-0 right-0",l=a=>{switch(a){case"zoomIn":r==null||r.zoomIn();break;case"zoomOut":r==null||r.zoomOut();break;case"locate":navigator.geolocation&&navigator.geolocation.getCurrentPosition(u=>{r==null||r.setCenter([u.coords.longitude,u.coords.latitude]),r==null||r.setZoom(14)});break;case"reset":r==null||r.setCenter([105,35]),r==null||r.setZoom(4);break}},c={zoomIn:s.jsx("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{d:"M12 5v14m-7-7h14"})}),zoomOut:s.jsx("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{d:"M5 12h14"})}),locate:s.jsxs("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:2,children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M12 2v4m0 12v4m10-10h-4M6 12H2"})]}),reset:s.jsxs("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:2,children:[s.jsx("path",{d:"M3 12a9 9 0 1 1 3.3 6.9"}),s.jsx("path",{d:"M3 22v-7h7"})]}),layers:s.jsx("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})})};return s.jsx("div",{className:re("absolute z-40 bg-surface/80 backdrop-blur-md border-t border-outline-variant/30 safe-area-inset shadow-lg",i,t),children:s.jsx("div",{className:"flex items-center justify-around py-3 px-4",children:n.map((a,u)=>s.jsxs("button",{onClick:()=>l(a),className:"flex flex-col items-center gap-1 p-2 text-on-surface hover:bg-surface-variant transition-colors rounded-lg","aria-label":a,children:[c[a]??s.jsx("span",{className:"text-label-caps font-label-caps",children:a}),s.jsx("span",{className:"text-label-caps font-label-caps",children:a})]},`${a}-${u}`))})})}function sn({legends:e,className:t,interaction:r}){const[n,o]=d.useState(!1);return e.length?s.jsx("div",{className:re("absolute bottom-3 left-3 right-3 z-30 transition-all duration-300",n?"max-h-[65vh]":"max-h-14",t),children:s.jsxs("div",{className:"rounded-xl border border-outline-variant/30 bg-surface/80 backdrop-blur-md p-3 px-3.5 text-on-surface shadow-lg",children:[s.jsxs("button",{onClick:()=>o(!n),className:"w-full flex items-center justify-between px-0 py-3 text-label-caps font-label-caps uppercase",style:{background:"none",border:"none",cursor:"pointer",color:"var(--color-primary, #004ac6)"},children:[s.jsx("span",{children:"图例"}),s.jsx("svg",{viewBox:"0 0 24 24",className:re("w-5 h-5 transition-transform",n?"rotate-180":""),fill:"none",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{d:"M6 9l6 6 6-6"})})]}),n&&s.jsx("div",{className:"flex flex-col gap-4 [&>*+*]:border-t [&>*+*]:border-outline-variant/20 [&>*+*]:pt-4 custom-scrollbar",style:{maxHeight:"55vh",overflowY:"auto"},children:e.map((i,l)=>s.jsx(ns,{legend:i,interaction:r},`mobile-legend-${l}`))})]})}):null}function ns({legend:e,interaction:t}){switch(e.type){case"categories":return s.jsx(Ot,{...e,interaction:t});case"ramp":return s.jsx(Ft,{...e,interaction:t});case"diverging":return s.jsx($t,{...e,interaction:t});case"threshold":return s.jsx(Dt,{...e,interaction:t});case"size":return s.jsx(Bt,{...e,interaction:t});case"lineWidth":return s.jsx(Zt,{...e,interaction:t});case"proportion":return s.jsx(Vt,{...e,interaction:t});case"icon":return s.jsx(Ht,{...e,interaction:t});default:return null}}function os({map:e,schema:t,theme:r="light",onSceneReady:n,onLayerClick:o,onLayerMouseMove:i,onLayerMouseEnter:l,onLayerMouseLeave:c,onMapMove:a,onMapZoom:u,autoFit:f,events:m,children:h,className:g,style:y}){const x=d.useRef(null),b=d.useMemo(()=>t?jt(Lr(t)):{map:is(e??{basemap:"gaode"}),layers:[],controls:[],interactions:[],legends:[]},[t,e]),v=!t&&!!e,C=d.useMemo(()=>({onClick:o,onMouseMove:i,onMouseEnter:l,onMouseLeave:c}),[o,i,l,c]),j=d.useMemo(()=>({onMove:a,onZoom:u}),[a,u]),_=d.useCallback(L=>{n==null||n(L),f&&ss(L)},[n,f]);return s.jsx(Pr,{defaultTheme:r,target:"container",children:s.jsx(Mr,{schema:b,children:s.jsx(Ir,{events:m,children:s.jsx(no,{responsive:b.responsive,children:s.jsx(as,{schema:b,isComposableMode:v,onSceneReady:_,layerEventHandlers:C,mapEventHandlers:j,containerRef:x,className:g,style:y,children:h})})})})})}function ss(e){let t=!1,r=0;const n=30,o=()=>{var i;if(!t){r+=1;try{const l=((i=e.getLayers)==null?void 0:i.call(e))??[];if(l.length===0){r<n&&window.setTimeout(o,100);return}let c=1/0,a=1/0,u=-1/0,f=-1/0,m=!1;for(const h of l){const g=h.getBounds;if(typeof g=="function")try{const y=g.call(h);if(!y||!Array.isArray(y)||y.length!==2)continue;const[x,b]=y;if(!x||!b||!isFinite(x[0])||!isFinite(x[1])||!isFinite(b[0])||!isFinite(b[1]))continue;c=Math.min(c,x[0]),a=Math.min(a,x[1]),u=Math.max(u,b[0]),f=Math.max(f,b[1]),m=!0}catch{}}if(!m){r<n&&window.setTimeout(o,100);return}e.fitBounds([[c,a],[u,f]]),t=!0}catch{r<n&&window.setTimeout(o,100)}}};window.setTimeout(o,200)}function is(e){return{basemap:e.basemap??"gaode",token:e.token,style:e.style,center:e.center??[105,35],zoom:e.zoom??4,pitch:e.pitch??0,rotation:e.rotation??0,minZoom:e.minZoom,maxZoom:e.maxZoom,bounds:e.bounds,gestureConfig:e.gestureConfig}}function as({schema:e,isComposableMode:t,onSceneReady:r,layerEventHandlers:n,mapEventHandlers:o,containerRef:i,className:l,style:c,children:a}){var x,b;const{isMobile:u}=nn(),[f,m]=d.useState(e.layers??[]),h=d.useMemo(()=>{var C,j;if(t||!u||!((j=(C=e.responsive)==null?void 0:C.mobile)!=null&&j.layers))return e.layers;const v=e.responsive.mobile.layers;if("*"in v){const _=v["*"];return e.layers.map(L=>({...L,..._,id:L.id}))}return e.layers.map(_=>_.id&&v[_.id]?{..._,...v[_.id],id:_.id}:_)},[e.layers,e.responsive,u,t]),g=d.useMemo(()=>{var j,_;const v=e.controls??[];if(!u||!((_=(j=e.responsive)==null?void 0:j.mobile)!=null&&_.controls))return v;const C=e.responsive.mobile.controls;return C.hide?v.filter(L=>!C.hide.includes(L.type)):v},[e.controls,e.responsive,u]),y=d.useCallback((v,C)=>{m(j=>j.map(_=>_.id===v?{..._,visible:C}:_))},[]);return s.jsx("div",{ref:i,className:l??"aimapui-container",style:c??{width:"100%",height:"100%"},children:s.jsxs(Dr,{mapSchema:e.map,onSceneReady:r,mapEventHandlers:o,events:e.events,style:{width:"100%",height:"100%"},children:[!t&&h.length>0&&s.jsx(Kr,{layers:h,eventHandlers:n}),!t&&s.jsx(Qr,{controls:g,layers:h,onLayerToggle:y,containerRef:i}),!t&&e.interactions&&e.interactions.length>0&&s.jsx(en,{interactions:e.interactions}),!t&&(u?e.legends&&e.legends.length>0&&s.jsx(sn,{legends:e.legends}):s.jsx(tn,{legends:e.legends??[]})),!t&&u&&((b=(x=e.responsive)==null?void 0:x.mobile)==null?void 0:b.toolbar)&&s.jsx(on,{config:e.responsive.mobile.toolbar}),t?s.jsx(ls,{children:a}):null]})})}function ls({children:e}){const{controls:t,others:r}=d.useMemo(()=>{const n=[],o=[];return d.Children.forEach(e,(i,l)=>{d.isValidElement(i)&&we.check(i)?n.push(i):o.push(i)}),{controls:n,others:o}},[e]);return s.jsxs(s.Fragment,{children:[t.length>0&&s.jsx(kt,{children:t}),r]})}function Ve(e,t){if(e===t)return!1;if(e==null||t==null||typeof e!=typeof t||typeof e!="object")return!0;try{return JSON.stringify(e)!==JSON.stringify(t)}catch{return!0}}function cs(e,t){const r=Ve(e.map,t.map),n=new Map;(e.layers??[]).forEach(b=>{b.id&&n.set(b.id,b)});const o=new Map;(t.layers??[]).forEach(b=>{b.id&&o.set(b.id,b)});const i=[],l=[],c=[];(t.layers??[]).forEach((b,v)=>{const C=b.id??`__index_${v}`;if(!n.has(C))i.push(b);else{const j=n.get(C);Ve(j,b)&&c.push({id:C,prev:j,next:b})}}),(e.layers??[]).forEach((b,v)=>{const C=b.id??`__index_${v}`;o.has(C)||l.push(C)});const a=e.controls??[],u=t.controls??[],f=[],m=[],h=[],g=Math.max(a.length,u.length);for(let b=0;b<g;b++)b>=a.length?f.push(u[b]):b>=u.length?m.push(a[b]):Ve(a[b],u[b])&&h.push({index:b,prev:a[b],next:u[b]});const y=Ve(e.interactions,t.interactions),x=Ve(e.legends,t.legends);return{mapChanged:r,layersAdded:i,layersRemoved:l,layersUpdated:c,controlsAdded:f,controlsRemoved:m,controlsUpdated:h,interactionsChanged:y,legendsChanged:x}}function us(e){const t=[];return e.map?t.push(...ds(e.map)):t.push({path:"map",message:"map is required",severity:"error"}),!e.layers||!Array.isArray(e.layers)?t.push({path:"layers",message:"layers must be an array",severity:"error"}):e.layers.forEach((r,n)=>{t.push(...fs(r,n))}),e.controls&&(Array.isArray(e.controls)?e.controls.forEach((r,n)=>{r.type||t.push({path:`controls[${n}].type`,message:"control type is required",severity:"error"})}):t.push({path:"controls",message:"controls must be an array",severity:"error"})),e.interactions&&(Array.isArray(e.interactions)?e.interactions.forEach((r,n)=>{(r.type==="marker"||r.type==="popup")&&(typeof r.longitude!="number"||typeof r.latitude!="number")&&t.push({path:`interactions[${n}]`,message:"marker/popup requires longitude and latitude as numbers",severity:"error"})}):t.push({path:"interactions",message:"interactions must be an array",severity:"error"})),e.legends&&(Array.isArray(e.legends)?e.legends.forEach((r,n)=>{r.type||t.push({path:`legends[${n}].type`,message:"legend type is required",severity:"error"})}):t.push({path:"legends",message:"legends must be an array",severity:"error"})),t}function ds(e){const t=[],r=["gaode","mapbox","maplibre","tianditu","tencent","baidu","google","map"];if(r.includes(e.basemap)||t.push({path:"map.basemap",message:`Invalid basemap "${e.basemap}". Valid values: ${r.join(", ")}`,severity:"error"}),e.center){const[n,o]=e.center;(n<-180||n>180)&&t.push({path:"map.center[0]",message:"Longitude must be between -180 and 180",severity:"error"}),(o<-90||o>90)&&t.push({path:"map.center[1]",message:"Latitude must be between -90 and 90",severity:"error"})}return e.zoom!==void 0&&(e.zoom<0||e.zoom>22)&&t.push({path:"map.zoom",message:"Zoom must be between 0 and 22",severity:"warning"}),["gaode","mapbox","tianditu","tencent","baidu","google"].includes(e.basemap)&&!e.token&&t.push({path:"map.token",message:`basemap "${e.basemap}" requires a token`,severity:"warning"}),t}function fs(e,t){const r=[],n=`layers[${t}]`,o=["point","line","polygon","heatmap","raster","image"];return e.type?o.includes(e.type)||r.push({path:`${n}.type`,message:`Invalid layer type "${e.type}". Valid values: ${o.join(", ")}`,severity:"error"}):r.push({path:`${n}.type`,message:"layer type is required",severity:"error"}),e.source===void 0&&e.source,e.colorField&&!e.colorValues&&!e.color&&r.push({path:`${n}.colorValues`,message:"colorField is set but colorValues is not. L7 will use default scale.",severity:"warning"}),e.sizeField&&!e.sizeValues&&e.size===void 0&&r.push({path:`${n}.sizeValues`,message:"sizeField is set but sizeValues is not. L7 will use default scale.",severity:"warning"}),r}const ps={$schema:"http://json-schema.org/draft-07/schema#",title:"AiMapSchema",description:"Schema-driven React map visualization component configuration",type:"object",required:["map","layers"],properties:{map:{type:"object",required:["basemap"],properties:{basemap:{type:"string",enum:["gaode","mapbox","maplibre","tianditu","tencent","baidu","google","map"],description:"Map base tile provider"},token:{type:"string",description:"API token for the map service"},style:{type:"string",description:"Map style preset (light/dark/normal/darkblue/satellite) or custom URL"},center:{type:"array",items:{type:"number"},minItems:2,maxItems:2,description:"Map center [longitude, latitude], default [105, 35]"},zoom:{type:"number",description:"Map zoom level, default 4"},pitch:{type:"number",description:"Map pitch in degrees, default 0"},rotation:{type:"number",description:"Map rotation in degrees, default 0"},minZoom:{type:"number",description:"Minimum zoom level"},maxZoom:{type:"number",description:"Maximum zoom level"},bounds:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:2},minItems:2,maxItems:2,description:"Initial bounds [[swLng, swLat], [neLng, neLat]]"},gestureConfig:{type:"object",properties:{dragPan:{type:"boolean"},pinchZoom:{type:"boolean"},dragRotate:{type:"boolean"}}}}},layers:{type:"array",description:"Array of map layers",items:{type:"object",required:["type","source"],properties:{id:{type:"string",description:"Unique layer ID (auto-generated if omitted)"},type:{type:"string",enum:["point","line","polygon","heatmap","raster","image"],description:"Layer visualization type"},name:{type:"string",description:"Human-readable layer name"},visible:{type:"boolean",default:!0},zIndex:{type:"number",default:0},minZoom:{type:"number"},maxZoom:{type:"number"},autoFit:{type:"boolean",default:!1},source:{description:"GeoJSON, JSON array, or URL string"},sourceType:{type:"string",enum:["geojson","json","csv"]},sourceConfig:{type:"object",properties:{x:{type:"string",description:"Longitude field name"},y:{type:"string",description:"Latitude field name"},x1:{type:"string",description:"End longitude field (for arc lines)"},y1:{type:"string",description:"End latitude field (for arc lines)"},coordinates:{type:"string",description:"Coordinates field"}}},color:{type:"string",description:"Fixed color"},colorField:{type:"string",description:"Field to map color to"},colorValues:{oneOf:[{type:"string",description:"Color palette name"},{type:"array",items:{type:"string"},description:"Array of color values"}]},size:{type:"number",description:"Fixed size"},sizeField:{type:"string",description:"Field to map size to"},sizeValues:{type:"array",items:{type:"number"},description:"Size range [min, max]"},shape:{type:"string",description:"Fixed shape"},shapeField:{type:"string",description:"Field to map shape to"},shapeValues:{type:"array",items:{type:"string"}},style:{type:"object",description:"Additional style properties"},filterField:{type:"string"},filterValues:{type:"array"},animate:{type:"object",properties:{enable:{type:"boolean"},speed:{type:"number"},duration:{type:"number"},trailLength:{type:"number"},repeat:{type:"number"}}},active:{oneOf:[{type:"boolean"},{type:"object",properties:{color:{type:"string"}}}]},select:{oneOf:[{type:"boolean"},{type:"object",properties:{color:{type:"string"}}}]},events:{type:"object",description:"Layer event configuration",properties:{click:{type:"string",description:"Event identifier emitted on click (via EventBus)"},mousemove:{type:"string",description:"Event identifier emitted on mousemove"},mouseenter:{type:"string",description:"Event identifier emitted on mouseenter"},mouseleave:{type:"string",description:"Event identifier emitted on mouseleave"},enablePopup:{type:"boolean",description:"Auto-show popup on click"},popupFields:{type:"array",items:{type:"string"},description:"Fields to show in popup"},popupTemplate:{type:"string",description:"HTML template with {{field}} interpolation"}}}}}},controls:{type:"array",description:"Map control widgets",items:{type:"object",required:["type"],properties:{type:{type:"string",enum:["zoom","scale","fullscreen","geoLocate","mapTheme","mouseLocation","exportImage","layerSwitch"]},position:{type:"string",enum:["topleft","topright","bottomleft","bottomright","topcenter","bottomcenter"]},options:{type:"object"}}}},interactions:{type:"array",description:"Interactive elements (markers, popups, tooltips)",items:{oneOf:[{type:"object",required:["type","longitude","latitude"],properties:{type:{type:"string",const:"marker"},longitude:{type:"number"},latitude:{type:"number"},content:{type:"string"},draggable:{type:"boolean"}}},{type:"object",required:["type","longitude","latitude","content"],properties:{type:{type:"string",const:"popup"},longitude:{type:"number"},latitude:{type:"number"},content:{type:"string"},closeButton:{type:"boolean"}}},{type:"object",required:["type","content"],properties:{type:{type:"string",const:"tooltip"},content:{type:"string"},trigger:{type:"string",enum:["hover","click"]}}}]}},legends:{type:"array",description:"Legend configurations",items:{oneOf:[{type:"object",required:["type","labels","colors"],properties:{type:{type:"string",const:"categories"},title:{type:"string"},labels:{type:"array",items:{type:"string"}},colors:{type:"array",items:{type:"string"}}}},{type:"object",required:["type","labels","colors"],properties:{type:{type:"string",const:"ramp"},title:{type:"string"},labels:{type:"array",items:{type:"string"}},colors:{type:"array",items:{type:"string"}},isContinuous:{type:"boolean"}}},{type:"object",required:["type","labels"],properties:{type:{type:"string",const:"proportion"},title:{type:"string"},labels:{type:"array",items:{type:"array",items:{type:"number"}}},fillColor:{type:"string"}}},{type:"object",required:["type","items"],properties:{type:{type:"string",const:"icon"},title:{type:"string"},items:{type:"array",items:{type:"object",properties:{icon:{type:"string"},label:{type:"string"}}}}}}]}},responsive:{type:"object",properties:{breakpoint:{type:"number",default:768},mobile:{type:"object",properties:{controls:{type:"object",properties:{position:{type:"string"},scale:{type:"number"},hide:{type:"array",items:{type:"string"}}}},legends:{type:"object",properties:{compact:{type:"boolean"},position:{type:"string"}}},toolbar:{type:"object",required:["items","position"],properties:{items:{type:"array",items:{type:"string"}},position:{type:"string",enum:["bottom","top"]}}}}}}},events:{type:"object",description:"Global event identifier mappings for map and interactions",properties:{mapMove:{type:"string",description:"Event identifier for map move"},mapZoom:{type:"string",description:"Event identifier for map zoom"},markerDragEnd:{type:"string",description:"Event identifier for marker drag end"}}}}};function ye({source:e,sourceType:t,sourceConfig:r,onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l,...c}){const a=fe();if(!a)return null;const u={...c,type:"point",source:e,sourceType:t??"json",sourceConfig:r},f=n||o||i||l?{onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l}:void 0;return s.jsx(Ie,{schema:u,scene:a,eventHandlers:f})}function Ce({source:e,sourceType:t,sourceConfig:r,onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l,...c}){const a=fe();if(!a)return null;const u={...c,type:"line",source:e,sourceType:t??"json",sourceConfig:r},f=n||o||i||l?{onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l}:void 0;return s.jsx(Ie,{schema:u,scene:a,eventHandlers:f})}function ot({source:e,sourceType:t,sourceConfig:r,onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l,...c}){const a=fe();if(!a)return null;const u={...c,type:"polygon",source:e,sourceType:t??"geojson",sourceConfig:r},f=n||o||i||l?{onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l}:void 0;return s.jsx(Ie,{schema:u,scene:a,eventHandlers:f})}function an({source:e,sourceType:t,sourceConfig:r,onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l,...c}){const a=fe();if(!a)return null;const u={...c,type:"heatmap",source:e,sourceType:t??"json",sourceConfig:r},f=n||o||i||l?{onClick:n,onMouseMove:o,onMouseEnter:i,onMouseLeave:l}:void 0;return s.jsx(Ie,{schema:u,scene:a,eventHandlers:f})}function ln({source:e,sourceType:t="json",sourceConfig:r,hexSize:n=100,weightField:o="h12",weightMethod:i="sum",onClick:l,onMouseMove:c,style:a,...u}){const f=[{type:"hexagon",size:n,field:o,method:i}];return s.jsx(an,{...u,source:e,sourceType:t,sourceConfig:{...r,transforms:f},shape:"hexagonColumn",style:{coverage:.8,angle:0,...a??{}},onClick:l,onMouseMove:c})}function cn({source:e,sourceType:t,sourceConfig:r,onClick:n,...o}){const i=fe();if(!i)return null;const l={...o,type:"raster",source:e,sourceType:t??"raster",sourceConfig:r},c=n?{onClick:n}:void 0;return s.jsx(Ie,{schema:l,scene:i,eventHandlers:c})}function ms({source:e,sourceType:t,sourceConfig:r,onClick:n,...o}){const i=fe();if(!i)return null;const l={...o,type:"image",source:e,sourceType:t??"image",sourceConfig:r},c=n?{onClick:n}:void 0;return s.jsx(Ie,{schema:l,scene:i,eventHandlers:c})}const hs=[8,16,32,48,64],Qe={primary:"#2563eb",warning:"#f59e0b",error:"#ef4444",success:"#10b981"};function gs({source:e,sourceType:t="geojson",sourceConfig:r,labelField:n="name",labelColor:o="#0b3b8c",labelSize:i=12,showLabel:l=!0,labelTrigger:c="always",labelOffset:a,sizeDomain:u,bubbleAnchor:f="bottom",labelAnchor:m="top",hoverEffect:h=!0,clickEffect:g=!0,tooltipEffect:y=!0,tooltipFields:x,tooltipTemplate:b,semanticColorField:v,color:C="#2563eb",size:j=16,sizeField:_,sizeValues:L,style:z,active:w,select:k,onClick:O,onMouseMove:M,onMouseEnter:A,onMouseLeave:T,...S}){const E=v??S.colorField,R=S.colorValues??(v?[Qe.primary,Qe.warning,Qe.error,Qe.success]:void 0),P=_?L??[...hs]:L,[B,D]=d.useState(c==="always"),F=d.useCallback(Z=>{c==="hover"&&D(!0),A==null||A(Z)},[c,A]),G=d.useCallback(Z=>{c==="hover"&&D(!1),T==null||T(Z)},[c,T]),H={color:"#60a5fa"},V={color:"#1d4ed8"},U=(()=>{const Z=S.events;return y?{...Z,enablePopup:(Z==null?void 0:Z.enablePopup)??!0,popupFields:(Z==null?void 0:Z.popupFields)??x,popupTemplate:(Z==null?void 0:Z.popupTemplate)??b}:Z})(),[W,I]=d.useState(!1);d.useEffect(()=>{const Z=requestAnimationFrame(()=>I(!0));return()=>cancelAnimationFrame(Z)},[]);const q=l&&B&&W,J=_?{sizeField:_,sizeValues:P}:{size:j};return s.jsxs(s.Fragment,{children:[s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shape:"circle",color:C,colorField:E,colorValues:R,...J,opacity:.75,active:h?w??H:w,select:g?k??V:k,events:U,zIndex:S.zIndex??0,autoFit:S.autoFit,visible:S.visible,name:S.name??"bubble-circle",onClick:O,onMouseMove:M,onMouseEnter:F,onMouseLeave:G,style:{stroke:C??"#004ac6",strokeWidth:2,strokeOpacity:1,...z??{}}}),q&&s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shapeField:n,shapeValues:"text",color:o,size:i,zIndex:(S.zIndex??0)+1,style:{textAnchor:m,textOffset:a??[0,0],stroke:"#fff",strokeWidth:2,textAllowOverlap:!0}})]})}const pr=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ft=1,He=8,ce=new Uint32Array(96);class Ut{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[r,n]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=n>>4;if(o!==ft)throw new Error(`Got v${o} data when expected v${ft}.`);const i=pr[n&15];if(!i)throw new Error("Unrecognized array type.");const[l]=new Uint16Array(t,2,1),[c]=new Uint32Array(t,4,1);return new Ut(c,l,i,void 0,t)}constructor(t,r=64,n=Float64Array,o=ArrayBuffer,i){if(isNaN(t)||t<0)throw new Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const l=pr.indexOf(this.ArrayType),c=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-a%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,He,t),this.coords=new n(i,He+a+u,t*2),this._pos=t*2,this._finished=!0;else{const f=this.data=new o(He+c+a+u);this.ids=new this.IndexArrayType(f,He,t),this.coords=new n(f,He+a+u,t*2),this._pos=0,this._finished=!1,new Uint8Array(f,0,2).set([219,(ft<<4)+l]),new Uint16Array(f,2,1)[0]=r,new Uint32Array(f,4,1)[0]=t}}add(t,r){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=r,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return bt(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:l,nodeSize:c}=this;ce[0]=0,ce[1]=i.length-1,ce[2]=0;let a=3;const u=[];for(;a>0;){const f=ce[--a],m=ce[--a],h=ce[--a];if(m-h<=c){for(let b=h;b<=m;b++){const v=l[2*b],C=l[2*b+1];v>=t&&v<=n&&C>=r&&C<=o&&u.push(i[b])}continue}const g=h+m>>1,y=l[2*g],x=l[2*g+1];y>=t&&y<=n&&x>=r&&x<=o&&u.push(i[g]),(f===0?t<=y:r<=x)&&(ce[a++]=h,ce[a++]=g-1,ce[a++]=1-f),(f===0?n>=y:o>=x)&&(ce[a++]=g+1,ce[a++]=m,ce[a++]=1-f)}return u}within(t,r,n){const o=[];return this.withinInto(t,r,n,o),o}withinInto(t,r,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:l,nodeSize:c}=this;ce[0]=0,ce[1]=i.length-1,ce[2]=0;let a=3,u=0;const f=n*n;for(;a>0;){const m=ce[--a],h=ce[--a],g=ce[--a];if(h-g<=c){for(let v=g;v<=h;v++)mr(l[2*v],l[2*v+1],t,r)<=f&&(o[u++]=i[v]);continue}const y=g+h>>1,x=l[2*y],b=l[2*y+1];mr(x,b,t,r)<=f&&(o[u++]=i[y]),(m===0?t-n<=x:r-n<=b)&&(ce[a++]=g,ce[a++]=y-1,ce[a++]=1-m),(m===0?t+n>=x:r+n>=b)&&(ce[a++]=y+1,ce[a++]=h,ce[a++]=1-m)}return u}}function bt(e,t,r,n,o,i){if(o-n<=r)return;const l=n+o>>1;un(e,t,l,n,o,i),bt(e,t,r,n,l-1,1-i),bt(e,t,r,l+1,o,1-i)}function un(e,t,r,n,o,i){for(;o>n;){if(o-n>600){const u=o-n+1,f=r-n+1,m=Math.log(u),h=.5*Math.exp(2*m/3),g=.5*Math.sqrt(m*h*(u-h)/u)*(f-u/2<0?-1:1),y=Math.max(n,Math.floor(r-f*h/u+g)),x=Math.min(o,Math.floor(r+(u-f)*h/u+g));un(e,t,r,y,x,i)}const l=t[2*r+i];let c=n,a=o;for(Ue(e,t,n,r),t[2*o+i]>l&&Ue(e,t,n,o);c<a;){for(Ue(e,t,c,a),c++,a--;t[2*c+i]<l;)c++;for(;t[2*a+i]>l;)a--}t[2*n+i]===l?Ue(e,t,n,a):(a++,Ue(e,t,a,o)),a<=r&&(n=a+1),r<=a&&(o=a-1)}}function Ue(e,t,r,n){pt(e,r,n),pt(t,2*r,2*n),pt(t,2*r+1,2*n+1)}function pt(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function mr(e,t,r,n){const o=e-r,i=t-n;return o*o+i*i}const ys={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},hr=Math.fround||(e=>(t=>(e[0]=+t,e[0])))(new Float32Array(1)),Re=2,Te=3,mt=4,Me=5,dn=6;class xs{constructor(t){this.options=Object.assign(Object.create(ys),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:r,minZoom:n,maxZoom:o}=this.options;r&&console.time("total time");const i=`prepare ${t.length} points`;r&&console.time(i),this.points=t;const l=[];for(let a=0;a<t.length;a++){const u=t[a];if(!u.geometry)continue;const[f,m]=u.geometry.coordinates,h=hr(et(f)),g=hr(tt(m));l.push(h,g,1/0,a,-1,1),this.options.reduce&&l.push(0)}let c=this.trees[o+1]=this._createTree(l);r&&console.timeEnd(i);for(let a=o;a>=n;a--){const u=+Date.now();c=this.trees[a]=this._createTree(this._cluster(c,a)),r&&console.log("z%d: %d clusters in %dms",a,c.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(t,r){let n=((t[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[1]));let i=t[2]===180?180:((t[2]+180)%360+360)%360-180;const l=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,i=180;else if(n>i){const m=this.getClusters([n,o,180,l],r),h=this.getClusters([-180,o,i,l],r);return m.concat(h)}const c=this.trees[this._limitZoom(r)],a=c.range(et(n),tt(l),et(i),tt(o)),u=c.data,f=[];for(const m of a){const h=this.stride*m;f.push(u[h+Me]>1?gr(u,h,this.clusterProps):this.points[u[h+Te]])}return f}getChildren(t){const r=this._getOriginId(t),n=this._getOriginZoom(t),o="No cluster with the specified id.",i=this.trees[n];if(!i)throw new Error(o);const l=i.data;if(r*this.stride>=l.length)throw new Error(o);const c=this.options.radius/(this.options.extent*Math.pow(2,n-1)),a=l[r*this.stride],u=l[r*this.stride+1],f=i.within(a,u,c),m=[];for(const h of f){const g=h*this.stride;l[g+mt]===t&&m.push(l[g+Me]>1?gr(l,g,this.clusterProps):this.points[l[g+Te]])}if(m.length===0)throw new Error(o);return m}getLeaves(t,r,n){r=r||10,n=n||0;const o=[];return this._appendLeaves(o,t,r,n,0),o}getTile(t,r,n){const o=this.trees[this._limitZoom(t)],i=Math.pow(2,t),{extent:l,radius:c}=this.options,a=c/l,u=(n-a)/i,f=(n+1+a)/i,m={features:[]};return this._addTileFeatures(o.range((r-a)/i,u,(r+1+a)/i,f),o.data,r,n,i,m),r===0&&this._addTileFeatures(o.range(1-a/i,u,1,f),o.data,i,n,i,m),r===i-1&&this._addTileFeatures(o.range(0,u,a/i,f),o.data,-1,n,i,m),m.features.length?m:null}getClusterExpansionZoom(t){let r=this._getOriginZoom(t)-1;for(;r<=this.options.maxZoom;){const n=this.getChildren(t);if(r++,n.length!==1)break;t=n[0].properties.cluster_id}return r}_appendLeaves(t,r,n,o,i){const l=this.getChildren(r);for(const c of l){const a=c.properties;if(a&&a.cluster?i+a.point_count<=o?i+=a.point_count:i=this._appendLeaves(t,a.cluster_id,n,o,i):i<o?i++:t.push(c),t.length===n)break}return i}_createTree(t){const r=new Ut(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)r.add(t[n],t[n+1]);return r.finish(),r.data=t,r}_addTileFeatures(t,r,n,o,i,l){for(const c of t){const a=c*this.stride,u=r[a+Me]>1;let f,m,h;if(u)f=fn(r,a,this.clusterProps),m=r[a],h=r[a+1];else{const x=this.points[r[a+Te]];f=x.properties;const[b,v]=x.geometry.coordinates;m=et(b),h=tt(v)}const g={type:1,geometry:[[Math.round(this.options.extent*(m*i-n)),Math.round(this.options.extent*(h*i-o))]],tags:f};let y;u||this.options.generateId?y=r[a+Te]:y=this.points[r[a+Te]].id,y!==void 0&&(g.id=y),l.features.push(g)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,r){const{radius:n,extent:o,reduce:i,minPoints:l}=this.options,c=n/(o*Math.pow(2,r)),a=t.data,u=[],f=this.stride;for(let m=0;m<a.length;m+=f){if(a[m+Re]<=r)continue;a[m+Re]=r;const h=a[m],g=a[m+1],y=t.within(a[m],a[m+1],c),x=a[m+Me];let b=x;for(const v of y){const C=v*f;a[C+Re]>r&&(b+=a[C+Me])}if(b>x&&b>=l){let v=h*x,C=g*x,j,_=-1;const L=((m/f|0)<<5)+(r+1)+this.points.length;for(const z of y){const w=z*f;if(a[w+Re]<=r)continue;a[w+Re]=r;const k=a[w+Me];v+=a[w]*k,C+=a[w+1]*k,a[w+mt]=L,i&&(j||(j=this._map(a,m,!0),_=this.clusterProps.length,this.clusterProps.push(j)),i(j,this._map(a,w)))}a[m+mt]=L,u.push(v/b,C/b,1/0,L,-1,b),i&&u.push(_)}else{for(let v=0;v<f;v++)u.push(a[m+v]);if(b>1)for(const v of y){const C=v*f;if(!(a[C+Re]<=r)){a[C+Re]=r;for(let j=0;j<f;j++)u.push(a[C+j])}}}}return u}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,r,n){if(t[r+Me]>1){const l=this.clusterProps[t[r+dn]];return n?Object.assign({},l):l}const o=this.points[t[r+Te]].properties,i=this.options.map(o);return n&&i===o?Object.assign({},i):i}}function gr(e,t,r){return{type:"Feature",id:e[t+Te],properties:fn(e,t,r),geometry:{type:"Point",coordinates:[bs(e[t]),vs(e[t+1])]}}}function fn(e,t,r){const n=e[t+Me],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,i=e[t+dn],l=i===-1?{}:Object.assign({},r[i]);return Object.assign(l,{cluster:!0,cluster_id:e[t+Te],point_count:n,point_count_abbreviated:o})}function et(e){return e/360+.5}function tt(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function bs(e){return(e-.5)*360}function vs(e){const t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ws({source:e,sourceType:t="geojson",sourceConfig:r,gridSize:n=60,minClusterSize:o=2,animationDuration:i=300,easing:l="cubic-bezier(0.4, 0, 0.2, 1)",onPointClick:c,onClusterClick:a}){const u=fe(),[f,m]=d.useState([]),[h,g]=d.useState(null),[y,x]=d.useState(null),b=d.useRef(null),v=d.useRef(-1),C=d.useMemo(()=>Ss(e,t,r),[e,t,r]);d.useEffect(()=>{if(C.length===0){b.current=null,m([]),v.current=-1;return}const w=new xs({radius:n,minPoints:o,maxZoom:20,minZoom:0}),k=C.map(O=>({type:"Feature",properties:{id:O.id,...O.properties},geometry:{type:"Point",coordinates:[O.lng,O.lat]}}));w.load(k),b.current=w,v.current=-1},[C,n,o]);const j=d.useCallback((w,k)=>{try{const O=Math.floor(k.getZoom());if(O===v.current)return;v.current=O;let M=[-180,-90,180,90];try{const S=k.getBounds();S&&(M=[S[0][0],S[0][1],S[1][0],S[1][1]])}catch{}const T=w.getClusters(M,O).map(S=>{const E=S.geometry.coordinates,R=E[0],P=E[1];return S.properties.cluster?{id:`cluster-${S.properties.cluster_id}`,clusterId:S.properties.cluster_id,lng:R,lat:P,pointCount:S.properties.point_count,isCluster:!0,properties:{}}:{id:`point-${S.properties.id}`,clusterId:-1,lng:R,lat:P,pointCount:1,isCluster:!1,properties:S.properties}});m(T),g(null)}catch{}},[]);d.useEffect(()=>{var M,A;if(!u)return;const w=u.mapService,k=()=>{requestAnimationFrame(()=>{const T=b.current;T&&u.loaded&&j(T,u)})};u.loaded?k():u.once("loaded",k);const O=()=>{const T=b.current;T&&j(T,u)};return(M=w==null?void 0:w.on)==null||M.call(w,"camerachange",O),(A=w==null?void 0:w.on)==null||A.call(w,"viewchange",O),()=>{var T,S;u.off("loaded",k),(T=w==null?void 0:w.off)==null||T.call(w,"camerachange",O),(S=w==null?void 0:w.off)==null||S.call(w,"viewchange",O)}},[u,j]);const _=d.useCallback(w=>{if(!u||!w.isCluster)return;let k=[];const O=b.current;O&&(k=O.getLeaves(w.clusterId,1/0)),a==null||a(w,k);try{if(u.getZoom()>=20-.5){g(T=>T===w.id?null:w.id);return}if(k.length>0){const T=k.map(B=>B.geometry.coordinates),S=T.map(B=>B[0]),E=T.map(B=>B[1]),R=[Math.min(...S),Math.min(...E)],P=[Math.max(...S),Math.max(...E)];u.fitBounds([R,P],{padding:[40,40,40,40],duration:i})}}catch{}},[u,a,i]),L=d.useMemo(()=>{if(!u||!h||!b.current)return[];const w=f.find(k=>k.id===h&&k.isCluster);if(!w)return[];try{const k=b.current.getLeaves(w.clusterId,1/0),O=u.mapService;if(!O)return[];const M=O.lngLatToContainer([w.lng,w.lat]);if(!M)return[];const A=k.length,T=Math.max(24,Math.min(72,18+A*2));return k.map((S,E)=>{var F,G;const R=Math.PI*2*E/A-Math.PI/2,P=M.x+Math.cos(R)*T,B=M.y+Math.sin(R)*T,D=O.containerToLngLat([P,B]);return{id:`spider-${w.id}-${((F=S.properties)==null?void 0:F.id)??E}`,lng:D.lng,lat:D.lat,point:{id:String(((G=S.properties)==null?void 0:G.id)??E),lng:S.geometry.coordinates[0],lat:S.geometry.coordinates[1],properties:S.properties??{}}}})}catch{return[]}},[u,h,f]),z=d.useMemo(()=>h?f.find(w=>w.id===h&&w.isCluster)??null:null,[h,f]);return s.jsxs(s.Fragment,{children:[h&&z&&L.map(w=>s.jsx(Fe,{longitude:w.lng,latitude:w.lat,anchor:"center",content:s.jsx(js,{centerLng:z.lng,centerLat:z.lat,lineLng:w.lng,lineLat:w.lat})},`line-${w.id}`)),f.map(w=>{var A;if(!w.isCluster)return s.jsx(Fe,{longitude:w.lng,latitude:w.lat,anchor:"center",content:s.jsx("div",{title:String(((A=w.properties)==null?void 0:A.name)??"单点"),onClick:()=>{var T;return c==null?void 0:c({id:String(((T=w.properties)==null?void 0:T.id)??""),lng:w.lng,lat:w.lat,properties:w.properties})},style:{width:14,height:14,borderRadius:9999,background:"#2563eb",border:"2px solid #fff",boxShadow:"0 2px 10px rgba(37,99,235,.5), 0 0 0 3px rgba(37,99,235,.15)",transition:"transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1)",cursor:"pointer"}})},w.id);const k=w.pointCount,O=Cs(k),M=y===w.id;return s.jsx(Fe,{longitude:w.lng,latitude:w.lat,anchor:"center",content:s.jsxs("div",{title:`包含 ${k} 个要素`,onClick:()=>_(w),onMouseEnter:()=>x(w.id),onMouseLeave:()=>x(T=>T===w.id?null:T),style:{width:O.size,height:O.size,borderRadius:9999,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontWeight:O.fontWeight,fontSize:O.fontSize,background:O.background,border:O.border,boxShadow:O.shadow,position:"relative",cursor:"pointer",transition:"transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1)",transform:M?"scale(1.1)":"scale(1)"},children:[O.pulse&&s.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:9999,background:"rgba(37,99,235,0.25)",animation:"aimapui-cluster-pulse 1.6s ease-out infinite"}}),s.jsx("span",{style:{position:"relative",zIndex:1},children:k})]})},w.id)}),L.map(w=>{var k;return s.jsx(Fe,{longitude:w.lng,latitude:w.lat,anchor:"center",content:s.jsx("div",{title:String(((k=w.point.properties)==null?void 0:k.name)??w.point.id),onClick:()=>c==null?void 0:c(w.point),style:{width:10,height:10,borderRadius:9999,background:"#fff",border:"2px solid #2563eb",boxShadow:"0 2px 8px rgba(0,0,0,.2)",cursor:"pointer"}})},w.id)})]})}function js({centerLng:e,centerLat:t,lineLng:r,lineLat:n}){const o=fe(),i=d.useRef(null);return d.useEffect(()=>{if(!o)return;const l=o.mapService;if(!l)return;const c=()=>{const f=i.current;if(f)try{const m=l.lngLatToContainer([e,t]),h=l.lngLatToContainer([r,n]);if(!m||!h)return;const g=h.x-m.x,y=h.y-m.y,x=Math.sqrt(g*g+y*y),b=Math.atan2(y,g)*180/Math.PI;f.style.width=`${x}px`,f.style.transform=`rotate(${b}deg)`}catch{}};c();const a=(f,m,h)=>{var g;try{(g=f==null?void 0:f.on)==null||g.call(f,m,h)}catch{}},u=(f,m,h)=>{var g;try{(g=f==null?void 0:f.off)==null||g.call(f,m,h)}catch{}};return a(l,"camerachange",c),a(l,"viewchange",c),()=>{u(l,"camerachange",c),u(l,"viewchange",c)}},[o,e,t,r,n]),s.jsx("div",{ref:i,style:{position:"absolute",left:0,top:0,height:1,background:"rgba(195, 198, 215, 0.5)",transformOrigin:"0 50%",pointerEvents:"none"}})}function Cs(e){return e>=1e3?{size:48,fontSize:14,fontWeight:700,background:"linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%)",border:"2px solid rgba(255,255,255,0.55)",shadow:"0 10px 24px rgba(37,99,235,.45)",pulse:!0}:e>=100?{size:40,fontSize:13,fontWeight:700,background:"rgba(37,99,235,0.30)",border:"2px solid rgba(255,255,255,0.5)",shadow:"0 6px 16px rgba(37,99,235,.25)",pulse:!1}:{size:32,fontSize:12,fontWeight:600,background:"radial-gradient(circle, #2563eb 60%, rgba(37,99,235,0.20) 61%)",border:"1px solid rgba(255,255,255,0.55)",shadow:"0 4px 12px rgba(37,99,235,.2)",pulse:!1}}function Ss(e,t,r){if(!e)return[];if(t==="geojson"&&typeof e=="object"&&e!==null){const n=e;return(Array.isArray(n.features)?n.features:[]).map((i,l)=>{var u,f,m;const c=i,a=(u=c==null?void 0:c.geometry)==null?void 0:u.coordinates;return!Array.isArray(a)||a.length<2?null:{id:String(((f=c==null?void 0:c.properties)==null?void 0:f.id)??((m=c==null?void 0:c.properties)==null?void 0:m.Id)??l),lng:Number(a[0]),lat:Number(a[1]),properties:(c==null?void 0:c.properties)??{}}}).filter(Boolean)}if(Array.isArray(e)){const n=(r==null?void 0:r.x)??"lng",o=(r==null?void 0:r.y)??"lat";return e.map((i,l)=>{const c=i,a=Number(c[n]),u=Number(c[o]);return Number.isNaN(a)||Number.isNaN(u)?null:{id:String(c.id??l),lng:a,lat:u,properties:c}}).filter(Boolean)}return[]}const _s=["#dbeafe","#93c5fd","#60a5fa","#3b82f6","#2563eb"],Es=["#dc2626","#fca5a5","#e5e7eb","#86efac","#16a34a"],Ls=["#2563eb","#f59e0b","#ef4444","#10b981","#8b5cf6","#14b8a6","#f97316","#64748b"];function ks({source:e,sourceType:t="geojson",colorMapping:r="sequential",showStroke:n=!0,strokeColor:o="rgba(255,255,255,0.30)",strokeWidth:i=.5,hoverEffect:l=!0,clickEffect:c=!0,stickySelection:a=!0,tooltipEffect:u=!0,tooltipFields:f,tooltipTemplate:m,regionIdField:h="name",highlightStrokeColor:g="#2563eb",highlightStrokeWidth:y=2,zoomToRegionOnClick:x=!0,clickZoomPadding:b=40,clickZoomDelta:v=1.2,onRegionClick:C,onDrilldown:j,showLabel:_=!1,labelField:L="name",labelColor:z="#0f172a",labelSize:w=11,labelAreaThreshold:k=5e-5,labelHaloWidth:O=2,minLabelZoom:M,valueField:A,percentageField:T,nameField:S,color:E,colorField:R,colorValues:P,active:B,select:D,events:F,style:G,...H}){const V=fe(),[U,W]=d.useState(null),[I,q]=d.useState(null),[J,Z]=d.useState(()=>{if(!V)return 0;try{return V.getZoom()}catch{return 0}});d.useEffect(()=>{if(!V)return;const ee=()=>{try{Z(V.getZoom())}catch{}};return ee(),V.on("zoomchange",ee),()=>{V.off("zoomchange",ee)}},[V]);const ue=M===void 0||J>=M,ne=d.useMemo(()=>{if(P)return P;switch(r){case"diverging":return[...Es];case"categorical":return[...Ls];case"sequential":default:return[..._s]}},[P,r]),de=A??R??"value",ie=S??L,X=d.useMemo(()=>m??Ms(ie,de,T),[m,ie,de,T]),le={color:"#ffffff"},ae={color:"#0f172a"},se=d.useMemo(()=>Ts(e,t,L,h,k),[e,t,L,h,k]),Le=d.useCallback(ee=>{C==null||C(ee);const Se=xr(ee.feature,h);if(Se!==null&&c&&q(De=>!a&&De===Se?null:Se),ee.feature&&(j==null||j(ee.feature)),!V||!x)return;const Ye=Number.isFinite(ee.lng)&&Number.isFinite(ee.lat)?[ee.lng,ee.lat]:Rs(ee.originalEvent);if(Ye)try{const De=V.getZoom(),qe=Math.abs(v);V.setCenter(Ye),V.setZoom(De+qe)}catch{}},[C,h,c,a,j,V,x,v]),ke=d.useCallback(ee=>{if(!l)return;const Se=xr(ee.feature,h);W(Se)},[l,h]),xe=d.useCallback(()=>{l&&W(null)},[l]),$e=d.useMemo(()=>{const ee=F;return u?{...ee,enablePopup:(ee==null?void 0:ee.enablePopup)??!0,popupTrigger:(ee==null?void 0:ee.popupTrigger)??"hover",popupFields:(ee==null?void 0:ee.popupFields)??f,popupTemplate:(ee==null?void 0:ee.popupTemplate)??X}:ee},[F,u,f,X]);return s.jsxs(s.Fragment,{children:[s.jsx(ot,{...H,source:e,sourceType:t,shape:H.shape??"fill",color:E??"#2563eb",colorField:R,colorValues:ne,active:l?B??le:B,select:c?D??ae:D,events:$e,onClick:Le,onMouseEnter:ke,onMouseLeave:xe,style:{opacity:.8,...G??{}}}),n&&s.jsx(Ce,{source:e,sourceType:t,color:o,size:i,zIndex:2}),l&&U!==null&&s.jsxs(s.Fragment,{children:[s.jsx(Ce,{source:e,sourceType:t,color:yr(g,.35),size:y+2,filterField:h,filterValues:[U],zIndex:3}),s.jsx(Ce,{source:e,sourceType:t,color:g,size:y,filterField:h,filterValues:[U],zIndex:4})]}),c&&I!==null&&s.jsx(Ce,{source:e,sourceType:t,color:yr(g,.9),size:Math.max(1.5,y),filterField:h,filterValues:[I],zIndex:5}),_&&ue&&s.jsx(ye,{source:se.data,sourceType:se.sourceType,sourceConfig:se.sourceConfig,shapeField:L,shapeValues:"text",color:z,size:w,style:{textAllowOverlap:!1,stroke:"#ffffff",strokeWidth:O,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace"}})]})}function Ms(e,t,r){const n=r?`<tr><td style="padding-right:8px;color:#64748b">占比</td><td style="font-weight:600">{{${r}}}%</td></tr>`:"";return['<div style="min-width:160px">',`<div style="font-weight:700;margin-bottom:6px">{{${e}}}</div>`,'<table style="font-size:12px;line-height:1.4">',`<tr><td style="padding-right:8px;color:#64748b">指标</td><td style="font-weight:600">{{${t}}}</td></tr>`,n,"</table>","</div>"].join("")}function yr(e,t){if(e.startsWith("#")){const r=e.replace("#",""),n=r.length===3?`${r[0]}${r[0]}${r[1]}${r[1]}${r[2]}${r[2]}`:r;if(n.length===6){const o=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),l=parseInt(n.slice(4,6),16);return`rgba(${o},${i},${l},${t})`}}return e}function xr(e,t){if(!e)return null;const r=e[t]??e.id??e.name;return typeof r=="string"||typeof r=="number"?r:null}function Ts(e,t,r,n,o){return t!=="geojson"||!Ns(e)?{data:e,sourceType:t}:{data:e.features.map(l=>{if(!l||!l.geometry||!l.properties)return null;const c=pn(l.geometry),a=As(l.geometry);if(!c||a<o)return null;const u=l.properties;return{lng:c[0],lat:c[1],[r]:u[r],[n]:u[n]}}).filter(l=>l!==null),sourceType:"json",sourceConfig:{x:"lng",y:"lat"}}}function Ns(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="FeatureCollection"&&Array.isArray(t.features)}function Rs(e){const t=Is(e);return t?pn(t):null}function Is(e){var r,n;const t=e;return((r=t==null?void 0:t.feature)==null?void 0:r.geometry)??((n=t==null?void 0:t.data)==null?void 0:n.geometry)??null}function pn(e){if(e.type==="Polygon")return br(e.coordinates[0]);if(e.type==="MultiPolygon"){let t=0,r=null;return e.coordinates.forEach(n=>{const o=n[0],i=Math.abs(vt(o));i>t&&(t=i,r=br(o))}),r}return null}function As(e){return e.type==="Polygon"?Math.abs(vt(e.coordinates[0])):e.type==="MultiPolygon"?e.coordinates.reduce((t,r)=>t+Math.abs(vt(r[0])),0):0}function br(e){if(!e||e.length<3)return null;let t=0,r=0,n=0;for(let i=0;i<e.length-1;i+=1){const[l,c]=e[i],[a,u]=e[i+1],f=l*u-a*c;t+=f,r+=(l+a)*f,n+=(c+u)*f}const o=t/2;if(Math.abs(o)<1e-12){const i=e[0];return i?[i[0],i[1]]:null}return[r/(6*o),n/(6*o)]}function vt(e){if(!e||e.length<3)return 0;let t=0;for(let r=0;r<e.length-1;r+=1){const[n,o]=e[r],[i,l]=e[r+1];t+=n*l-i*o}return t/2}const mn=["#eff6ff","#bfdbfe","#60a5fa","#2563eb","#1d4ed8","#1e3a8a"],hn="https://mdn.alipayobjects.com/antforest/afts/file/A*T2OJQ7XZzeEAAAAAgCAAAAgAerd2AQ/original_中国_省.json",gn="https://mdn.alipayobjects.com/antforest/afts/file/A*Xd8TQoduwj8AAAAAgEAAAAgAerd2AQ/original_中国_市.json",yn="https://mdn.alipayobjects.com/portal_moelhz/afts/file/A*Rb96Tac1p8EAAAAAgKAAAAgAegAAAQ";function Ps({provinceSource:e=hn,citySource:t=gn,districtSource:r=yn,level:n="province",drillEnabled:o=!1,drillPath:i,onDrill:l,data:c,joinField:a="name",dataJoinField:u="name",valueField:f="value",colors:m=[...mn],fillOpacity:h=.8,strokeColor:g="rgba(255,255,255,0.5)",strokeWidth:y=1.5,dimOpacity:x=.12,showLabel:b=!0,labelField:v="name",labelSize:C=12,hoverHighlight:j=!0,clickSelect:_=!0,showTooltip:L=!0,tooltipFields:z,onRegionClick:w,zIndex:k=0}){const O=fe(),[M,A]=d.useState(null),[T,S]=d.useState(null),[E,R]=d.useState(null),[P,B]=d.useState([{level:"province",name:"中国"}]),D=i??P,F=o?Os(D):n,[G,H]=d.useState(null),[V,U]=d.useState(null);d.useEffect(()=>{ht(e,A)},[e]),d.useEffect(()=>{t&&ht(t,S)},[t]),d.useEffect(()=>{r&&ht(r,R)},[r]);const W=d.useMemo(()=>{switch(F){case"city":return T;case"district":return E;default:return M}},[F,M,T,E]),I=d.useMemo(()=>!W||!c||c.length===0?W:Zs(W,c,a,u,f),[W,c,a,u,f]),q=d.useMemo(()=>{if(!o||D.length<=1)return I;if(!I)return null;const ie=D[D.length-1];return!ie.adcode&&!ie.name?I:Vs(I,ie)},[o,D,I,a]),J=d.useMemo(()=>!o||D.length<=1?null:(D.length===2?M:T)??null,[o,D,M,T]);d.useMemo(()=>`<div style="min-width:140px"><table style="font-size:12px;line-height:1.6">${(z??[v,f]).map(le=>`<tr><td style="padding-right:8px;color:#64748b">${le}</td><td style="font-weight:600">{{${le}}}</td></tr>`).join("")}</table></div>`,[z,v,f]);const Z=d.useCallback(ie=>{const X=ie.feature;if(!X)return;const le=String(X[v]??X.name??""),ae=X.adcode;if(w==null||w(X,F),_&&U(se=>se===le?null:le),o&&Fs(F)){const se=[...D,{level:$s(F),name:le,adcode:ae}];i||B(se),l==null||l(se),U(null)}},[v,F,_,o,D,i,l,w]);if(!O||!I)return null;const ue=!!(c&&c.length>0),ne=q??I,de=F==="province"?y:y*.6;return s.jsxs(s.Fragment,{children:[o&&J&&D.length>1&&s.jsxs(s.Fragment,{children:[s.jsx(ot,{source:J,sourceType:"geojson",shape:"fill",color:"#94a3b8",style:{opacity:x},zIndex:k}),s.jsx(Ce,{source:J,sourceType:"geojson",color:"rgba(148,163,184,0.2)",size:.5,zIndex:k+1})]}),s.jsx(ot,{source:ne,sourceType:"geojson",shape:"fill",...ue?{colorField:f,colorValues:m}:{color:m[2]??"#3b82f6"},active:j?{color:"#ffffff"}:void 0,select:_?{color:"#0f172a"}:void 0,style:{opacity:h},onClick:Z,zIndex:k+2}),s.jsx(Ce,{source:ne,sourceType:"geojson",color:g,size:de,zIndex:k+3}),b&&ne&&s.jsx(zs,{geoData:ne,labelField:v,labelSize:C,zIndex:k+4})]})}function zs({geoData:e,labelField:t,labelSize:r,zIndex:n}){const o=d.useMemo(()=>Hs(e,t),[e,t]);return!o||o.data.length===0?null:s.jsx(ye,{source:o.data,sourceType:o.sourceType,sourceConfig:o.sourceConfig,shapeField:t,shapeValues:"text",color:"#0f172a",size:r,style:{textAllowOverlap:!1,stroke:"#ffffff",strokeWidth:2,fontFamily:"PingFang SC, Microsoft YaHei, sans-serif"},zIndex:n})}function Os(e){return e.length<=1?"province":e.length===2?"city":"district"}function Fs(e){return e!=="district"}function $s(e){return e==="province"?"city":"district"}const Ds=new Set(["境界线","边界线","九段线","十段线"]);function Bs(e){var n,o;const t=(n=e.properties)==null?void 0:n.name;if(!t||typeof t!="string"||Ds.has(t))return!1;const r=(o=e.geometry)==null?void 0:o.type;return!(r==="LineString"||r==="MultiLineString")}function vr(e){return{type:"FeatureCollection",features:e.features.filter(Bs)}}function ht(e,t){typeof e=="string"?fetch(e).then(r=>r.json()).then(r=>{r&&r.type==="FeatureCollection"&&t(vr(r))}).catch(()=>{}):e&&e.type==="FeatureCollection"&&t(vr(e))}function Zs(e,t,r,n,o){const i=new Map;for(const c of t){const a=String(c[n]??"");a&&i.set(a,c)}return{type:"FeatureCollection",features:e.features.map(c=>{const a=String(c.properties[r]??""),u=i.get(a),f=u?u[o]??u.value??0:0;return{...c,properties:{...c.properties,...u??{},[o]:f}}})}}function Vs(e,t,r){const n=t.name,o=t.adcode;return{type:"FeatureCollection",features:e.features.filter(l=>{const c=l.properties;if(c.parent&&String(c.parent)===n||c.parentName&&String(c.parentName)===n)return!0;if(o&&c.adcode){const a=String(o),u=String(c.adcode);if(u.startsWith(a.slice(0,2))&&u!==a)return!0}return!!(c.province&&String(c.province)===n||c.city&&String(c.city)===n)})}}function Hs(e,t){const r=[];for(const n of e.features){if(!n.geometry||!n.properties)continue;const o=Us(n.geometry);o&&r.push({lng:o[0],lat:o[1],[t]:n.properties[t]??n.properties.name??""})}return r.length===0?null:{data:r,sourceType:"json",sourceConfig:{x:"lng",y:"lat"}}}function Us(e){const t=e.type,r=e.coordinates;if(!r)return null;if(t==="Point")return r;if(t==="Polygon")return wr(r);if(t==="MultiPolygon"){const n=r;let o=0,i=null;for(const l of n){const c=Math.abs(Ws(l[0]));c>o&&(o=c,i=wr(l))}return i}return null}function wr(e){const t=e[0];if(!t||t.length===0)return null;let r=0,n=0;const o=t.length;for(const i of t)r+=i[0],n+=i[1];return[r/o,n/o]}function Ws(e){let t=0;const r=e.length;for(let n=0;n<r;n++){const o=(n+1)%r;t+=e[n][0]*e[o][1],t-=e[o][0]*e[n][1]}return t/2}const Ys=[["sunny",""],["cloud",""],["cloudy",""],["partly_cloudy_day",""],["partly_cloudy_night",""],["rainy",""],["rainy_heavy",""],["rainy_light",""],["rainy_snow",""],["thunderstorm",""],["foggy",""],["air",""],["water_drop",""],["ac_unit",""],["filter_drama",""],["cloudy_snowing",""],["snowing",""],["snowflake",""],["severe_cold",""],["umbrella",""],["storm",""],["tornado",""],["thermostat",""],["heat",""],["hot",""],["flight",""],["flight_takeoff",""],["flight_land",""],["train",""],["directions_transit",""],["directions_railway",""],["directions_bus",""],["directions_car",""],["directions_boat",""],["directions_bike",""],["directions_walk",""],["directions_run",""],["taxi",""],["local_taxi",""],["local_airport",""],["connecting_airports",""],["two_wheeler",""],["tram",""],["subway",""],["ferry",""],["cable_car",""],["ev_station",""],["local_gas_station",""],["location_on",""],["place",""],["room",""],["pin",""],["pin_drop",""],["near_me",""],["my_location",""],["gps_fixed",""],["navigation",""],["explore",""],["map",""],["restaurant",""],["local_cafe",""],["coffee",""],["local_bar",""],["hotel",""],["local_hospital",""],["local_pharmacy",""],["local_atm",""],["local_police",""],["local_fire_department",""],["local_post_office",""],["local_library",""],["local_mall",""],["local_grocery_store",""],["store",""],["school",""],["church",""],["mosque",""],["synagogue",""],["temple_buddhist",""],["temple_hindu",""],["museum",""],["castle",""],["stadium",""],["theater_comedy",""],["pool",""],["fitness_center",""],["spa",""],["park",""],["forest",""],["attractions",""],["celebration",""],["festival",""],["nightlife",""],["sports",""],["sports_soccer",""],["sports_basketball",""],["sports_football",""],["sports_tennis",""],["sports_golf",""],["layers",""],["layers_clear",""],["terrain",""],["landscape",""],["share",""],["favorite",""],["star",""],["home",""],["work",""],["person",""],["people",""],["trip",""],["warning",""],["emergency",""],["photo_camera",""],["shopping_bag",""],["search",""],["settings",""],["info",""],["help",""],["close",""],["check",""],["add",""],["remove",""],["edit",""],["delete",""],["refresh",""],["download",""],["upload",""],["visibility",""],["visibility_off",""]],xn=[["smallRain",""],["middleRain",""],["hugeRain",""],["sun",""],["cloud",""]],jr="Material Symbols Outlined",qs="https://fonts.gstatic.com/s/materialsymbolsoutlined/v261/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2",Gs="iconfont",Js="//at.alicdn.com/t/font_2534097_ao9soua2obv.woff2?t=1622021146076";function Ks({source:e,sourceType:t="json",sourceConfig:r,iconField:n,iconFontFamily:o="material-symbols",iconFontPath:i,iconFontMap:l,iconColor:c="#3b82f6",iconSize:a=20,iconHaloColor:u="#fff",iconHaloWidth:f=1,iconStyle:m,showLabel:h=!0,labelField:g,labelColor:y="#333",labelSize:x=11,labelAnchor:b="top",labelOffset:v=[0,0],labelHaloColor:C="#fff",labelHaloWidth:j=2,labelStyle:_,textAllowOverlap:L=!1,iconAllowOverlap:z=!0,zoomAdaption:w=!0,zoomShowLabel:k=14,zoomDegradeToPoint:O=10,onClick:M,onMouseEnter:A,onMouseLeave:T,...S}){const E=fe(),[R,P]=d.useState(!1),[B,D]=d.useState(!1),[F,G]=d.useState(14),H=d.useRef(!1),{fontFamily:V,fontPath:U,iconMappings:W}=d.useMemo(()=>{switch(o){case"material-symbols":return{fontFamily:jr,fontPath:qs,iconMappings:Ys};case"iconfont":return{fontFamily:Gs,fontPath:Js,iconMappings:xn};default:return{fontFamily:o,fontPath:i??null,iconMappings:l??[]}}},[o,i,l]);if(d.useEffect(()=>{if(!E||H.current)return;H.current=!0;let Z=!1;return(async()=>{U&&E.addFontFace(V,U),W.length>0&&E.addIconFonts(W);try{if(V===jr){const ne=W.slice(0,10).map(([,de])=>String.fromCharCode(parseInt(de.replace("&#x","").replace(";",""),16))).join("");await document.fonts.load(`${a}px "${V}"`,ne)}else U&&await new Promise(ne=>{const de=setTimeout(()=>{ne()},3e3),ie=()=>{clearTimeout(de),E.off("fontloaded",ie),ne()};E.on("fontloaded",ie),document.fonts.load(`${a}px "${V}"`).then(()=>{clearTimeout(de),E.off("fontloaded",ie),ne()}).catch(()=>{clearTimeout(de),E.off("fontloaded",ie),ne()})})}catch{console.warn(`[GlyphLayer] 字体 "${V}" 加载超时,尝试继续渲染`)}try{const de=`${a}px "${V}"`;document.fonts.check(de,"X")||await document.fonts.ready}catch{}Z||P(!0)})(),()=>{Z=!0}},[E,V,U,W,a]),d.useEffect(()=>{if(!E)return;const Z=()=>D(!0);return E.loaded?Z():E.on("loaded",Z),()=>{E.off("loaded",Z)}},[E]),d.useEffect(()=>{if(!E||!w)return;const Z=()=>{G(E.getZoom())};return Z(),E.on("zoomchange",Z),()=>{E.off("zoomchange",Z)}},[E,w]),!R||!B)return null;const I=g??n,q=!w||F>=k;return w&&F<O?s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shape:"circle",color:typeof c=="string"?c:"#3b82f6",size:4,style:{opacity:.7}}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{...S,source:e,sourceType:t,sourceConfig:r,shapeField:n,shapeValues:"text",color:c,size:a,style:{fontFamily:V,iconfont:!0,textAllowOverlap:z,stroke:u,strokeWidth:f,...m??{}},onClick:M,onMouseEnter:A,onMouseLeave:T}),h&&q&&s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shapeField:I,shapeValues:"text",color:y,size:x,style:{textAnchor:b,textOffset:v,stroke:C,strokeWidth:j,fontWeight:"500",textAllowOverlap:L,..._??{}}})]})}function Xs({source:e,sourceType:t="json",sourceConfig:r,iconField:n,iconMap:o,iconSize:i=24,iconAnchor:l="bottom",size:c,showLabel:a=!0,labelField:u,labelColor:f="#333",labelSize:m=12,labelAnchor:h="top",labelOffset:g=[0,0],labelHaloColor:y="#fff",labelHaloWidth:x=2,labelStyle:b,textAllowOverlap:v=!1,iconAllowOverlap:C=!0,zoomAdaption:j=!0,zoomShowLabel:_=15,zoomDegradeToPoint:L=10,onClick:z,onMouseEnter:w,onMouseLeave:k,...O}){const M=fe(),[A,T]=d.useState(!1),[S,E]=d.useState(15),R=d.useMemo(()=>Object.keys(o),[o]),P=c??i,B=u??n;if(d.useEffect(()=>{M&&(R.forEach(G=>{M.addImage(G,o[G])}),T(!0))},[M,R,o]),d.useEffect(()=>{if(!M||!j)return;const G=()=>{E(M.getZoom())};return G(),M.on("zoomchange",G),()=>{M.off("zoomchange",G)}},[M,j]),!A)return null;const D=!j||S>=_;return j&&S<L?s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shape:"circle",color:O.color??"#3b82f6",size:6,style:{opacity:.8}}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shapeField:n,shapeValues:R,size:P,style:{...O.style??{},anchor:l,allowOverlap:C},onClick:z,onMouseEnter:w,onMouseLeave:k}),a&&D&&s.jsx(ye,{source:e,sourceType:t,sourceConfig:r,shapeField:B,shapeValues:"text",color:f,size:m,style:{textAnchor:h,textOffset:g,stroke:y,strokeWidth:x,fontWeight:"500",textAllowOverlap:v,...b??{}}})]})}const Qs={gaode:()=>"https://webst0{1-4}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",google:()=>"https://gwxc.shipxy.com/tile.g?z={z}&x={x}&y={y}",tianditu:(e="4043dde46add842282bacc412299311d")=>`https://t{0-7}.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=${e}`},ei={gaode:"高德卫星",tianditu:"天地图卫星",google:"谷歌卫星"};function ti({provider:e="gaode",zIndex:t=0,opacity:r=1,tiandituToken:n,visible:o=!0}){if(!o)return null;const i=Qs[e](n);return s.jsx(cn,{source:i,sourceType:"rasterTile",sourceConfig:{parser:{type:"rasterTile",tileSize:256,zoomOffset:1}},zIndex:t,opacity:r})}function ri({source:e,sourceType:t="json",sourceConfig:r,shape:n="arc",color:o="#2563EB",gradientColors:i,colorMode:l="single",colorField:c,colorValues:a,lineWidth:u=1.5,lineWidthRange:f,weightField:m="weight",opacity:h=.8,blur:g=.6,animate:y=!1,animateSpeed:x=1,animateTrailLength:b=.3,animateDuration:v=2e3,showNodes:C=!0,nodeColor:j,nodeSize:_=4,nodeSizeRange:L,nodePulse:z=!1,activeColor:w="#FFD93D",onArcHover:k,onArcClick:O,onNodeClick:M,style:A}){const T=d.useMemo(()=>r??{x:"fromLng",y:"fromLat",x1:"toLng",y1:"toLat"},[r]),S=d.useMemo(()=>l==="gradient"&&i?i:o,[l,i,o]),E=d.useMemo(()=>u,[u,f]),R=d.useMemo(()=>{if(y)return{enable:!0,speed:x,duration:v,trailLength:b}},[y,x,v,b]),P=d.useMemo(()=>({opacity:h,blur:g,...A}),[h,g,A]),B=d.useMemo(()=>{if(!C||typeof e=="string")return[];const F=new Map,G=T.x??"fromLng",H=T.y??"fromLat",V=T.x1??"toLng",U=T.y1??"toLat";return e.forEach(W=>{const I=`${W[G]}_${W[H]}`,q=`${W[V]}_${W[U]}`;F.has(I)||F.set(I,{lng:Number(W[G]),lat:Number(W[H]),degree:0,name:W.fromName}),F.has(q)||F.set(q,{lng:Number(W[V]),lat:Number(W[U]),degree:0,name:W.toName}),F.get(I).degree++,F.get(q).degree++}),Array.from(F.values())},[e,C,T]),D=j??o;return s.jsxs(s.Fragment,{children:[s.jsx(Ce,{source:e,sourceType:t,sourceConfig:T,shape:n,color:S,colorField:l==="field"?c:void 0,colorValues:l==="field"?a:void 0,size:E,sizeField:f?m:void 0,sizeValues:f||void 0,animate:R,active:w?{color:w}:!1,style:P,onMouseMove:k,onClick:O}),C&&B.length>0&&s.jsx(ye,{source:B,sourceConfig:{x:"lng",y:"lat"},color:D,size:_,sizeField:L?"degree":void 0,sizeValues:L,shape:"circle",style:{opacity:.9,strokeWidth:1,stroke:"#fff"},animate:z?{enable:!0,speed:.6}:void 0,active:w?{color:w}:!1,onClick:M})]})}function ni({path:e,segments:t,stops:r=[],color:n="#2563eb",lineWidth:o=4,opacity:i=.9,glow:l=!0,animate:c=!1,animateSpeed:a=1,stopSize:u=14,stopColor:f,endColor:m="#10b981",showStopIndex:h=!0,activeColor:g="#fbbf24",onPathClick:y,onStopClick:x}){const b=d.useMemo(()=>t&&t.length>0?{type:"FeatureCollection",features:t.map((j,_)=>({type:"Feature",properties:{color:j.color||n,width:j.width||o,index:_},geometry:{type:"LineString",coordinates:j.coordinates}}))}:e&&e.length>1?{type:"FeatureCollection",features:[{type:"Feature",properties:{color:n,width:o},geometry:{type:"LineString",coordinates:e}}]}:null,[e,t,n,o]),v=t&&t.some(j=>j.color),C=d.useMemo(()=>r.map((j,_)=>({...j,index:j.index??_+1,type:j.type??(_===0?"start":_===r.length-1?"end":"waypoint"),stopColor:j.type==="end"||!j.type&&_===r.length-1?m:f??n})),[r,n,f,m]);return b?s.jsxs(s.Fragment,{children:[l&&s.jsx(Ce,{source:b,sourceType:"geojson",shape:"line",color:v?void 0:n,colorField:v?"color":void 0,colorValues:v?t.map(j=>j.color||n):void 0,size:o*2.5,style:{opacity:.15}}),s.jsx(Ce,{source:b,sourceType:"geojson",shape:"line",color:v?void 0:n,colorField:v?"color":void 0,colorValues:v?t.map(j=>j.color||n):void 0,size:v?void 0:o,sizeField:v?"width":void 0,sizeValues:v?t.map(j=>j.width||o):void 0,style:{opacity:i},animate:c?{enable:!0,speed:a,trailLength:.3,duration:2e3}:void 0,active:g?{color:g}:!1,onClick:y}),C.length>0&&s.jsx(ye,{source:C,sourceConfig:{x:"lng",y:"lat"},colorField:"stopColor",colorValues:[...new Set(C.map(j=>j.stopColor))],size:u,shape:"circle",style:{opacity:1,strokeWidth:2,stroke:"#ffffff"},active:g?{color:g}:!1,onClick:x})]}):null}const Cr=[73.482190241,3.8150178409999995,135.106618732,57.630045996],oi={type:"linear",colors:["rgba(92,58,16,0)","rgba(92,58,16,0)","#fabd08","#f1e93f","#f1ff8f","#fcfff7"],positions:[0,3,9,22.5,45,90]};function Sr(e){const t=e[0]/2003750834e-2*180;let r=e[1]/2003750834e-2*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),[t,r]}function si({url:e,extent:t=Cr,renderMode:r="raster",bandIndex:n=0,domain:o=[0,90],noDataValue:i=0,rampColors:l=oi,clampLow:c=!1,clampHigh:a=!1,bands:u=[0,1,2],countCut:f,rMinMax:m,gMinMax:h,bMinMax:g,opacity:y=.8,mask:x=!1,maskData:b}){const[v,C]=d.useState(null),[j,_]=d.useState(null),[L,z]=d.useState(null);d.useEffect(()=>{let E=!1;async function R(){try{const P=await Promise.resolve().then(()=>require("./geotiff-DgvKp-KZ.cjs")).then(I=>I.geotiff),B=await fetch(e);if(!B.ok)throw new Error(`Fetch failed: ${B.status}`);const D=await B.arrayBuffer(),G=await(await P.fromArrayBuffer(D)).getImage(),H=G.getWidth(),V=G.getHeight(),U=await G.readRasters();let W;try{const I=G.getBoundingBox();I&&I.length===4&&(W=I)}catch{}E||(C({rasters:U,width:H,height:V,tiffExtent:W}),z(null))}catch(P){E||(z(P instanceof Error?P.message:"Failed to load TIFF"),console.error("[TiffRasterLayer] Load error:",P))}}return R(),()=>{E=!0}},[e]),d.useEffect(()=>{if(!x||!b)return;let E=!1;return typeof b=="string"?fetch(b).then(R=>R.json()).then(R=>{E||_(R)}).catch(R=>console.error("[TiffRasterLayer] Mask load error:",R)):_(b),()=>{E=!0}},[x,b]);const w=d.useMemo(()=>{if(t!==Cr)return t;if(v!=null&&v.tiffExtent){const[E,R,P,B]=v.tiffExtent;if(Math.abs(E)>180||Math.abs(P)>180){const D=Sr([E,R]),F=Sr([P,B]);return[D[0],D[1],F[0],F[1]]}return v.tiffExtent}return t},[t,v==null?void 0:v.tiffExtent]),k=d.useMemo(()=>{if(!v)return null;if(r==="rgb"){const E={type:"rgb",width:v.width,height:v.height,bands:u,extent:w};return m&&(E.RMinMax=m),h&&(E.GMinMax=h),g&&(E.BMinMax=g),f&&(E.countCut=f),{parser:E}}return r==="ndi"?{parser:{type:"ndi",width:v.width,height:v.height,bands:u,extent:w}}:{parser:{type:"raster",width:v.width,height:v.height,extent:w}}},[v,r,u,w]),O=d.useMemo(()=>r==="rgb"?{opacity:y}:r==="ndi"?{domain:o,rampColors:l,opacity:y}:{clampLow:c,clampHigh:a,domain:o,noDataValue:i,rampColors:l,opacity:y},[r,c,a,o,i,l,y]),M=d.useMemo(()=>v?r==="rgb"||r==="ndi"?v.rasters:v.rasters[n]:null,[v,r,n]),A=fe(),T=d.useRef(null);d.useRef(!1);const S=!x||!!j;return d.useEffect(()=>{if(!A||!k||!M||!S)return;let E=!1;return(async()=>{const R=await import("@antv/l7");if(E)return;T.current&&(A.removeLayer(T.current),T.current=null);const P={zIndex:10};x&&j&&(P.mask=!0,P.maskfence=j);const B=new R.RasterLayer(P);B.source(M,{parser:k.parser}),B.style(O),A.addLayer(B),T.current=B})(),()=>{E=!0,T.current&&A&&(A.removeLayer(T.current),T.current=null)}},[A,k,M,S,j]),null}function ii({children:e,defaultSnap:t="collapsed",collapsedHeight:r=80,halfRatio:n=.45,expandedRatio:o=.85,onSnapChange:i,className:l,showHandle:c=!0,borderRadius:a=32}){const u=d.useRef(null),f=d.useRef(0),m=d.useRef(0),h=d.useRef(!1),[g,y]=d.useState(0),[x,b]=d.useState(t),[v,C]=d.useState(!1),j=d.useCallback(()=>{var A;const M=(A=u.current)==null?void 0:A.offsetParent;return M?M.clientHeight:window.innerHeight},[]),_=d.useCallback(M=>{const A=j();switch(M){case"collapsed":return r;case"half":return A*n;case"expanded":return A*o}},[r,n,o,j]);d.useEffect(()=>{y(_(t))},[t,_]);const L=d.useCallback((M,A)=>{const T=_("collapsed"),S=_("half"),E=_("expanded");let R;if(Math.abs(A)>.5)A>0?R=M>S?"expanded":"half":R=M<S?"collapsed":"half";else{const P=Math.abs(M-T),B=Math.abs(M-S),D=Math.abs(M-E),F=Math.min(P,B,D);F===P?R="collapsed":F===B?R="half":R="expanded"}C(!0),b(R),y(_(R)),i==null||i(R),setTimeout(()=>C(!1),300)},[_,i]),z=d.useCallback(M=>{h.current=!0,f.current=M.touches[0].clientY,m.current=g,C(!1)},[g]),w=d.useCallback(M=>{if(!h.current)return;const A=f.current-M.touches[0].clientY,T=j()*o,S=Math.max(r,Math.min(T,m.current+A));y(S)},[r,o,j]),k=d.useCallback(M=>{if(!h.current)return;h.current=!1;const T=(f.current-M.changedTouches[0].clientY)/100;L(g,T)},[g,L]),O=d.useCallback(M=>{h.current=!0,f.current=M.clientY,m.current=g,C(!1);const A=S=>{if(!h.current)return;const E=f.current-S.clientY,R=j()*o,P=Math.max(r,Math.min(R,m.current+E));y(P)},T=S=>{h.current=!1;const R=(f.current-S.clientY)/100,P=j()*o;L(Math.max(r,Math.min(P,m.current+(f.current-S.clientY))),R),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",T)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",T)},[g,r,o,L,j]);return d.useCallback(M=>{C(!0),b(M),y(_(M)),i==null||i(M),setTimeout(()=>C(!1),300)},[_,i]),s.jsx("div",{ref:u,className:l,style:{position:"absolute",bottom:0,left:0,width:"100%",height:g,zIndex:50,pointerEvents:"auto",transition:v?"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none",willChange:"height",touchAction:"none"},children:s.jsxs("div",{style:{width:"100%",height:"100%",background:"var(--color-surface, #f8f9ff)",borderTopLeftRadius:a,borderTopRightRadius:a,boxShadow:"0 -10px 40px rgba(0, 0, 0, 0.15)",borderTop:"1px solid rgba(195, 198, 215, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[s.jsx("div",{onTouchStart:z,onTouchMove:w,onTouchEnd:k,onMouseDown:O,style:{padding:"12px 0 16px",cursor:"grab",userSelect:"none",flexShrink:0},children:c&&s.jsx("div",{style:{width:48,height:6,borderRadius:3,background:"rgba(195, 198, 215, 0.5)",margin:"0 auto"}})}),s.jsx("div",{style:{flex:1,overflowY:x==="collapsed"?"hidden":"auto",overflowX:"hidden",padding:"0 16px",WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},children:e})]})})}function ai({placeholder:e="搜索地点...",onSearch:t,onFilter:r,className:n,trailing:o}){const[i,l]=d.useState(""),c=d.useCallback(u=>{const f=u.target.value;l(f),t==null||t(f)},[t]),a=d.useCallback(()=>{l(""),t==null||t("")},[t]);return s.jsxs("div",{className:`glass-panel ${n??""}`,style:{display:"flex",alignItems:"center",padding:"12px 16px",borderRadius:16,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.08)",border:"1px solid rgba(195, 198, 215, 0.3)"},children:[s.jsx("span",{className:"material-symbols-outlined",style:{color:"var(--color-primary, #004ac6)",marginRight:12,fontSize:22},children:"search"}),s.jsx("input",{type:"text",value:i,onChange:c,placeholder:e,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:14,lineHeight:"20px",color:"var(--color-on-surface, #121c2a)"}}),i&&s.jsx("button",{onClick:a,style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:999,display:"flex",alignItems:"center",justifyContent:"center"},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18,color:"var(--color-on-surface-variant, #434655)"},children:"close"})}),r&&s.jsx("button",{onClick:r,style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:999,display:"flex",alignItems:"center",justifyContent:"center",marginLeft:4},children:s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:22,color:"var(--color-on-surface-variant, #434655)"},children:"tune"})}),o]})}function Wt(e,t){if(!t)return e;const r={...e};for(const n of Object.keys(t)){const o=t[n],i=r[n];o!==null&&typeof o=="object"&&!Array.isArray(o)&&i!==null&&typeof i=="object"&&!Array.isArray(i)?r[n]=Wt(i,o):o!==void 0&&(r[n]=o)}return r}function li(e,t){return t?Wt(e,t):e}class ci extends d.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){var n,o;(o=(n=this.props).onError)==null||o.call(n,t,r)}render(){if(this.state.hasError){const{fallback:t}=this.props,{error:r}=this.state;return typeof t=="function"?t(r):t||s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:32,color:"#666",fontFamily:"system-ui, sans-serif"},children:[s.jsx("span",{className:"material-symbols-outlined",style:{fontSize:48,marginBottom:16,color:"#e53e3e"},children:"error"}),s.jsx("p",{style:{fontSize:16,fontWeight:600,marginBottom:8},children:"地图加载失败"}),s.jsx("p",{style:{fontSize:13,color:"#999"},children:(r==null?void 0:r.message)??"未知错误"})]})}return this.props.children}}exports.ADMIN_SEQUENTIAL_COLORS=mn;exports.AiMap=os;exports.AiMapJSONSchema=ps;exports.ArcFlowLayer=ri;exports.BUILTIN_ICON_FONTS=xn;exports.BottomSheet=ii;exports.BubbleLayer=gs;exports.ChinaDistrict=Ps;exports.ControlContainer=kt;exports.ControlRegistry=we;exports.ControlRenderer=Qr;exports.DEFAULT_CITY_SOURCE=gn;exports.DEFAULT_DISTRICT_SOURCE=yn;exports.DEFAULT_PROVINCE_SOURCE=hn;exports.ErrorBoundary=ci;exports.EventBus=Tr;exports.EventBusProvider=Ir;exports.ExportImageControl=Pt;exports.FillLayer=ks;exports.FullscreenControl=Nt;exports.GAODE_THEME_PRESETS=xt;exports.GeoLocateControl=Rt;exports.GlyphLayer=Ks;exports.HeatmapHexagonLayer=ln;exports.HeatmapLayer=an;exports.HexagonLayer=ln;exports.INDEPENDENT_MAP_THEME_PRESETS=Bo;exports.IconLayer=Xs;exports.ImageLayer=ms;exports.InteractionRenderer=en;exports.LayerRenderer=Kr;exports.LayerSwitchControl=zt;exports.LegendCategories=Ot;exports.LegendDiverging=$t;exports.LegendIcon=Ht;exports.LegendLineWidth=Zt;exports.LegendProportion=Vt;exports.LegendRamp=Ft;exports.LegendRenderer=tn;exports.LegendSize=Bt;exports.LegendThreshold=Dt;exports.LineLayer=Ce;exports.MapSceneRenderer=Dr;exports.MapThemeControl=It;exports.Marker=Fe;exports.MarkerClusterLayer=ws;exports.MobileSheetLegend=sn;exports.MobileToolbar=on;exports.MouseLocationControl=At;exports.OPENFREEMAP_THEME_PRESETS=Do;exports.PointLayer=ye;exports.PolygonLayer=ot;exports.Popup=Lt;exports.RasterLayer=cn;exports.ResponsiveProvider=rs;exports.RouteLayer=ni;exports.SATELLITE_PROVIDER_NAMES=ei;exports.SatelliteLayer=ti;exports.ScaleControl=Tt;exports.SceneProvider=Fr;exports.SchemaProvider=Mr;exports.SearchBar=ai;exports.ThemeProvider=Pr;exports.TiffRasterLayer=si;exports.Tooltip=Jr;exports.ZoomControl=Mt;exports.adaptHeatmapLayer=Wr;exports.adaptImageLayer=qr;exports.adaptLineLayer=Hr;exports.adaptPointLayer=Vr;exports.adaptPolygonLayer=Ur;exports.adaptRasterLayer=Yr;exports.applyControlDefaults=Er;exports.applyLayerDefaults=_r;exports.applyMapDefaults=nt;exports.applyResponsiveOverrides=li;exports.applySchemaDefaults=jt;exports.createBasemap=$r;exports.createEventBus=Nr;exports.cx=re;exports.deepMerge=Wt;exports.diffSchema=cs;exports.hexToRgba=jo;exports.parseSchema=Lr;exports.useControlContainer=_e;exports.useEventBus=Ct;exports.useMapControl=Ee;exports.useMapPosition=Et;exports.useResponsive=nn;exports.useScene=fe;exports.useSchema=to;exports.useTheme=zr;exports.validateAiMapSchema=us;exports.validateSchema=eo;
|