PageSourceSearch

https://jhasolutions.com/assets/StaffWorkMapView-7nObp5Jm.js

js jhasolutions.com collected 2026-09-24 14:46:54 UTC 38,942 bytes, 11 lines download raw bytes

1import{r as a,a as S,j as s}from"./query-vendor-Dp9tfhuh.js";import{D as je,p as we,q as _e,r as Ce,L as me,X as Ue,b as re,B as P,s as oe,a as Z,w as Fe,h as pe,m as ge,N as $e,o as Re}from"./index-CgOeqv80.js";import{B as q}from"./badge-CarGzGVG.js";import{a as Be,b as fe,v as He,c as Ge}from"./useStaffWorkMaps-exVned1m.js";import{r as Ve,e as Ze}from"./react-vendor-DfslLuwi.js";import{i as qe}from"./index-CqDoGRXG.js";import{a as We}from"./googleMaps-CnGBkgZD.js";import{S as he}from"./scroll-area-DpCy8yLM.js";import{T as Je}from"./textarea-BSB7eVDL.js";import{C as ie}from"./circle-check-CLkepror.js";import{I as Ke}from"./image-plus-xT5L-tET.js";import{U as Ye}from"./upload-55xlfOPi.js";import{I as Xe}from"./input-go5takyh.js";import{M as ae}from"./map-pin-B63H-upO.js";import{L as Qe}from"./lock-B0M9hAnN.js";import{K as et}from"./key-round-Dh3U7Shh.js";import{C as xe}from"./clipboard-list-FvLR_NG8.js";import{C as tt}from"./clock-BmPJ466V.js";import{L as st}from"./list-BJoWfKXY.js";import{M as nt}from"./map-C8rxfYCS.js";import{C as rt}from"./chevron-down-Bm2Y15mk.js";import{C as ot}from"./chevron-up-DVBQQKr7.js";import{F as ve}from"./file-text-CuOiBfSM.js";import{N as be}from"./navigation-mR6QetLo.js";import{E as at}from"./external-link-BIGsQXrz.js";import"./ui-vendor-DW4RoVmg.js";import"./chart-vendor-BoynbIzZ.js";import"./index-BdQq_4o_.js";const it="1.7.1";function G(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function le(t,e,n,r){function i(l){return l instanceof n?l:new n(function(d){d(l)})}return new(n||(n=Promise))(function(l,d){function c(u){try{m(r.next(u))}catch(f){d(f)}}function p(u){try{m(r.throw(u))}catch(f){d(f)}}function m(u){u.done?l(u.value):i(u.value).then(c,p)}m((r=r.apply(t,[])).next())})}const z={NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED",FAILED:"FAILED",AUTH_FAILURE:"AUTH_FAILURE"},lt="https://maps.googleapis.com/maps/api/js";class Q{static load(e,n){return le(this,void 0,void 0,function*(){var r,i;const l=e.libraries?e.libraries.split(","):[],d=this.serializeParams(e);this.listeners.push(n),!((i=(r=window.google)===null||r===void 0?void 0:r.maps)===null||i===void 0)&&i.importLibrary?(this.serializedApiParams||(this.loadingStatus=z.LOADED),this.notifyLoadingStatusListeners()):(this.serializedApiParams=d,this.initImportLibrary(e)),this.serializedApiParams&&this.serializedApiParams!==d&&console.warn("[google-maps-api-loader] The maps API has already been loaded with different parameters and will not be loaded again. Refresh the page for new values to have effect.");const c=["maps",...l];yield Promise.all(c.map(p=>google.maps.importLibrary(p)))})}static serializeParams(e){return[e.v,e.key,e.language,e.region,e.authReferrerPolicy,e.solutionChannel].join("/")}static initImportLibrary(e){if(window.google||(window.google={}),window.google.maps||(window.google.maps={}),window.google.maps.importLibrary){console.error("[google-maps-api-loader-internal]: initImportLibrary must only be called once");return}let n=null;const r=()=>n||(n=new Promise((i,l)=>{var d;const c=document.createElement("script"),p=new URLSearchParams;for(const[m,u]of Object.entries(e)){const f=m.replace(/[A-Z]/g,b=>"_"+b[0].toLowerCase());p.set(f,String(u))}p.set("loading","async"),p.set("callback","__googleMapsCallback__"),c.async=!0,c.src=lt+"?"+p.toString(),c.nonce=((d=document.querySelector("script[nonce]"))===null||d===void 0?void 0:d.nonce)||"",c.onerror=()=>{this.loadingStatus=z.FAILED,this.notifyLoadingStatusListeners(),l(new Error("The Google Maps JavaScript API could not load."))},window.__googleMapsCallback__=()=>{this.loadingStatus=z.LOADED,this.notifyLoadingStatusListeners(),i()},window.gm_authFailure=()=>{this.loadingStatus=z.AUTH_FAILURE,this.notifyLoadingStatusListeners()},this.loadingStatus=z.LOADING,this.notifyLoadingStatusListeners(),document.head.append(c)}),n);google.maps.importLibrary=i=>r().then(()=>google.maps.importLibrary(i))}static notifyLoadingStatusListeners(){for(const e of this.listeners)e(this.loadingStatus)}}Q.loadingStatus=z.NOT_LOADED;Q.listeners=[];const ct="GMP_visgl_rgmlibrary_v1_default",dt=[`gmp_visgl_reactgooglemaps_v${it}`],W=S.createContext(null);function ut(){const[t,e]=a.useState({});return{mapInstances:t,addMapInstance:(l,d="default")=>{e(c=>Object.assign(Object.assign({},c),{[d]:l}))},removeMapInstance:(l="default")=>{e(d=>{var c=l;d[c];var p=G(d,[typeof c=="symbol"?c:c+""]);return p})},clearMapInstances:()=>{e({})}}}function mt(t){const{onLoad:e,onError:n,apiKey:r,version:i,libraries:l=[]}=t,d=G(t,["onLoad","onError","apiKey","version","libraries"]),[c,p]=a.use
1State(Q.loadingStatus),[m,u]=a.useReducer((g,N)=>g[N.name]?g:Object.assign(Object.assign({},g),{[N.name]:N.value}),{}),f=a.useMemo(()=>l==null?void 0:l.join(","),[l]),b=a.useMemo(()=>JSON.stringify(Object.assign({apiKey:r,version:i},d)),[r,i,d]),x=a.useCallback(g=>le(this,void 0,void 0,function*(){var N;if(m[g])return m[g];if(!(!((N=google==null?void 0:google.maps)===null||N===void 0)&&N.importLibrary))throw new Error("[api-provider-internal] importLibrary was called before google.maps.importLibrary was defined.");const C=yield window.google.maps.importLibrary(g);return u({name:g,value:C}),C}),[m]);return a.useEffect(()=>{le(this,void 0,void 0,function*(){try{const g=Object.assign({key:r},d);i&&(g.v=i),(f==null?void 0:f.length)>0&&(g.libraries=f),(g.channel===void 0||g.channel<0||g.channel>999)&&delete g.channel,g.solutionChannel===void 0?g.solutionChannel=ct:g.solutionChannel===""&&delete g.solutionChannel,yield Q.load(g,N=>p(N));for(const N of["core","maps",...l])yield x(N);e&&e()}catch(g){n?n(g):console.error("<ApiProvider> failed to load the Google Maps JavaScript API",g)}})},[r,f,b]),{status:c,loadedLibraries:m,importLibrary:x}}function pt(t){return a.useMemo(()=>t.disableUsageAttribution?null:dt,[t.disableUsageAttribution])}const gt=t=>{const{children:e}=t,n=G(t,["children"]),{mapInstances:r,addMapInstance:i,removeMapInstance:l,clearMapInstances:d}=ut(),{status:c,loadedLibraries:p,importLibrary:m}=mt(n),u=pt(n),f=a.useMemo(()=>({mapInstances:r,addMapInstance:i,removeMapInstance:l,clearMapInstances:d,status:c,loadedLibraries:p,importLibrary:m,internalUsageAttributionIds:u}),[r,i,l,d,c,p,m,u]);return S.createElement(W.Provider,{value:f},e)};function ft(t,e){for(const n of bt){const r=e[n],i=ke[n];a.useEffect(()=>{if(!t||!r)return;const l=google.maps.event.addListener(t,i,d=>{r(ht(i,t,d))});return()=>l.remove()},[t,i,r])}}function ht(t,e,n){var r;const i={type:t,map:e,detail:{},stoppable:!1,stop:()=>{}};if(xt.includes(t)){const l=i,d=e.getCenter(),c=e.getZoom(),p=e.getHeading()||0,m=e.getTilt()||0,u=e.getBounds();return(!d||!u||!Number.isFinite(c))&&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"),l.detail={center:(d==null?void 0:d.toJSON())||{lat:0,lng:0},zoom:c||0,heading:p,tilt:m,bounds:(u==null?void 0:u.toJSON())||{north:90,east:180,south:-90,west:-180}},l}else if(vt.includes(t)){if(!n)throw new Error("[createEvent] mouse events must provide a srcEvent");const l=i;return l.domEvent=n.domEvent,l.stoppable=!0,l.stop=()=>n.stop(),l.detail={latLng:((r=n.latLng)===null||r===void 0?void 0:r.toJSON())||null,placeId:n.placeId},l}return i}const ke={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:"mousemove",onMouseout:"mouseout",onMouseover:"mouseover",onProjectionChanged:"projection_changed",onRenderingTypeChanged:"renderingtype_changed",onTilesLoaded:"tilesloaded",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed",onCameraChanged:"bounds_changed"},xt=["bounds_changed","center_changed","heading_changed","tilt_changed","zoom_changed"],vt=["click","contextmenu","dblclick","mousemove","mouseout","mouseover"],bt=Object.keys(ke);function yt(t){const e=a.useRef(void 0);return a.useEffect(()=>{e.current=t}),e.current}function Nt(t,e){const n=yt(t);return a.useMemo(()=>n&&e(n,t)?n:t,[t,n,e])}function jt(t,e,n){a.useEffect(t,[Nt(e,n)])}function wt(t,e){jt(t,e,qe)}const _t=new Set(["backgroundColor","clickableIcons","controlSize","disableDefaultUI","disableDoubleClickZoom","draggable","draggableCursor","draggingCursor","fullscreenControl","fullscreenControlOptions","gestureHandling","headingInteractionEnabled","isFractionalZoomEnabled","keyboardShortcuts","mapT
1ypeControl","mapTypeControlOptions","mapTypeId","maxZoom","minZoom","noClear","panControl","panControlOptions","restriction","rotateControl","rotateControlOptions","scaleControl","scaleControlOptions","scrollwheel","streetView","streetViewControl","streetViewControlOptions","styles","tiltInteractionEnabled","zoomControl","zoomControlOptions"]);function Ct(t,e){const n={},r=Object.keys(e);for(const i of r)_t.has(i)&&(n[i]=e[i]);wt(()=>{t&&t.setOptions(n)},[n])}function Ee(){var t;return((t=a.useContext(W))===null||t===void 0?void 0:t.status)||z.NOT_LOADED}function kt(t,e){const{viewport:n,viewState:r}=e,i=!!n;return a.useLayoutEffect(()=>{if(!t||!r)return;const{latitude:l,longitude:d,bearing:c,pitch:p,zoom:m}=r;t.moveCamera({center:{lat:l,lng:d},heading:c,tilt:p,zoom:m+1})},[t,r]),i}function Et(t){return!t||typeof t!="object"||!("lat"in t&&"lng"in t)?!1:Number.isFinite(t.lat)&&Number.isFinite(t.lng)}function Se(t){return Et(t)?t:t.toJSON()}function St(t,e,n){const r=n.center?Se(n.center):null;let i=null,l=null;r&&Number.isFinite(r.lat)&&Number.isFinite(r.lng)&&(i=r.lat,l=r.lng);const d=Number.isFinite(n.zoom)?n.zoom:null,c=Number.isFinite(n.heading)?n.heading:null,p=Number.isFinite(n.tilt)?n.tilt:null;a.useLayoutEffect(()=>{if(!t)return;const m={};let u=!1;i!==null&&l!==null&&(e.current.center.lat!==i||e.current.center.lng!==l)&&(m.center={lat:i,lng:l},u=!0),d!==null&&e.current.zoom!==d&&(m.zoom=d,u=!0),c!==null&&e.current.heading!==c&&(m.heading=c,u=!0),p!==null&&e.current.tilt!==p&&(m.tilt=p,u=!0),u&&t.moveCamera(m)})}const Lt=()=>{const t={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"};return S.createElement("div",{style:t},S.createElement("h2",null,"Error: AuthFailure"),S.createElement("p",null,"A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",S.createElement("code",null,"APIProvider.apiKey")," prop is correct. Check the error-message in the console for further details."))};function Mt(){const[t,e]=a.useState(null),n=a.useCallback(r=>e(r),[e]);return[t,n]}function Le(){return Ee()===z.LOADED}function It(){const[,t]=a.useReducer(e=>e+1,0);return t}function At(t,e){const n=t.getCenter(),r=t.getZoom(),i=t.getHeading()||0,l=t.getTilt()||0,d=t.getBounds();(!n||!d||!Number.isFinite(r))&&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(e.current,{center:(n==null?void 0:n.toJSON())||{lat:0,lng:0},zoom:r||0,heading:i,tilt:l})}function Ot(t){const e=It(),n=a.useRef({center:{lat:0,lng:0},heading:0,tilt:0,zoom:0});return a.useEffect(()=>{if(!t)return;const r=google.maps.event.addListener(t,"bounds_changed",()=>{At(t,n),e()});return()=>r.remove()},[t,e]),n}class X{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,n){this.entries[e]||(this.entries[e]=[]),this.entries[e].push(n)}}X.entries={};function Pt(t,e){const n=Le(),[r,i]=a.useState(null),[l,d]=Mt(),c=Ot(r),{id:p,defaultBounds:m,defaultCenter:u,defaultZoom:f,defaultHeading:b,defaultTilt:x,reuseMaps:g,renderingType:N,colorScheme:C}=t,h=G(t,["id","defaultBounds","defaultCenter","defaultZoom","defaultHeading","defaultTilt","reuseMaps","renderingType","colorScheme"]),v=t.zoom!==void 0||t.defaultZoom!==void 0,j=t.center!==void 0||t.defaultCenter!==void 0;!m&&(!v||!j)&&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"),!h.center&&u&&(h.center=u),!h.zoom&&Number.isFinite(f)&&(h.zoom=f),!h.heading&&Number.isFinite(b)&&(h.heading=b),!h.tilt&&Number.isFinite(x)&&(h.tilt=x);const w=h.internalUsageAttributionIds;w==null?h.internalUsageAttributionIds=e.internalUsageAttributionIds:h.internalUsageAttributionIds=[...e.internalUsageAttributionIds||[],...w];for(const D of Object.keys(h))h[D]===void 0&&delete h[D];const k=a.useRef(void 0);return a.useEffect(()=>{if(!l||!n)return;const{addMapInstance:D,removeMapInstance:T}=e,{mapId:E}=t,I=`${E||"default"}:${N||"default"}:${C||"LIGHT"}`;let L,M;if(g&&X.has(I)?(M=X.pop(I),L=M.getDiv(),l.appendChild(L),M.setOptions(h),setTimeout(()=>M.setCenter(M.getCenter()),0)):(L=document.createElement("div"),L.style.height="100%",l.appendChild(L),M=new google.maps.Map(L,Object.assign(Object.assign(Object.assign({},h),N?{renderingType:N}:{}),C?{colorScheme:C}:{}))),i(M),D(M,p),m){const{padding:R}=m,F=G(m,["padding"]);M.fitBounds(F,R)}else(!v||!j)&&M.fitBounds({east:180,west:-180,south:-90,north:90});
1if(k.current){const{mapId:R,cameraState:F}=k.current;R!==E&&M.setOptions(F)}return()=>{k.current={mapId:E,cameraState:c.current},L.remove(),g?X.push(I,M):google.maps.event.clearInstanceListeners(M),i(null),T(p)}},[l,n,p,t.mapId,t.renderingType,t.colorScheme]),[r,d,c]}const Me=S.createContext(null),Ie=t=>{const{children:e,id:n,className:r,style:i}=t,l=a.useContext(W),d=Ee();if(!l)throw new Error("<Map> can only be used inside an <ApiProvider> component.");const[c,p,m]=Pt(t,l);St(c,m,t),ft(c,t),Ct(c,t);const u=kt(c,t),f=!!t.controlled;a.useEffect(()=>{if(c)return u&&c.setOptions({disableDefaultUI:!0}),(u||f)&&c.setOptions({gestureHandling:"none",keyboardShortcuts:!1}),()=>{c.setOptions({gestureHandling:t.gestureHandling,keyboardShortcuts:t.keyboardShortcuts})}},[c,u,f,t.gestureHandling,t.keyboardShortcuts]);const b=t.center?Se(t.center):null;let x=null,g=null;b&&Number.isFinite(b.lat)&&Number.isFinite(b.lng)&&(x=b.lat,g=b.lng);const N=a.useMemo(()=>{var v,j,w;return{center:{lat:x??0,lng:g??0},zoom:(v=t.zoom)!==null&&v!==void 0?v:0,heading:(j=t.heading)!==null&&j!==void 0?j:0,tilt:(w=t.tilt)!==null&&w!==void 0?w:0}},[x,g,t.zoom,t.heading,t.tilt]);a.useLayoutEffect(()=>{if(!c||!f)return;c.moveCamera(N);const v=c.addListener("bounds_changed",()=>{c.moveCamera(N)});return()=>v.remove()},[c,f,N]);const C=a.useMemo(()=>Object.assign({width:"100%",height:"100%",position:"relative",zIndex:u?-1:0},i),[i,u]),h=a.useMemo(()=>({map:c}),[c]);return d===z.AUTH_FAILURE?S.createElement("div",{style:Object.assign({position:"relative"},r?{}:C),className:r},S.createElement(Lt,null)):S.createElement("div",Object.assign({ref:p,"data-testid":"map",style:r?void 0:C,className:r},n?{id:n}:{}),c?S.createElement(Me.Provider,{value:h},e):null)};Ie.deckGLViewProps=!0;const ye=new Set;function Dt(...t){const e=JSON.stringify(t);ye.has(e)||(ye.add(e),console.error(...t))}const Ae=(t=null)=>{const e=a.useContext(W),{map:n}=a.useContext(Me)||{};if(e===null)return Dt("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;const{mapInstances:r}=e;return t!==null?r[t]||null:n||r.default||null};function Tt(t){const e=Le(),n=a.useContext(W);return a.useEffect(()=>{!e||!n||n.importLibrary(t)},[e,n,t]),(n==null?void 0:n.loadedLibraries[t])||null}function K(t,e,n){a.useEffect(()=>{if(!t||!e||!n)return;const r=google.maps.event.addListener(t,e,n);return()=>r.remove()},[t,e,n])}function Y(t,e,n){a.useEffect(()=>{t&&(t[e]=n)},[t,e,n])}function Ne(t,e,n){a.useEffect(()=>{if(!(!t||!e||!n))return t.addEventListener(e,n),()=>t.removeEventListener(e,n)},[t,e,n])}class zt{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;const 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())}}const Ut=new zt;function Ft(t,e){var n;if(!(!((n=google==null?void 0:google.maps)===null||n===void 0)&&n.version))return;const r=google.maps.version.split("."),i=parseInt(r[0],10),l=parseInt(r[1],10);return i>t||i===t&&l>=e}const $t=S.createContext(null),Rt={BOTTOM:["50%","100%"]},Oe=a.forwardRef((t,e)=>{const{children:n,style:r,className:i,anchorPoint:l}=t,[d,c]=Ht(t),p=a.useMemo(()=>d?{marker:d}:null,[d]);return a.useImperativeHandle(e,()=>d,[d]),c?S.createElement($t.Provider,{value:p},Ve.createPortal(S.createElement(Bt,{anchorPoint:l,styles:r,className:i},n),c)):null});Oe.displayName="AdvancedMarker";function ce(t){return t.nodeType===Node.ELEMENT_NODE}const Bt=({children:t,styles:e,className:n})=>S.createElement("div",{className:n,style:e},t);function Ht(t){const[e,n]=a.useState(null),[r,i]=a.useState(null),l=Ae(),d=Tt("marker"),{children:c,onClick:p,className:m,onMouseEnter:u,onMouseLeave:f,onDrag:b,onDragStart:x,onDragEnd:g,collisionBehavior:N,clickable:C,draggable:h,position:v,title:j,zIndex:w,anch
5orPoint:k,anchorLeft:D,anchorTop:T}=t,E=a.Children.count(c);return a.useEffect(()=>{if(!l||!d)return;const I=new d.AdvancedMarkerElement;I.map=l,n(I);let L=null;return E>0&&(L=document.createElement("div"),I.content=L,i(L)),()=>{I.map=null,L==null||L.remove(),n(null),i(null)}},[l,d,E]),a.useEffect(()=>{!(e!=null&&e.content)||!ce(e.content)||E>0||(e.content.className=m??"")},[e,m,E]),Gt(e,k,D,T,E>0),Y(e,"position",v),Y(e,"title",j??""),Y(e,"zIndex",w),Y(e,"collisionBehavior",N),a.useEffect(()=>{e&&(h!==void 0?e.gmpDraggable=h:b||x||g?e.gmpDraggable=!0:e.gmpDraggable=!1)},[e,h,b,g,x]),a.useEffect(()=>{if(!e)return;const I=C!==void 0||!!p||!!u||!!f;e.gmpClickable=I,I&&(e!=null&&e.content)&&ce(e.content)&&(e.content.style.pointerEvents="all",p&&(e.content.style.cursor="pointer"))},[e,C,p,u,f]),K(e,"click",p),K(e,"drag",b),K(e,"dragstart",x),K(e,"dragend",g),Ne(e==null?void 0:e.element,"mouseenter",u),Ne(e==null?void 0:e.element,"mouseleave",f),[e,r]}function Gt(t,e,n,r,i){a.useEffect(()=>{if(!t||!i)return;const l=Ft(3,62),d=t.content;if(!(!d||!ce(d))){if(n!==void 0||r!==void 0){l||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=r,e!==void 0&&console.warn("AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.");return}if(e!==void 0){const[c,p]=e??Rt.BOTTOM,m=`calc(-1 * ${c})`,u=`calc(-1 * ${p})`;l?(t.anchorLeft=m,t.anchorTop=u,d.style.transform=""):(d.style.transform=`translate(50%, 100%) translate(${m}, ${u})`,t.dataset.origin="rgm",Ut.addAdvancedMarkerPointerEventsOverwrite())}}},[t,e,n,r,i])}function Vt(t){const[e,n]=a.useState(null),r=Ae(),{onClick:i,onDrag:l,onDragStart:d,onDragEnd:c,onMouseOver:p,onMouseOut:m}=t,u=G(t,["onClick","onDrag","onDragStart","onDragEnd","onMouseOver","onMouseOut"]),{position:f,draggable:b}=u;return a.useEffect(()=>{if(!r){r===void 0&&console.error("<Marker> has to be inside a Map component.");return}const x=new google.maps.Marker(u);return x.setMap(r),n(x),()=>{x.setMap(null),n(null)}},[r]),a.useEffect(()=>{if(!e)return;const x=e,g=google.maps.event;return i&&g.addListener(x,"click",i),l&&g.addListener(x,"drag",l),d&&g.addListener(x,"dragstart",d),c&&g.addListener(x,"dragend",c),p&&g.addListener(x,"mouseover",p),m&&g.addListener(x,"mouseout",m),e.setDraggable(!!b),()=>{g.clearInstanceListeners(x)}},[e,b,i,l,d,c,p,m]),a.useEffect(()=>{e&&u&&e.setOptions(u)},[e,u]),a.useEffect(()=>{b||!f||!e||e.setPosition(f)},[b,f,e]),e}const Zt=a.forwardRef((t,e)=>{const n=Vt(t);return a.useImperativeHandle(e,()=>n,[n]),S.createElement(S.Fragment,null)});Zt.displayName="Marker";function qt({open:t,onOpenChange:e,property:n,token:r,onComplete:i}){const[l,d]=a.useState(n.completion_notes||""),[c,p]=a.useState(n.completion_photos||[]),[m,u]=a.useState(!1),[f,b]=a.useState(!1),x=a.useRef(null),g=n.custom_name||n.property_title,N=async v=>{if(v.length===0)return;u(!0);const j=[];try{for(const w of Array.from(v)){const k=w.name.split(".").pop(),D=`${n.property_id}/${Date.now()}-${Math.random().toString(36).substring(7)}.${k}`,{error:T}=await oe.storage.from("work-completion-photos").upload(D,w);if(T){console.error("Upload error:",T),Z.error(`Failed to upload ${w.name}`);continue}const{data:{publicUrl:E}}=oe.storage.from("work-completion-photos").getPublicUrl(D);j.push(E)}p(w=>[...w,...j]),Z.success(`${j.length} photo(s) uploaded`)}catch(w){console.error("Upload error:",w),Z.error("Failed to upload photos")}finally{u(!1)}},C=v=>{p(j=>j.filter((w,k)=>k!==v))},h=async v=>{b(!0);try{const{data:j,error:w}=await oe.rpc("update_work_map_property_completion",{p_token:r,p_property_id:n.property_id,p_status:v?"completed":n.status,p_completion_notes:l||null,p_completion_photos:c.length>0?c:null});if(w)throw w;Z.success(v?"Job marked as complete!":"Progress saved"),i(),e(!1)}catch(j){console.error("Save error:",j),Z.error("Failed to save")}finally{b(!1)}};return s.jsx(je,{open:t,onOpenChange:e,children:s.jsxs(we,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(_e,{children:s.jsxs(Ce,{className:"flex items-center gap-2",children:[s.jsx(ie,{className:"w-5 h-5 text-success"}),"Job Report"]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.quick_id&&s.jsx(q,{variant:"outline",className:"font-mono text-xs",children:n.quick_id}),s.jsx("p",{className:"font-semibold",children:g})]}),n.property_address&&s.jsx("p",{className:"text-sm text-muted-foreground",children:n.property_address}),n.task_notes&&s.jsxs("div",{className:"mt-2 p-2 bg-background rounded border",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Manager Notes:"}),s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:n.task_notes})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(me,{htmlFor:"notes",children:"Your Notes (what was done, any issues)"}),s.jsx(Je,{id:"notes",placeholder:"Describe the work completed, any problems encountered, items that need attention...",value:l,onCh
5ange:v=>d(v.target.value),rows:4})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(me,{children:"Photos"}),s.jsx("input",{ref:x,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:v=>v.target.files&&N(v.target.files)}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[c.map((v,j)=>s.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden border bg-muted",children:[s.jsx("img",{src:v,alt:"",className:"w-full h-full object-cover"}),s.jsx("button",{onClick:()=>C(j),className:"absolute top-1 right-1 p-1 rounded-full bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s.jsx(Ue,{className:"w-3 h-3"})})]},j)),s.jsx("button",{onClick:()=>{var v;return(v=x.current)==null?void 0:v.click()},disabled:m,className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/30 hover:border-primary/50 flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-primary transition-colors",children:m?s.jsx(re,{className:"w-6 h-6 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Ke,{className:"w-6 h-6"}),s.jsx("span",{className:"text-xs",children:"Add Photo"})]})})]})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsxs(P,{variant:"outline",className:"flex-1",onClick:()=>h(!1),disabled:f,children:[f?s.jsx(re,{className:"w-4 h-4 animate-spin mr-2"}):s.jsx(Ye,{className:"w-4 h-4 mr-2"}),"Save Progress"]}),s.jsxs(P,{className:"flex-1",onClick:()=>h(!0),disabled:f,children:[f?s.jsx(re,{className:"w-4 h-4 animate-spin mr-2"}):s.jsx(ie,{className:"w-4 h-4 mr-2"}),"Mark Complete"]})]})]})]})})}const B={low:{bg:"bg-slate-100",text:"text-slate-700",label:"Low"},medium:{bg:"bg-blue-100",text:"text-blue-700",label:"Medium"},high:{bg:"bg-orange-100",text:"text-orange-700",label:"High"},urgent:{bg:"bg-red-100",text:"text-red-700",label:"Urgent"}},H={pending:{icon:tt,color:"text-muted-foreground",label:"Pending"},in_progress:{icon:Re,color:"text-orange-500",label:"In Progress"},completed:{icon:ie,color:"text-green-500",label:"Completed"}},js=()=>{const{token:t}=Ze(),[e,n]=a.useState(null),[r,i]=a.useState([]),[l,d]=a.useState(!0),[c,p]=a.useState(null),[m,u]=a.useState(null),[f,b]=a.useState("list"),[x,g]=a.useState(!0),[N,C]=a.useState(!1),[h,v]=a.useState(null),[j,w]=a.useState(!1),[k,D]=a.useState(""),[T,E]=a.useState(""),[I,L]=a.useState(!1),[M,R]=a.useState(!1),F=a.useCallback(async()=>{if(t)try{d(!0);const o=await Be(t);if(!o){p("Work map not found or has expired.");return}if(n(o),o.is_private&&!I){w(!0),d(!1);return}const y=await fe(t,o.is_private?k:void 0);i(y)}catch(o){p("Failed to load work map."),console.error(o)}finally{d(!1)}},[t,I,k]),de=async()=>{if(!t||k.length<6){E("Please enter the 6-character access code");return}R(!0),E("");try{if(await He(t,k)){L(!0),w(!1);const y=await fe(t,k);i(y)}else E("Invalid access code. Please try again.")}catch(o){E("Failed to verify code. Please try again."),console.error(o)}finally{R(!1)}};a.useEffect(()=>{F()},[F]);const Pe=async(o,y)=>{if(t)try{await Ge(t,o,y),i(O=>O.map(A=>A.property_id===o?{...A,status:y}:A))}catch(O){console.error("Failed to update status:",O)}},ee=(o,y,O)=>{O==="google"?window.open(`https://www.google.com/maps/dir/?api=1&destination=${o},${y}`,"_blank"):window.open(`https://waze.com/ul?ll=${o},${y}&navigate=yes`,"_blank")},$=r.filter(o=>o.property_latitude&&o.property_longitude),De=$.length>0?{lat:$.reduce((o,y)=>o+(y.property_latitude||0),0)/$.length,lng:$.reduce((o,y)=>o+(y.property_longitude||0),0)/$.length}:{lat:41.3275,lng:19.8189};
5if(l)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:s.jsx(Fe,{})});if(c||!e)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:s.jsx(pe,{className:"max-w-md w-full",children:s.jsxs(ge,{className:"pt-6 text-center",children:[s.jsx(ae,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),s.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Work Map Not Found"}),s.jsx("p",{className:"text-muted-foreground",children:c||"This work map doesn't exist or has expired."})]})})});if(j)return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:s.jsx(pe,{className:"max-w-md w-full",children:s.jsxs(ge,{className:"pt-6",children:[s.jsxs("div",{className:"text-center mb-6",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-4",children:s.jsx(Qe,{className:"w-8 h-8 text-primary"})}),s.jsx("h2",{className:"text-xl font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"This work map requires an access code"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",children:"Access Code"}),s.jsxs("div",{className:"relative",children:[s.jsx(et,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),s.jsx(Xe,{type:"text",placeholder:"Enter 6-character code",value:k,onChange:o=>{D(o.target.value.toUpperCase().slice(0,6)),E("")},className:"pl-10 text-center text-lg tracking-widest font-mono uppercase",maxLength:6,onKeyDown:o=>{o.key==="Enter"&&de()}})]}),T&&s.jsx("p",{className:"text-sm text-destructive",children:T})]}),s.jsx(P,{className:"w-full",onClick:de,disabled:M||k.length<6,children:M?"Verifying...":"Access Work Map"}),s.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Ask your manager for the access code"})]})]})})});const Te=r.filter(o=>o.status==="completed").length,_=r.find(o=>o.property_id===m),J=r.filter(o=>o.task_notes&&o.task_notes.trim().length>0),ue=({property:o,index:y,showActions:O})=>{const A=B[o.priority]||B.medium,U=H[o.status]||H.pending,V=U.icon,te=o.custom_name||o.property_title,se=m===o.property_id;return s.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all ${se?"bg-primary/10 border-primary ring-1 ring-primary":"bg-card hover:bg-muted"}`,onClick:()=>u(o.property_id),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white font-bold text-xs shrink-0 ${o.status==="completed"?"bg-green-500":o.status==="in_progress"?"bg-orange-500":"bg-primary"}`,children:y+1}),o.property_image_url?s.jsx("img",{src:o.property_image_url,alt:"",className:"w-8 h-8 object-cover rounded shrink-0"}):s.jsx("div",{className:"w-8 h-8 bg-muted rounded flex items-center justify-center shrink-0",children:s.jsx(ae,{className:"w-3 h-3 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-xs truncate",children:te}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(V,{className:`w-3 h-3 ${U.color}`}),s.jsx("span",{className:`text-xs ${U.color}`,children:U.label})]})]}),s.jsx(q,{className:`${A.bg} ${A.text} text-[10px] px-1.5 py-0 shrink-0`,children:A.label}),O&&s.jsxs("div",{className:"flex gap-1 shrink-0",children:[s.jsx(P,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:ne=>{ne.stopPropagation(),v(o),C(!0)},children:s.jsx(ve,{className:"w-3 h-3"})}),o.property_latitude&&o.property_longitude&&s.jsx(P,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:ne=>{ne.stopPropagation(),ee(o.property_latitude,o.property_longitude,"google")},children:s.jsx(be,{className:"w-3 h-3"})})]})]}),o.task_notes&&o.task_notes.trim()&&s.jsx("div",{className:"bg-muted/60 rounded px-2 py-1.5 mt-2 ml-8",children:s.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap line-clamp-3",children:o.task_notes})})]})},ze=()=>{if(!_)return null;const o=B[_.priority]||B.medium,y=H[_.status]||H.pending,O=y.icon,A=_.custom_name||_.property_title,U=r.findIndex(V=>V.property_id===m)+1;return s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-background border-t shadow-lg p-4 z-20 animate-in slide-in-from-bottom-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-white font-bold text-sm shrink-0 ${_.status==="completed"?"bg-green-500":"bg-primary"}`,children:U}),_.property_image_url?s.jsx("img",{src:_.property_image_url,alt:"",className:"w-16 h-16 object-cover rounded shrink-0"}):s.jsx("div",{className:"w-16 h-16 bg-muted rounded flex items-center justify-center shrink-0",children:s.jsx(ae,{className:"w-5 h-5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("h3",{className:"font-semibold",children:A}),s.jsx(q,{className:`${o.bg} ${o.text} shrink-0`,children:o.label})]}),_.property_address&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:_.property_address}),_.task_notes&&s.jsx("p",{className:"text-sm mt-1 text-muted-foreground line-clamp-2",children:_.task_notes}),s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsx(O,{className:`w-4 h-4 ${y.color}`}),s.jsx("span",{className:`text-sm ${y.color}`,children:y.label})]})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[_.property_latitude&&_.property_longitude&&s.jsxs(s.Fragment,{children:[s.jsxs(P,{size:"sm",variant:"outline",onClick:()=>ee(_.property_latitude,_.property_longitude,"google"),children:[s.jsx(be,{className:"w-3 h-3 mr-1"}),"Navigate"]}),s.jsxs(P,{size:"sm",variant:"outline",onClick:()=>ee(_.property_latitude,_.property_longitude,"waze"),children:[s.jsx(at,{className:"w-3 h-3 mr-1"}),"Waze"]})]}),s.jsxs(P,{size:"sm",variant:"secondary",onClick:()=>{v(_),C(!0)},children:[s.jsx(ve,{className:"w-3 h-3 mr-1"}),"Report"]}),_.status==="pending"&&s.jsx(P,{size:"sm",variant:"outline",onClick:()=>Pe(_.property_id,"in_progress"),children:"Start"})]})]})};return s.jsxs("div",{className:"h-screen bg-background flex flex-col overflow-hidden",children:[s.jsx("header",{className:"shrink-0 z-50 bg-background border-b px-3 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"font-bold text-base truncate",children:e.title}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.length," properties · ",Te," done"]})]}),s.jsxs("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-0.5 
5shrink-0",children:[J.length>0&&s.jsxs(je,{children:[s.jsx($e,{asChild:!0,children:s.jsxs(P,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs gap-1",children:[s.jsx(xe,{className:"w-3 h-3"}),s.jsx("span",{className:"hidden sm:inline",children:"Work Orders"}),s.jsx(q,{variant:"secondary",className:"h-4 text-[10px] px-1",children:J.length})]})}),s.jsxs(we,{className:"max-w-lg max-h-[80vh]",children:[s.jsx(_e,{children:s.jsxs(Ce,{className:"flex items-center gap-2",children:[s.jsx(xe,{className:"w-5 h-5"}),"Work Orders (",J.length,")"]})}),s.jsx(he,{className:"max-h-[60vh] pr-4",children:s.jsx("div",{className:"space-y-3",children:J.map((o,y)=>{const O=B[o.priority]||B.medium,A=H[o.status]||H.pending,U=A.icon,V=o.custom_name||o.property_title,te=r.findIndex(se=>se.property_id===o.property_id)+1;return s.jsxs("div",{className:"p-3 rounded-lg border bg-card",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-white font-bold text-xs shrink-0 ${o.status==="completed"?"bg-green-500":o.status==="in_progress"?"bg-orange-500":"bg-primary"}`,children:te}),s.jsx("p",{className:"font-medium text-sm flex-1 truncate",children:V}),s.jsx(q,{className:`${O.bg} ${O.text} text-xs`,children:O.label})]}),s.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[s.jsx(U,{className:`w-3 h-3 ${A.color}`}),s.jsx("span",{className:`text-xs ${A.color}`,children:A.label})]}),s.jsx("div",{className:"bg-muted/50 rounded p-2",children:s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:o.task_notes})})]},o.id)})})})]})]}),s.jsxs(P,{size:"sm",variant:f==="list"?"default":"ghost",className:"h-7 px-2 text-xs",onClick:()=>b("list"),children:[s.jsx(st,{className:"w-3 h-3 mr-1"}),"List"]}),s.jsxs(P,{size:"sm",variant:f==="map"?"default":"ghost",className:"h-7 px-2 text-xs",onClick:()=>b("map"),children:[s.jsx(nt,{className:"w-3 h-3 mr-1"}),"Map"]})]})]})}),f==="list"&&s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsxs("div",{className:"p-3 space-y-2",children:[e.description&&s.jsx("p",{className:"text-xs bg-muted p-2 rounded mb-2",children:e.description}),r.map((o,y)=>s.jsx(ue,{property:o,index:y,showActions:!0},o.id))]})}),f==="map"&&s.jsxs("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden relative",children:[s.jsx("div",{className:"flex-1 relative",style:{minHeight:"300px"},children:$.length>0?s.jsx(gt,{apiKey:We,children:s.jsx(Ie,{defaultCenter:De,defaultZoom:13,mapId:"staff-work-map-full",gestureHandling:"greedy",disableDefaultUI:!0,zoomControl:!0,style:{width:"100%",height:"100%"},children:$.map((o,y)=>s.jsx(Oe,{position:{lat:o.property_latitude,lng:o.property_longitude},onClick:()=>u(o.property_id),children:s.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-white font-bold text-xs shadow-lg cursor-pointer border-2 border-white transition-transform ${m===o.property_id?"scale-125 ring-2 ring-primary":""} ${o.status==="completed"?"bg-green-500":o.status==="in_progress"?"bg-orange-500":"bg-primary"}`,children:y+1})},o.property_id))})}):s.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"No properties with coordinates"})}),s.jsxs("div",{className:`
6            md:border-l md:w-72 md:flex md:flex-col
7            absolute md:relative bottom-0 left-0 right-0 md:bottom-auto md:left-auto md:right-auto
8            bg-background/95 backdrop-blur-sm md:bg-background border-t md:border-t-0
9            transition-all duration-300 z-20
10            ${x?"max-h-[40vh] md:max-h-none":"max-h-10"}
11          `,children:[s.jsxs("button",{className:"h-10 flex items-center justify-center gap-2 border-b shrink-0 w-full md:hidden",onClick:()=>g(!x),children:[x?s.jsx(rt,{className:"w-4 h-4"}):s.jsx(ot,{className:"w-4 h-4"}),s.jsxs("span",{className:"text-xs font-medium",children:[r.length," properties"]})]}),s.jsx("div",{className:"hidden md:flex h-10 items-center justify-center border-b shrink-0",children:s.jsxs("span",{className:"text-xs font-medium",children:[r.length," properties"]})}),x&&s.jsx(he,{className:"flex-1 max-h-[calc(40vh-40px)] md:max-h-none md:h-full",children:s.jsx("div",{className:"p-2 space-y-1.5",children:r.map((o,y)=>s.jsx(ue,{property:o,index:y},o.id))})})]}),_&&!x&&s.jsx(ze,{})]}),h&&t&&s.jsx(qt,{open:N,onOpenChange:C,property:{id:h.id,property_id:h.property_id,property_title:h.property_title,property_address:h.property_address||void 0,property_image_url:h.property_image_url||void 0,custom_name:h.custom_name||void 0,task_notes:h.task_notes||void 0,priority:h.priority,status:h.status,quick_id:h.quick_id||void 0,completion_notes:h.completion_notes||void 0,completion_photos:h.completion_photos||void 0},token:t,onComplete:F})]})};export{js as default};

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.