1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[111],{19162:function(t,e,n){n.d(e,{AF:function(){return s},je:function(){return d},zf:function(){return u}});var i=n(90947),o=n(80163);function r(){let t=(0,i._)(["\n query ChatSessions {\n chatSessions {\n id\n userId\n title\n createdAt\n updatedAt\n }\n }\n"]);return r=function(){return t},t}function l(){let t=(0,i._)(["\n query ChatSessionMessages($sessionId: String!, $limit: Int, $before: ID) {\n chatSessionMessages(sessionId: $sessionId, limit: $limit, before: $before) {\n messages {\n id\n sessionId\n role\n content\n replyToMessageId\n createdAt\n }\n hasMore\n nextCursor\n }\n }\n"]);return l=function(){return t},t}function a(){let t=(0,i._)(["\n query SharedChatSession($token: String!) {\n sharedChatSession(token: $token) {\n title\n createdAt\n messages {\n role\n content\n createdAt\n }\n }\n }\n"]);return a=function(){return t},t}let u=(0,o.Ps)(r()),s=(0,o.Ps)(l()),d=(0,o.Ps)(a())},8197:function(t,e,n){n.d(e,{$z:function(){return M},AA:function(){return A},Ax:function(){return tn},CA:function(){return O},Cd:function(){return a},Cq:function(){return tt},DK:function(){return g},DP:function(){return R},GT:function(){return D},I6:function(){return S},IT:function(){return y},Ix:function(){return tl},JK:function(){return ta},Jw:function(){return f},KD:function(){return X},LU:function(){return m},Lb:function(){return F},U4:function(){return r},UK:function(){return k},WT:function(){return $},Xh:function(){return h},Yt:function(){return N},_M:function(){return z},fV:function(){return p},hF:function(){return G},mV:function(){return c},me:function(){return C},nq:function(){return d},od:function(){return u},q$:function(){return s},q8:function(){return x},sS:function(){return L},t5:function(){return te}});var i=n(90947);function o(){let t=(0,i._)(["[([^]\n]+.pdf)]((https://[^s)]+))"],["\\[([^\\]\\n]+\\.pdf)\\]\\((https:\\/\\/[^\\s)]+)\\)"]);return o=function(){return t},t}let r=["image/png","image/jpeg","image/webp","image/gif"],l="application/pdf",a=[...r,l].join(","),u=30,s=96,d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=new Set(t.map(t=>null==t?void 0:t.id));return[...e.filter(t=>(null==t?void 0:t.id)&&!n.has(t.id)),...t]},c=t=>{var e,n;return(null==t?void 0:t.nextCursor)||(null==t?void 0:null===(n=t.messages)||void 0===n?void 0:null===(e=n[0])||void 0===e?void 0:e.id)||null},g=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[...t].sort((t,e)=>{var n,i,o,r;let l=Number(null!==(i=null!==(n=null==t?void 0:t.updatedAt)&&void 0!==n?n:null==t?void 0:t.createdAt)&&void 0!==i?i:0);return Number(null!==(r=null!==(o=null==e?void 0:e.updatedAt)&&void 0!==o?o:null==e?void 0:e.createdAt)&&void 0!==r?r:0)-l})},h=(t,e)=>{var n,i;return null!==(i=null!==(n=null==t?void 0:t.chatSessions)&&void 0!==n?n:null==e?void 0:e.chatSessions)&&void 0!==i?i:[]},p=(t,e)=>"".concat(String(t||"").replace(/\/$/,""),"/public/chat/").concat(encodeURIComponent(e||"")),m=t=>{if(null==t||""===t)return null;let e=Number(t);if(Number.isFinite(e))return e<1e12?1e3*e:e;let n=Date.parse(t);return Number.isNaN(n)?null:n},f=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"tr-TR",n=m(t);if(null===n)return"";let i=new Date(n),o={day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"};return i.getFullYear()!==new Date().getFullYear()&&(o.year="numeric"),new Intl.DateTimeFormat(e,o).format(i)},S=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],i=[],o=[],a=e.reduce((t,e)=>t+((null==e?void 0:e.size)||0),0),u=e.filter(t=>r.includes(null==t?void 0:t.type)).length,s=e.filter(t=>(null==t?void 0:t.type)===l).length;for(let d of t){let t=r.includes(null==d?void 0:d.type),c=(null==d?void 0:d.type)===l,g=null;if(t||c?e.length+n.length>=4?g="attachment_count":t&&u>=4?g="image_count":c&&s>=2?g="pdf_count":t&&((null==d?void 0:d.size)||0)>5242880?g="image_size":c&&((null==d?void 0:d.size)||0)>10485760?g="pdf_size":a+((null==d?void 0:d.size)||0)>12582912&&(g="total_size"):g="unsupported_type",g){i.push(d),o.push({f
1ile:d,reason:g});continue}n.push(d),a+=d.size||0,t&&(u+=1),c&&(s+=1)}return{accepted:n,rejected:i,rejections:o}},v=t=>new Promise((e,n)=>{let i=new FileReader;i.onload=()=>e({type:"file",filename:t.name,mediaType:t.type,url:i.result}),i.onerror=()=>n(i.error||Error("Could not read attachment")),i.readAsDataURL(t)}),F=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Promise.all(t.map(v))},y=t=>{let{text:e="",files:n=[],persistedMessageId:i,replyToMessageId:o=null,createdAt:r,replace:l=!1}=t,a={createdAt:r||new Date().toISOString(),replyToMessageId:o||null};return l?{text:e,files:[...n],messageId:i,metadata:a}:{id:i,role:"user",parts:[...n,...e?[{type:"text",text:e}]:[]],metadata:a}},A=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{persistedMessageId:t,...e?{replyToMessageId:e}:{}}},N=t=>{let{sessionId:e,content:n,replyToMessageId:i=null}=t;return{sessionId:e,role:"user",content:n,...i?{replyToMessageId:i}:{}}},w=String.raw(o()),b=()=>RegExp(w,"gi"),I=t=>{try{let e=new URL(t);return"https:"===e.protocol&&e.pathname.toLowerCase().endsWith(".pdf")}catch(t){return!1}},L=t=>{let e=Number(t);return!Number.isFinite(e)||e<0?"":e<1024?"".concat(e," B"):e<1048576?"".concat(Math.round(e/1024)," KB"):"".concat((e/1024/1024).toFixed(1)," MB")},x=t=>{var e;if("string"!=typeof t)return null;let n=/^data:[^;,]+;base64,([A-Za-z0-9+/]*={0,2})$/.exec(t);if(!n)return null;let i=((null===(e=n[1].match(/=*$/))||void 0===e?void 0:e[0])||"").length;return Math.max(0,Math.floor(3*n[1].length/4)-i)},P=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if("string"!=typeof t||!t)return[];let e=[];for(let n of t.matchAll(b()))try{let t=new URL(n[2]);if(!I(t.toString()))continue;let i=String(n[1]).split("/").pop().trim();if(!i.toLowerCase().endsWith(".pdf"))continue;e.push({type:"file",filename:i,mediaType:l,url:t.toString()})}catch(t){}return Array.from(new Map(e.map(t=>[t.url,t])).values())},k=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return String(t||"").replace(b(),"").replace(/\n{3,}/g,"\n\n").trim()},W=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return[{type:"text",text:t||""},...P(t)]},R=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Array.from(new Map([...(t.parts||[]).filter(t=>(null==t?void 0:t.type)==="file"&&(null==t?void 0:t.mediaType)===l&&"string"==typeof t.url&&(!!t.url.startsWith("data:application/pdf;base64,")||I(t.url))),...P((t.parts||[]).filter(t=>(null==t?void 0:t.type)==="text").map(t=>t.text||"").join(""))].map(t=>[t.url,t])).values())},C=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(t.parts||[]).filter(t=>(null==t?void 0:t.type)==="text"&&"string"==typeof t.text&&""!==t.text).map(t=>t.text).join("")},_=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=C(t),n=(t.parts||[]).some(t=>(null==t?void 0:t.type)==="image"||(null==t?void 0:t.type)==="file"&&(!t.mediaType||String(t.mediaType).startsWith("image/"))),i=/!\[[^\]]*\]\((?:https?:\/\/|data:image\/)[^)]+\)/i.test(e);return{hasImage:n||i,hasPdf:R(t).length>0||b().test(e)}},T=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:120,n=String(t||"").replace(/!\[[^\]]*\]\((?:https?:\/\/|data:image\/)[^)]+\)/gi," ").replace(b()," ").replace(/\[([^\]]+)\]\((?:https?:\/\/)[^)]+\)/gi,"$1").replace(/data:[^\s)]+/gi," ").replace(/https?:\/\/[^\s)]+/gi," ").replace(/[*_~`>#|]+/g," ").replace(/\s+/g," ").trim();return n.length<=e?n:"".concat(n.slice(0,Math.max(1,e-1)).trimEnd(),"â¦")},D=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t.id||!["user","assistant"].includes(t.role))return null;let e=C(t),n="user"===t.role?tn(e).text:e;return{id:t.id,role:t.role,preview:T(n),..._(t)}},M=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0;return t.find(t=>String(null==t?void 0:t.id)===String(e))||null},z=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.map(t=>({id:t.id,role:"assistant"===t.role?"assistant":"user"===t.role?"user":"system",parts:"user"===t.role?W(t.content||""):[{type:"text",text:t.content||""}],metadata:{createdAt:t.createdAt?new Date(m(t.createdAt)).toISOString():new Date().toISOString(),replyToMessageId:t.replyToMessageId||null}}))},$=t=>{let e="Chat request failed";if(!t)return{message:e,statusCode:null};let n=String(t.message||t||"").trim(),i=n.indexOf("{");
1if(i>=0)try{let t=JSON.parse(n.slice(i));return{message:"string"==typeof t.error?t.error:e,statusCode:Number(t.statusCode||t.status)||null}}catch(t){}let o=n.match(/\b(400|413)\b/);return{message:n&&!/<html/i.test(n)?n:e,statusCode:o?Number(o[1]):null}},U=new Map,E=t=>"zirai:pending-message:".concat(t),G=(t,e)=>{if(t){U.set(String(t),e);try{window.sessionStorage.setItem(E(t),JSON.stringify(e))}catch(t){}}},O=t=>{if(!t)return null;let e=String(t),n=U.get(e);U.delete(e);let i=null;try{let t=window.sessionStorage.getItem(E(e));window.sessionStorage.removeItem(E(e)),i=t?JSON.parse(t):null}catch(t){i=null}return n||i},q=/^whatsapp_/i,B=/\s*\[(?:\d+\s+image\(s\)|\d+\s+PDF document\(s\))(?:,\s*(?:\d+\s+image\(s\)|\d+\s+PDF document\(s\)))*\s+attached\]/gi,j=/SHARED_LOCATION[^\n]*\n(\{[\s\S]*?\})/i,J=/CURRENT_USER_MESSAGE:\s*([\s\S]*)$/i,K=/^WhatsApp location shared\.?$/i,H=new Set(["input-streaming","input-available","partial-call","call","running"]),Y={getFieldFertilizerRecommendation:"chat.toolStatus.getFieldFertilizerRecommendation",saveFieldSoilAnalysis:"chat.toolStatus.saveFieldSoilAnalysis",getFieldSoilAnalysis:"chat.toolStatus.getFieldSoilAnalysis",getUserFields:"chat.toolStatus.getUserFields",getFieldWeather:"chat.toolStatus.getFieldWeather",getFieldAccumulation:"chat.toolStatus.getFieldAccumulation",generateFieldReport:"chat.toolStatus.generateFieldReport",getFieldSummary:"chat.toolStatus.getFieldSummary",getFieldSatelliteIndex:"chat.toolStatus.getFieldSatelliteIndex",findPlantByName:"chat.toolStatus.findPlantByName",findLocationPlaceID:"chat.toolStatus.findLocationPlaceID",getFieldPolygonByAdaParsel:"chat.toolStatus.getFieldPolygonByAdaParsel",createFieldFromWhatsApp:"chat.toolStatus.createFieldFromWhatsApp",getLocationLightningActivity:"chat.toolStatus.getLocationLightningActivity",getLocationWeatherRiskSummary:"chat.toolStatus.getLocationWeatherRiskSummary",getLocationStormActivity:"chat.toolStatus.getLocationStormActivity",getFieldWeatherRiskSummary:"chat.toolStatus.getFieldWeatherRiskSummary",getFieldForecastRisk:"chat.toolStatus.getFieldForecastRisk",getFieldHourlyForecast:"chat.toolStatus.getFieldHourlyForecast",getFieldWorkabilityWindow:"chat.toolStatus.getFieldWorkabilityWindow",getFieldLightningActivity:"chat.toolStatus.getFieldLightningActivity",registerFieldGeoAlarm:"chat.toolStatus.registerFieldGeoAlarm",listFieldGeoAlarms:"chat.toolStatus.listFieldGeoAlarms",updateFieldGeoAlarm:"chat.toolStatus.updateFieldGeoAlarm",deleteFieldGeoAlarm:"chat.toolStatus.deleteFieldGeoAlarm",listFinanceLedgers:"chat.toolStatus.listFinanceLedgers",getFinanceLedger:"chat.toolStatus.getFinanceLedger",previewFinanceLedger:"chat.toolStatus.previewFinanceLedger",createFinanceLedger:"chat.toolStatus.createFinanceLedger",updateFinanceLedger:"chat.toolStatus.updateFinanceLedger",deleteFinanceLedger:"chat.toolStatus.deleteFinanceLedger",getLocalProductPrice:"chat.toolStatus.getLocalProductPrice",getGlobalProductPrice:"chat.toolStatus.getGlobalProductPrice",getFertilizerPrice:"chat.toolStatus.getFertilizerPrice",getInputPrices:"chat.toolStatus.getInputPrices",createNoteFromWhatsApp:"chat.toolStatus.createNoteFromWhatsApp",getUserNotes:"chat.toolStatus.getUserNotes",getNoteById:"chat.toolStatus.getNoteById",updateNoteFromWhatsApp:"chat.toolStatus.updateNoteFromWhatsApp",deleteNoteFromWhatsApp:"chat.toolStatus.deleteNoteFromWhatsApp",assignObserverToField:"chat.toolStatus.assignObserverToField",addFieldSeason:"chat.toolStatus.addFieldSeason",updateFieldSeason:"chat.toolStatus.updateFieldSeason",google_search:"chat.toolStatus.google_search",recordEpisodeResponse:"chat.toolStatus.recordEpisodeResponse"},V=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return q.test(String(t||""))},X=(t,e,n)=>{let i=String(t||"").trim();return i&&"New Session"!==i?V(i)?n:i:e},Z=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return String(t||"").replace(B,"").replace(/\n{3,}/g,"\n\n").trim()},Q=t=>{try{let e=JSON.parse(t),n=Number(null==e?void 0:e.latitude),i=Number(null==e?void 0:e.longitude);if(!Number.isFinite(n)||!Number.isFinite(i)||n<-90||n>90||i<-180||i>180)return null;return{latitude:n,longitude:i,address:"string"==typeof e.address?e.address.trim():"",label:"string"==typeof e.label?e.label.trim():""}}catch(t){return null}},tt=t=>{let{latitude:e,longitude:n}=t;return"https://www.google.com/maps?q=".concat(encodeURIComponent("".concat(e,",").concat(n)))},te=t=>t?t.label?t.label:t.address?t.address:"".concat(t.latitude.toFixed(5),", ").concat(t.longitude.toFixed(5)):"",tn=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=String(t||""),n=e.match(j),i=n?Q(n[1]):null,o=e.match(J),r=o?o[1]:e;return i&&!o&&(r=r.replace(j,"")),r=Z(r),i&&K.test(r)&&(r=""),{text:r,location:i}},ti=t=>{var e;return t&&"object"==typeof t?"string"==typeof t.toolName&&t.toolName.trim()?t.toolName.trim():"tool-invocation"===t.type&&(null===(e=t.toolInvocation)||void 0===e?void 0:e.toolName)?String(t.toolInvocation.toolName):"string"==typeof t.type&&t.type.startsWith("tool-")&&"tool-invocation"!==t.type?t.type.slice(5):"":""},to=t=>{var e;return(null==t?void 0:t.state)||(null==t?void 0:null===(e=t.toolInvocation)||void 0===e?void 0:e.state)||""},tr=t=>{if(!ti(t))return!1;let e=to(t);return e?H.has(e):(null==t?void 0:t.type)!=="text"},tl=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;let n=t.parts||[],i=n.some(t=>(null==t?void 0:t.type)==="text"&&"string"==typeof t.text&&""!==t.text),o=[...n].reverse().find(tr);if(o)return{kind:"tool",toolName:ti(o)};let r=n.some(t=>((null==t?void 0:t.type)==="reasoning"||(null==t?void 0:t.type)==="thinking")&&void 0!==t.text);return i?null:{kind:r?"thinking":"working"}},ta=(t,e)=>t?"tool"===t.kind?e(Y[t.toolName]||"chat.toolStatus.generic"):e("thinking"===t.kind?"chat.status.thinking":"chat.status.working"):""}}]);
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.