@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
1 lines • 247 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.dspdfviewer=e():t.dspdfviewer=e()}(this,()=>(()=>{var t={1121:function(t,e){"use strict";var n=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}l((r=r.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.PromiseQueue=e.AsyncLock=e.createPromiseCapabilityWithTimeout=e.createPromiseCapability=void 0,e.createPromiseCapability=function(){var t={};return t.promise=new Promise(function(e,n){t.resolve=e,t.reject=n}),t},e.createPromiseCapabilityWithTimeout=function(t,e){void 0===t&&(t=-1),void 0===e&&(e="Timeout");var n={resolved:!1,rejected:!1,rejectTimeout:-1};return n.promise=new Promise(function(t,e){n.resolve=function(e){-1!==n.rejectTimeout&&(clearTimeout(n.rejectTimeout),n.rejectTimeout=-1),n.resolved=!0,t(e)},n.reject=function(t){-1!==n.rejectTimeout&&(clearTimeout(n.rejectTimeout),n.rejectTimeout=-1),n.rejected=!1,e(t)}}),t>0&&(n.rejectTimeout=setTimeout(function(){n.rejectTimeout=-1,n.resolved||n.rejected||n.reject(e)},t)),n};var i=function(){function t(){this._queue=[],this._isLocked=!1}return Object.defineProperty(t.prototype,"locked",{get:function(){return this._isLocked},enumerable:!1,configurable:!0}),t.prototype.lock=function(){return n(this,void 0,void 0,function(){var t=this;return r(this,function(e){return[2,new Promise(function(e){t._isLocked?t._queue.push(function(){e(),t._isLocked=!0}):(t._isLocked=!0,e())})]})})},t.prototype.unlock=function(){if(this._isLocked){var t=this._queue.shift();t?t():this._isLocked=!1}},t}();e.AsyncLock=i;var o=function(){function t(){this._queue=Promise.resolve(!0),this._queueId=0}return t.prototype.enqueue=function(t){var e=this;return t.___queueId||(t.___queueId=this._queueId),new Promise(function(i,o){t.___queueId===e._queueId&&(e._queue=e._queue.then(function(){return n(e,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return t.___queueId!==this._queueId?[2]:[4,t()];case 1:return e.sent(),[2]}})})}).then(i).catch(o))})},t.prototype.clear=function(){this._queueId++,isNaN(this._queueId)&&(this._queueId=0),this._queue=Promise.resolve(!0)},t}();e.PromiseQueue=o},4794:t=>{function e(t){return Promise.resolve().then(()=>{var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e})}e.keys=()=>[],e.resolve=e,e.id=4794,t.exports=e},10548:()=>{},27398:function(t,e){"use strict";var n=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};function r(t){var e=null;return t&&t.getRootNode&&(e=t.getRootNode()),e||(e=document),e}function i(t,e){return t&&(" "+t.className+" ").indexOf(" "+e+" ")>-1}function o(){var t=s().navigator,e=Number.isFinite(t.maxTouchPoints)?t.maxTouchPoints:t.msMaxTouchPoints;return Number.isFinite(e)?e>0&&256!==e:"ontouchstart"in window}function a(t,e){var n=document.createEvent("MouseEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function s(){try{if(window.top)try{if(window!==window.top)return window.top.navigator,window.top}catch(t){if(window.frameElement)try{if(window.parent&&window!==window.parent)return window.parent.navigator,window.parent}catch(t){}}}catch(t){}return window}Object.defineProperty(e,"__esModule",{value:!0}),e.resolveGlobalWindowOption=e.getSafeTopWindow=e.sanitizeHTML=e.triggerFullStackClick=e.triggerMouseEvent=e.reversePopupRotation=e.getEventCoordinates=e.isTouchEventsEnabled=e.findElementIndex=e.findSelfOrAncestorAttr=e.findSelfOrAncestor=e.classListContains=e.isInputArea=e.getEventTarget=e.isDescendant=e.closestShadowRootOrBody=e.getShadowRootOrDocument=void 0,e.getShadowRootOrDocument=r,e.closestShadowRootOrBody=function(t){var e=r(t);return e.body?e.body:e},e.isDescendant=function(t,e){for(var n=t.parentNode;n;){if(n===e)return!0;n=n.parentNode}return!1},e.getEventTarget=function(t){return(t.path||t.composedPath&&t.composedPath()||[])[0]||t.target},e.isInputArea=function(t){if(!t)return!1;for(var e="INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName;t&&!e&&(e=t.hasAttribute&&t.hasAttribute("contenteditable")&&"true"===t.getAttribute("contenteditable"),"SECTION"!==t.tagName&&"BODY"!==t.tagName&&"HTML"!==t.tagName);)t=t.parentNode;return e},e.classListContains=i,e.findSelfOrAncestor=function(t,e){if(t&&!i(t,e))for(;(t=t.parentNode)&&!i(t,e););return t},e.findSelfOrAncestorAttr=function(t,e){if(t&&(!t.hasAttribute||!t.hasAttribute(e)))for(;(t=t.parentNode)&&t&&(!t.hasAttribute||!t.hasAttribute(e)););return t},e.findElementIndex=function(t){return t&&t.parentNode?n([],Array.from(t.parentNode.children),!0).indexOf(t):-1},e.isTouchEventsEnabled=o,e.getEventCoordinates=function(t){if(o()&&t.touches&&t.touches.length>0){var e=t.touches[0];return{pageX:e.pageX||0,pageY:e.pageY||0,clientX:e.clientX||0,clientY:e.clientY||0}}return{pageX:t.pageX||0,pageY:t.pageY||0,clientX:t.clientX||0,clientY:t.clientY||0}},e.reversePopupRotation=function(t,e,n){if(360===e&&(e=0),t){if(!t.parentNode)return;if(e){var r=parseInt((t.style.left||"").toString().replace("px",""))||0,i=Math.round(r/2);t.style.transform="rotate(-"+e+"deg)";var o="left";switch(e){case 90:case 180:case 270:o="-"+i+"px -"+i+"px"}t.style.transformOrigin=o}else t.style.transform="",t.style.transformOrigin=""}n&&(n.style.transform=e?"rotate(-"+e+"deg)":"")},e.triggerMouseEvent=a,e.triggerFullStackClick=function(t){t&&(a(t,"mouseover"),a(t,"mousedown"),a(t,"mouseup"),a(t,"click"))},e.sanitizeHTML=function(t){return t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,"")},e.getSafeTopWindow=s,e.resolveGlobalWindowOption=function(t){if(Object.prototype.hasOwnProperty.call(window,t))return window[t];var e=s();return e!==window&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}},34401:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toCamelCase=e.htmlDecode=e.unicodeToChar=e.fasterBytesToBase64=e.base64ToBytes=e.bytesToBase64=e.base64ToUtf8=e.utf8ToBase64=void 0,e.unicodeToChar=function(t){return t.replace(/\\u[\dA-F]{4}/gi,function(t){return String.fromCharCode(parseInt(t.replace(/\\u/g,""),16))})},e.htmlDecode=function(t){var e;if(window.DOMParser){e=(new window.DOMParser).parseFromString(t,"text/html").documentElement.textContent||""}else{var n=document.createElement("textarea");n.innerHTML=t,e=(0===n.childNodes.length?"":n.childNodes[0].nodeValue)||""}return e=e.replace("","•")};var n=function(){for(var t=[],e="A".charCodeAt(0),n="a".charCodeAt(0),r="0".charCodeAt(0),i=0;i<26;++i)t.push(String.fromCharCode(e+i));for(i=0;i<26;++i)t.push(String.fromCharCode(n+i));for(i=0;i<10;++i)t.push(String.fromCharCode(r+i));return t.push("+"),t.push("/"),t}();e.fasterBytesToBase64=function(t){for(var e,n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(t),o=i.byteLength,a=o%3,s=o-a,l=0;l<s;l+=3)n+=r[(16515072&(e=i[l]<<16|i[l+1]<<8|i[l+2]))>>18]+r[(258048&e)>>12]+r[(4032&e)>>6]+r[63&e];return 1==a?n+=r[(252&(e=i[s]))>>2]+r[(3&e)<<4]+"==":2==a&&(n+=r[(64512&(e=i[s]<<8|i[s+1]))>>10]+r[(1008&e)>>4]+r[(15&e)<<2]+"="),n},e.bytesToBase64=function(t){var e,r="",i=t.length;for(e=2;e<i;e+=3)r+=n[t[e-2]>>2],r+=n[(3&t[e-2])<<4|t[e-1]>>4],r+=n[(15&t[e-1])<<2|t[e]>>6],r+=n[63&t[e]];return e===i+1&&(r+=n[t[e-2]>>2],r+=n[(3&t[e-2])<<4],r+="=="),e===i&&(r+=n[t[e-2]>>2],r+=n[(3&t[e-2])<<4|t[e-1]>>4],r+=n[(15&t[e-1])<<2],r+="="),r},e.base64ToBytes=function(t){for(var e=";base64,",n=t.indexOf(e),r=-1!==n?t.substring(n+8):t,i=window.atob(r),o=i.length,a=new Uint8Array(new ArrayBuffer(o)),s=0;s<o;s++)a[s]=i.charCodeAt(s);return a},e.utf8ToBase64=function(t){return window.btoa(unescape(encodeURIComponent(t)))},e.base64ToUtf8=function(t){return decodeURIComponent(escape(window.atob(t)))},e.toCamelCase=function(t){return void 0===t?"":t.toString().replace(/[-_]+(.)?/g,function(t,e){return e?e.toUpperCase():""}).replace(/^./,function(t){return t.toLowerCase()})}},36848:(t,e)=>{"use strict";function n(t,e,n){return void 0===n||0===+n?Math[t](e):(e=+e,n=+n,isNaN(e)||"number"!=typeof n||n%1!=0?NaN:(e=e.toString().split("e"),+((e=(e=Math[t](+(e[0]+"e"+(e[1]?+e[1]-n:-n)))).toString().split("e"))[0]+"e"+(e[1]?+e[1]+n:n))))}function r(t,e){return n("round",t,e)}function i(t){var e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}function o(t,e,n,i,o,a){void 0===a&&(a=!0);var s=a?Math.PI/180*o:o,l=Math.cos(s),c=Math.sin(s),u=l*(i-e)-c*(n-t)+e;return[r(l*(n-t)+c*(i-e)+t,-1),r(u,-1)]}function a(t,e,n,r){var i=Math.atan2(r-e,n-t)*(180/Math.PI);return i<0&&(i=360+i),i}function s(t,e,n,r){if(void 0===r&&(r=!0),!e){var a=Math.abs(t[2]-t[0]),s=Math.abs(t[3]-t[1]);e=[t[0]+a/2,t[1]+s/2]}var l=o(e[0],e[1],t[0],t[1],n,r),c=o(e[0],e[1],t[2],t[3],n,r);return i([l[0],l[1],c[0],c[1]])}Object.defineProperty(e,"__esModule",{value:!0}),e.findLinesIntersection=e.rotateRectAndFillBoth=e.getAngle=e.getDistance=e.reverseRotateRect=e.rotateRect=e.deg2rad=e.rad2Deg=e.findVectorsAngle=e.rotatePoint=e.normalizeRect=e.round10=e.ceil10=e.floor10=void 0,e.floor10=function(t,e){return n("floor",t,e)},e.ceil10=function(t,e){return n("ceil",t,e)},e.round10=r,e.normalizeRect=i,e.rotatePoint=o,e.findVectorsAngle=function(t,e,n){var r=a(n[0],n[1],t[0],t[1]);return(360+a(n[0],n[1],e[0],e[1])-r)%360},e.rad2Deg=function(t){return 180*t/Math.PI},e.deg2rad=function(t){return t*(Math.PI/180)},e.rotateRect=s,e.reverseRotateRect=function(t,e,n){var r=0;return[{a:-360,sect:1},{a:-321,sect:2},{a:-270,sect:1},{a:-269,sect:2},{a:-232,sect:1},{a:-141,sect:2},{a:-90,sect:1},{a:-89,sect:2},{a:-52,sect:1},{a:39,sect:2},{a:90,sect:1},{a:91,sect:2},{a:128,sect:1},{a:219,sect:2},{a:270,sect:1},{a:271,sect:2},{a:308,sect:1}].forEach(function(t){t.a<=n&&(r=t.sect)}),s(1===r?t:[t[2],t[1],t[0],t[3]],e,-n,!0)},e.getDistance=function(t,e,n,r){var i=n-t,o=r-e;return Math.sqrt(o*o+i*i)},e.getAngle=function(t,e,n,r){var i=n-t,o=r-e;return Math.atan2(o,i)},e.rotateRectAndFillBoth=function(t,e,n,r){void 0===r&&(r=!0);var o=s(t=i(t),e,n,r),a=s([t[2],t[1],t[0],t[3]],e,n,r),l=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[2],a[2]),Math.max(o[3],a[3])];return{rotatedRect:i([Math.max(t[0],l[0]),Math.min(t[1],l[1]),Math.min(t[2],l[2]),Math.max(t[3],l[3])]),transformedRect:o}},e.findLinesIntersection=function(t,e,n,r){var i=e[1]-t[1],o=t[0]-e[0],a=i*t[0]+o*t[1],s=r[1]-n[1],l=n[0]-r[0],c=s*n[0]+l*n[1],u=i*l-s*o;return u?[(l*a-o*c)/u,(i*c-s*a)/u]:null}},39093:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SharedRef=void 0;var n="___gcpdfviewer_shared_ref",r="___gcpdfviewer_shared_ref18n",i=function(){function t(t,e,n){this.viewer=t,this.moment=e,this.i18n=n,this.i18n}return t.onViewerInitialize=function(e,r){window[n]||(window[n]={}),window[n][e.instanceId]=new t(e,r,e.in17n)},t.get=function(t,e){if(void 0===e&&(e=!1),window[n]||(window[n]={}),!window[n][t]&&e)for(var r in window[n])return window[n][r];if(!t&&!e)throw new Error("Missing instanceId");return window[n][t]},t.dispose=function(e){t.get(e)&&(t.get(e).dispose(),delete window[n][e])},Object.defineProperty(t,"moment",{get:function(){return t.get("",!0).moment},enumerable:!1,configurable:!0}),Object.defineProperty(t,"i18n",{get:function(){var e,n;return null!==(n=null===(e=t.get("",!0))||void 0===e?void 0:e.i18n)&&void 0!==n?n:window[r]},set:function(t){window[r]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"count",{get:function(){return window[n]?Object.keys(window[n]).length:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this.viewer.storage},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.releaseResources()},t.prototype.releaseResources=function(){this.storage.releaseResources()},t}();e.SharedRef=i},48470:function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}l((r=r.apply(t,e||[])).next())})},i=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.WasmSupportApiBase=void 0;var a=n(34401),s=n(1121),l=n(73921),c=n(53488),u=o(n(71710)),d="JVBERi0xLjMNCiXi48/TDQoxIDAgb2JqDQo8PA0KL0NyZWF0b3IgKEdyYXBlQ2l0eS5Eb2N1bWVudHMuUGRmLTMuMS4wLjUwMSkNCj4+DQplbmRvYmoNCjIgMCBvYmoNCjw8DQovVHlwZSAvTWV0YWRhdGENCi9TdWJ0eXBlIC9YTUwNCi9MZW5ndGggOTI0DQo+Pg0Kc3RyZWFtDQrvu788P3hwYWNrZXQgYmVnaW49J++7vycgaWQ9J1c1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCc/Pg0KPHg6eG1wbWV0YSB4OnhtcHRrPSJHcmFwZUNpdHkuRG9jdW1lbnRzLlBkZi0zLjEuMC41MDEiIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIj4NCiAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4NCiAgICA8cmRmOkRlc2NyaXB0aW9uIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgcmRmOmFib3V0PSIiPg0KICAgICAgPGRjOmZvcm1hdD5hcHBsaWNhdGlvbi9wZGY8L2RjOmZvcm1hdD4NCiAgICA8L3JkZjpEZXNjcmlwdGlvbj4NCiAgICA8cmRmOkRlc2NyaXB0aW9uIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgcmRmOmFib3V0PSIiPg0KICAgICAgPHhtcDpDcmVhdGVEYXRlPjIwMjAtMDItMDFUMDg6NDc6MjcrMDA6MDA8L3htcDpDcmVhdGVEYXRlPg0KICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMjAtMDItMDFUMDg6NDc6MjcrMDA6MDA8L3htcDpNb2RpZnlEYXRlPg0KICAgICAgPHhtcDpNZXRhZGF0YURhdGU+MjAyMC0wMi0wMVQwODo0NzoyNyswMDowMDwveG1wOk1ldGFkYXRhRGF0ZT4NCiAgICA8L3JkZjpEZXNjcmlwdGlvbj4NCiAgICA8cmRmOkRlc2NyaXB0aW9uIHhtbG5zOnBkZj0iaHR0cDovL25zLmFkb2JlLmNvbS9wZGYvMS4zLyIgcmRmOmFib3V0PSIiPg0KICAgICAgPHBkZjpQcm9kdWNlcj5HcmFwZUNpdHkuRG9jdW1lbnRzLlBkZi0zLjEuMC41MDE8L3BkZjpQcm9kdWNlcj4NCiAgICAgIDxwZGY6UERGVmVyc2lvbj4xLjM8L3BkZjpQREZWZXJzaW9uPg0KICAgIDwvcmRmOkRlc2NyaXB0aW9uPg0KICA8L3JkZjpSREY+DQo8L3g6eG1wbWV0YT4NCjw/eHBhY2tldCBlbmQ9J3cnPz4NCmVuZHN0cmVhbQ0KZW5kb2JqDQozIDAgb2JqDQo8PA0KL1R5cGUgL1BhZ2VzDQovQ291bnQgMQ0KL01lZGlhQm94IFswIDAgNjEyIDc5Ml0NCi9LaWRzIFs0IDAgUl0NCj4+DQplbmRvYmoNCjQgMCBvYmoNCjw8DQovVHlwZSAvUGFnZQ0KL1BhcmVudCAzIDAgUg0KL1Jlc291cmNlcyA1IDAgUg0KPj4NCmVuZG9iag0KNSAwIG9iag0KPDwNCi9Qcm9jU2V0IFsvUERGIC9UZXh0IC9JbWFnZUIgL0ltYWdlQyAvSW1hZ2VJXQ0KPj4NCmVuZG9iag0KNiAwIG9iag0KPDwNCi9UeXBlIC9DYXRhbG9nDQovUGFnZXMgMyAwIFINCi9NZXRhZGF0YSAyIDAgUg0KL1BhZ2VNb2RlIC9Vc2VOb25lDQo+Pg0KZW5kb2JqDQp4cmVmDQowIDcNCjAwMDAwMDAwMDAgNjU1MzUgZg0KMDAwMDAwMDAxNyAwMDAwMCBuDQowMDAwMDAwMDg4IDAwMDAwIG4NCjAwMDAwMDExMDMgMDAwMDAgbg0KMDAwMDAwMTE5MiAwMDAwMCBuDQowMDAwMDAxMjYzIDAwMDAwIG4NCjAwMDAwMDEzMzUgMDAwMDAgbg0KdHJhaWxlcg0KPDwNCi9TaXplIDcNCi9Sb290IDYgMCBSDQovSW5mbyAxIDAgUg0KL0lEIFs8MURCMTA3QUJGMjU4MDU0QUExRTg3MzM1QjIyODQ0Q0M+IDwxREIxMDdBQkYyNTgwNTRBQTFFODczMzVCMjI4NDRDQz5dDQo+Pg0Kc3RhcnR4cmVmDQoxNDI3DQolJUVPRg0K",_=function(){function t(t){this.clientId=(0,c.generateUid)("wasm_client"),this.isDocumentShared=!1,this.isConnected=!1,this.isOpened=!1}return Object.defineProperty(t.prototype,"isConnected",{get:function(){return this._isConnected},set:function(t){var e=this;this._isConnected=t,this.viewer&&(t?this.serverVersion().then(function(t){e.viewer.plugin.onSupportApiConnected(t,!1)}):this.viewer.plugin.onSupportApiDisconnected())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportApiType",{get:function(){return"DsPdfWasm"},enumerable:!1,configurable:!0}),t.prototype.applyOptions=function(t){this.viewerOptions=t},t.prototype.setViewer=function(t){this.viewer=t},t.prototype.canEditAnnotation=function(t){return this.isOpened},t.prototype.checkDocumentLoader=function(){return r(this,void 0,void 0,function(){return i(this,function(t){return[2,this.isOpened]})})},t.prototype.closeDocumentLoader=function(){return r(this,void 0,void 0,function(){return i(this,function(t){return this.isOpened&&(this.isOpened=!1,this.wasmModule._close_document()),[2,!0]})})},t.prototype.close=function(){return r(this,void 0,void 0,function(){return i(this,function(t){return this.isOpened&&(this.isOpened=!1,this.wasmModule._close_document()),[2,"ok"]})})},t.prototype.connect=function(t){return r(this,void 0,void 0,function(){return i(this,function(e){return[2,this._connectInternal(t)]})})},t.prototype.dispose=function(){this.isConnected&&(this.isConnected=!1,this.isOpened=!1,this.wasmModule._Globals_Free())},t.prototype.getDisabledFeatures=function(){return["ESign","Collaboration"]},t.prototype.normalizeExportFileName=function(t){return t?t.replace(/([.-](?:pdf|zip))+$/i,""):""},t.prototype.getDownloadUrl=function(t,e,n){return void 0===e&&(e="PDF"),r(this,void 0,void 0,function(){var n,r,o,s,l,c,_,f,h,p,m,g,y,v,S,w;return i(this,function(i){switch(i.label){case 0:return this.isOpened?[3,1]:(w=(0,a.base64ToBytes)(d),n=new Blob([w],{type:"application/pdf"}),[3,10]);case 1:return"PNG"!==e?[3,5]:(g=this.wasmModule._malloc(10),this.wasmModule.writeTime(g),0!=(y=this.wasmModule._download_png_pages(g))?[3,2]:(w=(0,a.base64ToBytes)(d),n=new Blob([w],{type:"application/pdf"}),[3,4]));case 2:for(s=this.wasmModule.getValue(y,"i32"),l=this.normalizeExportFileName(t)+"-page",c=new u.default,_=y+4,f=0;f<s;f++)r=this.wasmModule.getValue(_,"*"),_+=4,v=this.wasmModule.getValue(_,"i32"),_+=4,S=new Uint8Array(this.wasmModule.HEAPU8.buffer,r,v),(o=new Uint8Array(v)).set(S),m=f+1,c.file(l+m.toString()+".png",o,{binary:!0});return this.wasmModule._clear_image_pages(),this.wasmModule._free(y),[4,c.generateAsync({type:"blob"})];case 3:n=i.sent(),i.label=4;case 4:return[3,10];case 5:return"SVG"!==e?[3,9]:(g=this.wasmModule._malloc(10),this.wasmModule.writeTime(g),0!=(y=this.wasmModule._download_svg_pages(g))?[3,6]:(w=(0,a.base64ToBytes)(d),n=new Blob([w],{type:"application/pdf"}),[3,8]));case 6:for(s=this.wasmModule.getValue(y,"i32"),l=this.normalizeExportFileName(t)+"-page",c=new u.default,_=y+4,f=0;f<s;f++)h=this.wasmModule.getValue(_,"*"),_+=4,v=this.wasmModule.getValue(_,"i32"),_+=4,S=new Uint8Array(this.wasmModule.HEAPU8.buffer,h,v),(p=new Uint8Array(v)).set(S),m=f+1,c.file(l+m.toString()+".svg",p,{binary:!0});return this.wasmModule._clear_image_pages(),this.wasmModule._free(y),[4,c.generateAsync({type:"blob"})];case 7:n=i.sent(),i.label=8;case 8:return[3,10];case 9:g=this.wasmModule._malloc(10),this.wasmModule.writeTime(g),y=this.wasmModule._download_modified(g),v=this.wasmModule.getValue(y,"i32")-4,S=new Uint8Array(this.wasmModule.HEAPU8.buffer,y+4,v),(w=new Uint8Array(v)).set(S),this.wasmModule._free(y),n=new Blob([w],{type:"application/pdf"}),i.label=10;case 10:return[2,window.URL.createObjectURL(n)]}})})},t.prototype.getDownloadUnmodifiedUrl=function(t){var e;if(this.isOpened){var n=this.wasmModule._download_unmodified(),r=this.wasmModule.getValue(n,"i32")-4,i=new Uint8Array(this.wasmModule.HEAPU8.buffer,n+4,r);(e=new Uint8Array(r)).set(i)}else e=(0,a.base64ToBytes)(d);var o=new Blob([e],{type:"application/pdf"});return window.URL.createObjectURL(o)},t.prototype.uploadFiles=function(t,e){return r(this,void 0,void 0,function(){var e,n,r,o,a,s,l,c;return i(this,function(i){if(this.isOpened){if(!t||!t.length)return[2,!0];for(e=this.viewer.storage,n=0,r=t.length;n<r;n++)if(o=t[n],a=this.wasmModule.stringToNewUTF8(o),!this.wasmModule._is_uploaded_file(a)){if(!(s=e.getItem(o))){this.viewer.logError("uploadFiles","There is no data in local storage for the file with id '".concat(o,"'. Ignoring the file."));continue}l=s.length,c=this.wasmModule._malloc(l),new Uint8Array(this.wasmModule.HEAPU8.buffer,c,l).set(s),this.wasmModule._upload_file(a,c,l)}return[2,!0]}return[2,!1]})})},t.prototype.getLastError=function(){return r(this,void 0,void 0,function(){return i(this,function(t){return[2,""]})})},t.prototype.getStampCategories=function(){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return[4,fetch("".concat(this._getResourcesUrl(),"images/stamps.json"))];case 1:return[4,t.sent().json()];case 2:return[2,t.sent()]}})})},t.prototype.getStampImageUrl=function(t,e,n){var r="Stamps",i=this.viewer.language;return["ja","cn"].includes(i)&&(r="Stamps_"+i),n?"".concat(this._getResourcesUrl(),"images/").concat(r,"/").concat(t,"/").concat(e):"".concat(this._getResourcesUrl(),"images/").concat(r,"/").concat(t,"/").concat(e,"?ts=").concat((new Date).getTime())},t.prototype.modify=function(t,e){return r(this,void 0,void 0,function(){var e,n;return i(this,function(r){return this.isOpened&&t&&(e=JSON.stringify(t),n=this.wasmModule.stringToNewUTF8(e),this.wasmModule._modify(n)),[2,"ok"]})})},t.prototype.openBinary=function(t){return r(this,void 0,void 0,function(){var e,n,r,o;return i(this,function(i){return e="",this.viewerOptions&&(e=this.viewerOptions.supportApiPassword||this.viewerOptions.password),n=this.wasmModule.stringToNewUTF8(e),r=t.length,o=this.wasmModule._malloc(r+4),this.wasmModule.setValue(o,r+4,"i32"),new Uint8Array(this.wasmModule.HEAPU8.buffer,o+4,r).set(t),this.wasmModule._open_document(o,n)&&(this.isOpened=!0),[2]})})},t.prototype.serverVersion=function(){return r(this,void 0,void 0,function(){var t;return i(this,function(e){if(!this.isConnected)throw this._connectInternal(!0),new Error("Wasm not loaded yet.");return t=this.wasmModule._Version(),[2,this.wasmModule.UTF8ToString(t)]})})},t.prototype.setOptions=function(t,e){return r(this,void 0,void 0,function(){var e,n;return i(this,function(r){return this.isConnected&&(t?(e=JSON.stringify(t),n=this.wasmModule.stringToNewUTF8(e),this.wasmModule._set_save_settings(n)):this.wasmModule._set_save_settings(0)),[2,"ok"]})})},t.prototype.verifySignature=function(t){return r(this,void 0,void 0,function(){return i(this,function(t){return[2,!1]})})},t.prototype.extractTableData=function(t){return r(this,void 0,void 0,function(){var e,n,r,o,a;return i(this,function(i){return this.isConnected&&t?(e=JSON.stringify(t),n=this.wasmModule.stringToNewUTF8(e),r=this.wasmModule._extract_table_data(n),o=this.wasmModule.UTF8ToString(r),a=JSON.parse(o),this.wasmModule._free(r),[2,a]):[2,null]})})},t.prototype.initWasmModule=function(){return r(this,void 0,void 0,function(){var t,e,n;return i(this,function(r){switch(r.label){case 0:return[4,this.loadWasmModule()];case 1:return(t=r.sent()).preRun=[],t.postRun=[],t.writeTime=function(e){var n=new Uint8Array(t.HEAPU8.buffer,e,10),r=new Date,i=r.getFullYear();n[0]=i>>8,n[1]=255&i,n[2]=r.getMonth()+1,n[3]=r.getDate(),n[4]=r.getHours(),n[5]=r.getMinutes(),n[6]=r.getSeconds();var o=r.getMilliseconds();n[7]=255&o;var a=1200-r.getTimezoneOffset();n[8]=o>>2&192|a>>8,n[9]=255&a},window.onerror=function(t){},e=t._malloc(42),(n=new Float32Array(t.HEAPU8.buffer,e,8))[1]=Math.random(),n[2]=Math.random(),n[3]=Math.random(),n[4]=Math.random(),n[5]=Math.random(),n[6]=Math.random(),n[7]=293.71,t.setValue(e,4294967295&Date.now(),"*"),t.writeTime(e+32),t._Globals_Init(e),[2,t]}})})},t.prototype._connectInternal=function(t){return r(this,void 0,void 0,function(){var t,e;return i(this,function(n){switch(n.label){case 0:if(this.isConnected)return[3,4];if(this._connectPromiseCapability)return[2,this._connectPromiseCapability.promise];this._connectPromiseCapability=(0,s.createPromiseCapability)(),n.label=1;case 1:return n.trys.push([1,3,,4]),(t=document.querySelector(".wasm-debugger-outer"))&&(t.style.display="block"),e=this,[4,this.initWasmModule()];case 2:return e.wasmModule=n.sent(),this.isConnected=!0,this._connectPromiseCapability.resolve(!0),delete this._connectPromiseCapability,[3,4];case 3:return n.sent(),this._connectPromiseCapability&&(this._connectPromiseCapability.resolve(!1),delete this._connectPromiseCapability),[2,!1];case 4:return[2,!0]}})})},t.prototype._getResourcesUrl=function(){return"".concat(this._findBaseUrl(),"resources/")},t.prototype._findBaseUrl=function(){var t=(this.viewer.options.baseUrl||"").trim();return t||(t=(0,l.findBaseScriptUrl)()),!t||t.endsWith("/")||t.endsWith("\\")||(t+="/"),t},t}();e.WasmSupportApiBase=_},53488:function(t,e,n){"use strict";var r,i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}l((r=r.apply(t,e||[])).next())})},o=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.isAnnotationAllowsSelectTextBehind=e.updateRotationInit=e.findRotationInit=e.calcRotationRectangles=e.initAnnotationRotateSupport=e.insertFirst=e.applyAnnotationRotate=e.applyAnnotationRotate2=e.clearAnnotationRotate=e.updateAnnotationContentPosition=e.updateInputCheckedAppearance=e.setInputCheckedState=e.logError=e.logMessage=e.isEditorModeEnabled=e.sortedIndex=e.getAccentTextColor=e.moveInkLists=e.detachHeadCss=e.detachHeadJs=e.attachHeadCss=e.cleanseRichText=e.stripHtmlTags=e.attachHeadJs=e.setActiveUserName=e.getActiveUserName=e.getDefaultUserName=e.humanReadableFileSize=e.formatDateTime=e.copyStringToClipboard=e.formatRelativeDate=e.dateToPdfDateString=e.pdfDateStringToDate=e.changeOriginToTop=e.changeOriginToBottom=e.changeRectangleOrigin=e.convertToPdfPoint=e.convertToViewportPoint=e.inverseTransform=e.applyInverseTransform=e.applyTransform=e.getAxialAlignedBoundingBox=e.adjustCoordinates=e.getTransformMatrix=e.cloneObject=e.mergeObject=e.isTypedArray=e.resetStampAspectRatio=e.updateInitialRectPosition=e.generateUid=void 0,e.getFontFormatFromUrl=e.loadFileData=e.getValueFromCssText=e.setImageFileFromCanvas=e.generateRichMediaPoster=e.injectSerializableFile=e.getStandardizedLanguageKey=void 0;var s=n(85806),l=n(27398),c=n(60661),u=n(36848),d=n(39093),_=n(73921);function f(t){return(t||"")+Date.now().toString(36)+Math.random().toString(36).substr(2)}function h(t,e){if(t.rotationInit){var n=t.rect,r=t.rotationInit.initRect,i=Math.abs(n[2]-n[0]),o=Math.abs(n[3]-n[1]),a=Math.abs(r[2]-r[0]),s=Math.abs(r[3]-r[1]),l=a-i,c=s-o;e&&(n[0]=e[0],n[1]=e[1],n[2]=n[0]+i,n[3]=n[1]+o);var d=t.rotate||0;switch(d){case 0:case 90:case 180:case 270:var _=(0,u.rotateRect)(n,null,d);r[0]=_[0],r[1]=_[1],r[2]=_[2],r[3]=_[3];break;default:r[0]=n[0]+l/2,r[1]=n[1]-c/2,r[2]=r[0]+a,r[3]=r[1]+s}}}function p(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function m(t,e,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===e||n&&void 0!==t&&(i=t)!==Object(i))return t;var i;if(p(e))return e;if(void 0===t){if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array)t=[];else{if(!e||"object"!=typeof e)return e;t={}}}if(e){if(e instanceof Array){if(t&&t instanceof Array){for(var o=[],a=0;a<e.length;a++)t.length>a?o[a]=m(t[a],e[a]):o[a]=m(void 0,e[a]);return o}return e}if("object"==typeof e&&t&&"object"==typeof t){if(t instanceof Array&&(t={}),r)for(var s in t)e.hasOwnProperty(s)||(t[s]=e[s]);for(var s in e)t[s]="implementation"===s||"irtAnnotations"===s||"parentAnnotation"===s||"popupAnnotation"===s||"threads"===s||"bead"===s||"firstBead"===s||"source"===s?e[s]:m(t[s],e[s]);return t}}return e}function g(t,e,n,r,i){void 0===i&&(i=!1);var o=t;if(i)return[n,0,0,-r,-o[0]*n,o[3]*r];var a=e;switch((a%=360)<0&&(a+=360),a||(a=0),a){case 90:return[0,n,r,0,-o[1]*n,-o[0]*r];case 180:return[-n,0,0,r,o[2]*n,-o[1]*r];case 270:return[0,-n,-r,0,o[3]*n,o[2]*r];default:return[n,0,0,-r,-o[0]*n,o[3]*r]}}function y(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}function v(t,e){var n=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/n,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/n]}function S(t){var e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}function w(t){var e=document.createElement("textarea");e.value=t,e.style.position="absolute",e.style.left="-9999px",document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);try{document.execCommand("copy")}catch(t){}document.body.removeChild(e)}function A(t,e){try{if(!t)return"";e||(e="yyyy-mm-dd HH:MM");e={0:"HH:MM",1:"h:MM tt",2:"HH:MM:ss",3:"h:MM:ss tt"}[e]||e;var n=function(t,e){void 0===e&&(e=2);for(var n=String(t);n.length<e;)n="0"+n;return n},r=function(t){return t<12?"am":"pm"},i={yyyy:String(t.getFullYear()),yy:String(t.getFullYear()).slice(-2),mmmm:t.toLocaleString("default",{month:"long"}),mmm:t.toLocaleString("default",{month:"short"}),mm:n(t.getMonth()+1),m:String(t.getMonth()+1),dddd:t.toLocaleString("default",{weekday:"long"}),ddd:t.toLocaleString("default",{weekday:"short"}),dd:n(t.getDate()),d:String(t.getDate()),HH:n(t.getHours()),H:String(t.getHours()),hh:n(t.getHours()%12||12),h:String(t.getHours()%12||12),MM:n(t.getMinutes()),M:String(t.getMinutes()),ss:n(t.getSeconds()),s:String(t.getSeconds()),tt:r(t.getHours()),t:r(t.getHours())[0]};return e.replace(/yyyy|yy|mmmm|mmm|mm|m|dddd|ddd|dd|d|HH|H|hh|h|MM|M|ss|s|tt|t/g,function(t){return i[t]})}catch(e){return String(t)}}e.generateUid=f,e.updateInitialRectPosition=h,e.resetStampAspectRatio=function(t,e,n,r,i,o){return void 0===o&&(o=!0),new Promise(function(a){if(t){var s=window.URL.createObjectURL(new Blob([t.buffer||t])),l=new Image;l.onload=function(){var t={width:l.naturalWidth||l.width,height:l.naturalHeight||l.height};i&&(t.width=72*t.width/i,t.height=72*t.height/i);var u=e.getPageSize(e.pageIndex),d=r.rect,_=Math.abs(d[2]-d[0]),f=Math.abs(d[3]-d[1]),p=Math.max(_,f),m=c.GcMeasurement.fitWithAspectRatio(t,p>10?{width:p,height:p}:u),g={x:r.rect[0],y:r.rect[1]};g.x+m.width>u.width&&(g.x=u.width-m.width),g.y+m.height>u.height&&(g.y=u.height-m.height),g.x<0&&(g.x=0),g.y<0&&(g.y=0);var y=[g.x,g.y,g.x+m.width,g.y+m.height];r.rect=y,r.rotate&&(r.rotationInit=void 0,M(r,r.rotate),h(r,[g.x,g.y])),e.updateAnnotation(n,r).then(function(t){o&&e.selectAnnotation(t.pageIndex,t.annotation),a(t)}),s&&(URL.revokeObjectURL(s),s=null)},l.onerror=function(){s&&(URL.revokeObjectURL(s),s=null),a(null)},l.src=s}else a(null)})},e.isTypedArray=p,e.mergeObject=m,e.cloneObject=function(t){return m(void 0,t)},e.getTransformMatrix=g,e.adjustCoordinates=function(t,e,n,r,i,o){void 0===r&&(r=!0),void 0===i&&(i=!1),void 0===o&&(o=1);var a,s=[t[0]<0?-t[0]:t[0],t[1]<0?-t[1]:t[1]],l=!0;t[0]<0&&0===t[2]?(a=[t[0],t[1]-s[1],t[2],t[3]-s[1]],l=!1):a=[t[0]-s[0],t[1]-s[1],t[2]-s[0],t[3]-s[1]];var c=g(a,n,o,o,!1);r&&(c=S(c));var u=y(e,c);return i||(u=[u[0],a[3]-u[1]]),l?[u[0]+t[0],u[1]+t[1]]:[u[0],u[1]+t[1]]},e.getAxialAlignedBoundingBox=function(t,e){var n=y(t,e),r=y(t.slice(2,4),e),i=y([t[0],t[3]],e),o=y([t[2],t[1]],e);return[Math.min(n[0],r[0],i[0],o[0]),Math.min(n[1],r[1],i[1],o[1]),Math.max(n[0],r[0],i[0],o[0]),Math.max(n[1],r[1],i[1],o[1])]},e.applyTransform=y,e.applyInverseTransform=v,e.inverseTransform=S,e.convertToViewportPoint=function(t,e,n){return y([t,e],n)},e.convertToPdfPoint=function(t,e,n){return v([t,e],n)},e.changeRectangleOrigin=function(t,e,n,r){void 0===n&&(n="BottomLeft"),void 0===r&&(r=!0);var i=a([],t,!0);if(r){var o=Math.min(t[1],t[3]),s=Math.max(t[1],t[3]);return("BottomLeft"===n||"TopLeft"===n)&&(i[1]=e[3]-s+e[1],i[3]=e[3]-o+e[1]),(0,u.normalizeRect)(i)}return o=t[1],s=t[3],("BottomLeft"===n||"TopLeft"===n)&&(i[1]=e[3]-o+e[1],i[3]=e[3]-s+e[1]),i},e.changeOriginToBottom=function(t,e){return e[3]-t+e[1]},e.changeOriginToTop=function(t,e){return e[3]-t-e[1]},e.pdfDateStringToDate=function(t){if(!t||"string"!=typeof t)return t&&t.getTime?t:null;r||(r=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));var e=r.exec(t);if(!e)return null;var n=parseInt(e[1],10),i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;var o=parseInt(e[3],10);o=o>=1&&o<=31?o:1;var a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;var s=parseInt(e[5],10);s=s>=0&&s<=59?s:0;var l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;var c=e[7]||"Z",u=parseInt(e[8],10);u=u>=0&&u<=23?u:0;var d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===c?(a+=u,s+=d):"+"===c&&(a-=u,s-=d),new Date(Date.UTC(n,i,o,a,s,l))},e.dateToPdfDateString=function(t){var e=null;if(void 0===t)return null;if(t instanceof Date)e=t;else if("string"==typeof t)e=new Date(t);else if("number"==typeof t)e=new Date(t);else{if(!t||!t.toDate)return null;e=t.toDate()}if(!e)return null;if(isNaN(e.getTime()))return null;var n=e.getUTCFullYear(),r=e.getUTCMonth()+1,i=e.getUTCDate(),o=e.getUTCHours(),a=e.getUTCMinutes(),s=e.getUTCSeconds(),l=n.toString().padStart(4,"0"),c=r.toString().padStart(2,"0"),u=i.toString().padStart(2,"0"),d=o.toString().padStart(2,"0"),_=a.toString().padStart(2,"0"),f=s.toString().padStart(2,"0");return"D:".concat(l).concat(c).concat(u).concat(d).concat(_).concat(f,"Z")},e.formatRelativeDate=function(t,e,n){if(!t)return"";var r=new Date,i=t.getTime()-r.getTime(),o=i>0,a=Math.abs(i);if(a<1e3)return e.t("labels.relative-date.right-now","right now");var s=Math.floor(a/1e3);if(s<60)return o?e.t("labels.relative-date.in-seconds-format","in {{sec}} sec.",{sec:s}):e.t("labels.relative-date.seconds-ago-format","{{sec}} sec. ago",{sec:s});var l=Math.floor(a/6e4);if(l<60)return o?e.t("labels.relative-date.in-minutes-format","in {{min}} min.",{min:l}):e.t("labels.relative-date.minutes-ago-format","{{min}} min. ago",{min:l});var c=A(t,n);return o?e.t("labels.relative-date.at-format","at {{date}}",{date:c}):c},e.copyStringToClipboard=function(t){navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then(function(){}).catch(function(e){w(t)}):w(t)},e.formatDateTime=A,e.humanReadableFileSize=function(t,e){var n;n=e?[e.t("labels.fileSize.b","B"),e.t("labels.fileSize.kb","KB"),e.t("labels.fileSize.mb","MB"),e.t("labels.fileSize.gb","GB"),e.t("labels.fileSize.tb","TB"),"PB","EB","ZB","YB"]:["B","KB","MB","GB","TB","PB","EB","ZB","YB"];var r=t?Math.floor(Math.log(t)/Math.log(1024)):0;return 1*(t/Math.pow(1024,r)).toFixed(2)+" "+n[r]};var b="gcpdfviewerusername";function C(){var t=d.SharedRef.i18n;return t?t.t("annotation-defaults.default-user-name","Anonymous"):"Anonymous"}e.getDefaultUserName=C,e.getActiveUserName=function(t){var e=void 0;if(t&&(e=t.userName),!e)try{var n=localStorage.getItem(b);if(n){var r=JSON.parse(n);r&&(e=r.userName)}}catch(t){}return e||(e=C()),e},e.setActiveUserName=function(t,e){t||(t=C());try{var n={userName:t,setBy:e};localStorage.setItem(b,JSON.stringify(n))}catch(t){}};var x={},F={};function T(t,e){try{for(var n=t.querySelector(e),r=0;n&&r<5;)n.remove?n.remove():n.parentNode.removeChild(n),n=t.querySelector(e),r++}catch(t){}}function k(t,e,n){var r=t.closest(".annotationLayer"),i=null==r?void 0:r.querySelectorAll('input[data-name="'+t.getAttribute("data-name")+'"]');i&&i.length>1?i.forEach(function(r){n&&r.hasAttribute("exportValue")&&n===r.getAttribute("exportValue")?P(r,!0):"radio"===t.type&&t!==r&&e?P(r,!1):P(r,t===r?e:void 0)}):P(t,e)}function P(t,e){void 0===e&&(e=!!t.checked);var n=t.closest("section");if(n){var r=n.getAttribute("data-annotation-id");if(r){e?n.classList.add("checked"):n.classList.remove("checked");var i=t.getAttribute("exportValue");if(i){var o=".gc-annotation-appearance-"+r+"-N",a=".gc-annotation-appearance-"+r+"-N_"+i.replace(/[\s\\\/\n]+/gm,"_"),s=".gc-annotation-appearance-"+r+"-N_Off",l=n.querySelector(o),c=n.querySelector(s),u=n.querySelector(a);u||(u=n.querySelector(".gc-annotation-appearance-"+r+"-N_Yes")||n.querySelector(".gc-annotation-appearance-"+r+"-N_On")),u&&(l&&(l.style.display="none"),n.classList.add("gc-annotation-has-appearance"),e?(u.style.display="block",c&&(c.style.display="none")):(u.style.display="none",c&&(c.style.display="block")))}}}}function D(t,e,n,r){t.style.position="absolute",t.style.left="",t.style.top="",t.style.right="";var i="100%",o="100%";switch(e){case-90:case 90:t.style.transformOrigin="0 0",i="".concat(n,"px"),o="".concat(r,"px"),t.style.left="0px",t.style.top="".concat(n,"px");break;case-180:case 180:t.style.transformOrigin="0 0",t.style.top="".concat(n,"px"),t.style.left="".concat(r,"px");break;case-270:case 270:t.style.transformOrigin="0 0",i="".concat(n,"px"),o="".concat(r,"px"),t.style.left="".concat(r,"px");break;default:i="".concat(r,"px"),o="".concat(n,"px"),t.style.transformOrigin="initial"}t.style.width=i,t.style.height=o}function I(t){for(var e=t.classList.contains("gc-rotate-support")?[t]:Array.from(t.querySelectorAll(".gc-rotate-support")),n=0;n<e.length;n++){var r=e[n];r.style.transform="",r.style.transformOrigin="",r.style.left="",r.style.top="",r.style.right="";for(var i=0,o=Array.from(r.querySelectorAll("IMG"));i<o.length;i++){var a=o[i];a.style.transform="",a.style.transformOrigin=""}}}function R(t,e){var n;if(void 0===e&&(e=[0,0,0,0]),t.rotationInit)n=t.rotationInit.initRect||t.rect||e;else if(!t.fileIdChanged){if(t.appearanceBBox){var r=t.appearanceBBox[2]-t.appearanceBBox[0],i=t.appearanceBBox[3]-t.appearanceBBox[1],o=(t.rect[2]-t.rect[0]-r)/2,a=(t.rect[3]-t.rect[1]-i)/2,s=t.rect[0]+o,l=t.rect[1]+a;n=[s,l,s+r,l+i]}!n&&t.rotate&&(n=(0,u.rotateRect)(t.rect||e,null,t.rotate,!0))}return n||(n=t.rect||e),n}function B(t,e,n){void 0===n&&(n=!1);var r=t.closest(".gc-annotation")||t.closest(".gc-widget")||t.closest("section"),i=e.rotate;if(Number.isFinite(i))for(var o=R(e,[r.offsetLeft,r.offsetTop,r.offsetLeft+r.offsetWidth,r.offsetTop+r.offsetHeight]),a=e.rect||[r.offsetLeft,r.offsetTop,r.offsetLeft+r.offsetWidth,r.offsetTop+r.offsetHeight],s=Math.abs(o[2]-o[0]),l=Math.abs(o[3]-o[1]),c=Math.abs(a[2]-a[0]),u=Math.abs(a[3]-a[1]),d=t.classList.contains("gc-rotate-support")?[t]:Array.from(t.querySelectorAll(".gc-rotate-support")),_=0;_<d.length;_++){var f=d[_],h=(f.style.transform||"").toString();h=h.replace(/(\s*rotate\(.+\))/gm,""),h+=" rotate("+-i+"deg)",f.style.transform=h,f.style.transformOrigin="",f.style.width=s+"px",f.style.height=l+"px",f.style.position="absolute",f.style.left="".concat((c-s)/2,"px"),f.style.top="".concat((u-l)/2,"px"),f.setAttribute("data-result-width",s.toString());var p=f.querySelector(".gc-text-content");p&&(p.style.width="100%",p.style.height="100%");for(var m=0,g=Array.from(t.querySelectorAll("IMG"));m<g.length;m++){var y=g[m];y.style.width="100%",y.style.height="100%"}}}function L(t,e,n){var r;if(void 0===n&&(n=!1),t&&e)if(e.rotate||e.orientation){if(e.annotationType===s.AnnotationTypeCode.INK)return;if(e.annotationType===s.AnnotationTypeCode.FREETEXT)return;if(!(0,s.isFormFieldWidget)(e))return B(t,e,n);var i=e.rotate||0,o=e.orientation||0;o&&(i=o);var a=t.closest(".gc-annotation")||t.closest(".gc-widget")||t.closest("section");if(!n&&a.classList.contains("gc-annotation-has-appearance")&&!a.classList.contains("gc-use-custom-appearance"))return;for(var l=t.classList.contains("gc-rotate-support")?[t]:Array.from(t.querySelectorAll(".gc-rotate-support")),c=0;c<l.length;c++){if(h=(h=((f=l[c]).style.transform||"").toString()).replace(/(\s*rotate\(.+\))/gm,""),h+=" rotate("+-i+"deg)",f.style.transform=h,f.style.transformOrigin="",!f.classList.contains("gc-annotation")&&!a.classList.contains("freeTextAnnotation")){a.__borderCopied||(a.__borderCopied=!0,a.style.border&&(f.style.border=a.style.border),a.style.borderColor&&(f.style.borderColor=a.style.borderColor),"none none solid"===a.style.borderStyle?(f.style.borderBottomStyle="solid",f.style.borderBottomWidth=a.style.borderBottomWidth,f.style.borderBottomColor=a.style.borderBottomColor,a.style.paddingBottom=a.style.borderBottomWidth,a.style.borderBottomWidth="0px"):a.style.borderWidth&&(f.style.borderWidth=a.style.borderWidth,a.style.padding=a.style.borderWidth,a.style.borderWidth="0px"),a.style.borderStyle&&(f.style.borderStyle=a.style.borderStyle)),!o&&i&&i%90==0&&(o=i);var u=(null===(r=e.rotationInit)||void 0===r?void 0:r.initRect)||e.rect;(!u||o&&(a.offsetWidth||a.offsetHeight))&&(u=[a.offsetLeft,a.offsetTop,a.offsetLeft+a.offsetWidth,a.offsetTop+a.offsetHeight]);var d=Math.abs(u[2]-u[0]),_=Math.abs(u[3]-u[1]);o?D(f,o,_,d):e.rotationInit&&(f.style.width="".concat(d,"px"),f.style.height="".concat(_,"px"),f.style.position="absolute",f.style.left="".concat(e.rotationInit.dx||0,"px"),f.style.top="".concat(e.rotationInit.dy||0,"px"))}}}else for(l=t.classList.contains("gc-rotate-support")?[t]:Array.from(t.querySelectorAll(".gc-rotate-support")),c=0;c<l.length;c++){var f,h;(f=l[c]).style.width="100%",f.style.height="100%",f.style.left="0px",f.style.top="0px",h=(h=(f.style.transform||"").toString()).replace(/(\s*rotate\(.+\))/gm,""),f.style.transform=h,f.style.transformOrigin=""}}function E(t,e){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function M(t,e,n){if(e){var r=n||R(t),i=Math.abs(r[2]-r[0]),o=Math.abs(r[3]-r[1]),a=(0,u.rotateRectAndFillBoth)(r,[r[0]+i/2,r[1]+o/2],e),s=a.rotatedRect,l=a.transformedRect,c=Math.abs(s[2]-s[0]),d=Math.abs(s[3]-s[1]);t.rotationInit={initRect:r,rotatedRect:s,transformedRect:l,angle:e,dx:(c-i)/2,dy:(d-o)/2},t.rect=s}else t.rotationInit&&(t.rotationInit.initRect&&(t.rect=t.rotationInit.initRect),t.rotationInit=void 0),n&&(t.rect=n)}function O(t,e){var n=(0,u.rotateRect)(t,null,e,!0),r=(0,u.findLinesIntersection)([n[0],n[3]],[n[2],n[3]],[t[0],t[1]],[t[0],t[3]]),i=(0,u.findLinesIntersection)([n[0],n[1]],[n[2],n[3]],[t[2],t[1]],[t[2],t[3]]);return r&&i?(0,u.normalizeRect)([r[0],r[1],i[0],i[1]]):a([],t,!0)}function N(t,e,n,r,a,s){return void 0===r&&(r="file"),void 0===a&&(a=!0),void 0===s&&(s=""),i(this,void 0,void 0,function(){var l=this;return o(this,function(c){return s=s||e["".concat(r,"Id")],[2,new Promise(function(c){t.toBlob(function(u){return i(l,void 0,void 0,function(){var i,l,d,_,h,p;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,,3,4]),u?[4,u.arrayBuffer()]:[3,2];case 1:i=o.sent(),l=new Uint8Array(i),d=s||f("".concat(r,"_img")),_="".concat(r,".png"),h=l.length,e["".concat(r,"Id")]=d,e["".concat(r,"Name")]=_,e["".concat(r,"Length")]=h,n.storage.setItem(d,l),p={id:e.id,fileId:d,fileName:_,fileLength:h,filePropName:r},n.viewer.eventBus.dispatch("annotation-image-loaded",p),o.label=2;case 2:return a&&(t.width=0,t.height=0),[3,4];case 3:return c(),[7];case 4:return[2]}})})},"image/png")})]})})}e.attachHeadJs=function(t,e,n){return new Promise(function(r,i){if(e){if(F[e])return void r();F[e]=!0}var o=((n=n||document).getElementsByTagName?n.getElementsByTagName("head")[0]:void 0)||n.body||n,a=document.createElement("script");e&&a.setAttribute("id",e),a.type="text/javascript",a.src=t,a.async=!0,a.onerror=function(t){i(t)};var s=!1;a.onload=a.onreadystatechange=function(t){var e=t.target;s||e.readyState&&"complete"!=e.readyState||(s=!0,r())},o.insertBefore(a,o.firstChild)})},e.stripHtmlTags=function(t){var e=document.createElement("div");return e.innerHTML=t||"",e.innerText||e.textContent||""},e.cleanseRichText=function(t){return t?t.replace(/<\/?(?:script|iframe|object|embed|form|input|textarea|select|option|button)[^>]*>/gi,"").replace(/<\?xml[^>]*\?>|<body[^>]*>|<\/body>/gi,""):""},e.attachHeadCss=function(t,e,n){if(e){if(x[e])return;x[e]=!0}var r=((n=n||document).getElementsByTagName?n.getElementsByTagName("head")[0]:void 0)||n.body||n,i=document.createElement("link");e&&i.setAttribute("id",e),i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href","data:text/css;charset=UTF-8,"+encodeURIComponent(t)),r.insertBefore(i,r.firstChild)},e.detachHeadJs=function(t,e){t&&(T((e=e||document).head||e,"#"+t),delete F[t])},e.detachHeadCss=function(t,e){t&&(T((e=e||document).head||e,"#"+t),delete x[t])},e.moveInkLists=function(t,e,n){if(t)for(var r=0,i=t;r<i.length;r++)for(var o=i[r],a=0;a<o.length;a++)o[a].x=o[a].x-e,o[a].y=o[a].y-n},e.getAccentTextColor=function(){var t=document.querySelector(".gc-menu__btn-container");return t&&window.getComputedStyle&&window.getComputedStyle(t,null).getPropertyValue("background-color")||"#000000"},e.sortedIndex=function(t,e){for(var n=0,r=t.length;n<r;){var i=n+r>>>1;t[i]<e?n=i+1:r=i}return n},e.isEditorModeEnabled=function(t){return t&&!!(0,l.findSelfOrAncestor)(t,"gc-editor-mode")},e.logMessage=function(t){window.console&&window.console.log(t);var e=document.querySelector("#log-message");if(e){var n=new Date;t=(t=t+(" ("+n.getHours()+":"+n.getSeconds()+"."+n.getMilliseconds()+")")+";<br>"+e.innerHTML).substr(0,Math.min(t.length,512)),e.innerHTML=t}},e.logError=function(t){if("object"==typeof(t=t||"[empty message]")){var e="{ ";for(var n in t)e=e+n+"="+t[n]+"; ";t=e+="}"}window.console&&window.console.log(t);var r=document.querySelector("#log-error-message")||document.querySelector("#log-message");if(r){var i=new Date,o=" ("+i.getHours()+":"+i.getSeconds()+"."+i.getMilliseconds()+")";r.innerHTML=t+o}},e.setInputCheckedState=function(t,e,n,r){var i,o;if(t){var a=t.closest("section"),s=t.hasAttribute("checked"),l=t.checked!==s||e!==t.checked||a&&(e&&!a.classList.contains("checked")||!e&&a.classList.contains("checked")),c=null;e?(t.setAttribute("checked","true"),t.checked=!0,t.hasAttribute("exportValue")&&(c=t.getAttribute("exportValue")),null===(i=t.closest("section"))||void 0===i||i.classList.add("checked")):(t.removeAttribute("checked"),t.checked=!1,null===(o=t.closest("section"))||void 0===o||o.classList.remove("checked")),k(t,e,c),l&&n&&n.onInputChanged(t,r)}},e.updateInputCheckedAppearance=k,e.updateAnnotationContentPosition=function(t,e,n){if(e||n)switch(t.annotationType){case s.AnnotationTypeCode.LINE:var r=t.lineCoordinates;if(r)for(var i=0;i<r.length;i+=2)e&&(r[i]=r[i]-e),n&&(r[i+1]=r[i+1]-n);break;case s.AnnotationTypeCode.INK:var o=t.inkLists;if(o)for(var a=0,l=o;a<l.length;a++)for(var c=0,u=l[a];c<u.length;c++){var d=u[c];e&&(d.x=d.x-e),n&&(d.y=d.y-n)}break;case s.AnnotationTypeCode.POLYLINE:case s.AnnotationTypeCode.POLYGON:var _=t.vertices;if(_)for(var f=0,h=_;f<h.length;f++){d=h[f];e&&(d.x=d.x-e),n&&(d.y=d.y-n)}}},e.clearAnnotationRotate=I,e.applyAnnotationRotate2=B,e.applyAnnotationRotate=L,e.insertFirst=E,e.initAnnotationRotateSupport=function(t,e,n){var r=t.querySelector(".gc-rotate-support")||document.createElement("div");r.classList.add("gc-rotate-support"),n&&("string"==typeof n?r.innerHTML=n:r.appendChild(n)),E(t,r),e.rotate||e.orientation?L(r,e):I(r)},e.calcRotationRectangles=M,e.findRotationInit=O,e.updateRotationInit=function(t){t.rotationInit&&t.rotate&&(t.rotationInit.initRect=O(t.rect,t.rotate))},e.isAnnotationAllowsSelectTextBehind=function(t){return!t||!!(t.className||"").match(new RegExp("(".concat(["underlineAnnotation","squigglyAnnotation","strikeOutAnn