qy-vue-plugins 0.1.34 → 0.1.35

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.
Files changed (25) hide show
  1. package/dist/chunks/{CreateData.vue_vue_type_script_setup_true_lang-adnTDvi9.js → CreateData.vue_vue_type_script_setup_true_lang-CtZGkue9.js} +9 -8
  2. package/dist/chunks/CreateData.vue_vue_type_script_setup_true_lang-DZJuz1uU.js +1 -0
  3. package/dist/chunks/{MapTools.vue_vue_type_style_index_0_lang-pXJrMAxB.js → MapTools.vue_vue_type_style_index_0_lang-CaVrxvuV.js} +1 -1
  4. package/dist/chunks/{MapTools.vue_vue_type_style_index_0_lang-CAyDu7kx.js → MapTools.vue_vue_type_style_index_0_lang-CePpdIw5.js} +2 -2
  5. package/dist/chunks/{ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-Cv8xkKoZ.js → ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-BsMK0hpE.js} +2 -1
  6. package/dist/chunks/{ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-BE7f7luj.js → ReplaceSpeciesNameDialog.vue_vue_type_script_setup_true_lang-Crqsopo0.js} +1 -1
  7. package/dist/manageTable/CreateData.cjs +1 -1
  8. package/dist/manageTable/CreateData.mjs +1 -1
  9. package/dist/manageTable/FilterItem.cjs +1 -1
  10. package/dist/manageTable/FilterItem.mjs +26 -25
  11. package/dist/manageTable/ReplaceSpeciesNameDialog.cjs +1 -1
  12. package/dist/manageTable/ReplaceSpeciesNameDialog.mjs +1 -1
  13. package/dist/manageTable/SortItem.cjs +1 -1
  14. package/dist/manageTable/SortItem.mjs +31 -30
  15. package/dist/manageTable/manageTable.cjs +1 -1
  16. package/dist/manageTable/manageTable.mjs +474 -476
  17. package/dist/mapbox/components/MapTools.cjs +1 -1
  18. package/dist/mapbox/components/MapTools.mjs +1 -1
  19. package/dist/mapbox/widgets/LayerDialog.cjs +1 -1
  20. package/dist/mapbox/widgets/LayerDialog.mjs +35 -35
  21. package/dist/mapbox.cjs +1 -1
  22. package/dist/mapbox.mjs +1 -1
  23. package/dist/qy-vue-plugins.css +1 -1
  24. package/package.json +1 -1
  25. package/dist/chunks/CreateData.vue_vue_type_script_setup_true_lang-CJPUwPxC.js +0 -1
@@ -22,7 +22,7 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
22
22
  "soilResearchCollect",
23
23
  "humanActivity",
24
24
  "naturalDisaster"
25
- ], g = i(!1), K = U, t = i(), P = async () => {
25
+ ], b = i(!1), K = U, t = i(), P = async () => {
26
26
  if (t.value && C.indexOf(t.value) == -1 && l.researchId == null) {
27
27
  s.error("请选择样地或样线数据");
28
28
  return;
@@ -48,7 +48,7 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
48
48
  return;
49
49
  }
50
50
  if (V) {
51
- g.value = !0;
51
+ b.value = !0;
52
52
  try {
53
53
  var n = [];
54
54
  for (let e = 0; e < l.addCount; e++) {
@@ -59,7 +59,7 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
59
59
  } catch (e) {
60
60
  console.log(e);
61
61
  }
62
- K("closed"), g.value = !1;
62
+ K("closed"), b.value = !1;
63
63
  } else
64
64
  s.warning("该调查不支持添加");
65
65
  f.value = !1;
@@ -67,8 +67,8 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
67
67
  if (t.value = n, f.value = !0, m.value = [], l.researchId = void 0, l.addCount = 1, v.value = {
68
68
  id: null
69
69
  }, a) {
70
- let [b, E] = a.split(",");
71
- l.layerName = b, E && (l.tableIndex = `0-${E}`);
70
+ let [g, E] = a.split(",");
71
+ l.layerName = g, E && (l.tableIndex = `0-${E}`);
72
72
  }
73
73
  if (["naturalDisaster", "humanActivity", "speciesDistribution"].indexOf(t.value) != -1 && (l.type = t.value), C.indexOf(n) == -1 && I) {
74
74
  var e = await I({
@@ -93,7 +93,8 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
93
93
  title: "添加数据",
94
94
  modelValue: f.value,
95
95
  "onUpdate:modelValue": a[4] || (a[4] = (e) => f.value = e),
96
- width: "800px"
96
+ width: "800px",
97
+ "append-to-body": ""
97
98
  }, {
98
99
  footer: r(() => [
99
100
  k("span", null, [
@@ -108,7 +109,7 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
108
109
  d(o(A), {
109
110
  type: "primary",
110
111
  onClick: P,
111
- loading: g.value,
112
+ loading: b.value,
112
113
  plain: ""
113
114
  }, {
114
115
  default: r(() => [...a[6] || (a[6] = [
@@ -189,7 +190,7 @@ const te = { style: { float: "left" } }, oe = { style: { float: "right", color:
189
190
  default: r(() => [
190
191
  d(o(W), {
191
192
  modelValue: p.value[e - 1],
192
- "onUpdate:modelValue": (b) => p.value[e - 1] = b,
193
+ "onUpdate:modelValue": (g) => p.value[e - 1] = g,
193
194
  placeholder: "请输入标题"
194
195
  }, null, 8, ["modelValue", "onUpdate:modelValue"])
195
196
  ]),
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),a=require("element-plus"),D=require("../manageTable/Block.cjs"),c=require("./ProvideKeys-BPenLFlD.js"),I={style:{float:"left"}},R={style:{float:"right",color:"var(--el-text-color-secondary)","font-size":"13px"}},_={key:1},O=e.defineComponent({__name:"CreateData",emits:["closed"],setup(S,{expose:k,emit:x}){const v=e.inject(c.apiRowDataOptionsKey),h=e.inject(c.queryResearchDataOptionsKey),C=e.inject(c.projectIdKey),V=e.inject(c.researchStandardKey),u=e.ref(!1),i=e.ref([]),o=e.reactive({researchId:void 0,addCount:1,layerName:"",tableIndex:"0",blockId:null,type:"1",projectId:C}),s=e.ref([]),y=["forestResearchPlot","shrubResearchPlot","grassResearchPlot","wetlandResearchPlot"],f=["plantResearchCollect","fungusResearchCollect","speciesDistribution","waterResearchCollect","soilResearchCollect","humanActivity","naturalDisaster"],p=e.ref(!1),E=x,r=e.ref(),b=async()=>{if(r.value&&f.indexOf(r.value)==-1&&o.researchId==null){a.ElMessage.error("请选择样地或样线数据");return}if(r.value&&y.indexOf(r.value)>-1&&o.blockId==null){a.ElMessage.error("请选择样方号");return}if(o.addCount==null){a.ElMessage.error("请选择单次增加条数");return}if(o.addCount<1){a.ElMessage.error("单次增加条数不能小于1");return}if(o.addCount>100){a.ElMessage.error("单次增加条数不能大于100");return}if(!r.value){a.ElMessage.error("请选择调查类型");return}if(v){p.value=!0;try{var n=[];for(let t=0;t<o.addCount;t++){var l={createDate:a.dayjs().unix(),...e.toRaw(o)};r.value=="speciesDistribution"&&(l.speciesName="待鉴定",l.speciesType="plant"),["humanActivity","naturalDisaster"].includes(r.value)&&(console.log(s.value[t]),l.title=s.value[t]),n.push(l)}await v(n),a.ElMessage.success("添加成功")}catch(t){console.log(t)}E("closed"),p.value=!1}else a.ElMessage.warning("该调查不支持添加");u.value=!1},w=async(n,l)=>{if(r.value=n,u.value=!0,i.value=[],o.researchId=void 0,o.addCount=1,d.value={id:null},l){let[m,g]=l.split(",");o.layerName=m,g&&(o.tableIndex=`0-${g}`)}if(["naturalDisaster","humanActivity","speciesDistribution"].indexOf(r.value)!=-1&&(o.type=r.value),f.indexOf(n)==-1&&h){var t=await h({pageSize:99999,pageNum:1,projectId:C,researchStandard:V});i.value=t.data?.list||t.data}},d=e.ref({id:null}),N=n=>{d.value=i.value.find(l=>l.id==n)},B=n=>{o.blockId=n};return k({showDialog:w}),(n,l)=>(e.openBlock(),e.createBlock(e.unref(a.ElDialog),{center:"",title:"添加数据",modelValue:u.value,"onUpdate:modelValue":l[4]||(l[4]=t=>u.value=t),width:"800px","append-to-body":""},{footer:e.withCtx(()=>[e.createElementVNode("span",null,[e.createVNode(e.unref(a.ElButton),{onClick:l[3]||(l[3]=t=>u.value=!1)},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(a.ElButton),{type:"primary",onClick:b,loading:p.value,plain:""},{default:e.withCtx(()=>[...l[6]||(l[6]=[e.createTextVNode("创建",-1)])]),_:1},8,["loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(a.ElForm),{model:o,ref:"form","label-width":"auto",inline:!1},{default:e.withCtx(()=>[r.value&&f.indexOf(r.value)==-1?(e.openBlock(),e.createBlock(e.unref(a.ElFormItem),{key:0,label:"样地或样线数据:"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElSelect),{modelValue:o.researchId,"onUpdate:modelValue":l[0]||(l[0]=t=>o.researchId=t),"value-key":"",placeholder:"选择样地或样线数据",filterable:"",onChange:N},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,t=>(e.openBlock(),e.createBlock(e.unref(a.ElOption),{key:t.id,label:t.serialNumberAndCode,value:t.id},{default:e.withCtx(()=>[e.createElementVNode("span",I,e.toDisplayString(t.serialNumberAndCode),1),e.createElementVNode("span",R,e.toDisplayString(t.researchArea),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):e.createCommentVNode("",!0),r.value&&y.indexOf(r.value)>-1&&d.value.id?(e.openBlock(),e.createBlock(e.unref(a.ElFormItem),{key:1,label:"选择样方号:"},{default:e.withCtx(()=>[d.value.id?(e.openBlock(),e.createBlock(D.default,{key:0,data:d.value,"show-code":!1,"select-mode":!0,onSelected:B},null,8,["data"])):(e.openBlock(),e.createElementBlock("div",_,"尚未选择样地数据"))]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(a.ElFormItem),{label:"单次增加条数:"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElInputNumber),{modelValue:o.addCount,"onUpdate:modelValue":l[1]||(l[1]=t=>o.addCount=t),min:1,max:100,step:2,onChange:l[2]||(l[2]=t=>s.value.length=o.addCount)},null,8,["modelValue"])]),_:1}),r.value&&["humanActivity","naturalDisaster"].includes(r.value)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(o.addCount,t=>(e.openBlock(),e.createBlock(e.unref(a.ElFormItem),{label:"标题:"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.ElInput),{modelValue:s.value[t-1],"onUpdate:modelValue":m=>s.value[t-1]=m,placeholder:"请输入标题"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024))),256)):e.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["modelValue"]))}});exports._sfc_main=O;
@@ -1 +1 @@
1
- "use strict";const p=require("vue"),oe=require("./_commonjsHelpers-DwGv2jUC.js"),At=require("./ProvideKeys-jy8dfV9u.js"),Ge=require("./EventKeys-BLmCVdTJ.js"),Ft=require("./constant-Bc8XErtI.js"),Dt=require("@turf/turf"),wt=require("@element-plus/icons-vue"),Rt=require("element-plus");function kt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Q=kt(Dt),R={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},G={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},I={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},k={POLYGON:"polygon",LINE:"line_string",POINT:"point"},g={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},v={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},D={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},ie={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},P={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},b={ACTIVE:"true",INACTIVE:"false"},it=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],Ut=-90,Oe=-85,Vt=90,be=85,xt=-270,Bt=270,st=Object.freeze(Object.defineProperty({__proto__:null,LAT_MAX:Vt,LAT_MIN:Ut,LAT_RENDERED_MAX:be,LAT_RENDERED_MIN:Oe,LNG_MAX:Bt,LNG_MIN:xt,activeStates:b,classes:R,cursors:I,events:D,geojsonTypes:g,interactions:it,meta:P,modes:v,sources:G,types:k,updateActions:ie},Symbol.toStringTag,{value:"Module"}));function me(e){return function(t){const n=t.featureTarget;return!n||!n.properties?!1:n.properties.meta===e}}function at(e){return!e.originalEvent||!e.originalEvent.shiftKey?!1:e.originalEvent.button===0}function z(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===b.ACTIVE&&e.featureTarget.properties.meta===P.FEATURE}function De(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===b.INACTIVE&&e.featureTarget.properties.meta===P.FEATURE}function ye(e){return e.featureTarget===void 0}function we(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.meta===P.FEATURE}function se(e){const t=e.featureTarget;return!t||!t.properties?!1:t.properties.meta===P.VERTEX}function he(e){return e.originalEvent?e.originalEvent.shiftKey===!0:!1}function Ee(e){return e.key==="Escape"||e.keyCode===27}function ve(e){return e.key==="Enter"||e.keyCode===13}function Le(e){return e.key==="Backspace"||e.keyCode===8}function Ne(e){return e.key==="Delete"||e.keyCode===46}function ut(e){return e.key==="1"||e.keyCode===49}function lt(e){return e.key==="2"||e.keyCode===50}function ct(e){return e.key==="3"||e.keyCode===51}function dt(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function Gt(){return!0}const $t=Object.freeze(Object.defineProperty({__proto__:null,isActiveFeature:z,isBackspaceKey:Le,isDeleteKey:Ne,isDigit1Key:ut,isDigit2Key:lt,isDigit3Key:ct,isDigitKey:dt,isEnterKey:ve,isEscapeKey:Ee,isFeature:we,isInactiveFeature:De,isOfMetaType:me,isShiftDown:he,isShiftMousedown:at,isTrue:Gt,isVertex:se,noTarget:ye},Symbol.toStringTag,{value:"Module"}));var le={},te={},$e;function qt(){return $e||($e=1,te.RADIUS=6378137,te.FLATTENING=1/298.257223563,te.POLAR_RADIUS=63567523142e-4),te}var qe;function Jt(){if(qe)return le;qe=1;var e=qt();le.geometry=t,le.ring=r;function t(i){var s=0,l;switch(i.type){case"Polygon":return n(i.coordinates);case"MultiPolygon":for(l=0;l<i.coordinates.length;l++)s+=n(i.coordinates[l]);return s;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(l=0;l<i.geometries.length;l++)s+=t(i.geometries[l]);return s}}function n(i){var s=0;if(i&&i.length>0){s+=Math.abs(r(i[0]));for(var l=1;l<i.length;l++)s-=Math.abs(r(i[l]))}return s}function r(i){var s,l,c,a,h,E,u,d=0,f=i.length;if(f>2){for(u=0;u<f;u++)u===f-2?(a=f-2,h=f-1,E=0):u===f-1?(a=f-1,h=0,E=1):(a=u,h=u+1,E=u+2),s=i[a],l=i[h],c=i[E],d+=(o(c[0])-o(s[0]))*Math.sin(o(l[1]));d=d*e.RADIUS*e.RADIUS/2}return d}function o(i){return i*Math.PI/180}return le}var Kt=Jt();const Yt=oe.getDefaultExportFromCjs(Kt),Je={Point:0,LineString:1,MultiLineString:1,Polygon:2};function Xt(e,t){const n=Je[e.geometry.type]-Je[t.geometry.type];return n===0&&e.geometry.type===g.POLYGON?e.area-t.area:n}function ft(e){return e.map(t=>(t.geometry.type===g.POLYGON&&(t.area=Yt.geometry({type:g.FEATURE,property:{},geometry:t.geometry})),t)).sort(Xt).map(t=>(delete t.area,t))}function pt(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function $(e){if(this._items={},this._nums={},this._length=e?e.length:0,!!e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),e[t]!==void 0&&(typeof e[t]=="string"?this._items[e[t]]=t:this._nums[e[t]]=t)}$.prototype.add=function(e){return this.has(e)?this:(this._length++,typeof e=="string"?this._items[e]=this._length:this._nums[e]=this._length,this)};$.prototype.delete=function(e){return this.has(e)===!1?this:(this._length--,delete this._items[e],delete this._nums[e],this)};$.prototype.has=function(e){return typeof e!="string"&&typeof e!="number"?!1:this._items[e]!==void 0||this._nums[e]!==void 0};$.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)};$.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const Ht=[P.FEATURE,P.MIDPOINT,P.VERTEX],j={click:Zt,touch:Wt};function Zt(e,t,n){return ht(e,t,n,n.options.clickBuffer)}function Wt(e,t,n){return ht(e,t,n,n.options.touchBuffer)}function ht(e,t,n,r){if(n.map===null)return[];const o=e?pt(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(a=>a.id).filter(a=>n.map.getLayer(a)!=null));const s=n.map.queryRenderedFeatures(o,i).filter(a=>Ht.indexOf(a.properties.meta)!==-1),l=new $,c=[];return s.forEach(a=>{const h=a.properties.id;l.has(h)||(l.add(h),c.push(a))}),ft(c)}function pe(e,t){const n=j.click(e,null,t),r={mouse:I.NONE};return n[0]&&(r.mouse=n[0].properties.active===b.ACTIVE?I.MOVE:I.POINTER,r.feature=n[0].properties.meta),t.events.currentModeName().indexOf("draw")!==-1&&(r.mouse=I.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function Re(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}const zt=4,Qt=12,jt=500;function Pe(e,t,n={}){const r=n.fineTolerance!=null?n.fineTolerance:zt,o=n.grossTolerance!=null?n.grossTolerance:Qt,i=n.interval!=null?n.interval:jt;e.point=e.point||t.point,e.time=e.time||t.time;const s=Re(e.point,t.point);return s<r||s<o&&t.time-e.time<i}const en=25,tn=250;function Ae(e,t,n={}){const r=n.tolerance!=null?n.tolerance:en,o=n.interval!=null?n.interval:tn;return e.point=e.point||t.point,e.time=e.time||t.time,Re(e.point,t.point)<r&&t.time-e.time<o}const Fe=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(i,s,l){if(n[i]===void 0)throw new Error(`Invalid event type: ${i}`);n[i].push({selector:s,fn:l})},render(i){t.store.featureChanged(i)}},o=function(i,s){const l=n[i];let c=l.length;for(;c--;){const a=l[c];if(a.selector(s)){a.fn.call(r,s)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){o("drag",i)},click(i){o("click",i)},mousemove(i){o("mousemove",i)},mousedown(i){o("mousedown",i)},mouseup(i){o("mouseup",i)},mouseout(i){o("mouseout",i)},keydown(i){o("keydown",i)},keyup(i){o("keyup",i)},touchstart(i){o("touchstart",i)},touchmove(i){o("touchmove",i)},touchend(i){o("touchend",i)},tap(i){o("tap",i)}}};let nn=(e,t=21)=>(n=t)=>{let r="",o=n|0;for(;o--;)r+=e[Math.random()*e.length|0];return r};const rn=nn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function ke(){return rn()}const w=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||ke(),this.type=t.geometry.type};w.prototype.changed=function(){this.ctx.store.featureChanged(this.id)};w.prototype.incomingCoords=function(e){this.setCoordinates(e)};w.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()};w.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))};w.prototype.setProperty=function(e,t){this.properties[e]=t};w.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:g.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))};w.prototype.internal=function(e){const t={id:this.id,meta:P.FEATURE,"meta:type":this.type,active:b.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:g.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const W=function(e,t){w.call(this,e,t)};W.prototype=Object.create(w.prototype);W.prototype.isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"};W.prototype.updateCoordinate=function(e,t,n){arguments.length===3?this.coordinates=[t,n]:this.coordinates=[e,t],this.changed()};W.prototype.getCoordinate=function(){return this.getCoordinates()};const X=function(e,t){w.call(this,e,t)};X.prototype=Object.create(w.prototype);X.prototype.isValid=function(){return this.coordinates.length>1};X.prototype.addCoordinate=function(e,t,n){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])};X.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))};X.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)};X.prototype.updateCoordinate=function(e,t,n){const r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};const x=function(e,t){w.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};x.prototype=Object.create(w.prototype);x.prototype.isValid=function(){return this.coordinates.length===0?!1:this.coordinates.every(e=>e.length>2)};x.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()};x.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()};x.prototype.addCoordinate=function(e,t,n){this.changed();const r=e.split(".").map(i=>parseInt(i,10));this.coordinates[r[0]].splice(r[1],0,[t,n])};x.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))};x.prototype.getCoordinate=function(e){const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];return JSON.parse(JSON.stringify(n[t[1]]))};x.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))};x.prototype.updateCoordinate=function(e,t,n){this.changed();const r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);this.coordinates[o]===void 0&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};const on={MultiPoint:W,MultiLineString:X,MultiPolygon:x},Ce=(e,t,n,r,o)=>{const i=n.split("."),s=parseInt(i[0],10),l=i[1]?i.slice(1).join("."):null;return e[s][t](l,r,o)},F=function(e,t){if(w.call(this,e,t),delete this.coordinates,this.model=on[t.geometry.type],this.model===void 0)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};F.prototype=Object.create(w.prototype);F.prototype._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:ke(),type:g.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))};F.prototype.isValid=function(){return this.features.every(e=>e.isValid())};F.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()};F.prototype.getCoordinate=function(e){return Ce(this.features,"getCoordinate",e)};F.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===g.POLYGON?e.getCoordinates():e.coordinates)))};F.prototype.updateCoordinate=function(e,t,n){Ce(this.features,"updateCoordinate",e,t,n),this.changed()};F.prototype.addCoordinate=function(e,t,n){Ce(this.features,"addCoordinate",e,t,n),this.changed()};F.prototype.removeCoordinate=function(e){Ce(this.features,"removeCoordinate",e),this.changed()};F.prototype.getFeatures=function(){return this.features};function y(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}y.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)};y.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(t[n.feature_id]===void 0&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})};y.prototype.getSelected=function(){return this._ctx.store.getSelected()};y.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()};y.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)};y.prototype.getFeature=function(e){return this._ctx.store.get(e)};y.prototype.select=function(e){return this._ctx.store.select(e)};y.prototype.deselect=function(e){return this._ctx.store.deselect(e)};y.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)};y.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)};y.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()};y.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()};y.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)};y.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)};y.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)};y.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)};y.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)};y.prototype.featuresAt=function(e,t,n="click"){if(n!=="click"&&n!=="touch")throw new Error("invalid buffer type");return j[n](e,t,this._ctx)};y.prototype.newFeature=function(e){const t=e.geometry.type;return t===g.POINT?new W(this._ctx,e):t===g.LINE_STRING?new X(this._ctx,e):t===g.POLYGON?new x(this._ctx,e):new F(this._ctx,e)};y.prototype.isInstanceOf=function(e,t){if(e===g.POINT)return t instanceof W;if(e===g.LINE_STRING)return t instanceof X;if(e===g.POLYGON)return t instanceof x;if(e==="MultiFeature")return t instanceof F;throw new Error(`Unknown feature class: ${e}`)};y.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};y.prototype.onSetup=function(){};y.prototype.onDrag=function(){};y.prototype.onClick=function(){};y.prototype.onMouseMove=function(){};y.prototype.onMouseDown=function(){};y.prototype.onMouseUp=function(){};y.prototype.onMouseOut=function(){};y.prototype.onKeyUp=function(){};y.prototype.onKeyDown=function(){};y.prototype.onTouchStart=function(){};y.prototype.onTouchMove=function(){};y.prototype.onTouchEnd=function(){};y.prototype.onTap=function(){};y.prototype.onStop=function(){};y.prototype.onTrash=function(){};y.prototype.onCombineFeature=function(){};y.prototype.onUncombineFeature=function(){};y.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const gt={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},sn=Object.keys(gt);function an(e){const t=Object.keys(e);return function(n,r={}){let o={};const i=t.reduce((l,c)=>(l[c]=e[c],l),new y(n));function s(l){return c=>i[l](o,c)}return{start(){o=i.onSetup(r),sn.forEach(l=>{const c=gt[l];let a=()=>!1;e[c]&&(a=()=>!0),this.on(l,a,s(c))})},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(l,c){i.toDisplayFeatures(o,l,c)}}}}function un(e){const t=Object.keys(e.options.modes).reduce((u,d)=>(u[d]=an(e.options.modes[d]),u),{});let n={},r={};const o={};let i=null,s=null;o.drag=function(u,d){d({point:u.point,time:new Date().getTime()})?(e.ui.queueMapClasses({mouse:I.DRAG}),s.drag(u)):u.originalEvent.stopPropagation()},o.mousedrag=function(u){o.drag(u,d=>!Pe(n,d))},o.touchdrag=function(u){o.drag(u,d=>!Ae(r,d))},o.mousemove=function(u){if((u.originalEvent.buttons!==void 0?u.originalEvent.buttons:u.originalEvent.which)===1)return o.mousedrag(u);const f=pe(u,e);u.featureTarget=f,s.mousemove(u)},o.mousedown=function(u){n={time:new Date().getTime(),point:u.point};const d=pe(u,e);u.featureTarget=d,s.mousedown(u)},o.mouseup=function(u){const d=pe(u,e);u.featureTarget=d,Pe(n,{point:u.point,time:new Date().getTime()})?s.click(u):s.mouseup(u)},o.mouseout=function(u){s.mouseout(u)},o.touchstart=function(u){if(!e.options.touchEnabled)return;r={time:new Date().getTime(),point:u.point};const d=j.touch(u,null,e)[0];u.featureTarget=d,s.touchstart(u)},o.touchmove=function(u){if(e.options.touchEnabled)return s.touchmove(u),o.touchdrag(u)},o.touchend=function(u){if(u.originalEvent.preventDefault(),!e.options.touchEnabled)return;const d=j.touch(u,null,e)[0];u.featureTarget=d,Ae(r,{time:new Date().getTime(),point:u.point})?s.tap(u):s.touchend(u)};const l=u=>{const d=Le(u),f=Ne(u),C=dt(u);return!(d||f||C)};o.keydown=function(u){(u.srcElement||u.target).classList.contains(R.CANVAS)&&((Le(u)||Ne(u))&&e.options.controls.trash?(u.preventDefault(),s.trash()):l(u)?s.keydown(u):ut(u)&&e.options.controls.point?c(v.DRAW_POINT):lt(u)&&e.options.controls.line_string?c(v.DRAW_LINE_STRING):ct(u)&&e.options.controls.polygon&&c(v.DRAW_POLYGON))},o.keyup=function(u){l(u)&&s.keyup(u)},o.zoomend=function(){e.store.changeZoom()},o.data=function(u){if(u.dataType==="style"){const{setup:d,map:f,options:C,store:L}=e;C.styles.some(B=>f.getLayer(B.id))||(d.addLayers(),L.setDirty(),L.render())}};function c(u,d,f={}){s.stop();const C=t[u];if(C===void 0)throw new Error(`${u} is not valid`);i=u;const L=C(e,d);s=Fe(L,e),f.silent||e.map.fire(D.MODE_CHANGE,{mode:u}),e.store.setDirty(),e.store.render()}const a={trash:!1,combineFeatures:!1,uncombineFeatures:!1};function h(u){let d=!1;Object.keys(u).forEach(f=>{if(a[f]===void 0)throw new Error("Invalid action type");a[f]!==u[f]&&(d=!0),a[f]=u[f]}),d&&e.map.fire(D.ACTIONABLE,{actions:a})}return{start(){i=e.options.defaultMode,s=Fe(t[i](e),e)},changeMode:c,actionable:h,currentModeName(){return i},currentModeRender(u,d){return s.render(u,d)},fire(u,d){e.map&&e.map.fire(u,d)},addEventListeners(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash(u){s.trash(u)},combineFeatures(){s.combineFeatures()},uncombineFeatures(){s.uncombineFeatures()},getMode(){return i}}}function ae(e){return[].concat(e).filter(t=>t!==void 0)}function ln(){const e=this;if(!(e.ctx.map&&e.ctx.map.getSource(G.HOT)!==void 0))return c();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let r=[],o=[];e.isDirty?o=e.getAllIds():(r=e.getChangedIds().filter(a=>e.get(a)!==void 0),o=e.sources.hot.filter(a=>a.properties.id&&r.indexOf(a.properties.id)===-1&&e.get(a.properties.id)!==void 0).map(a=>a.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(a=>{const h=a.properties.id||a.properties.parent;return r.indexOf(h)===-1});const s=i!==e.sources.cold.length||o.length>0;r.forEach(a=>l(a,"hot")),o.forEach(a=>l(a,"cold"));function l(a,h){const u=e.get(a).internal(n);e.ctx.events.currentModeRender(u,d=>{d.properties.mode=n,e.sources[h].push(d)})}s&&e.ctx.map.getSource(G.COLD).setData({type:g.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(G.HOT).setData({type:g.FEATURE_COLLECTION,features:e.sources.hot}),c();function c(){e.isDirty=!1,e.clearChangedIds()}}function _(e){this._features={},this._featureIds=new $,this._selectedFeatureIds=new $,this._selectedCoordinates=[],this._changedFeatureIds=new $,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]};let t;this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,ln.call(this),this._emitSelectionChange&&(this.ctx.events.fire(D.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(D.RENDER,{})}))},this.isDirty=!1}_.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}};_.prototype.setDirty=function(){return this.isDirty=!0,this};_.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0){const r=this.get(e);this.ctx.events.fire(D.CREATE,{features:[r.toGeoJSON()]})}return this};_.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0&&this.ctx.events.fire(D.UPDATE,{action:t.action?t.action:ie.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this};_.prototype.getChangedIds=function(){return this._changedFeatureIds.values()};_.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this};_.prototype.getAllIds=function(){return this._featureIds.values()};_.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this};_.prototype.delete=function(e,t={}){const n=[];return ae(e).forEach(r=>{this._featureIds.has(r)&&(this._featureIds.delete(r),this._selectedFeatureIds.delete(r),t.silent||n.indexOf(this._features[r])===-1&&n.push(this._features[r].toGeoJSON()),delete this._features[r],this.isDirty=!0)}),n.length&&this.ctx.events.fire(D.DELETE,{features:n}),mt(this,t),this};_.prototype.get=function(e){return this._features[e]};_.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])};_.prototype.select=function(e,t={}){return ae(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this};_.prototype.deselect=function(e,t={}){return ae(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),mt(this,t),this};_.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this};_.prototype.setSelected=function(e,t={}){return e=ae(e),this.deselect(this._selectedFeatureIds.values().filter(n=>e.indexOf(n)===-1),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this};_.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this};_.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this};_.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()};_.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))};_.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))};_.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)};_.prototype.setFeatureProperty=function(e,t,n,r={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:r.silent,action:ie.CHANGE_PROPERTIES})};function mt(e,t={}){const n=e._selectedCoordinates.filter(r=>e._selectedFeatureIds.has(r.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}_.prototype.storeMapConfig=function(){it.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})};_.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})};_.prototype.getInitialConfigValue=function(e){return this._mapInitialConfig[e]!==void 0?this._mapInitialConfig[e]:!0};const cn=["mode","feature","mouse"];function dn(e){const t={};let n=null,r={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function i(){s({mode:null,feature:null,mouse:null}),l()}function s(d){o=Object.assign(o,d)}function l(){if(!e.container)return;const d=[],f=[];cn.forEach(C=>{o[C]!==r[C]&&(d.push(`${C}-${r[C]}`),o[C]!==null&&f.push(`${C}-${o[C]}`))}),d.length>0&&e.container.classList.remove(...d),f.length>0&&e.container.classList.add(...f),r=Object.assign(r,o)}function c(d,f={}){const C=document.createElement("button");return C.className=`${R.CONTROL_BUTTON} ${f.className}`,C.setAttribute("title",f.title),f.container.appendChild(C),C.addEventListener("click",L=>{if(L.preventDefault(),L.stopPropagation(),L.target===n){a(),f.onDeactivate();return}h(d),f.onActivate()},!0),C}function a(){n&&(n.classList.remove(R.ACTIVE_BUTTON),n=null)}function h(d){a();const f=t[d];f&&f&&d!=="trash"&&(f.classList.add(R.ACTIVE_BUTTON),n=f)}function E(){const d=e.options.controls,f=document.createElement("div");return f.className=`${R.CONTROL_GROUP} ${R.CONTROL_BASE}`,d&&(d[k.POINT]&&(t[k.POINT]=c(k.POINT,{container:f,className:R.CONTROL_BUTTON_POINT,title:`Marker tool ${e.options.keybindings?"(1)":""}`,onActivate:()=>e.events.changeMode(v.DRAW_POINT),onDeactivate:()=>e.events.trash()})),d[k.LINE]&&(t[k.LINE]=c(k.LINE,{container:f,className:R.CONTROL_BUTTON_LINE,title:`LineString tool ${e.options.keybindings?"(2)":""}`,onActivate:()=>e.events.changeMode(v.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),d[k.POLYGON]&&(t[k.POLYGON]=c(k.POLYGON,{container:f,className:R.CONTROL_BUTTON_POLYGON,title:`Polygon tool ${e.options.keybindings?"(3)":""}`,onActivate:()=>e.events.changeMode(v.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),d.trash&&(t.trash=c("trash",{container:f,className:R.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),d.combine_features&&(t.combine_features=c("combineFeatures",{container:f,className:R.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),d.uncombine_features&&(t.uncombine_features=c("uncombineFeatures",{container:f,className:R.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),f}function u(){Object.keys(t).forEach(d=>{const f=t[d];f.parentNode&&f.parentNode.removeChild(f),delete t[d]})}return{setActiveButton:h,queueMapClasses:s,updateMapClasses:l,clearMapClasses:i,addButtons:E,removeButtons:u}}function fn(e){let t=null,n=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=un(e),e.ui=dn(e),e.container=o.getContainer(),e.store=new _(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable();const i=o.dragPan.isEnabled();o.dragPan.disable(),o.dragPan.enable(),i||o.dragPan.disable()}return o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(()=>{o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(G.COLD,{data:{type:g.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(G.HOT,{data:{type:g.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(o=>{e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(o=>{e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(G.COLD)&&e.map.removeSource(G.COLD),e.map.getSource(G.HOT)&&e.map.removeSource(G.HOT)}};return e.setup=r,r}const Te="#3bb2d0",ne="#fbb03b",Ke="#fff",yt=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],ne,Te],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],ne,Te],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":Ke}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],ne,Te]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":Ke}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":ne}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":ne}}];function Z(e,t){this.x=e,this.y=t}Z.prototype={clone(){return new Z(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,o=n*this.x+t*this.y;return this.x=r,this.y=o,this},_rotateAround(e,t){const n=Math.cos(e),r=Math.sin(e),o=t.x+n*(this.x-t.x)-r*(this.y-t.y),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=o,this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Z};Z.convert=function(e){if(e instanceof Z)return e;if(Array.isArray(e))return new Z(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new Z(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};function Ue(e,t){const n=t.getBoundingClientRect();return new Z(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))}function ee(e,t,n,r){return{type:g.FEATURE,properties:{meta:P.VERTEX,parent:e,coord_path:n,active:r?b.ACTIVE:b.INACTIVE},geometry:{type:g.POINT,coordinates:t}}}function pn(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Et(e,t,n){if(e!==null)for(var r,o,i,s,l,c,a,h=0,E=0,u,d=e.type,f=d==="FeatureCollection",C=d==="Feature",L=f?e.features.length:1,N=0;N<L;N++){a=f?e.features[N].geometry:C?e.geometry:e,u=a?a.type==="GeometryCollection":!1,l=u?a.geometries.length:1;for(var B=0;B<l;B++){var O=0,H=0;if(s=u?a.geometries[B]:a,s!==null){c=s.coordinates;var U=s.type;switch(h=0,U){case null:break;case"Point":if(t(c,E,N,O,H)===!1)return!1;E++,O++;break;case"LineString":case"MultiPoint":for(r=0;r<c.length;r++){if(t(c[r],E,N,O,H)===!1)return!1;E++,U==="MultiPoint"&&O++}U==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(r=0;r<c.length;r++){for(o=0;o<c[r].length-h;o++){if(t(c[r][o],E,N,O,H)===!1)return!1;E++}U==="MultiLineString"&&O++,U==="Polygon"&&H++}U==="Polygon"&&O++;break;case"MultiPolygon":for(r=0;r<c.length;r++){for(H=0,o=0;o<c[r].length;o++){for(i=0;i<c[r][o].length-h;i++){if(t(c[r][o][i],E,N,O,H)===!1)return!1;E++}H++}O++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(Et(s.geometries[r],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hn(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return vt(e);case"FeatureCollection":return gn(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ve(e);default:throw new Error("unknown GeoJSON type")}}function vt(e){const t={type:"Feature"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=Ct(e.properties),e.geometry==null?t.geometry=null:t.geometry=Ve(e.geometry),t}function Ct(e){const t={};return e&&Object.keys(e).forEach(n=>{const r=e[n];typeof r=="object"?r===null?t[n]=null:Array.isArray(r)?t[n]=r.map(o=>o):t[n]=Ct(r):t[n]=r}),t}function gn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(n=>vt(n)),t}function Ve(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),e.type==="GeometryCollection"?(t.geometries=e.geometries.map(n=>Ve(n)),t):(t.coordinates=St(e.coordinates),t)}function St(e){const t=e;return typeof t[0]!="object"?t.slice():t.map(n=>St(n))}function Ye(e,t={}){return Tt(e,"mercator",t)}function mn(e,t={}){return Tt(e,"wgs84",t)}function Tt(e,t,n={}){n=n||{};var r=n.mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&pn(e[0])?e=t==="mercator"?Xe(e):He(e):(r!==!0&&(e=hn(e)),Et(e,function(o){var i=t==="mercator"?Xe(o):He(o);o[0]=i[0],o[1]=i[1]})),e}function Xe(e){var t=Math.PI/180,n=6378137,r=20037508342789244e-9,o=Math.abs(e[0])<=180?e[0]:e[0]-yn(e[0])*360,i=[n*o*t,n*Math.log(Math.tan(Math.PI*.25+.5*e[1]*t))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function He(e){var t=180/Math.PI,n=6378137;return[e[0]*t/n,(Math.PI*.5-2*Math.atan(Math.exp(-e[1]/n)))*t]}function yn(e){return e<0?-1:e>0?1:0}function _t(e,t,n){const r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>be||r[1]<Oe||o[1]>be||o[1]<Oe)return null;const i=Ye(r),s=Ye(o),l=E=>Number(E.toFixed(8)),c=(E,u)=>(E+u)/2,a=mn([c(i[0],s[0]),c(i[1],s[1])]),h=[l(a[0]),l(a[1])];return{type:g.FEATURE,properties:{meta:P.MIDPOINT,parent:e,lng:h[0],lat:h[1],coord_path:n.properties.coord_path},geometry:{type:g.POINT,coordinates:h}}}function Se(e,t={},n=null){const{type:r,coordinates:o}=e.geometry,i=e.properties&&e.properties.id;let s=[];r===g.POINT?s.push(ee(i,o,n,c(n))):r===g.POLYGON?o.forEach((h,E)=>{l(h,n!==null?`${n}.${E}`:String(E))}):r===g.LINE_STRING?l(o,n):r.indexOf(g.MULTI_PREFIX)===0&&a();function l(h,E){let u="",d=null;h.forEach((f,C)=>{const L=E!=null?`${E}.${C}`:String(C),N=ee(i,f,L,c(L));if(t.midpoints&&d){const O=_t(i,d,N);O&&s.push(O)}d=N;const B=JSON.stringify(f);u!==B&&s.push(N),C===0&&(u=B)})}function c(h){return t.selectedPaths?t.selectedPaths.indexOf(h)!==-1:!1}function a(){const h=r.replace(g.MULTI_PREFIX,"");o.forEach((E,u)=>{const d={type:g.FEATURE,properties:e.properties,geometry:{type:h,coordinates:E}};s=s.concat(Se(d,t,u))})}return s}const q={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:ce,LAT_MAX:de,LAT_RENDERED_MIN:Ze,LAT_RENDERED_MAX:We,LNG_MIN:ze,LNG_MAX:Qe}=st;function En(e){const t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],n=[e.geometry.coordinates].flat(t),r=n.map(l=>l[0]),o=n.map(l=>l[1]),i=l=>Math.min.apply(null,l),s=l=>Math.max.apply(null,l);return[i(r),i(o),s(r),s(o)]}function xe(e,t){let n=ce,r=de,o=ce,i=de,s=Qe,l=ze;e.forEach(a=>{const h=En(a),E=h[1],u=h[3],d=h[0],f=h[2];E>n&&(n=E),u<r&&(r=u),u>o&&(o=u),E<i&&(i=E),d<s&&(s=d),f>l&&(l=f)});const c=t;return n+c.lat>We&&(c.lat=We-n),o+c.lat>de&&(c.lat=de-o),r+c.lat<Ze&&(c.lat=Ze-r),i+c.lat<ce&&(c.lat=ce-i),s+c.lng<=ze&&(c.lng+=Math.ceil(Math.abs(c.lng)/360)*360),l+c.lng>=Qe&&(c.lng-=Math.ceil(Math.abs(c.lng)/360)*360),c}function Be(e,t){const n=xe(e.map(r=>r.toGeoJSON()),t);e.forEach(r=>{const o=r.getCoordinates(),i=a=>{const h={lng:a[0]+n.lng,lat:a[1]+n.lat};return[h.lng,h.lat]},s=a=>a.map(h=>i(h)),l=a=>a.map(h=>s(h));let c;r.type===g.POINT?c=i(o):r.type===g.LINE_STRING||r.type===g.MULTI_POINT?c=o.map(i):r.type===g.POLYGON||r.type===g.MULTI_LINE_STRING?c=o.map(s):r.type===g.MULTI_POLYGON&&(c=o.map(l)),r.incomingCoords(c)})}const S={};S.onSetup=function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>this.getFeature(n)!==void 0)),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t};S.fireUpdate=function(){this.fire(D.UPDATE,{action:ie.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})};S.fireActionable=function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(s=>{s.type.replace("Multi","")!==i&&(n=!1)})}const r=t.length>0,o=e.length>0;this.setActionableState({combineFeatures:n,uncombineFeatures:r,trash:o})};S.getUniqueIds=function(e){return e.length?e.map(n=>n.properties.id).filter(n=>n!==void 0).reduce((n,r)=>(n.add(r),n),new $).values():[]};S.stopExtendedInteractions=function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1};S.onStop=function(){q.enable(this)};S.onMouseMove=function(e,t){return we(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0};S.onMouseOut=function(e){return e.dragMoving?this.fireUpdate():!0};S.onTap=S.onClick=function(e,t){if(ye(t))return this.clickAnywhere(e,t);if(me(P.VERTEX)(t))return this.clickOnVertex(e,t);if(we(t))return this.clickOnFeature(e,t)};S.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),q.enable(this),this.stopExtendedInteractions(e)};S.clickOnVertex=function(e,t){this.changeMode(v.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:I.MOVE})};S.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat};S.clickOnFeature=function(e,t){q.disable(this),this.stopExtendedInteractions(e);const n=he(t),r=this.getSelectedIds(),o=t.featureTarget.properties.id,i=this.isSelected(o);if(!n&&i&&this.getFeature(o).type!==g.POINT)return this.changeMode(v.DIRECT_SELECT,{featureId:o});i&&n?(this.deselect(o),this.updateUIClasses({mouse:I.POINTER}),r.length===1&&q.enable(this)):!i&&n?(this.select(o),this.updateUIClasses({mouse:I.MOVE})):!i&&!n&&(r.forEach(s=>this.doRender(s)),this.setSelected(o),this.updateUIClasses({mouse:I.MOVE})),this.doRender(o)};S.onMouseDown=function(e,t){if(e.initialDragPanState=this.map.dragPan.isEnabled(),z(t))return this.startOnActiveFeature(e,t);if(this.drawConfig.boxSelect&&at(t))return this.startBoxSelect(e,t)};S.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ue(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0};S.onTouchStart=function(e,t){if(z(t))return this.startOnActiveFeature(e,t)};S.onDrag=function(e,t){if(e.canDragMove)return this.dragMove(e,t);if(this.drawConfig.boxSelect&&e.canBoxSelect)return this.whileBoxSelect(e,t)};S.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:I.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(R.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=Ue(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),s=Math.max(e.boxSelectStartLocation.y,n.y),l=`translate(${r}px, ${i}px)`;e.boxSelectElement.style.transform=l,e.boxSelectElement.style.WebkitTransform=l,e.boxSelectElement.style.width=`${o-r}px`,e.boxSelectElement.style.height=`${s-i}px`};S.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};Be(this.getSelected(),n),e.dragMoveLocation=t.lngLat};S.onTouchEnd=S.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,Ue(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,n,"click"),o=this.getUniqueIds(r).filter(i=>!this.isSelected(i));o.length&&(this.select(o),o.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:I.MOVE}))}this.stopExtendedInteractions(e)};S.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?b.ACTIVE:b.INACTIVE,n(t),this.fireActionable(),!(t.properties.active!==b.ACTIVE||t.geometry.type===g.POINT)&&Se(t).forEach(n)};S.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()};S.onCombineFeatures=function(){const e=this.getSelected();if(e.length===0||e.length<2)return;const t=[],n=[],r=e[0].type.replace("Multi","");for(let o=0;o<e.length;o++){const i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(s=>{t.push(s)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const o=this.newFeature({type:g.FEATURE,properties:n[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(o),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([o.id]),this.fire(D.COMBINE_FEATURES,{createdFeatures:[o.toGeoJSON()],deletedFeatures:n})}this.fireActionable()};S.onUncombineFeatures=function(){const e=this.getSelected();if(e.length===0)return;const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];this.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach(i=>{this.addFeature(i),i.properties=o.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))}t.length>1&&this.fire(D.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const It=me(P.VERTEX),Mt=me(P.MIDPOINT),T={};T.fireUpdate=function(){this.fire(D.UPDATE,{action:ie.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})};T.fireActionable=function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})};T.startDragging=function(e,t){e.initialDragPanState==null&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat};T.stopDragging=function(e){e.canDragMove&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null};T.onVertex=function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);!he(t)&&r===-1?e.selectedCoordPaths=[n.coord_path]:he(t)&&r===-1&&e.selectedCoordPaths.push(n.coord_path);const o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)};T.onMidpoint=function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]};T.pathsToCoordinates=function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))};T.onFeature=function(e,t){e.selectedCoordPaths.length===0?this.startDragging(e,t):this.stopDragging(e)};T.dragFeature=function(e,t,n){Be(this.getSelected(),n),e.dragMoveLocation=t.lngLat};T.dragVertex=function(e,t,n){const r=e.selectedCoordPaths.map(s=>e.feature.getCoordinate(s)),o=r.map(s=>({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:s}})),i=xe(o,n);for(let s=0;s<r.length;s++){const l=r[s];e.feature.updateCoordinate(e.selectedCoordPaths[s],l[0]+i.lng,l[1]+i.lat)}};T.clickNoTarget=function(){this.changeMode(v.SIMPLE_SELECT)};T.clickInactive=function(){this.changeMode(v.SIMPLE_SELECT)};T.clickActiveFeature=function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()};T.onSetup=function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===g.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),q.disable(this),this.setActionableState({trash:!0}),r};T.onStop=function(){q.enable(this),this.clearSelectedCoordinates()};T.toDisplayFeatures=function(e,t,n){e.featureId===t.properties.id?(t.properties.active=b.ACTIVE,n(t),Se(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=b.INACTIVE,n(t)),this.fireActionable(e)};T.onTrash=function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),e.feature.isValid()===!1&&(this.deleteFeature([e.featureId]),this.changeMode(v.SIMPLE_SELECT,{}))};T.onMouseMove=function(e,t){const n=z(t),r=It(t),o=Mt(t),i=e.selectedCoordPaths.length===0;return n&&i?this.updateUIClasses({mouse:I.MOVE}):r&&!i?this.updateUIClasses({mouse:I.MOVE}):this.updateUIClasses({mouse:I.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0};T.onMouseOut=function(e){return e.dragMoving&&this.fireUpdate(),!0};T.onTouchStart=T.onMouseDown=function(e,t){if(It(t))return this.onVertex(e,t);if(z(t))return this.onFeature(e,t);if(Mt(t))return this.onMidpoint(e,t)};T.onDrag=function(e,t){if(e.canDragMove!==!0)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat};T.onClick=function(e,t){if(ye(t))return this.clickNoTarget(e,t);if(z(t))return this.clickActiveFeature(e,t);if(De(t))return this.clickInactive(e,t);this.stopDragging(e)};T.onTap=function(e,t){if(ye(t))return this.clickNoTarget(e,t);if(z(t))return this.clickActiveFeature(e,t);if(De(t))return this.clickInactive(e,t)};T.onTouchEnd=T.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const Y={};Y.onSetup=function(){const e=this.newFeature({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(k.POINT),this.setActionableState({trash:!0}),{point:e}};Y.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)};Y.onTap=Y.onClick=function(e,t){this.updateUIClasses({mouse:I.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(D.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.point.id]})};Y.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})};Y.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.point.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t)};Y.onTrash=Y.stopDrawingAndRemove;Y.onKeyUp=function(e,t){if(Ee(t)||ve(t))return this.stopDrawingAndRemove(e,t)};function ge(e,t){return e.lngLat?e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]:!1}const J={};J.onSetup=function(){const e=this.newFeature({type:g.FEATURE,properties:{},geometry:{type:g.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),q.disable(this),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(k.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}};J.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&ge(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:I.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)};J.clickOnVertex=function(e){return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.polygon.id]})};J.onMouseMove=function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),se(t)&&this.updateUIClasses({mouse:I.POINTER})};J.onTap=J.onClick=function(e,t){return se(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)};J.onKeyUp=function(e,t){Ee(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)):ve(t)&&this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.polygon.id]})};J.onStop=function(e){this.updateUIClasses({mouse:I.NONE}),q.enable(this),this.activateUIButton(),this.getFeature(e.polygon.id)!==void 0&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(D.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT,{},{silent:!0})))};J.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t);if(t.geometry.coordinates.length===0)return;const o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=P.FEATURE,n(ee(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){const i=t.geometry.coordinates[0].length-3;n(ee(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(o<=4){const i=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(n({type:g.FEATURE,properties:t.properties,geometry:{coordinates:i,type:g.LINE_STRING}}),o===3)return}return n(t)}};J.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)};const K={};K.onSetup=function(e){e=e||{};const t=e.featureId;let n,r,o="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&i.type==="Feature"&&i.geometry&&i.geometry.type==="Point"&&(i=i.geometry),i&&i.type==="Point"&&i.coordinates&&i.coordinates.length===2&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const s=n.coordinates.length-1;if(n.coordinates[s][0]===i[0]&&n.coordinates[s][1]===i[1])r=s+1,n.addCoordinate(r,...n.coordinates[s]);else if(n.coordinates[0][0]===i[0]&&n.coordinates[0][1]===i[1])o="backwards",r=0,n.addCoordinate(r,...n.coordinates[0]);else throw new Error("`from` should match the point at either the start or the end of the provided LineString")}else n=this.newFeature({type:g.FEATURE,properties:{},geometry:{type:g.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(n);return this.clearSelectedFeatures(),q.disable(this),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(k.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:r,direction:o}};K.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&ge(t,e.line.coordinates[e.currentVertexPosition-1])||e.direction==="backwards"&&ge(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:I.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.direction==="forward"?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)};K.clickOnVertex=function(e){return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.line.id]})};K.onMouseMove=function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),se(t)&&this.updateUIClasses({mouse:I.POINTER})};K.onTap=K.onClick=function(e,t){if(se(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)};K.onKeyUp=function(e,t){ve(t)?this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.line.id]}):Ee(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT))};K.onStop=function(e){q.enable(this),this.activateUIButton(),this.getFeature(e.line.id)!==void 0&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(D.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT,{},{silent:!0})))};K.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)};K.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.line.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=P.FEATURE,n(ee(e.line.id,t.geometry.coordinates[e.direction==="forward"?t.geometry.coordinates.length-2:1],`${e.direction==="forward"?t.geometry.coordinates.length-2:1}`,!1)),n(t))};const Ot={simple_select:S,direct_select:T,draw_point:Y,draw_polygon:J,draw_line_string:K},vn={defaultMode:v.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:yt,modes:Ot,controls:{},userProperties:!1,suppressAPIEvents:!0},Cn={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Sn={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function je(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:t==="hot"?G.HOT:G.COLD}))}function Tn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),e.displayControlsDefault===!1?t.controls=Object.assign({},Sn,e.controls):t.controls=Object.assign({},Cn,e.controls),t=Object.assign({},vn,t),t.styles=je(t.styles,"cold").concat(je(t.styles,"hot")),t}var _e,et;function _n(){return et||(et=1,_e=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)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(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),_e}var In=_n();const tt=oe.getDefaultExportFromCjs(In);var Ie,nt;function Mn(){if(nt)return Ie;nt=1,Ie=t;var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function t(n){if(!n||!n.type)return null;var r=e[n.type];if(!r)return null;if(r==="geometry")return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:n}]};if(r==="feature")return{type:"FeatureCollection",features:[n]};if(r==="featurecollection")return n}return Ie}var On=Mn();const bn=oe.getDefaultExportFromCjs(On);function bt(e,t){return e.length!==t.length?!1:JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const Ln={Polygon:x,LineString:X,Point:W,MultiPolygon:F,MultiLineString:F,MultiPoint:F};function Nn(e,t){t.modes=v;const n=e.options.suppressAPIEvents!==void 0?!!e.options.suppressAPIEvents:!0;return t.getFeatureIdsAt=function(r){return j.click({point:r},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:g.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(r=>e.store.get(r)).map(r=>r.toGeoJSON())}},t.getSelectedPoints=function(){return{type:g.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(r=>({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:r.coordinates}}))}},t.set=function(r){if(r.type===void 0||r.type!==g.FEATURE_COLLECTION||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");const o=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const s=t.add(r),l=new $(s);return i=i.filter(c=>!l.has(c)),i.length&&t.delete(i),o(),s},t.add=function(r){const i=JSON.parse(JSON.stringify(bn(r))).features.map(s=>{if(s.id=s.id||ke(),s.geometry===null)throw new Error("Invalid geometry: null");if(e.store.get(s.id)===void 0||e.store.get(s.id).type!==s.geometry.type){const l=Ln[s.geometry.type];if(l===void 0)throw new Error(`Invalid geometry type: ${s.geometry.type}.`);const c=new l(e,s);e.store.add(c,{silent:n})}else{const l=e.store.get(s.id),c=l.properties;l.properties=s.properties,tt(c,s.properties)||e.store.featureChanged(l.id,{silent:n}),tt(l.getCoordinates(),s.geometry.coordinates)||l.incomingCoords(s.geometry.coordinates)}return s.id});return e.store.render(),i},t.get=function(r){const o=e.store.get(r);if(o)return o.toGeoJSON()},t.getAll=function(){return{type:g.FEATURE_COLLECTION,features:e.store.getAll().map(r=>r.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:n}),t.getMode()===v.DIRECT_SELECT&&!e.store.getSelectedIds().length?e.events.changeMode(v.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===v.DIRECT_SELECT?e.events.changeMode(v.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(r,o={}){return r===v.SIMPLE_SELECT&&t.getMode()===v.SIMPLE_SELECT?(bt(o.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(o.featureIds,{silent:n}),e.store.render()),t):(r===v.DIRECT_SELECT&&t.getMode()===v.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,o,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(r,o,i){return e.store.setFeatureProperty(r,o,i,{silent:n}),t},t}const Pn=Object.freeze(Object.defineProperty({__proto__:null,CommonSelectors:$t,ModeHandler:Fe,StringSet:$,constrainFeatureMovement:xe,createMidPoint:_t,createSupplementaryPoints:Se,createVertex:ee,doubleClickZoom:q,euclideanDistance:Re,featuresAt:j,getFeatureAtAndSetCursors:pe,isClick:Pe,isEventAtCoordinates:ge,isTap:Ae,mapEventToBoundingBox:pt,moveFeatures:Be,sortFeatures:ft,stringSetsAreEqual:bt,theme:yt,toDenseArray:ae},Symbol.toStringTag,{value:"Module"})),An=function(e,t){e=Tn(e);const n={options:e};t=Nn(n,t),n.api=t;const r=fn(n);return t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=k,t.options=e,t};function re(e){An(e,this)}re.modes=Ot;re.constants=st;re.lib=Pn;var Me={exports:{}},rt;function Fn(){if(rt)return Me.exports;rt=1;var e=Me.exports={};return e.onSetup=function(){return this.setActionableState(),{}},e.toDisplayFeatures=function(t,n,r){r(n)},Me.exports}var Dn=Fn();const wn=oe.getDefaultExportFromCjs(Dn);var fe={},ot;function Rn(){if(ot)return fe;ot=1,Object.defineProperty(fe,"__esModule",{value:!0});var e={enable:function(r){setTimeout(function(){!r.map||!r.map.doubleClickZoom||!r._ctx||!r._ctx.store||!r._ctx.store.getInitialConfigValue||r._ctx.store.getInitialConfigValue("doubleClickZoom")&&r.map.doubleClickZoom.enable()},0)},disable:function(r){setTimeout(function(){!r.map||!r.map.doubleClickZoom||r.map.doubleClickZoom.disable()},0)}},t={onSetup:function(r){var o=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[]]}});return this.addFeature(o),this.clearSelectedFeatures(),e.disable(this),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:o}},onTap:function(r,o){r.startPoint&&this.onMouseMove(r,o),this.onClick(r,o)},onClick:function(r,o){r.startPoint&&r.startPoint[0]!==o.lngLat.lng&&r.startPoint[1]!==o.lngLat.lat&&(this.updateUIClasses({mouse:"pointer"}),r.endPoint=[o.lngLat.lng,o.lngLat.lat],this.changeMode("simple_select",{featuresId:r.rectangle.id}));var i=[o.lngLat.lng,o.lngLat.lat];r.startPoint=i},onMouseMove:function(r,o){r.startPoint&&(r.rectangle.updateCoordinate("0.0",r.startPoint[0],r.startPoint[1]),r.rectangle.updateCoordinate("0.1",o.lngLat.lng,r.startPoint[1]),r.rectangle.updateCoordinate("0.2",o.lngLat.lng,o.lngLat.lat),r.rectangle.updateCoordinate("0.3",r.startPoint[0],o.lngLat.lat),r.rectangle.updateCoordinate("0.4",r.startPoint[0],r.startPoint[1]))},onKeyUp:function(r,o){if(o.keyCode===27)return this.changeMode("simple_select")},onStop:function(r){e.enable(this),this.updateUIClasses({mouse:"none"}),this.activateUIButton(),this.getFeature(r.rectangle.id)!==void 0&&(r.rectangle.removeCoordinate("0.4"),r.rectangle.isValid()?this.map.fire("draw.create",{features:[r.rectangle.toGeoJSON()]}):(this.deleteFeature([r.rectangle.id],{silent:!0}),this.changeMode("simple_select",{},{silent:!0})))},toDisplayFeatures:function(r,o,i){var s=o.properties.id===r.rectangle.id;if(o.properties.active=s?"true":"false",!s)return i(o);if(r.startPoint)return i(o)},onTrash:function(r){this.deleteFeature([r.rectangle.id],{silent:!0}),this.changeMode("simple_select")}};return fe.default=t,fe}var kn=Rn();const Un=oe.getDefaultExportFromCjs(kn),Vn={key:0,class:"measure-info-panel"},xn={class:"measure-info-content"},Bn={class:"measure-label"},Gn={class:"measure-value"},$n={class:"qy-flex-row hiper-map-tools-bar"},qn=p.defineComponent({__name:"MapTools",props:{tools:{default:()=>["point","line","polygon","measure_distance","measure_area","clear_all"]}},setup(e){const t=p.inject("mapRootId"),n=p.ref(),r=p.ref([]),o=p.ref(null),i=p.ref(null),s=p.ref(!1),l=p.ref("distance"),c=M=>{switch(s.value&&M!=="measure_distance"&&M!=="clear_all"&&B(),n.value=M,M){case"point":h.changeMode("draw_point");break;case"line":h.changeMode("draw_line_string");break;case"polygon":h.changeMode("draw_polygon");break;case"measure_distance":h.changeMode("simple_select"),l.value="distance",d();break;case"measure_area":h.changeMode("simple_select"),l.value="area",d();break;case"clear_all":h.deleteAll(),B();break}},a=p.inject(At.mapInstanceKey),h=new re({userProperties:!0,displayControlsDefault:!1,modes:{...re.modes,draw_rectangle:Un,static:wn}});let E=null;E=Ge.mapLoadedBus.on(({mapRootId:M})=>{t!==M||!a?.value||(console.log("hiper-map-tools-bar mounted",a),a.value.addControl(h,"top-left"),a.value.on("draw.create",u))});function u(M){const m=h.getAll();if(!m.features.length)return;m.features=[m.features[0]];const A={point:{layerType:"symbol",config:{textColor:"rgba(0,0,0,1)",iconName:Ft.DefaultIcon}},line:{layerType:"line",config:{lineWidth:1,lineColor:"rgba(255, 0, 0, 1)",lineStyle:"solid"}},polygon:{layerType:"shape",config:{fillColor:"rgba(241, 131, 127, 1)",lineWidth:1}}}[n.value];A&&Ge.showLayerEditKeyBus.emit({mapRootId:t,e:new MouseEvent("click"),layer:{layerType:A.layerType,customLayerConfig:JSON.stringify(A.config),geoJSON:JSON.stringify(m),...n.value==="polygon"?{pid:""}:{}}}),h.deleteAll()}function d(){a?.value&&(s.value=!0,r.value=[],a.value.getCanvas().style.cursor="crosshair",a.value.on("click",C),a.value.on("dblclick",f))}function f(M){if(s.value){if(M.preventDefault(),l.value==="distance")r.value.length>=2&&L();else if(r.value.length>=3){const m=r.value[0],V=r.value[r.value.length-1];(m[0]!==V[0]||m[1]!==V[1])&&r.value.push(m),L()}a?.value?.off("click",C),a?.value?.off("dblclick",f),a?.value&&(a.value.getCanvas().style.cursor=""),s.value=!1}}function C(M){if(!s.value||!a?.value)return;M.originalEvent.stopPropagation();const m=[M.lngLat.lng,M.lngLat.lat];r.value.push(m),r.value.length===1?(l.value==="distance"?O.value=0:U.value=0,a.value.getSource("measure-point-source")?a.value.getSource("measure-point-source").setData({type:"Feature",properties:{},geometry:{type:"Point",coordinates:m}}):(a.value.addSource("measure-point-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"Point",coordinates:m}}}),a.value.addLayer({id:"measure-point-layer",type:"circle",source:"measure-point-source",paint:{"circle-radius":5,"circle-color":"#16aaff"}}))):(a.value.getSource("measure-point-source")&&a.value.getSource("measure-point-source").setData({type:"FeatureCollection",features:r.value.map(V=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:V}}))}),L(),l.value==="area"&&r.value.length>=3&&(a.value.getCanvas().style.cursor="pointer"))}function L(){if(!a?.value||r.value.length<2)return;const M=Q.lineString(r.value);if(l.value==="distance"){const m=Q.length(M,{units:"kilometers"});O.value=m,m<1?`${(m*1e3).toFixed(2)}`:`${m.toFixed(3)}`;const V=Math.floor(r.value.length/2)-1;V<0?r.value[0]:r.value[V],N(M)}else if(r.value.length>=3){const m=[...r.value];m[0]!==m[m.length-1]&&m.push(m[0]);const V=Q.polygon([m]),A=Q.area(V)/1e6;U.value=A,A<1?`${(A*1e6).toFixed(2)}`:`${A.toFixed(3)}`;const ue=Q.centroid(V);N(M,ue.geometry.coordinates)}else N(M,M.geometry.coordinates[0])}function N(M,m,V){if(a?.value){if(a.value.getSource("measure-line-source")?a.value.getSource("measure-line-source").setData(M):(a.value.addSource("measure-line-source",{type:"geojson",data:M}),a.value.addLayer({id:"measure-line-layer",type:"line",source:"measure-line-source",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#16aaff","line-width":2,"line-dasharray":[2,1]}}),o.value="measure-line-layer"),l.value==="area"&&r.value.length>=3){const A=[...r.value];A[0]!==A[A.length-1]&&A.push(A[0]);const ue=Q.polygon([A]);a.value.getSource("measure-fill-source")?a.value.getSource("measure-fill-source").setData(ue):(a.value.addSource("measure-fill-source",{type:"geojson",data:ue}),a.value.addLayer({id:"measure-fill-layer",type:"fill",source:"measure-fill-source",paint:{"fill-color":"#16aaff","fill-opacity":.2,"fill-outline-color":"#16aaff"}},"measure-line-layer"))}a.value.getSource("measure-label-source")&&a.value.getLayer("measure-label-layer")&&(a.value.removeLayer("measure-label-layer"),a.value.removeSource("measure-label-source"),i.value=null)}}function B(){a?.value&&(a.value.off("click",C),a.value.off("dblclick",f),a.value.getCanvas().style.cursor="",a.value.getLayer("measure-point-layer")&&(a.value.removeLayer("measure-point-layer"),a.value.removeSource("measure-point-source")),a.value.getLayer("measure-line-layer")&&(a.value.removeLayer("measure-line-layer"),a.value.removeSource("measure-line-source")),a.value.getLayer("measure-fill-layer")&&(a.value.removeLayer("measure-fill-layer"),a.value.removeSource("measure-fill-source")),a.value.getLayer("measure-label-layer")&&(a.value.removeLayer("measure-label-layer"),a.value.removeSource("measure-label-source")),r.value=[],o.value=null,i.value=null,s.value=!1,O.value=0,U.value=0,a.value.getLayer("measure-label-layer")&&a.value.removeLayer("measure-label-layer"),a.value.getSource("measure-label-source")&&a.value.removeSource("measure-label-source"))}p.onUnmounted(()=>{B(),E&&E(),a?.value&&(a.value.removeControl(h),a.value.off("draw.create",u),a.value.off("click",C),a.value.off("dblclick",f))});const O=p.ref(0),H=p.computed(()=>O.value<1?`${(O.value*1e3).toFixed(2)} 米`:`${O.value.toFixed(3)} 公里`),U=p.ref(0),Lt=p.computed(()=>U.value<1?`${(U.value*1e6).toFixed(2)} 平方米`:`${U.value.toFixed(3)} 平方公里`),Nt=p.computed(()=>l.value==="distance"?H.value:Lt.value),Pt=p.computed(()=>l.value==="distance"?"总长度: ":"总面积: ");return(M,m)=>(p.openBlock(),p.createElementBlock(p.Fragment,null,[s.value||r.value.length>0&&(n.value=="measure_distance"||n.value=="measure_area")?(p.openBlock(),p.createElementBlock("div",Vn,[p.createElementVNode("div",xn,[p.createElementVNode("span",Bn,p.toDisplayString(Pt.value),1),p.createElementVNode("span",Gn,p.toDisplayString(Nt.value),1),p.createVNode(p.unref(Rt.ElIcon),{style:{display:"block","margin-left":"10px",cursor:"pointer"},onClick:m[0]||(m[0]=V=>c("clear_all")),size:"20px"},{default:p.withCtx(()=>[p.createVNode(p.unref(wt.Close))]),_:1})])])):p.createCommentVNode("",!0),p.createElementVNode("div",$n,[e.tools.includes("point")?(p.openBlock(),p.createElementBlock("div",{key:0,title:"兴趣点",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="point"?"active":null]),onClick:m[1]||(m[1]=()=>c("point"))},[...m[7]||(m[7]=[p.createElementVNode("span",{class:"qyuan icon-local-two"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("line")?(p.openBlock(),p.createElementBlock("div",{key:1,title:"折线",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="line"?"active":null]),onClick:m[2]||(m[2]=()=>c("line"))},[...m[8]||(m[8]=[p.createElementVNode("span",{class:"qyuan icon-whole-site-accelerator"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("polygon")?(p.openBlock(),p.createElementBlock("div",{key:2,title:"多边形",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="polygon"?"active":null]),onClick:m[3]||(m[3]=()=>c("polygon"))},[...m[9]||(m[9]=[p.createElementVNode("span",{class:"qyuan icon-anchor"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("measure_distance")?(p.openBlock(),p.createElementBlock("div",{key:3,title:"测距",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="measure_distance"?"active":null]),onClick:m[4]||(m[4]=()=>c("measure_distance"))},[...m[10]||(m[10]=[p.createElementVNode("span",{class:"qyuan icon-ruler"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("measure_area")?(p.openBlock(),p.createElementBlock("div",{key:4,title:"测面",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="measure_area"?"active":null]),onClick:m[5]||(m[5]=()=>c("measure_area"))},[...m[11]||(m[11]=[p.createElementVNode("span",{class:"qyuan icon-multi-triangular"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("clear_all")?(p.openBlock(),p.createElementBlock("div",{key:5,title:"清除所有临时绘制图形",class:"hiper-map-tools-btn",style:{border:"none"},onClick:m[6]||(m[6]=()=>c("clear_all"))},[...m[12]||(m[12]=[p.createElementVNode("span",{class:"qyuan icon-clear"},null,-1)])])):p.createCommentVNode("",!0)])],64))}});exports._sfc_main=qn;
1
+ "use strict";const p=require("vue"),oe=require("./_commonjsHelpers-DwGv2jUC.js"),At=require("./ProvideKeys-jy8dfV9u.js"),Ge=require("./EventKeys-BLmCVdTJ.js"),Ft=require("./constant-Bc8XErtI.js"),Dt=require("@turf/turf"),wt=require("@element-plus/icons-vue"),Rt=require("element-plus");function kt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Q=kt(Dt),R={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},G={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},I={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},k={POLYGON:"polygon",LINE:"line_string",POINT:"point"},g={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},v={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},D={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},ie={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},P={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},b={ACTIVE:"true",INACTIVE:"false"},it=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],Ut=-90,Oe=-85,Vt=90,be=85,xt=-270,Bt=270,st=Object.freeze(Object.defineProperty({__proto__:null,LAT_MAX:Vt,LAT_MIN:Ut,LAT_RENDERED_MAX:be,LAT_RENDERED_MIN:Oe,LNG_MAX:Bt,LNG_MIN:xt,activeStates:b,classes:R,cursors:I,events:D,geojsonTypes:g,interactions:it,meta:P,modes:v,sources:G,types:k,updateActions:ie},Symbol.toStringTag,{value:"Module"}));function me(e){return function(t){const n=t.featureTarget;return!n||!n.properties?!1:n.properties.meta===e}}function at(e){return!e.originalEvent||!e.originalEvent.shiftKey?!1:e.originalEvent.button===0}function z(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===b.ACTIVE&&e.featureTarget.properties.meta===P.FEATURE}function De(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===b.INACTIVE&&e.featureTarget.properties.meta===P.FEATURE}function ye(e){return e.featureTarget===void 0}function we(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.meta===P.FEATURE}function se(e){const t=e.featureTarget;return!t||!t.properties?!1:t.properties.meta===P.VERTEX}function he(e){return e.originalEvent?e.originalEvent.shiftKey===!0:!1}function Ee(e){return e.key==="Escape"||e.keyCode===27}function ve(e){return e.key==="Enter"||e.keyCode===13}function Le(e){return e.key==="Backspace"||e.keyCode===8}function Ne(e){return e.key==="Delete"||e.keyCode===46}function ut(e){return e.key==="1"||e.keyCode===49}function lt(e){return e.key==="2"||e.keyCode===50}function ct(e){return e.key==="3"||e.keyCode===51}function dt(e){const t=e.key||String.fromCharCode(e.keyCode);return t>="0"&&t<="9"}function Gt(){return!0}const $t=Object.freeze(Object.defineProperty({__proto__:null,isActiveFeature:z,isBackspaceKey:Le,isDeleteKey:Ne,isDigit1Key:ut,isDigit2Key:lt,isDigit3Key:ct,isDigitKey:dt,isEnterKey:ve,isEscapeKey:Ee,isFeature:we,isInactiveFeature:De,isOfMetaType:me,isShiftDown:he,isShiftMousedown:at,isTrue:Gt,isVertex:se,noTarget:ye},Symbol.toStringTag,{value:"Module"}));var le={},te={},$e;function qt(){return $e||($e=1,te.RADIUS=6378137,te.FLATTENING=1/298.257223563,te.POLAR_RADIUS=63567523142e-4),te}var qe;function Jt(){if(qe)return le;qe=1;var e=qt();le.geometry=t,le.ring=r;function t(i){var s=0,l;switch(i.type){case"Polygon":return n(i.coordinates);case"MultiPolygon":for(l=0;l<i.coordinates.length;l++)s+=n(i.coordinates[l]);return s;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(l=0;l<i.geometries.length;l++)s+=t(i.geometries[l]);return s}}function n(i){var s=0;if(i&&i.length>0){s+=Math.abs(r(i[0]));for(var l=1;l<i.length;l++)s-=Math.abs(r(i[l]))}return s}function r(i){var s,l,c,a,h,E,u,d=0,f=i.length;if(f>2){for(u=0;u<f;u++)u===f-2?(a=f-2,h=f-1,E=0):u===f-1?(a=f-1,h=0,E=1):(a=u,h=u+1,E=u+2),s=i[a],l=i[h],c=i[E],d+=(o(c[0])-o(s[0]))*Math.sin(o(l[1]));d=d*e.RADIUS*e.RADIUS/2}return d}function o(i){return i*Math.PI/180}return le}var Kt=Jt();const Yt=oe.getDefaultExportFromCjs(Kt),Je={Point:0,LineString:1,MultiLineString:1,Polygon:2};function Xt(e,t){const n=Je[e.geometry.type]-Je[t.geometry.type];return n===0&&e.geometry.type===g.POLYGON?e.area-t.area:n}function ft(e){return e.map(t=>(t.geometry.type===g.POLYGON&&(t.area=Yt.geometry({type:g.FEATURE,property:{},geometry:t.geometry})),t)).sort(Xt).map(t=>(delete t.area,t))}function pt(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function $(e){if(this._items={},this._nums={},this._length=e?e.length:0,!!e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),e[t]!==void 0&&(typeof e[t]=="string"?this._items[e[t]]=t:this._nums[e[t]]=t)}$.prototype.add=function(e){return this.has(e)?this:(this._length++,typeof e=="string"?this._items[e]=this._length:this._nums[e]=this._length,this)};$.prototype.delete=function(e){return this.has(e)===!1?this:(this._length--,delete this._items[e],delete this._nums[e],this)};$.prototype.has=function(e){return typeof e!="string"&&typeof e!="number"?!1:this._items[e]!==void 0||this._nums[e]!==void 0};$.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)};$.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const Ht=[P.FEATURE,P.MIDPOINT,P.VERTEX],j={click:Zt,touch:Wt};function Zt(e,t,n){return ht(e,t,n,n.options.clickBuffer)}function Wt(e,t,n){return ht(e,t,n,n.options.touchBuffer)}function ht(e,t,n,r){if(n.map===null)return[];const o=e?pt(e,r):t,i={};n.options.styles&&(i.layers=n.options.styles.map(a=>a.id).filter(a=>n.map.getLayer(a)!=null));const s=n.map.queryRenderedFeatures(o,i).filter(a=>Ht.indexOf(a.properties.meta)!==-1),l=new $,c=[];return s.forEach(a=>{const h=a.properties.id;l.has(h)||(l.add(h),c.push(a))}),ft(c)}function pe(e,t){const n=j.click(e,null,t),r={mouse:I.NONE};return n[0]&&(r.mouse=n[0].properties.active===b.ACTIVE?I.MOVE:I.POINTER,r.feature=n[0].properties.meta),t.events.currentModeName().indexOf("draw")!==-1&&(r.mouse=I.ADD),t.ui.queueMapClasses(r),t.ui.updateMapClasses(),n[0]}function Re(e,t){const n=e.x-t.x,r=e.y-t.y;return Math.sqrt(n*n+r*r)}const zt=4,Qt=12,jt=500;function Pe(e,t,n={}){const r=n.fineTolerance!=null?n.fineTolerance:zt,o=n.grossTolerance!=null?n.grossTolerance:Qt,i=n.interval!=null?n.interval:jt;e.point=e.point||t.point,e.time=e.time||t.time;const s=Re(e.point,t.point);return s<r||s<o&&t.time-e.time<i}const en=25,tn=250;function Ae(e,t,n={}){const r=n.tolerance!=null?n.tolerance:en,o=n.interval!=null?n.interval:tn;return e.point=e.point||t.point,e.time=e.time||t.time,Re(e.point,t.point)<r&&t.time-e.time<o}const Fe=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},r={on(i,s,l){if(n[i]===void 0)throw new Error(`Invalid event type: ${i}`);n[i].push({selector:s,fn:l})},render(i){t.store.featureChanged(i)}},o=function(i,s){const l=n[i];let c=l.length;for(;c--;){const a=l[c];if(a.selector(s)){a.fn.call(r,s)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(r),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){o("drag",i)},click(i){o("click",i)},mousemove(i){o("mousemove",i)},mousedown(i){o("mousedown",i)},mouseup(i){o("mouseup",i)},mouseout(i){o("mouseout",i)},keydown(i){o("keydown",i)},keyup(i){o("keyup",i)},touchstart(i){o("touchstart",i)},touchmove(i){o("touchmove",i)},touchend(i){o("touchend",i)},tap(i){o("tap",i)}}};let nn=(e,t=21)=>(n=t)=>{let r="",o=n|0;for(;o--;)r+=e[Math.random()*e.length|0];return r};const rn=nn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function ke(){return rn()}const w=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||ke(),this.type=t.geometry.type};w.prototype.changed=function(){this.ctx.store.featureChanged(this.id)};w.prototype.incomingCoords=function(e){this.setCoordinates(e)};w.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()};w.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))};w.prototype.setProperty=function(e,t){this.properties[e]=t};w.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:g.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))};w.prototype.internal=function(e){const t={id:this.id,meta:P.FEATURE,"meta:type":this.type,active:b.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:g.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const W=function(e,t){w.call(this,e,t)};W.prototype=Object.create(w.prototype);W.prototype.isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"};W.prototype.updateCoordinate=function(e,t,n){arguments.length===3?this.coordinates=[t,n]:this.coordinates=[e,t],this.changed()};W.prototype.getCoordinate=function(){return this.getCoordinates()};const X=function(e,t){w.call(this,e,t)};X.prototype=Object.create(w.prototype);X.prototype.isValid=function(){return this.coordinates.length>1};X.prototype.addCoordinate=function(e,t,n){this.changed();const r=parseInt(e,10);this.coordinates.splice(r,0,[t,n])};X.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))};X.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)};X.prototype.updateCoordinate=function(e,t,n){const r=parseInt(e,10);this.coordinates[r]=[t,n],this.changed()};const x=function(e,t){w.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};x.prototype=Object.create(w.prototype);x.prototype.isValid=function(){return this.coordinates.length===0?!1:this.coordinates.every(e=>e.length>2)};x.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()};x.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()};x.prototype.addCoordinate=function(e,t,n){this.changed();const r=e.split(".").map(i=>parseInt(i,10));this.coordinates[r[0]].splice(r[1],0,[t,n])};x.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))};x.prototype.getCoordinate=function(e){const t=e.split(".").map(r=>parseInt(r,10)),n=this.coordinates[t[0]];return JSON.parse(JSON.stringify(n[t[1]]))};x.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))};x.prototype.updateCoordinate=function(e,t,n){this.changed();const r=e.split("."),o=parseInt(r[0],10),i=parseInt(r[1],10);this.coordinates[o]===void 0&&(this.coordinates[o]=[]),this.coordinates[o][i]=[t,n]};const on={MultiPoint:W,MultiLineString:X,MultiPolygon:x},Ce=(e,t,n,r,o)=>{const i=n.split("."),s=parseInt(i[0],10),l=i[1]?i.slice(1).join("."):null;return e[s][t](l,r,o)},F=function(e,t){if(w.call(this,e,t),delete this.coordinates,this.model=on[t.geometry.type],this.model===void 0)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};F.prototype=Object.create(w.prototype);F.prototype._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:ke(),type:g.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))};F.prototype.isValid=function(){return this.features.every(e=>e.isValid())};F.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()};F.prototype.getCoordinate=function(e){return Ce(this.features,"getCoordinate",e)};F.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===g.POLYGON?e.getCoordinates():e.coordinates)))};F.prototype.updateCoordinate=function(e,t,n){Ce(this.features,"updateCoordinate",e,t,n),this.changed()};F.prototype.addCoordinate=function(e,t,n){Ce(this.features,"addCoordinate",e,t,n),this.changed()};F.prototype.removeCoordinate=function(e){Ce(this.features,"removeCoordinate",e),this.changed()};F.prototype.getFeatures=function(){return this.features};function y(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}y.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)};y.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(t[n.feature_id]===void 0&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})};y.prototype.getSelected=function(){return this._ctx.store.getSelected()};y.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()};y.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)};y.prototype.getFeature=function(e){return this._ctx.store.get(e)};y.prototype.select=function(e){return this._ctx.store.select(e)};y.prototype.deselect=function(e){return this._ctx.store.deselect(e)};y.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)};y.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)};y.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()};y.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()};y.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)};y.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)};y.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)};y.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)};y.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)};y.prototype.featuresAt=function(e,t,n="click"){if(n!=="click"&&n!=="touch")throw new Error("invalid buffer type");return j[n](e,t,this._ctx)};y.prototype.newFeature=function(e){const t=e.geometry.type;return t===g.POINT?new W(this._ctx,e):t===g.LINE_STRING?new X(this._ctx,e):t===g.POLYGON?new x(this._ctx,e):new F(this._ctx,e)};y.prototype.isInstanceOf=function(e,t){if(e===g.POINT)return t instanceof W;if(e===g.LINE_STRING)return t instanceof X;if(e===g.POLYGON)return t instanceof x;if(e==="MultiFeature")return t instanceof F;throw new Error(`Unknown feature class: ${e}`)};y.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};y.prototype.onSetup=function(){};y.prototype.onDrag=function(){};y.prototype.onClick=function(){};y.prototype.onMouseMove=function(){};y.prototype.onMouseDown=function(){};y.prototype.onMouseUp=function(){};y.prototype.onMouseOut=function(){};y.prototype.onKeyUp=function(){};y.prototype.onKeyDown=function(){};y.prototype.onTouchStart=function(){};y.prototype.onTouchMove=function(){};y.prototype.onTouchEnd=function(){};y.prototype.onTap=function(){};y.prototype.onStop=function(){};y.prototype.onTrash=function(){};y.prototype.onCombineFeature=function(){};y.prototype.onUncombineFeature=function(){};y.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const gt={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},sn=Object.keys(gt);function an(e){const t=Object.keys(e);return function(n,r={}){let o={};const i=t.reduce((l,c)=>(l[c]=e[c],l),new y(n));function s(l){return c=>i[l](o,c)}return{start(){o=i.onSetup(r),sn.forEach(l=>{const c=gt[l];let a=()=>!1;e[c]&&(a=()=>!0),this.on(l,a,s(c))})},stop(){i.onStop(o)},trash(){i.onTrash(o)},combineFeatures(){i.onCombineFeatures(o)},uncombineFeatures(){i.onUncombineFeatures(o)},render(l,c){i.toDisplayFeatures(o,l,c)}}}}function un(e){const t=Object.keys(e.options.modes).reduce((u,d)=>(u[d]=an(e.options.modes[d]),u),{});let n={},r={};const o={};let i=null,s=null;o.drag=function(u,d){d({point:u.point,time:new Date().getTime()})?(e.ui.queueMapClasses({mouse:I.DRAG}),s.drag(u)):u.originalEvent.stopPropagation()},o.mousedrag=function(u){o.drag(u,d=>!Pe(n,d))},o.touchdrag=function(u){o.drag(u,d=>!Ae(r,d))},o.mousemove=function(u){if((u.originalEvent.buttons!==void 0?u.originalEvent.buttons:u.originalEvent.which)===1)return o.mousedrag(u);const f=pe(u,e);u.featureTarget=f,s.mousemove(u)},o.mousedown=function(u){n={time:new Date().getTime(),point:u.point};const d=pe(u,e);u.featureTarget=d,s.mousedown(u)},o.mouseup=function(u){const d=pe(u,e);u.featureTarget=d,Pe(n,{point:u.point,time:new Date().getTime()})?s.click(u):s.mouseup(u)},o.mouseout=function(u){s.mouseout(u)},o.touchstart=function(u){if(!e.options.touchEnabled)return;r={time:new Date().getTime(),point:u.point};const d=j.touch(u,null,e)[0];u.featureTarget=d,s.touchstart(u)},o.touchmove=function(u){if(e.options.touchEnabled)return s.touchmove(u),o.touchdrag(u)},o.touchend=function(u){if(u.originalEvent.preventDefault(),!e.options.touchEnabled)return;const d=j.touch(u,null,e)[0];u.featureTarget=d,Ae(r,{time:new Date().getTime(),point:u.point})?s.tap(u):s.touchend(u)};const l=u=>{const d=Le(u),f=Ne(u),C=dt(u);return!(d||f||C)};o.keydown=function(u){(u.srcElement||u.target).classList.contains(R.CANVAS)&&((Le(u)||Ne(u))&&e.options.controls.trash?(u.preventDefault(),s.trash()):l(u)?s.keydown(u):ut(u)&&e.options.controls.point?c(v.DRAW_POINT):lt(u)&&e.options.controls.line_string?c(v.DRAW_LINE_STRING):ct(u)&&e.options.controls.polygon&&c(v.DRAW_POLYGON))},o.keyup=function(u){l(u)&&s.keyup(u)},o.zoomend=function(){e.store.changeZoom()},o.data=function(u){if(u.dataType==="style"){const{setup:d,map:f,options:C,store:L}=e;C.styles.some(B=>f.getLayer(B.id))||(d.addLayers(),L.setDirty(),L.render())}};function c(u,d,f={}){s.stop();const C=t[u];if(C===void 0)throw new Error(`${u} is not valid`);i=u;const L=C(e,d);s=Fe(L,e),f.silent||e.map.fire(D.MODE_CHANGE,{mode:u}),e.store.setDirty(),e.store.render()}const a={trash:!1,combineFeatures:!1,uncombineFeatures:!1};function h(u){let d=!1;Object.keys(u).forEach(f=>{if(a[f]===void 0)throw new Error("Invalid action type");a[f]!==u[f]&&(d=!0),a[f]=u[f]}),d&&e.map.fire(D.ACTIONABLE,{actions:a})}return{start(){i=e.options.defaultMode,s=Fe(t[i](e),e)},changeMode:c,actionable:h,currentModeName(){return i},currentModeRender(u,d){return s.render(u,d)},fire(u,d){e.map&&e.map.fire(u,d)},addEventListeners(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash(u){s.trash(u)},combineFeatures(){s.combineFeatures()},uncombineFeatures(){s.uncombineFeatures()},getMode(){return i}}}function ae(e){return[].concat(e).filter(t=>t!==void 0)}function ln(){const e=this;if(!(e.ctx.map&&e.ctx.map.getSource(G.HOT)!==void 0))return c();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let r=[],o=[];e.isDirty?o=e.getAllIds():(r=e.getChangedIds().filter(a=>e.get(a)!==void 0),o=e.sources.hot.filter(a=>a.properties.id&&r.indexOf(a.properties.id)===-1&&e.get(a.properties.id)!==void 0).map(a=>a.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(a=>{const h=a.properties.id||a.properties.parent;return r.indexOf(h)===-1});const s=i!==e.sources.cold.length||o.length>0;r.forEach(a=>l(a,"hot")),o.forEach(a=>l(a,"cold"));function l(a,h){const u=e.get(a).internal(n);e.ctx.events.currentModeRender(u,d=>{d.properties.mode=n,e.sources[h].push(d)})}s&&e.ctx.map.getSource(G.COLD).setData({type:g.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(G.HOT).setData({type:g.FEATURE_COLLECTION,features:e.sources.hot}),c();function c(){e.isDirty=!1,e.clearChangedIds()}}function _(e){this._features={},this._featureIds=new $,this._selectedFeatureIds=new $,this._selectedCoordinates=[],this._changedFeatureIds=new $,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]};let t;this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,ln.call(this),this._emitSelectionChange&&(this.ctx.events.fire(D.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(D.RENDER,{})}))},this.isDirty=!1}_.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}};_.prototype.setDirty=function(){return this.isDirty=!0,this};_.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0){const r=this.get(e);this.ctx.events.fire(D.CREATE,{features:[r.toGeoJSON()]})}return this};_.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0&&this.ctx.events.fire(D.UPDATE,{action:t.action?t.action:ie.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this};_.prototype.getChangedIds=function(){return this._changedFeatureIds.values()};_.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this};_.prototype.getAllIds=function(){return this._featureIds.values()};_.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this};_.prototype.delete=function(e,t={}){const n=[];return ae(e).forEach(r=>{this._featureIds.has(r)&&(this._featureIds.delete(r),this._selectedFeatureIds.delete(r),t.silent||n.indexOf(this._features[r])===-1&&n.push(this._features[r].toGeoJSON()),delete this._features[r],this.isDirty=!0)}),n.length&&this.ctx.events.fire(D.DELETE,{features:n}),mt(this,t),this};_.prototype.get=function(e){return this._features[e]};_.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])};_.prototype.select=function(e,t={}){return ae(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this};_.prototype.deselect=function(e,t={}){return ae(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),mt(this,t),this};_.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this};_.prototype.setSelected=function(e,t={}){return e=ae(e),this.deselect(this._selectedFeatureIds.values().filter(n=>e.indexOf(n)===-1),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this};_.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this};_.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this};_.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()};_.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))};_.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))};_.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)};_.prototype.setFeatureProperty=function(e,t,n,r={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:r.silent,action:ie.CHANGE_PROPERTIES})};function mt(e,t={}){const n=e._selectedCoordinates.filter(r=>e._selectedFeatureIds.has(r.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}_.prototype.storeMapConfig=function(){it.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})};_.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})};_.prototype.getInitialConfigValue=function(e){return this._mapInitialConfig[e]!==void 0?this._mapInitialConfig[e]:!0};const cn=["mode","feature","mouse"];function dn(e){const t={};let n=null,r={mode:null,feature:null,mouse:null},o={mode:null,feature:null,mouse:null};function i(){s({mode:null,feature:null,mouse:null}),l()}function s(d){o=Object.assign(o,d)}function l(){if(!e.container)return;const d=[],f=[];cn.forEach(C=>{o[C]!==r[C]&&(d.push(`${C}-${r[C]}`),o[C]!==null&&f.push(`${C}-${o[C]}`))}),d.length>0&&e.container.classList.remove(...d),f.length>0&&e.container.classList.add(...f),r=Object.assign(r,o)}function c(d,f={}){const C=document.createElement("button");return C.className=`${R.CONTROL_BUTTON} ${f.className}`,C.setAttribute("title",f.title),f.container.appendChild(C),C.addEventListener("click",L=>{if(L.preventDefault(),L.stopPropagation(),L.target===n){a(),f.onDeactivate();return}h(d),f.onActivate()},!0),C}function a(){n&&(n.classList.remove(R.ACTIVE_BUTTON),n=null)}function h(d){a();const f=t[d];f&&f&&d!=="trash"&&(f.classList.add(R.ACTIVE_BUTTON),n=f)}function E(){const d=e.options.controls,f=document.createElement("div");return f.className=`${R.CONTROL_GROUP} ${R.CONTROL_BASE}`,d&&(d[k.POINT]&&(t[k.POINT]=c(k.POINT,{container:f,className:R.CONTROL_BUTTON_POINT,title:`Marker tool ${e.options.keybindings?"(1)":""}`,onActivate:()=>e.events.changeMode(v.DRAW_POINT),onDeactivate:()=>e.events.trash()})),d[k.LINE]&&(t[k.LINE]=c(k.LINE,{container:f,className:R.CONTROL_BUTTON_LINE,title:`LineString tool ${e.options.keybindings?"(2)":""}`,onActivate:()=>e.events.changeMode(v.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),d[k.POLYGON]&&(t[k.POLYGON]=c(k.POLYGON,{container:f,className:R.CONTROL_BUTTON_POLYGON,title:`Polygon tool ${e.options.keybindings?"(3)":""}`,onActivate:()=>e.events.changeMode(v.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),d.trash&&(t.trash=c("trash",{container:f,className:R.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),d.combine_features&&(t.combine_features=c("combineFeatures",{container:f,className:R.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),d.uncombine_features&&(t.uncombine_features=c("uncombineFeatures",{container:f,className:R.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),f}function u(){Object.keys(t).forEach(d=>{const f=t[d];f.parentNode&&f.parentNode.removeChild(f),delete t[d]})}return{setActiveButton:h,queueMapClasses:s,updateMapClasses:l,clearMapClasses:i,addButtons:E,removeButtons:u}}function fn(e){let t=null,n=null;const r={onRemove(){return e.map.off("load",r.connect),clearInterval(n),r.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",r.connect),clearInterval(n),r.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(o){if(e.map=o,e.events=un(e),e.ui=dn(e),e.container=o.getContainer(),e.store=new _(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=o.boxZoom.isEnabled(),o.boxZoom.disable();const i=o.dragPan.isEnabled();o.dragPan.disable(),o.dragPan.enable(),i||o.dragPan.disable()}return o.loaded()?r.connect():(o.on("load",r.connect),n=setInterval(()=>{o.loaded()&&r.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(G.COLD,{data:{type:g.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(G.HOT,{data:{type:g.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(o=>{e.map.addLayer(o)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(o=>{e.map.getLayer(o.id)&&e.map.removeLayer(o.id)}),e.map.getSource(G.COLD)&&e.map.removeSource(G.COLD),e.map.getSource(G.HOT)&&e.map.removeSource(G.HOT)}};return e.setup=r,r}const Te="#3bb2d0",ne="#fbb03b",Ke="#fff",yt=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],ne,Te],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],ne,Te],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":Ke}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],ne,Te]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":Ke}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":ne}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":ne}}];function Z(e,t){this.x=e,this.y=t}Z.prototype={clone(){return new Z(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),r=t*this.x-n*this.y,o=n*this.x+t*this.y;return this.x=r,this.y=o,this},_rotateAround(e,t){const n=Math.cos(e),r=Math.sin(e),o=t.x+n*(this.x-t.x)-r*(this.y-t.y),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=o,this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Z};Z.convert=function(e){if(e instanceof Z)return e;if(Array.isArray(e))return new Z(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new Z(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};function Ue(e,t){const n=t.getBoundingClientRect();return new Z(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))}function ee(e,t,n,r){return{type:g.FEATURE,properties:{meta:P.VERTEX,parent:e,coord_path:n,active:r?b.ACTIVE:b.INACTIVE},geometry:{type:g.POINT,coordinates:t}}}function pn(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Et(e,t,n){if(e!==null)for(var r,o,i,s,l,c,a,h=0,E=0,u,d=e.type,f=d==="FeatureCollection",C=d==="Feature",L=f?e.features.length:1,N=0;N<L;N++){a=f?e.features[N].geometry:C?e.geometry:e,u=a?a.type==="GeometryCollection":!1,l=u?a.geometries.length:1;for(var B=0;B<l;B++){var O=0,H=0;if(s=u?a.geometries[B]:a,s!==null){c=s.coordinates;var U=s.type;switch(h=0,U){case null:break;case"Point":if(t(c,E,N,O,H)===!1)return!1;E++,O++;break;case"LineString":case"MultiPoint":for(r=0;r<c.length;r++){if(t(c[r],E,N,O,H)===!1)return!1;E++,U==="MultiPoint"&&O++}U==="LineString"&&O++;break;case"Polygon":case"MultiLineString":for(r=0;r<c.length;r++){for(o=0;o<c[r].length-h;o++){if(t(c[r][o],E,N,O,H)===!1)return!1;E++}U==="MultiLineString"&&O++,U==="Polygon"&&H++}U==="Polygon"&&O++;break;case"MultiPolygon":for(r=0;r<c.length;r++){for(H=0,o=0;o<c[r].length;o++){for(i=0;i<c[r][o].length-h;i++){if(t(c[r][o][i],E,N,O,H)===!1)return!1;E++}H++}O++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(Et(s.geometries[r],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hn(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return vt(e);case"FeatureCollection":return gn(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ve(e);default:throw new Error("unknown GeoJSON type")}}function vt(e){const t={type:"Feature"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=Ct(e.properties),e.geometry==null?t.geometry=null:t.geometry=Ve(e.geometry),t}function Ct(e){const t={};return e&&Object.keys(e).forEach(n=>{const r=e[n];typeof r=="object"?r===null?t[n]=null:Array.isArray(r)?t[n]=r.map(o=>o):t[n]=Ct(r):t[n]=r}),t}function gn(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(n=>{switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(n=>vt(n)),t}function Ve(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),e.type==="GeometryCollection"?(t.geometries=e.geometries.map(n=>Ve(n)),t):(t.coordinates=St(e.coordinates),t)}function St(e){const t=e;return typeof t[0]!="object"?t.slice():t.map(n=>St(n))}function Ye(e,t={}){return Tt(e,"mercator",t)}function mn(e,t={}){return Tt(e,"wgs84",t)}function Tt(e,t,n={}){n=n||{};var r=n.mutate;if(!e)throw new Error("geojson is required");return Array.isArray(e)&&pn(e[0])?e=t==="mercator"?Xe(e):He(e):(r!==!0&&(e=hn(e)),Et(e,function(o){var i=t==="mercator"?Xe(o):He(o);o[0]=i[0],o[1]=i[1]})),e}function Xe(e){var t=Math.PI/180,n=6378137,r=20037508342789244e-9,o=Math.abs(e[0])<=180?e[0]:e[0]-yn(e[0])*360,i=[n*o*t,n*Math.log(Math.tan(Math.PI*.25+.5*e[1]*t))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function He(e){var t=180/Math.PI,n=6378137;return[e[0]*t/n,(Math.PI*.5-2*Math.atan(Math.exp(-e[1]/n)))*t]}function yn(e){return e<0?-1:e>0?1:0}function _t(e,t,n){const r=t.geometry.coordinates,o=n.geometry.coordinates;if(r[1]>be||r[1]<Oe||o[1]>be||o[1]<Oe)return null;const i=Ye(r),s=Ye(o),l=E=>Number(E.toFixed(8)),c=(E,u)=>(E+u)/2,a=mn([c(i[0],s[0]),c(i[1],s[1])]),h=[l(a[0]),l(a[1])];return{type:g.FEATURE,properties:{meta:P.MIDPOINT,parent:e,lng:h[0],lat:h[1],coord_path:n.properties.coord_path},geometry:{type:g.POINT,coordinates:h}}}function Se(e,t={},n=null){const{type:r,coordinates:o}=e.geometry,i=e.properties&&e.properties.id;let s=[];r===g.POINT?s.push(ee(i,o,n,c(n))):r===g.POLYGON?o.forEach((h,E)=>{l(h,n!==null?`${n}.${E}`:String(E))}):r===g.LINE_STRING?l(o,n):r.indexOf(g.MULTI_PREFIX)===0&&a();function l(h,E){let u="",d=null;h.forEach((f,C)=>{const L=E!=null?`${E}.${C}`:String(C),N=ee(i,f,L,c(L));if(t.midpoints&&d){const O=_t(i,d,N);O&&s.push(O)}d=N;const B=JSON.stringify(f);u!==B&&s.push(N),C===0&&(u=B)})}function c(h){return t.selectedPaths?t.selectedPaths.indexOf(h)!==-1:!1}function a(){const h=r.replace(g.MULTI_PREFIX,"");o.forEach((E,u)=>{const d={type:g.FEATURE,properties:e.properties,geometry:{type:h,coordinates:E}};s=s.concat(Se(d,t,u))})}return s}const q={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:ce,LAT_MAX:de,LAT_RENDERED_MIN:Ze,LAT_RENDERED_MAX:We,LNG_MIN:ze,LNG_MAX:Qe}=st;function En(e){const t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],n=[e.geometry.coordinates].flat(t),r=n.map(l=>l[0]),o=n.map(l=>l[1]),i=l=>Math.min.apply(null,l),s=l=>Math.max.apply(null,l);return[i(r),i(o),s(r),s(o)]}function xe(e,t){let n=ce,r=de,o=ce,i=de,s=Qe,l=ze;e.forEach(a=>{const h=En(a),E=h[1],u=h[3],d=h[0],f=h[2];E>n&&(n=E),u<r&&(r=u),u>o&&(o=u),E<i&&(i=E),d<s&&(s=d),f>l&&(l=f)});const c=t;return n+c.lat>We&&(c.lat=We-n),o+c.lat>de&&(c.lat=de-o),r+c.lat<Ze&&(c.lat=Ze-r),i+c.lat<ce&&(c.lat=ce-i),s+c.lng<=ze&&(c.lng+=Math.ceil(Math.abs(c.lng)/360)*360),l+c.lng>=Qe&&(c.lng-=Math.ceil(Math.abs(c.lng)/360)*360),c}function Be(e,t){const n=xe(e.map(r=>r.toGeoJSON()),t);e.forEach(r=>{const o=r.getCoordinates(),i=a=>{const h={lng:a[0]+n.lng,lat:a[1]+n.lat};return[h.lng,h.lat]},s=a=>a.map(h=>i(h)),l=a=>a.map(h=>s(h));let c;r.type===g.POINT?c=i(o):r.type===g.LINE_STRING||r.type===g.MULTI_POINT?c=o.map(i):r.type===g.POLYGON||r.type===g.MULTI_LINE_STRING?c=o.map(s):r.type===g.MULTI_POLYGON&&(c=o.map(l)),r.incomingCoords(c)})}const S={};S.onSetup=function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>this.getFeature(n)!==void 0)),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t};S.fireUpdate=function(){this.fire(D.UPDATE,{action:ie.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})};S.fireActionable=function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(s=>{s.type.replace("Multi","")!==i&&(n=!1)})}const r=t.length>0,o=e.length>0;this.setActionableState({combineFeatures:n,uncombineFeatures:r,trash:o})};S.getUniqueIds=function(e){return e.length?e.map(n=>n.properties.id).filter(n=>n!==void 0).reduce((n,r)=>(n.add(r),n),new $).values():[]};S.stopExtendedInteractions=function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1};S.onStop=function(){q.enable(this)};S.onMouseMove=function(e,t){return we(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0};S.onMouseOut=function(e){return e.dragMoving?this.fireUpdate():!0};S.onTap=S.onClick=function(e,t){if(ye(t))return this.clickAnywhere(e,t);if(me(P.VERTEX)(t))return this.clickOnVertex(e,t);if(we(t))return this.clickOnFeature(e,t)};S.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),q.enable(this),this.stopExtendedInteractions(e)};S.clickOnVertex=function(e,t){this.changeMode(v.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:I.MOVE})};S.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat};S.clickOnFeature=function(e,t){q.disable(this),this.stopExtendedInteractions(e);const n=he(t),r=this.getSelectedIds(),o=t.featureTarget.properties.id,i=this.isSelected(o);if(!n&&i&&this.getFeature(o).type!==g.POINT)return this.changeMode(v.DIRECT_SELECT,{featureId:o});i&&n?(this.deselect(o),this.updateUIClasses({mouse:I.POINTER}),r.length===1&&q.enable(this)):!i&&n?(this.select(o),this.updateUIClasses({mouse:I.MOVE})):!i&&!n&&(r.forEach(s=>this.doRender(s)),this.setSelected(o),this.updateUIClasses({mouse:I.MOVE})),this.doRender(o)};S.onMouseDown=function(e,t){if(e.initialDragPanState=this.map.dragPan.isEnabled(),z(t))return this.startOnActiveFeature(e,t);if(this.drawConfig.boxSelect&&at(t))return this.startBoxSelect(e,t)};S.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=Ue(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0};S.onTouchStart=function(e,t){if(z(t))return this.startOnActiveFeature(e,t)};S.onDrag=function(e,t){if(e.canDragMove)return this.dragMove(e,t);if(this.drawConfig.boxSelect&&e.canBoxSelect)return this.whileBoxSelect(e,t)};S.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:I.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(R.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=Ue(t.originalEvent,this.map.getContainer()),r=Math.min(e.boxSelectStartLocation.x,n.x),o=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),s=Math.max(e.boxSelectStartLocation.y,n.y),l=`translate(${r}px, ${i}px)`;e.boxSelectElement.style.transform=l,e.boxSelectElement.style.WebkitTransform=l,e.boxSelectElement.style.width=`${o-r}px`,e.boxSelectElement.style.height=`${s-i}px`};S.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};Be(this.getSelected(),n),e.dragMoveLocation=t.lngLat};S.onTouchEnd=S.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,Ue(t.originalEvent,this.map.getContainer())],r=this.featuresAt(null,n,"click"),o=this.getUniqueIds(r).filter(i=>!this.isSelected(i));o.length&&(this.select(o),o.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:I.MOVE}))}this.stopExtendedInteractions(e)};S.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?b.ACTIVE:b.INACTIVE,n(t),this.fireActionable(),!(t.properties.active!==b.ACTIVE||t.geometry.type===g.POINT)&&Se(t).forEach(n)};S.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()};S.onCombineFeatures=function(){const e=this.getSelected();if(e.length===0||e.length<2)return;const t=[],n=[],r=e[0].type.replace("Multi","");for(let o=0;o<e.length;o++){const i=e[o];if(i.type.replace("Multi","")!==r)return;i.type.includes("Multi")?i.getCoordinates().forEach(s=>{t.push(s)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const o=this.newFeature({type:g.FEATURE,properties:n[0].properties,geometry:{type:`Multi${r}`,coordinates:t}});this.addFeature(o),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([o.id]),this.fire(D.COMBINE_FEATURES,{createdFeatures:[o.toGeoJSON()],deletedFeatures:n})}this.fireActionable()};S.onUncombineFeatures=function(){const e=this.getSelected();if(e.length===0)return;const t=[],n=[];for(let r=0;r<e.length;r++){const o=e[r];this.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach(i=>{this.addFeature(i),i.properties=o.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))}t.length>1&&this.fire(D.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const It=me(P.VERTEX),Mt=me(P.MIDPOINT),T={};T.fireUpdate=function(){this.fire(D.UPDATE,{action:ie.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})};T.fireActionable=function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})};T.startDragging=function(e,t){e.initialDragPanState==null&&(e.initialDragPanState=this.map.dragPan.isEnabled()),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat};T.stopDragging=function(e){e.canDragMove&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.initialDragPanState=null,e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null};T.onVertex=function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,r=e.selectedCoordPaths.indexOf(n.coord_path);!he(t)&&r===-1?e.selectedCoordPaths=[n.coord_path]:he(t)&&r===-1&&e.selectedCoordPaths.push(n.coord_path);const o=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(o)};T.onMidpoint=function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]};T.pathsToCoordinates=function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))};T.onFeature=function(e,t){e.selectedCoordPaths.length===0?this.startDragging(e,t):this.stopDragging(e)};T.dragFeature=function(e,t,n){Be(this.getSelected(),n),e.dragMoveLocation=t.lngLat};T.dragVertex=function(e,t,n){const r=e.selectedCoordPaths.map(s=>e.feature.getCoordinate(s)),o=r.map(s=>({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:s}})),i=xe(o,n);for(let s=0;s<r.length;s++){const l=r[s];e.feature.updateCoordinate(e.selectedCoordPaths[s],l[0]+i.lng,l[1]+i.lat)}};T.clickNoTarget=function(){this.changeMode(v.SIMPLE_SELECT)};T.clickInactive=function(){this.changeMode(v.SIMPLE_SELECT)};T.clickActiveFeature=function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()};T.onSetup=function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===g.POINT)throw new TypeError("direct_select mode doesn't handle point features");const r={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,r.selectedCoordPaths)),this.setSelected(t),q.disable(this),this.setActionableState({trash:!0}),r};T.onStop=function(){q.enable(this),this.clearSelectedCoordinates()};T.toDisplayFeatures=function(e,t,n){e.featureId===t.properties.id?(t.properties.active=b.ACTIVE,n(t),Se(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=b.INACTIVE,n(t)),this.fireActionable(e)};T.onTrash=function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),e.feature.isValid()===!1&&(this.deleteFeature([e.featureId]),this.changeMode(v.SIMPLE_SELECT,{}))};T.onMouseMove=function(e,t){const n=z(t),r=It(t),o=Mt(t),i=e.selectedCoordPaths.length===0;return n&&i?this.updateUIClasses({mouse:I.MOVE}):r&&!i?this.updateUIClasses({mouse:I.MOVE}):this.updateUIClasses({mouse:I.NONE}),(r||n||o)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0};T.onMouseOut=function(e){return e.dragMoving&&this.fireUpdate(),!0};T.onTouchStart=T.onMouseDown=function(e,t){if(It(t))return this.onVertex(e,t);if(z(t))return this.onFeature(e,t);if(Mt(t))return this.onMidpoint(e,t)};T.onDrag=function(e,t){if(e.canDragMove!==!0)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat};T.onClick=function(e,t){if(ye(t))return this.clickNoTarget(e,t);if(z(t))return this.clickActiveFeature(e,t);if(De(t))return this.clickInactive(e,t);this.stopDragging(e)};T.onTap=function(e,t){if(ye(t))return this.clickNoTarget(e,t);if(z(t))return this.clickActiveFeature(e,t);if(De(t))return this.clickInactive(e,t)};T.onTouchEnd=T.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const Y={};Y.onSetup=function(){const e=this.newFeature({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(k.POINT),this.setActionableState({trash:!0}),{point:e}};Y.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)};Y.onTap=Y.onClick=function(e,t){this.updateUIClasses({mouse:I.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(D.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.point.id]})};Y.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})};Y.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.point.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t)};Y.onTrash=Y.stopDrawingAndRemove;Y.onKeyUp=function(e,t){if(Ee(t)||ve(t))return this.stopDrawingAndRemove(e,t)};function ge(e,t){return e.lngLat?e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]:!1}const J={};J.onSetup=function(){const e=this.newFeature({type:g.FEATURE,properties:{},geometry:{type:g.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),q.disable(this),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(k.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}};J.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&ge(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:I.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)};J.clickOnVertex=function(e){return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.polygon.id]})};J.onMouseMove=function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),se(t)&&this.updateUIClasses({mouse:I.POINTER})};J.onTap=J.onClick=function(e,t){return se(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)};J.onKeyUp=function(e,t){Ee(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)):ve(t)&&this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.polygon.id]})};J.onStop=function(e){this.updateUIClasses({mouse:I.NONE}),q.enable(this),this.activateUIButton(),this.getFeature(e.polygon.id)!==void 0&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(D.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT,{},{silent:!0})))};J.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.polygon.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t);if(t.geometry.coordinates.length===0)return;const o=t.geometry.coordinates[0].length;if(!(o<3)){if(t.properties.meta=P.FEATURE,n(ee(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),o>3){const i=t.geometry.coordinates[0].length-3;n(ee(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(o<=4){const i=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(n({type:g.FEATURE,properties:t.properties,geometry:{coordinates:i,type:g.LINE_STRING}}),o===3)return}return n(t)}};J.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)};const K={};K.onSetup=function(e){e=e||{};const t=e.featureId;let n,r,o="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&i.type==="Feature"&&i.geometry&&i.geometry.type==="Point"&&(i=i.geometry),i&&i.type==="Point"&&i.coordinates&&i.coordinates.length===2&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const s=n.coordinates.length-1;if(n.coordinates[s][0]===i[0]&&n.coordinates[s][1]===i[1])r=s+1,n.addCoordinate(r,...n.coordinates[s]);else if(n.coordinates[0][0]===i[0]&&n.coordinates[0][1]===i[1])o="backwards",r=0,n.addCoordinate(r,...n.coordinates[0]);else throw new Error("`from` should match the point at either the start or the end of the provided LineString")}else n=this.newFeature({type:g.FEATURE,properties:{},geometry:{type:g.LINE_STRING,coordinates:[]}}),r=0,this.addFeature(n);return this.clearSelectedFeatures(),q.disable(this),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(k.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:r,direction:o}};K.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&ge(t,e.line.coordinates[e.currentVertexPosition-1])||e.direction==="backwards"&&ge(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:I.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.direction==="forward"?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)};K.clickOnVertex=function(e){return this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.line.id]})};K.onMouseMove=function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),se(t)&&this.updateUIClasses({mouse:I.POINTER})};K.onTap=K.onClick=function(e,t){if(se(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)};K.onKeyUp=function(e,t){ve(t)?this.changeMode(v.SIMPLE_SELECT,{featureIds:[e.line.id]}):Ee(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT))};K.onStop=function(e){q.enable(this),this.activateUIButton(),this.getFeature(e.line.id)!==void 0&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(D.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT,{},{silent:!0})))};K.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(v.SIMPLE_SELECT)};K.toDisplayFeatures=function(e,t,n){const r=t.properties.id===e.line.id;if(t.properties.active=r?b.ACTIVE:b.INACTIVE,!r)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=P.FEATURE,n(ee(e.line.id,t.geometry.coordinates[e.direction==="forward"?t.geometry.coordinates.length-2:1],`${e.direction==="forward"?t.geometry.coordinates.length-2:1}`,!1)),n(t))};const Ot={simple_select:S,direct_select:T,draw_point:Y,draw_polygon:J,draw_line_string:K},vn={defaultMode:v.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:yt,modes:Ot,controls:{},userProperties:!1,suppressAPIEvents:!0},Cn={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Sn={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function je(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:t==="hot"?G.HOT:G.COLD}))}function Tn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),e.displayControlsDefault===!1?t.controls=Object.assign({},Sn,e.controls):t.controls=Object.assign({},Cn,e.controls),t=Object.assign({},vn,t),t.styles=je(t.styles,"cold").concat(je(t.styles,"hot")),t}var _e,et;function _n(){return et||(et=1,_e=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)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(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),_e}var In=_n();const tt=oe.getDefaultExportFromCjs(In);var Ie,nt;function Mn(){if(nt)return Ie;nt=1,Ie=t;var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function t(n){if(!n||!n.type)return null;var r=e[n.type];if(!r)return null;if(r==="geometry")return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:n}]};if(r==="feature")return{type:"FeatureCollection",features:[n]};if(r==="featurecollection")return n}return Ie}var On=Mn();const bn=oe.getDefaultExportFromCjs(On);function bt(e,t){return e.length!==t.length?!1:JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const Ln={Polygon:x,LineString:X,Point:W,MultiPolygon:F,MultiLineString:F,MultiPoint:F};function Nn(e,t){t.modes=v;const n=e.options.suppressAPIEvents!==void 0?!!e.options.suppressAPIEvents:!0;return t.getFeatureIdsAt=function(r){return j.click({point:r},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:g.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(r=>e.store.get(r)).map(r=>r.toGeoJSON())}},t.getSelectedPoints=function(){return{type:g.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(r=>({type:g.FEATURE,properties:{},geometry:{type:g.POINT,coordinates:r.coordinates}}))}},t.set=function(r){if(r.type===void 0||r.type!==g.FEATURE_COLLECTION||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");const o=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const s=t.add(r),l=new $(s);return i=i.filter(c=>!l.has(c)),i.length&&t.delete(i),o(),s},t.add=function(r){const i=JSON.parse(JSON.stringify(bn(r))).features.map(s=>{if(s.id=s.id||ke(),s.geometry===null)throw new Error("Invalid geometry: null");if(e.store.get(s.id)===void 0||e.store.get(s.id).type!==s.geometry.type){const l=Ln[s.geometry.type];if(l===void 0)throw new Error(`Invalid geometry type: ${s.geometry.type}.`);const c=new l(e,s);e.store.add(c,{silent:n})}else{const l=e.store.get(s.id),c=l.properties;l.properties=s.properties,tt(c,s.properties)||e.store.featureChanged(l.id,{silent:n}),tt(l.getCoordinates(),s.geometry.coordinates)||l.incomingCoords(s.geometry.coordinates)}return s.id});return e.store.render(),i},t.get=function(r){const o=e.store.get(r);if(o)return o.toGeoJSON()},t.getAll=function(){return{type:g.FEATURE_COLLECTION,features:e.store.getAll().map(r=>r.toGeoJSON())}},t.delete=function(r){return e.store.delete(r,{silent:n}),t.getMode()===v.DIRECT_SELECT&&!e.store.getSelectedIds().length?e.events.changeMode(v.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===v.DIRECT_SELECT?e.events.changeMode(v.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(r,o={}){return r===v.SIMPLE_SELECT&&t.getMode()===v.SIMPLE_SELECT?(bt(o.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(o.featureIds,{silent:n}),e.store.render()),t):(r===v.DIRECT_SELECT&&t.getMode()===v.DIRECT_SELECT&&o.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(r,o,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(r,o,i){return e.store.setFeatureProperty(r,o,i,{silent:n}),t},t}const Pn=Object.freeze(Object.defineProperty({__proto__:null,CommonSelectors:$t,ModeHandler:Fe,StringSet:$,constrainFeatureMovement:xe,createMidPoint:_t,createSupplementaryPoints:Se,createVertex:ee,doubleClickZoom:q,euclideanDistance:Re,featuresAt:j,getFeatureAtAndSetCursors:pe,isClick:Pe,isEventAtCoordinates:ge,isTap:Ae,mapEventToBoundingBox:pt,moveFeatures:Be,sortFeatures:ft,stringSetsAreEqual:bt,theme:yt,toDenseArray:ae},Symbol.toStringTag,{value:"Module"})),An=function(e,t){e=Tn(e);const n={options:e};t=Nn(n,t),n.api=t;const r=fn(n);return t.onAdd=r.onAdd,t.onRemove=r.onRemove,t.types=k,t.options=e,t};function re(e){An(e,this)}re.modes=Ot;re.constants=st;re.lib=Pn;var Me={exports:{}},rt;function Fn(){if(rt)return Me.exports;rt=1;var e=Me.exports={};return e.onSetup=function(){return this.setActionableState(),{}},e.toDisplayFeatures=function(t,n,r){r(n)},Me.exports}var Dn=Fn();const wn=oe.getDefaultExportFromCjs(Dn);var fe={},ot;function Rn(){if(ot)return fe;ot=1,Object.defineProperty(fe,"__esModule",{value:!0});var e={enable:function(r){setTimeout(function(){!r.map||!r.map.doubleClickZoom||!r._ctx||!r._ctx.store||!r._ctx.store.getInitialConfigValue||r._ctx.store.getInitialConfigValue("doubleClickZoom")&&r.map.doubleClickZoom.enable()},0)},disable:function(r){setTimeout(function(){!r.map||!r.map.doubleClickZoom||r.map.doubleClickZoom.disable()},0)}},t={onSetup:function(r){var o=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[]]}});return this.addFeature(o),this.clearSelectedFeatures(),e.disable(this),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:o}},onTap:function(r,o){r.startPoint&&this.onMouseMove(r,o),this.onClick(r,o)},onClick:function(r,o){r.startPoint&&r.startPoint[0]!==o.lngLat.lng&&r.startPoint[1]!==o.lngLat.lat&&(this.updateUIClasses({mouse:"pointer"}),r.endPoint=[o.lngLat.lng,o.lngLat.lat],this.changeMode("simple_select",{featuresId:r.rectangle.id}));var i=[o.lngLat.lng,o.lngLat.lat];r.startPoint=i},onMouseMove:function(r,o){r.startPoint&&(r.rectangle.updateCoordinate("0.0",r.startPoint[0],r.startPoint[1]),r.rectangle.updateCoordinate("0.1",o.lngLat.lng,r.startPoint[1]),r.rectangle.updateCoordinate("0.2",o.lngLat.lng,o.lngLat.lat),r.rectangle.updateCoordinate("0.3",r.startPoint[0],o.lngLat.lat),r.rectangle.updateCoordinate("0.4",r.startPoint[0],r.startPoint[1]))},onKeyUp:function(r,o){if(o.keyCode===27)return this.changeMode("simple_select")},onStop:function(r){e.enable(this),this.updateUIClasses({mouse:"none"}),this.activateUIButton(),this.getFeature(r.rectangle.id)!==void 0&&(r.rectangle.removeCoordinate("0.4"),r.rectangle.isValid()?this.map.fire("draw.create",{features:[r.rectangle.toGeoJSON()]}):(this.deleteFeature([r.rectangle.id],{silent:!0}),this.changeMode("simple_select",{},{silent:!0})))},toDisplayFeatures:function(r,o,i){var s=o.properties.id===r.rectangle.id;if(o.properties.active=s?"true":"false",!s)return i(o);if(r.startPoint)return i(o)},onTrash:function(r){this.deleteFeature([r.rectangle.id],{silent:!0}),this.changeMode("simple_select")}};return fe.default=t,fe}var kn=Rn();const Un=oe.getDefaultExportFromCjs(kn),Vn={key:0,class:"measure-info-panel"},xn={class:"measure-info-content"},Bn={class:"measure-label"},Gn={class:"measure-value"},$n={class:"qy-flex-row hiper-map-tools-bar"},qn=p.defineComponent({__name:"MapTools",props:{tools:{default:()=>["point","line","polygon","measure_distance","measure_area","clear_all"]}},setup(e){const t=p.inject("mapRootId"),n=p.ref(),r=p.ref([]),o=p.ref(null),i=p.ref(null),s=p.ref(!1),l=p.ref("distance"),c=M=>{switch(s.value&&M!=="measure_distance"&&M!=="clear_all"&&B(),n.value=M,M){case"point":h.changeMode("draw_point");break;case"line":h.changeMode("draw_line_string");break;case"polygon":h.changeMode("draw_polygon");break;case"measure_distance":h.changeMode("simple_select"),l.value="distance",d();break;case"measure_area":h.changeMode("simple_select"),l.value="area",d();break;case"clear_all":h.deleteAll(),B();break}},a=p.inject(At.mapInstanceKey),h=new re({userProperties:!0,displayControlsDefault:!1,modes:{...re.modes,draw_rectangle:Un,static:wn}});let E=null;E=Ge.mapLoadedBus.on(({mapRootId:M})=>{t!==M||!a?.value||(console.log("hiper-map-tools-bar mounted",a),a.value.addControl(h,"top-left"),a.value.on("draw.create",u))});function u(M){const m=h.getAll();if(!m.features.length)return;m.features=[m.features[0]];const A={point:{layerType:"symbol",config:{textColor:"rgba(0,0,0,1)",iconName:Ft.DefaultIcon}},line:{layerType:"line",config:{lineWidth:1,lineColor:"rgba(255, 0, 0, 1)",lineStyle:"solid"}},polygon:{layerType:"shape",config:{fillColor:"rgba(241, 131, 127, 1)",lineWidth:1}}}[n.value];A&&Ge.showLayerEditKeyBus.emit({mapRootId:t,e:new MouseEvent("click"),layer:{layerType:A.layerType,customLayerConfig:JSON.stringify(A.config),geoJSON:JSON.stringify(m),...n.value==="polygon"?{pid:""}:{}}}),h.deleteAll()}function d(){a?.value&&(s.value=!0,r.value=[],a.value.getCanvas().style.cursor="crosshair",a.value.on("click",C),a.value.on("dblclick",f))}function f(M){if(s.value){if(M.preventDefault(),l.value==="distance")r.value.length>=2&&L();else if(r.value.length>=3){const m=r.value[0],V=r.value[r.value.length-1];(m[0]!==V[0]||m[1]!==V[1])&&r.value.push(m),L()}a?.value?.off("click",C),a?.value?.off("dblclick",f),a?.value&&(a.value.getCanvas().style.cursor=""),s.value=!1}}function C(M){if(!s.value||!a?.value)return;M.originalEvent.stopPropagation();const m=[M.lngLat.lng,M.lngLat.lat];r.value.push(m),r.value.length===1?(l.value==="distance"?O.value=0:U.value=0,a.value.getSource("measure-point-source")?a.value.getSource("measure-point-source").setData({type:"Feature",properties:{},geometry:{type:"Point",coordinates:m}}):(a.value.addSource("measure-point-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"Point",coordinates:m}}}),a.value.addLayer({id:"measure-point-layer",type:"circle",source:"measure-point-source",paint:{"circle-radius":5,"circle-color":"#16aaff"}}))):(a.value.getSource("measure-point-source")&&a.value.getSource("measure-point-source").setData({type:"FeatureCollection",features:r.value.map(V=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:V}}))}),L(),l.value==="area"&&r.value.length>=3&&(a.value.getCanvas().style.cursor="pointer"))}function L(){if(!a?.value||r.value.length<2)return;const M=Q.lineString(r.value);if(l.value==="distance"){const m=Q.length(M,{units:"kilometers"});O.value=m,m<1?`${(m*1e3).toFixed(2)}`:`${m.toFixed(3)}`;const V=Math.floor(r.value.length/2)-1;V<0?r.value[0]:r.value[V],N(M)}else if(r.value.length>=3){const m=[...r.value];m[0]!==m[m.length-1]&&m.push(m[0]);const V=Q.polygon([m]),A=Q.area(V)/1e6;U.value=A,A<1?`${(A*1e6).toFixed(2)}`:`${A.toFixed(3)}`;const ue=Q.centroid(V);N(M,ue.geometry.coordinates)}else N(M,M.geometry.coordinates[0])}function N(M,m,V){if(a?.value){if(a.value.getSource("measure-line-source")?a.value.getSource("measure-line-source").setData(M):(a.value.addSource("measure-line-source",{type:"geojson",data:M}),a.value.addLayer({id:"measure-line-layer",type:"line",source:"measure-line-source",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#16aaff","line-width":2,"line-dasharray":[2,1]}}),o.value="measure-line-layer"),l.value==="area"&&r.value.length>=3){const A=[...r.value];A[0]!==A[A.length-1]&&A.push(A[0]);const ue=Q.polygon([A]);a.value.getSource("measure-fill-source")?a.value.getSource("measure-fill-source").setData(ue):(a.value.addSource("measure-fill-source",{type:"geojson",data:ue}),a.value.addLayer({id:"measure-fill-layer",type:"fill",source:"measure-fill-source",paint:{"fill-color":"#16aaff","fill-opacity":.2,"fill-outline-color":"#16aaff"}},"measure-line-layer"))}a.value.getSource("measure-label-source")&&a.value.getLayer("measure-label-layer")&&(a.value.removeLayer("measure-label-layer"),a.value.removeSource("measure-label-source"),i.value=null)}}function B(){a?.value&&(a.value?.off("click",C),a.value?.off("dblclick",f),a.value.getCanvas().style.cursor="",a.value.getLayer("measure-point-layer")&&(a.value.removeLayer("measure-point-layer"),a.value.removeSource("measure-point-source")),a.value.getLayer("measure-line-layer")&&(a.value.removeLayer("measure-line-layer"),a.value.removeSource("measure-line-source")),a.value.getLayer("measure-fill-layer")&&(a.value.removeLayer("measure-fill-layer"),a.value.removeSource("measure-fill-source")),a.value.getLayer("measure-label-layer")&&(a.value.removeLayer("measure-label-layer"),a.value.removeSource("measure-label-source")),r.value=[],o.value=null,i.value=null,s.value=!1,O.value=0,U.value=0,a.value.getLayer("measure-label-layer")&&a.value.removeLayer("measure-label-layer"),a.value.getSource("measure-label-source")&&a.value.removeSource("measure-label-source"))}p.onUnmounted(()=>{B(),E&&E(),a?.value&&(a.value.removeControl(h),a.value?.off("draw.create",u),a.value?.off("click",C),a.value?.off("dblclick",f))});const O=p.ref(0),H=p.computed(()=>O.value<1?`${(O.value*1e3).toFixed(2)} 米`:`${O.value.toFixed(3)} 公里`),U=p.ref(0),Lt=p.computed(()=>U.value<1?`${(U.value*1e6).toFixed(2)} 平方米`:`${U.value.toFixed(3)} 平方公里`),Nt=p.computed(()=>l.value==="distance"?H.value:Lt.value),Pt=p.computed(()=>l.value==="distance"?"总长度: ":"总面积: ");return(M,m)=>(p.openBlock(),p.createElementBlock(p.Fragment,null,[s.value||r.value.length>0&&(n.value=="measure_distance"||n.value=="measure_area")?(p.openBlock(),p.createElementBlock("div",Vn,[p.createElementVNode("div",xn,[p.createElementVNode("span",Bn,p.toDisplayString(Pt.value),1),p.createElementVNode("span",Gn,p.toDisplayString(Nt.value),1),p.createVNode(p.unref(Rt.ElIcon),{style:{display:"block","margin-left":"10px",cursor:"pointer"},onClick:m[0]||(m[0]=V=>c("clear_all")),size:"20px"},{default:p.withCtx(()=>[p.createVNode(p.unref(wt.Close))]),_:1})])])):p.createCommentVNode("",!0),p.createElementVNode("div",$n,[e.tools.includes("point")?(p.openBlock(),p.createElementBlock("div",{key:0,title:"兴趣点",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="point"?"active":null]),onClick:m[1]||(m[1]=()=>c("point"))},[...m[7]||(m[7]=[p.createElementVNode("span",{class:"qyuan icon-local-two"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("line")?(p.openBlock(),p.createElementBlock("div",{key:1,title:"折线",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="line"?"active":null]),onClick:m[2]||(m[2]=()=>c("line"))},[...m[8]||(m[8]=[p.createElementVNode("span",{class:"qyuan icon-whole-site-accelerator"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("polygon")?(p.openBlock(),p.createElementBlock("div",{key:2,title:"多边形",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="polygon"?"active":null]),onClick:m[3]||(m[3]=()=>c("polygon"))},[...m[9]||(m[9]=[p.createElementVNode("span",{class:"qyuan icon-anchor"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("measure_distance")?(p.openBlock(),p.createElementBlock("div",{key:3,title:"测距",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="measure_distance"?"active":null]),onClick:m[4]||(m[4]=()=>c("measure_distance"))},[...m[10]||(m[10]=[p.createElementVNode("span",{class:"qyuan icon-ruler"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("measure_area")?(p.openBlock(),p.createElementBlock("div",{key:4,title:"测面",class:p.normalizeClass(["hiper-map-tools-btn",n.value=="measure_area"?"active":null]),onClick:m[5]||(m[5]=()=>c("measure_area"))},[...m[11]||(m[11]=[p.createElementVNode("span",{class:"qyuan icon-multi-triangular"},null,-1)])],2)):p.createCommentVNode("",!0),e.tools.includes("clear_all")?(p.openBlock(),p.createElementBlock("div",{key:5,title:"清除所有临时绘制图形",class:"hiper-map-tools-btn",style:{border:"none"},onClick:m[6]||(m[6]=()=>c("clear_all"))},[...m[12]||(m[12]=[p.createElementVNode("span",{class:"qyuan icon-clear"},null,-1)])])):p.createCommentVNode("",!0)])],64))}});exports._sfc_main=qn;
@@ -2929,10 +2929,10 @@ const Wn = /* @__PURE__ */ le(Zn), zn = {
2929
2929
  }
2930
2930
  }
2931
2931
  function V() {
2932
- a?.value && (a.value.off("click", v), a.value.off("dblclick", f), a.value.getCanvas().style.cursor = "", a.value.getLayer("measure-point-layer") && (a.value.removeLayer("measure-point-layer"), a.value.removeSource("measure-point-source")), a.value.getLayer("measure-line-layer") && (a.value.removeLayer("measure-line-layer"), a.value.removeSource("measure-line-source")), a.value.getLayer("measure-fill-layer") && (a.value.removeLayer("measure-fill-layer"), a.value.removeSource("measure-fill-source")), a.value.getLayer("measure-label-layer") && (a.value.removeLayer("measure-label-layer"), a.value.removeSource("measure-label-source")), r.value = [], o.value = null, i.value = null, s.value = !1, M.value = 0, k.value = 0, a.value.getLayer("measure-label-layer") && a.value.removeLayer("measure-label-layer"), a.value.getSource("measure-label-source") && a.value.removeSource("measure-label-source"));
2932
+ a?.value && (a.value?.off("click", v), a.value?.off("dblclick", f), a.value.getCanvas().style.cursor = "", a.value.getLayer("measure-point-layer") && (a.value.removeLayer("measure-point-layer"), a.value.removeSource("measure-point-source")), a.value.getLayer("measure-line-layer") && (a.value.removeLayer("measure-line-layer"), a.value.removeSource("measure-line-source")), a.value.getLayer("measure-fill-layer") && (a.value.removeLayer("measure-fill-layer"), a.value.removeSource("measure-fill-source")), a.value.getLayer("measure-label-layer") && (a.value.removeLayer("measure-label-layer"), a.value.removeSource("measure-label-source")), r.value = [], o.value = null, i.value = null, s.value = !1, M.value = 0, k.value = 0, a.value.getLayer("measure-label-layer") && a.value.removeLayer("measure-label-layer"), a.value.getSource("measure-label-source") && a.value.removeSource("measure-label-source"));
2933
2933
  }
2934
2934
  Bt(() => {
2935
- V(), y && y(), a?.value && (a.value.removeControl(p), a.value.off("draw.create", u), a.value.off("click", v), a.value.off("dblclick", f));
2935
+ V(), y && y(), a?.value && (a.value.removeControl(p), a.value?.off("draw.create", u), a.value?.off("click", v), a.value?.off("dblclick", f));
2936
2936
  });
2937
2937
  const M = Z(0), H = he(() => M.value < 1 ? `${(M.value * 1e3).toFixed(2)} 米` : `${M.value.toFixed(3)} 公里`), k = Z(0), Ut = he(() => k.value < 1 ? `${(k.value * 1e6).toFixed(2)} 平方米` : `${k.value.toFixed(3)} 平方公里`), Gt = he(() => l.value === "distance" ? H.value : Ut.value), Vt = he(() => l.value === "distance" ? "总长度: " : "总面积: ");
2938
2938
  return (I, g) => (z(), W($t, null, [
@@ -952,7 +952,8 @@ const co = it(uo), bo = /* @__PURE__ */ q({
952
952
  title: "物种名称替换",
953
953
  modelValue: s.value,
954
954
  "onUpdate:modelValue": c[2] || (c[2] = (x) => s.value = x),
955
- width: "30%"
955
+ width: "30%",
956
+ "append-to-body": ""
956
957
  }, {
957
958
  footer: N(() => [
958
959
  A("span", null, [
@@ -2,4 +2,4 @@
2
2
  usage: app.provide(ID_INJECTION_KEY, {
3
3
  prefix: number,
4
4
  current: number,
5
- })`);const a=u.useGetDerivedNamespace();return x.computedEager(()=>e.unref(t)||`${a.value}-id-${n.prefix}-${n.current++}`)},Y=Symbol("formContextKey"),be=Symbol("formItemContextKey"),Dt=()=>{const t=e.inject(Y,void 0),n=e.inject(be,void 0);return{form:t,formItem:n}},Rt=(t,{formItemContext:n,disableIdGeneration:a,disableIdManagement:o})=>{a||(a=e.ref(!1)),o||(o=e.ref(!1));const i=e.getCurrentInstance(),s=()=>{let p=i?.parent;for(;p;){if(p.type.name==="ElFormItem")return!1;if(p.type.name==="ElLabelWrap")return!0;p=p.parent}return!1},l=e.ref();let c;const m=e.computed(()=>{var p;return!!(!(t.label||t.ariaLabel)&&n&&n.inputIds&&((p=n.inputIds)==null?void 0:p.length)<=1)});return e.onMounted(()=>{c=e.watch([e.toRef(t,"id"),a],([p,v])=>{const b=p??(v?void 0:$t().value);b!==l.value&&(n?.removeInputId&&!s()&&(l.value&&n.removeInputId(l.value),!o?.value&&!v&&b&&n.addInputId(b)),l.value=b)},{immediate:!0})}),e.onUnmounted(()=>{c&&c(),n?.removeInputId&&l.value&&n.removeInputId(l.value)}),{isLabeledByFormItem:m,inputId:l}},Ce=t=>{const n=e.getCurrentInstance();return e.computed(()=>{var a,o;return(o=(a=n?.proxy)==null?void 0:a.$props)==null?void 0:o[t]})},Kt=(t,n={})=>{const a=e.ref(void 0),o=n.prop?a:Ce("size"),i=n.global?a:u.useGlobalSize(),s=n.form?{size:void 0}:e.inject(Y,void 0),l=n.formItem?{size:void 0}:e.inject(be,void 0);return e.computed(()=>o.value||e.unref(t)||l?.size||s?.size||i.value||"")},Ht=t=>{const n=Ce("disabled"),a=e.inject(Y,void 0);return e.computed(()=>{var o,i,s;return(s=(i=(o=n.value)!=null?o:e.unref(t))!=null?i:a?.disabled)!=null?s:!1})},Ut=t=>{if(t.tabIndex>0||t.tabIndex===0&&t.getAttribute("tabIndex")!==null)return!0;if(t.tabIndex<0||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true")return!1;switch(t.nodeName){case"A":return!!t.href&&t.rel!=="ignore";case"INPUT":return!(t.type==="hidden"||t.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}};function jt(t,{disabled:n,beforeFocus:a,afterFocus:o,beforeBlur:i,afterBlur:s}={}){const l=e.getCurrentInstance(),{emit:c}=l,m=e.shallowRef(),p=e.ref(!1),v=d=>{const f=u.isFunction(a)?a(d):!1;e.unref(n)||p.value||f||(p.value=!0,c("focus",d),o?.())},b=d=>{var f;const C=u.isFunction(i)?i(d):!1;e.unref(n)||d.relatedTarget&&((f=m.value)!=null&&f.contains(d.relatedTarget))||C||(p.value=!1,c("blur",d),s?.())},g=d=>{var f,C;e.unref(n)||Ut(d.target)||(f=m.value)!=null&&f.contains(document.activeElement)&&m.value!==document.activeElement||(C=t.value)==null||C.focus()};return e.watch([m,()=>e.unref(n)],([d,f])=>{d&&(f?d.removeAttribute("tabindex"):d.setAttribute("tabindex","-1"))}),x.useEventListener(m,"focus",v,!0),x.useEventListener(m,"blur",b,!0),x.useEventListener(m,"click",g,!0),typeof process<"u"&&process.env.NODE_ENV==="test"&&e.onMounted(()=>{const d=u.isElement(t.value)?t.value:document.querySelector("input,textarea");d&&(x.useEventListener(d,"focus",v,!0),x.useEventListener(d,"blur",b,!0))}),{isFocused:p,wrapperRef:m,handleFocus:v,handleBlur:b}}const Wt=t=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(t);function qt({afterComposition:t,emit:n}){const a=e.ref(!1),o=c=>{n?.("compositionstart",c),a.value=!0},i=c=>{var m;n?.("compositionupdate",c);const p=(m=c.target)==null?void 0:m.value,v=p[p.length-1]||"";a.value=!Wt(v)},s=c=>{n?.("compositionend",c),a.value&&(a.value=!1,e.nextTick(()=>t(c)))};return{isComposing:a,handleComposition:c=>{c.type==="compositionend"?s(c):i(c)},handleCompositionStart:o,handleCompositionUpdate:i,handleCompositionEnd:s}}function Xt(t){let n;function a(){if(t.value==null)return;const{selectionStart:i,selectionEnd:s,value:l}=t.value;if(i==null||s==null)return;const c=l.slice(0,Math.max(0,i)),m=l.slice(Math.max(0,s));n={selectionStart:i,selectionEnd:s,value:l,beforeTxt:c,afterTxt:m}}function o(){if(t.value==null||n==null)return;const{value:i}=t.value,{beforeTxt:s,afterTxt:l,selectionStart:c}=n;if(s==null||l==null||c==null)return;let m=i.length;if(i.endsWith(l))m=i.length-l.length;else if(i.startsWith(s))m=s.length;else{const p=s[c-1],v=i.indexOf(p,c-1);v!==-1&&(m=v+1)}t.value.setSelectionRange(m,m)}return[a,o]}const we="ElInput",Yt=e.defineComponent({name:we,inheritAttrs:!1}),Gt=e.defineComponent({...Yt,props:Bt,emits:Ot,setup(t,{expose:n,emit:a}){const o=t,i=e.useAttrs(),s=Mt(),l=e.useSlots(),c=e.computed(()=>[o.type==="textarea"?C.b():f.b(),f.m(g.value),f.is("disabled",d.value),f.is("exceed",ke.value),{[f.b("group")]:l.prepend||l.append,[f.m("prefix")]:l.prefix||o.prefixIcon,[f.m("suffix")]:l.suffix||o.suffixIcon||o.clearable||o.showPassword,[f.bm("suffix","password-clear")]:A.value&&H.value,[f.b("hidden")]:o.type==="hidden"},i.class]),m=e.computed(()=>[f.e("wrapper"),f.is("focus",K.value)]),{form:p,formItem:v}=Dt(),{inputId:b}=Rt(o,{formItemContext:v}),g=Kt(),d=Ht(),f=u.useNamespace("input"),C=u.useNamespace("textarea"),_=e.shallowRef(),S=e.shallowRef(),R=e.ref(!1),M=e.ref(!1),G=e.ref(),L=e.shallowRef(o.inputStyle),E=e.computed(()=>_.value||S.value),{wrapperRef:Ee,isFocused:K,handleFocus:Ne,handleBlur:xe}=jt(E,{disabled:d,afterBlur(){var r;o.validateEvent&&((r=v?.validate)==null||r.call(v,"blur").catch(h=>u.debugWarn(h)))}}),J=e.computed(()=>{var r;return(r=p?.statusIcon)!=null?r:!1}),T=e.computed(()=>v?.validateState||""),Z=e.computed(()=>T.value&&xt[T.value]),Se=e.computed(()=>M.value?z.View:z.Hide),Ie=e.computed(()=>[i.style]),Q=e.computed(()=>[o.inputStyle,L.value,{resize:o.resize}]),I=e.computed(()=>vt(o.modelValue)?"":String(o.modelValue)),A=e.computed(()=>o.clearable&&!d.value&&!o.readonly&&!!I.value&&(K.value||R.value)),H=e.computed(()=>o.showPassword&&!d.value&&!!I.value),k=e.computed(()=>o.showWordLimit&&!!o.maxlength&&(o.type==="text"||o.type==="textarea")&&!d.value&&!o.readonly&&!o.showPassword),U=e.computed(()=>I.value.length),ke=e.computed(()=>!!k.value&&U.value>Number(o.maxlength)),Pe=e.computed(()=>!!l.suffix||!!o.suffixIcon||A.value||o.showPassword||k.value||!!T.value&&J.value),Ve=e.computed(()=>!!Object.keys(o.modelModifiers).length),[ze,Te]=Xt(_);x.useResizeObserver(S,r=>{if(Be(),!k.value||o.resize!=="both"&&o.resize!=="horizontal")return;const h=r[0],{width:y}=h.contentRect;G.value={right:`calc(100% - ${y+22-10}px)`}});const B=()=>{const{type:r,autosize:h}=o;if(!(!x.isClient||r!=="textarea"||!S.value))if(h){const y=u.isObject(h)?h.minRows:void 0,V=u.isObject(h)?h.maxRows:void 0,O=pe(S.value,y,V);L.value={overflowY:"hidden",...O},e.nextTick(()=>{S.value.offsetHeight,L.value=O})}else L.value={minHeight:pe(S.value).minHeight}},Be=(r=>{let h=!1;return()=>{var y;if(h||!o.autosize)return;((y=S.value)==null?void 0:y.offsetParent)===null||(setTimeout(r),h=!0)}})(B),P=()=>{const r=E.value,h=o.formatter?o.formatter(I.value):I.value;!r||r.value===h||o.type==="file"||(r.value=h)},ee=r=>{const{trim:h,number:y}=o.modelModifiers;return h&&(r=r.trim()),y&&(r=`${fe(r)}`),o.formatter&&o.parser&&(r=o.parser(r)),r},j=async r=>{if(ne.value)return;const{lazy:h}=o.modelModifiers;let{value:y}=r.target;if(h){a(W,y);return}if(y=ee(y),String(y)===I.value){o.formatter&&P();return}ze(),a($,y),a(W,y),await e.nextTick(),(o.formatter&&o.parser||!Ve.value)&&P(),Te()},te=async r=>{let{value:h}=r.target;h=ee(h),o.modelModifiers.lazy&&a($,h),a(de,h,r),await e.nextTick(),P()},{isComposing:ne,handleCompositionStart:oe,handleCompositionUpdate:re,handleCompositionEnd:ae}=qt({emit:a,afterComposition:j}),Oe=()=>{M.value=!M.value},Fe=()=>{var r;return(r=E.value)==null?void 0:r.focus()},_e=()=>{var r;return(r=E.value)==null?void 0:r.blur()},Me=r=>{R.value=!1,a("mouseleave",r)},Le=r=>{R.value=!0,a("mouseenter",r)},ie=r=>{a("keydown",r)},Ae=()=>{var r;(r=E.value)==null||r.select()},se=()=>{a($,""),a(de,""),a("clear"),a(W,"")};return e.watch(()=>o.modelValue,()=>{var r;e.nextTick(()=>B()),o.validateEvent&&((r=v?.validate)==null||r.call(v,"change").catch(h=>u.debugWarn(h)))}),e.watch(I,r=>{if(!E.value)return;const{trim:h,number:y}=o.modelModifiers,V=E.value.value,O=(y||o.type==="number")&&!/^0\d/.test(V)?`${fe(V)}`:V;O!==r&&(document.activeElement===E.value&&E.value.type!=="range"&&h&&O.trim()===r||P())}),e.watch(()=>o.type,async()=>{await e.nextTick(),P(),B()}),e.onMounted(()=>{!o.formatter&&o.parser&&u.debugWarn(we,"If you set the parser, you also need to set the formatter."),P(),e.nextTick(B)}),n({input:_,textarea:S,ref:E,textareaStyle:Q,autosize:e.toRef(o,"autosize"),isComposing:ne,focus:Fe,blur:_e,select:Ae,clear:se,resizeTextarea:B}),(r,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(c),{[e.unref(f).bm("group","append")]:r.$slots.append,[e.unref(f).bm("group","prepend")]:r.$slots.prepend}]),style:e.normalizeStyle(e.unref(Ie)),onMouseenter:Le,onMouseleave:Me},[e.createCommentVNode(" input "),r.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createCommentVNode(" prepend slot "),r.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(f).be("group","prepend"))},[e.renderSlot(r.$slots,"prepend")],2)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"wrapperRef",ref:Ee,class:e.normalizeClass(e.unref(m))},[e.createCommentVNode(" prefix slot "),r.$slots.prefix||r.prefixIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(f).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(f).e("prefix-inner"))},[e.renderSlot(r.$slots,"prefix"),r.prefixIcon?(e.openBlock(),e.createBlock(e.unref(F),{key:0,class:e.normalizeClass(e.unref(f).e("icon"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.prefixIcon)))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(b),ref_key:"input",ref:_,class:e.unref(f).e("inner")},e.unref(s),{name:r.name,minlength:r.minlength,maxlength:r.maxlength,type:r.showPassword?M.value?"text":"password":r.type,disabled:e.unref(d),readonly:r.readonly,autocomplete:r.autocomplete,tabindex:r.tabindex,"aria-label":r.ariaLabel,placeholder:r.placeholder,style:r.inputStyle,form:r.form,autofocus:r.autofocus,role:r.containerRole,inputmode:r.inputmode,onCompositionstart:e.unref(oe),onCompositionupdate:e.unref(re),onCompositionend:e.unref(ae),onInput:j,onChange:te,onKeydown:ie}),null,16,["id","name","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","inputmode","onCompositionstart","onCompositionupdate","onCompositionend"]),e.createCommentVNode(" suffix slot "),e.unref(Pe)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(f).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(f).e("suffix-inner"))},[!e.unref(A)||!e.unref(H)||!e.unref(k)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(r.$slots,"suffix"),r.suffixIcon?(e.openBlock(),e.createBlock(e.unref(F),{key:0,class:e.normalizeClass(e.unref(f).e("icon"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.suffixIcon)))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],64)):e.createCommentVNode("v-if",!0),e.unref(A)?(e.openBlock(),e.createBlock(e.unref(F),{key:1,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("clear")]),onMousedown:e.withModifiers(e.unref(u.NOOP),["prevent"]),onClick:se},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.clearIcon)))]),_:1},8,["class","onMousedown"])):e.createCommentVNode("v-if",!0),e.unref(H)?(e.openBlock(),e.createBlock(e.unref(F),{key:2,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("password")]),onClick:Oe,onMousedown:e.withModifiers(e.unref(u.NOOP),["prevent"]),onMouseup:e.withModifiers(e.unref(u.NOOP),["prevent"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Se))))]),_:1},8,["class","onMousedown","onMouseup"])):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass([e.unref(f).e("count"),e.unref(f).is("outside",r.wordLimitPosition==="outside")])},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(f).e("count-inner"))},e.toDisplayString(e.unref(U))+" / "+e.toDisplayString(r.maxlength),3)],2)):e.createCommentVNode("v-if",!0),e.unref(T)&&e.unref(Z)&&e.unref(J)?(e.openBlock(),e.createBlock(e.unref(F),{key:4,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("validateIcon"),e.unref(f).is("loading",e.unref(T)==="validating")])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Z))))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0)],2),e.createCommentVNode(" append slot "),r.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(f).be("group","append"))},[e.renderSlot(r.$slots,"append")],2)):e.createCommentVNode("v-if",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createCommentVNode(" textarea "),e.createElementVNode("textarea",e.mergeProps({id:e.unref(b),ref_key:"textarea",ref:S,class:[e.unref(C).e("inner"),e.unref(f).is("focus",e.unref(K))]},e.unref(s),{name:r.name,minlength:r.minlength,maxlength:r.maxlength,tabindex:r.tabindex,disabled:e.unref(d),readonly:r.readonly,autocomplete:r.autocomplete,style:e.unref(Q),"aria-label":r.ariaLabel,placeholder:r.placeholder,form:r.form,autofocus:r.autofocus,rows:r.rows,role:r.containerRole,onCompositionstart:e.unref(oe),onCompositionupdate:e.unref(re),onCompositionend:e.unref(ae),onInput:j,onFocus:e.unref(Ne),onBlur:e.unref(xe),onChange:te,onKeydown:ie}),null,16,["id","name","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role","onCompositionstart","onCompositionupdate","onCompositionend","onFocus","onBlur"]),e.unref(k)?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(G.value),class:e.normalizeClass([e.unref(f).e("count"),e.unref(f).is("outside",r.wordLimitPosition==="outside")])},e.toDisplayString(e.unref(U))+" / "+e.toDisplayString(r.maxlength),7)):e.createCommentVNode("v-if",!0)],64))],38))}});var Jt=ge(Gt,[["__file","input.vue"]]);const Zt=ye(Jt),Qt=e.defineComponent({__name:"ReplaceSpeciesNameDialog",emits:["closed"],setup(t,{expose:n,emit:a}){const o=e.inject($e.apiRowDataOptionsKey),i=e.ref(!1),s=e.reactive({speciesName:""}),l=e.ref(!1),c=e.ref(""),m=e.ref([]),p=a,v=async()=>{if(s.speciesName==""){N.ElMessage.error("请输入新的物种名称");return}if(l.value=!0,o){for(let d=0;d<m.value.length;d++)if(m.value[d].speciesName!=s.speciesName){var g=Object.assign({},m.value[d],{speciesName:s.speciesName});await o([g])}N.ElMessage.success("替换成功"),p("closed")}else N.ElMessage.warning("该调查不支持替换");l.value=!1,i.value=!1,s.speciesName=""};return n({showDialog:(g,d)=>{if(d[0].speciesName==null){N.ElMessage.warning("该调查不支持替换");return}c.value=g,i.value=!0,m.value=d}}),(g,d)=>{const f=Zt;return e.openBlock(),e.createBlock(e.unref(N.ElDialog),{center:"",title:"物种名称替换",modelValue:i.value,"onUpdate:modelValue":d[2]||(d[2]=C=>i.value=C),width:"30%"},{footer:e.withCtx(()=>[e.createElementVNode("span",null,[e.createVNode(e.unref(N.ElButton),{onClick:d[1]||(d[1]=C=>i.value=!1)},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(N.ElButton),{loading:l.value,type:"primary",onClick:v,plain:""},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("确定",-1)])]),_:1},8,["loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(N.ElForm),{model:s,"label-width":"150px",inline:!1},{default:e.withCtx(()=>[e.createVNode(e.unref(N.ElFormItem),{label:"原物种名称:"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.map(C=>C.speciesName).join(",")),1)]),_:1}),e.createVNode(e.unref(N.ElFormItem),{label:"新的物名称:"},{default:e.withCtx(()=>[e.createVNode(f,{modelValue:s.speciesName,"onUpdate:modelValue":d[0]||(d[0]=C=>s.speciesName=C)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}});exports._sfc_main=Qt;
5
+ })`);const a=u.useGetDerivedNamespace();return x.computedEager(()=>e.unref(t)||`${a.value}-id-${n.prefix}-${n.current++}`)},Y=Symbol("formContextKey"),be=Symbol("formItemContextKey"),Dt=()=>{const t=e.inject(Y,void 0),n=e.inject(be,void 0);return{form:t,formItem:n}},Rt=(t,{formItemContext:n,disableIdGeneration:a,disableIdManagement:o})=>{a||(a=e.ref(!1)),o||(o=e.ref(!1));const i=e.getCurrentInstance(),s=()=>{let p=i?.parent;for(;p;){if(p.type.name==="ElFormItem")return!1;if(p.type.name==="ElLabelWrap")return!0;p=p.parent}return!1},l=e.ref();let c;const m=e.computed(()=>{var p;return!!(!(t.label||t.ariaLabel)&&n&&n.inputIds&&((p=n.inputIds)==null?void 0:p.length)<=1)});return e.onMounted(()=>{c=e.watch([e.toRef(t,"id"),a],([p,v])=>{const b=p??(v?void 0:$t().value);b!==l.value&&(n?.removeInputId&&!s()&&(l.value&&n.removeInputId(l.value),!o?.value&&!v&&b&&n.addInputId(b)),l.value=b)},{immediate:!0})}),e.onUnmounted(()=>{c&&c(),n?.removeInputId&&l.value&&n.removeInputId(l.value)}),{isLabeledByFormItem:m,inputId:l}},Ce=t=>{const n=e.getCurrentInstance();return e.computed(()=>{var a,o;return(o=(a=n?.proxy)==null?void 0:a.$props)==null?void 0:o[t]})},Kt=(t,n={})=>{const a=e.ref(void 0),o=n.prop?a:Ce("size"),i=n.global?a:u.useGlobalSize(),s=n.form?{size:void 0}:e.inject(Y,void 0),l=n.formItem?{size:void 0}:e.inject(be,void 0);return e.computed(()=>o.value||e.unref(t)||l?.size||s?.size||i.value||"")},Ht=t=>{const n=Ce("disabled"),a=e.inject(Y,void 0);return e.computed(()=>{var o,i,s;return(s=(i=(o=n.value)!=null?o:e.unref(t))!=null?i:a?.disabled)!=null?s:!1})},Ut=t=>{if(t.tabIndex>0||t.tabIndex===0&&t.getAttribute("tabIndex")!==null)return!0;if(t.tabIndex<0||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true")return!1;switch(t.nodeName){case"A":return!!t.href&&t.rel!=="ignore";case"INPUT":return!(t.type==="hidden"||t.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}};function jt(t,{disabled:n,beforeFocus:a,afterFocus:o,beforeBlur:i,afterBlur:s}={}){const l=e.getCurrentInstance(),{emit:c}=l,m=e.shallowRef(),p=e.ref(!1),v=d=>{const f=u.isFunction(a)?a(d):!1;e.unref(n)||p.value||f||(p.value=!0,c("focus",d),o?.())},b=d=>{var f;const C=u.isFunction(i)?i(d):!1;e.unref(n)||d.relatedTarget&&((f=m.value)!=null&&f.contains(d.relatedTarget))||C||(p.value=!1,c("blur",d),s?.())},g=d=>{var f,C;e.unref(n)||Ut(d.target)||(f=m.value)!=null&&f.contains(document.activeElement)&&m.value!==document.activeElement||(C=t.value)==null||C.focus()};return e.watch([m,()=>e.unref(n)],([d,f])=>{d&&(f?d.removeAttribute("tabindex"):d.setAttribute("tabindex","-1"))}),x.useEventListener(m,"focus",v,!0),x.useEventListener(m,"blur",b,!0),x.useEventListener(m,"click",g,!0),typeof process<"u"&&process.env.NODE_ENV==="test"&&e.onMounted(()=>{const d=u.isElement(t.value)?t.value:document.querySelector("input,textarea");d&&(x.useEventListener(d,"focus",v,!0),x.useEventListener(d,"blur",b,!0))}),{isFocused:p,wrapperRef:m,handleFocus:v,handleBlur:b}}const Wt=t=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(t);function qt({afterComposition:t,emit:n}){const a=e.ref(!1),o=c=>{n?.("compositionstart",c),a.value=!0},i=c=>{var m;n?.("compositionupdate",c);const p=(m=c.target)==null?void 0:m.value,v=p[p.length-1]||"";a.value=!Wt(v)},s=c=>{n?.("compositionend",c),a.value&&(a.value=!1,e.nextTick(()=>t(c)))};return{isComposing:a,handleComposition:c=>{c.type==="compositionend"?s(c):i(c)},handleCompositionStart:o,handleCompositionUpdate:i,handleCompositionEnd:s}}function Xt(t){let n;function a(){if(t.value==null)return;const{selectionStart:i,selectionEnd:s,value:l}=t.value;if(i==null||s==null)return;const c=l.slice(0,Math.max(0,i)),m=l.slice(Math.max(0,s));n={selectionStart:i,selectionEnd:s,value:l,beforeTxt:c,afterTxt:m}}function o(){if(t.value==null||n==null)return;const{value:i}=t.value,{beforeTxt:s,afterTxt:l,selectionStart:c}=n;if(s==null||l==null||c==null)return;let m=i.length;if(i.endsWith(l))m=i.length-l.length;else if(i.startsWith(s))m=s.length;else{const p=s[c-1],v=i.indexOf(p,c-1);v!==-1&&(m=v+1)}t.value.setSelectionRange(m,m)}return[a,o]}const we="ElInput",Yt=e.defineComponent({name:we,inheritAttrs:!1}),Gt=e.defineComponent({...Yt,props:Bt,emits:Ot,setup(t,{expose:n,emit:a}){const o=t,i=e.useAttrs(),s=Mt(),l=e.useSlots(),c=e.computed(()=>[o.type==="textarea"?C.b():f.b(),f.m(g.value),f.is("disabled",d.value),f.is("exceed",ke.value),{[f.b("group")]:l.prepend||l.append,[f.m("prefix")]:l.prefix||o.prefixIcon,[f.m("suffix")]:l.suffix||o.suffixIcon||o.clearable||o.showPassword,[f.bm("suffix","password-clear")]:A.value&&H.value,[f.b("hidden")]:o.type==="hidden"},i.class]),m=e.computed(()=>[f.e("wrapper"),f.is("focus",K.value)]),{form:p,formItem:v}=Dt(),{inputId:b}=Rt(o,{formItemContext:v}),g=Kt(),d=Ht(),f=u.useNamespace("input"),C=u.useNamespace("textarea"),_=e.shallowRef(),S=e.shallowRef(),R=e.ref(!1),M=e.ref(!1),G=e.ref(),L=e.shallowRef(o.inputStyle),E=e.computed(()=>_.value||S.value),{wrapperRef:Ee,isFocused:K,handleFocus:Ne,handleBlur:xe}=jt(E,{disabled:d,afterBlur(){var r;o.validateEvent&&((r=v?.validate)==null||r.call(v,"blur").catch(h=>u.debugWarn(h)))}}),J=e.computed(()=>{var r;return(r=p?.statusIcon)!=null?r:!1}),T=e.computed(()=>v?.validateState||""),Z=e.computed(()=>T.value&&xt[T.value]),Se=e.computed(()=>M.value?z.View:z.Hide),Ie=e.computed(()=>[i.style]),Q=e.computed(()=>[o.inputStyle,L.value,{resize:o.resize}]),I=e.computed(()=>vt(o.modelValue)?"":String(o.modelValue)),A=e.computed(()=>o.clearable&&!d.value&&!o.readonly&&!!I.value&&(K.value||R.value)),H=e.computed(()=>o.showPassword&&!d.value&&!!I.value),k=e.computed(()=>o.showWordLimit&&!!o.maxlength&&(o.type==="text"||o.type==="textarea")&&!d.value&&!o.readonly&&!o.showPassword),U=e.computed(()=>I.value.length),ke=e.computed(()=>!!k.value&&U.value>Number(o.maxlength)),Pe=e.computed(()=>!!l.suffix||!!o.suffixIcon||A.value||o.showPassword||k.value||!!T.value&&J.value),Ve=e.computed(()=>!!Object.keys(o.modelModifiers).length),[ze,Te]=Xt(_);x.useResizeObserver(S,r=>{if(Be(),!k.value||o.resize!=="both"&&o.resize!=="horizontal")return;const h=r[0],{width:y}=h.contentRect;G.value={right:`calc(100% - ${y+22-10}px)`}});const B=()=>{const{type:r,autosize:h}=o;if(!(!x.isClient||r!=="textarea"||!S.value))if(h){const y=u.isObject(h)?h.minRows:void 0,V=u.isObject(h)?h.maxRows:void 0,O=pe(S.value,y,V);L.value={overflowY:"hidden",...O},e.nextTick(()=>{S.value.offsetHeight,L.value=O})}else L.value={minHeight:pe(S.value).minHeight}},Be=(r=>{let h=!1;return()=>{var y;if(h||!o.autosize)return;((y=S.value)==null?void 0:y.offsetParent)===null||(setTimeout(r),h=!0)}})(B),P=()=>{const r=E.value,h=o.formatter?o.formatter(I.value):I.value;!r||r.value===h||o.type==="file"||(r.value=h)},ee=r=>{const{trim:h,number:y}=o.modelModifiers;return h&&(r=r.trim()),y&&(r=`${fe(r)}`),o.formatter&&o.parser&&(r=o.parser(r)),r},j=async r=>{if(ne.value)return;const{lazy:h}=o.modelModifiers;let{value:y}=r.target;if(h){a(W,y);return}if(y=ee(y),String(y)===I.value){o.formatter&&P();return}ze(),a($,y),a(W,y),await e.nextTick(),(o.formatter&&o.parser||!Ve.value)&&P(),Te()},te=async r=>{let{value:h}=r.target;h=ee(h),o.modelModifiers.lazy&&a($,h),a(de,h,r),await e.nextTick(),P()},{isComposing:ne,handleCompositionStart:oe,handleCompositionUpdate:re,handleCompositionEnd:ae}=qt({emit:a,afterComposition:j}),Oe=()=>{M.value=!M.value},Fe=()=>{var r;return(r=E.value)==null?void 0:r.focus()},_e=()=>{var r;return(r=E.value)==null?void 0:r.blur()},Me=r=>{R.value=!1,a("mouseleave",r)},Le=r=>{R.value=!0,a("mouseenter",r)},ie=r=>{a("keydown",r)},Ae=()=>{var r;(r=E.value)==null||r.select()},se=()=>{a($,""),a(de,""),a("clear"),a(W,"")};return e.watch(()=>o.modelValue,()=>{var r;e.nextTick(()=>B()),o.validateEvent&&((r=v?.validate)==null||r.call(v,"change").catch(h=>u.debugWarn(h)))}),e.watch(I,r=>{if(!E.value)return;const{trim:h,number:y}=o.modelModifiers,V=E.value.value,O=(y||o.type==="number")&&!/^0\d/.test(V)?`${fe(V)}`:V;O!==r&&(document.activeElement===E.value&&E.value.type!=="range"&&h&&O.trim()===r||P())}),e.watch(()=>o.type,async()=>{await e.nextTick(),P(),B()}),e.onMounted(()=>{!o.formatter&&o.parser&&u.debugWarn(we,"If you set the parser, you also need to set the formatter."),P(),e.nextTick(B)}),n({input:_,textarea:S,ref:E,textareaStyle:Q,autosize:e.toRef(o,"autosize"),isComposing:ne,focus:Fe,blur:_e,select:Ae,clear:se,resizeTextarea:B}),(r,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(c),{[e.unref(f).bm("group","append")]:r.$slots.append,[e.unref(f).bm("group","prepend")]:r.$slots.prepend}]),style:e.normalizeStyle(e.unref(Ie)),onMouseenter:Le,onMouseleave:Me},[e.createCommentVNode(" input "),r.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createCommentVNode(" prepend slot "),r.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(f).be("group","prepend"))},[e.renderSlot(r.$slots,"prepend")],2)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"wrapperRef",ref:Ee,class:e.normalizeClass(e.unref(m))},[e.createCommentVNode(" prefix slot "),r.$slots.prefix||r.prefixIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(f).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(f).e("prefix-inner"))},[e.renderSlot(r.$slots,"prefix"),r.prefixIcon?(e.openBlock(),e.createBlock(e.unref(F),{key:0,class:e.normalizeClass(e.unref(f).e("icon"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.prefixIcon)))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(b),ref_key:"input",ref:_,class:e.unref(f).e("inner")},e.unref(s),{name:r.name,minlength:r.minlength,maxlength:r.maxlength,type:r.showPassword?M.value?"text":"password":r.type,disabled:e.unref(d),readonly:r.readonly,autocomplete:r.autocomplete,tabindex:r.tabindex,"aria-label":r.ariaLabel,placeholder:r.placeholder,style:r.inputStyle,form:r.form,autofocus:r.autofocus,role:r.containerRole,inputmode:r.inputmode,onCompositionstart:e.unref(oe),onCompositionupdate:e.unref(re),onCompositionend:e.unref(ae),onInput:j,onChange:te,onKeydown:ie}),null,16,["id","name","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","inputmode","onCompositionstart","onCompositionupdate","onCompositionend"]),e.createCommentVNode(" suffix slot "),e.unref(Pe)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(f).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(f).e("suffix-inner"))},[!e.unref(A)||!e.unref(H)||!e.unref(k)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(r.$slots,"suffix"),r.suffixIcon?(e.openBlock(),e.createBlock(e.unref(F),{key:0,class:e.normalizeClass(e.unref(f).e("icon"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.suffixIcon)))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],64)):e.createCommentVNode("v-if",!0),e.unref(A)?(e.openBlock(),e.createBlock(e.unref(F),{key:1,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("clear")]),onMousedown:e.withModifiers(e.unref(u.NOOP),["prevent"]),onClick:se},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.clearIcon)))]),_:1},8,["class","onMousedown"])):e.createCommentVNode("v-if",!0),e.unref(H)?(e.openBlock(),e.createBlock(e.unref(F),{key:2,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("password")]),onClick:Oe,onMousedown:e.withModifiers(e.unref(u.NOOP),["prevent"]),onMouseup:e.withModifiers(e.unref(u.NOOP),["prevent"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Se))))]),_:1},8,["class","onMousedown","onMouseup"])):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass([e.unref(f).e("count"),e.unref(f).is("outside",r.wordLimitPosition==="outside")])},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(f).e("count-inner"))},e.toDisplayString(e.unref(U))+" / "+e.toDisplayString(r.maxlength),3)],2)):e.createCommentVNode("v-if",!0),e.unref(T)&&e.unref(Z)&&e.unref(J)?(e.openBlock(),e.createBlock(e.unref(F),{key:4,class:e.normalizeClass([e.unref(f).e("icon"),e.unref(f).e("validateIcon"),e.unref(f).is("loading",e.unref(T)==="validating")])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Z))))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0)],2),e.createCommentVNode(" append slot "),r.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(f).be("group","append"))},[e.renderSlot(r.$slots,"append")],2)):e.createCommentVNode("v-if",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createCommentVNode(" textarea "),e.createElementVNode("textarea",e.mergeProps({id:e.unref(b),ref_key:"textarea",ref:S,class:[e.unref(C).e("inner"),e.unref(f).is("focus",e.unref(K))]},e.unref(s),{name:r.name,minlength:r.minlength,maxlength:r.maxlength,tabindex:r.tabindex,disabled:e.unref(d),readonly:r.readonly,autocomplete:r.autocomplete,style:e.unref(Q),"aria-label":r.ariaLabel,placeholder:r.placeholder,form:r.form,autofocus:r.autofocus,rows:r.rows,role:r.containerRole,onCompositionstart:e.unref(oe),onCompositionupdate:e.unref(re),onCompositionend:e.unref(ae),onInput:j,onFocus:e.unref(Ne),onBlur:e.unref(xe),onChange:te,onKeydown:ie}),null,16,["id","name","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role","onCompositionstart","onCompositionupdate","onCompositionend","onFocus","onBlur"]),e.unref(k)?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(G.value),class:e.normalizeClass([e.unref(f).e("count"),e.unref(f).is("outside",r.wordLimitPosition==="outside")])},e.toDisplayString(e.unref(U))+" / "+e.toDisplayString(r.maxlength),7)):e.createCommentVNode("v-if",!0)],64))],38))}});var Jt=ge(Gt,[["__file","input.vue"]]);const Zt=ye(Jt),Qt=e.defineComponent({__name:"ReplaceSpeciesNameDialog",emits:["closed"],setup(t,{expose:n,emit:a}){const o=e.inject($e.apiRowDataOptionsKey),i=e.ref(!1),s=e.reactive({speciesName:""}),l=e.ref(!1),c=e.ref(""),m=e.ref([]),p=a,v=async()=>{if(s.speciesName==""){N.ElMessage.error("请输入新的物种名称");return}if(l.value=!0,o){for(let d=0;d<m.value.length;d++)if(m.value[d].speciesName!=s.speciesName){var g=Object.assign({},m.value[d],{speciesName:s.speciesName});await o([g])}N.ElMessage.success("替换成功"),p("closed")}else N.ElMessage.warning("该调查不支持替换");l.value=!1,i.value=!1,s.speciesName=""};return n({showDialog:(g,d)=>{if(d[0].speciesName==null){N.ElMessage.warning("该调查不支持替换");return}c.value=g,i.value=!0,m.value=d}}),(g,d)=>{const f=Zt;return e.openBlock(),e.createBlock(e.unref(N.ElDialog),{center:"",title:"物种名称替换",modelValue:i.value,"onUpdate:modelValue":d[2]||(d[2]=C=>i.value=C),width:"30%","append-to-body":""},{footer:e.withCtx(()=>[e.createElementVNode("span",null,[e.createVNode(e.unref(N.ElButton),{onClick:d[1]||(d[1]=C=>i.value=!1)},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(N.ElButton),{loading:l.value,type:"primary",onClick:v,plain:""},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("确定",-1)])]),_:1},8,["loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(N.ElForm),{model:s,"label-width":"150px",inline:!1},{default:e.withCtx(()=>[e.createVNode(e.unref(N.ElFormItem),{label:"原物种名称:"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.map(C=>C.speciesName).join(",")),1)]),_:1}),e.createVNode(e.unref(N.ElFormItem),{label:"新的物名称:"},{default:e.withCtx(()=>[e.createVNode(f,{modelValue:s.speciesName,"onUpdate:modelValue":d[0]||(d[0]=C=>s.speciesName=C)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}});exports._sfc_main=Qt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CreateData.vue_vue_type_script_setup_true_lang-CJPUwPxC.js");exports.default=e._sfc_main;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CreateData.vue_vue_type_script_setup_true_lang-DZJuz1uU.js");exports.default=e._sfc_main;