1import{A as e,D as t,F as n,G as r,I as i,L as a,M as o,N as s,O as c,T as l,j as u,k as d,w as f}from"./index-PhjSgcsr.js";function p(e){return e.replace(/\D/g,``)}function m(e){let t=p(e);return t.length===11&&t.startsWith(`1`)&&(t=t.slice(1)),t.slice(0,10)}function h(e){let t=m(e);return t.length===0?``:t.length<4?`(${t}`:t.length<7?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`}function g(e){let t=m(e);if(t.length!==10||/^(\d)\1{9}$/.test(t))return!1;let n=t.slice(0,3),r=t.slice(3,6);return!(n[0]===`0`||n[0]===`1`||r[0]===`0`||r[0]===`1`||n[1]===`1`&&n[2]===`1`||r[1]===`1`&&r[2]===`1`)}var _=o(n(),a(),i(),c(1,`Please enter your email.`),t(254,`That email address is too long.`),l(`Enter a valid email address.`));d({name:o(n(),a(),c(1,`Please enter your name.`),t(120,`That name is too long.`)),email:_,phone:e(o(n(),a(),f(e=>e===``||g(e),`Enter a valid US phone number.`)),``),company:e(o(n(),a(),t(160)),``),message:o(n(),a(),c(1,`Please include a message.`),t(5e3,`Please shorten your message.`)),source:e(u([`contact`,`jw-cole`,`careers`]),`contact`),meta:e(s(o(n(),t(200)),o(n(),t(500))),{}),website:e(n(),``)});function v(e){let t=`message`,n=[];for(let r of e.split(` 2`))r.startsWith(`event:`)?t=r.slice(6).trim():r.startsWith(`data:`)&&n.push(r.slice(5).trim());if(n.length===0)return null;try{return{event:t,data:JSON.parse(n.join(` 3`))}}catch{return{event:t,data:n.join(` 4`)}}}async function y(e,t){t?.({step:`submitting`});let n;try{n=await fetch(r(`/api/contact`)??`/api/contact`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(e)})}catch{let e=`We could not reach the server. Check your connection and try again.`;return t?.({step:`error`,message:e}),{ok:!1,error:e}}if(!n.body){let e=n.ok?`The server returned an empty response.`:`Server error (${n.status}).`;return t?.({step:`error`,message:e}),{ok:!1,error:e}}let i=n.body.getReader(),a=new TextDecoder,o=``,s={ok:!1,error:`The submission did not complete. Please try again.`};for(;;){let{done:e,value:n}=await i.read();if(e)break;o+=a.decode(n,{stream:!0});let r=o.split(` 5 6`);o=r.pop()??``;for(let e of r){let n=v(e);if(!n)continue;let r=n.data??{};n.event===`status`?t?.({step:r.step??`sending`,message:r.message}):n.event===`done`?(s={ok:!0},t?.({step:`sent`})):n.event===`error`&&(s={ok:!1,error:r.message,fieldErrors:r.fieldErrors},t?.({step:`error`,message:r.message,fieldErrors:r.fieldErrors}))}}return s}export{g as i,_ as n,h as r,y as t};
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.