PageSourceSearch

https://law.pharmacycouncil.org/_next/static/chunks/a018fedb0284e34c.js

js pharmacycouncil.org collected 2026-10-02 17:18:10 UTC 85,076 bytes, 5 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,29801,(e,t,r)=>{"use strict";t.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(a=n;0!=a--;)if(!e(t[a],r[a]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(a=n;0!=a--;)if(!Object.prototype.hasOwnProperty.call(r,s[a]))return!1;for(a=n;0!=a--;){var n,a,s,l=s[a];if(!e(t[l],r[l]))return!1}return!0}return t!=t&&r!=r}},34737,e=>{"use strict";let t;e.i(47167);var r,n=e.i(43476),a=e.i(71645),s=e.i(68834);let l={step:1,tipReportId:null,reportNo:"",formToken:"",honeypot:"",reporterInfo:{isAnonymous:!1,prefix:"",name:"",surname:"",phone:"",email:"",address:"",provinceId:null,districtId:null,subDistrictId:null,zipcode:""},pharmacyInfo:{name:"",address:"",provinceId:null,districtId:null,subDistrictId:null,zipcode:"",lat:null,lng:null,pharmacistKnown:!1,pharmacistName:"",pharmacistSurname:"",pharmacistLicenseNo:"",pharmacistStartTime:"",pharmacistEndTime:""}
1,tipInfo:{incidentDate:"",incidentTime:"",details:"",evidences:[],consentDisclosure:null}},i=(0,s.create)(e=>({...l,setStep:t=>e({step:t}),setTipReportId:t=>e({tipReportId:t}),setReportNo:t=>e({reportNo:t}),setFormToken:t=>e({formToken:t}),setHoneypot:t=>e({honeypot:t}),setReporterInfo:t=>e(e=>({reporterInfo:{...e.reporterInfo,...t}})),setPharmacyInfo:t=>e(e=>({pharmacyInfo:{...e.pharmacyInfo,...t}})),setTipDetails:t=>e(e=>({tipInfo:{...e.tipInfo,...t}})),addEvidence:t=>e(e=>({tipInfo:{...e.tipInfo,evidences:[...e.tipInfo.evidences,t]}})),removeEvidence:t=>e(e=>({tipInfo:{...e.tipInfo,evidences:e.tipInfo.evidences.filter(e=>e.id!==t)}})),reset:()=>e(l)}));var o=e.i(43531),d=e.i(75157),c=e.i(46932);let u=[{id:1,label:"ข้อมูลผู้ร้อง"},{id:2,label:"ข้อมูลร้านยา"},{id:3,label:"ข้อมูลเบาะแส"}];function m({currentStep:e}){return(0,n.jsxs)("div",{className:"w-full py-4 px-4 md:px-0",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between relative",children:[(0,n.jsx)("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-full h-1 bg-gray-200 rounded-full"}),(0,n.jsx)("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 h-1 bg-[#686805] rounded-full transition-all duration-500 ease-out",style:{width:`${(e-1)/(u.length-1)*100}%`}}),u.map((t,r)=>{let a=e>t.id?"completed":e===t.id?"current":"pending";return(0,n.jsxs)("div",{className:"flex flex-col items-center relative gap-2 z-10",children:[(0,n.jsx)(c.motion.div,{initial:!1,animate:{backgroundColor:"pending"===a?"#e5e7eb":"#686805",borderColor:"pending"===a?"#e5e7eb":"#686805",scale:"current"===a?1.1:1},transition:{duration:.3},className:(0,d.cn)("w-9 h-9 md:w-10 md:h-10 rounded-full flex items-center justify-center border-2","pending"===a&&"bg-gray-200 border-gray-200 text-gray-400","pending"!==a&&"bg-[#686805] border-[#686805] text-white shadow-md"),children:"completed"===a?(0,n.jsx)(o.Check,{className:"w-5 h-5 md:w-6 md:h-6 stroke-[3]"}):(0,n.jsx)("span",{className:"text-sm font-bold",children:r+1})}),(0,n.jsx)("span",{className:(0,d.cn)("text-xs md:text-sm font-medium transition-colors duration-300 absolute -bottom-8 w-28 text-center","pending"===a?"text-gray-400":"text-[#686805] font-bold"),children:t.label})]},t.id)})]}),(0,n.jsx)("div",{className:"h-8 md:h-6"})]})}var p=e.i(30607);function g(){let{reporterInfo:e,setReporterInfo:t,setStep:r}=i(),{provinces:s,districts:l,subDistricts:o,getDistricts:d,getSubDistricts:c}=(0,p.useLocations)(),[u,m]=(0,a.useState)({});return(0,a.useEffect)(()=>{e.provinceId&&d(e.provinceId),e.districtId&&c(e.districtId)},[]),(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"text-center mb-8",children:[(0,n.jsx)("h2",{className:"text-[28px] font-[900] text-slate-800",children:"แจ้งเบาะแสร้านยาแขวนป้าย"}),(0,n.jsx)("p",{className:"text-[15px] text-slate-500 max-w-xl mx-auto leading-relaxed mt-2",children:"กรุณากรอกข้อมูลให้ครบถ้วน เพื่อให้เจ้าหน้าที่สามารถดำเนินการตรวจสอบได้"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,n.jsxs)("label",{className:"flex flex-col items-center gap-3 cursor-pointer rounded-xl border-2 p-5 transition-all",style:{borderColor:e.isAnonymous?"#e5e7eb":"#686805",background:e.isAnonymous?"white":"#fafaf0"},children:[(0,n.jsx)("input",{type:"radio",name:"anonymous",className:"hidden",checked:!e.isAnonymous,onChange:()=>t({isAnonymous:!1})}),(0,n.jsx)("span",{className:"material-symbols-outlined text-4xl",style:{color:e.isAnonymous?"#9ca3af":"#686805"},children:"person"}),(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"font-bold text-slate-700",children:"ระบุตัวตน"}),(0,n.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"กรอกข้อมูลส่วนตัวเพื่อความสะดวกในการติดต่อกลับ"})]})]}),(0,n.jsxs)("label",{className:"flex flex-col items-center gap-3 cursor-pointer rounded-xl border-2 p-5 transition-all",style:{borderColor:e.isAnonymous?"#686805":"#e5e7eb",background:e.isAnonymous?"#fafaf0":"white"},children:[(0,n.jsx)("input",{type:"radio",name:"anonymous",className:"hidden",checked:e.isAnonymous,onChange:()=>t({isAnonymous:!0})}),(0,n.jsx)("span",{className:"material-symbols-outlined text-4xl",style:{color:e.isAnonymous?"#686805":"#9ca3af"},children:"visibility_off"}),(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"font-bold text-slate-700",children:"ไม่ระบุตัวตน"}),(0,n.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:"ปกปิดข้อมูลส่วนตัวของผู้แจ้งเบาะแส"})]})]})]}),!e.isAnonymous&&(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["คำนำหน้าชื่อ-นามสกุล ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 outline-none focus:ring-2 focus:ring-[#686805] ${u.prefix?"border-red-500":"border-gray-300"}`,value:e.prefix,onChange:e=>{t({prefix:e.target.value}),m(e=>({...e,prefix:""}))},children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),(0,n.jsx)("option",{value:"นาย",children:"นาย"}),(0,n.jsx)("option",{value:"นาง",children:"นาง"}),(0,n.jsx)("option",{value:"นางสาว",children:"นางสาว"}),(0,n.jsx)("option",{value:"ภก.",children:"ภก."}),(0,n.jsx)("option",{value:"ภญ.",children:"ภญ."})]}),u.prefix&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.prefix})]})}),(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["ชื่อภาษาไทย ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)("input",{type:"text",className:`w-full border rounded-lg p-2 text-slate-700 ${u.name?"border-red-500":"border-gray-300"}`,placeholder:"กรอกชื่อของคุณ",value:e.name,onChange:e=>{t({name:e.target.value}),m(e=>({...e,name:""}))}}),u.name&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.name})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["นามสกุลภาษาไทย ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)("input",{type:"text",className:`w-full border rounded-lg p-2 text-slate-700 ${u.surname?"border-red-500":"border-gray-300"}`,placeholder:"กรอกนามสกุลของคุณ",value:e.surname,onChange:e=>{t({surname:e.target.value}),m(e=>({...e,surname:""}))}}),u.surname&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.surname})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["เบอร์โทรศัพท์ที่ติดต่อได้ ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})," (10 หลัก)"]}
1),(0,n.jsx)("input",{type:"tel",maxLength:10,className:`w-full border rounded-lg p-2 text-slate-700 ${u.phone?"border-red-500":"border-gray-300"}`,placeholder:"กรอกเบอร์โทรศัพท์ของคุณ",value:e.phone,onChange:e=>{t({phone:e.target.value.replace(/\D/g,"")}),m(e=>({...e,phone:""}))}}),u.phone&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.phone})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"อีเมล"}),(0,n.jsx)("input",{type:"email",className:`w-full border rounded-lg p-2 text-slate-700 ${u.email?"border-red-500":"border-gray-300"}`,placeholder:"[email protected]",value:e.email,onChange:e=>{t({email:e.target.value}),m(e=>({...e,email:""}))}}),u.email&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.email})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["ที่อยู่ที่สามารถติดต่อได้ ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)("textarea",{rows:3,className:`w-full border rounded-lg p-2 text-slate-700 placeholder-gray-400 ${u.address?"border-red-500":"border-gray-300"}`,placeholder:"บ้านเลขที่ หมู่บ้าน ซอย ถนน...",value:e.address,onChange:e=>{t({address:e.target.value}),m(e=>({...e,address:""}))}}),u.address&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.address})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["จังหวัด ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 ${u.provinceId?"border-red-500":"border-gray-300"}`,value:e.provinceId||"",onChange:e=>{let r=parseInt(e.target.value);t({provinceId:r,districtId:null,subDistrictId:null,zipcode:""}),d(r),m(e=>({...e,provinceId:""}))},children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),s.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name_th},e.id))]}),u.provinceId&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.provinceId})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["อำเภอ/เขต ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 ${u.districtId?"border-red-500":"border-gray-300"}`,value:e.districtId||"",onChange:e=>{let r=parseInt(e.target.value);t({districtId:r,subDistrictId:null,zipcode:""}),c(r),m(e=>({...e,districtId:""}))},disabled:!e.provinceId,children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),l.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name_th},e.id))]}),u.districtId&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.districtId})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["ตำบล/แขวง ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 ${u.subDistrictId?"border-red-500":"border-gray-300"}`,value:e.subDistrictId||"",onChange:e=>{let r=parseInt(e.target.value),n=o.find(e=>e.id===r);t({subDistrictId:r,zipcode:n?.zip_code?String(n.zip_code):""}),m(e=>({...e,subDistrictId:""}))},disabled:!e.districtId,children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),o.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name_th},e.id))]}),u.subDistrictId&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.subDistrictId})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"รหัสไปรษณีย์"}),(0,n.jsx)("input",{type:"text",readOnly:!0,className:"w-full border border-gray-200 rounded-lg p-2 text-slate-700 bg-gray-50",value:e.zipcode})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-4",children:[(0,n.jsxs)("a",{href:"https://pharmacycouncil.org",className:"flex items-center gap-2 text-slate-500 hover:text-slate-800 text-sm",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"}),"กลับหน้าหลัก"]}),(0,n.jsxs)("button",{onClick:()=>{let t;if(e.isAnonymous)return void r(2);let n={};if(e.prefix||(n.prefix="กรุณาเลือกคำนำหน้า"),e.name||(n.name="กรุณากรอกชื่อ"),e.surname||(n.surname="กรุณากรอกนามสกุล"),e.phone?/^\d{10}$/.test(e.phone)||(n.phone="เบอร์โทรศัพท์ต้องเป็นตัวเลข 10 หลัก"):n.phone="กรุณากรอกเบอร์โทรศัพท์",e.email&&(t=e.email,!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))&&(n.email="รูปแบบอีเมลไม่ถูกต้อง"),e.address||(n.address="กรุณากรอกที่อยู่"),e.provinceId||(n.provinceId="กรุณาเลือกจังหวัด"),e.districtId||(n.districtId="กรุณาเลือกอำเภอ/เขต"),e.subDistrictId||(n.subDistrictId="กรุณาเลือกตำบล/แขวง"),Object.keys(n).length>0){m(n),document.querySelector(".error-message")?.scrollIntoView({behavior:"smooth",block:"center"});return}r(2)},className:"bg-[#686805] hover:bg-[#4d6403] text-white px-8 py-3 rounded-lg font-bold flex items-center gap-2 transition-all",children:["ยืนยัน",(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_forward"})]})]})]})}var h=e.i(74080),f=e.i(29801);function x(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function b(e,t,r,n){return new(r||(r=Promise))(function(a,s){function l(e){try{o(n.next(e))}catch(e){s(e)}}function i(e){try{o(n.throw(e))}catch(e){s(e)}}function o(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(l,i)}o((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let v=()=>{},y=!1;async function j(e){if(y||v("No options were set before calling importLibrary. Make sure to configure the loader using setOptions()."),!window?.google?.maps?.importLibrary)throw Error("google.maps.importLibrary is not installed.");return await google.maps.importLibrary(e)}let N="NOT_LOADED",w="LOADING",I="LOADED",C=["gmp_visgl_reactgooglemaps_v1.8.3"],E=a.default.createContext(null),k=N,O=new Set;
1function S(e){e!==k&&(k=e,O.forEach(e=>e(k)))}let D=e=>{let{children:r}=e,n=x(e,["children"]),{mapInstances:s,addMapInstance:l,removeMapInstance:i,clearMapInstances:o}=function(){let[e,t]=(0,a.useState)({});return{mapInstances:e,addMapInstance:(e,r="default")=>{t(t=>Object.assign(Object.assign({},t),{[r]:e}))},removeMapInstance:(e="default")=>{t(t=>(t[e],x(t,["symbol"==typeof e?e:e+""])))},clearMapInstances:()=>{t({})}}}(),{map3dInstances:d,addMap3DInstance:c,removeMap3DInstance:u,clearMap3DInstances:m}=function(){let[e,t]=(0,a.useState)({});return{map3dInstances:e,addMap3DInstance:(e,r="default")=>{t(t=>Object.assign(Object.assign({},t),{[r]:e}))},removeMap3DInstance:(e="default")=>{t(t=>(t[e],x(t,["symbol"==typeof e?e:e+""])))},clearMap3DInstances:()=>{t({})}}}(),{status:p,loadedLibraries:g,importLibrary:h}=function(e){let{onLoad:r,onError:n,apiKey:s,version:l,libraries:i=[],region:o,language:d,authReferrerPolicy:c,channel:u,solutionChannel:m,fetchAppCheckToken:p}=e,[g,h]=(0,a.useState)(k),[f,x]=(0,a.useReducer)((e,t)=>e[t.name]?e:Object.assign(Object.assign({},e),{[t.name]:t.value}),{}),N=(0,a.useMemo)(()=>JSON.stringify({apiKey:s,version:l,libraries:i.join(","),region:o,language:d,authReferrerPolicy:c,channel:u,solutionChannel:m}),[s,l,i,o,d,c,u,m]),C=(0,a.useCallback)(e=>b(this,void 0,void 0,function*(){if(f[e])return f[e];let t=yield j(e);return x({name:e,value:t}),t}),[f]);return(0,a.useEffect)(()=>(O.add(h),h(k),()=>{O.delete(h)}),[]),(0,a.useEffect)(()=>{b(this,void 0,void 0,function*(){var e,a;try{t&&t!==N&&console.warn("The Google Maps JavaScript API has already been loaded with different parameters. The new parameters will be ignored. If you need to use different parameters, please refresh the page.");let n=["core","maps",...i];if(null==(a=null==(e=window.google)?void 0:e.maps)?void 0:a.importLibrary){t||S(I),yield Promise.all(n.map(e=>C(e))),r&&r();return}if(k===w||k===I){k===I&&r&&r();return}t=N,S(w);let p=Object.fromEntries(Object.entries({key:s,v:l,libraries:i,region:o,language:d,authReferrerPolicy:c}).filter(([,e])=>void 0!==e));void 0!==u&&u>=0&&u<=999&&(p.channel=String(u)),void 0===m?p.solutionChannel="GMP_visgl_rgmlibrary_v1_default":""!==m&&(p.solutionChannel=m),function(e){if(y)return v(`The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(e)}) will be ignored.`);(function(e){var t,r,n,a,s,l,i,o,d,c,u;let m=!!window.google?.maps?.importLibrary;m&&JSON.stringify(e);m||(a="google",s="importLibrary",l=document,d=(o=(i=window)[a]||(i[a]={})).maps||(o.maps={}),c=new Set,u=new URLSearchParams,d[s]?console.warn("The Google Maps JavaScript API only loads once. Ignoring:",e):d[s]=(i,...o)=>c.add(i)&&(t||(t=new Promise(async(s,i)=>{for(n in await (r=l.createElement("script")),u.set("libraries",[...c]+""),e)u.set(n.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),e[n]);u.set("callback",a+".maps.__ib__"),r.src="https://maps.googleapis.com/maps/api/js?"+u,d.__ib__=s,r.onerror=()=>t=i(Error("The Google Maps JavaScript API could not load.")),r.nonce=l.querySelector("script[nonce]")?.nonce||"",l.head.append(r)}))).then(()=>d[s](i,...o)))})(e),y=!0}(p),yield Promise.all(n.map(e=>C(e))),S(I),r&&r()}catch(e){S("FAILED"),n?n(e):console.error("The Google Maps JavaScript API failed to load.",e)}})},[N,r,n,C,i]),(0,a.useEffect)(()=>{if(g!==I)return;let e=google.maps.Settings.getInstance();p?e.fetchAppCheckToken=p:e.fetchAppCheckToken&&(e.fetchAppCheckToken=null)},[g,p]),{status:g,loadedLibraries:f,importLibrary:C}}(n),f=(0,a.useMemo)(()=>n.disableUsageAttribution?null:C,[n.disableUsageAttribution]),N=(0,a.useMemo)(()=>({mapInstances:s,addMapInstance:l,removeMapInstance:i,clearMapInstances:o,map3dInstances:d,addMap3DInstance:c,removeMap3DInstance:u,clearMap3DInstances:m,status:p,loadedLibraries:g,importLibrary:h,internalUsageAttributionIds:f}),[s,l,i,o,d,c,u,m,p,g,h,f]);return a.default.createElement(E.Provider,{value:N},r)},_={onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onContextmenu:"contextmenu",onDblclick:"dblclick",onDrag:"drag",onDragend:"dragend",onDragstart:"dragstart",onHeadingChanged:"heading_changed",onIdle:"idle",onIsFractionalZoomEnabledChanged:"isfractionalzoomenabled_changed",onMapCapabilitiesChanged:"mapcapabilities_changed",onMapTypeIdChanged:"maptypeid_changed",onMousemove:"mou
1semove",onMouseout:"mouseout",onMouseover:"mouseover",onProjectionChanged:"projection_changed",onRenderingTypeChanged:"renderingtype_changed",onTilesLoaded:"tilesloaded",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed",onCameraChanged:"bounds_changed"},A=["bounds_changed","center_changed","heading_changed","tilt_changed","zoom_changed"],P=["click","contextmenu","dblclick","mousemove","mouseout","mouseover"],T=Object.keys(_);function M(e,t){let r=(0,a.useRef)(e);return t(e,r.current)||(r.current=e),r.current}function L(e,t){var r;r=f.default,(0,a.useEffect)(e,[M(t,r)])}let z=new Set(["backgroundColor","clickableIcons","controlSize","disableDefaultUI","disableDoubleClickZoom","draggable","draggableCursor","draggingCursor","fullscreenControl","fullscreenControlOptions","gestureHandling","headingInteractionEnabled","isFractionalZoomEnabled","keyboardShortcuts","mapTypeControl","mapTypeControlOptions","mapTypeId","maxZoom","minZoom","noClear","panControl","panControlOptions","restriction","rotateControl","rotateControlOptions","scaleControl","scaleControlOptions","scrollwheel","streetView","streetViewControl","streetViewControlOptions","styles","tiltInteractionEnabled","zoomControl","zoomControlOptions"]);function R(){var e;return(null==(e=(0,a.useContext)(E))?void 0:e.status)||N}function $(e,t){if(!e||!t)return!1;let r=F(e),n=F(t);return r.lat===n.lat&&r.lng===n.lng}function F(e){return e&&"object"==typeof e&&"lat"in e&&"lng"in e&&Number.isFinite(e.lat)&&Number.isFinite(e.lng)?e:e.toJSON()}function H(e){if("north"in e&&"south"in e&&"east"in e&&"west"in e)return e;
1let t=e.getNorthEast().toJSON(),r=e.getSouthWest().toJSON();return{north:t.lat,east:t.lng,south:r.lat,west:r.lng}}function J(e,t){if(!e||!t)return e===t;let r="getArray"in t?t.getArray():t;if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!$(e[t],r[t]))return!1;return!0}let B=()=>a.default.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0,zIndex:999,display:"flex",flexFlow:"column nowrap",textAlign:"center",justifyContent:"center",fontSize:".8rem",color:"rgba(0,0,0,0.6)",background:"#dddddd",padding:"1rem 1.5rem"}},a.default.createElement("h2",null,"Error: AuthFailure"),a.default.createElement("p",null,"A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",a.default.createElement("code",null,"APIProvider.apiKey")," prop is correct. Check the error-message in the console for further details."));function K(){let[e,t]=(0,a.useState)(null);return[e,(0,a.useCallback)(e=>t(e),[t])]}function Z(){let[,e]=(0,a.useReducer)(e=>e+1,0);return e}class G{static has(e){return this.entries[e]&&this.entries[e].length>0}static pop(e){return this.entries[e]&&this.entries[e].pop()||null}static push(e,t){this.entries[e]||(this.entries[e]=[]),this.entries[e].push(t)}}G.entries={};let U=a.default.createContext(null),q=e=>{let t,r,n,s,l,i,{children:o,id:d,className:c,style:u}=e,m=(0,a.useContext)(E),p=R();if(!m)throw Error("<Map> can only be used inside an <ApiProvider> component.");let[g,h,f]=function(e,t){let r,n,s=R()===I,[l,i]=(0,a.useState)(null),[o,d]=K(),c=(r=Z(),n=(0,a.useRef)({center:{lat:0,lng:0},heading:0,tilt:0,zoom:0}),(0,a.useEffect)(()=>{if(!l)return;let e=google.maps.event.addListener(l,"bounds_changed",()=>{let e,t,a,s,i;e=l.getCenter(),t=l.getZoom(),a=l.getHeading()||0,s=l.getTilt()||0,i=l.getBounds(),e&&i&&Number.isFinite(t)||console.warn("[useTrackedCameraState] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"),Object.assign(n.current,{center:(null==e?void 0:e.toJSON())||{lat:0,lng:0},zoom:t||0,heading:a,tilt:s}),r()});return()=>e.remove()},[l,r]),n),{id:u,defaultBounds:m,defaultCenter:p,defaultZoom:g,defaultHeading:h,defaultTilt:f,reuseMaps:b,renderingType:v,colorScheme:y}=e,j=x(e,["id","defaultBounds","defaultCenter","defaultZoom","defaultHeading","defaultTilt","reuseMaps","renderingType","colorScheme"]),N=void 0!==e.zoom||void 0!==e.defaultZoom,w=void 0!==e.center||void 0!==e.defaultCenter;m||N&&w||console.warn("<Map> component is missing configuration. You have to provide zoom and center (via the `zoom`/`defaultZoom` and `center`/`defaultCenter` props) or specify the region to show using `defaultBounds`. See https://visgl.github.io/react-google-maps/docs/api-reference/components/map#required"),!j.center&&p&&(j.center=p),!j.zoom&&Number.isFinite(g)&&(j.zoom=g),!j.heading&&Number.isFinite(h)&&(j.heading=h),!j.tilt&&Number.isFinite(f)&&(j.tilt=f);let C=j.internalUsageAttributionIds;for(let e of(null==C?j.internalUsageAttributionIds=t.internalUsageAttributionIds:j.internalUsageAttributionIds=[...t.internalUsageAttributionIds||[],...C],Object.keys(j)))void 0===j[e]&&delete j[e];let E=(0,a.useRef)(void 0);return(0,a.useEffect)(()=>{let r,n;if(!o||!s)return;let{addMapInstance:a,removeMapInstance:l}=t,{mapId:d}=e,p=`${d||"default"}:${v||"default"}:${y||"LIGHT"}`;if(b&&G.has(p)?(r=(n=G.pop(p)).getDiv(),o.appendChild(r),n.setOptions(j),setTimeout(()=>n.moveCamera({}),0)):((r=document.createElement("div")).style.height="100%",o.appendChild(r),n=new google.maps.Map(r,Object.assign(Object.assign(Object.assign({},j),v?{renderingType:v}:{}),y?{colorScheme:y}:{}))),i(n),a(n,u),m){let{padding:e}=m,t=x(m,["padding"]);n.fitBounds(t,e)}else N&&w||n.fitBounds({east:180,west:-180,south:-90,north:90});if(E.current){let{mapId:e,cameraState:t}=E.current;e!==d&&n.moveCamera(t)}return()=>
1{E.current={mapId:d,cameraState:c.current},r.remove(),b?G.push(p,n):google.maps.event.clearInstanceListeners(n),i(null),l(u)}},[o,s,u,e.mapId,e.renderingType,e.colorScheme]),[l,d,c]}(e,m);for(let o of(t=e.center?F(e.center):null,r=null,n=null,t&&Number.isFinite(t.lat)&&Number.isFinite(t.lng)&&(r=t.lat,n=t.lng),s=Number.isFinite(e.zoom)?e.zoom:null,l=Number.isFinite(e.heading)?e.heading:null,i=Number.isFinite(e.tilt)?e.tilt:null,(0,a.useLayoutEffect)(()=>{if(!g)return;let e={},t=!1;null!==r&&null!==n&&(f.current.center.lat!==r||f.current.center.lng!==n)&&(e.center={lat:r,lng:n},t=!0),null!==s&&f.current.zoom!==s&&(e.zoom=s,t=!0),null!==l&&f.current.heading!==l&&(e.heading=l,t=!0),null!==i&&f.current.tilt!==i&&(e.tilt=i,t=!0),t&&g.moveCamera(e)}),T)){let t=e[o],r=_[o];(0,a.useEffect)(()=>{if(!g||!t)return;let e=google.maps.event.addListener(g,r,e=>{t(function(e,t,r){var n;let a={type:e,map:t,detail:{},stoppable:!1,stop:()=>{}};if(A.includes(e)){let e=t.getCenter(),r=t.getZoom(),n=t.getHeading()||0,s=t.getTilt()||0,l=t.getBounds();return e&&l&&Number.isFinite(r)||console.warn("[createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"),a.detail={center:(null==e?void 0:e.toJSON())||{lat:0,lng:0},zoom:r||0,heading:n,tilt:s,bounds:(null==l?void 0:l.toJSON())||{north:90,east:180,south:-90,west:-180}},a}if(P.includes(e)){if(!r)throw Error("[createEvent] mouse events must provide a srcEvent");return a.domEvent=r.domEvent,a.stoppable=!0,a.stop=()=>r.stop(),a.detail={latLng:(null==(n=r.latLng)?void 0:n.toJSON())||null,placeId:r.placeId},a}return a}(r,g,e))});return()=>e.remove()},[g,r,t])}let b={};for(let t of Object.keys(e))z.has(t)&&(b[t]=e[t]);L(()=>{g&&g.setOptions(b)},[b]);let v=function(e,t){let{viewport:r,viewState:n}=t;return(0,a.useLayoutEffect)(()=>{if(!e||!n)return;let{latitude:t,longitude:r,bearing:a,pitch:s,zoom:l}=n;e.moveCamera({center:{lat:t,lng:r},heading:a,tilt:s,zoom:l+1})},[e,n]),!!r}(g,e),y=!!e.controlled;(0,a.useEffect)(()=>{if(g)return v&&g.setOptions({disableDefaultUI:!0}),(v||y)&&g.setOptions({gestureHandling:"none",keyboardShortcuts:!1}),()=>{g.setOptions({gestureHandling:e.gestureHandling,keyboardShortcuts:e.keyboardShortcuts})}},[g,v,y,e.gestureHandling,e.keyboardShortcuts]);let j=e.center?F(e.center):null,N=null,w=null;j&&Number.isFinite(j.lat)&&Number.isFinite(j.lng)&&(N=j.lat,w=j.lng);let C=(0,a.useMemo)(()=>{var t,r,n;return{center:{lat:null!=N?N:0,lng:null!=w?w:0},zoom:null!=(t=e.zoom)?t:0,heading:null!=(r=e.heading)?r:0,tilt:null!=(n=e.tilt)?n:0}},[N,w,e.zoom,e.heading,e.tilt]);(0,a.useLayoutEffect)(()=>{if(!g||!y)return;g.moveCamera(C);let e=g.addListener("bounds_changed",()=>{g.moveCamera(C)});return()=>e.remove()},[g,y,C]);let k=(0,a.useMemo)(()=>Object.assign({width:"100%",height:"100%",position:"relative",zIndex:v?-1:0},u),[u,v]),O=(0,a.useMemo)(()=>({map:g}),[g]);return"AUTH_FAILURE"===p?a.default.createElement("div",{style:Object.assign({position:"relative"},c?{}:k),className:c},a.default.createElement(B,null)):a.default.createElement("div",Object.assign({ref:h,"data-testid":"map",style:c?void 0:k,className:c},d?{id:d}:{}),g?a.default.createElement(U.Provider,{value:O},o):null)};q.deckGLViewProps=!0;let W=new Set,V=(e=null)=>{let t=(0,a.useContext)(E),{map:r}=(0,a.useContext)(U)||{};if(null===t)return!function(...e){let t=JSON.stringify(e);W.has(t)||(W.add(t),console.error(...e))}("useMap(): failed to retrieve APIProviderContext. Make sure that the <APIProvider> component exists and that the component you are calling `useMap()` from is a sibling of the <APIProvider>."),null;let{mapInstances:n}=t;return null!==e?n[e]||null:r||n.default||null};function X(e){let t=R()===I,r=(0,a.useContext)(E);return(0,a.useEffect)(()=>{t&&r&&r.importLibrary(e)},[t,r,e]),(null==r?void 0:r.loadedLibraries[e])||null}let{useLayoutEffect:Q,useRef:Y}=a,ee=null!=(r=a.useInsertionEffect)?r:Q;function et(){throw Error("useEffectEvent: invalid call during rendering.")}let er=function(e){let t=Y(et);return ee(()=>{t.current=e},[e]),(...e)=>t.current(...e)},en=()=>{};function ea(e,t,r){let n=er(null!=r?r:en),s=!!r;(0,a.useEffect)(()=>
1{if(!e||!t||!s)return;let r=google.maps.event.addListener(e,t,n);return()=>r.remove()},[e,t,s])}function es(e,t,r){(0,a.useEffect)(()=>{e&&(e[t]=r)},[e,t,r])}let el=()=>{};function ei(e,t,r){let n=er(null!=r?r:el),s=!!r;(0,a.useEffect)(()=>{if(e&&t&&s)return e.addEventListener(t,n),()=>e.removeEventListener(t,n)},[e,t,s])}let eo=new class{constructor(){this.renderedStyles=new Set,this.styleElement=null}getStyleElement(){return this.styleElement||(this.styleElement=document.createElement("style"),this.styleElement.setAttribute("data-rgm-anchor-styles",""),document.head.appendChild(this.styleElement)),this.styleElement}addAdvancedMarkerPointerEventsOverwrite(){if(this.renderedStyles.has("marker-pointer-events"))return;let e=this.getStyleElement();e.textContent+=`
2      gmp-advanced-marker[data-origin='rgm'] {
3        pointer-events: none !important;
4      }
5    `,this.renderedStyles.add("marker-pointer-events")}cleanup(){this.styleElement&&(this.styleElement.remove(),this.styleElement=null,this.renderedStyles.clear())}},ed=a.default.createContext(null),ec=["50%","100%"],eu=(0,a.forwardRef)((e,t)=>{let{children:r,style:n,className:s,anchorPoint:l}=e,[i,o]=function(e){var t,r,n,s,l;let[i,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(null),u=V(),m=X("marker"),{children:p,onClick:g,className:h,onMouseEnter:f,onMouseLeave:x,onDrag:b,onDragStart:v,onDragEnd:y,collisionBehavior:j,clickable:N,draggable:w,position:I,title:C,zIndex:E,anchorPoint:k,anchorLeft:O,anchorTop:S}=e,D=a.Children.count(p);return(0,a.useEffect)(()=>{if(!u||!m)return;let e=new m.AdvancedMarkerElement;e.map=u,o(e);let t=null;return D>0&&(e.content=t=document.createElement("div"),c(t)),()=>{e.map=null,null==t||t.remove(),o(null),c(null)}},[u,m,D]),(0,a.useEffect)(()=>{(null==i?void 0:i.content)&&em(i.content)&&!(D>0)&&(i.content.className=null!=h?h:"")},[i,h,D]),t=i,r=k,n=O,s=S,l=D>0,(0,a.useEffect)(()=>{if(!t||!l)return;let e=function(e,t){var r;if(!(null==(r=null==google?void 0:google.maps)?void 0:r.version))return;let n=google.maps.version.split("."),a=parseInt(n[0],10),s=parseInt(n[1],10);return a>3||3===a&&s>=62}(0,0),a=t.content;if(a&&em(a)){if(void 0!==n||void 0!==s){e||console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`),t.anchorLeft=n,t.anchorTop=s,void 0!==r&&console.warn("AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.");return}if(void 0!==r){let[n,s]=null!=r?r:ec,l=`calc(-1 * ${n})`,i=`calc(-1 * ${s})`;e?(t.anchorLeft=l,t.anchorTop=i,a.style.transform=""):(a.style.transform=`translate(50%, 100%) translate(${l}, ${i})`,t.dataset.origin="rgm",eo.addAdvancedMarkerPointerEventsOverwrite())}}},[t,r,n,s,l]),es(i,"position",I),es(i,"title",null!=C?C:""),es(i,"zIndex",E),es(i,"collisionBehavior",j),(0,a.useEffect)(()=>{i&&(void 0!==w?i.gmpDraggable=w:b||v||y?i.gmpDraggable=!0:i.gmpDraggable=!1)},[i,w,b,y,v]),(0,a.useEffect)(()=>{if(!i)return;let e=void 0!==N?N:!!g||!!f||!!x;i.gmpClickable=e,e&&(null==i?void 0:i.content)&&em(i.content)&&(i.content.style.pointerEvents="all",g&&(i.content.style.cursor="pointer"))},[i,N,g,f,x]),ea(i,"click",g),ea(i,"drag",b),ea(i,"dragstart",v),ea(i,"dragend",y),ei(null==i?void 0:i.element,"mouseenter",f),ei(null==i?void 0:i.element,"mouseleave",x),[i,d]}(e),d=(0,a.useMemo)(()=>i?{marker:i}:null,[i]);return((0,a.useImperativeHandle)(t,()=>i,[i]),o)?a.default.createElement(ed.Provider,{value:d},(0,h.createPortal)(a.default.createElement(ep,{anchorPoint:l,styles:n,className:s},r),o)):null});function em(e){return e.nodeType===Node.ELEMENT_NODE}eu.displayName="AdvancedMarker";let ep=({children:e,styles:t,className:r})=>a.default.createElement("div",{className:r,style:t},e);function eg(e,t,r){var n;let a=0===t.indexOf("--");null==r||"boolean"==typeof r||""===r?a?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":a?e.setProperty(t,r):"number"!=typeof r||0===r||(n=t,eh.has(n))?"float"===t?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}(0,a.forwardRef)((e,t)=>{let r=function(e){var t,r,n;let{onClick:s,onDrag:l,onDragStart:i,onDragEnd:o,onMouseOver:d,onMouseOut:c,onRadiusChanged:u,onCenterChanged:m,center:p,defaultCenter:g,radius:h,defaultRadius:b}=e,v=x(e,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onRadiusChanged","onCenterChanged","center","defaultCenter","radius","defaultRadius"]),[y,j]=(0,a.useState)(null),N=V(),w=M(Object.assign(Object.assign({},v),{clickable:null!=(t=v.clickable)?t:!!s,draggable:null!=(r=v.draggable)?r:!!(l||i||o||m),editable:null!=(n=v.editable)?n:!!u}),f.default);return(0,a.useEffect)(()=>
5{if(!N){void 0===N&&console.error("<Circle> has to be inside a Map component.");return}let e=new google.maps.Circle(Object.assign(Object.assign({},w),{center:null!=p?p:g,radius:null!=h?h:b}));return e.setMap(N),j(e),()=>{e.setMap(null),j(null)}},[N]),ea(y,"click",s),ea(y,"drag",l),ea(y,"dragstart",i),ea(y,"dragend",o),ea(y,"mouseover",d),ea(y,"mouseout",c),ea(y,"radius_changed",u?()=>{let e=null==y?void 0:y.getRadius();void 0!==e&&u(e)}:null),ea(y,"center_changed",m?()=>{m(null==y?void 0:y.getCenter())}:null),(0,a.useEffect)(()=>{y&&y.setOptions(w)},[y,w]),(0,a.useEffect)(()=>{y&&p&&($(p,y.getCenter())||y.setCenter(p))},[y,p]),(0,a.useEffect)(()=>{y&&void 0!==h&&h!==y.getRadius()&&y.setRadius(h)},[y,h]),y}(e);return(0,a.useImperativeHandle)(t,()=>r,[r]),a.default.createElement(a.default.Fragment,null)}).displayName="Circle";let eh=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","scale","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function ef(e){let t=e.getPaths(),r=[];for(let e=0;e<t.getLength();e++)r.push(t.getAt(e).getArray());return r}(0,a.forwardRef)((e,t)=>{let r=function(e){var t,r,n;let{onClick:s,onDrag:l,onDragStart:i,onDragEnd:o,onMouseOver:d,onMouseOut:c,onPathsChanged:u,polygon:m,encodedPaths:p,paths:g,defaultPaths:h}=e,b=x(e,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onPathsChanged","polygon","encodedPaths","paths","defaultPaths"]),[v,y]=(0,a.useState)(null),j=V(),N=X("geometry"),w=(0,a.useRef)(!1),I=M(Object.assign(Object.assign({},b),{clickable:null!=(t=b.clickable)?t:!!s,draggable:null!=(r=b.draggable)?r:!!(l||i||o||u),editable:null!=(n=b.editable)?n:!!u}),f.default);return(0,a.useEffect)(()=>{let e;if(!j){void 0===j&&console.error("<Polygon> has to be inside a Map component.");return}if(m){e=m;let t=null!=g?g:h;t&&Array.isArray(t)&&e.setPaths(t),e.setOptions(I)}else{let t=null!=g?g:h,r=Object.assign({},I);t&&Array.isArray(t)&&(r.paths=t),e=new google.maps.Polygon(r)}return e.setMap(j),y(e),()=>{e.setMap(null),y(null)}},[j,m]),ea(v,"click",s),ea(v,"drag",l),ea(v,"dragstart",i),ea(v,"mouseover",d),ea(v,"mouseout",c),ea(v,"dragend",e=>{null==o||o(e),u&&v&&!w.current&&u(ef(v))}),(0,a.useEffect)(()=>{if(!v||!u)return;let e=[],t=v.getPaths();if("function"!=typeof t.getLength||"function"!=typeof t.getAt)return;let r=()=>{w.current||u(ef(v))},n=t=>{e.push(google.maps.event.addListener(t,"insert_at",r)),e.push(google.maps.event.addListener(t,"remove_at",r)),e.push(google.maps.event.addListener(t,"set_at",r))};for(let e=0;e<t.getLength();e++)n(t.getAt(e));return e.push(google.maps.event.addListener(t,"insert_at",e=>{n(t.getAt(e)),r()})),e.push(google.maps.event.addListener(t,"set_at",e=>{n(t.getAt(e)),r()})),e.push(google.maps.event.addListener(t,"remove_at",r)),()=>{e.forEach(e=>e.remove())}},[v,u,g,p,I.editable,I.draggable]),(0,a.useEffect)(()=>{v&&v.setOptions(I)},[v,I]),(0,a.useEffect)(()=>{v&&g&&Array.isArray(g)&&!function(e,t){if(!e||!t)return e===t;let r="getArray"in t?t.getArray().map(e=>e.getArray()):t;if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(!J(e[t],r[t]))return!1;return!0}(Array.isArray(g[0])?g:[g],v.getPaths())&&(w.current=!0,v.setPaths(g),w.current=!1)},[v,g]),(0,a.useEffect)(()=>{if(!v||!p||!N)return;w.current=!0;let e=p.map(e=>N.encoding.decodePath(e));v.setPaths(e),w.current=!1},[v,p,N]),v}(e);return(0,a.useImperativeHandle)(t,()=>r,[r]),a.default.createElement(a.default.Fragment,null)}).displayName="Polygon",(0,a.forwardRef)((e,t)=>{let r=function(e){var t,r,n;let{onClick:s,onDrag:l,onDragStart:i,onDragEnd:o,onMouseOver:d,onMouseOut:c,onPathChanged:u,polyline:m,encodedPath:p,path:g,defaultPath:h}=e,b=x(e,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onPathChanged","polyline","encodedPath","path","defaultPath"]),[v,y]=(0,a.useState)(null),j=V(),N=X("geometry"),w=(0,a.useRef)(!1),I=M(Object.assign(Object.assign({},b),{clickable:null!=(t=b.clickable)?t:!!s,draggable:null!=(r=b.draggable)?r:!!(l||i||o||u),editable:null!=(n=b.editable)?n:!!u}),f.default);return(0,a.useEffect)(()=>{let e;if(!j){void 0===j&&console.error("<Polyline> has to be inside a Map component.");return}if(m){e=m;let t=null!=g?g:h;t&&Array.isArray(t)&&e.setPath(t),e.setOptions(I)}else{let t=null!=g?g:h,r=Object.assign({},I);t&&Array.isArray(t)&&(r.path=t),e=new google.maps.Polyline(r)}return e.setMap(j),y(e),()=>{e.setMap(null),y(null)}},[j,m]),ea(v,"click",s),ea(v,"drag",l),ea(v,"dragstart",i),ea(v,"mouseover",d),ea(v,"mouseout",c),ea(v,"dragend",e=>{null==o||o(e),u&&v&&!w.current&&u(v.getPath().getArray())}),(0,a.useEffect)(()=>
5{if(!v||!u)return;let e=v.getPath();if(!e)return;let t=()=>{w.current||u(e.getArray())},r=[google.maps.event.addListener(e,"insert_at",t),google.maps.event.addListener(e,"remove_at",t),google.maps.event.addListener(e,"set_at",t)];return()=>{r.forEach(e=>e.remove())}},[v,u,g,p,I.editable,I.draggable]),(0,a.useEffect)(()=>{v&&v.setOptions(I)},[v,I]),(0,a.useEffect)(()=>{v&&g&&(J(g,v.getPath())||(w.current=!0,v.setPath(g),w.current=!1))},[v,g]),(0,a.useEffect)(()=>{if(!v||!p||!N)return;w.current=!0;let e=N.encoding.decodePath(p);v.setPath(e),w.current=!1},[v,p,N]),v}(e);return(0,a.useImperativeHandle)(t,()=>r,[r]),a.default.createElement(a.default.Fragment,null)}).displayName="Polyline";let ex={center:{lat:0,lng:0,altitude:0},range:0,heading:0,tilt:0,roll:0},eb=["center","range","heading","tilt","roll"],ev=["gmp-centerchange","gmp-headingchange","gmp-tiltchange","gmp-rangechange","gmp-rollchange"];function ey(e,t){let r=e.center;return{type:t,map3d:e,detail:{center:r&&"toJSON"in r&&"function"==typeof r.toJSON?r.toJSON():r||{lat:0,lng:0,altitude:0},range:e.range||0,heading:e.heading||0,tilt:e.tilt||0,roll:e.roll||0}}}function ej(e,t,r,n){(0,a.useEffect)(()=>{if(!e||!r)return;let a=()=>{r(n(e,t))};return e.addEventListener(t,a),()=>e.removeEventListener(t,a)},[e,t,r,n])}let eN=new Set(["bounds","defaultUIHidden","gestureHandling","internalUsageAttributionIds","maxAltitude","maxHeading","maxTilt","minAltitude","minHeading","minTilt","mode"]),ew=a.default.createContext(null),eI={width:"100%",height:"100%",position:"relative"};(0,a.forwardRef)((e,t)=>{var r,n,s,l,i,o,d,c;let u,m,p,g,h,f,b,v,y,{children:j,id:N,className:w,style:I}=e,C=(0,a.useContext)(E);if(!C)throw Error("<Map3D> can only be used inside an <APIProvider> component.");let{addMap3DInstance:k,removeMap3DInstance:O}=C,[S,D,_,A,P]=function(e){let t,r,n=X("maps3d"),[s,l]=(0,a.useState)(!1),[,i]=K(),[o,d]=K(),c=(t=Z(),r=(0,a.useRef)(Object.assign({},ex)),(0,a.useEffect)(()=>{if(!o)return;let e=[];for(let n of eb){let a=`gmp-${n}change`,s=()=>{!function(e,t,r){let n=e[r];null!=n&&("center"===r?t.current.center=n.toJSON?n.toJSON():n:t.current[r]=n)}(o,r,n),t()};o.addEventListener(a,s),e.push(()=>o.removeEventListener(a,s))}return()=>{for(let t of e)t()}},[o,t]),r);return(0,a.useEffect)(()=>{customElements.whenDefined("gmp-map-3d").then(()=>{l(!0)})},[]),(0,a.useEffect)(()=>{if(!o)return;let{center:t,heading:r,tilt:n,range:a,roll:s,defaultCenter:l,defaultHeading:i,defaultTilt:d,defaultRange:c,defaultRoll:u,id:m,style:p,className:g,children:h,onCenterChanged:f,onHeadingChanged:b,onTiltChanged:v,onRangeChanged:y,onRollChanged:j,onCameraChanged:N,onClick:w,onSteadyChange:I,onAnimationEnd:C,onError:E,mode:k,gestureHandling:O}=e,S=x(e,["center","heading","tilt","range","roll","defaultCenter","defaultHeading","defaultTilt","defaultRange","defaultRoll","
5id","style","className","children","onCenterChanged","onHeadingChanged","onTiltChanged","onRangeChanged","onRollChanged","onCameraChanged","onClick","onSteadyChange","onAnimationEnd","onError","mode","gestureHandling"]),D=null!=t?t:l,_=null!=r?r:i,A=null!=n?n:d,P=null!=a?a:c,T=null!=s?s:u,M=Object.assign({},S);D&&(M.center=D),void 0!==_&&(M.heading=_),void 0!==A&&(M.tilt=A),void 0!==P&&(M.range=P),void 0!==T&&(M.roll=T),Object.assign(o,M)},[o]),[o,i,d,c,!!n&&s]}(e);m=null!=(r=null==(u=(c=e.center)?"toJSON"in c&&"function"==typeof c.toJSON?c.toJSON():c:null)?void 0:u.lat)?r:null,p=null!=(n=null==u?void 0:u.lng)?n:null,g=null!=(s=null==u?void 0:u.altitude)?s:null,h=null!=(l=e.range)?l:null,f=null!=(i=e.heading)?i:null,b=null!=(o=e.tilt)?o:null,v=null!=(d=e.roll)?d:null,(0,a.useLayoutEffect)(()=>{var e;if(!S)return;let t=A.current;null!==m&&null!==p&&(t.center.lat!==m||t.center.lng!==p||null!==g&&t.center.altitude!==g)&&(S.center={lat:m,lng:p,altitude:null!=(e=null!=g?g:t.center.altitude)?e:0}),null!==h&&t.range!==h&&(S.range=h),null!==f&&t.heading!==f&&(S.heading=f),null!==b&&t.tilt!==b&&(S.tilt=b),null!==v&&t.roll!==v&&(S.roll=v)}),function(e,t){let{onCenterChanged:r,onHeadingChanged:n,onTiltChanged:s,onRangeChanged:l,onRollChanged:i,onCameraChanged:o,onClick:d,onSteadyChange:c,onAnimationEnd:u,onError:m}=t;ej(e,"gmp-centerchange",r,ey),ej(e,"gmp-headingchange",n,ey),ej(e,"gmp-tiltchange",s,ey),ej(e,"gmp-rangechange",l,ey),ej(e,"gmp-rollchange",i,ey),(0,a.useEffect)(()=>{if(!e||!o)return;let t=()=>{o(ey(e,"camerachange"))};for(let r of ev)e.addEventListener(r,t);return()=>{for(let r of ev)e.removeEventListener(r,t)}},[e,o]),(0,a.useEffect)(()=>{if(!e||!d)return;let t=t=>{d({type:"gmp-click",map3d:e,detail:{position:t.position||null,placeId:t.placeId}})};return e.addEventListener("gmp-click",t),()=>e.removeEventListener("gmp-click",t)},[e,d]),(0,a.useEffect)(()=>{if(!e||!c)return;let t=t=>{c({type:"gmp-steadychange",map3d:e,detail:{isSteady:t.isSteady}})};return e.addEventListener("gmp-steadychange",t),()=>e.removeEventListener("gmp-steadychange",t)},[e,c]),ej(e,"gmp-animationend",u,(e,t)=>({type:t,map3d:e})),ej(e,"gmp-error",m,(e,t)=>({type:t,map3d:e}))}(S,e),L(()=>{S&&Object.assign(S,y)},[S,y=(0,a.useMemo)(()=>{let t={};for(let r of Object.keys(e)){if(!eN.has(r))continue;let n=e[r];void 0!==n&&(t[r]=n)}return t},[e])]),(0,a.useEffect)(()=>{if(!S)return;let e=null!=N?N:"default";return k(S,e),()=>{O(e)}},[S,N]),(0,a.useImperativeHandle)(t,()=>({map3d:S,flyCameraAround:e=>{null==S||S.flyCameraAround(e)},flyCameraTo:e=>{null==S||S.flyCameraTo(e)},stopCameraAnimation:()=>{null==S||S.stopCameraAnimation()}}),[S]);let T=(0,a.useMemo)(()=>Object.assign(Object.assign({},eI),I),[I]),M=(0,a.useMemo)(()=>({map3d:S}),[S]);return P?a.default.createElement("div",Object.assign({ref:D,"data-testid":"map-3d",style:w?void 0:T,className:w},N?{id:N}:{}),a.default.createElement("gmp-map-3d",{ref:_,style:{width:"100%",height:"100%"}},S&&a.default.createElement(ew.Provider,{value:M},j))):a.default.createElement("div",Object.assign({ref:D,"data-testid":"map-3d",style:w?void 0:T,className:w},N?{id:N}:{}))}).displayName="Map3D";let eC=(0,a.createContext)(null);(0,a.forwardRef)(function(e,t){let{children:r,onClick:n,position:s,altitudeMode:l,collisionBehavior:i,drawsWhenOccluded:o,extruded:d,label:c,sizePreserved:u,zIndex:m,title:p}=e,g=!!n,[f,x]=(0,a.useState)(null),[b,v]=(0,a.useState)(!1),y=(0,a.useMemo)(()=>{let e=document.createElement("div");return e.style.display="none",document.body.appendChild(e),e},[]);(0,a.useEffect)(()=>()=>y.remove(),[y]);let j=(0,a.useCallback)(e=>{x(e),"function"==typeof t?t(e):t&&(t.current=e)},[t]);ei(f,"gmp-click",n),(0,a.useLayoutEffect)(()=>{if(!b&&f&&y){for(;f.firstChild;)f.removeChild(f.firstChild);for(let e of Array.from(y.childNodes)){if(e.nodeType!==Node.ELEMENT_NODE)continue;let t=e.tagName.toLowerCase();if("img"===t||"svg"===t){let t=document.createElement("template");t.content.appendChild(e.cloneNode(!0)),f.appendChild(t)}else f.appendChild(e.cloneNode(!0))}}},[f,y,r,b]);let N=(0,a.useMemo)(()=>({marker:f,setContentHandledExternally:v}),[f]);return es(f,"position",s),es(f,"altitudeMode",l),es(f,"collisionBehavior",i),es(f,"drawsWhenOccluded",o),es(f,"extruded",d),es(f,"label",c),es(f,"sizePreserved",u),es(f,"zIndex",m),es(f,"title",null!=p?p:""),a.default.createElement(eC.Provider,{value:N},g?a.default.createElement("gmp-marker-3d-interactive",{ref:j}):a.default.createElement("gmp-marker-3d",{ref:j}),(0,h.createPortal)(r,y))}).displayName="Marker3D",(0,a.forwardRef)(function(e,t){var r,n,s,l;let i,o,{children:d,headerContent:c,style:u,className:m,open:p=!0,position:g,anchor:h,anchorId:f,altitudeMode:x,lightDismissDisabled:b,autoPanDisabled:v,onClose:y}=e,[j,N]=(0,a.useState)(null),w=(0,a.useRef)(null);return(0,a.useImperativeHandle)(t,()=>j,[j]),n=j,s=p,l=y,i=(0,a.useRef)(void 0),o=(0,a.useRef)(s),(0,a.useEffect)(()=>{o.current=s},[s]),(0,a.useEffect)(()=>
5{if(!n||!l)return;let e=new MutationObserver(e=>{for(let t of e)if("attributes"===t.type&&"open"===t.attributeName){let e=n.hasAttribute("open");!0!==i.current||e||!1===o.current||l(),i.current=e}});return e.observe(n,{attributes:!0,attributeFilter:["open"]}),i.current=n.hasAttribute("open"),()=>{e.disconnect()}},[n,l]),es(j,"open",null!=p&&p),es(j,"altitudeMode",x),es(j,"lightDismissDisabled",b),es(j,"autoPanDisabled",v),es(j,"positionAnchor",null!=(r=null!=h?h:f)?r:g),(0,a.useLayoutEffect)(()=>{j&&(!function(e,t,r){if(null!=t&&"object"!=typeof t)throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");let n=e.style;if(null==r){if(null==t)return;for(let e in t)t.hasOwnProperty(e)&&eg(n,e,t[e]);return}for(let e in r)r.hasOwnProperty(e)&&(null==t||!t.hasOwnProperty(e))&&(0===e.indexOf("--")?n.setProperty(e,""):"float"===e?n.cssFloat="":n[e]="");if(null!=t)for(let e in t){let a=t[e];t.hasOwnProperty(e)&&r[e]!==a&&eg(n,e,a)}}(j,u||null,w.current),w.current=u||null)},[j,u]),a.default.createElement("gmp-popover",{ref:N,className:m},c&&a.default.createElement("div",{slot:"header"},c),d)}).displayName="Popover",(0,a.forwardRef)((e,t)=>{let r=function(e){let[t,r]=(0,a.useState)(null),n=V(),{onClick:s,onDrag:l,onDragStart:i,onDragEnd:o,onMouseOver:d,onMouseOut:c}=e,u=x(e,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut"]),{position:m,draggable:p}=u;return(0,a.useEffect)(()=>{if(!n){void 0===n&&console.error("<Marker> has to be inside a Map component.");return}let e=new google.maps.Marker(u);return e.setMap(n),r(e),()=>{e.setMap(null),r(null)}},[n]),(0,a.useEffect)(()=>{if(!t)return;let e=google.maps.event;return s&&e.addListener(t,"click",s),l&&e.addListener(t,"drag",l),i&&e.addListener(t,"dragstart",i),o&&e.addListener(t,"dragend",o),d&&e.addListener(t,"mouseover",d),c&&e.addListener(t,"mouseout",c),t.setDraggable(!!p),()=>{e.clearInstanceListeners(t)}},[t,p,s,l,i,o,d,c]),(0,a.useEffect)(()=>{t&&t.setOptions(u)},[t,u]),(0,a.useEffect)(()=>{!p&&m&&t&&t.setPosition(m)},[p,m,t]),t}(e);return(0,a.useImperativeHandle)(t,()=>r,[r]),a.default.createElement(a.default.Fragment,null)}).displayName="Marker",(0,a.forwardRef)((e,t)=>{let r=function(e){var t,r,n;let{onClick:s,onDrag:l,onDragStart:i,onDragEnd:o,onMouseOver:d,onMouseOut:c,onBoundsChanged:u,bounds:m,defaultBounds:p}=e,g=x(e,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut","onBoundsChanged","bounds","defaultBounds"]),[h,b]=(0,a.useState)(null),v=V(),y=M(Object.assign(Object.assign({},g),{clickable:null!=(t=g.clickable)?t:!!s,draggable:null!=(r=g.draggable)?r:!!(l||i||o||u),editable:null!=(n=g.editable)?n:!!u}),f.default);return(0,a.useEffect)(()=>{if(!v){void 0===v&&console.error("<Rectangle> has to be inside a Map component.");return}let e=new google.maps.Rectangle(Object.assign(Object.assign({},y),{bounds:null!=m?m:p}));return e.setMap(v),b(e),()=>{e.setMap(null),b(null)}},[v]),ea(h,"click",s),ea(h,"drag",l),ea(h,"dragstart",i),ea(h,"dragend",o),ea(h,"mouseover",d),ea(h,"mouseout",c),ea(h,"bounds_changed",u?()=>{u(null==h?void 0:h.getBounds())}:null),(0,a.useEffect)(()=>{h&&h.setOptions(y)},[h,y]),(0,a.useEffect)(()=>{h&&m&&!function(e,t){if(!e||!t)return!1;let r=H(e),n=H(t);return r.north===n.north&&r.south===n.south&&r.east===n.east&&r.west===n.west}(m,h.getBounds())&&h.setBounds(m)},[h,m]),h}(e);return(0,a.useImperativeHandle)(t,()=>r,[r]),a.default.createElement(a.default.Fragment,null)}).displayName="Rectangle";var eE=e.i(9971);let ek={lat:13.7563,lng:100.5018};function eO(e){return e.replace(/^จังหวัด/,"").replace(/^อำเภอ/,"").replace(/^เขต/,"").replace(/^ตำบล/,"").replace(/^แขวง/,"").trim()}function eS({onMapClick:e,onReverseGeocode:t,geocodeTarget:r,geocodeZoom:n}){let s=V(),l=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(!s)return;let r=s.addListener("click",r=>{if(!r.latLng)return;let n=r.latLng.lat(),a=r.latLng.lng();e(n,a),new google.maps.Geocoder().geocode({location:{lat:n,lng:a}},(e,r)=>{"OK"===r&&e?.[0]&&t(e[0].address_components)})});return()=>google.maps.event.removeListener(r)},[s,e,t]),(0,a.useEffect)(()=>{s&&r&&r!==l.current&&(l.current=r,new google.maps.Geocoder().geocode({address:r,regi
5on:"TH"},(e,t)=>{"OK"===t&&e?.[0]&&(s.panTo(e[0].geometry.location),s.setZoom(n))}))},[s,r,n]),null}function eD({lat:e,lng:t,onMapClick:r,onReverseGeocode:a,geocodeTarget:s,geocodeZoom:l}){let i=e&&t?{lat:e,lng:t}:ek;return(0,n.jsxs)(q,{defaultCenter:i,defaultZoom:e&&t?16:11,mapId:"tip-report-map",style:{width:"100%",height:"320px",borderRadius:"12px"},gestureHandling:"greedy",children:[(0,n.jsx)(eS,{onMapClick:r,onReverseGeocode:a,geocodeTarget:s,geocodeZoom:l}),e&&t&&(0,n.jsx)(eu,{position:{lat:e,lng:t},title:"ตำแหน่งร้านยา"})]})}function e_(){let{pharmacyInfo:e,setPharmacyInfo:t,setStep:r}=i(),{provinces:s,districts:l,subDistricts:o,getDistricts:d,getSubDistricts:c}=(0,p.useLocations)(),[u,m]=(0,a.useState)({}),[g,h]=(0,a.useState)(null),[f,x]=(0,a.useState)(11),[b,v]=(0,a.useState)(null),[y,j]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e.provinceId&&d(e.provinceId),e.districtId&&c(e.districtId)},[]),(0,a.useEffect)(()=>{if(!b)return;let r=s.find(e=>eO(e.name_th)===b.province);if(!r){v(null),j(!1);return}if(e.provinceId!==r.id){t({provinceId:r.id,districtId:null,subDistrictId:null,zipcode:""}),d(r.id);return}let n=l.filter(e=>e.province_id===r.id);if(!n.length)return;let a=n.find(e=>eO(e.name_th)===b.district);if(!a){v(null),j(!1);return}if(e.districtId!==a.id){t({districtId:a.id,subDistrictId:null,zipcode:""}),c(a.id);return}let i=o.filter(e=>e.district_id===a.id||e.amphure_id===a.id);if(!i.length)return;let u=i.find(e=>eO(e.name_th)===b.subDistrict);u&&t({subDistrictId:u.id,zipcode:u.zip_code?String(u.zip_code):""}),v(null),j(!1)},[b,s,l,o,e.provinceId,e.districtId]);let N=(0,a.useCallback)((e,r)=>{t({lat:e,lng:r})},[t]),w=(0,a.useCallback)(e=>{let t=e.find(e=>e.types.includes("administrative_area_level_1"))?.long_name??"",r=e.find(e=>e.types.includes("administrative_area_level_2"))?.long_name||"",n=e.find(e=>e.types.includes("administrative_area_level_3"))?.long_name||"",a=e.find(e=>e.types.includes("sublocality_level_1"))?.long_name||"",s=e.find(e=>e.types.includes("sublocality_level_2"))?.long_name||"",l=e.find(e=>e.types.includes("locality"))?.long_name||"",i="กรุงเทพมหานคร"===eO(t);t&&(j(!0),v({province:eO(t),district:eO(i?a:r),subDistrict:eO(i?s:n||a||l)}))},[]);return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"text-center mb-6",children:[(0,n.jsx)("h2",{className:"text-[24px] font-[900] text-slate-800",children:"ข้อมูลร้านยา"}),(0,n.jsx)("p",{className:"text-[14px] text-slate-500 mt-1",children:"กรุณาระบุข้อมูลร้านยาที่ต้องการแจ้งเบาะแส"})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["ชื่อร้านยา ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)("input",{type:"text",className:`w-full border rounded-lg p-2.5 text-slate-700 ${u.name?"border-red-500":"border-gray-300"}`,placeholder:"กรอกชื่อร้านยา",value:e.name,onChange:e=>{t({name:e.target.value}),m(e=>({...e,name:""}))}}),u.name&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.name})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"ที่อยู่ร้านยา"}),(0,n.jsx)("textarea",{rows:2,className:"w-full border border-gray-300 rounded-lg p-2.5 text-slate-700 placeholder-gray-400",placeholder:"บ้านเลขที่ ซอย ถนน...",value:e.address,onChange:e=>t({address:e.target.value})})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["จังหวัด ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 ${u.provinceId?"border-red-500":"border-gray-300"}`,value:e.provinceId||"",onChange:e=>{let r=parseInt(e.target.value),n=s.find(e=>e.id===r);t({provinceId:r,districtId:null,subDistrictId:null,zipcode:""}),d(r),m(e=>({...e,provinceId:""})),n&&(h(`${n.name_th} ประเทศไทย`),x(10))},children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),s.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name_th},e.id))]}),u.provinceId&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.provinceId})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["อำเภอ/เขต ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 ${u.districtId?"border-red-500":"border-gray-300"}`,value:e.districtId||"",onChange:r=>{let n=parseInt(r.target.value),a=l.find(e=>e.id===n),i=s.find(t=>
5t.id===e.provinceId);t({districtId:n,subDistrictId:null,zipcode:""}),c(n),m(e=>({...e,districtId:""})),a&&i&&(h(`${a.name_th} ${i.name_th} ประเทศไทย`),x(12))},disabled:!e.provinceId,children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),l.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name_th},e.id))]}),u.districtId&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.districtId})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["ตำบล/แขวง ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsxs)("select",{className:`w-full border rounded-lg p-2 text-slate-700 ${u.subDistrictId?"border-red-500":"border-gray-300"}`,value:e.subDistrictId||"",onChange:r=>{let n=parseInt(r.target.value),a=o.find(e=>e.id===n),i=l.find(t=>t.id===e.districtId),d=s.find(t=>t.id===e.provinceId);t({subDistrictId:n,zipcode:a?.zip_code?String(a.zip_code):""}),m(e=>({...e,subDistrictId:""})),a&&i&&d&&(h(`${a.name_th} ${i.name_th} ${d.name_th} ประเทศไทย`),x(14))},disabled:!e.districtId,children:[(0,n.jsx)("option",{value:"",children:"เลือก"}),o.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name_th},e.id))]}),u.subDistrictId&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:u.subDistrictId})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"รหัสไปรษณีย์"}),(0,n.jsx)("input",{type:"text",readOnly:!0,className:"w-full border border-gray-200 rounded-lg p-2 text-slate-700 bg-gray-50",value:e.zipcode})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"ระบุพิกัดร้านยาบนแผนที่"}),(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("p",{className:"text-xs text-slate-500",children:"เลือกจังหวัด/อำเภอ/ตำบลเพื่อให้แผนที่เลื่อนไป · คลิกบนแผนที่เพื่อปักหมุดและดึงที่อยู่อัตโนมัติ"}),y&&(0,n.jsxs)("span",{className:"text-xs text-amber-600 flex items-center gap-1 shrink-0 ml-3",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[14px] animate-spin",children:"progress_activity"}),"กำลังค้นหาที่อยู่..."]})]}),(0,n.jsx)(D,{apiKey:"AIzaSyA9Jel-X9PHQhcBZONYvErHwLB0VPtA6Dk",language:"th",children:(0,n.jsx)(eD,{lat:e.lat,lng:e.lng,onMapClick:N,onReverseGeocode:w,geocodeTarget:g,geocodeZoom:f})}),(e.lat||e.lng)&&(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsxs)("div",{className:"inline-flex items-center gap-2 text-sm text-slate-600 bg-green-50 border border-green-200 rounded-lg px-3 py-1.5",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-green-600 text-[16px]",children:"location_on"}),(0,n.jsxs)("span",{children:["ละติจูด: ",e.lat?.toFixed(6),", ลองจิจูด: ",e.lng?.toFixed(6)]}),(0,n.jsx)("button",{onClick:()=>t({lat:null,lng:null}),className:"ml-1 text-red-400 hover:text-red-600",children:(0,n.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,n.jsx)("div",{className:"flex-1 h-px bg-gray-200"}),(0,n.jsx)("span",{className:"text-sm font-semibold text-[#686805] px-2",children:"ข้อมูลเภสัชกร"}),(0,n.jsx)("div",{className:"flex-1 h-px bg-gray-200"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-5",children:[(0,n.jsxs)("label",{className:"flex flex-col items-center gap-2 cursor-pointer rounded-xl border-2 p-4 transition-all",style:{borderColor:e.pharmacistKnown?"#686805":"#e5e7eb",background:e.pharmacistKnown?"#fafaf0":"white"},children:[(0,n.jsx)("input",{type:"radio",name:"pharmacist-known",className:"hidden",checked:e.pharmacistKnown,onChange:()=>t({pharmacistKnown:!0})}),(0,n.jsx)("span",{className:"material-symbols-outlined text-3xl",style:{color:e.pharmacistKnown?"#686805":"#9ca3af"},children:"person_search"}),(0,n.jsx)("p",{className:"font-bold text-slate-700 text-sm",children:"ทราบข้อมูล"})]}),(0,n.jsxs)("label",{className:"flex flex-col items-center gap-2 cursor-pointer rounded-xl border-2 p-4 transition-all",style:{borderColor:e.pharmacistKnown?"#e5e7eb":"#686805",background:e.pharmacistKnown?"white":"#fafaf0"},children:[(0,n.jsx)("input",{type:"radio",name:"pharmacist-known",className:"hidden",checked:!e.pharmacistKnown,onChange:()=>t({pharmacistKnown:!1})}),(0,n.jsx)("span",{className:"material-symbols-outlined text-3xl",style:{color:e.pharmacistKnown?"#9ca3af":"#686805"},children:"help"}),(0,n.jsx)("p",{className:"font-bold text-slate-700 text-sm",children:"ไม่ทราบข้อมูล"})]})]}
5),e.pharmacistKnown&&(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"ชื่อ"}),(0,n.jsx)("input",{type:"text",className:"w-full border border-gray-300 rounded-lg p-2.5 text-slate-700",placeholder:"กรอกชื่อเภสัชกร",value:e.pharmacistName,onChange:e=>t({pharmacistName:e.target.value})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"นามสกุล"}),(0,n.jsx)("input",{type:"text",className:"w-full border border-gray-300 rounded-lg p-2.5 text-slate-700",placeholder:"กรอกนามสกุลเภสัชกร",value:e.pharmacistSurname,onChange:e=>t({pharmacistSurname:e.target.value})})]})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"เลขใบประกอบวิชาชีพเภสัชกรรม"}),(0,n.jsx)("input",{type:"text",className:"w-full border border-gray-300 rounded-lg p-2.5 text-slate-700",placeholder:"กรอกเลขใบประกอบวิชาชีพ",value:e.pharmacistLicenseNo,onChange:e=>t({pharmacistLicenseNo:e.target.value})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:"เวลาปฏิบัติหน้าที่"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(eE.TimePicker,{value:e.pharmacistStartTime,onChange:e=>t({pharmacistStartTime:e}),placeholder:"เริ่ม"}),(0,n.jsx)("span",{className:"text-slate-400 shrink-0",children:"–"}),(0,n.jsx)(eE.TimePicker,{value:e.pharmacistEndTime,onChange:e=>t({pharmacistEndTime:e}),placeholder:"สิ้นสุด"})]})]})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-4",children:[(0,n.jsxs)("button",{onClick:()=>r(1),className:"flex items-center gap-2 text-slate-500 hover:text-slate-800 text-sm border border-gray-200 rounded-lg px-4 py-2",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"}),"ย้อนกลับ"]}),(0,n.jsxs)("button",{onClick:()=>{let t={};if(e.name.trim()||(t.name="กรุณากรอกชื่อร้านยา"),e.provinceId||(t.provinceId="กรุณาเลือกจังหวัด"),e.districtId||(t.districtId="กรุณาเลือกอำเภอ/เขต"),e.subDistrictId||(t.subDistrictId="กรุณาเลือกตำบล/แขวง"),Object.keys(t).length>0){m(t),document.querySelector(".error-message")?.scrollIntoView({behavior:"smooth",block:"center"});return}r(3)},className:"bg-[#686805] hover:bg-[#4d6403] text-white px-8 py-3 rounded-lg font-bold flex items-center gap-2 transition-all",children:["ยืนยัน",(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"arrow_forward"})]})]})]})}let eA=(0,s.create)(e=>({queue:[],addToQueue:t=>e(e=>({queue:[...e.queue,...t.map(e=>({id:Math.random().toString(36).substring(7),file:e,status:"pending",progress:0}))]})),updateItem:(t,r)=>e(e=>({queue:e.queue.map(e=>e.id===t?{...e,...r}:e)})),removeFromQueue:t=>e(e=>({queue:e.queue.filter(e=>e.id!==t)})),clearQueue:()=>e({queue:[]})}));var eP=e.i(76743),eT=e.i(31278),eM=e.i(37727),eL=e.i(27612);let ez=["image/jpeg","image/png","image/jpg","application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","audio/mpeg","audio/wav","audio/mp4","video/mp4","video/webm","video/quicktime","video/x-msvideo"];function eR(){let{tipInfo:e,setTipDetails:t,setStep:r,tipReportId:s,setTipReportId:l,setReportNo:d,formToken:c,setFormToken:u,honeypot:m,reset:p}=i(),{queue:g,addToQueue:h,updateItem:f,removeFromQueue:x,clearQueue:b}=eA(),[v,y]=(0,a.useState)({}),[j,N]=(0,a.useState)(!1),[w,I]=(0,a.useState)(!1),[C,E]=(0,a.useState)(!1),[k,O]=(0,a.useState)(""),S=(0,a.useRef)(null),D=e.evidence
5s.length+g.filter(e=>"error"!==e.status).length,_=g.some(e=>["pending","uploading","processing"].includes(e.status));(0,a.useEffect)(()=>{fetch("https://law.pharmacycouncil.org/api/tip-reports/form-token").then(e=>e.json()).then(e=>{e.token&&u(e.token)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{(async()=>{let e=g.find(e=>"pending"===e.status),t=g.some(e=>"uploading"===e.status||"processing"===e.status);e&&!t&&await A(e.id,e.file)})()},[g]);let A=async(e,r)=>{f(e,{status:"uploading",progress:0});try{await new Promise((n,a)=>{let o=new XMLHttpRequest,d=new FormData;d.append("file",r),o.open("POST",`https://law.pharmacycouncil.org/api/tip-reports/${s||0}/upload`),o.upload.onprogress=t=>{if(t.lengthComputable){let r=Math.round(t.loaded/t.total*100);f(e,{status:100===r?"processing":"uploading",progress:r})}},o.onload=()=>{if(o.status>=200&&o.status<300){let a=JSON.parse(o.responseText);a.tipReportId&&!i.getState().tipReportId&&l(a.tipReportId),t({evidences:[...i.getState().tipInfo.evidences,{...a,fileSize:r.size,localName:r.name,fileType:r.type}]}),f(e,{status:"success"}),setTimeout(()=>x(e),1500),n()}else a(Error("Upload failed"))},o.onerror=()=>a(Error("Network error")),o.send(d)})}catch{let n={id:e,fileName:r.name,fileType:r.type,fileSize:r.size,localFile:r,isMock:!0};t({evidences:[...i.getState().tipInfo.evidences,n]}),f(e,{status:"success"}),setTimeout(()=>x(e),1500)}},P=e=>{let t=Array.from(e),r=5-D;if(r<=0)return void y(e=>({...e,files:`แนบได้สูงสุด 5 ไฟล์`}));let n={},a=[];for(let e of t){if(!ez.includes(e.type)){n.files=`ไฟล์ "${e.name}" ไม่รองรับประเภทนี้`;continue}if(e.size>0x6400000){n.files=`ไฟล์ "${e.name}" เกิน 100 MB`;continue}a.length<r&&a.push(e)}Object.keys(n).length>0&&y(e=>({...e,...n})),a.length>0&&(h(a),y(e=>({...e,files:""})))},T=async()=>{let t={};if(e.incidentDate||(t.incidentDate="กรุณาเลือกวันที่พบ"),e.incidentTime||(t.incidentTime="กรุณาเลือกเวลาที่พบ"),e.details.trim()||(t.details="กรุณาอธิบายพฤติกรรมที่พบ"),null===e.consentDisclosure&&(t.consent="กรุณาเลือกการยินยอมเปิดเผยข้อมูล"),_&&(t.files="กรุณารอให้ไฟล์อัพโหลดเสร็จสิ้น"),Object.keys(t).length>0){y(t),document.querySelector(".error-message")?.scrollIntoView({behavior:"smooth",block:"center"});return}I(!0),O("");try{let e=i.getState(),t="https://law.pharmacycouncil.org",r={draftId:e.tipReportId,isAnonymous:e.reporterInfo.isAnonymous,reporterPrefix:e.reporterInfo.prefix,reporterName:e.reporterInfo.name,reporterSurname:e.reporterInfo.surname,reporterPhone:e.reporterInfo.phone,reporterEmail:e.reporterInfo.email,reporterAddress:e.reporterInfo.address,reporterProvinceId:e.reporterInfo.provinceId,reporterDistrictId:e.reporterInfo.districtId,reporterSubDistrictId:e.reporterInfo.subDistrictId,reporterZipcode:e.reporterInfo.zipcode,pharmacyName:e.pharmacyInfo.name,pharmacyAddress:e.pharmacyInfo.address,pharmacyProvinceId:e.pharmacyInfo.provinceId,pharmacyDistrictId:e.pharmacyInfo.districtId,pharmacySubDistrictId:e.pharmacyInfo.subDistrictId,pharmacyZipcode:e.pharmacyInfo.zipcode,pharmacyLat:e.pharmacyInfo.lat,pharmacyLng:e.pharmacyInfo.lng,pharmacistKnown:e.pharmacyInfo.pharmacistKnown,pharmacistName:e.pharmacyInfo.pharmacistName,pharmacistSurname:e.pharmacyInfo.pharmacistSurname,pharmacistLicenseNo:e.pharmacyInfo.pharmacistLicenseNo,pharmacistStartTime:e.pharmacyInfo.pharmacistStartTime,pharmacistEndTime:e.pharmacyInfo.pharmacistEndTime,incidentDate:e.tipInfo.incidentDate,incidentTime:e.tipInfo.incidentTime,behaviorDetails:e.tipInfo.details,consentDisclosure:e.tipInfo.consentDisclosure},n=await fetch(`${t}/api/tip-reports`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.message||"ไม่สามารถบันทึกข้อมูลได้")}let a=(await n.json()).id;l(a);let s=await fetch(`${t}/api/tip-reports/${a}/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({formToken:c,website:m})});if(!s.ok){let e=await s.json().catch(()=>null);throw Error(e?.message||"ไม่สามารถส่งเบาะแสได้")}let o=await s.json();d(o.reportNo||""),E(!0)}catch(e){O(e instanceof Error?e.message:"เกิดข้อผิดพลาด กรุณาลองใหม่อีกครั้ง")}finally{I(!1)}};return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{className:"text-center mb-6",children:[(0,n.jsx)("h2",{className:"text-[24px] font-[900] text-slate-800",children:"ข้อมูลเบาะแส"}),(0,n.jsx)("p",{className:"text-[14px] text-slate-500 mt-1",children:"ระบุรายละเอียดเบาะแสที่พบเห็น"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["วันที่พบ ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)(eP.DatePicker,{value:e.incidentDate,onChange:e=>{t({incidentDate:e}),y(e=>({...e,incidentDate:""}))},placeholder:"เลือกวันที่",error:!!v.incidentDate}),v.incidentDate&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:v.incidentDate})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["เวลาที่พบ ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)(eE.TimePicker,{value:e.incidentTime,onChange:e=>{t({incidentTime:e}),y(e=>({...e,incidentTime:""}))},placeholder:"เลือกเวลา",error:!!v.incidentTime}),v.incidentTime&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:v.incidentTime})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"block text-sm font-medium mb-1 text-slate-700",children:["พฤติกรรม ",(0,n.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,n.jsx)("textarea",{rows:5,className:`w-full border rounded-lg p-3 text-slate-700 placeholder-gray-400 resize-none ${v.details?"border-red-500":"border-gray-300"}`,placeholder:"อธิบายพฤติกรรมที่พบ...",value:e.details,onChange:e=>{t({details:e.target.value}),y(e=>({...e,details:""}))}}),v.details&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-1 error-message",children:v.details})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-slate-700",children:"แนบหลักฐาน"}),(0,n.jsx)("span",{className:"text-xs bg-gray-100 text-slate-500 px-2 py-0.5 rounded-full",children:"ถ้ามี"})]}),(0,n.jsx)("input",{ref:S,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.pdf,.docx,.mp3,.wav,.mp4,.webm,.mov,.avi",className:"hidden",onChange:e=>{e.target.files&&P(e.target.files),e.target.value=""}}),D<5&&(0,n.jsxs)("div",{onClick:()=>S.current?.click(),onDragOver:e=>{e.preventDefault(),N(!0)},onDragEnter:e=>{e.preventDefault(),N(!0)},onDragLeave:()=>N(!1),onDrop:e=>{e.preventDefault(),N(!1),e.dataTransfer.files&&P(e.dataTransfer.files)},className:`border-2 border-dashed rounded-xl p-8 text-center cursor-pointer transition-colors ${j?"border-[#686805] bg-[#fafaf0]":"border-[#c8b84a] bg-[#fdfdf5] hover:bg-[#fafaf0]"}`,children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-4xl text-[#686805] mb-2 block",children:"cloud_upload"}),(0,n.jsx)("p",{className:"text-sm font-medium text-slate-700",children:"คลิกหรือลากไฟล์มาวาง"}),(0,n.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["รองรับ: JPG, PNG, PDF, DOC, DOCX, MP3, WAV, MP4, WebM, MOV, AVI",D>0?` \xb7 เหลือ ${5-D} ไฟล์`:""]})]}),v.files&&(0,n.jsx)("p",{className:"text-red-500 text-xs mt-2 error-message",children:v.files}
5),e.evidences.length>0&&(0,n.jsx)("div",{className:"mt-3 space-y-2",children:e.evidences.map(r=>{var a,s;return(0,n.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-green-50 border border-green-200 rounded-lg",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-green-600 text-[20px]",children:(a=r.fileType||"").startsWith("image/")?"image":"application/pdf"===a?"picture_as_pdf":a.startsWith("video/")?"videocam":a.startsWith("audio/")?"audio_file":"description"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-slate-700 truncate",children:r.localName||r.fileName}),r.fileSize&&(0,n.jsx)("p",{className:"text-xs text-slate-500",children:(s=r.fileSize)<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`})]}),(0,n.jsx)("button",{onClick:()=>t({evidences:e.evidences.filter(e=>e.id!==r.id)}),className:"text-red-400 hover:text-red-600 shrink-0",children:(0,n.jsx)(eL.Trash2,{className:"w-4 h-4"})})]},r.id)})}),g.length>0&&(0,n.jsx)("div",{className:"mt-2 space-y-2",children:g.map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-white border border-gray-200 rounded-lg",children:["success"===e.status?(0,n.jsx)(o.Check,{className:"w-4 h-4 text-green-500 shrink-0"}):"error"===e.status?(0,n.jsx)(eM.X,{className:"w-4 h-4 text-red-500 shrink-0"}):(0,n.jsx)(eT.Loader2,{className:"w-4 h-4 text-[#686805] animate-spin shrink-0"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-sm text-slate-700 truncate",children:e.file.name}),"uploading"===e.status&&(0,n.jsx)("div",{className:"mt-1 h-1 bg-gray-200 rounded-full overflow-hidden",children:(0,n.jsx)("div",{className:"h-full bg-[#686805] transition-all duration-300",style:{width:`${e.progress}%`}})}),"processing"===e.status&&(0,n.jsx)("p",{className:"text-xs text-blue-500",children:"กำลังประมวลผล..."}),"error"===e.status&&(0,n.jsx)("p",{className:"text-xs text-red-500",children:e.errorMsg||"เกิดข้อผิดพลาด"})]}),"error"===e.status&&(0,n.jsx)("button",{onClick:()=>x(e.id),className:"text-gray-400 hover:text-gray-600",children:(0,n.jsx)(eM.X,{className:"w-4 h-4"})})]},e.id))})]}),(0,n.jsxs)("div",{className:`border rounded-xl p-4 space-y-3 ${v.consent?"border-red-400 bg-red-50":"border-gray-200"}`,children:[(0,n.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,n.jsx)("input",{type:"radio",name:"consent",className:"accent-[#686805] w-4 h-4",checked:!0===e.consentDisclosure,onChange:()=>{t({consentDisclosure:!0}),y(e=>({...e,consent:""}))}}),(0,n.jsx)("span",{className:"text-sm text-slate-700",children:"ข้าพเจ้ายินยอมให้เปิดเผยข้อมูล"})]}),(0,n.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,n.jsx)("input",{type:"radio",name:"consent",className:"accent-[#686805] w-4 h-4",checked:!1===e.consentDisclosure,onChange:()=>{t({consentDisclosure:!1}),y(e=>({...e,consent:""}))}}),(0,n.jsx)("span",{className:"text-sm text-slate-700",children:"ข้าพเจ้าไม่ยินยอมให้เปิดเผยข้อมูล"})]}),v.consent&&(0,n.jsx)("p",{className:"text-red-500 text-xs error-message",children:v.consent})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,n.jsxs)("button",{onClick:()=>r(2),className:"flex items-center gap-2 text-slate-500 hover:text-slate-800 text-sm border border-gray-200 rounded-lg px-5 py-2.5",children:[(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"}),"ย้อนกลับ"]}),(0,n.jsx)("button",{onClick:T,disabled:w||_,className:"bg-[#686805] hover:bg-[#4d6403] disabled:opacity-60 text-white px-8 py-3 rounded-lg font-bold flex items-center gap-2 transition-all",children:w?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eT.Loader2,{className:"w-4 h-4 animate-spin"}),"กำลังส่ง..."]}):(0,n.jsxs)(n.Fragment,{children:["ส่งข้อมูล",(0,n.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"send"})]})})]}),C&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-8 w-full max-w-sm mx-4 text-center",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-green-100 mx-auto mb-4",children:(0,n.jsx)(o.Check,{className:"w-8 h-8 text-green-500",strokeWidth:3})}),(0,n.jsx)("h3",{className:"text-[20px] font-[900] text-slate-800 mb-2",children:"ขอขอบคุณที่แจ้งเบาะแส"}),(0,n.jsx)("p",{className:"text-sm text-slate-500 leading-relaxed",children:"ข้อมูลของคุณถูกส่งเข้าระบบเรียบร้อยแล้ว เราจะดำเนินการตรวจสอบโดยเร็วที่สุด"}),(0,n.jsx)("button",{onClick:()=>{p(),b(),window.location.href="https://pharmacycouncil.org"},className:"mt-6 w-full bg-[#686805] hover:bg-[#4d6403] text-white py-3 rounded-xl font-bold transition-all",children:"ตกลง"})]})}),k&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-8 w-full max-w-sm mx-4 text-center",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-red-100 mx-auto mb-4",children:(0,n.jsx)(eM.X,{className:"w-8 h-8 text-red-500",strokeWidth:3})}),(0,n.jsx)("h3",{className:"text-[20px] font-[900] text-slate-800 mb-2",children:"ส่งข้อมูลไม่สำเร็จ"}),(0,n.jsx)("p",{className:"text-sm text-slate-500 leading-relaxed",children:k}),(0,n.jsx)("button",{onClick:()=>O(""),className:"mt-6 w-full bg-[#686805] hover:bg-[#4d6403] text-white py-3 rounded-xl font-bold transition-all",children:"ลองอีกครั้ง"})]})})]})}
5let e$=(0,e.i(75254).default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);function eF(){let{reportNo:e,pharmacyInfo:t,reset:r}=i();return(0,n.jsxs)("div",{className:"flex flex-col items-center text-center py-8 space-y-6",children:[(0,n.jsx)("div",{className:"w-20 h-20 bg-green-100 rounded-full flex items-center justify-center",children:(0,n.jsx)(e$,{className:"w-10 h-10 text-green-600"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"text-[28px] font-[900] text-slate-800 mb-2",children:"ส่งเบาะแสสำเร็จ"}),(0,n.jsx)("p",{className:"text-slate-500 text-[15px] leading-relaxed max-w-md",children:"ขอบคุณที่ช่วยแจ้งเบาะแส เจ้าหน้าที่สภาเภสัชกรรมจะตรวจสอบข้อมูลและดำเนินการต่อไป"})]}),e&&(0,n.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-2xl p-6 w-full max-w-sm",children:[(0,n.jsx)("p",{className:"text-sm text-amber-700 font-medium mb-1",children:"เลขที่รับเรื่อง"}),(0,n.jsx)("p",{className:"text-3xl font-black text-amber-800 tracking-wider",children:e}),(0,n.jsx)("p",{className:"text-xs text-amber-600 mt-2",children:"กรุณาบันทึกเลขที่รับเรื่องนี้ไว้เพื่อการอ้างอิง"})]}),t.name&&(0,n.jsxs)("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-4 w-full max-w-sm text-left",children:[(0,n.jsx)("p",{className:"text-xs text-slate-500 mb-1",children:"ร้านยาที่แจ้ง"}),(0,n.jsx)("p",{className:"font-semibold text-slate-700",children:t.name}),t.address&&(0,n.jsx)("p",{className:"text-sm text-slate-500 mt-0.5",children:t.address})]}),(0,n.jsxs)("div",{className:"bg-blue-50 border border-blue-100 rounded-xl p-4 w-full max-w-sm text-left",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-blue-800 mb-2",children:"ขั้นตอนต่อไป"}),(0,n.jsxs)("ol",{className:"text-sm text-blue-700 space-y-1 list-decimal list-inside",children:[(0,n.jsx)("li",{children:"เจ้าหน้าที่รับเรื่องและออกเลขที่รับเรื่อง"}),(0,n.jsx)("li",{children:"ตรวจสอบข้อมูลและลงพื้นที่ตรวจสอบ"}),(0,n.jsx)("li",{children:"ดำเนินการตามกฎหมายหากพบการกระทำผิด"})]})]}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 w-full max-w-sm pt-2",children:[(0,n.jsx)("button",{onClick:()=>r(),className:"flex-1 border border-[#686805] text-[#686805] hover:bg-[#f5f5e8] px-6 py-3 rounded-lg font-medium transition-all",children:"แจ้งเบาะแสอีกครั้ง"}),(0,n.jsx)("a",{href:"https://pharmacycouncil.org",className:"flex-1 bg-[#686805] hover:bg-[#4d6403] text-white px-6 py-3 rounded-lg font-medium text-center transition-all",children:"กลับหน้าหลัก"})]})]})}function eH(){let{step:e,honeypot:t,setFormToken:r,setHoneypot:s}=i();return(0,a.useEffect)(()=>{fetch("https://law.pharmacycouncil.org/api/tip-reports/form-token").then(e=>e.json()).then(e=>{e.token&&r(e.token)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{window.scrollTo({top:0,behavior:"smooth"})},[e]),(0,n.jsxs)("div",{className:"max-w-3xl mx-auto p-3 md:p-6 bg-white rounded-xl my-4 md:my-10 relative",children:[(0,n.jsx)("input",{type:"text",name:"website",tabIndex:-1,autoComplete:"off","aria-hidden":"true",value:t,onChange:e=>s(e.target.value),style:{position:"absolute",left:"-9999px",opacity:0,height:0,width:0,overflow:"hidden"}}),e>=1&&e<=3&&(0,n.jsx)("div",{className:"mb-8",children:(0,n.jsx)(m,{currentStep:e})}),(0,n.jsxs)("div",{className:"min-h-[400px]",children:[1===e&&(0,n.jsx)(g,{}),2===e&&(0,n.jsx)(e_,{}),3===e&&(0,n.jsx)(eR,{}),4===e&&(0,n.jsx)(eF,{})]})]})}e.s(["default",()=>eH],34737)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.