Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.
AMO CertVault is a production-grade certificate management system designed for aviation AMOs. It uses AI to extract, validate, and organise aircraft spares certificates — EASA Form 1, FAA 8130-3, COC, CRS, and more.
Introduction
AMO CertVault digitises the certificate management workflow for Aircraft Approved Maintenance Organisations. Upload a PDF certificate, and the AI engine automatically extracts part numbers, serial numbers, suppliers, dates, and certificate types — even from multi-item documents with dozens of line items, including kit/overhaul sub-components.
Why CertVault? Aviation AMOs handle hundreds of certificates monthly. Manual data entry is slow, error-prone, and non-auditable. CertVault automates extraction with 92%+ accuracy using Gemini AI, with a regex fallback ensuring zero data loss.
Administrators managing user access and system configuration
Quick Start
1
Create Your Account
Navigate to /auth and create an account with your email and password. You will receive a Visitor role by default.
Use your company email — administrators can identify and approve your account faster.
2
Await Admin Approval
An administrator will review your account and assign an appropriate role (Quality Manager, Store Personnel, or Auditor). You will be redirected to a Pending Approval screen until activated.
Do not create multiple accounts — duplicate sign-ups will be flagged and may delay approval.
3
Upload Your First Certificate
Go to Upload Certificate from the sidebar. Drag and drop a PDF or use the Camera Scanner to capture a physical certificate directly from your device.
Supported formats: PDF (text-based or scanned). Maximum file size: 10MB per document.
4
Review AI Extraction
The system will automatically extract certificate data using Gemini AI. Review the extracted fields — part number, serial number, description, supplier, certificate type, and date. Edit any inaccuracies and save.
Use the Certificates page to search by part number, description, serial number, or supplier. Full-text search is powered by PostgreSQL tsvector with trigram fuzzy matching.
Features
AI-Powered Extraction
Gemini 2.5 Flash extracts structured data from PDFs using tool-calling. Supports EASA Form 1, FAA 8130-3, COC, CRS, and 37+ certificate type mappings. Regex fallback ensures zero data loss.
Multi-Item Certificates
Certificates with multiple line items are parsed into individual records — each with its own part number, serial number, quantity, and condition. Supports 100+ items per certificate.
Kit Sub-Item Extraction
Overhaul kits, gasket sets, and assembly items with sub-components are automatically detected. Sub-items use decimal line numbering (14.1, 14.2) to preserve parent-child relationships.
Role-Based Access (RBAC)
Five-tier RBAC: Admin, Quality Manager, Store Personnel, Auditor, and Visitor. Row-Level Security (RLS) enforced at the database level — no client-side bypasses possible.
Camera Scanning
Capture certificates directly from your device camera with real-time preview, crop overlay, and flash toggle. The image is uploaded and processed through the same AI extraction pipeline.
Batch Upload
Upload multiple PDFs simultaneously. Each file is processed independently with live progress tracking, error reporting, and searchable batch history.
Certificate Cart and Bulk Print
Add certificates to a cart from search results or the duplicates page. Bulk print PDFs or export selected certificates as CSV for external reporting and audits.
Duplicate Detection
Dedicated duplicate management page groups certificates by part number across the entire system. View, compare, delete, or add duplicates to cart with role-restricted actions.
AI Chat Assistant
Streaming AI chat assistant for aviation certificate questions. Renders responses with Markdown formatting — headers, tables, code blocks, bold/italic, and clickable links.
PDF Compression
Structural PDF compression using pdf-lib’s object stream optimisation. Anomaly detection automatically flags suspiciously high compression ratios (below 0.2).
Complete Audit Trail
Every create, update, and delete action is logged with user ID, certificate ID, timestamp, and action details in JSON format. Fully queryable and exportable.
Full-Text Search
PostgreSQL tsvector-based search across certificates and items. Trigram similarity matching handles typos and partial matches. Debounced input for responsive UX.
System Architecture
The application is a React SPA backed by Lovable Cloud, providing authentication, PostgreSQL database, file storage, and serverless edge functions — no separate backend to manage.
Certificate Processing
Extraction Pipeline
The extraction pipeline is fully automated — upload a PDF and the system handles file storage, AI extraction, type normalisation, duplicate checking, and database persistence without manual intervention.
Extraction Algorithm
AI Path (Primary)
Regex Fallback
The primary extraction path uses Gemini 2.5 Flash with structured tool-calling:
1. Download PDF from storage → base64 encode2. Call Gemini 2.5 Flash with extraction tool schema3. Parse tool_calls response → structured JSON4. Normalize certificate_type against 37 pattern mappings5. Normalize all dates to ISO 8601 format6. Detect kit/overhaul items by keyword matching7. Sort kit sub-items by decimal line_number (14.1, 14.2...)8. Re-sequence to integer line numbers for storage9. Validate part numbers with aviation regex patterns10. Compute per-item confidence score (0.0 – 1.0)
The AI prompt explicitly instructs Gemini to extract unnumbered rows beneath kit/overhaul/set items as sub-components with decimal line numbers.
When AI extraction fails (rate limits, malformed PDFs), the system falls back to pattern-based extraction:
1. Parse BT/ET (Begin Text / End Text) blocks from raw PDF bytes2. Detect aviation keywords against 36 known patterns3. Require >= 2 keyword matches to classify as certificate4. Extract fields via tiered regex patterns: - Part Number: 8 patterns (P/N, PN, Part No., etc.) - Serial Number: 6 patterns (S/N, SN, Serial, etc.) - Supplier: 7 patterns (MFR, Manufacturer, etc.) - Description: 5 patterns (DESC, Item, etc.) - Date: 6 patterns with ISO normalisation5. Multi-item detection via repeating pattern groups6. Tiered confidence: High (>=0.8), Medium (0.5–0.79), Low (<0.5)
Regex extraction typically achieves 60–75% accuracy compared to AI’s 92%+. Always review regex-extracted certificates manually.
Kit Sub-Item Extraction
Kit certificates (overhaul kits, gasket sets, hardware assemblies) contain a parent item with multiple sub-components listed beneath it. CertVault automatically detects and preserves these relationships.
Sub-component rows — indented with teal connector line and junction dot
Hover highlights the entire kit group
Certificate Type Mapping
Supported Certificate Types (37+ input patterns)
The system normalises dozens of input variations to standardised types:
Input Pattern(s)
Normalised Type
Common Sources
EASA Form 1, JAA Form 1, TCCA Form One
easa-form-1
European / Canadian MROs
FAA 8130-3, FAA Form 8130-3, Airworthiness Approval
8130-3
FAA-certified facilities
Certificate of Conformity, COC, C of C
coc
Manufacturers and distributors
Certificate of Release to Service, CRS
crs
Maintenance organisations
Test Report, Inspection Report
test-report
Testing laboratories
Shipping Document, Packing Slip
shipping
Logistics and supply chain
CAAC Form, ANAC Form, DGCA, Serviceable Tag
other
Other national authorities
If a certificate type is not recognised, it defaults to other. You can manually update the type in the certificate detail view.
Cart and Bulk Operations
1
Add to Cart
From the Certificates page or Duplicates page, click the cart icon on any certificate item. The cart state persists via React Context across navigation.
You can add items from multiple certificates — the cart is not limited to a single document.
2
Review Cart
Navigate to the Cart page to see all selected items with part numbers, descriptions, and source certificate references. Remove unwanted items individually or clear the entire cart.
3
Bulk Print PDFs
Click Print All to open all selected certificate PDFs in new tabs for printing. Each PDF links to the original uploaded document in storage.
4
Export to CSV
Click Export CSV to download a spreadsheet containing part number, description, serial number, quantity, condition, and source certificate for each selected item.
The CSV export is compatible with Excel, Google Sheets, and most ERP/inventory systems.
Duplicate Management
The Duplicates page identifies certificates that share the same part number across different uploads, enabling quick review and cleanup.
Destructive Action: Deleting a duplicate removes the certificate item permanently from the database. This action is restricted to Admin and Quality Manager roles and is logged in the audit trail with full details.
Detection Algorithm
FUNCTION detectDuplicates(): groups <- GROUP certificate_items BY LOWER(part_number) duplicates <- FILTER groups WHERE COUNT > 1 FOR EACH group IN duplicates: SORT items BY upload_date DESC DISPLAY with certificate metadata: - Part number, description, serial number - Source certificate ID and type - Upload date and uploader - Available actions (View, Cart, Delete) RETURN duplicates WITH search filtering
Duplicates are matched by part number only (case-insensitive). Different serial numbers with the same part number are flagged as duplicates — the same part from different batches should be reviewable together.
AI Chat Assistant
The AI Assistant provides streaming responses about aviation certificates and compliance, rendered with full Markdown formatting.
The chat uses the cert-ai-chat edge function connecting to Gemini AI via the Lovable AI Gateway. No API key configuration is required — it works out of the box.
Capabilities
Certificate Knowledge
FAA Form 8130-3 field explanations, EASA Form 1 block descriptions, certificate status types, traceability requirements.
Compliance Guidance
Regulatory requirements for parts documentation, release-to-service criteria, certificate validity periods.
Part number formats, supplier identification, condition codes (NE, OH, SV, AR), quantity and unit conventions.
Response Formatting
The AI assistant renders responses with rich Markdown:
Headers (##, ###) with teal accent styling
Bold and italic text for emphasis
Inline code and fenced code blocks with monospace font
Tables with borders and header highlighting
Ordered and unordered lists with proper nesting
Clickable links to external references
Try these starter prompts: “What fields are on FAA Form 8130-3?”, “Explain certificate status types”, “How does OCR extraction work?”
User Roles and Permissions
Permission Matrix
Permissions Grid
Role Lifecycle
Security Model
Permission
Admin
Quality Manager
Store Personnel
Auditor
Visitor
View certificates
✅
✅
✅
✅
❌
Upload certificates
✅
✅
✅
❌
❌
Edit certificates
✅
✅
❌
❌
❌
Delete certificates
✅
✅
❌
❌
❌
Batch upload
✅
✅
✅
❌
❌
Camera scanning
✅
✅
✅
❌
❌
View audit logs
✅
✅
❌
✅
❌
Manage users
✅
❌
❌
❌
❌
Certificate cart
✅
✅
✅
✅
❌
Duplicate management
✅
✅
✅
✅
❌
AI Assistant
✅
✅
✅
✅
❌
System settings
✅
❌
❌
❌
❌
Principle of Least Privilege: Each role has only the minimum permissions required. The admin dashboard includes an interactive permissions matrix for visual reference. Actual enforcement is at the database level via RLS policies.
Row-Level Security (RLS) is enforced on every table:
-- Only active, non-visitor users can view certificatesCREATE POLICY "Authenticated users can view certificates"ON public.certificates FOR SELECT TO authenticatedUSING ( public.has_role(auth.uid(), 'admin') OR public.has_role(auth.uid(), 'quality_manager') OR public.has_role(auth.uid(), 'store_personnel') OR public.has_role(auth.uid(), 'auditor'));
The has_role() function is defined as SECURITY DEFINER to prevent recursive RLS evaluation. Never store roles on the profiles table — they are isolated in user_roles to prevent privilege escalation.
User Management Dashboard (Admin)
Stats Overview
Summary cards showing total users, active accounts, pending visitors, and role distribution with animated counters.
Interactive Permissions Matrix
Visual reference grid with toggle checkboxes showing what each role can do. Labeled as reference-only — actual enforcement is via RLS.
User Table
Avatar initials, coloured role badges, activation toggle switches, time-ago join dates, and role assignment dropdowns.
Role Summary Cards
Per-role cards with custom icons, colour coding, and permission count — quick overview of the access hierarchy.
Data Model
All tables use UUID primary keys, automatic timestamps, and Row-Level Security. The search_vector columns enable PostgreSQL full-text search with automatic updates via triggers.
API Reference
Edge Functions
extract-certificate — AI Certificate Extraction
Method:POST Authentication: Bearer token (anon key)Extracts structured data from a PDF certificate using Gemini AI with regex fallback.Request Body
A flagged: true response indicates the compression ratio is suspiciously high (below 0.2), meaning 80%+ size reduction. The original is always preserved.
cert-ai-chat — Streaming AI Chat
Method:POST Authentication: Bearer token (anon key)Streaming AI chat for aviation certificate questions using Server-Sent Events (SSE).Request Body
{ "messages": [ { "role": "user", "content": "What fields are on FAA Form 8130-3?" } ]}
Response (SSE Stream)
data: {"choices":[{"delta":{"content":"FAA Form 8130-3 contains..."}}]}data: {"choices":[{"delta":{"content":" the following blocks:\n\n"}}]}data: [DONE]
The response follows the OpenAI-compatible delta streaming format. The frontend uses ReadableStream with chunk-by-chunk parsing for real-time display.
Application Routes
Route
Page
Access Level
Description
/
Landing / Dashboard
Public / Authenticated
Marketing page (unauthenticated) or interactive dashboard (authenticated)
/auth
Login and Sign Up
Public
Email/password authentication with form validation
/pending
Pending Approval
Visitor
Displayed after sign-up while awaiting admin activation
/certificates
Certificate List
Authenticated
Searchable, paginated list with status filters
/certificates/:id
Certificate Detail
Authenticated
Full certificate view with items table and kit indicators
/upload
Upload Certificate
Upload roles
Single PDF upload with AI extraction preview
/batch-upload
Batch Upload
Upload roles
Multi-file upload with progress tracking
/batch-history
Batch History
Authenticated
Historical batch upload records and item details
/scan
Camera Scanner
Upload roles
Device camera capture with crop overlay
/cart
Certificate Cart
Authenticated
Selected items for bulk print / CSV export
/duplicates
Duplicate Management
Authenticated
Part-number-grouped duplicate review and cleanup
/ai-assistant
AI Chat
Authenticated
Streaming AI assistant for certificate questions
/audit-logs
Audit Logs
Admin / QM / Auditor
Paginated audit trail with action filtering
/settings
User Settings
Authenticated
Profile and preference management
/admin/users
User Management
Admin only
User activation, role assignment, permissions matrix
/privacy-policy
Privacy Policy
Public
Data handling and privacy information
Tech Stack
Frontend
React 18 + TypeScript + Vite for fast builds. Tailwind CSS + shadcn/ui component library. Framer Motion for animations.
State Management
TanStack Query for server state with intelligent caching. React Context for client-side state (auth, cart).
For image-only PDFs, use the Camera Scanner which handles image processing
The method field in extraction results indicates whether AI or regex was used. Regex results warrant manual review.
Duplicate detection shows unexpected results
By design, duplicates are matched by part number only (case-insensitive):
Different serial numbers with the same part number are flagged as duplicates
The same part from different certificates is flagged as a duplicate
This is intentional for inventory reconciliation
Use the Duplicates page to review groups and decide which entries to keep, delete, or export.
User cannot access system after sign-up
New accounts receive the Visitor role by default and are placed on a Pending Approval screen. To resolve:
An Admin must navigate to User Management
Locate the user in the table
Change their role from visitor to an operational role
Ensure the Active toggle is enabled
Users with the visitor role or is_active: false cannot access any protected routes. This is enforced by both frontend route guards and database RLS policies.
PDF compression flags an anomaly
Compression ratios below 0.2 (80%+ size reduction) are flagged as potentially suspicious:
May indicate the PDF contains very little actual content
May indicate excessive metadata or duplicate objects
The original PDF is always preserved alongside the compressed version
Flagged compression is informational only — the certificate is still saved and accessible. Review flagged certificates to ensure content integrity.
Batch upload shows errors for some files
Individual files in a batch can fail independently:
Invalid PDF: Corrupted or non-PDF files are rejected
Extraction failure: AI and regex both failed to extract meaningful data
Duplicate detected: A certificate with the same part number already exists (skipped, not error)
Check Batch History for detailed per-file status, error messages, and confidence scores.
Camera scanner not working
Browser permissions required:
Allow camera access when prompted
Ensure HTTPS connection (camera API requires secure context)
On iOS, use Safari — other browsers may not support the camera API
Camera scanning is not supported on desktop browsers without a webcam. Use the standard Upload page for desktop workflows.
Changelog
Version
Date
Highlights
2.6
March 2026
Enhanced Mintlify documentation, SEO optimisation, deployment fixes
2.5
March 2026
Kit sub-item extraction, parent-child visual indicators, AI markdown rendering
2.4
March 2026
Certificate cart, duplicate management page, bulk print and CSV export
2.3
March 2026
AI chat assistant with streaming, batch upload history page
2.2
March 2026
Dashboard redesign with Recharts, user management permissions matrix
2.1
March 2026
Camera scanning, batch upload, PDF compression with anomaly detection
2.0
March 2026
Multi-item certificate support, full-text search with tsvector + pg_trgm
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Starter Kit","colors":{"primary":"#0D9373","light":"#07C983","dark":"#0D9373"},"logo":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/br/logo/favicon.svg","dark":"https://mintlify.s3.us-west-1.amazonaws.com/br/logo/favicon.svg"},"favicon":"/favicon.svg","navbar":{"links":[{"href":"mailto:projects@briankimemia.is-a.dev","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://dashboard.mintlify.com"}},"footer":{"socials":{"x":"https://briankimemia.is-a.dev/","github":"https://github.com/BrianKN019","linkedin":"https://www.linkedin.com/in/n-brian-kimemia019b"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Documentation","icon":"book-open-cover","href":"https://mintlify.com/docs"},{"anchor":"Community","icon":"slack","href":"https://mintlify.com/community"},{"anchor":"Blog","icon":"newspaper","href":"https://mintlify.com/blog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"br","hasAudioNarration":false,"actualSubdomain":"br","customDomains":["docs.briankimemia.is-a.dev"],"gitSource":{"type":"github","owner":"briankn019","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ae923d53e9b7a540d51de9a:success","clientVersion":"0.0.4340","searchFilterCounts":[{"language":"default","tag":"Documentation","count":39},{"language":"default","tag":"Get Started","count":19},{"language":"default","tag":"WEB-DEVELOPMENT","count":14},{"language":"default","tag":"Essentials","count":6},{"language":"default","tag":"API Reference","count":4},{"language":"default","tag":"Endpoint Examples","count":3},{"language":"default","tag":"API Documentation","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"amocerts","slug":"/amocerts","pageMetadata":{"title":"AMO CertVault — Complete Documentation","sidebarTitle":"AMO CertVault","description":"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.","icon":"shield-check","href":"/amocerts","hidden":false},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,br:`br`,code:`code`,em:`em`,hr:`hr`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,Card,CardGroup,CodeBlock,Heading,Info,Mermaid,Note,Step,Steps,Tab,Table,Tabs,Tip,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`AMO CertVault`}),` is a production-grade certificate management system designed for aviation AMOs. It uses AI to extract, validate, and organise aircraft spares certificates — EASA Form 1, FAA 8130-3, COC, CRS, and more.`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`introduction`,children:`Introduction`}),`\n`,_jsx(_components.p,{children:`AMO CertVault digitises the certificate management workflow for Aircraft Approved Maintenance Organisations. Upload a PDF certificate, and the AI engine automatically extracts part numbers, serial numbers, suppliers, dates, and certificate types — even from multi-item documents with dozens of line items, including kit/overhaul sub-components.`}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Why CertVault?`}),` Aviation AMOs handle hundreds of certificates monthly. Manual data entry is slow, error-prone, and non-auditable. CertVault automates extraction with `,_jsx(_components.strong,{children:`92%+ accuracy`}),` using Gemini AI, with a regex fallback ensuring zero data loss.`]})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Built for:`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Quality Managers`}),` reviewing incoming spares documentation`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Store Personnel`}),` receiving and cataloguing parts`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Auditors`}),` verifying compliance trails`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Administrators`}),` managing user access and system configuration`]}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`quick-start`,children:`Quick Start`}),`\n`,_jsxs(Steps,{children:[_jsxs(Step,{title:`Create Your Account`,children:[_jsxs(_components.p,{children:[`Navigate to `,_jsx(_components.code,{children:`/auth`}),` and create an account with your email and password. You will receive a `,_jsx(_components.strong,{children:`Visitor`}),` role by default.`]}),_jsx(Tip,{children:`Use your company email — administrators can identify and approve your account faster.`})]}),_jsxs(Step,{title:`Await Admin Approval`,children:[_jsxs(_components.p,{children:[`An administrator will review your account and assign an appropriate role (Quality Manager, Store Personnel, or Auditor). You will be redirected to a `,_jsx(_components.strong,{children:`Pending Approval`}),` screen until activated.`]}),_jsx(Warning,{children:`Do not create multiple accounts — duplicate sign-ups will be flagged and may delay approval.`})]}),_jsxs(Step,{title:`Upload Your First Certificate`,children:[_jsxs(_components.p,{children:[`Go to `,_jsx(_components.strong,{children:`Upload Certificate`}),` from the sidebar. Drag and drop a PDF or use the `,_jsx(_components.strong,{children:`Camera Scanner`}),` to capture a physical certificate directly from your device.`]}),_jsx(Info,{children:`Supported formats: PDF (text-based or scanned). Maximum file size: 10MB per document.`})]}),_jsxs(Step,{title:`Review AI Extraction`,children:[_jsx(_components.p,{children:`The system will automatically extract certificate data using Gemini AI. Review the extracted fields — part number, serial number, description, supplier, certificate type, and date. Edit any inaccuracies and save.`}),_jsxs(Tip,{children:[`The `,_jsx(_components.strong,{children:`confidence score`}),` (0–100%) indicates extraction reliability. Scores below 70% warrant manual verification.`]})]}),_jsx(Step,{title:`Search and Manage`,children:_jsxs(_components.p,{children:[`Use the `,_jsx(_components.strong,{children:`Certificates`}),` page to search by part number, description, serial number, or supplier. Full-text search is powered by PostgreSQL `,_jsx(_components.code,{children:`tsvector`}),` with trigram fuzzy matching.`]})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`features`,children:`Features`}),`\n`,_jsxs(CardGroup,{cols:3,children:[_jsx(Card,{title:`AI-Powered Extraction`,icon:`robot`,children:_jsx(_components.p,{children:`Gemini 2.5 Flash extracts structured data from PDFs using tool-calling. Supports EASA Form 1, FAA 8130-3, COC, CRS, and 37+ certificate type mappings. Regex fallback ensures zero data loss.`})}),_jsx(Card,{title:`Multi-Item Certificates`,icon:`layer-group`,children:_jsx(_components.p,{children:`Certificates with multiple line items are parsed into individual records — each with its own part number, serial number, quantity, and condition. Supports 100+ items per certificate.`})}),_jsx(Card,{title:`Kit Sub-Item Extraction`,icon:`box-open`,children:_jsxs(_components.p,{children:[`Overhaul kits, gasket sets, and assembly items with sub-components are automatically detected. Sub-items use decimal line numbering (`,_jsx(_components.code,{children:`14.1`}),`, `,_jsx(_components.code,{children:`14.2`}),`) to preserve parent-child relationships.`]})}),_jsx(Card,{title:`Role-Based Access (RBAC)`,icon:`user-shield`,children:_jsx(_components.p,{children:`Five-tier RBAC: Admin, Quality Manager, Store Personnel, Auditor, and Visitor. Row-Level Security (RLS) enforced at the database level — no client-side bypasses possible.`})}),_jsx(Card,{title:`Camera Scanning`,icon:`camera`,children:_jsx(_components.p,{children:`Capture certificates directly from your device camera with real-time preview, crop overlay, and flash toggle. The image is uploaded and processed through the same AI extraction pipeline.`})}),_jsx(Card,{title:`Batch Upload`,icon:`upload`,children:_jsx(_components.p,{children:`Upload multiple PDFs simultaneously. Each file is processed independently with live progress tracking, error reporting, and searchable batch history.`})}),_jsx(Card,{title:`Certificate Cart and Bulk Print`,icon:`cart-shopping`,children:_jsx(_components.p,{children:`Add certificates to a cart from search results or the duplicates page. Bulk print PDFs or export selected certificates as CSV for external reporting and audits.`})}),_jsx(Card,{title:`Duplicate Detection`,icon:`clone`,children:_jsx(_components.p,{children:`Dedicated duplicate management page groups certificates by part number across the entire system. View, compare, delete, or add duplicates to cart with role-restricted actions.`})}),_jsx(Card,{title:`AI Chat Assistant`,icon:`message-bot`,children:_jsx(_components.p,{children:`Streaming AI chat assistant for aviation certificate questions. Renders responses with Markdown formatting — headers, tables, code blocks, bold/italic, and clickable links.`})}),_jsx(Card,{title:`PDF Compression`,icon:`file-zipper`,children:_jsx(_components.p,{children:`Structural PDF compression using pdf-lib’s object stream optimisation. Anomaly detection automatically flags suspiciously high compression ratios (below 0.2).`})}),_jsx(Card,{title:`Complete Audit Trail`,icon:`clipboard-list`,children:_jsx(_components.p,{children:`Every create, update, and delete action is logged with user ID, certificate ID, timestamp, and action details in JSON format. Fully queryable and exportable.`})}),_jsx(Card,{title:`Full-Text Search`,icon:`magnifying-glass`,children:_jsxs(_components.p,{children:[`PostgreSQL `,_jsx(_components.code,{children:`tsvector`}),`-based search across certificates and items. Trigram similarity matching handles typos and partial matches. Debounced input for responsive UX.`]})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`system-architecture`,children:`System Architecture`}),`\n`,_jsx(Info,{children:_jsx(_components.p,{children:`The application is a React SPA backed by Lovable Cloud, providing authentication, PostgreSQL database, file storage, and serverless edge functions — no separate backend to manage.`})}),`\n`,_jsx(Mermaid,{chart:`graph TB\n subgraph Client[\"Frontend — React / Vite / PWA\"]\n UI[\"React SPA\\\\nTailwind + shadcn/ui\"]\n RQ[\"TanStack Query\\\\nCache \u0026 Mutations\"]\n Auth[\"Auth Context\\\\nSession Management\"]\n Cart[\"Certificate Cart\\\\nReact Context\"]\n Router[\"React Router v6\\\\nProtected Routes\"]\n end\n\n subgraph Cloud[\"Lovable Cloud\"]\n SBAuth[\"Authentication\\\\nEmail + Password\"]\n DB[(\"PostgreSQL\\\\nRLS Policies\")]\n Storage[\"File Storage\\\\nPDF Originals\"]\n EF1[\"extract-certificate\\\\nAI + Regex Fallback\"]\n EF2[\"compress-certificate\\\\npdf-lib Optimisation\"]\n EF3[\"cert-ai-chat\\\\nStreaming SSE\"]\n end\n\n subgraph AI[\"AI Gateway\"]\n Gemini[\"Gemini 2.5 Flash\\\\nTool Calling\"]\n end\n\n UI --> RQ\n RQ --> SBAuth\n RQ --> DB\n UI --> Storage\n UI --> EF1\n EF1 --> Gemini\n UI --> EF2\n EF2 --> Storage\n UI --> EF3\n EF3 --> Gemini\n Cart --> DB\n Router --> Auth\n Auth --> SBAuth`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`certificate-processing`,children:`Certificate Processing`}),`\n`,_jsx(Heading,{level:`3`,id:`extraction-pipeline`,children:`Extraction Pipeline`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`The extraction pipeline is `,_jsx(_components.strong,{children:`fully automated`}),` — upload a PDF and the system handles file storage, AI extraction, type normalisation, duplicate checking, and database persistence without manual intervention.`]})}),`\n`,_jsx(Mermaid,{chart:`sequenceDiagram\n participant U as User\n participant FE as Frontend\n participant ST as Storage\n participant EF as extract-certificate\n participant AI as Gemini AI\n participant DB as Database\n\n U->>FE: Upload PDF\n FE->>ST: Store original file\n FE->>EF: Invoke extraction (filePath)\n EF->>ST: Download PDF bytes\n EF->>AI: Send PDF + tool schema\n\n alt AI Extraction Succeeds\n AI-->>EF: Structured certificate JSON\n EF->>EF: Normalize types (37 mappings)\n EF->>EF: Normalize dates to ISO 8601\n EF->>EF: Sort and re-sequence kit sub-items\n EF->>EF: Compute per-item confidence\n else AI Fails or Rate Limited\n EF->>EF: Regex fallback extraction\n EF->>EF: Parse BT/ET text blocks\n EF->>EF: Match 36 aviation patterns\n EF->>EF: Tiered confidence scoring\n end\n\n EF->>DB: Check for duplicates (part_number)\n EF-->>FE: Return extraction result + duplicates\n FE->>FE: User reviews and edits\n FE->>DB: Save certificate + items\n FE->>DB: Log audit entry`}),`\n`,_jsx(Heading,{level:`3`,id:`extraction-algorithm`,children:`Extraction Algorithm`}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`AI Path (Primary)`,id:`ai-path-primary`,children:[_jsxs(_components.p,{children:[`The primary extraction path uses `,_jsx(_components.strong,{children:`Gemini 2.5 Flash`}),` with structured tool-calling:`]}),_jsx(CodeBlock,{numberOfLines:`11`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`1. Download PDF from storage → base64 encode`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`2. Call Gemini 2.5 Flash with extraction tool schema`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`3. Parse tool_calls response → structured JSON`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`4. Normalize certificate_type against 37 pattern mappings`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`5. Normalize all dates to ISO 8601 format`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`6. Detect kit/overhaul items by keyword matching`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`7. Sort kit sub-items by decimal line_number (14.1, 14.2...)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`8. Re-sequence to integer line numbers for storage`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`9. Validate part numbers with aviation regex patterns`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`10. Compute per-item confidence score (0.0 – 1.0)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsx(Tip,{children:`The AI prompt explicitly instructs Gemini to extract unnumbered rows beneath kit/overhaul/set items as sub-components with decimal line numbers.`})]}),_jsxs(Tab,{title:`Regex Fallback`,id:`regex-fallback`,children:[_jsx(_components.p,{children:`When AI extraction fails (rate limits, malformed PDFs), the system falls back to pattern-based extraction:`}),_jsx(CodeBlock,{numberOfLines:`12`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`1. Parse BT/ET (Begin Text / End Text) blocks from raw PDF bytes`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`2. Detect aviation keywords against 36 known patterns`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`3. Require >= 2 keyword matches to classify as certificate`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`4. Extract fields via tiered regex patterns:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Part Number: 8 patterns (P/N, PN, Part No., etc.)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Serial Number: 6 patterns (S/N, SN, Serial, etc.)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Supplier: 7 patterns (MFR, Manufacturer, etc.)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Description: 5 patterns (DESC, Item, etc.)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Date: 6 patterns with ISO normalisation`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`5. Multi-item detection via repeating pattern groups`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`6. Tiered confidence: High (>=0.8), Medium (0.5–0.79), Low (\u003c0.5)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsxs(Warning,{children:[`Regex extraction typically achieves `,_jsx(_components.strong,{children:`60–75% accuracy`}),` compared to AI’s 92%+. Always review regex-extracted certificates manually.`]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`kit-sub-item-extraction`,children:`Kit Sub-Item Extraction`}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`Kit certificates (overhaul kits, gasket sets, hardware assemblies) contain a `,_jsx(_components.strong,{children:`parent item`}),` with multiple `,_jsx(_components.strong,{children:`sub-components`}),` listed beneath it. CertVault automatically detects and preserves these relationships.`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Detection Keywords:`}),` `,_jsx(_components.code,{children:`kit`}),`, `,_jsx(_components.code,{children:`set`}),`, `,_jsx(_components.code,{children:`overhaul`}),`, `,_jsx(_components.code,{children:`assembly`}),`, `,_jsx(_components.code,{children:`hardware kit`}),`, `,_jsx(_components.code,{children:`gasket set`})]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Example Extraction:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Line`}),_jsx(_components.th,{children:`Part Number`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Type`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`14`}),_jsx(_components.td,{children:`SL12034-SC`}),_jsx(_components.td,{children:`GASKET SET SINGLE CYLINDER`}),_jsx(_components.td,{children:`Kit Parent`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`15`}),_jsx(_components.td,{children:`SL66732`}),_jsx(_components.td,{children:`GASKET`}),_jsx(_components.td,{children:`Sub-component`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`16`}),_jsx(_components.td,{children:`SL67193`}),_jsx(_components.td,{children:`GASKET`}),_jsx(_components.td,{children:`Sub-component`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`17`}),_jsx(_components.td,{children:`SL71481`}),_jsx(_components.td,{children:`RING, OIL SEAL`}),_jsx(_components.td,{children:`Sub-component`})]})]})]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Visual Display:`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Kit parent rows — teal gradient background with `,_jsx(_components.code,{children:`KIT`}),` badge pill`]}),`\n`,_jsx(_components.li,{children:`Sub-component rows — indented with teal connector line and junction dot`}),`\n`,_jsx(_components.li,{children:`Hover highlights the entire kit group`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`certificate-type-mapping`,children:`Certificate Type Mapping`}),`\n`,_jsxs(Accordion,{title:`Supported Certificate Types (37+ input patterns)`,id:`supported-certificate-types-37-input-patterns`,children:[_jsx(_components.p,{children:`The system normalises dozens of input variations to standardised types:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Input Pattern(s)`}),_jsx(_components.th,{children:`Normalised Type`}),_jsx(_components.th,{children:`Common Sources`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`EASA Form 1, JAA Form 1, TCCA Form One`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`easa-form-1`})}),_jsx(_components.td,{children:`European / Canadian MROs`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`FAA 8130-3, FAA Form 8130-3, Airworthiness Approval`}),_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`8130-3`})}),_jsx(_components.td,{children:`FAA-certified facilities`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Certificate of Conformity, COC, C of C`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`coc`})}),_jsx(_components.td,{children:`Manufacturers and distributors`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Certificate of Release to Service, CRS`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`crs`})}),_jsx(_components.td,{children:`Maintenance organisations`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Test Report, Inspection Report`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`test-report`})}),_jsx(_components.td,{children:`Testing laboratories`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Shipping Document, Packing Slip`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`shipping`})}),_jsx(_components.td,{children:`Logistics and supply chain`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`CAAC Form, ANAC Form, DGCA, Serviceable Tag`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`other`})}),_jsx(_components.td,{children:`Other national authorities`})]})]})]}),_jsxs(Tip,{children:[`If a certificate type is not recognised, it defaults to `,_jsx(_components.code,{children:`other`}),`. You can manually update the type in the certificate detail view.`]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`cart-and-bulk-operations`,children:`Cart and Bulk Operations`}),`\n`,_jsxs(Steps,{children:[_jsxs(Step,{title:`Add to Cart`,children:[_jsxs(_components.p,{children:[`From the `,_jsx(_components.strong,{children:`Certificates`}),` page or `,_jsx(_components.strong,{children:`Duplicates`}),` page, click the cart icon on any certificate item. The cart state persists via React Context across navigation.`]}),_jsx(Tip,{children:`You can add items from multiple certificates — the cart is not limited to a single document.`})]}),_jsx(Step,{title:`Review Cart`,children:_jsxs(_components.p,{children:[`Navigate to the `,_jsx(_components.strong,{children:`Cart`}),` page to see all selected items with part numbers, descriptions, and source certificate references. Remove unwanted items individually or clear the entire cart.`]})}),_jsx(Step,{title:`Bulk Print PDFs`,children:_jsxs(_components.p,{children:[`Click `,_jsx(_components.strong,{children:`Print All`}),` to open all selected certificate PDFs in new tabs for printing. Each PDF links to the original uploaded document in storage.`]})}),_jsxs(Step,{title:`Export to CSV`,children:[_jsxs(_components.p,{children:[`Click `,_jsx(_components.strong,{children:`Export CSV`}),` to download a spreadsheet containing part number, description, serial number, quantity, condition, and source certificate for each selected item.`]}),_jsx(Info,{children:`The CSV export is compatible with Excel, Google Sheets, and most ERP/inventory systems.`})]})]}),`\n`,_jsx(Mermaid,{chart:`flowchart LR\n A[\"Search Certificates\"] --> B[\"Add to Cart\"]\n C[\"Duplicates Page\"] --> B\n B --> D[\"Review Cart\"]\n D --> E{\"Action?\"}\n E -->|Print| F[\"Bulk Print PDFs\"]\n E -->|Export| G[\"Export CSV\"]\n E -->|Remove| H[\"Remove Items\"]\n E -->|Clear| I[\"Clear Cart\"]`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`duplicate-management`,children:`Duplicate Management`}),`\n`,_jsx(_components.p,{children:`The Duplicates page identifies certificates that share the same part number across different uploads, enabling quick review and cleanup.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Destructive Action:`}),` Deleting a duplicate removes the certificate item permanently from the database. This action is restricted to `,_jsx(_components.strong,{children:`Admin`}),` and `,_jsx(_components.strong,{children:`Quality Manager`}),` roles and is logged in the audit trail with full details.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`detection-algorithm`,children:`Detection Algorithm`}),`\n`,_jsx(CodeBlock,{numberOfLines:`14`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`FUNCTION detectDuplicates():`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` groups \u003c- GROUP certificate_items BY LOWER(part_number)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` duplicates \u003c- FILTER groups WHERE COUNT > 1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` FOR EACH group IN duplicates:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` SORT items BY upload_date DESC`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` DISPLAY with certificate metadata:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Part number, description, serial number`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Source certificate ID and type`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Upload date and uploader`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` - Available actions (View, Cart, Delete)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` RETURN duplicates WITH search filtering`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Duplicates are matched by `,_jsx(_components.strong,{children:`part number only`}),` (case-insensitive). Different serial numbers with the same part number are flagged as duplicates — the same part from different batches should be reviewable together.`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`ai-chat-assistant`,children:`AI Chat Assistant`}),`\n`,_jsxs(_components.p,{children:[`The AI Assistant provides `,_jsx(_components.strong,{children:`streaming`}),` responses about aviation certificates and compliance, rendered with full Markdown formatting.`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`The chat uses the `,_jsx(_components.code,{children:`cert-ai-chat`}),` edge function connecting to `,_jsx(_components.strong,{children:`Gemini AI`}),` via the Lovable AI Gateway. No API key configuration is required — it works out of the box.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`capabilities`,children:`Capabilities`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Certificate Knowledge`,icon:`file-certificate`,children:_jsx(_components.p,{children:`FAA Form 8130-3 field explanations, EASA Form 1 block descriptions, certificate status types, traceability requirements.`})}),_jsx(Card,{title:`Compliance Guidance`,icon:`gavel`,children:_jsx(_components.p,{children:`Regulatory requirements for parts documentation, release-to-service criteria, certificate validity periods.`})}),_jsx(Card,{title:`System Help`,icon:`circle-question`,children:_jsx(_components.p,{children:`OCR extraction process explanation, batch upload guidance, search tips, role-based access questions.`})}),_jsx(Card,{title:`General Aviation`,icon:`plane`,children:_jsx(_components.p,{children:`Part number formats, supplier identification, condition codes (NE, OH, SV, AR), quantity and unit conventions.`})})]}),`\n`,_jsx(Heading,{level:`3`,id:`response-formatting`,children:`Response Formatting`}),`\n`,_jsx(_components.p,{children:`The AI assistant renders responses with rich Markdown:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Headers (`,_jsx(_components.code,{children:`##`}),`, `,_jsx(_components.code,{children:`###`}),`) with teal accent styling`]}),`\n`,_jsx(_components.li,{children:`Bold and italic text for emphasis`}),`\n`,_jsx(_components.li,{children:`Inline code and fenced code blocks with monospace font`}),`\n`,_jsx(_components.li,{children:`Tables with borders and header highlighting`}),`\n`,_jsx(_components.li,{children:`Ordered and unordered lists with proper nesting`}),`\n`,_jsx(_components.li,{children:`Clickable links to external references`}),`\n`]}),`\n`,_jsxs(Tip,{children:[`Try these starter prompts: `,_jsx(_components.em,{children:`“What fields are on FAA Form 8130-3?”`}),`, `,_jsx(_components.em,{children:`“Explain certificate status types”`}),`, `,_jsx(_components.em,{children:`“How does OCR extraction work?”`})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`user-roles-and-permissions`,children:`User Roles and Permissions`}),`\n`,_jsx(Heading,{level:`3`,id:`permission-matrix`,children:`Permission Matrix`}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Permissions Grid`,id:`permissions-grid`,children:[_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Permission`}),_jsx(_components.th,{style:{textAlign:`center`},children:`Admin`}),_jsx(_components.th,{style:{textAlign:`center`},children:`Quality Manager`}),_jsx(_components.th,{style:{textAlign:`center`},children:`Store Personnel`}),_jsx(_components.th,{style:{textAlign:`center`},children:`Auditor`}),_jsx(_components.th,{style:{textAlign:`center`},children:`Visitor`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`View certificates`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Upload certificates`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Edit certificates`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Delete certificates`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Batch upload`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Camera scanning`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`View audit logs`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Manage users`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Certificate cart`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Duplicate management`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`AI Assistant`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`System settings`}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`})]})]})]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Principle of Least Privilege:`}),` Each role has only the minimum permissions required. The admin dashboard includes an interactive permissions matrix for visual reference. Actual enforcement is at the database level via RLS policies.`]})})]}),_jsx(Tab,{title:`Role Lifecycle`,id:`role-lifecycle`,children:_jsx(Mermaid,{chart:`graph TD\n A[\"User Signs Up\"] --> B[\"Visitor Role Assigned\"]\n B --> C{\"Admin Reviews Account\"}\n C -->|Approve| D[\"Assign Operational Role\"]\n C -->|Reject| E[\"Account Deactivated\"]\n D --> F[\"Quality Manager\"]\n D --> G[\"Store Personnel\"]\n D --> H[\"Auditor\"]\n F --> I[\"Full Upload + Edit + Delete\"]\n G --> J[\"Upload + View Only\"]\n H --> K[\"View + Audit Logs Only\"]\n E --> L[\"Cannot Access System\"]`})}),_jsxs(Tab,{title:`Security Model`,id:`security-model`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Row-Level Security (RLS)`}),` is enforced on every table:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Only active, non-visitor users can view certificates`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` POLICY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authenticated users can view certificates\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ON`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`certificates`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FOR`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` authenticated`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`USING`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`has_role`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`uid`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'admin'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`OR`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`has_role`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`uid`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'quality_manager'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`OR`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`has_role`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`uid`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'store_personnel'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`OR`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`has_role`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`auth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`uid`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'auditor'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`]})})}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`has_role()`}),` function is defined as `,_jsx(_components.code,{children:`SECURITY DEFINER`}),` to prevent recursive RLS evaluation. Never store roles on the `,_jsx(_components.code,{children:`profiles`}),` table — they are isolated in `,_jsx(_components.code,{children:`user_roles`}),` to prevent privilege escalation.`]})})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`user-management-dashboard-admin`,children:`User Management Dashboard (Admin)`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Stats Overview`,icon:`chart-bar`,children:_jsx(_components.p,{children:`Summary cards showing total users, active accounts, pending visitors, and role distribution with animated counters.`})}),_jsx(Card,{title:`Interactive Permissions Matrix`,icon:`table-cells`,children:_jsx(_components.p,{children:`Visual reference grid with toggle checkboxes showing what each role can do. Labeled as reference-only — actual enforcement is via RLS.`})}),_jsx(Card,{title:`User Table`,icon:`users`,children:_jsx(_components.p,{children:`Avatar initials, coloured role badges, activation toggle switches, time-ago join dates, and role assignment dropdowns.`})}),_jsx(Card,{title:`Role Summary Cards`,icon:`id-card`,children:_jsx(_components.p,{children:`Per-role cards with custom icons, colour coding, and permission count — quick overview of the access hierarchy.`})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`data-model`,children:`Data Model`}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`All tables use UUID primary keys, automatic timestamps, and Row-Level Security. The `,_jsx(_components.code,{children:`search_vector`}),` columns enable PostgreSQL full-text search with automatic updates via triggers.`]})}),`\n`,_jsx(Mermaid,{chart:`erDiagram\n certificates ||--o{ certificate_items : \"has many\"\n certificates ||--o{ audit_logs : \"tracked by\"\n certificates }o--|| profiles : \"uploaded by\"\n batch_uploads ||--o{ batch_upload_items : \"contains\"\n profiles ||--|| user_roles : \"has role\"\n\n certificates {\n uuid id PK\n uuid uploaded_by FK\n string part_number\n string description\n string serial_number\n string file_url\n string certificate_type\n string status\n int item_count\n float ocr_confidence\n string compressed_file_url\n float compression_ratio\n tsvector search_vector\n timestamp upload_date\n timestamp updated_at\n }\n\n certificate_items {\n uuid id PK\n uuid certificate_id FK\n int line_number\n string part_number\n string description\n string serial_number\n string quantity\n string condition\n float confidence\n tsvector search_vector\n }\n\n profiles {\n uuid id PK\n uuid user_id\n string email\n string full_name\n boolean is_active\n timestamp created_at\n }\n\n user_roles {\n uuid id PK\n uuid user_id\n string role\n }\n\n audit_logs {\n uuid id PK\n uuid user_id\n uuid certificate_id FK\n string action\n json details\n timestamp created_at\n }\n\n batch_uploads {\n uuid id PK\n uuid user_id\n int total_files\n int saved_count\n int error_count\n int skipped_count\n int rejected_count\n string status\n timestamp started_at\n timestamp completed_at\n }\n\n batch_upload_items {\n uuid id PK\n uuid batch_id FK\n uuid certificate_id FK\n string file_name\n int file_size\n string status\n string part_number\n float confidence\n string error_message\n }`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`api-reference`,children:`API Reference`}),`\n`,_jsx(Heading,{level:`3`,id:`edge-functions`,children:`Edge Functions`}),`\n`,_jsxs(Accordion,{title:`extract-certificate — AI Certificate Extraction`,id:`extract-certificate-ai-certificate-extraction`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Method:`}),` `,_jsx(_components.code,{children:`POST`}),_jsx(_components.br,{}),`\n`,_jsx(_components.strong,{children:`Authentication:`}),` Bearer token (anon key)`]}),_jsx(_components.p,{children:`Extracts structured data from a PDF certificate using Gemini AI with regex fallback.`}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Request Body`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"filePath\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"userId/timestamp_filename.pdf\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Success Response (200)`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`24`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`24`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"certificate\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"part_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7A-2841-MFG\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Turbine Blade Assembly\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"serial_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SN-2024-8847\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"certificate_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"easa-form-1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"certificate_date\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2024-03-15\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"supplier\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Rolls-Royce Aerospace\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"items\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"line_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"part_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"7A-2841-MFG\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Turbine Blade Assembly\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"serial_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SN-2024-8847\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"quantity\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1 EA\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"condition\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"NE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"confidence\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"confidence\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.92`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"duplicates\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"method\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ai\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Error Response (500)`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Extraction failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"PDF could not be parsed\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(Tip,{children:[`The `,_jsx(_components.code,{children:`method`}),` field indicates whether `,_jsx(_components.code,{children:`\"ai\"`}),` or `,_jsx(_components.code,{children:`\"regex\"`}),` was used. Regex extractions typically have lower confidence scores.`]})]}),`\n`,_jsxs(Accordion,{title:`compress-certificate — PDF Compression`,id:`compress-certificate-pdf-compression`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Method:`}),` `,_jsx(_components.code,{children:`POST`}),_jsx(_components.br,{}),`\n`,_jsx(_components.strong,{children:`Authentication:`}),` Bearer token (anon key)`]}),_jsx(_components.p,{children:`Compresses a PDF certificate using structural optimisation with pdf-lib.`}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Request Body`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"filePath\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"userId/timestamp_filename.pdf\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Success Response (200)`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"compressed_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"userId/compressed_filename.pdf\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"original_size\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`524288`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"compressed_size\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`312500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"ratio\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.596`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"flagged\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(Warning,{children:[`A `,_jsx(_components.code,{children:`flagged: true`}),` response indicates the compression ratio is suspiciously high (below 0.2), meaning 80%+ size reduction. The original is always preserved.`]})]}),`\n`,_jsxs(Accordion,{title:`cert-ai-chat — Streaming AI Chat`,id:`cert-ai-chat-streaming-ai-chat`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Method:`}),` `,_jsx(_components.code,{children:`POST`}),_jsx(_components.br,{}),`\n`,_jsx(_components.strong,{children:`Authentication:`}),` Bearer token (anon key)`]}),_jsx(_components.p,{children:`Streaming AI chat for aviation certificate questions using Server-Sent Events (SSE).`}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Request Body`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What fields are on FAA Form 8130-3?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Response (SSE Stream)`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"choices\":[{\"delta\":{\"content\":\"FAA Form 8130-3 contains...\"}}]}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"choices\":[{\"delta\":{\"content\":\" the following blocks:\\\\n\\\\n\"}}]}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: [DONE]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsxs(Info,{children:[`The response follows the OpenAI-compatible delta streaming format. The frontend uses `,_jsx(_components.code,{children:`ReadableStream`}),` with chunk-by-chunk parsing for real-time display.`]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`application-routes`,children:`Application Routes`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Route`}),_jsx(_components.th,{children:`Page`}),_jsx(_components.th,{children:`Access Level`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`/`})}),_jsx(_components.td,{children:`Landing / Dashboard`}),_jsx(_components.td,{children:`Public / Authenticated`}),_jsx(_components.td,{children:`Marketing page (unauthenticated) or interactive dashboard (authenticated)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/auth`})}),_jsx(_components.td,{children:`Login and Sign Up`}),_jsx(_components.td,{children:`Public`}),_jsx(_components.td,{children:`Email/password authentication with form validation`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/pending`})}),_jsx(_components.td,{children:`Pending Approval`}),_jsx(_components.td,{children:`Visitor`}),_jsx(_components.td,{children:`Displayed after sign-up while awaiting admin activation`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/certificates`})}),_jsx(_components.td,{children:`Certificate List`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Searchable, paginated list with status filters`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/certificates/:id`})}),_jsx(_components.td,{children:`Certificate Detail`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Full certificate view with items table and kit indicators`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/upload`})}),_jsx(_components.td,{children:`Upload Certificate`}),_jsx(_components.td,{children:`Upload roles`}),_jsx(_components.td,{children:`Single PDF upload with AI extraction preview`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/batch-upload`})}),_jsx(_components.td,{children:`Batch Upload`}),_jsx(_components.td,{children:`Upload roles`}),_jsx(_components.td,{children:`Multi-file upload with progress tracking`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/batch-history`})}),_jsx(_components.td,{children:`Batch History`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Historical batch upload records and item details`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/scan`})}),_jsx(_components.td,{children:`Camera Scanner`}),_jsx(_components.td,{children:`Upload roles`}),_jsx(_components.td,{children:`Device camera capture with crop overlay`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/cart`})}),_jsx(_components.td,{children:`Certificate Cart`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Selected items for bulk print / CSV export`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/duplicates`})}),_jsx(_components.td,{children:`Duplicate Management`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Part-number-grouped duplicate review and cleanup`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/ai-assistant`})}),_jsx(_components.td,{children:`AI Chat`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Streaming AI assistant for certificate questions`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/audit-logs`})}),_jsx(_components.td,{children:`Audit Logs`}),_jsx(_components.td,{children:`Admin / QM / Auditor`}),_jsx(_components.td,{children:`Paginated audit trail with action filtering`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/settings`})}),_jsx(_components.td,{children:`User Settings`}),_jsx(_components.td,{children:`Authenticated`}),_jsx(_components.td,{children:`Profile and preference management`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/admin/users`})}),_jsx(_components.td,{children:`User Management`}),_jsx(_components.td,{children:`Admin only`}),_jsx(_components.td,{children:`User activation, role assignment, permissions matrix`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`/privacy-policy`})}),_jsx(_components.td,{children:`Privacy Policy`}),_jsx(_components.td,{children:`Public`}),_jsx(_components.td,{children:`Data handling and privacy information`})]})]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`tech-stack`,children:`Tech Stack`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Frontend`,icon:`browser`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`React 18`}),` + `,_jsx(_components.strong,{children:`TypeScript`}),` + `,_jsx(_components.strong,{children:`Vite`}),` for fast builds. `,_jsx(_components.strong,{children:`Tailwind CSS`}),` + `,_jsx(_components.strong,{children:`shadcn/ui`}),` component library. `,_jsx(_components.strong,{children:`Framer Motion`}),` for animations.`]})}),_jsx(Card,{title:`State Management`,icon:`database`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`TanStack Query`}),` for server state with intelligent caching. `,_jsx(_components.strong,{children:`React Context`}),` for client-side state (auth, cart).`]})}),_jsx(Card,{title:`Backend`,icon:`cloud`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Lovable Cloud`}),` — PostgreSQL, Authentication, File Storage, and Edge Functions. Zero-config serverless deployment.`]})}),_jsx(Card,{title:`AI and Processing`,icon:`microchip`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Gemini 2.5 Flash`}),` via Lovable AI Gateway. `,_jsx(_components.strong,{children:`pdf-lib`}),` for compression. `,_jsx(_components.strong,{children:`react-markdown`}),` + `,_jsx(_components.strong,{children:`remark-gfm`}),` for rendering.`]})})]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Layer`}),_jsx(_components.th,{children:`Technology`}),_jsx(_components.th,{children:`Purpose`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Framework`}),_jsx(_components.td,{children:`React 18, TypeScript`}),_jsx(_components.td,{children:`Component architecture, type safety`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Build`}),_jsx(_components.td,{children:`Vite 5`}),_jsx(_components.td,{children:`Fast HMR, optimised production builds`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Styling`}),_jsx(_components.td,{children:`Tailwind CSS 3, shadcn/ui`}),_jsx(_components.td,{children:`Utility-first CSS, accessible components`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Routing`}),_jsx(_components.td,{children:`React Router v6`}),_jsx(_components.td,{children:`Client-side routing with protected routes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Server State`}),_jsx(_components.td,{children:`TanStack Query v5`}),_jsx(_components.td,{children:`Data fetching, caching, mutations`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Backend`}),_jsx(_components.td,{children:`Lovable Cloud (PostgreSQL, Auth, Storage)`}),_jsx(_components.td,{children:`Full-stack serverless platform`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`AI`}),_jsx(_components.td,{children:`Gemini 2.5 Flash`}),_jsx(_components.td,{children:`Certificate extraction, chat assistant`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`PDF`}),_jsx(_components.td,{children:`pdf-lib`}),_jsx(_components.td,{children:`Structural compression, byte parsing`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Charts`}),_jsx(_components.td,{children:`Recharts`}),_jsx(_components.td,{children:`Dashboard visualisations`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Markdown`}),_jsx(_components.td,{children:`react-markdown + remark-gfm`}),_jsx(_components.td,{children:`AI chat response formatting`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`PWA`}),_jsx(_components.td,{children:`vite-plugin-pwa`}),_jsx(_components.td,{children:`Offline support, installability`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Search`}),_jsx(_components.td,{children:`PostgreSQL tsvector + pg_trgm`}),_jsx(_components.td,{children:`Full-text and fuzzy search`})]})]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`progressive-web-app-pwa`,children:`Progressive Web App (PWA)`}),`\n`,_jsxs(_components.p,{children:[`AMO CertVault is a `,_jsx(_components.strong,{children:`Progressive Web App`}),` — installable on mobile and desktop with offline caching and a native-like experience.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Configuration:`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Install Prompt:`}),` Automatic on supported browsers (Chrome, Edge, Safari)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Icons:`}),` 192×192 and 512×512 PNG (including maskable)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Apple Touch Icon:`}),` Configured for iOS home screen`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Theme Colour:`}),` Teal (`,_jsx(_components.code,{children:`#1a9e8f`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Display:`}),` Standalone (no browser chrome)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Orientation:`}),` Portrait-primary`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Service Worker:`}),` Auto-update strategy via Workbox`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Viewport:`}),` `,_jsx(_components.code,{children:`width=device-width, initial-scale=1.0, viewport-fit=cover`})]}),`\n`]}),`\n`,_jsxs(Tip,{children:[`On iOS, open the app in Safari, tap the `,_jsx(_components.strong,{children:`Share`}),` button, and select `,_jsx(_components.strong,{children:`Add to Home Screen`}),` to install CertVault as a native-like app.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`seo-and-performance`,children:`SEO and Performance`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Meta and Structured Data`,icon:`code`,children:_jsx(_components.p,{children:`OpenGraph tags, Twitter Cards, JSON-LD (SoftwareApplication + Organization), canonical URLs, comprehensive meta descriptions.`})}),_jsx(Card,{title:`Image Optimisation`,icon:`image`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`loading=\"lazy\"`}),` on non-critical images, explicit `,_jsx(_components.code,{children:`width`}),`/`,_jsx(_components.code,{children:`height`}),` to prevent CLS, `,_jsx(_components.code,{children:`alt`}),` text on all images, `,_jsx(_components.code,{children:`role=\"img\"`}),` with `,_jsx(_components.code,{children:`aria-label`}),` on SVGs.`]})}),_jsx(Card,{title:`Font Performance`,icon:`font`,children:_jsxs(_components.p,{children:[`Google Fonts preconnect and preload for JetBrains Mono. `,_jsx(_components.code,{children:`font-display: swap`}),` to prevent FOIT.`]})}),_jsx(Card,{title:`Core Web Vitals`,icon:`gauge-high`,children:_jsx(_components.p,{children:`Minimised CLS via explicit dimensions, optimised LCP via font preloading, efficient FID via code splitting.`})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting`,children:`Troubleshooting`}),`\n`,_jsxs(Accordion,{title:`AI extraction returns no data or low confidence`,id:`ai-extraction-returns-no-data-or-low-confidence`,children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Possible causes:`})}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PDF is password-protected or image-only without embedded text`}),`\n`,_jsx(_components.li,{children:`Document is not a recognised aviation certificate type`}),`\n`,_jsx(_components.li,{children:`AI rate limits triggered fallback to regex extraction`}),`\n`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Solutions:`})}),_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Verify the PDF opens normally in a PDF reader`}),`\n`,_jsx(_components.li,{children:`Check that it contains at least 2 aviation keywords (P/N, S/N, EASA, FAA, etc.)`}),`\n`,_jsx(_components.li,{children:`Try re-uploading — temporary rate limits resolve automatically`}),`\n`,_jsxs(_components.li,{children:[`For image-only PDFs, use the `,_jsx(_components.strong,{children:`Camera Scanner`}),` which handles image processing`]}),`\n`]}),_jsxs(Tip,{children:[`The `,_jsx(_components.code,{children:`method`}),` field in extraction results indicates whether AI or regex was used. Regex results warrant manual review.`]})]}),`\n`,_jsxs(Accordion,{title:`Duplicate detection shows unexpected results`,id:`duplicate-detection-shows-unexpected-results`,children:[_jsxs(_components.p,{children:[`By design, duplicates are matched by `,_jsx(_components.strong,{children:`part number only`}),` (case-insensitive):`]}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Different serial numbers with the same part number are flagged as duplicates`}),`\n`,_jsx(_components.li,{children:`The same part from different certificates is flagged as a duplicate`}),`\n`,_jsx(_components.li,{children:`This is intentional for inventory reconciliation`}),`\n`]}),_jsx(Info,{children:`Use the Duplicates page to review groups and decide which entries to keep, delete, or export.`})]}),`\n`,_jsxs(Accordion,{title:`User cannot access system after sign-up`,id:`user-cannot-access-system-after-sign-up`,children:[_jsxs(_components.p,{children:[`New accounts receive the `,_jsx(_components.strong,{children:`Visitor`}),` role by default and are placed on a `,_jsx(_components.strong,{children:`Pending Approval`}),` screen. To resolve:`]}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`An `,_jsx(_components.strong,{children:`Admin`}),` must navigate to `,_jsx(_components.strong,{children:`User Management`})]}),`\n`,_jsx(_components.li,{children:`Locate the user in the table`}),`\n`,_jsxs(_components.li,{children:[`Change their role from `,_jsx(_components.code,{children:`visitor`}),` to an operational role`]}),`\n`,_jsxs(_components.li,{children:[`Ensure the `,_jsx(_components.strong,{children:`Active`}),` toggle is enabled`]}),`\n`]}),_jsxs(Warning,{children:[`Users with the `,_jsx(_components.code,{children:`visitor`}),` role or `,_jsx(_components.code,{children:`is_active: false`}),` cannot access any protected routes. This is enforced by both frontend route guards and database RLS policies.`]})]}),`\n`,_jsxs(Accordion,{title:`PDF compression flags an anomaly`,id:`pdf-compression-flags-an-anomaly`,children:[_jsxs(_components.p,{children:[`Compression ratios below `,_jsx(_components.strong,{children:`0.2`}),` (80%+ size reduction) are flagged as potentially suspicious:`]}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`May indicate the PDF contains very little actual content`}),`\n`,_jsx(_components.li,{children:`May indicate excessive metadata or duplicate objects`}),`\n`,_jsxs(_components.li,{children:[`The `,_jsx(_components.strong,{children:`original PDF is always preserved`}),` alongside the compressed version`]}),`\n`]}),_jsx(Tip,{children:`Flagged compression is informational only — the certificate is still saved and accessible. Review flagged certificates to ensure content integrity.`})]}),`\n`,_jsxs(Accordion,{title:`Batch upload shows errors for some files`,id:`batch-upload-shows-errors-for-some-files`,children:[_jsx(_components.p,{children:`Individual files in a batch can fail independently:`}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Invalid PDF:`}),` Corrupted or non-PDF files are rejected`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Extraction failure:`}),` AI and regex both failed to extract meaningful data`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Duplicate detected:`}),` A certificate with the same part number already exists (skipped, not error)`]}),`\n`]}),_jsxs(_components.p,{children:[`Check `,_jsx(_components.strong,{children:`Batch History`}),` for detailed per-file status, error messages, and confidence scores.`]})]}),`\n`,_jsxs(Accordion,{title:`Camera scanner not working`,id:`camera-scanner-not-working`,children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Browser permissions required:`})}),_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Allow camera access when prompted`}),`\n`,_jsx(_components.li,{children:`Ensure HTTPS connection (camera API requires secure context)`}),`\n`,_jsxs(_components.li,{children:[`On iOS, use `,_jsx(_components.strong,{children:`Safari`}),` — other browsers may not support the camera API`]}),`\n`]}),_jsxs(Warning,{children:[`Camera scanning is not supported on desktop browsers without a webcam. Use the standard `,_jsx(_components.strong,{children:`Upload`}),` page for desktop workflows.`]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`changelog`,children:`Changelog`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Version`}),_jsx(_components.th,{children:`Date`}),_jsx(_components.th,{children:`Highlights`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.6`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`Enhanced Mintlify documentation, SEO optimisation, deployment fixes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.5`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`Kit sub-item extraction, parent-child visual indicators, AI markdown rendering`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.4`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`Certificate cart, duplicate management page, bulk print and CSV export`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.3`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`AI chat assistant with streaming, batch upload history page`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.2`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`Dashboard redesign with Recharts, user management permissions matrix`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.1`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`Camera scanning, batch upload, PDF compression with anomaly detection`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2.0`}),_jsx(_components.td,{children:`March 2026`}),_jsx(_components.td,{children:`Multi-item certificate support, full-text search with tsvector + pg_trgm`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1.0`}),_jsx(_components.td,{children:`February 2026`}),_jsx(_components.td,{children:`Initial release — single-item extraction, RBAC, audit logging`})]})]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`additional-resources`,children:`Additional Resources`}),`\n`,_jsxs(CardGroup,{cols:3,children:[_jsx(Card,{title:`EASA Part 21`,icon:`book`,href:`https://www.easa.europa.eu/en/document-library/easy-access-rules/easy-access-rules-21`,children:_jsx(_components.p,{children:`EASA Form 1 regulatory requirements and authorised release certificate specifications.`})}),_jsx(Card,{title:`FAA Order 8130.21`,icon:`book`,href:`https://www.faa.gov/regulations_policies/orders_notices/index.cfm/go/document.information/documentID/1040745`,children:_jsx(_components.p,{children:`FAA procedures for completion and use of FAA Form 8130-3, Airworthiness Approval Tag.`})}),_jsx(Card,{title:`Source Code`,icon:`github`,href:`https://github.com/BrianKN019/skydocs-compliance`,children:_jsx(_components.p,{children:`Open-source repository with full codebase, CI/CD configuration, and contribution guidelines.`})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsxs(_components.p,{children:[`Built by `,_jsx(_components.a,{href:`https://briankimemia.is-a.dev/`,children:`Brian KN`}),` ·`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"AMO CertVault — Complete Documentation","sidebarTitle":"AMO CertVault","description":"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.","icon":"shield-check","href":"/amocerts","hidden":false}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Introduction","slug":"introduction","depth":2,"children":[]},{"title":"Quick Start","slug":"quick-start","depth":2,"children":[]},{"title":"Features","slug":"features","depth":2,"children":[]},{"title":"System Architecture","slug":"system-architecture","depth":2,"children":[]},{"title":"Certificate Processing","slug":"certificate-processing","depth":2,"children":[{"title":"Extraction Pipeline","slug":"extraction-pipeline","depth":3,"children":[]},{"title":"Extraction Algorithm","slug":"extraction-algorithm","depth":3,"children":[]},{"title":"Kit Sub-Item Extraction","slug":"kit-sub-item-extraction","depth":3,"children":[]},{"title":"Certificate Type Mapping","slug":"certificate-type-mapping","depth":3,"children":[]}]},{"title":"Cart and Bulk Operations","slug":"cart-and-bulk-operations","depth":2,"children":[]},{"title":"Duplicate Management","slug":"duplicate-management","depth":2,"children":[{"title":"Detection Algorithm","slug":"detection-algorithm","depth":3,"children":[]}]},{"title":"AI Chat Assistant","slug":"ai-chat-assistant","depth":2,"children":[{"title":"Capabilities","slug":"capabilities","depth":3,"children":[]},{"title":"Response Formatting","slug":"response-formatting","depth":3,"children":[]}]},{"title":"User Roles and Permissions","slug":"user-roles-and-permissions","depth":2,"children":[{"title":"Permission Matrix","slug":"permission-matrix","depth":3,"children":[]},{"title":"User Management Dashboard (Admin)","slug":"user-management-dashboard-admin","depth":3,"children":[]}]},{"title":"Data Model","slug":"data-model","depth":2,"children":[]},{"title":"API Reference","slug":"api-reference","depth":2,"children":[{"title":"Edge Functions","slug":"edge-functions","depth":3,"children":[]}]},{"title":"Application Routes","slug":"application-routes","depth":2,"children":[]},{"title":"Tech Stack","slug":"tech-stack","depth":2,"children":[]},{"title":"Progressive Web App (PWA)","slug":"progressive-web-app-pwa","depth":2,"children":[]},{"title":"SEO and Performance","slug":"seo-and-performance","depth":2,"children":[]},{"title":"Troubleshooting","slug":"troubleshooting","depth":2,"children":[]},{"title":"Changelog","slug":"changelog","depth":2,"children":[]},{"title":"Additional Resources","slug":"additional-resources","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"br","siteName":"Starter Kit","title":"AMO CertVault — Complete Documentation - Starter Kit","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-03-18T13:26:32.362Z","originalFileLocation":"amocerts.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Starter Kit\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"AMO CertVault — Complete Documentation - Starter Kit\">\u003cmeta data-mint-head property=\"og:description\" content=\"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Starter Kit\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.briankimemia.is-a.dev/amocerts\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://br.mintlify.site/_mintlify/api/og/v2?division=Get+Started\u0026amp;title=AMO+CertVault+%E2%80%94+Complete+Documentation\u0026amp;description=Enterprise-grade+AI-powered+aircraft+spares+certificate+repository+for+Approved+Maintenance+Organisations.+EASA+Form+1%2C+FAA+8130-3%2C+COC%2C+CRS+extraction+with+rol\u0026amp;theme=9ddf70da2be52af08cbada19\u0026amp;signature=f653492ecd8674e0391b3b260b202f55c38c785dbb7192808c45211232dbf265\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"AMO CertVault — Complete Documentation - Starter Kit\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://br.mintlify.site/_mintlify/api/og/v2?division=Get+Started\u0026amp;title=AMO+CertVault+%E2%80%94+Complete+Documentation\u0026amp;description=Enterprise-grade+AI-powered+aircraft+spares+certificate+repository+for+Approved+Maintenance+Organisations.+EASA+Form+1%2C+FAA+8130-3%2C+COC%2C+CRS+extraction+with+rol\u0026amp;theme=9ddf70da2be52af08cbada19\u0026amp;signature=f653492ecd8674e0391b3b260b202f55c38c785dbb7192808c45211232dbf265\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/br/VmI2z9-J6RrHw9IC/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Starter Kit\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.briankimemia.is-a.dev/amocerts\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/amocerts.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.briankimemia.is-a.dev/#organization\",\"name\":\"Starter Kit\",\"url\":\"https://docs.briankimemia.is-a.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintlify.s3.us-west-1.amazonaws.com/br/logo/favicon.svg\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.briankimemia.is-a.dev#website\",\"name\":\"Starter Kit\",\"url\":\"https://docs.briankimemia.is-a.dev\",\"publisher\":{\"@id\":\"https://docs.briankimemia.is-a.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.briankimemia.is-a.dev/amocerts#webpage\",\"url\":\"https://docs.briankimemia.is-a.dev/amocerts\",\"name\":\"AMO CertVault — Complete Documentation\",\"description\":\"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.\",\"dateModified\":\"2026-03-18T13:26:32.362Z\",\"isPartOf\":{\"@id\":\"https://docs.briankimemia.is-a.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.briankimemia.is-a.dev/amocerts#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.briankimemia.is-a.dev/amocerts#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Get Started\",\"item\":\"https://docs.briankimemia.is-a.dev/introduction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AMO CertVault — Complete Documentation\",\"item\":\"https://docs.briankimemia.is-a.dev/amocerts\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.briankimemia.is-a.dev/amocerts#article\",\"headline\":\"AMO CertVault — Complete Documentation\",\"name\":\"AMO CertVault — Complete Documentation\",\"description\":\"Enterprise-grade AI-powered aircraft spares certificate repository for Approved Maintenance Organisations. EASA Form 1, FAA 8130-3, COC, CRS extraction with role-based access, audit trails, and compliance tooling.\",\"url\":\"https://docs.briankimemia.is-a.dev/amocerts\",\"mainEntityOfPage\":{\"@id\":\"https://docs.briankimemia.is-a.dev/amocerts#webpage\"},\"dateModified\":\"2026-03-18T13:26:32.362Z\",\"publisher\":{\"@id\":\"https://docs.briankimemia.is-a.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.briankimemia.is-a.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Starter Kit\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Starter Kit\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/amocerts.md","siteName":"Starter Kit","nav":{"global":{"anchors":[{"anchor":"Documentation","icon":"book-open-cover","href":"https://mintlify.com/docs"},{"anchor":"Community","icon":"slack","href":"https://mintlify.com/community"},{"anchor":"Blog","icon":"newspaper","href":"https://mintlify.com/blog"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Introduction","href":"/introduction","hidden":false},{"title":"Quickstart","href":"/quickstart","hidden":false},{"title":"Development","description":"Preview changes locally to update your docs","href":"/development","hidden":false},{"title":"AMO CertVault — Complete Documentation","sidebarTitle":"AMO CertVault","icon":"shield-check","href":"/amocerts"},{"description":"A detailed and creative MDX landing page showcasing all AWS projects, using a modern, interactive style.","title":"AWS Projects Overview","sidebarTitle":"AWS Projects Overview","href":"/nas","hidden":false},{"title":"Cloud Security - AWS IAM","href":"/cloudsec","hidden":false},{"title":"Docker Installation Guide","href":"/docker","hidden":false},{"title":"AWS Docker and Elastic Beanstalk Deployment Guide","href":"/ebs","hidden":false},{"title":"Create S3 Buckets with Terraform (PRO project 🌟)","href":"/s3terrafoam","hidden":false},{"title":"Automate with CloudFormation","href":"/web2","hidden":false},{"title":"Amazon VPC, Monitoring, and Flow Logs","href":"/vpclogs","hidden":false},{"title":"VPC Traffic Flow and Security","href":"/vpcsec","hidden":false},{"title":"Access S3 from a VPC","href":"/s3","hidden":false},{"title":null,"href":"/vpcpeering","hidden":false},{"title":"AWS VPC Connectivity","sidebarTitle":"AWS VPC Connectivity","href":"/vpcconnect","hidden":false},{"title":"AWS RDS and QuickSight Connectivity","sidebarTitle":"AWS RDS and QuickSight Connectivity","href":"/rds","hidden":false},{"title":"How to Host a Website on Amazon S3","href":"/s3web","hidden":false},{"title":"Kubernetes Documentation: Launch a Cluster","href":"/kubanetes1","hidden":false},{"title":null,"href":"/kubanetes2","hidden":false},{"title":"Successfully Hosted a Website on Amazon S3","href":"/s3website","hidden":false},{"title":"# Aurora Database Project 🌌","href":"/webs","hidden":false},{"title":"Load Data into DynamoDB","href":"/dynamo","hidden":false},{"title":"AWS Web App Deployment Guide","href":"/web1","hidden":false},{"title":"Cloud Security with AWS IAM","href":"/iam","hidden":false}]},{"group":"WEB-DEVELOPMENT","pages":[{"title":"Frontend - Luxe Living - Premium Furniture E-commerce","href":"/furniture","hidden":false},{"title":"Aviation-grade Inventory Management Information System","icon":"plane","href":"/aeroplane","hidden":false},{"title":"🚀 Eduspark Learning Management System Documentation","href":"/edullm","hidden":false},{"title":"MediHaven Hospital System Architecture","href":"/telemed","hidden":false},{"title":"🎫 Advanced Ticket Management System","href":"/ticket","hidden":false},{"title":"🌦️ Premium Weather Dashboard","href":"/weather","hidden":false},{"title":"AssetifyPro - AI-Powered Supply Chain Management","href":"/assetify","hidden":false},{"title":"AI-Powered Calendar Workflow","href":"/aiworkflow1","hidden":false},{"title":"🌞 M-Solutions Solar Calculator","href":"/solar","hidden":false},{"title":"Al2","href":"/al2"},{"title":"Cloud Security - AWS IAM","href":"/cloudsec","hidden":false},{"title":"Docker Installation Guide","href":"/docker","hidden":false},{"title":"AWS Docker and Elastic Beanstalk Deployment Guide","href":"/ebs","hidden":false},{"title":"Create S3 Buckets with Terraform (PRO project 🌟)","href":"/s3terrafoam","hidden":false},{"title":"Automate with CloudFormation","href":"/web2","hidden":false}]},{"group":"Essentials","pages":[{"title":"Markdown Syntax","icon":"text-size","href":"/essentials/markdown","hidden":false},{"title":"Code Blocks","icon":"code","href":"/essentials/code","hidden":false},{"title":"Images and Embeds","icon":"image","href":"/essentials/images","hidden":false},{"title":"Global Settings","icon":"gear","href":"/essentials/settings","hidden":false},{"title":"Navigation","icon":"map","href":"/essentials/navigation","hidden":false},{"title":"Reusable Snippets","icon":"recycle","href":"/essentials/reusable-snippets","hidden":false}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"AMO CertVault — Complete Documentation - Starter Kit","deploymentId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","buildId":"dpl_EtLmMeZHkKGqAjV1DiX4ZXCriDj3","dynamics":[],"chunks":[]}