UNPKG

@syncfusion/ej2-pdfviewer

Version:
10 lines 3.75 MB
/*! * filename: ej2-pdfviewer.min.js * version : 33.1.49 * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ this.ej=this.ej||{},this.ej.pdfviewer=function(e,t,i,n,o,a,r,s,l,d,A,h,p,c,g){"use strict";function u(e){return"Line"===e.shapeAnnotationType||"LineWidthArrowHead"===e.shapeAnnotationType||"Distance"===e.shapeAnnotationType||"Polygon"===e.shapeAnnotationType}function f(e,t){if(e&&t)if(e.formFieldAnnotationType)-1!==e.id.indexOf("diagram_helper")?(t.style.fill="transparent",t.style.strokeWidth=1,t.style.strokeDashArray=e.borderDashArray):(t.style.fill="transparent",t.style.strokeWidth=0);else{var i="#ffffff00"===e.fillColor?"transparent":e.fillColor,n="Perimeter"!==e.measureType||!(!t.id||!t.id.toLowerCase().includes("srcdec")&&!t.id.toLowerCase().includes("tardec"));t.style.fill=i&&n?i:"transparent","Redaction"===e.shapeAnnotationType&&(i=m(e.markerFillColor,e.markerOpacity),t.style.fill=i),t.style.strokeColor=e.strokeColor?e.strokeColor:e.borderColor,t.style.color=e.strokeColor?e.strokeColor:e.borderColor,t.style.strokeWidth=e.thickness,"Image"!==e.shapeAnnotationType&&"SignatureText"!==e.shapeAnnotationType&&"SignatureImage"!==e.shapeAnnotationType||(t.style.strokeWidth=0),t.style.strokeDashArray=e.borderDashArray,t.style.opacity=e.opacity}}function m(e,t){return e.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*[\d.]+\s*\)/,function(e,i,n,o){return"rgba("+i+","+n+","+o+","+t+")"})}function w(e){for(var t=0,n=0;n<e.length-1;n++)t+=i.Point.findLength(e[parseInt(n.toString(),10)],e[n+1]);return t}function C(e){return i.Point.getLengthFromListOfPoints(e)}function B(e,t){var i={width:e.actualSize.width,height:e.actualSize.height,x:e.offsetX-e.actualSize.width*e.pivot.x+.5,y:e.offsetY-e.actualSize.height*e.pivot.y+.5,angle:e.rotateAngle+e.parentTransform,fill:e.style.fill,stroke:e.style.strokeColor,pivotX:e.pivot.x,pivotY:e.pivot.y,strokeWidth:1,opacity:e.style.opacity,dashArray:e.style.strokeDashArray||"",visible:e.visible,id:e.id};return t&&(i.x+=t.tx,i.y+=t.ty),i}function y(e){return void 0!==e&&"string"==typeof e&&(e=t.getValue(e,window)),e}function S(e,t,i){var n={};if(e){i=e.propName;var o=e.properties||e,a=[],r=[];if((a=a.concat(Object.keys(o))).push("version"),i){var s=y(t);r=s?s(i):[],a=a.concat(r)}for(var l=E(i),d=0,A=a=a.concat(l);d<A.length;d++){var h=A[d];"historyManager"!==h&&("wrapper"!==h?!(!e[""+h]||!Object.prototype.hasOwnProperty.call(e,"observers"))||(e[""+h]instanceof Array?n[""+h]=I(-1===l.indexOf(h)&&e[""+i]?e[""+i][""+h]:e[""+h],t,h):e[""+h]instanceof Array==!1&&e[""+h]instanceof HTMLElement?n[""+h]=e[""+h].cloneNode(!0).innerHtml:e[""+h]instanceof Array==!1&&e[""+h]instanceof Object&&"template"!==h?n[""+h]=S(-1===l.indexOf(h)&&e[""+i]?e[""+i][""+h]:e[""+h]):n[""+h]=e[""+h]):e[""+h]&&(n[""+h]={actualSize:{width:e[""+h].actualSize.width,height:e[""+h].actualSize.height},offsetX:e[""+h].offsetX,offsetY:e[""+h].offsetY}))}}return n}function I(e,t,i){var n;if(e){n=[];for(var o=0;o<e.length;o++)e[parseInt(o.toString(),10)]instanceof Array?n.push(e[parseInt(o.toString(),10)]):e[parseInt(o.toString(),10)]instanceof Object?n.push(S(e[parseInt(o.toString(),10)],t,i)):n.push(e[parseInt(o.toString(),10)])}return n}function E(e){switch(e){case"nodes":case"children":return["inEdges","outEdges","parentId","processId","nodeId","umlIndex","isPhase","isLane"];case"connectors":return["parentId"];case"annotation":case"annotations":return["nodeId"];case"shape":return["hasHeader"]}return[]}function v(e,t){var n;if("Distance"===e.shapeAnnotationType)for(var o=0,a=void 0,r=0;r<e.wrapper.children.length;r++){var s=i.Point.findAngle(e.sourcePoint,e.targetPoint);if(e.wrapper.children[parseInt(r.toString(),10)].id.indexOf("leader")>-1){var l=e.wrapper.children[0].bounds.center;0===o?(a={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},l=e.sourcePoint):(a={x:e.targetPoint.x,y:e.targetPoint.y-e.leaderHeight},l=e.targetPoint);var d=i.identityMatrix();if(i.rotateMatrix(d,s,l.x,l.y),n=i.transformPointByMatrix(d,{x:a.x,y:a.y}),t==="Leader"+o)return{leader:"leader"+o,point:n};o++}}return{leader:"",point:n}}function b(e,t){var i=(t=e.vertexPoints).slice(0);return i&&i.length>0&&(e.sourcePoint=i[0],e.targetPoint=i[i.length-1]),i}function x(e,t){for(var i,n="",o=[],a=0;a<t.length;)o.push({x:t[parseInt(a.toString(),10)].x,y:t[parseInt(a.toString(),10)].y}),a++;o=Q(e,o);for(var r=0;r<o.length;r++)i=o[parseInt(r.toString(),10)],0===r&&(n="M"+i.x+" "+i.y),r>0&&(n+=" L"+i.x+" "+i.y);return n}function V(e,t,n){var o=new i.Rect,a=x(e,t);if(o=i.Rect.toBounds(t),n.width=o.width,n.height=o.height,n.offsetX=o.x+n.width/2,n.offsetY=o.y+n.height/2,n.data=a,e.wrapper){e.wrapper.offsetX=n.offsetX,e.wrapper.offsetY=n.offsetY;var r=o.width;r=o.width<o.height?o.height:o.width,e.wrapper.width=e.enableShapeLabel?r/2:r,e.wrapper.height=o.height}return n}function M(e,t){var i=[];return i=b(e),t.staticSize=!0,t=V(e,i,t),f(e,t),t}function D(e,t,n,o,a){t.offsetX=n.x,t.offsetY=n.y;var r,s=i.Point.findAngle(n,o),l=K(a?e.sourceDecoraterShapes:e.taregetDecoraterShapes),d=0;"LineWidthArrowHead"===e.shapeAnnotationType||"Line"===e.shapeAnnotationType?(d=e.thickness,r=new i.Size(12*d,12*d)):(d=e.thickness<=5?5:e.thickness,r=new i.Size(2*d,2*d)),t.transform=i.RotateTransform.Self,f(e,t),t.style.fill="tranparent"!==e.fillColor?e.fillColor:"white",t.rotateAngle=s,t.data=l,t.canMeasurePath=!0,t.width=r.width,t.height=r.height,"Butt"!==e.sourceDecoraterShapes&&"Butt"!==e.taregetDecoraterShapes||(t.width=r.width-10,t.height=r.height+10)}function T(e,t,n,o){var a=new i.PathElement;return D(e,a,t,n,o),a}function Q(e,t){return t[0]=F(e,t,!0),t[t.length-1]=F(e,t,!1),t}function F(e,t,n){var o={x:0,y:0},a={x:0,y:0},r={x:0,y:0},s=t.length;if(a=n?t[0]:t[s-1],r=n?t[1]:t[s-2],"Butt"===(n?e.sourceDecoraterShapes:e.taregetDecoraterShapes))return a;var l=i.Point.distancePoints(a,r);l=0===l?1:l;var d=e.thickness;o.x=Math.round(a.x+d*(r.x-a.x)/l),o.y=Math.round(a.y+d*(r.y-a.y)/l);return o=i.Point.adjustPoint(o,r,!0,.5)}function k(e,t,n,o){var a=[],r=i.Point.findAngle(t[0],t[1]),s=H(e,r);return!o.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?s.content=e.notes:s.content=n.setConversion(w([t[0],t[1]])*n.pixelToPointFactor,e),s.rotateValue={y:-10,angle:r},!0===e.enableShapeLabel&&(s.style.strokeColor=e.labelBorderColor,s.style.fill=e.labelFillColor,s.style.fontSize=e.fontSize,s.style.color=e.fontColor,s.style.fontFamily=e.fontFamily),a.push(s),a}function P(e,i,n){for(var o,a=0;a<e.wrapper.children.length;a++){var r=e.wrapper.children[parseInt(a.toString(),10)];r&&!t.isNullOrUndefined(r.content)&&(o=n.setConversion(w([i[0],i[1]])*n.pixelToPointFactor,e),r.content=o,r.childNodes[0].text=r.content,r.refreshTextElement())}return o}function N(e,i){for(var n,o=0;o<e.wrapper.children.length;o++){var a=e.wrapper.children[parseInt(o.toString(),10)];a&&!t.isNullOrUndefined(a.content)&&(n=i.setConversion(e.bounds.width/2*i.pixelToPointFactor,e),a.content=n,2===a.childNodes.length?(a.childNodes[0].text=n,a.childNodes.splice(a.childNodes.length-1,1)):a.childNodes[0].text=n,a.refreshTextElement())}return n}function R(e,t,n,o){var a=[],r=i.Point.findAngle(t[0],t[1]),s=H(e,r);return!o.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?s.content=e.notes:s.content=n.calculatePerimeter(e),!0===e.enableShapeLabel&&(s.style.strokeColor=e.labelBorderColor,s.style.fill=e.labelFillColor,s.style.fontSize=e.fontSize,s.style.color=e.fontColor,s.style.fontFamily=e.fontFamily),s.rotateValue={y:-10,angle:r},a.push(s),a}function L(e,i,n){for(var o,a=0;a<e.wrapper.children.length;a++){var r=e.wrapper.children[parseInt(a.toString(),10)];r&&!t.isNullOrUndefined(r.content)&&(o=n.calculatePerimeter(e),r.content=o,r.childNodes[0].text=r.content,r.refreshTextElement())}return o}function O(e){for(var i=0;i<e.wrapper.children.length;i++){var n=e.wrapper.children[parseInt(i.toString(),10)];n&&!t.isNullOrUndefined(n.content)&&e.wrapper.children.splice(i,1)}}function U(e){if(e.wrapper&&e.wrapper.children)for(var i=0;i<e.wrapper.children.length;i++){var n=e.wrapper.children[parseInt(i.toString(),10)];n&&!t.isNullOrUndefined(n.content)&&(n.content=e.notes,n.childNodes[0].text=n.content,n.refreshTextElement())}}function z(e){var t,i="";i="M"+e[0].x+" "+e[0].y;var n;for(n=1;n<e.length;n++)i+="L"+(t=e[parseInt(n.toString(),10)]).x+" "+t.y;return i+="Z"}function H(e,t){var n=new i.TextElement;return f(e,n),n.style.fill="transparent",n.id=i.randomId(),n.horizontalAlignment="Center",n.rotateValue={y:10,angle:t},n.verticalAlignment="Top",n.relativeMode="Object",n.setOffsetWithRespectToBounds(.5,.5,"Absolute"),n.style.textWrapping="NoWrap",n}function Y(e,t){var i=[],n=G(e,t[0],t[1]);return i.push(n),n=G(e,t[1],t[0],!0),i.push(n),i}function G(e,t,n,o){var a=new i.PathElement;a.offsetX=t.x,a.offsetY=t.y;var r=i.Point.findAngle(t,n),s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=i.identityMatrix();i.rotateMatrix(l,0-r,s.x,s.y);var d=i.transformPointByMatrix(l,t),A={x:d.x,y:d.y-e.leaderHeight};l=i.identityMatrix(),i.rotateMatrix(l,r,a.offsetX,a.offsetY),d=i.transformPointByMatrix(l,A);var h={x:t.x,y:t.y};a.offsetX=h.x,a.offsetY=h.y,a.transform=i.RotateTransform.Self;var p="M"+t.x+","+t.y+",L"+d.x+","+d.y+"Z",c=new i.Size(0,e.leaderHeight);return a.pivot.x=.5,o?(a.id="leader2_"+i.randomId(),a.pivot.y=0):(a.id="leader1_"+i.randomId(),a.pivot.y=1),f(e,a),a.rotateAngle=r,a.data=p,a.canMeasurePath=!0,a.width=c.width,a.height=c.height,a}function j(e,n){var o=e.vertexPoints;if(!t.isNullOrUndefined(o))for(var a=0;a<o.length-1;a++){var r=o[parseInt(a.toString(),10)],s=o[a+1],l=i.Rect.toBounds([r,s]);if(l.Inflate(10),l.containsPoint(n)){var d=J(n,r,s),A={x1:r.x,x2:s.x,y1:r.y,y2:s.y},h={x1:n.x,x2:d.x,y1:n.y,y2:d.y},p=i.intersect3(A,h);if(p.enabled){var c=i.Point.findLength(n,p.intersectPt);if(Math.abs(c)<10)return!0}else{var g=i.Rect.toBounds([n,n]);if(g.Inflate(3),g.containsPoint(r)||g.containsPoint(s))return!0}if(i.Point.equals(n,d))return!0}}return!1}function J(e,t,n){var o;o=i.Point.findLength(t,e)>i.Point.findLength(n,e)?n:t;var a=i.Point.findAngle(t,n),r=i.Point.findAngle(o,e),s=i.Point.findLength(o,e),l=r+2*(a-r);return{x:o.x+s*Math.cos(l*Math.PI/180),y:o.y+s*Math.sin(l*Math.PI/180)}}function K(e){return po[""+e]}function W(e,t,i,n){if(i&&t.activeElements.activePageID>-1){var o=_(t,i,e),a=Z(o,e,t,i);return n?o:a}}function _(e,t,i){var n=e.currentPosition||{x:i.offsetX,y:i.offsetY};return te(n={x:n.x/e.getZoomFactor(),y:n.y/e.getZoomFactor()},t.getPageTable(e.activeElements.activePageID).objects,t.touchPadding)}function Z(e,t,n,o){var a,r,s,l=null;if(t&&t.type&&-1!==t.type.indexOf("touch")){if(a=t,o.annotation){var d=n.getElement("_pageDiv_"+o.annotation.getEventPageNumber(t));if(d){var A=d.getBoundingClientRect();r=a.changedTouches[0].clientX-A.left,s=a.changedTouches[0].clientY-A.top}}}else if(t&&t.target&&t.path&&t.target.parentElement&&t.target.parentElement.classList.contains("foreign-object")){h=t.path[4].getBoundingClientRect();r=t.clientX-h.left,s=t.clientY-h.top}else if(t.target&&t.target.parentElement&&t.target.parentElement.classList.contains("foreign-object")){h=t.target.offsetParent.offsetParent.offsetParent.getBoundingClientRect();r=t.clientX-h.left,s=t.clientY-h.top}else if(t.target&&t.target.parentElement&&t.target.parentElement.parentElement&&t.target.parentElement.parentElement.classList.contains("foreign-object")){var h=void 0;t.target.offsetParent&&t.target.offsetParent.offsetParent&&t.target.offsetParent.offsetParent.offsetParent&&t.target.offsetParent.offsetParent.offsetParent.offsetParent?(h=t.target.offsetParent.offsetParent.offsetParent.offsetParent.getBoundingClientRect(),r=t.clientX-h.left,s=t.clientY-h.top):t.target.parentElement.offsetParent&&t.target.parentElement.offsetParent.offsetParent&&(h=t.target.parentElement.offsetParent.offsetParent.getBoundingClientRect(),r=t.clientX-h.left,s=t.clientY-h.top)}else r=isNaN(t.offsetX)?t.position?t.position.x:0:t.offsetX,s=isNaN(t.offsetY)?t.position?t.position.y:0:t.offsetY;for(var p=o.touchPadding/2,c=0,g=0;g<e.length;g++)if("Distance"===e[parseInt(g.toString(),10)].shapeAnnotationType||"Line"===e[parseInt(g.toString(),10)].shapeAnnotationType||"LineWidthArrowHead"===e[parseInt(g.toString(),10)].shapeAnnotationType||n.tool instanceof bo){var u={x:r/n.getZoomFactor(),y:s/n.getZoomFactor()},f=q(e[parseInt(g.toString(),10)],u,p),m=j(e[parseInt(g.toString(),10)],u);if(f&&!m){var w=X(e[parseInt(g.toString(),10)],f);if(w){var C=i.Rect.toBounds([w,w]);C.Inflate(10),C.containsPoint(u)&&(m=!0)}}f&&m&&(l=e[parseInt(g.toString(),10)])}else{var B=e[parseInt(g.toString(),10)].wrapper.bounds,y=e[parseInt(g.toString(),10)].wrapper;if("Polygon"===e[parseInt(g.toString(),10)].shapeAnnotationType&&e[parseInt(g.toString(),10)].enableShapeLabel)for(var S=0;S<y.children.length;S++)if(y.children[parseInt(S.toString(),10)].bounds.containsPoint(n.currentPosition,o.touchPadding)){B=y.children[parseInt(S.toString(),10)].bounds;break}var I=0;if("Stamp"!==e[parseInt(g.toString(),10)].shapeAnnotationType&&"Image"!==e[parseInt(g.toString(),10)].shapeAnnotationType||(I=25),(B.x-p)*n.getZoomFactor()<r&&(B.x+B.width+p)*n.getZoomFactor()>r&&(B.y-p-I)*n.getZoomFactor()<s&&(B.y+B.height+p)*n.getZoomFactor()>s||(B.x-p)*n.getZoomFactor()<n.currentPosition.x&&(B.x+B.width+p)*n.getZoomFactor()>n.currentPosition.x&&(B.y-p-I)*n.getZoomFactor()<n.currentPosition.y&&(B.y+B.height+p)*n.getZoomFactor()>n.currentPosition.y)if(n.tool instanceof Eo||n.tool instanceof Bo)l=e[parseInt(g.toString(),10)];else if(c){var E=r-(B.x-p)*n.getZoomFactor()+((B.x+B.width+p)*n.getZoomFactor()-r)+(s-(B.y-p-I)*n.getZoomFactor())+((B.y+B.height+p)*n.getZoomFactor()-s);c>E?(l=e[parseInt(g.toString(),10)],c=E):c===E?(l=e[parseInt(g.toString(),10)],c=E):"Image"!==e[parseInt(g.toString(),10)].shapeAnnotationType&&"Stamp"!==e[parseInt(g.toString(),10)].shapeAnnotationType||(l=e[parseInt(g.toString(),10)])}else l=e[parseInt(g.toString(),10)],c=r-(B.x-p)*n.getZoomFactor()+((B.x+B.width+p)*n.getZoomFactor()-r)+(s-(B.y-p-I)*n.getZoomFactor())+((B.y+B.height+p)*n.getZoomFactor()-s)}return l}function X(e,t){var n=e.sourcePoint,o=e.targetPoint;if("Distance"===e.shapeAnnotationType){var a=t,r=void 0,s=i.Point.findAngle(e.sourcePoint,e.targetPoint);if(a.id.indexOf("leader")>-1){var l=e.wrapper.children[0].bounds.center;a.id.indexOf("leader1")>-1?(r={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},l=n):(r={x:e.targetPoint.x,y:e.targetPoint.y-e.leaderHeight},l=o);var d=i.identityMatrix();return i.rotateMatrix(d,s,l.x,l.y),i.transformPointByMatrix(d,{x:r.x,y:r.y})}}}function q(e,t,i){return ee(e.wrapper,t,i)}function $(e,t,i){if(0===i.length)i.push(e);else if(1===i.length)i[0][""+t]>e[""+t]?i.splice(0,0,e):i.push(e);else if(i.length>1){for(var n=0,o=i.length-1,a=Math.floor((n+o)/2);a!==n;)i[parseInt(a.toString(),10)][""+t]<e[""+t]?(n=a,a=Math.floor((n+o)/2)):i[parseInt(a.toString(),10)][""+t]>e[""+t]&&(o=a,a=Math.floor((n+o)/2));i[parseInt(o.toString(),10)][""+t]<e[""+t]?i.push(e):i[parseInt(n.toString(),10)][""+t]>e[""+t]?i.splice(n,0,e):i[parseInt(n.toString(),10)][""+t]<e[""+t]&&i[parseInt(o.toString(),10)][""+t]>e[""+t]&&i.splice(o,0,e)}}function ee(e,n,o){if(e&&e.children)for(var a=e.children.length-1;a>=0;a--){var r=e.children[parseInt(a.toString(),10)],s=o;if(!t.isNullOrUndefined(r.children)&&r.children.length>0)for(var l=r.children.length-1;l>=0;l--){var d=r.children[parseInt(l.toString(),10)];if(d&&d.bounds.containsPoint(n,s)){if(d instanceof i.Container&&(A=this.findTargetElement(d,n)))return A;if(d.bounds.containsPoint(n,s))return d}}else if(r&&r.bounds.containsPoint(n,s)){if(r instanceof i.Container){var A=this.findTargetElement(r,n);if(A)return A}if(r.bounds.containsPoint(n,s))return r}}if(e&&e.bounds.containsPoint(n,o)&&"none"!==e.style.fill){var h=e,p=i.identityMatrix();i.rotateMatrix(p,h.parentTransform,h.offsetX,h.offsetY);var c=h.offsetX-h.pivot.x*h.actualSize.width,g=h.offsetY-h.pivot.y*h.actualSize.height,u={x:c+(.5===h.pivot.x?2*h.pivot.x:h.pivot.x)*h.actualSize.width/2,y:g-30};if(u=i.transformPointByMatrix(p,u),i.contains(n,u,10))return e}return null}function te(e,t,i){for(var n=[],o=0,a=t;o<a.length;o++){var r=a[o];(q(r,e,i)||"Stamp"===r.shapeAnnotationType&&q(r,e,40))&&$(r,"zIndex",n)}return n}function ie(e){var t=void 0;if(e.target&&e.target.wrapper)return e.target.pageIndex;if(e.target){var i=e.target.id.split("_");i.length>0&&(t=parseInt(i[i.length-1],10))}return t}function ne(e,t,n,o,a){var r=i.createHtmlElement("div",{id:a.element.id+o+"_diagramAdornerLayer",style:"width:"+e.width+"px;height:"+e.height+"px;"+t});if(!i.getDiagramElement(r.id)){var s=a.viewerBase.getElement("_pageDiv_"+o),l=s.getBoundingClientRect(),d=oe(a.element.id+o+"_diagramAdorner_svg",l.width,l.height);d.setAttribute("class","e-adorner-layer"+o),d.style.pointerEvents="none",a.adornerSvgLayer=i.createSvgElement("g",{id:a.element.id+o+"_diagramAdorner"}),a.adornerSvgLayer.style.pointerEvents="all",d.appendChild(a.adornerSvgLayer),r.appendChild(d),r.style.width=l.width+"px",r.style.height=l.height+"px",s?s.insertBefore(r,s.childNodes[0]):n.parentElement.appendChild(r);var A=i.createSvgElement("g",{id:a.element.id+o+"_SelectorElement"});a.adornerSvgLayer.appendChild(A),i.setAttributeSvg(d,{style:"pointer-events:none;"})}a.viewerBase.applyElementStyles(r,o)}function oe(e,t,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttributeSvg(o,{id:e,width:t,height:n}),o}function ae(e,t,i,n){switch(e){case"Create":re({type:n,target:document.querySelector(t.target),cssClass:t.cssClass,label:t.label,width:t.width});break;case"Show":je(document.querySelector(i));break;case"Hide":Ke(document.querySelector(i));break;case"Set":We({cssClass:t.cssClass,type:n})}}function re(e,i){if(e.target){var n,o=t.isNullOrUndefined(i)?t.createElement:i,a=Qe(e.target,o);if(t.isNullOrUndefined(e.cssClass)||a.wrap.classList.add(e.cssClass),t.isNullOrUndefined(e.template)&&t.isNullOrUndefined(na)){var r=t.isNullOrUndefined(e.type)?Ce(a.wrap):e.type;n=xe(t.isNullOrUndefined(e.width)?void 0:e.width,r),Be(r,a.wrap,n,o),t.isNullOrUndefined(e.label)||se(a.innerWrap,e.label,o)}else{var s=t.isNullOrUndefined(e.template)?na:e.template;a.wrap.classList.add(Da),be(a.wrap,s,oa)}a.wrap.classList.add(ca),a=null}}function se(e,t,i){var n=i("div",{});return n.classList.add(Ma),n.textContent=t,e.appendChild(n),n}function le(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Material",radius:t},Te(e,n,i,ga),Pe(t,e,"Material",ga)}function de(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Fluent2",radius:t},De(e,n,Sa),ze(t,e,Sa)}function Ae(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Material3",radius:t},Te(e,n,i,ua),Pe(t,e,"Material3",ua)}function he(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Tailwind3",radius:t},Te(e,n,i,Ia),Pe(t,e,"Tailwind3",Ia)}function pe(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Bootstrap4",radius:t},Te(e,n,i,wa),Pe(t,e,"Bootstrap4",wa)}function ce(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Bootstrap5",radius:t},Te(e,n,i,Ca),Pe(t,e,"Bootstrap5",Ca)}function ge(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Tailwind",radius:t},De(e,n,Ba),ze(t,e,Ba)}function ue(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Fluent",radius:t},De(e,n,ya),ze(t,e,ya)}function fe(e,t,i){var n={};ia[""+t].timeOut=0,n[""+t]=Ve(t,i,0,0),Fe({uniqueID:t,container:e,globalInfo:n,timeOutVar:0})}function me(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Fabric",radius:t},De(e,n,fa),ze(t,e,fa)}function we(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"HighContrast",radius:t},De(e,n,Ea),ze(t,e,Ea)}function Ce(e){return window.getComputedStyle(e,":after").getPropertyValue("content").replace(/['"]+/g,"")}function Be(e,i,n,o){var a=i.querySelector("."+ba),r=a.querySelector("svg");switch(t.isNullOrUndefined(r)||a.removeChild(r),e){case"Material":le(a,n,o);break;case"Material3":Ae(a,n,o);break;case"Fabric":me(a,n);break;case"Bootstrap":ye(a,n);break;case"HighContrast":we(a,n);break;case"Bootstrap4":pe(a,n,o);break;case"Bootstrap5":ce(a,n,o);break;case"Tailwind":ge(a,n);break;case"Fluent":ue(a,n);break;case"Fluent2":de(a,n);break;case"Tailwind3":he(a,n,o)}}function ye(e,t,i){var n=Me();ia[""+n]={timeOut:0,type:"Bootstrap",radius:t},Se(e,n),Ie(e,t)}function Se(e,t,i){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("id",t),n.setAttribute("class",ma),n.setAttribute("viewBox","0 0 64 64"),e.insertBefore(n,e.firstChild);for(var o=0;o<=7;o++){var a=document.createElementNS("http://www.w3.org/2000/svg","circle");a.setAttribute("class",xa+"_"+o),a.setAttribute("r","2"),a.setAttribute("transform","translate(32,32)"),n.appendChild(a)}}function Ie(e,t){var i=e.querySelector("svg.e-spin-bootstrap");i.style.width=i.style.height=t+"px";for(var n=90,o=0;o<=7;o++){var a=He(0,0,24,n),r=i.querySelector("."+xa+"_"+o);r.setAttribute("cx",a.x+""),r.setAttribute("cy",a.y+""),n=n>=360?0:n,n+=45}}function Ee(e,t){function i(e){n.push(e),e===a&&1!==s||(e<=o&&e>1&&!r?e=parseFloat((e-.2).toFixed(2)):1===e?(e=7,e=parseFloat((e+.2).toFixed(2)),r=!0):e<8&&r?8===(e=parseFloat((e+.2).toFixed(2)))&&(r=!1):e<=8&&!r&&(e=parseFloat((e-.2).toFixed(2))),++s,i(e))}var n=[],o=e,a=t,r=!1,s=1;return i(o),n}function ve(e){for(var t=e.querySelector("svg.e-spin-bootstrap").getAttribute("id"),i=1;i<=8;i++)!function(e,t,i,n,o){function a(t){ia[""+o].isAnimate&&(++r,e.setAttribute("r",t+""),r>=n.length&&(r=0),ia[""+o].timeOut=setTimeout(a.bind(null,n[parseInt(r.toString(),10)]),18))}var r=0;a(t)}(e.getElementsByClassName("e-path-circle_"+(8===i?0:i))[0],i,0,Ee(i,i),t)}function be(e,i,n){t.isNullOrUndefined(n)||e.classList.add(n),e.querySelector(".e-spinner-inner").innerHTML=i}function xe(e,t){var i;switch(t){case"Material":i=aa;break;case"Material3":i=ra;break;case"Fabric":i=sa;break;case"Fluent2":i=Aa;break;case"Tailwind3":i=ha;break;case"Bootstrap4":i=da;break;default:i=la}return e=e?parseFloat(e+""):i,"Bootstrap"===t?e:e/2}function Ve(e,t,i,n){return{radius:t,count:i,previousId:n}}function Me(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}function De(e,t,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("id",t),o.setAttribute("class",i);var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class",xa);var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class",Va),e.insertBefore(o,e.firstChild),o.appendChild(a),o.appendChild(r)}function Te(e,t,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("class",n),o.setAttribute("id",t);var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class",xa),e.insertBefore(o,e.firstChild),o.appendChild(a)}function Qe(e,t){var i=t("div",{});i.classList.add(va);var n=t("div",{});return n.classList.add(ba),e.appendChild(i),i.appendChild(n),{wrap:i,innerWrap:n}}function Fe(e){ke(1,149,Ue,1333,e.globalInfo[e.uniqueID].count,75,e),e.globalInfo[e.uniqueID].count=++e.globalInfo[e.uniqueID].count%4}function ke(e,i,n,o,a,r,s){function l(i){var a=Math.max(0,Math.min((new Date).getTime()-h,o));t.isNullOrUndefined(ia[i.uniqueID])||t.isNullOrUndefined(ia[i.uniqueID].timeOut)||(d(n(a,e,p,o),i.container),A===i.globalInfo[i.uniqueID].previousId&&a<o?ia[i.uniqueID].timeOut=requestAnimationFrame(function(){return l(i)}):(clearTimeout(ia[i.uniqueID].timeOut),ia[i.uniqueID].timeOut=null,Fe(i)))}function d(e,i){if(!t.isNullOrUndefined(i.querySelector("svg.e-spin-material"))||!t.isNullOrUndefined(i.querySelector("svg.e-spin-material3"))){var n=void 0;if(t.isNullOrUndefined(i.querySelector("svg.e-spin-material"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-material").querySelector("path.e-path-circle"))?t.isNullOrUndefined(i.querySelector("svg.e-spin-fluent2"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-fluent2").querySelector("path.e-path-circle"))?t.isNullOrUndefined(i.querySelector("svg.e-spin-material3"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-material3").querySelector("path.e-path-circle"))?t.isNullOrUndefined(i.querySelector("svg.e-spin-tailwind3"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-tailwind3").querySelector("path.e-path-circle"))||(n=i.querySelector("svg.e-spin-tailwind3")):n=i.querySelector("svg.e-spin-material3"):n=i.querySelector("svg.e-spin-fluent2"):n=i.querySelector("svg.e-spin-material"),!t.isNullOrUndefined(n)){var o=n.querySelector("path.e-path-circle");o.setAttribute("stroke-dashoffset",Oe(c,g,e,r)+""),o.setAttribute("transform","rotate("+u+" "+c/2+" "+c/2+")")}}}var A=++s.globalInfo[s.uniqueID].previousId,h=(new Date).getTime(),p=i-e,c=Ne(2*s.globalInfo[s.uniqueID].radius+""),g=Le(c),u=-90*(s.globalInfo[s.uniqueID].count||0);!t.isNullOrUndefined(ia[s.uniqueID])&&ia[s.uniqueID].timeOut&&(clearTimeout(ia[s.uniqueID].timeOut),ia[s.uniqueID].timeOut=null),l(s)}function Pe(e,t,i,n){var o=2*e,a=t.querySelector("svg."+n),r=a.querySelector("path.e-path-circle"),s=Le(o),l=o/2+"px";a.setAttribute("viewBox","0 0 "+o+" "+o),a.style.width=a.style.height=o+"px",a.style.transformOrigin=l+" "+l+" "+l,r.setAttribute("d",Re(o,s)),"Material"!==i&&"Material3"!==i||(r.setAttribute("stroke-width",s+""),r.setAttribute("stroke-dasharray",(o-s)*Math.PI*.75+""),r.setAttribute("stroke-dashoffset",Oe(o,s,1,75)+"")),"Tailwind3"===i&&r.setAttribute("stroke-width",s+"")}function Ne(e){return parseFloat(e)}function Re(e,t){var i=e/2,n=t/2;return"M"+i+","+n+"A"+(i-n)+","+(i-n)+" 0 1 1 "+n+","+i}function Le(e){return.1*e}function Oe(e,t,i,n){return(e-t)*Math.PI*(3*n/100-i/100)}function Ue(e,t,i,n){var o=(e/=n)*e,a=o*e;return t+i*(6*a*o+-15*o*o+10*a)}function ze(e,t,i){var n=e,o=e,a=2*e,r=t.querySelector("."+i),s=r.querySelector(".e-path-circle"),l=r.querySelector(".e-path-arc"),d=a/2+"px";s.setAttribute("d",Ge(n,o,e)),l.setAttribute("d",Ye(n,o,e,315,45)),r.setAttribute("viewBox","0 0 "+a+" "+a),r.style.transformOrigin=d+" "+d+" "+d,r.style.width=r.style.height=a+"px"}function He(e,t,i,n){var o=(n-90)*Math.PI/180;return{x:e+i*Math.cos(o),y:t+i*Math.sin(o)}}function Ye(e,t,i,n,o){var a=He(e,t,i,o),r=He(e,t,i,n);return["M",a.x,a.y,"A",i,i,0,0,0,r.x,r.y].join(" ")}function Ge(e,t,i){return["M",e,t,"m",-i,0,"a",i,i,0,1,0,2*i,0,"a",i,i,0,1,0,2*-i,0].join(" ")}function je(e){Je(e,!1),e=null}function Je(e,i){var n;if(e&&(n=e.classList.contains(va)?e:e.querySelector("."+va)),e&&n){var o=n.querySelector("."+ba);if(i?!n.classList.contains(Da)&&!n.classList.contains(ca):!n.classList.contains(Da)&&!n.classList.contains(pa)){var a=n.querySelector("svg");if(t.isNullOrUndefined(a))return;var r=a.getAttribute("id");switch(ia[""+r].isAnimate=!i,ia[""+r].type){case"Material":case"Material3":case"Fluent2":case"Tailwind3":i?clearTimeout(ia[""+r].timeOut):fe(o,r,ia[""+r].radius);break;case"Bootstrap":i?clearTimeout(ia[""+r].timeOut):ve(o)}}i?t.classList(n,[ca],[pa]):t.classList(n,[pa],[ca]),e=null}}function Ke(e){Je(e,!0),e=null}function We(e,i){var n=t.isNullOrUndefined(i)?t.createElement:i;void 0!==e.template&&(na=e.template,void 0!==e.template&&(oa=e.cssClass));for(var o=document.querySelectorAll("."+va),a=0;a<o.length;a++)_e(e.template,o[parseInt(a.toString(),10)],e.type,e.cssClass,n)}function _e(e,i,n,o,a){t.isNullOrUndefined(e)&&!i.classList.contains(Da)?(Ze(i,n,o,a),i.classList.contains(pa)?(i.classList.remove(pa),je(i)):(i.classList.remove(ca),Ke(i))):(na=e,t.isNullOrUndefined(o)||(oa=o))}function Ze(e,i,n,o){t.isNullOrUndefined(n)||e.classList.add(n);var a=e.querySelector("svg"),r="Bootstrap"===i?parseFloat(a.style.height):parseFloat(a.style.height)/2;if(a.getAttribute("class").split(/\s/).indexOf("e-spin-material")>=0){var s=a.getAttribute("id");clearTimeout(ia[""+s].timeOut)}Be(i,e,r,o)}function Xe(){return qa}function qe(){function e(){l.Init=A.cwrap("FPDF_InitLibrary"),l.RenderPageBitmap=A.cwrap("FPDF_RenderPageBitmap","",["number","number","number","number","number","number","number","number"]),l.Bitmap_FillRect=A.cwrap("FPDFBitmap_FillRect","",["number","number","number","number","number","number"]),l.Bitmap_CreateEx=A.cwrap("FPDFBitmap_CreateEx","number",["number","number","number","number","number"]),l.Bitmap_Destroy=A.cwrap("FPDFBitmap_Destroy","",["number"]),l.LoadPage=A.cwrap("FPDF_LoadPage","number",["number","number"]),l.ClosePage=A.cwrap("FPDF_ClosePage","",["number"]),l.LoadCustomDocument=A.cwrap("FPDF_LoadCustomDocument","number",["number","string"]),l.LoadMemDocument=A.cwrap("FPDF_LoadMemDocument","number",["number","number","string"]),l.GetPageSizeByIndex=A.cwrap("FPDF_GetPageSizeByIndex","number",["number","number","number","number"]),l.GetLastError=A.cwrap("FPDF_GetLastError","number"),l.GetPageCount=A.cwrap("FPDF_GetPageCount","number",["number"]),l.CloseDocument=A.cwrap("FPDF_CloseDocument","",["number"]),l.DestroyLibrary=A.cwrap("FPDF_DestroyLibrary"),l.LoadTextPage=A.cwrap("FPDFText_LoadPage","number",["number"]),l.CloseTextPage=A.cwrap("FPDFText_ClosePage","",["number"]),l.TextCountChars=A.cwrap("FPDFText_CountChars","number",["number"]),l.GetUnicodeChar=A.cwrap("FPDFText_GetUnicode","number",["number"]),l.GetCharBox=A.cwrap("FPDFText_GetCharBox","number",["number","number","number","number","number"]),l.GetPageRotation=A.cwrap("FPDFPage_GetRotation","number",["number"]),l.GetCharAngle=A.cwrap("FPDFText_GetCharAngle","number",["number"]),l.TextFindStart=A.cwrap("FPDFText_FindStart","",["number","number","number","number"]),l.TextFindClose=A.cwrap("FPDFText_FindClose","",["number"]),l.TextFindNext=A.cwrap("FPDFText_FindNext","",["number"]),l.TextFindResultIndex=A.cwrap("FPDFText_GetSchResultIndex","",["number"]),l.TextFindCount=A.cwrap("FPDFText_GetSchCount","",["number"]),l.GetPageHeight=A.cwrap("FPDF_GetPageHeight","number",["number"]),l.GetPageHeight=A.cwrap("FPDF_GetPageHeight","number",["number"]),l.GetPageWidth=A.cwrap("FPDF_GetPageWidth","number",["number"]),d.heap=function(e,t){var i;switch(e){case Int8Array:i=A.HEAP8;break;case Int16Array:i=A.HEAP16;break;case Int32Array:i=A.HEAP32;break;case Uint8Array:i=A.HEAPU8;break;case Uint16Array:i=A.HEAPU16;break;case Uint32Array:i=A.HEAPU32;break;case Float32Array:i=A.HEAPF32;break;case Float64Array:i=A.HEAPF64}var n=e.BYTES_PER_ELEMENT,o=(A.asm&&A.asm.malloc?A.asm.malloc:A._malloc)(t*n),a=Array(1+t),r=A.asm&&A.asm.free?A.asm.free:A._free;a[0]={s:t,J:e,Z:n,E:i,m:o,free:function(){return r(o)}};for(var s=0;s<t;s++)!function(e){a[e+1]={p:o+e*n,get v(){return i[o/n+e]}}}(s);return a}}function t(){((r=!0)||s)&&i()}function i(){e(),d.loaded&&d.loaded()}function n(e){return{getFileSize:function(){return e.length},readBlock:function(t,i,n){if(t+n>e.length)return console.error("Requested chunk is out of bounds"),0;for(var o=0;o<n;o++)A.HEAPU8[i+o]=e[t+o];return 1}}}var o,a,r=!1,s=!1,l={},d=d||{},A=void 0!==d.Module?d.Module:{},h=Float64Array,p=function(e,t,i){return function(n){var o=d.heap(e,t),a=o[0],r=o.slice(1);if(!n.apply(void 0,r.map(function(e){return e.p})))return a.free(),i;var s=r.map(function(e){return e.v});return a.free(),s}};Object.assign(l,{LCD_TEXT:2,NO_NATIVETEXT:4,GRAYSCALE:8,DEBUG_INFO:128,NO_CATCH:256,RENDER_LIMITEDIMAGECACHE:512,RENDER_FORCEHALFTONE:1024,PRINTING:2048,REVERSE_BYTE_ORDER:16,Bitmap_Gray:1,Bitmap_BGR:2,Bitmap_BGRx:3,Bitmap_BGRA:4,LAST_ERROR:{SUCCESS:0,UNKNOWN:1,FILE:2,FORMAT:3,PASSWORD:4,SECURITY:5,PAGE:6}}),A.onRuntimeInitialized=function(){s=!0,t()},d.onload=function(){r=!0,t()},d.loaded=function(){c.postMessage({message:"loaded"})};var c=self;c.onmessage=function(e){if("initialLoading"===e.data.message)importScripts(e.data.url+"/pdfium.js"),A.url=e.data.url,A.onRuntimeInitialized=function(){if(s=!0,t(),e.data.fonts&&Object.keys(e.data.fonts).length>0){var i="/usr/share/fonts/";A.FS&&A.FS.createPath?A.FS.createPath("/",i,!0,!0):A.FS_createPath("/",i,!0,!0);for(var n in e.data.fonts)e.data.fonts[""+n]&&-1===n.indexOf("fallbackfonts")&&(A.FS&&A.FS.createDataFile?A.FS.createDataFile(i+n,null,e.data.fonts[""+n],!0,!0,!0):A.FS_createDataFile(i+n,null,e.data.fonts[""+n],!0,!0,!0))}},this.PDFiumModule(A);else if("LoadPageCollection"===e.data.message){a&&e.data.skipOnReload&&((R=A.asm&&A.asm.free?A.asm.free:A._free)(a.processor.wasmData.wasmBuffer),l.CloseDocument(a.processor.wasmData.wasm),l.DestroyLibrary(),A.removeFunction&&o&&A.removeFunction(o),a=null),d.fileByteArray=e.data.uploadedFile;B=d.fileByteArray.length;if(l.Init(),A.asm&&A.asm.malloc){i=A.asm.malloc(B);A.HEAPU8.set(d.fileByteArray,i),d.fileByteArray=null,a=new w({wasm:l.LoadMemDocument(i,B,e.data.password),wasmBuffer:i})}else{var i=(y=A.asm&&A.asm.malloc?A.asm.malloc:A._malloc)(B),r=n(e.data.uploadedFile);o=A.addFunction(function(e,t,i,n){return r.readBlock(t,i,n)},"iiiii");var g=y(12),f={mFileLen:r.getFileSize(),mGetBlock:o,mParam:null};A.setValue(g,f.mFileLen,"i32"),A.setValue(g+4,f.mGetBlock,"*"),A.setValue(g+8,f.mParam?f.mParam:0,"*");var C=l.LoadCustomDocument(g,e.data.password);a=new w({wasm:C,wasmBuffer:i})}d.fileByteArray=null,c.postMessage({message:"PageLoaded",pageIndex:e.data.pageIndex,isZoomMode:e.data.isZoomMode})}else if("LoadPageStampCollection"===e.data.message){var B=e.data.uploadedFile.length;l.Init();var y=A.asm&&A.asm.malloc?A.asm.malloc:A._malloc,i=y(B);A.HEAPU8.set(e.data.uploadedFile,i);var S=new w({wasm:l.LoadMemDocument(i,B,e.data.password),wasmBuffer:i});S.pageSizes=new m(e.data.pageSize[0],e.data.pageSize[1]),S.pageRotation.push(e.data.rotation);var I=S.getPage(e.data.pageIndex),E=e.data;(b=I.render(null,E.zoomFactor,!1,null,null,null,!0)).message="LoadedStamp",b.annotName=e.data.AnnotName,b.rubberStampAnnotationPageNumber=e.data.rubberStampAnnotationPageNumber,b.annotationOrder=e.data.annotationOrder,b.collectionOrder=e.data.collectionOrder,b.isFormField=e.data.isFormField,b.isFormField&&(b.message="LoadedStampForFormFields",b.formFieldName=e.data.formFieldName,b.formFieldList=e.data.formFieldList,b.formFields=e.data.rubberStampAnnotation,b.PageIndex=e.data.PageIndex),c.postMessage(b)}if(a)if("renderPage"===e.data.message){var I=a.getPage(e.data.pageIndex),v=e.data,b=I.render(null,v.zoomFactor,v.isTextNeed,null,null,v.textDetailsId,null,e.data.cropBoxRect,e.data.mediaBoxRect);c.postMessage(b)}else if("renderPageSearch"===e.data.message){var I=a.getPage(e.data.pageIndex),x=e.data;(b=I.render(null,x.zoomFactor,x.isTextNeed,null,null,x.textDetailsId,null,e.data.cropBoxRect)).message="imageRenderedSearch",c.postMessage(b)}else if(-1!==e.data.message.indexOf("extractText")){var I=a.getPage(e.data.pageIndex),V=e.data,M=e.data.isSkipCharacterBounds;(b=I.render("extractText",V.zoomFactor,V.isTextNeed,null,null,V.textDetailsId,null,null,null,null,M)).message=e.data.message,b.isLayout=e.data.isLayout,b.isRenderText=e.data.isRenderText,b.jsonObject=e.data.jsonObject,b.requestType=e.data.requestType,b.annotationObject=e.data.annotationObject,b.pageIndex=e.data.pageIndex,b.options=e.data.options,b.isAPI=e.data.isAPI,b.isNeedToRender=e.data.isNeedToRender,c.postMessage(b)}else if("searchText"===e.data.message){for(var D=l.GetPageCount(a.processor.wasmData.wasm),T=e.data.startIndex,Q=e.data.endIndex,F=!0===e.data.matchCase?1:0,k=e.data.searchWord,P=0,N={},R=A.asm&&A.asm.free?A.asm.free:A._free,L=function(e){return e?/[\u2018\u2019\u201B\u02BC\uFF07\u201C\u201D\uFF02]/.test(e)?e.normalize("NFKC").replace(/[\u2018\u2019\u201B\u02BC\uFF07]/g,"'").replace(/[\u201C\u201D\uFF02]/g,'"').replace(/\u00A0/g," ").replace(/(\w)[’‘]/g,"$1'"):e.replace(/'/g,"’").replace(/"/g,"”"):e}(k),O=k!==L,U=function(e,t){for(var i=new Uint16Array(t.length+1),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);i[t.length]=0;var o=(A.asm&&A.asm.malloc?A.asm.malloc:A._malloc)(i.length*i.BYTES_PER_ELEMENT);return A.HEAPU16.set(i,o/Uint16Array.BYTES_PER_ELEMENT),{handle:l.TextFindStart(e,o,F,0),pointer:o}},z=T;z<Q;z++)!function(e){var t=l.LoadPage(a.processor.wasmData.wasm,e),i=l.LoadTextPage(t),n=l.GetPageHeight(t),o=void 0,r=!1,s=U(i,k);if(l.TextFindNext(s.handle)?(r=!0,l.TextFindClose(s.handle),o={handle:l.TextFindStart(i,s.pointer,F,0),pointer:s.pointer}):(l.TextFindClose(s.handle),R(s.pointer)),!r&&O)o=U(i,L);else if(!r)return l.ClosePage(t),"continue";for(var d=-1;l.TextFindNext(o.handle);)!function(){P++,d++;var t=l.TextFindCount(o.handle),a=l.TextFindResultIndex(o.handle);N[parseInt(e.toString(),10)]||(N[parseInt(e.toString(),10)]={Indices:[],Bounds:{},PageOccurrence:0}),N[parseInt(e.toString(),10)].Bounds[parseInt(d.toString(),10)]||(N[parseInt(e.toString(),10)].Bounds[parseInt(d.toString(),10)]=[]),N[parseInt(e.toString(),10)].Indices.push(T);for(var r=Number.POSITIVE_INFINITY,s=0,A=Number.POSITIVE_INFINITY,c=0,g=0;g<t;g++)!function(t){var o=l.GetUnicodeChar(i,a+t),g=String.fromCharCode(o);if("\r"!==g&&"\n"!==g){var f=p(h,4,[-1,-1,-1,-1])(function(e,n,o,r){return l.GetCharBox(i,a+t,e,n,o,r)});r=Math.min(r,f[0]),s=Math.max(s,f[1]),A=Math.min(A,f[2]),c=Math.max(c,f[3])}if("\r"===g){var m=new u(r*(96/72),96/72*(n-(c-A)-A),96/72*(s-r),96/72*(c-A),"",null);N[parseInt(e.toString(),10)].Bounds[parseInt(d.toString(),10)].push(m),N[parseInt(e.toString(),10)].Bounds[parseInt(d.toString(),10)].sort(function(e,t){return e.Top===t.Top?e.Left-t.Left:e.Top-t.Top}),r=Number.POSITIVE_INFINITY,s=0,A=Number.POSITIVE_INFINITY,c=0}}(g);var f=new u(r*(96/72),96/72*(n-(c-A)-A),96/72*(s-r),96/72*(c-A),"",null);N[parseInt(e.toString(),10)].Bounds[parseInt(d.toString(),10)].push(f),N[parseInt(e.toString(),10)].Bounds[parseInt(d.toString(),10)].sort(function(e,t){return e.Top===t.Top?e.Left-t.Left:e.Top-t.Top}),N[parseInt(e.toString(),10)].PageOccurrence=d+1}();l.TextFindClose(o.handle),R(o.pointer),l.ClosePage(t)}(z);var H={totalSearchCount:P,resultPages:N,message:"textSearched",searchWord:k,matchCase:e.data.matchCase,isRequestsend:e.data.isRequestsend,isCompletedSearch:Q===D,endIndex:Q};c.postMessage(H)}else if("renderThumbnail"===e.data.message)new Promise(function(t,i){try{var n=a.getPage(e.data.pageIndex);if(null!==n.processor&&void 0!==n.processor){var o=n.render("thumbnail",null,e.data.isTextNeed,null,null,null,null,e.data.cropBoxRect,e.data.mediaBoxRect,null,e.data.isSkipCharacterBounds,e.data.imageSize);o.isRenderText=e.data.isRenderText,o.jsonObject=e.data.jsonObject,o.requestType=e.data.requestType,t(o)}}catch(e){i(e)}}).then(function(e){c.postMessage(e)});else if("renderPreviewTileImage"===e.data.message)(b=(I=a.getPage(e.data.pageIndex)).render("thumbnail",null,e.data.isTextNeed,null,null,null,null,null,null,null,e.data.isSkipCharacterBounds,e.data.imageSize)).message="renderPreviewTileImage",b.isRenderText=e.data.isRenderText,b.jsonObject=e.data.jsonObject,b.requestType=e.data.requestType,b.startIndex=e.data.startIndex,b.endIndex=e.data.endIndex,b.imageSize=e.data.imageSize,b.initialLoad=e.data.initialLoad,c.postMessage(b);else if("printImage"===e.data.message){b=(I=a.getPage(e.data.pageIndex)).render("print",null,!1,e.data.printScaleFactor,e.data.printDevicePixelRatio);c.postMessage(b)}else if("extractImage"===e.data.message||"extractImages"===e.data.message||0===e.data.message.indexOf("extractImage_")||0===e.data.message.indexOf("extractImages_")){var I=a.getPage(e.data.pageIndex),Y=e.data;(b=I.render(null,Y.zoomFactor,Y.isTextNeed,null,null,Y.textDetailsId,null,null,null,e.data.size)).message=e.data.message,c.postMessage(b)}else if("renderImageAsTile"===e.data.message){var G=e.data,b=(I=a.getPage(e.data.pageIndex)).renderTileImage(G.tileX,G.tileY,G.tileXCount,G.tileYCount,G.zoomFactor,e.data.isTextNeed,e.data.textDetailsId,e.data.cropBoxRect,e.data.mediaBoxRect);c.postMessage(b)}else if("renderImageAsTileSearch"===e.data.message){G=e.data;(b=(I=a.getPage(e.data.pageIndex)).renderTileImage(G.tileX,G.tileY,G.tileXCount,G.tileYCount,G.zoomFactor,e.data.isTextNeed,e.data.textDetailsId,e.data.cropBoxRect,e.data.mediaBoxRect)).message="renderTileImageSearch",c.postMessage(b)}else"unloadFPDF"===e.data.message&&a&&((R=A.asm&&A.asm.free?A.asm.free:A._free)(a.processor.wasmData.wasmBuffer),l.CloseDocument(a.processor.wasmData.wasm),l.DestroyLibrary(),A.removeFunction&&o&&A.removeFunction(o),a=null);"unloadFPDF"===e.data.message&&c.postMessage({message:""})};var g=function(){function e(e,t){this.index=e,this.src=null,this.processor=t}return e.prototype.render=function(e,t,i,n,o,a,r,s,l,d,A,h){return this.processor.render(this.index,e,t,i,n,o,a,r,s,l,d,A,h)},e.prototype.renderTileImage=function(e,t,i,n,o,a,r,s,l){return this.processor.renderTileImage(this.index,e,t,i,n,o,a,r,s,l)},e}(),u=function(){function e(e,t,i,n,o,a){this.X=e,this.Y=t,this.Width=i,this.Height=n,this.Bottom=this.Y+this.Height,this.Right=this.X+this.Width,this.Top=this.Y,this.Left=this.X,this.Rotation=a,this.Text=o}return e}(),f=function(){function e(e){this.TextBounds=[],this.TextContent=[],this.CharacterBounds=[],this.PageText="",this.wasmData=e}return e.prototype.getPageSize=function(e){var t=this;return void 0===e&&(e=0),p(h,2,[-1,-1])(function(i,n){return l.GetPageSizeByIndex(t.wasmData.wasm,e,i,n)}).map(function(e){return parseInt((e*(96/72)).toString(),10)})},e.prototype.getCharBounds=function(e,t){return void 0===t&&(t=0),p(h,4,[-1,-1,-1,-1])(function(i,n,o,a){return l.GetCharBox(e,t,i,n,o,a)})},e.prototype.getRender=function(e,t,i,n,o,a,r,s){void 0===e&&(e=0);var d=l.REVERSE_BYTE_ORDER,h=(A.asm&&A.asm.malloc?A.asm.malloc:A._malloc)(t*i*4);A.HEAPU8.fill(0,h,h+t*i*4);var p=l.Bitmap_CreateEx(t,i,l.Bitmap_BGRA,h,4*t),c=l.LoadPage(this.wasmData.wasm,e);return l.Bitmap_FillRect(p,0,0,t,i,o?16777215:4294967295),l.RenderPageBitmap(p,c,0,0,t,i,0,d),l.Bitmap_Destroy(p),this.textExtraction(c,e,n,a,r,s),l.ClosePage(c),h},e.prototype.textExtraction=function(e,t,i,n,o,a){var r;if(i){var s=this.getPageSize(t),d=s[0],A=s[1];o&&n&&o.y!==n.y&&(A+=this.pointerToPixelConverter(o&&o.y?o.y:0));var h=l.LoadTextPage(e),p=l.GetPageRotation(e),c=l.TextCountChars(h);this.TextBounds=[],this.TextContent=[],this.CharacterBounds=[];for(var g="",f=0,m=0,w=0,C=0,B=[],y=[],S=[],I=[],E=[],v="",b=0,x=0,V=0,M=0,D=0,T=!0,Q=!1,F=!1,k=!1,P=0;P<=c;P++)if(a){var N=l.GetUnicodeChar(h,P),R=String.fromCharCode(N);P<c&&(g+=R)}else{var N=l.GetUnicodeChar(h,P),L=l.GetCharAngle(h,P),R=String.fromCharCode(N),O=this.getCharBounds(h,P),U=O[0],z=O[1],H=O[2],Y=O[3],G=this.pointerToPixelConverter(U)-this.pointerToPixelConverter(o&&o.x?o.x:n?n.x:0),j=A+this.pointerToPixelConverter(n&&n.y?n.y:0)-this.pointerToPixelConverter(Y),J=this.pointerToPixelConverter(z-U),K=this.pointerToPixelConverter(Y-H),W=parseInt((180*L/Math.PI).toString(),10);if(P<c)if(g+=R,270===W&&1===p){var _=this.pointerToPixelConverter(H)-this.pointerToPixelConverter(n&&n.x?n.x:0),Z=this.pointerToPixelConverter(U);K=this.pointerToPixelConverter(K);X=new u(_,Z,J,K,R,W);this.CharacterBounds.push(X)}else{X=new u(G,j,J,K,R,W);this.CharacterBounds.push(X)}switch(1!==p&&3!==p||(j=d-this.pointerToPixelConverter(Y)),R){case"\0":f=Math.min.apply(Math,B),m=Math.max.apply(Math,y),w=Math.min.apply(Math,S),C=Math.max.apply(Math,I);$=new u(b,V,x-b,M-V,v,D);E.push($),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],T=!0,F=!1,v="",B=[],S=[],y=[],I=[],f=0,m=0,w=0,C=0;break;case"\r":if(P<c){q=new u(G,j,J,K,"\r\n",W);B.push(q.Top),y.push(q.Bottom),S.push(q.Left),I.push(q.Right),f=Math.min.apply(Math,B),m=Math.max.apply(Math,y),w=Math.min.apply(Math,S),C=Math.max.apply(Math,I);$=void 0;!1===T&&($=new u(b,V,x-b,M-V,v,D),E.push($)),E.push(q),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],T=!0,F=!1,v="",B=[],S=[],y=[],I=[],f=0,m=0,w=0,C=0,g+="\n",L=l.GetCharAngle(h,P),U=(r=this.getCharBounds(h,P))[0],z=r[1],H=r[2],Y=r[3],G=this.pointerToPixelConverter(U),j=A-this.pointerToPixelConverter(Y),J=this.pointerToPixelConverter(z-U),K=this.pointerToPixelConverter(Y-H),W=parseInt((180*L/Math.PI).toString(),10);var X=new u(G,j,J,K,R,W);this.CharacterBounds.push(X),P++}break;case"":case"￾":q=new u(G,j,J,K,R,W);B.push(q.Top),y.push(q.Bottom),S.push(q.Left),I.push(q.Right),f=Math.min.apply(Math,B),m=Math.max.apply(Math,y),w=Math.min.apply(Math,S),C=Math.max.apply(Math,I);$=void 0;!1===T&&($=new u(b,V,x-b,M-V,v,D),E.push($)),""===R&&E.push(q),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],T=!0,F=!1,v="",B=[],S=[],y=[],I=[],f=0,m=0,w=0,C=0;break;default:if(0===J||0===K){Q=!0,f=Math.min.apply(Math,B),m=Math.max.apply(Math,y),w=Math.min.apply(Math,S),C=Math.max.apply(Math,I);$=new u(b,V,x-b,M-V,v,D);E.push($),V=(q=new u(G,j,J,K,R,W)).Top,M=q.Bottom,b=q.Left,x=q.Right,v=R,D=E[E.length-1].Rotation,$=new u(b,V,x-b,M-V,v,D),E.push($),V=0,M=0,b=0,x=0,v="",D=0,T=!0,F=!0}else{!0===T&&(V=j,M=j+K,b=G,x=G+J);var q=new u(G,j,J,K,R,W);if(" "!==R){if(F&&E.length>0&&W===E[0].Rotation&&((180===W||0===W)&&Math.abs(q.Y-E[0].Y)>11&&(k=!0),(270===W||90===W)&&Math.abs(q.X-E[0].X)>11&&(k=!0)),Q&&E.length>=1&&E[E.length-1].Rotation!==q.Rotation||k){Q=!1,k=!1,f=Math.min.apply(Math,B),m=Math.max.apply(Math,y),w=Math.min.apply(Math,S),C=Math.max.apply(Math,I);$=void 0;!1===T&&($=new u(b,V,x-b,M-V,v,D),E.push($)),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],T=!0,v="",B=[],S=[],y=[],I=[],f=0,m=0,w=0,C=0}B.push(q.Top),y.push(q.Bottom),S.push(q.Left),I.push(q.Right),V=Math.min(V,q.Top),M=Math.max(M,q.Bottom),b=Math.min(b,q.Left),x=Math.max(x,q.Right),v+=R,D=q.Rotation,T=!1,F=!1}else{var $=new u(b,V,x-b,M-V,v,D);E.push($),V=q.Top,M=q.Bottom,b=q.Left,x=q.Right,v=R,D=q.Rotation,$=new u(b,V,x-b,M-V,v,D),E.push($),V=0,M=0,b=0,x=0,v="",D=0,T=!0,F=!0}}}}l.CloseTextPage(h),this.Rotation=p,this.PageText=g}},e.prototype.pointerToPixelConverter=function(e){return e*(96/72)},e.prototype.textBoundsCalculation=function(e,t,i,n,o,a,r,s,l){var d,A=!1,h="",p=e.reduce(function(e,t){return e+t.Text},""),c=this.checkIsRtlText(p);if(l>=5e3){for(var g=[],f=0,m=function(e,t){t.minX=Math.min(t.minX,e.X),t.minY=Math.min(t.minY,e.Y),t.maxX=Math.max(t.maxX,e.X+e.Width),t.maxY=Math.max(t.maxY,e.Y+e.Height)},w=0;w<e.length;w++)!function(t){var i=0;if(t<e.length-1&&(i=e[parseInt((t+1).toString(),10)].Left-e[parseInt(t.toString(),10)].Right),i>=5&&"\r\n"!==e[parseInt(t.toString(),10)].Text){for(var n={minX:e[parseInt(f.toString(),10)].X,minY:e[parseInt(f.toString(),10)].Y,maxX:e[parseInt(f.toString(),10)].X,maxY:e[parseInt(f.toString(),10)].Y},o="",a=[],r=f;r<=t;r++){w=e[parseInt(r.toString(),10)];m(w,n),a.push(w.Height),o+=w.Text}var s=n.maxX-n.minX,l=n.maxY-n.minY,d=new u(n.minX,n.minY,s,l,o,e[0].Rotation);g.push(d),f=t+1}else if(0===g.length&&t===e.length-1){var A={minX:e[0].X,minY:e[0].Y,maxX:e[0].X,maxY:e[0].Y};e.forEach(function(e){m(e,A)});var s=A.maxX-A.minX,l=A.maxY-A.minY,h=e.map(function(e){return e.Text}).join(""),p=new u(A.minX,A.minY,s,l,h,e[0].Rotation);e=[p]}else if(t===e.length-1){for(var n={minX:e[parseInt(f.toString(),10)].X,minY:e[parseInt(f.toString(),10)].Y,maxX:e[parseInt(f.toString(),10)].X,maxY:e[parseInt(f.toString(),10)].Y},c="",a=[],r=f;r<=t;r++){var w=e[parseInt(r.toString(),10)];m(w,n),a.push(w.Height),c+=w.Text}var s=n.maxX-n.minX,l=n.maxY-n.minY,C=new u(n.minX,n.minY,s,l,c,e[0].Rotation);g.push(C)}}(w);g.length>0&&(e=g)}for(var C=0;C<e.length;C++){var B=e[parseInt(C.toString(),10)].Rotation;if(0===B||180===B?(A&&(this.TextBounds.push(d),this.TextContent.push(h),h=""),A=!1,0===a?d=new u(e[parseInt(C.toString(),10)].Left,t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):1===a?d=new u(r-t,e[parseInt(C.toString(),10)].Left,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):2===a?d=new u(r-e[parseInt(C.toString(),10)].Left,s-t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):3===a&&(d=new u(t,s-e[parseInt(C.toString(),10)].Left,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B))):90===B||270===B?(A&&(this.TextBounds.push(d),this.TextContent.push(h),h=""),A=!1,0===a?d=new u(o,e[parseInt(C.toString(),10)].Top,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):1===a?d=new u(r-e[parseInt(C.toString(),10)].Top,o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):2===a?d=new u(r-o,s-e[parseInt(C.toString(),10)].Top,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):3===a&&(d=new u(e[parseInt(C.toString(),10)].Top,s-o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B))):A?h+=e[parseInt(C.toString(),10)].Text:(A=!0,h+=e[parseInt(C.toString(),10)].Text,0===a?d=new u(e[parseInt(C.toString(),10)].Left,t,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):1===a?d=new u(r-t,e[parseInt(C.toString(),10)].Left,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):2===a?d=new u(r-e[parseInt(C.toString(),10)].Left,s-t,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):3===a&&(d=new u(t,s-e[parseInt(C.toString(),10)].Left,n-o,i-t,e[parseInt(C.toString(),10)].Text,B))),!A&&" "===e[parseInt(C.toString(),10)].Text&&0!==C&&C+1<=e.length)if(c)c&&C+1!==e.length?((30<(y=e[C-1].Left-(e[C+1].Left+e[C+1].Width))||y<0)&&(y=0),d=new u(e[C+1].Left+e[C+1].Width,t,y,i-t,e[parseInt(C.toString(),10)].Text,e[parseInt(C.toString(),10)].Rotation)):c&&(d=new u(e[C-1].Left-e[parseInt(C.toString(),10)].Width,t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,e[parseInt(C.toString(),10)].Rotation));else if(C+1!==e.length){var y=0;switch(B){case 0:(30<(y=e[C+1].Left-(e[C-1].Left+e[C-1].Width))||y<0)&&(y=0),0===a?d=new u(e[C-1].Left+e[C-1].Width,t,y,i-t,e[parseInt(C.toString(),10)].Text,B):1===a?d=new u(r-t,e[C-1].Left+e[C-1].Width,y,i-t,e[parseInt(C.toString(),10)].Text,B):2===a?d=new u(r-(e[C-1].Left+e[C-1].Width),s-t,y,i-t,e[parseInt(C.toString(),10)].Text,B):3===a&&(d=new u(t,s-(e[C-1].Left+e[C-1].Width),y,i-t,e[parseInt(C.toString(),10)].Text,B));break;case 90:(30<(y=e[C+1].Top-(e[C-1].Top+e[C-1].Height))||y<0)&&(y=0),0===a?d=new u(o,e[C-1].Top+e[C-1].Height,n-o,y,e[parseInt(C.toString(),10)].Text,B):1===a?d=new u(r-(e[C-1].Top+e[C-1].Height),o,n-o,y,e[parseInt(C.toString(),1