ngx-extended-pdf-viewer
Version:
Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.
44 lines • 1.04 MB
JavaScript
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
!function webpackUniversalModuleDefinition(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],r):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=r():t["pdfjs-dist/build/pdf"]=t.pdfjsLib=r()}(this,(function(){return(()=>{var __webpack_modules__=[,(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.addLinkAttributes=function addLinkAttributes(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.url,i=r.target,l=r.rel,c=r.enabled,d=void 0===c||c;(0,o.assert)(a&&"string"==typeof a,'addLinkAttributes: A valid "url" parameter must provided.');var h=(0,o.removeNullCharacters)(a);if(d)t.href=t.title=h;else{t.href="";t.title="Disabled: ".concat(h);t.onclick=function(){return!1}}var p="";switch(i){case v.NONE:break;case v.SELF:p="_self";break;case v.BLANK:p="_blank";break;case v.PARENT:p="_parent";break;case v.TOP:p="_top"}t.target=p;t.rel="string"==typeof l?l:u};r.deprecated=function deprecated(t){console.log("Deprecated API usage: "+t)};r.getFilenameFromUrl=function getFilenameFromUrl(t){var r=t.indexOf("#"),a=t.indexOf("?"),i=Math.min(r>0?r:t.length,a>0?a:t.length);return t.substring(t.lastIndexOf("/",i)+1,i)};r.getPdfFilenameFromUrl=function getPdfFilenameFromUrl(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if(window.PDFViewerApplication.appConfig.filenameForDownload)return window.PDFViewerApplication.appConfig.filenameForDownload;if("string"!=typeof t)return r;if(isDataScheme(t)){(0,o.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return r}var a=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,l=a.exec(t),u=i.exec(l[1])||i.exec(l[2])||i.exec(l[3]);if(u&&(u=u[0]).includes("%"))try{u=i.exec(decodeURIComponent(u))[0]}catch(t){}return u||r};r.getXfaPageViewport=function getXfaPageViewport(t,r){var a=r.scale,i=void 0===a?1:a,o=r.rotation,l=void 0===o?0:o,u=t.attributes.style,c=u.width,d=u.height,h=[0,0,parseInt(c),parseInt(d)];return new m({viewBox:h,scale:i,rotation:l})};r.isDataScheme=isDataScheme;r.isPdfFile=function isPdfFile(t){return"string"==typeof t&&/\.pdf$/i.test(t)};r.isValidFetchUrl=isValidFetchUrl;r.loadScript=function loadScript(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((function(a,i){var o=document.createElement("script");"Function"===t.constructor.name?o.src=t():o.src=t;o.onload=function(t){r&&o.remove();a(t)};o.onerror=function(){i(new Error("Cannot load script at: ".concat(o.src)))};(document.head||document.documentElement).appendChild(o)}))};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 i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4),l=a(117);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var u="noopener noreferrer nofollow";r.DEFAULT_LINK_REL=u;var c=function(t){_inherits(DOMCanvasFactory,t);var r=_createSuper(DOMCanvasFactory);function DOMCanvasFactory(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=a.ownerDocument,o=void 0===i?globalThis.document:i;_classCallCheck(this,DOMCanvasFactory);(t=r.call(this))._document=o;return t}_createClass(DOMCanvasFactory,[{key:"_createCanvas",value:function _createCanvas(t,r){var a=this._document.createElement("canvas");a.width=t;a.height=r;return a}}]);return DOMCanvasFactory}(l.BaseCanvasFactory);r.DOMCanvasFactory=c;function fetchData(t){return _fetchData.apply(this,arguments)}function _fetchData(){_fetchData=_asyncToGenerator(i.default.mark((function _callee(t){var r,a,l=arguments;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:r=l.length>1&&void 0!==l[1]&&l[1];if(!isValidFetchUrl(t,document.baseURI)){i.next=21;break}i.next=4;return fetch(t);case 4:if((a=i.sent).ok){i.next=7;break}throw new Error(a.statusText);case 7:if(!r){i.next=15;break}i.t1=Uint8Array;i.next=11;return a.arrayBuffer();case 11:i.t2=i.sent;i.t0=new i.t1(i.t2);i.next=20;break;case 15:i.t3=o.stringToBytes;i.next=18;return a.text();case 18:i.t4=i.sent;i.t0=(0,i.t3)(i.t4);case 20:return i.abrupt("return",i.t0);case 21:return i.abrupt("return",new Promise((function(a,i){var l=new XMLHttpRequest;l.open("GET",t,!0);r&&(l.responseType="arraybuffer");l.onreadystatechange=function(){if(l.readyState===XMLHttpRequest.DONE){if(200===l.status||0===l.status){var t;r&&l.response?t=new Uint8Array(l.response):!r&&l.responseText&&(t=(0,o.stringToBytes)(l.responseText));if(t){a(t);return}}i(new Error(l.statusText))}};l.send(null)})));case 22:case"end":return i.stop()}}),_callee)})));return _fetchData.apply(this,arguments)}var d=function(t){_inherits(DOMCMapReaderFactory,t);var r=_createSuper(DOMCMapReaderFactory);function DOMCMapReaderFactory(){_classCallCheck(this,DOMCMapReaderFactory);return r.apply(this,arguments)}_createClass(DOMCMapReaderFactory,[{key:"_fetchData",value:function _fetchData(t,r){return fetchData(t,this.isCompressed).then((function(t){return{cMapData:t,compressionType:r}}))}}]);return DOMCMapReaderFactory}(l.BaseCMapReaderFactory);r.DOMCMapReaderFactory=d;var h=function(t){_inherits(DOMStandardFontDataFactory,t);var r=_createSuper(DOMStandardFontDataFactory);function DOMStandardFontDataFactory(){_classCallCheck(this,DOMStandardFontDataFactory);return r.apply(this,arguments)}_createClass(DOMStandardFontDataFactory,[{key:"_fetchData",value:function _fetchData(t){return fetchData(t,!0)}}]);return DOMStandardFontDataFactory}(l.BaseStandardFontDataFactory);r.DOMStandardFontDataFactory=h;var p=function(t){_inherits(DOMSVGFactory,t);var r=_createSuper(DOMSVGFactory);function DOMSVGFactory(){_classCallCheck(this,DOMSVGFactory);return r.apply(this,arguments)}_createClass(DOMSVGFactory,[{key:"_createSVG",value:function _createSVG(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}]);return DOMSVGFactory}(l.BaseSVGFactory);r.DOMSVGFactory=p;var m=function(){function PageViewport(t){var r=t.viewBox,a=t.scale,i=t.rotation,o=t.offsetX,l=void 0===o?0:o,u=t.offsetY,c=void 0===u?0:u,d=t.dontFlip,h=void 0!==d&&d;_classCallCheck(this,PageViewport);this.viewBox=r;this.scale=a;this.rotation=i;this.offsetX=l;this.offsetY=c;var p,m,g,v,y,b,S,w,C=(r[2]+r[0])/2,P=(r[3]+r[1])/2;(i%=360)<0&&(i+=360);switch(i){case 180:p=-1;m=0;g=0;v=1;break;case 90:p=0;m=1;g=1;v=0;break;case 270:p=0;m=-1;g=-1;v=0;break;case 0:p=1;m=0;g=0;v=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(h){g=-g;v=-v}if(0===p){y=Math.abs(P-r[1])*a+l;b=Math.abs(C-r[0])*a+c;S=Math.abs(r[3]-r[1])*a;w=Math.abs(r[2]-r[0])*a}else{y=Math.abs(C-r[0])*a+l;b=Math.abs(P-r[1])*a+c;S=Math.abs(r[2]-r[0])*a;w=Math.abs(r[3]-r[1])*a}this.transform=[p*a,m*a,g*a,v*a,y-p*a*C-g*a*P,b-m*a*C-v*a*P];this.width=S;this.height=w}_createClass(PageViewport,[{key:"clone",value:function clone(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.scale,a=void 0===r?this.scale:r,i=t.rotation,o=void 0===i?this.rotation:i,l=t.offsetX,u=void 0===l?this.offsetX:l,c=t.offsetY,d=void 0===c?this.offsetY:c,h=t.dontFlip,p=void 0!==h&&h;return new PageViewport({viewBox:this.viewBox.slice(),scale:a,rotation:o,offsetX:u,offsetY:d,dontFlip:p})}},{key:"convertToViewportPoint",value:function convertToViewportPoint(t,r){return o.Util.applyTransform([t,r],this.transform)}},{key:"convertToViewportRectangle",value:function convertToViewportRectangle(t){var r=o.Util.applyTransform([t[0],t[1]],this.transform),a=o.Util.applyTransform([t[2],t[3]],this.transform);return[r[0],r[1],a[0],a[1]]}},{key:"convertToPdfPoint",value:function convertToPdfPoint(t,r){return o.Util.applyInverseTransform([t,r],this.transform)}}]);return PageViewport}();r.PageViewport=m;var g=function(t){_inherits(RenderingCancelledException,t);var r=_createSuper(RenderingCancelledException);function RenderingCancelledException(t,a){var i;_classCallCheck(this,RenderingCancelledException);(i=r.call(this,t)).type=a;return i}return RenderingCancelledException}(o.BaseException);r.RenderingCancelledException=g;var v={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};r.LinkTarget=v;function isDataScheme(t){for(var r=t.length,a=0;a<r&&""===t[a].trim();)a++;return"data:"===t.substring(a,a+5).toLowerCase()}var y,b=function(){function StatTimer(){_classCallCheck(this,StatTimer);this.started=Object.create(null);this.times=[]}_createClass(StatTimer,[{key:"time",value:function time(t){t in this.started&&(0,o.warn)("Timer is already running for ".concat(t));this.started[t]=Date.now()}},{key:"timeEnd",value:function timeEnd(t){t in this.started||(0,o.warn)("Timer has not been started for ".concat(t));this.times.push({name:t,start:this.started[t],end:Date.now()});delete this.started[t]}},{key:"toString",value:function toString(){var t,r=[],a=0,i=_createForOfIteratorHelper(this.times);try{for(i.s();!(t=i.n()).done;){var o=t.value.name;o.length>a&&(a=o.length)}}catch(t){i.e(t)}finally{i.f()}var l,u=_createForOfIteratorHelper(this.times);try{for(u.s();!(l=u.n()).done;){var c=l.value,d=c.end-c.start;r.push("".concat(c.name.padEnd(a)," ").concat(d,"ms\n"))}}catch(t){u.e(t)}finally{u.f()}return r.join("")}}]);return StatTimer}();r.StatTimer=b;function isValidFetchUrl(t,r){try{var a=(r?new URL(t,r):new URL(t)).protocol;return"http:"===a||"https:"===a||"capacitor:"===a}catch(t){return!1}}var S=function(){function PDFDateString(){_classCallCheck(this,PDFDateString)}_createClass(PDFDateString,null,[{key:"toDateObject",value:function toDateObject(t){if(!t||!(0,o.isString)(t))return null;y||(y=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));var r=y.exec(t);if(!r)return null;var a=parseInt(r[1],10),i=parseInt(r[2],10);i=i>=1&&i<=12?i-1:0;var l=parseInt(r[3],10);l=l>=1&&l<=31?l:1;var u=parseInt(r[4],10);u=u>=0&&u<=23?u:0;var c=parseInt(r[5],10);c=c>=0&&c<=59?c:0;var d=parseInt(r[6],10);d=d>=0&&d<=59?d:0;var h=r[7]||"Z",p=parseInt(r[8],10);p=p>=0&&p<=23?p:0;var m=parseInt(r[9],10)||0;m=m>=0&&m<=59?m:0;if("-"===h){u+=p;c+=m}else if("+"===h){u-=p;c-=m}return new Date(Date.UTC(a,i,l,u,c,d))}}]);return PDFDateString}();r.PDFDateString=S},(t,r,a)=>{"use strict";t.exports=a(3)},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}var i=function(t){var r,a=Object.prototype,i=a.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},l=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(t,r,a){Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0});return t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),u=new Context(i||[]);l._invoke=function makeInvokeMethod(t,r,a){var i=d;return function invoke(o,l){if(i===p)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw l;return doneResult()}a.method=o;a.arg=l;for(;;){var u=a.delegate;if(u){var c=maybeInvokeDelegate(u,a);if(c){if(c===g)continue;return c}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(i===d){i=m;throw a.arg}a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i=p;var v=tryCatch(t,r,a);if("normal"===v.type){i=a.done?m:h;if(v.arg===g)continue;return{value:v.arg,done:a.done}}if("throw"===v.type){i=m;a.method="throw";a.arg=v.arg}}}}(t,a,u);return l}t.wrap=wrap;function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}var d="suspendedStart",h="suspendedYield",p="executing",m="completed",g={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var v={};define(v,l,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(values([])));b&&b!==a&&i.call(b,l)&&(v=b);var S=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(v);GeneratorFunction.prototype=GeneratorFunctionPrototype;define(S,"constructor",GeneratorFunctionPrototype);define(GeneratorFunctionPrototype,"constructor",GeneratorFunction);GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction");function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))};t.mark=function(t){if(Object.setPrototypeOf)Object.setPrototypeOf(t,GeneratorFunctionPrototype);else{t.__proto__=GeneratorFunctionPrototype;define(t,c,"GeneratorFunction")}t.prototype=Object.create(S);return t};t.awrap=function(t){return{__await:t}};function AsyncIterator(t,r){function invoke(a,o,l,u){var c=tryCatch(t[a],t,o);if("throw"!==c.type){var d=c.arg,h=d.value;return h&&"object"===_typeof(h)&&i.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,u)}),(function(t){invoke("throw",t,l,u)})):r.resolve(h).then((function(t){d.value=t;l(d)}),(function(t){return invoke("throw",t,l,u)}))}u(c.arg)}var a;this._invoke=function enqueue(t,i){function callInvokeWithMethodAndArg(){return new r((function(r,a){invoke(t,i,r,a)}))}return a=a?a.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}defineIteratorMethods(AsyncIterator.prototype);define(AsyncIterator.prototype,u,(function(){return this}));t.AsyncIterator=AsyncIterator;t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var u=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?u:u.next().then((function(t){return t.done?t.value:u.next()}))};function maybeInvokeDelegate(t,a){var i=t.iterator[a.method];if(i===r){a.delegate=null;if("throw"===a.method){if(t.iterator.return){a.method="return";a.arg=r;maybeInvokeDelegate(t,a);if("throw"===a.method)return g}a.method="throw";a.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=tryCatch(i,t.iterator,a.arg);if("throw"===o.type){a.method="throw";a.arg=o.arg;a.delegate=null;return g}var l=o.arg;if(!l){a.method="throw";a.arg=new TypeError("iterator result is not an object");a.delegate=null;return g}if(!l.done)return l;a[t.resultName]=l.value;a.next=t.nextLoc;if("return"!==a.method){a.method="next";a.arg=r}a.delegate=null;return g}defineIteratorMethods(S);define(S,c,"Generator");define(S,l,(function(){return this}));define(S,"toString",(function(){return"[object Generator]"}));function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]);if(2 in t){r.finallyLoc=t[2];r.afterLoc=t[3]}this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal";delete r.arg;t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}];t.forEach(pushTryEntry,this);this.reset(!0)}t.keys=function(t){var r=[];for(var a in t)r.push(a);r.reverse();return function next(){for(;r.length;){var a=r.pop();if(a in t){next.value=a;next.done=!1;return next}}next.done=!0;return next}};function values(t){if(t){var a=t[l];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,u=function next(){for(;++o<t.length;)if(i.call(t,o)){next.value=t[o];next.done=!1;return next}next.value=r;next.done=!0;return next};return u.next=u}}return{next:doneResult}}t.values=values;function doneResult(){return{value:r,done:!0}}Context.prototype={constructor:Context,reset:function reset(t){this.prev=0;this.next=0;this.sent=this._sent=r;this.done=!1;this.delegate=null;this.method="next";this.arg=r;this.tryEntries.forEach(resetTryEntry);if(!t)for(var a in this)"t"===a.charAt(0)&&i.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=r)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var a=this;function handle(i,o){u.type="throw";u.arg=t;a.next=i;if(o){a.method="next";a.arg=r}return!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o],u=l.completion;if("root"===l.tryLoc)return handle("end");if(l.tryLoc<=this.prev){var c=i.call(l,"catchLoc"),d=i.call(l,"finallyLoc");if(c&&d){if(this.prev<l.catchLoc)return handle(l.catchLoc,!0);if(this.prev<l.finallyLoc)return handle(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return handle(l.catchLoc,!0)}else{if(!d)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return handle(l.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var u=l?l.completion:{};u.type=t;u.arg=r;if(l){this.method="next";this.next=l.finallyLoc;return g}return this.complete(u)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;if("break"===t.type||"continue"===t.type)this.next=t.arg;else if("return"===t.type){this.rval=this.arg=t.arg;this.method="return";this.next="end"}else"normal"===t.type&&r&&(this.next=r);return g},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t){this.complete(a.completion,a.afterLoc);resetTryEntry(a);return g}}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,a,i){this.delegate={iterator:values(t),resultName:a,nextLoc:i};"next"===this.method&&(this.arg=r);return g}};return t}("object"===_typeof(t=a.nmd(t))?t.exports:{});try{regeneratorRuntime=i}catch(t){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.arrayByteLength=arrayByteLength;r.arraysToBytes=function arraysToBytes(t){var r=t.length;if(1===r&&t[0]instanceof Uint8Array)return t[0];for(var a=0,i=0;i<r;i++)a+=arrayByteLength(t[i]);for(var o=0,l=new Uint8Array(a),u=0;u<r;u++){var c=t[u];c instanceof Uint8Array||(c="string"==typeof c?stringToBytes(c):new Uint8Array(c));var d=c.byteLength;l.set(c,o);o+=d}return l};r.assert=assert;r.bytesToString=function bytesToString(t){assert(null!==t&&"object"===_typeof(t)&&void 0!==t.length,"Invalid argument for bytesToString");var r=t.length,a=8192;if(r<a)return String.fromCharCode.apply(null,t);for(var i=[],o=0;o<r;o+=a){var l=Math.min(o+a,r),u=t.subarray(o,l);i.push(String.fromCharCode.apply(null,u))}return i.join("")};r.createObjectURL=function createObjectURL(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(URL.createObjectURL&&!a)return URL.createObjectURL(new Blob([t],{type:r}));for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="data:".concat(r,";base64,"),l=0,u=t.length;l<u;l+=3){var c=255&t[l],d=255&t[l+1],h=255&t[l+2],p=c>>2,m=(3&c)<<4|d>>4,g=l+1<u?(15&d)<<2|h>>6:64,v=l+2<u?63&h:64;o+=i[p]+i[m]+i[g]+i[v]}return o};r.createPromiseCapability=function createPromiseCapability(){var t=Object.create(null),r=!1;Object.defineProperty(t,"settled",{get:function get(){return r}});t.promise=new Promise((function(a,i){t.resolve=function(t){r=!0;a(t)};t.reject=function(t){r=!0;i(t)}}));return t};r.createValidAbsoluteUrl=function createValidAbsoluteUrl(t,r){if(!t)return null;try{var a=r?new URL(t,r):new URL(t);if(function _isValidProtocol(t){if(!t)return!1;switch(t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(a))return a}catch(t){}return null};r.escapeString=function escapeString(t){return t.replace(/([()\\\n\r])/g,(function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\".concat(t)}))};r.getModificationDate=function getModificationDate(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,r=[t.getUTCFullYear().toString(),(t.getUTCMonth()+1).toString().padStart(2,"0"),t.getUTCDate().toString().padStart(2,"0"),t.getUTCHours().toString().padStart(2,"0"),t.getUTCMinutes().toString().padStart(2,"0"),t.getUTCSeconds().toString().padStart(2,"0")];return r.join("")};r.getVerbosityLevel=function getVerbosityLevel(){return o};r.info=function info(t){o>=i.INFOS&&console.log("Info: ".concat(t))};r.isArrayBuffer=function isArrayBuffer(t){return"object"===_typeof(t)&&null!==t&&void 0!==t.byteLength};r.isArrayEqual=function isArrayEqual(t,r){if(t.length!==r.length)return!1;for(var a=0,i=t.length;a<i;a++)if(t[a]!==r[a])return!1;return!0};r.isAscii=function isAscii(t){return/^[\x00-\x7F]*$/.test(t)};r.isBool=function isBool(t){return"boolean"==typeof t};r.isNum=function isNum(t){return"number"==typeof t};r.isSameOrigin=function isSameOrigin(t,r){var a;try{if(!(a=new URL(t)).origin||"null"===a.origin)return!1}catch(t){return!1}var i=new URL(r,a);return a.origin===i.origin};r.isString=function isString(t){return"string"==typeof t};r.objectFromMap=function objectFromMap(t){var r,a=Object.create(null),i=function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}(t);try{for(i.s();!(r=i.n()).done;){var o=(c=r.value,d=2,function _arrayWithHoles(t){if(Array.isArray(t))return t}(c)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(c,d)||_unsupportedIterableToArray(c,d)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=o[0],u=o[1];a[l]=u}}catch(t){i.e(t)}finally{i.f()}var c,d;return a};r.objectSize=function objectSize(t){return Object.keys(t).length};r.removeNullCharacters=function removeNullCharacters(t){if("string"!=typeof t){warn("The argument for removeNullCharacters must be a string.");return t}return t.replace(v,"")};r.setVerbosityLevel=function setVerbosityLevel(t){Number.isInteger(t)&&(o=t)};r.shadow=shadow;r.string32=function string32(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)};r.stringToBytes=stringToBytes;r.stringToPDFString=function stringToPDFString(t){var r=t.length,a=[];if("þ"===t[0]&&"ÿ"===t[1])for(var i=2;i<r;i+=2)a.push(String.fromCharCode(t.charCodeAt(i)<<8|t.charCodeAt(i+1)));else if("ÿ"===t[0]&&"þ"===t[1])for(var o=2;o<r;o+=2)a.push(String.fromCharCode(t.charCodeAt(o+1)<<8|t.charCodeAt(o)));else for(var l=0;l<r;++l){var u=C[t.charCodeAt(l)];a.push(u?String.fromCharCode(u):t.charAt(l))}return a.join("")};r.stringToUTF16BEString=function stringToUTF16BEString(t){for(var r=["þÿ"],a=0,i=t.length;a<i;a++){var o=t.charCodeAt(a);r.push(String.fromCharCode(o>>8&255),String.fromCharCode(255&o))}return r.join("")};r.stringToUTF8String=function stringToUTF8String(t){return decodeURIComponent(escape(t))};r.unreachable=unreachable;r.utf8StringToString=function utf8StringToString(t){return unescape(encodeURIComponent(t))};r.warn=warn;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;a(5);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}r.IDENTITY_MATRIX=[1,0,0,1,0,0];r.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];r.PermissionFlag={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.TextRenderingMode={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.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};r.AnnotationType={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.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};r.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};r.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};r.AnnotationReplyType={GROUP:"Group",REPLY:"R"};r.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};r.AnnotationFieldFlag={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.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};r.AnnotationActionEventType={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.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};r.PageActionEventType={O:"PageOpen",C:"PageClose"};r.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};r.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};var i={ERRORS:0,WARNINGS:1,INFOS:5};r.VerbosityLevel=i;r.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};r.OPS={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.UNSUPPORTED_FEATURES={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.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};var o=i.WARNINGS;function warn(t){o>=i.WARNINGS&&console.log("Warning: ".concat(t))}function unreachable(t){throw new Error(t)}function assert(t,r){t||unreachable(r)}function shadow(t,r,a){Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!1});return a}var l=function BaseExceptionClosure(){function BaseException(t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=t;this.name=this.constructor.name}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();r.BaseException=l;var u=function(t){_inherits(PasswordException,t);var r=_createSuper(PasswordException);function PasswordException(t,a){var i;_classCallCheck(this,PasswordException);(i=r.call(this,t)).code=a;return i}return PasswordException}(l);r.PasswordException=u;var c=function(t){_inherits(UnknownErrorException,t);var r=_createSuper(UnknownErrorException);function UnknownErrorException(t,a){var i;_classCallCheck(this,UnknownErrorException);(i=r.call(this,t)).details=a;return i}return UnknownErrorException}(l);r.UnknownErrorException=c;var d=function(t){_inherits(InvalidPDFException,t);var r=_createSuper(InvalidPDFException);function InvalidPDFException(){_classCallCheck(this,InvalidPDFException);return r.apply(this,arguments)}return InvalidPDFException}(l);r.InvalidPDFException=d;var h=function(t){_inherits(MissingPDFException,t);var r=_createSuper(MissingPDFException);function MissingPDFException(){_classCallCheck(this,MissingPDFException);return r.apply(this,arguments)}return MissingPDFException}(l);r.MissingPDFException=h;var p=function(t){_inherits(UnexpectedResponseException,t);var r=_createSuper(UnexpectedResponseException);function UnexpectedResponseException(t,a){var i;_classCallCheck(this,UnexpectedResponseException);(i=r.call(this,t)).status=a;return i}return UnexpectedResponseException}(l);r.UnexpectedResponseException=p;var m=function(t){_inherits(FormatError,t);var r=_createSuper(FormatError);function FormatError(){_classCallCheck(this,FormatError);return r.apply(this,arguments)}return FormatError}(l);r.FormatError=m;var g=function(t){_inherits(AbortException,t);var r=_createSuper(AbortException);function AbortException(){_classCallCheck(this,AbortException);return r.apply(this,arguments)}return AbortException}(l);r.AbortException=g;var v=/\x00/g;function stringToBytes(t){assert("string"==typeof t,"Invalid argument for stringToBytes");for(var r=t.length,a=new Uint8Array(r),i=0;i<r;++i)a[i]=255&t.charCodeAt(i);return a}function arrayByteLength(t){if(void 0!==t.length)return t.length;assert(void 0!==t.byteLength,"arrayByteLength - invalid argument.");return t.byteLength}var y={get value(){return shadow(this,"value",function isLittleEndian(){var t=new Uint8Array(4);t[0]=1;return 1===new Uint32Array(t.buffer,0,1)[0]}())}};r.IsLittleEndianCached=y;var b={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(t){return!1}}())}};r.IsEvalSupportedCached=b;var S=function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array(256).keys()).map((function(t){return t.toString(16).padStart(2,"0")})),w=function(){function Util(){_classCallCheck(this,Util)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(Util,null,[{key:"makeHexColor",value:function makeHexColor(t,r,a){return"#".concat(S[t]).concat(S[r]).concat(S[a])}},{key:"transform",value:function transform(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}},{key:"applyTransform",value:function applyTransform(t,r){return[t[0]*r[0]+t[1]*r[2]+r[4],t[0]*r[1]+t[1]*r[3]+r[5]]}},{key:"applyInverseTransform",value:function applyInverseTransform(t,r){var a=r[0]*r[3]-r[1]*r[2];return[(t[0]*r[3]-t[1]*r[2]+r[2]*r[5]-r[4]*r[3])/a,(-t[0]*r[1]+t[1]*r[0]+r[4]*r[1]-r[5]*r[0])/a]}},{key:"getAxialAlignedBoundingBox",value:function getAxialAlignedBoundingBox(t,r){var a=Util.applyTransform(t,r),i=Util.applyTransform(t.slice(2,4),r),o=Util.applyTransform([t[0],t[3]],r),l=Util.applyTransform([t[2],t[1]],r);return[Math.min(a[0],i[0],o[0],l[0]),Math.min(a[1],i[1],o[1],l[1]),Math.max(a[0],i[0],o[0],l[0]),Math.max(a[1],i[1],o[1],l[1])]}},{key:"inverseTransform",value:function inverseTransform(t){var r=t[0]*t[3]-t[1]*t[2];return[t[3]/r,-t[1]/r,-t[2]/r,t[0]/r,(t[2]*t[5]-t[4]*t[3])/r,(t[4]*t[1]-t[5]*t[0])/r]}},{key:"apply3dTransform",value:function apply3dTransform(t,r){return[t[0]*r[0]+t[1]*r[1]+t[2]*r[2],t[3]*r[0]+t[4]*r[1]+t[5]*r[2],t[6]*r[0]+t[7]*r[1]+t[8]*r[2]]}},{key:"singularValueDecompose2dScale",value:function singularValueDecompose2dScale(t){var r=[t[0],t[2],t[1],t[3]],a=t[0]*r[0]+t[1]*r[2],i=t[0]*r[1]+t[1]*r[3],o=t[2]*r[0]+t[3]*r[2],l=t[2]*r[1]+t[3]*r[3],u=(a+l)/2,c=Math.sqrt(Math.pow(a+l,2)-4*(a*l-o*i))/2,d=u+c||1,h=u-c||1;return[Math.sqrt(d),Math.sqrt(h)]}},{key:"normalizeRect",value:function normalizeRect(t){var r=t.slice(0);if(t[0]>t[2]){r[0]=t[2];r[2]=t[0]}if(t[1]>t[3]){r[1]=t[3];r[3]=t[1]}return r}},{key:"intersect",value:function intersect(t,r){function compare(t,r){return t-r}var a=[t[0],t[2],r[0],r[2]].sort(compare),i=[t[1],t[3],r[1],r[3]].sort(compare),o=[];t=Util.normalizeRect(t);r=Util.normalizeRect(r);if(!(a[0]===t[0]&&a[1]===r[0]||a[0]===r[0]&&a[1]===t[0]))return null;o[0]=a[1];o[2]=a[2];if(!(i[0]===t[1]&&i[1]===r[1]||i[0]===r[1]&&i[1]===t[1]))return null;o[1]=i[1];o[3]=i[2];return o}}]);return Util}();r.Util=w;var C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364]},(t,r,a)=>{"use strict";if("undefined"==typeof globalThis||!globalThis._pdfjsCompatibilityChecked){"undefined"!=typeof globalThis&&globalThis.Math===Math||(globalThis=a(6));globalThis._pdfjsCompatibilityChecked=!0;!function checkNodeBtoa(){globalThis.btoa}();!function checkNodeAtob(){globalThis.atob}();!function checkDOMMatrix(){globalThis.DOMMatrix}();!function checkObjectFromEntries(){Object.fromEntries||a(60)}();!function checkPromise(){globalThis.Promise.allSettled||(globalThis.Promise=a(88))}();!function checkReadableStream(){var t=!1;if("undefined"!=typeof ReadableStream)try{new ReadableStream({start:function start(t){t.close()}});t=!0}catch(t){}t||(globalThis.ReadableStream=a(116).ReadableStream)}()}},(t,r,a)=>{a(7);t.exports=a(9)},(t,r,a)=>{a(8)({global:!0},{globalThis:a(9)})},(t,r,a)=>{var i=a(9),o=a(10).f,l=a(39),u=a(42),c=a(33),d=a(48),h=a(58);t.exports=function(t,r){var a,p,m,g,v,y=t.target,b=t.global,S=t.stat;if(a=b?i:S?i[y]||c(y,{}):(i[y]||{}).prototype)for(p in r){g=r[p];m=t.noTargetGet?(v=o(a,p))&&v.value:a[p];if(!h(b?p:y+(S?".":"#")+p,t.forced)&&void 0!==m){if(typeof g==typeof m)continue;d(g,m)}(t.sham||m&&m.sham)&&l(g,"sham",!0);u(a,p,g,t)}}},t=>{var check=function(t){return t&&t.Math==Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||Function("return this")()},(t,r,a)=>{var i=a(11),o=a(13),l=a(14),u=a(15),c=a(19),d=a(34),h=a(37),p=Object.getOwnPropertyDescriptor;r.f=i?p:function getOwnPropertyDescriptor(t,r){t=u(t);r=c(r);if(h)try{return p(t,r)}catch(t){}if(d(t,r))return l(!o.f.call(t,r),t[r])}},(t,r,a)=>{var i=a(12);t.exports=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},(t,r)=>{"use strict";var a={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!a.call({1:2},1);r.f=o?function propertyIsEnumerable(t){var r=i(this,t);return!!r&&r.enumerable}:a},t=>{t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},(t,r,a)=>{var i=a(16),o=a(18);t.exports=function(t){return i(o(t))}},(t,r,a)=>{var i=a(12),o=a(17),l="".split;t.exports=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?l.call(t,""):Object(t)}:Object},t=>{var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},(t,r,a)=>{var i=a(20),o=a(22);t.exports=function(t){var r=i(t,"string");return o(r)?r:String(r)}},(t,r,a)=>{var i=a(21),o=a(22),l=a(28),u=a(29)("toPrimitive");t.exports=function(t,r){if(!i(t)||o(t))return t;var a,c=t[u];if(void 0!==c){void 0===r&&(r="default");a=c.call(t,r);if(!i(a)||o(a))return a;throw TypeError("Can't convert object to primitive value")}void 0===r&&(r="number");return l(t,r)}},t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},(t,r,a)=>{var i=a(23),o=a(24);t.exports=o?function(t){return"symbol"==typeof t}:function(t){var r=i("Symbol");return"function"==typeof r&&Object(t)instanceof r}},(t,r,a)=>{var i=a(9),aFunction=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,r){return arguments.length<2?aFunction(i[t]):i[t]&&i[t][r]}},(t,r,a)=>{var i=a(25);t.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(t,r,a)=>{var i=a(26),o=a(12);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},(t,r,a)=>{var i,o,l=a(9),u=a(27),c=l.process,d=l.Deno,h=c&&c.versions||d&&d.version,p=h&&h.v8;p?o=(i=p.split("."))[0]<4?1:i[0]+i[1]:u&&(!(i=u.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=u.match(/Chrome\/(\d+)/))&&(o=i[1]);t.exports=o&&+o},(t,r,a)=>{var i=a(23);t.exports=i("navigator","userAgent")||""},(t,r,a)=>{var i=a(21);t.exports=function(t,r){var a,o;if("string"===r&&"function"==typeof(a=t.toString)&&!i(o=a.call(t)))return o;if("function"==typeof(a=t.valueOf)&&!i(o=a.call(t)))return o;if("string"!==r&&"function"==typeof(a=t.toString)&&!i(o=a.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},(t,r,a)=>{var i=a(9),o=a(30),l=a(34),u=a(36),c=a(25),d=a(24),h=o("wks"),p=i.Symbol,m=d?p:p&&p.withoutSetter||u;t.exports=function(t){l(h,t)&&(c||"string"==typeof h[t])||(c&&l(p,t)?h[t]=p[t]:h[t]=m("Symbol."+t));return h[t]}},(t,r,a)=>{var i=a(31),o=a(32);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.17.3",mode:i?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},t=>{t.exports=!1},(t,r,a)=>{var i=a(9),o=a(33),l="__core-js_shared__",u=i[l]||o(l,{});t.exports=u},(t,r,a)=>{var i=a(9);t.exports=function(t,r){try{Object.defineProperty(i,t,{value:r,configurable:!0,writable:!0})}catch(a){i[t]=r}return r}},(t,r,a)=>{var i=a(35),o={}.hasOwnProperty;t.exports=Object.hasOwn||function hasOwn(t,r){return o.call(i(t),r)}},(t,r,a)=>{var i=a(18);t.exports=function(t){return Object(i(t))}},t=>{var r=0,a=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++r+a).toString(36)}},(t,r,a)=>{var i=a(11),o=a(12),l=a(38);t.exports=!i&&!o((function(){return 7!=Object.defineProperty(l("div"),"a",{get:function(){return 7}}).a}))},(t,r,a)=>{var i=a(9),o=a(21),l=i.document,u=o(l)&&o(l.createElement);t.exports=function(t){return u?l.createElement(t):{}}},(t,r,a)=>{var i=a(11),o=a(40),l=a(14);t.exports=i?function(t,r,a){return o.f(t,r,l(1,a))}:function(t,r,a){t[r]=a;return t}},(t,r,a)=>{var i=a(11),o=a(37),l=a(41),u=a(19),c=Object.defineProperty;r.f=i?c:function defineProperty(t,r,a){l(t);r=u(r);l(a);if(o)try{return c(t,r,a)}catch(t){}if("get"in a||"set"in a)throw TypeError("Accessors not supported");"value"in a&&(t[r]=a.value);return t}},(t,r,a)=>{var i=a(21);t.exports=function(t){if(!i(t))throw TypeError(String(t)+" is not an object");return t}},(t,r,a)=>{var i=a(9),o=a(39),l=a(34),u=a(33),c=a(43),d=a(44),h=d.get,p=d.enforce,m=String(String).split("String");(t.exports=function(t,r,a,c){var d,h=!!c&&!!c.unsafe,g=!!c&&!!c.enumerable,v=!!c&&!!c.noTargetGet;if("function"==typeof a){"string"!=typeof r||l(a,"name")||o(a,"name",r);(d=p(a)).source||(d.source=m.join("string"==typeof r?r:""))}if(t!==i){h?!v&&t[r]&&(g=!0):delete t[r];g?t[r]=a:o(t,r,a)}else g?t[r]=a:u(r,a)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&h(this).source||c(this)}))},(t,r,a)=>{var i=a(32),o=Function.toString;"function"!=typeof i.inspectSource&&(i.inspectSource=function(t){return o.call(t)});t.exports=i.inspectSource},(t,r,a)=>{var i,o,l,u=a(45),c=a(9),d=a(21),h=a(39),p=a(34),m=a(32),g=a(46),v=a(47),y="Object already initialized",b=c.WeakMap;if(u||m.state){var S=m.state||(m.state=new b),w=S.get,C=S.has,P=S.set;i=function(t,r){if(C.call(S,t))throw new TypeError(y);r.facade=t;P.call(S,t,r);return r};o=function(t){return w.call(S,t)||{}};l=function(t){return C.call(S,t)}}else{var k=g("state");v[k]=!0;i=function(t,r){if(p(t,k))throw new TypeError(y);r.facade=t;h(t,k,r);return r};o=function(t){return p(t,k)?t[k]:{}};l=function(t){return p(t,k)}}t.exports={set:i,get:o,has:l,enforce:function(t){return l(t)?o(t):i(t,{})},getterFor:function(t){return function(r){var a;if(!d(r)||(a=o(r)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return a}}}},(t,r,a)=>{var i=a(9),o=a(43),l=i.WeakMap;t.exports="function"==typeof l&&/native code/.test(o(l))},(t,r,a)=>{var i=a(30),o=a(36),l=i("keys");t.exports=function(t){return l[t]||(l[t]=o(t))}},t=>{t.exports={}},(t,r,a)=>{var i=a(34),o=a(49),l=a(10),u=a(40);t.exports=function(t,r){for(var a=o(r),c=u.f,d=l.f,h=0;h<a.length;h++){var p=a[h];i(t,p)||c(t,p,d(r,p))}}},(t,r,a)=>{var i=a(23),o=a(50),l=a(57),u=a(41);t.exports=i("Reflect","ownKeys")||function ownKeys(t){var r=o.f(u(t)),a=l.f;return a?r.concat(a(t)):r}},(t,r,a)=>{var i=a(51),o=a(56).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return i(t,o)}},(t,r,a)=>{var i=a(34),o=a(15),l=a(52).indexOf,u=a(47);t.exports=function(t,r){var a,c=o(t),d=0,h=[];for(a in c)!i(u,a)&&i(c,a)&&h.push(a);for(;r.length>d;)i(c,a=r[d++])&&(~l(h,a)||h.push(a));return h}},(t,r,a)=>{var i=a(15),o=a(53),l=a(55),createMethod=function(t){return function(r,a,u){var c,d=i(r),h=o(d.length),p=l(u,h);if(t&&a!=a){for(;h>p;)if((c=d[p++])!=c)return!0}else for(;h>p;p++)if((t||p in d)&&d[p]===a)return t||p||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(t,r,a)=>{var i=a(54),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},t=>{var r=Math.ceil,a=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?a:r)(t)}},(t,r,a)=>{var i=a(54),o=Math.max,l=Math.min;t.exports=function(t,r){var a=i(t);return a<0?o(a+r,0):l(a,r)}},t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(t,r)=>{r.f=Object.getOwnPropertySymbols},(t,r,a)=>{var i=a(12),o=/#|\.prototype\./,isForced=function(t,r){var a=u[l(t)];return a==d||a!=c&&("function"==typeof r?i(r):!!r)},l=isForced.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=isForced.data={},c=isForced.NATIVE="N",d=isForced.POLYFILL="P";t.exports=isForced},(t,r,a)=>{"use strict";var i,o,l;function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}l=function(){var t=function CSSMatrix(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];this.setIdentity();return t&&t.length&&this.setMatrixValue(t)},r={isIdentity:{configurable:!0},is2D:{configurable:!0}};r.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44};r.isIdentity.set=function(t){this.isIdentity=t};r.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44};r.is2D.set=function(t){this.is2D=t};Object.defineProperties(t.prototype,r);var a=t.prototype;function Translate(r,a,i){var o=new t;o.m41=r;o.e=r;o.m42=a;o.f=a;o.m43=i;return o}function Rotate(r,a,i){var o=new t,l=r*Math.PI/180,u=a*Math.PI/180,c=i*Math.PI/180,d=Math.cos(l),h=-Math.sin(l),p=Math.cos(u),m=-Math.sin(u),g=Math.cos(c),v=-Math.sin(c),y=p*g,b=-p*v;o.m11=y;o.a=y;o.m12=b;o.b=b;o.m13=m;var S=h*m*g+d*v;o.m21=S;o.c=S;var w=d*g-h*m*v;o.m22=w;o.d=w;o.m23=-h*p;o.m31=h*v-d*m*g;o.m32=h*g+d*m*v;o.m33=d*p;return o}function RotateAxisAngle(r,a,i,o){var l=new t,u=o*Math.PI/360,c=Math.sin(u),d=Math.cos(u),h=c*c,p=Math.sqrt(r*r+a*a+i*i),m=0,g=0,v=1;if(0!==p){m=r/p;g=a/p;v=i/p}var y=m*m,b=g*g,S=v*v,w=1-2*(b+S)*h;l.m11=w;l.a=w;var C=2*(r*a*h+i*c*d);l.m12=C;l.b=C;l.m13=2*(r*i*h-a*c*d);var P=2*(a*r*h-i*c*d);l.m21=P;l.c=P;var k=1-2*(S+y)*h;l.m22=k;l.d=k;l.m23=2*(a*i*h+r*c*d);l.m31=2*(i*r*h+a*c*d);l.m32=2*(i*a*h-r*c*d);l.m33=1-2*(y+b)*h;l.m14=0;l.m24=0;l.m34=0;l.m41=0;l.e=0;l.m42=0;l.f=0;l.m43=0;l.m44=1;return l}function Scale(r,a,i){var o=new t;o.m11=r;o.a=r;o.m22=a;o.d=a;o.m33=i;return o}function SkewX(r){var a=r*Math.PI/180,i=new t,o=Math.tan(a);i.m21=o;i.c=o;return i}function SkewY(r){var a=r*Math.PI/180,i=new t,o=Math.tan(a);i.m12=o;i.b=o;return i}function Multiply(r,a){var i=a.m11*r.m11+a.m12*r.m21+a.m13*r.m31+a.m14*r.m41,o=a.m11*r.m12+a.m12*r.m22+a.m13*r.m32+a.m14*r.m42,l=a.m11*r.m13+a.m12*r.m23+a.m13*r.m33+a.m14*r.m43,u=a.m11*r.m14+a.m12*r.m24+a.m13*r.m34+a.m14*r.m44,c=a.m21*r.m11+a.m22*r.m21+a.m23*r.m31+a.m24*r.m41,d=a.m21*r.m12+a.m22*r.m22+a.m23*r.m32+a.m24*r.m42,h=a.m21*r.m13+a.m22*r.m23+a.m23*r.m33+a.m24*r.m43,p=a.m21*r.m14+a.m22*r.m24+a.m23*r.m34+a.m24*r.m44,m=a.m31*r.m11+a.m32*r.m21+a.m33*r.m31+a.m34*r.m41,g=a.m31*r.m12+a.m32*r.m22+a.m33*r.m32+a.m34*r.m42,v=a.m31*r.m13+a.m32*r.m23+a.m33*r.m33+a.m34*r.m43,y=a.m31*r.m14+a.m32*r.m24+a.m33*r.m34+a.m34*r.m44,b=a.m41*r.m11+a.m42*r.m21+a.m43*r.m31+a.m44*r.m41,S=a.m41*r.m12+a.m42*r.m22+a.m43*r.m32+a.m44*r.m42,w=a.m41*r.m13+a.m42*r.m23+a.m43*r.m33+a.m44*r.m43,C=a.m41*r.m14+a.m42*r.m24+a.m43*r.m34+a.m44*r.m44;return new t([i,c,m,b,o,d,g,S,l,h,v,w,u,p,y,C])}function feedFromArray(t,r){var a=Array.from(r);if(16===a.length){var i=a[0],o=a[1],l=a[2],u=a[3],c=a[4],d=a[5],h=a[6],p=a[7],m=a[8],g=a[9],v=a[10],y=a[11],b=a[12],S=a[13],w=a[14],C=a[15];t.m11=i;t.a=i;t.m21=o;t.c=o;t.m31=l;t.m41=u;t.e=u;t.m12=c;t.b=c;t.m22=d;t.d=d;t.m32=h;t.m42=p;t.f=p;t.m13=m;t.m23=g;t.m33=v;t.m43=y;t.m14=b;t.m24=S;t.m34=w;t.m44=C}else{if(6!==a.length)throw new TypeError("CSSMatrix: expecting a 6/16 values Array");var P=a[0],k=a[1],R=a[2],A=a[3],x=a[4],T=a[5];t.m11=P;t.a=P;t.m12=k;t.b=k;t.m21=R;t.c=R;t.m22=A;t.d=A;t.m14=x;t.e=x;t.m24=T;t.f=T}return t}a.setMatrixValue=function setMatrixValue(r){var a=this;if(!r||!r.length)return a;if(r.length&&"string"==typeof r[0]&&r[0].length){var i,o,l=String(r[0]).trim();if("none"===l)return a;i=l.slice(0,l.indexOf("("));o=l.slice("matrix"===i?7:9,-1).split(",").map((function(t){return Math.abs(t)<1e-6?0:+t}));if(!([6,16].indexOf(o.length)>-1))throw new TypeError("CSSMatrix: expecting valid CSS matrix() / matrix3d() syntax");feedFromArray(a,o)}else r[0]instanceof t?feedFromArray(a,r[0].toArray()):Array.isArray(r[0])?feedFromArray(a,r[0]):Array.isArray(r)&&feedFromArray(a,r);return a};a.toString=function toString(){return(this.is2D?"matrix":"matrix3d")+"("+this.toArray(1).join(",")+")"};a.toArray=function toArray(t){var r=this;return r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:t?[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44]:[r.m11,r.m21,r.m31,r.m41,r.m12,r.m22,r.m32,r.m42,r.m13,r.m23,r.m33,r.m43,r.m14,r.m24,r.m34,r.m44]};a.multiply=function multiply(t){return Multiply(this,t)};a.translate=function translate(t,r,a){var i=r,o=a;null==o&&(o=0);null==i&&(i=0);return Multiply(this,Translate(t,i,o))};a.scale=function scale(t,r,a){var i=r,o=a;null==i&&(i=t);null==o&&(o=t);return Multiply(this,Scale(t,i,o))};a.rotate=function rotate(t,r,a){var i=t,o=r,l=a;null==o&&(o=0);if(null==l){l=i;i=0}return Multiply(this,Rotate(i,o,l))};a.rotateAxisAngle=function rotateAxisAngle(t,r,a,i){if(4!==arguments.length)throw new TypeError("CSSMatrix: expecting 4 values");return Multiply(this,RotateAxisAngle(t,r,a,i))};a.skewX=function skewX(t){return Multiply(this,SkewX(t))};a.skewY=function skewY(t){return Multiply(this,SkewY(t))};a.setIdentity=function setIdentity(){return feedFromArray(this,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};a.transformPoint=function transformPoint(t){var r=Translate(t.x,t.y,t.z);r.m44=t.w||1;return{x:(r=this.multiply(r)).m41,y:r.m42,z:r.m43,w:r.m44}};a.transform=function transform(t){var r=this,a=r.m11*t.x+r.m12*t.y+r.m13*t.z+r.m14*t.w,i=r.m21*t.x+r.m22*t.y+r.m23*t.z+r.m24*t.w,o=r.m31*t.x+r.m32*t.y+r.m33*t.z+r.m34*t.w,l=r.m41*t.x+r.m42*t.y+r.m43*t.z+r.m44*t.w;return{x:a/l,y:i/l,z:o/l,w:l}};t.Translate=Translate;t.Rotate=Rotate;t.RotateAxisAngle=RotateAxisAngle;t.Scale=Scale;t.SkewX=SkewX;t.SkewY=SkewY;t.Multiply=Multiply;t.fromMatrix=function fromMatrix(r){return new t([r.m11,r.m21,r.m31,r.m41,r.m12,r.m22,r.m32,r.m42,r.m13,r.m23,r.m33,r.m43,r.m14,r.m24,r.m34,r.m44])};t.fromArray=function fromArray(r){return feedFromArray(new t,r)};t.feedFromArray=feedFromArray;return t},"object"===_typeof(r)?t.exports=l():void 0!==(o="function"==typeof(i=l)?i.call(r,a,r,t):i)&&(t.exports=o)},(t,r,a)=>{a(61);a(76);var i=a(87);t.exports=i.Object.fromEntries},(t,r,a)=>{"use strict";var i=a(15),o=a(62),l=a(67),u=a(44),c=a(68),d="Array Iterator",h=u.set,p=u.getterFor(d);t.exports=c(Array,"Array",(function(t,r){h(this,{type:d,target:i(t),index:0,kind:r})}),(function(){var t=p(this),r=t.target,a=t.kind,i=t.index++;if(!r||i>=r.length){t.target=void 0;return{value:void 0,done:!0}}return"keys"==a?{value:i,done:!1}:"values"==a?{value:r[i],done:!1}:{value:[i,r[i]],done:!1}}),"values");l.Arguments=l.Array;o("keys");o("values");o("entries")},(t,r,a)=>{var i=a(29),o=a(63),l=a(40),u=i("unscopables"),c=Array.prototype;null==c[u]&&l.f(c,u,{configurable:!0,value:o(null)});t.exports=function(t){c[u][t]=!0}},(t,r,a)=>{var i,o=a(41),l=a(64),u=a(56),c=a(47),d=a(66),h=a(38),p=a(46),m=p("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag(""));t.close();var r=t.parentWindow.Object;t=null;return r},NullProtoObject=function(){try{i=new ActiveXObject("htmlfile")}catch(t){}NullProtoObject="undefined"!=typeof document?document.domain&&i?NullProtoObjectViaActiveX(i):function(){var t,r=h("iframe");r.style.display="none";d.appendChild(r);r.src=String("javascript:");(t=r.contentWindow.document).open();t.write(scriptTag("document.F=Object"));t.close();return t.F}():NullProtoObjectViaActiveX(i);for(var t=u.length;t--;)delete NullProtoObject.prototype[u[t]];return NullProtoObject()};c[m]=!0;t.exports=Object.create||function create(t,r){var a;if(null!==t){EmptyConstructor.prototype=o(t);a=new EmptyConstructor;EmptyConstructor.prototype=null;a[m]=t}else a=NullProtoObject();return void 0===r?a:l(a,r)}},(t,r,a)=>{var i=a(11),o=a(40),l=a(41),u=a(65);t.exports=i?Object.defineProperties:function defineProperties(t,r){l(t);for(var a,i=u(r),c=i.length,d=0;c>d;)o.f(t,a=i[d++],r[a]);return t}},(t,r,a)=>{var i=a(51),o=a(56);t.exports=Object.keys||function keys(t){return i(t,o)}},(t,r,a)=>{var i=a(23);t.exports=i("document","documentElement")},t=>{t.exports={}},(t,r,a)=>{"use strict";var i=a(8),o=a(69),l=a(71),u=a(74),c=a(73),d=a(39),h=a(42),p=a(29),m=a(31),g=a(67),v=a(70),y=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,S=p("iterator"),w="keys",C="values",P="entries",returnThis=function(){return this};t.exports=function(t,r,a,p,v,k,R){o(a,r,p);var A,x,T,getIterationMethod=function(t){if(t===v&&L)return L;if(!b&&t in O)return O[t];switch(t){case w:return function keys(){return new a(this,t)};case C:return function values(){return new a(this,t)};case P:return function entries(){return new a(this,t)}}return function(){return new a(this)}},E=r+" Iterator",I=!1,O=t.prototype,D=O[S]||O["@@iterator"]||v&&O[v],L=!b&&D||getIterationMethod(v),M="Array"==r&&O.entries||D;if(M&&(A=l(M.call(new t)))!==Object.prototype&&A.next){m||l(A)===y||(u?u(A,y):"function"!=typeof A[S]&&d(A,S,returnThis));c(A,E,!0,!0);m&&(g[E]=returnThis)}if(v==C&&D&&D.name!==C){I=!0;L=function values(){return D.call(this)}}m&&!R||O[S]===L||d(O,S,L);g[r]=L;if(v){x={values:getIterationMethod(C),keys:k?L:getIterationMethod(w),entries:getIterationMethod(P)};if(R)for(T in x)(b||I||!(T in O))&&h(O,T,x[T]);else i({target:r,proto:!0,forced:b||I},x)}return x}},(t,r,a)=>{"use strict";var i=a(70).IteratorPrototype,o=a(63),l=a(14),u=a(73),c=a(67),returnThis=function(){return this};t.exports=function(t,r,a){var d=r+" Iterator";t.prototype=o(i,{next:l(1,a)});u(t,d,!1,!0);c[d]=returnThis;return t}},(t,r,a)=>{"use strict";var i,o,l,u=a(12),c=a(63),d=a(71),h=a(39),p=a(29),m=a(31),g=p("iterator"),v=!1;[].keys&&("next"in(l=[].keys())?(o=d(d(l)))!==Object.prototype&&(i=o):v=!0);null==i||u((function(){var t={};return i[g].call(t)!==t}))?i={}:m&&(i=c(i));"function"!=typeof i[g]&&h(i,g,(function(){return this}));t.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:v}},(t,r,a)=>{var i=a(34),o=a(35),l=a(46),u=a(72),c=l("IE_PROTO"),d=Object.prototype;t.exports=u?Object.getPrototypeOf:function(t){t=o(t);return i(t,c)?t[c]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?d:null}},(t,r,a)=>{var i=a(12);t.exports=!i((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(t,r,a)=>{var i=a(40).f,o=a(34),l=a(29)("toStringTag");t.exports=function(t,r,a){t&&!o(t=a?t:t.prototype,l)&&i(t,l,{configurable:!0,value:r})}},(t,r,a)=>{var i=a(41),o=a(75);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,a={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(a,[]);r=a instanceof Array}catch(t){}return function setPrototypeOf(a,l){i(a);o(l);r?t.call(a,l):a.__proto__=l;return a}}():void 0)},(t,r,a)=>{var i=a(21);t.exports=function(t){if(!i(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},(t,r,a)=>{var i=a(8),o=a(77),l=a(86);i({target:"Object",stat:!0},{fromEntries:function fromEntries(t){var r={};o(t,(function(t,a){l(r,t,a)}),{AS_ENTRIES:!0});return r}})},(t,r,a)=>{var i=a(41),o=a(78),l=a(53),u=a(79),c=a(81),d=a(82),h=a(85),Result=function(t,r){this.stopped=t;this.result=r};t.exports=function(t,r,a){var p,m,g,v,y,b,S,w=a&&a.that,C=!(!a||!a.AS_ENTRIES),P=!(!a||!a.IS_ITERATOR),k=!(!a||!a.INTERRUPTED),R=u(r,w,1+C+k),stop=function(t){p&&h(p,"normal",t);return new Result(!0,t)},callFn=function(t){if(C){i(t);return k?R(t[0],t[1],stop):R(t[0],t[1])}return k?R(t,stop):R(t)};if(P)p=t;else{if("function"!=typeof(m=d(t)))throw TypeError("Target is not iterable");if(o(m)){for(g=0,v=l(t.length);v>g;g++)if((y=callFn(t[g]))&&y instanceof Result)return y;return new Result(!1)}p=c(t,m)}b=p.next;for(;!(S=b.call(p)).done;){try{y=callFn(S.value)}catch(t){h(p,"throw",t)}if("object"==typeof y&&y&&y instanceof Result)return y}return new Result(!1)}},(t,r,a)=>{var i=a(29),o=a(67),l=i("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||u[l]===t)}},(t,r,a)=>{var i=a(80);t.exports=function(t,r,a){i(t);if(void 0===r)return t;switch(a){case 0:return function(){return t.call(r)};case 1:return function(a){return t.call(r,a)};case 2:return function(a,i){return t.call(r,a,i)};case 3:return function(a,i,o){return t.call(r,a,i,o)}}return function(){return t.apply(r,arguments)}}},t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},(t,r,a)=>{var i=a(41),o=a(82);t.exports=function(t,r){var a=arguments.length<2?o(t):r;if("function"!=typeof a)throw TypeError(String(t)+" is not iterable");return i(a.call(t))}},(t,r,a)=>{var i=a(83),o=a(67),l=a(29)("iterator");t.exports=function(t){if(null!=t)return t[l]||t["@@iterator"]||o[i(t)]}},(t,r,a)=>{var i=a(84),o=a(17),l=a(29)("toStringTag"),u="Arguments"==o(function(){return arguments}());t.exports=i?o:function(t){var r,a,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(a=function(t,r){try{return t[r]}catch(t){}}(r=Object(t),l))?a:u?o(r):"Object"==(i=o(r))&&"function"==typeof r.callee?"Arguments":i}},(t,r,a)=>{var i={};i[a(29)("toStringTag")]="z";t.exports="[object z]"===String(i)},(t,r,a)=>{var i=a(41);t.exports=function(t,r,a){var o,l;i(t);try{if(void 0===(o=t.return)){if("throw"===r)throw a;return a}o=o.call(t)}catch(t){l=!0;o=t}if("throw"===r)throw a;if(l)throw o;i(o);return a}},(t,r,a)=>{"use strict";var i=a(19),o=a(40),l=a(14);t.exports=function(t,r,a){var u=i(r);u in t?o.f(t,u,l(0,a)):t[u]=a}},(t,r,a)=>{var i=a(9);t.exports=i},(t,r,a)=>{a(89);a(61);a(91);a(93);a(111);a(112);a(113);a(114);var i=a(87);t.exports=i.Promise},(t,r,a)=>{"use strict";var i=a(8),o=a(71),l=a(74),u=a(63),c=a(39),d=a(14),h=a(77),p=a(90),m=function AggregateError(t,r){var a=this;if(!(a instanceof m))return new m(t,r);l&&(a=l(new Error(void 0),o(a)));void 0!==r&&c(a,"message",p(r));var i=[];h(t,i.push,{that:i});c(a,"errors",i);return a};m.prototype=u(Error.prototype,{constructor:d(5,m),message:d(5,""),name:d(5,"AggregateError")});i({global:!0},{AggregateError:m})},(t,r,a)=>{var i=a(22);t.exports=function(t){if(i(t))throw TypeError("Cannot convert a Symbol value to a string");return String(t)}},(t,r,a)=>{var i=a(84),o=a(42),l=a(92);i||o(Object.prototype,"toString",l,{unsafe:!0})},(t,r,a)=>{"use strict";var i=a(84),o=a(83);t.exports=i?{}.toString:function toString(){return"[object "+o(this)+"]"}},(t,r,a)=>{"use strict";var i,o,l,u,c=a(8),d=a(31),h=a(9),p=a(23),m=a(94),g=a(42),v=a(95),y=a(74),b=a(73),S=a(96),w=a(21),C=a(80),P=a(97),k=a(43),R=a(77),A=a(98),x=a(99),T=a(100).set,E=a(103),I=a(106),O=a(108),D=a(107),L=a(109),M=a(44),B=a(58),W=a(29),N=a(110),j=a(102),V=a(26),U=W("species"),q="Promise",z=M.get,H=M.set,G=M.getterFor(q),Y=m&&m.prototype,Q=m,X=Y,K=h.TypeError,$=h.document,J=h.process,Z=D.f,ee=Z,te=!!($&&$.createEvent&&h.dispatchEvent),re="function"==typeof PromiseRejectionEvent,ne="unhandledrejection",ae=!1,ie=B(q,(function(){var t=k(Q),r=t!==String(Q);if(!r&&66===V)return!0;if(d&&!X.finally)return!0;if(V>=51&&/native code/.test(t))return!1;var a=new Q((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};(a.constructor={})[U]=FakePromise;return!(ae=a.then((function(){}))instanceof FakePromise)||!r&&N&&!re})),oe=ie||!A((function(t){Q.all(t).catch((function(){}))})),isThenable=function(t){var r;return!(!w(t)||"function"!=typeof(r=t.then))&&r},notify=function(t,r){if(!t.notified){t.notified=!0;var a=t.reactions;E((function(){for(var i=t.value,o=1==t.state,l=0;a.length>l;){var u,c,d,h=a[l++],p=o?h.ok:h.fail,m=h.resolve,g=h.reject,v=h.domain;try{if(p){if(!o){2===t.rejection&&onHandleUnhandled(t);t.rejection=1}if(!0===p)u=i;else{v&&v.enter();u=p(i);if(v){v.exit();d=!0}}u===h.promise?g(K("Promise-chain cycle")):(c=isThenable(u))?c.call(u,m,g):m(u)}else g(i)}catch(t){v&&!d&&v.exit();g(t)}}t.reactions=[];t.notified=!1;r&&!t.rejection&&onUnhandled(t)}))}},dispatchEvent=function(t,r,a){var i,o;if(te){(i=$.createEvent("Event")).promise=r;i.reason=a;i.initEvent(t,!1,!0);h.dispatchEvent(i)}else i={promise:r,reason:a};!re&&(o=h["on"+t])?o(i):t===ne&&O("Unhandled promise rejection",a)},onUnhandled=function(t){T.call(h,(function(){var r,a=t.facade,i=t.value;if(isUnhandled(t)){r=L((function(){j?J.emit("unhandledRejection",i,a):dispatchEvent(ne,a,i)}));t.rejection=j||isUnhandled(t)?2:1;if(r.error)throw r.value}}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){T.call(h,(function(){var r=t.facade;j?J.emit("rejectionHandled",r):dispatchEvent("rejectionhandled",r,t.value)}))},bind=function(t,r,a){return function(i){t(r,i,a)}},internalReject=function(t,r,a){if(!t.done){t.done=!0;a&&(t=a);t.value=r;t.state=2;notify(t,!0)}},internalResolve=function(t,r,a){if(!t.done){t.done=!0;a&&(t=a);try{if(t.facade===r)throw K("Promise can't be resolved itself");var i=isThenable(r);if(i)E((function(){var a={done:!1};try{i.call(r,bind(internalResolve,a,t),bind(internalReject,a,t))}catch(r){internalReject(a,r,t)}}));else{t.value=r;t.state=1;notify(t,!1)}}catch(r){internalReject({done:!1},r,t)}}};if(ie){X=(Q=function Promise(t){P(this,Q,q);C(t);i.call(this);var r=z(this);try{t(bind(internalResolve,r),bind(internalReject,r))}catch(t){internalReject(r,t)}}).prototype;(i=function Promise(t){H(this,{type:q,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=v(X,{then:function then(t,r){var a=G(this),i=Z(x(this,Q));i.ok="function"!=typeof t||t;i.fail="function"==typeof r&&r;i.domain=j?J.domain:void 0;a.parent=!0;a.reactions.push(i);0!=a.state&¬ify(a,!1);return i.promise},catch:function(t){return this.then(void 0,t)}});o=function(){var t=new i,r=z(t);this.promise=t;this.resolve=bind(internalResolve,r);this.reject=bind(internalReject,r)};D.f=Z=function(t){return t===Q||t===l?new o(t):ee(t)};if(!d&&"function"==typeof m&&Y!==Object.prototype){u=Y.then;if(!ae){g(Y,"then",(function then(t,r){var a=this;return new Q((function(t,r){u.call(a,t,r)})).then(t,r)}),{unsafe:!0});g(Y,"catch",X.catch,{unsafe:!0})}try{delete Y.constructor}catch(t){}y&&y(Y,X)}}c({global:!0,wrap:!0,forced:ie},{Promise:Q});b(Q,q,!1,!0);S(q);l=p(q);c({target:q,stat:!0,forced:ie},{reject:function reject(t){var r=Z(this);r.reject.call(void 0,t);return r.promise}});c({target:q,stat:!0,forced:d||ie},{resolve:function resolve(t){return I(d&&this===l?Q:this,t)}});c({target:q,stat:!0,forced:oe},{all:function all(t){var r=this,a=Z(r),i=a.resolve,o=a.reject,l=L((function(){var a=C(r.resolve),l=[],u=0,c=1;R(t,(function(t){var d=u++,h=!1;l.push(void 0);c++;a.call(r,t).then((function(t){if(!h){h=!0;l[d]=t;--c||i(l)}}),o)}));--c||i(l)}));l.error&&o(l.value);return a.promise},race:function race(t){var r=this,a=Z(r),i=a.reject,o=L((function(){var o=C(r.resolve);R(t,(function(t){o.call(r,t).then(a.resolve,i)}))}));o.error&&i(o.value);return a.promise}})},(t,r,a)=>{var i=a(9);t.exports=i.Promise},(t,r,a)=>{var i=a(42);t.exports=function(t,r,a){for(var o in r)i(t,o,r[o],a);return t}},(t,r,a)=>{"use strict";var i=a(23),o=a(40),l=a(29),u=a(11),c=l("species");t.exports=function(t){var r=i(t),a=o.f;u&&r&&!r[c]&&a(r,c,{configurable:!0,get:function(){return this}})}},t=>{t.exports=function(t,r,a){if(!(t instanceof r))throw TypeError("Incorrect "+(a?a+" ":"")+"invocation");return t}},(t,r,a)=>{var i=a(29)("iterator"),o=!1;try{var l=0,u={next:function(){return{done:!!l++}},return:function(){o=!0}};u[i]=function(){return this};Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,r){if(!r&&!o)return!1;var a=!1;try{var l={};l[i]=function(){return{next:function(){return{done:a=!0}}}};t(l)}catch(t){}return a}},(t,r,a)=>{var i=a(41),o=a(80),l=a(29)("species");t.exports=function(t,r){var a,u=i(t).constructor;return void 0===u||null==(a=i(u)[l])?r:o(a)}},(t,r,a)=>{var i,o,l,u,c=a(9),d=a(12),h=a(79),p=a(66),m=a(38),g=a(101),v=a(102),y=c.setImmediate,b=c.clearImmediate,S=c.process,w=c.MessageChannel,C=c.Dispatch,P=0,k={},R="onreadystatechange";try{i=c.location}catch(t){}var run=function(t){if(k.hasOwnProperty(t)){var r=k[t];delete k[t];r()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){c.postMessage(String(t),i.protocol+"//"+i.host)};if(!y||!b){y=function setImmediate(t){for(var r=[],a=arguments.length,i=1;a>i;)r.push(arguments[i++]);k[++P]=function(){("function"==typeof t?t:Function(t)).apply(void 0,r)};o(P);return P};b=function clearImmediate(t){delete k[t]};if(v)o=function(t){S.nextTick(runner(t))};else if(C&&C.now)o=function(t){C.now(runner(t))};else if(w&&!g){u=(l=new w).port2;l.port1.onmessage=listener;o=h(u.postMessage,u,1)}else if(c.addEventListener&&"function"==typeof postMessage&&!c.importScripts&&i&&"file:"!==i.protocol&&!d(post)){o=post;c.addEventListener("message",listener,!1)}else o=R in m("script")?function(t){p.appendChild(m("script")).onreadystatechange=function(){p.removeChild(this);run(t)}}:function(t){setTimeout(runner(t),0)}}t.exports={set:y,clear:b}},(t,r,a)=>{var i=a(27);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(i)},(t,r,a)=>{var i=a(17),o=a(9);t.exports="process"==i(o.process)},(t,r,a)=>{var i,o,l,u,c,d,h,p,m=a(9),g=a(10).f,v=a(100).set,y=a(101),b=a(104),S=a(105),w=a(102),C=m.MutationObserver||m.WebKitMutationObserver,P=m.document,k=m.process,R=m.Promise,A=g(m,"queueMicrotask"),x=A&&A.value;if(!x){i=function(){var t,r;w&&(t=k.domain)&&t.exit();for(;o;){r=o.fn;o=o.next;try{r()}catch(t){o?u():l=void 0;throw t}}l=void 0;t&&t.enter()};if(y||w||S||!C||!P)if(!b&&R&&R.resolve){(h=R.resolve(void 0)).constructor=R;p=h.then;u=function(){p.call(h,i)}}else u=w?function(){k.nextTick(i)}:function(){v.call(m,i)};else{c=!0;d=P.createTextNode("");new C(i).observe(d,{characterData:!0});u=function(){d.data=c=!c}}}t.exports=x||function(t){var r={fn:t,next:void 0};l&&(l.next=r);if(!o){o=r;u()}l=r}},(t,r,a)=>{var i=a(27),o=a(9);t.exports=/ipad|iphone|ipod/i.test(i)&&void 0!==o.Pebble},(t,r,a)=>{var i=a(27);t.exports=/web0s(?!.*chrome)/i.test(i)},(t,r,a)=>{var i=a(41),o=a(21),l=a(107);t.exports=function(t,r){i(t);if(o(r)&&r.constructor===t)return r;var a=l.f(t);(0,a.resolve)(r);return a.promise}},(t,r,a)=>{"use strict";var i=a(80),PromiseCapability=function(t){var r,a;this.promise=new t((function(t,i){if(void 0!==r||void 0!==a)throw TypeError("Bad Promise constructor");r=t;a=i}));this.resolve=i(r);this.reject=i(a)};t.exports.f=function(t){return new PromiseCapability(t)}},(t,r,a)=>{var i=a(9);t.exports=function(t,r){var a=i.console;a&&a.error&&(1===arguments.length?a.error(t):a.error(t,r))}},t=>{t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},t=>{t.exports="object"==typeof window},(t,r,a)=>{"use strict";var i=a(8),o=a(80),l=a(107),u=a(109),c=a(77);i({target:"Promise",stat:!0},{allSettled:function allSettled(t){var r=this,a=l.f(r),i=a.resolve,d=a.reject,h=u((function(){var a=o(r.resolve),l=[],u=0,d=1;c(t,(function(t){var o=u++,c=!1;l.push(void 0);d++;a.call(r,t).then((function(t){if(!c){c=!0;l[o]={status:"fulfilled",value:t};--d||i(l)}}),(function(t){if(!c){c=!0;l[o]={status:"rejected",reason:t};--d||i(l)}}))}));--d||i(l)}));h.error&&d(h.value);return a.promise}})},(t,r,a)=>{"use strict";var i=a(8),o=a(80),l=a(23),u=a(107),c=a(109),d=a(77),h="No one promise resolved";i({target:"Promise",stat:!0},{any:function any(t){var r=this,a=u.f(r),i=a.resolve,p=a.reject,m=c((function(){var a=o(r.resolve),u=[],c=0,m=1,g=!1;d(t,(function(t){var o=c++,d=!1;u.push(void 0);m++;a.call(r,t).then((function(t){if(!d&&!g){g=!0;i(t)}}),(function(t){if(!d&&!g){d=!0;u[o]=t;--m||p(new(l("AggregateError"))(u,h))}}))}));--m||p(new(l("AggregateError"))(u,h))}));m.error&&p(m.value);return a.promise}})},(t,r,a)=>{"use strict";var i=a(8),o=a(31),l=a(94),u=a(12),c=a(23),d=a(99),h=a(106),p=a(42);i({target:"Promise",proto:!0,real:!0,forced:!!l&&u((function(){l.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var r=d(this,c("Promise")),a="function"==typeof t;return this.then(a?function(a){return h(r,t()).then((function(){return a}))}:t,a?function(a){return h(r,t()).then((function(){throw a}))}:t)}});if(!o&&"function"==typeof l){var m=c("Promise").prototype.finally;l.prototype.finally!==m&&p(l.prototype,"finally",m,{unsafe:!0})}},(t,r,a)=>{"use strict";var i=a(115).charAt,o=a(90),l=a(44),u=a(68),c="String Iterator",d=l.set,h=l.getterFor(c);u(String,"String",(function(t){d(this,{type:c,string:o(t),index:0})}),(function next(){var t,r=h(this),a=r.string,o=r.index;if(o>=a.length)return{value:void 0,done:!0};t=i(a,o);r.index+=t.length;return{value:t,done:!1}}))},(t,r,a)=>{var i=a(54),o=a(90),l=a(18),createMethod=function(t){return function(r,a){var u,c,d=o(l(r)),h=i(a),p=d.length;return h<0||h>=p?t?"":void 0:(u=d.charCodeAt(h))<55296||u>56319||h+1===p||(c=d.charCodeAt(h+1))<56320||c>57343?t?d.charAt(h):u:t?d.slice(h,h+2):c-56320+(u-55296<<10)+65536}};t.exports={codeAt:createMethod(!1),charAt:createMethod(!0)}},function(t,r){a=function(t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(t){return"Symbol("+t+")"};function noop(){}var a=function getGlobals(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0}();function typeIsObject(t){return"object"==typeof t&&null!==t||"function"==typeof t}var i=noop,o=Promise,l=Promise.prototype.then,u=Promise.resolve.bind(o),c=Promise.reject.bind(o);function newPromise(t){return new o(t)}function promiseResolvedWith(t){return u(t)}function promiseRejectedWith(t){return c(t)}function PerformPromiseThen(t,r,a){return l.call(t,r,a)}function uponPromise(t,r,a){PerformPromiseThen(PerformPromiseThen(t,r,a),void 0,i)}function uponFulfillment(t,r){uponPromise(t,r)}function uponRejection(t,r){uponPromise(t,void 0,r)}function transformPromiseWith(t,r,a){return PerformPromiseThen(t,r,a)}function setPromiseIsHandledToTrue(t){PerformPromiseThen(t,void 0,i)}var d=function(){var t=a&&a.queueMicrotask;if("function"==typeof t)return t;var r=promiseResolvedWith(void 0);return function(t){return PerformPromiseThen(r,t)}}();function reflectCall(t,r,a){if("function"!=typeof t)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(t,r,a)}function promiseCall(t,r,a){try{return promiseResolvedWith(reflectCall(t,r,a))}catch(t){return promiseRejectedWith(t)}}var h=function(){function SimpleQueue(){this._cursor=0;this._size=0;this._front={_elements:[],_next:void 0};this._back=this._front;this._cursor=0;this._size=0}Object.defineProperty(SimpleQueue.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0});SimpleQueue.prototype.push=function(t){var r=this._back,a=r;16383===r._elements.length&&(a={_elements:[],_next:void 0});r._elements.push(t);if(a!==r){this._back=a;r._next=a}++this._size};SimpleQueue.prototype.shift=function(){var t=this._front,r=t,a=this._cursor,i=a+1,o=t._elements,l=o[a];if(16384===i){r=t._next;i=0}--this._size;this._cursor=i;t!==r&&(this._front=r);o[a]=void 0;return l};SimpleQueue.prototype.forEach=function(t){for(var r=this._cursor,a=this._front,i=a._elements;r!==i.length||void 0!==a._next;){if(r===i.length){r=0;if(0===(i=(a=a._next)._elements).length)break}t(i[r]);++r}};SimpleQueue.prototype.peek=function(){var t=this._front,r=this._cursor;return t._elements[r]};return SimpleQueue}();function ReadableStreamReaderGenericInitialize(t,r){t._ownerReadableStream=r;r._reader=t;"readable"===r._state?defaultReaderClosedPromiseInitialize(t):"closed"===r._state?function defaultReaderClosedPromiseInitializeAsResolved(t){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseResolve(t)}(t):defaultReaderClosedPromiseInitializeAsRejected(t,r._storedError)}function ReadableStreamReaderGenericCancel(t,r){return ReadableStreamCancel(t._ownerReadableStream,r)}function ReadableStreamReaderGenericRelease(t){"readable"===t._ownerReadableStream._state?defaultReaderClosedPromiseReject(t,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function defaultReaderClosedPromiseResetToRejected(t,r){defaultReaderClosedPromiseInitializeAsRejected(t,r)}(t,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));t._ownerReadableStream._reader=void 0;t._ownerReadableStream=void 0}function readerLockException(t){return new TypeError("Cannot "+t+" a stream using a released reader")}function defaultReaderClosedPromiseInitialize(t){t._closedPromise=newPromise((function(r,a){t._closedPromise_resolve=r;t._closedPromise_reject=a}))}function defaultReaderClosedPromiseInitializeAsRejected(t,r){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseReject(t,r)}function defaultReaderClosedPromiseReject(t,r){if(void 0!==t._closedPromise_reject){setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0}}function defaultReaderClosedPromiseResolve(t){if(void 0!==t._closedPromise_resolve){t._closedPromise_resolve(void 0);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0}}var p=r("[[AbortSteps]]"),m=r("[[ErrorSteps]]"),g=r("[[CancelSteps]]"),v=r("[[PullSteps]]"),y=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},b=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function assertDictionary(t,r){if(void 0!==t&&!function isDictionary(t){return"object"==typeof t||"function"==typeof t}(t))throw new TypeError(r+" is not an object.")}function assertFunction(t,r){if("function"!=typeof t)throw new TypeError(r+" is not a function.")}function assertObject(t,r){if(!function isObject(t){return"object"==typeof t&&null!==t||"function"==typeof t}(t))throw new TypeError(r+" is not an object.")}function assertRequiredArgument(t,r,a){if(void 0===t)throw new TypeError("Parameter "+r+" is required in '"+a+"'.")}function assertRequiredField(t,r,a){if(void 0===t)throw new TypeError(r+" is required in '"+a+"'.")}function convertUnrestrictedDouble(t){return Number(t)}function censorNegativeZero(t){return 0===t?0:t}function convertUnsignedLongLongWithEnforceRange(t,r){var a=Number.MAX_SAFE_INTEGER,i=Number(t);i=censorNegativeZero(i);if(!y(i))throw new TypeError(r+" is not a finite number");if((i=function integerPart(t){return censorNegativeZero(b(t))}(i))<0||i>a)throw new TypeError(r+" is outside the accepted range of 0 to "+a+", inclusive");return y(i)&&0!==i?i:0}function assertReadableStream(t,r){if(!IsReadableStream(t))throw new TypeError(r+" is not a ReadableStream.")}function AcquireReadableStreamDefaultReader(t){return new C(t)}function ReadableStreamAddReadRequest(t,r){t._reader._readRequests.push(r)}function ReadableStreamFulfillReadRequest(t,r,a){var i=t._reader._readRequests.shift();a?i._closeSteps():i._chunkSteps(r)}function ReadableStreamGetNumReadRequests(t){return t._reader._readRequests.length}function ReadableStreamHasDefaultReader(t){var r=t._reader;return void 0!==r&&!!IsReadableStreamDefaultReader(r)}var S,w,C=function(){function ReadableStreamDefaultReader(t){assertRequiredArgument(t,1,"ReadableStreamDefaultReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ReadableStreamReaderGenericInitialize(this,t);this._readRequests=new h}Object.defineProperty(ReadableStreamDefaultReader.prototype,"closed",{get:function(){return IsReadableStreamDefaultReader(this)?this._closedPromise:promiseRejectedWith(defaultReaderBrandCheckException("closed"))},enumerable:!1,configurable:!0});ReadableStreamDefaultReader.prototype.cancel=function(t){void 0===t&&(t=void 0);return IsReadableStreamDefaultReader(this)?void 0===this._ownerReadableStream?promiseRejectedWith(readerLockException("cancel")):ReadableStreamReaderGenericCancel(this,t):promiseRejectedWith(defaultReaderBrandCheckException("cancel"))};ReadableStreamDefaultReader.prototype.read=function(){if(!IsReadableStreamDefaultReader(this))return promiseRejectedWith(defaultReaderBrandCheckException("read"));if(void 0===this._ownerReadableStream)return promiseRejectedWith(readerLockException("read from"));var t,r,a=newPromise((function(a,i){t=a;r=i}));ReadableStreamDefaultReaderRead(this,{_chunkSteps:function(r){return t({value:r,done:!1})},_closeSteps:function(){return t({value:void 0,done:!0})},_errorSteps:function(t){return r(t)}});return a};ReadableStreamDefaultReader.prototype.releaseLock=function(){if(!IsReadableStreamDefaultReader(this))throw defaultReaderBrandCheckException("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ReadableStreamReaderGenericRelease(this)}};return ReadableStreamDefaultReader}();Object.defineProperties(C.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(C.prototype,r.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function IsReadableStreamDefaultReader(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readRequests")&&t instanceof C}function ReadableStreamDefaultReaderRead(t,r){var a=t._ownerReadableStream;a._disturbed=!0;"closed"===a._state?r._closeSteps():"errored"===a._state?r._errorSteps(a._storedError):a._readableStreamController[v](r)}function defaultReaderBrandCheckException(t){return new TypeError("ReadableStreamDefaultReader.prototype."+t+" can only be used on a ReadableStreamDefaultReader")}if("symbol"==typeof r.asyncIterator){w=((S={})[r.asyncIterator]=function(){return this},S);Object.defineProperty(w,r.asyncIterator,{enumerable:!1})}var P=function(){function ReadableStreamAsyncIteratorImpl(t,r){this._ongoingPromise=void 0;this._isFinished=!1;this._reader=t;this._preventCancel=r}ReadableStreamAsyncIteratorImpl.prototype.next=function(){var t=this,nextSteps=function(){return t._nextSteps()};this._ongoingPromise=this._ongoingPromise?transformPromiseWith(this._ongoingPromise,nextSteps,nextSteps):nextSteps();return this._ongoingPromise};ReadableStreamAsyncIteratorImpl.prototype.return=function(t){var r=this,returnSteps=function(){return r._returnSteps(t)};return this._ongoingPromise?transformPromiseWith(this._ongoingPromise,returnSteps,returnSteps):returnSteps()};ReadableStreamAsyncIteratorImpl.prototype._nextSteps=function(){var t=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var r,a,i=this._reader;if(void 0===i._ownerReadableStream)return promiseRejectedWith(readerLockException("iterate"));var o=newPromise((function(t,i){r=t;a=i}));ReadableStreamDefaultReaderRead(i,{_chunkSteps:function(a){t._ongoingPromise=void 0;d((function(){return r({value:a,done:!1})}))},_closeSteps:function(){t._ongoingPromise=void 0;t._isFinished=!0;ReadableStreamReaderGenericRelease(i);r({value:void 0,done:!0})},_errorSteps:function(r){t._ongoingPromise=void 0;t._isFinished=!0;ReadableStreamReaderGenericRelease(i);a(r)}});return o};ReadableStreamAsyncIteratorImpl.prototype._returnSteps=function(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;var r=this._reader;if(void 0===r._ownerReadableStream)return promiseRejectedWith(readerLockException("finish iterating"));if(!this._preventCancel){var a=ReadableStreamReaderGenericCancel(r,t);ReadableStreamReaderGenericRelease(r);return transformPromiseWith(a,(function(){return{value:t,done:!0}}))}ReadableStreamReaderGenericRelease(r);return promiseResolvedWith({value:t,done:!0})};return ReadableStreamAsyncIteratorImpl}(),k={next:function(){return IsReadableStreamAsyncIterator(this)?this._asyncIteratorImpl.next():promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"))},return:function(t){return IsReadableStreamAsyncIterator(this)?this._asyncIteratorImpl.return(t):promiseRejectedWith(streamAsyncIteratorBrandCheckException("return"))}};void 0!==w&&Object.setPrototypeOf(k,w);function IsReadableStreamAsyncIterator(t){if(!typeIsObject(t))return!1;if(!Object.prototype.hasOwnProperty.call(t,"_asyncIteratorImpl"))return!1;try{return t._asyncIteratorImpl instanceof P}catch(t){return!1}}function streamAsyncIteratorBrandCheckException(t){return new TypeError("ReadableStreamAsyncIterator."+t+" can only be used on a ReadableSteamAsyncIterator")}var R=Number.isNaN||function(t){return t!=t};function CreateArrayFromList(t){return t.slice()}function CopyDataBlockBytes(t,r,a,i,o){new Uint8Array(t).set(new Uint8Array(a,i,o),r)}function ArrayBufferSlice(t,r,a){if(t.slice)return t.slice(r,a);var i=a-r,o=new ArrayBuffer(i);CopyDataBlockBytes(o,0,t,r,i);return o}function CloneAsUint8Array(t){var r=ArrayBufferSlice(t.buffer,t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(r)}function DequeueValue(t){var r=t._queue.shift();t._queueTotalSize-=r.size;t._queueTotalSize<0&&(t._queueTotalSize=0);return r.value}function EnqueueValueWithSize(t,r,a){if(!function IsNonNegativeNumber(t){return!("number"!=typeof t||R(t)||t<0)}(a)||a===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");t._queue.push({value:r,size:a});t._queueTotalSize+=a}function ResetQueue(t){t._queue=new h;t._queueTotalSize=0}var A=function(){function ReadableStreamBYOBRequest(){throw new TypeError("Illegal constructor")}Object.defineProperty(ReadableStreamBYOBRequest.prototype,"view",{get:function(){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("view");return this._view},enumerable:!1,configurable:!0});ReadableStreamBYOBRequest.prototype.respond=function(t){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("respond");assertRequiredArgument(t,1,"respond");t=convertUnsignedLongLongWithEnforceRange(t,"First parameter");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer;ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController,t)};ReadableStreamBYOBRequest.prototype.respondWithNewView=function(t){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("respondWithNewView");assertRequiredArgument(t,1,"respondWithNewView");if(!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");t.buffer;ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,t)};return ReadableStreamBYOBRequest}();Object.defineProperties(A.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(A.prototype,r.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var x=function(){function ReadableByteStreamController(){throw new TypeError("Illegal constructor")}Object.defineProperty(ReadableByteStreamController.prototype,"byobRequest",{get:function(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("byobRequest");return ReadableByteStreamControllerGetBYOBRequest(this)},enumerable:!1,configurable:!0});Object.defineProperty(ReadableByteStreamController.prototype,"desiredSize",{get:function(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("desiredSize");return ReadableByteStreamControllerGetDesiredSize(this)},enumerable:!1,configurable:!0});ReadableByteStreamController.prototype.close=function(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be closed");ReadableByteStreamControllerClose(this)};ReadableByteStreamController.prototype.enqueue=function(t){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("enqueue");assertRequiredArgument(t,1,"enqueue");if(!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(0===t.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===t.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var r=this._controlledReadableByteStream._state;if("readable"!==r)throw new TypeError("The stream (in "+r+" state) is not in the readable state and cannot be enqueued to");ReadableByteStreamControllerEnqueue(this,t)};ReadableByteStreamController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("error");ReadableByteStreamControllerError(this,t)};ReadableByteStreamController.prototype[g]=function(t){ReadableByteStreamControllerClearPendingPullIntos(this);ResetQueue(this);var r=this._cancelAlgorithm(t);ReadableByteStreamControllerClearAlgorithms(this);return r};ReadableByteStreamController.prototype[v]=function(t){var r=this._controlledReadableByteStream;if(this._queueTotalSize>0){var a=this._queue.shift();this._queueTotalSize-=a.byteLength;ReadableByteStreamControllerHandleQueueDrain(this);var i=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);t._chunkSteps(i)}else{var o=this._autoAllocateChunkSize;if(void 0!==o){var l=void 0;try{l=new ArrayBuffer(o)}catch(r){t._errorSteps(r);return}var u={buffer:l,bufferByteLength:o,byteOffset:0,byteLength:o,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(u)}ReadableStreamAddReadRequest(r,t);ReadableByteStreamControllerCallPullIfNeeded(this)}};return ReadableByteStreamController}();Object.defineProperties(x.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(x.prototype,r.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function IsReadableByteStreamController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledReadableByteStream")&&t instanceof x}function IsReadableStreamBYOBRequest(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_associatedReadableByteStreamController")&&t instanceof A}function ReadableByteStreamControllerCallPullIfNeeded(t){var r=function ReadableByteStreamControllerShouldCallPull(t){var r=t._controlledReadableByteStream;return"readable"===r._state&&(!t._closeRequested&&(!!t._started&&(!!(ReadableStreamHasDefaultReader(r)&&ReadableStreamGetNumReadRequests(r)>0)||(!!(ReadableStreamHasBYOBReader(r)&&ReadableStreamGetNumReadIntoRequests(r)>0)||ReadableByteStreamControllerGetDesiredSize(t)>0))))}(t);if(r)if(t._pulling)t._pullAgain=!0;else{t._pulling=!0;uponPromise(t._pullAlgorithm(),(function(){t._pulling=!1;if(t._pullAgain){t._pullAgain=!1;ReadableByteStreamControllerCallPullIfNeeded(t)}}),(function(r){ReadableByteStreamControllerError(t,r)}))}}function ReadableByteStreamControllerClearPendingPullIntos(t){ReadableByteStreamControllerInvalidateBYOBRequest(t);t._pendingPullIntos=new h}function ReadableByteStreamControllerCommitPullIntoDescriptor(t,r){var a=!1;"closed"===t._state&&(a=!0);var i=ReadableByteStreamControllerConvertPullIntoDescriptor(r);"default"===r.readerType?ReadableStreamFulfillReadRequest(t,i,a):function ReadableStreamFulfillReadIntoRequest(t,r,a){var i=t._reader._readIntoRequests.shift();a?i._closeSteps(r):i._chunkSteps(r)}(t,i,a)}function ReadableByteStreamControllerConvertPullIntoDescriptor(t){var r=t.bytesFilled,a=t.elementSize;return new t.viewConstructor(t.buffer,t.byteOffset,r/a)}function ReadableByteStreamControllerEnqueueChunkToQueue(t,r,a,i){t._queue.push({buffer:r,byteOffset:a,byteLength:i});t._queueTotalSize+=i}function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r){var a=r.elementSize,i=r.bytesFilled-r.bytesFilled%a,o=Math.min(t._queueTotalSize,r.byteLength-r.bytesFilled),l=r.bytesFilled+o,u=l-l%a,c=o,d=!1;if(u>i){c=u-r.bytesFilled;d=!0}for(var h=t._queue;c>0;){var p=h.peek(),m=Math.min(c,p.byteLength),g=r.byteOffset+r.bytesFilled;CopyDataBlockBytes(r.buffer,g,p.buffer,p.byteOffset,m);if(p.byteLength===m)h.shift();else{p.byteOffset+=m;p.byteLength-=m}t._queueTotalSize-=m;ReadableByteStreamControllerFillHeadPullIntoDescriptor(0,m,r);c-=m}return d}function ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,a){a.bytesFilled+=r}function ReadableByteStreamControllerHandleQueueDrain(t){if(0===t._queueTotalSize&&t._closeRequested){ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(t._controlledReadableByteStream)}else ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerInvalidateBYOBRequest(t){if(null!==t._byobRequest){t._byobRequest._associatedReadableByteStreamController=void 0;t._byobRequest._view=null;t._byobRequest=null}}function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t){for(;t._pendingPullIntos.length>0;){if(0===t._queueTotalSize)return;var r=t._pendingPullIntos.peek();if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r)){ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,r)}}}function ReadableByteStreamControllerRespondInternal(t,r){var a=t._pendingPullIntos.peek();ReadableByteStreamControllerInvalidateBYOBRequest(t);"closed"===t._controlledReadableByteStream._state?function ReadableByteStreamControllerRespondInClosedState(t,r){var a=t._controlledReadableByteStream;if(ReadableStreamHasBYOBReader(a))for(;ReadableStreamGetNumReadIntoRequests(a)>0;)ReadableByteStreamControllerCommitPullIntoDescriptor(a,ReadableByteStreamControllerShiftPendingPullInto(t))}(t):function ReadableByteStreamControllerRespondInReadableState(t,r,a){ReadableByteStreamControllerFillHeadPullIntoDescriptor(0,r,a);if(!(a.bytesFilled<a.elementSize)){ReadableByteStreamControllerShiftPendingPullInto(t);var i=a.bytesFilled%a.elementSize;if(i>0){var o=a.byteOffset+a.bytesFilled,l=ArrayBufferSlice(a.buffer,o-i,o);ReadableByteStreamControllerEnqueueChunkToQueue(t,l,0,l.byteLength)}a.bytesFilled-=i;ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,a);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}}(t,r,a);ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerShiftPendingPullInto(t){return t._pendingPullIntos.shift()}function ReadableByteStreamControllerClearAlgorithms(t){t._pullAlgorithm=void 0;t._cancelAlgorithm=void 0}function ReadableByteStreamControllerClose(t){var r=t._controlledReadableByteStream;if(!t._closeRequested&&"readable"===r._state)if(t._queueTotalSize>0)t._closeRequested=!0;else{if(t._pendingPullIntos.length>0&&t._pendingPullIntos.peek().bytesFilled>0){var a=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,a);throw a}ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(r)}}function ReadableByteStreamControllerEnqueue(t,r){var a=t._controlledReadableByteStream;if(!t._closeRequested&&"readable"===a._state){var i=r.buffer,o=r.byteOffset,l=r.byteLength,u=i;if(t._pendingPullIntos.length>0){var c=t._pendingPullIntos.peek();c.buffer;c.buffer=c.buffer}ReadableByteStreamControllerInvalidateBYOBRequest(t);if(ReadableStreamHasDefaultReader(a))0===ReadableStreamGetNumReadRequests(a)?ReadableByteStreamControllerEnqueueChunkToQueue(t,u,o,l):ReadableStreamFulfillReadRequest(a,new Uint8Array(u,o,l),!1);else if(ReadableStreamHasBYOBReader(a)){ReadableByteStreamControllerEnqueueChunkToQueue(t,u,o,l);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}else ReadableByteStreamControllerEnqueueChunkToQueue(t,u,o,l);ReadableByteStreamControllerCallPullIfNeeded(t)}}function ReadableByteStreamControllerError(t,r){var a=t._controlledReadableByteStream;if("readable"===a._state){ReadableByteStreamControllerClearPendingPullIntos(t);ResetQueue(t);ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamError(a,r)}}function ReadableByteStreamControllerGetBYOBRequest(t){if(null===t._byobRequest&&t._pendingPullIntos.length>0){var r=t._pendingPullIntos.peek(),a=new Uint8Array(r.buffer,r.byteOffset+r.bytesFilled,r.byteLength-r.bytesFilled),i=Object.create(A.prototype);!function SetUpReadableStreamBYOBRequest(t,r,a){t._associatedReadableByteStreamController=r;t._view=a}(i,t,a);t._byobRequest=i}return t._byobRequest}function ReadableByteStreamControllerGetDesiredSize(t){var r=t._controlledReadableByteStream._state;return"errored"===r?null:"closed"===r?0:t._strategyHWM-t._queueTotalSize}function ReadableByteStreamControllerRespond(t,r){var a=t._pendingPullIntos.peek();if("closed"===t._controlledReadableByteStream._state){if(0!==r)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===r)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(a.bytesFilled+r>a.byteLength)throw new RangeError("bytesWritten out of range")}a.buffer=a.buffer;ReadableByteStreamControllerRespondInternal(t,r)}function ReadableByteStreamControllerRespondWithNewView(t,r){var a=t._pendingPullIntos.peek();if("closed"===t._controlledReadableByteStream._state){if(0!==r.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===r.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(a.byteOffset+a.bytesFilled!==r.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(a.bufferByteLength!==r.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(a.bytesFilled+r.byteLength>a.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");a.buffer=r.buffer;ReadableByteStreamControllerRespondInternal(t,r.byteLength)}function SetUpReadableByteStreamController(t,r,a,i,o,l,u){r._controlledReadableByteStream=t;r._pullAgain=!1;r._pulling=!1;r._byobRequest=null;r._queue=r._queueTotalSize=void 0;ResetQueue(r);r._closeRequested=!1;r._started=!1;r._strategyHWM=l;r._pullAlgorithm=i;r._cancelAlgorithm=o;r._autoAllocateChunkSize=u;r._pendingPullIntos=new h;t._readableStreamController=r;uponPromise(promiseResolvedWith(a()),(function(){r._started=!0;ReadableByteStreamControllerCallPullIfNeeded(r)}),(function(t){ReadableByteStreamControllerError(r,t)}))}function byobRequestBrandCheckException(t){return new TypeError("ReadableStreamBYOBRequest.prototype."+t+" can only be used on a ReadableStreamBYOBRequest")}function byteStreamControllerBrandCheckException(t){return new TypeError("ReadableByteStreamController.prototype."+t+" can only be used on a ReadableByteStreamController")}function AcquireReadableStreamBYOBReader(t){return new T(t)}function ReadableStreamAddReadIntoRequest(t,r){t._reader._readIntoRequests.push(r)}function ReadableStreamGetNumReadIntoRequests(t){return t._reader._readIntoRequests.length}function ReadableStreamHasBYOBReader(t){var r=t._reader;return void 0!==r&&!!IsReadableStreamBYOBReader(r)}var T=function(){function ReadableStreamBYOBReader(t){assertRequiredArgument(t,1,"ReadableStreamBYOBReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!IsReadableByteStreamController(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ReadableStreamReaderGenericInitialize(this,t);this._readIntoRequests=new h}Object.defineProperty(ReadableStreamBYOBReader.prototype,"closed",{get:function(){return IsReadableStreamBYOBReader(this)?this._closedPromise:promiseRejectedWith(byobReaderBrandCheckException("closed"))},enumerable:!1,configurable:!0});ReadableStreamBYOBReader.prototype.cancel=function(t){void 0===t&&(t=void 0);return IsReadableStreamBYOBReader(this)?void 0===this._ownerReadableStream?promiseRejectedWith(readerLockException("cancel")):ReadableStreamReaderGenericCancel(this,t):promiseRejectedWith(byobReaderBrandCheckException("cancel"))};ReadableStreamBYOBReader.prototype.read=function(t){if(!IsReadableStreamBYOBReader(this))return promiseRejectedWith(byobReaderBrandCheckException("read"));if(!ArrayBuffer.isView(t))return promiseRejectedWith(new TypeError("view must be an array buffer view"));if(0===t.byteLength)return promiseRejectedWith(new TypeError("view must have non-zero byteLength"));if(0===t.buffer.byteLength)return promiseRejectedWith(new TypeError("view's buffer must have non-zero byteLength"));t.buffer;if(void 0===this._ownerReadableStream)return promiseRejectedWith(readerLockException("read from"));var r,a,i=newPromise((function(t,i){r=t;a=i}));ReadableStreamBYOBReaderRead(this,t,{_chunkSteps:function(t){return r({value:t,done:!1})},_closeSteps:function(t){return r({value:t,done:!0})},_errorSteps:function(t){return a(t)}});return i};ReadableStreamBYOBReader.prototype.releaseLock=function(){if(!IsReadableStreamBYOBReader(this))throw byobReaderBrandCheckException("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ReadableStreamReaderGenericRelease(this)}};return ReadableStreamBYOBReader}();Object.defineProperties(T.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(T.prototype,r.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function IsReadableStreamBYOBReader(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readIntoRequests")&&t instanceof T}function ReadableStreamBYOBReaderRead(t,r,a){var i=t._ownerReadableStream;i._disturbed=!0;"errored"===i._state?a._errorSteps(i._storedError):function ReadableByteStreamControllerPullInto(t,r,a){var i=t._controlledReadableByteStream,o=1;r.constructor!==DataView&&(o=r.constructor.BYTES_PER_ELEMENT);var l=r.constructor,u=r.buffer,c={buffer:u,bufferByteLength:u.byteLength,byteOffset:r.byteOffset,byteLength:r.byteLength,bytesFilled:0,elementSize:o,viewConstructor:l,readerType:"byob"};if(t._pendingPullIntos.length>0){t._pendingPullIntos.push(c);ReadableStreamAddReadIntoRequest(i,a)}else if("closed"!==i._state){if(t._queueTotalSize>0){if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,c)){var d=ReadableByteStreamControllerConvertPullIntoDescriptor(c);ReadableByteStreamControllerHandleQueueDrain(t);a._chunkSteps(d);return}if(t._closeRequested){var h=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,h);a._errorSteps(h);return}}t._pendingPullIntos.push(c);ReadableStreamAddReadIntoRequest(i,a);ReadableByteStreamControllerCallPullIfNeeded(t)}else{var p=new l(c.buffer,c.byteOffset,0);a._closeSteps(p)}}(i._readableStreamController,r,a)}function byobReaderBrandCheckException(t){return new TypeError("ReadableStreamBYOBReader.prototype."+t+" can only be used on a ReadableStreamBYOBReader")}function ExtractHighWaterMark(t,r){var a=t.highWaterMark;if(void 0===a)return r;if(R(a)||a<0)throw new RangeError("Invalid highWaterMark");return a}function ExtractSizeAlgorithm(t){var r=t.size;return r||function(){return 1}}function convertQueuingStrategy(t,r){assertDictionary(t,r);var a=null==t?void 0:t.highWaterMark,i=null==t?void 0:t.size;return{highWaterMark:void 0===a?void 0:convertUnrestrictedDouble(a),size:void 0===i?void 0:convertQueuingStrategySize(i,r+" has member 'size' that")}}function convertQueuingStrategySize(t,r){assertFunction(t,r);return function(r){return convertUnrestrictedDouble(t(r))}}function convertUnderlyingSinkAbortCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertUnderlyingSinkCloseCallback(t,r,a){assertFunction(t,a);return function(){return promiseCall(t,r,[])}}function convertUnderlyingSinkStartCallback(t,r,a){assertFunction(t,a);return function(a){return reflectCall(t,r,[a])}}function convertUnderlyingSinkWriteCallback(t,r,a){assertFunction(t,a);return function(a,i){return promiseCall(t,r,[a,i])}}function assertWritableStream(t,r){if(!IsWritableStream(t))throw new TypeError(r+" is not a WritableStream.")}var E="function"==typeof AbortController,I=function(){function WritableStream(t,r){void 0===t&&(t={});void 0===r&&(r={});void 0===t?t=null:assertObject(t,"First parameter");var a=convertQueuingStrategy(r,"Second parameter"),i=function convertUnderlyingSink(t,r){assertDictionary(t,r);var a=null==t?void 0:t.abort,i=null==t?void 0:t.close,o=null==t?void 0:t.start,l=null==t?void 0:t.type,u=null==t?void 0:t.write;return{abort:void 0===a?void 0:convertUnderlyingSinkAbortCallback(a,t,r+" has member 'abort' that"),close:void 0===i?void 0:convertUnderlyingSinkCloseCallback(i,t,r+" has member 'close' that"),start:void 0===o?void 0:convertUnderlyingSinkStartCallback(o,t,r+" has member 'start' that"),write:void 0===u?void 0:convertUnderlyingSinkWriteCallback(u,t,r+" has member 'write' that"),type:l}}(t,"First parameter");InitializeWritableStream(this);if(void 0!==i.type)throw new RangeError("Invalid type is specified");var o=ExtractSizeAlgorithm(a);!function SetUpWritableStreamDefaultControllerFromUnderlyingSink(t,r,a,i){var o=Object.create(L.prototype),startAlgorithm=function(){},writeAlgorithm=function(){return promiseResolvedWith(void 0)},closeAlgorithm=function(){return promiseResolvedWith(void 0)},abortAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.start&&(startAlgorithm=function(){return r.start(o)});void 0!==r.write&&(writeAlgorithm=function(t){return r.write(t,o)});void 0!==r.close&&(closeAlgorithm=function(){return r.close()});void 0!==r.abort&&(abortAlgorithm=function(t){return r.abort(t)});SetUpWritableStreamDefaultController(t,o,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,a,i)}(this,i,ExtractHighWaterMark(a,1),o)}Object.defineProperty(WritableStream.prototype,"locked",{get:function(){if(!IsWritableStream(this))throw streamBrandCheckException$2("locked");return IsWritableStreamLocked(this)},enumerable:!1,configurable:!0});WritableStream.prototype.abort=function(t){void 0===t&&(t=void 0);return IsWritableStream(this)?IsWritableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer")):WritableStreamAbort(this,t):promiseRejectedWith(streamBrandCheckException$2("abort"))};WritableStream.prototype.close=function(){return IsWritableStream(this)?IsWritableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer")):WritableStreamCloseQueuedOrInFlight(this)?promiseRejectedWith(new TypeError("Cannot close an already-closing stream")):WritableStreamClose(this):promiseRejectedWith(streamBrandCheckException$2("close"))};WritableStream.prototype.getWriter=function(){if(!IsWritableStream(this))throw streamBrandCheckException$2("getWriter");return AcquireWritableStreamDefaultWriter(this)};return WritableStream}();Object.defineProperties(I.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(I.prototype,r.toStringTag,{value:"WritableStream",configurable:!0});function AcquireWritableStreamDefaultWriter(t){return new O(t)}function InitializeWritableStream(t){t._state="writable";t._storedError=void 0;t._writer=void 0;t._writableStreamController=void 0;t._writeRequests=new h;t._inFlightWriteRequest=void 0;t._closeRequest=void 0;t._inFlightCloseRequest=void 0;t._pendingAbortRequest=void 0;t._backpressure=!1}function IsWritableStream(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_writableStreamController")&&t instanceof I}function IsWritableStreamLocked(t){return void 0!==t._writer}function WritableStreamAbort(t,r){var a;if("closed"===t._state||"errored"===t._state)return promiseResolvedWith(void 0);t._writableStreamController._abortReason=r;null===(a=t._writableStreamController._abortController)||void 0===a||a.abort();var i=t._state;if("closed"===i||"errored"===i)return promiseResolvedWith(void 0);if(void 0!==t._pendingAbortRequest)return t._pendingAbortRequest._promise;var o=!1;if("erroring"===i){o=!0;r=void 0}var l=newPromise((function(a,i){t._pendingAbortRequest={_promise:void 0,_resolve:a,_reject:i,_reason:r,_wasAlreadyErroring:o}}));t._pendingAbortRequest._promise=l;o||WritableStreamStartErroring(t,r);return l}function WritableStreamClose(t){var r=t._state;if("closed"===r||"errored"===r)return promiseRejectedWith(new TypeError("The stream (in "+r+" state) is not in the writable state and cannot be closed"));var a=newPromise((function(r,a){var i={_resolve:r,_reject:a};t._closeRequest=i})),i=t._writer;void 0!==i&&t._backpressure&&"writable"===r&&defaultWriterReadyPromiseResolve(i);!function WritableStreamDefaultControllerClose(t){EnqueueValueWithSize(t,D,0);WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}(t._writableStreamController);return a}function WritableStreamDealWithRejection(t,r){"writable"!==t._state?WritableStreamFinishErroring(t):WritableStreamStartErroring(t,r)}function WritableStreamStartErroring(t,r){var a=t._writableStreamController;t._state="erroring";t._storedError=r;var i=t._writer;void 0!==i&&WritableStreamDefaultWriterEnsureReadyPromiseRejected(i,r);!function WritableStreamHasOperationMarkedInFlight(t){return void 0!==t._inFlightWriteRequest||void 0!==t._inFlightCloseRequest}(t)&&a._started&&WritableStreamFinishErroring(t)}function WritableStreamFinishErroring(t){t._state="errored";t._writableStreamController[m]();var r=t._storedError;t._writeRequests.forEach((function(t){t._reject(r)}));t._writeRequests=new h;if(void 0!==t._pendingAbortRequest){var a=t._pendingAbortRequest;t._pendingAbortRequest=void 0;if(a._wasAlreadyErroring){a._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}else uponPromise(t._writableStreamController[p](a._reason),(function(){a._resolve();WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}),(function(r){a._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}))}else WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}function WritableStreamCloseQueuedOrInFlight(t){return void 0!==t._closeRequest||void 0!==t._inFlightCloseRequest}function WritableStreamRejectCloseAndClosedPromiseIfNeeded(t){if(void 0!==t._closeRequest){t._closeRequest._reject(t._storedError);t._closeRequest=void 0}var r=t._writer;void 0!==r&&defaultWriterClosedPromiseReject(r,t._storedError)}function WritableStreamUpdateBackpressure(t,r){var a=t._writer;void 0!==a&&r!==t._backpressure&&(r?function defaultWriterReadyPromiseReset(t){defaultWriterReadyPromiseInitialize(t)}(a):defaultWriterReadyPromiseResolve(a));t._backpressure=r}var O=function(){function WritableStreamDefaultWriter(t){assertRequiredArgument(t,1,"WritableStreamDefaultWriter");assertWritableStream(t,"First parameter");if(IsWritableStreamLocked(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t;t._writer=this;var r=t._state;if("writable"===r){!WritableStreamCloseQueuedOrInFlight(t)&&t._backpressure?defaultWriterReadyPromiseInitialize(this):defaultWriterReadyPromiseInitializeAsResolved(this);defaultWriterClosedPromiseInitialize(this)}else if("erroring"===r){defaultWriterReadyPromiseInitializeAsRejected(this,t._storedError);defaultWriterClosedPromiseInitialize(this)}else if("closed"===r){defaultWriterReadyPromiseInitializeAsResolved(this);!function defaultWriterClosedPromiseInitializeAsResolved(t){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseResolve(t)}(this)}else{var a=t._storedError;defaultWriterReadyPromiseInitializeAsRejected(this,a);defaultWriterClosedPromiseInitializeAsRejected(this,a)}}Object.defineProperty(WritableStreamDefaultWriter.prototype,"closed",{get:function(){return IsWritableStreamDefaultWriter(this)?this._closedPromise:promiseRejectedWith(defaultWriterBrandCheckException("closed"))},enumerable:!1,configurable:!0});Object.defineProperty(WritableStreamDefaultWriter.prototype,"desiredSize",{get:function(){if(!IsWritableStreamDefaultWriter(this))throw defaultWriterBrandCheckException("desiredSize");if(void 0===this._ownerWritableStream)throw defaultWriterLockException("desiredSize");return function WritableStreamDefaultWriterGetDesiredSize(t){var r=t._ownerWritableStream,a=r._state;return"errored"===a||"erroring"===a?null:"closed"===a?0:WritableStreamDefaultControllerGetDesiredSize(r._writableStreamController)}(this)},enumerable:!1,configurable:!0});Object.defineProperty(WritableStreamDefaultWriter.prototype,"ready",{get:function(){return IsWritableStreamDefaultWriter(this)?this._readyPromise:promiseRejectedWith(defaultWriterBrandCheckException("ready"))},enumerable:!1,configurable:!0});WritableStreamDefaultWriter.prototype.abort=function(t){void 0===t&&(t=void 0);return IsWritableStreamDefaultWriter(this)?void 0===this._ownerWritableStream?promiseRejectedWith(defaultWriterLockException("abort")):function WritableStreamDefaultWriterAbort(t,r){return WritableStreamAbort(t._ownerWritableStream,r)}(this,t):promiseRejectedWith(defaultWriterBrandCheckException("abort"))};WritableStreamDefaultWriter.prototype.close=function(){if(!IsWritableStreamDefaultWriter(this))return promiseRejectedWith(defaultWriterBrandCheckException("close"));var t=this._ownerWritableStream;return void 0===t?promiseRejectedWith(defaultWriterLockException("close")):WritableStreamCloseQueuedOrInFlight(t)?promiseRejectedWith(new TypeError("Cannot close an already-closing stream")):WritableStreamDefaultWriterClose(this)};WritableStreamDefaultWriter.prototype.releaseLock=function(){if(!IsWritableStreamDefaultWriter(this))throw defaultWriterBrandCheckException("releaseLock");void 0!==this._ownerWritableStream&&WritableStreamDefaultWriterRelease(this)};WritableStreamDefaultWriter.prototype.write=function(t){void 0===t&&(t=void 0);return IsWritableStreamDefaultWriter(this)?void 0===this._ownerWritableStream?promiseRejectedWith(defaultWriterLockException("write to")):WritableStreamDefaultWriterWrite(this,t):promiseRejectedWith(defaultWriterBrandCheckException("write"))};return WritableStreamDefaultWriter}();Object.defineProperties(O.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(O.prototype,r.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function IsWritableStreamDefaultWriter(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_ownerWritableStream")&&t instanceof O}function WritableStreamDefaultWriterClose(t){return WritableStreamClose(t._ownerWritableStream)}function WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,r){"pending"===t._closedPromiseState?defaultWriterClosedPromiseReject(t,r):function defaultWriterClosedPromiseResetToRejected(t,r){defaultWriterClosedPromiseInitializeAsRejected(t,r)}(t,r)}function WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,r){"pending"===t._readyPromiseState?defaultWriterReadyPromiseReject(t,r):function defaultWriterReadyPromiseResetToRejected(t,r){defaultWriterReadyPromiseInitializeAsRejected(t,r)}(t,r)}function WritableStreamDefaultWriterRelease(t){var r=t._ownerWritableStream,a=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,a);WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,a);r._writer=void 0;t._ownerWritableStream=void 0}function WritableStreamDefaultWriterWrite(t,r){var a=t._ownerWritableStream,i=a._writableStreamController,o=function WritableStreamDefaultControllerGetChunkSize(t,r){try{return t._strategySizeAlgorithm(r)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return 1}}(i,r);if(a!==t._ownerWritableStream)return promiseRejectedWith(defaultWriterLockException("write to"));var l=a._state;if("errored"===l)return promiseRejectedWith(a._storedError);if(WritableStreamCloseQueuedOrInFlight(a)||"closed"===l)return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===l)return promiseRejectedWith(a._storedError);var u=function WritableStreamAddWriteRequest(t){return newPromise((function(r,a){var i={_resolve:r,_reject:a};t._writeRequests.push(i)}))}(a);!function WritableStreamDefaultControllerWrite(t,r,a){try{EnqueueValueWithSize(t,r,a)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return}var i=t._controlledWritableStream;WritableStreamCloseQueuedOrInFlight(i)||"writable"!==i._state||WritableStreamUpdateBackpressure(i,WritableStreamDefaultControllerGetBackpressure(t));WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}(i,r,o);return u}var D={},L=function(){function WritableStreamDefaultController(){throw new TypeError("Illegal constructor")}Object.defineProperty(WritableStreamDefaultController.prototype,"abortReason",{get:function(){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("abortReason");return this._abortReason},enumerable:!1,configurable:!0});Object.defineProperty(WritableStreamDefaultController.prototype,"signal",{get:function(){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal},enumerable:!1,configurable:!0});WritableStreamDefaultController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("error");"writable"===this._controlledWritableStream._state&&WritableStreamDefaultControllerError(this,t)};WritableStreamDefaultController.prototype[p]=function(t){var r=this._abortAlgorithm(t);WritableStreamDefaultControllerClearAlgorithms(this);return r};WritableStreamDefaultController.prototype[m]=function(){ResetQueue(this)};return WritableStreamDefaultController}();Object.defineProperties(L.prototype,{error:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(L.prototype,r.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function IsWritableStreamDefaultController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledWritableStream")&&t instanceof L}function SetUpWritableStreamDefaultController(t,r,a,i,o,l,u,c){r._controlledWritableStream=t;t._writableStreamController=r;r._queue=void 0;r._queueTotalSize=void 0;ResetQueue(r);r._abortReason=void 0;r._abortController=function createAbortController(){if(E)return new AbortController}();r._started=!1;r._strategySizeAlgorithm=c;r._strategyHWM=u;r._writeAlgorithm=i;r._closeAlgorithm=o;r._abortAlgorithm=l;var d=WritableStreamDefaultControllerGetBackpressure(r);WritableStreamUpdateBackpressure(t,d);uponPromise(promiseResolvedWith(a()),(function(){r._started=!0;WritableStreamDefaultControllerAdvanceQueueIfNeeded(r)}),(function(a){r._started=!0;WritableStreamDealWithRejection(t,a)}))}function WritableStreamDefaultControllerClearAlgorithms(t){t._writeAlgorithm=void 0;t._closeAlgorithm=void 0;t._abortAlgorithm=void 0;t._strategySizeAlgorithm=void 0}function WritableStreamDefaultControllerGetDesiredSize(t){return t._strategyHWM-t._queueTotalSize}function WritableStreamDefaultControllerAdvanceQueueIfNeeded(t){var r=t._controlledWritableStream;if(t._started&&void 0===r._inFlightWriteRequest)if("erroring"!==r._state){if(0!==t._queue.length){var a=function PeekQueueValue(t){return t._queue.peek().value}(t);a===D?function WritableStreamDefaultControllerProcessClose(t){var r=t._controlledWritableStream;!function WritableStreamMarkCloseRequestInFlight(t){t._inFlightCloseRequest=t._closeRequest;t._closeRequest=void 0}(r);DequeueValue(t);var a=t._closeAlgorithm();WritableStreamDefaultControllerClearAlgorithms(t);uponPromise(a,(function(){!function WritableStreamFinishInFlightClose(t){t._inFlightCloseRequest._resolve(void 0);t._inFlightCloseRequest=void 0;if("erroring"===t._state){t._storedError=void 0;if(void 0!==t._pendingAbortRequest){t._pendingAbortRequest._resolve();t._pendingAbortRequest=void 0}}t._state="closed";var r=t._writer;void 0!==r&&defaultWriterClosedPromiseResolve(r)}(r)}),(function(t){!function WritableStreamFinishInFlightCloseWithError(t,r){t._inFlightCloseRequest._reject(r);t._inFlightCloseRequest=void 0;if(void 0!==t._pendingAbortRequest){t._pendingAbortRequest._reject(r);t._pendingAbortRequest=void 0}WritableStreamDealWithRejection(t,r)}(r,t)}))}(t):function WritableStreamDefaultControllerProcessWrite(t,r){var a=t._controlledWritableStream;!function WritableStreamMarkFirstWriteRequestInFlight(t){t._inFlightWriteRequest=t._writeRequests.shift()}(a);uponPromise(t._writeAlgorithm(r),(function(){!function WritableStreamFinishInFlightWrite(t){t._inFlightWriteRequest._resolve(void 0);t._inFlightWriteRequest=void 0}(a);var r=a._state;DequeueValue(t);if(!WritableStreamCloseQueuedOrInFlight(a)&&"writable"===r){var i=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(a,i)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}),(function(r){"writable"===a._state&&WritableStreamDefaultControllerClearAlgorithms(t);!function WritableStreamFinishInFlightWriteWithError(t,r){t._inFlightWriteRequest._reject(r);t._inFlightWriteRequest=void 0;WritableStreamDealWithRejection(t,r)}(a,r)}))}(t,a)}}else WritableStreamFinishErroring(r)}function WritableStreamDefaultControllerErrorIfNeeded(t,r){"writable"===t._controlledWritableStream._state&&WritableStreamDefaultControllerError(t,r)}function WritableStreamDefaultControllerGetBackpressure(t){return WritableStreamDefaultControllerGetDesiredSize(t)<=0}function WritableStreamDefaultControllerError(t,r){var a=t._controlledWritableStream;WritableStreamDefaultControllerClearAlgorithms(t);WritableStreamStartErroring(a,r)}function streamBrandCheckException$2(t){return new TypeError("WritableStream.prototype."+t+" can only be used on a WritableStream")}function defaultControllerBrandCheckException$2(t){return new TypeError("WritableStreamDefaultController.prototype."+t+" can only be used on a WritableStreamDefaultController")}function defaultWriterBrandCheckException(t){return new TypeError("WritableStreamDefaultWriter.prototype."+t+" can only be used on a WritableStreamDefaultWriter")}function defaultWriterLockException(t){return new TypeError("Cannot "+t+" a stream using a released writer")}function defaultWriterClosedPromiseInitialize(t){t._closedPromise=newPromise((function(r,a){t._closedPromise_resolve=r;t._closedPromise_reject=a;t._closedPromiseState="pending"}))}function defaultWriterClosedPromiseInitializeAsRejected(t,r){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseReject(t,r)}function defaultWriterClosedPromiseReject(t,r){if(void 0!==t._closedPromise_reject){setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0;t._closedPromiseState="rejected"}}function defaultWriterClosedPromiseResolve(t){if(void 0!==t._closedPromise_resolve){t._closedPromise_resolve(void 0);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0;t._closedPromiseState="resolved"}}function defaultWriterReadyPromiseInitialize(t){t._readyPromise=newPromise((function(r,a){t._readyPromise_resolve=r;t._readyPromise_reject=a}));t._readyPromiseState="pending"}function defaultWriterReadyPromiseInitializeAsRejected(t,r){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseReject(t,r)}function defaultWriterReadyPromiseInitializeAsResolved(t){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseResolve(t)}function defaultWriterReadyPromiseReject(t,r){if(void 0!==t._readyPromise_reject){setPromiseIsHandledToTrue(t._readyPromise);t._readyPromise_reject(r);t._readyPromise_resolve=void 0;t._readyPromise_reject=void 0;t._readyPromiseState="rejected"}}function defaultWriterReadyPromiseResolve(t){if(void 0!==t._readyPromise_resolve){t._readyPromise_resolve(void 0);t._readyPromise_resolve=void 0;t._readyPromise_reject=void 0;t._readyPromiseState="fulfilled"}}var M="undefined"!=typeof DOMException?DOMException:void 0,B=function isDOMExceptionConstructor(t){if("function"!=typeof t&&"object"!=typeof t)return!1;try{new t;return!0}catch(t){return!1}}(M)?M:function createDOMExceptionPolyfill(){var t=function DOMException(t,r){this.message=t||"";this.name=r||"Error";Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};t.prototype=Object.create(Error.prototype);Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,configurable:!0});return t}();function ReadableStreamPipeTo(t,r,a,i,o,l){var u=AcquireReadableStreamDefaultReader(t),c=AcquireWritableStreamDefaultWriter(r);t._disturbed=!0;var d=!1,h=promiseResolvedWith(void 0);return newPromise((function(p,m){var g;if(void 0!==l){g=function(){var a=new B("Aborted","AbortError"),l=[];i||l.push((function(){return"writable"===r._state?WritableStreamAbort(r,a):promiseResolvedWith(void 0)}));o||l.push((function(){return"readable"===t._state?ReadableStreamCancel(t,a):promiseResolvedWith(void 0)}));shutdownWithAction((function(){return Promise.all(l.map((function(t){return t()})))}),!0,a)};if(l.aborted){g();return}l.addEventListener("abort",g)}isOrBecomesErrored(t,u._closedPromise,(function(t){i?shutdown(!0,t):shutdownWithAction((function(){return WritableStreamAbort(r,t)}),!0,t)}));isOrBecomesErrored(r,c._closedPromise,(function(r){o?shutdown(!0,r):shutdownWithAction((function(){return ReadableStreamCancel(t,r)}),!0,r)}));!function isOrBecomesClosed(t,r,a){"closed"===t._state?a():uponFulfillment(r,a)}(t,u._closedPromise,(function(){a?shutdown():shutdownWithAction((function(){return function WritableStreamDefaultWriterCloseWithErrorPropagation(t){var r=t._ownerWritableStream,a=r._state;return WritableStreamCloseQueuedOrInFlight(r)||"closed"===a?promiseResolvedWith(void 0):"errored"===a?promiseRejectedWith(r._storedError):WritableStreamDefaultWriterClose(t)}(c)}))}));if(WritableStreamCloseQueuedOrInFlight(r)||"closed"===r._state){var v=new TypeError("the destination writable stream closed before all data could be piped to it");o?shutdown(!0,v):shutdownWithAction((function(){return ReadableStreamCancel(t,v)}),!0,v)}setPromiseIsHandledToTrue(function pipeLoop(){return newPromise((function(t,r){!function next(a){a?t():PerformPromiseThen(function pipeStep(){return d?promiseResolvedWith(!0):PerformPromiseThen(c._readyPromise,(function(){return newPromise((function(t,r){ReadableStreamDefaultReaderRead(u,{_chunkSteps:function(r){h=PerformPromiseThen(WritableStreamDefaultWriterWrite(c,r),void 0,noop);t(!1)},_closeSteps:function(){return t(!0)},_errorSteps:r})}))}))}(),next,r)}(!1)}))}());function waitForWritesToFinish(){var t=h;return PerformPromiseThen(h,(function(){return t!==h?waitForWritesToFinish():void 0}))}function isOrBecomesErrored(t,r,a){"errored"===t._state?a(t._storedError):uponRejection(r,a)}function shutdownWithAction(t,a,i){if(!d){d=!0;"writable"!==r._state||WritableStreamCloseQueuedOrInFlight(r)?doTheRest():uponFulfillment(waitForWritesToFinish(),doTheRest)}function doTheRest(){uponPromise(t(),(function(){return finalize(a,i)}),(function(t){return finalize(!0,t)}))}}function shutdown(t,a){if(!d){d=!0;"writable"!==r._state||WritableStreamCloseQueuedOrInFlight(r)?finalize(t,a):uponFulfillment(waitForWritesToFinish(),(function(){return finalize(t,a)}))}}function finalize(t,r){WritableStreamDefaultWriterRelease(c);ReadableStreamReaderGenericRelease(u);void 0!==l&&l.removeEventListener("abort",g);t?m(r):p(void 0)}}))}var W=function(){function ReadableStreamDefaultController(){throw new TypeError("Illegal constructor")}Object.defineProperty(ReadableStreamDefaultController.prototype,"desiredSize",{get:function(){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("desiredSize");return ReadableStreamDefaultControllerGetDesiredSize(this)},enumerable:!1,configurable:!0});ReadableStreamDefaultController.prototype.close=function(){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("close");if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("The stream is not in a state that permits close");ReadableStreamDefaultControllerClose(this)};ReadableStreamDefaultController.prototype.enqueue=function(t){void 0===t&&(t=void 0);if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("enqueue");if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("The stream is not in a state that permits enqueue");return ReadableStreamDefaultControllerEnqueue(this,t)};ReadableStreamDefaultController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("error");ReadableStreamDefaultControllerError(this,t)};ReadableStreamDefaultController.prototype[g]=function(t){ResetQueue(this);var r=this._cancelAlgorithm(t);ReadableStreamDefaultControllerClearAlgorithms(this);return r};ReadableStreamDefaultController.prototype[v]=function(t){var r=this._controlledReadableStream;if(this._queue.length>0){var a=DequeueValue(this);if(this._closeRequested&&0===this._queue.length){ReadableStreamDefaultControllerClearAlgorithms(this);ReadableStreamClose(r)}else ReadableStreamDefaultControllerCallPullIfNeeded(this);t._chunkSteps(a)}else{ReadableStreamAddReadRequest(r,t);ReadableStreamDefaultControllerCallPullIfNeeded(this)}};return ReadableStreamDefaultController}();Object.defineProperties(W.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(W.prototype,r.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function IsReadableStreamDefaultController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledReadableStream")&&t instanceof W}function ReadableStreamDefaultControllerCallPullIfNeeded(t){if(ReadableStreamDefaultControllerShouldCallPull(t))if(t._pulling)t._pullAgain=!0;else{t._pulling=!0;uponPromise(t._pullAlgorithm(),(function(){t._pulling=!1;if(t._pullAgain){t._pullAgain=!1;ReadableStreamDefaultControllerCallPullIfNeeded(t)}}),(function(r){ReadableStreamDefaultControllerError(t,r)}))}}function ReadableStreamDefaultControllerShouldCallPull(t){var r=t._controlledReadableStream;return!!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)&&!!t._started&&(!!(IsReadableStreamLocked(r)&&ReadableStreamGetNumReadRequests(r)>0)||ReadableStreamDefaultControllerGetDesiredSize(t)>0)}function ReadableStreamDefaultControllerClearAlgorithms(t){t._pullAlgorithm=void 0;t._cancelAlgorithm=void 0;t._strategySizeAlgorithm=void 0}function ReadableStreamDefaultControllerClose(t){if(ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){var r=t._controlledReadableStream;t._closeRequested=!0;if(0===t._queue.length){ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamClose(r)}}}function ReadableStreamDefaultControllerEnqueue(t,r){if(ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){var a=t._controlledReadableStream;if(IsReadableStreamLocked(a)&&ReadableStreamGetNumReadRequests(a)>0)ReadableStreamFulfillReadRequest(a,r,!1);else{var i=void 0;try{i=t._strategySizeAlgorithm(r)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}try{EnqueueValueWithSize(t,r,i)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}}ReadableStreamDefaultControllerCallPullIfNeeded(t)}}function ReadableStreamDefaultControllerError(t,r){var a=t._controlledReadableStream;if("readable"===a._state){ResetQueue(t);ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamError(a,r)}}function ReadableStreamDefaultControllerGetDesiredSize(t){var r=t._controlledReadableStream._state;return"errored"===r?null:"closed"===r?0:t._strategyHWM-t._queueTotalSize}function ReadableStreamDefaultControllerCanCloseOrEnqueue(t){var r=t._controlledReadableStream._state;return!t._closeRequested&&"readable"===r}function SetUpReadableStreamDefaultController(t,r,a,i,o,l,u){r._controlledReadableStream=t;r._queue=void 0;r._queueTotalSize=void 0;ResetQueue(r);r._started=!1;r._closeRequested=!1;r._pullAgain=!1;r._pulling=!1;r._strategySizeAlgorithm=u;r._strategyHWM=l;r._pullAlgorithm=i;r._cancelAlgorithm=o;t._readableStreamController=r;uponPromise(promiseResolvedWith(a()),(function(){r._started=!0;ReadableStreamDefaultControllerCallPullIfNeeded(r)}),(function(t){ReadableStreamDefaultControllerError(r,t)}))}function defaultControllerBrandCheckException$1(t){return new TypeError("ReadableStreamDefaultController.prototype."+t+" can only be used on a ReadableStreamDefaultController")}function ReadableStreamTee(t,r){return IsReadableByteStreamController(t._readableStreamController)?function ReadableByteStreamTee(t){var r,a,i,o,l,u=AcquireReadableStreamDefaultReader(t),c=!1,h=!1,p=!1,m=newPromise((function(t){l=t}));function forwardReaderError(t){uponRejection(t._closedPromise,(function(r){if(t===u){ReadableByteStreamControllerError(i._readableStreamController,r);ReadableByteStreamControllerError(o._readableStreamController,r);h&&p||l(void 0)}}))}function pullWithDefaultReader(){if(IsReadableStreamBYOBReader(u)){ReadableStreamReaderGenericRelease(u);forwardReaderError(u=AcquireReadableStreamDefaultReader(t))}ReadableStreamDefaultReaderRead(u,{_chunkSteps:function(r){d((function(){c=!1;var a=r,u=r;if(!h&&!p)try{u=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(i._readableStreamController,r);ReadableByteStreamControllerError(o._readableStreamController,r);l(ReadableStreamCancel(t,r));return}h||ReadableByteStreamControllerEnqueue(i._readableStreamController,a);p||ReadableByteStreamControllerEnqueue(o._readableStreamController,u)}))},_closeSteps:function(){c=!1;h||ReadableByteStreamControllerClose(i._readableStreamController);p||ReadableByteStreamControllerClose(o._readableStreamController);i._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(i._readableStreamController,0);o._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(o._readableStreamController,0);h&&p||l(void 0)},_errorSteps:function(){c=!1}})}function pullWithBYOBReader(r,a){if(IsReadableStreamDefaultReader(u)){ReadableStreamReaderGenericRelease(u);forwardReaderError(u=AcquireReadableStreamBYOBReader(t))}var m=a?o:i,g=a?i:o;ReadableStreamBYOBReaderRead(u,r,{_chunkSteps:function(r){d((function(){c=!1;var i=a?p:h;if(a?h:p)i||ReadableByteStreamControllerRespondWithNewView(m._readableStreamController,r);else{var o=void 0;try{o=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(m._readableStreamController,r);ReadableByteStreamControllerError(g._readableStreamController,r);l(ReadableStreamCancel(t,r));return}i||ReadableByteStreamControllerRespondWithNewView(m._readableStreamController,r);ReadableByteStreamControllerEnqueue(g._readableStreamController,o)}}))},_closeSteps:function(t){c=!1;var r=a?p:h,i=a?h:p;r||ReadableByteStreamControllerClose(m._readableStreamController);i||ReadableByteStreamControllerClose(g._readableStreamController);if(void 0!==t){r||ReadableByteStreamControllerRespondWithNewView(m._readableStreamController,t);!i&&g._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(g._readableStreamController,0)}r&&i||l(void 0)},_errorSteps:function(){c=!1}})}function pull1Algorithm(){if(c)return promiseResolvedWith(void 0);c=!0;var t=ReadableByteStreamControllerGetBYOBRequest(i._readableStreamController);null===t?pullWithDefaultReader():pullWithBYOBReader(t._view,!1);return promiseResolvedWith(void 0)}function pull2Algorithm(){if(c)return promiseResolvedWith(void 0);c=!0;var t=ReadableByteStreamControllerGetBYOBRequest(o._readableStreamController);null===t?pullWithDefaultReader():pullWithBYOBReader(t._view,!0);return promiseResolvedWith(void 0)}function cancel1Algorithm(i){h=!0;r=i;if(p){var o=CreateArrayFromList([r,a]),u=ReadableStreamCancel(t,o);l(u)}return m}function cancel2Algorithm(i){p=!0;a=i;if(h){var o=CreateArrayFromList([r,a]),u=ReadableStreamCancel(t,o);l(u)}return m}function startAlgorithm(){}i=CreateReadableByteStream(startAlgorithm,pull1Algorithm,cancel1Algorithm);o=CreateReadableByteStream(startAlgorithm,pull2Algorithm,cancel2Algorithm);forwardReaderError(u);return[i,o]}(t):function ReadableStreamDefaultTee(t,r){var a,i,o,l,u,c=AcquireReadableStreamDefaultReader(t),h=!1,p=!1,m=!1,g=newPromise((function(t){u=t}));function pullAlgorithm(){if(h)return promiseResolvedWith(void 0);h=!0;ReadableStreamDefaultReaderRead(c,{_chunkSteps:function(t){d((function(){h=!1;var r=t,a=t;p||ReadableStreamDefaultControllerEnqueue(o._readableStreamController,r);m||ReadableStreamDefaultControllerEnqueue(l._readableStreamController,a)}))},_closeSteps:function(){h=!1;p||ReadableStreamDefaultControllerClose(o._readableStreamController);m||ReadableStreamDefaultControllerClose(l._readableStreamController);p&&m||u(void 0)},_errorSteps:function(){h=!1}});return promiseResolvedWith(void 0)}function cancel1Algorithm(r){p=!0;a=r;if(m){var o=CreateArrayFromList([a,i]),l=ReadableStreamCancel(t,o);u(l)}return g}function cancel2Algorithm(r){m=!0;i=r;if(p){var o=CreateArrayFromList([a,i]),l=ReadableStreamCancel(t,o);u(l)}return g}function startAlgorithm(){}o=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel1Algorithm);l=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel2Algorithm);uponRejection(c._closedPromise,(function(t){ReadableStreamDefaultControllerError(o._readableStreamController,t);ReadableStreamDefaultControllerError(l._readableStreamController,t);p&&m||u(void 0)}));return[o,l]}(t)}function convertUnderlyingSourceCancelCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertUnderlyingSourcePullCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertUnderlyingSourceStartCallback(t,r,a){assertFunction(t,a);return function(a){return reflectCall(t,r,[a])}}function convertReadableStreamType(t,r){if("bytes"!=(t=""+t))throw new TypeError(r+" '"+t+"' is not a valid enumeration value for ReadableStreamType");return t}function convertReadableStreamReaderMode(t,r){if("byob"!=(t=""+t))throw new TypeError(r+" '"+t+"' is not a valid enumeration value for ReadableStreamReaderMode");return t}function convertPipeOptions(t,r){assertDictionary(t,r);var a=null==t?void 0:t.preventAbort,i=null==t?void 0:t.preventCancel,o=null==t?void 0:t.preventClose,l=null==t?void 0:t.signal;void 0!==l&&function assertAbortSignal(t,r){if(!function isAbortSignal(t){if("object"!=typeof t||null===t)return!1;try{return"boolean"==typeof t.aborted}catch(t){return!1}}(t))throw new TypeError(r+" is not an AbortSignal.")}(l,r+" has member 'signal' that");return{preventAbort:Boolean(a),preventCancel:Boolean(i),preventClose:Boolean(o),signal:l}}var N=function(){function ReadableStream(t,r){void 0===t&&(t={});void 0===r&&(r={});void 0===t?t=null:assertObject(t,"First parameter");var a=convertQueuingStrategy(r,"Second parameter"),i=function convertUnderlyingDefaultOrByteSource(t,r){assertDictionary(t,r);var a=t,i=null==a?void 0:a.autoAllocateChunkSize,o=null==a?void 0:a.cancel,l=null==a?void 0:a.pull,u=null==a?void 0:a.start,c=null==a?void 0:a.type;return{autoAllocateChunkSize:void 0===i?void 0:convertUnsignedLongLongWithEnforceRange(i,r+" has member 'autoAllocateChunkSize' that"),cancel:void 0===o?void 0:convertUnderlyingSourceCancelCallback(o,a,r+" has member 'cancel' that"),pull:void 0===l?void 0:convertUnderlyingSourcePullCallback(l,a,r+" has member 'pull' that"),start:void 0===u?void 0:convertUnderlyingSourceStartCallback(u,a,r+" has member 'start' that"),type:void 0===c?void 0:convertReadableStreamType(c,r+" has member 'type' that")}}(t,"First parameter");InitializeReadableStream(this);if("bytes"===i.type){if(void 0!==a.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function SetUpReadableByteStreamControllerFromUnderlyingSource(t,r,a){var i=Object.create(x.prototype),startAlgorithm=function(){},pullAlgorithm=function(){return promiseResolvedWith(void 0)},cancelAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.start&&(startAlgorithm=function(){return r.start(i)});void 0!==r.pull&&(pullAlgorithm=function(){return r.pull(i)});void 0!==r.cancel&&(cancelAlgorithm=function(t){return r.cancel(t)});var o=r.autoAllocateChunkSize;if(0===o)throw new TypeError("autoAllocateChunkSize must be greater than 0");SetUpReadableByteStreamController(t,i,startAlgorithm,pullAlgorithm,cancelAlgorithm,a,o)}(this,i,ExtractHighWaterMark(a,0))}else{var o=ExtractSizeAlgorithm(a);!function SetUpReadableStreamDefaultControllerFromUnderlyingSource(t,r,a,i){var o=Object.create(W.prototype),startAlgorithm=function(){},pullAlgorithm=function(){return promiseResolvedWith(void 0)},cancelAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.start&&(startAlgorithm=function(){return r.start(o)});void 0!==r.pull&&(pullAlgorithm=function(){return r.pull(o)});void 0!==r.cancel&&(cancelAlgorithm=function(t){return r.cancel(t)});SetUpReadableStreamDefaultController(t,o,startAlgorithm,pullAlgorithm,cancelAlgorithm,a,i)}(this,i,ExtractHighWaterMark(a,1),o)}}Object.defineProperty(ReadableStream.prototype,"locked",{get:function(){if(!IsReadableStream(this))throw streamBrandCheckException$1("locked");return IsReadableStreamLocked(this)},enumerable:!1,configurable:!0});ReadableStream.prototype.cancel=function(t){void 0===t&&(t=void 0);return IsReadableStream(this)?IsReadableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader")):ReadableStreamCancel(this,t):promiseRejectedWith(streamBrandCheckException$1("cancel"))};ReadableStream.prototype.getReader=function(t){void 0===t&&(t=void 0);if(!IsReadableStream(this))throw streamBrandCheckException$1("getReader");return void 0===function convertReaderOptions(t,r){assertDictionary(t,r);var a=null==t?void 0:t.mode;return{mode:void 0===a?void 0:convertReadableStreamReaderMode(a,r+" has member 'mode' that")}}(t,"First parameter").mode?AcquireReadableStreamDefaultReader(this):AcquireReadableStreamBYOBReader(this)};ReadableStream.prototype.pipeThrough=function(t,r){void 0===r&&(r={});if(!IsReadableStream(this))throw streamBrandCheckException$1("pipeThrough");assertRequiredArgument(t,1,"pipeThrough");var a=function convertReadableWritablePair(t,r){assertDictionary(t,r);var a=null==t?void 0:t.readable;assertRequiredField(a,"readable","ReadableWritablePair");assertReadableStream(a,r+" has member 'readable' that");var i=null==t?void 0:t.writable;assertRequiredField(i,"writable","ReadableWritablePair");assertWritableStream(i,r+" has member 'writable' that");return{readable:a,writable:i}}(t,"First parameter"),i=convertPipeOptions(r,"Second parameter");if(IsReadableStreamLocked(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(IsWritableStreamLocked(a.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");setPromiseIsHandledToTrue(ReadableStreamPipeTo(this,a.writable,i.preventClose,i.preventAbort,i.preventCancel,i.signal));return a.readable};ReadableStream.prototype.pipeTo=function(t,r){void 0===r&&(r={});if(!IsReadableStream(this))return promiseRejectedWith(streamBrandCheckException$1("pipeTo"));if(void 0===t)return promiseRejectedWith("Parameter 1 is required in 'pipeTo'.");if(!IsWritableStream(t))return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var a;try{a=convertPipeOptions(r,"Second parameter")}catch(t){return promiseRejectedWith(t)}return IsReadableStreamLocked(this)?promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):IsWritableStreamLocked(t)?promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ReadableStreamPipeTo(this,t,a.preventClose,a.preventAbort,a.preventCancel,a.signal)};ReadableStream.prototype.tee=function(){if(!IsReadableStream(this))throw streamBrandCheckException$1("tee");return CreateArrayFromList(ReadableStreamTee(this))};ReadableStream.prototype.values=function(t){void 0===t&&(t=void 0);if(!IsReadableStream(this))throw streamBrandCheckException$1("values");return function AcquireReadableStreamAsyncIterator(t,r){var a=AcquireReadableStreamDefaultReader(t),i=new P(a,r),o=Object.create(k);o._asyncIteratorImpl=i;return o}(this,function convertIteratorOptions(t,r){assertDictionary(t,r);var a=null==t?void 0:t.preventCancel;return{preventCancel:Boolean(a)}}(t,"First parameter").preventCancel)};return ReadableStream}();Object.defineProperties(N.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(N.prototype,r.toStringTag,{value:"ReadableStream",configurable:!0});"symbol"==typeof r.asyncIterator&&Object.defineProperty(N.prototype,r.asyncIterator,{value:N.prototype.values,writable:!0,configurable:!0});function CreateReadableStream(t,r,a,i,o){void 0===i&&(i=1);void 0===o&&(o=function(){return 1});var l=Object.create(N.prototype);InitializeReadableStream(l);SetUpReadableStreamDefaultController(l,Object.create(W.prototype),t,r,a,i,o);return l}function CreateReadableByteStream(t,r,a){var i=Object.create(N.prototype);InitializeReadableStream(i);SetUpReadableByteStreamController(i,Object.create(x.prototype),t,r,a,0,void 0);return i}function InitializeReadableStream(t){t._state="readable";t._reader=void 0;t._storedError=void 0;t._disturbed=!1}function IsReadableStream(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readableStreamController")&&t instanceof N}function IsReadableStreamLocked(t){return void 0!==t._reader}function ReadableStreamCancel(t,r){t._disturbed=!0;if("closed"===t._state)return promiseResolvedWith(void 0);if("errored"===t._state)return promiseRejectedWith(t._storedError);ReadableStreamClose(t);var a=t._reader;if(void 0!==a&&IsReadableStreamBYOBReader(a)){a._readIntoRequests.forEach((function(t){t._closeSteps(void 0)}));a._readIntoRequests=new h}return transformPromiseWith(t._readableStreamController[g](r),noop)}function ReadableStreamClose(t){t._state="closed";var r=t._reader;if(void 0!==r){defaultReaderClosedPromiseResolve(r);if(IsReadableStreamDefaultReader(r)){r._readRequests.forEach((function(t){t._closeSteps()}));r._readRequests=new h}}}function ReadableStreamError(t,r){t._state="errored";t._storedError=r;var a=t._reader;if(void 0!==a){defaultReaderClosedPromiseReject(a,r);if(IsReadableStreamDefaultReader(a)){a._readRequests.forEach((function(t){t._errorSteps(r)}));a._readRequests=new h}else{a._readIntoRequests.forEach((function(t){t._errorSteps(r)}));a._readIntoRequests=new h}}}function streamBrandCheckException$1(t){return new TypeError("ReadableStream.prototype."+t+" can only be used on a ReadableStream")}function convertQueuingStrategyInit(t,r){assertDictionary(t,r);var a=null==t?void 0:t.highWaterMark;assertRequiredField(a,"highWaterMark","QueuingStrategyInit");return{highWaterMark:convertUnrestrictedDouble(a)}}var byteLengthSizeFunction=function(t){return t.byteLength};Object.defineProperty(byteLengthSizeFunction,"name",{value:"size",configurable:!0});var j=function(){function ByteLengthQueuingStrategy(t){assertRequiredArgument(t,1,"ByteLengthQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}Object.defineProperty(ByteLengthQueuingStrategy.prototype,"highWaterMark",{get:function(){if(!IsByteLengthQueuingStrategy(this))throw byteLengthBrandCheckException("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0});Object.defineProperty(ByteLengthQueuingStrategy.prototype,"size",{get:function(){if(!IsByteLengthQueuingStrategy(this))throw byteLengthBrandCheckException("size");return byteLengthSizeFunction},enumerable:!1,configurable:!0});return ByteLengthQueuingStrategy}();Object.defineProperties(j.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(j.prototype,r.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function byteLengthBrandCheckException(t){return new TypeError("ByteLengthQueuingStrategy.prototype."+t+" can only be used on a ByteLengthQueuingStrategy")}function IsByteLengthQueuingStrategy(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_byteLengthQueuingStrategyHighWaterMark")&&t instanceof j}var countSizeFunction=function(){return 1};Object.defineProperty(countSizeFunction,"name",{value:"size",configurable:!0});var V=function(){function CountQueuingStrategy(t){assertRequiredArgument(t,1,"CountQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._countQueuingStrategyHighWaterMark=t.highWaterMark}Object.defineProperty(CountQueuingStrategy.prototype,"highWaterMark",{get:function(){if(!IsCountQueuingStrategy(this))throw countBrandCheckException("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0});Object.defineProperty(CountQueuingStrategy.prototype,"size",{get:function(){if(!IsCountQueuingStrategy(this))throw countBrandCheckException("size");return countSizeFunction},enumerable:!1,configurable:!0});return CountQueuingStrategy}();Object.defineProperties(V.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(V.prototype,r.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function countBrandCheckException(t){return new TypeError("CountQueuingStrategy.prototype."+t+" can only be used on a CountQueuingStrategy")}function IsCountQueuingStrategy(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_countQueuingStrategyHighWaterMark")&&t instanceof V}function convertTransformerFlushCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertTransformerStartCallback(t,r,a){assertFunction(t,a);return function(a){return reflectCall(t,r,[a])}}function convertTransformerTransformCallback(t,r,a){assertFunction(t,a);return function(a,i){return promiseCall(t,r,[a,i])}}var U=function(){function TransformStream(t,r,a){void 0===t&&(t={});void 0===r&&(r={});void 0===a&&(a={});void 0===t&&(t=null);var i=convertQueuingStrategy(r,"Second parameter"),o=convertQueuingStrategy(a,"Third parameter"),l=function convertTransformer(t,r){assertDictionary(t,r);var a=null==t?void 0:t.flush,i=null==t?void 0:t.readableType,o=null==t?void 0:t.start,l=null==t?void 0:t.transform,u=null==t?void 0:t.writableType;return{flush:void 0===a?void 0:convertTransformerFlushCallback(a,t,r+" has member 'flush' that"),readableType:i,start:void 0===o?void 0:convertTransformerStartCallback(o,t,r+" has member 'start' that"),transform:void 0===l?void 0:convertTransformerTransformCallback(l,t,r+" has member 'transform' that"),writableType:u}}(t,"First parameter");if(void 0!==l.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==l.writableType)throw new RangeError("Invalid writableType specified");var u,c=ExtractHighWaterMark(o,0),d=ExtractSizeAlgorithm(o),h=ExtractHighWaterMark(i,1),p=ExtractSizeAlgorithm(i);!function InitializeTransformStream(t,r,a,i,o,l){function startAlgorithm(){return r}function writeAlgorithm(r){return function TransformStreamDefaultSinkWriteAlgorithm(t,r){var a=t._transformStreamController;return t._backpressure?transformPromiseWith(t._backpressureChangePromise,(function(){var i=t._writable;if("erroring"===i._state)throw i._storedError;return TransformStreamDefaultControllerPerformTransform(a,r)})):TransformStreamDefaultControllerPerformTransform(a,r)}(t,r)}function abortAlgorithm(r){return function TransformStreamDefaultSinkAbortAlgorithm(t,r){TransformStreamError(t,r);return promiseResolvedWith(void 0)}(t,r)}function closeAlgorithm(){return function TransformStreamDefaultSinkCloseAlgorithm(t){var r=t._readable,a=t._transformStreamController,i=a._flushAlgorithm();TransformStreamDefaultControllerClearAlgorithms(a);return transformPromiseWith(i,(function(){if("errored"===r._state)throw r._storedError;ReadableStreamDefaultControllerClose(r._readableStreamController)}),(function(a){TransformStreamError(t,a);throw r._storedError}))}(t)}t._writable=function CreateWritableStream(t,r,a,i,o,l){void 0===o&&(o=1);void 0===l&&(l=function(){return 1});var u=Object.create(I.prototype);InitializeWritableStream(u);SetUpWritableStreamDefaultController(u,Object.create(L.prototype),t,r,a,i,o,l);return u}(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,a,i);function pullAlgorithm(){return function TransformStreamDefaultSourcePullAlgorithm(t){TransformStreamSetBackpressure(t,!1);return t._backpressureChangePromise}(t)}function cancelAlgorithm(r){TransformStreamErrorWritableAndUnblockWrite(t,r);return promiseResolvedWith(void 0)}t._readable=CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,o,l);t._backpressure=void 0;t._backpressureChangePromise=void 0;t._backpressureChangePromise_resolve=void 0;TransformStreamSetBackpressure(t,!0);t._transformStreamController=void 0}(this,newPromise((function(t){u=t})),h,p,c,d);!function SetUpTransformStreamDefaultControllerFromTransformer(t,r){var a=Object.create(q.prototype),transformAlgorithm=function(t){try{TransformStreamDefaultControllerEnqueue(a,t);return promiseResolvedWith(void 0)}catch(t){return promiseRejectedWith(t)}},flushAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.transform&&(transformAlgorithm=function(t){return r.transform(t,a)});void 0!==r.flush&&(flushAlgorithm=function(){return r.flush(a)});!function SetUpTransformStreamDefaultController(t,r,a,i){r._controlledTransformStream=t;t._transformStreamController=r;r._transformAlgorithm=a;r._flushAlgorithm=i}(t,a,transformAlgorithm,flushAlgorithm)}(this,l);void 0!==l.start?u(l.start(this._transformStreamController)):u(void 0)}Object.defineProperty(TransformStream.prototype,"readable",{get:function(){if(!IsTransformStream(this))throw streamBrandCheckException("readable");return this._readable},enumerable:!1,configurable:!0});Object.defineProperty(TransformStream.prototype,"writable",{get:function(){if(!IsTransformStream(this))throw streamBrandCheckException("writable");return this._writable},enumerable:!1,configurable:!0});return TransformStream}();Object.defineProperties(U.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(U.prototype,r.toStringTag,{value:"TransformStream",configurable:!0});function IsTransformStream(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_transformStreamController")&&t instanceof U}function TransformStreamError(t,r){ReadableStreamDefaultControllerError(t._readable._readableStreamController,r);TransformStreamErrorWritableAndUnblockWrite(t,r)}function TransformStreamErrorWritableAndUnblockWrite(t,r){TransformStreamDefaultControllerClearAlgorithms(t._transformStreamController);WritableStreamDefaultControllerErrorIfNeeded(t._writable._writableStreamController,r);t._backpressure&&TransformStreamSetBackpressure(t,!1)}function TransformStreamSetBackpressure(t,r){void 0!==t._backpressureChangePromise&&t._backpressureChangePromise_resolve();t._backpressureChangePromise=newPromise((function(r){t._backpressureChangePromise_resolve=r}));t._backpressure=r}var q=function(){function TransformStreamDefaultController(){throw new TypeError("Illegal constructor")}Object.defineProperty(TransformStreamDefaultController.prototype,"desiredSize",{get:function(){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("desiredSize");return ReadableStreamDefaultControllerGetDesiredSize(this._controlledTransformStream._readable._readableStreamController)},enumerable:!1,configurable:!0});TransformStreamDefaultController.prototype.enqueue=function(t){void 0===t&&(t=void 0);if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("enqueue");TransformStreamDefaultControllerEnqueue(this,t)};TransformStreamDefaultController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("error");!function TransformStreamDefaultControllerError(t,r){TransformStreamError(t._controlledTransformStream,r)}(this,t)};TransformStreamDefaultController.prototype.terminate=function(){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("terminate");!function TransformStreamDefaultControllerTerminate(t){var r=t._controlledTransformStream;ReadableStreamDefaultControllerClose(r._readable._readableStreamController);var a=new TypeError("TransformStream terminated");TransformStreamErrorWritableAndUnblockWrite(r,a)}(this)};return TransformStreamDefaultController}();Object.defineProperties(q.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(q.prototype,r.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function IsTransformStreamDefaultController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledTransformStream")&&t instanceof q}function TransformStreamDefaultControllerClearAlgorithms(t){t._transformAlgorithm=void 0;t._flushAlgorithm=void 0}function TransformStreamDefaultControllerEnqueue(t,r){var a=t._controlledTransformStream,i=a._readable._readableStreamController;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(i))throw new TypeError("Readable side is not in a state that permits enqueue");try{ReadableStreamDefaultControllerEnqueue(i,r)}catch(t){TransformStreamErrorWritableAndUnblockWrite(a,t);throw a._readable._storedError}var o=function ReadableStreamDefaultControllerHasBackpressure(t){return!ReadableStreamDefaultControllerShouldCallPull(t)}(i);o!==a._backpressure&&TransformStreamSetBackpressure(a,!0)}function TransformStreamDefaultControllerPerformTransform(t,r){return transformPromiseWith(t._transformAlgorithm(r),void 0,(function(r){TransformStreamError(t._controlledTransformStream,r);throw r}))}function defaultControllerBrandCheckException(t){return new TypeError("TransformStreamDefaultController.prototype."+t+" can only be used on a TransformStreamDefaultController")}function streamBrandCheckException(t){return new TypeError("TransformStream.prototype."+t+" can only be used on a TransformStream")}t.ByteLengthQueuingStrategy=j;t.CountQueuingStrategy=V;t.ReadableByteStreamController=x;t.ReadableStream=N;t.ReadableStreamBYOBReader=T;t.ReadableStreamBYOBRequest=A;t.ReadableStreamDefaultController=W;t.ReadableStreamDefaultReader=C;t.TransformStream=U;t.TransformStreamDefaultController=q;t.WritableStream=I;t.WritableStreamDefaultController=L;t.WritableStreamDefaultWriter=O;Object.defineProperty(t,"__esModule",{value:!0})},a(r);var a},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.BaseSVGFactory=r.BaseStandardFontDataFactory=r.BaseCMapReaderFactory=r.BaseCanvasFactory=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var l=function(){function BaseCanvasFactory(){_classCallCheck(this,BaseCanvasFactory);this.constructor===BaseCanvasFactory&&(0,o.unreachable)("Cannot initialize BaseCanvasFactory.")}_createClass(BaseCanvasFactory,[{key:"create",value:function create(t,r){if(t<=0||r<=0)throw new Error("Invalid canvas size");var a=this._createCanvas(t,r);return{canvas:a,context:a.getContext("2d")}}},{key:"reset",value:function reset(t,r,a){if(!t.canvas)throw new Error("Canvas is not specified");if(r<=0||a<=0)throw new Error("Invalid canvas size");t.canvas.width=r;t.canvas.height=a}},{key:"destroy",value:function destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0;t.canvas.height=0;t.canvas=null;t.context=null}},{key:"_createCanvas",value:function _createCanvas(t,r){(0,o.unreachable)("Abstract method `_createCanvas` called.")}}]);return BaseCanvasFactory}();r.BaseCanvasFactory=l;var u=function(){function BaseCMapReaderFactory(t){var r=t.baseUrl,a=void 0===r?null:r,i=t.isCompressed,l=void 0!==i&&i;_classCallCheck(this,BaseCMapReaderFactory);this.constructor===BaseCMapReaderFactory&&(0,o.unreachable)("Cannot initialize BaseCMapReaderFactory.");this.baseUrl=a;this.isCompressed=l}_createClass(BaseCMapReaderFactory,[{key:"fetch",value:(t=_asyncToGenerator(i.default.mark((function _callee(t){var r,a,l,u=this;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:r=t.name;if(this.baseUrl){i.next=3;break}throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');case 3:if(r){i.next=5;break}throw new Error("CMap name must be specified.");case 5:a=this.baseUrl+r+(this.isCompressed?".bcmap":"");l=this.isCompressed?o.CMapCompressionType.BINARY:o.CMapCompressionType.NONE;return i.abrupt("return",this._fetchData(a,l).catch((function(t){throw new Error("Unable to load ".concat(u.isCompressed?"binary ":"","CMap at: ").concat(a))})));case 8:case"end":return i.stop()}}),_callee,this)}))),function fetch(r){return t.apply(this,arguments)})},{key:"_fetchData",value:function _fetchData(t,r){(0,o.unreachable)("Abstract method `_fetchData` called.")}}]);var t;return BaseCMapReaderFactory}();r.BaseCMapReaderFactory=u;var c=function(){function BaseStandardFontDataFactory(t){var r=t.baseUrl,a=void 0===r?null:r;_classCallCheck(this,BaseStandardFontDataFactory);this.constructor===BaseStandardFontDataFactory&&(0,o.unreachable)("Cannot initialize BaseStandardFontDataFactory.");this.baseUrl=a}_createClass(BaseStandardFontDataFactory,[{key:"fetch",value:(t=_asyncToGenerator(i.default.mark((function _callee2(t){var r,a;return i.default.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:r=t.filename;if(this.baseUrl){i.next=3;break}throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');case 3:if(r){i.next=5;break}throw new Error("Font filename must be specified.");case 5:a="".concat(this.baseUrl).concat(r);return i.abrupt("return",this._fetchData(a).catch((function(t){throw new Error("Unable to load font data at: ".concat(a))})));case 7:case"end":return i.stop()}}),_callee2,this)}))),function fetch(r){return t.apply(this,arguments)})},{key:"_fetchData",value:function _fetchData(t){(0,o.unreachable)("Abstract method `_fetchData` called.")}}]);var t;return BaseStandardFontDataFactory}();r.BaseStandardFontDataFactory=c;var d=function(){function BaseSVGFactory(){_classCallCheck(this,BaseSVGFactory);this.constructor===BaseSVGFactory&&(0,o.unreachable)("Cannot initialize BaseSVGFactory.")}_createClass(BaseSVGFactory,[{key:"create",value:function create(t,r){if(t<=0||r<=0)throw new Error("Invalid SVG dimensions");var a=this._createSVG("svg:svg");a.setAttribute("version","1.1");a.setAttribute("width","".concat(t,"px"));a.setAttribute("height","".concat(r,"px"));a.setAttribute("preserveAspectRatio","none");a.setAttribute("viewBox","0 0 ".concat(t," ").concat(r));return a}},{key:"createElement",value:function createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}},{key:"_createSVG",value:function _createSVG(t){(0,o.unreachable)("Abstract method `_createSVG` called.")}}]);return BaseSVGFactory}();r.BaseSVGFactory=d},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.getDocument=getDocument;exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory;exports.version=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCMapReaderFactory=exports.DefaultCanvasFactory=exports.build=void 0;var _regenerator=_interopRequireDefault(__w_pdfjs_require__(2)),_util=__w_pdfjs_require__(4),_display_utils=__w_pdfjs_require__(1),_font_loader=__w_pdfjs_require__(119),_node_utils=__w_pdfjs_require__(120),_annotation_storage=__w_pdfjs_require__(122),_canvas=__w_pdfjs_require__(123),_worker_options=__w_pdfjs_require__(125),_is_node=__w_pdfjs_require__(121),_message_handler=__w_pdfjs_require__(126),_metadata=__w_pdfjs_require__(127),_optional_content_config=__w_pdfjs_require__(128),_transport_stream=__w_pdfjs_require__(129);function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=a){var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}var DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,ServiceWorkerOptions={showUnverifiedSignatures:!1};window.ServiceWorkerOptions=ServiceWorkerOptions;var DefaultCanvasFactory=_is_node.isNodeJS?_node_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;var DefaultCMapReaderFactory=_is_node.isNodeJS?_node_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;var DefaultStandardFontDataFactory=_is_node.isNodeJS?_node_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function setPDFNetworkStreamFactory(t){createPDFNetworkStream=t}function getDocument(t){var r,a=new PDFDocumentLoadingTask;if("string"==typeof t||t instanceof URL)r={url:t};else if((0,_util.isArrayBuffer)(t))r={data:t};else if(t instanceof PDFDataRangeTransport)r={range:t};else{if("object"!==_typeof(t))throw new Error("Invalid parameter in getDocument, need either string, URL, Uint8Array, or parameter object.");if(!t.url&&!t.data&&!t.range)throw new Error("Invalid parameter object: need either .data, .range or .url");r=t}var i=t.baseHref,o=Object.create(null),l=null,u=null;for(var c in r){var d=r[c];switch(c){case"url":if("undefined"!=typeof window)try{o[c]=i?new URL(d,window.location.origin+i).href:new URL(d,window.location).href;continue}catch(t){(0,_util.warn)('Cannot create valid URL: "'.concat(t,'".'))}else if("string"==typeof d||d instanceof URL){o[c]=d.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":l=d;continue;case"worker":u=d;continue;case"data":if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&d instanceof Buffer)o[c]=new Uint8Array(d);else{if(d instanceof Uint8Array)break;if("string"==typeof d)o[c]=(0,_util.stringToBytes)(d);else if("object"!==_typeof(d)||null===d||isNaN(d.length)){if(!(0,_util.isArrayBuffer)(d))throw new Error("Invalid PDF binary data: either typed array, string, or array-like object is expected in the data property.");o[c]=new Uint8Array(d)}else o[c]=new Uint8Array(d)}continue}o[c]=d}o.rangeChunkSize=o.rangeChunkSize||DEFAULT_RANGE_CHUNK_SIZE;o.CMapReaderFactory=o.CMapReaderFactory||DefaultCMapReaderFactory;o.StandardFontDataFactory=o.StandardFontDataFactory||DefaultStandardFontDataFactory;o.ignoreErrors=!0!==o.stopAtErrors;o.fontExtraProperties=!0===o.fontExtraProperties;o.pdfBug=!0===o.pdfBug;o.enableXfa=!0===o.enableXfa;("string"!=typeof o.docBaseUrl||(0,_display_utils.isDataScheme)(o.docBaseUrl))&&(o.docBaseUrl=null);Number.isInteger(o.maxImageSize)||(o.maxImageSize=-1);"boolean"!=typeof o.useWorkerFetch&&(o.useWorkerFetch=o.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&o.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory);"boolean"!=typeof o.isEvalSupported&&(o.isEvalSupported=!0);"boolean"!=typeof o.disableFontFace&&(o.disableFontFace=_is_node.isNodeJS);"boolean"!=typeof o.useSystemFonts&&(o.useSystemFonts=!_is_node.isNodeJS&&!o.disableFontFace);void 0===o.ownerDocument&&(o.ownerDocument=globalThis.document);"boolean"!=typeof o.disableRange&&(o.disableRange=!1);"boolean"!=typeof o.disableStream&&(o.disableStream=!1);"boolean"!=typeof o.disableAutoFetch&&(o.disableAutoFetch=!1);(0,_util.setVerbosityLevel)(o.verbosity);if(!u){var h={verbosity:o.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};u=h.port?PDFWorker.fromPort(h):new PDFWorker(h);a._worker=u}var p=a.docId;u.promise.then((function(){if(a.destroyed)throw new Error("Loading aborted");var t=_fetchDocument(u,o,l,p),r=new Promise((function(t){var r;l?r=new _transport_stream.PDFDataTransportStream({length:o.length,initialData:o.initialData,progressiveDone:o.progressiveDone,contentDispositionFilename:o.contentDispositionFilename,disableRange:o.disableRange,disableStream:o.disableStream},l):o.data||(r=createPDFNetworkStream({url:o.url,length:o.length,httpHeaders:o.httpHeaders,withCredentials:o.withCredentials,rangeChunkSize:o.rangeChunkSize,disableRange:o.disableRange,disableStream:o.disableStream}));t(r)}));return Promise.all([t,r]).then((function(t){var r=_slicedToArray(t,2),i=r[0],l=r[1];if(a.destroyed)throw new Error("Loading aborted");var c=new _message_handler.MessageHandler(p,i,u.port);c.postMessageTransfers=u.postMessageTransfers;var d=new WorkerTransport(c,a,l,o);a._transport=d;c.send("showUnverifiedSignatures",window.ServiceWorkerOptions.showUnverifiedSignatures);c.send("Ready",null)}))})).catch(a._capability.reject);return a}function _fetchDocument(t,r,a,i){if(t.destroyed)return Promise.reject(new Error("Worker was destroyed"));if(a){r.length=a.length;r.initialData=a.initialData;r.progressiveDone=a.progressiveDone;r.contentDispositionFilename=a.contentDispositionFilename}var o=r.cMapUrl;"Function"===o.constructor.name&&(o=o());return t.messageHandler.sendWithPromise("GetDocRequest",{docId:i,apiVersion:"2.10.562",source:{data:r.data,url:r.url,password:r.password,disableAutoFetch:r.disableAutoFetch,rangeChunkSize:r.rangeChunkSize,length:r.length},maxImageSize:r.maxImageSize,disableFontFace:r.disableFontFace,postMessageTransfers:t.postMessageTransfers,docBaseUrl:r.docBaseUrl,ignoreErrors:r.ignoreErrors,isEvalSupported:r.isEvalSupported,fontExtraProperties:r.fontExtraProperties,enableXfa:r.enableXfa,useSystemFonts:r.useSystemFonts,cMapUrl:r.useWorkerFetch?o:null,standardFontDataUrl:r.useWorkerFetch?r.standardFontDataUrl:null}).then((function(r){if(t.destroyed)throw new Error("Worker was destroyed");return r}))}var PDFDocumentLoadingTask=function PDFDocumentLoadingTaskClosure(){var t=0;return function(){function PDFDocumentLoadingTask(){_classCallCheck(this,PDFDocumentLoadingTask);this._capability=(0,_util.createPromiseCapability)();this._transport=null;this._worker=null;this.docId="d"+t++;this.destroyed=!1;this.onPassword=null;this.onProgress=null;this.onUnsupportedFeature=null}_createClass(PDFDocumentLoadingTask,[{key:"promise",get:function get(){return this._capability.promise}},{key:"destroy",value:function destroy(){var t=this;this.destroyed=!0;return(this._transport?this._transport.destroy():Promise.resolve()).then((function(){t._transport=null;if(t._worker){t._worker.destroy();t._worker=null}}))}}]);return PDFDocumentLoadingTask}()}(),PDFDataRangeTransport=function(){function PDFDataRangeTransport(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,PDFDataRangeTransport);this.length=t;this.initialData=r;this.progressiveDone=a;this.contentDispositionFilename=i;this._rangeListeners=[];this._progressListeners=[];this._progressiveReadListeners=[];this._progressiveDoneListeners=[];this._readyCapability=(0,_util.createPromiseCapability)()}_createClass(PDFDataRangeTransport,[{key:"addRangeListener",value:function addRangeListener(t){this._rangeListeners.push(t)}},{key:"addProgressListener",value:function addProgressListener(t){this._progressListeners.push(t)}},{key:"addProgressiveReadListener",value:function addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}},{key:"addProgressiveDoneListener",value:function addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}},{key:"onDataRange",value:function onDataRange(t,r){var a,i=_createForOfIteratorHelper(this._rangeListeners);try{for(i.s();!(a=i.n()).done;){(0,a.value)(t,r)}}catch(t){i.e(t)}finally{i.f()}}},{key:"onDataProgress",value:function onDataProgress(t,r){var a=this;this._readyCapability.promise.then((function(){var i,o=_createForOfIteratorHelper(a._progressListeners);try{for(o.s();!(i=o.n()).done;){(0,i.value)(t,r)}}catch(t){o.e(t)}finally{o.f()}}))}},{key:"onDataProgressiveRead",value:function onDataProgressiveRead(t){var r=this;this._readyCapability.promise.then((function(){var a,i=_createForOfIteratorHelper(r._progressiveReadListeners);try{for(i.s();!(a=i.n()).done;){(0,a.value)(t)}}catch(t){i.e(t)}finally{i.f()}}))}},{key:"onDataProgressiveDone",value:function onDataProgressiveDone(){var t=this;this._readyCapability.promise.then((function(){var r,a=_createForOfIteratorHelper(t._progressiveDoneListeners);try{for(a.s();!(r=a.n()).done;){(0,r.value)()}}catch(t){a.e(t)}finally{a.f()}}))}},{key:"transportReady",value:function transportReady(){this._readyCapability.resolve()}},{key:"requestDataRange",value:function requestDataRange(t,r){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}},{key:"abort",value:function abort(){}}]);return PDFDataRangeTransport}();exports.PDFDataRangeTransport=PDFDataRangeTransport;var PDFDocumentProxy=function(){function PDFDocumentProxy(t,r){_classCallCheck(this,PDFDocumentProxy);this._pdfInfo=t;this._transport=r;Object.defineProperty(this,"fingerprint",{get:function get(){(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead.");return this.fingerprints[0]}})}_createClass(PDFDocumentProxy,[{key:"annotationStorage",get:function get(){return this._transport.annotationStorage}},{key:"numPages",get:function get(){return this._pdfInfo.numPages}},{key:"fingerprints",get:function get(){return this._pdfInfo.fingerprints}},{key:"isPureXfa",get:function get(){return!!this._transport._htmlForXfa}},{key:"allXfaHtml",get:function get(){return this._transport._htmlForXfa}},{key:"getPage",value:function getPage(t){return this._transport.getPage(t)}},{key:"getPageIndex",value:function getPageIndex(t){return this._transport.getPageIndex(t)}},{key:"getDestinations",value:function getDestinations(){return this._transport.getDestinations()}},{key:"getDestination",value:function getDestination(t){return this._transport.getDestination(t)}},{key:"getPageLabels",value:function getPageLabels(){return this._transport.getPageLabels()}},{key:"getPageLayout",value:function getPageLayout(){return this._transport.getPageLayout()}},{key:"getPageMode",value:function getPageMode(){return this._transport.getPageMode()}},{key:"getViewerPreferences",value:function getViewerPreferences(){return this._transport.getViewerPreferences()}},{key:"getOpenAction",value:function getOpenAction(){return this._transport.getOpenAction()}},{key:"getAttachments",value:function getAttachments(){return this._transport.getAttachments()}},{key:"getJavaScript",value:function getJavaScript(){return this._transport.getJavaScript()}},{key:"getJSActions",value:function getJSActions(){return this._transport.getDocJSActions()}},{key:"getOutline",value:function getOutline(){return this._transport.getOutline()}},{key:"getOptionalContentConfig",value:function getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}},{key:"getPermissions",value:function getPermissions(){return this._transport.getPermissions()}},{key:"getMetadata",value:function getMetadata(){return this._transport.getMetadata()}},{key:"getMarkInfo",value:function getMarkInfo(){return this._transport.getMarkInfo()}},{key:"getData",value:function getData(){return this._transport.getData()}},{key:"getDownloadInfo",value:function getDownloadInfo(){return this._transport.downloadInfoCapability.promise}},{key:"getStats",value:function getStats(){return this._transport.getStats()}},{key:"cleanup",value:function cleanup(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}},{key:"destroy",value:function destroy(){return this.loadingTask.destroy()}},{key:"loadingParams",get:function get(){return this._transport.loadingParams}},{key:"loadingTask",get:function get(){return this._transport.loadingTask}},{key:"saveDocument",value:function saveDocument(){this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");return this._transport.saveDocument()}},{key:"getFieldObjects",value:function getFieldObjects(){return this._transport.getFieldObjects()}},{key:"hasJSActions",value:function hasJSActions(){return this._transport.hasJSActions()}},{key:"getCalculationOrderIds",value:function getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}]);return PDFDocumentProxy}();exports.PDFDocumentProxy=PDFDocumentProxy;var PDFPageProxy=function(){function PDFPageProxy(t,r,a,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];_classCallCheck(this,PDFPageProxy);this._pageIndex=t;this._pageInfo=r;this._ownerDocument=i;this._transport=a;this._stats=o?new _display_utils.StatTimer:null;this._pdfBug=o;this.commonObjs=a.commonObjs;this.objs=new PDFObjects;this.cleanupAfterRender=!1;this.pendingCleanup=!1;this._intentStates=new Map;this.destroyed=!1}_createClass(PDFPageProxy,[{key:"pageNumber",get:function get(){return this._pageIndex+1}},{key:"rotate",get:function get(){return this._pageInfo.rotate}},{key:"ref",get:function get(){return this._pageInfo.ref}},{key:"userUnit",get:function get(){return this._pageInfo.userUnit}},{key:"view",get:function get(){return this._pageInfo.view}},{key:"getViewport",value:function getViewport(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.scale,a=t.rotation,i=void 0===a?this.rotate:a,o=t.offsetX,l=void 0===o?0:o,u=t.offsetY,c=void 0===u?0:u,d=t.dontFlip,h=void 0!==d&&d;return new _display_utils.PageViewport({viewBox:this.view,scale:r,rotation:i,offsetX:l,offsetY:c,dontFlip:h})}},{key:"getAnnotations",value:function getAnnotations(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.intent,a=void 0===r?null:r,i="display"===a||"print"===a?a:null;if(!this._annotationsPromise||this._annotationsIntent!==i){this._annotationsPromise=this._transport.getAnnotations(this._pageIndex,i);this._annotationsIntent=i}return this._annotationsPromise}},{key:"getJSActions",value:function getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}},{key:"getXfa",value:(t=_asyncToGenerator(_regenerator.default.mark((function _callee(){var t;return _regenerator.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null);case 1:case"end":return r.stop()}}),_callee,this)}))),function getXfa(){return t.apply(this,arguments)})},{key:"render",value:function render(t){var r,a=this,i=t.canvasContext,o=t.viewport,l=t.intent,u=void 0===l?"display":l,c=t.renderInteractiveForms,d=void 0!==c&&c,h=t.transform,p=void 0===h?null:h,m=t.imageLayer,g=void 0===m?null:m,v=t.canvasFactory,y=void 0===v?null:v,b=t.background,S=void 0===b?null:b,w=t.includeAnnotationStorage,C=void 0!==w&&w,P=t.optionalContentConfigPromise,k=void 0===P?null:P;this._stats&&this._stats.time("Overall");var R="print"===u?"print":"display";this.pendingCleanup=!1;k||(k=this._transport.getOptionalContentConfig());var A=this._intentStates.get(R);if(!A){A=Object.create(null);this._intentStates.set(R,A)}if(A.streamReaderCancelTimeout){clearTimeout(A.streamReaderCancelTimeout);A.streamReaderCancelTimeout=null}var x=y||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),T=C?this._transport.annotationStorage.serializable:null;if(!A.displayReadyCapability){A.displayReadyCapability=(0,_util.createPromiseCapability)();A.operatorList={fnArray:[],argsArray:[],lastChunk:!1};this._stats&&this._stats.time("Page Request");this._pumpOperatorList({pageIndex:this._pageIndex,intent:R,renderInteractiveForms:!0===d,annotationStorage:T})}var E=function complete(t){A.renderTasks.delete(I);(a.cleanupAfterRender||"print"===R)&&(a.pendingCleanup=!0);a._tryCleanup();if(t){I.capability.reject(t);a._abortOperatorList({intentState:A,reason:t})}else I.capability.resolve();if(a._stats){a._stats.timeEnd("Rendering");a._stats.timeEnd("Overall")}},I=new InternalRenderTask({callback:E,params:{canvasContext:i,viewport:o,transform:p,imageLayer:g,background:S},objs:this.objs,commonObjs:this.commonObjs,operatorList:A.operatorList,pageIndex:this._pageIndex,canvasFactory:x,useRequestAnimationFrame:"print"!==R,pdfBug:this._pdfBug});((r=A).renderTasks||(r.renderTasks=new Set)).add(I);var O=I.task;Promise.all([A.displayReadyCapability.promise,k]).then((function(t){var r=_slicedToArray(t,2),i=r[0],o=r[1];if(a.pendingCleanup)E();else{a._stats&&a._stats.time("Rendering");I.initializeGraphics({transparency:i,optionalContentConfig:o});I.operatorListChanged()}})).catch(E);return O}},{key:"getOperatorList",value:function getOperatorList(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.intent,a=void 0===r?"display":r;function operatorListChanged(){if(l.operatorList.lastChunk){l.opListReadCapability.resolve(l.operatorList);l.renderTasks.delete(i)}}var i,o="oplist-".concat("print"===a?"print":"display"),l=this._intentStates.get(o);if(!l){l=Object.create(null);this._intentStates.set(o,l)}if(!l.opListReadCapability){var u;(i=Object.create(null)).operatorListChanged=operatorListChanged;l.opListReadCapability=(0,_util.createPromiseCapability)();((u=l).renderTasks||(u.renderTasks=new Set)).add(i);l.operatorList={fnArray:[],argsArray:[],lastChunk:!1};this._stats&&this._stats.time("Page Request");this._pumpOperatorList({pageIndex:this._pageIndex,intent:o})}return l.opListReadCapability.promise}},{key:"streamTextContent",value:function streamTextContent(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.normalizeWhitespace,a=void 0!==r&&r,i=t.disableCombineTextItems,o=void 0!==i&&i,l=t.includeMarkedContent,u=void 0!==l&&l,c=100;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,normalizeWhitespace:!0===a,combineTextItems:!0!==o,includeMarkedContent:!0===u},{highWaterMark:c,size:function size(t){return t.items.length}})}},{key:"getTextContent",value:function getTextContent(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.streamTextContent(t);return new Promise((function(t,a){var i=r.getReader(),o={items:[],styles:Object.create(null)};!function pump(){i.read().then((function(r){var a,i=r.value;if(r.done)t(o);else{Object.assign(o.styles,i.styles);(a=o.items).push.apply(a,_toConsumableArray(i.items));pump()}}),a)}()}))}},{key:"getStructTree",value:function getStructTree(){return this._structTreePromise||(this._structTreePromise=this._transport.getStructTree(this._pageIndex))}},{key:"_destroy",value:function _destroy(){this.destroyed=!0;this._transport.pageCache[this._pageIndex]=null;var t,r=[],a=_createForOfIteratorHelper(this._intentStates);try{for(a.s();!(t=a.n()).done;){var i=_slicedToArray(t.value,2),o=i[0],l=i[1];this._abortOperatorList({intentState:l,reason:new Error("Page was destroyed."),force:!0});if(!o.startsWith("oplist-")){var u,c=_createForOfIteratorHelper(l.renderTasks);try{for(c.s();!(u=c.n()).done;){var d=u.value;r.push(d.completed);d.cancel()}}catch(t){c.e(t)}finally{c.f()}}}}catch(t){a.e(t)}finally{a.f()}this.objs.clear();this._annotationsPromise=null;this._jsActionsPromise=null;this._structTreePromise=null;this.pendingCleanup=!1;return Promise.all(r)}},{key:"cleanup",value:function cleanup(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.pendingCleanup=!0;this._tryCleanup(t)||(this.cleanupAfterRender=!0);return!0}},{key:"_tryCleanup",value:function _tryCleanup(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pendingCleanup)return!1;var r,a=_createForOfIteratorHelper(this._intentStates.values());try{for(a.s();!(r=a.n()).done;){var i=r.value,o=i.renderTasks,l=i.operatorList;if(o.size>0||!l.lastChunk)return!1}}catch(t){a.e(t)}finally{a.f()}this._intentStates.clear();this.objs.clear();this._annotationsPromise=null;this._jsActionsPromise=null;this._structTreePromise=null;t&&this._stats&&(this._stats=new _display_utils.StatTimer);this.pendingCleanup=!1;return!0}},{key:"_startRenderPage",value:function _startRenderPage(t,r){var a=this._intentStates.get(r);if(a){this._stats&&this._stats.timeEnd("Page Request");a.displayReadyCapability&&a.displayReadyCapability.resolve(t)}}},{key:"_renderPageChunk",value:function _renderPageChunk(t,r){for(var a=0,i=t.length;a<i;a++){r.operatorList.fnArray.push(t.fnArray[a]);r.operatorList.argsArray.push(t.argsArray[a])}r.operatorList.lastChunk=t.lastChunk;var o,l=_createForOfIteratorHelper(r.renderTasks);try{for(l.s();!(o=l.n()).done;){o.value.operatorListChanged()}}catch(t){l.e(t)}finally{l.f()}t.lastChunk&&this._tryCleanup()}},{key:"_pumpOperatorList",value:function _pumpOperatorList(t){var r=this;(0,_util.assert)(t.intent,'PDFPageProxy._pumpOperatorList: Expected "intent" argument.');var a=this._transport.messageHandler.sendWithStream("GetOperatorList",t).getReader(),i=this._intentStates.get(t.intent);i.streamReader=a;!function pump(){a.read().then((function(t){var a=t.value;if(t.done)i.streamReader=null;else if(!r._transport.destroyed){r._renderPageChunk(a,i);pump()}}),(function(t){i.streamReader=null;if(!r._transport.destroyed){if(i.operatorList){i.operatorList.lastChunk=!0;var a,o=_createForOfIteratorHelper(i.renderTasks);try{for(o.s();!(a=o.n()).done;){a.value.operatorListChanged()}}catch(t){o.e(t)}finally{o.f()}r._tryCleanup()}if(i.displayReadyCapability)i.displayReadyCapability.reject(t);else{if(!i.opListReadCapability)throw t;i.opListReadCapability.reject(t)}}}))}()}},{key:"_abortOperatorList",value:function _abortOperatorList(t){var r=this,a=t.intentState,i=t.reason,o=t.force,l=void 0!==o&&o;(0,_util.assert)(i instanceof Error||"object"===_typeof(i)&&null!==i,'PDFPageProxy._abortOperatorList: Expected "reason" argument.');if(a.streamReader){if(!l){if(a.renderTasks.size>0)return;if(i instanceof _display_utils.RenderingCancelledException){a.streamReaderCancelTimeout=setTimeout((function(){r._abortOperatorList({intentState:a,reason:i,force:!0});a.streamReaderCancelTimeout=null}),RENDERING_CANCELLED_TIMEOUT);return}}a.streamReader.cancel(new _util.AbortException(null==i?void 0:i.message));a.streamReader=null;if(!this._transport.destroyed){var u,c=_createForOfIteratorHelper(this._intentStates);try{for(c.s();!(u=c.n()).done;){var d=_slicedToArray(u.value,2),h=d[0];if(d[1]===a){this._intentStates.delete(h);break}}}catch(t){c.e(t)}finally{c.f()}this.cleanup()}}}},{key:"stats",get:function get(){return this._stats}}]);var t;return PDFPageProxy}();exports.PDFPageProxy=PDFPageProxy;var LoopbackPort=function(){function LoopbackPort(){_classCallCheck(this,LoopbackPort);this._listeners=[];this._deferred=Promise.resolve(void 0)}_createClass(LoopbackPort,[{key:"postMessage",value:function postMessage(t,r){var a=this;var i=new WeakMap,o={data:function cloneValue(t){if("function"==typeof t||"symbol"===_typeof(t)||t instanceof URL)throw new Error("LoopbackPort.postMessage - cannot clone: ".concat(null==t?void 0:t.toString()));if("object"!==_typeof(t)||null===t)return t;if(i.has(t))return i.get(t);var a,o;if((a=t.buffer)&&(0,_util.isArrayBuffer)(a)){o=null!=r&&r.includes(a)?new t.constructor(a,t.byteOffset,t.byteLength):new t.constructor(t);i.set(t,o);return o}if(t instanceof Map){o=new Map;i.set(t,o);var l,u=_createForOfIteratorHelper(t);try{for(u.s();!(l=u.n()).done;){var c=_slicedToArray(l.value,2),d=c[0],h=c[1];o.set(d,cloneValue(h))}}catch(t){u.e(t)}finally{u.f()}return o}if(t instanceof Set){o=new Set;i.set(t,o);var p,m=_createForOfIteratorHelper(t);try{for(m.s();!(p=m.n()).done;){var g=p.value;o.add(cloneValue(g))}}catch(t){m.e(t)}finally{m.f()}return o}o=Array.isArray(t)?[]:Object.create(null);i.set(t,o);for(var v in t){for(var y=void 0,b=t;!(y=Object.getOwnPropertyDescriptor(b,v));)b=Object.getPrototypeOf(b);if(void 0!==y.value){if("function"==typeof y.value){var S;if("cMapUrl"===v)o[v]=cloneValue(y.value());else if(null===(S=t.hasOwnProperty)||void 0===S||!S.call(t,v))continue}o[v]=cloneValue(y.value)}}return o}(t)};this._deferred.then((function(){var t,r=_createForOfIteratorHelper(a._listeners);try{for(r.s();!(t=r.n()).done;){t.value.call(a,o)}}catch(t){r.e(t)}finally{r.f()}}))}},{key:"addEventListener",value:function addEventListener(t,r){this._listeners.push(r)}},{key:"removeEventListener",value:function removeEventListener(t,r){var a=this._listeners.indexOf(r);this._listeners.splice(a,1)}},{key:"terminate",value:function terminate(){this._listeners.length=0}}]);return LoopbackPort}();exports.LoopbackPort=LoopbackPort;var PDFWorker=function PDFWorkerClosure(){var pdfWorkerPorts=new WeakMap,isWorkerDisabled=!1,fallbackWorkerSrc,nextFakeWorkerId=0,fakeWorkerCapability;if(_is_node.isNodeJS&&"function"==typeof require){isWorkerDisabled=!0;fallbackWorkerSrc="./pdf.worker.js"}else if("object"===("undefined"==typeof document?"undefined":_typeof(document))&&"currentScript"in document){var _document$currentScri,pdfjsFilePath=null===(_document$currentScri=document.currentScript)||void 0===_document$currentScri?void 0:_document$currentScri.src;pdfjsFilePath&&(fallbackWorkerSrc=pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}function _getWorkerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return"Function"===_worker_options.GlobalWorkerOptions.workerSrc.constructor.name?_worker_options.GlobalWorkerOptions.workerSrc():_worker_options.GlobalWorkerOptions.workerSrc;if(void 0!==fallbackWorkerSrc){_is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');return fallbackWorkerSrc}throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}function getMainThreadWorkerMessageHandler(){var t;try{var r;t=null===(r=globalThis.pdfjsWorker)||void 0===r?void 0:r.WorkerMessageHandler}catch(t){}return t||null}function setupFakeWorkerGlobal(){if(fakeWorkerCapability)return fakeWorkerCapability.promise;fakeWorkerCapability=(0,_util.createPromiseCapability)();var loader=function(){var _ref13=_asyncToGenerator(_regenerator.default.mark((function _callee2(){var mainWorkerMessageHandler,worker;return _regenerator.default.wrap((function _callee2$(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:mainWorkerMessageHandler=getMainThreadWorkerMessageHandler();if(!mainWorkerMessageHandler){_context2.next=3;break}return _context2.abrupt("return",mainWorkerMessageHandler);case 3:if(!_is_node.isNodeJS||"function"!=typeof require){_context2.next=6;break}worker=eval("require")(_getWorkerSrc());return _context2.abrupt("return",worker.WorkerMessageHandler);case 6:_context2.next=8;return(0,_display_utils.loadScript)(_getWorkerSrc());case 8:return _context2.abrupt("return",window.pdfjsWorker.WorkerMessageHandler);case 9:case"end":return _context2.stop()}}),_callee2)})));return function loader(){return _ref13.apply(this,arguments)}}();loader().then(fakeWorkerCapability.resolve,fakeWorkerCapability.reject);return fakeWorkerCapability.promise}function createCDNWrapper(t){var r="importScripts('"+t+"');";return URL.createObjectURL(new Blob([r]))}var PDFWorker=function(){function PDFWorker(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.name,a=void 0===r?null:r,i=t.port,o=void 0===i?null:i,l=t.verbosity,u=void 0===l?(0,_util.getVerbosityLevel)():l;_classCallCheck(this,PDFWorker);if(o&&pdfWorkerPorts.has(o))throw new Error("Cannot use more than one PDFWorker per port");this.name=a;this.destroyed=!1;this.postMessageTransfers=!0;this.verbosity=u;this._readyCapability=(0,_util.createPromiseCapability)();this._port=null;this._webWorker=null;this._messageHandler=null;if(o){pdfWorkerPorts.set(o,this);this._initializeFromPort(o)}else this._initialize()}_createClass(PDFWorker,[{key:"promise",get:function get(){return this._readyCapability.promise}},{key:"port",get:function get(){return this._port}},{key:"messageHandler",get:function get(){return this._messageHandler}},{key:"_initializeFromPort",value:function _initializeFromPort(t){this._port=t;this._messageHandler=new _message_handler.MessageHandler("main","worker",t);this._messageHandler.on("ready",(function(){}));this._readyCapability.resolve()}},{key:"_initialize",value:function _initialize(){var t=this;if("undefined"!=typeof Worker&&!isWorkerDisabled&&!getMainThreadWorkerMessageHandler()){var r=_getWorkerSrc();try{(0,_util.isSameOrigin)(window.location.href,r)||(r=createCDNWrapper(new URL(r,window.location).href));var a=new Worker(r),i=new _message_handler.MessageHandler("main","worker",a),o=function terminateEarly(){a.removeEventListener("error",l);i.destroy();a.terminate();t.destroyed?t._readyCapability.reject(new Error("Worker was destroyed")):t._setupFakeWorker()},l=function onWorkerError(){t._webWorker||o()};a.addEventListener("error",l);i.on("test",(function(r){a.removeEventListener("error",l);if(t.destroyed)o();else if(r){t._messageHandler=i;t._port=a;t._webWorker=a;r.supportTransfers||(t.postMessageTransfers=!1);t._readyCapability.resolve();i.send("configure",{verbosity:t.verbosity})}else{t._setupFakeWorker();i.destroy();a.terminate()}}));i.on("ready",(function(r){a.removeEventListener("error",l);if(t.destroyed)o();else try{u()}catch(r){t._setupFakeWorker()}}));var u=function sendTest(){var r=new Uint8Array([t.postMessageTransfers?255:0]);try{i.send("test",r,[r.buffer])}catch(t){(0,_util.warn)("Cannot use postMessage transfers.");r[0]=0;i.send("test",r)}};u();return}catch(t){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}},{key:"_setupFakeWorker",value:function _setupFakeWorker(){var t=this;if(!isWorkerDisabled){(0,_util.warn)("Setting up fake worker.");isWorkerDisabled=!0}setupFakeWorkerGlobal().then((function(r){if(t.destroyed)t._readyCapability.reject(new Error("Worker was destroyed"));else{var a=new LoopbackPort;t._port=a;var i="fake"+nextFakeWorkerId++,o=new _message_handler.MessageHandler(i+"_worker",i,a);r.setup(o,a);var l=new _message_handler.MessageHandler(i,i+"_worker",a);t._messageHandler=l;t._readyCapability.resolve();l.send("configure",{verbosity:t.verbosity})}})).catch((function(r){t._readyCapability.reject(new Error('Setting up fake worker failed: "'.concat(r.message,'".')))}))}},{key:"destroy",value:function destroy(){this.destroyed=!0;if(this._webWorker){this._webWorker.terminate();this._webWorker=null}pdfWorkerPorts.delete(this._port);this._port=null;if(this._messageHandler){this._messageHandler.destroy();this._messageHandler=null}}}],[{key:"fromPort",value:function fromPort(t){if(!t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return pdfWorkerPorts.has(t.port)?pdfWorkerPorts.get(t.port):new PDFWorker(t)}},{key:"getWorkerSrc",value:function getWorkerSrc(){return _getWorkerSrc()}}]);return PDFWorker}();return PDFWorker}();exports.PDFWorker=PDFWorker;var WorkerTransport=function(){function WorkerTransport(t,r,a,i){_classCallCheck(this,WorkerTransport);this.messageHandler=t;this.loadingTask=r;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({docId:r.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:i.ownerDocument,styleElement:i.styleElement});this._params=i;if(!i.useWorkerFetch){var o=i.cMapUrl;"Function"===o.constructor.name&&(o=o());this.CMapReaderFactory=new i.CMapReaderFactory({baseUrl:o,isCompressed:i.cMapPacked});this.StandardFontDataFactory=new i.StandardFontDataFactory({baseUrl:i.standardFontDataUrl})}this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=a;this._fullReader=null;this._lastProgress=null;this.pageCache=[];this.pagePromises=[];this.downloadInfoCapability=(0,_util.createPromiseCapability)();this.setupMessageHandler()}_createClass(WorkerTransport,[{key:"annotationStorage",get:function get(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}},{key:"destroy",value:function destroy(){var t=this;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=(0,_util.createPromiseCapability)();this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));var r,a=[],i=_createForOfIteratorHelper(this.pageCache);try{for(i.s();!(r=i.n()).done;){var o=r.value;o&&a.push(o._destroy())}}catch(t){i.e(t)}finally{i.f()}this.pageCache.length=0;this.pagePromises.length=0;this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();var l=this.messageHandler.sendWithPromise("Terminate",null);a.push(l);Promise.all(a).then((function(){t.commonObjs.clear();t.fontLoader.clear();t._hasJSActionsPromise=null;t._networkStream&&t._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));if(t.messageHandler){t.messageHandler.destroy();t.messageHandler=null}t.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}},{key:"setupMessageHandler",value:function setupMessageHandler(){var t=this,r=this.messageHandler,a=this.loadingTask;r.on("GetReader",(function(r,a){(0,_util.assert)(t._networkStream,"GetReader - no `IPDFStream` instance available.");t._fullReader=t._networkStream.getFullReader();t._fullReader.onProgress=function(r){t._lastProgress={loaded:r.loaded,total:r.total}};a.onPull=function(){t._fullReader.read().then((function(t){var r=t.value;if(t.done)a.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(r),"GetReader - expected an ArrayBuffer.");a.enqueue(new Uint8Array(r),1,[r])}})).catch((function(t){a.error(t)}))};a.onCancel=function(r){t._fullReader.cancel(r);a.ready.catch((function(r){if(!t.destroyed)throw r}))}}));r.on("ReaderHeadersReady",(function(r){var i=(0,_util.createPromiseCapability)(),o=t._fullReader;o.headersReady.then((function(){if(!o.isStreamingSupported||!o.isRangeSupported){t._lastProgress&&a.onProgress&&a.onProgress(t._lastProgress);o.onProgress=function(t){a.onProgress&&a.onProgress({loaded:t.loaded,total:t.total})}}i.resolve({isStreamingSupported:o.isStreamingSupported,isRangeSupported:o.isRangeSupported,contentLength:o.contentLength})}),i.reject);return i.promise}));r.on("GetRangeReader",(function(r,a){(0,_util.assert)(t._networkStream,"GetRangeReader - no `IPDFStream` instance available.");var i=t._networkStream.getRangeReader(r.begin,r.end);if(i){a.onPull=function(){i.read().then((function(t){var r=t.value;if(t.done)a.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(r),"GetRangeReader - expected an ArrayBuffer.");a.enqueue(new Uint8Array(r),1,[r])}})).catch((function(t){a.error(t)}))};a.onCancel=function(r){i.cancel(r);a.ready.catch((function(r){if(!t.destroyed)throw r}))}}else a.close()}));r.on("GetDoc",(function(r){var i=r.pdfInfo;t._numPages=i.numPages;t._htmlForXfa=i.htmlForXfa;delete i.htmlForXfa;a._capability.resolve(new PDFDocumentProxy(i,t))}));r.on("DocException",(function(t){var r;switch(t.name){case"PasswordException":r=new _util.PasswordException(t.message,t.code);break;case"InvalidPDFException":r=new _util.InvalidPDFException(t.message);break;case"MissingPDFException":r=new _util.MissingPDFException(t.message);break;case"UnexpectedResponseException":r=new _util.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":r=new _util.UnknownErrorException(t.message,t.details)}if(!(r instanceof Error)){(0,_util.warn)("DocException - expected a valid Error.")}a._capability.reject(r)}));r.on("PasswordRequest",(function(r){t._passwordCapability=(0,_util.createPromiseCapability)();if(a.onPassword){try{a.onPassword((function updatePassword(r){t._passwordCapability.resolve({password:r})}),r.code)}catch(r){t._passwordCapability.reject(r)}}else t._passwordCapability.reject(new _util.PasswordException(r.message,r.code));return t._passwordCapability.promise}));r.on("DataLoaded",(function(r){a.onProgress&&a.onProgress({loaded:r.length,total:r.length});t.downloadInfoCapability.resolve(r)}));r.on("StartRenderPage",(function(r){if(!t.destroyed){t.pageCache[r.pageIndex]._startRenderPage(r.transparency,r.intent)}}));r.on("commonobj",(function(a){var i;if(!t.destroyed){var o=_slicedToArray(a,3),l=o[0],u=o[1],c=o[2];if(!t.commonObjs.has(l))switch(u){case"Font":var d=t._params;if("error"in c){var h=c.error;(0,_util.warn)("Error during font loading: ".concat(h));t.commonObjs.resolve(l,h);break}var p=null;d.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled&&(p={registerFont:function registerFont(t,r){globalThis.FontInspector.fontAdded(t,r)}});var m=new _font_loader.FontFaceObject(c,{isEvalSupported:d.isEvalSupported,disableFontFace:d.disableFontFace,ignoreErrors:d.ignoreErrors,onUnsupportedFeature:t._onUnsupportedFeature.bind(t),fontRegistry:p});t.fontLoader.bind(m).catch((function(t){return r.sendWithPromise("FontFallback",{id:l})})).finally((function(){!d.fontExtraProperties&&m.data&&(m.data=null);t.commonObjs.resolve(l,m)}));break;case"FontPath":case"Image":t.commonObjs.resolve(l,c);break;default:throw new Error("Got unknown common object type ".concat(u))}}}));r.on("obj",(function(r){var a;if(!t.destroyed){var i=_slicedToArray(r,4),o=i[0],l=i[1],u=i[2],c=i[3],d=t.pageCache[l];if(!d.objs.has(o))switch(u){case"Image":d.objs.resolve(o,c);(null==c||null===(a=c.data)||void 0===a?void 0:a.length)>8e6&&(d.cleanupAfterRender=!0);break;case"Pattern":d.objs.resolve(o,c);break;default:throw new Error("Got unknown object type ".concat(u))}}}));r.on("DocProgress",(function(r){t.destroyed||a.onProgress&&a.onProgress({loaded:r.loaded,total:r.total})}));r.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this));r.on("FetchBuiltInCMap",(function(r){return t.destroyed?Promise.reject(new Error("Worker was destroyed.")):t.CMapReaderFactory?t.CMapReaderFactory.fetch(r):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))}));r.on("FetchStandardFontData",(function(r){return t.destroyed?Promise.reject(new Error("Worker was destroyed.")):t.StandardFontDataFactory?t.StandardFontDataFactory.fetch(r):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))}))}},{key:"_onUnsupportedFeature",value:function _onUnsupportedFeature(t){var r=t.featureId;this.destroyed||this.loadingTask.onUnsupportedFeature&&this.loadingTask.onUnsupportedFeature(r)}},{key:"getData",value:function getData(){return this.messageHandler.sendWithPromise("GetData",null)}},{key:"getPage",value:function getPage(t){var r=this;if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request"));var a=t-1;if(a in this.pagePromises)return this.pagePromises[a];var i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:a}).then((function(t){if(r.destroyed)throw new Error("Transport destroyed");var i=new PDFPageProxy(a,t,r,r._params.ownerDocument,r._params.pdfBug);r.pageCache[a]=i;return i}));this.pagePromises[a]=i;return i}},{key:"getPageIndex",value:function getPageIndex(t){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:t}).catch((function(t){return Promise.reject(new Error(t))}))}},{key:"getAnnotations",value:function getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}},{key:"saveDocument",value:function saveDocument(){var t,r,a=this;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:null!==(t=null===(r=this._fullReader)||void 0===r?void 0:r.filename)&&void 0!==t?t:null}).finally((function(){a.annotationStorage.resetModified()}))}},{key:"getFieldObjects",value:function getFieldObjects(){return this.messageHandler.sendWithPromise("GetFieldObjects",null)}},{key:"hasJSActions",value:function hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}},{key:"getCalculationOrderIds",value:function getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}},{key:"getDestinations",value:function getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}},{key:"getDestination",value:function getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}},{key:"getPageLabels",value:function getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}},{key:"getPageLayout",value:function getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}},{key:"getPageMode",value:function getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}},{key:"getViewerPreferences",value:function getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}},{key:"getOpenAction",value:function getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}},{key:"getAttachments",value:function getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}},{key:"getJavaScript",value:function getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}},{key:"getDocJSActions",value:function getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}},{key:"getPageJSActions",value:function getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}},{key:"getStructTree",value:function getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}},{key:"getOutline",value:function getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}},{key:"getOptionalContentConfig",value:function getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((function(t){return new _optional_content_config.OptionalContentConfig(t)}))}},{key:"getPermissions",value:function getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}},{key:"getMetadata",value:function getMetadata(){var t=this;return this.messageHandler.sendWithPromise("GetMetadata",null).then((function(r){var a,i,o,l;return{info:r[0],metadata:r[1]?new _metadata.Metadata(r[1]):null,contentDispositionFilename:null!==(a=null===(i=t._fullReader)||void 0===i?void 0:i.filename)&&void 0!==a?a:null,contentLength:null!==(o=null===(l=t._fullReader)||void 0===l?void 0:l.contentLength)&&void 0!==o?o:null}}))}},{key:"getMarkInfo",value:function getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}},{key:"getStats",value:function getStats(){return this.messageHandler.sendWithPromise("GetStats",null)}},{key:"startCleanup",value:(t=_asyncToGenerator(_regenerator.default.mark((function _callee3(){var t,r,a,i,o=arguments;return _regenerator.default.wrap((function _callee3$(l){for(;;)switch(l.prev=l.next){case 0:t=o.length>0&&void 0!==o[0]&&o[0];l.next=3;return this.messageHandler.sendWithPromise("Cleanup",null);case 3:if(!this.destroyed){l.next=5;break}return l.abrupt("return");case 5:r=0,a=this.pageCache.length;case 6:if(!(r<a)){l.next=16;break}if(i=this.pageCache[r]){l.next=10;break}return l.abrupt("continue",13);case 10:if(i.cleanup()){l.next=13;break}throw new Error("startCleanup: Page ".concat(r+1," is currently rendering."));case 13:r++;l.next=6;break;case 16:this.commonObjs.clear();t||this.fontLoader.clear();this._hasJSActionsPromise=null;case 19:case"end":return l.stop()}}),_callee3,this)}))),function startCleanup(){return t.apply(this,arguments)})},{key:"loadingParams",get:function get(){var t=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch})}}]);var t;return WorkerTransport}(),PDFObjects=function(){function PDFObjects(){_classCallCheck(this,PDFObjects);this._objs=Object.create(null)}_createClass(PDFObjects,[{key:"_ensureObj",value:function _ensureObj(t){return this._objs[t]?this._objs[t]:this._objs[t]={capability:(0,_util.createPromiseCapability)(),data:null,resolved:!1}}},{key:"get",value:function get(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(r){this._ensureObj(t).capability.promise.then(r);return null}var a=this._objs[t];if(!a||!a.resolved)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return a.data}},{key:"has",value:function has(t){var r=this._objs[t];return(null==r?void 0:r.resolved)||!1}},{key:"resolve",value:function resolve(t,r){var a=this._ensureObj(t);a.resolved=!0;a.data=r;a.capability.resolve(r)}},{key:"clear",value:function clear(){this._objs=Object.create(null)}}]);return PDFObjects}(),RenderTask=function(){function RenderTask(t){_classCallCheck(this,RenderTask);this._internalRenderTask=t;this.onContinue=null}_createClass(RenderTask,[{key:"promise",get:function get(){return this._internalRenderTask.capability.promise}},{key:"cancel",value:function cancel(){this._internalRenderTask.cancel()}}]);return RenderTask}(),InternalRenderTask=function InternalRenderTaskClosure(){var t=new WeakSet,r=function(){function InternalRenderTask(t){var r=t.callback,a=t.params,i=t.objs,o=t.commonObjs,l=t.operatorList,u=t.pageIndex,c=t.canvasFactory,d=t.useRequestAnimationFrame,h=void 0!==d&&d,p=t.pdfBug,m=void 0!==p&&p;_classCallCheck(this,InternalRenderTask);this.callback=r;this.params=a;this.objs=i;this.commonObjs=o;this.operatorListIdx=null;this.operatorList=l;this._pageIndex=u;this.canvasFactory=c;this._pdfBug=m;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===h&&"undefined"!=typeof window;this.cancelled=!1;this.capability=(0,_util.createPromiseCapability)();this.task=new RenderTask(this);this._cancelBound=this.cancel.bind(this);this._continueBound=this._continue.bind(this);this._scheduleNextBound=this._scheduleNext.bind(this);this._nextBound=this._next.bind(this);this._canvas=a.canvasContext.canvas}_createClass(InternalRenderTask,[{key:"completed",get:function get(){return this.capability.promise.catch((function(){}))}},{key:"initializeGraphics",value:function initializeGraphics(r){var a,i=r.transparency,o=void 0!==i&&i,l=r.optionalContentConfig;if(!this.cancelled){if(this._canvas){if(t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");t.add(this._canvas)}if(this._pdfBug&&null!==(a=globalThis.StepperManager)&&void 0!==a&&a.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}var u=this.params,c=u.canvasContext,d=u.viewport,h=u.transform,p=u.imageLayer,m=u.background;this.gfx=new _canvas.CanvasGraphics(c,this.commonObjs,this.objs,this.canvasFactory,p,l);this.gfx.beginDrawing({transform:h,viewport:d,transparency:o,background:m});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback&&this.graphicsReadyCallback()}}},{key:"cancel",value:function cancel(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.running=!1;this.cancelled=!0;this.gfx&&this.gfx.endDrawing();this._canvas&&t.delete(this._canvas);this.callback(r||new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex+1),"canvas"))}},{key:"operatorListChanged",value:function operatorListChanged(){if(this.graphicsReady){this.stepper&&this.stepper.updateOperatorList(this.operatorList);this.running||this._continue()}else this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}},{key:"_continue",value:function _continue(){this.running=!0;this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}},{key:"_scheduleNext",value:function _scheduleNext(){var t=this;this._useRequestAnimationFrame?window.requestAnimationFrame((function(){t._nextBound().catch(t._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}},{key:"_next",value:(r=_asyncToGenerator(_regenerator.default.mark((function _callee4(){return _regenerator.default.wrap((function _callee4$(r){for(;;)switch(r.prev=r.next){case 0:if(!this.cancelled){r.next=2;break}return r.abrupt("return");case 2:this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing();this._canvas&&t.delete(this._canvas);this.callback()}}case 4:case"end":return r.stop()}}),_callee4,this)}))),function _next(){return r.apply(this,arguments)})}]);var r;return InternalRenderTask}();return r}(),version="2.10.562";exports.version=version;var build="96780ddc8";exports.build=build},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.FontLoader=r.FontFaceObject=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4);function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var l,u=function(){function BaseFontLoader(t){var r=t.docId,a=t.onUnsupportedFeature,i=t.ownerDocument,l=void 0===i?globalThis.document:i;t.styleElement;_classCallCheck(this,BaseFontLoader);this.constructor===BaseFontLoader&&(0,o.unreachable)("Cannot initialize BaseFontLoader.");this.docId=r;this._onUnsupportedFeature=a;this._document=l;this.nativeFontFaces=[];this.styleElement=null}_createClass(BaseFontLoader,[{key:"addNativeFontFace",value:function addNativeFontFace(t){this.nativeFontFaces.push(t);this._document.fonts.add(t)}},{key:"insertRule",value:function insertRule(t){var r=this.styleElement;if(!r){(r=this.styleElement=this._document.createElement("style")).id="PDFJS_FONT_STYLE_TAG_".concat(this.docId);this._document.documentElement.getElementsByTagName("head")[0].appendChild(r)}var a=r.sheet;a.insertRule(t,a.cssRules.length)}},{key:"clear",value:function clear(){var t,r=_createForOfIteratorHelper(this.nativeFontFaces);try{for(r.s();!(t=r.n()).done;){var a=t.value;this._document.fonts.delete(a)}}catch(t){r.e(t)}finally{r.f()}this.nativeFontFaces.length=0;if(this.styleElement){this.styleElement.remove();this.styleElement=null}}},{key:"bind",value:(t=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(i.default.mark((function _callee(t){var r,a,l=this;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(!t.attached&&!t.missingFile){i.next=2;break}return i.abrupt("return");case 2:t.attached=!0;if(!this.isFontLoadingAPISupported){i.next=19;break}if(!(r=t.createNativeFontFace())){i.next=18;break}this.addNativeFontFace(r);i.prev=7;i.next=10;return r.loaded;case 10:i.next=18;break;case 12:i.prev=12;i.t0=i.catch(7);this._onUnsupportedFeature({featureId:o.UNSUPPORTED_FEATURES.errorFontLoadNative});(0,o.warn)("Failed to load font '".concat(r.family,"': '").concat(i.t0,"'."));t.disableFontFace=!0;throw i.t0;case 18:return i.abrupt("return");case 19:if(!(a=t.createFontFaceRule())){i.next=26;break}this.insertRule(a);if(!this.isSyncFontLoadingSupported){i.next=24;break}return i.abrupt("return");case 24:i.next=26;return new Promise((function(r){var i=l._queueLoadingCallback(r);l._prepareFontLoadEvent([a],[t],i)}));case 26:case"end":return i.stop()}}),_callee,this,[[7,12]])}))),function bind(r){return t.apply(this,arguments)})},{key:"_queueLoadingCallback",value:function _queueLoadingCallback(t){(0,o.unreachable)("Abstract method `_queueLoadingCallback`.")}},{key:"isFontLoadingAPISupported",get:function get(){var t,r=!(null===(t=this._document)||void 0===t||!t.fonts);return(0,o.shadow)(this,"isFontLoadingAPISupported",r)}},{key:"isSyncFontLoadingSupported",get:function get(){(0,o.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}},{key:"_loadTestFont",get:function get(){(0,o.unreachable)("Abstract method `_loadTestFont`.")}},{key:"_prepareFontLoadEvent",value:function _prepareFontLoadEvent(t,r,a){(0,o.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}]);var t;return BaseFontLoader}();r.FontLoader=l;r.FontLoader=l=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}(GenericFontLoader,t);var r=_createSuper(GenericFontLoader);function GenericFontLoader(t){var a;_classCallCheck(this,GenericFontLoader);(a=r.call(this,t)).loadingContext={requests:[],nextRequestId:0};a.loadTestFontId=0;return a}_createClass(GenericFontLoader,[{key:"isSyncFontLoadingSupported",get:function get(){var t=!1;if("undefined"==typeof navigator)t=!0;else{var r=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);(null==r?void 0:r[1])>=14&&(t=!0)}return(0,o.shadow)(this,"isSyncFontLoadingSupported",t)}},{key:"_queueLoadingCallback",value:function _queueLoadingCallback(t){var r=this.loadingContext,a={id:"pdfjs-font-loading-".concat(r.nextRequestId++),done:!1,complete:function completeRequest(){(0,o.assert)(!a.done,"completeRequest() cannot be called twice.");a.done=!0;for(;r.requests.length>0&&r.requests[0].done;){var t=r.requests.shift();setTimeout(t.callback,0)}},callback:t};r.requests.push(a);return a}},{key:"_loadTestFont",get:function get(){return(0,o.shadow)(this,"_loadTestFont",function getLoadTestFont(){return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==")}())}},{key:"_prepareFontLoadEvent",value:function _prepareFontLoadEvent(t,r,a){var i,l,u=this;function int32(t,r){return t.charCodeAt(r)<<24|t.charCodeAt(r+1)<<16|t.charCodeAt(r+2)<<8|255&t.charCodeAt(r+3)}function spliceString(t,r,a,i){return t.substring(0,r)+i+t.substring(r+a)}var c=this._document.createElement("canvas");c.width=1;c.height=1;var d=c.getContext("2d"),h=0;var p="lt".concat(Date.now()).concat(this.loadTestFontId++),m=this._loadTestFont,g=1482184792,v=int32(m=spliceString(m,976,p.length,p),16);for(i=0,l=p.length-3;i<l;i+=4)v=v-g+int32(p,i)|0;i<p.length&&(v=v-g+int32(p+"XXX",i)|0);m=spliceString(m,16,4,(0,o.string32)(v));var y="url(data:font/opentype;base64,".concat(btoa(m),");"),b='@font-face {font-family:"'.concat(p,'";src:').concat(y,"}");this.insertRule(b);var S,w=[],C=_createForOfIteratorHelper(r);try{for(C.s();!(S=C.n()).done;){var P=S.value;w.push(P.loadedName)}}catch(t){C.e(t)}finally{C.f()}w.push(p);var k=this._document.createElement("div");k.style.visibility="hidden";k.style.width=k.style.height="10px";k.style.position="absolute";k.style.top=k.style.left="0px";for(var R=0,A=w;R<A.length;R++){var x=A[R],T=this._document.createElement("span");T.textContent="Hi";T.style.fontFamily=x;k.appendChild(T)}this._document.body.appendChild(k);!function isFontReady(t,r){if(++h>30){(0,o.warn)("Load test font never loaded.");r()}else{d.font="30px "+t;d.fillText(".",0,20);d.getImageData(0,0,1,1).data[3]>0?r():setTimeout(isFontReady.bind(null,t,r))}}(p,(function(){u._document.body.removeChild(k);a.complete()}))}}]);return GenericFontLoader}(u);var c=function(){function FontFaceObject(t,r){var a=r.isEvalSupported,i=void 0===a||a,o=r.disableFontFace,l=void 0!==o&&o,u=r.ignoreErrors,c=void 0!==u&&u,d=r.onUnsupportedFeature,h=r.fontRegistry,p=void 0===h?null:h;_classCallCheck(this,FontFaceObject);this.compiledGlyphs=Object.create(null);for(var m in t)this[m]=t[m];this.isEvalSupported=!1!==i;this.disableFontFace=!0===l;this.ignoreErrors=!0===c;this._onUnsupportedFeature=d;this.fontRegistry=p}_createClass(FontFaceObject,[{key:"createNativeFontFace",value:function createNativeFontFace(){if(!this.data||this.disableFontFace)return null;var t;if(this.cssFontInfo){var r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg"));t=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}else t=new FontFace(this.loadedName,this.data,{});this.fontRegistry&&this.fontRegistry.registerFont(this);return t}},{key:"createFontFaceRule",value:function createFontFaceRule(){if(!this.data||this.disableFontFace)return null;var t,r=(0,o.bytesToString)(this.data),a="url(data:".concat(this.mimetype,";base64,").concat(btoa(r),");");if(this.cssFontInfo){var i="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(i+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;"));t='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(i,"src:").concat(a,"}")}else t='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(a,"}");this.fontRegistry&&this.fontRegistry.registerFont(this,a);return t}},{key:"getPathGenerator",value:function getPathGenerator(t,r){if(void 0!==this.compiledGlyphs[r])return this.compiledGlyphs[r];var a;try{a=t.get(this.loadedName+"_path_"+r)}catch(t){if(!this.ignoreErrors)throw t;this._onUnsupportedFeature({featureId:o.UNSUPPORTED_FEATURES.errorFontGetPath});(0,o.warn)('getPathGenerator - ignoring character: "'.concat(t,'".'));return this.compiledGlyphs[r]=function(t,r){}}if(this.isEvalSupported&&o.IsEvalSupportedCached.value){var i,l=[],u=_createForOfIteratorHelper(a);try{for(u.s();!(i=u.n()).done;){var c=i.value,d=void 0!==c.args?c.args.join(","):"";l.push("c.",c.cmd,"(",d,");\n")}}catch(t){u.e(t)}finally{u.f()}return this.compiledGlyphs[r]=new Function("c","size",l.join(""))}return this.compiledGlyphs[r]=function(t,r){var i,o=_createForOfIteratorHelper(a);try{for(o.s();!(i=o.n()).done;){var l=i.value;"scale"===l.cmd&&(l.args=[r,-r]);t[l.cmd].apply(t,l.args)}}catch(t){o.e(t)}finally{o.f()}}}}]);return FontFaceObject}();r.FontFaceObject=c},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.NodeStandardFontDataFactory=r.NodeCMapReaderFactory=r.NodeCanvasFactory=void 0;var i=a(117),o=a(121),l=a(4);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var u=function NodeCanvasFactory(){_classCallCheck(this,NodeCanvasFactory);(0,l.unreachable)("Not implemented: NodeCanvasFactory")};r.NodeCanvasFactory=u;var c=function NodeCMapReaderFactory(){_classCallCheck(this,NodeCMapReaderFactory);(0,l.unreachable)("Not implemented: NodeCMapReaderFactory")};r.NodeCMapReaderFactory=c;var d=function NodeStandardFontDataFactory(){_classCallCheck(this,NodeStandardFontDataFactory);(0,l.unreachable)("Not implemented: NodeStandardFontDataFactory")};r.NodeStandardFontDataFactory=d;if(o.isNodeJS){var h=function fetchData(t){return new Promise((function(r,a){require("fs").readFile(t,(function(t,i){!t&&i?r(new Uint8Array(i)):a(new Error(t))}))}))};r.NodeCanvasFactory=u=function(t){_inherits(NodeCanvasFactory,t);var r=_createSuper(NodeCanvasFactory);function NodeCanvasFactory(){_classCallCheck(this,NodeCanvasFactory);return r.apply(this,arguments)}_createClass(NodeCanvasFactory,[{key:"_createCanvas",value:function _createCanvas(t,r){return require("canvas").createCanvas(t,r)}}]);return NodeCanvasFactory}(i.BaseCanvasFactory);r.NodeCMapReaderFactory=c=function(t){_inherits(NodeCMapReaderFactory,t);var r=_createSuper(NodeCMapReaderFactory);function NodeCMapReaderFactory(){_classCallCheck(this,NodeCMapReaderFactory);return r.apply(this,arguments)}_createClass(NodeCMapReaderFactory,[{key:"_fetchData",value:function _fetchData(t,r){return h(t).then((function(t){return{cMapData:t,compressionType:r}}))}}]);return NodeCMapReaderFactory}(i.BaseCMapReaderFactory);r.NodeStandardFontDataFactory=d=function(t){_inherits(NodeStandardFontDataFactory,t);var r=_createSuper(NodeStandardFontDataFactory);function NodeStandardFontDataFactory(){_classCallCheck(this,NodeStandardFontDataFactory);return r.apply(this,arguments)}_createClass(NodeStandardFontDataFactory,[{key:"_fetchData",value:function _fetchData(t){return h(t)}}]);return NodeStandardFontDataFactory}(i.BaseStandardFontDataFactory)}},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.isNodeJS=void 0;function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}var a=!("object"!==("undefined"==typeof process?"undefined":_typeof(process))||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);r.isNodeJS=a},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.AnnotationStorage=void 0;var i=a(4);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function AnnotationStorage(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,AnnotationStorage);this._storage=new Map;this._modified=!1;this.onSetModified=null;this.onResetModified=null}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(AnnotationStorage,[{key:"getValue",value:function getValue(t,r,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=this._storage.get(t);if(void 0===o&&window.getFormValue){window.assignFormIdAndFieldName(t,r,i);var l=window.getFormValue(r);if(void 0!==l&&void 0!==l.value){if(i){var u={value:l.value===i};o=u}else o=l;this.setValue(t,void 0,o)}void 0===o&&void 0!==a&&void 0!==a.value&&""!==a.value&&(i?a.value&&window.setFormValue(r,i):window.setFormValue(r,a.value))}return void 0!==o?o:a}},{key:"setValue",value:function setValue(t,r,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=this._storage.get(t),l=!1;if(void 0!==o)for(var u=0,c=Object.entries(a);u<c.length;u++){var d=_slicedToArray(c[u],2),h=d[0],p=d[1];if("radioValue"!==h&&"emitMessage"!==h&&o[h]!==p){l=!0;o[h]=p}}else{this._storage.set(t,a);l=!0}if(l){this._setModified();if((r||i)&&window.setFormValue)if(a.items)window.setFormValue(r,a.items);else if(!1===a.emitMessage);else if(a.radioValue)window.setFormValue(r,a.radioValue);else for(var m=0,g=Object.values(a);m<g.length;m++){var v=g[m];window.setFormValue(r,v)}}}},{key:"getAll",value:function getAll(){return this._storage.size>0?(0,i.objectFromMap)(this._storage):null}},{key:"size",get:function get(){return this._storage.size}},{key:"_setModified",value:function _setModified(){if(!this._modified){this._modified=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}},{key:"resetModified",value:function resetModified(){if(this._modified){this._modified=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}},{key:"serializable",get:function get(){return this._storage.size>0?this._storage:null}}]);return AnnotationStorage}();r.AnnotationStorage=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.CanvasGraphics=void 0;var i=a(4),o=a(124);function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}var l=4096,u=16;function addContextCurrentTransform(t){if(!t.mozCurrentTransform){t._originalSave=t.save;t._originalRestore=t.restore;t._originalRotate=t.rotate;t._originalScale=t.scale;t._originalTranslate=t.translate;t._originalTransform=t.transform;t._originalSetTransform=t.setTransform;t._originalResetTransform=t.resetTransform;t._transformMatrix=t._transformMatrix||[1,0,0,1,0,0];t._transformStack=[];try{var r=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"lineWidth");t._setLineWidth=r.set;t._getLineWidth=r.get;Object.defineProperty(t,"lineWidth",{set:function setLineWidth(t){this._setLineWidth(1.000001*t)},get:function getLineWidth(){return this._getLineWidth()}})}catch(t){}Object.defineProperty(t,"mozCurrentTransform",{get:function getCurrentTransform(){return this._transformMatrix}});Object.defineProperty(t,"mozCurrentTransformInverse",{get:function getCurrentTransformInverse(){var t=_slicedToArray(this._transformMatrix,6),r=t[0],a=t[1],i=t[2],o=t[3],l=t[4],u=t[5],c=r*o-a*i,d=a*i-r*o;return[o/c,a/d,i/d,r/c,(o*l-i*u)/d,(a*l-r*u)/c]}});t.save=function ctxSave(){var t=this._transformMatrix;this._transformStack.push(t);this._transformMatrix=t.slice(0,6);this._originalSave()};t.restore=function ctxRestore(){var t=this._transformStack.pop();if(t){this._transformMatrix=t;this._originalRestore()}};t.translate=function ctxTranslate(t,r){var a=this._transformMatrix;a[4]=a[0]*t+a[2]*r+a[4];a[5]=a[1]*t+a[3]*r+a[5];this._originalTranslate(t,r)};t.scale=function ctxScale(t,r){var a=this._transformMatrix;a[0]*=t;a[1]*=t;a[2]*=r;a[3]*=r;this._originalScale(t,r)};t.transform=function ctxTransform(r,a,i,o,l,u){var c=this._transformMatrix;this._transformMatrix=[c[0]*r+c[2]*a,c[1]*r+c[3]*a,c[0]*i+c[2]*o,c[1]*i+c[3]*o,c[0]*l+c[2]*u+c[4],c[1]*l+c[3]*u+c[5]];t._originalTransform(r,a,i,o,l,u)};t.setTransform=function ctxSetTransform(r,a,i,o,l,u){this._transformMatrix=[r,a,i,o,l,u];t._originalSetTransform(r,a,i,o,l,u)};t.resetTransform=function ctxResetTransform(){this._transformMatrix=[1,0,0,1,0,0];t._originalResetTransform()};t.rotate=function ctxRotate(t){var r=Math.cos(t),a=Math.sin(t),i=this._transformMatrix;this._transformMatrix=[i[0]*r+i[2]*a,i[1]*r+i[3]*a,i[0]*-a+i[2]*r,i[1]*-a+i[3]*r,i[4],i[5]];this._originalRotate(t)}}}var c=function(){function CachedCanvases(t){_classCallCheck(this,CachedCanvases);this.canvasFactory=t;this.cache=Object.create(null)}_createClass(CachedCanvases,[{key:"getCanvas",value:function getCanvas(t,r,a,i){var o;if(void 0!==this.cache[t]){o=this.cache[t];this.canvasFactory.reset(o,r,a);o.context.setTransform(1,0,0,1,0,0)}else{o=this.canvasFactory.create(r,a);this.cache[t]=o}i&&addContextCurrentTransform(o.context);return o}},{key:"clear",value:function clear(){for(var t in this.cache){var r=this.cache[t];this.canvasFactory.destroy(r);delete this.cache[t]}}}]);return CachedCanvases}();var d=function(){function CanvasExtraState(){_classCallCheck(this,CanvasExtraState);this.alphaIsShape=!1;this.fontSize=0;this.fontSizeScale=1;this.textMatrix=i.IDENTITY_MATRIX;this.textMatrixScale=1;this.fontMatrix=i.FONT_IDENTITY_MATRIX;this.leading=0;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRenderingMode=i.TextRenderingMode.FILL;this.textRise=0;this.fillColor="#000000";this.strokeColor="#000000";this.patternFill=!1;this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.activeSMask=null;this.resumeSMaskCtx=null;this.transferMaps=null}_createClass(CanvasExtraState,[{key:"clone",value:function clone(){return Object.create(this)}},{key:"setCurrentPoint",value:function setCurrentPoint(t,r){this.x=t;this.y=r}}]);return CanvasExtraState}(),h=function CanvasGraphicsClosure(){function putBinaryImageData(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"!=typeof ImageData&&r instanceof ImageData)t.putImageData(r,0,0);else{var o,l,c,d,h,p,m,g,v,y=r.height,b=r.width,S=y%u,w=(y-S)/u,C=0===S?w:w+1,P=t.createImageData(b,u),k=0,R=r.data,A=P.data;if(a)switch(a.length){case 1:p=a[0];m=a[0];g=a[0];v=a[0];break;case 4:p=a[0];m=a[1];g=a[2];v=a[3]}if(r.kind===i.ImageKind.GRAYSCALE_1BPP){var x=R.byteLength,T=new Uint32Array(A.buffer,0,A.byteLength>>2),E=T.length,I=b+7>>3,O=4294967295,D=i.IsLittleEndianCached.value?4278190080:255;if(v&&255===v[0]&&0===v[255]){var L=[D,O];O=L[0];D=L[1]}for(l=0;l<C;l++){d=l<w?u:S;o=0;for(c=0;c<d;c++){for(var M=x-k,B=0,W=M>I?b:8*M-7,N=-8&W,j=0,V=0;B<N;B+=8){V=R[k++];T[o++]=128&V?O:D;T[o++]=64&V?O:D;T[o++]=32&V?O:D;T[o++]=16&V?O:D;T[o++]=8&V?O:D;T[o++]=4&V?O:D;T[o++]=2&V?O:D;T[o++]=1&V?O:D}for(;B<W;B++){if(0===j){V=R[k++];j=128}T[o++]=V&j?O:D;j>>=1}}for(;o<E;)T[o++]=0;t.putImageData(P,0,l*u)}}else if(r.kind===i.ImageKind.RGBA_32BPP){var U=!!(p||m||g);c=0;h=b*u*4;for(l=0;l<w;l++){A.set(R.subarray(k,k+h));k+=h;if(U)for(var q=0;q<h;q+=4){p&&(A[q+0]=p[A[q+0]]);m&&(A[q+1]=m[A[q+1]]);g&&(A[q+2]=g[A[q+2]])}t.putImageData(P,0,c);c+=u}if(l<C){h=b*S*4;A.set(R.subarray(k,k+h));if(U)for(var z=0;z<h;z+=4){p&&(A[z+0]=p[A[z+0]]);m&&(A[z+1]=m[A[z+1]]);g&&(A[z+2]=g[A[z+2]])}t.putImageData(P,0,c)}}else{if(r.kind!==i.ImageKind.RGB_24BPP)throw new Error("bad image kind: ".concat(r.kind));var H=!!(p||m||g);h=b*(d=u);for(l=0;l<C;l++){l>=w&&(h=b*(d=S));o=0;for(c=h;c--;){A[o++]=R[k++];A[o++]=R[k++];A[o++]=R[k++];A[o++]=255}if(H)for(var G=0;G<o;G+=4){p&&(A[G+0]=p[A[G+0]]);m&&(A[G+1]=m[A[G+1]]);g&&(A[G+2]=g[A[G+2]])}t.putImageData(P,0,l*u)}}}}function putBinaryImageMask(t,r){for(var a=r.height,i=r.width,o=a%u,l=(a-o)/u,c=0===o?l:l+1,d=t.createImageData(i,u),h=0,p=r.data,m=d.data,g=0;g<c;g++){for(var v=g<l?u:o,y=3,b=0;b<v;b++)for(var S=void 0,w=0,C=0;C<i;C++){if(!w){S=p[h++];w=128}m[y]=S&w?0:255;y+=4;w>>=1}t.putImageData(d,0,g*u)}}function copyCtxState(t,r){for(var a=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],i=0,o=a.length;i<o;i++){var l=a[i];void 0!==t[l]&&(r[l]=t[l])}if(void 0!==t.setLineDash){r.setLineDash(t.getLineDash());r.lineDashOffset=t.lineDashOffset}}function resetCtxToDefault(t){t.strokeStyle="#000000";t.fillStyle="#000000";t.fillRule="nonzero";t.globalAlpha=1;t.lineWidth=1;t.lineCap="butt";t.lineJoin="miter";t.miterLimit=10;t.globalCompositeOperation="source-over";t.font="10px sans-serif";if(void 0!==t.setLineDash){t.setLineDash([]);t.lineDashOffset=0}}function composeSMaskBackdrop(t,r,a,i){for(var o=t.length,l=3;l<o;l+=4){var u=t[l];if(0===u){t[l-3]=r;t[l-2]=a;t[l-1]=i}else if(u<255){var c=255-u;t[l-3]=t[l-3]*u+r*c>>8;t[l-2]=t[l-2]*u+a*c>>8;t[l-1]=t[l-1]*u+i*c>>8}}}function composeSMaskAlpha(t,r,a){for(var i=t.length,o=3;o<i;o+=4){var l=a?a[t[o]]:t[o];r[o]=r[o]*l*.00392156862745098|0}}function composeSMaskLuminosity(t,r,a){for(var i=t.length,o=3;o<i;o+=4){var l=77*t[o-3]+152*t[o-2]+28*t[o-1];r[o]=a?r[o]*a[l>>8]>>8:r[o]*l>>16}}function composeSMask(t,r,a){var i=r.canvas,o=r.context;t.setTransform(r.scaleX,0,0,r.scaleY,r.offsetX,r.offsetY);!function genericComposeSMask(t,r,a,i,o,l,u){var c,d=!!l,h=d?l[0]:0,p=d?l[1]:0,m=d?l[2]:0;c="Luminosity"===o?composeSMaskLuminosity:composeSMaskAlpha;for(var g=Math.min(i,Math.ceil(1048576/a)),v=0;v<i;v+=g){var y=Math.min(g,i-v),b=t.getImageData(0,v,a,y),S=r.getImageData(0,v,a,y);d&&composeSMaskBackdrop(b.data,h,p,m);c(b.data,S.data,u);t.putImageData(S,0,v)}}(o,a,i.width,i.height,r.subtype,r.backdrop,r.transferMap);t.drawImage(i,0,0)}var t=["butt","round","square"],r=["miter","round","bevel"],a={},h={},p=function(){function CanvasGraphics(t,r,a,i,o,l){_classCallCheck(this,CanvasGraphics);this.ctx=t;this.current=new d;this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=r;this.objs=a;this.canvasFactory=i;this.imageLayer=o;this.groupStack=[];this.processingType3=null;this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.contentVisible=!0;this.markedContentStack=[];this.optionalContentConfig=l;this.cachedCanvases=new c(this.canvasFactory);this.cachedPatterns=new Map;t&&addContextCurrentTransform(t);this._cachedGetSinglePixelWidth=null}_createClass(CanvasGraphics,[{key:"beginDrawing",value:function beginDrawing(t){var r=t.transform,a=t.viewport,i=t.transparency,o=void 0!==i&&i,l=t.background,u=void 0===l?null:l,c=this.ctx.canvas.width,d=this.ctx.canvas.height;this.ctx.save();this.ctx.fillStyle=u||"rgb(255, 255, 255)";this.ctx.fillRect(0,0,c,d);this.ctx.restore();if(o){var h=this.cachedCanvases.getCanvas("transparent",c,d,!0);this.compositeCtx=this.ctx;this.transparentCanvas=h.canvas;this.ctx=h.context;this.ctx.save();this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save();resetCtxToDefault(this.ctx);r&&this.ctx.transform.apply(this.ctx,r);this.ctx.transform.apply(this.ctx,a.transform);this.baseTransform=this.ctx.mozCurrentTransform.slice();this._combinedScaleFactor=Math.hypot(this.baseTransform[0],this.baseTransform[2]);this.imageLayer&&this.imageLayer.beginLayout()}},{key:"executeOperatorList",value:function executeOperatorList(t,r,a,o){var l=t.argsArray,u=t.fnArray,c=r||0,d=l.length;if(d===c)return c;for(var h,p=d-c>10&&"function"==typeof a,m=p?Date.now()+15:0,g=0,v=this.commonObjs,y=this.objs;;){if(void 0!==o&&c===o.nextBreakPoint){o.breakIt(c,a);return c}if((h=u[c])!==i.OPS.dependency)this[h].apply(this,l[c]);else{var b,S=_createForOfIteratorHelper(l[c]);try{for(S.s();!(b=S.n()).done;){var w=b.value,C=w.startsWith("g_")?v:y;if(!C.has(w)){C.get(w,a);return c}}}catch(t){S.e(t)}finally{S.f()}}if(++c===d)return c;if(p&&++g>10){if(Date.now()>m){a();return c}g=0}}}},{key:"endDrawing",value:function endDrawing(){for(;this.stateStack.length||null!==this.current.activeSMask;)this.restore();this.ctx.restore();if(this.transparentCanvas){this.ctx=this.compositeCtx;this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.drawImage(this.transparentCanvas,0,0);this.ctx.restore();this.transparentCanvas=null}this.cachedCanvases.clear();this.cachedPatterns.clear();this.imageLayer&&this.imageLayer.endLayout()}},{key:"_scaleImage",value:function _scaleImage(t,r){for(var a,i,o=t.width,l=t.height,u=Math.max(Math.hypot(r[0],r[1]),1),c=Math.max(Math.hypot(r[2],r[3]),1),d=o,h=l,p="prescale1";u>2&&d>1||c>2&&h>1;){var m=d,g=h;u>2&&d>1&&(u/=d/(m=Math.ceil(d/2)));c>2&&h>1&&(c/=h/(g=Math.ceil(h/2)));(i=(a=this.cachedCanvases.getCanvas(p,m,g)).context).clearRect(0,0,m,g);i.drawImage(t,0,0,d,h,0,0,m,g);t=a.canvas;d=m;h=g;p="prescale1"===p?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:h}}},{key:"_createMaskCanvas",value:function _createMaskCanvas(t){var r=this.ctx,a=t.width,o=t.height,l=this.current.fillColor,u=this.current.patternFill,c=this.cachedCanvases.getCanvas("maskCanvas",a,o);putBinaryImageMask(c.context,t);var d=r.mozCurrentTransform,h=i.Util.transform(d,[1/a,0,0,-1/o,0,0]);h=i.Util.transform(h,[1,0,0,1,0,-o]);var p=i.Util.applyTransform([0,0],h),m=i.Util.applyTransform([a,o],h),g=i.Util.normalizeRect([p[0],p[1],m[0],m[1]]),v=Math.ceil(g[2]-g[0]),y=Math.ceil(g[3]-g[1]),b=this.cachedCanvases.getCanvas("fillCanvas",v,y,!0),S=b.context,w=Math.min(p[0],m[0]),C=Math.min(p[1],m[1]);S.translate(-w,-C);S.transform.apply(S,h);var P=this._scaleImage(c.canvas,S.mozCurrentTransformInverse);S.drawImage(P.img,0,0,P.img.width,P.img.height,0,0,a,o);S.globalCompositeOperation="source-in";var k=i.Util.transform(S.mozCurrentTransformInverse,[1,0,0,1,-w,-C]);S.fillStyle=u?l.getPattern(r,this,k,!1):l;S.fillRect(0,0,a,o);return{canvas:b.canvas,offsetX:Math.round(w),offsetY:Math.round(C)}}},{key:"setLineWidth",value:function setLineWidth(t){this.current.lineWidth=t;this.ctx.lineWidth=t}},{key:"setLineCap",value:function setLineCap(r){this.ctx.lineCap=t[r]}},{key:"setLineJoin",value:function setLineJoin(t){this.ctx.lineJoin=r[t]}},{key:"setMiterLimit",value:function setMiterLimit(t){this.ctx.miterLimit=t}},{key:"setDash",value:function setDash(t,r){var a=this.ctx;if(void 0!==a.setLineDash){a.setLineDash(t);a.lineDashOffset=r}}},{key:"setRenderingIntent",value:function setRenderingIntent(t){}},{key:"setFlatness",value:function setFlatness(t){}},{key:"setGState",value:function setGState(t){for(var r=0,a=t.length;r<a;r++){var i=t[r],o=i[0],l=i[1];switch(o){case"LW":this.setLineWidth(l);break;case"LC":this.setLineCap(l);break;case"LJ":this.setLineJoin(l);break;case"ML":this.setMiterLimit(l);break;case"D":this.setDash(l[0],l[1]);break;case"RI":this.setRenderingIntent(l);break;case"FL":this.setFlatness(l);break;case"Font":this.setFont(l[0],l[1]);break;case"CA":this.current.strokeAlpha=i[1];break;case"ca":this.current.fillAlpha=i[1];this.ctx.globalAlpha=i[1];break;case"BM":this.ctx.globalCompositeOperation=l;break;case"SMask":this.current.activeSMask&&(this.stateStack.length>0&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask?this.suspendSMaskGroup():this.endSMaskGroup());this.current.activeSMask=l?this.tempSMask:null;this.current.activeSMask&&this.beginSMaskGroup();this.tempSMask=null;break;case"TR":this.current.transferMaps=l}}}},{key:"beginSMaskGroup",value:function beginSMaskGroup(){var t=this.current.activeSMask,r=t.canvas.width,a=t.canvas.height,i="smaskGroupAt"+this.groupLevel,o=this.cachedCanvases.getCanvas(i,r,a,!0),l=this.ctx,u=l.mozCurrentTransform;this.ctx.save();var c=o.context;c.scale(1/t.scaleX,1/t.scaleY);c.translate(-t.offsetX,-t.offsetY);c.transform.apply(c,u);t.startTransformInverse=c.mozCurrentTransformInverse;copyCtxState(l,c);this.ctx=c;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(l);this.groupLevel++}},{key:"suspendSMaskGroup",value:function suspendSMaskGroup(){var t=this.ctx;this.groupLevel--;this.ctx=this.groupStack.pop();composeSMask(this.ctx,this.current.activeSMask,t);this.ctx.restore();this.ctx.save();copyCtxState(t,this.ctx);this.current.resumeSMaskCtx=t;var r=i.Util.transform(this.current.activeSMask.startTransformInverse,t.mozCurrentTransform);this.ctx.transform.apply(this.ctx,r);t.save();t.setTransform(1,0,0,1,0,0);t.clearRect(0,0,t.canvas.width,t.canvas.height);t.restore()}},{key:"resumeSMaskGroup",value:function resumeSMaskGroup(){var t=this.current.resumeSMaskCtx,r=this.ctx;this.ctx=t;this.groupStack.push(r);this.groupLevel++}},{key:"endSMaskGroup",value:function endSMaskGroup(){var t=this.ctx;this.groupLevel--;this.ctx=this.groupStack.pop();composeSMask(this.ctx,this.current.activeSMask,t);this.ctx.restore();copyCtxState(t,this.ctx);var r=i.Util.transform(this.current.activeSMask.startTransformInverse,t.mozCurrentTransform);this.ctx.transform.apply(this.ctx,r)}},{key:"save",value:function save(){this.ctx.save();var t=this.current;this.stateStack.push(t);this.current=t.clone();this.current.resumeSMaskCtx=null}},{key:"restore",value:function restore(){this.current.resumeSMaskCtx&&this.resumeSMaskGroup();null===this.current.activeSMask||0!==this.stateStack.length&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask||this.endSMaskGroup();if(0!==this.stateStack.length){this.current=this.stateStack.pop();this.ctx.restore();this.pendingClip=null;this._cachedGetSinglePixelWidth=null}else this.current.activeSMask=null}},{key:"transform",value:function transform(t,r,a,i,o,l){this.ctx.transform(t,r,a,i,o,l);this._cachedGetSinglePixelWidth=null}},{key:"constructPath",value:function constructPath(t,r){for(var a=this.ctx,o=this.current,l=o.x,u=o.y,c=0,d=0,h=t.length;c<h;c++)switch(0|t[c]){case i.OPS.rectangle:l=r[d++];u=r[d++];var p=r[d++],m=r[d++],g=l+p,v=u+m;a.moveTo(l,u);if(0===p||0===m)a.lineTo(g,v);else{a.lineTo(g,u);a.lineTo(g,v);a.lineTo(l,v)}a.closePath();break;case i.OPS.moveTo:l=r[d++];u=r[d++];a.moveTo(l,u);break;case i.OPS.lineTo:l=r[d++];u=r[d++];a.lineTo(l,u);break;case i.OPS.curveTo:l=r[d+4];u=r[d+5];a.bezierCurveTo(r[d],r[d+1],r[d+2],r[d+3],l,u);d+=6;break;case i.OPS.curveTo2:a.bezierCurveTo(l,u,r[d],r[d+1],r[d+2],r[d+3]);l=r[d+2];u=r[d+3];d+=4;break;case i.OPS.curveTo3:l=r[d+2];u=r[d+3];a.bezierCurveTo(r[d],r[d+1],l,u,l,u);d+=4;break;case i.OPS.closePath:a.closePath()}o.setCurrentPoint(l,u)}},{key:"closePath",value:function closePath(){this.ctx.closePath()}},{key:"stroke",value:function stroke(t){t=void 0===t||t;var r=this.ctx,a=this.current.strokeColor;r.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"===_typeof(a)&&null!=a&&a.getPattern){var i=this.getSinglePixelWidth();r.save();r.strokeStyle=a.getPattern(r,this,r.mozCurrentTransformInverse);r.lineWidth=Math.max(i,this.current.lineWidth);r.stroke();r.restore()}else{var o=this.getSinglePixelWidth();if(o<0&&-o>=this.current.lineWidth){r.save();r.resetTransform();r.lineWidth=Math.round(this._combinedScaleFactor);r.stroke();r.restore()}else{r.lineWidth=Math.max(o,this.current.lineWidth);r.stroke()}}t&&this.consumePath();r.globalAlpha=this.current.fillAlpha}},{key:"closeStroke",value:function closeStroke(){this.closePath();this.stroke()}},{key:"fill",value:function fill(t){t=void 0===t||t;var r=this.ctx,a=this.current.fillColor,i=!1;if(this.current.patternFill){r.save();r.fillStyle=a.getPattern(r,this,r.mozCurrentTransformInverse);i=!0}if(this.contentVisible)if(this.pendingEOFill){r.fill("evenodd");this.pendingEOFill=!1}else r.fill();i&&r.restore();t&&this.consumePath()}},{key:"eoFill",value:function eoFill(){this.pendingEOFill=!0;this.fill()}},{key:"fillStroke",value:function fillStroke(){this.fill(!1);this.stroke(!1);this.consumePath()}},{key:"eoFillStroke",value:function eoFillStroke(){this.pendingEOFill=!0;this.fillStroke()}},{key:"closeFillStroke",value:function closeFillStroke(){this.closePath();this.fillStroke()}},{key:"closeEOFillStroke",value:function closeEOFillStroke(){this.pendingEOFill=!0;this.closePath();this.fillStroke()}},{key:"endPath",value:function endPath(){this.consumePath()}},{key:"clip",value:function clip(){this.pendingClip=a}},{key:"eoClip",value:function eoClip(){this.pendingClip=h}},{key:"beginText",value:function beginText(){this.current.textMatrix=i.IDENTITY_MATRIX;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}},{key:"endText",value:function endText(){var t=this.pendingTextPaths,r=this.ctx;if(void 0!==t){r.save();r.beginPath();for(var a=0;a<t.length;a++){var i=t[a];r.setTransform.apply(r,i.transform);r.translate(i.x,i.y);i.addToPath(r,i.fontSize)}r.restore();r.clip();r.beginPath();delete this.pendingTextPaths}else r.beginPath()}},{key:"setCharSpacing",value:function setCharSpacing(t){this.current.charSpacing=t}},{key:"setWordSpacing",value:function setWordSpacing(t){this.current.wordSpacing=t}},{key:"setHScale",value:function setHScale(t){this.current.textHScale=t/100}},{key:"setLeading",value:function setLeading(t){this.current.leading=-t}},{key:"setFont",value:function setFont(t,r){var a=this.commonObjs.get(t),o=this.current;if(!a)throw new Error("Can't find font for ".concat(t));o.fontMatrix=a.fontMatrix||i.FONT_IDENTITY_MATRIX;0!==o.fontMatrix[0]&&0!==o.fontMatrix[3]||(0,i.warn)("Invalid font matrix for font "+t);if(r<0){r=-r;o.fontDirection=-1}else o.fontDirection=1;this.current.font=a;this.current.fontSize=r;if(!a.isType3Font){var l=a.loadedName||"sans-serif",u="normal";a.black?u="900":a.bold&&(u="bold");var c=a.italic?"italic":"normal",d='"'.concat(l,'", ').concat(a.fallbackName),h=r;r<16?h=16:r>100&&(h=100);this.current.fontSizeScale=r/h;this.ctx.font="".concat(c," ").concat(u," ").concat(h,"px ").concat(d)}}},{key:"setTextRenderingMode",value:function setTextRenderingMode(t){this.current.textRenderingMode=t}},{key:"setTextRise",value:function setTextRise(t){this.current.textRise=t}},{key:"moveText",value:function moveText(t,r){this.current.x=this.current.lineX+=t;this.current.y=this.current.lineY+=r}},{key:"setLeadingMoveText",value:function setLeadingMoveText(t,r){this.setLeading(-r);this.moveText(t,r)}},{key:"setTextMatrix",value:function setTextMatrix(t,r,a,i,o,l){this.current.textMatrix=[t,r,a,i,o,l];this.current.textMatrixScale=Math.hypot(t,r);this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}},{key:"nextLine",value:function nextLine(){this.moveText(0,this.current.leading)}},{key:"paintChar",value:function paintChar(t,r,a,o,l){var u,c=this.ctx,d=this.current,h=d.font,p=d.textRenderingMode,m=d.fontSize/d.fontSizeScale,g=p&i.TextRenderingMode.FILL_STROKE_MASK,v=!!(p&i.TextRenderingMode.ADD_TO_PATH_FLAG),y=d.patternFill&&!h.missingFile;(h.disableFontFace||v||y)&&(u=h.getPathGenerator(this.commonObjs,t));if(h.disableFontFace||y){c.save();c.translate(r,a);c.beginPath();u(c,m);o&&c.setTransform.apply(c,o);g!==i.TextRenderingMode.FILL&&g!==i.TextRenderingMode.FILL_STROKE||c.fill();if(g===i.TextRenderingMode.STROKE||g===i.TextRenderingMode.FILL_STROKE){if(l){c.resetTransform();c.lineWidth=Math.round(this._combinedScaleFactor)}c.stroke()}c.restore()}else{g!==i.TextRenderingMode.FILL&&g!==i.TextRenderingMode.FILL_STROKE||c.fillText(t,r,a);if(g===i.TextRenderingMode.STROKE||g===i.TextRenderingMode.FILL_STROKE)if(l){c.save();c.moveTo(r,a);c.resetTransform();c.lineWidth=Math.round(this._combinedScaleFactor);c.strokeText(t,0,0);c.restore()}else c.strokeText(t,r,a)}if(v){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:c.mozCurrentTransform,x:r,y:a,fontSize:m,addToPath:u})}}},{key:"isFontSubpixelAAEnabled",get:function get(){var t=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10).context;t.scale(1.5,1);t.fillText("I",0,10);for(var r=t.getImageData(0,0,10,10).data,a=!1,o=3;o<r.length;o+=4)if(r[o]>0&&r[o]<255){a=!0;break}return(0,i.shadow)(this,"isFontSubpixelAAEnabled",a)}},{key:"showText",value:function showText(t){var r=this.current,a=r.font;if(a.isType3Font)return this.showType3Text(t);var o=r.fontSize;if(0!==o){var l,u=this.ctx,c=r.fontSizeScale,d=r.charSpacing,h=r.wordSpacing,p=r.fontDirection,m=r.textHScale*p,g=t.length,v=a.vertical,y=v?1:-1,b=a.defaultVMetrics,S=o*r.fontMatrix[0],w=r.textRenderingMode===i.TextRenderingMode.FILL&&!a.disableFontFace&&!r.patternFill;u.save();if(r.patternFill){u.save();var C=r.fillColor.getPattern(u,this,u.mozCurrentTransformInverse);l=u.mozCurrentTransform;u.restore();u.fillStyle=C}u.transform.apply(u,r.textMatrix);u.translate(r.x,r.y+r.textRise);p>0?u.scale(m,-1):u.scale(m,1);var P=r.lineWidth,k=!1,R=r.textMatrixScale;if(0===R||0===P){var A=r.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(A===i.TextRenderingMode.STROKE||A===i.TextRenderingMode.FILL_STROKE){this._cachedGetSinglePixelWidth=null;k=(P=this.getSinglePixelWidth())<0}}else P/=R;if(1!==c){u.scale(c,c);P/=c}u.lineWidth=P;var x,T=0;for(x=0;x<g;++x){var E=t[x];if((0,i.isNum)(E))T+=y*E*o/1e3;else{var I=!1,O=(E.isSpace?h:0)+d,D=E.fontChar,L=E.accent,M=void 0,B=void 0,W=E.width;if(v){var N=E.vmetric||b,j=-(E.vmetric?N[1]:.5*W)*S,V=N[2]*S;W=N?-N[0]:W;M=j/c;B=(T+V)/c}else{M=T/c;B=0}if(a.remeasure&&W>0){var U=1e3*u.measureText(D).width/o*c;if(W<U&&this.isFontSubpixelAAEnabled){var q=W/U;I=!0;u.save();u.scale(q,1);M/=q}else W!==U&&(M+=(W-U)/2e3*o/c)}if(this.contentVisible&&(E.isInFont||a.missingFile))if(w&&!L)u.fillText(D,M,B);else{this.paintChar(D,M,B,l,k);if(L){var z=M+o*L.offset.x/c,H=B-o*L.offset.y/c;this.paintChar(L.fontChar,z,H,l,k)}}T+=v?W*S-O*p:W*S+O*p;I&&u.restore()}}v?r.y-=T:r.x+=T*m;u.restore()}}},{key:"showType3Text",value:function showType3Text(t){var r,a,o,l,u=this.ctx,c=this.current,d=c.font,h=c.fontSize,p=c.fontDirection,m=d.vertical?1:-1,g=c.charSpacing,v=c.wordSpacing,y=c.textHScale*p,b=c.fontMatrix||i.FONT_IDENTITY_MATRIX,S=t.length;if(!(c.textRenderingMode===i.TextRenderingMode.INVISIBLE)&&0!==h){this._cachedGetSinglePixelWidth=null;u.save();u.transform.apply(u,c.textMatrix);u.translate(c.x,c.y);u.scale(y,p);for(r=0;r<S;++r){a=t[r];if((0,i.isNum)(a)){l=m*a*h/1e3;this.ctx.translate(l,0);c.x+=l*y}else{var w=(a.isSpace?v:0)+g,C=d.charProcOperatorList[a.operatorListId];if(C){if(this.contentVisible){this.processingType3=a;this.save();u.scale(h,h);u.transform.apply(u,b);this.executeOperatorList(C);this.restore()}o=i.Util.applyTransform([a.width,0],b)[0]*h+w;u.translate(o,0);c.x+=o*y}else(0,i.warn)('Type3 character "'.concat(a.operatorListId,'" is not available.'))}}u.restore();this.processingType3=null}}},{key:"setCharWidth",value:function setCharWidth(t,r){}},{key:"setCharWidthAndBounds",value:function setCharWidthAndBounds(t,r,a,i,o,l){this.ctx.rect(a,i,o-a,l-i);this.clip();this.endPath()}},{key:"getColorN_Pattern",value:function getColorN_Pattern(t){var r,a=this;if("TilingPattern"===t[0]){var i=t[1],l=this.baseTransform||this.ctx.mozCurrentTransform.slice(),u={createCanvasGraphics:function createCanvasGraphics(t){return new CanvasGraphics(t,a.commonObjs,a.objs,a.canvasFactory)}};r=new o.TilingPattern(t,i,this.ctx,u,l)}else r=this._getPattern(t[1]);return r}},{key:"setStrokeColorN",value:function setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}},{key:"setFillColorN",value:function setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments);this.current.patternFill=!0}},{key:"setStrokeRGBColor",value:function setStrokeRGBColor(t,r,a){var o=i.Util.makeHexColor(t,r,a);this.ctx.strokeStyle=o;this.current.strokeColor=o}},{key:"setFillRGBColor",value:function setFillRGBColor(t,r,a){var o=i.Util.makeHexColor(t,r,a);this.ctx.fillStyle=o;this.current.fillColor=o;this.current.patternFill=!1}},{key:"_getPattern",value:function _getPattern(t){if(this.cachedPatterns.has(t))return this.cachedPatterns.get(t);var r=(0,o.getShadingPattern)(this.objs.get(t));this.cachedPatterns.set(t,r);return r}},{key:"shadingFill",value:function shadingFill(t){if(this.contentVisible){var r=this.ctx;this.save();var a=this._getPattern(t);r.fillStyle=a.getPattern(r,this,r.mozCurrentTransformInverse,!0);var o=r.mozCurrentTransformInverse;if(o){var l=r.canvas,u=l.width,c=l.height,d=i.Util.applyTransform([0,0],o),h=i.Util.applyTransform([0,c],o),p=i.Util.applyTransform([u,0],o),m=i.Util.applyTransform([u,c],o),g=Math.min(d[0],h[0],p[0],m[0]),v=Math.min(d[1],h[1],p[1],m[1]),y=Math.max(d[0],h[0],p[0],m[0]),b=Math.max(d[1],h[1],p[1],m[1]);this.ctx.fillRect(g,v,y-g,b-v)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()}}},{key:"beginInlineImage",value:function beginInlineImage(){(0,i.unreachable)("Should not call beginInlineImage")}},{key:"beginImageData",value:function beginImageData(){(0,i.unreachable)("Should not call beginImageData")}},{key:"paintFormXObjectBegin",value:function paintFormXObjectBegin(t,r){if(this.contentVisible){this.save();this.baseTransformStack.push(this.baseTransform);Array.isArray(t)&&6===t.length&&this.transform.apply(this,t);this.baseTransform=this.ctx.mozCurrentTransform;if(r){var a=r[2]-r[0],i=r[3]-r[1];this.ctx.rect(r[0],r[1],a,i);this.clip();this.endPath()}}}},{key:"paintFormXObjectEnd",value:function paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}}},{key:"beginGroup",value:function beginGroup(t){if(this.contentVisible){this.save();var r=this.ctx;t.isolated||(0,i.info)("TODO: Support non-isolated groups.");t.knockout&&(0,i.warn)("Knockout groups not supported.");var a=r.mozCurrentTransform;t.matrix&&r.transform.apply(r,t.matrix);if(!t.bbox)throw new Error("Bounding box is required.");var o=i.Util.getAxialAlignedBoundingBox(t.bbox,r.mozCurrentTransform),u=[0,0,r.canvas.width,r.canvas.height];o=i.Util.intersect(o,u)||[0,0,0,0];var c=Math.floor(o[0]),d=Math.floor(o[1]),h=Math.max(Math.ceil(o[2])-c,1),p=Math.max(Math.ceil(o[3])-d,1),m=1,g=1;if(h>l){m=h/l;h=l}if(p>l){g=p/l;p=l}var v="groupAt"+this.groupLevel;t.smask&&(v+="_smask_"+this.smaskCounter++%2);var y=this.cachedCanvases.getCanvas(v,h,p,!0),b=y.context;b.scale(1/m,1/g);b.translate(-c,-d);b.transform.apply(b,a);if(t.smask)this.smaskStack.push({canvas:y.canvas,context:b,offsetX:c,offsetY:d,scaleX:m,scaleY:g,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null});else{r.setTransform(1,0,0,1,0,0);r.translate(c,d);r.scale(m,g)}copyCtxState(r,b);this.ctx=b;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(r);this.groupLevel++;this.current.activeSMask=null}}},{key:"endGroup",value:function endGroup(t){if(this.contentVisible){this.groupLevel--;var r=this.ctx;this.ctx=this.groupStack.pop();void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1;t.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(r.canvas,0,0);this.restore()}}},{key:"beginAnnotations",value:function beginAnnotations(){this.save();this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)}},{key:"endAnnotations",value:function endAnnotations(){this.restore()}},{key:"beginAnnotation",value:function beginAnnotation(t,r,a,i){this.save();resetCtxToDefault(this.ctx);this.current=new d;if(Array.isArray(r)&&4===r.length){var o=r[2]-r[0],l=r[3]-r[1];this.ctx.rect(r[0],r[1],o,l);this.clip();this.endPath()}this.transform.apply(this,a);this.transform.apply(this,i)}},{key:"endAnnotation",value:function endAnnotation(){this.restore()}},{key:"paintImageMaskXObject",value:function paintImageMaskXObject(t){if(this.contentVisible){var r=this.ctx,a=t.width,i=t.height,o=this.processingType3;o&&void 0===o.compiled&&(o.compiled=a<=1e3&&i<=1e3?function compileType3Glyph(t){var r,a,i,o,l=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),u=t.width,c=t.height,d=u+1,h=new Uint8Array(d*(c+1)),p=u+7&-8,m=t.data,g=new Uint8Array(p*c),v=0;for(r=0,a=m.length;r<a;r++)for(var y=m[r],b=128;b>0;){g[v++]=y&b?0:255;b>>=1}var S=0;if(0!==g[v=0]){h[0]=1;++S}for(i=1;i<u;i++){if(g[v]!==g[v+1]){h[i]=g[v]?2:1;++S}v++}if(0!==g[v]){h[i]=2;++S}for(r=1;r<c;r++){o=r*d;if(g[(v=r*p)-p]!==g[v]){h[o]=g[v]?1:8;++S}var w=(g[v]?4:0)+(g[v-p]?8:0);for(i=1;i<u;i++){if(l[w=(w>>2)+(g[v+1]?4:0)+(g[v-p+1]?8:0)]){h[o+i]=l[w];++S}v++}if(g[v-p]!==g[v]){h[o+i]=g[v]?2:4;++S}if(S>1e3)return null}o=r*d;if(0!==g[v=p*(c-1)]){h[o]=8;++S}for(i=1;i<u;i++){if(g[v]!==g[v+1]){h[o+i]=g[v]?4:8;++S}v++}if(0!==g[v]){h[o+i]=4;++S}if(S>1e3)return null;var C=new Int32Array([0,d,-1,0,-d,0,0,0,1]),P=[];for(r=0;S&&r<=c;r++){for(var k=r*d,R=k+u;k<R&&!h[k];)k++;if(k!==R){var A=[k%d,r],x=k,T=h[k];do{var E=C[T];do{k+=E}while(!h[k]);var I=h[k];if(5!==I&&10!==I){T=I;h[k]=0}else{T=I&51*T>>4;h[k]&=T>>2|T<<2}A.push(k%d,k/d|0);h[k]||--S}while(x!==k);P.push(A);--r}}return function drawOutline(t){t.save();t.scale(1/u,-1/c);t.translate(0,-c);t.beginPath();for(var r=0,a=P.length;r<a;r++){var i=P[r];t.moveTo(i[0],i[1]);for(var o=2,l=i.length;o<l;o+=2)t.lineTo(i[o],i[o+1])}t.fill();t.beginPath();t.restore()}}({data:t.data,width:a,height:i}):null);if(null!=o&&o.compiled)o.compiled(r);else{var l=this._createMaskCanvas(t),u=l.canvas;r.save();r.setTransform(1,0,0,1,0,0);r.drawImage(u,l.offsetX,l.offsetY);r.restore()}}}},{key:"paintImageMaskXObjectRepeat",value:function paintImageMaskXObjectRepeat(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,l=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0;if(this.contentVisible){var c=this.ctx;c.save();var d=c.mozCurrentTransform;c.transform(r,a,o,l,0,0);var h=this._createMaskCanvas(t);c.setTransform(1,0,0,1,0,0);for(var p=0,m=u.length;p<m;p+=2){var g=i.Util.transform(d,[r,a,o,l,u[p],u[p+1]]),v=i.Util.applyTransform([0,0],g),y=_slicedToArray(v,2),b=y[0],S=y[1];c.drawImage(h.canvas,b,S)}c.restore()}}},{key:"paintImageMaskXObjectGroup",value:function paintImageMaskXObjectGroup(t){if(this.contentVisible)for(var r=this.ctx,a=this.current.fillColor,i=this.current.patternFill,o=0,l=t.length;o<l;o++){var u=t[o],c=u.width,d=u.height,h=this.cachedCanvases.getCanvas("maskCanvas",c,d),p=h.context;p.save();putBinaryImageMask(p,u);p.globalCompositeOperation="source-in";p.fillStyle=i?a.getPattern(p,this,r.mozCurrentTransformInverse,!1):a;p.fillRect(0,0,c,d);p.restore();r.save();r.transform.apply(r,u.transform);r.scale(1,-1);r.drawImage(h.canvas,0,0,c,d,0,-1,1,1);r.restore()}}},{key:"paintImageXObject",value:function paintImageXObject(t){if(this.contentVisible){var r=t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t);r?this.paintInlineImageXObject(r):(0,i.warn)("Dependent image isn't ready yet")}}},{key:"paintImageXObjectRepeat",value:function paintImageXObjectRepeat(t,r,a,o){if(this.contentVisible){var l=t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t);if(l){for(var u=l.width,c=l.height,d=[],h=0,p=o.length;h<p;h+=2)d.push({transform:[r,0,0,a,o[h],o[h+1]],x:0,y:0,w:u,h:c});this.paintInlineImageXObjectGroup(l,d)}else(0,i.warn)("Dependent image isn't ready yet")}}},{key:"paintInlineImageXObject",value:function paintInlineImageXObject(t){if(this.contentVisible){var r,a=t.width,i=t.height,o=this.ctx;this.save();o.scale(1/a,-1/i);if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)r=t;else{var l=this.cachedCanvases.getCanvas("inlineImage",a,i);putBinaryImageData(l.context,t,this.current.transferMaps);r=l.canvas}var u=this._scaleImage(r,o.mozCurrentTransformInverse);o.drawImage(u.img,0,0,u.paintWidth,u.paintHeight,0,-i,a,i);if(this.imageLayer){var c=this.getCanvasPosition(0,-i);this.imageLayer.appendImage({imgData:t,left:c[0],top:c[1],width:a/o.mozCurrentTransformInverse[0],height:i/o.mozCurrentTransformInverse[3]})}this.restore()}}},{key:"paintInlineImageXObjectGroup",value:function paintInlineImageXObjectGroup(t,r){if(this.contentVisible){var a=this.ctx,i=t.width,o=t.height,l=this.cachedCanvases.getCanvas("inlineImage",i,o);putBinaryImageData(l.context,t,this.current.transferMaps);for(var u=0,c=r.length;u<c;u++){var d=r[u];a.save();a.transform.apply(a,d.transform);a.scale(1,-1);a.drawImage(l.canvas,d.x,d.y,d.w,d.h,0,-1,1,1);if(this.imageLayer){var h=this.getCanvasPosition(d.x,d.y);this.imageLayer.appendImage({imgData:t,left:h[0],top:h[1],width:i,height:o})}a.restore()}}}},{key:"paintSolidColorImageMask",value:function paintSolidColorImageMask(){this.contentVisible&&this.ctx.fillRect(0,0,1,1)}},{key:"markPoint",value:function markPoint(t){}},{key:"markPointProps",value:function markPointProps(t,r){}},{key:"beginMarkedContent",value:function beginMarkedContent(t){this.markedContentStack.push({visible:!0})}},{key:"beginMarkedContentProps",value:function beginMarkedContentProps(t,r){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}},{key:"endMarkedContent",value:function endMarkedContent(){this.markedContentStack.pop();this.contentVisible=this.isContentVisible()}},{key:"beginCompat",value:function beginCompat(){}},{key:"endCompat",value:function endCompat(){}},{key:"consumePath",value:function consumePath(){var t=this.ctx;if(this.pendingClip){this.pendingClip===h?t.clip("evenodd"):t.clip();this.pendingClip=null}t.beginPath()}},{key:"getSinglePixelWidth",value:function getSinglePixelWidth(){if(null===this._cachedGetSinglePixelWidth){var t=this.ctx.mozCurrentTransform,r=Math.abs(t[0]*t[3]-t[2]*t[1]),a=Math.pow(t[0],2)+Math.pow(t[2],2),i=Math.pow(t[1],2)+Math.pow(t[3],2),o=Math.sqrt(Math.max(a,i))/r;a!==i&&this._combinedScaleFactor*o>1?this._cachedGetSinglePixelWidth=-this._combinedScaleFactor*o:r>Number.EPSILON?this._cachedGetSinglePixelWidth=o:this._cachedGetSinglePixelWidth=1}return this._cachedGetSinglePixelWidth}},{key:"getCanvasPosition",value:function getCanvasPosition(t,r){var a=this.ctx.mozCurrentTransform;return[a[0]*t+a[2]*r+a[4],a[1]*t+a[3]*r+a[5]]}},{key:"isContentVisible",value:function isContentVisible(){for(var t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}]);return CanvasGraphics}();for(var m in i.OPS)p.prototype[i.OPS[m]]=p.prototype[m];return p}();r.CanvasGraphics=h},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.getShadingPattern=function getShadingPattern(t){switch(t[0]){case"RadialAxial":return new l(t);case"Mesh":return new u(t);case"Dummy":return new c}throw new Error("Unknown IR type: ".concat(t[0]))};r.TilingPattern=void 0;var i=a(4);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function applyBoundingBox(t,r){if(r&&"undefined"!=typeof Path2D){var a=r[2]-r[0],i=r[3]-r[1],o=new Path2D;o.rect(r[0],r[1],a,i);t.clip(o)}}var o=function(){function BaseShadingPattern(){_classCallCheck(this,BaseShadingPattern);this.constructor===BaseShadingPattern&&(0,i.unreachable)("Cannot initialize BaseShadingPattern.")}_createClass(BaseShadingPattern,[{key:"getPattern",value:function getPattern(){(0,i.unreachable)("Abstract method `getPattern` called.")}}]);return BaseShadingPattern}(),l=function(t){_inherits(RadialAxialShadingPattern,t);var r=_createSuper(RadialAxialShadingPattern);function RadialAxialShadingPattern(t){var a;_classCallCheck(this,RadialAxialShadingPattern);(a=r.call(this))._type=t[1];a._bbox=t[2];a._colorStops=t[3];a._p0=t[4];a._p1=t[5];a._r0=t[6];a._r1=t[7];a._matrix=t[8];a._patternCache=null;return a}_createClass(RadialAxialShadingPattern,[{key:"_createGradient",value:function _createGradient(t){var r;"axial"===this._type?r=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(r=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));var a,i=_createForOfIteratorHelper(this._colorStops);try{for(i.s();!(a=i.n()).done;){var o=a.value;r.addColorStop(o[0],o[1])}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"getPattern",value:function getPattern(t,r,a){var o,l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(this._patternCache)o=this._patternCache;else{if(l){applyBoundingBox(t,this._bbox);o=this._createGradient(t)}else{var u=r.cachedCanvases.getCanvas("pattern",r.ctx.canvas.width,r.ctx.canvas.height,!0),c=u.context;c.clearRect(0,0,c.canvas.width,c.canvas.height);c.beginPath();c.rect(0,0,c.canvas.width,c.canvas.height);c.setTransform.apply(c,r.baseTransform);this._matrix&&c.transform.apply(c,this._matrix);applyBoundingBox(c,this._bbox);c.fillStyle=this._createGradient(c);c.fill();o=t.createPattern(u.canvas,"repeat")}this._patternCache=o}if(!l){var d=new DOMMatrix(a);try{o.setTransform(d)}catch(t){(0,i.warn)('RadialAxialShadingPattern.getPattern: "'.concat(null==t?void 0:t.message,'".'))}}return o}}]);return RadialAxialShadingPattern}(o);function drawTriangle(t,r,a,i,o,l,u,c){var d,h=r.coords,p=r.colors,m=t.data,g=4*t.width;if(h[a+1]>h[i+1]){d=a;a=i;i=d;d=l;l=u;u=d}if(h[i+1]>h[o+1]){d=i;i=o;o=d;d=u;u=c;c=d}if(h[a+1]>h[i+1]){d=a;a=i;i=d;d=l;l=u;u=d}var v=(h[a]+r.offsetX)*r.scaleX,y=(h[a+1]+r.offsetY)*r.scaleY,b=(h[i]+r.offsetX)*r.scaleX,S=(h[i+1]+r.offsetY)*r.scaleY,w=(h[o]+r.offsetX)*r.scaleX,C=(h[o+1]+r.offsetY)*r.scaleY;if(!(y>=C))for(var P,k,R,A,x,T,E,I,O=p[l],D=p[l+1],L=p[l+2],M=p[u],B=p[u+1],W=p[u+2],N=p[c],j=p[c+1],V=p[c+2],U=Math.round(y),q=Math.round(C),z=U;z<=q;z++){if(z<S){var H=void 0;P=v-(v-b)*(H=z<y?0:(y-z)/(y-S));k=O-(O-M)*H;R=D-(D-B)*H;A=L-(L-W)*H}else{var G=void 0;P=b-(b-w)*(G=z>C?1:S===C?0:(S-z)/(S-C));k=M-(M-N)*G;R=B-(B-j)*G;A=W-(W-V)*G}var Y=void 0;x=v-(v-w)*(Y=z<y?0:z>C?1:(y-z)/(y-C));T=O-(O-N)*Y;E=D-(D-j)*Y;I=L-(L-V)*Y;for(var Q=Math.round(Math.min(P,x)),X=Math.round(Math.max(P,x)),K=g*z+4*Q,$=Q;$<=X;$++){(Y=(P-$)/(P-x))<0?Y=0:Y>1&&(Y=1);m[K++]=k-(k-T)*Y|0;m[K++]=R-(R-E)*Y|0;m[K++]=A-(A-I)*Y|0;m[K++]=255}}}function drawFigure(t,r,a){var i,o,l=r.coords,u=r.colors;switch(r.type){case"lattice":var c=r.verticesPerRow,d=Math.floor(l.length/c)-1,h=c-1;for(i=0;i<d;i++)for(var p=i*c,m=0;m<h;m++,p++){drawTriangle(t,a,l[p],l[p+1],l[p+c],u[p],u[p+1],u[p+c]);drawTriangle(t,a,l[p+c+1],l[p+1],l[p+c],u[p+c+1],u[p+1],u[p+c])}break;case"triangles":for(i=0,o=l.length;i<o;i+=3)drawTriangle(t,a,l[i],l[i+1],l[i+2],u[i],u[i+1],u[i+2]);break;default:throw new Error("illegal figure")}}var u=function(t){_inherits(MeshShadingPattern,t);var r=_createSuper(MeshShadingPattern);function MeshShadingPattern(t){var a;_classCallCheck(this,MeshShadingPattern);(a=r.call(this))._coords=t[2];a._colors=t[3];a._figures=t[4];a._bounds=t[5];a._matrix=t[6];a._bbox=t[7];a._background=t[8];return a}_createClass(MeshShadingPattern,[{key:"_createMeshCanvas",value:function _createMeshCanvas(t,r,a){var i=Math.floor(this._bounds[0]),o=Math.floor(this._bounds[1]),l=Math.ceil(this._bounds[2])-i,u=Math.ceil(this._bounds[3])-o,c=Math.min(Math.ceil(Math.abs(l*t[0]*1.1)),3e3),d=Math.min(Math.ceil(Math.abs(u*t[1]*1.1)),3e3),h=l/c,p=u/d,m={coords:this._coords,colors:this._colors,offsetX:-i,offsetY:-o,scaleX:1/h,scaleY:1/p},g=c+4,v=d+4,y=a.getCanvas("mesh",g,v,!1),b=y.context,S=b.createImageData(c,d);if(r)for(var w=S.data,C=0,P=w.length;C<P;C+=4){w[C]=r[0];w[C+1]=r[1];w[C+2]=r[2];w[C+3]=255}var k,R=_createForOfIteratorHelper(this._figures);try{for(R.s();!(k=R.n()).done;){drawFigure(S,k.value,m)}}catch(t){R.e(t)}finally{R.f()}b.putImageData(S,2,2);return{canvas:y.canvas,offsetX:i-2*h,offsetY:o-2*p,scaleX:h,scaleY:p}}},{key:"getPattern",value:function getPattern(t,r,a){var o,l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];applyBoundingBox(t,this._bbox);if(l)o=i.Util.singularValueDecompose2dScale(t.mozCurrentTransform);else{o=i.Util.singularValueDecompose2dScale(r.baseTransform);if(this._matrix){var u=i.Util.singularValueDecompose2dScale(this._matrix);o=[o[0]*u[0],o[1]*u[1]]}}var c=this._createMeshCanvas(o,l?null:this._background,r.cachedCanvases);if(!l){t.setTransform.apply(t,r.baseTransform);this._matrix&&t.transform.apply(t,this._matrix)}t.translate(c.offsetX,c.offsetY);t.scale(c.scaleX,c.scaleY);return t.createPattern(c.canvas,"no-repeat")}}]);return MeshShadingPattern}(o),c=function(t){_inherits(DummyShadingPattern,t);var r=_createSuper(DummyShadingPattern);function DummyShadingPattern(){_classCallCheck(this,DummyShadingPattern);return r.apply(this,arguments)}_createClass(DummyShadingPattern,[{key:"getPattern",value:function getPattern(){return"hotpink"}}]);return DummyShadingPattern}(o);var d=1,h=2,p=function(){function TilingPattern(t,r,a,i,o){_classCallCheck(this,TilingPattern);this.operatorList=t[2];this.matrix=t[3]||[1,0,0,1,0,0];this.bbox=t[4];this.xstep=t[5];this.ystep=t[6];this.paintType=t[7];this.tilingType=t[8];this.color=r;this.ctx=a;this.canvasGraphicsFactory=i;this.baseTransform=o}_createClass(TilingPattern,[{key:"createPatternCanvas",value:function createPatternCanvas(t){var r=this.operatorList,a=this.bbox,o=this.xstep,l=this.ystep,u=this.paintType,c=this.tilingType,d=this.color,h=this.canvasGraphicsFactory;(0,i.info)("TilingType: "+c);var p=a[0],m=a[1],g=a[2],v=a[3],y=i.Util.singularValueDecompose2dScale(this.matrix),b=i.Util.singularValueDecompose2dScale(this.baseTransform),S=[y[0]*b[0],y[1]*b[1]],w=this.getSizeAndScale(o,this.ctx.canvas.width,S[0]),C=this.getSizeAndScale(l,this.ctx.canvas.height,S[1]),P=t.cachedCanvases.getCanvas("pattern",w.size,C.size,!0),k=P.context,R=h.createCanvasGraphics(k);R.groupLevel=t.groupLevel;this.setFillAndStrokeStyleToContext(R,u,d);var A=p,x=m,T=g,E=v;if(p<0){A=0;T+=Math.abs(p)}if(m<0){x=0;E+=Math.abs(m)}k.translate(-w.scale*A,-C.scale*x);R.transform(w.scale,0,0,C.scale,0,0);this.clipBbox(R,A,x,T,E);R.baseTransform=R.ctx.mozCurrentTransform.slice();R.executeOperatorList(r);R.endDrawing();return{canvas:P.canvas,scaleX:w.scale,scaleY:C.scale,offsetX:A,offsetY:x}}},{key:"getSizeAndScale",value:function getSizeAndScale(t,r,a){t=Math.abs(t);var i=Math.max(TilingPattern.MAX_PATTERN_SIZE,r),o=Math.ceil(t*a);o>=i?o=i:a=o/t;return{scale:a,size:o}}},{key:"clipBbox",value:function clipBbox(t,r,a,i,o){var l=i-r,u=o-a;t.ctx.rect(r,a,l,u);t.clip();t.endPath()}},{key:"setFillAndStrokeStyleToContext",value:function setFillAndStrokeStyleToContext(t,r,a){var o=t.ctx,l=t.current;switch(r){case d:var u=this.ctx;o.fillStyle=u.fillStyle;o.strokeStyle=u.strokeStyle;l.fillColor=u.fillStyle;l.strokeColor=u.strokeStyle;break;case h:var c=i.Util.makeHexColor(a[0],a[1],a[2]);o.fillStyle=c;o.strokeStyle=c;l.fillColor=c;l.strokeColor=c;break;default:throw new i.FormatError("Unsupported paint type: ".concat(r))}}},{key:"getPattern",value:function getPattern(t,r,a){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=a;if(!o){l=i.Util.transform(l,r.baseTransform);this.matrix&&(l=i.Util.transform(l,this.matrix))}var u=this.createPatternCanvas(r),c=new DOMMatrix(l);c=(c=c.translate(u.offsetX,u.offsetY)).scale(1/u.scaleX,1/u.scaleY);var d=t.createPattern(u.canvas,"repeat");try{d.setTransform(c)}catch(t){(0,i.warn)('TilingPattern.getPattern: "'.concat(null==t?void 0:t.message,'".'))}return d}}],[{key:"MAX_PATTERN_SIZE",get:function get(){return(0,i.shadow)(this,"MAX_PATTERN_SIZE",3e3)}}]);return TilingPattern}();r.TilingPattern=p},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.GlobalWorkerOptions=void 0;var a=Object.create(null);r.GlobalWorkerOptions=a;a.workerPort=void 0===a.workerPort?null:a.workerPort;a.workerSrc=void 0===a.workerSrc?"":a.workerSrc},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.MessageHandler=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}var l=1,u=2,c=1,d=2,h=3,p=4,m=5,g=6,v=7,y=8;function wrapReason(t){if("object"!==_typeof(t)||null===t)return t;switch(t.name){case"AbortException":return new o.AbortException(t.message);case"MissingPDFException":return new o.MissingPDFException(t.message);case"UnexpectedResponseException":return new o.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new o.UnknownErrorException(t.message,t.details);default:return new o.UnknownErrorException(t.message,t.toString())}}var b=function(){function MessageHandler(t,r,a){var i=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,MessageHandler);this.sourceName=t;this.targetName=r;this.comObj=a;this.callbackId=1;this.streamId=1;this.postMessageTransfers=!0;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);this._onComObjOnMessage=function(t){var r=t.data;if(r.targetName===i.sourceName)if(r.stream)i._processStreamMessage(r);else if(r.callback){var o=r.callbackId,c=i.callbackCapabilities[o];if(!c)throw new Error("Cannot resolve callback ".concat(o));delete i.callbackCapabilities[o];if(r.callback===l)c.resolve(r.data);else{if(r.callback!==u)throw new Error("Unexpected callback case");c.reject(wrapReason(r.reason))}}else{var d=i.actionHandler[r.action];if(!d)throw new Error("Unknown action from worker: ".concat(r.action));if(r.callbackId){var h=i.sourceName,p=r.sourceName;new Promise((function(t){t(d(r.data))})).then((function(t){a.postMessage({sourceName:h,targetName:p,callback:l,callbackId:r.callbackId,data:t})}),(function(t){a.postMessage({sourceName:h,targetName:p,callback:u,callbackId:r.callbackId,reason:wrapReason(t)})}))}else r.streamId?i._createStreamSink(r):d(r.data)}};a.addEventListener("message",this._onComObjOnMessage)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(MessageHandler,[{key:"on",value:function on(t,r){var a=this.actionHandler;if(a[t])throw new Error('There is already an actionName called "'.concat(t,'"'));a[t]=r}},{key:"send",value:function send(t,r,a){this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:r},a)}},{key:"sendWithPromise",value:function sendWithPromise(t,r,a){var i=this.callbackId++,l=(0,o.createPromiseCapability)();this.callbackCapabilities[i]=l;try{this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:r},a)}catch(t){l.reject(t)}return l.promise}},{key:"sendWithStream",value:function sendWithStream(t,r,a,i){var l=this,u=this.streamId++,d=this.sourceName,h=this.targetName,p=this.comObj;return new ReadableStream({start:function start(a){var c=(0,o.createPromiseCapability)();l.streamControllers[u]={controller:a,startCall:c,pullCall:null,cancelCall:null,isClosed:!1};l._postMessage({sourceName:d,targetName:h,action:t,streamId:u,data:r,desiredSize:a.desiredSize},i);return c.promise},pull:function pull(t){var r=(0,o.createPromiseCapability)();l.streamControllers[u].pullCall=r;p.postMessage({sourceName:d,targetName:h,stream:g,streamId:u,desiredSize:t.desiredSize});return r.promise},cancel:function cancel(t){(0,o.assert)(t instanceof Error,"cancel must have a valid reason");var r=(0,o.createPromiseCapability)();l.streamControllers[u].cancelCall=r;l.streamControllers[u].isClosed=!0;p.postMessage({sourceName:d,targetName:h,stream:c,streamId:u,reason:wrapReason(t)});return r.promise}},a)}},{key:"_createStreamSink",value:function _createStreamSink(t){var r=this,a=this.actionHandler[t.action],i=t.streamId,l=this.sourceName,u=t.sourceName,c=this.comObj,d={enqueue:function enqueue(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,c=arguments.length>2?arguments[2]:void 0;if(!this.isCancelled){var d=this.desiredSize;this.desiredSize-=a;if(d>0&&this.desiredSize<=0){this.sinkCapability=(0,o.createPromiseCapability)();this.ready=this.sinkCapability.promise}r._postMessage({sourceName:l,targetName:u,stream:p,streamId:i,chunk:t},c)}},close:function close(){if(!this.isCancelled){this.isCancelled=!0;c.postMessage({sourceName:l,targetName:u,stream:h,streamId:i});delete r.streamSinks[i]}},error:function error(t){(0,o.assert)(t instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;c.postMessage({sourceName:l,targetName:u,stream:m,streamId:i,reason:wrapReason(t)})}},sinkCapability:(0,o.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};d.sinkCapability.resolve();d.ready=d.sinkCapability.promise;this.streamSinks[i]=d;new Promise((function(r){r(a(t.data,d))})).then((function(){c.postMessage({sourceName:l,targetName:u,stream:y,streamId:i,success:!0})}),(function(t){c.postMessage({sourceName:l,targetName:u,stream:y,streamId:i,reason:wrapReason(t)})}))}},{key:"_processStreamMessage",value:function _processStreamMessage(t){var r=t.streamId,a=this.sourceName,i=t.sourceName,l=this.comObj;switch(t.stream){case y:t.success?this.streamControllers[r].startCall.resolve():this.streamControllers[r].startCall.reject(wrapReason(t.reason));break;case v:t.success?this.streamControllers[r].pullCall.resolve():this.streamControllers[r].pullCall.reject(wrapReason(t.reason));break;case g:if(!this.streamSinks[r]){l.postMessage({sourceName:a,targetName:i,stream:v,streamId:r,success:!0});break}this.streamSinks[r].desiredSize<=0&&t.desiredSize>0&&this.streamSinks[r].sinkCapability.resolve();this.streamSinks[r].desiredSize=t.desiredSize;var u=this.streamSinks[t.streamId].onPull;new Promise((function(t){t(u&&u())})).then((function(){l.postMessage({sourceName:a,targetName:i,stream:v,streamId:r,success:!0})}),(function(t){l.postMessage({sourceName:a,targetName:i,stream:v,streamId:r,reason:wrapReason(t)})}));break;case p:(0,o.assert)(this.streamControllers[r],"enqueue should have stream controller");if(this.streamControllers[r].isClosed)break;this.streamControllers[r].controller.enqueue(t.chunk);break;case h:(0,o.assert)(this.streamControllers[r],"close should have stream controller");if(this.streamControllers[r].isClosed)break;this.streamControllers[r].isClosed=!0;this.streamControllers[r].controller.close();this._deleteStreamController(r);break;case m:(0,o.assert)(this.streamControllers[r],"error should have stream controller");this.streamControllers[r].controller.error(wrapReason(t.reason));this._deleteStreamController(r);break;case d:t.success?this.streamControllers[r].cancelCall.resolve():this.streamControllers[r].cancelCall.reject(wrapReason(t.reason));this._deleteStreamController(r);break;case c:if(!this.streamSinks[r])break;var b=this.streamSinks[t.streamId].onCancel;new Promise((function(r){r(b&&b(wrapReason(t.reason)))})).then((function(){l.postMessage({sourceName:a,targetName:i,stream:d,streamId:r,success:!0})}),(function(t){l.postMessage({sourceName:a,targetName:i,stream:d,streamId:r,reason:wrapReason(t)})})).catch((function(t){console.log("Caught an error of the worker thread: "+t)}));this.streamSinks[r].sinkCapability.reject(wrapReason(t.reason));this.streamSinks[r].isCancelled=!0;delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}},{key:"_deleteStreamController",value:(t=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(i.default.mark((function _callee(t){return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:r.next=2;return Promise.allSettled([this.streamControllers[t].startCall,this.streamControllers[t].pullCall,this.streamControllers[t].cancelCall].map((function(t){return t&&t.promise})));case 2:delete this.streamControllers[t];case 3:case"end":return r.stop()}}),_callee,this)}))),function _deleteStreamController(r){return t.apply(this,arguments)})},{key:"_postMessage",value:function _postMessage(t,r){r&&this.postMessageTransfers?this.comObj.postMessage(t,r):this.comObj.postMessage(t)}},{key:"destroy",value:function destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}]);var t;return MessageHandler}();r.MessageHandler=b},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Metadata=void 0;var i=a(4);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function Metadata(t){var r=t.parsedData,a=t.rawData;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,Metadata);this._metadataMap=r;this._data=a}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(Metadata,[{key:"getRaw",value:function getRaw(){return this._data}},{key:"get",value:function get(t){var r;return null!==(r=this._metadataMap.get(t))&&void 0!==r?r:null}},{key:"getAll",value:function getAll(){return(0,i.objectFromMap)(this._metadataMap)}},{key:"has",value:function has(t){return this._metadataMap.has(t)}}]);return Metadata}();r.Metadata=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.OptionalContentConfig=void 0;var i=a(4);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var o=function OptionalContentGroup(t,r){_classCallCheck(this,OptionalContentGroup);this.visible=!0;this.name=t;this.intent=r},l=function(){function OptionalContentConfig(t){_classCallCheck(this,OptionalContentConfig);this.name=null;this.creator=null;this._order=null;this._groups=new Map;if(null!==t){this.name=t.name;this.creator=t.creator;this._order=t.order;var r,a=_createForOfIteratorHelper(t.groups);try{for(a.s();!(r=a.n()).done;){var i=r.value;this._groups.set(i.id,new o(i.name,i.intent))}}catch(t){a.e(t)}finally{a.f()}if("OFF"===t.baseState){var l,u=_createForOfIteratorHelper(this._groups);try{for(u.s();!(l=u.n()).done;){l.value.visible=!1}}catch(t){u.e(t)}finally{u.f()}}var c,d=_createForOfIteratorHelper(t.on);try{for(d.s();!(c=d.n()).done;){var h=c.value;this._groups.get(h).visible=!0}}catch(t){d.e(t)}finally{d.f()}var p,m=_createForOfIteratorHelper(t.off);try{for(m.s();!(p=m.n()).done;){var g=p.value;this._groups.get(g).visible=!1}}catch(t){m.e(t)}finally{m.f()}}}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(OptionalContentConfig,[{key:"_evaluateVisibilityExpression",value:function _evaluateVisibilityExpression(t){var r=t.length;if(r<2)return!0;for(var a=t[0],o=1;o<r;o++){var l=t[o],u=void 0;if(Array.isArray(l))u=this._evaluateVisibilityExpression(l);else{if(!this._groups.has(l)){(0,i.warn)("Optional content group not found: ".concat(l));return!0}u=this._groups.get(l).visible}switch(a){case"And":if(!u)return!1;break;case"Or":if(u)return!0;break;case"Not":return!u;default:return!0}}return"And"===a}},{key:"isVisible",value:function isVisible(t){if("OCG"===t.type){if(!this._groups.has(t.id)){(0,i.warn)("Optional content group not found: ".concat(t.id));return!0}return this._groups.get(t.id).visible}if("OCMD"===t.type){if(t.expression)return this._evaluateVisibilityExpression(t.expression);if(!t.policy||"AnyOn"===t.policy){var r,a=_createForOfIteratorHelper(t.ids);try{for(a.s();!(r=a.n()).done;){var o=r.value;if(!this._groups.has(o)){(0,i.warn)("Optional content group not found: ".concat(o));return!0}if(this._groups.get(o).visible)return!0}}catch(t){a.e(t)}finally{a.f()}return!1}if("AllOn"===t.policy){var l,u=_createForOfIteratorHelper(t.ids);try{for(u.s();!(l=u.n()).done;){var c=l.value;if(!this._groups.has(c)){(0,i.warn)("Optional content group not found: ".concat(c));return!0}if(!this._groups.get(c).visible)return!1}}catch(t){u.e(t)}finally{u.f()}return!0}if("AnyOff"===t.policy){var d,h=_createForOfIteratorHelper(t.ids);try{for(h.s();!(d=h.n()).done;){var p=d.value;if(!this._groups.has(p)){(0,i.warn)("Optional content group not found: ".concat(p));return!0}if(!this._groups.get(p).visible)return!0}}catch(t){h.e(t)}finally{h.f()}return!1}if("AllOff"===t.policy){var m,g=_createForOfIteratorHelper(t.ids);try{for(g.s();!(m=g.n()).done;){var v=m.value;if(!this._groups.has(v)){(0,i.warn)("Optional content group not found: ".concat(v));return!0}if(this._groups.get(v).visible)return!1}}catch(t){g.e(t)}finally{g.f()}return!0}(0,i.warn)("Unknown optional content policy ".concat(t.policy,"."));return!0}(0,i.warn)("Unknown group type ".concat(t.type,"."));return!0}},{key:"setVisibility",value:function setVisibility(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._groups.has(t)?this._groups.get(t).visible=!!r:(0,i.warn)("Optional content group not found: ".concat(t))}},{key:"getOrder",value:function getOrder(){return this._groups.size?this._order?this._order.slice():Array.from(this._groups.keys()):null}},{key:"getGroups",value:function getGroups(){return this._groups.size>0?(0,i.objectFromMap)(this._groups):null}},{key:"getGroup",value:function getGroup(t){return this._groups.get(t)||null}}]);return OptionalContentConfig}();r.OptionalContentConfig=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFDataTransportStream=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4),l=a(1);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var u=function(){function PDFDataTransportStream(t,r){var a=this;_classCallCheck(this,PDFDataTransportStream);(0,o.assert)(r,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=t.progressiveDone||!1;this._contentDispositionFilename=t.contentDispositionFilename||null;var i=t.initialData;if((null==i?void 0:i.length)>0){var l=new Uint8Array(i).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=r;this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;this._contentLength=t.length;this._fullRequestReader=null;this._rangeReaders=[];this._pdfDataRangeTransport.addRangeListener((function(t,r){a._onReceiveData({begin:t,chunk:r})}));this._pdfDataRangeTransport.addProgressListener((function(t,r){a._onProgress({loaded:t,total:r})}));this._pdfDataRangeTransport.addProgressiveReadListener((function(t){a._onReceiveData({chunk:t})}));this._pdfDataRangeTransport.addProgressiveDoneListener((function(){a._onProgressiveDone()}));this._pdfDataRangeTransport.transportReady()}_createClass(PDFDataTransportStream,[{key:"_onReceiveData",value:function _onReceiveData(t){var r=new Uint8Array(t.chunk).buffer;if(void 0===t.begin)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{var a=this._rangeReaders.some((function(a){if(a._begin!==t.begin)return!1;a._enqueue(r);return!0}));(0,o.assert)(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}},{key:"_progressiveDataLength",get:function get(){var t,r;return null!==(t=null===(r=this._fullRequestReader)||void 0===r?void 0:r._loaded)&&void 0!==t?t:0}},{key:"_onProgress",value:function _onProgress(t){if(void 0===t.total){var r=this._rangeReaders[0];null!=r&&r.onProgress&&r.onProgress({loaded:t.loaded})}else{var a=this._fullRequestReader;null!=a&&a.onProgress&&a.onProgress({loaded:t.loaded,total:t.total})}}},{key:"_onProgressiveDone",value:function _onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone();this._progressiveDone=!0}},{key:"_removeRangeReader",value:function _removeRangeReader(t){var r=this._rangeReaders.indexOf(t);r>=0&&this._rangeReaders.splice(r,1)}},{key:"getFullReader",value:function getFullReader(){(0,o.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");var t=this._queuedChunks;this._queuedChunks=null;return new c(this,t,this._progressiveDone,this._contentDispositionFilename)}},{key:"getRangeReader",value:function getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;var a=new d(this,t,r);this._pdfDataRangeTransport.requestDataRange(t,r);this._rangeReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}this._pdfDataRangeTransport.abort()}}]);return PDFDataTransportStream}();r.PDFDataTransportStream=u;var c=function(){function PDFDataTransportStreamReader(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,PDFDataTransportStreamReader);this._stream=t;this._done=a||!1;this._filename=(0,l.isPdfFile)(i)?i:null;this._queuedChunks=r||[];this._loaded=0;var o,u=_createForOfIteratorHelper(this._queuedChunks);try{for(u.s();!(o=u.n()).done;){var c=o.value;this._loaded+=c.byteLength}}catch(t){u.e(t)}finally{u.f()}this._requests=[];this._headersReady=Promise.resolve();t._fullRequestReader=this;this.onProgress=null}_createClass(PDFDataTransportStreamReader,[{key:"_enqueue",value:function _enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}},{key:"headersReady",get:function get(){return this._headersReady}},{key:"filename",get:function get(){return this._filename}},{key:"isRangeSupported",get:function get(){return this._stream._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._stream._isStreamingSupported}},{key:"contentLength",get:function get(){return this._stream._contentLength}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee(){var t,r;return i.default.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(!(this._queuedChunks.length>0)){a.next=3;break}t=this._queuedChunks.shift();return a.abrupt("return",{value:t,done:!1});case 3:if(!this._done){a.next=5;break}return a.abrupt("return",{value:void 0,done:!0});case 5:r=(0,o.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 8:case"end":return a.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0}},{key:"progressiveDone",value:function progressiveDone(){this._done||(this._done=!0)}}]);var t;return PDFDataTransportStreamReader}(),d=function(){function PDFDataTransportStreamRangeReader(t,r,a){_classCallCheck(this,PDFDataTransportStreamRangeReader);this._stream=t;this._begin=r;this._end=a;this._queuedChunk=null;this._requests=[];this._done=!1;this.onProgress=null}_createClass(PDFDataTransportStreamRangeReader,[{key:"_enqueue",value:function _enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0}this._done=!0;this._stream._removeRangeReader(this)}}},{key:"isStreamingSupported",get:function get(){return!1}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee2(){var t,r;return i.default.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(!this._queuedChunk){a.next=4;break}t=this._queuedChunk;this._queuedChunk=null;return a.abrupt("return",{value:t,done:!1});case 4:if(!this._done){a.next=6;break}return a.abrupt("return",{value:void 0,done:!0});case 6:r=(0,o.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 9:case"end":return a.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._stream._removeRangeReader(this)}}]);var t;return PDFDataTransportStreamRangeReader}()},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.AnnotationLayer=void 0;var i=a(1),o=a(4),l=a(122),u=a(131);function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var c=function(){function AnnotationElementFactory(){_classCallCheck(this,AnnotationElementFactory)}_createClass(AnnotationElementFactory,null,[{key:"create",value:function create(t){switch(t.data.annotationType){case o.AnnotationType.LINK:return new h(t);case o.AnnotationType.TEXT:return new p(t);case o.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new g(t);case"Btn":return t.data.radioButton?new y(t):t.data.checkBox?new v(t):new b(t);case"Ch":return new S(t)}return new m(t);case o.AnnotationType.POPUP:return new w(t);case o.AnnotationType.FREETEXT:return new P(t);case o.AnnotationType.LINE:return new k(t);case o.AnnotationType.SQUARE:return new R(t);case o.AnnotationType.CIRCLE:return new A(t);case o.AnnotationType.POLYLINE:return new x(t);case o.AnnotationType.CARET:return new E(t);case o.AnnotationType.INK:return new I(t);case o.AnnotationType.POLYGON:return new T(t);case o.AnnotationType.HIGHLIGHT:return new O(t);case o.AnnotationType.UNDERLINE:return new D(t);case o.AnnotationType.SQUIGGLY:return new L(t);case o.AnnotationType.STRIKEOUT:return new M(t);case o.AnnotationType.STAMP:return new B(t);case o.AnnotationType.FILEATTACHMENT:return new W(t);default:return new d(t)}}}]);return AnnotationElementFactory}(),d=function(){function AnnotationElement(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.isRenderable,i=void 0!==a&&a,o=r.ignoreBorder,l=void 0!==o&&o,u=r.createQuadrilaterals,c=void 0!==u&&u;_classCallCheck(this,AnnotationElement);this.isRenderable=i;this.data=t.data;this.layer=t.layer;this.page=t.page;this.viewport=t.viewport;this.linkService=t.linkService;this.downloadManager=t.downloadManager;this.imageResourcesPath=t.imageResourcesPath;this.renderInteractiveForms=t.renderInteractiveForms;this.svgFactory=t.svgFactory;this.annotationStorage=t.annotationStorage;this.enableScripting=t.enableScripting;this.hasJSActions=t.hasJSActions;this._mouseState=t.mouseState;i&&(this.container=this._createContainer(l));c&&(this.quadrilaterals=this._createQuadrilaterals(l))}_createClass(AnnotationElement,[{key:"_createContainer",value:function _createContainer(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.data,a=this.page,i=this.viewport,l=document.createElement("section"),u=r.rect[2]-r.rect[0],c=r.rect[3]-r.rect[1];l.setAttribute("data-annotation-id",r.id);var d=o.Util.normalizeRect([r.rect[0],a.view[3]-r.rect[1]+a.view[1],r.rect[2],a.view[3]-r.rect[3]+a.view[1]]);l.style.transform="matrix(".concat(i.transform.join(","),")");l.style.transformOrigin="".concat(-d[0],"px ").concat(-d[1],"px");if(!t&&r.borderStyle.width>0){l.style.borderWidth="".concat(r.borderStyle.width,"px");if(r.borderStyle.style!==o.AnnotationBorderStyleType.UNDERLINE){u-=2*r.borderStyle.width;c-=2*r.borderStyle.width}var h=r.borderStyle.horizontalCornerRadius,p=r.borderStyle.verticalCornerRadius;if(h>0||p>0){var m="".concat(h,"px / ").concat(p,"px");l.style.borderRadius=m}switch(r.borderStyle.style){case o.AnnotationBorderStyleType.SOLID:l.style.borderStyle="solid";break;case o.AnnotationBorderStyleType.DASHED:l.style.borderStyle="dashed";break;case o.AnnotationBorderStyleType.BEVELED:(0,o.warn)("Unimplemented border style: beveled");break;case o.AnnotationBorderStyleType.INSET:(0,o.warn)("Unimplemented border style: inset");break;case o.AnnotationBorderStyleType.UNDERLINE:l.style.borderBottomStyle="solid"}r.color?l.style.borderColor=o.Util.makeHexColor(0|r.color[0],0|r.color[1],0|r.color[2]):l.style.borderWidth=0}l.style.left="".concat(d[0],"px");l.style.top="".concat(d[1],"px");l.style.width="".concat(u,"px");l.style.height="".concat(c,"px");return l}},{key:"_createQuadrilaterals",value:function _createQuadrilaterals(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;var r,a=[],i=this.data.rect,o=_createForOfIteratorHelper(this.data.quadPoints);try{for(o.s();!(r=o.n()).done;){var l=r.value;this.data.rect=[l[2].x,l[2].y,l[1].x,l[1].y];a.push(this._createContainer(t))}}catch(t){o.e(t)}finally{o.f()}this.data.rect=i;return a}},{key:"_createPopup",value:function _createPopup(t,r){var a=this.container;if(this.quadrilaterals){t=t||this.quadrilaterals;a=this.quadrilaterals[0]}if(!t){(t=document.createElement("div")).style.height=a.style.height;t.style.width=a.style.width;a.appendChild(t)}var i=new C({container:a,trigger:t,color:r.color,title:r.title,modificationDate:r.modificationDate,contents:r.contents,hideWrapper:!0}).render();i.style.left=a.style.width;a.appendChild(i)}},{key:"_renderQuadrilaterals",value:function _renderQuadrilaterals(t){var r,a=_createForOfIteratorHelper(this.quadrilaterals);try{for(a.s();!(r=a.n()).done;){r.value.className=t}}catch(t){a.e(t)}finally{a.f()}return this.quadrilaterals}},{key:"render",value:function render(){(0,o.unreachable)("Abstract method `AnnotationElement.render` called")}}]);return AnnotationElement}(),h=function(t){_inherits(LinkAnnotationElement,t);var r=_createSuper(LinkAnnotationElement);function LinkAnnotationElement(t){_classCallCheck(this,LinkAnnotationElement);var a=!!(t.data.url||t.data.dest||t.data.action||t.data.isTooltipOnly||t.data.actions&&(t.data.actions.Action||t.data.actions["Mouse Up"]||t.data.actions["Mouse Down"]));return r.call(this,t,{isRenderable:a,createQuadrilaterals:!0})}_createClass(LinkAnnotationElement,[{key:"render",value:function render(){var t=this.data,r=this.linkService,a=document.createElement("a");t.url?(0,i.addLinkAttributes)(a,{url:t.url,target:t.newWindow?i.LinkTarget.BLANK:r.externalLinkTarget,rel:r.externalLinkRel,enabled:r.externalLinkEnabled}):t.action?this._bindNamedAction(a,t.action):t.dest?this._bindLink(a,t.dest):t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions?this._bindJSAction(a,t):this._bindLink(a,"");if(this.quadrilaterals)return this._renderQuadrilaterals("linkAnnotation").map((function(t,r){var i=0===r?a:a.cloneNode();t.appendChild(i);return t}));this.container.className="linkAnnotation";this.container.appendChild(a);return this.container}},{key:"_bindLink",value:function _bindLink(t,r){var a=this;t.href=this.linkService.getDestinationHash(r);t.onclick=function(){r&&a.linkService.goToDestination(r);return!1};(r||""===r)&&(t.className="internalLink")}},{key:"_bindNamedAction",value:function _bindNamedAction(t,r){var a=this;t.href=this.linkService.getAnchorUrl("");t.onclick=function(){a.linkService.executeNamedAction(r);return!1};t.className="internalLink"}},{key:"_bindJSAction",value:function _bindJSAction(t,r){var a=this;t.href=this.linkService.getAnchorUrl("");for(var i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]),o=function _loop(){var o=u[l],c=i.get(o);if(!c)return"continue";t[c]=function(){var t;null===(t=a.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:a,detail:{id:r.id,name:o}});return!1}},l=0,u=Object.keys(r.actions);l<u.length;l++)o();t.className="internalLink"}}]);return LinkAnnotationElement}(d),p=function(t){_inherits(TextAnnotationElement,t);var r=_createSuper(TextAnnotationElement);function TextAnnotationElement(t){_classCallCheck(this,TextAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a})}_createClass(TextAnnotationElement,[{key:"render",value:function render(){this.container.className="textAnnotation";var t=document.createElement("img");t.style.height=this.container.style.height;t.style.width=this.container.style.width;t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg";t.alt="[{{type}} Annotation]";t.dataset.l10nId="text_annotation_type";t.dataset.l10nArgs=JSON.stringify({type:this.data.name});this.data.hasPopup||this._createPopup(t,this.data);this.container.appendChild(t);return this.container}}]);return TextAnnotationElement}(d),m=function(t){_inherits(WidgetAnnotationElement,t);var r=_createSuper(WidgetAnnotationElement);function WidgetAnnotationElement(){_classCallCheck(this,WidgetAnnotationElement);return r.apply(this,arguments)}_createClass(WidgetAnnotationElement,[{key:"render",value:function render(){this.data.alternativeText&&(this.container.title=this.data.alternativeText);return this.container}},{key:"_getKeyModifier",value:function _getKeyModifier(t){return navigator.platform.includes("Win")&&t.ctrlKey||navigator.platform.includes("Mac")&&t.metaKey}},{key:"_setEventListener",value:function _setEventListener(t,r,a,i){var o=this;r.includes("mouse")?t.addEventListener(r,(function(t){var r;null===(r=o.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:o,detail:{id:o.data.id,name:a,value:i(t),shift:t.shiftKey,modifier:o._getKeyModifier(t)}})})):t.addEventListener(r,(function(t){var r;null===(r=o.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:o,detail:{id:o.data.id,name:a,value:t.target.checked}})}))}},{key:"_setEventListeners",value:function _setEventListeners(t,r,a){var i,o=_createForOfIteratorHelper(r);try{for(o.s();!(i=o.n()).done;){var l,u=_slicedToArray(i.value,2),c=u[0],d=u[1];("Action"===d||null!==(l=this.data.actions)&&void 0!==l&&l[d])&&this._setEventListener(t,c,d,a)}}catch(t){o.e(t)}finally{o.f()}}},{key:"_dispatchEventFromSandbox",value:function _dispatchEventFromSandbox(t,r){for(var a=this,i=function setColor(t,r,a){var i=a.detail[t];a.target.style[r]=u.ColorConverters["".concat(i[0],"_HTML")](i.slice(1))},o={display:function display(t){var r=t.detail.display%2==1;t.target.style.visibility=r?"hidden":"visible";a.annotationStorage.setValue(a.data.id,a.data.fieldName,{hidden:r,print:0===t.detail.display||3===t.detail.display})},print:function print(t){a.annotationStorage.setValue(a.data.id,a.data.fieldName,{print:t.detail.print})},hidden:function hidden(t){t.target.style.visibility=t.detail.hidden?"hidden":"visible";a.annotationStorage.setValue(a.data.id,a.data.fieldName,{hidden:t.detail.hidden})},focus:function focus(t){setTimeout((function(){return t.target.focus({preventScroll:!1})}),0)},userName:function userName(t){t.target.title=t.detail.userName},readonly:function readonly(t){t.detail.readonly?t.target.setAttribute("readonly",""):t.target.removeAttribute("readonly")},required:function required(t){t.detail.required?t.target.setAttribute("required",""):t.target.removeAttribute("required")},bgColor:function bgColor(t){i("bgColor","backgroundColor",t)},fillColor:function fillColor(t){i("fillColor","backgroundColor",t)},fgColor:function fgColor(t){i("fgColor","color",t)},textColor:function textColor(t){i("textColor","color",t)},borderColor:function borderColor(t){i("borderColor","borderColor",t)},strokeColor:function strokeColor(t){i("strokeColor","borderColor",t)}},l=0,c=Object.keys(r.detail);l<c.length;l++){var d=c[l],h=t[d]||o[d];h&&h(r)}}}]);return WidgetAnnotationElement}(d),g=function(t){_inherits(TextWidgetAnnotationElement,t);var r=_createSuper(TextWidgetAnnotationElement);function TextWidgetAnnotationElement(t){_classCallCheck(this,TextWidgetAnnotationElement);var a=t.renderInteractiveForms||!t.data.hasAppearance&&!!t.data.fieldValue;return r.call(this,t,{isRenderable:a})}_createClass(TextWidgetAnnotationElement,[{key:"setPropertyOnSiblings",value:function setPropertyOnSiblings(t,r,a,i){var o,l=this.annotationStorage,u=_createForOfIteratorHelper(document.getElementsByName(t.name));try{for(u.s();!(o=u.n()).done;){var c=o.value;if(c!==t){c[r]=a;var d=Object.create(null);d[i]=a;l.setValue(c.getAttribute("id"),this.data.fieldName,d)}}}catch(t){u.e(t)}finally{u.f()}}},{key:"render",value:function render(){var t=this,r=this.annotationStorage,a=this.data.id;this.container.className="textWidgetAnnotation";var i=null;if(this.renderInteractiveForms){var o=r.getValue(a,this.data.fieldName,{value:this.data.fieldValue,valueAsString:this.data.fieldValue}),l=o.valueAsString||o.value||"",u={userValue:null,formattedValue:null,beforeInputSelectionRange:null,beforeInputValue:null};if(this.data.multiLine)(i=document.createElement("textarea")).textContent=l;else{(i=document.createElement("input")).type="text";i.setAttribute("value",l)}u.userValue=l;i.setAttribute("id",a);i.addEventListener("input",(function(o){r.setValue(a,t.data.fieldName,{value:o.target.value});t.setPropertyOnSiblings(i,"value",o.target.value,"value")}));var c=function blurListener(t){u.formattedValue&&(t.target.value=u.formattedValue);t.target.scrollLeft=0;u.beforeInputSelectionRange=null};if(this.enableScripting&&this.hasJSActions){var d;i.addEventListener("focus",(function(t){u.userValue&&(t.target.value=u.userValue)}));var h=this.data.fieldName;i.addEventListener("updatefromsandbox",(function(i){var o={value:function value(t){u.userValue=t.detail.value||"";r.setValue(a,h,{value:u.userValue.toString()});u.formattedValue||(t.target.value=u.userValue)},valueAsString:function valueAsString(t){u.formattedValue=t.detail.valueAsString||"";t.target!==document.activeElement&&(t.target.value=u.formattedValue);r.setValue(a,h,{formattedValue:u.formattedValue})},selRange:function selRange(t){var r=_slicedToArray(t.detail.selRange,2),a=r[0],i=r[1];a>=0&&i<t.target.value.length&&t.target.setSelectionRange(a,i)}};t._dispatchEventFromSandbox(o,i)}));i.addEventListener("keydown",(function(r){var i;u.beforeInputValue=r.target.value;var o=-1;"Escape"===r.key?o=0:"Enter"===r.key?o=2:"Tab"===r.key&&(o=3);if(-1!==o){u.userValue=r.target.value;null===(i=t.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:r.target.value,willCommit:!0,commitKey:o,selStart:r.target.selectionStart,selEnd:r.target.selectionEnd}})}}));var p=c;c=null;i.addEventListener("blur",(function(r){if(t._mouseState.isDown){var i;u.userValue=r.target.value;null===(i=t.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:r.target.value,willCommit:!0,commitKey:1,selStart:r.target.selectionStart,selEnd:r.target.selectionEnd}})}p(r)}));i.addEventListener("mousedown",(function(t){u.beforeInputValue=t.target.value;u.beforeInputSelectionRange=null}));i.addEventListener("keyup",(function(t){t.target.selectionStart===t.target.selectionEnd&&(u.beforeInputSelectionRange=null)}));i.addEventListener("select",(function(t){u.beforeInputSelectionRange=[t.target.selectionStart,t.target.selectionEnd]}));null!==(d=this.data.actions)&&void 0!==d&&d.Keystroke&&i.addEventListener("input",(function(r){var i,o=-1,l=-1;if(u.beforeInputSelectionRange){var c=_slicedToArray(u.beforeInputSelectionRange,2);o=c[0];l=c[1]}null===(i=t.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:u.beforeInputValue,change:r.data,willCommit:!1,selStart:o,selEnd:l}})}));this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(t){return t.target.value}))}c&&i.addEventListener("blur",c);i.disabled=this.data.readOnly;i.name=this.data.fieldName;null!==this.data.maxLen&&(i.maxLength=this.data.maxLen);if(this.data.comb){var m=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;i.classList.add("comb");i.style.letterSpacing="calc(".concat(m,"px - 1ch)")}}else{(i=document.createElement("div")).textContent=this.data.fieldValue;i.style.verticalAlign="middle";i.style.display="table-cell"}this._setTextStyle(i);this.container.appendChild(i);return this.container}},{key:"_setTextStyle",value:function _setTextStyle(t){var r=this.data.defaultAppearanceData,a=r.fontSize,i=r.fontColor,l=t.style;a&&(l.fontSize="".concat(a,"px"));l.color=o.Util.makeHexColor(i[0],i[1],i[2]);null!==this.data.textAlignment&&(l.textAlign=["left","center","right"][this.data.textAlignment])}}]);return TextWidgetAnnotationElement}(m),v=function(t){_inherits(CheckboxWidgetAnnotationElement,t);var r=_createSuper(CheckboxWidgetAnnotationElement);function CheckboxWidgetAnnotationElement(t){_classCallCheck(this,CheckboxWidgetAnnotationElement);return r.call(this,t,{isRenderable:t.renderInteractiveForms})}_createClass(CheckboxWidgetAnnotationElement,[{key:"render",value:function render(){var t=this,r=this.annotationStorage,a=this.data,i=a.id,o=r.getValue(i,this.data.fieldName,{value:a.fieldValue&&(a.exportValue&&a.exportValue===a.fieldValue||!a.exportValue&&"Off"!==a.fieldValue)}).value;if("string"==typeof o){o="Off"!==o;r.setValue(i,this.data.fieldName,{value:o})}this.container.className="buttonWidgetAnnotation checkBox";var l=document.createElement("input");l.disabled=a.readOnly;l.type="checkbox";l.name=this.data.fieldName;o&&l.setAttribute("checked",!0);l.setAttribute("id",i);l.addEventListener("change",(function(a){var o,l=a.target.name,u=_createForOfIteratorHelper(document.getElementsByName(l));try{for(u.s();!(o=u.n()).done;){var c=o.value;if(c!==a.target){c.checked=!1;r.setValue(c.parentNode.getAttribute("data-annotation-id"),t.data.fieldName,{value:!1})}}}catch(t){u.e(t)}finally{u.f()}r.setValue(i,t.data.fieldName,{value:a.target.checked})}));if(this.enableScripting&&this.hasJSActions){var u=this.data.fieldName;l.addEventListener("updatefromsandbox",(function(a){var o={value:function value(t){t.target.checked="Off"!==t.detail.value;r.setValue(i,u,{value:t.target.checked})}};t._dispatchEventFromSandbox(o,a)}));this._setEventListeners(l,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(t){return t.target.checked}))}this.container.appendChild(l);return this.container}}]);return CheckboxWidgetAnnotationElement}(m),y=function(t){_inherits(RadioButtonWidgetAnnotationElement,t);var r=_createSuper(RadioButtonWidgetAnnotationElement);function RadioButtonWidgetAnnotationElement(t){_classCallCheck(this,RadioButtonWidgetAnnotationElement);return r.call(this,t,{isRenderable:t.renderInteractiveForms})}_createClass(RadioButtonWidgetAnnotationElement,[{key:"render",value:function render(){var t=this;this.container.className="buttonWidgetAnnotation radioButton";var r=this.annotationStorage,a=this.data,i=a.id,o=r.getValue(i,this.data.fieldName,{value:a.fieldValue===a.buttonValue},this.data.buttonValue).value;if("string"==typeof o){o=o!==a.buttonValue;r.setValue(i,this.data.fieldName,{value:o},this.data.buttonValue)}var l=document.createElement("input");l.disabled=a.readOnly;l.type="radio";l.name=a.fieldName;o&&l.setAttribute("checked",!0);l.setAttribute("id",i);l.addEventListener("change",(function(a){var o,l=a.target,u=_createForOfIteratorHelper(document.getElementsByName(l.name));try{for(u.s();!(o=u.n()).done;){var c=o.value;if(c!==l){window.setFormValue&&window.setFormValue(c.getAttribute("id"),!1);r.setValue(c.getAttribute("id"),t.data.fieldName,{value:!1,emitMessage:!1})}}}catch(t){u.e(t)}finally{u.f()}r.setValue(i,t.data.fieldName,{value:l.checked,radioValue:t.data.buttonValue})}));if(this.enableScripting&&this.hasJSActions){var u=a.buttonValue;l.addEventListener("updatefromsandbox",(function(a){var o=t.data.fieldName,l={value:function value(t){var a,l=u===t.detail.value,c=_createForOfIteratorHelper(document.getElementsByName(t.target.name));try{for(c.s();!(a=c.n()).done;){var d=a.value,h=d.getAttribute("id");d.checked=h===i&&l;r.setValue(h,o,{value:d.checked})}}catch(t){c.e(t)}finally{c.f()}}};t._dispatchEventFromSandbox(l,a)}));this._setEventListeners(l,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(t){return t.target.checked}))}this.container.appendChild(l);return this.container}}]);return RadioButtonWidgetAnnotationElement}(m),b=function(t){_inherits(PushButtonWidgetAnnotationElement,t);var r=_createSuper(PushButtonWidgetAnnotationElement);function PushButtonWidgetAnnotationElement(){_classCallCheck(this,PushButtonWidgetAnnotationElement);return r.apply(this,arguments)}_createClass(PushButtonWidgetAnnotationElement,[{key:"render",value:function render(){var t=_get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype),"render",this).call(this);t.className="buttonWidgetAnnotation pushButton";this.data.alternativeText&&(t.title=this.data.alternativeText);return t}}]);return PushButtonWidgetAnnotationElement}(h),S=function(t){_inherits(ChoiceWidgetAnnotationElement,t);var r=_createSuper(ChoiceWidgetAnnotationElement);function ChoiceWidgetAnnotationElement(t){_classCallCheck(this,ChoiceWidgetAnnotationElement);return r.call(this,t,{isRenderable:t.renderInteractiveForms})}_createClass(ChoiceWidgetAnnotationElement,[{key:"render",value:function render(){var t=this;this.container.className="choiceWidgetAnnotation";var r=this.annotationStorage,a=this.data.id,i=r.getValue(a,this.data.fieldName,{value:this.data.fieldValue.length>0?this.data.fieldValue[0]:void 0}).value;this.data.fieldValue=i;var o=document.createElement("select");o.disabled=this.data.readOnly;o.name=this.data.fieldName;o.setAttribute("id",a);if(!this.data.combo){o.size=this.data.options.length;this.data.multiSelect&&(o.multiple=!0)}var l,u=_createForOfIteratorHelper(this.data.options);try{for(u.s();!(l=u.n()).done;){var c=l.value,d=document.createElement("option");d.textContent=c.displayValue;d.value=c.exportValue;this.data.fieldValue.includes(c.exportValue)&&d.setAttribute("selected",!0);o.appendChild(d)}}catch(t){u.e(t)}finally{u.f()}var h=function getValue(t,r){var a=r?"value":"textContent",i=t.target.options;return t.target.multiple?Array.prototype.filter.call(i,(function(t){return t.selected})).map((function(t){return t[a]})):-1===i.selectedIndex?null:i[i.selectedIndex][a]},p=function getItems(t){var r=t.target.options;return Array.prototype.map.call(r,(function(t){return{displayValue:t.textContent,exportValue:t.value}}))};if(this.enableScripting&&this.hasJSActions){o.addEventListener("updatefromsandbox",(function(i){var l=t.data.fieldName,u={value:function value(t){var i=o.options,value=t.detail.value,u=new Set(Array.isArray(value)?value:[value]);Array.prototype.forEach.call(i,(function(t){t.selected=u.has(t.value)}));r.setValue(a,l,{value:h(t,!0)})},multipleSelection:function multipleSelection(t){o.multiple=!0},remove:function remove(t){var i=o.options,l=t.detail.remove;i[l].selected=!1;o.remove(l);if(i.length>0){var u=Array.prototype.findIndex.call(i,(function(t){return t.selected}));-1===u&&(i[0].selected=!0)}r.setValue(a,this.data.fieldName,{value:h(t,!0),items:p(t)})},clear:function clear(t){for(;0!==o.length;)o.remove(0);r.setValue(a,this.data.fieldName,{value:null,items:[]})},insert:function insert(t){var i=t.detail.insert,l=i.index,u=i.displayValue,c=i.exportValue,d=document.createElement("option");d.textContent=u;d.value=c;o.insertBefore(d,o.children[l]);r.setValue(a,this.data.fieldName,{value:h(t,!0),items:p(t)})},items:function items(t){for(var items=t.detail.items;0!==o.length;)o.remove(0);var i,l=_createForOfIteratorHelper(items);try{for(l.s();!(i=l.n()).done;){var u=i.value,c=u.displayValue,d=u.exportValue,m=document.createElement("option");m.textContent=c;m.value=d;o.appendChild(m)}}catch(t){l.e(t)}finally{l.f()}o.options.length>0&&(o.options[0].selected=!0);r.setValue(a,this.data.fieldName,{value:h(t,!0),items:p(t)})},indices:function indices(t){var indices=new Set(t.detail.indices),i=t.target.options;Array.prototype.forEach.call(i,(function(t,r){t.selected=indices.has(r)}));r.setValue(a,this.data.fieldName,{value:h(t,!0)})},editable:function editable(t){t.target.disabled=!t.detail.editable}};t._dispatchEventFromSandbox(u,i)}));o.addEventListener("input",(function(i){var o,l=h(i,!0),u=h(i,!1);r.setValue(a,t.data.fieldName,{value:l});null===(o=t.linkService.eventBus)||void 0===o||o.dispatch("dispatcheventinsandbox",{source:t,detail:{id:a,name:"Keystroke",value:u,changeEx:l,willCommit:!0,commitKey:1,keyDown:!1}})}));this._setEventListeners(o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(function(t){return t.target.checked}))}else o.addEventListener("input",(function(i){r.setValue(a,t.data.fieldName,{value:h(i),radioValue:h(i,!0)})}));this.container.appendChild(o);return this.container}}]);return ChoiceWidgetAnnotationElement}(m),w=function(t){_inherits(PopupAnnotationElement,t);var r=_createSuper(PopupAnnotationElement);function PopupAnnotationElement(t){_classCallCheck(this,PopupAnnotationElement);var a=!(!t.data.title&&!t.data.contents);return r.call(this,t,{isRenderable:a})}_createClass(PopupAnnotationElement,[{key:"render",value:function render(){this.container.className="popupAnnotation";if(["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;var t='[data-annotation-id="'.concat(this.data.parentId,'"]'),r=this.layer.querySelectorAll(t);if(0===r.length)return this.container;var a=new C({container:this.container,trigger:Array.from(r),color:this.data.color,title:this.data.title,modificationDate:this.data.modificationDate,contents:this.data.contents}),i=this.page,l=o.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),u=l[0]+this.data.parentRect[2]-this.data.parentRect[0],c=l[1];this.container.style.transformOrigin="".concat(-u,"px ").concat(-c,"px");this.container.style.left="".concat(u,"px");this.container.style.top="".concat(c,"px");this.container.appendChild(a.render());return this.container}}]);return PopupAnnotationElement}(d),C=function(){function PopupElement(t){_classCallCheck(this,PopupElement);this.container=t.container;this.trigger=t.trigger;this.color=t.color;this.title=t.title;this.modificationDate=t.modificationDate;this.contents=t.contents;this.hideWrapper=t.hideWrapper||!1;this.pinned=!1}_createClass(PopupElement,[{key:"render",value:function render(){var t=document.createElement("div");t.className="popupWrapper";this.hideElement=this.hideWrapper?t:this.container;this.hideElement.hidden=!0;var r=document.createElement("div");r.className="popup";var a=this.color;if(a){var l=.7*(255-a[0])+a[0],u=.7*(255-a[1])+a[1],c=.7*(255-a[2])+a[2];r.style.backgroundColor=o.Util.makeHexColor(0|l,0|u,0|c)}var d=document.createElement("h1");d.textContent=this.title;r.appendChild(d);var h=i.PDFDateString.toDateObject(this.modificationDate);if(h){var p=document.createElement("span");p.textContent="{{date}}, {{time}}";p.dataset.l10nId="annotation_date_string";p.dataset.l10nArgs=JSON.stringify({date:h.toLocaleDateString(),time:h.toLocaleTimeString()});r.appendChild(p)}var m=this._formatContents(this.contents);r.appendChild(m);Array.isArray(this.trigger)||(this.trigger=[this.trigger]);var g,v=_createForOfIteratorHelper(this.trigger);try{for(v.s();!(g=v.n()).done;){var y=g.value;y.addEventListener("click",this._toggle.bind(this));y.addEventListener("mouseover",this._show.bind(this,!1));y.addEventListener("mouseout",this._hide.bind(this,!1))}}catch(t){v.e(t)}finally{v.f()}r.addEventListener("click",this._hide.bind(this,!0));t.appendChild(r);return t}},{key:"_formatContents",value:function _formatContents(t){for(var r=document.createElement("p"),a=t.split(/(?:\r\n?|\n)/),i=0,o=a.length;i<o;++i){var l=a[i];r.appendChild(document.createTextNode(l));i<o-1&&r.appendChild(document.createElement("br"))}return r}},{key:"_toggle",value:function _toggle(){this.pinned?this._hide(!0):this._show(!0)}},{key:"_show",value:function _show(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&(this.pinned=!0);if(this.hideElement.hidden){this.hideElement.hidden=!1;this.container.style.zIndex+=1}}},{key:"_hide",value:function _hide(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t&&(this.pinned=!1);if(!this.hideElement.hidden&&!this.pinned){this.hideElement.hidden=!0;this.container.style.zIndex-=1}}}]);return PopupElement}(),P=function(t){_inherits(FreeTextAnnotationElement,t);var r=_createSuper(FreeTextAnnotationElement);function FreeTextAnnotationElement(t){_classCallCheck(this,FreeTextAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0})}_createClass(FreeTextAnnotationElement,[{key:"render",value:function render(){this.container.className="freeTextAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}]);return FreeTextAnnotationElement}(d),k=function(t){_inherits(LineAnnotationElement,t);var r=_createSuper(LineAnnotationElement);function LineAnnotationElement(t){_classCallCheck(this,LineAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0})}_createClass(LineAnnotationElement,[{key:"render",value:function render(){this.container.className="lineAnnotation";var t=this.data,r=t.rect[2]-t.rect[0],a=t.rect[3]-t.rect[1],i=this.svgFactory.create(r,a),o=this.svgFactory.createElement("svg:line");o.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]);o.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]);o.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]);o.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]);o.setAttribute("stroke-width",t.borderStyle.width||1);o.setAttribute("stroke","transparent");i.appendChild(o);this.container.append(i);this._createPopup(o,t);return this.container}}]);return LineAnnotationElement}(d),R=function(t){_inherits(SquareAnnotationElement,t);var r=_createSuper(SquareAnnotationElement);function SquareAnnotationElement(t){_classCallCheck(this,SquareAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0})}_createClass(SquareAnnotationElement,[{key:"render",value:function render(){this.container.className="squareAnnotation";var t=this.data,r=t.rect[2]-t.rect[0],a=t.rect[3]-t.rect[1],i=this.svgFactory.create(r,a),o=t.borderStyle.width,l=this.svgFactory.createElement("svg:rect");l.setAttribute("x",o/2);l.setAttribute("y",o/2);l.setAttribute("width",r-o);l.setAttribute("height",a-o);l.setAttribute("stroke-width",o||1);l.setAttribute("stroke","transparent");l.setAttribute("fill","none");i.appendChild(l);this.container.append(i);this._createPopup(l,t);return this.container}}]);return SquareAnnotationElement}(d),A=function(t){_inherits(CircleAnnotationElement,t);var r=_createSuper(CircleAnnotationElement);function CircleAnnotationElement(t){_classCallCheck(this,CircleAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0})}_createClass(CircleAnnotationElement,[{key:"render",value:function render(){this.container.className="circleAnnotation";var t=this.data,r=t.rect[2]-t.rect[0],a=t.rect[3]-t.rect[1],i=this.svgFactory.create(r,a),o=t.borderStyle.width,l=this.svgFactory.createElement("svg:ellipse");l.setAttribute("cx",r/2);l.setAttribute("cy",a/2);l.setAttribute("rx",r/2-o/2);l.setAttribute("ry",a/2-o/2);l.setAttribute("stroke-width",o||1);l.setAttribute("stroke","transparent");l.setAttribute("fill","none");i.appendChild(l);this.container.append(i);this._createPopup(l,t);return this.container}}]);return CircleAnnotationElement}(d),x=function(t){_inherits(PolylineAnnotationElement,t);var r=_createSuper(PolylineAnnotationElement);function PolylineAnnotationElement(t){var a;_classCallCheck(this,PolylineAnnotationElement);var i=!!(t.data.hasPopup||t.data.title||t.data.contents);(a=r.call(this,t,{isRenderable:i,ignoreBorder:!0})).containerClassName="polylineAnnotation";a.svgElementName="svg:polyline";return a}_createClass(PolylineAnnotationElement,[{key:"render",value:function render(){this.container.className=this.containerClassName;var t,r=this.data,a=r.rect[2]-r.rect[0],i=r.rect[3]-r.rect[1],o=this.svgFactory.create(a,i),l=[],u=_createForOfIteratorHelper(r.vertices);try{for(u.s();!(t=u.n()).done;){var c=t.value,d=c.x-r.rect[0],h=r.rect[3]-c.y;l.push(d+","+h)}}catch(t){u.e(t)}finally{u.f()}l=l.join(" ");var p=this.svgFactory.createElement(this.svgElementName);p.setAttribute("points",l);p.setAttribute("stroke-width",r.borderStyle.width||1);p.setAttribute("stroke","transparent");p.setAttribute("fill","none");o.appendChild(p);this.container.append(o);this._createPopup(p,r);return this.container}}]);return PolylineAnnotationElement}(d),T=function(t){_inherits(PolygonAnnotationElement,t);var r=_createSuper(PolygonAnnotationElement);function PolygonAnnotationElement(t){var a;_classCallCheck(this,PolygonAnnotationElement);(a=r.call(this,t)).containerClassName="polygonAnnotation";a.svgElementName="svg:polygon";return a}return PolygonAnnotationElement}(x),E=function(t){_inherits(CaretAnnotationElement,t);var r=_createSuper(CaretAnnotationElement);function CaretAnnotationElement(t){_classCallCheck(this,CaretAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0})}_createClass(CaretAnnotationElement,[{key:"render",value:function render(){this.container.className="caretAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}]);return CaretAnnotationElement}(d),I=function(t){_inherits(InkAnnotationElement,t);var r=_createSuper(InkAnnotationElement);function InkAnnotationElement(t){var a;_classCallCheck(this,InkAnnotationElement);var i=!!(t.data.hasPopup||t.data.title||t.data.contents);(a=r.call(this,t,{isRenderable:i,ignoreBorder:!0})).containerClassName="inkAnnotation";a.svgElementName="svg:polyline";return a}_createClass(InkAnnotationElement,[{key:"render",value:function render(){this.container.className=this.containerClassName;var t,r=this.data,a=r.rect[2]-r.rect[0],i=r.rect[3]-r.rect[1],o=this.svgFactory.create(a,i),l=_createForOfIteratorHelper(r.inkLists);try{for(l.s();!(t=l.n()).done;){var u,c=t.value,d=[],h=_createForOfIteratorHelper(c);try{for(h.s();!(u=h.n()).done;){var p=u.value,m=p.x-r.rect[0],g=r.rect[3]-p.y;d.push("".concat(m,",").concat(g))}}catch(t){h.e(t)}finally{h.f()}d=d.join(" ");var v=this.svgFactory.createElement(this.svgElementName);v.setAttribute("points",d);v.setAttribute("stroke-width",r.borderStyle.width||1);v.setAttribute("stroke","transparent");v.setAttribute("fill","none");this._createPopup(v,r);o.appendChild(v)}}catch(t){l.e(t)}finally{l.f()}this.container.append(o);return this.container}}]);return InkAnnotationElement}(d),O=function(t){_inherits(HighlightAnnotationElement,t);var r=_createSuper(HighlightAnnotationElement);function HighlightAnnotationElement(t){_classCallCheck(this,HighlightAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(HighlightAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("highlightAnnotation");this.container.className="highlightAnnotation";return this.container}}]);return HighlightAnnotationElement}(d),D=function(t){_inherits(UnderlineAnnotationElement,t);var r=_createSuper(UnderlineAnnotationElement);function UnderlineAnnotationElement(t){_classCallCheck(this,UnderlineAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(UnderlineAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("underlineAnnotation");this.container.className="underlineAnnotation";return this.container}}]);return UnderlineAnnotationElement}(d),L=function(t){_inherits(SquigglyAnnotationElement,t);var r=_createSuper(SquigglyAnnotationElement);function SquigglyAnnotationElement(t){_classCallCheck(this,SquigglyAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(SquigglyAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("squigglyAnnotation");this.container.className="squigglyAnnotation";return this.container}}]);return SquigglyAnnotationElement}(d),M=function(t){_inherits(StrikeOutAnnotationElement,t);var r=_createSuper(StrikeOutAnnotationElement);function StrikeOutAnnotationElement(t){_classCallCheck(this,StrikeOutAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}_createClass(StrikeOutAnnotationElement,[{key:"render",value:function render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("strikeoutAnnotation");this.container.className="strikeoutAnnotation";return this.container}}]);return StrikeOutAnnotationElement}(d),B=function(t){_inherits(StampAnnotationElement,t);var r=_createSuper(StampAnnotationElement);function StampAnnotationElement(t){_classCallCheck(this,StampAnnotationElement);var a=!!(t.data.hasPopup||t.data.title||t.data.contents);return r.call(this,t,{isRenderable:a,ignoreBorder:!0})}_createClass(StampAnnotationElement,[{key:"render",value:function render(){this.container.className="stampAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}]);return StampAnnotationElement}(d),W=function(t){_inherits(FileAttachmentAnnotationElement,t);var r=_createSuper(FileAttachmentAnnotationElement);function FileAttachmentAnnotationElement(t){var a,l;_classCallCheck(this,FileAttachmentAnnotationElement);var u=(l=r.call(this,t,{isRenderable:!0})).data.file,c=u.filename,d=u.content;l.filename=(0,i.getFilenameFromUrl)(c);l.content=d;null===(a=l.linkService.eventBus)||void 0===a||a.dispatch("fileattachmentannotation",{source:_assertThisInitialized(l),id:(0,o.stringToPDFString)(c),filename:c,content:d});return l}_createClass(FileAttachmentAnnotationElement,[{key:"render",value:function render(){this.container.className="fileAttachmentAnnotation";var t=document.createElement("div");t.style.height=this.container.style.height;t.style.width=this.container.style.width;t.addEventListener("dblclick",this._download.bind(this));this.data.hasPopup||!this.data.title&&!this.data.contents||this._createPopup(t,this.data);this.container.appendChild(t);return this.container}},{key:"_download",value:function _download(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.container,this.content,this.filename)}}]);return FileAttachmentAnnotationElement}(d),N=function(){function AnnotationLayer(){_classCallCheck(this,AnnotationLayer)}_createClass(AnnotationLayer,null,[{key:"render",value:function render(t){var r,a=[],u=[],d=_createForOfIteratorHelper(t.annotations);try{for(d.s();!(r=d.n()).done;){var h=r.value;h&&(h.annotationType!==o.AnnotationType.POPUP?a.push(h):u.push(h))}}catch(t){d.e(t)}finally{d.f()}u.length&&a.push.apply(a,u);window.registerAcroformAnnotations&&window.registerAcroformAnnotations(a);for(var p=0,m=a;p<m.length;p++){var g=m[p],v=c.create({data:g,layer:t.div,page:t.page,viewport:t.viewport,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderInteractiveForms:!1!==t.renderInteractiveForms,svgFactory:new i.DOMSVGFactory,annotationStorage:t.annotationStorage||new l.AnnotationStorage,enableScripting:t.enableScripting,hasJSActions:t.hasJSActions,mouseState:t.mouseState||{isDown:!1}});if(v.isRenderable){var y=v.render();g.hidden&&(y.style.visibility="hidden");if(Array.isArray(y)){var b,S=_createForOfIteratorHelper(y);try{for(S.s();!(b=S.n()).done;){var C=b.value;t.div.appendChild(C)}}catch(t){S.e(t)}finally{S.f()}}else v instanceof w?t.div.prepend(y):t.div.appendChild(y)}}}},{key:"update",value:function update(t){var r,a="matrix(".concat(t.viewport.transform.join(","),")"),i=_createForOfIteratorHelper(t.annotations);try{for(i.s();!(r=i.n()).done;){var o=r.value,l=t.div.querySelectorAll('[data-annotation-id="'.concat(o.id,'"]'));if(l){var u,c=_createForOfIteratorHelper(l);try{for(c.s();!(u=c.n()).done;){u.value.style.transform=a}}catch(t){c.e(t)}finally{c.f()}}}}catch(t){i.e(t)}finally{i.f()}t.div.hidden=!1}}]);return AnnotationLayer}();r.AnnotationLayer=N},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ColorConverters=void 0;function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function makeColorComp(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}var a=function(){function ColorConverters(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,ColorConverters)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(ColorConverters,null,[{key:"CMYK_G",value:function CMYK_G(t){var r=_slicedToArray(t,4),a=r[0],i=r[1],o=r[2],l=r[3];return["G",1-Math.min(1,.3*a+.59*o+.11*i+l)]}},{key:"G_CMYK",value:function G_CMYK(t){return["CMYK",0,0,0,1-_slicedToArray(t,1)[0]]}},{key:"G_RGB",value:function G_RGB(t){var r=_slicedToArray(t,1)[0];return["RGB",r,r,r]}},{key:"G_HTML",value:function G_HTML(t){var r=makeColorComp(_slicedToArray(t,1)[0]);return"#".concat(r).concat(r).concat(r)}},{key:"RGB_G",value:function RGB_G(t){var r=_slicedToArray(t,3);return["G",.3*r[0]+.59*r[1]+.11*r[2]]}},{key:"RGB_HTML",value:function RGB_HTML(t){var r=_slicedToArray(t,3),a=r[0],i=r[1],o=r[2],l=makeColorComp(a),u=makeColorComp(i),c=makeColorComp(o);return"#".concat(l).concat(u).concat(c)}},{key:"T_HTML",value:function T_HTML(){return"#00000000"}},{key:"CMYK_RGB",value:function CMYK_RGB(t){var r=_slicedToArray(t,4),a=r[0],i=r[1],o=r[2],l=r[3];return["RGB",1-Math.min(1,a+l),1-Math.min(1,o+l),1-Math.min(1,i+l)]}},{key:"CMYK_HTML",value:function CMYK_HTML(t){return this.RGB_HTML(this.CMYK_RGB(t))}},{key:"RGB_CMYK",value:function RGB_CMYK(t){var r=_slicedToArray(t,3),a=1-r[0],i=1-r[1],o=1-r[2];return["CMYK",a,i,o,Math.min(a,i,o)]}}]);return ColorConverters}();r.ColorConverters=a},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.renderTextLayer=function renderTextLayer(t){var r=new c({textContent:t.textContent,textContentStream:t.textContentStream,container:t.container,viewport:t.viewport,textDivs:t.textDivs,textContentItemsStr:t.textContentItemsStr,enhanceTextSelection:t.enhanceTextSelection});r._render(t.timeout);return r};var i=a(4);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}var o=30,l=new Map,u=/^\s+$/g;function appendText(t,r,a,c){var d=document.createElement("span"),h={angle:0,canvasWidth:0,hasText:""!==r.str,hasEOL:r.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1};t._textDivs.push(d);var p=i.Util.transform(t._viewport.transform,r.transform),m=Math.atan2(p[1],p[0]),g=a[r.fontName];g.vertical&&(m+=Math.PI/2);var v,y,b=Math.hypot(p[2],p[3]),S=b*function getAscent(t,r){var a=l.get(t);if(a)return a;r.save();r.font="".concat(o,"px ").concat(t);var i=r.measureText(""),u=null==i?void 0:i.fontBoundingBoxAscent,c=Math.abs(null==i?void 0:i.fontBoundingBoxDescent);if(u){r.restore();var d=u/(u+c);l.set(t,d);return d}r.strokeStyle="red";r.clearRect(0,0,o,o);r.strokeText("g",0,0);var h=r.getImageData(0,0,o,o).data;c=0;for(var p=h.length-1-3;p>=0;p-=4)if(h[p]>0){c=Math.ceil(p/4/o);break}r.clearRect(0,0,o,o);r.strokeText("A",0,o);u=0;for(var m=0,g=(h=r.getImageData(0,0,o,o).data).length;m<g;m+=4)if(h[m]>0){u=o-Math.floor(m/4/o);break}r.restore();if(u){var v=u/(u+c);l.set(t,v);return v}l.set(t,.8);return.8}(g.fontFamily,c);if(0===m){v=p[4];y=p[5]-S}else{v=p[4]+S*Math.sin(m);y=p[5]-S*Math.cos(m)}d.style.left="".concat(v,"px");d.style.top="".concat(y,"px");d.style.fontSize="".concat(b,"px");d.style.fontFamily=g.fontFamily;d.setAttribute("role","presentation");d.textContent=r.str;d.dir=r.dir;t._fontInspectorEnabled&&(d.dataset.fontName=r.fontName);0!==m&&(h.angle=m*(180/Math.PI));var w=!1;if(r.str.length>1||t._enhanceTextSelection&&u.test(r.str))w=!0;else if(r.transform[0]!==r.transform[3]){var C=Math.abs(r.transform[0]),P=Math.abs(r.transform[3]);C!==P&&Math.max(C,P)/Math.min(C,P)>1.5&&(w=!0)}w&&(g.vertical?h.canvasWidth=r.height*t._viewport.scale:h.canvasWidth=r.width*t._viewport.scale);t._textDivProperties.set(d,h);t._textContentStream&&t._layoutText(d);if(t._enhanceTextSelection&&h.hasText){var k=1,R=0;if(0!==m){k=Math.cos(m);R=Math.sin(m)}var A,x,T=(g.vertical?r.height:r.width)*t._viewport.scale,E=b;if(0!==m){A=[k,R,-R,k,v,y];x=i.Util.getAxialAlignedBoundingBox([0,0,T,E],A)}else x=[v,y,v+T,y+E];t._bounds.push({left:x[0],top:x[1],right:x[2],bottom:x[3],div:d,size:[T,E],m:A})}}function render(t){if(!t._canceled){var r=t._textDivs,a=t._capability,i=r.length;if(i>1e5){t._renderingDone=!0;a.resolve()}else{if(!t._textContentStream)for(var o=0;o<i;o++)t._layoutText(r[o]);t._renderingDone=!0;a.resolve()}}}function findPositiveMin(t,r,a){for(var i=0,o=0;o<a;o++){var l=t[r++];l>0&&(i=i?Math.min(l,i):l)}return i}function expand(t){for(var r=t._bounds,a=t._viewport,o=function expandBounds(t,r,a){var i=a.map((function(t,r){return{x1:t.left,y1:t.top,x2:t.right,y2:t.bottom,index:r,x1New:void 0,x2New:void 0}}));expandBoundsLTR(t,i);var o,l=new Array(a.length),u=_createForOfIteratorHelper(i);try{for(u.s();!(o=u.n()).done;){var c=o.value,d=c.index;l[d]={left:c.x1New,top:0,right:c.x2New,bottom:0}}}catch(t){u.e(t)}finally{u.f()}a.map((function(r,a){var o=l[a],u=i[a];u.x1=r.top;u.y1=t-o.right;u.x2=r.bottom;u.y2=t-o.left;u.index=a;u.x1New=void 0;u.x2New=void 0}));expandBoundsLTR(r,i);var h,p=_createForOfIteratorHelper(i);try{for(p.s();!(h=p.n()).done;){var m=h.value,g=m.index;l[g].top=m.x1New;l[g].bottom=m.x2New}}catch(t){p.e(t)}finally{p.f()}return l}(a.width,a.height,r),l=0;l<o.length;l++){var u=r[l].div,c=t._textDivProperties.get(u);if(0!==c.angle){for(var d=o[l],h=r[l],p=h.m,m=p[0],g=p[1],v=[[0,0],[0,h.size[1]],[h.size[0],0],h.size],y=new Float64Array(64),b=0,S=v.length;b<S;b++){var w=i.Util.applyTransform(v[b],p);y[b+0]=m&&(d.left-w[0])/m;y[b+4]=g&&(d.top-w[1])/g;y[b+8]=m&&(d.right-w[0])/m;y[b+12]=g&&(d.bottom-w[1])/g;y[b+16]=g&&(d.left-w[0])/-g;y[b+20]=m&&(d.top-w[1])/m;y[b+24]=g&&(d.right-w[0])/-g;y[b+28]=m&&(d.bottom-w[1])/m;y[b+32]=m&&(d.left-w[0])/-m;y[b+36]=g&&(d.top-w[1])/-g;y[b+40]=m&&(d.right-w[0])/-m;y[b+44]=g&&(d.bottom-w[1])/-g;y[b+48]=g&&(d.left-w[0])/g;y[b+52]=m&&(d.top-w[1])/-m;y[b+56]=g&&(d.right-w[0])/g;y[b+60]=m&&(d.bottom-w[1])/-m}var C=1+Math.min(Math.abs(m),Math.abs(g));c.paddingLeft=findPositiveMin(y,32,16)/C;c.paddingTop=findPositiveMin(y,48,16)/C;c.paddingRight=findPositiveMin(y,0,16)/C;c.paddingBottom=findPositiveMin(y,16,16)/C;t._textDivProperties.set(u,c)}else{c.paddingLeft=r[l].left-o[l].left;c.paddingTop=r[l].top-o[l].top;c.paddingRight=o[l].right-r[l].right;c.paddingBottom=o[l].bottom-r[l].bottom;t._textDivProperties.set(u,c)}}}function expandBoundsLTR(t,r){r.sort((function(t,r){return t.x1-r.x1||t.index-r.index}));var a,i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}],o=_createForOfIteratorHelper(r);try{for(o.s();!(a=o.n()).done;){for(var l=a.value,u=0;u<i.length&&i[u].end<=l.y1;)u++;for(var c=i.length-1;c>=0&&i[c].start>=l.y2;)c--;var d=void 0,h=void 0,p=void 0,m=void 0,g=-1/0;for(p=u;p<=c;p++){h=(d=i[p]).boundary;var v=void 0;(v=h.x2>l.x1?h.index>l.index?h.x1New:l.x1:void 0===h.x2New?(h.x2+l.x1)/2:h.x2New)>g&&(g=v)}l.x1New=g;for(p=u;p<=c;p++)void 0===(h=(d=i[p]).boundary).x2New?h.x2>l.x1?h.index>l.index&&(h.x2New=h.x2):h.x2New=g:h.x2New>g&&(h.x2New=Math.max(g,h.x2));var y=[],b=null;for(p=u;p<=c;p++){var S=(h=(d=i[p]).boundary).x2>l.x2?h:l;if(b===S)y[y.length-1].end=d.end;else{y.push({start:d.start,end:d.end,boundary:S});b=S}}if(i[u].start<l.y1){y[0].start=l.y1;y.unshift({start:i[u].start,end:l.y1,boundary:i[u].boundary})}if(l.y2<i[c].end){y[y.length-1].end=l.y2;y.push({start:l.y2,end:i[c].end,boundary:i[c].boundary})}for(p=u;p<=c;p++)if(void 0===(h=(d=i[p]).boundary).x2New){var w=!1;for(m=u-1;!w&&m>=0&&i[m].start>=h.y1;m--)w=i[m].boundary===h;for(m=c+1;!w&&m<i.length&&i[m].end<=h.y2;m++)w=i[m].boundary===h;for(m=0;!w&&m<y.length;m++)w=y[m].boundary===h;w||(h.x2New=g)}Array.prototype.splice.apply(i,[u,c-u+1].concat(y))}}catch(t){o.e(t)}finally{o.f()}for(var C=0,P=i;C<P.length;C++){var k=P[C].boundary;void 0===k.x2New&&(k.x2New=Math.max(t,k.x2))}}var c=function(){function TextLayerRenderTask(t){var r,a=this,o=t.textContent,l=t.textContentStream,u=t.container,c=t.viewport,d=t.textDivs,h=t.textContentItemsStr,p=t.enhanceTextSelection;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,TextLayerRenderTask);this._textContent=o;this._textContentStream=l;this._container=u;this._document=u.ownerDocument;this._viewport=c;this._textDivs=d||[];this._textContentItemsStr=h||[];this._enhanceTextSelection=!!p;this._fontInspectorEnabled=!(null===(r=globalThis.FontInspector)||void 0===r||!r.enabled);this._reader=null;this._layoutTextLastFontSize=null;this._layoutTextLastFontFamily=null;this._layoutTextCtx=null;this._textDivProperties=new WeakMap;this._renderingDone=!1;this._canceled=!1;this._capability=(0,i.createPromiseCapability)();this._renderTimer=null;this._bounds=[];this._capability.promise.finally((function(){if(a._layoutTextCtx){a._layoutTextCtx.canvas.width=0;a._layoutTextCtx.canvas.height=0;a._layoutTextCtx=null}})).catch((function(){}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(TextLayerRenderTask,[{key:"promise",get:function get(){return this._capability.promise}},{key:"cancel",value:function cancel(){this._canceled=!0;if(this._reader){this._reader.cancel(new i.AbortException("TextLayer task cancelled."));this._reader=null}if(null!==this._renderTimer){clearTimeout(this._renderTimer);this._renderTimer=null}this._capability.reject(new Error("TextLayer task cancelled."))}},{key:"_processItems",value:function _processItems(t,r){for(var a=0,i=t.length;a<i;a++)if(void 0!==t[a].str){this._textContentItemsStr.push(t[a].str);appendText(this,t[a],r,this._layoutTextCtx)}else if("beginMarkedContentProps"===t[a].type||"beginMarkedContent"===t[a].type){var o=this._container;this._container=document.createElement("span");this._container.classList.add("markedContent");null!==t[a].id&&this._container.setAttribute("id","".concat(t[a].id));o.appendChild(this._container)}else"endMarkedContent"===t[a].type&&(this._container=this._container.parentNode)}},{key:"_layoutText",value:function _layoutText(t){var r=this._textDivProperties.get(t),a="";if(0!==r.canvasWidth&&r.hasText){var i=t.style,o=i.fontSize,l=i.fontFamily;if(o!==this._layoutTextLastFontSize||l!==this._layoutTextLastFontFamily){this._layoutTextCtx.font="".concat(o," ").concat(l);this._layoutTextLastFontSize=o;this._layoutTextLastFontFamily=l}try{var u=this._layoutTextCtx.measureText(t.textContent).width;if(u>0){r.scale=r.canvasWidth/u;a="scaleX(".concat(r.scale,")")}}catch(t){}}0!==r.angle&&(a="rotate(".concat(r.angle,"deg) ").concat(a));if(a.length>0){this._enhanceTextSelection&&(r.originalTransform=a);t.style.transform=a}r.hasText&&this._container.appendChild(t);if(r.hasEOL){var c=document.createElement("br");c.setAttribute("role","presentation");this._container.appendChild(c)}}},{key:"_render",value:function _render(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,a=(0,i.createPromiseCapability)(),l=Object.create(null),u=this._document.createElement("canvas");u.height=u.width=o;u.mozOpaque=!0;this._layoutTextCtx=u.getContext("2d",{alpha:!1});if(this._textContent){var c=this._textContent.items,d=this._textContent.styles;this._processItems(c,d);a.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');var h=function pump(){t._reader.read().then((function(r){var i=r.value;if(r.done)a.resolve();else{Object.assign(l,i.styles);t._processItems(i.items,l);pump()}}),a.reject)};this._reader=this._textContentStream.getReader();h()}a.promise.then((function(){l=null;r?t._renderTimer=setTimeout((function(){render(t);t._renderTimer=null}),r):render(t)}),this._capability.reject)}},{key:"expandTextDivs",value:function expandTextDivs(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._enhanceTextSelection&&this._renderingDone){if(null!==this._bounds){expand(this);this._bounds=null}for(var r=[],a=[],i=0,o=this._textDivs.length;i<o;i++){var l=this._textDivs[i],u=this._textDivProperties.get(l);if(u.hasText)if(t){r.length=0;a.length=0;u.originalTransform&&r.push(u.originalTransform);if(u.paddingTop>0){a.push("".concat(u.paddingTop,"px"));r.push("translateY(".concat(-u.paddingTop,"px)"))}else a.push(0);u.paddingRight>0?a.push("".concat(u.paddingRight/u.scale,"px")):a.push(0);u.paddingBottom>0?a.push("".concat(u.paddingBottom,"px")):a.push(0);if(u.paddingLeft>0){a.push("".concat(u.paddingLeft/u.scale,"px"));r.push("translateX(".concat(-u.paddingLeft/u.scale,"px)"))}else a.push(0);l.style.padding=a.join(" ");r.length&&(l.style.transform=r.join(" "))}else{l.style.padding=null;l.style.transform=u.originalTransform}}}}}]);return TextLayerRenderTask}()},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.SVGGraphics=void 0;var i=a(4),o=a(1);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var l=function SVGGraphics(){_classCallCheck(this,SVGGraphics);(0,i.unreachable)("Not implemented: SVGGraphics")};r.SVGGraphics=l;var u=function pf(t){if(Number.isInteger(t))return t.toString();var r=t.toFixed(10),a=r.length-1;if("0"!==r[a])return r;do{a--}while("0"===r[a]);return r.substring(0,"."===r[a]?a:a+1)},c=function pm(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":"scale(".concat(u(t[0])," ").concat(u(t[3]),")");if(t[0]===t[3]&&t[1]===-t[2]){var r=180*Math.acos(t[0])/Math.PI;return"rotate(".concat(u(r),")")}}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return"translate(".concat(u(t[4])," ").concat(u(t[5]),")");return"matrix(".concat(u(t[0])," ").concat(u(t[1])," ").concat(u(t[2])," ").concat(u(t[3])," ").concat(u(t[4])," ")+"".concat(u(t[5]),")")},d={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},h=["butt","round","square"],p=["miter","round","bevel"],m=function(){for(var t=new Uint8Array([137,80,78,71,13,10,26,10]),r=new Int32Array(256),a=0;a<256;a++){for(var o=a,l=0;l<8;l++)o=1&o?3988292384^o>>1&2147483647:o>>1&2147483647;r[a]=o}function writePngChunk(t,a,i,o){var l=o,u=a.length;i[l]=u>>24&255;i[l+1]=u>>16&255;i[l+2]=u>>8&255;i[l+3]=255&u;i[l+=4]=255&t.charCodeAt(0);i[l+1]=255&t.charCodeAt(1);i[l+2]=255&t.charCodeAt(2);i[l+3]=255&t.charCodeAt(3);l+=4;i.set(a,l);var c=function crc32(t,a,i){for(var o=-1,l=a;l<i;l++){var u=255&(o^t[l]);o=o>>>8^r[u]}return-1^o}(i,o+4,l+=a.length);i[l]=c>>24&255;i[l+1]=c>>16&255;i[l+2]=c>>8&255;i[l+3]=255&c}function deflateSync(t){return function deflateSyncUncompressed(t){var r=t.length,a=65535,i=Math.ceil(r/a),o=new Uint8Array(2+r+5*i+4),l=0;o[l++]=120;o[l++]=156;var u=0;for(;r>a;){o[l++]=0;o[l++]=255;o[l++]=255;o[l++]=0;o[l++]=0;o.set(t.subarray(u,u+a),l);l+=a;u+=a;r-=a}o[l++]=1;o[l++]=255&r;o[l++]=r>>8&255;o[l++]=255&~r;o[l++]=(65535&~r)>>8&255;o.set(t.subarray(u),l);l+=t.length-u;var c=function adler32(t,r,a){for(var i=1,o=0,l=r;l<a;++l)o=(o+(i=(i+(255&t[l]))%65521))%65521;return o<<16|i}(t,0,t.length);o[l++]=c>>24&255;o[l++]=c>>16&255;o[l++]=c>>8&255;o[l++]=255&c;return o}(t)}return function convertImgDataToPng(r,a,o){return function encode(r,a,o,l){var u,c,d,h=r.width,p=r.height,m=r.data;switch(a){case i.ImageKind.GRAYSCALE_1BPP:c=0;u=1;d=h+7>>3;break;case i.ImageKind.RGB_24BPP:c=2;u=8;d=3*h;break;case i.ImageKind.RGBA_32BPP:c=6;u=8;d=4*h;break;default:throw new Error("invalid format")}for(var g=new Uint8Array((1+d)*p),v=0,y=0,b=0;b<p;++b){g[v++]=0;g.set(m.subarray(y,y+d),v);y+=d;v+=d}if(a===i.ImageKind.GRAYSCALE_1BPP&&l){v=0;for(var S=0;S<p;S++){v++;for(var w=0;w<d;w++)g[v++]^=255}}var C=new Uint8Array([h>>24&255,h>>16&255,h>>8&255,255&h,p>>24&255,p>>16&255,p>>8&255,255&p,u,c,0,0,0]),P=deflateSync(g),k=t.length+36+C.length+P.length,R=new Uint8Array(k),A=0;R.set(t,A);writePngChunk("IHDR",C,R,A+=t.length);writePngChunk("IDATA",P,R,A+=12+C.length);A+=12+P.length;writePngChunk("IEND",new Uint8Array(0),R,A);return(0,i.createObjectURL)(R,"image/png",o)}(r,void 0===r.kind?i.ImageKind.GRAYSCALE_1BPP:r.kind,a,o)}}(),g=function(){function SVGExtraState(){_classCallCheck(this,SVGExtraState);this.fontSizeScale=1;this.fontWeight=d.fontWeight;this.fontSize=0;this.textMatrix=i.IDENTITY_MATRIX;this.fontMatrix=i.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=i.TextRenderingMode.FILL;this.textMatrixScale=1;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRise=0;this.fillColor=d.fillColor;this.strokeColor="#000000";this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.lineJoin="";this.lineCap="";this.miterLimit=0;this.dashArray=[];this.dashPhase=0;this.dependencies=[];this.activeClipUrl=null;this.clipGroup=null;this.maskId=""}_createClass(SVGExtraState,[{key:"clone",value:function clone(){return Object.create(this)}},{key:"setCurrentPoint",value:function setCurrentPoint(t,r){this.x=t;this.y=r}}]);return SVGExtraState}(),v=0,y=0,b=0;r.SVGGraphics=l=function(){function SVGGraphics(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];_classCallCheck(this,SVGGraphics);this.svgFactory=new o.DOMSVGFactory;this.current=new g;this.transformMatrix=i.IDENTITY_MATRIX;this.transformStack=[];this.extraStack=[];this.commonObjs=t;this.objs=r;this.pendingClip=null;this.pendingEOFill=!1;this.embedFonts=!1;this.embeddedFonts=Object.create(null);this.cssStyle=null;this.forceDataSchema=!!a;this._operatorIdMapping=[];for(var l in i.OPS)this._operatorIdMapping[i.OPS[l]]=l}_createClass(SVGGraphics,[{key:"save",value:function save(){this.transformStack.push(this.transformMatrix);var t=this.current;this.extraStack.push(t);this.current=t.clone()}},{key:"restore",value:function restore(){this.transformMatrix=this.transformStack.pop();this.current=this.extraStack.pop();this.pendingClip=null;this.tgrp=null}},{key:"group",value:function group(t){this.save();this.executeOpTree(t);this.restore()}},{key:"loadDependencies",value:function loadDependencies(t){for(var r=this,a=t.fnArray,o=t.argsArray,l=0,u=a.length;l<u;l++)if(a[l]===i.OPS.dependency){var c,d=_createForOfIteratorHelper(o[l]);try{var h=function _loop(){var t=c.value,a=t.startsWith("g_")?r.commonObjs:r.objs,i=new Promise((function(r){a.get(t,r)}));r.current.dependencies.push(i)};for(d.s();!(c=d.n()).done;)h()}catch(t){d.e(t)}finally{d.f()}}return Promise.all(this.current.dependencies)}},{key:"transform",value:function transform(t,r,a,o,l,u){var c=[t,r,a,o,l,u];this.transformMatrix=i.Util.transform(this.transformMatrix,c);this.tgrp=null}},{key:"getSVG",value:function getSVG(t,r){var a=this;this.viewport=r;var o=this._initialize(r);return this.loadDependencies(t).then((function(){a.transformMatrix=i.IDENTITY_MATRIX;a.executeOpTree(a.convertOpList(t));return o}))}},{key:"convertOpList",value:function convertOpList(t){for(var r=this._operatorIdMapping,a=t.argsArray,i=t.fnArray,o=[],l=0,u=i.length;l<u;l++){var c=i[l];o.push({fnId:c,fn:r[c],args:a[l]})}return function opListToTree(t){var r,a=[],i=[],o=_createForOfIteratorHelper(t);try{for(o.s();!(r=o.n()).done;){var l=r.value;if("save"!==l.fn)"restore"===l.fn?a=i.pop():a.push(l);else{a.push({fnId:92,fn:"group",items:[]});i.push(a);a=a[a.length-1].items}}}catch(t){o.e(t)}finally{o.f()}return a}(o)}},{key:"executeOpTree",value:function executeOpTree(t){var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var o=r.value,l=o.fn,u=o.fnId,c=o.args;switch(0|u){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(c);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(c[0],c[1]);break;case i.OPS.setFont:this.setFont(c);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(c[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(c[0],c[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(c[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(c[0]);break;case i.OPS.setHScale:this.setHScale(c[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(c[0],c[1],c[2],c[3],c[4],c[5]);break;case i.OPS.setTextRise:this.setTextRise(c[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(c[0]);break;case i.OPS.setLineWidth:this.setLineWidth(c[0]);break;case i.OPS.setLineJoin:this.setLineJoin(c[0]);break;case i.OPS.setLineCap:this.setLineCap(c[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(c[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(c[0],c[1],c[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(c[0],c[1],c[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(c);break;case i.OPS.setFillColorN:this.setFillColorN(c);break;case i.OPS.shadingFill:this.shadingFill(c[0]);break;case i.OPS.setDash:this.setDash(c[0],c[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(c[0]);break;case i.OPS.setFlatness:this.setFlatness(c[0]);break;case i.OPS.setGState:this.setGState(c[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(c[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(c[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(c[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(c[0],c[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(c[0],c[1],c[2],c[3],c[4],c[5]);break;case i.OPS.constructPath:this.constructPath(c[0],c[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(o.items);break;default:(0,i.warn)("Unimplemented operator ".concat(l))}}}catch(t){a.e(t)}finally{a.f()}}},{key:"setWordSpacing",value:function setWordSpacing(t){this.current.wordSpacing=t}},{key:"setCharSpacing",value:function setCharSpacing(t){this.current.charSpacing=t}},{key:"nextLine",value:function nextLine(){this.moveText(0,this.current.leading)}},{key:"setTextMatrix",value:function setTextMatrix(t,r,a,i,o,l){var c=this.current;c.textMatrix=c.lineMatrix=[t,r,a,i,o,l];c.textMatrixScale=Math.hypot(t,r);c.x=c.lineX=0;c.y=c.lineY=0;c.xcoords=[];c.ycoords=[];c.tspan=this.svgFactory.createElement("svg:tspan");c.tspan.setAttributeNS(null,"font-family",c.fontFamily);c.tspan.setAttributeNS(null,"font-size","".concat(u(c.fontSize),"px"));c.tspan.setAttributeNS(null,"y",u(-c.y));c.txtElement=this.svgFactory.createElement("svg:text");c.txtElement.appendChild(c.tspan)}},{key:"beginText",value:function beginText(){var t=this.current;t.x=t.lineX=0;t.y=t.lineY=0;t.textMatrix=i.IDENTITY_MATRIX;t.lineMatrix=i.IDENTITY_MATRIX;t.textMatrixScale=1;t.tspan=this.svgFactory.createElement("svg:tspan");t.txtElement=this.svgFactory.createElement("svg:text");t.txtgrp=this.svgFactory.createElement("svg:g");t.xcoords=[];t.ycoords=[]}},{key:"moveText",value:function moveText(t,r){var a=this.current;a.x=a.lineX+=t;a.y=a.lineY+=r;a.xcoords=[];a.ycoords=[];a.tspan=this.svgFactory.createElement("svg:tspan");a.tspan.setAttributeNS(null,"font-family",a.fontFamily);a.tspan.setAttributeNS(null,"font-size","".concat(u(a.fontSize),"px"));a.tspan.setAttributeNS(null,"y",u(-a.y))}},{key:"showText",value:function showText(t){var r=this.current,a=r.font,o=r.fontSize;if(0!==o){var l,h=r.fontSizeScale,p=r.charSpacing,m=r.wordSpacing,g=r.fontDirection,v=r.textHScale*g,y=a.vertical,b=y?1:-1,S=a.defaultVMetrics,w=o*r.fontMatrix[0],C=0,P=_createForOfIteratorHelper(t);try{for(P.s();!(l=P.n()).done;){var k=l.value;if(null!==k)if((0,i.isNum)(k))C+=b*k*o/1e3;else{var R=(k.isSpace?m:0)+p,A=k.fontChar,x=void 0,T=void 0,E=k.width;if(y){var I=void 0,O=k.vmetric||S;I=-(I=k.vmetric?O[1]:.5*E)*w;var D=O[2]*w;E=O?-O[0]:E;x=I/h;T=(C+D)/h}else{x=C/h;T=0}if(k.isInFont||a.missingFile){r.xcoords.push(r.x+x);y&&r.ycoords.push(-r.y+T);r.tspan.textContent+=A}C+=y?E*w-R*g:E*w+R*g}else C+=g*m}}catch(t){P.e(t)}finally{P.f()}r.tspan.setAttributeNS(null,"x",r.xcoords.map(u).join(" "));y?r.tspan.setAttributeNS(null,"y",r.ycoords.map(u).join(" ")):r.tspan.setAttributeNS(null,"y",u(-r.y));y?r.y-=C:r.x+=C*v;r.tspan.setAttributeNS(null,"font-family",r.fontFamily);r.tspan.setAttributeNS(null,"font-size","".concat(u(r.fontSize),"px"));r.fontStyle!==d.fontStyle&&r.tspan.setAttributeNS(null,"font-style",r.fontStyle);r.fontWeight!==d.fontWeight&&r.tspan.setAttributeNS(null,"font-weight",r.fontWeight);var L=r.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(L===i.TextRenderingMode.FILL||L===i.TextRenderingMode.FILL_STROKE){r.fillColor!==d.fillColor&&r.tspan.setAttributeNS(null,"fill",r.fillColor);r.fillAlpha<1&&r.tspan.setAttributeNS(null,"fill-opacity",r.fillAlpha)}else r.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?r.tspan.setAttributeNS(null,"fill","transparent"):r.tspan.setAttributeNS(null,"fill","none");if(L===i.TextRenderingMode.STROKE||L===i.TextRenderingMode.FILL_STROKE){var M=1/(r.textMatrixScale||1);this._setStrokeAttributes(r.tspan,M)}var B=r.textMatrix;0!==r.textRise&&((B=B.slice())[5]+=r.textRise);r.txtElement.setAttributeNS(null,"transform","".concat(c(B)," scale(").concat(u(v),", -1)"));r.txtElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve");r.txtElement.appendChild(r.tspan);r.txtgrp.appendChild(r.txtElement);this._ensureTransformGroup().appendChild(r.txtElement)}}},{key:"setLeadingMoveText",value:function setLeadingMoveText(t,r){this.setLeading(-r);this.moveText(t,r)}},{key:"addFontStyle",value:function addFontStyle(t){if(!t.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');if(!this.cssStyle){this.cssStyle=this.svgFactory.createElement("svg:style");this.cssStyle.setAttributeNS(null,"type","text/css");this.defs.appendChild(this.cssStyle)}var r=(0,i.createObjectURL)(t.data,t.mimetype,this.forceDataSchema);this.cssStyle.textContent+='@font-face { font-family: "'.concat(t.loadedName,'";')+" src: url(".concat(r,"); }\n")}},{key:"setFont",value:function setFont(t){var r=this.current,a=this.commonObjs.get(t[0]),o=t[1];r.font=a;if(this.embedFonts&&!a.missingFile&&!this.embeddedFonts[a.loadedName]){this.addFontStyle(a);this.embeddedFonts[a.loadedName]=a}r.fontMatrix=a.fontMatrix||i.FONT_IDENTITY_MATRIX;var l="normal";a.black?l="900":a.bold&&(l="bold");var c=a.italic?"italic":"normal";if(o<0){o=-o;r.fontDirection=-1}else r.fontDirection=1;r.fontSize=o;r.fontFamily=a.loadedName;r.fontWeight=l;r.fontStyle=c;r.tspan=this.svgFactory.createElement("svg:tspan");r.tspan.setAttributeNS(null,"y",u(-r.y));r.xcoords=[];r.ycoords=[]}},{key:"endText",value:function endText(){var t,r=this.current;if(r.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&null!==(t=r.txtElement)&&void 0!==t&&t.hasChildNodes()){r.element=r.txtElement;this.clip("nonzero");this.endPath()}}},{key:"setLineWidth",value:function setLineWidth(t){t>0&&(this.current.lineWidth=t)}},{key:"setLineCap",value:function setLineCap(t){this.current.lineCap=h[t]}},{key:"setLineJoin",value:function setLineJoin(t){this.current.lineJoin=p[t]}},{key:"setMiterLimit",value:function setMiterLimit(t){this.current.miterLimit=t}},{key:"setStrokeAlpha",value:function setStrokeAlpha(t){this.current.strokeAlpha=t}},{key:"setStrokeRGBColor",value:function setStrokeRGBColor(t,r,a){this.current.strokeColor=i.Util.makeHexColor(t,r,a)}},{key:"setFillAlpha",value:function setFillAlpha(t){this.current.fillAlpha=t}},{key:"setFillRGBColor",value:function setFillRGBColor(t,r,a){this.current.fillColor=i.Util.makeHexColor(t,r,a);this.current.tspan=this.svgFactory.createElement("svg:tspan");this.current.xcoords=[];this.current.ycoords=[]}},{key:"setStrokeColorN",value:function setStrokeColorN(t){this.current.strokeColor=this._makeColorN_Pattern(t)}},{key:"setFillColorN",value:function setFillColorN(t){this.current.fillColor=this._makeColorN_Pattern(t)}},{key:"shadingFill",value:function shadingFill(t){var r=this.viewport.width,a=this.viewport.height,o=i.Util.inverseTransform(this.transformMatrix),l=i.Util.applyTransform([0,0],o),u=i.Util.applyTransform([0,a],o),c=i.Util.applyTransform([r,0],o),d=i.Util.applyTransform([r,a],o),h=Math.min(l[0],u[0],c[0],d[0]),p=Math.min(l[1],u[1],c[1],d[1]),m=Math.max(l[0],u[0],c[0],d[0]),g=Math.max(l[1],u[1],c[1],d[1]),v=this.svgFactory.createElement("svg:rect");v.setAttributeNS(null,"x",h);v.setAttributeNS(null,"y",p);v.setAttributeNS(null,"width",m-h);v.setAttributeNS(null,"height",g-p);v.setAttributeNS(null,"fill",this._makeShadingPattern(t));this.current.fillAlpha<1&&v.setAttributeNS(null,"fill-opacity",this.current.fillAlpha);this._ensureTransformGroup().appendChild(v)}},{key:"_makeColorN_Pattern",value:function _makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}},{key:"_makeTilingPattern",value:function _makeTilingPattern(t){var r=t[1],a=t[2],o=t[3]||i.IDENTITY_MATRIX,l=_slicedToArray(t[4],4),u=l[0],c=l[1],d=l[2],h=l[3],p=t[5],m=t[6],g=t[7],v="shading".concat(b++),y=_slicedToArray(i.Util.normalizeRect([].concat(_toConsumableArray(i.Util.applyTransform([u,c],o)),_toConsumableArray(i.Util.applyTransform([d,h],o)))),4),S=y[0],w=y[1],C=y[2],P=y[3],k=_slicedToArray(i.Util.singularValueDecompose2dScale(o),2),R=p*k[0],A=m*k[1],x=this.svgFactory.createElement("svg:pattern");x.setAttributeNS(null,"id",v);x.setAttributeNS(null,"patternUnits","userSpaceOnUse");x.setAttributeNS(null,"width",R);x.setAttributeNS(null,"height",A);x.setAttributeNS(null,"x","".concat(S));x.setAttributeNS(null,"y","".concat(w));var T=this.svg,E=this.transformMatrix,I=this.current.fillColor,O=this.current.strokeColor,D=this.svgFactory.create(C-S,P-w);this.svg=D;this.transformMatrix=o;if(2===g){var L=i.Util.makeHexColor.apply(i.Util,_toConsumableArray(r));this.current.fillColor=L;this.current.strokeColor=L}this.executeOpTree(this.convertOpList(a));this.svg=T;this.transformMatrix=E;this.current.fillColor=I;this.current.strokeColor=O;x.appendChild(D.childNodes[0]);this.defs.appendChild(x);return"url(#".concat(v,")")}},{key:"_makeShadingPattern",value:function _makeShadingPattern(t){switch(t[0]){case"RadialAxial":var r,a="shading".concat(b++),o=t[3];switch(t[1]){case"axial":var l=t[4],u=t[5];(r=this.svgFactory.createElement("svg:linearGradient")).setAttributeNS(null,"id",a);r.setAttributeNS(null,"gradientUnits","userSpaceOnUse");r.setAttributeNS(null,"x1",l[0]);r.setAttributeNS(null,"y1",l[1]);r.setAttributeNS(null,"x2",u[0]);r.setAttributeNS(null,"y2",u[1]);break;case"radial":var c=t[4],d=t[5],h=t[6],p=t[7];(r=this.svgFactory.createElement("svg:radialGradient")).setAttributeNS(null,"id",a);r.setAttributeNS(null,"gradientUnits","userSpaceOnUse");r.setAttributeNS(null,"cx",d[0]);r.setAttributeNS(null,"cy",d[1]);r.setAttributeNS(null,"r",p);r.setAttributeNS(null,"fx",c[0]);r.setAttributeNS(null,"fy",c[1]);r.setAttributeNS(null,"fr",h);break;default:throw new Error("Unknown RadialAxial type: ".concat(t[1]))}var m,g=_createForOfIteratorHelper(o);try{for(g.s();!(m=g.n()).done;){var v=m.value,y=this.svgFactory.createElement("svg:stop");y.setAttributeNS(null,"offset",v[0]);y.setAttributeNS(null,"stop-color",v[1]);r.appendChild(y)}}catch(t){g.e(t)}finally{g.f()}this.defs.appendChild(r);return"url(#".concat(a,")");case"Mesh":(0,i.warn)("Unimplemented pattern Mesh");return null;case"Dummy":return"hotpink";default:throw new Error("Unknown IR type: ".concat(t[0]))}}},{key:"setDash",value:function setDash(t,r){this.current.dashArray=t;this.current.dashPhase=r}},{key:"constructPath",value:function constructPath(t,r){var a,o=this.current,l=o.x,c=o.y,d=[],h=0,p=_createForOfIteratorHelper(t);try{for(p.s();!(a=p.n()).done;){switch(0|a.value){case i.OPS.rectangle:l=r[h++];c=r[h++];var m=r[h++],g=r[h++],v=l+m,y=c+g;d.push("M",u(l),u(c),"L",u(v),u(c),"L",u(v),u(y),"L",u(l),u(y),"Z");break;case i.OPS.moveTo:l=r[h++];c=r[h++];d.push("M",u(l),u(c));break;case i.OPS.lineTo:l=r[h++];c=r[h++];d.push("L",u(l),u(c));break;case i.OPS.curveTo:l=r[h+4];c=r[h+5];d.push("C",u(r[h]),u(r[h+1]),u(r[h+2]),u(r[h+3]),u(l),u(c));h+=6;break;case i.OPS.curveTo2:d.push("C",u(l),u(c),u(r[h]),u(r[h+1]),u(r[h+2]),u(r[h+3]));l=r[h+2];c=r[h+3];h+=4;break;case i.OPS.curveTo3:l=r[h+2];c=r[h+3];d.push("C",u(r[h]),u(r[h+1]),u(l),u(c),u(l),u(c));h+=4;break;case i.OPS.closePath:d.push("Z")}}}catch(t){p.e(t)}finally{p.f()}d=d.join(" ");if(o.path&&t.length>0&&t[0]!==i.OPS.rectangle&&t[0]!==i.OPS.moveTo)d=o.path.getAttributeNS(null,"d")+d;else{o.path=this.svgFactory.createElement("svg:path");this._ensureTransformGroup().appendChild(o.path)}o.path.setAttributeNS(null,"d",d);o.path.setAttributeNS(null,"fill","none");o.element=o.path;o.setCurrentPoint(l,c)}},{key:"endPath",value:function endPath(){var t=this.current;t.path=null;if(this.pendingClip)if(t.element){var r="clippath".concat(v++),a=this.svgFactory.createElement("svg:clipPath");a.setAttributeNS(null,"id",r);a.setAttributeNS(null,"transform",c(this.transformMatrix));var i=t.element.cloneNode(!0);"evenodd"===this.pendingClip?i.setAttributeNS(null,"clip-rule","evenodd"):i.setAttributeNS(null,"clip-rule","nonzero");this.pendingClip=null;a.appendChild(i);this.defs.appendChild(a);if(t.activeClipUrl){t.clipGroup=null;var o,l=_createForOfIteratorHelper(this.extraStack);try{for(l.s();!(o=l.n()).done;){o.value.clipGroup=null}}catch(t){l.e(t)}finally{l.f()}a.setAttributeNS(null,"clip-path",t.activeClipUrl)}t.activeClipUrl="url(#".concat(r,")");this.tgrp=null}else this.pendingClip=null}},{key:"clip",value:function clip(t){this.pendingClip=t}},{key:"closePath",value:function closePath(){var t=this.current;if(t.path){var r="".concat(t.path.getAttributeNS(null,"d"),"Z");t.path.setAttributeNS(null,"d",r)}}},{key:"setLeading",value:function setLeading(t){this.current.leading=-t}},{key:"setTextRise",value:function setTextRise(t){this.current.textRise=t}},{key:"setTextRenderingMode",value:function setTextRenderingMode(t){this.current.textRenderingMode=t}},{key:"setHScale",value:function setHScale(t){this.current.textHScale=t/100}},{key:"setRenderingIntent",value:function setRenderingIntent(t){}},{key:"setFlatness",value:function setFlatness(t){}},{key:"setGState",value:function setGState(t){var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var o=_slicedToArray(r.value,2),l=o[0],u=o[1];switch(l){case"LW":this.setLineWidth(u);break;case"LC":this.setLineCap(u);break;case"LJ":this.setLineJoin(u);break;case"ML":this.setMiterLimit(u);break;case"D":this.setDash(u[0],u[1]);break;case"RI":this.setRenderingIntent(u);break;case"FL":this.setFlatness(u);break;case"Font":this.setFont(u);break;case"CA":this.setStrokeAlpha(u);break;case"ca":this.setFillAlpha(u);break;default:(0,i.warn)("Unimplemented graphic state operator ".concat(l))}}}catch(t){a.e(t)}finally{a.f()}}},{key:"fill",value:function fill(){var t=this.current;if(t.element){t.element.setAttributeNS(null,"fill",t.fillColor);t.element.setAttributeNS(null,"fill-opacity",t.fillAlpha);this.endPath()}}},{key:"stroke",value:function stroke(){var t=this.current;if(t.element){this._setStrokeAttributes(t.element);t.element.setAttributeNS(null,"fill","none");this.endPath()}}},{key:"_setStrokeAttributes",value:function _setStrokeAttributes(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=this.current,i=a.dashArray;1!==r&&i.length>0&&(i=i.map((function(t){return r*t})));t.setAttributeNS(null,"stroke",a.strokeColor);t.setAttributeNS(null,"stroke-opacity",a.strokeAlpha);t.setAttributeNS(null,"stroke-miterlimit",u(a.miterLimit));t.setAttributeNS(null,"stroke-linecap",a.lineCap);t.setAttributeNS(null,"stroke-linejoin",a.lineJoin);t.setAttributeNS(null,"stroke-width",u(r*a.lineWidth)+"px");t.setAttributeNS(null,"stroke-dasharray",i.map(u).join(" "));t.setAttributeNS(null,"stroke-dashoffset",u(r*a.dashPhase)+"px")}},{key:"eoFill",value:function eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd");this.fill()}},{key:"fillStroke",value:function fillStroke(){this.stroke();this.fill()}},{key:"eoFillStroke",value:function eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd");this.fillStroke()}},{key:"closeStroke",value:function closeStroke(){this.closePath();this.stroke()}},{key:"closeFillStroke",value:function closeFillStroke(){this.closePath();this.fillStroke()}},{key:"closeEOFillStroke",value:function closeEOFillStroke(){this.closePath();this.eoFillStroke()}},{key:"paintSolidColorImageMask",value:function paintSolidColorImageMask(){var t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0");t.setAttributeNS(null,"y","0");t.setAttributeNS(null,"width","1px");t.setAttributeNS(null,"height","1px");t.setAttributeNS(null,"fill",this.current.fillColor);this._ensureTransformGroup().appendChild(t)}},{key:"paintImageXObject",value:function paintImageXObject(t){var r=t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t);r?this.paintInlineImageXObject(r):(0,i.warn)("Dependent image with object ID ".concat(t," is not ready yet"))}},{key:"paintInlineImageXObject",value:function paintInlineImageXObject(t,r){var a=t.width,i=t.height,o=m(t,this.forceDataSchema,!!r),l=this.svgFactory.createElement("svg:rect");l.setAttributeNS(null,"x","0");l.setAttributeNS(null,"y","0");l.setAttributeNS(null,"width",u(a));l.setAttributeNS(null,"height",u(i));this.current.element=l;this.clip("nonzero");var c=this.svgFactory.createElement("svg:image");c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);c.setAttributeNS(null,"x","0");c.setAttributeNS(null,"y",u(-i));c.setAttributeNS(null,"width",u(a)+"px");c.setAttributeNS(null,"height",u(i)+"px");c.setAttributeNS(null,"transform","scale(".concat(u(1/a)," ").concat(u(-1/i),")"));r?r.appendChild(c):this._ensureTransformGroup().appendChild(c)}},{key:"paintImageMaskXObject",value:function paintImageMaskXObject(t){var r=this.current,a=t.width,i=t.height,o=r.fillColor;r.maskId="mask".concat(y++);var l=this.svgFactory.createElement("svg:mask");l.setAttributeNS(null,"id",r.maskId);var c=this.svgFactory.createElement("svg:rect");c.setAttributeNS(null,"x","0");c.setAttributeNS(null,"y","0");c.setAttributeNS(null,"width",u(a));c.setAttributeNS(null,"height",u(i));c.setAttributeNS(null,"fill",o);c.setAttributeNS(null,"mask","url(#".concat(r.maskId,")"));this.defs.appendChild(l);this._ensureTransformGroup().appendChild(c);this.paintInlineImageXObject(t,l)}},{key:"paintFormXObjectBegin",value:function paintFormXObjectBegin(t,r){Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]);if(r){var a=r[2]-r[0],i=r[3]-r[1],o=this.svgFactory.createElement("svg:rect");o.setAttributeNS(null,"x",r[0]);o.setAttributeNS(null,"y",r[1]);o.setAttributeNS(null,"width",u(a));o.setAttributeNS(null,"height",u(i));this.current.element=o;this.clip("nonzero");this.endPath()}}},{key:"paintFormXObjectEnd",value:function paintFormXObjectEnd(){}},{key:"_initialize",value:function _initialize(t){var r=this.svgFactory.create(t.width,t.height),a=this.svgFactory.createElement("svg:defs");r.appendChild(a);this.defs=a;var i=this.svgFactory.createElement("svg:g");i.setAttributeNS(null,"transform",c(t.transform));r.appendChild(i);this.svg=i;return r}},{key:"_ensureClipGroup",value:function _ensureClipGroup(){if(!this.current.clipGroup){var t=this.svgFactory.createElement("svg:g");t.setAttributeNS(null,"clip-path",this.current.activeClipUrl);this.svg.appendChild(t);this.current.clipGroup=t}return this.current.clipGroup}},{key:"_ensureTransformGroup",value:function _ensureTransformGroup(){if(!this.tgrp){this.tgrp=this.svgFactory.createElement("svg:g");this.tgrp.setAttributeNS(null,"transform",c(this.transformMatrix));this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)}return this.tgrp}}]);return SVGGraphics}()},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.XfaLayer=void 0;function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var a=function(){function XfaLayer(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,XfaLayer)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(XfaLayer,null,[{key:"setupStorage",value:function setupStorage(t,r,a,i,o){var l=i.getValue(r,{value:null});switch(a.name){case"textarea":null!==l.value&&(t.textContent=l.value);if("print"===o)break;t.addEventListener("input",(function(t){i.setValue(r,{value:t.target.value})}));break;case"input":if("radio"===a.attributes.type||"checkbox"===a.attributes.type){l.value===a.attributes.xfaOn&&t.setAttribute("checked",!0);if("print"===o)break;t.addEventListener("change",(function(t){i.setValue(r,{value:t.target.getAttribute("xfaOn")})}))}else{null!==l.value&&t.setAttribute("value",l.value);if("print"===o)break;t.addEventListener("input",(function(t){i.setValue(r,{value:t.target.value})}))}break;case"select":if(null!==l.value){var u,c=_createForOfIteratorHelper(a.children);try{for(c.s();!(u=c.n()).done;){var d=u.value;d.attributes.value===l.value&&(d.attributes.selected=!0)}}catch(t){c.e(t)}finally{c.f()}}t.addEventListener("input",(function(t){var a=t.target.options,o=-1===a.selectedIndex?"":a[a.selectedIndex].value;i.setValue(r,{value:o})}))}}},{key:"setAttributes",value:function setAttributes(t,r,a,i){var o=r.attributes;"radio"===o.type&&(o.name="".concat(o.name,"-").concat(i));for(var l=0,u=Object.entries(o);l<u.length;l++){var c=_slicedToArray(u[l],2),d=c[0],h=c[1];null!=h&&"dataId"!==d&&("style"!==d?"textContent"===d?t.textContent=h:"class"===d?t.setAttribute(d,h.join(" ")):t.setAttribute(d,h):Object.assign(t.style,h))}a&&o.dataId&&this.setupStorage(t,o.dataId,r,a)}},{key:"render",value:function render(t){var r=t.annotationStorage,a=t.xfa,i=t.intent||"display",o=document.createElement(a.name);a.attributes&&this.setAttributes(o,a);var l=[[a,-1,o]],u=t.div;u.appendChild(o);var c="matrix(".concat(t.viewport.transform.join(","),")");u.style.transform=c;u.setAttribute("class","xfaLayer xfaFont");for(;l.length>0;){var d,h=_slicedToArray(l[l.length-1],3),p=h[0],m=h[1],g=h[2];if(m+1!==p.children.length){var v=p.children[++l[l.length-1][1]];if(null!==v){var y=v.name;if("#text"!==y){var b=void 0;b=null!=v&&null!==(d=v.attributes)&&void 0!==d&&d.xmlns?document.createElementNS(v.attributes.xmlns,y):document.createElement(y);g.appendChild(b);v.attributes&&this.setAttributes(b,v,r,i);v.children&&v.children.length>0?l.push([v,-1,b]):v.value&&b.appendChild(document.createTextNode(v.value))}else g.appendChild(document.createTextNode(v.value))}}else l.pop()}var S,w=_createForOfIteratorHelper(u.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"));try{for(w.s();!(S=w.n()).done;){S.value.setAttribute("readOnly",!0)}}catch(t){w.e(t)}finally{w.f()}}},{key:"update",value:function update(t){var r="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=r;t.div.hidden=!1}}]);return XfaLayer}();r.XfaLayer=a},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFNodeStream=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4),l=a(136);function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var u=require("fs"),c=require("http"),d=require("https"),h=require("url"),p=/^file:\/\/\/[a-zA-Z]:\//;var m=function(){function PDFNodeStream(t){_classCallCheck(this,PDFNodeStream);this.source=t;this.url=function parseUrl(t){var r=h.parse(t);if("file:"===r.protocol||r.host)return r;if(/^[a-z]:[/\\]/i.test(t))return h.parse("file:///".concat(t));r.host||(r.protocol="file:");return r}(t.url);this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol||"capacitor:"===this.url.protocol;this.isFsUrl="file:"===this.url.protocol;this.httpHeaders=this.isHttp&&t.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}_createClass(PDFNodeStream,[{key:"_progressiveDataLength",get:function get(){var t,r;return null!==(t=null===(r=this._fullRequestReader)||void 0===r?void 0:r._loaded)&&void 0!==t?t:0}},{key:"getFullReader",value:function getFullReader(){(0,o.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once.");this._fullRequestReader=this.isFsUrl?new S(this):new y(this);return this._fullRequestReader}},{key:"getRangeReader",value:function getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;var a=this.isFsUrl?new w(this,t,r):new b(this,t,r);this._rangeRequestReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}}}]);return PDFNodeStream}();r.PDFNodeStream=m;var g=function(){function BaseFullReader(t){_classCallCheck(this,BaseFullReader);this._url=t.url;this._done=!1;this._storedError=null;this.onProgress=null;var r=t.source;this._contentLength=r.length;this._loaded=0;this._filename=null;this._disableRange=r.disableRange||!1;this._rangeChunkSize=r.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!r.disableStream;this._isRangeSupported=!r.disableRange;this._readableStream=null;this._readCapability=(0,o.createPromiseCapability)();this._headersCapability=(0,o.createPromiseCapability)()}_createClass(BaseFullReader,[{key:"headersReady",get:function get(){return this._headersCapability.promise}},{key:"filename",get:function get(){return this._filename}},{key:"contentLength",get:function get(){return this._contentLength}},{key:"isRangeSupported",get:function get(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee(){var t,r;return i.default.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._readCapability.promise;case 2:if(!this._done){a.next=4;break}return a.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){a.next=6;break}throw this._storedError;case 6:if(null!==(t=this._readableStream.read())){a.next=10;break}this._readCapability=(0,o.createPromiseCapability)();return a.abrupt("return",this.read());case 10:this._loaded+=t.length;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});r=new Uint8Array(t).buffer;return a.abrupt("return",{value:r,done:!1});case 14:case"end":return a.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}},{key:"_error",value:function _error(t){this._storedError=t;this._readCapability.resolve()}},{key:"_setReadableStream",value:function _setReadableStream(t){var r=this;this._readableStream=t;t.on("readable",(function(){r._readCapability.resolve()}));t.on("end",(function(){t.destroy();r._done=!0;r._readCapability.resolve()}));t.on("error",(function(t){r._error(t)}));!this._isStreamingSupported&&this._isRangeSupported&&this._error(new o.AbortException("streaming is disabled"));this._storedError&&this._readableStream.destroy(this._storedError)}}]);var t;return BaseFullReader}(),v=function(){function BaseRangeReader(t){_classCallCheck(this,BaseRangeReader);this._url=t.url;this._done=!1;this._storedError=null;this.onProgress=null;this._loaded=0;this._readableStream=null;this._readCapability=(0,o.createPromiseCapability)();var r=t.source;this._isStreamingSupported=!r.disableStream}_createClass(BaseRangeReader,[{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee2(){var t,r;return i.default.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._readCapability.promise;case 2:if(!this._done){a.next=4;break}return a.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){a.next=6;break}throw this._storedError;case 6:if(null!==(t=this._readableStream.read())){a.next=10;break}this._readCapability=(0,o.createPromiseCapability)();return a.abrupt("return",this.read());case 10:this._loaded+=t.length;this.onProgress&&this.onProgress({loaded:this._loaded});r=new Uint8Array(t).buffer;return a.abrupt("return",{value:r,done:!1});case 14:case"end":return a.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}},{key:"_error",value:function _error(t){this._storedError=t;this._readCapability.resolve()}},{key:"_setReadableStream",value:function _setReadableStream(t){var r=this;this._readableStream=t;t.on("readable",(function(){r._readCapability.resolve()}));t.on("end",(function(){t.destroy();r._done=!0;r._readCapability.resolve()}));t.on("error",(function(t){r._error(t)}));this._storedError&&this._readableStream.destroy(this._storedError)}}]);var t;return BaseRangeReader}();function createRequestOptions(t,r){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:r}}var y=function(t){_inherits(PDFNodeStreamFullReader,t);var r=_createSuper(PDFNodeStreamFullReader);function PDFNodeStreamFullReader(t){var a;_classCallCheck(this,PDFNodeStreamFullReader);var i=function handleResponse(r){if(404!==r.statusCode){a._headersCapability.resolve();a._setReadableStream(r);var i=function getResponseHeader(t){return a._readableStream.headers[t.toLowerCase()]},u=(0,l.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:a._rangeChunkSize,disableRange:a._disableRange}),c=u.allowRangeRequests,d=u.suggestedLength;a._isRangeSupported=c;a._contentLength=d||a._contentLength;a._filename=(0,l.extractFilenameFromHeader)(i)}else{var h=new o.MissingPDFException('Missing PDF "'.concat(a._url,'".'));a._storedError=h;a._headersCapability.reject(h)}};(a=r.call(this,t))._request=null;"http:"===a._url.protocol?a._request=c.request(createRequestOptions(a._url,t.httpHeaders),i):a._request=d.request(createRequestOptions(a._url,t.httpHeaders),i);a._request.on("error",(function(t){a._storedError=t;a._headersCapability.reject(t)}));a._request.end();return a}return PDFNodeStreamFullReader}(g),b=function(t){_inherits(PDFNodeStreamRangeReader,t);var r=_createSuper(PDFNodeStreamRangeReader);function PDFNodeStreamRangeReader(t,a,i){var l;_classCallCheck(this,PDFNodeStreamRangeReader);(l=r.call(this,t))._httpHeaders={};for(var u in t.httpHeaders){var h=t.httpHeaders[u];void 0!==h&&(l._httpHeaders[u]=h)}l._httpHeaders.Range="bytes=".concat(a,"-").concat(i-1);var p=function handleResponse(t){if(404!==t.statusCode)l._setReadableStream(t);else{var r=new o.MissingPDFException('Missing PDF "'.concat(l._url,'".'));l._storedError=r}};l._request=null;"http:"===l._url.protocol?l._request=c.request(createRequestOptions(l._url,l._httpHeaders),p):l._request=d.request(createRequestOptions(l._url,l._httpHeaders),p);l._request.on("error",(function(t){l._storedError=t}));l._request.end();return l}return PDFNodeStreamRangeReader}(v),S=function(t){_inherits(PDFNodeStreamFsFullReader,t);var r=_createSuper(PDFNodeStreamFsFullReader);function PDFNodeStreamFsFullReader(t){var a;_classCallCheck(this,PDFNodeStreamFsFullReader);a=r.call(this,t);var i=decodeURIComponent(a._url.path);p.test(a._url.href)&&(i=i.replace(/^\//,""));u.lstat(i,(function(t,r){if(t){"ENOENT"===t.code&&(t=new o.MissingPDFException('Missing PDF "'.concat(i,'".')));a._storedError=t;a._headersCapability.reject(t)}else{a._contentLength=r.size;a._setReadableStream(u.createReadStream(i));a._headersCapability.resolve()}}));return a}return PDFNodeStreamFsFullReader}(g),w=function(t){_inherits(PDFNodeStreamFsRangeReader,t);var r=_createSuper(PDFNodeStreamFsRangeReader);function PDFNodeStreamFsRangeReader(t,a,i){var o;_classCallCheck(this,PDFNodeStreamFsRangeReader);o=r.call(this,t);var l=decodeURIComponent(o._url.path);p.test(o._url.href)&&(l=l.replace(/^\//,""));o._setReadableStream(u.createReadStream(l,{start:a,end:i-1}));return o}return PDFNodeStreamFsRangeReader}(v)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.createResponseStatusError=function createResponseStatusError(t,r){if(404===t||0===t&&r.startsWith("file:"))return new i.MissingPDFException('Missing PDF "'+r+'".');return new i.UnexpectedResponseException("Unexpected server response (".concat(t,') while retrieving PDF "').concat(r,'".'),t)};r.extractFilenameFromHeader=function extractFilenameFromHeader(t){var r=t("Content-Disposition");if(r){var a=(0,o.getFilenameFromContentDispositionHeader)(r);if(a.includes("%"))try{a=decodeURIComponent(a)}catch(t){}if((0,l.isPdfFile)(a))return a}return null};r.validateRangeRequestCapabilities=function validateRangeRequestCapabilities(t){var r=t.getResponseHeader,a=t.isHttp,o=t.rangeChunkSize,l=t.disableRange;(0,i.assert)(o>0,"Range chunk size must be larger than zero");var u={allowRangeRequests:!1,suggestedLength:void 0},c=parseInt(r("Content-Length"),10);if(!Number.isInteger(c))return u;u.suggestedLength=c;if(c<=2*o)return u;if(l||!a)return u;if("bytes"!==r("Accept-Ranges"))return u;if("identity"!==(r("Content-Encoding")||"identity"))return u;u.allowRangeRequests=!0;return u};r.validateResponseStatus=function validateResponseStatus(t){return 200===t||206===t};var i=a(4),o=a(137),l=a(1)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.getFilenameFromContentDispositionHeader=function getFilenameFromContentDispositionHeader(t){var r=!0,a=toParamRegExp("filename\\*","i").exec(t);if(a){var o=rfc2616unquote(a=a[1]);return fixupEncoding(o=rfc2047decode(o=rfc5987decode(o=unescape(o))))}if(a=function rfc2231getparam(t){var r,a=[],i=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(r=i.exec(t));){var o=_slicedToArray(r,4),l=o[1],u=o[2],c=o[3];if((l=parseInt(l,10))in a){if(0===l)break}else a[l]=[u,c]}for(var d=[],h=0;h<a.length&&h in a;++h){var p=_slicedToArray(a[h],2),m=p[0],g=p[1];g=rfc2616unquote(g);if(m){g=unescape(g);0===h&&(g=rfc5987decode(g))}d.push(g)}return d.join("")}(t)){return fixupEncoding(rfc2047decode(a))}if(a=toParamRegExp("filename","i").exec(t)){var l=rfc2616unquote(a=a[1]);return fixupEncoding(l=rfc2047decode(l))}function toParamRegExp(t,r){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',r)}function textdecode(t,a){if(t){if(!/^[\x00-\xFF]+$/.test(a))return a;try{var o=new TextDecoder(t,{fatal:!0}),l=(0,i.stringToBytes)(a);a=o.decode(l);r=!1}catch(i){if(/^utf-?8$/i.test(t))try{a=decodeURIComponent(escape(a));r=!1}catch(t){}}}return a}function fixupEncoding(t){if(r&&/[\x80-\xff]/.test(t)){t=textdecode("utf-8",t);r&&(t=textdecode("iso-8859-1",t))}return t}function rfc2616unquote(t){if(t.startsWith('"')){for(var r=t.slice(1).split('\\"'),a=0;a<r.length;++a){var i=r[a].indexOf('"');if(-1!==i){r[a]=r[a].slice(0,i);r.length=a+1}r[a]=r[a].replace(/\\(.)/g,"$1")}t=r.join('"')}return t}function rfc5987decode(t){var r=t.indexOf("'");return-1===r?t:textdecode(t.slice(0,r),t.slice(r+1).replace(/^[^']*'/,""))}function rfc2047decode(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,r,a,i){if("q"===a||"Q"===a)return textdecode(r,i=(i=i.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(t,r){return String.fromCharCode(parseInt(r,16))})));try{i=atob(i)}catch(t){}return textdecode(r,i)}))}return""};var i=a(4);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFNetworkStream=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4),l=a(136);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var u=function(){function NetworkManager(t,r){_classCallCheck(this,NetworkManager);this.url=t;r=r||{};this.isHttp=/^https?:/i.test(t);this.httpHeaders=this.isHttp&&r.httpHeaders||{};this.withCredentials=r.withCredentials||!1;this.getXhr=r.getXhr||function NetworkManager_getXhr(){return new XMLHttpRequest};this.currXhrId=0;this.pendingRequests=Object.create(null)}_createClass(NetworkManager,[{key:"requestRange",value:function requestRange(t,r,a){var i={begin:t,end:r};for(var o in a)i[o]=a[o];return this.request(i)}},{key:"requestFull",value:function requestFull(t){return this.request(t)}},{key:"request",value:function request(t){var r=this.getXhr(),a=this.currXhrId++,i=this.pendingRequests[a]={xhr:r};r.open("GET",this.url);r.withCredentials=this.withCredentials;for(var o in this.httpHeaders){var l=this.httpHeaders[o];void 0!==l&&r.setRequestHeader(o,l)}if(this.isHttp&&"begin"in t&&"end"in t){r.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1));i.expectedStatus=206}else i.expectedStatus=200;r.responseType="arraybuffer";t.onError&&(r.onerror=function(a){t.onError(r.status)});r.onreadystatechange=this.onStateChange.bind(this,a);r.onprogress=this.onProgress.bind(this,a);i.onHeadersReceived=t.onHeadersReceived;i.onDone=t.onDone;i.onError=t.onError;i.onProgress=t.onProgress;r.send(null);return a}},{key:"onProgress",value:function onProgress(t,r){var a=this.pendingRequests[t];a&&a.onProgress&&a.onProgress(r)}},{key:"onStateChange",value:function onStateChange(t,r){var a=this.pendingRequests[t];if(a){var i=a.xhr;if(i.readyState>=2&&a.onHeadersReceived){a.onHeadersReceived();delete a.onHeadersReceived}if(4===i.readyState&&t in this.pendingRequests){delete this.pendingRequests[t];if(0===i.status&&this.isHttp)a.onError&&a.onError(i.status);else{var l=i.status||200;if(200===l&&206===a.expectedStatus||l===a.expectedStatus){var u=function getArrayBuffer(t){var r=t.response;return"string"!=typeof r?r:(0,o.stringToBytes)(r).buffer}(i);if(206===l){var c=i.getResponseHeader("Content-Range"),d=/bytes (\d+)-(\d+)\/(\d+)/.exec(c);a.onDone({begin:parseInt(d[1],10),chunk:u})}else u?a.onDone({begin:0,chunk:u}):a.onError&&a.onError(i.status)}else a.onError&&a.onError(i.status)}}}}},{key:"getRequestXhr",value:function getRequestXhr(t){return this.pendingRequests[t].xhr}},{key:"isPendingRequest",value:function isPendingRequest(t){return t in this.pendingRequests}},{key:"abortRequest",value:function abortRequest(t){var r=this.pendingRequests[t].xhr;delete this.pendingRequests[t];r.abort()}}]);return NetworkManager}(),c=function(){function PDFNetworkStream(t){_classCallCheck(this,PDFNetworkStream);this._source=t;this._manager=new u(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials});this._rangeChunkSize=t.rangeChunkSize;this._fullRequestReader=null;this._rangeRequestReaders=[]}_createClass(PDFNetworkStream,[{key:"_onRangeRequestReaderClosed",value:function _onRangeRequestReaderClosed(t){var r=this._rangeRequestReaders.indexOf(t);r>=0&&this._rangeRequestReaders.splice(r,1)}},{key:"getFullReader",value:function getFullReader(){(0,o.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once.");this._fullRequestReader=new d(this._manager,this._source);return this._fullRequestReader}},{key:"getRangeReader",value:function getRangeReader(t,r){var a=new h(this._manager,t,r);a.onClosed=this._onRangeRequestReaderClosed.bind(this);this._rangeRequestReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}}}]);return PDFNetworkStream}();r.PDFNetworkStream=c;var d=function(){function PDFNetworkStreamFullRequestReader(t,r){_classCallCheck(this,PDFNetworkStreamFullRequestReader);this._manager=t;var a={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url;this._fullRequestId=t.requestFull(a);this._headersReceivedCapability=(0,o.createPromiseCapability)();this._disableRange=r.disableRange||!1;this._contentLength=r.length;this._rangeChunkSize=r.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!1;this._isRangeSupported=!1;this._cachedChunks=[];this._requests=[];this._done=!1;this._storedError=void 0;this._filename=null;this.onProgress=null}_createClass(PDFNetworkStreamFullRequestReader,[{key:"_onHeadersReceived",value:function _onHeadersReceived(){var t=this._fullRequestId,r=this._manager.getRequestXhr(t),a=function getResponseHeader(t){return r.getResponseHeader(t)},i=(0,l.validateRangeRequestCapabilities)({getResponseHeader:a,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),o=i.allowRangeRequests,u=i.suggestedLength;o&&(this._isRangeSupported=!0);this._contentLength=u||this._contentLength;this._filename=(0,l.extractFilenameFromHeader)(a);this._isRangeSupported&&this._manager.abortRequest(t);this._headersReceivedCapability.resolve()}},{key:"_onDone",value:function _onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);this._done=!0;if(!(this._cachedChunks.length>0)){var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0}}},{key:"_onError",value:function _onError(t){var r=this._url,a=(0,l.createResponseStatusError)(t,r);this._storedError=a;this._headersReceivedCapability.reject(a);var i,o=_createForOfIteratorHelper(this._requests);try{for(o.s();!(i=o.n()).done;){i.value.reject(a)}}catch(t){o.e(t)}finally{o.f()}this._requests.length=0;this._cachedChunks.length=0}},{key:"_onProgress",value:function _onProgress(t){this.onProgress&&this.onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}},{key:"filename",get:function get(){return this._filename}},{key:"isRangeSupported",get:function get(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"contentLength",get:function get(){return this._contentLength}},{key:"headersReady",get:function get(){return this._headersReceivedCapability.promise}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee(){var t,r;return i.default.wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:if(!this._storedError){a.next=2;break}throw this._storedError;case 2:if(!(this._cachedChunks.length>0)){a.next=5;break}t=this._cachedChunks.shift();return a.abrupt("return",{value:t,done:!1});case 5:if(!this._done){a.next=7;break}return a.abrupt("return",{value:void 0,done:!0});case 7:r=(0,o.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 10:case"end":return a.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;this._headersReceivedCapability.reject(t);var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId);this._fullRequestReader=null}}]);var t;return PDFNetworkStreamFullRequestReader}(),h=function(){function PDFNetworkStreamRangeRequestReader(t,r,a){_classCallCheck(this,PDFNetworkStreamRangeRequestReader);this._manager=t;var i={onDone:this._onDone.bind(this),onProgress:this._onProgress.bind(this)};this._requestId=t.requestRange(r,a,i);this._requests=[];this._queuedChunk=null;this._done=!1;this.onProgress=null;this.onClosed=null}_createClass(PDFNetworkStreamRangeRequestReader,[{key:"_close",value:function _close(){this.onClosed&&this.onClosed(this)}},{key:"_onDone",value:function _onDone(t){var r=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:r,done:!1})}else this._queuedChunk=r;this._done=!0;var a,i=_createForOfIteratorHelper(this._requests);try{for(i.s();!(a=i.n()).done;){a.value.resolve({value:void 0,done:!0})}}catch(t){i.e(t)}finally{i.f()}this._requests.length=0;this._close()}},{key:"_onProgress",value:function _onProgress(t){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:t.loaded})}},{key:"isStreamingSupported",get:function get(){return!1}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee2(){var t,r;return i.default.wrap((function _callee2$(a){for(;;)switch(a.prev=a.next){case 0:if(null===this._queuedChunk){a.next=4;break}t=this._queuedChunk;this._queuedChunk=null;return a.abrupt("return",{value:t,done:!1});case 4:if(!this._done){a.next=6;break}return a.abrupt("return",{value:void 0,done:!0});case 6:r=(0,o.createPromiseCapability)();this._requests.push(r);return a.abrupt("return",r.promise);case 9:case"end":return a.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._done=!0;var r,a=_createForOfIteratorHelper(this._requests);try{for(a.s();!(r=a.n()).done;){r.value.resolve({value:void 0,done:!0})}}catch(t){a.e(t)}finally{a.f()}this._requests.length=0;this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId);this._close()}}]);var t;return PDFNetworkStreamRangeRequestReader}()},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFFetchStream=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(2)),o=a(4),l=a(136);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function createFetchOptions(t,r,a){return{method:"GET",headers:t,signal:null==a?void 0:a.signal,mode:"cors",credentials:r?"include":"same-origin",redirect:"follow"}}function createHeaders(t){var r=new Headers;for(var a in t){var i=t[a];void 0!==i&&r.append(a,i)}return r}var u=function(){function PDFFetchStream(t){_classCallCheck(this,PDFFetchStream);this.source=t;this.isHttp=/^https?:/i.test(t.url);this.httpHeaders=this.isHttp&&t.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}_createClass(PDFFetchStream,[{key:"_progressiveDataLength",get:function get(){var t,r;return null!==(t=null===(r=this._fullRequestReader)||void 0===r?void 0:r._loaded)&&void 0!==t?t:0}},{key:"getFullReader",value:function getFullReader(){(0,o.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once.");this._fullRequestReader=new c(this);return this._fullRequestReader}},{key:"getRangeReader",value:function getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;var a=new d(this,t,r);this._rangeRequestReaders.push(a);return a}},{key:"cancelAllRequests",value:function cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);var r,a=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(a.s();!(r=a.n()).done;){r.value.cancel(t)}}catch(t){a.e(t)}finally{a.f()}}}]);return PDFFetchStream}();r.PDFFetchStream=u;var c=function(){function PDFFetchStreamReader(t){var r=this;_classCallCheck(this,PDFFetchStreamReader);this._stream=t;this._reader=null;this._loaded=0;this._filename=null;var a=t.source;this._withCredentials=a.withCredentials||!1;this._contentLength=a.length;this._headersCapability=(0,o.createPromiseCapability)();this._disableRange=a.disableRange||!1;this._rangeChunkSize=a.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._isStreamingSupported=!a.disableStream;this._isRangeSupported=!a.disableRange;this._headers=createHeaders(this._stream.httpHeaders);var i=a.url;fetch(i,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((function(t){if(!(0,l.validateResponseStatus)(t.status))throw(0,l.createResponseStatusError)(t.status,i);r._reader=t.body.getReader();r._headersCapability.resolve();var a=function getResponseHeader(r){return t.headers.get(r)},u=(0,l.validateRangeRequestCapabilities)({getResponseHeader:a,isHttp:r._stream.isHttp,rangeChunkSize:r._rangeChunkSize,disableRange:r._disableRange}),c=u.allowRangeRequests,d=u.suggestedLength;r._isRangeSupported=c;r._contentLength=d||r._contentLength;r._filename=(0,l.extractFilenameFromHeader)(a);!r._isStreamingSupported&&r._isRangeSupported&&r.cancel(new o.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject);this.onProgress=null}_createClass(PDFFetchStreamReader,[{key:"headersReady",get:function get(){return this._headersCapability.promise}},{key:"filename",get:function get(){return this._filename}},{key:"contentLength",get:function get(){return this._contentLength}},{key:"isRangeSupported",get:function get(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee(){var t,r,a,o;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._headersCapability.promise;case 2:i.next=4;return this._reader.read();case 4:t=i.sent;r=t.value;if(!(a=t.done)){i.next=9;break}return i.abrupt("return",{value:r,done:a});case 9:this._loaded+=r.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});o=new Uint8Array(r).buffer;return i.abrupt("return",{value:o,done:!1});case 13:case"end":return i.stop()}}),_callee,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._reader&&this._reader.cancel(t);this._abortController&&this._abortController.abort()}}]);var t;return PDFFetchStreamReader}(),d=function(){function PDFFetchStreamRangeReader(t,r,a){var i=this;_classCallCheck(this,PDFFetchStreamRangeReader);this._stream=t;this._reader=null;this._loaded=0;var u=t.source;this._withCredentials=u.withCredentials||!1;this._readCapability=(0,o.createPromiseCapability)();this._isStreamingSupported=!u.disableStream;"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._headers=createHeaders(this._stream.httpHeaders);this._headers.append("Range","bytes=".concat(r,"-").concat(a-1));var c=u.url;fetch(c,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((function(t){if(!(0,l.validateResponseStatus)(t.status))throw(0,l.createResponseStatusError)(t.status,c);i._readCapability.resolve();i._reader=t.body.getReader()})).catch((function(t){if("AbortError"!==(null==t?void 0:t.name))throw t}));this.onProgress=null}_createClass(PDFFetchStreamRangeReader,[{key:"isStreamingSupported",get:function get(){return this._isStreamingSupported}},{key:"read",value:(t=_asyncToGenerator(i.default.mark((function _callee2(){var t,r,a,o;return i.default.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._readCapability.promise;case 2:i.next=4;return this._reader.read();case 4:t=i.sent;r=t.value;if(!(a=t.done)){i.next=9;break}return i.abrupt("return",{value:r,done:a});case 9:this._loaded+=r.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded});o=new Uint8Array(r).buffer;return i.abrupt("return",{value:o,done:!1});case 13:case"end":return i.stop()}}),_callee2,this)}))),function read(){return t.apply(this,arguments)})},{key:"cancel",value:function cancel(t){this._reader&&this._reader.cancel(t);this._abortController&&this._abortController.abort()}}]);var t;return PDFFetchStreamRangeReader}()}],__webpack_module_cache__={};function __w_pdfjs_require__(t){var r=__webpack_module_cache__[t];if(void 0!==r)return r.exports;var a=__webpack_module_cache__[t]={id:t,loaded:!1,exports:{}};__webpack_modules__[t].call(a.exports,a,a.exports,__w_pdfjs_require__);a.loaded=!0;return a.exports}__w_pdfjs_require__.nmd=t=>{t.paths=[];t.children||(t.children=[]);return t};var __webpack_exports__={};(()=>{"use strict";var t=__webpack_exports__;Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"addLinkAttributes",{enumerable:!0,get:function get(){return r.addLinkAttributes}});Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function get(){return r.getFilenameFromUrl}});Object.defineProperty(t,"getPdfFilenameFromUrl",{enumerable:!0,get:function get(){return r.getPdfFilenameFromUrl}});Object.defineProperty(t,"getXfaPageViewport",{enumerable:!0,get:function get(){return r.getXfaPageViewport}});Object.defineProperty(t,"isPdfFile",{enumerable:!0,get:function get(){return r.isPdfFile}});Object.defineProperty(t,"LinkTarget",{enumerable:!0,get:function get(){return r.LinkTarget}});Object.defineProperty(t,"loadScript",{enumerable:!0,get:function get(){return r.loadScript}});Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function get(){return r.PDFDateString}});Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function get(){return r.RenderingCancelledException}});Object.defineProperty(t,"build",{enumerable:!0,get:function get(){return a.build}});Object.defineProperty(t,"getDocument",{enumerable:!0,get:function get(){return a.getDocument}});Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function get(){return a.LoopbackPort}});Object.defineProperty(t,"PDFDataRangeTransport",{enumerable:!0,get:function get(){return a.PDFDataRangeTransport}});Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function get(){return a.PDFWorker}});Object.defineProperty(t,"version",{enumerable:!0,get:function get(){return a.version}});Object.defineProperty(t,"CMapCompressionType",{enumerable:!0,get:function get(){return i.CMapCompressionType}});Object.defineProperty(t,"createObjectURL",{enumerable:!0,get:function get(){return i.createObjectURL}});Object.defineProperty(t,"createPromiseCapability",{enumerable:!0,get:function get(){return i.createPromiseCapability}});Object.defineProperty(t,"createValidAbsoluteUrl",{enumerable:!0,get:function get(){return i.createValidAbsoluteUrl}});Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function get(){return i.InvalidPDFException}});Object.defineProperty(t,"MissingPDFException",{enumerable:!0,get:function get(){return i.MissingPDFException}});Object.defineProperty(t,"OPS",{enumerable:!0,get:function get(){return i.OPS}});Object.defineProperty(t,"PasswordResponses",{enumerable:!0,get:function get(){return i.PasswordResponses}});Object.defineProperty(t,"PermissionFlag",{enumerable:!0,get:function get(){return i.PermissionFlag}});Object.defineProperty(t,"removeNullCharacters",{enumerable:!0,get:function get(){return i.removeNullCharacters}});Object.defineProperty(t,"shadow",{enumerable:!0,get:function get(){return i.shadow}});Object.defineProperty(t,"UnexpectedResponseException",{enumerable:!0,get:function get(){return i.UnexpectedResponseException}});Object.defineProperty(t,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function get(){return i.UNSUPPORTED_FEATURES}});Object.defineProperty(t,"Util",{enumerable:!0,get:function get(){return i.Util}});Object.defineProperty(t,"VerbosityLevel",{enumerable:!0,get:function get(){return i.VerbosityLevel}});Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function get(){return o.AnnotationLayer}});Object.defineProperty(t,"GlobalWorkerOptions",{enumerable:!0,get:function get(){return l.GlobalWorkerOptions}});Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function get(){return c.renderTextLayer}});Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function get(){return d.SVGGraphics}});Object.defineProperty(t,"XfaLayer",{enumerable:!0,get:function get(){return h.XfaLayer}});var r=__w_pdfjs_require__(1),a=__w_pdfjs_require__(118),i=__w_pdfjs_require__(4),o=__w_pdfjs_require__(130),l=__w_pdfjs_require__(125),u=__w_pdfjs_require__(121),c=__w_pdfjs_require__(132),d=__w_pdfjs_require__(133),h=__w_pdfjs_require__(134);if(u.isNodeJS){var p=__w_pdfjs_require__(135).PDFNodeStream;(0,a.setPDFNetworkStreamFactory)((function(t){return new p(t)}))}else{var m=__w_pdfjs_require__(138).PDFNetworkStream,g=__w_pdfjs_require__(139).PDFFetchStream;(0,a.setPDFNetworkStreamFactory)((function(t){return(0,r.isValidFetchUrl)(t.url)?new g(t):new m(t)}))}})();return __webpack_exports__})()}));
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/(()=>{var t=[,(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.OptionKind=r.AppOptions=void 0;var i=a(2);function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};r.OptionKind=o;var l={cursorToolOnLoad:{value:0,kind:o.VIEWER+o.PREFERENCE},defaultUrl:{value:"",kind:o.VIEWER},defaultZoomValue:{value:"",kind:o.VIEWER+o.PREFERENCE},disableHistory:{value:!1,kind:o.VIEWER},disablePageLabels:{value:!1,kind:o.VIEWER+o.PREFERENCE},enablePermissions:{value:!1,kind:o.VIEWER+o.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:o.VIEWER+o.PREFERENCE},enableScripting:{value:!0,kind:o.VIEWER+o.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:o.VIEWER},externalLinkTarget:{value:0,kind:o.VIEWER+o.PREFERENCE},historyUpdateUrl:{value:!1,kind:o.VIEWER+o.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:o.VIEWER+o.PREFERENCE},imageResourcesPath:{value:"./images/",kind:o.VIEWER},maxCanvasPixels:{value:16777216,compatibility:i.viewerCompatibilityParams.maxCanvasPixels,kind:o.VIEWER},pdfBugEnabled:{value:!1,kind:o.VIEWER+o.PREFERENCE},printResolution:{value:150,kind:o.VIEWER},removePageBorders:{value:!1,kind:o.VIEWER+o.PREFERENCE},renderer:{value:"canvas",kind:o.VIEWER},renderInteractiveForms:{value:!0,kind:o.VIEWER+o.PREFERENCE},sidebarViewOnLoad:{value:-1,kind:o.VIEWER+o.PREFERENCE},scrollModeOnLoad:{value:-1,kind:o.VIEWER+o.PREFERENCE},spreadModeOnLoad:{value:-1,kind:o.VIEWER+o.PREFERENCE},textLayerMode:{value:1,kind:o.VIEWER+o.PREFERENCE},useOnlyCssZoom:{value:!1,kind:o.VIEWER+o.PREFERENCE},viewerCssTheme:{value:0,kind:o.VIEWER+o.PREFERENCE},viewOnLoad:{value:0,kind:o.VIEWER+o.PREFERENCE},cMapPacked:{value:!0,kind:o.API},cMapUrl:{value:"../web/cmaps/",kind:o.API},disableAutoFetch:{value:!1,kind:o.API+o.PREFERENCE},disableFontFace:{value:!1,kind:o.API+o.PREFERENCE},disableRange:{value:!1,kind:o.API+o.PREFERENCE},disableStream:{value:!1,kind:o.API+o.PREFERENCE},docBaseUrl:{value:"",kind:o.API},enableXfa:{value:!1,kind:o.API+o.PREFERENCE},fontExtraProperties:{value:!1,kind:o.API},isEvalSupported:{value:!0,kind:o.API},maxImageSize:{value:-1,kind:o.API},pdfBug:{value:!1,kind:o.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:o.API},verbosity:{value:1,kind:o.API},workerPort:{value:null,kind:o.WORKER},workerSrc:{value:"./assets/pdf.worker.js",kind:o.WORKER}};l.disablePreferences={value:!1,kind:o.VIEWER};l.locale={value:"undefined"!=typeof navigator?navigator.language:"en-US",kind:o.VIEWER};l.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:o.VIEWER};l.renderer.kind+=o.PREFERENCE;var u=Object.create(null),c=function(){function AppOptions(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,AppOptions);throw new Error("Cannot initialize AppOptions.")}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(AppOptions,null,[{key:"get",value:function get(t){var r=u[t];if(void 0!==r)return r;var a=l[t];if(void 0!==a){var i;return null!==(i=a.compatibility)&&void 0!==i?i:a.value}}},{key:"getAll",value:function getAll(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=Object.create(null);for(var a in l){var i,c=l[a];if(t){if(0==(t&c.kind))continue;if(t===o.PREFERENCE){var d=c.value,h=_typeof(d);if("boolean"===h||"string"===h||"number"===h&&Number.isInteger(d)){r[a]=d;continue}throw new Error("Invalid type for preference: ".concat(a))}}var p=u[a];r[a]=void 0!==p?p:null!==(i=c.compatibility)&&void 0!==i?i:c.value}return r}},{key:"set",value:function set(t,r){u[t]=r}},{key:"setAll",value:function setAll(t){for(var r in t)u[r]=t[r]}},{key:"remove",value:function remove(t){delete u[t]}}]);return AppOptions}();r.AppOptions=c},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.viewerCompatibilityParams=void 0;var a=Object.create(null),i="undefined"!=typeof navigator&&navigator.userAgent||"",o="undefined"!=typeof navigator&&navigator.platform||"",l="undefined"!=typeof navigator&&navigator.maxTouchPoints||1,u=/Android/.test(i),c=/\b(iPad|iPhone|iPod)(?=;)/.test(i)||"MacIntel"===o&&l>1,d=/CriOS/.test(i);!function checkOnBlobSupport(){d&&(a.disableCreateObjectURL=!0)}();!function checkCanvasSizeLimitation(){(c||u)&&(a.maxCanvasPixels=5242880)}();var h=Object.freeze(a);r.viewerCompatibilityParams=h},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFViewerApplication=r.PDFPrintServiceFactory=r.DefaultExternalServices=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(6),l=a(1),u=a(7),c=a(8),d=a(10),h=a(11),p=a(12),m=a(13),g=a(15),v=a(16),y=a(17),b=a(21),S=a(22),w=a(23),C=a(24),P=a(25),k=a(26),R=a(27),A=a(28),x=a(29),T=a(31),E=a(154),I=a(156),O=a(2),D=a(157);function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})));a.push.apply(a,i)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){_defineProperty(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var L="enablePermissions",M=-1,B=1,W={AUTOMATIC:0,LIGHT:1,DARK:2},N=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"],j=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"],V=function(){function DefaultExternalServices(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,DefaultExternalServices);throw new Error("Cannot initialize DefaultExternalServices.")}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(DefaultExternalServices,null,[{key:"updateFindControlState",value:function updateFindControlState(t){}},{key:"updateFindMatchesCount",value:function updateFindMatchesCount(t){}},{key:"initPassiveLoading",value:function initPassiveLoading(t){}},{key:"fallback",value:(t=_asyncToGenerator(i.default.mark((function _callee(t){return i.default.wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),_callee)}))),function fallback(r){return t.apply(this,arguments)})},{key:"reportTelemetry",value:function reportTelemetry(t){}},{key:"createDownloadManager",value:function createDownloadManager(t){throw new Error("Not implemented: createDownloadManager")}},{key:"createPreferences",value:function createPreferences(){throw new Error("Not implemented: createPreferences")}},{key:"createL10n",value:function createL10n(t){throw new Error("Not implemented: createL10n")}},{key:"createScripting",value:function createScripting(t){throw new Error("Not implemented: createScripting")}},{key:"supportsIntegratedFind",get:function get(){return(0,u.shadow)(this,"supportsIntegratedFind",!1)}},{key:"supportsDocumentFonts",get:function get(){return(0,u.shadow)(this,"supportsDocumentFonts",!0)}},{key:"supportedMouseWheelZoomModifierKeys",get:function get(){return(0,u.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}},{key:"isInAutomation",get:function get(){return(0,u.shadow)(this,"isInAutomation",!1)}}]);var t;return DefaultExternalServices}();r.DefaultExternalServices=V;var U={initialBookmark:document.location.hash.substring(1),_initializedCapability:(0,u.createPromiseCapability)(),_fellback:!1,appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfSidebarResizer:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,store:null,downloadManager:null,overlayManager:null,preferences:null,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,isInitialViewSet:!1,downloadComplete:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",externalServices:V,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_idleCallbacks:new Set,initialize:function initialize(t){var r=this;return _asyncToGenerator(i.default.mark((function _callee2(){var a;return i.default.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:r.preferences=r.externalServices.createPreferences();r.appConfig=t;i.next=4;return r._readPreferences();case 4:i.next=6;return r._parseHashParameters();case 6:r._forceCssTheme();i.next=9;return r._initializeL10n();case 9:r.isViewerEmbedded&&l.AppOptions.get("externalLinkTarget")===u.LinkTarget.NONE&&l.AppOptions.set("externalLinkTarget",u.LinkTarget.TOP);i.next=12;return r._initializeViewerComponents();case 12:r.bindEvents();r.bindWindowEvents();a=t.appContainer||document.documentElement;r.l10n.translate(a).then((function(){r.eventBus.dispatch("localized",{source:r})}));r._initializedCapability.resolve();r.initializeLoadingBar();case 18:case"end":return i.stop()}}),_callee2)})))()},_readPreferences:function _readPreferences(){var t=this;return _asyncToGenerator(i.default.mark((function _callee3(){return i.default.wrap((function _callee3$(r){for(;;)switch(r.prev=r.next){case 0:if(!l.AppOptions.get("disablePreferences")){r.next=2;break}return r.abrupt("return");case 2:r.prev=2;r.t0=l.AppOptions;r.next=6;return t.preferences.getAll();case 6:r.t1=r.sent;r.t0.setAll.call(r.t0,r.t1);r.next=13;break;case 10:r.prev=10;r.t2=r.catch(2);console.error('_readPreferences: "'.concat(null===r.t2||void 0===r.t2?void 0:r.t2.message,'".'));case 13:case"end":return r.stop()}}),_callee3,null,[[2,10]])})))()},_parseHashParameters:function _parseHashParameters(){var t=this;return _asyncToGenerator(i.default.mark((function _callee4(){var r,a,u,c;return i.default.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:if(l.AppOptions.get("pdfBugEnabled")){i.next=2;break}return i.abrupt("return",void 0);case 2:if(r=document.location.hash.substring(1)){i.next=5;break}return i.abrupt("return",void 0);case 5:a=(0,o.parseQueryString)(r),u=[];"disableworker"in a&&"true"===a.disableworker&&u.push(loadFakeWorker());"disablerange"in a&&l.AppOptions.set("disableRange","true"===a.disablerange);"disablestream"in a&&l.AppOptions.set("disableStream","true"===a.disablestream);"disableautofetch"in a&&l.AppOptions.set("disableAutoFetch","true"===a.disableautofetch);"disablefontface"in a&&l.AppOptions.set("disableFontFace","true"===a.disablefontface);"disablehistory"in a&&l.AppOptions.set("disableHistory","true"===a.disablehistory);"verbosity"in a&&l.AppOptions.set("verbosity",0|a.verbosity);if(!("textlayer"in a)){i.next=22;break}i.t0=a.textlayer;i.next="off"===i.t0?17:"visible"===i.t0||"shadow"===i.t0||"hover"===i.t0?19:22;break;case 17:l.AppOptions.set("textLayerMode",o.TextLayerMode.DISABLE);return i.abrupt("break",22);case 19:t.appConfig.viewerContainer.classList.add("textLayer-"+a.textlayer);return i.abrupt("break",22);case 22:if("pdfbug"in a){l.AppOptions.set("pdfBug",!0);l.AppOptions.set("fontExtraProperties",!0);c=a.pdfbug.split(",");u.push(loadAndEnablePDFBug(c))}"locale"in a&&l.AppOptions.set("locale",a.locale);if(0!==u.length){i.next=26;break}return i.abrupt("return",void 0);case 26:return i.abrupt("return",Promise.all(u).catch((function(t){console.error('_parseHashParameters: "'.concat(t.message,'".'))})));case 27:case"end":return i.stop()}}),_callee4)})))()},_initializeL10n:function _initializeL10n(){var t=this;return _asyncToGenerator(i.default.mark((function _callee5(){var r;return i.default.wrap((function _callee5$(a){for(;;)switch(a.prev=a.next){case 0:t.l10n=t.externalServices.createL10n({locale:l.AppOptions.get("locale")});a.next=3;return t.l10n.getDirection();case 3:r=a.sent;document.getElementsByTagName("html")[0].dir=r;case 5:case"end":return a.stop()}}),_callee5)})))()},_forceCssTheme:function _forceCssTheme(){var t=l.AppOptions.get("viewerCssTheme");if(t!==W.AUTOMATIC&&Object.values(W).includes(t))try{for(var r=document.styleSheets[0],a=(null==r?void 0:r.cssRules)||[],i="prefers-color-scheme",o="(".concat(i,": dark)"),u=new RegExp("^@media \\(".concat(i,": dark\\) {\\n\\s*([\\w\\s-.,:;/\\\\{}()]+)\\n}$")),c=0,d=a.length;c<d;c++){var h,p=a[c];if(p instanceof CSSMediaRule&&(null===(h=p.media)||void 0===h?void 0:h[0])===o){if(t===W.LIGHT){r.deleteRule(c);return}var m=u.exec(p.cssText);if(null!=m&&m[1]){r.deleteRule(c);r.insertRule(m[1],c)}return}}}catch(t){console.error('_forceCssTheme: "'.concat(null==t?void 0:t.message,'".'))}},_initializeViewerComponents:function _initializeViewerComponents(){var t=this;return _asyncToGenerator(i.default.mark((function _callee6(){var r,a,u,O,D,L,M,B,W;return i.default.wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:r=t.appConfig;a=r.eventBus||new o.EventBus({isInAutomation:t.externalServices.isInAutomation});t.eventBus=a;t.overlayManager=new h.OverlayManager;(u=new d.PDFRenderingQueue).onIdle=t._cleanup.bind(t);t.pdfRenderingQueue=u;O=new w.PDFLinkService({eventBus:a,externalLinkTarget:l.AppOptions.get("externalLinkTarget"),externalLinkRel:l.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:l.AppOptions.get("ignoreDestinationZoom")});t.pdfLinkService=O;D=t.externalServices.createDownloadManager();t.downloadManager=D;L=new y.PDFFindController({linkService:O,eventBus:a,pageViewMode:l.AppOptions.get("pageViewMode")});t.findController=L;M=new k.PDFScriptingManager({eventBus:a,sandboxBundleSrc:l.AppOptions.get("sandboxBundleSrc"),scriptingFactory:t.externalServices,docPropertiesLookup:t._scriptingDocProperties.bind(t)});t.pdfScriptingManager=M;B=r.mainContainer;W=r.viewerContainer;t.pdfViewer=new T.PDFViewer({container:B,viewer:W,eventBus:a,renderingQueue:u,linkService:O,downloadManager:D,findController:L,scriptingManager:M,renderer:l.AppOptions.get("renderer"),l10n:t.l10n,textLayerMode:l.AppOptions.get("textLayerMode"),imageResourcesPath:l.AppOptions.get("imageResourcesPath"),removePageBorders:l.AppOptions.get("removePageBorders"),renderInteractiveForms:l.AppOptions.get("renderInteractiveForms"),enablePrintAutoRotate:l.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:l.AppOptions.get("useOnlyCssZoom"),maxCanvasPixels:l.AppOptions.get("maxCanvasPixels"),pageViewMode:l.AppOptions.get("pageViewMode"),enableScripting:l.AppOptions.get("enableScripting")});u.setViewer(t.pdfViewer);O.setViewer(t.pdfViewer);M.setViewer(t.pdfViewer);t.pdfThumbnailViewer=new x.PDFThumbnailViewer({container:r.sidebar.thumbnailView,eventBus:a,renderingQueue:u,linkService:O,l10n:t.l10n});u.setThumbnailViewer(t.pdfThumbnailViewer);t.pdfHistory=new b.PDFHistory({linkService:O,eventBus:a});O.setHistory(t.pdfHistory);t.supportsIntegratedFind||(t.findBar=new v.PDFFindBar(r.findBar,a,t.l10n));t.pdfDocumentProperties=new g.PDFDocumentProperties(r.documentProperties,t.overlayManager,a,t.l10n);t.pdfCursorTools=new c.PDFCursorTools({container:B,eventBus:a,cursorToolOnLoad:l.AppOptions.get("cursorToolOnLoad")});t.toolbar=new I.Toolbar(r.toolbar,a,t.l10n);t.secondaryToolbar=new E.SecondaryToolbar(r.secondaryToolbar,B,a);t.supportsFullscreen&&(t.pdfPresentationMode=new P.PDFPresentationMode({container:B,pdfViewer:t.pdfViewer,eventBus:a}));t.passwordPrompt=new p.PasswordPrompt(r.passwordOverlay,t.overlayManager,t.l10n,t.isViewerEmbedded);t.pdfOutlineViewer=new C.PDFOutlineViewer({container:r.sidebar.outlineView,eventBus:a,linkService:O});t.pdfAttachmentViewer=new m.PDFAttachmentViewer({container:r.sidebar.attachmentsView,eventBus:a,downloadManager:D});t.pdfLayerViewer=new S.PDFLayerViewer({container:r.sidebar.layersView,eventBus:a,l10n:t.l10n});t.pdfSidebar=new R.PDFSidebar({elements:r.sidebar,pdfViewer:t.pdfViewer,pdfThumbnailViewer:t.pdfThumbnailViewer,eventBus:a,l10n:t.l10n});t.pdfSidebar.onToggled=t.forceRendering.bind(t);t.pdfSidebarResizer=new A.PDFSidebarResizer(r.sidebarResizer,a,t.l10n);case 38:case"end":return i.stop()}}),_callee6)})))()},run:function run(t){this.initialize(t).then(webViewerInitialized)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},zoomIn:function zoomIn(t){if(!this.pdfViewer.isInPresentationMode){var r=this.pdfViewer.currentScale,a=Number(l.AppOptions.get("maxZoom"));a||(a=o.MAX_SCALE);do{r=(1.1*r).toFixed(2);r=Math.ceil(10*r)/10;r=Math.min(a,r)}while(--t>0&&r<a);this.pdfViewer.currentScaleValue=r}},zoomOut:function zoomOut(t){if(!this.pdfViewer.isInPresentationMode){var r=this.pdfViewer.currentScale,a=Number(l.AppOptions.get("minZoom"));a||(a=o.MIN_SCALE);do{r=(r/1.1).toFixed(2);r=Math.floor(10*r)/10;r=Math.max(a,r)}while(--t>0&&r>a);this.pdfViewer.currentScaleValue=r}},zoomReset:function zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=o.DEFAULT_SCALE_VALUE)},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(t){this.pdfViewer.currentPageNumber=t},get supportsPrinting(){return Y.instance.supportsPrinting},get supportsFullscreen(){var t=document.documentElement,r=!!(t.requestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullScreen);!1!==document.fullscreenEnabled&&!1!==document.mozFullScreenEnabled&&!1!==document.webkitFullscreenEnabled||(r=!1);return(0,u.shadow)(this,"supportsFullscreen",r)},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts},initializeLoadingBar:function initializeLoadingBar(){var t=new o.ProgressBar("#loadingBar");t.hide();return(0,u.shadow)(this,"loadingBar",t)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading:function initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl:function setTitleUsingUrl(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.url=t;this.baseUrl=t.split("#")[0];var r=(0,u.getPdfFilenameFromUrl)(t,"");if(!r)try{r=decodeURIComponent((0,u.getFilenameFromUrl)(t))||t}catch(a){r=t}this.setTitle(r)},setTitle:function setTitle(t){this.isViewerEmbedded||(document.title=t)},get _docFilename(){return this._contentDispositionFilename||(0,u.getPdfFilenameFromUrl)(this.url)},_cancelIdleCallbacks:function _cancelIdleCallbacks(){if(this._idleCallbacks.size){var t,r=_createForOfIteratorHelper(this._idleCallbacks);try{for(r.s();!(t=r.n()).done;){var a=t.value;window.cancelIdleCallback(a)}}catch(t){r.e(t)}finally{r.f()}this._idleCallbacks.clear()}},close:function close(){var t=this;return _asyncToGenerator(i.default.mark((function _callee7(){var r,a;return i.default.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:t._unblockDocumentLoadEvent();t.appConfig.errorWrapper.container.hidden=!0;if(t.pdfLoadingTask){i.next=5;break}return i.abrupt("return");case 5:if(!((null===(r=t.pdfDocument)||void 0===r?void 0:r.annotationStorage.size)>0&&t._annotationStorageModified)){i.next=13;break}i.prev=6;i.next=9;return t.save({sourceEventType:"save"});case 9:i.next=13;break;case 11:i.prev=11;i.t0=i.catch(6);case 13:(a=[]).push(t.pdfLoadingTask.destroy());t.pdfLoadingTask=null;if(t.pdfDocument){t.pdfDocument=null;t.pdfThumbnailViewer.setDocument(null);t.pdfViewer.setDocument(null);t.pdfLinkService.setDocument(null);t.pdfDocumentProperties.setDocument(null)}webViewerResetPermissions();t.pdfLinkService.externalLinkEnabled=!0;t._fellback=!1;t.store=null;t.isInitialViewSet=!1;t.downloadComplete=!1;t.url="";t.baseUrl="";t.documentInfo=null;t.metadata=null;t._contentDispositionFilename=null;t._contentLength=null;t._saveInProgress=!1;t._cancelIdleCallbacks();a.push(t.pdfScriptingManager.destroyPromise);t.pdfSidebar.reset();t.pdfOutlineViewer.reset();t.pdfAttachmentViewer.reset();t.pdfLayerViewer.reset();t.pdfHistory&&t.pdfHistory.reset();t.findBar&&t.findBar.reset();t.toolbar.reset();t.secondaryToolbar.reset();"undefined"!=typeof PDFBug&&PDFBug.cleanup();i.next=43;return Promise.all(a);case 43:case"end":return i.stop()}}),_callee7,null,[[6,11]])})))()},open:function open(t,r){var a=this;return _asyncToGenerator(i.default.mark((function _callee8(){var o,c,d,h,p,m,g,v;return i.default.wrap((function _callee8$(i){for(;;)switch(i.prev=i.next){case 0:if(!a.pdfLoadingTask){i.next=3;break}i.next=3;return a.close();case 3:o=l.AppOptions.getAll(l.OptionKind.WORKER);for(c in o)u.GlobalWorkerOptions[c]=o[c];d=Object.create(null);if("string"==typeof t){a.setTitleUsingUrl(t);d.url=t}else if(t&&"byteLength"in t)d.data=t;else if(t.url&&t.originalUrl){a.setTitleUsingUrl(t.originalUrl);d.url=t.url}h=l.AppOptions.getAll(l.OptionKind.API);for(p in h){m=h[p];d[p]=m}if(r)for(g in r)d[g]=r[g];v=(0,u.getDocument)(d);a.pdfLoadingTask=v;v.onPassword=function(t,r){a.pdfLinkService.externalLinkEnabled=!1;a.passwordPrompt.setUpdateCallback(t,r);a.passwordPrompt.open()};v.onProgress=function(t){var r=t.loaded,i=t.total;a.progress(r/i);a.eventBus.dispatch("progress",{source:a,type:"load",total:i,loaded:r,percent:100*r/i})};v.onUnsupportedFeature=a.fallback.bind(a);a.loadingBar.show();return i.abrupt("return",v.promise.then((function(t){a.load(t)}),(function(t){if(v===a.pdfLoadingTask){var r="loading_error";t instanceof u.InvalidPDFException?r="invalid_file_error":t instanceof u.MissingPDFException?r="missing_file_error":t instanceof u.UnexpectedResponseException&&(r="unexpected_response_error");return a.l10n.get(r).then((function(r){a._documentError(r,{message:null==t?void 0:t.message});a.onError(t);throw t}))}})));case 17:case"end":return i.stop()}}),_callee8)})))()},_ensureDownloadComplete:function _ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")},download:function download(){var t=arguments,r=this;return _asyncToGenerator(i.default.mark((function _callee9(){var a,o,l,u,c,d,h;return i.default.wrap((function _callee9$(i){for(;;)switch(i.prev=i.next){case 0:a=t.length>0&&void 0!==t[0]?t[0]:{},o=a.sourceEventType,l=void 0===o?"download":o;u=r.baseUrl,c=r._docFilename;i.prev=2;r._ensureDownloadComplete();i.next=6;return r.pdfDocument.getData();case 6:d=i.sent;h=new Blob([d],{type:"application/pdf"});i.next=10;return r.downloadManager.download(h,u,c,l);case 10:i.next=16;break;case 12:i.prev=12;i.t0=i.catch(2);i.next=16;return r.downloadManager.downloadUrl(u,c);case 16:case"end":return i.stop()}}),_callee9,null,[[2,12]])})))()},save:function save(){var t=arguments,r=this;return _asyncToGenerator(i.default.mark((function _callee10(){var a,o,l,u,c,d,h;return i.default.wrap((function _callee10$(i){for(;;)switch(i.prev=i.next){case 0:a=t.length>0&&void 0!==t[0]?t[0]:{},o=a.sourceEventType,l=void 0===o?"download":o;if(!r._saveInProgress){i.next=3;break}return i.abrupt("return");case 3:r._saveInProgress=!0;i.next=6;return r.pdfScriptingManager.dispatchWillSave();case 6:u=r.baseUrl,c=r._docFilename;i.prev=7;r._ensureDownloadComplete();i.next=11;return r.pdfDocument.saveDocument();case 11:d=i.sent;h=new Blob([d],{type:"application/pdf"});i.next=15;return r.downloadManager.download(h,u,c,l);case 15:i.next=21;break;case 17:i.prev=17;i.t0=i.catch(7);i.next=21;return r.download({sourceEventType:l});case 21:i.prev=21;i.next=24;return r.pdfScriptingManager.dispatchDidSave();case 24:r._saveInProgress=!1;return i.finish(21);case 26:case"end":return i.stop()}}),_callee10,null,[[7,17,21,26]])})))()},downloadOrSave:function downloadOrSave(t){var r;(null===(r=this.pdfDocument)||void 0===r?void 0:r.annotationStorage.size)>0?this.save(t):this.download(t)},fallback:function fallback(t){var r=this;this.externalServices.reportTelemetry({type:"unsupportedFeature",featureId:t});if(!this._fellback){this._fellback=!0;this.externalServices.fallback({featureId:t,url:this.baseUrl}).then((function(t){t&&r.download({sourceEventType:"download"})}))}},_documentError:function _documentError(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._unblockDocumentLoadEvent();this._otherError(t,r)},_otherError:function _otherError(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=[this.l10n.get("error_version_info",{version:u.version||"?",build:u.build||"?"})];if(r){a.push(this.l10n.get("error_message",{message:r.message}));if(r.stack)a.push(this.l10n.get("error_stack",{stack:r.stack}));else{r.filename&&a.push(this.l10n.get("error_file",{file:r.filename}));r.lineNumber&&a.push(this.l10n.get("error_line",{line:r.lineNumber}))}}var i=this.appConfig.errorWrapper,l=i.container;l.hidden=!1;var c=i.errorMessage;c.textContent=t;var d=i.closeButton;d.onclick=function(){l.hidden=!0};var h=i.errorMoreInfo,p=i.moreInfoButton,m=i.lessInfoButton;p.onclick=function(){h.hidden=!1;p.hidden=!0;m.hidden=!1;h.style.height=h.scrollHeight+"px"};m.onclick=function(){h.hidden=!0;p.hidden=!1;m.hidden=!0};p.oncontextmenu=o.noContextMenuHandler;m.oncontextmenu=o.noContextMenuHandler;d.oncontextmenu=o.noContextMenuHandler;p.hidden=!1;m.hidden=!0;Promise.all(a).then((function(t){h.value=t.join("\n")}))},progress:function progress(t){var r=this;if(!this.downloadComplete){var a=Math.round(100*t);if(a>this.loadingBar.percent||isNaN(a)){this.loadingBar.percent=a;if((this.pdfDocument?this.pdfDocument.loadingParams.disableAutoFetch:l.AppOptions.get("disableAutoFetch"))&&a){if(this.disableAutoFetchLoadingBarTimeout){clearTimeout(this.disableAutoFetchLoadingBarTimeout);this.disableAutoFetchLoadingBarTimeout=null}this.loadingBar.show();this.disableAutoFetchLoadingBarTimeout=setTimeout((function(){r.loadingBar.hide();r.disableAutoFetchLoadingBarTimeout=null}),5e3)}}}},load:function load(t){var r=this;this.pdfDocument=t;t.getDownloadInfo().then((function(t){var a=t.length;r._contentLength=a;r.downloadComplete=!0;r.loadingBar.hide();h.then((function(){r.eventBus.dispatch("documentloaded",{source:r})}))}));var a=t.getPageLayout().catch((function(){})),u=t.getPageMode().catch((function(){})),c=t.getOpenAction().catch((function(){}));this.toolbar.setPagesCount(t.numPages,!1);this.secondaryToolbar.setPagesCount(t.numPages);null;this.pdfLinkService.setDocument(t,null);this.pdfDocumentProperties.setDocument(t,this.url);var d=this.pdfViewer;d.setDocument(t);var h=d.firstPagePromise,p=d.onePageRendered,m=d.pagesPromise;this.pdfThumbnailViewer.setDocument(t);var g=(this.store=new D.ViewHistory(t.fingerprints[0])).getMultiple({page:null,zoom:o.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:o.SidebarView.UNKNOWN,scrollMode:o.ScrollMode.UNKNOWN,spreadMode:o.SpreadMode.UNKNOWN}).catch((function(){return Object.create(null)}));h.then((function(h){r.loadingBar.setWidth(r.appConfig.viewerContainer);r._initializeAnnotationStorageCallbacks(t);Promise.all([o.animationStarted,g,a,u,c]).then(function(){var a=_asyncToGenerator(i.default.mark((function _callee11(a){var u,c,h,p,g,v,y,b,S,w,C,P,k;return i.default.wrap((function _callee11$(i){for(;;)switch(i.prev=i.next){case 0:u=_slicedToArray(a,5),u[0],c=u[1],h=u[2],p=u[3],g=u[4];v=l.AppOptions.get("viewOnLoad");r._initializePdfHistory({fingerprint:t.fingerprints[0],viewOnLoad:v,initialDest:null==g?void 0:g.dest});y=r.initialBookmark;b=l.AppOptions.get("defaultZoomValue");S=b?"zoom=".concat(b):null;w=null;C=l.AppOptions.get("sidebarViewOnLoad");P=l.AppOptions.get("scrollModeOnLoad");k=l.AppOptions.get("spreadModeOnLoad");if(c.page&&v!==B){S="page=".concat(c.page,"&zoom=").concat(b||c.zoom,",")+"".concat(c.scrollLeft,",").concat(c.scrollTop);w=parseInt(c.rotation,10);C===o.SidebarView.UNKNOWN&&(C=0|c.sidebarView);P===o.ScrollMode.UNKNOWN&&(P=0|c.scrollMode);k===o.SpreadMode.UNKNOWN&&(k=0|c.spreadMode)}p&&C===o.SidebarView.UNKNOWN&&(C=(0,o.apiPageModeToSidebarView)(p));h&&k===o.SpreadMode.UNKNOWN&&(k=(0,o.apiPageLayoutToSpreadMode)(h));r.setInitialView(S,{rotation:w,sidebarView:C,scrollMode:P,spreadMode:k});r.eventBus.dispatch("documentinit",{source:r});r.isViewerEmbedded||d.focus();r._initializePermissions(t);i.next=19;return Promise.race([m,new Promise((function(t){setTimeout(t,1e4)}))]);case 19:if(y||S){i.next=21;break}return i.abrupt("return");case 21:if(!d.hasEqualPageSizes){i.next=23;break}return i.abrupt("return");case 23:r.initialBookmark=y;d.currentScaleValue=d.currentScaleValue;r.setInitialView(S);case 26:case"end":return i.stop()}}),_callee11)})));return function(t){return a.apply(this,arguments)}}()).catch((function(){r.setInitialView()})).then((function(){d.update()}))}));m.then((function(){r._unblockDocumentLoadEvent();r._initializeAutoPrint(t,c)}));p.then((function(){t.getOutline().then((function(a){t===r.pdfDocument&&r.pdfOutlineViewer.render({outline:a,pdfDocument:t})}));t.getAttachments().then((function(a){t===r.pdfDocument&&r.pdfAttachmentViewer.render({attachments:a})}));d.optionalContentConfigPromise.then((function(a){t===r.pdfDocument&&r.pdfLayerViewer.render({optionalContentConfig:a,pdfDocument:t})}));if("requestIdleCallback"in window){var a=window.requestIdleCallback((function(){r._collectTelemetry(t);r._idleCallbacks.delete(a)}),{timeout:1e3});r._idleCallbacks.add(a)}}));this._initializePageLabels(t);this._initializeMetadata(t)},_scriptingDocProperties:function _scriptingDocProperties(t){var r=this;return _asyncToGenerator(i.default.mark((function _callee12(){var a,o;return i.default.wrap((function _callee12$(i){for(;;)switch(i.prev=i.next){case 0:if(r.documentInfo){i.next=5;break}i.next=3;return new Promise((function(t){r.eventBus._on("metadataloaded",t,{once:!0})}));case 3:if(t===r.pdfDocument){i.next=5;break}return i.abrupt("return",null);case 5:if(r._contentLength){i.next=10;break}i.next=8;return new Promise((function(t){r.eventBus._on("documentloaded",t,{once:!0})}));case 8:if(t===r.pdfDocument){i.next=10;break}return i.abrupt("return",null);case 10:return i.abrupt("return",_objectSpread(_objectSpread({},r.documentInfo),{},{baseURL:r.baseUrl,filesize:r._contentLength,filename:r._docFilename,metadata:null===(a=r.metadata)||void 0===a?void 0:a.getRaw(),authors:null===(o=r.metadata)||void 0===o?void 0:o.get("dc:creator"),numPages:r.pagesCount,URL:r.url}));case 11:case"end":return i.stop()}}),_callee12)})))()},_collectTelemetry:function _collectTelemetry(t){var r=this;return _asyncToGenerator(i.default.mark((function _callee13(){var a,o;return i.default.wrap((function _callee13$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return r.pdfDocument.getMarkInfo();case 2:a=i.sent;if(t===r.pdfDocument){i.next=5;break}return i.abrupt("return");case 5:o=(null==a?void 0:a.Marked)||!1;r.externalServices.reportTelemetry({type:"tagged",tagged:o});case 7:case"end":return i.stop()}}),_callee13)})))()},_initializeAutoPrint:function _initializeAutoPrint(t,r){var a=this;return _asyncToGenerator(i.default.mark((function _callee14(){var l,c,d,h,p,m,g,v;return i.default.wrap((function _callee14$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return Promise.all([r,a.pdfViewer.enableScripting?null:t.getJavaScript()]);case 2:l=i.sent;c=_slicedToArray(l,2);d=c[0];h=c[1];if(t===a.pdfDocument){i.next=8;break}return i.abrupt("return");case 8:p=!1;"Print"===(null==d?void 0:d.action)&&(p=!0);if(!h){i.next=31;break}h.some((function(t){if(!t)return!1;console.warn("Warning: JavaScript support is not enabled");a.fallback(u.UNSUPPORTED_FEATURES.javaScript);return!0}));if(p){i.next=31;break}m=_createForOfIteratorHelper(h);i.prev=14;m.s();case 16:if((g=m.n()).done){i.next=23;break}if(!(v=g.value)||!o.AutoPrintRegExp.test(v)){i.next=21;break}p=!0;return i.abrupt("break",23);case 21:i.next=16;break;case 23:i.next=28;break;case 25:i.prev=25;i.t0=i.catch(14);m.e(i.t0);case 28:i.prev=28;m.f();return i.finish(28);case 31:p&&a.triggerPrinting();case 32:case"end":return i.stop()}}),_callee14,null,[[14,25,28,31]])})))()},_initializeMetadata:function _initializeMetadata(t){var r=this;return _asyncToGenerator(i.default.mark((function _callee15(){var a,o,l,c,d,h,p,m,g,v,y,b,S,w;return i.default.wrap((function _callee15$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return t.getMetadata();case 2:l=i.sent;c=l.info;d=l.metadata;h=l.contentDispositionFilename;p=l.contentLength;if(t===r.pdfDocument){i.next=9;break}return i.abrupt("return");case 9:r.documentInfo=c;r.metadata=d;null!==(a=r._contentDispositionFilename)&&void 0!==a||(r._contentDispositionFilename=h);null!==(o=r._contentLength)&&void 0!==o||(r._contentLength=p);if(!(m=window.PDFViewerApplicationOptions)||m.get("verbosity")>0){console.log("PDF viewer: ngx-extended-pdf-viewer running on pdf.js "+(window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"].version:" developer version (?)"));console.log("PDF ".concat(t.fingerprints[0]," [").concat(c.PDFFormatVersion," ")+"".concat((c.Producer||"-").trim()," / ").concat((c.Creator||"-").trim(),"] ")+"(PDF.js: ".concat(u.version||"-")+"".concat(r.pdfViewer.enableWebGL?" [WebGL]":"",") modified by ngx-extended-pdf-viewer)"))}g=null==c?void 0:c.Title;(v=null==d?void 0:d.get("dc:title"))&&("Untitled"===v||/[\uFFF0-\uFFFF]/g.test(v)||(g=v));g?r.setTitle("".concat(g," - ").concat(h||document.title)):h&&r.setTitle(h);if(!c.IsXFAPresent||c.IsAcroFormPresent||t.isPureXfa){if((c.IsAcroFormPresent||c.IsXFAPresent)&&!r.pdfViewer.renderInteractiveForms){console.warn("Warning: Interactive form support is not enabled");r.fallback(u.UNSUPPORTED_FEATURES.forms)}}else{console.warn("Warning: XFA support is not enabled");r.fallback(u.UNSUPPORTED_FEATURES.forms)}if(c.IsSignaturesPresent){console.warn("Warning: Digital signatures validation is not supported");r.fallback(u.UNSUPPORTED_FEATURES.signatures)}y="other";N.includes(c.PDFFormatVersion)&&(y="v".concat(c.PDFFormatVersion.replace(".","_")));b="other";if(c.Producer){S=c.Producer.toLowerCase();j.some((function(t){if(!S.includes(t))return!1;b=t.replace(/[ .-]/g,"_");return!0}))}w=null;c.IsXFAPresent?w="xfa":c.IsAcroFormPresent&&(w="acroform");r.externalServices.reportTelemetry({type:"documentInfo",version:y,generator:b,formType:w});r.eventBus.dispatch("metadataloaded",{source:r});case 29:case"end":return i.stop()}}),_callee15)})))()},_initializePageLabels:function _initializePageLabels(t){var r=this;return _asyncToGenerator(i.default.mark((function _callee16(){var a,o,u,c,d,h;return i.default.wrap((function _callee16$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return t.getPageLabels();case 2:a=i.sent;if(t===r.pdfDocument){i.next=5;break}return i.abrupt("return");case 5:if(a&&!l.AppOptions.get("disablePageLabels")){i.next=7;break}return i.abrupt("return");case 7:if((o=a.length)===r.pagesCount){i.next=11;break}console.error("The number of Page Labels does not match the number of pages in the document.");return i.abrupt("return");case 11:u=0;for(;u<o&&a[u]===(u+1).toString();)u++;if(u!==o){i.next=15;break}return i.abrupt("return");case 15:c=r.pdfViewer,d=r.pdfThumbnailViewer,h=r.toolbar;c.setPageLabels(a);d.setPageLabels(a);h.setPagesCount(o,!0);h.setPageNumber(c.currentPageNumber,c.currentPageLabel);case 20:case"end":return i.stop()}}),_callee16)})))()},_initializePdfHistory:function _initializePdfHistory(t){var r=t.fingerprint,a=t.viewOnLoad,i=t.initialDest,o=void 0===i?null:i;if(!this.isViewerEmbedded&&!l.AppOptions.get("disableHistory")){this.pdfHistory.initialize({fingerprint:r,resetHistory:a===B,updateUrl:l.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(o&&!this.initialBookmark&&a===M){this.initialBookmark=JSON.stringify(o);this.pdfHistory.push({explicitDest:o,pageNumber:null})}}},_initializePermissions:function _initializePermissions(t){var r=this;return _asyncToGenerator(i.default.mark((function _callee17(){var a;return i.default.wrap((function _callee17$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return t.getPermissions();case 2:a=i.sent;if(t===r.pdfDocument){i.next=5;break}return i.abrupt("return");case 5:if(a&&l.AppOptions.get("enablePermissions")){i.next=7;break}return i.abrupt("return");case 7:a.includes(u.PermissionFlag.COPY)||r.appConfig.viewerContainer.classList.add(L);case 8:case"end":return i.stop()}}),_callee17)})))()},_initializeAnnotationStorageCallbacks:function _initializeAnnotationStorageCallbacks(t){var r=this;if(t===this.pdfDocument){var a=t.annotationStorage;a.onSetModified=function(){window.addEventListener("beforeunload",beforeUnload);r._annotationStorageModified=!0};a.onResetModified=function(){window.removeEventListener("beforeunload",beforeUnload);delete r._annotationStorageModified}}},setInitialView:function setInitialView(t){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.rotation,l=a.sidebarView,u=a.scrollMode,c=a.spreadMode,d=function setRotation(t){(0,o.isValidRotation)(t)&&(r.pdfViewer.pagesRotation=t)},h=function setViewerModes(t,a){(0,o.isValidScrollMode)(t)&&(r.pdfViewer.scrollMode=t);(0,o.isValidSpreadMode)(a)&&(r.pdfViewer.spreadMode=a)};this.isInitialViewSet=!0;this.pdfSidebar.setInitialView(l);h(u,c);if(this.initialBookmark){d(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(t){d(i);this.pdfLinkService.setHash(t)}this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){var p=PDFViewerApplicationOptions.get("defaultZoomValue");p&&(this.pdfViewer.currentScaleValue=p)}},_cleanup:function _cleanup(){if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer.cleanup();this.pdfDocument.cleanup(this.pdfViewer.renderer===o.RendererType.SVG)}},forceRendering:function forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar.isThumbnailViewVisible;this.pdfRenderingQueue.renderHighestPriority()},beforePrint:function beforePrint(){var t=this;this.pdfScriptingManager.dispatchWillPrint();if(!this.printService)if(this.supportsPrinting)if(this.pdfViewer.pageViewsReady){var r=this.pdfViewer.getPagesOverview(),a=this.appConfig.printContainer,i=l.AppOptions.get("printResolution"),o=this.pdfViewer.optionalContentConfigPromise,u=Y.instance.createPrintService(this.pdfDocument,r,a,i,o,this.l10n,this.pdfViewer.eventBus);this.printService=u;this.forceRendering();u.layout();this.externalServices.reportTelemetry({type:"print"})}else this.l10n.get("printing_not_ready").then((function(t){window.alert(t)}));else this.l10n.get("printing_not_supported").then((function(r){t._otherError(r)}))},afterPrint:function afterPrint(){this.pdfScriptingManager.dispatchDidPrint();if(this.printService){document.body.removeAttribute("data-pdfjsprinting");this.printService.destroy();this.printService=null;this.pdfDocument&&this.pdfDocument.annotationStorage.resetModified()}this.forceRendering()},rotatePages:function rotatePages(t){this.pdfViewer.pagesRotation+=t},requestPresentationMode:function requestPresentationMode(){this.pdfPresentationMode&&this.pdfPresentationMode.request()},triggerPrinting:function triggerPrinting(){this.supportsPrinting&&window.printPDF()},bindEvents:function bindEvents(){var t=this.eventBus,r=this._boundEvents;r.beforePrint=this.beforePrint.bind(this);r.afterPrint=this.afterPrint.bind(this);t._on("resize",webViewerResize);t._on("hashchange",webViewerHashchange);t._on("beforeprint",r.beforePrint);t._on("afterprint",r.afterPrint);t._on("pagerendered",webViewerPageRendered);t._on("updateviewarea",webViewerUpdateViewarea);t._on("pagechanging",webViewerPageChanging);t._on("scalechanging",webViewerScaleChanging);t._on("rotationchanging",webViewerRotationChanging);t._on("sidebarviewchanged",webViewerSidebarViewChanged);t._on("pagemode",webViewerPageMode);t._on("namedaction",webViewerNamedAction);t._on("presentationmodechanged",webViewerPresentationModeChanged);t._on("presentationmode",webViewerPresentationMode);t._on("print",webViewerPrint);t._on("download",webViewerDownload);t._on("save",webViewerSave);t._on("firstpage",webViewerFirstPage);t._on("lastpage",webViewerLastPage);t._on("nextpage",webViewerNextPage);t._on("previouspage",webViewerPreviousPage);t._on("zoomin",webViewerZoomIn);t._on("zoomout",webViewerZoomOut);t._on("zoomreset",webViewerZoomReset);t._on("pagenumberchanged",webViewerPageNumberChanged);t._on("scalechanged",webViewerScaleChanged);t._on("rotatecw",webViewerRotateCw);t._on("rotateccw",webViewerRotateCcw);t._on("optionalcontentconfig",webViewerOptionalContentConfig);t._on("switchscrollmode",webViewerSwitchScrollMode);t._on("scrollmodechanged",webViewerScrollModeChanged);t._on("switchspreadmode",webViewerSwitchSpreadMode);t._on("spreadmodechanged",webViewerSpreadModeChanged);t._on("documentproperties",webViewerDocumentProperties);t._on("find",webViewerFind);t._on("findfromurlhash",webViewerFindFromUrlHash);t._on("updatefindmatchescount",webViewerUpdateFindMatchesCount);t._on("updatefindcontrolstate",webViewerUpdateFindControlState);if(l.AppOptions.get("pdfBug")){r.reportPageStatsPDFBug=reportPageStatsPDFBug;t._on("pagerendered",r.reportPageStatsPDFBug);t._on("pagechanging",r.reportPageStatsPDFBug)}t._on("fileinputchange",q);t._on("openfile",z)},bindWindowEvents:function bindWindowEvents(){var t=this.eventBus,r=this._boundEvents;r.windowResize=function(){t.dispatch("resize",{source:window})};r.windowHashChange=function(){t.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})};r.windowBeforePrint=function(){t.dispatch("beforeprint",{source:window})};r.windowAfterPrint=function(){t.dispatch("afterprint",{source:window})};r.windowUpdateFromSandbox=function(r){t.dispatch("updatefromsandbox",{source:window,detail:r.detail})};window.addEventListener("visibilitychange",webViewerVisibilityChange);window.addEventListener("wheel",webViewerWheel,{passive:!1});window.addEventListener("click",webViewerClick);window.addEventListener("keydown",webViewerKeyDown);window.addEventListener("resize",r.windowResize);window.addEventListener("hashchange",r.windowHashChange);window.addEventListener("beforeprint",r.windowBeforePrint);window.addEventListener("afterprint",r.windowAfterPrint);window.addEventListener("updatefromsandbox",r.windowUpdateFromSandbox)},unbindEvents:function unbindEvents(){var t=this.eventBus,r=this._boundEvents;t._off("resize",webViewerResize);t._off("hashchange",webViewerHashchange);t._off("beforeprint",r.beforePrint);t._off("afterprint",r.afterPrint);t._off("pagerendered",webViewerPageRendered);t._off("updateviewarea",webViewerUpdateViewarea);t._off("pagechanging",webViewerPageChanging);t._off("scalechanging",webViewerScaleChanging);t._off("rotationchanging",webViewerRotationChanging);t._off("sidebarviewchanged",webViewerSidebarViewChanged);t._off("pagemode",webViewerPageMode);t._off("namedaction",webViewerNamedAction);t._off("presentationmodechanged",webViewerPresentationModeChanged);t._off("presentationmode",webViewerPresentationMode);t._off("print",webViewerPrint);t._off("download",webViewerDownload);t._off("save",webViewerSave);t._off("firstpage",webViewerFirstPage);t._off("lastpage",webViewerLastPage);t._off("nextpage",webViewerNextPage);t._off("previouspage",webViewerPreviousPage);t._off("zoomin",webViewerZoomIn);t._off("zoomout",webViewerZoomOut);t._off("zoomreset",webViewerZoomReset);t._off("pagenumberchanged",webViewerPageNumberChanged);t._off("scalechanged",webViewerScaleChanged);t._off("rotatecw",webViewerRotateCw);t._off("rotateccw",webViewerRotateCcw);t._off("optionalcontentconfig",webViewerOptionalContentConfig);t._off("switchscrollmode",webViewerSwitchScrollMode);t._off("scrollmodechanged",webViewerScrollModeChanged);t._off("switchspreadmode",webViewerSwitchSpreadMode);t._off("spreadmodechanged",webViewerSpreadModeChanged);t._off("documentproperties",webViewerDocumentProperties);t._off("find",webViewerFind);t._off("findfromurlhash",webViewerFindFromUrlHash);t._off("updatefindmatchescount",webViewerUpdateFindMatchesCount);t._off("updatefindcontrolstate",webViewerUpdateFindControlState);if(r.reportPageStatsPDFBug){t._off("pagerendered",r.reportPageStatsPDFBug);t._off("pagechanging",r.reportPageStatsPDFBug);r.reportPageStatsPDFBug=null}t._off("fileinputchange",q);t._off("openfile",z);r.beforePrint=null;r.afterPrint=null},unbindWindowEvents:function unbindWindowEvents(){var t=this._boundEvents;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("resize",t.windowResize);window.removeEventListener("hashchange",t.windowHashChange);window.removeEventListener("beforeprint",t.windowBeforePrint);window.removeEventListener("afterprint",t.windowAfterPrint);window.removeEventListener("updatefromsandbox",t.windowUpdateFromSandbox);t.windowResize=null;t.windowHashChange=null;t.windowBeforePrint=null;t.windowAfterPrint=null;t.windowUpdateFromSandbox=null},accumulateWheelTicks:function accumulateWheelTicks(t){(this._wheelUnusedTicks>0&&t<0||this._wheelUnusedTicks<0&&t>0)&&(this._wheelUnusedTicks=0);this._wheelUnusedTicks+=t;var r=Math.sign(this._wheelUnusedTicks)*Math.floor(Math.abs(this._wheelUnusedTicks));this._wheelUnusedTicks-=r;return r},_unblockDocumentLoadEvent:function _unblockDocumentLoadEvent(){document.blockUnblockOnload&&document.blockUnblockOnload(!1);this._unblockDocumentLoadEvent=function(){}},get scriptingReady(){return this.pdfScriptingManager.ready}};r.PDFViewerApplication=U;var q,z,H=["null","http://mozilla.github.io","https://mozilla.github.io"];(function validateFileURL(t){if(void 0!==t)try{var r=new URL(window.location.href).origin||"null";if(H.includes(r))return;var a=new URL(t,window.location.href),i=a.origin,o=a.protocol;if(i!==r&&"blob:"!==o)throw new Error("file origin does not match viewer's")}catch(t){U.l10n.get("loading_error").then((function(r){U._documentError(r,{message:null==t?void 0:t.message})}));throw t}});function loadFakeWorker(){return _loadFakeWorker.apply(this,arguments)}function _loadFakeWorker(){return(_loadFakeWorker=_asyncToGenerator(i.default.mark((function _callee18(){return i.default.wrap((function _callee18$(t){for(;;)switch(t.prev=t.next){case 0:u.GlobalWorkerOptions.workerSrc||(u.GlobalWorkerOptions.workerSrc=l.AppOptions.get("workerSrc"));return t.abrupt("return",(0,u.loadScript)(u.PDFWorker.getWorkerSrc()));case 2:case"end":return t.stop()}}),_callee18)})))).apply(this,arguments)}function loadAndEnablePDFBug(t){var r=U.appConfig;return(0,u.loadScript)(r.debuggerScriptPath).then((function(){PDFBug.enable(t);PDFBug.init({OPS:u.OPS},r.mainContainer)}))}function reportPageStatsPDFBug(t){var r,a=t.pageNumber;if("undefined"!=typeof Stats&&Stats.enabled){var i=U.pdfViewer.getPageView(a-1),o=null==i||null===(r=i.pdfPage)||void 0===r?void 0:r.stats;o&&Stats.add(a,o)}}function webViewerInitialized(){var t=U.appConfig,r=document.createElement("input");r.id=t.openFileInputName;r.className="fileInput";r.setAttribute("accept",".pdf,application/pdf");r.setAttribute("type","file");r.oncontextmenu=o.noContextMenuHandler;document.body.appendChild(r);if(window.File&&window.FileReader&&window.FileList&&window.Blob)r.value=null;else{t.toolbar.openFile.hidden=!0;t.secondaryToolbar.openFileButton.hidden=!0}r.addEventListener("change",(function(t){var r=t.target.files;r&&0!==r.length&&U.eventBus.dispatch("fileinputchange",{source:this,fileInput:t.target})}));t.mainContainer.addEventListener("dragover",(function(t){if(l.AppOptions.get("enableDragAndDrop")){t.preventDefault();t.dataTransfer.dropEffect="move"}}));t.mainContainer.addEventListener("drop",(function(t){if(l.AppOptions.get("enableDragAndDrop")){t.preventDefault();var r=t.dataTransfer.files;if(!r||0===r.length)return;U.eventBus.dispatch("fileinputchange",{source:this,fileInput:t.dataTransfer,dropEvent:t})}}));if(!U.supportsDocumentFonts){l.AppOptions.set("disableFontFace",!0);U.l10n.get("web_fonts_disabled").then((function(t){console.warn(t)}))}if(!U.supportsPrinting){t.toolbar.print.classList.add("hidden");t.secondaryToolbar.printButton.classList.add("hidden")}if(!U.supportsFullscreen){t.toolbar.presentationModeButton.classList.add("hidden");t.secondaryToolbar.presentationModeButton.classList.add("hidden")}U.supportsIntegratedFind&&t.toolbar.viewFind.classList.add("hidden");t.mainContainer.addEventListener("transitionend",(function(t){t.target===this&&U.eventBus.dispatch("resize",{source:this})}),!0);try{!function webViewerOpenFileViaURL(t){t&&U.open(t)}(undefined)}catch(t){U.l10n.get("loading_error").then((function(r){U._documentError(r,t)}))}}function webViewerResetPermissions(){var t=U.appConfig;t&&t.viewerContainer.classList.remove(L)}function webViewerPageRendered(t){var r=t.pageNumber,a=t.timestamp,i=t.error;r===U.page&&U.toolbar.updateLoadingIndicatorState(!1);if(U.pdfSidebar.isThumbnailViewVisible){var o=U.pdfViewer.getPageView(r-1),l=U.pdfThumbnailViewer.getThumbnail(r-1);o&&l&&l.setImage(o)}i&&U.l10n.get("rendering_error").then((function(t){U._otherError(t,i)}));U.externalServices.reportTelemetry({type:"pageInfo",timestamp:a});U.pdfDocument.getStats().then((function(t){U.externalServices.reportTelemetry({type:"documentStats",stats:t})}))}function webViewerPageMode(t){var r,a=t.mode;switch(a){case"thumbs":r=o.SidebarView.THUMBS;break;case"bookmarks":case"outline":r=o.SidebarView.OUTLINE;break;case"attachments":r=o.SidebarView.ATTACHMENTS;break;case"layers":r=o.SidebarView.LAYERS;break;case"none":r=o.SidebarView.NONE;break;default:console.error('Invalid "pagemode" hash parameter: '+a);return}U.pdfSidebar.switchView(r,!0)}function webViewerNamedAction(t){switch(t.action){case"GoToPage":U.appConfig.toolbar.pageNumber.select();break;case"Find":U.supportsIntegratedFind||U.findBar.toggle();break;case"Print":U.triggerPrinting();break;case"SaveAs":webViewerSave()}}function webViewerPresentationModeChanged(t){U.pdfViewer.presentationModeState=t.state}function webViewerSidebarViewChanged(t){U.pdfRenderingQueue.isThumbnailViewEnabled=U.pdfSidebar.isThumbnailViewVisible;var r=U.store;r&&U.isInitialViewSet&&r.set("sidebarView",t.view).catch((function(){}))}function webViewerUpdateViewarea(t){var r=t.location,a=U.store;if(a&&U.isInitialViewSet){var i={};void 0===r.pageNumber&&null===r.pageNumber||(i.page=r.pageNumber);r.scale&&(i.zoom=r.scale);r.left&&(i.scrollLeft=r.left);r.top&&(i.scrollTop=r.top);void 0===r.rotation&&null===r.rotation||(i.rotation=r.rotation);a.setMultiple(i).catch((function(){}))}var o=U.pdfLinkService.getAnchorUrl(r.pdfOpenParams);U.appConfig.toolbar.viewBookmark.href=o;U.appConfig.secondaryToolbar.viewBookmarkButton.href=o;var l=U.pdfViewer.getPageView(U.page-1),u=(null==l?void 0:l.renderingState)!==d.RenderingStates.FINISHED;U.toolbar.updateLoadingIndicatorState(u)}function webViewerScrollModeChanged(t){var r=U.store;r&&U.isInitialViewSet&&r.set("scrollMode",t.mode).catch((function(){}))}function webViewerSpreadModeChanged(t){var r=U.store;r&&U.isInitialViewSet&&r.set("spreadMode",t.mode).catch((function(){}))}function webViewerResize(){var t=U.pdfDocument,r=U.pdfViewer;if(t){var a=r.currentScaleValue;"auto"!==a&&"page-fit"!==a&&"page-width"!==a||(r.currentScaleValue=a);r.update()}}function webViewerHashchange(t){var r=t.hash;r&&(U.isInitialViewSet?U.pdfHistory.popStateInProgress||U.pdfLinkService.setHash(r):U.initialBookmark=r)}q=function webViewerFileInputChange(t){var r;if(null===(r=U.pdfViewer)||void 0===r||!r.isInPresentationMode){var a=t.fileInput.files[0];if(O.viewerCompatibilityParams.disableCreateObjectURL){U.setTitleUsingUrl(a.name);var i=new FileReader;i.onload=function webViewerChangeFileReaderOnload(t){var r=t.target.result;U.open(new Uint8Array(r))};i.readAsArrayBuffer(a)}else{var o=URL.createObjectURL(a);a.name&&(o={url:o,originalUrl:a.name});U.open(o)}var l=U.appConfig;l.toolbar.viewBookmark.hidden=!0;l.secondaryToolbar.viewBookmarkButton.hidden=!0;l.toolbar.download.hidden=!0;l.secondaryToolbar.downloadButton.hidden=!0}};z=function webViewerOpenFile(t){var r=U.appConfig.openFileInputName;document.getElementById(r).click()};function webViewerPresentationMode(){U.requestPresentationMode()}function webViewerPrint(){U.triggerPrinting()}function webViewerDownload(){U.downloadOrSave({sourceEventType:"download"})}function webViewerSave(){U.downloadOrSave({sourceEventType:"save"})}function webViewerFirstPage(){U.pdfDocument&&(U.page=1)}function webViewerLastPage(){if(U.pdfDocument){U.page=U.pagesCount;"single"===U.pageViewMode&&U.pdfViewer&&U.pdfViewer.container&&(U.pdfViewer.container.scrollTop=0)}}function webViewerNextPage(){U.pdfViewer.nextPage();"single"===U.pageViewMode&&U.pdfViewer&&U.pdfViewer.container&&(U.pdfViewer.container.scrollTop=0)}function webViewerPreviousPage(){U.pdfViewer.previousPage()}function webViewerZoomIn(){U.zoomIn()}function webViewerZoomOut(){U.zoomOut()}function webViewerZoomReset(){U.zoomReset()}function webViewerPageNumberChanged(t){var r=U.pdfViewer;""!==t.value&&U.pdfLinkService.goToPage(t.value);t.value!==r.currentPageNumber.toString()&&t.value!==r.currentPageLabel&&U.toolbar.setPageNumber(r.currentPageNumber,r.currentPageLabel)}function webViewerScaleChanged(t){U.pdfViewer.currentScaleValue=t.value}function webViewerRotateCw(){U.rotatePages(90)}function webViewerRotateCcw(){U.rotatePages(-90)}function webViewerOptionalContentConfig(t){U.pdfViewer.optionalContentConfigPromise=t.promise}function webViewerSwitchScrollMode(t){U.pdfViewer.scrollMode=t.mode}function webViewerSwitchSpreadMode(t){U.pdfViewer.spreadMode=t.mode}function webViewerDocumentProperties(){U.pdfDocumentProperties.open()}function webViewerFind(t){U.findController.executeCommand("find"+t.type,{query:t.query,phraseSearch:t.phraseSearch,caseSensitive:t.caseSensitive,entireWord:t.entireWord,ignoreAccents:t.ignoreAccents,fuzzySearch:t.fuzzySearch,highlightAll:t.highlightAll,findPrevious:t.findPrevious})}function webViewerFindFromUrlHash(t){U.findController.executeCommand("find",{query:t.query,phraseSearch:t.phraseSearch,caseSensitive:!1,entireWord:!1,ignoreAccents:!1,fuzzySearch:!1,highlightAll:!0,findPrevious:!1})}function webViewerUpdateFindMatchesCount(t){var r=t.matchesCount;U.supportsIntegratedFind?U.externalServices.updateFindMatchesCount(r):U.findBar.updateResultsCount(r)}function webViewerUpdateFindControlState(t){var r=t.state,a=t.previous,i=t.matchesCount,o=t.rawQuery;U.supportsIntegratedFind?U.externalServices.updateFindControlState({result:r,findPrevious:a,matchesCount:i,rawQuery:o}):U.findBar.updateUIState(r,a,i)}function webViewerScaleChanging(t){U.toolbar.setPageScale(t.presetValue,t.scale);U.pdfViewer.update()}function webViewerRotationChanging(t){U.pdfThumbnailViewer.pagesRotation=t.pagesRotation;U.forceRendering();U.pdfViewer.currentPageNumber=t.pageNumber}function webViewerPageChanging(t){var r=t.pageNumber,a=t.pageLabel;U.toolbar.setPageNumber(r,a);U.secondaryToolbar.setPageNumber(r);U.pdfSidebar.isThumbnailViewVisible&&U.pdfThumbnailViewer.scrollThumbnailIntoView(r);var i=document.getElementById("pageNumber");if(i){var o=new CustomEvent("page-change");i.dispatchEvent(o)}}function webViewerVisibilityChange(t){"visible"===document.visibilityState&&setZoomDisabledTimeout()}var G=null;function setZoomDisabledTimeout(){G&&clearTimeout(G);G=setTimeout((function(){G=null}),1e3)}function webViewerWheel(t){var r=U.pdfViewer,a=U.supportedMouseWheelZoomModifierKeys;if(!r.isInPresentationMode){var i=(t.ctrlKey?1:0)|(t.altKey?2:0)|(t.shiftKey?4:0)|(t.metaKey?8:0);if(!window.isKeyIgnored||!window.isKeyIgnored(i,"WHEEL"))if(t.ctrlKey&&a.ctrlKey||t.metaKey&&a.metaKey){t.preventDefault();if(G||"hidden"===document.visibilityState)return;var l=r.currentScale,u=(0,o.normalizeWheelEventDirection)(t),c=0;if(t.deltaMode===WheelEvent.DOM_DELTA_LINE||t.deltaMode===WheelEvent.DOM_DELTA_PAGE)c=Math.abs(u)>=1?Math.sign(u):U.accumulateWheelTicks(u);else{c=U.accumulateWheelTicks(u/30)}c<0?U.zoomOut(-c):c>0&&U.zoomIn(c);var d=r.currentScale;if(l!==d){var h=d/l-1,p=r.container.getBoundingClientRect(),m=t.clientX-p.left,g=t.clientY-p.top;r.container.scrollLeft+=m*h;r.container.scrollTop+=g*h}}else setZoomDisabledTimeout()}}function webViewerClick(t){if(U.secondaryToolbar.isOpen){var r=U.appConfig;if(U.pdfViewer.containsElement(t.target)||r.toolbar.container.contains(t.target)&&t.target!==r.secondaryToolbar.toggleButton){if(t.target&&t.target.parentElement===r.secondaryToolbar.toggleButton)return;if(t.target&&t.target.parentElement&&t.target.parentElement.parentElement===r.secondaryToolbar.toggleButton)return;U.secondaryToolbar.close()}}}function webViewerKeyDown(t){if(!U.overlayManager.active){var r=!1,a=!1,i=(t.ctrlKey?1:0)|(t.altKey?2:0)|(t.shiftKey?4:0)|(t.metaKey?8:0),l=U.pdfViewer,u=null==l?void 0:l.isInPresentationMode;if(!window.isKeyIgnored||!window.isKeyIgnored(i,t.keyCode)){if(1===i||8===i||5===i||12===i)switch(t.keyCode){case 70:if(!U.supportsIntegratedFind&&!t.shiftKey){U.findBar.open();r=!0}break;case 71:if(!U.supportsIntegratedFind){var d=U.findController.state;d&&U.findController.executeCommand("findagain",{query:d.query,phraseSearch:d.phraseSearch,caseSensitive:d.caseSensitive,entireWord:d.entireWord,ignoreAccents:d.ignoreAccents,fuzzySearch:d.fuzzySearch,highlightAll:d.highlightAll,findPrevious:5===i||12===i});r=!0}break;case 61:case 107:case 187:case 171:u||U.zoomIn();r=!0;break;case 173:case 109:case 189:u||U.zoomOut();r=!0;break;case 48:case 96:if(!u){setTimeout((function(){U.zoomReset()}));r=!1}break;case 38:if(u||U.page>1){U.page=1;r=!0;a=!0}break;case 40:if(u||U.page<U.pagesCount){U.page=U.pagesCount;r=!0;a=!0}}var h=U.eventBus;if(1===i||8===i)switch(t.keyCode){case 83:h.dispatch("download",{source:window});r=!0;break;case 79:h.dispatch("openfile",{source:window});r=!0}if(3===i||10===i)switch(t.keyCode){case 80:U.requestPresentationMode();r=!0;break;case 71:U.appConfig.toolbar.pageNumber.select();r=!0}if(r){a&&!u&&l.focus();t.preventDefault()}else{var p=(0,o.getActiveOrFocusedElement)(),m=null==p?void 0:p.tagName.toUpperCase();if(!("INPUT"===m||"TEXTAREA"===m||"SELECT"===m||null!=p&&p.isContentEditable)||27===t.keyCode){if(0===i){var g=0,v=!1;switch(t.keyCode){case 38:case 33:l.isVerticalScrollbarEnabled&&(v=!0);g=-1;break;case 8:u||(v=!0);g=-1;break;case 37:l.isHorizontalScrollbarEnabled&&(v=!0);case 75:case 80:g=-1;break;case 27:if(U.secondaryToolbar.isOpen){U.secondaryToolbar.close();r=!0}if(!U.supportsIntegratedFind&&U.findBar.opened){U.findBar.close();r=!0}break;case 40:case 34:l.isVerticalScrollbarEnabled&&(v=!0);g=1;break;case 13:case 32:u||(v=!0);g=1;break;case 39:l.isHorizontalScrollbarEnabled&&(v=!0);case 74:case 78:g=1;break;case 36:if(u||U.page>1){U.page=1;r=!0;a=!0}break;case 35:if(u||U.page<U.pagesCount){U.page=U.pagesCount;r=!0;a=!0}break;case 83:U.pdfCursorTools.switchTool(c.CursorTool.SELECT);break;case 72:U.pdfCursorTools.switchTool(c.CursorTool.HAND);break;case 82:U.rotatePages(90);break;case 115:U.pdfSidebar.toggle()}if(0!==g&&(!v||"page-fit"===l.currentScaleValue)){g>0?l.nextPage():l.previousPage();r=!0}}if(4===i)switch(t.keyCode){case 13:case 32:if(!u&&"page-fit"!==l.currentScaleValue)break;U.page>1&&U.page--;r=!0;break;case 82:U.rotatePages(-90)}a&&!l.containsElement(p)&&l.focus();r&&t.preventDefault()}}}}}function beforeUnload(t){t.preventDefault();t.returnValue="";return!1}var Y={instance:{supportsPrinting:!1,createPrintService:function createPrintService(){throw new Error("Not implemented: createPrintService")}}};r.PDFPrintServiceFactory=Y},(t,r,a)=>{"use strict";t.exports=a(5)},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}var i=function(t){var r,a=Object.prototype,i=a.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},l=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function define(t,r,a){Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0});return t[r]}try{define({},"")}catch(t){define=function define(t,r,a){return t[r]=a}}function wrap(t,r,a,i){var o=r&&r.prototype instanceof Generator?r:Generator,l=Object.create(o.prototype),u=new Context(i||[]);l._invoke=function makeInvokeMethod(t,r,a){var i=d;return function invoke(o,l){if(i===p)throw new Error("Generator is already running");if(i===m){if("throw"===o)throw l;return doneResult()}a.method=o;a.arg=l;for(;;){var u=a.delegate;if(u){var c=maybeInvokeDelegate(u,a);if(c){if(c===g)continue;return c}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(i===d){i=m;throw a.arg}a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);i=p;var v=tryCatch(t,r,a);if("normal"===v.type){i=a.done?m:h;if(v.arg===g)continue;return{value:v.arg,done:a.done}}if("throw"===v.type){i=m;a.method="throw";a.arg=v.arg}}}}(t,a,u);return l}t.wrap=wrap;function tryCatch(t,r,a){try{return{type:"normal",arg:t.call(r,a)}}catch(t){return{type:"throw",arg:t}}}var d="suspendedStart",h="suspendedYield",p="executing",m="completed",g={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var v={};define(v,l,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(values([])));b&&b!==a&&i.call(b,l)&&(v=b);var S=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(v);GeneratorFunction.prototype=GeneratorFunctionPrototype;define(S,"constructor",GeneratorFunctionPrototype);define(GeneratorFunctionPrototype,"constructor",GeneratorFunction);GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction");function defineIteratorMethods(t){["next","throw","return"].forEach((function(r){define(t,r,(function(t){return this._invoke(r,t)}))}))}t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===GeneratorFunction||"GeneratorFunction"===(r.displayName||r.name))};t.mark=function(t){if(Object.setPrototypeOf)Object.setPrototypeOf(t,GeneratorFunctionPrototype);else{t.__proto__=GeneratorFunctionPrototype;define(t,c,"GeneratorFunction")}t.prototype=Object.create(S);return t};t.awrap=function(t){return{__await:t}};function AsyncIterator(t,r){function invoke(a,o,l,u){var c=tryCatch(t[a],t,o);if("throw"!==c.type){var d=c.arg,h=d.value;return h&&"object"===_typeof(h)&&i.call(h,"__await")?r.resolve(h.__await).then((function(t){invoke("next",t,l,u)}),(function(t){invoke("throw",t,l,u)})):r.resolve(h).then((function(t){d.value=t;l(d)}),(function(t){return invoke("throw",t,l,u)}))}u(c.arg)}var a;this._invoke=function enqueue(t,i){function callInvokeWithMethodAndArg(){return new r((function(r,a){invoke(t,i,r,a)}))}return a=a?a.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}defineIteratorMethods(AsyncIterator.prototype);define(AsyncIterator.prototype,u,(function(){return this}));t.AsyncIterator=AsyncIterator;t.async=function(r,a,i,o,l){void 0===l&&(l=Promise);var u=new AsyncIterator(wrap(r,a,i,o),l);return t.isGeneratorFunction(a)?u:u.next().then((function(t){return t.done?t.value:u.next()}))};function maybeInvokeDelegate(t,a){var i=t.iterator[a.method];if(i===r){a.delegate=null;if("throw"===a.method){if(t.iterator.return){a.method="return";a.arg=r;maybeInvokeDelegate(t,a);if("throw"===a.method)return g}a.method="throw";a.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=tryCatch(i,t.iterator,a.arg);if("throw"===o.type){a.method="throw";a.arg=o.arg;a.delegate=null;return g}var l=o.arg;if(!l){a.method="throw";a.arg=new TypeError("iterator result is not an object");a.delegate=null;return g}if(!l.done)return l;a[t.resultName]=l.value;a.next=t.nextLoc;if("return"!==a.method){a.method="next";a.arg=r}a.delegate=null;return g}defineIteratorMethods(S);define(S,c,"Generator");define(S,l,(function(){return this}));define(S,"toString",(function(){return"[object Generator]"}));function pushTryEntry(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]);if(2 in t){r.finallyLoc=t[2];r.afterLoc=t[3]}this.tryEntries.push(r)}function resetTryEntry(t){var r=t.completion||{};r.type="normal";delete r.arg;t.completion=r}function Context(t){this.tryEntries=[{tryLoc:"root"}];t.forEach(pushTryEntry,this);this.reset(!0)}t.keys=function(t){var r=[];for(var a in t)r.push(a);r.reverse();return function next(){for(;r.length;){var a=r.pop();if(a in t){next.value=a;next.done=!1;return next}}next.done=!0;return next}};function values(t){if(t){var a=t[l];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,u=function next(){for(;++o<t.length;)if(i.call(t,o)){next.value=t[o];next.done=!1;return next}next.value=r;next.done=!0;return next};return u.next=u}}return{next:doneResult}}t.values=values;function doneResult(){return{value:r,done:!0}}Context.prototype={constructor:Context,reset:function reset(t){this.prev=0;this.next=0;this.sent=this._sent=r;this.done=!1;this.delegate=null;this.method="next";this.arg=r;this.tryEntries.forEach(resetTryEntry);if(!t)for(var a in this)"t"===a.charAt(0)&&i.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=r)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var a=this;function handle(i,o){u.type="throw";u.arg=t;a.next=i;if(o){a.method="next";a.arg=r}return!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var l=this.tryEntries[o],u=l.completion;if("root"===l.tryLoc)return handle("end");if(l.tryLoc<=this.prev){var c=i.call(l,"catchLoc"),d=i.call(l,"finallyLoc");if(c&&d){if(this.prev<l.catchLoc)return handle(l.catchLoc,!0);if(this.prev<l.finallyLoc)return handle(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return handle(l.catchLoc,!0)}else{if(!d)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return handle(l.finallyLoc)}}}},abrupt:function abrupt(t,r){for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var l=o;break}}l&&("break"===t||"continue"===t)&&l.tryLoc<=r&&r<=l.finallyLoc&&(l=null);var u=l?l.completion:{};u.type=t;u.arg=r;if(l){this.method="next";this.next=l.finallyLoc;return g}return this.complete(u)},complete:function complete(t,r){if("throw"===t.type)throw t.arg;if("break"===t.type||"continue"===t.type)this.next=t.arg;else if("return"===t.type){this.rval=this.arg=t.arg;this.method="return";this.next="end"}else"normal"===t.type&&r&&(this.next=r);return g},finish:function finish(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.finallyLoc===t){this.complete(a.completion,a.afterLoc);resetTryEntry(a);return g}}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc===t){var i=a.completion;if("throw"===i.type){var o=i.arg;resetTryEntry(a)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,a,i){this.delegate={iterator:values(t),resultName:a,nextLoc:i};"next"===this.method&&(this.arg=r);return g}};return t}("object"===_typeof(t=a.nmd(t))?t.exports:{});try{regeneratorRuntime=i}catch(t){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.apiPageLayoutToSpreadMode=function apiPageLayoutToSpreadMode(t){switch(t){case"SinglePage":case"OneColumn":return o.NONE;case"TwoColumnLeft":case"TwoPageLeft":return o.ODD;case"TwoColumnRight":case"TwoPageRight":return o.EVEN}return o.NONE};r.apiPageModeToSidebarView=function apiPageModeToSidebarView(t){switch(t){case"UseNone":return a.NONE;case"UseThumbs":return a.THUMBS;case"UseOutlines":return a.OUTLINE;case"UseAttachments":return a.ATTACHMENTS;case"UseOC":return a.LAYERS}return a.NONE};r.approximateFraction=function approximateFraction(t){if(Math.floor(t)===t)return[t,1];var r=1/t;if(r>8)return[1,8];if(Math.floor(r)===r)return[1,r];var a,i=t>1?r:t,o=0,l=1,u=1,c=1;for(;;){var d=o+u,h=l+c;if(h>8)break;if(i<=d/h){u=d;c=h}else{o=d;l=h}}a=i-o/l<u/c-i?i===t?[o,l]:[l,o]:i===t?[u,c]:[c,u];return a};r.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements;r.binarySearchFirstItem=binarySearchFirstItem;r.getActiveOrFocusedElement=function getActiveOrFocusedElement(){var t=document,r=t.activeElement||t.querySelector(":focus");for(;null!==(a=r)&&void 0!==a&&a.shadowRoot;){var a;t=r.shadowRoot;r=t.activeElement||t.querySelector(":focus")}return r};r.getOutputScale=function getOutputScale(t){var r=window.devicePixelRatio||1,a=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.backingStorePixelRatio||1,i=r/a;return{sx:i,sy:i,scaled:1!==i}};r.getPageSizeInches=function getPageSizeInches(t){var r=t.view,a=t.userUnit,i=t.rotate,o=function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r,4),l=o[0],u=o[1],c=o[2],d=o[3],h=i%180!=0,p=(c-l)/72*a,m=(d-u)/72*a;return{width:h?m:p,height:h?p:m}};r.getVisibleElements=function getVisibleElements(t){var r=t.scrollEl,a=t.views,i=t.sortByVisibility,o=void 0!==i&&i,l=t.horizontal,u=void 0!==l&&l,c=t.rtl,d=void 0!==c&&c,h=r.scrollTop,p=h+r.clientHeight,m=r.scrollLeft,g=m+r.clientWidth;var v=[],y=a.length,b=binarySearchFirstItem(a,u?function isElementNextAfterViewHorizontally(t){var r=t.div,a=r.offsetLeft+r.clientLeft,i=a+r.clientWidth;return d?a<g:i>m}:function isElementBottomAfterViewTop(t){var r=t.div;return r.offsetTop+r.clientTop+r.clientHeight>h});b>0&&b<y&&!u&&(b=backtrackBeforeAllVisibleElements(b,a,h));for(var S=u?g:-1,w=b;w<y;w++){var C=a[w],P=C.div,k=P.offsetLeft+P.clientLeft,R=P.offsetTop+P.clientTop,A=P.clientWidth,x=P.clientHeight,T=k+A,E=R+x;if(-1===S)E>=p&&(S=E);else if((u?k:R)>S)break;if(!(E<=h||R>=p||T<=m||k>=g)){var I=Math.max(0,h-R)+Math.max(0,E-p),O=Math.max(0,m-k)+Math.max(0,T-g),D=(A-O)/A,L=(x-I)/x*D*100|0;v.push({id:C.id,x:k,y:R,view:C,percent:L,widthPercent:100*D|0})}}var M=v[0],B=v[v.length-1];o&&v.sort((function(t,r){var a=t.percent-r.percent;return Math.abs(a)>.001?-a:t.id-r.id}));return{first:M,last:B,views:v}};r.isPortraitOrientation=function isPortraitOrientation(t){return t.width<=t.height};r.isValidRotation=function isValidRotation(t){return Number.isInteger(t)&&t%90==0};r.isValidScrollMode=function isValidScrollMode(t){return Number.isInteger(t)&&Object.values(i).includes(t)&&t!==i.UNKNOWN};r.isValidSpreadMode=function isValidSpreadMode(t){return Number.isInteger(t)&&Object.values(o).includes(t)&&t!==o.UNKNOWN};r.moveToEndOfArray=function moveToEndOfArray(t,r){for(var a=[],i=t.length,o=0,l=0;l<i;++l)if(r(t[l]))a.push(t[l]);else{t[o]=t[l];++o}for(var u=0;o<i;++u,++o)t[o]=a[u]};r.noContextMenuHandler=function noContextMenuHandler(t){t.preventDefault()};r.normalizeWheelEventDelta=function normalizeWheelEventDelta(t){var r=normalizeWheelEventDirection(t);0===t.deltaMode?r/=900:1===t.deltaMode&&(r/=30);return r};r.normalizeWheelEventDirection=normalizeWheelEventDirection;r.parseQueryString=function parseQueryString(t){for(var r=t.split("&"),a=Object.create(null),i=0,o=r.length;i<o;++i){var l=r[i].split("="),u=l[0].toLowerCase(),c=l.length>1?l[1]:null;a[decodeURIComponent(u)]=decodeURIComponent(c)}return a};r.roundToDivide=function roundToDivide(t,r){var a=t%r;return 0===a?t:Math.round(t-a+r)};r.scrollIntoView=function scrollIntoView(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.classList.contains("stf__item")){console.log("don't scroll in book mode");return}var o=t.offsetParent;if(!o){console.error("offsetParent is not set -- cannot scroll");return}var l=t.offsetTop+t.clientTop,u=t.offsetLeft+t.clientLeft;for(;o.clientHeight===o.scrollHeight&&o.clientWidth===o.scrollWidth||a&&(o.classList.contains("markedContent")||"hidden"===getComputedStyle(o).overflow);){l+=o.offsetTop;u+=o.offsetLeft;if(!(o=o.offsetParent)){if(i&&document.body.clientHeight>l){l-=32;window.scrollTo(window.scrollX,l)}return}}if(r){void 0!==r.top&&(l+=r.top);if(void 0!==r.left){u+=r.left;o.scrollLeft=u}}o.scrollTop=l};r.waitOnEventOrTimeout=function waitOnEventOrTimeout(t){var r=t.target,a=t.name,i=t.delay,o=void 0===i?0:i;return new Promise((function(t,i){if("object"!==_typeof(r)||!a||"string"!=typeof a||!(Number.isInteger(o)&&o>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(i){r instanceof c?r._off(a,u):r.removeEventListener(a,u);h&&clearTimeout(h);t(i)}var u=handler.bind(null,l.EVENT);r instanceof c?r._on(a,u):r.addEventListener(a,u);var d=handler.bind(null,l.TIMEOUT),h=setTimeout(d,o)}))};r.watchScroll=function watchScroll(t,r){var a=function debounceScroll(a){o||(o=window.requestAnimationFrame((function viewAreaElementScrolled(){o=null;var a=t.scrollLeft,l=i.lastX;a!==l&&(i.right=a>l);i.lastX=a;var u=t.scrollTop,c=i.lastY;u!==c&&(i.down=u>c);i.lastY=u;r(i)})))},i={right:!0,down:!0,lastX:t.scrollLeft,lastY:t.scrollTop,_eventHandler:a},o=null;t.addEventListener("scroll",a,!0);return i};r.WaitOnType=r.VERTICAL_PADDING=r.UNKNOWN_SCALE=r.TextLayerMode=r.SpreadMode=r.SidebarView=r.ScrollMode=r.SCROLLBAR_PADDING=r.RendererType=r.ProgressBar=r.PresentationModeState=r.MIN_SCALE=r.MAX_SCALE=r.MAX_AUTO_SCALE=r.EventBus=r.DEFAULT_SCALE_VALUE=r.DEFAULT_SCALE=r.CSS_UNITS=r.AutoPrintRegExp=r.animationStarted=void 0;function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}r.CSS_UNITS=96/72;r.DEFAULT_SCALE_VALUE="auto";r.DEFAULT_SCALE=1;r.MIN_SCALE=.1;r.MAX_SCALE=10;r.UNKNOWN_SCALE=0;r.MAX_AUTO_SCALE=1.25;r.SCROLLBAR_PADDING=40;r.VERTICAL_PADDING=5;r.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};var a={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};r.SidebarView=a;r.RendererType={CANVAS:"canvas",SVG:"svg"};r.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_ENHANCE:2};var i={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2};r.ScrollMode=i;var o={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};r.SpreadMode=o;r.AutoPrintRegExp=/\bprint\s*\(/;function binarySearchFirstItem(t,r){var a=0,i=t.length-1;if(i<0||!r(t[i]))return t.length;if(r(t[a]))return a;for(;a<i;){var o=a+i>>1;r(t[o])?i=o:a=o+1}return a}function backtrackBeforeAllVisibleElements(t,r,a){if(t<2)return t;var i=r[t].div,o=i.offsetTop+i.clientTop;o>=a&&(o=(i=r[t-1].div).offsetTop+i.clientTop);for(var l=t-2;l>=0&&!((i=r[l].div).offsetTop+i.clientTop+i.clientHeight<=o);--l)t=l;return t}function normalizeWheelEventDirection(t){var r=Math.hypot(t.deltaX,t.deltaY),a=Math.atan2(t.deltaY,t.deltaX);-.25*Math.PI<a&&a<.75*Math.PI&&(r=-r);return r}var l={EVENT:"event",TIMEOUT:"timeout"};r.WaitOnType=l;var u=new Promise((function(t){window.requestAnimationFrame(t)}));r.animationStarted=u;var c=function(){function EventBus(t){_classCallCheck(this,EventBus);this._listeners=Object.create(null)}_createClass(EventBus,[{key:"on",value:function on(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._on(t,r,{external:!0,once:null==a?void 0:a.once})}},{key:"off",value:function off(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._off(t,r,{external:!0,once:null==a?void 0:a.once})}},{key:"dispatch",value:function dispatch(t){var r=this._listeners[t];if(r&&0!==r.length){var a,i,o=Array.prototype.slice.call(arguments,1),l=_createForOfIteratorHelper(r.slice(0));try{for(l.s();!(i=l.n()).done;){var u=i.value,c=u.listener,d=u.external,h=u.once;h&&this._off(t,c);d?(a||(a=[])).push(c):c.apply(null,o)}}catch(t){l.e(t)}finally{l.f()}if(a){var p,m=_createForOfIteratorHelper(a);try{for(m.s();!(p=m.n()).done;){var g=p.value;g.apply(null,o)}}catch(t){m.e(t)}finally{m.f()}a=null}}}},{key:"_on",value:function _on(t,r){var a,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=(a=this._listeners)[t]||(a[t]=[]);o.push({listener:r,external:!0===(null==i?void 0:i.external),once:!0===(null==i?void 0:i.once)})}},{key:"_off",value:function _off(t,r){var a=this._listeners[t];if(a)for(var i=0,o=a.length;i<o;i++)if(a[i].listener===r){a.splice(i,1);return}}}]);return EventBus}();r.EventBus=c;var d=function(){function ProgressBar(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.height,i=r.width,o=r.units;_classCallCheck(this,ProgressBar);this.visible=!0;this.div=document.querySelector(t+" .progress");this.div&&(this.bar=this.div.parentNode);this.height=a||100;this.width=i||100;this.units=o||"%";this.div&&(this.div.style.height=this.height+this.units);this.percent=0}_createClass(ProgressBar,[{key:"_updateBar",value:function _updateBar(){if(this._indeterminate){this.div.classList.add("indeterminate");this.div.style.width=this.width+this.units}else{this.div&&this.div.classList.remove("indeterminate");var t=this.width*this._percent/100;this.div&&(this.div.style.width=t+this.units)}}},{key:"percent",get:function get(){return this._percent},set:function set(t){this._indeterminate=isNaN(t);this._percent=function clamp(t,r,a){return Math.min(Math.max(t,r),a)}(t,0,100);this._updateBar()}},{key:"setWidth",value:function setWidth(t){if(t){var r=t.parentNode.offsetWidth-t.offsetWidth;if(r>0){document.documentElement.style.setProperty("--loadingBar-end-offset","".concat(r,"px"))}}}},{key:"hide",value:function hide(){if(this.visible){this.visible=!1;this.div=document.querySelector(".body #mainContainer .progress");if(this.div){this.bar=this.div.parentNode;this.bar.classList.add("hidden")}document.body.classList.remove("loadingInProgress")}}},{key:"show",value:function show(){if(!this.visible){this.visible=!0;this.bar.classList.remove("hidden")}}}]);return ProgressBar}();r.ProgressBar=d},t=>{"use strict";t.exports=window["pdfjs-dist/build/pdf"]},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFCursorTools=r.CursorTool=void 0;var i=a(9),o=a(6);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var l={SELECT:0,HAND:1,ZOOM:2};r.CursorTool=l;var u=function(){function PDFCursorTools(t){var r=this,a=t.container,o=t.eventBus,u=t.cursorToolOnLoad,c=void 0===u?l.SELECT:u;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFCursorTools);this.container=a;this.eventBus=o;this.active=l.SELECT;this.activeBeforePresentationMode=null;this.handTool=new i.GrabToPan({element:this.container});this._addEventListeners();Promise.resolve().then((function(){r.switchTool(c)}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFCursorTools,[{key:"activeTool",get:function get(){return this.active}},{key:"switchTool",value:function switchTool(t){var r=this;if(null===this.activeBeforePresentationMode&&t!==this.active){var a=function disableActiveTool(){switch(r.active){case l.SELECT:break;case l.HAND:r.handTool.deactivate()}};switch(t){case l.SELECT:a();break;case l.HAND:a();this.handTool.activate();break;default:console.error('switchTool: "'.concat(t,'" is an unsupported value.'));return}this.active=t;this._dispatchEvent()}}},{key:"_dispatchEvent",value:function _dispatchEvent(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}},{key:"_addEventListeners",value:function _addEventListeners(){var t=this;this.eventBus._on("switchcursortool",(function(r){t.switchTool(r.tool)}));this.eventBus._on("presentationmodechanged",(function(r){switch(r.state){case o.PresentationModeState.FULLSCREEN:var a=t.active;t.switchTool(l.SELECT);t.activeBeforePresentationMode=a;break;case o.PresentationModeState.NORMAL:var i=t.activeBeforePresentationMode;t.activeBeforePresentationMode=null;t.switchTool(i)}}))}}]);return PDFCursorTools}();r.PDFCursorTools=u},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.GrabToPan=GrabToPan;function GrabToPan(t){this.element=t.element;this.document=t.element.ownerDocument;"function"==typeof t.ignoreTarget&&(this.ignoreTarget=t.ignoreTarget);this.onActiveChanged=t.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._endPan=this._endPan.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}GrabToPan.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function GrabToPan_activate(){if(!this.active){this.active=!0;this.element.addEventListener("mousedown",this._onmousedown,!0);this.element.classList.add(this.CSS_CLASS_GRAB);this.onActiveChanged&&this.onActiveChanged(!0)}},deactivate:function GrabToPan_deactivate(){if(this.active){this.active=!1;this.element.removeEventListener("mousedown",this._onmousedown,!0);this._endPan();this.element.classList.remove(this.CSS_CLASS_GRAB);this.onActiveChanged&&this.onActiveChanged(!1)}},toggle:function GrabToPan_toggle(){this.active?this.deactivate():this.activate()},ignoreTarget:function GrabToPan_ignoreTarget(t){return!!document.querySelector(".stf__item")||t.matches("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function GrabToPan__onmousedown(t){if(0===t.button&&!this.ignoreTarget(t.target)){if(t.originalTarget)try{t.originalTarget.tagName}catch(t){return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=t.clientX;this.clientYStart=t.clientY;if(!isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x")&&!isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y")){this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);t.preventDefault();t.stopPropagation();var r=document.activeElement;r&&!r.contains(t.target)&&r.blur()}}},_onmousemove:function GrabToPan__onmousemove(t){this.element.removeEventListener("scroll",this._endPan,!0);if(function isLeftMouseReleased(t){if("buttons"in t)return!(1&t.buttons);var r=window.chrome,a=r&&(r.webstore||r.app),i=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);if(a||i)return 0===t.which;return!1}(t))this._endPan();else{var r=t.clientX-this.clientXStart,a=t.clientY-this.clientYStart,i=this.scrollTopStart-a,o=this.scrollLeftStart-r;if(this.element.scrollTo)this.element.scrollTo({top:i,left:o,behavior:"instant"});else{this.element.scrollTop=i;this.element.scrollLeft=o}this.overlay.parentNode||document.body.appendChild(this.overlay)}},_endPan:function GrabToPan__endPan(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.remove()}};function isOverPerfectScrollbar(t,r,a){var i=document.getElementsByClassName(a);if(i&&1===i.length){var o=i[0].getBoundingClientRect(),l=o.top,u=o.right,c=o.bottom,d=o.left;if(r>=l&&r<=c&&t<=u&&t>=d)return!0}return!1}},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.RenderingStates=r.PDFRenderingQueue=void 0;var i=a(7);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};r.RenderingStates=o;var l=function(){function PDFRenderingQueue(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFRenderingQueue);this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFRenderingQueue,[{key:"setViewer",value:function setViewer(t){this.pdfViewer=t}},{key:"setThumbnailViewer",value:function setThumbnailViewer(t){this.pdfThumbnailViewer=t}},{key:"isHighestPriority",value:function isHighestPriority(t){return this.highestPriorityPage===t.renderingId}},{key:"renderHighestPriority",value:function renderHighestPriority(t){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(t)||this.pdfThumbnailViewer&&this.isThumbnailViewEnabled&&this.pdfThumbnailViewer.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}},{key:"getHighestPriority",value:function getHighestPriority(t,r,a){var i=t.views,o=i.length;if(0===o)return null;for(var l=0;l<o;++l){var u=i[l].view;if(!this.isViewFinished(u))return u}if(a){var c=t.last.id;if(r[c]&&!this.isViewFinished(r[c]))return r[c]}else{var d=t.first.id-2;if(r[d]&&!this.isViewFinished(r[d]))return r[d]}return null}},{key:"isViewFinished",value:function isViewFinished(t){return t.renderingState===o.FINISHED}},{key:"renderView",value:function renderView(t){var r=this;switch(t.renderingState){case o.FINISHED:return!1;case o.PAUSED:this.highestPriorityPage=t.renderingId;t.resume();break;case o.RUNNING:this.highestPriorityPage=t.renderingId;break;case o.INITIAL:this.highestPriorityPage=t.renderingId;t.draw().finally((function(){r.renderHighestPriority()})).catch((function(t){t instanceof i.RenderingCancelledException||console.error('renderView: "'.concat(t,'"'))}))}return!0}}]);return PDFRenderingQueue}();r.PDFRenderingQueue=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.OverlayManager=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4));function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function OverlayManager(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,OverlayManager);this._overlays={};this._active=null;this._keyDownBound=this._keyDown.bind(this)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(OverlayManager,[{key:"active",get:function get(){return this._active}},{key:"register",value:(o=_asyncToGenerator(i.default.mark((function _callee(t,r){var a,o,l,u=arguments;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:a=u.length>2&&void 0!==u[2]?u[2]:null;o=u.length>3&&void 0!==u[3]&&u[3];if(t&&r&&(l=r.parentNode)){i.next=6;break}throw new Error("Not enough parameters.");case 6:if(!this._overlays[t]){i.next=8;break}throw new Error("The overlay is already registered.");case 8:this._overlays[t]={element:r,container:l,callerCloseMethod:a,canForceClose:o};case 9:case"end":return i.stop()}}),_callee,this)}))),function register(t,r){return o.apply(this,arguments)})},{key:"unregister",value:(a=_asyncToGenerator(i.default.mark((function _callee2(t){return i.default.wrap((function _callee2$(r){for(;;)switch(r.prev=r.next){case 0:if(this._overlays[t]){r.next=4;break}throw new Error("The overlay does not exist.");case 4:if(this._active!==t){r.next=6;break}throw new Error("The overlay cannot be removed while it is active.");case 6:delete this._overlays[t];case 7:case"end":return r.stop()}}),_callee2,this)}))),function unregister(t){return a.apply(this,arguments)})},{key:"open",value:(r=_asyncToGenerator(i.default.mark((function _callee3(t){return i.default.wrap((function _callee3$(r){for(;;)switch(r.prev=r.next){case 0:if(this._overlays[t]){r.next=4;break}throw new Error("The overlay does not exist.");case 4:if(!this._active){r.next=14;break}if(!this._overlays[t].canForceClose){r.next=9;break}this._closeThroughCaller();r.next=14;break;case 9:if(this._active!==t){r.next=13;break}throw new Error("The overlay is already active.");case 13:throw new Error("Another overlay is currently active.");case 14:this._active=t;this._overlays[this._active].element.classList.remove("hidden");this._overlays[this._active].container.classList.remove("hidden");window.addEventListener("keydown",this._keyDownBound);case 18:case"end":return r.stop()}}),_callee3,this)}))),function open(t){return r.apply(this,arguments)})},{key:"close",value:(t=_asyncToGenerator(i.default.mark((function _callee4(t){return i.default.wrap((function _callee4$(r){for(;;)switch(r.prev=r.next){case 0:if(this._overlays[t]){r.next=4;break}throw new Error("The overlay does not exist.");case 4:if(this._active){r.next=8;break}throw new Error("The overlay is currently not active.");case 8:if(this._active===t){r.next=10;break}throw new Error("Another overlay is currently active.");case 10:this._overlays[this._active].container.classList.add("hidden");this._overlays[this._active].element.classList.add("hidden");this._active=null;window.removeEventListener("keydown",this._keyDownBound);case 14:case"end":return r.stop()}}),_callee4,this)}))),function close(r){return t.apply(this,arguments)})},{key:"_keyDown",value:function _keyDown(t){if(this._active&&27===t.keyCode){this._closeThroughCaller();t.preventDefault()}}},{key:"_closeThroughCaller",value:function _closeThroughCaller(){this._overlays[this._active].callerCloseMethod&&this._overlays[this._active].callerCloseMethod();this._active&&this.close(this._active)}}]);var t,r,a,o;return OverlayManager}();r.OverlayManager=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PasswordPrompt=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(7);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var l=function(){function PasswordPrompt(t,r,a){var i=this,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];_classCallCheck(this,PasswordPrompt);this.overlayName=t.overlayName;this.container=t.container;this.label=t.label;this.input=t.input;this.submitButton=t.submitButton;this.cancelButton=t.cancelButton;this.overlayManager=r;this.l10n=a;this._isViewerEmbedded=o;this.updateCallback=null;this.reason=null;this.submitButton.addEventListener("click",this.verify.bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(function(t){13===t.keyCode&&i.verify()}));this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PasswordPrompt,[{key:"open",value:(t=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(i.default.mark((function _callee(){var t;return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:r.next=2;return this.overlayManager.open(this.overlayName);case 2:this.input.type="password";this.input.focus();t=this.reason===o.PasswordResponses.INCORRECT_PASSWORD;this._isViewerEmbedded&&!t||this.input.focus();r.next=8;return this.l10n.get("password_".concat(t?"invalid":"label"));case 8:this.label.textContent=r.sent;case 9:case"end":return r.stop()}}),_callee,this)}))),function open(){return t.apply(this,arguments)})},{key:"close",value:function close(){var t=this;this.overlayManager.close(this.overlayName).then((function(){t.input.type="";t.input.value=""}))}},{key:"verify",value:function verify(){var t=this.input.value;if((null==t?void 0:t.length)>0){this.close();this.updateCallback(t)}}},{key:"setUpdateCallback",value:function setUpdateCallback(t,r){this.updateCallback=t;this.reason=r}}]);var t;return PasswordPrompt}();r.PasswordPrompt=l},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFAttachmentViewer=void 0;var i=a(7);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var o=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}(PDFAttachmentViewer,t);var r=_createSuper(PDFAttachmentViewer);function PDFAttachmentViewer(t){var a;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFAttachmentViewer);(a=r.call(this,t)).downloadManager=t.downloadManager;a.eventBus._on("fileattachmentannotation",a._appendAttachment.bind(_assertThisInitialized(a)));return a}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFAttachmentViewer,[{key:"reset",value:function reset(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_get(_getPrototypeOf(PDFAttachmentViewer.prototype),"reset",this).call(this);this._attachments=null;t||(this._renderedCapability=(0,i.createPromiseCapability)());this._pendingDispatchEvent&&clearTimeout(this._pendingDispatchEvent);this._pendingDispatchEvent=null}},{key:"_dispatchEvent",value:function _dispatchEvent(t){var r=this;this._renderedCapability.resolve();if(this._pendingDispatchEvent){clearTimeout(this._pendingDispatchEvent);this._pendingDispatchEvent=null}0!==t?this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:t}):this._pendingDispatchEvent=setTimeout((function(){r.eventBus.dispatch("attachmentsloaded",{source:r,attachmentsCount:0});r._pendingDispatchEvent=null}))}},{key:"_bindLink",value:function _bindLink(t,r){var a=this,i=r.content,o=r.filename;t.onclick=function(){a.downloadManager.openOrDownloadData(t,i,o);return!1}}},{key:"render",value:function render(t){var r=t.attachments,a=t.keepRenderedCapability,o=void 0!==a&&a;this._attachments&&this.reset(o);this._attachments=r||null;if(r){var l,u=Object.keys(r).sort((function(t,r){return t.toLowerCase().localeCompare(r.toLowerCase())})),c=document.createDocumentFragment(),d=0,h=_createForOfIteratorHelper(u);try{for(h.s();!(l=h.n()).done;){var p=r[l.value],m=p.content,g=(0,i.getFilenameFromUrl)(p.filename),v=document.createElement("div");v.className="treeItem";var y=document.createElement("a");this._bindLink(y,{content:m,filename:g});y.textContent=this._normalizeTextContent(g);v.appendChild(y);c.appendChild(v);d++}}catch(t){h.e(t)}finally{h.f()}this._finishRendering(c,d)}else this._dispatchEvent(0)}},{key:"_appendAttachment",value:function _appendAttachment(t){var r=this,a=t.id,i=t.filename,o=t.content,l=this._renderedCapability.promise;l.then((function(){if(l===r._renderedCapability.promise){var t=r._attachments;if(t){for(var u in t)if(a===u)return}else t=Object.create(null);t[a]={filename:i,content:o};r.render({attachments:t,keepRenderedCapability:!0})}}))}}]);return PDFAttachmentViewer}(a(14).BaseTreeViewer);r.PDFAttachmentViewer=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.BaseTreeViewer=void 0;var i=a(7);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o="selected",l=function(){function BaseTreeViewer(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BaseTreeViewer);if(this.constructor===BaseTreeViewer)throw new Error("Cannot initialize BaseTreeViewer.");this.container=t.container;this.eventBus=t.eventBus;this.reset()}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(BaseTreeViewer,[{key:"reset",value:function reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}},{key:"_dispatchEvent",value:function _dispatchEvent(t){throw new Error("Not implemented: _dispatchEvent")}},{key:"_bindLink",value:function _bindLink(t,r){throw new Error("Not implemented: _bindLink")}},{key:"_normalizeTextContent",value:function _normalizeTextContent(t){return(0,i.removeNullCharacters)(t)||"–"}},{key:"_addToggleButton",value:function _addToggleButton(t){var r=this,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=document.createElement("div");i.className="treeItemToggler";a&&i.classList.add("treeItemsHidden");i.onclick=function(a){a.stopPropagation();i.classList.toggle("treeItemsHidden");if(a.shiftKey){var o=!i.classList.contains("treeItemsHidden");r._toggleTreeItem(t,o)}};t.insertBefore(i,t.firstChild)}},{key:"_toggleTreeItem",value:function _toggleTreeItem(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._lastToggleIsShow=r;var a,i=_createForOfIteratorHelper(t.querySelectorAll(".treeItemToggler"));try{for(i.s();!(a=i.n()).done;){var o=a.value;o.classList.toggle("treeItemsHidden",!r)}}catch(t){i.e(t)}finally{i.f()}}},{key:"_toggleAllTreeItems",value:function _toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}},{key:"_finishRendering",value:function _finishRendering(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(a){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!t.querySelector(".treeItemsHidden")}this.container.appendChild(t);this._dispatchEvent(r)}},{key:"render",value:function render(t){throw new Error("Not implemented: render")}},{key:"_updateCurrentTreeItem",value:function _updateCurrentTreeItem(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this._currentTreeItem){this._currentTreeItem.classList.remove(o);this._currentTreeItem=null}if(t){t.classList.add(o);this._currentTreeItem=t}}},{key:"_scrollToCurrentTreeItem",value:function _scrollToCurrentTreeItem(t){if(t){for(var r=t.parentNode;r&&r!==this.container;){if(r.classList.contains("treeItem")){var a=r.firstElementChild;null==a||a.classList.remove("treeItemsHidden")}r=r.parentNode}this._updateCurrentTreeItem(t);this.container.scrollTo(t.offsetLeft,t.offsetTop+-100)}}}]);return BaseTreeViewer}();r.BaseTreeViewer=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFDocumentProperties=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(7),l=a(6);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var u="-",c=["en-us","en-lr","my"],d={"8.5x11":"Letter","8.5x14":"Legal"},h={"297x420":"A3","210x297":"A4"};function getPageName(t,r,a){var i=r?t.width:t.height,o=r?t.height:t.width;return a["".concat(i,"x").concat(o)]}var p=function(){function PDFDocumentProperties(t,r,a,i){var o=this,l=t.overlayName,u=t.fields,d=t.container,h=t.closeButton;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFDocumentProperties);this.overlayName=l;this.fields=u;this.container=d;this.overlayManager=r;this.l10n=i;this._reset();h.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.overlayName,this.container,this.close.bind(this));a._on("pagechanging",(function(t){o._currentPageNumber=t.pageNumber}));a._on("rotationchanging",(function(t){o._pagesRotation=t.pagesRotation}));this._isNonMetricLocale=!0;i.getLanguage().then((function(t){o._isNonMetricLocale=c.includes(t)}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFDocumentProperties,[{key:"open",value:(p=_asyncToGenerator(i.default.mark((function _callee(){var t,r,a,u,c,d,h,p,m,g,v,y,b,S,w,C,P,k,R=this;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:t=function freezeFieldData(t){Object.defineProperty(R,"fieldData",{value:Object.freeze(t),writable:!1,enumerable:!0,configurable:!0})};i.next=3;return Promise.all([this.overlayManager.open(this.overlayName),this._dataAvailableCapability.promise]);case 3:r=this._currentPageNumber;a=this._pagesRotation;if(!this.fieldData||r!==this.fieldData._currentPageNumber||a!==this.fieldData._pagesRotation){i.next=8;break}this._updateUI();return i.abrupt("return");case 8:i.next=10;return this.pdfDocument.getMetadata();case 10:u=i.sent;c=u.info;d=u.contentDispositionFilename;h=u.contentLength;i.next=16;return Promise.all([d||(0,o.getPdfFilenameFromUrl)(this.url),this._parseFileSize(h),this._parseDate(c.CreationDate),this._parseDate(c.ModDate),this.pdfDocument.getPage(r).then((function(t){return R._parsePageSize((0,l.getPageSizeInches)(t),a)})),this._parseLinearization(c.IsLinearized)]);case 16:p=i.sent;m=_slicedToArray(p,6);g=m[0];v=m[1];y=m[2];b=m[3];S=m[4];w=m[5];t({fileName:g,fileSize:v,title:c.Title,author:c.Author,subject:c.Subject,keywords:c.Keywords,creationDate:y,modificationDate:b,creator:c.Creator,producer:c.Producer,version:c.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:S,linearized:w,_currentPageNumber:r,_pagesRotation:a});this._updateUI();i.next=28;return this.pdfDocument.getDownloadInfo();case 28:C=i.sent;P=C.length;if(h!==P){i.next=32;break}return i.abrupt("return");case 32:k=Object.assign(Object.create(null),this.fieldData);i.next=35;return this._parseFileSize(P);case 35:k.fileSize=i.sent;t(k);this._updateUI();case 38:case"end":return i.stop()}}),_callee,this)}))),function open(){return p.apply(this,arguments)})},{key:"close",value:function close(){this.overlayManager.close(this.overlayName)}},{key:"setDocument",value:function setDocument(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.pdfDocument){this._reset();this._updateUI(!0)}if(t){this.pdfDocument=t;this.url=r;this._dataAvailableCapability.resolve()}}},{key:"_reset",value:function _reset(){this.pdfDocument=null;this.url=null;delete this.fieldData;this._dataAvailableCapability=(0,o.createPromiseCapability)();this._currentPageNumber=1;this._pagesRotation=0}},{key:"_updateUI",value:function _updateUI(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t&&this.fieldData){if(this.overlayManager.active===this.overlayName)for(var r in this.fields){var a=this.fieldData[r];this.fields[r].textContent=a||0===a?a:u}}else for(var i in this.fields)this.fields[i].textContent=u}},{key:"_parseFileSize",value:(a=_asyncToGenerator(i.default.mark((function _callee2(){var t,r,a,o=arguments;return i.default.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:t=o.length>0&&void 0!==o[0]?o[0]:0;a=(r=t/1024)/1024;if(r){i.next=4;break}return i.abrupt("return",void 0);case 4:return i.abrupt("return",this.l10n.get("document_properties_".concat(a>=1?"mb":"kb"),{size_mb:a>=1&&(+a.toPrecision(3)).toLocaleString(),size_kb:a<1&&(+r.toPrecision(3)).toLocaleString(),size_b:t.toLocaleString()}));case 5:case"end":return i.stop()}}),_callee2,this)}))),function _parseFileSize(){return a.apply(this,arguments)})},{key:"_parsePageSize",value:(r=_asyncToGenerator(i.default.mark((function _callee3(t,r){var a,o,u,c,p,m,g,v,y,b,S,w,C,P;return i.default.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:if(t){i.next=2;break}return i.abrupt("return",void 0);case 2:r%180!=0&&(t={width:t.height,height:t.width});a=(0,l.isPortraitOrientation)(t);o={width:Math.round(100*t.width)/100,height:Math.round(100*t.height)/100};u={width:Math.round(25.4*t.width*10)/10,height:Math.round(25.4*t.height*10)/10};if(!((c=getPageName(o,a,d)||getPageName(u,a,h))||Number.isInteger(u.width)&&Number.isInteger(u.height))){p={width:25.4*t.width,height:25.4*t.height};m={width:Math.round(u.width),height:Math.round(u.height)};if(Math.abs(p.width-m.width)<.1&&Math.abs(p.height-m.height)<.1&&(c=getPageName(m,a,h))){o={width:Math.round(m.width/25.4*100)/100,height:Math.round(m.height/25.4*100)/100};u=m}}i.next=10;return Promise.all([this._isNonMetricLocale?o:u,this.l10n.get("document_properties_page_size_unit_".concat(this._isNonMetricLocale?"inches":"millimeters")),c&&this.l10n.get("document_properties_page_size_name_".concat(c.toLowerCase())),this.l10n.get("document_properties_page_size_orientation_".concat(a?"portrait":"landscape"))]);case 10:g=i.sent;v=_slicedToArray(g,4);y=v[0];b=y.width;S=y.height;w=v[1];C=v[2];P=v[3];return i.abrupt("return",this.l10n.get("document_properties_page_size_dimension_".concat(C?"name_":"","string"),{width:b.toLocaleString(),height:S.toLocaleString(),unit:w,name:C,orientation:P}));case 19:case"end":return i.stop()}}),_callee3,this)}))),function _parsePageSize(t,a){return r.apply(this,arguments)})},{key:"_parseDate",value:(t=_asyncToGenerator(i.default.mark((function _callee4(t){var r;return i.default.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:if(r=o.PDFDateString.toDateObject(t)){a.next=3;break}return a.abrupt("return",void 0);case 3:return a.abrupt("return",this.l10n.get("document_properties_date_string",{date:r.toLocaleDateString(),time:r.toLocaleTimeString()}));case 4:case"end":return a.stop()}}),_callee4,this)}))),function _parseDate(r){return t.apply(this,arguments)})},{key:"_parseLinearization",value:function _parseLinearization(t){return this.l10n.get("document_properties_linearized_".concat(t?"yes":"no"))}}]);var t,r,a,p;return PDFDocumentProperties}();r.PDFDocumentProperties=p},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFFindBar=void 0;var i=a(17);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function PDFFindBar(t,r,a){var i=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFFindBar);this.opened=!1;this.bar=t.bar;this.toggleButton=t.toggleButton;this.findField=t.findField;this.highlightAll=t.highlightAllCheckbox;this.caseSensitive=t.caseSensitiveCheckbox;this.entireWord=t.entireWordCheckbox;this.findMsg=t.findMsg;this.findResultsCount=t.findResultsCount;this.findPreviousButton=t.findPreviousButton;this.findNextButton=t.findNextButton;this.findFieldMultiline=t.findFieldMultiline||null;this.multipleSearchTexts=t.findMultipleSearchTextsCheckbox||null;this.ignoreAccents=t.ignoreAccentsCheckbox||null;this.fuzzySearch=t.fuzzyCheckbox||null;this.eventBus=r;this.l10n=a;this.toggleButton.addEventListener("click",(function(){i.toggle()}));this.findFieldMultiline.addEventListener("input",(function(){i.dispatchEvent("")}));this.findField.addEventListener("input",(function(){i.dispatchEvent("")}));this.bar.addEventListener("keydown",(function(t){switch(t.keyCode){case 13:t.target===i.findField&&i.dispatchEvent("again",t.shiftKey);break;case 27:i.close()}}));this.findPreviousButton.addEventListener("click",(function(){i.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(function(){i.dispatchEvent("again",!1)}));this.highlightAll.addEventListener("click",(function(){i.dispatchEvent("highlightallchange")}));this.caseSensitive.addEventListener("click",(function(){i.dispatchEvent("casesensitivitychange")}));this.entireWord.addEventListener("click",(function(){i.dispatchEvent("entirewordchange")}));this.multipleSearchTexts.addEventListener("click",(function(){i.dispatchEvent("multiplesearchtextschange")}));this.ignoreAccents.addEventListener("click",(function(){i.dispatchEvent("ignoreAccentsChange")}));this.fuzzySearch.addEventListener("click",(function(){i.dispatchEvent("fuzzySearchChange")}));this.eventBus._on("resize",this._adjustWidth.bind(this))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFFindBar,[{key:"reset",value:function reset(){this.updateUIState()}},{key:"dispatchEvent",value:function dispatchEvent(t,r){this.eventBus.dispatch("find",{source:this,type:t,query:this.findFieldMultiline.classList.contains("hidden")?this.findField.value:this.findFieldMultiline.value,phraseSearch:!this.multipleSearchTexts.checked,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,ignoreAccents:this.ignoreAccents.checked,fuzzySearch:this.fuzzySearch.checked,highlightAll:this.highlightAll.checked,findPrevious:r})}},{key:"updateUIState",value:function updateUIState(t,r,a){var o=this,l=Promise.resolve(""),u="";switch(t){case i.FindState.FOUND:break;case i.FindState.PENDING:u="pending";break;case i.FindState.NOT_FOUND:l=this.l10n.get("find_not_found");u="notFound";break;case i.FindState.WRAPPED:l=this.l10n.get("find_reached_".concat(r?"top":"bottom"))}this.findField.setAttribute("data-status",u);this.findFieldMultiline.classList.toggle("notFound","notFound"===u);this.findFieldMultiline.setAttribute("data-status",u);l.then((function(t){o.findMsg.textContent=t;o._adjustWidth()}));this.updateResultsCount(a)}},{key:"updateResultsCount",value:function updateResultsCount(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=r.current,i=void 0===a?0:a,o=r.total,l=void 0===o?0:o,u=1e3,c=Promise.resolve("");if(l>0)if(l>u){var d="find_match_count_limit";c=this.l10n.get(d,{limit:u})}else{var h="find_match_count";c=this.l10n.get(h,{current:i,total:l})}c.then((function(r){t.findResultsCount.textContent=r;t.findResultsCount.classList.toggle("hidden",!l);t._adjustWidth()}))}},{key:"open",value:function open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.bar.classList.remove("hidden")}this.findField.select();this.findField.focus();this.dispatchEvent("");this._adjustWidth()}},{key:"close",value:function close(){if(this.opened){this.opened=!1;this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false");this.bar.classList.add("hidden");this.eventBus.dispatch("findbarclose",{source:this})}}},{key:"toggle",value:function toggle(){this.opened?this.close():this.open()}},{key:"_adjustWidth",value:function _adjustWidth(){if(this.opened){this.bar.classList.remove("wrapContainers");this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers")}}}]);return PDFFindBar}();r.PDFFindBar=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFFindController=r.FindState=void 0;var i=a(7),o=a(18),l=a(19),u=a(20),c=a(6);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}var d={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};r.FindState=d;var h={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},p=null;function normalize(t){if(!p){var r=Object.keys(h).join("");p=new RegExp("[".concat(r,"]"),"g")}var a=null;return[t.replace(p,(function(t,r){var i=h[t],o=i.length-t.length;0!==o&&(a||(a=[])).push([r,o]);return i})),a]}function getOriginalIndex(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!r)return t;var a,i=0,o=_createForOfIteratorHelper(r);try{for(o.s();!(a=o.n()).done;){var l=_slicedToArray(a.value,2),u=l[0],c=l[1],d=u+i;if(d>=t)break;if(d+c>t){i+=t-d;break}i+=c}}catch(t){o.e(t)}finally{o.f()}return t-i}var m=function(){function PDFFindController(t){var r=t.linkService,a=t.eventBus,i=t.pageViewMode;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFFindController);this._linkService=r;this._eventBus=a;this._pageViewMode=i;this._reset();a._on("findbarclose",this._onFindBarClose.bind(this))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFFindController,[{key:"highlightMatches",get:function get(){return this._highlightMatches}},{key:"pageMatches",get:function get(){return this._pageMatches}},{key:"pageMatchesColor",get:function get(){return this._pageMatchesColor}},{key:"pageMatchesLength",get:function get(){return this._pageMatchesLength}},{key:"selected",get:function get(){return this._selected}},{key:"state",get:function get(){return this._state}},{key:"setDocument",value:function setDocument(t){this._pdfDocument&&this._reset();if(t){this._pdfDocument=t;this._firstPageCapability.resolve()}}},{key:"executeCommand",value:function executeCommand(t,r){var a=this;if(r){var i=this._pdfDocument;(null===this._state||this._shouldDirtyMatch(t,r))&&(this._dirtyMatch=!0);this._state=r;"findhighlightallchange"!==t&&this._updateUIState(d.PENDING);this._firstPageCapability.promise.then((function(){if(a._pdfDocument&&(!i||a._pdfDocument===i)){a._extractText();var r=!a._highlightMatches,o=!!a._findTimeout;if(a._findTimeout){clearTimeout(a._findTimeout);a._findTimeout=null}if("find"===t)a._findTimeout=setTimeout((function(){a._nextMatch();a._findTimeout=null}),250);else if(a._dirtyMatch)a._nextMatch();else if("findagain"===t){a._nextMatch();r&&a._state.highlightAll&&a._updateAllPages()}else if("findhighlightallchange"===t){o?a._nextMatch():a._highlightMatches=!0;a._updateAllPages()}else a._nextMatch()}}))}}},{key:"scrollMatchIntoView",value:function scrollMatchIntoView(t){var r=t.element,a=void 0===r?null:r,i=t.selectedLeft,o=void 0===i?0:i,l=t.pageIndex,u=void 0===l?-1:l,d=t.matchIndex,h=void 0===d?-1:d;if(this._scrollMatches&&a&&-1!==h&&h===this._selected.matchIdx&&-1!==u&&u===this._selected.pageIdx){this._scrollMatches=!1;var p={top:-50,left:o+-400};(0,c.scrollIntoView)(a,p,!0,"infinite-scroll"===this._pageViewMode)}}},{key:"_reset",value:function _reset(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];this._pageMatchesColor=[];this._state=null;this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._pageContents=[];this._pageDiffs=[];this._matchesCountTotal=0;this._pagesToSearch=null;this._pendingFindMatches=new Set;this._resumePageIdx=null;this._dirtyMatch=!1;clearTimeout(this._findTimeout);this._findTimeout=null;this._firstPageCapability=(0,i.createPromiseCapability)()}},{key:"_query",get:function get(){if(this._state.query!==this._rawQuery){this._rawQuery=this._state.query;var t=_slicedToArray(normalize(this._state.query),1);this._normalizedQuery=t[0]}return this._normalizedQuery}},{key:"_shouldDirtyMatch",value:function _shouldDirtyMatch(t,r){if(r.query!==this._state.query)return!0;switch(t){case"findagain":var a=this._selected.pageIdx+1,i=this._linkService;return a>=1&&a<=i.pagesCount&&a!==i.page&&!i.isPageVisible(a);case"findhighlightallchange":return!1}return!0}},{key:"_prepareMatches",value:function _prepareMatches(t,r,a,i){function isSubTerm(r){var a=t[r],i=t[r+1];if(r<t.length-1&&a.match===i.match){a.skipped=!0;return!0}for(var o=r-1;o>=0;o--){var l=t[o];if(!l.skipped){if(l.match+l.matchLength<a.match)break;if(l.match+l.matchLength>=a.match+a.matchLength){a.skipped=!0;return!0}}}return!1}t.sort((function(t,r){return t.match===r.match?t.matchLength-r.matchLength:t.match-r.match}));for(var o=0,l=t.length;o<l;o++)if(!isSubTerm(o)){r.push(t[o].match);a.push(t[o].matchLength);i.push(t[o].color)}}},{key:"_isEntireWord",value:function _isEntireWord(t,r,a){if(r>0){var i=t.charCodeAt(r),o=t.charCodeAt(r-1);if((0,l.getCharacterType)(i)===(0,l.getCharacterType)(o))return!1}var u=r+a-1;if(u<t.length-1){var c=t.charCodeAt(u),d=t.charCodeAt(u+1);if((0,l.getCharacterType)(c)===(0,l.getCharacterType)(d))return!1}return!0}},{key:"_calculateFuzzyMatch",value:function _calculateFuzzyMatch(t,r,a,i){for(var o=[],l=[],c=t.length,d=c<5?c:5,h=Math.round(c/5),p=t.substring(0,d),m={useCollator:!0},g=0;g<a.length-c;g++){var v=a.substring(g,g+d);if(u.Levenshtein.distance(p,v,m)<3){var y=a.substring(g,g+c),b=u.Levenshtein.distance(t,y,m);if(b<=h){if(g+1<a.length-c){var S=a.substring(g+1,g+1+c);if(b>=u.Levenshtein.distance(t,S,m))continue}var w=getOriginalIndex(g,i),C=getOriginalIndex(g+c-1,i)-w+1;o.push(w);l.push(C);g+=c-1}}}this._pageMatches[r]=o;this._pageMatchesLength[r]=l}},{key:"_calculatePhraseMatch",value:function _calculatePhraseMatch(t,r,a,i,l,u){if(u){a=(0,o.deburr)(a);t=(0,o.deburr)(t)}for(var c=[],d=[],h=t.length,p=-h;-1!==(p=a.indexOf(t,p+h));)if(!l||this._isEntireWord(a,p,h)){var m=getOriginalIndex(p,i),g=getOriginalIndex(p+h-1,i)-m+1;c.push(m);d.push(g)}this._pageMatches[r]=c;this._pageMatchesLength[r]=d}},{key:"_calculateWordMatch",value:function _calculateWordMatch(t,r,a,i,l,u){if(u){a=(0,o.deburr)(a);t=(0,o.deburr)(t)}for(var c=[],d=t.includes("\n")?t.trim().split(/\n+/g):t.trim().match(/\S+/g),h=0,p=d.length;h<p;h++){var m=d[h],g=m.length;if(0!==g)for(var v=-g;-1!==(v=a.indexOf(m,v+g));)if(!l||this._isEntireWord(a,v,g)){var y=getOriginalIndex(v,i),b=getOriginalIndex(v+g-1,i)-y+1;c.push({match:y,matchLength:b,skipped:!1,color:h})}}this._pageMatchesLength[r]=[];this._pageMatchesColor[r]=[];this._pageMatches[r]=[];this._prepareMatches(c,this._pageMatches[r],this._pageMatchesLength[r],this._pageMatchesColor[r])}},{key:"_calculateMatch",value:function _calculateMatch(t){var r=this._pageContents[t],a=this._pageDiffs[t],i=this._query,o=this._state,l=o.caseSensitive,u=o.entireWord,c=o.ignoreAccents,d=o.fuzzySearch,h=o.phraseSearch;if(0!==i.length){if(!l){r=r.toLowerCase();i=i.toLowerCase()}d?i.length<=2?this._calculatePhraseMatch(i,t,r,a,!1):this._calculateFuzzyMatch(i,t,r,a):h?this._calculatePhraseMatch(i,t,r,a,u,c):this._calculateWordMatch(i,t,r,a,u,c);this._state.highlightAll&&this._updatePage(t);if(this._resumePageIdx===t){this._resumePageIdx=null;this._nextPageMatch()}var p=this._pageMatches[t].length;if(p>0){this._matchesCountTotal+=p;this._updateUIResultsCount()}}}},{key:"_extractText",value:function _extractText(){var t=this;if(!(this._extractTextPromises.length>0))for(var r=Promise.resolve(),a=function _loop(a,o){var l=(0,i.createPromiseCapability)();t._extractTextPromises[a]=l.promise;r=r.then((function(){return t._pdfDocument.getPage(a+1).then((function(t){return t.getTextContent({normalizeWhitespace:!0})})).then((function(r){for(var i=r.items,o=[],u=0,c=i.length;u<c;u++)o.push(i[u].str);var d=_slicedToArray(normalize(o.join("")),2);t._pageContents[a]=d[0];t._pageDiffs[a]=d[1];l.resolve(a)}),(function(r){console.error("Unable to get text content for page ".concat(a+1),r);t._pageContents[a]="";t._pageDiffs[a]=null;l.resolve(a)}))}))},o=0,l=this._linkService.pagesCount;o<l;o++)a(o)}},{key:"_updatePage",value:function _updatePage(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1);this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})}},{key:"_updateAllPages",value:function _updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}},{key:"_nextMatch",value:function _nextMatch(){var t=this,r=this._state.findPrevious,a=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=a;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;this._pageMatchesColor.length=0;this._matchesCountTotal=0;this._updateAllPages();for(var o=0;o<i;o++)if(!this._pendingFindMatches.has(o)){this._pendingFindMatches.add(o);this._extractTextPromises[o].then((function(r){t._pendingFindMatches.delete(r);t._calculateMatch(r)}))}}if(""!==this._query){if(!this._resumePageIdx){var l=this._offset;this._pagesToSearch=i;if(null!==l.matchIdx){var u=this._pageMatches[l.pageIdx].length;if(!r&&l.matchIdx+1<u||r&&l.matchIdx>0){l.matchIdx=r?l.matchIdx-1:l.matchIdx+1;this._updateMatch(!0);return}this._advanceOffsetPage(r)}this._nextPageMatch()}}else this._updateUIState(d.FOUND)}},{key:"_matchesReady",value:function _matchesReady(t){var r=this._offset,a=t.length,i=this._state.findPrevious;if(a){r.matchIdx=i?a-1:0;this._updateMatch(!0);return!0}this._advanceOffsetPage(i);if(r.wrapped){r.matchIdx=null;if(this._pagesToSearch<0){this._updateMatch(!1);return!0}}return!1}},{key:"_nextPageMatch",value:function _nextPageMatch(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");var t=null;do{var r=this._offset.pageIdx;if(!(t=this._pageMatches[r])){this._resumePageIdx=r;break}}while(!this._matchesReady(t))}},{key:"_advanceOffsetPage",value:function _advanceOffsetPage(t){var r=this._offset,a=this._linkService.pagesCount;r.pageIdx=t?r.pageIdx-1:r.pageIdx+1;r.matchIdx=null;this._pagesToSearch--;if(r.pageIdx>=a||r.pageIdx<0){r.pageIdx=t?a-1:0;r.wrapped=!0}}},{key:"_updateMatch",value:function _updateMatch(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=d.NOT_FOUND,a=this._offset.wrapped;this._offset.wrapped=!1;if(t){var i=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;r=a?d.WRAPPED:d.FOUND;-1!==i&&i!==this._selected.pageIdx&&this._updatePage(i)}this._updateUIState(r,this._state.findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;this._updatePage(this._selected.pageIdx)}}},{key:"_onFindBarClose",value:function _onFindBarClose(t){var r=this,a=this._pdfDocument;this._firstPageCapability.promise.then((function(){if(r._pdfDocument&&(!a||r._pdfDocument===a)){if(r._findTimeout){clearTimeout(r._findTimeout);r._findTimeout=null}if(r._resumePageIdx){r._resumePageIdx=null;r._dirtyMatch=!0}r._updateUIState(d.FOUND);r._highlightMatches=!1;r._updateAllPages()}}))}},{key:"_requestMatchesCount",value:function _requestMatchesCount(){var t=this._selected,r=t.pageIdx,a=t.matchIdx,i=0,o=this._matchesCountTotal;if(-1!==a){for(var l=0;l<r;l++){var u;i+=(null===(u=this._pageMatches[l])||void 0===u?void 0:u.length)||0}i+=a+1}(i<1||i>o)&&(i=o=0);return{current:i,total:o}}},{key:"_updateUIResultsCount",value:function _updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}},{key:"_updateUIState",value:function _updateUIState(t,r){var a,i;this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:t,previous:r,matchesCount:this._requestMatchesCount(),rawQuery:null!==(a=null===(i=this._state)||void 0===i?void 0:i.query)&&void 0!==a?a:null})}}]);return PDFFindController}();r.PDFFindController=m},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.deburr=function deburr(t){return(t=function toString(t){return null==t?"":function baseToString(t){if("string"==typeof t)return t;if(function isSymbol(t){return"symbol"==_typeof(t)||function isObjectLike(t){return!!t&&"object"==_typeof(t)}(t)&&h.call(t)==a}(t))return g?g.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}(t)}(t))&&t.replace(i,d).replace(o,"")};function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}var a="[object Symbol]",i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,o=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),l="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,u="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,c=l||u||Function("return this")();var d=function basePropertyOf(t){return function(r){return null==t?void 0:t[r]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"}),h=Object.prototype.toString,p=c.Symbol,m=p?p.prototype:void 0,g=m?m.toString:void 0},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.getCharacterType=function getCharacterType(t){if(function isAlphabeticalScript(t){return t<11904}(t))return function isAscii(t){return 0==(65408&t)}(t)?function isAsciiSpace(t){return 32===t||9===t||13===t||10===t}(t)?a.SPACE:function isAsciiAlpha(t){return t>=97&&t<=122||t>=65&&t<=90}(t)||function isAsciiDigit(t){return t>=48&&t<=57}(t)||95===t?a.ALPHA_LETTER:a.PUNCT:function isThai(t){return 3584==(65408&t)}(t)?a.THAI_LETTER:160===t?a.SPACE:a.ALPHA_LETTER;if(function isHan(t){return t>=13312&&t<=40959||t>=63744&&t<=64255}(t))return a.HAN_LETTER;if(function isKatakana(t){return t>=12448&&t<=12543}(t))return a.KATAKANA_LETTER;if(function isHiragana(t){return t>=12352&&t<=12447}(t))return a.HIRAGANA_LETTER;if(function isHalfwidthKatakana(t){return t>=65376&&t<=65439}(t))return a.HALFWIDTH_KATAKANA_LETTER;return a.ALPHA_LETTER};r.CharacterType=void 0;var a={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};r.CharacterType=a},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Levenshtein=void 0;function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var a;try{a=Intl.Collator("und",{sensitivity:"base"})}catch(t){try{a=Intl.Collator("generic",{sensitivity:"base"})}catch(t){a=void 0}}var i=[],o=[],l=function(){function Levenshtein(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,Levenshtein)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(Levenshtein,null,[{key:"distance",value:function distance(t,r,l){var u,c,d,h,p,m,g=l&&a&&l.useCollator,v=t.length,y=r.length;if(0===v)return y;if(0===y)return v;for(d=0;d<y;++d){i[d]=d;o[d]=r.charCodeAt(d)}i[y]=y;if(g)for(d=0;d<v;++d){c=d+1;for(h=0;h<y;++h){u=c;m=0===a.compare(t.charAt(d),String.fromCharCode(o[h]));(c=i[h]+(m?0:1))>(p=u+1)&&(c=p);c>(p=i[h+1]+1)&&(c=p);i[h]=u}i[h]=c}else for(d=0;d<v;++d){c=d+1;for(h=0;h<y;++h){u=c;m=t.charCodeAt(d)===o[h];(c=i[h]+(m?0:1))>(p=u+1)&&(c=p);c>(p=i[h+1]+1)&&(c=p);i[h]=u}i[h]=c}return c}}]);return Levenshtein}();r.Levenshtein=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.isDestArraysEqual=isDestArraysEqual;r.isDestHashesEqual=isDestHashesEqual;r.PDFHistory=void 0;var i=a(6);function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function getCurrentHash(){return document.location.hash}var o=function(){function PDFHistory(t){var r=this,a=t.linkService,o=t.eventBus;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFHistory);this.linkService=a;this.eventBus=o;this._initialized=!1;this._fingerprint="";this.reset();this._boundEvents=null;this._isViewerInPresentationMode=!1;this.eventBus._on("presentationmodechanged",(function(t){r._isViewerInPresentationMode=t.state!==i.PresentationModeState.NORMAL}));this.eventBus._on("pagesinit",(function(){r._isPagesLoaded=!1;r.eventBus._on("pagesloaded",(function(t){r._isPagesLoaded=!!t.pagesCount}),{once:!0})}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFHistory,[{key:"initialize",value:function initialize(t){var r=t.fingerprint,a=t.resetHistory,i=void 0!==a&&a,o=t.updateUrl,l=void 0!==o&&o;if(r&&"string"==typeof r){this._initialized&&this.reset();var u=""!==this._fingerprint&&this._fingerprint!==r;this._fingerprint=r;this._updateUrl=!0===l;this._initialized=!0;this._bindEvents();var c=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(this._isValidState(c,!0)&&!i){var d=c.destination;this._updateInternalState(d,c.uid,!0);void 0!==d.rotation&&(this._initialRotation=d.rotation);if(d.dest){this._initialBookmark=JSON.stringify(d.dest);this._destination.page=null}else d.hash?this._initialBookmark=d.hash:d.page&&(this._initialBookmark="page=".concat(d.page))}else{var h=this._parseCurrentHash(!0),p=h.hash,m=h.page,g=h.rotation;if(!p||u||i){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:p,page:m,rotation:g},!0)}}else console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.')}},{key:"reset",value:function reset(){if(this._initialized){this._pageHide();this._initialized=!1;this._unbindEvents()}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}},{key:"push",value:function push(t){var r=this,a=t.namedDest,i=void 0===a?null:a,o=t.explicitDest,l=t.pageNumber;if(this._initialized)if(i&&"string"!=typeof i)console.error("PDFHistory.push: "+'"'.concat(i,'" is not a valid namedDest parameter.'));else if(Array.isArray(o))if(this._isValidPage(l)||null===l&&!this._destination){var u=i||JSON.stringify(o);if(u){var c=!1;if(this._destination&&(isDestHashesEqual(this._destination.hash,u)||isDestArraysEqual(this._destination.dest,o))){if(this._destination.page)return;c=!0}if(!this._popStateInProgress||c){this._pushOrReplaceState({dest:o,hash:u,page:l,rotation:this.linkService.rotation},c);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((function(){r._popStateInProgress=!1}))}}}}else console.error("PDFHistory.push: "+'"'.concat(l,'" is not a valid pageNumber parameter.'));else console.error("PDFHistory.push: "+'"'.concat(o,'" is not a valid explicitDest parameter.'))}},{key:"pushPage",value:function pushPage(t){var r,a=this;if(this._initialized)if(this._isValidPage(t)){if((null===(r=this._destination)||void 0===r?void 0:r.page)!==t&&!this._popStateInProgress){this._pushOrReplaceState({dest:null,hash:"page=".concat(t),page:t,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((function(){a._popStateInProgress=!1}))}}}else console.error('PDFHistory.pushPage: "'.concat(t,'" is not a valid page number.'))}},{key:"pushCurrentPosition",value:function pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}},{key:"back",value:function back(){if(this._initialized&&!this._popStateInProgress){var t=window.history.state;this._isValidState(t)&&t.uid>0&&window.history.back()}}},{key:"forward",value:function forward(){if(this._initialized&&!this._popStateInProgress){var t=window.history.state;this._isValidState(t)&&t.uid<this._maxUid&&window.history.forward()}}},{key:"popStateInProgress",get:function get(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}},{key:"initialBookmark",get:function get(){return this._initialized?this._initialBookmark:null}},{key:"initialRotation",get:function get(){return this._initialized?this._initialRotation:null}},{key:"_pushOrReplaceState",value:function _pushOrReplaceState(t){var r,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=a||!this._destination,o={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};this._updateInternalState(t,o.uid);if(this._updateUrl&&null!=t&&t.hash){var l=document.location.href.split("#")[0];l.startsWith("file://")||(r="".concat(l,"#").concat(t.hash))}i?window.history.replaceState(o,"",r):window.history.pushState(o,"",r)}},{key:"_tryPushCurrentPosition",value:function _tryPushCurrentPosition(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._position){var r=this._position;t&&((r=Object.assign(Object.create(null),this._position)).temporary=!0);if(this._destination){if(this._destination.temporary)this._pushOrReplaceState(r,!0);else if(this._destination.hash!==r.hash&&(this._destination.page||!(this._numPositionUpdates<=50))){var a=!1;if(this._destination.page>=r.first&&this._destination.page<=r.page){if(void 0!==this._destination.dest||!this._destination.first)return;a=!0}this._pushOrReplaceState(r,a)}}else this._pushOrReplaceState(r)}}},{key:"_isValidPage",value:function _isValidPage(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount}},{key:"_isValidState",value:function _isValidState(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return!1;if(t.fingerprint!==this._fingerprint){if(!r)return!1;if("string"!=typeof t.fingerprint||t.fingerprint.length!==this._fingerprint.length)return!1;var a=performance.getEntriesByType("navigation"),i=_slicedToArray(a,1),o=i[0];if("reload"!==(null==o?void 0:o.type))return!1}return!(!Number.isInteger(t.uid)||t.uid<0)&&(null!==t.destination&&"object"===_typeof(t.destination))}},{key:"_updateInternalState",value:function _updateInternalState(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}a&&null!=t&&t.temporary&&delete t.temporary;this._destination=t;this._uid=r;this._maxUid=Math.max(this._maxUid,r);this._numPositionUpdates=0}},{key:"_parseCurrentHash",value:function _parseCurrentHash(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=unescape(getCurrentHash()).substring(1),a=(0,i.parseQueryString)(r),o=a.nameddest||"",l=0|a.page;(!this._isValidPage(l)||t&&o.length>0)&&(l=null);return{hash:r,page:l,rotation:this.linkService.rotation}}},{key:"_updateViewarea",value:function _updateViewarea(t){var r=this,a=t.location;if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:this._isViewerInPresentationMode?"page=".concat(a.pageNumber):a.pdfOpenParams.substring(1),page:this.linkService.page,first:a.pageNumber,rotation:a.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((function(){r._popStateInProgress||r._tryPushCurrentPosition(!0);r._updateViewareaTimeout=null}),1e3)}}},{key:"_popState",value:function _popState(t){var r=this,a=t.state,o=getCurrentHash(),l=this._currentHash!==o;this._currentHash=o;if(a){if(this._isValidState(a)){this._popStateInProgress=!0;if(l){this._blockHashChange++;(0,i.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((function(){r._blockHashChange--}))}var u=a.destination;this._updateInternalState(u,a.uid,!0);(0,i.isValidRotation)(u.rotation)&&(this.linkService.rotation=u.rotation);u.dest?this.linkService.goToDestination(u.dest):u.hash?this.linkService.setHash(u.hash):u.page&&(this.linkService.page=u.page);Promise.resolve().then((function(){r._popStateInProgress=!1}))}}else{this._uid++;var c=this._parseCurrentHash(),d=c.hash,h=c.page,p=c.rotation;this._pushOrReplaceState({hash:d,page:h,rotation:p},!0)}}},{key:"_pageHide",value:function _pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}},{key:"_bindEvents",value:function _bindEvents(){if(!this._boundEvents){this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)};this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea);window.addEventListener("popstate",this._boundEvents.popState);window.addEventListener("pagehide",this._boundEvents.pageHide)}}},{key:"_unbindEvents",value:function _unbindEvents(){if(this._boundEvents){this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea);window.removeEventListener("popstate",this._boundEvents.popState);window.removeEventListener("pagehide",this._boundEvents.pageHide);this._boundEvents=null}}}]);return PDFHistory}();r.PDFHistory=o;function isDestHashesEqual(t,r){return"string"==typeof t&&"string"==typeof r&&(t===r||(0,i.parseQueryString)(t).nameddest===r)}function isDestArraysEqual(t,r){function isEntryEqual(t,r){if(_typeof(t)!==_typeof(r))return!1;if(Array.isArray(t)||Array.isArray(r))return!1;if(null!==t&&"object"===_typeof(t)&&null!==r){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(var a in t)if(!isEntryEqual(t[a],r[a]))return!1;return!0}return t===r||Number.isNaN(t)&&Number.isNaN(r)}if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;for(var a=0,i=t.length;a<i;a++)if(!isEntryEqual(t[a],r[a]))return!1;return!0}},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFLayerViewer=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4));function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var o=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}(PDFLayerViewer,t);var r,a,o=_createSuper(PDFLayerViewer);function PDFLayerViewer(t){var r;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFLayerViewer);(r=o.call(this,t)).l10n=t.l10n;r.eventBus._on("resetlayers",r._resetLayers.bind(_assertThisInitialized(r)));r.eventBus._on("togglelayerstree",r._toggleAllTreeItems.bind(_assertThisInitialized(r)));return r}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFLayerViewer,[{key:"reset",value:function reset(){_get(_getPrototypeOf(PDFLayerViewer.prototype),"reset",this).call(this);this._optionalContentConfig=null}},{key:"_dispatchEvent",value:function _dispatchEvent(t){this.eventBus.dispatch("layersloaded",{source:this,layersCount:t})}},{key:"_bindLink",value:function _bindLink(t,r){var a=this,i=r.groupId,o=r.input,l=function setVisibility(){a._optionalContentConfig.setVisibility(i,o.checked);a.eventBus.dispatch("optionalcontentconfig",{source:a,promise:Promise.resolve(a._optionalContentConfig)})};t.onclick=function(r){if(r.target===o){l();return!0}if(r.target!==t)return!0;o.checked=!o.checked;l();return!1}}},{key:"_setNestedName",value:(a=_asyncToGenerator(i.default.mark((function _callee(t,r){var a,o;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:a=r.name;if("string"!=typeof(o=void 0===a?null:a)){i.next=4;break}t.textContent=this._normalizeTextContent(o);return i.abrupt("return");case 4:i.next=6;return this.l10n.get("additional_layers");case 6:t.textContent=i.sent;t.style.fontStyle="italic";case 8:case"end":return i.stop()}}),_callee,this)}))),function _setNestedName(t,r){return a.apply(this,arguments)})},{key:"_addToggleButton",value:function _addToggleButton(t,r){var a=r.name,i=void 0===a?null:a;_get(_getPrototypeOf(PDFLayerViewer.prototype),"_addToggleButton",this).call(this,t,null===i)}},{key:"_toggleAllTreeItems",value:function _toggleAllTreeItems(){this._optionalContentConfig&&_get(_getPrototypeOf(PDFLayerViewer.prototype),"_toggleAllTreeItems",this).call(this)}},{key:"render",value:function render(t){var r=t.optionalContentConfig,a=t.pdfDocument;this._optionalContentConfig&&this.reset();this._optionalContentConfig=r||null;this._pdfDocument=a||null;var i=null==r?void 0:r.getOrder();if(i){for(var o=document.createDocumentFragment(),l=[{parent:o,groups:i}],u=0,c=!1;l.length>0;){var d,h=l.shift(),p=_createForOfIteratorHelper(h.groups);try{for(p.s();!(d=p.n()).done;){var m=d.value,g=document.createElement("div");g.className="treeItem";var v=document.createElement("a");g.appendChild(v);if("object"===_typeof(m)){c=!0;this._addToggleButton(g,m);this._setNestedName(v,m);var y=document.createElement("div");y.className="treeItems";g.appendChild(y);l.push({parent:y,groups:m.order})}else{var b=r.getGroup(m),S=document.createElement("input");this._bindLink(v,{groupId:m,input:S});S.type="checkbox";S.id=m;S.checked=b.visible;var w=document.createElement("label");w.setAttribute("for",m);w.textContent=this._normalizeTextContent(b.name);v.appendChild(S);v.appendChild(w);u++}h.parent.appendChild(g)}}catch(t){p.e(t)}finally{p.f()}}this._finishRendering(o,u,c)}else this._dispatchEvent(0)}},{key:"_resetLayers",value:(r=_asyncToGenerator(i.default.mark((function _callee2(){var t;return i.default.wrap((function _callee2$(r){for(;;)switch(r.prev=r.next){case 0:if(this._optionalContentConfig){r.next=2;break}return r.abrupt("return");case 2:r.next=4;return this._pdfDocument.getOptionalContentConfig();case 4:t=r.sent;this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(t)});this.render({optionalContentConfig:t,pdfDocument:this._pdfDocument});case 7:case"end":return r.stop()}}),_callee2,this)}))),function _resetLayers(){return r.apply(this,arguments)})}]);return PDFLayerViewer}(a(14).BaseTreeViewer);r.PDFLayerViewer=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.SimpleLinkService=r.PDFLinkService=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(6);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var l=function(){function PDFLinkService(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.eventBus,a=t.externalLinkTarget,i=void 0===a?null:a,o=t.externalLinkRel,l=void 0===o?null:o,u=t.ignoreDestinationZoom,c=void 0!==u&&u;_classCallCheck(this,PDFLinkService);this.eventBus=r;this.externalLinkTarget=i;this.externalLinkRel=l;this.externalLinkEnabled=!0;this._ignoreDestinationZoom=c;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null;this._pagesRefCache=null}_createClass(PDFLinkService,[{key:"setDocument",value:function setDocument(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.baseUrl=r;this.pdfDocument=t;this._pagesRefCache=Object.create(null)}},{key:"setViewer",value:function setViewer(t){this.pdfViewer=t}},{key:"setHistory",value:function setHistory(t){this.pdfHistory=t}},{key:"pagesCount",get:function get(){return this.pdfDocument?this.pdfDocument.numPages:0}},{key:"page",get:function get(){return this.pdfViewer.currentPageNumber},set:function set(t){this.pdfViewer.currentPageNumber=t}},{key:"rotation",get:function get(){return this.pdfViewer.pagesRotation},set:function set(t){this.pdfViewer.pagesRotation=t}},{key:"_goToDestinationHelper",value:function _goToDestinationHelper(t){var r,a=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2?arguments[2]:void 0,l=o[0];if("object"===_typeof(l)&&null!==l){if(null===(r=this._cachedPageNumber(l))){this.pdfDocument.getPageIndex(l).then((function(r){a.cachePageRef(r+1,l);a._goToDestinationHelper(t,i,o)})).catch((function(){console.error('PDFLinkService._goToDestinationHelper: "'.concat(l,'" is not ')+'a valid page reference, for dest="'.concat(t,'".'))}));return}}else{if(!Number.isInteger(l)){console.error('PDFLinkService._goToDestinationHelper: "'.concat(l,'" is not ')+'a valid destination reference, for dest="'.concat(t,'".'));return}r=l+1}if(!r||r<1||r>this.pagesCount)console.error('PDFLinkService._goToDestinationHelper: "'.concat(r,'" is not ')+'a valid page number, for dest="'.concat(t,'".'));else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:i,explicitDest:o,pageNumber:r})}this.pdfViewer.scrollPageIntoView({pageNumber:r,destArray:o,ignoreDestinationZoom:this._ignoreDestinationZoom})}}},{key:"goToDestination",value:(t=_asyncToGenerator(i.default.mark((function _callee(t){var r,a;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this.pdfDocument){i.next=2;break}return i.abrupt("return");case 2:if("string"!=typeof t){i.next=9;break}r=t;i.next=6;return this.pdfDocument.getDestination(t);case 6:a=i.sent;i.next=13;break;case 9:r=null;i.next=12;return t;case 12:a=i.sent;case 13:if(Array.isArray(a)){i.next=16;break}console.error('PDFLinkService.goToDestination: "'.concat(a,'" is not ')+'a valid destination array, for dest="'.concat(t,'".'));return i.abrupt("return");case 16:this._goToDestinationHelper(t,r,a);case 17:case"end":return i.stop()}}),_callee,this)}))),function goToDestination(r){return t.apply(this,arguments)})},{key:"goToPage",value:function goToPage(t){if(this.pdfDocument){var r="string"==typeof t&&this.pdfViewer.pageLabelToPageNumber(t)||0|t;if(Number.isInteger(r)&&r>0&&r<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(r)}this.pdfViewer.scrollPageIntoView({pageNumber:r})}else console.error('PDFLinkService.goToPage: "'.concat(t,'" is not a valid page.'))}}},{key:"getDestinationHash",value:function getDestinationHash(t){if("string"==typeof t){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){var r=JSON.stringify(t);if(r.length>0)return this.getAnchorUrl("#"+escape(r))}return this.getAnchorUrl("")}},{key:"getAnchorUrl",value:function getAnchorUrl(t){return(this.baseUrl||"")+t}},{key:"setHash",value:function setHash(t){if(this.pdfDocument){var r,a;if(t.includes("=")){var i=(0,o.parseQueryString)(t);"search"in i&&this.eventBus.dispatch("findfromurlhash",{source:this,query:i.search.replace(/"/g,""),phraseSearch:"true"===i.phrase});"page"in i&&(r=0|i.page||1);if("zoom"in i){var l=i.zoom.split(","),u=l[0],c=parseFloat(u);u.includes("Fit")?"Fit"===u||"FitB"===u?a=[null,{name:u}]:"FitH"===u||"FitBH"===u||"FitV"===u||"FitBV"===u?a=[null,{name:u},l.length>1?0|l[1]:null]:"FitR"===u?5!==l.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):a=[null,{name:u},0|l[1],0|l[2],0|l[3],0|l[4]]:console.error('PDFLinkService.setHash: "'.concat(u,'" is not ')+"a valid zoom value."):a=[null,{name:"XYZ"},l.length>1?0|l[1]:null,l.length>2?0|l[2]:null,c?c/100:u]}a?this.pdfViewer.scrollPageIntoView({pageNumber:r||this.page,destArray:a,allowNegativeOffset:!0}):r&&(this.page=r);"pagemode"in i&&this.eventBus.dispatch("pagemode",{source:this,mode:i.pagemode});"nameddest"in i&&this.goToDestination(i.nameddest)}else{a=unescape(t);try{a=JSON.parse(a);Array.isArray(a)||(a=a.toString())}catch(t){}if("string"==typeof a||function isValidExplicitDestination(t){if(!Array.isArray(t))return!1;var r=t.length;if(r<2)return!1;var a=t[0];if(!("object"===_typeof(a)&&Number.isInteger(a.num)&&Number.isInteger(a.gen)||Number.isInteger(a)&&a>=0))return!1;var i=t[1];if("object"!==_typeof(i)||"string"!=typeof i.name)return!1;var o=!0;switch(i.name){case"XYZ":if(5!==r)return!1;break;case"Fit":case"FitB":return 2===r;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==r)return!1;break;case"FitR":if(6!==r)return!1;o=!1;break;default:return!1}for(var l=2;l<r;l++){var u=t[l];if(!("number"==typeof u||o&&null===u))return!1}return!0}(a)){this.goToDestination(a);return}console.error('PDFLinkService.setHash: "'.concat(unescape(t),'" is not ')+"a valid destination.")}}}},{key:"executeNamedAction",value:function executeNamedAction(t){switch(t){case"GoBack":this.pdfHistory&&this.pdfHistory.back();break;case"GoForward":this.pdfHistory&&this.pdfHistory.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:t})}},{key:"cachePageRef",value:function cachePageRef(t,r){if(r){var a=0===r.gen?"".concat(r.num,"R"):"".concat(r.num,"R").concat(r.gen);this._pagesRefCache[a]=t}}},{key:"_cachedPageNumber",value:function _cachedPageNumber(t){var r,a=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return(null===(r=this._pagesRefCache)||void 0===r?void 0:r[a])||null}},{key:"isPageVisible",value:function isPageVisible(t){return this.pdfViewer.isPageVisible(t)}},{key:"isPageCached",value:function isPageCached(t){return this.pdfViewer.isPageCached(t)}}]);var t;return PDFLinkService}();r.PDFLinkService=l;var u=function(){function SimpleLinkService(){_classCallCheck(this,SimpleLinkService);this.externalLinkTarget=null;this.externalLinkRel=null;this.externalLinkEnabled=!0;this._ignoreDestinationZoom=!1}_createClass(SimpleLinkService,[{key:"pagesCount",get:function get(){return 0}},{key:"page",get:function get(){return 0},set:function set(t){}},{key:"rotation",get:function get(){return 0},set:function set(t){}},{key:"goToDestination",value:(t=_asyncToGenerator(i.default.mark((function _callee2(t){return i.default.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),_callee2)}))),function goToDestination(r){return t.apply(this,arguments)})},{key:"goToPage",value:function goToPage(t){}},{key:"getDestinationHash",value:function getDestinationHash(t){return"#"}},{key:"getAnchorUrl",value:function getAnchorUrl(t){return"#"}},{key:"setHash",value:function setHash(t){}},{key:"executeNamedAction",value:function executeNamedAction(t){}},{key:"cachePageRef",value:function cachePageRef(t,r){}},{key:"isPageVisible",value:function isPageVisible(t){return!0}},{key:"isPageCached",value:function isPageCached(t){return!0}}]);var t;return SimpleLinkService}();r.SimpleLinkService=u},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFOutlineViewer=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(7),l=a(14),u=a(6);function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var c=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}(PDFOutlineViewer,t);var r,a,l=_createSuper(PDFOutlineViewer);function PDFOutlineViewer(t){var r;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFOutlineViewer);(r=l.call(this,t)).linkService=t.linkService;r.eventBus._on("toggleoutlinetree",r._toggleAllTreeItems.bind(_assertThisInitialized(r)));r.eventBus._on("currentoutlineitem",r._currentOutlineItem.bind(_assertThisInitialized(r)));r.eventBus._on("pagechanging",(function(t){r._currentPageNumber=t.pageNumber}));r.eventBus._on("pagesloaded",(function(t){r._isPagesLoaded=!!t.pagesCount;r._currentOutlineItemCapability&&!r._currentOutlineItemCapability.settled&&r._currentOutlineItemCapability.resolve(r._isPagesLoaded)}));r.eventBus._on("sidebarviewchanged",(function(t){r._sidebarView=t.view}));return r}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFOutlineViewer,[{key:"reset",value:function reset(){_get(_getPrototypeOf(PDFOutlineViewer.prototype),"reset",this).call(this);this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=!1;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(!1);this._currentOutlineItemCapability=null}},{key:"_dispatchEvent",value:function _dispatchEvent(t){var r;this._currentOutlineItemCapability=(0,o.createPromiseCapability)();0===t||null!==(r=this._pdfDocument)&&void 0!==r&&r.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(!0);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:t,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}},{key:"_bindLink",value:function _bindLink(t,r){var a=this,i=r.url,l=r.newWindow,u=r.dest,c=this.linkService;if(i)(0,o.addLinkAttributes)(t,{url:i,target:l?o.LinkTarget.BLANK:c.externalLinkTarget,rel:c.externalLinkRel,enabled:c.externalLinkEnabled});else{t.href=c.getDestinationHash(u);t.onclick=function(t){a._updateCurrentTreeItem(t.target.parentNode);u&&c.goToDestination(u);return!1}}}},{key:"_setStyles",value:function _setStyles(t,r){var a=r.bold,i=r.italic;a&&(t.style.fontWeight="bold");i&&(t.style.fontStyle="italic")}},{key:"_addToggleButton",value:function _addToggleButton(t,r){var a=r.count,i=r.items,o=!1;if(a<0){var l=i.length;if(l>0)for(var u=_toConsumableArray(i);u.length>0;){var c=u.shift(),d=c.count,h=c.items;if(d>0&&h.length>0){l+=h.length;u.push.apply(u,_toConsumableArray(h))}}Math.abs(a)===l&&(o=!0)}_get(_getPrototypeOf(PDFOutlineViewer.prototype),"_addToggleButton",this).call(this,t,o)}},{key:"_toggleAllTreeItems",value:function _toggleAllTreeItems(){this._outline&&_get(_getPrototypeOf(PDFOutlineViewer.prototype),"_toggleAllTreeItems",this).call(this)}},{key:"render",value:function render(t){var r=t.outline,a=t.pdfDocument;this._outline&&this.reset();this._outline=r||null;this._pdfDocument=a||null;if(r){for(var i=document.createDocumentFragment(),o=[{parent:i,items:r}],l=0,u=!1;o.length>0;){var c,d=o.shift(),h=_createForOfIteratorHelper(d.items);try{for(h.s();!(c=h.n()).done;){var p=c.value,m=document.createElement("div");m.className="treeItem";var g=document.createElement("a");this._bindLink(g,p);this._setStyles(g,p);g.textContent=this._normalizeTextContent(p.title);m.appendChild(g);if(p.items.length>0){u=!0;this._addToggleButton(m,p);var v=document.createElement("div");v.className="treeItems";m.appendChild(v);o.push({parent:v,items:p.items})}d.parent.appendChild(m);l++}}catch(t){h.e(t)}finally{h.f()}}this._finishRendering(i,l,u)}else this._dispatchEvent(0)}},{key:"_currentOutlineItem",value:(a=_asyncToGenerator(i.default.mark((function _callee(){var t,r,a,o;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:if(this._isPagesLoaded){i.next=2;break}throw new Error("_currentOutlineItem: All pages have not been loaded.");case 2:if(this._outline&&this._pdfDocument){i.next=4;break}return i.abrupt("return");case 4:i.next=6;return this._getPageNumberToDestHash(this._pdfDocument);case 6:if(t=i.sent){i.next=9;break}return i.abrupt("return");case 9:this._updateCurrentTreeItem(null);if(this._sidebarView===u.SidebarView.OUTLINE){i.next=12;break}return i.abrupt("return");case 12:r=this._currentPageNumber;case 13:if(!(r>0)){i.next=25;break}if(a=t.get(r)){i.next=17;break}return i.abrupt("continue",22);case 17:if(o=this.container.querySelector('a[href="'.concat(a,'"]'))){i.next=20;break}return i.abrupt("continue",22);case 20:this._scrollToCurrentTreeItem(o.parentNode);return i.abrupt("break",25);case 22:r--;i.next=13;break;case 25:case"end":return i.stop()}}),_callee,this)}))),function _currentOutlineItem(){return a.apply(this,arguments)})},{key:"_getPageNumberToDestHash",value:(r=_asyncToGenerator(i.default.mark((function _callee2(t){var r,a,l,u,c,d,h,p,m,g,v,y,b,S,w;return i.default.wrap((function _callee2$(i){for(;;)switch(i.prev=i.next){case 0:if(!this._pageNumberToDestHashCapability){i.next=2;break}return i.abrupt("return",this._pageNumberToDestHashCapability.promise);case 2:this._pageNumberToDestHashCapability=(0,o.createPromiseCapability)();r=new Map,a=new Map;l=[{nesting:0,items:this._outline}];case 5:if(!(l.length>0)){i.next=56;break}u=l.shift(),c=u.nesting;d=_createForOfIteratorHelper(u.items);i.prev=8;d.s();case 10:if((h=d.n()).done){i.next=46;break}p=h.value,m=p.dest,g=p.items;v=void 0,y=void 0;if("string"!=typeof m){i.next=21;break}i.next=16;return t.getDestination(m);case 16:v=i.sent;if(t===this._pdfDocument){i.next=19;break}return i.abrupt("return",null);case 19:i.next=22;break;case 21:v=m;case 22:if(!Array.isArray(v)){i.next=43;break}b=_slicedToArray(v,1);if("object"!==_typeof(S=b[0])||null===S){i.next=41;break}if(y=this.linkService._cachedPageNumber(S)){i.next=39;break}i.prev=27;i.next=30;return t.getPageIndex(S);case 30:i.t0=i.sent;y=i.t0+1;if(t===this._pdfDocument){i.next=34;break}return i.abrupt("return",null);case 34:this.linkService.cachePageRef(y,S);i.next=39;break;case 37:i.prev=37;i.t1=i.catch(27);case 39:i.next=42;break;case 41:Number.isInteger(S)&&(y=S+1);case 42:if(Number.isInteger(y)&&(!r.has(y)||c>a.get(y))){w=this.linkService.getDestinationHash(m);r.set(y,w);a.set(y,c)}case 43:g.length>0&&l.push({nesting:c+1,items:g});case 44:i.next=10;break;case 46:i.next=51;break;case 48:i.prev=48;i.t2=i.catch(8);d.e(i.t2);case 51:i.prev=51;d.f();return i.finish(51);case 54:i.next=5;break;case 56:this._pageNumberToDestHashCapability.resolve(r.size>0?r:null);return i.abrupt("return",this._pageNumberToDestHashCapability.promise);case 58:case"end":return i.stop()}}),_callee2,this,[[8,48,51,54],[27,37]])}))),function _getPageNumberToDestHash(t){return r.apply(this,arguments)})}]);return PDFOutlineViewer}(l.BaseTreeViewer);r.PDFOutlineViewer=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFPresentationMode=void 0;var i=a(6);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o="pdfPresentationMode",l="pdfPresentationModeControls",u=Math.PI/6,c=function(){function PDFPresentationMode(t){var r=t.container,a=t.pdfViewer,i=t.eventBus;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFPresentationMode);this.container=r;this.pdfViewer=a;this.eventBus=i;this.active=!1;this.args=null;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFPresentationMode,[{key:"request",value:function request(){if(this.switchInProgress||this.active||!this.pdfViewer.pagesCount)return!1;this._addFullscreenChangeListeners();this._setSwitchInProgress();this._notifyStateChange();if(this.container.requestFullscreen)this.container.requestFullscreen();else if(this.container.mozRequestFullScreen)this.container.mozRequestFullScreen();else{if(!this.container.webkitRequestFullscreen)return!1;document.body.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);this._prepareFullscreenMode()}this.args={page:this.pdfViewer.currentPageNumber,previousScale:this.pdfViewer.currentScaleValue};return!0}},{key:"_mouseWheel",value:function _mouseWheel(t){if(this.active){t.preventDefault();var r=(0,i.normalizeWheelEventDelta)(t),a=Date.now(),o=this.mouseScrollTimeStamp;if(!(a>o&&a-o<50)){(this.mouseScrollDelta>0&&r<0||this.mouseScrollDelta<0&&r>0)&&this._resetMouseScrollState();this.mouseScrollDelta+=r;if(Math.abs(this.mouseScrollDelta)>=.1){var l=this.mouseScrollDelta;this._resetMouseScrollState();(l>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=a)}}}}},{key:"isFullscreen",get:function get(){return!!(document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen)}},{key:"_notifyStateChange",value:function _notifyStateChange(){var t=i.PresentationModeState.NORMAL;this.switchInProgress?t=i.PresentationModeState.CHANGING:this.active&&(t=i.PresentationModeState.FULLSCREEN);this.eventBus.dispatch("presentationmodechanged",{source:this,state:t})}},{key:"_setSwitchInProgress",value:function _setSwitchInProgress(){var t=this;this.switchInProgress&&clearTimeout(this.switchInProgress);this.switchInProgress=setTimeout((function(){t._removeFullscreenChangeListeners();delete t.switchInProgress;t._notifyStateChange()}),1500)}},{key:"_resetSwitchInProgress",value:function _resetSwitchInProgress(){if(this.switchInProgress){clearTimeout(this.switchInProgress);delete this.switchInProgress}}},{key:"_enter",value:function _enter(){var t=this;this.active=!0;this._resetSwitchInProgress();this._notifyStateChange();this.container.classList.add(o);setTimeout((function(){t.pdfViewer.currentPageNumber=t.args.page;t.pdfViewer.currentScaleValue="page-fit"}),0);this._addWindowListeners();this._showControls();this.contextMenuOpen=!1;window.getSelection().removeAllRanges()}},{key:"_exit",value:function _exit(){var t=this;this._tidyUpFullscreenMode();var r=this.pdfViewer.currentPageNumber;this.container.classList.remove(o);setTimeout((function(){t.active=!1;t._removeFullscreenChangeListeners();t._notifyStateChange();t.pdfViewer.currentScaleValue=t.args.previousScale;t.pdfViewer.currentPageNumber=r;t.args=null}),0);this._removeWindowListeners();this._hideControls();this._resetMouseScrollState();this.contextMenuOpen=!1}},{key:"_prepareFullscreenMode",value:function _prepareFullscreenMode(){var t=document.getElementsByClassName("zoom")[0].parentElement,r=t.parentElement;this.ngxContainer=r;for(var a=0;a<r.childElementCount;a++)r.children.item(a)===t&&(this.ngxContainerIndex=a);r.removeChild(t);document.body.append(t);for(var i=document.body.children,o=0;o<i.length;o++){var l=i.item(o);l!==t&&l instanceof HTMLElement&&l.classList.add("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.add("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.add("hidden-by-fullscreen")}},{key:"_tidyUpFullscreenMode",value:function _tidyUpFullscreenMode(){if(this.ngxContainer){var t=document.getElementsByClassName("zoom")[0].parentElement;document.body.removeChild(t);this.ngxContainerIndex>=this.ngxContainer.childElementCount?this.ngxContainer.append(t):this.ngxContainer.insertBefore(t,this.ngxContainer.children.item(this.ngxContainerIndex));this.ngxContainer=void 0;for(var r=document.body.children,a=0;a<r.length;a++){var i=r.item(a);i!==t&&i instanceof HTMLElement&&i.classList.contains("hidden-by-fullscreen")&&i.classList.remove("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.remove("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.remove("hidden-by-fullscreen")}}},{key:"_mouseDown",value:function _mouseDown(t){if(this.contextMenuOpen){this.contextMenuOpen=!1;t.preventDefault()}else if(0===t.button){if(!(t.target.href&&t.target.classList.contains("internalLink"))){t.preventDefault();t.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}}},{key:"_contextMenu",value:function _contextMenu(){this.contextMenuOpen=!0}},{key:"_showControls",value:function _showControls(){var t=this;this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(l);this.controlsTimeout=setTimeout((function(){t.container.classList.remove(l);delete t.controlsTimeout}),3e3)}},{key:"_hideControls",value:function _hideControls(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(l);delete this.controlsTimeout}}},{key:"_resetMouseScrollState",value:function _resetMouseScrollState(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}},{key:"_touchSwipe",value:function _touchSwipe(t){if(this.active)if(t.touches.length>1)this.touchSwipeState=null;else switch(t.type){case"touchstart":this.touchSwipeState={startX:t.touches[0].pageX,startY:t.touches[0].pageY,endX:t.touches[0].pageX,endY:t.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=t.touches[0].pageX;this.touchSwipeState.endY=t.touches[0].pageY;t.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;var r=0,a=this.touchSwipeState.endX-this.touchSwipeState.startX,i=this.touchSwipeState.endY-this.touchSwipeState.startY,o=Math.abs(Math.atan2(i,a));Math.abs(a)>50&&(o<=u||o>=Math.PI-u)?r=a:Math.abs(i)>50&&Math.abs(o-Math.PI/2)<=u&&(r=i);r>0?this.pdfViewer.previousPage():r<0&&this.pdfViewer.nextPage()}}},{key:"_addWindowListeners",value:function _addWindowListeners(){this.showControlsBind=this._showControls.bind(this);this.mouseDownBind=this._mouseDown.bind(this);this.mouseWheelBind=this._mouseWheel.bind(this);this.resetMouseScrollStateBind=this._resetMouseScrollState.bind(this);this.contextMenuBind=this._contextMenu.bind(this);this.touchSwipeBind=this._touchSwipe.bind(this);window.addEventListener("mousemove",this.showControlsBind);window.addEventListener("mousedown",this.mouseDownBind);window.addEventListener("wheel",this.mouseWheelBind,{passive:!1});window.addEventListener("keydown",this.resetMouseScrollStateBind);window.addEventListener("contextmenu",this.contextMenuBind);window.addEventListener("touchstart",this.touchSwipeBind);window.addEventListener("touchmove",this.touchSwipeBind);window.addEventListener("touchend",this.touchSwipeBind)}},{key:"_removeWindowListeners",value:function _removeWindowListeners(){window.removeEventListener("mousemove",this.showControlsBind);window.removeEventListener("mousedown",this.mouseDownBind);window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1});window.removeEventListener("keydown",this.resetMouseScrollStateBind);window.removeEventListener("contextmenu",this.contextMenuBind);window.removeEventListener("touchstart",this.touchSwipeBind);window.removeEventListener("touchmove",this.touchSwipeBind);window.removeEventListener("touchend",this.touchSwipeBind);delete this.showControlsBind;delete this.mouseDownBind;delete this.mouseWheelBind;delete this.resetMouseScrollStateBind;delete this.contextMenuBind;delete this.touchSwipeBind}},{key:"_fullscreenChange",value:function _fullscreenChange(){this.isFullscreen?this._enter():this._exit()}},{key:"_addFullscreenChangeListeners",value:function _addFullscreenChangeListeners(){this.fullscreenChangeBind=this._fullscreenChange.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind);window.addEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.addEventListener("webkitfullscreenchange",this.fullscreenChangeBind)}},{key:"_removeFullscreenChangeListeners",value:function _removeFullscreenChangeListeners(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);window.removeEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.removeEventListener("webkitfullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}]);return PDFPresentationMode}();r.PDFPresentationMode=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFScriptingManager=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(7),l=a(6),u=a(10);function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})));a.push.apply(a,i)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){_defineProperty(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var c=function(){function PDFScriptingManager(t){var r=t.eventBus,a=t.sandboxBundleSrc,i=void 0===a?null:a,o=t.scriptingFactory,l=void 0===o?null:o,u=t.docPropertiesLookup,c=void 0===u?null:u;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFScriptingManager);this._pdfDocument=null;this._pdfViewer=null;this._closeCapability=null;this._destroyCapability=null;this._scripting=null;this._mouseState=Object.create(null);this._ready=!1;this._eventBus=r;this._sandboxBundleSrc=i;this._scriptingFactory=l;this._docPropertiesLookup=c}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFScriptingManager,[{key:"setViewer",value:function setViewer(t){this._pdfViewer=t}},{key:"setDocument",value:(v=_asyncToGenerator(i.default.mark((function _callee2(t){var r,a,o,l,u,c,d,h,p,m,g,v,y,b,S,w,C,P=this;return i.default.wrap((function _callee2$(k){for(;;)switch(k.prev=k.next){case 0:if(!this._pdfDocument){k.next=3;break}k.next=3;return this._destroyScripting();case 3:this._pdfDocument=t;if(t){k.next=6;break}return k.abrupt("return");case 6:k.next=8;return Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);case 8:a=k.sent;o=_slicedToArray(a,3);l=o[0];u=o[1];c=o[2];if(l||c){k.next=17;break}k.next=16;return this._destroyScripting();case 16:return k.abrupt("return");case 17:if(t===this._pdfDocument){k.next=19;break}return k.abrupt("return");case 19:k.prev=19;this._scripting=this._createScripting();k.next=29;break;case 23:k.prev=23;k.t0=k.catch(19);console.error('PDFScriptingManager.setDocument: "'.concat(null===k.t0||void 0===k.t0?void 0:k.t0.message,'".'));k.next=28;return this._destroyScripting();case 28:return k.abrupt("return");case 29:this._internalEvents.set("updatefromsandbox",(function(t){(null==t?void 0:t.source)===window&&P._updateFromSandbox(t.detail)}));this._internalEvents.set("dispatcheventinsandbox",(function(t){var r;null===(r=P._scripting)||void 0===r||r.dispatchEventInSandbox(t.detail)}));this._internalEvents.set("pagechanging",(function(t){var r=t.pageNumber,a=t.previous;if(r!==a){P._dispatchPageClose(a);P._dispatchPageOpen(r)}}));this._internalEvents.set("pagerendered",(function(t){var r=t.pageNumber;P._pageOpenPending.has(r)&&r===P._pdfViewer.currentPageNumber&&P._dispatchPageOpen(r)}));this._internalEvents.set("pagesdestroy",function(){var t=_asyncToGenerator(i.default.mark((function _callee(t){var r,a;return i.default.wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:t.next=2;return P._dispatchPageClose(P._pdfViewer.currentPageNumber);case 2:t.next=4;return null===(r=P._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"doc",name:"WillClose"});case 4:null===(a=P._closeCapability)||void 0===a||a.resolve();case 5:case"end":return t.stop()}}),_callee)})));return function(r){return t.apply(this,arguments)}}());this._domEvents.set("mousedown",(function(t){P._mouseState.isDown=!0}));this._domEvents.set("mouseup",(function(t){P._mouseState.isDown=!1}));d=_createForOfIteratorHelper(this._internalEvents);try{for(d.s();!(h=d.n()).done;){p=_slicedToArray(h.value,2),m=p[0],g=p[1];this._eventBus._on(m,g)}}catch(t){d.e(t)}finally{d.f()}v=_createForOfIteratorHelper(this._domEvents);try{for(v.s();!(y=v.n()).done;){b=_slicedToArray(y.value,2),S=b[0],w=b[1];window.addEventListener(S,w)}}catch(t){v.e(t)}finally{v.f()}k.prev=40;k.next=43;return this._getDocProperties();case 43:C=k.sent;if(t===this._pdfDocument){k.next=46;break}return k.abrupt("return");case 46:k.next=48;return this._scripting.createSandbox({objects:l,calculationOrder:u,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:_objectSpread(_objectSpread({},C),{},{actions:c})});case 48:this._eventBus.dispatch("sandboxcreated",{source:this});k.next=57;break;case 51:k.prev=51;k.t1=k.catch(40);console.error('PDFScriptingManager.setDocument: "'.concat(null===k.t1||void 0===k.t1?void 0:k.t1.message,'".'));k.next=56;return this._destroyScripting();case 56:return k.abrupt("return");case 57:k.next=59;return null===(r=this._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"doc",name:"Open"});case 59:k.next=61;return this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0);case 61:Promise.resolve().then((function(){t===P._pdfDocument&&(P._ready=!0)}));case 62:case"end":return k.stop()}}),_callee2,this,[[19,23],[40,51]])}))),function setDocument(t){return v.apply(this,arguments)})},{key:"dispatchWillSave",value:(g=_asyncToGenerator(i.default.mark((function _callee3(t){var r;return i.default.wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null===(r=this._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"doc",name:"WillSave"}));case 1:case"end":return t.stop()}}),_callee3,this)}))),function dispatchWillSave(t){return g.apply(this,arguments)})},{key:"dispatchDidSave",value:(m=_asyncToGenerator(i.default.mark((function _callee4(t){var r;return i.default.wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null===(r=this._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"doc",name:"DidSave"}));case 1:case"end":return t.stop()}}),_callee4,this)}))),function dispatchDidSave(t){return m.apply(this,arguments)})},{key:"dispatchWillPrint",value:(p=_asyncToGenerator(i.default.mark((function _callee5(t){var r;return i.default.wrap((function _callee5$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null===(r=this._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"doc",name:"WillPrint"}));case 1:case"end":return t.stop()}}),_callee5,this)}))),function dispatchWillPrint(t){return p.apply(this,arguments)})},{key:"dispatchDidPrint",value:(h=_asyncToGenerator(i.default.mark((function _callee6(t){var r;return i.default.wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null===(r=this._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"doc",name:"DidPrint"}));case 1:case"end":return t.stop()}}),_callee6,this)}))),function dispatchDidPrint(t){return h.apply(this,arguments)})},{key:"mouseState",get:function get(){return this._mouseState}},{key:"destroyPromise",get:function get(){var t;return(null===(t=this._destroyCapability)||void 0===t?void 0:t.promise)||null}},{key:"ready",get:function get(){return this._ready}},{key:"_internalEvents",get:function get(){return(0,o.shadow)(this,"_internalEvents",new Map)}},{key:"_domEvents",get:function get(){return(0,o.shadow)(this,"_domEvents",new Map)}},{key:"_pageOpenPending",get:function get(){return(0,o.shadow)(this,"_pageOpenPending",new Set)}},{key:"_visitedPages",get:function get(){return(0,o.shadow)(this,"_visitedPages",new Map)}},{key:"_updateFromSandbox",value:(d=_asyncToGenerator(i.default.mark((function _callee7(t){var r,a,o,u,c,d,h,p,m,g,v;return i.default.wrap((function _callee7$(i){for(;;)switch(i.prev=i.next){case 0:r=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode;a=t.id,o=t.siblings,u=t.command,c=t.value;if(a){i.next=25;break}i.t0=u;i.next="clear"===i.t0?6:"error"===i.t0?8:"layout"===i.t0?10:"page-num"===i.t0?12:"print"===i.t0?14:"println"===i.t0?18:"zoom"===i.t0?20:24;break;case 6:console.clear();return i.abrupt("break",24);case 8:console.error(c);return i.abrupt("break",24);case 10:this._pdfViewer.spreadMode=(0,l.apiPageLayoutToSpreadMode)(c);return i.abrupt("break",24);case 12:this._pdfViewer.currentPageNumber=c+1;return i.abrupt("break",24);case 14:i.next=16;return this._pdfViewer.pagesPromise;case 16:this._eventBus.dispatch("print",{source:this});return i.abrupt("break",24);case 18:console.log(c);return i.abrupt("break",24);case 20:if(!r){i.next=22;break}return i.abrupt("return");case 22:this._pdfViewer.currentScaleValue=c;return i.abrupt("break",24);case 24:return i.abrupt("return");case 25:if(!r){i.next=28;break}if(!t.focus){i.next=28;break}return i.abrupt("return");case 28:delete t.id;delete t.siblings;d=o?[a].concat(_toConsumableArray(o)):[a];h=_createForOfIteratorHelper(d);try{for(h.s();!(p=h.n()).done;){m=p.value;(g=document.getElementById(m))?g.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):null===(v=this._pdfDocument)||void 0===v||v.annotationStorage.setValue(m,void 0,t)}}catch(t){h.e(t)}finally{h.f()}case 33:case"end":return i.stop()}}),_callee7,this)}))),function _updateFromSandbox(t){return d.apply(this,arguments)})},{key:"_dispatchPageOpen",value:(c=_asyncToGenerator(i.default.mark((function _callee9(t){var r,a,l,c,d,h=this,p=arguments;return i.default.wrap((function _callee9$(m){for(;;)switch(m.prev=m.next){case 0:r=p.length>1&&void 0!==p[1]&&p[1];a=this._pdfDocument,l=this._visitedPages;r&&(this._closeCapability=(0,o.createPromiseCapability)());if(this._closeCapability){m.next=5;break}return m.abrupt("return");case 5:if((null==(c=this._pdfViewer.getPageView(t-1))?void 0:c.renderingState)===u.RenderingStates.FINISHED){m.next=9;break}this._pageOpenPending.add(t);return m.abrupt("return");case 9:this._pageOpenPending.delete(t);d=_asyncToGenerator(i.default.mark((function _callee8(){var r,o,u;return i.default.wrap((function _callee8$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return l.has(t)?null:null===(r=c.pdfPage)||void 0===r?void 0:r.getJSActions();case 2:u=i.sent;if(a===h._pdfDocument){i.next=5;break}return i.abrupt("return");case 5:i.next=7;return null===(o=h._scripting)||void 0===o?void 0:o.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:u});case 7:case"end":return i.stop()}}),_callee8)})))();l.set(t,d);case 12:case"end":return m.stop()}}),_callee9,this)}))),function _dispatchPageOpen(t){return c.apply(this,arguments)})},{key:"_dispatchPageClose",value:(a=_asyncToGenerator(i.default.mark((function _callee10(t){var r,a,o,l;return i.default.wrap((function _callee10$(i){for(;;)switch(i.prev=i.next){case 0:a=this._pdfDocument,o=this._visitedPages;if(this._closeCapability){i.next=3;break}return i.abrupt("return");case 3:if(!this._pageOpenPending.has(t)){i.next=5;break}return i.abrupt("return");case 5:if(l=o.get(t)){i.next=8;break}return i.abrupt("return");case 8:o.set(t,null);i.next=11;return l;case 11:if(a===this._pdfDocument){i.next=13;break}return i.abrupt("return");case 13:i.next=15;return null===(r=this._scripting)||void 0===r?void 0:r.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t});case 15:case"end":return i.stop()}}),_callee10,this)}))),function _dispatchPageClose(t){return a.apply(this,arguments)})},{key:"_getDocProperties",value:(r=_asyncToGenerator(i.default.mark((function _callee11(){return i.default.wrap((function _callee11$(t){for(;;)switch(t.prev=t.next){case 0:if(!this._docPropertiesLookup){t.next=2;break}return t.abrupt("return",this._docPropertiesLookup(this._pdfDocument));case 2:throw new Error("_getDocProperties: Unable to lookup properties.");case 3:case"end":return t.stop()}}),_callee11,this)}))),function _getDocProperties(){return r.apply(this,arguments)})},{key:"_createScripting",value:function _createScripting(){this._destroyCapability=(0,o.createPromiseCapability)();if(this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});throw new Error("_createScripting: Cannot create scripting.")}},{key:"_destroyScripting",value:(t=_asyncToGenerator(i.default.mark((function _callee12(){var t,r,a,o,l,u,c,d,h,p,m,g;return i.default.wrap((function _callee12$(i){for(;;)switch(i.prev=i.next){case 0:if(this._scripting){i.next=4;break}this._pdfDocument=null;null===(r=this._destroyCapability)||void 0===r||r.resolve();return i.abrupt("return");case 4:if(!this._closeCapability){i.next=8;break}i.next=7;return Promise.race([this._closeCapability.promise,new Promise((function(t){setTimeout(t,1e3)}))]).catch((function(t){}));case 7:this._closeCapability=null;case 8:this._pdfDocument=null;i.prev=9;i.next=12;return this._scripting.destroySandbox();case 12:i.next=16;break;case 14:i.prev=14;i.t0=i.catch(9);case 16:a=_createForOfIteratorHelper(this._internalEvents);try{for(a.s();!(o=a.n()).done;){l=_slicedToArray(o.value,2),u=l[0],c=l[1];this._eventBus._off(u,c)}}catch(t){a.e(t)}finally{a.f()}this._internalEvents.clear();d=_createForOfIteratorHelper(this._domEvents);try{for(d.s();!(h=d.n()).done;){p=_slicedToArray(h.value,2),m=p[0],g=p[1];window.removeEventListener(m,g)}}catch(t){d.e(t)}finally{d.f()}this._domEvents.clear();this._pageOpenPending.clear();this._visitedPages.clear();this._scripting=null;delete this._mouseState.isDown;this._ready=!1;null===(t=this._destroyCapability)||void 0===t||t.resolve();case 28:case"end":return i.stop()}}),_callee12,this,[[9,14]])}))),function _destroyScripting(){return t.apply(this,arguments)})}]);var t,r,a,c,d,h,p,m,g,v;return PDFScriptingManager}();r.PDFScriptingManager=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFSidebar=void 0;var i=a(6),o=a(10);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var l="pdfSidebarNotification",u=function(){function PDFSidebar(t){var r=t.elements,a=t.pdfViewer,o=t.pdfThumbnailViewer,l=t.eventBus,u=t.l10n;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFSidebar);this.isOpen=!1;this.active=i.SidebarView.THUMBS;this.isInitialViewSet=!1;this.onToggled=null;this.pdfViewer=a;this.pdfThumbnailViewer=o;this.outerContainer=r.outerContainer;this.viewerContainer=r.viewerContainer;this.toggleButton=r.toggleButton;this.thumbnailButton=r.thumbnailButton;this.outlineButton=r.outlineButton;this.attachmentsButton=r.attachmentsButton;this.layersButton=r.layersButton;this.thumbnailView=r.thumbnailView;this.outlineView=r.outlineView;this.attachmentsView=r.attachmentsView;this.layersView=r.layersView;this._outlineOptionsContainer=r.outlineOptionsContainer;this._currentOutlineItemButton=r.currentOutlineItemButton;this.eventBus=l;this.l10n=u;this._addEventListeners()}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFSidebar,[{key:"reset",value:function reset(){this.isInitialViewSet=!1;this._hideUINotification(!0);this.switchView(i.SidebarView.THUMBS);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this._currentOutlineItemButton.disabled=!0}},{key:"visibleView",get:function get(){return this.isOpen?this.active:i.SidebarView.NONE}},{key:"isThumbnailViewVisible",get:function get(){return this.isOpen&&this.active===i.SidebarView.THUMBS}},{key:"isOutlineViewVisible",get:function get(){return this.isOpen&&this.active===i.SidebarView.OUTLINE}},{key:"isAttachmentsViewVisible",get:function get(){return this.isOpen&&this.active===i.SidebarView.ATTACHMENTS}},{key:"isLayersViewVisible",get:function get(){return this.isOpen&&this.active===i.SidebarView.LAYERS}},{key:"setInitialView",value:function setInitialView(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.SidebarView.NONE;if(!this.isInitialViewSet){this.isInitialViewSet=!0;t!==i.SidebarView.NONE&&t!==i.SidebarView.UNKNOWN&&this._switchView(t,!0)||this._dispatchEvent()}}},{key:"switchView",value:function switchView(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._switchView(t,r)}},{key:"_switchView",value:function _switchView(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=t!==this.active,o=!1;switch(t){case i.SidebarView.NONE:if(this.isOpen){this.close();return!0}return!1;case i.SidebarView.THUMBS:this.isOpen&&a&&(o=!0);break;case i.SidebarView.OUTLINE:if(this.outlineButton.disabled)return!1;break;case i.SidebarView.ATTACHMENTS:if(this.attachmentsButton.disabled)return!1;break;case i.SidebarView.LAYERS:if(this.layersButton.disabled)return!1;break;default:console.error('PDFSidebar._switchView: "'.concat(t,'" is not a valid view.'));return!1}this.active=t;this.thumbnailButton.classList.toggle("toggled",t===i.SidebarView.THUMBS);this.outlineButton.classList.toggle("toggled",t===i.SidebarView.OUTLINE);this.attachmentsButton.classList.toggle("toggled",t===i.SidebarView.ATTACHMENTS);this.layersButton.classList.toggle("toggled",t===i.SidebarView.LAYERS);this.thumbnailView.classList.toggle("hidden",t!==i.SidebarView.THUMBS);this.outlineView.classList.toggle("hidden",t!==i.SidebarView.OUTLINE);this.attachmentsView.classList.toggle("hidden",t!==i.SidebarView.ATTACHMENTS);this.layersView.classList.toggle("hidden",t!==i.SidebarView.LAYERS);this._outlineOptionsContainer.classList.toggle("hidden",t!==i.SidebarView.OUTLINE);if(r&&!this.isOpen){this.open();return!0}if(o){this._updateThumbnailViewer();this._forceRendering()}a&&this._dispatchEvent();return a}},{key:"open",value:function open(){if(!this.isOpen){this.isOpen=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===i.SidebarView.THUMBS&&this._updateThumbnailViewer();this._forceRendering();this._dispatchEvent();this._hideUINotification()}}},{key:"close",value:function close(){if(this.isOpen){this.isOpen=!1;this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false");this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this._forceRendering();this._dispatchEvent()}}},{key:"toggle",value:function toggle(){this.isOpen?this.close():this.open()}},{key:"_dispatchEvent",value:function _dispatchEvent(){this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}},{key:"_forceRendering",value:function _forceRendering(){if(this.onToggled)this.onToggled();else{this.pdfViewer.forceRendering();this.pdfThumbnailViewer.forceRendering()}}},{key:"_updateThumbnailViewer",value:function _updateThumbnailViewer(){for(var t=this.pdfViewer,r=this.pdfThumbnailViewer,a=t.pagesCount,i=0;i<a;i++){var l=t.getPageView(i);if((null==l?void 0:l.renderingState)===o.RenderingStates.FINISHED){r.getThumbnail(i).setImage(l)}}r.scrollThumbnailIntoView(t.currentPageNumber)}},{key:"_showUINotification",value:function _showUINotification(){var t=this;this.l10n.get("toggle_sidebar_notification2.title").then((function(r){t.toggleButton.title=r}));this.isOpen||this.toggleButton.classList.add(l)}},{key:"_hideUINotification",value:function _hideUINotification(){var t=this,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(this.isOpen||r)&&this.toggleButton.classList.remove(l);r&&this.l10n.get("toggle_sidebar.title").then((function(r){t.toggleButton.title=r}))}},{key:"_addEventListeners",value:function _addEventListeners(){var t=this;this.viewerContainer.addEventListener("transitionend",(function(r){r.target===t.viewerContainer&&t.outerContainer.classList.remove("sidebarMoving")}));this.toggleButton.addEventListener("click",(function(){t.toggle()}));this.thumbnailButton.addEventListener("click",(function(){t.switchView(i.SidebarView.THUMBS)}));this.outlineButton.addEventListener("click",(function(){t.switchView(i.SidebarView.OUTLINE)}));this.outlineButton.addEventListener("dblclick",(function(){t.eventBus.dispatch("toggleoutlinetree",{source:t})}));this.attachmentsButton.addEventListener("click",(function(){t.switchView(i.SidebarView.ATTACHMENTS)}));this.layersButton.addEventListener("click",(function(){t.switchView(i.SidebarView.LAYERS)}));this.layersButton.addEventListener("dblclick",(function(){t.eventBus.dispatch("resetlayers",{source:t})}));this._currentOutlineItemButton.addEventListener("click",(function(){t.eventBus.dispatch("currentoutlineitem",{source:t})}));var r=function onTreeLoaded(r,a,o){a.disabled=!r;a.hidden=!r;r?t._showUINotification():t.active===o&&t.switchView(i.SidebarView.THUMBS)};this.eventBus._on("outlineloaded",(function(a){r(a.outlineCount,t.outlineButton,i.SidebarView.OUTLINE);a.enableCurrentOutlineItemButton&&a.currentOutlineItemPromise&&a.currentOutlineItemPromise.then((function(r){t.isInitialViewSet&&(t._currentOutlineItemButton.disabled=!r)}))}));this.eventBus._on("attachmentsloaded",(function(a){r(a.attachmentsCount,t.attachmentsButton,i.SidebarView.ATTACHMENTS)}));this.eventBus._on("layersloaded",(function(a){r(a.layersCount,t.layersButton,i.SidebarView.LAYERS)}));this.eventBus._on("presentationmodechanged",(function(r){r.state===i.PresentationModeState.NORMAL&&t.isThumbnailViewVisible&&t._updateThumbnailViewer()}))}}]);return PDFSidebar}();r.PDFSidebar=u},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFSidebarResizer=void 0;function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var a="--sidebar-width",i=200,o="sidebarResizing",l=function(){function PDFSidebarResizer(t,r,a){var i=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFSidebarResizer);this.isRTL=!1;this.sidebarOpen=!1;this.doc=document.documentElement;this._width=null;this._outerContainerWidth=null;this._boundEvents=Object.create(null);this.outerContainer=t.outerContainer;this.resizer=t.resizer;this.eventBus=r;a.getDirection().then((function(t){i.isRTL="rtl"===t}));this._addEventListeners()}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFSidebarResizer,[{key:"outerContainerWidth",get:function get(){return this._outerContainerWidth||(this._outerContainerWidth=this.outerContainer.clientWidth)}},{key:"_updateWidth",value:function _updateWidth(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=Math.floor(this.outerContainerWidth/2);t>r&&(t=r);t<i&&(t=i);if(t===this._width)return!1;this._width=t;this.doc.style.setProperty(a,"".concat(t,"px"));return!0}},{key:"_mouseMove",value:function _mouseMove(t){var r=t.clientX;this.isRTL&&(r=this.outerContainerWidth-r);this._updateWidth(r)}},{key:"_mouseUp",value:function _mouseUp(t){this.outerContainer.classList.remove(o);this.eventBus.dispatch("resize",{source:this});var r=this._boundEvents;window.removeEventListener("mousemove",r.mouseMove);window.removeEventListener("mouseup",r.mouseUp)}},{key:"_addEventListeners",value:function _addEventListeners(){var t=this,r=this._boundEvents;r.mouseMove=this._mouseMove.bind(this);r.mouseUp=this._mouseUp.bind(this);this.resizer.addEventListener("mousedown",(function(a){if(0===a.button){t.outerContainer.classList.add(o);window.addEventListener("mousemove",r.mouseMove);window.addEventListener("mouseup",r.mouseUp)}}));this.eventBus._on("sidebarviewchanged",(function(r){t.sidebarOpen=!(null==r||!r.view)}));this.eventBus._on("resize",(function(r){if((null==r?void 0:r.source)===window){t._outerContainerWidth=null;if(t._width)if(t.sidebarOpen){t.outerContainer.classList.add(o);var a=t._updateWidth(t._width);Promise.resolve().then((function(){t.outerContainer.classList.remove(o);a&&t.eventBus.dispatch("resize",{source:t})}))}else t._updateWidth(t._width)}}))}}]);return PDFSidebarResizer}();r.PDFSidebarResizer=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFThumbnailViewer=void 0;var i=a(6),o=a(30),l=a(10);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var u="selected",c=function(){function PDFThumbnailViewer(t){var r=this,a=t.container,o=t.eventBus,l=t.linkService,u=t.renderingQueue,c=t.l10n;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFThumbnailViewer);this.container=a;this.linkService=l;this.renderingQueue=u;this.l10n=c;this.scroll=(0,i.watchScroll)(this.container,this._scrollUpdated.bind(this));this._resetView();o._on("optionalcontentconfigchanged",(function(){r._setImageDisabled=!0}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFThumbnailViewer,[{key:"_scrollUpdated",value:function _scrollUpdated(){this.renderingQueue.renderHighestPriority()}},{key:"getThumbnail",value:function getThumbnail(t){return this._thumbnails[t]}},{key:"_getVisibleThumbs",value:function _getVisibleThumbs(){return(0,i.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}},{key:"scrollThumbnailIntoView",value:function scrollThumbnailIntoView(t){if(this.pdfDocument){var r=this._thumbnails[t-1];if(r){if(t!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(u);r.div.classList.add(u)}var a=this._getVisibleThumbs(),o=a.views.length;if(o>0){var l=a.first.id,c=o>1?a.last.id:l,d=!1;t<=l||t>=c?d=!0:a.views.some((function(r){if(r.id!==t)return!1;d=r.percent<100;return!0}));d&&(0,i.scrollIntoView)(r.div,{top:-19})}this._currentPageNumber=t}else console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.')}}},{key:"pagesRotation",get:function get(){return this._pagesRotation},set:function set(t){if(!(0,i.isValidRotation)(t))throw new Error("Invalid thumbnails rotation angle.");if(this.pdfDocument&&this._pagesRotation!==t){this._pagesRotation=t;for(var r=0,a=this._thumbnails.length;r<a;r++)this._thumbnails[r].update(t)}}},{key:"cleanup",value:function cleanup(){for(var t=0,r=this._thumbnails.length;t<r;t++)this._thumbnails[t]&&this._thumbnails[t].renderingState!==l.RenderingStates.FINISHED&&this._thumbnails[t].reset();o.TempImageFactory.destroyCanvas()}},{key:"_resetView",value:function _resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._pagesRequests=new WeakMap;this._setImageDisabled=!1;this.container.textContent=""}},{key:"setDocument",value:function setDocument(t){var r=this;if(this.pdfDocument){this._cancelRendering();this._resetView()}this.pdfDocument=t;if(t){var a=t.getPage(1),i=t.getOptionalContentConfig();a.then((function(a){r._optionalContentConfigPromise=i;for(var l=t.numPages,c=a.getViewport({scale:1}),d=function checkSetImageDisabled(){return r._setImageDisabled},h=1;h<=l;++h){var p=new o.PDFThumbnailView({container:r.container,id:h,defaultViewport:c.clone(),optionalContentConfigPromise:i,linkService:r.linkService,renderingQueue:r.renderingQueue,checkSetImageDisabled:d,l10n:r.l10n});r._thumbnails.push(p)}var m=r._thumbnails[0];m&&m.setPdfPage(a);r._thumbnails[r._currentPageNumber-1].div.classList.add(u)})).catch((function(t){console.error("Unable to initialize thumbnail viewer",t)}))}}},{key:"_cancelRendering",value:function _cancelRendering(){for(var t=0,r=this._thumbnails.length;t<r;t++)this._thumbnails[t]&&this._thumbnails[t].cancelRendering()}},{key:"setPageLabels",value:function setPageLabels(t){if(this.pdfDocument){if(t)if(Array.isArray(t)&&this.pdfDocument.numPages===t.length)this._pageLabels=t;else{this._pageLabels=null;console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(var r=0,a=this._thumbnails.length;r<a;r++){var i,o;this._thumbnails[r].setPageLabel(null!==(i=null===(o=this._pageLabels)||void 0===o?void 0:o[r])&&void 0!==i?i:null)}}}},{key:"_ensurePdfPageLoaded",value:function _ensurePdfPageLoaded(t){var r=this;if(t.pdfPage)return Promise.resolve(t.pdfPage);if(this._pagesRequests.has(t))return this._pagesRequests.get(t);var a=this.pdfDocument.getPage(t.id).then((function(a){t.pdfPage||t.setPdfPage(a);r._pagesRequests.delete(t);return a})).catch((function(a){console.error("Unable to get page for thumb view",a);r._pagesRequests.delete(t)}));this._pagesRequests.set(t,a);return a}},{key:"forceRendering",value:function forceRendering(){var t=this,r=this._getVisibleThumbs(),a=this.renderingQueue.getHighestPriority(r,this._thumbnails,this.scroll.down);if(a){this._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}));return!0}return!1}}]);return PDFThumbnailViewer}();r.PDFThumbnailViewer=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.TempImageFactory=r.PDFThumbnailView=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(6),l=a(7),u=a(10);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var c=function TempImageFactoryClosure(){var t=null;return{getCanvas:function getCanvas(r,a){var i=t;if(!i){i=document.createElement("canvas");t=i}i.width=r;i.height=a;i.mozOpaque=!0;var o=i.getContext("2d",{alpha:!1});o.save();o.fillStyle="rgb(255, 255, 255)";o.fillRect(0,0,r,a);o.restore();return[i,i.getContext("2d")]},destroyCanvas:function destroyCanvas(){var r=t;if(r){r.width=0;r.height=0}t=null}}}();r.TempImageFactory=c;var d=function(){function PDFThumbnailView(t){var r=t.container,a=t.id,i=t.defaultViewport,o=t.optionalContentConfigPromise,l=t.linkService,c=t.renderingQueue,d=t.checkSetImageDisabled,h=t.l10n;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFThumbnailView);this.id=a;this.renderingId="thumbnail"+a;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=o||null;this.linkService=l;this.renderingQueue=c;this.renderTask=null;this.renderingState=u.RenderingStates.INITIAL;this.resume=null;this._checkSetImageDisabled=d||function(){return!1};var p=this.viewport.width,m=p/this.viewport.height;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/m|0;this.scale=this.canvasWidth/p;this.l10n=h;window.pdfThumbnailGenerator?window.pdfThumbnailGenerator(this,l,a,r,this._thumbPageTitle):this.createThumbnail(this,l,a,r,this._thumbPageTitle)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFThumbnailView,[{key:"createThumbnail",value:function createThumbnail(t,r,a,i,o){var l=document.createElement("a");l.href=r.getAnchorUrl("#page="+a);o.then((function(t){l.title=t}));l.onclick=function(){r.goToPage(a);return!1};t.anchor=l;var u=document.createElement("div");u.className="thumbnail";u.setAttribute("data-page-number",this.id);t.div=u;var c=document.createElement("div");c.className="thumbnailSelectionRing";c.style.width=this.canvasWidth+2+"px";c.style.height=this.canvasHeight+2+"px";t.ring=c;u.appendChild(c);l.appendChild(u);i.appendChild(l)}},{key:"setPdfPage",value:function setPdfPage(t){this.pdfPage=t;this.pdfPageRotate=t.rotate;var r=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:1,rotation:r});this.reset()}},{key:"reset",value:function reset(){this.cancelRendering();this.renderingState=u.RenderingStates.INITIAL;var t=this.viewport.width,r=t/this.viewport.height;this.canvasHeight=this.canvasWidth/r|0;this.scale=this.canvasWidth/t;this.div.removeAttribute("data-loaded");var a=this.ring;a.textContent="";a.style.width=this.canvasWidth+2+"px";a.style.height=this.canvasHeight+2+"px";if(this.canvas){this.canvas.width=0;this.canvas.height=0;delete this.canvas}if(this.image){this.image.removeAttribute("src");delete this.image}}},{key:"update",value:function update(t){void 0!==t&&(this.rotation=t);var r=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:r});this.reset()}},{key:"cancelRendering",value:function cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}},{key:"_getPageDrawContext",value:function _getPageDrawContext(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=document.createElement("canvas");r.mozOpaque=!0;var a=r.getContext("2d",{alpha:!1}),i=(0,o.getOutputScale)(a);r.width=t*this.canvasWidth*i.sx|0;r.height=t*this.canvasHeight*i.sy|0;var l=i.scaled?[i.sx,0,0,i.sy,0,0]:null;return{ctx:a,canvas:r,transform:l}}},{key:"_convertCanvasToImage",value:function _convertCanvasToImage(t){if(this.renderingState!==u.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");var r=this._reduceImage(t),a=document.createElement("img");a.className="thumbnailImage";this._thumbPageCanvas.then((function(t){a.setAttribute("aria-label",t)}));a.style.width=this.canvasWidth+"px";a.style.height=this.canvasHeight+"px";a.src=r.toDataURL();this.image=a;this.div.setAttribute("data-loaded",!0);this.ring.appendChild(a);r.width=0;r.height=0}},{key:"draw",value:function draw(){var t=this;if(this.renderingState!==u.RenderingStates.INITIAL){console.error("Must be in new state before drawing");return Promise.resolve(void 0)}var r=this.pdfPage;if(!r){this.renderingState=u.RenderingStates.FINISHED;return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=u.RenderingStates.RUNNING;var a=function(){var r=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(i.default.mark((function _callee(){var r,a=arguments;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:r=a.length>0&&void 0!==a[0]?a[0]:null;p===t.renderTask&&(t.renderTask=null);if(!(r instanceof l.RenderingCancelledException)){i.next=4;break}return i.abrupt("return");case 4:t.renderingState=u.RenderingStates.FINISHED;t._convertCanvasToImage(d);if(!r){i.next=8;break}throw r;case 8:case"end":return i.stop()}}),_callee)})));return function finishRenderTask(){return r.apply(this,arguments)}}(),o=this._getPageDrawContext(2),c=o.ctx,d=o.canvas,h={canvasContext:c,transform:o.transform,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,background:PDFViewerApplicationOptions.get("pdfBackgroundColor")},p=this.renderTask=r.render(h);p.onContinue=function renderContinueCallback(r){if(t.renderingQueue.isHighestPriority(t))r();else{t.renderingState=u.RenderingStates.PAUSED;t.resume=function(){t.renderingState=u.RenderingStates.RUNNING;r()}}};var m=p.promise.then((function(){return a(null)}),(function(t){return a(t)}));m.finally((function(){d.width=0;d.height=0;if(!t.linkService.isPageCached(t.id)){var r;null===(r=t.pdfPage)||void 0===r||r.cleanup()}}));return m}},{key:"setImage",value:function setImage(t){if(!this._checkSetImageDisabled()&&this.renderingState===u.RenderingStates.INITIAL){var r=t.canvas,a=t.pdfPage;if(r){this.pdfPage||this.setPdfPage(a);this.renderingState=u.RenderingStates.FINISHED;this._convertCanvasToImage(r)}}}},{key:"_reduceImage",value:function _reduceImage(t){var r=this._getPageDrawContext(),a=r.ctx,i=r.canvas;if(t.width<=2*i.width){a.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height);return i}for(var o=i.width<<3,l=i.height<<3,u=_slicedToArray(c.getCanvas(o,l),2),d=u[0],h=u[1];o>t.width||l>t.height;){o>>=1;l>>=1}h.drawImage(t,0,0,t.width,t.height,0,0,o,l);for(;o>2*i.width;){h.drawImage(d,0,0,o,l,0,0,o>>1,l>>1);o>>=1;l>>=1}a.drawImage(d,0,0,o,l,0,0,i.width,i.height);return i}},{key:"_thumbPageTitle",get:function get(){var t;return this.l10n.get("thumb_page_title",{page:null!==(t=this.pageLabel)&&void 0!==t?t:this.id})}},{key:"_thumbPageCanvas",get:function get(){var t;return this.l10n.get("thumb_page_canvas",{page:null!==(t=this.pageLabel)&&void 0!==t?t:this.id})}},{key:"setPageLabel",value:function setPageLabel(t){var r=this;this.pageLabel="string"==typeof t?t:null;this._thumbPageTitle.then((function(t){r.anchor.title=t}));this.renderingState===u.RenderingStates.FINISHED&&this._thumbPageCanvas.then((function(t){var a;null===(a=r.image)||void 0===a||a.setAttribute("aria-label",t)}))}}]);return PDFThumbnailView}();r.PDFThumbnailView=d},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFViewer=void 0;var i=a(6),o=a(32),l=a(7);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var u=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}(PDFViewer,t);var r=_createSuper(PDFViewer);function PDFViewer(){_classCallCheck(this,PDFViewer);return r.apply(this,arguments)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFViewer,[{key:"_viewerElement",get:function get(){return(0,l.shadow)(this,"_viewerElement",this.viewer)}},{key:"_scrollIntoView",value:function _scrollIntoView(t){var r=t.pageDiv,a=t.pageSpot,i=void 0===a?null:a,o=t.pageNumber,l=void 0===o?null:o;if(!i&&!this.isInPresentationMode){var u=r.offsetLeft+r.clientLeft,c=u+r.clientWidth,d=this.container,h=d.scrollLeft,p=d.clientWidth;(this._isScrollModeHorizontal||u<h||c>h+p)&&(i={left:0,top:0})}_get(_getPrototypeOf(PDFViewer.prototype),"_scrollIntoView",this).call(this,{pageDiv:r,pageSpot:i,pageNumber:l})}},{key:"_getVisiblePages",value:function _getVisiblePages(){return this.isInPresentationMode?this._getCurrentVisiblePage():_get(_getPrototypeOf(PDFViewer.prototype),"_getVisiblePages",this).call(this)}},{key:"_updateHelper",value:function _updateHelper(t){if(!this.isInPresentationMode){var r,a=this._currentPageNumber,o=!1,l=_createForOfIteratorHelper(t);try{for(l.s();!(r=l.n()).done;){var u=r.value;if(u.percent<100)break;if(u.id===a&&this._scrollMode===i.ScrollMode.VERTICAL&&this._spreadMode===i.SpreadMode.NONE){o=!0;break}}}catch(t){l.e(t)}finally{l.f()}if(!o){t.some((function(t){return a===t.id}))||(a=t[0].id)}this._setCurrentPageNumber(a)}}}]);return PDFViewer}(o.BaseViewer);r.PDFViewer=u},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.BaseViewer=void 0;var i=a(7),o=a(6),l=a(10),u=a(33),c=a(34),d=a(35),h=a(36),p=a(23),m=a(151),g=a(152),v=a(153);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function PDFPageViewBuffer(t){var r=[];this.push=function(a){var i=r.indexOf(a);i>=0&&r.splice(i,1);r.push(a);r.length>t&&r.shift().destroy()};this.resize=function(a,i){t=a;if(i){for(var l=new Set,u=0,c=i.length;u<c;++u)l.add(i[u].id);(0,o.moveToEndOfArray)(r,(function(t){return l.has(t.id)}))}for(;r.length>t;)r.shift().destroy()};this.has=function(t){return r.includes(t)}}function isSameScale(t,r){return r===t||Math.abs(r-t)<1e-15}var y=function(){function BaseViewer(t){var r,a,u=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BaseViewer);if(this.constructor===BaseViewer)throw new Error("Cannot initialize BaseViewer.");var d="2.10.562";if(i.version!==d)throw new Error('The API version "'.concat(i.version,'" does not match the Viewer version "').concat(d,'".'));this._name=this.constructor.name;this.container=t.container;this.viewer=t.viewer||t.container.firstElementChild;this.pageViewMode=t.pageViewMode||"single";if("DIV"!==(null===(r=this.container)||void 0===r?void 0:r.tagName.toUpperCase())||"DIV"!==(null===(a=this.viewer)||void 0===a?void 0:a.tagName.toUpperCase()))throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.eventBus=t.eventBus;this.linkService=t.linkService||new p.SimpleLinkService;this.downloadManager=t.downloadManager||null;this.findController=t.findController||null;this._scriptingManager=t.scriptingManager||null;this.removePageBorders=t.removePageBorders||!1;this.textLayerMode=Number.isInteger(t.textLayerMode)?t.textLayerMode:o.TextLayerMode.ENABLE;this.imageResourcesPath=t.imageResourcesPath||"";this.renderInteractiveForms=!1!==t.renderInteractiveForms;this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1;this.renderer=t.renderer||o.RendererType.CANVAS;this.useOnlyCssZoom=t.useOnlyCssZoom||!1;this.maxCanvasPixels=t.maxCanvasPixels;this.l10n=t.l10n||c.NullL10n;this.enableScripting=!0===t.enableScripting&&!!this._scriptingManager;this.defaultRenderingQueue=!t.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new l.PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=t.renderingQueue;this.scroll=(0,o.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=o.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");Promise.resolve().then((function(){u.eventBus.dispatch("baseviewerinit",{source:u})}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(BaseViewer,[{key:"pagesCount",get:function get(){return this._pages.length}},{key:"getPageView",value:function getPageView(t){return this._pages[t]}},{key:"pageViewsReady",get:function get(){return!!this._pagesCapability.settled&&this._pages.every((function(t){return null==t?void 0:t.pdfPage}))}},{key:"currentPageNumber",get:function get(){return this._currentPageNumber},set:function set(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");if(this.pdfDocument){var r=Math.abs(this._currentPageNumber-t)<2;this._setCurrentPageNumber(t,!0)||console.error("".concat(this._name,'.currentPageNumber: "').concat(t,'" is not a valid page.'));if(this.pageFlip)if(r){console.log("Flip");this.pageFlip.flip(t-1)}else{console.log("turn to page");this.pageFlip.turnToPage(t-1)}}}},{key:"hidePagesDependingOnpageViewMode",value:function hidePagesDependingOnpageViewMode(){var t=this;if("single"===this.pageViewMode){this._pages.forEach((function(t){t.div.style.display="none"}));this._pages.forEach((function(r){if(r.id===t.currentPageNumber){r.div.style.display="inline-block";r.div.parentElement.classList.contains("spread")&&r.div.parentElement.childNodes.forEach((function(t,r){t.style.display="inline-block"}))}}))}else"book"===this.pageViewMode&&(this.pageFlip||setTimeout((function(){if(!t.pageFlip){var r=t._pages[0].div,a=r.parentElement,i=a.parentElement;i.style.width=2*r.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";t.pageFlip=new d.PageFlip(a,{width:r.clientWidth,height:r.clientHeight,showCover:!0,size:"fixed"});t.pageFlip.loadFromHTML(document.querySelectorAll(".page"));t.ensureAdjecentPagesAreLoaded();t.pageFlip.on("flip",(function(r){t._currentPageNumber!==r.data+1&&t._setCurrentPageNumber(r.data+1,!1)}))}}),100))}},{key:"_setCurrentPageNumber",value:function _setCurrentPageNumber(t){var r,a,i=this,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._currentPageNumber===t){o&&this._resetCurrentPageView();return!0}if(!(0<t&&t<=this.pagesCount))return!1;var l=this._currentPageNumber;this._currentPageNumber=t;this.hidePagesDependingOnpageViewMode();if("single"===this.pageViewMode||"book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){var u=this._pages[this.currentPageNumber-1];if(u.div.parentElement.classList.contains("spread"))u.div.parentElement.childNodes.forEach((function(t){var r=Number(t.getAttribute("data-page-number")),a=i._pages[r-1];i._ensurePdfPageLoaded(a).then((function(){i.renderingQueue.renderView(a)}));t.style.display="inline-block"}));else{this._ensurePdfPageLoaded(u).then((function(){i.renderingQueue.renderView(u)}));"book"===this.pageViewMode&&this.ensureAdjecentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:null!==(r=null===(a=this._pageLabels)||void 0===a?void 0:a[t-1])&&void 0!==r?r:null,previous:l});o&&this._resetCurrentPageView();return!0}},{key:"addPageToRenderQueue",value:function addPageToRenderQueue(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(r>=0&&r<=this._pages.length-1){var a=this._pages[r],i=a.div.querySelector(".loadingIcon");if(i){this._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}));return!0}}return!1}},{key:"ensureAdjecentPagesAreLoaded",value:function ensureAdjecentPagesAreLoaded(){var t=this;if(!window.adjacentPagesLoader){window.adjacentPagesLoader=function(r){console.log("rendered",r);var a=t._pages[Math.min(t._pages.length-1,t.currentPageNumber)],i=a.div.querySelector(".loadingIcon");if(i){console.log("asking for the next page");t._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}))}else if(i=(a=t._pages[Math.min(t._pages.length-1,t.currentPageNumber+1)]).div.querySelector(".loadingIcon")){console.log("asking for the next + 1 page");t._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}))}else if(i=(a=t._pages[Math.min(t._pages.length-1,t.currentPageNumber+2)]).div.querySelector(".loadingIcon")){console.log("asking for the next + 2 page");t._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}))}else if(i=(a=t._pages[Math.min(t._pages.length-1,t.currentPageNumber+3)]).div.querySelector(".loadingIcon")){console.log("asking for the next + 3 page");t._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}))}else if(i=(a=t._pages[Math.max(0,t.currentPageNumber-1)]).div.querySelector(".loadingIcon")){console.log("asking for the current page");t._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}))}else if(i=(a=t._pages[Math.max(0,t.currentPageNumber-2)]).div.querySelector(".loadingIcon")){console.log("asking for the previous page");t._ensurePdfPageLoaded(a).then((function(){t.renderingQueue.renderView(a)}))}else console.log("Finished preloading the pages")};this.eventBus._on("pagerendered",window.adjacentPagesLoader)}window.adjacentPagesLoader()}},{key:"currentPageLabel",get:function get(){var t,r;return null!==(t=null===(r=this._pageLabels)||void 0===r?void 0:r[this._currentPageNumber-1])&&void 0!==t?t:null},set:function set(t){if(this.pdfDocument){var r=0|t;if(this._pageLabels){var a=this._pageLabels.indexOf(t);a>=0&&(r=a+1)}this._setCurrentPageNumber(r,!0)||console.error("".concat(this._name,'.currentPageLabel: "').concat(t,'" is not a valid page.'))}}},{key:"currentScale",get:function get(){return this._currentScale!==o.UNKNOWN_SCALE?this._currentScale:o.DEFAULT_SCALE},set:function set(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(t,"single"===this.pageViewMode)}},{key:"currentScaleValue",get:function get(){return this._currentScaleValue},set:function set(t){this.pdfDocument&&this._setScale(t,"single"===this.pageViewMode)}},{key:"pagesRotation",get:function get(){return this._pagesRotation},set:function set(t){if(!(0,o.isValidRotation)(t))throw new Error("Invalid pages rotation angle.");if(this.pdfDocument){(t%=360)<0&&(t+=360);if(this._pagesRotation!==t){this._pagesRotation=t;for(var r=this._currentPageNumber,a=0,i=this._pages.length;a<i;a++){var l=this._pages[a];l.update(l.scale,t)}this._currentScaleValue&&this._setScale(this._currentScaleValue,!0);this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:r});this.defaultRenderingQueue&&this.update()}}}},{key:"firstPagePromise",get:function get(){return this.pdfDocument?this._firstPageCapability.promise:null}},{key:"onePageRendered",get:function get(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}},{key:"pagesPromise",get:function get(){return this.pdfDocument?this._pagesCapability.promise:null}},{key:"_viewerElement",get:function get(){throw new Error("Not implemented: _viewerElement")}},{key:"_onePageRenderedOrForceFetch",value:function _onePageRenderedOrForceFetch(){return this.container.offsetParent&&0!==this._getVisiblePages().views.length?this._onePageRenderedCapability.promise:Promise.resolve()}},{key:"setDocument",value:function setDocument(t){var r=this;if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController&&this.findController.setDocument(null);this._scriptingManager&&this._scriptingManager.setDocument(null)}this.pdfDocument=t;if(t){var a=t.isPureXfa,i=t.numPages,l=t.getPage(1),u=t.getOptionalContentConfig();this._pagesCapability.promise.then((function(){r.eventBus.dispatch("pagesloaded",{source:r,pagesCount:i})}));this._onBeforeDraw=function(t){var a=r._pages[t.pageNumber-1];a&&r._buffer.push(a)};this.eventBus._on("pagerender",this._onBeforeDraw);this._onAfterDraw=function(t){if(!t.cssTransform&&!r._onePageRenderedCapability.settled){r._onePageRenderedCapability.resolve();r.eventBus._off("pagerendered",r._onAfterDraw);r._onAfterDraw=null}};this.eventBus._on("pagerendered",this._onAfterDraw);l.then((function(l){r._firstPageCapability.resolve(l);r._optionalContentConfigPromise=u;for(var c=r.currentScale,d=l.getViewport({scale:c*o.CSS_UNITS}),p=r.textLayerMode!==o.TextLayerMode.DISABLE?r:null,m=a?r:null,g=1;g<=i;++g){var v=new h.PDFPageView({container:r._viewerElement,eventBus:r.eventBus,id:g,scale:c,defaultViewport:d.clone(),optionalContentConfigPromise:u,renderingQueue:r.renderingQueue,textLayerFactory:p,textLayerMode:r.textLayerMode,annotationLayerFactory:r,xfaLayerFactory:m,structTreeLayerFactory:r,imageResourcesPath:r.imageResourcesPath,removePageBorders:r.removePageBorders,renderInteractiveForms:r.renderInteractiveForms,renderer:r.renderer,useOnlyCssZoom:r.useOnlyCssZoom,maxCanvasPixels:r.maxCanvasPixels,l10n:r.l10n});r._pages.push(v)}var y=r._pages[0];if(y){y.setPdfPage(l);r.linkService.cachePageRef(1,l.ref)}r._spreadMode!==o.SpreadMode.NONE&&r._updateSpreadMode();r._onePageRenderedOrForceFetch().then((function(){r.findController&&r.findController.setDocument(t);r.enableScripting&&r._scriptingManager.setDocument(t);if(t.loadingParams.disableAutoFetch||i>7500)r._pagesCapability.resolve();else{var a=i-1;if(a<=0)r._pagesCapability.resolve();else for(var o=function _loop(i){t.getPage(i).then((function(t){var o=r._pages[i-1];o.pdfPage||o.setPdfPage(t);r.linkService.cachePageRef(i,t.ref);0==--a&&r._pagesCapability.resolve()}),(function(t){console.error("Unable to get page ".concat(i," to initialize viewer"),t);0==--a&&r._pagesCapability.resolve()}))},l=2;l<=i;++l)o(l)}}));r.hidePagesDependingOnpageViewMode();r.eventBus.dispatch("pagesinit",{source:r});r.defaultRenderingQueue&&r.update()})).catch((function(t){console.error("Unable to initialize viewer",t)}))}}},{key:"setPageLabels",value:function setPageLabels(t){if(this.pdfDocument){if(t)if(Array.isArray(t)&&this.pdfDocument.numPages===t.length)this._pageLabels=t;else{this._pageLabels=null;console.error("".concat(this._name,".setPageLabels: Invalid page labels."))}else this._pageLabels=null;for(var r=0,a=this._pages.length;r<a;r++){var i,o;this._pages[r].setPageLabel(null!==(i=null===(o=this._pageLabels)||void 0===o?void 0:o[r])&&void 0!==i?i:null)}}}},{key:"_resetView",value:function _resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=o.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;var t=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10;this._buffer=new PDFPageViewBuffer(t);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._pagesRequests=new WeakMap;this._firstPageCapability=(0,i.createPromiseCapability)();this._onePageRenderedCapability=(0,i.createPromiseCapability)();this._pagesCapability=(0,i.createPromiseCapability)();this._scrollMode=o.ScrollMode.VERTICAL;this._spreadMode=o.SpreadMode.NONE;if(this._onBeforeDraw){this.eventBus._off("pagerender",this._onBeforeDraw);this._onBeforeDraw=null}if(this._onAfterDraw){this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}this.viewer.textContent="";this._updateScrollMode()}},{key:"_scrollUpdate",value:function _scrollUpdate(){0!==this.pagesCount&&this.update()}},{key:"_scrollIntoView",value:function _scrollIntoView(t){var r=t.pageDiv,a=t.pageSpot,i=void 0===a?null:a;t.pageNumber;"single"===this.pageViewMode&&this._pages.forEach((function(){r.style.display="inline-block"}));(0,o.scrollIntoView)(r,i,!1,"infinite-scroll"===this.pageViewMode)}},{key:"_setScaleUpdatePages",value:function _setScaleUpdatePages(t,r){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._currentScaleValue=r.toString();if(isSameScale(this._currentScale,t))i&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:r});else{for(var o=0,l=this._pages.length;o<l;o++)this._pages[o].update(t);this._currentScale=t;if(!a){var u,c=this._currentPageNumber;if(this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode){c=this._location.pageNumber;u=[null,{name:"XYZ"},this._location.left,this._location.top,null]}this.scrollPageIntoView({pageNumber:c,destArray:u,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:i?r:void 0});this.defaultRenderingQueue&&this.update()}}},{key:"_pageWidthScaleFactor",get:function get(){return this._spreadMode===o.SpreadMode.NONE||this._scrollMode===o.ScrollMode.HORIZONTAL||this.isInPresentationMode?1:2}},{key:"_setScale",value:function _setScale(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===t&&(t="auto");var a=parseFloat(t);if(a>0)this._setScaleUpdatePages(a,t,r,!1);else{var i=this._pages[this._currentPageNumber-1];if(!i)return;var l=this.isInPresentationMode||this.removePageBorders,u=o.VERTICAL_PADDING;"single"===this.pageViewMode&&(u+=15);var c=l?0:o.SCROLLBAR_PADDING,d=l?"single"===this.pageViewMode?10:0:u;if(!l&&this._isScrollModeHorizontal){var h=[d,c];c=h[0];d=h[1]}var p=(this.container.clientWidth-c)/i.width*i.scale/this._pageWidthScaleFactor,m=(this.container.clientHeight-d)/i.height*i.scale;switch(t){case"page-actual":a=1;break;case"page-width":a=p;break;case"page-height":a=m;break;case"page-fit":a=Math.min(p,m);break;case"auto":var g=(0,o.isPortraitOrientation)(i)?p:Math.min(m,p);a=Math.min(o.MAX_AUTO_SCALE,g);break;default:console.error("".concat(this._name,'._setScale: "').concat(t,'" is an unknown zoom value.'));return}this._setScaleUpdatePages(a,t,r,!0)}}},{key:"_resetCurrentPageView",value:function _resetCurrentPageView(){this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0);var t=this._pages[this._currentPageNumber-1];this._scrollIntoView({pageDiv:t.div})}},{key:"pageLabelToPageNumber",value:function pageLabelToPageNumber(t){if(!this._pageLabels)return null;var r=this._pageLabels.indexOf(t);return r<0?null:r+1}},{key:"scrollPageIntoView",value:function scrollPageIntoView(t){var r=this,a=t.pageNumber,i=t.destArray,l=void 0===i?null:i,u=t.allowNegativeOffset,c=void 0!==u&&u,d=t.ignoreDestinationZoom,h=void 0!==d&&d;if(this.pdfDocument){var p=Number.isInteger(a)&&this._pages[a-1];if(p)if(!this.isInPresentationMode&&l){var m,g,v=0,y=0,b=0,S=0,w=p.rotation%180!=0,C=(w?p.height:p.width)/p.scale/o.CSS_UNITS,P=(w?p.width:p.height)/p.scale/o.CSS_UNITS,k=0;switch(l[1].name){case"XYZ":v=l[2];y=l[3];k=l[4];v=null!==v?v:0;y=null!==y?y:P;break;case"Fit":case"FitB":k="page-fit";break;case"FitH":case"FitBH":k="page-width";if(null===(y=l[2])&&this._location){v=this._location.left;y=this._location.top}else"number"!=typeof y&&(y=P);break;case"FitV":case"FitBV":v=l[2];b=C;S=P;k="page-height";break;case"FitR":v=l[2];y=l[3];b=l[4]-v;S=l[5]-y;var R=this.removePageBorders?0:o.SCROLLBAR_PADDING,A=this.removePageBorders?0:o.VERTICAL_PADDING;m=(this.container.clientWidth-R)/b/o.CSS_UNITS;g=(this.container.clientHeight-A)/S/o.CSS_UNITS;k=Math.min(Math.abs(m),Math.abs(g));break;default:console.error("".concat(this._name,".scrollPageIntoView: ")+'"'.concat(l[1].name,'" is not a valid destination type.'));return}h||(k&&k!==this._currentScale?this.currentScaleValue=k:this._currentScale===o.UNKNOWN_SCALE&&(this.currentScaleValue=o.DEFAULT_SCALE_VALUE));this._ensurePdfPageLoaded(p).then((function(){r.renderingQueue.renderView(p);r.currentPageNumber!==a&&(r.currentPageNumber=a)}));if("page-fit"!==k||l[4]){var x=[p.viewport.convertToViewportPoint(v,y),p.viewport.convertToViewportPoint(v+b,y+S)],T=Math.min(x[0][0],x[1][0]),E=Math.min(x[0][1],x[1][1]);if(!c){T=Math.max(T,0);E=Math.max(E,0)}this._scrollIntoView({pageDiv:p.div,pageSpot:{left:T,top:E},pageNumber:a})}else this._scrollIntoView({pageDiv:p.div,pageNumber:a})}else this._setCurrentPageNumber(a,!0);else console.error("".concat(this._name,".scrollPageIntoView: ")+'"'.concat(a,'" is not a valid pageNumber parameter.'))}}},{key:"_updateLocation",value:function _updateLocation(t){var r=this._currentScale,a=this._currentScaleValue,i=parseFloat(a)===r?Math.round(1e4*r)/100:a,o=t.id,l="#page="+o;l+="&zoom="+i;var u=this._pages[o-1],c=this.container,d=u.getPagePoint(c.scrollLeft-t.x,c.scrollTop-t.y),h=Math.round(d[0]),p=Math.round(d[1]);l+=","+h+","+p;this._location={pageNumber:o,scale:i,top:p,left:h,rotation:this._pagesRotation,pdfOpenParams:l}}},{key:"_updateHelper",value:function _updateHelper(t){throw new Error("Not implemented: _updateHelper")}},{key:"update",value:function update(){var t=this._getVisiblePages(),r=t.views,a=r.length;if(0!==a){var i=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10,o=Math.max(i,2*a+1);this._buffer.resize(o,r);this.renderingQueue.renderHighestPriority(t);this._updateHelper(r);this._updateLocation(t.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location});this.hidePagesDependingOnpageViewMode()}}},{key:"containsElement",value:function containsElement(t){return this.container.contains(t)}},{key:"focus",value:function focus(){this.container.focus()}},{key:"_isScrollModeHorizontal",get:function get(){return!this.isInPresentationMode&&this._scrollMode===o.ScrollMode.HORIZONTAL}},{key:"_isContainerRtl",get:function get(){return"rtl"===getComputedStyle(this.container).direction}},{key:"isInPresentationMode",get:function get(){return this.presentationModeState===o.PresentationModeState.FULLSCREEN}},{key:"isChangingPresentationMode",get:function get(){return this.presentationModeState===o.PresentationModeState.CHANGING}},{key:"isHorizontalScrollbarEnabled",get:function get(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}},{key:"isVerticalScrollbarEnabled",get:function get(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}},{key:"_getCurrentVisiblePage",value:function _getCurrentVisiblePage(){if(!this.pagesCount)return{views:[]};var t=this._pages[this._currentPageNumber-1],r=t.div,a={id:t.id,x:r.offsetLeft+r.clientLeft,y:r.offsetTop+r.clientTop,view:t};return{first:a,last:a,views:[a]}}},{key:"_getVisiblePages",value:function _getVisiblePages(){var t=this;if("single"===this.pageViewMode){if(!this.pagesCount)return{views:[]};var r=this._pages[this._currentPageNumber-1];if(r.div.parentElement.classList.contains("spread")){var a=[];r.div.parentElement.childNodes.forEach((function(r){var i=Number(r.getAttribute("data-page-number")),o=t._pages[i-1],l=o.div,u={id:o.id,x:l.offsetLeft+l.clientLeft,y:l.offsetTop+l.clientTop,view:o};a.push(u)}));return{first:a[0],last:a[a.length-1],views:a}}return this._getCurrentVisiblePage()}return(0,o.getVisibleElements)({scrollEl:this.container,views:this._pages,sortByVisibility:!0,horizontal:this._isScrollModeHorizontal,rtl:this._isScrollModeHorizontal&&this._isContainerRtl})}},{key:"isPageVisible",value:function isPageVisible(t){if(!this.pdfDocument)return!1;if(!(Number.isInteger(t)&&t>0&&t<=this.pagesCount)){console.error("".concat(this._name,'.isPageVisible: "').concat(t,'" is not a valid page.'));return!1}return this._getVisiblePages().views.some((function(r){return r.id===t}))}},{key:"isPageCached",value:function isPageCached(t){if(!this.pdfDocument||!this._buffer)return!1;if(!(Number.isInteger(t)&&t>0&&t<=this.pagesCount)){console.error("".concat(this._name,'.isPageCached: "').concat(t,'" is not a valid page.'));return!1}var r=this._pages[t-1];return!!r&&this._buffer.has(r)}},{key:"cleanup",value:function cleanup(){for(var t=0,r=this._pages.length;t<r;t++)this._pages[t]&&this._pages[t].renderingState!==l.RenderingStates.FINISHED&&this._pages[t].reset()}},{key:"_cancelRendering",value:function _cancelRendering(){for(var t=0,r=this._pages.length;t<r;t++)this._pages[t]&&this._pages[t].cancelRendering()}},{key:"_ensurePdfPageLoaded",value:function _ensurePdfPageLoaded(t){var r=this;if(t.pdfPage)return Promise.resolve(t.pdfPage);if(this._pagesRequests.has(t))return this._pagesRequests.get(t);var a=this.pdfDocument.getPage(t.id).then((function(a){t.pdfPage||t.setPdfPage(a);r._pagesRequests.delete(t);return a})).catch((function(a){console.error("Unable to get page for page view",a);r._pagesRequests.delete(t)}));this._pagesRequests.set(t,a);return a}},{key:"forceRendering",value:function forceRendering(t){var r=this,a=t||this._getVisiblePages(),i=this._isScrollModeHorizontal?this.scroll.right:this.scroll.down,o=this.renderingQueue.getHighestPriority(a,this._pages,i);if(o){this._ensurePdfPageLoaded(o).then((function(){r.renderingQueue.renderView(o)}));return!0}return!1}},{key:"createTextLayerBuilder",value:function createTextLayerBuilder(t,r,a){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;return new g.TextLayerBuilder({textLayerDiv:t,eventBus:o,pageIndex:r,viewport:a,findController:this.isInPresentationMode?null:this.findController,enhanceTextSelection:!this.isInPresentationMode&&i})}},{key:"createAnnotationLayerBuilder",value:function createAnnotationLayerBuilder(t,r){var a,i,o,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",h=arguments.length>4&&void 0!==arguments[4]&&arguments[4],p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:c.NullL10n,m=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,g=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,v=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null;return new u.AnnotationLayerBuilder({pageDiv:t,pdfPage:r,annotationStorage:l||(null===(a=this.pdfDocument)||void 0===a?void 0:a.annotationStorage),imageResourcesPath:d,renderInteractiveForms:h,linkService:this.linkService,downloadManager:this.downloadManager,l10n:p,enableScripting:null!=m?m:this.enableScripting,hasJSActionsPromise:g||(null===(i=this.pdfDocument)||void 0===i?void 0:i.hasJSActions()),mouseState:v||(null===(o=this._scriptingManager)||void 0===o?void 0:o.mouseState)})}},{key:"createXfaLayerBuilder",value:function createXfaLayerBuilder(t,r){var a,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new v.XfaLayerBuilder({pageDiv:t,pdfPage:r,annotationStorage:i||(null===(a=this.pdfDocument)||void 0===a?void 0:a.annotationStorage)})}},{key:"createStructTreeLayerBuilder",value:function createStructTreeLayerBuilder(t){return new m.StructTreeLayerBuilder({pdfPage:t})}},{key:"hasEqualPageSizes",get:function get(){for(var t=this._pages[0],r=1,a=this._pages.length;r<a;++r){var i=this._pages[r];if(i.width!==t.width||i.height!==t.height)return!1}return!0}},{key:"getPagesOverview",value:function getPagesOverview(){var t=this;return this._pages.map((function(r){var a=r.pdfPage.getViewport({scale:1});return!t.enablePrintAutoRotate||(0,o.isPortraitOrientation)(a)?{width:a.width,height:a.height,rotation:a.rotation}:{width:a.height,height:a.width,rotation:(a.rotation-90)%360}}))}},{key:"optionalContentConfigPromise",get:function get(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:this.pdfDocument.getOptionalContentConfig():Promise.resolve(null)},set:function set(t){if(!(t instanceof Promise))throw new Error("Invalid optionalContentConfigPromise: ".concat(t));if(this.pdfDocument&&this._optionalContentConfigPromise){this._optionalContentConfigPromise=t;var r,a=_createForOfIteratorHelper(this._pages);try{for(a.s();!(r=a.n()).done;){var i=r.value;i.update(i.scale,i.rotation,t)}}catch(t){a.e(t)}finally{a.f()}this.update();this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t})}}},{key:"scrollMode",get:function get(){return this._scrollMode},set:function set(t){if(this._scrollMode!==t){if(!(0,o.isValidScrollMode)(t))throw new Error("Invalid scroll mode: ".concat(t));this._scrollMode=t;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t});this._updateScrollMode(this._currentPageNumber)}}},{key:"_updateScrollMode",value:function _updateScrollMode(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=this._scrollMode,a=this.viewer;a.classList.toggle("scrollHorizontal",r===o.ScrollMode.HORIZONTAL);a.classList.toggle("scrollWrapped",r===o.ScrollMode.WRAPPED);if(this.pdfDocument&&t){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(t,!0);this.update()}}},{key:"spreadMode",get:function get(){return this._spreadMode},set:function set(t){if(this._spreadMode!==t){if(!(0,o.isValidSpreadMode)(t))throw new Error("Invalid spread mode: ".concat(t));this._spreadMode=t;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t});this._updateSpreadMode(this._currentPageNumber)}}},{key:"_updateSpreadMode",value:function _updateSpreadMode(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.pdfDocument){var r=this.viewer,a=this._pages;r.textContent="";if(this._spreadMode===o.SpreadMode.NONE)for(var i=0,l=a.length;i<l;++i)r.appendChild(a[i].div);else for(var u=this._spreadMode-1,c=null,d=0,h=a.length;d<h;++d){if(null===c){(c=document.createElement("div")).className="spread";r.appendChild(c)}else if(d%2===u){c=c.cloneNode(!1);r.appendChild(c)}c.appendChild(a[d].div)}this.hidePagesDependingOnpageViewMode();if(t){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(t,!0);this.update()}}}},{key:"_getPageAdvance",value:function _getPageAdvance(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isInPresentationMode)return 1;switch(this._scrollMode){case o.ScrollMode.WRAPPED:var a,i=this._getVisiblePages(),l=i.views,u=new Map,c=_createForOfIteratorHelper(l);try{for(c.s();!(a=c.n()).done;){var d=a.value,h=d.id,p=d.y,m=d.percent,g=d.widthPercent;if(!(0===m||g<100)){var v=u.get(p);v||u.set(p,v||(v=[]));v.push(h)}}}catch(t){c.e(t)}finally{c.f()}var y,b=_createForOfIteratorHelper(u.values());try{for(b.s();!(y=b.n()).done;){var S=y.value,w=S.indexOf(t);if(-1!==w){var C=S.length;if(1===C)break;if(r)for(var P=w-1,k=0;P>=k;P--){var R=S[P],A=S[P+1]-1;if(R<A)return t-A}else for(var x=w+1,T=C;x<T;x++){var E=S[x],I=S[x-1]+1;if(E>I)return I-t}if(r){var O=S[0];if(O<t)return t-O+1}else{var D=S[C-1];if(D>t)return D-t+1}break}}}catch(t){b.e(t)}finally{b.f()}break;case o.ScrollMode.HORIZONTAL:break;case o.ScrollMode.VERTICAL:if(this._spreadMode===o.SpreadMode.NONE)break;if("single"===this.pageViewMode)return 2;var L=this._spreadMode-1;if(r&&t%2!==L)break;if(!r&&t%2===L)break;var M,B=this._getVisiblePages(),W=B.views,N=r?t-1:t+1,j=_createForOfIteratorHelper(W);try{for(j.s();!(M=j.n()).done;){var V=M.value,U=V.id,q=V.percent,z=V.widthPercent;if(U===N){if(q>0&&100===z)return 2;break}}}catch(t){j.e(t)}finally{j.f()}}return 1}},{key:"nextPage",value:function nextPage(){var t=this._currentPageNumber,r=this.pagesCount;if(t>=r)return!1;var a=this._getPageAdvance(t,!1)||1;this.currentPageNumber=Math.min(t+a,r);return!0}},{key:"previousPage",value:function previousPage(){var t=this._currentPageNumber;if(t<=1)return!1;var r=this._getPageAdvance(t,!0)||1;this.currentPageNumber=Math.max(t-r,1);return!0}}]);return BaseViewer}();r.BaseViewer=y},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.DefaultAnnotationLayerFactory=r.AnnotationLayerBuilder=void 0;var i=a(7),o=a(34),l=a(23);function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var u=function(){function AnnotationLayerBuilder(t){var r=t.pageDiv,a=t.pdfPage,i=t.linkService,l=t.downloadManager,u=t.annotationStorage,c=void 0===u?null:u,d=t.imageResourcesPath,h=void 0===d?"":d,p=t.renderInteractiveForms,m=void 0===p||p,g=t.l10n,v=void 0===g?o.NullL10n:g,y=t.enableScripting,b=void 0!==y&&y,S=t.hasJSActionsPromise,w=void 0===S?null:S,C=t.mouseState,P=void 0===C?null:C;_classCallCheck(this,AnnotationLayerBuilder);this.pageDiv=r;this.pdfPage=a;this.linkService=i;this.downloadManager=l;this.imageResourcesPath=h;this.renderInteractiveForms=m;this.l10n=v;this.annotationStorage=c;this.enableScripting=b;this._hasJSActionsPromise=w;this._mouseState=P;this.div=null;this._cancelled=!1}_createClass(AnnotationLayerBuilder,[{key:"render",value:function render(t){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"display";return Promise.all([this.pdfPage.getAnnotations({intent:a}),this._hasJSActionsPromise]).then((function(a){var o=_slicedToArray(a,2),l=o[0],u=o[1],c=void 0!==u&&u;if(!r._cancelled&&0!==l.length){var d={viewport:t.clone({dontFlip:!0}),div:r.div,annotations:l,page:r.pdfPage,imageResourcesPath:r.imageResourcesPath,removePageBorders:r.removePageBorders,renderInteractiveForms:r.renderInteractiveForms,linkService:r.linkService,downloadManager:r.downloadManager,annotationStorage:r.annotationStorage,enableScripting:r.enableScripting,hasJSActions:c,mouseState:r._mouseState};if(r.div)i.AnnotationLayer.update(d);else{r.div=document.createElement("div");r.div.className="annotationLayer";r.pageDiv.appendChild(r.div);d.div=r.div;i.AnnotationLayer.render(d);r.l10n.translate(r.div)}}}))}},{key:"cancel",value:function cancel(){this._cancelled=!0}},{key:"hide",value:function hide(){this.div&&(this.div.hidden=!0)}}]);return AnnotationLayerBuilder}();r.AnnotationLayerBuilder=u;var c=function(){function DefaultAnnotationLayerFactory(){_classCallCheck(this,DefaultAnnotationLayerFactory)}_createClass(DefaultAnnotationLayerFactory,[{key:"createAnnotationLayerBuilder",value:function createAnnotationLayerBuilder(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",c=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],d=arguments.length>5&&void 0!==arguments[5]?arguments[5]:o.NullL10n,h=arguments.length>6&&void 0!==arguments[6]&&arguments[6],p=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,m=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null;return new u({pageDiv:t,pdfPage:r,imageResourcesPath:i,renderInteractiveForms:c,linkService:new l.SimpleLinkService,l10n:d,annotationStorage:a,enableScripting:h,hasJSActionsPromise:p,mouseState:m})}}]);return DefaultAnnotationLayerFactory}();r.DefaultAnnotationLayerFactory=c},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.fixupLangCode=function fixupLangCode(t){return l[null==t?void 0:t.toLowerCase()]||t};r.getL10nFallback=getL10nFallback;r.NullL10n=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4));function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}var o={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",print_progress_percent:"{{progress}}%","toggle_sidebar.title":"Toggle Sidebar","toggle_sidebar_notification2.title":"Toggle Sidebar (document contains outline/attachments/layers)",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",error_version_info:"PDF.js v{{version}} (build: {{build}})",error_message:"Message: {{message}}",error_stack:"Stack: {{stack}}",error_file:"File: {{file}}",error_line:"Line: {{line}}",rendering_error:"An error occurred while rendering the page.",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading:"Loading…",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts."};function getL10nFallback(t,r){switch(t){case"find_match_count":t="find_match_count[".concat(1===r.total?"one":"other","]");break;case"find_match_count_limit":t="find_match_count_limit[".concat(1===r.limit?"one":"other","]")}return o[t]||""}var l={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"};function formatL10nValue(t,r){return r?t.replace(/\{\{\s*(\w+)\s*\}\}/g,(function(t,a){return a in r?r[a]:"{{"+a+"}}"})):t}var u={getLanguage:function getLanguage(){return _asyncToGenerator(i.default.mark((function _callee(){return i.default.wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return","en-us");case 1:case"end":return t.stop()}}),_callee)})))()},getDirection:function getDirection(){return _asyncToGenerator(i.default.mark((function _callee2(){return i.default.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return","ltr");case 1:case"end":return t.stop()}}),_callee2)})))()},get:function get(t){var r=arguments;return _asyncToGenerator(i.default.mark((function _callee3(){var a,o;return i.default.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:a=r.length>1&&void 0!==r[1]?r[1]:null;o=r.length>2&&void 0!==r[2]?r[2]:getL10nFallback(t,a);return i.abrupt("return",formatL10nValue(o,a));case 3:case"end":return i.stop()}}),_callee3)})))()},translate:function translate(t){return _asyncToGenerator(i.default.mark((function _callee4(){return i.default.wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),_callee4)})))()}};r.NullL10n=u},(t,r)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PageFlip=void 0;function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var a=function(){function Page(t,r){_classCallCheck(this,Page);this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0};this.createdDensity=r;this.nowDrawingDensity=this.createdDensity;this.render=t}_createClass(Page,[{key:"setDensity",value:function setDensity(t){this.createdDensity=t;this.nowDrawingDensity=t}},{key:"setDrawingDensity",value:function setDrawingDensity(t){this.nowDrawingDensity=t}},{key:"setPosition",value:function setPosition(t){this.state.position=t}},{key:"setAngle",value:function setAngle(t){this.state.angle=t}},{key:"setArea",value:function setArea(t){this.state.area=t}},{key:"setHardDrawingAngle",value:function setHardDrawingAngle(t){this.state.hardDrawingAngle=t}},{key:"setHardAngle",value:function setHardAngle(t){this.state.hardAngle=t;this.state.hardDrawingAngle=t}},{key:"setOrientation",value:function setOrientation(t){this.orientation=t}},{key:"getDrawingDensity",value:function getDrawingDensity(){return this.nowDrawingDensity}},{key:"getDensity",value:function getDensity(){return this.createdDensity}},{key:"getHardAngle",value:function getHardAngle(){return this.state.hardAngle}}]);return Page}(),i=function(t){_inherits(ImagePage,t);var r=_createSuper(ImagePage);function ImagePage(t,a,i){var o;_classCallCheck(this,ImagePage);(o=r.call(this,t,i)).image=null;o.isLoad=!1;o.loadingAngle=0;o.image=new Image;o.image.src=a;return o}_createClass(ImagePage,[{key:"draw",value:function draw(t){var r=this.render.getContext(),a=this.render.convertToGlobal(this.state.position),i=this.render.getRect().pageWidth,o=this.render.getRect().height;r.save();r.translate(a.x,a.y);r.beginPath();var l,u=_createForOfIteratorHelper(this.state.area);try{for(u.s();!(l=u.n()).done;){var c=l.value;if(null!==c){c=this.render.convertToGlobal(c);r.lineTo(c.x-a.x,c.y-a.y)}}}catch(t){u.e(t)}finally{u.f()}r.rotate(this.state.angle);r.clip();this.isLoad?r.drawImage(this.image,0,0,i,o):this.drawLoader(r,{x:0,y:0},i,o);r.restore()}},{key:"simpleDraw",value:function simpleDraw(t){var r=this.render.getRect(),a=this.render.getContext(),i=r.pageWidth,o=r.height,l=1===t?r.left+r.pageWidth:r.left,u=r.top;this.isLoad?a.drawImage(this.image,l,u,i,o):this.drawLoader(a,{x:l,y:u},i,o)}},{key:"drawLoader",value:function drawLoader(t,r,a,i){t.beginPath();t.strokeStyle="rgb(200, 200, 200)";t.fillStyle="rgb(255, 255, 255)";t.lineWidth=1;t.rect(r.x+1,r.y+1,a-1,i-1);t.stroke();t.fill();var o={x:r.x+a/2,y:r.y+i/2};t.beginPath();t.lineWidth=10;t.arc(o.x,o.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle);t.stroke();t.closePath();this.loadingAngle+=.07;this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}},{key:"load",value:function load(){var t=this;this.isLoad||(this.image.onload=function(){t.isLoad=!0})}},{key:"newTemporaryCopy",value:function newTemporaryCopy(){return this}},{key:"getTemporaryCopy",value:function getTemporaryCopy(){return this}},{key:"hideTemporaryCopy",value:function hideTemporaryCopy(){}}]);return ImagePage}(a),o=function(){function PageCollection(t,r){_classCallCheck(this,PageCollection);this.pages=[];this.currentPageIndex=0;this.currentSpreadIndex=0;this.landscapeSpread=[];this.portraitSpread=[];this.render=r;this.app=t;this.currentPageIndex=0;this.isShowCover=this.app.getSettings().showCover}_createClass(PageCollection,[{key:"destroy",value:function destroy(){this.pages=[]}},{key:"createSpread",value:function createSpread(){this.landscapeSpread=[];this.portraitSpread=[];for(var t=0;t<this.pages.length;t++)this.portraitSpread.push([t]);var r=0;if(this.isShowCover){this.pages[0].setDensity("hard");this.landscapeSpread.push([r]);r++}for(var a=r;a<this.pages.length;a+=2)if(a<this.pages.length-1)this.landscapeSpread.push([a,a+1]);else{this.landscapeSpread.push([a]);this.pages[a].setDensity("hard")}}},{key:"getSpread",value:function getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}},{key:"getSpreadIndexByPage",value:function getSpreadIndexByPage(t){for(var r=this.getSpread(),a=0;a<r.length;a++)if(t===r[a][0]||t===r[a][1])return a;return null}},{key:"getPageCount",value:function getPageCount(){return this.pages.length}},{key:"getPages",value:function getPages(){return this.pages}},{key:"getPage",value:function getPage(t){if(t>=0&&t<this.pages.length)return this.pages[t];throw new Error("Invalid page number")}},{key:"nextBy",value:function nextBy(t){var r=this.pages.indexOf(t);return r<this.pages.length-1?this.pages[r+1]:null}},{key:"prevBy",value:function prevBy(t){var r=this.pages.indexOf(t);return r>0?this.pages[r-1]:null}},{key:"getFlippingPage",value:function getFlippingPage(t){var r=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===t?this.pages[r].newTemporaryCopy():this.pages[r-1];var a=0===t?this.getSpread()[r+1]:this.getSpread()[r-1];return 1===a.length||0===t?this.pages[a[0]]:this.pages[a[1]]}},{key:"getBottomPage",value:function getBottomPage(t){var r=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===t?this.pages[r+1]:this.pages[r-1];var a=0===t?this.getSpread()[r+1]:this.getSpread()[r-1];return 1===a.length?this.pages[a[0]]:0===t?this.pages[a[1]]:this.pages[a[0]]}},{key:"showNext",value:function showNext(){if(this.currentSpreadIndex<this.getSpread().length){this.currentSpreadIndex++;this.showSpread()}}},{key:"showPrev",value:function showPrev(){if(this.currentSpreadIndex>0){this.currentSpreadIndex--;this.showSpread()}}},{key:"getCurrentPageIndex",value:function getCurrentPageIndex(){return this.currentPageIndex}},{key:"show",value:function show(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;null===t&&(t=this.currentPageIndex);if(!(t<0||t>=this.pages.length)){var r=this.getSpreadIndexByPage(t);if(null!==r){this.currentSpreadIndex=r;this.showSpread()}}}},{key:"getCurrentSpreadIndex",value:function getCurrentSpreadIndex(){return this.currentSpreadIndex}},{key:"setCurrentSpreadIndex",value:function setCurrentSpreadIndex(t){if(!(t>=0&&t<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=t}},{key:"showSpread",value:function showSpread(){var t=this.getSpread()[this.currentSpreadIndex];if(2===t.length){this.render.setLeftPage(this.pages[t[0]]);this.render.setRightPage(this.pages[t[1]])}else if("landscape"===this.render.getOrientation())if(t[0]===this.pages.length-1){this.render.setLeftPage(this.pages[t[0]]);this.render.setRightPage(null)}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[t[0]])}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[t[0]])}this.currentPageIndex=t[0];this.app.updatePageIndex(this.currentPageIndex)}}]);return PageCollection}(),l=function(t){_inherits(ImagePageCollection,t);var r=_createSuper(ImagePageCollection);function ImagePageCollection(t,a,i){var o;_classCallCheck(this,ImagePageCollection);(o=r.call(this,t,a)).imagesHref=i;return o}_createClass(ImagePageCollection,[{key:"load",value:function load(){var t,r=_createForOfIteratorHelper(this.imagesHref);try{for(r.s();!(t=r.n()).done;){var a=t.value,o=new i(this.render,a,"soft");o.load();this.pages.push(o)}}catch(t){r.e(t)}finally{r.f()}this.createSpread()}}]);return ImagePageCollection}(o),u=function(){function Helper(){_classCallCheck(this,Helper)}_createClass(Helper,null,[{key:"GetDistanceBetweenTwoPoint",value:function GetDistanceBetweenTwoPoint(t,r){return null===t||null===r?1/0:Math.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2))}},{key:"GetSegmentLength",value:function GetSegmentLength(t){return Helper.GetDistanceBetweenTwoPoint(t[0],t[1])}},{key:"GetAngleBetweenTwoLine",value:function GetAngleBetweenTwoLine(t,r){var a=t[0].y-t[1].y,i=r[0].y-r[1].y,o=t[1].x-t[0].x,l=r[1].x-r[0].x;return Math.acos((a*i+o*l)/(Math.sqrt(a*a+o*o)*Math.sqrt(i*i+l*l)))}},{key:"PointInRect",value:function PointInRect(t,r){return null===r?null:r.x>=t.left&&r.x<=t.width+t.left&&r.y>=t.top&&r.y<=t.top+t.height?r:null}},{key:"GetRotatedPoint",value:function GetRotatedPoint(t,r,a){return{x:t.x*Math.cos(a)+t.y*Math.sin(a)+r.x,y:t.y*Math.cos(a)-t.x*Math.sin(a)+r.y}}},{key:"LimitPointToCircle",value:function LimitPointToCircle(t,r,a){if(Helper.GetDistanceBetweenTwoPoint(t,a)<=r)return a;var i=t.x,o=t.y,l=a.x,u=a.y,c=Math.sqrt(Math.pow(r,2)*Math.pow(i-l,2)/(Math.pow(i-l,2)+Math.pow(o-u,2)))+i;a.x<0&&(c*=-1);var d=(c-i)*(o-u)/(i-l)+o;i-l+o===0&&(d=r);return{x:c,y:d}}},{key:"GetIntersectBetweenTwoSegment",value:function GetIntersectBetweenTwoSegment(t,r,a){return Helper.PointInRect(t,Helper.GetIntersectBeetwenTwoLine(r,a))}},{key:"GetIntersectBeetwenTwoLine",value:function GetIntersectBeetwenTwoLine(t,r){var a=t[0].y-t[1].y,i=r[0].y-r[1].y,o=t[1].x-t[0].x,l=r[1].x-r[0].x,u=t[0].x*t[1].y-t[1].x*t[0].y,c=r[0].x*r[1].y-r[1].x*r[0].y,d=a*c-i*u,h=o*c-l*u,p=-(u*l-c*o)/(a*l-i*o),m=-(a*c-i*u)/(a*l-i*o);if(isFinite(p)&&isFinite(m))return{x:p,y:m};if(Math.abs(d-h)<.1)throw new Error("Segment included");return null}},{key:"GetCordsFromTwoPoint",value:function GetCordsFromTwoPoint(t,r){var a=Math.abs(t.x-r.x),i=Math.abs(t.y-r.y),o=Math.max(a,i),l=[t];function getCord(t,r,a,i,o){return r>t?t+o*(a/i):r<t?t-o*(a/i):t}for(var u=1;u<=o;u+=1)l.push({x:getCord(t.x,r.x,a,o,u),y:getCord(t.y,r.y,i,o,u)});return l}}]);return Helper}(),c=function(t){_inherits(HTMLPage,t);var r=_createSuper(HTMLPage);function HTMLPage(t,a,i){var o;_classCallCheck(this,HTMLPage);(o=r.call(this,t,i)).copiedElement=null;o.temporaryCopy=null;o.isLoad=!1;o.element=a;o.element.classList.add("stf__item");o.element.classList.add("--"+i);return o}_createClass(HTMLPage,[{key:"newTemporaryCopy",value:function newTemporaryCopy(){if("hard"===this.nowDrawingDensity)return this;if(null===this.temporaryCopy){this.copiedElement=this.element.cloneNode(!0);this.element.parentElement.appendChild(this.copiedElement);this.temporaryCopy=new HTMLPage(this.render,this.copiedElement,this.nowDrawingDensity)}return this.getTemporaryCopy()}},{key:"getTemporaryCopy",value:function getTemporaryCopy(){return this.temporaryCopy}},{key:"hideTemporaryCopy",value:function hideTemporaryCopy(){if(null!==this.temporaryCopy){this.copiedElement.remove();this.copiedElement=null;this.temporaryCopy=null}}},{key:"draw",value:function draw(t){var r=t||this.nowDrawingDensity,a=this.render.convertToGlobal(this.state.position),i=this.render.getRect().pageWidth,o=this.render.getRect().height;this.element.classList.remove("--simple");var l="\n position: absolute;\n display: block;\n z-index: ".concat(this.element.style.zIndex,";\n left: 0;\n top: 0;\n width: ").concat(i,"px;\n height: ").concat(o,"px;\n ");"hard"===r?this.drawHard(l):this.drawSoft(a,l)}},{key:"drawHard",value:function drawHard(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=this.render.getRect().left+this.render.getRect().width/2,a=this.state.hardDrawingAngle,i=t+"\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n clip-path: none;\n -webkit-clip-path: none;\n "+(0===this.orientation?"transform-origin: ".concat(this.render.getRect().pageWidth,"px 0;\n transform: translate3d(0, 0, 0) rotateY(").concat(a,"deg);"):"transform-origin: 0 0;\n transform: translate3d(".concat(r,"px, 0, 0) rotateY(").concat(a,"deg);"));this.element.style.cssText=i}},{key:"drawSoft",value:function drawSoft(t){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="polygon( ",o=_createForOfIteratorHelper(this.state.area);try{for(o.s();!(r=o.n()).done;){var l=r.value;if(null!==l){var c=1===this.render.getDirection()?{x:-l.x+this.state.position.x,y:l.y-this.state.position.y}:{x:l.x-this.state.position.x,y:l.y-this.state.position.y};i+=(c=u.GetRotatedPoint(c,{x:0,y:0},this.state.angle)).x+"px "+c.y+"px, "}}}catch(t){o.e(t)}finally{o.f()}i=i.slice(0,-2);var d=a+"transform-origin: 0 0; clip-path: ".concat(i+=")","; -webkit-clip-path: ").concat(i,";")+(this.render.isSafari()&&0===this.state.angle?"transform: translate(".concat(t.x,"px, ").concat(t.y,"px);"):"transform: translate3d(".concat(t.x,"px, ").concat(t.y,"px, 0) rotate(").concat(this.state.angle,"rad);"));this.element.style.cssText=d}},{key:"simpleDraw",value:function simpleDraw(t){var r=this.render.getRect(),a=r.pageWidth,i=r.height,o=1===t?r.left+r.pageWidth:r.left,l=r.top;this.element.classList.add("--simple");this.element.style.cssText="\n position: absolute;\n display: block;\n height: ".concat(i,"px;\n left: ").concat(o,"px;\n top: ").concat(l,"px;\n width: ").concat(a,"px;\n z-index: ").concat(this.render.getSettings().startZIndex+1,";")}},{key:"getElement",value:function getElement(){return this.element}},{key:"load",value:function load(){this.isLoad=!0}},{key:"setOrientation",value:function setOrientation(t){_get(_getPrototypeOf(HTMLPage.prototype),"setOrientation",this).call(this,t);this.element.classList.remove("--left","--right");this.element.classList.add(1===t?"--right":"--left")}},{key:"setDrawingDensity",value:function setDrawingDensity(t){this.element.classList.remove("--soft","--hard");this.element.classList.add("--"+t);_get(_getPrototypeOf(HTMLPage.prototype),"setDrawingDensity",this).call(this,t)}}]);return HTMLPage}(a),d=function(t){_inherits(HTMLPageCollection,t);var r=_createSuper(HTMLPageCollection);function HTMLPageCollection(t,a,i,o){var l;_classCallCheck(this,HTMLPageCollection);(l=r.call(this,t,a)).element=i;l.pagesElement=o;return l}_createClass(HTMLPageCollection,[{key:"load",value:function load(){var t,r=_createForOfIteratorHelper(this.pagesElement);try{for(r.s();!(t=r.n()).done;){var a=t.value,i=new c(this.render,a,"hard"===a.dataset.density?"hard":"soft");i.load();this.pages.push(i)}}catch(t){r.e(t)}finally{r.f()}this.createSpread()}}]);return HTMLPageCollection}(o),h=function(){function FlipCalculation(t,r,a,i){_classCallCheck(this,FlipCalculation);this.direction=t;this.corner=r;this.topIntersectPoint=null;this.sideIntersectPoint=null;this.bottomIntersectPoint=null;this.pageWidth=parseInt(a,10);this.pageHeight=parseInt(i,10)}_createClass(FlipCalculation,[{key:"calc",value:function calc(t){try{this.position=this.calcAngleAndPosition(t);this.calculateIntersectPoint(this.position);return!0}catch(t){return!1}}},{key:"getFlippingClipArea",value:function getFlippingClipArea(){var t=[],r=!1;t.push(this.rect.topLeft);t.push(this.topIntersectPoint);if(null===this.sideIntersectPoint)r=!0;else{t.push(this.sideIntersectPoint);null===this.bottomIntersectPoint&&(r=!1)}t.push(this.bottomIntersectPoint);(r||"bottom"===this.corner)&&t.push(this.rect.bottomLeft);return t}},{key:"getBottomClipArea",value:function getBottomClipArea(){var t=[];t.push(this.topIntersectPoint);if("top"===this.corner)t.push({x:this.pageWidth,y:0});else{null!==this.topIntersectPoint&&t.push({x:this.pageWidth,y:0});t.push({x:this.pageWidth,y:this.pageHeight})}null!==this.sideIntersectPoint?u.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&t.push(this.sideIntersectPoint):"top"===this.corner&&t.push({x:this.pageWidth,y:this.pageHeight});t.push(this.bottomIntersectPoint);t.push(this.topIntersectPoint);return t}},{key:"getAngle",value:function getAngle(){return 0===this.direction?-this.angle:this.angle}},{key:"getRect",value:function getRect(){return this.rect}},{key:"getPosition",value:function getPosition(){return this.position}},{key:"getActiveCorner",value:function getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}},{key:"getDirection",value:function getDirection(){return this.direction}},{key:"getFlippingProgress",value:function getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}},{key:"getCorner",value:function getCorner(){return this.corner}},{key:"getBottomPagePosition",value:function getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}},{key:"getShadowStartPoint",value:function getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}},{key:"getShadowAngle",value:function getShadowAngle(){var t=u.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?t:Math.PI-t}},{key:"calcAngleAndPosition",value:function calcAngleAndPosition(t){var r=t;this.updateAngleAndGeometry(r);r="top"===this.corner?this.checkPositionAtCenterLine(r,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(r,{x:0,y:this.pageHeight},{x:0,y:0});if(Math.abs(r.x-this.pageWidth)<1&&Math.abs(r.y)<1)throw new Error("Point is too small");return r}},{key:"updateAngleAndGeometry",value:function updateAngleAndGeometry(t){this.angle=this.calculateAngle(t);this.rect=this.getPageRect(t)}},{key:"calculateAngle",value:function calculateAngle(t){var r=this.pageWidth-t.x+1,a="bottom"===this.corner?this.pageHeight-t.y:t.y,i=2*Math.acos(r/Math.sqrt(a*a+r*r));a<0&&(i=-i);var o=Math.PI-i;if(!isFinite(i)||o>=0&&o<.003)throw new Error("The G point is too small");"bottom"===this.corner&&(i=-i);return i}},{key:"getPageRect",value:function getPageRect(t){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],t):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],t)}},{key:"getRectFromBasePoint",value:function getRectFromBasePoint(t,r){return{topLeft:this.getRotatedPoint(t[0],r),topRight:this.getRotatedPoint(t[1],r),bottomLeft:this.getRotatedPoint(t[2],r),bottomRight:this.getRotatedPoint(t[3],r)}}},{key:"getRotatedPoint",value:function getRotatedPoint(t,r){return{x:t.x*Math.cos(this.angle)+t.y*Math.sin(this.angle)+r.x,y:t.y*Math.cos(this.angle)-t.x*Math.sin(this.angle)+r.y}}},{key:"calculateIntersectPoint",value:function calculateIntersectPoint(t){var r={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};if("top"===this.corner){this.topIntersectPoint=u.GetIntersectBetweenTwoSegment(r,[t,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=u.GetIntersectBetweenTwoSegment(r,[t,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=u.GetIntersectBetweenTwoSegment(r,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}else{this.topIntersectPoint=u.GetIntersectBetweenTwoSegment(r,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=u.GetIntersectBetweenTwoSegment(r,[t,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=u.GetIntersectBetweenTwoSegment(r,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}}},{key:"checkPositionAtCenterLine",value:function checkPositionAtCenterLine(t,r,a){var i=t,o=u.LimitPointToCircle(r,this.pageWidth,i);if(i!==o){i=o;this.updateAngleAndGeometry(i)}var l=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2)),c=this.rect.bottomRight,d=this.rect.topLeft;if("bottom"===this.corner){c=this.rect.topRight;d=this.rect.bottomLeft}if(c.x<=0){var h=u.LimitPointToCircle(a,l,d);if(h!==i){i=h;this.updateAngleAndGeometry(i)}}return i}},{key:"getSegmentToShadowLine",value:function getSegmentToShadowLine(){var t=this.getShadowStartPoint();return[t,t!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}]);return FlipCalculation}(),p=function(){function Flip(t,r){_classCallCheck(this,Flip);this.flippingPage=null;this.bottomPage=null;this.calc=null;this.state="read";this.render=t;this.app=r}_createClass(Flip,[{key:"fold",value:function fold(t){this.setState("user_fold");null===this.calc&&this.start(t);this.do(this.render.convertToPage(t))}},{key:"flip",value:function flip(t){if(!this.app.getSettings().disableFlipByClick||this.isPointOnCorners(t)){null!==this.calc&&this.render.finishAnimation();if(this.start(t)){var r=this.getBoundsRect();this.setState("flipping");var a=r.height/10,i="bottom"===this.calc.getCorner()?r.height-a:a,o="bottom"===this.calc.getCorner()?r.height:0;this.calc.calc({x:r.pageWidth-a,y:i});this.animateFlippingTo({x:r.pageWidth-a,y:i},{x:-r.pageWidth,y:o},!0)}}}},{key:"start",value:function start(t){this.reset();var r=this.render.convertToBook(t),a=this.getBoundsRect(),i=this.getDirectionByPoint(r),o=r.y>=a.height/2?"bottom":"top";if(!this.checkDirection(i))return!1;try{this.flippingPage=this.app.getPageCollection().getFlippingPage(i);this.bottomPage=this.app.getPageCollection().getBottomPage(i);if("landscape"===this.render.getOrientation())if(1===i){var l=this.app.getPageCollection().nextBy(this.flippingPage);if(null!==l&&this.flippingPage.getDensity()!==l.getDensity()){this.flippingPage.setDrawingDensity("hard");l.setDrawingDensity("hard")}}else{var u=this.app.getPageCollection().prevBy(this.flippingPage);if(null!==u&&this.flippingPage.getDensity()!==u.getDensity()){this.flippingPage.setDrawingDensity("hard");u.setDrawingDensity("hard")}}this.render.setDirection(i);this.calc=new h(i,o,a.pageWidth.toString(10),a.height.toString(10));return!0}catch(t){return!1}}},{key:"do",value:function _do(t){if(null!==this.calc&&this.calc.calc(t)){var r=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea());this.bottomPage.setPosition(this.calc.getBottomPagePosition());this.bottomPage.setAngle(0);this.bottomPage.setHardAngle(0);this.flippingPage.setArea(this.calc.getFlippingClipArea());this.flippingPage.setPosition(this.calc.getActiveCorner());this.flippingPage.setAngle(this.calc.getAngle());0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*r)/100):this.flippingPage.setHardAngle(-90*(200-2*r)/100);this.render.setPageRect(this.calc.getRect());this.render.setBottomPage(this.bottomPage);this.render.setFlippingPage(this.flippingPage);this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),r,this.calc.getDirection())}}},{key:"flipToPage",value:function flipToPage(t,r){var a=this.app.getPageCollection().getCurrentSpreadIndex(),i=this.app.getPageCollection().getSpreadIndexByPage(t);try{if(i>a){this.app.getPageCollection().setCurrentSpreadIndex(i-1);this.flipNext(r)}if(i<a){this.app.getPageCollection().setCurrentSpreadIndex(i+1);this.flipPrev(r)}}catch(t){}}},{key:"flipNext",value:function flipNext(t){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===t?1:this.render.getRect().height-2})}},{key:"flipPrev",value:function flipPrev(t){this.flip({x:10,y:"top"===t?1:this.render.getRect().height-2})}},{key:"stopMove",value:function stopMove(){if(null!==this.calc){var t=this.calc.getPosition(),r=this.getBoundsRect(),a="bottom"===this.calc.getCorner()?r.height:0;t.x<=0?this.animateFlippingTo(t,{x:-r.pageWidth,y:a},!0):this.animateFlippingTo(t,{x:r.pageWidth,y:a},!1)}}},{key:"showCorner",value:function showCorner(t){if(this.checkState("read","fold_corner")){var r=this.getBoundsRect(),a=r.pageWidth;if(this.isPointOnCorners(t))if(null===this.calc){if(!this.start(t))return;this.setState("fold_corner");this.calc.calc({x:a-1,y:1});var i="bottom"===this.calc.getCorner()?r.height-1:1,o="bottom"===this.calc.getCorner()?r.height-50:50;this.animateFlippingTo({x:a-1,y:i},{x:a-50,y:o},!1,!1)}else this.do(this.render.convertToPage(t));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}}},{key:"animateFlippingTo",value:function animateFlippingTo(t,r,a){var i,o=this,l=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],c=u.GetCordsFromTwoPoint(t,r),d=[],h=_createForOfIteratorHelper(c);try{var p=function _loop(){var t=i.value;d.push((function(){return o.do(t)}))};for(h.s();!(i=h.n()).done;)p()}catch(t){h.e(t)}finally{h.f()}var m=this.getAnimationDuration(c.length);this.render.startAnimation(d,m,(function(){if(o.calc){a&&(1===o.calc.getDirection()?o.app.turnToPrevPage():o.app.turnToNextPage());if(l){o.render.setBottomPage(null);o.render.setFlippingPage(null);o.render.clearShadow();o.setState("read");o.reset()}}}))}},{key:"getCalculation",value:function getCalculation(){return this.calc}},{key:"getState",value:function getState(){return this.state}},{key:"setState",value:function setState(t){if(this.state!==t){this.app.updateState(t);this.state=t}}},{key:"getDirectionByPoint",value:function getDirectionByPoint(t){var r=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(t.x-r.pageWidth<=r.width/5)return 1}else if(t.x<r.width/2)return 1;return 0}},{key:"getAnimationDuration",value:function getAnimationDuration(t){var r=this.app.getSettings().flippingTime;return t>=1e3?r:t/1e3*r}},{key:"checkDirection",value:function checkDirection(t){return 0===t?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}},{key:"reset",value:function reset(){this.calc=null;this.flippingPage=null;this.bottomPage=null}},{key:"getBoundsRect",value:function getBoundsRect(){return this.render.getRect()}},{key:"checkState",value:function checkState(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];for(var i=0,o=r;i<o.length;i++){var l=o[i];if(this.state===l)return!0}return!1}},{key:"isPointOnCorners",value:function isPointOnCorners(t){var r=this.getBoundsRect(),a=r.pageWidth,i=Math.sqrt(Math.pow(a,2)+Math.pow(r.height,2))/5,o=this.render.convertToBook(t);return o.x>0&&o.y>0&&o.x<r.width&&o.y<r.height&&(o.x<i||o.x>r.width-i)&&(o.y<i||o.y>r.height-i)}}]);return Flip}(),m=function(){function Render(t,r){_classCallCheck(this,Render);this.leftPage=null;this.rightPage=null;this.flippingPage=null;this.bottomPage=null;this.direction=null;this.orientation=null;this.shadow=null;this.animation=null;this.pageRect=null;this.boundsRect=null;this.timer=0;this.safari=!1;this.setting=r;this.app=t;var a=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==a.exec(window.navigator.userAgent)}_createClass(Render,[{key:"render",value:function render(t){if(null!==this.animation){var r=Math.round((t-this.animation.startedAt)/this.animation.durationFrame);if(r<this.animation.frames.length)this.animation.frames[r]();else{this.animation.onAnimateEnd();this.animation=null}}this.timer=t;this.drawFrame()}},{key:"start",value:function start(){var t=this;this.update();requestAnimationFrame((function loop(r){t.render(r);requestAnimationFrame(loop)}))}},{key:"startAnimation",value:function startAnimation(t,r,a){this.finishAnimation();this.animation={frames:t,duration:r,durationFrame:r/t.length,onAnimateEnd:a,startedAt:this.timer}}},{key:"finishAnimation",value:function finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}},{key:"update",value:function update(){this.boundsRect=null;var t=this.calculateBoundsRect();if(this.orientation!==t){this.orientation=t;this.app.updateOrientation(t)}}},{key:"calculateBoundsRect",value:function calculateBoundsRect(){var t="landscape",r=this.getBlockWidth(),a=r/2,i=this.getBlockHeight()/2,o=this.setting.width/this.setting.height,l=this.setting.width,u=this.setting.height,c=a-l;if("stretch"===this.setting.size){r<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(t="portrait");(l="portrait"===t?this.getBlockWidth():this.getBlockWidth()/2)>this.setting.maxWidth&&(l=this.setting.maxWidth);(u=l/o)>this.getBlockHeight()&&(l=(u=this.getBlockHeight())*o);c="portrait"===t?a-l/2-l:a-l}else if(r<2*l&&this.app.getSettings().usePortrait){t="portrait";c=a-l/2-l}this.boundsRect={left:c,top:i-u/2,width:2*l,height:u,pageWidth:l};return t}},{key:"setShadowData",value:function setShadowData(t,r,a,i){if(this.app.getSettings().drawShadow){var o=100*this.getSettings().maxShadowOpacity;this.shadow={pos:t,angle:r,width:3*this.getRect().pageWidth/4*a/100,opacity:(100-a)*o/100/100,direction:i,progress:2*a}}}},{key:"clearShadow",value:function clearShadow(){this.shadow=null}},{key:"getBlockWidth",value:function getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}},{key:"getBlockHeight",value:function getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}},{key:"getDirection",value:function getDirection(){return this.direction}},{key:"getRect",value:function getRect(){null===this.boundsRect&&this.calculateBoundsRect();return this.boundsRect}},{key:"getSettings",value:function getSettings(){return this.app.getSettings()}},{key:"getOrientation",value:function getOrientation(){return this.orientation}},{key:"setPageRect",value:function setPageRect(t){this.pageRect=t}},{key:"setDirection",value:function setDirection(t){this.direction=t}},{key:"setRightPage",value:function setRightPage(t){null!==t&&t.setOrientation(1);this.rightPage=t}},{key:"setLeftPage",value:function setLeftPage(t){null!==t&&t.setOrientation(0);this.leftPage=t}},{key:"setBottomPage",value:function setBottomPage(t){null!==t&&t.setOrientation(1===this.direction?0:1);this.bottomPage=t}},{key:"setFlippingPage",value:function setFlippingPage(t){null!==t&&t.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1);this.flippingPage=t}},{key:"convertToBook",value:function convertToBook(t){var r=this.getRect();return{x:t.x-r.left,y:t.y-r.top}}},{key:"isSafari",value:function isSafari(){return this.safari}},{key:"convertToPage",value:function convertToPage(t,r){r||(r=this.direction);var a=this.getRect();return{x:0===r?t.x-a.left-a.width/2:a.width/2-t.x+a.left,y:t.y-a.top}}},{key:"convertToGlobal",value:function convertToGlobal(t,r){r||(r=this.direction);if(null==t)return null;var a=this.getRect();return{x:0===r?t.x+a.left+a.width/2:a.width/2-t.x+a.left,y:t.y+a.top}}},{key:"convertRectToGlobal",value:function convertRectToGlobal(t,r){r||(r=this.direction);return{topLeft:this.convertToGlobal(t.topLeft,r),topRight:this.convertToGlobal(t.topRight,r),bottomLeft:this.convertToGlobal(t.bottomLeft,r),bottomRight:this.convertToGlobal(t.bottomRight,r)}}}]);return Render}(),g=function(t){_inherits(CanvasRender,t);var r=_createSuper(CanvasRender);function CanvasRender(t,a,i){var o;_classCallCheck(this,CanvasRender);(o=r.call(this,t,a)).canvas=i;o.ctx=i.getContext("2d");return o}_createClass(CanvasRender,[{key:"getContext",value:function getContext(){return this.ctx}},{key:"reload",value:function reload(){}},{key:"drawFrame",value:function drawFrame(){this.clear();"portrait"!==this.orientation&&null!=this.leftPage&&this.leftPage.simpleDraw(0);null!=this.rightPage&&this.rightPage.simpleDraw(1);null!=this.bottomPage&&this.bottomPage.draw();this.drawBookShadow();null!=this.flippingPage&&this.flippingPage.draw();if(null!=this.shadow){this.drawOuterShadow();this.drawInnerShadow()}var t=this.getRect();if("portrait"===this.orientation){this.ctx.beginPath();this.ctx.rect(t.left+t.pageWidth,t.top,t.width,t.height);this.ctx.clip()}}},{key:"drawBookShadow",value:function drawBookShadow(){var t=this.getRect();this.ctx.save();this.ctx.beginPath();var r=t.width/20;this.ctx.rect(t.left,t.top,t.width,t.height);var a={x:t.left+t.width/2-r/2,y:0};this.ctx.translate(a.x,a.y);var i=this.ctx.createLinearGradient(0,0,r,0);i.addColorStop(0,"rgba(0, 0, 0, 0)");i.addColorStop(.4,"rgba(0, 0, 0, 0.2)");i.addColorStop(.49,"rgba(0, 0, 0, 0.1)");i.addColorStop(.5,"rgba(0, 0, 0, 0.5)");i.addColorStop(.51,"rgba(0, 0, 0, 0.4)");i.addColorStop(1,"rgba(0, 0, 0, 0)");this.ctx.clip();this.ctx.fillStyle=i;this.ctx.fillRect(0,0,r,2*t.height);this.ctx.restore()}},{key:"drawOuterShadow",value:function drawOuterShadow(){var t=this.getRect();this.ctx.save();this.ctx.beginPath();this.ctx.rect(t.left,t.top,t.width,t.height);var r=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y});this.ctx.translate(r.x,r.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);var a=this.ctx.createLinearGradient(0,0,this.shadow.width,0);if(0===this.shadow.direction){this.ctx.translate(0,-100);a.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");a.addColorStop(1,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(-this.shadow.width,-100);a.addColorStop(0,"rgba(0, 0, 0, 0)");a.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")")}this.ctx.clip();this.ctx.fillStyle=a;this.ctx.fillRect(0,0,this.shadow.width,2*t.height);this.ctx.restore()}},{key:"drawInnerShadow",value:function drawInnerShadow(){var t=this.getRect();this.ctx.save();this.ctx.beginPath();var r=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),a=this.convertRectToGlobal(this.pageRect);this.ctx.moveTo(a.topLeft.x,a.topLeft.y);this.ctx.lineTo(a.topRight.x,a.topRight.y);this.ctx.lineTo(a.bottomRight.x,a.bottomRight.y);this.ctx.lineTo(a.bottomLeft.x,a.bottomLeft.y);this.ctx.translate(r.x,r.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);var i=3*this.shadow.width/4,o=this.ctx.createLinearGradient(0,0,i,0);if(0===this.shadow.direction){this.ctx.translate(-i,-100);o.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")");o.addColorStop(.9,"rgba(0, 0, 0, 0.05)");o.addColorStop(.7,"rgba(0, 0, 0, "+this.shadow.opacity+")");o.addColorStop(0,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(0,-100);o.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");o.addColorStop(.1,"rgba(0, 0, 0, 0.05)");o.addColorStop(.3,"rgba(0, 0, 0, "+this.shadow.opacity+")");o.addColorStop(1,"rgba(0, 0, 0, 0)")}this.ctx.clip();this.ctx.fillStyle=o;this.ctx.fillRect(0,0,i,2*t.height);this.ctx.restore()}},{key:"clear",value:function clear(){this.ctx.fillStyle="white";this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}}]);return CanvasRender}(m),v=function(){function UI(t,r,a){var i=this;_classCallCheck(this,UI);this.touchPoint=null;this.swipeTimeout=250;this.onResize=function(){i.update()};this.onMouseDown=function(t){if(i.checkTarget(t.target)){var r=i.getMousePos(t.clientX,t.clientY);i.app.startUserTouch(r);t.preventDefault()}};this.onTouchStart=function(t){if(i.checkTarget(t.target)&&t.changedTouches.length>0){var r=t.changedTouches[0],a=i.getMousePos(r.clientX,r.clientY);i.touchPoint={point:a,time:Date.now()};setTimeout((function(){null!==i.touchPoint&&i.app.startUserTouch(a)}),i.swipeTimeout);i.app.getSettings().mobileScrollSupport||t.preventDefault()}};this.onMouseUp=function(t){var r=i.getMousePos(t.clientX,t.clientY);i.app.userStop(r)};this.onMouseMove=function(t){var r=i.getMousePos(t.clientX,t.clientY);i.app.userMove(r,!1)};this.onTouchMove=function(t){if(t.changedTouches.length>0){var r=t.changedTouches[0],a=i.getMousePos(r.clientX,r.clientY);if(i.app.getSettings().mobileScrollSupport){null!==i.touchPoint&&(Math.abs(i.touchPoint.point.x-a.x)>10||"read"!==i.app.getState())&&t.cancelable&&i.app.userMove(a,!0);"read"!==i.app.getState()&&t.preventDefault()}else i.app.userMove(a,!0)}};this.onTouchEnd=function(t){if(t.changedTouches.length>0){var r=t.changedTouches[0],a=i.getMousePos(r.clientX,r.clientY),o=!1;if(null!==i.touchPoint){var l=a.x-i.touchPoint.point.x,u=Math.abs(a.y-i.touchPoint.point.y);if(Math.abs(l)>i.swipeDistance&&u<2*i.swipeDistance&&Date.now()-i.touchPoint.time<i.swipeTimeout){l>0?i.app.flipPrev(i.touchPoint.point.y<i.app.getRender().getRect().height/2?"top":"bottom"):i.app.flipNext(i.touchPoint.point.y<i.app.getRender().getRect().height/2?"top":"bottom");o=!0}i.touchPoint=null}i.app.userStop(a,o)}};this.parentElement=t;t.classList.add("stf__parent");t.insertAdjacentHTML("afterbegin",'<div class="stf__wrapper"></div>');this.wrapper=t.querySelector(".stf__wrapper");this.app=r;var o=this.app.getSettings().usePortrait?1:2;t.style.minWidth=a.minWidth*o+"px";t.style.minHeight=a.minHeight+"px";if("fixed"===a.size){t.style.minWidth=a.width*o+"px";t.style.minHeight=a.height+"px"}if(a.autoSize){t.style.width="100%";t.style.maxWidth=2*a.maxWidth+"px"}t.style.display="block";window.addEventListener("resize",this.onResize,!1);this.swipeDistance=a.swipeDistance}_createClass(UI,[{key:"destroy",value:function destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers();this.distElement.remove();this.wrapper.remove()}},{key:"getDistElement",value:function getDistElement(){return this.distElement}},{key:"getWrapper",value:function getWrapper(){return this.wrapper}},{key:"setOrientationStyle",value:function setOrientationStyle(t){this.wrapper.classList.remove("--portrait","--landscape");if("portrait"===t){this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%");this.wrapper.classList.add("--portrait")}else{this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%");this.wrapper.classList.add("--landscape")}this.update()}},{key:"removeHandlers",value:function removeHandlers(){window.removeEventListener("resize",this.onResize);this.distElement.removeEventListener("mousedown",this.onMouseDown);this.distElement.removeEventListener("touchstart",this.onTouchStart);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("mouseup",this.onMouseUp);window.removeEventListener("touchend",this.onTouchEnd)}},{key:"setHandlers",value:function setHandlers(){window.addEventListener("resize",this.onResize,!1);if(this.app.getSettings().useMouseEvents){this.distElement.addEventListener("mousedown",this.onMouseDown);this.distElement.addEventListener("touchstart",this.onTouchStart);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport});window.addEventListener("mouseup",this.onMouseUp);window.addEventListener("touchend",this.onTouchEnd)}}},{key:"getMousePos",value:function getMousePos(t,r){var a=this.distElement.getBoundingClientRect();return{x:t-a.left,y:r-a.top}}},{key:"checkTarget",value:function checkTarget(t){return!this.app.getSettings().clickEventForward||!["a","button"].includes(t.tagName.toLowerCase())}}]);return UI}(),y=function(t){_inherits(HTMLUI,t);var r=_createSuper(HTMLUI);function HTMLUI(t,a,i,o){var l;_classCallCheck(this,HTMLUI);(l=r.call(this,t,a,i)).wrapper.insertAdjacentHTML("afterbegin",'<div class="stf__block"></div>');l.distElement=t.querySelector(".stf__block");l.items=o;var u,c=_createForOfIteratorHelper(o);try{for(c.s();!(u=c.n()).done;){var d=u.value;l.distElement.appendChild(d)}}catch(t){c.e(t)}finally{c.f()}l.setHandlers();return l}_createClass(HTMLUI,[{key:"clear",value:function clear(){var t,r=_createForOfIteratorHelper(this.items);try{for(r.s();!(t=r.n()).done;){var a=t.value;this.parentElement.appendChild(a)}}catch(t){r.e(t)}finally{r.f()}}},{key:"updateItems",value:function updateItems(t){this.removeHandlers();this.distElement.innerHTML="";var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var i=r.value;this.distElement.appendChild(i)}}catch(t){a.e(t)}finally{a.f()}this.items=t;this.setHandlers()}},{key:"update",value:function update(){this.app.getRender().update()}}]);return HTMLUI}(v),b=function(t){_inherits(CanvasUI,t);var r=_createSuper(CanvasUI);function CanvasUI(t,a,i){var o;_classCallCheck(this,CanvasUI);(o=r.call(this,t,a,i)).wrapper.innerHTML='<canvas class="stf__canvas"></canvas>';o.canvas=t.querySelectorAll("canvas")[0];o.distElement=o.canvas;o.resizeCanvas();o.setHandlers();return o}_createClass(CanvasUI,[{key:"resizeCanvas",value:function resizeCanvas(){var t=getComputedStyle(this.canvas),r=parseInt(t.getPropertyValue("width"),10),a=parseInt(t.getPropertyValue("height"),10);this.canvas.width=r;this.canvas.height=a}},{key:"getCanvas",value:function getCanvas(){return this.canvas}},{key:"update",value:function update(){this.resizeCanvas();this.app.getRender().update()}}]);return CanvasUI}(v),S=function(){function EventObject(){_classCallCheck(this,EventObject);this.events=new Map}_createClass(EventObject,[{key:"on",value:function on(t,r){this.events.has(t)?this.events.get(t).push(r):this.events.set(t,[r]);return this}},{key:"off",value:function off(t){this.events.delete(t)}},{key:"trigger",value:function trigger(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(this.events.has(t)){var i,o=_createForOfIteratorHelper(this.events.get(t));try{for(o.s();!(i=o.n()).done;){var l=i.value;l({data:a,object:r})}}catch(t){o.e(t)}finally{o.f()}}}}]);return EventObject}(),w=function(t){_inherits(HTMLRender,t);var r=_createSuper(HTMLRender);function HTMLRender(t,a,i){var o;_classCallCheck(this,HTMLRender);(o=r.call(this,t,a)).outerShadow=null;o.innerShadow=null;o.hardShadow=null;o.hardInnerShadow=null;o.element=i;o.createShadows();return o}_createClass(HTMLRender,[{key:"createShadows",value:function createShadows(){this.element.insertAdjacentHTML("beforeend",'<div class="stf__outerShadow"></div>\n <div class="stf__innerShadow"></div>\n <div class="stf__hardShadow"></div>\n <div class="stf__hardInnerShadow"></div>');this.outerShadow=this.element.querySelector(".stf__outerShadow");this.innerShadow=this.element.querySelector(".stf__innerShadow");this.hardShadow=this.element.querySelector(".stf__hardShadow");this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}},{key:"clearShadow",value:function clearShadow(){_get(_getPrototypeOf(HTMLRender.prototype),"clearShadow",this).call(this);this.outerShadow.style.cssText="display: none";this.innerShadow.style.cssText="display: none";this.hardShadow.style.cssText="display: none";this.hardInnerShadow.style.cssText="display: none"}},{key:"reload",value:function reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}},{key:"drawHardInnerShadow",value:function drawHardInnerShadow(){var t=this.getRect(),r=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress,a=(100-r)*(2.5*t.pageWidth)/100+20;a>t.pageWidth&&(a=t.pageWidth);var i="\n display: block;\n z-index: ".concat((this.getSettings().startZIndex+5).toString(10),";\n width: ").concat(a,"px;\n height: ").concat(t.height,"px;\n background: linear-gradient(to right,\n rgba(0, 0, 0, ").concat(this.shadow.opacity*r/100,") 5%,\n rgba(0, 0, 0, 0) 100%);\n left: ").concat(t.left+t.width/2,"px;\n transform-origin: 0 0;\n ");i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);";this.hardInnerShadow.style.cssText=i}},{key:"drawHardOuterShadow",value:function drawHardOuterShadow(){var t=this.getRect(),r=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*t.pageWidth)/100+20;r>t.pageWidth&&(r=t.pageWidth);var a="\n display: block;\n z-index: ".concat((this.getSettings().startZIndex+4).toString(10),";\n width: ").concat(r,"px;\n height: ").concat(t.height,"px;\n background: linear-gradient(to left, rgba(0, 0, 0, ").concat(this.shadow.opacity,") 5%, rgba(0, 0, 0, 0) 100%);\n left: ").concat(t.left+t.width/2,"px;\n transform-origin: 0 0;\n ");a+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);";this.hardShadow.style.cssText=a}},{key:"drawInnerShadow",value:function drawInnerShadow(){for(var t=this.getRect(),r=3*this.shadow.width/4,a=0===this.getDirection()?r:0,i=0===this.getDirection()?"to left":"to right",o=this.convertToGlobal(this.shadow.pos),l=this.shadow.angle+3*Math.PI/2,c="polygon( ",d=0,h=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];d<h.length;d++){var p=h[d],m=1===this.getDirection()?{x:-p.x+this.shadow.pos.x,y:p.y-this.shadow.pos.y}:{x:p.x-this.shadow.pos.x,y:p.y-this.shadow.pos.y};c+=(m=u.GetRotatedPoint(m,{x:a,y:100},l)).x+"px "+m.y+"px, "}c=c.slice(0,-2);c+=")";var g="\n display: block;\n z-index: ".concat((this.getSettings().startZIndex+10).toString(10),";\n width: ").concat(r,"px;\n height: ").concat(2*t.height,"px;\n background: linear-gradient(").concat(i,",\n rgba(0, 0, 0, ").concat(this.shadow.opacity,") 5%,\n rgba(0, 0, 0, 0.05) 15%,\n rgba(0, 0, 0, ").concat(this.shadow.opacity,") 35%,\n rgba(0, 0, 0, 0) 100%);\n transform-origin: ").concat(a,"px 100px;\n transform: translate3d(").concat(o.x-a,"px, ").concat(o.y-100,"px, 0) rotate(").concat(l,"rad);\n clip-path: ").concat(c,";\n -webkit-clip-path: ").concat(c,";\n ");this.innerShadow.style.cssText=g}},{key:"drawOuterShadow",value:function drawOuterShadow(){for(var t=this.getRect(),r=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),a=this.shadow.angle+3*Math.PI/2,i=1===this.getDirection()?this.shadow.width:0,o=0===this.getDirection()?"to right":"to left",l="polygon( ",c=0,d=[{x:0,y:0},{x:t.pageWidth,y:0},{x:t.pageWidth,y:t.height},{x:0,y:t.height}];c<d.length;c++){var h=d[c];if(null!==h){var p=1===this.getDirection()?{x:-h.x+this.shadow.pos.x,y:h.y-this.shadow.pos.y}:{x:h.x-this.shadow.pos.x,y:h.y-this.shadow.pos.y};l+=(p=u.GetRotatedPoint(p,{x:i,y:100},a)).x+"px "+p.y+"px, "}}l=l.slice(0,-2);l+=")";var m="\n display: block;\n z-index: ".concat((this.getSettings().startZIndex+10).toString(10),";\n width: ").concat(this.shadow.width,"px;\n height: ").concat(2*t.height,"px;\n background: linear-gradient(").concat(o,", rgba(0, 0, 0, ").concat(this.shadow.opacity,"), rgba(0, 0, 0, 0));\n transform-origin: ").concat(i,"px 100px;\n transform: translate3d(").concat(r.x-i,"px, ").concat(r.y-100,"px, 0) rotate(").concat(a,"rad);\n clip-path: ").concat(l,";\n -webkit-clip-path: ").concat(l,";\n ");this.outerShadow.style.cssText=m}},{key:"drawLeftPage",value:function drawLeftPage(){if("portrait"!==this.orientation&&null!==this.leftPage)if(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.simpleDraw(0)}},{key:"drawRightPage",value:function drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.simpleDraw(1)}},{key:"drawBottomPage",value:function drawBottomPage(){if(null!==this.bottomPage){var t=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(t)}}}},{key:"drawFrame",value:function drawFrame(){this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}},{key:"clear",value:function clear(){var t,r=_createForOfIteratorHelper(this.app.getPageCollection().getPages());try{for(r.s();!(t=r.n()).done;){var a=t.value;if(a!==this.leftPage&&a!==this.rightPage&&a!==this.flippingPage&&a!==this.bottomPage){var i=a.getElement().style;"none"!==i.display&&(i.cssText="display: none")}a.getTemporaryCopy()!==this.flippingPage&&a.hideTemporaryCopy()}}catch(t){r.e(t)}finally{r.f()}}},{key:"update",value:function update(){_get(_getPrototypeOf(HTMLRender.prototype),"update",this).call(this);null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}]);return HTMLRender}(m),C=function(){function Settings(){_classCallCheck(this,Settings);this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}_createClass(Settings,[{key:"getSettings",value:function getSettings(t){var r=this._default;Object.assign(r,t);if("stretch"!==r.size&&"fixed"!==r.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(r.width<=0||r.height<=0)throw new Error("Invalid width or height");if(r.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===r.size){r.minWidth<=0&&(r.minWidth=100);r.maxWidth<r.minWidth&&(r.maxWidth=2e3);r.minHeight<=0&&(r.minHeight=100);r.maxHeight<r.minHeight&&(r.maxHeight=2e3)}else{r.minWidth=r.width;r.maxWidth=r.width;r.minHeight=r.height;r.maxHeight=r.height}return r}}]);return Settings}();!function styleInject(t,r){void 0===r&&(r={});var a=r.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css";"top"===a&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o);o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}(".stf__parent {\n position: relative;\n display: block;\n box-sizing: border-box;\n transform: translateZ(0);\n\n -ms-touch-action: pan-y;\n touch-action: pan-y;\n}\n\n.sft__wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n}\n\n.stf__parent canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n.stf__block {\n position: absolute;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n perspective: 2000px;\n}\n\n.stf__item {\n display: none;\n position: absolute;\n transform-style: preserve-3d;\n}\n\n.stf__outerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__innerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardInnerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}");var P=function(t){_inherits(PageFlip,t);var r=_createSuper(PageFlip);function PageFlip(t,a){var i;_classCallCheck(this,PageFlip);(i=r.call(this)).isUserTouch=!1;i.isUserMove=!1;i.setting=null;i.pages=null;i.setting=(new C).getSettings(a);i.block=t;return i}_createClass(PageFlip,[{key:"destroy",value:function destroy(){this.ui.destroy();this.block.remove()}},{key:"update",value:function update(){this.render.update();this.pages.show()}},{key:"loadFromImages",value:function loadFromImages(t){var r=this;this.ui=new b(this.block,this,this.setting);var a=this.ui.getCanvas();this.render=new g(this,this.setting,a);this.flipController=new p(this.render,this);this.pages=new l(this,this.render,t);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((function(){r.ui.update();r.trigger("init",r,{page:r.setting.startPage,mode:r.render.getOrientation()})}),1)}},{key:"loadFromHTML",value:function loadFromHTML(t){var r=this;this.ui=new y(this.block,this,this.setting,t);this.render=new w(this,this.setting,this.ui.getDistElement());this.flipController=new p(this.render,this);this.pages=new d(this,this.render,this.ui.getDistElement(),t);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((function(){r.ui.update();r.trigger("init",r,{page:r.setting.startPage,mode:r.render.getOrientation()})}),1)}},{key:"updateFromImages",value:function updateFromImages(t){var r=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new l(this,this.render,t);this.pages.load();this.pages.show(r);this.trigger("update",this,{page:r,mode:this.render.getOrientation()})}},{key:"updateFromHtml",value:function updateFromHtml(t){var r=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new d(this,this.render,this.ui.getDistElement(),t);this.pages.load();this.ui.updateItems(t);this.render.reload();this.pages.show(r);this.trigger("update",this,{page:r,mode:this.render.getOrientation()})}},{key:"clear",value:function clear(){this.pages.destroy();this.ui.clear()}},{key:"turnToPrevPage",value:function turnToPrevPage(){this.pages.showPrev()}},{key:"turnToNextPage",value:function turnToNextPage(){this.pages.showNext()}},{key:"turnToPage",value:function turnToPage(t){this.pages.show(t)}},{key:"flipNext",value:function flipNext(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipNext(t)}},{key:"flipPrev",value:function flipPrev(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipPrev(t)}},{key:"flip",value:function flip(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top";this.flipController.flipToPage(t,r)}},{key:"updateState",value:function updateState(t){this.trigger("changeState",this,t)}},{key:"updatePageIndex",value:function updatePageIndex(t){this.trigger("flip",this,t)}},{key:"updateOrientation",value:function updateOrientation(t){this.ui.setOrientationStyle(t);this.update();this.trigger("changeOrientation",this,t)}},{key:"getPageCount",value:function getPageCount(){return this.pages.getPageCount()}},{key:"getCurrentPageIndex",value:function getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}},{key:"getPage",value:function getPage(t){return this.pages.getPage(t)}},{key:"getRender",value:function getRender(){return this.render}},{key:"getFlipController",value:function getFlipController(){return this.flipController}},{key:"getOrientation",value:function getOrientation(){return this.render.getOrientation()}},{key:"getBoundsRect",value:function getBoundsRect(){return this.render.getRect()}},{key:"getSettings",value:function getSettings(){return this.setting}},{key:"getUI",value:function getUI(){return this.ui}},{key:"getState",value:function getState(){return this.flipController.getState()}},{key:"getPageCollection",value:function getPageCollection(){return this.pages}},{key:"startUserTouch",value:function startUserTouch(t){this.mousePosition=t;this.isUserTouch=!0;this.isUserMove=!1}},{key:"userMove",value:function userMove(t,r){if(this.isUserTouch||r||!this.setting.showPageCorners){if(this.isUserTouch&&u.GetDistanceBetweenTwoPoint(this.mousePosition,t)>5){this.isUserMove=!0;this.flipController.fold(t)}}else this.flipController.showCorner(t)}},{key:"userStop",value:function userStop(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isUserTouch){this.isUserTouch=!1;r||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(t))}}}]);return PageFlip}(S);r.PageFlip=P},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFPageView=void 0;var i=_interopRequireDefault(a(4)),o=a(6),l=a(7),u=a(34),c=a(10),d=a(2),h=_interopRequireDefault(a(37)),p=a(38);function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var m=d.viewerCompatibilityParams.maxCanvasPixels||16777216,g=function(){function PDFPageView(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFPageView);var r=t.container,a=t.defaultViewport;this.id=t.id;this.renderingId="page"+this.id;this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=t.scale||o.DEFAULT_SCALE;this.viewport=a;this.pdfPageRotate=a.rotation;this._optionalContentConfigPromise=t.optionalContentConfigPromise||null;this.hasRestrictedScaling=!1;this.textLayerMode=Number.isInteger(t.textLayerMode)?t.textLayerMode:o.TextLayerMode.ENABLE;this.imageResourcesPath=t.imageResourcesPath||"";this.renderInteractiveForms=!1!==t.renderInteractiveForms;this.useOnlyCssZoom=t.useOnlyCssZoom||!1;this.maxCanvasPixels=t.maxCanvasPixels||m;this.eventBus=t.eventBus;this.renderingQueue=t.renderingQueue;this.textLayerFactory=t.textLayerFactory;this.annotationLayerFactory=t.annotationLayerFactory;this.xfaLayerFactory=t.xfaLayerFactory;this.structTreeLayerFactory=t.structTreeLayerFactory;this.renderer=t.renderer||o.RendererType.CANVAS;this.l10n=t.l10n||u.NullL10n;this.paintTask=null;this.paintedViewportMap=new WeakMap;this.renderingState=c.RenderingStates.INITIAL;this.resume=null;this._renderError=null;this.annotationLayer=null;this.textLayer=null;this.zoomLayer=null;this.xfaLayer=null;this.structTreeLayer=null;var i=document.createElement("div");i.className="page";i.style.width=Math.floor(this.viewport.width)+"px";i.style.height=Math.floor(this.viewport.height)+"px";i.setAttribute("data-page-number",this.id);i.setAttribute("role","region");this.l10n.get("page_landmark",{page:this.id}).then((function(t){i.setAttribute("aria-label",t)}));this.div=i;r.appendChild(i)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFPageView,[{key:"setPdfPage",value:function setPdfPage(t){this.pdfPage=t;this.pdfPageRotate=t.rotate;var r=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:this.scale*o.CSS_UNITS,rotation:r});this.reset()}},{key:"destroy",value:function destroy(){this.reset();this.pdfPage&&this.pdfPage.cleanup()}},{key:"_renderAnnotationLayer",value:(r=_asyncToGenerator(i.default.mark((function _callee(){var t;return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:t=null;r.prev=1;r.next=4;return this.annotationLayer.render(this.viewport,"display");case 4:r.next=9;break;case 6:r.prev=6;r.t0=r.catch(1);t=r.t0;case 9:r.prev=9;this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:t});return r.finish(9);case 12:case"end":return r.stop()}}),_callee,this,[[1,6,9,12]])}))),function _renderAnnotationLayer(){return r.apply(this,arguments)})},{key:"_renderXfaLayer",value:(t=_asyncToGenerator(i.default.mark((function _callee2(){var t;return i.default.wrap((function _callee2$(r){for(;;)switch(r.prev=r.next){case 0:t=null;r.prev=1;r.next=4;return this.xfaLayer.render(this.viewport,"display");case 4:r.next=9;break;case 6:r.prev=6;r.t0=r.catch(1);t=r.t0;case 9:r.prev=9;this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:t});return r.finish(9);case 12:case"end":return r.stop()}}),_callee2,this,[[1,6,9,12]])}))),function _renderXfaLayer(){return t.apply(this,arguments)})},{key:"_resetZoomLayer",value:function _resetZoomLayer(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.zoomLayer){var r=this.zoomLayer.firstChild;this.paintedViewportMap.delete(r);r.width=0;r.height=0;t&&this.zoomLayer.remove();this.zoomLayer=null}}},{key:"reset",value:function reset(){var t,r,a=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.keepZoomLayer,l=void 0!==o&&o,u=i.keepAnnotationLayer,d=void 0!==u&&u,h=i.keepXfaLayer,p=void 0!==h&&h;this.cancelRendering({keepAnnotationLayer:d,keepXfaLayer:p});this.renderingState=c.RenderingStates.INITIAL;var m=this.div;m.style.width=Math.floor(this.viewport.width)+"px";m.style.height=Math.floor(this.viewport.height)+"px";for(var g=m.childNodes,v=l&&this.zoomLayer||null,y=d&&(null===(t=this.annotationLayer)||void 0===t?void 0:t.div)||null,b=p&&(null===(r=this.xfaLayer)||void 0===r?void 0:r.div)||null,S=g.length-1;S>=0;S--){var w=g[S];switch(w){case v:case y:case b:continue}m.removeChild(w)}m.removeAttribute("data-loaded");y&&this.annotationLayer.hide();b&&this.xfaLayer.hide();if(!v){if(this.canvas){this.paintedViewportMap.delete(this.canvas);this.canvas.width=0;this.canvas.height=0;delete this.canvas}this._resetZoomLayer()}if(this.svg){this.paintedViewportMap.delete(this.svg);delete this.svg}this.loadingIconDiv=document.createElement("div");this.loadingIconDiv.className="loadingIcon";this.loadingIconDiv.setAttribute("role","img");this.l10n.get("loading").then((function(t){var r;null===(r=a.loadingIconDiv)||void 0===r||r.setAttribute("aria-label",t)}));m.appendChild(this.loadingIconDiv)}},{key:"update",value:function update(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.scale=t||this.scale;void 0!==r&&(this.rotation=r);a instanceof Promise&&(this._optionalContentConfigPromise=a);var i=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*o.CSS_UNITS,rotation:i});if(this.svg){this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawXfaLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError})}else{var l=!1;if(this.canvas&&this.maxCanvasPixels>0){var u=this.outputScale;(Math.floor(this.viewport.width)*u.sx|0)*(Math.floor(this.viewport.height)*u.sy|0)>this.maxCanvasPixels&&(l=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&l){this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawXfaLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}if(!this.zoomLayer&&!this.canvas.hidden){this.zoomLayer=this.canvas.parentNode;this.zoomLayer.style.position="absolute"}}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild});this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepXfaLayer:!0})}}},{key:"cancelRendering",value:function cancelRendering(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.keepAnnotationLayer,a=void 0!==r&&r,i=t.keepXfaLayer,o=void 0!==i&&i;if(this.paintTask){this.paintTask.cancel();this.paintTask=null}this.resume=null;if(this.textLayer){this.textLayer.cancel();this.textLayer=null}if(this.annotationLayer&&(!a||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null}if(this.xfaLayer&&(!o||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null}if(this._onTextLayerRendered){this.eventBus._off("textlayerrendered",this._onTextLayerRendered);this._onTextLayerRendered=null}}},{key:"cssTransform",value:function cssTransform(t){var r=t.target,a=t.redrawAnnotationLayer,i=void 0!==a&&a,o=t.redrawXfaLayer,l=void 0!==o&&o,u=this.viewport.width,c=this.viewport.height,d=this.div;r.style.width=r.parentNode.style.width=d.style.width=Math.floor(u)+"px";r.style.height=r.parentNode.style.height=d.style.height=Math.floor(c)+"px";var h=this.viewport.rotation-this.paintedViewportMap.get(r).rotation,p=Math.abs(h),m=1,g=1;if(90===p||270===p){m=c/u;g=u/c}r.style.transform="rotate(".concat(h,"deg) scale(").concat(m,", ").concat(g,")");if(this.textLayer){var v=this.textLayer.viewport,y=this.viewport.rotation-v.rotation,b=Math.abs(y),S=u/v.width;90!==b&&270!==b||(S=u/v.height);var w,C,P=this.textLayer.textLayerDiv;switch(b){case 0:w=C=0;break;case 90:w=0;C="-"+P.style.height;break;case 180:w="-"+P.style.width;C="-"+P.style.height;break;case 270:w="-"+P.style.width;C=0;break;default:console.error("Bad rotation value.")}P.style.transform="rotate(".concat(b,"deg) ")+"scale(".concat(S,") ")+"translate(".concat(w,", ").concat(C,")");P.style.transformOrigin="0% 0%"}i&&this.annotationLayer&&this._renderAnnotationLayer();l&&this.xfaLayer&&this._renderXfaLayer()}},{key:"width",get:function get(){return this.viewport.width}},{key:"height",get:function get(){return this.viewport.height}},{key:"getPagePoint",value:function getPagePoint(t,r){return this.viewport.convertToPdfPoint(t,r)}},{key:"draw",value:function draw(){var t,r,a=this;if(this.renderingState!==c.RenderingStates.INITIAL){console.error("Must be in new state before drawing");this.reset()}var u=this.div,d=this.pdfPage;if(!d){this.renderingState=c.RenderingStates.FINISHED;if(this.loadingIconDiv){u.removeChild(this.loadingIconDiv);delete this.loadingIconDiv}return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=c.RenderingStates.RUNNING;var h=document.createElement("div");h.style.width=u.style.width;h.style.height=u.style.height;h.classList.add("canvasWrapper");null!==(t=this.annotationLayer)&&void 0!==t&&t.div?u.insertBefore(h,this.annotationLayer.div):u.appendChild(h);var p=null;if(this.textLayerMode!==o.TextLayerMode.DISABLE&&this.textLayerFactory){var m,g=document.createElement("div");g.className="textLayer";g.style.width=h.style.width;g.style.height=h.style.height;null!==(m=this.annotationLayer)&&void 0!==m&&m.div?u.insertBefore(g,this.annotationLayer.div):u.appendChild(g);p=this.textLayerFactory.createTextLayerBuilder(g,this.id-1,this.viewport,this.textLayerMode===o.TextLayerMode.ENABLE_ENHANCE,this.eventBus)}this.textLayer=p;null!==(r=this.xfaLayer)&&void 0!==r&&r.div&&u.appendChild(this.xfaLayer.div);var v=null;this.renderingQueue&&(v=function renderContinueCallback(t){if(a.renderingQueue.isHighestPriority(a))t();else{a.renderingState=c.RenderingStates.PAUSED;a.resume=function(){a.renderingState=c.RenderingStates.RUNNING;t()}}});var y=function(){var t=_asyncToGenerator(i.default.mark((function _callee3(){var t,r=arguments;return i.default.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:null;b===a.paintTask&&(a.paintTask=null);if(!(t instanceof l.RenderingCancelledException)){i.next=5;break}a._renderError=null;return i.abrupt("return");case 5:a._renderError=t;a.renderingState=c.RenderingStates.FINISHED;if(a.loadingIconDiv){u.removeChild(a.loadingIconDiv);delete a.loadingIconDiv}a._resetZoomLayer(!0);a.eventBus.dispatch("pagerendered",{source:a,pageNumber:a.id,cssTransform:!1,timestamp:performance.now(),error:a._renderError});if(!t){i.next=12;break}throw t;case 12:case"end":return i.stop()}}),_callee3)})));return function finishPaintTask(){return t.apply(this,arguments)}}(),b=this.renderer===o.RendererType.SVG?this.paintOnSvg(h):this.paintOnCanvas(h);b.onRenderContinue=v;this.paintTask=b;var S=b.promise.then((function(){return y(null).then((function(){if(p){var t=d.streamTextContent({normalizeWhitespace:!0,includeMarkedContent:!0});p.setTextContentStream(t);p.render()}}))}),(function(t){return y(t)}));if(this.annotationLayerFactory){this.annotationLayer||(this.annotationLayer=this.annotationLayerFactory.createAnnotationLayerBuilder(u,d,null,this.imageResourcesPath,this.renderInteractiveForms,this.l10n,null,null,null));this._renderAnnotationLayer()}if(this.xfaLayerFactory){this.xfaLayer||(this.xfaLayer=this.xfaLayerFactory.createXfaLayerBuilder(u,d,null));this._renderXfaLayer()}if(this.structTreeLayerFactory&&this.textLayer&&this.canvas){this._onTextLayerRendered=function(t){if(t.pageNumber===a.id){a.eventBus._off("textlayerrendered",a._onTextLayerRendered);a._onTextLayerRendered=null;a.canvas&&a.pdfPage.getStructTree().then((function(t){if(t&&a.canvas){var r=a.structTreeLayer.render(t);r.classList.add("structTree");a.canvas.appendChild(r)}}))}};this.eventBus._on("textlayerrendered",this._onTextLayerRendered);this.structTreeLayer=this.structTreeLayerFactory.createStructTreeLayerBuilder(d)}u.setAttribute("data-loaded",!0);this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id});return S}},{key:"paintOnCanvas",value:function paintOnCanvas(t){var r=(0,l.createPromiseCapability)(),a={promise:r.promise,onRenderContinue:function onRenderContinue(t){t()},cancel:function cancel(){T.cancel()}},i=this.viewport,u=document.createElement("canvas");u.hidden=!0;var c=!0,d=function showCanvas(){if(c){u.hidden=!1;c=!1}};t.appendChild(u);this.canvas=u;u.mozOpaque=!0;var m=u.getContext("2d",{alpha:!1}),g=(0,o.getOutputScale)(m);this.outputScale=g;if(this.useOnlyCssZoom){var v=i.clone({scale:o.CSS_UNITS});g.sx*=v.width/i.width;g.sy*=v.height/i.height;g.scaled=!0}if(this.maxCanvasPixels>0){var y=i.width*i.height,b=Math.sqrt(this.maxCanvasPixels/y);if(g.sx>b||g.sy>b){g.sx=b;g.sy=b;g.scaled=!0;this.hasRestrictedScaling=!0}else this.hasRestrictedScaling=!1}var S=(0,o.approximateFraction)(g.sx),w=(0,o.approximateFraction)(g.sy),C=(0,o.roundToDivide)(i.width*g.sx,S[0]),P=(0,o.roundToDivide)(i.height*g.sy,w[0]);if((C>=4096||P>=4096)&&(this.maxWidth||!h.default.test({width:C,height:P}))){var k=this.determineMaxDimensions(),R=Math.max(C/k,P/k),A=Math.floor(100*this.scale/R)/100;R=this.scale/A;this.scale=A;window.PDFViewerApplicationOptions.set("maxZoom",A);PDFViewerApplication.pdfViewer.currentScaleValue=this.scale;i.width/=R;i.height/=R;(0,p.warn)("Page "+this.id+": Reduced the maximum zoom to "+A+" because the browser can't render larger canvases.")}u.width=(0,o.roundToDivide)(i.width*g.sx,S[0]);u.height=(0,o.roundToDivide)(i.height*g.sy,w[0]);u.style.width=(0,o.roundToDivide)(i.width,S[1])+"px";u.style.height=(0,o.roundToDivide)(i.height,w[1])+"px";this.paintedViewportMap.set(u,i);var x={canvasContext:m,transform:g.scaled?[g.sx,0,0,g.sy,0,0]:null,viewport:this.viewport,renderInteractiveForms:this.renderInteractiveForms,optionalContentConfigPromise:this._optionalContentConfigPromise,background:PDFViewerApplicationOptions.get("pdfBackgroundColor")},T=this.pdfPage.render(x);T.onContinue=function(t){d();a.onRenderContinue?a.onRenderContinue(t):t()};T.promise.then((function(){d();r.resolve(void 0)}),(function(t){d();r.reject(t)}));return a}},{key:"paintOnSvg",value:function paintOnSvg(t){var r=this,a=!1,i=function ensureNotCancelled(){if(a)throw new l.RenderingCancelledException("Rendering cancelled, page ".concat(r.id),"svg")},u=this.pdfPage,h=this.viewport.clone({scale:o.CSS_UNITS});return{promise:u.getOperatorList().then((function(a){i();return new l.SVGGraphics(u.commonObjs,u.objs,d.viewerCompatibilityParams.disableCreateObjectURL).getSVG(a,h).then((function(a){i();r.svg=a;r.paintedViewportMap.set(a,h);a.style.width=t.style.width;a.style.height=t.style.height;r.renderingState=c.RenderingStates.FINISHED;t.appendChild(a)}))})),onRenderContinue:function onRenderContinue(t){t()},cancel:function cancel(){a=!0}}}},{key:"setPageLabel",value:function setPageLabel(t){this.pageLabel="string"==typeof t?t:null;null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}},{key:"determineMaxDimensions",value:function determineMaxDimensions(){if(this.maxWidth)return this.maxWidth;for(var t=0,r=[4096,8192,10836,11180,11402,14188,16384];t<r.length;t++){var a=r[t];if(!h.default.test({width:a+1,height:a+1})){this.maxWidth=a;return this.maxWidth}}return 16384}}]);var t,r;return PDFPageView}();r.PDFPageView=g},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default=void 0;function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})));a.push.apply(a,i)}return a}function _objectSpread2(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){_defineProperty(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _objectWithoutProperties(t,r){if(null==t)return{};var a,i,o=function _objectWithoutPropertiesLoose(t,r){if(null==t)return{};var a,i,o={},l=Object.keys(t);for(i=0;i<l.length;i++){a=l[i];r.indexOf(a)>=0||(o[a]=t[a])}return o}(t,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(i=0;i<l.length;i++){a=l[i];r.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(o[a]=t[a])}}return o}function _slicedToArray(t,r){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(t,r)||_unsupportedIterableToArray(t,r)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function canvasTest(t){var r,a,i=t.sizes.shift(),o=Math.max(Math.ceil(i[0]),1),l=Math.max(Math.ceil(i[1]),1),u=[o-1,l-1,1,1],c=Date.now(),d="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;if(d){r=new OffscreenCanvas(1,1);a=new OffscreenCanvas(o,l)}else{(r=document.createElement("canvas")).width=1;r.height=1;(a=document.createElement("canvas")).width=o;a.height=l}var h=r.getContext("2d"),p=a.getContext("2d");if(p){p.fillRect.apply(p,u);h.drawImage(a,o-1,l-1,1,1,0,0,1,1)}var m=h&&0!==h.getImageData(0,0,1,1).data[3],g=Date.now()-c;if(d){postMessage({width:o,height:l,benchmark:g,isTestPass:m});!m&&t.sizes.length&&canvasTest(t)}else if(m)t.onSuccess(o,l,g);else{t.onError(o,l,g);t.sizes.length&&canvasTest(t)}return m}var a=[16384,14188,11402,11180,10836,8192,4096,1],i=[8388607,65535,32767,16384,8192,4096,1],o=[4194303,65535,32767,16384,8192,4096,1],l=["onError","onSuccess"],u={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},c={};function createSizesArray(t){var r=t.width===t.height,a=1===t.height,i=1===t.width,o=[];if(t.width&&t.height)for(var l=t.min||u.min,c=t.step||u.step,d=Math.max(t.width,t.height);d>=l;){var h=r||a?d:1,p=r||i?d:1;o.push([h,p]);d-=c}else t.sizes.forEach((function(t){var l=r||a?t:1,u=r||i?t:1;o.push([l,u])}));return o}function handleMethod(t){var r=window&&"HTMLCanvasElement"in window,a=window&&"OffscreenCanvas"in window,i=Date.now(),o=t.onError,u=t.onSuccess,d=_objectWithoutProperties(t,l),h=null;if(!r)return!1;if(t.useWorker&&a){var p="\n var canvasTest = ".concat(canvasTest.toString(),";\n onmessage = function(e) {\n canvasTest(e.data);\n };\n "),m=new Blob([p],{type:"application/javascript"}),g=URL.createObjectURL(m);h=new Worker(g);URL.revokeObjectURL(g);h.onmessage=function(t){var r=t.data,a=r.width,o=r.height,l=r.benchmark;if(r.isTestPass){c[i].onSuccess(a,o,l);delete c[i]}else c[i].onError(a,o,l)}}if(t.usePromise)return new Promise((function(r,a){var l=_objectSpread2(_objectSpread2({},t),{},{onError:function onError(r,i,l){var u;if(0===t.sizes.length)u=!0;else{var c=_slicedToArray(t.sizes.slice(-1),1),d=_slicedToArray(c[0],2),h=d[0],p=d[1];u=r===h&&i===p}o(r,i,l);u&&a({width:r,height:i,benchmark:l})},onSuccess:function onSuccess(t,a,i){u(t,a,i);r({width:t,height:a,benchmark:i})}});if(h){var p=l.onError,m=l.onSuccess;c[i]={onError:p,onSuccess:m};h.postMessage(d)}else canvasTest(l)}));if(!h)return canvasTest(t);c[i]={onError:o,onSuccess:u};h.postMessage(d)}var d={maxArea:function maxArea(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=createSizesArray({width:t.max,height:t.max,min:t.min,step:t.step,sizes:_toConsumableArray(a)}),i=_objectSpread2(_objectSpread2(_objectSpread2({},u),t),{},{sizes:r});return handleMethod(i)},maxHeight:function maxHeight(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=createSizesArray({width:1,height:t.max,min:t.min,step:t.step,sizes:_toConsumableArray(i)}),a=_objectSpread2(_objectSpread2(_objectSpread2({},u),t),{},{sizes:r});return handleMethod(a)},maxWidth:function maxWidth(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=createSizesArray({width:t.max,height:1,min:t.min,step:t.step,sizes:_toConsumableArray(o)}),a=_objectSpread2(_objectSpread2(_objectSpread2({},u),t),{},{sizes:r});return handleMethod(a)},test:function test(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=_objectSpread2(_objectSpread2({},u),t);r.sizes=_toConsumableArray(r.sizes);r.width&&r.height&&(r.sizes=[[r.width,r.height]]);return handleMethod(r)}};r.default=d},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.arrayByteLength=arrayByteLength;r.arraysToBytes=function arraysToBytes(t){var r=t.length;if(1===r&&t[0]instanceof Uint8Array)return t[0];for(var a=0,i=0;i<r;i++)a+=arrayByteLength(t[i]);for(var o=0,l=new Uint8Array(a),u=0;u<r;u++){var c=t[u];c instanceof Uint8Array||(c="string"==typeof c?stringToBytes(c):new Uint8Array(c));var d=c.byteLength;l.set(c,o);o+=d}return l};r.assert=assert;r.bytesToString=function bytesToString(t){assert(null!==t&&"object"===_typeof(t)&&void 0!==t.length,"Invalid argument for bytesToString");var r=t.length,a=8192;if(r<a)return String.fromCharCode.apply(null,t);for(var i=[],o=0;o<r;o+=a){var l=Math.min(o+a,r),u=t.subarray(o,l);i.push(String.fromCharCode.apply(null,u))}return i.join("")};r.createObjectURL=function createObjectURL(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(URL.createObjectURL&&!a)return URL.createObjectURL(new Blob([t],{type:r}));for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="data:".concat(r,";base64,"),l=0,u=t.length;l<u;l+=3){var c=255&t[l],d=255&t[l+1],h=255&t[l+2],p=c>>2,m=(3&c)<<4|d>>4,g=l+1<u?(15&d)<<2|h>>6:64,v=l+2<u?63&h:64;o+=i[p]+i[m]+i[g]+i[v]}return o};r.createPromiseCapability=function createPromiseCapability(){var t=Object.create(null),r=!1;Object.defineProperty(t,"settled",{get:function get(){return r}});t.promise=new Promise((function(a,i){t.resolve=function(t){r=!0;a(t)};t.reject=function(t){r=!0;i(t)}}));return t};r.createValidAbsoluteUrl=function createValidAbsoluteUrl(t,r){if(!t)return null;try{var a=r?new URL(t,r):new URL(t);if(function _isValidProtocol(t){if(!t)return!1;switch(t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(a))return a}catch(t){}return null};r.escapeString=function escapeString(t){return t.replace(/([()\\\n\r])/g,(function(t){return"\n"===t?"\\n":"\r"===t?"\\r":"\\".concat(t)}))};r.getModificationDate=function getModificationDate(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,r=[t.getUTCFullYear().toString(),(t.getUTCMonth()+1).toString().padStart(2,"0"),t.getUTCDate().toString().padStart(2,"0"),t.getUTCHours().toString().padStart(2,"0"),t.getUTCMinutes().toString().padStart(2,"0"),t.getUTCSeconds().toString().padStart(2,"0")];return r.join("")};r.getVerbosityLevel=function getVerbosityLevel(){return o};r.info=function info(t){o>=i.INFOS&&console.log("Info: ".concat(t))};r.isArrayBuffer=function isArrayBuffer(t){return"object"===_typeof(t)&&null!==t&&void 0!==t.byteLength};r.isArrayEqual=function isArrayEqual(t,r){if(t.length!==r.length)return!1;for(var a=0,i=t.length;a<i;a++)if(t[a]!==r[a])return!1;return!0};r.isAscii=function isAscii(t){return/^[\x00-\x7F]*$/.test(t)};r.isBool=function isBool(t){return"boolean"==typeof t};r.isNum=function isNum(t){return"number"==typeof t};r.isSameOrigin=function isSameOrigin(t,r){var a;try{if(!(a=new URL(t)).origin||"null"===a.origin)return!1}catch(t){return!1}var i=new URL(r,a);return a.origin===i.origin};r.isString=function isString(t){return"string"==typeof t};r.objectFromMap=function objectFromMap(t){var r,a=Object.create(null),i=function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=_unsupportedIterableToArray(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}(t);try{for(i.s();!(r=i.n()).done;){var o=(c=r.value,d=2,function _arrayWithHoles(t){if(Array.isArray(t))return t}(c)||function _iterableToArrayLimit(t,r){var a=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==a)return;var i,o,l=[],u=!0,c=!1;try{for(a=a.call(t);!(u=(i=a.next()).done);u=!0){l.push(i.value);if(r&&l.length===r)break}}catch(t){c=!0;o=t}finally{try{u||null==a.return||a.return()}finally{if(c)throw o}}return l}(c,d)||_unsupportedIterableToArray(c,d)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=o[0],u=o[1];a[l]=u}}catch(t){i.e(t)}finally{i.f()}var c,d;return a};r.objectSize=function objectSize(t){return Object.keys(t).length};r.removeNullCharacters=function removeNullCharacters(t){if("string"!=typeof t){warn("The argument for removeNullCharacters must be a string.");return t}return t.replace(v,"")};r.setVerbosityLevel=function setVerbosityLevel(t){Number.isInteger(t)&&(o=t)};r.shadow=shadow;r.string32=function string32(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)};r.stringToBytes=stringToBytes;r.stringToPDFString=function stringToPDFString(t){var r=t.length,a=[];if("þ"===t[0]&&"ÿ"===t[1])for(var i=2;i<r;i+=2)a.push(String.fromCharCode(t.charCodeAt(i)<<8|t.charCodeAt(i+1)));else if("ÿ"===t[0]&&"þ"===t[1])for(var o=2;o<r;o+=2)a.push(String.fromCharCode(t.charCodeAt(o+1)<<8|t.charCodeAt(o)));else for(var l=0;l<r;++l){var u=C[t.charCodeAt(l)];a.push(u?String.fromCharCode(u):t.charAt(l))}return a.join("")};r.stringToUTF16BEString=function stringToUTF16BEString(t){for(var r=["þÿ"],a=0,i=t.length;a<i;a++){var o=t.charCodeAt(a);r.push(String.fromCharCode(o>>8&255),String.fromCharCode(255&o))}return r.join("")};r.stringToUTF8String=function stringToUTF8String(t){return decodeURIComponent(escape(t))};r.unreachable=unreachable;r.utf8StringToString=function utf8StringToString(t){return unescape(encodeURIComponent(t))};r.warn=warn;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;a(39);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);return"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}r.IDENTITY_MATRIX=[1,0,0,1,0,0];r.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];r.PermissionFlag={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.TextRenderingMode={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.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};r.AnnotationType={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.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};r.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};r.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};r.AnnotationReplyType={GROUP:"Group",REPLY:"R"};r.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};r.AnnotationFieldFlag={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.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};r.AnnotationActionEventType={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.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};r.PageActionEventType={O:"PageOpen",C:"PageClose"};r.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};r.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};var i={ERRORS:0,WARNINGS:1,INFOS:5};r.VerbosityLevel=i;r.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};r.OPS={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.UNSUPPORTED_FEATURES={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.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};var o=i.WARNINGS;function warn(t){o>=i.WARNINGS&&console.log("Warning: ".concat(t))}function unreachable(t){throw new Error(t)}function assert(t,r){t||unreachable(r)}function shadow(t,r,a){Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!1});return a}var l=function BaseExceptionClosure(){function BaseException(t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=t;this.name=this.constructor.name}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();r.BaseException=l;var u=function(t){_inherits(PasswordException,t);var r=_createSuper(PasswordException);function PasswordException(t,a){var i;_classCallCheck(this,PasswordException);(i=r.call(this,t)).code=a;return i}return PasswordException}(l);r.PasswordException=u;var c=function(t){_inherits(UnknownErrorException,t);var r=_createSuper(UnknownErrorException);function UnknownErrorException(t,a){var i;_classCallCheck(this,UnknownErrorException);(i=r.call(this,t)).details=a;return i}return UnknownErrorException}(l);r.UnknownErrorException=c;var d=function(t){_inherits(InvalidPDFException,t);var r=_createSuper(InvalidPDFException);function InvalidPDFException(){_classCallCheck(this,InvalidPDFException);return r.apply(this,arguments)}return InvalidPDFException}(l);r.InvalidPDFException=d;var h=function(t){_inherits(MissingPDFException,t);var r=_createSuper(MissingPDFException);function MissingPDFException(){_classCallCheck(this,MissingPDFException);return r.apply(this,arguments)}return MissingPDFException}(l);r.MissingPDFException=h;var p=function(t){_inherits(UnexpectedResponseException,t);var r=_createSuper(UnexpectedResponseException);function UnexpectedResponseException(t,a){var i;_classCallCheck(this,UnexpectedResponseException);(i=r.call(this,t)).status=a;return i}return UnexpectedResponseException}(l);r.UnexpectedResponseException=p;var m=function(t){_inherits(FormatError,t);var r=_createSuper(FormatError);function FormatError(){_classCallCheck(this,FormatError);return r.apply(this,arguments)}return FormatError}(l);r.FormatError=m;var g=function(t){_inherits(AbortException,t);var r=_createSuper(AbortException);function AbortException(){_classCallCheck(this,AbortException);return r.apply(this,arguments)}return AbortException}(l);r.AbortException=g;var v=/\x00/g;function stringToBytes(t){assert("string"==typeof t,"Invalid argument for stringToBytes");for(var r=t.length,a=new Uint8Array(r),i=0;i<r;++i)a[i]=255&t.charCodeAt(i);return a}function arrayByteLength(t){if(void 0!==t.length)return t.length;assert(void 0!==t.byteLength,"arrayByteLength - invalid argument.");return t.byteLength}var y={get value(){return shadow(this,"value",function isLittleEndian(){var t=new Uint8Array(4);t[0]=1;return 1===new Uint32Array(t.buffer,0,1)[0]}())}};r.IsLittleEndianCached=y;var b={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(t){return!1}}())}};r.IsEvalSupportedCached=b;var S=function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_unsupportedIterableToArray(t)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array(256).keys()).map((function(t){return t.toString(16).padStart(2,"0")})),w=function(){function Util(){_classCallCheck(this,Util)}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(Util,null,[{key:"makeHexColor",value:function makeHexColor(t,r,a){return"#".concat(S[t]).concat(S[r]).concat(S[a])}},{key:"transform",value:function transform(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}},{key:"applyTransform",value:function applyTransform(t,r){return[t[0]*r[0]+t[1]*r[2]+r[4],t[0]*r[1]+t[1]*r[3]+r[5]]}},{key:"applyInverseTransform",value:function applyInverseTransform(t,r){var a=r[0]*r[3]-r[1]*r[2];return[(t[0]*r[3]-t[1]*r[2]+r[2]*r[5]-r[4]*r[3])/a,(-t[0]*r[1]+t[1]*r[0]+r[4]*r[1]-r[5]*r[0])/a]}},{key:"getAxialAlignedBoundingBox",value:function getAxialAlignedBoundingBox(t,r){var a=Util.applyTransform(t,r),i=Util.applyTransform(t.slice(2,4),r),o=Util.applyTransform([t[0],t[3]],r),l=Util.applyTransform([t[2],t[1]],r);return[Math.min(a[0],i[0],o[0],l[0]),Math.min(a[1],i[1],o[1],l[1]),Math.max(a[0],i[0],o[0],l[0]),Math.max(a[1],i[1],o[1],l[1])]}},{key:"inverseTransform",value:function inverseTransform(t){var r=t[0]*t[3]-t[1]*t[2];return[t[3]/r,-t[1]/r,-t[2]/r,t[0]/r,(t[2]*t[5]-t[4]*t[3])/r,(t[4]*t[1]-t[5]*t[0])/r]}},{key:"apply3dTransform",value:function apply3dTransform(t,r){return[t[0]*r[0]+t[1]*r[1]+t[2]*r[2],t[3]*r[0]+t[4]*r[1]+t[5]*r[2],t[6]*r[0]+t[7]*r[1]+t[8]*r[2]]}},{key:"singularValueDecompose2dScale",value:function singularValueDecompose2dScale(t){var r=[t[0],t[2],t[1],t[3]],a=t[0]*r[0]+t[1]*r[2],i=t[0]*r[1]+t[1]*r[3],o=t[2]*r[0]+t[3]*r[2],l=t[2]*r[1]+t[3]*r[3],u=(a+l)/2,c=Math.sqrt(Math.pow(a+l,2)-4*(a*l-o*i))/2,d=u+c||1,h=u-c||1;return[Math.sqrt(d),Math.sqrt(h)]}},{key:"normalizeRect",value:function normalizeRect(t){var r=t.slice(0);if(t[0]>t[2]){r[0]=t[2];r[2]=t[0]}if(t[1]>t[3]){r[1]=t[3];r[3]=t[1]}return r}},{key:"intersect",value:function intersect(t,r){function compare(t,r){return t-r}var a=[t[0],t[2],r[0],r[2]].sort(compare),i=[t[1],t[3],r[1],r[3]].sort(compare),o=[];t=Util.normalizeRect(t);r=Util.normalizeRect(r);if(!(a[0]===t[0]&&a[1]===r[0]||a[0]===r[0]&&a[1]===t[0]))return null;o[0]=a[1];o[2]=a[2];if(!(i[0]===t[1]&&i[1]===r[1]||i[0]===r[1]&&i[1]===t[1]))return null;o[1]=i[1];o[3]=i[2];return o}}]);return Util}();r.Util=w;var C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364]},(t,r,a)=>{"use strict";if("undefined"==typeof globalThis||!globalThis._pdfjsCompatibilityChecked){"undefined"!=typeof globalThis&&globalThis.Math===Math||(globalThis=a(40));globalThis._pdfjsCompatibilityChecked=!0;!function checkNodeBtoa(){globalThis.btoa}();!function checkNodeAtob(){globalThis.atob}();!function checkDOMMatrix(){globalThis.DOMMatrix}();!function checkObjectFromEntries(){Object.fromEntries||a(94)}();!function checkPromise(){globalThis.Promise.allSettled||(globalThis.Promise=a(122))}();!function checkReadableStream(){var t=!1;if("undefined"!=typeof ReadableStream)try{new ReadableStream({start:function start(t){t.close()}});t=!0}catch(t){}t||(globalThis.ReadableStream=a(150).ReadableStream)}()}},(t,r,a)=>{a(41);t.exports=a(43)},(t,r,a)=>{a(42)({global:!0},{globalThis:a(43)})},(t,r,a)=>{var i=a(43),o=a(44).f,l=a(73),u=a(76),c=a(67),d=a(82),h=a(92);t.exports=function(t,r){var a,p,m,g,v,y=t.target,b=t.global,S=t.stat;if(a=b?i:S?i[y]||c(y,{}):(i[y]||{}).prototype)for(p in r){g=r[p];m=t.noTargetGet?(v=o(a,p))&&v.value:a[p];if(!h(b?p:y+(S?".":"#")+p,t.forced)&&void 0!==m){if(typeof g==typeof m)continue;d(g,m)}(t.sham||m&&m.sham)&&l(g,"sham",!0);u(a,p,g,t)}}},t=>{var check=function(t){return t&&t.Math==Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||Function("return this")()},(t,r,a)=>{var i=a(45),o=a(47),l=a(48),u=a(49),c=a(53),d=a(68),h=a(71),p=Object.getOwnPropertyDescriptor;r.f=i?p:function getOwnPropertyDescriptor(t,r){t=u(t);r=c(r);if(h)try{return p(t,r)}catch(t){}if(d(t,r))return l(!o.f.call(t,r),t[r])}},(t,r,a)=>{var i=a(46);t.exports=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},(t,r)=>{"use strict";var a={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,o=i&&!a.call({1:2},1);r.f=o?function propertyIsEnumerable(t){var r=i(this,t);return!!r&&r.enumerable}:a},t=>{t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},(t,r,a)=>{var i=a(50),o=a(52);t.exports=function(t){return i(o(t))}},(t,r,a)=>{var i=a(46),o=a(51),l="".split;t.exports=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?l.call(t,""):Object(t)}:Object},t=>{var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},(t,r,a)=>{var i=a(54),o=a(56);t.exports=function(t){var r=i(t,"string");return o(r)?r:String(r)}},(t,r,a)=>{var i=a(55),o=a(56),l=a(62),u=a(63)("toPrimitive");t.exports=function(t,r){if(!i(t)||o(t))return t;var a,c=t[u];if(void 0!==c){void 0===r&&(r="default");a=c.call(t,r);if(!i(a)||o(a))return a;throw TypeError("Can't convert object to primitive value")}void 0===r&&(r="number");return l(t,r)}},t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},(t,r,a)=>{var i=a(57),o=a(58);t.exports=o?function(t){return"symbol"==typeof t}:function(t){var r=i("Symbol");return"function"==typeof r&&Object(t)instanceof r}},(t,r,a)=>{var i=a(43),aFunction=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,r){return arguments.length<2?aFunction(i[t]):i[t]&&i[t][r]}},(t,r,a)=>{var i=a(59);t.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(t,r,a)=>{var i=a(60),o=a(46);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},(t,r,a)=>{var i,o,l=a(43),u=a(61),c=l.process,d=l.Deno,h=c&&c.versions||d&&d.version,p=h&&h.v8;p?o=(i=p.split("."))[0]<4?1:i[0]+i[1]:u&&(!(i=u.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=u.match(/Chrome\/(\d+)/))&&(o=i[1]);t.exports=o&&+o},(t,r,a)=>{var i=a(57);t.exports=i("navigator","userAgent")||""},(t,r,a)=>{var i=a(55);t.exports=function(t,r){var a,o;if("string"===r&&"function"==typeof(a=t.toString)&&!i(o=a.call(t)))return o;if("function"==typeof(a=t.valueOf)&&!i(o=a.call(t)))return o;if("string"!==r&&"function"==typeof(a=t.toString)&&!i(o=a.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},(t,r,a)=>{var i=a(43),o=a(64),l=a(68),u=a(70),c=a(59),d=a(58),h=o("wks"),p=i.Symbol,m=d?p:p&&p.withoutSetter||u;t.exports=function(t){l(h,t)&&(c||"string"==typeof h[t])||(c&&l(p,t)?h[t]=p[t]:h[t]=m("Symbol."+t));return h[t]}},(t,r,a)=>{var i=a(65),o=a(66);(t.exports=function(t,r){return o[t]||(o[t]=void 0!==r?r:{})})("versions",[]).push({version:"3.17.3",mode:i?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},t=>{t.exports=!1},(t,r,a)=>{var i=a(43),o=a(67),l="__core-js_shared__",u=i[l]||o(l,{});t.exports=u},(t,r,a)=>{var i=a(43);t.exports=function(t,r){try{Object.defineProperty(i,t,{value:r,configurable:!0,writable:!0})}catch(a){i[t]=r}return r}},(t,r,a)=>{var i=a(69),o={}.hasOwnProperty;t.exports=Object.hasOwn||function hasOwn(t,r){return o.call(i(t),r)}},(t,r,a)=>{var i=a(52);t.exports=function(t){return Object(i(t))}},t=>{var r=0,a=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++r+a).toString(36)}},(t,r,a)=>{var i=a(45),o=a(46),l=a(72);t.exports=!i&&!o((function(){return 7!=Object.defineProperty(l("div"),"a",{get:function(){return 7}}).a}))},(t,r,a)=>{var i=a(43),o=a(55),l=i.document,u=o(l)&&o(l.createElement);t.exports=function(t){return u?l.createElement(t):{}}},(t,r,a)=>{var i=a(45),o=a(74),l=a(48);t.exports=i?function(t,r,a){return o.f(t,r,l(1,a))}:function(t,r,a){t[r]=a;return t}},(t,r,a)=>{var i=a(45),o=a(71),l=a(75),u=a(53),c=Object.defineProperty;r.f=i?c:function defineProperty(t,r,a){l(t);r=u(r);l(a);if(o)try{return c(t,r,a)}catch(t){}if("get"in a||"set"in a)throw TypeError("Accessors not supported");"value"in a&&(t[r]=a.value);return t}},(t,r,a)=>{var i=a(55);t.exports=function(t){if(!i(t))throw TypeError(String(t)+" is not an object");return t}},(t,r,a)=>{var i=a(43),o=a(73),l=a(68),u=a(67),c=a(77),d=a(78),h=d.get,p=d.enforce,m=String(String).split("String");(t.exports=function(t,r,a,c){var d,h=!!c&&!!c.unsafe,g=!!c&&!!c.enumerable,v=!!c&&!!c.noTargetGet;if("function"==typeof a){"string"!=typeof r||l(a,"name")||o(a,"name",r);(d=p(a)).source||(d.source=m.join("string"==typeof r?r:""))}if(t!==i){h?!v&&t[r]&&(g=!0):delete t[r];g?t[r]=a:o(t,r,a)}else g?t[r]=a:u(r,a)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&h(this).source||c(this)}))},(t,r,a)=>{var i=a(66),o=Function.toString;"function"!=typeof i.inspectSource&&(i.inspectSource=function(t){return o.call(t)});t.exports=i.inspectSource},(t,r,a)=>{var i,o,l,u=a(79),c=a(43),d=a(55),h=a(73),p=a(68),m=a(66),g=a(80),v=a(81),y="Object already initialized",b=c.WeakMap;if(u||m.state){var S=m.state||(m.state=new b),w=S.get,C=S.has,P=S.set;i=function(t,r){if(C.call(S,t))throw new TypeError(y);r.facade=t;P.call(S,t,r);return r};o=function(t){return w.call(S,t)||{}};l=function(t){return C.call(S,t)}}else{var k=g("state");v[k]=!0;i=function(t,r){if(p(t,k))throw new TypeError(y);r.facade=t;h(t,k,r);return r};o=function(t){return p(t,k)?t[k]:{}};l=function(t){return p(t,k)}}t.exports={set:i,get:o,has:l,enforce:function(t){return l(t)?o(t):i(t,{})},getterFor:function(t){return function(r){var a;if(!d(r)||(a=o(r)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return a}}}},(t,r,a)=>{var i=a(43),o=a(77),l=i.WeakMap;t.exports="function"==typeof l&&/native code/.test(o(l))},(t,r,a)=>{var i=a(64),o=a(70),l=i("keys");t.exports=function(t){return l[t]||(l[t]=o(t))}},t=>{t.exports={}},(t,r,a)=>{var i=a(68),o=a(83),l=a(44),u=a(74);t.exports=function(t,r){for(var a=o(r),c=u.f,d=l.f,h=0;h<a.length;h++){var p=a[h];i(t,p)||c(t,p,d(r,p))}}},(t,r,a)=>{var i=a(57),o=a(84),l=a(91),u=a(75);t.exports=i("Reflect","ownKeys")||function ownKeys(t){var r=o.f(u(t)),a=l.f;return a?r.concat(a(t)):r}},(t,r,a)=>{var i=a(85),o=a(90).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return i(t,o)}},(t,r,a)=>{var i=a(68),o=a(49),l=a(86).indexOf,u=a(81);t.exports=function(t,r){var a,c=o(t),d=0,h=[];for(a in c)!i(u,a)&&i(c,a)&&h.push(a);for(;r.length>d;)i(c,a=r[d++])&&(~l(h,a)||h.push(a));return h}},(t,r,a)=>{var i=a(49),o=a(87),l=a(89),createMethod=function(t){return function(r,a,u){var c,d=i(r),h=o(d.length),p=l(u,h);if(t&&a!=a){for(;h>p;)if((c=d[p++])!=c)return!0}else for(;h>p;p++)if((t||p in d)&&d[p]===a)return t||p||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(t,r,a)=>{var i=a(88),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},t=>{var r=Math.ceil,a=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?a:r)(t)}},(t,r,a)=>{var i=a(88),o=Math.max,l=Math.min;t.exports=function(t,r){var a=i(t);return a<0?o(a+r,0):l(a,r)}},t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(t,r)=>{r.f=Object.getOwnPropertySymbols},(t,r,a)=>{var i=a(46),o=/#|\.prototype\./,isForced=function(t,r){var a=u[l(t)];return a==d||a!=c&&("function"==typeof r?i(r):!!r)},l=isForced.normalize=function(t){return String(t).replace(o,".").toLowerCase()},u=isForced.data={},c=isForced.NATIVE="N",d=isForced.POLYFILL="P";t.exports=isForced},(t,r,a)=>{"use strict";var i,o,l;function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}l=function(){var t=function CSSMatrix(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];this.setIdentity();return t&&t.length&&this.setMatrixValue(t)},r={isIdentity:{configurable:!0},is2D:{configurable:!0}};r.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44};r.isIdentity.set=function(t){this.isIdentity=t};r.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44};r.is2D.set=function(t){this.is2D=t};Object.defineProperties(t.prototype,r);var a=t.prototype;function Translate(r,a,i){var o=new t;o.m41=r;o.e=r;o.m42=a;o.f=a;o.m43=i;return o}function Rotate(r,a,i){var o=new t,l=r*Math.PI/180,u=a*Math.PI/180,c=i*Math.PI/180,d=Math.cos(l),h=-Math.sin(l),p=Math.cos(u),m=-Math.sin(u),g=Math.cos(c),v=-Math.sin(c),y=p*g,b=-p*v;o.m11=y;o.a=y;o.m12=b;o.b=b;o.m13=m;var S=h*m*g+d*v;o.m21=S;o.c=S;var w=d*g-h*m*v;o.m22=w;o.d=w;o.m23=-h*p;o.m31=h*v-d*m*g;o.m32=h*g+d*m*v;o.m33=d*p;return o}function RotateAxisAngle(r,a,i,o){var l=new t,u=o*Math.PI/360,c=Math.sin(u),d=Math.cos(u),h=c*c,p=Math.sqrt(r*r+a*a+i*i),m=0,g=0,v=1;if(0!==p){m=r/p;g=a/p;v=i/p}var y=m*m,b=g*g,S=v*v,w=1-2*(b+S)*h;l.m11=w;l.a=w;var C=2*(r*a*h+i*c*d);l.m12=C;l.b=C;l.m13=2*(r*i*h-a*c*d);var P=2*(a*r*h-i*c*d);l.m21=P;l.c=P;var k=1-2*(S+y)*h;l.m22=k;l.d=k;l.m23=2*(a*i*h+r*c*d);l.m31=2*(i*r*h+a*c*d);l.m32=2*(i*a*h-r*c*d);l.m33=1-2*(y+b)*h;l.m14=0;l.m24=0;l.m34=0;l.m41=0;l.e=0;l.m42=0;l.f=0;l.m43=0;l.m44=1;return l}function Scale(r,a,i){var o=new t;o.m11=r;o.a=r;o.m22=a;o.d=a;o.m33=i;return o}function SkewX(r){var a=r*Math.PI/180,i=new t,o=Math.tan(a);i.m21=o;i.c=o;return i}function SkewY(r){var a=r*Math.PI/180,i=new t,o=Math.tan(a);i.m12=o;i.b=o;return i}function Multiply(r,a){var i=a.m11*r.m11+a.m12*r.m21+a.m13*r.m31+a.m14*r.m41,o=a.m11*r.m12+a.m12*r.m22+a.m13*r.m32+a.m14*r.m42,l=a.m11*r.m13+a.m12*r.m23+a.m13*r.m33+a.m14*r.m43,u=a.m11*r.m14+a.m12*r.m24+a.m13*r.m34+a.m14*r.m44,c=a.m21*r.m11+a.m22*r.m21+a.m23*r.m31+a.m24*r.m41,d=a.m21*r.m12+a.m22*r.m22+a.m23*r.m32+a.m24*r.m42,h=a.m21*r.m13+a.m22*r.m23+a.m23*r.m33+a.m24*r.m43,p=a.m21*r.m14+a.m22*r.m24+a.m23*r.m34+a.m24*r.m44,m=a.m31*r.m11+a.m32*r.m21+a.m33*r.m31+a.m34*r.m41,g=a.m31*r.m12+a.m32*r.m22+a.m33*r.m32+a.m34*r.m42,v=a.m31*r.m13+a.m32*r.m23+a.m33*r.m33+a.m34*r.m43,y=a.m31*r.m14+a.m32*r.m24+a.m33*r.m34+a.m34*r.m44,b=a.m41*r.m11+a.m42*r.m21+a.m43*r.m31+a.m44*r.m41,S=a.m41*r.m12+a.m42*r.m22+a.m43*r.m32+a.m44*r.m42,w=a.m41*r.m13+a.m42*r.m23+a.m43*r.m33+a.m44*r.m43,C=a.m41*r.m14+a.m42*r.m24+a.m43*r.m34+a.m44*r.m44;return new t([i,c,m,b,o,d,g,S,l,h,v,w,u,p,y,C])}function feedFromArray(t,r){var a=Array.from(r);if(16===a.length){var i=a[0],o=a[1],l=a[2],u=a[3],c=a[4],d=a[5],h=a[6],p=a[7],m=a[8],g=a[9],v=a[10],y=a[11],b=a[12],S=a[13],w=a[14],C=a[15];t.m11=i;t.a=i;t.m21=o;t.c=o;t.m31=l;t.m41=u;t.e=u;t.m12=c;t.b=c;t.m22=d;t.d=d;t.m32=h;t.m42=p;t.f=p;t.m13=m;t.m23=g;t.m33=v;t.m43=y;t.m14=b;t.m24=S;t.m34=w;t.m44=C}else{if(6!==a.length)throw new TypeError("CSSMatrix: expecting a 6/16 values Array");var P=a[0],k=a[1],R=a[2],A=a[3],x=a[4],T=a[5];t.m11=P;t.a=P;t.m12=k;t.b=k;t.m21=R;t.c=R;t.m22=A;t.d=A;t.m14=x;t.e=x;t.m24=T;t.f=T}return t}a.setMatrixValue=function setMatrixValue(r){var a=this;if(!r||!r.length)return a;if(r.length&&"string"==typeof r[0]&&r[0].length){var i,o,l=String(r[0]).trim();if("none"===l)return a;i=l.slice(0,l.indexOf("("));o=l.slice("matrix"===i?7:9,-1).split(",").map((function(t){return Math.abs(t)<1e-6?0:+t}));if(!([6,16].indexOf(o.length)>-1))throw new TypeError("CSSMatrix: expecting valid CSS matrix() / matrix3d() syntax");feedFromArray(a,o)}else r[0]instanceof t?feedFromArray(a,r[0].toArray()):Array.isArray(r[0])?feedFromArray(a,r[0]):Array.isArray(r)&&feedFromArray(a,r);return a};a.toString=function toString(){return(this.is2D?"matrix":"matrix3d")+"("+this.toArray(1).join(",")+")"};a.toArray=function toArray(t){var r=this;return r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:t?[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44]:[r.m11,r.m21,r.m31,r.m41,r.m12,r.m22,r.m32,r.m42,r.m13,r.m23,r.m33,r.m43,r.m14,r.m24,r.m34,r.m44]};a.multiply=function multiply(t){return Multiply(this,t)};a.translate=function translate(t,r,a){var i=r,o=a;null==o&&(o=0);null==i&&(i=0);return Multiply(this,Translate(t,i,o))};a.scale=function scale(t,r,a){var i=r,o=a;null==i&&(i=t);null==o&&(o=t);return Multiply(this,Scale(t,i,o))};a.rotate=function rotate(t,r,a){var i=t,o=r,l=a;null==o&&(o=0);if(null==l){l=i;i=0}return Multiply(this,Rotate(i,o,l))};a.rotateAxisAngle=function rotateAxisAngle(t,r,a,i){if(4!==arguments.length)throw new TypeError("CSSMatrix: expecting 4 values");return Multiply(this,RotateAxisAngle(t,r,a,i))};a.skewX=function skewX(t){return Multiply(this,SkewX(t))};a.skewY=function skewY(t){return Multiply(this,SkewY(t))};a.setIdentity=function setIdentity(){return feedFromArray(this,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};a.transformPoint=function transformPoint(t){var r=Translate(t.x,t.y,t.z);r.m44=t.w||1;return{x:(r=this.multiply(r)).m41,y:r.m42,z:r.m43,w:r.m44}};a.transform=function transform(t){var r=this,a=r.m11*t.x+r.m12*t.y+r.m13*t.z+r.m14*t.w,i=r.m21*t.x+r.m22*t.y+r.m23*t.z+r.m24*t.w,o=r.m31*t.x+r.m32*t.y+r.m33*t.z+r.m34*t.w,l=r.m41*t.x+r.m42*t.y+r.m43*t.z+r.m44*t.w;return{x:a/l,y:i/l,z:o/l,w:l}};t.Translate=Translate;t.Rotate=Rotate;t.RotateAxisAngle=RotateAxisAngle;t.Scale=Scale;t.SkewX=SkewX;t.SkewY=SkewY;t.Multiply=Multiply;t.fromMatrix=function fromMatrix(r){return new t([r.m11,r.m21,r.m31,r.m41,r.m12,r.m22,r.m32,r.m42,r.m13,r.m23,r.m33,r.m43,r.m14,r.m24,r.m34,r.m44])};t.fromArray=function fromArray(r){return feedFromArray(new t,r)};t.feedFromArray=feedFromArray;return t},"object"===_typeof(r)?t.exports=l():void 0!==(o="function"==typeof(i=l)?i.call(r,a,r,t):i)&&(t.exports=o)},(t,r,a)=>{a(95);a(110);var i=a(121);t.exports=i.Object.fromEntries},(t,r,a)=>{"use strict";var i=a(49),o=a(96),l=a(101),u=a(78),c=a(102),d="Array Iterator",h=u.set,p=u.getterFor(d);t.exports=c(Array,"Array",(function(t,r){h(this,{type:d,target:i(t),index:0,kind:r})}),(function(){var t=p(this),r=t.target,a=t.kind,i=t.index++;if(!r||i>=r.length){t.target=void 0;return{value:void 0,done:!0}}return"keys"==a?{value:i,done:!1}:"values"==a?{value:r[i],done:!1}:{value:[i,r[i]],done:!1}}),"values");l.Arguments=l.Array;o("keys");o("values");o("entries")},(t,r,a)=>{var i=a(63),o=a(97),l=a(74),u=i("unscopables"),c=Array.prototype;null==c[u]&&l.f(c,u,{configurable:!0,value:o(null)});t.exports=function(t){c[u][t]=!0}},(t,r,a)=>{var i,o=a(75),l=a(98),u=a(90),c=a(81),d=a(100),h=a(72),p=a(80),m=p("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"</"+"script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag(""));t.close();var r=t.parentWindow.Object;t=null;return r},NullProtoObject=function(){try{i=new ActiveXObject("htmlfile")}catch(t){}NullProtoObject="undefined"!=typeof document?document.domain&&i?NullProtoObjectViaActiveX(i):function(){var t,r=h("iframe");r.style.display="none";d.appendChild(r);r.src=String("javascript:");(t=r.contentWindow.document).open();t.write(scriptTag("document.F=Object"));t.close();return t.F}():NullProtoObjectViaActiveX(i);for(var t=u.length;t--;)delete NullProtoObject.prototype[u[t]];return NullProtoObject()};c[m]=!0;t.exports=Object.create||function create(t,r){var a;if(null!==t){EmptyConstructor.prototype=o(t);a=new EmptyConstructor;EmptyConstructor.prototype=null;a[m]=t}else a=NullProtoObject();return void 0===r?a:l(a,r)}},(t,r,a)=>{var i=a(45),o=a(74),l=a(75),u=a(99);t.exports=i?Object.defineProperties:function defineProperties(t,r){l(t);for(var a,i=u(r),c=i.length,d=0;c>d;)o.f(t,a=i[d++],r[a]);return t}},(t,r,a)=>{var i=a(85),o=a(90);t.exports=Object.keys||function keys(t){return i(t,o)}},(t,r,a)=>{var i=a(57);t.exports=i("document","documentElement")},t=>{t.exports={}},(t,r,a)=>{"use strict";var i=a(42),o=a(103),l=a(105),u=a(108),c=a(107),d=a(73),h=a(76),p=a(63),m=a(65),g=a(101),v=a(104),y=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,S=p("iterator"),w="keys",C="values",P="entries",returnThis=function(){return this};t.exports=function(t,r,a,p,v,k,R){o(a,r,p);var A,x,T,getIterationMethod=function(t){if(t===v&&L)return L;if(!b&&t in O)return O[t];switch(t){case w:return function keys(){return new a(this,t)};case C:return function values(){return new a(this,t)};case P:return function entries(){return new a(this,t)}}return function(){return new a(this)}},E=r+" Iterator",I=!1,O=t.prototype,D=O[S]||O["@@iterator"]||v&&O[v],L=!b&&D||getIterationMethod(v),M="Array"==r&&O.entries||D;if(M&&(A=l(M.call(new t)))!==Object.prototype&&A.next){m||l(A)===y||(u?u(A,y):"function"!=typeof A[S]&&d(A,S,returnThis));c(A,E,!0,!0);m&&(g[E]=returnThis)}if(v==C&&D&&D.name!==C){I=!0;L=function values(){return D.call(this)}}m&&!R||O[S]===L||d(O,S,L);g[r]=L;if(v){x={values:getIterationMethod(C),keys:k?L:getIterationMethod(w),entries:getIterationMethod(P)};if(R)for(T in x)(b||I||!(T in O))&&h(O,T,x[T]);else i({target:r,proto:!0,forced:b||I},x)}return x}},(t,r,a)=>{"use strict";var i=a(104).IteratorPrototype,o=a(97),l=a(48),u=a(107),c=a(101),returnThis=function(){return this};t.exports=function(t,r,a){var d=r+" Iterator";t.prototype=o(i,{next:l(1,a)});u(t,d,!1,!0);c[d]=returnThis;return t}},(t,r,a)=>{"use strict";var i,o,l,u=a(46),c=a(97),d=a(105),h=a(73),p=a(63),m=a(65),g=p("iterator"),v=!1;[].keys&&("next"in(l=[].keys())?(o=d(d(l)))!==Object.prototype&&(i=o):v=!0);null==i||u((function(){var t={};return i[g].call(t)!==t}))?i={}:m&&(i=c(i));"function"!=typeof i[g]&&h(i,g,(function(){return this}));t.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:v}},(t,r,a)=>{var i=a(68),o=a(69),l=a(80),u=a(106),c=l("IE_PROTO"),d=Object.prototype;t.exports=u?Object.getPrototypeOf:function(t){t=o(t);return i(t,c)?t[c]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?d:null}},(t,r,a)=>{var i=a(46);t.exports=!i((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(t,r,a)=>{var i=a(74).f,o=a(68),l=a(63)("toStringTag");t.exports=function(t,r,a){t&&!o(t=a?t:t.prototype,l)&&i(t,l,{configurable:!0,value:r})}},(t,r,a)=>{var i=a(75),o=a(109);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,r=!1,a={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(a,[]);r=a instanceof Array}catch(t){}return function setPrototypeOf(a,l){i(a);o(l);r?t.call(a,l):a.__proto__=l;return a}}():void 0)},(t,r,a)=>{var i=a(55);t.exports=function(t){if(!i(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},(t,r,a)=>{var i=a(42),o=a(111),l=a(120);i({target:"Object",stat:!0},{fromEntries:function fromEntries(t){var r={};o(t,(function(t,a){l(r,t,a)}),{AS_ENTRIES:!0});return r}})},(t,r,a)=>{var i=a(75),o=a(112),l=a(87),u=a(113),c=a(115),d=a(116),h=a(119),Result=function(t,r){this.stopped=t;this.result=r};t.exports=function(t,r,a){var p,m,g,v,y,b,S,w=a&&a.that,C=!(!a||!a.AS_ENTRIES),P=!(!a||!a.IS_ITERATOR),k=!(!a||!a.INTERRUPTED),R=u(r,w,1+C+k),stop=function(t){p&&h(p,"normal",t);return new Result(!0,t)},callFn=function(t){if(C){i(t);return k?R(t[0],t[1],stop):R(t[0],t[1])}return k?R(t,stop):R(t)};if(P)p=t;else{if("function"!=typeof(m=d(t)))throw TypeError("Target is not iterable");if(o(m)){for(g=0,v=l(t.length);v>g;g++)if((y=callFn(t[g]))&&y instanceof Result)return y;return new Result(!1)}p=c(t,m)}b=p.next;for(;!(S=b.call(p)).done;){try{y=callFn(S.value)}catch(t){h(p,"throw",t)}if("object"==typeof y&&y&&y instanceof Result)return y}return new Result(!1)}},(t,r,a)=>{var i=a(63),o=a(101),l=i("iterator"),u=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||u[l]===t)}},(t,r,a)=>{var i=a(114);t.exports=function(t,r,a){i(t);if(void 0===r)return t;switch(a){case 0:return function(){return t.call(r)};case 1:return function(a){return t.call(r,a)};case 2:return function(a,i){return t.call(r,a,i)};case 3:return function(a,i,o){return t.call(r,a,i,o)}}return function(){return t.apply(r,arguments)}}},t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},(t,r,a)=>{var i=a(75),o=a(116);t.exports=function(t,r){var a=arguments.length<2?o(t):r;if("function"!=typeof a)throw TypeError(String(t)+" is not iterable");return i(a.call(t))}},(t,r,a)=>{var i=a(117),o=a(101),l=a(63)("iterator");t.exports=function(t){if(null!=t)return t[l]||t["@@iterator"]||o[i(t)]}},(t,r,a)=>{var i=a(118),o=a(51),l=a(63)("toStringTag"),u="Arguments"==o(function(){return arguments}());t.exports=i?o:function(t){var r,a,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(a=function(t,r){try{return t[r]}catch(t){}}(r=Object(t),l))?a:u?o(r):"Object"==(i=o(r))&&"function"==typeof r.callee?"Arguments":i}},(t,r,a)=>{var i={};i[a(63)("toStringTag")]="z";t.exports="[object z]"===String(i)},(t,r,a)=>{var i=a(75);t.exports=function(t,r,a){var o,l;i(t);try{if(void 0===(o=t.return)){if("throw"===r)throw a;return a}o=o.call(t)}catch(t){l=!0;o=t}if("throw"===r)throw a;if(l)throw o;i(o);return a}},(t,r,a)=>{"use strict";var i=a(53),o=a(74),l=a(48);t.exports=function(t,r,a){var u=i(r);u in t?o.f(t,u,l(0,a)):t[u]=a}},(t,r,a)=>{var i=a(43);t.exports=i},(t,r,a)=>{a(123);a(95);a(125);a(127);a(145);a(146);a(147);a(148);var i=a(121);t.exports=i.Promise},(t,r,a)=>{"use strict";var i=a(42),o=a(105),l=a(108),u=a(97),c=a(73),d=a(48),h=a(111),p=a(124),m=function AggregateError(t,r){var a=this;if(!(a instanceof m))return new m(t,r);l&&(a=l(new Error(void 0),o(a)));void 0!==r&&c(a,"message",p(r));var i=[];h(t,i.push,{that:i});c(a,"errors",i);return a};m.prototype=u(Error.prototype,{constructor:d(5,m),message:d(5,""),name:d(5,"AggregateError")});i({global:!0},{AggregateError:m})},(t,r,a)=>{var i=a(56);t.exports=function(t){if(i(t))throw TypeError("Cannot convert a Symbol value to a string");return String(t)}},(t,r,a)=>{var i=a(118),o=a(76),l=a(126);i||o(Object.prototype,"toString",l,{unsafe:!0})},(t,r,a)=>{"use strict";var i=a(118),o=a(117);t.exports=i?{}.toString:function toString(){return"[object "+o(this)+"]"}},(t,r,a)=>{"use strict";var i,o,l,u,c=a(42),d=a(65),h=a(43),p=a(57),m=a(128),g=a(76),v=a(129),y=a(108),b=a(107),S=a(130),w=a(55),C=a(114),P=a(131),k=a(77),R=a(111),A=a(132),x=a(133),T=a(134).set,E=a(137),I=a(140),O=a(142),D=a(141),L=a(143),M=a(78),B=a(92),W=a(63),N=a(144),j=a(136),V=a(60),U=W("species"),q="Promise",z=M.get,H=M.set,G=M.getterFor(q),Y=m&&m.prototype,Q=m,X=Y,K=h.TypeError,$=h.document,J=h.process,Z=D.f,ee=Z,te=!!($&&$.createEvent&&h.dispatchEvent),re="function"==typeof PromiseRejectionEvent,ne="unhandledrejection",ae=!1,ie=B(q,(function(){var t=k(Q),r=t!==String(Q);if(!r&&66===V)return!0;if(d&&!X.finally)return!0;if(V>=51&&/native code/.test(t))return!1;var a=new Q((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};(a.constructor={})[U]=FakePromise;return!(ae=a.then((function(){}))instanceof FakePromise)||!r&&N&&!re})),oe=ie||!A((function(t){Q.all(t).catch((function(){}))})),isThenable=function(t){var r;return!(!w(t)||"function"!=typeof(r=t.then))&&r},notify=function(t,r){if(!t.notified){t.notified=!0;var a=t.reactions;E((function(){for(var i=t.value,o=1==t.state,l=0;a.length>l;){var u,c,d,h=a[l++],p=o?h.ok:h.fail,m=h.resolve,g=h.reject,v=h.domain;try{if(p){if(!o){2===t.rejection&&onHandleUnhandled(t);t.rejection=1}if(!0===p)u=i;else{v&&v.enter();u=p(i);if(v){v.exit();d=!0}}u===h.promise?g(K("Promise-chain cycle")):(c=isThenable(u))?c.call(u,m,g):m(u)}else g(i)}catch(t){v&&!d&&v.exit();g(t)}}t.reactions=[];t.notified=!1;r&&!t.rejection&&onUnhandled(t)}))}},dispatchEvent=function(t,r,a){var i,o;if(te){(i=$.createEvent("Event")).promise=r;i.reason=a;i.initEvent(t,!1,!0);h.dispatchEvent(i)}else i={promise:r,reason:a};!re&&(o=h["on"+t])?o(i):t===ne&&O("Unhandled promise rejection",a)},onUnhandled=function(t){T.call(h,(function(){var r,a=t.facade,i=t.value;if(isUnhandled(t)){r=L((function(){j?J.emit("unhandledRejection",i,a):dispatchEvent(ne,a,i)}));t.rejection=j||isUnhandled(t)?2:1;if(r.error)throw r.value}}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){T.call(h,(function(){var r=t.facade;j?J.emit("rejectionHandled",r):dispatchEvent("rejectionhandled",r,t.value)}))},bind=function(t,r,a){return function(i){t(r,i,a)}},internalReject=function(t,r,a){if(!t.done){t.done=!0;a&&(t=a);t.value=r;t.state=2;notify(t,!0)}},internalResolve=function(t,r,a){if(!t.done){t.done=!0;a&&(t=a);try{if(t.facade===r)throw K("Promise can't be resolved itself");var i=isThenable(r);if(i)E((function(){var a={done:!1};try{i.call(r,bind(internalResolve,a,t),bind(internalReject,a,t))}catch(r){internalReject(a,r,t)}}));else{t.value=r;t.state=1;notify(t,!1)}}catch(r){internalReject({done:!1},r,t)}}};if(ie){X=(Q=function Promise(t){P(this,Q,q);C(t);i.call(this);var r=z(this);try{t(bind(internalResolve,r),bind(internalReject,r))}catch(t){internalReject(r,t)}}).prototype;(i=function Promise(t){H(this,{type:q,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=v(X,{then:function then(t,r){var a=G(this),i=Z(x(this,Q));i.ok="function"!=typeof t||t;i.fail="function"==typeof r&&r;i.domain=j?J.domain:void 0;a.parent=!0;a.reactions.push(i);0!=a.state&¬ify(a,!1);return i.promise},catch:function(t){return this.then(void 0,t)}});o=function(){var t=new i,r=z(t);this.promise=t;this.resolve=bind(internalResolve,r);this.reject=bind(internalReject,r)};D.f=Z=function(t){return t===Q||t===l?new o(t):ee(t)};if(!d&&"function"==typeof m&&Y!==Object.prototype){u=Y.then;if(!ae){g(Y,"then",(function then(t,r){var a=this;return new Q((function(t,r){u.call(a,t,r)})).then(t,r)}),{unsafe:!0});g(Y,"catch",X.catch,{unsafe:!0})}try{delete Y.constructor}catch(t){}y&&y(Y,X)}}c({global:!0,wrap:!0,forced:ie},{Promise:Q});b(Q,q,!1,!0);S(q);l=p(q);c({target:q,stat:!0,forced:ie},{reject:function reject(t){var r=Z(this);r.reject.call(void 0,t);return r.promise}});c({target:q,stat:!0,forced:d||ie},{resolve:function resolve(t){return I(d&&this===l?Q:this,t)}});c({target:q,stat:!0,forced:oe},{all:function all(t){var r=this,a=Z(r),i=a.resolve,o=a.reject,l=L((function(){var a=C(r.resolve),l=[],u=0,c=1;R(t,(function(t){var d=u++,h=!1;l.push(void 0);c++;a.call(r,t).then((function(t){if(!h){h=!0;l[d]=t;--c||i(l)}}),o)}));--c||i(l)}));l.error&&o(l.value);return a.promise},race:function race(t){var r=this,a=Z(r),i=a.reject,o=L((function(){var o=C(r.resolve);R(t,(function(t){o.call(r,t).then(a.resolve,i)}))}));o.error&&i(o.value);return a.promise}})},(t,r,a)=>{var i=a(43);t.exports=i.Promise},(t,r,a)=>{var i=a(76);t.exports=function(t,r,a){for(var o in r)i(t,o,r[o],a);return t}},(t,r,a)=>{"use strict";var i=a(57),o=a(74),l=a(63),u=a(45),c=l("species");t.exports=function(t){var r=i(t),a=o.f;u&&r&&!r[c]&&a(r,c,{configurable:!0,get:function(){return this}})}},t=>{t.exports=function(t,r,a){if(!(t instanceof r))throw TypeError("Incorrect "+(a?a+" ":"")+"invocation");return t}},(t,r,a)=>{var i=a(63)("iterator"),o=!1;try{var l=0,u={next:function(){return{done:!!l++}},return:function(){o=!0}};u[i]=function(){return this};Array.from(u,(function(){throw 2}))}catch(t){}t.exports=function(t,r){if(!r&&!o)return!1;var a=!1;try{var l={};l[i]=function(){return{next:function(){return{done:a=!0}}}};t(l)}catch(t){}return a}},(t,r,a)=>{var i=a(75),o=a(114),l=a(63)("species");t.exports=function(t,r){var a,u=i(t).constructor;return void 0===u||null==(a=i(u)[l])?r:o(a)}},(t,r,a)=>{var i,o,l,u,c=a(43),d=a(46),h=a(113),p=a(100),m=a(72),g=a(135),v=a(136),y=c.setImmediate,b=c.clearImmediate,S=c.process,w=c.MessageChannel,C=c.Dispatch,P=0,k={},R="onreadystatechange";try{i=c.location}catch(t){}var run=function(t){if(k.hasOwnProperty(t)){var r=k[t];delete k[t];r()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){c.postMessage(String(t),i.protocol+"//"+i.host)};if(!y||!b){y=function setImmediate(t){for(var r=[],a=arguments.length,i=1;a>i;)r.push(arguments[i++]);k[++P]=function(){("function"==typeof t?t:Function(t)).apply(void 0,r)};o(P);return P};b=function clearImmediate(t){delete k[t]};if(v)o=function(t){S.nextTick(runner(t))};else if(C&&C.now)o=function(t){C.now(runner(t))};else if(w&&!g){u=(l=new w).port2;l.port1.onmessage=listener;o=h(u.postMessage,u,1)}else if(c.addEventListener&&"function"==typeof postMessage&&!c.importScripts&&i&&"file:"!==i.protocol&&!d(post)){o=post;c.addEventListener("message",listener,!1)}else o=R in m("script")?function(t){p.appendChild(m("script")).onreadystatechange=function(){p.removeChild(this);run(t)}}:function(t){setTimeout(runner(t),0)}}t.exports={set:y,clear:b}},(t,r,a)=>{var i=a(61);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(i)},(t,r,a)=>{var i=a(51),o=a(43);t.exports="process"==i(o.process)},(t,r,a)=>{var i,o,l,u,c,d,h,p,m=a(43),g=a(44).f,v=a(134).set,y=a(135),b=a(138),S=a(139),w=a(136),C=m.MutationObserver||m.WebKitMutationObserver,P=m.document,k=m.process,R=m.Promise,A=g(m,"queueMicrotask"),x=A&&A.value;if(!x){i=function(){var t,r;w&&(t=k.domain)&&t.exit();for(;o;){r=o.fn;o=o.next;try{r()}catch(t){o?u():l=void 0;throw t}}l=void 0;t&&t.enter()};if(y||w||S||!C||!P)if(!b&&R&&R.resolve){(h=R.resolve(void 0)).constructor=R;p=h.then;u=function(){p.call(h,i)}}else u=w?function(){k.nextTick(i)}:function(){v.call(m,i)};else{c=!0;d=P.createTextNode("");new C(i).observe(d,{characterData:!0});u=function(){d.data=c=!c}}}t.exports=x||function(t){var r={fn:t,next:void 0};l&&(l.next=r);if(!o){o=r;u()}l=r}},(t,r,a)=>{var i=a(61),o=a(43);t.exports=/ipad|iphone|ipod/i.test(i)&&void 0!==o.Pebble},(t,r,a)=>{var i=a(61);t.exports=/web0s(?!.*chrome)/i.test(i)},(t,r,a)=>{var i=a(75),o=a(55),l=a(141);t.exports=function(t,r){i(t);if(o(r)&&r.constructor===t)return r;var a=l.f(t);(0,a.resolve)(r);return a.promise}},(t,r,a)=>{"use strict";var i=a(114),PromiseCapability=function(t){var r,a;this.promise=new t((function(t,i){if(void 0!==r||void 0!==a)throw TypeError("Bad Promise constructor");r=t;a=i}));this.resolve=i(r);this.reject=i(a)};t.exports.f=function(t){return new PromiseCapability(t)}},(t,r,a)=>{var i=a(43);t.exports=function(t,r){var a=i.console;a&&a.error&&(1===arguments.length?a.error(t):a.error(t,r))}},t=>{t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},t=>{t.exports="object"==typeof window},(t,r,a)=>{"use strict";var i=a(42),o=a(114),l=a(141),u=a(143),c=a(111);i({target:"Promise",stat:!0},{allSettled:function allSettled(t){var r=this,a=l.f(r),i=a.resolve,d=a.reject,h=u((function(){var a=o(r.resolve),l=[],u=0,d=1;c(t,(function(t){var o=u++,c=!1;l.push(void 0);d++;a.call(r,t).then((function(t){if(!c){c=!0;l[o]={status:"fulfilled",value:t};--d||i(l)}}),(function(t){if(!c){c=!0;l[o]={status:"rejected",reason:t};--d||i(l)}}))}));--d||i(l)}));h.error&&d(h.value);return a.promise}})},(t,r,a)=>{"use strict";var i=a(42),o=a(114),l=a(57),u=a(141),c=a(143),d=a(111),h="No one promise resolved";i({target:"Promise",stat:!0},{any:function any(t){var r=this,a=u.f(r),i=a.resolve,p=a.reject,m=c((function(){var a=o(r.resolve),u=[],c=0,m=1,g=!1;d(t,(function(t){var o=c++,d=!1;u.push(void 0);m++;a.call(r,t).then((function(t){if(!d&&!g){g=!0;i(t)}}),(function(t){if(!d&&!g){d=!0;u[o]=t;--m||p(new(l("AggregateError"))(u,h))}}))}));--m||p(new(l("AggregateError"))(u,h))}));m.error&&p(m.value);return a.promise}})},(t,r,a)=>{"use strict";var i=a(42),o=a(65),l=a(128),u=a(46),c=a(57),d=a(133),h=a(140),p=a(76);i({target:"Promise",proto:!0,real:!0,forced:!!l&&u((function(){l.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var r=d(this,c("Promise")),a="function"==typeof t;return this.then(a?function(a){return h(r,t()).then((function(){return a}))}:t,a?function(a){return h(r,t()).then((function(){throw a}))}:t)}});if(!o&&"function"==typeof l){var m=c("Promise").prototype.finally;l.prototype.finally!==m&&p(l.prototype,"finally",m,{unsafe:!0})}},(t,r,a)=>{"use strict";var i=a(149).charAt,o=a(124),l=a(78),u=a(102),c="String Iterator",d=l.set,h=l.getterFor(c);u(String,"String",(function(t){d(this,{type:c,string:o(t),index:0})}),(function next(){var t,r=h(this),a=r.string,o=r.index;if(o>=a.length)return{value:void 0,done:!0};t=i(a,o);r.index+=t.length;return{value:t,done:!1}}))},(t,r,a)=>{var i=a(88),o=a(124),l=a(52),createMethod=function(t){return function(r,a){var u,c,d=o(l(r)),h=i(a),p=d.length;return h<0||h>=p?t?"":void 0:(u=d.charCodeAt(h))<55296||u>56319||h+1===p||(c=d.charCodeAt(h+1))<56320||c>57343?t?d.charAt(h):u:t?d.slice(h,h+2):c-56320+(u-55296<<10)+65536}};t.exports={codeAt:createMethod(!1),charAt:createMethod(!0)}},function(t,r){a=function(t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(t){return"Symbol("+t+")"};function noop(){}var a=function getGlobals(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0}();function typeIsObject(t){return"object"==typeof t&&null!==t||"function"==typeof t}var i=noop,o=Promise,l=Promise.prototype.then,u=Promise.resolve.bind(o),c=Promise.reject.bind(o);function newPromise(t){return new o(t)}function promiseResolvedWith(t){return u(t)}function promiseRejectedWith(t){return c(t)}function PerformPromiseThen(t,r,a){return l.call(t,r,a)}function uponPromise(t,r,a){PerformPromiseThen(PerformPromiseThen(t,r,a),void 0,i)}function uponFulfillment(t,r){uponPromise(t,r)}function uponRejection(t,r){uponPromise(t,void 0,r)}function transformPromiseWith(t,r,a){return PerformPromiseThen(t,r,a)}function setPromiseIsHandledToTrue(t){PerformPromiseThen(t,void 0,i)}var d=function(){var t=a&&a.queueMicrotask;if("function"==typeof t)return t;var r=promiseResolvedWith(void 0);return function(t){return PerformPromiseThen(r,t)}}();function reflectCall(t,r,a){if("function"!=typeof t)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(t,r,a)}function promiseCall(t,r,a){try{return promiseResolvedWith(reflectCall(t,r,a))}catch(t){return promiseRejectedWith(t)}}var h=function(){function SimpleQueue(){this._cursor=0;this._size=0;this._front={_elements:[],_next:void 0};this._back=this._front;this._cursor=0;this._size=0}Object.defineProperty(SimpleQueue.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0});SimpleQueue.prototype.push=function(t){var r=this._back,a=r;16383===r._elements.length&&(a={_elements:[],_next:void 0});r._elements.push(t);if(a!==r){this._back=a;r._next=a}++this._size};SimpleQueue.prototype.shift=function(){var t=this._front,r=t,a=this._cursor,i=a+1,o=t._elements,l=o[a];if(16384===i){r=t._next;i=0}--this._size;this._cursor=i;t!==r&&(this._front=r);o[a]=void 0;return l};SimpleQueue.prototype.forEach=function(t){for(var r=this._cursor,a=this._front,i=a._elements;r!==i.length||void 0!==a._next;){if(r===i.length){r=0;if(0===(i=(a=a._next)._elements).length)break}t(i[r]);++r}};SimpleQueue.prototype.peek=function(){var t=this._front,r=this._cursor;return t._elements[r]};return SimpleQueue}();function ReadableStreamReaderGenericInitialize(t,r){t._ownerReadableStream=r;r._reader=t;"readable"===r._state?defaultReaderClosedPromiseInitialize(t):"closed"===r._state?function defaultReaderClosedPromiseInitializeAsResolved(t){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseResolve(t)}(t):defaultReaderClosedPromiseInitializeAsRejected(t,r._storedError)}function ReadableStreamReaderGenericCancel(t,r){return ReadableStreamCancel(t._ownerReadableStream,r)}function ReadableStreamReaderGenericRelease(t){"readable"===t._ownerReadableStream._state?defaultReaderClosedPromiseReject(t,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function defaultReaderClosedPromiseResetToRejected(t,r){defaultReaderClosedPromiseInitializeAsRejected(t,r)}(t,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));t._ownerReadableStream._reader=void 0;t._ownerReadableStream=void 0}function readerLockException(t){return new TypeError("Cannot "+t+" a stream using a released reader")}function defaultReaderClosedPromiseInitialize(t){t._closedPromise=newPromise((function(r,a){t._closedPromise_resolve=r;t._closedPromise_reject=a}))}function defaultReaderClosedPromiseInitializeAsRejected(t,r){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseReject(t,r)}function defaultReaderClosedPromiseReject(t,r){if(void 0!==t._closedPromise_reject){setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0}}function defaultReaderClosedPromiseResolve(t){if(void 0!==t._closedPromise_resolve){t._closedPromise_resolve(void 0);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0}}var p=r("[[AbortSteps]]"),m=r("[[ErrorSteps]]"),g=r("[[CancelSteps]]"),v=r("[[PullSteps]]"),y=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},b=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function assertDictionary(t,r){if(void 0!==t&&!function isDictionary(t){return"object"==typeof t||"function"==typeof t}(t))throw new TypeError(r+" is not an object.")}function assertFunction(t,r){if("function"!=typeof t)throw new TypeError(r+" is not a function.")}function assertObject(t,r){if(!function isObject(t){return"object"==typeof t&&null!==t||"function"==typeof t}(t))throw new TypeError(r+" is not an object.")}function assertRequiredArgument(t,r,a){if(void 0===t)throw new TypeError("Parameter "+r+" is required in '"+a+"'.")}function assertRequiredField(t,r,a){if(void 0===t)throw new TypeError(r+" is required in '"+a+"'.")}function convertUnrestrictedDouble(t){return Number(t)}function censorNegativeZero(t){return 0===t?0:t}function convertUnsignedLongLongWithEnforceRange(t,r){var a=Number.MAX_SAFE_INTEGER,i=Number(t);i=censorNegativeZero(i);if(!y(i))throw new TypeError(r+" is not a finite number");if((i=function integerPart(t){return censorNegativeZero(b(t))}(i))<0||i>a)throw new TypeError(r+" is outside the accepted range of 0 to "+a+", inclusive");return y(i)&&0!==i?i:0}function assertReadableStream(t,r){if(!IsReadableStream(t))throw new TypeError(r+" is not a ReadableStream.")}function AcquireReadableStreamDefaultReader(t){return new C(t)}function ReadableStreamAddReadRequest(t,r){t._reader._readRequests.push(r)}function ReadableStreamFulfillReadRequest(t,r,a){var i=t._reader._readRequests.shift();a?i._closeSteps():i._chunkSteps(r)}function ReadableStreamGetNumReadRequests(t){return t._reader._readRequests.length}function ReadableStreamHasDefaultReader(t){var r=t._reader;return void 0!==r&&!!IsReadableStreamDefaultReader(r)}var S,w,C=function(){function ReadableStreamDefaultReader(t){assertRequiredArgument(t,1,"ReadableStreamDefaultReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ReadableStreamReaderGenericInitialize(this,t);this._readRequests=new h}Object.defineProperty(ReadableStreamDefaultReader.prototype,"closed",{get:function(){return IsReadableStreamDefaultReader(this)?this._closedPromise:promiseRejectedWith(defaultReaderBrandCheckException("closed"))},enumerable:!1,configurable:!0});ReadableStreamDefaultReader.prototype.cancel=function(t){void 0===t&&(t=void 0);return IsReadableStreamDefaultReader(this)?void 0===this._ownerReadableStream?promiseRejectedWith(readerLockException("cancel")):ReadableStreamReaderGenericCancel(this,t):promiseRejectedWith(defaultReaderBrandCheckException("cancel"))};ReadableStreamDefaultReader.prototype.read=function(){if(!IsReadableStreamDefaultReader(this))return promiseRejectedWith(defaultReaderBrandCheckException("read"));if(void 0===this._ownerReadableStream)return promiseRejectedWith(readerLockException("read from"));var t,r,a=newPromise((function(a,i){t=a;r=i}));ReadableStreamDefaultReaderRead(this,{_chunkSteps:function(r){return t({value:r,done:!1})},_closeSteps:function(){return t({value:void 0,done:!0})},_errorSteps:function(t){return r(t)}});return a};ReadableStreamDefaultReader.prototype.releaseLock=function(){if(!IsReadableStreamDefaultReader(this))throw defaultReaderBrandCheckException("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ReadableStreamReaderGenericRelease(this)}};return ReadableStreamDefaultReader}();Object.defineProperties(C.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(C.prototype,r.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function IsReadableStreamDefaultReader(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readRequests")&&t instanceof C}function ReadableStreamDefaultReaderRead(t,r){var a=t._ownerReadableStream;a._disturbed=!0;"closed"===a._state?r._closeSteps():"errored"===a._state?r._errorSteps(a._storedError):a._readableStreamController[v](r)}function defaultReaderBrandCheckException(t){return new TypeError("ReadableStreamDefaultReader.prototype."+t+" can only be used on a ReadableStreamDefaultReader")}if("symbol"==typeof r.asyncIterator){w=((S={})[r.asyncIterator]=function(){return this},S);Object.defineProperty(w,r.asyncIterator,{enumerable:!1})}var P=function(){function ReadableStreamAsyncIteratorImpl(t,r){this._ongoingPromise=void 0;this._isFinished=!1;this._reader=t;this._preventCancel=r}ReadableStreamAsyncIteratorImpl.prototype.next=function(){var t=this,nextSteps=function(){return t._nextSteps()};this._ongoingPromise=this._ongoingPromise?transformPromiseWith(this._ongoingPromise,nextSteps,nextSteps):nextSteps();return this._ongoingPromise};ReadableStreamAsyncIteratorImpl.prototype.return=function(t){var r=this,returnSteps=function(){return r._returnSteps(t)};return this._ongoingPromise?transformPromiseWith(this._ongoingPromise,returnSteps,returnSteps):returnSteps()};ReadableStreamAsyncIteratorImpl.prototype._nextSteps=function(){var t=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var r,a,i=this._reader;if(void 0===i._ownerReadableStream)return promiseRejectedWith(readerLockException("iterate"));var o=newPromise((function(t,i){r=t;a=i}));ReadableStreamDefaultReaderRead(i,{_chunkSteps:function(a){t._ongoingPromise=void 0;d((function(){return r({value:a,done:!1})}))},_closeSteps:function(){t._ongoingPromise=void 0;t._isFinished=!0;ReadableStreamReaderGenericRelease(i);r({value:void 0,done:!0})},_errorSteps:function(r){t._ongoingPromise=void 0;t._isFinished=!0;ReadableStreamReaderGenericRelease(i);a(r)}});return o};ReadableStreamAsyncIteratorImpl.prototype._returnSteps=function(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;var r=this._reader;if(void 0===r._ownerReadableStream)return promiseRejectedWith(readerLockException("finish iterating"));if(!this._preventCancel){var a=ReadableStreamReaderGenericCancel(r,t);ReadableStreamReaderGenericRelease(r);return transformPromiseWith(a,(function(){return{value:t,done:!0}}))}ReadableStreamReaderGenericRelease(r);return promiseResolvedWith({value:t,done:!0})};return ReadableStreamAsyncIteratorImpl}(),k={next:function(){return IsReadableStreamAsyncIterator(this)?this._asyncIteratorImpl.next():promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"))},return:function(t){return IsReadableStreamAsyncIterator(this)?this._asyncIteratorImpl.return(t):promiseRejectedWith(streamAsyncIteratorBrandCheckException("return"))}};void 0!==w&&Object.setPrototypeOf(k,w);function IsReadableStreamAsyncIterator(t){if(!typeIsObject(t))return!1;if(!Object.prototype.hasOwnProperty.call(t,"_asyncIteratorImpl"))return!1;try{return t._asyncIteratorImpl instanceof P}catch(t){return!1}}function streamAsyncIteratorBrandCheckException(t){return new TypeError("ReadableStreamAsyncIterator."+t+" can only be used on a ReadableSteamAsyncIterator")}var R=Number.isNaN||function(t){return t!=t};function CreateArrayFromList(t){return t.slice()}function CopyDataBlockBytes(t,r,a,i,o){new Uint8Array(t).set(new Uint8Array(a,i,o),r)}function ArrayBufferSlice(t,r,a){if(t.slice)return t.slice(r,a);var i=a-r,o=new ArrayBuffer(i);CopyDataBlockBytes(o,0,t,r,i);return o}function CloneAsUint8Array(t){var r=ArrayBufferSlice(t.buffer,t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(r)}function DequeueValue(t){var r=t._queue.shift();t._queueTotalSize-=r.size;t._queueTotalSize<0&&(t._queueTotalSize=0);return r.value}function EnqueueValueWithSize(t,r,a){if(!function IsNonNegativeNumber(t){return!("number"!=typeof t||R(t)||t<0)}(a)||a===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");t._queue.push({value:r,size:a});t._queueTotalSize+=a}function ResetQueue(t){t._queue=new h;t._queueTotalSize=0}var A=function(){function ReadableStreamBYOBRequest(){throw new TypeError("Illegal constructor")}Object.defineProperty(ReadableStreamBYOBRequest.prototype,"view",{get:function(){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("view");return this._view},enumerable:!1,configurable:!0});ReadableStreamBYOBRequest.prototype.respond=function(t){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("respond");assertRequiredArgument(t,1,"respond");t=convertUnsignedLongLongWithEnforceRange(t,"First parameter");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer;ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController,t)};ReadableStreamBYOBRequest.prototype.respondWithNewView=function(t){if(!IsReadableStreamBYOBRequest(this))throw byobRequestBrandCheckException("respondWithNewView");assertRequiredArgument(t,1,"respondWithNewView");if(!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");t.buffer;ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,t)};return ReadableStreamBYOBRequest}();Object.defineProperties(A.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(A.prototype,r.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var x=function(){function ReadableByteStreamController(){throw new TypeError("Illegal constructor")}Object.defineProperty(ReadableByteStreamController.prototype,"byobRequest",{get:function(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("byobRequest");return ReadableByteStreamControllerGetBYOBRequest(this)},enumerable:!1,configurable:!0});Object.defineProperty(ReadableByteStreamController.prototype,"desiredSize",{get:function(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("desiredSize");return ReadableByteStreamControllerGetDesiredSize(this)},enumerable:!1,configurable:!0});ReadableByteStreamController.prototype.close=function(){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be closed");ReadableByteStreamControllerClose(this)};ReadableByteStreamController.prototype.enqueue=function(t){if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("enqueue");assertRequiredArgument(t,1,"enqueue");if(!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(0===t.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===t.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var r=this._controlledReadableByteStream._state;if("readable"!==r)throw new TypeError("The stream (in "+r+" state) is not in the readable state and cannot be enqueued to");ReadableByteStreamControllerEnqueue(this,t)};ReadableByteStreamController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsReadableByteStreamController(this))throw byteStreamControllerBrandCheckException("error");ReadableByteStreamControllerError(this,t)};ReadableByteStreamController.prototype[g]=function(t){ReadableByteStreamControllerClearPendingPullIntos(this);ResetQueue(this);var r=this._cancelAlgorithm(t);ReadableByteStreamControllerClearAlgorithms(this);return r};ReadableByteStreamController.prototype[v]=function(t){var r=this._controlledReadableByteStream;if(this._queueTotalSize>0){var a=this._queue.shift();this._queueTotalSize-=a.byteLength;ReadableByteStreamControllerHandleQueueDrain(this);var i=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);t._chunkSteps(i)}else{var o=this._autoAllocateChunkSize;if(void 0!==o){var l=void 0;try{l=new ArrayBuffer(o)}catch(r){t._errorSteps(r);return}var u={buffer:l,bufferByteLength:o,byteOffset:0,byteLength:o,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(u)}ReadableStreamAddReadRequest(r,t);ReadableByteStreamControllerCallPullIfNeeded(this)}};return ReadableByteStreamController}();Object.defineProperties(x.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(x.prototype,r.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function IsReadableByteStreamController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledReadableByteStream")&&t instanceof x}function IsReadableStreamBYOBRequest(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_associatedReadableByteStreamController")&&t instanceof A}function ReadableByteStreamControllerCallPullIfNeeded(t){var r=function ReadableByteStreamControllerShouldCallPull(t){var r=t._controlledReadableByteStream;return"readable"===r._state&&(!t._closeRequested&&(!!t._started&&(!!(ReadableStreamHasDefaultReader(r)&&ReadableStreamGetNumReadRequests(r)>0)||(!!(ReadableStreamHasBYOBReader(r)&&ReadableStreamGetNumReadIntoRequests(r)>0)||ReadableByteStreamControllerGetDesiredSize(t)>0))))}(t);if(r)if(t._pulling)t._pullAgain=!0;else{t._pulling=!0;uponPromise(t._pullAlgorithm(),(function(){t._pulling=!1;if(t._pullAgain){t._pullAgain=!1;ReadableByteStreamControllerCallPullIfNeeded(t)}}),(function(r){ReadableByteStreamControllerError(t,r)}))}}function ReadableByteStreamControllerClearPendingPullIntos(t){ReadableByteStreamControllerInvalidateBYOBRequest(t);t._pendingPullIntos=new h}function ReadableByteStreamControllerCommitPullIntoDescriptor(t,r){var a=!1;"closed"===t._state&&(a=!0);var i=ReadableByteStreamControllerConvertPullIntoDescriptor(r);"default"===r.readerType?ReadableStreamFulfillReadRequest(t,i,a):function ReadableStreamFulfillReadIntoRequest(t,r,a){var i=t._reader._readIntoRequests.shift();a?i._closeSteps(r):i._chunkSteps(r)}(t,i,a)}function ReadableByteStreamControllerConvertPullIntoDescriptor(t){var r=t.bytesFilled,a=t.elementSize;return new t.viewConstructor(t.buffer,t.byteOffset,r/a)}function ReadableByteStreamControllerEnqueueChunkToQueue(t,r,a,i){t._queue.push({buffer:r,byteOffset:a,byteLength:i});t._queueTotalSize+=i}function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r){var a=r.elementSize,i=r.bytesFilled-r.bytesFilled%a,o=Math.min(t._queueTotalSize,r.byteLength-r.bytesFilled),l=r.bytesFilled+o,u=l-l%a,c=o,d=!1;if(u>i){c=u-r.bytesFilled;d=!0}for(var h=t._queue;c>0;){var p=h.peek(),m=Math.min(c,p.byteLength),g=r.byteOffset+r.bytesFilled;CopyDataBlockBytes(r.buffer,g,p.buffer,p.byteOffset,m);if(p.byteLength===m)h.shift();else{p.byteOffset+=m;p.byteLength-=m}t._queueTotalSize-=m;ReadableByteStreamControllerFillHeadPullIntoDescriptor(0,m,r);c-=m}return d}function ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,a){a.bytesFilled+=r}function ReadableByteStreamControllerHandleQueueDrain(t){if(0===t._queueTotalSize&&t._closeRequested){ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(t._controlledReadableByteStream)}else ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerInvalidateBYOBRequest(t){if(null!==t._byobRequest){t._byobRequest._associatedReadableByteStreamController=void 0;t._byobRequest._view=null;t._byobRequest=null}}function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t){for(;t._pendingPullIntos.length>0;){if(0===t._queueTotalSize)return;var r=t._pendingPullIntos.peek();if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r)){ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,r)}}}function ReadableByteStreamControllerRespondInternal(t,r){var a=t._pendingPullIntos.peek();ReadableByteStreamControllerInvalidateBYOBRequest(t);"closed"===t._controlledReadableByteStream._state?function ReadableByteStreamControllerRespondInClosedState(t,r){var a=t._controlledReadableByteStream;if(ReadableStreamHasBYOBReader(a))for(;ReadableStreamGetNumReadIntoRequests(a)>0;)ReadableByteStreamControllerCommitPullIntoDescriptor(a,ReadableByteStreamControllerShiftPendingPullInto(t))}(t):function ReadableByteStreamControllerRespondInReadableState(t,r,a){ReadableByteStreamControllerFillHeadPullIntoDescriptor(0,r,a);if(!(a.bytesFilled<a.elementSize)){ReadableByteStreamControllerShiftPendingPullInto(t);var i=a.bytesFilled%a.elementSize;if(i>0){var o=a.byteOffset+a.bytesFilled,l=ArrayBufferSlice(a.buffer,o-i,o);ReadableByteStreamControllerEnqueueChunkToQueue(t,l,0,l.byteLength)}a.bytesFilled-=i;ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,a);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}}(t,r,a);ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerShiftPendingPullInto(t){return t._pendingPullIntos.shift()}function ReadableByteStreamControllerClearAlgorithms(t){t._pullAlgorithm=void 0;t._cancelAlgorithm=void 0}function ReadableByteStreamControllerClose(t){var r=t._controlledReadableByteStream;if(!t._closeRequested&&"readable"===r._state)if(t._queueTotalSize>0)t._closeRequested=!0;else{if(t._pendingPullIntos.length>0&&t._pendingPullIntos.peek().bytesFilled>0){var a=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,a);throw a}ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(r)}}function ReadableByteStreamControllerEnqueue(t,r){var a=t._controlledReadableByteStream;if(!t._closeRequested&&"readable"===a._state){var i=r.buffer,o=r.byteOffset,l=r.byteLength,u=i;if(t._pendingPullIntos.length>0){var c=t._pendingPullIntos.peek();c.buffer;c.buffer=c.buffer}ReadableByteStreamControllerInvalidateBYOBRequest(t);if(ReadableStreamHasDefaultReader(a))0===ReadableStreamGetNumReadRequests(a)?ReadableByteStreamControllerEnqueueChunkToQueue(t,u,o,l):ReadableStreamFulfillReadRequest(a,new Uint8Array(u,o,l),!1);else if(ReadableStreamHasBYOBReader(a)){ReadableByteStreamControllerEnqueueChunkToQueue(t,u,o,l);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}else ReadableByteStreamControllerEnqueueChunkToQueue(t,u,o,l);ReadableByteStreamControllerCallPullIfNeeded(t)}}function ReadableByteStreamControllerError(t,r){var a=t._controlledReadableByteStream;if("readable"===a._state){ReadableByteStreamControllerClearPendingPullIntos(t);ResetQueue(t);ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamError(a,r)}}function ReadableByteStreamControllerGetBYOBRequest(t){if(null===t._byobRequest&&t._pendingPullIntos.length>0){var r=t._pendingPullIntos.peek(),a=new Uint8Array(r.buffer,r.byteOffset+r.bytesFilled,r.byteLength-r.bytesFilled),i=Object.create(A.prototype);!function SetUpReadableStreamBYOBRequest(t,r,a){t._associatedReadableByteStreamController=r;t._view=a}(i,t,a);t._byobRequest=i}return t._byobRequest}function ReadableByteStreamControllerGetDesiredSize(t){var r=t._controlledReadableByteStream._state;return"errored"===r?null:"closed"===r?0:t._strategyHWM-t._queueTotalSize}function ReadableByteStreamControllerRespond(t,r){var a=t._pendingPullIntos.peek();if("closed"===t._controlledReadableByteStream._state){if(0!==r)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===r)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(a.bytesFilled+r>a.byteLength)throw new RangeError("bytesWritten out of range")}a.buffer=a.buffer;ReadableByteStreamControllerRespondInternal(t,r)}function ReadableByteStreamControllerRespondWithNewView(t,r){var a=t._pendingPullIntos.peek();if("closed"===t._controlledReadableByteStream._state){if(0!==r.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===r.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(a.byteOffset+a.bytesFilled!==r.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(a.bufferByteLength!==r.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(a.bytesFilled+r.byteLength>a.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");a.buffer=r.buffer;ReadableByteStreamControllerRespondInternal(t,r.byteLength)}function SetUpReadableByteStreamController(t,r,a,i,o,l,u){r._controlledReadableByteStream=t;r._pullAgain=!1;r._pulling=!1;r._byobRequest=null;r._queue=r._queueTotalSize=void 0;ResetQueue(r);r._closeRequested=!1;r._started=!1;r._strategyHWM=l;r._pullAlgorithm=i;r._cancelAlgorithm=o;r._autoAllocateChunkSize=u;r._pendingPullIntos=new h;t._readableStreamController=r;uponPromise(promiseResolvedWith(a()),(function(){r._started=!0;ReadableByteStreamControllerCallPullIfNeeded(r)}),(function(t){ReadableByteStreamControllerError(r,t)}))}function byobRequestBrandCheckException(t){return new TypeError("ReadableStreamBYOBRequest.prototype."+t+" can only be used on a ReadableStreamBYOBRequest")}function byteStreamControllerBrandCheckException(t){return new TypeError("ReadableByteStreamController.prototype."+t+" can only be used on a ReadableByteStreamController")}function AcquireReadableStreamBYOBReader(t){return new T(t)}function ReadableStreamAddReadIntoRequest(t,r){t._reader._readIntoRequests.push(r)}function ReadableStreamGetNumReadIntoRequests(t){return t._reader._readIntoRequests.length}function ReadableStreamHasBYOBReader(t){var r=t._reader;return void 0!==r&&!!IsReadableStreamBYOBReader(r)}var T=function(){function ReadableStreamBYOBReader(t){assertRequiredArgument(t,1,"ReadableStreamBYOBReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!IsReadableByteStreamController(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ReadableStreamReaderGenericInitialize(this,t);this._readIntoRequests=new h}Object.defineProperty(ReadableStreamBYOBReader.prototype,"closed",{get:function(){return IsReadableStreamBYOBReader(this)?this._closedPromise:promiseRejectedWith(byobReaderBrandCheckException("closed"))},enumerable:!1,configurable:!0});ReadableStreamBYOBReader.prototype.cancel=function(t){void 0===t&&(t=void 0);return IsReadableStreamBYOBReader(this)?void 0===this._ownerReadableStream?promiseRejectedWith(readerLockException("cancel")):ReadableStreamReaderGenericCancel(this,t):promiseRejectedWith(byobReaderBrandCheckException("cancel"))};ReadableStreamBYOBReader.prototype.read=function(t){if(!IsReadableStreamBYOBReader(this))return promiseRejectedWith(byobReaderBrandCheckException("read"));if(!ArrayBuffer.isView(t))return promiseRejectedWith(new TypeError("view must be an array buffer view"));if(0===t.byteLength)return promiseRejectedWith(new TypeError("view must have non-zero byteLength"));if(0===t.buffer.byteLength)return promiseRejectedWith(new TypeError("view's buffer must have non-zero byteLength"));t.buffer;if(void 0===this._ownerReadableStream)return promiseRejectedWith(readerLockException("read from"));var r,a,i=newPromise((function(t,i){r=t;a=i}));ReadableStreamBYOBReaderRead(this,t,{_chunkSteps:function(t){return r({value:t,done:!1})},_closeSteps:function(t){return r({value:t,done:!0})},_errorSteps:function(t){return a(t)}});return i};ReadableStreamBYOBReader.prototype.releaseLock=function(){if(!IsReadableStreamBYOBReader(this))throw byobReaderBrandCheckException("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ReadableStreamReaderGenericRelease(this)}};return ReadableStreamBYOBReader}();Object.defineProperties(T.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(T.prototype,r.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function IsReadableStreamBYOBReader(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readIntoRequests")&&t instanceof T}function ReadableStreamBYOBReaderRead(t,r,a){var i=t._ownerReadableStream;i._disturbed=!0;"errored"===i._state?a._errorSteps(i._storedError):function ReadableByteStreamControllerPullInto(t,r,a){var i=t._controlledReadableByteStream,o=1;r.constructor!==DataView&&(o=r.constructor.BYTES_PER_ELEMENT);var l=r.constructor,u=r.buffer,c={buffer:u,bufferByteLength:u.byteLength,byteOffset:r.byteOffset,byteLength:r.byteLength,bytesFilled:0,elementSize:o,viewConstructor:l,readerType:"byob"};if(t._pendingPullIntos.length>0){t._pendingPullIntos.push(c);ReadableStreamAddReadIntoRequest(i,a)}else if("closed"!==i._state){if(t._queueTotalSize>0){if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,c)){var d=ReadableByteStreamControllerConvertPullIntoDescriptor(c);ReadableByteStreamControllerHandleQueueDrain(t);a._chunkSteps(d);return}if(t._closeRequested){var h=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,h);a._errorSteps(h);return}}t._pendingPullIntos.push(c);ReadableStreamAddReadIntoRequest(i,a);ReadableByteStreamControllerCallPullIfNeeded(t)}else{var p=new l(c.buffer,c.byteOffset,0);a._closeSteps(p)}}(i._readableStreamController,r,a)}function byobReaderBrandCheckException(t){return new TypeError("ReadableStreamBYOBReader.prototype."+t+" can only be used on a ReadableStreamBYOBReader")}function ExtractHighWaterMark(t,r){var a=t.highWaterMark;if(void 0===a)return r;if(R(a)||a<0)throw new RangeError("Invalid highWaterMark");return a}function ExtractSizeAlgorithm(t){var r=t.size;return r||function(){return 1}}function convertQueuingStrategy(t,r){assertDictionary(t,r);var a=null==t?void 0:t.highWaterMark,i=null==t?void 0:t.size;return{highWaterMark:void 0===a?void 0:convertUnrestrictedDouble(a),size:void 0===i?void 0:convertQueuingStrategySize(i,r+" has member 'size' that")}}function convertQueuingStrategySize(t,r){assertFunction(t,r);return function(r){return convertUnrestrictedDouble(t(r))}}function convertUnderlyingSinkAbortCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertUnderlyingSinkCloseCallback(t,r,a){assertFunction(t,a);return function(){return promiseCall(t,r,[])}}function convertUnderlyingSinkStartCallback(t,r,a){assertFunction(t,a);return function(a){return reflectCall(t,r,[a])}}function convertUnderlyingSinkWriteCallback(t,r,a){assertFunction(t,a);return function(a,i){return promiseCall(t,r,[a,i])}}function assertWritableStream(t,r){if(!IsWritableStream(t))throw new TypeError(r+" is not a WritableStream.")}var E="function"==typeof AbortController,I=function(){function WritableStream(t,r){void 0===t&&(t={});void 0===r&&(r={});void 0===t?t=null:assertObject(t,"First parameter");var a=convertQueuingStrategy(r,"Second parameter"),i=function convertUnderlyingSink(t,r){assertDictionary(t,r);var a=null==t?void 0:t.abort,i=null==t?void 0:t.close,o=null==t?void 0:t.start,l=null==t?void 0:t.type,u=null==t?void 0:t.write;return{abort:void 0===a?void 0:convertUnderlyingSinkAbortCallback(a,t,r+" has member 'abort' that"),close:void 0===i?void 0:convertUnderlyingSinkCloseCallback(i,t,r+" has member 'close' that"),start:void 0===o?void 0:convertUnderlyingSinkStartCallback(o,t,r+" has member 'start' that"),write:void 0===u?void 0:convertUnderlyingSinkWriteCallback(u,t,r+" has member 'write' that"),type:l}}(t,"First parameter");InitializeWritableStream(this);if(void 0!==i.type)throw new RangeError("Invalid type is specified");var o=ExtractSizeAlgorithm(a);!function SetUpWritableStreamDefaultControllerFromUnderlyingSink(t,r,a,i){var o=Object.create(L.prototype),startAlgorithm=function(){},writeAlgorithm=function(){return promiseResolvedWith(void 0)},closeAlgorithm=function(){return promiseResolvedWith(void 0)},abortAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.start&&(startAlgorithm=function(){return r.start(o)});void 0!==r.write&&(writeAlgorithm=function(t){return r.write(t,o)});void 0!==r.close&&(closeAlgorithm=function(){return r.close()});void 0!==r.abort&&(abortAlgorithm=function(t){return r.abort(t)});SetUpWritableStreamDefaultController(t,o,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,a,i)}(this,i,ExtractHighWaterMark(a,1),o)}Object.defineProperty(WritableStream.prototype,"locked",{get:function(){if(!IsWritableStream(this))throw streamBrandCheckException$2("locked");return IsWritableStreamLocked(this)},enumerable:!1,configurable:!0});WritableStream.prototype.abort=function(t){void 0===t&&(t=void 0);return IsWritableStream(this)?IsWritableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer")):WritableStreamAbort(this,t):promiseRejectedWith(streamBrandCheckException$2("abort"))};WritableStream.prototype.close=function(){return IsWritableStream(this)?IsWritableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer")):WritableStreamCloseQueuedOrInFlight(this)?promiseRejectedWith(new TypeError("Cannot close an already-closing stream")):WritableStreamClose(this):promiseRejectedWith(streamBrandCheckException$2("close"))};WritableStream.prototype.getWriter=function(){if(!IsWritableStream(this))throw streamBrandCheckException$2("getWriter");return AcquireWritableStreamDefaultWriter(this)};return WritableStream}();Object.defineProperties(I.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(I.prototype,r.toStringTag,{value:"WritableStream",configurable:!0});function AcquireWritableStreamDefaultWriter(t){return new O(t)}function InitializeWritableStream(t){t._state="writable";t._storedError=void 0;t._writer=void 0;t._writableStreamController=void 0;t._writeRequests=new h;t._inFlightWriteRequest=void 0;t._closeRequest=void 0;t._inFlightCloseRequest=void 0;t._pendingAbortRequest=void 0;t._backpressure=!1}function IsWritableStream(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_writableStreamController")&&t instanceof I}function IsWritableStreamLocked(t){return void 0!==t._writer}function WritableStreamAbort(t,r){var a;if("closed"===t._state||"errored"===t._state)return promiseResolvedWith(void 0);t._writableStreamController._abortReason=r;null===(a=t._writableStreamController._abortController)||void 0===a||a.abort();var i=t._state;if("closed"===i||"errored"===i)return promiseResolvedWith(void 0);if(void 0!==t._pendingAbortRequest)return t._pendingAbortRequest._promise;var o=!1;if("erroring"===i){o=!0;r=void 0}var l=newPromise((function(a,i){t._pendingAbortRequest={_promise:void 0,_resolve:a,_reject:i,_reason:r,_wasAlreadyErroring:o}}));t._pendingAbortRequest._promise=l;o||WritableStreamStartErroring(t,r);return l}function WritableStreamClose(t){var r=t._state;if("closed"===r||"errored"===r)return promiseRejectedWith(new TypeError("The stream (in "+r+" state) is not in the writable state and cannot be closed"));var a=newPromise((function(r,a){var i={_resolve:r,_reject:a};t._closeRequest=i})),i=t._writer;void 0!==i&&t._backpressure&&"writable"===r&&defaultWriterReadyPromiseResolve(i);!function WritableStreamDefaultControllerClose(t){EnqueueValueWithSize(t,D,0);WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}(t._writableStreamController);return a}function WritableStreamDealWithRejection(t,r){"writable"!==t._state?WritableStreamFinishErroring(t):WritableStreamStartErroring(t,r)}function WritableStreamStartErroring(t,r){var a=t._writableStreamController;t._state="erroring";t._storedError=r;var i=t._writer;void 0!==i&&WritableStreamDefaultWriterEnsureReadyPromiseRejected(i,r);!function WritableStreamHasOperationMarkedInFlight(t){return void 0!==t._inFlightWriteRequest||void 0!==t._inFlightCloseRequest}(t)&&a._started&&WritableStreamFinishErroring(t)}function WritableStreamFinishErroring(t){t._state="errored";t._writableStreamController[m]();var r=t._storedError;t._writeRequests.forEach((function(t){t._reject(r)}));t._writeRequests=new h;if(void 0!==t._pendingAbortRequest){var a=t._pendingAbortRequest;t._pendingAbortRequest=void 0;if(a._wasAlreadyErroring){a._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}else uponPromise(t._writableStreamController[p](a._reason),(function(){a._resolve();WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}),(function(r){a._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}))}else WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}function WritableStreamCloseQueuedOrInFlight(t){return void 0!==t._closeRequest||void 0!==t._inFlightCloseRequest}function WritableStreamRejectCloseAndClosedPromiseIfNeeded(t){if(void 0!==t._closeRequest){t._closeRequest._reject(t._storedError);t._closeRequest=void 0}var r=t._writer;void 0!==r&&defaultWriterClosedPromiseReject(r,t._storedError)}function WritableStreamUpdateBackpressure(t,r){var a=t._writer;void 0!==a&&r!==t._backpressure&&(r?function defaultWriterReadyPromiseReset(t){defaultWriterReadyPromiseInitialize(t)}(a):defaultWriterReadyPromiseResolve(a));t._backpressure=r}var O=function(){function WritableStreamDefaultWriter(t){assertRequiredArgument(t,1,"WritableStreamDefaultWriter");assertWritableStream(t,"First parameter");if(IsWritableStreamLocked(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t;t._writer=this;var r=t._state;if("writable"===r){!WritableStreamCloseQueuedOrInFlight(t)&&t._backpressure?defaultWriterReadyPromiseInitialize(this):defaultWriterReadyPromiseInitializeAsResolved(this);defaultWriterClosedPromiseInitialize(this)}else if("erroring"===r){defaultWriterReadyPromiseInitializeAsRejected(this,t._storedError);defaultWriterClosedPromiseInitialize(this)}else if("closed"===r){defaultWriterReadyPromiseInitializeAsResolved(this);!function defaultWriterClosedPromiseInitializeAsResolved(t){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseResolve(t)}(this)}else{var a=t._storedError;defaultWriterReadyPromiseInitializeAsRejected(this,a);defaultWriterClosedPromiseInitializeAsRejected(this,a)}}Object.defineProperty(WritableStreamDefaultWriter.prototype,"closed",{get:function(){return IsWritableStreamDefaultWriter(this)?this._closedPromise:promiseRejectedWith(defaultWriterBrandCheckException("closed"))},enumerable:!1,configurable:!0});Object.defineProperty(WritableStreamDefaultWriter.prototype,"desiredSize",{get:function(){if(!IsWritableStreamDefaultWriter(this))throw defaultWriterBrandCheckException("desiredSize");if(void 0===this._ownerWritableStream)throw defaultWriterLockException("desiredSize");return function WritableStreamDefaultWriterGetDesiredSize(t){var r=t._ownerWritableStream,a=r._state;return"errored"===a||"erroring"===a?null:"closed"===a?0:WritableStreamDefaultControllerGetDesiredSize(r._writableStreamController)}(this)},enumerable:!1,configurable:!0});Object.defineProperty(WritableStreamDefaultWriter.prototype,"ready",{get:function(){return IsWritableStreamDefaultWriter(this)?this._readyPromise:promiseRejectedWith(defaultWriterBrandCheckException("ready"))},enumerable:!1,configurable:!0});WritableStreamDefaultWriter.prototype.abort=function(t){void 0===t&&(t=void 0);return IsWritableStreamDefaultWriter(this)?void 0===this._ownerWritableStream?promiseRejectedWith(defaultWriterLockException("abort")):function WritableStreamDefaultWriterAbort(t,r){return WritableStreamAbort(t._ownerWritableStream,r)}(this,t):promiseRejectedWith(defaultWriterBrandCheckException("abort"))};WritableStreamDefaultWriter.prototype.close=function(){if(!IsWritableStreamDefaultWriter(this))return promiseRejectedWith(defaultWriterBrandCheckException("close"));var t=this._ownerWritableStream;return void 0===t?promiseRejectedWith(defaultWriterLockException("close")):WritableStreamCloseQueuedOrInFlight(t)?promiseRejectedWith(new TypeError("Cannot close an already-closing stream")):WritableStreamDefaultWriterClose(this)};WritableStreamDefaultWriter.prototype.releaseLock=function(){if(!IsWritableStreamDefaultWriter(this))throw defaultWriterBrandCheckException("releaseLock");void 0!==this._ownerWritableStream&&WritableStreamDefaultWriterRelease(this)};WritableStreamDefaultWriter.prototype.write=function(t){void 0===t&&(t=void 0);return IsWritableStreamDefaultWriter(this)?void 0===this._ownerWritableStream?promiseRejectedWith(defaultWriterLockException("write to")):WritableStreamDefaultWriterWrite(this,t):promiseRejectedWith(defaultWriterBrandCheckException("write"))};return WritableStreamDefaultWriter}();Object.defineProperties(O.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(O.prototype,r.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function IsWritableStreamDefaultWriter(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_ownerWritableStream")&&t instanceof O}function WritableStreamDefaultWriterClose(t){return WritableStreamClose(t._ownerWritableStream)}function WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,r){"pending"===t._closedPromiseState?defaultWriterClosedPromiseReject(t,r):function defaultWriterClosedPromiseResetToRejected(t,r){defaultWriterClosedPromiseInitializeAsRejected(t,r)}(t,r)}function WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,r){"pending"===t._readyPromiseState?defaultWriterReadyPromiseReject(t,r):function defaultWriterReadyPromiseResetToRejected(t,r){defaultWriterReadyPromiseInitializeAsRejected(t,r)}(t,r)}function WritableStreamDefaultWriterRelease(t){var r=t._ownerWritableStream,a=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,a);WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,a);r._writer=void 0;t._ownerWritableStream=void 0}function WritableStreamDefaultWriterWrite(t,r){var a=t._ownerWritableStream,i=a._writableStreamController,o=function WritableStreamDefaultControllerGetChunkSize(t,r){try{return t._strategySizeAlgorithm(r)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return 1}}(i,r);if(a!==t._ownerWritableStream)return promiseRejectedWith(defaultWriterLockException("write to"));var l=a._state;if("errored"===l)return promiseRejectedWith(a._storedError);if(WritableStreamCloseQueuedOrInFlight(a)||"closed"===l)return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===l)return promiseRejectedWith(a._storedError);var u=function WritableStreamAddWriteRequest(t){return newPromise((function(r,a){var i={_resolve:r,_reject:a};t._writeRequests.push(i)}))}(a);!function WritableStreamDefaultControllerWrite(t,r,a){try{EnqueueValueWithSize(t,r,a)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return}var i=t._controlledWritableStream;WritableStreamCloseQueuedOrInFlight(i)||"writable"!==i._state||WritableStreamUpdateBackpressure(i,WritableStreamDefaultControllerGetBackpressure(t));WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}(i,r,o);return u}var D={},L=function(){function WritableStreamDefaultController(){throw new TypeError("Illegal constructor")}Object.defineProperty(WritableStreamDefaultController.prototype,"abortReason",{get:function(){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("abortReason");return this._abortReason},enumerable:!1,configurable:!0});Object.defineProperty(WritableStreamDefaultController.prototype,"signal",{get:function(){if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal},enumerable:!1,configurable:!0});WritableStreamDefaultController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsWritableStreamDefaultController(this))throw defaultControllerBrandCheckException$2("error");"writable"===this._controlledWritableStream._state&&WritableStreamDefaultControllerError(this,t)};WritableStreamDefaultController.prototype[p]=function(t){var r=this._abortAlgorithm(t);WritableStreamDefaultControllerClearAlgorithms(this);return r};WritableStreamDefaultController.prototype[m]=function(){ResetQueue(this)};return WritableStreamDefaultController}();Object.defineProperties(L.prototype,{error:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(L.prototype,r.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function IsWritableStreamDefaultController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledWritableStream")&&t instanceof L}function SetUpWritableStreamDefaultController(t,r,a,i,o,l,u,c){r._controlledWritableStream=t;t._writableStreamController=r;r._queue=void 0;r._queueTotalSize=void 0;ResetQueue(r);r._abortReason=void 0;r._abortController=function createAbortController(){if(E)return new AbortController}();r._started=!1;r._strategySizeAlgorithm=c;r._strategyHWM=u;r._writeAlgorithm=i;r._closeAlgorithm=o;r._abortAlgorithm=l;var d=WritableStreamDefaultControllerGetBackpressure(r);WritableStreamUpdateBackpressure(t,d);uponPromise(promiseResolvedWith(a()),(function(){r._started=!0;WritableStreamDefaultControllerAdvanceQueueIfNeeded(r)}),(function(a){r._started=!0;WritableStreamDealWithRejection(t,a)}))}function WritableStreamDefaultControllerClearAlgorithms(t){t._writeAlgorithm=void 0;t._closeAlgorithm=void 0;t._abortAlgorithm=void 0;t._strategySizeAlgorithm=void 0}function WritableStreamDefaultControllerGetDesiredSize(t){return t._strategyHWM-t._queueTotalSize}function WritableStreamDefaultControllerAdvanceQueueIfNeeded(t){var r=t._controlledWritableStream;if(t._started&&void 0===r._inFlightWriteRequest)if("erroring"!==r._state){if(0!==t._queue.length){var a=function PeekQueueValue(t){return t._queue.peek().value}(t);a===D?function WritableStreamDefaultControllerProcessClose(t){var r=t._controlledWritableStream;!function WritableStreamMarkCloseRequestInFlight(t){t._inFlightCloseRequest=t._closeRequest;t._closeRequest=void 0}(r);DequeueValue(t);var a=t._closeAlgorithm();WritableStreamDefaultControllerClearAlgorithms(t);uponPromise(a,(function(){!function WritableStreamFinishInFlightClose(t){t._inFlightCloseRequest._resolve(void 0);t._inFlightCloseRequest=void 0;if("erroring"===t._state){t._storedError=void 0;if(void 0!==t._pendingAbortRequest){t._pendingAbortRequest._resolve();t._pendingAbortRequest=void 0}}t._state="closed";var r=t._writer;void 0!==r&&defaultWriterClosedPromiseResolve(r)}(r)}),(function(t){!function WritableStreamFinishInFlightCloseWithError(t,r){t._inFlightCloseRequest._reject(r);t._inFlightCloseRequest=void 0;if(void 0!==t._pendingAbortRequest){t._pendingAbortRequest._reject(r);t._pendingAbortRequest=void 0}WritableStreamDealWithRejection(t,r)}(r,t)}))}(t):function WritableStreamDefaultControllerProcessWrite(t,r){var a=t._controlledWritableStream;!function WritableStreamMarkFirstWriteRequestInFlight(t){t._inFlightWriteRequest=t._writeRequests.shift()}(a);uponPromise(t._writeAlgorithm(r),(function(){!function WritableStreamFinishInFlightWrite(t){t._inFlightWriteRequest._resolve(void 0);t._inFlightWriteRequest=void 0}(a);var r=a._state;DequeueValue(t);if(!WritableStreamCloseQueuedOrInFlight(a)&&"writable"===r){var i=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(a,i)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}),(function(r){"writable"===a._state&&WritableStreamDefaultControllerClearAlgorithms(t);!function WritableStreamFinishInFlightWriteWithError(t,r){t._inFlightWriteRequest._reject(r);t._inFlightWriteRequest=void 0;WritableStreamDealWithRejection(t,r)}(a,r)}))}(t,a)}}else WritableStreamFinishErroring(r)}function WritableStreamDefaultControllerErrorIfNeeded(t,r){"writable"===t._controlledWritableStream._state&&WritableStreamDefaultControllerError(t,r)}function WritableStreamDefaultControllerGetBackpressure(t){return WritableStreamDefaultControllerGetDesiredSize(t)<=0}function WritableStreamDefaultControllerError(t,r){var a=t._controlledWritableStream;WritableStreamDefaultControllerClearAlgorithms(t);WritableStreamStartErroring(a,r)}function streamBrandCheckException$2(t){return new TypeError("WritableStream.prototype."+t+" can only be used on a WritableStream")}function defaultControllerBrandCheckException$2(t){return new TypeError("WritableStreamDefaultController.prototype."+t+" can only be used on a WritableStreamDefaultController")}function defaultWriterBrandCheckException(t){return new TypeError("WritableStreamDefaultWriter.prototype."+t+" can only be used on a WritableStreamDefaultWriter")}function defaultWriterLockException(t){return new TypeError("Cannot "+t+" a stream using a released writer")}function defaultWriterClosedPromiseInitialize(t){t._closedPromise=newPromise((function(r,a){t._closedPromise_resolve=r;t._closedPromise_reject=a;t._closedPromiseState="pending"}))}function defaultWriterClosedPromiseInitializeAsRejected(t,r){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseReject(t,r)}function defaultWriterClosedPromiseReject(t,r){if(void 0!==t._closedPromise_reject){setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0;t._closedPromiseState="rejected"}}function defaultWriterClosedPromiseResolve(t){if(void 0!==t._closedPromise_resolve){t._closedPromise_resolve(void 0);t._closedPromise_resolve=void 0;t._closedPromise_reject=void 0;t._closedPromiseState="resolved"}}function defaultWriterReadyPromiseInitialize(t){t._readyPromise=newPromise((function(r,a){t._readyPromise_resolve=r;t._readyPromise_reject=a}));t._readyPromiseState="pending"}function defaultWriterReadyPromiseInitializeAsRejected(t,r){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseReject(t,r)}function defaultWriterReadyPromiseInitializeAsResolved(t){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseResolve(t)}function defaultWriterReadyPromiseReject(t,r){if(void 0!==t._readyPromise_reject){setPromiseIsHandledToTrue(t._readyPromise);t._readyPromise_reject(r);t._readyPromise_resolve=void 0;t._readyPromise_reject=void 0;t._readyPromiseState="rejected"}}function defaultWriterReadyPromiseResolve(t){if(void 0!==t._readyPromise_resolve){t._readyPromise_resolve(void 0);t._readyPromise_resolve=void 0;t._readyPromise_reject=void 0;t._readyPromiseState="fulfilled"}}var M="undefined"!=typeof DOMException?DOMException:void 0,B=function isDOMExceptionConstructor(t){if("function"!=typeof t&&"object"!=typeof t)return!1;try{new t;return!0}catch(t){return!1}}(M)?M:function createDOMExceptionPolyfill(){var t=function DOMException(t,r){this.message=t||"";this.name=r||"Error";Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};t.prototype=Object.create(Error.prototype);Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,configurable:!0});return t}();function ReadableStreamPipeTo(t,r,a,i,o,l){var u=AcquireReadableStreamDefaultReader(t),c=AcquireWritableStreamDefaultWriter(r);t._disturbed=!0;var d=!1,h=promiseResolvedWith(void 0);return newPromise((function(p,m){var g;if(void 0!==l){g=function(){var a=new B("Aborted","AbortError"),l=[];i||l.push((function(){return"writable"===r._state?WritableStreamAbort(r,a):promiseResolvedWith(void 0)}));o||l.push((function(){return"readable"===t._state?ReadableStreamCancel(t,a):promiseResolvedWith(void 0)}));shutdownWithAction((function(){return Promise.all(l.map((function(t){return t()})))}),!0,a)};if(l.aborted){g();return}l.addEventListener("abort",g)}isOrBecomesErrored(t,u._closedPromise,(function(t){i?shutdown(!0,t):shutdownWithAction((function(){return WritableStreamAbort(r,t)}),!0,t)}));isOrBecomesErrored(r,c._closedPromise,(function(r){o?shutdown(!0,r):shutdownWithAction((function(){return ReadableStreamCancel(t,r)}),!0,r)}));!function isOrBecomesClosed(t,r,a){"closed"===t._state?a():uponFulfillment(r,a)}(t,u._closedPromise,(function(){a?shutdown():shutdownWithAction((function(){return function WritableStreamDefaultWriterCloseWithErrorPropagation(t){var r=t._ownerWritableStream,a=r._state;return WritableStreamCloseQueuedOrInFlight(r)||"closed"===a?promiseResolvedWith(void 0):"errored"===a?promiseRejectedWith(r._storedError):WritableStreamDefaultWriterClose(t)}(c)}))}));if(WritableStreamCloseQueuedOrInFlight(r)||"closed"===r._state){var v=new TypeError("the destination writable stream closed before all data could be piped to it");o?shutdown(!0,v):shutdownWithAction((function(){return ReadableStreamCancel(t,v)}),!0,v)}setPromiseIsHandledToTrue(function pipeLoop(){return newPromise((function(t,r){!function next(a){a?t():PerformPromiseThen(function pipeStep(){return d?promiseResolvedWith(!0):PerformPromiseThen(c._readyPromise,(function(){return newPromise((function(t,r){ReadableStreamDefaultReaderRead(u,{_chunkSteps:function(r){h=PerformPromiseThen(WritableStreamDefaultWriterWrite(c,r),void 0,noop);t(!1)},_closeSteps:function(){return t(!0)},_errorSteps:r})}))}))}(),next,r)}(!1)}))}());function waitForWritesToFinish(){var t=h;return PerformPromiseThen(h,(function(){return t!==h?waitForWritesToFinish():void 0}))}function isOrBecomesErrored(t,r,a){"errored"===t._state?a(t._storedError):uponRejection(r,a)}function shutdownWithAction(t,a,i){if(!d){d=!0;"writable"!==r._state||WritableStreamCloseQueuedOrInFlight(r)?doTheRest():uponFulfillment(waitForWritesToFinish(),doTheRest)}function doTheRest(){uponPromise(t(),(function(){return finalize(a,i)}),(function(t){return finalize(!0,t)}))}}function shutdown(t,a){if(!d){d=!0;"writable"!==r._state||WritableStreamCloseQueuedOrInFlight(r)?finalize(t,a):uponFulfillment(waitForWritesToFinish(),(function(){return finalize(t,a)}))}}function finalize(t,r){WritableStreamDefaultWriterRelease(c);ReadableStreamReaderGenericRelease(u);void 0!==l&&l.removeEventListener("abort",g);t?m(r):p(void 0)}}))}var W=function(){function ReadableStreamDefaultController(){throw new TypeError("Illegal constructor")}Object.defineProperty(ReadableStreamDefaultController.prototype,"desiredSize",{get:function(){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("desiredSize");return ReadableStreamDefaultControllerGetDesiredSize(this)},enumerable:!1,configurable:!0});ReadableStreamDefaultController.prototype.close=function(){if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("close");if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("The stream is not in a state that permits close");ReadableStreamDefaultControllerClose(this)};ReadableStreamDefaultController.prototype.enqueue=function(t){void 0===t&&(t=void 0);if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("enqueue");if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this))throw new TypeError("The stream is not in a state that permits enqueue");return ReadableStreamDefaultControllerEnqueue(this,t)};ReadableStreamDefaultController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsReadableStreamDefaultController(this))throw defaultControllerBrandCheckException$1("error");ReadableStreamDefaultControllerError(this,t)};ReadableStreamDefaultController.prototype[g]=function(t){ResetQueue(this);var r=this._cancelAlgorithm(t);ReadableStreamDefaultControllerClearAlgorithms(this);return r};ReadableStreamDefaultController.prototype[v]=function(t){var r=this._controlledReadableStream;if(this._queue.length>0){var a=DequeueValue(this);if(this._closeRequested&&0===this._queue.length){ReadableStreamDefaultControllerClearAlgorithms(this);ReadableStreamClose(r)}else ReadableStreamDefaultControllerCallPullIfNeeded(this);t._chunkSteps(a)}else{ReadableStreamAddReadRequest(r,t);ReadableStreamDefaultControllerCallPullIfNeeded(this)}};return ReadableStreamDefaultController}();Object.defineProperties(W.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(W.prototype,r.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function IsReadableStreamDefaultController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledReadableStream")&&t instanceof W}function ReadableStreamDefaultControllerCallPullIfNeeded(t){if(ReadableStreamDefaultControllerShouldCallPull(t))if(t._pulling)t._pullAgain=!0;else{t._pulling=!0;uponPromise(t._pullAlgorithm(),(function(){t._pulling=!1;if(t._pullAgain){t._pullAgain=!1;ReadableStreamDefaultControllerCallPullIfNeeded(t)}}),(function(r){ReadableStreamDefaultControllerError(t,r)}))}}function ReadableStreamDefaultControllerShouldCallPull(t){var r=t._controlledReadableStream;return!!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)&&!!t._started&&(!!(IsReadableStreamLocked(r)&&ReadableStreamGetNumReadRequests(r)>0)||ReadableStreamDefaultControllerGetDesiredSize(t)>0)}function ReadableStreamDefaultControllerClearAlgorithms(t){t._pullAlgorithm=void 0;t._cancelAlgorithm=void 0;t._strategySizeAlgorithm=void 0}function ReadableStreamDefaultControllerClose(t){if(ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){var r=t._controlledReadableStream;t._closeRequested=!0;if(0===t._queue.length){ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamClose(r)}}}function ReadableStreamDefaultControllerEnqueue(t,r){if(ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){var a=t._controlledReadableStream;if(IsReadableStreamLocked(a)&&ReadableStreamGetNumReadRequests(a)>0)ReadableStreamFulfillReadRequest(a,r,!1);else{var i=void 0;try{i=t._strategySizeAlgorithm(r)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}try{EnqueueValueWithSize(t,r,i)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}}ReadableStreamDefaultControllerCallPullIfNeeded(t)}}function ReadableStreamDefaultControllerError(t,r){var a=t._controlledReadableStream;if("readable"===a._state){ResetQueue(t);ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamError(a,r)}}function ReadableStreamDefaultControllerGetDesiredSize(t){var r=t._controlledReadableStream._state;return"errored"===r?null:"closed"===r?0:t._strategyHWM-t._queueTotalSize}function ReadableStreamDefaultControllerCanCloseOrEnqueue(t){var r=t._controlledReadableStream._state;return!t._closeRequested&&"readable"===r}function SetUpReadableStreamDefaultController(t,r,a,i,o,l,u){r._controlledReadableStream=t;r._queue=void 0;r._queueTotalSize=void 0;ResetQueue(r);r._started=!1;r._closeRequested=!1;r._pullAgain=!1;r._pulling=!1;r._strategySizeAlgorithm=u;r._strategyHWM=l;r._pullAlgorithm=i;r._cancelAlgorithm=o;t._readableStreamController=r;uponPromise(promiseResolvedWith(a()),(function(){r._started=!0;ReadableStreamDefaultControllerCallPullIfNeeded(r)}),(function(t){ReadableStreamDefaultControllerError(r,t)}))}function defaultControllerBrandCheckException$1(t){return new TypeError("ReadableStreamDefaultController.prototype."+t+" can only be used on a ReadableStreamDefaultController")}function ReadableStreamTee(t,r){return IsReadableByteStreamController(t._readableStreamController)?function ReadableByteStreamTee(t){var r,a,i,o,l,u=AcquireReadableStreamDefaultReader(t),c=!1,h=!1,p=!1,m=newPromise((function(t){l=t}));function forwardReaderError(t){uponRejection(t._closedPromise,(function(r){if(t===u){ReadableByteStreamControllerError(i._readableStreamController,r);ReadableByteStreamControllerError(o._readableStreamController,r);h&&p||l(void 0)}}))}function pullWithDefaultReader(){if(IsReadableStreamBYOBReader(u)){ReadableStreamReaderGenericRelease(u);forwardReaderError(u=AcquireReadableStreamDefaultReader(t))}ReadableStreamDefaultReaderRead(u,{_chunkSteps:function(r){d((function(){c=!1;var a=r,u=r;if(!h&&!p)try{u=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(i._readableStreamController,r);ReadableByteStreamControllerError(o._readableStreamController,r);l(ReadableStreamCancel(t,r));return}h||ReadableByteStreamControllerEnqueue(i._readableStreamController,a);p||ReadableByteStreamControllerEnqueue(o._readableStreamController,u)}))},_closeSteps:function(){c=!1;h||ReadableByteStreamControllerClose(i._readableStreamController);p||ReadableByteStreamControllerClose(o._readableStreamController);i._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(i._readableStreamController,0);o._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(o._readableStreamController,0);h&&p||l(void 0)},_errorSteps:function(){c=!1}})}function pullWithBYOBReader(r,a){if(IsReadableStreamDefaultReader(u)){ReadableStreamReaderGenericRelease(u);forwardReaderError(u=AcquireReadableStreamBYOBReader(t))}var m=a?o:i,g=a?i:o;ReadableStreamBYOBReaderRead(u,r,{_chunkSteps:function(r){d((function(){c=!1;var i=a?p:h;if(a?h:p)i||ReadableByteStreamControllerRespondWithNewView(m._readableStreamController,r);else{var o=void 0;try{o=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(m._readableStreamController,r);ReadableByteStreamControllerError(g._readableStreamController,r);l(ReadableStreamCancel(t,r));return}i||ReadableByteStreamControllerRespondWithNewView(m._readableStreamController,r);ReadableByteStreamControllerEnqueue(g._readableStreamController,o)}}))},_closeSteps:function(t){c=!1;var r=a?p:h,i=a?h:p;r||ReadableByteStreamControllerClose(m._readableStreamController);i||ReadableByteStreamControllerClose(g._readableStreamController);if(void 0!==t){r||ReadableByteStreamControllerRespondWithNewView(m._readableStreamController,t);!i&&g._readableStreamController._pendingPullIntos.length>0&&ReadableByteStreamControllerRespond(g._readableStreamController,0)}r&&i||l(void 0)},_errorSteps:function(){c=!1}})}function pull1Algorithm(){if(c)return promiseResolvedWith(void 0);c=!0;var t=ReadableByteStreamControllerGetBYOBRequest(i._readableStreamController);null===t?pullWithDefaultReader():pullWithBYOBReader(t._view,!1);return promiseResolvedWith(void 0)}function pull2Algorithm(){if(c)return promiseResolvedWith(void 0);c=!0;var t=ReadableByteStreamControllerGetBYOBRequest(o._readableStreamController);null===t?pullWithDefaultReader():pullWithBYOBReader(t._view,!0);return promiseResolvedWith(void 0)}function cancel1Algorithm(i){h=!0;r=i;if(p){var o=CreateArrayFromList([r,a]),u=ReadableStreamCancel(t,o);l(u)}return m}function cancel2Algorithm(i){p=!0;a=i;if(h){var o=CreateArrayFromList([r,a]),u=ReadableStreamCancel(t,o);l(u)}return m}function startAlgorithm(){}i=CreateReadableByteStream(startAlgorithm,pull1Algorithm,cancel1Algorithm);o=CreateReadableByteStream(startAlgorithm,pull2Algorithm,cancel2Algorithm);forwardReaderError(u);return[i,o]}(t):function ReadableStreamDefaultTee(t,r){var a,i,o,l,u,c=AcquireReadableStreamDefaultReader(t),h=!1,p=!1,m=!1,g=newPromise((function(t){u=t}));function pullAlgorithm(){if(h)return promiseResolvedWith(void 0);h=!0;ReadableStreamDefaultReaderRead(c,{_chunkSteps:function(t){d((function(){h=!1;var r=t,a=t;p||ReadableStreamDefaultControllerEnqueue(o._readableStreamController,r);m||ReadableStreamDefaultControllerEnqueue(l._readableStreamController,a)}))},_closeSteps:function(){h=!1;p||ReadableStreamDefaultControllerClose(o._readableStreamController);m||ReadableStreamDefaultControllerClose(l._readableStreamController);p&&m||u(void 0)},_errorSteps:function(){h=!1}});return promiseResolvedWith(void 0)}function cancel1Algorithm(r){p=!0;a=r;if(m){var o=CreateArrayFromList([a,i]),l=ReadableStreamCancel(t,o);u(l)}return g}function cancel2Algorithm(r){m=!0;i=r;if(p){var o=CreateArrayFromList([a,i]),l=ReadableStreamCancel(t,o);u(l)}return g}function startAlgorithm(){}o=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel1Algorithm);l=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel2Algorithm);uponRejection(c._closedPromise,(function(t){ReadableStreamDefaultControllerError(o._readableStreamController,t);ReadableStreamDefaultControllerError(l._readableStreamController,t);p&&m||u(void 0)}));return[o,l]}(t)}function convertUnderlyingSourceCancelCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertUnderlyingSourcePullCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertUnderlyingSourceStartCallback(t,r,a){assertFunction(t,a);return function(a){return reflectCall(t,r,[a])}}function convertReadableStreamType(t,r){if("bytes"!=(t=""+t))throw new TypeError(r+" '"+t+"' is not a valid enumeration value for ReadableStreamType");return t}function convertReadableStreamReaderMode(t,r){if("byob"!=(t=""+t))throw new TypeError(r+" '"+t+"' is not a valid enumeration value for ReadableStreamReaderMode");return t}function convertPipeOptions(t,r){assertDictionary(t,r);var a=null==t?void 0:t.preventAbort,i=null==t?void 0:t.preventCancel,o=null==t?void 0:t.preventClose,l=null==t?void 0:t.signal;void 0!==l&&function assertAbortSignal(t,r){if(!function isAbortSignal(t){if("object"!=typeof t||null===t)return!1;try{return"boolean"==typeof t.aborted}catch(t){return!1}}(t))throw new TypeError(r+" is not an AbortSignal.")}(l,r+" has member 'signal' that");return{preventAbort:Boolean(a),preventCancel:Boolean(i),preventClose:Boolean(o),signal:l}}var N=function(){function ReadableStream(t,r){void 0===t&&(t={});void 0===r&&(r={});void 0===t?t=null:assertObject(t,"First parameter");var a=convertQueuingStrategy(r,"Second parameter"),i=function convertUnderlyingDefaultOrByteSource(t,r){assertDictionary(t,r);var a=t,i=null==a?void 0:a.autoAllocateChunkSize,o=null==a?void 0:a.cancel,l=null==a?void 0:a.pull,u=null==a?void 0:a.start,c=null==a?void 0:a.type;return{autoAllocateChunkSize:void 0===i?void 0:convertUnsignedLongLongWithEnforceRange(i,r+" has member 'autoAllocateChunkSize' that"),cancel:void 0===o?void 0:convertUnderlyingSourceCancelCallback(o,a,r+" has member 'cancel' that"),pull:void 0===l?void 0:convertUnderlyingSourcePullCallback(l,a,r+" has member 'pull' that"),start:void 0===u?void 0:convertUnderlyingSourceStartCallback(u,a,r+" has member 'start' that"),type:void 0===c?void 0:convertReadableStreamType(c,r+" has member 'type' that")}}(t,"First parameter");InitializeReadableStream(this);if("bytes"===i.type){if(void 0!==a.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function SetUpReadableByteStreamControllerFromUnderlyingSource(t,r,a){var i=Object.create(x.prototype),startAlgorithm=function(){},pullAlgorithm=function(){return promiseResolvedWith(void 0)},cancelAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.start&&(startAlgorithm=function(){return r.start(i)});void 0!==r.pull&&(pullAlgorithm=function(){return r.pull(i)});void 0!==r.cancel&&(cancelAlgorithm=function(t){return r.cancel(t)});var o=r.autoAllocateChunkSize;if(0===o)throw new TypeError("autoAllocateChunkSize must be greater than 0");SetUpReadableByteStreamController(t,i,startAlgorithm,pullAlgorithm,cancelAlgorithm,a,o)}(this,i,ExtractHighWaterMark(a,0))}else{var o=ExtractSizeAlgorithm(a);!function SetUpReadableStreamDefaultControllerFromUnderlyingSource(t,r,a,i){var o=Object.create(W.prototype),startAlgorithm=function(){},pullAlgorithm=function(){return promiseResolvedWith(void 0)},cancelAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.start&&(startAlgorithm=function(){return r.start(o)});void 0!==r.pull&&(pullAlgorithm=function(){return r.pull(o)});void 0!==r.cancel&&(cancelAlgorithm=function(t){return r.cancel(t)});SetUpReadableStreamDefaultController(t,o,startAlgorithm,pullAlgorithm,cancelAlgorithm,a,i)}(this,i,ExtractHighWaterMark(a,1),o)}}Object.defineProperty(ReadableStream.prototype,"locked",{get:function(){if(!IsReadableStream(this))throw streamBrandCheckException$1("locked");return IsReadableStreamLocked(this)},enumerable:!1,configurable:!0});ReadableStream.prototype.cancel=function(t){void 0===t&&(t=void 0);return IsReadableStream(this)?IsReadableStreamLocked(this)?promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader")):ReadableStreamCancel(this,t):promiseRejectedWith(streamBrandCheckException$1("cancel"))};ReadableStream.prototype.getReader=function(t){void 0===t&&(t=void 0);if(!IsReadableStream(this))throw streamBrandCheckException$1("getReader");return void 0===function convertReaderOptions(t,r){assertDictionary(t,r);var a=null==t?void 0:t.mode;return{mode:void 0===a?void 0:convertReadableStreamReaderMode(a,r+" has member 'mode' that")}}(t,"First parameter").mode?AcquireReadableStreamDefaultReader(this):AcquireReadableStreamBYOBReader(this)};ReadableStream.prototype.pipeThrough=function(t,r){void 0===r&&(r={});if(!IsReadableStream(this))throw streamBrandCheckException$1("pipeThrough");assertRequiredArgument(t,1,"pipeThrough");var a=function convertReadableWritablePair(t,r){assertDictionary(t,r);var a=null==t?void 0:t.readable;assertRequiredField(a,"readable","ReadableWritablePair");assertReadableStream(a,r+" has member 'readable' that");var i=null==t?void 0:t.writable;assertRequiredField(i,"writable","ReadableWritablePair");assertWritableStream(i,r+" has member 'writable' that");return{readable:a,writable:i}}(t,"First parameter"),i=convertPipeOptions(r,"Second parameter");if(IsReadableStreamLocked(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(IsWritableStreamLocked(a.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");setPromiseIsHandledToTrue(ReadableStreamPipeTo(this,a.writable,i.preventClose,i.preventAbort,i.preventCancel,i.signal));return a.readable};ReadableStream.prototype.pipeTo=function(t,r){void 0===r&&(r={});if(!IsReadableStream(this))return promiseRejectedWith(streamBrandCheckException$1("pipeTo"));if(void 0===t)return promiseRejectedWith("Parameter 1 is required in 'pipeTo'.");if(!IsWritableStream(t))return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var a;try{a=convertPipeOptions(r,"Second parameter")}catch(t){return promiseRejectedWith(t)}return IsReadableStreamLocked(this)?promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):IsWritableStreamLocked(t)?promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):ReadableStreamPipeTo(this,t,a.preventClose,a.preventAbort,a.preventCancel,a.signal)};ReadableStream.prototype.tee=function(){if(!IsReadableStream(this))throw streamBrandCheckException$1("tee");return CreateArrayFromList(ReadableStreamTee(this))};ReadableStream.prototype.values=function(t){void 0===t&&(t=void 0);if(!IsReadableStream(this))throw streamBrandCheckException$1("values");return function AcquireReadableStreamAsyncIterator(t,r){var a=AcquireReadableStreamDefaultReader(t),i=new P(a,r),o=Object.create(k);o._asyncIteratorImpl=i;return o}(this,function convertIteratorOptions(t,r){assertDictionary(t,r);var a=null==t?void 0:t.preventCancel;return{preventCancel:Boolean(a)}}(t,"First parameter").preventCancel)};return ReadableStream}();Object.defineProperties(N.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(N.prototype,r.toStringTag,{value:"ReadableStream",configurable:!0});"symbol"==typeof r.asyncIterator&&Object.defineProperty(N.prototype,r.asyncIterator,{value:N.prototype.values,writable:!0,configurable:!0});function CreateReadableStream(t,r,a,i,o){void 0===i&&(i=1);void 0===o&&(o=function(){return 1});var l=Object.create(N.prototype);InitializeReadableStream(l);SetUpReadableStreamDefaultController(l,Object.create(W.prototype),t,r,a,i,o);return l}function CreateReadableByteStream(t,r,a){var i=Object.create(N.prototype);InitializeReadableStream(i);SetUpReadableByteStreamController(i,Object.create(x.prototype),t,r,a,0,void 0);return i}function InitializeReadableStream(t){t._state="readable";t._reader=void 0;t._storedError=void 0;t._disturbed=!1}function IsReadableStream(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_readableStreamController")&&t instanceof N}function IsReadableStreamLocked(t){return void 0!==t._reader}function ReadableStreamCancel(t,r){t._disturbed=!0;if("closed"===t._state)return promiseResolvedWith(void 0);if("errored"===t._state)return promiseRejectedWith(t._storedError);ReadableStreamClose(t);var a=t._reader;if(void 0!==a&&IsReadableStreamBYOBReader(a)){a._readIntoRequests.forEach((function(t){t._closeSteps(void 0)}));a._readIntoRequests=new h}return transformPromiseWith(t._readableStreamController[g](r),noop)}function ReadableStreamClose(t){t._state="closed";var r=t._reader;if(void 0!==r){defaultReaderClosedPromiseResolve(r);if(IsReadableStreamDefaultReader(r)){r._readRequests.forEach((function(t){t._closeSteps()}));r._readRequests=new h}}}function ReadableStreamError(t,r){t._state="errored";t._storedError=r;var a=t._reader;if(void 0!==a){defaultReaderClosedPromiseReject(a,r);if(IsReadableStreamDefaultReader(a)){a._readRequests.forEach((function(t){t._errorSteps(r)}));a._readRequests=new h}else{a._readIntoRequests.forEach((function(t){t._errorSteps(r)}));a._readIntoRequests=new h}}}function streamBrandCheckException$1(t){return new TypeError("ReadableStream.prototype."+t+" can only be used on a ReadableStream")}function convertQueuingStrategyInit(t,r){assertDictionary(t,r);var a=null==t?void 0:t.highWaterMark;assertRequiredField(a,"highWaterMark","QueuingStrategyInit");return{highWaterMark:convertUnrestrictedDouble(a)}}var byteLengthSizeFunction=function(t){return t.byteLength};Object.defineProperty(byteLengthSizeFunction,"name",{value:"size",configurable:!0});var j=function(){function ByteLengthQueuingStrategy(t){assertRequiredArgument(t,1,"ByteLengthQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}Object.defineProperty(ByteLengthQueuingStrategy.prototype,"highWaterMark",{get:function(){if(!IsByteLengthQueuingStrategy(this))throw byteLengthBrandCheckException("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0});Object.defineProperty(ByteLengthQueuingStrategy.prototype,"size",{get:function(){if(!IsByteLengthQueuingStrategy(this))throw byteLengthBrandCheckException("size");return byteLengthSizeFunction},enumerable:!1,configurable:!0});return ByteLengthQueuingStrategy}();Object.defineProperties(j.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(j.prototype,r.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function byteLengthBrandCheckException(t){return new TypeError("ByteLengthQueuingStrategy.prototype."+t+" can only be used on a ByteLengthQueuingStrategy")}function IsByteLengthQueuingStrategy(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_byteLengthQueuingStrategyHighWaterMark")&&t instanceof j}var countSizeFunction=function(){return 1};Object.defineProperty(countSizeFunction,"name",{value:"size",configurable:!0});var V=function(){function CountQueuingStrategy(t){assertRequiredArgument(t,1,"CountQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._countQueuingStrategyHighWaterMark=t.highWaterMark}Object.defineProperty(CountQueuingStrategy.prototype,"highWaterMark",{get:function(){if(!IsCountQueuingStrategy(this))throw countBrandCheckException("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0});Object.defineProperty(CountQueuingStrategy.prototype,"size",{get:function(){if(!IsCountQueuingStrategy(this))throw countBrandCheckException("size");return countSizeFunction},enumerable:!1,configurable:!0});return CountQueuingStrategy}();Object.defineProperties(V.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(V.prototype,r.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function countBrandCheckException(t){return new TypeError("CountQueuingStrategy.prototype."+t+" can only be used on a CountQueuingStrategy")}function IsCountQueuingStrategy(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_countQueuingStrategyHighWaterMark")&&t instanceof V}function convertTransformerFlushCallback(t,r,a){assertFunction(t,a);return function(a){return promiseCall(t,r,[a])}}function convertTransformerStartCallback(t,r,a){assertFunction(t,a);return function(a){return reflectCall(t,r,[a])}}function convertTransformerTransformCallback(t,r,a){assertFunction(t,a);return function(a,i){return promiseCall(t,r,[a,i])}}var U=function(){function TransformStream(t,r,a){void 0===t&&(t={});void 0===r&&(r={});void 0===a&&(a={});void 0===t&&(t=null);var i=convertQueuingStrategy(r,"Second parameter"),o=convertQueuingStrategy(a,"Third parameter"),l=function convertTransformer(t,r){assertDictionary(t,r);var a=null==t?void 0:t.flush,i=null==t?void 0:t.readableType,o=null==t?void 0:t.start,l=null==t?void 0:t.transform,u=null==t?void 0:t.writableType;return{flush:void 0===a?void 0:convertTransformerFlushCallback(a,t,r+" has member 'flush' that"),readableType:i,start:void 0===o?void 0:convertTransformerStartCallback(o,t,r+" has member 'start' that"),transform:void 0===l?void 0:convertTransformerTransformCallback(l,t,r+" has member 'transform' that"),writableType:u}}(t,"First parameter");if(void 0!==l.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==l.writableType)throw new RangeError("Invalid writableType specified");var u,c=ExtractHighWaterMark(o,0),d=ExtractSizeAlgorithm(o),h=ExtractHighWaterMark(i,1),p=ExtractSizeAlgorithm(i);!function InitializeTransformStream(t,r,a,i,o,l){function startAlgorithm(){return r}function writeAlgorithm(r){return function TransformStreamDefaultSinkWriteAlgorithm(t,r){var a=t._transformStreamController;return t._backpressure?transformPromiseWith(t._backpressureChangePromise,(function(){var i=t._writable;if("erroring"===i._state)throw i._storedError;return TransformStreamDefaultControllerPerformTransform(a,r)})):TransformStreamDefaultControllerPerformTransform(a,r)}(t,r)}function abortAlgorithm(r){return function TransformStreamDefaultSinkAbortAlgorithm(t,r){TransformStreamError(t,r);return promiseResolvedWith(void 0)}(t,r)}function closeAlgorithm(){return function TransformStreamDefaultSinkCloseAlgorithm(t){var r=t._readable,a=t._transformStreamController,i=a._flushAlgorithm();TransformStreamDefaultControllerClearAlgorithms(a);return transformPromiseWith(i,(function(){if("errored"===r._state)throw r._storedError;ReadableStreamDefaultControllerClose(r._readableStreamController)}),(function(a){TransformStreamError(t,a);throw r._storedError}))}(t)}t._writable=function CreateWritableStream(t,r,a,i,o,l){void 0===o&&(o=1);void 0===l&&(l=function(){return 1});var u=Object.create(I.prototype);InitializeWritableStream(u);SetUpWritableStreamDefaultController(u,Object.create(L.prototype),t,r,a,i,o,l);return u}(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,a,i);function pullAlgorithm(){return function TransformStreamDefaultSourcePullAlgorithm(t){TransformStreamSetBackpressure(t,!1);return t._backpressureChangePromise}(t)}function cancelAlgorithm(r){TransformStreamErrorWritableAndUnblockWrite(t,r);return promiseResolvedWith(void 0)}t._readable=CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,o,l);t._backpressure=void 0;t._backpressureChangePromise=void 0;t._backpressureChangePromise_resolve=void 0;TransformStreamSetBackpressure(t,!0);t._transformStreamController=void 0}(this,newPromise((function(t){u=t})),h,p,c,d);!function SetUpTransformStreamDefaultControllerFromTransformer(t,r){var a=Object.create(q.prototype),transformAlgorithm=function(t){try{TransformStreamDefaultControllerEnqueue(a,t);return promiseResolvedWith(void 0)}catch(t){return promiseRejectedWith(t)}},flushAlgorithm=function(){return promiseResolvedWith(void 0)};void 0!==r.transform&&(transformAlgorithm=function(t){return r.transform(t,a)});void 0!==r.flush&&(flushAlgorithm=function(){return r.flush(a)});!function SetUpTransformStreamDefaultController(t,r,a,i){r._controlledTransformStream=t;t._transformStreamController=r;r._transformAlgorithm=a;r._flushAlgorithm=i}(t,a,transformAlgorithm,flushAlgorithm)}(this,l);void 0!==l.start?u(l.start(this._transformStreamController)):u(void 0)}Object.defineProperty(TransformStream.prototype,"readable",{get:function(){if(!IsTransformStream(this))throw streamBrandCheckException("readable");return this._readable},enumerable:!1,configurable:!0});Object.defineProperty(TransformStream.prototype,"writable",{get:function(){if(!IsTransformStream(this))throw streamBrandCheckException("writable");return this._writable},enumerable:!1,configurable:!0});return TransformStream}();Object.defineProperties(U.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(U.prototype,r.toStringTag,{value:"TransformStream",configurable:!0});function IsTransformStream(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_transformStreamController")&&t instanceof U}function TransformStreamError(t,r){ReadableStreamDefaultControllerError(t._readable._readableStreamController,r);TransformStreamErrorWritableAndUnblockWrite(t,r)}function TransformStreamErrorWritableAndUnblockWrite(t,r){TransformStreamDefaultControllerClearAlgorithms(t._transformStreamController);WritableStreamDefaultControllerErrorIfNeeded(t._writable._writableStreamController,r);t._backpressure&&TransformStreamSetBackpressure(t,!1)}function TransformStreamSetBackpressure(t,r){void 0!==t._backpressureChangePromise&&t._backpressureChangePromise_resolve();t._backpressureChangePromise=newPromise((function(r){t._backpressureChangePromise_resolve=r}));t._backpressure=r}var q=function(){function TransformStreamDefaultController(){throw new TypeError("Illegal constructor")}Object.defineProperty(TransformStreamDefaultController.prototype,"desiredSize",{get:function(){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("desiredSize");return ReadableStreamDefaultControllerGetDesiredSize(this._controlledTransformStream._readable._readableStreamController)},enumerable:!1,configurable:!0});TransformStreamDefaultController.prototype.enqueue=function(t){void 0===t&&(t=void 0);if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("enqueue");TransformStreamDefaultControllerEnqueue(this,t)};TransformStreamDefaultController.prototype.error=function(t){void 0===t&&(t=void 0);if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("error");!function TransformStreamDefaultControllerError(t,r){TransformStreamError(t._controlledTransformStream,r)}(this,t)};TransformStreamDefaultController.prototype.terminate=function(){if(!IsTransformStreamDefaultController(this))throw defaultControllerBrandCheckException("terminate");!function TransformStreamDefaultControllerTerminate(t){var r=t._controlledTransformStream;ReadableStreamDefaultControllerClose(r._readable._readableStreamController);var a=new TypeError("TransformStream terminated");TransformStreamErrorWritableAndUnblockWrite(r,a)}(this)};return TransformStreamDefaultController}();Object.defineProperties(q.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}});"symbol"==typeof r.toStringTag&&Object.defineProperty(q.prototype,r.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function IsTransformStreamDefaultController(t){return!!typeIsObject(t)&&!!Object.prototype.hasOwnProperty.call(t,"_controlledTransformStream")&&t instanceof q}function TransformStreamDefaultControllerClearAlgorithms(t){t._transformAlgorithm=void 0;t._flushAlgorithm=void 0}function TransformStreamDefaultControllerEnqueue(t,r){var a=t._controlledTransformStream,i=a._readable._readableStreamController;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(i))throw new TypeError("Readable side is not in a state that permits enqueue");try{ReadableStreamDefaultControllerEnqueue(i,r)}catch(t){TransformStreamErrorWritableAndUnblockWrite(a,t);throw a._readable._storedError}var o=function ReadableStreamDefaultControllerHasBackpressure(t){return!ReadableStreamDefaultControllerShouldCallPull(t)}(i);o!==a._backpressure&&TransformStreamSetBackpressure(a,!0)}function TransformStreamDefaultControllerPerformTransform(t,r){return transformPromiseWith(t._transformAlgorithm(r),void 0,(function(r){TransformStreamError(t._controlledTransformStream,r);throw r}))}function defaultControllerBrandCheckException(t){return new TypeError("TransformStreamDefaultController.prototype."+t+" can only be used on a TransformStreamDefaultController")}function streamBrandCheckException(t){return new TypeError("TransformStream.prototype."+t+" can only be used on a TransformStream")}t.ByteLengthQueuingStrategy=j;t.CountQueuingStrategy=V;t.ReadableByteStreamController=x;t.ReadableStream=N;t.ReadableStreamBYOBReader=T;t.ReadableStreamBYOBRequest=A;t.ReadableStreamDefaultController=W;t.ReadableStreamDefaultReader=C;t.TransformStream=U;t.TransformStreamDefaultController=q;t.WritableStream=I;t.WritableStreamDefaultController=L;t.WritableStreamDefaultWriter=O;Object.defineProperty(t,"__esModule",{value:!0})},a(r);var a},(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.StructTreeLayerBuilder=r.DefaultStructTreeLayerFactory=void 0;function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var a={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},i=/^H(\d+)$/,o=function(){function StructTreeLayerBuilder(t){var r=t.pdfPage;_classCallCheck(this,StructTreeLayerBuilder);this.pdfPage=r}_createClass(StructTreeLayerBuilder,[{key:"render",value:function render(t){return this._walk(t)}},{key:"_setAttributes",value:function _setAttributes(t,r){void 0!==t.alt&&r.setAttribute("aria-label",t.alt);void 0!==t.id&&r.setAttribute("aria-owns",t.id)}},{key:"_walk",value:function _walk(t){if(!t)return null;var r=document.createElement("span");if("role"in t){var o=t.role,l=o.match(i);if(l){r.setAttribute("role","heading");r.setAttribute("aria-level",l[1])}else a[o]&&r.setAttribute("role",a[o])}this._setAttributes(t,r);if(t.children)if(1===t.children.length&&"id"in t.children[0])this._setAttributes(t.children[0],r);else{var u,c=_createForOfIteratorHelper(t.children);try{for(c.s();!(u=c.n()).done;){var d=u.value;r.appendChild(this._walk(d))}}catch(t){c.e(t)}finally{c.f()}}return r}}]);return StructTreeLayerBuilder}();r.StructTreeLayerBuilder=o;var l=function(){function DefaultStructTreeLayerFactory(){_classCallCheck(this,DefaultStructTreeLayerFactory)}_createClass(DefaultStructTreeLayerFactory,[{key:"createStructTreeLayerBuilder",value:function createStructTreeLayerBuilder(t){return new o({pdfPage:t})}}]);return DefaultStructTreeLayerFactory}();r.DefaultStructTreeLayerFactory=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.TextLayerBuilder=r.DefaultTextLayerFactory=void 0;var i=a(7);function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var o=function(){function TextLayerBuilder(t){var r=t.textLayerDiv,a=t.eventBus,i=t.pageIndex,o=t.viewport,l=t.findController,u=void 0===l?null:l,c=t.enhanceTextSelection,d=void 0!==c&&c;_classCallCheck(this,TextLayerBuilder);this.textLayerDiv=r;this.eventBus=a;this.textContent=null;this.textContentItemsStr=[];this.textContentStream=null;this.renderingDone=!1;this.pageIdx=i;this.pageNumber=this.pageIdx+1;this.matches=[];this.viewport=o;this.textDivs=[];this.findController=u;this.textLayerRenderTask=null;this.enhanceTextSelection=d;this._onUpdateTextLayerMatches=null;this._bindMouse()}_createClass(TextLayerBuilder,[{key:"_finishRendering",value:function _finishRendering(){this.renderingDone=!0;if(!this.enhanceTextSelection){var t=document.createElement("div");t.className="endOfContent";this.textLayerDiv.appendChild(t)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}},{key:"render",value:function render(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if((this.textContent||this.textContentStream)&&!this.renderingDone){this.cancel();this.textDivs=[];var a=document.createDocumentFragment();this.textLayerRenderTask=(0,i.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:a,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:r,enhanceTextSelection:this.enhanceTextSelection});this.textLayerRenderTask.promise.then((function(){t.textLayerDiv.appendChild(a);t._finishRendering();t._updateMatches()}),(function(t){}));if(!this._onUpdateTextLayerMatches){this._onUpdateTextLayerMatches=function(r){r.pageIndex!==t.pageIdx&&-1!==r.pageIndex||t._updateMatches()};this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)}}}},{key:"cancel",value:function cancel(){if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}if(this._onUpdateTextLayerMatches){this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches);this._onUpdateTextLayerMatches=null}}},{key:"setTextContentStream",value:function setTextContentStream(t){this.cancel();this.textContentStream=t}},{key:"setTextContent",value:function setTextContent(t){this.cancel();this.textContent=t}},{key:"_convertMatches",value:function _convertMatches(t,r,a){if(!t)return[];for(var i=this.textContentItemsStr,o=0,l=0,u=i.length-1,c=[],d=0,h=t.length;d<h;d++){for(var p=t[d];o!==u&&p>=l+i[o].length;){l+=i[o].length;o++}o===i.length&&console.error("Could not find a matching mapping");var m={color:a?a[d]:0,begin:{divIdx:o,offset:p-l}};p+=r[d];for(;o!==u&&p>l+i[o].length;){l+=i[o].length;o++}m.end={divIdx:o,offset:p-l};c.push(m)}return c}},{key:"_renderMatches",value:function _renderMatches(t){if(0!==t.length){var r=this.findController,a=this.pageIdx,i=this.textContentItemsStr,o=this.textDivs,l=a===r.selected.pageIdx,u=r.selected.matchIdx,c=null,d={divIdx:-1,offset:void 0},h=u,p=h+1;if(r.state.highlightAll){h=0;p=t.length}else if(!l)return;for(var m=h;m<p;m++){var g=t[m],v=g.begin,y=g.end,b=l&&m===u,S=(b?" selected":"")+" color"+g.color,w=0;if(c&&v.divIdx===c.divIdx)appendTextToDiv(c.divIdx,c.offset,v.offset);else{null!==c&&appendTextToDiv(c.divIdx,c.offset,d.offset);beginText(v)}if(v.divIdx===y.divIdx)w=appendTextToDiv(v.divIdx,v.offset,y.offset,"highlight"+S);else{w=appendTextToDiv(v.divIdx,v.offset,d.offset,"highlight begin"+S);for(var C=v.divIdx+1,P=y.divIdx;C<P;C++)o[C].className="highlight middle"+S;beginText(y,"highlight end"+S)}c=y;b&&r.scrollMatchIntoView({element:o[v.divIdx],selectedLeft:w,pageIndex:a,matchIndex:u})}c&&appendTextToDiv(c.divIdx,c.offset,d.offset)}function beginText(t,r){var a=t.divIdx;o[a].textContent="";return appendTextToDiv(a,0,t.offset,r)}function appendTextToDiv(t,r,a,l){var u=o[t],c=i[t].substring(r,a),d=document.createTextNode(c);if(l){var h=document.createElement("span");h.className="".concat(l," appended");h.appendChild(d);u.appendChild(h);return l.includes("selected")?h.offsetLeft:0}u.appendChild(d);return 0}}},{key:"_updateMatches",value:function _updateMatches(){if(this.renderingDone){for(var t=this.findController,r=this.matches,a=this.pageIdx,i=this.textContentItemsStr,o=this.textDivs,l=-1,u=0,c=r.length;u<c;u++){for(var d=r[u],h=Math.max(l,d.begin.divIdx),p=d.end.divIdx;h<=p;h++){var m=o[h];m.textContent=i[h];m.className=""}l=d.end.divIdx+1}if(null!=t&&t.highlightMatches){var g=t.pageMatches[a]||null,v=t.pageMatchesLength[a]||null,y=t.pageMatchesColor[a]||null;this.matches=this._convertMatches(g,v,y);this._renderMatches(this.matches)}}}},{key:"_bindMouse",value:function _bindMouse(){var t=this,r=this.textLayerDiv,a=null;r.addEventListener("mousedown",(function(i){if(t.enhanceTextSelection&&t.textLayerRenderTask){t.textLayerRenderTask.expandTextDivs(!0);if(a){clearTimeout(a);a=null}}else{var o=r.querySelector(".endOfContent");if(o){var l=i.target!==r;if(l=l&&"none"!==window.getComputedStyle(o).getPropertyValue("-moz-user-select")){var u=r.getBoundingClientRect(),c=Math.max(0,(i.pageY-u.top)/u.height);o.style.top=(100*c).toFixed(2)+"%"}o.classList.add("active")}}}));r.addEventListener("mouseup",(function(){if(t.enhanceTextSelection&&t.textLayerRenderTask)a=setTimeout((function(){t.textLayerRenderTask&&t.textLayerRenderTask.expandTextDivs(!1);a=null}),300);else{var i=r.querySelector(".endOfContent");if(i){i.style.top="";i.classList.remove("active")}}}))}}]);return TextLayerBuilder}();r.TextLayerBuilder=o;var l=function(){function DefaultTextLayerFactory(){_classCallCheck(this,DefaultTextLayerFactory)}_createClass(DefaultTextLayerFactory,[{key:"createTextLayerBuilder",value:function createTextLayerBuilder(t,r,a){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4?arguments[4]:void 0;return new o({textLayerDiv:t,pageIndex:r,viewport:a,enhanceTextSelection:i,eventBus:l})}}]);return DefaultTextLayerFactory}();r.DefaultTextLayerFactory=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.XfaLayerBuilder=r.DefaultXfaLayerFactory=void 0;var i=a(7);function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}var o=function(){function XfaLayerBuilder(t){var r=t.pageDiv,a=t.pdfPage,i=t.xfaHtml,o=t.annotationStorage;_classCallCheck(this,XfaLayerBuilder);this.pageDiv=r;this.pdfPage=a;this.xfaHtml=i;this.annotationStorage=o;this.div=null;this._cancelled=!1}_createClass(XfaLayerBuilder,[{key:"render",value:function render(t){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"display";if("print"===a){var o={viewport:t.clone({dontFlip:!0}),div:this.div,xfa:this.xfaHtml,page:null,annotationStorage:this.annotationStorage,intent:a},l=document.createElement("div");this.pageDiv.appendChild(l);o.div=l;i.XfaLayer.render(o);return Promise.resolve()}return this.pdfPage.getXfa().then((function(o){if(!r._cancelled){var l={viewport:t.clone({dontFlip:!0}),div:r.div,xfa:o,page:r.pdfPage,annotationStorage:r.annotationStorage,intent:a};if(r.div)i.XfaLayer.update(l);else{r.div=document.createElement("div");r.pageDiv.appendChild(r.div);l.div=r.div;i.XfaLayer.render(l)}}})).catch((function(t){console.error(t)}))}},{key:"cancel",value:function cancel(){this._cancelled=!0}},{key:"hide",value:function hide(){this.div&&(this.div.hidden=!0)}}]);return XfaLayerBuilder}();r.XfaLayerBuilder=o;var l=function(){function DefaultXfaLayerFactory(){_classCallCheck(this,DefaultXfaLayerFactory)}_createClass(DefaultXfaLayerFactory,[{key:"createXfaLayerBuilder",value:function createXfaLayerBuilder(t,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return new o({pageDiv:t,pdfPage:r,annotationStorage:a,xfaHtml:i})}}]);return DefaultXfaLayerFactory}();r.DefaultXfaLayerFactory=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.SecondaryToolbar=void 0;var i=a(6),o=a(8),l=a(155);function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var u=function(){function SecondaryToolbar(t,r,a){var u=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,SecondaryToolbar);this.toolbar=t.toolbar;this.toggleButton=t.toggleButton;this.toolbarButtonContainer=t.toolbarButtonContainer;this.buttons=[{element:t.presentationModeButton,eventName:"presentationmode",close:!0},{element:t.openFileButton,eventName:"openfile",close:!0},{element:t.printButton,eventName:"print",close:!0},{element:t.downloadButton,eventName:"download",close:!0},{element:t.viewBookmarkButton,eventName:null,close:!0},{element:t.firstPageButton,eventName:"firstpage",close:!0},{element:t.lastPageButton,eventName:"lastpage",close:!0},{element:t.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:t.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:t.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:o.CursorTool.SELECT},close:!0},{element:t.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:o.CursorTool.HAND},close:!0},{element:t.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:i.ScrollMode.VERTICAL},close:!0},{element:t.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:i.ScrollMode.HORIZONTAL},close:!0},{element:t.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:i.ScrollMode.WRAPPED},close:!0},{element:t.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:i.SpreadMode.NONE},close:!0},{element:t.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:i.SpreadMode.ODD},close:!0},{element:t.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:i.SpreadMode.EVEN},close:!0},{element:t.documentPropertiesButton,eventName:"documentproperties",close:!0}];this.items={firstPage:t.firstPageButton,lastPage:t.lastPageButton,pageRotateCw:t.pageRotateCwButton,pageRotateCcw:t.pageRotateCcwButton};this.mainContainer=r;this.eventBus=a;this.opened=!1;this.containerHeight=null;this.previousContainerHeight=null;this.reset();this._bindClickListeners();this._bindCursorToolsListener(t);this._bindScrollModeListener(t);this._bindSpreadModeListener(t);this.eventBus._on("resize",this._setMaxHeight.bind(this));this.eventBus._on("baseviewerinit",(function(t){t.source instanceof l.PDFSinglePageViewer?u.toolbarButtonContainer.classList.add("hiddenScrollModeButtons","hiddenSpreadModeButtons"):u.toolbarButtonContainer.classList.remove("hiddenScrollModeButtons","hiddenSpreadModeButtons")}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(SecondaryToolbar,[{key:"isOpen",get:function get(){return this.opened}},{key:"setPageNumber",value:function setPageNumber(t){this.pageNumber=t;this._updateUIState()}},{key:"setPagesCount",value:function setPagesCount(t){this.pagesCount=t;this._updateUIState()}},{key:"reset",value:function reset(){this.pageNumber=0;this.pagesCount=0;this._updateUIState();this.eventBus.dispatch("secondarytoolbarreset",{source:this})}},{key:"_updateUIState",value:function _updateUIState(){this.items.firstPage.disabled=this.pageNumber<=1;document.getElementById("previousPage")&&(document.getElementById("previousPage").disabled=this.pageNumber<=1);this.items.lastPage.disabled=this.pageNumber>=this.pagesCount;document.getElementById("nextPage")&&(document.getElementById("nextPage").disabled=this.pageNumber>=this.pagesCount);this.items.pageRotateCw.disabled=0===this.pagesCount;this.items.pageRotateCcw.disabled=0===this.pagesCount;this.eventBus.dispatch("updateuistate",{source:this,widget:"SecondaryToolbar",pageNumber:this.pageNumber,pagesCount:this.pagesCount})}},{key:"_bindClickListeners",value:function _bindClickListeners(){var t=this;this.toggleButton.addEventListener("click",this.toggle.bind(this));var r,a=_createForOfIteratorHelper(this.buttons);try{var i=function _loop(){var a=r.value,i=a.element,o=a.eventName,l=a.close,u=a.eventDetails;i.addEventListener("click",(function(r){if(null!==o){var a={source:t};for(var i in u)a[i]=u[i];t.eventBus.dispatch(o,a)}l&&t.close()}))};for(a.s();!(r=a.n()).done;)i()}catch(t){a.e(t)}finally{a.f()}}},{key:"_bindCursorToolsListener",value:function _bindCursorToolsListener(t){this.eventBus._on("cursortoolchanged",(function(r){var a=r.tool;t.cursorSelectToolButton.classList.toggle("toggled",a===o.CursorTool.SELECT);t.cursorHandToolButton.classList.toggle("toggled",a===o.CursorTool.HAND)}))}},{key:"_bindScrollModeListener",value:function _bindScrollModeListener(t){var r=this;function scrollModeChanged(r){var a=r.mode;t.scrollVerticalButton.classList.toggle("toggled",a===i.ScrollMode.VERTICAL);t.scrollHorizontalButton.classList.toggle("toggled",a===i.ScrollMode.HORIZONTAL);t.scrollWrappedButton.classList.toggle("toggled",a===i.ScrollMode.WRAPPED);var o=a===i.ScrollMode.HORIZONTAL;t.spreadNoneButton.disabled=o;t.spreadOddButton.disabled=o;t.spreadEvenButton.disabled=o}this.eventBus._on("scrollmodechanged",scrollModeChanged);this.eventBus._on("secondarytoolbarreset",(function(t){t.source===r&&scrollModeChanged({mode:i.ScrollMode.VERTICAL})}))}},{key:"_bindSpreadModeListener",value:function _bindSpreadModeListener(t){var r=this;function spreadModeChanged(r){var a=r.mode;t.spreadNoneButton.classList.toggle("toggled",a===i.SpreadMode.NONE);t.spreadOddButton.classList.toggle("toggled",a===i.SpreadMode.ODD);t.spreadEvenButton.classList.toggle("toggled",a===i.SpreadMode.EVEN)}this.eventBus._on("spreadmodechanged",spreadModeChanged);this.eventBus._on("secondarytoolbarreset",(function(t){t.source===r&&spreadModeChanged({mode:i.SpreadMode.NONE})}))}},{key:"open",value:function open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.toolbar.classList.remove("hidden")}}},{key:"close",value:function close(){if(this.opened){this.opened=!1;this.toolbar.classList.add("hidden");this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false")}}},{key:"toggle",value:function toggle(){this.opened?this.close():this.open()}},{key:"_setMaxHeight",value:function _setMaxHeight(){if(this.opened){this.containerHeight=this.mainContainer.clientHeight;if(this.containerHeight!==this.previousContainerHeight){this.toolbarButtonContainer.style.maxHeight="".concat(this.containerHeight-i.SCROLLBAR_PADDING,"px");this.previousContainerHeight=this.containerHeight}}}}]);return SecondaryToolbar}();r.SecondaryToolbar=u},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.PDFSinglePageViewer=void 0;var i=a(32),o=a(7);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _get(t,r,a){_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,r,a){var i=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=_getPrototypeOf(t)););return t}(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(a):o.value}};return _get(t,r,a||t)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}var l=function(t){!function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}(PDFSinglePageViewer,t);var r=_createSuper(PDFSinglePageViewer);function PDFSinglePageViewer(t){var a;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,PDFSinglePageViewer);(a=r.call(this,t)).eventBus._on("pagesinit",(function(t){a._ensurePageViewVisible()}));return a}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(PDFSinglePageViewer,[{key:"_viewerElement",get:function get(){return(0,o.shadow)(this,"_viewerElement",this._shadowViewer)}},{key:"_pageWidthScaleFactor",get:function get(){return 1}},{key:"_resetView",value:function _resetView(){_get(_getPrototypeOf(PDFSinglePageViewer.prototype),"_resetView",this).call(this);this._previousPageNumber=1;this._shadowViewer=document.createDocumentFragment();this._updateScrollDown=null}},{key:"_ensurePageViewVisible",value:function _ensurePageViewVisible(){var t=this._pages[this._currentPageNumber-1],r=this._pages[this._previousPageNumber-1],a=this.viewer.childNodes;switch(a.length){case 0:this.viewer.appendChild(t.div);break;case 1:if(a[0]!==r.div)throw new Error("_ensurePageViewVisible: Unexpected previously visible page.");if(t===r)break;this._shadowViewer.appendChild(r.div);this.viewer.appendChild(t.div);this.container.scrollTop=0;break;default:throw new Error("_ensurePageViewVisible: Only one page should be visible at a time.")}this._previousPageNumber=this._currentPageNumber}},{key:"_scrollUpdate",value:function _scrollUpdate(){this._updateScrollDown&&this._updateScrollDown();_get(_getPrototypeOf(PDFSinglePageViewer.prototype),"_scrollUpdate",this).call(this)}},{key:"_scrollIntoView",value:function _scrollIntoView(t){var r=this,a=t.pageDiv,i=t.pageSpot,o=void 0===i?null:i,l=t.pageNumber,u=void 0===l?null:l;u&&this._setCurrentPageNumber(u);var c=this._currentPageNumber>=this._previousPageNumber;this._ensurePageViewVisible();this.update();_get(_getPrototypeOf(PDFSinglePageViewer.prototype),"_scrollIntoView",this).call(this,{pageDiv:a,pageSpot:o,pageNumber:u});this._updateScrollDown=function(){r.scroll.down=c;r._updateScrollDown=null}}},{key:"_getVisiblePages",value:function _getVisiblePages(){return this._getCurrentVisiblePage()}},{key:"_updateHelper",value:function _updateHelper(t){}},{key:"_isScrollModeHorizontal",get:function get(){return(0,o.shadow)(this,"_isScrollModeHorizontal",!1)}},{key:"_updateScrollMode",value:function _updateScrollMode(){}},{key:"_updateSpreadMode",value:function _updateSpreadMode(){}},{key:"_getPageAdvance",value:function _getPageAdvance(){return 1}}]);return PDFSinglePageViewer}(i.BaseViewer);r.PDFSinglePageViewer=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Toolbar=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(6);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var l="visiblePageIsLoading",u=function(){function Toolbar(t,r,a){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,Toolbar);this.toolbar=t.container;this.eventBus=r;this.l10n=a;this.buttons=[{element:t.previous,eventName:"previouspage"},{element:t.next,eventName:"nextpage"},{element:t.zoomIn,eventName:"zoomin"},{element:t.zoomOut,eventName:"zoomout"},{element:t.openFile,eventName:"openfile"},{element:t.print,eventName:"print"},{element:t.presentationModeButton,eventName:"presentationmode"},{element:t.download,eventName:"download"},{element:t.viewBookmark,eventName:null}];this.items={numPages:t.numPages,pageNumber:t.pageNumber,scaleSelectContainer:t.scaleSelectContainer,scaleSelect:t.scaleSelect,customScaleOption:t.customScaleOption,previous:t.previous,next:t.next,zoomIn:t.zoomIn,zoomOut:t.zoomOut};this._wasLocalized=!1;this.reset();this._bindListeners()}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(Toolbar,[{key:"setPageNumber",value:function setPageNumber(t,r){this.pageNumber=t;this.pageLabel=r;this._updateUIState(!1)}},{key:"setPagesCount",value:function setPagesCount(t,r){this.pagesCount=t;this.hasPageLabels=r;this._updateUIState(!0)}},{key:"setPageScale",value:function setPageScale(t,r){this.pageScaleValue=(t||r).toString();this.pageScale=r;this._updateUIState(!1)}},{key:"reset",value:function reset(){this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;var t=PDFViewerApplicationOptions.get("defaultZoomValue");if(t){this.pageScaleValue=t;Number(t)&&(this.pageScale=Number(t))}else{this.pageScaleValue=o.DEFAULT_SCALE_VALUE;this.pageScale=o.DEFAULT_SCALE}this._updateUIState(!0);this.updateLoadingIndicatorState()}},{key:"_bindListeners",value:function _bindListeners(){var t,r=this,a=this.items,i=a.pageNumber,l=a.scaleSelect,u=this,c=_createForOfIteratorHelper(this.buttons);try{var d=function _loop(){var a=t.value,i=a.element,o=a.eventName;i.addEventListener("click",(function(t){null!==o&&r.eventBus.dispatch(o,{source:r})}))};for(c.s();!(t=c.n()).done;)d()}catch(t){c.e(t)}finally{c.f()}i.addEventListener("click",(function(){this.select()}));i.addEventListener("change",(function(){u.eventBus.dispatch("pagenumberchanged",{source:u,value:this.value})}));l.addEventListener("change",(function(){"custom"!==this.value&&u.eventBus.dispatch("scalechanged",{source:u,value:this.value})}));l.addEventListener("click",(function(t){var r=t.target;this.value===u.pageScaleValue&&"OPTION"===r.tagName.toUpperCase()&&this.blur()}));l.oncontextmenu=o.noContextMenuHandler;this.eventBus._on("localized",(function(){r._wasLocalized=!0;r._updateUIState(!0)}))}},{key:"_updateUIState",value:function _updateUIState(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._wasLocalized){var r=this.pageNumber,a=this.pagesCount,i=this.pageScaleValue,l=this.pageScale,u=this.items;if(t){if(this.hasPageLabels)u.pageNumber.type="text";else{u.pageNumber.type="number";this.l10n.get("of_pages",{pagesCount:a}).then((function(t){u.numPages.textContent=t}))}u.pageNumber.max=a}if(this.hasPageLabels){u.pageNumber.value=this.pageLabel;this.l10n.get("page_of_pages",{pageNumber:r,pagesCount:a}).then((function(t){u.numPages.textContent=t}))}else u.pageNumber.value=r;u.previous.disabled=r<=1;u.next.disabled=r>=a;u.zoomOut.disabled=l<=o.MIN_SCALE;u.zoomIn.disabled=l>=o.MAX_SCALE;this.l10n.get("page_scale_percent",{scale:Math.round(1e4*l)/100}).then((function(t){var r,a=!1,o=_createForOfIteratorHelper(u.scaleSelect.options);try{for(o.s();!(r=o.n()).done;){var l=r.value;if(l.value===i){l.selected=!0;a=!0}else l.selected=!1}}catch(t){o.e(t)}finally{o.f()}if(!a){u.customScaleOption.textContent=t;u.customScaleOption.selected=!0}}));this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:r,pagesCount:a,pageScaleValue:i,pageScale:l})}}},{key:"updateLoadingIndicatorState",value:function updateLoadingIndicatorState(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.items.pageNumber;r.classList.toggle(l,t)}},{key:"_adjustScaleWidth",value:(t=function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}(i.default.mark((function _callee(){var t,r,a,l,u,c,d,h,p,m,g,v,y,b;return i.default.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:t=this.items,r=this.l10n;a=Promise.all([r.get("page_scale_auto"),r.get("page_scale_actual"),r.get("page_scale_fit"),r.get("page_scale_width")]);(l=document.createElement("canvas")).mozOpaque=!0;u=l.getContext("2d",{alpha:!1});i.next=7;return o.animationStarted;case 7:c=getComputedStyle(t.scaleSelect),d=c.fontSize,h=c.fontFamily;u.font="".concat(d," ").concat(h);p=0;i.t0=_createForOfIteratorHelper;i.next=13;return a;case 13:i.t1=i.sent;m=(0,i.t0)(i.t1);try{for(m.s();!(g=m.n()).done;){v=g.value;try{y=u.measureText(v);(b=y.width)>p&&(p=b)}catch(t){}}}catch(t){m.e(t)}finally{m.f()}if((p+=44)>140){t.scaleSelect.style.width="".concat(p+22,"px");t.scaleSelectContainer.style.width="".concat(p,"px")}l.width=0;l.height=0;l=u=null;case 22:case"end":return i.stop()}}),_callee,this)}))),function _adjustScaleWidth(){return t.apply(this,arguments)})}]);var t;return Toolbar}();r.Toolbar=u},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ViewHistory=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4));function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function ViewHistory(t){var r=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;_classCallCheck(this,ViewHistory);this.fingerprint=t;this.cacheSize=a;this._initializedPromise=this._readFromStorage().then((function(t){var a=JSON.parse(t||"{}"),i=-1;if(Array.isArray(a.files)){for(;a.files.length>=r.cacheSize;)a.files.shift();for(var o=0,l=a.files.length;o<l;o++){if(a.files[o].fingerprint===r.fingerprint){i=o;break}}}else a.files=[];-1===i&&(i=a.files.push({fingerprint:r.fingerprint})-1);r.file=a.files[i];r.database=a}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(ViewHistory,[{key:"_writeToStorage",value:(u=_asyncToGenerator(i.default.mark((function _callee(){var t;return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:t=JSON.stringify(this.database);localStorage.setItem("pdfjs.history",t);case 2:case"end":return r.stop()}}),_callee,this)}))),function _writeToStorage(){return u.apply(this,arguments)})},{key:"_readFromStorage",value:(l=_asyncToGenerator(i.default.mark((function _callee2(){return i.default.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",localStorage.getItem("pdfjs.history"));case 1:case"end":return t.stop()}}),_callee2)}))),function _readFromStorage(){return l.apply(this,arguments)})},{key:"set",value:(o=_asyncToGenerator(i.default.mark((function _callee3(t,r){return i.default.wrap((function _callee3$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._initializedPromise;case 2:this.file[t]=r;return a.abrupt("return",this._writeToStorage());case 4:case"end":return a.stop()}}),_callee3,this)}))),function set(t,r){return o.apply(this,arguments)})},{key:"setMultiple",value:(a=_asyncToGenerator(i.default.mark((function _callee4(t){var r;return i.default.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._initializedPromise;case 2:for(r in t)this.file[r]=t[r];return a.abrupt("return",this._writeToStorage());case 4:case"end":return a.stop()}}),_callee4,this)}))),function setMultiple(t){return a.apply(this,arguments)})},{key:"get",value:(r=_asyncToGenerator(i.default.mark((function _callee5(t,r){var a;return i.default.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._initializedPromise;case 2:a=this.file[t];return i.abrupt("return",void 0!==a?a:r);case 4:case"end":return i.stop()}}),_callee5,this)}))),function get(t,a){return r.apply(this,arguments)})},{key:"getMultiple",value:(t=_asyncToGenerator(i.default.mark((function _callee6(t){var r,a,o;return i.default.wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._initializedPromise;case 2:r=Object.create(null);for(a in t){o=this.file[a];r[a]=void 0!==o?o:t[a]}return i.abrupt("return",r);case 5:case"end":return i.stop()}}),_callee6,this)}))),function getMultiple(r){return t.apply(this,arguments)})}]);var t,r,a,o,l,u;return ViewHistory}();r.ViewHistory=o},(t,r,a)=>{"use strict";function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}Object.defineProperty(r,"__esModule",{value:!0});r.GenericCom=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(3),l=a(159),u=a(160),c=a(161),d=a(163);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}});r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){t.__proto__=r;return t};return _setPrototypeOf(t,r)}function _createSuper(t){var r=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}();return function _createSuperInternal(){var a,i=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;a=Reflect.construct(i,arguments,o)}else a=i.apply(this,arguments);return _possibleConstructorReturn(this,a)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function _getPrototypeOf(t){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)};return _getPrototypeOf(t)}r.GenericCom={};var h=function(t){_inherits(GenericPreferences,t);var r,a,o=_createSuper(GenericPreferences);function GenericPreferences(){_classCallCheck(this,GenericPreferences);return o.apply(this,arguments)}_createClass(GenericPreferences,[{key:"_writeToStorage",value:(a=_asyncToGenerator(i.default.mark((function _callee(t){return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:localStorage.setItem("pdfjs.preferences",JSON.stringify(t));case 1:case"end":return r.stop()}}),_callee)}))),function _writeToStorage(t){return a.apply(this,arguments)})},{key:"_readFromStorage",value:(r=_asyncToGenerator(i.default.mark((function _callee2(t){return i.default.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",JSON.parse(localStorage.getItem("pdfjs.preferences")));case 1:case"end":return t.stop()}}),_callee2)}))),function _readFromStorage(t){return r.apply(this,arguments)})}]);return GenericPreferences}(l.BasePreferences),p=function(t){_inherits(GenericExternalServices,t);var r=_createSuper(GenericExternalServices);function GenericExternalServices(){_classCallCheck(this,GenericExternalServices);return r.apply(this,arguments)}_createClass(GenericExternalServices,null,[{key:"createDownloadManager",value:function createDownloadManager(t){return new u.DownloadManager}},{key:"createPreferences",value:function createPreferences(){return new h}},{key:"createL10n",value:function createL10n(t){var r=t.locale,a=void 0===r?"en-US":r;return new c.GenericL10n(a)}},{key:"createScripting",value:function createScripting(t){var r=t.sandboxBundleSrc;return new d.GenericScripting(r)}}]);return GenericExternalServices}(o.DefaultExternalServices);o.PDFViewerApplication.externalServices=p},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.BasePreferences=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4));a(1);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _typeof(t){_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var o=function(){function BasePreferences(){var t=this;!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,BasePreferences);if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");Object.defineProperty(this,"defaults",{value:Object.freeze({cursorToolOnLoad:0,defaultZoomValue:"",disablePageLabels:!1,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!0,externalLinkTarget:0,historyUpdateUrl:!1,ignoreDestinationZoom:!1,pdfBugEnabled:!1,removePageBorders:!1,renderer:"canvas",renderInteractiveForms:!0,sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,useOnlyCssZoom:!1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableXfa:!1}),writable:!1,enumerable:!0,configurable:!1});this.prefs=Object.create(null);this._initializedPromise=this._readFromStorage(this.defaults).then((function(r){for(var a in t.defaults){var i=null==r?void 0:r[a];_typeof(i)===_typeof(t.defaults[a])&&(t.prefs[a]=i)}}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(BasePreferences,[{key:"_writeToStorage",value:(u=_asyncToGenerator(i.default.mark((function _callee(t){return i.default.wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:throw new Error("Not implemented: _writeToStorage");case 1:case"end":return t.stop()}}),_callee)}))),function _writeToStorage(t){return u.apply(this,arguments)})},{key:"_readFromStorage",value:(l=_asyncToGenerator(i.default.mark((function _callee2(t){return i.default.wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:throw new Error("Not implemented: _readFromStorage");case 1:case"end":return t.stop()}}),_callee2)}))),function _readFromStorage(t){return l.apply(this,arguments)})},{key:"reset",value:(o=_asyncToGenerator(i.default.mark((function _callee3(){return i.default.wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:t.next=2;return this._initializedPromise;case 2:this.prefs=Object.create(null);return t.abrupt("return",this._writeToStorage(this.defaults));case 4:case"end":return t.stop()}}),_callee3,this)}))),function reset(){return o.apply(this,arguments)})},{key:"set",value:(a=_asyncToGenerator(i.default.mark((function _callee4(t,r){var a,o,l;return i.default.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._initializedPromise;case 2:if(void 0!==(a=this.defaults[t])){i.next=7;break}throw new Error('Set preference: "'.concat(t,'" is undefined.'));case 7:if(void 0!==r){i.next=9;break}throw new Error("Set preference: no value is specified.");case 9:o=_typeof(r);l=_typeof(a);if(o===l){i.next=19;break}if("number"!==o||"string"!==l){i.next=16;break}r=r.toString();i.next=17;break;case 16:throw new Error('Set preference: "'.concat(r,'" is a ').concat(o,", expected a ").concat(l,"."));case 17:i.next=21;break;case 19:if("number"!==o||Number.isInteger(r)){i.next=21;break}throw new Error('Set preference: "'.concat(r,'" must be an integer.'));case 21:this.prefs[t]=r;return i.abrupt("return",this._writeToStorage(this.prefs));case 23:case"end":return i.stop()}}),_callee4,this)}))),function set(t,r){return a.apply(this,arguments)})},{key:"get",value:(r=_asyncToGenerator(i.default.mark((function _callee5(t){var r,a;return i.default.wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._initializedPromise;case 2:r=this.defaults[t],a=this.prefs[t];if(void 0!==r){i.next=5;break}throw new Error('Get preference: "'.concat(t,'" is undefined.'));case 5:return i.abrupt("return",void 0!==a?a:r);case 6:case"end":return i.stop()}}),_callee5,this)}))),function get(t){return r.apply(this,arguments)})},{key:"getAll",value:(t=_asyncToGenerator(i.default.mark((function _callee6(){var t,r,a;return i.default.wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:i.next=2;return this._initializedPromise;case 2:t=Object.create(null);for(r in this.defaults){a=this.prefs[r];t[r]=void 0!==a?a:this.defaults[r]}return i.abrupt("return",t);case 5:case"end":return i.stop()}}),_callee6,this)}))),function getAll(){return t.apply(this,arguments)})}]);var t,r,a,o,l,u;return BasePreferences}();r.BasePreferences=o},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.DownloadManager=void 0;var i=a(7),o=a(2);function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function _download(t,r){var a=document.createElement("a");if(!a.click)throw new Error('DownloadManager: "a.click()" is not supported.');a.href=t;a.target="_parent";"download"in a&&(a.download=r);(document.body||document.documentElement).appendChild(a);a.click();a.remove()}var l=function(){function DownloadManager(){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,DownloadManager);this._openBlobUrls=new WeakMap}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(DownloadManager,[{key:"downloadUrl",value:function downloadUrl(t,r){(0,i.createValidAbsoluteUrl)(t,"http://example.com")&&_download(t+"#pdfjs.action=download",r)}},{key:"downloadData",value:function downloadData(t,r,a){_download((0,i.createObjectURL)(t,a,o.viewerCompatibilityParams.disableCreateObjectURL),r)}},{key:"openOrDownloadData",value:function openOrDownloadData(t,r,a){var l=(0,i.isPdfFile)(a),u=l?"application/pdf":"";if(l&&!o.viewerCompatibilityParams.disableCreateObjectURL){var c,d=this._openBlobUrls.get(t);if(!d){d=URL.createObjectURL(new Blob([r],{type:u}));this._openBlobUrls.set(t,d)}c="?file="+encodeURIComponent(d+"#"+a);try{window.open(c);return!0}catch(r){console.error("openOrDownloadData: ".concat(r));URL.revokeObjectURL(d);this._openBlobUrls.delete(t)}}this.downloadData(r,a,u);return!1}},{key:"download",value:function download(t,r,a){if(o.viewerCompatibilityParams.disableCreateObjectURL&&r)this.downloadUrl(r,a);else{var i=URL.createObjectURL(t);_download(i,a)}}}]);return DownloadManager}();r.DownloadManager=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.GenericL10n=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4));a(162);var o=a(34);function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}var l=document.webL10n,u=function(){function GenericL10n(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,GenericL10n);this._lang=t;this._ready=new Promise((function(r,a){l.setLanguage((0,o.fixupLangCode)(t),(function(){r(l)}))}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(GenericL10n,[{key:"getLanguage",value:(u=_asyncToGenerator(i.default.mark((function _callee(){var t;return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:r.next=2;return this._ready;case 2:t=r.sent;return r.abrupt("return",t.getLanguage());case 4:case"end":return r.stop()}}),_callee,this)}))),function getLanguage(){return u.apply(this,arguments)})},{key:"getDirection",value:(a=_asyncToGenerator(i.default.mark((function _callee2(){var t;return i.default.wrap((function _callee2$(r){for(;;)switch(r.prev=r.next){case 0:r.next=2;return this._ready;case 2:t=r.sent;return r.abrupt("return",t.getDirection());case 4:case"end":return r.stop()}}),_callee2,this)}))),function getDirection(){return a.apply(this,arguments)})},{key:"get",value:(r=_asyncToGenerator(i.default.mark((function _callee3(t){var r,a,l,u=arguments;return i.default.wrap((function _callee3$(i){for(;;)switch(i.prev=i.next){case 0:r=u.length>1&&void 0!==u[1]?u[1]:null;a=u.length>2&&void 0!==u[2]?u[2]:(0,o.getL10nFallback)(t,r);i.next=4;return this._ready;case 4:l=i.sent;return i.abrupt("return",l.get(t,r,a));case 6:case"end":return i.stop()}}),_callee3,this)}))),function get(t){return r.apply(this,arguments)})},{key:"translate",value:(t=_asyncToGenerator(i.default.mark((function _callee4(t){var r;return i.default.wrap((function _callee4$(a){for(;;)switch(a.prev=a.next){case 0:a.next=2;return this._ready;case 2:r=a.sent;return a.abrupt("return",r.translate(t));case 4:case"end":return a.stop()}}),_callee4,this)}))),function translate(r){return t.apply(this,arguments)})}]);var t,r,a,u;return GenericL10n}();r.GenericL10n=u},()=>{"use strict";document.webL10n=function(t,r,a){var i={},o="",l="textContent",u="",c={},d="loading";function fireL10nReadyEvent(t){var a=r.createEvent("Event");a.initEvent("localized",!0,!1);a.language=t;r.dispatchEvent(a)}function xhrLoadText(t,r,a){r=r||function _onSuccess(t){};a=a||function _onFailure(){};var i=new XMLHttpRequest;i.open("GET",t,true);i.overrideMimeType&&i.overrideMimeType("text/plain; charset=utf-8");i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0===i.status?r(i.responseText):a())};i.onerror=a;i.ontimeout=a;try{i.send(null)}catch(t){a()}}function parseResource(r,a,u,c){var d=r.replace(/[^\/]*$/,"")||"./";function evalString(t){return t.lastIndexOf("\\")<0?t:t.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}xhrLoadText(r,(function(r){o+=r;!function parseProperties(r,i){var o={},l=/^\s*|\s*$/,u=/^\s*#|^\s*$/,c=/^\s*\[(.*)\]\s*$/,h=/^\s*@import\s+url\((.*)\)\s*$/i,p=/^([^=\s]*)\s*=\s*(.+)$/;function parseRawLines(t,r,i){var m=t.replace(l,"").split(/[\r\n]+/),g="*",v=a.split("-",1)[0],y=!1,b="",S=!1;!function nextEntry(){for(var t=void 0;;){if(!m.length&&t){S?nextEntry():loadImport(t,nextEntry);return}if(!m.length){i();return}var l=m.shift();if(!u.test(l)){if(r){if(b=c.exec(l)){g=b[1].toLowerCase();y="*"!==g&&g!==a&&g!==v;continue}if(y)continue;if(b=h.exec(l)){if("*"===g||g===a){loadImport(d+b[1],nextEntry);S=!0;return}t=d+b[1]}}var w=l.match(p);w&&3==w.length&&(o[w[1]]=evalString(w[2]))}}}()}function loadImport(r,a){xhrLoadText(r,(function(t){parseRawLines(t,!1,a)}),(function(){var i=t.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&console.warn(r+" not found.");a()}))}parseRawLines(r,!0,(function(){i(o)}))}(r,(function(t){for(var r in t){var a,o,c=r.lastIndexOf(".");if(c>0){a=r.substring(0,c);o=r.substring(c+1)}else{a=r;o=l}i[a]||(i[a]={});i[a][o]=t[r]}u&&u()}))}),c)}function loadLocale(a,l){var c=a;a&&(a=a.toLowerCase());l=l||function _callback(){};!function clear(){i={};o="";u=""}();u=a;var h=function getL10nResourceLinks(){return r.querySelectorAll('link[type="application/l10n"]')}(),p=h.length;if(0!==p){var m,g=0;m=function onResourceLoaded(){if(++g>=p){l();fireL10nReadyEvent(a);d="complete"}};for(var v=0;v<p;v++){new L10nResourceLink(h[v]).load(a,m)}}else{var y=function getL10nDictionary(){var t=r.querySelector('script[type="application/l10n"]');return t?JSON.parse(t.innerHTML):null}();if(y&&y.locales&&y.default_locale){console.log("The PDF viewer uses the pre-compiled language bundle stored in the HTML page.");if(!(i=y.locales[c])){var b=y.default_locale.toLowerCase();for(var S in y.locales){c=S;if((S=S.toLowerCase())===a){i=y.locales[c];break}S===b&&(i=y.locales[c])}}l()}else console.log("Could not load the translation files for the PDF viewer. Check the flag useBrowserLocale, check the locales subfolder of the assets folder, or add the locale definition to the index.html");fireL10nReadyEvent(a);d="complete"}function L10nResourceLink(r){var a=r.href;this.load=function(r,i){parseResource(a,r,i,(function(){var o=t.PDFViewerApplicationOptions;if(!o||o.get("verbosity")>0){console.warn(a+" not found.");console.warn('"'+r+'" resource not found')}u="";i()}))}}}c.plural=function(r,a,o,d){var h=parseFloat(a);if(isNaN(h))return r;if(d!=l)return r;c._pluralRules||(c._pluralRules=function getPluralRules(r){function isIn(t,r){return-1!==r.indexOf(t)}function isBetween(t,r,a){return r<=t&&t<=a}var a={0:function _(t){return"other"},1:function _(t){return isBetween(t%100,3,10)?"few":0===t?"zero":isBetween(t%100,11,99)?"many":2==t?"two":1==t?"one":"other"},2:function _(t){return 0!==t&&t%10==0?"many":2==t?"two":1==t?"one":"other"},3:function _(t){return 1==t?"one":"other"},4:function _(t){return isBetween(t,0,1)?"one":"other"},5:function _(t){return isBetween(t,0,2)&&2!=t?"one":"other"},6:function _(t){return 0===t?"zero":t%10==1&&t%100!=11?"one":"other"},7:function _(t){return 2==t?"two":1==t?"one":"other"},8:function _(t){return isBetween(t,3,6)?"few":isBetween(t,7,10)?"many":2==t?"two":1==t?"one":"other"},9:function _(t){return 0===t||1!=t&&isBetween(t%100,1,19)?"few":1==t?"one":"other"},10:function _(t){return isBetween(t%10,2,9)&&!isBetween(t%100,11,19)?"few":t%10!=1||isBetween(t%100,11,19)?"other":"one"},11:function _(t){return isBetween(t%10,2,4)&&!isBetween(t%100,12,14)?"few":t%10==0||isBetween(t%10,5,9)||isBetween(t%100,11,14)?"many":t%10==1&&t%100!=11?"one":"other"},12:function _(t){return isBetween(t,2,4)?"few":1==t?"one":"other"},13:function _(t){return isBetween(t%10,2,4)&&!isBetween(t%100,12,14)?"few":1!=t&&isBetween(t%10,0,1)||isBetween(t%10,5,9)||isBetween(t%100,12,14)?"many":1==t?"one":"other"},14:function _(t){return isBetween(t%100,3,4)?"few":t%100==2?"two":t%100==1?"one":"other"},15:function _(t){return 0===t||isBetween(t%100,2,10)?"few":isBetween(t%100,11,19)?"many":1==t?"one":"other"},16:function _(t){return t%10==1&&11!=t?"one":"other"},17:function _(t){return 3==t?"few":0===t?"zero":6==t?"many":2==t?"two":1==t?"one":"other"},18:function _(t){return 0===t?"zero":isBetween(t,0,2)&&0!==t&&2!=t?"one":"other"},19:function _(t){return isBetween(t,2,10)?"few":isBetween(t,0,1)?"one":"other"},20:function _(t){return!isBetween(t%10,3,4)&&t%10!=9||isBetween(t%100,10,19)||isBetween(t%100,70,79)||isBetween(t%100,90,99)?t%1e6==0&&0!==t?"many":t%10!=2||isIn(t%100,[12,72,92])?t%10!=1||isIn(t%100,[11,71,91])?"other":"one":"two":"few"},21:function _(t){return 0===t?"zero":1==t?"one":"other"},22:function _(t){return isBetween(t,0,1)||isBetween(t,11,99)?"one":"other"},23:function _(t){return isBetween(t%10,1,2)||t%20==0?"one":"other"},24:function _(t){return isBetween(t,3,10)||isBetween(t,13,19)?"few":isIn(t,[2,12])?"two":isIn(t,[1,11])?"one":"other"}},i={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[r.replace(/-.*$/,"")];if(!(i in a)){var o=t.PDFViewerApplicationOptions;(!o||o.get("verbosity")>0)&&console.warn("plural form unknown for ["+r+"]");return function(){return"other"}}return a[i]}(u));var p="["+c._pluralRules(h)+"]";0===h&&o+"[zero]"in i?r=i[o+"[zero]"][d]:1==h&&o+"[one]"in i?r=i[o+"[one]"][d]:2==h&&o+"[two]"in i?r=i[o+"[two]"][d]:o+p in i?r=i[o+p][d]:o+"[other]"in i&&(r=i[o+"[other]"][d]);return r};function getL10nData(r,a,o){var l=i[r];if(!l){var u=t.PDFViewerApplicationOptions;(!u||u.get("verbosity")>0)&&console.warn("Translation for the key #"+r+" is missing.");if(!o)return null;l=o}var c={};for(var d in l){var h=l[d];h=substArguments(h=substIndexes(h,a,r,d),a,r);c[d]=h}return c}function substIndexes(t,r,a,o){var l=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(t);if(!l||!l.length)return t;var u,d=l[1],h=l[2];r&&h in r?u=r[h]:h in i&&(u=i[h]);if(d in c){t=(0,c[d])(t,u,a,o)}return t}function substArguments(t,r,a){return t.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(t,o){if(r&&o in r)return r[o];if(o in i)return i[o];console.log("argument {{"+o+"}} for #"+a+" is undefined.");return t}))}function translateElement(a){var i=function getL10nAttributes(r){if(!r)return{};var a=r.getAttribute("data-l10n-id"),i=r.getAttribute("data-l10n-args"),o={};if(i)try{o=JSON.parse(i)}catch(r){var l=t.PDFViewerApplicationOptions;(!l||l.get("verbosity")>0)&&console.warn("could not parse arguments for #"+a)}return{id:a,args:o}}(a);if(i.id){var o=getL10nData(i.id,i.args);if(o){if(o[l]){if(0===function getChildElementCount(t){if(t.children)return t.children.length;if(void 0!==t.childElementCount)return t.childElementCount;for(var r=0,a=0;a<t.childNodes.length;a++)r+=1===t.nodeType?1:0;return r}(a))a[l]=o[l];else{for(var u=a.childNodes,c=!1,d=0,h=u.length;d<h;d++)if(3===u[d].nodeType&&/\S/.test(u[d].nodeValue))if(c)u[d].nodeValue="";else{u[d].nodeValue=o[l];c=!0}if(!c){var p=r.createTextNode(o[l]);a.insertBefore(p,a.firstChild)}}delete o[l]}for(var m in o)a[m]=o[m]}else{var g=t.PDFViewerApplicationOptions;(!g||g.get("verbosity")>0)&&console.warn("#"+i.id+" is undefined.")}}}return{get:function get(t,r,a){var i,o=t.lastIndexOf("."),u=l;if(o>0){u=t.substring(o+1);t=t.substring(0,o)}a&&((i={})[u]=a);var c=getL10nData(t,r,i);return c&&u in c?c[u]:"{{"+t+"}}"},getData:function getData(){return i},getText:function getText(){return o},getLanguage:function getLanguage(){return u},setLanguage:function setLanguage(t,r){loadLocale(t,(function(){r&&r()}))},getDirection:function getDirection(){var t=u.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(t)>=0?"rtl":"ltr"},translate:function translateFragment(t){for(var a=function getTranslatableChildren(t){return t?t.querySelectorAll("*[data-l10n-id]"):[]}(t=t||r.documentElement),i=a.length,o=0;o<i;o++)translateElement(a[o]);translateElement(t)},getReadyState:function getReadyState(){return d},ready:function ready(a){a&&("complete"==d||"interactive"==d?t.setTimeout((function(){a()})):r.addEventListener&&r.addEventListener("localized",(function once(){r.removeEventListener("localized",once);a()})))}}}(window,document)},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.docPropertiesLookup=function docPropertiesLookup(t){return _docPropertiesLookup.apply(this,arguments)};r.GenericScripting=void 0;var i=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(4)),o=a(7);function ownKeys(t,r){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})));a.push.apply(a,i)}return a}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(a),!0).forEach((function(r){_defineProperty(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(a,r))}))}return t}function _defineProperty(t,r,a){r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a;return t}function _defineProperties(t,r){for(var a=0;a<r.length;a++){var i=r[a];i.enumerable=i.enumerable||!1;i.configurable=!0;"value"in i&&(i.writable=!0);Object.defineProperty(t,i.key,i)}}function asyncGeneratorStep(t,r,a,i,o,l,u){try{var c=t[l](u),d=c.value}catch(t){a(t);return}c.done?r(d):Promise.resolve(d).then(i,o)}function _asyncToGenerator(t){return function(){var r=this,a=arguments;return new Promise((function(i,o){var l=t.apply(r,a);function _next(t){asyncGeneratorStep(l,i,o,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(l,i,o,_next,_throw,"throw",t)}_next(void 0)}))}}function _docPropertiesLookup(){return(_docPropertiesLookup=_asyncToGenerator(i.default.mark((function _callee4(t){var r,a,l,u,c,d,h,p,m;return i.default.wrap((function _callee4$(i){for(;;)switch(i.prev=i.next){case 0:a=(r="").split("#")[0];i.next=3;return t.getMetadata();case 3:l=i.sent;u=l.info;c=l.metadata;d=l.contentDispositionFilename;if(h=l.contentLength){i.next=14;break}i.next=11;return t.getDownloadInfo();case 11:p=i.sent;m=p.length;h=m;case 14:return i.abrupt("return",_objectSpread(_objectSpread({},u),{},{baseURL:a,filesize:h,filename:d||(0,o.getPdfFilenameFromUrl)(r),metadata:null==c?void 0:c.getRaw(),authors:null==c?void 0:c.get("dc:creator"),numPages:t.numPages,URL:r}));case 15:case"end":return i.stop()}}),_callee4)})))).apply(this,arguments)}var l=function(){function GenericScripting(t){!function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,GenericScripting);this._ready=(0,o.loadScript)(t,!0).then((function(){return window.pdfjsSandbox.QuickJSSandbox()}))}!function _createClass(t,r,a){r&&_defineProperties(t.prototype,r);a&&_defineProperties(t,a);return t}(GenericScripting,[{key:"createSandbox",value:(a=_asyncToGenerator(i.default.mark((function _callee(t){return i.default.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:r.next=2;return this._ready;case 2:r.sent.create(t);case 4:case"end":return r.stop()}}),_callee,this)}))),function createSandbox(t){return a.apply(this,arguments)})},{key:"dispatchEventInSandbox",value:(r=_asyncToGenerator(i.default.mark((function _callee2(t){return i.default.wrap((function _callee2$(r){for(;;)switch(r.prev=r.next){case 0:r.next=2;return this._ready;case 2:r.sent.dispatchEvent(t);case 4:case"end":return r.stop()}}),_callee2,this)}))),function dispatchEventInSandbox(t){return r.apply(this,arguments)})},{key:"destroySandbox",value:(t=_asyncToGenerator(i.default.mark((function _callee3(){return i.default.wrap((function _callee3$(t){for(;;)switch(t.prev=t.next){case 0:t.next=2;return this._ready;case 2:t.sent.nukeSandbox();case 4:case"end":return t.stop()}}),_callee3,this)}))),function destroySandbox(){return t.apply(this,arguments)})}]);var t,r,a;return GenericScripting}();r.GenericScripting=l},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.PDFPrintService=PDFPrintService;var i=a(3),o=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}(a(37)),l=a(165),u=a(2);var c=null,d=null;function renderPage(t,r,a,i,l,u){var d=c.scratchCanvas,h=l/72,p=1,m=Math.floor(i.width*h),g=Math.floor(i.height*h);if(m>=4096||g>=4096){if(!o.default.test({width:m,height:g})){var v=function determineMaxDimensions(){for(var t=0,r=[4096,8192,10836,11180,11402,14188,16384];t<r.length;t++){var a=r[t];if(!o.default.test({width:a+1,height:a+1}))return a}return 16384}();p=.95*Math.min(v/m,v/g)}warn("Page "+a+": Reduced the [printResolution] to "+Math.floor(l*p)+" because the browser can't render larger canvases. If you see blank page in the print preview, reduce [printResolution] manually to a lower value.")}h*=p;d.width=Math.floor(i.width*h);d.height=Math.floor(i.height*h);var y=d.getContext("2d");y.save();y.fillStyle="rgb(255, 255, 255)";y.fillRect(0,0,d.width,d.height);y.restore();return r.getPage(a).then((function(t){var r={canvasContext:y,transform:[h,0,0,h,0,0],viewport:t.getViewport({scale:1,rotation:i.rotation}),intent:"print",includeAnnotationStorage:!0,optionalContentConfigPromise:u,background:PDFViewerApplicationOptions.get("pdfBackgroundColor")};return t.render(r).promise}))}function PDFPrintService(t,r,a,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0;this.pdfDocument=t;this.pagesOverview=r;this.printContainer=a;this._printResolution=i||150;this._optionalContentConfigPromise=o||t.getOptionalContentConfig();this.l10n=l;this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=u}PDFPrintService.prototype={layout:function layout(){this.throwIfInactive();var t=document.querySelector("body");t.setAttribute("data-pdfjsprinting",!0);this.pagesOverview.every((function(t){return t.width===this.pagesOverview[0].width&&t.height===this.pagesOverview[0].height}),this)||console.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");var r=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+r.width+"pt "+r.height+"pt;}";t.appendChild(this.pageStyleSheet)},destroy:function destroy(){if(c===this){this.printContainer.textContent="";document.querySelector("body").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;c=null;ensureOverlay().then((function(){if("printServiceOverlay"===d.active){d.close("printServiceOverlay");d.unregister("printServiceOverlay")}}));h=void 0}},renderPages:function renderPages(){var t=this;if(this.pdfDocument.isPureXfa){(0,l.getXfaHtmlForPrinting)(this.printContainer,this.pdfDocument);return Promise.resolve()}var r=this.pagesOverview.length;return new Promise((function renderNextPage(a,i){t.throwIfInactive();for(;;){++t.currentPage;if(t.currentPage>=r)break;if(!window.isInPDFPrintRange||window.isInPDFPrintRange(t.currentPage))break}if(t.currentPage>=r){renderProgress(window.filteredPageCount|r,window.filteredPageCount|r,t.l10n,t.eventBus);a()}else{var o=t.currentPage;renderProgress(o,window.filteredPageCount|r,t.l10n,t.eventBus);renderPage(0,t.pdfDocument,o+1,t.pagesOverview[o],t._printResolution,t._optionalContentConfigPromise).then(t.useRenderedPage.bind(t)).then((function(){renderNextPage(a,i)}),i)}}))},useRenderedPage:function useRenderedPage(){this.throwIfInactive();var t=document.createElement("img"),r=this.scratchCanvas;"toBlob"in r&&!u.viewerCompatibilityParams.disableCreateObjectURL?r.toBlob((function(r){t.src=URL.createObjectURL(r)})):t.src=r.toDataURL();var a=document.createElement("div");a.className="printedPage";a.appendChild(t);this.printContainer.appendChild(a);return new Promise((function(r,a){t.onload=r;t.onerror=a}))},performPrint:function performPrint(){var t=this;this.throwIfInactive();return new Promise((function(r){setTimeout((function(){if(t.active){p.call(window);setTimeout(r,20)}else r()}),0)}))},get active(){return this===c},throwIfInactive:function throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};var h,p=window.print;window.printPDF=function(){if(i.PDFViewerApplication.enablePrint)if(c)console.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){c&&d.open("printServiceOverlay")}));try{dispatchEvent("beforeprint")}finally{if(!c){console.error("Expected print service to be initialized.");ensureOverlay().then((function(){"printServiceOverlay"===d.active&&d.close("printServiceOverlay")}));return}var t=c;c.renderPages().then((function(){var r=document.getElementById("printServiceOverlay");r&&r.classList.add("hidden");return t.performPrint()})).catch((function(){})).then((function(){t.active&&abort()}))}}};function dispatchEvent(t){var r=document.createEvent("CustomEvent");r.initCustomEvent(t,!1,!1,"custom");window.dispatchEvent(r)}function abort(){if(c){c.destroy();dispatchEvent("afterprint")}}function renderProgress(t,r,a,i){var o=document.getElementById("printServiceOverlay"),l=Math.round(100*t/r),u=o.querySelector("progress"),c=o.querySelector(".relative-progress");u.value=l;a.get("print_progress_percent",{progress:l}).then((function(t){c.textContent=t}));i.dispatch("progress",{source:this,type:"print",total:r,page:t,percent:100*t/r})}i.PDFViewerApplication.printKeyDownListener=function(t){if(80===t.keyCode&&(t.ctrlKey||t.metaKey)&&!t.altKey&&(!t.shiftKey||window.chrome||window.opera)){window.printPDF();t.preventDefault();t.stopImmediatePropagation?t.stopImmediatePropagation():t.stopPropagation()}};if("onbeforeprint"in window){var m=function stopPropagationIfNeeded(t){"custom"!==t.detail&&t.stopImmediatePropagation&&t.stopImmediatePropagation()};window.addEventListener("beforeprint",m);window.addEventListener("afterprint",m)}function ensureOverlay(){if(!h){if(!(d=i.PDFViewerApplication.overlayManager))throw new Error("The overlay manager has not yet been initialized.");h=d.register("printServiceOverlay",document.getElementById("printServiceOverlay"),abort,!0);document.getElementById("printCancel").onclick=abort}return h}i.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService:function createPrintService(t,r,a,i,o,l,u){if(c)throw new Error("The print service is created and active.");return c=new PDFPrintService(t,r,a,i,o,l,u)}}},(t,r,a)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.getXfaHtmlForPrinting=function getXfaHtmlForPrinting(t,r){var a,u=r.allXfaHtml,c=new o.DefaultXfaLayerFactory,d=Math.round(100*i.CSS_UNITS)/100,h=function _createForOfIteratorHelper(t,r){var a="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!a){if(Array.isArray(t)||(a=function _unsupportedIterableToArray(t,r){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,r);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return _arrayLikeToArray(t,r)}(t))||r&&t&&"number"==typeof t.length){a&&(t=a);var i=0,o=function F(){};return{s:o,n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function e(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,u=!0,c=!1;return{s:function s(){a=a.call(t)},n:function n(){var t=a.next();u=t.done;return t},e:function e(t){c=!0;l=t},f:function f(){try{u||null==a.return||a.return()}finally{if(c)throw l}}}}(u.children);try{for(h.s();!(a=h.n()).done;){var p=a.value,m=document.createElement("div");m.className="xfaPrintedPage";t.appendChild(m);var g=c.createXfaLayerBuilder(m,null,r.annotationStorage,p),v=(0,l.getXfaPageViewport)(p,{scale:d});g.render(v,"print")}}catch(t){h.e(t)}finally{h.f()}};var i=a(6),o=a(153),l=a(7);function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var a=0,i=new Array(r);a<r;a++)i[a]=t[a];return i}}],r={};function __webpack_require__(a){var i=r[a];if(void 0!==i)return i.exports;var o=r[a]={id:a,loaded:!1,exports:{}};t[a].call(o.exports,o,o.exports,__webpack_require__);o.loaded=!0;return o.exports}__webpack_require__.nmd=t=>{t.paths=[];t.children||(t.children=[]);return t};var a={};(()=>{"use strict";var t=a;Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"PDFViewerApplicationOptions",{enumerable:!0,get:function get(){return r.AppOptions}});Object.defineProperty(t,"PDFViewerApplication",{enumerable:!0,get:function get(){return i.PDFViewerApplication}});var r=__webpack_require__(1),i=__webpack_require__(3);window.PDFViewerApplication=i.PDFViewerApplication;window.PDFViewerApplicationOptions=r.AppOptions;HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(t,r){r=r||{bubbles:!1,cancelable:!1,detail:null};var a=document.createEvent("CustomEvent");a.initCustomEvent(t,r.bubbles,r.cancelable,r.detail);return a});__webpack_require__(158);__webpack_require__(164);document.blockUnblockOnload&&document.blockUnblockOnload(!0);window.webViewerLoad=function webViewerLoad(){var t=function getViewerConfiguration(){var t;t={container:document.getElementById("errorWrapper"),errorMessage:document.getElementById("errorMessage"),closeButton:document.getElementById("errorClose"),errorMoreInfo:document.getElementById("errorMoreInfo"),moreInfoButton:document.getElementById("errorShowMore"),lessInfoButton:document.getElementById("errorShowLess")};return{appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),eventBus:null,toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelectContainer:document.getElementById("scaleSelectContainer"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),openFile:document.getElementById("openFile"),print:document.getElementById("print"),presentationModeButton:document.getElementById("presentationMode"),download:document.getElementById("download"),viewBookmark:document.getElementById("viewBookmark")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),toolbarButtonContainer:document.getElementById("secondaryToolbarButtonContainer"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("secondaryViewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},sidebar:{outerContainer:document.getElementById("outerContainer"),viewerContainer:document.getElementById("viewerContainer"),toggleButton:document.getElementById("sidebarToggle"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),outlineOptionsContainer:document.getElementById("outlineOptionsContainer"),currentOutlineItemButton:document.getElementById("currentOutlineItem")},sidebarResizer:{outerContainer:document.getElementById("outerContainer"),resizer:document.getElementById("sidebarResizer")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),findFieldMultiline:document.getElementById("findInputMultiline"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),entireWordCheckbox:document.getElementById("findEntireWord"),findMultipleSearchTextsCheckbox:document.getElementById("findMultipleSearchTexts"),ignoreAccentsCheckbox:document.getElementById("findIgnoreAccents"),fuzzyCheckbox:document.getElementById("findFuzzy"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{overlayName:"passwordOverlay",container:document.getElementById("passwordOverlay"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{overlayName:"documentPropertiesOverlay",container:document.getElementById("documentPropertiesOverlay"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},errorWrapper:t,printContainer:document.getElementById("printContainer"),openFileInputName:"fileInput",debuggerScriptPath:"./debugger.js"}}(),r=document.createEvent("CustomEvent");r.initCustomEvent("webviewerloaded",!0,!0,{source:window});try{parent.document.dispatchEvent(r)}catch(t){console.error("webviewerloaded: ".concat(t));document.dispatchEvent(r)}i.PDFViewerApplication.run(t)}})()})();
//# sourceMappingURL=viewer-es5.min.js.map