var k=(n,e,t)=>new Promise((l,d)=>{var m=i=>{try{u(t.next(i))}catch(s){d(s)}},r=i=>{try{u(t.throw(i))}catch(s){d(s)}},u=i=>i.done?l(i.value):Promise.resolve(i.value).then(m,r);u((t=t.apply(n,e)).next())});import{_ as M,d as V,r as j,z as B,f as C,g as N,n as A,w as b,e as x,h as q,A as D,J as O,L as z,b as Q,i as R}from"./index.2f2d2ba5.js";function I(n,e){n=n.replace(/=/g,"");var t=[];switch(e.constructor){case String:case Number:case Boolean:t.push(encodeURIComponent(n)+"="+encodeURIComponent(e));break;case Array:e.forEach(function(l){t=t.concat(I(n+"[]=",l))});break;case Object:Object.keys(e).forEach(function(l){var d=e[l];t=t.concat(I(n+"["+l+"]",d))})}return t}function $(n){var e=[];return n.forEach(function(t){typeof t=="string"?e.push(t):e=e.concat($(t))}),e}function T(n,e,t){if(e===void 0&&(e={}),typeof n!="string")throw new Error('[Vue-jsonp] Type of param "url" is not string.');if(typeof e!="object"||!e)throw new Error("[Vue-jsonp] Invalid params, should be an object.");return t=typeof t=="number"?t:5e3,new Promise(function(l,d){var m=typeof e.callbackQuery=="string"?e.callbackQuery:"callback",r=typeof e.callbackName=="string"?e.callbackName:"jsonp_"+(Math.floor(1e5*Math.random())*Date.now()).toString(16);e[m]=r,delete e.callbackQuery,delete e.callbackName;var u=[];Object.keys(e).forEach(function(f){u=u.concat(I(f,e[f]))});var i=$(u).join("&"),s=function(){v(),clearTimeout(_),d({status:400,statusText:"Bad Request"})},v=function(){p.removeEventListener("error",s)},h=function(){document.body.removeChild(p),delete window[r]},_=null;t>-1&&(_=setTimeout(function(){v(),h(),d({statusText:"Request Timeout",status:408})},t)),window[r]=function(f){clearTimeout(_),v(),h(),l(f)};var p=document.createElement("script");p.addEventListener("error",s),p.src=n+(/\?/.test(n)?"&":"?")+i,document.body.appendChild(p)})}const U=n=>(O("data-v-fcaecf15"),n=n(),z(),n),F=U(()=>Q("div",{id:"map",class:"map"},null,-1)),G=q("\u786E\u5B9A"),H=q(" \u5173\u95ED "),Y=V({name:"queryAddressDialog"}),P=Object.assign(Y,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(n,{emit:e}){const t=n;let l,d;const{proxy:m}=R(),r=window.TMap,u="YYUBZ-IPZ35-HB4IL-ICGH3-ICY43-V2FCQ",i=j(""),s=j({}),v=a=>k(this,null,function*(){yield D();try{l=new r.Map("map",{center:a,zoom:15,mapStyleId:"style1"}),d=new r.MultiMarker({map:l,styles:{marker:new r.MarkerStyle({width:20,height:30,anchor:{x:10,y:30}})},geometries:[{position:a,id:"marker"}]}),l.on("click",h)}catch(o){console.error(o)}}),h=a=>{const o=+a.latLng.lat.toFixed(6),c=+a.latLng.lng.toFixed(6);s.value.longitude=c,s.value.latitude=o,L(o,c),d.geometries=[],d.updateGeometries([{id:"marker",position:new r.LatLng(o,c)}])},_=(a,o)=>{T("https://apis.map.qq.com/ws/place/v1/suggestion",{key:u,keyword:a,output:"jsonp"}).then(c=>{if(c.status===0){const g=c.data;o(g)}else m.$message.error(c.message)})},p=a=>{s.value.longitude=a.location.lng,s.value.latitude=a.location.lat,f(a.location.lat,a.location.lng),L(a.location.lat,a.location.lng)},f=(a,o)=>{l.setCenter(new r.LatLng(a,o)),d.updateGeometries([{id:"marker",position:new r.LatLng(a,o)}])},L=(a,o)=>{T("https://apis.map.qq.com/ws/geocoder/v1/?",{location:`${a},${o}`,key:u,output:"jsonp"}).then(c=>{if(c.status===0){const{adcode:g,city:w,province:y,district:E}=c.result.ad_info||{};s.value.regionCode=g,s.value.region=`${y}-${w}-${E}`,s.value.address=`${y}${w}${c.result.formatted_addresses.recommend}`}else m.$message.error(c.message)})},S=()=>{e("close",s.value)};return B(()=>t.visible,a=>k(this,null,function*(){if(!a)s.value={},i.value="",l&&l.destroy();else{s.value.addressType=t.data.addressType,s.value.id=t.data.id;const o=new r.LatLng(+t.data.lat,+t.data.lng);yield v(o)}})),(a,o)=>{const c=C("el-autocomplete"),g=C("el-button"),w=C("el-dialog");return N(),A(w,{"model-value":n.visible,title:"\u5730\u70B9\u67E5\u8BE2",width:"840px","destroy-on-close":"",onClose:o[2]||(o[2]=y=>e("close"))},{footer:b(()=>[x(g,{type:"primary",size:"small",onClick:S},{default:b(()=>[G]),_:1}),x(g,{type:"info",size:"small",onClick:o[1]||(o[1]=y=>e("close"))},{default:b(()=>[H]),_:1})]),default:b(()=>[x(c,{modelValue:i.value,"onUpdate:modelValue":o[0]||(o[0]=y=>i.value=y),"fetch-suggestions":_,placeholder:"\u8BF7\u8F93\u5165\u8BE6\u7EC6\u5730\u5740","trigger-on-focus":!1,"value-key":"title",class:"mb-16 w-full",onSelect:p},null,8,["modelValue"]),F]),_:1},8,["model-value"])}}}),K=M(P,[["__scopeId","data-v-fcaecf15"]]);export{K as default};
