UNPKG

@syncfusion/ej2-pdfviewer

Version:
10 lines 3.34 MB
/*! * filename: ej2-pdfviewer.min.js * version : 30.2.4 * Copyright Syncfusion Inc. 2001 - 2024. 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,r,a,s,l,d,A,h,p,c){"use strict";function g(e){return"Line"===e.shapeAnnotationType||"LineWidthArrowHead"===e.shapeAnnotationType||"Distance"===e.shapeAnnotationType||"Polygon"===e.shapeAnnotationType}function u(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;t.style.fill=i||"white",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 f(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 m(e){return i.Point.getLengthFromListOfPoints(e)}function w(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 C(e){return void 0!==e&&"string"==typeof e&&(e=t.getValue(e,window)),e}function B(e,t,i){var n={};if(e){i=e.propName;var o=e.properties||e,r=[],a=[];if((r=r.concat(Object.keys(o))).push("version"),i){var s=C(t);a=s?s(i):[],r=r.concat(a)}for(var l=y(i),d=0,A=r=r.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]=S(-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]=B(-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 S(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(B(e[parseInt(o.toString(),10)],t,i)):n.push(e[parseInt(o.toString(),10)])}return n}function y(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 I(e,t){var n;if("Distance"===e.shapeAnnotationType)for(var o=0,r=void 0,a=0;a<e.wrapper.children.length;a++){var s=i.Point.findAngle(e.sourcePoint,e.targetPoint);if(e.wrapper.children[parseInt(a.toString(),10)].id.indexOf("leader")>-1){var l=e.wrapper.children[0].bounds.center;0===o?(r={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},l=e.sourcePoint):(r={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:r.x,y:r.y}),t==="Leader"+o)return{leader:"leader"+o,point:n};o++}}return{leader:"",point:n}}function E(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 v(e,t){for(var i,n="",o=[],r=0;r<t.length;)o.push({x:t[parseInt(r.toString(),10)].x,y:t[parseInt(r.toString(),10)].y}),r++;o=Q(e,o);for(var a=0;a<o.length;a++)i=o[parseInt(a.toString(),10)],0===a&&(n="M"+i.x+" "+i.y),a>0&&(n+=" L"+i.x+" "+i.y);return n}function b(e,t,n){var o=new i.Rect,r=v(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=r,e.wrapper){e.wrapper.offsetX=n.offsetX,e.wrapper.offsetY=n.offsetY;var a=o.width;a=o.width<o.height?o.height:o.width,e.wrapper.width=e.enableShapeLabel?a/2:a,e.wrapper.height=o.height}return n}function V(e,t){var i=[];return i=E(e),t.staticSize=!0,t=b(e,i,t),u(e,t),t}function D(e,t,n,o,r){t.offsetX=n.x,t.offsetY=n.y;var a,s=i.Point.findAngle(n,o),l=J(r?e.sourceDecoraterShapes:e.taregetDecoraterShapes),d=0;"LineWidthArrowHead"===e.shapeAnnotationType||"Line"===e.shapeAnnotationType?(d=e.thickness,a=new i.Size(12*d,12*d)):(d=e.thickness<=5?5:e.thickness,a=new i.Size(2*d,2*d)),t.transform=i.RotateTransform.Self,u(e,t),t.style.fill="tranparent"!==e.fillColor?e.fillColor:"white",t.rotateAngle=s,t.data=l,t.canMeasurePath=!0,t.width=a.width,t.height=a.height,"Butt"===e.sourceDecoraterShapes&&(t.width=a.width-10,t.height=a.height+10)}function x(e,t,n,o){var r=new i.PathElement;return D(e,r,t,n,o),r}function Q(e,t){return t[0]=M(e,t,!0),t[t.length-1]=M(e,t,!1),t}function M(e,t,n){var o={x:0,y:0},r={x:0,y:0},a={x:0,y:0},s=t.length;r=n?t[0]:t[s-1],a=n?t[1]:t[s-2];var l=i.Point.distancePoints(r,a);l=0===l?1:l;var d=e.thickness;o.x=Math.round(r.x+d*(a.x-r.x)/l),o.y=Math.round(r.y+d*(a.y-r.y)/l);return o=i.Point.adjustPoint(o,a,!0,.5)}function F(e,t,n,o){var r=[],a=i.Point.findAngle(t[0],t[1]),s=O(e,a);return!o.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?s.content=e.notes:s.content=n.setConversion(f([t[0],t[1]])*n.pixelToPointFactor,e),s.rotateValue={y:-10,angle:a},!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),r.push(s),r}function T(e,i,n){for(var o,r=0;r<e.wrapper.children.length;r++){var a=e.wrapper.children[parseInt(r.toString(),10)];a&&!t.isNullOrUndefined(a.content)&&(o=n.setConversion(f([i[0],i[1]])*n.pixelToPointFactor,e),a.content=o,a.childNodes[0].text=a.content,a.refreshTextElement())}return o}function k(e,i){for(var n,o=0;o<e.wrapper.children.length;o++){var r=e.wrapper.children[parseInt(o.toString(),10)];r&&!t.isNullOrUndefined(r.content)&&(n=i.setConversion(e.bounds.width/2*i.pixelToPointFactor,e),r.content=n,2===r.childNodes.length?(r.childNodes[0].text=n,r.childNodes.splice(r.childNodes.length-1,1)):r.childNodes[0].text=n,r.refreshTextElement())}return n}function P(e,t,n,o){var r=[],a=i.Point.findAngle(t[0],t[1]),s=O(e,a);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:a},r.push(s),r}function N(e,i,n){for(var o,r=0;r<e.wrapper.children.length;r++){var a=e.wrapper.children[parseInt(r.toString(),10)];a&&!t.isNullOrUndefined(a.content)&&(o=n.calculatePerimeter(e),a.content=o,a.childNodes[0].text=a.content,a.refreshTextElement())}return o}function R(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 L(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 U(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 O(e,t){var n=new i.TextElement;return u(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 z(e,t){var i=[],n=H(e,t[0],t[1]);return i.push(n),n=H(e,t[1],t[0],!0),i.push(n),i}function H(e,t,n,o){var r=new i.PathElement;r.offsetX=t.x,r.offsetY=t.y;var a=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-a,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,a,r.offsetX,r.offsetY),d=i.transformPointByMatrix(l,A);var h={x:t.x,y:t.y};r.offsetX=h.x,r.offsetY=h.y,r.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 r.pivot.x=.5,o?(r.id="leader2_"+i.randomId(),r.pivot.y=0):(r.id="leader1_"+i.randomId(),r.pivot.y=1),u(e,r),r.rotateAngle=a,r.data=p,r.canMeasurePath=!0,r.width=c.width,r.height=c.height,r}function Y(e,n){var o=e.vertexPoints;if(!t.isNullOrUndefined(o))for(var r=0;r<o.length-1;r++){var a=o[parseInt(r.toString(),10)],s=o[r+1],l=i.Rect.toBounds([a,s]);if(l.Inflate(10),l.containsPoint(n)){var d=G(n,a,s),A={x1:a.x,x2:s.x,y1:a.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(a)||g.containsPoint(s))return!0}if(i.Point.equals(n,d))return!0}}return!1}function G(e,t,n){var o;o=i.Point.findLength(t,e)>i.Point.findLength(n,e)?n:t;var r=i.Point.findAngle(t,n),a=i.Point.findAngle(o,e),s=i.Point.findLength(o,e),l=a+2*(r-a);return{x:o.x+s*Math.cos(l*Math.PI/180),y:o.y+s*Math.sin(l*Math.PI/180)}}function J(e){return st[""+e]}function j(e,t,i,n){if(i&&t.activeElements.activePageID>-1){var o=K(t,i,e),r=W(o,e,t,i);return n?o:r}}function K(e,t,i){var n=e.currentPosition||{x:i.offsetX,y:i.offsetY};return $(n={x:n.x/e.getZoomFactor(),y:n.y/e.getZoomFactor()},t.getPageTable(e.activeElements.activePageID).objects,t.touchPadding)}function W(e,t,n,o){var r,a,s,l=null;if(t&&t.type&&-1!==t.type.indexOf("touch")){if(r=t,o.annotation){var d=n.getElement("_pageDiv_"+o.annotation.getEventPageNumber(t));if(d){var A=d.getBoundingClientRect();a=r.changedTouches[0].clientX-A.left,s=r.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();a=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();a=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(),a=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(),a=t.clientX-h.left,s=t.clientY-h.top)}else a=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 St){var u={x:a/n.getZoomFactor(),y:s/n.getZoomFactor()},f=_(e[parseInt(g.toString(),10)],u,p),m=Y(e[parseInt(g.toString(),10)],u);if(f&&!m){var w=Z(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,S=0;if("Stamp"!==e[parseInt(g.toString(),10)].shapeAnnotationType&&"Image"!==e[parseInt(g.toString(),10)].shapeAnnotationType||(S=25),(B.x-p)*n.getZoomFactor()<a&&(B.x+B.width+p)*n.getZoomFactor()>a&&(B.y-p-S)*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-S)*n.getZoomFactor()<n.currentPosition.y&&(B.y+B.height+p)*n.getZoomFactor()>n.currentPosition.y)if(n.tool instanceof Ct||n.tool instanceof ut)l=e[parseInt(g.toString(),10)];else if(c){var y=a-(B.x-p)*n.getZoomFactor()+((B.x+B.width+p)*n.getZoomFactor()-a)+(s-(B.y-p-S)*n.getZoomFactor())+((B.y+B.height+p)*n.getZoomFactor()-s);c>y?(l=e[parseInt(g.toString(),10)],c=y):c===y?(l=e[parseInt(g.toString(),10)],c=y):"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=a-(B.x-p)*n.getZoomFactor()+((B.x+B.width+p)*n.getZoomFactor()-a)+(s-(B.y-p-S)*n.getZoomFactor())+((B.y+B.height+p)*n.getZoomFactor()-s)}return l}function Z(e,t){var n=e.sourcePoint,o=e.targetPoint;if("Distance"===e.shapeAnnotationType){var r=t,a=void 0,s=i.Point.findAngle(e.sourcePoint,e.targetPoint);if(r.id.indexOf("leader")>-1){var l=e.wrapper.children[0].bounds.center;r.id.indexOf("leader1")>-1?(a={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},l=n):(a={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:a.x,y:a.y})}}}function _(e,t,i){return q(e.wrapper,t,i)}function X(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,r=Math.floor((n+o)/2);r!==n;)i[parseInt(r.toString(),10)][""+t]<e[""+t]?(n=r,r=Math.floor((n+o)/2)):i[parseInt(r.toString(),10)][""+t]>e[""+t]&&(o=r,r=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 q(e,n,o){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--){var a=e.children[parseInt(r.toString(),10)],s=o;if(!t.isNullOrUndefined(a.children)&&a.children.length>0)for(var l=a.children.length-1;l>=0;l--){var d=a.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(a&&a.bounds.containsPoint(n,s)){if(a instanceof i.Container){var A=this.findTargetElement(a,n);if(A)return A}if(a.bounds.containsPoint(n,s))return a}}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 $(e,t,i){for(var n=[],o=0,r=t;o<r.length;o++){var a=r[o];(_(a,e,i)||"Stamp"===a.shapeAnnotationType&&_(a,e,40))&&X(a,"zIndex",n)}return n}function ee(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 te(e,t,n,o,r){var a=i.createHtmlElement("div",{id:r.element.id+o+"_diagramAdornerLayer",style:"width:"+e.width+"px;height:"+e.height+"px;"+t});if(!i.getDiagramElement(a.id)){var s=r.viewerBase.getElement("_pageDiv_"+o),l=s.getBoundingClientRect(),d=ie(r.element.id+o+"_diagramAdorner_svg",l.width,l.height);d.setAttribute("class","e-adorner-layer"+o),d.style.pointerEvents="none",r.adornerSvgLayer=i.createSvgElement("g",{id:r.element.id+o+"_diagramAdorner"}),r.adornerSvgLayer.style.pointerEvents="all",d.appendChild(r.adornerSvgLayer),a.appendChild(d),a.style.width=l.width+"px",a.style.height=l.height+"px",s?s.insertBefore(a,s.childNodes[0]):n.parentElement.appendChild(a);var A=i.createSvgElement("g",{id:r.element.id+o+"_SelectorElement"});r.adornerSvgLayer.appendChild(A),i.setAttributeSvg(d,{style:"pointer-events:none;"})}r.viewerBase.applyElementStyles(a,o)}function ie(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 ne(e,t,i,n){switch(e){case"Create":oe({type:n,target:document.querySelector(t.target),cssClass:t.cssClass,label:t.label,width:t.width});break;case"Show":Ye(document.querySelector(i));break;case"Hide":Je(document.querySelector(i));break;case"Set":je({cssClass:t.cssClass,type:n})}}function oe(e,i){if(e.target){var n,o=t.isNullOrUndefined(i)?t.createElement:i,r=Qe(e.target,o);if(t.isNullOrUndefined(e.cssClass)||r.wrap.classList.add(e.cssClass),t.isNullOrUndefined(e.template)&&t.isNullOrUndefined(_t)){var a=t.isNullOrUndefined(e.type)?me(r.wrap):e.type;n=ve(t.isNullOrUndefined(e.width)?void 0:e.width,a),we(a,r.wrap,n,o),t.isNullOrUndefined(e.label)||re(r.innerWrap,e.label,o)}else{var s=t.isNullOrUndefined(e.template)?_t:e.template;r.wrap.classList.add(Ii),Ee(r.wrap,s,Xt)}r.wrap.classList.add(ai),r=null}}function re(e,t,i){var n=i("div",{});return n.classList.add(yi),n.textContent=t,e.appendChild(n),n}function ae(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Material",radius:t},xe(e,n,i,si),Te(t,e,"Material",si)}function se(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Fluent2",radius:t},De(e,n,ui),Ue(t,e,ui)}function le(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Material3",radius:t},xe(e,n,i,li),Te(t,e,"Material3",li)}function de(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Tailwind3",radius:t},xe(e,n,i,fi),Te(t,e,"Tailwind3",fi)}function Ae(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Bootstrap4",radius:t},xe(e,n,i,hi),Te(t,e,"Bootstrap4",hi)}function he(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Bootstrap5",radius:t},xe(e,n,i,pi),Te(t,e,"Bootstrap5",pi)}function pe(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Tailwind",radius:t},De(e,n,ci),Ue(t,e,ci)}function ce(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Fluent",radius:t},De(e,n,gi),Ue(t,e,gi)}function ge(e,t,i){var n={};Zt[""+t].timeOut=0,n[""+t]=be(t,i,0,0),Me({uniqueID:t,container:e,globalInfo:n,timeOutVar:0})}function ue(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Fabric",radius:t},De(e,n,di),Ue(t,e,di)}function fe(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"HighContrast",radius:t},De(e,n,mi),Ue(t,e,mi)}function me(e){return window.getComputedStyle(e,":after").getPropertyValue("content").replace(/['"]+/g,"")}function we(e,i,n,o){var r=i.querySelector("."+Ci),a=r.querySelector("svg");switch(t.isNullOrUndefined(a)||r.removeChild(a),e){case"Material":ae(r,n,o);break;case"Material3":le(r,n,o);break;case"Fabric":ue(r,n);break;case"Bootstrap":Ce(r,n);break;case"HighContrast":fe(r,n);break;case"Bootstrap4":Ae(r,n,o);break;case"Bootstrap5":he(r,n,o);break;case"Tailwind":pe(r,n);break;case"Fluent":ce(r,n);break;case"Fluent2":se(r,n);break;case"Tailwind3":de(r,n,o)}}function Ce(e,t,i){var n=Ve();Zt[""+n]={timeOut:0,type:"Bootstrap",radius:t},Be(e,n),Se(e,t)}function Be(e,t,i){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("id",t),n.setAttribute("class",Ai),n.setAttribute("viewBox","0 0 64 64"),e.insertBefore(n,e.firstChild);for(var o=0;o<=7;o++){var r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("class",Bi+"_"+o),r.setAttribute("r","2"),r.setAttribute("transform","translate(32,32)"),n.appendChild(r)}}function Se(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 r=Oe(0,0,24,n),a=i.querySelector("."+Bi+"_"+o);a.setAttribute("cx",r.x+""),a.setAttribute("cy",r.y+""),n=n>=360?0:n,n+=45}}function ye(e,t){function i(e){n.push(e),e===r&&1!==s||(e<=o&&e>1&&!a?e=parseFloat((e-.2).toFixed(2)):1===e?(e=7,e=parseFloat((e+.2).toFixed(2)),a=!0):e<8&&a?8===(e=parseFloat((e+.2).toFixed(2)))&&(a=!1):e<=8&&!a&&(e=parseFloat((e-.2).toFixed(2))),++s,i(e))}var n=[],o=e,r=t,a=!1,s=1;return i(o),n}function Ie(e){for(var t=e.querySelector("svg.e-spin-bootstrap").getAttribute("id"),i=1;i<=8;i++)!function(e,t,i,n,o){function r(t){Zt[""+o].isAnimate&&(++a,e.setAttribute("r",t+""),a>=n.length&&(a=0),Zt[""+o].timeOut=setTimeout(r.bind(null,n[parseInt(a.toString(),10)]),18))}var a=0;r(t)}(e.getElementsByClassName("e-path-circle_"+(8===i?0:i))[0],i,0,ye(i,i),t)}function Ee(e,i,n){t.isNullOrUndefined(n)||e.classList.add(n),e.querySelector(".e-spinner-inner").innerHTML=i}function ve(e,t){var i;switch(t){case"Material":i=qt;break;case"Material3":i=$t;break;case"Fabric":i=ei;break;case"Fluent2":i=ni;break;case"Tailwind3":i=oi;break;case"Bootstrap4":i=ii;break;default:i=ti}return e=e?parseFloat(e+""):i,"Bootstrap"===t?e:e/2}function be(e,t,i,n){return{radius:t,count:i,previousId:n}}function Ve(){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 r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class",Bi);var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class",Si),e.insertBefore(o,e.firstChild),o.appendChild(r),o.appendChild(a)}function xe(e,t,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("class",n),o.setAttribute("id",t);var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class",Bi),e.insertBefore(o,e.firstChild),o.appendChild(r)}function Qe(e,t){var i=t("div",{});i.classList.add(wi);var n=t("div",{});return n.classList.add(Ci),e.appendChild(i),i.appendChild(n),{wrap:i,innerWrap:n}}function Me(e){Fe(1,149,Le,1333,e.globalInfo[e.uniqueID].count,75,e),e.globalInfo[e.uniqueID].count=++e.globalInfo[e.uniqueID].count%4}function Fe(e,i,n,o,r,a,s){function l(i){var r=Math.max(0,Math.min((new Date).getTime()-h,o));t.isNullOrUndefined(Zt[i.uniqueID])||t.isNullOrUndefined(Zt[i.uniqueID].timeOut)||(d(n(r,e,p,o),i.container),A===i.globalInfo[i.uniqueID].previousId&&r<o?Zt[i.uniqueID].timeOut=requestAnimationFrame(function(){return l(i)}):(clearTimeout(Zt[i.uniqueID].timeOut),Zt[i.uniqueID].timeOut=null,Me(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",Re(c,g,e,a)+""),o.setAttribute("transform","rotate("+u+" "+c/2+" "+c/2+")")}}}var A=++s.globalInfo[s.uniqueID].previousId,h=(new Date).getTime(),p=i-e,c=ke(2*s.globalInfo[s.uniqueID].radius+""),g=Ne(c),u=-90*(s.globalInfo[s.uniqueID].count||0);!t.isNullOrUndefined(Zt[s.uniqueID])&&Zt[s.uniqueID].timeOut&&(clearTimeout(Zt[s.uniqueID].timeOut),Zt[s.uniqueID].timeOut=null),l(s)}function Te(e,t,i,n){var o=2*e,r=t.querySelector("svg."+n),a=r.querySelector("path.e-path-circle"),s=Ne(o),l=o/2+"px";r.setAttribute("viewBox","0 0 "+o+" "+o),r.style.width=r.style.height=o+"px",r.style.transformOrigin=l+" "+l+" "+l,a.setAttribute("d",Pe(o,s)),"Material"!==i&&"Material3"!==i||(a.setAttribute("stroke-width",s+""),a.setAttribute("stroke-dasharray",(o-s)*Math.PI*.75+""),a.setAttribute("stroke-dashoffset",Re(o,s,1,75)+"")),"Tailwind3"===i&&a.setAttribute("stroke-width",s+"")}function ke(e){return parseFloat(e)}function Pe(e,t){var i=e/2,n=t/2;return"M"+i+","+n+"A"+(i-n)+","+(i-n)+" 0 1 1 "+n+","+i}function Ne(e){return.1*e}function Re(e,t,i,n){return(e-t)*Math.PI*(3*n/100-i/100)}function Le(e,t,i,n){var o=(e/=n)*e,r=o*e;return t+i*(6*r*o+-15*o*o+10*r)}function Ue(e,t,i){var n=e,o=e,r=2*e,a=t.querySelector("."+i),s=a.querySelector(".e-path-circle"),l=a.querySelector(".e-path-arc"),d=r/2+"px";s.setAttribute("d",He(n,o,e)),l.setAttribute("d",ze(n,o,e,315,45)),a.setAttribute("viewBox","0 0 "+r+" "+r),a.style.transformOrigin=d+" "+d+" "+d,a.style.width=a.style.height=r+"px"}function Oe(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 ze(e,t,i,n,o){var r=Oe(e,t,i,o),a=Oe(e,t,i,n);return["M",r.x,r.y,"A",i,i,0,0,0,a.x,a.y].join(" ")}function He(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 Ye(e){Ge(e,!1),e=null}function Ge(e,i){var n;if(e&&(n=e.classList.contains(wi)?e:e.querySelector("."+wi)),e&&n){var o=n.querySelector("."+Ci);if(i?!n.classList.contains(Ii)&&!n.classList.contains(ai):!n.classList.contains(Ii)&&!n.classList.contains(ri)){var r=n.querySelector("svg");if(t.isNullOrUndefined(r))return;var a=r.getAttribute("id");switch(Zt[""+a].isAnimate=!i,Zt[""+a].type){case"Material":case"Material3":case"Fluent2":case"Tailwind3":i?clearTimeout(Zt[""+a].timeOut):ge(o,a,Zt[""+a].radius);break;case"Bootstrap":i?clearTimeout(Zt[""+a].timeOut):Ie(o)}}i?t.classList(n,[ai],[ri]):t.classList(n,[ri],[ai]),e=null}}function Je(e){Ge(e,!0),e=null}function je(e,i){var n=t.isNullOrUndefined(i)?t.createElement:i;void 0!==e.template&&(_t=e.template,void 0!==e.template&&(Xt=e.cssClass));for(var o=document.querySelectorAll("."+wi),r=0;r<o.length;r++)Ke(e.template,o[parseInt(r.toString(),10)],e.type,e.cssClass,n)}function Ke(e,i,n,o,r){t.isNullOrUndefined(e)&&!i.classList.contains(Ii)?(We(i,n,o,r),i.classList.contains(ri)?(i.classList.remove(ri),Ye(i)):(i.classList.remove(ai),Je(i))):(_t=e,t.isNullOrUndefined(o)||(Xt=o))}function We(e,i,n,o){t.isNullOrUndefined(n)||e.classList.add(n);var r=e.querySelector("svg"),a="Bootstrap"===i?parseFloat(r.style.height):parseFloat(r.style.height)/2;if(r.getAttribute("class").split(/\s/).indexOf("e-spin-material")>=0){var s=r.getAttribute("id");clearTimeout(Zt[""+s].timeOut)}we(i,e,a,o)}function Ze(){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),r=Array(1+t),a=A.asm&&A.asm.free?A.asm.free:A._free;r[0]={s:t,J:e,Z:n,E:i,m:o,free:function(){return a(o)}};for(var s=0;s<t;s++)!function(e){r[e+1]={p:o+e*n,get v(){return i[o/n+e]}}}(s);return r}}function t(){((a=!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,r,a=!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),r=o[0],a=o.slice(1);if(!n.apply(void 0,a.map(function(e){return e.p})))return r.free(),i;var s=a.map(function(e){return e.v});return r.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(){a=!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){r&&e.data.skipOnReload&&((G=A.asm&&A.asm.free?A.asm.free:A._free)(r.processor.wasmData.wasmBuffer),l.CloseDocument(r.processor.wasmData.wasm),l.DestroyLibrary(),A.removeFunction&&o&&A.removeFunction(o),r=null),d.fileByteArray=e.data.uploadedFile;C=d.fileByteArray.length;if(l.Init(),A.asm&&A.asm.malloc){i=A.asm.malloc(C);A.HEAPU8.set(d.fileByteArray,i),d.fileByteArray=null,r=new w({wasm:l.LoadMemDocument(i,C,e.data.password),wasmBuffer:i})}else{var i=(T=A.asm&&A.asm.malloc?A.asm.malloc:A._malloc)(C),a=n(e.data.uploadedFile);o=A.addFunction(function(e,t,i,n){return a.readBlock(t,i,n)},"iiiii");var g=T(12),f={mFileLen:a.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 m=l.LoadCustomDocument(g,e.data.password);r=new w({wasm:m,wasmBuffer:i})}S=l.GetPageCount(r.processor.wasmData.wasm);r.setPages(S),r.createAllPages(),d.fileByteArray=null,c.postMessage({message:"PageLoaded",pageIndex:e.data.pageIndex,isZoomMode:e.data.isZoomMode,pageCount:S,pageSizes:r.pageSizes,pageRotation:r.pageRotation})}else if("LoadPageStampCollection"===e.data.message){var C=e.data.uploadedFile.length;l.Init();i=(T=A.asm&&A.asm.malloc?A.asm.malloc:A._malloc)(C);A.HEAPU8.set(e.data.uploadedFile,i);var B=new w({wasm:l.LoadMemDocument(i,C,e.data.password),wasmBuffer:i}),S=l.GetPageCount(B.processor.wasmData.wasm);B.setPages(S),B.createAllPages();var y=B.getPage(e.data.pageIndex),I=e.data;(v=y.render(null,I.zoomFactor,!1,null,null,null,!0)).message="LoadedStamp",v.annotName=e.data.AnnotName,v.rubberStampAnnotationPageNumber=e.data.rubberStampAnnotationPageNumber,v.annotationOrder=e.data.annotationOrder,v.collectionOrder=e.data.collectionOrder,v.isFormField=e.data.isFormField,v.isFormField&&(v.message="LoadedStampForFormFields",v.formFieldName=e.data.formFieldName,v.formFieldList=e.data.formFieldList,v.formFields=e.data.rubberStampAnnotation,v.PageIndex=e.data.PageIndex),c.postMessage(v)}if(r)if("renderPage"===e.data.message){var y=r.getPage(e.data.pageIndex),E=e.data,v=y.render(null,E.zoomFactor,E.isTextNeed,null,null,E.textDetailsId,null,e.data.cropBoxRect,e.data.mediaBoxRect);c.postMessage(v)}else if("renderPageSearch"===e.data.message){var y=r.getPage(e.data.pageIndex),b=e.data;(v=y.render(null,b.zoomFactor,b.isTextNeed,null,null,b.textDetailsId,null,e.data.cropBoxRect)).message="imageRenderedSearch",c.postMessage(v)}else if(-1!==e.data.message.indexOf("extractText")){var y=r.getPage(e.data.pageIndex),V=e.data,D=e.data.isSkipCharacterBounds;(v=y.render("extractText",V.zoomFactor,V.isTextNeed,null,null,V.textDetailsId,null,null,null,null,D)).message=e.data.message,v.isLayout=e.data.isLayout,v.isRenderText=e.data.isRenderText,v.jsonObject=e.data.jsonObject,v.requestType=e.data.requestType,v.annotationObject=e.data.annotationObject,v.pageIndex=e.data.pageIndex,v.options=e.data.options,v.isAPI=e.data.isAPI,v.isNeedToRender=e.data.isNeedToRender,c.postMessage(v)}else if("searchText"===e.data.message){for(var x=l.GetPageCount(r.processor.wasmData.wasm),Q=e.data.searchWord,M=new Uint16Array(Q.length+1),F=0;F<Q.length;F++)M[parseInt(F.toString(),10)]=Q.charCodeAt(F);M[Q.length]=0;var T=A.asm&&A.asm.malloc?A.asm.malloc:A._malloc,k=T(M.length*M.BYTES_PER_ELEMENT);A.HEAPU16.set(M,k/Uint16Array.BYTES_PER_ELEMENT);for(var P=0,N=!0===e.data.matchCase?1:0,R=e.data.startIndex,L=e.data.endIndex,U={},O=R;O<L;O++)!function(e){for(var t=-1,i=l.LoadPage(r.processor.wasmData.wasm,e),n=l.LoadTextPage(i),o=l.TextFindStart(n,k,N,0),a=l.GetPageHeight(i);l.TextFindNext(o);)!function(){P++,t++;var i=l.TextFindCount(o),r=l.TextFindResultIndex(o);U[parseInt(e.toString(),10)]||(U[parseInt(e.toString(),10)]={Indices:[],Bounds:{},PageOccurrence:0}),U[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)]||(U[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)]=[]),U[parseInt(e.toString(),10)].Indices.push(r);for(var s=Number.POSITIVE_INFINITY,d=0,A=Number.POSITIVE_INFINITY,c=0,g=0;g<i;g++)!function(i){var o=l.GetUnicodeChar(n,r+i),g=String.fromCharCode(o);if("\r"!==g&&"\n"!==g){var f=p(h,4,[-1,-1,-1,-1])(function(e,t,o,a){return l.GetCharBox(n,r+i,e,t,o,a)});s=Math.min(s,f[0]),d=Math.max(d,f[1]),A=Math.min(A,f[2]),c=Math.max(c,f[3])}if("\r"===g){var m=new u(s*(96/72),96/72*(a-(c-A)-A),96/72*(d-s),96/72*(c-A),"",null);U[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].push(m),U[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].sort(function(e,t){return e.Top===t.Top?e.Left-t.Left:e.Top-t.Top}),s=Number.POSITIVE_INFINITY,d=0,A=Number.POSITIVE_INFINITY,c=0}}(g);var f=new u(s*(96/72),96/72*(a-(c-A)-A),96/72*(d-s),96/72*(c-A),"",null);U[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].push(f),U[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].sort(function(e,t){return e.Top===t.Top?e.Left-t.Left:e.Top-t.Top}),U[parseInt(e.toString(),10)].PageOccurrence=t+1}();l.TextFindClose(o),l.ClosePage(i)}(O);var z={totalSearchCount:P,resultPages:U,message:"textSearched",searchWord:Q,matchCase:e.data.matchCase,isRequestsend:e.data.isRequestsend,isCompletedSearch:L===x,endIndex:L};c.postMessage(z),U={},(G=A.asm&&A.asm.free?A.asm.free:A._free)(k)}else if("renderThumbnail"===e.data.message)new Promise(function(t,i){try{var n=r.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,null,null,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)(v=(y=r.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",v.isRenderText=e.data.isRenderText,v.jsonObject=e.data.jsonObject,v.requestType=e.data.requestType,v.startIndex=e.data.startIndex,v.endIndex=e.data.endIndex,v.imageSize=e.data.imageSize,v.initialLoad=e.data.initialLoad,c.postMessage(v);else if("printImage"===e.data.message){v=(y=r.getPage(e.data.pageIndex)).render("print",null,!1,e.data.printScaleFactor,e.data.printDevicePixelRatio);c.postMessage(v)}else if("extractImage"===e.data.message||"extractImages"===e.data.message){var y=r.getPage(e.data.pageIndex),H=e.data,v=y.render(null,H.zoomFactor,H.isTextNeed,null,null,H.textDetailsId,null,null,null,e.data.size);"extractImage"===e.data.message&&(v.message="imageExtracted"),"extractImages"===e.data.message&&(v.message="imagesExtracted"),c.postMessage(v)}else if("renderImageAsTile"===e.data.message){var Y=e.data,v=(y=r.getPage(e.data.pageIndex)).renderTileImage(Y.tileX,Y.tileY,Y.tileXCount,Y.tileYCount,Y.zoomFactor,e.data.isTextNeed,e.data.textDetailsId,e.data.cropBoxRect,e.data.mediaBoxRect);c.postMessage(v)}else if("renderImageAsTileSearch"===e.data.message){Y=e.data;(v=(y=r.getPage(e.data.pageIndex)).renderTileImage(Y.tileX,Y.tileY,Y.tileXCount,Y.tileYCount,Y.zoomFactor,e.data.isTextNeed,e.data.textDetailsId,e.data.cropBoxRect,e.data.mediaBoxRect)).message="renderTileImageSearch",c.postMessage(v)}else if("unloadFPDF"===e.data.message&&r){var G=A.asm&&A.asm.free?A.asm.free:A._free;G(r.processor.wasmData.wasmBuffer),l.CloseDocument(r.processor.wasmData.wasm),l.DestroyLibrary(),A.removeFunction&&o&&A.removeFunction(o),r=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,r,a,s,l,d,A,h){return this.processor.render(this.index,e,t,i,n,o,r,a,s,l,d,A,h)},e.prototype.renderTileImage=function(e,t,i,n,o,r,a,s,l){return this.processor.renderTileImage(this.index,e,t,i,n,o,r,a,s,l)},e}(),u=function(){function e(e,t,i,n,o,r){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=r,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,r){return l.GetCharBox(e,t,i,n,o,r)})},e.prototype.getRender=function(e,t,i,n,o,r,a,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,r,a,s),l.ClosePage(c),h},e.prototype.textExtraction=function(e,t,i,n,o,r){var a;if(i){var s=this.getPageSize(t),d=s[0],A=s[1];o&&n&&o.y&&n.y&&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=[],S=[],y=[],I=[],E=[],v="",b=0,V=0,D=0,x=0,Q=0,M=!0,F=!1,T=!1,k=!1,P=0;P<=c;P++)if(r){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),U=this.getCharBounds(h,P),O=U[0],z=U[1],H=U[2],Y=U[3],G=this.pointerToPixelConverter(O)-this.pointerToPixelConverter(n&&n.x?n.x:0),J=A+this.pointerToPixelConverter(n&&n.y?n.y:0)-this.pointerToPixelConverter(Y),j=this.pointerToPixelConverter(z-O),K=this.pointerToPixelConverter(Y-H),W=parseInt((180*L/Math.PI).toString(),10);if(P<c)if(g+=R,270===W&&1===p){var Z=this.pointerToPixelConverter(H)-this.pointerToPixelConverter(n&&n.x?n.x:0),_=this.pointerToPixelConverter(O);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,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);$=new u(b,D,V-b,x-D,v,Q);E.push($),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],M=!0,T=!1,v="",B=[],y=[],S=[],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),S.push(q.Bottom),y.push(q.Left),I.push(q.Right),f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);$=void 0;!1===M&&($=new u(b,D,V-b,x-D,v,Q),E.push($)),E.push(q),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],M=!0,T=!1,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0,g+="\n",L=l.GetCharAngle(h,P),O=(a=this.getCharBounds(h,P))[0],z=a[1],H=a[2],Y=a[3],G=this.pointerToPixelConverter(O),J=A-this.pointerToPixelConverter(Y),j=this.pointerToPixelConverter(z-O),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),S.push(q.Bottom),y.push(q.Left),I.push(q.Right),f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);$=void 0;!1===M&&($=new u(b,D,V-b,x-D,v,Q),E.push($)),""===R&&E.push(q),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],M=!0,T=!1,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0;break;default:if(0===j||0===K){F=!0,f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);$=new u(b,D,V-b,x-D,v,Q);E.push($),D=(q=new u(G,J,j,K,R,W)).Top,x=q.Bottom,b=q.Left,V=q.Right,v=R,Q=E[E.length-1].Rotation,$=new u(b,D,V-b,x-D,v,Q),E.push($),D=0,x=0,b=0,V=0,v="",Q=0,M=!0,T=!0}else{!0===M&&(D=J,x=J+K,b=G,V=G+j);var q=new u(G,J,j,K,R,W);if(" "!==R){if(T&&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)),F&&E.length>=1&&E[E.length-1].Rotation!==q.Rotation||k){F=!1,k=!1,f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);$=void 0;!1===M&&($=new u(b,D,V-b,x-D,v,Q),E.push($)),this.textBoundsCalculation(E,f,m,C,w,p,d,A,c),E=[],M=!0,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0}B.push(q.Top),S.push(q.Bottom),y.push(q.Left),I.push(q.Right),D=Math.min(D,q.Top),x=Math.max(x,q.Bottom),b=Math.min(b,q.Left),V=Math.max(V,q.Right),v+=R,Q=q.Rotation,M=!1,T=!1}else{var $=new u(b,D,V-b,x-D,v,Q);E.push($),D=q.Top,x=q.Bottom,b=q.Left,V=q.Right,v=R,Q=q.Rotation,$=new u(b,D,V-b,x-D,v,Q),E.push($),D=0,x=0,b=0,V=0,v="",Q=0,M=!0,T=!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,r,a,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="",r=[],a=f;a<=t;a++){w=e[parseInt(a.toString(),10)];m(w,n),r.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="",r=[],a=f;a<=t;a++){var w=e[parseInt(a.toString(),10)];m(w,n),r.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===r?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===r?d=new u(a-t,e[parseInt(C.toString(),10)].Left,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-e[parseInt(C.toString(),10)].Left,s-t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(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===r?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===r?d=new u(a-e[parseInt(C.toString(),10)].Top,o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-o,s-e[parseInt(C.toString(),10)].Top,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):3===r&&(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===r?d=new u(e[parseInt(C.toString(),10)].Left,t,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new u(a-t,e[parseInt(C.toString(),10)].Left,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-e[parseInt(C.toString(),10)].Left,s-t,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(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<(S=e[C-1].Left-(e[C+1].Left+e[C+1].Width))||S<0)&&(S=0),d=new u(e[C+1].Left+e[C+1].Width,t,S,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 S=0;switch(B){case 0:(30<(S=e[C+1].Left-(e[C-1].Left+e[C-1].Width))||S<0)&&(S=0),0===r?d=new u(e[C-1].Left+e[C-1].Width,t,S,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new u(a-t,e[C-1].Left+e[C-1].Width,S,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-(e[C-1].Left+e[C-1].Width),s-t,S,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new u(t,s-(e[C-1].Left+e[C-1].Width),S,i-t,e[parseInt(C.toString(),10)].Text,B));break;case 90:(30<(S=e[C+1].Top-(e[C-1].Top+e[C-1].Height))||S<0)&&(S=0),0===r?d=new u(o,e[C-1].Top+e[C-1].Height,n-o,S,e[parseInt(C.toString(),10)].Text,B):1===r?d=new u(a-(e[C-1].Top+e[C-1].Height),o,n-o,S,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-o,s-(e[C-1].Top+e[C-1].Height),n-o,S,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new u(e[C-1].Top+e[C-1].Height,s-o,n-o,S,e[parseInt(C.toString(),10)].Text,B));break;case 180:(30<(S=e[C-1].Left-(e[C+1].Left+e[C+1].Width))||S<0)&&(S=0),0===r?d=new u(e[C+1].Left+e[C+1].Width,t,S,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new u(a-t,e[C+1].Left+e[C+1].Width,S,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-(e[C+1].Left+e[C+1].Width),s-t,S,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new u(t,s-(e[C+1].Left+e[C+1].Width),S,i-t,e[parseInt(C.toString(),10)].Text,B));break;case 270:(30<(S=e[C-1].Top-(e[C+1].Top+e[C+1].Height))||S<0)&&(S=0),0===r?d=new u(o,e[C+1].Top+e[C+1].Height,n-o,S,e[parseInt(C.toString(),10)].Text,B):1===r?d=new u(a-(e[C+1].Top+e[C+1].Height),o,n-o,S,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-o,s-(e[C+1].Top+e[C+1].Height),n-o,S,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new u(e[C+1].Top+e[C+1].Height,s-o,n-o,S,e[parseInt(C.toString(),10)].Text,B))}}else switch(B){case 90:0===r?d=new u(o,e[C-1].Top+e[C-1].Height,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):1===r?d=new u(a-(e[C-1].Top+e[C-1].Height),o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):2===r?d=new u(a-o,s-(e[C-1