UNPKG

@tindtechnologies/universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

2 lines (1 loc) 3.25 kB
import{b as I}from"./chunk-YAXTLTJC.js";var C=I((O,p)=>{(function(m,t){typeof define=="function"&&define.amd?define([],t):typeof p=="object"&&p.exports?p.exports=t():m.PDFObject=t()})(O,function(){"use strict";if(typeof window=="undefined"||typeof navigator=="undefined")return!1;var m="2.1.1",t=window.navigator.userAgent,b,v,M=typeof navigator.mimeTypes["application/pdf"]!="undefined",g,k=function(){return typeof window.Promise!="undefined"}(),J=function(){return t.indexOf("irefox")!==-1}(),R=function(){return J?parseInt(t.split("rv:")[1].split(".")[0],10)>18:!1}(),y=function(){return/iphone|ipad|ipod/i.test(t.toLowerCase())}(),h,P,F,a,D,T,w,L;return h=function(e){var i;try{i=new ActiveXObject(e)}catch{i=null}return i},v=function(){return!!(window.ActiveXObject||"ActiveXObject"in window)},g=function(){return!!(h("AcroPDF.PDF")||h("PDF.PdfCtrl"))},b=!y&&(R||M||v()&&g()),P=function(e){var i="",n;if(e){for(n in e)e.hasOwnProperty(n)&&(i+=encodeURIComponent(n)+"="+encodeURIComponent(e[n])+"&");i&&(i="#"+i,i=i.slice(0,i.length-1))}return i},F=function(e){typeof console!="undefined"&&console.log&&console.log("[PDFObject] "+e)},a=function(e){return F(e),!1},T=function(e){var i=document.body;return typeof e=="string"?i=document.querySelector(e):typeof jQuery!="undefined"&&e instanceof jQuery&&e.length?i=e.get(0):typeof e.nodeType!="undefined"&&e.nodeType===1&&(i=e),i},w=function(e,i,n,f,d){var u=f+"?file="+encodeURIComponent(i)+n,r=y?"-webkit-overflow-scrolling: touch; overflow-y: scroll; ":"overflow: hidden; ",o="<div style='"+r+"position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe "+d+" src='"+u+"' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";return e.className+=" pdfobject-container",e.style.position="relative",e.style.overflow="auto",e.innerHTML=o,e.getElementsByTagName("iframe")[0]},L=function(e,i,n,f,d,u,r){var o="";return i&&i!==document.body?o="width: "+d+"; height: "+u+";":o="position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;",e.className+=" pdfobject-container",e.innerHTML="<embed "+r+" class='pdfobject' src='"+n+f+"' type='application/pdf' style='overflow: auto; "+o+"'/>",e.getElementsByTagName("embed")[0]},D=function(e,i,n){if(typeof e!="string")return a("URL is not valid");i=typeof i!="undefined"?i:!1,n=typeof n!="undefined"?n:{};var f=n.id&&typeof n.id=="string"?"id='"+n.id+"'":"",d=n.page?n.page:!1,u=n.pdfOpenParams?n.pdfOpenParams:{},r=typeof n.fallbackLink!="undefined"?n.fallbackLink:!0,o=n.width?n.width:"100%",U=n.height?n.height:"100%",x=typeof n.assumptionMode=="boolean"?n.assumptionMode:!0,A=typeof n.forcePDFJS=="boolean"?n.forcePDFJS:!1,l=n.PDFJS_URL?n.PDFJS_URL:!1,s=T(i),j="",c="",E="<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";return s?(d&&(u.page=d),c=P(u),A&&l?w(s,e,c,l,f):b||x&&k&&!y?L(s,i,e,c,o,U,f):l?w(s,e,c,l,f):(r&&(j=typeof r=="string"?r:E,s.innerHTML=j.replace(/\[url\]/g,e)),a("This browser does not support embedded PDFs"))):a("Target element cannot be determined")},{embed:function(e,i,n){return D(e,i,n)},pdfobjectversion:function(){return m}(),supportsPDFs:function(){return b}()}})});export default C();