{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/vS2fuUlIEymSzIz0sRrg/fjR9N83zHHPhsj2FSKVR/HtemlToPdf.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";// Override function to download a specific div as PDF using jsPDF\nexport function withDownloadPDF(Component){return props=>{let element=null;useEffect(()=>{// Target the parent div using data-framer-name\nelement=document.querySelector('[data-framer-name=\"Body\"]');if(element){console.log(\"Targeted element found:\",element);}else{console.warn(\"Target element 'Body' not found!\");}},[]);const handleDownload=()=>{if(!element){alert(\"Target element 'Body' not found! Please ensure the div has the correct data-framer-name.\");return;}const downloadButtonDiv=document.querySelector('[data-framer-name=\"Default\"]');const originalDisplay=downloadButtonDiv?downloadButtonDiv.style.display:\"\";if(downloadButtonDiv){downloadButtonDiv.style.display=\"none\";}try{var _window_jspdf;const jsPDF=(_window_jspdf=window.jspdf)===null||_window_jspdf===void 0?void 0:_window_jspdf.jsPDF;if(!jsPDF){console.error(\"Failed to load jsPDF from the global scope.\");alert(\"jsPDF is not available. Please ensure it is loaded correctly via CDN.\");return;}const pdf=new jsPDF({orientation:\"portrait\",unit:\"pt\",format:\"a4\"});const pageWidth=pdf.internal.pageSize.getWidth();const pageHeight=pdf.internal.pageSize.getHeight();let currentY=20// Starting Y position with some top margin\n;// Extract the <h1> content to use as the filename\nconst titleElement=element.querySelector(\"h1\");const filename=titleElement?`${titleElement.textContent.trim()}.pdf`:\"download.pdf\";// Collect all relevant text elements including <ol> and <li>\nconst texts=Array.from(element.querySelectorAll(\"p, h1, h2, h3, span, ul, ol, li\"));const seenTexts=new Set// To filter out duplicate text nodes\n;texts.forEach(textEl=>{var _textEl_textContent;const content=(_textEl_textContent=textEl.textContent)===null||_textEl_textContent===void 0?void 0:_textEl_textContent.trim();if(!content||seenTexts.has(content))return;// Skip empty or duplicate content\nseenTexts.add(content);const style=window.getComputedStyle(textEl);const fontSize=11// Set standard font size for legal documents\n;const color=style.color||\"#000000\";// Check if the element contains a <strong> or <b> tag, especially inside <ol> and <li>\nconst containsBold=textEl.querySelectorAll(\"strong, b\").length>0;// Set font to sans-serif and adjust styles for bold\npdf.setFont(\"helvetica\",containsBold?\"bold\":\"normal\");pdf.setFontSize(fontSize);pdf.setTextColor(color);// Split text into lines to fit within the page width\nconst textWidth=pageWidth-40// Account for side margins\n;const lines=pdf.splitTextToSize(content,textWidth);// Calculate line height based on font size and boldness\nconst lineHeight=fontSize+(containsBold?10:6);lines.forEach(line=>{// Check if adding this line would exceed the page height\nif(currentY+lineHeight>pageHeight-20){pdf.addPage();currentY=20// Reset Y position for new page\n;}// Draw text with proper line spacing\npdf.text(line,20,currentY);currentY+=lineHeight;});// Add extra spacing after bold text\ncurrentY+=containsBold?10:6;});pdf.save(filename);console.log(`PDF successfully created and saved as ${filename}`);}catch(error){console.error(\"Error generating PDF:\",error);}finally{if(downloadButtonDiv){downloadButtonDiv.style.display=originalDisplay;}}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleDownload});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withDownloadPDF\":{\"type\":\"reactHoc\",\"name\":\"withDownloadPDF\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HtemlToPdf.map"],
  "mappings": "yFACO,SAASA,EAAgBC,EAAU,CAAC,OAAOC,GAAO,CAAC,IAAIC,EAAQ,KAAK,OAAAC,EAAU,IAAI,CACzFD,EAAQ,SAAS,cAAc,2BAA2B,EAAKA,EAAS,QAAQ,IAAI,0BAA0BA,CAAO,EAAQ,QAAQ,KAAK,kCAAkC,CAAG,EAAE,CAAC,CAAC,EAekGE,EAAKJ,EAAU,CAAC,GAAGC,EAAM,QAfpG,IAAI,CAAC,GAAG,CAACC,EAAQ,CAAC,MAAM,0FAA0F,EAAE,OAAQ,IAAMG,EAAkB,SAAS,cAAc,8BAA8B,EAAQC,EAAgBD,EAAkBA,EAAkB,MAAM,QA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GAAUc,CAAW,CAAC,EACjDd,GAAUW,EAAa,GAAG,CAAE,CAAC,EAAEd,EAAI,KAAKK,CAAQ,EAAE,QAAQ,IAAI,yCAAyCA,GAAU,CAAE,OAAOc,EAAN,CAAa,QAAQ,MAAM,wBAAwBA,CAAK,CAAE,QAAC,CAAWxB,IAAmBA,EAAkB,MAAM,QAAQC,EAAiB,CAAC,CAAqE,CAAC,CAAE,CAAE",
  "names": ["withDownloadPDF", "Component", "props", "element", "ue", "p", "downloadButtonDiv", "originalDisplay", "_window_jspdf", "jsPDF", "window", "pdf", "pageWidth", "pageHeight", "currentY", "titleElement", "filename", "texts", "seenTexts", "textEl", "_textEl_textContent", "content", "style", "fontSize", "color", "containsBold", "textWidth", "lines", "lineHeight", "line", "error"]
}
