1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2325],{52325:(e,t,s)=>{s.d(t,{R:()=>eg});var a=s(54568),n=s(7620),i=s(21973),r=s(889),l=s(32064),o=s(60844),c=s(8994),d=s(2167),u=s(70577),h=s(62594),p=s(29304),m=s(84861),x=s(12598);function v(e){let t=window.SpeechRecognition||window.webkitSpeechRecognition;if(!t)return e.onError("unsupported"),()=>{};let s=new t;s.lang="en-US",s.interimResults=!0,s.continuous=!1;let a="";s.onresult=t=>{let s="";for(let e=t.resultIndex;e<t.results.length;e++){let n=t.results[e];n.isFinal?a+=n[0].transcript:s+=n[0].transcript}s&&e.onInterim((a+s).trim())},s.onerror=t=>e.onError(t.error||"error"),s.onend=()=>{a.trim()&&e.onFinal(a.trim()),e.onEnd()};try{s.start()}catch(t){e.onError("start-failed")}return()=>{try{s.abort()}catch(e){}}}function b(e,t){if(!("speechSynthesis"in window)){null==t||t();return}window.speechSynthesis.cancel();let s=new SpeechSynthesisUtterance(e.replace(/\n+\s*\**(sources?|references?|links?)\**\s*:[\s\S]*$/i,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/\(\s*(source|via)\s*:[^)]*\)/gi,"").replace(/\[\d+(?:\s*,\s*\d+)*\]/g,"").replace(/https?:\/\/\S+/g,"").replace(RegExp("[\\p{Extended_Pictographic}\\p{Emoji_Modifier}\\u200d\\ufe0f\\u20e3]","gu"),"").replace(/^\s*(?:[-*\u2022]|\d+[.)])\s+/gm,"").replace(/[*_`#>|~]/g,"").replace(/\bSETX\s*360\b/gi,"Set X three sixty").replace(/\bSETX\b/gi,"Set X").replace(/\s+/g," ").trim().slice(0,1200)),a=window.speechSynthesis.getVoices().filter(e=>e.lang.startsWith("en")),n=a.find(e=>/female|samantha|jenny|aria|zira|google us english/i.test(e.name))||a[0];n&&(s.voice=n),s.rate=1.02,s.onend=()=>null==t?void 0:t(),s.onerror=()=>null==t?void 0:t(),window.speechSynthesis.speak(s)}let f=()=>{"speechSynthesis"in window&&window.speechSynthesis.cancel()};var g=s(96666),j=s(66840),y=s(68165),w=s(57764),N=s(90008),k=s(75956),S=s(47677);async function _(e){let{data:t,error:s}=await N.supabase.schema("consumer").from("saved_places").select("id,label,address,lat,lng").eq("id",e).single();if(s||!t)throw Error("That saved place is no longer available.");return t}async function C(e,t,s){var a,n;let i=await _(e),r=await (0,k.a)(t,i),l=null!=(a=null==r?void 0:r.distanceMiles)?a:1.3*(0,S.vz)(t.lat,t.lng,i.lat,i.lng),o=null!=(n=null==r?void 0:r.durationMinutes)?n:l/28*60,c=(0,w.QV)(s,l,o,(0,w.D3)());return{place:i,rideType:s,distanceMiles:l,durationMinutes:o,fare:c}}async function E(e,t,s,a,n){var i;if(!(0,w.I1)(a))throw Error("Unknown ride type.");let{count:r}=await N.supabase.from("driver_profiles").select("id",{count:"exact",head:!0}).eq("status","online");if(!r)throw Error("No drivers are online right now, so nothing was requested or charged. Try again a bit later.");let l=await C(t,s,a),{data:o,error:c}=await N.supabase.from("rides").insert({rider_id:e,ride_type:a,pickup_lat:s.lat,pickup_lng:s.lng,dropoff_lat:l.place.lat,dropoff_lng:l.place.lng,distance_miles:l.distanceMiles,duration_minutes:l.durationMinutes,dropoff_address:l.place.address,fare_amount:Math.round(100*l.fare)/100,status:"pending",preferred_driver_id:null!=n?n:null}).select().single();if(c||!o)throw c||Error("Could not create ride");let d=null==(i=(await N.supabase.auth.getSession()).data.session)?void 0:i.access_token,u=await fetch("/api/checkout",{method:"POST",headers:{"Content-Type":"application/json",...d?{Authorization:"Bearer ".concat(d)}:{}},body:JSON.stringify({type:"ride",amountCents:Math.round(100*l.fare),rideId:o.id})}),h=await u.json();if(!u.ok||!h.url)throw Error(h.error||"Checkout failed");return h.url}var A=s(83801);let z=e=>{let{action:t,userId:s}=e,[i,r]=(0,n.useState)("economy"),[l,c]=(0,n.useState)(null),[d,u]=(0,n.use
1State)(null),[h,p]=(0,n.useState)(null),[m,x]=(0,n.useState)(""),[v,b]=(0,n.useState)(!1),[f,g]=(0,n.useState)(!0),N=t.favoriteDriver;(0,n.useEffect)(()=>{let e=!0;return(async()=>{try{let s=await (0,A.vM)(),a={lat:s.lat,lng:s.lon};if(!e)return;p(a);let n=await C(t.placeId,a,i);e&&(c(n.fare),u(n.durationMinutes),x(""))}catch(t){var s;e&&x((null==t||null==(s=t.message)?void 0:s.includes("saved place"))?t.message:"Turn on location so I can price this ride.")}})(),()=>{e=!1}},[t.placeId,i]);let k=async()=>{if(s&&h){b(!0),x("");try{window.location.href=await E(s,t.placeId,h,i,N&&f?N.id:null)}catch(e){x((null==e?void 0:e.message)||"Could not request the ride."),b(!1)}}};return(0,a.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:14,padding:12,marginTop:8,display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontWeight:700},children:[(0,a.jsx)(y.q$,{kind:t.kind,size:16})," ",t.label]}),(0,a.jsx)("div",{style:{fontSize:12,color:"var(--text-muted)"},children:t.address}),(0,a.jsx)("div",{style:{display:"flex",gap:6},children:w.vT.map(e=>(0,a.jsxs)("button",{onClick:()=>r(e.id),style:{flex:1,padding:"6px 4px",borderRadius:10,fontSize:12,cursor:"pointer",border:"1px solid ".concat(i===e.id?"var(--primary)":"var(--border)"),background:"transparent",color:"var(--text)"},children:[e.emoji," ",e.name.replace("SETX ","")]},e.id))}),N&&(0,a.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,cursor:"pointer"},children:[(0,a.jsx)("input",{type:"checkbox",checked:f,onChange:e=>g(e.target.checked)}),"Ask ",N.firstName," first (about ",N.minutes," min away)"]}),(0,a.jsx)("div",{style:{fontSize:13},children:null!=l?"$".concat(l.toFixed(2)," \xb7 about ").concat(Math.round(d||0)," min"):m?"":"Getting your fareâ¦"}),m&&(0,a.jsx)("div",{style:{color:"#ef4444",fontSize:12},children:m}),(0,a.jsxs)("button",{onClick:k,disabled:v||null==l,style:{padding:"10px",borderRadius:999,border:0,background:"var(--primary)",color:"#fff",fontWeight:700,cursor:"pointer",opacity:v||null==l?.5:1,display:"inline-flex",justifyContent:"center",gap:6},children:[v?(0,a.jsx)(o.A,{size:16,className:"animate-spin"}):(0,a.jsx)(j.A,{size:16})," Confirm and pay"]})]})};var T=s(70415),I=s(94971);let R=e=>!!e&&"archived"!==e.status&&"draft"!==e.status&&!/out/i.test(e.stock_status||"")&&!(null!=e.stock_quantity&&e.stock_quantity<=0&&/track|limited/i.test(e.stock_status||"")),M=e=>{let{action:t,onNavigate:s}=e,i=(0,I._)(),r=(0,n.useRef)(i.addToCart);r.current=i.addToCart;
1let[l,c]=(0,n.useState)(null),[d,u]=(0,n.useState)(!1),[h,p]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=!0;return N.supabase.from("products").select("id,name,price,image_urls,stock_status,stock_quantity,store_id,status").in("id",t.items.map(e=>e.productId)).is("deleted_at",null).then(t=>{let{data:s}=t;e&&c(Object.fromEntries((null!=s?s:[]).map(e=>[e.id,e])))}),()=>{e=!1}},[t.orderId]);let m=t.items.map(e=>({...e,p:null==l?void 0:l[e.productId]})),x=m.filter(e=>R(e.p)),v=x.reduce((e,t)=>e+Number(t.p.price)*t.qty,0),b=async()=>{for(let e of(u(!0),x)){let s=e.p;r.current({id:s.id,name:s.name,price:Number(s.price),image_urls:s.image_urls||[],store:t.storeName,store_id:s.store_id},e.qty),await new Promise(e=>setTimeout(e,60))}u(!1),p(!0)};return(0,a.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:14,padding:12,marginTop:8,display:"flex",flexDirection:"column",gap:6},children:[(0,a.jsx)("div",{style:{fontWeight:700},children:t.storeName}),m.map(e=>(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,opacity:l&&!R(e.p)?.5:1},children:[(0,a.jsxs)("span",{children:[e.qty," x ",e.name]}),(0,a.jsx)("span",{children:l?R(e.p)?"$".concat((Number(e.p.price)*e.qty).toFixed(2)):"Unavailable":""})]},e.productId)),l&&x.length>0&&(0,a.jsxs)("div",{style:{fontSize:12,color:"var(--text-muted)"},children:["Current prices. Total $",v.toFixed(2)," before tax and fees."]}),h?(0,a.jsx)("button",{onClick:()=>{window.dispatchEvent(new CustomEvent("NAVIGATE_TO_ENV",{detail:"market"})),null==s||s("market")},style:{padding:10,borderRadius:999,border:"1px solid var(--border)",background:"transparent",color:"var(--text)",fontWeight:700,cursor:"pointer"},children:"Added. Open Market to check out"}):(0,a.jsxs)("button",{onClick:b,disabled:d||!l||0===x.length,style:{padding:10,borderRadius:999,border:0,background:"var(--primary)",color:"#fff",fontWeight:700,cursor:"pointer",opacity:d||!l||0===x.length?.5:1,display:"inline-flex",justifyContent:"center",gap:6},children:[d?(0,a.jsx)(o.A,{size:16,className:"animate-spin"}):(0,a.jsx)(T.A,{size:16})," ",l&&0===x.length?"Nothing available right now":"Add to cart"]})]})};var q=s(6438),F=s(71413),P=s(18335),O=s(6158),W=s(72522),V=s(22260),U=s(65773);let L=e=>{let{action:t,user:s}=e,{appOrigin:i,activeCounty:r,scope:l}=(0,O.n)(),{startUpload:o}=(0,W.b)(),[c,d]=(0,n.useState)(t.content),[u,h]=(0,n.useState)([]),[m,v]=(0,n.useState)([]),[b,f]=(0,n.useState)(!1),[g,j]=(0,n.useState)(!1),[y,w]=(0,n.useState)(""),N=(0,n.useRef)(null),k=e=>{h(t=>[...t,e]),v(t=>[...t,URL.createObjectURL(e)])},S=async()=>{if((null==s?void 0:s.id)&&c.trim())try{let e=await Promise.all(u.map(e=>e.type.startsWith("image/")?(0,U.xl)(e,e.name):Promise.resolve(e)));o(e,null,{tenant_id:r||(null==s?void 0:s.county),profile_id:s.id,page_id:null,content:c.trim(),type:"post",category:"Everybody",poll_data:null,location:null==s?void 0:s.community,visibility_scope:l,group_id:null,is_nsfw:!1,tags:[],metadata:{platform:i,posted_via:"sabine_confirmed"}}),j(!0)}catch(e){w((null==e?void 0:e.message)||"Could not post. Try again.")}};return g?(0,a.jsx)("div",{className:"sabine-draft",children:(0,a.jsxs)("div",{className:"sabine-draft-done",children:[(0,a.jsx)(q.A,{size:16})," Posting to Social now."]})}):(0,a.jsxs)("div",{className:"sabine-draft",children:[(0,a.jsx)("div",{className:"sabine-draft-label",children:"Draft post (review before posting)"}),(0,a.jsx)("textarea",{value:c,onChange:e=>d(e.target.value),rows:5,maxLength:2e3,"aria-label":"Post draft"}),m.length>0&&(0,a.jsx)("div",{className:"sabine-draft-previews",children:m.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsx)("img",{src:e,alt:""}),(0,a.jsx)("button",{"aria-label":"Remove",onClick:()=>(e=>{h(t=>t.filter((t,s)=>s!==e)),v(t=>t.filter((t,s)=>s!==e))})(t),children:(0,a.jsx)(x.A,{size:12})})]},e))}),(0,a.jsxs)("div",{className:"sabine-draft-actions",children:[(0,a.jsxs)("button",{onClick:()=>f(!0),children:[(0,a.jsx)(F.A,{size:14})," Gallery"]}),(0,a.jsxs)("button",{onClick:()=>{var e;return null==(e=N.current)?void 0:e.click()},children:[(0,a.jsx)(P.A,{size:14})," Device"]}),(0,a.jsxs)("button",{className:"primary",disabled:!c.trim(),onClick:S,children:[(0,a.jsx)(p.A,{size:14})," Post"]})]}),y&&(0,a.jsx)("div",{className:"sabine-draft-err",children:y}),(0,a.jsx)("input",{ref:N,type:"file",accept:"image/*,video/*",multiple:!0,hidden:!0,onChange:e=>
1{Array.from(e.target.files||[]).forEach(k),e.target.value=""}}),b&&s&&(0,a.jsx)(V.W,{userId:s.id,pickTarget:"general",onClose:()=>f(!1),onPick:async e=>{f(!1);try{k(await (0,U.FO)(e))}catch(e){w("Could not attach that photo.")}},onUploadNew:async e=>{f(!1);try{k(await (0,U.xl)(await (await fetch(e)).blob(),"upload_".concat(Date.now(),".jpg")))}catch(e){w("Could not attach that photo.")}}})]})};var D=s(19760);let G=e=>{let{action:t,onNavigate:s}=e;return(0,a.jsxs)("button",{className:"sabine-openapp",onClick:()=>{window.dispatchEvent(new CustomEvent("NAVIGATE_TO_ENV",{detail:t.env})),null==s||s(t.env)},children:[(0,a.jsxs)("span",{className:"sabine-openapp-text",children:[(0,a.jsx)("strong",{children:t.label}),(0,a.jsx)("small",{children:t.description})]}),(0,a.jsxs)("span",{className:"sabine-openapp-go",children:["Open ",(0,a.jsx)(D.A,{size:14})]})]})};var $=s(75424),X=s(56178),Z=s(3485),J=s(16325);let B=e=>{let{action:t,onNavigate:s}=e,n=(0,Z.G)();return(0,a.jsxs)("div",{className:"sabine-draft",children:[(0,a.jsx)("div",{className:"sabine-draft-label",children:t.how}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.avatar?(0,a.jsx)("img",{src:t.avatar,alt:"",style:{width:40,height:40,borderRadius:"50%",objectFit:"cover"}}):(0,a.jsx)("div",{style:{width:40,height:40,borderRadius:"50%",background:"rgba(128,128,128,.3)",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700},children:t.name.slice(0,1).toUpperCase()}),(0,a.jsxs)("div",{style:{minWidth:0},children:[(0,a.jsx)("strong",{children:t.name}),t.handle&&(0,a.jsxs)("div",{style:{fontSize:12,opacity:.65},children:["@",t.handle]})]})]}),(0,a.jsxs)("div",{className:"sabine-draft-actions",children:[(0,a.jsxs)("button",{onClick:()=>{(0,J.JJ)(t.id),null==s||s("messages")},children:[(0,a.jsx)($.A,{size:14})," Message"]}),(0,a.jsxs)("button",{className:"primary",onClick:()=>null==n?void 0:n.startCall(t.id,t.name),children:[(0,a.jsx)(X.A,{size:14})," Call"]})]})]})};var H=s(56005);let K=e=>{let{action:t}=e,[s,i]=(0,n.useState)(!1);return(0,a.jsxs)("div",{className:"sabine-draft",children:[(0,a.jsx)("div",{className:"sabine-draft-label",children:"Suggested reply"}),(0,a.jsx)("div",{className:"sabine-draft-body",children:t.text}),s?(0,a.jsxs)("div",{className:"sabine-draft-done",children:[(0,a.jsx)(q.A,{size:16})," Put in your chat box. Review it and press send."]}):(0,a.jsx)("div",{className:"sabine-draft-actions",children:(0,a.jsxs)("button",{className:"primary",onClick:()=>{(0,g.s7)({target:"chat",text:t.text}),i(!0)},children:[(0,a.jsx)($.A,{size:14})," Use this reply"]})})]})},Q=e=>{let{action:t,onNavigate:s}=e;return(0,a.jsxs)("div",{className:"sabine-draft",children:[(0,a.jsxs)("div",{className:"sabine-draft-label",children:["Email draft",t.to?" to ".concat(t.to):""]}),t.subject&&(0,a.jsx)("strong",{children:t.subject}),(0,a.jsx)("div",{className:"sabine-draft-body",children:t.body}),(0,a.jsx)("div",{className:"sabine-draft-actions",children:(0,a.jsxs)("button",{className:"primary",onClick:()=>{(0,g.s7)({target:"mail",to:t.to,subject:t.subject,body:t.body}),null==s||s("mail")},children:[(0,a.jsx)(H.A,{size:14})," Open in Mail"]})})]})};var Y=s(51166),ee=s(32458);let et=e=>{let{action:t,userId:s}=e,[i,r]=(0,n.useState)(null),[l,c]=(0,n.useState)(0),[d,u]=(0,n.use
1State)(null),[h,p]=(0,n.useState)(!1),[m,x]=(0,n.useState)(!1),[v,b]=(0,n.useState)(""),f="home"===t.kind||"work"===t.kind;(0,n.useEffect)(()=>{let e=!0;return(0,ee.qU)(t.address).then(t=>e&&r(t)),f&&s&&N.supabase.schema("consumer").from("saved_places").select("id,address").eq("user_id",s).eq("kind",t.kind).maybeSingle().then(t=>{let{data:s}=t;return e&&u(null!=s?s:null)}),()=>{e=!1}},[t.address,t.kind,f,s]);let g=async()=>{let e=null==i?void 0:i[l];if(!e||!s)return;p(!0),b(""),d&&await N.supabase.schema("consumer").from("saved_places").delete().eq("id",d.id);let{error:a}=await N.supabase.schema("consumer").from("saved_places").insert({user_id:s,kind:t.kind,label:t.label,address:e.label.slice(0,300),lat:e.lat,lng:e.lng});if(p(!1),a)return void b("Could not save that place.");x(!0)};return m?(0,a.jsx)("div",{className:"sabine-draft",children:(0,a.jsxs)("div",{className:"sabine-draft-done",children:[(0,a.jsx)(q.A,{size:16})," Saved to Me > Saved Places."]})}):(0,a.jsxs)("div",{className:"sabine-draft",children:[(0,a.jsxs)("div",{className:"sabine-draft-label",children:["Save ",t.label," to Saved Places"]}),null===i&&(0,a.jsxs)("div",{className:"sabine-draft-done",children:[(0,a.jsx)(o.A,{size:14,className:"spin"})," Looking up the address..."]}),null!==i&&0===i.length&&(0,a.jsx)("div",{className:"sabine-draft-err",children:"I couldn't find that address. Try again with the street, city and ZIP."}),null!==i&&i.length>0&&i.slice(0,3).map((e,s)=>(0,a.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"flex-start",padding:"6px 0",fontSize:13,cursor:"pointer"},children:[(0,a.jsx)("input",{type:"radio",name:"sp-"+t.address,checked:l===s,onChange:()=>c(s)}),(0,a.jsxs)("span",{children:[(0,a.jsx)(Y.A,{size:12})," ",e.label]})]},s)),d&&(0,a.jsxs)("div",{style:{fontSize:12,opacity:.7,marginTop:4},children:["This replaces your current ",t.kind,": ",d.address]}),v&&(0,a.jsx)("div",{className:"sabine-draft-err",children:v}),(0,a.jsx)("div",{className:"sabine-draft-actions",children:(0,a.jsx)("button",{className:"primary",disabled:h||!(null==i?void 0:i.length)||!s,onClick:g,children:d?"Replace":"Save"})})]})};var es=s(22030),ea=s(26105),en=s(22713),ei=s(29742),er=s.n(ei);s(18162);let el=er().divIcon({className:"",html:'<div class="sabine-wx-pin"></div>',iconSize:[14,14],iconAnchor:[7,7]}),eo=e=>{var t;let{action:s}=e,[i,r]=(0,n.useState)(0),[l,o]=(0,n.useState)(null),[c,d]=(0,n.useState)(!1),u=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=!1;return fetch("https://api.rainviewer.com/public/weather-maps.json").then(e=>e.json()).then(t=>{var s;let a=null==t||null==(s=t.radar)?void 0:s.past,n=null==a?void 0:a[a.length-1];!e&&n?o({host:t.host,path:n.path,time:n.time}):e||d(!0)}).catch(()=>{e||d(!0)}),()=>{e=!0}},[]);let h=null!=s.rainChance?" Chance of rain today: ".concat(s.rainChance,"%."):"",p=0===i?"".concat(s.description.charAt(0).toUpperCase()+s.description.slice(1)," in ").concat(s.city,". Feels like ").concat(Math.round(null!=(t=s.feelsLike)?t:s.temp),"\xb0F, wind ").concat(Math.round(s.wind)," mph, humidity ").concat(s.humidity,"%.").concat(h):c?"Radar is unavailable right now.":l?"Live radar near ".concat(s.city.split(",")[0],", updated ").concat(new Date(1e3*l.time).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),"."):"Loading radarâ¦";return(0,a.jsxs)("div",{className:"sabine-wx",children:[(0,a.jsxs)("div",{className:"sabine-wx-slides",ref:u,onScroll:()=>{let e=u.current;e&&r(Math.round(e.scrollLeft/e.clientWidth))},children:[(0,a.jsxs)("div",{className:"sabine-wx-slide sabine-wx-main",children:[(0,a.jsx)("div",{className:"sabine-wx-city",children:s.city}),(0,a.jsxs)("div",{className:"sabine-wx-temp",children:[Math.round(s.temp),"\xb0F"]}),(0,a.jsx)("div",{className:"sabine-wx-desc",children:s.description}),null!=s.high&&null!=s.low&&(0,a.jsxs)("div",{className:"sabine-wx-hl",children:["H ",Math.round(s.high),"\xb0 \xb7 L ",Math.round(s.low),"\xb0"]})]}),(0,a.jsx)("div",{className:"sabine-wx-slide sabine-wx-radar",children:c?(0,a.jsx)("div",{className:"sabine-wx-none",children:"Radar unavailable"}):(0,a.jsxs)(es.W,{center:[s.lat,s.lon],zoom:7,zoomControl:!1,attributionControl:!1,dragging:!1,scrollWheelZoom:!1,doubleClickZoom:!1,touchZoom:!1,keyboard:!1,style:{height:"100%",width:"100%"},children:[(0,a.jsx)(ea.e,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png"}),l&&(0,a.jsx)(ea.e,{url:"".concat(l.host).concat(l.path,"/256/{z}/{x}/{y}/2/1_1.png"),opacity:.75}),(0,a.jsx)(en.p,{position:[s.lat,s.lon],icon:el})]})})]}),(0,a.jsx)("div",{className:"sabine-wx-dots",children:[0,1].map(e=>(0,a.jsx)("button",{"aria-label":e?"Radar":"Current weather",className:i===e?"on":"",onClick:()=>(e=>{var t;return null==(t=u.current)?void 0:t.scrollTo({left:e*u.current.clientWidth,behavior:"smooth"})})(e)},e))}),(0,a.jsx)("div",{className:"sabine-wx-caption",children:p})]})},ec=e=>{let{action:t,onNavigate:s}=e;return(0,a.jsxs)("button",{className:"sabine-openapp",onClick:()=>(0,g.qV)(t.source,s),children:[(0,a.jsxs)("span",{className:"sabine-openapp-text",children:[(0,a.jsx)("small",{style:{textTransform:"uppercase",letterSpacing:".05em"},children:t.source.type}),(0,a.jsx)("strong",{children:t.source.title})]}),(0,a.jsxs)("span",{className:"sabine-openapp-go",children:["Open ",(0,a.jsx)(D.A,{size:14})]})]})};var ed=s(18937),eu=s(38756);function eh(e,t){let s=t.tracks.map(e=>({...e,artist:e.artist_name}));s.length&&e(s[0],s)}let ep=e=>{let{action:t}=e,{playSong:s}=(0,O.n)();return(0,a.jsxs)("button",{className:"sabine-openapp",onClick:()=>eh(s,t),children:[t.cover?(0,a.jsx)("img",{src:t.cover,alt:"",style:{width:44,height:44,borderRadius:8,objectFit:"cover"}}):(0,a.jsx)(ed.A,{size:22}),(0,a.jsxs)("span",{className:"sabine-openapp-text",children:[(0,a.jsx)("strong",{children:t.title}),(0,a.jsxs)("small",{children:["playlist"===t.kind?"Playlist \xb7 ":"",t.subtitle]})]}),(0,a.jsxs)("span",{className:"sabine-openapp-go",children:[(0,a.jsx)(eu.A,{size:14})," Play"]})]})};var em=s(10614),ex=s(12494),ev=s(48517);let eb=e=>{var t;let{action:s}
1=e,i=Math.min(null!=(t=s.stock)?t:10,10),[r,l]=(0,n.useState)(1),[o,c]=(0,n.useState)(!1),[d,u]=(0,n.useState)(""),h=async()=>{c(!0),u("");try{let{data:{session:e}}=await N.supabase.auth.getSession();if(!e)throw Error("Sign in to check out");let t=await fetch("/api/checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e.access_token)},body:JSON.stringify({type:"biz_cart",cartItems:[{productId:s.productId,quantity:r}],customerId:e.user.id})}),a=await t.json();if(!t.ok||a.error||!a.url)throw Error(a.error||"Could not start checkout");window.location.href=a.url}catch(e){u(e.message||"Could not start checkout"),c(!1)}};return(0,a.jsxs)("div",{className:"sabine-openapp",style:{flexDirection:"column",alignItems:"stretch",cursor:"default"},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:[(0,a.jsxs)("span",{className:"sabine-openapp-text",children:[(0,a.jsx)("strong",{children:s.name}),(0,a.jsxs)("small",{children:[s.storeName," \xb7 $",(s.priceCents/100).toFixed(2)," each"]})]}),(0,a.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,a.jsx)("button",{"aria-label":"Fewer",disabled:r<=1||o,onClick:()=>l(e=>e-1),style:{background:"none",border:0,color:"inherit"},children:(0,a.jsx)(em.A,{size:16})}),(0,a.jsx)("strong",{children:r}),(0,a.jsx)("button",{"aria-label":"More",disabled:r>=i||o,onClick:()=>l(e=>e+1),style:{background:"none",border:0,color:"inherit"},children:(0,a.jsx)(ex.A,{size:16})})]})]}),(0,a.jsxs)("button",{className:"sabine-openapp-go",disabled:o,onClick:h,style:{justifyContent:"center",padding:"10px 0",marginTop:8,borderRadius:10,border:"1px solid rgba(96,165,250,.5)",background:"transparent"},children:[(0,a.jsx)(ev.A,{size:14})," ",o?"Opening secure checkoutâ¦":"Review & pay \xb7 $".concat((s.priceCents*r/100).toFixed(2),"+")]}),(0,a.jsx)("small",{style:{opacity:.65,marginTop:6,textAlign:"center"},children:"Pick a card on file or add a new one (save it to your wallet if you like). Tax and fees are shown before you pay. Nothing is charged until you confirm."}),d&&(0,a.jsx)("small",{style:{color:"#f87171",marginTop:4},children:d})]})};s(99865);
1let ef=/(\*\*[^*]+\*\*|\[[^\]]+\]\((?:https?:\/\/|\/)[^)\s]*\)|https?:\/\/[^\s)]+)/g,eg=e=>{let{user:t,platform:s,context:j,initialQuery:y,autoSend:w,persist:N,saveHistory:k,onNavigate:S,initialTurns:_,chatId:C,onChatSaved:E,onNewChat:A}=e,[T,I]=(0,n.useState)(()=>null!=_?_:N?(0,g.Nx)():[]),R=(0,n.useRef)(null!=C?C:null),[q,F]=(0,n.useState)(y||""),[P,W]=(0,n.useState)(!1),[V,U]=(0,n.useState)(!1),D=(0,n.useRef)(null),$=(0,n.useRef)(!1),{playSong:X}=(0,O.n)(),Z=(0,n.useRef)([]),J=(0,n.useRef)(T);J.current=T;let[H,Y]=(0,n.useState)(!1),[ee,es]=(0,n.useState)(!1),[ea,en]=(0,n.useState)("listening"),[ei,er]=(0,n.useState)(""),[el,ed]=(0,n.useState)(!1),eu=(0,n.useRef)(!1),em=(0,n.useRef)(!1),ex=(0,n.useRef)(()=>{}),ev=!!(window.SpeechRecognition||window.webkitSpeechRecognition),eg=()=>{if(!eu.current||em.current)return;en("listening"),er("");let e=!1;ex.current=v({onInterim:e=>er(e),onFinal:async t=>{e=!0,en("thinking"),er(t);let s=await ey(t);if(!eu.current)return;en("speaking"),er(s);let a=Z.current.find(e=>"open_app"===e.type),n=Z.current.find(e=>"open_result"===e.type);if(a){ej(),window.dispatchEvent(new CustomEvent("NAVIGATE_TO_ENV",{detail:a.env})),null==S||S(a.env),b(s,()=>{});return}let i=Z.current.find(e=>"play_music"===e.type);if(i){ej(),b(s,()=>eh(X,i));return}if(n){ej(),(0,g.qV)(n.source,S),b(s,()=>{});return}b(s,()=>eg())},onEnd:()=>{eu.current&&!e&&eg()},onError:e=>{"no-speech"!==e&&"aborted"!==e&&ej()}})},ej=()=>{eu.current=!1,ex.current(),f(),es(!1),Y(!1)};(0,n.useEffect)(()=>()=>{eu.current=!1,ex.current(),f()},[]),(0,n.useEffect)(()=>{N&&(0,g.eK)(T)},[T,N]),(0,n.useEffect)(()=>{if(!(null!=k?k:N)||!(null==t?void 0:t.id)||P||0===T.length||!T.some(e=>"user"===e.role))return;let e=setTimeout(async()=>{let e=await (0,g.iv)(R.current,T,s);e&&e!==R.current&&(R.current=e,null==E||E(e))},600);return()=>clearTimeout(e)},[T,P,N,k,null==t?void 0:t.id]),(0,n.useEffect)(()=>{var e;null==(e=D.current)||e.scrollIntoView({behavior:"smooth"})},[T,P]);let ey=async e=>{let a=e.trim();if(!a||P)return"";let n=J.current;I(e=>[...e,{role:"user",content:a}]),F(""),W(!0);try{let{reply:e,sources:i,actions:r}=await (0,g.A6)({message:a,history:n,platform:s,context:j,deep:V,userProfile:t?{id:t.id,name:t.name}:void 0});Z.current=r||[];let l=e||"I couldn't come up with an answer for that.";return I(e=>[...e,{role:"tevis",content:l,sources:i,actions:r}]),l}catch(t){let e="I hit a snag reaching my brain just now. Give me a moment and try again.";return I(t=>[...t,{role:"tevis",content:e}]),e}finally{W(!1)}};(0,n.useEffect)(()=>{w&&y&&!$.current&&($.current=!0,ey(y))},[]);let ew=(0,g.Z8)(s);return(0,a.jsxs)("div",{className:"tevis-panel",children:[j&&(0,a.jsxs)("div",{className:"tevis-context-chip",children:[(0,a.jsx)(r.A,{size:12}),(0,a.jsxs)("span",{children:["Asking about ",j.type,j.title?": ".concat(j.title):""]})]}),(0,a.jsxs)("div",{className:"tevis-messages",children:[(0,a.jsx)("div",{className:"tevis-msg tevis-msg-bot",children:(0,a.jsx)("div",{className:"tevis-bubble",children:"Howdy! I'm Sabine, your Southeast Texas guide. Ask me about local businesses, events, jobs, city services, or anything on SETX 360 â I can search the whole platform plus the web links we index."})}),0===T.length&&!P&&(0,a.jsx)("div",{className:"tevis-chips",children:(j?["Tell me more about this ".concat(j.type),"Is this legit / worth it?","Find similar things nearby"]:ew).map(e=>(0,a.jsx)("button",{className:"tevis-chip",onClick:()=>ey(e),children:e},e))}),T.map((e,s)=>{var i,r;return(0,a.jsxs)("div",{className:"tevis-msg ".concat("user"===e.role?"tevis-msg-user":"tevis-msg-bot"),children:[(0,a.jsx)("div",{className:"tevis-bubble",children:(r=e.content,r.split("\n").map((e,t)=>(0,a.jsx)("div",{className:"tevis-line",children:e.trim()?function(e,t,s){let i=e.split(ef).filter(Boolean);return(0,a.jsx)(n.Fragment,{children:i.map((e,t)=>{if(e.startsWith("**")&&e.endsWith("**"))return(0,a.jsx)("strong",{children:e.slice(2,-2)},t);let i=e.match(/^\[([^\]]+)\]\((\/[^)\s]*)\)$/);if(i)return(0,a.jsx)("a",{href:i[2],onClick:e=>{e.preventDefault();let t=new URLSearchParams(i[2].split("?")[1]||"").get("env");t&&(window.dispatchEvent(new CustomEvent("NAVIGATE_TO_ENV",{detail:t})),null==s||s(t))},children:i[1]},t);let r=e.match(/^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/);return r?(0,a.jsx)("a",{href:r[2],target:"_blank",rel:"noopener noreferrer",children:r[1]},t):/^https?:\/\//.test(e)?(0,a.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:e},t):(0,a.jsx)(n.Fragment,{children:e},t)})},t)}(e,t,S):(0,a.jsx)("br",{})},t)))}),null==(i=e.actions)?void 0:i.map((e,s)=>"ride_offer"===e.type?(0,a.jsx)(z,{action:e,userId:null==t?void 0:t.id},s):"reply_draft"===e.type?(0,a.jsx)(K,{action:e},s):"mail_draft"===e.type?(0,a.jsx)(Q,{action:e,onNavigate:S},s):"contact"===e.type?(0,a.jsx)(B,{action:e,onNavigate:S},s):"save_place"===e.type?(0,a.jsx)(et,{action:e,userId:null==t?void 0:t.id},s):"post_draft"===e.type?(0,a.jsx)(L,{action:e,user:t},s):"open_app"===e.type?(0,a.jsx)(G,{action:e,onNavigate:S},s):"checkout"===e.type?(0,a.jsx)(eb,{action:e},s):"play_music"===e.type?(0,a.jsx)(ep,{action:e},s):"weather"===e.type?(0,a.jsx)(eo,{action:e},s):"open_result"===e.type?(0,a.jsx)(ec,{action:e,onNavigate:S},s):(0,a.jsx)(M,{action:e,onNavigate:S},s)),e.sources&&e.sources.length>0&&(0,a.jsx)("div",{className:"tevis-sources",children:e.sources.map((e,t)=>(0,a.jsxs)("button",{className:"tevis-source",onClick:()=>(e=>{if(e.external&&e.url)return void window.open(e.url,"_blank","noopener,noreferrer");let t=(0,g.OG)(e);if(!t){e.url&&window.open(e.url,"_blank","noopener,noreferrer");return}t.env&&window.dispatchEvent(new CustomEvent("NAVIGATE_TO_ENV",{detail:t.env})),t.event&&t.detail&&window.dispatchEvent(new CustomEvent(t.event,{detail:t.detail})),null==S||S(t.env||"social")})(e),children:[(0,a.jsx)("span",{className:"tevis-source-type",children:e.type}),(0,a.jsx)("span",{className:"tevis-source-title",children:e.title}),e.external&&(0,a.jsx)(l.A,{size:11})]},t))})]},s)}),P&&(0,a.jsx)("div",{className:"tevis-msg tevis-msg-bot",children:(0,a.jsxs)("div",{className:"tevis-bubble tevis-thinking",children:[(0,a.jsx)(o.A,{size:14,className:"animate-spin"})," Sabine is searchingâ¦"]})}),(0,a.jsx)("div",{ref:D})]}),(0,a.jsxs)("div",{className:"tevis-toolbar",children:[(0,a.jsxs)("button",{className:"tevis-tool ".concat(V?"active":""),onClick:()=>U(e=>!e),title:"Use the stronger model for harder questions",children:[(0,a.jsx)(c.A,{size:13})," Think harder"]}),N&&T.length>0&&(0,a.jsxs)("button",{className:"tevis-tool",onClick:()=>{(0,g.w4)(),A?A():I([])},children:[(0,a.jsx)(d.A,{size:13})," ",A?"New chat":"Clear"]})]}),(0,a.jsxs)("form",{className:"tevis-input-row",onSubmit:e=>{e.preventDefault(),ey(q)},children:[(0,a.jsx)(i.W,{size:20,className:"tevis-input-icon"}),(0,a.jsx)("input",{value:q,onChange:e=>F(e.target.value),placeholder:"Ask Sabine anythingâ¦",maxLength:1e3,"aria-label":"Ask Sabine"}),ev&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"sabine-mic ".concat(H?"on":""),onClick:()=>
1{if(H){ex.current(),Y(!1);return}Y(!0),ex.current=v({onInterim:e=>F(e),onFinal:e=>F(e),onEnd:()=>Y(!1),onError:()=>Y(!1)})},"aria-label":"Dictate",children:(0,a.jsx)(u.A,{size:16})}),(0,a.jsx)("button",{type:"button",className:"sabine-mic",onClick:()=>{eu.current=!0,em.current=!1,ed(!1),es(!0),eg()},"aria-label":"Talk with Sabine",children:(0,a.jsx)(h.A,{size:16})})]}),(0,a.jsx)("button",{type:"submit",disabled:!q.trim()||P,"aria-label":"Send",children:(0,a.jsx)(p.A,{size:16})})]}),ee&&(0,a.jsxs)("div",{className:"sabine-live",children:[(0,a.jsx)("div",{className:"sabine-live-orb ".concat(ea)}),(0,a.jsx)("div",{className:"sabine-live-state",children:el?"Muted":"listening"===ea?"Listening":"thinking"===ea?"Thinking":"Sabine is speaking"}),(0,a.jsx)("div",{className:"sabine-live-text",children:ei}),(0,a.jsxs)("div",{className:"sabine-live-actions",children:[(0,a.jsx)("button",{"aria-label":el?"Unmute":"Mute",onClick:()=>{let e=!em.current;em.current=e,ed(e),e?ex.current():"listening"===ea&&eg()},children:el?(0,a.jsx)(m.A,{size:22}):(0,a.jsx)(u.A,{size:22})}),(0,a.jsx)("button",{className:"end","aria-label":"End conversation",onClick:ej,children:(0,a.jsx)(x.A,{size:22})})]})]})]})}}}]);
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.