const DS = window.OneCloudDesignSystem_bc49b9;
const PHONE = '877-774-1777', TEL = 'tel:8777741777', HQ = 'Plano', UPTIME = '99.9%';
const INDUSTRIES = [
  { key: 'medical', name: 'Medical', icon: 'Stethoscope', demo: ['Prestige Family Medical', '(877) 817-0430', 'Sarah F'], body: 'Book appointments, capture refill requests and triage after hours calls the way your practice wants.', bullets: ['Appointment booking, rescheduling and reminders', 'Refill requests captured and routed to staff', 'After hours triage with emergency escalation'], chat: ["Thanks for calling Prestige Family Medical. Are you calling to book, reschedule or ask a question?", "I need a refill on my blood pressure medication.", "I can send that to Dr. Patel's team. Which pharmacy should they use?"] },
  { key: 'dental', name: 'Dental', icon: 'Smile', demo: ['Bright Smile Dental', '(877) 816-0662', 'Roger M'], body: 'Fill the schedule, confirm cleanings and answer insurance questions without pulling the front desk off the floor.', bullets: ['New patient scheduling and recall reminders', 'Insurance and payment questions answered', 'Emergency calls routed to the on call dentist'], chat: ["Bright Smile Dental, how can I help you today?", "I'm a new patient and I need a cleaning.", "Welcome. I have Tuesday at 9 or Wednesday at 3. Which works better?"] },
  { key: 'law', name: 'Law firms', icon: 'Scale', demo: ['Parker and Associates', '(877) 817-0421', 'Laura F'], body: 'Intake new clients, schedule consultations, screen cases and keep every message confidential, 24/7.', bullets: ['New client intake with conflict screening questions', 'Consultation booking synced to your calendar', 'Confidential message taking, after hours included'], chat: ["Thanks for calling Parker and Associates. Are you a new or existing client?", "New. I was in a car accident last week.", "I'm sorry to hear that. I can book a free consultation. Does Thursday at 2 work?"] },
  { key: 'restaurant', name: 'Restaurants', icon: 'Utensils', demo: ['Tuscany Grille', '(877) 817-0203', 'Sarah F'], body: 'Take reservations, answer menu questions and hand catering requests to the manager.', bullets: ['Reservations with party size and time', 'Menu, hours and directions answered instantly', 'Catering inquiries routed to the manager'], chat: ["Tuscany Grille, would you like to make a reservation?", "Yes, a table for six on Friday night.", "I have 7:15 on the patio or 8:00 inside. Which would you like?"] },
  { key: 'realestate', name: 'Real estate', icon: 'House', demo: ['Pinnacle Realty Group', '(877) 817-0436', 'George M'], body: 'Qualify buyers and sellers, book showings and text the listing details while you are out showing homes.', bullets: ['Buyer and seller qualification questions', 'Showings booked to the agent calendar', 'Listing details texted to the caller'], chat: ["Pinnacle Realty Group. Are you looking to buy, sell or rent?", "Buy. I saw the listing on Maple Street.", "Great choice. I can text you the details and book a showing this weekend."] },
  { key: 'auto', name: 'Auto shops', icon: 'Car', demo: ['Apex Auto Care', '(877) 817-0426', 'Eric M'], body: 'Book service appointments, quote common jobs and keep tow calls moving while hands are busy.', bullets: ['Service appointments by vehicle and issue', 'Common job quotes and hours answered', 'Tow and breakdown calls routed to the bay'], chat: ["Apex Auto Care, what's going on with your vehicle?", "My check engine light came on this morning.", "Let's get it checked. I can fit you in tomorrow at 8 AM. What's the make and model?"] },
  { key: 'salon', name: 'Salons and beauty', icon: 'Scissors', demo: ['Luxe Beauty Studio', '(877) 817-0429', 'Laura F'], body: 'Book by stylist and service, confirm by text and fill cancellations without stopping mid blowout.', bullets: ['Booking by stylist, service and duration', 'Text confirmations and reminders', 'Cancellation slots offered to the waitlist'], chat: ["Luxe Beauty Studio. Who would you like to book with?", "Maria, for a cut and color.", "Maria has Saturday at 11. That's about two hours. Shall I book it?"] },
  { key: 'cpa', name: 'CPAs and accountants', icon: 'Calculator', demo: ['Summit Tax and Advisory', '(877) 817-0334', 'Charlie M'], body: 'Schedule tax prep, answer service questions and keep existing clients first during busy season.', bullets: ['Tax prep appointments during peak season', 'Service and pricing questions answered', 'Priority routing for existing clients'], chat: ["Summit Tax and Advisory. Are you an existing client?", "Yes, I need to file an extension.", "I'll flag that as priority for your preparer. What's the best number to call you back?"] },
  { key: 'any', name: 'Any business', icon: 'Building2', demo: ['Any business type', '(877) 817-0419', 'River N'], body: 'Trained on your hours, services and pricing. Takes messages, books time and routes urgent calls to you.', bullets: ['Trained on your business in one setup call', 'Messages delivered by text and email', 'Urgent calls routed to your cell'], chat: ["Thanks for calling. How can I help you today?", "What are your hours on Saturday?", "We're open 9 to 3 on Saturdays. Would you like me to book a time?"], alt: true },
];
const Container = ({ children, className = '', style }) => <div className={'container ' + className} style={style}>{children}</div>;
const Section = ({ id, tone, tight, children, className = '', labelledBy }) => <section id={id} aria-labelledby={labelledBy} className={['section', tight ? 'tight' : '', tone === 'subtle' ? 'surface-2' : tone === 'navy' ? 'navy on-navy' : '', className].join(' ')}><Container>{children}</Container></section>;
const Head = ({ id, title, lead, center }) => <div className={'head reveal' + (center ? ' center' : '')}><h2 id={id}>{title}</h2>{lead && <p className="lead">{lead}</p>}</div>;
const Check = ({ children }) => <li><span className="ck" aria-hidden="true"><DS.Icon name="Check" size={12} strokeWidth={3} /></span><span>{children}</span></li>;
const CallButton = ({ size = 'md', full }) => <DS.Button size={size} href={TEL} fullWidth={full} aria-label={'Call ' + PHONE}><DS.Icon name="Phone" size={18} /><span className="num">Call {PHONE}</span></DS.Button>;
const Tile = ({ icon, size = 56 }) => <span className="tile" aria-hidden="true" style={{ width: size, height: size }}><DS.Icon name={icon} size={size / 2} /></span>;
// Counts a stat up once when it scrolls into view. Values like "24/7" stay as written; `from` sets the starting number.
function CountUp({ value, from = 0, duration = 1200 }) {
  const m = /^([^\d]*)([\d.,]*\d)(.*)$/.exec(value); const ref = React.useRef(null);
  const countable = m && !m[3].startsWith('/');
  const end = countable ? parseFloat(m[2].replace(/,/g, '')) : 0, dec = countable && m[2].includes('.') ? m[2].split('.')[1].length : 0, commas = countable && m[2].includes(',');
  const [cur, setCur] = React.useState(countable ? from : end);
  React.useEffect(() => {
    if (!countable || !ref.current) return;
    if (!('IntersectionObserver' in window) || matchMedia('(prefers-reduced-motion: reduce)').matches) { setCur(end); return; }
    let raf = 0;
    const io = new IntersectionObserver(([e]) => { if (!e.isIntersecting) return; io.disconnect(); const t0 = performance.now();
      const step = t => { const p = Math.min(1, (t - t0) / duration), k = 1 - Math.pow(1 - p, 3); setCur(from + (end - from) * k); if (p < 1) raf = requestAnimationFrame(step); };
      raf = requestAnimationFrame(step); }, { threshold: 0.6 });
    io.observe(ref.current); return () => { io.disconnect(); cancelAnimationFrame(raf); };
  }, [value]);
  if (!countable) return <span>{value}</span>;
  return <span ref={ref} aria-label={value}><span aria-hidden="true">{m[1]}{commas ? Math.round(cur).toLocaleString('en-US') : cur.toFixed(dec)}{m[3]}</span></span>;
}
function Stats({ items }) { return <div className="stats reveal">{items.map(([n, l, from]) => <div key={l}><div className="stat-n num"><CountUp value={n} from={from} /></div><div className="stat-l">{l}</div></div>)}</div>; }
// Real page addresses. These match the URLs of the previous onecloudnetworks.com site so old links keep working.
const PATHS = { home: '/', phone: '/business-phone-systems', about: '/about-us', carriers: '/carriers', support: '/contact-us/', blog: '/blog/', terms: '/terms', privacy: '/privacy-policy/', industries: '/#industries' };
const pathFor = (k, p = {}) => k === 'post' ? '/' + p.slug + '/' : k === 'city' ? '/' + p.slug : (PATHS[k] || '/');
// Sends a form to sales@onecloudnetworks.com through formsubmit.co, the same service the previous site's forms used.
const sendForm = (subject, fields) => fetch('https://formsubmit.co/ajax/sales@onecloudnetworks.com', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify({ _subject: subject, _template: 'table', _captcha: 'false', ...fields }) })
  .then(r => r.json()).then(j => { if (String(j.success) !== 'true') throw new Error(j.message || 'Send failed'); });
const FORM_FAIL = 'Your message did not send. Please call ' + PHONE + ' or try again.';
Object.assign(window, { sendForm, FORM_FAIL, DS, PHONE, TEL, HQ, UPTIME, INDUSTRIES, Container, Section, Head, Check, CallButton, Tile, Stats, CountUp, PATHS, pathFor });