PageSourceSearch

https://www.pei-privaterealestate.com/obx/_next/static/chunks/3008.3c4a5fd4d8dd0350.js

js pei-privaterealestate.com collected 2026-09-28 09:11:43 UTC 10,405 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3008],{3008:(e,t,s)=>{s.r(t),s.d(t,{default:()=>b});var a=s(95155),n=s(19946);let i=(0,n.A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),r=(0,n.A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var o=s(70333),l=s(15580),c=s(5196),d=s(66766),u=s(12115),m=s(37222),p=s(34095),x=s(68631),g=s(6035),h=s(17028);function b(e){let{blaizeSession:t,userId:s,brand:n,onClose:b}=e,[y,f]=(0,u.useState)(""),[j,k]=(0,u.useState)({}),[v,w]=(0,u.useState)({}),[N,C]=(0,u.useState)({}),[T,S]=(0,u.useState)({}),[_,A]=(0,u.useState)(null),I=(0,u.useRef)(null),P=(0,u.useRef)(null),{messages:E,conversationId:F,isLoading:q,error:D,sendMessage:z,clearError:M}=(0,x.Y)({blaizeSession:t,brand:n,userId:s,onError:e=>{(0,m.e)(e)||console.error("Chat error:",e),A(null),P.current&&clearTimeout(P.current)},onStreamStart:()=>{A("analysing"),P.current=setTimeout(()=>{A("thinking")},1e3)},onStreamComplete:()=>{A(null),P.current&&clearTimeout(P.current)},onContentStart:()=>{setTimeout(()=>{A(null),P.current&&clearTimeout(P.current)},300)}}),R=()=>{var e;null==(e=I.current)||e.scrollIntoView({behavior:"smooth"})};(0,u.useEffect)(()=>{R()},[E]),(0,u.useEffect)(()=>()=>{P.current&&clearTimeout(P.current)},[]);let K=async e=>{e.preventDefault(),y.trim()&&!q&&(f(""),await z(y))},L=e=>{navigator.clipboard.writeText(e)},O=(e,t)=>{N[e]||(k(s=>({...s,[e]:t})),"unsure"!==t?S(t=>({...t,[e]:!0})):(S(t=>({...t,[e]:!1})),C(t=>({...t,[e]:!0}))))},H=async e=>{let t=j[e],a=v[e]||"",n=E.find(t=>t.id===e);if(!(null==n?void 0:n.databricks_request_id)&&!(null==n?void 0:n.trace_id))return void console.error("No request ID found for feedback message");if(!t||"unsure"===t)return;let i="yes"===t;try{let t=new AbortController,r=setTimeout(()=>t.abort(),6e4),o=await (0,m.u)("/api/fusion-proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:"/api/copilot/feedback",method:"POST",headers:{"Content-Type":"application/json"},body:{request_id:n.databricks_request_id||n.trace_id,trace_id:n.trace_id,value:i,userId:s,rationale:a||(i?"The response was helpful":"The response was not helpful")}}),signal:t.signal},{module:"copilot-widget",operationName:"submit_copilot_feedback",upstream:"fusion-api"}).finally(()=>clearTimeout(r));if(!o.ok)throw Error("HTTP error! status: ".concat(o.status));await o.json(),C(t=>({...t,[e]:!0})),S(t=>({...t,[e]:!1}))}catch(t){(0,m.e)(t)||console.error("Error submitting feedback:",t instanceof Error?t.message:String(t)),k(t=>{let s={...t};return delete s[e],s})}};return(0,a.jsxs)("div",{className:"fixed bottom-4 right-4 z-[60] flex h-[80vh] w-[650px] flex-col rounded-lg border border-gray-200 bg-white shadow-2xl","data-testid":"widget-ask-pei-container",...(0,p.Mt)({panel:"copilot",component:"copilot-widget"}),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-center",children:[(0,a.jsx)(d.default,{className:"relative z-10",alt:"Ask PEI Icon",src:"/obx/sparkle-star.svg",width:24,height:24}),(0,a.jsx)("span",{className:"font-roboto relative z-10 ml-1 text-base font-normal leading-[150%] text-black/90",children:"Ask PEI"})]}),(0,a.jsx)("button",{onClick:b,className:"text-gray-500 hover:text-gray-700","data-testid":"widget-ask-pei-close-btn",...(0,p.Mt)({panel:"copilot",component:"copilot-widget",item:"close-button",action:p.RH.CLICK}),children:(0,a.jsx)(i,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4","data-testid":"widget-ask-pei-messages",children:[0===E.length&&(0,a.jsx)("div",{className:"mt-8 text-center text-gray-500",children:(0,a.jsx)("p",{className:"text-sm",children:"Ask me anything about infrastructure investments."})}),E.map((e,t)=>{var s;return"assistant"!==e.role||e.content||t===E.length-1?(0,a.jsx)(g.b,{conversationId:F,messageId:e.id,traceId:null!=(s=e.trace_id)?s:null,children:(0,a.jsx)("div",{className:"mb-4",children:"user"===e.role?(0,a.jsx)("div",{className:"mb-2 flex justify-start",children:(0,a.jsx)("div",{className:"max-w-[80%] rounded-lg p-3",style:{backgroundColor:"#939393"},children:(0,a.jsx)("div",{className:"flex items-start gap-2",children:(0,a.jsx)("div",{className:"text-sm",style:{color:"#12100F",opacity:.7},children:(0,a.jsx)(h.P,{content:e.content})})})})}):(0,a.jsx)("div",{className:"mb-2 flex justify-end",children:(0,a.jsxs)("div",{className:"max-w-[80%] rounded-lg p-4",style:{backgroundColor:"#FAFAFA"},children:[(0,a.jsx)("div",{className:"text-sm",style:{color:"#12100F",opacity:.7},children:_&&t===E.length-1?(0,a.jsx)("span",{className:"italic text-gray-700",children:"analysing"===_?(0,a.jsx)(a.Fragment,{children:["Analysing","y
1our","question..."].map((e,t)=>(0,a.jsxs)("span",{className:"inline-block animate-pulse",style:{animationDelay:"".concat(.15*t,"s")},children:[e,t<2?"\xa0":""]},t))}):(0,a.jsx)(a.Fragment,{children:["Thinking..."].map((e,t)=>(0,a.jsx)("span",{className:"inline-block animate-pulse",style:{animationDelay:"".concat(.15*t,"s")},children:e},t))})}):e.content||t!==E.length-1?e.content&&(0,a.jsx)(h.P,{content:e.content,customOutputs:e.custom_outputs,messageId:e.id}):(0,a.jsx)("span",{className:"italic text-gray-700",children:["Waiting","for","response..."].map((e,t)=>(0,a.jsxs)("span",{className:"inline-block animate-pulse",style:{animationDelay:"".concat(.15*t,"s")},children:[e,t<2?"\xa0":""]},t))})}),e.content&&(!q||q&&t<E.length-1)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mt-3 flex items-center gap-2 border-t pt-3",children:(0,a.jsx)("button",{onClick:()=>L(e.content),className:"rounded p-1.5 transition-colors hover:bg-gray-200",title:"Copy","data-testid":"widget-ask-pei-copy-btn-".concat(e.id),children:(0,a.jsx)(r,{className:"h-4 w-4"})})}),N[e.id]?(0,a.jsx)("div",{className:"mt-4 border-t pt-3",children:(0,a.jsxs)("p",{className:"flex items-center text-sm text-green-600",children:[(0,a.jsx)(c.A,{className:"mr-1 h-4 w-4"}),"Thank you for your feedback!"]})}):(0,a.jsxs)("div",{className:"mt-4 border-t pt-3",children:[(0,a.jsx)("p",{className:"mb-2 text-sm text-gray-600",children:"Is this a good response for the question?"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{onClick:()=>O(e.id,"yes"),disabled:N[e.id],"data-testid":"widget-ask-pei-feedback-yes-btn-".concat(e.id),className:"rounded-md px-3 py-1.5 text-sm transition-colors ".concat("yes"===j[e.id]?"bg-green-100 text-green-700":"bg-gray-100 hover:bg-gray-200"," ").concat(N[e.id]?"cursor-not-allowed opacity-50":""),children:[(0,a.jsx)(o.A,{className:"mr-1 inline h-4 w-4"}),"Yes"]}),(0,a.jsxs)("button",{onClick:()=>O(e.id,"no"),disabled:N[e.id],"data-testid":"widget-ask-pei-feedback-no-btn-".concat(e.id),className:"rounded-md px-3 py-1.5 text-sm transition-colors ".concat("no"===j[e.id]?"bg-red-100 text-red-700":"bg-gray-100 hover:bg-gray-200"," ").concat(N[e.id]?"cursor-not-allowed opacity-50":""),children:[(0,a.jsx)(l.A,{className:"mr-1 inline h-4 w-4"}),"No"]}),(0,a.jsx)("button",{onClick:()=>O(e.id,"unsure"),disabled:N[e.id],"data-testid":"widget-ask-pei-feedback-unsure-btn-".concat(e.id),className:"rounded-md px-3 py-1.5 text-sm transition-colors ".concat("unsure"===j[e.id]?"bg-gray-300":"bg-gray-100 hover:bg-gray-200"," ").concat(N[e.id]?"cursor-not-allowed opacity-50":""),children:"I don't know"})]}),T[e.id]&&"unsure"!==j[e.id]&&(0,a.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,a.jsx)("textarea",{value:v[e.id]||"",onChange:t=>w(s=>({...s,[e.id]:t.target.value})),placeholder:"Tell us more about your experience (optional)","data-testid":"widget-ask-pei-feedback-textarea-".concat(e.id),className:"w-full resize-none rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",rows:3}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>{S(t=>({...t,[e.id]:!1})),k(t=>{let s={...t};return delete s[e.id],s})},"data-testid":"widget-ask-pei-feedback-cancel-btn-".concat(e.id),className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-800",children:"Cancel"}),(0,a.jsx)("button",{onClick:()=>void H(e.id),"data-testid":"widget-ask-pei-feedback-submit-btn-".concat(e.id),className:"rounded-md bg-blue-500 px-4 py-1.5 text-sm text-white hover:bg-blue-600",children:"Submit Feedback"})]})]})]})]})]})})})},e.id):null}),D&&(0,a.jsxs)("div",{className:"mb-4 rounded-lg bg-red-50 p-3 text-center text-sm",children:[(0,a.jsx)("p",{className:"font-medium text-red-600",children:D.message.includes("403")?"Access denied. Please check your permissions.":D.message.includes("504")?"Request timed out. Please try again.":D.message.includes("500")?"Server error. Please try again later.":D.message.includes("429")?"Too many requests. Please wait a moment.":"Something went wrong. Please try again."}),(0,a.jsx)("button",{onClick:()=>M(),className:"mt-2 text-xs text-red-500 underline hover:text-red-700","data-testid":"widget-ask-pei-error-dismiss-btn",children:"Dismiss"})]}),(0,a.jsx)("div",{ref:I})]}),(0,a.jsx)("form",{onSubmit:e=>void K(e),className:"border-t p-4","data-testid":"widget-ask-pei-form",...(0,p.Mt)({panel:"copilot",component:"
1copilot-widget",item:"chat-form",action:p.RH.CLICK}),children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"text",value:y,onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),K(e))},placeholder:"ask PEI",className:"w-full rounded-full bg-gray-100 px-4 py-3 pr-14 focus:outline-none focus:ring-2 focus:ring-blue-500","data-testid":"widget-ask-pei-input",disabled:q,...(0,p.Mt)({panel:"copilot",component:"copilot-widget",item:"chat-input"})}),(0,a.jsx)("button",{type:"submit",disabled:!y.trim()||q,className:"absolute right-2 top-1/2 h-10 w-10 text-gray-500 hover:text-gray-700 disabled:opacity-50","data-testid":"widget-ask-pei-send-btn",style:{transform:"translateY(-50%)"},...(0,p.Mt)({panel:"copilot",component:"copilot-widget",action:"submit"}),children:(0,a.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})})]})}}}]);

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.