{"version":3,"file":"PDFViewer.Dxq6O2d7.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/htKcM20CNTKCsllUlPFh/GzPAEvVC21nDI4yASB9v/PDFViewer.js"],"sourcesContent":["// PDF Viewer component that displays PDF files from CMS or static URLs\n// Supports Google Drive, Dropbox, and direct PDF URLs\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,startTransition}from\"react\";/**\n * PDF Viewer\n *\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 600\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PDFViewer(props){const{pdfUrl=\"https://framerusercontent.com/assets/example.pdf\",showToolbar=true,zoom=100,backgroundColor=\"#F5F5F5\",borderRadius=8}=props;const[embedUrl,setEmbedUrl]=useState(\"\");const[error,setError]=useState(\"\");useEffect(()=>{if(typeof window===\"undefined\")return;if(!pdfUrl||pdfUrl.trim()===\"\"){startTransition(()=>{setError(\"Please provide a PDF URL\");setEmbedUrl(\"\");});return;}try{let processedUrl=pdfUrl.trim();// Handle Google Drive URLs\nif(processedUrl.includes(\"drive.google.com\")){const fileIdMatch=processedUrl.match(/\\/d\\/([a-zA-Z0-9_-]+)/);if(fileIdMatch){const fileId=fileIdMatch[1];processedUrl=`https://drive.google.com/file/d/${fileId}/preview`;}else if(processedUrl.includes(\"/file/d/\")){processedUrl=processedUrl.replace(\"/view\",\"/preview\");}}else if(processedUrl.includes(\"dropbox.com\")){processedUrl=processedUrl.replace(\"www.dropbox.com\",\"dl.dropboxusercontent.com\");processedUrl=processedUrl.replace(\"?dl=0\",\"\");}else if(processedUrl.endsWith(\".pdf\")){const toolbar=showToolbar?\"1\":\"0\";processedUrl=`${processedUrl}#toolbar=${toolbar}&zoom=${zoom}`;}startTransition(()=>{setEmbedUrl(processedUrl);setError(\"\");});}catch(err){startTransition(()=>{setError(\"Invalid URL format\");setEmbedUrl(\"\");});}},[pdfUrl,showToolbar,zoom]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor,borderRadius,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\"},children:error?/*#__PURE__*/_jsx(\"div\",{style:{padding:20,textAlign:\"center\",color:\"#FF5588\",fontSize:14,fontFamily:\"Inter, sans-serif\"},children:error}):embedUrl?/*#__PURE__*/_jsx(\"iframe\",{src:embedUrl,style:{width:\"100%\",height:\"100%\",border:\"none\"},title:\"PDF Viewer\",allow:\"autoplay\"}):/*#__PURE__*/_jsx(\"div\",{style:{padding:20,textAlign:\"center\",color:\"#CCCCCC\",fontSize:14,fontFamily:\"Inter, sans-serif\"},children:\"Loading PDF...\"})});}addPropertyControls(PDFViewer,{pdfUrl:{type:ControlType.String,title:\"PDF URL\",defaultValue:\"https://framerusercontent.com/assets/example.pdf\",placeholder:\"Enter PDF URL or Google Drive link\",displayTextArea:true},showToolbar:{type:ControlType.Boolean,title:\"Show Toolbar\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},zoom:{type:ControlType.Number,title:\"Zoom\",defaultValue:100,min:50,max:200,step:10,unit:\"%\",displayStepper:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PDFViewer\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"600\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"800\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PDFViewer.map"],"mappings":"uMAUG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,SAAO,mDAAmD,cAAY,GAAK,OAAK,IA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