@nocobase/plugin-map 2.1.0-beta.47 → 2.1.0-beta.48

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.
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- (self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).push([["641"],{302:function(e){"use strict";e.exports=function(){function e(e){var t,l,a=[];return e.AMapUI&&a.push((t=e.AMapUI,new Promise(function(e,l){var a=[];if(t.plugins)for(var c=0;c<t.plugins.length;c+=1)-1==r.AMapUI.plugins.indexOf(t.plugins[c])&&a.push(t.plugins[c]);if(o.AMapUI===n.failed)l("前次请求 AMapUI 失败");else if(o.AMapUI===n.notload){o.AMapUI=n.loading,r.AMapUI.version=t.version||r.AMapUI.version,c=r.AMapUI.version;var u=document.body||document.head,s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/ui/"+c+"/main.js",s.onerror=function(e){o.AMapUI=n.failed,l("请求 AMapUI 失败")},s.onload=function(){if(o.AMapUI=n.loaded,a.length)window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()});else for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()},u.appendChild(s)}else o.AMapUI===n.loaded?t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e():t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):i.AMapUI.push(function(t){t?l(t):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e()})}))),e.Loca&&a.push((l=e.Loca,new Promise(function(e,t){if(o.Loca===n.failed)t("前次请求 Loca 失败");else if(o.Loca===n.notload){o.Loca=n.loading,r.Loca.version=l.version||r.Loca.version;var a=r.Loca.version,c=r.AMap.version.startsWith("2"),u=a.startsWith("2");if(c&&!u||!c&&u)t("JSAPI 与 Loca 版本不对应!!");else{c=r.key,u=document.body||document.head;var s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/loca?v="+a+"&key="+c,s.onerror=function(e){o.Loca=n.failed,t("请求 AMapUI 失败")},s.onload=function(){for(o.Loca=n.loaded,e();i.Loca.length;)i.Loca.splice(0,1)[0]()},u.appendChild(s)}}else o.Loca===n.loaded?l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):e():l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):i.Loca.push(function(e){e?t(e):t()})}))),Promise.all(a)}if(!window)throw Error("AMap JSAPI can only be used in Browser.");(t=n||(n={})).notload="notload",t.loading="loading",t.loaded="loaded",t.failed="failed";var t,n,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]},l=[],a=function(e){"function"==typeof e&&(o.AMap===n.loaded?e(window.AMap):l.push(e))};return{load:function(t){return new Promise(function(i,c){if(o.AMap==n.failed)c("");else if(o.AMap==n.notload){var u=t.key,s=t.version,f=t.plugins;u?(window.AMap&&"lbs.amap.com"!==location.host&&c("禁止多种API加载方式混用"),r.key=u,r.AMap.version=s||r.AMap.version,r.AMap.plugins=f||r.AMap.plugins,o.AMap=n.loading,s=document.body||document.head,window.___onAPILoaded=function(r){if(delete window.___onAPILoaded,r)o.AMap=n.failed,c(r);else for(o.AMap=n.loaded,e(t).then(function(){i(window.AMap)}).catch(c);l.length;)l.splice(0,1)[0]()},(f=document.createElement("script")).type="text/javascript",f.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+r.AMap.version+"&key="+u+"&plugin="+r.AMap.plugins.join(","),f.onerror=function(e){o.AMap=n.failed,c(e)},s.appendChild(f)):c("请填写key")}else if(o.AMap==n.loaded)if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{if(u=[],t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&u.push(t.plugins[s]);u.length?window.AMap.plugin(u,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)}else if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{var p=[];if(t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&p.push(t.plugins[s]);a(function(){p.length?window.AMap.plugin(p,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]}}}}()},119:function(e){e.exports={}},899:function(e,t,n){"use strict";n.d(t,{K0:function(){return i},S4:function(){return l},cV:function(){return u}});var r=n(694),o=n(155),i="map-configuration",l=function(e){return"NOCOBASE_PLUGIN_MAP_CONFIGURATION_".concat(e)};function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c=function(e){var t=sessionStorage.getItem(l(e));try{return t?JSON.parse(t):null}catch(e){return null}},u=function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],u=(0,r.useFlowContext)().api,s=(0,o.useMemo)(function(){return l(e)},[e]),f=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)(function(){return n?c(e):null}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return a(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=f[0],d=f[1];return(0,o.useEffect)(function(){n?d(c(e)):d(null)},[e,n]),(0,o.useEffect)(function(){if(!(n&&c(e))){var t=!1;return u.resource(i).get({isRaw:!n,type:e}).then(function(e){if(!t){var r,o=null==(r=e.data)?void 0:r.data;if(n){var i=sessionStorage.getItem(s);i&&i===JSON.stringify(o)||sessionStorage.setItem(s,JSON.stringify(o))}d(o)}}).catch(function(){}),function(){t=!0}}},[u,e,n,s]),p}},285:function(e,t,n){"use strict";n.d(t,{r:function(){return M},h:function(){return C}});var r=n(375),o=n(625),i=n(59),l=n(155),a=n.n(l),c=n(970),u=n(802),s=n(294),f=n(488),p=n(302),d=n.n(p);n(119);var g=n(694),y=n(899);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var v=function(e){var t,n=e.aMap,r=e.toCenter,c=(0,f.kj)(),u=(0,l.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,l.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return m(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=s[0],d=s[1];(0,l.useEffect)(function(){null==n||n.plugin("AMap.PlaceSearch",function(){n&&(u.current=new n.PlaceSearch({city:"全国",pageSize:30}))})},[n]);var g=(0,o.useDebounceFn)(function(e){u.current&&u.current.search(e||" ",function(e,t){if("complete"===e)d(t.poiList.pois.map(function(e){var t,n;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(e.name,"-").concat(e.address),value:e.id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}));else{if("no_data"===e)return void d([]);i.message.error(c("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}).run;return a().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},a().createElement(i.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:c("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=p.find(function(t){return t.value===e});(null==t?void 0:t.location)&&r(t.location)},options:p,popupMatchSelectWidth:!1}))};function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){b(e,t,n[t])})}return e}function O(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var S={point:{mouseTool:"marker",propertyKey:"position",overlay:"Marker"},polygon:{mouseTool:"polygon",editor:"PolygonEditor",propertyKey:"path",overlay:"Polygon"},lineString:{mouseTool:"polyline",editor:"PolylineEditor",propertyKey:"path",overlay:"Polyline"},circle:{mouseTool:"circle",editor:"CircleEditor",transformOptions:function(e){return{center:e.slice(0,2),radius:e[2]}},overlay:"Circle"}},M=a().forwardRef(function(e,t){var n=(0,y.cV)(e.mapType)||{},c=n.accessKey,p=n.securityJsCode,m=e.value,h=e.onChange,M=e.block,E=void 0!==M&&M,P=e.readonly,I=e.disabled,k=void 0===I?E:I,j=e.zoom,C=e.overlayCommonOptions,x=e.height,L=e.type,U=(0,f.kj)(),T=(0,l.useRef)(),_=(0,l.useRef)(),D=(0,l.useRef)(),z=A((0,l.useState)([]),2),F=z[0],R=z[1],B=A((0,l.useState)(""),2),K=B[0],G=B[1],N="Something went wrong, please refresh the page and try again",$=(0,g.useFlowContext)(),J=(0,l.useRef)(),Z=(0,l.useRef)(null),V=$.router.navigate,W=(0,l.useRef)("nocobase-map-".concat(L||"","-").concat(Date.now().toString(32))),q=i.App.useApp().modal,X=A((0,l.useState)(w({strokeWeight:5,strokeColor:u.A,fillColor:u.A,strokeOpacity:1},C)),1)[0];(0,l.useEffect)(function(){_.current&&!E&&setTimeout(function(){var e;null==(e=_.current)||e.setZoom(j)},500)},[j,_.current,E]);var H=(0,o.useMemoizedFn)(function(){J.current&&J.current.remove()}),Y=(0,o.useMemoizedFn)(function(){(!k||E)&&"point"!==L&&Z.current&&(Z.current.setTarget(J.current),Z.current.open())}),Q=(0,o.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===L){var r=e.getPosition(),o=r.lat;n=[r.lng,o]}else if("polygon"===L||"lineString"===L){if((n=e.getPath().map(function(e){return[e.lng,e.lat]})).length<2)return}else if("circle"===L){var i=e.getCenter(),l=e.getRadius();n=[i.lng,i.lat,l]}t||(H(),J.current=e,Y()),null==h||h(n)}),ee=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L,t=S[e];if(t&&"editor"in t&&!Z.current)return Z.current=new T.current[t.editor](_.current,null,{createOptions:X,editOptions:X,controlPoint:O(w({},X),{strokeWeight:3}),midControlPoint:O(w({},X),{strokeWeight:2,fillColor:"#fff"})}),Z.current.on("adjust",function(e){Q(e.target,!0)}),Z.current.on("move",function(e){Q(e.target,!0)}),Z.current}),et=(0,o.useMemoizedFn)(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L;if(!(!D.current||(null==(e=Z.current)?void 0:e.getTarget()))){var n=S[t];n&&D.current[n.mouseTool](w({},X))}}),en=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L;D.current||(D.current=new T.current.MouseTool(_.current),D.current.on("draw",function(e){Q(e.obj)}),et(e))}),er=(0,l.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m,n=arguments.length>2?arguments[2]:void 0,r=S[e];if(r){var o=w({},X,n);return"transformOptions"in r?Object.assign(o,r.transformOptions(t)):"propertyKey"in r&&(o[r.propertyKey]=t),new T.current[r.overlay](o)}},[X]),eo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m,n=arguments.length>2?arguments[2]:void 0;if(T.current){var r=er(e,t,n);if(r)return r.setMap(_.current),r}};return((0,l.useEffect)(function(){if(T.current&&m&&(P||!J.current)){var e=eo();_.current.setFitView([e]),J.current=e,k||(ee(),Y())}},[m,F,L,X,k,P]),(0,l.useEffect)(function(){var e,t,n;D.current&&(k?(null==(e=D.current)||e.close(),null==(t=Z.current)||t.close()):(et(),null==(n=Z.current)||n.open()))},[k]),(0,l.useEffect)(function(){T.current&&L&&!k&&(en(),ee())},[k,F,L]),(0,l.useEffect)(function(){if(!m&&(D.current||Z.current)&&(H(),Z.current&&(Z.current.setTarget(),Z.current.close()),null==h||h(null)),D.current&&Z.current){var e,t;Z.current.getTarget()?null==(e=(t=D.current).close)||e.call(t):et()}},[L,m]),(0,l.useEffect)(function(){if(c&&!_.current){p&&(window._AMapSecurityConfig=b({},p.endsWith("_AMapService")?"serviceHOST":"securityJsCode",p));var e=window.define;return(window.define=void 0,window.AMap)?void(0,s.zd)(function(){try{_.current=new window.AMap.Map(W.current,{resizeEnable:!0,zoom:j}),T.current=AMap,G(""),R([])}catch(e){G((0,s.DP)(e,N))}finally{window.define=e}}):(d().load({key:c,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(function(t){if(t)return window.define=e,(0,s.zd)(function(){try{_.current=new t.Map(W.current,{resizeEnable:!0,zoom:j}),T.current=t,G(""),R([])}catch(e){G((0,s.DP)(e,N))}})}).catch(function(t){window.define=e;var n=(0,s.DP)(t,N);n.includes("多个不一致的 key")?G(U("The AccessKey is incorrect, please check it")):t&&(void 0===t?"undefined":t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&"type"in t&&"error"===t.type?G(N):G(n)}),function(){var e;null==(e=_.current)||e.destroy(),T.current=null,_.current=null,D.current=null,Z.current=null,d().reset()})}},[c,L,p]),(0,l.useImperativeHandle)(t,function(){return{setOverlay:eo,getOverlay:er,createMouseTool:en,createEditor:ee,executeMouseTool:et,aMap:T.current,map:_.current,overlay:J.current,mouseTool:function(){return D.current},editor:function(){return Z.current},errMessage:K}}),!c||K)?a().createElement(i.Alert,{action:a().createElement(i.Button,{type:"primary",onClick:function(){var e,t;null==(t=$.view)||null==(e=t.close)||e.call(t),V("/admin/settings/map")}},U("Go to the configuration page")),message:K||U("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):a().createElement("div",{style:w({position:"relative",height:x||500},null==e?void 0:e.style),id:W.current},!T.current&&a().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},a().createElement(i.Spin,null)),k?null:a().createElement(a().Fragment,null,a().createElement(v,{toCenter:function(e,t){_.current&&_.current.setZoomAndCenter(18,e,t)},aMap:T.current}),a().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},a().createElement(i.Button,{onClick:function(){J.current&&_.current.setFitView([J.current])},disabled:!J.current,type:"primary",shape:"round",size:"large",icon:a().createElement(r.SyncOutlined,null)})),"point"!==L?a().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},a().createElement(i.Alert,{message:U("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,a().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},a().createElement(i.Button,{disabled:!m,style:{height:"40px"},onClick:function(){var e=function(){H(),Z.current&&(Z.current.setTarget(),Z.current.close()),null==h||h(null)};q.confirm({title:U("Clear the canvas"),content:U("Are you sure to clear the canvas?"),okText:U("Confirm"),cancelText:U("Cancel"),getContainer:function(){return document.getElementById(W.current)},onOk:function(){e()}})},type:"primary",danger:!0},U("Clear")))))});function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||j(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}}M.displayName="AMapCom";var C=function(e){var t,n,p,d,g,y,m=e.collectionField,v=e.marker,h=e.dataSource,b=e.fixedBlock,w=e.zoom,O=e.setSelectedRecordKeys,A=e.lineSort,S=e.fields,E=e.name,j=e.primaryKey,C=e.mapField,x=e.associationCollectionField,L=e.onOpenView,U=I((0,l.useState)(!1),2),T=U[0],_=U[1],D=(0,l.useRef)(),z=null==(d=D.current)||null==(p=d.aMap)?void 0:p.GeometryUtil,F=I((0,l.useState)(""),2),R=F[0],B=F[1],K=(0,f.kj)(),G=(0,l.useRef)(R);G.current=R;var N=null==(g=S.find(function(e){return e.name===v}))?void 0:g.uiSchema,$=m.interface||m.type,J=function(e,t){var n=e.getExtData(),r=void 0===t?n.selected:!t;n.selected=!r,"setIcon"in e&&e.setIcon(new D.current.aMap.Icon({imageSize:[19,32],image:r?c.X:c.F})),e.setOptions(P({extData:n},r?{strokeColor:u.A,fillColor:u.A}:{strokeColor:u.v,fillColor:u.v}))},Z=function(){var e,t,n;D.current&&(null==(e=D.current)||e.mouseTool().close(!0),null==(t=D.current)||t.editor().setTarget(null),null==(n=D.current)||n.editor().close())};(0,l.useEffect)(function(){var e,t,n,r;if("selection"===R)return(null==(e=D.current)?void 0:e.editor())?null==(r=D.current)||r.executeMouseTool("polygon"):(null==(t=D.current)||t.createEditor("polygon"),null==(n=D.current)||n.createMouseTool("polygon")),function(){Z()}},[R]),(0,l.useEffect)(function(){if(R)return function(){if(!G.current){var e;null==(e=D.current)||e.map.getAllOverlays().forEach(function(e){J(e,!1)})}}},[R]);var V=(0,o.useMemoizedFn)(function(){var e,t,n,r=null==(e=D.current)?void 0:e.editor().getTarget(),o=null==(t=D.current)?void 0:t.map.getAllOverlays(),i=null==o?void 0:o.filter(function(e){if(e!==r&&void 0!==e.getExtData().id)return"getPosition"in e?z.isPointInRing(e.getPosition(),null==r?void 0:r.getPath()):z.doesRingRingIntersect(e.getPath(),null==r?void 0:r.getPath())});O(null==i?void 0:i.map(function(e){return J(e,!0),e.getExtData().id})),null==r||r.remove(),null==(n=D.current)||n.editor().close()});return(0,l.useEffect)(function(){if(m&&D.current&&h){var e=h.map(function(e){var t,n=null==(t=(0,s.el)(e,C,null==x?void 0:x.interface))?void 0:t.filter(Boolean),r=(0,s.PB)(N,e[v]);return(null==n?void 0:n.length)?n.map(function(t){var n;return null==(n=D.current)?void 0:n.setOverlay($,t,{strokeColor:u.A,fillColor:u.A,cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:v?(0,s.Gq)(r,K):void 0},extData:{id:e[j]}})}):[]}).flat().filter(Boolean);1===e.length&&"point"===$?(null==(r=D.current)||null==(n=r.map)||n.setFitView(e),null==(i=D.current)||null==(o=i.map)||o.setZoom(w||13)):null==(a=D.current)||null==(l=a.map)||l.setFitView(e);var t=e.map(function(e){var t=function(e){var t=e.target,n=t.getExtData();if(n){if(G.current){"click"===G.current&&(O(function(e){return n.selected?e.filter(function(e){return e!==n.id}):k(e).concat([n.id])}),J(t));return}var r=h.find(function(e){return n.id===e[j]});r&&L(r)}};return e.on("click",t),function(){return e.off("click",t)}});if("point"===$&&(null==A?void 0:A.length)&&(null==e?void 0:e.length)>1){var n,r,o,i,l,a,c,f=e.map(function(e){return e.getPosition()});e[0].setzIndex(13),e[e.length-1].setzIndex(13);var p=function(){var e,t,n=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=D.current)?void 0:e.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:n?K("Start point"):K("End point")},position:f[n?0:f.length-1],map:null==(t=D.current)?void 0:t.map})};e.push.apply(e,k([null==(c=D.current)?void 0:c.setOverlay("lineString",f,{strokeColor:u.A,fillColor:u.A,strokeWeight:2,cursor:"pointer"}),p(),p(!1)].filter(Boolean)))}return function(){e.forEach(function(e){e.remove()}),t.forEach(function(e){return e()})}}},[h,T,C,v,E,j,$,!1,A]),(0,l.useEffect)(function(){setTimeout(function(){O([])})},[h]),a().createElement("div",{style:{position:"relative",height:"100%"}},a().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},!T||(null==(y=D.current)?void 0:y.errMessage)?null:a().createElement(i.Space,{direction:"vertical"},a().createElement(i.Button,{style:{color:R?void 0:u.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("")},icon:a().createElement(r.EnvironmentOutlined,null)}),a().createElement(i.Button,{style:{color:"selection"===R?u.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("selection")},icon:a().createElement(r.ExpandOutlined,null)}),"selection"===R?a().createElement(i.Button,{type:"primary",icon:a().createElement(r.CheckOutlined,null),title:K("Confirm selection"),onClick:V}):null)),a().createElement(M,(t=P({},e),n=n={ref:function(e){D.current=e,_(!!(null==e?void 0:e.map)&&!e.errMessage)},style:b?{height:"100%"}:void 0,zoom:w,type:$,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:u.v,fillColor:u.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},348:function(e,t,n){"use strict";n.d(t,{Y6:function(){return C},G$:function(){return F}});var r,o,i=n(375),l=n(625),a=n(59),c=n(155),u=n.n(c),s=n(970),f=n(802),p=n(294),d=n(488),g=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var r,o,i,l=i[o];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n};let y="__googleMapsScriptId";(r=o||(o={}))[r.INITIALIZED=0]="INITIALIZED",r[r.LOADING=1]="LOADING",r[r.SUCCESS=2]="SUCCESS",r[r.FAILURE=3]="FAILURE";class m{constructor({apiKey:e,authReferrerPolicy:t,channel:n,client:r,id:o=y,language:i,libraries:l=[],mapIds:a,nonce:c,region:u,retries:s=3,url:f="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=n,this.client=r,this.id=o||y,this.language=i,this.libraries=l,this.mapIds=a,this.nonce=c,this.region=u,this.retries=s,this.url=f,this.version=p,m.instance){if(!g(this.options,m.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(m.instance.options)}`);return m.instance}m.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?o.FAILURE:this.done?o.SUCCESS:this.loading?o.LOADING:o.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`&region=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(n=>{n?t(n.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;let n,r,o,i,l,a,c,u,s,f,p;if(document.getElementById(this.id))return void this.callback();let d={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(d).forEach(e=>!d[e]&&delete d[e]),(null==(t=null==(e=null==window?void 0:window.google)?void 0:e.maps)?void 0:t.importLibrary)||(i="google",l="importLibrary",a=document,u=(c=(c=window)[i]||(c[i]={})).maps||(c.maps={}),s=new Set,f=new URLSearchParams,p=()=>n||(n=new Promise((e,t)=>{var l,c,p,g;return l=this,c=void 0,p=void 0,g=function*(){var l;for(o in yield r=a.createElement("script"),r.id=this.id,f.set("libraries",[...s]+""),d)f.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),d[o]);f.set("callback",i+".maps.__ib__"),r.src=this.url+"?"+f,u.__ib__=e,r.onerror=()=>n=t(Error("The Google Maps JavaScript API could not load.")),r.nonce=this.nonce||(null==(l=a.querySelector("script[nonce]"))?void 0:l.nonce)||"",a.head.append(r)},new(p||(p=Promise))(function(e,t){function n(e){try{o(g.next(e))}catch(e){t(e)}}function r(e){try{o(g.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):((o=t.value)instanceof p?o:new p(function(e){e(o)})).then(n,r)}o((g=g.apply(l,c||[])).next())})})),u[l]?console.warn("The Google Maps JavaScript API only loads once. Ignoring:",d):u[l]=(e,...t)=>s.add(e)&&p().then(()=>u[l](e,...t)));let g=this.libraries.map(e=>this.importLibrary(e));g.length||g.push(this.importLibrary("core")),Promise.all(g).then(()=>this.callback(),e=>{let t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){let e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}var v=n(694),h=n(899);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var w=function(e){var t,n=e.toCenter,r=e.mapRef,o=(0,d.kj)(),i=(0,c.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return b(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1];(0,c.useEffect)(function(){google.maps.importLibrary("places").then(function(e){i.current=new e.AutocompleteService}).catch(function(){a.message.error("Please configure the Google API Key correctly")})},[r]);var g=(0,l.useDebounceFn)(function(e){i.current&&i.current.getPlacePredictions({input:e||" "},function(e,t){t!==google.maps.places.PlacesServiceStatus.OK?p([]):p(e.map(function(e){var t,n,r=e.structured_formatting;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(r.main_text).concat(r.secondary_text?" "+r.secondary_text:""),value:e.place_id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}))})},{wait:300}).run;return u().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},u().createElement(a.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:o("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=f.find(function(t){return t.value===e});new google.maps.places.PlacesService(r.current).getDetails({placeId:t.place_id,fields:["geometry"]},function(e,t){t===google.maps.places.PlacesServiceStatus.OK&&n(e.geometry.location)})},options:f}))},O=function(e){return{url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(9.5,42)}};function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function M(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function P(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||k(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}}var j={point:{propertyKey:"position",overlay:"Marker"},polygon:{propertyKey:"paths",overlay:"Polygon"},lineString:{propertyKey:"path",overlay:"Polyline"},circle:{transformOptions:function(e){return{center:new google.maps.LatLng(e[1],e[0]),radius:e[2]}},overlay:"Circle"}},C=u().forwardRef(function(e,t){var n=e.value,r=e.onChange,o=e.block,p=void 0!==o&&o,g=e.readonly,y=e.disabled,b=void 0===y?p:y,C=e.zoom,x=void 0===C?13:C,L=e.overlayCommonOptions,U=e.height,T=e.type,_=((0,h.cV)(e.mapType)||{}).accessKey,D=(0,d.kj)(),z=(0,v.useFlowContext)(),F=(0,c.useRef)(),R=(0,c.useRef)(),B=(0,c.useRef)(),K=I((0,c.useState)([]),2),G=K[0],N=K[1],$=I((0,c.useState)(""),2),J=$[0],Z=$[1],V=a.App.useApp().modal;(0,c.useEffect)(function(){if(R.current&&!p){var e;null==(e=R.current)||e.setZoom(x)}},[x,p]);var W=(0,c.useRef)("point"===T?"marker":"lineString"===T?"polyline":T),q=I((0,c.useState)(E({strokeWeight:5,strokeColor:f.A,fillColor:f.A,strokeOpacity:1,editable:!b,draggable:!b},L)),1)[0],X=z.router.navigate,H=(0,c.useRef)(),Y=(0,c.useRef)(new Set),Q=(0,l.useMemoizedFn)(function(e){if(Y.current.forEach(function(e){Y.current.delete(e)}),"getPath"in e){var t=e.getPath();["insert_at","remove_at","set_at"].forEach(function(n){Y.current.add(t.addListener(n,function(){eo(e,!0)}).remove)})}else M(e,google.maps.Circle)&&["center_changed","radius_changed"].forEach(function(t){Y.current.add(e.addListener(t,function(){eo(e,!0)}).remove)})}),ee=(0,l.useMemoizedFn)(function(){if(B.current&&(B.current.unbindAll(),B.current.setMap(null)),"point"!==T){var e;null==(e=F.current)||e.setDrawingMode(null)}}),et=(0,l.useMemoizedFn)(function(e){if(R.current&&e){var t,n;null==(t=R.current)||t.setCenter(e),null==(n=R.current)||n.setZoom(x)}}),en=(0,l.useMemoizedFn)(function(e){ee(),Q(e),B.current=e}),er=(0,l.useMemoizedFn)(function(e){if(null==e?void 0:e.length){if(1===e.length&&M(e[0],google.maps.Marker)){null==(o=R.current)||null==(r=o.setCenter)||r.call(o,e[0].getPosition()),null==(l=R.current)||null==(i=l.setZoom)||i.call(l,x||13);return}var t,n,r,o,i,l,a=new google.maps.LatLngBounds;e.forEach(function(e){if(M(e,google.maps.Marker))a.extend(e.getPosition());else if(M(e,google.maps.Polyline)||M(e,google.maps.Polygon))for(var t=e.getPath(),n=0;n<t.getLength();n++)a.extend(t.getAt(n));else M(e,google.maps.Circle)&&a.union(e.getBounds())}),null==(n=R.current)||null==(t=n.fitBounds)||t.call(n,a)}}),eo=(0,l.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===T){var o=e.getPosition(),i=o.lat;n=[(0,o.lng)(),i()]}else if("polygon"===T||"lineString"===T){if((n=e.getPath().getArray().map(function(e){return[e.lng(),e.lat()]})).length<2)return}else if("circle"===T){var l=e.getCenter(),a=e.getRadius();n=[l.lng(),l.lat(),a]}t||en(e),null==r||r(n)}),ei=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=P(E({},q,t),{map:R.current});return F.current=new google.maps.drawing.DrawingManager({drawingMode:W.current,drawingControl:!1,markerOptions:P(E({},n),{icon:O(s.X)}),polygonOptions:n,polylineOptions:n,circleOptions:n,map:R.current}),e||F.current.addListener("overlaycomplete",function(e){eo(e.overlay)}),F.current}),el=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0,o=j[e];if(o){var i=E(P(E({},q),{icon:O(s.X)}),r);return"transformOptions"in o?Object.assign(i,o.transformOptions(t)):"propertyKey"in o&&(i[o.propertyKey]=Array.isArray(t[0])?t.map(function(e){return new google.maps.LatLng(e[1],e[0])}):new google.maps.LatLng(t[1],t[0])),new google.maps[o.overlay](i)}}),ea=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0;if(R.current)return el(e,t,P(E({},r),{map:R.current}))});(0,c.useEffect)(function(){if(!n&&R.current){var e,t;ee(),null==F||null==(t=F.current)||null==(e=t.setDrawingMode)||e.call(t,W.current),null==r||r(null)}if(R.current&&n&&(g||!B.current)){var o=ea();en(o),er([o])}},[n,G,T,b,g,ea,er,en]),(0,c.useEffect)(function(){if(_&&!R.current&&H.current){try{e=new m({apiKey:_,version:"weekly",language:z.api.auth.getLocale()})}catch(e){Z(D("Load google maps failed, Please check the Api key and refresh the page"));return}var e,t=console.error;return console.error=function(e){for(var n,r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];(null==e||null==(n=e.includes)?void 0:n.call(e,"InvalidKeyMapError"))&&Z(D("Load google maps failed, Please check the Api key and refresh the page")),t.apply(void 0,[e].concat(function(e){if(Array.isArray(e))return A(e)}(o)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||k(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()))},Promise.all([e.importLibrary("drawing"),e.importLibrary("core"),e.importLibrary("geometry")]).then(function(e){var t;return(t=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return[4,new Promise(function(e){var t=function(){e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){var n=t.coords;e({lat:n.latitude,lng:n.longitude})},function(){t()},{timeout:2e3,maximumAge:0}):t()})];case 1:return e=t.sent(),R.current=new google.maps.Map(H.current,{zoom:x,center:e,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),Z(""),N([]),[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function l(e){S(i,r,o,l,a,"next",e)}function a(e){S(i,r,o,l,a,"throw",e)}l(void 0)})})()}).catch(function(e){if(M(e,Error))return void Z(e.message)}),function(){var e,t;null==(e=R.current)||e.unbindAll(),R.current=null,null==(t=F.current)||t.unbindAll()}}},[_,z.api.auth,T,x]),(0,c.useEffect)(function(){R.current&&T&&!b&&!F.current&&ei()},[ei,b,G,T]),(0,c.useImperativeHandle)(t,function(){return{setOverlay:ea,getOverlay:el,setFitView:er,createDraw:ei,map:R.current,overlay:B.current,drawingManager:F.current,errMessage:J}});var ec=(0,l.useMemoizedFn)(function(){var e=function(){ee(),F.current.setDrawingMode(W.current),null==r||r(null)};V.confirm({title:D("Clear the canvas"),content:D("Are you sure to clear the canvas?"),okText:D("Confirm"),cancelText:D("Cancel"),getContainer:function(){return H.current},onOk:function(){e()}})});return!_||J?u().createElement(a.Alert,{action:u().createElement(a.Button,{type:"primary",onClick:function(){var e,t;null==(t=z.view)||null==(e=t.close)||e.call(t),X("/admin/settings/map?tab=google")}},D("Go to the configuration page")),message:J||D("Please configure the Api key first"),type:"error"}):u().createElement("div",{style:{position:"relative",height:U||500}},!R.current&&u().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},u().createElement(a.Spin,null)),b?null:u().createElement(u().Fragment,null,R.current&&u().createElement(w,{toCenter:et,mapRef:R}),u().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},u().createElement(a.Button,{onClick:function(){B.current&&er([B.current])},disabled:!B.current,type:"primary",shape:"round",size:"large",icon:u().createElement(i.SyncOutlined,null)})),"lineString"===T||"polygon"===T?u().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},u().createElement(a.Alert,{message:D("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,u().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},u().createElement(a.Button,{disabled:!n,style:{height:"40px"},onClick:ec,type:"primary",danger:!0},D("Clear")))),u().createElement("div",{ref:H,style:E({width:"100%",height:"100%"},null==e?void 0:e.style)}))});function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function L(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||_(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){if(e){if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x(e,t)}}C.displayName="GoogleMapsCom";var D="google-maps-overlay-id",z="google-maps-overlay-selected",F=function(e){var t,n,r,o=e.collectionField,g=e.marker,y=e.dataSource,m=e.fixedBlock,v=e.zoom,h=e.setSelectedRecordKeys,b=e.lineSort,w=e.fields,A=(e.name,e.primaryKey),S=e.mapField,M=e.associationCollectionField,E=e.onOpenView,P=T((0,c.useState)(!1),2),I=P[0],k=P[1],j=(0,c.useRef)(),F=T((0,c.useState)(""),2),R=F[0],B=F[1],K=(0,d.kj)(),G=(T((0,c.useState)(null),2)[1],(0,c.useRef)(R)),N=(0,c.useRef)(null),$=(0,c.useRef)([]);G.current=R;var J=null==(r=w.find(function(e){return e.name===g}))?void 0:r.uiSchema,Z=o.interface||o.type,V=function(e,t){var n=void 0!==t?!t:e.get(z);e.set(z,!n),e.setOptions(U({},n?{icon:O(s.X),strokeColor:f.A,fillColor:f.A}:{icon:O(s.F),strokeColor:f.v,fillColor:f.v}))};(0,c.useEffect)(function(){if("selection"===R){!j.current||(null==(e=j.current)?void 0:e.drawingManager)||(j.current.drawingManager=null==(r=j.current)?void 0:r.createDraw(!0,{editable:!0,draggable:!0}));var e,t,n,r,o=new Set;return null==(t=j.current)||t.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON),null==(n=j.current)||n.drawingManager.addListener("overlaycomplete",function(e){var t,n=e.overlay;null==(t=j.current)||t.drawingManager.setDrawingMode(null),N.current=n;var r=n.getPath();["insert_at","remove_at","set_at"].forEach(function(e){o.add(r.addListener(e,function(){}).remove)})}),function(){var e,t,n,r;o.forEach(function(e){e()}),j.current&&(null==(e=N.current)||e.unbindAll(),null==(t=N.current)||t.setMap(null),N.current=null,null==(n=j.current)||n.drawingManager.setDrawingMode(null),null==(r=j.current)||r.drawingManager.unbindAll())}}},[R]),(0,c.useEffect)(function(){if(R)return function(){G.current||$.current.forEach(function(e){V(e,!1)})}},[R]);var W=(0,l.useMemoizedFn)(function(){var e,t=N.current,n=$.current,r=google.maps.geometry.poly,o=n.filter(function(e){if(e!==t&&void 0!==e.get(D))if(L(e,google.maps.Marker))return r.containsLocation(e.getPosition(),t);else if(L(e,google.maps.Circle))return r.containsLocation(e.getCenter(),t);else return e.getPath().getArray().some(function(e){return r.containsLocation(e,t)})}).map(function(e){return V(e,!0),e.get(D)});h(function(e){return o.concat(e)}),null==t||t.unbindAll(),null==t||t.setMap(null),null==(e=j.current)||e.drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON)});return(0,c.useEffect)(function(){if(o&&(null==y?void 0:y.length)&&(null==(r=j.current)?void 0:r.map)){var e=y.map(function(e){var t,n=null==(t=(0,p.el)(e,S,null==M?void 0:M.interface))?void 0:t.filter(Boolean),r=(0,p.PB)(J,e[g]);return(null==n?void 0:n.length)?null==n?void 0:n.filter(Boolean).map(function(t){if(n){var o,i=null==(o=j.current)?void 0:o.setOverlay(Z,t,{strokeColor:f.A,fillColor:f.A,cursor:"pointer",label:{className:"nb-map-google-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:g?(0,p.Gq)(r,K):void 0}});return null==i||i.set(D,e[A]),i}}):[]}).flat().filter(Boolean);$.current=e;var t=e.map(function(e){return e.addListener("click",function(t){var n=e.get(D);if(n){var r=null==y?void 0:y.find(function(e){return n===e[A]});r&&E(r)}}),function(){return e.unbindAll()}});if("point"===Z&&(null==b?void 0:b.length)&&(null==e?void 0:e.length)>1){var n,r,i,l=e.map(function(e){return e.getPosition()});e[0].setZIndex(138),e[e.length-1].setZIndex(138);var a=function(){var e,t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=j.current)?void 0:e.map)return new google.maps.Marker({label:{className:"nb-map-google-point-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:t?K("Start point"):K("End point")},icon:O(s.X),position:t?l[0]:l[l.length-1],map:j.current.map})};e.push.apply(e,function(e){if(Array.isArray(e))return x(e)}(n=[j.current.setOverlay("lineString",l.map(function(e){return[e.lng(),e.lat()]}),{strokeColor:f.A,fillColor:f.A,strokeWeight:2,cursor:"pointer"}),a(),a(!1)].filter(Boolean))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||_(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}return null==(i=j.current)||i.setFitView(e),function(){e.forEach(function(e){e.setMap(null),e.unbindAll()}),t.forEach(function(e){return e()})}}},[y,I,g,Z,!1]),(0,c.useEffect)(function(){setTimeout(function(){h([])})},[y]),u().createElement("div",{style:{position:"relative",height:"100%"}},I&&u().createElement(u().Fragment,null,u().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},u().createElement(a.Space,{direction:"vertical"},u().createElement(a.Button,{style:{color:R?void 0:f.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("")},icon:u().createElement(i.EnvironmentOutlined,null)}),u().createElement(a.Button,{style:{color:"selection"===R?f.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("selection")},icon:u().createElement(i.ExpandOutlined,null)}),"selection"===R?u().createElement(a.Button,{type:"primary",icon:u().createElement(i.CheckOutlined,null),title:K("Confirm selection"),onClick:W}):null))),u().createElement(C,(t=U({},e),n=n={ref:function(e){j.current=e,k(!!(null==e?void 0:e.map)&&!e.errMessage)},style:m?{height:"100%"}:void 0,zoom:v,type:Z,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:f.v,fillColor:f.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},970:function(e,t,n){"use strict";n.d(t,{F:function(){return i},X:function(){return l}});var r=n(802),o=function(e){return"data:image/svg+xml;utf8,".concat(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="38" height="63" viewBox="0 0 38 63"><path fill="'.concat(e,'" d="M19 0C8.5 0 0 8.5 0 19c0 14.2 19 44 19 44s19-29.8 19-44C38 8.5 29.5 0 19 0Z"/><circle fill="white" cx="19" cy="19" r="8"/></svg>')))},i=o(r.v),l=o(r.A)},802:function(e,t,n){"use strict";n.d(t,{A:function(){return r},v:function(){return o}});var r="#4e9bff",o="#F18b62"},294:function(e,t,n){"use strict";n.d(t,{DP:function(){return i},Gq:function(){return l},PB:function(){return a},el:function(){return r},zd:function(){return o}});var r=function(e,t,n){var r=null==t?void 0:t.reduce(function(e,r,o){return o===t.length-1&&("o2m"===n||"m2m"===n)?null==e?void 0:e.map(function(e){return e[r]}).filter(function(e){return null!=e}):null==e?void 0:e[r]},e);return"o2m"===n||"m2m"===n?r:[r]},o=function(e){window.requestIdleCallback?window.requestIdleCallback(function(){e()}):window.setTimeout(e,1)},i=function(e,t){if("string"==typeof e)return e;if((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"message"in e){var n,r=e.message;if("string"==typeof r&&r)return r}return t},l=function(e,t){return"string"!=typeof e?e:e.replace(/\{\{\s*t\(['"]([^'"]+)['"](?:,\s*([^}]+))?\)\s*\}\}/g,function(e,n){return t?t(n):n})},a=function(e,t){if(null==t)return t;var n=(null==e?void 0:e.enum)||(null==e||null==(r=e["x-component-props"])?void 0:r.options);if(Array.isArray(n)){var r,o,i,l=n.find(function(e){return(null==e?void 0:e.value)===t});if(l)return null!=(o=null!=(i=l.label)?i:l.title)?o:t}return t}}}]);