PageSourceSearch

https://civiltakeoff.ai/_next/static/chunks/7942.bbc5413de830996f.js

js civiltakeoff.ai collected 2026-10-05 15:13:27 UTC 12,760 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7942],{21507:(e,t,n)=>{n.d(t,{Z:()=>c,w:()=>d});var r=n(57437),o=n(2265),a=n(77165),s=n(69613),l=n(12594),i=n(67442);function d(e,t,n){let r=e;return n&&t&&(r+='<br/><hr style="border: none; border-top: 1px solid #e5e7eb; margin: 16px 0;"/>'.concat(t)),r=function(e){let t=(e,t)=>/style\s*=/i.test(e)?e.replace(/style\s*=\s*"([^"]*)"/i,(e,n)=>{let r=n.replace(/;?\s*$/,"")+"; "+t;return'style="'.concat(r,'"')}):e.replace(/>$/,' style="'.concat(t,'">')),n=e;return(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n.replace(/<table\b[^>]*>/gi,e=>t(e,"border-collapse: collapse; margin: 8px 0; width: 100%;"))).replace(/<td\b[^>]*>/gi,e=>t(e,"border: 1px solid #d1d5db; padding: 6px 10px; text-align: left; vertical-align: top;"))).replace(/<th\b[^>]*>/gi,e=>t(e,"border: 1px solid #d1d5db; padding: 6px 10px; text-align: left; vertical-align: top; background-color: #f9fafb; font-weight: 600;"))).replace(/<ul\b[^>]*>/gi,e=>t(e,"list-style: disc; padding-left: 1.5em; margin: 4px 0;"))).replace(/<ol\b[^>]*>/gi,e=>t(e,"list-style: decimal; padding-left: 1.5em; margin: 4px 0;"))).replace(/<li\b[^>]*>/gi,e=>t(e,"margin: 2px 0;"))).replace(/<p\b[^>]*>/gi,e=>t(e,"margin: 4px 0;"))).replace(/<h1\b[^>]*>/gi,e=>t(e,"font-size: 2em; font-weight: bold; margin: 0.67em 0;"))).replace(/<h2\b[^>]*>/gi,e=>t(e,"font-size: 1.5em; font-weight: bold; margin: 0.75em 0;"))).replace(/<h3\b[^>]*>/gi,e=>t(e,"font-size: 1.17em; font-weight: bold; margin: 0.83em 0;"))).replace(/<img\b[^>]*>/gi,e=>t(e,"max-width: 100%;"))}(r),"<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"/></head>\n<body style=\"margin: 0; padding: 16px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 14px; line-height: 1.5; color: #1a1a1a; word-wrap: break-word;\">\n".concat(r,"\n</body>\n</html>")}function c(e){let{open:t,onClose:n,onSend:c,subject:m,bodyHtml:u,signatureHtml:x,showSignature:p=!0,from:g,to:f,cc:h,bcc:b,attachmentNames:w,sending:v=!1,sendLabel:y="Send",sendingLabel:j="Sending..."}=e,N=(0,o.useRef)(null),[k,C]=(0,o.useState)(300),L=d(u,x,p);if((0,o.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[t]),!t)return null;let E=w&&w.length>0;return(0,r.jsx)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/50 p-4",onClick:e=>{e.target===e.currentTarget&&n()},children:(0,r.jsxs)("div",{className:"bg-background rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] flex flex-col overflow-hidden animate-in fade-in zoom-in-95 duration-150",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border bg-muted/80",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Email Preview"}),(0,r.jsx)("button",{type:"button",onClick:n,className:"rounded-md p-1 text-muted-foreground hover:text-muted-foreground hover:bg-muted",children:(0,r.jsx)(a.Z,{className:"h-5 w-5"})})]}),(0,r.jsxs)("div",{className:"px-5 py-3 border-b border-border space-y-1.5 bg-background text-sm",children:[g&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-right",children:"From"}),(0,r.jsx)("span",{className:"text-foreground font-medium",children:g})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-right",children:"To"}),(0,r.jsx)("span",{className:"text-foreground",children:f.join(", ")||"—"})]}),h&&h.length>0&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-right",children:"Cc"}),(0,r.jsx)("span",{className:"text-foreground",children:h.join(", ")})]}),b&&b.length>0&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-right",children:"Bcc"}),(0,r.jsx)("span",{className:"text-foreground",children:b.join(", ")})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("span",{className:"text-muted-foreground w-14 shrink-0 text-right",children:"Subject"}),(0,r.jsx)("span",{className:"text-foreground font-medium",children:m||"(No subject)"})]})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto bg-background",children:(0,r.jsx)("iframe",{ref:N,title:"Email preview",sandbox:"allow-same-origin",srcDoc:t?"<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\"/>\n  <style>\n    body {\n      margin: 0;\n      padding: 24px;\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      font-size: 14px;\n      line-height: 1.5;\n      color: #1a1a1a;\n      word-wrap: break-word;\n      overflow-wrap: break-word;\n    }\n    table { border-collapse: collapse; margin: 8px 0; width: 100%; table-layout: fixed; }\n    td, th { border: 1px solid #d1d5db; padding: 6px 10px; text-align: left; vertical-align: top; }\n    th { background-color: #f9fafb; font-weight: 600; }\n    a { color: #4f46e5; }\n    img { max-width: 100%; }\n    hr { border: none; border-top: 1px solid #e5e7eb; margin: 16px 0; }\n    p { margin: 4px 0; }\n    h1 { font-size: 2em; font-weight: bold; margin: 0.67em 0; }\n    h2 { font-size: 1.5em; font-weight: bold; margin: 0.75em 0; }\n    h3 { font-size: 1.17em; font-weight: bold; margin: 0.83em 0; }\n    ul { list-style: disc; padding-left: 1.5em; }\n    ol { list-style: decimal; padding-left: 1.5em; }\n    li { margin: 2px 0; }\n  </style>\n</head>\n<body>".concat(L,"</body>\n</html>"):void 0,onLoad:()=>{let e=()=>{var e,t;let n=null===(t=N.current)||void 0===t?void 0:null===(e=t.contentDocument)||void 0===e?void 0:e.body;n&&C(Math.min(Math.max(n.scrollHeight+32,200),600))};
1e(),setTimeout(e,300)},className:"w-full border-0",style:{height:k}})}),E&&(0,r.jsx)("div",{className:"px-5 py-2.5 border-t border-border bg-muted/50",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:w.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground",children:[(0,r.jsx)(s.Z,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,r.jsx)("span",{className:"max-w-[160px] truncate",children:e})]},t))})}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-t border-border bg-muted/80",children:[(0,r.jsxs)("button",{type:"button",onClick:n,disabled:v,className:"inline-flex items-center gap-1.5 rounded-md px-3.5 py-2 text-sm font-medium text-foreground hover:bg-muted disabled:opacity-50",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4"}),"Edit"]}),(0,r.jsxs)("button",{type:"button",onClick:c,disabled:v,className:"inline-flex items-center gap-1.5 rounded-md bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-500 disabled:opacity-50",children:[v?(0,r.jsx)("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)(i.Z,{className:"h-4 w-4"}),v?j:y]})]})]})})}},72671:(e,t,n)=>{n.d(t,{Z:()=>l});var r=n(57437),o=n(2265),a=n(77165),s=n(18752);function l(e){let{projectId:t,value:n,onChange:l,placeholder:i="Type email or name...",label:d,autoFocus:c=!1}=e,{toast:m}=(0,s.p)(),[u,x]=(0,o.useState)([]),[p,g]=(0,o.useState)(""),[f,h]=(0,o.useState)(!1),[b,w]=(0,o.useState)(!1),v=(0,o.useRef)(null),y=(0,o.useRef)(null),j=(0,o.useCallback)(async()=>{if(!b)try{let o=await fetch("/api/projects/".concat(t,"/crm-contacts"),{credentials:"include"});if(o.ok){var e,n,r;let t=await o.json(),a=[];for(let n of null!==(e=t.customer_contacts)&&void 0!==e?e:[])n.email&&a.push({email:n.email,name:[n.first_name,n.last_name].filter(Boolean).join(" "),source:"customer"});for(let e of null!==(n=t.vendor_contacts)&&void 0!==n?n:[])e.email&&a.push({email:e.email,name:[e.first_name,e.last_name].filter(Boolean).join(" "),source:"vendor",company:null===(r=e.vendors)||void 0===r?void 0:r.company_name});x(a),w(!0)}}catch(e){}},[t,b]),N=u.filter(e=>!n.some(t=>t.toLowerCase()===e.email.toLowerCase())),k=N.filter(e=>"customer"===e.source).slice(0,6),C=N.filter(e=>{var t;let n=p.toLowerCase();return!!n&&(e.email.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)||(null===(t=e.company)||void 0===t?void 0:t.toLowerCase().includes(n)))}),L=e=>{let t=e.trim();t&&!n.some(e=>e.toLowerCase()===t.toLowerCase())&&l([...n,t]),g(""),h(!1)},E=e=>{if(!e.trim())return[];let t=e.split(/[,;\s]+/).map(e=>e.trim()).filter(Boolean),r=new Set(n.map(e=>e.toLowerCase())),o=[],a=[];for(let e of t){if(!function(e){if(!e)return!1;let t=e.trim();return!(t.length>254||t.includes(" "))&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}(e)){a.push(e);continue}r.has(e.toLowerCase())||(r.add(e.toLowerCase()),o.push(e))}return o.length>0&&l([...n,...o]),a.length>0&&m({title:"Invalid email".concat(a.length>1?"s":""),description:a.join(", "),variant:"destructive"}),a},S=e=>{l(n.filter(t=>t!==e))};return(0,o.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,o.useEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>{var e;return null===(e=v.current)||void 0===e?void 0:e.focus()});return()=>cancelAnimationFrame(e)},[c]),(0,r.jsxs)("div",{ref:y,className:"relative",children:[d&&(0,r.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:d}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1 rounded-md border border-border px-2 py-1.5 min-h-[38px] focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500 bg-background cursor-text",onClick:()=>{var e;return null===(e=v.current)||void 0===e?void 0:e.focus()},children:[n.map(e=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-indigo-100 text-indigo-800 px-2 py-0.5 text-xs font-medium",children:[e,(0,r.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),S(e)},className:"hover:text-indigo-600",children:(0,r.jsx)(a.Z,{className:"h-3 w-3"})})]},e)),(0,r.jsx)("input",{ref:v,type:"text",value:p,onChange:e=>{g(e.target.value),f||h(!0),b||j()},onFocus:()=>{h(!0),b||j()},onKeyDown:e=>{"Enter"===e.key||","===e.key||";"===e.key?(e.preventDefault(),!p.trim()||(g(E(p).join(", ")),h(!1))):"Backspace"===e.key&&!p&&n.length>0&&S(n[n.length-1])},onBlur:()=>{p.trim()&&g(E(p).join(", "))},placeholder:0===n.length?i:"",className:"flex-1 min-w-[120px] border-none p-0 text-sm focus:ring-0 focus:outline-none"})]}),f&&(0,r.jsxs)("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-background shadow-lg max-h-64 overflow-y-auto",children:[!b&&(0,r.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading contacts…"}),b&&!p&&k.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-3 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Suggested from this project"}),k.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>L(e.email),className:"block w-full text-left px-3 py-2 text-sm hover:bg-indigo-50 dark:hover:bg-indigo-950 transition-colors",children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:e.name||e.email}),e.name&&(0,r.jsxs)("span",{className:"text-muted-foreground ml-1",children:["<",e.email,">"]}),(0,r.jsx)("span",{className:"ml-2 text-xs text-green-600",children:"customer"})]},"sug-".concat(e.email))),(0,r.jsx)("div",{className:"px-3 py-1.5 text-[11px] text-muted-foreground border-t border-border",children:"Type a name or email to search vendors and other customers"})]}),b&&!p&&0===k.length&&(0,r.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:0===u.length?"No contacts yet — type an email to add a new recipient.":"Type a name or email to search."}),b&&p&&0===C.length&&(0,r.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:["No contact matches “",p,"” — press Enter to add it as a free-form recipient."]}),b&&p&&C.slice(0,10).map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>L(e.email),className:"block w-full text-left px-3 py-2 text-sm hover:bg-indigo-50 dark:hover:bg-indigo-950 transition-colors",children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:e.name||e.email}),e.name&&(0,r.jsxs)("span",{className:"text-muted-foreground ml-1",children:["<",e.email,">"]}),(0,r.jsxs)("span",{className:"ml-2 text-xs ".concat("customer"===e.source?"text-green-600":"text-blue-600"),children:[e.source,e.company?" - ".concat(e.company):""]})]},e.email))]})]})}}}]);

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.