// Track initialization state let initialized = false; let workflowInitialized = false; function initScrollReveal() { const sections = document.querySelectorAll('.bp-section:not([data-revealed])'); sections.forEach(s => { s.setAttribute('data-revealed', 'true'); s.style.opacity = '0'; s.style.transform = 'translateY(40px) scale(0.98)'; s.style.transition = 'opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1)'; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.opacity = '1'; entry.target.style.transform = 'translateY(0) scale(1)'; } }); }, { threshold: 0.15 }); observer.observe(s); }); } function initWorkflow() { const aiItems = document.querySelectorAll('.bp-ai-item'); const useCaseTitle = document.getElementById('use-case-title'); const useCaseFlow = document.getElementById('use-case-workflow'); if (aiItems.length > 0 && useCaseTitle && useCaseFlow && !workflowInitialized) { workflowInitialized = true; const domainLabels = { agriculture: 'Agriculture', healthcare: 'Healthcare', finance: 'Finance', ecommerce: 'E-commerce', manufacturing: 'Manufacturing', education: 'Education', transportation: 'Transportation' }; const workflows = { agriculture: `
AG.01
๐Ÿ„
INTAKE

Dairy Ops Intake Agent

Goal

Collects herd size, milking routine, tank capacity, target yield, and compliance constraints.

RequirementsConstraints
AG.02
๐Ÿ“ˆ
SIGNALS

Herd & Milk Data Agent

Inputs

Ingests milk yield, SCC, temperature, activity, feed intake, and milking machine telemetry.

IoTQualityTelemetry
AG.03
๐Ÿง 
ANALYZE

Health & Quality Risk Agent

Decision

Flags mastitis risk, heat stress, and milk quality anomalies with explainable contributing factors.

DetectionExplainability
AG.04
๐Ÿฅ›
PLAN

Production Planner Agent

Output

Recommends feeding adjustments, milking schedule tuning, and routing to maximize yield and quality.

OptimizationProduction
AG.05
๐Ÿงพ
EXECUTE

Compliance & Ops Agent

Loop

Creates audit-ready logs, triggers tasks, and notifies staff for interventions and quality holds.

AutomationAuditingCompliance
`, healthcare: `
01
๐Ÿ“‹
HC.01

Patient Intake

Responsibilities

Captures patient demographics, symptoms, and insurance information.

RegistrationInsurance Check
02
๐Ÿ”
HC.02

Triage Agent

Responsibilities

Analyzes symptoms and determines urgency level.

Symptom AnalysisUrgency Level
03
โšก
HC.03

Severity Checker

Responsibilities

Evaluates severity and routes to care pathway.

Severity ScoringRouting
04
๐Ÿšจ
HC.04

ER Alert Agent

Responsibilities

Alerts ER staff for critical cases.

Critical AlertReal-time Notify
05
๐Ÿ‘จโ€โš•๏ธ
HC.05

Doctor Agent

Responsibilities

AI-assisted diagnosis recommendations.

Diagnosis AssistTreatment Plan
06
โœ“
HC.06

Treatment Plan

Responsibilities

Generates treatment plan with prescriptions.

PrescriptionsFollow-up
`, finance: `
01
๐Ÿ’ณ
FN.01

Transaction Agent

Responsibilities

Captures and validates transaction data.

Transaction CaptureValidation
02
๐Ÿ”
FN.02

Fraud Detection

Responsibilities

Analyzes patterns for fraudulent activity.

Pattern AnalysisAnomaly Detection
03
โšก
FN.03

Risk Scorer

Responsibilities

Calculates risk score and determines approval.

Risk ScoringDecision Routing
04
๐Ÿšจ
FN.04

Block Transaction

Responsibilities

Blocks high-risk transactions.

Transaction BlockSecurity Alert
05
๐Ÿ“Š
FN.05

Analysis Agent

Responsibilities

Performs detailed financial analysis.

Financial AnalysisReporting
06
๐Ÿ’ฐ
FN.06

Compliance Agent

Responsibilities

Validates compliance with regulations.

Regulatory CheckFinal Approval
`, ecommerce: `
01
๐Ÿ›’
EC.01

User Browse Agent

Responsibilities

Tracks browsing behavior and preferences.

User TrackingPreference Capture
02
๐Ÿง 
EC.02

Intent Analysis

Responsibilities

Analyzes user intent and behavior.

Intent DetectionBehavior Analysis
03
๐Ÿ“ฆ
EC.03

Inventory Agent

Responsibilities

Checks product availability.

Stock CheckAvailability
04
๐ŸŽ
EC.04

Recommendation Agent

Responsibilities

Generates personalized recommendations.

RecommendationsPersonalization
05
๐Ÿ’ฌ
EC.05

Cart Agent

Responsibilities

Manages cart operations and promos.

Cart ManagementPromo Codes
06
โœ“
EC.06

Checkout Agent

Responsibilities

Processes checkout and payment.

Payment ProcessOrder Confirm
`, manufacturing: `
01
๐Ÿ“Š
MF.01

Sensor Data Agent

Responsibilities

Collects real-time sensor data.

Data CollectionIoT Integration
02
๐Ÿ“ˆ
MF.02

Condition Monitor

Responsibilities

Monitors equipment health.

Health MonitoringPerformance
03
โšก
MF.03

Anomaly Detection

Responsibilities

Detects anomalies in processes.

Anomaly DetectionAlert Generation
04
๐Ÿ”ง
MF.04

Predictive Maintenance

Responsibilities

Predicts failures and schedules maintenance.

Failure PredictionMaintenance Sched
05
๐Ÿญ
MF.05

Schedule Agent

Responsibilities

Optimizes production schedules.

Production SchedResource Alloc
06
โœ“
MF.06

Quality Check Agent

Responsibilities

Performs quality inspection.

Quality InspectValidation
`, education: `
01
๐Ÿ“
ED.01

Student Login

Responsibilities

Authenticates and loads profile.

AuthenticationProfile Load
02
๐Ÿ“‹
ED.02

Assessment Agent

Responsibilities

Evaluates student knowledge.

AssessmentKnowledge Check
03
๐Ÿง 
ED.03

Learning Profile

Responsibilities

Builds personalized profile.

Profile BuildingPersonalization
04
๐ŸŽฏ
ED.04

Content Adapter

Responsibilities

Adapts content to proficiency level.

Content AdaptDifficulty Adjust
05
๐Ÿ“š
ED.05

Tutor Agent

Responsibilities

Provides personalized tutoring.

TutoringConcept Explain
06
โœ“
ED.06

Progress Tracker

Responsibilities

Tracks learning progress.

Progress TrackSkill Mastery
`, transportation: `
01
๐Ÿ—บ๏ธ
TR.01

Route Request Agent

Responsibilities

Processes route requests.

Route CaptureDestination
02
๐Ÿšฆ
TR.02

Traffic Analysis

Responsibilities

Analyzes traffic conditions.

Traffic DataCongestion Analysis
03
๐Ÿš—
TR.03

Fleet Agent

Responsibilities

Manages fleet assignments.

Fleet MgmtVehicle Assign
04
โšก
TR.04

Optimization Agent

Responsibilities

Optimizes routes for efficiency.

Route OptimEfficiency
05
โ›ฝ
TR.05

Fuel Planner

Responsibilities

Plans fuel stops and refueling.

Fuel PlanningRefuel Sched
06
๐Ÿ“
TR.06

Delivery Agent

Responsibilities

Manages final delivery execution.

Delivery ExecPOD Collection
` }; const selected = document.querySelector('.bp-ai-item--selected') || aiItems[0]; const initialDomain = selected && selected.dataset && selected.dataset.domain ? selected.dataset.domain : 'healthcare'; useCaseTitle.textContent = domainLabels[initialDomain] || initialDomain; useCaseFlow.innerHTML = workflows[initialDomain] || workflows['healthcare'] || ''; aiItems.forEach(item => { item.addEventListener('click', () => { aiItems.forEach(i => i.classList.remove('bp-ai-item--selected')); item.classList.add('bp-ai-item--selected'); const domain = item.dataset.domain; useCaseTitle.textContent = domainLabels[domain] || domain; useCaseFlow.innerHTML = workflows[domain] || workflows['healthcare'] || ''; // Re-init drag scroll after workflow change setTimeout(initWorkflowDragScroll, 0); }); }); // Initialize drag scroll for workflow initWorkflowDragScroll(); } } // Drag-to-scroll for workflow container function initWorkflowDragScroll() { const workflow = document.querySelector('.bp-use-case__workflow'); if (!workflow || workflow.dataset.dragInit) return; workflow.dataset.dragInit = 'true'; let isDown = false; let startX; let scrollLeft; workflow.addEventListener('mousedown', (e) => { isDown = true; workflow.classList.add('bp-dragging'); startX = e.pageX - workflow.offsetLeft; scrollLeft = workflow.scrollLeft; }, { passive: true }); workflow.addEventListener('mouseleave', () => { isDown = false; workflow.classList.remove('bp-dragging'); }, { passive: true }); workflow.addEventListener('mouseup', () => { isDown = false; workflow.classList.remove('bp-dragging'); }, { passive: true }); workflow.addEventListener('mousemove', (e) => { if (!isDown) return; e.preventDefault(); const x = e.pageX - workflow.offsetLeft; const walk = (x - startX) * 1.5; // Scroll speed multiplier workflow.scrollLeft = scrollLeft - walk; }); // Touch support let touchStartX; let touchScrollLeft; workflow.addEventListener('touchstart', (e) => { touchStartX = e.touches[0].pageX - workflow.offsetLeft; touchScrollLeft = workflow.scrollLeft; }, { passive: true }); workflow.addEventListener('touchmove', (e) => { const x = e.touches[0].pageX - workflow.offsetLeft; const walk = (x - touchStartX) * 1.5; workflow.scrollLeft = touchScrollLeft - walk; }, { passive: true }); } function initToTop() { const toTop = document.getElementById('toTop'); if (toTop && !toTop.hasAttribute('data-listener')) { toTop.setAttribute('data-listener', 'true'); window.addEventListener('scroll', () => { if (window.scrollY > 300) { toTop.classList.add('bp-totop--visible'); } else { toTop.classList.remove('bp-totop--visible'); } }, { passive: true }); toTop.addEventListener('click', () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } } function initHeroShuffle() { const title = document.getElementById('hero-title'); if (!title || title.dataset.shuffled) return; title.dataset.shuffled = 'true'; title.style.opacity = '1'; const kanaChars = 'ใ‚ใ„ใ†ใˆใŠใ‹ใใใ‘ใ“ใ•ใ—ใ™ใ›ใใŸใกใคใฆใจใชใซใฌใญใฎใฏใฒใตใธใปใพใฟใ‚€ใ‚ใ‚‚ใ‚„ใ‚Šใ‚‹ใ‚Œใ‚ใ‚ใ‚’ใ‚“'; const kanjiChars = 'ๆฅฝใ—ใŸใ„ใ„ใ‚ใฏใชใพใ‚‰ใ›ใฌใกใจใ€ใใใ‘ใ“ใ•ใ—ใ™'; const alphaChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&*'; const finalKanji = ['ๆฅฝ', 'ใ—', 'ใ„']; const finalText = 'Computing'; function runShuffle() { const kanaPart = title.querySelector('.bp-kanji'); const textPart = title.querySelector('.bp-title-text'); if (kanaPart) { const rb = kanaPart.querySelector('rb'); rb.innerHTML = ''; const spans = finalKanji.map(char => { const span = document.createElement('span'); span.className = 'shuffling'; span.dataset.final = char; span.textContent = kanaChars[Math.floor(Math.random() * kanaChars.length)]; rb.appendChild(span); return span; }); spans.forEach((span, i) => { setTimeout(() => { let shuffled = 0; const interval = setInterval(() => { span.textContent = kanaChars[Math.floor(Math.random() * kanaChars.length)]; shuffled++; if (shuffled >= 4) { clearInterval(interval); span.textContent = span.dataset.final; span.classList.remove('shuffling'); span.style.transition = 'transform 0.2s ease, opacity 0.2s ease'; span.style.transform = 'scale(1.1)'; span.style.opacity = '0.7'; setTimeout(() => { span.style.transform = 'scale(1)'; span.style.opacity = '1'; }, 150); } }, 60); }, i * 120); }); } if (textPart) { textPart.innerHTML = ''; const chars = finalText.split(''); const spans = chars.map(char => { const span = document.createElement('span'); span.className = 'shuffling'; span.dataset.final = char; span.textContent = char === ' ' ? ' ' : alphaChars[Math.floor(Math.random() * alphaChars.length)]; textPart.appendChild(span); return span; }); spans.forEach((span, i) => { setTimeout(() => { let shuffled = 0; const isSpace = span.dataset.final === ' '; const interval = setInterval(() => { span.textContent = isSpace ? ' ' : alphaChars[Math.floor(Math.random() * alphaChars.length)]; shuffled++; if (shuffled >= 4) { clearInterval(interval); span.textContent = span.dataset.final; span.classList.remove('shuffling'); span.style.transition = 'transform 0.2s ease, opacity 0.2s ease'; span.style.transform = 'scale(1.1)'; span.style.opacity = '0.7'; setTimeout(() => { span.style.transform = 'scale(1)'; span.style.opacity = '1'; }, 150); } }, 50); }, i * 100); }); } setTimeout(runShuffle, 25000); } runShuffle(); } function initAll() { initScrollReveal(); initWorkflow(); initToTop(); initHeroShuffle(); initHeroSlider(); } // Handle reduced motion preference function initReducedMotion() { const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; if (prefersReducedMotion) { document.documentElement.classList.add('reduced-motion'); } } // Hero Slider let heroSliderInterval; function initHeroSlider() { const dots = document.querySelectorAll('.bp-hero__dot'); const slides = document.querySelectorAll('.bp-hero__slide'); if (dots.length === 0 || slides.length === 0) return; let currentSlide = 0; function showSlide(index) { slides.forEach((slide, i) => { slide.classList.toggle('bp-hero__slide--active', i === index); }); dots.forEach((dot, i) => { dot.classList.toggle('bp-hero__dot--active', i === index); }); currentSlide = index; } dots.forEach((dot, index) => { dot.addEventListener('click', () => { showSlide(index); resetAutoPlay(); }); }); function nextSlide() { const next = (currentSlide + 1) % slides.length; showSlide(next); } function resetAutoPlay() { clearInterval(heroSliderInterval); heroSliderInterval = setInterval(nextSlide, 5000); } // Auto-play every 5 seconds resetAutoPlay(); } // Handle htmx loaded content - use event delegation document.body.addEventListener('htmx:afterSwap', (evt) => { // Only run if the swapped element is a section if (evt.target.tagName === 'SECTION') { initScrollReveal(); initWorkflow(); initHeroShuffle(); initHeroSlider(); } }); // Expose functions to window so app.js can access them window.initAll = initAll; window.initReducedMotion = initReducedMotion; window.initScrollReveal = initScrollReveal; window.initWorkflow = initWorkflow; window.initToTop = initToTop; window.initHeroShuffle = initHeroShuffle; window.initHeroSlider = initHeroSlider; window.initWorkflowDragScroll = initWorkflowDragScroll; console.log('[PAGE] Page initialization functions exposed to window')