1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[547],{6547:function(e,t,a){a.d(t,{Z:function(){return r}});var s=a(7437),l=a(2265),n=a(1837),i=a(1435);function r(e){let{field:t,onDelete:a}=e,[i,r]=(0,l.useState)(!1),[c,x]=(0,l.useState)("weather"),[d,p]=(0,l.useState)(null),[u,j]=(0,l.useState)(null),[v,f]=(0,l.useState)(null),[b,N]=(0,l.useState)(null),[g,y]=(0,l.useState)(new Set);async function w(e){if(!g.has(e)){N(e);try{if("weather"===e){let e=await n.h.getFieldWeather(t.id);p(e.length>0?e[0]:null)}else if("crop"===e){let e=await n.h.getFieldCropHealth(t.id);j(e.length>0?e[0]:null)}else if("soil"===e){let e=await n.h.getFieldSoil(t.id);f(e)}y(t=>new Set(t).add(e))}catch(e){}N(null)}}async function _(e){y(t=>{let a=new Set(t);return a.delete(e),a}),await w(e)}return(0,s.jsxs)("div",{className:"bg-paper border border-0.5 rounded-xl transition-all duration-300 ".concat(i?"border-sand shadow-sm":"border-grid hover:border-sand"),children:[(0,s.jsxs)("button",{onClick:function(){let e=!i;r(e),e&&w(c)},className:"w-full text-left p-5 flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 mb-1",children:[(0,s.jsx)("h3",{className:"text-[15px] font-semibold text-text",children:t.name}),(0,s.jsx)("span",{className:"text-[11px] font-medium text-text/30 bg-bg px-2 py-0.5 rounded-full capitalize",children:t.crop_type})]}),(0,s.jsxs)("p",{className:"text-[12px] text-text/40",children:[t.area_acres," acres \xb7 ",t.soil_type," \xb7"," ",(0,s.jsxs)("span",{className:"font-mono",children:[t.lat.toFixed(3),"\xb0, ",t.lng.toFixed(3),"\xb0"]})]})]}),void 0!==t.last_ndvi&&!i&&(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,s.jsx)("span",{className:"text-[13px] font-bold text-text tabular-nums",children:t.last_ndvi}),(0,s.jsx)("span",{className:"text-[10px] text-text/30",children:"NDVI"})]}),(0,s.jsx)("svg",{className:"w-4 h-4 text-text/30 transition-transform duration-300 flex-shrink-0 ".concat(i?"rotate-180":""),viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,s.jsx)("path",{d:"M4 6l4 4 4-4"})})]}),i&&(0,s.jsxs)("div",{className:"px-5 pb-5 border-t border-grid",children:[(0,s.jsx)("div",{className:"flex items-center gap-1 mt-4 mb-4 bg-bg rounded-lg p-1",children:[{key:"weather",label:"Weather",icon:"\uD83C\uDF24"},{key:"crop",label:"Crop Health",icon:"\uD83C\uDF31"},{key:"soil",label:"Soil",icon:"\uD83E\uDEA8"}].map(e=>(0,s.jsxs)("button",{onClick:()=>{var t;x(t=e.key),w(t)},className:"flex-1 flex items-center justify-center gap-1.5 text-[12px] font-medium py-2 rounded-md transition-all ".concat(c===e.key?"bg-paper text-text shadow-sm":"text-text/40 hover:text-text/60"),children:[(0,s.jsx)("span",{className:"text-[13px]",children:e.icon}),e.label]},e.key))}),(0,s.jsx)("div",{className:"min-h-[140px]",children:b===c?(0,s.jsx)("div",{className:"flex items-center justify-center py-10",children:(0,s.jsx)("div",{className:"w-5 h-5 border-2 border-primary/20 border-t-primary rounded-full animate-spin"})}):(0,s.jsxs)(s.Fragment,{children:["weather"===c&&(0,s.jsx)(o,{data:d,onRefresh:()=>_("weather")}),"crop"===c&&(0,s.jsx)(m,{data:u,ndvi:t.last_ndvi,onRefresh:()=>_("crop")}),"soil"===c&&(0,s.jsx)(h,{data:v})]})}),a&&(0,s.jsx)("div",{className:"mt-4 pt-3 border-t border-grid flex justify-end",children:(0,s.jsx)("button",{onClick:()=>a(t.id),className:"text-[11px] text-text/30 hover:text-critical transition-colors",children:"Delete field"})})]})]})}function c(e){let{label:t,value:a,mono:l}=e;return(0,s.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,s.jsx)("span",{className:"text-[12px] text-text/40",children:t}),(0,s.jsx)("span",{className:"text-[13px] font-medium text-text ".concat(l?"font-mono":""),children:null!=a?a:"â"})]})}function x(e){let{message:t}=e;return(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("p",{className:"text-[13px] text-text/40",children:t}),(0,s.jsx)("p",{className:"text-[11px] text-text/25 mt-1",children:"Run the agent on this field to populate"})]})}function d(e){let{onClick:t}=e;return(0,s.jsxs)("button",{onClick:t,className:"flex items-center gap-1.5 text-[11px] font-medium text-accent hover:text-accent/80 transition-colors",children:[(0,s.jsxs)("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,s.jsx)("path",{d:"M2 8a6 6 0 0 1 10.2-4.3M14 8a6 6 0 0 1-10.2 4.3"}),(0,s.jsx)("path",{d:"M12 2v4h-4M4 14v-4h4"})]}),"Refresh"]})}function o(e){let{data:t,onRefresh:a}=e;return t?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("span",{className:"text-[11px] text-text/25",children:["Updated ",new Date(t.created_at).toLocaleStr
1ing("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})]}),(0,s.jsx)(d,{onClick:a})]}),(0,s.jsxs)("div",{className:"flex items-baseline gap-6 mb-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("span",{className:"text-[28px] font-bold text-text tabular-nums",children:[Math.round(t.temp_f),"\xb0"]}),(0,s.jsx)("span",{className:"text-[12px] text-text/30 ml-0.5",children:"F"})]}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-[16px] font-semibold text-text capitalize",children:t.conditions}),(0,s.jsx)("span",{className:"text-[11px] text-text/30",children:"conditions"})]})]}),(0,s.jsxs)("div",{className:"space-y-0.5 mb-4",children:[(0,s.jsx)(c,{label:"Humidity",value:"".concat(t.humidity_pct,"%")}),(0,s.jsx)(c,{label:"Wind",value:"".concat(t.wind_mph," mph")}),null!==t.uv_index&&(0,s.jsx)(c,{label:"UV Index",value:t.uv_index})]}),t.precipitation_forecast.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold text-text/30 uppercase tracking-wider mb-2",children:"Precipitation Forecast"}),(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2",children:t.precipitation_forecast.slice(0,3).map(e=>(0,s.jsxs)("div",{className:"bg-bg rounded-lg px-3 py-2 text-center",children:[(0,s.jsx)("p",{className:"text-[10px] text-text/30 font-mono",children:new Date(e.date+"T00:00:00").toLocaleDateString("en-US",{weekday:"short"})}),(0,s.jsxs)("p",{className:"text-[14px] font-bold text-text mt-0.5",children:[e.precip_in,'"']}),(0,s.jsxs)("p",{className:"text-[10px] text-text/30",children:[e.prob_pct,"% chance"]})]},e.date))})]})]}):(0,s.jsx)(x,{message:"No weather data yet"})}function m(e){var t;let{data:a,ndvi:l,onRefresh:n}=e,r=null!==(t=null==a?void 0:a.ndvi_score)&&void 0!==t?t:l;return a||void 0!==r?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(null==a?void 0:a.created_at)&&(0,s.jsxs)("span",{className:"text-[11px] text-text/25",children:["Updated ",new Date(a.created_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})]}),(0,s.jsx)(d,{onClick:n})]}),void 0!==r&&(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(i.Z,{value:r})}),a&&(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(c,{label:"Stress Level",value:a.stress_level}),(0,s.jsx)(c,{label:"Vegetation Trend",value:a.vegetation_trend}),(0,s.jsx)(c,{label:"Vegetation Fraction",value:"".concat((100*a.vegetation_fraction).toFixed(0),"%")}),a.last_satellite_date&&(0,s.jsx)(c,{label:"Last Satellite",value:new Date(a.last_satellite_date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})]}):(0,s.jsx)(x,{message:"No crop health data yet"})}function h(e){let{data:t}=e;return t?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsxs)("span",{className:"text-[11px] text-text/25",children:["Updated ",new Date(t.updated_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})]})}),(0,s.jsxs)("div",{className:"flex items-baseline gap-4 mb-4",children:[(0,s.jsx)("div",{children:(0,s.jsxs)("span",{className:"text-[20px] font-bold text-text",children:["pH ",t.ph]})}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-[15px] font-semibold text-text",children:t.soil_type}),(0,s.jsx)("span",{className:"text-[11px] text-text/30",children:"classification"})]})]}),(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(c,{label:"Organic Matter",value:"".concat(t.organic_matter_pct,"%")}),(0,s.jsx)(c,{label:"Drainage",value:t.drainage_class}),(0,s.jsx)(c,{label:"Water Capacity",value:t.water_holding_capacity}),(0,s.jsx)(c,{label:"Available Water",value:"".concat(t.available_water_in_per_ft," in/ft")})]})]}):(0,s.jsx)(x,{message:"No soil profile yet"})}},1435:function(e,t,a){a.d(t,{Z:function(){return n}});var s=a(7437);let l=[{min:0,max:.2,color:"bg-ndvi-severe",label:"Severe"},{min:.2,max:.4,color:"bg-ndvi-high",label:"Stress"},{min:.4,max:.6,color:"bg-ndvi-moderate",label:"Moderate"},{min:.6,max:.8,color:"bg-ndvi-healthy",label:"Healthy"},{min:.8,max:1,color:"bg-ndvi-peak",label:"Peak"}];function n(e){var t;let{value:a,showLabel:n=!0}=e,i=Math.max(0,Math.min(1,a));return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"flex h-2 rounded-full overflow-hidden gap-[1px]",children:l.map(e=>(0,s.jsx)("div",{className:"flex-1 ".concat(e.color)},e.label))}),(0,s.jsx)("div",{className:"absolute top-[-3px] w-0 h-0",style:{left:"".concat(100*i,"%")},children:(0,s.jsx)("div",{className:"relative -left-[4px]",children:(0,s.jsx)("div",{className:"w-2 h-2 bg-text rotate-45 transform"})})})]}),n&&(0,s.jsxs)("div",{className:"flex items-center justify-between mt-1.5",children:[(0,s.jsxs)("span",{className:"font-mono text-[10px] text-sand",children:["NDVI ",i.toFixed(2)]}),(0,s.jsx)("span",{className:"font-mono text-[10px] text-sand",children:(null===(t=l.find(e=>i>=e.min&&i<e.max))||void 0===t?void 0:t.label)||l[l.length-1].label})]})]})}}}]);
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.