/** * JF Creations Costing System - Consolidated React Component Bundle * Provides atomic compilation for Babel Standalone without async race conditions. */ const { useState, useEffect, useRef, Component } = React; // --- 0. EMBEDDED ATTACHMENT MEDIA PARSER --- function parseAttachmentMedia(bbcode) { if (!bbcode || typeof bbcode !== 'string') { return { type: 'empty', url: null, imageUrl: null, linkUrl: null, isIframeBlockable: false }; } const text = bbcode.trim(); if (!text) { return { type: 'empty', url: null, imageUrl: null, linkUrl: null, isIframeBlockable: false }; } let imageUrl = null; let linkUrl = null; let iframeSrc = null; let rawUrl = null; // 1. Extract [img]...[/img] (Priority 1 for direct images) const imgBbcodeMatch = text.match(/\[img\](.*?)\[\/img\]/i); if (imgBbcodeMatch) { imageUrl = imgBbcodeMatch[1].trim(); } // 2. Extract [url=...] (Link container around img or text) const urlAttrMatch = text.match(/\[url=([^\]]+)\]/i); if (urlAttrMatch) { linkUrl = urlAttrMatch[1].trim().replace(/^['"]|['"]$/g, ''); } // 3. Extract [url]...[/url] const urlTagMatch = text.match(/\[url\](.*?)\[\/url\]/i); if (urlTagMatch && !linkUrl) { linkUrl = urlTagMatch[1].trim(); } // 4. Extract