reactjs-file-preview
Version:
Effortlessly preview images, videos, and PDFs in your React applications with MyFilePreview. This lightweight and customizable component intelligently detects file types and displays them.
1,323 lines (1,320 loc) • 422 kB
JavaScript
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".preview-file{width:100%;height:100%;object-fit:contain}.loader-container{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.loader{width:50px;height:50px;border:5px solid #e0e0e0;border-top:5px solid #606060;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.hidden{visibility:hidden;width:0;height:0}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
import require$$0, { useState, useEffect } from "react";
function getAugmentedNamespace(z) {
if (z.__esModule) return z;
var r = z.default;
if (typeof r == "function") {
var _ = function t() {
return this instanceof t ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
};
_.prototype = r.prototype;
} else _ = {};
return Object.defineProperty(_, "__esModule", { value: !0 }), Object.keys(z).forEach(function(t) {
var g = Object.getOwnPropertyDescriptor(z, t);
Object.defineProperty(_, t, g.get ? g : {
enumerable: !0,
get: function() {
return z[t];
}
});
}), _;
}
var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var hasRequiredReactJsxRuntime_production_min;
function requireReactJsxRuntime_production_min() {
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
hasRequiredReactJsxRuntime_production_min = 1;
var z = require$$0, r = Symbol.for("react.element"), _ = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, g = z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, x = { key: !0, ref: !0, __self: !0, __source: !0 };
function R(O, m, d) {
var f, E = {}, N = null, P = null;
d !== void 0 && (N = "" + d), m.key !== void 0 && (N = "" + m.key), m.ref !== void 0 && (P = m.ref);
for (f in m) t.call(m, f) && !x.hasOwnProperty(f) && (E[f] = m[f]);
if (O && O.defaultProps) for (f in m = O.defaultProps, m) E[f] === void 0 && (E[f] = m[f]);
return { $$typeof: r, type: O, key: N, ref: P, props: E, _owner: g.current };
}
return reactJsxRuntime_production_min.Fragment = _, reactJsxRuntime_production_min.jsx = R, reactJsxRuntime_production_min.jsxs = R, reactJsxRuntime_production_min;
}
var reactJsxRuntime_development = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var hasRequiredReactJsxRuntime_development;
function requireReactJsxRuntime_development() {
return hasRequiredReactJsxRuntime_development || (hasRequiredReactJsxRuntime_development = 1, process.env.NODE_ENV !== "production" && function() {
var z = require$$0, r = Symbol.for("react.element"), _ = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), O = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), W = Symbol.iterator, c = "@@iterator";
function S(C) {
if (C === null || typeof C != "object")
return null;
var K = W && C[W] || C[c];
return typeof K == "function" ? K : null;
}
var I = z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function T(C) {
{
for (var K = arguments.length, Z = new Array(K > 1 ? K - 1 : 0), re = 1; re < K; re++)
Z[re - 1] = arguments[re];
b("error", C, Z);
}
}
function b(C, K, Z) {
{
var re = I.ReactDebugCurrentFrame, pe = re.getStackAddendum();
pe !== "" && (K += "%s", Z = Z.concat([pe]));
var _e = Z.map(function(he) {
return String(he);
});
_e.unshift("Warning: " + K), Function.prototype.apply.call(console[C], console, _e);
}
}
var n = !1, s = !1, u = !1, y = !1, p = !1, M;
M = Symbol.for("react.module.reference");
function k(C) {
return !!(typeof C == "string" || typeof C == "function" || C === t || C === x || p || C === g || C === d || C === f || y || C === P || n || s || u || typeof C == "object" && C !== null && (C.$$typeof === N || C.$$typeof === E || C.$$typeof === R || C.$$typeof === O || C.$$typeof === m || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
C.$$typeof === M || C.getModuleId !== void 0));
}
function $(C, K, Z) {
var re = C.displayName;
if (re)
return re;
var pe = K.displayName || K.name || "";
return pe !== "" ? Z + "(" + pe + ")" : Z;
}
function D(C) {
return C.displayName || "Context";
}
function v(C) {
if (C == null)
return null;
if (typeof C.tag == "number" && T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof C == "function")
return C.displayName || C.name || null;
if (typeof C == "string")
return C;
switch (C) {
case t:
return "Fragment";
case _:
return "Portal";
case x:
return "Profiler";
case g:
return "StrictMode";
case d:
return "Suspense";
case f:
return "SuspenseList";
}
if (typeof C == "object")
switch (C.$$typeof) {
case O:
var K = C;
return D(K) + ".Consumer";
case R:
var Z = C;
return D(Z._context) + ".Provider";
case m:
return $(C, C.render, "ForwardRef");
case E:
var re = C.displayName || null;
return re !== null ? re : v(C.type) || "Memo";
case N: {
var pe = C, _e = pe._payload, he = pe._init;
try {
return v(he(_e));
} catch {
return null;
}
}
}
return null;
}
var L = Object.assign, j = 0, V, F, o, e, i, a, h;
function l() {
}
l.__reactDisabledLog = !0;
function A() {
{
if (j === 0) {
V = console.log, F = console.info, o = console.warn, e = console.error, i = console.group, a = console.groupCollapsed, h = console.groupEnd;
var C = {
configurable: !0,
enumerable: !0,
value: l,
writable: !0
};
Object.defineProperties(console, {
info: C,
log: C,
warn: C,
error: C,
group: C,
groupCollapsed: C,
groupEnd: C
});
}
j++;
}
}
function w() {
{
if (j--, j === 0) {
var C = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: L({}, C, {
value: V
}),
info: L({}, C, {
value: F
}),
warn: L({}, C, {
value: o
}),
error: L({}, C, {
value: e
}),
group: L({}, C, {
value: i
}),
groupCollapsed: L({}, C, {
value: a
}),
groupEnd: L({}, C, {
value: h
})
});
}
j < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var U = I.ReactCurrentDispatcher, G;
function B(C, K, Z) {
{
if (G === void 0)
try {
throw Error();
} catch (pe) {
var re = pe.stack.trim().match(/\n( *(at )?)/);
G = re && re[1] || "";
}
return `
` + G + C;
}
}
var Y = !1, J;
{
var Q = typeof WeakMap == "function" ? WeakMap : Map;
J = new Q();
}
function te(C, K) {
if (!C || Y)
return "";
{
var Z = J.get(C);
if (Z !== void 0)
return Z;
}
var re;
Y = !0;
var pe = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var _e;
_e = U.current, U.current = null, A();
try {
if (K) {
var he = function() {
throw Error();
};
if (Object.defineProperty(he.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(he, []);
} catch (Te) {
re = Te;
}
Reflect.construct(C, [], he);
} else {
try {
he.call();
} catch (Te) {
re = Te;
}
C.call(he.prototype);
}
} else {
try {
throw Error();
} catch (Te) {
re = Te;
}
C();
}
} catch (Te) {
if (Te && re && typeof Te.stack == "string") {
for (var le = Te.stack.split(`
`), Pe = re.stack.split(`
`), ve = le.length - 1, Ce = Pe.length - 1; ve >= 1 && Ce >= 0 && le[ve] !== Pe[Ce]; )
Ce--;
for (; ve >= 1 && Ce >= 0; ve--, Ce--)
if (le[ve] !== Pe[Ce]) {
if (ve !== 1 || Ce !== 1)
do
if (ve--, Ce--, Ce < 0 || le[ve] !== Pe[Ce]) {
var Fe = `
` + le[ve].replace(" at new ", " at ");
return C.displayName && Fe.includes("<anonymous>") && (Fe = Fe.replace("<anonymous>", C.displayName)), typeof C == "function" && J.set(C, Fe), Fe;
}
while (ve >= 1 && Ce >= 0);
break;
}
}
} finally {
Y = !1, U.current = _e, w(), Error.prepareStackTrace = pe;
}
var Ne = C ? C.displayName || C.name : "", Ie = Ne ? B(Ne) : "";
return typeof C == "function" && J.set(C, Ie), Ie;
}
function oe(C, K, Z) {
return te(C, !1);
}
function ie(C) {
var K = C.prototype;
return !!(K && K.isReactComponent);
}
function de(C, K, Z) {
if (C == null)
return "";
if (typeof C == "function")
return te(C, ie(C));
if (typeof C == "string")
return B(C);
switch (C) {
case d:
return B("Suspense");
case f:
return B("SuspenseList");
}
if (typeof C == "object")
switch (C.$$typeof) {
case m:
return oe(C.render);
case E:
return de(C.type, K, Z);
case N: {
var re = C, pe = re._payload, _e = re._init;
try {
return de(_e(pe), K, Z);
} catch {
}
}
}
return "";
}
var ae = Object.prototype.hasOwnProperty, ue = {}, ye = I.ReactDebugCurrentFrame;
function ne(C) {
if (C) {
var K = C._owner, Z = de(C.type, C._source, K ? K.type : null);
ye.setExtraStackFrame(Z);
} else
ye.setExtraStackFrame(null);
}
function be(C, K, Z, re, pe) {
{
var _e = Function.call.bind(ae);
for (var he in C)
if (_e(C, he)) {
var le = void 0;
try {
if (typeof C[he] != "function") {
var Pe = Error((re || "React class") + ": " + Z + " type `" + he + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof C[he] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw Pe.name = "Invariant Violation", Pe;
}
le = C[he](K, he, re, Z, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (ve) {
le = ve;
}
le && !(le instanceof Error) && (ne(pe), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", re || "React class", Z, he, typeof le), ne(null)), le instanceof Error && !(le.message in ue) && (ue[le.message] = !0, ne(pe), T("Failed %s type: %s", Z, le.message), ne(null));
}
}
}
var me = Array.isArray;
function Se(C) {
return me(C);
}
function Ae(C) {
{
var K = typeof Symbol == "function" && Symbol.toStringTag, Z = K && C[Symbol.toStringTag] || C.constructor.name || "Object";
return Z;
}
}
function we(C) {
try {
return xe(C), !1;
} catch {
return !0;
}
}
function xe(C) {
return "" + C;
}
function Re(C) {
if (we(C))
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ae(C)), xe(C);
}
var Ee = I.ReactCurrentOwner, ke = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, ge, Oe;
function je(C) {
if (ae.call(C, "ref")) {
var K = Object.getOwnPropertyDescriptor(C, "ref").get;
if (K && K.isReactWarning)
return !1;
}
return C.ref !== void 0;
}
function Ge(C) {
if (ae.call(C, "key")) {
var K = Object.getOwnPropertyDescriptor(C, "key").get;
if (K && K.isReactWarning)
return !1;
}
return C.key !== void 0;
}
function He(C, K) {
typeof C.ref == "string" && Ee.current;
}
function Ve(C, K) {
{
var Z = function() {
ge || (ge = !0, T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", K));
};
Z.isReactWarning = !0, Object.defineProperty(C, "key", {
get: Z,
configurable: !0
});
}
}
function $e(C, K) {
{
var Z = function() {
Oe || (Oe = !0, T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", K));
};
Z.isReactWarning = !0, Object.defineProperty(C, "ref", {
get: Z,
configurable: !0
});
}
}
var Xe = function(C, K, Z, re, pe, _e, he) {
var le = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: r,
// Built-in properties that belong on the element
type: C,
key: K,
ref: Z,
props: he,
// Record the component responsible for creating this element.
_owner: _e
};
return le._store = {}, Object.defineProperty(le._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(le, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: re
}), Object.defineProperty(le, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: pe
}), Object.freeze && (Object.freeze(le.props), Object.freeze(le)), le;
};
function ze(C, K, Z, re, pe) {
{
var _e, he = {}, le = null, Pe = null;
Z !== void 0 && (Re(Z), le = "" + Z), Ge(K) && (Re(K.key), le = "" + K.key), je(K) && (Pe = K.ref, He(K, pe));
for (_e in K)
ae.call(K, _e) && !ke.hasOwnProperty(_e) && (he[_e] = K[_e]);
if (C && C.defaultProps) {
var ve = C.defaultProps;
for (_e in ve)
he[_e] === void 0 && (he[_e] = ve[_e]);
}
if (le || Pe) {
var Ce = typeof C == "function" ? C.displayName || C.name || "Unknown" : C;
le && Ve(he, Ce), Pe && $e(he, Ce);
}
return Xe(C, le, Pe, pe, re, Ee.current, he);
}
}
var Ue = I.ReactCurrentOwner, X = I.ReactDebugCurrentFrame;
function q(C) {
if (C) {
var K = C._owner, Z = de(C.type, C._source, K ? K.type : null);
X.setExtraStackFrame(Z);
} else
X.setExtraStackFrame(null);
}
var H;
H = !1;
function ee(C) {
return typeof C == "object" && C !== null && C.$$typeof === r;
}
function se() {
{
if (Ue.current) {
var C = v(Ue.current.type);
if (C)
return `
Check the render method of \`` + C + "`.";
}
return "";
}
}
function ce(C) {
return "";
}
var fe = {};
function Me(C) {
{
var K = se();
if (!K) {
var Z = typeof C == "string" ? C : C.displayName || C.name;
Z && (K = `
Check the top-level render call using <` + Z + ">.");
}
return K;
}
}
function Le(C, K) {
{
if (!C._store || C._store.validated || C.key != null)
return;
C._store.validated = !0;
var Z = Me(K);
if (fe[Z])
return;
fe[Z] = !0;
var re = "";
C && C._owner && C._owner !== Ue.current && (re = " It was passed a child from " + v(C._owner.type) + "."), q(C), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Z, re), q(null);
}
}
function De(C, K) {
{
if (typeof C != "object")
return;
if (Se(C))
for (var Z = 0; Z < C.length; Z++) {
var re = C[Z];
ee(re) && Le(re, K);
}
else if (ee(C))
C._store && (C._store.validated = !0);
else if (C) {
var pe = S(C);
if (typeof pe == "function" && pe !== C.entries)
for (var _e = pe.call(C), he; !(he = _e.next()).done; )
ee(he.value) && Le(he.value, K);
}
}
}
function qe(C) {
{
var K = C.type;
if (K == null || typeof K == "string")
return;
var Z;
if (typeof K == "function")
Z = K.propTypes;
else if (typeof K == "object" && (K.$$typeof === m || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
K.$$typeof === E))
Z = K.propTypes;
else
return;
if (Z) {
var re = v(K);
be(Z, C.props, "prop", re, C);
} else if (K.PropTypes !== void 0 && !H) {
H = !0;
var pe = v(K);
T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", pe || "Unknown");
}
typeof K.getDefaultProps == "function" && !K.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Ye(C) {
{
for (var K = Object.keys(C.props), Z = 0; Z < K.length; Z++) {
var re = K[Z];
if (re !== "children" && re !== "key") {
q(C), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", re), q(null);
break;
}
}
C.ref !== null && (q(C), T("Invalid attribute `ref` supplied to `React.Fragment`."), q(null));
}
}
var We = {};
function Be(C, K, Z, re, pe, _e) {
{
var he = k(C);
if (!he) {
var le = "";
(C === void 0 || typeof C == "object" && C !== null && Object.keys(C).length === 0) && (le += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var Pe = ce();
Pe ? le += Pe : le += se();
var ve;
C === null ? ve = "null" : Se(C) ? ve = "array" : C !== void 0 && C.$$typeof === r ? (ve = "<" + (v(C.type) || "Unknown") + " />", le = " Did you accidentally export a JSX literal instead of a component?") : ve = typeof C, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ve, le);
}
var Ce = ze(C, K, Z, pe, _e);
if (Ce == null)
return Ce;
if (he) {
var Fe = K.children;
if (Fe !== void 0)
if (re)
if (Se(Fe)) {
for (var Ne = 0; Ne < Fe.length; Ne++)
De(Fe[Ne], C);
Object.freeze && Object.freeze(Fe);
} else
T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
De(Fe, C);
}
if (ae.call(K, "key")) {
var Ie = v(C), Te = Object.keys(K).filter(function(nt) {
return nt !== "key";
}), Je = Te.length > 0 ? "{key: someKey, " + Te.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!We[Ie + Je]) {
var tt = Te.length > 0 ? "{" + Te.join(": ..., ") + ": ...}" : "{}";
T(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, Je, Ie, tt, Ie), We[Ie + Je] = !0;
}
}
return C === t ? Ye(Ce) : qe(Ce), Ce;
}
}
function Ke(C, K, Z) {
return Be(C, K, Z, !0);
}
function Qe(C, K, Z) {
return Be(C, K, Z, !1);
}
var Ze = Qe, et = Ke;
reactJsxRuntime_development.Fragment = t, reactJsxRuntime_development.jsx = Ze, reactJsxRuntime_development.jsxs = et;
}()), reactJsxRuntime_development;
}
var hasRequiredJsxRuntime;
function requireJsxRuntime() {
return hasRequiredJsxRuntime || (hasRequiredJsxRuntime = 1, process.env.NODE_ENV === "production" ? jsxRuntime.exports = requireReactJsxRuntime_production_min() : jsxRuntime.exports = requireReactJsxRuntime_development()), jsxRuntime.exports;
}
var jsxRuntimeExports = requireJsxRuntime();
function commonjsRequire(z) {
throw new Error('Could not dynamically require "' + z + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var pdf$1 = { exports: {} };
const __viteBrowserExternal = {}, __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: __viteBrowserExternal
}, Symbol.toStringTag, { value: "Module" })), require$$5 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
var pdf = pdf$1.exports, hasRequiredPdf;
function requirePdf() {
return hasRequiredPdf || (hasRequiredPdf = 1, function(module, exports) {
(function(r, _) {
module.exports = _();
})(pdf, function() {
return (
/******/
(() => {
var __webpack_modules__ = [
,
/* 1 */
/***/
(z, r, _) => {
Object.defineProperty(r, "__esModule", {
value: !0
}), r.addLinkAttributes = c, r.deprecated = y, r.getFilenameFromUrl = T, r.getPdfFilenameFromUrl = b, r.getXfaPageViewport = k, r.isDataScheme = S, r.isPdfFile = I, r.isValidFetchUrl = s, r.loadScript = u, r.StatTimer = r.RenderingCancelledException = r.PDFDateString = r.PageViewport = r.LinkTarget = r.DOMSVGFactory = r.DOMStandardFontDataFactory = r.DOMCMapReaderFactory = r.DOMCanvasFactory = r.DEFAULT_LINK_REL = void 0;
var t = _(2), g = _(5);
const x = "noopener noreferrer nofollow";
r.DEFAULT_LINK_REL = x;
const R = "http://www.w3.org/2000/svg";
class O extends g.BaseCanvasFactory {
constructor({
ownerDocument: D = globalThis.document
} = {}) {
super(), this._document = D;
}
_createCanvas(D, v) {
const L = this._document.createElement("canvas");
return L.width = D, L.height = v, L;
}
}
r.DOMCanvasFactory = O;
async function m($, D = !1) {
if (s($, document.baseURI)) {
const v = await fetch($);
if (!v.ok)
throw new Error(v.statusText);
return D ? new Uint8Array(await v.arrayBuffer()) : (0, t.stringToBytes)(await v.text());
}
return new Promise((v, L) => {
const j = new XMLHttpRequest();
j.open("GET", $, !0), D && (j.responseType = "arraybuffer"), j.onreadystatechange = () => {
if (j.readyState === XMLHttpRequest.DONE) {
if (j.status === 200 || j.status === 0) {
let V;
if (D && j.response ? V = new Uint8Array(j.response) : !D && j.responseText && (V = (0, t.stringToBytes)(j.responseText)), V) {
v(V);
return;
}
}
L(new Error(j.statusText));
}
}, j.send(null);
});
}
class d extends g.BaseCMapReaderFactory {
_fetchData(D, v) {
return m(D, this.isCompressed).then((L) => ({
cMapData: L,
compressionType: v
}));
}
}
r.DOMCMapReaderFactory = d;
class f extends g.BaseStandardFontDataFactory {
_fetchData(D) {
return m(D, !0);
}
}
r.DOMStandardFontDataFactory = f;
class E extends g.BaseSVGFactory {
_createSVG(D) {
return document.createElementNS(R, D);
}
}
r.DOMSVGFactory = E;
class N {
constructor({
viewBox: D,
scale: v,
rotation: L,
offsetX: j = 0,
offsetY: V = 0,
dontFlip: F = !1
}) {
this.viewBox = D, this.scale = v, this.rotation = L, this.offsetX = j, this.offsetY = V;
const o = (D[2] + D[0]) / 2, e = (D[3] + D[1]) / 2;
let i, a, h, l;
switch (L %= 360, L < 0 && (L += 360), L) {
case 180:
i = -1, a = 0, h = 0, l = 1;
break;
case 90:
i = 0, a = 1, h = 1, l = 0;
break;
case 270:
i = 0, a = -1, h = -1, l = 0;
break;
case 0:
i = 1, a = 0, h = 0, l = -1;
break;
default:
throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
}
F && (h = -h, l = -l);
let A, w, U, G;
i === 0 ? (A = Math.abs(e - D[1]) * v + j, w = Math.abs(o - D[0]) * v + V, U = Math.abs(D[3] - D[1]) * v, G = Math.abs(D[2] - D[0]) * v) : (A = Math.abs(o - D[0]) * v + j, w = Math.abs(e - D[1]) * v + V, U = Math.abs(D[2] - D[0]) * v, G = Math.abs(D[3] - D[1]) * v), this.transform = [i * v, a * v, h * v, l * v, A - i * v * o - h * v * e, w - a * v * o - l * v * e], this.width = U, this.height = G;
}
clone({
scale: D = this.scale,
rotation: v = this.rotation,
offsetX: L = this.offsetX,
offsetY: j = this.offsetY,
dontFlip: V = !1
} = {}) {
return new N({
viewBox: this.viewBox.slice(),
scale: D,
rotation: v,
offsetX: L,
offsetY: j,
dontFlip: V
});
}
convertToViewportPoint(D, v) {
return t.Util.applyTransform([D, v], this.transform);
}
convertToViewportRectangle(D) {
const v = t.Util.applyTransform([D[0], D[1]], this.transform), L = t.Util.applyTransform([D[2], D[3]], this.transform);
return [v[0], v[1], L[0], L[1]];
}
convertToPdfPoint(D, v) {
return t.Util.applyInverseTransform([D, v], this.transform);
}
}
r.PageViewport = N;
class P extends t.BaseException {
constructor(D, v) {
super(D), this.type = v;
}
}
r.RenderingCancelledException = P;
const W = {
NONE: 0,
SELF: 1,
BLANK: 2,
PARENT: 3,
TOP: 4
};
r.LinkTarget = W;
function c($, {
url: D,
target: v,
rel: L,
enabled: j = !0
} = {}) {
(0, t.assert)(D && typeof D == "string", 'addLinkAttributes: A valid "url" parameter must provided.');
const V = (0, t.removeNullCharacters)(D);
j ? $.href = $.title = V : ($.href = "", $.title = `Disabled: ${V}`, $.onclick = () => !1);
let F = "";
switch (v) {
case W.NONE:
break;
case W.SELF:
F = "_self";
break;
case W.BLANK:
F = "_blank";
break;
case W.PARENT:
F = "_parent";
break;
case W.TOP:
F = "_top";
break;
}
$.target = F, $.rel = typeof L == "string" ? L : x;
}
function S($) {
const D = $.length;
let v = 0;
for (; v < D && $[v].trim() === ""; )
v++;
return $.substring(v, v + 5).toLowerCase() === "data:";
}
function I($) {
return typeof $ == "string" && /\.pdf$/i.test($);
}
function T($) {
const D = $.indexOf("#"), v = $.indexOf("?"), L = Math.min(D > 0 ? D : $.length, v > 0 ? v : $.length);
return $.substring($.lastIndexOf("/", L) + 1, L);
}
function b($, D = "document.pdf") {
if (typeof $ != "string")
return D;
if (S($))
return (0, t.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), D;
const v = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/, L = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i, j = v.exec($);
let V = L.exec(j[1]) || L.exec(j[2]) || L.exec(j[3]);
if (V && (V = V[0], V.includes("%")))
try {
V = L.exec(decodeURIComponent(V))[0];
} catch {
}
return V || D;
}
class n {
constructor() {
this.started = /* @__PURE__ */ Object.create(null), this.times = [];
}
time(D) {
D in this.started && (0, t.warn)(`Timer is already running for ${D}`), this.started[D] = Date.now();
}
timeEnd(D) {
D in this.started || (0, t.warn)(`Timer has not been started for ${D}`), this.times.push({
name: D,
start: this.started[D],
end: Date.now()
}), delete this.started[D];
}
toString() {
const D = [];
let v = 0;
for (const L of this.times) {
const j = L.name;
j.length > v && (v = j.length);
}
for (const L of this.times) {
const j = L.end - L.start;
D.push(`${L.name.padEnd(v)} ${j}ms
`);
}
return D.join("");
}
}
r.StatTimer = n;
function s($, D) {
try {
const {
protocol: v
} = D ? new URL($, D) : new URL($);
return v === "http:" || v === "https:";
} catch {
return !1;
}
}
function u($, D = !1) {
return new Promise((v, L) => {
const j = document.createElement("script");
j.src = $, j.onload = function(V) {
D && j.remove(), v(V);
}, j.onerror = function() {
L(new Error(`Cannot load script at: ${j.src}`));
}, (document.head || document.documentElement).appendChild(j);
});
}
function y($) {
console.log("Deprecated API usage: " + $);
}
let p;
class M {
static toDateObject(D) {
if (!D || !(0, t.isString)(D))
return null;
p || (p = new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));
const v = p.exec(D);
if (!v)
return null;
const L = parseInt(v[1], 10);
let j = parseInt(v[2], 10);
j = j >= 1 && j <= 12 ? j - 1 : 0;
let V = parseInt(v[3], 10);
V = V >= 1 && V <= 31 ? V : 1;
let F = parseInt(v[4], 10);
F = F >= 0 && F <= 23 ? F : 0;
let o = parseInt(v[5], 10);
o = o >= 0 && o <= 59 ? o : 0;
let e = parseInt(v[6], 10);
e = e >= 0 && e <= 59 ? e : 0;
const i = v[7] || "Z";
let a = parseInt(v[8], 10);
a = a >= 0 && a <= 23 ? a : 0;
let h = parseInt(v[9], 10) || 0;
return h = h >= 0 && h <= 59 ? h : 0, i === "-" ? (F += a, o += h) : i === "+" && (F -= a, o -= h), new Date(Date.UTC(L, j, V, F, o, e));
}
}
r.PDFDateString = M;
function k($, {
scale: D = 1,
rotation: v = 0
}) {
const {
width: L,
height: j
} = $.attributes.style, V = [0, 0, parseInt(L), parseInt(j)];
return new N({
viewBox: V,
scale: D,
rotation: v
});
}
},
/* 2 */
/***/
(z, r, _) => {
Object.defineProperty(r, "__esModule", {
value: !0
}), r.arrayByteLength = oe, r.arraysToBytes = ie, r.assert = V, r.bytesToString = Q, r.createObjectURL = Ue, r.createPromiseCapability = ze, r.createValidAbsoluteUrl = e, r.escapeString = Re, r.getModificationDate = Xe, r.getVerbosityLevel = D, r.info = v, r.isArrayBuffer = Ve, r.isArrayEqual = $e, r.isAscii = Ee, r.isBool = je, r.isNum = Ge, r.isSameOrigin = F, r.isString = He, r.objectFromMap = ue, r.objectSize = ae, r.removeNullCharacters = J, r.setVerbosityLevel = $, r.shadow = i, r.string32 = de, r.stringToBytes = te, r.stringToPDFString = xe, r.stringToUTF16BEString = ke, r.stringToUTF8String = ge, r.unreachable = j, r.utf8StringToString = Oe, r.warn = L, r.VerbosityLevel = r.Util = r.UNSUPPORTED_FEATURES = r.UnknownErrorException = r.UnexpectedResponseException = r.TextRenderingMode = r.StreamType = r.PermissionFlag = r.PasswordResponses = r.PasswordException = r.PageActionEventType = r.OPS = r.MissingPDFException = r.IsLittleEndianCached = r.IsEvalSupportedCached = r.InvalidPDFException = r.ImageKind = r.IDENTITY_MATRIX = r.FormatError = r.FontType = r.FONT_IDENTITY_MATRIX = r.DocumentActionEventType = r.CMapCompressionType = r.BaseException = r.AnnotationType = r.AnnotationStateModelType = r.AnnotationReviewState = r.AnnotationReplyType = r.AnnotationMarkedState = r.AnnotationFlag = r.AnnotationFieldFlag = r.AnnotationBorderStyleType = r.AnnotationActionEventType = r.AbortException = void 0, _(3);
const t = [1, 0, 0, 1, 0, 0];
r.IDENTITY_MATRIX = t;
const g = [1e-3, 0, 0, 1e-3, 0, 0];
r.FONT_IDENTITY_MATRIX = g;
const x = {
PRINT: 4,
MODIFY_CONTENTS: 8,
COPY: 16,
MODIFY_ANNOTATIONS: 32,
FILL_INTERACTIVE_FORMS: 256,
COPY_FOR_ACCESSIBILITY: 512,
ASSEMBLE: 1024,
PRINT_HIGH_QUALITY: 2048
};
r.PermissionFlag = x;
const R = {
FILL: 0,
STROKE: 1,
FILL_STROKE: 2,
INVISIBLE: 3,
FILL_ADD_TO_PATH: 4,
STROKE_ADD_TO_PATH: 5,
FILL_STROKE_ADD_TO_PATH: 6,
ADD_TO_PATH: 7,
FILL_STROKE_MASK: 3,
ADD_TO_PATH_FLAG: 4
};
r.TextRenderingMode = R;
const O = {
GRAYSCALE_1BPP: 1,
RGB_24BPP: 2,
RGBA_32BPP: 3
};
r.ImageKind = O;
const m = {
TEXT: 1,
LINK: 2,
FREETEXT: 3,
LINE: 4,
SQUARE: 5,
CIRCLE: 6,
POLYGON: 7,
POLYLINE: 8,
HIGHLIGHT: 9,
UNDERLINE: 10,
SQUIGGLY: 11,
STRIKEOUT: 12,
STAMP: 13,
CARET: 14,
INK: 15,
POPUP: 16,
FILEATTACHMENT: 17,
SOUND: 18,
MOVIE: 19,
WIDGET: 20,
SCREEN: 21,
PRINTERMARK: 22,
TRAPNET: 23,
WATERMARK: 24,
THREED: 25,
REDACT: 26
};
r.AnnotationType = m;
const d = {
MARKED: "Marked",
REVIEW: "Review"
};
r.AnnotationStateModelType = d;
const f = {
MARKED: "Marked",
UNMARKED: "Unmarked"
};
r.AnnotationMarkedState = f;
const E = {
ACCEPTED: "Accepted",
REJECTED: "Rejected",
CANCELLED: "Cancelled",
COMPLETED: "Completed",
NONE: "None"
};
r.AnnotationReviewState = E;
const N = {
GROUP: "Group",
REPLY: "R"
};
r.AnnotationReplyType = N;
const P = {
INVISIBLE: 1,
HIDDEN: 2,
PRINT: 4,
NOZOOM: 8,
NOROTATE: 16,
NOVIEW: 32,
READONLY: 64,
LOCKED: 128,
TOGGLENOVIEW: 256,
LOCKEDCONTENTS: 512
};
r.AnnotationFlag = P;
const W = {
READONLY: 1,
REQUIRED: 2,
NOEXPORT: 4,
MULTILINE: 4096,
PASSWORD: 8192,
NOTOGGLETOOFF: 16384,
RADIO: 32768,
PUSHBUTTON: 65536,
COMBO: 131072,
EDIT: 262144,
SORT: 524288,
FILESELECT: 1048576,
MULTISELECT: 2097152,
DONOTSPELLCHECK: 4194304,
DONOTSCROLL: 8388608,
COMB: 16777216,
RICHTEXT: 33554432,
RADIOSINUNISON: 33554432,
COMMITONSELCHANGE: 67108864
};
r.AnnotationFieldFlag = W;
const c = {
SOLID: 1,
DASHED: 2,
BEVELED: 3,
INSET: 4,
UNDERLINE: 5
};
r.AnnotationBorderStyleType = c;
const S = {
E: "Mouse Enter",
X: "Mouse Exit",
D: "Mouse Down",
U: "Mouse Up",
Fo: "Focus",
Bl: "Blur",
PO: "PageOpen",
PC: "PageClose",
PV: "PageVisible",
PI: "PageInvisible",
K: "Keystroke",
F: "Format",
V: "Validate",
C: "Calculate"
};
r.AnnotationActionEventType = S;
const I = {
WC: "WillClose",
WS: "WillSave",
DS: "DidSave",
WP: "WillPrint",
DP: "DidPrint"
};
r.DocumentActionEventType = I;
const T = {
O: "PageOpen",
C: "PageClose"
};
r.PageActionEventType = T;
const b = {
UNKNOWN: "UNKNOWN",
FLATE: "FLATE",
LZW: "LZW",
DCT: "DCT",
JPX: "JPX",
JBIG: "JBIG",
A85: "A85",
AHX: "AHX",
CCF: "CCF",
RLX: "RLX"
};
r.StreamType = b;
const n = {
UNKNOWN: "UNKNOWN",
TYPE1: "TYPE1",
TYPE1STANDARD: "TYPE1STANDARD",
TYPE1C: "TYPE1C",
CIDFONTTYPE0: "CIDFONTTYPE0",
CIDFONTTYPE0C: "CIDFONTTYPE0C",
TRUETYPE: "TRUETYPE",
CIDFONTTYPE2: "CIDFONTTYPE2",
TYPE3: "TYPE3",
OPENTYPE: "OPENTYPE",
TYPE0: "TYPE0",
MMTYPE1: "MMTYPE1"
};
r.FontType = n;
const s = {
ERRORS: 0,
WARNINGS: 1,
INFOS: 5
};
r.VerbosityLevel = s;
const u = {
NONE: 0,
BINARY: 1,
STREAM: 2
};
r.CMapCompressionType = u;
const y = {
dependency: 1,
setLineWidth: 2,
setLineCap: 3,
setLineJoin: 4,
setMiterLimit: 5,
setDash: 6,
setRenderingIntent: 7,
setFlatness: 8,
setGState: 9,
save: 10,
restore: 11,
transform: 12,
moveTo: 13,
lineTo: 14,
curveTo: 15,
curveTo2: 16,
curveTo3: 17,
closePath: 18,
rectangle: 19,
stroke: 20,
closeStroke: 21,
fill: 22,
eoFill: 23,
fillStroke: 24,
eoFillStroke: 25,
closeFillStroke: 26,
closeEOFillStroke: 27,
endPath: 28,
clip: 29,
eoClip: 30,
beginText: 31,
endText: 32,
setCharSpacing: 33,
setWordSpacing: 34,
setHScale: 35,
setLeading: 36,
setFont: 37,
setTextRenderingMode: 38,
setTextRise: 39,
moveText: 40,
setLeadingMoveText: 41,
setTextMatrix: 42,
nextLine: 43,
showText: 44,
showSpacedText: 45,
nextLineShowText: 46,
nextLineSetSpacingShowText: 47,
setCharWidth: 48,
setCharWidthAndBounds: 49,
setStrokeColorSpace: 50,
setFillColorSpace: 51,
setStrokeColor: 52,
setStrokeColorN: 53,
setFillColor: 54,
setFillColorN: 55,
setStrokeGray: 56,
setFillGray: 57,
setStrokeRGBColor: 58,
setFillRGBColor: 59,
setStrokeCMYKColor: 60,
setFillCMYKColor: 61,
shadingFill: 62,
beginInlineImage: 63,
beginImageData: 64,
endInlineImage: 65,
paintXObject: 66,
markPoint: 67,
markPointProps: 68,
beginMarkedContent: 69,
beginMarkedContentProps: 70,
endMarkedContent: 71,
beginCompat: 72,
endCompat: 73,
paintFormXObjectBegin: 74,
paintFormXObjectEnd: 75,
beginGroup: 76,
endGroup: 77,
beginAnnotations: 78,
endAnnotations: 79,
beginAnnotation: 80,
endAnnotation: 81,
paintJpegXObject: 82,
paintImageMaskXObject: 83,
paintImageMaskXObjectGroup: 84,
paintImageXObject: 85,
paintInlineImageXObject: 86,
paintInlineImageXObjectGroup: 87,
paintImageXObjectRepeat: 88,
paintImageMaskXObjectRepeat: 89,
paintSolidColorImageMask: 90,
constructPath: 91
};
r.OPS = y;
const p = {
unknown: "unknown",
forms: "forms",
javaScript: "javaScript",
signatures: "signatures",
smask: "smask",
shadingPattern: "shadingPattern",
font: "font",
errorTilingPattern: "errorTilingPattern",
errorExtGState: "errorExtGState",
errorXObject: "errorXObject",
errorFontLoadType3: "errorFontLoadType3",
errorFontState: "errorFontState",
errorFontMissing: "errorFontMissing",
errorFontTranslate: "errorFontTranslate",
errorColorSpace: "errorColorSpace",
errorOperatorList: "errorOperatorList",
errorFontToUnicode: "errorFontToUnicode",
errorFontLoadNative: "errorFontLoadNative",
errorFontBuildPath: "errorFontBuildPath",
errorFontGetPath: "errorFontGetPath",
errorMarkedContent: "errorMarkedContent"
};
r.UNSUPPORTED_FEATURES = p;
const M = {
NEED_PASSWORD: 1,
INCORRECT_PASSWORD: 2
};
r.PasswordResponses = M;
let k = s.WARNINGS;
function $(X) {
Number.isInteger(X) && (k = X);
}
function D() {
return k;
}
function v(X) {
k >= s.INFOS && console.log(`Info: ${X}`);
}
function L(X) {
k >= s.WARNINGS && console.log(`Warning: ${X}`);
}
function j(X) {
throw new Error(X);
}
function V(X, q) {
X || j(q);
}
function F(X, q) {
let H;
try {
if (H = new URL(X), !H.origin || H.origin === "null")
return !1;
} catch {
return !1;
}
const ee = new URL(q, H);
return H.origin === ee.origin;
}
function o(X) {
if (!X)
return !1;