PageSourceSearch

https://pplsync.ai/_next/static/chunks/1663.db74b81e10f5853d.js

js pplsync.ai collected 2026-10-05 14:52:39 UTC 7,031 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1663],{11663:function(e,t,o){o.r(t);var l=o(57437),a=o(8268),r=o(9388),s=o(99376),n=o(2265),d=o(94242),i=o(91964),c=o(37996);let g={width:"100%",height:"500px"},u={lat:12.9716,lng:77.5946},m=e=>e.toISOString().split("T")[0],p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(e.length<=t)return e;let o=Math.ceil(e.length/t),l=[];for(let t=0;t<e.length;t+=o)l.push(e[t]);return l[l.length-1]!==e[e.length-1]&&l.push(e[e.length-1]),l};t.default=()=>{let[e,t]=(0,n.useState)([]),[o,h]=(0,n.useState)(!0),[x,f]=(0,n.useState)(m(new Date)),[b,C]=(0,n.useState)(""),[w,y]=(0,n.useState)(!1),v=(0,s.useSearchParams)().get("id"),j=(0,n.useRef)(null),{isLoaded:N}=(0,i.Ji)({googleMapsApiKey:"AIzaSyBFPjzXEIbl-pPzs9RJqWT3WJc0LVVVwfc",libraries:["geometry"]}),S=async e=>{try{h(!0),y(!0);let l=await (0,a.R1)("".concat(r.Z.daily_app_location_get,"?user_id=").concat(v,"&date=").concat(e));if((null==l?void 0:l.status)===200){var o;let e=(null==l?void 0:null===(o=l.data)||void 0===o?void 0:o.full_path)||[];t(e)}else t([])}catch(e){d.Am.error(null==e?void 0:e.message),t([])}finally{h(!1),y(!1)}};(0,n.useEffect)(()=>{x&&S(x)},[x]);let k=(0,n.useMemo)(()=>{if(!Array.isArray(e)||0===e.length)return{allCoords:[],reducedCoords:[],startCoord:null,endCoord:null,lastCoord:null};let t=e.flatMap(e=>Array.isArray(e.coordinates)?e.coordinates:e.lat&&e.lng?[e]:[]).filter(e=>(null==e?void 0:e.lat)&&(null==e?void 0:e.lng)&&!isNaN(e.lat)&&!isNaN(e.lng)).map(e=>({lat:parseFloat(e.lat),lng:parseFloat(e.lng),timestamp:e.timestamp})),o=p(t,500),l=t[t.length-1],a=t[0];return{allCoords:t,reducedCoords:o,startCoord:l,endCoord:a,lastCoord:null==e?void 0:e[0]}},[e]),D=(0,n.useMemo)(()=>{var e;if(!(null===(e=window)||void 0===e?void 0:e.google)||!k.allCoords||k.allCoords.length<2)return{meters:0,km:"0.00"};let t=0,o=k.allCoords;for(let e=0;e<o.length-1;e+=100){let l=Math.min(e+100,o.length-1);for(let a=e;a<l;a++){let e=new window.google.maps.LatLng(o[a]),l=new window.google.maps.LatLng(o[a+1]);t+=window.google.maps.geometry.spherical.computeDistanceBetween(e,l)}}return{meters:t,km:(t/1e3).toFixed(2)}},[k.allCoords]),z=k.reducedCoords.length>0?k.endCoord:u,A=k.allCoords.length>0?Math.max(...k.allCoords.map(e=>e.timestamp)):null,_=(0,n.useCallback)(e=>{j.current&&e&&(j.current.panTo(e),j.current.setZoom(18))},[]),E=k.reducedCoords.length>0,L=e=>{let t=Math.floor(e/60),o=Math.floor(e%60);return t>0&&o>0?"".concat(t," hr ").concat(o," min"):t>0?"".concat(t," hr"):"".concat(o," min")},M=(e=>{if(!e)return{label:"Unknown",color:"gray"};let t=(new Date-new Date(e<1e12?1e3*e:e))/6e4,o=L(t);return t<=1?{label:"",color:"green"}:t<=15?{label:"\uD83D\uDFE0 Idle (".concat(o," ago)"),color:"orange"}:t<=1440?{label:"\uD83D\uDD34 Inactive for ".concat(o),color:"red"}:{label:""}})(A),F=(0,n.useCallback)(async e=>{let{lat:t,lng:o}=e;try{new window.google.maps.Geocoder().geocode({location:{lat:t,lng:o}},(e,t)=>{"OK"===t&&e[0]?C(e[0].formatted_address):C("Address not found")})}catch(e){console.error("Geocoder failed:",e),C("Failed to fetch address")}},[]);(0,n.useEffect)(()=>{var e,t;N&&(null===(e=k.lastCoord)||void 0===e?void 0:e.lat)&&(null===(t=k.lastCoord)||void 0===t?void 0:t.lng)&&F(k.lastCoord)},[N,k.lastCoord,F]);let O=(0,n.useMemo)(()=>{if(!k.reducedCoords.length)return[];let e=[],t=k.reducedCoords;return t.length<=20&&t.slice(1,-1).forEach((t,o)=>{e.push({position:t,key:"waypoint-".concat(o),label:"".concat(o+2)})}),e},[k.reducedCoords]);return(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"flex items-center justify-end",children:(0,l.jsx)("input",{type:"date",value:x,onChange:e=>f(e.target.value),className:"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 pl-3 py-2",disabled:o})}),(o||w)&&(0,l.jsxs)("div",{className:"text-gray-500 flex items-center gap-2",children:[(0,l.jsx)("div",{className:"animate-spin h-4 w-4 border-2 border-blue-500 border-t-transparent rounded-full"}),w?"Processing tracking data...":"Loading..."]}),!o&&!E&&(0,l.jsxs)("div",{className:"text-red-500 font-medium text-center",children:["No tracking data available for ",x]}),!o&&N&&E&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"mb-4 p-4 border border-gray-200 rounded-lg bg-gray-50 shadow-sm text-sm text-gray-800 space-y-2 mt-5 items-center",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(c.i63,{className:"text-blue-600",size:24}),(0,l.jsx)("span",{className:"font-medium text-gray-600",children:"Total Distance:"}),(0,l.jsxs)("span",{className:"font-semibold text-black",children:[D.km," km"]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(c.bAx,{size:24,className:"red"===M.c
1olor?"text-red-600":"text-green-600"}),(0,l.jsx)("span",{className:"font-medium text-gray-600",children:"Status:"}),(0,l.jsxs)("span",{className:"font-semibold ".concat("green"===M.color?"text-green-600":"red"===M.color?"text-red-600":"text-gray-500"),children:["green"===M.color?"\uD83D\uDFE2":"red"===M.color?"\uD83D\uDD34 ":"⚪",M.label]})]}),(0,l.jsxs)("div",{className:"flex items-start gap-2",children:[(0,l.jsx)(c.m6D,{className:"text-indigo-600 mt-0.5",size:24}),(0,l.jsx)("span",{className:"font-medium text-gray-600 mt-0.5",children:"Last Location:"}),(0,l.jsx)("span",{className:"text-blue-700 font-medium",children:b})]})]}),(0,l.jsxs)("div",{className:"mb-4 flex gap-4",children:[(0,l.jsx)("button",{onClick:()=>_(k.startCoord),className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50",disabled:!k.startCoord,children:"Go to Start"}),(0,l.jsx)("button",{onClick:()=>_(k.endCoord),className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 disabled:opacity-50",disabled:!k.endCoord,children:"Go to End"})]}),(0,l.jsxs)(i.b6,{mapContainerStyle:g,center:z,zoom:16,onLoad:e=>j.current=e,options:{mapTypeControl:!0,streetViewControl:!0,fullscreenControl:!0},children:[k.reducedCoords.length>1&&(0,l.jsx)(i.aH,{path:k.reducedCoords,options:{strokeColor:"#00B300",strokeOpacity:.8,strokeWeight:4,geodesic:!0,icons:[{icon:{path:window.google.maps.SymbolPath.FORWARD_CLOSED_ARROW,scale:3,fillColor:"#00B300",fillOpacity:.8,strokeWeight:1},offset:"100%",repeat:"100px"}]}}),k.startCoord&&(0,l.jsx)(i.Jx,{position:k.startCoord,label:{text:"Start",color:"white",fontSize:"12px"},icon:{url:"http://maps.google.com/mapfiles/ms/icons/green-dot.png",scaledSize:new window.google.maps.Size(40,40)}}),k.endCoord&&(0,l.jsx)(i.Jx,{position:k.endCoord,label:{text:"End",color:"white",fontSize:"12px"},icon:{url:"http://maps.google.com/mapfiles/ms/icons/red-dot.png",scaledSize:new window.google.maps.Size(50,50)}}),O.map(e=>(0,l.jsx)(i.Jx,{position:e.position,icon:{url:"/images/map.png",scaledSize:new window.google.maps.Size(30,30),labelOrigin:new window.google.maps.Point(15,12)},label:{text:e.label,color:"#5A189A",fontSize:"10px",fontWeight:"bold"}},e.key))]})]})]})}}}]);

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.