!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).PdfViewer={})}(this,function(e){"use strict";class t{static instance;iframeInstance;static resolveViewerBase(){return`${location.origin}/node_modules/pdf-web-viewer/dist/web/viewer.html`}static resolveFilePath(e){const t=e.trim().toLowerCase();return t.startsWith("http:")||t.startsWith("https:")?encodeURIComponent(e.trim()):encodeURIComponent(`${location.origin}${e.startsWith("/")?e:"/"+e}`)}static viewerUrlFor(e){return`${t.resolveViewerBase()}?file=${t.resolveFilePath(e)}`}constructor(e,i){if(!/\.pdf($|[?#])/i.test(e))throw new Error("Only PDF files are supported.");const r=i?.width||"100%",n=i?.height||"100%";this.iframeInstance=document.createElement("iframe"),this.iframeInstance.src=t.viewerUrlFor(e),this.iframeInstance.style.width=r,this.iframeInstance.style.height=n,this.iframeInstance.style.border="none",this.iframeInstance.loading="lazy",this.iframeInstance.allow="fullscreen"}static getInstance(e,i){return this.instance=new t(e,i),this.instance}mount(e){if(!e)throw new Error("Target element is required to mount the PDF viewer.");e.appendChild(this.iframeInstance)}setFile(e){if(!e)throw new Error("Source PDF URL is required.");if(!/\.pdf($|[?#])/i.test(e))throw new Error("Only PDF files are supported.");this.iframeInstance.src=t.viewerUrlFor(e)}}const i=t.getInstance;e.create=i});