vue-pdf3
Version:
基于Vue3 + vite + PDF.js版的PDF预览插件
2 lines (1 loc) • 5.2 kB
JavaScript
import{B as x,c as L,a as M}from"./_@vue_runtime-core@3.2.40@@vue-6145b0ae.js";import{f as E,e as v,k as l,o as O,B,i as T,y as N,x as R,z as I,G as H,H as w}from"./_@vue_shared@3.2.40@@vue-b138ca7b.js";const z="http://www.w3.org/2000/svg",a=typeof document<"u"?document:null,d=a&&a.createElement("template"),D={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,i)=>{const r=t?a.createElementNS(z,e):a.createElement(e,n?{is:n}:void 0);return e==="select"&&i&&i.multiple!=null&&r.setAttribute("multiple",i.multiple),r},createText:e=>a.createTextNode(e),createComment:e=>a.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>a.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,i,r,s){const c=n?n.previousSibling:t.lastChild;if(r&&(r===s||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===s||!(r=r.nextSibling)););else{d.innerHTML=i?`<svg>${e}</svg>`:e;const f=d.content;if(i){const o=f.firstChild;for(;o.firstChild;)f.appendChild(o.firstChild);f.removeChild(o)}t.insertBefore(f,n)}return[c?c.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}};function F(e,t,n){const i=e._vtc;i&&(t=(t?[t,...i]:[...i]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function W(e,t,n){const i=e.style,r=l(n);if(n&&!r){for(const s in n)u(i,s,n[s]);if(t&&!l(t))for(const s in t)n[s]==null&&u(i,s,"")}else{const s=i.display;r?t!==n&&(i.cssText=n):t&&e.removeAttribute("style"),"_vod"in e&&(i.display=s)}}const g=/\s*!important$/;function u(e,t,n){if(T(n))n.forEach(i=>u(e,t,i));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=q(e,t);g.test(n)?e.setProperty(N(i),n.replace(g,""),"important"):e[i]=n}}const S=["Webkit","Moz","ms"],p={};function q(e,t){const n=p[t];if(n)return n;let i=R(t);if(i!=="filter"&&i in e)return p[t]=i;i=I(i);for(let r=0;r<S.length;r++){const s=S[r]+i;if(s in e)return p[t]=s}return t}const h="http://www.w3.org/1999/xlink";function $(e,t,n,i,r){if(i&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(h,t.slice(6,t.length)):e.setAttributeNS(h,t,n);else{const s=H(t);n==null||s&&!w(n)?e.removeAttribute(t):e.setAttribute(t,s?"":n)}}function j(e,t,n,i,r,s,c){if(t==="innerHTML"||t==="textContent"){i&&c(i,r,s),e[t]=n==null?"":n;return}if(t==="value"&&e.tagName!=="PROGRESS"&&!e.tagName.includes("-")){e._value=n;const o=n==null?"":n;(e.value!==o||e.tagName==="OPTION")&&(e.value=o),n==null&&e.removeAttribute(t);return}let f=!1;if(n===""||n==null){const o=typeof e[t];o==="boolean"?n=w(n):n==null&&o==="string"?(n="",f=!0):o==="number"&&(n=0,f=!0)}try{e[t]=n}catch{}f&&e.removeAttribute(t)}const[P,U]=(()=>{let e=Date.now,t=!1;if(typeof window<"u"){Date.now()>document.createEvent("Event").timeStamp&&(e=performance.now.bind(performance));const n=navigator.userAgent.match(/firefox\/(\d+)/i);t=!!(n&&Number(n[1])<=53)}return[e,t]})();let m=0;const X=Promise.resolve(),G=()=>{m=0},J=()=>m||(X.then(G),m=P());function K(e,t,n,i){e.addEventListener(t,n,i)}function Q(e,t,n,i){e.removeEventListener(t,n,i)}function Y(e,t,n,i,r=null){const s=e._vei||(e._vei={}),c=s[t];if(i&&c)c.value=i;else{const[f,o]=Z(t);if(i){const _=s[t]=V(i,r);K(e,f,_,o)}else c&&(Q(e,f,c,o),s[t]=void 0)}}const C=/(?:Once|Passive|Capture)$/;function Z(e){let t;if(C.test(e)){t={};let i;for(;i=e.match(C);)e=e.slice(0,e.length-i[0].length),t[i[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):N(e.slice(2)),t]}function V(e,t){const n=i=>{const r=i.timeStamp||P();(U||r>=n.attached-1)&&M(y(i,n.value),t,5,[i])};return n.value=e,n.attached=J(),n}function y(e,t){if(T(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(i=>r=>!r._stopped&&i&&i(r))}else return t}const b=/^on[a-z]/,k=(e,t,n,i,r=!1,s,c,f,o)=>{t==="class"?F(e,i,r):t==="style"?W(e,n,i):O(t)?B(t)||Y(e,t,n,i,c):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):tt(e,t,i,r))?j(e,t,i,s,c,f,o):(t==="true-value"?e._trueValue=i:t==="false-value"&&(e._falseValue=i),$(e,t,i,r))};function tt(e,t,n,i){return i?!!(t==="innerHTML"||t==="textContent"||t in e&&b.test(t)&&v(n)):t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA"||b.test(t)&&l(n)?!1:t in e}const et={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};x.props;const nt=E({patchProp:k},D);let A;function it(){return A||(A=L(nt))}const ct=(...e)=>{const t=it().createApp(...e),{mount:n}=t;return t.mount=i=>{const r=rt(i);if(!r)return;const s=t._component;!v(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.innerHTML="";const c=n(r,!1,r instanceof SVGElement);return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),c},t};function rt(e){return l(e)?document.querySelector(e):e}export{ct as c};