@compdfkit_pdf_sdk/webviewer 2.7.1 → 2.7.3-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,2 +1 @@
1
- function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){d(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(){n=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",d=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=t&&t.prototype instanceof M?t:M,i=Object.create(o.prototype),u=new E(r||[]);return a(i,"_invoke",{value:w(e,n,u)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var p="suspendedStart",g="suspendedYield",A="executing",h="completed",P={};function M(){}function m(){}function v(){}var y={};s(y,u,(function(){return this}));var I=Object.getPrototypeOf,C=I&&I(I(R([])));C&&C!==r&&o.call(C,u)&&(y=C);var S=v.prototype=M.prototype=Object.create(y);function _(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(r,a,i,u){var l=f(e[r],e,a);if("throw"!==l.type){var d=l.arg,s=d.value;return s&&"object"==typeof s&&o.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(s).then((function(e){d.value=e,i(d)}),(function(e){return n("throw",e,i,u)}))}u(l.arg)}var r;a(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(a,a):a()}})}function w(t,n,r){var o=p;return function(a,i){if(o===A)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var u=r.delegate;if(u){var l=b(u,r);if(l){if(l===P)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=A;var d=f(t,n,r);if("normal"===d.type){if(o=r.done?h:g,d.arg===P)continue;return{value:d.arg,done:r.done}}"throw"===d.type&&(o=h,r.method="throw",r.arg=d.arg)}}}function b(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,b(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),P;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,P;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,P):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,P)}function G(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(G,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[u];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=v,a(S,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:m,configurable:!0}),m.displayName=s(v,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,d,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},_(x.prototype),s(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new x(c(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(S),s(S,d,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=R,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),d=o.call(i,"finallyLoc");if(l&&d){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!d)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,P):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),P}},t}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function o(e,t,n,r,o,a,i){try{var u=e[a](i),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function u(e){o(i,r,a,u,l,"next",e)}function l(e){o(i,r,a,u,l,"throw",e)}u(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,r(o.key),o)}}function l(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,u=[],l=!0,d=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){d=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(d)throw o}}return u}}(e,t)||f(e,t)||function(){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 c(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(e)||function(){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 f(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e){var t=e.getTimezoneOffset(),n=t<0?"+":"-",r=("00"+Math.abs(t/60)).slice(-2),o=("00"+Math.abs(t%60)).slice(-2),a="".concat(n).concat(r,"'").concat(o,"'"),i=e.getFullYear(),u=("00"+(e.getMonth()+1)).slice(-2),l=("00"+e.getDate()).slice(-2),d=("00"+e.getHours()).slice(-2),s=("00"+e.getMinutes()).slice(-2),c=("00"+e.getSeconds()).slice(-2);return"D:".concat(i).concat(u).concat(l).concat(d).concat(s).concat(c).concat(a)}function A(e){if(!e)return new Date;var t=e.match(/D:(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})([-+]\d{2}'\d{2}')?/);if(t){var n=s(t,8),r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],l=n[6];return n[7],new Date(parseInt(r),parseInt(o)-1,parseInt(a),parseInt(i),parseInt(u),parseInt(l))}throw new Error("Invalid timestamp format")}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=Math.pow(10,t);return Math.round(e*n)/n}var P=l((function e(){var t=this;i(this,e),this.promise=new Promise((function(e,n){t.resolve=function(t){e(t)},t.reject=function(e){n(e)}}))}));function M(e,t){this.constructor===M&&function(e){throw new Error(e)}("Cannot initialize BaseException."),this.message=e,this.name=t}function m(e){return e.startsWith("#")?"hex":e.startsWith("rgb(")?"rgb":e.startsWith("hsl")?"hsl":"unknown"}function v(e){var t=m(e);if("hex"===t){var n=I(e),r=n.R,o=n.G,a=n.B;return{R:h(r/255),G:h(o/255),B:h(a/255)}}if("rgb"===t){var i=e.match(/(\d+),\s*(\d+),\s*(\d+)/);return{R:h(parseInt(i[1])/255),G:h(parseInt(i[2])/255),B:h(parseInt(i[3])/255)}}if("hsl"===t){var u=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(!u)return{error:"Invalid HSL format"};var l=parseInt(u[1]),d=parseInt(u[2])/100,s=parseInt(u[3])/100,c=C(l,d,s),f=c.R,p=c.G,g=c.B;return{R:h(f/255),G:h(p/255),B:h(g/255)}}console.error({message:"Invalid color value"})}function y(e,t,n){return function(e,t,n){var r=(1<<24|e<<16|t<<8|n).toString(16).slice(1).toUpperCase();return"#".concat(r)}(Math.round(255*e),Math.round(255*t),Math.round(255*n))}function I(e){var t=e.slice(1),n=parseInt(t,16);return{R:n>>16&255,G:n>>8&255,B:255&n}}M.prototype=new Error,M.constructor=M,"undefined"!=typeof document&&document.documentElement.style;var C=function(e,t,n){var r,o,a;if(e/=360,0===t)r=o=a=Math.round(255*n);else{var i=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},u=n<.5?n*(1+t):n+t-n*t,l=2*n-u;r=Math.round(255*i(l,u,e+1/3)),o=Math.round(255*i(l,u,e)),a=Math.round(255*i(l,u,e-1/3))}return{R:r,G:o,B:a}},S={0:"left",1:"center",2:"right"},_={LEFT:0,CENTER:1,CENTERED:1,RIGHT:2},x={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,RICHMEDIA:26,REDACT:27,INTERCHANGE:28,ARC:29},w={1:"text",2:"link",3:"freetext",4:"line",5:"square",6:"circle",7:"polygon",8:"polyline",9:"highlight",10:"underline",11:"squiggly",12:"strikeout",13:"stamp",14:"caret",15:"ink",16:"popup",17:"fileattachment",18:"sound",19:"movie",20:"widget",21:"screen",22:"printermark",23:"trapnet",24:"watermark",25:"threed",26:"richmedia",27:"redact",28:"interchange",29:"arc"},b={PUSHBUTTON:0,CHECKBOX:1,RADIOBUTTON:2,TEXTFIELD:3,COMBOBOX:4,LISTBOX:5,SIGNATUREFIELDS:6,UNKNOWN:255},G={0:"pushbutton",1:"checkbox",2:"radiobutton",3:"textfield",4:"combobox",5:"listbox",6:"signatureFields",255:"unknown"},T=1,E=2,R=32,B={UNKNOWN:-1,NONE:0,OPENARROW:1,CLOSEDARROW:2,SQUARE:3,CIRCLE:4,DIAMOND:5,BUTT:6,ROPENARROW:7,RCLOSEDARROW:8,SLASH:9},F={"-1":"unknown",0:"none",1:"openarrow",2:"closedarrow",3:"square",4:"circle",5:"diamond",6:"butt",7:"ropenarrow",8:"rclosedarrow",9:"slash"};d(d(d(d(d({1:"none",0:"check"},"1","circle"),2,"cross"),3,"diamond"),4,"square"),5,"star");var D={0:"unknown",1:"standard",2:"image",3:"text",4:"digital"},L={0:"unknown",1:"goto",2:"gotor",3:"gotoe",4:"launch",5:"thread",6:"uri",7:"sound",8:"movie",9:"hide",10:"named",11:"submitform",12:"resetform",13:"importdata",14:"javascript",15:"setocgstate",16:"rendition",17:"trans",18:"goto3dview",19:"uop",255:"error"},U={solid:0,dashed:1,beveled:2,inset:3,underline:4},N={0:"solid",1:"dashed",2:"beveled",3:"inset",4:"underline"},k={0:"rect",1:"leftTriangle",2:"rightTriangle",3:"none"},O=l((function e(){i(this,e)}));d(O,"CSS",96),d(O,"PDF",72),d(O,"PDF_TO_CSS_UNITS",1);var H={MARKED:0,UNMARKED:1,ACCEPTED:2,REJECTED:3,CANCELLED:4,COMPLETED:5,NONE:6,ERROR:7},Y={0:"MARKED",1:"UNMARKED",2:"ACCEPTED",3:"REJECTED",4:"CANCELLED",5:"COMPLETED",6:"NONE",7:"ERROR"},W={DISTANCE:0,PERIMETER:1,AREA:2,ANGLE:3,COUNT:4,ARC:5},Q={0:"distance",1:"perimeter",2:"area",3:"angle",4:"count",5:"arc"},K={AREA:1,LENGTH:2,RADIUS:4,DIAMETER:8,ANGLE:16,COUNT:32,ARCLENGTH:64,GENERIC:128},q={1:"area",2:"length",4:"radius",8:"diameter",16:"angle",32:"count",64:"arclength",128:"generic"},J=function(){return l((function e(t,n,r){var o=this;i(this,e),this.sourceName=t,this.targetName=n,this.comObj=r,this.callbackId=1,this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=function(e){var t=e.data;if(t.targetName===o.sourceName)if(t.callback){var n=t.callbackId,a=o.callbackCapabilities[n];if(!a)throw new Error("Cannot resolve callback ".concat(n));if(delete o.callbackCapabilities[n],"resolve"!==t.callback)throw console.log({data:{action:t.data.action,data:t.data.data},message:t.reason&&t.reason.message}),new Error("Unexpected callback case");a.resolve(t.data)}else{var i=o.actionHandler[t.action];if(!i)throw new Error("Unknown action from worker: ".concat(t.action));if(t.callbackId){var u=o.sourceName,l=t.sourceName;new Promise((function(e){e(i(t.data))})).then((function(e){r.postMessage({sourceName:u,targetName:l,callback:"resolve",callbackId:t.callbackId,data:e})}),(function(e){r.postMessage({data:t,sourceName:u,targetName:l,callback:"reject",callbackId:t.callbackId,reason:e})}))}else i(t.data)}},r.addEventListener("message",this._onComObjOnMessage)}),[{key:"on",value:function(e,t){var n=this.actionHandler;if(n[e])throw new Error('There is already an actionName called "'.concat(e,'"'));n[e]=t}},{key:"send",value:function(e,t){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t})}},{key:"sendWithPromise",value:function(e,t){var n=this.callbackId++,r=new P;this.callbackCapabilities[n]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t})}catch(e){r.reject(e)}return r.promise}},{key:"destroy",value:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}])}();function X(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){var e=new Uint8Array(r.result);t(e)},r.onerror=function(){n(r.error)},r.readAsArrayBuffer(e)}))}function j(e){for(var t=e.split(";base64,")[1],n=atob(t),r=new Uint8Array(n.length),o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}importScripts("./ComPDFKit.js");var ComPDFKitJS={opened_Font:[],opened_DefFont:[],ComPDFKitDownloadFont:function(e){if(ComPDFKitJS.opened_Font[e])return ComPDFKitJS.opened_Font[e];return!1},ComPDFKitDownloadFontA:function(e){if(ComPDFKitJS.opened_Font[e])return ComPDFKitJS.opened_Font[e];var t=fontsJson[e-1];if(!t)return!1;var fontFile=$(Z+t.filePath);return te.MessageHandler.send("LoadFont",{fontFamily:t.family}),ComPDFKitJS.opened_Font[e]=fontFile,fontFile},FontNameList:[],FontCount:1,opened_image:[],opened_files:[],opened_cert:[]},DataArray=[],LineType={},BorderStyle={},PageSize={},Rect={},RGBColor={},FontDa={},PDFDestination={},WidgetItem={},WidgetItemsArray={},TextFindItemArray=[],EditCharPlace={},EndEditCharPlace={},RectArray=[],CursorPoints={},EditTextStyle={},U8StringData="",PDFRange={},TextRectArray=[],ImageAreaInfo={},SignerArray=[],CertArray=[],AccessInfoArray=[],PolicyArray=[],CRLPointArray=[],OCSPUrlArray=[],DiffInfoArray=[],AnnotArray=[],fontsJson=null,Z="https://www.compdf.com/fonts/",LayerPrintData={},LayerZoomData={},SepColorsArray=[],SelectPointColorArray=[],MeasureVerticesArray=[],PermissionsInfo={};function V(e){return z.apply(this,arguments)}function z(){return(z=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,t)}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new XMLHttpRequest;n.open("GET",e,t),n.responseType="arraybuffer";var r=function(){return(200===n.status||206===n.status)&&new Uint8Array(n.response)};if(t)return new Promise((function(e,t){n.onload=function(){return e(r())},n.onerror=function(){return t(new Error("Network error"))},n.send()}));try{return n.send(),r()}catch(e){return!1}}function ee(e){var t=parseInt(e.slice(1),16),n=t>>8&255,r=255&t;return{R:h((t>>16&255)/255),G:h(n/255),B:h(r/255)}}var te=function(){function e(){i(this,e)}return l(e,null,[{key:"setUp",value:(t=a(n().mark((function t(){var r,o;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=new J("worker","main",self),this.MessageHandler=r,o=!1,r.on("test",(function(e){o||(o=!0,r.send("test",e instanceof Uint8Array))})),r.send("ready",null),r.on("Ready",(function(t){return e.createDocumentHandler(self)}));case 6:case"end":return t.stop()}}),t,this)}))),function(){return t.apply(this,arguments)})},{key:"createDocumentHandler",value:function(){var e=this.MessageHandler;e.on("InitConfig",(function(e){var t=e.license,n=e.appId,r=e.version,o=stringToNewUTF8(t),a=stringToNewUTF8(""),i=stringToNewUTF8(n),u=stringToNewUTF8(r);return Module._InitComPDFkit(o,!1,a,i,0,u),Ae()})),e.on("LoadFile",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,fontFile,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ComPDFKitJS.opened_files=[],ComPDFKitJS.opened_files[0]=t.buffer,t.pagesPtr&&t.pagesPtr.length>0&&t.pagesPtr.forEach((function(e){Module._ClearPage(e.pagePtr)})),t.doc&&Module._ClearDocument(t.doc),t.fileList&&(ComPDFKitJS.opened_Font[0]=t.fileList),"https://www.compdf.com/fonts/"!==t.webFontURL&&(Z=t.webFontURL),!t.fontsJson||fontsJson){e.next=26;break}if(fontsJson=t.fontsJson,r=!!ComPDFKitJS.opened_Font[0],ComPDFKitJS.FontCount=r?t.fontsJson.length+1:t.fontsJson.length,r){e.next=25;break}for(o=[],a=0;a<t.fontsJson.length;a++)o.push($(Z+t.fontsJson[a].filePath,!0));if(!o.length){e.next=25;break}return i=null,e.prev=15,e.next=18,Promise.all(o);case 18:i=e.sent,e.next=24;break;case 21:e.prev=21,e.t0=e.catch(15),console.log(e.t0);case 24:if(i&&i.length)for(u=0;u<o.length;u++)l=ComPDFKitJS.opened_Font.length,i[u]&&(ComPDFKitJS.opened_Font[l]=i[u]);case 25:Module._InitComPDFkitFont(r);case 26:return t.enableDefaultFont&&!ComPDFKitJS.opened_DefFont[0]&&(fontFile=$("./DroidSansFallbackFull.ttf"),ComPDFKitJS.opened_DefFont[0]=fontFile),d=Module._InitDocument(),e.abrupt("return",d);case 29:case"end":return e.stop()}}),e,null,[[15,21]])})));return function(t){return e.apply(this,arguments)}}()),e.on("GetWebFontNameList",(function(){var e=ComPDFKitJS.FontNameList;return e.length?e:null})),e.on("LoadDocumentByStream",re),e.on("GetPageCount",(function(e){var t=e.doc;return Module._GetPageCount(t)})),e.on("GetPageSize",(function(e){var t=e.doc,n=e.pageIndex;PageSize.Width=0,PageSize.Height=0,Module._GetPageSizeForIndex(t,n);var r=Module._GetPage(t,n),o=Module._GetPageRotation(r);return{pagePtr:r,width:PageSize.Width,height:PageSize.Height,rotation:90*o}})),e.on("InitAnnot",(function(e){for(var t=e.pagePtr,n=Module._GetAnnotCount(t),r=[],o=0;o<n;o++){var a=Module._InitAnnot(t,o);if(a)if(!Module._IsReplyAnnot(a)){var i={annotPtr:a,type:Module._GetAnnotType(a),pagePtr:t};r.push(i)}}return{annotCount:r.length,annotations:r}})),e.on("GetAnnotation",(function(e){return function(e){var t=e.doc,n=e.pagePtr,r=e.annotPtr,o=e.typeInt;e.scale;var a=null;Rect={},Module._GetAnnotRect(n,r);var i={left:h(Rect.Left),top:h(Rect.Top),right:h(Rect.Right),bottom:h(Rect.Bottom)};Module._GetAnnotCreationDate(r);var u=A(U8StringData);Module._GetAnnotContent(r);var l=U8StringData;Module._GetAnnotTitle(r);var d=U8StringData;Module._GetAnnotAuthor(r);var c=U8StringData,f=h(Module._GetAnnotTransparency(r)),p={date:u,contents:l,rect:i,opacity:f,title:d,author:c},g=ze(n,r),P=g.replies,M=g.reviewAnnotState,m=g.markedAnnotState;P.length&&(p.replies=P);M&&(p.reviewAnnotState=M);m&&(p.markedAnnotState=m);switch(o){case x.TEXT:if(RGBColor={},Module._GetAnnotRGBColor(r)){var v=RGBColor,I=y(v.R,v.G,v.B);p.textColor=I}return p;case x.LINK:var C=Module._GetLinkActionType(r);if(p.actionType=L[C],RGBColor={},Module._GetAnnotFilledRGBColor(r)){var _=RGBColor,b=y(_.R,_.G,_.B);p.fillColor=b}return 1===C?(PDFDestination={},Module._GetLinkDestination(t,r),p.destPage=PDFDestination.PageIndex+1,p.url=""):6===C&&(Module._GetLinkUri(r),p.url=U8StringData,p.destPage=""),p;case x.FREETEXT:FontDa={},Module._GetFreeTextFont(r);var G=U8StringData,T=/bold/i.test(G)?"bold":"normal",E=/(oblique|italic)/i.test(G)?"oblique":"normal";p.fontName=G.split("-")[0],p.fontStyle=E,p.fontWeight=T,p.fontSize=FontDa.fontSize,p.borderWidth=Module._GetAnnotBorderWidth(r),RGBColor={},Module._GetFreeTextBorderColor(r)&&(p.borderColor=y(RGBColor.R,RGBColor.G,RGBColor.B)),p.fillOpacity=Module._GetAnnotFilledTransparency(r);var R=Module._GetTextAlignment(r);p.textAlignment=S[R];var B=FontDa,U=y(B.R,B.G,B.B);p.color=U,Module._GetFreeTextContent(r);var O=U8StringData;if(p.contents=O,RGBColor={},Module._GetFreeTextBgColor(r)){var H=RGBColor,Y=y(H.R,H.G,H.B);p.fillColor=Y}return p;case x.LINE:LinePoint={},Module._GetLinePoint(n,r);var Q=[LinePoint.StartPointX,LinePoint.StartPointY,LinePoint.EndPointX,LinePoint.EndPointY];if(p.linePoints=Q,LineType={},Module._GetLineType(r),p.tail=F[LineType.Tail],p.head=F[LineType.Head],RGBColor={},Module._GetAnnotRGBColor(r)&&(p.color=y(RGBColor.R,RGBColor.G,RGBColor.B)),RGBColor={},Module._GetAnnotBorderRGBColor(r)&&(p.borderColor=y(RGBColor.R,RGBColor.G,RGBColor.B)),p.borderWidth=Module._GetAnnotBorderWidth(r),(BorderStyle={}).DashArray=[],Module._GetAnnotBorderStyle(r),p.dashes=BorderStyle.DashArray,BorderStyle.Style&&(p.borderStyle=N[BorderStyle.Style]),Module._isMeasured(r)){p.measure=1,p.rulerPtr=Module._initRuler(t,r,W.DISTANCE);var K=et(r,p.rulerPtr,w[o]);Object.assign(p,K)}return p;case x.ARC:case x.SQUARE:case x.POLYGON:if(p.vertices=rt({pagePtr:n,annotPtr:r}),4===p.vertices.length){var q=s(p.vertices,4),J=q[0],X=q[1],j=q[2],Z=q[3];J.y===X.y&&X.x===j.x&&j.y===Z.y&&Z.x===J.x&&(p.type="rectangle")}if(RGBColor={},Module._GetAnnotRGBColor(r)&&(p.color=y(RGBColor.R,RGBColor.G,RGBColor.B)),RGBColor={},Module._GetAnnotFilledRGBColor(r)&&(p.fillColor=y(RGBColor.R,RGBColor.G,RGBColor.B)),RGBColor={},Module._GetAnnotBorderRGBColor(r)&&(p.borderColor=y(RGBColor.R,RGBColor.G,RGBColor.B)),p.fillTransparency=Module._GetAnnotFilledTransparency(r),p.borderWidth=Module._GetAnnotBorderWidth(r),(BorderStyle={}).DashArray=[],Module._GetAnnotBorderStyle(r),p.dashes=BorderStyle.DashArray,BorderStyle.Style&&(p.borderStyle=N[BorderStyle.Style]),Module._isMeasured(r)){p.measure=1,p.rulerPtr=Module._initRuler(t,r,W.AREA);var V=et(r,p.rulerPtr,w[o]);return Object.assign(p,V),p}return 5===o?p.type="square":29===o&&(p.type="arc"),p;case x.POLYLINE:if(p.vertices=rt({pagePtr:n,annotPtr:r}),RGBColor={},Module._GetAnnotRGBColor(r)&&(p.color=y(RGBColor.R,RGBColor.G,RGBColor.B)),RGBColor={},Module._GetAnnotBorderRGBColor(r)&&(p.borderColor=y(RGBColor.R,RGBColor.G,RGBColor.B)),p.borderWidth=Module._GetAnnotBorderWidth(r),(BorderStyle={}).DashArray=[],Module._GetAnnotBorderStyle(r),p.dashes=BorderStyle.DashArray,BorderStyle.Style&&(p.borderStyle=N[BorderStyle.Style]),Module._isMeasured(r)){p.measure=1,p.rulerPtr=Module._initRuler(t,r,W.PERIMETER);var z=et(r,p.rulerPtr,w[o]);return Object.assign(p,z),p}return p;case x.CIRCLE:if(p.borderWidth=Module._GetAnnotBorderWidth(r),BorderStyle.DashArray=[],Module._GetAnnotBorderStyle(r),p.dashes=BorderStyle.DashArray,RGBColor={},Module._GetAnnotRGBColor(r)){var $=RGBColor,ee=y($.R,$.G,$.B);p.borderColor=ee}if(RGBColor={},Module._GetAnnotFilledRGBColor(r)){var te=RGBColor,ne=y(te.R,te.G,te.B);p.fillColor=ne}if(p.fillTransparency=Module._GetAnnotFilledTransparency(r),Module._isMeasured(r)){LinePoint={},Module._GetLinePoint(n,r);var re=[LinePoint.StartPointX,LinePoint.StartPointY,LinePoint.EndPointX,LinePoint.EndPointY];p.linePoints=re,p.measure=1,p.rulerPtr=Module._initRuler(t,r,W.DISTANCE);var oe=et(r,p.rulerPtr,w[o]);Object.assign(p,oe)}return p;case x.HIGHLIGHT:case x.UNDERLINE:case x.SQUIGGLY:case x.STRIKEOUT:return a=function(e){var t=e.pagePtr,n=e.annotPtr;RGBColor={};var r={},o=Module._GetAnnotRGBColor(n);if(o){var a=RGBColor,i=y(a.R,a.G,a.B);r.color=i}return InkPointArray=[],Module._GetQuadPoints(t,n),r.quadPoints=InkPointArray,r}({pagePtr:n,annotPtr:r}),Object.assign(p,a),p;case x.STAMP:var ae=Module._GetStampType(r);return p.stampType=D[ae],0===ae?p.stampType="image":(TextStamp={},Module._GetTextStamp(r),p.stampColor=TextStamp.StampColor,p.stampShape=k[TextStamp.StampType],TextStamp.Date&&(p.time=TextStamp.Date)),p;case x.INK:if(RGBColor={},Module._GetAnnotRGBColor(r)){var ie=RGBColor,ue=y(ie.R,ie.G,ie.B);p.borderColor=ue}if(BorderStyle.DashArray=[],Module._GetAnnotBorderStyle(r),p.dashes=BorderStyle.DashArray,a=function(e){for(var t=e.pagePtr,n=e.annotPtr,r=Module._GetInkPathCount(n),o=[],a=0;a<r;a++)InkPointArray=[],Module._GetInkPoints(t,n,a),o.push(InkPointArray);var i=Module._GetAnnotBorderWidth(n);return{borderWidth:i,inkPointes:o}}({pagePtr:n,annotPtr:r}),Object.assign(p,a),3===a.inkPointes[0].length&&(p.arcPoints=a.inkPointes[0].map((function(e){return{x:e.PointX,y:e.PointY}}))),Module._isMeasured(r)){p.measure=1,p.rulerPtr=Module._initRuler(t,r,W.ARC);var le=et(r,p.rulerPtr,w[o]);Object.assign(p,le)}return p}return}({doc:e.doc,pagePtr:e.pagePtr,annotPtr:e.annotPtr,typeInt:e.typeInt,scale:e.scale})})),e.on("GetPermissionsInfo",(function(e){PermissionsInfo={};var t=e.doc;return Module._GetPermissionsInfo(t),PermissionsInfo})),e.on("CheckOwnerPassword",(function(e){var t=e.doc,n=e.pwd,r=stringToNewUTF8(n);return!!Module._CheckOwnerPassword(t,r)})),e.on("GetDynamicStampPreview",(function(e){var t=e.contents,n=e.time,r=e.stampShape,o=e.stampColor,a=Module._InitDocument();Module._CreateDocument(a),Module._InsertPage(a,0,595,842);var i=Module._GetPage(a,0),u=Module._CreateAnnot(a,i,13),l=stringToNewUTF8(t),d=stringToNewUTF8(n);Module._SetTextStamp(u,l,d,r,o,0),Module._UpdateAnnotAp(u,0),Rect={},Module._GetAnnotRect(i,u);for(var s=Rect,c=s.Left,f=s.Top,p=s.Right,g=s.Bottom,A=Math.ceil(p-c),h=Math.ceil(g-f),P=A*h,M=4*P,m=_malloc(M),v=0;v<P;v++)Module.HEAP32[m/4+v]=0;Module._RenderAnnot(u,A,h,m,0);var y=new Uint8Array(M);for(v=0;v<M;v+=4)y[v]=Module.HEAPU8[m+v+2],y[v+1]=Module.HEAPU8[m+v+1],y[v+2]=Module.HEAPU8[m+v],y[v+3]=Module.HEAPU8[m+v+3];return _free(m),{width:A,height:h,imageArray:y}})),e.on("GetRenderAnnot",(function(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.width,o=e.height,a=r*o,i=_malloc(4*a),u=0;u<a;u++)Module.HEAP32[i/4+u]=0;var l=function(e,t,n,r,o){var a,i;1===o||3===o?(a=r,i=n):(a=n,i=r);Module._RenderAnnot(e,a,i,t,0);for(var u=new Uint8Array(a*i*4),l=0;l<i;l++)for(var d=0;d<a;d++){var s=4*(l*a+d),c=void 0,f=void 0;switch(o){case 1:c=i-1-l,f=d;break;case 2:c=a-1-d,f=i-1-l;break;case 3:c=l,f=a-1-d;break;default:c=d,f=l}var p=4*(f*n+c);u[p]=Module.HEAPU8[t+s+2],u[p+1]=Module.HEAPU8[t+s+1],u[p+2]=Module.HEAPU8[t+s],u[p+3]=Module.HEAPU8[t+s+3]}return{imageArray:u,width:a,height:i}}(n,i,r,o,Module._GetPageRotation(t)),d=l.imageArray;return _free(i),d})),e.on("GetWidgetAnnotation",(function(e){return function(e){var t=e.doc,n=e.pagePtr,r=e.annotPtr;e.typeInt;var o=e.signaturePtrList;Rect={},Module._GetAnnotRect(n,r);var a={left:h(Rect.Left),top:h(Rect.Top),right:h(Rect.Right),bottom:h(Rect.Bottom)};Module._GetAnnotCreationDate(r);var i=A(U8StringData);Module._GetAnnotContent(r);var u=U8StringData,l=Module._GetWidgetType(r),d=Module._GetRequiredFlag(r),s={date:i,contents:u,rect:a,required:d,type:G[l]};RGBColor={};var c=Module._GetWidgetBackgroundRGBColor(r);if(c){var f=RGBColor,p=y(f.R,f.G,f.B);s.backgroundColor=p}else s.backgroundColor=null;RGBColor={};var g=Module._GetWidgetBorderRGBColor(r);if(g){var P=RGBColor,M=y(P.R,P.G,P.B);s.borderColor=M}else s.borderColor=null;var m=Module._GetWidgetBorderStyle(r);s.borderStyle=N[m],Module._GetWidgetFieldName(r);var v=U8StringData;s.fieldName=v;var I=Module._GetAnnotBorderWidth(r);s.borderWidth=I;var C=Module._GetAnnotFlag(r);if(s.flag=C,0===C)s.isHidden=0;else{var _=!(C&T),x=!(C&R),w=!(C&E);s.isHidden=_&&x&&w?0:1}if(1===l){var b=Module._GetWidgetCheckStyle(r);if(s.checkStyle=b,RGBColor={},Module._GetWidgetCheckRGBColor(r)){var B=RGBColor,F=y(B.R,B.G,B.B);s.checkRGBColor=F}var D=Module._GetCheckBoxIsChecked(r);s.isChecked=D}if(2===l){var L=Module._GetWidgetCheckStyle(r);s.checkStyle=L;var U=Module._GetRadioButtonIsChecked(r);s.isChecked=U}if(3===l){if(1===Module._GetTextFieldSpe(r))return null;Module._GetTextFieldContent(r);var k=U8StringData;s.contents=k;var O=Module._IsMultiLine(r);s.isMultiLine=O;var H=Module._GetWidgetTextJustification(r);s.textAlignment=S[H],FontDa={},ue(s,r,Module._GetAnnotFontDa(r));var Y=U8StringData,W=/bold/i.test(Y),Q=/(oblique|italic)/i.test(Y),K={fontName:Y.split("-")[0],fontSize:FontDa.fontSize,isBold:W,isItalic:Q};Object.assign(s,K)}if(0===l){Module._GetButtonTitle(r);var q=U8StringData;s.title=q;var J=Module._GetBtnActionType(r);Module._GetBtnActionNamedAction(r);var X=U8StringData;if(s.actionName=X,1===J){var j=Module._GetBtnActionDestPage(t,r);s.destPage=j+1}else if(6===J){Module._GetBtnActionURI(r);var Z=U8StringData;s.url=Z}s.actionType=J,FontDa={},ue(s,r,Module._GetAnnotFontDa(r));var V=U8StringData,z=/bold/i.test(V),$=/(oblique|italic)/i.test(V),ee={fontName:V.split("-")[0],fontSize:FontDa.fontSize,isBold:z,isItalic:$};Object.assign(s,ee)}if(4===l||5===l){WidgetItem={},Module._GetItemsSelectedItem(r),s.selectedItem={values:WidgetItem.Values,strings:WidgetItem.Strings};var te=Module._GetItemsCount(r);s.itemsCount=te,WidgetItemsArray=[],Module._GetWidgetItems(r),s.items=WidgetItemsArray,Module._GetItemsSelectedValue(r);var ne=U8StringData;if(ne){for(var re=0;re<WidgetItemsArray.length;re++)if(WidgetItemsArray[re].Value===ne){s.selected=re;break}}else s.selected=null;FontDa={},ue(s,r,Module._GetAnnotFontDa(r));var oe=U8StringData,ae=/bold/i.test(oe),ie=/(oblique|italic)/i.test(oe),le={fontName:oe.split("-")[0],fontSize:FontDa.fontSize,isBold:ae,isItalic:ie};Object.assign(s,le)}if(6===l){for(var de=0;de<o.length;de++){var se=o[de];Module._IsSameAnnotDict(se,r)&&(SignerArray=[],Module._GetSigner(se),SignerArray.length&&(s.isSignedDigitally=!0),s.signaturePtr=se)}s.isSigned=Module._IsStampSignature(r)}return s}({doc:e.doc,pagePtr:e.pagePtr,annotPtr:e.annotPtr,typeInt:e.typeInt,signaturePtrList:e.signaturePtrList})})),e.on("GetSignatures",(function(e){return function(e){return de.apply(this,arguments)}(e)})),e.on("UpdateDigitalSignAp",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,M,m;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAYAAACHjumMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA9kSURBVHgB7d1vbJXlGcfx635KpUWqJWgiZGgxg2ZG52k1pmqmJdYl6kZwW8S5F4hlKvGFmG3RZWYU4wuX7QUsMdpsSn3j3LJMo3FLJobqMmMWpDUuS4BkdpKAyWAFi4JAz737Oj2Hlv45PX+e+/x57u8nOZ4/Lbw4nvPjuq77fp7HSAy67x9tPSWyzhhJpSNzhbGSsmJa3fNWAeqBtSNiZMSk7YfWyLCkZfD9gSUjgrIYKVEmVKLoUTG22/013QIkjBE7bK3dQdiUruiAyQWLFdlChYJgWBmQdHobQVOcogKm64HjWwkWBM1K3/svXrxNUJCCAqbr/tE20xC96sIlJUDorIy4amYN1cz8ovl+oav3sw02ioYIFyDLSJttiIZu7B1dJ8grb8BoS+TieoCWCDifK/1brUSvTnxHMJc5W6TMG2ekTwDkx1xmTrMGjJZ+ms4CoEDm/vdfuOglwXlmBIwOdHXmQlsEFM7NKI+Z8XQHg9/zzZzBRNFuwgUojs5kdKVVcJ7zAiY7d2kTAEXTldauB0b7BOeca5G0NZKG6GMBUDJtlZrH0ysHB5YcE0ypYFgxAsqmrdKpSLYIMjIVDNULEB+qmElR9r/dAiAWVDGTMgFjTPSoAIiPabhVIIb2CPCjaTy9JPQ2KaI9AvxwbVLwB0NGenpLARA7vlsuYGxkrhUAsUtHUZsELnJraisFQOxcBRP8P96RW0K6QgDEznJM3/xntANQGt0PI4EjYA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ymoGC0TAiaVi1p2ZGvJZrxRwRFyVQz49Ln3roNAoQgGyzpBU3bs2cfKPyPCkqiQSNp6TbWbHFPrxUgaax9xwXEYCnBkkPAxCAXNpE1KWttyr2rbe6tvUKAeuAqFDdfPO5uw8aYkbSe5TFqeq3UUJnq/zPmsRQ9GquGAAAAAElFTkSuQmCC"),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=r,t.imageBase64&&"image"===t.appearance?je(t):Ve(t),o=t.pkcs12Buffer,a=t.password,i=t.annotPtr,u=t.doc,ComPDFKitJS.opened_cert[0]=o,l=stringToNewUTF8(a),d=Module._GetPKCS12Cert(l,0,o.length),(DataArray=[]).push(ComPDFKitJS.opened_files[0]),s=Module._InitSignature2(i),Module._AddSignSaveDocument(u,s,d),c=[],f=0;f<DataArray.length;f++)p=new Uint8Array(DataArray[f]),c.push(p);return g=new Blob(c,{type:"application/pdf"}),e.next=18,X(g);case 18:for(A=e.sent,h=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[h]=A,DataArray=[],Module._AddSignModifyDocument(s,d,h,A.length),c=[],P=0;P<DataArray.length;P++)M=new Uint8Array(DataArray[P]),c.push(M);return ComPDFKitJS.opened_files[0]=c,ComPDFKitJS.opened_files.splice(h,1),m=new Blob(c,{type:"application/pdf"}),e.abrupt("return",m);case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("CreateSignatureAP",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.rect,o=Module._InitDocument(),Module._CreateDocument(o),Module._InsertPage(o,0,595,842),Module._GetPageCount(o),a=Module._GetPage(o,0),Pe({annotPtr:i=Module._CreateWidget(o,a,6),date:new Date}),Me({pagePtr:a,annotPtr:i,rect:r}),Module._UpdateFormAp(i),t.annotPtr=i,Ve(t),u=r.width,l=r.height,s=4*(d=u*l),c=_malloc(s),f=0;f<d;f++)Module.HEAP32[c/4+f]=0;for(Module._RenderAnnot(i,u,l,c,0),p=new Uint8Array(s),f=0;f<s;f+=4)p[f]=Module.HEAPU8[c+f+2],p[f+1]=Module.HEAPU8[c+f+1],p[f+2]=Module.HEAPU8[c+f],p[f+3]=Module.HEAPU8[c+f+3];return _free(c),e.abrupt("return",p);case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("UpdateSignatureAP",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.doc,o=t.annotPtr,a=t.rect,i=t.pagePtr,u=t.imageBase64,l=t.imageArray,Me({pagePtr:i,annotPtr:o,rect:a}),d=l||u&&j(u),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=d,Module._RemoveAP(o),Module._SetImageStampByStream(o,0,d.length,0),Module._SetStampSignature(o),Module._WidgetRemoveFromFields(r,o);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("TestAddSignature",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,e.next=3,X(t.certFile);case 3:for(o=e.sent,ComPDFKitJS.opened_cert[0]=o,a=stringToNewUTF8("ComPDFKit"),i=Module._GetX509ByPKCS12Cert(0,o.length,a),u=Module._InitSignature2(annotPtr),DataArray=[],l=!!fontsJson||!!ComPDFKitJS.opened_DefFont[0],Module._SaveDocumentByStream(r,2,l),Module._AddSignSaveDocument(r,u,i),d=[],s=0;s<DataArray.length;s++)c=new Uint8Array(DataArray[s]),d.push(c);return f=new Blob(d,{type:"application/pdf"}),e.next=17,X(f);case 17:p=e.sent,g=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[g]=p,A=Module._InitDocument(),h=stringToNewUTF8(""),Module._LoadDocumentByStream(A,g,p.length,h);case 23:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("LoadCertificates",function(){var e=a(n().mark((function e(t){var r,o,a,i,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.pkcs12Buffer,o=t.password,ComPDFKitJS.opened_cert[0]=r,a=stringToNewUTF8(o),0!==(i=Module._GetX509ByPKCS12Cert(0,r.length,a))){e.next=6;break}return e.abrupt("return",!1);case 6:return e.next=8,Je(i);case 8:return u=e.sent,e.abrupt("return",u);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("AddSignature",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,M,m;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.pagePtr.pagePtr,e.next=4,X(t.certFile);case 4:for(a=e.sent,ComPDFKitJS.opened_cert[0]=a,i=stringToNewUTF8("ComPDFKit"),u=Module._GetPKCS12Cert(i,0,a.length),l={left:50,top:442,right:100,bottom:642},(DataArray=[]).push(ComPDFKitJS.opened_files[0]),Pe({annotPtr:d=Module._CreateWidget(r,o,6),date:new Date}),ke({annotPtr:d,fieldName:"signatureField1"}),Me({pagePtr:o,annotPtr:d,rect:l}),s=Module._InitSignature2(d),Module._AddSignSaveDocument(r,s,u),c=[],f=0;f<DataArray.length;f++)p=new Uint8Array(DataArray[f]),c.push(p);return g=new Blob(c,{type:"application/pdf"}),e.next=22,X(g);case 22:for(A=e.sent,h=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[h]=A,DataArray=[],Module._AddSignModifyDocument(s,u,1,ComPDFKitJS.opened_files[1].length),c=[],P=0;P<DataArray.length;P++)M=new Uint8Array(DataArray[P]),c.push(M);return m=new Blob(c,{type:"application/pdf"}),e.abrupt("return",m);case 31:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("PushRenderTask",(function(e){var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=void 0===u?-1:u,d=e.flag,s=void 0===d?0:d,c=e.form,f=function(e){for(var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=e.flag,d=e.form,s=parseInt(o-r)*parseInt(a-i),c=4*s,f=_malloc(c),p=0;p<s;p++)Module.HEAP32[f/4+p]=0;Module._RenderPageBitmapWithMatrix(t,n,r,o,a,i,u,f,l,d);var g=Ae("PDF VIEWER RENDER");if(g.code)return _free(f),g;var A=new Uint8Array(c);for(p=0;p<c;p+=4)A[p]=Module.HEAPU8[f+p+2],A[p+1]=Module.HEAPU8[f+p+1],A[p+2]=Module.HEAPU8[f+p],A[p+3]=Module.HEAPU8[f+p+3];return _free(f),{imageArray:A}}({pagePtr:t,scale:n,left:r,right:o,bottom:a,top:i,mode:l,flag:s,form:void 0===c?0:c});return f})),e.on("RenderPageBitmap",(function(e){var t=function(e){for(var t=e.pagePtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.mode,u=e.flag,l=e.form,d=parseInt(o)*parseInt(a),s=4*d,c=_malloc(s),f=0;f<d;f++)Module.HEAP32[c/4+f]=0;Module._RenderPageBitmap(t,n,r,o,a,i,c,u,l);var p=Ae("PDF VIEWER RENDER");if(p.code)return _free(c),p;var g=new Uint8Array(s);for(f=0;f<s;f+=4)g[f]=Module.HEAPU8[c+f+2],g[f+1]=Module.HEAPU8[c+f+1],g[f+2]=Module.HEAPU8[c+f],g[f+3]=Module.HEAPU8[c+f+3];return _free(c),{imageArray:g}}({pagePtr:e.pagePtr,x:e.x,y:e.y,width:e.width,height:e.height,mode:-1,flag:1,form:1});return t})),e.on("EditAnnotation",(function(e){var t=e.annotation;if(t.rect&&Me(t),t.color&&(t.type&&"freetext"===t.type?function(e){var t=e.annotPtr,n=e.fontName,r=e.fontWeight,o=e.fontStyle,a=e.fontSize,i=e.color,u=e.textAlignment,l=e.contents,d=le({fontName:n,fontWeight:r,fontStyle:o}),s=_[u.toUpperCase()],c=stringToNewUTF8(d),f=stringToNewUTF8(l),p=v(i);Module._SetFreeText(t,c,a,p.R,p.G,p.B,s,f)}(t):Ie(t)),isFinite(t.opacity)&&we(t),"contents"in t&&"mod-form"===t.operate){var n=Qe(t);if(n)return n}if("contents"in t&&"mod-annot"===t.operate&&(t.type&&"freetext"===t.type?function(e){var t=e.annotPtr,n=e.contents,r=stringToNewUTF8(n);Module._SetFreeTextContent(t,r)}(t):ye(t)),"fillColor"in t&&(t.type&&"freetext"===t.type?Se(t):xe({annotPtr:t.annotPtr,fillColor:t.fillColor})),"borderWidth"in t&&be({annotPtr:t.annotPtr,borderWidth:t.borderWidth}),t.borderColor&&(t.type&&"freetext"===t.type?Ce(t):_e({annotPtr:t.annotPtr,borderColor:t.borderColor})),"arcPoints"in t&&tt({pagePtr:t.pagePtr,annotPtr:t.annotPtr,vertices:t.arcPoints}),t.linePoints&&Ee(t),t.inkPointes&&Re(t),t.destPage&&"mod-annot"===t.operate&&Be(t),t.destPage&&"mod-form"===t.operate&&Ye(t),t.url&&"mod-annot"===t.operate&&Fe(t),t.url&&"mod-form"===t.operate&&We(t),(t.isHidden||0===t.isHidden)&&function(e){var t=e.annotPtr,n=e.isHidden,r=0;r=1==n?2:4;var o=Module._SetAnnotFlag(t,r)}(t),"required"in t&&function(e){var t=e.annotPtr,n=e.required;Module._SetRequiredFlag(t,n)}(t),t.isChecked||0===t.isChecked)if("checkbox"===t.type){var r=De(t);if(r)return r}else if("radiobutton"===t.type){var o=Le(t);if(o)return o}if(t.checkStyle&&Ue(t),t.backgroundColor&&"mod-form"===t.operate&&Ne(t),t.title&&"mod-form"===t.operate){var a=t.annotPtr,i=t.title,u=stringToNewUTF8(i);Module._SetButtonTitle(a,u)}if(t.fieldName&&ke(t),t.fontName&&"freetext"!==t.type&&Oe({annotPtr:t.annotPtr,fontName:t.fontName,fontSize:t.fontSize,color:t.color}),t.item&&Ke(t),t.moveOption&&function(e){var t=e.annotPtr,n=e.moveOption,r=n.fromIndex,o=n.toIndex,a=n.item;(function(e){var t=e.annotPtr,n=e.index;Module._RemoveOptionItem(t,n)})({annotPtr:t,index:r}),Ke({annotPtr:t,item:{value:a.Value,index:o}})}(t),t.selected||0===t.selected){var l=He(t);if(l)return l}if(t.hasOwnProperty("deleteItemIndex")&&function(e){var t=e.annotPtr,n=e.deleteItemIndex;if(Module._RemoveOptionItem(t,n),0===Module._GetItemsCount(t))return;He({annotPtr:t,selected:0})}(t),t.textAlignment&&"mod-form"===t.operate){var d=t.annotPtr,s=t.textAlignment,c=_[s.toUpperCase()];Module._SetWidgetTextJustification(d,c)}if(t.hasOwnProperty("isMultiLine")){var f=t.annotPtr,p=t.isMultiLine;Module._SetMultiLine(f,p)}t.author&&me(t),t.borderColor&&_e(t),Object.hasOwn(t,"fillColor")&&xe(t),t.fillTransparency&&Ge(t),t.quadPoints&&Te(t),t.borderStyle&&t.dashes&&nt(t),t.vertices&&tt(t),null==t.head&&null==t.tail||Module._SetLineType(t.annotPtr,B[t.head.toUpperCase()],B[t.tail.toUpperCase()]);var g=Module._GetPageRotation(t.pagePtr);"mod-annot"===t.operate?Module._UpdateAnnotAp(t.annotPtr,g):"mod-form"===t.operate&&Module._UpdateFormAp(t.annotPtr,g)})),e.on("FlattenPage",(function(e){var t=function(e){return he.apply(this,arguments)}({doc:e.doc,saveType:e.saveType,password:e.password,oldPassword:e.oldPassword});return t})),e.on("CreateAnnotation",(function(e){var t=e.doc,n=e.pagePtr,r=e.annotation;return"add-form"===r.operate?function(e,t,n){var r=n.type,o=n.date,a=n.fieldName,i=n.backgroundColor,u=n.checkStyle,l=n.rect,d=b[r.toUpperCase()],s=Module._CreateWidget(e,t,d),c=Ae("PDF FORM");if(c.code)return c;n.annotPtr=s,o&&Pe({annotPtr:s,date:o});i&&Ne({annotPtr:s,backgroundColor:i});u&&Ue({annotPtr:s,checkStyle:u});a&&ke({annotPtr:s,fieldName:a});var f=n.borderColor,p=n.borderWidth,g=n.borderStyle,A=n.isChecked,h=n.color,P=n.fontName,M=n.fontSize;(f||g||p)&&(!f&&(f="#43474D"),!g&&(g="solid"),!p&&0!==p&&(p=1),function(e){var t=e.annotPtr,n=e.borderColor,r=e.borderWidth,o=e.borderStyle;if(n){var a=v(n);Module._SetWidgetBorderRGBColor(t,a.R,a.G,a.B)}if(o){var i=U[o];Module._SetWidgetBorderStyle(t,i)}(0===r||r)&&be({annotPtr:t,borderWidth:r})}({annotPtr:s,borderColor:f,borderWidth:p,borderStyle:g}));switch(r){case"checkbox":(A||0===A)&&De({annotPtr:s,isChecked:A});break;case"radiobutton":(A||0===A)&&Le({annotPtr:s,isChecked:A});break;case"listbox":case"combobox":for(var m=n.items,y=n.selected,I=0;I<m.length;I++)Ke({annotPtr:s,item:{value:m[I].Value,index:I}});Oe({annotPtr:s,fontName:P,fontSize:M,color:h}),(y||0===y)&&He({annotPtr:s,selected:y});break;case"pushbutton":Oe({annotPtr:s,fontName:P,fontSize:M,color:h});var C=n.title,S=stringToNewUTF8(C);Module._SetButtonTitle(s,S),n.destPage&&Ye(n),n.url&&We(n);break;case"textfield":var x=n.isMultiLine,w=n.textAlignment,G=_[w.toUpperCase()];Module._SetMultiLine(s,x),Module._SetWidgetTextJustification(s,G),Module._SetTextFieldSpe(s,0),"contents"in n&&Qe({annotPtr:s,contents:n.contents}),Oe({annotPtr:s,fontName:P,fontSize:M,color:h})}if(Me({pagePtr:t,annotPtr:s,rect:l}),Module._UpdateFormAp(s),"signatureFields"===r){var T=n.imageBase64;if(T){var E=j(T);ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=E,Module._RemoveAP(s),Module._SetImageStampByStream(s,0,E.length,0),Module._SignWithName(s)}}return{annotPtr:s}}(t,n,r):function(e,t,n){var r=n.type,o=x[r.toUpperCase()],a=Module._CreateAnnot(e,t,o),i=Ae("PDF Annotation");if(i.code)return i;n.annotPtr=a;var u=n.color,l=n.borderColor,d=n.borderWidth,s=n.contents,c=n.date,f=n.opacity,p=n.fillTransparency,g=n.rect,A=n.author,h=n.fillColor,P=n.quadPoints,M=n.vertices,m=n.borderStyle,y=n.dashes;u&&"freetext"!==r&&Ie({annotPtr:a,color:u});l&&"freetext"!==r&&_e({annotPtr:a,borderColor:l});h&&"freetext"!==r&&xe({annotPtr:a,fillColor:h});s&&"freetext"!==r&&ye({annotPtr:a,contents:s});Pe({annotPtr:a,date:c}),isFinite(f)&&we({annotPtr:a,opacity:f});p&&Ge({annotPtr:a,fillTransparency:p});g&&Me({pagePtr:t,annotPtr:a,rect:g});A&&me({annotPtr:a,author:A});P&&Te({pagePtr:t,annotPtr:a,quadPoints:P});d&&be({annotPtr:a,borderWidth:d});m&&y&&nt({annotPtr:a,borderWidth:d,borderStyle:m,dashes:y});switch(o){case x.TEXT:break;case x.LINK:n.destPage&&Be(n),n.url&&Fe(n);break;case x.FREETEXT:var I=n.color,C=void 0===I?"rgb(0, 0, 0":I,S=n.fontSize,w=void 0===S?16:S,b=n.fontName,G=void 0===b?"Helvetica":b,T=n.fontStyle,E=void 0===T?"normal":T,R=n.fontWeight,F=void 0===R?"normal":R,D=n.textAlignment,L=void 0===D?"left":D;n.borderWidth;var U=n.borderColor,N=void 0===U?"rgb(0, 0, 0)":U,k=n.fillColor,O=void 0===k?"":k,H=n.contents;!function(e){var t=e.annotPtr,n=e.fontName,r=e.fontWeight,o=e.fontStyle,a=e.fontSize,i=e.color,u=e.textAlignment,l=e.contents,d=le({fontName:n,fontWeight:r,fontStyle:o}),s=_[u.toUpperCase()],c=stringToNewUTF8(d),f=stringToNewUTF8(l),p=v(i);Module._SetFreeText(t,c,a,p.R,p.G,p.B,s,f),Module._SetFreeTextType(t,0),Module._SetFreeTextBorderColor(t,0)}({annotPtr:a,color:C,fontName:G,fontSize:w,fontStyle:E,fontWeight:F,textAlignment:L,contents:void 0===H?"":H}),"fillColor"in n&&Se({annotPtr:a,fillColor:O}),"borderWidth"in n&&be({annotPtr:n.annotPtr,borderWidth:n.borderWidth}),"borderColor"in n&&Ce({annotPtr:a,borderColor:N});break;case x.POLYLINE:case x.POLYGON:M&&tt({pagePtr:t,annotPtr:a,vertices:M});break;case x.LINE:var Y=n.head,W=n.tail,Q=n.linePoints;null==Y&&null==W||Module._SetLineType(a,B[Y.toUpperCase()],B[W.toUpperCase()]),Ee({pagePtr:t,annotPtr:a,linePoints:Q});break;case x.SQUARE:case x.CIRCLE:!function(e){var t=e.annotPtr,n=e.borderWidth;be({annotPtr:t,borderWidth:n})}({annotPtr:a,borderWidth:d}),Ie({annotPtr:a,color:n.borderColor});break;case x.HIGHLIGHT:case x.UNDERLINE:case x.SQUIGGLY:case x.STRIKEOUT:var K=n.quadPoints;!function(e){var t=e.pagePtr,n=e.annotPtr,r=e.color,o=e.quadPoints;Ie({annotPtr:n,color:r}),Te({pagePtr:t,annotPtr:n,quadPoints:o})}({pagePtr:t,annotPtr:a,color:n.color,quadPoints:K});break;case x.STAMP:var q=n.stampType,J=Module._GetPageRotation(t);if("standard"===q){var X=function(e,t){var n=e.annotPtr,r=e.contents,o=stringToNewUTF8(r.replace(/ /g,""));Module._SetStandardStamp(n,o,t);var a=Ae("PDF Annotation STAMPS");if(a.code)return a}({annotPtr:a,contents:s},J);if(X)return X}else if("text"===q){n.annotPtr=a;var Z=function(e,t){var n=e.annotPtr,r=e.contents,o=e.time,a=e.stampShape,i=e.stampColor,u=stringToNewUTF8(r),l=stringToNewUTF8(o);Module._SetTextStamp(n,u,l,a,i,t);var d=Ae("PDF Annotation STAMPS");if(d.code)return d}(n,J);if(Z)return Z}else if("image"===q){n.annotPtr=a,n.doc=e;var V=function(e,t){var n=e.annotPtr,r=e.imageBase64;e.stampShape,e.rect,e.doc;var o=j(r);ye({annotPtr:n,contents:"image"}),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=o,Module._SetImageStampByStream(n,0,o.length,t);var a=Ae("PDF Annotation STAMPS");if(a.code)return a}(n,J);if(V)return V}break;case x.INK:var z=n.inkPointes,$=n.borderColor;$&&Ie({annotPtr:a,color:$}),Re({pagePtr:t,annotPtr:a,inkPointes:z});break;case x.ARC:tt({pagePtr:t,annotPtr:a,vertices:n.arcPoints})}g&&Me({pagePtr:t,annotPtr:a,rect:g});var ee=Module._GetPageRotation(t);return Module._UpdateAnnotAp(n.annotPtr,ee),{annotPtr:a}}(t,n,r)})),e.on("GetAnnotRect",(function(e){var t=e.pagePtr,n=e.annotPtr;return Rect={},Module._GetAnnotRect(t,n),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom}})),e.on("SetAnnotRect",(function(e){var t=e.pagePtr,n=e.annotPtr,r=e.rect;Module._SetAnnotRect(t,n,r.left,r.right,r.bottom,r.top)})),e.on("RemoveAnnot",(function(e){var t=e.annotPtr;Module._RemoveAnnot(t);var n=Ae("PDF Annotation");if(n.code)return n})),e.on("RemoveFromPageIncludeReplyAnnot",(function(e){var t=e.pagePtr,n=e.annotPtr;Module._RemoveFromPageIncludeReplyAnnot(t,n);var r=Ae("PDF Annotation");if(r.code)return r})),e.on("GetCharIndexAtPos",(function(e){var t=e.pagePtr,n=e.textPtr,r=e.point,o=r.x,a=r.y;return-1!==Module._GetCharIndexAtPos(t,n,o,a,5,5)})),e.on("GetCharsRangeAtPos",(function(e){var t=e.pagePtr,n=e.textPtr,r=e.start,o=e.end;PDFRange={},Module._GetCharsRangeAtPos(t,n,r.x,r.y,o.x,o.y,5,5);var a=Module._GetTextContent(n,PDFRange.Location,PDFRange.Length),i=UTF8ToString(a);return TextRectArray=[],Module._GetRects(t,n,PDFRange.Location,PDFRange.Length),{textContent:i,textRects:TextRectArray}})),e.on("GetSelectionForWordAtPos",(function(e){var t=e.pagePtr,n=e.textPtr,r=e.start;e.end,Rect={},PDFRange={};var o=Module._GetSelectionForWordAtPos(t,n,r.x,r.y,5,5),a=UTF8ToString(o);return TextRectArray=[],Module._GetRects(t,n,PDFRange.Location,PDFRange.Length),{textContent:a,textRects:TextRectArray}})),e.on("XFDFExportAnnotations",(function(e){var t=function(e){XFDFData={},Module._XFDFExportAnnotations(e);var t=Ae("PDF Annotation XFDF");if(t.code)return t;return XFDFData}(e.doc);return t})),e.on("XFDFImportAnnotations",(function(e){var t=e.doc,n=e.xfdfBuffer,r=_malloc(n.length);Module.HEAPU8.set(n,r),Module._XFDFImportAnnotaitons(t,r,n.length),_free(r);var o=Ae("PDF Annotation XFDF");if(o.code)return o})),e.on("SaveDocumentByStream",(function(e){return pe(e)})),e.on("SetPassword",(function(e){var t=e.doc,n=e.password,r=stringToNewUTF8(n);Module._SetPassword(t,r,"","","","","","")})),e.on("CompareDocument",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,M,m,v,y,I,C,S,_,x,w,b,G,T,E,R,B,F,D,L,U,N,k,O,H,Y,W,Q,K,q,J,j;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.data,o=r.leftFile,a=r.rightFile,i=r.leftFilePassword,u=r.rightFilePassword,e.next=4,X(o);case 4:return l=e.sent,d=Module._InitDocument(),ComPDFKitJS.opened_files[1]=l,s=stringToNewUTF8(i),Module._LoadDocumentByStream(d,1,l.length,s),c=Module._GetPageCount(d),e.next=12,X(a);case 12:if(f=e.sent,p=Module._InitDocument(),ComPDFKitJS.opened_files[2]=f,g=stringToNewUTF8(u),Module._LoadDocumentByStream(p,2,f.length,g),A=Module._GetPageCount(p),h=Math.min(c,A),1!==r.type){e.next=58;break}P=r.replaceColor,M=r.insertColor,m=r.deleteColor,v=r.textCompare,y=r.imgCompare,I=Module._InitCompare(d,p),C=0,v&&y?C=2:y&&(C=1),S=ee(P),_=ee(M),x=ee(m),Module._SetReplaceResColor(I,255*S.R,255*S.G,255*S.B),Module._SetInsertResColor(I,255*_.R,255*_.G,255*_.B),Module._SetDeleteResColor(I,255*x.R,255*x.G,255*x.B),Module._SetReplaceResTransparency(I,127.5),Module._SetInsertResTransparency(I,127.5),Module._SetDeleteResTransparency(I,127.5),w=0;case 34:if(!(w<h)){e.next=47;break}if(b=Module._DoCompare(I,w,w,C,1),!(G=Ae("PDF COMPARE"))||!G.code){e.next=39;break}return e.abrupt("return",G);case 39:Module._GetCompareResultsCount(b,1),CompareResultArray=[],Module._GetCompareResults(d,p,b,1),ResultsCountParams={},Module._GetResultsCountParams(b);case 44:w++,e.next=34;break;case 47:for(DataArray=[],Module._GenerateNewDoc(I),T=[],E=0;E<DataArray.length;E++)R=new Uint8Array(DataArray[E]),T.push(R);return DataArray=[],B=new Blob(T,{type:"application/pdf"}),F=fe(d,2),D=fe(p,2),e.abrupt("return",{oldDocument:F,newDocument:D,blobData:B});case 58:if(2!==r.type){e.next=82;break}if(L=r.inColor,U=r.newColor,N=r.inTransparency,k=r.newTransparency,O=r.coverType,H=Module._InitCompareDrawing(d,p),Module._SetBlendMode(H,O),Module._SetNoFill(H,1),Y=N/100,W=k/100,Module._SetStrokeAlphaCompare(H,Y),Module._SetStrokeAlphaCompared(H,W),Module._SetFillAlphaCompare(H,Y),Module._SetFillAlphaCompared(H,W),Q=ee(L),K=ee(U),Module._SetColorCompare(H,255*Q.R,255*Q.G,255*Q.B),Module._SetColorCompared(H,255*K.R,255*K.G,255*K.B),Module._CompareContent(H),!(q=Ae("PDF COMPARE"))||!q.code){e.next=77;break}return e.abrupt("return",q);case 77:return J=Module._GetDocGenerate(H),e.next=80,pe({doc:J});case 80:return j=e.sent,e.abrupt("return",{blobData:j});case 82:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("GetOutlines",(function(e){var t=e.doc,n=[];return ae(t,Module._GetOutlineRoot(t),n,-1),n})),e.on("InitText",(function(e){var t=e.pagePtr;return Module._InitText(t)})),e.on("ClearText",(function(e){var t=e.textPtr;Module._ClearText(t)})),e.on("ClearPage",(function(e){var t=e.pagePtr;Module._ClearPage(t)})),e.on("Search",(function(e){for(var t=e.pagesPtr,n=e.value,r=stringToNewUTF8(n),o=null,a=[],i=0;i<t.length;i++){var u=t[i],l=u.pageNumber,d=u.pagePtr,s=u.textPtr,c=Module._InitTextFind();if(Module._FindStart(s,c,r,0,0),(o=Ae("PDF VIEWER SEARCH")).code)return o;var f=1,p=0;do{if(TextFindItemArray=[],f=Module._FindNext(d,s,c)){for(var g=TextFindItemArray.length,A=[],h=0;h<g;h++){var P=TextFindItemArray[h],M=P.Left,m=P.Top,v=P.Right,y=P.Bottom;A.push({left:M,top:m,right:v,bottom:y})}a.push({pageNum:l,quads:A,content:TextFindItemArray[0].Content.replace(/\r?\n/gm," "),pageSearchIndex:p,searchValue:n}),p++}}while(f);Module._ClearTextFind(c)}return{searchResults:a}})),e.on("InitEditPage",(function(e){var t=e.pagePtr;return{editPagePtr:Module._InitEditPage(t),pagePtr:t}})),e.on("ClearEditPage",(function(e){Module._ClearEditPage(e)})),e.on("BeginEdit",(function(e){var t=e.editPagePtr,n=e.type;return Module._BeginEdit(t,n),Ae("PDF CONTENT EDIT")})),e.on("EndEdit",(function(e){Module._EndEdit(e)})),e.on("GetEditAreaCount",(function(e){return Module._GetEditAreaCount(e)})),e.on("GetEditArea",(function(e){var t=e.editPagePtr,n=e.index;return Module._GetEditArea(t,n)})),e.on("IsTextArea",(function(e){return Module._IsTextArea(e)})),e.on("IsImageArea",(function(e){return Module._IsImageArea(e)})),e.on("SetFrame",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.rect;Module._SetFrame(t,n,r.left,r.right,r.bottom,r.top,!0)})),e.on("GetFrame",(function(e){var t=e.pagePtr,n=e.editAreaPtr;return Rect={},Module._GetFrame(t,n),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom}})),e.on("GetBeginAndEndCharPlace",(function(e){return EditCharPlace={},EndEditCharPlace={},Module._GetBeginAndEndCharPlace(e),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetTextByRange",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return Module._GetTextByRange(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex),U8StringData})),e.on("GetText",function(){var e=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EditCharPlace={},EndEditCharPlace={},e.next=4,Module._GetBeginAndEndCharPlace(t);case 4:return e.next=6,Module._GetTextByRange(t,EditCharPlace.SectionIndex,EditCharPlace.LineIndex,EditCharPlace.RunIndex,EditCharPlace.CharIndex,EndEditCharPlace.SectionIndex,EndEditCharPlace.LineIndex,EndEditCharPlace.RunIndex,EndEditCharPlace.CharIndex);case 6:return e.abrupt("return",U8StringData);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("SelectCharsRangeAtPos",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.startPoint,o=e.endPoint;return EditCharPlace={},EndEditCharPlace={},Module._SelectCharsRangeAtPos(t,n,r.x,r.y,o.x,o.y),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetSectionAtPos",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.pointX,o=e.pointY;return EditCharPlace={},EndEditCharPlace={},Module._GetSectionAtPos(t,n,r,o),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetTextCursorPoints",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.char;return CursorPoints={},Module._GetTextCursorPoints(t,n,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex),CursorPoints})),e.on("GetPrevCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetPrevCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetNextCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetNextCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetUpCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetUpCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetDownCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetDownCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("InsertText",(function(e){var t=e.editAreaPtr,n=e.char,r=e.text;EditCharPlace={};var o=stringToNewUTF8(r);return Module._InsertText(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,o,!0),EditCharPlace})),e.on("BackSpaceChar",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},Module._BackSpaceChar(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,!0),EditCharPlace})),e.on("DeleteChar",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},Module._DeleteChar(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,!0),EditCharPlace})),e.on("DeleteChars",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return EditCharPlace={},Module._DeleteChars(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,!0),EditCharPlace})),e.on("GetSelectLineRectsCounts",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return Module._GetSelectLineRectsCounts(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex)})),e.on("GetSelectLineRects",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.start,o=e.end;return RectArray=[],Module._GetSelectLineRects(t,n,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o.SectionIndex,o.LineIndex,o.RunIndex,o.CharIndex),RectArray})),e.on("SetCharsFontColor",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=function(e){var t=m(e);if("hex"===t)return I(e);if("rgb"===t){var n=e.match(/(\d+),\s*(\d+),\s*(\d+)/);return n?{R:parseInt(n[1]),G:parseInt(n[2]),B:parseInt(n[3])}:{error:"Invalid RGB format"}}if("hsl"===t){var r=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(!r)return{error:"Invalid HSL format"};var o=parseInt(r[1]),a=parseInt(r[2])/100,i=parseInt(r[3])/100;return C(o,a,i)}console.error({message:"Invalid color value"})}(e.color);Module._SetCharsFontColor(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o.R,o.G,o.B,!0)})),e.on("SetCharsFontTransparency",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.opacity;Module._SetCharsFontTransparency(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o,!0)})),e.on("SetTextAligningSection",(function(e){var t=e.editAreaPtr,n=e.char,r=e.alignType;Module._SetTextAligningSection(t,r,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,!0)})),e.on("SetTextAligningRange",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.alignType;Module._SetTextAligningRange(t,o,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,!0)})),e.on("SetCharsFontSize",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.fontSize;Module._SetCharsFontSize(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o,!0,!0)})),e.on("SetFontFromNativeTrueTypeFont",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.fontFamily,a=stringToNewUTF8(o);Module._SetFontFromNativeTrueTypeFont(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,a,!0)})),e.on("RefreshRange",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return EditCharPlace={},EndEditCharPlace={},Module._RefreshRange(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("SetCharsFontStyle",function(){var e=a(n().mark((function e(t){var r,o,a,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.editAreaPtr,o=t.start,a=t.end,i=t.fontStyle,Module["_"+i](r,o.SectionIndex,o.LineIndex,o.RunIndex,o.CharIndex,a.SectionIndex,a.LineIndex,a.RunIndex,a.CharIndex,!0);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("CreateNewTextArea",(function(e){var t=e.pagePtr,n=e.editPagePtr,r=e.rect,o=e.fontData,a=e.alignType;return Module._CreateNewTextArea(t,n,r.left,r.right,r.bottom,r.top,stringToNewUTF8(o.fontName),o.fontSize,o.r,o.g,o.b,o.opacity,o.isBold,o.italic,a,!0)})),e.on("RemoveEditAreaByIndex",(function(e){var t=e.editPagePtr,n=e.editAreaIndex;Module._RemoveEditAreaByIndex(t,n,!0)})),e.on("RemoveEditArea",(function(e){var t=e.editPagePtr,n=e.editAreaPtr;Module._RemoveEditArea(t,n,!0)})),e.on("CopyArea",(function(e){var t=e.editPagePtr,n=e.editAreaPtr;return Module._CopyArea(t,n)})),e.on("PasteArea",(function(e){var t=e.pagePtr,n=e.editPagePtr,r=e.editAreaInfoPtr,o=e.rect,a=n;n||(a=Module._InitEditPage(t),Module._BeginEdit(a,3));var i=Module._PasteArea(t,a,r,o.left+5,o.top+5,!0);return n||(Module._EndEdit(a),Module._ClearEditPage(a)),i})),e.on("GetCopyAreaContent",(function(e){var t=e.editPagePtr,n=e.editAreaInfoPtr;return Module._GetCopyAreaContent(t,n),U8StringData})),e.on("GetTextStyle",(function(e){var t=e.editAreaPtr,n=e.char;return EditTextStyle={},Module._GetTextStyle(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),EditTextStyle})),e.on("GetBaseFontName",(function(e){var t=e.editAreaPtr,n=e.char;return Module._GetBaseFontName(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),U8StringData})),e.on("createEditorDoc",function(){var e=a(n().mark((function e(t){var r,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.password,e.next=3,se(r,o);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("GetTextSectionAlignType",function(){var e=a(n().mark((function e(t){var r,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.editAreaPtr,o=t.char,e.abrupt("return",Module._GetTextSectionAlignType(r,o.SectionIndex,o.LineIndex,o.RunIndex,o.CharIndex));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("InsertPage",(function(e){var t=e.doc,n=e.index,r=e.width,o=e.height,a=Module._InsertPage(t,n,r,o),i=Ae("PDF EDITOR PAGE");return i.code?i:{status:a}})),e.on("ImportPagesAtIndex",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,c,f,p,g,A,h,P,M,m,v,y;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.file,a=t.range,i=t.index,u=t.password,e.next=3,X(o);case 3:if(l=e.sent,d=Module._InitDocument(),c=ComPDFKitJS.opened_files.length||0,ComPDFKitJS.opened_files[c]=l,f=stringToNewUTF8(u),Module._LoadDocumentByStream(d,c,l.length,f),p=Module._GetPageCount(d),A=!1,"all"===a?g="1-"+p:"odd"===a?g=Array.from({length:p},(function(e,t){return t+1})).filter((function(e){return e%2!=0})).join(","):"even"===a?g=Array.from({length:p},(function(e,t){return t+1})).filter((function(e){return e%2==0})).join(","):(h=p,P=a.replace(/\s/g,""),M=P.split(","),m=[],M.forEach((function(e){if(e.includes("-")){var t=e.split("-").map((function(e){return parseInt(e)})),n=s(t,2),r=n[0],o=n[1];if(r<=0&&(A=!0),r>h)return;o>h&&(o=h),m.push(r===h?r.toString():"".concat(r,"-").concat(o))}else{var a=parseInt(e);a<=0&&(A=!0),a<=h&&m.push(a.toString())}})),g=m.join(",")),g&&!A){e.next=14;break}return e.abrupt("return",0);case 14:if(g=stringToNewUTF8(g),v=Module._ImportPagesAtIndex(r,d,g,i),!(y=Ae("PDF EDITOR PAGE")).code){e.next=19;break}return e.abrupt("return",y);case 19:return ComPDFKitJS.opened_files.pop(),e.abrupt("return",{status:v});case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("RemovePage",(function(e){var t=e.doc,n=e.index,r=Module._RemovePage(t,n),o=Ae("PDF EDITOR PAGE");return o.code?o:{status:r}})),e.on("RotatePage",(function(e){var t=e.pagePtr,n=e.rotation;Module._RotatePage(t,n);var r=Ae("PDF EDITOR PAGE");if(r.code)return r})),e.on("GetPageWithoutParse",(function(e){var t=e.doc,n=e.index;return Module._GetPageWithoutParse(t,n)})),e.on("CopyPage",(function(e){var t=e.doc,n=e.index,r=stringToNewUTF8(n+1+""),o=Module._ImportPagesAtIndex(t,t,r,n+1),a=Ae("PDF EDITOR PAGE");return a.code?a:{status:o}})),e.on("GetPageRotation",(function(e){return Module._GetPageRotation(e)})),e.on("ClearDocument",(function(e){Module._ClearDocument(e),ComPDFKitJS.opened_files=[]})),e.on("ExtractPage",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.doc,o=t.range,a=t.separateFile,i=[],!a){e.next=20;break}u=0;case 4:if(!(u<o.length)){e.next=18;break}if(l=o[u]+1+"",d=stringToNewUTF8(l),s=Module._InitDocument(),Module._CreateDocument(s),Module._ImportPagesAtIndex(s,r,d,0),!(c=Ae("PDF EDITOR PAGE")).code){e.next=13;break}return e.abrupt("return",c);case 13:f=fe(s,2),i.push({name:l,blobData:f});case 15:u++,e.next=4;break;case 18:e.next=29;break;case 20:if(p=stringToNewUTF8(o),g=Module._InitDocument(),Module._CreateDocument(g),Module._ImportPagesAtIndex(g,r,p,0),!(A=Ae("PDF EDITOR PAGE")).code){e.next=27;break}return e.abrupt("return",A);case 27:h=fe(g,2),i.push(h);case 29:return e.abrupt("return",{blobDataList:i});case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("MovePage",(function(e){var t=e.doc,n=e.index,r=e.targetIndex,o=Module._MovePage(t,n,r),a=Ae("PDF EDITOR PAGE");return a.code?a:{status:o}})),e.on("CreateNewImageAreaByStream",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.pagePtr,o=t.editPagePtr,a=t.rect,i=t.imageBase64,u=j(i),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=u,l=Module._CreateNewImageAreaByStream(r,o,a.left,a.right,a.bottom,a.top,0,u.length,!0),(d=Module._GetPageRotation(r))%4!=0&&(s=90*d,Module._RotateImage(l,s,!1)),e.abrupt("return",l);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("ReplaceImageAreaByStream",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.pagePtr,o=t.editPagePtr,a=t.editAreaPtr,i=t.rect,u=t.imageBase64,l=j(u),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=l,e.abrupt("return",Module._ReplaceImageAreaByStream(r,o,a,i.left,i.right,i.bottom,i.top,0,l.length,!0));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("RotateImage",(function(e){var t=e.editAreaPtr,n=e.angle;return Module._RotateImage(t,n,!0)})),e.on("HorizontalMirrorImage",(function(e){return Module._HorizontalMirrorImage(e,!0)})),e.on("VerticalMirrorImage",(function(e){return Module._VerticalMirrorImage(e,!0)})),e.on("SetImageTransparency",(function(e){var t=e.editAreaPtr,n=e.opacity;return Module._SetImageTransparency(t,n,!0)})),e.on("GetImageTransparency",(function(e){return Module._GetImageTransparency(e)})),e.on("GetImageAreaSize",(function(e){return ImageAreaInfo={},Module._GetImageAreaSize(e),{width:ImageAreaInfo.Width,height:ImageAreaInfo.Height,stride:ImageAreaInfo.Stride}})),e.on("ExtractOriginalImage",(function(e){var t=function(e){for(var t=e.editAreaPtr,n=e.width,r=e.height,o=e.stride,a=parseInt(n)*parseInt(r),i=_malloc(o*r),u=0;u<a;u++)Module.HEAP32[i/4+u]=0;Module._GetImageAreaData(t,i);for(var l=new Uint8Array(o*r),d=0;d<r;d++)for(var s=0;s<n;s++){var c=d*o+4*s,f=d*n*4+4*s;l[f]=Module.HEAPU8[i+c+2],l[f+1]=Module.HEAPU8[i+c+1],l[f+2]=Module.HEAPU8[i+c],l[f+3]=Module.HEAPU8[i+c+3]}return _free(i),l}(e);return{imageArray:t}})),e.on("CutWithRect",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.rect;Module._CutWithRect(t,n,r.left,r.right,r.bottom,r.top,!0)})),e.on("GetClipRect",(function(e){var t=e.pagePtr,n=e.editAreaPtr;return Rect={},Module._GetClipRect(t,n),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom}})),e.on("SetClipRect",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.rect;Module._SetClipRect(t,n,r.left,r.right,r.bottom,r.top,!0)})),e.on("RemoveSignature",(function(e){var t=e.doc,n=e.signaturePtr;return Module._RemoveSignature(t,n,!0)})),e.on("AddToTrustedCertificates",(function(e){return function(e){var t=e.signerPtr,n=Module._GetSignCert(t);if(n){return CertArray=[],!!Module._ExportToFilePath(n,0)&&CertArray[0]}return!1}(e)})),e.on("CreateReplyAnnotation",(function(e){!function(e,t,n){var r=n.author,o=n.date,a=n.contents,i=n.title,u=Module._CreateReplyAnnotation(e,t);r&&me({annotPtr:u,author:r});a&&ye({annotPtr:u,contents:a});o&&Pe({annotPtr:u,date:o});i&&ve({annotPtr:u,title:i})}(e.pagePtr,e.annotPtr,e.reply)})),e.on("CreateReplyStateAnnotation",(function(e){var t=e.pagePtr,n=e.annotPtr,r=e.state,o=H[r],a=Module._CreateReplyStateAnnotation(t,n,o);return newStateInt=Module._GetState(a),{annotPtr:a,state:Y[newStateInt]}})),e.on("GetReplyAnnotation",(function(e){return ze(e.pagePtr,e.annotPtr)})),e.on("EditReplyAnnotation",(function(e){var t=e.reply;t.author&&me(t),t.contents&&ye(t),t.date&&Pe(t),t.title&&ve(t)})),e.on("SetState",(function(e){var t=e.reviewAnnotState,n=e.markedAnnotState;if(n){var r=H[n.state.toUpperCase()];Module._SetState(n.annotPtr,r);var o=Module._GetState(n.annotPtr);return{annotPtr:n.annotPtr,state:Y[o]}}if(t){var a=H[t.state.toUpperCase()];Module._SetState(t.annotPtr,a);var i=Module._GetState(t.annotPtr);return{annotPtr:t.annotPtr,state:Y[i]}}})),e.on("CanRedo",(function(e){return Module._CanRedo(e)})),e.on("CanUndo",(function(e){return Module._CanUndo(e)})),e.on("Redo",(function(e){return EditCharPlace={},{editAreaPtr:Module._Redo(e),editCharPlace:EditCharPlace}})),e.on("Undo",(function(e){return EditCharPlace={},{editAreaPtr:Module._Undo(e),editCharPlace:EditCharPlace}})),e.on("GetLineLeading",(function(e){var t=e.editAreaPtr,n=e.char;return Module._GetLineLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex)})),e.on("SetLineLeading",(function(e){var t=e.editAreaPtr,n=e.char,r=e.spacing;Module._SetLineLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r)})),e.on("GetSectionAfterLeading",(function(e){var t=e.editAreaPtr,n=e.char;return Module._GetSectionAfterLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex)})),e.on("SetSectionAfterLeading",(function(e){var t=e.editAreaPtr,n=e.char,r=e.spacing;Module._SetSectionAfterLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r)})),e.on("GetCharacterSpacing",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return Module._GetCharacterSpacing(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex)})),e.on("SetCharacterSpacing",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.spacing;Module._SetCharacterSpacing(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o)})),e.on("ApplyRedaction",(function(e){var t=e.annotPtr;return Module._ApplyRedaction(t)})),e.on("ApplyRedactionPage",(function(e){var t=e.pagePtr;return Module._ApplyRedactionPage(t)})),e.on("ErasureRedactionFromRect",(function(e){var t=e.pagePtr,n=e.rect;return Module._ErasureRedactionFromRect(t,n.left,n.right,n.bottom,n.top)})),e.on("GetStampRect",(function(e){var t=e.doc,n=e.pagePtr,r=e.annotation,o=r.contents,a=r.time,i=r.stampShape,u=r.stampColor,l=x[r.type.toUpperCase()],d=Module._CreateAnnot(t,n,l),s=stringToNewUTF8(o),c=stringToNewUTF8(a);Module._SetTextStamp(d,s,c,i,u,0);var f=Ae("PDF Annotation STAMPS");return f.code?f:(Module._UpdateAnnotAp(d,0),Module._GetAnnotRect(n,d),Module._RemoveAnnot(d),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom})})),e.on("GetLayers",(function(e){var t=Module._getLayerTree(e),n=Module._getRootNode(t),r=[],o=[],a=Module._getChildrenCount(n);return r.push.apply(r,c(function e(t,n){for(var r=[],a=0;a<n;a++){var i=Module._getChild(t,a);Module._getName(i);var u=Module._isLocked(i),l=Module._getLayerNodeDict(i),d=Module._getViewUsage(i),s=1!==d?1:0;s&&l&&o.push(l);var f=Module._getExportUsage(i);LayerPrintData={},Module._getPrintUsage(i),LayerZoomData={},Module._getZoomUsage(i);var p=Module._getChildrenCount(i),g=[];p>0&&g.push.apply(g,c(e(i,p))),r.push({node:i,ocg:l,name:U8StringData,isLocked:u,visible:s,defaultVisible:s,children:g,viewState:d,exportState:0===f?0:1===f?1:2,printState:0===LayerPrintData.print_state?0:1===LayerPrintData.print_state?1:2,zoom:LayerZoomData})}return r}(n,a))),{layers:r,ocgsPtr:o}})),e.on("SetLayer",(function(e){var t=e.node,n=e.name,r=e.defaultVisible,o=e.isLocked,a=e.printState,i=e.exportState;n&&Module._setName(t,stringToNewUTF8(n)),e.hasOwnProperty("defaultVisible")&&Module._setViewUsage(t,!r),e.hasOwnProperty("isLocked")&&Module._setLocked(t,o),e.hasOwnProperty("printState")&&Module._setPrintUsage(t,stringToNewUTF8(""),0===a?0:1===a?1:3),e.hasOwnProperty("exportState")&&Module._setExportUsage(t,0===i?0:1===i?1:3)})),e.on("RenderLayerBitmap",(function(e){var t=function(e){for(var t=e.pagePtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.mode,u=e.flag,l=e.ocgsPtr,d=e.form,s=parseInt(o)*parseInt(a),c=4*s,f=_malloc(c),p=0;p<s;p++)Module.HEAP32[f/4+p]=0;var g=l.length,A=_malloc(4*g);for(p=0;p<g;p++)Module.HEAP32[A/4+p]=l[p];Module._RenderLayerBitmap(t,n,r,o,a,i,f,u,A,g,d);var h=Ae("PDF VIEWER RENDER");if(h.code)return _free(f),h;var P=new Uint8Array(c);for(p=0;p<c;p+=4)P[p]=Module.HEAPU8[f+p+2],P[p+1]=Module.HEAPU8[f+p+1],P[p+2]=Module.HEAPU8[f+p],P[p+3]=Module.HEAPU8[f+p+3];return _free(f),{imageArray:P}}({pagePtr:e.pagePtr,x:e.x,y:e.y,width:e.width,height:e.height,ocgsPtr:e.ocgsPtr,mode:-1,flag:1,form:1});return t})),e.on("RenderLayerBitmapWithMatrix",(function(e){var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=void 0===u?-1:u,d=e.flag,s=void 0===d?0:d,c=e.ocgsPtr,f=e.form,p=function(e){for(var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=e.flag,d=e.ocgsPtr,s=e.form,c=parseInt(o-r)*parseInt(a-i),f=4*c,p=_malloc(f),g=0;g<c;g++)Module.HEAP32[p/4+g]=0;var A=d.length,h=_malloc(4*A);for(g=0;g<A;g++)Module.HEAP32[h/4+g]=d[g];Module._RenderPageBitmapWithMatrix2(t,n,r,o,a,i,u,p,l,h,A,s);var P=Ae("PDF VIEWER RENDER");if(P.code)return _free(p),P;var M=new Uint8Array(f);for(g=0;g<f;g+=4)M[g]=Module.HEAPU8[p+g+2],M[g+1]=Module.HEAPU8[p+g+1],M[g+2]=Module.HEAPU8[p+g],M[g+3]=Module.HEAPU8[p+g+3];return _free(p),{imageArray:M}}({pagePtr:t,scale:n,left:r,right:o,bottom:a,top:i,mode:l,flag:s,ocgsPtr:c,form:void 0===f?0:f});return p})),e.on("ExportLayers",(function(e){for(var t=e.doc,n=e.ocgsPtr,r=n.length,o=4*n.length,a=_malloc(o),i=0;i<n.length;i++)Module.HEAP32[a/4+i]=n[i];return fe(Module._exportDocumentLayer(t,a,r),2)})),e.on("InitColorList",(function(e){return Module._initColorList(e)})),e.on("GetPDFSeparationColor",function(){var e=a(n().mark((function e(t){var r,o,a,i,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.pagePtr,o=t.fileData,a=o instanceof ArrayBuffer?new Uint8Array(o):o,i=_malloc(a.length),Module.HEAPU8.set(a,i),u=Module._getPDFSeparationColor(r,i,a.length),_free(i),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("GetColorsList",(function(e){SepColorsArray=[],Module._getColorsList(e);for(var t=[],n=0;n<SepColorsArray.length;n++){var r=SepColorsArray[n];t.push({index:n,name:r.ColorName,color:"rgb(".concat(r.R,", ").concat(r.G,", ").concat(r.B,")")})}return t})),e.on("GetSelectPointColor",(function(e){var t=e.pagePtr,n=e.sepColorPtr,r=e.point;return SelectPointColorArray=[],Module._getSelectPointColor(t,n,r.x,r.y),SelectPointColorArray})),e.on("RenderPageAndIgnoreColorByIndex",(function(e){var t=e.sepColorPtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.indexs,u=e.flag,l=void 0===u?0:u,d=e.rotate,s=function(e){for(var t=e.sepColorPtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.rotate,u=e.flag,l=e.indexs,d=parseInt(o)*parseInt(a),s=4*d,c=_malloc(s),f=0;f<d;f++)Module.HEAP32[c/4+f]=0;var p=l.length,g=_malloc(4*p);for(f=0;f<p;f++)Module.HEAP32[g/4+f]=l[f];Module._renderPageAndIgnoreColorByIndex(t,c,n,r,o,a,i,u,g,p);var A=Ae("PDF VIEWER COLOR RENDER");if(A.code)return _free(c),A;var h=new Uint8Array(s);for(f=0;f<s;f+=4)h[f]=Module.HEAPU8[c+f+2],h[f+1]=Module.HEAPU8[c+f+1],h[f+2]=Module.HEAPU8[c+f],h[f+3]=Module.HEAPU8[c+f+3];return _free(c),{imageArray:h}}({sepColorPtr:t,x:n,y:r,width:o,height:a,rotate:void 0===d?0:d,flag:l,indexs:i});return s})),e.on("CreateMeasurementAnnotation",(function(e){return function(e,t,n){var r="RECTANGLE"===n.type.toUpperCase()?"POLYGON":n.type.toUpperCase(),o=x[r],a=W[n.measureType.toUpperCase()],i=Module._CreateAnnot(e,t,o),u=Module._initRuler(e,i,a);n.captionType&&(MeasureInfo={},Module._getMeasureInfo(u),Module._SetMeasureInfo(u,MeasureInfo.factor,stringToNewUTF8(MeasureInfo.unit),stringToNewUTF8(MeasureInfo.decimalSymbol),stringToNewUTF8(MeasureInfo.thousandSymbol),stringToNewUTF8(MeasureInfo.display),MeasureInfo.precision,stringToNewUTF8(MeasureInfo.unitPrefix),stringToNewUTF8(MeasureInfo.unitSuffix),stringToNewUTF8(MeasureInfo.unitPosition),MeasureInfo.RulerBase,stringToNewUTF8(MeasureInfo.RulerBaseUnit),MeasureInfo.RulerTranslate,stringToNewUTF8(MeasureInfo.RulerTranslateUnit),K[n.captionType.toUpperCase()]));var l=Ae("PDF Annotation");if(l.code)return l;return n.pagePtr=t,n.annotPtr=i,n.rulerPtr=u,$e(e,n),{annotPtr:i,rulerPtr:u}}(e.doc,e.pagePtr,e.annotation)})),e.on("EditMeasurementAnnotation",(function(e){return $e(e.doc,e.annotation)})),e.on("GetMeasurementData",(function(e){return et(e.annotPtr,e.rulerPtr,e.type)})),e.on("GetMeasurementResult",(function(e){var t=e.annotPtr,n=e.rulerPtr,r=e.captionType,o=r?K[r.toUpperCase()]:Module._getCaptionTypes(t);return Module._getMeasurementResults(n,o)})),e.on("GetFactor",(function(e){return Module._getFactor(e)}))}}]);var t}();function ne(){return(ne=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(runtimeInitialized){e.next=5;break}return e.next=3,V(100);case 3:e.next=0;break;case 5:return e.abrupt("return",new Promise((function(e,t){e()})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(e){var t=e.doc,n=e.fileId,r=e.length,o=e.password,a=stringToNewUTF8(o);return Module._LoadDocumentByStream(t,n,r,a),PermissionsInfo={},Module._GetPermissionsInfo(t),PermissionsInfo}function oe(e){var t=e.doc,n=e.password,r=e.permissionPassword,o=void 0===r?"":r,a=e.permissions,i=void 0===a?"":a,u=stringToNewUTF8(n),l=o?stringToNewUTF8(o):"",d=i.allowsPrinting,s=i.allowsCopying,c=i.allowsDocumentChanges;return d=void 0===d||d,s=void 0===s||s,c=void 0===c||c,Module._SetPassword(t,u,l,d,1,s,c,1,1,1),Ae("PDF SECURITY ENCRYPT")}function ae(e,t,n,r){++r;var o=[];if(!Module._IsValid(t))return n;var a=Module._GetFirst(t);if(!Module._IsValid(a))return n;for(var i=ie(e,o,a,n,r);Module._IsValid(i);)i=ie(e,o,i,n,r);for(var u=0;u<o.length;u++)ae(e,o[u],n[u].children,r)}function ie(e,t,n,r,o){t.push(n),Module._GetTitle(n);var a={title:U8StringData,children:[],level:o};return function(e,t,n,r){1===n?(PDFDestination={},Module._GetOutlineDestination(e,t),r.pageNumber=PDFDestination.PageIndex+1,r.posX=PDFDestination.PosX<0?0:PDFDestination.PosX,r.posY=PDFDestination.PosY<0?0:PDFDestination.PosY):6===n&&(Module._GetUri(t),r.url=U8StringData)}(e,n,Module._GetOutlineActionType(e,n),a),r.push(a),Module._GetNext(n)}function ue(e,t,n){if(RGBColor={},n){var r=FontDa,o=y(r.R,r.G,r.B);e.color=o}else if(Module._GetAnnotRGBColor(t)){var a=RGBColor,i=y(a.R,a.G,a.B);e.color=i}else e.color="#000000"}function le(e){var t=e.fontName,n=e.fontWeight,r=e.fontStyle,o={Courier:{normal:"Courier",bold:"Courier-Bold",italic:"Courier-Oblique",boldItalic:"Courier-BoldOblique"},Helvetica:{normal:"Helvetica",bold:"Helvetica-Bold",italic:"Helvetica-Oblique",boldItalic:"Helvetica-BoldOblique"},Times:{normal:"Times",bold:"Times-Bold",italic:"Times-Italic",boldItalic:"Times-BoldItalic"}};return"normal"!==n&&"normal"!==r?o[t].boldItalic:"normal"!==n?o[t].bold:"normal"!==r?o[t].italic:o[t]?o[t].normal:t}function de(){return(de=a(n().mark((function e(r){var o,a,i,u,l,d,s,c,f,p,g,P,M,m,v,y,I,C,S,_,x,w,b,G;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=r.doc,a=[],i=[],u=Module._GetSignatureCount(o),l=0;case 5:if(!(l<u)){e.next=61;break}if(!(d=Module._InitSignature(o,l))){e.next=58;break}i.push(d),c={signaturePtr:d,signerList:s=[]},SignerArray=[],Module._GetSigner(d),f=[],p=0;case 16:if(!(p<SignerArray.length)){e.next=56;break}if(!(g=SignerArray[p])){e.next=53;break}if(P={signerPtr:g,isSignVerified:!1,isCertTrusted:!1,certificateList:f},!(M=Module._GetSignCert(g))){e.next=50;break}CertArray=[],Module._ExportToFilePath(M,1),ComPDFKitJS.opened_cert[0]=CertArray[0],CertArray=[],Module._GetSignCertChain(M),CertArray.push(M),m=0;case 29:if(!(m<CertArray.length)){e.next=39;break}return v=CertArray[m],e.next=33,Je(v);case 33:y=e.sent,I=t({certPtr:v},y),f.push(I);case 36:m++,e.next=29;break;case 39:if(C=ComPDFKitJS.opened_cert[0].length,S=Module._VerifyGetChain(d,M,0,C),_=void 0,_=S?null:Module._bEqualCert(M,0,C),S||_)for(P.isCertTrusted=!0,x=0;x<P.certificateList.length;x++)P.certificateList[x].isTrusted=!0;w=ComPDFKitJS.opened_files[0].length,1===Module._VerifySigner(d,g,0,w)&&(b=Module._VerifyDocument(o,d,0,w),P.isSignVerified=1===b),DiffInfoArray=[],Module._GetSignatureDiffInfo(d),P.diffInfo=DiffInfoArray;case 50:Module._GetTimeStampSignature(g),s.push(P);case 53:p++,e.next=16;break;case 56:SignerArray.length?(Rect={},Module._GetSignatureRect(o,d),c.rect={left:h(Rect.Left),top:h(Rect.Top),right:h(Rect.Right),bottom:h(Rect.Bottom)},Module._GetSignatureFieldName(d),c.fieldName=U8StringData,Module._GetSignatureName(d),c.name=f[0].subject[5]||"",Module._GetSignatureTime(d),G=U8StringData,c.date=A(G),Module._GetSignatureReason(d),c.reason=U8StringData,Module._GetSignatureLocation(d),c.location=U8StringData,c.pageIndex=Module._GetSignaturePageIndex(o,d),c.isDigital=1):c.isDigital=0,a.push(c);case 58:l++,e.next=5;break;case 61:return e.abrupt("return",{signatures:a,signaturePtrList:i});case 62:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function se(e,t){return ce.apply(this,arguments)}function ce(){return(ce=a(n().mark((function e(t,r){var o,a,i,u,l,d,s,c,f;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(DataArray=[],o=!!fontsJson||!!ComPDFKitJS.opened_DefFont[0],Module._SaveDocumentByStream(t,2,o),a=[],i=0;i<DataArray.length;i++)u=new Uint8Array(DataArray[i]),a.push(u);return DataArray=[],l=new Blob(a,{type:"application/pdf"}),e.next=9,X(l);case 9:return d=e.sent,s=Module._InitDocument(),c=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[c]=d,f=stringToNewUTF8(r),Module._LoadDocumentByStream(s,c,d.length,f),e.abrupt("return",s);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fe(e,t){DataArray=[],1===t&&DataArray.push(ComPDFKitJS.opened_files[0]);var n=!!fontsJson||!!ComPDFKitJS.opened_DefFont[0];Module._SaveDocumentByStream(e,t,n);for(var r=[],o=0;o<DataArray.length;o++){var a=new Uint8Array(DataArray[o]);r.push(a)}return DataArray=[],new Blob(r,{type:"application/pdf"})}function pe(e){return ge.apply(this,arguments)}function ge(){return(ge=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.doc,o=t.saveType,a=void 0===o?2:o,i=t.password,u=t.oldPassword,l=t.permissionPassword,d=void 0===l?"":l,s=t.permissions,c=void 0===s?"":s,f=null,2!==a){e.next=21;break}if(u!==i&&i||c){e.next=7;break}f=fe(r,a),e.next=19;break;case 7:if(!i&&!c){e.next=18;break}return e.next=10,se(r,u);case 10:if(p=e.sent,!(g=oe({doc:p,password:i,permissionPassword:d,permissions:c}))||!g.code){e.next=14;break}return e.abrupt("return",g);case 14:f=fe(p,a),ComPDFKitJS.opened_files.pop(),e.next=19;break;case 18:f=fe(r,a);case 19:e.next=22;break;case 21:f=fe(r,a);case 22:return e.abrupt("return",f);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(e){var t=Module._GetComPDFkitLicenseErrorcode(),n={code:t};if(t)switch(t){case-100:n.message="The license is invalid";break;case-101:n.message="The license is expired";break;case-102:n.message="The license does not support the current platform";break;case-103:case-104:n.message="The license does not support your domain";break;case-105:n.message="The license does not support the "+e;break;case-106:n.message="License has not been initialized";break;case-107:n.message="The license does not support the current version";break;case-1e3:n.message="Illegal access to the API interface";break;case-1001:n.message="Failed to read license file"}return n}function he(){return(he=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,M;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.saveType,a=void 0===o?2:o,i=t.password,u=void 0===i?"":i,l=t.oldPassword,d=void 0===l?"":l,e.next=3,se(r,d);case 3:for(s=e.sent,c=Module._GetPageCount(s),f=[],p=0;p<c;p++)g=Module._GetPage(s,p),f.push(g);A=0;case 8:if(!(A<f.length)){e.next=17;break}if(Module._FlattenPage(f[A]),!(h=Ae("PDF Annotation FLATTEN")).code){e.next=14;break}return ComPDFKitJS.opened_files.pop(),e.abrupt("return",h);case 14:A++,e.next=8;break;case 17:if(P=null,!u||u===d){e.next=26;break}if(!(M=oe({doc:s,password:u}))||!M.code){e.next=23;break}return ComPDFKitJS.opened_files.pop(),e.abrupt("return",M);case 23:P=fe(s,a),e.next=27;break;case 26:P=fe(s,a);case 27:return ComPDFKitJS.opened_files.pop(),e.abrupt("return",{blobData:P});case 29:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pe(e){var t=e.annotPtr,n=e.date;n=n||new Date;var r=stringToNewUTF8(g(n));Module._SetAnnotCreationDate(t,r),function(e){var t=e.annotPtr,n=e.date;n=n||new Date;var r=stringToNewUTF8(g(n));Module._SetAnnotRecentlyModifyDate(t,r)}({annotPtr:t,date:n})}function Me(e){var t=e.pagePtr,n=e.annotPtr,r=e.rect,o=r.left,a=r.right,i=r.bottom,u=r.top;return Module._SetAnnotRect(t,n,o,a,i,u)}function me(e){var t=e.annotPtr,n=e.author,r=stringToNewUTF8(n);return Module._SetAnnotAuthor(t,r)}function ve(e){var t=e.annotPtr,n=e.title,r=stringToNewUTF8(n);return Module._SetAnnotTitle(t,r)}function ye(e){var t=e.annotPtr,n=e.contents,r=stringToNewUTF8(n);return Module._SetAnnotContent(t,r)}function Ie(e){var t=e.annotPtr,n=v(e.color);return!!Module._SetAnnotRGBColor(t,n.R,n.G,n.B)}function Ce(e){var t=e.annotPtr,n=v(e.borderColor);return!!Module._SetFreeTextBorderColor(t,n.R,n.G,n.B)}function Se(e){var t=e.annotPtr,n=e.fillColor;if(n){var r=v(n);return!!Module._SetFreeTextBgColor(t,r.R,r.G,r.B)}Module._ClearFreeTextBgColor(t)}function _e(e){var t=e.annotPtr,n=v(e.borderColor);return!!Module._SetAnnotBorderRGBColor(t,n.R,n.G,n.B)}function xe(e){var t=e.annotPtr,n=e.fillColor;if(!n)return Module._ClearAnnotFilledRGBColor(t);var r=v(n);return!!Module._SetAnnotFilledRGBColor(t,r.R,r.G,r.B)}function we(e){var t=e.annotPtr,n=e.opacity,r=void 0===n?1:n;return Module._SetAnnotTransparency(t,r)}function be(e){var t=e.annotPtr,n=e.borderWidth;Module._SetAnnotBorderWidth(t,n)}function Ge(e){var t=e.annotPtr,n=e.fillTransparency,r=void 0===n?1:n;return Module._SetAnnotFilledTransparency(t,r)}function Te(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.quadPoints,o=[],a=0;a<r.length;a++){var i=r[a];o.push(i.PointX,i.PointY)}for(var u=o.length,l=_malloc(4*u),d=0;d<u;d++)Module.HEAPF32[l/4+d]=o[d];var s=Module._SetQuadPoints(t,n,l,u);return _free(l),s}function Ee(e){var t=e.pagePtr,n=e.annotPtr,r=e.linePoints;return Module._SetLinePoint(t,n,r[0],r[1],r[2],r[3])}function Re(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.inkPointes,o=[],a=[],i=r.length,u=0;u<i;u++){for(var l=r[u].length,d=0;d<l;d++)o.push(r[u][d].PointX,r[u][d].PointY);a.push(l)}for(var s=a.length,c=_malloc(4*s),f=0;f<s;f++)Module.HEAP32[c/4+f]=a[f];var p=o.length,g=_malloc(4*p);for(f=0;f<p;f++)Module.HEAPF32[g/4+f]=o[f];Module._SetInkPath(t,n,c,i,g),_free(g)}function Be(e){var t=e.doc,n=e.annotPtr,r=e.destPage,o=e.pageHeight;Module._SetLinkDestination(t,n,r-1,0,o,0)}function Fe(e){var t=e.annotPtr,n=e.url,r=stringToNewUTF8(n);Module._SetLinkUri(t,r)}function De(e){var t=e.annotPtr,n=e.isChecked;Module._SetCheckBoxIsChecked(t,n);var r=Ae("PDF FORM FILL");if(r.code)return r}function Le(e){var t=e.annotPtr,n=e.isChecked;Module._SetRadioButtonIsChecked(t,n);var r=Ae("PDF FORM FILL");if(r.code)return r}function Ue(e){var t=e.annotPtr,n=e.checkStyle;Module._SetWidgetCheckStyle(t,n)}function Ne(e){var t=e.annotPtr,n=v(e.backgroundColor);Module._SetWidgetBackgroundRGBColor(t,n.R,n.G,n.B)}function ke(e){var t=e.annotPtr,n=e.fieldName,r=stringToNewUTF8(n);Module._SetWidgetFieldName(t,r)}function Oe(e){var t=e.annotPtr,n=e.fontName,r=e.fontSize,o=e.color,a=stringToNewUTF8(n),i=v(o);Module._SetAnnotFontDa(t,a,r,i.R,i.G,i.B)}function He(e){var t=e.annotPtr,n=e.selected;Module._SetItemsSelectedIndex(t,n);var r=Ae("PDF FORM FILL");if(r.code)return r}function Ye(e){var t=e.doc,n=e.annotPtr,r=e.destPage,o=e.pageHeight,a=e.actionType,i=Module._InitAction();Module._SetActionType(i,a),r&&1==a&&(Module._SetDestination(i,t,r-1,0,o,0),Module._SetButtonAction(n,i),Module._ClearAction(i))}function We(e){var t=e.annotPtr,n=e.url,r=e.actionType,o=Module._InitAction();if(Module._SetActionType(o,r),n&&6==r){var a=stringToNewUTF8(n);Module._SetUriPath(o,a),Module._SetButtonAction(t,o),Module._ClearAction(o)}}function Qe(e){var t=e.annotPtr,n=e.contents,r=stringToNewUTF8(n);Module._SetTextFieldContent(t,r);var o=Ae("PDF FORM FILL");if(o.code)return o}function Ke(e){var t=e.annotPtr,n=e.item,r=n.index,o=n.value,a=stringToNewUTF8(o);Module._AddOptionItem(t,r,a,a)}function qe(e){switch(e){case"1.2.840.113549.1.1.1":default:return"RSA_RSA";case"1.2.840.113549.1.1.2":return"MD2RSA";case"1.2.840.113549.1.1.3":return"MD4RSA";case"1.2.840.113549.1.1.4":return"MD5RSA";case"1.2.840.113549.1.1.5":return"SHA1RSA";case"1.2.840.113549.1.1.11":return"SHA256RSA";case"1.2.156.10197.1.501":return"SM3SM2"}}function Je(e){return Xe.apply(this,arguments)}function Xe(){return(Xe=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,M,m,v,y,I,C,S,_;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=["C","ST","L","O","OU","CN","email"],o=Module._GetSignVersion(t),Module._GetSignAlgOid(t),i=qe(a=U8StringData),u={},l=0;l<7;l++)Module._GetSignSubject(t,l),u[r[l]]=U8StringData;for(d=[],s=0;s<7;s++)Module._GetSignIssuer(t,s),d[r[s]]=U8StringData;return Module._GetSignSerialNumber(t),c=U8StringData,Module._GetSignValidDate(t,0),f=U8StringData,Module._GetSignValidDate(t,1),p=U8StringData,AccessInfoArray=[],Module._GetAuthorityInfoAccess(t),g=AccessInfoArray,Module._GetSubjectKeyIdentifier(t),A=U8StringData,h=Module._GetKeyUsage(t),PolicyArray=[],Module._GetCertificatePolicies(t),P=PolicyArray,Module._GetAuthorityKeyIdentifier(t),M=U8StringData,CRLPointArray=[],Module._GetCRLDistributionPoints(t),m=CRLPointArray,Module._GetBasicConstraints(t),v=U8StringData,Module._GetPublicKey(t),y=U8StringData,Module._GetX509Data(t),I=U8StringData,Module._GetSHA1Digest(t),C=U8StringData,Module._GetMD5Digest(t),S=U8StringData,OCSPUrlArray=[],Module._GetOCSPUrl(t),_=OCSPUrlArray,e.abrupt("return",{version:o,signAlgOid:a,signAlgOidType:i,subject:u,issuer:d,serialNumber:c,validDateStart:f,validDateEnd:p,sccessInfo:g,subjectKeyIdentifier:A,keyUsage:h,certificatePolicies:P,authorityKeyIdentifier:M,CRLDistributionPoints:m,basicConstraints:v,publicKey:y,X509Data:I,SHA1Digest:C,MD5Digest:S,ocspURL:_});case 43:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(e){return Ze.apply(this,arguments)}function Ze(){return(Ze=a(n().mark((function e(t){var r,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=j(t.imageBase64),o=ComPDFKitJS.opened_image.length,ComPDFKitJS.opened_image[o]=r,Module._UpdateAPWithImage(t.annotPtr,o,r.length,1,0);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(e){var t=e.annotPtr,n=e.content,r=e.isDrawOnlyContent,o=void 0!==r&&r,a=e.isDrowLogo,i=void 0!==a&&a,u=e.isContentAlginLeft,l=void 0!==u&&u,d=e.text,s=e.logoBase64,c=void 0===s?"":s,f=e.imageBase64,p=void 0===f?"":f,g=stringToNewUTF8(n),A=stringToNewUTF8(d);ComPDFKitJS.opened_image=[];var h=ComPDFKitJS.opened_image.length,P=0;if(c){var M=j(c);ComPDFKitJS.opened_image[h]=M,P=M.length}var m=ComPDFKitJS.opened_image.length,v=0;if(p){var y=j(p);ComPDFKitJS.opened_image[m]=y,v=y.length}Module._UpdateApWithDigitalSigConfig(t,g,o,i,l,A,h,P,m,v,0,0,0,0,0,0)}function ze(e,t){AnnotArray=[];var n,r,o=[];Module._GetReplies(e,t);for(var a=0;a<AnnotArray.length;a++){var i=AnnotArray[a],u={annotPtr:i,repliesIndex:a+1};if(Module._IsReviewStateAnnot(i))stateInt=Module._GetState(i),n={annotPtr:i,state:Y[stateInt]};else if(Module._IsMarkedStateAnnot(i))stateInt=Module._GetState(i),r={annotPtr:i,state:Y[stateInt]};else{Module._GetAnnotAuthor(i),u.author=U8StringData,Module._GetAnnotCreationDate(i);var l=U8StringData;u.date=A(l),Module._GetAnnotContent(i),u.contents=U8StringData,Module._GetAnnotTitle(i),u.title=U8StringData,o.push(u)}}return{replies:o,reviewAnnotState:n,markedAnnotState:r}}function $e(e,t){var n=t.pagePtr,r=t.annotPtr,o=t.rulerPtr,a=t.color,i=t.borderColor,u=t.borderWidth,l=t.contents,d=t.date,s=t.opacity,c=t.fillTransparency,f=t.rect,p=t.author,g=t.fillColor,A=t.quadPoints,P=t.fontName,M=t.fontSize,m=t.vertices,y=t.borderStyle,I=t.dashes,C=t.head,S=t.tail,_=t.linePoints,x=t.inkPointes,w=t.arcPoints;i&&Ie({annotPtr:r,color:i}),i&&_e({annotPtr:r,borderColor:i}),Object.hasOwn(t,"fillColor")&&xe({annotPtr:r,fillColor:g}),d&&Pe({annotPtr:r,date:d}),isFinite(s)&&(!function(e){var t=e.annotPtr,n=e.opacity,r=void 0===n?1:n;Module._setMeasureTextTransparency(t,r)}({annotPtr:r,opacity:s}),we({annotPtr:r,opacity:s})),c&&Ge({annotPtr:r,fillTransparency:c}),f&&Me({pagePtr:n,annotPtr:r,rect:f}),p&&me({annotPtr:r,author:p}),A&&Te({pagePtr:n,annotPtr:r,quadPoints:A}),u&&be({annotPtr:r,borderWidth:u}),(y||I)&&nt({annotPtr:r,borderWidth:u,borderStyle:y,dashes:I}),P&&M&&a&&Oe({annotPtr:r,fontName:P,fontSize:M,color:a}),P&&M&&a&&function(e){var t=e.annotPtr,n=e.fontName,r=e.fontSize,o=e.color,a=e.opacity,i=void 0===a?1:a,u=stringToNewUTF8(n),l=v(o);Module._SetAnnotFont(t,u,r,i,l.R,l.G,l.B)}({annotPtr:r,fontName:P,fontSize:M,color:a}),m&&tt({pagePtr:n,annotPtr:r,vertices:m}),null==C&&null==S||Module._SetLineType(r,B[C.toUpperCase()],B[S.toUpperCase()]),_&&Ee({pagePtr:n,annotPtr:r,linePoints:_}),x&&Re({pagePtr:n,annotPtr:r,inkPointes:x});var b=t.precision,G=t.scale,T=t.labelPosition,E=t.leadLength,R=t.leadOffset,F=t.leadExtension;(b&&function(e){var t=e.rulerPtr,n=e.precision;Module._setPrecision(t,Math.pow(10,-Math.floor(Math.log10(n))))}({rulerPtr:o,precision:b}),G&&function(e){var t=e.rulerPtr,n=e.scale,r=n.base,o=n.baseUnit,a=n.translate,i=n.translateUnit;Module._setMeasureScale(t,r,stringToNewUTF8(o),a,stringToNewUTF8(i))}({rulerPtr:o,scale:G}),T&&function(e){var t=e.rulerPtr,n=e.labelPosition;if("top"===n)return Module._setLabelTop(t);if("inside"===n)Module._setLabelInside(t)}({rulerPtr:o,labelPosition:T}),E&&function(e){var t=e.rulerPtr,n=e.leadLength;Module._setLeadLength(t,n)}({rulerPtr:o,leadLength:E}),R&&function(e){var t=e.rulerPtr,n=e.leadOffset;Module._setLeadOffset(t,n)}({rulerPtr:o,leadOffset:R}),F&&function(e){var t=e.rulerPtr,n=e.leadExtension;Module._setLeadExtension(t,n)}({rulerPtr:o,leadExtension:F}),w)&&(PageSize.Width=0,PageSize.Height=0,Module._GetPageSizeForIndex(e,t.pageIndex),function(e){for(var t=e.rulerPtr,n=e.arcPoints,r=e.pageHeight,o=function(e,t){var n=e.map((function(e){return{x:e.x,y:t-e.y}}));return n}(n,r),a=[],i=0;i<o.length;i++){var u=o[i];a.push(u.x,u.y)}for(var l=a.length,d=_malloc(4*l),s=0;s<l;s++)Module.HEAPF32[d/4+s]=a[s];var c=Module._SetArcPoints(t,d);_free(d)}({rulerPtr:o,arcPoints:w,pageHeight:PageSize.Height}),Rect={},Module._GetArcRect(t.rulerPtr),Me({pagePtr:n,annotPtr:r,rect:{left:h(Rect.Left),top:h(PageSize.Height-Rect.Top),right:h(Rect.Right),bottom:h(PageSize.Height-Rect.Bottom)}}));Module._UpdateAnnotMeasure(o),t.hasOwnProperty("contents")&&ye({annotPtr:r,contents:l}),Module._UpdateAnnotAp(r,0),x&&u&&i&&s&&function(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.inkPointes,o=e.borderWidth,a=e.borderColor,i=e.opacity,u=[],l=[],d=r.length,s=0;s<d;s++){for(var c=r[s].length,f=0;f<c;f++)u.push(r[s][f].PointX,r[s][f].PointY);l.push(c)}for(var p=l.length,g=_malloc(4*p),A=0;A<p;A++)Module.HEAP32[g/4+A]=l[A];var h=u.length,P=_malloc(4*h);for(A=0;A<h;A++)Module.HEAPF32[P/4+A]=u[A];var M=v(a);Module._UpdateAnnotApWithInk(t,n,g,d,P,o,M.R,M.G,M.B,i),_free(P)}({pagePtr:n,annotPtr:r,inkPointes:x,borderWidth:u,borderColor:i,opacity:s})}function et(e,t,n){MeasureInfo={},Module._getMeasureInfo(t);var r=Module._getCaptionTypes(e),o=Module._GetMeasureType(t);Module._setLabelInside(t);var a={captionType:q[r],measureType:Q[o],scale:{base:MeasureInfo.RulerBase,baseUnit:MeasureInfo.RulerBaseUnit,translate:MeasureInfo.RulerTranslate,translateUnit:MeasureInfo.RulerTranslateUnit},precision:MeasureInfo.precision,factor:MeasureInfo.factor};FontDa={},Module._GetAnnotFontDa(e);var i=U8StringData;switch(a.fontName=i,a.fontSize=FontDa.fontSize,a.color=y(FontDa.R,FontDa.G,FontDa.B),RGBColor={},hasColor=Module._GetAnnotRGBColor(e),hasColor&&(a.borderColor=y(RGBColor.R,RGBColor.G,RGBColor.B)),n){case"line":a.length=Module._getMeasurementResults(t,K.LENGTH),a.leadOffset=Module._getLeadOffset(t);var u=Module._getLeadLength(t),l=Module._getLeadExtension(t);u<0&&(l-=u,u=0),l<0&&(u-=l,l=0),a.leadLength=u,a.leadExtension=l,a.labelPosition="inside";break;case"rectangle":case"circle":case"polygon":a.area=Module._getMeasurementResults(t,K.AREA),a.perimeter=Module._getMeasurementResults(t,K.LENGTH),a.labelPosition="inside";break;case"polyline":a.perimeter=Module._getMeasurementResults(t,K.LENGTH);break;case"ink":"generic"===a.captionType&&(a.perimeter=Module._getMeasurementResults(t,K.GENERIC)),"arclength"===a.captionType&&(a.arcLength=Module._getMeasurementResults(t,K.ARCLENGTH))}return a}function tt(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.vertices,o=[],a=0;a<r.length;a++){var i=r[a];o.push(i.x,i.y)}for(var u=o.length,l=_malloc(4*u),d=0;d<u;d++)Module.HEAPF32[l/4+d]=o[d];var s=Module._setVertices(t,n,l,u);return _free(l),s}function nt(e){for(var t=e.annotPtr,n=e.dashes,r=e.borderStyle,o=e.borderWidth,a=U[r],i=n.length,u=_malloc(4*i),l=0;l<i;l++)Module.HEAPF32[u/4+l]=n[l];var d=Module._SetAnnotBorderStyle(t,a,o,u,i);return _free(u),d}function rt(e){var t=e.pagePtr,n=e.annotPtr;MeasureVerticesArray=[],Module._getVertices(t,n);for(var r=[],o=0;o<MeasureVerticesArray.length;o++){var a=MeasureVerticesArray[o];a&&r.push({x:a.PointX,y:a.PointY})}return r}(function(){return ne.apply(this,arguments)})().then((function(){te.setUp()}));
2
- //# sourceMappingURL=PDFWorker.js.map
1
+ function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(){n=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",d=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),u=new E(r||[]);return a(i,"_invoke",{value:T(e,n,u)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var p="suspendedStart",g="suspendedYield",A="executing",h="completed",P={};function m(){}function M(){}function v(){}var y={};s(y,u,(function(){return this}));var I=Object.getPrototypeOf,C=I&&I(I(R([])));C&&C!==r&&o.call(C,u)&&(y=C);var S=v.prototype=m.prototype=Object.create(y);function _(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(r,a,i,u){var l=f(e[r],e,a);if("throw"!==l.type){var d=l.arg,s=d.value;return s&&"object"==typeof s&&o.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(s).then((function(e){d.value=e,i(d)}),(function(e){return n("throw",e,i,u)}))}u(l.arg)}var r;a(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(a,a):a()}})}function T(t,n,r){var o=p;return function(a,i){if(o===A)throw Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var u=r.delegate;if(u){var l=w(u,r);if(l){if(l===P)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=A;var d=f(t,n,r);if("normal"===d.type){if(o=r.done?h:g,d.arg===P)continue;return{value:d.arg,done:r.done}}"throw"===d.type&&(o=h,r.method="throw",r.arg=d.arg)}}}function w(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,w(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),P;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,P;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,P):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,P)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function G(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[u];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return M.prototype=v,a(S,"constructor",{value:v,configurable:!0}),a(v,"constructor",{value:M,configurable:!0}),M.displayName=s(v,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===M||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,s(e,d,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},_(x.prototype),s(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new x(c(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(S),s(S,d,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=R,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(G),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),d=o.call(i,"finallyLoc");if(l&&d){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!d)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,P):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),G(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;G(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),P}},t}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function o(e,t,n,r,o,a,i){try{var u=e[a](i),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function u(e){o(i,r,a,u,l,"next",e)}function l(e){o(i,r,a,u,l,"throw",e)}u(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,r(o.key),o)}}function d(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){throw new TypeError('"'+e+'" is read-only')}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,u=[],l=!0,d=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){d=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(d)throw o}}return u}}(e,t)||g(e,t)||function(){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 p(e){return function(e){if(Array.isArray(e))return A(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){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 g(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var h,P=new Uint8Array(16);function m(){if(!h&&!(h="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return h(P)}for(var M=[],v=0;v<256;++v)M.push((v+256).toString(16).slice(1));var y={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function I(e,t,n){if(y.randomUUID&&!t&&!e)return y.randomUUID();var r=(e=e||{}).random||(e.rng||m)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return M[e[t+0]]+M[e[t+1]]+M[e[t+2]]+M[e[t+3]]+"-"+M[e[t+4]]+M[e[t+5]]+"-"+M[e[t+6]]+M[e[t+7]]+"-"+M[e[t+8]]+M[e[t+9]]+"-"+M[e[t+10]]+M[e[t+11]]+M[e[t+12]]+M[e[t+13]]+M[e[t+14]]+M[e[t+15]]}(r)}function C(e){var t=e.getTimezoneOffset(),n=t<0?"+":"-",r=("00"+Math.abs(t/60)).slice(-2),o=("00"+Math.abs(t%60)).slice(-2),a="".concat(n).concat(r,"'").concat(o,"'"),i=e.getFullYear(),u=("00"+(e.getMonth()+1)).slice(-2),l=("00"+e.getDate()).slice(-2),d=("00"+e.getHours()).slice(-2),s=("00"+e.getMinutes()).slice(-2),c=("00"+e.getSeconds()).slice(-2);return"D:".concat(i).concat(u).concat(l).concat(d).concat(s).concat(c).concat(a)}function S(e){if(!e)return new Date;var t=e.match(/D:(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})([-+]\d{2}'\d{2}')?/);if(t){var n=f(t,8),r=n[1],o=n[2],a=n[3],i=n[4],u=n[5],l=n[6];return n[7],new Date(parseInt(r),parseInt(o)-1,parseInt(a),parseInt(i),parseInt(u),parseInt(l))}throw new Error("Invalid timestamp format")}function _(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,n=Math.pow(10,t);return Math.round(e*n)/n}var x=d((function e(){var t=this;u(this,e),this.promise=new Promise((function(e,n){t.resolve=function(t){e(t)},t.reject=function(e){n(e)}}))}));function T(e,t){this.constructor===T&&function(e){throw new Error(e)}("Cannot initialize BaseException."),this.message=e,this.name=t}function w(e){return e.startsWith("#")?"hex":e.startsWith("rgb(")?"rgb":e.startsWith("hsl")?"hsl":"unknown"}function b(e){var t=w(e);if("hex"===t){var n=E(e),r=n.R,o=n.G,a=n.B;return{R:_(r/255),G:_(o/255),B:_(a/255)}}if("rgb"===t){var i=e.match(/(\d+),\s*(\d+),\s*(\d+)/);return{R:_(parseInt(i[1])/255),G:_(parseInt(i[2])/255),B:_(parseInt(i[3])/255)}}if("hsl"===t){var u=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(!u)return{error:"Invalid HSL format"};var l=parseInt(u[1]),d=parseInt(u[2])/100,s=parseInt(u[3])/100,c=R(l,d,s),f=c.R,p=c.G,g=c.B;return{R:_(f/255),G:_(p/255),B:_(g/255)}}console.error({message:"Invalid color value"})}function G(e,t,n){return function(e,t,n){var r=(1<<24|e<<16|t<<8|n).toString(16).slice(1).toUpperCase();return"#".concat(r)}(Math.round(255*e),Math.round(255*t),Math.round(255*n))}function E(e){var t=e.slice(1),n=parseInt(t,16);return{R:n>>16&255,G:n>>8&255,B:255&n}}T.prototype=new Error,T.constructor=T,"undefined"!=typeof document&&document.documentElement.style;var R=function(e,t,n){var r,o,a;if(e/=360,0===t)r=o=a=Math.round(255*n);else{var i=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},u=n<.5?n*(1+t):n+t-n*t,l=2*n-u;r=Math.round(255*i(l,u,e+1/3)),o=Math.round(255*i(l,u,e)),a=Math.round(255*i(l,u,e-1/3))}return{R:r,G:o,B:a}},F={0:"left",1:"center",2:"right"},D={LEFT:0,CENTER:1,CENTERED:1,RIGHT:2},B={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,RICHMEDIA:26,REDACT:27,INTERCHANGE:28,ARC:29},U={1:"text",2:"link",3:"freetext",4:"line",5:"square",6:"circle",7:"polygon",8:"polyline",9:"highlight",10:"underline",11:"squiggly",12:"strikeout",13:"stamp",14:"caret",15:"ink",16:"popup",17:"fileattachment",18:"sound",19:"movie",20:"widget",21:"screen",22:"printermark",23:"trapnet",24:"watermark",25:"threed",26:"richmedia",27:"redact",28:"interchange",29:"arc"},L={PUSHBUTTON:0,CHECKBOX:1,RADIOBUTTON:2,TEXTFIELD:3,COMBOBOX:4,LISTBOX:5,SIGNATUREFIELDS:6,UNKNOWN:255},N={0:"pushbutton",1:"checkbox",2:"radiobutton",3:"textfield",4:"combobox",5:"listbox",6:"signatureFields",255:"unknown"},k=1,O=2,H=32,W={UNKNOWN:-1,NONE:0,OPENARROW:1,CLOSEDARROW:2,SQUARE:3,CIRCLE:4,DIAMOND:5,BUTT:6,ROPENARROW:7,RCLOSEDARROW:8,SLASH:9},Y={"-1":"unknown",0:"none",1:"openarrow",2:"closedarrow",3:"square",4:"circle",5:"diamond",6:"butt",7:"ropenarrow",8:"rclosedarrow",9:"slash"};s(s(s(s(s({1:"none",0:"check"},"1","circle"),2,"cross"),3,"diamond"),4,"square"),5,"star");var Q={0:"unknown",1:"standard",2:"image",3:"text",4:"digital"},K={0:"unknown",1:"goto",2:"gotor",3:"gotoe",4:"launch",5:"thread",6:"uri",7:"sound",8:"movie",9:"hide",10:"named",11:"submitform",12:"resetform",13:"importdata",14:"javascript",15:"setocgstate",16:"rendition",17:"trans",18:"goto3dview",19:"uop",255:"error"},J={solid:0,dashed:1,beveled:2,inset:3,underline:4},q={0:"solid",1:"dashed",2:"beveled",3:"inset",4:"underline"},X={0:"rect",1:"leftTriangle",2:"rightTriangle",3:"none"},j=d((function e(){u(this,e)}));s(j,"CSS",96),s(j,"PDF",72),s(j,"PDF_TO_CSS_UNITS",1);var V={MARKED:0,UNMARKED:1,ACCEPTED:2,REJECTED:3,CANCELLED:4,COMPLETED:5,NONE:6,ERROR:7},Z={0:"MARKED",1:"UNMARKED",2:"ACCEPTED",3:"REJECTED",4:"CANCELLED",5:"COMPLETED",6:"NONE",7:"ERROR"},z={DISTANCE:0,PERIMETER:1,AREA:2,ANGLE:3,COUNT:4,ARC:5},$={0:"distance",1:"perimeter",2:"area",3:"angle",4:"count",5:"arc"},ee={AREA:1,LENGTH:2,RADIUS:4,DIAMETER:8,ANGLE:16,COUNT:32,ARCLENGTH:64,GENERIC:128},te={1:"area",2:"length",4:"radius",8:"diameter",16:"angle",32:"count",64:"arclength",128:"generic"},ne=function(){return d((function e(t,n,r){var o=this;u(this,e),this.sourceName=t,this.targetName=n,this.comObj=r,this.callbackId=1,this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=function(e){var t=e.data;if(t.targetName===o.sourceName)if(t.callback){var n=t.callbackId,a=o.callbackCapabilities[n];if(!a)throw new Error("Cannot resolve callback ".concat(n));if(delete o.callbackCapabilities[n],"resolve"!==t.callback)throw console.log({data:{action:t.data.action,data:t.data.data},message:t.reason&&t.reason.message}),new Error("Unexpected callback case");a.resolve(t.data)}else{var i=o.actionHandler[t.action];if(!i)throw new Error("Unknown action from worker: ".concat(t.action));if(t.callbackId){var u=o.sourceName,l=t.sourceName;new Promise((function(e){e(i(t.data))})).then((function(e){r.postMessage({sourceName:u,targetName:l,callback:"resolve",callbackId:t.callbackId,data:e})}),(function(e){r.postMessage({data:t,sourceName:u,targetName:l,callback:"reject",callbackId:t.callbackId,reason:e})}))}else i(t.data)}},r.addEventListener("message",this._onComObjOnMessage)}),[{key:"on",value:function(e,t){var n=this.actionHandler;if(n[e])throw new Error('There is already an actionName called "'.concat(e,'"'));n[e]=t}},{key:"send",value:function(e,t){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t})}},{key:"sendWithPromise",value:function(e,t){var n=this.callbackId++,r=new x;this.callbackCapabilities[n]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:n,data:t})}catch(e){r.reject(e)}return r.promise}},{key:"destroy",value:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}])}();function re(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){var e=new Uint8Array(r.result);t(e)},r.onerror=function(){n(r.error)},r.readAsArrayBuffer(e)}))}function oe(e){for(var t=e.split(";base64,")[1],n=atob(t),r=new Uint8Array(n.length),o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}importScripts("./ComPDFKit.js");var ComPDFKitJS={opened_Font:[],opened_DefFont:[],ComPDFKitDownloadFont:function(e){if(ComPDFKitJS.opened_Font[e])return ComPDFKitJS.opened_Font[e];return!1},ComPDFKitDownloadFontA:function(e){if(ComPDFKitJS.opened_Font[e])return ComPDFKitJS.opened_Font[e];var t=fontsJson[e-1];if(!t)return!1;var fontFile=le(ae+t.filePath);return se.MessageHandler.send("LoadFont",{fontFamily:t.family}),ComPDFKitJS.opened_Font[e]=fontFile,fontFile},FontNameList:[],FontCount:1,opened_image:[],opened_files:[],opened_cert:[]},DataArray=[],LineType={},BorderStyle={},PageSize={},Rect={},RGBColor={},FontDa={},PDFDestination={},WidgetItem={},WidgetItemsArray={},TextFindItemArray=[],EditCharPlace={},EndEditCharPlace={},RectArray=[],CursorPoints={},EditTextStyle={},U8StringData="",PDFRange={},TextRectArray=[],ImageAreaInfo={},SignerArray=[],CertArray=[],AccessInfoArray=[],PolicyArray=[],CRLPointArray=[],OCSPUrlArray=[],DiffInfoArray=[],AnnotArray=[],fontsJson=null,ae="https://www.compdf.com/fonts/",LayerPrintData={},LayerZoomData={},SepColorsArray=[],SelectPointColorArray=[],MeasureVerticesArray=[],PermissionsInfo={};function ie(e){return ue.apply(this,arguments)}function ue(){return(ue=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,t)}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function le(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new XMLHttpRequest;n.open("GET",e,t),n.responseType="arraybuffer";var r=function(){return(200===n.status||206===n.status)&&new Uint8Array(n.response)};if(t)return new Promise((function(e,t){n.onload=function(){return e(r())},n.onerror=function(){return t(new Error("Network error"))},n.send()}));try{return n.send(),r()}catch(e){return!1}}function de(e){var t=parseInt(e.slice(1),16),n=t>>8&255,r=255&t;return{R:_((t>>16&255)/255),G:_(n/255),B:_(r/255)}}var se=function(){function e(){u(this,e)}return d(e,null,[{key:"setUp",value:(t=a(n().mark((function t(){var r,o;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=new ne("worker","main",self),this.MessageHandler=r,o=!1,r.on("test",(function(e){o||(o=!0,r.send("test",e instanceof Uint8Array))})),r.send("ready",null),r.on("Ready",(function(t){return e.createDocumentHandler(self)}));case 6:case"end":return t.stop()}}),t,this)}))),function(){return t.apply(this,arguments)})},{key:"createDocumentHandler",value:function(){var e=this.MessageHandler;e.on("InitConfig",(function(e){var t=e.license,n=e.appId,r=e.version,o=stringToNewUTF8(t),a=stringToNewUTF8(""),i=stringToNewUTF8(n),u=stringToNewUTF8(r);return Module._InitComPDFkit(o,!1,a,i,0,u),we()})),e.on("LoadFile",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,fontFile,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ComPDFKitJS.opened_files=[],ComPDFKitJS.opened_files[0]=t.buffer,t.pagesPtr&&t.pagesPtr.length>0&&t.pagesPtr.forEach((function(e){Module._ClearPage(e.pagePtr)})),t.doc&&Module._ClearDocument(t.doc),t.fileList&&(ComPDFKitJS.opened_Font[0]=t.fileList),"https://www.compdf.com/fonts/"!==t.webFontURL&&(ae=t.webFontURL),!t.fontsJson||fontsJson){e.next=26;break}if(fontsJson=t.fontsJson,r=!!ComPDFKitJS.opened_Font[0],ComPDFKitJS.FontCount=r?t.fontsJson.length+1:t.fontsJson.length,r){e.next=25;break}for(o=[],a=0;a<t.fontsJson.length;a++)o.push(le(ae+t.fontsJson[a].filePath,!0));if(!o.length){e.next=25;break}return i=null,e.prev=15,e.next=18,Promise.all(o);case 18:i=e.sent,e.next=24;break;case 21:e.prev=21,e.t0=e.catch(15),console.log(e.t0);case 24:if(i&&i.length)for(u=0;u<o.length;u++)l=ComPDFKitJS.opened_Font.length,i[u]&&(ComPDFKitJS.opened_Font[l]=i[u]);case 25:Module._InitComPDFkitFont(r);case 26:return t.enableDefaultFont&&!ComPDFKitJS.opened_DefFont[0]&&(fontFile=le("./DroidSansFallbackFull.ttf"),ComPDFKitJS.opened_DefFont[0]=fontFile),d=Module._InitDocument(),e.abrupt("return",d);case 29:case"end":return e.stop()}}),e,null,[[15,21]])})));return function(t){return e.apply(this,arguments)}}()),e.on("GetWebFontNameList",(function(){var e=ComPDFKitJS.FontNameList;return e.length?e:null})),e.on("LoadDocumentByStream",fe),e.on("GetPageCount",(function(e){var t=e.doc;return Module._GetPageCount(t)})),e.on("GetPageSize",(function(e){var t=e.doc,n=e.pageIndex;PageSize.Width=0,PageSize.Height=0,Module._GetPageSizeForIndex(t,n);var r=Module._GetPage(t,n),o=Module._GetPageRotation(r);return{pagePtr:r,width:PageSize.Width,height:PageSize.Height,rotation:90*o}})),e.on("InitAnnot",(function(e){for(var t=e.doc,n=e.pagesPtr,r=Ie({doc:t}),o=r.signatures,a=r.signaturePtrList,i=[],u=0;u<n.length;u++)for(var l=n[u].pagePtr,d=Module._GetAnnotCount(l),s=0;s<d;s++){var c=Module._InitAnnot(l,s);if(c)if(!Module._IsReplyAnnot(c)){var f=Module._GetAnnotType(c),p=U[f],g=null;(g="widget"===p?Pe({doc:t,pagePtr:l,annotPtr:c,signaturePtrList:a,pageIndex:u}):he({doc:t,pagePtr:l,annotPtr:c,type:p,pageIndex:u}))&&i.push(g)}}return{annotations:i,signatures:o,signaturePtrList:a}})),e.on("GetAnnotation",(function(e){return he({doc:e.doc,pagePtr:e.pagePtr,annotPtr:e.annotPtr,typeInt:e.typeInt,scale:e.scale})})),e.on("GetPermissionsInfo",(function(e){PermissionsInfo={};var t=e.doc;return Module._GetPermissionsInfo(t),PermissionsInfo})),e.on("CheckOwnerPassword",(function(e){var t=e.doc,n=e.pwd,r=stringToNewUTF8(n);return!!Module._CheckOwnerPassword(t,r)})),e.on("GetDynamicStampPreview",(function(e){var t=e.contents,n=e.time,r=e.stampShape,o=e.stampColor,a=Module._InitDocument();Module._CreateDocument(a),Module._InsertPage(a,0,595,842);var i=Module._GetPage(a,0),u=Module._CreateAnnot(a,i,13),l=stringToNewUTF8(t),d=stringToNewUTF8(n);Module._SetTextStamp(u,l,d,r,o,0),Module._UpdateAnnotAp(u,0),Rect={},Module._GetAnnotRect(i,u);for(var s=Rect,c=s.Left,f=s.Top,p=s.Right,g=s.Bottom,A=Math.ceil(p-c),h=Math.ceil(g-f),P=A*h,m=4*P,M=_malloc(m),v=0;v<P;v++)Module.HEAP32[M/4+v]=0;Module._RenderAnnot(u,A,h,M,0);var y=new Uint8Array(m);for(v=0;v<m;v+=4)y[v]=Module.HEAPU8[M+v+2],y[v+1]=Module.HEAPU8[M+v+1],y[v+2]=Module.HEAPU8[M+v],y[v+3]=Module.HEAPU8[M+v+3];return _free(M),{width:A,height:h,imageArray:y}})),e.on("GetRenderAnnot",(function(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.width,o=e.height,a=r*o,i=_malloc(4*a),u=0;u<a;u++)Module.HEAP32[i/4+u]=0;var l=function(e,t,n,r,o){var a,i;1===o||3===o?(a=r,i=n):(a=n,i=r);Module._RenderAnnot(e,a,i,t,0);for(var u=new Uint8Array(a*i*4),l=0;l<i;l++)for(var d=0;d<a;d++){var s=4*(l*a+d),c=void 0,f=void 0;switch(o){case 1:c=i-1-l,f=d;break;case 2:c=a-1-d,f=i-1-l;break;case 3:c=l,f=a-1-d;break;default:c=d,f=l}var p=4*(f*n+c);u[p]=Module.HEAPU8[t+s+2],u[p+1]=Module.HEAPU8[t+s+1],u[p+2]=Module.HEAPU8[t+s],u[p+3]=Module.HEAPU8[t+s+3]}return{imageArray:u,width:a,height:i}}(n,i,r,o,Module._GetPageRotation(t)),d=l.imageArray;return _free(i),d})),e.on("GetWidgetAnnotation",(function(e){return Pe({doc:e.doc,pagePtr:e.pagePtr,annotPtr:e.annotPtr,typeInt:e.typeInt,signaturePtrList:e.signaturePtrList})})),e.on("GetSignatures",(function(e){return Ie(e)})),e.on("UpdateDigitalSignAp",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,m,M;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAYAAACHjumMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA9kSURBVHgB7d1vbJXlGcfx635KpUWqJWgiZGgxg2ZG52k1pmqmJdYl6kZwW8S5F4hlKvGFmG3RZWYU4wuX7QUsMdpsSn3j3LJMo3FLJobqMmMWpDUuS4BkdpKAyWAFi4JAz737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wMciFjTFRylqru4DbXOhcIUgUndtotXOZuy1bajLPF7swasne9PHi5omAwgQCJnAdu57nfAiAJ9S9ALwhYAB4Q8AA8IaAAeANAQPAGwIGgDcEDABvCBgA3hAwALwhYAB4Q8AA8IaAAeANAQPAGwIGgDcEDABvCBgA3hAwALwhYAB4Q8AA8IaAAeANAQPAGwIGgDcEDABvCBgA3hAwALwhYAB4Q8AA8IaAAeANASP2mADwgoAROS4AfBgJPmCsNcMCIH7W/ocKxsiIAIidNWaYgDGWCgbwwX23CJio6TUBEL9IBoMPmOE1G3UVaVAAxGl4eM1mhrzKWvuOAIiNNXaH3hMwakHTdvbDADGKJroCAkYm2iRrZYcAKJsxMqDtkT4mYHKoYoBYpCO7LfeYgMmiigHKZ6zdlqteMs8F5+nY1T/kKpmUACiOkZGh2x5eOfUlKphpbEP6bloloEjGHrORXTP9ZQJmGi3vrJHHBEDBrI02Tm2NcgiYWQzftnlAe0kBMK/M3KXnoVl3xDODyaPzref6rDFbBcCsNFz23r65b86fC/JK7epfZyS9071VrQJggpu5mHF5bO83Nw/k/TXBvFK7n2szabNbrLQJEDwzrIshs81cZvymoGC0TAiaVi1p2ZGvJZrxRwRFyVQz49Ln3roNAoQgGyzpBU3bs2cfKPyPCkqiQSNp6TbWbHFPrxUgaax9xwXEYCnBkkPAxCAXNpE1KWttyr2rbe6tvUKAeuAqFDdfPO5uw8aYkbSe5TFqeq3UUJnq/zPmsRQ9GquGAAAAAElFTkSuQmCC"),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=r,t.imageBase64&&"image"===t.appearance?it(t):lt(t),o=t.pkcs12Buffer,a=t.password,i=t.annotPtr,u=t.doc,ComPDFKitJS.opened_cert[0]=o,l=stringToNewUTF8(a),d=Module._GetPKCS12Cert(l,0,o.length),(DataArray=[]).push(ComPDFKitJS.opened_files[0]),s=Module._InitSignature2(i),Module._AddSignSaveDocument(u,s,d),c=[],f=0;f<DataArray.length;f++)p=new Uint8Array(DataArray[f]),c.push(p);return g=new Blob(c,{type:"application/pdf"}),e.next=18,re(g);case 18:for(A=e.sent,h=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[h]=A,DataArray=[],Module._AddSignModifyDocument(s,d,h,A.length),c=[],P=0;P<DataArray.length;P++)m=new Uint8Array(DataArray[P]),c.push(m);return ComPDFKitJS.opened_files[0]=c,ComPDFKitJS.opened_files.splice(h,1),M=new Blob(c,{type:"application/pdf"}),e.abrupt("return",M);case 29:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("CreateSignatureAP",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=t.rect,o=Module._InitDocument(),Module._CreateDocument(o),Module._InsertPage(o,0,595,842),Module._GetPageCount(o),a=Module._GetPage(o,0),Ge({annotPtr:i=Module._CreateWidget(o,a,6),date:new Date}),Ee({pagePtr:a,annotPtr:i,rect:r}),Module._UpdateFormAp(i),t.annotPtr=i,lt(t),u=r.width,l=r.height,s=4*(d=u*l),c=_malloc(s),f=0;f<d;f++)Module.HEAP32[c/4+f]=0;for(Module._RenderAnnot(i,u,l,c,0),p=new Uint8Array(s),f=0;f<s;f+=4)p[f]=Module.HEAPU8[c+f+2],p[f+1]=Module.HEAPU8[c+f+1],p[f+2]=Module.HEAPU8[c+f],p[f+3]=Module.HEAPU8[c+f+3];return _free(c),e.abrupt("return",p);case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("UpdateSignatureAP",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.doc,o=t.annotPtr,a=t.rect,i=t.pagePtr,u=t.imageBase64,l=t.imageArray,Ee({pagePtr:i,annotPtr:o,rect:a}),d=l||u&&oe(u),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=d,Module._RemoveAP(o),Module._SetImageStampByStream(o,0,d.length,0),Module._SetStampSignature(o),Module._WidgetRemoveFromFields(r,o);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("TestAddSignature",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,e.next=3,re(t.certFile);case 3:for(o=e.sent,ComPDFKitJS.opened_cert[0]=o,a=stringToNewUTF8("ComPDFKit"),i=Module._GetX509ByPKCS12Cert(0,o.length,a),u=Module._InitSignature2(annotPtr),DataArray=[],l=!!fontsJson||!!ComPDFKitJS.opened_DefFont[0],Module._SaveDocumentByStream(r,2,l),Module._AddSignSaveDocument(r,u,i),d=[],s=0;s<DataArray.length;s++)c=new Uint8Array(DataArray[s]),d.push(c);return f=new Blob(d,{type:"application/pdf"}),e.next=17,re(f);case 17:p=e.sent,g=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[g]=p,A=Module._InitDocument(),h=stringToNewUTF8(""),Module._LoadDocumentByStream(A,g,p.length,h);case 23:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("LoadCertificates",function(){var e=a(n().mark((function e(t){var r,o,a,i,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.pkcs12Buffer,o=t.password,ComPDFKitJS.opened_cert[0]=r,a=stringToNewUTF8(o),0!==(i=Module._GetX509ByPKCS12Cert(0,r.length,a))){e.next=6;break}return e.abrupt("return",!1);case 6:return e.next=8,at(i);case 8:return u=e.sent,e.abrupt("return",u);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("AddSignature",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,m,M;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.pagePtr.pagePtr,e.next=4,re(t.certFile);case 4:for(a=e.sent,ComPDFKitJS.opened_cert[0]=a,i=stringToNewUTF8("ComPDFKit"),u=Module._GetPKCS12Cert(i,0,a.length),l={left:50,top:442,right:100,bottom:642},(DataArray=[]).push(ComPDFKitJS.opened_files[0]),Ge({annotPtr:d=Module._CreateWidget(r,o,6),date:new Date}),ze({annotPtr:d,fieldName:"signatureField1"}),Ee({pagePtr:o,annotPtr:d,rect:l}),s=Module._InitSignature2(d),Module._AddSignSaveDocument(r,s,u),c=[],f=0;f<DataArray.length;f++)p=new Uint8Array(DataArray[f]),c.push(p);return g=new Blob(c,{type:"application/pdf"}),e.next=22,re(g);case 22:for(A=e.sent,h=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[h]=A,DataArray=[],Module._AddSignModifyDocument(s,u,1,ComPDFKitJS.opened_files[1].length),c=[],P=0;P<DataArray.length;P++)m=new Uint8Array(DataArray[P]),c.push(m);return M=new Blob(c,{type:"application/pdf"}),e.abrupt("return",M);case 31:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("PushRenderTask",(function(e){var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=void 0===u?-1:u,d=e.flag,s=void 0===d?0:d,c=e.form,f=function(e){for(var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=e.flag,d=e.form,s=parseInt(o-r)*parseInt(a-i),c=4*s,f=_malloc(c),p=0;p<s;p++)Module.HEAP32[f/4+p]=0;Module._RenderPageBitmapWithMatrix(t,n,r,o,a,i,u,f,l,d);var g=we("PDF VIEWER RENDER");if(g.code)return _free(f),g;var A=new Uint8Array(c);for(p=0;p<c;p+=4)A[p]=Module.HEAPU8[f+p+2],A[p+1]=Module.HEAPU8[f+p+1],A[p+2]=Module.HEAPU8[f+p],A[p+3]=Module.HEAPU8[f+p+3];return _free(f),{imageArray:A}}({pagePtr:t,scale:n,left:r,right:o,bottom:a,top:i,mode:l,flag:s,form:void 0===c?0:c});return f})),e.on("RenderPageBitmap",(function(e){var t=function(e){for(var t=e.pagePtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.mode,u=e.flag,l=e.form,d=parseInt(o)*parseInt(a),s=4*d,c=_malloc(s),f=0;f<d;f++)Module.HEAP32[c/4+f]=0;Module._RenderPageBitmap(t,n,r,o,a,i,c,u,l);var p=we("PDF VIEWER RENDER");if(p.code)return _free(c),p;var g=new Uint8Array(s);for(f=0;f<s;f+=4)g[f]=Module.HEAPU8[c+f+2],g[f+1]=Module.HEAPU8[c+f+1],g[f+2]=Module.HEAPU8[c+f],g[f+3]=Module.HEAPU8[c+f+3];return _free(c),{imageArray:g}}({pagePtr:e.pagePtr,x:e.x,y:e.y,width:e.width,height:e.height,mode:-1,flag:1,form:1});return t})),e.on("EditAnnotation",(function(e){var t=e.annotation;if(t.rect&&Ee(t),t.color&&t.type&&"freetext"===t.type&&function(e){var t=e.annotPtr,n=e.fontName,r=e.fontWeight,o=e.fontStyle,a=e.fontSize,i=e.color,u=e.textAlignment,l=e.contents,d=ve({fontName:n,fontWeight:r,fontStyle:o}),s=D[u.toUpperCase()],c=stringToNewUTF8(d),f=stringToNewUTF8(l),p=b(i);Module._SetFreeText(t,c,a,p.R,p.G,p.B,s,f)}(t),"customData"in t&&ke(t),isFinite(t.opacity)&&Oe(t),"contents"in t&&"mod-form"===t.operate){var n=rt(t);if(n)return n}if("contents"in t&&"mod-annot"===t.operate&&(t.type&&"freetext"===t.type?function(e){var t=e.annotPtr,n=e.contents,r=stringToNewUTF8(n);Module._SetFreeTextContent(t,r)}(t):De(t)),"fillColor"in t&&"mod-annot"===t.operate&&(t.type&&"freetext"===t.type?Le(t):Ne({annotPtr:t.annotPtr,fillColor:t.fillColor})),"borderWidth"in t&&He({annotPtr:t.annotPtr,borderWidth:t.borderWidth}),t.borderColor&&"mod-annot"===t.operate&&(t.type&&"freetext"===t.type?Ue(t):Be({annotPtr:t.annotPtr,borderColor:t.borderColor})),t.borderColor&&"mod-form"===t.operate&&function(e){var t=e.annotPtr,n=e.borderColor,r=b(n);Module._SetWidgetBorderRGBColor(t,r.R,r.G,r.B)}(t),"arcPoints"in t&&ft({pagePtr:t.pagePtr,annotPtr:t.annotPtr,vertices:t.arcPoints}),t.linePoints&&Qe(t),t.inkPointes&&Ke(t),t.destPage&&"mod-annot"===t.operate&&Je(t),t.destPage&&"mod-form"===t.operate&&tt(t),t.url&&"mod-annot"===t.operate&&qe(t),t.url&&"mod-form"===t.operate&&nt(t),(t.isHidden||0===t.isHidden)&&function(e){var t=e.annotPtr,n=e.isHidden,r=0;r=1==n?2:4;var o=Module._SetAnnotFlag(t,r)}(t),"required"in t&&function(e){var t=e.annotPtr,n=e.required;Module._SetRequiredFlag(t,n)}(t),"isChecked"in t)if("checkbox"===t.type){var r=Xe(t);if(r)return r}else if("radiobutton"===t.type){var o=je(t);if(o)return o}if("checkStyle"in t&&Ve(t),t.fillColor&&"mod-form"===t.operate&&Ze(t),t.title&&"mod-form"===t.operate){var a=t.annotPtr,u=t.title,l=stringToNewUTF8(u);Module._SetButtonTitle(a,l)}if(t.fieldName&&ze(t),t.fontName&&"freetext"!==t.type&&$e({annotPtr:t.annotPtr,fontName:t.fontName,fontSize:t.fontSize,color:t.color}),t.item&&ot(t),t.items)for(var d=t.items,s=0;s<d.length;s++)ot({annotPtr:t.annotPtr,item:{string:d[s].String,value:d[s].Value,index:s}});if(t.moveOption&&function(e){var t=e.annotPtr,n=e.moveOption,r=n.fromIndex,o=n.toIndex;n.item,function(e){var t=e.annotPtr,n=e.index;Module._RemoveOptionItem(t,n)}({annotPtr:t,index:r}),ot({annotPtr:t,item:{string:items[i].String,value:items[i].Value,index:o}})}(t),t.hasOwnProperty("deleteItemIndex")&&function(e){var t=e.annotPtr,n=e.deleteItemIndex;if(Module._RemoveOptionItem(t,n),0===Module._GetItemsCount(t))return;et({annotPtr:t,selected:0})}(t),t.textAlignment&&"mod-form"===t.operate){var c=t.annotPtr,f=t.textAlignment,p=D[f.toUpperCase()];Module._SetWidgetTextJustification(c,p)}if("selected"in t){var g=et(t);if(g)return g}if(t.hasOwnProperty("isMultiLine")){var A=t.annotPtr,h=t.isMultiLine;Module._SetMultiLine(A,h)}t.author&&Re(t),t.fillTransparency&&("mod-annot"===t.operate?We(t):function(e){var t=e.annotPtr,n=e.fillTransparency,r=void 0===n?1:n;e.fillColor,Module._SetAnnotFilledTransparency(t,r),console.log(Module._GetWidgetAlpha(t))}(t)),t.quadPoints&&Ye(t),(t.borderStyle||t.dashes)&&("mod-annot"===t.operate?pt(t):function(e){var t=e.annotPtr,n=e.borderStyle,r=J[n];Module._SetWidgetBorderStyle(t,r)}(t)),t.vertices&&ft(t),null==t.head&&null==t.tail||Module._SetLineType(t.annotPtr,W[t.head.toUpperCase()],W[t.tail.toUpperCase()]);var P=Module._GetPageRotation(t.pagePtr);"mod-annot"===t.operate?Module._UpdateAnnotAp(t.annotPtr,P):"mod-form"===t.operate&&Module._UpdateFormAp(t.annotPtr,P)})),e.on("FlattenPage",(function(e){var t=function(e){return be.apply(this,arguments)}({doc:e.doc,saveType:e.saveType,password:e.password,oldPassword:e.oldPassword});return t})),e.on("CreateAnnotation",(function(e){var t=e.doc,n=e.pagePtr,r=e.annotation;return"add-form"===r.operate?function(e,t,n){var r=n.type,o=n.date,a=n.fieldName,i=n.fillColor,u=n.checkStyle,l=n.rect,d=L[r.toUpperCase()],s=Module._CreateWidget(e,t,d),c=we("PDF FORM");if(c.code)return c;n.annotPtr=s,"customData"in n&&ke(n);o&&Ge({annotPtr:s,date:o});i&&Ze({annotPtr:s,fillColor:i});u&&Ve({annotPtr:s,checkStyle:u});a&&ze({annotPtr:s,fieldName:a});var f=n.borderColor,p=n.borderWidth,g=n.borderStyle,A=n.isChecked,h=n.color,P=n.fontName,m=n.fontSize;(f||g||"borderWidth"in n)&&function(e){var t=e.annotPtr,n=e.borderColor,r=e.borderWidth,o=e.borderStyle;if(n){var a=b(n);Module._SetWidgetBorderRGBColor(t,a.R,a.G,a.B)}if(o){var i=J[o];Module._SetWidgetBorderStyle(t,i)}(0===r||r)&&He({annotPtr:t,borderWidth:r})}({annotPtr:s,borderColor:f,borderWidth:p,borderStyle:g});switch(r){case"checkbox":(A||0===A)&&Xe({annotPtr:s,isChecked:A});break;case"radiobutton":(A||0===A)&&je({annotPtr:s,isChecked:A});break;case"listbox":case"combobox":for(var M=n.items,v=n.selected,y=0;y<M.length;y++)ot({annotPtr:s,item:{string:M[y].String,value:M[y].Value,index:y}});$e({annotPtr:s,fontName:P,fontSize:m,color:h}),(v||0===v)&&et({annotPtr:s,selected:v});break;case"pushbutton":$e({annotPtr:s,fontName:P,fontSize:m,color:h});var I=n.title,C=stringToNewUTF8(I);Module._SetButtonTitle(s,C),n.destPage&&tt(n),n.url&&nt(n);break;case"textfield":var S=n.isMultiLine,_=n.textAlignment,x=D[_.toUpperCase()];Module._SetMultiLine(s,S),Module._SetWidgetTextJustification(s,x),Module._SetTextFieldSpe(s,0),"contents"in n&&rt({annotPtr:s,contents:n.contents}),$e({annotPtr:s,fontName:P,fontSize:m,color:h})}if(Ee({pagePtr:t,annotPtr:s,rect:l}),Module._UpdateFormAp(s),"signatureFields"===r){var T=n.imageBase64;if(T){var w=oe(T);ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=w,Module._RemoveAP(s),Module._SetImageStampByStream(s,0,w.length,0),Module._SignWithName(s)}}return{annotPtr:s}}(t,n,r):function(e,t,n){var r=n.type,o=B[r.toUpperCase()],a=Module._CreateAnnot(e,t,o),i=we("PDF Annotation");if(i.code)return i;n.annotPtr=a;var u=n.color,l=n.fontName,d=n.fontWeight,s=n.fontStyle,c=n.borderColor,f=n.borderWidth,p=n.contents,g=n.date,A=n.opacity,h=n.fillTransparency,P=n.rect,m=n.author,M=n.fillColor,v=n.quadPoints,y=n.vertices,I=n.borderStyle,C=n.dashes;u&&l&&d&&s&&$e(n);"customData"in n&&ke(n);c&&"freetext"!==r&&Be({annotPtr:a,borderColor:c});M&&"freetext"!==r&&Ne({annotPtr:a,fillColor:M});p&&"freetext"!==r&&De({annotPtr:a,contents:p});Ge({annotPtr:a,date:g}),isFinite(A)&&Oe({annotPtr:a,opacity:A});h&&We({annotPtr:a,fillTransparency:h});P&&Ee({pagePtr:t,annotPtr:a,rect:P});m&&Re({annotPtr:a,author:m});v&&Ye({pagePtr:t,annotPtr:a,quadPoints:v});"borderWidth"in n&&He({annotPtr:a,borderWidth:f});(I||C)&&pt({annotPtr:a,borderWidth:f,borderStyle:I,dashes:C});switch(o){case B.TEXT:break;case B.LINK:n.destPage&&Je(n),n.url&&qe(n);break;case B.FREETEXT:var S=n.color,_=void 0===S?"rgb(0, 0, 0":S,x=n.fontSize,T=void 0===x?16:x,w=n.fontName,G=void 0===w?"Helvetica":w,E=n.fontStyle,R=void 0===E?"normal":E,F=n.fontWeight,U=void 0===F?"normal":F,L=n.textAlignment,N=void 0===L?"left":L;n.borderWidth;var k=n.borderColor,O=void 0===k?"rgb(0, 0, 0)":k,H=n.fillColor,Y=void 0===H?"":H,Q=n.contents;!function(e){var t=e.annotPtr,n=e.fontName,r=e.fontWeight,o=e.fontStyle,a=e.fontSize,i=e.color,u=e.textAlignment,l=e.contents,d=ve({fontName:n,fontWeight:r,fontStyle:o}),s=D[u.toUpperCase()],c=stringToNewUTF8(d),f=stringToNewUTF8(l),p=b(i);Module._SetFreeText(t,c,a,p.R,p.G,p.B,s,f),Module._SetFreeTextType(t,0),Module._SetFreeTextBorderColor(t,0)}({annotPtr:a,color:_,fontName:G,fontSize:T,fontStyle:R,fontWeight:U,textAlignment:N,contents:void 0===Q?"":Q}),"fillColor"in n&&Le({annotPtr:a,fillColor:Y}),"borderColor"in n&&Ue({annotPtr:a,borderColor:O});break;case B.POLYLINE:case B.POLYGON:y&&ft({pagePtr:t,annotPtr:a,vertices:y});break;case B.LINE:var K=n.head,J=n.tail,q=n.linePoints;null==K&&null==J||Module._SetLineType(a,W[K.toUpperCase()],W[J.toUpperCase()]),Qe({pagePtr:t,annotPtr:a,linePoints:q});break;case B.SQUARE:case B.CIRCLE:!function(e){var t=e.annotPtr,n=e.borderWidth;He({annotPtr:t,borderWidth:n})}({annotPtr:a,borderWidth:f});break;case B.HIGHLIGHT:case B.UNDERLINE:case B.SQUIGGLY:case B.STRIKEOUT:var X=n.quadPoints;!function(e){var t=e.pagePtr,n=e.annotPtr,r=e.color,o=e.quadPoints;Be({annotPtr:n,borderColor:r}),Ye({pagePtr:t,annotPtr:n,quadPoints:o})}({pagePtr:t,annotPtr:a,color:n.color,quadPoints:X});break;case B.STAMP:var j=n.stampType,V=Module._GetPageRotation(t);if("standard"===j){var Z=function(e,t){var n=e.annotPtr,r=e.contents,o=stringToNewUTF8(r.replace(/ /g,""));Module._SetStandardStamp(n,o,t);var a=we("PDF Annotation STAMPS");if(a.code)return a}({annotPtr:a,contents:p},V);if(Z)return Z}else if("text"===j){n.annotPtr=a;var z=function(e,t){var n=e.annotPtr,r=e.contents,o=e.time,a=e.stampShape,i=e.stampColor,u=stringToNewUTF8(r),l=stringToNewUTF8(o);Module._SetTextStamp(n,u,l,a,i,t);var d=we("PDF Annotation STAMPS");if(d.code)return d}(n,V);if(z)return z}else if("image"===j){n.annotPtr=a,n.doc=e;var $=function(e,t){var n=e.annotPtr,r=e.imageBase64;e.stampShape,e.rect,e.doc;var o=oe(r);De({annotPtr:n,contents:"image"}),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=o,Module._SetImageStampByStream(n,0,o.length,t);var a=we("PDF Annotation STAMPS");if(a.code)return a}(n,V);if($)return $}break;case B.INK:var ee=n.inkPointes,te=n.borderColor;te&&Be({annotPtr:a,borderColor:te}),Ke({pagePtr:t,annotPtr:a,inkPointes:ee});break;case B.ARC:ft({pagePtr:t,annotPtr:a,vertices:n.arcPoints})}P&&Ee({pagePtr:t,annotPtr:a,rect:P});var ne=Module._GetPageRotation(t);return Module._UpdateAnnotAp(n.annotPtr,ne),{annotPtr:a}}(t,n,r)})),e.on("GetAnnotRect",(function(e){var t=e.pagePtr,n=e.annotPtr;return Rect={},Module._GetAnnotRect(t,n),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom}})),e.on("SetAnnotRect",(function(e){var t=e.pagePtr,n=e.annotPtr,r=e.rect;Module._SetAnnotRect(t,n,r.left,r.right,r.bottom,r.top)})),e.on("RemoveAnnot",(function(e){var t=e.annotPtr;Module._RemoveAnnot(t);var n=we("PDF Annotation");if(n.code)return n})),e.on("RemoveFromPageIncludeReplyAnnot",(function(e){var t=e.pagePtr,n=e.annotPtr;Module._RemoveFromPageIncludeReplyAnnot(t,n);var r=we("PDF Annotation");if(r.code)return r})),e.on("GetCharIndexAtPos",(function(e){var t=e.pagePtr,n=e.textPtr,r=e.point,o=r.x,a=r.y;return-1!==Module._GetCharIndexAtPos(t,n,o,a,5,5)})),e.on("GetCharsRangeAtPos",(function(e){var t=e.pagePtr,n=e.textPtr,r=e.start,o=e.end;PDFRange={},Module._GetCharsRangeAtPos(t,n,r.x,r.y,o.x,o.y,5,5);var a=Module._GetTextContent(n,PDFRange.Location,PDFRange.Length),i=UTF8ToString(a);return TextRectArray=[],Module._GetRects(t,n,PDFRange.Location,PDFRange.Length),{textContent:i,textRects:TextRectArray}})),e.on("GetSelectionForWordAtPos",(function(e){var t=e.pagePtr,n=e.textPtr,r=e.start;e.end,Rect={},PDFRange={};var o=Module._GetSelectionForWordAtPos(t,n,r.x,r.y,5,5),a=UTF8ToString(o);return TextRectArray=[],Module._GetRects(t,n,PDFRange.Location,PDFRange.Length),{textContent:a,textRects:TextRectArray}})),e.on("XFDFExportAnnotations",(function(e){var t=function(e){XFDFData={},Module._XFDFExportAnnotations(e);var t=we("PDF Annotation XFDF");if(t.code)return t;return XFDFData}(e.doc);return t})),e.on("XFDFImportAnnotations",(function(e){var t=e.doc,n=e.xfdfBuffer,r=_malloc(n.length);Module.HEAPU8.set(n,r),Module._XFDFImportAnnotaitons(t,r,n.length),_free(r);var o=we("PDF Annotation XFDF");if(o.code)return o})),e.on("XFDFExportFormAnnotations",(function(e){var t=function(e){XFDFData={},Module._ExportCustomWidgets(e);var t=we("PDF XFDF");if(t.code)return t;return XFDFData.Content}(e.doc);return t})),e.on("SaveDocumentByStream",(function(e){return xe(e)})),e.on("SetPassword",(function(e){var t=e.doc,n=e.password,r=stringToNewUTF8(n);Module._SetPassword(t,r,"","","","","","")})),e.on("CompareDocument",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,m,M,v,y,I,C,S,_,x,T,w,b,G,E,R,F,D,B,U,L,N,k,O,H,W,Y,Q,K,J,q,X;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.data,o=r.leftFile,a=r.rightFile,i=r.leftFilePassword,u=r.rightFilePassword,e.next=4,re(o);case 4:return l=e.sent,d=Module._InitDocument(),ComPDFKitJS.opened_files[1]=l,s=stringToNewUTF8(i),Module._LoadDocumentByStream(d,1,l.length,s),c=Module._GetPageCount(d),e.next=12,re(a);case 12:if(f=e.sent,p=Module._InitDocument(),ComPDFKitJS.opened_files[2]=f,g=stringToNewUTF8(u),Module._LoadDocumentByStream(p,2,f.length,g),A=Module._GetPageCount(p),h=Math.min(c,A),1!==r.type){e.next=58;break}P=r.replaceColor,m=r.insertColor,M=r.deleteColor,v=r.textCompare,y=r.imgCompare,I=Module._InitCompare(d,p),C=0,v&&y?C=2:y&&(C=1),S=de(P),_=de(m),x=de(M),Module._SetReplaceResColor(I,255*S.R,255*S.G,255*S.B),Module._SetInsertResColor(I,255*_.R,255*_.G,255*_.B),Module._SetDeleteResColor(I,255*x.R,255*x.G,255*x.B),Module._SetReplaceResTransparency(I,127.5),Module._SetInsertResTransparency(I,127.5),Module._SetDeleteResTransparency(I,127.5),T=0;case 34:if(!(T<h)){e.next=47;break}if(w=Module._DoCompare(I,T,T,C,1),!(b=we("PDF COMPARE"))||!b.code){e.next=39;break}return e.abrupt("return",b);case 39:Module._GetCompareResultsCount(w,1),CompareResultArray=[],Module._GetCompareResults(d,p,w,1),ResultsCountParams={},Module._GetResultsCountParams(w);case 44:T++,e.next=34;break;case 47:for(DataArray=[],Module._GenerateNewDoc(I),G=[],E=0;E<DataArray.length;E++)R=new Uint8Array(DataArray[E]),G.push(R);return DataArray=[],F=new Blob(G,{type:"application/pdf"}),D=_e(d,2),B=_e(p,2),e.abrupt("return",{oldDocument:D,newDocument:B,blobData:F});case 58:if(2!==r.type){e.next=82;break}if(U=r.inColor,L=r.newColor,N=r.inTransparency,k=r.newTransparency,O=r.coverType,H=Module._InitCompareDrawing(d,p),Module._SetBlendMode(H,O),Module._SetNoFill(H,1),W=N/100,Y=k/100,Module._SetStrokeAlphaCompare(H,W),Module._SetStrokeAlphaCompared(H,Y),Module._SetFillAlphaCompare(H,W),Module._SetFillAlphaCompared(H,Y),Q=de(U),K=de(L),Module._SetColorCompare(H,255*Q.R,255*Q.G,255*Q.B),Module._SetColorCompared(H,255*K.R,255*K.G,255*K.B),Module._CompareContent(H),!(J=we("PDF COMPARE"))||!J.code){e.next=77;break}return e.abrupt("return",J);case 77:return q=Module._GetDocGenerate(H),e.next=80,xe({doc:q});case 80:return X=e.sent,e.abrupt("return",{blobData:X});case 82:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("GetOutlines",(function(e){var t=e.doc,n=[];return ge(t,Module._GetOutlineRoot(t),n,-1),n})),e.on("InitText",(function(e){var t=e.pagePtr;return Module._InitText(t)})),e.on("ClearText",(function(e){var t=e.textPtr;Module._ClearText(t)})),e.on("ClearPage",(function(e){var t=e.pagePtr;Module._ClearPage(t)})),e.on("Search",(function(e){for(var t=e.pagesPtr,n=e.value,r=stringToNewUTF8(n),o=null,a=[],i=0;i<t.length;i++){var u=t[i],l=u.pageNumber,d=u.pagePtr,s=u.textPtr,c=Module._InitTextFind();if(Module._FindStart(s,c,r,0,0),(o=we("PDF VIEWER SEARCH")).code)return o;var f=1,p=0;do{if(TextFindItemArray=[],f=Module._FindNext(d,s,c)){for(var g=TextFindItemArray.length,A=[],h=0;h<g;h++){var P=TextFindItemArray[h],m=P.Left,M=P.Top,v=P.Right,y=P.Bottom;A.push({left:m,top:M,right:v,bottom:y})}a.push({pageNum:l,quads:A,content:TextFindItemArray[0].Content.replace(/\r?\n/gm," "),pageSearchIndex:p,searchValue:n}),p++}}while(f);Module._ClearTextFind(c)}return{searchResults:a}})),e.on("InitEditPage",(function(e){var t=e.pagePtr;return{editPagePtr:Module._InitEditPage(t),pagePtr:t}})),e.on("ClearEditPage",(function(e){Module._ClearEditPage(e)})),e.on("BeginEdit",(function(e){var t=e.editPagePtr,n=e.type;return Module._BeginEdit(t,n),we("PDF CONTENT EDIT")})),e.on("EndEdit",(function(e){Module._EndEdit(e)})),e.on("GetEditAreaCount",(function(e){return Module._GetEditAreaCount(e)})),e.on("GetEditArea",(function(e){var t=e.editPagePtr,n=e.index;return Module._GetEditArea(t,n)})),e.on("IsTextArea",(function(e){return Module._IsTextArea(e)})),e.on("IsImageArea",(function(e){return Module._IsImageArea(e)})),e.on("SetFrame",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.rect;Module._SetFrame(t,n,r.left,r.right,r.bottom,r.top,!0)})),e.on("GetFrame",(function(e){var t=e.pagePtr,n=e.editAreaPtr;return Rect={},Module._GetFrame(t,n),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom}})),e.on("GetBeginAndEndCharPlace",(function(e){return EditCharPlace={},EndEditCharPlace={},Module._GetBeginAndEndCharPlace(e),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetTextByRange",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return Module._GetTextByRange(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex),U8StringData})),e.on("GetText",function(){var e=a(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return EditCharPlace={},EndEditCharPlace={},e.next=4,Module._GetBeginAndEndCharPlace(t);case 4:return e.next=6,Module._GetTextByRange(t,EditCharPlace.SectionIndex,EditCharPlace.LineIndex,EditCharPlace.RunIndex,EditCharPlace.CharIndex,EndEditCharPlace.SectionIndex,EndEditCharPlace.LineIndex,EndEditCharPlace.RunIndex,EndEditCharPlace.CharIndex);case 6:return e.abrupt("return",U8StringData);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("SelectCharsRangeAtPos",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.startPoint,o=e.endPoint;return EditCharPlace={},EndEditCharPlace={},Module._SelectCharsRangeAtPos(t,n,r.x,r.y,o.x,o.y),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetSectionAtPos",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.pointX,o=e.pointY;return EditCharPlace={},EndEditCharPlace={},Module._GetSectionAtPos(t,n,r,o),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetTextCursorPoints",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.char;return CursorPoints={},Module._GetTextCursorPoints(t,n,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex),CursorPoints})),e.on("GetPrevCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetPrevCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetNextCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetNextCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetUpCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetUpCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("GetDownCharPlace",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},EndEditCharPlace={},Module._GetDownCharPlace(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("InsertText",(function(e){var t=e.editAreaPtr,n=e.char,r=e.text;EditCharPlace={};var o=stringToNewUTF8(r);return Module._InsertText(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,o,!0),EditCharPlace})),e.on("BackSpaceChar",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},Module._BackSpaceChar(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,!0),EditCharPlace})),e.on("DeleteChar",(function(e){var t=e.editAreaPtr,n=e.char;return EditCharPlace={},Module._DeleteChar(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,!0),EditCharPlace})),e.on("DeleteChars",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return EditCharPlace={},Module._DeleteChars(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,!0),EditCharPlace})),e.on("GetSelectLineRectsCounts",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return Module._GetSelectLineRectsCounts(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex)})),e.on("GetSelectLineRects",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.start,o=e.end;return RectArray=[],Module._GetSelectLineRects(t,n,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o.SectionIndex,o.LineIndex,o.RunIndex,o.CharIndex),RectArray})),e.on("SetCharsFontColor",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=function(e){var t=w(e);if("hex"===t)return E(e);if("rgb"===t){var n=e.match(/(\d+),\s*(\d+),\s*(\d+)/);return n?{R:parseInt(n[1]),G:parseInt(n[2]),B:parseInt(n[3])}:{error:"Invalid RGB format"}}if("hsl"===t){var r=e.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(!r)return{error:"Invalid HSL format"};var o=parseInt(r[1]),a=parseInt(r[2])/100,i=parseInt(r[3])/100;return R(o,a,i)}console.error({message:"Invalid color value"})}(e.color);Module._SetCharsFontColor(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o.R,o.G,o.B,!0)})),e.on("SetCharsFontTransparency",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.opacity;Module._SetCharsFontTransparency(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o,!0)})),e.on("SetTextAligningSection",(function(e){var t=e.editAreaPtr,n=e.char,r=e.alignType;Module._SetTextAligningSection(t,r,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,!0)})),e.on("SetTextAligningRange",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.alignType;Module._SetTextAligningRange(t,o,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,!0)})),e.on("SetCharsFontSize",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.fontSize;Module._SetCharsFontSize(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o,!0,!0)})),e.on("SetFontFromNativeTrueTypeFont",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.fontFamily,a=stringToNewUTF8(o);Module._SetFontFromNativeTrueTypeFont(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,a,!0)})),e.on("RefreshRange",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return EditCharPlace={},EndEditCharPlace={},Module._RefreshRange(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex),{start:EditCharPlace,end:EndEditCharPlace}})),e.on("SetCharsFontStyle",function(){var e=a(n().mark((function e(t){var r,o,a,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.editAreaPtr,o=t.start,a=t.end,i=t.fontStyle,Module["_"+i](r,o.SectionIndex,o.LineIndex,o.RunIndex,o.CharIndex,a.SectionIndex,a.LineIndex,a.RunIndex,a.CharIndex,!0);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("CreateNewTextArea",(function(e){var t=e.pagePtr,n=e.editPagePtr,r=e.rect,o=e.fontData,a=e.alignType;return Module._CreateNewTextArea(t,n,r.left,r.right,r.bottom,r.top,stringToNewUTF8(o.fontName),o.fontSize,o.r,o.g,o.b,o.opacity,o.isBold,o.italic,a,!0)})),e.on("RemoveEditAreaByIndex",(function(e){var t=e.editPagePtr,n=e.editAreaIndex;Module._RemoveEditAreaByIndex(t,n,!0)})),e.on("RemoveEditArea",(function(e){var t=e.editPagePtr,n=e.editAreaPtr;Module._RemoveEditArea(t,n,!0)})),e.on("CopyArea",(function(e){var t=e.editPagePtr,n=e.editAreaPtr;return Module._CopyArea(t,n)})),e.on("PasteArea",(function(e){var t=e.pagePtr,n=e.editPagePtr,r=e.editAreaInfoPtr,o=e.rect,a=n;n||(a=Module._InitEditPage(t),Module._BeginEdit(a,3));var i=Module._PasteArea(t,a,r,o.left+5,o.top+5,!0);return n||(Module._EndEdit(a),Module._ClearEditPage(a)),i})),e.on("GetCopyAreaContent",(function(e){var t=e.editPagePtr,n=e.editAreaInfoPtr;return Module._GetCopyAreaContent(t,n),U8StringData})),e.on("GetTextStyle",(function(e){var t=e.editAreaPtr,n=e.char;return EditTextStyle={},Module._GetTextStyle(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),EditTextStyle})),e.on("GetBaseFontName",(function(e){var t=e.editAreaPtr,n=e.char;return Module._GetBaseFontName(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex),U8StringData})),e.on("createEditorDoc",function(){var e=a(n().mark((function e(t){var r,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.password,e.next=3,Ce(r,o);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("GetTextSectionAlignType",function(){var e=a(n().mark((function e(t){var r,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.editAreaPtr,o=t.char,e.abrupt("return",Module._GetTextSectionAlignType(r,o.SectionIndex,o.LineIndex,o.RunIndex,o.CharIndex));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("InsertPage",(function(e){var t=e.doc,n=e.index,r=e.width,o=e.height,a=Module._InsertPage(t,n,r,o),i=we("PDF EDITOR PAGE");return i.code?i:{status:a}})),e.on("ImportPagesAtIndex",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,p,g,A,h,P,m,M,v,y;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.file,a=t.range,i=t.index,u=t.password,e.next=3,re(o);case 3:if(l=e.sent,d=Module._InitDocument(),s=ComPDFKitJS.opened_files.length||0,ComPDFKitJS.opened_files[s]=l,c=stringToNewUTF8(u),Module._LoadDocumentByStream(d,s,l.length,c),p=Module._GetPageCount(d),A=!1,"all"===a?g="1-"+p:"odd"===a?g=Array.from({length:p},(function(e,t){return t+1})).filter((function(e){return e%2!=0})).join(","):"even"===a?g=Array.from({length:p},(function(e,t){return t+1})).filter((function(e){return e%2==0})).join(","):(h=p,P=a.replace(/\s/g,""),m=P.split(","),M=[],m.forEach((function(e){if(e.includes("-")){var t=e.split("-").map((function(e){return parseInt(e)})),n=f(t,2),r=n[0],o=n[1];if(r<=0&&(A=!0),r>h)return;o>h&&(o=h),M.push(r===h?r.toString():"".concat(r,"-").concat(o))}else{var a=parseInt(e);a<=0&&(A=!0),a<=h&&M.push(a.toString())}})),g=M.join(",")),g&&!A){e.next=14;break}return e.abrupt("return",0);case 14:if(g=stringToNewUTF8(g),v=Module._ImportPagesAtIndex(r,d,g,i),!(y=we("PDF EDITOR PAGE")).code){e.next=19;break}return e.abrupt("return",y);case 19:return ComPDFKitJS.opened_files.pop(),e.abrupt("return",{status:v});case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("RemovePage",(function(e){var t=e.doc,n=e.index,r=Module._RemovePage(t,n),o=we("PDF EDITOR PAGE");return o.code?o:{status:r}})),e.on("RotatePage",(function(e){var t=e.pagePtr,n=e.rotation;Module._RotatePage(t,n);var r=we("PDF EDITOR PAGE");if(r.code)return r})),e.on("GetPageWithoutParse",(function(e){var t=e.doc,n=e.index;return Module._GetPageWithoutParse(t,n)})),e.on("CopyPage",(function(e){var t=e.doc,n=e.index,r=stringToNewUTF8(n+1+""),o=Module._ImportPagesAtIndex(t,t,r,n+1),a=we("PDF EDITOR PAGE");return a.code?a:{status:o}})),e.on("GetPageRotation",(function(e){return Module._GetPageRotation(e)})),e.on("ClearDocument",(function(e){Module._ClearDocument(e),ComPDFKitJS.opened_files=[]})),e.on("ExtractPage",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.doc,o=t.range,a=t.separateFile,i=[],!a){e.next=20;break}u=0;case 4:if(!(u<o.length)){e.next=18;break}if(l=o[u]+1+"",d=stringToNewUTF8(l),s=Module._InitDocument(),Module._CreateDocument(s),Module._ImportPagesAtIndex(s,r,d,0),!(c=we("PDF EDITOR PAGE")).code){e.next=13;break}return e.abrupt("return",c);case 13:f=_e(s,2),i.push({name:l,blobData:f});case 15:u++,e.next=4;break;case 18:e.next=29;break;case 20:if(p=stringToNewUTF8(o),g=Module._InitDocument(),Module._CreateDocument(g),Module._ImportPagesAtIndex(g,r,p,0),!(A=we("PDF EDITOR PAGE")).code){e.next=27;break}return e.abrupt("return",A);case 27:h=_e(g,2),i.push(h);case 29:return e.abrupt("return",{blobDataList:i});case 30:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("MovePage",(function(e){var t=e.doc,n=e.index,r=e.targetIndex,o=Module._MovePage(t,n,r),a=we("PDF EDITOR PAGE");return a.code?a:{status:o}})),e.on("CreateNewImageAreaByStream",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l,d,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.pagePtr,o=t.editPagePtr,a=t.rect,i=t.imageBase64,u=oe(i),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=u,l=Module._CreateNewImageAreaByStream(r,o,a.left,a.right,a.bottom,a.top,0,u.length,!0),(d=Module._GetPageRotation(r))%4!=0&&(s=90*d,Module._RotateImage(l,s,!1)),e.abrupt("return",l);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("ReplaceImageAreaByStream",function(){var e=a(n().mark((function e(t){var r,o,a,i,u,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.pagePtr,o=t.editPagePtr,a=t.editAreaPtr,i=t.rect,u=t.imageBase64,l=oe(u),ComPDFKitJS.opened_image=[],ComPDFKitJS.opened_image[0]=l,e.abrupt("return",Module._ReplaceImageAreaByStream(r,o,a,i.left,i.right,i.bottom,i.top,0,l.length,!0));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("RotateImage",(function(e){var t=e.editAreaPtr,n=e.angle;return Module._RotateImage(t,n,!0)})),e.on("HorizontalMirrorImage",(function(e){return Module._HorizontalMirrorImage(e,!0)})),e.on("VerticalMirrorImage",(function(e){return Module._VerticalMirrorImage(e,!0)})),e.on("SetImageTransparency",(function(e){var t=e.editAreaPtr,n=e.opacity;return Module._SetImageTransparency(t,n,!0)})),e.on("GetImageTransparency",(function(e){return Module._GetImageTransparency(e)})),e.on("GetImageAreaSize",(function(e){return ImageAreaInfo={},Module._GetImageAreaSize(e),{width:ImageAreaInfo.Width,height:ImageAreaInfo.Height,stride:ImageAreaInfo.Stride}})),e.on("ExtractOriginalImage",(function(e){var t=function(e){for(var t=e.editAreaPtr,n=e.width,r=e.height,o=e.stride,a=parseInt(n)*parseInt(r),i=_malloc(o*r),u=0;u<a;u++)Module.HEAP32[i/4+u]=0;Module._GetImageAreaData(t,i);for(var l=new Uint8Array(o*r),d=0;d<r;d++)for(var s=0;s<n;s++){var c=d*o+4*s,f=d*n*4+4*s;l[f]=Module.HEAPU8[i+c+2],l[f+1]=Module.HEAPU8[i+c+1],l[f+2]=Module.HEAPU8[i+c],l[f+3]=Module.HEAPU8[i+c+3]}return _free(i),l}(e);return{imageArray:t}})),e.on("CutWithRect",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.rect;Module._CutWithRect(t,n,r.left,r.right,r.bottom,r.top,!0)})),e.on("GetClipRect",(function(e){var t=e.pagePtr,n=e.editAreaPtr;return Rect={},Module._GetClipRect(t,n),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom}})),e.on("SetClipRect",(function(e){var t=e.pagePtr,n=e.editAreaPtr,r=e.rect;Module._SetClipRect(t,n,r.left,r.right,r.bottom,r.top,!0)})),e.on("RemoveSignature",(function(e){var t=e.doc,n=e.signaturePtr;return Module._RemoveSignature(t,n,!0)})),e.on("AddToTrustedCertificates",(function(e){return function(e){var t=e.signerPtr,n=Module._GetSignCert(t);if(n){return CertArray=[],!!Module._ExportToFilePath(n,0)&&CertArray[0]}return!1}(e)})),e.on("CreateReplyAnnotation",(function(e){!function(e,t,n){var r=n.author,o=n.date,a=n.contents,i=n.title,u=Module._CreateReplyAnnotation(e,t);r&&Re({annotPtr:u,author:r});a&&De({annotPtr:u,contents:a});o&&Ge({annotPtr:u,date:o});i&&Fe({annotPtr:u,title:i})}(e.pagePtr,e.annotPtr,e.reply)})),e.on("CreateReplyStateAnnotation",(function(e){var t=e.pagePtr,n=e.annotPtr,r=e.state,o=V[r],a=Module._CreateReplyStateAnnotation(t,n,o);return newStateInt=Module._GetState(a),{annotPtr:a,state:Z[newStateInt]}})),e.on("GetReplyAnnotation",(function(e){return dt(e.pagePtr,e.annotPtr)})),e.on("EditReplyAnnotation",(function(e){var t=e.reply;t.author&&Re(t),t.contents&&De(t),t.date&&Ge(t),t.title&&Fe(t)})),e.on("SetState",(function(e){var t=e.reviewAnnotState,n=e.markedAnnotState;if(n){var r=V[n.state.toUpperCase()];Module._SetState(n.annotPtr,r);var o=Module._GetState(n.annotPtr);return{annotPtr:n.annotPtr,state:Z[o]}}if(t){var a=V[t.state.toUpperCase()];Module._SetState(t.annotPtr,a);var i=Module._GetState(t.annotPtr);return{annotPtr:t.annotPtr,state:Z[i]}}})),e.on("CanRedo",(function(e){return Module._CanRedo(e)})),e.on("CanUndo",(function(e){return Module._CanUndo(e)})),e.on("Redo",(function(e){return EditCharPlace={},{editAreaPtr:Module._Redo(e),editCharPlace:EditCharPlace}})),e.on("Undo",(function(e){return EditCharPlace={},{editAreaPtr:Module._Undo(e),editCharPlace:EditCharPlace}})),e.on("GetLineLeading",(function(e){var t=e.editAreaPtr,n=e.char;return Module._GetLineLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex)})),e.on("SetLineLeading",(function(e){var t=e.editAreaPtr,n=e.char,r=e.spacing;Module._SetLineLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r)})),e.on("GetSectionAfterLeading",(function(e){var t=e.editAreaPtr,n=e.char;return Module._GetSectionAfterLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex)})),e.on("SetSectionAfterLeading",(function(e){var t=e.editAreaPtr,n=e.char,r=e.spacing;Module._SetSectionAfterLeading(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r)})),e.on("GetCharacterSpacing",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end;return Module._GetCharacterSpacing(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex)})),e.on("SetCharacterSpacing",(function(e){var t=e.editAreaPtr,n=e.start,r=e.end,o=e.spacing;Module._SetCharacterSpacing(t,n.SectionIndex,n.LineIndex,n.RunIndex,n.CharIndex,r.SectionIndex,r.LineIndex,r.RunIndex,r.CharIndex,o)})),e.on("ApplyRedaction",(function(e){var t=e.annotPtr;return Module._ApplyRedaction(t)})),e.on("ApplyRedactionPage",(function(e){var t=e.pagePtr;return Module._ApplyRedactionPage(t)})),e.on("ErasureRedactionFromRect",(function(e){var t=e.pagePtr,n=e.rect;return Module._ErasureRedactionFromRect(t,n.left,n.right,n.bottom,n.top)})),e.on("GetStampRect",(function(e){var t=e.doc,n=e.pagePtr,r=e.annotation,o=r.contents,a=r.time,i=r.stampShape,u=r.stampColor,l=B[r.type.toUpperCase()],d=Module._CreateAnnot(t,n,l),s=stringToNewUTF8(o),c=stringToNewUTF8(a);Module._SetTextStamp(d,s,c,i,u,0);var f=we("PDF Annotation STAMPS");return f.code?f:(Module._UpdateAnnotAp(d,0),Module._GetAnnotRect(n,d),Module._RemoveAnnot(d),{left:Rect.Left,top:Rect.Top,right:Rect.Right,bottom:Rect.Bottom})})),e.on("GetLayers",(function(e){var t=Module._getLayerTree(e),n=Module._getRootNode(t),r=[],o=[],a=Module._getChildrenCount(n);return r.push.apply(r,p(function e(t,n){for(var r=[],a=0;a<n;a++){var i=Module._getChild(t,a);Module._getName(i);var u=Module._isLocked(i),l=Module._getLayerNodeDict(i),d=Module._getViewUsage(i),s=1!==d?1:0;s&&l&&o.push(l);var c=Module._getExportUsage(i);LayerPrintData={},Module._getPrintUsage(i),LayerZoomData={},Module._getZoomUsage(i);var f=Module._getChildrenCount(i),g=[];f>0&&g.push.apply(g,p(e(i,f))),r.push({node:i,ocg:l,name:U8StringData,isLocked:u,visible:s,defaultVisible:s,children:g,viewState:d,exportState:0===c?0:1===c?1:2,printState:0===LayerPrintData.print_state?0:1===LayerPrintData.print_state?1:2,zoom:LayerZoomData})}return r}(n,a))),{layers:r,ocgsPtr:o}})),e.on("SetLayer",(function(e){var t=e.node,n=e.name,r=e.defaultVisible,o=e.isLocked,a=e.printState,i=e.exportState;n&&Module._setName(t,stringToNewUTF8(n)),e.hasOwnProperty("defaultVisible")&&Module._setViewUsage(t,!r),e.hasOwnProperty("isLocked")&&Module._setLocked(t,o),e.hasOwnProperty("printState")&&Module._setPrintUsage(t,stringToNewUTF8(""),0===a?0:1===a?1:3),e.hasOwnProperty("exportState")&&Module._setExportUsage(t,0===i?0:1===i?1:3)})),e.on("RenderLayerBitmap",(function(e){var t=function(e){for(var t=e.pagePtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.mode,u=e.flag,l=e.ocgsPtr,d=e.form,s=parseInt(o)*parseInt(a),c=4*s,f=_malloc(c),p=0;p<s;p++)Module.HEAP32[f/4+p]=0;var g=l.length,A=_malloc(4*g);for(p=0;p<g;p++)Module.HEAP32[A/4+p]=l[p];Module._RenderLayerBitmap(t,n,r,o,a,i,f,u,A,g,d);var h=we("PDF VIEWER RENDER");if(h.code)return _free(f),h;var P=new Uint8Array(c);for(p=0;p<c;p+=4)P[p]=Module.HEAPU8[f+p+2],P[p+1]=Module.HEAPU8[f+p+1],P[p+2]=Module.HEAPU8[f+p],P[p+3]=Module.HEAPU8[f+p+3];return _free(f),{imageArray:P}}({pagePtr:e.pagePtr,x:e.x,y:e.y,width:e.width,height:e.height,ocgsPtr:e.ocgsPtr,mode:-1,flag:1,form:1});return t})),e.on("RenderLayerBitmapWithMatrix",(function(e){var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=void 0===u?-1:u,d=e.flag,s=void 0===d?0:d,c=e.ocgsPtr,f=e.form,p=function(e){for(var t=e.pagePtr,n=e.scale,r=e.left,o=e.right,a=e.bottom,i=e.top,u=e.mode,l=e.flag,d=e.ocgsPtr,s=e.form,c=parseInt(o-r)*parseInt(a-i),f=4*c,p=_malloc(f),g=0;g<c;g++)Module.HEAP32[p/4+g]=0;var A=d.length,h=_malloc(4*A);for(g=0;g<A;g++)Module.HEAP32[h/4+g]=d[g];Module._RenderPageBitmapWithMatrix2(t,n,r,o,a,i,u,p,l,h,A,s);var P=we("PDF VIEWER RENDER");if(P.code)return _free(p),P;var m=new Uint8Array(f);for(g=0;g<f;g+=4)m[g]=Module.HEAPU8[p+g+2],m[g+1]=Module.HEAPU8[p+g+1],m[g+2]=Module.HEAPU8[p+g],m[g+3]=Module.HEAPU8[p+g+3];return _free(p),{imageArray:m}}({pagePtr:t,scale:n,left:r,right:o,bottom:a,top:i,mode:l,flag:s,ocgsPtr:c,form:void 0===f?0:f});return p})),e.on("ExportLayers",(function(e){for(var t=e.doc,n=e.ocgsPtr,r=n.length,o=4*n.length,a=_malloc(o),i=0;i<n.length;i++)Module.HEAP32[a/4+i]=n[i];return _e(Module._exportDocumentLayer(t,a,r),2)})),e.on("InitColorList",(function(e){return Module._initColorList(e)})),e.on("GetPDFSeparationColor",function(){var e=a(n().mark((function e(t){var r,o,a,i,u;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.pagePtr,o=t.fileData,a=o instanceof ArrayBuffer?new Uint8Array(o):o,i=_malloc(a.length),Module.HEAPU8.set(a,i),u=Module._getPDFSeparationColor(r,i,a.length),_free(i),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.on("GetColorsList",(function(e){SepColorsArray=[],Module._getColorsList(e);for(var t=[],n=0;n<SepColorsArray.length;n++){var r=SepColorsArray[n];t.push({index:n,name:r.ColorName,color:"rgb(".concat(r.R,", ").concat(r.G,", ").concat(r.B,")")})}return t})),e.on("GetSelectPointColor",(function(e){var t=e.pagePtr,n=e.sepColorPtr,r=e.point;return SelectPointColorArray=[],Module._getSelectPointColor(t,n,r.x,r.y),SelectPointColorArray})),e.on("RenderPageAndIgnoreColorByIndex",(function(e){var t=e.sepColorPtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.indexs,u=e.flag,l=void 0===u?0:u,d=e.rotate,s=function(e){for(var t=e.sepColorPtr,n=e.x,r=e.y,o=e.width,a=e.height,i=e.rotate,u=e.flag,l=e.indexs,d=parseInt(o)*parseInt(a),s=4*d,c=_malloc(s),f=0;f<d;f++)Module.HEAP32[c/4+f]=0;var p=l.length,g=_malloc(4*p);for(f=0;f<p;f++)Module.HEAP32[g/4+f]=l[f];Module._renderPageAndIgnoreColorByIndex(t,c,n,r,o,a,i,u,g,p);var A=we("PDF VIEWER COLOR RENDER");if(A.code)return _free(c),A;var h=new Uint8Array(s);for(f=0;f<s;f+=4)h[f]=Module.HEAPU8[c+f+2],h[f+1]=Module.HEAPU8[c+f+1],h[f+2]=Module.HEAPU8[c+f],h[f+3]=Module.HEAPU8[c+f+3];return _free(c),{imageArray:h}}({sepColorPtr:t,x:n,y:r,width:o,height:a,rotate:void 0===d?0:d,flag:l,indexs:i});return s})),e.on("CreateMeasurementAnnotation",(function(e){return function(e,t,n){var r="RECTANGLE"===n.type.toUpperCase()?"POLYGON":n.type.toUpperCase(),o=B[r],a=z[n.measureType.toUpperCase()],i=Module._CreateAnnot(e,t,o),u=Module._initRuler(e,i,a);n.captionType&&(MeasureInfo={},Module._getMeasureInfo(u),Module._SetMeasureInfo(u,MeasureInfo.factor,stringToNewUTF8(MeasureInfo.unit),stringToNewUTF8(MeasureInfo.decimalSymbol),stringToNewUTF8(MeasureInfo.thousandSymbol),stringToNewUTF8(MeasureInfo.display),MeasureInfo.precision,stringToNewUTF8(MeasureInfo.unitPrefix),stringToNewUTF8(MeasureInfo.unitSuffix),stringToNewUTF8(MeasureInfo.unitPosition),MeasureInfo.RulerBase,stringToNewUTF8(MeasureInfo.RulerBaseUnit),MeasureInfo.RulerTranslate,stringToNewUTF8(MeasureInfo.RulerTranslateUnit),ee[n.captionType.toUpperCase()]));var l=we("PDF Annotation");if(l.code)return l;return n.pagePtr=t,n.annotPtr=i,n.rulerPtr=u,st(e,n),{annotPtr:i,rulerPtr:u}}(e.doc,e.pagePtr,e.annotation)})),e.on("EditMeasurementAnnotation",(function(e){return st(e.doc,e.annotation)})),e.on("GetMeasurementData",(function(e){return ct(e.annotPtr,e.rulerPtr,e.type)})),e.on("GetMeasurementResult",(function(e){var t=e.annotPtr,n=e.rulerPtr,r=e.captionType,o=r?ee[r.toUpperCase()]:Module._getCaptionTypes(t);return Module._getMeasurementResults(n,o)})),e.on("GetFactor",(function(e){return Module._getFactor(e)}))}}]);var t}();function ce(){return(ce=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(runtimeInitialized){e.next=5;break}return e.next=3,ie(100);case 3:e.next=0;break;case 5:return e.abrupt("return",new Promise((function(e,t){e()})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fe(e){var t=e.doc,n=e.fileId,r=e.length,o=e.password,a=stringToNewUTF8(o);return Module._LoadDocumentByStream(t,n,r,a),PermissionsInfo={},Module._GetPermissionsInfo(t),PermissionsInfo}function pe(e){var t=e.doc,n=e.password,r=e.permissionPassword,o=void 0===r?"":r,a=e.permissions,i=void 0===a?"":a,u=stringToNewUTF8(n),l=o?stringToNewUTF8(o):"",d=i.allowsPrinting,s=i.allowsCopying,c=i.allowsDocumentChanges;return d=void 0===d||d,s=void 0===s||s,c=void 0===c||c,Module._SetPassword(t,u,l,d,1,s,c,1,1,1),we("PDF SECURITY ENCRYPT")}function ge(e,t,n,r){++r;var o=[];if(!Module._IsValid(t))return n;var a=Module._GetFirst(t);if(!Module._IsValid(a))return n;for(var i=Ae(e,o,a,n,r);Module._IsValid(i);)i=Ae(e,o,i,n,r);for(var u=0;u<o.length;u++)ge(e,o[u],n[u].children,r)}function Ae(e,t,n,r,o){t.push(n),Module._GetTitle(n);var a={title:U8StringData,children:[],level:o};return function(e,t,n,r){1===n?(PDFDestination={},Module._GetOutlineDestination(e,t),r.pageNumber=PDFDestination.PageIndex+1,r.posX=PDFDestination.PosX<0?0:PDFDestination.PosX,r.posY=PDFDestination.PosY<0?0:PDFDestination.PosY):6===n&&(Module._GetUri(t),r.url=U8StringData)}(e,n,Module._GetOutlineActionType(e,n),a),r.push(a),Module._GetNext(n)}function he(e){var t=e.doc,n=e.pagePtr,r=e.annotPtr,o=e.type,a=e.pageIndex,i=null;Rect={},Module._GetAnnotRect(n,r);var u={left:_(Rect.Left),top:_(Rect.Top),right:_(Rect.Right),bottom:_(Rect.Bottom)};Module._GetAnnotCreationDate(r);var l=S(U8StringData);Module._GetAnnotContent(r);var d=U8StringData;Module._GetAnnotTitle(r);var s=U8StringData;Module._GetAnnotAuthor(r);var c=U8StringData,p=_(Module._GetAnnotTransparency(r)),g=Module._GetAnnotDictName(r,stringToNewUTF8("NM")),A=UTF8ToString(g);A||(A=I(),Module._SetAnnotDictName(r,stringToNewUTF8("NM"),stringToNewUTF8(A)));var h=Module._GetAnnotDictName(r,stringToNewUTF8("trn-custom-data")),P=UTF8ToString(h),m=Module._GetAnnotBorderWidth(r);try{JSON.parse(P)}catch(e){P={}}var M={type:o,date:l,contents:d,rect:u,opacity:p,name:A,pagePtr:n,annotPtr:r,title:s,author:c,color:null,borderColor:null,borderStyle:"solid",borderWidth:m,fillColor:null,fillTransparency:1,pageIndex:a,customData:P},v=dt(n,r,A);v.length&&(M.replies=v),RGBColor={},Module._GetAnnotRGBColor(r)&&(M.borderColor=G(RGBColor.R,RGBColor.G,RGBColor.B)),RGBColor={},Module._GetAnnotFilledRGBColor(r)&&(M.fillColor=G(RGBColor.R,RGBColor.G,RGBColor.B)),(BorderStyle={}).DashArray=[],Module._GetAnnotBorderStyle(r)&&(M.borderStyle=BorderStyle.Style,M.dashes=BorderStyle.DashArray);var y=dt(n,r,A);switch(y&&(M.replyAnnotations=y),o){case"text":return M.textColor=M.borderColor,delete M.borderColor,M;case"link":var C=Module._GetLinkActionType(r);return M.actionType=K[C],1===C?(PDFDestination={},Module._GetLinkDestination(t,r),M.destPage=PDFDestination.PageIndex+1,M.url=""):6===C&&(Module._GetLinkUri(r),M.url=U8StringData,M.destPage=""),M;case"freetext":FontDa={},Module._GetFreeTextFont(r);var x=U8StringData,T=/bold/i.test(x)?"bold":"normal",w=/(oblique|italic)/i.test(x)?"oblique":"normal";M.fontName=x.split("-")[0],M.fontStyle=w,M.fontWeight=T,M.fontSize=FontDa.fontSize,M.color=G(FontDa.R,FontDa.G,FontDa.B),RGBColor={},Module._GetFreeTextBorderColor(r)&&(M.borderColor=G(RGBColor.R,RGBColor.G,RGBColor.B)),M.fillTransparency=Module._GetAnnotFilledTransparency(r);var b=Module._GetTextAlignment(r);return M.textAlignment=F[b],Module._GetFreeTextContent(r),M.contents=U8StringData,RGBColor={},Module._GetFreeTextBgColor(r)&&(M.fillColor=G(RGBColor.R,RGBColor.G,RGBColor.B)),M;case"line":LinePoint={},Module._GetLinePoint(n,r);var E=[LinePoint.StartPointX,LinePoint.StartPointY,LinePoint.EndPointX,LinePoint.EndPointY];if(M.linePoints=E,LineType={},Module._GetLineType(r),M.tail=Y[LineType.Tail],M.head=Y[LineType.Head],Module._isMeasured(r)){M.measure=1,M.rulerPtr=Module._initRuler(t,r,z.DISTANCE);var R=ct(r,M.rulerPtr,o);Object.assign(M,R)}return M;case"arc":case"square":case"polygon":if(M.vertices=gt({pagePtr:n,annotPtr:r}),4===M.vertices.length){var D=f(M.vertices,4),B=D[0],U=D[1],L=D[2],N=D[3];B.y===U.y&&U.x===L.x&&L.y===N.y&&N.x===B.x&&(M.type="rectangle")}if(M.fillTransparency=Module._GetAnnotFilledTransparency(r),Module._isMeasured(r)){M.measure=1,M.rulerPtr=Module._initRuler(t,r,z.AREA);var k=ct(r,M.rulerPtr,o);Object.assign(M,k)}return M;case"polyline":if(M.vertices=gt({pagePtr:n,annotPtr:r}),Module._isMeasured(r)){M.measure=1,M.rulerPtr=Module._initRuler(t,r,z.PERIMETER);var O=ct(r,M.rulerPtr,o);Object.assign(M,O)}return M;case"circle":if(M.fillTransparency=Module._GetAnnotFilledTransparency(r),Module._isMeasured(r)){M.measure=1,M.rulerPtr=Module._initRuler(t,r,z.DISTANCE);var H=ct(r,M.rulerPtr,o);Object.assign(M,H)}return M;case"highlight":case"underline":case"squiggly":case"strikeout":return i=function(e){var t=e.pagePtr,n=e.annotPtr;RGBColor={};var r={};return Module._GetAnnotRGBColor(n)&&(r.color=G(RGBColor.R,RGBColor.G,RGBColor.B)),InkPointArray=[],Module._GetQuadPoints(t,n),r.quadPoints=InkPointArray,r}({pagePtr:n,annotPtr:r}),Object.assign(M,i),M;case"stamp":var W=Module._GetStampType(r);return M.stampType=Q[W],0===W?M.stampType="image":(TextStamp={},Module._GetTextStamp(r),M.stampColor=TextStamp.StampColor,M.stampShape=X[TextStamp.StampType],TextStamp.Date&&(M.time=TextStamp.Date)),M;case"ink":if(i=function(e){for(var t=e.pagePtr,n=e.annotPtr,r=Module._GetInkPathCount(n),o=[],a=0;a<r;a++)InkPointArray=[],Module._GetInkPoints(t,n,a),o.push(InkPointArray);return{borderWidth:Module._GetAnnotBorderWidth(n),inkPointes:o}}({pagePtr:n,annotPtr:r}),Object.assign(M,i),3===i.inkPointes[0].length&&(M.arcPoints=i.inkPointes[0].map((function(e){return{x:e.PointX,y:e.PointY}}))),Module._isMeasured(r)){M.measure=1,M.rulerPtr=Module._initRuler(t,r,z.ARC);var J=ct(r,M.rulerPtr,o);Object.assign(M,J)}return M}}function Pe(e){var n=e.doc,r=e.pagePtr,o=e.annotPtr,a=e.signaturePtrList,i=e.pageIndex;Rect={},Module._GetAnnotRect(r,o);var u={left:_(Rect.Left),top:_(Rect.Top),right:_(Rect.Right),bottom:_(Rect.Bottom)};Module._GetAnnotCreationDate(o);var l=S(U8StringData);Module._GetAnnotContent(o);var d=U8StringData;Module._GetAnnotAuthor(o);var s=U8StringData,c=_(Module._GetAnnotTransparency(o)),f=Module._GetWidgetType(o),p=Module._GetRequiredFlag(o),g=Module._GetAnnotDictName(o,stringToNewUTF8("NM")),A=UTF8ToString(g);A||(A=I(),Module._SetAnnotDictName(o,stringToNewUTF8("NM"),stringToNewUTF8(A)));var h=Module._GetAnnotDictName(o,stringToNewUTF8("trn-custom-data")),P=UTF8ToString(h),m=Module._GetAnnotBorderWidth(o);try{P=JSON.parse(P)}catch(e){P={}}var M={type:N[f],name:A,pagePtr:r,annotPtr:o,date:l,contents:d,rect:u,opacity:c,required:p,author:s,borderColor:null,borderWidth:m,borderStyle:"solid",fillColor:null,fillTransparency:1,pageIndex:i,customData:P};RGBColor={},Module._GetAnnotRGBColor(o)&&(M.borderColor=G(RGBColor.R,RGBColor.G,RGBColor.B)),RGBColor={},Module._GetWidgetBackgroundRGBColor(o)&&(M.fillColor=G(RGBColor.R,RGBColor.G,RGBColor.B));var v=Module._GetWidgetBorderStyle(o);M.borderStyle=q[v],Module._GetWidgetFieldName(o),M.fieldName=U8StringData;var y=Module._GetAnnotFlag(o);if(M.flag=y,0===y)M.isHidden=0;else{var C=!(y&k),x=!(y&H),T=!(y&O);M.isHidden=C&&x&&T?0:1}switch(f){case L.PUSHBUTTON:Module._GetButtonTitle(o),M.title=U8StringData,Module._GetBtnActionNamedAction(o),M.actionName=U8StringData;var w=Module._GetBtnActionType(o);if(1===w){var b=Module._GetBtnActionDestPage(n,o);M.destPage=b+1}else 6===w&&(Module._GetBtnActionURI(o),M.url=U8StringData);M.actionType=w,FontDa={},me(M,o,Module._GetAnnotFontDa(o));var E=Me(U8StringData),R=t({fontSize:FontDa.fontSize||12},E);Object.assign(M,R);break;case L.CHECKBOX:var D=Module._GetWidgetCheckStyle(o);M.checkStyle=D;var B=Module._GetCheckBoxIsChecked(o);M.isChecked=B;break;case L.RADIOBUTTON:var U=Module._GetWidgetCheckStyle(o);M.checkStyle=U;var W=Module._GetRadioButtonIsChecked(o);M.isChecked=W;break;case L.TEXTFIELD:if(1===Module._GetTextFieldSpe(o))return null;Module._GetTextFieldContent(o),M.contents=U8StringData;var Y=Module._IsMultiLine(o);M.isMultiLine=Y;var Q=Module._GetWidgetTextJustification(o);M.textAlignment=F[Q],FontDa={},me(M,o,Module._GetAnnotFontDa(o));var K=Me(U8StringData),J=t({fontSize:FontDa.fontSize||12},K);Object.assign(M,J);break;case L.COMBOBOX:case L.LISTBOX:WidgetItem={},Module._GetItemsSelectedItem(o),M.selectedItem={values:WidgetItem.Values,strings:WidgetItem.Strings};var X=Module._GetItemsCount(o);M.itemsCount=X,WidgetItemsArray=[],Module._GetWidgetItems(o),M.items=WidgetItemsArray,Module._GetItemsSelectedValue(o);var j=U8StringData;if(j){for(var V=0;V<WidgetItemsArray.length;V++)if(WidgetItemsArray[V].Value===j){M.selected=V;break}}else M.selected=null;FontDa={},me(M,o,Module._GetAnnotFontDa(o));var Z=Me(U8StringData),z=t({fontSize:FontDa.fontSize||12},Z);Object.assign(M,z);break;case L.SIGNATUREFIELDS:for(var $=0;$<a.length;$++){var ee=a[$];Module._IsSameAnnotDict(ee,o)&&(SignerArray=[],Module._GetSigner(ee),SignerArray.length&&(M.isSignedDigitally=!0),M.signaturePtr=ee)}M.isSigned=Module._IsStampSignature(o)}return M}function me(e,t,n){if(RGBColor={},n){var r=FontDa,o=G(r.R,r.G,r.B);e.color=o}else if(Module._GetAnnotRGBColor(t)){var a=RGBColor,i=G(a.R,a.G,a.B);e.color=i}else e.color="#000000"}function Me(e){var t=e.split("-")[0],n=/bold/i.test(e)?"bold":"normal";return{fontName:t,fontStyle:/(oblique|italic)/i.test(e)?"oblique":"normal",fontWeight:n}}function ve(e){var t=e.fontName,n=e.fontWeight,r=e.fontStyle;return"bold"!==n||"italic"!==r&&"oblique"!==r?"bold"===n?t+"-"+ye(n):"italic"===r||"oblique"===r?t+"-"+ye(r):t:t+"-"+ye(n)+ye(r)}function ye(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ie(e){for(var n=e.doc,r=[],o=[],a=Module._GetSignatureCount(n),i=0;i<a;i++){var u=Module._InitSignature(n,i);if(u){o.push(u);var l=[],d={signaturePtr:u,signerList:l};SignerArray=[],Module._GetSigner(u);for(var s=[],c=0;c<SignerArray.length;c++){var f=SignerArray[c];if(f){var p={signerPtr:f,isSignVerified:!1,isCertTrusted:!1,certificateList:s},g=Module._GetSignCert(f);if(g){CertArray=[],Module._ExportToFilePath(g,1),ComPDFKitJS.opened_cert[0]=CertArray[0],CertArray=[],Module._GetSignCertChain(g),CertArray.push(g);for(var A=0;A<CertArray.length;A++){var h=CertArray[A],P=t({certPtr:h},at(h));s.push(P)}var m=ComPDFKitJS.opened_cert[0].length,M=Module._VerifyGetChain(u,g,0,m),v=void 0;if(v=M?null:Module._bEqualCert(g,0,m),M||v){p.isCertTrusted=!0;for(var y=0;y<p.certificateList.length;y++)p.certificateList[y].isTrusted=!0}var I=ComPDFKitJS.opened_files[0].length;if(1===Module._VerifySigner(u,f,0,I)){var C=Module._VerifyDocument(n,u,0,I);p.isSignVerified=1===C}DiffInfoArray=[],Module._GetSignatureDiffInfo(u),p.diffInfo=DiffInfoArray}Module._GetTimeStampSignature(f),l.push(p)}}if(SignerArray.length){Rect={},Module._GetSignatureRect(n,u),d.rect={left:_(Rect.Left),top:_(Rect.Top),right:_(Rect.Right),bottom:_(Rect.Bottom)},Module._GetSignatureFieldName(u),d.fieldName=U8StringData,Module._GetSignatureName(u),d.name=s[0].subject[5]||"",Module._GetSignatureTime(u);var x=U8StringData;d.date=S(x),Module._GetSignatureReason(u),d.reason=U8StringData,Module._GetSignatureLocation(u),d.location=U8StringData,d.pageIndex=Module._GetSignaturePageIndex(n,u),d.isDigital=1}else d.isDigital=0;r.push(d)}}return{signatures:r,signaturePtrList:o}}function Ce(e,t){return Se.apply(this,arguments)}function Se(){return(Se=a(n().mark((function e(t,r){var o,a,i,u,l,d,s,c,f;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(DataArray=[],o=!!fontsJson||!!ComPDFKitJS.opened_DefFont[0],Module._SaveDocumentByStream(t,2,o),a=[],i=0;i<DataArray.length;i++)u=new Uint8Array(DataArray[i]),a.push(u);return DataArray=[],l=new Blob(a,{type:"application/pdf"}),e.next=9,re(l);case 9:return d=e.sent,s=Module._InitDocument(),c=ComPDFKitJS.opened_files.length,ComPDFKitJS.opened_files[c]=d,f=stringToNewUTF8(r),Module._LoadDocumentByStream(s,c,d.length,f),e.abrupt("return",s);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(e,t){DataArray=[],1===t&&DataArray.push(ComPDFKitJS.opened_files[0]);var n=!!fontsJson||!!ComPDFKitJS.opened_DefFont[0];Module._SaveDocumentByStream(e,t,n);for(var r=[],o=0;o<DataArray.length;o++){var a=new Uint8Array(DataArray[o]);r.push(a)}return DataArray=[],new Blob(r,{type:"application/pdf"})}function xe(e){return Te.apply(this,arguments)}function Te(){return(Te=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.doc,o=t.saveType,a=void 0===o?2:o,i=t.password,u=t.oldPassword,l=t.permissionPassword,d=void 0===l?"":l,s=t.permissions,c=void 0===s?"":s,f=null,2!==a){e.next=21;break}if(u!==i&&i||c){e.next=7;break}f=_e(r,a),e.next=19;break;case 7:if(!i&&!c){e.next=18;break}return e.next=10,Ce(r,u);case 10:if(p=e.sent,!(g=pe({doc:p,password:i,permissionPassword:d,permissions:c}))||!g.code){e.next=14;break}return e.abrupt("return",g);case 14:f=_e(p,a),ComPDFKitJS.opened_files.pop(),e.next=19;break;case 18:f=_e(r,a);case 19:e.next=22;break;case 21:f=_e(r,a);case 22:return e.abrupt("return",f);case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function we(e){var t=Module._GetComPDFkitLicenseErrorcode(),n={code:t};if(t)switch(t){case-100:n.message="The license is invalid";break;case-101:n.message="The license is expired";break;case-102:n.message="The license does not support the current platform";break;case-103:case-104:n.message="The license does not support your domain";break;case-105:n.message="The license does not support the "+e;break;case-106:n.message="License has not been initialized";break;case-107:n.message="The license does not support the current version";break;case-1e3:n.message="Illegal access to the API interface";break;case-1001:n.message="Failed to read license file"}return n}function be(){return(be=a(n().mark((function e(t){var r,o,a,i,u,l,d,s,c,f,p,g,A,h,P,m;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.doc,o=t.saveType,a=void 0===o?2:o,i=t.password,u=void 0===i?"":i,l=t.oldPassword,d=void 0===l?"":l,e.next=3,Ce(r,d);case 3:for(s=e.sent,c=Module._GetPageCount(s),f=[],p=0;p<c;p++)g=Module._GetPage(s,p),f.push(g);A=0;case 8:if(!(A<f.length)){e.next=17;break}if(Module._FlattenPage(f[A]),!(h=we("PDF Annotation FLATTEN")).code){e.next=14;break}return ComPDFKitJS.opened_files.pop(),e.abrupt("return",h);case 14:A++,e.next=8;break;case 17:if(P=null,!u||u===d){e.next=26;break}if(!(m=pe({doc:s,password:u}))||!m.code){e.next=23;break}return ComPDFKitJS.opened_files.pop(),e.abrupt("return",m);case 23:P=_e(s,a),e.next=27;break;case 26:P=_e(s,a);case 27:return ComPDFKitJS.opened_files.pop(),e.abrupt("return",{blobData:P});case 29:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(e){var t=e.annotPtr,n=e.date;n=n||new Date;var r=stringToNewUTF8(C(n));Module._SetAnnotCreationDate(t,r),function(e){var t=e.annotPtr,n=e.date;n=n||new Date;var r=stringToNewUTF8(C(n));Module._SetAnnotRecentlyModifyDate(t,r)}({annotPtr:t,date:n})}function Ee(e){var t=e.pagePtr,n=e.annotPtr,r=e.rect,o=r.left,a=r.right,i=r.bottom,u=r.top;return Module._SetAnnotRect(t,n,o,a,i,u)}function Re(e){var t=e.annotPtr,n=e.author,r=stringToNewUTF8(n);return Module._SetAnnotAuthor(t,r)}function Fe(e){var t=e.annotPtr,n=e.title,r=stringToNewUTF8(n);return Module._SetAnnotTitle(t,r)}function De(e){var t=e.annotPtr,n=e.contents,r=stringToNewUTF8(n);return Module._SetAnnotContent(t,r)}function Be(e){var t=e.annotPtr,n=b(e.borderColor);return!!Module._SetAnnotRGBColor(t,n.R,n.G,n.B)}function Ue(e){var t=e.annotPtr,n=b(e.borderColor);return!!Module._SetFreeTextBorderColor(t,n.R,n.G,n.B)}function Le(e){var t=e.annotPtr,n=e.fillColor;if(n){var r=b(n);return!!Module._SetFreeTextBgColor(t,r.R,r.G,r.B)}Module._ClearFreeTextBgColor(t)}function Ne(e){var t=e.annotPtr,n=e.fillColor;if(!n)return Module._ClearAnnotFilledRGBColor(t);var r=b(n);return!!Module._SetAnnotFilledRGBColor(t,r.R,r.G,r.B)}function ke(e){Module._SetAnnotDictName(e.annotPtr,stringToNewUTF8("trn-custom-data"),stringToNewUTF8(e.customData))}function Oe(e){var t=e.annotPtr,n=e.opacity,r=void 0===n?1:n;return Module._SetAnnotTransparency(t,r)}function He(e){var t=e.annotPtr,n=e.borderWidth;Module._SetAnnotBorderWidth(t,n)}function We(e){var t=e.annotPtr,n=e.fillTransparency,r=void 0===n?1:n;return Module._SetAnnotFilledTransparency(t,r)}function Ye(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.quadPoints,o=[],a=0;a<r.length;a++){var i=r[a];o.push(i.PointX,i.PointY)}for(var u=o.length,l=_malloc(4*u),d=0;d<u;d++)Module.HEAPF32[l/4+d]=o[d];var s=Module._SetQuadPoints(t,n,l,u);return _free(l),s}function Qe(e){var t=e.pagePtr,n=e.annotPtr,r=e.linePoints;return Module._SetLinePoint(t,n,r[0],r[1],r[2],r[3])}function Ke(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.inkPointes,o=[],a=[],i=r.length,u=0;u<i;u++){for(var l=r[u].length,d=0;d<l;d++)o.push(r[u][d].PointX,r[u][d].PointY);a.push(l)}for(var s=a.length,c=_malloc(4*s),f=0;f<s;f++)Module.HEAP32[c/4+f]=a[f];var p=o.length,g=_malloc(4*p);for(f=0;f<p;f++)Module.HEAPF32[g/4+f]=o[f];Module._SetInkPath(t,n,c,i,g),_free(g)}function Je(e){var t=e.doc,n=e.annotPtr,r=e.destPage,o=e.pageHeight;Module._SetLinkDestination(t,n,r-1,0,o,0)}function qe(e){var t=e.annotPtr,n=e.url,r=stringToNewUTF8(n);Module._SetLinkUri(t,r)}function Xe(e){var t=e.annotPtr,n=e.isChecked;Module._SetCheckBoxIsChecked(t,n);var r=we("PDF FORM FILL");if(r.code)return r}function je(e){var t=e.annotPtr,n=e.isChecked;Module._SetRadioButtonIsChecked(t,n);var r=we("PDF FORM FILL");if(r.code)return r}function Ve(e){var t=e.annotPtr,n=e.checkStyle;Module._SetWidgetCheckStyle(t,n)}function Ze(e){var t=e.annotPtr,n=b(e.fillColor);Module._SetWidgetBackgroundRGBColor(t,n.R,n.G,n.B)}function ze(e){var t=e.annotPtr,n=e.fieldName,r=stringToNewUTF8(n);Module._SetWidgetFieldName(t,r)}function $e(e){var t=e.annotPtr,n=e.fontName,r=e.fontWeight,o=e.fontStyle,a=e.fontSize,i=b(e.color||e.textColor||"#000000");ve({fontName:n,fontWeight:r,fontStyle:o});var u=stringToNewUTF8("Courier-BoldOblique");return Module._SetAnnotFontDa(t,u,a,i.R,i.G,i.B)}function et(e){var t=e.annotPtr,n=e.selected;Module._SetItemsSelectedIndex(t,n);var r=we("PDF FORM FILL");if(r.code)return r}function tt(e){var t=e.doc,n=e.annotPtr,r=e.destPage,o=e.pageHeight,a=e.actionType,i=Module._InitAction();Module._SetActionType(i,a),r&&1==a&&(Module._SetDestination(i,t,r-1,0,o,0),Module._SetButtonAction(n,i),Module._ClearAction(i))}function nt(e){var t=e.annotPtr,n=e.url,r=e.actionType,o=Module._InitAction();if(Module._SetActionType(o,r),n&&6==r){var a=stringToNewUTF8(n);Module._SetUriPath(o,a),Module._SetButtonAction(t,o),Module._ClearAction(o)}}function rt(e){var t=e.annotPtr,n=e.contents,r=stringToNewUTF8(n);Module._SetTextFieldContent(t,r);var o=we("PDF FORM FILL");if(o.code)return o}function ot(e){var t=e.annotPtr,n=e.item,r=n.index,o=n.value,a=n.string,i=stringToNewUTF8(o),u=stringToNewUTF8(a);Module._AddOptionItem(t,r,i,u)}function at(e){var t=["C","ST","L","O","OU","CN","email"],n=Module._GetSignVersion(e);Module._GetSignAlgOid(e);for(var r=U8StringData,o=function(e){switch(e){case"1.2.840.113549.1.1.1":default:return"RSA_RSA";case"1.2.840.113549.1.1.2":return"MD2RSA";case"1.2.840.113549.1.1.3":return"MD4RSA";case"1.2.840.113549.1.1.4":return"MD5RSA";case"1.2.840.113549.1.1.5":return"SHA1RSA";case"1.2.840.113549.1.1.11":return"SHA256RSA";case"1.2.156.10197.1.501":return"SM3SM2"}}(r),a={},i=0;i<7;i++)Module._GetSignSubject(e,i),a[t[i]]=U8StringData;for(var u=[],l=0;l<7;l++)Module._GetSignIssuer(e,l),u[t[l]]=U8StringData;Module._GetSignSerialNumber(e);var d=U8StringData;Module._GetSignValidDate(e,0);var s=U8StringData;Module._GetSignValidDate(e,1);var c=U8StringData;AccessInfoArray=[],Module._GetAuthorityInfoAccess(e);var f=AccessInfoArray;Module._GetSubjectKeyIdentifier(e);var p=U8StringData,g=Module._GetKeyUsage(e);PolicyArray=[],Module._GetCertificatePolicies(e);var A=PolicyArray;Module._GetAuthorityKeyIdentifier(e);var h=U8StringData;CRLPointArray=[],Module._GetCRLDistributionPoints(e);var P=CRLPointArray;Module._GetBasicConstraints(e);var m=U8StringData;Module._GetPublicKey(e);var M=U8StringData;Module._GetX509Data(e);var v=U8StringData;Module._GetSHA1Digest(e);var y=U8StringData;Module._GetMD5Digest(e);var I=U8StringData;return OCSPUrlArray=[],Module._GetOCSPUrl(e),{version:n,signAlgOid:r,signAlgOidType:o,subject:a,issuer:u,serialNumber:d,validDateStart:s,validDateEnd:c,sccessInfo:f,subjectKeyIdentifier:p,keyUsage:g,certificatePolicies:A,authorityKeyIdentifier:h,CRLDistributionPoints:P,basicConstraints:m,publicKey:M,X509Data:v,SHA1Digest:y,MD5Digest:I,ocspURL:OCSPUrlArray}}function it(e){return ut.apply(this,arguments)}function ut(){return(ut=a(n().mark((function e(t){var r,o;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=oe(t.imageBase64),o=ComPDFKitJS.opened_image.length,ComPDFKitJS.opened_image[o]=r,Module._UpdateAPWithImage(t.annotPtr,o,r.length,1,0);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lt(e){var t=e.annotPtr,n=e.content,r=e.isDrawOnlyContent,o=void 0!==r&&r,a=e.isDrowLogo,i=void 0!==a&&a,u=e.isContentAlginLeft,l=void 0!==u&&u,d=e.text,s=e.logoBase64,c=void 0===s?"":s,f=e.imageBase64,p=void 0===f?"":f,g=stringToNewUTF8(n),A=stringToNewUTF8(d);ComPDFKitJS.opened_image=[];var h=ComPDFKitJS.opened_image.length,P=0;if(c){var m=oe(c);ComPDFKitJS.opened_image[h]=m,P=m.length}var M=ComPDFKitJS.opened_image.length,v=0;if(p){var y=oe(p);ComPDFKitJS.opened_image[M]=y,v=y.length}Module._UpdateApWithDigitalSigConfig(t,g,o,i,l,A,h,P,M,v,0,0,0,0,0,0)}function dt(e,t,n){AnnotArray=[];var r=[];Module._GetReplies(e,t);for(var o=0;o<AnnotArray.length;o++){var a=AnnotArray[o];Rect={},Module._GetAnnotRect(e,t);var i={left:_(Rect.Left),top:_(Rect.Top),right:_(Rect.Right),bottom:_(Rect.Bottom)};Module._GetAnnotCreationDate(t);var u=S(U8StringData);Module._GetAnnotContent(t);var l=U8StringData;Module._GetAnnotTitle(t);var d=U8StringData;Module._GetAnnotAuthor(t);var f=U8StringData,p=_(Module._GetAnnotTransparency(t)),g=Module._GetAnnotDictName(t,stringToNewUTF8("NM"));g||(I(),c("name"),Module._SetAnnotDictName(t,stringToNewUTF8("NM"),stringToNewUTF8(g)));var A=Module._GetAnnotBorderWidth(t),h=s(s(s(s({inReplyTo:n,date:u,contents:l,rect:i,opacity:p,name:g,title:d,author:f},"date",u),"opacity",p),"borderWidth",A),"fillTransparency",1);if(Module._IsReviewStateAnnot(a)){var P=Module._GetState(a);h.state=Z[P]}if(Module._IsMarkedStateAnnot(a)){var m=Module._GetState(a);h.state=Z[m]}r.push(h)}return r}function st(e,t){var n=t.pagePtr,r=t.annotPtr,o=t.rulerPtr,a=t.color,i=t.borderColor,u=t.borderWidth,l=t.contents,d=t.date,s=t.opacity,c=t.fillTransparency,f=t.rect,p=t.author,g=t.fillColor,A=t.quadPoints,h=t.fontName,P=t.fontSize,m=t.vertices,M=t.borderStyle,v=t.dashes,y=t.head,I=t.tail,C=t.linePoints,S=t.inkPointes,x=t.arcPoints;i&&Be({annotPtr:r,borderColor:i}),i&&function(e){var t=e.annotPtr,n=b(e.borderColor);Module._SetAnnotBorderRGBColor(t,n.R,n.G,n.B)}({annotPtr:r,borderColor:i}),Object.hasOwn(t,"fillColor")&&Ne({annotPtr:r,fillColor:g}),d&&Ge({annotPtr:r,date:d}),isFinite(s)&&(!function(e){var t=e.annotPtr,n=e.opacity,r=void 0===n?1:n;Module._setMeasureTextTransparency(t,r)}({annotPtr:r,opacity:s}),Oe({annotPtr:r,opacity:s})),c&&We({annotPtr:r,fillTransparency:c}),f&&Ee({pagePtr:n,annotPtr:r,rect:f}),p&&Re({annotPtr:r,author:p}),A&&Ye({pagePtr:n,annotPtr:r,quadPoints:A}),u&&He({annotPtr:r,borderWidth:u}),(M||v)&&pt({annotPtr:r,borderWidth:u,borderStyle:M,dashes:v}),h&&P&&a&&$e({annotPtr:r,fontName:h,fontSize:P,color:a}),m&&ft({pagePtr:n,annotPtr:r,vertices:m}),null==y&&null==I||Module._SetLineType(r,W[y.toUpperCase()],W[I.toUpperCase()]),C&&Qe({pagePtr:n,annotPtr:r,linePoints:C}),S&&Ke({pagePtr:n,annotPtr:r,inkPointes:S});var T=t.precision,w=t.scale,G=t.labelPosition,E=t.leadLength,R=t.leadOffset,F=t.leadExtension;(T&&function(e){var t=e.rulerPtr,n=e.precision;Module._setPrecision(t,Math.pow(10,-Math.floor(Math.log10(n))))}({rulerPtr:o,precision:T}),w&&function(e){var t=e.rulerPtr,n=e.scale,r=n.base,o=n.baseUnit,a=n.translate,i=n.translateUnit;Module._setMeasureScale(t,r,stringToNewUTF8(o),a,stringToNewUTF8(i))}({rulerPtr:o,scale:w}),G&&function(e){var t=e.rulerPtr,n=e.labelPosition;if("top"===n)return Module._setLabelTop(t);if("inside"===n)Module._setLabelInside(t)}({rulerPtr:o,labelPosition:G}),E&&function(e){var t=e.rulerPtr,n=e.leadLength;Module._setLeadLength(t,n)}({rulerPtr:o,leadLength:E}),R&&function(e){var t=e.rulerPtr,n=e.leadOffset;Module._setLeadOffset(t,n)}({rulerPtr:o,leadOffset:R}),F&&function(e){var t=e.rulerPtr,n=e.leadExtension;Module._setLeadExtension(t,n)}({rulerPtr:o,leadExtension:F}),x)&&(PageSize.Width=0,PageSize.Height=0,Module._GetPageSizeForIndex(e,t.pageIndex),function(e){for(var t=e.rulerPtr,n=e.arcPoints,r=e.pageHeight,o=function(e,t){var n=e.map((function(e){return{x:e.x,y:t-e.y}}));return n}(n,r),a=[],i=0;i<o.length;i++){var u=o[i];a.push(u.x,u.y)}for(var l=a.length,d=_malloc(4*l),s=0;s<l;s++)Module.HEAPF32[d/4+s]=a[s];var c=Module._SetArcPoints(t,d);_free(d)}({rulerPtr:o,arcPoints:x,pageHeight:PageSize.Height}),Rect={},Module._GetArcRect(t.rulerPtr),Ee({pagePtr:n,annotPtr:r,rect:{left:_(Rect.Left),top:_(PageSize.Height-Rect.Top),right:_(Rect.Right),bottom:_(PageSize.Height-Rect.Bottom)}}));Module._UpdateAnnotMeasure(o),t.hasOwnProperty("contents")&&De({annotPtr:r,contents:l}),Module._UpdateAnnotAp(r,0),S&&u&&i&&s&&function(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.inkPointes,o=e.borderWidth,a=e.borderColor,i=e.opacity,u=[],l=[],d=r.length,s=0;s<d;s++){for(var c=r[s].length,f=0;f<c;f++)u.push(r[s][f].PointX,r[s][f].PointY);l.push(c)}for(var p=l.length,g=_malloc(4*p),A=0;A<p;A++)Module.HEAP32[g/4+A]=l[A];var h=u.length,P=_malloc(4*h);for(A=0;A<h;A++)Module.HEAPF32[P/4+A]=u[A];var m=b(a);Module._UpdateAnnotApWithInk(t,n,g,d,P,o,m.R,m.G,m.B,i),_free(P)}({pagePtr:n,annotPtr:r,inkPointes:S,borderWidth:u,borderColor:i,opacity:s})}function ct(e,t,n){MeasureInfo={},Module._getMeasureInfo(t);var r=Module._getCaptionTypes(e),o=Module._GetMeasureType(t);Module._setLabelInside(t);var a={captionType:te[r],measureType:$[o],scale:{base:MeasureInfo.RulerBase,baseUnit:MeasureInfo.RulerBaseUnit,translate:MeasureInfo.RulerTranslate,translateUnit:MeasureInfo.RulerTranslateUnit},precision:MeasureInfo.precision,factor:MeasureInfo.factor};FontDa={},Module._GetAnnotFontDa(e);var i=U8StringData;switch(a.fontName=i,a.fontSize=FontDa.fontSize,a.color=G(FontDa.R,FontDa.G,FontDa.B),RGBColor={},hasColor=Module._GetAnnotRGBColor(e),hasColor&&(a.borderColor=G(RGBColor.R,RGBColor.G,RGBColor.B)),n){case"line":a.length=Module._getMeasurementResults(t,ee.LENGTH),a.leadOffset=Module._getLeadOffset(t);var u=Module._getLeadLength(t),l=Module._getLeadExtension(t);u<0&&(l-=u,u=0),l<0&&(u-=l,l=0),a.leadLength=u,a.leadExtension=l,a.labelPosition="inside";break;case"rectangle":case"circle":case"polygon":a.area=Module._getMeasurementResults(t,ee.AREA),a.perimeter=Module._getMeasurementResults(t,ee.LENGTH),a.labelPosition="inside";break;case"polyline":a.perimeter=Module._getMeasurementResults(t,ee.LENGTH);break;case"ink":"generic"===a.captionType&&(a.perimeter=Module._getMeasurementResults(t,ee.GENERIC)),"arclength"===a.captionType&&(a.arcLength=Module._getMeasurementResults(t,ee.ARCLENGTH))}return a}function ft(e){for(var t=e.pagePtr,n=e.annotPtr,r=e.vertices,o=[],a=0;a<r.length;a++){var i=r[a];o.push(i.x,i.y)}for(var u=o.length,l=_malloc(4*u),d=0;d<u;d++)Module.HEAPF32[l/4+d]=o[d];var s=Module._setVertices(t,n,l,u);return _free(l),s}function pt(e){for(var t=e.annotPtr,n=e.dashes,r=void 0===n?[]:n,o=e.borderStyle,a=e.borderWidth,i=J[o],u=r.length,l=_malloc(4*u),d=0;d<u;d++)Module.HEAPF32[l/4+d]=r[d];var s=Module._SetAnnotBorderStyle(t,i,a,l,u);return _free(l),s}function gt(e){var t=e.pagePtr,n=e.annotPtr;MeasureVerticesArray=[],Module._getVertices(t,n);for(var r=[],o=0;o<MeasureVerticesArray.length;o++){var a=MeasureVerticesArray[o];a&&r.push({x:a.PointX,y:a.PointY})}return r}(function(){return ce.apply(this,arguments)})().then((function(){se.setUp()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compdfkit_pdf_sdk/webviewer",
3
- "version": "2.7.1",
3
+ "version": "2.7.3-rc.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "PDF SDK",