/** * name: pdf-document-viewer * version: v0.8.67 * description: * author: */ (function(Dr,yi){typeof exports=="object"&&typeof module<"u"?yi(exports):typeof define=="function"&&define.amd?define(["exports"],yi):(Dr=typeof globalThis<"u"?globalThis:Dr||self,yi(Dr.ImageViewer={}))})(this,function(exports){"use strict";var Qs=Object.defineProperty;var ea=(Dr,yi,vi)=>yi in Dr?Qs(Dr,yi,{enumerable:!0,configurable:!0,writable:!0,value:vi}):Dr[yi]=vi;var es=(Dr,yi,vi)=>(ea(Dr,typeof yi!="symbol"?yi+"":yi,vi),vi),bs=(Dr,yi,vi)=>{if(!yi.has(Dr))throw TypeError("Cannot "+vi)};var Cr=(Dr,yi,vi)=>(bs(Dr,yi,"read from private field"),vi?vi.call(Dr):yi.get(Dr)),Er=(Dr,yi,vi)=>{if(yi.has(Dr))throw TypeError("Cannot add the same private member more than once");yi instanceof WeakSet?yi.add(Dr):yi.set(Dr,vi)},Nr=(Dr,yi,vi,bi)=>(bs(Dr,yi,"write to private field"),bi?bi.call(Dr,vi):yi.set(Dr,vi),vi);var xr=(Dr,yi,vi)=>(bs(Dr,yi,"access private method"),vi);const component_viewer$1="",index="";if(typeof window<"u"){let yi=function(){var vi=document.body,bi=document.getElementById("__svg__viewer_0_8_67__icons__dom__");bi||(bi=document.createElementNS("http://www.w3.org/2000/svg","svg"),bi.style.position="absolute",bi.style.width="0",bi.style.height="0",bi.id="__svg__viewer_0_8_67__icons__dom__",bi.setAttribute("xmlns","http://www.w3.org/2000/svg"),bi.setAttribute("xmlns:link","http://www.w3.org/1999/xlink")),bi.innerHTML='',vi.insertBefore(bi,vi.lastChild)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",yi):yi()}window.requestIdleCallback=window.requestIdleCallback||(yi=>{const vi=Date.now();return setTimeout(()=>{yi({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-vi))})},1)}),window.cancelIdleCallback=window.cancelIdleCallback||(yi=>{clearTimeout(yi)});var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(yi){if(yi.__esModule)return yi;var vi=yi.default;if(typeof vi=="function"){var bi=function _i(){if(this instanceof _i){var $i=[null];$i.push.apply($i,arguments);var Pi=Function.bind.apply(vi,$i);return new Pi}return vi.apply(this,arguments)};bi.prototype=vi.prototype}else bi={};return Object.defineProperty(bi,"__esModule",{value:!0}),Object.keys(yi).forEach(function(_i){var $i=Object.getOwnPropertyDescriptor(yi,_i);Object.defineProperty(bi,_i,$i.get?$i:{enumerable:!0,get:function(){return yi[_i]}})}),bi}var arrayBufferBasicDetection=typeof ArrayBuffer<"u"&&typeof DataView<"u",fails$d=function(yi){try{return!!yi()}catch{return!0}},fails$c=fails$d,descriptors=!fails$c(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),check=function(yi){return yi&&yi.Math==Math&&yi},global$h=check(typeof globalThis=="object"&&globalThis)||check(typeof window=="object"&&window)||check(typeof self=="object"&&self)||check(typeof commonjsGlobal=="object"&&commonjsGlobal)||function(){return this}()||commonjsGlobal||Function("return this")(),documentAll$2=typeof document=="object"&&document.all,IS_HTMLDDA=typeof documentAll$2>"u"&&documentAll$2!==void 0,documentAll_1={all:documentAll$2,IS_HTMLDDA},$documentAll$1=documentAll_1,documentAll$1=$documentAll$1.all,isCallable$h=$documentAll$1.IS_HTMLDDA?function(yi){return typeof yi=="function"||yi===documentAll$1}:function(yi){return typeof yi=="function"},isCallable$g=isCallable$h,$documentAll=documentAll_1,documentAll=$documentAll.all,isObject$j=$documentAll.IS_HTMLDDA?function(yi){return typeof yi=="object"?yi!==null:isCallable$g(yi)||yi===documentAll}:function(yi){return typeof yi=="object"?yi!==null:isCallable$g(yi)},fails$b=fails$d,functionBindNative=!fails$b(function(){var yi=function(){}.bind();return typeof yi!="function"||yi.hasOwnProperty("prototype")}),NATIVE_BIND$3=functionBindNative,FunctionPrototype$2=Function.prototype,call$b=FunctionPrototype$2.call,uncurryThisWithBind=NATIVE_BIND$3&&FunctionPrototype$2.bind.bind(call$b,call$b),functionUncurryThis=NATIVE_BIND$3?uncurryThisWithBind:function(yi){return function(){return call$b.apply(yi,arguments)}},isNullOrUndefined$3=function(yi){return yi==null},isNullOrUndefined$2=isNullOrUndefined$3,$TypeError$a=TypeError,requireObjectCoercible$2=function(yi){if(isNullOrUndefined$2(yi))throw $TypeError$a("Can't call method on "+yi);return yi},requireObjectCoercible$1=requireObjectCoercible$2,$Object$4=Object,toObject$4=function(yi){return $Object$4(requireObjectCoercible$1(yi))},uncurryThis$f=functionUncurryThis,toObject$3=toObject$4,hasOwnProperty$e=uncurryThis$f({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(vi,bi){return hasOwnProperty$e(toObject$3(vi),bi)},sharedExports={},shared$3={get exports(){return sharedExports},set exports(yi){sharedExports=yi}},global$g=global$h,defineProperty$7=Object.defineProperty,defineGlobalProperty$3=function(yi,vi){try{defineProperty$7(global$g,yi,{value:vi,configurable:!0,writable:!0})}catch{global$g[yi]=vi}return vi},global$f=global$h,defineGlobalProperty$2=defineGlobalProperty$3,SHARED="__core-js_shared__",store$3=global$f[SHARED]||defineGlobalProperty$2(SHARED,{}),sharedStore=store$3,store$2=sharedStore;(shared$3.exports=function(yi,vi){return store$2[yi]||(store$2[yi]=vi!==void 0?vi:{})})("versions",[]).push({version:"3.32.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.0/LICENSE",source:"https://github.com/zloirock/core-js"});var uncurryThis$e=functionUncurryThis,id=0,postfix=Math.random(),toString$5=uncurryThis$e(1 .toString),uid$3=function(yi){return"Symbol("+(yi===void 0?"":yi)+")_"+toString$5(++id+postfix,36)},engineUserAgent=typeof navigator<"u"&&String(navigator.userAgent)||"",global$e=global$h,userAgent$2=engineUserAgent,process$1=global$e.process,Deno$1=global$e.Deno,versions=process$1&&process$1.versions||Deno$1&&Deno$1.version,v8=versions&&versions.v8,match,version;v8&&(match=v8.split("."),version=match[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version&&userAgent$2&&(match=userAgent$2.match(/Edge\/(\d+)/),(!match||match[1]>=74)&&(match=userAgent$2.match(/Chrome\/(\d+)/),match&&(version=+match[1])));var engineV8Version=version,V8_VERSION$1=engineV8Version,fails$a=fails$d,global$d=global$h,$String$6=global$d.String,symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails$a(function(){var yi=Symbol();return!$String$6(yi)||!(Object(yi)instanceof Symbol)||!Symbol.sham&&V8_VERSION$1&&V8_VERSION$1<41}),NATIVE_SYMBOL$2=symbolConstructorDetection,useSymbolAsUid=NATIVE_SYMBOL$2&&!Symbol.sham&&typeof Symbol.iterator=="symbol",global$c=global$h,shared$2=sharedExports,hasOwn$9=hasOwnProperty_1,uid$2=uid$3,NATIVE_SYMBOL$1=symbolConstructorDetection,USE_SYMBOL_AS_UID$1=useSymbolAsUid,Symbol$7=global$c.Symbol,WellKnownSymbolsStore=shared$2("wks"),createWellKnownSymbol=USE_SYMBOL_AS_UID$1?Symbol$7.for||Symbol$7:Symbol$7&&Symbol$7.withoutSetter||uid$2,wellKnownSymbol$a=function(yi){return hasOwn$9(WellKnownSymbolsStore,yi)||(WellKnownSymbolsStore[yi]=NATIVE_SYMBOL$1&&hasOwn$9(Symbol$7,yi)?Symbol$7[yi]:createWellKnownSymbol("Symbol."+yi)),WellKnownSymbolsStore[yi]},wellKnownSymbol$9=wellKnownSymbol$a,TO_STRING_TAG$3=wellKnownSymbol$9("toStringTag"),test={};test[TO_STRING_TAG$3]="z";var toStringTagSupport=String(test)==="[object z]",uncurryThis$d=functionUncurryThis,toString$4=uncurryThis$d({}.toString),stringSlice$1=uncurryThis$d("".slice),classofRaw$2=function(yi){return stringSlice$1(toString$4(yi),8,-1)},TO_STRING_TAG_SUPPORT=toStringTagSupport,isCallable$f=isCallable$h,classofRaw$1=classofRaw$2,wellKnownSymbol$8=wellKnownSymbol$a,TO_STRING_TAG$2=wellKnownSymbol$8("toStringTag"),$Object$3=Object,CORRECT_ARGUMENTS=classofRaw$1(function(){return arguments}())=="Arguments",tryGet=function(yi,vi){try{return yi[vi]}catch{}},classof$7=TO_STRING_TAG_SUPPORT?classofRaw$1:function(yi){var vi,bi,_i;return yi===void 0?"Undefined":yi===null?"Null":typeof(bi=tryGet(vi=$Object$3(yi),TO_STRING_TAG$2))=="string"?bi:CORRECT_ARGUMENTS?classofRaw$1(vi):(_i=classofRaw$1(vi))=="Object"&&isCallable$f(vi.callee)?"Arguments":_i},$String$5=String,tryToString$4=function(yi){try{return $String$5(yi)}catch{return"Object"}},objectDefineProperty={},global$b=global$h,isObject$i=isObject$j,document$1=global$b.document,EXISTS$1=isObject$i(document$1)&&isObject$i(document$1.createElement),documentCreateElement$1=function(yi){return EXISTS$1?document$1.createElement(yi):{}},DESCRIPTORS$8=descriptors,fails$9=fails$d,createElement=documentCreateElement$1,ie8DomDefine=!DESCRIPTORS$8&&!fails$9(function(){return Object.defineProperty(createElement("div"),"a",{get:function(){return 7}}).a!=7}),DESCRIPTORS$7=descriptors,fails$8=fails$d,v8PrototypeDefineBug=DESCRIPTORS$7&&fails$8(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),isObject$h=isObject$j,$String$4=String,$TypeError$9=TypeError,anObject$8=function(yi){if(isObject$h(yi))return yi;throw $TypeError$9($String$4(yi)+" is not an object")},NATIVE_BIND$2=functionBindNative,call$a=Function.prototype.call,functionCall=NATIVE_BIND$2?call$a.bind(call$a):function(){return call$a.apply(call$a,arguments)},global$a=global$h,isCallable$e=isCallable$h,aFunction=function(yi){return isCallable$e(yi)?yi:void 0},getBuiltIn$4=function(yi,vi){return arguments.length<2?aFunction(global$a[yi]):global$a[yi]&&global$a[yi][vi]},uncurryThis$c=functionUncurryThis,objectIsPrototypeOf=uncurryThis$c({}.isPrototypeOf),getBuiltIn$3=getBuiltIn$4,isCallable$d=isCallable$h,isPrototypeOf$2=objectIsPrototypeOf,USE_SYMBOL_AS_UID=useSymbolAsUid,$Object$2=Object,isSymbol$9=USE_SYMBOL_AS_UID?function(yi){return typeof yi=="symbol"}:function(yi){var vi=getBuiltIn$3("Symbol");return isCallable$d(vi)&&isPrototypeOf$2(vi.prototype,$Object$2(yi))},isCallable$c=isCallable$h,tryToString$3=tryToString$4,$TypeError$8=TypeError,aCallable$8=function(yi){if(isCallable$c(yi))return yi;throw $TypeError$8(tryToString$3(yi)+" is not a function")},aCallable$7=aCallable$8,isNullOrUndefined$1=isNullOrUndefined$3,getMethod$3=function(yi,vi){var bi=yi[vi];return isNullOrUndefined$1(bi)?void 0:aCallable$7(bi)},call$9=functionCall,isCallable$b=isCallable$h,isObject$g=isObject$j,$TypeError$7=TypeError,ordinaryToPrimitive$1=function(yi,vi){var bi,_i;if(vi==="string"&&isCallable$b(bi=yi.toString)&&!isObject$g(_i=call$9(bi,yi))||isCallable$b(bi=yi.valueOf)&&!isObject$g(_i=call$9(bi,yi))||vi!=="string"&&isCallable$b(bi=yi.toString)&&!isObject$g(_i=call$9(bi,yi)))return _i;throw $TypeError$7("Can't convert object to primitive value")},call$8=functionCall,isObject$f=isObject$j,isSymbol$8=isSymbol$9,getMethod$2=getMethod$3,ordinaryToPrimitive=ordinaryToPrimitive$1,wellKnownSymbol$7=wellKnownSymbol$a,$TypeError$6=TypeError,TO_PRIMITIVE=wellKnownSymbol$7("toPrimitive"),toPrimitive$1=function(yi,vi){if(!isObject$f(yi)||isSymbol$8(yi))return yi;var bi=getMethod$2(yi,TO_PRIMITIVE),_i;if(bi){if(vi===void 0&&(vi="default"),_i=call$8(bi,yi,vi),!isObject$f(_i)||isSymbol$8(_i))return _i;throw $TypeError$6("Can't convert object to primitive value")}return vi===void 0&&(vi="number"),ordinaryToPrimitive(yi,vi)},toPrimitive=toPrimitive$1,isSymbol$7=isSymbol$9,toPropertyKey$3=function(yi){var vi=toPrimitive(yi,"string");return isSymbol$7(vi)?vi:vi+""},DESCRIPTORS$6=descriptors,IE8_DOM_DEFINE$1=ie8DomDefine,V8_PROTOTYPE_DEFINE_BUG$1=v8PrototypeDefineBug,anObject$7=anObject$8,toPropertyKey$2=toPropertyKey$3,$TypeError$5=TypeError,$defineProperty=Object.defineProperty,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE$1="configurable",WRITABLE="writable";objectDefineProperty.f=DESCRIPTORS$6?V8_PROTOTYPE_DEFINE_BUG$1?function(vi,bi,_i){if(anObject$7(vi),bi=toPropertyKey$2(bi),anObject$7(_i),typeof vi=="function"&&bi==="prototype"&&"value"in _i&&WRITABLE in _i&&!_i[WRITABLE]){var $i=$getOwnPropertyDescriptor$1(vi,bi);$i&&$i[WRITABLE]&&(vi[bi]=_i.value,_i={configurable:CONFIGURABLE$1 in _i?_i[CONFIGURABLE$1]:$i[CONFIGURABLE$1],enumerable:ENUMERABLE in _i?_i[ENUMERABLE]:$i[ENUMERABLE],writable:!1})}return $defineProperty(vi,bi,_i)}:$defineProperty:function(vi,bi,_i){if(anObject$7(vi),bi=toPropertyKey$2(bi),anObject$7(_i),IE8_DOM_DEFINE$1)try{return $defineProperty(vi,bi,_i)}catch{}if("get"in _i||"set"in _i)throw $TypeError$5("Accessors not supported");return"value"in _i&&(vi[bi]=_i.value),vi};var createPropertyDescriptor$3=function(yi,vi){return{enumerable:!(yi&1),configurable:!(yi&2),writable:!(yi&4),value:vi}},DESCRIPTORS$5=descriptors,definePropertyModule$4=objectDefineProperty,createPropertyDescriptor$2=createPropertyDescriptor$3,createNonEnumerableProperty$3=DESCRIPTORS$5?function(yi,vi,bi){return definePropertyModule$4.f(yi,vi,createPropertyDescriptor$2(1,bi))}:function(yi,vi,bi){return yi[vi]=bi,yi},makeBuiltInExports={},makeBuiltIn$3={get exports(){return makeBuiltInExports},set exports(yi){makeBuiltInExports=yi}},DESCRIPTORS$4=descriptors,hasOwn$8=hasOwnProperty_1,FunctionPrototype$1=Function.prototype,getDescriptor=DESCRIPTORS$4&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn$8(FunctionPrototype$1,"name"),PROPER=EXISTS&&function(){}.name==="something",CONFIGURABLE=EXISTS&&(!DESCRIPTORS$4||DESCRIPTORS$4&&getDescriptor(FunctionPrototype$1,"name").configurable),functionName={EXISTS,PROPER,CONFIGURABLE},uncurryThis$b=functionUncurryThis,isCallable$a=isCallable$h,store$1=sharedStore,functionToString=uncurryThis$b(Function.toString);isCallable$a(store$1.inspectSource)||(store$1.inspectSource=function(yi){return functionToString(yi)});var inspectSource$2=store$1.inspectSource,global$9=global$h,isCallable$9=isCallable$h,WeakMap$4=global$9.WeakMap,weakMapBasicDetection=isCallable$9(WeakMap$4)&&/native code/.test(String(WeakMap$4)),shared$1=sharedExports,uid$1=uid$3,keys$4=shared$1("keys"),sharedKey$3=function(yi){return keys$4[yi]||(keys$4[yi]=uid$1(yi))},hiddenKeys$4={},NATIVE_WEAK_MAP=weakMapBasicDetection,global$8=global$h,isObject$e=isObject$j,createNonEnumerableProperty$2=createNonEnumerableProperty$3,hasOwn$7=hasOwnProperty_1,shared=sharedStore,sharedKey$2=sharedKey$3,hiddenKeys$3=hiddenKeys$4,OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$2=global$8.TypeError,WeakMap$3=global$8.WeakMap,set,get$2,has,enforce=function(yi){return has(yi)?get$2(yi):set(yi,{})},getterFor=function(yi){return function(vi){var bi;if(!isObject$e(vi)||(bi=get$2(vi)).type!==yi)throw TypeError$2("Incompatible receiver, "+yi+" required");return bi}};if(NATIVE_WEAK_MAP||shared.state){var store=shared.state||(shared.state=new WeakMap$3);store.get=store.get,store.has=store.has,store.set=store.set,set=function(yi,vi){if(store.has(yi))throw TypeError$2(OBJECT_ALREADY_INITIALIZED);return vi.facade=yi,store.set(yi,vi),vi},get$2=function(yi){return store.get(yi)||{}},has=function(yi){return store.has(yi)}}else{var STATE=sharedKey$2("state");hiddenKeys$3[STATE]=!0,set=function(yi,vi){if(hasOwn$7(yi,STATE))throw TypeError$2(OBJECT_ALREADY_INITIALIZED);return vi.facade=yi,createNonEnumerableProperty$2(yi,STATE,vi),vi},get$2=function(yi){return hasOwn$7(yi,STATE)?yi[STATE]:{}},has=function(yi){return hasOwn$7(yi,STATE)}}var internalState={set,get:get$2,has,enforce,getterFor},uncurryThis$a=functionUncurryThis,fails$7=fails$d,isCallable$8=isCallable$h,hasOwn$6=hasOwnProperty_1,DESCRIPTORS$3=descriptors,CONFIGURABLE_FUNCTION_NAME=functionName.CONFIGURABLE,inspectSource$1=inspectSource$2,InternalStateModule$1=internalState,enforceInternalState$1=InternalStateModule$1.enforce,getInternalState$1=InternalStateModule$1.get,$String$3=String,defineProperty$6=Object.defineProperty,stringSlice=uncurryThis$a("".slice),replace$1=uncurryThis$a("".replace),join=uncurryThis$a([].join),CONFIGURABLE_LENGTH=DESCRIPTORS$3&&!fails$7(function(){return defineProperty$6(function(){},"length",{value:8}).length!==8}),TEMPLATE=String(String).split("String"),makeBuiltIn$2=makeBuiltIn$3.exports=function(yi,vi,bi){stringSlice($String$3(vi),0,7)==="Symbol("&&(vi="["+replace$1($String$3(vi),/^Symbol\(([^)]*)\)/,"$1")+"]"),bi&&bi.getter&&(vi="get "+vi),bi&&bi.setter&&(vi="set "+vi),(!hasOwn$6(yi,"name")||CONFIGURABLE_FUNCTION_NAME&&yi.name!==vi)&&(DESCRIPTORS$3?defineProperty$6(yi,"name",{value:vi,configurable:!0}):yi.name=vi),CONFIGURABLE_LENGTH&&bi&&hasOwn$6(bi,"arity")&&yi.length!==bi.arity&&defineProperty$6(yi,"length",{value:bi.arity});try{bi&&hasOwn$6(bi,"constructor")&&bi.constructor?DESCRIPTORS$3&&defineProperty$6(yi,"prototype",{writable:!1}):yi.prototype&&(yi.prototype=void 0)}catch{}var _i=enforceInternalState$1(yi);return hasOwn$6(_i,"source")||(_i.source=join(TEMPLATE,typeof vi=="string"?vi:"")),yi};Function.prototype.toString=makeBuiltIn$2(function(){return isCallable$8(this)&&getInternalState$1(this).source||inspectSource$1(this)},"toString");var isCallable$7=isCallable$h,definePropertyModule$3=objectDefineProperty,makeBuiltIn$1=makeBuiltInExports,defineGlobalProperty$1=defineGlobalProperty$3,defineBuiltIn$2=function(yi,vi,bi,_i){_i||(_i={});var $i=_i.enumerable,Pi=_i.name!==void 0?_i.name:vi;if(isCallable$7(bi)&&makeBuiltIn$1(bi,Pi,_i),_i.global)$i?yi[vi]=bi:defineGlobalProperty$1(vi,bi);else{try{_i.unsafe?yi[vi]&&($i=!0):delete yi[vi]}catch{}$i?yi[vi]=bi:definePropertyModule$3.f(yi,vi,{value:bi,enumerable:!1,configurable:!_i.nonConfigurable,writable:!_i.nonWritable})}return yi},makeBuiltIn=makeBuiltInExports,defineProperty$5=objectDefineProperty,defineBuiltInAccessor$1=function(yi,vi,bi){return bi.get&&makeBuiltIn(bi.get,vi,{getter:!0}),bi.set&&makeBuiltIn(bi.set,vi,{setter:!0}),defineProperty$5.f(yi,vi,bi)},fails$6=fails$d,correctPrototypeGetter=!fails$6(function(){function yi(){}return yi.prototype.constructor=null,Object.getPrototypeOf(new yi)!==yi.prototype}),hasOwn$5=hasOwnProperty_1,isCallable$6=isCallable$h,toObject$2=toObject$4,sharedKey$1=sharedKey$3,CORRECT_PROTOTYPE_GETTER=correctPrototypeGetter,IE_PROTO$1=sharedKey$1("IE_PROTO"),$Object$1=Object,ObjectPrototype$1=$Object$1.prototype,objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER?$Object$1.getPrototypeOf:function(yi){var vi=toObject$2(yi);if(hasOwn$5(vi,IE_PROTO$1))return vi[IE_PROTO$1];var bi=vi.constructor;return isCallable$6(bi)&&vi instanceof bi?bi.prototype:vi instanceof $Object$1?ObjectPrototype$1:null},uncurryThis$9=functionUncurryThis,aCallable$6=aCallable$8,functionUncurryThisAccessor=function(yi,vi,bi){try{return uncurryThis$9(aCallable$6(Object.getOwnPropertyDescriptor(yi,vi)[bi]))}catch{}},isCallable$5=isCallable$h,$String$2=String,$TypeError$4=TypeError,aPossiblePrototype$1=function(yi){if(typeof yi=="object"||isCallable$5(yi))return yi;throw $TypeError$4("Can't set "+$String$2(yi)+" as a prototype")},uncurryThisAccessor=functionUncurryThisAccessor,anObject$6=anObject$8,aPossiblePrototype=aPossiblePrototype$1,objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var yi=!1,vi={},bi;try{bi=uncurryThisAccessor(Object.prototype,"__proto__","set"),bi(vi,[]),yi=vi instanceof Array}catch{}return function($i,Pi){return anObject$6($i),aPossiblePrototype(Pi),yi?bi($i,Pi):$i.__proto__=Pi,$i}}():void 0),NATIVE_ARRAY_BUFFER=arrayBufferBasicDetection,DESCRIPTORS$2=descriptors,global$7=global$h,isCallable$4=isCallable$h,isObject$d=isObject$j,hasOwn$4=hasOwnProperty_1,classof$6=classof$7,tryToString$2=tryToString$4,createNonEnumerableProperty$1=createNonEnumerableProperty$3,defineBuiltIn$1=defineBuiltIn$2,defineBuiltInAccessor=defineBuiltInAccessor$1,isPrototypeOf$1=objectIsPrototypeOf,getPrototypeOf=objectGetPrototypeOf,setPrototypeOf=objectSetPrototypeOf,wellKnownSymbol$6=wellKnownSymbol$a,uid=uid$3,InternalStateModule=internalState,enforceInternalState=InternalStateModule.enforce,getInternalState=InternalStateModule.get,Int8Array$1=global$7.Int8Array,Int8ArrayPrototype$1=Int8Array$1&&Int8Array$1.prototype,Uint8ClampedArray$1=global$7.Uint8ClampedArray,Uint8ClampedArrayPrototype=Uint8ClampedArray$1&&Uint8ClampedArray$1.prototype,TypedArray=Int8Array$1&&getPrototypeOf(Int8Array$1),TypedArrayPrototype=Int8ArrayPrototype$1&&getPrototypeOf(Int8ArrayPrototype$1),ObjectPrototype=Object.prototype,TypeError$1=global$7.TypeError,TO_STRING_TAG$1=wellKnownSymbol$6("toStringTag"),TYPED_ARRAY_TAG=uid("TYPED_ARRAY_TAG"),TYPED_ARRAY_CONSTRUCTOR="TypedArrayConstructor",NATIVE_ARRAY_BUFFER_VIEWS=NATIVE_ARRAY_BUFFER&&!!setPrototypeOf&&classof$6(global$7.opera)!=="Opera",TYPED_ARRAY_TAG_REQUIRED=!1,NAME,Constructor,Prototype,TypedArrayConstructorsList={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},BigIntArrayConstructorsList={BigInt64Array:8,BigUint64Array:8},isView=function(vi){if(!isObject$d(vi))return!1;var bi=classof$6(vi);return bi==="DataView"||hasOwn$4(TypedArrayConstructorsList,bi)||hasOwn$4(BigIntArrayConstructorsList,bi)},getTypedArrayConstructor=function(yi){var vi=getPrototypeOf(yi);if(isObject$d(vi)){var bi=getInternalState(vi);return bi&&hasOwn$4(bi,TYPED_ARRAY_CONSTRUCTOR)?bi[TYPED_ARRAY_CONSTRUCTOR]:getTypedArrayConstructor(vi)}},isTypedArray$5=function(yi){if(!isObject$d(yi))return!1;var vi=classof$6(yi);return hasOwn$4(TypedArrayConstructorsList,vi)||hasOwn$4(BigIntArrayConstructorsList,vi)},aTypedArray$3=function(yi){if(isTypedArray$5(yi))return yi;throw TypeError$1("Target is not a typed array")},aTypedArrayConstructor=function(yi){if(isCallable$4(yi)&&(!setPrototypeOf||isPrototypeOf$1(TypedArray,yi)))return yi;throw TypeError$1(tryToString$2(yi)+" is not a typed array constructor")},exportTypedArrayMethod$3=function(yi,vi,bi,_i){if(DESCRIPTORS$2){if(bi)for(var $i in TypedArrayConstructorsList){var Pi=global$7[$i];if(Pi&&hasOwn$4(Pi.prototype,yi))try{delete Pi.prototype[yi]}catch{try{Pi.prototype[yi]=vi}catch{}}}(!TypedArrayPrototype[yi]||bi)&&defineBuiltIn$1(TypedArrayPrototype,yi,bi?vi:NATIVE_ARRAY_BUFFER_VIEWS&&Int8ArrayPrototype$1[yi]||vi,_i)}},exportTypedArrayStaticMethod=function(yi,vi,bi){var _i,$i;if(DESCRIPTORS$2){if(setPrototypeOf){if(bi){for(_i in TypedArrayConstructorsList)if($i=global$7[_i],$i&&hasOwn$4($i,yi))try{delete $i[yi]}catch{}}if(!TypedArray[yi]||bi)try{return defineBuiltIn$1(TypedArray,yi,bi?vi:NATIVE_ARRAY_BUFFER_VIEWS&&TypedArray[yi]||vi)}catch{}else return}for(_i in TypedArrayConstructorsList)$i=global$7[_i],$i&&(!$i[yi]||bi)&&defineBuiltIn$1($i,yi,vi)}};for(NAME in TypedArrayConstructorsList)Constructor=global$7[NAME],Prototype=Constructor&&Constructor.prototype,Prototype?enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR]=Constructor:NATIVE_ARRAY_BUFFER_VIEWS=!1;for(NAME in BigIntArrayConstructorsList)Constructor=global$7[NAME],Prototype=Constructor&&Constructor.prototype,Prototype&&(enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR]=Constructor);if((!NATIVE_ARRAY_BUFFER_VIEWS||!isCallable$4(TypedArray)||TypedArray===Function.prototype)&&(TypedArray=function(){throw TypeError$1("Incorrect invocation")},NATIVE_ARRAY_BUFFER_VIEWS))for(NAME in TypedArrayConstructorsList)global$7[NAME]&&setPrototypeOf(global$7[NAME],TypedArray);if((!NATIVE_ARRAY_BUFFER_VIEWS||!TypedArrayPrototype||TypedArrayPrototype===ObjectPrototype)&&(TypedArrayPrototype=TypedArray.prototype,NATIVE_ARRAY_BUFFER_VIEWS))for(NAME in TypedArrayConstructorsList)global$7[NAME]&&setPrototypeOf(global$7[NAME].prototype,TypedArrayPrototype);if(NATIVE_ARRAY_BUFFER_VIEWS&&getPrototypeOf(Uint8ClampedArrayPrototype)!==TypedArrayPrototype&&setPrototypeOf(Uint8ClampedArrayPrototype,TypedArrayPrototype),DESCRIPTORS$2&&!hasOwn$4(TypedArrayPrototype,TO_STRING_TAG$1)){TYPED_ARRAY_TAG_REQUIRED=!0,defineBuiltInAccessor(TypedArrayPrototype,TO_STRING_TAG$1,{configurable:!0,get:function(){return isObject$d(this)?this[TYPED_ARRAY_TAG]:void 0}});for(NAME in TypedArrayConstructorsList)global$7[NAME]&&createNonEnumerableProperty$1(global$7[NAME],TYPED_ARRAY_TAG,NAME)}var arrayBufferViewCore={NATIVE_ARRAY_BUFFER_VIEWS,TYPED_ARRAY_TAG:TYPED_ARRAY_TAG_REQUIRED&&TYPED_ARRAY_TAG,aTypedArray:aTypedArray$3,aTypedArrayConstructor,exportTypedArrayMethod:exportTypedArrayMethod$3,exportTypedArrayStaticMethod,getTypedArrayConstructor,isView,isTypedArray:isTypedArray$5,TypedArray,TypedArrayPrototype},ceil=Math.ceil,floor$1=Math.floor,mathTrunc=Math.trunc||function(vi){var bi=+vi;return(bi>0?floor$1:ceil)(bi)},trunc=mathTrunc,toIntegerOrInfinity$5=function(yi){var vi=+yi;return vi!==vi||vi===0?0:trunc(vi)},toIntegerOrInfinity$4=toIntegerOrInfinity$5,min$1=Math.min,toLength$1=function(yi){return yi>0?min$1(toIntegerOrInfinity$4(yi),9007199254740991):0},toLength=toLength$1,lengthOfArrayLike$7=function(yi){return toLength(yi.length)},ArrayBufferViewCore$2=arrayBufferViewCore,lengthOfArrayLike$6=lengthOfArrayLike$7,toIntegerOrInfinity$3=toIntegerOrInfinity$5,aTypedArray$2=ArrayBufferViewCore$2.aTypedArray,exportTypedArrayMethod$2=ArrayBufferViewCore$2.exportTypedArrayMethod;exportTypedArrayMethod$2("at",function(vi){var bi=aTypedArray$2(this),_i=lengthOfArrayLike$6(bi),$i=toIntegerOrInfinity$3(vi),Pi=$i>=0?$i:_i+$i;return Pi<0||Pi>=_i?void 0:bi[Pi]});var toIntegerOrInfinity$2=toIntegerOrInfinity$5,$RangeError$1=RangeError,toPositiveInteger$1=function(yi){var vi=toIntegerOrInfinity$2(yi);if(vi<0)throw $RangeError$1("The argument can't be less than 0");return vi},toPositiveInteger=toPositiveInteger$1,$RangeError=RangeError,toOffset$1=function(yi,vi){var bi=toPositiveInteger(yi);if(bi%vi)throw $RangeError("Wrong offset");return bi},global$6=global$h,call$7=functionCall,ArrayBufferViewCore$1=arrayBufferViewCore,lengthOfArrayLike$5=lengthOfArrayLike$7,toOffset=toOffset$1,toIndexedObject$5=toObject$4,fails$5=fails$d,RangeError$1=global$6.RangeError,Int8Array=global$6.Int8Array,Int8ArrayPrototype=Int8Array&&Int8Array.prototype,$set=Int8ArrayPrototype&&Int8ArrayPrototype.set,aTypedArray$1=ArrayBufferViewCore$1.aTypedArray,exportTypedArrayMethod$1=ArrayBufferViewCore$1.exportTypedArrayMethod,WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS=!fails$5(function(){var yi=new Uint8ClampedArray(2);return call$7($set,yi,{length:1,0:3},1),yi[1]!==3}),TO_OBJECT_BUG=WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS&&ArrayBufferViewCore$1.NATIVE_ARRAY_BUFFER_VIEWS&&fails$5(function(){var yi=new Int8Array(2);return yi.set(1),yi.set("2",1),yi[0]!==0||yi[1]!==2});exportTypedArrayMethod$1("set",function(vi){aTypedArray$1(this);var bi=toOffset(arguments.length>1?arguments[1]:void 0,1),_i=toIndexedObject$5(vi);if(WORKS_WITH_OBJECTS_AND_GENERIC_ON_TYPED_ARRAYS)return call$7($set,this,_i,bi);var $i=this.length,Pi=lengthOfArrayLike$5(_i),Ai=0;if(Pi+bi>$i)throw RangeError$1("Wrong length");for(;Ai0;)yi[Pi]=yi[--Pi];Pi!==_i++&&(yi[Pi]=$i)}return yi},merge=function(yi,vi,bi,_i){for(var $i=vi.length,Pi=bi.length,Ai=0,Si=0;Ai<$i||Si0&&1/bi<0?1:-1:vi>bi}};exportTypedArrayMethod("sort",function(vi){return vi!==void 0&&aCallable$5(vi),STABLE_SORT?nativeSort(this,vi):internalSort(aTypedArray(this),getSortCompare(vi))},!STABLE_SORT||ACCEPT_INCORRECT_ARGUMENTS);var objectDefineProperties={},uncurryThis$6=functionUncurryThis,fails$3=fails$d,classof$5=classofRaw$2,$Object=Object,split=uncurryThis$6("".split),indexedObject=fails$3(function(){return!$Object("z").propertyIsEnumerable(0)})?function(yi){return classof$5(yi)=="String"?split(yi,""):$Object(yi)}:$Object,IndexedObject$1=indexedObject,requireObjectCoercible=requireObjectCoercible$2,toIndexedObject$4=function(yi){return IndexedObject$1(requireObjectCoercible(yi))},toIndexedObject$3=toIndexedObject$4,toAbsoluteIndex=toAbsoluteIndex$2,lengthOfArrayLike$3=lengthOfArrayLike$7,createMethod$1=function(yi){return function(vi,bi,_i){var $i=toIndexedObject$3(vi),Pi=lengthOfArrayLike$3($i),Ai=toAbsoluteIndex(_i,Pi),Si;if(yi&&bi!=bi){for(;Pi>Ai;)if(Si=$i[Ai++],Si!=Si)return!0}else for(;Pi>Ai;Ai++)if((yi||Ai in $i)&&$i[Ai]===bi)return yi||Ai||0;return!yi&&-1}},arrayIncludes$2={includes:createMethod$1(!0),indexOf:createMethod$1(!1)},uncurryThis$5=functionUncurryThis,hasOwn$3=hasOwnProperty_1,toIndexedObject$2=toIndexedObject$4,indexOf=arrayIncludes$2.indexOf,hiddenKeys$2=hiddenKeys$4,push$1=uncurryThis$5([].push),objectKeysInternal=function(yi,vi){var bi=toIndexedObject$2(yi),_i=0,$i=[],Pi;for(Pi in bi)!hasOwn$3(hiddenKeys$2,Pi)&&hasOwn$3(bi,Pi)&&push$1($i,Pi);for(;vi.length>_i;)hasOwn$3(bi,Pi=vi[_i++])&&(~indexOf($i,Pi)||push$1($i,Pi));return $i},enumBugKeys$3=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],internalObjectKeys$1=objectKeysInternal,enumBugKeys$2=enumBugKeys$3,objectKeys$1=Object.keys||function(vi){return internalObjectKeys$1(vi,enumBugKeys$2)},DESCRIPTORS$1=descriptors,V8_PROTOTYPE_DEFINE_BUG=v8PrototypeDefineBug,definePropertyModule$1=objectDefineProperty,anObject$5=anObject$8,toIndexedObject$1=toIndexedObject$4,objectKeys=objectKeys$1;objectDefineProperties.f=DESCRIPTORS$1&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(vi,bi){anObject$5(vi);for(var _i=toIndexedObject$1(bi),$i=objectKeys(bi),Pi=$i.length,Ai=0,Si;Pi>Ai;)definePropertyModule$1.f(vi,Si=$i[Ai++],_i[Si]);return vi};var getBuiltIn$2=getBuiltIn$4,html$1=getBuiltIn$2("document","documentElement"),anObject$4=anObject$8,definePropertiesModule=objectDefineProperties,enumBugKeys$1=enumBugKeys$3,hiddenKeys$1=hiddenKeys$4,html=html$1,documentCreateElement=documentCreateElement$1,sharedKey=sharedKey$3,GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(yi){return LT+SCRIPT+GT+yi+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(yi){yi.write(scriptTag("")),yi.close();var vi=yi.parentWindow.Object;return yi=null,vi},NullProtoObjectViaIFrame=function(){var yi=documentCreateElement("iframe"),vi="java"+SCRIPT+":",bi;return yi.style.display="none",html.appendChild(yi),yi.src=String(vi),bi=yi.contentWindow.document,bi.open(),bi.write(scriptTag("document.F=Object")),bi.close(),bi.F},activeXDocument,NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch{}NullProtoObject=typeof document<"u"?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame():NullProtoObjectViaActiveX(activeXDocument);for(var yi=enumBugKeys$1.length;yi--;)delete NullProtoObject[PROTOTYPE][enumBugKeys$1[yi]];return NullProtoObject()};hiddenKeys$1[IE_PROTO]=!0;var objectCreate$1=Object.create||function(vi,bi){var _i;return vi!==null?(EmptyConstructor[PROTOTYPE]=anObject$4(vi),_i=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,_i[IE_PROTO]=vi):_i=NullProtoObject(),bi===void 0?_i:definePropertiesModule.f(_i,bi)},wellKnownSymbol$5=wellKnownSymbol$a,create=objectCreate$1,defineProperty$4=objectDefineProperty.f,UNSCOPABLES=wellKnownSymbol$5("unscopables"),ArrayPrototype$1=Array.prototype;ArrayPrototype$1[UNSCOPABLES]==null&&defineProperty$4(ArrayPrototype$1,UNSCOPABLES,{configurable:!0,value:create(null)});var addToUnscopables$2=function(yi){ArrayPrototype$1[UNSCOPABLES][yi]=!0},addToUnscopables$1=addToUnscopables$2;addToUnscopables$1("flat");var objectGetOwnPropertyDescriptor={},objectPropertyIsEnumerable={},$propertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$1&&!$propertyIsEnumerable.call({1:2},1);objectPropertyIsEnumerable.f=NASHORN_BUG?function(vi){var bi=getOwnPropertyDescriptor$1(this,vi);return!!bi&&bi.enumerable}:$propertyIsEnumerable;var DESCRIPTORS=descriptors,call$6=functionCall,propertyIsEnumerableModule=objectPropertyIsEnumerable,createPropertyDescriptor=createPropertyDescriptor$3,toIndexedObject=toIndexedObject$4,toPropertyKey=toPropertyKey$3,hasOwn$2=hasOwnProperty_1,IE8_DOM_DEFINE=ie8DomDefine,$getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor;objectGetOwnPropertyDescriptor.f=DESCRIPTORS?$getOwnPropertyDescriptor:function(vi,bi){if(vi=toIndexedObject(vi),bi=toPropertyKey(bi),IE8_DOM_DEFINE)try{return $getOwnPropertyDescriptor(vi,bi)}catch{}if(hasOwn$2(vi,bi))return createPropertyDescriptor(!call$6(propertyIsEnumerableModule.f,vi,bi),vi[bi])};var objectGetOwnPropertyNames={},internalObjectKeys=objectKeysInternal,enumBugKeys=enumBugKeys$3,hiddenKeys=enumBugKeys.concat("length","prototype");objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(vi){return internalObjectKeys(vi,hiddenKeys)};var objectGetOwnPropertySymbols={};objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols;var getBuiltIn$1=getBuiltIn$4,uncurryThis$4=functionUncurryThis,getOwnPropertyNamesModule=objectGetOwnPropertyNames,getOwnPropertySymbolsModule=objectGetOwnPropertySymbols,anObject$3=anObject$8,concat=uncurryThis$4([].concat),ownKeys$1=getBuiltIn$1("Reflect","ownKeys")||function(vi){var bi=getOwnPropertyNamesModule.f(anObject$3(vi)),_i=getOwnPropertySymbolsModule.f;return _i?concat(bi,_i(vi)):bi},hasOwn$1=hasOwnProperty_1,ownKeys=ownKeys$1,getOwnPropertyDescriptorModule=objectGetOwnPropertyDescriptor,definePropertyModule=objectDefineProperty,copyConstructorProperties$1=function(yi,vi,bi){for(var _i=ownKeys(vi),$i=definePropertyModule.f,Pi=getOwnPropertyDescriptorModule.f,Ai=0;Ai<_i.length;Ai++){var Si=_i[Ai];!hasOwn$1(yi,Si)&&!(bi&&hasOwn$1(bi,Si))&&$i(yi,Si,Pi(vi,Si))}},fails$2=fails$d,isCallable$3=isCallable$h,replacement=/#|\.prototype\./,isForced$2=function(yi,vi){var bi=data[normalize(yi)];return bi==POLYFILL?!0:bi==NATIVE?!1:isCallable$3(vi)?fails$2(vi):!!vi},normalize=isForced$2.normalize=function(yi){return String(yi).replace(replacement,".").toLowerCase()},data=isForced$2.data={},NATIVE=isForced$2.NATIVE="N",POLYFILL=isForced$2.POLYFILL="P",isForced_1=isForced$2,global$4=global$h,getOwnPropertyDescriptor=objectGetOwnPropertyDescriptor.f,createNonEnumerableProperty=createNonEnumerableProperty$3,defineBuiltIn=defineBuiltIn$2,defineGlobalProperty=defineGlobalProperty$3,copyConstructorProperties=copyConstructorProperties$1,isForced$1=isForced_1,_export=function(yi,vi){var bi=yi.target,_i=yi.global,$i=yi.stat,Pi,Ai,Si,Ei,wi,Ci;if(_i?Ai=global$4:$i?Ai=global$4[bi]||defineGlobalProperty(bi,{}):Ai=(global$4[bi]||{}).prototype,Ai)for(Si in vi){if(wi=vi[Si],yi.dontCallGetSet?(Ci=getOwnPropertyDescriptor(Ai,Si),Ei=Ci&&Ci.value):Ei=Ai[Si],Pi=isForced$1(_i?Si:bi+($i?".":"#")+Si,yi.forced),!Pi&&Ei!==void 0){if(typeof wi==typeof Ei)continue;copyConstructorProperties(wi,Ei)}(yi.sham||Ei&&Ei.sham)&&createNonEnumerableProperty(wi,"sham",!0),defineBuiltIn(Ai,Si,wi,yi)}},defineProperty$3=objectDefineProperty.f,hasOwn=hasOwnProperty_1,wellKnownSymbol$4=wellKnownSymbol$a,TO_STRING_TAG=wellKnownSymbol$4("toStringTag"),setToStringTag$1=function(yi,vi,bi){yi&&!bi&&(yi=yi.prototype),yi&&!hasOwn(yi,TO_STRING_TAG)&&defineProperty$3(yi,TO_STRING_TAG,{configurable:!0,value:vi})},$$k=_export,global$3=global$h,setToStringTag=setToStringTag$1;$$k({global:!0},{Reflect:{}}),setToStringTag(global$3.Reflect,"Reflect",!0);var aCallable$4=aCallable$8,toObject$1=toObject$4,IndexedObject=indexedObject,lengthOfArrayLike$2=lengthOfArrayLike$7,$TypeError$3=TypeError,createMethod=function(yi){return function(vi,bi,_i,$i){aCallable$4(bi);var Pi=toObject$1(vi),Ai=IndexedObject(Pi),Si=lengthOfArrayLike$2(Pi),Ei=yi?Si-1:0,wi=yi?-1:1;if(_i<2)for(;;){if(Ei in Ai){$i=Ai[Ei],Ei+=wi;break}if(Ei+=wi,yi?Ei<0:Si<=Ei)throw $TypeError$3("Reduce of empty array with no initial value")}for(;yi?Ei>=0:Si>Ei;Ei+=wi)Ei in Ai&&($i=bi($i,Ai[Ei],Ei,Pi));return $i}},arrayReduce={left:createMethod(!1),right:createMethod(!0)},fails$1=fails$d,arrayMethodIsStrict$1=function(yi,vi){var bi=[][yi];return!!bi&&fails$1(function(){bi.call(null,vi||function(){return 1},1)})},classof$4=classofRaw$2,engineIsNode=typeof process<"u"&&classof$4(process)=="process",$$j=_export,$reduce=arrayReduce.left,arrayMethodIsStrict=arrayMethodIsStrict$1,CHROME_VERSION=engineV8Version,IS_NODE$1=engineIsNode,CHROME_BUG=!IS_NODE$1&&CHROME_VERSION>79&&CHROME_VERSION<83,FORCED=CHROME_BUG||!arrayMethodIsStrict("reduce");$$j({target:"Array",proto:!0,forced:FORCED},{reduce:function(vi){var bi=arguments.length;return $reduce(this,vi,bi,bi>1?arguments[1]:void 0)}});const RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};new Promise(function(yi){if(typeof PDFJSDev<"u"&&PDFJSDev.test("LIB")&&typeof window>"u"){setTimeout(yi,20);return}window.requestAnimationFrame(yi)});function unreachable(yi){throw new Error(yi)}(function(){function vi(bi,_i){this.constructor===vi&&unreachable("Cannot initialize BaseException."),this.message=bi,this.name=_i}return vi.prototype=new Error,vi.constructor=vi,vi})(),[...Array(256).keys()].map(yi=>yi.toString(16).padStart(2,"0"));const Dr=class{};let PixelsPerInch=Dr;es(PixelsPerInch,"CSS",96),es(PixelsPerInch,"PDF",72),es(PixelsPerInch,"PDF_TO_CSS_UNITS",Dr.CSS/Dr.PDF);let random=yi=>crypto.getRandomValues(new Uint8Array(yi)),customRandom=(yi,vi,bi)=>{let _i=(2<{let Ai="";for(;;){let Si=bi($i),Ei=$i;for(;Ei--;)if(Ai+=yi[Si[Ei]&_i]||"",Ai.length===Pi)return Ai}}},customAlphabet=(yi,vi=21)=>customRandom(yi,vi,random);var $$i=_export,toObject=toObject$4,lengthOfArrayLike$1=lengthOfArrayLike$7,toIntegerOrInfinity=toIntegerOrInfinity$5,addToUnscopables=addToUnscopables$2;$$i({target:"Array",proto:!0},{at:function(vi){var bi=toObject(this),_i=lengthOfArrayLike$1(bi),$i=toIntegerOrInfinity(vi),Pi=$i>=0?$i:_i+$i;return Pi<0||Pi>=_i?void 0:bi[Pi]}}),addToUnscopables("at");function identity$4(yi){return yi}var identity_1=identity$4;function arrayPush$2(yi,vi){for(var bi=-1,_i=vi.length,$i=yi.length;++bi<_i;)yi[$i+bi]=vi[bi];return yi}var _arrayPush=arrayPush$2,freeGlobal$1=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$9=freeGlobal||freeSelf||Function("return this")(),_root=root$9,root$8=_root,Symbol$6=root$8.Symbol,_Symbol=Symbol$6,Symbol$5=_Symbol,objectProto$g=Object.prototype,hasOwnProperty$d=objectProto$g.hasOwnProperty,nativeObjectToString$1=objectProto$g.toString,symToStringTag$1=Symbol$5?Symbol$5.toStringTag:void 0;function getRawTag$1(yi){var vi=hasOwnProperty$d.call(yi,symToStringTag$1),bi=yi[symToStringTag$1];try{yi[symToStringTag$1]=void 0;var _i=!0}catch{}var $i=nativeObjectToString$1.call(yi);return _i&&(vi?yi[symToStringTag$1]=bi:delete yi[symToStringTag$1]),$i}var _getRawTag=getRawTag$1,objectProto$f=Object.prototype,nativeObjectToString=objectProto$f.toString;function objectToString$1(yi){return nativeObjectToString.call(yi)}var _objectToString=objectToString$1,Symbol$4=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$4?Symbol$4.toStringTag:void 0;function baseGetTag$6(yi){return yi==null?yi===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(yi)?getRawTag(yi):objectToString(yi)}var _baseGetTag=baseGetTag$6;function isObjectLike$7(yi){return yi!=null&&typeof yi=="object"}var isObjectLike_1=isObjectLike$7,baseGetTag$5=_baseGetTag,isObjectLike$6=isObjectLike_1,argsTag$2="[object Arguments]";function baseIsArguments$1(yi){return isObjectLike$6(yi)&&baseGetTag$5(yi)==argsTag$2}var _baseIsArguments=baseIsArguments$1,baseIsArguments=_baseIsArguments,isObjectLike$5=isObjectLike_1,objectProto$e=Object.prototype,hasOwnProperty$c=objectProto$e.hasOwnProperty,propertyIsEnumerable$1=objectProto$e.propertyIsEnumerable,isArguments$5=baseIsArguments(function(){return arguments}())?baseIsArguments:function(yi){return isObjectLike$5(yi)&&hasOwnProperty$c.call(yi,"callee")&&!propertyIsEnumerable$1.call(yi,"callee")},isArguments_1=isArguments$5,isArray$f=Array.isArray,isArray_1=isArray$f,Symbol$3=_Symbol,isArguments$4=isArguments_1,isArray$e=isArray_1,spreadableSymbol=Symbol$3?Symbol$3.isConcatSpreadable:void 0;function isFlattenable$1(yi){return isArray$e(yi)||isArguments$4(yi)||!!(spreadableSymbol&&yi&&yi[spreadableSymbol])}var _isFlattenable=isFlattenable$1,arrayPush$1=_arrayPush,isFlattenable=_isFlattenable;function baseFlatten$3(yi,vi,bi,_i,$i){var Pi=-1,Ai=yi.length;for(bi||(bi=isFlattenable),$i||($i=[]);++Pi0&&bi(Si)?vi>1?baseFlatten$3(Si,vi-1,bi,_i,$i):arrayPush$1($i,Si):_i||($i[$i.length]=Si)}return $i}var _baseFlatten=baseFlatten$3;function arrayMap$2(yi,vi){for(var bi=-1,_i=yi==null?0:yi.length,$i=Array(_i);++bi<_i;)$i[bi]=vi(yi[bi],bi,yi);return $i}var _arrayMap=arrayMap$2,baseGetTag$4=_baseGetTag,isObjectLike$4=isObjectLike_1,symbolTag$1="[object Symbol]";function isSymbol$6(yi){return typeof yi=="symbol"||isObjectLike$4(yi)&&baseGetTag$4(yi)==symbolTag$1}var isSymbol_1=isSymbol$6,isArray$d=isArray_1,isSymbol$5=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(yi,vi){if(isArray$d(yi))return!1;var bi=typeof yi;return bi=="number"||bi=="symbol"||bi=="boolean"||yi==null||isSymbol$5(yi)?!0:reIsPlainProp.test(yi)||!reIsDeepProp.test(yi)||vi!=null&&yi in Object(vi)}var _isKey=isKey$3;function isObject$c(yi){var vi=typeof yi;return yi!=null&&(vi=="object"||vi=="function")}var isObject_1=isObject$c,baseGetTag$3=_baseGetTag,isObject$b=isObject_1,asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(yi){if(!isObject$b(yi))return!1;var vi=baseGetTag$3(yi);return vi==funcTag$1||vi==genTag||vi==asyncTag||vi==proxyTag}var isFunction_1=isFunction$3,root$7=_root,coreJsData$1=root$7["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=_coreJsData,maskSrcKey=function(){var yi=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return yi?"Symbol(src)_1."+yi:""}();function isMasked$1(yi){return!!maskSrcKey&&maskSrcKey in yi}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(yi){if(yi!=null){try{return funcToString$2.call(yi)}catch{}try{return yi+""}catch{}}return""}var _toSource=toSource$2,isFunction$2=isFunction_1,isMasked=_isMasked,isObject$a=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$d=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$b=objectProto$d.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$b).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(yi){if(!isObject$a(yi)||isMasked(yi))return!1;var vi=isFunction$2(yi)?reIsNative:reIsHostCtor;return vi.test(toSource$1(yi))}var _baseIsNative=baseIsNative$1;function getValue$1(yi,vi){return yi==null?void 0:yi[vi]}var _getValue=getValue$1,baseIsNative=_baseIsNative,getValue=_getValue;function getNative$7(yi,vi){var bi=getValue(yi,vi);return baseIsNative(bi)?bi:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=getNative$6(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(yi){var vi=this.has(yi)&&delete this.__data__[yi];return this.size-=vi?1:0,vi}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$c=Object.prototype,hasOwnProperty$a=objectProto$c.hasOwnProperty;function hashGet$1(yi){var vi=this.__data__;if(nativeCreate$2){var bi=vi[yi];return bi===HASH_UNDEFINED$2?void 0:bi}return hasOwnProperty$a.call(vi,yi)?vi[yi]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$b=Object.prototype,hasOwnProperty$9=objectProto$b.hasOwnProperty;function hashHas$1(yi){var vi=this.__data__;return nativeCreate$1?vi[yi]!==void 0:hasOwnProperty$9.call(vi,yi)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet$1(yi,vi){var bi=this.__data__;return this.size+=this.has(yi)?0:1,bi[yi]=nativeCreate&&vi===void 0?HASH_UNDEFINED$1:vi,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=_hashHas,hashSet=_hashSet;function Hash$1(yi){var vi=-1,bi=yi==null?0:yi.length;for(this.clear();++vi-1}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(yi,vi){var bi=this.__data__,_i=assocIndexOf(bi,yi);return _i<0?(++this.size,bi.push([yi,vi])):bi[_i][1]=vi,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=_listCacheDelete,listCacheGet=_listCacheGet,listCacheHas=_listCacheHas,listCacheSet=_listCacheSet;function ListCache$4(yi){var vi=-1,bi=yi==null?0:yi.length;for(this.clear();++viSi))return!1;var wi=Pi.get(yi),Ci=Pi.get(vi);if(wi&&Ci)return wi==vi&&Ci==yi;var ki=-1,xi=!0,Ti=bi&COMPARE_UNORDERED_FLAG$3?new SetCache$1:void 0;for(Pi.set(yi,vi),Pi.set(vi,yi);++ki-1&&yi%1==0&&yi-1&&yi%1==0&&yi<=MAX_SAFE_INTEGER}var isLength_1=isLength$3,baseGetTag$2=_baseGetTag,isLength$2=isLength_1,isObjectLike$3=isObjectLike_1,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag$2="[object Map]",numberTag="[object Number]",objectTag$3="[object Object]",regexpTag="[object RegExp]",setTag$2="[object Set]",stringTag="[object String]",weakMapTag$1="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag$1]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag$1]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag$2]=typedArrayTags[numberTag]=typedArrayTags[objectTag$3]=typedArrayTags[regexpTag]=typedArrayTags[setTag$2]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag$1]=!1;function baseIsTypedArray$1(yi){return isObjectLike$3(yi)&&isLength$2(yi.length)&&!!typedArrayTags[baseGetTag$2(yi)]}var _baseIsTypedArray=baseIsTypedArray$1;function baseUnary$2(yi){return function(vi){return yi(vi)}}var _baseUnary=baseUnary$2,_nodeUtilExports={},_nodeUtil={get exports(){return _nodeUtilExports},set exports(yi){_nodeUtilExports=yi}};(function(yi,vi){var bi=_freeGlobal,_i=vi&&!vi.nodeType&&vi,$i=_i&&!0&&yi&&!yi.nodeType&&yi,Pi=$i&&$i.exports===_i,Ai=Pi&&bi.process,Si=function(){try{var Ei=$i&&$i.require&&$i.require("util").types;return Ei||Ai&&Ai.binding&&Ai.binding("util")}catch{}}();yi.exports=Si})(_nodeUtil,_nodeUtilExports);var baseIsTypedArray=_baseIsTypedArray,baseUnary$1=_baseUnary,nodeUtil=_nodeUtilExports,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray$4=nodeIsTypedArray?baseUnary$1(nodeIsTypedArray):baseIsTypedArray,isTypedArray_1=isTypedArray$4,baseTimes=_baseTimes,isArguments$3=isArguments_1,isArray$9=isArray_1,isBuffer$3=isBufferExports,isIndex$3=_isIndex,isTypedArray$3=isTypedArray_1,objectProto$9=Object.prototype,hasOwnProperty$8=objectProto$9.hasOwnProperty;function arrayLikeKeys$2(yi,vi){var bi=isArray$9(yi),_i=!bi&&isArguments$3(yi),$i=!bi&&!_i&&isBuffer$3(yi),Pi=!bi&&!_i&&!$i&&isTypedArray$3(yi),Ai=bi||_i||$i||Pi,Si=Ai?baseTimes(yi.length,String):[],Ei=Si.length;for(var wi in yi)(vi||hasOwnProperty$8.call(yi,wi))&&!(Ai&&(wi=="length"||$i&&(wi=="offset"||wi=="parent")||Pi&&(wi=="buffer"||wi=="byteLength"||wi=="byteOffset")||isIndex$3(wi,Ei)))&&Si.push(wi);return Si}var _arrayLikeKeys=arrayLikeKeys$2,objectProto$8=Object.prototype;function isPrototype$4(yi){var vi=yi&&yi.constructor,bi=typeof vi=="function"&&vi.prototype||objectProto$8;return yi===bi}var _isPrototype=isPrototype$4;function overArg$2(yi,vi){return function(bi){return yi(vi(bi))}}var _overArg=overArg$2,overArg$1=_overArg,nativeKeys$1=overArg$1(Object.keys,Object),_nativeKeys=nativeKeys$1,isPrototype$3=_isPrototype,nativeKeys=_nativeKeys,objectProto$7=Object.prototype,hasOwnProperty$7=objectProto$7.hasOwnProperty;function baseKeys$2(yi){if(!isPrototype$3(yi))return nativeKeys(yi);var vi=[];for(var bi in Object(yi))hasOwnProperty$7.call(yi,bi)&&bi!="constructor"&&vi.push(bi);return vi}var _baseKeys=baseKeys$2,isFunction$1=isFunction_1,isLength$1=isLength_1;function isArrayLike$7(yi){return yi!=null&&isLength$1(yi.length)&&!isFunction$1(yi)}var isArrayLike_1=isArrayLike$7,arrayLikeKeys$1=_arrayLikeKeys,baseKeys$1=_baseKeys,isArrayLike$6=isArrayLike_1;function keys$3(yi){return isArrayLike$6(yi)?arrayLikeKeys$1(yi):baseKeys$1(yi)}var keys_1=keys$3,baseGetAllKeys=_baseGetAllKeys,getSymbols=_getSymbols,keys$2=keys_1;function getAllKeys$1(yi){return baseGetAllKeys(yi,keys$2,getSymbols)}var _getAllKeys=getAllKeys$1,getAllKeys=_getAllKeys,COMPARE_PARTIAL_FLAG$3=1,objectProto$6=Object.prototype,hasOwnProperty$6=objectProto$6.hasOwnProperty;function equalObjects$1(yi,vi,bi,_i,$i,Pi){var Ai=bi&COMPARE_PARTIAL_FLAG$3,Si=getAllKeys(yi),Ei=Si.length,wi=getAllKeys(vi),Ci=wi.length;if(Ei!=Ci&&!Ai)return!1;for(var ki=Ei;ki--;){var xi=Si[ki];if(!(Ai?xi in vi:hasOwnProperty$6.call(vi,xi)))return!1}var Ti=Pi.get(yi),Oi=Pi.get(vi);if(Ti&&Oi)return Ti==vi&&Oi==yi;var ji=!0;Pi.set(yi,vi),Pi.set(vi,yi);for(var Li=Ai;++kivi||Pi&&Ai&&Ei&&!Si&&!wi||_i&&Ai&&Ei||!bi&&Ei||!$i)return 1;if(!_i&&!Pi&&!wi&&yi=Si)return Ei;var wi=bi[_i];return Ei*(wi=="desc"?-1:1)}}return yi.index-vi.index}var _compareMultiple=compareMultiple$1,arrayMap=_arrayMap,baseGet$1=_baseGet,baseIteratee$2=_baseIteratee,baseMap=_baseMap,baseSortBy=_baseSortBy,baseUnary=_baseUnary,compareMultiple=_compareMultiple,identity$2=identity_1,isArray$5=isArray_1;function baseOrderBy$1(yi,vi,bi){vi.length?vi=arrayMap(vi,function(Pi){return isArray$5(Pi)?function(Ai){return baseGet$1(Ai,Pi.length===1?Pi[0]:Pi)}:Pi}):vi=[identity$2];var _i=-1;vi=arrayMap(vi,baseUnary(baseIteratee$2));var $i=baseMap(yi,function(Pi,Ai,Si){var Ei=arrayMap(vi,function(wi){return wi(Pi)});return{criteria:Ei,index:++_i,value:Pi}});return baseSortBy($i,function(Pi,Ai){return compareMultiple(Pi,Ai,bi)})}var _baseOrderBy=baseOrderBy$1;function apply$3(yi,vi,bi){switch(bi.length){case 0:return yi.call(vi);case 1:return yi.call(vi,bi[0]);case 2:return yi.call(vi,bi[0],bi[1]);case 3:return yi.call(vi,bi[0],bi[1],bi[2])}return yi.apply(vi,bi)}var _apply=apply$3,apply$2=_apply,nativeMax$1=Math.max;function overRest$2(yi,vi,bi){return vi=nativeMax$1(vi===void 0?yi.length-1:vi,0),function(){for(var _i=arguments,$i=-1,Pi=nativeMax$1(_i.length-vi,0),Ai=Array(Pi);++$i0){if(++vi>=HOT_COUNT)return arguments[0]}else vi=0;return yi.apply(void 0,arguments)}}var _shortOut=shortOut$1,baseSetToString=_baseSetToString,shortOut=_shortOut,setToString$2=shortOut(baseSetToString),_setToString=setToString$2,identity=identity_1,overRest$1=_overRest,setToString$1=_setToString;function baseRest$3(yi,vi){return setToString$1(overRest$1(yi,vi,identity),yi+"")}var _baseRest=baseRest$3,eq$2=eq_1,isArrayLike$3=isArrayLike_1,isIndex$1=_isIndex,isObject$8=isObject_1;function isIterateeCall$2(yi,vi,bi){if(!isObject$8(bi))return!1;var _i=typeof vi;return(_i=="number"?isArrayLike$3(bi)&&isIndex$1(vi,bi.length):_i=="string"&&vi in bi)?eq$2(bi[vi],yi):!1}var _isIterateeCall=isIterateeCall$2,baseFlatten$2=_baseFlatten,baseOrderBy=_baseOrderBy,baseRest$2=_baseRest,isIterateeCall$1=_isIterateeCall,sortBy=baseRest$2(function(yi,vi){if(yi==null)return[];var bi=vi.length;return bi>1&&isIterateeCall$1(yi,vi[0],vi[1])?vi=[]:bi>2&&isIterateeCall$1(vi[0],vi[1],vi[2])&&(vi=[vi[0]]),baseOrderBy(yi,baseFlatten$2(vi,1),[])}),sortBy_1=sortBy;function isNil(yi){return yi==null}var isNil_1=isNil;new TextDecoder("utf-16");function M$l(yi,vi="auto"){const bi=document.createElement("div"),_i=` `;return bi.innerHTML=_i,bi.firstElementChild}function j$g(yi){const vi=yi.slice(),bi=[];vi.sort(($i,Pi)=>$i[0]-Pi[0]);let _i=vi[0].slice();for(let $i=1;$i=Pi[0]?_i[1]=Math.max(Pi[1],_i[1]):(bi.push(_i),_i=Pi)}return bi.push(_i),bi}function P$r(yi){return new Worker(yi)}function S$r(yi){const vi="application/l10n",bi=document.querySelector(`link[type="${vi}"]`);if((bi==null?void 0:bi.href)===yi)return;const _i=document.createElement("link");_i.rel="resource",_i.type=vi,_i.href=yi,document.head.appendChild(_i)}function D$q(yi,vi){return new URL(`${yi}?version=0.8.67`,vi).href}function W$n(yi,vi,bi,_i){return Math.sqrt((yi-bi)**2+(vi-_i)**2)}function x$m(yi){return yi&&yi.type==="TABLE_CELL"}function y$s(yi,vi,bi=.7,_i=.4){const $i=Math.max(yi[0],vi[0]),Pi=Math.max(yi[1],vi[1]),Ai=Math.min(yi[2],vi[2]),Si=Math.min(yi[3],vi[3]);if($i>=Ai||Pi>=Si)return!1;const Ei=yi[2]-yi[0],wi=yi[3]-yi[1],Ci=Ai-$i,ki=Si-Pi,xi=Ci/Ei,Ti=ki/wi;return xi>bi&&Ti>_i}function I$o(yi,vi){return y$s(yi,vi,.7,.4)}function z$g(yi,vi){const bi=x$m(vi)&&vi.rowOutline||vi.outline;return I$o(yi,bi)}function F$l(yi){const vi=yi.grid.columns.length;return`${yi.grid.rows.length}_${vi}`}function R$m({outline:yi,rows:vi}){const bi=[];return vi.length===0?[[yi[0],yi[1],yi[2],yi[3]]]:(vi.forEach((_i,$i)=>{const Pi=vi[$i-1]||0,Ai=yi[0],Si=yi[2],Ei=yi[1]+Pi,wi=yi[1]+_i;bi.push([Ai,Ei,Si,wi])}),bi.push([yi[0],yi[1]+vi.at(-1),yi[2],yi[3]]),bi)}function m$w(yi,vi,bi,_i){var $i;if(_i){var Pi;return(Pi=vi.cells[yi])===null||Pi===void 0?void 0:Pi.text}return($i=bi[yi])===null||$i===void 0?void 0:$i.text}function X$h(yi,vi,bi,_i){const $i=[],Pi=sortBy_1(yi,({cell:wi})=>Number(wi.split("_")[0])),Ai=Number(Pi[0].cell.split("_")[0]),Si=Number(Pi.at(-1).cell.split("_")[0]),Ei=vi.grid.columns.length;for(let wi=Ai;wi<=Si;wi+=1){const Ci=[];for(let ki=0;ki<=Ei;ki+=1){let xi=`${wi}_${ki}`,Ti=m$w(xi,vi,bi,_i);if(Ti!==void 0)Ci.push({text:Ti,col:ki});else{const Oi=vi.merged.find(ji=>ji.find(Li=>Li[0]===wi&&Li[1]===ki));Oi?(xi=`${Oi[0][0]}_${Oi[0][1]}`,Ti=m$w(xi,vi,bi,_i),Ci.push({text:Ti,col:ki})):Ci.push({text:"",col:ki})}}$i.push({row:wi,cols:Ci})}return $i}function J$i(yi){return yi.map(vi=>{if(x$m(vi)){const bi=R$m({outline:vi.table.outline,rows:vi.table.grid.rows});return{...vi,rowOutline:bi[vi.row]}}return vi})}function _$p(yi){return Number(yi.split("_")[0])}function C$p(yi,vi){const bi=[...yi[0].rows],_i=vi==null?void 0:vi.table.page_merged_table.cells_idx;return yi.forEach(($i,Pi)=>{if(Pi>0)if(!_i)bi.push(...$i.rows);else{const Ai=Object.entries(_i[$i.index]),Si=Object.entries(_i[yi[Pi-1].index]),Ei=_$p(Ai[0][0]),wi=_$p(Si.at(-1)[0]);Ei===wi?(bi.at(-1).cols.forEach((Ci,ki)=>{Ci.text=`${Ci.text} ${$i.rows[0].cols[ki].text}`}),bi.push(...$i.rows.slice(1))):bi.push(...$i.rows)}}),bi}function Q$e(yi,vi){const bi=[];return yi.forEach(_i=>{var $i,Pi;if(($i=_i.type)!==null&&$i!==void 0&&$i.startsWith("PARAGRAPH")){const Ai=bi.findIndex(Si=>{var Ei;return(Ei=Si.page_merged_paragraph)===null||Ei===void 0||(Ei=Ei.paragraph_indices)===null||Ei===void 0?void 0:Ei.includes(_i.index)});Ai!==-1?bi[Ai].selectedText=`${bi[Ai].selectedText} ${_i.selectedText}`:bi.push(_i)}else if(isNil_1((Pi=_i.table)===null||Pi===void 0?void 0:Pi.page_merged_table))bi.push(_i);else{const Ai=_i.table.page_merged_table;let Si=[],Ei=_i;if(typeof Ai=="object"){const Ci=Object.keys(Ai.cells_idx).map(Number);Si=yi.filter(ki=>Ci.includes(ki.index))}else Si=yi.filter(Ci=>{var ki;return((ki=Ci.table)===null||ki===void 0?void 0:ki.page_merged_table)===Ai}),Ei=vi.find(Ci=>Ci.index===Ai);const wi=Si.map(Ci=>Ci.index);if(!bi.find(Ci=>{var ki;return(ki=Ci.mergedTableIndexs)===null||ki===void 0?void 0:ki.includes(_i.index)})){const Ci=C$p(Si,Ei);bi.push({..._i,rows:Ci,mergedTableIndexs:wi})}}}),bi}const E$q=async(yi,vi)=>{if(yi.page_merged_table){var bi;if(typeof yi.page_merged_table=="object")return Object.keys(yi.page_merged_table.cells_idx).map(Number);let $i=await vi(yi.page),Pi=(bi=$i.find(Ai=>x$m(Ai)&&Ai.table.index===yi.page_merged_table))===null||bi===void 0?void 0:bi.table;if(!Pi){var _i;$i=await vi(yi.page-1),Pi=(_i=$i.find(Ai=>x$m(Ai)&&(Ai.table.index===yi.page_merged_table||Ai.table.page_merged_table===yi.page_merged_table)))===null||_i===void 0?void 0:_i.table}if(Pi)return E$q(Pi,vi)}return[yi.index]};var E$p=(yi=>(yi[yi.Text=1]="Text",yi[yi.Link=2]="Link",yi[yi.Line=4]="Line",yi[yi.Square=5]="Square",yi[yi.Polygon=7]="Polygon",yi[yi.PolyLine=8]="PolyLine",yi[yi.Highlight=9]="Highlight",yi[yi.Underline=10]="Underline",yi[yi.StrikeOut=12]="StrikeOut",yi[yi.Stamp=13]="Stamp",yi[yi.Ink=15]="Ink",yi[yi.Popup=16]="Popup",yi[yi.Table=27]="Table",yi[yi.SelectText=28]="SelectText",yi[yi.Null=29]="Null",yi[yi.TextDiff=101]="TextDiff",yi))(E$p||{});const s$f={PDF_VIEWER_EDIT_TEXT_RECT:"pdf-viewer-edit-text-rect"},_$o={PDF_VIEWER_EDIT_TEXT_RECT_ID:`${s$f.PDF_VIEWER_EDIT_TEXT_RECT}-ui-manager`},N$k="pdf-document-viewer",T$m=[{customClass:"resize-point-bc",position:[.5,1]},{customClass:"resize-point-rc",position:[1,.5]},{customClass:"resize-point-br",position:[1,1]},{customClass:"resize-point-tc",position:[.5,0]},{customClass:"resize-point-rt",position:[1,0]},{customClass:"resize-point-lb",position:[0,1]},{customClass:"resize-point-lc",position:[0,.5]},{customClass:"resize-point-lt",position:[0,0]}];var c$q=(yi=>(yi[yi.S=1]="S",yi[yi.D=2]="D",yi[yi.B=3]="B",yi[yi.I=4]="I",yi[yi.U=5]="U",yi))(c$q||{});const D$p=[27],O$t=[28,101],p$j=20,C$o={TABLE_CELL:"TABLE_CELL"},S$q="disable-drawing",d$h="disable-destroy-selection",i$c="annot-updated",R$l="annot-removed",P$q="annot-focus",g$m="blur",u$i="annot-created",m$v="resize-end",n$9="move-end",A$r="vertex-changed",a$i="show-ctrl",G$d="show-widget-toolbar",U$h="hide-ctrl",W$m="hide-widget-toolbar",b$l="annot-destroyed",w$s="outline-change",H$g="change-custom-type",h$i="annot-mousedown",V$k="annot-rendered",X$g="selection-changed",f$k="widget-destroyed",v$p="annot-table-cell-active",F$k="annot-table-span-cell",k$o="annot-table-split-cell",B$f="annot-table-line-changed",Z$d="text-selected",q$e="text-copied",K$a=15,j$f="widget-polygon-vertex-changed",$$h="widget-polyline-vertex-changed",J$h="widget-created",Q$d="widget-drawing-end",y$r="update-widget-toolbar",ee$5="across-page-widgets-drawing-end",te$5=Object.freeze([72,145,243]);var o$d=(yi=>(yi.SelectElement="SelectElement",yi.SelectWord="SelectWord",yi.SelectTable="SelectTable",yi.SelectCell="SelectCell",yi))(o$d||{});function M$k(yi,...vi){const bi=document.createElementNS("http://www.w3.org/2000/svg",yi);return bi.classList.add(...vi),bi}const xt$4=yi=>{const vi=T$l(yi),bi=document.createDocumentFragment();return yi.forEach(_i=>{const $i=M$k("rect","text-box");$i.setAttribute("width",_i[2]-_i[0]),$i.setAttribute("height",_i[3]-_i[1]),$i.setAttribute("x",_i[0]-vi[0]),$i.setAttribute("y",_i[1]-vi[1]),bi.appendChild($i)}),bi};function dt$6(){const yi=document.createElementNS("http://www.w3.org/2000/svg","svg");return yi.setAttribute("xmlns","http://www.w3.org/2000/svg"),yi.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),yi}function yt$3(yi,vi=0){return yi.map(bi=>{const _i=M$k("circle","resize-point",bi.customClass),$i=Math.max(vi+3,5);return _i.setAttribute("r",String($i)),_i.dataset.position=`${bi.position[0]},${bi.position[1]}`,_i.setAttribute(`data-${S$q}`,"true"),_i})}function mt$5(yi){return yi/PixelsPerInch.PDF_TO_CSS_UNITS}function ht$7(yi){return yi*PixelsPerInch.PDF_TO_CSS_UNITS}function gt$6(yi,vi,bi,_i){if(_i%360===0)return yi;const $i=Math.sign(_i),Pi=Math.abs(_i/90),Ai=Si=>Si.map(([Ei,wi])=>($i===1?Ei=vi-1-Ei:wi=bi-1-wi,[wi,Ei]));for(let Si=0;Si$i==="H"?vi-Ei:yi-Ei;for(let Ei=0;Eiyi>=360?yi%360:yi;function Mt$2({width:yi,height:vi,rotation:bi},_i){if(bi%360===0)return _i;bi=X$f(bi);const $i=Math.sign(bi),Pi=90*(Math.PI/180)*$i,Ai=Math.cos(Pi),Si=Math.sin(Pi),Ei=Math.abs(bi/90);(bi===-90||bi===-270)&&([yi,vi]=[vi,yi]);const wi=([Ci,ki],xi)=>{const Ti=Ci*Ai-ki*Si,Oi=ki*Ai+Ci*Si;return[Ti-xi,Oi+xi]};for(let Ci=0;Ci{const ji=Ci*Ai-ki*Si,Li=ki*Ai+Ci*Si,Ii=xi*Ai-Ti*Si,Mi=Ti*Ai+xi*Si;return $i===1?[Ii-Oi,Li+Oi,ji-Oi,Mi+Oi]:[ji-Oi,Mi+Oi,Ii-Oi,Li+Oi]};for(let Ci=0;Ci0?Ei=`-${String(Si/60).padStart(2,"0")}`:Ei=`+${String(-Si/60).padStart(2,"0")}`,`D:${vi}${bi}${_i}${$i}${Pi}${Ai}${Ei}'00'`}function V$j(yi=[],vi){const bi=[];return yi.forEach(_i=>{_i.forEach(({x:$i,y:Pi})=>{const[,Ai,,Si]=vi;bi.push({_type:2,data:$i},{_type:2,data:Si-Pi})})}),bi.length?bi:void 0}function B$e(yi,vi){const[bi,_i,$i,Pi]=yi,[,Ai,,Si]=vi;return[{data:bi,_type:2},{data:Si-_i,_type:2},{data:$i,_type:2},{data:Si-Pi,_type:2}]}function j$e(yi,vi){const[,bi,,_i]=vi;return yi.map($i=>{const Pi={data:[],_type:5};return $i.forEach(({x:Ai,y:Si})=>{Pi.data.push({_type:2,data:Ai}),Pi.data.push({_type:2,data:_i-Si})}),Pi})}function F$j(yi,vi){const[,bi,,_i]=vi;return yi.flat().map(($i,Pi)=>Pi%2!==0?{_type:2,data:_i-$i}:{_type:2,data:$i})}const U$g=yi=>{Object.keys(yi).forEach(vi=>{var bi;(bi=yi[vi])!==null&&bi!==void 0||Reflect.deleteProperty(yi,vi)})};function St$4({objects:yi},vi){const bi={};return Object.keys(yi).forEach(_i=>{if(_i.startsWith("page"))bi[_i]=yi[_i];else{var $i,Pi,Ai,Si,Ei;const wi=typeof yi[_i]=="string"?JSON.parse(yi[_i]):yi[_i],{borderStyle:Ci,pageNumber:ki}=wi,xi=vi[ki-1];bi[wi.id]={generationID:0,Type:{_type:4,data:"Annot"},ID:wi.id,Rect:{_type:5,data:H$f(wi.rect,xi).map(Ti=>({_type:2,data:Ti}))},Subtype:{_type:4,data:wi.subtype},F:{_type:2,data:($i=wi.annotationFlags)!==null&&$i!==void 0?$i:0},M:{_type:3,data:wi.modificationDate?I$n(new Date(wi.modificationDate)):""},CreationDate:{_type:3,data:wi.creationDate?I$n(new Date(wi.creationDate)):""},T:{_type:3,data:wi.titleObj.str},Contents:{_type:3,data:wi.contentsObj.str},Popup:wi.popupId?{_type:9,data:{ref_id:wi.popupId}}:null,BS:{_type:6,data:{W:{_type:2,data:(Pi=Ci==null?void 0:Ci.width)!==null&&Pi!==void 0?Pi:1},D:{_type:5,data:(Ai=Ci==null?void 0:Ci.dashArray.map(Ti=>({_type:2,data:Ti})))!==null&&Ai!==void 0?Ai:[]},S:{_type:4,data:c$q[(Si=Ci==null?void 0:Ci.style)!==null&&Si!==void 0?Si:1]}}},Parent:wi.parentId?{_type:9,data:{ref_id:wi.parentId}}:null,IRT:wi.inReplyTo?{_type:9,data:{ref_id:wi.inReplyTo}}:null,RT:wi.inReplyTo?{_type:4,data:wi.replyType}:null,Name:{_type:4,data:(Ei=wi.name)!==null&&Ei!==void 0?Ei:""},Subj:wi.subj?{_type:3,data:wi.subj}:null,C:{_type:5,data:(wi.color||te$5).map(Ti=>({_type:2,data:Ti/255}))},QuadPoints:wi.quadPoints?{_type:5,data:V$j(wi.quadPoints,xi)}:null,L:wi.lineCoordinates?{_type:5,data:B$e(wi.lineCoordinates,xi)}:null,InkList:wi.inkLists?{_type:5,data:j$e(JSON.parse(wi.inkLists),xi)}:null,LE:wi.lineEndpoints?{_type:5,data:wi.lineEndpoints.map(Ti=>({_type:4,data:Ti}))}:null,Vertices:wi.vertices?{_type:5,data:F$j(wi.vertices,xi)}:null,AP:wi.AP,CA:wi.CA,RC:wi.RC,HideInf:wi.HideInf,NM:wi.NM,P:wi.P,HighDpi:wi.HighDpi},U$g(bi[_i])}}),{objects:bi}}function k$n(yi){return D$p.includes(yi)}function Pt$3(yi){const vi=P$p();return k$n(yi)?`pai_${vi}`:`ann_${vi}`}function It$3(yi=""){const vi=P$p();return yi?`${yi}_${vi}`:vi}function Lt$2(yi){if(yi)if(navigator.clipboard){const vi=new Blob([yi],{type:"text/plain"});navigator.clipboard.write([new ClipboardItem({[vi.type]:vi})]).then(()=>{},bi=>{console.error(bi)})}else{const vi=document.createRange();window.getSelection().removeAllRanges();const bi=document.createElement("pre");bi.innerText=yi,document.body.appendChild(bi),vi.selectNode(bi),window.getSelection().addRange(vi),document.execCommand("copy"),window.getSelection().removeAllRanges(),bi.remove()}}function D$o(yi){const[,vi,,bi]=yi,_i=bi-vi;return[_i,Math.max(6,_i*.382)]}function Ct$2(yi,vi,bi){var _i;(_i=bi)!==null&&_i!==void 0||(bi=M$k("line","text-cursor"));const[$i,Pi,Ai,Si]=vi,[Ei]=D$o(vi);let wi,Ci;const ki=Pi,xi=Pi+Ei;return yi==="start"?(wi=$i,Ci=$i):yi==="end"&&(wi=Ai,Ci=Ai),bi.setAttribute("x1",wi),bi.setAttribute("y1",ki),bi.setAttribute("x2",Ci),bi.setAttribute("y2",xi),bi.dataset.pos=yi,bi}function Tt$3(yi){return yi&&!Array.isArray(yi[0])?yi.map(({key:vi,value:bi})=>[vi,bi]):yi}const R$k=(yi,vi,bi=3)=>{const[,_i,,$i]=yi,[Pi,Ai,,Si]=vi;return Math.abs(Si-$i)<=bi&&Math.abs(Ai-_i)<=bi},q$d=(yi,vi=3,bi=_i=>_i)=>{const{lines:_i}=yi.reduce((Pi,Ai)=>(Pi.prevItem&&!R$k(Pi.prevItem,Ai,vi)&&(Pi.lineNumber+=1),Pi.prevItem=Ai,Pi.lines[Pi.lineNumber]||(Pi.lines[Pi.lineNumber]=[]),Pi.lines[Pi.lineNumber].push(Ai),Pi),{lineNumber:0,lines:[],prevItem:null}),$i=[];return _i.forEach(Pi=>{const Ai=Math.min(...Pi.map(Ei=>Ei[1])),Si=Math.max(...Pi.map(Ei=>Ei[3]));Pi=bi(Pi),Pi.forEach(Ei=>{$i.push([Ei[0],Ai,Ei[2],Si])})}),$i},Xt$2=(yi,vi,bi=1)=>{const[_i,$i]=yi;return vi.some(Pi=>{const[Ai,Si,Ei,wi]=Pi;return _i>=Ai-bi&&_i<=Ei+bi&&$i>=Si-bi&&$i<=wi+bi})},tt$a=yi=>{let[vi,bi,_i,$i]=yi;return vi>_i&&([vi,_i]=[_i,vi]),bi>$i&&([bi,$i]=[$i,bi]),[vi,bi,_i,$i]},T$l=yi=>{if(!yi.length)return[0,0,0,0];const[vi,bi,_i,$i]=[[],[],[],[]];yi.forEach(wi=>{const[Ci,ki,xi,Ti]=tt$a(wi);vi.push(Ci),bi.push(ki),_i.push(xi),$i.push(Ti)});const Pi=Math.min(...vi),Ai=Math.min(...bi),Si=Math.max(..._i),Ei=Math.max(...$i);return[Pi,Ai,Si,Ei]},Vt$2=(yi,vi)=>{const[bi,_i,$i,Pi]=yi,[Ai,Si]=vi;return Ai>=bi&&Si>=_i&&Ai<=$i&&Si<=Pi},Bt$2=(yi,vi)=>{const[bi,_i,$i,Pi]=yi,[Ai,Si,Ei,wi]=vi;return!($i<=Ai||bi>=Ei||_i>=wi||Pi<=Si)},et$a=(yi,vi,bi=7,_i=3)=>{const[,,$i]=yi,[Pi]=vi,Ai=Math.abs(Pi-$i)<=bi;return R$k(yi,vi,_i)&&Ai},jt$2=(yi,vi=7,bi=3,_i=1.9)=>{let $i=[];const Pi=new Set;for(let Ai=0;AiAi[2]-Ai[0]>=_i),$i},Ft$2=yi=>{const vi=yi.map(([Si])=>Si).flat(),bi=yi.map(([,Si])=>Si).flat(),_i=Math.min(...vi),$i=Math.min(...bi),Pi=Math.max(...vi),Ai=Math.max(...bi);return[_i,$i,Pi,Ai]},Ut$2=yi=>{const{x:vi,y:bi}=yi[0],_i=[`M${vi} ${bi}`];for(let $i=1;$i(()=>{var __webpack_modules__=[,(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.VerbosityLevel=vi.Util=vi.UnknownErrorException=vi.UnexpectedResponseException=vi.UNSUPPORTED_FEATURES=vi.TextRenderingMode=vi.StreamType=vi.RenderingIntentFlag=vi.PermissionFlag=vi.PasswordResponses=vi.PasswordException=vi.PageActionEventType=vi.OPS=vi.MissingPDFException=vi.IsLittleEndianCached=vi.IsEvalSupportedCached=vi.InvalidPDFException=vi.ImageKind=vi.IDENTITY_MATRIX=vi.FormatError=vi.FontType=vi.FONT_IDENTITY_MATRIX=vi.DocumentActionEventType=vi.CMapCompressionType=vi.BaseException=vi.AnnotationType=vi.AnnotationStateModelType=vi.AnnotationReviewState=vi.AnnotationReplyType=vi.AnnotationMode=vi.AnnotationMarkedState=vi.AnnotationFlag=vi.AnnotationFieldFlag=vi.AnnotationBorderStyleType=vi.AnnotationActionEventType=vi.AbortException=void 0,vi.addParamsToUrl=function(Ii,Mi){const Fi=new URL(Ii);return Object.keys(Mi).forEach(Bi=>Fi.searchParams.append(Bi,Mi[Bi])),Fi.toString()},vi.arrayByteLength=Ci,vi.arraysToBytes=function(Ii){const Mi=Ii.length;if(Mi===1&&Ii[0]instanceof Uint8Array)return Ii[0];let Fi=0;for(let Vi=0;ViMi}),Ii.promise=new Promise(function(Fi,Bi){Ii.resolve=function(Ri){Mi=!0,Fi(Ri)},Ii.reject=function(Ri){Mi=!0,Bi(Ri)}}),Ii},vi.createValidAbsoluteUrl=function(Ii,Mi=null,Fi=null){if(!Ii)return null;try{if(Fi&&typeof Ii=="string"){if(Fi.addDefaultProtocol&&Ii.startsWith("www.")){const Ri=Ii.match(/\./g);Ri&&Ri.length>=2&&(Ii=`http://${Ii}`)}if(Fi.tryConvertEncoding)try{Ii=Li(Ii)}catch{}}const Bi=Mi?new URL(Ii,Mi):new URL(Ii);if(function(Ri){if(!Ri)return!1;switch(Ri.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(Bi))return Bi}catch{}return null},vi.escapeString=function(Ii){return Ii.replace(/([()\\\n\r])/g,Mi=>Mi===` `?"\\n":Mi==="\r"?"\\r":`\\${Mi}`)},vi.getModificationDate=function(Ii=new Date){return[Ii.getUTCFullYear().toString(),(Ii.getUTCMonth()+1).toString().padStart(2,"0"),Ii.getUTCDate().toString().padStart(2,"0"),Ii.getUTCHours().toString().padStart(2,"0"),Ii.getUTCMinutes().toString().padStart(2,"0"),Ii.getUTCSeconds().toString().padStart(2,"0")].join("")},vi.getVerbosityLevel=function(){return $i},vi.info=function(Ii){},vi.isArrayBuffer=function(Ii){return typeof Ii=="object"&&Ii!==null&&Ii.byteLength!==void 0},vi.isArrayEqual=function(Ii,Mi){if(Ii.length!==Mi.length)return!1;for(let Fi=0,Bi=Ii.length;Fi>24&255,Ii>>16&255,Ii>>8&255,255&Ii)},vi.stringToBytes=wi,vi.stringToPDFString=function(Ii){if(Ii[0]>="ï"){let Fi;if(Ii[0]==="þ"&&Ii[1]==="ÿ"?Fi="utf-16be":Ii[0]==="ÿ"&&Ii[1]==="þ"?Fi="utf-16le":Ii[0]==="ï"&&Ii[1]==="»"&&Ii[2]==="¿"&&(Fi="utf-8"),Fi)try{const Bi=new TextDecoder(Fi,{fatal:!0}),Ri=wi(Ii);return Bi.decode(Ri)}catch{}}const Mi=[];for(let Fi=0,Bi=Ii.length;Fi>8&255),String.fromCharCode(255&Ri))}return Mi.join("")},vi.stringToUTF8String=Li,vi.unreachable=Ai,vi.utf8StringToString=function(Ii){return unescape(encodeURIComponent(Ii))},vi.warn=Pi,bi(2),vi.IDENTITY_MATRIX=[1,0,0,1,0,0],vi.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],vi.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},vi.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},vi.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},vi.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},vi.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},vi.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},vi.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"},vi.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"},vi.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"},vi.AnnotationReplyType={GROUP:"Group",REPLY:"R"},vi.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},vi.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},vi.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},vi.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},vi.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},vi.PageActionEventType={O:"PageOpen",C:"PageClose"},vi.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"},vi.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const _i={ERRORS:0,WARNINGS:1,INFOS:5};vi.VerbosityLevel=_i,vi.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},vi.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},vi.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"},vi.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let $i=_i.WARNINGS;function Pi(Ii){}function Ai(Ii){throw new Error(Ii)}function Si(Ii,Mi,Fi){return Object.defineProperty(Ii,Mi,{value:Fi,enumerable:!0,configurable:!0,writable:!1}),Fi}const Ei=function(){function Ii(Mi,Fi){this.constructor===Ii&&Ai("Cannot initialize BaseException."),this.message=Mi,this.name=Fi}return Ii.prototype=new Error,Ii.constructor=Ii,Ii}();vi.BaseException=Ei,vi.PasswordException=class extends Ei{constructor(Ii,Mi){super(Ii,"PasswordException"),this.code=Mi}},vi.UnknownErrorException=class extends Ei{constructor(Ii,Mi){super(Ii,"UnknownErrorException"),this.details=Mi}},vi.InvalidPDFException=class extends Ei{constructor(Ii){super(Ii,"InvalidPDFException")}},vi.MissingPDFException=class extends Ei{constructor(Ii){super(Ii,"MissingPDFException")}},vi.UnexpectedResponseException=class extends Ei{constructor(Ii,Mi){super(Ii,"UnexpectedResponseException"),this.status=Mi}},vi.FormatError=class extends Ei{constructor(Ii){super(Ii,"FormatError")}},vi.AbortException=class extends Ei{constructor(Ii){super(Ii,"AbortException")}};function wi(Ii){typeof Ii!="string"&&Ai("Invalid argument for stringToBytes");const Mi=Ii.length,Fi=new Uint8Array(Mi);for(let Bi=0;BiIi.toString(16).padStart(2,"0"));class Oi{static makeHexColor(Mi,Fi,Bi){return`#${Ti[Mi]}${Ti[Fi]}${Ti[Bi]}`}static transform(Mi,Fi){return[Mi[0]*Fi[0]+Mi[2]*Fi[1],Mi[1]*Fi[0]+Mi[3]*Fi[1],Mi[0]*Fi[2]+Mi[2]*Fi[3],Mi[1]*Fi[2]+Mi[3]*Fi[3],Mi[0]*Fi[4]+Mi[2]*Fi[5]+Mi[4],Mi[1]*Fi[4]+Mi[3]*Fi[5]+Mi[5]]}static applyTransform(Mi,Fi){return[Mi[0]*Fi[0]+Mi[1]*Fi[2]+Fi[4],Mi[0]*Fi[1]+Mi[1]*Fi[3]+Fi[5]]}static applyInverseTransform(Mi,Fi){const Bi=Fi[0]*Fi[3]-Fi[1]*Fi[2];return[(Mi[0]*Fi[3]-Mi[1]*Fi[2]+Fi[2]*Fi[5]-Fi[4]*Fi[3])/Bi,(-Mi[0]*Fi[1]+Mi[1]*Fi[0]+Fi[4]*Fi[1]-Fi[5]*Fi[0])/Bi]}static getAxialAlignedBoundingBox(Mi,Fi){const Bi=Oi.applyTransform(Mi,Fi),Ri=Oi.applyTransform(Mi.slice(2,4),Fi),Vi=Oi.applyTransform([Mi[0],Mi[3]],Fi),Ni=Oi.applyTransform([Mi[2],Mi[1]],Fi);return[Math.min(Bi[0],Ri[0],Vi[0],Ni[0]),Math.min(Bi[1],Ri[1],Vi[1],Ni[1]),Math.max(Bi[0],Ri[0],Vi[0],Ni[0]),Math.max(Bi[1],Ri[1],Vi[1],Ni[1])]}static inverseTransform(Mi){const Fi=Mi[0]*Mi[3]-Mi[1]*Mi[2];return[Mi[3]/Fi,-Mi[1]/Fi,-Mi[2]/Fi,Mi[0]/Fi,(Mi[2]*Mi[5]-Mi[4]*Mi[3])/Fi,(Mi[4]*Mi[1]-Mi[5]*Mi[0])/Fi]}static apply3dTransform(Mi,Fi){return[Mi[0]*Fi[0]+Mi[1]*Fi[1]+Mi[2]*Fi[2],Mi[3]*Fi[0]+Mi[4]*Fi[1]+Mi[5]*Fi[2],Mi[6]*Fi[0]+Mi[7]*Fi[1]+Mi[8]*Fi[2]]}static singularValueDecompose2dScale(Mi){const Fi=[Mi[0],Mi[2],Mi[1],Mi[3]],Bi=Mi[0]*Fi[0]+Mi[1]*Fi[2],Ri=Mi[0]*Fi[1]+Mi[1]*Fi[3],Vi=Mi[2]*Fi[0]+Mi[3]*Fi[2],Ni=Mi[2]*Fi[1]+Mi[3]*Fi[3],Wi=(Bi+Ni)/2,zi=Math.sqrt((Bi+Ni)**2-4*(Bi*Ni-Vi*Ri))/2,Di=Wi+zi||1,Ui=Wi-zi||1;return[Math.sqrt(Di),Math.sqrt(Ui)]}static normalizeRect(Mi){const Fi=Mi.slice(0);return Mi[0]>Mi[2]&&(Fi[0]=Mi[2],Fi[2]=Mi[0]),Mi[1]>Mi[3]&&(Fi[1]=Mi[3],Fi[3]=Mi[1]),Fi}static intersect(Mi,Fi){function Bi(Wi,zi){return Wi-zi}const Ri=[Mi[0],Mi[2],Fi[0],Fi[2]].sort(Bi),Vi=[Mi[1],Mi[3],Fi[1],Fi[3]].sort(Bi),Ni=[];return Mi=Oi.normalizeRect(Mi),Fi=Oi.normalizeRect(Fi),!(Ri[0]===Mi[0]&&Ri[1]===Fi[0]||Ri[0]===Fi[0]&&Ri[1]===Mi[0])||(Ni[0]=Ri[1],Ni[2]=Ri[2],!(Vi[0]===Mi[1]&&Vi[1]===Fi[1]||Vi[0]===Fi[1]&&Vi[1]===Mi[1]))?null:(Ni[1]=Vi[1],Ni[3]=Vi[2],Ni)}static bezierBoundingBox(Mi,Fi,Bi,Ri,Vi,Ni,Wi,zi){const Di=[],Ui=[[],[]];let Hi,qi,Gi,Ki,Qi,Xi,rr,ar;for(let mr=0;mr<2;++mr)if(mr===0?(qi=6*Mi-12*Bi+6*Vi,Hi=-3*Mi+9*Bi-9*Vi+3*Wi,Gi=3*Bi-3*Mi):(qi=6*Fi-12*Ri+6*Ni,Hi=-3*Fi+9*Ri-9*Ni+3*zi,Gi=3*Ri-3*Fi),Math.abs(Hi)<1e-12){if(Math.abs(qi)<1e-12)continue;Ki=-Gi/qi,0{bi(3)},(yi,vi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.isNodeJS=void 0;const bi=!(typeof process!="object"||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type!=="browser");vi.isNodeJS=bi},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{var yi,vi,bi,_i,$i,Pi,Ai,_s;Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.WorkerTransport=exports.RenderTask=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.version=void 0;var _util=__w_pdfjs_require__(1),_display_utils=__w_pdfjs_require__(5),_font_loader=__w_pdfjs_require__(7),_node_utils=__w_pdfjs_require__(8),_annotation_storage=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(10),_worker_options=__w_pdfjs_require__(12),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(13),_metadata=__w_pdfjs_require__(14),_optional_content_config=__w_pdfjs_require__(15),_transport_stream=__w_pdfjs_require__(16),_xfa_text=__w_pdfjs_require__(17);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DefaultCanvasFactory=_is_node.isNodeJS?_node_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_is_node.isNodeJS?_node_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultStandardFontDataFactory=_is_node.isNodeJS?_node_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;let createPDFNetworkStream;function setPDFNetworkStreamFactory(Ei){createPDFNetworkStream=Ei}function getDocument(Ei,wi){const Ci=new PDFDocumentLoadingTask;let ki;if(typeof Ei=="string"||Ei instanceof URL)ki={url:Ei};else if((0,_util.isArrayBuffer)(Ei))ki={data:Ei};else if(Ei instanceof PDFDataRangeTransport)ki={range:Ei};else{if(typeof Ei!="object")throw new Error("Invalid parameter in getDocument, need either string, URL, Uint8Array, or parameter object.");if(!Ei.url&&!Ei.data&&!Ei.range)throw new Error("Invalid parameter object: need either .data, .range or .url");ki=Ei}const xi=Object.create(null);let Ti=null,Oi=null;for(const Li in ki){const Ii=ki[Li];switch(Li){case"url":if(typeof window<"u")try{xi[Li]=new URL(Ii,window.location).href;continue}catch(Mi){(0,_util.warn)(`Cannot create valid URL: "${Mi}".`)}else if(typeof Ii=="string"||Ii instanceof URL){xi[Li]=Ii.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":Ti=Ii;continue;case"worker":Oi=Ii;continue;case"data":if(_is_node.isNodeJS&&typeof Buffer<"u"&&Ii instanceof Buffer)xi[Li]=new Uint8Array(Ii);else{if(Ii instanceof Uint8Array)break;if(typeof Ii=="string")xi[Li]=(0,_util.stringToBytes)(Ii);else if(typeof Ii!="object"||Ii===null||isNaN(Ii.length)){if(!(0,_util.isArrayBuffer)(Ii))throw new Error("Invalid PDF binary data: either typed array, string, or array-like object is expected in the data property.");xi[Li]=new Uint8Array(Ii)}else xi[Li]=new Uint8Array(Ii)}continue}xi[Li]=Ii}if(xi.rangeChunkSize=xi.rangeChunkSize||DEFAULT_RANGE_CHUNK_SIZE,xi.CMapReaderFactory=xi.CMapReaderFactory||DefaultCMapReaderFactory,xi.StandardFontDataFactory=xi.StandardFontDataFactory||DefaultStandardFontDataFactory,xi.ignoreErrors=xi.stopAtErrors!==!0,xi.fontExtraProperties=xi.fontExtraProperties===!0,xi.pdfBug=xi.pdfBug===!0,xi.enableXfa=xi.enableXfa===!0,(typeof xi.docBaseUrl!="string"||(0,_display_utils.isDataScheme)(xi.docBaseUrl))&&(xi.docBaseUrl=null),Number.isInteger(xi.maxImageSize)||(xi.maxImageSize=-1),typeof xi.useWorkerFetch!="boolean"&&(xi.useWorkerFetch=xi.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&xi.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory),typeof xi.isEvalSupported!="boolean"&&(xi.isEvalSupported=!0),typeof xi.disableFontFace!="boolean"&&(xi.disableFontFace=_is_node.isNodeJS),typeof xi.useSystemFonts!="boolean"&&(xi.useSystemFonts=!_is_node.isNodeJS&&!xi.disableFontFace),xi.ownerDocument===void 0&&(xi.ownerDocument=globalThis.document),typeof xi.disableRange!="boolean"&&(xi.disableRange=!1),typeof xi.disableStream!="boolean"&&(xi.disableStream=!1),typeof xi.disableAutoFetch!="boolean"&&(xi.disableAutoFetch=!1),(0,_util.setVerbosityLevel)(xi.verbosity),Oi)Ci._worker=Oi;else{const Li={verbosity:xi.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};Oi=Li.port?_PDFWorker.fromPort(Li):new _PDFWorker(Li),Ci._worker=Oi}const ji=Ci.docId;return Oi.promise.then(function(){if(Ci.destroyed)throw new Error("Loading aborted");const Li=_fetchDocument(Oi,xi,Ti,ji),Ii=new Promise(function(Mi){let Fi;Ti?Fi=new _transport_stream.PDFDataTransportStream({length:xi.length,initialData:xi.initialData,progressiveDone:xi.progressiveDone,contentDispositionFilename:xi.contentDispositionFilename,disableRange:xi.disableRange,disableStream:xi.disableStream,inspectFetchUrl:xi.inspectFetchUrl},Ti):xi.data||(Fi=createPDFNetworkStream({url:xi.url,length:xi.length,httpHeaders:xi.httpHeaders,withCredentials:xi.withCredentials,rangeChunkSize:xi.rangeChunkSize,disableRange:xi.disableRange,disableStream:xi.disableStream,streamHttpMethod:xi.streamHttpMethod,inspectFetchUrl:xi.inspectFetchUrl})),Mi(Fi)});return Promise.all([Li,Ii]).then(function([Mi,Fi]){if(Ci.destroyed)throw new Error("Loading aborted");const Bi=new _message_handler.MessageHandler(ji,Mi,Oi.port);let Ri,Vi=null;wi!==null&&(Vi=async function(Ni){return wi(Ni,Bi)}),Ri=xi.createWorkerTransport?xi.createWorkerTransport(Bi,Ci,Fi,xi,Vi):new WorkerTransport(Bi,Ci,Fi,xi,Vi),Ci.setTransport(Ri),Bi.send("Ready",null)})}).catch(Ci._capability.reject),Ci}async function _fetchDocument(Ei,wi,Ci,ki){if(Ei.destroyed)throw new Error("Worker was destroyed");Ci&&(wi.length=Ci.length,wi.initialData=Ci.initialData,wi.progressiveDone=Ci.progressiveDone,wi.contentDispositionFilename=Ci.contentDispositionFilename);const xi=await Ei.messageHandler.sendWithPromise("GetDocRequest",{docId:ki,apiVersion:"2.13.217-alpha.85",source:{data:wi.data,url:wi.url,password:wi.password,disableAutoFetch:wi.disableAutoFetch,rangeChunkSize:wi.rangeChunkSize,length:wi.length},maxImageSize:wi.maxImageSize,disableFontFace:wi.disableFontFace,docBaseUrl:wi.docBaseUrl,ignoreErrors:wi.ignoreErrors,isEvalSupported:wi.isEvalSupported,fontExtraProperties:wi.fontExtraProperties,enableXfa:wi.enableXfa,useSystemFonts:wi.useSystemFonts,cMapUrl:wi.useWorkerFetch?wi.cMapUrl:null,standardFontDataUrl:wi.useWorkerFetch?wi.standardFontDataUrl:null});if(Ei.destroyed)throw new Error("Worker was destroyed");return xi}class PDFDocumentLoadingTask{static get idCounters(){return(0,_util.shadow)(this,"idCounters",{doc:0})}constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transportCapability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+PDFDocumentLoadingTask.idCounters.doc++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}setTransport(wi){this._transport=wi,this._transportCapability.resolve(wi)}get transportPromise(){return this._transportCapability.promise}async destroy(){var wi;this.destroyed=!0,await((wi=this._transport)==null?void 0:wi.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(wi,Ci,ki=!1,xi=null){this.length=wi,this.initialData=Ci,this.progressiveDone=ki,this.contentDispositionFilename=xi,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(wi){this._rangeListeners.push(wi)}addProgressListener(wi){this._progressListeners.push(wi)}addProgressiveReadListener(wi){this._progressiveReadListeners.push(wi)}addProgressiveDoneListener(wi){this._progressiveDoneListeners.push(wi)}onDataRange(wi,Ci){for(const ki of this._rangeListeners)ki(wi,Ci)}onDataProgress(wi,Ci){this._readyCapability.promise.then(()=>{for(const ki of this._progressListeners)ki(wi,Ci)})}onDataProgressiveRead(wi){this._readyCapability.promise.then(()=>{for(const Ci of this._progressiveReadListeners)Ci(wi)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const wi of this._progressiveDoneListeners)wi()})}transportReady(){this._readyCapability.resolve()}requestDataRange(wi,Ci){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(wi,Ci){this._pdfInfo=wi,this._transport=Ci,Object.defineProperty(this,"fingerprint",{get(){return(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead."),this.stats||{streamTypes:{},fontTypes:{}})})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get stats(){return this._transport.stats}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(wi){return this._transport.getPage(wi)}getPageIndex(wi){return this._transport.getPageIndex(wi)}getDestinations(){return this._transport.getDestinations()}getDestination(wi){return this._transport.getDestination(wi)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(wi=!1){return this._transport.startCleanup(wi||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){return this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(wi,Ci,ki,xi,Ti=!1){this._pageIndex=wi,this._pageInfo=Ci,this._ownerDocument=xi,this._transport=ki,this._stats=Ti?new _display_utils.StatTimer:null,this._pdfBug=Ti,this.commonObjs=ki.commonObjs,this.objs=new PDFObjects,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this._annotationPromises=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:wi,rotation:Ci=this.rotate,offsetX:ki=0,offsetY:xi=0,dontFlip:Ti=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:wi,rotation:Ci,offsetX:ki,offsetY:xi,dontFlip:Ti})}getAnnotations({intent:wi="display"}={}){const Ci=this._transport.getRenderingIntent(wi);let ki=this._annotationPromises.get(Ci.cacheKey);return ki||(ki=this._transport.getAnnotations(this._pageIndex,Ci.renderingIntent),this._annotationPromises.set(Ci.cacheKey,ki),ki=ki.then(xi=>{for(const Ti of xi)Ti.titleObj!==void 0&&Object.defineProperty(Ti,"title",{get(){return(0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead."),Ti.titleObj.str}}),Ti.contentsObj!==void 0&&Object.defineProperty(Ti,"contents",{get(){return(0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),Ti.contentsObj.str}});return xi})),ki}getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}async getXfa(){var wi;return((wi=this._transport._htmlForXfa)==null?void 0:wi.children[this._pageIndex])||null}render({canvasContext:wi,viewport:Ci,intent:ki="display",annotationMode:xi=_util.AnnotationMode.ENABLE,transform:Ti=null,imageLayer:Oi=null,canvasFactory:ji=null,background:Li=null,optionalContentConfigPromise:Ii=null,annotationCanvasMap:Mi=null}){var Di,Ui;((Di=arguments[0])==null?void 0:Di.renderInteractiveForms)!==void 0&&((0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),arguments[0].renderInteractiveForms===!0&&xi===_util.AnnotationMode.ENABLE&&(xi=_util.AnnotationMode.ENABLE_FORMS)),((Ui=arguments[0])==null?void 0:Ui.includeAnnotationStorage)!==void 0&&((0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),arguments[0].includeAnnotationStorage===!0&&xi===_util.AnnotationMode.ENABLE&&(xi=_util.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const Fi=this._transport.getRenderingIntent(ki,xi);this.pendingCleanup=!1,Ii||(Ii=this._transport.getOptionalContentConfig());let Bi=this._intentStates.get(Fi.cacheKey);Bi||(Bi=Object.create(null),this._intentStates.set(Fi.cacheKey,Bi)),Bi.streamReaderCancelTimeout&&(clearTimeout(Bi.streamReaderCancelTimeout),Bi.streamReaderCancelTimeout=null);const Ri=ji||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),Vi=!!(Fi.renderingIntent&_util.RenderingIntentFlag.PRINT);Bi.displayReadyCapability||(Bi.displayReadyCapability=(0,_util.createPromiseCapability)(),Bi.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(Fi));const Ni=Hi=>{Bi.renderTasks.delete(Wi),(this.cleanupAfterRender||Vi)&&(this.pendingCleanup=!0),this._tryCleanup(),Hi?(Wi.capability.reject(Hi),this._abortOperatorList({intentState:Bi,reason:Hi instanceof Error?Hi:new Error(Hi)})):Wi.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},Wi=new InternalRenderTask({callback:Ni,params:{canvasContext:wi,viewport:Ci,transform:Ti,imageLayer:Oi,background:Li},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:Mi,operatorList:Bi.operatorList,pageIndex:this._pageIndex,canvasFactory:Ri,useRequestAnimationFrame:!Vi,pdfBug:this._pdfBug});(Bi.renderTasks||(Bi.renderTasks=new Set)).add(Wi);const zi=Wi.task;return Promise.all([Bi.displayReadyCapability.promise,Ii]).then(([Hi,qi])=>{this.pendingCleanup?Ni():(this._stats&&this._stats.time("Rendering"),Wi.initializeGraphics({transparency:Hi,optionalContentConfig:qi}),Wi.operatorListChanged())}).catch(Ni),zi}getOperatorList({intent:wi="display",annotationMode:Ci=_util.AnnotationMode.ENABLE}={}){const ki=this._transport.getRenderingIntent(wi,Ci,!0);let xi,Ti=this._intentStates.get(ki.cacheKey);return Ti||(Ti=Object.create(null),this._intentStates.set(ki.cacheKey,Ti)),Ti.opListReadCapability||(xi=Object.create(null),xi.operatorListChanged=function(){Ti.operatorList.lastChunk&&(Ti.opListReadCapability.resolve(Ti.operatorList),Ti.renderTasks.delete(xi))},Ti.opListReadCapability=(0,_util.createPromiseCapability)(),(Ti.renderTasks||(Ti.renderTasks=new Set)).add(xi),Ti.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(ki)),Ti.opListReadCapability.promise}streamTextContent({disableCombineTextItems:wi=!1,includeMarkedContent:Ci=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:wi!==!0,includeMarkedContent:Ci===!0},{highWaterMark:100,size:ki=>ki.items.length})}getTextContent(wi={}){if(this._transport._htmlForXfa)return this.getXfa().then(ki=>_xfa_text.XfaText.textContent(ki));const Ci=this.streamTextContent(wi);return new Promise(function(ki,xi){const Ti=Ci.getReader(),Oi={items:[],styles:Object.create(null)};(function ji(){Ti.read().then(function({value:Li,done:Ii}){Ii?ki(Oi):(Object.assign(Oi.styles,Li.styles),Oi.items.push(...Li.items),ji())},xi)})()})}getStructTree(){return this._structTreePromise||(this._structTreePromise=this._transport.getStructTree(this._pageIndex))}_destroy(){this.destroyed=!0;const wi=[];for(const Ci of this._intentStates.values())if(this._abortOperatorList({intentState:Ci,reason:new Error("Page was destroyed."),force:!0}),!Ci.opListReadCapability)for(const ki of Ci.renderTasks)wi.push(ki.completed),ki.cancel();return this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(wi)}cleanup(wi=!1){return this.pendingCleanup=!0,this._tryCleanup(wi)}_tryCleanup(wi=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:Ci,operatorList:ki}of this._intentStates.values())if(Ci.size>0||!ki.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,wi&&this._stats&&(this._stats=new _display_utils.StatTimer),this.pendingCleanup=!1,!0}_startRenderPage(wi,Ci){const ki=this._intentStates.get(Ci);ki&&(this._stats&&this._stats.timeEnd("Page Request"),ki.displayReadyCapability&&ki.displayReadyCapability.resolve(wi))}_renderPageChunk(wi,Ci){for(let ki=0,xi=wi.length;ki{ki.read().then(({value:Oi,done:ji})=>{ji?xi.streamReader=null:this._transport.destroyed||(this._renderPageChunk(Oi,xi),Ti())},Oi=>{if(xi.streamReader=null,!this._transport.destroyed){if(xi.operatorList){xi.operatorList.lastChunk=!0;for(const ji of xi.renderTasks)ji.operatorListChanged();this._tryCleanup()}if(xi.displayReadyCapability)xi.displayReadyCapability.reject(Oi);else{if(!xi.opListReadCapability)throw Oi;xi.opListReadCapability.reject(Oi)}}})};Ti()}_abortOperatorList({intentState:wi,reason:Ci,force:ki=!1}){if(wi.streamReader){if(!ki){if(wi.renderTasks.size>0)return;if(Ci instanceof _display_utils.RenderingCancelledException){wi.streamReaderCancelTimeout=setTimeout(()=>{this._abortOperatorList({intentState:wi,reason:Ci,force:!0}),wi.streamReaderCancelTimeout=null},RENDERING_CANCELLED_TIMEOUT);return}}if(wi.streamReader.cancel(new _util.AbortException(Ci.message)).catch(()=>{}),wi.streamReader=null,!this._transport.destroyed){for(const[xi,Ti]of this._intentStates)if(Ti===wi){this._intentStates.delete(xi);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(wi,Ci){const ki={data:structuredClone(wi,Ci||null)};this._deferred.then(()=>{for(const xi of this._listeners)xi.call(this,ki)})}addEventListener(wi,Ci){this._listeners.push(Ci)}removeEventListener(wi,Ci){const ki=this._listeners.indexOf(Ci);this._listeners.splice(ki,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(_is_node.isNodeJS&&typeof require=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const Ei=(yi=document==null?void 0:document.currentScript)==null?void 0:yi.src;Ei&&(PDFWorkerUtil.fallbackWorkerSrc=Ei.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.createCDNWrapper=function(Ei){const wi=`importScripts("${Ei}");`;return URL.createObjectURL(new Blob([wi]))};class _PDFWorker{static get _workerPorts(){return(0,_util.shadow)(this,"_workerPorts",new WeakMap)}constructor({name:Ei=null,port:wi=null,verbosity:Ci=(0,_util.getVerbosityLevel)()}={}){if(wi&&_PDFWorker._workerPorts.has(wi))throw new Error("Cannot use more than one PDFWorker per port.");this.name=Ei,this.destroyed=!1,this.verbosity=Ci,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,wi?(_PDFWorker._workerPorts.set(wi,this),this._initializeFromPort(wi)):this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(Ei){this._port=Ei,this._messageHandler=new _message_handler.MessageHandler("main","worker",Ei),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve()}_initialize(){if(typeof Worker<"u"&&!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let Ei=_PDFWorker.workerSrc;try{(0,_util.isSameOrigin)(window.location.href,Ei)||(Ei=PDFWorkerUtil.createCDNWrapper(new URL(Ei,window.location).href));const wi=new Worker(Ei,{type:"module"}),Ci=new _message_handler.MessageHandler("main","worker",wi),ki=()=>{wi.removeEventListener("error",xi),Ci.destroy(),wi.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},xi=()=>{this._webWorker||ki()};wi.addEventListener("error",xi),Ci.on("test",Oi=>{wi.removeEventListener("error",xi),this.destroyed?ki():Oi?(this._messageHandler=Ci,this._port=wi,this._webWorker=wi,this._readyCapability.resolve(),Ci.send("configure",this.getWorkerConfiguration())):(this._setupFakeWorker(),Ci.destroy(),wi.terminate())}),Ci.on("ready",Oi=>{if(wi.removeEventListener("error",xi),this.destroyed)ki();else try{Ti()}catch{this._setupFakeWorker()}});const Ti=()=>{const Oi=new Uint8Array([255]);try{Ci.send("test",Oi,[Oi.buffer])}catch{(0,_util.warn)("Cannot use postMessage transfers."),Oi[0]=0,Ci.send("test",Oi)}};Ti();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}getWorkerConfiguration(){return{verbosity:this.verbosity}}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),_PDFWorker._setupFakeWorkerGlobal.then(Ei=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const wi=new LoopbackPort;this._port=wi;const Ci="fake"+PDFWorkerUtil.fakeWorkerId++,ki=new _message_handler.MessageHandler(Ci+"_worker",Ci,wi);Ei.setup(ki,wi);const xi=new _message_handler.MessageHandler(Ci,Ci+"_worker",wi);this._messageHandler=xi,this._readyCapability.resolve(),xi.send("configure",{verbosity:this.verbosity})}).catch(Ei=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${Ei.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),_PDFWorker._workerPorts.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(Ei){if(!(Ei!=null&&Ei.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return this._workerPorts.has(Ei.port)?this._workerPorts.get(Ei.port):new _PDFWorker(Ei)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var Ei;try{return((Ei=globalThis.pdfjsWorker)==null?void 0:Ei.WorkerMessageHandler)||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&typeof require=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=_PDFWorker,_PDFWorker.getWorkerSrc=function(){return(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};class WorkerTransport{constructor(wi,Ci,ki,xi,Ti){Er(this,vi,null);Er(this,bi,new Map);Er(this,_i,new Map);Er(this,$i,null);this.messageHandler=wi,this.loadingTask=Ci,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:Ci.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:xi.ownerDocument,styleElement:xi.styleElement}),this._params=xi,this._readRange=Ti,xi.useWorkerFetch||(this.CMapReaderFactory=new xi.CMapReaderFactory({baseUrl:xi.cMapUrl,isCompressed:xi.cMapPacked}),this.StandardFontDataFactory=new xi.StandardFontDataFactory({baseUrl:xi.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=ki,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}get pageCache(){return Cr(this,bi)}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get stats(){return Cr(this,vi)}getRenderingIntent(wi,Ci=_util.AnnotationMode.ENABLE,ki=!1){let xi=_util.RenderingIntentFlag.DISPLAY,Ti="";switch(wi){case"any":xi=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":xi=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${wi}`)}switch(Ci){case _util.AnnotationMode.DISABLE:xi+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:xi+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:xi+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,Ti=this.annotationStorage.lastModified;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${Ci}`)}return ki&&(xi+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:xi,cacheKey:`${xi}_${Ti}`}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const wi=[];for(const ki of Cr(this,bi).values())wi.push(ki._destroy());Cr(this,bi).clear(),Cr(this,_i).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const Ci=this.messageHandler.sendWithPromise("Terminate",null);return wi.push(Ci),Promise.all(wi).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),Nr(this,$i,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:wi,loadingTask:Ci}=this;wi.on("GetReader",(xi,Ti)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=Oi=>{this._lastProgress={loaded:Oi.loaded,total:Oi.total}},Ti.onPull=()=>{this._fullReader.read().then(function({value:Oi,done:ji}){ji?Ti.close():((0,_util.assert)((0,_util.isArrayBuffer)(Oi),"GetReader - expected an ArrayBuffer."),Ti.enqueue(new Uint8Array(Oi),1,[Oi]))}).catch(Oi=>{Ti.error(Oi)})},Ti.onCancel=Oi=>{this._fullReader.cancel(Oi),Ti.ready.catch(ji=>{if(!this.destroyed)throw ji})}}),wi.on("ReaderHeadersReady",xi=>{const Ti=(0,_util.createPromiseCapability)(),Oi=this._fullReader;return Oi.headersReady.then(()=>{var ji;(!Oi.isStreamingSupported||!Oi.isRangeSupported)&&(this._lastProgress&&((ji=Ci.onProgress)==null||ji.call(Ci,this._lastProgress)),Oi.onProgress=Li=>{var Ii;(Ii=Ci.onProgress)==null||Ii.call(Ci,{loaded:Li.loaded,total:Li.total})}),Ti.resolve({isStreamingSupported:Oi.isStreamingSupported,isRangeSupported:Oi.isRangeSupported,contentLength:Oi.contentLength})},Ti.reject),Ti.promise});const ki={};wi.on("GetRangeReader",(xi,Ti)=>{if(this._readRange){Ti.onPull=()=>{this._readRange(xi).then(ji=>{const Li=`${xi.begin}-${xi.end}`;ki[Li]?Ti.close():(ki[Li]=!0,Ti.enqueue(new Uint8Array(ji),1,[ji]))}).catch(ji=>{Ti.error(ji)})},Ti.onCancel=ji=>{Ti.ready.catch(Li=>{if(!this.destroyed)throw Li})};return}(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const Oi=this._networkStream.getRangeReader(xi.begin,xi.end,xi.cause);Oi?(Ti.onPull=()=>{Oi.read().then(function({value:ji,done:Li}){Li?Ti.close():((0,_util.assert)((0,_util.isArrayBuffer)(ji),"GetRangeReader - expected an ArrayBuffer."),Ti.enqueue(new Uint8Array(ji),1,[ji]))}).catch(ji=>{Ti.error(ji)})},Ti.onCancel=ji=>{Oi.cancel(ji),Ti.ready.catch(Li=>{if(!this.destroyed)throw Li})}):Ti.close()}),wi.on("GetDoc",({pdfInfo:xi})=>{this._numPages=xi.numPages,this._htmlForXfa=xi.htmlForXfa,delete xi.htmlForXfa;let Ti;Ti=this._params.createDocumentProxy?this._params.createDocumentProxy(xi,this):new PDFDocumentProxy(xi,this),Ci._capability.resolve(Ti)}),wi.on("DocException",function(xi){let Ti;switch(xi.name){case"PasswordException":Ti=new _util.PasswordException(xi.message,xi.code);break;case"InvalidPDFException":Ti=new _util.InvalidPDFException(xi.message);break;case"MissingPDFException":Ti=new _util.MissingPDFException(xi.message);break;case"UnexpectedResponseException":Ti=new _util.UnexpectedResponseException(xi.message,xi.status);break;case"UnknownErrorException":Ti=new _util.UnknownErrorException(xi.message,xi.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}Ci._capability.reject(Ti)}),wi.on("PasswordRequest",xi=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),Ci.onPassword){const Ti=Oi=>{Oi instanceof Error?this._passwordCapability.reject(Oi):this._passwordCapability.resolve({password:Oi})};try{Ci.onPassword(Ti,xi.code)}catch(Oi){this._passwordCapability.reject(Oi)}}else this._passwordCapability.reject(new _util.PasswordException(xi.message,xi.code));return this._passwordCapability.promise}),wi.on("DataLoaded",xi=>{var Ti;(Ti=Ci.onProgress)==null||Ti.call(Ci,{loaded:xi.length,total:xi.length}),this.downloadInfoCapability.resolve(xi)}),wi.on("StartRenderPage",xi=>{this.destroyed||Cr(this,bi).get(xi.pageIndex)._startRenderPage(xi.transparency,xi.cacheKey)}),wi.on("commonobj",([xi,Ti,Oi])=>{var ji;if(!this.destroyed&&!this.commonObjs.has(xi))switch(Ti){case"Font":const Li=this._params;if("error"in Oi){const Fi=Oi.error;(0,_util.warn)(`Error during font loading: ${Fi}`),this.commonObjs.resolve(xi,Fi);break}let Ii=null;Li.pdfBug&&((ji=globalThis.FontInspector)!=null&&ji.enabled)&&(Ii={registerFont(Fi,Bi){globalThis.FontInspector.fontAdded(Fi,Bi)}});const Mi=new _font_loader.FontFaceObject(Oi,{isEvalSupported:Li.isEvalSupported,disableFontFace:Li.disableFontFace,ignoreErrors:Li.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:Ii});this.fontLoader.bind(Mi).catch(Fi=>wi.sendWithPromise("FontFallback",{id:xi})).finally(()=>{!Li.fontExtraProperties&&Mi.data&&(Mi.data=null),this.commonObjs.resolve(xi,Mi)});break;case"FontPath":case"Image":this.commonObjs.resolve(xi,Oi);break;default:throw new Error(`Got unknown common object type ${Ti}`)}}),wi.on("obj",([xi,Ti,Oi,ji])=>{var Ii;if(this.destroyed)return;const Li=Cr(this,bi).get(Ti);if(!Li.objs.has(xi))switch(Oi){case"Image":Li.objs.resolve(xi,ji);const Mi=8e6;((Ii=ji==null?void 0:ji.data)==null?void 0:Ii.length)>Mi&&(Li.cleanupAfterRender=!0);break;case"Pattern":Li.objs.resolve(xi,ji);break;default:throw new Error(`Got unknown object type ${Oi}`)}}),wi.on("DocProgress",xi=>{var Ti;this.destroyed||((Ti=Ci.onProgress)==null||Ti.call(Ci,{loaded:xi.loaded,total:xi.total}))}),wi.on("DocStats",xi=>{this.destroyed||Nr(this,vi,Object.freeze({streamTypes:Object.freeze(xi.streamTypes),fontTypes:Object.freeze(xi.fontTypes)}))}),wi.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),wi.on("FetchBuiltInCMap",xi=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(xi):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),wi.on("FetchStandardFontData",xi=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(xi):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}_onUnsupportedFeature({featureId:wi}){var Ci,ki;this.destroyed||((ki=(Ci=this.loadingTask).onUnsupportedFeature)==null||ki.call(Ci,wi))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getRangeData(wi){return this.messageHandler.sendWithPromise("GetRangeData",wi)}ensureRangesData(wi){return this.messageHandler.sendWithPromise("EnsureRangesData",wi)}prefetchPageData(wi){return this.messageHandler.sendWithPromise("EnsurePageData",wi)}getPage(wi){if(!Number.isInteger(wi)||wi<=0||wi>this._numPages)return Promise.reject(new Error("Invalid page request."));const Ci=wi-1,ki=Cr(this,_i).get(Ci);if(ki)return ki;const xi=this.messageHandler.sendWithPromise("GetPage",{pageIndex:Ci}).then(Ti=>{if(this.destroyed)throw new Error("Transport destroyed");let Oi;return Oi=this._params.createPDFPageProxy?this._params.createPDFPageProxy(Ci,Ti,this,this._params.ownerDocument,this._params.pdfBug):new PDFPageProxy(Ci,Ti,this,this._params.ownerDocument,this._params.pdfBug),Cr(this,bi).set(Ci,Oi),Oi});return Cr(this,_i).set(Ci,xi),xi}getPageIndex(wi){return typeof wi!="object"||wi===null||!Number.isInteger(wi.num)||wi.num<0||!Number.isInteger(wi.gen)||wi.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:wi.num,gen:wi.gen})}getAnnotations(wi,Ci){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:wi,intent:Ci})}saveDocument(){var wi,Ci;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:(Ci=(wi=this._fullReader)==null?void 0:wi.filename)!=null?Ci:null}).finally(()=>{this.annotationStorage.resetModified()})}getFieldObjects(){return this._getFieldObjectsPromise||(this._getFieldObjectsPromise=this.messageHandler.sendWithPromise("GetFieldObjects",null))}hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(wi){return typeof wi!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:wi})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(wi){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:wi})}getStructTree(wi){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:wi})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(wi=>new _optional_content_config.OptionalContentConfig(wi))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return Cr(this,$i)||Nr(this,$i,this.messageHandler.sendWithPromise("GetMetadata",null).then(wi=>{var Ci,ki,xi,Ti;return{info:wi[0],metadata:wi[1]?new _metadata.Metadata(wi[1]):null,contentDispositionFilename:(ki=(Ci=this._fullReader)==null?void 0:Ci.filename)!=null?ki:null,contentLength:(Ti=(xi=this._fullReader)==null?void 0:xi.contentLength)!=null?Ti:null}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(wi=!1){if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const Ci of Cr(this,bi).values())if(!Ci.cleanup())throw new Error(`startCleanup: Page ${Ci.pageNumber} is currently rendering.`);this.commonObjs.clear(),wi||this.fontLoader.clear(),Nr(this,$i,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const wi=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:wi.disableAutoFetch,enableXfa:wi.enableXfa})}}vi=new WeakMap,bi=new WeakMap,_i=new WeakMap,$i=new WeakMap,exports.WorkerTransport=WorkerTransport;class PDFObjects{constructor(){Er(this,Ai);Er(this,Pi,Object.create(null))}get(wi,Ci=null){if(Ci){const xi=xr(this,Ai,_s).call(this,wi);return xi.capability.promise.then(()=>Ci(xi.data)),null}const ki=Cr(this,Pi)[wi];if(!(ki!=null&&ki.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${wi}.`);return ki.data}has(wi){var Ci;return((Ci=Cr(this,Pi)[wi])==null?void 0:Ci.capability.settled)||!1}resolve(wi,Ci=null){const ki=xr(this,Ai,_s).call(this,wi);ki.data=Ci,ki.capability.resolve()}clear(){Nr(this,Pi,Object.create(null))}}Pi=new WeakMap,Ai=new WeakSet,_s=function(wi){return Cr(this,Pi)[wi]||(Cr(this,Pi)[wi]={capability:(0,_util.createPromiseCapability)(),data:null})};class RenderTask{constructor(wi){this._internalRenderTask=wi,this.onContinue=null}get promise(){return this._internalRenderTask.capability.promise}cancel(){this._internalRenderTask.cancel()}}exports.RenderTask=RenderTask;class InternalRenderTask{static get canvasInUse(){return(0,_util.shadow)(this,"canvasInUse",new WeakSet)}constructor({callback:wi,params:Ci,objs:ki,commonObjs:xi,annotationCanvasMap:Ti,operatorList:Oi,pageIndex:ji,canvasFactory:Li,useRequestAnimationFrame:Ii=!1,pdfBug:Mi=!1}){this.callback=wi,this.params=Ci,this.objs=ki,this.commonObjs=xi,this.annotationCanvasMap=Ti,this.operatorListIdx=null,this.operatorList=Oi,this._pageIndex=ji,this.canvasFactory=Li,this._pdfBug=Mi,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=Ii===!0&&typeof window<"u",this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=Ci.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:wi=!1,optionalContentConfig:Ci}){var Li;if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.canvasInUse.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.canvasInUse.add(this._canvas)}this._pdfBug&&((Li=globalThis.StepperManager)!=null&&Li.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:ki,viewport:xi,transform:Ti,imageLayer:Oi,background:ji}=this.params;this.gfx=new _canvas.CanvasGraphics(ki,this.commonObjs,this.objs,this.canvasFactory,Oi,Ci,this.annotationCanvasMap),this.gfx.beginDrawing({transform:Ti,viewport:xi,transparency:wi,background:ji}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(wi=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&InternalRenderTask.canvasInUse.delete(this._canvas),this.callback(wi||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&InternalRenderTask.canvasInUse.delete(this._canvas),this.callback())))}}const version="2.13.217-alpha.85";exports.version=version;const build="bbff5b618";exports.build=build},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.StatTimer=vi.RenderingCancelledException=vi.PixelsPerInch=vi.PageViewport=vi.PDFDateString=vi.DOMStandardFontDataFactory=vi.DOMSVGFactory=vi.DOMCanvasFactory=vi.DOMCMapReaderFactory=void 0,vi.deprecated=function(Ii){},vi.getFilenameFromUrl=function(Ii){const Mi=Ii.indexOf("#"),Fi=Ii.indexOf("?"),Bi=Math.min(Mi>0?Mi:Ii.length,Fi>0?Fi:Ii.length);return Ii.substring(Ii.lastIndexOf("/",Bi)+1,Bi)},vi.getPdfFilenameFromUrl=function(Ii,Mi="document.pdf"){if(typeof Ii!="string")return Mi;if(Ti(Ii))return(0,$i.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),Mi;const Fi=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,Bi=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(Ii);let Ri=Fi.exec(Bi[1])||Fi.exec(Bi[2])||Fi.exec(Bi[3]);if(Ri&&(Ri=Ri[0],Ri.includes("%")))try{Ri=Fi.exec(decodeURIComponent(Ri))[0]}catch{}return Ri||Mi},vi.getXfaPageViewport=function(Ii,{scale:Mi=1,rotation:Fi=0}){const{width:Bi,height:Ri}=Ii.attributes.style,Vi=[0,0,parseInt(Bi),parseInt(Ri)];return new ki({viewBox:Vi,scale:Mi,rotation:Fi})},vi.isDataScheme=Ti,vi.isPdfFile=function(Ii){return typeof Ii=="string"&&/\.pdf$/i.test(Ii)},vi.isValidFetchUrl=Oi,vi.loadScript=function(Ii,Mi=!1,Fi=!1){return new Promise((Bi,Ri)=>{const Vi=document.createElement("script");Vi.src=Ii,Fi&&(Vi.crossOrigin="anonymous"),Vi.onload=function(Ni){Mi&&Vi.remove(),Bi(Ni)},Vi.onerror=function(){Ri(new Error(`Cannot load script at: ${Vi.src}`))},(document.head||document.documentElement).appendChild(Vi)})};var _i=bi(6),$i=bi(1);const Li=class{};let Pi=Li;es(Pi,"CSS",96),es(Pi,"PDF",72),es(Pi,"PDF_TO_CSS_UNITS",Li.CSS/Li.PDF),vi.PixelsPerInch=Pi;class Ai extends _i.BaseCanvasFactory{constructor({ownerDocument:Mi=globalThis.document}={}){super(),this._document=Mi}_createCanvas(Mi,Fi){const Bi=this._document.createElement("canvas");return Bi.width=Mi,Bi.height=Fi,Bi}}vi.DOMCanvasFactory=Ai;async function Si(Ii,Mi=!1){if(Oi(Ii,document.baseURI)){const Fi=await fetch(Ii);if(!Fi.ok)throw new Error(Fi.statusText);return Mi?new Uint8Array(await Fi.arrayBuffer()):(0,$i.stringToBytes)(await Fi.text())}return new Promise((Fi,Bi)=>{const Ri=new XMLHttpRequest;Ri.open("GET",Ii,!0),Mi&&(Ri.responseType="arraybuffer"),Ri.onreadystatechange=()=>{if(Ri.readyState===XMLHttpRequest.DONE){if(Ri.status===200||Ri.status===0){let Vi;if(Mi&&Ri.response?Vi=new Uint8Array(Ri.response):!Mi&&Ri.responseText&&(Vi=(0,$i.stringToBytes)(Ri.responseText)),Vi){Fi(Vi);return}}Bi(new Error(Ri.statusText))}},Ri.send(null)})}class Ei extends _i.BaseCMapReaderFactory{_fetchData(Mi,Fi){return Si(Mi,this.isCompressed).then(Bi=>({cMapData:Bi,compressionType:Fi}))}}vi.DOMCMapReaderFactory=Ei;class wi extends _i.BaseStandardFontDataFactory{_fetchData(Mi){return Si(Mi,!0)}}vi.DOMStandardFontDataFactory=wi;class Ci extends _i.BaseSVGFactory{_createSVG(Mi){return document.createElementNS("http://www.w3.org/2000/svg",Mi)}}vi.DOMSVGFactory=Ci;class ki{constructor({viewBox:Mi,scale:Fi,rotation:Bi,offsetX:Ri=0,offsetY:Vi=0,dontFlip:Ni=!1}){this.viewBox=Mi,this.scale=Fi,this.rotation=Bi,this.offsetX=Ri,this.offsetY=Vi;const Wi=(Mi[2]+Mi[0])/2,zi=(Mi[3]+Mi[1])/2;let Di,Ui,Hi,qi,Gi,Ki,Qi,Xi;switch((Bi%=360)<0&&(Bi+=360),Bi){case 180:Di=-1,Ui=0,Hi=0,qi=1;break;case 90:Di=0,Ui=1,Hi=1,qi=0;break;case 270:Di=0,Ui=-1,Hi=-1,qi=0;break;case 0:Di=1,Ui=0,Hi=0,qi=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}Ni&&(Hi=-Hi,qi=-qi),Di===0?(Gi=Math.abs(zi-Mi[1])*Fi+Ri,Ki=Math.abs(Wi-Mi[0])*Fi+Vi,Qi=Math.abs(Mi[3]-Mi[1])*Fi,Xi=Math.abs(Mi[2]-Mi[0])*Fi):(Gi=Math.abs(Wi-Mi[0])*Fi+Ri,Ki=Math.abs(zi-Mi[1])*Fi+Vi,Qi=Math.abs(Mi[2]-Mi[0])*Fi,Xi=Math.abs(Mi[3]-Mi[1])*Fi),this.transform=[Di*Fi,Ui*Fi,Hi*Fi,qi*Fi,Gi-Di*Fi*Wi-Hi*Fi*zi,Ki-Ui*Fi*Wi-qi*Fi*zi],this.width=Qi,this.height=Xi}clone({scale:Mi=this.scale,rotation:Fi=this.rotation,offsetX:Bi=this.offsetX,offsetY:Ri=this.offsetY,dontFlip:Vi=!1}={}){return new ki({viewBox:this.viewBox.slice(),scale:Mi,rotation:Fi,offsetX:Bi,offsetY:Ri,dontFlip:Vi})}convertToViewportPoint(Mi,Fi){return $i.Util.applyTransform([Mi,Fi],this.transform)}convertToViewportRectangle(Mi){const Fi=$i.Util.applyTransform([Mi[0],Mi[1]],this.transform),Bi=$i.Util.applyTransform([Mi[2],Mi[3]],this.transform);return[Fi[0],Fi[1],Bi[0],Bi[1]]}convertToPdfPoint(Mi,Fi){return $i.Util.applyInverseTransform([Mi,Fi],this.transform)}convertToPdfRectangle(Mi){let[Fi,Bi,Ri,Vi]=Mi;return[Fi,Bi]=$i.Util.applyInverseTransform([Fi,Bi],this.transform),[Ri,Vi]=$i.Util.applyInverseTransform([Ri,Vi],this.transform),[Fi,Bi,Ri,Vi]}}vi.PageViewport=ki;class xi extends $i.BaseException{constructor(Mi,Fi){super(Mi,"RenderingCancelledException"),this.type=Fi}}vi.RenderingCancelledException=xi;function Ti(Ii){const Mi=Ii.length;let Fi=0;for(;FiMi&&(Mi=Bi.length)}for(const Fi of this.times){const Bi=Fi.end-Fi.start;Ii.push(`${Fi.name.padEnd(Mi)} ${Bi}ms `)}return Ii.join("")}};function Oi(Ii,Mi){try{const{protocol:Fi}=Mi?new URL(Ii,Mi):new URL(Ii);return Fi==="http:"||Fi==="https:"}catch{return!1}}let ji;vi.PDFDateString=class{static toDateObject(Ii){if(!Ii||typeof Ii!="string")return null;ji||(ji=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const Mi=ji.exec(Ii);if(!Mi)return null;const Fi=parseInt(Mi[1],10);let Bi=parseInt(Mi[2],10);Bi=Bi>=1&&Bi<=12?Bi-1:0;let Ri=parseInt(Mi[3],10);Ri=Ri>=1&&Ri<=31?Ri:1;let Vi=parseInt(Mi[4],10);Vi=Vi>=0&&Vi<=23?Vi:0;let Ni=parseInt(Mi[5],10);Ni=Ni>=0&&Ni<=59?Ni:0;let Wi=parseInt(Mi[6],10);Wi=Wi>=0&&Wi<=59?Wi:0;const zi=Mi[7]||"Z";let Di=parseInt(Mi[8],10);Di=Di>=0&&Di<=23?Di:0;let Ui=parseInt(Mi[9],10)||0;return Ui=Ui>=0&&Ui<=59?Ui:0,zi==="-"?(Vi+=Di,Ni+=Ui):zi==="+"&&(Vi-=Di,Ni-=Ui),new Date(Date.UTC(Fi,Bi,Ri,Vi,Ni,Wi))}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.BaseStandardFontDataFactory=vi.BaseSVGFactory=vi.BaseCanvasFactory=vi.BaseCMapReaderFactory=void 0;var _i=bi(1);class $i{constructor(){this.constructor===$i&&(0,_i.unreachable)("Cannot initialize BaseCanvasFactory.")}create(wi,Ci){if(wi<=0||Ci<=0)throw new Error("Invalid canvas size");const ki=this._createCanvas(wi,Ci);return{canvas:ki,context:ki.getContext("2d")}}reset(wi,Ci,ki){if(!wi.canvas)throw new Error("Canvas is not specified");if(Ci<=0||ki<=0)throw new Error("Invalid canvas size");wi.canvas.width=Ci,wi.canvas.height=ki}destroy(wi){if(!wi.canvas)throw new Error("Canvas is not specified");wi.canvas.width=0,wi.canvas.height=0,wi.canvas=null,wi.context=null}_createCanvas(wi,Ci){(0,_i.unreachable)("Abstract method `_createCanvas` called.")}}vi.BaseCanvasFactory=$i;class Pi{constructor({baseUrl:wi=null,isCompressed:Ci=!1}){this.constructor===Pi&&(0,_i.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=wi,this.isCompressed=Ci}async fetch({name:wi}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!wi)throw new Error("CMap name must be specified.");const Ci=this.baseUrl+wi+(this.isCompressed?".bcmap":""),ki=this.isCompressed?_i.CMapCompressionType.BINARY:_i.CMapCompressionType.NONE;return this._fetchData(Ci,ki).catch(xi=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${Ci}`)})}_fetchData(wi,Ci){(0,_i.unreachable)("Abstract method `_fetchData` called.")}}vi.BaseCMapReaderFactory=Pi;class Ai{constructor({baseUrl:wi=null}){this.constructor===Ai&&(0,_i.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=wi}async fetch({filename:wi}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!wi)throw new Error("Font filename must be specified.");const Ci=`${this.baseUrl}${wi}`;return this._fetchData(Ci).catch(ki=>{throw new Error(`Unable to load font data at: ${Ci}`)})}_fetchData(wi){(0,_i.unreachable)("Abstract method `_fetchData` called.")}}vi.BaseStandardFontDataFactory=Ai;class Si{constructor(){this.constructor===Si&&(0,_i.unreachable)("Cannot initialize BaseSVGFactory.")}create(wi,Ci){if(wi<=0||Ci<=0)throw new Error("Invalid SVG dimensions");const ki=this._createSVG("svg:svg");return ki.setAttribute("version","1.1"),ki.setAttribute("width",`${wi}px`),ki.setAttribute("height",`${Ci}px`),ki.setAttribute("preserveAspectRatio","none"),ki.setAttribute("viewBox",`0 0 ${wi} ${Ci}`),ki}createElement(wi){if(typeof wi!="string")throw new Error("Invalid SVG element type");return this._createSVG(wi)}_createSVG(wi){(0,_i.unreachable)("Abstract method `_createSVG` called.")}}vi.BaseSVGFactory=Si},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.FontLoader=vi.FontFaceObject=void 0;var _i=bi(1);class $i{constructor({docId:Si,onUnsupportedFeature:Ei,ownerDocument:wi=globalThis.document,styleElement:Ci=null}){this.constructor===$i&&(0,_i.unreachable)("Cannot initialize BaseFontLoader."),this.docId=Si,this._onUnsupportedFeature=Ei,this._document=wi,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(Si){this.nativeFontFaces.push(Si),this._document.fonts.add(Si)}insertRule(Si){let Ei=this.styleElement;Ei||(Ei=this.styleElement=this._document.createElement("style"),Ei.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`,this._document.documentElement.getElementsByTagName("head")[0].appendChild(Ei));const wi=Ei.sheet;wi.insertRule(Si,wi.cssRules.length)}clear(){for(const Si of this.nativeFontFaces)this._document.fonts.delete(Si);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(Si){if(Si.attached||Si.missingFile)return;if(Si.attached=!0,this.isFontLoadingAPISupported){const wi=Si.createNativeFontFace();if(wi){this.addNativeFontFace(wi);try{await wi.loaded}catch(Ci){throw this._onUnsupportedFeature({featureId:_i.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,_i.warn)(`Failed to load font '${wi.family}': '${Ci}'.`),Si.disableFontFace=!0,Ci}}return}const Ei=Si.createFontFaceRule();if(Ei){if(this.insertRule(Ei),this.isSyncFontLoadingSupported)return;await new Promise(wi=>{const Ci=this._queueLoadingCallback(wi);this._prepareFontLoadEvent([Ei],[Si],Ci)})}}_queueLoadingCallback(Si){(0,_i.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){var Ei;const Si=!!((Ei=this._document)!=null&&Ei.fonts);return(0,_i.shadow)(this,"isFontLoadingAPISupported",Si)}get isSyncFontLoadingSupported(){(0,_i.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,_i.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(Si,Ei,wi){(0,_i.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let Pi;vi.FontLoader=Pi,vi.FontLoader=Pi=class extends $i{constructor(Ai){super(Ai),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){var Si;let Ai=!1;return(typeof navigator>"u"||((Si=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent))==null?void 0:Si[1])>=14)&&(Ai=!0),(0,_i.shadow)(this,"isSyncFontLoadingSupported",Ai)}_queueLoadingCallback(Ai){const Si=this.loadingContext,Ei={id:"pdfjs-font-loading-"+Si.nextRequestId++,done:!1,complete:function(){for((0,_i.assert)(!Ei.done,"completeRequest() cannot be called twice."),Ei.done=!0;Si.requests.length>0&&Si.requests[0].done;){const wi=Si.requests.shift();setTimeout(wi.callback,0)}},callback:Ai};return Si.requests.push(Ei),Ei}get _loadTestFont(){return(0,_i.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(Ai,Si,Ei){function wi(Ni,Wi){return Ni.charCodeAt(Wi)<<24|Ni.charCodeAt(Wi+1)<<16|Ni.charCodeAt(Wi+2)<<8|255&Ni.charCodeAt(Wi+3)}function Ci(Ni,Wi,zi,Di){return Ni.substring(0,Wi)+Di+Ni.substring(Wi+zi)}let ki,xi;const Ti=this._document.createElement("canvas");Ti.width=1,Ti.height=1;const Oi=Ti.getContext("2d");let ji=0;const Li=`lt${Date.now()}${this.loadTestFontId++}`;let Ii=this._loadTestFont;Ii=Ci(Ii,976,Li.length,Li);const Mi=1482184792;let Fi=wi(Ii,16);for(ki=0,xi=Li.length-3;ki30){(0,_i.warn)("Load test font never loaded."),zi();return}Oi.font="30px "+Wi,Oi.fillText(".",0,20),Oi.getImageData(0,0,1,1).data[3]>0?zi():setTimeout(Ni.bind(null,Wi,zi))}(Li,()=>{Vi.remove(),Ei.complete()})}},vi.FontFaceObject=class{constructor(Ai,{isEvalSupported:Si=!0,disableFontFace:Ei=!1,ignoreErrors:wi=!1,onUnsupportedFeature:Ci,fontRegistry:ki=null}){this.compiledGlyphs=Object.create(null);for(const xi in Ai)this[xi]=Ai[xi];this.isEvalSupported=Si!==!1,this.disableFontFace=Ei===!0,this.ignoreErrors=wi===!0,this._onUnsupportedFeature=Ci,this.fontRegistry=ki}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let Ai;if(this.cssFontInfo){const Si={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(Si.style=`oblique ${this.cssFontInfo.italicAngle}deg`),Ai=new FontFace(this.cssFontInfo.fontFamily,this.data,Si)}else Ai=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),Ai}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const Ai=(0,_i.bytesToString)(this.data),Si=`url(data:${this.mimetype};base64,${btoa(Ai)});`;let Ei;if(this.cssFontInfo){let wi=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(wi+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),Ei=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${wi}src:${Si}}`}else Ei=`@font-face {font-family:"${this.loadedName}";src:${Si}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,Si),Ei}getPathGenerator(Ai,Si){if(this.compiledGlyphs[Si]!==void 0)return this.compiledGlyphs[Si];let Ei;try{Ei=Ai.get(this.loadedName+"_path_"+Si)}catch(wi){if(!this.ignoreErrors)throw wi;return this._onUnsupportedFeature({featureId:_i.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,_i.warn)(`getPathGenerator - ignoring character: "${wi}".`),this.compiledGlyphs[Si]=function(Ci,ki){}}if(this.isEvalSupported&&_i.IsEvalSupportedCached.value){const wi=[];for(const Ci of Ei){const ki=Ci.args!==void 0?Ci.args.join(","):"";wi.push("c.",Ci.cmd,"(",ki,`); `)}return this.compiledGlyphs[Si]=new Function("c","size",wi.join(""))}return this.compiledGlyphs[Si]=function(wi,Ci){for(const ki of Ei)ki.cmd==="scale"&&(ki.args=[Ci,-Ci]),wi[ki.cmd].apply(wi,ki.args)}}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.NodeStandardFontDataFactory=vi.NodeCanvasFactory=vi.NodeCMapReaderFactory=void 0;var _i=bi(6),$i=bi(3),Pi=bi(1);let Ai=class{constructor(){(0,Pi.unreachable)("Not implemented: NodeCanvasFactory")}};vi.NodeCanvasFactory=Ai;let Si=class{constructor(){(0,Pi.unreachable)("Not implemented: NodeCMapReaderFactory")}};vi.NodeCMapReaderFactory=Si;let Ei=class{constructor(){(0,Pi.unreachable)("Not implemented: NodeStandardFontDataFactory")}};if(vi.NodeStandardFontDataFactory=Ei,$i.isNodeJS){const wi=function(Ci){return new Promise((ki,xi)=>{require$$5.readFile(Ci,(Ti,Oi)=>{!Ti&&Oi?ki(new Uint8Array(Oi)):xi(new Error(Ti))})})};vi.NodeCanvasFactory=Ai=class extends _i.BaseCanvasFactory{_createCanvas(Ci,ki){try{return require("canvas").createCanvas(Ci,ki)}catch{}}},vi.NodeCMapReaderFactory=Si=class extends _i.BaseCMapReaderFactory{_fetchData(Ci,ki){return wi(Ci).then(xi=>({cMapData:xi,compressionType:ki}))}},vi.NodeStandardFontDataFactory=Ei=class extends _i.BaseStandardFontDataFactory{_fetchData(Ci){return wi(Ci)}}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.AnnotationStorage=void 0;var _i=bi(1);vi.AnnotationStorage=class{constructor(){this._storage=new Map,this._timeStamp=Date.now(),this._modified=!1,this.onSetModified=null,this.onResetModified=null}getValue($i,Pi){const Ai=this._storage.get($i);return Ai===void 0?Pi:Object.assign(Pi,Ai)}setValue($i,Pi){const Ai=this._storage.get($i);let Si=!1;if(Ai!==void 0)for(const[Ei,wi]of Object.entries(Pi))Ai[Ei]!==wi&&(Si=!0,Ai[Ei]=wi);else Si=!0,this._storage.set($i,Pi);Si&&(this._timeStamp=Date.now(),this._setModified())}getAll(){return this._storage.size>0?(0,_i.objectFromMap)(this._storage):null}get size(){return this._storage.size}_setModified(){this._modified||(this._modified=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this._modified&&(this._modified=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get serializable(){return this._storage.size>0?this._storage:null}get lastModified(){return this._timeStamp.toString()}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.CanvasGraphics=void 0;var _i=bi(1),$i=bi(11),Pi=bi(5);const Ai=4096,Si=16;function Ei(zi){if(zi._transformStack&&(zi._transformStack=[]),!zi.mozCurrentTransform){zi._originalSave=zi.save,zi._originalRestore=zi.restore,zi._originalRotate=zi.rotate,zi._originalScale=zi.scale,zi._originalTranslate=zi.translate,zi._originalTransform=zi.transform,zi._originalSetTransform=zi.setTransform,zi._originalResetTransform=zi.resetTransform,zi._transformMatrix=zi._transformMatrix||[1,0,0,1,0,0],zi._transformStack=[];try{const Di=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(zi),"lineWidth");zi._setLineWidth=Di.set,zi._getLineWidth=Di.get,Object.defineProperty(zi,"lineWidth",{set:function(Ui){this._setLineWidth(1.000001*Ui)},get:function(){return this._getLineWidth()}})}catch{}Object.defineProperty(zi,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(zi,"mozCurrentTransformInverse",{get:function(){const[Di,Ui,Hi,qi,Gi,Ki]=this._transformMatrix,Qi=Di*qi-Ui*Hi,Xi=Ui*Hi-Di*qi;return[qi/Qi,Ui/Xi,Hi/Xi,Di/Qi,(qi*Gi-Hi*Ki)/Xi,(Ui*Gi-Di*Ki)/Qi]}}),zi.save=function(){const Di=this._transformMatrix;this._transformStack.push(Di),this._transformMatrix=Di.slice(0,6),this._originalSave()},zi.restore=function(){this._transformStack.length===0&&(0,_i.warn)("Tried to restore a ctx when the stack was already empty.");const Di=this._transformStack.pop();Di&&(this._transformMatrix=Di,this._originalRestore())},zi.translate=function(Di,Ui){const Hi=this._transformMatrix;Hi[4]=Hi[0]*Di+Hi[2]*Ui+Hi[4],Hi[5]=Hi[1]*Di+Hi[3]*Ui+Hi[5],this._originalTranslate(Di,Ui)},zi.scale=function(Di,Ui){const Hi=this._transformMatrix;Hi[0]*=Di,Hi[1]*=Di,Hi[2]*=Ui,Hi[3]*=Ui,this._originalScale(Di,Ui)},zi.transform=function(Di,Ui,Hi,qi,Gi,Ki){const Qi=this._transformMatrix;this._transformMatrix=[Qi[0]*Di+Qi[2]*Ui,Qi[1]*Di+Qi[3]*Ui,Qi[0]*Hi+Qi[2]*qi,Qi[1]*Hi+Qi[3]*qi,Qi[0]*Gi+Qi[2]*Ki+Qi[4],Qi[1]*Gi+Qi[3]*Ki+Qi[5]],zi._originalTransform(Di,Ui,Hi,qi,Gi,Ki)},zi.setTransform=function(Di,Ui,Hi,qi,Gi,Ki){this._transformMatrix=[Di,Ui,Hi,qi,Gi,Ki],zi._originalSetTransform(Di,Ui,Hi,qi,Gi,Ki)},zi.resetTransform=function(){this._transformMatrix=[1,0,0,1,0,0],zi._originalResetTransform()},zi.rotate=function(Di){const Ui=Math.cos(Di),Hi=Math.sin(Di),qi=this._transformMatrix;this._transformMatrix=[qi[0]*Ui+qi[2]*Hi,qi[1]*Ui+qi[3]*Hi,qi[0]*-Hi+qi[2]*Ui,qi[1]*-Hi+qi[3]*Ui,qi[4],qi[5]],this._originalRotate(Di)}}}class wi{constructor(Di){this.canvasFactory=Di,this.cache=Object.create(null)}getCanvas(Di,Ui,Hi,qi){let Gi;return this.cache[Di]!==void 0?(Gi=this.cache[Di],this.canvasFactory.reset(Gi,Ui,Hi),Gi.context.setTransform(1,0,0,1,0,0)):(Gi=this.canvasFactory.create(Ui,Hi),this.cache[Di]=Gi),qi&&Ei(Gi.context),Gi}clear(){for(const Di in this.cache){const Ui=this.cache[Di];this.canvasFactory.destroy(Ui),delete this.cache[Di]}}}class Ci{constructor(Di,Ui){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=_i.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=_i.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=_i.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=null,this.startNewPathAndClipBox([0,0,Di,Ui])}clone(){const Di=Object.create(this);return Di.clipBox=this.clipBox.slice(),Di}setCurrentPoint(Di,Ui){this.x=Di,this.y=Ui}updatePathMinMax(Di,Ui,Hi){[Ui,Hi]=_i.Util.applyTransform([Ui,Hi],Di),this.minX=Math.min(this.minX,Ui),this.minY=Math.min(this.minY,Hi),this.maxX=Math.max(this.maxX,Ui),this.maxY=Math.max(this.maxY,Hi)}updateCurvePathMinMax(Di,Ui,Hi,qi,Gi,Ki,Qi,Xi,rr){const ar=_i.Util.bezierBoundingBox(Ui,Hi,qi,Gi,Ki,Qi,Xi,rr);this.updatePathMinMax(Di,ar[0],ar[1]),this.updatePathMinMax(Di,ar[2],ar[3])}getPathBoundingBox(Di=$i.PathType.FILL,Ui=null){const Hi=[this.minX,this.minY,this.maxX,this.maxY];if(Di===$i.PathType.STROKE){Ui||(0,_i.unreachable)("Stroke bounding box must include transform.");const qi=_i.Util.singularValueDecompose2dScale(Ui),Gi=qi[0]*this.lineWidth/2,Ki=qi[1]*this.lineWidth/2;Hi[0]-=Gi,Hi[1]-=Ki,Hi[2]+=Gi,Hi[3]+=Ki}return Hi}updateClipFromPath(){const Di=_i.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(Di||[0,0,0,0])}startNewPathAndClipBox(Di){this.clipBox=Di,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(Di=$i.PathType.FILL,Ui=null){return _i.Util.intersect(this.clipBox,this.getPathBoundingBox(Di,Ui))}}function ki(zi,Di,Ui=null){if(typeof ImageData<"u"&&Di instanceof ImageData){zi.putImageData(Di,0,0);return}const Hi=Di.height,qi=Di.width,Gi=Hi%Si,Ki=(Hi-Gi)/Si,Qi=Gi===0?Ki:Ki+1,Xi=zi.createImageData(qi,Si);let rr,ar=0;const gr=Di.data,fr=Xi.data;let lr,mr,vr,Yi,nr,ir,cr,tr;if(Ui)switch(Ui.length){case 1:nr=Ui[0],ir=Ui[0],cr=Ui[0],tr=Ui[0];break;case 4:nr=Ui[0],ir=Ui[1],cr=Ui[2],tr=Ui[3]}if(Di.kind===_i.ImageKind.GRAYSCALE_1BPP){const dr=gr.byteLength,Ji=new Uint32Array(fr.buffer,0,fr.byteLength>>2),sr=Ji.length,pr=qi+7>>3;let or=4294967295,Zi=_i.IsLittleEndianCached.value?4278190080:255;for(tr&&tr[0]===255&&tr[255]===0&&([or,Zi]=[Zi,or]),lr=0;lrpr?qi:8*er-7,_r=-8&ur;let $r=0,Pr=0;for(;hr<_r;hr+=8)Pr=gr[ar++],Ji[rr++]=128&Pr?or:Zi,Ji[rr++]=64&Pr?or:Zi,Ji[rr++]=32&Pr?or:Zi,Ji[rr++]=16&Pr?or:Zi,Ji[rr++]=8&Pr?or:Zi,Ji[rr++]=4&Pr?or:Zi,Ji[rr++]=2&Pr?or:Zi,Ji[rr++]=1&Pr?or:Zi;for(;hr>=1}for(;rr=Ki&&(vr=Gi,Yi=qi*vr),rr=0,mr=Yi;mr--;)fr[rr++]=gr[ar++],fr[rr++]=gr[ar++],fr[rr++]=gr[ar++],fr[rr++]=255;if(dr)for(let Ji=0;Ji>=1}zi.putImageData(Qi,0,gr*Si)}}function Ti(zi,Di){const Ui=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let Hi=0,qi=Ui.length;Hi>8,zi[Gi-2]=zi[Gi-2]*Ki+Ui*Qi>>8,zi[Gi-1]=zi[Gi-1]*Ki+Hi*Qi>>8}}}function Li(zi,Di,Ui){const Hi=zi.length;for(let qi=3;qi>8]>>8:Di[qi]*Gi>>16}}function Mi(zi,Di,Ui,Hi){const qi=Hi[0],Gi=Hi[1],Ki=Hi[2]-qi,Qi=Hi[3]-Gi;Ki!==0&&Qi!==0&&(function(Xi,rr,ar,gr,fr,lr,mr,vr,Yi,nr,ir){const cr=!!lr,tr=cr?lr[0]:0,dr=cr?lr[1]:0,Ji=cr?lr[2]:0;let sr;sr=fr==="Luminosity"?Ii:Li;const pr=Math.min(gr,Math.ceil(1048576/ar));for(let or=0;or10&&typeof Hi=="function",ar=rr?Date.now()+15:0;let gr=0;const fr=this.commonObjs,lr=this.objs;let mr;for(;;){if(qi!==void 0&&Qi===qi.nextBreakPoint)return qi.breakIt(Qi,Hi),Qi;if(mr=Ki[Qi],mr!==_i.OPS.dependency)this[mr].apply(this,Gi[Qi]);else for(const vr of Gi[Qi]){const Yi=vr.startsWith("g_")?fr:lr;if(!Yi.has(vr))return Yi.get(vr,Hi),Qi}if(Qi++,Qi===Xi)return Qi;if(rr&&++gr>10){if(Date.now()>ar)return Hi(),Qi;gr=0}}}endDrawing(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(Di,Ui){const Hi=Di.width,qi=Di.height;let Gi,Ki,Qi=Math.max(Math.hypot(Ui[0],Ui[1]),1),Xi=Math.max(Math.hypot(Ui[2],Ui[3]),1),rr=Hi,ar=qi,gr="prescale1";for(;Qi>2&&rr>1||Xi>2&&ar>1;){let fr=rr,lr=ar;Qi>2&&rr>1&&(fr=Math.ceil(rr/2),Qi/=rr/fr),Xi>2&&ar>1&&(lr=Math.ceil(ar/2),Xi/=ar/lr),Gi=this.cachedCanvases.getCanvas(gr,fr,lr),Ki=Gi.context,Ki.clearRect(0,0,fr,lr),Ki.drawImage(Di,0,0,rr,ar,0,0,fr,lr),Di=Gi.canvas,rr=fr,ar=lr,gr=gr==="prescale1"?"prescale2":"prescale1"}return{img:Di,paintWidth:rr,paintHeight:ar}}_createMaskCanvas(Di){const Ui=this.ctx,Hi=Di.width,qi=Di.height,Gi=this.current.fillColor,Ki=this.current.patternFill,Qi=this.cachedCanvases.getCanvas("maskCanvas",Hi,qi);xi(Qi.context,Di);const Xi=Ui.mozCurrentTransform;let rr=_i.Util.transform(Xi,[1/Hi,0,0,-1/qi,0,0]);rr=_i.Util.transform(rr,[1,0,0,1,0,-qi]);const ar=_i.Util.applyTransform([0,0],rr),gr=_i.Util.applyTransform([Hi,qi],rr),fr=_i.Util.normalizeRect([ar[0],ar[1],gr[0],gr[1]]),lr=Math.ceil(fr[2]-fr[0]),mr=Math.ceil(fr[3]-fr[1]),vr=this.cachedCanvases.getCanvas("fillCanvas",lr,mr,!0),Yi=vr.context,nr=Math.min(ar[0],gr[0]),ir=Math.min(ar[1],gr[1]);Yi.translate(-nr,-ir),Yi.transform.apply(Yi,rr);const cr=this._scaleImage(Qi.canvas,Yi.mozCurrentTransformInverse);Yi.imageSmoothingEnabled=Fi(Yi.mozCurrentTransform,Di.interpolate),Yi.drawImage(cr.img,0,0,cr.img.width,cr.img.height,0,0,Hi,qi),Yi.globalCompositeOperation="source-in";const tr=_i.Util.transform(Yi.mozCurrentTransformInverse,[1,0,0,1,-nr,-ir]);return Yi.fillStyle=Ki?Gi.getPattern(Ui,this,tr,$i.PathType.FILL):Gi,Yi.fillRect(0,0,Hi,qi),{canvas:vr.canvas,offsetX:Math.round(nr),offsetY:Math.round(ir)}}setLineWidth(Di){this.current.lineWidth=Di,this.ctx.lineWidth=Di}setLineCap(Di){this.ctx.lineCap=Bi[Di]}setLineJoin(Di){this.ctx.lineJoin=Ri[Di]}setMiterLimit(Di){this.ctx.miterLimit=Di}setDash(Di,Ui){const Hi=this.ctx;Hi.setLineDash!==void 0&&(Hi.setLineDash(Di),Hi.lineDashOffset=Ui)}setRenderingIntent(Di){}setFlatness(Di){}setGState(Di){for(let Ui=0,Hi=Di.length;Ui{Ki.save=Ki.__originalSave,Ki.restore=Ki.__originalRestore,Ki.rotate=Ki.__originalRotate,Ki.scale=Ki.__originalScale,Ki.translate=Ki.__originalTranslate,Ki.transform=Ki.__originalTransform,Ki.setTransform=Ki.__originalSetTransform,Ki.resetTransform=Ki.__originalResetTransform,Ki.clip=Ki.__originalClip,Ki.moveTo=Ki.__originalMoveTo,Ki.lineTo=Ki.__originalLineTo,Ki.bezierCurveTo=Ki.__originalBezierCurveTo,Ki.rect=Ki.__originalRect,Ki.closePath=Ki.__originalClosePath,Ki.beginPath=Ki.__originalBeginPath,delete Ki._removeMirroring},Ki.save=function(){Qi.save(),this.__originalSave()},Ki.restore=function(){Qi.restore(),this.__originalRestore()},Ki.translate=function(Xi,rr){Qi.translate(Xi,rr),this.__originalTranslate(Xi,rr)},Ki.scale=function(Xi,rr){Qi.scale(Xi,rr),this.__originalScale(Xi,rr)},Ki.transform=function(Xi,rr,ar,gr,fr,lr){Qi.transform(Xi,rr,ar,gr,fr,lr),this.__originalTransform(Xi,rr,ar,gr,fr,lr)},Ki.setTransform=function(Xi,rr,ar,gr,fr,lr){Qi.setTransform(Xi,rr,ar,gr,fr,lr),this.__originalSetTransform(Xi,rr,ar,gr,fr,lr)},Ki.resetTransform=function(){Qi.resetTransform(),this.__originalResetTransform()},Ki.rotate=function(Xi){Qi.rotate(Xi),this.__originalRotate(Xi)},Ki.clip=function(Xi){Qi.clip(Xi),this.__originalClip(Xi)},Ki.moveTo=function(Xi,rr){Qi.moveTo(Xi,rr),this.__originalMoveTo(Xi,rr)},Ki.lineTo=function(Xi,rr){Qi.lineTo(Xi,rr),this.__originalLineTo(Xi,rr)},Ki.bezierCurveTo=function(Xi,rr,ar,gr,fr,lr){Qi.bezierCurveTo(Xi,rr,ar,gr,fr,lr),this.__originalBezierCurveTo(Xi,rr,ar,gr,fr,lr)},Ki.rect=function(Xi,rr,ar,gr){Qi.rect(Xi,rr,ar,gr),this.__originalRect(Xi,rr,ar,gr)},Ki.closePath=function(){Qi.closePath(),this.__originalClosePath()},Ki.beginPath=function(){Qi.beginPath(),this.__originalBeginPath()}}(Gi,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Ti(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(Di){if(!this.current.activeSMask)return;Di?(Di[0]=Math.floor(Di[0]),Di[1]=Math.floor(Di[1]),Di[2]=Math.ceil(Di[2]),Di[3]=Math.ceil(Di[3])):Di=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const Ui=this.current.activeSMask;Mi(this.suspendedCtx,Ui,this.ctx,Di),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(Ti(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const Di=this.current;this.stateStack.push(Di),this.current=Di.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Ti(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedGetSinglePixelWidth=null)}transform(Di,Ui,Hi,qi,Gi,Ki){this.ctx.transform(Di,Ui,Hi,qi,Gi,Ki),this._cachedGetSinglePixelWidth=null}constructPath(Di,Ui){const Hi=this.ctx,qi=this.current;let Gi,Ki,Qi=qi.x,Xi=qi.y;for(let rr=0,ar=0,gr=Di.length;rr=this.current.lineWidth?(Ui.save(),Ui.resetTransform(),Ui.lineWidth=Math.floor(this._combinedScaleFactor),Ui.stroke(),Ui.restore()):(Ui.lineWidth=Math.max(qi,this.current.lineWidth),Ui.stroke())}Di&&this.consumePath(this.current.getClippedPathBoundingBox()),Ui.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(Di){Di=Di===void 0||Di;const Ui=this.ctx,Hi=this.current.fillColor;let qi=!1;this.current.patternFill&&(Ui.save(),Ui.fillStyle=Hi.getPattern(Ui,this,Ui.mozCurrentTransformInverse,$i.PathType.FILL),qi=!0);const Gi=this.current.getClippedPathBoundingBox();this.contentVisible&&Gi!==null&&(this.pendingEOFill?(Ui.fill("evenodd"),this.pendingEOFill=!1):Ui.fill()),qi&&Ui.restore(),Di&&this.consumePath(Gi)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Vi}eoClip(){this.pendingClip=Ni}beginText(){this.current.textMatrix=_i.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const Di=this.pendingTextPaths,Ui=this.ctx;if(Di!==void 0){Ui.save(),Ui.beginPath();for(let Hi=0;Hi100&&(rr=100),this.current.fontSizeScale=Ui/rr,this.ctx.font=`${Qi} ${Ki} ${rr}px ${Xi}`}setTextRenderingMode(Di){this.current.textRenderingMode=Di}setTextRise(Di){this.current.textRise=Di}moveText(Di,Ui){this.current.x=this.current.lineX+=Di,this.current.y=this.current.lineY+=Ui}setLeadingMoveText(Di,Ui){this.setLeading(-Ui),this.moveText(Di,Ui)}setTextMatrix(Di,Ui,Hi,qi,Gi,Ki){this.current.textMatrix=[Di,Ui,Hi,qi,Gi,Ki],this.current.textMatrixScale=Math.hypot(Di,Ui),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(Di,Ui,Hi,qi,Gi){const Ki=this.ctx,Qi=this.current,Xi=Qi.font,rr=Qi.textRenderingMode,ar=Qi.fontSize/Qi.fontSizeScale,gr=rr&_i.TextRenderingMode.FILL_STROKE_MASK,fr=!!(rr&_i.TextRenderingMode.ADD_TO_PATH_FLAG),lr=Qi.patternFill&&!Xi.missingFile;let mr;(Xi.disableFontFace||fr||lr)&&(mr=Xi.getPathGenerator(this.commonObjs,Di)),Xi.disableFontFace||lr?(Ki.save(),Ki.translate(Ui,Hi),Ki.beginPath(),mr(Ki,ar),qi&&Ki.setTransform.apply(Ki,qi),gr!==_i.TextRenderingMode.FILL&&gr!==_i.TextRenderingMode.FILL_STROKE||Ki.fill(),(gr===_i.TextRenderingMode.STROKE||gr===_i.TextRenderingMode.FILL_STROKE)&&(Gi&&(Ki.resetTransform(),Ki.lineWidth=Math.floor(this._combinedScaleFactor)),Ki.stroke()),Ki.restore()):(gr!==_i.TextRenderingMode.FILL&&gr!==_i.TextRenderingMode.FILL_STROKE||Ki.fillText(Di,Ui,Hi),(gr===_i.TextRenderingMode.STROKE||gr===_i.TextRenderingMode.FILL_STROKE)&&(Gi?(Ki.save(),Ki.moveTo(Ui,Hi),Ki.resetTransform(),Ki.lineWidth=Math.floor(this._combinedScaleFactor),Ki.strokeText(Di,0,0),Ki.restore()):Ki.strokeText(Di,Ui,Hi))),fr&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ki.mozCurrentTransform,x:Ui,y:Hi,fontSize:ar,addToPath:mr})}get isFontSubpixelAAEnabled(){const{context:Di}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);Di.scale(1.5,1),Di.fillText("I",0,10);const Ui=Di.getImageData(0,0,10,10).data;let Hi=!1;for(let qi=3;qi0&&Ui[qi]<255){Hi=!0;break}return(0,_i.shadow)(this,"isFontSubpixelAAEnabled",Hi)}showText(Di){const Ui=this.current,Hi=Ui.font;if(Hi.isType3Font)return this.showType3Text(Di);const qi=Ui.fontSize;if(qi===0)return;const Gi=this.ctx,Ki=Ui.fontSizeScale,Qi=Ui.charSpacing,Xi=Ui.wordSpacing,rr=Ui.fontDirection,ar=Ui.textHScale*rr,gr=Di.length,fr=Hi.vertical,lr=fr?1:-1,mr=Hi.defaultVMetrics,vr=qi*Ui.fontMatrix[0],Yi=Ui.textRenderingMode===_i.TextRenderingMode.FILL&&!Hi.disableFontFace&&!Ui.patternFill;Gi.save(),Gi.transform.apply(Gi,Ui.textMatrix),Gi.translate(Ui.x,Ui.y+Ui.textRise),rr>0?Gi.scale(ar,-1):Gi.scale(ar,1);let nr;if(Ui.patternFill){Gi.save();const sr=Ui.fillColor.getPattern(Gi,this,Gi.mozCurrentTransformInverse,$i.PathType.FILL);nr=Gi.mozCurrentTransform,Gi.restore(),Gi.fillStyle=sr}let ir=Ui.lineWidth,cr=!1;const tr=Ui.textMatrixScale;if(tr===0||ir===0){const sr=Ui.textRenderingMode&_i.TextRenderingMode.FILL_STROKE_MASK;(sr===_i.TextRenderingMode.STROKE||sr===_i.TextRenderingMode.FILL_STROKE)&&(this._cachedGetSinglePixelWidth=null,ir=this.getSinglePixelWidth(),cr=ir<0)}else ir/=tr;Ki!==1&&(Gi.scale(Ki,Ki),ir/=Ki),Gi.lineWidth=ir;let dr,Ji=0;for(dr=0;dr0){const Pr=1e3*Gi.measureText(Zi).width/qi*Ki;if($rnew Wi(Ki,this.commonObjs,this.objs,this.canvasFactory)};Ui=new $i.TilingPattern(Di,Hi,this.ctx,Gi,qi)}else Ui=this._getPattern(Di[1],Di[2]);return Ui}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(Di,Ui,Hi){const qi=_i.Util.makeHexColor(Di,Ui,Hi);this.ctx.strokeStyle=qi,this.current.strokeColor=qi}setFillRGBColor(Di,Ui,Hi){const qi=_i.Util.makeHexColor(Di,Ui,Hi);this.ctx.fillStyle=qi,this.current.fillColor=qi,this.current.patternFill=!1}_getPattern(Di,Ui=null){let Hi;return this.cachedPatterns.has(Di)?Hi=this.cachedPatterns.get(Di):(Hi=(0,$i.getShadingPattern)(this.objs.get(Di)),this.cachedPatterns.set(Di,Hi)),Ui&&(Hi.matrix=Ui),Hi}shadingFill(Di){if(!this.contentVisible)return;const Ui=this.ctx;this.save();const Hi=this._getPattern(Di);Ui.fillStyle=Hi.getPattern(Ui,this,Ui.mozCurrentTransformInverse,$i.PathType.SHADING);const qi=Ui.mozCurrentTransformInverse;if(qi){const Gi=Ui.canvas,Ki=Gi.width,Qi=Gi.height,Xi=_i.Util.applyTransform([0,0],qi),rr=_i.Util.applyTransform([0,Qi],qi),ar=_i.Util.applyTransform([Ki,0],qi),gr=_i.Util.applyTransform([Ki,Qi],qi),fr=Math.min(Xi[0],rr[0],ar[0],gr[0]),lr=Math.min(Xi[1],rr[1],ar[1],gr[1]),mr=Math.max(Xi[0],rr[0],ar[0],gr[0]),vr=Math.max(Xi[1],rr[1],ar[1],gr[1]);this.ctx.fillRect(fr,lr,mr-fr,vr-lr)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,_i.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,_i.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(Di,Ui){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(Di)&&Di.length===6&&this.transform.apply(this,Di),this.baseTransform=this.ctx.mozCurrentTransform,Ui)){const Hi=Ui[2]-Ui[0],qi=Ui[3]-Ui[1];this.ctx.rect(Ui[0],Ui[1],Hi,qi),this.current.updatePathMinMax(this.ctx.mozCurrentTransform,Ui[0],Ui[1]),this.current.updatePathMinMax(this.ctx.mozCurrentTransform,Ui[2],Ui[3]),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(Di){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const Ui=this.ctx;Di.isolated||(0,_i.info)("TODO: Support non-isolated groups."),Di.knockout&&(0,_i.warn)("Knockout groups not supported.");const Hi=Ui.mozCurrentTransform;if(Di.matrix&&Ui.transform.apply(Ui,Di.matrix),!Di.bbox)throw new Error("Bounding box is required.");let qi=_i.Util.getAxialAlignedBoundingBox(Di.bbox,Ui.mozCurrentTransform);const Gi=[0,0,Ui.canvas.width,Ui.canvas.height];qi=_i.Util.intersect(qi,Gi)||[0,0,0,0];const Ki=Math.floor(qi[0]),Qi=Math.floor(qi[1]);let Xi=Math.max(Math.ceil(qi[2])-Ki,1),rr=Math.max(Math.ceil(qi[3])-Qi,1),ar=1,gr=1;Xi>Ai&&(ar=Xi/Ai,Xi=Ai),rr>Ai&&(gr=rr/Ai,rr=Ai),this.current.startNewPathAndClipBox([0,0,Xi,rr]);let fr="groupAt"+this.groupLevel;Di.smask&&(fr+="_smask_"+this.smaskCounter++%2);const lr=this.cachedCanvases.getCanvas(fr,Xi,rr,!0),mr=lr.context;mr.scale(1/ar,1/gr),mr.translate(-Ki,-Qi),mr.transform.apply(mr,Hi),Di.smask?this.smaskStack.push({canvas:lr.canvas,context:mr,offsetX:Ki,offsetY:Qi,scaleX:ar,scaleY:gr,subtype:Di.smask.subtype,backdrop:Di.smask.backdrop,transferMap:Di.smask.transferMap||null,startTransformInverse:null}):(Ui.setTransform(1,0,0,1,0,0),Ui.translate(Ki,Qi),Ui.scale(ar,gr),Ui.save()),Ti(Ui,mr),this.ctx=mr,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(Ui),this.groupLevel++}endGroup(Di){if(!this.contentVisible)return;this.groupLevel--;const Ui=this.ctx,Hi=this.groupStack.pop();if(this.ctx=Hi,this.ctx.imageSmoothingEnabled=!1,Di.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const qi=this.ctx.mozCurrentTransform;this.restore(),this.ctx.save(),this.ctx.setTransform.apply(this.ctx,qi);const Gi=_i.Util.getAxialAlignedBoundingBox([0,0,Ui.canvas.width,Ui.canvas.height],qi);this.ctx.drawImage(Ui.canvas,0,0),this.ctx.restore(),this.compose(Gi)}}beginAnnotations(){this.save(),this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)}endAnnotations(){this.restore()}beginAnnotation(Di,Ui,Hi,qi,Gi){if(this.save(),Array.isArray(Ui)&&Ui.length===4){const Ki=Ui[2]-Ui[0],Qi=Ui[3]-Ui[1];if(Gi&&this.annotationCanvasMap){(Hi=Hi.slice())[4]-=Ui[0],Hi[5]-=Ui[1],(Ui=Ui.slice())[0]=Ui[1]=0,Ui[2]=Ki,Ui[3]=Qi;const[Xi,rr]=_i.Util.singularValueDecompose2dScale(this.ctx.mozCurrentTransform),{viewportScale:ar}=this,gr=Math.ceil(Ki*this.outputScaleX*ar),fr=Math.ceil(Qi*this.outputScaleY*ar);this.annotationCanvas=this.canvasFactory.create(gr,fr);const{canvas:lr,context:mr}=this.annotationCanvas;lr.style.width=`calc(${Ki}px * var(--viewport-scale-factor))`,lr.style.height=`calc(${Qi}px * var(--viewport-scale-factor))`,this.annotationCanvasMap.set(Di,lr),this.annotationCanvas.savedCtx=this.ctx,this.ctx=mr,this.ctx.setTransform(Xi,0,0,-rr,0,Qi*rr),Ei(this.ctx),Oi(this.ctx)}else Oi(this.ctx),this.ctx.rect(Ui[0],Ui[1],Ki,Qi),this.clip(),this.endPath()}this.current=new Ci(this.ctx.canvas.width,this.ctx.canvas.height),this.transform.apply(this,Hi),this.transform.apply(this,qi)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.restore()}paintImageMaskXObject(Di){if(!this.contentVisible)return;const Ui=this.ctx,Hi=Di.width,qi=Di.height,Gi=this.processingType3;if(Gi&&Gi.compiled===void 0&&(Gi.compiled=Hi<=1e3&&qi<=1e3?function(Xi){const rr=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),ar=Xi.width,gr=Xi.height,fr=ar+1;let lr,mr,vr,Yi;const nr=new Uint8Array(fr*(gr+1)),ir=ar+7&-8,cr=Xi.data,tr=new Uint8Array(ir*gr);let dr=0;for(lr=0,mr=cr.length;lr0;)tr[dr++]=or&Zi?0:255,Zi>>=1}let Ji=0;for(dr=0,tr[dr]!==0&&(nr[0]=1,++Ji),vr=1;vr>2)+(tr[dr+1]?4:0)+(tr[dr-ir+1]?8:0),rr[or]&&(nr[Yi+vr]=rr[or],++Ji),dr++;if(tr[dr-ir]!==tr[dr]&&(nr[Yi+vr]=tr[dr]?2:4,++Ji),Ji>1e3)return null}for(dr=ir*(gr-1),Yi=lr*fr,tr[dr]!==0&&(nr[Yi]=8,++Ji),vr=1;vr1e3)return null;const sr=new Int32Array([0,fr,-1,0,-fr,0,0,0,1]),pr=[];for(lr=0;Ji&&lr<=gr;lr++){let or=lr*fr;const Zi=or+ar;for(;or>4,nr[or]&=ur>>2|ur<<2),er.push(or%fr,or/fr|0),nr[or]||--Ji}while(hr!==or);pr.push(er),--lr}return function(or){or.save(),or.scale(1/ar,-1/gr),or.translate(0,-gr),or.beginPath();for(let Zi=0,er=pr.length;Zi1?this._cachedGetSinglePixelWidth=-this._combinedScaleFactor*Gi:Ui>Number.EPSILON?this._cachedGetSinglePixelWidth=Gi:this._cachedGetSinglePixelWidth=1}return this._cachedGetSinglePixelWidth}getCanvasPosition(Di,Ui){const Hi=this.ctx.mozCurrentTransform;return[Hi[0]*Di+Hi[2]*Ui+Hi[4],Hi[1]*Di+Hi[3]*Ui+Hi[5]]}isContentVisible(){for(let Di=this.markedContentStack.length-1;Di>=0;Di--)if(!this.markedContentStack[Di].visible)return!1;return!0}}vi.CanvasGraphics=Wi;for(const zi in _i.OPS)Wi.prototype[zi]!==void 0&&(Wi.prototype[_i.OPS[zi]]=Wi.prototype[zi])},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.TilingPattern=vi.PathType=void 0,vi.getShadingPattern=function(ji){switch(ji[0]){case"RadialAxial":return new Si(ji);case"Mesh":return new Ci(ji);case"Dummy":return new ki}throw new Error(`Unknown IR type: ${ji[0]}`)};var _i=bi(1);const $i={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};vi.PathType=$i;function Pi(ji,Li){if(!Li||typeof Path2D>"u")return;const Ii=Li[2]-Li[0],Mi=Li[3]-Li[1],Fi=new Path2D;Fi.rect(Li[0],Li[1],Ii,Mi),ji.clip(Fi)}class Ai{constructor(){this.constructor===Ai&&(0,_i.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,_i.unreachable)("Abstract method `getPattern` called.")}}class Si extends Ai{constructor(Li){super(),this._type=Li[1],this._bbox=Li[2],this._colorStops=Li[3],this._p0=Li[4],this._p1=Li[5],this._r0=Li[6],this._r1=Li[7],this.matrix=null}_createGradient(Li){let Ii;this._type==="axial"?Ii=Li.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(Ii=Li.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const Mi of this._colorStops)Ii.addColorStop(Mi[0],Mi[1]);return Ii}getPattern(Li,Ii,Mi,Fi){let Bi;if(Fi===$i.STROKE||Fi===$i.FILL){const Ri=Ii.current.getClippedPathBoundingBox(Fi,Li.mozCurrentTransform)||[0,0,0,0],Vi=Math.ceil(Ri[2]-Ri[0])||1,Ni=Math.ceil(Ri[3]-Ri[1])||1,Wi=Ii.cachedCanvases.getCanvas("pattern",Vi,Ni,!0),zi=Wi.context;zi.clearRect(0,0,zi.canvas.width,zi.canvas.height),zi.beginPath(),zi.rect(0,0,zi.canvas.width,zi.canvas.height),zi.translate(-Ri[0],-Ri[1]),Mi=_i.Util.transform(Mi,[1,0,0,1,Ri[0],Ri[1]]),zi.transform.apply(zi,Ii.baseTransform),this.matrix&&zi.transform.apply(zi,this.matrix),Pi(zi,this._bbox),zi.fillStyle=this._createGradient(zi),zi.fill(),Bi=Li.createPattern(Wi.canvas,"no-repeat");const Di=new DOMMatrix(Mi);try{Bi.setTransform(Di)}catch(Ui){(0,_i.warn)(`RadialAxialShadingPattern.getPattern: "${Ui==null?void 0:Ui.message}".`)}}else Pi(Li,this._bbox),Bi=this._createGradient(Li);return Bi}}function Ei(ji,Li,Ii,Mi,Fi,Bi,Ri,Vi){const Ni=Li.coords,Wi=Li.colors,zi=ji.data,Di=4*ji.width;let Ui;Ni[Ii+1]>Ni[Mi+1]&&(Ui=Ii,Ii=Mi,Mi=Ui,Ui=Bi,Bi=Ri,Ri=Ui),Ni[Mi+1]>Ni[Fi+1]&&(Ui=Mi,Mi=Fi,Fi=Ui,Ui=Ri,Ri=Vi,Vi=Ui),Ni[Ii+1]>Ni[Mi+1]&&(Ui=Ii,Ii=Mi,Mi=Ui,Ui=Bi,Bi=Ri,Ri=Ui);const Hi=(Ni[Ii]+Li.offsetX)*Li.scaleX,qi=(Ni[Ii+1]+Li.offsetY)*Li.scaleY,Gi=(Ni[Mi]+Li.offsetX)*Li.scaleX,Ki=(Ni[Mi+1]+Li.offsetY)*Li.scaleY,Qi=(Ni[Fi]+Li.offsetX)*Li.scaleX,Xi=(Ni[Fi+1]+Li.offsetY)*Li.scaleY;if(qi>=Xi)return;const rr=Wi[Bi],ar=Wi[Bi+1],gr=Wi[Bi+2],fr=Wi[Ri],lr=Wi[Ri+1],mr=Wi[Ri+2],vr=Wi[Vi],Yi=Wi[Vi+1],nr=Wi[Vi+2],ir=Math.round(qi),cr=Math.round(Xi);let tr,dr,Ji,sr,pr,or,Zi,er;for(let hr=ir;hr<=cr;hr++){if(hrXi?1:Ki===Xi?0:(Ki-hr)/(Ki-Xi),tr=Gi-(Gi-Qi)*Sr,dr=fr-(fr-vr)*Sr,Ji=lr-(lr-Yi)*Sr,sr=mr-(mr-nr)*Sr}let ur;ur=hrXi?1:(qi-hr)/(qi-Xi),pr=Hi-(Hi-Qi)*ur,or=rr-(rr-vr)*ur,Zi=ar-(ar-Yi)*ur,er=gr-(gr-nr)*ur;const _r=Math.round(Math.min(tr,pr)),$r=Math.round(Math.max(tr,pr));let Pr=Di*hr+4*_r;for(let Sr=_r;Sr<=$r;Sr++)ur=(tr-Sr)/(tr-pr),ur<0?ur=0:ur>1&&(ur=1),zi[Pr++]=dr-(dr-or)*ur|0,zi[Pr++]=Ji-(Ji-Zi)*ur|0,zi[Pr++]=sr-(sr-er)*ur|0,zi[Pr++]=255}}function wi(ji,Li,Ii){const Mi=Li.coords,Fi=Li.colors;let Bi,Ri;switch(Li.type){case"lattice":const Vi=Li.verticesPerRow,Ni=Math.floor(Mi.length/Vi)-1,Wi=Vi-1;for(Bi=0;Bi=Fi?Bi=Fi:Mi=Bi/Li,{scale:Mi,size:Bi}}clipBbox(Li,Ii,Mi,Fi,Bi){const Ri=Fi-Ii,Vi=Bi-Mi;Li.ctx.rect(Ii,Mi,Ri,Vi),Li.clip(),Li.endPath()}setFillAndStrokeStyleToContext(Li,Ii,Mi){const Fi=Li.ctx,Bi=Li.current;switch(Ii){case xi:const Ri=this.ctx;Fi.fillStyle=Ri.fillStyle,Fi.strokeStyle=Ri.strokeStyle,Bi.fillColor=Ri.fillStyle,Bi.strokeColor=Ri.strokeStyle;break;case Ti:const Vi=_i.Util.makeHexColor(Mi[0],Mi[1],Mi[2]);Fi.fillStyle=Vi,Fi.strokeStyle=Vi,Bi.fillColor=Vi,Bi.strokeColor=Vi;break;default:throw new _i.FormatError(`Unsupported paint type: ${Ii}`)}}getPattern(Li,Ii,Mi,Fi){let Bi=Mi;Fi!==$i.SHADING&&(Bi=_i.Util.transform(Bi,Ii.baseTransform),this.matrix&&(Bi=_i.Util.transform(Bi,this.matrix)));const Ri=this.createPatternCanvas(Ii);let Vi=new DOMMatrix(Bi);Vi=Vi.translate(Ri.offsetX,Ri.offsetY),Vi=Vi.scale(1/Ri.scaleX,1/Ri.scaleY);const Ni=Li.createPattern(Ri.canvas,"repeat");try{Ni.setTransform(Vi)}catch(Wi){(0,_i.warn)(`TilingPattern.getPattern: "${Wi==null?void 0:Wi.message}".`)}return Ni}}vi.TilingPattern=Oi},(yi,vi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.GlobalWorkerOptions=void 0;const bi=Object.create(null);vi.GlobalWorkerOptions=bi,bi.workerPort=bi.workerPort===void 0?null:bi.workerPort,bi.workerSrc=bi.workerSrc===void 0?"":bi.workerSrc},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.MessageHandler=void 0;var _i=bi(1);const $i=1,Pi=2,Ai=1,Si=2,Ei=3,wi=4,Ci=5,ki=6,xi=7,Ti=8;function Oi(ji){switch(ji instanceof Error||typeof ji=="object"&&ji!==null||(0,_i.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),ji.name){case"AbortException":return new _i.AbortException(ji.message);case"MissingPDFException":return new _i.MissingPDFException(ji.message);case"PasswordException":return new _i.PasswordException(ji.message,ji.code);case"UnexpectedResponseException":return new _i.UnexpectedResponseException(ji.message,ji.status);case"UnknownErrorException":return new _i.UnknownErrorException(ji.message,ji.details);default:return new _i.UnknownErrorException(ji.message,ji.toString())}}vi.MessageHandler=class{constructor(ji,Li,Ii){this.sourceName=ji,this.targetName=Li,this.comObj=Ii,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=Mi=>{const Fi=Mi.data;if(Fi.targetName!==this.sourceName)return;if(Fi.stream){this._processStreamMessage(Fi);return}if(Fi.callback){const Ri=Fi.callbackId,Vi=this.callbackCapabilities[Ri];if(!Vi)throw new Error(`Cannot resolve callback ${Ri}`);if(delete this.callbackCapabilities[Ri],Fi.callback===$i)Vi.resolve(Fi.data);else{if(Fi.callback!==Pi)throw new Error("Unexpected callback case");Vi.reject(Oi(Fi.reason))}return}const Bi=this.actionHandler[Fi.action];if(!Bi)throw new Error(`Unknown action from worker: ${Fi.action}`);if(Fi.callbackId){const Ri=this.sourceName,Vi=Fi.sourceName;new Promise(function(Ni){Ni(Bi(Fi.data))}).then(function(Ni){Ii.postMessage({sourceName:Ri,targetName:Vi,callback:$i,callbackId:Fi.callbackId,data:Ni})},function(Ni){Ii.postMessage({sourceName:Ri,targetName:Vi,callback:Pi,callbackId:Fi.callbackId,reason:Oi(Ni)})})}else Fi.streamId?this._createStreamSink(Fi):Bi(Fi.data)},Ii.addEventListener("message",this._onComObjOnMessage)}on(ji,Li){const Ii=this.actionHandler;if(Ii[ji])throw new Error(`There is already an actionName called "${ji}"`);Ii[ji]=Li}send(ji,Li,Ii){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:ji,data:Li},Ii)}sendWithPromise(ji,Li,Ii){const Mi=this.callbackId++,Fi=(0,_i.createPromiseCapability)();this.callbackCapabilities[Mi]=Fi;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:ji,callbackId:Mi,data:Li},Ii)}catch(Bi){Fi.reject(Bi)}return Fi.promise}sendWithStream(ji,Li,Ii,Mi){const Fi=this.streamId++,Bi=this.sourceName,Ri=this.targetName,Vi=this.comObj;return new ReadableStream({start:Ni=>{const Wi=(0,_i.createPromiseCapability)();return this.streamControllers[Fi]={controller:Ni,startCall:Wi,pullCall:null,cancelCall:null,isClosed:!1},Vi.postMessage({sourceName:Bi,targetName:Ri,action:ji,streamId:Fi,data:Li,desiredSize:Ni.desiredSize},Mi),Wi.promise},pull:Ni=>{const Wi=(0,_i.createPromiseCapability)();return this.streamControllers[Fi].pullCall=Wi,Vi.postMessage({sourceName:Bi,targetName:Ri,stream:ki,streamId:Fi,desiredSize:Ni.desiredSize}),Wi.promise},cancel:Ni=>{(0,_i.assert)(Ni instanceof Error,"cancel must have a valid reason");const Wi=(0,_i.createPromiseCapability)();return this.streamControllers[Fi].cancelCall=Wi,this.streamControllers[Fi].isClosed=!0,Vi.postMessage({sourceName:Bi,targetName:Ri,stream:Ai,streamId:Fi,reason:Oi(Ni)}),Wi.promise}},Ii)}_createStreamSink(ji){const Li=ji.streamId,Ii=this.sourceName,Mi=ji.sourceName,Fi=this.comObj,Bi=this,Ri=this.actionHandler[ji.action],Vi={enqueue(Ni,Wi=1,zi){if(this.isCancelled)return;const Di=this.desiredSize;this.desiredSize-=Wi,Di>0&&this.desiredSize<=0&&(this.sinkCapability=(0,_i.createPromiseCapability)(),this.ready=this.sinkCapability.promise),Fi.postMessage({sourceName:Ii,targetName:Mi,stream:wi,streamId:Li,chunk:Ni},zi)},close(){this.isCancelled||(this.isCancelled=!0,Fi.postMessage({sourceName:Ii,targetName:Mi,stream:Ei,streamId:Li}),delete Bi.streamSinks[Li])},error(Ni){(0,_i.assert)(Ni instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,Fi.postMessage({sourceName:Ii,targetName:Mi,stream:Ci,streamId:Li,reason:Oi(Ni)}))},sinkCapability:(0,_i.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:ji.desiredSize,ready:null};Vi.sinkCapability.resolve(),Vi.ready=Vi.sinkCapability.promise,this.streamSinks[Li]=Vi,new Promise(function(Ni){Ni(Ri(ji.data,Vi))}).then(function(){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:Ti,streamId:Li,success:!0})},function(Ni){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:Ti,streamId:Li,reason:Oi(Ni)})})}_processStreamMessage(ji){const Li=ji.streamId,Ii=this.sourceName,Mi=ji.sourceName,Fi=this.comObj,Bi=this.streamControllers[Li],Ri=this.streamSinks[Li];switch(ji.stream){case Ti:ji.success?Bi.startCall.resolve():Bi.startCall.reject(Oi(ji.reason));break;case xi:ji.success?Bi.pullCall.resolve():Bi.pullCall.reject(Oi(ji.reason));break;case ki:if(!Ri){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:xi,streamId:Li,success:!0});break}Ri.desiredSize<=0&&ji.desiredSize>0&&Ri.sinkCapability.resolve(),Ri.desiredSize=ji.desiredSize,new Promise(function(Vi){Vi(Ri.onPull&&Ri.onPull())}).then(function(){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:xi,streamId:Li,success:!0})},function(Vi){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:xi,streamId:Li,reason:Oi(Vi)})});break;case wi:if((0,_i.assert)(Bi,"enqueue should have stream controller"),Bi.isClosed)break;Bi.controller.enqueue(ji.chunk);break;case Ei:if((0,_i.assert)(Bi,"close should have stream controller"),Bi.isClosed)break;Bi.isClosed=!0,Bi.controller.close(),this._deleteStreamController(Bi,Li);break;case Ci:(0,_i.assert)(Bi,"error should have stream controller"),Bi.controller.error(Oi(ji.reason)),this._deleteStreamController(Bi,Li);break;case Si:ji.success?Bi.cancelCall.resolve():Bi.cancelCall.reject(Oi(ji.reason)),this._deleteStreamController(Bi,Li);break;case Ai:if(!Ri)break;new Promise(function(Vi){Vi(Ri.onCancel&&Ri.onCancel(Oi(ji.reason)))}).then(function(){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:Si,streamId:Li,success:!0})},function(Vi){Fi.postMessage({sourceName:Ii,targetName:Mi,stream:Si,streamId:Li,reason:Oi(Vi)})}),Ri.sinkCapability.reject(Oi(ji.reason)),Ri.isCancelled=!0,delete this.streamSinks[Li];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(ji,Li){await Promise.allSettled([ji.startCall&&ji.startCall.promise,ji.pullCall&&ji.pullCall.promise,ji.cancelCall&&ji.cancelCall.promise]),delete this.streamControllers[Li]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(yi,vi,bi)=>{var $i,Pi,Ai;Object.defineProperty(vi,"__esModule",{value:!0}),vi.Metadata=void 0;var _i=bi(1);vi.Metadata=(Ai=class{constructor({parsedData:Si,rawData:Ei}){Er(this,$i,void 0);Er(this,Pi,void 0);Nr(this,$i,Si),Nr(this,Pi,Ei)}getRaw(){return Cr(this,Pi)}get(Si){var Ei;return(Ei=Cr(this,$i).get(Si))!=null?Ei:null}getAll(){return(0,_i.objectFromMap)(Cr(this,$i))}has(Si){return Cr(this,$i).has(Si)}},$i=new WeakMap,Pi=new WeakMap,Ai)},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.OptionalContentConfig=void 0;var _i=bi(1);class $i{constructor(Ai,Si){this.visible=!0,this.name=Ai,this.intent=Si}}vi.OptionalContentConfig=class{constructor(Pi){if(this.name=null,this.creator=null,this._order=null,this._groups=new Map,Pi!==null){this.name=Pi.name,this.creator=Pi.creator,this._order=Pi.order;for(const Ai of Pi.groups)this._groups.set(Ai.id,new $i(Ai.name,Ai.intent));if(Pi.baseState==="OFF")for(const Ai of this._groups)Ai.visible=!1;for(const Ai of Pi.on)this._groups.get(Ai).visible=!0;for(const Ai of Pi.off)this._groups.get(Ai).visible=!1}}_evaluateVisibilityExpression(Pi){const Ai=Pi.length;if(Ai<2)return!0;const Si=Pi[0];for(let Ei=1;Ei0?(0,_i.objectFromMap)(this._groups):null}getGroup(Pi){return this._groups.get(Pi)||null}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.PDFDataTransportStream=void 0;var _i=bi(1),$i=bi(5);vi.PDFDataTransportStream=class{constructor(Si,Ei){(0,_i.assert)(Ei,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=Si.progressiveDone||!1,this._contentDispositionFilename=Si.contentDispositionFilename||null;const wi=Si.initialData;if((wi==null?void 0:wi.length)>0){const Ci=new Uint8Array(wi).buffer;this._queuedChunks.push(Ci)}this._pdfDataRangeTransport=Ei,this._isStreamingSupported=!Si.disableStream,this._isRangeSupported=!Si.disableRange,this._contentLength=Si.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((Ci,ki)=>{this._onReceiveData({begin:Ci,chunk:ki})}),this._pdfDataRangeTransport.addProgressListener((Ci,ki)=>{this._onProgress({loaded:Ci,total:ki})}),this._pdfDataRangeTransport.addProgressiveReadListener(Ci=>{this._onReceiveData({chunk:Ci})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(Si){const Ei=new Uint8Array(Si.chunk).buffer;if(Si.begin===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(Ei):this._queuedChunks.push(Ei);else{const wi=this._rangeReaders.some(function(Ci){return Ci._begin!==Si.begin?!1:(Ci._enqueue(Ei),!0)});(0,_i.assert)(wi,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var Si,Ei;return(Ei=(Si=this._fullRequestReader)==null?void 0:Si._loaded)!=null?Ei:0}_onProgress(Si){if(Si.total===void 0){const Ei=this._rangeReaders[0];Ei!=null&&Ei.onProgress&&Ei.onProgress({loaded:Si.loaded})}else{const Ei=this._fullRequestReader;Ei!=null&&Ei.onProgress&&Ei.onProgress({loaded:Si.loaded,total:Si.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(Si){const Ei=this._rangeReaders.indexOf(Si);Ei>=0&&this._rangeReaders.splice(Ei,1)}getFullReader(){(0,_i.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const Si=this._queuedChunks;return this._queuedChunks=null,new Pi(this,Si,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(Si,Ei){if(Ei<=this._progressiveDataLength)return null;const wi=new Ai(this,Si,Ei);return this._pdfDataRangeTransport.requestDataRange(Si,Ei),this._rangeReaders.push(wi),wi}cancelAllRequests(Si){this._fullRequestReader&&this._fullRequestReader.cancel(Si);for(const Ei of this._rangeReaders.slice(0))Ei.cancel(Si);this._pdfDataRangeTransport.abort()}};class Pi{constructor(Ei,wi,Ci=!1,ki=null){this._stream=Ei,this._done=Ci||!1,this._filename=(0,$i.isPdfFile)(ki)?ki:null,this._queuedChunks=wi||[],this._loaded=0;for(const xi of this._queuedChunks)this._loaded+=xi.byteLength;this._requests=[],this._headersReady=Promise.resolve(),Ei._fullRequestReader=this,this.onProgress=null}_enqueue(Ei){this._done||(this._requests.length>0?this._requests.shift().resolve({value:Ei,done:!1}):this._queuedChunks.push(Ei),this._loaded+=Ei.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const Ei=(0,_i.createPromiseCapability)();return this._requests.push(Ei),Ei.promise}cancel(Ei){this._done=!0;for(const wi of this._requests)wi.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Ai{constructor(Ei,wi,Ci){this._stream=Ei,this._begin=wi,this._end=Ci,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(Ei){if(!this._done){if(this._requests.length===0)this._queuedChunk=Ei;else{this._requests.shift().resolve({value:Ei,done:!1});for(const wi of this._requests)wi.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const wi=this._queuedChunk;return this._queuedChunk=null,{value:wi,done:!1}}if(this._done)return{value:void 0,done:!0};const Ei=(0,_i.createPromiseCapability)();return this._requests.push(Ei),Ei.promise}cancel(Ei){this._done=!0;for(const wi of this._requests)wi.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(yi,vi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.XfaText=void 0;class bi{static textContent($i){const Pi=[],Ai={items:Pi,styles:Object.create(null)};return function Si(Ei){var ki;if(!Ei)return;let wi=null;const Ci=Ei.name;if(Ci==="#text")wi=Ei.value;else{if(!bi.shouldBuildText(Ci))return;(ki=Ei==null?void 0:Ei.attributes)!=null&&ki.textContent?wi=Ei.attributes.textContent:Ei.value&&(wi=Ei.value)}if(wi!==null&&Pi.push({str:wi}),Ei.children)for(const xi of Ei.children)Si(xi)}($i),Ai}static shouldBuildText($i){return!($i==="textarea"||$i==="input"||$i==="option"||$i==="select")}}vi.XfaText=bi},(yi,vi,bi)=>{var fr,lr,$s;Object.defineProperty(vi,"__esModule",{value:!0}),vi.AnnotationLayer=void 0;var _i=bi(1),$i=bi(5),Pi=bi(9),Ai=bi(19),Si=bi(20);const Ei=1e3,wi=new WeakSet;function Ci(vr){return{width:vr[2]-vr[0],height:vr[3]-vr[1]}}class ki{static create(Yi){switch(Yi.data.annotationType){case _i.AnnotationType.LINK:return new Ti(Yi);case _i.AnnotationType.TEXT:return new Oi(Yi);case _i.AnnotationType.WIDGET:switch(Yi.data.fieldType){case"Tx":return new Li(Yi);case"Btn":return Yi.data.radioButton?new Mi(Yi):Yi.data.checkBox?new Ii(Yi):new Fi(Yi);case"Ch":return new Bi(Yi)}return new ji(Yi);case _i.AnnotationType.POPUP:return new Ri(Yi);case _i.AnnotationType.FREETEXT:return new Ni(Yi);case _i.AnnotationType.LINE:return new Wi(Yi);case _i.AnnotationType.SQUARE:return new zi(Yi);case _i.AnnotationType.CIRCLE:return new Di(Yi);case _i.AnnotationType.POLYLINE:return new Ui(Yi);case _i.AnnotationType.CARET:return new qi(Yi);case _i.AnnotationType.INK:return new Gi(Yi);case _i.AnnotationType.POLYGON:return new Hi(Yi);case _i.AnnotationType.HIGHLIGHT:return new Ki(Yi);case _i.AnnotationType.UNDERLINE:return new Qi(Yi);case _i.AnnotationType.SQUIGGLY:return new Xi(Yi);case _i.AnnotationType.STRIKEOUT:return new rr(Yi);case _i.AnnotationType.STAMP:return new ar(Yi);case _i.AnnotationType.FILEATTACHMENT:return new gr(Yi);default:return new xi(Yi)}}}class xi{constructor(Yi,{isRenderable:nr=!1,ignoreBorder:ir=!1,createQuadrilaterals:cr=!1}={}){this.isRenderable=nr,this.data=Yi.data,this.layer=Yi.layer,this.page=Yi.page,this.viewport=Yi.viewport,this.linkService=Yi.linkService,this.downloadManager=Yi.downloadManager,this.imageResourcesPath=Yi.imageResourcesPath,this.renderForms=Yi.renderForms,this.svgFactory=Yi.svgFactory,this.annotationStorage=Yi.annotationStorage,this.enableScripting=Yi.enableScripting,this.hasJSActions=Yi.hasJSActions,this._fieldObjects=Yi.fieldObjects,this._mouseState=Yi.mouseState,nr&&(this.container=this._createContainer(ir)),cr&&(this.quadrilaterals=this._createQuadrilaterals(ir))}_createContainer(Yi=!1){const nr=this.data,ir=this.page,cr=this.viewport,tr=document.createElement("section");let{width:dr,height:Ji}=Ci(nr.rect);tr.setAttribute("data-annotation-id",nr.id);const sr=_i.Util.normalizeRect([nr.rect[0],ir.view[3]-nr.rect[1]+ir.view[1],nr.rect[2],ir.view[3]-nr.rect[3]+ir.view[1]]);if(nr.hasOwnCanvas){const pr=cr.transform.slice(),[or,Zi]=_i.Util.singularValueDecompose2dScale(pr);dr=Math.ceil(dr*or),Ji=Math.ceil(Ji*Zi),sr[0]*=or,sr[1]*=Zi;for(let er=0;er<4;er++)pr[er]=Math.sign(pr[er]);tr.style.transform=`matrix(${pr.join(",")})`}else tr.style.transform=`matrix(${cr.transform.join(",")})`;if(tr.style.transformOrigin=`${-sr[0]}px ${-sr[1]}px`,!Yi&&nr.borderStyle.width>0){tr.style.borderWidth=`${nr.borderStyle.width}px`,nr.borderStyle.style!==_i.AnnotationBorderStyleType.UNDERLINE&&(dr-=2*nr.borderStyle.width,Ji-=2*nr.borderStyle.width);const pr=nr.borderStyle.horizontalCornerRadius,or=nr.borderStyle.verticalCornerRadius;if(pr>0||or>0){const Zi=`${pr}px / ${or}px`;tr.style.borderRadius=Zi}switch(nr.borderStyle.style){case _i.AnnotationBorderStyleType.SOLID:tr.style.borderStyle="solid";break;case _i.AnnotationBorderStyleType.DASHED:tr.style.borderStyle="dashed";break;case _i.AnnotationBorderStyleType.BEVELED:(0,_i.warn)("Unimplemented border style: beveled");break;case _i.AnnotationBorderStyleType.INSET:(0,_i.warn)("Unimplemented border style: inset");break;case _i.AnnotationBorderStyleType.UNDERLINE:tr.style.borderBottomStyle="solid"}nr.borderColor||nr.color?tr.style.borderColor=_i.Util.makeHexColor(0|nr.color[0],0|nr.color[1],0|nr.color[2]):tr.style.borderWidth=0}return tr.style.left=`${sr[0]}px`,tr.style.top=`${sr[1]}px`,nr.hasOwnCanvas?tr.style.width=tr.style.height="auto":(tr.style.width=`${dr}px`,tr.style.height=`${Ji}px`),tr}_createQuadrilaterals(Yi=!1){if(!this.data.quadPoints)return null;const nr=[],ir=this.data.rect;for(const cr of this.data.quadPoints)this.data.rect=[cr[2].x,cr[2].y,cr[1].x,cr[1].y],nr.push(this._createContainer(Yi));return this.data.rect=ir,nr}_createPopup(Yi,nr){let ir=this.container;this.quadrilaterals&&(Yi=Yi||this.quadrilaterals,ir=this.quadrilaterals[0]),Yi||((Yi=document.createElement("div")).style.height=ir.style.height,Yi.style.width=ir.style.width,ir.appendChild(Yi));const cr=new Vi({container:ir,trigger:Yi,color:nr.color,titleObj:nr.titleObj,modificationDate:nr.modificationDate,contentsObj:nr.contentsObj,richText:nr.richText,hideWrapper:!0}).render();cr.style.left=ir.style.width,ir.appendChild(cr)}_renderQuadrilaterals(Yi){for(const nr of this.quadrilaterals)nr.className=Yi;return this.quadrilaterals}render(){(0,_i.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(Yi,nr=null){const ir=[];if(this._fieldObjects){const cr=this._fieldObjects[Yi];if(cr)for(const{page:tr,id:dr,exportValues:Ji}of cr){if(tr===-1||dr===nr)continue;const sr=typeof Ji=="string"?Ji:null,pr=document.getElementById(dr);!pr||wi.has(pr)?ir.push({id:dr,exportValue:sr,domElement:pr}):(0,_i.warn)(`_getElementsByName - element not allowed: ${dr}`)}return ir}for(const cr of document.getElementsByName(Yi)){const{id:tr,exportValue:dr}=cr;tr!==nr&&wi.has(cr)&&ir.push({id:tr,exportValue:dr,domElement:cr})}return ir}static get platform(){const Yi=typeof navigator<"u"?navigator.platform:"";return(0,_i.shadow)(this,"platform",{isWin:Yi.includes("Win"),isMac:Yi.includes("Mac")})}}class Ti extends xi{constructor(Yi,nr=null){super(Yi,{isRenderable:!!(Yi.data.url||Yi.data.dest||Yi.data.action||Yi.data.isTooltipOnly||Yi.data.resetForm||Yi.data.actions&&(Yi.data.actions.Action||Yi.data.actions["Mouse Up"]||Yi.data.actions["Mouse Down"])),ignoreBorder:!!(nr!=null&&nr.ignoreBorder),createQuadrilaterals:!0})}render(){var cr;const{data:Yi,linkService:nr}=this,ir=document.createElement("a");if(Yi.url)nr.addLinkAttributes||(0,_i.warn)("LinkAnnotationElement.render - missing `addLinkAttributes`-method on the `linkService`-instance."),(cr=nr.addLinkAttributes)==null||cr.call(nr,ir,Yi.url,Yi.newWindow);else if(Yi.action)this._bindNamedAction(ir,Yi.action);else if(Yi.dest)this._bindLink(ir,Yi.dest);else{let tr=!1;Yi.actions&&(Yi.actions.Action||Yi.actions["Mouse Up"]||Yi.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(tr=!0,this._bindJSAction(ir,Yi)),Yi.resetForm?this._bindResetFormAction(ir,Yi.resetForm):tr||this._bindLink(ir,"")}return this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((tr,dr)=>{const Ji=dr===0?ir:ir.cloneNode();return tr.appendChild(Ji),tr}):(this.container.className="linkAnnotation",this.container.appendChild(ir),this.container)}_bindLink(Yi,nr){Yi.href=this.linkService.getDestinationHash(nr),Yi.onclick=()=>(nr&&this.linkService.goToDestination(nr),!1),(nr||nr==="")&&(Yi.className="internalLink")}_bindNamedAction(Yi,nr){Yi.href=this.linkService.getAnchorUrl(""),Yi.onclick=()=>(this.linkService.executeNamedAction(nr),!1),Yi.className="internalLink"}_bindJSAction(Yi,nr){Yi.href=this.linkService.getAnchorUrl("");const ir=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const cr of Object.keys(nr.actions)){const tr=ir.get(cr);tr&&(Yi[tr]=()=>{var dr;return(dr=this.linkService.eventBus)==null||dr.dispatch("dispatcheventinsandbox",{source:this,detail:{id:nr.id,name:cr}}),!1})}Yi.onclick||(Yi.onclick=()=>!1),Yi.className="internalLink"}_bindResetFormAction(Yi,nr){const ir=Yi.onclick;ir||(Yi.href=this.linkService.getAnchorUrl("")),Yi.className="internalLink",this._fieldObjects?Yi.onclick=()=>{var or;ir&&ir();const{fields:cr,refs:tr,include:dr}=nr,Ji=[];if(cr.length!==0||tr.length!==0){const Zi=new Set(tr);for(const er of cr){const hr=this._fieldObjects[er]||[];for(const{id:ur}of hr)Zi.add(ur)}for(const er of Object.values(this._fieldObjects))for(const hr of er)Zi.has(hr.id)===dr&&Ji.push(hr)}else for(const Zi of Object.values(this._fieldObjects))Ji.push(...Zi);const sr=this.annotationStorage,pr=[];for(const Zi of Ji){const{id:er}=Zi;switch(pr.push(er),Zi.type){case"text":{const ur=Zi.defaultValue||"";sr.setValue(er,{value:ur,valueAsString:ur});break}case"checkbox":case"radiobutton":{const ur=Zi.defaultValue===Zi.exportValues;sr.setValue(er,{value:ur});break}case"combobox":case"listbox":{const ur=Zi.defaultValue||"";sr.setValue(er,{value:ur});break}default:continue}const hr=document.getElementById(er);hr&&wi.has(hr)&&hr.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((or=this.linkService.eventBus)==null||or.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:pr,name:"ResetForm"}})),!1}:((0,_i.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),ir||(Yi.onclick=()=>!1))}}class Oi extends xi{constructor(Yi){var nr,ir,cr;super(Yi,{isRenderable:!!(Yi.data.hasPopup||(nr=Yi.data.titleObj)!=null&&nr.str||(ir=Yi.data.contentsObj)!=null&&ir.str||(cr=Yi.data.richText)!=null&&cr.str)})}render(){this.container.className="textAnnotation";const Yi=document.createElement("img");return Yi.style.height=this.container.style.height,Yi.style.width=this.container.style.width,Yi.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",Yi.alt="[{{type}} Annotation]",Yi.dataset.l10nId="text_annotation_type",Yi.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(Yi,this.data),this.container.appendChild(Yi),this.container}}class ji extends xi{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(Yi){const{isWin:nr,isMac:ir}=xi.platform;return nr&&Yi.ctrlKey||ir&&Yi.metaKey}_setEventListener(Yi,nr,ir,cr){nr.includes("mouse")?Yi.addEventListener(nr,tr=>{var dr;(dr=this.linkService.eventBus)==null||dr.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:ir,value:cr(tr),shift:tr.shiftKey,modifier:this._getKeyModifier(tr)}})}):Yi.addEventListener(nr,tr=>{var dr;(dr=this.linkService.eventBus)==null||dr.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:ir,value:cr(tr)}})})}_setEventListeners(Yi,nr,ir){var cr;for(const[tr,dr]of nr)(dr==="Action"||(cr=this.data.actions)!=null&&cr[dr])&&this._setEventListener(Yi,tr,dr,ir)}_setBackgroundColor(Yi){const nr=this.data.backgroundColor||null;Yi.style.backgroundColor=nr===null?"transparent":_i.Util.makeHexColor(nr[0],nr[1],nr[2])}_dispatchEventFromSandbox(Yi,nr){const ir=(tr,dr,Ji)=>{const sr=Ji.detail[tr];Ji.target.style[dr]=Ai.ColorConverters[`${sr[0]}_HTML`](sr.slice(1))},cr={display:tr=>{const dr=tr.detail.display%2==1;tr.target.style.visibility=dr?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:dr,print:tr.detail.display===0||tr.detail.display===3})},print:tr=>{this.annotationStorage.setValue(this.data.id,{print:tr.detail.print})},hidden:tr=>{tr.target.style.visibility=tr.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:tr.detail.hidden})},focus:tr=>{setTimeout(()=>tr.target.focus({preventScroll:!1}),0)},userName:tr=>{tr.target.title=tr.detail.userName},readonly:tr=>{tr.detail.readonly?tr.target.setAttribute("readonly",""):tr.target.removeAttribute("readonly")},required:tr=>{tr.detail.required?tr.target.setAttribute("required",""):tr.target.removeAttribute("required")},bgColor:tr=>{ir("bgColor","backgroundColor",tr)},fillColor:tr=>{ir("fillColor","backgroundColor",tr)},fgColor:tr=>{ir("fgColor","color",tr)},textColor:tr=>{ir("textColor","color",tr)},borderColor:tr=>{ir("borderColor","borderColor",tr)},strokeColor:tr=>{ir("strokeColor","borderColor",tr)}};for(const tr of Object.keys(nr.detail)){const dr=Yi[tr]||cr[tr];dr&&dr(nr)}}}class Li extends ji{constructor(Yi){super(Yi,{isRenderable:Yi.renderForms||!Yi.data.hasAppearance&&!!Yi.data.fieldValue})}setPropertyOnSiblings(Yi,nr,ir,cr){const tr=this.annotationStorage;for(const dr of this._getElementsByName(Yi.name,Yi.id))dr.domElement&&(dr.domElement[nr]=ir),tr.setValue(dr.id,{[cr]:ir})}render(){var cr;const Yi=this.annotationStorage,nr=this.data.id;this.container.className="textWidgetAnnotation";let ir=null;if(this.renderForms){const tr=Yi.getValue(nr,{value:this.data.fieldValue,valueAsString:this.data.fieldValue}),dr=tr.valueAsString||tr.value||"",Ji={userValue:null,formattedValue:null};this.data.multiLine?(ir=document.createElement("textarea"),ir.textContent=dr):(ir=document.createElement("input"),ir.type="text",ir.setAttribute("value",dr)),wi.add(ir),ir.disabled=this.data.readOnly,ir.name=this.data.fieldName,ir.tabIndex=Ei,Ji.userValue=dr,ir.setAttribute("id",nr),ir.addEventListener("input",pr=>{Yi.setValue(nr,{value:pr.target.value}),this.setPropertyOnSiblings(ir,"value",pr.target.value,"value")}),ir.addEventListener("resetform",pr=>{const or=this.data.defaultFieldValue||"";ir.value=Ji.userValue=or,delete Ji.formattedValue});let sr=pr=>{Ji.formattedValue&&(pr.target.value=Ji.formattedValue),pr.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){ir.addEventListener("focus",or=>{Ji.userValue&&(or.target.value=Ji.userValue)}),ir.addEventListener("updatefromsandbox",or=>{const Zi={value(er){Ji.userValue=er.detail.value||"",Yi.setValue(nr,{value:Ji.userValue.toString()}),Ji.formattedValue||(er.target.value=Ji.userValue)},valueAsString(er){Ji.formattedValue=er.detail.valueAsString||"",er.target!==document.activeElement&&(er.target.value=Ji.formattedValue),Yi.setValue(nr,{formattedValue:Ji.formattedValue})},selRange(er){const[hr,ur]=er.detail.selRange;hr>=0&&ur{var er;let Zi=-1;or.key==="Escape"?Zi=0:or.key==="Enter"?Zi=2:or.key==="Tab"&&(Zi=3),Zi!==-1&&(Ji.userValue=or.target.value,(er=this.linkService.eventBus)==null||er.dispatch("dispatcheventinsandbox",{source:this,detail:{id:nr,name:"Keystroke",value:or.target.value,willCommit:!0,commitKey:Zi,selStart:or.target.selectionStart,selEnd:or.target.selectionEnd}}))});const pr=sr;sr=null,ir.addEventListener("blur",or=>{var Zi;Ji.userValue=or.target.value,this._mouseState.isDown&&((Zi=this.linkService.eventBus)==null||Zi.dispatch("dispatcheventinsandbox",{source:this,detail:{id:nr,name:"Keystroke",value:or.target.value,willCommit:!0,commitKey:1,selStart:or.target.selectionStart,selEnd:or.target.selectionEnd}})),pr(or)}),(cr=this.data.actions)!=null&&cr.Keystroke&&ir.addEventListener("beforeinput",or=>{var $r;Ji.formattedValue="";const{data:Zi,target:er}=or,{value:hr,selectionStart:ur,selectionEnd:_r}=er;($r=this.linkService.eventBus)==null||$r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:nr,name:"Keystroke",value:hr,change:Zi,willCommit:!1,selStart:ur,selEnd:_r}})}),this._setEventListeners(ir,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],or=>or.target.value)}if(sr&&ir.addEventListener("blur",sr),this.data.maxLen!==null&&(ir.maxLength=this.data.maxLen),this.data.comb){const pr=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;ir.classList.add("comb"),ir.style.letterSpacing=`calc(${pr}px - 1ch)`}}else ir=document.createElement("div"),ir.textContent=this.data.fieldValue,ir.style.verticalAlign="middle",ir.style.display="table-cell";return this._setTextStyle(ir),this._setBackgroundColor(ir),this.container.appendChild(ir),this.container}_setTextStyle(Yi){const nr=["left","center","right"],{fontSize:ir,fontColor:cr}=this.data.defaultAppearanceData,tr=Yi.style;ir&&(tr.fontSize=`${ir}px`),tr.color=_i.Util.makeHexColor(cr[0],cr[1],cr[2]),this.data.textAlignment!==null&&(tr.textAlign=nr[this.data.textAlignment])}}class Ii extends ji{constructor(Yi){super(Yi,{isRenderable:Yi.renderForms})}render(){const Yi=this.annotationStorage,nr=this.data,ir=nr.id;let cr=Yi.getValue(ir,{value:nr.exportValue===nr.fieldValue}).value;typeof cr=="string"&&(cr=cr!=="Off",Yi.setValue(ir,{value:cr})),this.container.className="buttonWidgetAnnotation checkBox";const tr=document.createElement("input");return wi.add(tr),tr.disabled=nr.readOnly,tr.type="checkbox",tr.name=nr.fieldName,cr&&tr.setAttribute("checked",!0),tr.setAttribute("id",ir),tr.setAttribute("exportValue",nr.exportValue),tr.tabIndex=Ei,tr.addEventListener("change",dr=>{const{name:Ji,checked:sr}=dr.target;for(const pr of this._getElementsByName(Ji,ir)){const or=sr&&pr.exportValue===nr.exportValue;pr.domElement&&(pr.domElement.checked=or),Yi.setValue(pr.id,{value:or})}Yi.setValue(ir,{value:sr})}),tr.addEventListener("resetform",dr=>{const Ji=nr.defaultFieldValue||"Off";dr.target.checked=Ji===nr.exportValue}),this.enableScripting&&this.hasJSActions&&(tr.addEventListener("updatefromsandbox",dr=>{const Ji={value(sr){sr.target.checked=sr.detail.value!=="Off",Yi.setValue(ir,{value:sr.target.checked})}};this._dispatchEventFromSandbox(Ji,dr)}),this._setEventListeners(tr,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],dr=>dr.target.checked)),this._setBackgroundColor(tr),this.container.appendChild(tr),this.container}}class Mi extends ji{constructor(Yi){super(Yi,{isRenderable:Yi.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const Yi=this.annotationStorage,nr=this.data,ir=nr.id;let cr=Yi.getValue(ir,{value:nr.fieldValue===nr.buttonValue}).value;typeof cr=="string"&&(cr=cr!==nr.buttonValue,Yi.setValue(ir,{value:cr}));const tr=document.createElement("input");if(wi.add(tr),tr.disabled=nr.readOnly,tr.type="radio",tr.name=nr.fieldName,cr&&tr.setAttribute("checked",!0),tr.setAttribute("id",ir),tr.tabIndex=Ei,tr.addEventListener("change",dr=>{const{name:Ji,checked:sr}=dr.target;for(const pr of this._getElementsByName(Ji,ir))Yi.setValue(pr.id,{value:!1});Yi.setValue(ir,{value:sr})}),tr.addEventListener("resetform",dr=>{const Ji=nr.defaultFieldValue;dr.target.checked=Ji!=null&&Ji===nr.buttonValue}),this.enableScripting&&this.hasJSActions){const dr=nr.buttonValue;tr.addEventListener("updatefromsandbox",Ji=>{const sr={value:pr=>{const or=dr===pr.detail.value;for(const Zi of this._getElementsByName(pr.target.name)){const er=or&&Zi.id===ir;Zi.domElement&&(Zi.domElement.checked=er),Yi.setValue(Zi.id,{value:er})}}};this._dispatchEventFromSandbox(sr,Ji)}),this._setEventListeners(tr,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Ji=>Ji.target.checked)}return this._setBackgroundColor(tr),this.container.appendChild(tr),this.container}}class Fi extends Ti{constructor(Yi){super(Yi,{ignoreBorder:Yi.data.hasAppearance})}render(){const Yi=super.render();return Yi.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(Yi.title=this.data.alternativeText),Yi}}class Bi extends ji{constructor(Yi){super(Yi,{isRenderable:Yi.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const Yi=this.annotationStorage,nr=this.data.id;Yi.getValue(nr,{value:this.data.fieldValue.length>0?this.data.fieldValue[0]:void 0});let{fontSize:ir}=this.data.defaultAppearanceData;ir||(ir=9);const cr=`calc(${ir}px * var(--zoom-factor))`,tr=document.createElement("select");wi.add(tr),tr.disabled=this.data.readOnly,tr.name=this.data.fieldName,tr.setAttribute("id",nr),tr.tabIndex=Ei,tr.style.fontSize=`${ir}px`,this.data.combo||(tr.size=this.data.options.length,this.data.multiSelect&&(tr.multiple=!0)),tr.addEventListener("resetform",sr=>{const pr=this.data.defaultFieldValue;for(const or of tr.options)or.selected=or.value===pr});for(const sr of this.data.options){const pr=document.createElement("option");pr.textContent=sr.displayValue,pr.value=sr.exportValue,this.data.combo&&(pr.style.fontSize=cr),this.data.fieldValue.includes(sr.exportValue)&&pr.setAttribute("selected",!0),tr.appendChild(pr)}const dr=(sr,pr)=>{const or=pr?"value":"textContent",Zi=sr.target.options;return sr.target.multiple?Array.prototype.filter.call(Zi,er=>er.selected).map(er=>er[or]):Zi.selectedIndex===-1?null:Zi[Zi.selectedIndex][or]},Ji=sr=>{const pr=sr.target.options;return Array.prototype.map.call(pr,or=>({displayValue:or.textContent,exportValue:or.value}))};return this.enableScripting&&this.hasJSActions?(tr.addEventListener("updatefromsandbox",sr=>{const pr={value(or){const Zi=or.detail.value,er=new Set(Array.isArray(Zi)?Zi:[Zi]);for(const hr of tr.options)hr.selected=er.has(hr.value);Yi.setValue(nr,{value:dr(or,!0)})},multipleSelection(or){tr.multiple=!0},remove(or){const Zi=tr.options,er=or.detail.remove;Zi[er].selected=!1,tr.remove(er),Zi.length>0&&Array.prototype.findIndex.call(Zi,hr=>hr.selected)===-1&&(Zi[0].selected=!0),Yi.setValue(nr,{value:dr(or,!0),items:Ji(or)})},clear(or){for(;tr.length!==0;)tr.remove(0);Yi.setValue(nr,{value:null,items:[]})},insert(or){const{index:Zi,displayValue:er,exportValue:hr}=or.detail.insert,ur=document.createElement("option");ur.textContent=er,ur.value=hr,tr.insertBefore(ur,tr.children[Zi]),Yi.setValue(nr,{value:dr(or,!0),items:Ji(or)})},items(or){const{items:Zi}=or.detail;for(;tr.length!==0;)tr.remove(0);for(const er of Zi){const{displayValue:hr,exportValue:ur}=er,_r=document.createElement("option");_r.textContent=hr,_r.value=ur,tr.appendChild(_r)}tr.options.length>0&&(tr.options[0].selected=!0),Yi.setValue(nr,{value:dr(or,!0),items:Ji(or)})},indices(or){const Zi=new Set(or.detail.indices);for(const er of or.target.options)er.selected=Zi.has(er.index);Yi.setValue(nr,{value:dr(or,!0)})},editable(or){or.target.disabled=!or.detail.editable}};this._dispatchEventFromSandbox(pr,sr)}),tr.addEventListener("input",sr=>{var Zi;const pr=dr(sr,!0),or=dr(sr,!1);Yi.setValue(nr,{value:pr}),(Zi=this.linkService.eventBus)==null||Zi.dispatch("dispatcheventinsandbox",{source:this,detail:{id:nr,name:"Keystroke",value:or,changeEx:pr,willCommit:!0,commitKey:1,keyDown:!1}})}),this._setEventListeners(tr,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],sr=>sr.target.checked)):tr.addEventListener("input",function(sr){Yi.setValue(nr,{value:dr(sr)})}),this._setBackgroundColor(tr),this.container.appendChild(tr),this.container}}class Ri extends xi{constructor(Yi){var nr,ir,cr;super(Yi,{isRenderable:!!((nr=Yi.data.titleObj)!=null&&nr.str||(ir=Yi.data.contentsObj)!=null&&ir.str||(cr=Yi.data.richText)!=null&&cr.str)})}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const Yi=`[data-annotation-id="${this.data.parentId}"]`,nr=this.layer.querySelectorAll(Yi);if(nr.length===0)return this.container;const ir=new Vi({container:this.container,trigger:Array.from(nr),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),cr=this.page,tr=_i.Util.normalizeRect([this.data.parentRect[0],cr.view[3]-this.data.parentRect[1]+cr.view[1],this.data.parentRect[2],cr.view[3]-this.data.parentRect[3]+cr.view[1]]),dr=tr[0]+this.data.parentRect[2]-this.data.parentRect[0],Ji=tr[1];return this.container.style.transformOrigin=`${-dr}px ${-Ji}px`,this.container.style.left=`${dr}px`,this.container.style.top=`${Ji}px`,this.container.appendChild(ir.render()),this.container}}class Vi{constructor(Yi){this.container=Yi.container,this.trigger=Yi.trigger,this.color=Yi.color,this.titleObj=Yi.titleObj,this.modificationDate=Yi.modificationDate,this.contentsObj=Yi.contentsObj,this.richText=Yi.richText,this.hideWrapper=Yi.hideWrapper||!1,this.pinned=!1}render(){var dr,Ji;const Yi=document.createElement("div");Yi.className="popupWrapper",this.hideElement=this.hideWrapper?Yi:this.container,this.hideElement.hidden=!0;const nr=document.createElement("div");nr.className="popup";const ir=this.color;if(ir){const sr=.7*(255-ir[0])+ir[0],pr=.7*(255-ir[1])+ir[1],or=.7*(255-ir[2])+ir[2];nr.style.backgroundColor=_i.Util.makeHexColor(0|sr,0|pr,0|or)}const cr=document.createElement("h1");cr.dir=this.titleObj.dir,cr.textContent=this.titleObj.str,nr.appendChild(cr);const tr=$i.PDFDateString.toDateObject(this.modificationDate);if(tr){const sr=document.createElement("span");sr.className="popupDate",sr.textContent="{{date}}, {{time}}",sr.dataset.l10nId="annotation_date_string",sr.dataset.l10nArgs=JSON.stringify({date:tr.toLocaleDateString(),time:tr.toLocaleTimeString()}),nr.appendChild(sr)}if(!((dr=this.richText)!=null&&dr.str)||(Ji=this.contentsObj)!=null&&Ji.str&&this.contentsObj.str!==this.richText.str){const sr=this._formatContents(this.contentsObj);nr.appendChild(sr)}else Si.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:nr}),nr.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const sr of this.trigger)sr.addEventListener("click",this._toggle.bind(this)),sr.addEventListener("mouseover",this._show.bind(this,!1)),sr.addEventListener("mouseout",this._hide.bind(this,!1));return nr.addEventListener("click",this._hide.bind(this,!0)),Yi.appendChild(nr),Yi}_formatContents({str:Yi,dir:nr}){const ir=document.createElement("p");ir.className="popupContent",ir.dir=nr;const cr=Yi.split(/(?:\r\n?|\n)/);for(let tr=0,dr=cr.length;tr{Object.defineProperty(vi,"__esModule",{value:!0}),vi.ColorConverters=void 0;function bi(_i){return Math.floor(255*Math.max(0,Math.min(1,_i))).toString(16).padStart(2,"0")}vi.ColorConverters=class{static CMYK_G([_i,$i,Pi,Ai]){return["G",1-Math.min(1,.3*_i+.59*Pi+.11*$i+Ai)]}static G_CMYK([_i]){return["CMYK",0,0,0,1-_i]}static G_RGB([_i]){return["RGB",_i,_i,_i]}static G_HTML([_i]){const $i=bi(_i);return`#${$i}${$i}${$i}`}static RGB_G([_i,$i,Pi]){return["G",.3*_i+.59*$i+.11*Pi]}static RGB_HTML([_i,$i,Pi]){return`#${bi(_i)}${bi($i)}${bi(Pi)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([_i,$i,Pi,Ai]){return["RGB",1-Math.min(1,_i+Ai),1-Math.min(1,Pi+Ai),1-Math.min(1,$i+Ai)]}static CMYK_HTML(_i){return this.RGB_HTML(this.CMYK_RGB(_i))}static RGB_CMYK([_i,$i,Pi]){const Ai=1-_i,Si=1-$i,Ei=1-Pi;return["CMYK",Ai,Si,Ei,Math.min(Ai,Si,Ei)]}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.XfaLayer=void 0;var _i=bi(1),$i=bi(17);vi.XfaLayer=class{static setupStorage(Pi,Ai,Si,Ei,wi){const Ci=Ei.getValue(Ai,{value:null});switch(Si.name){case"textarea":if(Ci.value!==null&&(Pi.textContent=Ci.value),wi==="print")break;Pi.addEventListener("input",ki=>{Ei.setValue(Ai,{value:ki.target.value})});break;case"input":if(Si.attributes.type==="radio"||Si.attributes.type==="checkbox"){if(Ci.value===Si.attributes.xfaOn?Pi.setAttribute("checked",!0):Ci.value===Si.attributes.xfaOff&&Pi.removeAttribute("checked"),wi==="print")break;Pi.addEventListener("change",ki=>{Ei.setValue(Ai,{value:ki.target.checked?ki.target.getAttribute("xfaOn"):ki.target.getAttribute("xfaOff")})})}else{if(Ci.value!==null&&Pi.setAttribute("value",Ci.value),wi==="print")break;Pi.addEventListener("input",ki=>{Ei.setValue(Ai,{value:ki.target.value})})}break;case"select":if(Ci.value!==null)for(const ki of Si.children)ki.attributes.value===Ci.value&&(ki.attributes.selected=!0);Pi.addEventListener("input",ki=>{const xi=ki.target.options,Ti=xi.selectedIndex===-1?"":xi[xi.selectedIndex].value;Ei.setValue(Ai,{value:Ti})})}}static setAttributes({html:Pi,element:Ai,storage:Si=null,intent:Ei,linkService:wi}){var xi;const{attributes:Ci}=Ai,ki=Pi instanceof HTMLAnchorElement;Ci.type==="radio"&&(Ci.name=`${Ci.name}-${Ei}`);for(const[Ti,Oi]of Object.entries(Ci))if(Oi!=null&&Ti!=="dataId")if(Ti!=="style")if(Ti==="textContent")Pi.textContent=Oi;else if(Ti==="class")Oi.length&&Pi.setAttribute(Ti,Oi.join(" "));else{if(ki&&(Ti==="href"||Ti==="newWindow"))continue;Pi.setAttribute(Ti,Oi)}else Object.assign(Pi.style,Oi);ki&&(wi.addLinkAttributes||(0,_i.warn)("XfaLayer.setAttribute - missing `addLinkAttributes`-method on the `linkService`-instance."),(xi=wi.addLinkAttributes)==null||xi.call(wi,Pi,Ci.href,Ci.newWindow)),Si&&Ci.dataId&&this.setupStorage(Pi,Ci.dataId,Ai,Si)}static render(Pi){var Oi;const Ai=Pi.annotationStorage,Si=Pi.linkService,Ei=Pi.xfaHtml,wi=Pi.intent||"display",Ci=document.createElement(Ei.name);Ei.attributes&&this.setAttributes({html:Ci,element:Ei,intent:wi,linkService:Si});const ki=[[Ei,-1,Ci]],xi=Pi.div;if(xi.appendChild(Ci),Pi.viewport){const ji=`matrix(${Pi.viewport.transform.join(",")})`;xi.style.transform=ji}wi!=="richText"&&xi.setAttribute("class","xfaLayer xfaFont");const Ti=[];for(;ki.length>0;){const[ji,Li,Ii]=ki[ki.length-1];if(Li+1===ji.children.length){ki.pop();continue}const Mi=ji.children[++ki[ki.length-1][1]];if(Mi===null)continue;const{name:Fi}=Mi;if(Fi==="#text"){const Ri=document.createTextNode(Mi.value);Ti.push(Ri),Ii.appendChild(Ri);continue}let Bi;if(Bi=(Oi=Mi==null?void 0:Mi.attributes)!=null&&Oi.xmlns?document.createElementNS(Mi.attributes.xmlns,Fi):document.createElement(Fi),Ii.appendChild(Bi),Mi.attributes&&this.setAttributes({html:Bi,element:Mi,storage:Ai,intent:wi,linkService:Si}),Mi.children&&Mi.children.length>0)ki.push([Mi,-1,Bi]);else if(Mi.value){const Ri=document.createTextNode(Mi.value);$i.XfaText.shouldBuildText(Fi)&&Ti.push(Ri),Bi.appendChild(Ri)}}for(const ji of xi.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))ji.setAttribute("readOnly",!0);return{textDivs:Ti}}static update(Pi){const Ai=`matrix(${Pi.viewport.transform.join(",")})`;Pi.div.style.transform=Ai,Pi.div.hidden=!1}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.renderTextLayer=function(Ti){const Oi=new xi({textContent:Ti.textContent,textContentStream:Ti.textContentStream,container:Ti.container,viewport:Ti.viewport,textDivs:Ti.textDivs,textContentItemsStr:Ti.textContentItemsStr,enhanceTextSelection:Ti.enhanceTextSelection});return Oi._render(Ti.timeout),Oi};var _i=bi(1);const $i=30,Pi=new Map,Ai=/^\s+$/g;function Si(Ti,Oi,ji,Li){const Ii=document.createElement("span"),Mi=Ti._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:Oi.str!=="",hasEOL:Oi.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1}:{angle:0,canvasWidth:0,hasText:Oi.str!=="",hasEOL:Oi.hasEOL};Ti._textDivs.push(Ii);const Fi=_i.Util.transform(Ti._viewport.transform,Oi.transform);let Bi=Math.atan2(Fi[1],Fi[0]);const Ri=ji[Oi.fontName];Ri.vertical&&(Bi+=Math.PI/2);const Vi=Math.hypot(Fi[2],Fi[3]),Ni=Vi*function(Ui,Hi){const qi=Pi.get(Ui);if(qi)return qi;Hi.save(),Hi.font=`30px ${Ui}`;const Gi=Hi.measureText("");let Ki=Gi.fontBoundingBoxAscent,Qi=Math.abs(Gi.fontBoundingBoxDescent);if(Ki){Hi.restore();const rr=Ki/(Ki+Qi);return Pi.set(Ui,rr),rr}Hi.strokeStyle="red",Hi.clearRect(0,0,$i,$i),Hi.strokeText("g",0,0);let Xi=Hi.getImageData(0,0,$i,$i).data;Qi=0;for(let rr=Xi.length-1-3;rr>=0;rr-=4)if(Xi[rr]>0){Qi=Math.ceil(rr/4/$i);break}Hi.clearRect(0,0,$i,$i),Hi.strokeText("A",0,$i),Xi=Hi.getImageData(0,0,$i,$i).data,Ki=0;for(let rr=0,ar=Xi.length;rr0){Ki=$i-Math.floor(rr/4/$i);break}if(Hi.restore(),Ki){const rr=Ki/(Ki+Qi);return Pi.set(Ui,rr),rr}return Pi.set(Ui,.8),.8}(Ri.fontFamily,Li);let Wi,zi;Bi===0?(Wi=Fi[4],zi=Fi[5]-Ni):(Wi=Fi[4]+Ni*Math.sin(Bi),zi=Fi[5]-Ni*Math.cos(Bi)),Ii.style.left=`${Wi}px`,Ii.style.top=`${zi}px`,Ii.style.fontSize=`${Vi}px`,Ii.style.fontFamily=Ri.fontFamily,Ii.setAttribute("role","presentation"),Ii.textContent=Oi.str,Ii.dir=Oi.dir,Ti._fontInspectorEnabled&&(Ii.dataset.fontName=Oi.fontName),Bi!==0&&(Mi.angle=Bi*(180/Math.PI));let Di=!1;if(Oi.str.length>1||Ti._enhanceTextSelection&&Ai.test(Oi.str))Di=!0;else if(Oi.str!==" "&&Oi.transform[0]!==Oi.transform[3]){const Ui=Math.abs(Oi.transform[0]),Hi=Math.abs(Oi.transform[3]);Ui!==Hi&&Math.max(Ui,Hi)/Math.min(Ui,Hi)>1.5&&(Di=!0)}if(Di&&(Ri.vertical?Mi.canvasWidth=Oi.height*Ti._viewport.scale:Mi.canvasWidth=Oi.width*Ti._viewport.scale),Ti._textDivProperties.set(Ii,Mi),Ti._textContentStream&&Ti._layoutText(Ii),Ti._enhanceTextSelection&&Mi.hasText){let Ui=1,Hi=0;Bi!==0&&(Ui=Math.cos(Bi),Hi=Math.sin(Bi));const qi=(Ri.vertical?Oi.height:Oi.width)*Ti._viewport.scale,Gi=Vi;let Ki,Qi;Bi!==0?(Ki=[Ui,Hi,-Hi,Ui,Wi,zi],Qi=_i.Util.getAxialAlignedBoundingBox([0,0,qi,Gi],Ki)):Qi=[Wi,zi,Wi+qi,zi+Gi],Ti._bounds.push({left:Qi[0],top:Qi[1],right:Qi[2],bottom:Qi[3],div:Ii,size:[qi,Gi],m:Ki})}}function Ei(Ti){if(Ti._canceled)return;const Oi=Ti._textDivs,ji=Ti._capability,Li=Oi.length;if(Li>1e5)Ti._renderingDone=!0,ji.resolve();else{if(!Ti._textContentStream)for(let Ii=0;Ii0&&(Li=Li?Math.min(Mi,Li):Mi)}return Li}function Ci(Ti){const Oi=Ti._bounds,ji=Ti._viewport,Li=function(Ii,Mi,Fi){const Bi=Fi.map(function(Vi,Ni){return{x1:Vi.left,y1:Vi.top,x2:Vi.right,y2:Vi.bottom,index:Ni,x1New:void 0,x2New:void 0}});ki(Ii,Bi);const Ri=new Array(Fi.length);for(const Vi of Bi){const Ni=Vi.index;Ri[Ni]={left:Vi.x1New,top:0,right:Vi.x2New,bottom:0}}Fi.map(function(Vi,Ni){const Wi=Ri[Ni],zi=Bi[Ni];zi.x1=Vi.top,zi.y1=Ii-Wi.right,zi.x2=Vi.bottom,zi.y2=Ii-Wi.left,zi.index=Ni,zi.x1New=void 0,zi.x2New=void 0}),ki(Mi,Bi);for(const Vi of Bi){const Ni=Vi.index;Ri[Ni].top=Vi.x1New,Ri[Ni].bottom=Vi.x2New}return Ri}(ji.width,ji.height,Oi);for(let Ii=0;Ii=0&&ji[Bi].start>=Li.y2;)Bi--;let Ri,Vi,Ni=-1/0;for(Ri=Ii;Ri<=Bi;Ri++){Mi=ji[Ri],Fi=Mi.boundary;let Di;Di=Fi.x2>Li.x1?Fi.index>Li.index?Fi.x1New:Li.x1:Fi.x2New===void 0?(Fi.x2+Li.x1)/2:Fi.x2New,Di>Ni&&(Ni=Di)}for(Li.x1New=Ni,Ri=Ii;Ri<=Bi;Ri++)Mi=ji[Ri],Fi=Mi.boundary,Fi.x2New===void 0?Fi.x2>Li.x1?Fi.index>Li.index&&(Fi.x2New=Fi.x2):Fi.x2New=Ni:Fi.x2New>Ni&&(Fi.x2New=Math.max(Ni,Fi.x2));const Wi=[];let zi=null;for(Ri=Ii;Ri<=Bi;Ri++){Mi=ji[Ri],Fi=Mi.boundary;const Di=Fi.x2>Li.x2?Fi:Li;zi===Di?Wi[Wi.length-1].end=Mi.end:(Wi.push({start:Mi.start,end:Mi.end,boundary:Di}),zi=Di)}for(ji[Ii].start=0&&ji[Vi].start>=Fi.y1;Vi--)Di=ji[Vi].boundary===Fi;for(Vi=Bi+1;!Di&&Vi{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new _i.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._renderTimer!==null&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(Oi,ji){for(let Li=0,Ii=Oi.length;Li0){let Bi=ji.canvasWidth/Fi;if(this._enhanceTextSelection&&(ji.scale=Bi),navigator.userAgent.indexOf("Chrome")>-1){const Ri=Number.parseFloat(Ii);Ri<12&&(Bi*=Ri/12),Li=`scale(${Bi})`}else Li=`scaleX(${Bi})`}}if(ji.angle!==0&&(Li=`rotate(${ji.angle}deg) ${Li}`),Li.length>0&&(this._enhanceTextSelection&&(ji.originalTransform=Li),Oi.style.transform=Li),ji.hasText&&this._container.appendChild(Oi),ji.hasEOL){const Ii=document.createElement("br");Ii.setAttribute("role","presentation"),this._container.appendChild(Ii)}}_render(Oi=0){const ji=(0,_i.createPromiseCapability)();let Li=Object.create(null);const Ii=this._document.createElement("canvas");if(Ii.height=Ii.width=$i,Ii.mozOpaque=!0,this._layoutTextCtx=Ii.getContext("2d",{alpha:!1}),this._textContent){const Mi=this._textContent.items,Fi=this._textContent.styles;this._processItems(Mi,Fi),ji.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const Mi=()=>{this._reader.read().then(({value:Fi,done:Bi})=>{Bi?ji.resolve():(Object.assign(Li,Fi.styles),this._processItems(Fi.items,Li),Mi())},ji.reject)};this._reader=this._textContentStream.getReader(),Mi()}}ji.promise.then(()=>{Li=null,Oi?this._renderTimer=setTimeout(()=>{Ei(this),this._renderTimer=null},Oi):Ei(this)},this._capability.reject)}expandTextDivs(Oi=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;this._bounds!==null&&(Ci(this),this._bounds=null);const ji=[],Li=[];for(let Ii=0,Mi=this._textDivs.length;Ii0?(Li.push(`${Bi.paddingTop}px`),ji.push(`translateY(${-Bi.paddingTop}px)`)):Li.push(0),Bi.paddingRight>0?Li.push(Bi.paddingRight/Bi.scale+"px"):Li.push(0),Bi.paddingBottom>0?Li.push(`${Bi.paddingBottom}px`):Li.push(0),Bi.paddingLeft>0?(Li.push(Bi.paddingLeft/Bi.scale+"px"),ji.push(`translateX(${-Bi.paddingLeft/Bi.scale}px)`)):Li.push(0),Fi.style.padding=Li.join(" "),ji.length&&(Fi.style.transform=ji.join(" "))):(Fi.style.padding=null,Fi.style.transform=Bi.originalTransform))}}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.SVGGraphics=void 0;var _i=bi(1),$i=bi(5),Pi=bi(3);let Ai=class{constructor(){(0,_i.unreachable)("Not implemented: SVGGraphics")}};vi.SVGGraphics=Ai;{let ji=function(Ri){let Vi=[];const Ni=[];for(const Wi of Ri)Wi.fn!=="save"?Wi.fn==="restore"?Vi=Ni.pop():Vi.push(Wi):(Vi.push({fnId:92,fn:"group",items:[]}),Ni.push(Vi),Vi=Vi[Vi.length-1].items);return Vi},Li=function(Ri){if(Number.isInteger(Ri))return Ri.toString();const Vi=Ri.toFixed(10);let Ni=Vi.length-1;if(Vi[Ni]!=="0")return Vi;do Ni--;while(Vi[Ni]==="0");return Vi.substring(0,Vi[Ni]==="."?Ni:Ni+1)},Ii=function(Ri){if(Ri[4]===0&&Ri[5]===0){if(Ri[1]===0&&Ri[2]===0)return Ri[0]===1&&Ri[3]===1?"":`scale(${Li(Ri[0])} ${Li(Ri[3])})`;if(Ri[0]===Ri[3]&&Ri[1]===-Ri[2])return`rotate(${Li(180*Math.acos(Ri[0])/Math.PI)})`}else if(Ri[0]===1&&Ri[1]===0&&Ri[2]===0&&Ri[3]===1)return`translate(${Li(Ri[4])} ${Li(Ri[5])})`;return`matrix(${Li(Ri[0])} ${Li(Ri[1])} ${Li(Ri[2])} ${Li(Ri[3])} ${Li(Ri[4])} ${Li(Ri[5])})`};const Si={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},Ei="http://www.w3.org/XML/1998/namespace",wi="http://www.w3.org/1999/xlink",Ci=["butt","round","square"],ki=["miter","round","bevel"],xi=function(Ri,Vi="",Ni=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!Ni)return URL.createObjectURL(new Blob([Ri],{type:Vi}));const Wi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let zi=`data:${Vi};base64,`;for(let Di=0,Ui=Ri.length;Di>2]+Wi[(3&Hi)<<4|qi>>4]+Wi[Di+1>6:64]+Wi[Di+2>1&2147483647:Ui>>1&2147483647;Vi[Di]=Ui}function Ni(Di,Ui,Hi,qi){let Gi=qi;const Ki=Ui.length;Hi[Gi]=Ki>>24&255,Hi[Gi+1]=Ki>>16&255,Hi[Gi+2]=Ki>>8&255,Hi[Gi+3]=255&Ki,Gi+=4,Hi[Gi]=255&Di.charCodeAt(0),Hi[Gi+1]=255&Di.charCodeAt(1),Hi[Gi+2]=255&Di.charCodeAt(2),Hi[Gi+3]=255&Di.charCodeAt(3),Gi+=4,Hi.set(Ui,Gi),Gi+=Ui.length;const Qi=function(Xi,rr,ar){let gr=-1;for(let fr=rr;fr>>8^Vi[lr]}return-1^gr}(Hi,qi+4,Gi);Hi[Gi]=Qi>>24&255,Hi[Gi+1]=Qi>>16&255,Hi[Gi+2]=Qi>>8&255,Hi[Gi+3]=255&Qi}function Wi(Di){let Ui=Di.length;const Hi=65535,qi=Math.ceil(Ui/Hi),Gi=new Uint8Array(2+Ui+5*qi+4);let Ki=0;Gi[Ki++]=120,Gi[Ki++]=156;let Qi=0;for(;Ui>Hi;)Gi[Ki++]=0,Gi[Ki++]=255,Gi[Ki++]=255,Gi[Ki++]=0,Gi[Ki++]=0,Gi.set(Di.subarray(Qi,Qi+Hi),Ki),Ki+=Hi,Qi+=Hi,Ui-=Hi;Gi[Ki++]=1,Gi[Ki++]=255&Ui,Gi[Ki++]=Ui>>8&255,Gi[Ki++]=255&~Ui,Gi[Ki++]=(65535&~Ui)>>8&255,Gi.set(Di.subarray(Qi),Ki),Ki+=Di.length-Qi;const Xi=function(rr,ar,gr){let fr=1,lr=0;for(let mr=ar;mr>24&255,Gi[Ki++]=Xi>>16&255,Gi[Ki++]=Xi>>8&255,Gi[Ki++]=255&Xi,Gi}function zi(Di,Ui,Hi,qi){const Gi=Di.width,Ki=Di.height;let Qi,Xi,rr;const ar=Di.data;switch(Ui){case _i.ImageKind.GRAYSCALE_1BPP:Xi=0,Qi=1,rr=Gi+7>>3;break;case _i.ImageKind.RGB_24BPP:Xi=2,Qi=8,rr=3*Gi;break;case _i.ImageKind.RGBA_32BPP:Xi=6,Qi=8,rr=4*Gi;break;default:throw new Error("invalid format")}const gr=new Uint8Array((1+rr)*Ki);let fr=0,lr=0;for(let cr=0;cr>24&255,Gi>>16&255,Gi>>8&255,255&Gi,Ki>>24&255,Ki>>16&255,Ki>>8&255,255&Ki,Qi,Xi,0,0,0]),vr=function(cr){if(!Pi.isNodeJS)return Wi(cr);try{let tr;tr=parseInt(process.versions.node)>=8?cr:Buffer.from(cr);const dr=require$$5.deflateSync(tr,{level:9});return dr instanceof Uint8Array?dr:new Uint8Array(dr)}catch(tr){(0,_i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+tr)}return Wi(cr)}(gr),Yi=Ri.length+36+mr.length+vr.length,nr=new Uint8Array(Yi);let ir=0;return nr.set(Ri,ir),ir+=Ri.length,Ni("IHDR",mr,nr,ir),ir+=12+mr.length,Ni("IDATA",vr,nr,ir),ir+=12+vr.length,Ni("IEND",new Uint8Array(0),nr,ir),xi(nr,"image/png",Hi)}return function(Di,Ui,Hi){return zi(Di,Di.kind===void 0?_i.ImageKind.GRAYSCALE_1BPP:Di.kind,Ui,Hi)}}();class Oi{constructor(){this.fontSizeScale=1,this.fontWeight=Si.fontWeight,this.fontSize=0,this.textMatrix=_i.IDENTITY_MATRIX,this.fontMatrix=_i.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=_i.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=Si.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(Vi,Ni){this.x=Vi,this.y=Ni}}let Mi=0,Fi=0,Bi=0;vi.SVGGraphics=Ai=class{constructor(Ri,Vi,Ni=!1){this.svgFactory=new $i.DOMSVGFactory,this.current=new Oi,this.transformMatrix=_i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=Ri,this.objs=Vi,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!Ni,this._operatorIdMapping=[];for(const Wi in _i.OPS)this._operatorIdMapping[_i.OPS[Wi]]=Wi}save(){this.transformStack.push(this.transformMatrix);const Ri=this.current;this.extraStack.push(Ri),this.current=Ri.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(Ri){this.save(),this.executeOpTree(Ri),this.restore()}loadDependencies(Ri){const Vi=Ri.fnArray,Ni=Ri.argsArray;for(let Wi=0,zi=Vi.length;Wi{Ui.get(Di,qi)});this.current.dependencies.push(Hi)}return Promise.all(this.current.dependencies)}transform(Ri,Vi,Ni,Wi,zi,Di){const Ui=[Ri,Vi,Ni,Wi,zi,Di];this.transformMatrix=_i.Util.transform(this.transformMatrix,Ui),this.tgrp=null}getSVG(Ri,Vi){this.viewport=Vi;const Ni=this._initialize(Vi);return this.loadDependencies(Ri).then(()=>(this.transformMatrix=_i.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(Ri)),Ni))}convertOpList(Ri){const Vi=this._operatorIdMapping,Ni=Ri.argsArray,Wi=Ri.fnArray,zi=[];for(let Di=0,Ui=Wi.length;Di0&&(this.current.lineWidth=Ri)}setLineCap(Ri){this.current.lineCap=Ci[Ri]}setLineJoin(Ri){this.current.lineJoin=ki[Ri]}setMiterLimit(Ri){this.current.miterLimit=Ri}setStrokeAlpha(Ri){this.current.strokeAlpha=Ri}setStrokeRGBColor(Ri,Vi,Ni){this.current.strokeColor=_i.Util.makeHexColor(Ri,Vi,Ni)}setFillAlpha(Ri){this.current.fillAlpha=Ri}setFillRGBColor(Ri,Vi,Ni){this.current.fillColor=_i.Util.makeHexColor(Ri,Vi,Ni),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(Ri){this.current.strokeColor=this._makeColorN_Pattern(Ri)}setFillColorN(Ri){this.current.fillColor=this._makeColorN_Pattern(Ri)}shadingFill(Ri){const Vi=this.viewport.width,Ni=this.viewport.height,Wi=_i.Util.inverseTransform(this.transformMatrix),zi=_i.Util.applyTransform([0,0],Wi),Di=_i.Util.applyTransform([0,Ni],Wi),Ui=_i.Util.applyTransform([Vi,0],Wi),Hi=_i.Util.applyTransform([Vi,Ni],Wi),qi=Math.min(zi[0],Di[0],Ui[0],Hi[0]),Gi=Math.min(zi[1],Di[1],Ui[1],Hi[1]),Ki=Math.max(zi[0],Di[0],Ui[0],Hi[0]),Qi=Math.max(zi[1],Di[1],Ui[1],Hi[1]),Xi=this.svgFactory.createElement("svg:rect");Xi.setAttributeNS(null,"x",qi),Xi.setAttributeNS(null,"y",Gi),Xi.setAttributeNS(null,"width",Ki-qi),Xi.setAttributeNS(null,"height",Qi-Gi),Xi.setAttributeNS(null,"fill",this._makeShadingPattern(Ri)),this.current.fillAlpha<1&&Xi.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().appendChild(Xi)}_makeColorN_Pattern(Ri){return Ri[0]==="TilingPattern"?this._makeTilingPattern(Ri):this._makeShadingPattern(Ri)}_makeTilingPattern(Ri){const Vi=Ri[1],Ni=Ri[2],Wi=Ri[3]||_i.IDENTITY_MATRIX,[zi,Di,Ui,Hi]=Ri[4],qi=Ri[5],Gi=Ri[6],Ki=Ri[7],Qi="shading"+Bi++,[Xi,rr,ar,gr]=_i.Util.normalizeRect([..._i.Util.applyTransform([zi,Di],Wi),..._i.Util.applyTransform([Ui,Hi],Wi)]),[fr,lr]=_i.Util.singularValueDecompose2dScale(Wi),mr=qi*fr,vr=Gi*lr,Yi=this.svgFactory.createElement("svg:pattern");Yi.setAttributeNS(null,"id",Qi),Yi.setAttributeNS(null,"patternUnits","userSpaceOnUse"),Yi.setAttributeNS(null,"width",mr),Yi.setAttributeNS(null,"height",vr),Yi.setAttributeNS(null,"x",`${Xi}`),Yi.setAttributeNS(null,"y",`${rr}`);const nr=this.svg,ir=this.transformMatrix,cr=this.current.fillColor,tr=this.current.strokeColor,dr=this.svgFactory.create(ar-Xi,gr-rr);if(this.svg=dr,this.transformMatrix=Wi,Ki===2){const Ji=_i.Util.makeHexColor(...Vi);this.current.fillColor=Ji,this.current.strokeColor=Ji}return this.executeOpTree(this.convertOpList(Ni)),this.svg=nr,this.transformMatrix=ir,this.current.fillColor=cr,this.current.strokeColor=tr,Yi.appendChild(dr.childNodes[0]),this.defs.appendChild(Yi),`url(#${Qi})`}_makeShadingPattern(Ri){switch(typeof Ri=="string"&&(Ri=this.objs.get(Ri)),Ri[0]){case"RadialAxial":const Vi="shading"+Bi++,Ni=Ri[3];let Wi;switch(Ri[1]){case"axial":const zi=Ri[4],Di=Ri[5];Wi=this.svgFactory.createElement("svg:linearGradient"),Wi.setAttributeNS(null,"id",Vi),Wi.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),Wi.setAttributeNS(null,"x1",zi[0]),Wi.setAttributeNS(null,"y1",zi[1]),Wi.setAttributeNS(null,"x2",Di[0]),Wi.setAttributeNS(null,"y2",Di[1]);break;case"radial":const Ui=Ri[4],Hi=Ri[5],qi=Ri[6],Gi=Ri[7];Wi=this.svgFactory.createElement("svg:radialGradient"),Wi.setAttributeNS(null,"id",Vi),Wi.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),Wi.setAttributeNS(null,"cx",Hi[0]),Wi.setAttributeNS(null,"cy",Hi[1]),Wi.setAttributeNS(null,"r",Gi),Wi.setAttributeNS(null,"fx",Ui[0]),Wi.setAttributeNS(null,"fy",Ui[1]),Wi.setAttributeNS(null,"fr",qi);break;default:throw new Error(`Unknown RadialAxial type: ${Ri[1]}`)}for(const zi of Ni){const Di=this.svgFactory.createElement("svg:stop");Di.setAttributeNS(null,"offset",zi[0]),Di.setAttributeNS(null,"stop-color",zi[1]),Wi.appendChild(Di)}return this.defs.appendChild(Wi),`url(#${Vi})`;case"Mesh":return(0,_i.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${Ri[0]}`)}}setDash(Ri,Vi){this.current.dashArray=Ri,this.current.dashPhase=Vi}constructPath(Ri,Vi){const Ni=this.current;let Wi=Ni.x,zi=Ni.y,Di=[],Ui=0;for(const Hi of Ri)switch(0|Hi){case _i.OPS.rectangle:Wi=Vi[Ui++],zi=Vi[Ui++];const qi=Wi+Vi[Ui++],Gi=zi+Vi[Ui++];Di.push("M",Li(Wi),Li(zi),"L",Li(qi),Li(zi),"L",Li(qi),Li(Gi),"L",Li(Wi),Li(Gi),"Z");break;case _i.OPS.moveTo:Wi=Vi[Ui++],zi=Vi[Ui++],Di.push("M",Li(Wi),Li(zi));break;case _i.OPS.lineTo:Wi=Vi[Ui++],zi=Vi[Ui++],Di.push("L",Li(Wi),Li(zi));break;case _i.OPS.curveTo:Wi=Vi[Ui+4],zi=Vi[Ui+5],Di.push("C",Li(Vi[Ui]),Li(Vi[Ui+1]),Li(Vi[Ui+2]),Li(Vi[Ui+3]),Li(Wi),Li(zi)),Ui+=6;break;case _i.OPS.curveTo2:Di.push("C",Li(Wi),Li(zi),Li(Vi[Ui]),Li(Vi[Ui+1]),Li(Vi[Ui+2]),Li(Vi[Ui+3])),Wi=Vi[Ui+2],zi=Vi[Ui+3],Ui+=4;break;case _i.OPS.curveTo3:Wi=Vi[Ui+2],zi=Vi[Ui+3],Di.push("C",Li(Vi[Ui]),Li(Vi[Ui+1]),Li(Wi),Li(zi),Li(Wi),Li(zi)),Ui+=4;break;case _i.OPS.closePath:Di.push("Z")}Di=Di.join(" "),Ni.path&&Ri.length>0&&Ri[0]!==_i.OPS.rectangle&&Ri[0]!==_i.OPS.moveTo?Di=Ni.path.getAttributeNS(null,"d")+Di:(Ni.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().appendChild(Ni.path)),Ni.path.setAttributeNS(null,"d",Di),Ni.path.setAttributeNS(null,"fill","none"),Ni.element=Ni.path,Ni.setCurrentPoint(Wi,zi)}endPath(){const Ri=this.current;if(Ri.path=null,!this.pendingClip)return;if(!Ri.element){this.pendingClip=null;return}const Vi="clippath"+Mi++,Ni=this.svgFactory.createElement("svg:clipPath");Ni.setAttributeNS(null,"id",Vi),Ni.setAttributeNS(null,"transform",Ii(this.transformMatrix));const Wi=Ri.element.cloneNode(!0);if(this.pendingClip==="evenodd"?Wi.setAttributeNS(null,"clip-rule","evenodd"):Wi.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,Ni.appendChild(Wi),this.defs.appendChild(Ni),Ri.activeClipUrl){Ri.clipGroup=null;for(const zi of this.extraStack)zi.clipGroup=null;Ni.setAttributeNS(null,"clip-path",Ri.activeClipUrl)}Ri.activeClipUrl=`url(#${Vi})`,this.tgrp=null}clip(Ri){this.pendingClip=Ri}closePath(){const Ri=this.current;if(Ri.path){const Vi=`${Ri.path.getAttributeNS(null,"d")}Z`;Ri.path.setAttributeNS(null,"d",Vi)}}setLeading(Ri){this.current.leading=-Ri}setTextRise(Ri){this.current.textRise=Ri}setTextRenderingMode(Ri){this.current.textRenderingMode=Ri}setHScale(Ri){this.current.textHScale=Ri/100}setRenderingIntent(Ri){}setFlatness(Ri){}setGState(Ri){for(const[Vi,Ni]of Ri)switch(Vi){case"LW":this.setLineWidth(Ni);break;case"LC":this.setLineCap(Ni);break;case"LJ":this.setLineJoin(Ni);break;case"ML":this.setMiterLimit(Ni);break;case"D":this.setDash(Ni[0],Ni[1]);break;case"RI":this.setRenderingIntent(Ni);break;case"FL":this.setFlatness(Ni);break;case"Font":this.setFont(Ni);break;case"CA":this.setStrokeAlpha(Ni);break;case"ca":this.setFillAlpha(Ni);break;default:(0,_i.warn)(`Unimplemented graphic state operator ${Vi}`)}}fill(){const Ri=this.current;Ri.element&&(Ri.element.setAttributeNS(null,"fill",Ri.fillColor),Ri.element.setAttributeNS(null,"fill-opacity",Ri.fillAlpha),this.endPath())}stroke(){const Ri=this.current;Ri.element&&(this._setStrokeAttributes(Ri.element),Ri.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(Ri,Vi=1){const Ni=this.current;let Wi=Ni.dashArray;Vi!==1&&Wi.length>0&&(Wi=Wi.map(function(zi){return Vi*zi})),Ri.setAttributeNS(null,"stroke",Ni.strokeColor),Ri.setAttributeNS(null,"stroke-opacity",Ni.strokeAlpha),Ri.setAttributeNS(null,"stroke-miterlimit",Li(Ni.miterLimit)),Ri.setAttributeNS(null,"stroke-linecap",Ni.lineCap),Ri.setAttributeNS(null,"stroke-linejoin",Ni.lineJoin),Ri.setAttributeNS(null,"stroke-width",Li(Vi*Ni.lineWidth)+"px"),Ri.setAttributeNS(null,"stroke-dasharray",Wi.map(Li).join(" ")),Ri.setAttributeNS(null,"stroke-dashoffset",Li(Vi*Ni.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const Ri=this.svgFactory.createElement("svg:rect");Ri.setAttributeNS(null,"x","0"),Ri.setAttributeNS(null,"y","0"),Ri.setAttributeNS(null,"width","1px"),Ri.setAttributeNS(null,"height","1px"),Ri.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().appendChild(Ri)}paintImageXObject(Ri){const Vi=Ri.startsWith("g_")?this.commonObjs.get(Ri):this.objs.get(Ri);Vi?this.paintInlineImageXObject(Vi):(0,_i.warn)(`Dependent image with object ID ${Ri} is not ready yet`)}paintInlineImageXObject(Ri,Vi){const Ni=Ri.width,Wi=Ri.height,zi=Ti(Ri,this.forceDataSchema,!!Vi),Di=this.svgFactory.createElement("svg:rect");Di.setAttributeNS(null,"x","0"),Di.setAttributeNS(null,"y","0"),Di.setAttributeNS(null,"width",Li(Ni)),Di.setAttributeNS(null,"height",Li(Wi)),this.current.element=Di,this.clip("nonzero");const Ui=this.svgFactory.createElement("svg:image");Ui.setAttributeNS(wi,"xlink:href",zi),Ui.setAttributeNS(null,"x","0"),Ui.setAttributeNS(null,"y",Li(-Wi)),Ui.setAttributeNS(null,"width",Li(Ni)+"px"),Ui.setAttributeNS(null,"height",Li(Wi)+"px"),Ui.setAttributeNS(null,"transform",`scale(${Li(1/Ni)} ${Li(-1/Wi)})`),Vi?Vi.appendChild(Ui):this._ensureTransformGroup().appendChild(Ui)}paintImageMaskXObject(Ri){const Vi=this.current,Ni=Ri.width,Wi=Ri.height,zi=Vi.fillColor;Vi.maskId="mask"+Fi++;const Di=this.svgFactory.createElement("svg:mask");Di.setAttributeNS(null,"id",Vi.maskId);const Ui=this.svgFactory.createElement("svg:rect");Ui.setAttributeNS(null,"x","0"),Ui.setAttributeNS(null,"y","0"),Ui.setAttributeNS(null,"width",Li(Ni)),Ui.setAttributeNS(null,"height",Li(Wi)),Ui.setAttributeNS(null,"fill",zi),Ui.setAttributeNS(null,"mask",`url(#${Vi.maskId})`),this.defs.appendChild(Di),this._ensureTransformGroup().appendChild(Ui),this.paintInlineImageXObject(Ri,Di)}paintFormXObjectBegin(Ri,Vi){if(Array.isArray(Ri)&&Ri.length===6&&this.transform(Ri[0],Ri[1],Ri[2],Ri[3],Ri[4],Ri[5]),Vi){const Ni=Vi[2]-Vi[0],Wi=Vi[3]-Vi[1],zi=this.svgFactory.createElement("svg:rect");zi.setAttributeNS(null,"x",Vi[0]),zi.setAttributeNS(null,"y",Vi[1]),zi.setAttributeNS(null,"width",Li(Ni)),zi.setAttributeNS(null,"height",Li(Wi)),this.current.element=zi,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(Ri){const Vi=this.svgFactory.create(Ri.width,Ri.height),Ni=this.svgFactory.createElement("svg:defs");Vi.appendChild(Ni),this.defs=Ni;const Wi=this.svgFactory.createElement("svg:g");return Wi.setAttributeNS(null,"transform",Ii(Ri.transform)),Vi.appendChild(Wi),this.svg=Wi,Vi}_ensureClipGroup(){if(!this.current.clipGroup){const Ri=this.svgFactory.createElement("svg:g");Ri.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.appendChild(Ri),this.current.clipGroup=Ri}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",Ii(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)),this.tgrp}}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.PDFNodeStream=void 0;var _i=bi(1),$i=bi(24);const Pi=require$$5,Ai=require$$5,Si=require$$5,Ei=require$$5,wi=/^file:\/\/\/[a-zA-Z]:\//;vi.PDFNodeStream=class{constructor(Ii){this.source=Ii,this.url=function(Mi){const Fi=Ei.parse(Mi);return Fi.protocol==="file:"||Fi.host?Fi:/^[a-z]:[/\\]/i.test(Mi)?Ei.parse(`file:///${Mi}`):(Fi.host||(Fi.protocol="file:"),Fi)}(Ii.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&Ii.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var Ii,Mi;return(Mi=(Ii=this._fullRequestReader)==null?void 0:Ii._loaded)!=null?Mi:0}getFullReader(){return(0,_i.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new ji(this):new Ti(this),this._fullRequestReader}getRangeReader(Ii,Mi){if(Mi<=this._progressiveDataLength)return null;const Fi=this.isFsUrl?new Li(this,Ii,Mi):new Oi(this,Ii,Mi);return this._rangeRequestReaders.push(Fi),Fi}cancelAllRequests(Ii){this._fullRequestReader&&this._fullRequestReader.cancel(Ii);for(const Mi of this._rangeRequestReaders.slice(0))Mi.cancel(Ii)}};class Ci{constructor(Mi){this._url=Mi.url,this._done=!1,this._storedError=null,this.onProgress=null;const Fi=Mi.source;this._contentLength=Fi.length,this._loaded=0,this._filename=null,this._disableRange=Fi.disableRange||!1,this._rangeChunkSize=Fi.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!Fi.disableStream,this._isRangeSupported=!Fi.disableRange,this._readableStream=null,this._readCapability=(0,_i.createPromiseCapability)(),this._headersCapability=(0,_i.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const Mi=this._readableStream.read();return Mi===null?(this._readCapability=(0,_i.createPromiseCapability)(),this.read()):(this._loaded+=Mi.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(Mi).buffer,done:!1})}cancel(Mi){this._readableStream?this._readableStream.destroy(Mi):this._error(Mi)}_error(Mi){this._storedError=Mi,this._readCapability.resolve()}_setReadableStream(Mi){this._readableStream=Mi,Mi.on("readable",()=>{this._readCapability.resolve()}),Mi.on("end",()=>{Mi.destroy(),this._done=!0,this._readCapability.resolve()}),Mi.on("error",Fi=>{this._error(Fi)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new _i.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class ki{constructor(Mi){this._url=Mi.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,_i.createPromiseCapability)();const Fi=Mi.source;this._isStreamingSupported=!Fi.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const Mi=this._readableStream.read();return Mi===null?(this._readCapability=(0,_i.createPromiseCapability)(),this.read()):(this._loaded+=Mi.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(Mi).buffer,done:!1})}cancel(Mi){this._readableStream?this._readableStream.destroy(Mi):this._error(Mi)}_error(Mi){this._storedError=Mi,this._readCapability.resolve()}_setReadableStream(Mi){this._readableStream=Mi,Mi.on("readable",()=>{this._readCapability.resolve()}),Mi.on("end",()=>{Mi.destroy(),this._done=!0,this._readCapability.resolve()}),Mi.on("error",Fi=>{this._error(Fi)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function xi(Ii,Mi){return{protocol:Ii.protocol,auth:Ii.auth,host:Ii.hostname,port:Ii.port,path:Ii.path,method:"GET",headers:Mi}}class Ti extends Ci{constructor(Mi){super(Mi);const Fi=Bi=>{if(Bi.statusCode===404){const Wi=new _i.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=Wi,this._headersCapability.reject(Wi);return}this._headersCapability.resolve(),this._setReadableStream(Bi);const Ri=Wi=>this._readableStream.headers[Wi.toLowerCase()],{allowRangeRequests:Vi,suggestedLength:Ni}=(0,$i.validateRangeRequestCapabilities)({getResponseHeader:Ri,isHttp:Mi.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=Vi,this._contentLength=Ni||this._contentLength,this._filename=(0,$i.extractFilenameFromHeader)(Ri)};this._request=null,this._url.protocol==="http:"?this._request=Ai.request(xi(this._url,Mi.httpHeaders),Fi):this._request=Si.request(xi(this._url,Mi.httpHeaders),Fi),this._request.on("error",Bi=>{this._storedError=Bi,this._headersCapability.reject(Bi)}),this._request.end()}}class Oi extends ki{constructor(Mi,Fi,Bi){super(Mi),this._httpHeaders={};for(const Vi in Mi.httpHeaders){const Ni=Mi.httpHeaders[Vi];Ni!==void 0&&(this._httpHeaders[Vi]=Ni)}this._httpHeaders.Range=`bytes=${Fi}-${Bi-1}`;const Ri=Vi=>{if(Vi.statusCode!==404)this._setReadableStream(Vi);else{const Ni=new _i.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=Ni}};this._request=null,this._url.protocol==="http:"?this._request=Ai.request(xi(this._url,this._httpHeaders),Ri):this._request=Si.request(xi(this._url,this._httpHeaders),Ri),this._request.on("error",Vi=>{this._storedError=Vi}),this._request.end()}}class ji extends Ci{constructor(Mi){super(Mi);let Fi=decodeURIComponent(this._url.path);wi.test(this._url.href)&&(Fi=Fi.replace(/^\//,"")),Pi.lstat(Fi,(Bi,Ri)=>{Bi?(Bi.code==="ENOENT"&&(Bi=new _i.MissingPDFException(`Missing PDF "${Fi}".`)),this._storedError=Bi,this._headersCapability.reject(Bi)):(this._contentLength=Ri.size,this._setReadableStream(Pi.createReadStream(Fi)),this._headersCapability.resolve())})}}class Li extends ki{constructor(Mi,Fi,Bi){super(Mi);let Ri=decodeURIComponent(this._url.path);wi.test(this._url.href)&&(Ri=Ri.replace(/^\//,"")),this._setReadableStream(Pi.createReadStream(Ri,{start:Fi,end:Bi-1}))}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.createResponseStatusError=function(Ai,Si){return Ai===404||Ai===0&&Si.startsWith("file:")?new _i.MissingPDFException('Missing PDF "'+Si+'".'):new _i.UnexpectedResponseException(`Unexpected server response (${Ai}) while retrieving PDF "${Si}".`,Ai)},vi.extractFilenameFromHeader=function(Ai){const Si=Ai("Content-Disposition");if(Si){let Ei=(0,$i.getFilenameFromContentDispositionHeader)(Si);if(Ei.includes("%"))try{Ei=decodeURIComponent(Ei)}catch{}if((0,Pi.isPdfFile)(Ei))return Ei}return null},vi.validateRangeRequestCapabilities=function({getResponseHeader:Ai,isHttp:Si,rangeChunkSize:Ei,disableRange:wi}){(0,_i.assert)(Ei>0,"Range chunk size must be larger than zero");const Ci={allowRangeRequests:!1,suggestedLength:void 0},ki=parseInt(Ai("Content-Length"),10);return!Number.isInteger(ki)||(Ci.suggestedLength=ki,ki<=2*Ei)||wi||!Si||Ai("Accept-Ranges")!=="bytes"||(Ai("Content-Encoding")||"identity")!=="identity"||(Ci.allowRangeRequests=!0),Ci},vi.validateResponseStatus=function(Ai){return Ai===200||Ai===206};var _i=bi(1),$i=bi(25),Pi=bi(5)},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.getFilenameFromContentDispositionHeader=function($i){let Pi=!0,Ai=Si("filename\\*","i").exec($i);if(Ai){Ai=Ai[1];let Ti=Ci(Ai);return Ti=unescape(Ti),Ti=ki(Ti),Ti=xi(Ti),wi(Ti)}if(Ai=function(Ti){const Oi=[];let ji;const Li=Si("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(ji=Li.exec(Ti))!==null;){let[,Mi,Fi,Bi]=ji;if(Mi=parseInt(Mi,10),Mi in Oi){if(Mi===0)break}else Oi[Mi]=[Fi,Bi]}const Ii=[];for(let Mi=0;Mi{Object.defineProperty(vi,"__esModule",{value:!0}),vi.PDFNetworkStream=void 0;var _i=bi(1),$i=bi(24);class Pi{constructor(wi,Ci={}){this.url=wi,this.isHttp=/^https?:/i.test(wi),this.httpHeaders=this.isHttp&&Ci.httpHeaders||Object.create(null),this.withCredentials=Ci.withCredentials||!1,this.getXhr=Ci.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(wi,Ci,ki){const xi={begin:wi,end:Ci};for(const Ti in ki)xi[Ti]=ki[Ti];return this.request(xi)}requestFull(wi){return this.request(wi)}request(wi){const Ci=this.getXhr(),ki=this.currXhrId++,xi=this.pendingRequests[ki]={xhr:Ci};Ci.open("GET",this.url),Ci.withCredentials=this.withCredentials;for(const Ti in this.httpHeaders){const Oi=this.httpHeaders[Ti];Oi!==void 0&&Ci.setRequestHeader(Ti,Oi)}return this.isHttp&&"begin"in wi&&"end"in wi?(Ci.setRequestHeader("Range",`bytes=${wi.begin}-${wi.end-1}`),xi.expectedStatus=206):xi.expectedStatus=200,Ci.responseType="arraybuffer",wi.onError&&(Ci.onerror=function(Ti){wi.onError(Ci.status)}),Ci.onreadystatechange=this.onStateChange.bind(this,ki),Ci.onprogress=this.onProgress.bind(this,ki),xi.onHeadersReceived=wi.onHeadersReceived,xi.onDone=wi.onDone,xi.onError=wi.onError,xi.onProgress=wi.onProgress,Ci.send(null),ki}onProgress(wi,Ci){var xi;const ki=this.pendingRequests[wi];ki&&((xi=ki.onProgress)==null||xi.call(ki,Ci))}onStateChange(wi,Ci){var ji,Li,Ii;const ki=this.pendingRequests[wi];if(!ki)return;const xi=ki.xhr;if(xi.readyState>=2&&ki.onHeadersReceived&&(ki.onHeadersReceived(),delete ki.onHeadersReceived),xi.readyState!==4||!(wi in this.pendingRequests))return;if(delete this.pendingRequests[wi],xi.status===0&&this.isHttp){(ji=ki.onError)==null||ji.call(ki,xi.status);return}const Ti=xi.status||200;if(!(Ti===200&&ki.expectedStatus===206)&&Ti!==ki.expectedStatus){(Li=ki.onError)==null||Li.call(ki,xi.status);return}const Oi=function(Mi){const Fi=Mi.response;return typeof Fi!="string"?Fi:(0,_i.stringToBytes)(Fi).buffer}(xi);if(Ti===206){const Mi=xi.getResponseHeader("Content-Range"),Fi=/bytes (\d+)-(\d+)\/(\d+)/.exec(Mi);ki.onDone({begin:parseInt(Fi[1],10),chunk:Oi})}else Oi?ki.onDone({begin:0,chunk:Oi}):(Ii=ki.onError)==null||Ii.call(ki,xi.status)}getRequestXhr(wi){return this.pendingRequests[wi].xhr}isPendingRequest(wi){return wi in this.pendingRequests}abortRequest(wi){const Ci=this.pendingRequests[wi].xhr;delete this.pendingRequests[wi],Ci.abort()}}vi.PDFNetworkStream=class{constructor(Ei){this._source=Ei,this._manager=new Pi(Ei.url,{httpHeaders:Ei.httpHeaders,withCredentials:Ei.withCredentials}),this._rangeChunkSize=Ei.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(Ei){const wi=this._rangeRequestReaders.indexOf(Ei);wi>=0&&this._rangeRequestReaders.splice(wi,1)}getFullReader(){return(0,_i.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Ai(this._manager,this._source),this._fullRequestReader}getRangeReader(Ei,wi,Ci=""){const ki=new Si(this._manager,Ei,wi);return ki.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(ki),ki}cancelAllRequests(Ei){var wi;(wi=this._fullRequestReader)==null||wi.cancel(Ei);for(const Ci of this._rangeRequestReaders.slice(0))Ci.cancel(Ei)}};class Ai{constructor(wi,Ci){this._manager=wi;const ki={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=Ci.url,this._fullRequestId=wi.requestFull(ki),this._headersReceivedCapability=(0,_i.createPromiseCapability)(),this._disableRange=Ci.disableRange||!1,this._contentLength=Ci.length,this._rangeChunkSize=Ci.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const wi=this._fullRequestId,Ci=this._manager.getRequestXhr(wi),ki=Oi=>Ci.getResponseHeader(Oi),{allowRangeRequests:xi,suggestedLength:Ti}=(0,$i.validateRangeRequestCapabilities)({getResponseHeader:ki,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});xi&&(this._isRangeSupported=!0),this._contentLength=Ti||this._contentLength,this._filename=(0,$i.extractFilenameFromHeader)(ki),this._isRangeSupported&&this._manager.abortRequest(wi),this._headersReceivedCapability.resolve()}_onDone(wi){if(wi&&(this._requests.length>0?this._requests.shift().resolve({value:wi.chunk,done:!1}):this._cachedChunks.push(wi.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const Ci of this._requests)Ci.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(wi){this._storedError=(0,$i.createResponseStatusError)(wi,this._url),this._headersReceivedCapability.reject(this._storedError);for(const Ci of this._requests)Ci.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(wi){var Ci;(Ci=this.onProgress)==null||Ci.call(this,{loaded:wi.loaded,total:wi.lengthComputable?wi.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const wi=(0,_i.createPromiseCapability)();return this._requests.push(wi),wi.promise}cancel(wi){this._done=!0,this._headersReceivedCapability.reject(wi);for(const Ci of this._requests)Ci.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class Si{constructor(wi,Ci,ki){this._manager=wi;const xi={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=wi.url,this._requestId=wi.requestRange(Ci,ki,xi),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var wi;(wi=this.onClosed)==null||wi.call(this,this)}_onDone(wi){const Ci=wi.chunk;this._requests.length>0?this._requests.shift().resolve({value:Ci,done:!1}):this._queuedChunk=Ci,this._done=!0;for(const ki of this._requests)ki.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(wi){this._storedError=(0,$i.createResponseStatusError)(wi,this._url);for(const Ci of this._requests)Ci.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(wi){var Ci;this.isStreamingSupported||((Ci=this.onProgress)==null||Ci.call(this,{loaded:wi.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const Ci=this._queuedChunk;return this._queuedChunk=null,{value:Ci,done:!1}}if(this._done)return{value:void 0,done:!0};const wi=(0,_i.createPromiseCapability)();return this._requests.push(wi),wi.promise}cancel(wi){this._done=!0;for(const Ci of this._requests)Ci.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(yi,vi,bi)=>{Object.defineProperty(vi,"__esModule",{value:!0}),vi.PDFFetchStream=void 0;var _i=bi(1),$i=bi(24);function Pi(wi,Ci,ki,xi="GET"){return{method:xi,headers:wi,signal:ki==null?void 0:ki.signal,mode:"cors",credentials:Ci?"include":"same-origin",redirect:"follow"}}function Ai(wi){const Ci=new Headers;for(const ki in wi){const xi=wi[ki];xi!==void 0&&Ci.append(ki,xi)}return Ci}vi.PDFFetchStream=class{constructor(wi){this.source=wi,this.isHttp=/^https?:/i.test(wi.url),this.httpHeaders=this.isHttp&&wi.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var wi,Ci;return(Ci=(wi=this._fullRequestReader)==null?void 0:wi._loaded)!=null?Ci:0}getFullReader(){return(0,_i.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Si(this),this._fullRequestReader}getRangeReader(wi,Ci,ki=""){if(Ci<=this._progressiveDataLength)return null;const xi=new Ei(this,wi,Ci,ki);return this._rangeRequestReaders.push(xi),xi}cancelAllRequests(wi){this._fullRequestReader&&this._fullRequestReader.cancel(wi);for(const Ci of this._rangeRequestReaders.slice(0))Ci.cancel(wi)}};class Si{constructor(Ci){this._stream=Ci,this._reader=null,this._loaded=0,this._filename=null;const ki=Ci.source;this._withCredentials=ki.withCredentials||!1,this._contentLength=ki.length,this._headersCapability=(0,_i.createPromiseCapability)(),this._disableRange=ki.disableRange||!1,this._rangeChunkSize=ki.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),typeof AbortController<"u"&&(this._abortController=new AbortController),this._isStreamingSupported=!ki.disableStream,this._isRangeSupported=!ki.disableRange,this._headers=Ai(this._stream.httpHeaders);const xi=ki.url,Ti=ki.streamHttpMethod||"GET";fetch(xi,Pi(this._headers,this._withCredentials,this._abortController,Ti)).then(Oi=>{if(Oi.redirected&&(Ci.source.url=Oi.url),!(0,$i.validateResponseStatus)(Oi.status))throw(0,$i.createResponseStatusError)(Oi.status,xi);this._reader=Oi.body.getReader(),this._headersCapability.resolve();const ji=Mi=>Oi.headers.get(Mi),{allowRangeRequests:Li,suggestedLength:Ii}=(0,$i.validateRangeRequestCapabilities)({getResponseHeader:ji,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=Li,this._contentLength=Ii||this._contentLength,this._filename=(0,$i.extractFilenameFromHeader)(ji),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new _i.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:Ci,done:ki}=await this._reader.read();return ki?{value:Ci,done:ki}:(this._loaded+=Ci.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(Ci).buffer,done:!1})}cancel(Ci){this._reader&&this._reader.cancel(Ci),this._abortController&&this._abortController.abort()}}class Ei{constructor(Ci,ki,xi,Ti=""){this._stream=Ci,this._reader=null,this._loaded=0;const Oi=Ci.source;this._withCredentials=Oi.withCredentials||!1,this._readCapability=(0,_i.createPromiseCapability)(),this._isStreamingSupported=!Oi.disableStream,typeof AbortController<"u"&&(this._abortController=new AbortController),this._headers=Ai(this._stream.httpHeaders),this._headers.append("Range",`bytes=${ki}-${xi-1}`);let ji=Oi.url;if(Oi.inspectFetchUrl&&Ti){const Li={causedBy:`${Ti}:${this._headers.get("range")}`};ji=(0,_i.addParamsToUrl)(ji,Li)}fetch(ji,Pi(this._headers,this._withCredentials,this._abortController)).then(Li=>{if(!(0,$i.validateResponseStatus)(Li.status))throw(0,$i.createResponseStatusError)(Li.status,ji);this._readCapability.resolve(),this._reader=Li.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:Ci,done:ki}=await this._reader.read();return ki?{value:Ci,done:ki}:(this._loaded+=Ci.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(Ci).buffer,done:!1})}cancel(Ci){this._reader&&this._reader.cancel(Ci),this._abortController&&this._abortController.abort()}}}],__webpack_module_cache__={};function __w_pdfjs_require__(yi){var vi=__webpack_module_cache__[yi];if(vi!==void 0)return vi.exports;var bi=__webpack_module_cache__[yi]={exports:{}};return __webpack_modules__[yi](bi,bi.exports,__w_pdfjs_require__),bi.exports}var __webpack_exports__={};return(()=>{var yi=__webpack_exports__;Object.defineProperty(yi,"__esModule",{value:!0}),Object.defineProperty(yi,"AnnotationLayer",{enumerable:!0,get:function(){return $i.AnnotationLayer}}),Object.defineProperty(yi,"AnnotationMode",{enumerable:!0,get:function(){return vi.AnnotationMode}}),Object.defineProperty(yi,"CMapCompressionType",{enumerable:!0,get:function(){return vi.CMapCompressionType}}),Object.defineProperty(yi,"GlobalWorkerOptions",{enumerable:!0,get:function(){return Pi.GlobalWorkerOptions}}),Object.defineProperty(yi,"InvalidPDFException",{enumerable:!0,get:function(){return vi.InvalidPDFException}}),Object.defineProperty(yi,"LoopbackPort",{enumerable:!0,get:function(){return bi.LoopbackPort}}),Object.defineProperty(yi,"MissingPDFException",{enumerable:!0,get:function(){return vi.MissingPDFException}}),Object.defineProperty(yi,"OPS",{enumerable:!0,get:function(){return vi.OPS}}),Object.defineProperty(yi,"PDFDataRangeTransport",{enumerable:!0,get:function(){return bi.PDFDataRangeTransport}}),Object.defineProperty(yi,"PDFDateString",{enumerable:!0,get:function(){return _i.PDFDateString}}),Object.defineProperty(yi,"PDFDocumentLoadingTask",{enumerable:!0,get:function(){return bi.PDFDocumentLoadingTask}}),Object.defineProperty(yi,"PDFDocumentProxy",{enumerable:!0,get:function(){return bi.PDFDocumentProxy}}),Object.defineProperty(yi,"PDFPageProxy",{enumerable:!0,get:function(){return bi.PDFPageProxy}}),Object.defineProperty(yi,"PDFWorker",{enumerable:!0,get:function(){return bi.PDFWorker}}),Object.defineProperty(yi,"PasswordResponses",{enumerable:!0,get:function(){return vi.PasswordResponses}}),Object.defineProperty(yi,"PermissionFlag",{enumerable:!0,get:function(){return vi.PermissionFlag}}),Object.defineProperty(yi,"PixelsPerInch",{enumerable:!0,get:function(){return _i.PixelsPerInch}}),Object.defineProperty(yi,"RenderingCancelledException",{enumerable:!0,get:function(){return _i.RenderingCancelledException}}),Object.defineProperty(yi,"SVGGraphics",{enumerable:!0,get:function(){return Ei.SVGGraphics}}),Object.defineProperty(yi,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return vi.UNSUPPORTED_FEATURES}}),Object.defineProperty(yi,"UnexpectedResponseException",{enumerable:!0,get:function(){return vi.UnexpectedResponseException}}),Object.defineProperty(yi,"Util",{enumerable:!0,get:function(){return vi.Util}}),Object.defineProperty(yi,"VerbosityLevel",{enumerable:!0,get:function(){return vi.VerbosityLevel}}),Object.defineProperty(yi,"WorkerTransport",{enumerable:!0,get:function(){return bi.WorkerTransport}}),Object.defineProperty(yi,"XfaLayer",{enumerable:!0,get:function(){return wi.XfaLayer}}),Object.defineProperty(yi,"build",{enumerable:!0,get:function(){return bi.build}}),Object.defineProperty(yi,"createPromiseCapability",{enumerable:!0,get:function(){return vi.createPromiseCapability}}),Object.defineProperty(yi,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return vi.createValidAbsoluteUrl}}),Object.defineProperty(yi,"getDocument",{enumerable:!0,get:function(){return bi.getDocument}}),Object.defineProperty(yi,"getFilenameFromUrl",{enumerable:!0,get:function(){return _i.getFilenameFromUrl}}),Object.defineProperty(yi,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return _i.getPdfFilenameFromUrl}}),Object.defineProperty(yi,"getXfaPageViewport",{enumerable:!0,get:function(){return _i.getXfaPageViewport}}),Object.defineProperty(yi,"isPdfFile",{enumerable:!0,get:function(){return _i.isPdfFile}}),Object.defineProperty(yi,"loadScript",{enumerable:!0,get:function(){return _i.loadScript}}),Object.defineProperty(yi,"renderTextLayer",{enumerable:!0,get:function(){return Si.renderTextLayer}}),Object.defineProperty(yi,"shadow",{enumerable:!0,get:function(){return vi.shadow}}),Object.defineProperty(yi,"version",{enumerable:!0,get:function(){return bi.version}}),Object.defineProperty(yi,"warn",{enumerable:!0,get:function(){return vi.warn}});var vi=__w_pdfjs_require__(1),bi=__w_pdfjs_require__(4),_i=__w_pdfjs_require__(5),$i=__w_pdfjs_require__(18),Pi=__w_pdfjs_require__(12),Ai=__w_pdfjs_require__(3),Si=__w_pdfjs_require__(21),Ei=__w_pdfjs_require__(22),wi=__w_pdfjs_require__(20);if(Ai.isNodeJS){const{PDFNodeStream:Ci}=__w_pdfjs_require__(23);(0,bi.setPDFNetworkStreamFactory)(ki=>new Ci(ki))}else{const{PDFNetworkStream:Ci}=__w_pdfjs_require__(26),{PDFFetchStream:ki}=__w_pdfjs_require__(27);(0,bi.setPDFNetworkStreamFactory)(xi=>(0,_i.isValidFetchUrl)(xi.url)?new ki(xi):new Ci(xi))}})(),__webpack_exports__})())}(pdf)),pdfExports$1}(function(yi,vi){(function(bi,_i){yi.exports=_i()})(commonjsGlobal,()=>(()=>{var bi=[,(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.animationStarted=Si.VERTICAL_PADDING=Si.UNKNOWN_SCALE=Si.TextLayerMode=Si.SpreadMode=Si.SidebarView=Si.ScrollMode=Si.SCROLLBAR_PADDING=Si.RenderingStates=Si.RendererType=Si.ProgressBar=Si.PresentationModeState=Si.OutputScale=Si.MIN_SCALE=Si.MAX_SCALE=Si.MAX_AUTO_SCALE=Si.DEFAULT_SCALE_VALUE=Si.DEFAULT_SCALE_DELTA=Si.DEFAULT_SCALE=Si.AutoPrintRegExp=void 0,Si.apiPageLayoutToViewerModes=function(Ii){let Mi=wi.VERTICAL,Fi=Ci.NONE;switch(Ii){case"SinglePage":Mi=wi.PAGE;break;case"OneColumn":break;case"TwoPageLeft":Mi=wi.PAGE;case"TwoColumnLeft":Fi=Ci.ODD;break;case"TwoPageRight":Mi=wi.PAGE;case"TwoColumnRight":Fi=Ci.EVEN}return{scrollMode:Mi,spreadMode:Fi}},Si.apiPageModeToSidebarView=function(Ii){switch(Ii){case"UseNone":return Ei.NONE;case"UseThumbs":return Ei.THUMBS;case"UseOutlines":return Ei.OUTLINE;case"UseAttachments":return Ei.ATTACHMENTS;case"UseOC":return Ei.LAYERS}return Ei.NONE},Si.approximateFraction=function(Ii){if(Math.floor(Ii)===Ii)return[Ii,1];const Mi=1/Ii;if(Mi>8)return[1,8];if(Math.floor(Mi)===Mi)return[1,Mi];const Fi=Ii>1?Mi:Ii;let Bi,Ri=0,Vi=1,Ni=1,Wi=1;for(;;){const zi=Ri+Ni,Di=Vi+Wi;if(Di>8)break;Fi<=zi/Di?(Ni=zi,Wi=Di):(Ri=zi,Vi=Di)}return Bi=Fi-Ri/ViWi}:function(Xi){const rr=Xi.div;return rr.offsetTop+rr.clientTop+rr.clientHeight>Vi});qi>0&&qi=Ni&&(Gi=Yi);else if((Bi?gr:fr)>Gi)break;if(Yi<=Vi||fr>=Ni||vr<=Wi||gr>=zi)continue;const nr=Math.max(0,Vi-fr)+Math.max(0,Yi-Ni),ir=(lr-(Math.max(0,Wi-gr)+Math.max(0,vr-zi)))/lr,cr=(mr-nr)/mr*ir*100|0;Di.push({id:rr.id,x:gr,y:fr,view:rr,percent:cr,widthPercent:100*ir|0}),Ui.add(rr.id)}const Ki=Di[0],Qi=Di[Di.length-1];return Fi&&Di.sort(function(Xi,rr){const ar=Xi.percent-rr.percent;return Math.abs(ar)>.001?-ar:Xi.id-rr.id}),{first:Ki,last:Qi,views:Di,ids:Ui}},Si.isPortraitOrientation=function(Ii){return Ii.width<=Ii.height},Si.isValidRotation=function(Ii){return Number.isInteger(Ii)&&Ii%90==0},Si.isValidScrollMode=function(Ii){return Number.isInteger(Ii)&&Object.values(wi).includes(Ii)&&Ii!==wi.UNKNOWN},Si.isValidSpreadMode=function(Ii){return Number.isInteger(Ii)&&Object.values(Ci).includes(Ii)&&Ii!==Ci.UNKNOWN},Si.noContextMenuHandler=function(Ii){Ii.preventDefault()},Si.normalizeWheelEventDelta=function(Ii){let Mi=ji(Ii);return Ii.deltaMode===0?Mi/=900:Ii.deltaMode===1&&(Mi/=30),Mi},Si.normalizeWheelEventDirection=ji,Si.parseQueryString=function(Ii){const Mi=new Map;for(const[Fi,Bi]of new URLSearchParams(Ii))Mi.set(Fi.toLowerCase(),Bi);return Mi},Si.removeNullCharacters=function(Ii,Mi=!1){return typeof Ii!="string"?Ii:(Mi&&(Ii=Ii.replace(xi," ")),Ii.replace(ki,""))},Si.roundToDivide=function(Ii,Mi){const Fi=Ii%Mi;return Fi===0?Ii:Math.round(Ii-Fi+Mi)},Si.scrollIntoView=function(Ii,Mi,Fi=!1){let Bi=Ii.offsetParent;if(!Bi)return;let Ri=Ii.offsetTop+Ii.clientTop,Vi=Ii.offsetLeft+Ii.clientLeft;for(;Bi.clientHeight===Bi.scrollHeight&&Bi.clientWidth===Bi.scrollWidth||Fi&&(Bi.classList.contains("markedContent")||getComputedStyle(Bi).overflow==="hidden");)if(Ri+=Bi.offsetTop,Vi+=Bi.offsetLeft,Bi=Bi.offsetParent,!Bi)return;Mi&&(Mi.top!==void 0&&(Ri+=Mi.top),Mi.left!==void 0&&(Vi+=Mi.left,Bi.scrollLeft=Vi)),Bi.scrollTop=Ri},Si.watchScroll=function(Ii,Mi){const Fi=function(Vi){Ri||(Ri=window.requestAnimationFrame(function(){Ri=null;const Ni=Ii.scrollLeft,Wi=Bi.lastX;Ni!==Wi&&(Bi.right=Ni>Wi),Bi.lastX=Ni;const zi=Ii.scrollTop,Di=Bi.lastY;zi!==Di&&(Bi.down=zi>Di),Bi.lastY=zi,Mi(Bi)}))},Bi={right:!0,down:!0,lastX:Ii.scrollLeft,lastY:Ii.scrollTop,_eventHandler:Fi};let Ri=null;return Ii.addEventListener("scroll",Fi,!0),Bi},Si.DEFAULT_SCALE_VALUE="auto",Si.DEFAULT_SCALE=1,Si.DEFAULT_SCALE_DELTA=1.1,Si.MIN_SCALE=.1,Si.MAX_SCALE=10,Si.UNKNOWN_SCALE=0,Si.MAX_AUTO_SCALE=1.25,Si.SCROLLBAR_PADDING=40,Si.VERTICAL_PADDING=5,Si.RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},Si.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};const Ei={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};Si.SidebarView=Ei,Si.RendererType={CANVAS:"canvas",SVG:"svg"},Si.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_ENHANCE:2};const wi={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};Si.ScrollMode=wi;const Ci={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};Si.SpreadMode=Ci,Si.AutoPrintRegExp=/\bprint\s*\(/,Si.OutputScale=class{constructor(){const Ii=window.devicePixelRatio||1;this.sx=Ii,this.sy=Ii}get scaled(){return this.sx!==1||this.sy!==1}};const ki=/\x00/g,xi=/[\x01-\x1F]/g;function Ti(Ii,Mi,Fi=0){let Bi=Fi,Ri=Ii.length-1;if(Ri<0||!Mi(Ii[Ri]))return Ii.length;if(Mi(Ii[Bi]))return Bi;for(;Bi>1;Mi(Ii[Vi])?Ri=Vi:Bi=Vi+1}return Bi}function Oi(Ii,Mi,Fi){if(Ii<2)return Ii;let Bi=Mi[Ii].div,Ri=Bi.offsetTop+Bi.clientTop;Ri>=Fi&&(Bi=Mi[Ii-1].div,Ri=Bi.offsetTop+Bi.clientTop);for(let Vi=Ii-2;Vi>=0&&(Bi=Mi[Vi].div,!(Bi.offsetTop+Bi.clientTop+Bi.clientHeight<=Ri));--Vi)Ii=Vi;return Ii}function ji(Ii){let Mi=Math.hypot(Ii.deltaX,Ii.deltaY);const Fi=Math.atan2(Ii.deltaY,Ii.deltaX);return-.25*Math.PI0&&document.documentElement.style.setProperty("--loadingBar-end-offset",`${Mi}px`)}hide(){this.visible&&(this.visible=!1,this.bar.classList.add("hidden"))}show(){this.visible||(this.visible=!0,this.bar.classList.remove("hidden"))}}},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.WaitOnType=Si.EventBus=Si.AutomationEventBus=void 0,Si.waitOnEventOrTimeout=function({target:Ci,name:ki,delay:xi=0}){return new Promise(function(Ti,Oi){if(typeof Ci!="object"||!ki||typeof ki!="string"||!(Number.isInteger(xi)&&xi>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function ji(Fi){Ci instanceof wi?Ci._off(ki,Li):Ci.removeEventListener(ki,Li),Mi&&clearTimeout(Mi),Ti(Fi)}const Li=ji.bind(null,Ei.EVENT);Ci instanceof wi?Ci._on(ki,Li):Ci.addEventListener(ki,Li);const Ii=ji.bind(null,Ei.TIMEOUT),Mi=setTimeout(Ii,xi)})};const Ei={EVENT:"event",TIMEOUT:"timeout"};Si.WaitOnType=Ei;class wi{constructor(){this._listeners=Object.create(null)}on(ki,xi,Ti=null){this._on(ki,xi,{external:!0,once:Ti==null?void 0:Ti.once})}off(ki,xi,Ti=null){this._off(ki,xi,{external:!0,once:Ti==null?void 0:Ti.once})}dispatch(ki,xi){const Ti=this._listeners[ki];if(!Ti||Ti.length===0)return;let Oi;for(const{listener:ji,external:Li,once:Ii}of Ti.slice(0))Ii&&this._off(ki,ji),Li?(Oi||(Oi=[])).push(ji):ji(xi);if(Oi){for(const ji of Oi)ji(xi);Oi=null}}_on(ki,xi,Ti=null){var Oi;((Oi=this._listeners)[ki]||(Oi[ki]=[])).push({listener:xi,external:(Ti==null?void 0:Ti.external)===!0,once:(Ti==null?void 0:Ti.once)===!0})}_off(ki,xi,Ti=null){const Oi=this._listeners[ki];if(Oi){for(let ji=0,Li=Oi.length;ji{Object.defineProperty(Si,"__esModule",{value:!0}),Si.compatibilityParams=Si.OptionKind=Si.AppOptions=void 0;const Ei=Object.create(null);Si.compatibilityParams=Ei;{const ki=navigator.userAgent||"",xi=navigator.platform||"",Ti=navigator.maxTouchPoints||1,Oi=/Android/.test(ki);(/\b(iPad|iPhone|iPod)(?=;)/.test(ki)||xi==="MacIntel"&&Ti>1||Oi)&&(Ei.maxCanvasPixels=5242880)}const wi={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};Si.OptionKind=wi;const Ci={annotationMode:{value:2,kind:wi.VIEWER+wi.PREFERENCE},cursorToolOnLoad:{value:0,kind:wi.VIEWER+wi.PREFERENCE},defaultUrl:{value:"compressed.tracemonkey-pldi-09.pdf",kind:wi.VIEWER},defaultZoomValue:{value:"",kind:wi.VIEWER+wi.PREFERENCE},disableHistory:{value:!1,kind:wi.VIEWER},disablePageLabels:{value:!1,kind:wi.VIEWER+wi.PREFERENCE},enablePermissions:{value:!1,kind:wi.VIEWER+wi.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:wi.VIEWER+wi.PREFERENCE},enableScripting:{value:!0,kind:wi.VIEWER+wi.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:wi.VIEWER},externalLinkTarget:{value:0,kind:wi.VIEWER+wi.PREFERENCE},historyUpdateUrl:{value:!1,kind:wi.VIEWER+wi.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:wi.VIEWER+wi.PREFERENCE},imageResourcesPath:{value:"./images/",kind:wi.VIEWER},maxCanvasPixels:{value:16777216,compatibility:Ei.maxCanvasPixels,kind:wi.VIEWER},pdfBugEnabled:{value:!1,kind:wi.VIEWER+wi.PREFERENCE},printResolution:{value:150,kind:wi.VIEWER},renderer:{value:"canvas",kind:wi.VIEWER},sidebarViewOnLoad:{value:-1,kind:wi.VIEWER+wi.PREFERENCE},scrollModeOnLoad:{value:-1,kind:wi.VIEWER+wi.PREFERENCE},spreadModeOnLoad:{value:-1,kind:wi.VIEWER+wi.PREFERENCE},textLayerMode:{value:1,kind:wi.VIEWER+wi.PREFERENCE},useOnlyCssZoom:{value:!1,kind:wi.VIEWER+wi.PREFERENCE},viewerCssTheme:{value:0,kind:wi.VIEWER+wi.PREFERENCE},viewOnLoad:{value:0,kind:wi.VIEWER+wi.PREFERENCE},cMapPacked:{value:!0,kind:wi.API},cMapUrl:{value:"../web/cmaps/",kind:wi.API},disableAutoFetch:{value:!1,kind:wi.API+wi.PREFERENCE},disableFontFace:{value:!1,kind:wi.API+wi.PREFERENCE},disableRange:{value:!1,kind:wi.API+wi.PREFERENCE},disableStream:{value:!1,kind:wi.API+wi.PREFERENCE},docBaseUrl:{value:"",kind:wi.API},enableXfa:{value:!0,kind:wi.API+wi.PREFERENCE},fontExtraProperties:{value:!1,kind:wi.API},isEvalSupported:{value:!0,kind:wi.API},maxImageSize:{value:-1,kind:wi.API},pdfBug:{value:!1,kind:wi.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:wi.API},verbosity:{value:1,kind:wi.API},workerPort:{value:null,kind:wi.WORKER},workerSrc:{value:"../build/pdf.worker.js",kind:wi.WORKER}};Ci.disablePreferences={value:!1,kind:wi.VIEWER},Ci.locale={value:navigator.language||"en-US",kind:wi.VIEWER},Ci.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:wi.VIEWER},Ci.renderer.kind+=wi.PREFERENCE,Si.AppOptions=class{constructor(){this.userOptions=Object.create(null)}get(ki){var Oi;const xi=this.userOptions[ki];if(xi!==void 0)return xi;const Ti=Ci[ki];return Ti!==void 0?(Oi=Ti.compatibility)!=null?Oi:Ti.value:void 0}getAll(ki=null){var Ti;const xi=Object.create(null);for(const Oi in Ci){const ji=Ci[Oi];if(ki){if(!(ki&ji.kind))continue;if(ki===wi.PREFERENCE){const Ii=ji.value,Mi=typeof Ii;if(Mi==="boolean"||Mi==="string"||Mi==="number"&&Number.isInteger(Ii)){xi[Oi]=Ii;continue}throw new Error(`Invalid type for preference: ${Oi}`)}}const Li=this.userOptions[Oi];xi[Oi]=Li!==void 0?Li:(Ti=ji.compatibility)!=null?Ti:ji.value}return xi}set(ki,xi){this.userOptions[ki]=xi}setAll(ki){for(const xi in ki)this.userOptions[xi]=ki[xi]}remove(ki){delete this.userOptions[ki]}_hasUserOptions(){return Object.keys(this.userOptions).length>0}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.getActiveApp=function(){return Ci},Si.initManager=function(xi){return ki||(ki={createApp(Ti,Oi){const ji=wi.ViewerApplication.create(Ti,Oi);return this._register(ji),ji},_register(Ti){let Oi=null;Ti.initializedPromise.then(()=>{xi.forEach(ji=>{Ti.appConfig.sidebar.outerContainer.addEventListener(ji,()=>{Li=Ti,Oi||(Oi=window.requestAnimationFrame(()=>{Oi=null,ki.activateApp(Li)}));var Li})})})},activateApp(Ti){Ci&&window.removeEventListener("keydown",Ci.helper.webViewerKeyDown),Ci=Ti,window.addEventListener("keydown",Ci.helper.webViewerKeyDown)}},ki)};var wi=Ei(5);let Ci=null,ki=null},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.ViewerApplication=void 0;var wi,Ci=Ei(1),ki=Ei(3),xi=Ei(2),Ti=Ei(6),Oi=Ei(7),ji=(wi=Ei(8))&&wi.__esModule?wi:{default:wi},Li=Ei(11),Ii=Ei(12),Mi=Ei(14),Fi=Ei(15),Bi=Ei(25),Ri=Ei(27),Vi=Ei(28),Ni=Ei(29),Wi=Ei(9),zi=Ei(30),Di=Ei(31),Ui=Ei(32),Hi=Ei(20),qi=Ei(33),Gi=Ei(34),Ki=Ei(36),Qi=Ei(37),Xi=Ei(38),rr=Ei(39),ar=Ei(40),gr=Ei(41),fr=Ei(42);const lr={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}},mr=dr=>(dr.preventDefault(),dr.returnValue="",!1),vr=-1,Yi=1,nr={AUTOMATIC:0,LIGHT:1,DARK:2},ir=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"],cr=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"];class tr{constructor(Ji,sr){this.initFields(),this.appConfig=Ji,this.AppOptions=sr,this.helper=(0,ji.default)(this,this.AppOptions),this.bindService();const pr=this.externalServices.isInAutomation?new xi.AutomationEventBus:Ji.eventBus||new xi.EventBus;this.eventBus=pr,this.onCreate()}onCreate(){const{webViewerInitialized:Ji}=this.helper;this.initialize(this.appConfig).then(Ji)}initFields(){this.initialBookmark=document.location.hash.substring(1),this._initializedCapability=(0,Ti.createPromiseCapability)(),this._fellback=!1,this.appConfig=null,this.pdfDocument=null,this.pdfLoadingTask=null,this.printService=null,this.pdfViewer=null,this.pdfThumbnailViewer=null,this.pdfRenderingQueue=null,this.pdfPresentationMode=null,this.pdfDocumentProperties=null,this.pdfLinkService=null,this.pdfHistory=null,this.pdfSidebar=null,this.pdfSidebarResizer=null,this.pdfOutlineViewer=null,this.pdfAttachmentViewer=null,this.pdfLayerViewer=null,this.pdfCursorTools=null,this.pdfScriptingManager=null,this.store=null,this.downloadManager=null,this.overlayManager=null,this.preferences=null,this.toolbar=null,this.secondaryToolbar=null,this.eventBus=null,this.l10n=null,this.isInitialViewSet=!1,this.downloadComplete=!1,this.isViewerEmbedded=window.parent!==window,this.url="",this.baseUrl="",this._downloadUrl="",this.externalServices=gr.DefaultExternalServices,this._boundEvents=Object.create(null),this.documentInfo=null,this.metadata=null,this._contentDispositionFilename=null,this._contentLength=null,this._saveInProgress=!1,this._docStats=null,this._wheelUnusedTicks=0,this._idleCallbacks=new Set}bindService(){(0,fr.bindPrintServiceFactory)(lr),(0,fr.bindExternalService)(this)}static create(Ji,sr){return new tr(Ji,sr)}async initialize(Ji){const{AppOptions:sr}=this;this.preferences=this.externalServices.createPreferences(),await this._readPreferences(),await this._parseHashParameters(),this._forceCssTheme(),await this._initializeL10n(),this.isViewerEmbedded&&sr.get("externalLinkTarget")===Oi.LinkTarget.NONE&&sr.set("externalLinkTarget",Oi.LinkTarget.TOP),await this._initializeViewerComponents(),this.bindEvents(),this.bindWindowEvents();const pr=Ji.appContainer||document.documentElement;this.l10n.translate(pr).then(()=>{this.eventBus.dispatch("localized",{source:this})}),this._initializedCapability.resolve()}async _readPreferences(){const{AppOptions:Ji}=this;if(!Ji.get("disablePreferences")){Ji._hasUserOptions();try{Ji.setAll(await this.preferences.getAll())}catch{}}}async _parseHashParameters(){const{AppOptions:Ji}=this,{loadFakeWorker:sr,initPDFBug:pr}=this.helper;if(!Ji.get("pdfBugEnabled"))return;const or=document.location.hash.substring(1);if(!or)return;const Zi=(0,Ci.parseQueryString)(or),er=[];if(Zi.get("disableworker")==="true"&&er.push(sr()),Zi.has("disablerange")&&Ji.set("disableRange",Zi.get("disablerange")==="true"),Zi.has("disablestream")&&Ji.set("disableStream",Zi.get("disablestream")==="true"),Zi.has("disableautofetch")&&Ji.set("disableAutoFetch",Zi.get("disableautofetch")==="true"),Zi.has("disablefontface")&&Ji.set("disableFontFace",Zi.get("disablefontface")==="true"),Zi.has("disablehistory")&&Ji.set("disableHistory",Zi.get("disablehistory")==="true"),Zi.has("verbosity")&&Ji.set("verbosity",0|Zi.get("verbosity")),Zi.has("textlayer"))switch(Zi.get("textlayer")){case"off":Ji.set("textLayerMode",Ci.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":this.appConfig.viewerContainer.classList.add(`textLayer-${Zi.get("textlayer")}`)}if(Zi.has("pdfbug")){Ji.set("pdfBug",!0),Ji.set("fontExtraProperties",!0);const hr=Zi.get("pdfbug").split(",");er.push(pr(hr))}if(Zi.has("locale")&&Ji.set("locale",Zi.get("locale")),er.length!==0)try{await Promise.all(er)}catch{}}async _initializeL10n(){const{AppOptions:Ji}=this;this.l10n=this.externalServices.createL10n({locale:Ji.get("locale")});const sr=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=sr}_forceCssTheme(){var pr;const{AppOptions:Ji}=this,sr=Ji.get("viewerCssTheme");if(sr!==nr.AUTOMATIC&&Object.values(nr).includes(sr))try{const or=document.styleSheets[0],Zi=(or==null?void 0:or.cssRules)||[];for(let er=0,hr=Zi.length;er0&&this._annotationStorageModified)try{await this.save({sourceEventType:"save"})}catch{}const sr=[];sr.push(this.pdfLoadingTask.destroy()),this.pdfLoadingTask=null,this.pdfDocument&&(this.pdfDocument=null,this.pdfThumbnailViewer.setDocument(null),this.pdfViewer.setDocument(null),this.pdfLinkService.setDocument(null),this.pdfDocumentProperties.setDocument(null)),this.pdfLinkService.externalLinkEnabled=!0,this._fellback=!1,this.store=null,this.isInitialViewSet=!1,this.downloadComplete=!1,this.url="",this.baseUrl="",this._downloadUrl="",this.documentInfo=null,this.metadata=null,this._contentDispositionFilename=null,this._contentLength=null,this._saveInProgress=!1,this._docStats=null,this._cancelIdleCallbacks(),sr.push(this.pdfScriptingManager.destroyPromise),this.pdfSidebar.reset(),this.pdfOutlineViewer.reset(),this.pdfAttachmentViewer.reset(),this.pdfLayerViewer.reset(),(or=this.pdfHistory)==null||or.reset(),(Zi=this.findBar)==null||Zi.reset(),this.toolbar.reset(),this.secondaryToolbar.reset(),typeof PDFBug<"u"&&PDFBug.cleanup(),await Promise.all(sr)}async open(Ji,sr){const{AppOptions:pr}=this;this.pdfLoadingTask&&await this.close();const or=pr.getAll(ki.OptionKind.WORKER);for(const ur in or)Ti.GlobalWorkerOptions[ur]=or[ur];const Zi=Object.create(null);typeof Ji=="string"?(this.setTitleUsingUrl(Ji,Ji),Zi.url=Ji):Ji&&"byteLength"in Ji?Zi.data=Ji:Ji.url&&Ji.originalUrl&&(this.setTitleUsingUrl(Ji.originalUrl,Ji.url),Zi.url=Ji.url);const er=pr.getAll(ki.OptionKind.API);for(const ur in er){let _r=er[ur];Zi[ur]=_r}if(sr)for(const ur in sr)Zi[ur]=sr[ur];const hr=await this.getDocument(Zi);return this.pdfLoadingTask=hr,hr.onPassword=(ur,_r)=>{this.pdfLinkService.externalLinkEnabled=!1,this.passwordPrompt.setUpdateCallback(ur,_r),this.passwordPrompt.open()},hr.onProgress=({loaded:ur,total:_r})=>{this.progress(ur/_r)},hr.onUnsupportedFeature=this.fallback.bind(this),hr.promise.then(ur=>{this.load(ur)},ur=>{if(hr!==this.pdfLoadingTask)return;let _r="loading_error";return ur instanceof Ti.InvalidPDFException?_r="invalid_file_error":ur instanceof Ti.MissingPDFException?_r="missing_file_error":ur instanceof Ti.UnexpectedResponseException&&(_r="unexpected_response_error"),this.l10n.get(_r).then($r=>{throw this._documentError($r,{message:ur==null?void 0:ur.message}),ur})})}async getDocument(Ji){return(0,Ti.getDocument)(Ji)}_ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")}async download({sourceEventType:Ji="download"}={}){const sr=this._downloadUrl,pr=this._docFilename;try{this._ensureDownloadComplete();const or=await this.pdfDocument.getData(),Zi=new Blob([or],{type:"application/pdf"});await this.downloadManager.download(Zi,sr,pr,Ji)}catch{await this.downloadManager.downloadUrl(sr,pr)}}async save({sourceEventType:Ji="download"}={}){if(this._saveInProgress)return;this._saveInProgress=!0,await this.pdfScriptingManager.dispatchWillSave();const sr=this._downloadUrl,pr=this._docFilename;try{this._ensureDownloadComplete();const or=await this.pdfDocument.saveDocument(),Zi=new Blob([or],{type:"application/pdf"});await this.downloadManager.download(Zi,sr,pr,Ji)}catch{await this.download({sourceEventType:Ji})}finally{await this.pdfScriptingManager.dispatchDidSave(),this._saveInProgress=!1}}downloadOrSave(Ji){var sr;((sr=this.pdfDocument)==null?void 0:sr.annotationStorage.size)>0?this.save(Ji):this.download(Ji)}fallback(Ji){this.externalServices.reportTelemetry({type:"unsupportedFeature",featureId:Ji}),this._fellback||(this._fellback=!0,this.externalServices.fallback({featureId:Ji,url:this.baseUrl}).then(sr=>{sr&&this.download({sourceEventType:"download"})}))}_documentError(Ji,sr=null){var pr;this._unblockDocumentLoadEvent(),this._otherError(Ji,sr),this.eventBus.dispatch("documenterror",{source:this,message:Ji,reason:(pr=sr==null?void 0:sr.message)!=null?pr:null})}_otherError(Ji,sr=null){const pr=[this.l10n.get("error_version_info",{version:Ti.version||"?",build:Ti.build||"?"})];sr&&(pr.push(this.l10n.get("error_message",{message:sr.message})),sr.stack?pr.push(this.l10n.get("error_stack",{stack:sr.stack})):(sr.filename&&pr.push(this.l10n.get("error_file",{file:sr.filename})),sr.lineNumber&&pr.push(this.l10n.get("error_line",{line:sr.lineNumber}))));const or=this.appConfig.errorWrapper,Zi=or.container;Zi.hidden=!1,or.errorMessage.textContent=Ji;const er=or.closeButton;er.onclick=function(){Zi.hidden=!0};const hr=or.errorMoreInfo,ur=or.moreInfoButton,_r=or.lessInfoButton;ur.onclick=function(){hr.hidden=!1,ur.hidden=!0,_r.hidden=!1,hr.style.height=hr.scrollHeight+"px"},_r.onclick=function(){hr.hidden=!0,ur.hidden=!1,_r.hidden=!0},ur.oncontextmenu=Ci.noContextMenuHandler,_r.oncontextmenu=Ci.noContextMenuHandler,er.oncontextmenu=Ci.noContextMenuHandler,ur.hidden=!1,_r.hidden=!0,Promise.all(pr).then($r=>{hr.value=$r.join(` `)})}progress(Ji){const{AppOptions:sr}=this;if(this.downloadComplete)return;const pr=Math.round(100*Ji);(pr>this.loadingBar.percent||isNaN(pr))&&(this.loadingBar.percent=pr,(this.pdfDocument?this.pdfDocument.loadingParams.disableAutoFetch:sr.get("disableAutoFetch"))&&pr&&(this.disableAutoFetchLoadingBarTimeout&&(clearTimeout(this.disableAutoFetchLoadingBarTimeout),this.disableAutoFetchLoadingBarTimeout=null),this.loadingBar.show(),this.disableAutoFetchLoadingBarTimeout=setTimeout(()=>{this.loadingBar.hide(),this.disableAutoFetchLoadingBarTimeout=null},5e3)))}load(Ji){const{AppOptions:sr}=this;this.pdfDocument=Ji,Ji.getDownloadInfo().then(({length:Pr})=>{this._contentLength=Pr,this.downloadComplete=!0,this.loadingBar.hide(),hr.then(()=>{this.eventBus.dispatch("documentloaded",{source:this})})});const pr=Ji.getPageLayout().catch(function(){}),or=Ji.getPageMode().catch(function(){}),Zi=Ji.getOpenAction().catch(function(){});this.toolbar.setPagesCount(Ji.numPages,!1),this.secondaryToolbar.setPagesCount(Ji.numPages),this.pdfLinkService.setDocument(Ji,null),this.pdfDocumentProperties.setDocument(Ji,this.url);const er=this.pdfViewer;er.setDocument(Ji);const{firstPagePromise:hr,onePageRendered:ur,pagesPromise:_r}=er;this.pdfThumbnailViewer.setDocument(Ji);const $r=(this.store=new ar.ViewHistory(Ji.fingerprints[0])).getMultiple({page:null,zoom:Ci.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:Ci.SidebarView.UNKNOWN,scrollMode:Ci.ScrollMode.UNKNOWN,spreadMode:Ci.SpreadMode.UNKNOWN}).catch(()=>Object.create(null));hr.then(Pr=>{this.loadingBar.setWidth(this.appConfig.viewerContainer),this._initializeAnnotationStorageCallbacks(Ji),Promise.all([Ci.animationStarted,$r,pr,or,Zi]).then(async([Sr,Tr,kr,Rr,Vr])=>{const Hr=sr.get("viewOnLoad");this._initializePdfHistory({fingerprint:Ji.fingerprints[0],viewOnLoad:Hr,initialDest:Vr==null?void 0:Vr.dest});const Wr=this.initialBookmark,Fr=sr.get("defaultZoomValue");let Lr=Fr?`zoom=${Fr}`:null,Br=null,zr=sr.get("sidebarViewOnLoad"),jr=sr.get("scrollModeOnLoad"),Gr=sr.get("spreadModeOnLoad");Tr.page&&Hr!==Yi&&(Lr=`page=${Tr.page}&zoom=${Fr||Tr.zoom},${Tr.scrollLeft},${Tr.scrollTop}`,Br=parseInt(Tr.rotation,10),zr===Ci.SidebarView.UNKNOWN&&(zr=0|Tr.sidebarView),jr===Ci.ScrollMode.UNKNOWN&&(jr=0|Tr.scrollMode),Gr===Ci.SpreadMode.UNKNOWN&&(Gr=0|Tr.spreadMode)),Rr&&zr===Ci.SidebarView.UNKNOWN&&(zr=(0,Ci.apiPageModeToSidebarView)(Rr)),kr&&jr===Ci.ScrollMode.UNKNOWN&&Gr===Ci.SpreadMode.UNKNOWN&&(Gr=(0,Ci.apiPageLayoutToViewerModes)(kr).spreadMode),this.setInitialView(Lr,{rotation:Br,sidebarView:zr,scrollMode:jr,spreadMode:Gr}),this.eventBus.dispatch("documentinit",{source:this}),this.isViewerEmbedded||er.focus(),await Promise.race([_r,new Promise(Xr=>{setTimeout(Xr,1e4)})]),(Wr||Lr)&&!er.hasEqualPageSizes&&(this.initialBookmark=Wr,er.currentScaleValue=er.currentScaleValue,this.setInitialView(Lr))}).catch(()=>{this.setInitialView()}).then(function(){er.update()})}),_r.then(()=>{this._unblockDocumentLoadEvent(),this._initializeAutoPrint(Ji,Zi)},Pr=>{this.l10n.get("loading_error").then(Sr=>{this._documentError(Sr,{message:Pr==null?void 0:Pr.message})})}),ur.then(Pr=>{if(this.externalServices.reportTelemetry({type:"pageInfo",timestamp:Pr.timestamp}),Ji.getOutline().then(Sr=>{Ji===this.pdfDocument&&this.pdfOutlineViewer.render({outline:Sr,pdfDocument:Ji})}),Ji.getAttachments().then(Sr=>{Ji===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:Sr})}),er.optionalContentConfigPromise.then(Sr=>{Ji===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:Sr,pdfDocument:Ji})}),"requestIdleCallback"in window){const Sr=window.requestIdleCallback(()=>{this._collectTelemetry(Ji),this._idleCallbacks.delete(Sr)},{timeout:1e3});this._idleCallbacks.add(Sr)}}),this._initializePageLabels(Ji),this._initializeMetadata(Ji)}async _scriptingDocProperties(Ji){var sr,pr;return!this.documentInfo&&(await new Promise(or=>{this.eventBus._on("metadataloaded",or,{once:!0})}),Ji!==this.pdfDocument)||!this._contentLength&&(await new Promise(or=>{this.eventBus._on("documentloaded",or,{once:!0})}),Ji!==this.pdfDocument)?null:{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:(sr=this.metadata)==null?void 0:sr.getRaw(),authors:(pr=this.metadata)==null?void 0:pr.get("dc:creator"),numPages:this.pagesCount,URL:this.url}}async _collectTelemetry(Ji){const sr=await this.pdfDocument.getMarkInfo();if(Ji!==this.pdfDocument)return;const pr=(sr==null?void 0:sr.Marked)||!1;this.externalServices.reportTelemetry({type:"tagged",tagged:pr})}async _initializeAutoPrint(Ji,sr){const[pr,or]=await Promise.all([sr,this.pdfViewer.enableScripting?null:Ji.getJavaScript()]);if(Ji!==this.pdfDocument)return;let Zi=!1;if((pr==null?void 0:pr.action)==="Print"&&(Zi=!0),or&&(or.some(er=>er?(this.fallback(Ti.UNSUPPORTED_FEATURES.javaScript),!0):!1),!Zi)){for(const er of or)if(er&&Ci.AutoPrintRegExp.test(er)){Zi=!0;break}}Zi&&this.triggerPrinting()}async _initializeMetadata(Ji){var Pr,Sr;const{info:sr,metadata:pr,contentDispositionFilename:or,contentLength:Zi}=await Ji.getMetadata();if(Ji!==this.pdfDocument)return;this.documentInfo=sr,this.metadata=pr,(Pr=this._contentDispositionFilename)!=null||(this._contentDispositionFilename=or),(Sr=this._contentLength)!=null||(this._contentLength=Zi);let er=sr==null?void 0:sr.Title;const hr=pr==null?void 0:pr.get("dc:title");hr&&(hr==="Untitled"||/[\uFFF0-\uFFFF]/g.test(hr)||(er=hr)),er?this.setTitle(`${er} - ${or||document.title}`):or&&this.setTitle(or),!sr.IsXFAPresent||sr.IsAcroFormPresent||Ji.isPureXfa?!sr.IsAcroFormPresent&&!sr.IsXFAPresent||this.pdfViewer.renderForms||this.fallback(Ti.UNSUPPORTED_FEATURES.forms):(Ji.loadingParams.enableXfa,this.fallback(Ti.UNSUPPORTED_FEATURES.forms)),sr.IsSignaturesPresent&&this.fallback(Ti.UNSUPPORTED_FEATURES.signatures);let ur="other";ir.includes(sr.PDFFormatVersion)&&(ur=`v${sr.PDFFormatVersion.replace(".","_")}`);let _r="other";if(sr.Producer){const Tr=sr.Producer.toLowerCase();cr.some(function(kr){return Tr.includes(kr)?(_r=kr.replace(/[ .-]/g,"_"),!0):!1})}let $r=null;sr.IsXFAPresent?$r="xfa":sr.IsAcroFormPresent&&($r="acroform"),this.externalServices.reportTelemetry({type:"documentInfo",version:ur,generator:_r,formType:$r}),this.eventBus.dispatch("metadataloaded",{source:this})}async _initializePageLabels(Ji){const{AppOptions:sr}=this,pr=await Ji.getPageLabels();if(Ji!==this.pdfDocument||!pr||sr.get("disablePageLabels"))return;const or=pr.length;let Zi=0,er=0;for(let $r=0;$r=or||er>=or)return;const{pdfViewer:hr,pdfThumbnailViewer:ur,toolbar:_r}=this;hr.setPageLabels(pr),ur.setPageLabels(pr),_r.setPagesCount(or,!0),_r.setPageNumber(hr.currentPageNumber,hr.currentPageLabel)}_initializePdfHistory({fingerprint:Ji,viewOnLoad:sr,initialDest:pr=null}){const{AppOptions:or}=this;this.pdfHistory&&(this.pdfHistory.initialize({fingerprint:Ji,resetHistory:sr===Yi,updateUrl:or.get("historyUpdateUrl")}),this.pdfHistory.initialBookmark&&(this.initialBookmark=this.pdfHistory.initialBookmark,this.initialRotation=this.pdfHistory.initialRotation),pr&&!this.initialBookmark&&sr===vr&&(this.initialBookmark=JSON.stringify(pr),this.pdfHistory.push({explicitDest:pr,pageNumber:null})))}_initializeAnnotationStorageCallbacks(Ji){if(Ji!==this.pdfDocument)return;const{annotationStorage:sr}=Ji;sr.onSetModified=()=>{window.addEventListener("beforeunload",mr),this._annotationStorageModified=!0},sr.onResetModified=()=>{window.removeEventListener("beforeunload",mr),delete this._annotationStorageModified}}setInitialView(Ji,{rotation:sr,sidebarView:pr,scrollMode:or,spreadMode:Zi}={}){const er=hr=>{(0,Ci.isValidRotation)(hr)&&(this.pdfViewer.pagesRotation=hr)};this.isInitialViewSet=!0,this.pdfSidebar.setInitialView(pr),((hr,ur)=>{(0,Ci.isValidScrollMode)(hr)&&(this.pdfViewer.scrollMode=hr),(0,Ci.isValidSpreadMode)(ur)&&(this.pdfViewer.spreadMode=ur)})(or,Zi),this.initialBookmark?(er(this.initialRotation),delete this.initialRotation,this.pdfLinkService.setHash(this.initialBookmark),this.initialBookmark=null):Ji&&(er(sr),this.pdfLinkService.setHash(Ji,{isStoredHash:!0})),this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel),this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber),this.pdfViewer.currentScaleValue||(this.pdfViewer.currentScaleValue=Ci.DEFAULT_SCALE_VALUE)}_cleanup(){this.pdfDocument&&(this.pdfViewer.cleanup(),this.pdfThumbnailViewer.cleanup(),this.pdfDocument.cleanup(this.pdfViewer.renderer===Ci.RendererType.SVG))}forceRendering(){this.pdfRenderingQueue.printing=!!this.printService,this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar.isThumbnailViewVisible,this.pdfRenderingQueue.renderHighestPriority()}beforePrint(){const{AppOptions:Ji}=this;if(this.pdfScriptingManager.dispatchWillPrint(),this.printService)return;if(!this.supportsPrinting){this.l10n.get("printing_not_supported").then(ur=>{this._otherError(ur)});return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("printing_not_ready").then(ur=>{window.alert(ur)});return}const sr=this.pdfViewer.getPagesOverview(),pr=this.appConfig.printContainer,or=this.appConfig.printServiceOverlay,Zi=Ji.get("printResolution"),er=this.pdfViewer.optionalContentConfigPromise,hr=lr.instance.createPrintService(this.pdfDocument,sr,pr,Zi,er,this.l10n,or);this.printService=hr,this.forceRendering(),hr.layout(),this.externalServices.reportTelemetry({type:"print"})}afterPrint(){var Ji;this.pdfScriptingManager.dispatchDidPrint(),this.printService&&(this.printService.destroy(),this.printService=null,(Ji=this.pdfDocument)==null||Ji.annotationStorage.resetModified()),this.forceRendering()}rotatePages(Ji){this.pdfViewer.pagesRotation+=Ji}requestPresentationMode(){var Ji;(Ji=this.pdfPresentationMode)==null||Ji.request()}triggerPrinting(){this.supportsPrinting&&window.print()}bindEvents(){const{eventBus:Ji,_boundEvents:sr,AppOptions:pr}=this,{webViewerResize:or,webViewerHashchange:Zi,webViewerPageRendered:er,webViewerUpdateViewarea:hr,webViewerPageChanging:ur,webViewerScaleChanging:_r,webViewerRotationChanging:$r,webViewerSidebarViewChanged:Pr,webViewerPageMode:Sr,webViewerNamedAction:Tr,webViewerPresentationModeChanged:kr,webViewerPresentationMode:Rr,webViewerPrint:Vr,webViewerDownload:Hr,webViewerSave:Wr,webViewerFirstPage:Fr,webViewerLastPage:Lr,webViewerNextPage:Br,webViewerPreviousPage:zr,webViewerZoomIn:jr,webViewerZoomOut:Gr,webViewerZoomReset:Xr,webViewerPageNumberChanged:ns,webViewerScaleChanged:is,webViewerRotateCw:rs,webViewerRotateCcw:ss,webViewerOptionalContentConfig:as,webViewerSwitchScrollMode:os,webViewerSwitchSpreadMode:wr,webViewerDocumentProperties:yr,webViewerUpdateFindMatchesCount:br,webViewerUpdateFindControlState:Ar,webViewerScrollModeChanged:Ir,webViewerSpreadModeChanged:Mr,reportPageStatsPDFBug:Or,webViewerFindFromUrlHash:qr,webViewerFileInputChange:Jr,webViewerOpenFile:Zr}=this.helper;sr.beforePrint=this.beforePrint.bind(this),sr.afterPrint=this.afterPrint.bind(this),Ji._on("resize",or),Ji._on("hashchange",Zi),Ji._on("beforeprint",sr.beforePrint),Ji._on("afterprint",sr.afterPrint),Ji._on("pagerendered",er),Ji._on("updateviewarea",hr),Ji._on("pagechanging",ur),Ji._on("scalechanging",_r),Ji._on("rotationchanging",$r),Ji._on("sidebarviewchanged",Pr),Ji._on("pagemode",Sr),Ji._on("namedaction",Tr),Ji._on("presentationmodechanged",kr),Ji._on("presentationmode",Rr),Ji._on("print",Vr),Ji._on("download",Hr),Ji._on("save",Wr),Ji._on("firstpage",Fr),Ji._on("lastpage",Lr),Ji._on("nextpage",Br),Ji._on("previouspage",zr),Ji._on("zoomin",jr),Ji._on("zoomout",Gr),Ji._on("zoomreset",Xr),Ji._on("pagenumberchanged",ns),Ji._on("scalechanged",is),Ji._on("rotatecw",rs),Ji._on("rotateccw",ss),Ji._on("optionalcontentconfig",as),Ji._on("switchscrollmode",os),Ji._on("scrollmodechanged",Ir),Ji._on("switchspreadmode",wr),Ji._on("spreadmodechanged",Mr),Ji._on("documentproperties",yr),Ji._on("findfromurlhash",qr),Ji._on("updatefindmatchescount",br),Ji._on("updatefindcontrolstate",Ar),pr.get("pdfBug")&&(sr.reportPageStatsPDFBug=Or,Ji._on("pagerendered",sr.reportPageStatsPDFBug),Ji._on("pagechanging",sr.reportPageStatsPDFBug)),Ji._on("fileinputchange",Jr),Ji._on("openfile",Zr)}bindWindowEvents(){const{eventBus:Ji,_boundEvents:sr}=this,{webViewerVisibilityChange:pr,webViewerWheel:or,webViewerTouchStart:Zi,webViewerClick:er,webViewerKeyDown:hr}=this.helper;sr.windowResize=()=>{Ji.dispatch("resize",{source:window})},sr.windowHashChange=()=>{Ji.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})},sr.windowBeforePrint=()=>{Ji.dispatch("beforeprint",{source:window})},sr.windowAfterPrint=()=>{Ji.dispatch("afterprint",{source:window})},sr.windowUpdateFromSandbox=ur=>{Ji.dispatch("updatefromsandbox",{source:window,detail:ur.detail})},window.addEventListener("visibilitychange",pr),window.addEventListener("wheel",or,{passive:!1}),window.addEventListener("touchstart",Zi,{passive:!1}),window.addEventListener("click",er),window.addEventListener("resize",sr.windowResize),window.addEventListener("hashchange",sr.windowHashChange),window.addEventListener("beforeprint",sr.windowBeforePrint),window.addEventListener("afterprint",sr.windowAfterPrint),window.addEventListener("updatefromsandbox",sr.windowUpdateFromSandbox)}unbindEvents(){const{eventBus:Ji,_boundEvents:sr}=this,{webViewerResize:pr,webViewerHashchange:or,webViewerPageRendered:Zi,webViewerUpdateViewarea:er,webViewerPageChanging:hr,webViewerScaleChanging:ur,webViewerRotationChanging:_r,webViewerSidebarViewChanged:$r,webViewerPageMode:Pr,webViewerNamedAction:Sr,webViewerPresentationModeChanged:Tr,webViewerPresentationMode:kr,webViewerPrint:Rr,webViewerDownload:Vr,webViewerSave:Hr,webViewerFirstPage:Wr,webViewerLastPage:Fr,webViewerNextPage:Lr,webViewerPreviousPage:Br,webViewerZoomIn:zr,webViewerZoomOut:jr,webViewerZoomReset:Gr,webViewerPageNumberChanged:Xr,webViewerScaleChanged:ns,webViewerRotateCw:is,webViewerRotateCcw:rs,webViewerOptionalContentConfig:ss,webViewerSwitchScrollMode:as,webViewerSwitchSpreadMode:os,webViewerDocumentProperties:wr,webViewerUpdateFindMatchesCount:yr,webViewerUpdateFindControlState:br,webViewerScrollModeChanged:Ar,webViewerSpreadModeChanged:Ir,webViewerFindFromUrlHash:Mr,webViewerFileInputChange:Or,webViewerOpenFile:qr}=this.helper;Ji._off("resize",pr),Ji._off("hashchange",or),Ji._off("beforeprint",sr.beforePrint),Ji._off("afterprint",sr.afterPrint),Ji._off("pagerendered",Zi),Ji._off("updateviewarea",er),Ji._off("pagechanging",hr),Ji._off("scalechanging",ur),Ji._off("rotationchanging",_r),Ji._off("sidebarviewchanged",$r),Ji._off("pagemode",Pr),Ji._off("namedaction",Sr),Ji._off("presentationmodechanged",Tr),Ji._off("presentationmode",kr),Ji._off("print",Rr),Ji._off("download",Vr),Ji._off("save",Hr),Ji._off("firstpage",Wr),Ji._off("lastpage",Fr),Ji._off("nextpage",Lr),Ji._off("previouspage",Br),Ji._off("zoomin",zr),Ji._off("zoomout",jr),Ji._off("zoomreset",Gr),Ji._off("pagenumberchanged",Xr),Ji._off("scalechanged",ns),Ji._off("rotatecw",is),Ji._off("rotateccw",rs),Ji._off("optionalcontentconfig",ss),Ji._off("switchscrollmode",as),Ji._off("scrollmodechanged",Ar),Ji._off("switchspreadmode",os),Ji._off("spreadmodechanged",Ir),Ji._off("documentproperties",wr),Ji._off("findfromurlhash",Mr),Ji._off("updatefindmatchescount",yr),Ji._off("updatefindcontrolstate",br),sr.reportPageStatsPDFBug&&(Ji._off("pagerendered",sr.reportPageStatsPDFBug),Ji._off("pagechanging",sr.reportPageStatsPDFBug),sr.reportPageStatsPDFBug=null),Ji._off("fileinputchange",Or),Ji._off("openfile",qr),sr.beforePrint=null,sr.afterPrint=null}unbindWindowEvents(){const{_boundEvents:Ji}=this,{webViewerVisibilityChange:sr,webViewerWheel:pr,webViewerTouchStart:or,webViewerClick:Zi,webViewerKeyDown:er}=this.helper;window.removeEventListener("visibilitychange",sr),window.removeEventListener("wheel",pr,{passive:!1}),window.removeEventListener("touchstart",or,{passive:!1}),window.removeEventListener("click",Zi),window.removeEventListener("resize",Ji.windowResize),window.removeEventListener("hashchange",Ji.windowHashChange),window.removeEventListener("beforeprint",Ji.windowBeforePrint),window.removeEventListener("afterprint",Ji.windowAfterPrint),window.removeEventListener("updatefromsandbox",Ji.windowUpdateFromSandbox),Ji.windowResize=null,Ji.windowHashChange=null,Ji.windowBeforePrint=null,Ji.windowAfterPrint=null,Ji.windowUpdateFromSandbox=null}accumulateWheelTicks(Ji){(this._wheelUnusedTicks>0&&Ji<0||this._wheelUnusedTicks<0&&Ji>0)&&(this._wheelUnusedTicks=0),this._wheelUnusedTicks+=Ji;const sr=Math.sign(this._wheelUnusedTicks)*Math.floor(Math.abs(this._wheelUnusedTicks));return this._wheelUnusedTicks-=sr,sr}_unblockDocumentLoadEvent(){document.blockUnblockOnload&&document.blockUnblockOnload(!1),this._unblockDocumentLoadEvent=()=>{}}_reportDocumentStatsTelemetry(){const{stats:Ji}=this.pdfDocument;Ji!==this._docStats&&(this._docStats=Ji,this.externalServices.reportTelemetry({type:"documentStats",stats:Ji}))}get scriptingReady(){return this.pdfScriptingManager.ready}createSidebar(Ji){return new Xi.PDFSidebar(Ji)}createPDFViewer(Ji){return new Fi.PDFViewer(Ji)}}Si.ViewerApplication=tr},Ai=>{let Si;Si=typeof window<"u"&&window["paoding-pdfjs-dist/build/pdf"]?window["paoding-pdfjs-dist/build/pdf"]:requirePdf(),Ai.exports=Si},(Ai,Si,Ei)=>{var Ti,Oi,ws,Li,Ts;Object.defineProperty(Si,"__esModule",{value:!0}),Si.SimpleLinkService=Si.PDFLinkService=Si.LinkTarget=void 0;var wi=Ei(1);const Ci={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};Si.LinkTarget=Ci;function ki(Fi,{url:Bi,target:Ri,rel:Vi,enabled:Ni=!0}={}){if(!Bi||typeof Bi!="string")throw new Error('A valid "url" parameter must provided.');const Wi=(0,wi.removeNullCharacters)(Bi);Ni?Fi.href=Fi.title=Wi:(Fi.href="",Fi.title=`Disabled: ${Wi}`,Fi.onclick=()=>!1);let zi="";switch(Ri){case Ci.NONE:break;case Ci.SELF:zi="_self";break;case Ci.BLANK:zi="_blank";break;case Ci.PARENT:zi="_parent";break;case Ci.TOP:zi="_top"}Fi.target=zi,Fi.rel=typeof Vi=="string"?Vi:"noopener noreferrer nofollow"}const Mi=class{constructor({eventBus:Bi,externalLinkTarget:Ri=null,externalLinkRel:Vi=null,ignoreDestinationZoom:Ni=!1}={}){Er(this,Oi);Er(this,Ti,new Map);this.eventBus=Bi,this.externalLinkTarget=Ri,this.externalLinkRel=Vi,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=Ni,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(Bi,Ri=null){this.baseUrl=Ri,this.pdfDocument=Bi,Cr(this,Ti).clear()}setViewer(Bi){this.pdfViewer=Bi}setHistory(Bi){this.pdfHistory=Bi}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(Bi){this.pdfViewer.currentPageNumber=Bi}get rotation(){return this.pdfViewer.pagesRotation}set rotation(Bi){this.pdfViewer.pagesRotation=Bi}async goToDestination(Bi){if(!this.pdfDocument)return;let Ri,Vi;typeof Bi=="string"?(Ri=Bi,Vi=await this.pdfDocument.getDestination(Bi)):(Ri=null,Vi=await Bi),Array.isArray(Vi)&&xr(this,Oi,ws).call(this,Bi,Ri,Vi)}goToPage(Bi){if(!this.pdfDocument)return;const Ri=typeof Bi=="string"&&this.pdfViewer.pageLabelToPageNumber(Bi)||0|Bi;Number.isInteger(Ri)&&Ri>0&&Ri<=this.pagesCount&&(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(Ri)),this.pdfViewer.scrollPageIntoView({pageNumber:Ri}))}addLinkAttributes(Bi,Ri,Vi=!1){ki(Bi,{url:Ri,target:Vi?Ci.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(Bi){if(typeof Bi=="string"){if(Bi.length>0)return this.getAnchorUrl("#"+escape(Bi))}else if(Array.isArray(Bi)){const Ri=JSON.stringify(Bi);if(Ri.length>0)return this.getAnchorUrl("#"+escape(Ri))}return this.getAnchorUrl("")}getAnchorUrl(Bi){return(this.baseUrl||"")+Bi}setHash(Bi,Ri={isStoredHash:!1}){var Wi;if(!this.pdfDocument)return;let Vi,Ni;if(Bi.includes("=")){const zi=(0,wi.parseQueryString)(Bi);if(zi.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:zi.get("search").replace(/"/g,""),phraseSearch:zi.get("phrase")==="true"}),zi.has("page")&&(Vi=0|zi.get("page")||1),zi.has("zoom")){const Di=zi.get("zoom").split(","),Ui=Di[0],Hi=parseFloat(Ui);Ui.includes("Fit")?Ui==="Fit"||Ui==="FitB"?Ni=[null,{name:Ui}]:Ui==="FitH"||Ui==="FitBH"||Ui==="FitV"||Ui==="FitBV"?Ni=[null,{name:Ui},Di.length>1?0|Di[1]:null]:Ui==="FitR"&&(Di.length!==5||(Ni=[null,{name:Ui},0|Di[1],0|Di[2],0|Di[3],0|Di[4]])):Ni=[null,{name:"XYZ"},Di.length>1?0|Di[1]:null,Di.length>2?0|Di[2]:null,Hi?Hi/100:Ui]}Ni?this.pdfViewer.scrollPageIntoView({pageNumber:Vi||this.page,destArray:Ni,allowNegativeOffset:!0,hashOptions:Ri}):Vi&&(this.page=Vi),zi.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:zi.get("pagemode")}),zi.has("nameddest")&&this.goToDestination(zi.get("nameddest"))}else{Ni=unescape(Bi);try{Ni=JSON.parse(Ni),Array.isArray(Ni)||(Ni=Ni.toString())}catch{}if(typeof Ni=="string"||xr(Wi=Mi,Li,Ts).call(Wi,Ni)){this.goToDestination(Ni);return}}}executeNamedAction(Bi){var Ri,Vi;switch(Bi){case"GoBack":(Ri=this.pdfHistory)==null||Ri.back();break;case"GoForward":(Vi=this.pdfHistory)==null||Vi.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:Bi})}cachePageRef(Bi,Ri){if(!Ri)return;const Vi=Ri.gen===0?`${Ri.num}R`:`${Ri.num}R${Ri.gen}`;Cr(this,Ti).set(Vi,Bi)}_cachedPageNumber(Bi){if(!Bi)return null;const Ri=Bi.gen===0?`${Bi.num}R`:`${Bi.num}R${Bi.gen}`;return Cr(this,Ti).get(Ri)||null}isPageVisible(Bi){return this.pdfViewer.isPageVisible(Bi)}isPageCached(Bi){return this.pdfViewer.isPageCached(Bi)}};let xi=Mi;Ti=new WeakMap,Oi=new WeakSet,ws=function(Bi,Ri=null,Vi){const Ni=Vi[0];let Wi;if(typeof Ni=="object"&&Ni!==null){if(Wi=this._cachedPageNumber(Ni),!Wi){this.pdfDocument.getPageIndex(Ni).then(zi=>{this.cachePageRef(zi+1,Ni),xr(this,Oi,ws).call(this,Bi,Ri,Vi)}).catch(()=>{});return}}else{if(!Number.isInteger(Ni))return;Wi=Ni+1}!Wi||Wi<1||Wi>this.pagesCount||(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:Ri,explicitDest:Vi,pageNumber:Wi})),this.pdfViewer.scrollPageIntoView({pageNumber:Wi,destArray:Vi,ignoreDestinationZoom:this._ignoreDestinationZoom}))},Li=new WeakSet,Ts=function(Bi){if(!Array.isArray(Bi))return!1;const Ri=Bi.length;if(Ri<2)return!1;const Vi=Bi[0];if(!(typeof Vi=="object"&&Number.isInteger(Vi.num)&&Number.isInteger(Vi.gen)||Number.isInteger(Vi)&&Vi>=0))return!1;const Ni=Bi[1];if(typeof Ni!="object"||typeof Ni.name!="string")return!1;let Wi=!0;switch(Ni.name){case"XYZ":if(Ri!==5)return!1;break;case"Fit":case"FitB":return Ri===2;case"FitH":case"FitBH":case"FitV":case"FitBV":if(Ri!==3)return!1;break;case"FitR":if(Ri!==6)return!1;Wi=!1;break;default:return!1}for(let zi=2;zi{Object.defineProperty(Si,"__esModule",{value:!0}),Si.default=void 0;var wi=Ei(1),Ci=Ei(6),ki=Ei(9),xi=function(Ti,Oi){let ji;const Li=["null","http://mozilla.github.io","https://mozilla.github.io"];ji=function(Ni){if(Ni!==void 0)try{const Wi=new URL(window.location.href).origin||"null";if(Li.includes(Wi)||Oi.get("disableCORSOriginCheck"))return;if(new URL(Ni,window.location.href).origin!==Wi)throw new Error("file origin does not match viewer's")}catch(Wi){throw Ti.l10n.get("loading_error").then(zi=>{Ti._documentError(zi,{message:Wi==null?void 0:Wi.message})}),Wi}};function Ii(Ni){Ni?Ti.open(Ni):Ti._hideViewBookmark()}let Mi,Fi;Mi=function(Ni){var Di;if((Di=Ti.pdfViewer)!=null&&Di.isInPresentationMode)return;const Wi=Ni.fileInput.files[0];let zi=URL.createObjectURL(Wi);Wi.name&&(zi={url:zi,originalUrl:Wi.name}),Ti.open(zi)},Fi=function(Ni){const Wi=Ti.appConfig.openFileInputName;document.querySelector(`[data-id="${Wi}"]`).click()};function Bi(){Ti.downloadOrSave({sourceEventType:"save"})}let Ri=null;function Vi(){Ri&&clearTimeout(Ri),Ri=setTimeout(function(){Ri=null},1e3)}return{validateFileURL:ji,loadFakeWorker:async function(){GlobalWorkerOptions.workerSrc||(GlobalWorkerOptions.workerSrc=Oi.get("workerSrc")),await(0,Ci.loadScript)(Ci.PDFWorker.workerSrc)},initPDFBug:async function(Ni){const{debuggerScriptPath:Wi,mainContainer:zi}=Ti.appConfig;await(0,Ci.loadScript)(Wi),PDFBug.init({OPS:Ci.OPS},zi,Ni)},reportPageStatsPDFBug:function({pageNumber:Ni}){var zi,Di;if(typeof Stats>"u"||!Stats.enabled)return;const Wi=(Di=(zi=Ti.pdfViewer.getPageView(Ni-1))==null?void 0:zi.pdfPage)==null?void 0:Di.stats;Wi&&Stats.add(Ni,Wi)},webViewerInitialized:function(){var Ui;const Ni=Ti.appConfig;let Wi;const zi=document.location.search.substring(1);Wi=(Ui=(0,wi.parseQueryString)(zi).get("file"))!=null?Ui:Oi.get("defaultUrl"),ji(Wi);const Di=document.createElement("input");Di.dataset.id=Ni.openFileInputName,Di.className="fileInput",Di.setAttribute("type","file"),Di.oncontextmenu=wi.noContextMenuHandler,document.body.appendChild(Di),window.File&&window.FileReader&&window.FileList&&window.Blob?Di.value=null:(Ni.toolbar.openFile.hidden=!0,Ni.secondaryToolbar.openFileButton.hidden=!0),Di.addEventListener("change",function(Hi){const qi=Hi.target.files;qi&&qi.length!==0&&Ti.eventBus.dispatch("fileinputchange",{source:this,fileInput:Hi.target})}),Oi.get("disableDraggingAndDropping")||(Ni.mainContainer.addEventListener("dragover",function(Hi){Hi.preventDefault(),Hi.dataTransfer.dropEffect="move"}),Ni.mainContainer.addEventListener("drop",function(Hi){Hi.preventDefault();const qi=Hi.dataTransfer.files;qi&&qi.length!==0&&Ti.eventBus.dispatch("fileinputchange",{source:this,fileInput:Hi.dataTransfer})})),Ti.supportsDocumentFonts||(Oi.set("disableFontFace",!0),Ti.l10n.get("web_fonts_disabled").then(Hi=>{})),Ti.supportsPrinting||(Ni.toolbar.print.classList.add("hidden"),Ni.secondaryToolbar.printButton.classList.add("hidden")),Ti.supportsFullscreen||(Ni.toolbar.presentationModeButton.classList.add("hidden"),Ni.secondaryToolbar.presentationModeButton.classList.add("hidden")),Ti.supportsIntegratedFind&&Ni.toolbar.viewFind.classList.add("hidden"),Ni.mainContainer.addEventListener("transitionend",function(Hi){Hi.target===this&&Ti.eventBus.dispatch("resize",{source:this})},!0);try{Ii(Wi)}catch(Hi){Ti.l10n.get("loading_error").then(qi=>{Ti._documentError(qi,Hi)})}},webViewerOpenFileViaURL:Ii,webViewerPageRendered:function({pageNumber:Ni,error:Wi}){if(Ni===Ti.page&&Ti.toolbar.updateLoadingIndicatorState(!1),Ti.pdfSidebar.isThumbnailViewVisible){const zi=Ti.pdfViewer.getPageView(Ni-1),Di=Ti.pdfThumbnailViewer.getThumbnail(Ni-1);zi&&Di&&Di.setImage(zi)}Wi&&Ti.l10n.get("rendering_error").then(zi=>{Ti._otherError(zi,Wi)}),Ti._reportDocumentStatsTelemetry()},webViewerPageMode:function({mode:Ni}){let Wi;switch(Ni){case"thumbs":Wi=wi.SidebarView.THUMBS;break;case"bookmarks":case"outline":Wi=wi.SidebarView.OUTLINE;break;case"attachments":Wi=wi.SidebarView.ATTACHMENTS;break;case"layers":Wi=wi.SidebarView.LAYERS;break;case"none":Wi=wi.SidebarView.NONE;break;default:return}Ti.pdfSidebar.switchView(Wi,!0)},webViewerNamedAction:function(Ni){switch(Ni.action){case"GoToPage":Ti.appConfig.toolbar.pageNumber.select();break;case"Find":Ti.supportsIntegratedFind||Ti.findBar.toggle();break;case"Print":Ti.triggerPrinting();break;case"SaveAs":Bi()}},webViewerPresentationModeChanged:function(Ni){Ti.pdfViewer.presentationModeState=Ni.state},webViewerSidebarViewChanged:function(Ni){var Wi;Ti.pdfRenderingQueue.isThumbnailViewEnabled=Ti.pdfSidebar.isThumbnailViewVisible,Ti.isInitialViewSet&&((Wi=Ti.store)==null||Wi.set("sidebarView",Ni.view).catch(()=>{}))},webViewerUpdateViewarea:function(Ni){var Ui,Hi;const Wi=Ni.location;Ti.isInitialViewSet&&((Ui=Ti.store)==null||Ui.setMultiple({page:Wi.pageNumber,zoom:Wi.scale,scrollLeft:Wi.left,scrollTop:Wi.top,rotation:Wi.rotation}).catch(()=>{}));const zi=Ti.pdfLinkService.getAnchorUrl(Wi.pdfOpenParams);Ti.appConfig.toolbar.viewBookmark.href=zi,Ti.appConfig.secondaryToolbar.viewBookmarkButton.href=zi;const Di=((Hi=Ti.pdfViewer.getPageView(Ti.page-1))==null?void 0:Hi.renderingState)!==wi.RenderingStates.FINISHED;Ti.toolbar.updateLoadingIndicatorState(Di)},webViewerScrollModeChanged:function(Ni){var Wi;Ti.isInitialViewSet&&((Wi=Ti.store)==null||Wi.set("scrollMode",Ni.mode).catch(()=>{}))},webViewerSpreadModeChanged:function(Ni){var Wi;Ti.isInitialViewSet&&((Wi=Ti.store)==null||Wi.set("spreadMode",Ni.mode).catch(()=>{}))},webViewerResize:function(){const{pdfDocument:Ni,pdfViewer:Wi}=Ti;if(!Ni)return;const zi=Wi.currentScaleValue;zi!=="auto"&&zi!=="page-fit"&&zi!=="page-width"||(Wi.currentScaleValue=zi),Wi.update()},webViewerHashchange:function(Ni){var zi;const Wi=Ni.hash;Wi&&(Ti.isInitialViewSet?(zi=Ti.pdfHistory)!=null&&zi.popStateInProgress||Ti.pdfLinkService.setHash(Wi):Ti.initialBookmark=Wi)},webViewerFileInputChange:Mi,webViewerPresentationMode:function(){Ti.requestPresentationMode()},webViewerPrint:function(){Ti.triggerPrinting()},webViewerDownload:function(){Ti.downloadOrSave({sourceEventType:"download"})},webViewerSave:Bi,webViewerFirstPage:function(){Ti.pdfDocument&&(Ti.page=1)},webViewerLastPage:function(){Ti.pdfDocument&&(Ti.page=Ti.pagesCount)},webViewerNextPage:function(){Ti.pdfViewer.nextPage()},webViewerPreviousPage:function(){Ti.pdfViewer.previousPage()},webViewerZoomIn:function(){Ti.zoomIn()},webViewerZoomOut:function(){Ti.zoomOut()},webViewerZoomReset:function(){Ti.zoomReset()},webViewerPageNumberChanged:function(Ni){const Wi=Ti.pdfViewer;Ni.value!==""&&Ti.pdfLinkService.goToPage(Ni.value),Ni.value!==Wi.currentPageNumber.toString()&&Ni.value!==Wi.currentPageLabel&&Ti.toolbar.setPageNumber(Wi.currentPageNumber,Wi.currentPageLabel)},webViewerScaleChanged:function(Ni){Ti.pdfViewer.currentScaleValue=Ni.value},webViewerRotateCw:function(){Ti.rotatePages(90)},webViewerRotateCcw:function(){Ti.rotatePages(-90)},webViewerOptionalContentConfig:function(Ni){Ti.pdfViewer.optionalContentConfigPromise=Ni.promise},webViewerSwitchScrollMode:function(Ni){Ti.pdfViewer.scrollMode=Ni.mode},webViewerSwitchSpreadMode:function(Ni){Ti.pdfViewer.spreadMode=Ni.mode},webViewerDocumentProperties:function(){Ti.pdfDocumentProperties.open()},webViewerUpdateFindMatchesCount:function({matchesCount:Ni}){Ti.supportsIntegratedFind?Ti.externalServices.updateFindMatchesCount(Ni):Ti.findBar.updateResultsCount(Ni)},webViewerUpdateFindControlState:function({state:Ni,previous:Wi,matchesCount:zi,rawQuery:Di}){Ti.supportsIntegratedFind?Ti.externalServices.updateFindControlState({result:Ni,findPrevious:Wi,matchesCount:zi,rawQuery:Di}):Ti.findBar.updateUIState(Ni,Wi,zi)},webViewerScaleChanging:function(Ni){Ti.toolbar.setPageScale(Ni.presetValue,Ni.scale),Ti.pdfViewer.update()},webViewerRotationChanging:function(Ni){Ti.pdfThumbnailViewer.pagesRotation=Ni.pagesRotation,Ti.forceRendering(),Ti.pdfViewer.currentPageNumber=Ni.pageNumber},webViewerPageChanging:function({pageNumber:Ni,pageLabel:Wi}){Ti.toolbar.setPageNumber(Ni,Wi),Ti.secondaryToolbar.setPageNumber(Ni),Ti.pdfSidebar.isThumbnailViewVisible&&Ti.pdfThumbnailViewer.scrollThumbnailIntoView(Ni)},webViewerVisibilityChange:function(Ni){document.visibilityState==="visible"&&Vi()},setZoomDisabledTimeout:Vi,webViewerWheel:function(Ni){const{pdfViewer:Wi,supportedMouseWheelZoomModifierKeys:zi}=Ti;if(!Wi.isInPresentationMode)if(Ni.ctrlKey&&zi.ctrlKey||Ni.metaKey&&zi.metaKey){if(Ni.preventDefault(),Ri||document.visibilityState==="hidden")return;const Di=Ni.deltaMode,Ui=(0,wi.normalizeWheelEventDirection)(Ni),Hi=Wi.currentScale;let qi=0;Di===WheelEvent.DOM_DELTA_LINE||Di===WheelEvent.DOM_DELTA_PAGE?qi=Math.abs(Ui)>=1?Math.sign(Ui):Ti.accumulateWheelTicks(Ui):qi=Ti.accumulateWheelTicks(Ui/30),qi<0?Ti.zoomOut(-qi):qi>0&&Ti.zoomIn(qi);const Gi=Wi.currentScale;if(Hi!==Gi){const Ki=Gi/Hi-1,Qi=Wi.container.getBoundingClientRect(),Xi=Ni.clientX-Qi.left,rr=Ni.clientY-Qi.top;Wi.container.scrollLeft+=Xi*Ki,Wi.container.scrollTop+=rr*Ki}}else Vi()},webViewerTouchStart:function(Ni){Ni.touches.length>1&&Ni.preventDefault()},webViewerClick:function(Ni){if(!Ti.secondaryToolbar.isOpen)return;const Wi=Ti.appConfig;(Ti.pdfViewer.containsElement(Ni.target)||Wi.toolbar.container.contains(Ni.target)&&Ni.target!==Wi.secondaryToolbar.toggleButton)&&Ti.secondaryToolbar.close()},webViewerKeyDown:function(Ni){if(Ti.overlayManager.active)return;const{eventBus:Wi,pdfViewer:zi}=Ti,Di=zi.isInPresentationMode;let Ui=!1,Hi=!1;const qi=(Ni.ctrlKey?1:0)|(Ni.altKey?2:0)|(Ni.shiftKey?4:0)|(Ni.metaKey?8:0);if(qi===1||qi===8||qi===5||qi===12)switch(Ni.keyCode){case 70:!Ti.supportsIntegratedFind&&!Ni.shiftKey&&(Ti.findBar.open(),Ui=!0);break;case 71:if(!Ti.supportsIntegratedFind){const{state:Qi}=Ti.findController;if(Qi){const Xi=Object.assign(Object.create(null),Qi,{source:window,type:"again",findPrevious:qi===5||qi===12});Wi.dispatch("find",Xi)}Ui=!0}break;case 61:case 107:case 187:case 171:Di||Ti.zoomIn(),Ui=!0;break;case 173:case 109:case 189:Di||Ti.zoomOut(),Ui=!0;break;case 48:case 96:Di||(setTimeout(function(){Ti.zoomReset()}),Ui=!1);break;case 38:(Di||Ti.page>1)&&(Ti.page=1,Ui=!0,Hi=!0);break;case 40:(Di||Ti.page1)&&(Ti.page=1,Ui=!0,Hi=!0);break;case 35:(Di||Ti.page0?zi.nextPage():zi.previousPage(),Ui=!0)}if(qi===4)switch(Ni.keyCode){case 13:case 32:if(!Di&&zi.currentScaleValue!=="page-fit")break;zi.previousPage(),Ui=!0;break;case 82:Ti.rotatePages(-90)}Ui||Di||(Ni.keyCode>=33&&Ni.keyCode<=40||Ni.keyCode===32&&Ki!=="BUTTON")&&(Hi=!0),Hi&&!zi.containsElement(Gi)&&zi.focus(),Ui&&Ni.preventDefault()}},beforeUnload:function(Ni){return Ni.preventDefault(),Ni.returnValue="",!1},webViewerFindFromUrlHash:function(Ni){Ti.eventBus.dispatch("find",{source:Ni.source,type:"",query:Ni.query,phraseSearch:Ni.phraseSearch,caseSensitive:!1,entireWord:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})},webViewerOpenFile:Fi}};Si.default=xi},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFCursorTools=Si.CursorTool=void 0;var wi=Ei(10),Ci=Ei(1);const ki={SELECT:0,HAND:1,ZOOM:2};Si.CursorTool=ki,Si.PDFCursorTools=class{constructor({container:xi,eventBus:Ti,cursorToolOnLoad:Oi=ki.SELECT}){this.container=xi,this.eventBus=Ti,this.active=ki.SELECT,this.activeBeforePresentationMode=null,this.handTool=new wi.GrabToPan({element:this.container}),this._addEventListeners(),Promise.resolve().then(()=>{this.switchTool(Oi)})}get activeTool(){return this.active}switchTool(xi){if(this.activeBeforePresentationMode!==null||xi===this.active)return;const Ti=()=>{switch(this.active){case ki.SELECT:break;case ki.HAND:this.handTool.deactivate()}};switch(xi){case ki.SELECT:Ti();break;case ki.HAND:Ti(),this.handTool.activate();break;default:return}this.active=xi,this._dispatchEvent()}_dispatchEvent(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}_addEventListeners(){this.eventBus._on("switchcursortool",xi=>{this.switchTool(xi.tool)}),this.eventBus._on("presentationmodechanged",xi=>{switch(xi.state){case Ci.PresentationModeState.FULLSCREEN:{const Ti=this.active;this.switchTool(ki.SELECT),this.activeBeforePresentationMode=Ti;break}case Ci.PresentationModeState.NORMAL:{const Ti=this.activeBeforePresentationMode;this.activeBeforePresentationMode=null,this.switchTool(Ti);break}}})}}},(Ai,Si)=>{var wi,xs,ki,Is,Ti,ks,ji;Object.defineProperty(Si,"__esModule",{value:!0}),Si.GrabToPan=void 0;const Ei="grab-to-pan-grab";Si.GrabToPan=(ji=class{constructor(Li){Er(this,wi);Er(this,ki);Er(this,Ti);this.element=Li.element,this.document=Li.element.ownerDocument,typeof Li.ignoreTarget=="function"&&(this.ignoreTarget=Li.ignoreTarget),this.onActiveChanged=Li.onActiveChanged,this.activate=this.activate.bind(this),this.deactivate=this.deactivate.bind(this),this.toggle=this.toggle.bind(this),this._onMouseDown=xr(this,wi,xs).bind(this),this._onMouseMove=xr(this,ki,Is).bind(this),this._endPan=xr(this,Ti,ks).bind(this),(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){var Li;this.active||(this.active=!0,this.element.addEventListener("mousedown",this._onMouseDown,!0),this.element.classList.add(Ei),(Li=this.onActiveChanged)==null||Li.call(this,!0))}deactivate(){var Li;this.active&&(this.active=!1,this.element.removeEventListener("mousedown",this._onMouseDown,!0),this._endPan(),this.element.classList.remove(Ei),(Li=this.onActiveChanged)==null||Li.call(this,!1))}toggle(){this.active?this.deactivate():this.activate()}ignoreTarget(Li){return Li.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}},wi=new WeakSet,xs=function(Li){if(Li.button!==0||this.ignoreTarget(Li.target))return;if(Li.originalTarget)try{Li.originalTarget.tagName}catch{return}this.scrollLeftStart=this.element.scrollLeft,this.scrollTopStart=this.element.scrollTop,this.clientXStart=Li.clientX,this.clientYStart=Li.clientY,this.document.addEventListener("mousemove",this._onMouseMove,!0),this.document.addEventListener("mouseup",this._endPan,!0),this.element.addEventListener("scroll",this._endPan,!0),Li.preventDefault(),Li.stopPropagation();const Ii=document.activeElement;Ii&&!Ii.contains(Li.target)&&Ii.blur()},ki=new WeakSet,Is=function(Li){if(this.element.removeEventListener("scroll",this._endPan,!0),!(1&Li.buttons)){this._endPan();return}const Ii=Li.clientX-this.clientXStart,Mi=Li.clientY-this.clientYStart,Fi=this.scrollTopStart-Mi,Bi=this.scrollLeftStart-Ii;this.element.scrollTo?this.element.scrollTo({top:Fi,left:Bi,behavior:"instant"}):(this.element.scrollTop=Fi,this.element.scrollLeft=Bi),this.overlay.parentNode||document.body.appendChild(this.overlay)},Ti=new WeakSet,ks=function(){this.element.removeEventListener("scroll",this._endPan,!0),this.document.removeEventListener("mousemove",this._onMouseMove,!0),this.document.removeEventListener("mouseup",this._endPan,!0),this.overlay.remove()},ji)},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.OverlayManager=void 0,Si.OverlayManager=class{constructor(){this._overlays={},this._active=null,this._keyDownBound=this._keyDown.bind(this)}get active(){return this._active}async register(Ei,wi,Ci=null,ki=!1){let xi;if(!(Ei&&wi&&(xi=wi.parentNode)))throw new Error("Not enough parameters.");if(this._overlays[Ei])throw new Error("The overlay is already registered.");this._overlays[Ei]={element:wi,container:xi,callerCloseMethod:Ci,canForceClose:ki}}async unregister(Ei){if(!this._overlays[Ei])throw new Error("The overlay does not exist.");if(this._active===Ei)throw new Error("The overlay cannot be removed while it is active.");delete this._overlays[Ei]}async open(Ei){if(!this._overlays[Ei])throw new Error("The overlay does not exist.");if(this._active){if(!this._overlays[Ei].canForceClose)throw this._active===Ei?new Error("The overlay is already active."):new Error("Another overlay is currently active.");this._closeThroughCaller()}this._active=Ei,this._overlays[this._active].element.classList.remove("hidden"),this._overlays[this._active].container.classList.remove("hidden"),window.addEventListener("keydown",this._keyDownBound)}async close(Ei){if(!this._overlays[Ei])throw new Error("The overlay does not exist.");if(!this._active)throw new Error("The overlay is currently not active.");if(this._active!==Ei)throw new Error("Another overlay is currently active.");this._overlays[this._active].container.classList.add("hidden"),this._overlays[this._active].element.classList.add("hidden"),this._active=null,window.removeEventListener("keydown",this._keyDownBound)}_keyDown(Ei){this._active&&Ei.keyCode===27&&(this._closeThroughCaller(),Ei.preventDefault())}_closeThroughCaller(){this._overlays[this._active].callerCloseMethod&&this._overlays[this._active].callerCloseMethod(),this._active&&this.close(this._active)}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFFindController=Si.FindState=void 0;var wi=Ei(1),Ci=Ei(6),ki=Ei(13);const xi={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};Si.FindState=xi;const Ti={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},Oi=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]),ji=[...Oi.values()].map(Ni=>String.fromCharCode(Ni)).join(""),Li=/\p{M}+/gu,Ii=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,Mi=/([^\p{M}])\p{M}*$/u,Fi=/^\p{M}*([^\p{M}])/u;let Bi=null;function Ri(Ni){if(!Bi){const Xi=Object.keys(Ti).join("");Bi=new RegExp(`([${Xi}])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(\\n)`,"gum")}const Wi=[];let zi;for(;(zi=Li.exec(Ni))!==null;)Wi.push([zi[0].length,zi.index]);let Di=Ni.normalize("NFD");const Ui=[[0,0]];let Hi=0,qi=0,Gi=0,Ki=0,Qi=!1;return Di=Di.replace(Bi,(Xi,rr,ar,gr,fr,lr)=>{var mr;if(lr-=Gi,rr){const vr=Ti[Xi],Yi=vr.length;for(let nr=1;nrGi[0]>=Di);Ni[Hi][0]>Di&&--Hi;let qi=(0,wi.binarySearchFirstItem)(Ni,Gi=>Gi[0]>=Ui,Hi);return Ni[qi][0]>Ui&&--qi,[Di+Ni[Hi][1],zi+Ni[qi][1]-Ni[Hi][1]]}Si.PDFFindController=class{constructor({linkService:Ni,eventBus:Wi}){this._linkService=Ni,this._eventBus=Wi,this._reset(),Wi._on("find",this._onFind.bind(this)),Wi._on("findbarclose",this._onFindBarClose.bind(this)),this.executeCommand=(zi,Di)=>{const Ui=Object.assign(Object.create(null),Di,{type:zi.substring(4)});this._onFind(Ui)}}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(Ni){this._pdfDocument&&this._reset(),Ni&&(this._pdfDocument=Ni,this._firstPageCapability.resolve())}_onFind(Ni){if(!Ni)return;const Wi=this._pdfDocument,{type:zi}=Ni;(this._state===null||this._shouldDirtyMatch(Ni))&&(this._dirtyMatch=!0),this._state=Ni,zi!=="highlightallchange"&&this._updateUIState(xi.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||Wi&&this._pdfDocument!==Wi)return;this._extractText();const Di=!this._highlightMatches,Ui=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),zi?this._dirtyMatch?this._nextMatch():zi==="again"?(this._nextMatch(),Di&&this._state.highlightAll&&this._updateAllPages()):zi==="highlightallchange"?(Ui?this._nextMatch():this._highlightMatches=!0,this._updateAllPages()):this._nextMatch():this._findTimeout=setTimeout(()=>{this._nextMatch(),this._findTimeout=null},250)})}scrollMatchIntoView({element:Ni=null,selectedLeft:Wi=0,pageIndex:zi=-1,matchIndex:Di=-1}){if(!this._scrollMatches||!Ni||Di===-1||Di!==this._selected.matchIdx||zi===-1||zi!==this._selected.pageIdx)return;this._scrollMatches=!1;const Ui={top:-150,left:Wi+-400};(0,wi.scrollIntoView)(Ni,Ui,!0)}_reset(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this._state=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=(0,Ci.createPromiseCapability)()}get _query(){return this._state.query!==this._rawQuery&&(this._rawQuery=this._state.query,[this._normalizedQuery]=Ri(this._state.query)),this._normalizedQuery}_shouldDirtyMatch(Ni){if(Ni.query!==this._state.query)return!0;switch(Ni.type){case"again":const Wi=this._selected.pageIdx+1,zi=this._linkService;return Wi>=1&&Wi<=zi.pagesCount&&Wi!==zi.page&&!zi.isPageVisible(Wi);case"highlightallchange":return!1}return!0}_isEntireWord(Ni,Wi,zi){let Di=Ni.slice(0,Wi).match(Mi);if(Di){const Ui=Ni.charCodeAt(Wi),Hi=Di[1].charCodeAt(0);if((0,ki.getCharacterType)(Ui)===(0,ki.getCharacterType)(Hi))return!1}if(Di=Ni.slice(Wi+zi).match(Fi),Di){const Ui=Ni.charCodeAt(Wi+zi-1),Hi=Di[1].charCodeAt(0);if((0,ki.getCharacterType)(Ui)===(0,ki.getCharacterType)(Hi))return!1}return!0}_calculateRegExpMatch(Ni,Wi,zi,Di){const Ui=[],Hi=[],qi=this._pageDiffs[zi];let Gi;for(;(Gi=Ni.exec(Di))!==null;){if(Wi&&!this._isEntireWord(Di,Gi.index,Gi[0].length))continue;const[Ki,Qi]=Vi(qi,Gi.index,Gi[0].length);Qi&&(Ui.push(Ki),Hi.push(Qi))}this._pageMatches[zi]=Ui,this._pageMatchesLength[zi]=Hi}_convertToRegExpString(Ni,Wi){const{matchDiacritics:zi}=this._state;let Di=!1;const Ui="[ ]*";return(Ni=Ni.replace(Ii,(Hi,qi,Gi,Ki,Qi,Xi)=>qi?`[ ]*\\${qi}[ ]*`:Gi?`[ ]*${Gi}[ ]*`:Ki?"[ ]+":zi?Qi||Xi:Qi?Oi.has(Qi.charCodeAt(0))?Qi:"":Wi?(Di=!0,`${Xi}\\p{M}*`):Xi)).endsWith(Ui)&&(Ni=Ni.slice(0,Ni.length-Ui.length)),zi&&Wi&&(Di=!0,Ni=`${Ni}(?=[${ji}]|[^\\p{M}]|$)`),[Di,Ni]}_calculateMatch(Ni){let Wi=this._query;if(Wi.length===0)return;const{caseSensitive:zi,entireWord:Di,phraseSearch:Ui}=this._state,Hi=this._pageContents[Ni],qi=this._hasDiacritics[Ni];let Gi=!1;if(Ui)[Gi,Wi]=this._convertToRegExpString(Wi,qi);else{const Qi=Wi.match(/\S+/g);Qi&&(Wi=Qi.sort().reverse().map(Xi=>{const[rr,ar]=this._convertToRegExpString(Xi,qi);return Gi||(Gi=rr),`(${ar})`}).join("|"))}Wi=new RegExp(Wi,`g${Gi?"u":""}${zi?"":"i"}`),this._calculateRegExpMatch(Wi,Di,Ni,Hi),this._state.highlightAll&&this._updatePage(Ni),this._resumePageIdx===Ni&&(this._resumePageIdx=null,this._nextPageMatch());const Ki=this._pageMatches[Ni].length;Ki>0&&(this._matchesCountTotal+=Ki,this._updateUIResultsCount())}_extractText(){if(this._extractTextPromises.length>0)return;let Ni=Promise.resolve();for(let Wi=0,zi=this._linkService.pagesCount;Withis._pdfDocument.getPage(Wi+1).then(Ui=>Ui.getTextContent()).then(Ui=>{const Hi=Ui.items,qi=[];for(let Gi=0,Ki=Hi.length;Gi{this._pageContents[Wi]="",this._pageDiffs[Wi]=null,this._hasDiacritics[Wi]=!1,Di.resolve(Wi)}))}}_updatePage(Ni){this._scrollMatches&&this._selected.pageIdx===Ni&&(this._linkService.page=Ni+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:Ni})}_updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}_nextMatch(){const Ni=this._state.findPrevious,Wi=this._linkService.page-1,zi=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=Wi,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this._matchesCountTotal=0,this._updateAllPages();for(let Ui=0;Ui{this._pendingFindMatches.delete(Hi),this._calculateMatch(Hi)}))}if(this._query===""){this._updateUIState(xi.FOUND);return}if(this._resumePageIdx)return;const Di=this._offset;if(this._pagesToSearch=zi,Di.matchIdx!==null){const Ui=this._pageMatches[Di.pageIdx].length;if(!Ni&&Di.matchIdx+10){Di.matchIdx=Ni?Di.matchIdx-1:Di.matchIdx+1,this._updateMatch(!0);return}this._advanceOffsetPage(Ni)}this._nextPageMatch()}_matchesReady(Ni){const Wi=this._offset,zi=Ni.length,Di=this._state.findPrevious;return zi?(Wi.matchIdx=Di?zi-1:0,this._updateMatch(!0),!0):(this._advanceOffsetPage(Di),Wi.wrapped&&(Wi.matchIdx=null,this._pagesToSearch<0)?(this._updateMatch(!1),!0):!1)}_nextPageMatch(){this._resumePageIdx;let Ni=null;do{const Wi=this._offset.pageIdx;if(Ni=this._pageMatches[Wi],!Ni){this._resumePageIdx=Wi;break}}while(!this._matchesReady(Ni))}_advanceOffsetPage(Ni){const Wi=this._offset,zi=this._linkService.pagesCount;Wi.pageIdx=Ni?Wi.pageIdx-1:Wi.pageIdx+1,Wi.matchIdx=null,this._pagesToSearch--,(Wi.pageIdx>=zi||Wi.pageIdx<0)&&(Wi.pageIdx=Ni?zi-1:0,Wi.wrapped=!0)}_updateMatch(Ni=!1){let Wi=xi.NOT_FOUND;const zi=this._offset.wrapped;if(this._offset.wrapped=!1,Ni){const Di=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,Wi=zi?xi.WRAPPED:xi.FOUND,Di!==-1&&Di!==this._selected.pageIdx&&this._updatePage(Di)}this._updateUIState(Wi,this._state.findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,this._updatePage(this._selected.pageIdx))}_onFindBarClose(Ni){const Wi=this._pdfDocument;this._firstPageCapability.promise.then(()=>{this._pdfDocument&&(!Wi||this._pdfDocument===Wi)&&(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this._updateUIState(xi.FOUND),this._highlightMatches=!1,this._updateAllPages())})}_requestMatchesCount(){var Ui;const{pageIdx:Ni,matchIdx:Wi}=this._selected;let zi=0,Di=this._matchesCountTotal;if(Wi!==-1){for(let Hi=0;HiDi)&&(zi=Di=0),{current:zi,total:Di}}_updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}_updateUIState(Ni,Wi=!1){var zi,Di;this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:Ni,previous:Wi,matchesCount:this._requestMatchesCount(),rawQuery:(Di=(zi=this._state)==null?void 0:zi.query)!=null?Di:null})}}},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.CharacterType=void 0,Si.getCharacterType=function(wi){return function(Ci){return Ci<11904}(wi)?function(Ci){return(65408&Ci)==0}(wi)?function(Ci){return Ci===32||Ci===9||Ci===13||Ci===10}(wi)?Ei.SPACE:function(Ci){return Ci>=97&&Ci<=122||Ci>=65&&Ci<=90}(wi)||function(Ci){return Ci>=48&&Ci<=57}(wi)||wi===95?Ei.ALPHA_LETTER:Ei.PUNCT:function(Ci){return(65408&Ci)==3584}(wi)?Ei.THAI_LETTER:wi===160?Ei.SPACE:Ei.ALPHA_LETTER:function(Ci){return Ci>=13312&&Ci<=40959||Ci>=63744&&Ci<=64255}(wi)?Ei.HAN_LETTER:function(Ci){return Ci>=12448&&Ci<=12543}(wi)?Ei.KATAKANA_LETTER:function(Ci){return Ci>=12352&&Ci<=12447}(wi)?Ei.HIRAGANA_LETTER:function(Ci){return Ci>=65376&&Ci<=65439}(wi)?Ei.HALFWIDTH_KATAKANA_LETTER:Ei.ALPHA_LETTER};const Ei={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};Si.CharacterType=Ei},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFScriptingManager=void 0;var wi=Ei(1),Ci=Ei(6);Si.PDFScriptingManager=class{constructor({eventBus:ki,sandboxBundleSrc:xi=null,scriptingFactory:Ti=null,docPropertiesLookup:Oi=null}){this._pdfDocument=null,this._pdfViewer=null,this._closeCapability=null,this._destroyCapability=null,this._scripting=null,this._mouseState=Object.create(null),this._ready=!1,this._eventBus=ki,this._sandboxBundleSrc=xi,this._scriptingFactory=Ti,this._docPropertiesLookup=Oi}setViewer(ki){this._pdfViewer=ki}async setDocument(ki){var ji;if(this._pdfDocument&&await this._destroyScripting(),this._pdfDocument=ki,!ki)return;const[xi,Ti,Oi]=await Promise.all([ki.getFieldObjects(),ki.getCalculationOrderIds(),ki.getJSActions()]);if(xi||Oi){if(ki===this._pdfDocument){try{this._scripting=this._createScripting()}catch{await this._destroyScripting();return}this._internalEvents.set("updatefromsandbox",Li=>{(Li==null?void 0:Li.source)===window&&this._updateFromSandbox(Li.detail)}),this._internalEvents.set("dispatcheventinsandbox",Li=>{var Ii;(Ii=this._scripting)==null||Ii.dispatchEventInSandbox(Li.detail)}),this._internalEvents.set("pagechanging",({pageNumber:Li,previous:Ii})=>{Li!==Ii&&(this._dispatchPageClose(Ii),this._dispatchPageOpen(Li))}),this._internalEvents.set("pagerendered",({pageNumber:Li})=>{this._pageOpenPending.has(Li)&&Li===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(Li)}),this._internalEvents.set("pagesdestroy",async Li=>{var Ii,Mi;await this._dispatchPageClose(this._pdfViewer.currentPageNumber),await((Ii=this._scripting)==null?void 0:Ii.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(Mi=this._closeCapability)==null||Mi.resolve()}),this._domEvents.set("mousedown",Li=>{this._mouseState.isDown=!0}),this._domEvents.set("mouseup",Li=>{this._mouseState.isDown=!1});for(const[Li,Ii]of this._internalEvents)this._eventBus._on(Li,Ii);for(const[Li,Ii]of this._domEvents)window.addEventListener(Li,Ii);try{const Li=await this._getDocProperties();if(ki!==this._pdfDocument)return;await this._scripting.createSandbox({objects:xi,calculationOrder:Ti,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...Li,actions:Oi}}),this._eventBus.dispatch("sandboxcreated",{source:this})}catch{await this._destroyScripting();return}await((ji=this._scripting)==null?void 0:ji.dispatchEventInSandbox({id:"doc",name:"Open"})),await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0),Promise.resolve().then(()=>{ki===this._pdfDocument&&(this._ready=!0)})}}else await this._destroyScripting()}async dispatchWillSave(ki){var xi;return(xi=this._scripting)==null?void 0:xi.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(ki){var xi;return(xi=this._scripting)==null?void 0:xi.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(ki){var xi;return(xi=this._scripting)==null?void 0:xi.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(ki){var xi;return(xi=this._scripting)==null?void 0:xi.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get mouseState(){return this._mouseState}get destroyPromise(){var ki;return((ki=this._destroyCapability)==null?void 0:ki.promise)||null}get ready(){return this._ready}get _internalEvents(){return(0,Ci.shadow)(this,"_internalEvents",new Map)}get _domEvents(){return(0,Ci.shadow)(this,"_domEvents",new Map)}get _pageOpenPending(){return(0,Ci.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,Ci.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(ki){var Mi;const xi=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:Ti,siblings:Oi,command:ji,value:Li}=ki;if(!Ti){switch(ji){case"clear":case"error":case"println":break;case"layout":if(xi)return;const Fi=(0,wi.apiPageLayoutToViewerModes)(Li);this._pdfViewer.spreadMode=Fi.spreadMode;break;case"page-num":this._pdfViewer.currentPageNumber=Li+1;break;case"print":await this._pdfViewer.pagesPromise,this._eventBus.dispatch("print",{source:this});break;case"zoom":if(xi)return;this._pdfViewer.currentScaleValue=Li;break;case"SaveAs":this._eventBus.dispatch("save",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(xi)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(xi)return;this._pdfViewer.decreaseScale()}return}if(xi&&ki.focus)return;delete ki.id,delete ki.siblings;const Ii=Oi?[Ti,...Oi]:[Ti];for(const Fi of Ii){const Bi=document.getElementById(Fi);Bi?Bi.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:ki})):(Mi=this._pdfDocument)==null||Mi.annotationStorage.setValue(Fi,ki)}}async _dispatchPageOpen(ki,xi=!1){const Ti=this._pdfDocument,Oi=this._visitedPages;if(xi&&(this._closeCapability=(0,Ci.createPromiseCapability)()),!this._closeCapability)return;const ji=this._pdfViewer.getPageView(ki-1);if((ji==null?void 0:ji.renderingState)!==wi.RenderingStates.FINISHED){this._pageOpenPending.add(ki);return}this._pageOpenPending.delete(ki);const Li=(async()=>{var Mi,Fi;const Ii=await(Oi.has(ki)?null:(Mi=ji.pdfPage)==null?void 0:Mi.getJSActions());Ti===this._pdfDocument&&await((Fi=this._scripting)==null?void 0:Fi.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:ki,actions:Ii}))})();Oi.set(ki,Li)}async _dispatchPageClose(ki){var ji;const xi=this._pdfDocument,Ti=this._visitedPages;if(!this._closeCapability||this._pageOpenPending.has(ki))return;const Oi=Ti.get(ki);Oi&&(Ti.set(ki,null),await Oi,xi===this._pdfDocument&&await((ji=this._scripting)==null?void 0:ji.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:ki})))}async _getDocProperties(){if(this._docPropertiesLookup)return this._docPropertiesLookup(this._pdfDocument);throw new Error("_getDocProperties: Unable to lookup properties.")}_createScripting(){if(this._destroyCapability=(0,Ci.createPromiseCapability)(),this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});throw new Error("_createScripting: Cannot create scripting.")}async _destroyScripting(){var ki,xi;if(this._scripting){this._closeCapability&&(await Promise.race([this._closeCapability.promise,new Promise(Ti=>{setTimeout(Ti,1e3)})]).catch(Ti=>{}),this._closeCapability=null),this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch{}for(const[Ti,Oi]of this._internalEvents)this._eventBus._off(Ti,Oi);this._internalEvents.clear();for(const[Ti,Oi]of this._domEvents)window.removeEventListener(Ti,Oi);this._domEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this._scripting=null,delete this._mouseState.isDown,this._ready=!1,(ki=this._destroyCapability)==null||ki.resolve()}else this._pdfDocument=null,(xi=this._destroyCapability)==null||xi.resolve()}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFViewer=Si.PDFSinglePageViewer=void 0;var wi=Ei(1),Ci=Ei(16);class ki extends Ci.BaseViewer{}Si.PDFViewer=ki;class xi extends Ci.BaseViewer{_resetView(){super._resetView(),this._scrollMode=wi.ScrollMode.PAGE,this._spreadMode=wi.SpreadMode.NONE}set scrollMode(Oi){}_updateScrollMode(){}set spreadMode(Oi){}_updateSpreadMode(){}}Si.PDFSinglePageViewer=xi},(Ai,Si,Ei)=>{var Wi,zi,Di,Ps,Hi,qi,Gi,Ki,Qi,Xi,rr,ar,Ms,fr,Os,mr,hs,Yi,Ls,ir,Ds,tr,Rs,Ji,Fs;Object.defineProperty(Si,"__esModule",{value:!0}),Si.PagesCountLimit=Si.PDFPageViewBuffer=Si.BaseViewer=void 0;var wi=Ei(6),Ci=Ei(1),ki=Ei(17),xi=Ei(18),Ti=Ei(19),Oi=Ei(20),ji=Ei(7),Li=Ei(21),Ii=Ei(22),Mi=Ei(23),Fi=Ei(24);const Bi="enablePermissions",Ri={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};Si.PagesCountLimit=Ri;class Vi{constructor(Zi){Er(this,Di);Er(this,Wi,new Set);Er(this,zi,0);Nr(this,zi,Zi)}push(Zi){const er=Cr(this,Wi);er.has(Zi)&&er.delete(Zi),er.add(Zi),er.size>Cr(this,zi)&&xr(this,Di,Ps).call(this)}resize(Zi,er=null){Nr(this,zi,Zi);const hr=Cr(this,Wi);if(er){const ur=hr.size;let _r=1;for(const $r of hr)if(er.has($r.id)&&(hr.delete($r),hr.add($r)),++_r>ur)break}for(;hr.size>Cr(this,zi);)xr(this,Di,Ps).call(this)}has(Zi){return Cr(this,Wi).has(Zi)}[Symbol.iterator](){return Cr(this,Wi).keys()}}Wi=new WeakMap,zi=new WeakMap,Di=new WeakSet,Ps=function(){const Zi=Cr(this,Wi).keys().next().value;Zi==null||Zi.destroy(),Cr(this,Wi).delete(Zi)},Si.PDFPageViewBuffer=Vi;const pr=class{constructor(Zi){Er(this,ar);Er(this,fr);Er(this,mr);Er(this,Yi);Er(this,ir);Er(this,tr);Er(this,Ji);Er(this,Hi,null);Er(this,qi,wi.AnnotationMode.ENABLE_FORMS);Er(this,Gi,null);Er(this,Ki,!1);Er(this,Qi,0);Er(this,Xi,null);Er(this,rr,null);var hr,ur,_r,$r;if(this.constructor===pr)throw new Error("Cannot initialize BaseViewer.");const er="2.13.217-alpha.85";if(wi.version!==er)throw new Error(`The API version "${wi.version}" does not match the Viewer version "${er}".`);if(this.container=Zi.container,this.viewer=Zi.viewer||Zi.container.firstElementChild,((hr=this.container)==null?void 0:hr.tagName.toUpperCase())!=="DIV"||((ur=this.viewer)==null?void 0:ur.tagName.toUpperCase())!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");this.eventBus=Zi.eventBus,this.linkService=Zi.linkService||new ji.SimpleLinkService,this.downloadManager=Zi.downloadManager||null,this.findController=Zi.findController||null,this._scriptingManager=Zi.scriptingManager||null,this.removePageBorders=Zi.removePageBorders||!1,this.textLayerMode=(_r=Zi.textLayerMode)!=null?_r:Ci.TextLayerMode.ENABLE,Nr(this,qi,($r=Zi.annotationMode)!=null?$r:wi.AnnotationMode.ENABLE_FORMS),this.imageResourcesPath=Zi.imageResourcesPath||"",this.enablePrintAutoRotate=Zi.enablePrintAutoRotate||!1,this.renderer=Zi.renderer||Ci.RendererType.CANVAS,this.useOnlyCssZoom=Zi.useOnlyCssZoom||!1,this.maxCanvasPixels=Zi.maxCanvasPixels,this.l10n=Zi.l10n||xi.NullL10n,Nr(this,Ki,Zi.enablePermissions||!1),this.defaultRenderingQueue=!Zi.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new Oi.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=Zi.renderingQueue,this._doc=document.documentElement,this.scroll=(0,Ci.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=Ci.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),Promise.resolve().then(()=>{this.eventBus.dispatch("baseviewerinit",{source:this})})}get pagesCount(){return this._pages.length}getPageView(Zi){return this._pages[Zi]}get pageViewsReady(){return!!this._pagesCapability.settled&&this._pages.every(function(Zi){return Zi==null?void 0:Zi.pdfPage})}get renderForms(){return Cr(this,qi)===wi.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(Zi){if(!Number.isInteger(Zi))throw new Error("Invalid page number.");this.pdfDocument&&this._setCurrentPageNumber(Zi,!0)}_setCurrentPageNumber(Zi,er=!1){var ur,_r;if(this._currentPageNumber===Zi)return er&&this._resetCurrentPageView(),!0;if(!(0=0&&(er=hr+1)}this._setCurrentPageNumber(er,!0)}get currentScale(){return this._currentScale!==Ci.UNKNOWN_SCALE?this._currentScale:Ci.DEFAULT_SCALE}set currentScale(Zi){if(isNaN(Zi))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(Zi,!1)}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(Zi){this.pdfDocument&&this._setScale(Zi,!1)}get pagesRotation(){return this._pagesRotation}set pagesRotation(Zi){if(!(0,Ci.isValidRotation)(Zi))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||((Zi%=360)<0&&(Zi+=360),this._pagesRotation===Zi))return;this._pagesRotation=Zi;const er=this._currentPageNumber,hr={rotation:Zi};for(const ur of this._pages)ur.update(hr);this._currentScaleValue&&this._setScale(this._currentScaleValue,!0),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:Zi,pageNumber:er}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}setDocument(Zi){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController&&this.findController.setDocument(null),this._scriptingManager&&this._scriptingManager.setDocument(null)),this.pdfDocument=Zi,!Zi)return;const er=Zi.isPureXfa,hr=Zi.numPages,ur=Zi.getPage(1),_r=Zi.getOptionalContentConfig(),$r=Cr(this,Ki)?Zi.getPermissions():Promise.resolve();if(hr>Ri.FORCE_SCROLL_MODE_PAGE){const Pr=this._scrollMode=Ci.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:Pr})}this._pagesCapability.promise.then(()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:hr})},()=>{}),this._onBeforeDraw=Pr=>{const Sr=this._pages[Pr.pageNumber-1];Sr&&Cr(this,Hi).push(Sr)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=Pr=>{!Pr.cssTransform&&!this._onePageRenderedCapability.settled&&(this._onePageRenderedCapability.resolve({timestamp:Pr.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,Cr(this,rr)&&(document.removeEventListener("visibilitychange",Cr(this,rr)),Nr(this,rr,null)))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([ur,$r]).then(([Pr,Sr])=>{if(Zi!==this.pdfDocument)return;this._firstPageCapability.resolve(Pr),this._optionalContentConfigPromise=_r,xr(this,ar,Ms).call(this,Sr);const Tr=this._scrollMode===Ci.ScrollMode.PAGE?null:this.viewer,kr=this.currentScale,Rr=Pr.getViewport({scale:kr*wi.PixelsPerInch.PDF_TO_CSS_UNITS}),Vr=this.textLayerMode===Ci.TextLayerMode.DISABLE||er?null:this,Hr=Cr(this,qi)!==wi.AnnotationMode.DISABLE?this:null,Wr=er?this:null;for(let Lr=1;Lr<=hr;++Lr){const Br=new Ti.PDFPageView({container:Tr,eventBus:this.eventBus,id:Lr,scale:kr,defaultViewport:Rr.clone(),optionalContentConfigPromise:_r,renderingQueue:this.renderingQueue,textLayerFactory:Vr,textLayerMode:this.textLayerMode,annotationLayerFactory:Hr,annotationMode:Cr(this,qi),xfaLayerFactory:Wr,textHighlighterFactory:this,structTreeLayerFactory:this,imageResourcesPath:this.imageResourcesPath,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,maxCanvasPixels:this.maxCanvasPixels,l10n:this.l10n});this._pages.push(Br)}const Fr=this._pages[0];Fr&&(Fr.setPdfPage(Pr),this.linkService.cachePageRef(1,Pr.ref)),this._scrollMode===Ci.ScrollMode.PAGE?xr(this,mr,hs).call(this):this._spreadMode!==Ci.SpreadMode.NONE&&this._updateSpreadMode(),xr(this,fr,Os).call(this).then(async()=>{if(this.findController&&this.findController.setDocument(Zi),this._scriptingManager&&this._scriptingManager.setDocument(Zi),Zi.loadingParams.disableAutoFetch||hr>Ri.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let Lr=hr-1;if(Lr<=0)this._pagesCapability.resolve();else for(let Br=2;Br<=hr;++Br){const zr=Zi.getPage(Br).then(jr=>{const Gr=this._pages[Br-1];Gr.pdfPage||Gr.setPdfPage(jr),this.linkService.cachePageRef(Br,jr.ref),--Lr==0&&this._pagesCapability.resolve()},jr=>{--Lr==0&&this._pagesCapability.resolve()});Br%Ri.PAUSE_EAGER_PAGE_INIT==0&&await zr}}),this.eventBus.dispatch("pagesinit",{source:this}),Zi.getMetadata().then(({info:Lr})=>{Zi===this.pdfDocument&&Lr.Language&&(this.viewer.lang=Lr.Language)}),this.defaultRenderingQueue&&this.update()}).catch(Pr=>{this._pagesCapability.reject(Pr)})}setPageLabels(Zi){var er,hr;if(this.pdfDocument){Zi&&Array.isArray(Zi)&&this.pdfDocument.numPages===Zi.length?this._pageLabels=Zi:this._pageLabels=null;for(let ur=0,_r=this._pages.length;ur<_r;ur++)this._pages[ur].setPageLabel((hr=(er=this._pageLabels)==null?void 0:er[ur])!=null?hr:null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=Ci.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,Nr(this,Hi,new Vi(10)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=(0,wi.createPromiseCapability)(),this._onePageRenderedCapability=(0,wi.createPromiseCapability)(),this._pagesCapability=(0,wi.createPromiseCapability)(),this._scrollMode=Ci.ScrollMode.VERTICAL,this._previousScrollMode=Ci.ScrollMode.UNKNOWN,this._spreadMode=Ci.SpreadMode.NONE,Nr(this,Xi,{previousPageNumber:1,scrollDown:!0,pages:[]}),this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),Cr(this,rr)&&(document.removeEventListener("visibilitychange",Cr(this,rr)),Nr(this,rr,null)),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.viewer.classList.remove(Bi),Cr(this,Gi)!==null&&(Nr(this,qi,Cr(this,Gi)),Nr(this,Gi,null))}_scrollUpdate(){this.pagesCount!==0&&this.update()}_scrollIntoView({pageDiv:Zi,pageSpot:er=null,pageNumber:hr=null}){if(this._scrollMode===Ci.ScrollMode.PAGE&&(hr&&this._setCurrentPageNumber(hr),xr(this,mr,hs).call(this),this.update()),!er&&!this.isInPresentationMode){const ur=Zi.offsetLeft+Zi.clientLeft,_r=ur+Zi.clientWidth,{scrollLeft:$r,clientWidth:Pr}=this.container;(this._scrollMode===Ci.ScrollMode.HORIZONTAL||ur<$r||_r>$r+Pr)&&(er={left:0,top:0})}(0,Ci.scrollIntoView)(Zi,er)}_setScaleUpdatePages(Zi,er,hr=!1,ur=!1){if(this._currentScaleValue=er.toString(),xr(this,Yi,Ls).call(this,Zi)){ur&&this.eventBus.dispatch("scalechanging",{source:this,scale:Zi,presetValue:er});return}this._doc.style.setProperty("--zoom-factor",Zi),this._doc.style.setProperty("--viewport-scale-factor",Zi*wi.PixelsPerInch.PDF_TO_CSS_UNITS);const _r={scale:Zi};for(const $r of this._pages)$r.update(_r);if(this._currentScale=Zi,!hr){let $r,Pr=this._currentPageNumber;this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode&&(Pr=this._location.pageNumber,$r=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:Pr,destArray:$r,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:Zi,presetValue:ur?er:void 0}),this.defaultRenderingQueue&&this.update(),Nr(this,Qi,this.container.clientHeight)}get _pageWidthScaleFactor(){return this._spreadMode!==Ci.SpreadMode.NONE&&this._scrollMode!==Ci.ScrollMode.HORIZONTAL?2:1}_setScale(Zi,er=!1){let hr=parseFloat(Zi);if(hr>0)this._setScaleUpdatePages(hr,Zi,er,!1);else{const ur=this._pages[this._currentPageNumber-1];if(!ur)return;let _r=Ci.SCROLLBAR_PADDING,$r=Ci.VERTICAL_PADDING;this.isInPresentationMode?_r=$r=4:this.removePageBorders&&(_r=$r=0),this._scrollMode===Ci.ScrollMode.HORIZONTAL&&([_r,$r]=[$r,_r]);const Pr=(this.container.clientWidth-_r)/ur.width*ur.scale/this._pageWidthScaleFactor,Sr=(this.container.clientHeight-$r)/ur.height*ur.scale;switch(Zi){case"page-actual":hr=1;break;case"page-width":hr=Pr;break;case"page-height":hr=Sr;break;case"page-fit":hr=Math.min(Pr,Sr);break;case"auto":const Tr=(0,Ci.isPortraitOrientation)(ur)?Pr:Math.min(Sr,Pr);hr=Math.min(Ci.MAX_AUTO_SCALE,Tr);break;default:return}this._setScaleUpdatePages(hr,Zi,er,!0)}}_resetCurrentPageView(){this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0);const Zi=this._pages[this._currentPageNumber-1];this._scrollIntoView({pageDiv:Zi.div})}pageLabelToPageNumber(Zi){if(!this._pageLabels)return null;const er=this._pageLabels.indexOf(Zi);return er<0?null:er+1}scrollPageIntoView({pageNumber:Zi,destArray:er=null,allowNegativeOffset:hr=!1,ignoreDestinationZoom:ur=!1,hashOptions:_r={isStoredHash:!1}}){if(!this.pdfDocument)return;const $r=Number.isInteger(Zi)&&this._pages[Zi-1];if(!$r)return;if(this.isInPresentationMode||!er){this._setCurrentPageNumber(Zi,!0);return}let Pr,Sr,Tr=0,kr=0,Rr=0,Vr=0;const Hr=$r.rotation%180!=0,Wr=(Hr?$r.height:$r.width)/$r.scale/wi.PixelsPerInch.PDF_TO_CSS_UNITS,Fr=(Hr?$r.width:$r.height)/$r.scale/wi.PixelsPerInch.PDF_TO_CSS_UNITS;let Lr=0;switch(er[1].name){case"XYZ":Tr=er[2],kr=er[3],Lr=er[4],Tr=Tr!==null?Tr:0,kr=kr!==null?kr:Fr;break;case"Fit":case"FitB":Lr="page-fit";break;case"FitH":case"FitBH":kr=er[2],Lr="page-width",kr===null&&this._location?(Tr=this._location.left,kr=this._location.top):(typeof kr!="number"||kr<0)&&(kr=Fr);break;case"FitV":case"FitBV":Tr=er[2],Rr=Wr,Vr=Fr,Lr="page-height";break;case"FitR":Tr=er[2],kr=er[3],Rr=er[4]-Tr,Vr=er[5]-kr;const Gr=this.removePageBorders?0:Ci.SCROLLBAR_PADDING,Xr=this.removePageBorders?0:Ci.VERTICAL_PADDING;Pr=(this.container.clientWidth-Gr)/Rr/wi.PixelsPerInch.PDF_TO_CSS_UNITS,Sr=(this.container.clientHeight-Xr)/Vr/wi.PixelsPerInch.PDF_TO_CSS_UNITS,Lr=Math.min(Math.abs(Pr),Math.abs(Sr));break;default:return}if(ur||(Lr&&Lr!==this._currentScale?this.currentScaleValue=Lr:this._currentScale===Ci.UNKNOWN_SCALE&&(this.currentScaleValue=Ci.DEFAULT_SCALE_VALUE)),Lr==="page-fit"&&!er[4]){this._scrollIntoView({pageDiv:$r.div,pageNumber:Zi});return}const Br=[$r.viewport.convertToViewportPoint(Tr,kr),$r.viewport.convertToViewportPoint(Tr+Rr,kr+Vr)];let zr=Math.min(Br[0][0],Br[1][0]),jr=Math.min(Br[0][1],Br[1][1]);hr||(zr=Math.max(zr,0),jr=Math.max(jr,0)),_r.isStoredHash&&er[1].name==="XYZ"&&er[3]===null&&(jr=0),this._scrollIntoView({pageDiv:$r.div,pageSpot:{left:zr,top:jr},pageNumber:Zi})}_updateLocation(Zi){const er=this._currentScale,hr=this._currentScaleValue,ur=parseFloat(hr)===er?Math.round(1e4*er)/100:hr,_r=Zi.id;let $r="#page="+_r;$r+="&zoom="+ur;const Pr=this._pages[_r-1],Sr=this.container,Tr=Pr.getPagePoint(Sr.scrollLeft-Zi.x,Sr.scrollTop-Zi.y),kr=Math.round(Tr[0]),Rr=Math.round(Tr[1]);$r+=","+kr+","+Rr,this._location={pageNumber:_r,scale:ur,top:Rr,left:kr,rotation:this._pagesRotation,pdfOpenParams:$r}}update(){const Zi=this._getVisiblePages(),er=Zi.views,hr=er.length;if(hr===0)return;const ur=Math.max(10,2*hr+1);if(Cr(this,Hi).resize(ur,Zi.ids),this.renderingQueue.renderHighestPriority(Zi),!this.isInPresentationMode){const _r=this._spreadMode===Ci.SpreadMode.NONE&&(this._scrollMode===Ci.ScrollMode.PAGE||this._scrollMode===Ci.ScrollMode.VERTICAL);let $r=this._currentPageNumber,Pr=!1;for(const Sr of er){if(Sr.percent<100)break;if(Sr.id===$r&&_r){Pr=!0;break}}Pr||($r=er[0].id),this._setCurrentPageNumber($r)}this._updateLocation(Zi.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(Zi){return this.container.contains(Zi)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===Ci.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===Ci.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getCurrentVisiblePage(){if(!this.pagesCount)return{views:[]};const Zi=this._pages[this._currentPageNumber-1],er=Zi.div,hr={id:Zi.id,x:er.offsetLeft+er.clientLeft,y:er.offsetTop+er.clientTop,view:Zi};return{first:hr,last:hr,views:[hr],ids:new Set([Zi.id])}}_getVisiblePages(){if(this.isInPresentationMode)return this._getCurrentVisiblePage();const Zi=this._scrollMode===Ci.ScrollMode.PAGE?Cr(this,Xi).pages:this._pages,er=this._scrollMode===Ci.ScrollMode.HORIZONTAL,hr=er&&this._isContainerRtl;return(0,Ci.getVisibleElements)({scrollEl:this.container,views:Zi,sortByVisibility:!0,horizontal:er,rtl:hr})}isPageVisible(Zi){return!!this.pdfDocument&&!!(Number.isInteger(Zi)&&Zi>0&&Zi<=this.pagesCount)&&this._getVisiblePages().ids.has(Zi)}isPageCached(Zi){if(!this.pdfDocument||!(Number.isInteger(Zi)&&Zi>0&&Zi<=this.pagesCount))return!1;const er=this._pages[Zi-1];return Cr(this,Hi).has(er)}cleanup(){for(let Zi=0,er=this._pages.length;Zi{this.renderingQueue.renderView(_r)}),!0):!1}createTextLayerBuilder(Zi,er,hr,ur=!1,_r,$r){return new Mi.TextLayerBuilder({textLayerDiv:Zi,eventBus:_r,pageIndex:er,viewport:hr,enhanceTextSelection:!this.isInPresentationMode&&ur,highlighter:$r})}createTextHighlighter(Zi,er){return new Ii.TextHighlighter({eventBus:er,pageIndex:Zi,findController:this.isInPresentationMode?null:this.findController})}createAnnotationLayerBuilder(Zi,er,hr=null,ur="",_r=!0,$r=xi.NullL10n,Pr=null,Sr=null,Tr=null,kr=null,Rr=null){var Vr,Hr,Wr,Fr;return new ki.AnnotationLayerBuilder({pageDiv:Zi,pdfPage:er,annotationStorage:hr||((Vr=this.pdfDocument)==null?void 0:Vr.annotationStorage),imageResourcesPath:ur,renderForms:_r,linkService:this.linkService,downloadManager:this.downloadManager,l10n:$r,enableScripting:Pr!=null?Pr:this.enableScripting,hasJSActionsPromise:Sr||((Hr=this.pdfDocument)==null?void 0:Hr.hasJSActions()),fieldObjectsPromise:kr||((Wr=this.pdfDocument)==null?void 0:Wr.getFieldObjects()),mouseState:Tr||((Fr=this._scriptingManager)==null?void 0:Fr.mouseState),annotationCanvasMap:Rr})}createXfaLayerBuilder(Zi,er,hr=null){var ur;return new Fi.XfaLayerBuilder({pageDiv:Zi,pdfPage:er,annotationStorage:hr||((ur=this.pdfDocument)==null?void 0:ur.annotationStorage),linkService:this.linkService})}createStructTreeLayerBuilder(Zi){return new Li.StructTreeLayerBuilder({pdfPage:Zi})}get hasEqualPageSizes(){const Zi=this._pages[0];for(let er=1,hr=this._pages.length;er{const er=Zi.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,Ci.isPortraitOrientation)(er)?{width:er.width,height:er.height,rotation:er.rotation}:{width:er.height,height:er.width,rotation:(er.rotation-90)%360}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:this.pdfDocument.getOptionalContentConfig():Promise.resolve(null)}set optionalContentConfigPromise(Zi){if(!(Zi instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${Zi}`);if(!this.pdfDocument||!this._optionalContentConfigPromise)return;this._optionalContentConfigPromise=Zi;const er={optionalContentConfigPromise:Zi};for(const hr of this._pages)hr.update(er);this.update(),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:Zi})}get scrollMode(){return this._scrollMode}set scrollMode(Zi){if(this._scrollMode!==Zi){if(!(0,Ci.isValidScrollMode)(Zi))throw new Error(`Invalid scroll mode: ${Zi}`);this.pagesCount>Ri.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=Zi,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:Zi}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(Zi=null){const er=this._scrollMode,hr=this.viewer;hr.classList.toggle("scrollHorizontal",er===Ci.ScrollMode.HORIZONTAL),hr.classList.toggle("scrollWrapped",er===Ci.ScrollMode.WRAPPED),this.pdfDocument&&Zi&&(er===Ci.ScrollMode.PAGE?xr(this,mr,hs).call(this):this._previousScrollMode===Ci.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0),this._setCurrentPageNumber(Zi,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(Zi){if(this._spreadMode!==Zi){if(!(0,Ci.isValidSpreadMode)(Zi))throw new Error(`Invalid spread mode: ${Zi}`);this._spreadMode=Zi,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:Zi}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(Zi=null){if(!this.pdfDocument)return;const er=this.viewer,hr=this._pages;if(this._scrollMode===Ci.ScrollMode.PAGE)xr(this,mr,hs).call(this);else if(er.textContent="",this._spreadMode===Ci.SpreadMode.NONE)for(let ur=0,_r=hr.length;ur<_r;++ur)er.appendChild(hr[ur].div);else{const ur=this._spreadMode-1;let _r=null;for(let $r=0,Pr=hr.length;$r=Tr;Sr--){const kr=_r[Sr],Rr=_r[Sr+1]-1;if(krRr)return Rr-Zi}if(er){const Sr=_r[0];if(SrZi)return Sr-Zi+1}break}break}case Ci.ScrollMode.HORIZONTAL:break;case Ci.ScrollMode.PAGE:case Ci.ScrollMode.VERTICAL:{if(this._spreadMode===Ci.SpreadMode.NONE)break;const hr=this._spreadMode-1;if(er&&Zi%2!==hr||!er&&Zi%2===hr)break;const{views:ur}=this._getVisiblePages(),_r=er?Zi-1:Zi+1;for(const{id:$r,percent:Pr,widthPercent:Sr}of ur)if($r===_r){if(Pr>0&&Sr===100)return 2;break}break}}return 1}nextPage(){const Zi=this._currentPageNumber,er=this.pagesCount;if(Zi>=er)return!1;const hr=this._getPageAdvance(Zi,!1)||1;return this.currentPageNumber=Math.min(Zi+hr,er),!0}previousPage(){const Zi=this._currentPageNumber;if(Zi<=1)return!1;const er=this._getPageAdvance(Zi,!0)||1;return this.currentPageNumber=Math.max(Zi-er,1),!0}increaseScale(Zi=1){let er=this._currentScale;do er=(er*Ci.DEFAULT_SCALE_DELTA).toFixed(2),er=Math.ceil(10*er)/10,er=Math.min(Ci.MAX_SCALE,er);while(--Zi>0&&er0&&er>Ci.MIN_SCALE);this.currentScaleValue=er}get scrollModePageState(){return Cr(this,Xi)||{previousPageNumber:1,scrollDown:!0,pages:[]}}};let Ni=pr;Hi=new WeakMap,qi=new WeakMap,Gi=new WeakMap,Ki=new WeakMap,Qi=new WeakMap,Xi=new WeakMap,rr=new WeakMap,ar=new WeakSet,Ms=function(Zi){Zi&&(Zi.includes(wi.PermissionFlag.COPY)||this.viewer.classList.add(Bi),!Zi.includes(wi.PermissionFlag.MODIFY_ANNOTATIONS)&&!Zi.includes(wi.PermissionFlag.FILL_INTERACTIVE_FORMS)&&Cr(this,qi)===wi.AnnotationMode.ENABLE_FORMS&&(Nr(this,Gi,Cr(this,qi)),Nr(this,qi,wi.AnnotationMode.ENABLE)))},fr=new WeakSet,Os=function(){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return Promise.resolve();const Zi=new Promise(er=>{Nr(this,rr,()=>{document.visibilityState==="hidden"&&(er(),document.removeEventListener("visibilitychange",Cr(this,rr)),Nr(this,rr,null))}),document.addEventListener("visibilitychange",Cr(this,rr))});return Promise.race([this._onePageRenderedCapability.promise,Zi])},mr=new WeakSet,hs=function(){if(this._scrollMode!==Ci.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const Zi=this._currentPageNumber,er=Cr(this,Xi),hr=this.viewer;if(hr.textContent="",er.pages.length=0,this._spreadMode===Ci.SpreadMode.NONE){const ur=this._pages[Zi-1];if(this.isInPresentationMode){const _r=document.createElement("div");_r.className="spread";const $r=document.createElement("div");$r.className="dummyPage",$r.style.height=`${this.container.clientHeight}px`,_r.appendChild($r),_r.appendChild(ur.div),hr.appendChild(_r)}else hr.appendChild(ur.div);er.pages.push(ur)}else{const ur=new Set,_r=this._spreadMode-1;Zi%2!==_r?(ur.add(Zi-1),ur.add(Zi)):(ur.add(Zi-2),ur.add(Zi-1));let $r=null;for(const Pr of ur){const Sr=this._pages[Pr];Sr&&($r===null?($r=document.createElement("div"),$r.className="spread",hr.appendChild($r)):Pr%2===_r&&($r=$r.cloneNode(!1),hr.appendChild($r)),$r.appendChild(Sr.div),er.pages.push(Sr))}}er.scrollDown=Zi>=er.previousPageNumber,er.previousPageNumber=Zi},Yi=new WeakSet,Ls=function(Zi){return(!this.isInPresentationMode||this.container.clientHeight===Cr(this,Qi))&&(Zi===this._currentScale||Math.abs(Zi-this._currentScale)<1e-15)},ir=new WeakSet,Ds=async function(Zi){var er,hr;if(Zi.pdfPage)return Zi.pdfPage;try{const ur=await this.pdfDocument.getPage(Zi.id);return Zi.pdfPage||Zi.setPdfPage(ur),(hr=(er=this.linkService)._cachedPageNumber)!=null&&hr.call(er,ur.ref)||this.linkService.cachePageRef(Zi.id,ur.ref),ur}catch{return null}},tr=new WeakSet,Rs=function(Zi){var er,hr;if(((er=Zi.first)==null?void 0:er.id)===1)return!0;if(((hr=Zi.last)==null?void 0:hr.id)===this.pagesCount)return!1;switch(this._scrollMode){case Ci.ScrollMode.PAGE:return Cr(this,Xi).scrollDown;case Ci.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down},Ji=new WeakSet,Fs=function(Zi){var er;for(const hr of Zi)(er=this._pages[hr-1])==null||er.toggleLoadingIconSpinner(!0);for(const hr of Cr(this,Hi))Zi.has(hr.id)||hr.toggleLoadingIconSpinner(!1)},Si.BaseViewer=Ni},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.AnnotationLayerBuilder=void 0;var wi=Ei(6),Ci=Ei(18);Si.AnnotationLayerBuilder=class{constructor({pageDiv:ki,pdfPage:xi,linkService:Ti,downloadManager:Oi,annotationStorage:ji=null,imageResourcesPath:Li="",renderForms:Ii=!0,l10n:Mi=Ci.NullL10n,enableScripting:Fi=!1,hasJSActionsPromise:Bi=null,fieldObjectsPromise:Ri=null,mouseState:Vi=null,annotationCanvasMap:Ni=null}){this.pageDiv=ki,this.pdfPage=xi,this.linkService=Ti,this.downloadManager=Oi,this.imageResourcesPath=Li,this.renderForms=Ii,this.l10n=Mi,this.annotationStorage=ji,this.enableScripting=Fi,this._hasJSActionsPromise=Bi,this._fieldObjectsPromise=Ri,this._mouseState=Vi,this._annotationCanvasMap=Ni,this.div=null,this._cancelled=!1}async render(ki,xi="display"){const[Ti,Oi=!1,ji=null]=await Promise.all([this.pdfPage.getAnnotations({intent:xi}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled||Ti.length===0)return;const Li={viewport:ki.clone({dontFlip:!0}),div:this.div,annotations:Ti,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:Oi,fieldObjects:ji,mouseState:this._mouseState,annotationCanvasMap:this._annotationCanvasMap};this.div?wi.AnnotationLayer.update(Li):(this.div=document.createElement("div"),this.div.className="annotationLayer",this.pageDiv.appendChild(this.div),Li.div=this.div,wi.AnnotationLayer.render(Li),this.l10n.translate(this.div))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.NullL10n=void 0,Si.fixupLangCode=function(xi){return Ci[xi==null?void 0:xi.toLowerCase()]||xi},Si.getL10nFallback=wi;const Ei={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",print_progress_percent:"{{progress}}%","toggle_sidebar.title":"Toggle Sidebar","toggle_sidebar_notification2.title":"Toggle Sidebar (document contains outline/attachments/layers)",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",error_version_info:"PDF.js v{{version}} (build: {{build}})",error_message:"Message: {{message}}",error_stack:"Stack: {{stack}}",error_file:"File: {{file}}",error_line:"Line: {{line}}",rendering_error:"An error occurred while rendering the page.",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading:"Loading…",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts."};function wi(xi,Ti){switch(xi){case"find_match_count":xi=`find_match_count[${Ti.total===1?"one":"other"}]`;break;case"find_match_count_limit":xi=`find_match_count_limit[${Ti.limit===1?"one":"other"}]`}return Ei[xi]||""}const Ci={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"},ki={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(xi,Ti=null,Oi=wi(xi,Ti))=>function(ji,Li){return Li?ji.replace(/\{\{\s*(\w+)\s*\}\}/g,(Ii,Mi)=>Mi in Li?Li[Mi]:"{{"+Mi+"}}"):ji}(Oi,Ti),async translate(xi){}};Si.NullL10n=ki},(Ai,Si,Ei)=>{var Oi,ji;Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFPageView=void 0;var wi=Ei(6),Ci=Ei(1),ki=Ei(3),xi=Ei(18);const Ti=ki.compatibilityParams.maxCanvasPixels||16777216;Si.PDFPageView=(ji=class{constructor(Li){Er(this,Oi,wi.AnnotationMode.ENABLE_FORMS);var Bi,Ri,Vi,Ni;const Ii=Li.container,Mi=Li.defaultViewport;this.id=Li.id,this.renderingId="page"+this.id,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=Li.scale||Ci.DEFAULT_SCALE,this.viewport=Mi,this.pdfPageRotate=Mi.rotation,this._optionalContentConfigPromise=Li.optionalContentConfigPromise||null,this.hasRestrictedScaling=!1,this.textLayerMode=(Bi=Li.textLayerMode)!=null?Bi:Ci.TextLayerMode.ENABLE,Nr(this,Oi,(Ri=Li.annotationMode)!=null?Ri:wi.AnnotationMode.ENABLE_FORMS),this.imageResourcesPath=Li.imageResourcesPath||"",this.useOnlyCssZoom=Li.useOnlyCssZoom||!1,this.maxCanvasPixels=Li.maxCanvasPixels||Ti,this.eventBus=Li.eventBus,this.renderingQueue=Li.renderingQueue,this.textLayerFactory=Li.textLayerFactory,this.annotationLayerFactory=Li.annotationLayerFactory,this.xfaLayerFactory=Li.xfaLayerFactory,this.textHighlighter=(Vi=Li.textHighlighterFactory)==null?void 0:Vi.createTextHighlighter(this.id-1,this.eventBus),this.structTreeLayerFactory=Li.structTreeLayerFactory,this.renderer=Li.renderer||Ci.RendererType.CANVAS,this.l10n=Li.l10n||xi.NullL10n,this.paintTask=null,this.paintedViewportMap=new WeakMap,this.renderingState=Ci.RenderingStates.INITIAL,this.resume=null,this._renderError=null,this._isStandalone=!((Ni=this.renderingQueue)!=null&&Ni.hasViewer()),this._annotationCanvasMap=null,this.annotationLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null;const Fi=document.createElement("div");Fi.className="page",Fi.style.width=Math.floor(this.viewport.width)+"px",Fi.style.height=Math.floor(this.viewport.height)+"px",Fi.setAttribute("data-page-number",this.id),Fi.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then(Wi=>{Fi.setAttribute("aria-label",Wi)}),this.div=Fi,Ii==null||Ii.appendChild(Fi)}set renderingState(Li){this._renderingState=Li}get renderingState(){var Li;return this._renderingState!==Ci.RenderingStates.FINISHED||(Li=this.div)!=null&&Li.dataset.loaded||(this._renderingState=Ci.RenderingStates.INITIAL),this._renderingState}setPdfPage(Li){this.pdfPage=Li,this.pdfPageRotate=Li.rotate;const Ii=(this.rotation+this.pdfPageRotate)%360;this.viewport=Li.getViewport({scale:this.scale*wi.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:Ii}),this.reset()}destroy(){this.reset(),this.pdfPage&&this.pdfPage.cleanup(),this.eventBus.dispatch("pageunmounted",{source:this,pageNumber:this.id})}async _renderAnnotationLayer(){let Li=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(Ii){Li=Ii}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:Li})}}async _renderXfaLayer(){let Li=null;try{const Ii=await this.xfaLayer.render(this.viewport,"display");this.textHighlighter&&this._buildXfaTextContentItems(Ii.textDivs)}catch(Ii){Li=Ii}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:Li})}}async _buildXfaTextContentItems(Li){const Ii=await this.pdfPage.getTextContent(),Mi=[];for(const Fi of Ii.items)Mi.push(Fi.str);this.textHighlighter.setTextMapping(Li,Mi),this.textHighlighter.enable()}_resetZoomLayer(Li=!1){if(!this.zoomLayer)return;const Ii=this.zoomLayer.firstChild;this.paintedViewportMap.delete(Ii),Ii.width=0,Ii.height=0,Li&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:Li=!1,keepAnnotationLayer:Ii=!1,keepXfaLayer:Mi=!1}={}){var Wi,zi;this.cancelRendering({keepAnnotationLayer:Ii,keepXfaLayer:Mi}),this.renderingState=Ci.RenderingStates.INITIAL;const Fi=this.div;Fi.style.width=Math.floor(this.viewport.width)+"px",Fi.style.height=Math.floor(this.viewport.height)+"px";const Bi=Fi.childNodes,Ri=Li&&this.zoomLayer||null,Vi=Ii&&((Wi=this.annotationLayer)==null?void 0:Wi.div)||null,Ni=Mi&&((zi=this.xfaLayer)==null?void 0:zi.div)||null;for(let Di=Bi.length-1;Di>=0;Di--){const Ui=Bi[Di];switch(Ui){case Ri:case Vi:case Ni:continue}Ui.remove()}Fi.removeAttribute("data-loaded"),Vi&&this.annotationLayer.hide(),Ni&&this.xfaLayer.hide(),Ri||(this.canvas&&(this.paintedViewportMap.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer()),this.svg&&(this.paintedViewportMap.delete(this.svg),delete this.svg),this.loadingIconDiv=document.createElement("div"),this.loadingIconDiv.className="loadingIcon notVisible",this._isStandalone&&this.toggleLoadingIconSpinner(!0),this.loadingIconDiv.setAttribute("role","img"),this.l10n.get("loading").then(Di=>{var Ui;(Ui=this.loadingIconDiv)==null||Ui.setAttribute("aria-label",Di)}),Fi.appendChild(this.loadingIconDiv)}update({scale:Li=0,rotation:Ii=null,optionalContentConfigPromise:Mi=null}){if(typeof arguments[0]!="object"){this.update({scale:arguments[0],rotation:arguments[1],optionalContentConfigPromise:arguments[2]});return}this.scale=Li||this.scale,typeof Ii=="number"&&(this.rotation=Ii),Mi instanceof Promise&&(this._optionalContentConfigPromise=Mi);const Fi=(this.rotation+this.pdfPageRotate)%360,Bi=this.scale*wi.PixelsPerInch.PDF_TO_CSS_UNITS;if(this.viewport=this.viewport.clone({scale:Bi,rotation:Fi}),this._isStandalone){const{style:Vi}=document.documentElement;Vi.setProperty("--zoom-factor",this.scale),Vi.setProperty("--viewport-scale-factor",Bi)}if(this.svg){this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawXfaLayer:!0}),this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}let Ri=!1;if(this.canvas&&this.maxCanvasPixels>0){const Vi=this.outputScale;(Math.floor(this.viewport.width)*Vi.sx|0)*(Math.floor(this.viewport.height)*Vi.sy|0)>this.maxCanvasPixels&&(Ri=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&Ri){this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawXfaLayer:!0}),this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}!this.zoomLayer&&!this.canvas.hidden&&(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepXfaLayer:!0})}cancelRendering({keepAnnotationLayer:Li=!1,keepXfaLayer:Ii=!1}={}){var Mi;this.paintTask&&(this.paintTask.cancel(),this.paintTask=null),this.resume=null,this.textLayer&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!Li||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.xfaLayer&&(!Ii||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(Mi=this.textHighlighter)==null||Mi.disable()),this._onTextLayerRendered&&(this.eventBus._off("textlayerrendered",this._onTextLayerRendered),this._onTextLayerRendered=null)}cssTransform({target:Li,redrawAnnotationLayer:Ii=!1,redrawXfaLayer:Mi=!1}){const Fi=this.viewport.width,Bi=this.viewport.height,Ri=this.div;Li.style.width=Li.parentNode.style.width=Ri.style.width=Math.floor(Fi)+"px",Li.style.height=Li.parentNode.style.height=Ri.style.height=Math.floor(Bi)+"px";const Vi=this.viewport.rotation-this.paintedViewportMap.get(Li).rotation,Ni=Math.abs(Vi);let Wi=1,zi=1;if((Ni===90||Ni===270)&&(Wi=Bi/Fi,zi=Fi/Bi),Li.style.transform=`rotate(${Vi}deg) scale(${Wi}, ${zi})`,this.textLayer){const Di=this.textLayer.viewport,Ui=this.viewport.rotation-Di.rotation,Hi=Math.abs(Ui);let qi=Fi/Di.width;Hi!==90&&Hi!==270||(qi=Fi/Di.height);const Gi=this.textLayer.textLayerDiv;let Ki,Qi;switch(Hi){case 0:Ki=Qi=0;break;case 90:Ki=0,Qi="-"+Gi.style.height;break;case 180:Ki="-"+Gi.style.width,Qi="-"+Gi.style.height;break;case 270:Ki="-"+Gi.style.width,Qi=0}Gi.style.transform=`rotate(${Hi}deg) scale(${qi}) translate(${Ki}, ${Qi})`,Gi.style.transformOrigin="0% 0%"}Ii&&this.annotationLayer&&this._renderAnnotationLayer(),Mi&&this.xfaLayer&&this._renderXfaLayer()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(Li,Ii){return this.viewport.convertToPdfPoint(Li,Ii)}toggleLoadingIconSpinner(Li=!1){var Ii;(Ii=this.loadingIconDiv)==null||Ii.classList.toggle("notVisible",!Li)}draw(){var Wi,zi,Di;this.renderingState!==Ci.RenderingStates.INITIAL&&this.reset();const{div:Li,pdfPage:Ii}=this;if(!Ii)return this.renderingState=Ci.RenderingStates.FINISHED,this.loadingIconDiv&&(this.loadingIconDiv.remove(),delete this.loadingIconDiv),Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=Ci.RenderingStates.RUNNING;const Mi=document.createElement("div");Mi.style.width=Li.style.width,Mi.style.height=Li.style.height,Mi.classList.add("canvasWrapper"),(Wi=this.annotationLayer)!=null&&Wi.div?Li.insertBefore(Mi,this.annotationLayer.div):Li.appendChild(Mi);let Fi=null;if(this.textLayerMode!==Ci.TextLayerMode.DISABLE&&this.textLayerFactory){const Ui=document.createElement("div");Ui.className="textLayer",Ui.style.width=Mi.style.width,Ui.style.height=Mi.style.height,(zi=this.annotationLayer)!=null&&zi.div?Li.insertBefore(Ui,this.annotationLayer.div):Li.appendChild(Ui),Fi=this.textLayerFactory.createTextLayerBuilder(Ui,this.id-1,this.viewport,this.textLayerMode===Ci.TextLayerMode.ENABLE_ENHANCE,this.eventBus,this.textHighlighter)}this.textLayer=Fi,Cr(this,Oi)!==wi.AnnotationMode.DISABLE&&this.annotationLayerFactory&&(this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer||(this.annotationLayer=this.annotationLayerFactory.createAnnotationLayerBuilder(Li,Ii,null,this.imageResourcesPath,Cr(this,Oi)===wi.AnnotationMode.ENABLE_FORMS,this.l10n,null,null,null,null,this._annotationCanvasMap))),(Di=this.xfaLayer)!=null&&Di.div&&Li.appendChild(this.xfaLayer.div);let Bi=null;this.renderingQueue&&(Bi=Ui=>{this.renderingQueue.isHighestPriority(this)?Ui():(this.renderingState=Ci.RenderingStates.PAUSED,this.resume=()=>{this.renderingState=Ci.RenderingStates.RUNNING,Ui()})});const Ri=async(Ui=null)=>{if(Vi===this.paintTask&&(this.paintTask=null),Ui instanceof wi.RenderingCancelledException)this._renderError=null;else if(this._renderError=Ui,this.renderingState=Ci.RenderingStates.FINISHED,this.loadingIconDiv&&(this.loadingIconDiv.remove(),delete this.loadingIconDiv),this._resetZoomLayer(!0),this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError}),Ui)throw Ui},Vi=this.renderer===Ci.RendererType.SVG?this.paintOnSvg(Mi):this.paintOnCanvas(Mi);Vi.onRenderContinue=Bi,this.paintTask=Vi;const Ni=Vi.promise.then(()=>Ri(null).then(()=>{if(Fi){const Ui=Ii.streamTextContent({includeMarkedContent:!0});Fi.setTextContentStream(Ui),Fi.render()}this.annotationLayer&&this._renderAnnotationLayer()}),function(Ui){return Ri(Ui)});return this.xfaLayerFactory&&(this.xfaLayer||(this.xfaLayer=this.xfaLayerFactory.createXfaLayerBuilder(Li,Ii,null)),this._renderXfaLayer()),this.structTreeLayerFactory&&this.textLayer&&this.canvas&&(this._onTextLayerRendered=Ui=>{Ui.pageNumber===this.id&&(this.eventBus._off("textlayerrendered",this._onTextLayerRendered),this._onTextLayerRendered=null,this.canvas&&this.pdfPage.getStructTree().then(Hi=>{if(!Hi||!this.canvas)return;const qi=this.structTreeLayer.render(Hi);qi.classList.add("structTree"),this.canvas.appendChild(qi)}))},this.eventBus._on("textlayerrendered",this._onTextLayerRendered),this.structTreeLayer=this.structTreeLayerFactory.createStructTreeLayerBuilder(Ii)),Li.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),Ni}paintOnCanvas(Li){const Ii=(0,wi.createPromiseCapability)(),Mi={promise:Ii.promise,onRenderContinue(qi){qi()},cancel(){Hi.cancel()}},Fi=this.viewport,Bi=document.createElement("canvas");Bi.hidden=!0;let Ri=!0;const Vi=function(){Ri&&(Bi.hidden=!1,Ri=!1)};Li.appendChild(Bi),this.canvas=Bi,Bi.mozOpaque=!0;const Ni=Bi.getContext("2d",{alpha:!1}),Wi=this.outputScale=new Ci.OutputScale;if(this.useOnlyCssZoom){const qi=Fi.clone({scale:wi.PixelsPerInch.PDF_TO_CSS_UNITS});Wi.sx*=qi.width/Fi.width,Wi.sy*=qi.height/Fi.height}if(this.maxCanvasPixels>0){const qi=Fi.width*Fi.height,Gi=Math.sqrt(this.maxCanvasPixels/qi);Wi.sx>Gi||Wi.sy>Gi?(Wi.sx=Gi,Wi.sy=Gi,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1}const zi=(0,Ci.approximateFraction)(Wi.sx),Di=(0,Ci.approximateFraction)(Wi.sy);Bi.width=(0,Ci.roundToDivide)(Fi.width*Wi.sx,zi[0]),Bi.height=(0,Ci.roundToDivide)(Fi.height*Wi.sy,Di[0]),Bi.style.width=(0,Ci.roundToDivide)(Fi.width,zi[1])+"px",Bi.style.height=(0,Ci.roundToDivide)(Fi.height,Di[1])+"px",this.paintedViewportMap.set(Bi,Fi);const Ui={canvasContext:Ni,transform:Wi.scaled?[Wi.sx,0,0,Wi.sy,0,0]:null,viewport:this.viewport,annotationMode:Cr(this,Oi),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap},Hi=this.pdfPage.render(Ui);return Hi.onContinue=function(qi){Vi(),Mi.onRenderContinue?Mi.onRenderContinue(qi):qi()},Hi.promise.then(function(){Vi(),Ii.resolve()},function(qi){Vi(),Ii.reject(qi)}),Mi}paintOnSvg(Li){let Ii=!1;const Mi=()=>{if(Ii)throw new wi.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},Fi=this.pdfPage,Bi=this.viewport.clone({scale:wi.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:Fi.getOperatorList({annotationMode:Cr(this,Oi)}).then(Ri=>(Mi(),new wi.SVGGraphics(Fi.commonObjs,Fi.objs).getSVG(Ri,Bi).then(Vi=>{Mi(),this.svg=Vi,this.paintedViewportMap.set(Vi,Bi),Vi.style.width=Li.style.width,Vi.style.height=Li.style.height,this.renderingState=Ci.RenderingStates.FINISHED,Li.appendChild(Vi)}))),onRenderContinue(Ri){Ri()},cancel(){Ii=!0}}}setPageLabel(Li){this.pageLabel=typeof Li=="string"?Li:null,this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}},Oi=new WeakMap,ji)},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFRenderingQueue=void 0;var wi=Ei(6),Ci=Ei(1);Si.PDFRenderingQueue=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}setViewer(ki){this.pdfViewer=ki}setThumbnailViewer(ki){this.pdfThumbnailViewer=ki}isHighestPriority(ki){return this.highestPriorityPage===ki.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(ki){var xi;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(ki)||this.isThumbnailViewEnabled&&((xi=this.pdfThumbnailViewer)!=null&&xi.forceRendering())||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(ki,xi,Ti,Oi=!1){const ji=ki.views,Li=ji.length;if(Li===0)return null;for(let Ri=0;RiLi){const Ri=ki.ids;for(let Vi=1,Ni=Mi-Ii;Vi{this.renderHighestPriority()}).catch(xi=>{wi.RenderingCancelledException})}return!0}}},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.StructTreeLayerBuilder=void 0;const Ei={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},wi=/^H(\d+)$/;Si.StructTreeLayerBuilder=class{constructor({pdfPage:Ci}){this.pdfPage=Ci}render(Ci){return this._walk(Ci)}_setAttributes(Ci,ki){Ci.alt!==void 0&&ki.setAttribute("aria-label",Ci.alt),Ci.id!==void 0&&ki.setAttribute("aria-owns",Ci.id),Ci.lang!==void 0&&ki.setAttribute("lang",Ci.lang)}_walk(Ci){if(!Ci)return null;const ki=document.createElement("span");if("role"in Ci){const{role:xi}=Ci,Ti=xi.match(wi);Ti?(ki.setAttribute("role","heading"),ki.setAttribute("aria-level",Ti[1])):Ei[xi]&&ki.setAttribute("role",Ei[xi])}if(this._setAttributes(Ci,ki),Ci.children)if(Ci.children.length===1&&"id"in Ci.children[0])this._setAttributes(Ci.children[0],ki);else for(const xi of Ci.children)ki.appendChild(this._walk(xi));return ki}}}, (Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}), Si.TextHighlighter=void 0, Si.TextHighlighter=class { constructor({ findController, eventBus, pageIndex }) { this.findController = findController; this.matches = []; this.eventBus = eventBus; this.pageIdx = pageIndex; this._onUpdateTextLayerMatches = null; this.textDivs = null; this.textContentItemsStr = null; this.enabled = false; this.defaultPagesMatches = null; this.defaultPagesMatchesIsFocus = false; // 没有则创建 _onUpdatePagesMatches if (!this._onUpdatePagesMatches) { this._onUpdatePagesMatches = (evt) => { if (evt.pagesMatches !== this.defaultPagesMatches) { this.defaultPagesMatches = evt.pagesMatches; this.defaultPagesMatchesIsFocus = true; sessionStorage.removeItem("pdfFindBar"); } this._updateMatches(false); }; this.eventBus._on("updatePagesMatches", this._onUpdatePagesMatches); } } setTextMapping(divs, texts) { this.textDivs = divs; this.textContentItemsStr = texts; } enable() { // 页面渲染时调用,初始化绑定事件,调用页面渲染更新 if (!this.textDivs || !this.textContentItemsStr) { throw new Error("Text divs and strings have not been set."); } if (this.enabled) { throw new Error("TextHighlighter is already enabled."); } this.enabled = true; if (!this._onUpdateTextLayerMatches) { this._onUpdateTextLayerMatches = evt => { if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) { this._updateMatches(); } }; this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches); } if (!this._onUpdatePagesMatches) { this._onUpdatePagesMatches = (evt) => { if (evt.pagesMatches !== this.defaultPagesMatches) { this.defaultPagesMatches = evt.pagesMatches; this.defaultPagesMatchesIsFocus = true; sessionStorage.removeItem("pdfFindBar"); } this._updateMatches(false); }; this.eventBus._on("updatePagesMatches", this._onUpdatePagesMatches); } this._updateMatches(); } disable() { if (!this.enabled) { return; } this.enabled = false; if (this._onUpdateTextLayerMatches) { this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches); this._onUpdateTextLayerMatches = null; } // disable时候移除监听方法 if (this._onUpdatePagesMatches) { this.eventBus._off("updatePagesMatches", this._onUpdatePagesMatches); this._onUpdatePagesMatches = null; } this._updateMatches(true); } _convertMatches(matches, matchesLength) { // _convertMatches:将数据转换成begin end 格式 if (!matches) { return []; } const { textContentItemsStr } = this; let i = 0 let iIndex = 0; const end = textContentItemsStr.length - 1; const result = []; try { for (let m = 0, mm = matches.length; m < mm; m++) { let matchIdx = matches[m]; while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) { iIndex += textContentItemsStr[i].length; i++; } if (i === textContentItemsStr.length) { console.error("Could not find a matching mapping"); } const match = { begin: { divIdx: i, offset: matchIdx - iIndex } }; matchIdx += matchesLength[m]; while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) { iIndex += textContentItemsStr[i].length; i++; } match.end = { divIdx: i, offset: matchIdx - iIndex }; result.push(match); } } catch { } return result; } _renderMatches(matches) { // Early exit if there is nothing to render. if (matches.length === 0) { return; } const isPagesMatch = sessionStorage.getItem("pdfFindBar") !== "pdfFindBar"; const { textContentItemsStr, textDivs, findController, pageIdx } = this; if (!textDivs?.length) { return; } const isSelectedPage = findController?.selected ? pageIdx === findController.selected.pageIdx : true; const selectedMatchIdx = findController?.selected?.matchIdx ?? 0; // const highlightAll = !options ? findController.state.highlightAll : true; const highlightAll = true; let prevEnd = null; const infinity = { divIdx: -1, offset: undefined, }; function beginText(begin, className, styles) { const divIdx = begin.divIdx; if (!textDivs[divIdx]) { return; } textDivs[divIdx].textContent = ""; return appendTextToDiv(divIdx, 0, begin.offset, className, styles); } function appendTextToDiv(divIdx, fromOffset, toOffset, className, styles) { let div = textDivs[divIdx]; if (!div) { return; } if (div.nodeType === Node.TEXT_NODE) { const span = document.createElement("span"); div.before(span); span.append(div); textDivs[divIdx] = span; div = span; } const content = textContentItemsStr[divIdx].substring( fromOffset, toOffset ); const node = document.createTextNode(content); if (className) { const span = document.createElement("span"); if (styles && span) { for (let p in styles) { span.style[p] = styles[p]; } } span.className = `${className} appended`; span.append(node); div.append(span); return className.includes("selected") ? span.offsetLeft : 0; } div.append(node); return 0; } let i0 = selectedMatchIdx, i1 = i0 + 1; if (highlightAll) { i0 = 0; i1 = matches.length; } else if (!isSelectedPage) { // Not highlighting all and this isn't the selected page, so do nothing. return; } let lastDivIdx = -1; let lastOffset = -1; let selectedElement; let findIndex = -1; for (let i = i0; i < i1; i++) { const match = matches[i]; const begin = match.begin; if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) { // It's possible to be in this situation if we searched for a 'f' and we // have a ligature 'ff' in the text. The 'ff' has to be highlighted two // times. continue; } lastDivIdx = begin.divIdx; lastOffset = begin.offset; const end = match.end; if (match.sectionIndex === undefined) { findIndex += 1; } const isSelected = isPagesMatch ? match.isSelected : isSelectedPage && findIndex === selectedMatchIdx; const highlightSuffix = " " + match.className; let selectedLeft = 0; // Match inside new div. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) { // If there was a previous div, then add the text at the end. if (prevEnd !== null) { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); } // Clear the divs and set the content until the starting point. beginText(begin); } else { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset); } if (begin.divIdx === end.divIdx) { selectedLeft = appendTextToDiv( begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix, match.styles ); } else { selectedLeft = appendTextToDiv( begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix, match.styles ); for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) { if (textDivs[n0]) { if (match.styles) { for (let p in match.styles) { textDivs[n0].style[p] = match.styles[p]; } } textDivs[n0].className = "highlight middle" + highlightSuffix; } } beginText(end, "highlight end" + highlightSuffix, match.styles); } prevEnd = end; if (!selectedElement && isSelected) { let divIdx = begin.divIdx; while (!textContentItemsStr[divIdx] && divIdx <= end.divIdx) { divIdx++; } const div = textDivs[divIdx]; let isOut = false; // 定位元素需要在可视区域内 try{ const divStyle = div.style; let textLayerNode = div; while ( !textLayerNode.classList.contains("textLayer") && textLayerNode.parentElement ) { textLayerNode = textLayerNode.parentElement; } let left = parseFloat(divStyle.left.match(/\d+/g)[0] || "0"); let top = parseFloat(divStyle.top.match(/\d+/g)[0] || "0"); if ( (divStyle.left.includes("%") && left >= 100) || (divStyle.top.includes("%") && top >= 100) ) { isOut = true; } if (textLayerNode.classList.contains("textLayer")) { let width = parseFloat(textLayerNode.style.width.match(/\d+/g)[0] || "0"); let height = parseFloat(textLayerNode.style.height.match(/\d+/g)[0] || "0"); if ( (divStyle.left.includes("px") && left > width) || (!divStyle.top.includes("px") && top > height) ) { isOut = true; } } } catch(e) { console.error(e) } if (!isOut && this.defaultPagesMatchesIsFocus && isPagesMatch) { selectedElement = div; } else if (!isOut && !isPagesMatch) { selectedElement = div; } } } if (selectedElement && findController) { findController.scrollMatchIntoView({ element: selectedElement, selectedLeft: 0, pageIndex: pageIdx, matchIndex: selectedMatchIdx, }); this.defaultPagesMatchesIsFocus = false; } if (prevEnd) { appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); } } /** * * @desc 合并数据方法 * @returns */ _merageMatches(baseMatchs, matches) { while (matches.length) { const match = matches[0]; const beginIndex = baseMatchs.findIndex((item) => { return ( (item.begin.divIdx < match.begin.divIdx || (item.begin.divIdx === match.begin.divIdx && item.begin.offset <= match.begin.offset)) && (item.end.divIdx > match.begin.divIdx || (item.end.divIdx === match.begin.divIdx && item.end.offset > match.begin.offset)) ); }); const endIndex = baseMatchs.findIndex((item) => { return ( (item.begin.divIdx < match.end.divIdx || (item.begin.divIdx === match.end.divIdx && item.begin.offset <= match.end.offset)) && (item.end.divIdx > match.end.divIdx || (item.end.divIdx === match.end.divIdx && item.end.offset >= match.end.offset)) ); }); if (endIndex === -1 && beginIndex === -1) { baseMatchs.push({ ...match, }); matches.shift(); continue; } if (endIndex !== 1 && beginIndex !== -1 && endIndex !== beginIndex) { baseMatchs[beginIndex].end = { ...match.begin }; baseMatchs[endIndex].begin = { ...match.end }; baseMatchs.splice(beginIndex + 1, endIndex - beginIndex - 1, match); matches.shift(); continue; } if (endIndex !== -1 && beginIndex !== -1 && endIndex === beginIndex) { baseMatchs.splice( beginIndex, 1, { ...baseMatchs[beginIndex], end: { ...match.begin }, }, match, { ...baseMatchs[beginIndex], begin: { ...match.end }, } ); matches.shift(); continue; } if (endIndex !== -1 && beginIndex === -1) { baseMatchs[endIndex].begin = { ...match.end }; baseMatchs.splice(0, 0, match); matches.shift(); continue; } if (endIndex === -1 && beginIndex !== -1) { baseMatchs[beginIndex].end = { ...match.begin }; baseMatchs.push(match); matches.shift(); continue; } matches.shift(); console.log("没有处理的", endIndex, beginIndex); } baseMatchs.sort((a, b) => { return a.begin.divIdx - b.begin.divIdx; }); return baseMatchs.filter((item) => { if (item.begin.divIdx === item.end.divIdx && item.begin.offset === item.end.offset) { return false } return true }) } _updateMatches(reset = false) { // 清空原高亮筛选逻辑,调用_renderMatches渲染新高亮样式 if (!this.enabled && !reset) { return; } // this.pageIdx 当前页数index const { findController, pageIdx } = this; const { textContentItemsStr, textDivs, matches = [] } = this; // 清楚匹配项 for (let i = 0, ii = matches.length; i < ii; i++) { const match = matches[i]; const begin = match.begin.divIdx; for (let n = begin, end = match.end.divIdx; n <= end; n++) { const div = textDivs[n]; if (div) { div.textContent = textContentItemsStr[n]; div.className = ""; } } } let sectionMatches = [...(this.defaultPagesMatches?.[this.pageIdx] || [])]; if (findController?.highlightMatches && !reset) { const pageMatches = findController.pageMatches[pageIdx] || null; const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null; const findMatches = this._convertMatches(pageMatches, pageMatchesLength); const selectedMatchIdx = findController.selected.matchIdx; pageIdx === findController.selected.pageIdx && findMatches[selectedMatchIdx] && (findMatches[selectedMatchIdx].className = "selected"); this.matches = this._merageMatches(sectionMatches, findMatches); this._renderMatches(this.matches || []); return; } this.matches = sectionMatches; this._renderMatches(sectionMatches || []); } } }, (Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.TextLayerBuilder=void 0;var wi=Ei(6);Si.TextLayerBuilder=class{constructor({textLayerDiv:Ci,eventBus:ki,pageIndex:xi,viewport:Ti,highlighter:Oi=null,enhanceTextSelection:ji=!1}){this.textLayerDiv=Ci,this.eventBus=ki,this.textContent=null,this.textContentItemsStr=[],this.textContentStream=null,this.renderingDone=!1,this.pageNumber=xi+1,this.viewport=Ti,this.textDivs=[],this.textLayerRenderTask=null,this.highlighter=Oi,this.enhanceTextSelection=ji,this._bindMouse()}_finishRendering(){if(this.renderingDone=!0,!this.enhanceTextSelection){const Ci=document.createElement("div");Ci.className="endOfContent",this.textLayerDiv.appendChild(Ci)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}render(Ci=0){var xi;if(!this.textContent&&!this.textContentStream||this.renderingDone)return;this.cancel(),this.textDivs.length=0,(xi=this.highlighter)==null||xi.setTextMapping(this.textDivs,this.textContentItemsStr);const ki=document.createDocumentFragment();this.textLayerRenderTask=(0,wi.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:ki,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:Ci,enhanceTextSelection:this.enhanceTextSelection}),this.textLayerRenderTask.promise.then(()=>{var Ti;this.textLayerDiv.appendChild(ki),this._finishRendering(),(Ti=this.highlighter)==null||Ti.enable()},function(Ti){})}cancel(){var Ci;this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),(Ci=this.highlighter)==null||Ci.disable()}setTextContentStream(Ci){this.cancel(),this.textContentStream=Ci}setTextContent(Ci){this.cancel(),this.textContent=Ci}_bindMouse(){const Ci=this.textLayerDiv;let ki=null;Ci.addEventListener("mousedown",xi=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){this.textLayerRenderTask.expandTextDivs(!0),ki&&(clearTimeout(ki),ki=null);return}const Ti=Ci.querySelector(".endOfContent");if(!Ti)return;let Oi=xi.target!==Ci;if(Oi=Oi&&window.getComputedStyle(Ti).getPropertyValue("-moz-user-select")!=="none",Oi){const ji=Ci.getBoundingClientRect(),Li=Math.max(0,(xi.pageY-ji.top)/ji.height);Ti.style.top=(100*Li).toFixed(2)+"%"}Ti.classList.add("active")}),Ci.addEventListener("mouseup",()=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){ki=setTimeout(()=>{this.textLayerRenderTask&&this.textLayerRenderTask.expandTextDivs(!1),ki=null},300);return}const xi=Ci.querySelector(".endOfContent");xi&&(xi.style.top="",xi.classList.remove("active"))})}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.XfaLayerBuilder=void 0;var wi=Ei(6);Si.XfaLayerBuilder=class{constructor({pageDiv:Ci,pdfPage:ki,annotationStorage:xi=null,linkService:Ti,xfaHtml:Oi=null}){this.pageDiv=Ci,this.pdfPage=ki,this.annotationStorage=xi,this.linkService=Ti,this.xfaHtml=Oi,this.div=null,this._cancelled=!1}render(Ci,ki="display"){if(ki==="print"){const xi={viewport:Ci.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:ki},Ti=document.createElement("div");this.pageDiv.appendChild(Ti),xi.div=Ti;const Oi=wi.XfaLayer.render(xi);return Promise.resolve(Oi)}return this.pdfPage.getXfa().then(xi=>{if(this._cancelled||!xi)return{textDivs:[]};const Ti={viewport:Ci.clone({dontFlip:!0}),div:this.div,xfaHtml:xi,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:ki};return this.div?wi.XfaLayer.update(Ti):(this.div=document.createElement("div"),this.pageDiv.appendChild(this.div),Ti.div=this.div,wi.XfaLayer.render(Ti))}).catch(xi=>{})}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(Ai,Si,Ei)=>{var xi,Ns,Oi,Bs,Li;Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFThumbnailViewer=void 0;var wi=Ei(1),Ci=Ei(26);const ki="selected";Si.PDFThumbnailViewer=(Li=class{constructor({container:Ii,eventBus:Mi,linkService:Fi,renderingQueue:Bi,l10n:Ri}){Er(this,xi);Er(this,Oi);this.container=Ii,this.linkService=Fi,this.renderingQueue=Bi,this.l10n=Ri,this.scroll=(0,wi.watchScroll)(this.container,this._scrollUpdated.bind(this)),this._resetView(),Mi._on("optionalcontentconfigchanged",()=>{this._setImageDisabled=!0})}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(Ii){return this._thumbnails[Ii]}_getVisibleThumbs(){return(0,wi.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(Ii){if(!this.pdfDocument)return;const Mi=this._thumbnails[Ii-1];if(!Mi)return;Ii!==this._currentPageNumber&&(this._thumbnails[this._currentPageNumber-1].div.classList.remove(ki),Mi.div.classList.add(ki));const{first:Fi,last:Bi,views:Ri}=this._getVisibleThumbs();if(Ri.length>0){let Vi=!1;if(Ii<=Fi.id||Ii>=Bi.id)Vi=!0;else for(const{id:Ni,percent:Wi}of Ri)if(Ni===Ii){Vi=Wi<100;break}Vi&&(0,wi.scrollIntoView)(Mi.div,{top:-19})}this._currentPageNumber=Ii}get pagesRotation(){return this._pagesRotation}set pagesRotation(Ii){if(!(0,wi.isValidRotation)(Ii))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument||this._pagesRotation===Ii)return;this._pagesRotation=Ii;const Mi={rotation:Ii};for(const Fi of this._thumbnails)Fi.update(Mi)}cleanup(){for(let Ii=0,Mi=this._thumbnails.length;Ii{this._optionalContentConfigPromise=Fi;const Ri=Ii.numPages,Vi=Bi.getViewport({scale:1}),Ni=()=>this._setImageDisabled;for(let zi=1;zi<=Ri;++zi){const Di=new Ci.PDFThumbnailView({container:this.container,id:zi,defaultViewport:Vi.clone(),optionalContentConfigPromise:Fi,linkService:this.linkService,renderingQueue:this.renderingQueue,checkSetImageDisabled:Ni,l10n:this.l10n});this._thumbnails.push(Di)}const Wi=this._thumbnails[0];Wi&&Wi.setPdfPage(Bi),this._thumbnails[this._currentPageNumber-1].div.classList.add(ki)}).catch(Bi=>{})}_cancelRendering(){for(let Ii=0,Mi=this._thumbnails.length;Ii{this.renderingQueue.renderView(Fi)}),!0):!1}},xi=new WeakSet,Ns=async function(Ii){if(Ii.pdfPage)return Ii.pdfPage;try{const Mi=await this.pdfDocument.getPage(Ii.id);return Ii.pdfPage||Ii.setPdfPage(Mi),Mi}catch{return null}},Oi=new WeakSet,Bs=function(Ii){var Mi,Fi;return((Mi=Ii.first)==null?void 0:Mi.id)===1||((Fi=Ii.last)==null?void 0:Fi.id)!==this._thumbnails.length&&this.scroll.down},Li)},(Ai,Si,Ei)=>{var xi;Object.defineProperty(Si,"__esModule",{value:!0}),Si.TempImageFactory=Si.PDFThumbnailView=void 0;var wi=Ei(1),Ci=Ei(6);class ki{static getCanvas(Oi,ji){const Li=Cr(this,xi)||Nr(this,xi,document.createElement("canvas"));Li.width=Oi,Li.height=ji,Li.mozOpaque=!0;const Ii=Li.getContext("2d",{alpha:!1});return Ii.save(),Ii.fillStyle="rgb(255, 255, 255)",Ii.fillRect(0,0,Oi,ji),Ii.restore(),[Li,Li.getContext("2d")]}static destroyCanvas(){const Oi=Cr(this,xi);Oi&&(Oi.width=0,Oi.height=0),Nr(this,xi,null)}}xi=new WeakMap,Er(ki,xi,null),Si.TempImageFactory=ki,Si.PDFThumbnailView=class{constructor({container:Ti,id:Oi,defaultViewport:ji,optionalContentConfigPromise:Li,linkService:Ii,renderingQueue:Mi,checkSetImageDisabled:Fi,l10n:Bi}){this.id=Oi,this.renderingId="thumbnail"+Oi,this.pageLabel=null,this.pdfPage=null,this.rotation=0,this.viewport=ji,this.pdfPageRotate=ji.rotation,this._optionalContentConfigPromise=Li||null,this.linkService=Ii,this.renderingQueue=Mi,this.renderTask=null,this.renderingState=wi.RenderingStates.INITIAL,this.resume=null,this._checkSetImageDisabled=Fi||function(){return!1};const Ri=this.viewport.width,Vi=Ri/this.viewport.height;this.canvasWidth=98,this.canvasHeight=this.canvasWidth/Vi|0,this.scale=this.canvasWidth/Ri,this.l10n=Bi;const Ni=document.createElement("a");Ni.href=Ii.getAnchorUrl("#page="+Oi),this._thumbPageTitle.then(Di=>{Ni.title=Di}),Ni.onclick=function(){return Ii.goToPage(Oi),!1},this.anchor=Ni;const Wi=document.createElement("div");Wi.className="thumbnail",Wi.setAttribute("data-page-number",this.id),this.div=Wi;const zi=document.createElement("div");zi.className="thumbnailSelectionRing",zi.style.width=this.canvasWidth+2+"px",zi.style.height=this.canvasHeight+2+"px",this.ring=zi,Wi.appendChild(zi),Ni.appendChild(Wi),Ti.appendChild(Ni)}setPdfPage(Ti){this.pdfPage=Ti,this.pdfPageRotate=Ti.rotate;const Oi=(this.rotation+this.pdfPageRotate)%360;this.viewport=Ti.getViewport({scale:1,rotation:Oi}),this.reset()}reset(){this.cancelRendering(),this.renderingState=wi.RenderingStates.INITIAL;const Ti=this.viewport.width,Oi=Ti/this.viewport.height;this.canvasHeight=this.canvasWidth/Oi|0,this.scale=this.canvasWidth/Ti,this.div.removeAttribute("data-loaded");const ji=this.ring;ji.textContent="",ji.style.width=this.canvasWidth+2+"px",ji.style.height=this.canvasHeight+2+"px",this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas),this.image&&(this.image.removeAttribute("src"),delete this.image)}update({rotation:Ti=null}){typeof Ti=="number"&&(this.rotation=Ti);const Oi=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:Oi}),this.reset()}cancelRendering(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}_getPageDrawContext(Ti=1){const Oi=document.createElement("canvas");Oi.mozOpaque=!0;const ji=Oi.getContext("2d",{alpha:!1}),Li=new wi.OutputScale;return Oi.width=Ti*this.canvasWidth*Li.sx|0,Oi.height=Ti*this.canvasHeight*Li.sy|0,{ctx:ji,canvas:Oi,transform:Li.scaled?[Li.sx,0,0,Li.sy,0,0]:null}}_convertCanvasToImage(Ti){if(this.renderingState!==wi.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const Oi=this._reduceImage(Ti),ji=document.createElement("img");ji.className="thumbnailImage",this._thumbPageCanvas.then(Li=>{ji.setAttribute("aria-label",Li)}),ji.style.width=this.canvasWidth+"px",ji.style.height=this.canvasHeight+"px",ji.src=Oi.toDataURL(),this.image=ji,this.div.setAttribute("data-loaded",!0),this.ring.appendChild(ji),Oi.width=0,Oi.height=0}draw(){if(this.renderingState!==wi.RenderingStates.INITIAL)return Promise.resolve();const{pdfPage:Ti}=this;if(!Ti)return this.renderingState=wi.RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=wi.RenderingStates.RUNNING;const Oi=async(Ri=null)=>{if(Fi===this.renderTask&&(this.renderTask=null),!(Ri instanceof Ci.RenderingCancelledException)&&(this.renderingState=wi.RenderingStates.FINISHED,this._convertCanvasToImage(Li),Ri))throw Ri},{ctx:ji,canvas:Li,transform:Ii}=this._getPageDrawContext(2),Mi={canvasContext:ji,transform:Ii,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise},Fi=this.renderTask=Ti.render(Mi);Fi.onContinue=Ri=>{this.renderingQueue.isHighestPriority(this)?Ri():(this.renderingState=wi.RenderingStates.PAUSED,this.resume=()=>{this.renderingState=wi.RenderingStates.RUNNING,Ri()})};const Bi=Fi.promise.then(function(){return Oi(null)},function(Ri){return Oi(Ri)});return Bi.finally(()=>{var Ri;Li.width=0,Li.height=0,this.linkService.isPageCached(this.id)||((Ri=this.pdfPage)==null||Ri.cleanup())}),Bi}setImage(Ti){if(this._checkSetImageDisabled()||this.renderingState!==wi.RenderingStates.INITIAL)return;const{canvas:Oi,pdfPage:ji}=Ti;Oi&&(this.pdfPage||this.setPdfPage(ji),this.renderingState=wi.RenderingStates.FINISHED,this._convertCanvasToImage(Oi))}_reduceImage(Ti){const{ctx:Oi,canvas:ji}=this._getPageDrawContext();if(Ti.width<=2*ji.width)return Oi.drawImage(Ti,0,0,Ti.width,Ti.height,0,0,ji.width,ji.height),ji;let Li=ji.width<<3,Ii=ji.height<<3;const[Mi,Fi]=ki.getCanvas(Li,Ii);for(;Li>Ti.width||Ii>Ti.height;)Li>>=1,Ii>>=1;for(Fi.drawImage(Ti,0,0,Ti.width,Ti.height,0,0,Li,Ii);Li>2*ji.width;)Fi.drawImage(Mi,0,0,Li,Ii,0,0,Li>>1,Ii>>1),Li>>=1,Ii>>=1;return Oi.drawImage(Mi,0,0,Li,Ii,0,0,ji.width,ji.height),ji}get _thumbPageTitle(){var Ti;return this.l10n.get("thumb_page_title",{page:(Ti=this.pageLabel)!=null?Ti:this.id})}get _thumbPageCanvas(){var Ti;return this.l10n.get("thumb_page_canvas",{page:(Ti=this.pageLabel)!=null?Ti:this.id})}setPageLabel(Ti){this.pageLabel=typeof Ti=="string"?Ti:null,this._thumbPageTitle.then(Oi=>{this.anchor.title=Oi}),this.renderingState===wi.RenderingStates.FINISHED&&this._thumbPageCanvas.then(Oi=>{var ji;(ji=this.image)==null||ji.setAttribute("aria-label",Oi)})}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFHistory=void 0,Si.isDestArraysEqual=Ti,Si.isDestHashesEqual=xi;var wi=Ei(1),Ci=Ei(2);function ki(){return document.location.hash}Si.PDFHistory=class{constructor({linkService:Oi,eventBus:ji}){this.linkService=Oi,this.eventBus=ji,this._initialized=!1,this._fingerprint="",this.reset(),this._boundEvents=null,this._isViewerInPresentationMode=!1,this.eventBus._on("presentationmodechanged",Li=>{this._isViewerInPresentationMode=Li.state!==wi.PresentationModeState.NORMAL}),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",Li=>{this._isPagesLoaded=!!Li.pagesCount},{once:!0})})}initialize({fingerprint:Oi,resetHistory:ji=!1,updateUrl:Li=!1}){if(!Oi||typeof Oi!="string")return;this._initialized&&this.reset();const Ii=this._fingerprint!==""&&this._fingerprint!==Oi;this._fingerprint=Oi,this._updateUrl=Li===!0,this._initialized=!0,this._bindEvents();const Mi=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=ki(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(Mi,!0)||ji){const{hash:Bi,page:Ri,rotation:Vi}=this._parseCurrentHash(!0);if(!Bi||Ii||ji){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:Bi,page:Ri,rotation:Vi},!0);return}const Fi=Mi.destination;this._updateInternalState(Fi,Mi.uid,!0),Fi.rotation!==void 0&&(this._initialRotation=Fi.rotation),Fi.dest?(this._initialBookmark=JSON.stringify(Fi.dest),this._destination.page=null):Fi.hash?this._initialBookmark=Fi.hash:Fi.page&&(this._initialBookmark=`page=${Fi.page}`)}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:Oi=null,explicitDest:ji,pageNumber:Li}){if(!this._initialized||Oi&&typeof Oi!="string"||!Array.isArray(ji)||!this._isValidPage(Li)&&(Li!==null||this._destination))return;const Ii=Oi||JSON.stringify(ji);if(!Ii)return;let Mi=!1;if(this._destination&&(xi(this._destination.hash,Ii)||Ti(this._destination.dest,ji))){if(this._destination.page)return;Mi=!0}(!this._popStateInProgress||Mi)&&(this._pushOrReplaceState({dest:ji,hash:Ii,page:Li,rotation:this.linkService.rotation},Mi),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(Oi){var Ii;if(!this._initialized||!this._isValidPage(Oi)||((Ii=this._destination)==null?void 0:Ii.page)===Oi||this._popStateInProgress)return;let ji=`page=${Oi}`;const Li=(0,wi.parseQueryString)(this._destination.hash);Li.has("zoom")&&(ji+=`&zoom=${Li.get("zoom")}`),this._pushOrReplaceState({dest:null,hash:ji,page:Oi,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const Oi=window.history.state;this._isValidState(Oi)&&Oi.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const Oi=window.history.state;this._isValidState(Oi)&&Oi.uid0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(Oi,ji=!1){const Li=ji||!this._destination,Ii={fingerprint:this._fingerprint,uid:Li?this._uid:this._uid+1,destination:Oi};this._updateInternalState(Oi,Ii.uid);let Mi;if(this._updateUrl&&(Oi!=null&&Oi.hash)){const Fi=document.location.href.split("#")[0];Fi.startsWith("file://")||(Mi=`${Fi}#${Oi.hash}`)}Li?window.history.replaceState(Ii,"",Mi):window.history.pushState(Ii,"",Mi)}_tryPushCurrentPosition(Oi=!1){if(!this._position)return;let ji=this._position;if(Oi&&(ji=Object.assign(Object.create(null),this._position),ji.temporary=!0),!this._destination){this._pushOrReplaceState(ji);return}if(this._destination.temporary){this._pushOrReplaceState(ji,!0);return}if(this._destination.hash===ji.hash||!this._destination.page&&this._numPositionUpdates<=50)return;let Li=!1;if(this._destination.page>=ji.first&&this._destination.page<=ji.page){if(this._destination.dest!==void 0||!this._destination.first)return;Li=!0}this._pushOrReplaceState(ji,Li)}_isValidPage(Oi){return Number.isInteger(Oi)&&Oi>0&&Oi<=this.linkService.pagesCount}_isValidState(Oi,ji=!1){if(!Oi)return!1;if(Oi.fingerprint!==this._fingerprint){if(!ji)return!1;{if(typeof Oi.fingerprint!="string"||Oi.fingerprint.length!==this._fingerprint.length||new Date().getTime()-performance.timing.loadEventEnd>200)return!1;const[Li]=performance.getEntriesByType("navigation");if((Li==null?void 0:Li.type)!=="reload")return!1}}return!(!Number.isInteger(Oi.uid)||Oi.uid<0)&&Oi.destination!==null&&typeof Oi.destination=="object"}_updateInternalState(Oi,ji,Li=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),Li&&(Oi!=null&&Oi.temporary)&&delete Oi.temporary,this._destination=Oi,this._uid=ji,this._maxUid=Math.max(this._maxUid,ji),this._numPositionUpdates=0}_parseCurrentHash(Oi=!1){const ji=unescape(ki()).substring(1),Li=(0,wi.parseQueryString)(ji),Ii=Li.get("nameddest")||"";let Mi=0|Li.get("page");return(!this._isValidPage(Mi)||Oi&&Ii.length>0)&&(Mi=null),{hash:ji,page:Mi,rotation:this.linkService.rotation}}_updateViewarea({location:Oi}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:this._isViewerInPresentationMode?`page=${Oi.pageNumber}`:Oi.pdfOpenParams.substring(1),page:this.linkService.page,first:Oi.pageNumber,rotation:Oi.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0),this._updateViewareaTimeout=null},1e3))}_popState({state:Oi}){const ji=ki(),Li=this._currentHash!==ji;if(this._currentHash=ji,!Oi){this._uid++;const{hash:Mi,page:Fi,rotation:Bi}=this._parseCurrentHash();this._pushOrReplaceState({hash:Mi,page:Fi,rotation:Bi},!0);return}if(!this._isValidState(Oi))return;this._popStateInProgress=!0,Li&&(this._blockHashChange++,(0,Ci.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then(()=>{this._blockHashChange--}));const Ii=Oi.destination;this._updateInternalState(Ii,Oi.uid,!0),(0,wi.isValidRotation)(Ii.rotation)&&(this.linkService.rotation=Ii.rotation),Ii.dest?this.linkService.goToDestination(Ii.dest):Ii.hash?this.linkService.setHash(Ii.hash):Ii.page&&(this.linkService.page=Ii.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}_unbindEvents(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}};function xi(Oi,ji){return typeof Oi!="string"||typeof ji!="string"?!1:Oi===ji?!0:(0,wi.parseQueryString)(Oi).get("nameddest")===ji}function Ti(Oi,ji){function Li(Ii,Mi){if(typeof Ii!=typeof Mi||Array.isArray(Ii)||Array.isArray(Mi))return!1;if(Ii!==null&&typeof Ii=="object"&&Mi!==null){if(Object.keys(Ii).length!==Object.keys(Mi).length)return!1;for(const Fi in Ii)if(!Li(Ii[Fi],Mi[Fi]))return!1;return!0}return Ii===Mi||Number.isNaN(Ii)&&Number.isNaN(Mi)}if(!Array.isArray(Oi)||!Array.isArray(ji)||Oi.length!==ji.length)return!1;for(let Ii=0,Mi=Oi.length;Ii{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFFindBar=void 0;var wi=Ei(12);Si.PDFFindBar=class{constructor(Ci,ki,xi){this.opened=!1,this.bar=Ci.bar,this.toggleButton=Ci.toggleButton,this.findField=Ci.findField,this.highlightAll=Ci.highlightAllCheckbox,this.caseSensitive=Ci.caseSensitiveCheckbox,this.matchDiacritics=Ci.matchDiacriticsCheckbox,this.entireWord=Ci.entireWordCheckbox,this.findMsg=Ci.findMsg,this.findResultsCount=Ci.findResultsCount,this.findPreviousButton=Ci.findPreviousButton,this.findNextButton=Ci.findNextButton,this.eventBus=ki,this.l10n=xi,this.toggleButton.addEventListener("click",()=>{this.toggle()}),this.findField.addEventListener("input",()=>{this.dispatchEvent("")}),this.bar.addEventListener("keydown",Ti=>{switch(Ti.keyCode){case 13:Ti.target===this.findField&&this.dispatchEvent("again",Ti.shiftKey);break;case 27:this.close()}}),this.findPreviousButton.addEventListener("click",()=>{this.dispatchEvent("again",!0)}),this.findNextButton.addEventListener("click",()=>{this.dispatchEvent("again",!1)}),this.highlightAll.addEventListener("click",()=>{this.dispatchEvent("highlightallchange")}),this.caseSensitive.addEventListener("click",()=>{this.dispatchEvent("casesensitivitychange")}),this.entireWord.addEventListener("click",()=>{this.dispatchEvent("entirewordchange")}),this.matchDiacritics.addEventListener("click",()=>{this.dispatchEvent("diacriticmatchingchange")}),this.eventBus._on("resize",this._adjustWidth.bind(this))}reset(){this.updateUIState()}dispatchEvent(Ci,ki=!1){this.eventBus.dispatch("find",{source:this,type:Ci,query:this.findField.value,phraseSearch:!0,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,highlightAll:this.highlightAll.checked,findPrevious:ki,matchDiacritics:this.matchDiacritics.checked})}updateUIState(Ci,ki,xi){let Ti=Promise.resolve(""),Oi="";switch(Ci){case wi.FindState.FOUND:break;case wi.FindState.PENDING:Oi="pending";break;case wi.FindState.NOT_FOUND:Ti=this.l10n.get("find_not_found"),Oi="notFound";break;case wi.FindState.WRAPPED:Ti=this.l10n.get("find_reached_"+(ki?"top":"bottom"))}this.findField.setAttribute("data-status",Oi),Ti.then(ji=>{this.findMsg.textContent=ji,this._adjustWidth()}),this.updateResultsCount(xi)}updateResultsCount({current:Ci=0,total:ki=0}={}){let xi=Promise.resolve("");if(ki>0)if(ki>1e3){let Ti="find_match_count_limit";xi=this.l10n.get(Ti,{limit:1e3})}else{let Ti="find_match_count";xi=this.l10n.get(Ti,{current:Ci,total:ki})}xi.then(Ti=>{this.findResultsCount.textContent=Ti,this._adjustWidth()})}open(){this.opened||(this.opened=!0,this.toggleButton.classList.add("toggled"),this.toggleButton.setAttribute("aria-expanded","true"),this.bar.classList.remove("hidden")),this.findField.select(),this.findField.focus(),this._adjustWidth()}close(){this.opened&&(this.opened=!1,this.toggleButton.classList.remove("toggled"),this.toggleButton.setAttribute("aria-expanded","false"),this.bar.classList.add("hidden"),this.eventBus.dispatch("findbarclose",{source:this}))}toggle(){this.opened?this.close():this.open()}_adjustWidth(){this.opened&&(this.bar.classList.remove("wrapContainers"),this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers"))}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFDocumentProperties=void 0;var wi=Ei(6),Ci=Ei(1);const ki=["en-us","en-lr","my"],xi={"8.5x11":"Letter","8.5x14":"Legal"},Ti={"297x420":"A3","210x297":"A4"};function Oi(ji,Li,Ii){return Ii[`${Li?ji.width:ji.height}x${Li?ji.height:ji.width}`]}Si.PDFDocumentProperties=class{constructor({overlayName:ji,fields:Li,container:Ii,closeButton:Mi},Fi,Bi,Ri){this.overlayName=ji,this.fields=Li,this.container=Ii,this.overlayManager=Fi,this.l10n=Ri,this._reset(),Mi.addEventListener("click",this.close.bind(this)),this.overlayManager.register(this.overlayName,this.container,this.close.bind(this)),Bi._on("pagechanging",Vi=>{this._currentPageNumber=Vi.pageNumber}),Bi._on("rotationchanging",Vi=>{this._pagesRotation=Vi.pagesRotation}),this._isNonMetricLocale=!0,Ri.getLanguage().then(Vi=>{this._isNonMetricLocale=ki.includes(Vi)})}async open(){const ji=qi=>{Object.defineProperty(this,"fieldData",{value:Object.freeze(qi),writable:!1,enumerable:!0,configurable:!0})};await Promise.all([this.overlayManager.open(this.overlayName),this._dataAvailableCapability.promise]);const Li=this._currentPageNumber,Ii=this._pagesRotation;if(this.fieldData&&Li===this.fieldData._currentPageNumber&&Ii===this.fieldData._pagesRotation){this._updateUI();return}const{info:Mi,contentDispositionFilename:Fi,contentLength:Bi}=await this.pdfDocument.getMetadata(),[Ri,Vi,Ni,Wi,zi,Di]=await Promise.all([Fi||(0,wi.getPdfFilenameFromUrl)(this.url),this._parseFileSize(Bi),this._parseDate(Mi.CreationDate),this._parseDate(Mi.ModDate),this.pdfDocument.getPage(Li).then(qi=>this._parsePageSize((0,Ci.getPageSizeInches)(qi),Ii)),this._parseLinearization(Mi.IsLinearized)]);ji({fileName:Ri,fileSize:Vi,title:Mi.Title,author:Mi.Author,subject:Mi.Subject,keywords:Mi.Keywords,creationDate:Ni,modificationDate:Wi,creator:Mi.Creator,producer:Mi.Producer,version:Mi.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:zi,linearized:Di,_currentPageNumber:Li,_pagesRotation:Ii}),this._updateUI();const{length:Ui}=await this.pdfDocument.getDownloadInfo();if(Bi===Ui)return;const Hi=Object.assign(Object.create(null),this.fieldData);Hi.fileSize=await this._parseFileSize(Ui),ji(Hi),this._updateUI()}close(){this.overlayManager.close(this.overlayName)}setDocument(ji,Li=null){this.pdfDocument&&(this._reset(),this._updateUI(!0)),ji&&(this.pdfDocument=ji,this.url=Li,this._dataAvailableCapability.resolve())}_reset(){this.pdfDocument=null,this.url=null,delete this.fieldData,this._dataAvailableCapability=(0,wi.createPromiseCapability)(),this._currentPageNumber=1,this._pagesRotation=0}_updateUI(ji=!1){if(!ji&&this.fieldData){if(this.overlayManager.active===this.overlayName)for(const Li in this.fields){const Ii=this.fieldData[Li];this.fields[Li].textContent=Ii||Ii===0?Ii:"-"}}else for(const Li in this.fields)this.fields[Li].textContent="-"}async _parseFileSize(ji=0){const Li=ji/1024,Ii=Li/1024;if(Li)return this.l10n.get("document_properties_"+(Ii>=1?"mb":"kb"),{size_mb:Ii>=1&&(+Ii.toPrecision(3)).toLocaleString(),size_kb:Ii<1&&(+Li.toPrecision(3)).toLocaleString(),size_b:ji.toLocaleString()})}async _parsePageSize(ji,Li){if(!ji)return;Li%180!=0&&(ji={width:ji.height,height:ji.width});const Ii=(0,Ci.isPortraitOrientation)(ji);let Mi={width:Math.round(100*ji.width)/100,height:Math.round(100*ji.height)/100},Fi={width:Math.round(25.4*ji.width*10)/10,height:Math.round(25.4*ji.height*10)/10},Bi=Oi(Mi,Ii,xi)||Oi(Fi,Ii,Ti);if(!(Bi||Number.isInteger(Fi.width)&&Number.isInteger(Fi.height))){const Di={width:25.4*ji.width,height:25.4*ji.height},Ui={width:Math.round(Fi.width),height:Math.round(Fi.height)};Math.abs(Di.width-Ui.width)<.1&&Math.abs(Di.height-Ui.height)<.1&&(Bi=Oi(Ui,Ii,Ti),Bi&&(Mi={width:Math.round(Ui.width/25.4*100)/100,height:Math.round(Ui.height/25.4*100)/100},Fi=Ui))}const[{width:Ri,height:Vi},Ni,Wi,zi]=await Promise.all([this._isNonMetricLocale?Mi:Fi,this.l10n.get("document_properties_page_size_unit_"+(this._isNonMetricLocale?"inches":"millimeters")),Bi&&this.l10n.get(`document_properties_page_size_name_${Bi.toLowerCase()}`),this.l10n.get("document_properties_page_size_orientation_"+(Ii?"portrait":"landscape"))]);return this.l10n.get(`document_properties_page_size_dimension_${Wi?"name_":""}string`,{width:Ri.toLocaleString(),height:Vi.toLocaleString(),unit:Ni,name:Wi,orientation:zi})}async _parseDate(ji){const Li=wi.PDFDateString.toDateObject(ji);if(Li)return this.l10n.get("document_properties_date_string",{date:Li.toLocaleDateString(),time:Li.toLocaleTimeString()})}_parseLinearization(ji){return this.l10n.get("document_properties_linearized_"+(ji?"yes":"no"))}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.Toolbar=void 0;var wi=Ei(1);Si.Toolbar=class{constructor(Ci,ki,xi){this.toolbar=Ci.container,this.eventBus=ki,this.l10n=xi,this.buttons=[{element:Ci.previous,eventName:"previouspage"},{element:Ci.next,eventName:"nextpage"},{element:Ci.zoomIn,eventName:"zoomin"},{element:Ci.zoomOut,eventName:"zoomout"},{element:Ci.openFile,eventName:"openfile"},{element:Ci.print,eventName:"print"},{element:Ci.presentationModeButton,eventName:"presentationmode"},{element:Ci.download,eventName:"download"},{element:Ci.viewBookmark,eventName:null}],this.items={numPages:Ci.numPages,pageNumber:Ci.pageNumber,scaleSelect:Ci.scaleSelect,customScaleOption:Ci.customScaleOption,previous:Ci.previous,next:Ci.next,zoomIn:Ci.zoomIn,zoomOut:Ci.zoomOut},this._wasLocalized=!1,this.reset(),this._bindListeners()}setPageNumber(Ci,ki){this.pageNumber=Ci,this.pageLabel=ki-10,this._updateUIState(!1)}setPagesCount(Ci,ki){this.pagesCount=Ci,this.hasPageLabels=ki,this._updateUIState(!0)}setPageScale(Ci,ki){this.pageScaleValue=(Ci||ki).toString(),this.pageScale=ki,this._updateUIState(!1)}reset(){this.pageNumber=0,this.pageLabel=null,this.hasPageLabels=!1,this.pagesCount=0,this.pageScaleValue=wi.DEFAULT_SCALE_VALUE,this.pageScale=wi.DEFAULT_SCALE,this._updateUIState(!0),this.updateLoadingIndicatorState()}_bindListeners(){const{pageNumber:Ci,scaleSelect:ki}=this.items,xi=this;for(const{element:Ti,eventName:Oi}of this.buttons)Ti.addEventListener("click",ji=>{Oi!==null&&this.eventBus.dispatch(Oi,{source:this})});Ci.addEventListener("click",function(){this.select()}),Ci.addEventListener("change",function(){xi.eventBus.dispatch("pagenumberchanged",{source:xi,value:this.value})}),ki.addEventListener("change",function(){this.value!=="custom"&&xi.eventBus.dispatch("scalechanged",{source:xi,value:this.value})}),ki.addEventListener("click",function(Ti){const Oi=Ti.target;this.value===xi.pageScaleValue&&Oi.tagName.toUpperCase()==="OPTION"&&this.blur()}),ki.oncontextmenu=wi.noContextMenuHandler,this.eventBus._on("localized",()=>{this._wasLocalized=!0,this._adjustScaleWidth(),this._updateUIState(!0)})}_updateUIState(Ci=!1){if(!this._wasLocalized)return;const{pageNumber:ki,pagesCount:xi,pageScaleValue:Ti,pageScale:Oi,items:ji}=this;Ci&&(this.hasPageLabels?ji.pageNumber.type="text":(ji.pageNumber.type="number",this.l10n.get("of_pages",{pagesCount:xi}).then(Li=>{ji.numPages.textContent=Li})),ji.pageNumber.max=xi),this.hasPageLabels?(ji.pageNumber.value=this.pageLabel,this.l10n.get("page_of_pages",{pageNumber:ki,pagesCount:xi}).then(Li=>{ji.numPages.textContent=Li})):ji.pageNumber.value=ki,ji.previous.disabled=ki<=1,ji.next.disabled=ki>=xi,ji.zoomOut.disabled=Oi<=wi.MIN_SCALE,ji.zoomIn.disabled=Oi>=wi.MAX_SCALE,this.l10n.get("page_scale_percent",{scale:Math.round(1e4*Oi)/100}).then(Li=>{let Ii=!1;for(const Mi of ji.scaleSelect.options)Mi.value===Ti?(Mi.selected=!0,Ii=!0):Mi.selected=!1;Ii||(ji.customScaleOption.textContent=Li,ji.customScaleOption.selected=!0)})}updateLoadingIndicatorState(Ci=!1){this.items.pageNumber.classList.toggle("visiblePageIsLoading",Ci)}async _adjustScaleWidth(){const{items:Ci,l10n:ki}=this,xi=Promise.all([ki.get("page_scale_auto"),ki.get("page_scale_actual"),ki.get("page_scale_fit"),ki.get("page_scale_width")]),Ti=getComputedStyle(Ci.scaleSelect),Oi=parseInt(Ti.getPropertyValue("--scale-select-container-width"),10),ji=parseInt(Ti.getPropertyValue("--scale-select-overflow"),10);let Li=document.createElement("canvas");Li.mozOpaque=!0;let Ii=Li.getContext("2d",{alpha:!1});await wi.animationStarted,Ii.font=`${Ti.fontSize} ${Ti.fontFamily}`;let Mi=0;for(const Fi of await xi){const{width:Bi}=Ii.measureText(Fi);Bi>Mi&&(Mi=Bi)}Mi+=2*ji,Mi>Oi&&document.documentElement.style.setProperty("--scale-select-container-width",`${Mi}px`),Li.width=0,Li.height=0,Li=Ii=null}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.SecondaryToolbar=void 0;var wi=Ei(1),Ci=Ei(9),ki=Ei(16);Si.SecondaryToolbar=class{constructor(xi,Ti,Oi){this.toolbar=xi.toolbar,this.toggleButton=xi.toggleButton,this.toolbarButtonContainer=xi.toolbarButtonContainer,this.buttons=[{element:xi.presentationModeButton,eventName:"presentationmode",close:!0},{element:xi.openFileButton,eventName:"openfile",close:!0},{element:xi.printButton,eventName:"print",close:!0},{element:xi.downloadButton,eventName:"download",close:!0},{element:xi.viewBookmarkButton,eventName:null,close:!0},{element:xi.firstPageButton,eventName:"firstpage",close:!0},{element:xi.lastPageButton,eventName:"lastpage",close:!0},{element:xi.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:xi.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:xi.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:Ci.CursorTool.SELECT},close:!0},{element:xi.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:Ci.CursorTool.HAND},close:!0},{element:xi.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:wi.ScrollMode.PAGE},close:!0},{element:xi.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:wi.ScrollMode.VERTICAL},close:!0},{element:xi.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:wi.ScrollMode.HORIZONTAL},close:!0},{element:xi.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:wi.ScrollMode.WRAPPED},close:!0},{element:xi.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:wi.SpreadMode.NONE},close:!0},{element:xi.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:wi.SpreadMode.ODD},close:!0},{element:xi.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:wi.SpreadMode.EVEN},close:!0},{element:xi.documentPropertiesButton,eventName:"documentproperties",close:!0}],this.items={firstPage:xi.firstPageButton,lastPage:xi.lastPageButton,pageRotateCw:xi.pageRotateCwButton,pageRotateCcw:xi.pageRotateCcwButton},this.mainContainer=Ti,this.eventBus=Oi,this.opened=!1,this.containerHeight=null,this.previousContainerHeight=null,this.reset(),this._bindClickListeners(),this._bindCursorToolsListener(xi),this._bindScrollModeListener(xi),this._bindSpreadModeListener(xi),this.eventBus._on("resize",this._setMaxHeight.bind(this))}get isOpen(){return this.opened}setPageNumber(xi){this.pageNumber=xi,this._updateUIState()}setPagesCount(xi){this.pagesCount=xi,this._updateUIState()}reset(){this.pageNumber=0,this.pagesCount=0,this._updateUIState(),this.eventBus.dispatch("secondarytoolbarreset",{source:this})}_updateUIState(){this.items.firstPage.disabled=this.pageNumber<=1,this.items.lastPage.disabled=this.pageNumber>=this.pagesCount,this.items.pageRotateCw.disabled=this.pagesCount===0,this.items.pageRotateCcw.disabled=this.pagesCount===0}_bindClickListeners(){this.toggleButton.addEventListener("click",this.toggle.bind(this));for(const{element:xi,eventName:Ti,close:Oi,eventDetails:ji}of this.buttons)xi.addEventListener("click",Li=>{if(Ti!==null){const Ii={source:this};for(const Mi in ji)Ii[Mi]=ji[Mi];this.eventBus.dispatch(Ti,Ii)}Oi&&this.close()})}_bindCursorToolsListener(xi){this.eventBus._on("cursortoolchanged",function({tool:Ti}){xi.cursorSelectToolButton.classList.toggle("toggled",Ti===Ci.CursorTool.SELECT),xi.cursorHandToolButton.classList.toggle("toggled",Ti===Ci.CursorTool.HAND)})}_bindScrollModeListener(xi){const Ti=({mode:Oi})=>{xi.scrollPageButton.classList.toggle("toggled",Oi===wi.ScrollMode.PAGE),xi.scrollVerticalButton.classList.toggle("toggled",Oi===wi.ScrollMode.VERTICAL),xi.scrollHorizontalButton.classList.toggle("toggled",Oi===wi.ScrollMode.HORIZONTAL),xi.scrollWrappedButton.classList.toggle("toggled",Oi===wi.ScrollMode.WRAPPED);const ji=this.pagesCount>ki.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;xi.scrollPageButton.disabled=ji,xi.scrollVerticalButton.disabled=ji,xi.scrollHorizontalButton.disabled=ji,xi.scrollWrappedButton.disabled=ji;const Li=Oi===wi.ScrollMode.HORIZONTAL;xi.spreadNoneButton.disabled=Li,xi.spreadOddButton.disabled=Li,xi.spreadEvenButton.disabled=Li};this.eventBus._on("scrollmodechanged",Ti),this.eventBus._on("secondarytoolbarreset",Oi=>{Oi.source===this&&Ti({mode:wi.ScrollMode.VERTICAL})})}_bindSpreadModeListener(xi){function Ti({mode:Oi}){xi.spreadNoneButton.classList.toggle("toggled",Oi===wi.SpreadMode.NONE),xi.spreadOddButton.classList.toggle("toggled",Oi===wi.SpreadMode.ODD),xi.spreadEvenButton.classList.toggle("toggled",Oi===wi.SpreadMode.EVEN)}this.eventBus._on("spreadmodechanged",Ti),this.eventBus._on("secondarytoolbarreset",Oi=>{Oi.source===this&&Ti({mode:wi.SpreadMode.NONE})})}open(){this.opened||(this.opened=!0,this._setMaxHeight(),this.toggleButton.classList.add("toggled"),this.toggleButton.setAttribute("aria-expanded","true"),this.toolbar.classList.remove("hidden"))}close(){this.opened&&(this.opened=!1,this.toolbar.classList.add("hidden"),this.toggleButton.classList.remove("toggled"),this.toggleButton.setAttribute("aria-expanded","false"))}toggle(){this.opened?this.close():this.open()}_setMaxHeight(){this.opened&&(this.containerHeight=this.mainContainer.clientHeight,this.containerHeight!==this.previousContainerHeight&&(this.toolbarButtonContainer.style.maxHeight=this.containerHeight-wi.SCROLLBAR_PADDING+"px",this.previousContainerHeight=this.containerHeight))}}},(Ai,Si,Ei)=>{var Ti,Vs,ji,ds,Ii,js,Fi,Us,Ri,Ws,Ni,zs,zi,Hs,Ui,Gs,qi,Ss,Ki,qs,Xi,us,ar,Ks,fr,Ys,mr,Xs,Yi,Js,ir,Zs,tr,As,Ji;Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFPresentationMode=void 0;var wi=Ei(1);const Ci="pdfPresentationMode",ki="pdfPresentationModeControls",xi=Math.PI/6;Si.PDFPresentationMode=(Ji=class{constructor({container:sr,pdfViewer:pr,eventBus:or}){Er(this,Ti);Er(this,ji);Er(this,Ii);Er(this,Fi);Er(this,Ri);Er(this,Ni);Er(this,zi);Er(this,Ui);Er(this,qi);Er(this,Ki);Er(this,Xi);Er(this,ar);Er(this,fr);Er(this,mr);Er(this,Yi);Er(this,ir);Er(this,tr);this.container=sr,this.pdfViewer=pr,this.eventBus=or,this.active=!1,this.args=null,this.contextMenuOpen=!1,this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0,this.touchSwipeState=null}request(){return this.switchInProgress||this.active||!this.pdfViewer.pagesCount||!this.container.requestFullscreen?!1:(xr(this,ir,Zs).call(this),xr(this,Ii,js).call(this),xr(this,ji,ds).call(this),this.container.requestFullscreen(),this.args={pageNumber:this.pdfViewer.currentPageNumber,scaleValue:this.pdfViewer.currentScaleValue,scrollMode:this.pdfViewer.scrollMode,spreadMode:this.pdfViewer.spreadMode},!0)}},Ti=new WeakSet,Vs=function(sr){if(!this.active)return;sr.preventDefault();const pr=(0,wi.normalizeWheelEventDelta)(sr),or=Date.now(),Zi=this.mouseScrollTimeStamp;if(!(or>Zi&&or-Zi<50)&&((this.mouseScrollDelta>0&&pr<0||this.mouseScrollDelta<0&&pr>0)&&xr(this,Xi,us).call(this),this.mouseScrollDelta+=pr,Math.abs(this.mouseScrollDelta)>=.1)){const er=this.mouseScrollDelta;xr(this,Xi,us).call(this),(er>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=or)}},ji=new WeakSet,ds=function(){let sr=wi.PresentationModeState.NORMAL;this.switchInProgress?sr=wi.PresentationModeState.CHANGING:this.active&&(sr=wi.PresentationModeState.FULLSCREEN),this.eventBus.dispatch("presentationmodechanged",{source:this,state:sr})},Ii=new WeakSet,js=function(){this.switchInProgress&&clearTimeout(this.switchInProgress),this.switchInProgress=setTimeout(()=>{xr(this,tr,As).call(this),delete this.switchInProgress,xr(this,ji,ds).call(this)},1500)},Fi=new WeakSet,Us=function(){this.switchInProgress&&(clearTimeout(this.switchInProgress),delete this.switchInProgress)},Ri=new WeakSet,Ws=function(){this.active=!0,xr(this,Fi,Us).call(this),xr(this,ji,ds).call(this),this.container.classList.add(Ci),setTimeout(()=>{this.pdfViewer.scrollMode=wi.ScrollMode.PAGE,this.pdfViewer.spreadMode=wi.SpreadMode.NONE,this.pdfViewer.currentPageNumber=this.args.pageNumber,this.pdfViewer.currentScaleValue="page-fit"},0),xr(this,fr,Ys).call(this),xr(this,qi,Ss).call(this),this.contextMenuOpen=!1,window.getSelection().removeAllRanges()},Ni=new WeakSet,zs=function(){const sr=this.pdfViewer.currentPageNumber;this.container.classList.remove(Ci),setTimeout(()=>{this.active=!1,xr(this,tr,As).call(this),xr(this,ji,ds).call(this),this.pdfViewer.scrollMode=this.args.scrollMode,this.pdfViewer.spreadMode=this.args.spreadMode,this.pdfViewer.currentScaleValue=this.args.scaleValue,this.pdfViewer.currentPageNumber=sr,this.args=null},0),xr(this,mr,Xs).call(this),xr(this,Ki,qs).call(this),xr(this,Xi,us).call(this),this.contextMenuOpen=!1},zi=new WeakSet,Hs=function(sr){this.contextMenuOpen?(this.contextMenuOpen=!1,sr.preventDefault()):sr.button===0&&(sr.target.href&&sr.target.classList.contains("internalLink")||(sr.preventDefault(),sr.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()))},Ui=new WeakSet,Gs=function(){this.contextMenuOpen=!0},qi=new WeakSet,Ss=function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(ki),this.controlsTimeout=setTimeout(()=>{this.container.classList.remove(ki),delete this.controlsTimeout},3e3)},Ki=new WeakSet,qs=function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(ki),delete this.controlsTimeout)},Xi=new WeakSet,us=function(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0},ar=new WeakSet,Ks=function(sr){if(this.active)if(sr.touches.length>1)this.touchSwipeState=null;else switch(sr.type){case"touchstart":this.touchSwipeState={startX:sr.touches[0].pageX,startY:sr.touches[0].pageY,endX:sr.touches[0].pageX,endY:sr.touches[0].pageY};break;case"touchmove":if(this.touchSwipeState===null)return;this.touchSwipeState.endX=sr.touches[0].pageX,this.touchSwipeState.endY=sr.touches[0].pageY,sr.preventDefault();break;case"touchend":if(this.touchSwipeState===null)return;let pr=0;const or=this.touchSwipeState.endX-this.touchSwipeState.startX,Zi=this.touchSwipeState.endY-this.touchSwipeState.startY,er=Math.abs(Math.atan2(Zi,or));Math.abs(or)>50&&(er<=xi||er>=Math.PI-xi)?pr=or:Math.abs(Zi)>50&&Math.abs(er-Math.PI/2)<=xi&&(pr=Zi),pr>0?this.pdfViewer.previousPage():pr<0&&this.pdfViewer.nextPage()}},fr=new WeakSet,Ys=function(){this.showControlsBind=xr(this,qi,Ss).bind(this),this.mouseDownBind=xr(this,zi,Hs).bind(this),this.mouseWheelBind=xr(this,Ti,Vs).bind(this),this.resetMouseScrollStateBind=xr(this,Xi,us).bind(this),this.contextMenuBind=xr(this,Ui,Gs).bind(this),this.touchSwipeBind=xr(this,ar,Ks).bind(this),window.addEventListener("mousemove",this.showControlsBind),window.addEventListener("mousedown",this.mouseDownBind),window.addEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.addEventListener("keydown",this.resetMouseScrollStateBind),window.addEventListener("contextmenu",this.contextMenuBind),window.addEventListener("touchstart",this.touchSwipeBind),window.addEventListener("touchmove",this.touchSwipeBind),window.addEventListener("touchend",this.touchSwipeBind)},mr=new WeakSet,Xs=function(){window.removeEventListener("mousemove",this.showControlsBind),window.removeEventListener("mousedown",this.mouseDownBind),window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.removeEventListener("keydown",this.resetMouseScrollStateBind),window.removeEventListener("contextmenu",this.contextMenuBind),window.removeEventListener("touchstart",this.touchSwipeBind),window.removeEventListener("touchmove",this.touchSwipeBind),window.removeEventListener("touchend",this.touchSwipeBind),delete this.showControlsBind,delete this.mouseDownBind,delete this.mouseWheelBind,delete this.resetMouseScrollStateBind,delete this.contextMenuBind,delete this.touchSwipeBind},Yi=new WeakSet,Js=function(){document.fullscreenElement?xr(this,Ri,Ws).call(this):xr(this,Ni,zs).call(this)},ir=new WeakSet,Zs=function(){this.fullscreenChangeBind=xr(this,Yi,Js).bind(this),window.addEventListener("fullscreenchange",this.fullscreenChangeBind)},tr=new WeakSet,As=function(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind),delete this.fullscreenChangeBind},Ji)},(Ai,Si,Ei)=>{var Ci,Cs,xi,Es,Oi;Object.defineProperty(Si,"__esModule",{value:!0}),Si.PasswordPrompt=void 0;var wi=Ei(6);Si.PasswordPrompt=(Oi=class{constructor(ji,Li,Ii,Mi=!1){Er(this,Ci);Er(this,xi);this.overlayName=ji.overlayName,this.container=ji.container,this.label=ji.label,this.input=ji.input,this.submitButton=ji.submitButton,this.cancelButton=ji.cancelButton,this.overlayManager=Li,this.l10n=Ii,this._isViewerEmbedded=Mi,this.updateCallback=null,this.reason=null,this.submitButton.addEventListener("click",xr(this,Ci,Cs).bind(this)),this.cancelButton.addEventListener("click",xr(this,xi,Es).bind(this)),this.input.addEventListener("keydown",Fi=>{Fi.keyCode===13&&xr(this,Ci,Cs).call(this)}),this.overlayManager.register(this.overlayName,this.container,xr(this,xi,Es).bind(this),!0)}async open(){await this.overlayManager.open(this.overlayName);const ji=this.reason===wi.PasswordResponses.INCORRECT_PASSWORD;this._isViewerEmbedded&&!ji||this.input.focus(),this.label.textContent=await this.l10n.get("password_"+(ji?"invalid":"label"))}async close(){await this.overlayManager.close(this.overlayName),this.input.value=""}setUpdateCallback(ji,Li){this.updateCallback=ji,this.reason=Li}},Ci=new WeakSet,Cs=function(){const ji=this.input.value;(ji==null?void 0:ji.length)>0&&(this.close(),this.updateCallback(ji))},xi=new WeakSet,Es=function(){this.close(),this.updateCallback(new Error("PasswordPrompt cancelled."))},Oi)},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFOutlineViewer=void 0;var wi=Ei(35),Ci=Ei(6),ki=Ei(1);class xi extends wi.BaseTreeViewer{constructor(Oi){super(Oi),this.linkService=Oi.linkService,this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this)),this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this)),this.eventBus._on("pagechanging",ji=>{this._currentPageNumber=ji.pageNumber}),this.eventBus._on("pagesloaded",ji=>{this._isPagesLoaded=!!ji.pagesCount,this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded)}),this.eventBus._on("sidebarviewchanged",ji=>{this._sidebarView=ji.view})}reset(){super.reset(),this._outline=null,this._pageNumberToDestHashCapability=null,this._currentPageNumber=1,this._isPagesLoaded=null,this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(!1),this._currentOutlineItemCapability=null}_dispatchEvent(Oi){var ji;this._currentOutlineItemCapability=(0,Ci.createPromiseCapability)(),Oi===0||(ji=this._pdfDocument)!=null&&ji.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):this._isPagesLoaded!==null&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded),this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:Oi,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(Oi,{url:ji,newWindow:Li,dest:Ii}){const{linkService:Mi}=this;ji?Mi.addLinkAttributes(Oi,ji,Li):(Oi.href=Mi.getDestinationHash(Ii),Oi.onclick=Fi=>(this._updateCurrentTreeItem(Fi.target.parentNode),Ii&&Mi.goToDestination(Ii),!1))}_setStyles(Oi,{bold:ji,italic:Li}){ji&&(Oi.style.fontWeight="bold"),Li&&(Oi.style.fontStyle="italic")}_addToggleButton(Oi,{count:ji,items:Li}){let Ii=!1;if(ji<0){let Mi=Li.length;if(Mi>0){const Fi=[...Li];for(;Fi.length>0;){const{count:Bi,items:Ri}=Fi.shift();Bi>0&&Ri.length>0&&(Mi+=Ri.length,Fi.push(...Ri))}}Math.abs(ji)===Mi&&(Ii=!0)}super._addToggleButton(Oi,Ii)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render({outline:Oi,pdfDocument:ji}){if(this._outline&&this.reset(),this._outline=Oi||null,this._pdfDocument=ji||null,!Oi){this._dispatchEvent(0);return}const Li=document.createDocumentFragment(),Ii=[{parent:Li,items:Oi}];let Mi=0,Fi=!1;for(;Ii.length>0;){const Bi=Ii.shift();for(const Ri of Bi.items){const Vi=document.createElement("div");Vi.className="treeItem";const Ni=document.createElement("a");if(this._bindLink(Ni,Ri),this._setStyles(Ni,Ri),Ni.textContent=this._normalizeTextContent(Ri.title),Vi.appendChild(Ni),Ri.items.length>0){Fi=!0,this._addToggleButton(Vi,Ri);const Wi=document.createElement("div");Wi.className="treeItems",Vi.appendChild(Wi),Ii.push({parent:Wi,items:Ri.items})}Bi.parent.appendChild(Vi),Mi++}}this._finishRendering(Li,Mi,Fi)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const Oi=await this._getPageNumberToDestHash(this._pdfDocument);if(Oi&&(this._updateCurrentTreeItem(null),this._sidebarView===ki.SidebarView.OUTLINE))for(let ji=this._currentPageNumber;ji>0;ji--){const Li=Oi.get(ji);if(!Li)continue;const Ii=this.container.querySelector(`a[href="${Li}"]`);if(Ii){this._scrollToCurrentTreeItem(Ii.parentNode);break}}}async _getPageNumberToDestHash(Oi){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=(0,Ci.createPromiseCapability)();const ji=new Map,Li=new Map,Ii=[{nesting:0,items:this._outline}];for(;Ii.length>0;){const Mi=Ii.shift(),Fi=Mi.nesting;for(const{dest:Bi,items:Ri}of Mi.items){let Vi,Ni;if(typeof Bi=="string"){if(Vi=await Oi.getDestination(Bi),Oi!==this._pdfDocument)return null}else Vi=Bi;if(Array.isArray(Vi)){const[Wi]=Vi;if(typeof Wi=="object"&&Wi!==null){if(Ni=this.linkService._cachedPageNumber(Wi),!Ni)try{if(Ni=await Oi.getPageIndex(Wi)+1,Oi!==this._pdfDocument)return null;this.linkService.cachePageRef(Ni,Wi)}catch{}}else Number.isInteger(Wi)&&(Ni=Wi+1);if(Number.isInteger(Ni)&&(!ji.has(Ni)||Fi>Li.get(Ni))){const zi=this.linkService.getDestinationHash(Bi);ji.set(Ni,zi),Li.set(Ni,Fi)}}Ri.length>0&&Ii.push({nesting:Fi+1,items:Ri})}}return this._pageNumberToDestHashCapability.resolve(ji.size>0?ji:null),this._pageNumberToDestHashCapability.promise}}Si.PDFOutlineViewer=xi},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.BaseTreeViewer=void 0;var wi=Ei(1);const Ci="selected";class ki{constructor(Ti){if(this.constructor===ki)throw new Error("Cannot initialize BaseTreeViewer.");this.container=Ti.container,this.eventBus=Ti.eventBus,this.reset()}reset(){this._pdfDocument=null,this._lastToggleIsShow=!0,this._currentTreeItem=null,this.container.textContent="",this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(Ti){throw new Error("Not implemented: _dispatchEvent")}_bindLink(Ti,Oi){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(Ti){return(0,wi.removeNullCharacters)(Ti,!0)||"–"}_addToggleButton(Ti,Oi=!1){const ji=document.createElement("div");ji.className="treeItemToggler",Oi&&ji.classList.add("treeItemsHidden"),ji.onclick=Li=>{if(Li.stopPropagation(),ji.classList.toggle("treeItemsHidden"),Li.shiftKey){const Ii=!ji.classList.contains("treeItemsHidden");this._toggleTreeItem(Ti,Ii)}},Ti.insertBefore(ji,Ti.firstChild)}_toggleTreeItem(Ti,Oi=!1){this._lastToggleIsShow=Oi;for(const ji of Ti.querySelectorAll(".treeItemToggler"))ji.classList.toggle("treeItemsHidden",!Oi)}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(Ti,Oi,ji=!1){ji&&(this.container.classList.add("treeWithDeepNesting"),this._lastToggleIsShow=!Ti.querySelector(".treeItemsHidden")),this.container.appendChild(Ti),this._dispatchEvent(Oi)}render(Ti){throw new Error("Not implemented: render")}_updateCurrentTreeItem(Ti=null){this._currentTreeItem&&(this._currentTreeItem.classList.remove(Ci),this._currentTreeItem=null),Ti&&(Ti.classList.add(Ci),this._currentTreeItem=Ti)}_scrollToCurrentTreeItem(Ti){var ji;if(!Ti)return;let Oi=Ti.parentNode;for(;Oi&&Oi!==this.container;)Oi.classList.contains("treeItem")&&((ji=Oi.firstElementChild)==null||ji.classList.remove("treeItemsHidden")),Oi=Oi.parentNode;this._updateCurrentTreeItem(Ti),this.container.scrollTo(Ti.offsetLeft,Ti.offsetTop+-100)}}Si.BaseTreeViewer=ki},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFAttachmentViewer=void 0;var wi=Ei(6),Ci=Ei(35);class ki extends Ci.BaseTreeViewer{constructor(Ti){super(Ti),this.downloadManager=Ti.downloadManager,this.eventBus._on("fileattachmentannotation",this._appendAttachment.bind(this))}reset(Ti=!1){super.reset(),this._attachments=null,Ti||(this._renderedCapability=(0,wi.createPromiseCapability)()),this._pendingDispatchEvent&&clearTimeout(this._pendingDispatchEvent),this._pendingDispatchEvent=null}_dispatchEvent(Ti){this._renderedCapability.resolve(),this._pendingDispatchEvent&&(clearTimeout(this._pendingDispatchEvent),this._pendingDispatchEvent=null),Ti!==0?this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:Ti}):this._pendingDispatchEvent=setTimeout(()=>{this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:0}),this._pendingDispatchEvent=null})}_bindLink(Ti,{content:Oi,filename:ji}){Ti.onclick=()=>(this.downloadManager.openOrDownloadData(Ti,Oi,ji),!1)}render({attachments:Ti,keepRenderedCapability:Oi=!1}){if(this._attachments&&this.reset(Oi),this._attachments=Ti||null,!Ti){this._dispatchEvent(0);return}const ji=Object.keys(Ti).sort(function(Mi,Fi){return Mi.toLowerCase().localeCompare(Fi.toLowerCase())}),Li=document.createDocumentFragment();let Ii=0;for(const Mi of ji){const Fi=Ti[Mi],Bi=Fi.content,Ri=(0,wi.getFilenameFromUrl)(Fi.filename),Vi=document.createElement("div");Vi.className="treeItem";const Ni=document.createElement("a");this._bindLink(Ni,{content:Bi,filename:Ri}),Ni.textContent=this._normalizeTextContent(Ri),Vi.appendChild(Ni),Li.appendChild(Vi),Ii++}this._finishRendering(Li,Ii)}_appendAttachment({id:Ti,filename:Oi,content:ji}){const Li=this._renderedCapability.promise;Li.then(()=>{if(Li!==this._renderedCapability.promise)return;let Ii=this._attachments;if(Ii){for(const Mi in Ii)if(Ti===Mi)return}else Ii=Object.create(null);Ii[Ti]={filename:Oi,content:ji},this.render({attachments:Ii,keepRenderedCapability:!0})})}}Si.PDFAttachmentViewer=ki},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFLayerViewer=void 0;var wi=Ei(35);class Ci extends wi.BaseTreeViewer{constructor(xi){super(xi),this.l10n=xi.l10n,this.eventBus._on("resetlayers",this._resetLayers.bind(this)),this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset(),this._optionalContentConfig=null}_dispatchEvent(xi){this.eventBus.dispatch("layersloaded",{source:this,layersCount:xi})}_bindLink(xi,{groupId:Ti,input:Oi}){const ji=()=>{this._optionalContentConfig.setVisibility(Ti,Oi.checked),this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};xi.onclick=Li=>Li.target===Oi?(ji(),!0):Li.target!==xi?!0:(Oi.checked=!Oi.checked,ji(),!1)}async _setNestedName(xi,{name:Ti=null}){typeof Ti!="string"?(xi.textContent=await this.l10n.get("additional_layers"),xi.style.fontStyle="italic"):xi.textContent=this._normalizeTextContent(Ti)}_addToggleButton(xi,{name:Ti=null}){super._addToggleButton(xi,Ti===null)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render({optionalContentConfig:xi,pdfDocument:Ti}){this._optionalContentConfig&&this.reset(),this._optionalContentConfig=xi||null,this._pdfDocument=Ti||null;const Oi=xi==null?void 0:xi.getOrder();if(!Oi){this._dispatchEvent(0);return}const ji=document.createDocumentFragment(),Li=[{parent:ji,groups:Oi}];let Ii=0,Mi=!1;for(;Li.length>0;){const Fi=Li.shift();for(const Bi of Fi.groups){const Ri=document.createElement("div");Ri.className="treeItem";const Vi=document.createElement("a");if(Ri.appendChild(Vi),typeof Bi=="object"){Mi=!0,this._addToggleButton(Ri,Bi),this._setNestedName(Vi,Bi);const Ni=document.createElement("div");Ni.className="treeItems",Ri.appendChild(Ni),Li.push({parent:Ni,groups:Bi.order})}else{const Ni=xi.getGroup(Bi),Wi=document.createElement("input");this._bindLink(Vi,{groupId:Bi,input:Wi}),Wi.type="checkbox",Wi.id=Bi,Wi.checked=Ni.visible;const zi=document.createElement("label");zi.setAttribute("for",Bi),zi.textContent=this._normalizeTextContent(Ni.name),Vi.appendChild(Wi),Vi.appendChild(zi),Ii++}Fi.parent.appendChild(Ri)}}this._finishRendering(ji,Ii,Mi)}async _resetLayers(){if(!this._optionalContentConfig)return;const xi=await this._pdfDocument.getOptionalContentConfig();this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(xi)}),this.render({optionalContentConfig:xi,pdfDocument:this._pdfDocument})}}Si.PDFLayerViewer=Ci},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFSidebar=void 0;var wi=Ei(1);const Ci="pdfSidebarNotification";Si.PDFSidebar=class{constructor({elements:ki,pdfViewer:xi,pdfThumbnailViewer:Ti,eventBus:Oi,l10n:ji}){this.isOpen=!1,this.active=wi.SidebarView.THUMBS,this.isInitialViewSet=!1,this.onToggled=null,this.pdfViewer=xi,this.pdfThumbnailViewer=Ti,this.outerContainer=ki.outerContainer,this.viewerContainer=ki.viewerContainer,this.toggleButton=ki.toggleButton,this.thumbnailButton=ki.thumbnailButton,this.outlineButton=ki.outlineButton,this.attachmentsButton=ki.attachmentsButton,this.layersButton=ki.layersButton,this.thumbnailView=ki.thumbnailView,this.outlineView=ki.outlineView,this.attachmentsView=ki.attachmentsView,this.layersView=ki.layersView,this._outlineOptionsContainer=ki.outlineOptionsContainer,this._currentOutlineItemButton=ki.currentOutlineItemButton,this.eventBus=Oi,this.l10n=ji,this._addEventListeners()}reset(){this.isInitialViewSet=!1,this._hideUINotification(!0),this.switchView(wi.SidebarView.THUMBS),this.outlineButton.disabled=!1,this.attachmentsButton.disabled=!1,this.layersButton.disabled=!1,this._currentOutlineItemButton.disabled=!0}get visibleView(){return this.isOpen?this.active:wi.SidebarView.NONE}get isThumbnailViewVisible(){return this.isOpen&&this.active===wi.SidebarView.THUMBS}get isOutlineViewVisible(){return this.isOpen&&this.active===wi.SidebarView.OUTLINE}get isAttachmentsViewVisible(){return this.isOpen&&this.active===wi.SidebarView.ATTACHMENTS}get isLayersViewVisible(){return this.isOpen&&this.active===wi.SidebarView.LAYERS}setInitialView(ki=wi.SidebarView.NONE){this.isInitialViewSet||(this.isInitialViewSet=!0,ki!==wi.SidebarView.NONE&&ki!==wi.SidebarView.UNKNOWN&&this._switchView(ki,!0)||this._dispatchEvent())}switchView(ki,xi=!1){this._switchView(ki,xi)}_switchView(ki,xi=!1){const Ti=ki!==this.active;let Oi=!1;switch(ki){case wi.SidebarView.NONE:return this.isOpen?(this.close(),!0):!1;case wi.SidebarView.THUMBS:this.isOpen&&Ti&&(Oi=!0);break;case wi.SidebarView.OUTLINE:if(this.outlineButton.disabled)return!1;break;case wi.SidebarView.ATTACHMENTS:if(this.attachmentsButton.disabled)return!1;break;case wi.SidebarView.LAYERS:if(this.layersButton.disabled)return!1;break;default:return!1}return this.active=ki,this.thumbnailButton.classList.toggle("toggled",ki===wi.SidebarView.THUMBS),this.outlineButton.classList.toggle("toggled",ki===wi.SidebarView.OUTLINE),this.attachmentsButton.classList.toggle("toggled",ki===wi.SidebarView.ATTACHMENTS),this.layersButton.classList.toggle("toggled",ki===wi.SidebarView.LAYERS),this.thumbnailView.classList.toggle("hidden",ki!==wi.SidebarView.THUMBS),this.outlineView.classList.toggle("hidden",ki!==wi.SidebarView.OUTLINE),this.attachmentsView.classList.toggle("hidden",ki!==wi.SidebarView.ATTACHMENTS),this.layersView.classList.toggle("hidden",ki!==wi.SidebarView.LAYERS),this._outlineOptionsContainer.classList.toggle("hidden",ki!==wi.SidebarView.OUTLINE),xi&&!this.isOpen?(this.open(),!0):(Oi&&(this._updateThumbnailViewer(),this._forceRendering()),Ti&&this._dispatchEvent(),Ti)}open(){this.isOpen||(this.isOpen=!0,this.toggleButton.classList.add("toggled"),this.toggleButton.setAttribute("aria-expanded","true"),this.outerContainer.classList.add("sidebarMoving","sidebarOpen"),this.active===wi.SidebarView.THUMBS&&this._updateThumbnailViewer(),this._forceRendering(),this._dispatchEvent(),this._hideUINotification())}close(){this.isOpen&&(this.isOpen=!1,this.toggleButton.classList.remove("toggled"),this.toggleButton.setAttribute("aria-expanded","false"),this.outerContainer.classList.add("sidebarMoving"),this.outerContainer.classList.remove("sidebarOpen"),this._forceRendering(),this._dispatchEvent())}toggle(){this.isOpen?this.close():this.open()}_dispatchEvent(){this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}_forceRendering(){this.onToggled?this.onToggled():(this.pdfViewer.forceRendering(),this.pdfThumbnailViewer.forceRendering())}_updateThumbnailViewer(){const{pdfViewer:ki,pdfThumbnailViewer:xi}=this,Ti=ki.pagesCount;for(let Oi=0;Oi{this.toggleButton.title=ki}),this.isOpen||this.toggleButton.classList.add(Ci)}_hideUINotification(ki=!1){(this.isOpen||ki)&&this.toggleButton.classList.remove(Ci),ki&&this.l10n.get("toggle_sidebar.title").then(xi=>{this.toggleButton.title=xi})}_addEventListeners(){this.viewerContainer.addEventListener("transitionend",xi=>{xi.target===this.viewerContainer&&this.outerContainer.classList.remove("sidebarMoving")}),this.toggleButton.addEventListener("click",()=>{this.toggle()}),this.thumbnailButton.addEventListener("click",()=>{this.switchView(wi.SidebarView.THUMBS)}),this.outlineButton.addEventListener("click",()=>{this.switchView(wi.SidebarView.OUTLINE)}),this.outlineButton.addEventListener("dblclick",()=>{this.eventBus.dispatch("toggleoutlinetree",{source:this})}),this.attachmentsButton.addEventListener("click",()=>{this.switchView(wi.SidebarView.ATTACHMENTS)}),this.layersButton.addEventListener("click",()=>{this.switchView(wi.SidebarView.LAYERS)}),this.layersButton.addEventListener("dblclick",()=>{this.eventBus.dispatch("resetlayers",{source:this})}),this._currentOutlineItemButton.addEventListener("click",()=>{this.eventBus.dispatch("currentoutlineitem",{source:this})});const ki=(xi,Ti,Oi)=>{Ti.disabled=!xi,xi?this._showUINotification():this.active===Oi&&this.switchView(wi.SidebarView.THUMBS)};this.eventBus._on("outlineloaded",xi=>{ki(xi.outlineCount,this.outlineButton,wi.SidebarView.OUTLINE),xi.currentOutlineItemPromise.then(Ti=>{this.isInitialViewSet&&(this._currentOutlineItemButton.disabled=!Ti)})}),this.eventBus._on("attachmentsloaded",xi=>{ki(xi.attachmentsCount,this.attachmentsButton,wi.SidebarView.ATTACHMENTS)}),this.eventBus._on("layersloaded",xi=>{ki(xi.layersCount,this.layersButton,wi.SidebarView.LAYERS)}),this.eventBus._on("presentationmodechanged",xi=>{xi.state===wi.PresentationModeState.NORMAL&&this.isThumbnailViewVisible&&this._updateThumbnailViewer()})}}},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFSidebarResizer=void 0;const Ei="sidebarResizing";Si.PDFSidebarResizer=class{constructor(wi,Ci,ki){this.isRTL=!1,this.sidebarOpen=!1,this.doc=document.documentElement,this._width=null,this._outerContainerWidth=null,this._boundEvents=Object.create(null),this.outerContainer=wi.outerContainer,this.resizer=wi.resizer,this.eventBus=Ci,ki.getDirection().then(xi=>{this.isRTL=xi==="rtl"}),this._addEventListeners()}get outerContainerWidth(){return this._outerContainerWidth||(this._outerContainerWidth=this.outerContainer.clientWidth)}_updateWidth(wi=0){const Ci=Math.floor(this.outerContainerWidth/2);return wi>Ci&&(wi=Ci),wi<200&&(wi=200),wi===this._width?!1:(this._width=wi,this.doc.style.setProperty("--sidebar-width",`${wi}px`),!0)}_mouseMove(wi){let Ci=wi.clientX;this.isRTL&&(Ci=this.outerContainerWidth-Ci),this._updateWidth(Ci)}_mouseUp(wi){this.outerContainer.classList.remove(Ei),this.eventBus.dispatch("resize",{source:this});const Ci=this._boundEvents;window.removeEventListener("mousemove",Ci.mouseMove),window.removeEventListener("mouseup",Ci.mouseUp)}_addEventListeners(){const wi=this._boundEvents;wi.mouseMove=this._mouseMove.bind(this),wi.mouseUp=this._mouseUp.bind(this),this.resizer.addEventListener("mousedown",Ci=>{Ci.button===0&&(this.outerContainer.classList.add(Ei),window.addEventListener("mousemove",wi.mouseMove),window.addEventListener("mouseup",wi.mouseUp))}),this.eventBus._on("sidebarviewchanged",Ci=>{this.sidebarOpen=!!(Ci!=null&&Ci.view)}),this.eventBus._on("resize",Ci=>{if((Ci==null?void 0:Ci.source)!==window||(this._outerContainerWidth=null,!this._width))return;if(!this.sidebarOpen){this._updateWidth(this._width);return}this.outerContainer.classList.add(Ei);const ki=this._updateWidth(this._width);Promise.resolve().then(()=>{this.outerContainer.classList.remove(Ei),ki&&this.eventBus.dispatch("resize",{source:this})})})}}},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.ViewHistory=void 0,Si.ViewHistory=class{constructor(Ei,wi=20){this.fingerprint=Ei,this.cacheSize=wi,this._initializedPromise=this._readFromStorage().then(Ci=>{const ki=JSON.parse(Ci||"{}");let xi=-1;if(Array.isArray(ki.files)){for(;ki.files.length>=this.cacheSize;)ki.files.shift();for(let Ti=0,Oi=ki.files.length;Ti{Object.defineProperty(Si,"__esModule",{value:!0}),Si.DefaultExternalServices=void 0;var wi=Ei(6);Si.DefaultExternalServices=class{constructor(){throw new Error("Cannot initialize DefaultExternalServices.")}static updateFindControlState(Ci){}static updateFindMatchesCount(Ci){}static initPassiveLoading(Ci){}static async fallback(Ci){}static reportTelemetry(Ci){}static createDownloadManager(Ci){throw new Error("Not implemented: createDownloadManager")}static createPreferences(){throw new Error("Not implemented: createPreferences")}static createL10n(Ci){throw new Error("Not implemented: createL10n")}static createScripting(Ci){throw new Error("Not implemented: createScripting")}static get supportsIntegratedFind(){return(0,wi.shadow)(this,"supportsIntegratedFind",!1)}static get supportsDocumentFonts(){return(0,wi.shadow)(this,"supportsDocumentFonts",!0)}static get supportedMouseWheelZoomModifierKeys(){return(0,wi.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}static get isInAutomation(){return(0,wi.shadow)(this,"isInAutomation",!1)}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.bindPrintServiceFactory=Si.bindExternalService=void 0;let wi,Ci;Si.bindPrintServiceFactory=wi,Si.bindExternalService=Ci,Si.bindExternalService=Ci=Ei(43).bindExternalService,Si.bindPrintServiceFactory=wi=Ei(49).bindPrintServiceFactory,document.blockUnblockOnload&&document.blockUnblockOnload(!0)},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.GenericCom=void 0,Si.bindExternalService=function(Li){Li.externalServices=ji};var wi=Ei(41),Ci=Ei(44),ki=Ei(45),xi=Ei(46),Ti=Ei(48);Si.GenericCom={};class Oi extends Ci.BasePreferences{async _writeToStorage(Ii){localStorage.setItem("pdfjs.preferences",JSON.stringify(Ii))}async _readFromStorage(Ii){return JSON.parse(localStorage.getItem("pdfjs.preferences"))}}class ji extends wi.DefaultExternalServices{static createDownloadManager(Ii){return new ki.DownloadManager}static createPreferences(){return new Oi}static createL10n({locale:Ii="en-US"}){return new xi.GenericL10n(Ii)}static createScripting({sandboxBundleSrc:Ii}){return new Ti.GenericScripting(Ii)}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.BasePreferences=void 0,Ei(3);class wi{constructor(){if(this.constructor===wi)throw new Error("Cannot initialize BasePreferences.");Object.defineProperty(this,"defaults",{value:Object.freeze({annotationMode:2,cursorToolOnLoad:0,defaultZoomValue:"",disablePageLabels:!1,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!0,externalLinkTarget:0,historyUpdateUrl:!1,ignoreDestinationZoom:!1,pdfBugEnabled:!1,renderer:"canvas",sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,useOnlyCssZoom:!1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableXfa:!0}),writable:!1,enumerable:!0,configurable:!1}),this.prefs=Object.create(null),this._initializedPromise=this._readFromStorage(this.defaults).then(ki=>{for(const xi in this.defaults){const Ti=ki==null?void 0:ki[xi];typeof Ti==typeof this.defaults[xi]&&(this.prefs[xi]=Ti)}})}async _writeToStorage(ki){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(ki){throw new Error("Not implemented: _readFromStorage")}async reset(){return await this._initializedPromise,this.prefs=Object.create(null),this._writeToStorage(this.defaults)}async set(ki,xi){await this._initializedPromise;const Ti=this.defaults[ki];if(Ti===void 0)throw new Error(`Set preference: "${ki}" is undefined.`);if(xi===void 0)throw new Error("Set preference: no value is specified.");const Oi=typeof xi,ji=typeof Ti;if(Oi!==ji){if(Oi!=="number"||ji!=="string")throw new Error(`Set preference: "${xi}" is a ${Oi}, expected a ${ji}.`);xi=xi.toString()}else if(Oi==="number"&&!Number.isInteger(xi))throw new Error(`Set preference: "${xi}" must be an integer.`);return this.prefs[ki]=xi,this._writeToStorage(this.prefs)}async get(ki){await this._initializedPromise;const xi=this.defaults[ki],Ti=this.prefs[ki];if(xi===void 0)throw new Error(`Get preference: "${ki}" is undefined.`);return Ti!==void 0?Ti:xi}async getAll(){await this._initializedPromise;const ki=Object.create(null);for(const xi in this.defaults){const Ti=this.prefs[xi];ki[xi]=Ti!==void 0?Ti:this.defaults[xi]}return ki}}Si.BasePreferences=wi},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.DownloadManager=void 0;var wi=Ei(6);function Ci(ki,xi){const Ti=document.createElement("a");if(!Ti.click)throw new Error('DownloadManager: "a.click()" is not supported.');Ti.href=ki,Ti.target="_parent","download"in Ti&&(Ti.download=xi),(document.body||document.documentElement).appendChild(Ti),Ti.click(),Ti.remove()}Si.DownloadManager=class{constructor(){this._openBlobUrls=new WeakMap}downloadUrl(ki,xi){(0,wi.createValidAbsoluteUrl)(ki,"http://example.com")&&Ci(ki+"#pdfjs.action=download",xi)}downloadData(ki,xi,Ti){Ci(URL.createObjectURL(new Blob([ki],{type:Ti})),xi)}openOrDownloadData(ki,xi,Ti){const Oi=(0,wi.isPdfFile)(Ti),ji=Oi?"application/pdf":"";if(Oi){let Li,Ii=this._openBlobUrls.get(ki);Ii||(Ii=URL.createObjectURL(new Blob([xi],{type:ji})),this._openBlobUrls.set(ki,Ii)),Li="?file="+encodeURIComponent(Ii+"#"+Ti);try{return window.open(Li),!0}catch{URL.revokeObjectURL(Ii),this._openBlobUrls.delete(ki)}}return this.downloadData(xi,Ti,ji),!1}download(ki,xi,Ti,Oi="download"){Ci(URL.createObjectURL(ki),Ti)}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.GenericL10n=void 0,Ei(47);var wi=Ei(18);const Ci=document.webL10n;Si.GenericL10n=class{constructor(ki){this._lang=ki,this._ready=new Promise((xi,Ti)=>{Ci.setLanguage((0,wi.fixupLangCode)(ki),()=>{xi(Ci)})})}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(ki,xi=null,Ti=(0,wi.getL10nFallback)(ki,xi)){return(await this._ready).get(ki,xi,Ti)}async translate(ki){return(await this._ready).translate(ki)}}},()=>{document.webL10n=function(Ai,Si,Ei){var wi={},Ci="",ki="textContent",xi="",Ti={},Oi="loading";function ji(Vi,Ni,Wi){Ni=Ni||function(Di){},Wi=Wi||function(){};var zi=new XMLHttpRequest;zi.open("GET",Vi,!0),zi.overrideMimeType&&zi.overrideMimeType("text/plain; charset=utf-8"),zi.onreadystatechange=function(){zi.readyState==4&&(zi.status==200||zi.status===0?Ni(zi.responseText):Wi())},zi.onerror=Wi,zi.ontimeout=Wi;try{zi.send(null)}catch{Wi()}}function Li(Vi,Ni,Wi,zi){var Di=Vi.replace(/[^\/]*$/,"")||"./";function Ui(Hi){return Hi.lastIndexOf("\\")<0?Hi:Hi.replace(/\\\\/g,"\\").replace(/\\n/g,` `).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}ji(Vi,function(Hi){Ci+=Hi,function(qi,Gi){var Ki={},Qi=/^\s*|\s*$/,Xi=/^\s*#|^\s*$/,rr=/^\s*\[(.*)\]\s*$/,ar=/^\s*@import\s+url\((.*)\)\s*$/i,gr=/^([^=\s]*)\s*=\s*(.+)$/;function fr(mr,vr,Yi){var nr=mr.replace(Qi,"").split(/[\r\n]+/),ir="*",cr=Ni.split("-",1)[0],tr=!1,dr="";(function Ji(){for(;;){if(!nr.length){Yi();return}var sr=nr.shift();if(!Xi.test(sr)){if(vr){if(dr=rr.exec(sr)){ir=dr[1].toLowerCase(),tr=ir!=="*"&&ir!==Ni&&ir!==cr;continue}if(tr)continue;if(dr=ar.exec(sr)){lr(Di+dr[1],Ji);return}}var pr=sr.match(gr);pr&&pr.length==3&&(Ki[pr[1]]=Ui(pr[2]))}}})()}function lr(mr,vr){ji(mr,function(Yi){fr(Yi,!1,vr)},function(){vr()})}fr(qi,!0,function(){Gi(Ki)})}(Hi,function(qi){for(var Gi in qi){var Ki,Qi,Xi=Gi.lastIndexOf(".");Xi>0?(Ki=Gi.substring(0,Xi),Qi=Gi.substring(Xi+1)):(Ki=Gi,Qi=ki),wi[Ki]||(wi[Ki]={}),wi[Ki][Qi]=qi[Gi]}Wi&&Wi()})},zi)}function Ii(Vi,Ni){Vi&&(Vi=Vi.toLowerCase()),Ni=Ni||function(){},function(){wi={},Ci="",xi=""}(),xi=Vi;var Wi=Si.querySelectorAll('link[type="application/l10n"]'),zi=Wi.length;if(zi!==0){var Di,Ui,Hi=0;Ui=function(){++Hi>=zi&&(Ni(),Oi="complete")};for(var qi=0;qi0&&(Ui=Vi.substring(Di+1),Vi=Vi.substring(0,Di)),Wi&&((zi={})[Ui]=Wi);var Hi=Mi(Vi,Ni,zi);return Hi&&Ui in Hi?Hi[Ui]:"{{"+Vi+"}}"},getData:function(){return wi},getText:function(){return Ci},getLanguage:function(){return xi},setLanguage:function(Vi,Ni){Ii(Vi,function(){Ni&&Ni()})},getDirection:function(){var Vi=xi.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(Vi)>=0?"rtl":"ltr"},translate:function(Vi){for(var Ni=function(Di){return Di?Di.querySelectorAll("*[data-l10n-id]"):[]}(Vi=Vi||Si.documentElement),Wi=Ni.length,zi=0;zi{Object.defineProperty(Si,"__esModule",{value:!0}),Si.GenericScripting=void 0,Si.docPropertiesLookup=async function(Ci){const ki="".split("#")[0];let{info:xi,metadata:Ti,contentDispositionFilename:Oi,contentLength:ji}=await Ci.getMetadata();if(!ji){const{length:Li}=await Ci.getDownloadInfo();ji=Li}return{...xi,baseURL:ki,filesize:ji,filename:Oi||(0,wi.getPdfFilenameFromUrl)(""),metadata:Ti==null?void 0:Ti.getRaw(),authors:Ti==null?void 0:Ti.get("dc:creator"),numPages:Ci.numPages,URL:""}};var wi=Ei(6);Si.GenericScripting=class{constructor(Ci){this._ready=(0,wi.loadScript)(Ci,!0,!0).then(()=>window.pdfjsSandbox.QuickJSSandbox())}async createSandbox(Ci){(await this._ready).create(Ci)}async dispatchEventInSandbox(Ci){const ki=await this._ready;setTimeout(()=>ki.dispatchEvent(Ci),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.PDFPrintService=ji,Si.bindPrintServiceFactory=function(Vi){Vi.instance={supportsPrinting:!0,createPrintService(Ni,Wi,zi,Di,Ui,Hi,qi){if(Ti)throw new Error("The print service is created and active.");return Ti=new ji(Ni,Wi,zi,Di,Ui,Hi,qi),Ti}}};var wi=Ei(6),Ci=Ei(3),ki=Ei(50),xi=Ei(4);let Ti=null,Oi=null;function ji(Vi,Ni,Wi,zi,Di=null,Ui,Hi){this.pdfDocument=Vi,this.pagesOverview=Ni,this.printContainer=Wi,this.printServiceOverlay=Hi,this._printResolution=zi||150,this._optionalContentConfigPromise=Di||Vi.getOptionalContentConfig(),this.l10n=Ui,this.currentPage=-1,this.scratchCanvas=document.createElement("canvas")}ji.prototype={layout(){this.throwIfInactive();const Vi=document.querySelector("body");Vi.setAttribute("data-pdfjsprinting",!0),this.pagesOverview.every(function(Wi){return Wi.width===this.pagesOverview[0].width&&Wi.height===this.pagesOverview[0].height},this),this.pageStyleSheet=document.createElement("style");const Ni=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+Ni.width+"pt "+Ni.height+"pt;}",Vi.appendChild(this.pageStyleSheet)},destroy(){Ti===this&&(this.printContainer.textContent="",document.querySelector("body").removeAttribute("data-pdfjsprinting"),this.pageStyleSheet&&(this.pageStyleSheet.remove(),this.pageStyleSheet=null),this.scratchCanvas.width=this.scratchCanvas.height=0,this.scratchCanvas=null,Ti=null,Ri().then(function(){Oi.active==="printServiceOverlay"&&Oi.close("printServiceOverlay")}))},renderPages(){if(this.pdfDocument.isPureXfa)return(0,ki.getXfaHtmlForPrinting)(this.printContainer,this.pdfDocument),Promise.resolve();const Vi=this.pagesOverview.length,Ni=(Wi,zi)=>{if(this.throwIfInactive(),++this.currentPage>=Vi){Fi(Vi,Vi,this.l10n,this.printServiceOverlay),Wi();return}const Di=this.currentPage;Fi(Di,Vi,this.l10n,this.printServiceOverlay),function(Ui,Hi,qi,Gi,Ki,Qi){const Xi=Ti.scratchCanvas,rr=Ki/wi.PixelsPerInch.PDF;Xi.width=Math.floor(Gi.width*rr),Xi.height=Math.floor(Gi.height*rr);const ar=Xi.getContext("2d");return ar.save(),ar.fillStyle="rgb(255, 255, 255)",ar.fillRect(0,0,Xi.width,Xi.height),ar.restore(),Hi.getPage(qi).then(function(gr){const fr={canvasContext:ar,transform:[rr,0,0,rr,0,0],viewport:gr.getViewport({scale:1,rotation:Gi.rotation}),intent:"print",annotationMode:wi.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:Qi};return gr.render(fr).promise})}(0,this.pdfDocument,Di+1,this.pagesOverview[Di],this._printResolution,this._optionalContentConfigPromise).then(this.useRenderedPage.bind(this)).then(function(){Ni(Wi,zi)},zi)};return new Promise(Ni)},useRenderedPage(){this.throwIfInactive();const Vi=document.createElement("img"),Ni=this.scratchCanvas;"toBlob"in Ni&&!Ci.compatibilityParams.disableCreateObjectURL?Ni.toBlob(function(zi){Vi.src=URL.createObjectURL(zi)}):Vi.src=Ni.toDataURL();const Wi=document.createElement("div");return Wi.className="printedPage",Wi.appendChild(Vi),this.printContainer.appendChild(Wi),new Promise(function(zi,Di){Vi.onload=zi,Vi.onerror=Di})},performPrint(){return this.throwIfInactive(),new Promise(Vi=>{setTimeout(()=>{this.active?(Li.call(window),setTimeout(Vi,20)):Vi()},0)})},get active(){return this===Ti},throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};const Li=window.print;window.print=function(){if(!Ti){Ri().then(function(){Ti&&Oi.open("printServiceOverlay")});try{Ii("beforeprint")}finally{if(!Ti){Ri().then(function(){Oi.active==="printServiceOverlay"&&Oi.close("printServiceOverlay")});return}const Vi=Ti;Ti.renderPages().then(function(){return Vi.performPrint()}).catch(function(){}).then(function(){Vi.active&&Mi()})}}};function Ii(Vi){const Ni=document.createEvent("CustomEvent");Ni.initCustomEvent(Vi,!1,!1,"custom"),window.dispatchEvent(Ni)}function Mi(){Ti&&(Ti.destroy(),Ii("afterprint"))}function Fi(Vi,Ni,Wi,zi){const Di=Math.round(100*Vi/Ni),Ui=zi.querySelector("progress"),Hi=zi.querySelector(".relative-progress");Ui.value=Di,Wi.get("print_progress_percent",{progress:Di}).then(qi=>{Hi.textContent=qi})}if(window.addEventListener("keydown",function(Vi){Vi.keyCode===80&&(Vi.ctrlKey||Vi.metaKey)&&!Vi.altKey&&(!Vi.shiftKey||window.chrome||window.opera)&&(window.print(),Vi.preventDefault(),Vi.stopImmediatePropagation?Vi.stopImmediatePropagation():Vi.stopPropagation())},!0),"onbeforeprint"in window){const Vi=function(Ni){Ni.detail!=="custom"&&Ni.stopImmediatePropagation&&Ni.stopImmediatePropagation()};window.addEventListener("beforeprint",Vi),window.addEventListener("afterprint",Vi)}let Bi;function Ri(){if(!Bi){const Vi=(0,xi.getActiveApp)(),Ni=Vi.appConfig.printServiceOverlay;if(Oi=Vi.overlayManager,!Oi)throw new Error("The overlay manager has not yet been initialized.");Bi=Oi.register("printServiceOverlay",Ni,Mi,!0),Ni.querySelector("[data-id='printCancel']").onclick=Mi}return Bi}},(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.getXfaHtmlForPrinting=function(xi,Ti){const Oi=Ti.allXfaHtml,ji=new Ci.SimpleLinkService,Li=Math.round(100*wi.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const Ii of Oi.children){const Mi=document.createElement("div");Mi.className="xfaPrintedPage",xi.appendChild(Mi);const Fi=new ki.XfaLayerBuilder({pageDiv:Mi,pdfPage:null,annotationStorage:Ti.annotationStorage,linkService:ji,xfaHtml:Ii}),Bi=(0,wi.getXfaPageViewport)(Ii,{scale:Li});Fi.render(Bi,"print")}};var wi=Ei(6),Ci=Ei(7),ki=Ei(24)},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.default=void 0,Si.default=` Thumbnails Document Outline Attachments Layers Current Outline Item Previous Next Highlight All Match Case Match Diacritics Whole Words Presentation Mode Open Print Download Current View Go to First Page Go to Last Page Rotate Clockwise Rotate Counterclockwise Text Selection Tool Hand Tool Page Scrolling Vertical Scrolling Horizontal Scrolling Wrapped Scrolling No Spreads Odd Spreads Even Spreads Document Properties… Toggle Sidebar Presentation Mode Open Print Download Current View Tools Previous Next Zoom Out 50% 75% 100% 125% 150% 200% Zoom In Find More Information Less Information Close Enter the password to open this PDF file: Cancel OK File name: - File size: - Title: - Author: - Subject: - Keywords: - Creation Date: - Modification Date: - Creator: - PDF Producer: - PDF Version: - Page Count: - Page Size: - Fast Web View: - Close Preparing document for printing… 0% Cancel `}],_i={};function $i(Ai){var Si=_i[Ai];if(Si!==void 0)return Si.exports;var Ei=_i[Ai]={exports:{}};return bi[Ai](Ei,Ei.exports,$i),Ei.exports}var Pi={};return(()=>{var Ai=Pi;Object.defineProperty(Ai,"__esModule",{value:!0}),Object.defineProperty(Ai,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return Ti.AnnotationLayerBuilder}}),Object.defineProperty(Ai,"EventBus",{enumerable:!0,get:function(){return wi.EventBus}}),Object.defineProperty(Ai,"GlobalAppOptions",{enumerable:!0,get:function(){return Ci.AppOptions}}),Object.defineProperty(Ai,"MAX_SCALE",{enumerable:!0,get:function(){return Ei.MAX_SCALE}}),Object.defineProperty(Ai,"MIN_SCALE",{enumerable:!0,get:function(){return Ei.MIN_SCALE}}),Object.defineProperty(Ai,"NullL10n",{enumerable:!0,get:function(){return ji.NullL10n}}),Object.defineProperty(Ai,"PDFViewer",{enumerable:!0,get:function(){return xi.PDFViewer}}),Object.defineProperty(Ai,"ViewerApplication",{enumerable:!0,get:function(){return Oi.ViewerApplication}}),Ai.appManager=void 0,Ai.getViewerConfiguration=function(Mi){let Fi=null;const Bi=Mi.querySelector("[data-id='outerContainer']");return Fi={container:Bi.querySelector("[data-id='errorWrapper']"),errorMessage:Bi.querySelector("[data-id='errorMessage']"),closeButton:Bi.querySelector("[data-id='errorClose']"),errorMoreInfo:Bi.querySelector("[data-id='errorMoreInfo']"),moreInfoButton:Bi.querySelector("[data-id='errorShowMore']"),lessInfoButton:Bi.querySelector("[data-id='errorShowLess']")},{appContainer:Mi,mainContainer:Bi.querySelector("[data-id='viewerContainer']"),viewerContainer:Bi.querySelector("[data-id='viewer']"),toolbar:{container:Bi.querySelector("[data-id='toolbarViewer']"),numPages:Bi.querySelector("[data-id='numPages']"),pageNumber:Bi.querySelector("[data-id='pageNumber']"),scaleSelect:Bi.querySelector("[data-id='scaleSelect']"),customScaleOption:Bi.querySelector("[data-id='customScaleOption']"),previous:Bi.querySelector("[data-id='previous']"),next:Bi.querySelector("[data-id='next']"),zoomIn:Bi.querySelector("[data-id='zoomIn']"),zoomOut:Bi.querySelector("[data-id='zoomOut']"),viewFind:Bi.querySelector("[data-id='viewFind']"),openFile:Bi.querySelector("[data-id='openFile']"),print:Bi.querySelector("[data-id='print']"),presentationModeButton:Bi.querySelector("[data-id='presentationMode']"),download:Bi.querySelector("[data-id='download']"),viewBookmark:Bi.querySelector("[data-id='viewBookmark']")},secondaryToolbar:{toolbar:Bi.querySelector("[data-id='secondaryToolbar']"),toggleButton:Bi.querySelector("[data-id='secondaryToolbarToggle']"),toolbarButtonContainer:Bi.querySelector("[data-id='secondaryToolbarButtonContainer']"),presentationModeButton:Bi.querySelector("[data-id='secondaryPresentationMode']"),openFileButton:Bi.querySelector("[data-id='secondaryOpenFile']"),printButton:Bi.querySelector("[data-id='secondaryPrint']"),downloadButton:Bi.querySelector("[data-id='secondaryDownload']"),viewBookmarkButton:Bi.querySelector("[data-id='secondaryViewBookmark']"),firstPageButton:Bi.querySelector("[data-id='firstPage']"),lastPageButton:Bi.querySelector("[data-id='lastPage']"),pageRotateCwButton:Bi.querySelector("[data-id='pageRotateCw']"),pageRotateCcwButton:Bi.querySelector("[data-id='pageRotateCcw']"),cursorSelectToolButton:Bi.querySelector("[data-id='cursorSelectTool']"),cursorHandToolButton:Bi.querySelector("[data-id='cursorHandTool']"),scrollPageButton:Bi.querySelector("[data-id='scrollPage']"),scrollVerticalButton:Bi.querySelector("[data-id='scrollVertical']"),scrollHorizontalButton:Bi.querySelector("[data-id='scrollHorizontal']"),scrollWrappedButton:Bi.querySelector("[data-id='scrollWrapped']"),spreadNoneButton:Bi.querySelector("[data-id='spreadNone']"),spreadOddButton:Bi.querySelector("[data-id='spreadOdd']"),spreadEvenButton:Bi.querySelector("[data-id='spreadEven']"),documentPropertiesButton:Bi.querySelector("[data-id='documentProperties']")},sidebar:{outerContainer:Bi,viewerContainer:Bi.querySelector("[data-id='viewerContainer']"),toggleButton:Bi.querySelector("[data-id='sidebarToggle']"),thumbnailButton:Bi.querySelector("[data-id='viewThumbnail']"),outlineButton:Bi.querySelector("[data-id='viewOutline']"),attachmentsButton:Bi.querySelector("[data-id='viewAttachments']"),layersButton:Bi.querySelector("[data-id='viewLayers']"),thumbnailView:Bi.querySelector("[data-id='thumbnailView']"),outlineView:Bi.querySelector("[data-id='outlineView']"),attachmentsView:Bi.querySelector("[data-id='attachmentsView']"),layersView:Bi.querySelector("[data-id='layersView']"),outlineOptionsContainer:Bi.querySelector("[data-id='outlineOptionsContainer']"),currentOutlineItemButton:Bi.querySelector("[data-id='currentOutlineItem']")},sidebarResizer:{outerContainer:Bi,resizer:Bi.querySelector("[data-id='sidebarResizer']")},findBar:{bar:Bi.querySelector("[data-id='findbar']"),toggleButton:Bi.querySelector("[data-id='viewFind']"),findField:Bi.querySelector("[data-id='findInput']"),highlightAllCheckbox:Bi.querySelector("[data-id='findHighlightAll']"),caseSensitiveCheckbox:Bi.querySelector("[data-id='findMatchCase']"),matchDiacriticsCheckbox:Bi.querySelector("[data-id='findMatchDiacritics']"),entireWordCheckbox:Bi.querySelector("[data-id='findEntireWord']"),findMsg:Bi.querySelector("[data-id='findMsg']"),findResultsCount:Bi.querySelector("[data-id='findResultsCount']"),findPreviousButton:Bi.querySelector("[data-id='findPrevious']"),findNextButton:Bi.querySelector("[data-id='findNext']")},passwordOverlay:{overlayName:"passwordOverlay",container:Bi.querySelector("[data-id='passwordOverlay']"),label:Bi.querySelector("[data-id='passwordText']"),input:Bi.querySelector("[data-id='password']"),submitButton:Bi.querySelector("[data-id='passwordSubmit']"),cancelButton:Bi.querySelector("[data-id='passwordCancel']")},documentProperties:{overlayName:"documentPropertiesOverlay",container:Bi.querySelector("[data-id='documentPropertiesOverlay']"),closeButton:Bi.querySelector("[data-id='documentPropertiesClose']"),fields:{fileName:Bi.querySelector("[data-id='fileNameField']"),fileSize:Bi.querySelector("[data-id='fileSizeField']"),title:Bi.querySelector("[data-id='titleField']"),author:Bi.querySelector("[data-id='authorField']"),subject:Bi.querySelector("[data-id='subjectField']"),keywords:Bi.querySelector("[data-id='keywordsField']"),creationDate:Bi.querySelector("[data-id='creationDateField']"),modificationDate:Bi.querySelector("[data-id='modificationDateField']"),creator:Bi.querySelector("[data-id='creatorField']"),producer:Bi.querySelector("[data-id='producerField']"),version:Bi.querySelector("[data-id='versionField']"),pageCount:Bi.querySelector("[data-id='pageCountField']"),pageSize:Bi.querySelector("[data-id='pageSizeField']"),linearized:Bi.querySelector("[data-id='linearizedField']")}},errorWrapper:Fi,printContainer:Bi.parentElement.querySelector("[data-id='printContainer']"),printServiceOverlay:Bi.querySelector("[data-id='printServiceOverlay']"),openFileInputName:"fileInput",debuggerScriptPath:"./debugger.js"}},Object.defineProperty(Ai,"viewerTemplate",{enumerable:!0,get:function(){return Li.default}});var Si,Ei=$i(1),wi=$i(2),Ci=$i(3),ki=$i(4),xi=$i(15),Ti=$i(17),Oi=$i(5),ji=$i(18),Li=(Si=$i(51))&&Si.__esModule?Si:{default:Si};const Ii=(0,ki.initManager)(["mousemove","click","mousedown","touchstart"]);Ai.appManager=Ii,document.blockUnblockOnload&&document.blockUnblockOnload(!0)})(),Pi})())})(component_viewer);function _defineProperty(yi,vi,bi){return vi=_toPropertyKey(vi),vi in yi?Object.defineProperty(yi,vi,{value:bi,enumerable:!0,configurable:!0,writable:!0}):yi[vi]=bi,yi}function _getPrototypeOf(yi){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(bi){return bi.__proto__||Object.getPrototypeOf(bi)},_getPrototypeOf(yi)}function _superPropBase(yi,vi){for(;!Object.prototype.hasOwnProperty.call(yi,vi)&&(yi=_getPrototypeOf(yi),yi!==null););return yi}function _get(){return typeof Reflect<"u"&&Reflect.get?_get=Reflect.get.bind():_get=function(vi,bi,_i){var $i=_superPropBase(vi,bi);if($i){var Pi=Object.getOwnPropertyDescriptor($i,bi);return Pi.get?Pi.get.call(arguments.length<3?vi:_i):Pi.value}},_get.apply(this,arguments)}function _toPrimitive(yi,vi){if(typeof yi!="object"||yi===null)return yi;var bi=yi[Symbol.toPrimitive];if(bi!==void 0){var _i=bi.call(yi,vi||"default");if(typeof _i!="object")return _i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(vi==="string"?String:Number)(yi)}function _toPropertyKey(yi){var vi=_toPrimitive(yi,"string");return typeof vi=="symbol"?vi:String(vi)}function _classPrivateFieldGet(yi,vi){var bi=_classExtractFieldDescriptor(yi,vi,"get");return _classApplyDescriptorGet(yi,bi)}function _classPrivateFieldSet(yi,vi,bi){var _i=_classExtractFieldDescriptor(yi,vi,"set");return _classApplyDescriptorSet(yi,_i,bi),bi}function _classExtractFieldDescriptor(yi,vi,bi){if(!vi.has(yi))throw new TypeError("attempted to "+bi+" private field on non-instance");return vi.get(yi)}function _classApplyDescriptorGet(yi,vi){return vi.get?vi.get.call(yi):vi.value}function _classApplyDescriptorSet(yi,vi,bi){if(vi.set)vi.set.call(yi,bi);else{if(!vi.writable)throw new TypeError("attempted to set read only private field");vi.value=bi}}function _classPrivateMethodGet(yi,vi,bi){if(!vi.has(yi))throw new TypeError("attempted to get private field on non-instance");return bi}function _checkPrivateRedeclaration(yi,vi){if(vi.has(yi))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldInitSpec(yi,vi,bi){_checkPrivateRedeclaration(yi,vi),vi.set(yi,bi)}function _classPrivateMethodInitSpec(yi,vi){_checkPrivateRedeclaration(yi,vi),vi.add(yi)}var NATIVE_BIND$1=functionBindNative,FunctionPrototype=Function.prototype,apply$1=FunctionPrototype.apply,call$5=FunctionPrototype.call,functionApply=typeof Reflect=="object"&&Reflect.apply||(NATIVE_BIND$1?call$5.bind(apply$1):function(){return call$5.apply(apply$1,arguments)}),uncurryThis$3=functionUncurryThis,arraySlice$1=uncurryThis$3([].slice),classof$3=classofRaw$2,isArray$4=Array.isArray||function yi(vi){return classof$3(vi)=="Array"},classof$2=classof$7,$String$1=String,toString$1=function(yi){if(classof$2(yi)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return $String$1(yi)},uncurryThis$2=functionUncurryThis,isArray$3=isArray$4,isCallable$2=isCallable$h,classof$1=classofRaw$2,toString=toString$1,push=uncurryThis$2([].push),getJsonReplacerFunction=function(yi){if(isCallable$2(yi))return yi;if(isArray$3(yi)){for(var vi=yi.length,bi=[],_i=0;_i-1}var _arrayIncludes=arrayIncludes$1;function arrayIncludesWith$1(yi,vi,bi){for(var _i=-1,$i=yi==null?0:yi.length;++_i<$i;)if(bi(vi,yi[_i]))return!0;return!1}var _arrayIncludesWith=arrayIncludesWith$1;function noop$2(){}var noop_1=noop$2,Set$1=_Set,noop$1=noop_1,setToArray$1=_setToArray,INFINITY=1/0,createSet$1=Set$1&&1/setToArray$1(new Set$1([,-0]))[1]==INFINITY?function(yi){return new Set$1(yi)}:noop$1,_createSet=createSet$1,SetCache=_SetCache,arrayIncludes=_arrayIncludes,arrayIncludesWith=_arrayIncludesWith,cacheHas=_cacheHas,createSet=_createSet,setToArray=_setToArray,LARGE_ARRAY_SIZE=200;function baseUniq$1(yi,vi,bi){var _i=-1,$i=arrayIncludes,Pi=yi.length,Ai=!0,Si=[],Ei=Si;if(bi)Ai=!1,$i=arrayIncludesWith;else if(Pi>=LARGE_ARRAY_SIZE){var wi=vi?null:createSet(yi);if(wi)return setToArray(wi);Ai=!1,$i=cacheHas,Ei=new SetCache}else Ei=vi?[]:Si;e:for(;++_i(()=>{var bi=[,(Ai,Si,Ei)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.VerbosityLevel=Si.Util=Si.UnknownErrorException=Si.UnexpectedResponseException=Si.UNSUPPORTED_FEATURES=Si.TextRenderingMode=Si.StreamType=Si.RenderingIntentFlag=Si.PermissionFlag=Si.PasswordResponses=Si.PasswordException=Si.PageActionEventType=Si.OPS=Si.MissingPDFException=Si.IsLittleEndianCached=Si.IsEvalSupportedCached=Si.InvalidPDFException=Si.ImageKind=Si.IDENTITY_MATRIX=Si.FormatError=Si.FontType=Si.FONT_IDENTITY_MATRIX=Si.DocumentActionEventType=Si.CMapCompressionType=Si.BaseException=Si.AnnotationType=Si.AnnotationStateModelType=Si.AnnotationReviewState=Si.AnnotationReplyType=Si.AnnotationMode=Si.AnnotationMarkedState=Si.AnnotationFlag=Si.AnnotationFieldFlag=Si.AnnotationBorderStyleType=Si.AnnotationActionEventType=Si.AbortException=void 0,Si.addParamsToUrl=os,Si.arrayByteLength=_r,Si.arraysToBytes=$r,Si.assert=vr,Si.bytesToString=hr,Si.createPromiseCapability=as,Si.createValidAbsoluteUrl=ir,Si.escapeString=zr,Si.getModificationDate=ss,Si.getVerbosityLevel=gr,Si.info=fr,Si.isArrayBuffer=is,Si.isArrayEqual=rs,Si.isAscii=jr,Si.isSameOrigin=Yi,Si.objectFromMap=Tr,Si.objectSize=Sr,Si.setVerbosityLevel=ar,Si.shadow=cr,Si.string32=Pr,Si.stringToBytes=ur,Si.stringToPDFString=Br,Si.stringToUTF16BEString=Gr,Si.stringToUTF8String=Xr,Si.unreachable=mr,Si.utf8StringToString=ns,Si.warn=lr,Ei(2);const wi=[1,0,0,1,0,0];Si.IDENTITY_MATRIX=wi;const Ci=[.001,0,0,.001,0,0];Si.FONT_IDENTITY_MATRIX=Ci;const ki={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};Si.RenderingIntentFlag=ki;const xi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};Si.AnnotationMode=xi;const Ti={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};Si.PermissionFlag=Ti;const Oi={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};Si.TextRenderingMode=Oi;const ji={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};Si.ImageKind=ji;const Li={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};Si.AnnotationType=Li;const Ii={MARKED:"Marked",REVIEW:"Review"};Si.AnnotationStateModelType=Ii;const Mi={MARKED:"Marked",UNMARKED:"Unmarked"};Si.AnnotationMarkedState=Mi;const Fi={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};Si.AnnotationReviewState=Fi;const Bi={GROUP:"Group",REPLY:"R"};Si.AnnotationReplyType=Bi;const Ri={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};Si.AnnotationFlag=Ri;const Vi={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};Si.AnnotationFieldFlag=Vi;const Ni={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};Si.AnnotationBorderStyleType=Ni;const Wi={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};Si.AnnotationActionEventType=Wi;const zi={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};Si.DocumentActionEventType=zi;const Di={O:"PageOpen",C:"PageClose"};Si.PageActionEventType=Di;const Ui={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};Si.StreamType=Ui;const Hi={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};Si.FontType=Hi;const qi={ERRORS:0,WARNINGS:1,INFOS:5};Si.VerbosityLevel=qi;const Gi={NONE:0,BINARY:1,STREAM:2};Si.CMapCompressionType=Gi;const Ki={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};Si.OPS=Ki;const Qi={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};Si.UNSUPPORTED_FEATURES=Qi;const Xi={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};Si.PasswordResponses=Xi;let rr=qi.WARNINGS;function ar(wr){Number.isInteger(wr)&&(rr=wr)}function gr(){return rr}function fr(wr){rr>=qi.INFOS&&`${wr}`}function lr(wr){rr>=qi.WARNINGS&&`${wr}`}function mr(wr){throw new Error(wr)}function vr(wr,yr){wr||mr(yr)}function Yi(wr,yr){let br;try{if(br=new URL(wr),!br.origin||br.origin==="null")return!1}catch{return!1}const Ar=new URL(yr,br);return br.origin===Ar.origin}function nr(wr){if(!wr)return!1;switch(wr.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function ir(wr,yr=null,br=null){if(!wr)return null;try{if(br&&typeof wr=="string"){if(br.addDefaultProtocol&&wr.startsWith("www.")){const Ir=wr.match(/\./g);Ir&&Ir.length>=2&&(wr=`http://${wr}`)}if(br.tryConvertEncoding)try{wr=Xr(wr)}catch{}}const Ar=yr?new URL(wr,yr):new URL(wr);if(nr(Ar))return Ar}catch{}return null}function cr(wr,yr,br){return Object.defineProperty(wr,yr,{value:br,enumerable:!0,configurable:!0,writable:!1}),br}const tr=function(){function yr(br,Ar){this.constructor===yr&&mr("Cannot initialize BaseException."),this.message=br,this.name=Ar}return yr.prototype=new Error,yr.constructor=yr,yr}();Si.BaseException=tr;class dr extends tr{constructor(yr,br){super(yr,"PasswordException"),this.code=br}}Si.PasswordException=dr;class Ji extends tr{constructor(yr,br){super(yr,"UnknownErrorException"),this.details=br}}Si.UnknownErrorException=Ji;class sr extends tr{constructor(yr){super(yr,"InvalidPDFException")}}Si.InvalidPDFException=sr;class pr extends tr{constructor(yr){super(yr,"MissingPDFException")}}Si.MissingPDFException=pr;class or extends tr{constructor(yr,br){super(yr,"UnexpectedResponseException"),this.status=br}}Si.UnexpectedResponseException=or;class Zi extends tr{constructor(yr){super(yr,"FormatError")}}Si.FormatError=Zi;class er extends tr{constructor(yr){super(yr,"AbortException")}}Si.AbortException=er;function hr(wr){(typeof wr!="object"||wr===null||wr.length===void 0)&&mr("Invalid argument for bytesToString");const yr=wr.length,br=8192;if(yr>24&255,wr>>16&255,wr>>8&255,wr&255)}function Sr(wr){return Object.keys(wr).length}function Tr(wr){const yr=Object.create(null);for(const[br,Ar]of wr)yr[br]=Ar;return yr}function kr(){const wr=new Uint8Array(4);return wr[0]=1,new Uint32Array(wr.buffer,0,1)[0]===1}const Rr={get value(){return cr(this,"value",kr())}};Si.IsLittleEndianCached=Rr;function Vr(){try{return new Function(""),!0}catch{return!1}}const Hr={get value(){return cr(this,"value",Vr())}};Si.IsEvalSupportedCached=Hr;const Wr=[...Array(256).keys()].map(wr=>wr.toString(16).padStart(2,"0"));class Fr{static makeHexColor(yr,br,Ar){return`#${Wr[yr]}${Wr[br]}${Wr[Ar]}`}static transform(yr,br){return[yr[0]*br[0]+yr[2]*br[1],yr[1]*br[0]+yr[3]*br[1],yr[0]*br[2]+yr[2]*br[3],yr[1]*br[2]+yr[3]*br[3],yr[0]*br[4]+yr[2]*br[5]+yr[4],yr[1]*br[4]+yr[3]*br[5]+yr[5]]}static applyTransform(yr,br){const Ar=yr[0]*br[0]+yr[1]*br[2]+br[4],Ir=yr[0]*br[1]+yr[1]*br[3]+br[5];return[Ar,Ir]}static applyInverseTransform(yr,br){const Ar=br[0]*br[3]-br[1]*br[2],Ir=(yr[0]*br[3]-yr[1]*br[2]+br[2]*br[5]-br[4]*br[3])/Ar,Mr=(-yr[0]*br[1]+yr[1]*br[0]+br[4]*br[1]-br[5]*br[0])/Ar;return[Ir,Mr]}static getAxialAlignedBoundingBox(yr,br){const Ar=Fr.applyTransform(yr,br),Ir=Fr.applyTransform(yr.slice(2,4),br),Mr=Fr.applyTransform([yr[0],yr[3]],br),Or=Fr.applyTransform([yr[2],yr[1]],br);return[Math.min(Ar[0],Ir[0],Mr[0],Or[0]),Math.min(Ar[1],Ir[1],Mr[1],Or[1]),Math.max(Ar[0],Ir[0],Mr[0],Or[0]),Math.max(Ar[1],Ir[1],Mr[1],Or[1])]}static inverseTransform(yr){const br=yr[0]*yr[3]-yr[1]*yr[2];return[yr[3]/br,-yr[1]/br,-yr[2]/br,yr[0]/br,(yr[2]*yr[5]-yr[4]*yr[3])/br,(yr[4]*yr[1]-yr[5]*yr[0])/br]}static apply3dTransform(yr,br){return[yr[0]*br[0]+yr[1]*br[1]+yr[2]*br[2],yr[3]*br[0]+yr[4]*br[1]+yr[5]*br[2],yr[6]*br[0]+yr[7]*br[1]+yr[8]*br[2]]}static singularValueDecompose2dScale(yr){const br=[yr[0],yr[2],yr[1],yr[3]],Ar=yr[0]*br[0]+yr[1]*br[2],Ir=yr[0]*br[1]+yr[1]*br[3],Mr=yr[2]*br[0]+yr[3]*br[2],Or=yr[2]*br[1]+yr[3]*br[3],qr=(Ar+Or)/2,Jr=Math.sqrt((Ar+Or)**2-4*(Ar*Or-Mr*Ir))/2,Zr=qr+Jr||1,Kr=qr-Jr||1;return[Math.sqrt(Zr),Math.sqrt(Kr)]}static normalizeRect(yr){const br=yr.slice(0);return yr[0]>yr[2]&&(br[0]=yr[2],br[2]=yr[0]),yr[1]>yr[3]&&(br[1]=yr[3],br[3]=yr[1]),br}static intersect(yr,br){function Ar(qr,Jr){return qr-Jr}const Ir=[yr[0],yr[2],br[0],br[2]].sort(Ar),Mr=[yr[1],yr[3],br[1],br[3]].sort(Ar),Or=[];if(yr=Fr.normalizeRect(yr),br=Fr.normalizeRect(br),Ir[0]===yr[0]&&Ir[1]===br[0]||Ir[0]===br[0]&&Ir[1]===yr[0])Or[0]=Ir[1],Or[2]=Ir[2];else return null;if(Mr[0]===yr[1]&&Mr[1]===br[1]||Mr[0]===br[1]&&Mr[1]===yr[1])Or[1]=Mr[1],Or[3]=Mr[2];else return null;return Or}static bezierBoundingBox(yr,br,Ar,Ir,Mr,Or,qr,Jr){const Zr=[],Kr=[[],[]];let ts,Qr,ps,Ur,fs,gs,ms,vs;for(let ys=0;ys<2;++ys){if(ys===0?(Qr=6*yr-12*Ar+6*Mr,ts=-3*yr+9*Ar-9*Mr+3*qr,ps=3*Ar-3*yr):(Qr=6*br-12*Ir+6*Or,ts=-3*br+9*Ir-9*Or+3*Jr,ps=3*Ir-3*br),Math.abs(ts)<1e-12){if(Math.abs(Qr)<1e-12)continue;Ur=-ps/Qr,0="ï"){let br;if(wr[0]==="þ"&&wr[1]==="ÿ"?br="utf-16be":wr[0]==="ÿ"&&wr[1]==="þ"?br="utf-16le":wr[0]==="ï"&&wr[1]==="»"&&wr[2]==="¿"&&(br="utf-8"),br)try{const Ar=new TextDecoder(br,{fatal:!0}),Ir=ur(wr);return Ar.decode(Ir)}catch(Ar){lr(`stringToPDFString: "${Ar}".`)}}const yr=[];for(let br=0,Ar=wr.length;bryr===` `?"\\n":yr==="\r"?"\\r":`\\${yr}`)}function jr(wr){return/^[\x00-\x7F]*$/.test(wr)}function Gr(wr){const yr=["þÿ"];for(let br=0,Ar=wr.length;br>8&255),String.fromCharCode(Ir&255))}return yr.join("")}function Xr(wr){return decodeURIComponent(escape(wr))}function ns(wr){return unescape(encodeURIComponent(wr))}function is(wr){return typeof wr=="object"&&wr!==null&&wr.byteLength!==void 0}function rs(wr,yr){if(wr.length!==yr.length)return!1;for(let br=0,Ar=wr.length;brbr.searchParams.append(Ar,yr[Ar])),br.toString()}},(Ai,Si,Ei)=>{Ei(3)},(Ai,Si)=>{Object.defineProperty(Si,"__esModule",{value:!0}),Si.isNodeJS=void 0;const Ei=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");Si.isNodeJS=Ei}],_i={};function $i(Ai){var Si=_i[Ai];if(Si!==void 0)return Si.exports;var Ei=_i[Ai]={exports:{}};return bi[Ai](Ei,Ei.exports,$i),Ei.exports}var Pi={};return(()=>{var Ai=Pi;Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.MessageHandler=void 0;var Si=$i(1);const Ei={UNKNOWN:0,DATA:1,ERROR:2},wi={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Ci(xi){switch(xi instanceof Error||typeof xi=="object"&&xi!==null||(0,Si.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),xi.name){case"AbortException":return new Si.AbortException(xi.message);case"MissingPDFException":return new Si.MissingPDFException(xi.message);case"PasswordException":return new Si.PasswordException(xi.message,xi.code);case"UnexpectedResponseException":return new Si.UnexpectedResponseException(xi.message,xi.status);case"UnknownErrorException":return new Si.UnknownErrorException(xi.message,xi.details);default:return new Si.UnknownErrorException(xi.message,xi.toString())}}class ki{constructor(Ti,Oi,ji){this.sourceName=Ti,this.targetName=Oi,this.comObj=ji,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=Li=>{const Ii=Li.data;if(Ii.targetName!==this.sourceName)return;if(Ii.stream){this._processStreamMessage(Ii);return}if(Ii.callback){const Fi=Ii.callbackId,Bi=this.callbackCapabilities[Fi];if(!Bi)throw new Error(`Cannot resolve callback ${Fi}`);if(delete this.callbackCapabilities[Fi],Ii.callback===Ei.DATA)Bi.resolve(Ii.data);else if(Ii.callback===Ei.ERROR)Bi.reject(Ci(Ii.reason));else throw new Error("Unexpected callback case");return}const Mi=this.actionHandler[Ii.action];if(!Mi)throw new Error(`Unknown action from worker: ${Ii.action}`);if(Ii.callbackId){const Fi=this.sourceName,Bi=Ii.sourceName;new Promise(function(Ri){Ri(Mi(Ii.data))}).then(function(Ri){ji.postMessage({sourceName:Fi,targetName:Bi,callback:Ei.DATA,callbackId:Ii.callbackId,data:Ri})},function(Ri){ji.postMessage({sourceName:Fi,targetName:Bi,callback:Ei.ERROR,callbackId:Ii.callbackId,reason:Ci(Ri)})});return}if(Ii.streamId){this._createStreamSink(Ii);return}Mi(Ii.data)},ji.addEventListener("message",this._onComObjOnMessage)}on(Ti,Oi){const ji=this.actionHandler;if(ji[Ti])throw new Error(`There is already an actionName called "${Ti}"`);ji[Ti]=Oi}send(Ti,Oi,ji){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:Ti,data:Oi},ji)}sendWithPromise(Ti,Oi,ji){const Li=this.callbackId++,Ii=(0,Si.createPromiseCapability)();this.callbackCapabilities[Li]=Ii;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:Ti,callbackId:Li,data:Oi},ji)}catch(Mi){Ii.reject(Mi)}return Ii.promise}sendWithStream(Ti,Oi,ji,Li){const Ii=this.streamId++,Mi=this.sourceName,Fi=this.targetName,Bi=this.comObj;return new ReadableStream({start:Ri=>{const Vi=(0,Si.createPromiseCapability)();return this.streamControllers[Ii]={controller:Ri,startCall:Vi,pullCall:null,cancelCall:null,isClosed:!1},Bi.postMessage({sourceName:Mi,targetName:Fi,action:Ti,streamId:Ii,data:Oi,desiredSize:Ri.desiredSize},Li),Vi.promise},pull:Ri=>{const Vi=(0,Si.createPromiseCapability)();return this.streamControllers[Ii].pullCall=Vi,Bi.postMessage({sourceName:Mi,targetName:Fi,stream:wi.PULL,streamId:Ii,desiredSize:Ri.desiredSize}),Vi.promise},cancel:Ri=>{(0,Si.assert)(Ri instanceof Error,"cancel must have a valid reason");const Vi=(0,Si.createPromiseCapability)();return this.streamControllers[Ii].cancelCall=Vi,this.streamControllers[Ii].isClosed=!0,Bi.postMessage({sourceName:Mi,targetName:Fi,stream:wi.CANCEL,streamId:Ii,reason:Ci(Ri)}),Vi.promise}},ji)}_createStreamSink(Ti){const Oi=Ti.streamId,ji=this.sourceName,Li=Ti.sourceName,Ii=this.comObj,Mi=this,Fi=this.actionHandler[Ti.action],Bi={enqueue(Ri,Vi=1,Ni){if(this.isCancelled)return;const Wi=this.desiredSize;this.desiredSize-=Vi,Wi>0&&this.desiredSize<=0&&(this.sinkCapability=(0,Si.createPromiseCapability)(),this.ready=this.sinkCapability.promise),Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.ENQUEUE,streamId:Oi,chunk:Ri},Ni)},close(){this.isCancelled||(this.isCancelled=!0,Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.CLOSE,streamId:Oi}),delete Mi.streamSinks[Oi])},error(Ri){(0,Si.assert)(Ri instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.ERROR,streamId:Oi,reason:Ci(Ri)}))},sinkCapability:(0,Si.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:Ti.desiredSize,ready:null};Bi.sinkCapability.resolve(),Bi.ready=Bi.sinkCapability.promise,this.streamSinks[Oi]=Bi,new Promise(function(Ri){Ri(Fi(Ti.data,Bi))}).then(function(){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.START_COMPLETE,streamId:Oi,success:!0})},function(Ri){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.START_COMPLETE,streamId:Oi,reason:Ci(Ri)})})}_processStreamMessage(Ti){const Oi=Ti.streamId,ji=this.sourceName,Li=Ti.sourceName,Ii=this.comObj,Mi=this.streamControllers[Oi],Fi=this.streamSinks[Oi];switch(Ti.stream){case wi.START_COMPLETE:Ti.success?Mi.startCall.resolve():Mi.startCall.reject(Ci(Ti.reason));break;case wi.PULL_COMPLETE:Ti.success?Mi.pullCall.resolve():Mi.pullCall.reject(Ci(Ti.reason));break;case wi.PULL:if(!Fi){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.PULL_COMPLETE,streamId:Oi,success:!0});break}Fi.desiredSize<=0&&Ti.desiredSize>0&&Fi.sinkCapability.resolve(),Fi.desiredSize=Ti.desiredSize,new Promise(function(Bi){Bi(Fi.onPull&&Fi.onPull())}).then(function(){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.PULL_COMPLETE,streamId:Oi,success:!0})},function(Bi){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.PULL_COMPLETE,streamId:Oi,reason:Ci(Bi)})});break;case wi.ENQUEUE:if((0,Si.assert)(Mi,"enqueue should have stream controller"),Mi.isClosed)break;Mi.controller.enqueue(Ti.chunk);break;case wi.CLOSE:if((0,Si.assert)(Mi,"close should have stream controller"),Mi.isClosed)break;Mi.isClosed=!0,Mi.controller.close(),this._deleteStreamController(Mi,Oi);break;case wi.ERROR:(0,Si.assert)(Mi,"error should have stream controller"),Mi.controller.error(Ci(Ti.reason)),this._deleteStreamController(Mi,Oi);break;case wi.CANCEL_COMPLETE:Ti.success?Mi.cancelCall.resolve():Mi.cancelCall.reject(Ci(Ti.reason)),this._deleteStreamController(Mi,Oi);break;case wi.CANCEL:if(!Fi)break;new Promise(function(Bi){Bi(Fi.onCancel&&Fi.onCancel(Ci(Ti.reason)))}).then(function(){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.CANCEL_COMPLETE,streamId:Oi,success:!0})},function(Bi){Ii.postMessage({sourceName:ji,targetName:Li,stream:wi.CANCEL_COMPLETE,streamId:Oi,reason:Ci(Bi)})}),Fi.sinkCapability.reject(Ci(Ti.reason)),Fi.isCancelled=!0,delete this.streamSinks[Oi];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(Ti,Oi){await Promise.allSettled([Ti.startCall&&Ti.startCall.promise,Ti.pullCall&&Ti.pullCall.promise,Ti.cancelCall&&Ti.cancelCall.promise]),delete this.streamControllers[Oi]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Ai.MessageHandler=ki})(),Pi})())})(message_handler);var defineProperty=_defineProperty$1;function baseAssignValue$4(yi,vi,bi){vi=="__proto__"&&defineProperty?defineProperty(yi,vi,{configurable:!0,enumerable:!0,value:bi,writable:!0}):yi[vi]=bi}var _baseAssignValue=baseAssignValue$4,baseAssignValue$3=_baseAssignValue,eq$1=eq_1,objectProto$3=Object.prototype,hasOwnProperty$3=objectProto$3.hasOwnProperty;function assignValue$2(yi,vi,bi){var _i=yi[vi];(!(hasOwnProperty$3.call(yi,vi)&&eq$1(_i,bi))||bi===void 0&&!(vi in yi))&&baseAssignValue$3(yi,vi,bi)}var _assignValue=assignValue$2,assignValue$1=_assignValue,castPath$1=_castPath,isIndex=_isIndex,isObject$7=isObject_1,toKey=_toKey;function baseSet$1(yi,vi,bi,_i){if(!isObject$7(yi))return yi;vi=castPath$1(vi,yi);for(var $i=-1,Pi=vi.length,Ai=Pi-1,Si=yi;Si!=null&&++$i1?bi[$i-1]:void 0,Ai=$i>2?bi[2]:void 0;for(Pi=yi.length>3&&typeof Pi=="function"?($i--,Pi):void 0,Ai&&isIterateeCall(bi[0],bi[1],Ai)&&(Pi=$i<3?void 0:Pi,$i=1),vi=Object(vi);++_i<$i;){var Si=bi[_i];Si&&yi(vi,Si,_i,Pi)}return vi})}var _createAssigner=createAssigner$1,baseMerge=_baseMerge,createAssigner=_createAssigner,mergeWith=createAssigner(function(yi,vi,bi,_i){baseMerge(yi,vi,bi,_i)}),mergeWith_1=mergeWith;function i$b(yi,vi,bi){this.pdfluxTransport=yi}async function s$e(yi){const{prefetchStrategy:vi}=this.pdfluxTransport;return vi&&vi.isValid()&&(vi.isResolved(yi)||await vi.ensurePageData(yi)),pdfExports.PDFDocumentProxy.prototype.getPage.call(this,yi)}async function c$p(){return this.pdfluxTransport.getDocumentOutline(!1)}async function l$i(yi,vi,bi){const _i=new Map;let $i=vi;for await(const Pi of yi){if($i=Pi.page+1,$i<=0)break;_i.has($i)||_i.set($i,[]),_i.get($i).push({pageNumber:$i,index:Pi.index})}return[..._i.values()]}let m$u=class extends pdfExports.PDFDocumentProxy{constructor(vi,bi,_i){return super(bi,_i),i$b.call(this,vi,bi,_i)}async getPage(vi){return s$e.call(this,vi)}async getPdfiumOutline(){return c$p.call(this)}async getPageInfoElements(vi,bi,_i=-1){return l$i.call(this,vi,bi,_i)}};function P$o(yi,vi,bi){return new m$u(yi,vi,bi)}function X$e(yi=[],vi){const bi=[];for(let _i=0;_i{const Ai=[];let Si=0;for(;Siir.data),nr={id:rr,rect:H$f(Yi,bi),subtype:ar.data,annotationFlags:($i=yi.F)===null||$i===void 0?void 0:$i.data,creationDate:F$i(gr==null?void 0:gr.data),modificationDate:fr!=null&&fr.data?F$i(fr==null?void 0:fr.data):F$i(gr==null?void 0:gr.data),annotationType:E$p[ar.data],titleObj:{str:(Pi=(Ai=yi.T)===null||Ai===void 0?void 0:Ai.data)!==null&&Pi!==void 0?Pi:"",dir:"ltr"},contentsObj:{str:(Si=(Ei=yi.Contents)===null||Ei===void 0?void 0:Ei.data)!==null&&Si!==void 0?Si:"",dir:"ltr"},hasAppearance:!!(!((wi=yi.AP)===null||wi===void 0)&&wi.data),pageNumber:vi,popupId:(Ci=yi.Popup)===null||Ci===void 0?void 0:Ci.data.ref_id,hasPopup:!!(!((ki=yi.Popup)===null||ki===void 0)&&ki.data),borderStyle:{width:(xi=(Ti=yi.BS)===null||Ti===void 0||(Ti=Ti.data.W)===null||Ti===void 0?void 0:Ti.data)!==null&&xi!==void 0?xi:0,dashArray:(Oi=(ji=yi.BS)===null||ji===void 0||(ji=ji.data.D)===null||ji===void 0?void 0:ji.data)!==null&&Oi!==void 0?Oi:[],horizontalCornerRadius:0,verticalCornerRadius:0,style:(Li=c$q[(Ii=yi.BS)===null||Ii===void 0||(Ii=Ii.data.S)===null||Ii===void 0?void 0:Ii.data])!==null&&Li!==void 0?Li:1},parentId:vr,parentType:vr?(Mi=_i[vr])===null||Mi===void 0?void 0:Mi.Subtype.data:null,inReplyTo:(Fi=yi.IRT)===null||Fi===void 0?void 0:Fi.data.ref_id,replyType:yi.IRT&&((Bi=(Ri=yi.RT)===null||Ri===void 0?void 0:Ri.data)!==null&&Bi!==void 0?Bi:"R"),name:(Vi=yi.Name)===null||Vi===void 0?void 0:Vi.data,subj:(Ni=yi.Subj)===null||Ni===void 0?void 0:Ni.data,color:(Wi=yi.C)===null||Wi===void 0?void 0:Wi.data.map(ir=>255*ir.data|0),quadPoints:(zi=yi.QuadPoints)!==null&&zi!==void 0&&zi.data?X$e((Di=yi.QuadPoints)===null||Di===void 0?void 0:Di.data,bi):void 0,lineCoordinates:(Ui=yi.L)!==null&&Ui!==void 0&&Ui.data?Y$e(yi.L.data,bi):void 0,inkLists:(Hi=yi.InkList)!==null&&Hi!==void 0&&Hi.data?Z$c(yi.InkList.data,bi):void 0,lineEndpoints:(qi=yi.LE)!==null&&qi!==void 0&&qi.data?[(Gi=yi.LE)===null||Gi===void 0?void 0:Gi.data[0].data,(Ki=yi.LE)===null||Ki===void 0?void 0:Ki.data[1].data]:void 0,vertices:(Qi=yi.Vertices)!==null&&Qi!==void 0&&Qi.data?tt$9(yi.Vertices.data,bi):void 0,A:yi.A,AP:yi.AP,CA:yi.CA,RC:yi.RC,HideInf:yi.HideInf,NM:yi.NM,P:yi.P,LL:yi.LL,LLE:yi.LLE,LLO:yi.LLO,HighDpi:yi.HighDpi};if(((Xi=yi.A)===null||Xi===void 0||(Xi=Xi.data.S)===null||Xi===void 0?void 0:Xi.data)==="URI"){nr.unsafeUrl=yi.A.data.URI.data;const ir=pdfExports.createValidAbsoluteUrl(nr.unsafeUrl,void 0,{addDefaultProtocol:!0,tryConvertEncoding:!0});ir&&(nr.url=ir.href)}return U$g(nr),nr}function et$9(yi,vi=0){if(!yi)return null;const bi=vi*(255-yi[0])+yi[0],_i=vi*(255-yi[1])+yi[1],$i=vi*(255-yi[2])+yi[2];let Pi=pdfExports.Util.makeHexColor(bi|0,_i|0,$i|0);if(yi.length===4){const Ai=yi[3];let Si=Math.round(Ai*255).toString(16);Si.length===1&&(Si=`0${Si}`),Pi+=Si}return Pi}function o$c(){const yi=Object.create(null);let vi=!1;return Object.defineProperty(yi,"settled",{get(){return vi}}),yi.promise=new Promise((bi,_i)=>{yi.resolve=function($i){vi=!0,bi($i)},yi.reject=function($i){vi=!0,_i($i)}}),yi}function A$q(yi){this._internalRenderTask=yi,this.onContinue=null}function W$l(){return this._internalRenderTask.capability.promise}function L$h(){this._internalRenderTask.cancel()}let N$j=class{constructor(vi){return A$q.call(this,vi)}get promise(){return W$l.call(this)}cancel(){return L$h.call(this)}};var S$p=new WeakMap,m$t=new WeakMap,I$m=new WeakMap,C$n=new WeakMap;function U$f(){return pdfExports.shadow(this,"canvasInUse",new WeakSet)}function M$j(yi,vi,bi,_i,$i){_classPrivateFieldInitSpec(this,S$p,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,m$t,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,I$m,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,C$n,{writable:!0,value:void 0}),_defineProperty(this,"running",!1),_defineProperty(this,"cancelled",!1),_defineProperty(this,"capability",o$c()),_defineProperty(this,"gfx",null),this.callback=yi,this.params=vi,_classPrivateFieldSet(this,S$p,_i),_classPrivateFieldSet(this,I$m,bi),this.task=new N$j(this),_classPrivateFieldSet(this,m$t,vi.canvasContext.canvas),_classPrivateFieldSet(this,C$n,$i)}function O$s(){return this.capability.promise.catch(()=>{})}function $$f(yi){if(this.cancelled)return;if(_classPrivateFieldGet(this,m$t)){if(v$o.canvasInUse.has(_classPrivateFieldGet(this,m$t)))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");v$o.canvasInUse.add(_classPrivateFieldGet(this,m$t))}this.gfx={beginDrawing:async({canvasContext:_i,page:$i})=>{const{canvas:Pi}=_i,{width:Ai,height:Si}=Pi,{rotation:Ei}=yi.app.pages[$i],wi=`${$i}_${Ai}_${Si}_${Ei}`,Ci=yi.app.imageCache.get(wi);if(Ci){_i.drawImage(Ci,0,0),this.capability.resolve(void 0);return}const ki=async()=>{try{if(this.cancelled){this.capability.resolve(void 0);return}yi.app.rendering=!0;const xi=yi.app.layers?{layers:yi.app.layers}:{},Ti=await yi.pdfiumTransport.getImageData({index:$i,width:Ai,height:Si,rotation:Ei,devicePixelRatio:window.devicePixelRatio,...xi,watermark:_classPrivateFieldGet(this,C$n)});_i.drawImage(Ti,0,0),yi.app.imageCache.set(wi,Ti),this.capability.resolve(void 0)}catch(xi){yi.app.destroyed||console.error(xi)}finally{yi.app.renderStack.length&&yi.app.renderStack.pop()(),yi.app.rendering=!1}};yi.app.rendering?yi.app.renderStack.push(ki):await ki()}};const{canvasContext:vi,viewport:bi}=this.params;this.gfx.beginDrawing({viewport:bi,canvasContext:vi,page:_classPrivateFieldGet(this,I$m)})}function j$d(yi){this.running=!1,this.cancelled=!0,_classPrivateFieldGet(this,m$t)&&v$o.canvasInUse.delete(_classPrivateFieldGet(this,m$t)),this.callback(yi||new pdfExports.RenderingCancelledException(`Rendering cancelled, page ${_classPrivateFieldGet(this,I$m)+1}`,"canvas"))}let v$o=class{static get canvasInUse(){return U$f.call(this)}constructor({callback:vi,params:bi,pageIndex:_i,pdfDebug:$i=!1,watermark:Pi=0}){return M$j.call(this,vi,bi,_i,$i,Pi)}get completed(){return O$s.call(this)}initializeGraphics(vi){return $$f.call(this,vi)}cancel(vi=null){return j$d.call(this,vi)}};var R$j=new WeakMap;function z$f(yi,vi,bi,_i,$i,Pi){_classPrivateFieldInitSpec(this,R$j,{writable:!0,value:void 0}),_defineProperty(this,"charCount",null),this.context=yi}async function K$9(){if(this.app.AppOptions.get("disableDocAnnotation"))return[];const{objects:yi}=await this.pdfiumTransport.getPageAnnotations(this._pageIndex),vi=[],bi=[];return Object.keys(yi).forEach(_i=>{const $i=yi[_i];$i.Type==="Page"&&vi.push($i)}),vi.forEach(({Annots:_i,pai_annots:$i})=>{const Pi=this._pageIndex+1,Ai=[];let Si=[];const Ei=[];[..._i,...$i].forEach(wi=>{const Ci=yi[wi];if(!E$p[Ci.Subtype.data])return;if(Ci.Subtype.data==="Popup"&&Ci.Parent){const xi=Ci.Parent.data.ref_id,Ti=yi[xi];if(!E$p[Ti.Subtype.data])return}const ki=lt$8(Ci,Pi,this.view,yi);if(ki){const{annotationType:xi,inReplyTo:Ti}=ki;xi===E$p.Popup?Ei.push(ki):xi===E$p.Text&&Ti?Si.push(ki):Ai.push(ki)}}),Si=Si.filter(wi=>{const{inReplyTo:Ci}=wi,ki=Ai.find(xi=>xi.id===Ci);return!(ki&&ki.popupId&&!Ei.find(xi=>xi.id===ki.popupId))}),Si.forEach(wi=>{const{id:Ci,inReplyTo:ki}=wi,xi=Ai.find(Oi=>Oi.id===ki),Ti=(xi==null?void 0:xi.replyIds)||[];xi&&!Ti.includes(Ci)&&(Ti.push(Ci),xi.replyIds=Ti)}),Si.sort((wi,Ci)=>wi.modificationDate-Ci.modificationDate),bi.push(...Ai,...Ei,...Si)}),bi}function H$e(){return this.context.app}function V$i(){return this.context.transport}function q$c(){return this.context.app.selectTextService(this._pageIndex)}function J$g(yi,vi){const bi=$i=>{this.cleanupAfterRender&&(this.pendingCleanup=!0),$i||_i.capability.resolve(void 0),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},_i=new v$o({callback:bi,params:{canvasContext:yi,viewport:vi},pageIndex:this._pageIndex,pdfBug:this._pdfBug,watermark:this.app.AppOptions.get("watermark")});return Promise.resolve().then(()=>{_i.initializeGraphics(this)}),_i.task}async function Q$c(){return await this.getPdfiumAnnotations()}function X$d(yi){return this.pdfiumTransport.cleanup(this._pageIndex),pdfExports.PDFPageProxy.prototype.cleanup.call(this,yi)}async function Y$d(){return _classPrivateFieldGet(this,R$j)===void 0&&_classPrivateFieldSet(this,R$j,await this.pdfiumTransport.getPageScannedResult(this._pageIndex)),_classPrivateFieldGet(this,R$j)}async function Z$b(){return this.charCount===null&&(this.charCount=await this.selectTextService.getCountChars(this._pageIndex)),this.charCount}async function ee$4(yi,vi,bi){return this.selectTextService.getText({pageIndex:this._pageIndex,index:yi,count:vi,withNewline:bi})}async function te$4(yi,vi){return this.selectTextService.getRects({pageIndex:this._pageIndex,index:yi,count:vi})}async function ne$4(yi){return this.selectTextService.getExpandSentence({pageIndex:this._pageIndex,startIndex:yi})}async function ae$3(yi){return this.selectTextService.selectTextInElementBlock({pageIndex:this._pageIndex,startIndex:yi})}async function se$4(yi,vi){const bi=[],_i=async $i=>{const Pi=[this.getRangeText($i,1),this.getRangeRects($i,1)],[Ai,Si]=await Promise.all(Pi);return{index:$i,text:Ai,rects:Si}};for(let $i=yi;$i{if(!_i.includes($i.text))return $i;const Ai=Pi>0?yi[Pi-1]:null;if(Ai){const Ei=Ai.rects.at(-1),wi=$i.rects.at(0);R$k(Ei,wi,2)&&wi[0]-Ei[2]>bi&&(wi[0]=Ei[2]+bi)}const Si=Pibi&&(Ei[2]=wi[0]-bi)}return $i})}async function re$3(yi,vi){const[bi,_i]=yi;let $i=await this.getEachCharInfosByIdxRange(bi,_i);vi&&($i=this.repairSpaceRect($i));const Pi=[];let Ai=1,Si=0;return $i.forEach((Ei,wi)=>{let Ci=!1;if(Ei.text===""&&wi!==$i.length-1){const Ti=$i[wi+1],[[Oi,,,ji]]=Ei.rects,[[,Li,Ii]]=Ti.rects;Ci=jiIi}const ki=Ci?" ":Ei.text,xi=!["",` `].includes(Ei.text);Pi.push({lineNumber:Ai,charIdx:Si,index:Ei.index,text:ki,rects:Ei.rects,isBreak:Ci,isValidChar:xi}),Ci?(Si+=1,Ai+=1):xi&&(Si+=1)}),Pi}async function ce$3(){return this.pdfiumTransport.getElementBlockInfos(this._pageIndex)}async function oe$3(yi,vi){const bi=await this.getRangeText(yi,vi-yi);return this.selectTextService.getSentenceCountInText(bi)}async function le$3(yi,vi,bi,_i){const[$i]=await this.selectTextService.getNearPointIndexes({index:this._pageIndex,x:yi,y:vi,xTolerance:bi,yTolerance:_i});return this.getElementBlockCharRange($i)}async function he$3(yi,vi){const[bi]=await this.selectTextService.getNearPointIndexes({index:this._pageIndex,x:yi,y:vi,xTolerance:10,yTolerance:10});return this.getSentenceCharRange(bi)}async function ue$2(yi,vi,bi,_i){const $i=await this.selectTextService.getNearPointIndexes({index:this._pageIndex,x:yi,y:vi,xTolerance:bi,yTolerance:_i});if($i[0]!==$i[1])return $i;const[Pi]=await this.getRangeRects($i[0],1);if(!Pi)return $i;const[Ai,Si,Ei,wi]=Pi;if(!(yi+bi>=Ai&&yi-bi<=Ei&&vi+_i>=Si&&vi-_i<=wi))return $i;const Ci=Ei-Ai;return yi-Ai>Ci/2?$i.map(ki=>ki+1):$i}async function pe$1(){return(await this.getElementBlockInfos()).filter(yi=>yi.type!=="PAGE_BLOCK_ITEM")}async function de$2(){return(await this.getElementBlockInfos()).filter(yi=>yi.type.startsWith("PARAGRAPH"))}async function ge$1(yi,vi){return this.selectTextService.getTextInRectWithoutLineBreak({pageIndex:yi,rect:vi})}let fe$1=class extends pdfExports.PDFPageProxy{constructor(vi,bi,_i,$i,Pi,Ai){return super(bi,_i,$i,Pi,Ai),z$f.call(this,vi,bi,_i,$i,Pi,Ai)}async getPdfiumAnnotations(){return K$9.call(this)}get app(){return H$e.call(this)}get pdfiumTransport(){return V$i.call(this)}get selectTextService(){return q$c.call(this)}render({canvasContext:vi,viewport:bi}){return J$g.call(this,vi,bi)}async getAnnotations(){return Q$c.call(this)}cleanup(vi=!1){return X$d.call(this,vi)}async isScanned(){return Y$d.call(this)}async getCharCount(){return Z$b.call(this)}async getRangeText(vi,bi,_i=!1){return ee$4.call(this,vi,bi,_i)}async getRangeRects(vi,bi){return te$4.call(this,vi,bi)}async getSentenceCharRange(vi){return ne$4.call(this,vi)}async getElementBlockCharRange(vi){return ae$3.call(this,vi)}async getEachCharInfosByIdxRange(vi,bi){return se$4.call(this,vi,bi)}repairSpaceRect(vi){return ie$4.call(this,vi)}async getEachCharInfo(vi,bi=!1){return re$3.call(this,vi,bi)}async getElementBlockInfos(){return ce$3.call(this)}async getSentenceCountByIndexes(vi,bi){return oe$3.call(this,vi,bi)}async getElementBlockIndexesByPoint(vi,bi,_i=10,$i=10){return le$3.call(this,vi,bi,_i,$i)}async getExpandSentenceIndexesByPoint(vi,bi){return he$3.call(this,vi,bi)}async getNearPointExactIndexes(vi,bi,_i=10,$i=10){return ue$2.call(this,vi,bi,_i,$i)}async getTextElementBlocks(){return pe$1.call(this)}async getParagraphInfos(){return de$2.call(this)}async getTextInRectWithoutLineBreak(vi,bi){return ge$1.call(this,vi,bi)}};function Ce$2(yi,vi,bi,_i,$i,Pi){if(yi.renderEngine!=="pdf.js")return new fe$1(yi,vi,bi,_i,$i,Pi);const Ai=new pdfExports.PDFPageProxy(vi,bi,_i,$i,Pi);return Ai.app=yi.app,Ai.pdfiumTransport=yi.transport,Ai}var newPromiseCapability={},aCallable$3=aCallable$8,$TypeError$2=TypeError,PromiseCapability=function(yi){var vi,bi;this.promise=new yi(function(_i,$i){if(vi!==void 0||bi!==void 0)throw $TypeError$2("Bad Promise constructor");vi=_i,bi=$i}),this.resolve=aCallable$3(vi),this.reject=aCallable$3(bi)};newPromiseCapability.f=function(yi){return new PromiseCapability(yi)};var perform$1=function(yi){try{return{error:!1,value:yi()}}catch(vi){return{error:!0,value:vi}}},uncurryThis=functionUncurryThisClause,aCallable$2=aCallable$8,NATIVE_BIND=functionBindNative,bind$1=uncurryThis(uncurryThis.bind),functionBindContext=function(yi,vi){return aCallable$2(yi),vi===void 0?yi:NATIVE_BIND?bind$1(yi,vi):function(){return yi.apply(vi,arguments)}},iterators={},wellKnownSymbol$3=wellKnownSymbol$a,Iterators$1=iterators,ITERATOR$2=wellKnownSymbol$3("iterator"),ArrayPrototype=Array.prototype,isArrayIteratorMethod$1=function(yi){return yi!==void 0&&(Iterators$1.Array===yi||ArrayPrototype[ITERATOR$2]===yi)},classof=classof$7,getMethod$1=getMethod$3,isNullOrUndefined=isNullOrUndefined$3,Iterators=iterators,wellKnownSymbol$2=wellKnownSymbol$a,ITERATOR$1=wellKnownSymbol$2("iterator"),getIteratorMethod$2=function(yi){if(!isNullOrUndefined(yi))return getMethod$1(yi,ITERATOR$1)||getMethod$1(yi,"@@iterator")||Iterators[classof(yi)]},call$3=functionCall,aCallable$1=aCallable$8,anObject$2=anObject$8,tryToString$1=tryToString$4,getIteratorMethod$1=getIteratorMethod$2,$TypeError$1=TypeError,getIterator$1=function(yi,vi){var bi=arguments.length<2?getIteratorMethod$1(yi):vi;if(aCallable$1(bi))return anObject$2(call$3(bi,yi));throw $TypeError$1(tryToString$1(yi)+" is not iterable")},call$2=functionCall,anObject$1=anObject$8,getMethod=getMethod$3,iteratorClose$1=function(yi,vi,bi){var _i,$i;anObject$1(yi);try{if(_i=getMethod(yi,"return"),!_i){if(vi==="throw")throw bi;return bi}_i=call$2(_i,yi)}catch(Pi){$i=!0,_i=Pi}if(vi==="throw")throw bi;if($i)throw _i;return anObject$1(_i),bi},bind=functionBindContext,call$1=functionCall,anObject=anObject$8,tryToString=tryToString$4,isArrayIteratorMethod=isArrayIteratorMethod$1,lengthOfArrayLike=lengthOfArrayLike$7,isPrototypeOf=objectIsPrototypeOf,getIterator=getIterator$1,getIteratorMethod=getIteratorMethod$2,iteratorClose=iteratorClose$1,$TypeError=TypeError,Result=function(yi,vi){this.stopped=yi,this.result=vi},ResultPrototype=Result.prototype,iterate$1=function(yi,vi,bi){var _i=bi&&bi.that,$i=!!(bi&&bi.AS_ENTRIES),Pi=!!(bi&&bi.IS_RECORD),Ai=!!(bi&&bi.IS_ITERATOR),Si=!!(bi&&bi.INTERRUPTED),Ei=bind(vi,_i),wi,Ci,ki,xi,Ti,Oi,ji,Li=function(Mi){return wi&&iteratorClose(wi,"normal",Mi),new Result(!0,Mi)},Ii=function(Mi){return $i?(anObject(Mi),Si?Ei(Mi[0],Mi[1],Li):Ei(Mi[0],Mi[1])):Si?Ei(Mi,Li):Ei(Mi)};if(Pi)wi=yi.iterator;else if(Ai)wi=yi;else{if(Ci=getIteratorMethod(yi),!Ci)throw $TypeError(tryToString(yi)+" is not iterable");if(isArrayIteratorMethod(Ci)){for(ki=0,xi=lengthOfArrayLike(yi);xi>ki;ki++)if(Ti=Ii(yi[ki]),Ti&&isPrototypeOf(ResultPrototype,Ti))return Ti;return new Result(!1)}wi=getIterator(yi,Ci)}for(Oi=Pi?yi.next:wi.next;!(ji=call$1(Oi,wi)).done;){try{Ti=Ii(ji.value)}catch(Mi){iteratorClose(wi,"throw",Mi)}if(typeof Ti=="object"&&Ti&&isPrototypeOf(ResultPrototype,Ti))return Ti}return new Result(!1)},global$2=global$h,promiseNativeConstructor=global$2.Promise,wellKnownSymbol$1=wellKnownSymbol$a,ITERATOR=wellKnownSymbol$1("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR]=function(){return this},Array.from(iteratorWithReturn,function(){throw 2})}catch(yi){}var checkCorrectnessOfIteration$1=function(yi,vi){if(!vi&&!SAFE_CLOSING)return!1;var bi=!1;try{var _i={};_i[ITERATOR]=function(){return{next:function(){return{done:bi=!0}}}},yi(_i)}catch{}return bi},engineIsDeno=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",IS_DENO$1=engineIsDeno,IS_NODE=engineIsNode,engineIsBrowser=!IS_DENO$1&&!IS_NODE&&typeof window=="object"&&typeof document=="object",global$1=global$h,NativePromiseConstructor$1=promiseNativeConstructor,isCallable=isCallable$h,isForced=isForced_1,inspectSource=inspectSource$2,wellKnownSymbol=wellKnownSymbol$a,IS_BROWSER=engineIsBrowser,IS_DENO=engineIsDeno,V8_VERSION=engineV8Version;NativePromiseConstructor$1&&NativePromiseConstructor$1.prototype;var SPECIES=wellKnownSymbol("species"),SUBCLASSING=!1,NATIVE_PROMISE_REJECTION_EVENT=isCallable(global$1.PromiseRejectionEvent),FORCED_PROMISE_CONSTRUCTOR$1=isForced("Promise",function(){var yi=inspectSource(NativePromiseConstructor$1),vi=yi!==String(NativePromiseConstructor$1);if(!vi&&V8_VERSION===66)return!0;if(!V8_VERSION||V8_VERSION<51||!/native code/.test(yi)){var bi=new NativePromiseConstructor$1(function(Pi){Pi(1)}),_i=function(Pi){Pi(function(){},function(){})},$i=bi.constructor={};if($i[SPECIES]=_i,SUBCLASSING=bi.then(function(){})instanceof _i,!SUBCLASSING)return!0}return!vi&&(IS_BROWSER||IS_DENO)&&!NATIVE_PROMISE_REJECTION_EVENT}),promiseConstructorDetection={CONSTRUCTOR:FORCED_PROMISE_CONSTRUCTOR$1,REJECTION_EVENT:NATIVE_PROMISE_REJECTION_EVENT,SUBCLASSING},NativePromiseConstructor=promiseNativeConstructor,checkCorrectnessOfIteration=checkCorrectnessOfIteration$1,FORCED_PROMISE_CONSTRUCTOR=promiseConstructorDetection.CONSTRUCTOR,promiseStaticsIncorrectIteration=FORCED_PROMISE_CONSTRUCTOR||!checkCorrectnessOfIteration(function(yi){NativePromiseConstructor.all(yi).then(void 0,function(){})}),$$e=_export,call=functionCall,aCallable=aCallable$8,newPromiseCapabilityModule=newPromiseCapability,perform=perform$1,iterate=iterate$1,PROMISE_STATICS_INCORRECT_ITERATION=promiseStaticsIncorrectIteration;$$e({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION},{allSettled:function yi(vi){var bi=this,_i=newPromiseCapabilityModule.f(bi),$i=_i.resolve,Pi=_i.reject,Ai=perform(function(){var Si=aCallable(bi.resolve),Ei=[],wi=0,Ci=1;iterate(vi,function(ki){var xi=wi++,Ti=!1;Ci++,call(Si,bi,ki).then(function(Oi){Ti||(Ti=!0,Ei[xi]={status:"fulfilled",value:Oi},--Ci||$i(Ei))},function(Oi){Ti||(Ti=!0,Ei[xi]={status:"rejected",reason:Oi},--Ci||$i(Ei))})}),--Ci||$i(Ei)});return Ai.error&&Pi(Ai.value),_i.promise}});const r$e="pdfjs.password";function o$b(yi,vi){return yi.findIndex(bi=>bi.url===vi)}function e$2(){const yi=window.localStorage.getItem(r$e);let vi=[];return yi&&(vi=JSON.parse(yi)),vi}function i$a(yi){const vi=e$2(),bi=o$b(vi,yi.url);return bi>=0?vi[bi]=yi:vi.push(yi),window.localStorage.setItem(r$e,JSON.stringify(vi)),yi}function a$h(yi){const vi=e$2(),bi=o$b(vi,yi);return bi>=0?vi[bi].password:""}function r$d(){return typeof SharedArrayBuffer=="function"}const S$o={DISABLE:0,USE_JSON:1};function w$r(yi){this.loadingTask=null,this.pdfiumTransport=yi}function T$k(yi){this.loadingTask=yi}let U$e=class{constructor(vi){return w$r.call(this,vi)}setLoadingTask(vi){return T$k.call(this,vi)}};var l$h=new WeakMap,n$8=new WeakMap,p$i=new WeakMap;function k$m(){return _classPrivateFieldGet(this,n$8).promise}function J$f(yi,vi){_classPrivateFieldInitSpec(this,l$h,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,n$8,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,p$i,{writable:!0,value:new Map}),_classPrivateFieldSet(this,n$8,o$c()),this.getDocData=vi;const{appOptions:bi}=this.pdfiumTransport;if(vi&&typeof this.getDocData=="function"){const _i=bi.get("defaultUrl");this.getDocData(_i).then($i=>{_classPrivateFieldSet(this,l$h,$i),_classPrivateFieldGet(this,n$8).resolve($i)}).catch(()=>{_classPrivateFieldSet(this,l$h,null),_classPrivateFieldGet(this,n$8).resolve(_classPrivateFieldGet(this,l$h))})}}function F$h(yi){return!1}function M$i(){return this.getDocData!==null&&typeof this.getDocData=="function"}async function b$k(yi){await this._ensurePageData(yi)}async function E$o(yi){const vi=await _classPrivateFieldGet(this,n$8).promise;if(vi===null||vi.ranges===null)return!1;const bi=_classPrivateFieldGet(this,p$i).get(yi);if(bi)return bi;const _i=vi.ranges[yi];if(!_i||_i.length===0)return!1;const{appOptions:$i}=this.pdfiumTransport;let Pi;const Ai=_i.map(Ti=>({begin:Ti[0],end:Ti[1]})),Si=$i.get("pdfBugEnabled"),Ei=$i.get("supportMultipleRange"),wi=$i.get("resolvePageDataUrl"),Ci=$i.get("defaultUrl"),ki=wi?wi(Ci):Ci,xi={ranges:Ai,pageNumber:yi,cause:Si?`ensurePage${yi}`:"",supportMultipleRange:Ei,pdfUrl:ki};return r$d()?Pi=this.loadingTask._transport.prefetchPageData(xi):Pi=this.pdfiumTransport.prefetchPageData(xi),_classPrivateFieldGet(this,p$i).set(yi,Pi),Pi}let I$l=class extends U$e{get promise(){return k$m.call(this)}constructor(vi,bi=null){return super(vi),J$f.call(this,vi,bi)}isResolved(vi){return F$h.call(this,vi)}isValid(){return M$i.call(this)}async ensurePageData(vi){return b$k.call(this,vi)}async _ensurePageData(vi){return E$o.call(this,vi)}};function w$q(){_defineProperty(this,"chunkSize",65536),_defineProperty(this,"bytes",null),_defineProperty(this,"loadedChunks",new Set)}function W$k(yi){return Math.floor(yi/this.chunkSize)}function R$i(yi){return Math.floor((yi-1)/this.chunkSize)+1}function C$m(yi,vi){const bi=this.getBeginChunk(yi),_i=this.getEndChunk(vi),$i=[];for(let Pi=bi;Pi<_i;++Pi)$i.push(Pi);return $i}let T$j=class{constructor(){return w$q.call(this)}getBeginChunk(vi){return W$k.call(this,vi)}getEndChunk(vi){return R$i.call(this,vi)}getChunks(vi,bi){return C$m.call(this,vi,bi)}};function S$n(yi,vi){if(_defineProperty(this,"workerIsReady",o$c()),_defineProperty(this,"_docHandlerCapability",o$c()),_defineProperty(this,"docHandler",null),_defineProperty(this,"_docLoadedCapability",o$c()),_defineProperty(this,"prefetchStrategy",null),!(!vi||!yi)){this.messageHandler=yi,this.appOptions=vi;try{const bi=this.appOptions.get("wasmPath")||"/static/pdflux.wasm",_i=this.appOptions.get("isDesktopEnv")||!1,$i=this.appOptions.get("disableExternalFont")||!1,Pi=this.appOptions.get("defaultUrl"),Ai=this.appOptions.get("rangeChunkSize");yi.send("4b3a00a1594c8be0500ce1a724448d61",{rangeChunkSize:Ai,defaultUrl:Pi,wasmPath:bi,isDesktopEnv:_i,disableExternalFont:$i})}catch(bi){console.error(bi)}if(vi.get("prefetchStrategy")===S$o.USE_JSON){const bi=vi.get("prefetchPageData");typeof bi=="function"&&(this.prefetchStrategy=new I$l(this,bi))}yi.on("4e545ebce9d8a341b0449fc2627b2776",()=>{this.workerIsReady.resolve(null)})}}function $$d(yi){const{messageHandler:vi}=this,bi=new message_handlerExports.MessageHandler(yi,`${yi}_worker`,vi.comObj),_i=new T$j;bi.on("bd067cd4c0b5d62681e3c43871bb88a1",()=>{var $i;this._docHandlerCapability.resolve(bi),($i=this.docHandler)===null||$i===void 0||$i.destroy(),this.docHandler=bi}),bi.on("ea5e203bd5dd55a4f278aebf828fe3a8",()=>{this._docLoadedCapability.resolve(null)}),bi.on("4b0cae975a3f8a937176a16a24a5951e",async $i=>{var Pi,Ai;if(await((Pi=this._loadingTask)===null||Pi===void 0?void 0:Pi.promise),((Ai=this._loadingTask)===null||Ai===void 0?void 0:Ai.destroyed)!==!0){var Si;const wi=(Si=this._loadingTask)===null||Si===void 0?void 0:Si._transport,Ci=_i.getChunks($i.start,$i.end);if(!(_i.bytes!==null&&Ci.every(ki=>_i.loadedChunks.has(ki)))){const{bytes:ki,loadedChunks:xi,chunkSize:Ti}=await wi.getRangeData($i);_i.bytes=ki,_i.chunkSize=Ti,_i.loadedChunks=xi}}const Ei=new Int32Array($i.sab);if(_i.bytes){const wi=new Uint32Array(_i.bytes.subarray($i.start,$i.end));Ei.set(wi,1)}Ei[0]=1,Atomics.notify(Ei,0)})}function D$n(yi){if(this._loadingTask)throw new Error("there is already a loadingTask");this._loadingTask=yi,this.prefetchStrategy&&this.prefetchStrategy.setLoadingTask(yi),yi.transportPromise.then(()=>{const{prefetchStrategy:vi}=this;yi._transport.messageHandler.on("PrefetchPage0Data",async()=>{if(!vi||!vi.isValid())return null;await vi.ensurePageData(0)}),yi._transport.messageHandler.on("PrefetchFirstViewData",async bi=>{if(!vi||!vi.isValid())return null;await vi.ensurePageData(1);try{const _i=Number(bi);Number.isNaN(_i)||await(vi==null?void 0:vi.ensurePageData(_i))}catch{console.error("Prefetch the last page data failed!")}})}),this.workerIsReady.promise.then(()=>{const{messageHandler:vi}=this,{docId:bi}=yi,_i=this.appOptions.get("systemFontListURL"),$i=this.appOptions.get("fontHostServer");vi.send("40b3dae6c20fa5c6a8a0f334f35b7554",{docId:bi,appOptions:{enableAutoRotateScannedPage:this.appOptions.userOptions.enableAutoRotateScannedPage,apiDocId:this.appOptions.userOptions.apiDocId,apiPrefix:this.appOptions.userOptions.apiPrefix},systemFontListURL:_i,fontHostServer:$i,wordsFileSrc:this.appOptions.get("wordsFileSrc")}),this.setMessageHandler(bi)}),this.workerIsReady.promise.then(()=>{yi.promise.then(async vi=>{var bi;if(yi.destroyed)return;const _i=yi._transport._fullReader;await _i._headersReady;let $i=new Uint8Array(_i.contentLength);_i.isRangeSupported||($i=await vi.getData());const Pi=await this._docHandlerCapability.promise,Ai=this.appOptions.get("wasmPath")||"/static/pdflux.wasm",Si=this.appOptions.get("isDesktopEnv")||!1,Ei=this.appOptions.get("disableExternalFont")||!1,wi=this.appOptions.get("enableWordSegmentation")||!1,Ci=this.appOptions.get("enableLoadLinearizedPdf")||!1,ki=this.appOptions.get("enableCachePassword")||!1,xi=this.appOptions.get("defaultUrl"),Ti=(bi=this._loadingTask)===null||bi===void 0?void 0:bi._transport,Oi=this.appOptions.get("keepInvisibleText");let ji={password:""};ki&&(ji.password=a$h(xi));try{Ti._passwordCapability&&(ji=await Ti._passwordCapability.promise,ki&&i$a({url:xi,password:ji.password}))}catch{console.error("wrong password")}const Li={data:$i,wasmPath:Ai,password:ji.password,isDesktopEnv:Si,disableExternalFont:Ei,isRangeSupported:_i.isRangeSupported,enableWordSegmentation:wi,enableLoadLinearizedPdf:Ci,keepInvisibleText:Oi};Pi==null||Pi.send("4866e9e33c823a8d5543744fd5903c3c",Li,[Li.data.buffer])})})}function x$l(){const yi=[this._docHandlerCapability.promise,this._docLoadedCapability.promise];return Promise.allSettled(yi)}async function G$c(){var yi;await this.idPdfiumReady,(yi=this.docHandler)===null||yi===void 0||yi.sendWithPromise("30ad8f8fbccac7cf713be9b3090f9662")}async function O$r(yi){var vi;return await this.idPdfiumReady,await((vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("993f1dddc1bf76a22938fa27725e597e",yi))}async function I$k(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("82d89d9fd09ee4f56b14f75fc6fab5ea",yi)}async function L$g(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("7038fc11b29eb81569e11289014c2015",yi)}async function E$n(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("14d81fb0dbb80c9d327ff3202f7cbd28",yi)}async function A$p(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("1bf93ea6c204608162f7e7717d2fd45c",yi)}async function B$d(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("451168b6d282bacc0510744c102ae60d",yi)}async function M$h(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("59d138d9b2b320b0bf6dae632d236d6b",yi)}async function N$i(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("5b7a21e557bd9012720100308697f769",yi)}async function z$e(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("ab0a04dc5f03993a613c50e4b255a72c",yi)}async function F$g(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("fd5eb71dab9211618a58554653bea150",yi)}async function U$d(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("e92b72b7ee074427f0038ecf00683bb5",yi)}async function V$h(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("707eef544def53bbc37844acb70516cf",yi)}async function q$b(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("e9b1d1a07e51f90da8941042dbebee85",yi)}async function J$e(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("6bf92e81b46261875d8622f2673fbc23",yi)}async function j$c(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("d9c3a1fe81a4e9e9f06effa3e5dfe3cc",yi)}async function K$8(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("885aa83539a116e7087b8344ca89ba7e",yi)}async function Q$b(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("edee9e85ea9cea876be620473f9b3e21",yi)}async function X$c(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("c79c0780a929b1632065e380d9a5d17f",yi)}async function Y$c(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("5988cfdd48320d172689295e648b257f",yi)}async function Z$a(){var yi;return await this.idPdfiumReady,(yi=this.docHandler)===null||yi===void 0?void 0:yi.sendWithPromise("1023b99daf7726d96d4977bcbb25a3fb")}async function ee$3(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("227505aee1e83523e717dc06ffe040ad",yi)}async function te$3(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("1a0f2218baaca445f45bd32738ce41d2",yi)}async function ae$2(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("50d8f6f253df9db505f7ee240bec61ea",yi)}async function ne$3(){var yi;return await this.idPdfiumReady,(yi=this.docHandler)===null||yi===void 0?void 0:yi.sendWithPromise("2dde3edd42abf97b616f21a36cb1e9f2")}async function re$2(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("7a6248b086e1d0da242222904ce5de34",yi)}async function ie$3(){var yi,vi,bi;await this.idPdfiumReady;const _i=await((yi=this.docHandler)===null||yi===void 0?void 0:yi.sendWithPromise("a05e73a4384a93c5f25834399b168945"));return(vi=this.docHandler)===null||vi===void 0||vi.destroy(),(bi=this.messageHandler)===null||bi===void 0||bi.destroy(),_i}async function se$3(yi){var vi,bi;(vi=this.messageHandler)===null||vi===void 0||vi.send("8ecfc86efc208e0b82806e097950c6d9",yi),await this.idPdfiumReady,await((bi=this.docHandler)===null||bi===void 0?void 0:bi.sendWithPromise("8ecfc86efc208e0b82806e097950c6d9",yi))}async function de$1(){var yi;return await this.idPdfiumReady,(yi=this.docHandler)===null||yi===void 0?void 0:yi.sendWithPromise("c8c97234b5bfe8b2df8ee8a73b16b8ac")}async function oe$2(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("47c0201f546dfff5d39071e8008029eb",yi)}async function ce$2(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("62735b06496c06e838be629eb4fd1133",yi)}async function le$2(yi){var vi;return await this.idPdfiumReady,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("e82b44a353fe682eecb8ae34e94b7861",yi)}async function he$2(yi){var vi;return await this._docHandlerCapability.promise,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("8344edd7d7b90479d064e9d17a5b8736",yi)}async function ue$1(yi){var vi;return await this._docHandlerCapability.promise,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("c0dc801a102b706b6570b6072765a887",yi)}async function fe(yi){var vi;return await this._docHandlerCapability.promise,(vi=this.docHandler)===null||vi===void 0?void 0:vi.sendWithPromise("b78143d7db40fb3e614820887af3352e",yi)}class pe{constructor(vi,bi){return S$n.call(this,vi,bi)}setMessageHandler(vi){return $$d.call(this,vi)}set loadingTask(vi){return D$n.call(this,vi)}get idPdfiumReady(){return x$l.call(this)}async loadDocSegment(){return G$c.call(this)}async getImageData(vi){return O$r.call(this,vi)}async getPageScannedResult(vi){return I$k.call(this,vi)}async getDocumentOutline(vi=!1){return L$g.call(this,vi)}async getTextAtRect(vi){return E$n.call(this,vi)}async getIndexNearPoint(vi){return A$p.call(this,vi)}async getTextInRectWithoutLineBreak(vi){return B$d.call(this,vi)}async getCharBox(vi){return M$h.call(this,vi)}async getPageAngle(vi){return N$i.call(this,vi)}async getText(vi){return z$e.call(this,vi)}async getCountChars(vi){return F$g.call(this,vi)}async getExpandWord(vi){return U$d.call(this,vi)}async getExpandSentence(vi){return V$h.call(this,vi)}async getSentenceCountInText(vi){return q$b.call(this,vi)}async selectTextInElementBlock(vi){return J$e.call(this,vi)}async getRects(vi){return j$c.call(this,vi)}async getCharRects(vi){return K$8.call(this,vi)}async getNeighborIndexes(vi){return Q$b.call(this,vi)}async setElementBlock(vi){return X$c.call(this,vi)}async cleanup(vi){return Y$c.call(this,vi)}async getAnnotations(){return Z$a.call(this)}async getPageAnnotations(vi){return ee$3.call(this,vi)}async getElementBlockInfos(vi){return te$3.call(this,vi)}async setAnnotations(vi){return ae$2.call(this,vi)}async saveDocument(){return ne$3.call(this)}async loadPage(vi){return re$2.call(this,vi)}async destroyLibrary(){return ie$3.call(this)}async setWasmConfig(vi){return se$3.call(this,vi)}async getDocLayers(){return de$1.call(this)}async getCharStyle(vi){return oe$2.call(this,vi)}async getColorAtPoint(vi){return ce$2.call(this,vi)}async getPageRotation(vi){return le$2.call(this,vi)}async getRange(vi){return he$2.call(this,vi)}async prefetchPageData(vi){return ue$1.call(this,vi)}async getWordSegment(vi){return fe.call(this,vi)}}var We$2=pe;function s$d(yi){_defineProperty(this,"MAX_SCALE",component_viewerExports.MAX_SCALE),_defineProperty(this,"MIN_SCALE",component_viewerExports.MIN_SCALE),this.viewerApp=yi,this.helper=yi.helper;const{helper:vi}=this;this.zoomIn=vi.webViewerZoomIn,this.zoomOut=vi.webViewerZoomOut,this.zoomReset=vi.webViewerZoomReset,this.goPreviousPage=vi.webViewerPreviousPage,this.goNextPage=vi.webViewerNextPage,this.goFirstPage=vi.webViewerFirstPage,this.goLastPage=vi.webViewerLastPage,this.print=vi.webViewerPrint,this.download=vi.webViewerDownload,this.openFile=vi.webViewerOpenFile}function l$g(){return[...this.viewerApp.toolbar.items.scaleSelect.options].map(yi=>({value:yi.value,label:yi.innerText}))}function a$g(yi){this.helper.webViewerScaleChanged({value:yi})}function n$7(yi){this.helper.webViewerPageNumberChanged({value:yi})}function h$h(yi){yi===1?this.helper.webViewerRotateCw():this.helper.webViewerRotateCcw()}let w$p=class{constructor(vi){return s$d.call(this,vi)}getScalePresetValues(){return l$g.call(this)}setViewerScale(vi){return a$g.call(this,vi)}goPageByNumber(vi){return n$7.call(this,vi)}rotate(vi=1){return h$h.call(this,vi)}};var b$j=w$p;function o$a(yi,vi,bi){component_viewerExports.EventBus.prototype.on.call(this,yi,vi,bi)}function i$9(yi,vi){component_viewerExports.EventBus.prototype.off.call(this,yi,vi)}function r$c(yi,vi){component_viewerExports.EventBus.prototype.dispatch.call(this,yi,vi)}function c$o(yi){yi?this._listeners[yi]=[]:this._listeners=Object.create(null)}let h$g=class extends component_viewerExports.EventBus{on(vi,bi,_i){return o$a.call(this,vi,bi,_i)}off(vi,bi){return i$9.call(this,vi,bi)}dispatch(vi,bi){return r$c.call(this,vi,bi)}clear(vi){return c$o.call(this,vi)}};const m$s=[{icon:"text-box",widgetType:E$p[28],title:"选择文本"},{icon:"vector-square-solid",widgetType:E$p[5],title:"矩形"},{icon:"table-solid",widgetType:E$p[27],title:"表格"},{icon:"comments",widgetType:E$p[1],title:"Note"},{icon:"line",widgetType:E$p[4],title:"直线"},{icon:"Ink",widgetType:E$p[15],title:"画笔"},{icon:"polygon",widgetType:E$p[7],title:"多边形"},{icon:"polyline",widgetType:E$p[8],title:"折线"},{icon:"text-diff",widgetType:E$p[101],title:"编辑文本"}];var n$6=new WeakMap;function g$l(yi){_defineProperty(this,"dom",null),_defineProperty(this,"isOpened",!1),_classPrivateFieldInitSpec(this,n$6,{writable:!0,value:null}),_defineProperty(this,"eventBus",new h$g),_defineProperty(this,"menuItems",[...m$s]),this.options=yi,this.dom=this.createView()}function w$o(yi){this.dom&&(this.isOpened=yi,yi?this.dom.classList.add("mark-opened"):this.dom.classList.remove("mark-opened"))}function v$n(){const yi=document.createElement("div"),vi=["mark-buttons-wrapper","menu"];yi.classList.add(...vi);const bi=M$l("marker-solid");bi.classList.add("marker-icon"),bi.addEventListener("click",()=>{this.setOpen(!this.isOpened)});const _i=document.createElement("ul");return _i.addEventListener("click",$i=>{const Pi=$i.target.closest("li");if(Pi){const{widgetType:Ai}=Pi.dataset;this.handleUpdate(Ai)}}),m$s.forEach($i=>{const Pi=document.createElement("li");Pi.dataset.widgetType=$i.widgetType,Pi.setAttribute("title",$i.title);const Ai=M$l($i.icon);Pi.appendChild(Ai),$i.el=Pi,_i.append(Pi)}),yi.appendChild(bi),yi.appendChild(_i),yi}function _$n(yi){if(!yi)this.selected=null;else{const vi=this.menuItems.find(bi=>bi.widgetType===yi);if(vi)this.selected=vi;else throw new Error(`不被支持的控件类型 ${yi}`)}}function y$q(){return _classPrivateFieldGet(this,n$6)}function I$j(yi){if(this.menuItems.forEach(bi=>{var _i;(_i=bi.el)===null||_i===void 0||_i.classList.remove("widget-icon-selected")}),_classPrivateFieldGet(this,n$6)===yi)_classPrivateFieldSet(this,n$6,null);else if(_classPrivateFieldSet(this,n$6,yi),_classPrivateFieldGet(this,n$6)){var vi;(vi=_classPrivateFieldGet(this,n$6).el)===null||vi===void 0||vi.classList.add("widget-icon-selected")}this.eventBus.dispatch("widgetMenuItemChange",{..._classPrivateFieldGet(this,n$6)})}function T$i(){this.selected=null}function M$g(){var yi;(yi=this.dom)===null||yi===void 0||yi.remove()}let k$l=class{constructor(vi){return g$l.call(this,vi)}setOpen(vi){return w$o.call(this,vi)}createView(){return v$n.call(this)}handleUpdate(vi){return _$n.call(this,vi)}get selected(){return y$q.call(this)}set selected(vi){return I$j.call(this,vi)}reset(){return T$i.call(this)}destroy(){return M$g.call(this)}};var f$j=new WeakMap,P$n=new WeakSet,A$o=new WeakSet;function M$f(){return this.config.dom}function x$k(yi){_classPrivateMethodInitSpec(this,A$o),_classPrivateMethodInitSpec(this,P$n),_classPrivateFieldInitSpec(this,f$j,{writable:!0,value:void 0}),_defineProperty(this,"outline",[0,0,0,0]),_defineProperty(this,"originalOutline",[0,0,0,0]),_defineProperty(this,"activated",!1),this.config=yi,_classPrivateFieldSet(this,f$j,_classPrivateMethodGet(this,P$n,G$b).bind(this))}function E$m(){const yi=this.config.getContext();return this.originalOutline=yi.outline,this.outline=yi.outline,yi}function w$n(yi){const{outline:vi}=this.config.getContext(),[bi,_i]=yi.dataset.position.split(",").map(Number),$i=Math.abs(vi[2]-vi[0]),Pi=Math.abs(vi[3]-vi[1]);yi.setAttribute("cx",`${$i*bi}`),yi.setAttribute("cy",`${Pi*_i}`)}function U$c(){this.activated=!0,this.setup();const{resizePoints:yi}=this.config.getContext(),vi=document.createDocumentFragment();yt$3(yi).forEach(bi=>{this.updateCirclePosition(bi),bi.addEventListener("mousedown",_classPrivateFieldGet(this,f$j)),vi.appendChild(bi)}),this.container.appendChild(vi)}function F$f(){this.activated=!1,this.container.querySelectorAll(".resize-point").forEach(yi=>{yi.removeEventListener("mousedown",_classPrivateFieldGet(this,f$j)),yi.remove()}),this.cleanup()}function I$i(){this.container.querySelectorAll(".resize-point").forEach(yi=>{this.updateCirclePosition(yi)})}function O$q(yi,vi,bi){const[_i,$i]=bi,{outline:Pi}=this,Ai=this.originalOutline.slice(0,2),Si=this.originalOutline.slice(2,4);if($i===.5){if(_i===0){[,vi]=Pi,this.outline=[yi,vi,...Si];return}if(_i===1){[,,,vi]=Pi,this.outline=[...Ai,yi,vi];return}}if(_i===.5){if($i===0){[yi]=Pi,this.outline=[yi,vi,...Si];return}if($i===1){[,,yi]=Pi,this.outline=[...Ai,yi,vi];return}}if(_i===0&&$i===0){this.outline=[yi,vi,...Si];return}if(_i===1&&$i===1){this.outline=[...Ai,yi,vi];return}if(_i===0&&$i===1){this.outline=[yi,Ai[1],Si[0],vi];return}_i===1&&$i===0&&(this.outline=[Ai[0],vi,yi,Si[1]])}function D$m(){this.currentResizePoint=void 0,this.outline=[0,0,0,0],this.originalOutline=[0,0,0,0]}function k$k(){this.config.onDimensionsUpdated(this.outline)}let R$h=class{get container(){return M$f.call(this)}constructor(vi){return x$k.call(this,vi)}setup(){return E$m.call(this)}updateCirclePosition(vi){return w$n.call(this,vi)}enable(){return U$c.call(this)}disable(){return F$f.call(this)}updatePoints(){return I$i.call(this)}resize(vi,bi,_i=[1,1]){return O$q.call(this,vi,bi,_i)}cleanup(){return D$m.call(this)}handleUpdate(){return k$k.call(this)}};function G$b(yi){this.setup();const vi=yi.target,bi=_classPrivateMethodGet(this,A$o,N$h).bind(this),_i=this.container.closest(".annotationLayer");this.container.classList.add("resizing"),vi.dataset&&vi.dataset.position&&(_i.addEventListener("mousemove",bi),this.currentResizePoint=vi.dataset.position.split(",").map(Number),document.addEventListener("mouseup",()=>{_i.removeEventListener("mousemove",bi),this.config.onResizeDone(),this.container.classList.remove("resizing")},{once:!0}))}function N$h(yi){if(yi.stopPropagation(),!this.currentResizePoint)return;const vi=this.currentResizePoint;if(localStorage.getItem("USE_OCR_LABEL_RESIZE")){const{movementX:bi,movementY:_i}=yi,[$i,Pi,Ai,Si]=this.outline,[Ei,wi]=vi,Ci=$i+(Ai-$i)*Ei+bi,ki=Pi+(Si-Pi)*wi+_i;this.resize(Ci,ki,vi)}else{const bi=this.container.closest(".annotationLayer").getBoundingClientRect(),{clientX:_i,clientY:$i}=yi;this.resize(_i-bi.left,$i-bi.top,vi)}this.updatePoints(),this.handleUpdate()}var c$n=new WeakMap;function W$j(yi){_classPrivateFieldInitSpec(this,c$n,{writable:!0,value:[]})}function X$b(){const yi=R$h.prototype.setup.call(this);_classPrivateFieldSet(this,c$n,yi.lineCoordinates)}function Y$b(yi,vi,bi){const[_i,$i]=bi,[Pi,Ai,Si,Ei]=_classPrivateFieldGet(this,c$n);_i===0&&$i===0?_classPrivateFieldSet(this,c$n,[yi,vi,Si,Ei]):_classPrivateFieldSet(this,c$n,[Pi,Ai,yi,vi])}function $$c(yi){const vi=this.config.getContext(),[bi,_i]=vi.outline,[$i,Pi]=yi.dataset.position.split(",").map(Number),[Ai,Si,Ei,wi]=vi.lineCoordinates;let Ci=0,ki=0;const xi=Math.sqrt((Ei-Ai)**2+(wi-Si)**2);if(xi>0){const Ti=Number(yi.getAttribute("r")),Oi=(Ei-Ai)/xi,ji=(wi-Si)/xi;Ci=Oi*Ti,ki=ji*Ti}$i===0&&Pi===0?(yi.setAttribute("cx",String(Ai-Ci)),yi.setAttribute("cy",String(Si-ki))):(yi.setAttribute("cx",String(Ei+Ci)),yi.setAttribute("cy",String(wi+ki))),yi.setAttribute("transform",`translate(-${bi},-${_i})`)}function q$a(){this.config.onDimensionsUpdated(_classPrivateFieldGet(this,c$n))}let Q$a=class extends R$h{constructor(...vi){return super(...vi),W$j.call(this,vi)}setup(){return X$b.call(this)}resize(vi,bi,_i=[1,1]){return Y$b.call(this,vi,bi,_i)}updateCirclePosition(vi){return $$c.call(this,vi)}handleUpdate(){return q$a.call(this)}};function H$d(yi){return yi.map(vi=>`${vi}`).join("")}const T$h=document.createElement("ul");T$h.classList.add("annotation-tag-list");const f$i=Symbol("identification"),j$b=["click","mouseenter","mouseleave","dblclick","mousedown"],P$m=["annotation"];var A$n=new WeakMap,g$k=new WeakMap,E$l=new WeakMap,p$h=new WeakMap,w$m=new WeakMap,v$m=new WeakMap,C$l=new WeakSet,y$p=new WeakSet;function Z$9(){return this.widget.contentEl}function q$9(){return{x:this.outline[0],y:this.outline[1]}}function J$d(yi){this.data.annotationType!==E$p.Popup&&(this.widget.zIndex=yi)}function Y$a(){return this.data.annotationType!==E$p.Popup?this.widget.zIndex:0}function Q$9(yi){const{x:vi,y:bi}=this.transformCoordinates;return yi>0?`translate(${vi}, ${bi})`:`translate(${-vi}, ${-bi})`}function K$7(yi){return et$9(yi,0)}function X$a(yi,vi,bi,_i){var $i;_classPrivateMethodInitSpec(this,y$p),_classPrivateMethodInitSpec(this,C$l),_classPrivateFieldInitSpec(this,A$n,{writable:!0,value:void 0}),_defineProperty(this,"resizePoints",T$m),_defineProperty(this,"isResizeEnable",!0),_classPrivateFieldInitSpec(this,g$k,{writable:!0,value:!0}),_classPrivateFieldInitSpec(this,E$l,{writable:!0,value:!1}),_defineProperty(this,"autoFocusOnClick",!0),_defineProperty(this,"autoFocusOnEnter",!1),_defineProperty(this,"initialized",!1),_classPrivateFieldInitSpec(this,p$h,{writable:!0,value:!1}),_defineProperty(this,"className",[...P$m]),_defineProperty(this,"dataset",[]),_defineProperty(this,"destroyed",!1),_classPrivateFieldInitSpec(this,w$m,{writable:!0,value:[]}),_defineProperty(this,"ignoreBorder",!1),_defineProperty(this,"editable",!0),_defineProperty(this,"resizeAbility",null),_defineProperty(this,"events",[...j$b]),_defineProperty(this,f$i,!1),_classPrivateFieldInitSpec(this,v$m,{writable:!0,value:Ai=>{const Si=`annot-${Ai.type}`;if(this.eventBus.dispatch(Si,{eventName:Si,annotation:this,event:Ai}),Ai.type==="click"){this.autoFocusOnClick&&(this.focus=!0),localStorage.getItem("PDF_VIEWER_DEBUG");return}Ai.type==="mouseenter"&&this.autoFocusOnEnter&&(this.focus=!0)}}),_classPrivateFieldSet(this,A$n,yi.data.id),this.subtype=E$p[yi.data.annotationType],this.parameters=yi,this.setCommonFieldsBasedData(yi.data),this.author=yi.author(),this.ignoreBorder=bi,this.annotationService=yi.annotationService,this.data.dataset&&(this.dataset=[...this.dataset,...this.data.dataset||[]]),this.data.classNames&&(this.className=[...this.className,...this.data.classNames||[]]),this.tagsContainer=yi.tagsContainer,this.layer=yi.layer,this.editable=this.checkEditable(yi.data.authorID),this[f$i]=($i=yi.data.identification||/pdflux-identification/.test(yi.data.customType||""))!==null&&$i!==void 0?$i:!1,this.isResizeEnable=!this[f$i];const Pi=!!this[f$i];this.widget=this.createWidget({...this.parameters,zIndex:this.annotationService.getWidgetMaxZIndex(this.pageNumber)+1},{ignoreBorder:bi,useViewRotation:Pi,allowCrossPageBoundary:Pi}),this.widget&&(yi.annotationService.UIEventBus.dispatch(J$h,this.widget),this.tags=yi.data.tags||[])}function tt$8(yi){var vi;const bi={borderWidth:(vi=this.data.borderStyle)===null||vi===void 0?void 0:vi.width,dom:this.widget.svg,onDimensionsUpdated:$i=>{this.setOutline($i)},onResizeDone:()=>{this.eventBus.dispatch(m$v,this)},getContext:()=>({outline:this.outline,resizePoints:this.resizePoints})};yi&&Object.assign(bi,yi);const _i=new R$h(bi);return this.widget.resizeAbility=_i,_i}function et$8(yi){return this.quadrilaterals&&this.widget.svg.append(...this.quadrilaterals),this.addAttributes(this.widget.dom,yi),this.widget.dom}function it$8(yi,vi){const{customType:bi,subj:_i}=vi;yi.classList.add(...this.className),yi.dataset.subtype=this.subtype,bi&&(yi.dataset.customType=bi),_i&&(yi.dataset.subj=_i),this.dataset.forEach(([$i,Pi])=>{yi.dataset[$i]=Pi||""})}function nt$8(yi,vi){const{customType:bi,subj:_i}=vi;yi.classList.add(...this.className),bi&&(yi.dataset.customType=bi),_i&&(yi.dataset.subj=_i),this.dataset.forEach(([$i,Pi])=>{yi.dataset[$i]=Pi}),this.widget.applyStyles(yi,vi)}function st$8(yi,vi){if(yi){if(E$p[yi]!==void 0)throw new Error(`Unexpected custom type "${yi}", please use registered custom type`);const{customAnnotClassMap:bi}=this.parameters.annotationService;if(!bi.has(yi))throw new Error(`the custom type "${yi}" is not registered, please check`);if(vi&&E$p[bi.get(yi).ParentType]!==this.subtype)throw new Error(`The current custom type '${yi}' does not match the parent type '${this.subtype}'`)}}function at$8(yi){const vi=yi[2]-yi[0],bi=yi[3]-yi[1];return vi!==0&&bi!==0&&(yi=vt$3(this.viewportInfo,yi)),yi.map(_i=>_i*this.pageInfo.viewport.scale)}function ot$8(yi){const{customType:vi}=yi;yi.dataset=Tt$3(yi.dataset),this.data=yi,this.customType=vi}function rt$8(yi){this.widget.updateByData(yi),this.onOutlineUpdated()}function lt$7(yi){const{customType:vi}=yi;this.validateCustomType(vi);const bi=this.getPopupAnnotationElement();bi&&(bi==null||bi.update())}function ht$6(yi){const{tags:vi=[],customType:bi}=yi;this.validateCustomType(bi,!0);const _i=this.customType;yi.dataset=Tt$3(yi.dataset),this.data=yi,this.customType=bi,this.tags=vi,this.updateViewByData(this.data);const $i=this.getPopupAnnotationElement();if($i&&$i.update(),_i!==bi&&(this.eventBus.dispatch(H$g,this),bi)){const{customAnnotConfigMap:Pi}=this.parameters.annotationService,{classNames:Ai=[],dataset:Si=[]}=Pi.get(bi);this.container.classList.remove(...this.className),this.dataset.forEach(([Ei])=>{delete this.container.dataset[Ei]}),this.className=[...P$m,...Ai],this.dataset=[...yi.dataset||[],...Si]}return this.updateAttributes(this.container,yi),this.container}function ut$7(){return _classPrivateFieldGet(this,g$k)&&(this.container.classList.add("always-show"),this.setTagVisible(!0)),_classPrivateMethodGet(this,C$l,se$2).call(this),this.initialized=!0,this.eventBus.dispatch(V$k,this),this.container}function ct$7(){return this.parameters.annotationService.APPEventBus}function dt$5(){return _classPrivateFieldGet(this,A$n)}function mt$4(){return this.pageInfo.scale}function ft$4(){return this.pageInfo.pageNumber}function gt$5(){return this.widget.outline}function pt$5(){return this.subtype===E$p[16]}async function _t$4(){const{authorID:yi}=this.parameters.data;let vi;return yi&&(vi=await this.parameters.annotationService.getAvatar(yi)),vi}function At$1(yi){this.widget.setOutline(yi),this.onOutlineUpdated()}function Et$2(){this.isPopup||_classPrivateMethodGet(this,y$p,I$h).call(this),this.syncWithPopupAnnotationView(),this.initialized&&this.eventBus.dispatch(w$s,this)}function wt$3(){const yi=this.getPopupAnnotationElement();yi&&(!yi.alignAnnotInfo||yi.alignAnnotInfo.id===this.id)&&(yi==null||yi.setAlignAnnotInfo(this))}function vt$2(){return this.widget.width}function yt$2(){return this.widget.height}function bt$2(yi){yi?this.container.classList.add("always-show"):(this.isAlwaysShowControlBar=yi,this.container.classList.remove("always-show")),_classPrivateFieldSet(this,g$k,yi),this.setTagVisible(yi)}function St$3(){return _classPrivateFieldGet(this,g$k)}function Tt$2(yi){if(yi&&!this.isAlwaysShow)throw new Error('Property "isAlwaysShow" must first be set to true');_classPrivateFieldSet(this,E$l,yi),this.setCtrlBarVisibility(yi)}function Pt$2(){return _classPrivateFieldGet(this,E$l)}function Ct$1(){return this.parameters.getPageInfo()}function It$2(){return this.pageInfo.viewport}function Bt$1(){let{viewBox:yi,rotation:vi,scale:bi}=this.viewport;this[f$i]&&(vi=this.pageInfo.rotation);const[_i,$i,Pi,Ai]=yi,Si=Pi-_i,Ei=Ai-$i;return{width:Si,height:Ei,rotation:vi,scale:bi}}function Lt$1(yi,vi){this.widget.move(yi,vi),this.onOutlineUpdated()}function Nt$1(yi){this.widget.moveEnd(yi),this.eventBus.dispatch(n$9,this)}function Dt$1(yi,vi,bi,_i){this.widget.drawing(yi,vi,bi,_i)}async function Rt$2(yi,vi){if(vi&&!this.check()){this.destroy();return}this.widget.handleDrawEnd(),this.focus=yi!=null?yi:this.focus,this.eventBus.dispatch(u$i,this)}function Ut$1(){return this.widget.isDrawing}function zt$1(){return[this.widget.outline[0],this.widget.outline[1]]}function Ot$1(){return[this.widget.outline[0],this.widget.outline[1]]}function xt$3(yi){yi?this.eventBus.dispatch(a$i,this):this.eventBus.dispatch(U$h,this)}function Vt$1(yi){if(this.tagUL){if(this.focus||this.isAlwaysShow||yi){this.tagUL.classList.add("show");return}!this.focus&&!this.isAlwaysShow&&this.tagUL.classList.remove("show")}}function kt$1(){var yi;this.destroyed||((yi=this.tagUL)===null||yi===void 0||yi.remove(),this.destroyed=!0,this.tagUL=void 0,this.tagsContainer=void 0,this.parameters.annotationService.removeAnnotation(this.id),this.eventBus.dispatch(b$l,this))}function Ft$1(){return _classPrivateFieldGet(this,p$h)}function Mt$1(yi){if(_classPrivateFieldGet(this,p$h)===yi)return;_classPrivateFieldSet(this,p$h,yi),yi?(this.container.classList.add("focus"),this.enableResize(),this.eventBus.dispatch(P$q,this)):(this.container.classList.remove("focus"),this.disableResize(),this.eventBus.dispatch(g$m,this)),this.setTagVisible(yi);const vi=this.getPopupAnnotationElement();vi&&(yi&&vi.setAlignAnnotInfo(this),vi.toggleVisible(yi))}function Wt$1(){if(this.editable&&this.isResizeEnable){var yi;this.addClass("resizable"),(yi=this.resizeAbility)===null||yi===void 0||yi.enable()}}function Gt$1(){if(this.editable){var yi;this.removeClass("resizable"),(yi=this.resizeAbility)===null||yi===void 0||yi.disable()}}function $t$1(yi){yi?this.widget.freeze():this.widget.unfreeze()}function Ht$1(){return this.widget.isFrozen}function jt$1(yi){if(_classPrivateFieldSet(this,w$m,yi),this.tagUL&&(this.tagUL.remove(),this.tagUL=void 0),yi.length){var vi,bi;this.tagUL=T$h.cloneNode(),_classPrivateMethodGet(this,y$p,I$h).call(this),this.tagUL.innerHTML=H$d(this.tags),this.tagUL.dataset.annot=this.id,this.tagUL.dataset.annotType=(vi=this.customType)!==null&&vi!==void 0?vi:this.subtype,this.setTagVisible(this.focus),(bi=this.tagsContainer)===null||bi===void 0||bi.appendChild(this.tagUL)}}function Zt$1(){return _classPrivateFieldGet(this,w$m)}function qt$2(yi){this.container.classList.add(...yi)}function Jt$1(yi){this.container.classList.remove(...yi)}function Yt$1(){return{...this.data,rect:this.widget.getViewBoxRect(),tags:this.tags}}function Qt$1(yi){_classPrivateFieldGet(this,v$m).call(this,yi)}function Kt$1(){return this.parameters.data.parentId?this.annotationService.getAnnotations(yi=>yi.id===this.parameters.data.parentId)[0]:this.parameters.data.inReplyTo?this.annotationService.getAnnotations(yi=>yi.id===this.parameters.data.inReplyTo)[0]:null}function Xt$1(){return this.parameters.data.popupId?this.annotationService.getAnnotations(yi=>yi.id===this.parameters.data.popupId)[0]:null}function te$2(yi){return yi?yi===this.parameters.authorID():!0}function ee$2(){return this.widget.getText()}function ie$2(yi){this.controlBar=yi}let ne$2=class{get content(){return Z$9.call(this)}get transformCoordinates(){return q$9.call(this)}set zIndex(vi){return J$d.call(this,vi)}get zIndex(){return Y$a.call(this)}getTransformStyleAttr(vi=1){return Q$9.call(this,vi)}parseColor(vi){return K$7.call(this,vi)}constructor(vi,{isRenderable:bi=!1,ignoreBorder:_i=!1,createQuadrilaterals:$i=!1}={}){return X$a.call(this,vi,bi,_i,$i)}createResizeAbility(vi){return tt$8.call(this,vi)}createView(vi){return et$8.call(this,vi)}addAttributes(vi,bi){return it$8.call(this,vi,bi)}updateAttributes(vi,bi){return nt$8.call(this,vi,bi)}validateCustomType(vi,bi=!1){return st$8.call(this,vi,bi)}parseRect(vi){return at$8.call(this,vi)}setCommonFieldsBasedData(vi){return ot$8.call(this,vi)}updateViewByData(vi){return rt$8.call(this,vi)}initialize(vi){return lt$7.call(this,vi)}update(vi){return ht$6.call(this,vi)}render(){return ut$7.call(this)}get eventBus(){return ct$7.call(this)}get id(){return dt$5.call(this)}get scale(){return mt$4.call(this)}get pageNumber(){return ft$4.call(this)}get outline(){return gt$5.call(this)}get isPopup(){return pt$5.call(this)}async getAvatar(){return _t$4.call(this)}setOutline(vi){return At$1.call(this,vi)}onOutlineUpdated(){return Et$2.call(this)}syncWithPopupAnnotationView(){return wt$3.call(this)}get width(){return vt$2.call(this)}get height(){return yt$2.call(this)}set isAlwaysShow(vi){return bt$2.call(this,vi)}get isAlwaysShow(){return St$3.call(this)}set isAlwaysShowControlBar(vi){return Tt$2.call(this,vi)}get isAlwaysShowControlBar(){return Pt$2.call(this)}get pageInfo(){return Ct$1.call(this)}get viewport(){return It$2.call(this)}get viewportInfo(){return Bt$1.call(this)}move(vi,bi){return Lt$1.call(this,vi,bi)}moveEnd(vi){return Nt$1.call(this,vi)}drawing(vi,bi,_i,$i){return Dt$1.call(this,vi,bi,_i,$i)}async drawingEnd(vi,bi=!0){return Rt$2.call(this,vi,bi)}get isDrawing(){return Ut$1.call(this)}get startPoint(){return zt$1.call(this)}get ctrlBarPoint(){return Ot$1.call(this)}setCtrlBarVisibility(vi=!1){return xt$3.call(this,vi)}setTagVisible(vi=!1){return Vt$1.call(this,vi)}destroy(){return kt$1.call(this)}get focus(){return Ft$1.call(this)}set focus(vi){return Mt$1.call(this,vi)}enableResize(){return Wt$1.call(this)}disableResize(){return Gt$1.call(this)}set locked(vi){return $t$1.call(this,vi)}get locked(){return Ht$1.call(this)}set tags(vi){return jt$1.call(this,vi)}get tags(){return Zt$1.call(this)}addClass(...vi){return qt$2.call(this,vi)}removeClass(...vi){return Jt$1.call(this,vi)}toJSON(){return Yt$1.call(this)}triggerEvent(vi){return Qt$1.call(this,vi)}getParentAnnotationElement(){return Kt$1.call(this)}getPopupAnnotationElement(){return Xt$1.call(this)}checkEditable(vi){return te$2.call(this,vi)}getText(){return ee$2.call(this)}setControlBar(vi){return ie$2.call(this,vi)}};function se$2(){this.locked||this.subtype==="SelectText"||this.events.forEach(yi=>{this.container.addEventListener(yi,_classPrivateFieldGet(this,v$m))})}function I$h(){const{tagUL:yi,width:vi,height:bi}=this,_i=[this.widget.outline[0],this.widget.outline[1]];yi&&(yi.style.setProperty("--top",`${_i[1]}px`),yi.style.setProperty("--left",`${_i[0]}px`),yi.style.setProperty("--width",`${vi}px`),yi.style.setProperty("--height",`${bi}px`))}const L$f=T$m,F$e=["widget"],N$g=["widget-content"];var d$g=new WeakMap,c$m=new WeakMap,C$k=new WeakSet;function q$8(){var yi;return(yi=this.parameters.data.selection)===null||yi===void 0?void 0:yi.pageView}function H$c(){return this.dom.firstChild||this.dom}function K$6(yi){_classPrivateFieldSet(this,c$m,yi),this.dom.dataset.zIndex=String(_classPrivateFieldGet(this,c$m))}function k$j(){return _classPrivateFieldGet(this,c$m)}function $$b(){var yi;return(yi=this.config.allowCrossPageBoundary)!==null&&yi!==void 0?yi:!1}function Z$8(){return this.config.ignoreBorder}function j$a(){var yi;return(yi=this.config.useViewRotation)!==null&&yi!==void 0?yi:!1}function Y$9(){return this.parameters.getPageInfo()}function X$9(){const{viewBox:yi}=this.pageInfo.viewport;return{width:yi[2]-yi[0],height:yi[3]-yi[1]}}function J$c(){let{viewBox:yi,rotation:vi,scale:bi}=this.pageInfo.viewport;this.useViewRotation&&(vi=this.pageInfo.rotation);const[_i,$i,Pi,Ai]=yi,Si=Pi-_i,Ei=Ai-$i;return{width:Si,height:Ei,rotation:vi,scale:bi}}function Q$8(){return this.parameters.data.pageNumber}function tt$7(){return Math.abs(this.outline[2]-this.outline[0])}function et$7(){return Math.abs(this.outline[3]-this.outline[1])}function it$7(){return F$e}function nt$7(){return _classPrivateFieldGet(this,d$g)}function st$7(){return N$g}function rt$7(){if(this.parameters.data.borderStyle){var yi;return(yi=this.parameters.data.borderStyle.width)!==null&&yi!==void 0?yi:2}return 2}function ot$7(){return this.dom.querySelector(".widget-content")}function at$7(){return this.parameters.annotationService.UIEventBus}function lt$6(){return this.parameters.annotationService.getAuthorInfo()}function ht$5(){return this.parameters.data}function ut$6(){return this.config.ctrlKey||!1}function dt$4(){return this.config.altKey||!1}function ct$6(){return this.config.shiftKey||!1}function gt$4(yi){return et$9(yi,0)}async function ft$3(){return[this.outline[0],this.outline[1]]}function _t$3(yi,vi){_classPrivateMethodInitSpec(this,C$k),_defineProperty(this,"destroyed",!1),_defineProperty(this,"isDrawing",!1),_defineProperty(this,"resizeAbility",null),_classPrivateFieldInitSpec(this,d$g,{writable:!0,value:[0,0,0,0]}),_defineProperty(this,"isFrozen",!1),_defineProperty(this,"moving",!1),_classPrivateFieldInitSpec(this,c$m,{writable:!0,value:0}),_defineProperty(this,"editable",!0),this.id=yi.data.id,this.config=vi,this.parameters=yi,_classPrivateFieldSet(this,c$m,yi.zIndex),this.dom=_classPrivateMethodGet(this,C$k,Qt).call(this)}function pt$4(yi){const vi=yi[2]-yi[0],bi=yi[3]-yi[1];return vi!==0&&bi!==0&&(yi=vt$3(this.viewportInfo,yi)),yi.map(_i=>_i*this.pageInfo.viewport.scale)}function mt$3(yi){const vi=this.createContent(yi);return this.svg.append(vi),this.addAttributes(this.dom,yi),this.dom}function vt$1(yi){const vi=M$k("rect",...this.defaultContentClasses),bi=document.createDocumentFragment();return bi.append(vi),bi}function yt$1(yi){const vi={borderWidth:this.borderWidth,dom:this.svg,onDimensionsUpdated:bi=>{this.setOutline(bi)},onResizeDone:()=>{},getContext:()=>({outline:this.outline,resizePoints:L$f})};return yi&&Object.assign(vi,yi),new R$h(vi)}function Wt(yi){this.setOutline(this.parseRect(yi.rect)),this.onOutlineUpdated()}function wt$2(){const yi=this.toData();this.updateByData(yi),this.updateToolbar()}function bt$1(){return!0}function xt$2(yi,vi){this.dom.style.left=`${yi}px`,this.dom.style.top=`${vi}px`}function St$2(yi,vi){this.moving=!0;const[bi,_i,$i,Pi]=_classPrivateFieldGet(this,d$g),Ai=[bi+yi,_i+vi,$i+yi,Pi+vi];this.onUserMove(Ai)}function It$1(yi){this.setOutline(yi)}function Tt$1(yi){this.moving=!1,_classPrivateFieldSet(this,d$g,this.outline)}function Ct(yi){this.updateOutline(yi),this.onOutlineUpdated()}function Pt$1(){var yi;this.moveTo(this.outline[0],this.outline[1]),this.updateViewDimensions(),(yi=this.resizeAbility)!==null&&yi!==void 0&&yi.activated&&this.resizeAbility.updatePoints()}function Dt(yi,vi){this.svg.setAttribute("width",vi),this.svg.setAttribute("height",yi),this.dom.style.height=yi,this.dom.style.width=vi}function Ot(){const yi=this.dom.querySelector(".widget-content");if(!yi)return;let{width:vi}=this;this.ignoreBorder&&(vi+=8,yi.setAttribute("transform","translate(-4, -4)")),yi.setAttribute("width",`${Math.max(0,vi)}`);let{height:bi}=this;this.ignoreBorder&&(bi+=8),yi.setAttribute("height",`${Math.max(0,bi)}`),this.updateContainerSize({width:`${Math.max(1,vi)}px`,height:`${Math.max(1,bi)}px`})}function At(yi,vi){yi.dataset.zIndex=String(_classPrivateFieldGet(this,c$m)),vi.id&&(yi.dataset.id=this.id),this.ignoreBorder&&yi.classList.add("ignoreBorder"),this.applyStyles(yi,vi)}function Bt(yi,vi){if(vi.borderStyle){const{scale:bi}=this.pageInfo.viewport,{style:_i,dashArray:$i,width:Pi}=vi.borderStyle;yi.style.setProperty("--border-width",String(Pi*bi)),_i&&_i===c$q.D&&yi.style.setProperty("--border-dasharray",$i.join(" "))}vi.color&&yi.style.setProperty("--color",this.parseColor(vi.color))}function Et$1(){if(this.editable){var yi;(yi=this.resizeAbility)===null||yi===void 0||yi.enable()}}function zt(){if(this.editable){var yi;(yi=this.resizeAbility)===null||yi===void 0||yi.disable()}}function Rt$1(){const{viewportInfo:yi}=this,{scale:vi}=yi;let bi=this.outline.map(_i=>_i/vi);return bi=vt$3({...yi,rotation:-yi.rotation},bi),bi}function Vt(){this.destroyed=!0,this.dom.remove(),this.eventBus.dispatch(f$k,this)}function Ut(yi){yi=tt$a(yi);let[vi,bi,_i,$i]=yi;if(_classPrivateFieldSet(this,d$g,[vi,bi,_i,$i]),!this.allowCrossPageBoundary){const{currentWidth:Pi,currentHeight:Ai}=this.pageInfo;vi<0&&(_i-=vi,vi=0),bi<0&&($i-=bi,bi=0),_i>Pi&&(vi=Pi-(_i-vi),_i=Pi),$i>Ai&&(bi=Ai-($i-bi),$i=Ai)}this.outline=[vi,bi,_i,$i]}function Mt(yi){this.dom.classList.add(...yi)}function Gt(yi){this.dom.classList.remove(...yi)}function Lt(){this.isDrawing=!0,this.addClass("drawing")}function Ft(){this.isDrawing=!1,this.removeClass("drawing"),_classPrivateFieldSet(this,d$g,this.outline.slice())}function Nt(){this.addClass("locked","frozen"),this.isFrozen=!0}function qt$1(){this.removeClass("locked","frozen"),this.isFrozen=!1}function Ht(){return this.getOutlines()}async function Kt(){const yi=this.getOutlines();if(!yi.length)return"";const vi=[];yi.forEach(_i=>{const $i=this.parameters.pdfPage.selectTextService.convertToPdfRectangle(_i,this.pageInfo);vi.push(this.parameters.pdfPage.selectTextService.getTextInRect($i,this.pageNumber-1))});let bi="";for await(const _i of vi)bi+=_i;return bi}async function kt(){const yi=[];this.outlines.forEach(bi=>{const _i=this.parameters.pdfPage.selectTextService.convertToPdfRectangle(bi,this.pageInfo);yi.push(this.parameters.pdfPage.selectTextService.getTextInRect(_i,this.pageNumber-1))});const vi=[];for await(const bi of yi)vi.push(bi);return vi}function $t(){if(!this.parameters.data.quadPoints)return[];const yi=[],{viewportInfo:vi}=this,{scale:bi}=vi;for(const _i of this.parameters.data.quadPoints){let $i=[_i[0].x,_i[0].y,_i[3].x,_i[3].y];$i=tt$a($i),$i=vt$3(vi,$i),$i=$i.map(Pi=>Pi*bi),yi.push($i)}return yi}function Zt(yi){const vi=[];if(!yi.quadPoints)return[];const bi=yi.annotationType===E$p.StrikeOut,{scale:_i}=this.viewportInfo,{rotation:$i}=this.pageInfo,[Pi,Ai]=this.outline;for(const Si of yi.quadPoints){let[Ei,wi]=[Si[0].x,Si[0].y],[Ci,ki]=[Si[2].x,Si[2].y],[xi,Ti]=[Si[3].x,Si[3].y];[Ei,wi]=Mt$2(this.viewportInfo,[Ei,wi]).map(Li=>Li*_i),[Ci,ki]=Mt$2(this.viewportInfo,[Ci,ki]).map(Li=>Li*_i),[xi,Ti]=Mt$2(this.viewportInfo,[xi,Ti]).map(Li=>Li*_i),bi&&($i===90||$i===270?(Ci-=(Ci-Ei)/2,xi-=(xi-Ei)/2):(ki-=(ki-wi)/2,Ti-=(Ti-wi)/2));const Oi=M$k("line","annotation-line");Oi.setAttribute("x1",String(Ci)),Oi.setAttribute("y1",String(ki)),Oi.setAttribute("x2",String(xi)),Oi.setAttribute("y2",String(Ti)),Oi.setAttribute("transform",`translate(${-Pi},${-Ai})`);const ji=Oi.cloneNode(!0);ji.classList.add("front"),vi.push(Oi,ji)}return vi}function jt(){return{rect:this.getViewBoxRect(),pageNumber:this.pageNumber,subtype:this.parameters.data.subtype,customType:this.parameters.data.customType}}function Yt(){this.eventBus.dispatch(W$m,this)}function Xt(){this.eventBus.dispatch(G$d,this)}function Jt(){this.eventBus.dispatch(y$r,this)}class ue{get pageView(){return q$8.call(this)}get svg(){return H$c.call(this)}set zIndex(vi){return K$6.call(this,vi)}get zIndex(){return k$j.call(this)}get allowCrossPageBoundary(){return $$b.call(this)}get ignoreBorder(){return Z$8.call(this)}get useViewRotation(){return j$a.call(this)}get pageInfo(){return Y$9.call(this)}get viewBoxDimensions(){return X$9.call(this)}get viewportInfo(){return J$c.call(this)}get pageNumber(){return Q$8.call(this)}get width(){return tt$7.call(this)}get height(){return et$7.call(this)}get defaultClasses(){return it$7.call(this)}get prevOutline(){return nt$7.call(this)}get defaultContentClasses(){return st$7.call(this)}get borderWidth(){return rt$7.call(this)}get contentEl(){return ot$7.call(this)}get eventBus(){return at$7.call(this)}get authorInfo(){return lt$6.call(this)}get data(){return ht$5.call(this)}get ctrlKey(){return ut$6.call(this)}get altKey(){return dt$4.call(this)}get shiftKey(){return ct$6.call(this)}parseColor(vi){return gt$4.call(this,vi)}async getToolbarPosition(){return ft$3.call(this)}constructor(vi,bi){return _t$3.call(this,vi,bi)}parseRect(vi){return pt$4.call(this,vi)}createView(vi){return mt$3.call(this,vi)}createContent(vi){return vt$1.call(this,vi)}createResizeAbility(vi){return yt$1.call(this,vi)}updateByData(vi){return Wt.call(this,vi)}update(){return wt$2.call(this)}validate(){return bt$1.call(this)}moveTo(vi,bi){return xt$2.call(this,vi,bi)}move(vi,bi){return St$2.call(this,vi,bi)}onUserMove(vi){return It$1.call(this,vi)}moveEnd(vi){return Tt$1.call(this,vi)}setOutline(vi){return Ct.call(this,vi)}onOutlineUpdated(){return Pt$1.call(this)}updateContainerSize({height:vi,width:bi}){return Dt.call(this,vi,bi)}updateViewDimensions(){return Ot.call(this)}addAttributes(vi,bi){return At.call(this,vi,bi)}applyStyles(vi,bi){return Bt.call(this,vi,bi)}enableResize(){return Et$1.call(this)}disableResize(){return zt.call(this)}getViewBoxRect(){return Rt$1.call(this)}destroy(){return Vt.call(this)}updateOutline(vi){return Ut.call(this,vi)}addClass(...vi){return Mt.call(this,vi)}removeClass(...vi){return Gt.call(this,vi)}handleDrawStart(){return Lt.call(this)}handleDrawEnd(){return Ft.call(this)}freeze(){return Nt.call(this)}unfreeze(){return qt$1.call(this)}get outlines(){return Ht.call(this)}async getText(){return Kt.call(this)}async getOutlinesText(){return kt.call(this)}getOutlines(){return $t.call(this)}createLines(vi){return Zt.call(this,vi)}toData(){return jt.call(this)}hideToolbar(){return Yt.call(this)}showToolbar(){return Xt.call(this)}updateToolbar(){return Jt.call(this)}}function Qt(){const yi=document.createElement("div"),vi=dt$6();return this.defaultClasses.forEach(bi=>{yi.classList.add(bi)}),yi.appendChild(vi),yi}const h$f=10,l$f=10;function c$l(){return F$e.concat("square-widget")}function d$f(yi,vi){_defineProperty(this,"front",M$k("rect","annotation-border","front")),this.initializeByData(yi.data),this.resizeAbility=this.createResizeAbility()}function f$h(){ue.prototype.onOutlineUpdated.call(this);const{width:yi,height:vi}=this;this.front.setAttribute("width",`${Math.max(0,yi)}`),this.front.setAttribute("height",`${Math.max(0,vi)}`)}function _$m(yi){this.updateOutline(this.parseRect(yi.rect)),this.createView(yi),this.onOutlineUpdated()}function p$g(yi){const vi=ue.prototype.createContent.call(this,yi);return vi.append(this.front),vi}function g$j(yi,vi,bi,_i){this.setOutline([yi,vi,bi,_i])}function m$r(){const{outline:yi}=this,vi=yi[2]-yi[0],bi=yi[3]-yi[1];return!(Math.abs(vi)yi.removeEventListener(vi,bi,_i)}function attr(yi,vi,bi){bi==null?yi.removeAttribute(vi):yi.getAttribute(vi)!==bi&&yi.setAttribute(vi,bi)}function children(yi){return Array.from(yi.childNodes)}function set_data(yi,vi){vi=""+vi,yi.data!==vi&&(yi.data=vi)}function set_input_value(yi,vi){yi.value=vi==null?"":vi}function set_style(yi,vi,bi,_i){bi==null?yi.style.removeProperty(vi):yi.style.setProperty(vi,bi,_i?"important":"")}function toggle_class(yi,vi,bi){yi.classList[bi?"add":"remove"](vi)}function custom_event(yi,vi,{bubbles:bi=!1,cancelable:_i=!1}={}){const $i=document.createEvent("CustomEvent");return $i.initCustomEvent(yi,bi,_i,vi),$i}let current_component;function set_current_component(yi){current_component=yi}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(yi){get_current_component().$$.on_mount.push(yi)}function createEventDispatcher(){const yi=get_current_component();return(vi,bi,{cancelable:_i=!1}={})=>{const $i=yi.$$.callbacks[vi];if($i){const Pi=custom_event(vi,bi,{cancelable:_i});return $i.slice().forEach(Ai=>{Ai.call(yi,Pi)}),!Pi.defaultPrevented}return!0}}const dirty_components=[],binding_callbacks=[];let render_callbacks=[];const flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function tick(){return schedule_update(),resolved_promise}function add_render_callback(yi){render_callbacks.push(yi)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0)return;const yi=current_component;do{try{for(;flushidxyi.indexOf(_i)===-1?vi.push(_i):bi.push(_i)),bi.forEach(_i=>_i()),render_callbacks=vi}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(yi,vi){yi&&yi.i&&(outroing.delete(yi),yi.i(vi))}function transition_out(yi,vi,bi,_i){if(yi&&yi.o){if(outroing.has(yi))return;outroing.add(yi),outros.c.push(()=>{outroing.delete(yi),_i&&(bi&&yi.d(1),_i())}),yi.o(vi)}else _i&&_i()}function outro_and_destroy_block(yi,vi){transition_out(yi,1,1,()=>{vi.delete(yi.key)})}function update_keyed_each(yi,vi,bi,_i,$i,Pi,Ai,Si,Ei,wi,Ci,ki){let xi=yi.length,Ti=Pi.length,Oi=xi;const ji={};for(;Oi--;)ji[yi[Oi].key]=Oi;const Li=[],Ii=new Map,Mi=new Map,Fi=[];for(Oi=Ti;Oi--;){const Ni=ki($i,Pi,Oi),Wi=bi(Ni);let zi=Ai.get(Wi);zi?_i&&Fi.push(()=>zi.p(Ni,vi)):(zi=wi(Wi,Ni),zi.c()),Ii.set(Wi,Li[Oi]=zi),Wi in ji&&Mi.set(Wi,Math.abs(Oi-ji[Wi]))}const Bi=new Set,Ri=new Set;function Vi(Ni){transition_in(Ni,1),Ni.m(Si,Ci),Ai.set(Ni.key,Ni),Ci=Ni.first,Ti--}for(;xi&&Ti;){const Ni=Li[Ti-1],Wi=yi[xi-1],zi=Ni.key,Di=Wi.key;Ni===Wi?(Ci=Ni.first,xi--,Ti--):Ii.has(Di)?!Ai.has(zi)||Bi.has(zi)?Vi(Ni):Ri.has(Di)?xi--:Mi.get(zi)>Mi.get(Di)?(Ri.add(zi),Vi(Ni)):(Bi.add(Di),xi--):(Ei(Wi,Ai),xi--)}for(;xi--;){const Ni=yi[xi];Ii.has(Ni.key)||Ei(Ni,Ai)}for(;Ti;)Vi(Li[Ti-1]);return run_all(Fi),Li}function get_spread_update(yi,vi){const bi={},_i={},$i={$$scope:1};let Pi=yi.length;for(;Pi--;){const Ai=yi[Pi],Si=vi[Pi];if(Si){for(const Ei in Ai)Ei in Si||(_i[Ei]=1);for(const Ei in Si)$i[Ei]||(bi[Ei]=Si[Ei],$i[Ei]=1);yi[Pi]=Si}else for(const Ei in Ai)$i[Ei]=1}for(const Ai in _i)Ai in bi||(bi[Ai]=void 0);return bi}function get_spread_object(yi){return typeof yi=="object"&&yi!==null?yi:{}}function create_component(yi){yi&&yi.c()}function mount_component(yi,vi,bi,_i){const{fragment:$i,after_update:Pi}=yi.$$;$i&&$i.m(vi,bi),_i||add_render_callback(()=>{const Ai=yi.$$.on_mount.map(run).filter(is_function);yi.$$.on_destroy?yi.$$.on_destroy.push(...Ai):run_all(Ai),yi.$$.on_mount=[]}),Pi.forEach(add_render_callback)}function destroy_component(yi,vi){const bi=yi.$$;bi.fragment!==null&&(flush_render_callbacks(bi.after_update),run_all(bi.on_destroy),bi.fragment&&bi.fragment.d(vi),bi.on_destroy=bi.fragment=null,bi.ctx=[])}function make_dirty(yi,vi){yi.$$.dirty[0]===-1&&(dirty_components.push(yi),schedule_update(),yi.$$.dirty.fill(0)),yi.$$.dirty[vi/31|0]|=1<{const Oi=Ti.length?Ti[0]:xi;return wi.ctx&&$i(wi.ctx[ki],wi.ctx[ki]=Oi)&&(!wi.skip_bound&&wi.bound[ki]&&wi.bound[ki](Oi),Ci&&make_dirty(yi,ki)),xi}):[],wi.update(),Ci=!0,run_all(wi.before_update),wi.fragment=_i?_i(wi.ctx):!1,vi.target){if(vi.hydrate){const ki=children(vi.target);wi.fragment&&wi.fragment.l(ki),ki.forEach(detach)}else wi.fragment&&wi.fragment.c();vi.intro&&transition_in(yi.$$.fragment),mount_component(yi,vi.target,vi.anchor,vi.customElement),flush()}set_current_component(Ei)}class SvelteComponent{$destroy(){destroy_component(this,1),this.$destroy=noop}$on(vi,bi){if(!is_function(bi))return noop;const _i=this.$$.callbacks[vi]||(this.$$.callbacks[vi]=[]);return _i.push(bi),()=>{const $i=_i.indexOf(bi);$i!==-1&&_i.splice($i,1)}}$set(vi){this.$$set&&!is_empty(vi)&&(this.$$.skip_bound=!0,this.$$set(vi),this.$$.skip_bound=!1)}}var dayjs_minExports={},dayjs_min={get exports(){return dayjs_minExports},set exports(yi){dayjs_minExports=yi}};(function(yi,vi){(function(bi,_i){yi.exports=_i()})(commonjsGlobal,function(){var bi=1e3,_i=6e4,$i=36e5,Pi="millisecond",Ai="second",Si="minute",Ei="hour",wi="day",Ci="week",ki="month",xi="quarter",Ti="year",Oi="date",ji="Invalid Date",Li=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Ii=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Mi={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(qi){var Gi=["th","st","nd","rd"],Ki=qi%100;return"["+qi+(Gi[(Ki-20)%10]||Gi[Ki]||Gi[0])+"]"}},Fi=function(qi,Gi,Ki){var Qi=String(qi);return!Qi||Qi.length>=Gi?qi:""+Array(Gi+1-Qi.length).join(Ki)+qi},Bi={s:Fi,z:function(qi){var Gi=-qi.utcOffset(),Ki=Math.abs(Gi),Qi=Math.floor(Ki/60),Xi=Ki%60;return(Gi<=0?"+":"-")+Fi(Qi,2,"0")+":"+Fi(Xi,2,"0")},m:function qi(Gi,Ki){if(Gi.date()1)return qi(ar[0])}else{var gr=Gi.name;Vi[gr]=Gi,Xi=gr}return!Qi&&Xi&&(Ri=Xi),Xi||!Qi&&Ri},zi=function(qi,Gi){if(Ni(qi))return qi.clone();var Ki=typeof Gi=="object"?Gi:{};return Ki.date=qi,Ki.args=arguments,new Ui(Ki)},Di=Bi;Di.l=Wi,Di.i=Ni,Di.w=function(qi,Gi){return zi(qi,{locale:Gi.$L,utc:Gi.$u,x:Gi.$x,$offset:Gi.$offset})};var Ui=function(){function qi(Ki){this.$L=Wi(Ki.locale,null,!0),this.parse(Ki)}var Gi=qi.prototype;return Gi.parse=function(Ki){this.$d=function(Qi){var Xi=Qi.date,rr=Qi.utc;if(Xi===null)return new Date(NaN);if(Di.u(Xi))return new Date;if(Xi instanceof Date)return new Date(Xi);if(typeof Xi=="string"&&!/Z$/i.test(Xi)){var ar=Xi.match(Li);if(ar){var gr=ar[2]-1||0,fr=(ar[7]||"0").substring(0,3);return rr?new Date(Date.UTC(ar[1],gr,ar[3]||1,ar[4]||0,ar[5]||0,ar[6]||0,fr)):new Date(ar[1],gr,ar[3]||1,ar[4]||0,ar[5]||0,ar[6]||0,fr)}}return new Date(Xi)}(Ki),this.$x=Ki.x||{},this.init()},Gi.init=function(){var Ki=this.$d;this.$y=Ki.getFullYear(),this.$M=Ki.getMonth(),this.$D=Ki.getDate(),this.$W=Ki.getDay(),this.$H=Ki.getHours(),this.$m=Ki.getMinutes(),this.$s=Ki.getSeconds(),this.$ms=Ki.getMilliseconds()},Gi.$utils=function(){return Di},Gi.isValid=function(){return this.$d.toString()!==ji},Gi.isSame=function(Ki,Qi){var Xi=zi(Ki);return this.startOf(Qi)<=Xi&&Xi<=this.endOf(Qi)},Gi.isAfter=function(Ki,Qi){return zi(Ki)',ji=space(),Li=element("button"),Li.innerHTML='',attr(bi,"class","title svelte-ej9kvz"),attr(Pi,"class","popupTextarea svelte-ej9kvz"),attr(Pi,"rows","1"),attr(Pi,"placeholder",Ai=`请输入${yi[0]}内容`),attr(Pi,"maxlength",maxLength),toggle_class(Pi,"error",yi[2]),set_style(Pi,"height",yi[5]?`${yi[5]}px`:""),attr(Ei,"class","popupTextareaHelper svelte-ej9kvz"),attr(Oi,"class","svelte-ej9kvz"),attr(Li,"class","svelte-ej9kvz"),attr(Ti,"class","operations svelte-ej9kvz"),attr(ki,"class","footer svelte-ej9kvz"),attr(vi,"class","reply-editor svelte-ej9kvz")},m(Vi,Ni){insert(Vi,vi,Ni),append(vi,bi),append(bi,_i),append(vi,$i),append(vi,Pi),yi[15](Pi),set_input_value(Pi,yi[1]),append(vi,Si),append(vi,Ei),append(Ei,wi),yi[17](Ei),append(vi,Ci),append(vi,ki),Ri.m(ki,null),append(ki,xi),append(ki,Ti),append(Ti,Oi),append(Ti,ji),append(Ti,Li),Ii||(Mi=[listen(Pi,"input",yi[16]),listen(Pi,"input",yi[8]),listen(Pi,"compositionstart",yi[6]),listen(Pi,"compositionend",yi[7]),listen(Pi,"keydown",yi[9]),listen(Pi,"click",click_handler),listen(Oi,"click",yi[10]),listen(Li,"click",yi[11])],Ii=!0)},p(Vi,[Ni]){Ni&1&&set_data(_i,Vi[0]),Ni&1&&Ai!==(Ai=`请输入${Vi[0]}内容`)&&attr(Pi,"placeholder",Ai),Ni&2&&set_input_value(Pi,Vi[1]),Ni&4&&toggle_class(Pi,"error",Vi[2]),Ni&32&&set_style(Pi,"height",Vi[5]?`${Vi[5]}px`:""),Ni&2&&set_data(wi,Vi[1]),Bi===(Bi=Fi(Vi))&&Ri?Ri.p(Vi,Ni):(Ri.d(1),Ri=Bi(Vi),Ri&&(Ri.c(),Ri.m(ki,xi)))},i:noop,o:noop,d(Vi){Vi&&detach(vi),yi[15](null),yi[17](null),Ri.d(),Ii=!1,run_all(Mi)}}}const maxLength=200,click_handler=yi=>yi.stopImmediatePropagation();function instance$3(yi,vi,bi){const _i=createEventDispatcher();let{title:$i}=vi,{value:Pi=""}=vi,Ai,Si,Ei;function wi(){Ai.focus({preventScroll:!0})}function Ci(Wi){bi(1,ki=Wi),Bi()}let ki=Pi,xi=!1,Ti=!1;function Oi(){xi=!0}function ji(){xi=!1,Bi()}function Li(){xi||Bi()}function Ii(Wi){(Wi.ctrlKey||Wi.metaKey)&&Wi.key==="Enter"&&Mi()}function Mi(Wi){Wi==null||Wi.stopImmediatePropagation();const zi=ki.trim();zi.length?(_i("submit",zi),bi(1,ki=""),bi(2,Ti=!1)):bi(2,Ti=!0),Bi()}function Fi(Wi){Wi==null||Wi.stopImmediatePropagation(),bi(1,ki=""),Bi(),_i("cancel")}function Bi(){return __awaiter(this,void 0,void 0,function*(){yield tick(),Si&&Ei!==Si.offsetHeight&&(bi(5,Ei=Si.offsetHeight),yield tick(),_i("editor-resize"))})}onMount(()=>{Bi()});function Ri(Wi){binding_callbacks[Wi?"unshift":"push"](()=>{Ai=Wi,bi(3,Ai)})}function Vi(){ki=this.value,bi(1,ki)}function Ni(Wi){binding_callbacks[Wi?"unshift":"push"](()=>{Si=Wi,bi(4,Si)})}return yi.$$set=Wi=>{"title"in Wi&&bi(0,$i=Wi.title),"value"in Wi&&bi(12,Pi=Wi.value)},yi.$$.update=()=>{yi.$$.dirty&6&&ki.trim().length&&Ti&&bi(2,Ti=!1)},[$i,ki,Ti,Ai,Si,Ei,Oi,ji,Li,Ii,Mi,Fi,Pi,wi,Ci,Ri,Vi,Ni]}class PopupReplyEditorElement extends SvelteComponent{constructor(vi){super(),init(this,vi,instance$3,create_fragment$3,safe_not_equal,{title:0,value:12,focus:13,updateContent:14})}get focus(){return this.$$.ctx[13]}get updateContent(){return this.$$.ctx[14]}}const defaultAvatar="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEyIiBmaWxsPSIjRUVFRUVFIi8+CiAgICA8bWFzayBpZD0ibWFzazBfNl8yMTM2IiBzdHlsZT0ibWFzay10eXBlOmFscGhhIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4PSIwIiB5PSIwIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiPgogICAgICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEyIiBmaWxsPSJ3aGl0ZSIvPgogICAgPC9tYXNrPgogICAgPGcgbWFzaz0idXJsKCNtYXNrMF82XzIxMzYpIj4KICAgICAgICA8ZWxsaXBzZSBjeD0iMTIiIGN5PSIyMiIgcng9IjgiIHJ5PSI5IiBmaWxsPSIjQkNCQ0JDIi8+CiAgICAgICAgPGNpcmNsZSBjeD0iMTIiIGN5PSI5IiByPSI1IiBmaWxsPSIjQkNCQ0JDIi8+CiAgICA8L2c+Cjwvc3ZnPgo=",PopupAnnotationElementUI_svelte_svelte_type_style_lang="";function get_each_context$2(yi,vi,bi){const _i=yi.slice();return _i[27]=vi[bi],_i[28]=vi,_i[29]=bi,_i}function create_else_block_1(yi){let vi,bi;return{c(){vi=element("img"),attr(vi,"class","author-avatar svelte-hqwlzt"),src_url_equal(vi.src,bi=defaultAvatar)||attr(vi,"src",bi),attr(vi,"alt",""),attr(vi,"crossorigin","anonymous")},m(_i,$i){insert(_i,vi,$i)},p:noop,d(_i){_i&&detach(vi)}}}function create_if_block_5(yi){let vi,bi;return{c(){vi=element("img"),attr(vi,"class","author-avatar svelte-hqwlzt"),src_url_equal(vi.src,bi=yi[27].avatar)||attr(vi,"src",bi),attr(vi,"alt",""),attr(vi,"crossorigin","anonymous")},m(_i,$i){insert(_i,vi,$i)},p(_i,$i){$i&17&&!src_url_equal(vi.src,bi=_i[27].avatar)&&attr(vi,"src",bi)},d(_i){_i&&detach(vi)}}}function create_if_block_3(yi){let vi,bi,_i,$i,Pi;function Ai(){return yi[18](yi[27])}let Si=yi[27].id!==yi[0].id&&create_if_block_4(yi);return{c(){vi=element("div"),bi=element("button"),bi.innerHTML='',_i=space(),Si&&Si.c(),attr(bi,"class","svelte-hqwlzt"),attr(vi,"class","popupModifier svelte-hqwlzt")},m(Ei,wi){insert(Ei,vi,wi),append(vi,bi),append(vi,_i),Si&&Si.m(vi,null),$i||(Pi=listen(bi,"click",Ai),$i=!0)},p(Ei,wi){yi=Ei,yi[27].id!==yi[0].id?Si?Si.p(yi,wi):(Si=create_if_block_4(yi),Si.c(),Si.m(vi,null)):Si&&(Si.d(1),Si=null)},d(Ei){Ei&&detach(vi),Si&&Si.d(),$i=!1,Pi()}}}function create_if_block_4(yi){let vi,bi,_i;function $i(){return yi[19](yi[27])}return{c(){vi=element("button"),vi.innerHTML='',attr(vi,"class","svelte-hqwlzt")},m(Pi,Ai){insert(Pi,vi,Ai),bi||(_i=listen(vi,"click",$i),bi=!0)},p(Pi,Ai){yi=Pi},d(Pi){Pi&&detach(vi),bi=!1,_i()}}}function create_else_block(yi){let vi,bi,_i=yi[27].contentsObj.str+"",$i;return{c(){vi=element("div"),bi=element("p"),$i=text(_i),attr(bi,"class","svelte-hqwlzt"),attr(vi,"class","popupContent svelte-hqwlzt")},m(Pi,Ai){insert(Pi,vi,Ai),append(vi,bi),append(bi,$i)},p(Pi,Ai){Ai&17&&_i!==(_i=Pi[27].contentsObj.str+"")&&set_data($i,_i)},i:noop,o:noop,d(Pi){Pi&&detach(vi)}}}function create_if_block_2(yi){let vi,bi=yi[27],_i;const $i=()=>yi[20](vi,bi),Pi=()=>yi[20](null,bi);function Ai(...Ei){return yi[21](yi[27],...Ei)}let Si={title:"编辑",value:yi[27].contentsObj.str};return vi=new PopupReplyEditorElement({props:Si}),$i(),vi.$on("submit",Ai),vi.$on("cancel",yi[22]),vi.$on("editor-resize",yi[23]),{c(){create_component(vi.$$.fragment)},m(Ei,wi){mount_component(vi,Ei,wi),_i=!0},p(Ei,wi){yi=Ei,bi!==yi[27]&&(Pi(),bi=yi[27],$i());const Ci={};wi&17&&(Ci.value=yi[27].contentsObj.str),vi.$set(Ci)},i(Ei){_i||(transition_in(vi.$$.fragment,Ei),_i=!0)},o(Ei){transition_out(vi.$$.fragment,Ei),_i=!1},d(Ei){Pi(),destroy_component(vi,Ei)}}}function create_each_block$2(yi,vi){let bi,_i,$i,Pi,Ai,Si=vi[27].titleObj.str+"",Ei,wi,Ci,ki,xi=dayjs(vi[27].modificationDate).format("YYYY-MM-DD HH:mm")+"",Ti,Oi,ji,Li,Ii,Mi,Fi,Bi;function Ri(Hi,qi){return Hi[27].avatar?create_if_block_5:create_else_block_1}let Vi=Ri(vi),Ni=Vi(vi),Wi=vi[27].editable&&create_if_block_3(vi);const zi=[create_if_block_2,create_else_block],Di=[];function Ui(Hi,qi){return Hi[7]===Hi[27].id?0:1}return Li=Ui(vi),Ii=Di[Li]=zi[Li](vi),{key:yi,first:null,c(){bi=element("div"),_i=element("div"),$i=element("div"),Ni.c(),Pi=space(),Ai=element("div"),Ei=text(Si),wi=space(),Ci=element("div"),ki=element("div"),Ti=text(xi),Oi=space(),Wi&&Wi.c(),ji=space(),Ii.c(),Mi=space(),attr(Ai,"class","popupTitle svelte-hqwlzt"),attr($i,"class","headLeft svelte-hqwlzt"),attr(ki,"class","popupDate svelte-hqwlzt"),attr(Ci,"class","headRight svelte-hqwlzt"),attr(_i,"class","popupHead svelte-hqwlzt"),attr(bi,"class","reply svelte-hqwlzt"),attr(bi,"data-id",Fi=vi[27].id===vi[0].id?"main":vi[27].id),toggle_class(bi,"editable",vi[27].editable),this.first=bi},m(Hi,qi){insert(Hi,bi,qi),append(bi,_i),append(_i,$i),Ni.m($i,null),append($i,Pi),append($i,Ai),append(Ai,Ei),append(_i,wi),append(_i,Ci),append(Ci,ki),append(ki,Ti),append(Ci,Oi),Wi&&Wi.m(Ci,null),append(bi,ji),Di[Li].m(bi,null),append(bi,Mi),Bi=!0},p(Hi,qi){vi=Hi,Vi===(Vi=Ri(vi))&&Ni?Ni.p(vi,qi):(Ni.d(1),Ni=Vi(vi),Ni&&(Ni.c(),Ni.m($i,Pi))),(!Bi||qi&17)&&Si!==(Si=vi[27].titleObj.str+"")&&set_data(Ei,Si),(!Bi||qi&17)&&xi!==(xi=dayjs(vi[27].modificationDate).format("YYYY-MM-DD HH:mm")+"")&&set_data(Ti,xi),vi[27].editable?Wi?Wi.p(vi,qi):(Wi=create_if_block_3(vi),Wi.c(),Wi.m(Ci,null)):Wi&&(Wi.d(1),Wi=null);let Gi=Li;Li=Ui(vi),Li===Gi?Di[Li].p(vi,qi):(group_outros(),transition_out(Di[Gi],1,1,()=>{Di[Gi]=null}),check_outros(),Ii=Di[Li],Ii?Ii.p(vi,qi):(Ii=Di[Li]=zi[Li](vi),Ii.c()),transition_in(Ii,1),Ii.m(bi,Mi)),(!Bi||qi&17&&Fi!==(Fi=vi[27].id===vi[0].id?"main":vi[27].id))&&attr(bi,"data-id",Fi),(!Bi||qi&17)&&toggle_class(bi,"editable",vi[27].editable)},i(Hi){Bi||(transition_in(Ii),Bi=!0)},o(Hi){transition_out(Ii),Bi=!1},d(Hi){Hi&&detach(bi),Ni.d(),Wi&&Wi.d(),Di[Li].d()}}}function create_if_block_1(yi){let vi,bi,_i,$i={title:yi[0].contentsObj.str?"追加批注":"批注"};return bi=new PopupReplyEditorElement({props:$i}),yi[24](bi),bi.$on("submit",yi[12]),bi.$on("cancel",yi[16]),bi.$on("editor-resize",yi[25]),{c(){vi=element("div"),create_component(bi.$$.fragment),attr(vi,"class","addReply svelte-hqwlzt")},m(Pi,Ai){insert(Pi,vi,Ai),mount_component(bi,vi,null),_i=!0},p(Pi,Ai){const Si={};Ai&1&&(Si.title=Pi[0].contentsObj.str?"追加批注":"批注"),bi.$set(Si)},i(Pi){_i||(transition_in(bi.$$.fragment,Pi),_i=!0)},o(Pi){transition_out(bi.$$.fragment,Pi),_i=!1},d(Pi){Pi&&detach(vi),yi[24](null),destroy_component(bi)}}}function create_if_block(yi){let vi,bi,_i=yi[4].length+"",$i,Pi;return{c(){vi=element("div"),bi=text("已折叠 "),$i=text(_i),Pi=text(" 条批注"),attr(vi,"class","reply-annot-count svelte-hqwlzt")},m(Ai,Si){insert(Ai,vi,Si),append(vi,bi),append(vi,$i),append(vi,Pi)},p(Ai,Si){Si&16&&_i!==(_i=Ai[4].length+"")&&set_data($i,_i)},d(Ai){Ai&&detach(vi)}}}function create_fragment$2(yi){let vi,bi,_i,$i=[yi[0]].concat(yi[4]).length+"",Pi,Ai,Si,Ei,wi=[],Ci=new Map,ki,xi,Ti,Oi,ji,Li,Ii,Mi,Fi,Bi,Ri=[yi[0]].concat(yi[4]);const Vi=zi=>zi[27].id;for(let zi=0;zi{Ni=null}),check_outros()),zi[4].length?Wi?Wi.p(zi,Di):(Wi=create_if_block(zi),Wi.c(),Wi.m(vi,null)):Wi&&(Wi.d(1),Wi=null),(!Mi||Di&4&&Ti!==(Ti=null_to_empty(["popupAnnotation"].concat(zi[2]).join(" "))+" svelte-hqwlzt"))&&attr(vi,"class",Ti),(!Mi||Di&8&&Oi!==(Oi=zi[3].id))&&attr(vi,"data-id",Oi),(!Mi||Di&1&&ji!==(ji=zi[0].id))&&attr(vi,"data-parent",ji),(!Mi||Di&1&&Li!==(Li=zi[0].subtype))&&attr(vi,"data-parent-type",Li),(!Mi||Di&1&&Ii!==(Ii=zi[0].pageNumber))&&attr(vi,"data-page-nunber",Ii),Di&32&&set_style(vi,"--top",`${zi[5].top}px`),Di&32&&set_style(vi,"--left",`${zi[5].left}px`)},i(zi){if(!Mi){for(let Di=0;DiObject.assign(Object.assign({},Gi),{[Ki.id]:void 0}),{}),Oi;function ji(Gi){bi(7,xi=Gi),setTimeout(()=>Ti[Gi].focus())}function Li(Gi){const Ki=Gi.detail;Pi.editable&&!Pi.contentsObj.str?(bi(0,Pi.contentsObj.str=Ki,Pi),_i("update-annotation-data",Pi)):_i("add-reply",Ki)}function Ii(Gi,Ki){const Qi=Ki.detail;Gi.contentsObj.str=Qi,_i("update-annotation-data",Gi),bi(7,xi="")}function Mi(Gi){_i("remove-annotation-data",Gi),bi(7,xi="")}function Fi(){_i("open-popup")}function Bi(){_i("close-popup")}const Ri=Gi=>ji(Gi.id),Vi=Gi=>Mi(Gi.id);function Ni(Gi,Ki){binding_callbacks[Gi?"unshift":"push"](()=>{Ti[Ki.id]=Gi,bi(8,Ti)})}const Wi=(Gi,Ki)=>Ii(Gi,Ki),zi=()=>bi(7,xi=""),Di=()=>_i("editor-resize");function Ui(Gi){binding_callbacks[Gi?"unshift":"push"](()=>{Oi=Gi,bi(9,Oi)})}const Hi=()=>_i("editor-resize");function qi(Gi){binding_callbacks[Gi?"unshift":"push"](()=>{wi=Gi,bi(1,wi)})}return yi.$$set=Gi=>{"customClass"in Gi&&bi(2,$i=Gi.customClass),"annotationData"in Gi&&bi(0,Pi=Gi.annotationData),"annotationPopupData"in Gi&&bi(3,Ai=Gi.annotationPopupData),"replyAnnotationData"in Gi&&bi(4,Si=Gi.replyAnnotationData),"pos"in Gi&&bi(5,Ei=Gi.pos),"dom"in Gi&&bi(1,wi=Gi.dom),"canReply"in Gi&&bi(6,ki=Gi.canReply)},[Pi,wi,$i,Ai,Si,Ei,ki,xi,Ti,Oi,_i,ji,Li,Ii,Mi,Fi,Bi,Ci,Ri,Vi,Ni,Wi,zi,Di,Ui,Hi,qi]}class PopupAnnotationElementUI extends SvelteComponent{constructor(vi){super(),init(this,vi,instance$2,create_fragment$2,safe_not_equal,{customClass:2,annotationData:0,annotationPopupData:3,replyAnnotationData:4,pos:5,dom:1,focusEditor:17,canReply:6})}get customClass(){return this.$$.ctx[2]}set customClass(vi){this.$$set({customClass:vi}),flush()}get annotationData(){return this.$$.ctx[0]}set annotationData(vi){this.$$set({annotationData:vi}),flush()}get annotationPopupData(){return this.$$.ctx[3]}set annotationPopupData(vi){this.$$set({annotationPopupData:vi}),flush()}get replyAnnotationData(){return this.$$.ctx[4]}set replyAnnotationData(vi){this.$$set({replyAnnotationData:vi}),flush()}get pos(){return this.$$.ctx[5]}set pos(vi){this.$$set({pos:vi}),flush()}get dom(){return this.$$.ctx[1]}set dom(vi){this.$$set({dom:vi}),flush()}get focusEditor(){return this.$$.ctx[17]}get canReply(){return this.$$.ctx[6]}set canReply(vi){this.$$set({canReply:vi}),flush()}}function l$e(yi,vi,bi,_i,$i,Pi,Ai){_defineProperty(this,"annotationFlags",0),_defineProperty(this,"modificationDate",Date.now()),_defineProperty(this,"creationDate",Date.now()),_defineProperty(this,"color",[...te$5]),_defineProperty(this,"borderStyle",{width:2,style:1,dashArray:[]}),this.id=Pt$3(Pi),this.annotationType=Pi,this.subtype=E$p[Pi],this.rect=yi,this.pageNumber=vi,this.customType=Ai,this.titleObj=bi,this.contentsObj=_i,this.authorID=$i}let m$q=class{constructor({rect:vi,pageNumber:bi,titleObj:_i,contentsObj:$i,authorID:Pi=""},Ai,Si){return l$e.call(this,vi,bi,_i,$i,Pi,Ai,Si)}};function i$8(yi){_defineProperty(this,"state",null),_defineProperty(this,"stateModel",null),_defineProperty(this,"name","Comment"),_defineProperty(this,"subj","Text"),yi.inReplyTo&&(this.inReplyTo=yi.inReplyTo,this.replyType="R",this.subj="Text")}let n$5=class extends m$q{constructor(vi){return super(vi,E$p.Text),i$8.call(this,vi)}};function m$p(){var yi,vi;(yi=this.popupAnnotRelatedItem)===null||yi===void 0||(vi=yi.listPopupSetPosCallback)===null||vi===void 0||vi.call(yi,this.popupAnnotRelatedItem)}function f$g(){return et$9(this.parameters.data.color,.7)}function A$m(yi){var vi;if(_defineProperty(this,"className",["popup-annotation"]),_defineProperty(this,"listPos",{top:0,left:0}),_defineProperty(this,"pin",!1),_defineProperty(this,"alignAnnotInfo",null),_defineProperty(this,"replyAvatar",{}),this.initialize(yi.data),this.container=this.createView(this.data),this.avatar=(vi=yi.parentData)===null||vi===void 0?void 0:vi.avatar,yi.replyData){var bi;this.replyAvatar=(bi=yi.replyData)===null||bi===void 0?void 0:bi.reduce(($i,Pi)=>({...$i,[Pi.id]:Pi.avatar||""}),{})}const _i=this.getParentAnnotationElement();_i&&this.setAlignAnnotInfo(_i)}function P$l(yi){ne$2.prototype.initialize.call(this,yi),this.getAvatar().then(vi=>{this.setAvatar(vi)})}function _$l(yi){return null}function v$k(yi){const vi=this.createContainer(),bi=this.createContent(yi.annotationType);return vi.appendChild(bi),this.addAttributes(vi,yi),vi}function E$k(yi){return document.createElement("div")}function g$i(yi){return document.createElement("div")}function y$m(){return this.popupAnnotRelatedItem&&(this.popupAnnotRelatedItem.popupComponent=new PopupAnnotationElementUI({target:this.container,props:this.popupAnnotRelatedItem.popupComponentProps}),this.popupAnnotRelatedItem.bindComponentEvents()),this.eventBus.dispatch(V$k,this),this.container}function I$g(){var yi;(yi=this.popupAnnotRelatedItem)===null||yi===void 0||yi.refresh()}function R$g(){return this.refresh(),this.listPopupSetPosCallback(),this.getAvatar().then(yi=>{this.setAvatar(yi)}),this.container}function C$j(yi){const vi=this.parameters.replyData||[],bi=vi.findIndex(_i=>_i.id===yi.id);bi>-1?vi[bi]={...vi[bi],...yi}:vi.push(yi),this.refresh(),this.listPopupSetPosCallback()}function b$h(yi,vi){this.replyAvatar={...this.replyAvatar,[yi]:vi},this.refresh()}function D$l(yi){const vi=this.parameters.replyData||[],bi=vi.findIndex(_i=>_i.id===yi);bi>-1&&vi.splice(bi,1),this.refresh(),this.listPopupSetPosCallback()}function S$l(yi){this.focus=yi,window.requestAnimationFrame(()=>{yi&&this.focusRelyEditor()})}function N$e(yi,vi){const bi=_i=>{this.annotationService.getAnnotations($i=>$i.data.popupId===_i).forEach($i=>{$i.focus=yi})};if(this.annotationService.getCurrentPageNumber()!==this.data.pageNumber){const{parentData:_i}=this.parameters;_i&&(yi&&this.annotationService.scrollToAnnotation(_i.pageNumber,_i.id,yi,{block:"center"}),_i.popupId&&bi(_i.popupId))}else{const _i=this.getParentAnnotationElement();vi&&(_i==null||_i.container.scrollIntoView()),_i!=null&&_i.data.popupId&&bi(_i.data.popupId)}}function T$g(yi,vi){this.alignAnnotInfo={id:yi.id,pageNumber:yi.pageNumber,outline:yi.outline},vi&&this.refresh(),this.listPopupSetPosCallback()}function k$i(yi){this.listPos={...this.listPos,...yi},this.refresh()}function x$j(yi){this.avatar=yi,this.refresh()}function w$k(){window.requestAnimationFrame(()=>{var yi;return(yi=this.popupAnnotRelatedItem)===null||yi===void 0||(yi=yi.popupComponent)===null||yi===void 0?void 0:yi.focusEditor()})}function V$g(){ne$2.prototype.destroy.call(this),this.container.remove()}function F$d(yi){const vi=this.getParentAnnotationElement();if(!vi)return;const bi=vi.toJSON(),{pageNumber:_i,rect:$i,id:Pi}=bi,Ai=new n$5({rect:[$i[0],$i[1],$i[0]+p$j,$i[1]+p$j],inReplyTo:Pi,titleObj:{str:this.author,dir:"ltr"},contentsObj:{str:yi,dir:"ltr"},pageNumber:_i,authorID:this.parameters.authorID()});bi.replyIds=(bi.replyIds||[]).concat(Ai.id),this.annotationService.updateAnnotations([bi],{updateModificationDate:!1}),this.annotationService.updateAnnotations([Ai])}function O$o(){return!0}let U$b=class extends ne$2{listPopupSetPosCallback(){return m$p.call(this)}get color(){return f$g.call(this)}constructor(vi){return super(vi),A$m.call(this,vi)}initialize(vi){return P$l.call(this,vi)}createWidget(...vi){return _$l.call(this,vi)}createView(vi){return v$k.call(this,vi)}createContainer(vi=!1){return E$k.call(this,vi)}createContent(vi){return g$i.call(this,vi)}render(){return y$m.call(this)}refresh(){return I$g.call(this)}update(){return R$g.call(this)}updateReply(vi){return C$j.call(this,vi)}updateReplyAvatar(vi,bi){return b$h.call(this,vi,bi)}removeReply(vi){return D$l.call(this,vi)}toggleVisible(vi){return S$l.call(this,vi)}togglePopup(vi,bi=!1){return N$e.call(this,vi,bi)}setAlignAnnotInfo(vi,bi=!1){return T$g.call(this,vi,bi)}setListPos(vi){return k$i.call(this,vi)}setAvatar(vi){return x$j.call(this,vi)}focusRelyEditor(){return w$k.call(this)}destroy(){return V$g.call(this)}addReply(vi){return F$d.call(this,vi)}check(){return O$o.call(this)}};var r$b=new WeakSet,o$9=new WeakSet;function f$f(yi,vi,bi){_classPrivateMethodInitSpec(this,o$9),_classPrivateMethodInitSpec(this,r$b),_defineProperty(this,"wrapper",M$k("g","line-wrapper")),_defineProperty(this,"backLine",M$k("path","table-line","back-line")),_defineProperty(this,"frontLine",M$k("path","table-line","front-line")),_defineProperty(this,"maxPos",0),_defineProperty(this,"minPos",0),_defineProperty(this,"per",0),_defineProperty(this,"cutData",[]),this.wrapper.appendChild(this.backLine),this.wrapper.appendChild(this.frontLine),this.pos=yi,this.table=bi,this.lineContainer=vi,this.MIN_LINE_SPACE=bi.MIN_LINE_SPACE,this.wrapper.dataset.lineDir=this.dir,_classPrivateMethodGet(this,r$b,a$f).call(this),_classPrivateMethodGet(this,o$9,l$d).call(this)}function m$o(){return this.lineContainer.dir}function _$k(){return this.lineContainer.long}function L$e(yi,vi,bi){const _i=this.per===0?0:(yi-this.per)/this.per;this.pos=this.pos*(1+_i)||yi*bi,this.per=yi,_classPrivateMethodGet(this,r$b,a$f).call(this)}function P$k(yi,vi){_classPrivateMethodGet(this,o$9,l$d).call(this);const{MIN_LINE_SPACE:bi,table:_i}=this;this.dir==="H"?this.maxPos=(vi?vi.pos:_i.height)-bi:this.maxPos=(vi?vi.pos:_i.width)-bi,this.minPos=(yi?yi.pos:0)+bi}function g$h(yi,vi){this.dir==="H"?this.pos=vi:this.pos=yi,!(this.pos>this.maxPos||this.posthis.maxPos?this.pos=this.maxPos:this.posbi===yi[0]&&_i===yi[1]);vi>-1&&(this.cutData.splice(vi,1),this.cut(this.cutData))}function b$g(yi){if(!yi.length){_classPrivateMethodGet(this,r$b,a$f).call(this),_classPrivateMethodGet(this,o$9,l$d).call(this);return}this.cutData=yi;const vi=j$g(yi);let bi="";this.dir==="H"?(bi=`M0 ${this.pos} `,vi.forEach(([_i,$i])=>{bi+=`H${_i} M${$i} ${this.pos} `}),bi+=`H${this.long}`):(bi=`M${this.pos} 0 `,vi.forEach(([_i,$i])=>{bi+=`V${_i} M${this.pos} ${$i} `}),bi+=`V${this.long}`),this.backLine.setAttribute("d",bi),this.frontLine.setAttribute("d",bi)}function $$a(){this.wrapper.remove()}let C$i=class{constructor(vi=0,bi,_i){return f$f.call(this,vi,bi,_i)}get dir(){return m$o.call(this)}get long(){return _$k.call(this)}draw(vi,bi,_i){return L$e.call(this,vi,bi,_i)}finishDrawing(vi,bi){return P$k.call(this,vi,bi)}move(vi,bi){return g$h.call(this,vi,bi)}moveStart(){return v$j.call(this)}moveEnd(){return M$e.call(this)}revertCut(vi){return w$j.call(this,vi)}cut(vi){return b$g.call(this,vi)}destroy(){return $$a.call(this)}};function a$f(){let yi="";this.dir==="H"?yi=`M0 ${this.pos} H${this.long}`:yi=`M${this.pos} 0 V${this.long}`,this.backLine.setAttribute("d",yi)}function l$d(){this.frontLine.setAttribute("d",this.backLine.getAttribute("d"))}var A$l=C$i,u$g=new WeakMap,p$f=new WeakMap,v$i=new WeakMap,L$d=new WeakMap,g$g=new WeakMap,D$k=new WeakMap,M$d=new WeakMap,x$i=new WeakSet,y$l=new WeakSet;function G$a(yi,vi,bi){_classPrivateMethodInitSpec(this,y$l),_classPrivateMethodInitSpec(this,x$i),_defineProperty(this,"wrapper",M$k("g","table-line-container")),_defineProperty(this,"lines",[]),_classPrivateFieldInitSpec(this,u$g,{writable:!0,value:M$k("path","temp-line")}),_classPrivateFieldInitSpec(this,p$f,{writable:!0,value:0}),_classPrivateFieldInitSpec(this,v$i,{writable:!0,value:1}),_classPrivateFieldInitSpec(this,L$d,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,g$g,{writable:!0,value:$i=>{const{hLines:Pi,vLines:Ai,MIN_LINE_SPACE:Si,height:Ei,width:wi}=this.table,{dir:Ci}=this;let ki=$i.offsetY,xi=$i.offsetX,Ti,Oi;const{rowNum:ji,colNum:Li}=this.table.getCellPoint(xi,ki);Ci==="H"?(Ti=Pi.lines[ji-1],Oi=Pi.lines[ji],_classPrivateFieldSet(this,v$i,ji+1)):(Ti=Ai.lines[Li-1],Oi=Ai.lines[Li],_classPrivateFieldSet(this,v$i,Li+1));const Ii=(Ti?Ti.pos:0)+Si,Mi=(Oi?Oi.pos:Ci==="H"?Ei:wi)-Si;Ci==="H"?(ki=Mi&&(ki=Mi),_classPrivateFieldSet(this,p$f,ki),_classPrivateFieldGet(this,u$g).setAttribute("d",`M0 ${_classPrivateFieldGet(this,p$f)} H${wi}`)):(xi=Mi&&(xi=Mi),_classPrivateFieldSet(this,p$f,xi),_classPrivateFieldGet(this,u$g).setAttribute("d",`M${_classPrivateFieldGet(this,p$f)} 0 V${Ei}`)),_classPrivateFieldSet(this,L$d,!0)}}),_classPrivateFieldInitSpec(this,D$k,{writable:!0,value:()=>{_classPrivateFieldGet(this,L$d)&&(_classPrivateMethodGet(this,x$i,j$9).call(this,_classPrivateFieldGet(this,p$f),_classPrivateFieldGet(this,v$i)),_classPrivateFieldSet(this,L$d,!1))}}),_classPrivateFieldInitSpec(this,M$d,{writable:!0,value:$i=>{const Pi=$i.target.closest("g.line-wrapper");Pi&&_classPrivateMethodGet(this,y$l,q$7).call(this,Pi)}}),this.dir=yi,this.table=vi,yi==="V"&&this.wrapper.classList.add("vertical-lines"),yi==="H"&&this.wrapper.classList.add("horizontal-lines");const _i=document.createDocumentFragment();bi.forEach($i=>{const Pi=new A$l($i,this,this.table);this.lines.push(Pi),_i.appendChild(Pi.wrapper)}),this.wrapper.appendChild(_i)}function T$f(){return this.dir==="H"?this.table.width:this.table.height}function V$f(){return this.lines.length}function $$9(yi){if(yi>0)for(let vi=0;vi{_i.draw(bi,vi,$i+1)});return}if(this.dir==="V"){if(this.table.colCount-1===0)return;const bi=vi/this.table.colCount;this.lines.forEach((_i,$i)=>{_i.draw(bi,yi,$i+1)})}}function B$c(){this.lines.forEach((yi,vi)=>{yi.finishDrawing(this.lines[vi-1],this.lines[vi+1])})}function O$n(){this.wrapper.appendChild(_classPrivateFieldGet(this,u$g)),this.table.container.addEventListener("mousemove",_classPrivateFieldGet(this,g$g)),this.table.container.addEventListener("mouseup",_classPrivateFieldGet(this,D$k))}function J$b(){this.table.container.removeEventListener("mousemove",_classPrivateFieldGet(this,g$g)),this.table.container.removeEventListener("mouseup",_classPrivateFieldGet(this,D$k)),_classPrivateFieldGet(this,u$g).remove()}function R$f(){this.wrapper.addEventListener("click",_classPrivateFieldGet(this,M$d))}function U$a(){this.wrapper.removeEventListener("click",_classPrivateFieldGet(this,M$d))}function X$8(yi){return this.lines.map(vi=>vi.pos/yi)}let Y$8=class{constructor(vi,bi,_i=[]){return G$a.call(this,vi,bi,_i)}get long(){return T$f.call(this)}get lineCount(){return V$f.call(this)}setLine(vi){return $$9.call(this,vi)}drawLines(){return z$d.call(this)}finishDrawing(){return B$c.call(this)}insertLine(){return O$n.call(this)}cancelInsertLine(){return J$b.call(this)}bindEvents(){return R$f.call(this)}unbindEvents(){return U$a.call(this)}toJSON(vi){return X$8.call(this,vi)}};function j$9(yi,vi){if(this.table.isFrozen)return;const bi=this.lines.slice(vi-1),_i=this.lines.slice(0,vi-1),$i=new A$l(yi,this,this.table);this.lines=[..._i,$i,...bi];const Pi=this.lines[vi];Pi?this.wrapper.insertBefore($i.wrapper,Pi.wrapper):this.wrapper.appendChild($i.wrapper),this.finishDrawing(),this.table.handleEvents(B$f,{dir:this.dir,action:"ADD"})}function q$7(yi){if(this.table.isFrozen)return;const vi=this.lines.findIndex(bi=>bi.wrapper===yi);if(vi>-1){const bi=this.lines.splice(vi,1)[0];bi&&(bi.destroy(),this.table.tableCell.updateSpanCellDataAfterRemoveLine(vi,this.dir==="H"?0:1),this.finishDrawing(),this.table.handleEvents(B$f,{dir:this.dir,action:"DELETE"}))}}function P$j(yi){return[...yi].sort((vi,bi)=>{let[_i,$i,Pi,Ai]=[];return Array.isArray(vi)&&Array.isArray(bi)?([_i,$i]=vi,[Pi,Ai]=bi):typeof vi=="string"&&typeof bi=="string"&&([_i,$i]=vi.split("-").map(Number),[Pi,Ai]=bi.split("-").map(Number)),_i===Pi?$i-Ai:_i-Pi})}var m$n=new WeakMap,g$f=new WeakMap,I$f=new WeakMap,R$e=new WeakMap,N$d=new WeakMap,T$e=new WeakSet,W$i=new WeakSet,B$b=new WeakSet,z$c=new WeakSet;function K$5(yi,vi){_classPrivateMethodInitSpec(this,z$c),_classPrivateMethodInitSpec(this,B$b),_classPrivateMethodInitSpec(this,W$i),_classPrivateMethodInitSpec(this,T$e),_defineProperty(this,"wrapper",M$k("g","cell-wrapper")),_defineProperty(this,"cellDom",M$k("rect","table-cell")),_classPrivateFieldInitSpec(this,m$n,{writable:!0,value:new Set}),_classPrivateFieldInitSpec(this,g$f,{writable:!0,value:[0,0]}),_defineProperty(this,"spanCellData",new Set),_classPrivateFieldInitSpec(this,I$f,{writable:!0,value:0}),_classPrivateFieldInitSpec(this,R$e,{writable:!0,value:0}),_classPrivateFieldInitSpec(this,N$d,{writable:!0,value:void 0}),this.table=yi,this.wrapper.appendChild(this.cellDom),vi.forEach(bi=>{bi=P$j(bi);const _i=bi.map(([$i=0,Pi=0])=>`${$i}-${Pi}`);this.spanCellData.add(new Set(_i))}),this.updateCell(),this.mousedown=this.mousedown.bind(this),this.mousemove=this.mousemove.bind(this),this.mouseup=this.mouseup.bind(this)}function X$7(){return this.table.vLines.lines}function Y$7(){return this.table.hLines.lines}function q$6(yi){const{offsetX:vi,offsetY:bi,ctrlKey:_i,shiftKey:$i}=yi;if($i||yi.target.tagName.toLowerCase()==="path"&&yi.target.closest(".table-line-wrapper"))return;const{rowNum:Pi,colNum:Ai}=this.table.getCellPoint(vi,bi);if(_classPrivateFieldSet(this,g$f,[Pi,Ai]),_i){const Si=`${Pi}-${Ai}`;if(_classPrivateFieldGet(this,m$n).has(Si))return;_classPrivateFieldGet(this,m$n).add(Si),_classPrivateMethodGet(this,T$e,k$h).call(this,Pi,Ai)}else{this.clean(),document.addEventListener("mouseup",this.mouseup,{once:!0}),this.table.container.addEventListener("mousemove",this.mousemove);const Si=this.getSpanCell(Pi,Ai);Si?_classPrivateFieldSet(this,m$n,new Set(Si)):_classPrivateFieldGet(this,m$n).add(`${Pi}-${Ai}`),_classPrivateMethodGet(this,T$e,k$h).call(this)}this.table.handleEvents(v$p,{eventName:v$p,event:yi,cellData:this.cellData})}function J$a(yi){const{offsetX:vi,offsetY:bi}=yi,{rowNum:_i,colNum:$i}=this.table.getCellPoint(vi,bi);if(_classPrivateFieldGet(this,R$e)!==$i||_classPrivateFieldGet(this,I$f)!==_i){let Pi=Math.min(_i,_classPrivateFieldGet(this,g$f)[0]),Ai=Math.max(_i,_classPrivateFieldGet(this,g$f)[0]),Si=Math.min($i,_classPrivateFieldGet(this,g$f)[1]),Ei=Math.max($i,_classPrivateFieldGet(this,g$f)[1]),wi=[];this.clean();for(let ki=0;ki<=Ai-Pi;ki+=1)for(let xi=0;xi<=Ei-Si;xi+=1)wi.push([ki+Pi,xi+Si]);const Ci=ki=>{const xi=new Set;if(ki.forEach(([Ri,Vi])=>{const Ni=this.getSpanCell(Ri,Vi);Ni&&xi.add(Ni)}),xi.size===0)return ki;const Ti=[...xi].map(Ri=>[...Ri]).flat(),Oi=Ti.map(Ri=>Number(Ri.split("-")[0])).sort((Ri,Vi)=>Ri-Vi),ji=Ti.map(Ri=>Number(Ri.split("-")[1])).sort((Ri,Vi)=>Ri-Vi),[Li,Ii]=[Oi[0],ji[0]],[Mi,Fi]=[Oi.at(-1),ji.at(-1)];Pi=Li!==void 0?Math.min(Pi,Li):Pi,Ai=Mi!==void 0?Math.max(Ai,Mi):Ai,Si=Ii!==void 0?Math.min(Si,Ii):Si,Ei=Fi!==void 0?Math.max(Ei,Fi):Ei;const Bi=[];for(let Ri=0;Ri<=Ai-Pi;Ri+=1)for(let Vi=0;Vi<=Ei-Si;Vi+=1)Bi.push([Ri+Pi,Vi+Si]);return Bi.length!==ki.length?Ci(Bi):Bi};wi=Ci(wi),_classPrivateFieldSet(this,m$n,new Set(wi.map(ki=>ki.join("-")))),_classPrivateMethodGet(this,T$e,k$h).call(this),this.table.handleEvents(v$p,{event:yi,eventName:v$p,cellData:this.cellData})}_classPrivateFieldSet(this,I$f,_i),_classPrivateFieldSet(this,R$e,$i)}function Q$7(){return P$j(_classPrivateFieldGet(this,m$n)).map(yi=>yi.split("-").map(Number))}function Z$7(){return[...this.cellData].at(0)}function tt$6(){return[...this.cellData].at(-1)}function et$6(){this.table.container.removeEventListener("mousemove",this.mousemove)}function lt$5(){_classPrivateMethodGet(this,W$i,O$m).call(this,!0)}function st$6(){_classPrivateMethodGet(this,W$i,O$m).call(this,!1)}function it$6(yi,vi){_classPrivateFieldGet(this,N$d)&&cancelIdleCallback(_classPrivateFieldGet(this,N$d)),_classPrivateFieldSet(this,N$d,requestIdleCallback(()=>{if(typeof yi=="number"&&typeof vi=="number"){const bi=this.getSpanCell(yi,vi)||new Set;_classPrivateFieldSet(this,m$n,new Set([...bi,`${yi}-${vi}`]))}else Array.isArray(yi)&&_classPrivateFieldSet(this,m$n,new Set(yi.map(bi=>bi.join("-"))));_classPrivateMethodGet(this,T$e,k$h).call(this)}))}function at$6(){if(this.spanCellData.size!==0){const yi=new Map;this.spanCellData.forEach(vi=>{const bi=[...vi].at(0).split("-").map(Number),_i=[...vi].at(-1).split("-").map(Number);_classPrivateMethodGet(this,z$c,V$e).call(this,bi,_i).forEach(($i,Pi)=>{const Ai=yi.get(Pi)||[];Ai.push($i),yi.set(Pi,Ai)})}),yi.forEach((vi,bi)=>{bi.cut(vi)})}this.selectCell(this.cellData)}function nt$6(){_classPrivateFieldGet(this,m$n).clear(),this.cellDom.removeAttribute("x"),this.cellDom.removeAttribute("y"),this.cellDom.removeAttribute("width"),this.cellDom.removeAttribute("height")}function rt$6(yi){yi.forEach(vi=>{this.spanCellData.forEach(bi=>{bi.delete(vi),bi.size===0&&this.spanCellData.delete(bi)})})}function ot$6(yi,vi){if(this.spanCellData.size>0){const bi=this.getSpanCellData(),_i=[];bi.forEach(Pi=>{if(!Pi.some(Ai=>Ai[vi]===yi)){const Ai=Pi.map(Si=>Si.map((Ei,wi)=>vi===wi&&Ei>yi?Ei-1:Ei));_i.push(Ai)}});const $i=new Set;_i.forEach(Pi=>{Pi=P$j(Pi);const Ai=Pi.map(([Si=0,Ei=0])=>`${Si}-${Ei}`);$i.add(new Set(Ai))}),this.spanCellData=$i}}function ht$4(yi,vi){const bi=`${yi}-${vi}`;for(const _i of this.spanCellData)if(_i.has(bi))return _i;return null}function ct$5(){return[...this.spanCellData].map(yi=>[...yi].map(vi=>vi.split("-").map(Number)))}let ut$5=class{constructor(vi,bi=[]){return K$5.call(this,vi,bi)}get vLines(){return X$7.call(this)}get hLines(){return Y$7.call(this)}mousedown(vi){return q$6.call(this,vi)}mousemove(vi){return J$a.call(this,vi)}get cellData(){return Q$7.call(this)}get startCell(){return Z$7.call(this)}get endCell(){return tt$6.call(this)}mouseup(){return et$6.call(this)}spanCell(){return lt$5.call(this)}splitCell(){return st$6.call(this)}selectCell(vi,bi){return it$6.call(this,vi,bi)}updateCell(){return at$6.call(this)}clean(){return nt$6.call(this)}removeSpanCellData(vi){return rt$6.call(this,vi)}updateSpanCellDataAfterRemoveLine(vi,bi){return ot$6.call(this,vi,bi)}getSpanCell(vi,bi){return ht$4.call(this,vi,bi)}getSpanCellData(){return ct$5.call(this)}};function k$h(yi,vi){if(!this.startCell||!this.endCell)return;const{height:bi,width:_i}=this.table;let[$i,Pi]=this.startCell,[Ai,Si]=this.endCell;$i=yi!=null?yi:$i,Ai=yi!=null?yi:Ai,Pi=vi!=null?vi:Pi,Si=vi!=null?vi:Si;const Ei=this.hLines[$i-1],wi=this.hLines[Ai],Ci=this.vLines[Pi-1],ki=this.vLines[Si],xi=Ci?Ci.pos:0,Ti=Ei?Ei.pos:0,Oi=ki?ki.pos:_i,ji=wi?wi.pos:bi,Li=this.cellDom;Li.setAttribute("x",xi),Li.setAttribute("y",Ti),Li.setAttribute("width",Oi-xi),Li.setAttribute("height",ji-Ti)}function O$m(yi){if(this.table.isFrozen||!this.startCell||!this.endCell||_classPrivateFieldGet(this,m$n).size<2)return;const[vi,bi]=this.startCell,[_i,$i]=this.endCell;if(($i-bi+1)*(_i-vi+1)!==_classPrivateFieldGet(this,m$n).size)return;yi?(_classPrivateMethodGet(this,B$b,pt$3).call(this,_classPrivateFieldGet(this,m$n)),this.updateCell()):(this.removeSpanCellData(_classPrivateFieldGet(this,m$n)),_classPrivateMethodGet(this,z$c,V$e).call(this,this.startCell,this.endCell).forEach((Ai,Si)=>{Si.revertCut(Ai)}));let Pi=k$o;yi&&(Pi=F$k),this.table.handleEvents(Pi)}function pt$3(yi){let vi=new Set;this.spanCellData.forEach(bi=>{let _i=!1;for(const $i of yi)if(bi.has($i)){_i=!0;break}_i&&(vi=new Set([...vi,...bi,...yi]),this.spanCellData.delete(bi))}),vi.size>0?(vi=new Set(P$j(vi)),this.spanCellData.add(vi)):this.spanCellData.add(new Set(yi))}function V$e(yi,vi){const{hLines:bi,vLines:_i}=this,{width:$i,height:Pi}=this.table,[Ai,Si]=yi,[Ei,wi]=vi,[Ci,ki]=[bi[Ai-1],bi[Ei]],[xi,Ti]=[_i[Si-1],_i[wi]],Oi=bi.slice(Ai,Ei),ji=_i.slice(Si,wi),Li=new Map;return Oi.forEach(Ii=>{Li.set(Ii,[(xi==null?void 0:xi.pos)||0,(Ti==null?void 0:Ti.pos)||$i])}),ji.forEach(Ii=>{Li.set(Ii,[(Ci==null?void 0:Ci.pos)||0,(ki==null?void 0:ki.pos)||Pi])}),Li}var W$h=new WeakMap,c$k=new WeakMap,d$e=new WeakMap;function M$c(){return this.dom}function H$b(){return this.dom.querySelector(".widget-content")}function S$k(){return F$e.concat(["table-widget"])}function A$k(){return[this.outline[0],this.outline[1]]}function P$i(yi){_classPrivateFieldGet(this,c$k)!==yi&&(yi>=2?this.vLines.setLine(yi-_classPrivateFieldGet(this,c$k)):this.vLines.setLine(-1)),_classPrivateFieldSet(this,c$k,yi)}function V$d(){return _classPrivateFieldGet(this,c$k)}function O$l(yi){_classPrivateFieldGet(this,d$e)!==yi&&(yi>=2?this.hLines.setLine(yi-_classPrivateFieldGet(this,d$e)):this.hLines.setLine(-1),_classPrivateFieldSet(this,d$e,yi))}function N$c(){return _classPrivateFieldGet(this,d$e)}function R$d(){return this.colCount*8}function B$a(){return this.rowCount*8}function G$9(yi){_defineProperty(this,"MIN_LINE_SPACE",5),_defineProperty(this,"lineWrapper",M$k("g","table-line-wrapper")),_classPrivateFieldInitSpec(this,W$h,{writable:!0,value:[40,20]}),_classPrivateFieldInitSpec(this,c$k,{writable:!0,value:0}),_classPrivateFieldInitSpec(this,d$e,{writable:!0,value:0}),_defineProperty(this,"deleting",!1),_defineProperty(this,"inserting",!1);const[vi]=yi,bi={onDimensionsUpdated:_i=>{this.handleOutlineUpdate(_i)}};this.initializeByData(vi.data),this.vLines.finishDrawing(),this.hLines.finishDrawing(),this.svg.insertBefore(this.tableCell.wrapper,this.svg.firstElementChild),this.dom.addEventListener("mousedown",_i=>this.tableCell.mousedown(_i)),this.resizeAbility=this.createResizeAbility(bi)}function U$9(yi){this.updateOutline(this.parseRect(yi.rect)),this.onOutlineUpdated();const{vContainer:vi,hContainer:bi}=this.createLineContainers(yi);this.vLines=vi,this.hLines=bi,this.vLines.lineCount&&_classPrivateFieldSet(this,c$k,this.vLines.lineCount+1),this.hLines.lineCount&&_classPrivateFieldSet(this,d$e,this.hLines.lineCount+1);let{vLines:_i,hLines:$i,spanCellData:Pi=[]}=this.parameters.data;_i&&$i&&(Pi=gt$6(Pi,$i.length+1,_i.length+1,this.viewportInfo.rotation)),this.tableCell=new ut$5(this,Pi),this.createView(yi),this.onOutlineUpdated()}function k$g(yi){ue.prototype.updateByData.call(this,yi);let{hLines:vi,vLines:bi,spanCellData:_i=[],rect:$i}=yi;const{vLines:Pi,hLines:Ai,tableCell:Si}=this;if(vi&&bi){const{rotation:Ei,scale:wi}=this.viewportInfo;_i=gt$6(_i,vi.length+1,bi.length+1,Ei);let Ci=Math.abs($i[2]-$i[0]),ki=Math.abs($i[3]-$i[1]);wi!==1&&(bi=bi.map(xi=>wi*(xi!=null?xi:0)),vi=vi.map(xi=>wi*(xi!=null?xi:0)),Ci*=wi,ki*=wi),Ei&&(vi=_t$5({rotation:Ei,width:Ci,height:ki},vi,"H"),bi=_t$5({rotation:Ei,width:Ci,height:ki},bi,"V")),Ei===90||Ei===270?(this.vLines=new Y$8("V",this,vi),this.hLines=new Y$8("H",this,bi)):(this.vLines=new Y$8("V",this,bi),this.hLines=new Y$8("H",this,vi)),_classPrivateFieldSet(this,c$k,this.vLines.lineCount+1),_classPrivateFieldSet(this,d$e,this.hLines.lineCount+1),this.vLines.finishDrawing(),this.hLines.finishDrawing()}else this.vLines=new Y$8("V",this),this.hLines=new Y$8("H",this);this.tableCell=new ut$5(this,_i),Ai&&Pi&&(this.lineWrapper.replaceChild(this.hLines.wrapper,Ai.wrapper),this.lineWrapper.replaceChild(this.vLines.wrapper,Pi.wrapper)),Si&&this.svg.replaceChild(this.tableCell.wrapper,Si.wrapper),this.cancelDeleteLine(),this.vLines.cancelInsertLine(),this.hLines.cancelInsertLine()}function F$c(yi){const vi=ue.prototype.createContent.call(this,yi);return this.lineWrapper.appendChild(this.hLines.wrapper),this.lineWrapper.appendChild(this.vLines.wrapper),vi.appendChild(this.lineWrapper),vi}function z$b(yi,vi){ue.prototype.addAttributes.call(this,yi,vi),yi.setAttribute(`data-${S$q}`,"true"),yi.style.setProperty("--table-line-stroke-width",this.MIN_LINE_SPACE.toString())}function $$8(yi,vi){const{rotation:bi,scale:_i}=this.viewportInfo,{rect:$i}=this.parameters.data,Pi=Math.abs($i[2]-$i[0])*_i,Ai=Math.abs($i[3]-$i[1])*_i;return yi=yi.map(Si=>_i*(Si!=null?Si:0)),bi&&(yi=_t$5({rotation:bi,width:Pi,height:Ai},yi,vi)),yi}function x$h(){return _classPrivateFieldGet(this,W$h)[0]}function J$9(){return _classPrivateFieldGet(this,W$h)[1]}function q$5(yi,vi,bi,_i){this.handleOutlineUpdate([bi,_i,yi,vi]);const{cellMinWidth:$i,cellMinHeight:Pi}=this;this.colCount=Math.floor(this.width/$i)||1,this.rowCount=Math.floor(this.height/Pi)||1}function X$6(){return this.vLines.finishDrawing(),this.hLines.finishDrawing(),ue.prototype.handleDrawEnd.call(this)}function Y$6(yi){this.setOutline(yi),this.redraw()}function j$8(){this.hLines.drawLines(),this.vLines.drawLines(),this.tableCell.updateCell()}function K$4(yi,vi){var bi,_i;(bi=(_i=this.config).handleEvents)===null||bi===void 0||bi.call(_i,yi,vi)}function Q$6(yi){const vi=this.parseLines(yi.hLines||[],"H"),bi=this.parseLines(yi.vLines||[],"V"),{rotation:_i}=this.viewportInfo;if(_i===90||_i===270){const Ai=new Y$8("V",this,vi),Si=new Y$8("H",this,bi);return{vContainer:Ai,hContainer:Si}}const $i=new Y$8("V",this,bi),Pi=new Y$8("H",this,vi);return{vContainer:$i,hContainer:Pi}}function Z$6(){return!(this.rowCount<=1&&this.colCount<=1)}function ee$1(){const{rotation:yi,scale:vi}=this.viewportInfo,bi=this.width/vi,_i=this.height/vi;let $i=_t$5({rotation:-yi,width:bi,height:_i},this.hLines.toJSON(vi),"H"),Pi=_t$5({rotation:-yi,width:bi,height:_i},this.vLines.toJSON(vi),"V");(yi===90||yi===270)&&([$i,Pi]=[Pi,$i]);const Ai=gt$6(this.tableCell.getSpanCellData(),_classPrivateFieldGet(this,d$e),_classPrivateFieldGet(this,c$k),-yi);return{...ue.prototype.toData.call(this),hLines:$i,vLines:Pi,spanCellData:Ai}}function te$1(){return this.dom.classList.contains("delete-line")}function ie$1(yi,vi){let bi;if(vi==="V"?bi=this.vLines.lines.find(Pi=>Pi.frontLine===yi):bi=this.hLines.lines.find(Pi=>Pi.frontLine===yi),!bi)return;bi.moveStart();const _i=Pi=>{const{offsetX:Ai,offsetY:Si}=Pi;bi.move(Ai,Si)},$i=()=>{var Pi;(Pi=bi)===null||Pi===void 0||Pi.moveEnd(),vi==="V"?this.vLines.finishDrawing():this.hLines.finishDrawing(),this.tableCell.updateCell(),document.removeEventListener("mousemove",_i),this.handleEvents(B$f,{dir:vi,action:"MOVE"})};document.addEventListener("mousemove",_i),document.addEventListener("mouseup",$i,{once:!0})}function ne$1(){this.cancelDeleteLine(),this.cancelInsertLine(),this.tableCell.spanCell()}function se$1(){this.cancelDeleteLine(),this.cancelInsertLine(),this.tableCell.splitCell()}function le$1(yi){yi==="H"?(this.hLines.insertLine(),this.vLines.cancelInsertLine()):(this.vLines.insertLine(),this.hLines.cancelInsertLine()),this.cancelDeleteLine(),this.inserting=!0}function ae$1(){this.vLines.cancelInsertLine(),this.hLines.cancelInsertLine(),this.inserting=!1}function re$1(){this.cancelInsertLine(),this.hLines.bindEvents(),this.vLines.bindEvents(),this.container.classList.add("delete-line"),this.deleting=!0}function he$1(){this.hLines.unbindEvents(),this.vLines.unbindEvents(),this.dom.classList.remove("delete-line"),this.deleting=!1}function oe$1(yi,vi){const bi=this.hLines.lines,_i=this.vLines.lines;let $i=0,Pi=0;for(let Ai=0;Ai<=bi.length&&($i=Ai,Ai!==bi.length);Ai+=1){const Si=bi[Ai];if(vi{this.setOutline(bi)}};this.resizeAbility=this.createResizeAbility(vi),this.widget.resizeAbility=this.resizeAbility}function N$b(yi){ne$2.prototype.setOutline.call(this,yi),this.widget.redraw()}function y$k(yi){const[vi,bi]=yi;return bi.handleEvents=(_i,$i)=>{switch($i?$i.annotation=this:$i=this,this.eventBus.dispatch(_i,$i),_i){case B$f:case F$k:case k$o:{this.updateAnnotation();break}}},new me$1(vi,bi)}function O$k(){this.annotationService.updateAnnotations([this.toJSON()],{forceRender:!1})}function S$j(){return this.widget.validate()}function v$h(yi,vi){this.widget.removing||this.locked||this.widget.readyMoveLine(yi,vi)}function D$j(){this.widget.spanCell()}function P$h(){this.widget.splitCell()}function z$a(yi){this.widget.insertLine(yi)}function R$c(){this.widget.cancelInsertLine()}function k$f(){this.widget.deleteLine()}function I$e(){this.widget.cancelDeleteLine()}function W$g(yi,vi){return this.widget.getCellPoint(yi,vi)}function x$g(yi){this.widget.getRowHeight(yi)}function B$9(yi){this.widget.getColWidth(yi)}function G$8(){return this.widget.tableCell}function H$a(){const{hLines:yi,vLines:vi,spanCellData:bi}=this.widget.toData();return{...ne$2.prototype.toJSON.call(this),hLines:yi,vLines:vi,spanCellData:bi}}let u$f=class extends ne$2{constructor(vi){return super(vi),L$c.call(this,vi)}setOutline(vi){return N$b.call(this,vi)}createWidget(...vi){return y$k.call(this,vi)}updateAnnotation(){return O$k.call(this)}check(){return S$j.call(this)}readyMoveLine(vi,bi){return v$h.call(this,vi,bi)}spanCell(){return D$j.call(this)}splitCell(){return P$h.call(this)}insertLine(vi){return z$a.call(this,vi)}cancelInsertLine(){return R$c.call(this)}deleteLine(){return k$f.call(this)}cancelDeleteLine(){return I$e.call(this)}getCellPoint(vi,bi){return W$g.call(this,vi,bi)}getRowHeight(vi){return x$g.call(this,vi)}getColWidth(vi){return B$9.call(this,vi)}get tableCell(){return G$8.call(this)}toJSON(){return H$a.call(this)}};function V$c({customType:yi,isResizeEnable:vi=!0,isAlwaysShow:bi=!0,isAlwaysShowControlBar:_i=!1,classNames:$i=[],locked:Pi=!1,autoFocusOnClick:Ai=!1,autoFocusOnEnter:Si=!1,dataset:Ei=[],events:wi=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function Ci(xi){_defineProperty(this,"customType",yi),_defineProperty(this,"isResizeEnable",vi),_defineProperty(this,"autoFocusOnClick",Ai),_defineProperty(this,"autoFocusOnEnter",Si),_defineProperty(this,"events",wi),this.locked=Pi,this.isAlwaysShow=_i||bi,this.isAlwaysShowControlBar=_i}class ki extends u$f{constructor(...Ti){const[Oi]=Ti;return Oi.data.classNames=[...Oi.data.classNames||[],...$i],Oi.data.dataset=[...Oi.data.dataset||[],...Ei],super(...Ti),Ci.call(this,Ti)}}return _defineProperty(ki,"ParentType",E$p.Table),ki}function e$1(yi){_defineProperty(this,"subj","Highlight"),_defineProperty(this,"color",[250,205,90]),this.quadPoints=yi.quadPoints,yi.subj==="Rect"&&(this.color=[...te$5]),this.subj=yi.subj||"Highlight"}let a$e=class extends m$q{constructor(vi){return super(vi,E$p.Highlight),e$1.call(this,vi)}};function a$d(yi){this.parentId=yi.parentId,this.parentRect=yi.parentRect,this.parentType=yi.parentType}let o$8=class extends m$q{constructor(vi){return super(vi,E$p.Popup),a$d.call(this,vi)}};function s$c(yi){_defineProperty(this,"subj","Underline"),_defineProperty(this,"color",[251,91,136]),_defineProperty(this,"borderStyle",{width:1,style:1,dashArray:[]}),this.quadPoints=yi.quadPoints}let i$7=class extends m$q{constructor(vi){return super(vi,E$p.Underline),s$c.call(this,vi)}};function i$6(yi){_defineProperty(this,"subj","StrikeOut"),_defineProperty(this,"color",[251,91,136]),_defineProperty(this,"borderStyle",{width:1,style:1,dashArray:[]}),this.quadPoints=yi.quadPoints}let a$c=class extends m$q{constructor(vi){return super(vi,E$p.StrikeOut),i$6.call(this,vi)}};function d$d(yi,vi,bi){this.x=yi,this.y=vi,this.pageNumber=bi}let a$b=class{constructor(vi,bi,_i){return d$d.call(this,vi,bi,_i)}};var r$a=new WeakMap;function _$j(){return _classPrivateFieldGet(this,r$a).promise}function m$m(yi,vi){_classPrivateFieldInitSpec(this,r$a,{writable:!0,value:o$c()}),this.pos=yi,this.selection=vi,this.selection.getCharOutline(this.pos).then(bi=>{if(bi){this.start=new a$b(bi[0],bi[1]),this.end=new a$b(bi[2],bi[3]);const[_i]=D$o(bi);this.height=_i,_classPrivateFieldGet(this,r$a).resolve(bi)}})}let S$i=class{get resolved(){return _$j.call(this)}constructor(vi,bi){return m$m.call(this,vi,bi)}};function x$f(){return Math.min(this.anchor,this.head)}function P$g(){return Math.min(this.anchor,this.head)}function w$i(){return Math.abs(this.head-this.anchor)}function v$g(){return this.head-this.anchor}function y$j(){return this.cursor.resolved}function C$h(){return this.parameters.pageView}function T$d(){return this.pdfPage.pageNumber}function O$j(){return this.pageView.pdfPage}function b$f(){return this.pageView.viewport.scale}function R$b(yi,vi,bi){_defineProperty(this,"text",null),_defineProperty(this,"outlines",[]),this.anchor=yi,this.head=vi,this.parameters=bi,this.cursor=new S$i(this.head,this)}async function M$b(yi){const vi=await this.pdfPage.getCharCount();vi&&yi>=vi&&(yi-=1);let bi=await this.pdfPage.getRangeRects(yi,1);const _i=await this.pdfPage.selectTextService.getOriginalPageInfo(this.pageNumber);return bi=this.pdfPage.selectTextService.convertToViewportRectangle(bi,_i),bi[0]}async function z$9(){const yi=await this.getOutlines(),vi=T$l(yi);await this.cursor.resolved;let bi,_i;if(this.direction>0){const $i=yi.at(-1);bi={x:$i[2]-vi[0],y:$i[1]-vi[1]},_i={x:$i[2]-vi[0],y:$i[1]+this.cursor.height-vi[1]}}else{const $i=yi.at(0);bi={x:$i[0]-vi[0],y:$i[1]-vi[1]},_i={x:$i[0]-vi[0],y:$i[1]+this.cursor.height-vi[1]}}return[bi,_i]}let N$a=class{get from(){return x$f.call(this)}get to(){return P$g.call(this)}get size(){return w$i.call(this)}get direction(){return v$g.call(this)}get cursorResolved(){return y$j.call(this)}get pageView(){return C$h.call(this)}get pageNumber(){return T$d.call(this)}get pdfPage(){return O$j.call(this)}get scale(){return b$f.call(this)}constructor(vi,bi=vi,_i){return R$b.call(this,vi,bi,_i)}async getCharOutline(vi){return M$b.call(this,vi)}async getCursorPath(){return z$9.call(this)}};async function V$b(yi){if(this.text)return this.text;const vi=await this.pdfPage.getRangeText(this.from,this.size,yi);return this.text=vi,vi}async function G$7(){if(this.outlines.length>0)return this.outlines;const yi=[];if(this.size>0){let vi=await this.pdfPage.getRangeRects(this.from,this.size);const bi=await this.pdfPage.selectTextService.getOriginalPageInfo(this.pageNumber);vi=jt$2(vi),vi=this.pdfPage.selectTextService.convertToViewportRectangle(vi,bi),vi.forEach(_i=>{_i[2]-_i[0]>0&&_i[3]-_i[1]>0&&yi.push(_i)})}else{const vi=await this.cursor.resolved;yi.push([vi[0],vi[1],vi[0],vi[1]])}return this.outlines=yi,yi}function I$d(){return new l$c(this.anchor,this.head-1,this.parameters)}function F$b(yi,vi){return new l$c(yi,vi,this.parameters)}let l$c=class extends N$a{async getText(vi=!1){return V$b.call(this,vi)}async getOutlines(){return G$7.call(this)}trim(){return I$d.call(this)}new({anchor:vi,head:bi}){return F$b.call(this,vi,bi)}};function W$f(){this.selections=[]}function k$e(yi,vi){vi>0?this.selections.push(yi):this.selections.unshift(yi)}async function A$j(){const yi=[];for(const vi of this.selections)(await vi.getText()).endsWith(` `)?yi.push(vi.trim()):yi.push(null);for(let vi=0;vi{bi.preventDefault();const{shiftKey:_i}=bi;if(this.charCount!==0&&!this.loading){if(bi.key==="c"&&(bi.ctrlKey||bi.metaKey)){this.copy();return}if(Object.values(f$e).includes(bi.key)){this.loading=!0;let $i,Pi,Ai;const[Si,Ei]=this.focusIndex;switch(await this.getNeighborIndexesPromise.promise,bi.key){case f$e.R:if(_i){if(Si===this.charCount){this.loading=!1;return}this.focusIndex=this.focusIndex.map(xi=>xi+1)}else if(this.text)this.direction===-1?this.focusIndex=[...this.anchorIndex]:this.anchorIndex=[...this.focusIndex];else{if(this.anchorIndex[1]>=this.charCount){this.loading=!1;return}this.anchorIndex=this.anchorIndex.map(xi=>xi+1)}await this.getNeighborIndexes(this.focusIndex[0]);break;case f$e.L:if(_i){if(Ei===0){this.loading=!1;return}this.focusIndex=this.focusIndex.map(xi=>xi-1)}else if(this.text)$i=-1,this.direction===-1?this.anchorIndex=[...this.focusIndex]:this.focusIndex=[...this.anchorIndex];else{if(this.anchorIndex[0]===0){this.loading=!1;return}this.anchorIndex=this.anchorIndex.map(xi=>xi-1)}await this.getNeighborIndexes(this.focusIndex[0]);break;case f$e.U:if(this.keySteps-=1,Ai=this.indexes[this.keySteps],Ai===void 0){this.keySteps+=1,this.loading=!1;return}this.focusIndex=[Ai,Ai],_i||(this.anchorIndex=[Ai,Ai]);break;case f$e.D:if(this.keySteps+=1,Pi=this.indexes[this.keySteps],Pi===void 0){this.keySteps-=1,this.loading=!1;return}this.focusIndex=[Pi,Pi],_i||(this.anchorIndex=[Pi,Pi]);break}if(_i||(this.focusIndex=[...this.anchorIndex],this.text="",this.setCtrlBarVisibility(!1)),bi.key===f$e.L&&this.text&&this.focusIndex.every(xi=>xi-this.anchorIndex[0]===-1)){this.loading=!1,this.text="",this.container.innerHTML="",_classPrivateMethodGet(this,p$e,m$l).call(this,-1),this.focusIndex=this.focusIndex.map(xi=>xi+1),this.anchorIndex=[...this.focusIndex],this.setCtrlBarVisibility(!1);return}if(bi.key===f$e.R&&this.text&&this.focusIndex.every(xi=>xi-this.anchorIndex[0]===0)){this.loading=!1,this.text="",this.container.innerHTML="",_classPrivateMethodGet(this,p$e,m$l).call(this,1),this.setCtrlBarVisibility(!1);return}const[wi,Ci]=this.getIndexAndCount();this.selection=new l$c(wi,wi+Ci,{pageView:this.parameters.pageView});const ki=await this.selection.getOutlines();_i&&await this.selection.getText(),this.loading=!1,ki.length&&(_classPrivateMethodGet(this,C$g,U$8).call(this),this.container.innerHTML="",this.text&&this.container.appendChild(xt$4(this.selection.outlines))),_classPrivateMethodGet(this,p$e,m$l).call(this,$i)}}}}),_defineProperty(this,"genHighligtDatas",(bi="Highlight")=>{const{rect:_i,pageNumber:$i,authorID:Pi}=this.toJSON(),Ai=_classPrivateMethodGet(this,S$h,O$i).call(this),Si=new a$e({quadPoints:Ai,rect:_i,titleObj:{str:this.author,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},pageNumber:$i,subj:bi,authorID:Pi}),Ei=_classPrivateMethodGet(this,T$c,P$f).call(this,_i,Si,$i);return Si.popupId=Ei.id,Ei.parentId=Si.id,[Si,Ei]}),_defineProperty(this,"genUnderlineDatas",()=>{const{rect:bi,pageNumber:_i,authorID:$i}=this.toJSON(),Pi=_classPrivateMethodGet(this,S$h,O$i).call(this),Ai=new i$7({quadPoints:Pi,rect:bi,titleObj:{str:this.author,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},pageNumber:_i,authorID:$i}),Si=_classPrivateMethodGet(this,T$c,P$f).call(this,bi,Ai,_i);return Ai.popupId=Si.id,Si.parentId=Ai.id,[Ai,Si]}),this.className.push("select-text"),document.addEventListener("keydown",_classPrivateFieldGet(this,v$f)),this.update(yi.data)}function ot$5(yi,vi){}function rt$5(){const[yi,vi]=this.anchorIndex,[bi,_i]=this.focusIndex,$i=_i>vi?vi:yi,Pi=_i>vi?bi:_i,Ai=Math.abs($i-Pi);return[Math.min($i,Pi),Ai]}function at$5(){const[,yi]=this.anchorIndex,[,vi]=this.focusIndex;return Math.sign(vi-yi)}function ht$3(){const yi=this.selection.outlines.at(-1);return yi?[yi[0],yi[1]]:[0,0]}function ct$4(){if(!this.selection)return 0;const yi=this.selection.outlines.at(-1);return yi?Math.abs(yi[2]-yi[0]):0}function lt$4(){if(!this.selection)return 0;const yi=this.selection.outlines.at(-1);return yi?Math.abs(yi[3]-yi[1]):0}function ut$4(yi){return ne$2.prototype.update.call(this,yi),null}function dt$3(){return ne$2.prototype.render.call(this),this.container}function xt$1(){var yi;return((yi=this.container.parentElement)===null||yi===void 0?void 0:yi.style.cursor)==="text"}async function ft$2(yi){this.getNeighborIndexesPromise=o$c();const[vi,bi]=await Promise.all([this.parameters.pdfPage.selectTextService.getNeighborIndexes({pageIndex:this.pageNumber-1,start:yi,direction:-1}),this.parameters.pdfPage.selectTextService.getNeighborIndexes({pageIndex:this.pageNumber-1,start:yi,direction:1})]);return this.indexes=await _classPrivateMethodGet(this,G$6,Tt).call(this,[...vi.reverse(),...bi],yi),this.keySteps=this.indexes.indexOf(this.focusIndex[0]),this.getNeighborIndexesPromise.resolve(!0),this.indexes}function pt$2(){const{rect:yi,pageNumber:vi,authorID:bi}=this.toJSON(),_i=_classPrivateMethodGet(this,S$h,O$i).call(this),$i=new a$c({quadPoints:_i,rect:yi,titleObj:{str:this.author,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},pageNumber:vi,authorID:bi}),Pi=_classPrivateMethodGet(this,T$c,P$f).call(this,yi,$i,vi);return $i.popupId=Pi.id,Pi.parentId=$i.id,[$i,Pi]}function It(){this.annotationService.copy()}function mt$2(){return this.allowInsertCursor||!!this.text}function gt$3(){const{viewportInfo:yi}=this,{scale:vi,rotation:bi}=yi;return this.selection.outlines.map(_i=>(_i=_i.map($i=>$i/vi),_i=vt$3({...yi,rotation:-bi},_i),_i))}async function _t$2(){return this.text}function yt(){return{...ne$2.prototype.toJSON.call(this),rects:this.getOutlines(),text:this.text}}function wt$1(){this.destroyed||(_classPrivateMethodGet(this,J$7,Et).call(this),document.removeEventListener("keydown",_classPrivateFieldGet(this,v$f)),ne$2.prototype.destroy.call(this))}let A$i=class extends ne$2{async reselectText(){return st$5.call(this)}constructor(vi,bi){return super(vi,bi),nt$5.call(this,vi,bi)}createWidget(vi,bi){return ot$5.call(this,vi,bi)}getIndexAndCount(){return rt$5.call(this)}get direction(){return at$5.call(this)}get ctrlBarPoint(){return ht$3.call(this)}get width(){return ct$4.call(this)}get height(){return lt$4.call(this)}update(vi){return ut$4.call(this,vi)}render(){return dt$3.call(this)}get allowInsertCursor(){return xt$1.call(this)}async getNeighborIndexes(vi){return ft$2.call(this,vi)}genStrikeOutDatas(){return pt$2.call(this)}copy(){return It.call(this)}check(){return mt$2.call(this)}getOutlines(){return gt$3.call(this)}async getText(){return _t$2.call(this)}toJSON(){return yt.call(this)}destroy(){return wt$1.call(this)}};E$j=A$i;async function St$1(yi,vi,bi=10,_i=10){return this.parameters.pdfPage.selectTextService.getNearPointIndexes({index:this.pageNumber-1,x:yi,y:vi,xTolerance:bi,yTolerance:_i})}async function k$d(){await this.selection.getOutlines(),await this.selection.getText(),this.container.innerHTML="",_classPrivateMethodGet(this,C$g,U$8).call(this),this.selection.text&&this.container.appendChild(xt$4(this.selection.outlines)),this.endSelectTextPromise.resolve(!0)}function U$8(){const[yi,vi,bi,_i]=T$l(this.selection.outlines);_get(_getPrototypeOf(E$j.prototype),"setOutline",this).call(this,[yi,vi,bi,_i])}async function Tt(yi,vi){const bi=await _classPrivateMethodGet(this,V$a,bt).call(this),_i=new Map;bi.forEach(Pi=>{const Ai=_i.get(Pi.tableId);Ai?Ai.push(Pi.charIndex):_i.set(Pi.tableId,[Pi.charIndex])});const $i=[...yi];return _i.forEach(Pi=>{const Ai=$i.findIndex(Ei=>Ei>=Pi.at(0)),Si=$i.findIndex(Ei=>Ei>Pi.at(-1));$i.splice(Ai,Si-Ai,...Pi)}),[...$i,vi].sort((Pi,Ai)=>Pi-Ai)}async function bt(){const yi=await this.parameters.pdfPage.getElementBlockInfos(),vi=[];yi.forEach((_i,$i)=>{const Pi=yi[$i+1];_i.type===C$o.TABLE_CELL?Pi&&Pi.row!==_i.row&&Pi.outline&&vi.push({tableId:_i.tableId,row:_i.row,nextOutline:Pi.outline}):(Pi==null?void 0:Pi.type)===C$o.TABLE_CELL&&vi.push({tableId:Pi.tableId,row:-1,nextOutline:Pi.outline})});const bi=async _i=>{const[$i,Pi,Ai,Si]=_i.nextOutline,Ei=Math.min(5,(Ai-$i)/2),wi=Math.min(5,(Si-Pi)/2),[,Ci]=await _classPrivateMethodGet(this,H$9,St$1).call(this,$i+Ei,Pi+wi,Ei,wi);return{..._i,charIndex:Ci}};return Promise.all(vi.map(bi))}function m$l(yi,vi=!0){var bi;if(this.destroyed)return;let _i,$i="";(bi=yi)!==null&&bi!==void 0||(yi=this.direction),yi===1?(_i=this.selection.outlines.at(-1),$i="end"):(_i=this.selection.outlines.at(0),$i="start"),_i&&(this.cursor?Ct$2($i,_i,this.cursor):(this.cursor=Ct$2($i,_i),this.container.parentElement.appendChild(this.cursor)),vi&&this.cursor.scrollIntoView({block:"nearest"})),this.eventBus.dispatch(X$g,this)}function Et(){var yi;(yi=this.cursor)===null||yi===void 0||yi.remove(),this.cursor=null}function O$i(){const{rects:yi}=this.toJSON(),vi=[],bi=this.pageInfo.rotation,_i=this.viewportInfo.rotation;return yi.forEach(([$i,Pi,Ai,Si])=>{const Ei=[];bi!==_i?(Ei.push({x:$i,y:Pi}),Ei.push({x:$i,y:Si}),Ei.push({x:Ai,y:Pi}),Ei.push({x:Ai,y:Si})):(Ei.push({x:$i,y:Pi}),Ei.push({x:Ai,y:Pi}),Ei.push({x:$i,y:Si}),Ei.push({x:Ai,y:Si})),vi.push(Ei)}),vi}function P$f(yi,vi,bi){return new o$8({rect:yi,pageNumber:bi,titleObj:{...vi.titleObj},contentsObj:{...vi.contentsObj},parentId:vi.id,parentRect:yi,parentType:vi.subtype,authorID:vi.authorID})}function qt({customType:yi,isAlwaysShow:vi=!0,isAlwaysShowControlBar:bi=!1,classNames:_i=[],locked:$i=!1,autoFocusOnClick:Pi=!1,autoFocusOnEnter:Ai=!1,dataset:Si=[],events:Ei=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function wi(ki){_defineProperty(this,"customType",yi),_defineProperty(this,"autoFocusOnClick",Pi),_defineProperty(this,"autoFocusOnEnter",Ai),_defineProperty(this,"events",Ei),this.locked=$i,this.isAlwaysShow=bi||vi,this.isAlwaysShowControlBar=bi}class Ci extends A$i{constructor(...xi){const[Ti]=xi;return Ti.data.classNames=[...Ti.data.classNames||[],..._i],Ti.data.dataset=[...Ti.data.dataset||[],...Si],super(...xi),wi.call(this,xi)}}return _defineProperty(Ci,"ParentType",E$p.SelectText),Ci}function m$k(yi,vi){this.initializeByData(yi.data),this.icon=this.createIcon(yi.data),this.svg.appendChild(this.icon),this.onOutlineUpdated()}function f$d(yi){this.updateOutline(this.parseRect(yi.rect)),this.createView(yi)}function y$i(yi){return document.createDocumentFragment()}function x$e(yi){ue.prototype.updateByData.call(this,yi);const[vi,bi,_i,$i]=this.outline;this.icon.setAttribute("height",String($i-bi)),this.icon.setAttribute("width",String(_i-vi))}function N$9(yi){const{width:vi,height:bi,scale:_i,rotation:$i}=this.viewportInfo,[Pi,,Ai]=yi;if(Ai-Pi===0){let Si=Math.max(yi[0]-p$j/2,0),Ei=Math.max(yi[1]-p$j,0),wi=Si+p$j,Ci=Ei+p$j;return $i===90||$i===270?(wi>bi&&(wi=bi,Si=bi-p$j),Ci>vi&&(Ci=vi,Ei=vi-p$j)):(wi>vi&&(wi=vi,Si=vi-p$j),Ci>bi&&(Ci=bi,Ei=bi-p$j)),[Si,Ei,wi,Ci].map(ki=>ki*_i)}return ue.prototype.parseRect.call(this,yi)}function A$h(yi,vi,bi,_i){}function D$i(yi){const[vi,bi,_i,$i]=this.outline,Pi=yi.name==="NoIcon"?"Comment":yi.name,Ai=M$l(`annotation-${Pi.toLowerCase()}`),Si=`${String(_i-vi)}px`,Ei=`${String($i-bi)}px`;return Ai.setAttribute("height",Ei),Ai.setAttribute("width",Si),this.updateContainerSize({height:Ei,width:Si}),Ai}function W$e(yi,vi){ue.prototype.addAttributes.call(this,yi,vi),yi.setAttribute(`data-${S$q}`,"true")}let b$e=class extends ue{constructor(vi,bi){return super(vi,bi),m$k.call(this,vi,bi)}initializeByData(vi){return f$d.call(this,vi)}createContent(vi){return y$i.call(this,vi)}updateByData(vi){return x$e.call(this,vi)}parseRect(vi){return N$9.call(this,vi)}drawing(vi,bi,_i,$i){return A$h.call(this,vi,bi,_i,$i)}createIcon(vi){return D$i.call(this,vi)}addAttributes(vi,bi){return W$e.call(this,vi,bi)}};function i$5(){return["annotation-border","text-border"]}function r$9(){return this.data.inReplyTo&&this.data.replyType==="R"}function s$b(yi,vi){this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated(),this.isResizeEnable=!1,this.getAvatar().then(bi=>{this.setAvatar(bi)})}function l$b(yi){return new b$e(...yi)}function p$d(yi){if(this.getAvatar().then(vi=>{this.setAvatar(vi)}),this.data.inReplyTo&&this.data.replyType==="R"){const vi=this.parameters.annotationService.getAnnotationById(this.data.inReplyTo);if(vi){const bi=this.parameters.annotationService.getAnnotationById(vi.data.popupId||"");bi&&bi.updateReply(this.data)}}ne$2.prototype.updateViewByData.call(this,yi)}function h$e(yi){return ne$2.prototype.update.call(this,yi),this.isReply?null:this.container}function d$c(){if(ne$2.prototype.render.call(this),this.data.inReplyTo&&this.data.replyType==="R"){const yi=this.parameters.annotationService.getAnnotationById(this.data.inReplyTo);if(yi){const vi=this.parameters.annotationService.getAnnotationById(yi.data.popupId||"");vi&&vi.updateReply(this.data)}return null}return this.container}function c$j(){const yi=ne$2.prototype.toJSON.call(this);return{...yi,rect:this.data.replyType==="R"?this.data.rect:yi.rect}}function u$e(){ne$2.prototype.destroy.call(this)}function y$h(yi){if(yi){const vi=this.getParentAnnotationElement();if(vi){const bi=vi.getPopupAnnotationElement();bi&&bi.updateReplyAvatar(this.parameters.data.id,yi)}}}function m$j(){return!0}let A$g=class extends ne$2{get defaultContentClasses(){return i$5.call(this)}get isReply(){return r$9.call(this)}constructor(vi,bi){return super(vi,bi),s$b.call(this,vi,bi)}createWidget(...vi){return l$b.call(this,vi)}updateViewByData(vi){return p$d.call(this,vi)}update(vi){return h$e.call(this,vi)}render(){return d$c.call(this)}toJSON(){return c$j.call(this)}destroy(){return u$e.call(this)}setAvatar(vi){return y$h.call(this,vi)}check(){return m$j.call(this)}};var _$i=A$g,s$a=new WeakSet;function m$i(){return F$e.concat("highlight-widget")}function _$h(yi){_classPrivateMethodInitSpec(this,s$a),_defineProperty(this,"quadrilaterals",[]),_defineProperty(this,"text","");const[vi]=yi;this.initializeByData(vi.data)}function D$h(yi){this.updateOutline(this.parseRect(yi.rect)),this.createView(yi),this.onOutlineUpdated(),this.getText().then(vi=>{this.text=vi})}function q$4(yi){ue.prototype.updateByData.call(this,yi),_classPrivateMethodGet(this,s$a,o$7).call(this)}function y$g(){}function W$d(yi){const vi=ue.prototype.createContent.call(this,yi),bi=_classPrivateMethodGet(this,s$a,o$7).call(this);return vi.append(...bi),vi}function S$g(){return{...ue.prototype.toData.call(this),quadPoints:this.parameters.data.quadPoints,subj:this.parameters.data.subj,text:this.text}}let B$8=class extends ue{get defaultClasses(){return m$i.call(this)}constructor(...vi){return super(...vi),_$h.call(this,vi)}initializeByData(vi){return D$h.call(this,vi)}updateByData(vi){return q$4.call(this,vi)}drawing(){return y$g.call(this)}createContent(vi){return W$d.call(this,vi)}toData(){return S$g.call(this)}};function o$7(){const yi=this.outline,vi=[];return this.getOutlines().forEach((bi,_i)=>{const $i=this.quadrilaterals[_i]||M$k("rect","annotation-quad"),Pi=bi[2]-bi[0],Ai=bi[3]-bi[1];$i.setAttribute("width",String(Pi)),$i.setAttribute("height",String(Ai)),$i.setAttribute("transform",`translate(${bi[0]-yi[0]}, ${bi[1]-yi[1]})`),vi.push($i)}),this.quadrilaterals.length||(this.quadrilaterals=vi),vi}function H$8(yi){_defineProperty(this,"isResizeEnable",!1),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function A$f(yi){return new B$8(...yi)}async function C$f(){const yi=await this.widget.getText();Lt$2(yi)}function x$d(){return!0}let h$d=class extends ne$2{constructor(vi){return super(vi,{createQuadrilaterals:!0,ignoreBorder:!0}),H$8.call(this,vi)}createWidget(...vi){return A$f.call(this,vi)}async copy(){return C$f.call(this)}check(){return x$d.call(this)}};var O$h=h$d;function P$e({customType:yi,isAlwaysShow:vi=!0,isAlwaysShowControlBar:bi=!1,classNames:_i=[],locked:$i=!1,autoFocusOnClick:Pi=!1,autoFocusOnEnter:Ai=!1,dataset:Si=[],events:Ei=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function wi(ki){_defineProperty(this,"customType",yi),_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"autoFocusOnClick",Pi),_defineProperty(this,"autoFocusOnEnter",Ai),_defineProperty(this,"events",Ei),this.locked=$i,this.isAlwaysShow=bi||vi,this.isAlwaysShowControlBar=bi}class Ci extends h$d{constructor(...xi){const[Ti]=xi;return Ti.data.classNames=[...Ti.data.classNames||[],..._i],Ti.data.dataset=[...Ti.data.dataset||[],...Si],super(...xi),wi.call(this,xi)}}return _defineProperty(Ci,"ParentType",E$p.Highlight),Ci}const t=dt$6();t.id=`__svg__markers__${Date.now()}`,t.style.position="absolute",t.style.width="0",t.style.height="0",document.body.prepend(t);const m$h=[{content:'',viewBox:"0 0 10 10",id:"ClosedArrow",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 9.5 10",id:"OpenArrow",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 9.5 10",id:"ROpenArrow",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 10 10",id:"RClosedArrow",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 10 10",id:"Circle",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 10 10",id:"Square",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 10 10",id:"Diamond",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 10 10",id:"Butt",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"},{content:'',viewBox:"0 0 10 10",id:"Slash",refX:"6.7",refY:"5",orient:"auto-start-reverse",markerWidth:"6",markerHeight:"6"}],d$b=[];function k$c(yi,vi,bi,_i){let $i=m$h.find(Pi=>Pi.id===yi);if($i){$i={...$i,..._i};const Pi=`${$i.id}-${bi}`;if(d$b.includes(Pi))return null;d$b.push(Pi);const Ai=M$k("marker");return Ai.setAttribute("viewBox",$i.viewBox),Ai.setAttribute("id",Pi),Ai.setAttribute("refX",$i.refX),Ai.setAttribute("refY",$i.refY),Ai.setAttribute("orient",$i.orient),Ai.setAttribute("markerWidth",$i.markerWidth),Ai.setAttribute("markerHeight",$i.markerHeight),vi&&Ai.setAttribute("fill",vi),Ai.innerHTML=$i.content,t.appendChild(Ai),Ai}return null}let u$d=class{static create(vi,bi,_i,$i={}){return k$c.call(this,vi,bi,_i,$i)}};const _$g=[{customClass:"resize-point-start",position:[0,0]},{customClass:"resize-point-end",position:[1,1]}];function D$g(){return F$e.concat("line-widget")}function W$c(yi,vi){_defineProperty(this,"backLine",M$k("line","annotation-line","back")),_defineProperty(this,"frontLine",M$k("line","annotation-line","front")),_defineProperty(this,"lineCoordinates",[]),_defineProperty(this,"lineCoordinatesTemp",[]),_defineProperty(this,"markerStart",null),_defineProperty(this,"markerEnd",null),this.initializeByData(yi.data),this.resizeAbility=this.createResizeAbility()}function y$f(yi){const{lineCoordinates:vi}=yi;if(!(vi!=null&&vi.length))return null;const{scale:bi}=this.pageInfo.viewport;let[_i,$i,Pi,Ai]=vi;return Pi!==_i&&Ai!==$i&&([_i,$i,Pi,Ai]=vt$3(this.viewportInfo,vi)),this.rotateLineCoordinates([_i,$i,Pi,Ai].map(Si=>Si*bi))}function b$d(yi){const vi=ue.prototype.createContent.call(this,yi);return vi.append(this.backLine,this.frontLine),this.frontLine.setAttribute(`data-${S$q}`,"true"),vi}function E$i(yi){const[vi,bi]=yi.lineEndpoints||[],_i=this.parseColor(yi.color),$i=u$d.create(vi,_i,this.id),Pi=u$d.create(bi,_i,this.id);this.markerStart=$i,this.markerEnd=Pi,this.updateOutline(this.parseRect(yi.rect));const Ai=this.createLineCoordinates(yi);Ai&&(this.lineCoordinates=Ai),this.createView(yi),this.onOutlineUpdated()}function w$g(yi){const vi=this.createLineCoordinates(yi);vi&&(this.lineCoordinates=vi),ue.prototype.updateByData.call(this,yi)}function A$e(){ue.prototype.onOutlineUpdated.call(this),this.drawLine()}function k$b(){const yi={borderWidth:this.borderWidth,dom:this.svg,onDimensionsUpdated:vi=>{this.lineCoordinates=[...vi],this.setOutline(vi),this.drawLine()},onResizeDone:()=>{this.eventBus.dispatch(m$v,this)},getContext:()=>({outline:this.outline,resizePoints:_$g,lineCoordinates:this.lineCoordinates})};return new Q$a(yi)}function S$f(yi,vi){const[bi,_i]=this.lineCoordinates;this.lineCoordinates=[bi,_i,yi,vi],this.setOutline(this.lineCoordinates),this.drawLine()}function v$e(){return ue.prototype.handleDrawEnd.call(this)}function z$8(yi,vi,bi,_i){const{rotation:$i}=this.viewportInfo;return $i===90?[yi,,bi]=[bi,_i,yi,vi]:$i===180?[yi,vi,bi,_i]=[bi,_i,yi,vi]:$i===270&&([,vi,,_i]=[bi,_i,yi,vi]),[yi,vi,bi,_i]}function I$c(){const[yi,vi]=this.outline,[bi,_i,$i,Pi]=this.lineCoordinates,[Ai,Si]=this.parameters.data.lineEndpoints||[];[this.backLine,this.frontLine].forEach(Ei=>{Ei.setAttribute("x1",String(bi)),Ei.setAttribute("y1",String(_i)),Ei.setAttribute("x2",String($i)),Ei.setAttribute("y2",String(Pi)),Ei.setAttribute("transform",`translate(-${yi},-${vi})`),Ai&&Ai!=="None"&&Ei.setAttribute("marker-start",`url(#${Ai}-${this.id})`),Si&&Si!=="None"&&Ei.setAttribute("marker-end",`url(#${Si}-${this.id})`)})}function O$g(){const{viewportInfo:yi}=this,{rotation:vi,scale:bi}=yi,[_i,$i,Pi,Ai]=this.rotateLineCoordinates(this.lineCoordinates).map(Si=>Si/bi);return vt$3({...yi,rotation:-vi},[_i,$i,Pi,Ai])}function R$a(yi,vi){this.moving||(this.lineCoordinatesTemp=[...this.lineCoordinates]),ue.prototype.move.call(this,yi,vi);let[bi,_i,$i,Pi]=this.lineCoordinatesTemp;const{currentWidth:Ai,currentHeight:Si}=this.pageInfo;bi+=yi,$i+=yi,_i+=vi,Pi+=vi,this.lineCoordinatesTemp=[bi,_i,$i,Pi],bi<=0&&($i-=bi,bi=0),_i<=0&&(Pi-=_i,_i=0),$i<=0&&(bi-=$i,$i=0),Pi<=0&&(_i-=Pi,Pi=0),$i>=Ai&&(bi=Ai-($i-bi),$i=Ai),Pi>=Si&&(_i=Si-(Pi-_i),Pi=Si),bi>=Ai&&($i=Ai-(bi-$i),bi=Ai),_i>=Si&&(Pi=Si-(_i-Pi),_i=Si),this.lineCoordinates=[bi,_i,$i,Pi]}function T$b(){const[yi,vi,bi,_i]=this.lineCoordinates;return W$n(yi,vi,bi,_i)>10}function B$7(){return{...ue.prototype.toData.call(this),lineCoordinates:this.getLineCoordinates()}}let V$9=class extends ue{get defaultClasses(){return D$g.call(this)}constructor(vi,bi){return super(vi,bi),W$c.call(this,vi,bi)}createLineCoordinates(vi){return y$f.call(this,vi)}createContent(vi){return b$d.call(this,vi)}initializeByData(vi){return E$i.call(this,vi)}updateByData(vi){return w$g.call(this,vi)}onOutlineUpdated(){return A$e.call(this)}createResizeAbility(){return k$b.call(this)}drawing(vi,bi){return S$f.call(this,vi,bi)}handleDrawEnd(){return v$e.call(this)}rotateLineCoordinates([vi,bi,_i,$i]){return z$8.call(this,vi,bi,_i,$i)}drawLine(){return I$c.call(this)}getLineCoordinates(){return O$g.call(this)}move(vi,bi){return R$a.call(this,vi,bi)}validate(){return T$b.call(this)}toData(){return B$7.call(this)}};function l$a(yi){_defineProperty(this,"isResizeEnable",!0),_defineProperty(this,"resizePoints",[{customClass:"resize-point-start",position:[0,0]},{customClass:"resize-point-end",position:[1,1]}]),this.initialize(yi.data),this.container=this.createView(this.data),this.resizeAbility=this.createResizeAbility(),this.onOutlineUpdated()}function h$c(yi){return new V$9(...yi)}function c$i(){var yi;const vi={borderWidth:(yi=this.data.borderStyle)===null||yi===void 0?void 0:yi.width,dom:this.widget.svg,onDimensionsUpdated:_i=>{this.widget.lineCoordinates=[..._i],this.setOutline(_i),this.widget.drawLine()},onResizeDone:()=>{this.eventBus.dispatch(m$v,this)},getContext:()=>({outline:this.outline,resizePoints:this.resizePoints,lineCoordinates:this.widget.lineCoordinates})},bi=new Q$a(vi);return this.widget.resizeAbility=bi,bi}function u$c(){return this.widget.validate()}function m$g(){const yi=this.widget.getLineCoordinates();return{...ne$2.prototype.toJSON.call(this),lineCoordinates:yi}}let p$c=class extends ne$2{constructor(vi){return super(vi,{ignoreBorder:!0}),l$a.call(this,vi)}createWidget(...vi){return h$c.call(this,vi)}createResizeAbility(){return c$i.call(this)}check(){return u$c.call(this)}toJSON(){return m$g.call(this)}};var w$f=p$c;function u$b(){return F$e.concat("strike-out-widget")}function h$b(yi,vi){_defineProperty(this,"lines",[]),_defineProperty(this,"text",""),this.initializeByData(yi.data)}function l$9(yi){const vi=ue.prototype.createContent.call(this,yi);return vi.append(...this.lines),vi}function c$h(yi,vi,bi,_i){}function d$a(yi){this.updateOutline(this.parseRect(yi.rect)),this.lines=this.createLines(yi),this.createView(yi),this.onOutlineUpdated(),this.getText().then(vi=>{this.text=vi})}function p$b(yi){ue.prototype.updateByData.call(this,yi),this.lines.forEach(vi=>vi.remove()),this.lines=this.createLines(yi),this.svg.append(...this.lines)}function _$f(){return{...ue.prototype.toData.call(this),quadPoints:this.parameters.data.quadPoints,text:this.text}}let y$e=class extends ue{get defaultClasses(){return u$b.call(this)}constructor(vi,bi){return super(vi,bi),h$b.call(this,vi,bi)}createContent(vi){return l$9.call(this,vi)}drawing(vi,bi,_i,$i){return c$h.call(this,vi,bi,_i,$i)}initializeByData(vi){return d$a.call(this,vi)}updateByData(vi){return p$b.call(this,vi)}toData(){return _$f.call(this)}};function w$e(yi){_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"lines",[]),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function y$d(yi){return new y$e(...yi)}async function A$d(){const yi=await this.widget.getText();Lt$2(yi)}function C$e(){return!0}let u$a=class extends ne$2{constructor(vi){return super(vi,{createQuadrilaterals:!0,ignoreBorder:!0}),w$e.call(this,vi)}createWidget(...vi){return y$d.call(this,vi)}async copy(){return A$d.call(this)}check(){return C$e.call(this)}};var z$7=u$a;function P$d({customType:yi,isAlwaysShow:vi=!0,isAlwaysShowControlBar:bi=!1,classNames:_i=[],locked:$i=!1,autoFocusOnClick:Pi=!1,autoFocusOnEnter:Ai=!1,dataset:Si=[],events:Ei=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function wi(ki){_defineProperty(this,"customType",yi),_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"autoFocusOnClick",Pi),_defineProperty(this,"autoFocusOnEnter",Ai),_defineProperty(this,"events",Ei),this.locked=$i,this.isAlwaysShow=bi||vi,this.isAlwaysShowControlBar=bi}class Ci extends u$a{constructor(...xi){const[Ti]=xi;return Ti.data.classNames=[...Ti.data.classNames||[],..._i],Ti.data.dataset=[...Ti.data.dataset||[],...Si],super(...xi),wi.call(this,xi)}}return _defineProperty(Ci,"ParentType",E$p.StrikeOut),Ci}function o$6(){return F$e.concat("underline-widget")}function d$9(yi,vi){_defineProperty(this,"lines",[]),_defineProperty(this,"text",""),this.initializeByData(yi.data)}function h$a(yi){const vi=ue.prototype.createContent.call(this,yi);return vi.append(...this.lines),vi}function c$g(yi,vi,bi,_i){}function u$9(yi){this.updateOutline(this.parseRect(yi.rect)),this.lines=this.createLines(yi),this.createView(yi),this.onOutlineUpdated(),this.getText().then(vi=>{this.text=vi})}function p$a(yi){ue.prototype.updateByData.call(this,yi),this.lines.forEach(vi=>vi.remove()),this.lines=this.createLines(yi),this.svg.append(...this.lines)}function _$e(){return{...ue.prototype.toData.call(this),quadPoints:this.parameters.data.quadPoints,text:this.text}}let y$c=class extends ue{get defaultClasses(){return o$6.call(this)}constructor(vi,bi){return super(vi,bi),d$9.call(this,vi,bi)}createContent(vi){return h$a.call(this,vi)}drawing(vi,bi,_i,$i){return c$g.call(this,vi,bi,_i,$i)}initializeByData(vi){return u$9.call(this,vi)}updateByData(vi){return p$a.call(this,vi)}toData(){return _$e.call(this)}};function A$c(yi){_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"lines",[]),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function C$d(yi){return new y$c(...yi)}async function x$c(){const yi=await this.widget.getText();Lt$2(yi)}function g$e(){return!0}let l$8=class extends ne$2{constructor(vi){return super(vi,{createQuadrilaterals:!0,ignoreBorder:!0}),A$c.call(this,vi)}createWidget(...vi){return C$d.call(this,vi)}async copy(){return x$c.call(this)}check(){return g$e.call(this)}};var O$f=l$8;function P$c({customType:yi,isAlwaysShow:vi=!0,isAlwaysShowControlBar:bi=!1,classNames:_i=[],locked:$i=!1,autoFocusOnClick:Pi=!1,autoFocusOnEnter:Ai=!1,dataset:Si=[],events:Ei=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function wi(ki){_defineProperty(this,"customType",yi),_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"autoFocusOnClick",Pi),_defineProperty(this,"autoFocusOnEnter",Ai),_defineProperty(this,"events",Ei),this.locked=$i,this.isAlwaysShow=bi||vi,this.isAlwaysShowControlBar=bi}class Ci extends l$8{constructor(...xi){const[Ti]=xi;return Ti.data.classNames=[...Ti.data.classNames||[],..._i],Ti.data.dataset=[...Ti.data.dataset||[],...Si],super(...xi),wi.call(this,xi)}}return _defineProperty(Ci,"ParentType",E$p.Underline),Ci}function _$d(){return F$e.concat("ink-widget")}function I$b(yi,vi){_defineProperty(this,"lines",[]),_defineProperty(this,"frontLines",[]),this.initializeByData(yi.data)}function L$b(yi){this.updateOutline(yi),ue.prototype.onOutlineUpdated.call(this)}function g$d(){ue.prototype.onOutlineUpdated.call(this),this.drawInk(this.inkLists)}function W$b(yi,vi){ue.prototype.addAttributes.call(this,yi,vi);const bi=et$9([200,133,218],0);yi.style.setProperty("--color",bi)}function D$f(yi){const vi=this.viewportInfo,bi=this.outline[2]-this.outline[0],_i=this.outline[3]-this.outline[1];return yi.map($i=>$i.map(({x:Pi,y:Ai})=>((bi!==0||_i!==0)&&([Pi,Ai]=Mt$2(vi,[Pi,Ai])),[Pi,Ai]=[Pi*vi.scale,Ai*vi.scale],{x:Pi,y:Ai})))}function v$d(yi){this.updateOutline(this.parseRect(yi.rect)),this.onOutlineUpdated(),this.inkLists=this.parseInkLists(JSON.parse(yi.inkLists)),this.createView(yi)}function w$d(yi){typeof yi.inkLists=="string"?this.inkLists=this.parseInkLists(JSON.parse(yi.inkLists)):this.inkLists=this.parseInkLists(yi.inkLists),ue.prototype.updateByData.call(this,yi)}function y$b(yi){const vi=document.createDocumentFragment(),bi=this.createInkLines(this.inkLists),_i=bi.map($i=>{const Pi=$i.cloneNode();return Pi.classList.add("front"),Pi});return vi.append(ue.prototype.createContent.call(this,yi)),vi.append(...bi),vi.append(..._i),this.lines=bi,this.frontLines=_i,vi}function A$b(yi){const[vi,bi]=this.outline,[_i,$i]=yi,Pi=vi-_i,Ai=bi-$i;this.inkLists=this.inkLists.map(Si=>Si.map(({x:Ei,y:wi})=>(Ei+=Pi,wi+=Ai,{x:Ei,y:wi}))),ue.prototype.moveEnd.call(this,yi),this.drawInk(this.inkLists)}function O$e(yi,vi,bi,_i){this.inkLists[0].push({x:yi,y:vi});const $i=Ut$2(this.inkLists[0]);this.lines[0].setAttribute("d",$i)}function b$c(){const yi=this.inkLists.map(vi=>{const bi=vi.map(Ei=>Ei.x),_i=vi.map(Ei=>Ei.y),$i=Math.min(...bi),Pi=Math.min(..._i),Ai=Math.max(...bi),Si=Math.max(..._i);return[$i,Pi,Ai,Si]});this.updateOutline(yi[0]),ue.prototype.handleDrawEnd.call(this),this.onOutlineUpdated()}function C$c(yi){const[vi,bi]=this.outline;yi!=null&&yi.map((_i,$i)=>{const Pi=this.lines[$i]||M$k("path","annotation-path"),Ai=Ut$2(_i),Si=`translate(-${vi},-${bi})`;Pi.setAttribute("d",Ai),Pi.setAttribute("transform",Si);let Ei=this.frontLines[$i];return Ei?(Ei.setAttribute("d",Ai),Ei.setAttribute("transform",Si)):(Ei=Pi.cloneNode(),Ei.classList.add("front"),this.frontLines[$i]=Ei),Pi})}function E$h(yi){const[vi,bi]=this.outline;return(yi==null?void 0:yi.map((_i,$i)=>{const Pi=M$k("path","annotation-path"),Ai=Ut$2(_i),Si=`translate(-${vi},-${bi})`;return Pi.setAttribute("d",Ai),Pi.setAttribute("transform",Si),Pi}))||[]}function U$7(){const{scale:yi}=this.viewportInfo;return this.inkLists.map(vi=>vi.map(({x:bi,y:_i})=>(bi/=yi,_i/=yi,[bi,_i]=Mt$2({...this.viewportInfo,rotation:-this.viewportInfo.rotation},[bi,_i]),{x:bi,y:_i})))}function M$a(){return this.inkLists.some(yi=>yi.length>1)}function B$6(){return{...ue.prototype.toData.call(this),inkLists:this.getInkLists()}}let V$8=class extends ue{get defaultClasses(){return _$d.call(this)}constructor(vi,bi){return super(vi,bi),I$b.call(this,vi,bi)}onUserMove(vi){return L$b.call(this,vi)}onOutlineUpdated(){return g$d.call(this)}addAttributes(vi,bi){return W$b.call(this,vi,bi)}parseInkLists(vi){return D$f.call(this,vi)}initializeByData(vi){return v$d.call(this,vi)}updateByData(vi){return w$d.call(this,vi)}createContent(vi){return y$b.call(this,vi)}moveEnd(vi){return A$b.call(this,vi)}drawing(vi,bi,_i,$i){return O$e.call(this,vi,bi,_i,$i)}handleDrawEnd(){return b$c.call(this)}drawInk(vi){return C$c.call(this,vi)}createInkLines(vi){return E$h.call(this,vi)}getInkLists(){return U$7.call(this)}validate(){return M$a.call(this)}toData(){return B$6.call(this)}};function r$8(yi){_defineProperty(this,"isResizeEnable",!1),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function s$9(yi){return new V$8(...yi)}function a$a(){return{...ne$2.prototype.toJSON.call(this),inkLists:JSON.stringify(this.widget.getInkLists())}}function l$7(){return this.widget.validate()}let c$f=class extends ne$2{constructor(vi){return super(vi,{ignoreBorder:!0}),r$8.call(this,vi)}createWidget(...vi){return s$9.call(this,vi)}toJSON(){return a$a.call(this)}check(){return l$7.call(this)}};var f$c=c$f;function c$e(yi,vi){this.initializeByData(yi.data)}function o$5(yi,vi,bi,_i){}function s$8(yi){this.updateOutline(this.parseRect(yi.rect)),this.onOutlineUpdated(),this.createView(yi)}let d$8=class extends ue{constructor(vi,bi){return super(vi,bi),c$e.call(this,vi,bi)}drawing(vi,bi,_i,$i){return o$5.call(this,vi,bi,_i,$i)}initializeByData(vi){return s$8.call(this,vi)}};function r$7(yi){_defineProperty(this,"isResizeEnable",!1),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function a$9(yi){return new d$8(...yi)}function s$7(){return this.widget.validate()}let c$d=class extends ne$2{constructor(vi){return super(vi),r$7.call(this,vi)}createWidget(...vi){return a$9.call(this,vi)}check(){return s$7.call(this)}};function o$4(yi,vi){this.initializeByData(yi.data)}function s$6(yi,vi,bi,_i){}function l$6(yi){this.updateOutline(this.parseRect(yi.rect)),this.createView(yi),this.onOutlineUpdated()}function u$8(yi){const vi=document.createDocumentFragment(),bi=M$k("rect",...this.defaultContentClasses);if(yi.url){const _i=M$k("a");_i.setAttribute("href",yi.url),_i.setAttribute("target","_blank"),_i.appendChild(bi),vi.appendChild(_i)}else vi.appendChild(bi);return vi}let p$9=class extends ue{constructor(vi,bi){return super(vi,bi),o$4.call(this,vi,bi)}drawing(vi,bi,_i,$i){return s$6.call(this,vi,bi,_i,$i)}initializeByData(vi){return l$6.call(this,vi)}createContent(vi){return u$8.call(this,vi)}};function p$8(yi){_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"autoFocusOnClick",!1),_defineProperty(this,"autoFocusOnEnter",!1),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function E$g(yi){return new p$9(...yi)}function w$c(){return this.widget.validate()}let s$5=class extends ne$2{constructor(vi){return super(vi,{ignoreBorder:!0}),p$8.call(this,vi)}createWidget(...vi){return E$g.call(this,vi)}check(){return w$c.call(this)}};function y$a({customType:yi,classNames:vi=[],locked:bi=!1,dataset:_i=[],events:$i=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function Pi(Si){_defineProperty(this,"customType",yi),_defineProperty(this,"events",$i),this.locked=bi,this.isAlwaysShow=!0,this.isAlwaysShowControlBar=!0}class Ai extends s$5{constructor(...Ei){const[wi]=Ei;return wi.data.classNames=[...wi.data.classNames||[],...vi],wi.data.dataset=[...wi.data.dataset||[],..._i],super(...Ei),Pi.call(this,Ei)}}return _defineProperty(Ai,"ParentType",E$p.Link),Ai}var a$8=new WeakMap,o$3=new WeakSet;function v$c(yi,vi){_classPrivateMethodInitSpec(this,o$3),_defineProperty(this,"outlines",[]),_classPrivateFieldInitSpec(this,a$8,{writable:!0,value:void 0}),_defineProperty(this,"className",["text-diff-widget"]),this.createTextDiffAnnotElementHelper(),this.initialize(yi.data),this.container=this.createView(yi.data)}function x$b(yi){ne$2.prototype.initialize.call(this,yi),this.getAvatar().then(vi=>{this.setAvatar(vi)})}function A$a(yi){return new y$o(...yi)}function D$e(){this.annotationService.textDiffExtension&&_classPrivateFieldSet(this,a$8,this.annotationService.textDiffExtension.createTextDiffAnnotElementHelper(this))}function E$f(yi,vi){return ne$2.prototype.update.call(this,yi),this.getAvatar().then(bi=>{this.setAvatar(bi)}),vi&&_classPrivateMethodGet(this,o$3,c$c).call(this),this.container}function S$e(){return this.data.indexes||[0,0]}function T$a(){return this.viewport.scale}function g$c(){return ne$2.prototype.render.call(this),_classPrivateMethodGet(this,o$3,c$c).call(this),this.container}function w$b(){return!0}function P$b(){const{viewportInfo:yi}=this,{scale:vi,rotation:bi}=yi;return this.outlines.map(_i=>(_i=_i.map($i=>$i/vi),_i=vt$3({...yi,rotation:-bi},_i),_i))}function y$9(yi){this.avatar=yi}function I$a(){return{...ne$2.prototype.toJSON.call(this),rects:this.getScaledOutlines()}}function F$a(){this.destroyed||ne$2.prototype.destroy.call(this)}let O$d=class extends ne$2{constructor(vi,bi){return super(vi,bi),v$c.call(this,vi,bi)}initialize(vi){return x$b.call(this,vi)}createWidget(...vi){return A$a.call(this,vi)}createTextDiffAnnotElementHelper(){return D$e.call(this)}update(vi,bi=!0){return E$f.call(this,vi,bi)}get baseIndexes(){return S$e.call(this)}get viewportScale(){return T$a.call(this)}render(){return g$c.call(this)}check(){return w$b.call(this)}getScaledOutlines(){return P$b.call(this)}setAvatar(vi){return y$9.call(this,vi)}toJSON(){return I$a.call(this)}destroy(){return F$a.call(this)}};function c$c(){var yi;(yi=_classPrivateFieldGet(this,a$8))===null||yi===void 0||yi.drawing()}const p$7=M$k("circle","vertex");p$7.setAttribute("r","5"),p$7.setAttribute(`data-${S$q}`,"true");var _$c=new WeakMap,v$b=new WeakMap;function E$e(){return F$e.concat(["polyline-widget"])}function x$a(yi,vi,bi){_defineProperty(this,"vertices",[]),_defineProperty(this,"tempVertex",[]),_defineProperty(this,"currentPointIndex",-1),_defineProperty(this,"polyEle",M$k("polyline","annotation-polyline")),_defineProperty(this,"polyEleFront",M$k("polyline","annotation-polyline","front")),_classPrivateFieldInitSpec(this,_$c,{writable:!0,value:_i=>{var $i,Pi;($i=this.config.events)===null||$i===void 0||(Pi=$i.onVertexMouseDown)===null||Pi===void 0||Pi.call($i,this),_i.target&&(this.currentPointIndex=Number(_i.target.dataset.point));const Ai=this.dom.closest(".annotationLayer");Ai.addEventListener("mousemove",_classPrivateFieldGet(this,v$b)),this.addClass("resizing"),document.addEventListener("mouseup",()=>{var Si,Ei;this.removeClass("resizing"),this.currentPointIndex=-1,Ai.removeEventListener("mousemove",_classPrivateFieldGet(this,v$b)),(Si=this.config.events)===null||Si===void 0||(Ei=Si.onVertexChanged)===null||Ei===void 0||Ei.call(Si,this)},{once:!0})}}),_classPrivateFieldInitSpec(this,v$b,{writable:!0,value:_i=>{this.handleVertexMove(_i)}}),bi.initialize&&this.initializeByData(yi.data)}function w$a(){ue.prototype.onOutlineUpdated.call(this),this.drawPolyEle(),this.drawVertex()}function V$7(yi){this.updateOutline(yi),ue.prototype.onOutlineUpdated.call(this)}function I$9(yi){const vi=ue.prototype.createContent.call(this,yi);return vi.appendChild(this.polyEle),vi.appendChild(this.polyEleFront),this.polyEleFront.setAttribute(`data-${S$q}`,"true"),vi}function W$a(yi,vi){ue.prototype.move.call(this,yi,vi),this.updateViewDimensions()}function D$d(yi){ue.prototype.moveEnd.call(this,yi);const[vi,bi]=yi,[_i,$i]=this.outline,Pi=_i-vi,Ai=$i-bi;this.vertices=this.vertices.map(([Si,Ei])=>[Si+Pi,Ei+Ai]),this.drawPolyEle(),this.drawVertex()}function C$b(yi){this.updateOutline(this.parseRect(yi.rect)),this.createView(yi),this.vertices=this.createVertices(yi),this.onOutlineUpdated()}function A$9(yi){this.vertices=this.createVertices(yi),ue.prototype.updateByData.call(this,yi)}function $$7(yi){const{rect:vi}=yi,{scale:bi}=this.viewportInfo,_i=vi[2]-vi[0],$i=vi[3]-vi[1];return yi.vertices.map(([Pi,Ai])=>((_i!==0||$i!==0)&&([Pi,Ai]=Mt$2(this.viewportInfo,[Pi,Ai])),[Pi,Ai]=[Pi*bi,Ai*bi],[Pi,Ai]))}function b$b(yi,vi,bi,_i){this.addClass("drawing"),this.tempVertex=[yi,vi],this.drawPolyEle()}function O$c(){this.currentPointIndex=-1,this.tempVertex=[];let yi=this.vertices.at(-1),vi=this.vertices.at(-2);for(;vi&&yi.join()===vi.join();)this.vertices.pop(),yi=this.vertices.at(-1),vi=this.vertices.at(-2);this.updateOutline(Ft$2(this.vertices)),ue.prototype.handleDrawEnd.call(this),this.onOutlineUpdated()}function S$d(){const[yi,vi]=this.outline,bi=`translate(-${yi},-${vi})`,_i=[...this.vertices];if(this.tempVertex.length&&_i.push(this.tempVertex),this.currentPointIndex>-1&&this.polyEle.points.length<=_i.length){const[$i,Pi]=_i[this.currentPointIndex],Ai=this.svg.createSVGPoint();Ai.x=$i,Ai.y=Pi,this.polyEle.points[this.currentPointIndex]?(this.polyEle.points.replaceItem(Ai,this.currentPointIndex),this.polyEleFront.points.replaceItem(Ai,this.currentPointIndex)):(this.polyEle.points.appendItem(Ai),this.polyEleFront.points.appendItem(Ai))}else{const $i=_i.join(" ");this.polyEle.setAttribute("points",$i),this.polyEleFront.setAttribute("points",$i)}this.polyEle.setAttribute("transform",bi),this.polyEleFront.setAttribute("transform",bi)}function F$9(){var yi;if(this.vertices.length<2)return;const[vi,bi]=this.outline,{currentPointIndex:_i}=this;if(_i>-1&&this.verticesEl){const[Pi,Ai]=this.vertices[_i];this.verticesEl.setAttribute("transform",`translate(-${vi},-${bi})`);const Si=this.verticesEl.querySelector(`circle[data-point="${_i}"]`);Si==null||Si.setAttribute("cx",String(Pi)),Si==null||Si.setAttribute("cy",String(Ai));return}const $i=M$k("g","vertices-wrapper");(yi=this.verticesEl)===null||yi===void 0||yi.remove(),this.verticesEl=$i,$i.setAttribute("transform",`translate(-${vi},-${bi})`),this.vertices.forEach(([Pi,Ai],Si)=>{const Ei=p$7.cloneNode();Ei.setAttribute("cx",String(Pi)),Ei.setAttribute("cy",String(Ai)),Ei.dataset.point=String(Si),$i.appendChild(Ei),Ei.addEventListener("mousedown",_classPrivateFieldGet(this,_$c))}),Promise.resolve().then(()=>{this.svg.contains(this.verticesEl)||this.svg.appendChild(this.verticesEl)})}function M$9(yi,vi){var bi,_i;this.vertices.push([yi,vi]),this.currentPointIndex=this.vertices.length,(bi=this.config.events)===null||bi===void 0||(_i=bi.onVertexChanged)===null||_i===void 0||_i.call(bi,this)}function U$6(){if(this.vertices.pop(),this.vertices.length>0){var yi,vi;this.currentPointIndex-=1,this.drawPolyEle(),(yi=this.config.events)===null||yi===void 0||(vi=yi.onVertexChanged)===null||vi===void 0||vi.call(yi,this)}else this.destroy()}function L$a(yi){var vi,bi;const{offsetX:_i,offsetY:$i}=yi;this.vertices[this.currentPointIndex]=[_i,$i],this.updateOutline(Ft$2(this.vertices)),this.onOutlineUpdated(),(vi=this.config.events)===null||vi===void 0||(bi=vi.onVertexMove)===null||bi===void 0||bi.call(vi,this)}function z$6(){return this.vertices.length>1}function B$5(){const{scale:yi,width:vi,height:bi,rotation:_i}=this.viewportInfo;return{...ue.prototype.toData.call(this),vertices:this.vertices.map(([$i,Pi])=>([$i,Pi]=[$i/yi,Pi/yi],[$i,Pi]=Mt$2({width:vi,height:bi,rotation:-_i},[$i,Pi]),[$i,Pi]))}}let H$7=class extends ue{get defaultClasses(){return E$e.call(this)}constructor(vi,bi,_i={initialize:!0}){return super(vi,bi),x$a.call(this,vi,bi,_i)}onOutlineUpdated(){return w$a.call(this)}onUserMove(vi){return V$7.call(this,vi)}createContent(vi){return I$9.call(this,vi)}move(vi,bi){return W$a.call(this,vi,bi)}moveEnd(vi){return D$d.call(this,vi)}initializeByData(vi){return C$b.call(this,vi)}updateByData(vi){return A$9.call(this,vi)}createVertices(vi){return $$7.call(this,vi)}drawing(vi,bi,_i,$i){return b$b.call(this,vi,bi,_i,$i)}handleDrawEnd(){return O$c.call(this)}drawPolyEle(){return S$d.call(this)}drawVertex(){return F$9.call(this)}addVertex(vi,bi){return M$9.call(this,vi,bi)}undoVertex(){return U$6.call(this)}handleVertexMove(vi){return L$a.call(this,vi)}validate(){return z$6.call(this)}toData(){return B$5.call(this)}};const g$b=M$k("circle","vertex");g$b.setAttribute("r","5");function x$9(yi){_defineProperty(this,"isResizeEnable",!1),this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function C$a(yi){const[vi,bi]=yi;return bi.events={onVertexMouseDown:()=>{this.focus=!0},onVertexChanged:()=>{this.eventBus.dispatch(A$r,this)},onVertexMove:()=>{this.eventBus.dispatch(w$s,this)}},new H$7(vi,bi)}function N$8(yi,vi){this.widget.addVertex(yi,vi),this.eventBus.dispatch(A$r,this)}function O$b(){this.widget.undoVertex(),this.widget.destroyed||this.eventBus.dispatch(A$r,this)}function S$c(){return this.widget.validate()}function T$9(){const{scale:yi,width:vi,height:bi,rotation:_i}=this.viewportInfo;return{...ne$2.prototype.toJSON.call(this),vertices:this.widget.vertices.map(([$i,Pi])=>([$i,Pi]=[$i/yi,Pi/yi],[$i,Pi]=Mt$2({width:vi,height:bi,rotation:-_i},[$i,Pi]),[$i,Pi]))}}let m$f=class extends ne$2{constructor(vi){return super(vi,{ignoreBorder:!0}),x$9.call(this,vi)}createWidget(...vi){return C$a.call(this,vi)}addVertex(vi,bi){return N$8.call(this,vi,bi)}undoVertex(){return O$b.call(this)}check(){return S$c.call(this)}toJSON(){return T$9.call(this)}};function J$6({customType:yi,isAlwaysShow:vi=!0,isAlwaysShowControlBar:bi=!1,classNames:_i=[],locked:$i=!1,autoFocusOnClick:Pi=!1,autoFocusOnEnter:Ai=!1,dataset:Si=[],events:Ei=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function wi(ki){_defineProperty(this,"customType",yi),_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"autoFocusOnClick",Pi),_defineProperty(this,"autoFocusOnEnter",Ai),_defineProperty(this,"events",Ei),this.locked=$i,this.isAlwaysShow=bi||vi,this.isAlwaysShowControlBar=bi}class Ci extends m$f{constructor(...xi){const[Ti]=xi;return Ti.data.classNames=[...Ti.data.classNames||[],..._i],Ti.data.dataset=[...Ti.data.dataset||[],...Si],super(...xi),wi.call(this,xi)}}return _defineProperty(Ci,"ParentType",E$p.PolyLine),Ci}const h$9=M$k("g","polygon-closure-area");h$9.setAttribute("transform",`translate(-${K$a/2}, -${K$a/2})`),h$9.innerHTML=` `.trim();var c$b=new WeakSet;function v$a(){return F$e.concat(["polygon-widget"])}function _$b(yi,vi){_classPrivateMethodInitSpec(this,c$b),_defineProperty(this,"polyEle",M$k("polygon","annotation-polygon")),_defineProperty(this,"polyEleFront",M$k("polygon","annotation-polygon","front")),_defineProperty(this,"polyline",M$k("polyline","annotation-polyline")),_defineProperty(this,"closureAreaEle",h$9.cloneNode(!0)),_defineProperty(this,"previewLine",M$k("line","annotation-polyline-preview")),this.initializeByData(yi.data)}function P$a(yi){this.updateOutline(this.parseRect(yi.rect)),this.createView(yi),this.vertices=this.createVertices(yi),this.onOutlineUpdated()}function E$d(yi){const vi=H$7.prototype.createContent.call(this,yi);return vi.appendChild(this.polyEle),vi.appendChild(this.polyEleFront),this.polyEleFront.setAttribute(`data-${S$q}`,"true"),vi}function w$9(yi,vi,bi,_i){this.addClass("drawing"),this.tempVertex=[yi,vi],this.drawingPolyEle(),_classPrivateMethodGet(this,c$b,g$a).call(this)}function A$8(){this.closePolygon()}function C$9(){this.canClose&&(this.polyline.remove(),this.closureAreaEle.remove(),this.previewLine.remove(),H$7.prototype.handleDrawEnd.call(this),this.drawPolyEle())}function x$8(yi,vi){H$7.prototype.addVertex.call(this,yi,vi),this.vertices.length>2&&!this.dom.contains(this.closureAreaEle)&&this.svg.appendChild(this.closureAreaEle),_classPrivateMethodGet(this,c$b,g$a).call(this)}function W$9(){return this.vertices.length>2}function D$c(){H$7.prototype.undoVertex.call(this),this.vertices.length<3&&this.closureAreaEle.remove(),this.vertices.length<2&&this.previewLine.remove()}function V$6(){this.svg.contains(this.polyline)||this.svg.appendChild(this.polyline);const yi=[...this.vertices];this.tempVertex.length&&yi.push(this.tempVertex);const[vi,bi]=this.outline,_i=`translate(-${vi},-${bi})`;this.polyline.setAttribute("points",yi.join(" ")),this.polyline.setAttribute("transform",_i)}function S$b(){return this.validate()}let B$4=class extends H$7{get defaultClasses(){return v$a.call(this)}constructor(vi,bi){return super(vi,bi,{initialize:!1}),_$b.call(this,vi,bi)}initializeByData(vi){return P$a.call(this,vi)}createContent(vi){return E$d.call(this,vi)}drawing(vi,bi,_i,$i){return w$9.call(this,vi,bi,_i,$i)}handleDrawEnd(){return A$8.call(this)}closePolygon(){return C$9.call(this)}addVertex(vi,bi){return x$8.call(this,vi,bi)}validate(){return W$9.call(this)}undoVertex(){return D$c.call(this)}drawingPolyEle(){return V$6.call(this)}get canClose(){return S$b.call(this)}};function g$a(){if(this.vertices.length>1&&this.isDrawing){const[yi,vi]=this.outline,[bi,_i]=this.tempVertex,[$i,Pi]=this.vertices[0],Ai=this.previewLine;Ai.setAttribute("x1",String(bi)),Ai.setAttribute("y1",String(_i)),Ai.setAttribute("x2",String($i)),Ai.setAttribute("y2",String(Pi)),Ai.setAttribute("transform",`translate(-${yi},-${vi})`),this.svg.contains(Ai)||this.svg.appendChild(Ai)}else this.previewLine.remove()}const c$a=M$k("g","polygon-closure-area");c$a.setAttribute("transform",`translate(-${K$a/2}, -${K$a/2})`),c$a.innerHTML=` `.trim();function N$7(){return this.widget.vertices}function x$7(){var yi;return(yi=this.widget.verticesEl)===null||yi===void 0?void 0:yi.childNodes}function V$5(yi){this.initialize(yi.data),this.container=this.createView(this.data),this.onOutlineUpdated()}function T$8(yi){const[vi,bi]=yi;return bi.events={onVertexMouseDown:()=>{this.focus=!0},onVertexChanged:()=>{this.eventBus.dispatch(A$r,this)},onVertexMove:()=>{this.eventBus.dispatch(w$s,this)}},new B$4(vi,bi)}function k$a(){return this.widget.validate()}function O$a(){return this.isDrawing&&this.check()}let u$7=class extends m$f{get vertices(){return N$7.call(this)}get vertexNodes(){return x$7.call(this)}constructor(vi){return super(vi),V$5.call(this,vi)}createWidget(...vi){return T$8.call(this,vi)}check(){return k$a.call(this)}get canClose(){return O$a.call(this)}};function W$8({customType:yi,isAlwaysShow:vi=!0,isAlwaysShowControlBar:bi=!1,classNames:_i=[],locked:$i=!1,autoFocusOnClick:Pi=!1,autoFocusOnEnter:Ai=!1,dataset:Si=[],events:Ei=[...j$b]}){if(!yi)throw new Error('自定义annotation的"customType"不能为空');if(E$p[yi])throw new Error(`"${yi}"不能作为自定义annotation的"customType"`);function wi(ki){_defineProperty(this,"customType",yi),_defineProperty(this,"isResizeEnable",!1),_defineProperty(this,"autoFocusOnClick",Pi),_defineProperty(this,"autoFocusOnEnter",Ai),_defineProperty(this,"events",Ei),this.locked=$i,this.isAlwaysShow=bi||vi,this.isAlwaysShowControlBar=bi}class Ci extends u$7{constructor(...xi){const[Ti]=xi;return Ti.data.classNames=[...Ti.data.classNames||[],..._i],Ti.data.dataset=[...Ti.data.dataset||[],...Si],super(...xi),wi.call(this,xi)}}return _defineProperty(Ci,"ParentType",E$p.Polygon),Ci}function H$6(yi){const{annotationType:vi,customType:bi=""}=yi.data,{CustomAnnotClass:_i}=yi;let $i=null;try{switch(vi){case E$p.Link:const Pi=_i.get(bi)||s$5;$i=new Pi(yi);break;case E$p.Text:$i=new _$i(yi);break;case E$p.Popup:$i=new U$b(yi);break;case E$p.Line:$i=new w$f(yi);break;case E$p.Square:const Ai=_i.get(bi)||u$h;$i=new Ai(yi);break;case E$p.SelectText:const Si=_i.get(bi)||A$i;$i=new Si(yi);break;case E$p.Table:const Ei=_i.get(bi)||u$f;$i=new Ei(yi);break;case E$p.PolyLine:const wi=_i.get(bi)||m$f;$i=new wi(yi);break;case E$p.Ink:$i=new f$c(yi);break;case E$p.Polygon:const Ci=_i.get(bi)||u$7;$i=new Ci(yi);break;case E$p.Highlight:const ki=_i.get(bi)||O$h;$i=new ki(yi);break;case E$p.Underline:const xi=_i.get(bi)||O$f;$i=new xi(yi);break;case E$p.StrikeOut:const Ti=_i.get(bi)||z$7;$i=new Ti(yi);break;case E$p.Stamp:$i=new c$d(yi);break;case E$p.TextDiff:const Oi=O$d;$i=new Oi(yi);break;default:$i=null}return $i}catch(Pi){throw console.error(Pi),Pi}}let O$9=class{static create(vi){return H$6.call(this,vi)}};function s$4(yi){_defineProperty(this,"subj","Line"),_defineProperty(this,"color",[...te$5]),_defineProperty(this,"borderStyle",{width:2,style:1,dashArray:[]}),this.lineCoordinates=yi.lineCoordinates,this.lineEndpoints=yi.lineEndpoints||["None","OpenArrow"]}let a$7=class extends m$q{constructor(vi){return super(vi,E$p.Line),s$4.call(this,vi)}};function n$4(yi){_defineProperty(this,"subj","Ink"),_defineProperty(this,"color",[200,133,218]),_defineProperty(this,"borderStyle",{width:2,style:1,dashArray:[]}),this.inkLists=JSON.stringify(yi.inkLists)}class e extends m$q{constructor(vi){return super(vi,E$p.Ink),n$4.call(this,vi)}}function i$4(yi){_defineProperty(this,"subj","TextDiff"),_defineProperty(this,"diffTextList",["",""])}let s$3=class extends m$q{constructor(vi){return super(vi,E$p.TextDiff),i$4.call(this,vi)}};function a$6(yi,vi){_defineProperty(this,"subj","Polygon"),_defineProperty(this,"borderStyle",{width:1,style:1,dashArray:[]}),this.vertices=yi.vertices}let i$3=class extends m$q{constructor(vi,bi){return super(vi,E$p.Polygon,bi),a$6.call(this,vi,bi)}};function n$3(yi,vi){_defineProperty(this,"subj",E$p[E$p.PolyLine]),_defineProperty(this,"borderStyle",{width:1,style:1,dashArray:[]}),this.vertices=yi.vertices}let a$5=class extends m$q{constructor(vi,bi){return super(vi,E$p.PolyLine,bi),n$3.call(this,vi,bi)}};function L$9(yi,vi,bi){this.pageNumber=yi,this.pageWidth=vi,this.pageHeight=bi,this.titleObj={str:"",dir:"ltr"},this.contentsObj={str:"",dir:"ltr"}}function x$6(yi,vi,bi,_i){const{titleObj:$i,contentsObj:Pi,pageNumber:Ai}=this,Si={rect:bi,pageNumber:Ai,titleObj:{...$i,str:_i.author},contentsObj:{...Pi},authorID:_i.authorID};let Ei,wi;!E$p[yi]&&vi?(Ei=vi,wi=yi):Ei=E$p[yi];let Ci=null;switch(Ei){case E$p.Table:case E$p.Square:case E$p.SelectText:Ci=new m$q(Si,Ei,wi);break;case E$p.Text:Ci=new n$5({...Si,inReplyTo:"",rect:bi});break;case E$p.Line:Ci=new a$7({...Si,lineCoordinates:bi});break;case E$p.Ink:Ci=new e({...Si,rect:[0,0,0,0],inkLists:[[{x:bi[0],y:bi[1]}]]});break;case E$p.TextDiff:Ci=new s$3({...Si});break;case E$p.Polygon:Ci=new i$3({...Si,vertices:[[bi[0],bi[1]]]},wi);break;case E$p.PolyLine:Ci=new a$5({...Si,vertices:[[bi[0],bi[1]]]},wi);break;default:Ci=null}return Ci}function D$b(yi,vi,bi){var _i;const{currentAnnotType:$i}=yi,Pi=(_i=yi.customAnnotClassMap.get($i))===null||_i===void 0?void 0:_i.ParentType,Ai={rect:vi,pageNumber:bi,titleObj:{str:"",dir:"ltr"},contentsObj:{str:"",dir:"ltr"},authorID:""};let Si,Ei;!E$p[$i]&&Pi?(Si=Pi,Ei=$i):Si=E$p[$i];let wi=null;switch(Si){case E$p.Table:case E$p.Square:case E$p.SelectText:wi=new m$q(Ai,Si,Ei);break;case E$p.Text:wi=new n$5({...Ai,inReplyTo:"",rect:vi});break;case E$p.Line:wi=new a$7({...Ai,lineCoordinates:vi});break;case E$p.Ink:wi=new e({...Ai,rect:[0,0,0,0],inkLists:[[{x:vi[0],y:vi[1]}]]});break;case E$p.TextDiff:wi=new s$3({...Ai});break;case E$p.Polygon:wi=new i$3({...Ai,vertices:[[vi[0],vi[1]]]},Ei);break;case E$p.PolyLine:wi=new a$5({...Ai,vertices:[[vi[0],vi[1]]]},Ei);break;default:wi=null}return wi}function j$7(yi,vi,bi){var _i;let{customType:$i,subtype:Pi}=vi;const Ai=$i||Pi,Si=(_i=yi.customAnnotClassMap.get(Ai))===null||_i===void 0?void 0:_i.ParentType,{pageNumber:Ei,rect:wi}=vi,Ci={rect:wi,pageNumber:Ei,titleObj:{str:bi.author,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},authorID:bi.authorID};let ki;!E$p[Ai]&&Si?(ki=Si,$i=Ai):ki=E$p[Ai];let xi=null;switch(ki){case E$p.Square:case E$p.SelectText:xi=new m$q(Ci,ki,$i);break;case E$p.Table:xi=new m$q(Ci,ki,$i),xi.hLines=vi.hLines,xi.vLines=vi.vLines,xi.spanCellData=vi.spanCellData;break;case E$p.Text:xi=new n$5({...Ci,inReplyTo:"",rect:wi});break;case E$p.Line:xi=new a$7({...Ci,lineCoordinates:vi.lineCoordinates});break;case E$p.Ink:xi=new e({...Ci,rect:vi.rect,inkLists:vi.inkLists});break;case E$p.TextDiff:xi=new s$3({...Ci});break;case E$p.Polygon:xi=new i$3({...Ci,vertices:vi.vertices},$i);break;case E$p.PolyLine:xi=new a$5({...Ci,vertices:vi.vertices},$i);break;case E$p.Highlight:xi=new a$e({...Ci,quadPoints:vi.quadPoints,subj:vi.subj});break;case E$p.Underline:xi=new i$7({...Ci,quadPoints:vi.quadPoints});break;case E$p.StrikeOut:xi=new a$c({...Ci,quadPoints:vi.quadPoints});break;default:xi=null}return xi}let O$8=class{constructor({pageNumber:vi,width:bi,height:_i}){return L$9.call(this,vi,bi,_i)}create(vi,bi,_i,$i){return x$6.call(this,vi,bi,_i,$i)}static fromRect(vi,bi,_i){return D$b.call(this,vi,bi,_i)}static fromWidget(vi,bi,_i){return j$7.call(this,vi,bi,_i)}};var r$6=new WeakMap,c$9=new WeakMap;function u$6(yi,vi){var bi;_classPrivateFieldInitSpec(this,r$6,{writable:!0,value:!1}),_defineProperty(this,"allowChecked",!1),_classPrivateFieldInitSpec(this,c$9,{writable:!0,value:_i=>{var $i,Pi;($i=(Pi=this.handleDOMEvents)[_i.type])===null||$i===void 0||$i.call(Pi,this,_i)}}),this.controlBar=yi,this.type=vi.type,this.handleDOMEvents=vi.handleDOMEvents,this.allowChecked=(bi=vi.allowChecked)!==null&&bi!==void 0?bi:!1,this.li=vi.render(this),this.li.dataset.type=this.type,vi.classNames&&this.li.classList.add(...vi.classNames),Array.isArray(vi.dataset)&&vi.dataset.forEach(([_i,$i])=>{this.li.dataset[_i]=$i}),this.handleDOMEvents&&Object.keys(this.handleDOMEvents).forEach(_i=>{this.li.addEventListener(_i,_classPrivateFieldGet(this,c$9))}),this.li.addEventListener("mousedown",()=>{this.checked=!this.checked,this.eventBus.dispatch("ctrlChange",this)})}function v$9(){return this.controlBar.eventBus}function f$b(){return this.controlBar.annotationId}function _$a(yi){this.allowChecked&&(_classPrivateFieldSet(this,r$6,yi),yi?this.li.classList.add("active"):this.li.classList.remove("active"))}function m$e(){return _classPrivateFieldGet(this,r$6)}function C$8(){return this.controlBar}let k$9=class{constructor(vi,bi){return u$6.call(this,vi,bi)}get eventBus(){return v$9.call(this)}get annotationId(){return f$b.call(this)}set checked(vi){return _$a.call(this,vi)}get checked(){return m$e.call(this)}get operationBar(){return C$8.call(this)}};var h$8=new WeakSet;function m$d(yi){_classPrivateMethodInitSpec(this,h$8),_defineProperty(this,"CLASS_NAME","annotation-control-bar"),_defineProperty(this,"ctrls",new Map),_defineProperty(this,"eventBus",new h$g),_defineProperty(this,"show",()=>{this.wrapper.classList.add("show")}),_defineProperty(this,"move",(vi,bi,_i,$i)=>{const{wrapper:Pi}=this;Pi.style.setProperty("--top",`${vi}px`),Pi.style.setProperty("--left",`${bi}px`),Pi.style.setProperty("--width",`${_i}px`),Pi.style.setProperty("--height",`${$i}px`)}),_defineProperty(this,"hide",()=>{this.wrapper.classList.remove("show")}),_defineProperty(this,"destroy",()=>{this.wrapper.remove(),setTimeout(()=>{this.eventBus.clear()})}),this.wrapper=document.createElement("div"),this.wrapper.setAttribute(`data-${S$q}`,"true"),yi&&this.setAttributes(yi),this.eventBus.on("ctrlChange",vi=>{this.ctrls.forEach(bi=>{bi.forEach(_i=>{vi!==_i&&vi.type!=="move"&&(_i.checked=!1)})})})}function f$a(yi){yi.dataset&&yi.dataset.forEach(([vi,bi])=>{vi&&bi&&(this.wrapper.dataset[vi]=bi)})}function w$8(yi,vi,bi){return this.annotationId=yi,_classPrivateMethodGet(this,h$8,v$8).call(this,bi),this.wrapper.classList.add("control-bar-wrapper"),this.wrapper.dataset.targetId=yi,this.ctrls.forEach((_i,$i)=>{const Pi=document.createElement("ul");Pi.classList.add(this.CLASS_NAME,`${this.CLASS_NAME}__${$i}`),_i.forEach(Ai=>{Pi.append(Ai.li)}),this.wrapper.appendChild(Pi)}),this.ctrls.size?(vi&&this.show(),this.wrapper):null}let _$9=class{constructor(vi){return m$d.call(this,vi)}setAttributes(vi){return f$a.call(this,vi)}render({id:vi,focus:bi},_i){return w$8.call(this,vi,bi,_i)}};function v$8(yi){Object.keys(yi).forEach(vi=>{const bi=yi[vi]||[],_i=this.ctrls.get(vi)||[],$i=bi.map(Pi=>new k$9(this,Pi));_i.push(...$i),_i.length&&this.ctrls.set(vi,_i)})}const p$6={R:"ArrowRight",L:"ArrowLeft",D:"ArrowDown",U:"ArrowUp"};var m$c=new WeakMap,T$7=new WeakMap,v$7=new WeakMap,b$a=new WeakSet,I$8=new WeakSet,P$9=new WeakSet,W$7=new WeakSet,x$5=new WeakSet,M$8=new WeakSet;function j$6(){return F$e.concat("selection-widget")}function G$5(){return this.parameters.annotationService}function U$5(){return Math.sign(this.selection.head-this.selection.anchor)}function V$4(){const yi=this.selection.outlines.at(-1);return yi?[yi[0],yi[1]]:[0,0]}function z$5(){const yi=this.selection.outlines.at(-1);return yi?Math.abs(yi[2]-yi[0]):0}function q$3(){const yi=this.selection.outlines.at(-1);return yi?Math.abs(yi[3]-yi[1]):0}function F$8(){return this.parameters.pdfPage.charCount}function H$5(){return this.selection.outlines}function K$3(yi,vi){_classPrivateMethodInitSpec(this,M$8),_classPrivateMethodInitSpec(this,x$5),_classPrivateMethodInitSpec(this,W$7),_classPrivateMethodInitSpec(this,P$9),_classPrivateMethodInitSpec(this,I$8),_classPrivateMethodInitSpec(this,b$a),_defineProperty(this,"text",""),_defineProperty(this,"loading",!1),_defineProperty(this,"indexes",[]),_defineProperty(this,"keySteps",0),_defineProperty(this,"drawingTask",[]),_defineProperty(this,"previousSelection",null),_classPrivateFieldInitSpec(this,m$c,{writable:!0,value:async bi=>{bi.preventDefault();const{shiftKey:_i}=bi,{charCount:$i}=this.parameters.pdfPage;if($i===null||this.loading)return;if(bi.key==="c"&&(bi.ctrlKey||bi.metaKey)){this.copy();return}if(!Object.values(p$6).includes(bi.key))return;this.loading=!0;let Pi,Ai,{anchor:Si,head:Ei}=this.selection;switch(bi.key){case p$6.R:if(_i){if(this.selection.to===$i){this.loading=!1;return}Ei+=1}else if(this.text)this.direction===-1?Ei=Si:Si=Ei;else{if(this.selection.to>=$i){this.loading=!1;return}Ei+=1,Si+=1}await this.getNeighborIndexes(Ei);break;case p$6.L:if(_i){if(Ei===0){this.loading=!1;return}Ei-=1}else if(this.text)this.direction===-1?Si=Ei:Ei=Si;else{if(Ei===0){this.loading=!1;return}Ei-=1,Si-=1}await this.getNeighborIndexes(Ei);break;case p$6.U:if(this.keySteps-=1,Ai=this.indexes[this.keySteps],Ai===void 0){this.keySteps+=1,this.loading=!1;return}Ei=Ai,_i||(Si=Ai);break;case p$6.D:if(this.keySteps+=1,Pi=this.indexes[this.keySteps],Pi===void 0){this.keySteps-=1,this.loading=!1;return}Ei=Pi,_i||(Si=Pi);break}_i||(this.text=""),await this.updateSelection({head:Ei,anchor:Si},!0),this.loading=!1}}),_classPrivateFieldInitSpec(this,T$7,{writable:!0,value:()=>{const{annotationLayer:bi}=this.pageView;bi&&(bi.div.setAttribute("tabindex",-1),bi.div.focus({preventScroll:!0}),bi.div.addEventListener("keydown",_classPrivateFieldGet(this,m$c)),bi.div.addEventListener("blur",()=>{},{once:!0}))}}),_classPrivateFieldInitSpec(this,v$7,{writable:!0,value:()=>{const{annotationLayer:bi}=this.pageView;bi&&(bi.div.removeAttribute("tabindex"),bi.div.blur(),bi.div.removeEventListener("keydown",_classPrivateFieldGet(this,m$c)))}}),_defineProperty(this,"drawing",async(bi,_i,$i,Pi,Ai={needScrollIntoView:!0})=>{if(this.destroyed)return;if(this.drawingTask.length>0){await Promise.all(this.drawingTask),this.drawingTask=[];return}const Si=o$c();this.drawingTask.push(Si.promise),await this.parameters.pdfPage.getCharCount();const[Ei]=await _classPrivateMethodGet(this,W$7,_t$1).call(this,bi,_i);await this.updateSelection({anchor:this.selection.anchor,head:Ei},!1),Si.resolve(null)}),_defineProperty(this,"genUnderlineDatas",()=>{const{rect:bi,pageNumber:_i}=this.toData(),$i=_classPrivateMethodGet(this,x$5,w$7).call(this),{authorID:Pi,author:Ai=""}=this.authorInfo;return new i$7({quadPoints:$i,rect:bi,titleObj:{str:Ai,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},pageNumber:_i,authorID:Pi})}),_defineProperty(this,"genHighligtDatas",(bi="Highlight")=>{const{rect:_i,pageNumber:$i}=this.toData(),{authorID:Pi,author:Ai=""}=this.authorInfo,Si=_classPrivateMethodGet(this,x$5,w$7).call(this);return new a$e({quadPoints:Si,rect:_i,titleObj:{str:Ai,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},pageNumber:$i,subj:bi,authorID:Pi})}),this.initializeByData(yi.data),this.cursor=this.dom.querySelector(".text-cursor"),this.renderSelection(this.selection),this.initializeResources(),_classPrivateFieldGet(this,T$7).call(this)}function Y$5(){return this.outline[2]===this.outline[0]}function Q$5(){this.addClass("selected")}function $$6(){this.removeClass("selected")}function X$5(yi){this.updateOutline(this.parseRect(yi.rect)),this.selection=yi.selection,this.createView(yi)}function J$5(yi){ue.prototype.updateByData.call(this,yi),this.selection=yi.selection}async function Z$5(){await this.updateSelection({head:this.selection.head,anchor:this.selection.anchor}),this.updateToolbar()}async function tt$4(){await this.prepareSelectionText(),await this.parameters.pdfPage.getCharCount(),await this.getNeighborIndexes(this.selection.head)}async function et$4(){this.text=await this.selection.getText()}async function it$4(yi,vi,bi){if(this.previousSelection=this.selection,this.selection=this.selection.new({head:yi,anchor:vi}),await this.renderSelection(this.selection),bi&&this.cursor.scrollIntoView({block:"nearest"}),yi!==this.previousSelection.head||vi!==this.previousSelection.anchor){var _i;this.text.length?this.showToolbar():this.hideToolbar(),(_i=this.config.events)===null||_i===void 0||_i.onSelectionChange(this)}}async function st$4(yi){const vi=o$c();this.drawingTask.push(vi.promise);const bi=await yi.getOutlines();this.updateOutline(T$l(bi)),await this.prepareSelectionText(),this.svg.querySelectorAll(".text-box").forEach(Pi=>{Pi.remove()}),this.svg.append(xt$4(bi)),this.dom.style.left=`${this.outline[0]}px`,this.dom.style.top=`${this.outline[1]}px`;const _i=this.outline[2]-this.outline[0],$i=this.outline[3]-this.outline[1];if(this.updateContainerSize({width:`${Math.max(2,_i)}px`,height:`${Math.max(this.selection.cursor.height||0,$i)}px`}),bi.length){const[Pi,Ai]=await this.selection.getCursorPath();this.cursor.setAttribute("x1",String(Pi.x)),this.cursor.setAttribute("y1",String(Pi.y)),this.cursor.setAttribute("x2",String(Ai.x)),this.cursor.setAttribute("y2",String(Ai.y))}vi.resolve(null)}function nt$4(yi){const vi=document.createDocumentFragment();return this.cursor=M$k("line","text-cursor"),vi.append(this.cursor),vi}async function rt$4(yi){const[vi,bi]=await Promise.all([this.parameters.pdfPage.selectTextService.getNeighborIndexes({pageIndex:this.pageNumber-1,start:yi,direction:-1}),this.parameters.pdfPage.selectTextService.getNeighborIndexes({pageIndex:this.pageNumber-1,start:yi,direction:1})]);return this.indexes=await _classPrivateMethodGet(this,b$a,St).call(this,[...vi.reverse(),...bi],yi),this.keySteps=this.indexes.indexOf(yi),this.indexes}async function at$4(){const yi=(await this.selection.getOutlines()).at(-1);return yi?[yi[0],yi[1]]:[0,0]}function ot$4(){this.annotationService.copy()}async function lt$3(yi){return this.parameters.pdfPage.getRangeText(this.selection.from,this.selection.size,yi)}function ct$3(){const{rect:yi,pageNumber:vi}=this.toData(),{authorID:bi,author:_i=""}=this.authorInfo,$i=_classPrivateMethodGet(this,x$5,w$7).call(this);return new a$c({quadPoints:$i,rect:yi,titleObj:{str:_i,dir:"ltr"},contentsObj:{str:"",dir:"ltr"},pageNumber:vi,authorID:bi})}async function ht$2(){await this.updateSelection({anchor:this.selection.anchor,head:this.selection.head})}function ut$3(){const{viewportInfo:yi}=this,{scale:vi,rotation:bi}=yi;return this.selection.outlines.map(_i=>(_i=_i.map($i=>$i/vi),_i=vt$3({...yi,rotation:-bi},_i),_i))}function dt$2(){return{...ue.prototype.toData.call(this),rects:this.getViewBoxRects(),text:this.text}}function gt$2(){const yi=this.dom.closest(".annotationLayer");return yi?yi.style.cursor==="text":!1}async function pt$1(){const yi=await this.getText();return(await this.selection.getOutlines()).length?this.allowInsertCursor||!!yi:!1}function ft$1(){ue.prototype.handleDrawEnd.call(this),Promise.all(this.drawingTask).finally(()=>{var yi;this.drawingTask=[],(yi=this.config.events)===null||yi===void 0||yi.onSelectionChange(this)})}function xt(){_classPrivateFieldGet(this,v$7).call(this),ue.prototype.destroy.call(this),this.dom.remove()}class Rt extends ue{get defaultClasses(){return j$6.call(this)}get annotationService(){return G$5.call(this)}get direction(){return U$5.call(this)}get ctrlBarPoint(){return V$4.call(this)}get width(){return z$5.call(this)}get height(){return q$3.call(this)}get pageCharCount(){return F$8.call(this)}get outlines(){return H$5.call(this)}constructor(vi,bi){return super(vi,bi),K$3.call(this,vi,bi)}get isCursor(){return Y$5.call(this)}select(){return Q$5.call(this)}unselect(){return $$6.call(this)}initializeByData(vi){return X$5.call(this,vi)}updateByData(vi){return J$5.call(this,vi)}async update(){return Z$5.call(this)}async initializeResources(){return tt$4.call(this)}async prepareSelectionText(){return et$4.call(this)}async updateSelection({head:vi,anchor:bi},_i=!1){return it$4.call(this,vi,bi,_i)}async renderSelection(vi){return st$4.call(this,vi)}createContent(vi){return nt$4.call(this,vi)}async getNeighborIndexes(vi){return rt$4.call(this,vi)}async getToolbarPosition(){return at$4.call(this)}copy(){return ot$4.call(this)}async getText(vi=!1){return lt$3.call(this,vi)}genStrikeOutDatas(){return ct$3.call(this)}async reselectText(){return ht$2.call(this)}getViewBoxRects(){return ut$3.call(this)}toData(){return dt$2.call(this)}get allowInsertCursor(){return gt$2.call(this)}async validate(){return pt$1.call(this)}handleDrawEnd(){return ft$1.call(this)}destroy(){return xt.call(this)}}async function St(yi,vi){const bi=await _classPrivateMethodGet(this,I$8,mt$1).call(this),_i=new Map;bi.forEach(Pi=>{const Ai=_i.get(Pi.tableId);Ai?Ai.push(Pi.charIndex):_i.set(Pi.tableId,[Pi.charIndex])});const $i=[...yi];return _i.forEach(Pi=>{const Ai=$i.findIndex(Ei=>Ei>=Pi.at(0)),Si=$i.findIndex(Ei=>Ei>Pi.at(-1));$i.splice(Ai,Si-Ai,...Pi)}),[...$i,vi].sort((Pi,Ai)=>Pi-Ai)}async function mt$1(){const yi=await this.parameters.pdfPage.getElementBlockInfos(),vi=[];yi.forEach((_i,$i)=>{const Pi=yi[$i+1];_i.type===C$o.TABLE_CELL?Pi&&Pi.row!==_i.row&&Pi.outline&&vi.push({tableId:_i.tableId,row:_i.row,nextOutline:Pi.outline}):(Pi==null?void 0:Pi.type)===C$o.TABLE_CELL&&vi.push({tableId:Pi.tableId,row:-1,nextOutline:Pi.outline})});const bi=async _i=>{const[$i,Pi,Ai,Si]=_i.nextOutline,Ei=Math.min(5,(Ai-$i)/2),wi=Math.min(5,(Si-Pi)/2),[,Ci]=await _classPrivateMethodGet(this,P$9,wt).call(this,$i+Ei,Pi+wi,Ei,wi);return{..._i,charIndex:Ci}};return Promise.all(vi.map(bi))}async function wt(yi,vi,bi=10,_i=10){return this.parameters.pdfPage.selectTextService.getNearPointIndexes({index:this.pageNumber-1,x:yi,y:vi,xTolerance:bi,yTolerance:_i})}async function _t$1(yi,vi,bi=10,_i=10){const $i=await this.parameters.pdfPage.selectTextService.getOriginalPageInfo(this.pageNumber);return[yi,vi]=this.parameters.pdfPage.selectTextService.convertToPDFPoint(yi,vi,$i),this.parameters.pdfPage.getNearPointExactIndexes(yi,vi,bi,_i)}function w$7(){const{rects:yi}=this.toData(),vi=[],bi=this.pageInfo.rotation,_i=this.viewportInfo.rotation;return yi.forEach(([$i,Pi,Ai,Si])=>{const Ei=[];bi!==_i?(Ei.push({x:$i,y:Pi}),Ei.push({x:$i,y:Si}),Ei.push({x:Ai,y:Pi}),Ei.push({x:Ai,y:Si})):(Ei.push({x:$i,y:Pi}),Ei.push({x:Ai,y:Pi}),Ei.push({x:$i,y:Si}),Ei.push({x:Ai,y:Si})),vi.push(Ei)}),vi}function m$b(yi,vi,bi){switch(yi.type){case"delete":{vi instanceof ue?bi.UIManager.removeWidget(vi):bi.removeAnnotationById(vi.id);break}case"h-line-add":{yi.checked?vi.insertLine("H"):vi.cancelInsertLine();break}case"v-line-add":{yi.checked?vi.insertLine("V"):vi.cancelInsertLine();break}case"line-delete":{yi.checked?vi.deleteLine():vi.cancelDeleteLine();break}case"span-cell":{vi==null||vi.spanCell();break}case"split-cell":{vi==null||vi.splitCell();break}case"copy-text":{bi.UIManager.copy();break}case"highlight":{vi instanceof Rt?bi.UIManager.highlightText():vi.highlight();break}case"square-highlight":{bi.UIManager.highlightText("Rect");break}case"strike-out":{bi.UIManager.strikeOut();break}case"underline":{bi.UIManager.underline();break}case"move":{document.body.style.userSelect="none";let _i=0,$i=0;const{outline:Pi}=vi,Ai=wi=>{_i=wi.pageX,$i=wi.pageY},Si=wi=>{vi==null||vi.move(wi.pageX-_i,wi.pageY-$i),_i=wi.pageX,$i=wi.pageY},Ei=()=>{document.body.style.userSelect="unset",document.removeEventListener("mousemove",Si),_i=0,$i=0,vi&&vi.moveEnd([Pi[0],Pi[1]])};document.addEventListener("mousedown",Ai,{once:!0}),document.addEventListener("mouseup",Ei,{once:!0}),document.addEventListener("mousemove",Si);break}}}const{VITE_SDK_DISABLE_ANNOTATION:E$c,VITE_SDK_DISABLE_TEXT_SELECTION:_$8}={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0},T$6=E$c==="true",D$a=_$8==="true",n$2={type:"delete",render(){const yi=document.createElement("li");return yi.appendChild(M$l("delete")),yi.title="删除",yi}},r$5={type:"move",render(){const yi=document.createElement("li");return yi.appendChild(M$l("move")),yi.title="移动",yi}},d$7={type:"highlight",render(){const yi=document.createElement("li");return yi.appendChild(M$l("highlight")),yi.setAttribute(`data-${d$h}`,"true"),yi.title="高亮",yi}},c$8={type:"line-delete",allowChecked:!0,render(){const yi=document.createElement("li");return yi.appendChild(M$l("delLine")),yi.title="删除线",yi}},u$5={type:"h-line-add",allowChecked:!0,render(){const yi=document.createElement("li");return yi.appendChild(M$l("addHLine")),yi.title="增加水平线",yi}},a$4={type:"v-line-add",allowChecked:!0,render(){const yi=document.createElement("li");return yi.appendChild(M$l("addVLine")),yi.title="增加竖线",yi}},p$5={type:"span-cell",render(){const yi=document.createElement("li");return yi.appendChild(M$l("spanCell")),yi.title="合并单元格",yi}},s$2={type:"split-cell",render(){const yi=document.createElement("li");return yi.appendChild(M$l("splitCell")),yi.title="拆分单元格",yi}},i$2={type:"copy-text",render(){const yi=document.createElement("li");return yi.appendChild(M$l("copy")),yi.title="复制",yi.setAttribute(`data-${d$h}`,"true"),yi}},h$7={type:"strike-out",render(){const yi=document.createElement("li");return yi.appendChild(M$l("strike")),yi.title="删除线",yi.setAttribute(`data-${d$h}`,"true"),yi}},m$a={type:"square-highlight",render(){const yi=document.createElement("li");return yi.appendChild(M$l("rect-highlight")),yi.title="框选文字",yi.setAttribute(`data-${d$h}`,"true"),yi}},g$9={type:"underline",render(){const yi=document.createElement("li");return yi.appendChild(M$l("underline")),yi.title="下划线",yi.setAttribute(`data-${d$h}`,"true"),yi}};var E$b={get Text(){return{fixed:[r$5,n$2]}},get Line(){return{fixed:[r$5,n$2]}},get Square(){return{fixed:[r$5,n$2,d$7]}},get Highlight(){return{top:[i$2,n$2]}},get Underline(){return{top:[i$2,n$2]}},get StrikeOut(){return{top:[i$2,n$2]}},get Ink(){return{fixed:[r$5,n$2]}},get Table(){return{fixed:[r$5,n$2,u$5,a$4,c$8,p$5,s$2]}},get SelectText(){return T$6?{bottom:[i$2,n$2]}:{bottom:[i$2,m$a,d$7,g$9,h$7,n$2]}},get Polygon(){return{fixed:[r$5,n$2]}},get PolyLine(){return{fixed:[r$5,n$2]}}},i$1=new WeakMap;function d$6(yi,vi){_defineProperty(this,"getParentAnnotationElement",()=>{var bi;return(bi=this.annot)===null||bi===void 0?void 0:bi.getParentAnnotationElement()}),_defineProperty(this,"pin",!1),_defineProperty(this,"listPos",{top:0,left:0}),_defineProperty(this,"handleAnnotUpdated",({data:bi})=>{if(bi.id===this.annotId){var _i;this.annotData=bi,this.refresh(),(_i=this.listPopupSetPosCallback)===null||_i===void 0||_i.call(this,this)}}),_classPrivateFieldInitSpec(this,i$1,{writable:!0,value:({data:bi})=>{bi.id===this.annotId&&this.destroy()}}),_defineProperty(this,"handleAnnotFocusOrBlur",bi=>{[this.annotId].includes(bi.id)&&(this.refresh(),requestAnimationFrame(()=>{var _i;(_i=this.listPopupToggleCallback)===null||_i===void 0||_i.call(this,bi.focus)}))}),_defineProperty(this,"handleOpenPopup",()=>{this.togglePopup(!0)}),_defineProperty(this,"handleClosePopup",()=>{this.togglePopup(!1)}),this.annotId=yi.id,this.annotData=yi,this.app=vi,this.bindAppEvents()}function c$7(){return this.app.destroyed}function m$9(){return this.app.annotationService}function v$6(){return this.app.getAnnotationById(this.annotId)}function f$9(){var yi,vi;return(yi=(vi=this.annot)===null||vi===void 0?void 0:vi.avatar)!==null&&yi!==void 0?yi:""}function A$7(){var yi,vi;return(yi=(vi=this.annot)===null||vi===void 0?void 0:vi.focus)!==null&&yi!==void 0?yi:!1}function _$7(yi){yi.id===this.annotId&&(this.annotData=yi)}function g$8(yi){this.listPos={...this.listPos,...yi},this.refresh()}function P$8(){var yi;(yi=this.popupComponent)===null||yi===void 0||yi.$set(this.popupComponentProps)}function I$7(){return this.annotData.pageNumber}function R$9(){const yi={top:0,left:0},vi=bi=>{if(!bi)return;const _i=bi[2]-bi[0];[,yi.top]=bi,yi.left=bi[0]+_i};if(this.annot){const{outline:bi}=this.annot;vi(bi)}else{const{rect:bi}=this.annotData;vi(bi)}return yi}function C$7(){const yi=[];return this.pin?this.focus&&yi.push("focus"):this.focus||yi.push("hidden"),yi}function E$a(){const{customClass:yi}=this,vi={...this.annotData,avatar:this.avatar,editable:!1};return{annotationData:vi,annotationPopupData:vi,replyAnnotationData:[],pos:this.pin?this.listPos:this.pagePos,customClass:yi,canReply:!1}}function b$9(yi,vi){const bi=this.annotationService.getCurrentPageNumber(),_i={block:"center"};bi!==this.annotData.pageNumber?this.annotationService.scrollToAnnotation(this.annotData.pageNumber,this.annotId,yi,_i):this.annot&&(this.annot.focus=yi,vi&&this.app.annotScrollIntoView(this.annot,_i))}function D$9(){this.popupComponent&&(this.popupComponent.$on("open-popup",this.handleOpenPopup),this.popupComponent.$on("close-popup",this.handleClosePopup))}function N$6(){this.app.addEventListener(i$c,this.handleAnnotUpdated),this.app.addEventListener(P$q,this.handleAnnotFocusOrBlur),this.app.addEventListener(g$m,this.handleAnnotFocusOrBlur),this.app.addEventListener(b$l,_classPrivateFieldGet(this,i$1))}function O$7(){this.app.removeEventListener(i$c,this.handleAnnotUpdated),this.app.removeEventListener(P$q,this.handleAnnotFocusOrBlur),this.app.removeEventListener(g$m,this.handleAnnotFocusOrBlur),this.app.removeEventListener(b$l,_classPrivateFieldGet(this,i$1))}function y$8(){var yi;this.unbindAppEvents(),(yi=this.listPopupRemoveCallback)===null||yi===void 0||yi.call(this,this.annotId)}let F$7=class{constructor({annotData:vi,app:bi}){return d$6.call(this,vi,bi)}get destroyed(){return c$7.call(this)}get annotationService(){return m$9.call(this)}get annot(){return v$6.call(this)}get avatar(){return f$9.call(this)}get focus(){return A$7.call(this)}setAnnotData(vi){return _$7.call(this,vi)}setListPos(vi){return g$8.call(this,vi)}refresh(){return P$8.call(this)}get alignAnnotPageNumber(){return I$7.call(this)}get pagePos(){return R$9.call(this)}get customClass(){return C$7.call(this)}get popupComponentProps(){return E$a.call(this)}togglePopup(vi,bi=!1){return b$9.call(this,vi,bi)}bindComponentEvents(){return D$9.call(this)}bindAppEvents(){return N$6.call(this)}unbindAppEvents(){return O$7.call(this)}destroy(){return y$8.call(this)}};var l$5=new WeakMap,p$4=new WeakSet;function f$8(yi){_classPrivateMethodInitSpec(this,p$4),_classPrivateFieldInitSpec(this,l$5,{writable:!0,value:void 0}),_defineProperty(this,"togglePopup",(vi,bi=!1)=>{var _i;(_i=this.annot)===null||_i===void 0||_i.togglePopup(vi,bi)}),_defineProperty(this,"handleAddReply",vi=>{var bi;(bi=this.annot)===null||bi===void 0||bi.addReply(vi.detail)}),_defineProperty(this,"handleUpdateAnnotationData",vi=>{const bi=vi.detail;this.annotationService.updateAnnotations([bi])}),_defineProperty(this,"handleDeleteAnnotationData",vi=>{const bi=vi.detail;this.annotationService.removeAnnotation(bi)}),yi.annot&&this.setAnnot(yi.annot)}function v$5(yi){_classPrivateFieldSet(this,l$5,yi)}function P$7(){return this.app.getAnnotationById(this.annotId)||_classPrivateFieldGet(this,l$5)}function g$7(){let yi={top:0,left:0};return this.alignAnnotInfo&&(yi=_classPrivateMethodGet(this,p$4,S$a).call(this,this.alignAnnotInfo.outline)),yi}function _$6(){var yi,vi;return(yi=(vi=this.alignAnnotInfo)===null||vi===void 0?void 0:vi.pageNumber)!==null&&yi!==void 0?yi:Number(this.annotData.pageNumber)}function I$6(){var yi;const vi=this.annot.getParentAnnotationElement(),bi=[];this.pin?this.focus&&bi.push("focus"):this.focus||bi.push("hidden");const{data:_i,parameters:$i,replyAvatar:Pi}=this.annot;return{annotationData:{...vi?vi.toJSON():$i.parentData,avatar:this.avatar,editable:this.annot.checkEditable((yi=$i.parentData)===null||yi===void 0?void 0:yi.authorID)},annotationPopupData:_i,replyAnnotationData:($i.replyData||[]).map(Ai=>({...Ai,avatar:Pi[Ai.id],editable:this.annot.checkEditable(Ai.authorID)})),pos:this.pin?this.listPos:this.pagePos,customClass:bi}}function D$8(){var yi;return(yi=this.annot)===null||yi===void 0?void 0:yi.alignAnnotInfo}function R$8(yi,vi){var bi;(bi=this.annot)===null||bi===void 0||bi.setAlignAnnotInfo(yi,vi)}function C$6(){this.popupComponent&&(this.popupComponent.$on("open-popup",this.handleOpenPopup),this.popupComponent.$on("close-popup",this.handleClosePopup),this.popupComponent.$on("add-reply",this.handleAddReply),this.popupComponent.$on("update-annotation-data",this.handleUpdateAnnotationData),this.popupComponent.$on("remove-annotation-data",this.handleDeleteAnnotationData))}let $$5=class extends F$7{constructor(vi){return super(vi),f$8.call(this,vi)}setAnnot(vi){return v$5.call(this,vi)}get annot(){return P$7.call(this)}get pagePos(){return g$7.call(this)}get alignAnnotPageNumber(){return _$6.call(this)}get popupComponentProps(){return I$6.call(this)}get alignAnnotInfo(){return D$8.call(this)}setAlignAnnotInfo(vi,bi=!1){return R$8.call(this,vi,bi)}bindComponentEvents(){return C$6.call(this)}};function S$a(yi){const vi=yi[2]-yi[0];return{top:yi[1],left:yi[0]+vi}}function L$8(yi){_defineProperty(this,"controlBarContainer",document.createElement("div")),_defineProperty(this,"tagsContainer",document.createElement("div")),_defineProperty(this,"popupContainer",document.createElement("div")),_defineProperty(this,"div",document.createElement("div")),_defineProperty(this,"createAnnotDatas",(vi,bi)=>{var _i;return this.dataFactory.create(vi,(_i=this.CustomAnnotClass.get(vi))===null||_i===void 0?void 0:_i.ParentType,bi,{authorID:this.app.userService.currentUser.authorID,author:this.app.userService.currentUser.author})}),this.options=yi,this.pageView=yi.pageView,this.controlBarContainer.classList.add("control-bar-container"),this.tagsContainer.classList.add("tags-container"),this.popupContainer.classList.add("popup-container"),this.controlBarContainer.setAttribute(`data-${S$q}`,"true"),this.tagsContainer.setAttribute(`data-${S$q}`,"true"),this.popupContainer.setAttribute(`data-${S$q}`,"true"),this.div.className="annotationLayer",this.div.appendChild(this.popupContainer),this.div.appendChild(this.controlBarContainer),this.div.appendChild(this.tagsContainer),this.pageDiv.appendChild(this.div),this.dataFactory=new O$8(this.pageInfo),this.annotationConfig={layer:this.div,tagsContainer:this.tagsContainer,pdfPage:this.pdfPage,pageView:this.pageView,viewport:null,getPageInfo:()=>this.pageInfo,linkService:this.linkService,downloadManager:this.downloadManager,imageResourcesPath:this.imageResourcesPath||"",renderForms:this.renderForms!==!1,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,getHasJSActions:()=>this.hasJSActions,getFieldObjects:()=>this.fieldObjects,mouseState:this._mouseState||{isDown:!1},isHandPainted:!0,CustomAnnotClass:this.CustomAnnotClass,annotationService:this.app.annotationService,author:()=>this.app.userService.currentUser.author,authorID:()=>this.app.userService.currentUser.authorID}}function w$6(){return this.pdfPage.app}function S$9(){return this.pageView.id}function b$8(){return this.app.annotationManager}function D$7(){return this.app.currentAnnotType}function I$5(){return this.app.customAnnotClassMap}function M$7(){const{rotation:yi,scale:vi,viewport:bi,id:_i,canvas:$i}=this.pageView,Pi=this.pageDiv.clientHeight,Ai=this.pageDiv.clientWidth,[Si,Ei,wi,Ci]=bi.viewBox,ki=wi-Si,xi=Ci-Ei;return{scale:vi,rotation:yi,width:ki,height:xi,currentHeight:Pi,currentWidth:Ai,pageNumber:_i,viewport:bi,canvas:$i}}function T$5(){return this._hasJSActionsPromise}function R$7(){return this._fieldObjectsPromise}function E$9(yi){var vi;const bi=(vi=this.annotationManager.getById(yi.parentId||""))===null||vi===void 0?void 0:vi.data;let _i=null,$i=null;if(bi&&(bi.annotationType===E$p.Text||!this.app.hasPopupList)){const Pi=this.annotationManager.filter(({data:Ai})=>(bi.replyIds||[]).includes(Ai.id)).map(Ai=>Ai.data);$i=O$9.create({...this.annotationConfig,parentData:bi,data:yi,replyData:Pi}),$i.popupAnnotRelatedItem=new $$5({annotData:$i.data,app:this.app,annot:$i}),_i=$i.render(),_i&&this.popupContainer.appendChild(_i)}return $i}function H$4(yi){yi.data.subj==="Highlight"?yi.container.classList.add("highlight-wrapper"):yi.container.classList.remove("highlight-wrapper")}function O$6(yi){var vi;let bi=(vi=this.annotationManager.getById(yi.id))===null||vi===void 0?void 0:vi.el,_i=null;if(bi)if(_i=bi.update(yi),yi.annotationType!==E$p.Popup){var $i;const Pi=($i=bi.controlBar)===null||$i===void 0?void 0:$i.wrapper;Pi&&!this.controlBarContainer.contains(Pi)&&this.controlBarContainer.append(Pi)}else _i&&!this.popupContainer.contains(_i)&&this.popupContainer.appendChild(_i);else{if(yi.annotationType===E$p.Popup)return this.renderPopupAnnotation(yi);bi=O$9.create({...this.annotationConfig,data:yi}),bi&&(_i=bi.render(),this.renderControlBar(bi))}return _i&&this.toogleHighlightAnnot(bi),_i&&yi.annotationType!==E$p.Popup&&!this.div.contains(_i)&&this.div.appendChild(_i),bi}function x$4(yi){const{subtype:vi,inReplyTo:bi}=yi.parameters.data;vi==="Text"&&bi||(vi==="SelectText"&&yi.dom.classList.add("highlight-wrapper"),this.div.appendChild(yi.dom))}function F$6(yi){const{customType:vi,subtype:bi}=yi,_i=new _$9({dataset:[["subtype",bi],["customType",vi]]});_i.eventBus.on("ctrlChange",Si=>{m$b(Si,yi,this.app)});const $i=vi?{}:E$b[yi.subtype],Pi=this.app.customOperations[vi||bi]||{};if(mergeWith_1($i,Pi,(Si,Ei)=>{if(Array.isArray(Si)&&Array.isArray(Si))return[...Si,...Ei]}),!$i)return;if(yi.editable||Object.keys($i).forEach(Si=>{$i[Si]=$i[Si].filter(Ei=>!["move","delete","highlight"].includes(Ei.type))}),yi.isAlwaysShowControlBar||yi.focus){if(yi.isDrawing)return;const{ctrlBarPoint:Si,width:Ei,height:wi}=yi;_i.move(Si[1],Si[0],Ei,wi),_i.show()}const Ai=_i.render(yi,$i);Ai&&this.controlBarContainer.append(Ai),yi.setControlBar(_i)}async function W$6(yi){this.annotationConfig.viewport=yi.clone({dontFlip:!0});try{var vi;const{pageNumber:bi}=this;this.annotationManager.getByPage(bi).filter(Pi=>!(Pi.data.annotationType===E$p.Popup&&Pi.data.parentType!=="Text")).map(Pi=>Pi.data).forEach(Pi=>{this.renderAnnot(Pi)});const _i=this.app.UIManager.widgetManager.widgetsOfPage.get(bi);if(_i==null||_i.forEach(Pi=>{Pi.update()}),!this.annotationManager.hasRendered(bi)){this.annotationManager.setRendered(bi);const Pi=await this.pdfPage.getAnnotations(),{collabService:Ai}=this.app;Pi.forEach(Si=>{if(Ai){const Ei=Ai.getPageRef(bi);if(Ei&&(!Ai.hasAnnotation(Si,Ei)||this.annotationManager.has(Si.id)))return}this.annotationManager.setData(Si,!1)})}const $i=(vi=this.pageView.canvas)===null||vi===void 0?void 0:vi.parentElement;if($i){$i.classList.add("annotation-bg");const Pi=this.div.querySelector(".annotation-bg");Pi?this.div.replaceChild($i,Pi):this.div.insertBefore($i,this.div.firstChild)}this.div.hidden=!1,this.l10n.translate(this.div)}catch(bi){throw console.error(bi),bi}}function N$5(){component_viewerExports.AnnotationLayerBuilder.prototype.cancel.call(this)}function j$5(){}let J$4=class extends component_viewerExports.AnnotationLayerBuilder{constructor(vi){return super(vi),L$8.call(this,vi)}get app(){return w$6.call(this)}get pageNumber(){return S$9.call(this)}get annotationManager(){return b$8.call(this)}get currentAnnotType(){return D$7.call(this)}get CustomAnnotClass(){return I$5.call(this)}get pageInfo(){return M$7.call(this)}get hasJSActions(){return T$5.call(this)}get fieldObjects(){return R$7.call(this)}renderPopupAnnotation(vi){return E$9.call(this,vi)}toogleHighlightAnnot(vi){return H$4.call(this,vi)}renderAnnot(vi){return O$6.call(this,vi)}renderWidget(vi){return x$4.call(this,vi)}renderControlBar(vi){return F$6.call(this,vi)}async render(vi){return W$6.call(this,vi)}cancel(){return N$5.call(this)}hide(){return j$5.call(this)}};var Z$4=J$4;const h$6=new WeakMap;function w$5({views:yi,sortByVisibility:vi=!1}){const bi=[],_i=new Set;yi.forEach((Ai,Si)=>{const Ei=Ai.div;if(h$6.has(Ei)){const wi=Ei.offsetLeft+Ei.clientLeft,Ci=Ei.offsetTop+Ei.clientTop;bi.push({id:Ai.id,x:wi,y:Ci,view:Ai,percent:h$6.get(Ei),widthPercent:100}),_i.add(Ai.id)}});const $i=bi[0],Pi=bi[bi.length-1];return vi&&bi.sort((Ai,Si)=>{const Ei=Ai.percent-Si.percent;return Math.abs(Ei)>.001?-Ei:Ai.id-Si.id}),{first:$i,last:Pi,views:bi,ids:_i}}const b$7={threshold:[0,.25,.5,.75,1]};function L$7(yi,vi){const bi={right:!0,down:!0,lastPage:1},_i=yi.querySelector(".pdfViewer"),$i=new IntersectionObserver(Ai=>{let Si=0;const{length:Ei}=Ai;for(;Si{let Si=0;const{length:Ei}=Ai;for(;Si{Pi&&Pi.popupId===$i&&Ai!==yi&&_i.push(Ai)}),_i}function B$3(yi,vi){var bi;const _i=_classPrivateFieldGet(this,a$3).get(yi);if(!_i)return!1;const{data:$i,el:Pi}=_i;return _classPrivateMethodGet(this,d$5,k$8).call(this,yi,vi),this.eventBus.dispatch(R$l,{data:$i,triggerRemote:vi}),(bi=$i.replyIds)===null||bi===void 0||bi.forEach(Ai=>this.remove(Ai,vi)),$i.popupId&&this.remove($i.popupId,vi),_classPrivateFieldGet(this,a$3).delete(yi),Pi==null||Pi.destroy(),!0}function E$8(yi){[..._classPrivateFieldGet(this,a$3).values()].forEach(({data:vi})=>{(vi.customType===yi||vi.subtype===yi)&&this.remove(vi.id)})}function D$6(){for(const[yi]of _classPrivateFieldGet(this,a$3))this.remove(yi)}function S$8(yi){const vi=[..._classPrivateFieldGet(this,a$3).values()];return yi?vi.filter(yi):vi}function F$4(yi){_classPrivateFieldGet(this,a$3).forEach(yi)}function R$6(yi){(yi.autoFocusOnEnter||yi.autoFocusOnClick)&&_classPrivateFieldGet(this,a$3).forEach(({el:vi})=>{vi&&vi!==yi&&(vi.focus=!!yi.data.popupId&&vi.data.popupId===yi.data.popupId)})}function G$4(yi,vi){const bi=_classPrivateFieldGet(this,a$3).get(yi);return bi?vi?!!(bi.data&&bi.el):!!bi.data:!1}function N$4(yi,vi,bi){this.eventBus.on(yi,vi,bi)}function w$4(yi,vi){this.eventBus.off(yi,vi)}function C$4(yi){_classPrivateFieldGet(this,h$5).add(yi)}function O$4(yi){return _classPrivateFieldGet(this,h$5).has(yi)}function T$4(){_classPrivateFieldGet(this,a$3).clear(),_classPrivateFieldGet(this,h$5).clear()}function b$6(){this.reset()}let j$4=class{constructor(vi){return v$4.call(this,vi)}setData(vi,bi=!0,_i=!0){return g$6.call(this,vi,bi,_i)}setAnnot(vi){return A$5.call(this,vi)}getById(vi){return M$6.call(this,vi)}getByPage(vi){return I$4.call(this,vi)}getAnnotsNotCustom(vi){return P$6.call(this,vi)}getCrossPageRelatedAnnotIds(vi,bi=!1){return y$6.call(this,vi,bi)}remove(vi,bi=!0){return B$3.call(this,vi,bi)}removeByType(vi){return E$8.call(this,vi)}removeAll(){return D$6.call(this)}filter(vi){return S$8.call(this,vi)}forEach(vi){return F$4.call(this,vi)}setFocus(vi){return R$6.call(this,vi)}has(vi,bi=!1){return G$4.call(this,vi,bi)}on(vi,bi,_i){return N$4.call(this,vi,bi,_i)}off(vi,bi){return w$4.call(this,vi,bi)}setRendered(vi){return C$4.call(this,vi)}hasRendered(vi){return O$4.call(this,vi)}reset(){return T$4.call(this)}destroy(){return b$6.call(this)}};function k$8(yi,vi){this.getCrossPageRelatedAnnotIds(yi).forEach(bi=>{const _i=_classPrivateFieldGet(this,a$3).get(bi);if(_i){var $i,Pi;_classPrivateFieldGet(this,a$3).delete(bi),this.eventBus.dispatch(R$l,{data:_i.data,triggerRemote:vi}),($i=_i.data.replyIds)===null||$i===void 0||$i.forEach(Ai=>this.remove(Ai,vi)),(Pi=_i.el)===null||Pi===void 0||Pi.destroy()}})}var root=_root,now$1=function(){return root.Date.now()},now_1=now$1,reWhitespace=/\s/;function trimmedEndIndex$1(yi){for(var vi=yi.length;vi--&&reWhitespace.test(yi.charAt(vi)););return vi}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(yi){return yi&&yi.slice(0,trimmedEndIndex(yi)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,baseTrim=_baseTrim,isObject$2=isObject_1,isSymbol=isSymbol_1,NAN=0/0,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(yi){if(typeof yi=="number")return yi;if(isSymbol(yi))return NAN;if(isObject$2(yi)){var vi=typeof yi.valueOf=="function"?yi.valueOf():yi;yi=isObject$2(vi)?vi+"":vi}if(typeof yi!="string")return yi===0?yi:+yi;yi=baseTrim(yi);var bi=reIsBinary.test(yi);return bi||reIsOctal.test(yi)?freeParseInt(yi.slice(2),bi?2:8):reIsBadHex.test(yi)?NAN:+yi}var toNumber_1=toNumber$1,isObject$1=isObject_1,now=now_1,toNumber=toNumber_1,FUNC_ERROR_TEXT$1="Expected a function",nativeMax=Math.max,nativeMin=Math.min;function debounce$1(yi,vi,bi){var _i,$i,Pi,Ai,Si,Ei,wi=0,Ci=!1,ki=!1,xi=!0;if(typeof yi!="function")throw new TypeError(FUNC_ERROR_TEXT$1);vi=toNumber(vi)||0,isObject$1(bi)&&(Ci=!!bi.leading,ki="maxWait"in bi,Pi=ki?nativeMax(toNumber(bi.maxWait)||0,vi):Pi,xi="trailing"in bi?!!bi.trailing:xi);function Ti(Vi){var Ni=_i,Wi=$i;return _i=$i=void 0,wi=Vi,Ai=yi.apply(Wi,Ni),Ai}function Oi(Vi){return wi=Vi,Si=setTimeout(Ii,vi),Ci?Ti(Vi):Ai}function ji(Vi){var Ni=Vi-Ei,Wi=Vi-wi,zi=vi-Ni;return ki?nativeMin(zi,Pi-Wi):zi}function Li(Vi){var Ni=Vi-Ei,Wi=Vi-wi;return Ei===void 0||Ni>=vi||Ni<0||ki&&Wi>=Pi}function Ii(){var Vi=now();if(Li(Vi))return Mi(Vi);Si=setTimeout(Ii,ji(Vi))}function Mi(Vi){return Si=void 0,xi&&_i?Ti(Vi):(_i=$i=void 0,Ai)}function Fi(){Si!==void 0&&clearTimeout(Si),wi=0,_i=Ei=$i=Si=void 0}function Bi(){return Si===void 0?Ai:Mi(now())}function Ri(){var Vi=now(),Ni=Li(Vi);if(_i=arguments,$i=this,Ei=Vi,Ni){if(Si===void 0)return Oi(Ei);if(ki)return clearTimeout(Si),Si=setTimeout(Ii,vi),Ti(Ei)}return Si===void 0&&(Si=setTimeout(Ii,vi)),Ai}return Ri.cancel=Fi,Ri.flush=Bi,Ri}var debounce_1=debounce$1,debounce=debounce_1,isObject=isObject_1,FUNC_ERROR_TEXT="Expected a function";function throttle(yi,vi,bi){var _i=!0,$i=!0;if(typeof yi!="function")throw new TypeError(FUNC_ERROR_TEXT);return isObject(bi)&&(_i="leading"in bi?!!bi.leading:_i,$i="trailing"in bi?!!bi.trailing:$i),debounce(yi,vi,{leading:_i,maxWait:vi,trailing:$i})}var throttle_1=throttle;const L$6={useViewRotation:!1,allowCrossPageBoundary:!1};function a$2(yi,vi,bi={}){var _i;bi={...L$6,...bi};const $i=(_i=/pdflux-identification/.test(vi.data.customType||""))!==null&&_i!==void 0?_i:!1;return bi={...bi,useViewRotation:$i,allowCrossPageBoundary:$i},yi===E$p[E$p.Square]?new y$o(vi,bi):yi===E$p[E$p.SelectText]?(bi.events={onSelectionChange(Pi){vi.annotationService.UIEventBus.dispatch(X$g,Pi)}},new Rt(vi,bi)):yi===E$p[E$p.Ink]?new V$8(vi,bi):yi===E$p[E$p.PolyLine]?(bi.events={onVertexChanged(Pi){vi.annotationService.UIEventBus.dispatch($$h,Pi)}},new H$7(vi,bi)):yi===E$p[E$p.Polygon]?(bi.events={onVertexChanged(Pi){vi.annotationService.UIEventBus.dispatch(j$f,Pi)}},new B$4(vi,bi)):yi===E$p[E$p.Line]?(bi.ignoreBorder=!0,new V$9(vi,bi)):yi===E$p[E$p.Table]?new me$1(vi,bi):yi===E$p[E$p.Text]?new b$e(vi,bi):yi===E$p[E$p.Highlight]?new B$8(vi,bi):yi===E$p[E$p.Underline]?new y$c(vi,bi):yi===E$p[E$p.StrikeOut]?new y$e(vi,bi):new y$o(vi,bi)}const o$2={INITIAL:0,DRAWING:1,DORMANT:2,FINISHED:3};function S$7(){return this.drawingState===o$2.DORMANT}function D$5(){return this.dataLoadedCapability.promise}function b$5(){const yi=this.triggeredBy.layerDom.getBoundingClientRect(),vi=this.drawingBy?this.drawingBy.layerDom.getBoundingClientRect():yi,{clientX:bi,clientY:_i}=this.triggeredBy.event,{clientX:$i,clientY:Pi}=this.drawingBy.event,Ai=bi-yi.left,Si=_i-yi.top,Ei=$i-vi.left,wi=Pi-vi.top;return[Ai,Si,Ei,wi]}function N$3(){return this.triggeredBy.pageNumber}function E$7(){return this.drawingBy?this.drawingBy.pageNumber:this.triggeredBy.pageNumber}function L$5(){return this.triggeredBy?this.triggeredBy.event.ctrlKey:!1}function P$5(){return this.triggeredBy?this.triggeredBy.event.altKey:!1}function A$4(){return this.triggeredBy?this.triggeredBy.event.shiftKey:!1}function C$3(yi,vi){_defineProperty(this,"clickTimes",1),_defineProperty(this,"drawingState",o$2.INITIAL),_defineProperty(this,"timer",0),_defineProperty(this,"dataLoadedCapability",o$c()),_defineProperty(this,"onClose",null),_defineProperty(this,"state",{}),this.triggeredBy=c$6.createData(yi),this.options=vi}function H$3(yi){return{event:yi,pageNumber:this.getPageNumber(yi),layerDom:this.getLayerDom(yi)}}function I$3(yi){return yi.target.closest(".annotationLayer")}function T$3(yi){const vi=yi.target.closest(".page");return Number(vi.dataset.pageNumber)}function M$5(yi,vi){this.onClose=vi,this.cancelTimer(),this.drawingState===o$2.DORMANT&&(this.triggeredBy=c$6.createData(yi),this.clickTimes+=1)}function R$5(){this.dataLoadedCapability.resolve(!0)}function x$3(yi){this.drawingBy=c$6.createData(yi),this.drawingState=o$2.DRAWING}function F$3(){this.timer&&clearTimeout(this.timer)}function G$3(){this.drawingState=o$2.DORMANT,this.timer=setTimeout(async()=>{this.onClose&&await this.onClose(),this.close(),this.timer=0},250)}function K$2(){this.drawingState!==o$2.FINISHED&&(this.drawingState=o$2.FINISHED,this.cancelTimer(),this.options.onSessionClose&&this.options.onSessionClose())}let c$6=class{get isDormant(){return S$7.call(this)}get dataLoaded(){return D$5.call(this)}get outline(){return b$5.call(this)}get beginPageNumber(){return N$3.call(this)}get pageNumber(){return E$7.call(this)}get ctrlKey(){return L$5.call(this)}get altKey(){return P$5.call(this)}get shiftKey(){return A$4.call(this)}constructor(vi,bi={}){return C$3.call(this,vi,bi)}static createData(vi){return H$3.call(this,vi)}static getLayerDom(vi){return I$3.call(this,vi)}static getPageNumber(vi){return T$3.call(this,vi)}activate(vi,bi){return M$5.call(this,vi,bi)}resolveData(){return R$5.call(this)}drawing(vi){return x$3.call(this,vi)}cancelTimer(){return F$3.call(this)}stop(){return G$3.call(this)}close(){return K$2.call(this)}};function W$5(yi,vi){return new c$6(yi,vi)}var u$4=new WeakMap,d$4=new WeakMap;function k$7(yi){_defineProperty(this,"session",null),_classPrivateFieldInitSpec(this,u$4,{writable:!0,value:null}),_defineProperty(this,"removeLineBreak",!1),_classPrivateFieldInitSpec(this,d$4,{writable:!0,value:async()=>{await this.drawingEnd()}}),_defineProperty(this,"onMousedown",async vi=>{var bi;this.canHandleEvent(vi)&&(this.reset(),this.prepareSession(vi),document.addEventListener("mouseup",_classPrivateFieldGet(this,d$4),{once:!0}),await this.createAnnotationFromEvent(this.getData(vi)),(bi=this.session)===null||bi===void 0||bi.resolveData())}),_defineProperty(this,"onMousemove",vi=>{var bi;const _i=this.getPageNumberByEventTarget(vi.target);if(((bi=this.session)===null||bi===void 0?void 0:bi.pageNumber)===_i&&this.session){this.session.drawing(vi);const{outline:$i}=this.session;this.options.onWidgetDrawing($i[2],$i[3],$i[0],$i[1])}}),this.getPageView=yi.getPageView,this.container=yi.container,this.eventBus=yi.eventBus,this.uiManager=yi.uiManager,this.options=yi}function $$3(){return this.getLayer(this.session.pageNumber)}function O$3(){return this.currentAnnotLayer.currentAnnotType}function X$4(){return this.uiManager.parentAnnotType}function Y$4(){return this.currentAnnotLayer.app}function V$3(){return _classPrivateFieldGet(this,u$4)}function z$4(yi){_classPrivateFieldSet(this,u$4,yi)}function U$4(yi){const vi=this.getPageView(yi-1);return vi==null?void 0:vi.annotationLayer}function Z$3(yi,vi){var bi;const _i=((bi=this.getLayer(vi).div)===null||bi===void 0?void 0:bi.getBoundingClientRect())||{left:0,top:0},{clientX:$i,clientY:Pi}=yi,Ai=$i-_i.left,Si=Pi-_i.top;return[Ai,Si]}function j$3(yi){var vi;const bi=yi;if(!(bi!=null&&bi.closest(".annotationLayer")))return null;const _i=bi==null||(vi=bi.closest)===null||vi===void 0?void 0:vi.call(bi,".page"),$i=_i==null?void 0:_i.dataset.pageNumber;return $i?Number($i):null}function q$2(yi,vi){const bi={data:yi,pdfPage:vi.pdfPage,getPageInfo(){return vi.annotationLayer.pageInfo},annotationService:this.app.annotationService,zIndex:this.uiManager.widgetManager.getMaxZIndex(yi.pageNumber)+1},{ctrlKey:_i,altKey:$i,shiftKey:Pi}=this.session||{};return a$2(yi.subtype,bi,{ctrlKey:_i,altKey:$i,shiftKey:Pi})}async function J$3(yi){const{rect:vi}=yi;document.body.style.userSelect="none";const bi=O$8.fromRect(this.app,vi,this.session.pageNumber),_i=this.getPageView(this.session.pageNumber-1),$i=this.createWidget(bi,_i);return this.options.onWidgetCreate($i),this.onAnnotationCreated($i),$i}function Q$4(yi){this.currentDrawing=yi}async function tt$3(){this.session&&await this.session.dataLoaded,this.stopDrawing()}function et$3(yi){var vi;return!(yi.button!==0||(vi=yi.target)!==null&&vi!==void 0&&vi.closest(`[data-${S$q}="true"]`)||!this.isTriggeredInPage(yi))}function nt$3(){document.body.style.userSelect="unset";const yi=this.currentDrawing;this.currentDrawing=null,this.session&&this.session.stop(),yi!=null&&yi.isDrawing&&this.options.onWidgetDrawEnd(yi),document.removeEventListener("mouseup",_classPrivateFieldGet(this,d$4))}function rt$3(yi){return!!this.getPageNumberByEventTarget(yi.target)}function it$3(yi,vi,bi){var _i;const $i=((_i=this.currentAnnotLayer.div)===null||_i===void 0?void 0:_i.getBoundingClientRect())||{left:0,top:0},Pi={x:yi.clientX-$i.left,y:yi.clientY-$i.top};return bi&&(Pi.x/=vi.viewport.scale,Pi.y/=vi.viewport.scale),Pi}function st$3(yi){const vi=this.getStartAt(yi,this.currentAnnotLayer.pageInfo);return{rect:[vi.x,vi.y,vi.x,vi.y],eventType:yi.type,event:yi}}function at$3(){this.removeLineBreak=!1}function ot$3(yi){}function lt$2(yi){if(this.session){if(this.session.isDormant){this.session.activate(yi,async()=>{await this.handleMultipleClick(yi)});return}return}const vi=()=>{const _i=this.getPageNumberByEventTarget(yi.target),$i=this.getLayer(_i);return{pageNumber:_i,pageInfo:$i.pageInfo}},bi=W$5(yi,{onSessionClose:()=>{this.session=null}});bi.context=vi(),this.session=bi}function ct$2(){this.container.addEventListener("mousedown",this.onMousedown),this.container.addEventListener("mousemove",this.onMousemove)}function ut$2(){this.container.removeEventListener("mousedown",this.onMousedown),this.container.removeEventListener("mousemove",this.onMousemove)}function gt$1(){var yi;this.unbindEvent(),(yi=_classPrivateFieldGet(this,u$4))===null||yi===void 0||yi.destroy()}let ht$1=class{constructor(vi){return k$7.call(this,vi)}get currentAnnotLayer(){return $$3.call(this)}get currentAnnotType(){return O$3.call(this)}get parentAnnotType(){return X$4.call(this)}get app(){return Y$4.call(this)}get currentDrawing(){return V$3.call(this)}set currentDrawing(vi){return z$4.call(this,vi)}getLayer(vi){return U$4.call(this,vi)}getPoint(vi,bi){return Z$3.call(this,vi,bi)}getPageNumberByEventTarget(vi){return j$3.call(this,vi)}createWidget(vi,bi){return q$2.call(this,vi,bi)}async createAnnotationFromEvent(vi){return J$3.call(this,vi)}onAnnotationCreated(vi){return Q$4.call(this,vi)}async drawingEnd(){return tt$3.call(this)}canHandleEvent(vi){return et$3.call(this,vi)}stopDrawing(){return nt$3.call(this)}isTriggeredInPage(vi){return rt$3.call(this,vi)}getStartAt(vi,bi,_i=!0){return it$3.call(this,vi,bi,_i)}getData(vi){return st$3.call(this,vi)}reset(){return at$3.call(this)}handleMultipleClick(vi){return ot$3.call(this,vi)}prepareSession(vi){return lt$2.call(this,vi)}bindEvent(){return ct$2.call(this)}unbindEvent(){return ut$2.call(this)}destroy(){return gt$1.call(this)}};var D$4=new WeakMap,W$4=new WeakMap,U$3=new WeakMap,V$2=new WeakMap,L$4=new WeakMap,j$2=new WeakMap,M$4=new WeakMap,J$2=new WeakMap,Q$3=new WeakMap,Z$2=new WeakSet,ee=new WeakMap,te=new WeakSet,ne=new WeakMap,se=new WeakSet,ie=new WeakSet,ae=new WeakSet,re=new WeakSet,H$2=new WeakSet,F$2=new WeakSet,R$4=new WeakSet,Y$3=new WeakSet,X$3=new WeakSet,$$2=new WeakMap,O$2=new WeakMap,z$3=new WeakMap,G$2=new WeakMap;function we(yi){_classPrivateMethodInitSpec(this,X$3),_classPrivateMethodInitSpec(this,Y$3),_classPrivateMethodInitSpec(this,R$4),_classPrivateMethodInitSpec(this,F$2),_classPrivateMethodInitSpec(this,H$2),_classPrivateMethodInitSpec(this,re),_classPrivateMethodInitSpec(this,ae),_classPrivateMethodInitSpec(this,ie),_classPrivateMethodInitSpec(this,se),_classPrivateMethodInitSpec(this,te),_classPrivateMethodInitSpec(this,Z$2),_classPrivateFieldInitSpec(this,D$4,{writable:!0,value:""}),_classPrivateFieldInitSpec(this,W$4,{writable:!0,value:-1}),_defineProperty(this,"drawingWidgets",new Set),_defineProperty(this,"cursorPageNumber",null),_defineProperty(this,"clearDrawingWidgets",()=>{this.drawingWidgets.forEach(vi=>{this.drawingWidgets.delete(vi),this.uiManager.removeWidget(vi)})}),_classPrivateFieldInitSpec(this,U$3,{writable:!0,value:(vi,bi=!0,_i=1)=>{let $i;const[Pi,Ai,Si,Ei]=vi;return bi?$i=[Math.max(Si-_i,Pi),Math.max(Ei-_i,Ai)]:$i=[Math.min(Pi+_i,Si),Math.min(Ai+_i,Ei)],$i}}),_classPrivateFieldInitSpec(this,V$2,{writable:!0,value:async(vi,bi,_i)=>{const $i=[];for await(const Pi of vi){const Ai=Pi,[Si,...Ei]=Ai,wi=_i?Ei:[],Ci=_i?[]:Ei,ki=this.getPageView(Si.pageNumber-1),xi=(await ki.pdfPage.getParagraphInfos()).find(Fi=>Fi.index===Si.index);if(!xi)break;const Ti=_classPrivateFieldGet(this,U$3).call(this,xi.outline,_i),[Oi,ji]=await ki.pdfPage.selectTextService.getNearPointIndexes({index:Si.pageNumber-1,x:Ti[0],y:Ti[1],xTolerance:0,yTolerance:0}),Li=_i?Oi:ji;let Ii=await ki.pdfPage.getSentenceCharRange(Li);const Mi=await ki.pdfPage.getRangeText(Ii[0],Ii[1]-Ii[0]);if(_i?bi=`${Mi}${bi}`:bi=`${bi}${Mi}`,await ki.pdfPage.selectTextService.getSentenceCountInText(bi)===1){const Fi=await _classPrivateFieldGet(this,L$4).call(this,Si.pageNumber,Ii,Ti,wi,Ci);if(Ii=Fi.indexes,$i.push({point:Ti,pageNumber:Si.pageNumber,indexes:Ii}),!(Fi.beforeFull&&Fi.afterFull))break}else break}return $i}}),_classPrivateFieldInitSpec(this,L$4,{writable:!0,value:async(vi,bi,_i,$i,Pi)=>{const[Ai,Si]=_i,Ei=this.getPageView(vi-1),wi=await Ei.pdfPage.getElementBlockIndexesByPoint(Ai,Si);let[Ci,ki]=bi;const xi={beforeFull:Ci===wi[0],afterFull:ki===wi[1],indexes:bi};if($i.length){const Ti=[...$i].reverse();for await(const Oi of Ti){const[ji]=await Ei.pdfPage.getSentenceCharRange(Ci-1),[Li]=await Ei.pdfPage.getElementBlockCharRange(Ci-1),Ii=ji===Li;if(await Ei.pdfPage.getSentenceCountByIndexes(ji,ki)===1){if(Ci=ji,!Ii){xi.beforeFull=!1;break}}else{xi.beforeFull=!1;break}}}if(Pi.length)for await(const Ti of Pi){const[,Oi]=await Ei.pdfPage.getSentenceCharRange(ki+1),[,ji]=await Ei.pdfPage.getElementBlockCharRange(Ci+1),Li=Oi===ji;if(await Ei.pdfPage.getSentenceCountByIndexes(Ci,Oi)===1){if(ki=Oi,!Li){xi.beforeFull=!1;break}}else{xi.afterFull=!1;break}}return xi.indexes=[Ci,ki],xi}}),_classPrivateFieldInitSpec(this,j$2,{writable:!0,value:async(vi,bi,_i,$i)=>{let[Pi,Ai]=bi;if(_i.length){const Si=[..._i].reverse(),Ei=this.app.pdfViewer.getPageView(vi-1);for await(const wi of Si)[Pi]=await Ei.pdfPage.getElementBlockCharRange(Pi-1)}if($i.length){const Si=this.app.pdfViewer.getPageView(vi-1);for await(const Ei of $i)[,Ai]=await Si.pdfPage.getElementBlockCharRange(Ai+1)}return{indexes:[Pi,Ai]}}}),_classPrivateFieldInitSpec(this,M$4,{writable:!0,value:async vi=>{for(const _i of vi.selections){var bi;const{point:$i}=_i,Pi={rect:$i.concat($i),id:It$3("widget"),selection:_i,pageNumber:_i.pageNumber,subtype:E$p[E$p.SelectText]},Ai=this.createWidget(Pi,_i.pageView);this.options.onWidgetCreate(Ai),this.onAnnotationCreated(Ai),this.options.onWidgetDrawEnd(Ai),await Promise.all(Ai.drawingTask),(bi=Ai.config.events)===null||bi===void 0||bi.onSelectionChange(Ai)}}}),_classPrivateFieldInitSpec(this,J$2,{writable:!0,value:async(vi,bi,_i)=>{const $i=this.app.pdfViewer.getPageView(vi-1),Pi=await $i.pdfPage.getExpandSentenceIndexesByPoint(bi,_i),{acrossColumn:Ai,acrossPage:Si}=await this.app.getParagraphMerged(vi,bi,_i,!0),Ei=await _classPrivateFieldGet(this,L$4).call(this,vi,Pi,[bi,_i],Ai.beforeBlocks,Ai.afterBlocks),wi={pageView:$i},Ci=new J$8,ki=new l$c(Ei.indexes[0],Ei.indexes[1],wi);ki.point=[bi,_i],Ci.addSelection(ki);const[xi,Ti]=Ei.indexes,Oi=await $i.pdfPage.getRangeText(xi,Ti-xi);if(Ei.beforeFull&&Si.beforeBlocks.length){const ji=[...Si.beforeBlocks].reverse(),Li=await this.app.pdfDocument.getPageInfoElements(ji,vi,-1),Ii=await _classPrivateFieldGet(this,V$2).call(this,Li,Oi,!0);for(const Mi of Ii){const Fi={pageView:this.getPageView(Mi.pageNumber-1)},Bi=new l$c(Mi.indexes[0],Mi.indexes[1],Fi);Bi.point=Mi.point,Ci.addSelection(Bi,-1)}}if(Ei.afterFull&&Si.afterBlocks.length){const ji=await this.app.pdfDocument.getPageInfoElements(Si.afterBlocks,vi,1),Li=await _classPrivateFieldGet(this,V$2).call(this,ji,Oi,!1);for(const Ii of Li){const Mi={pageView:this.getPageView(Ii.pageNumber-1)},Fi=new l$c(Ii.indexes[0],Ii.indexes[1],Mi);Fi.point=Ii.point,Ci.addSelection(Fi)}}await Ci.trimSelections(),await _classPrivateFieldGet(this,M$4).call(this,Ci)}}),_classPrivateFieldInitSpec(this,Q$3,{writable:!0,value:async(vi,bi,_i)=>{const $i=this.getPageView(vi-1),Pi=await $i.pdfPage.getElementBlockIndexesByPoint(bi,_i),{acrossColumn:Ai,acrossPage:Si}=await this.app.getParagraphMerged(vi,bi,_i,!0),Ei=new J$8,wi=await _classPrivateFieldGet(this,j$2).call(this,vi,Pi,Ai.beforeBlocks,Ai.afterBlocks),Ci=new l$c(wi.indexes[0],wi.indexes[1],{pageView:$i});Ci.point=[bi,_i],Ei.addSelection(Ci);for(const ki of Si.afterBlocks){const{outline:[xi,Ti,Oi,ji],page:Li}=ki,Ii=this.getPageView(Li),Mi=[xi+(Oi-xi)/2,Ti+(ji-Ti)/2],[Fi,Bi]=await Ii.pdfPage.getElementBlockIndexesByPoint(...Mi),Ri=new l$c(Fi,Bi,{pageView:Ii});Ri.point=Mi,Ei.addSelection(Ri)}for(const ki of Si.beforeBlocks){const{outline:[xi,Ti,Oi,ji],page:Li}=ki,Ii=this.getPageView(Li),Mi=[xi+(Oi-xi)/2,Ti+(ji-Ti)/2],[Fi,Bi]=await Ii.pdfPage.getElementBlockIndexesByPoint(...Mi),Ri=new l$c(Fi,Bi,{pageView:Ii});Ri.point=Mi,Ei.addSelection(Ri,-1)}await Ei.trimSelections(),await _classPrivateFieldGet(this,M$4).call(this,Ei)}}),_classPrivateFieldInitSpec(this,ee,{writable:!0,value:throttle_1(()=>{if(this.session&&this.drawingWidgets.size>1){const[vi,bi]=[this.session.beginPageNumber,this.session.pageNumber].sort(($i,Pi)=>$i-Pi),_i=this.session.beginPageNumber{if($i.pageNumberbi||!$i.pageCharCount||!$i.text)return;let{anchor:Pi,head:Ai}=$i.selection;const Si=$i.pageNumber===vi,Ei=$i.pageNumber===bi,wi=$i.pageCharCount-1;if(_i){Si?Ai=wi:(Ei||(Ai=wi),Pi=0),($i.selection.head!==Ai||$i.selection.anchor!==Pi)&&$i.updateSelection({anchor:Pi,head:Ai});return}Si?Pi=wi:Ei?Ai=0:(Ai=0,Pi=wi),($i.selection.head!==Ai||$i.selection.anchor!==Pi)&&$i.updateSelection({anchor:Pi,head:Ai})})}},60,{leading:!1,trailing:!0})}),_classPrivateFieldInitSpec(this,ne,{writable:!0,value:vi=>{var bi;(bi=vi.target)!==null&&bi!==void 0&&bi.closest(`[data-${d$h}="true"]`)||this.drawingWidgets.forEach(_i=>{this.drawingWidgets.delete(_i),this.uiManager.removeWidget(_i)})}}),_defineProperty(this,"onMousemove",vi=>{const bi=this.getPageNumberByEventTarget(vi.target);if(!bi||vi.altKey)return;const[_i,$i]=this.getPoint(vi,bi);if(this.cursorPageNumber=bi,_classPrivateMethodGet(this,Z$2,Ne$1).call(this),_classPrivateFieldGet(this,ee).call(this),_classPrivateMethodGet(this,te,Be$1).call(this),this.session&&!this.isMissMove(this.session.triggeredBy.event,vi))if(this.session.drawing(vi),this.needTriggerDrawingStart){const Pi=[_i,$i,_i,$i].map(Ai=>Ai/this.currentAnnotLayer.pageInfo.viewport.scale);this.createAnnotationFromEvent({rect:Pi,event:vi}).then(()=>{this.drawingWidgets.forEach(Ai=>{Ai.pageNumber===bi&&Ai!==this.currentDrawing&&(this.drawingWidgets.delete(Ai),this.uiManager.removeWidget(Ai))})})}else{if(this.currentDrawing){const{outline:Pi}=this.session;this.currentDrawing.drawing(Pi[2],Pi[3],Pi[0],Pi[1])}return}_classPrivateFieldGet(this,D$4).length>0?(_classPrivateMethodGet(this,X$3,ge).call(this),_classPrivateFieldSet(this,W$4,setTimeout(()=>{_classPrivateMethodGet(this,Y$3,he).call(this,_i,$i)},100))):_classPrivateMethodGet(this,Y$3,he).call(this,_i,$i)}),_classPrivateFieldInitSpec(this,$$2,{writable:!0,value:vi=>{this.session&&this.onMousemove(vi)}}),_classPrivateFieldInitSpec(this,O$2,{writable:!0,value:throttle_1(({clientY:vi})=>{if(!this.session)return;const bi=this.container.querySelector('[data-id="viewerContainer"]'),_i=this.container.querySelector('[data-id="viewer"]');if(!bi||!_i||!(_i.offsetHeight>bi.clientHeight))return;if(!this.session.state.prevMousePos){this.session.state.prevMousePos={clientY:vi};return}const{top:$i}=bi.getBoundingClientRect(),Pi=vi-$i;if(Pi<=0)return;let Ai=18;const Si=vi-this.session.state.prevMousePos.clientY,Ei=1;if(Math.abs(Si)<=Ei)return;this.session.state.prevMousePos={clientY:vi};const wi=80,Ci=20;let ki=!1;if(Si>0){if(bi.clientHeight-Pi>wi)return;const xi=_i.offsetHeight-bi.clientHeight-bi.scrollTop;if(xi<=0)return;Ai=Math.min(xi,Ai),ki=bi.clientHeight-Piwi)return;const xi=bi.scrollTop;if(xi<=0)return;Ai=Math.min(xi,Ai)*-1,ki=Pi{_classPrivateFieldGet(this,O$2).call(this,{clientY:vi.clientY})}}),_classPrivateFieldInitSpec(this,G$2,{writable:!0,value:async vi=>{if(!this.canHandleEvent(vi))return;const{shiftKey:bi}=vi;document.body.style.userSelect="none",!(bi&&this.updateDrawingWidgets(vi))&&(_classPrivateFieldGet(this,ne).call(this,vi),await this.onMousedown(vi))}})}function me(){return this.container.querySelector('[data-id="viewerContainer"]')}function ve(){return this.session?this.getLayer(this.session.pageNumber):this.getLayer(this.cursorPageNumber)}function xe$1(){this.removeLineBreak=!1}async function Pe$1(yi){const{mouseBehaviorConfig:vi}=this.app;let bi,_i;if(vi.thriceClick===o$d.SelectElement?bi=_classPrivateMethodGet(this,R$4,le).bind(this):bi=_classPrivateMethodGet(this,F$2,ce).bind(this),vi.dbClick===o$d.SelectElement?_i=_classPrivateMethodGet(this,R$4,le).bind(this):_i=_classPrivateMethodGet(this,F$2,ce).bind(this),this.session.clickTimes===3||this.session.clickTimes===4){await bi(yi);return}this.session.clickTimes===2&&await _i(yi)}async function be$1(yi){const{event:vi}=yi,bi=this.getStartAt(vi,this.currentAnnotLayer.pageInfo),_i=[bi.x,bi.y,bi.x,bi.y];if(this.session.clickTimes===1)if(vi.altKey)await _classPrivateMethodGet(this,re,Le$1).call(this,_i[0],_i[1]);else{const $i=this.getPageView(this.session.pageNumber-1),Pi=await _classPrivateMethodGet(this,H$2,oe).call(this,vi,$i),Ai={pageView:$i},Si=new l$c(Pi[0],Pi[0],Ai),Ei={rect:_i,id:It$3("widget"),selection:Si,pageNumber:Si.pageNumber,subtype:E$p[E$p.SelectText]},wi=this.createWidget(Ei,$i);this.options.onWidgetCreate(wi),this.onAnnotationCreated(wi)}}function Se$1(yi){ht$1.prototype.onAnnotationCreated.call(this,yi),this.drawingWidgets.add(yi)}function _e(yi){const vi=this.currentAnnotLayer;vi.div.style.cursor=yi}function ye$1(yi,vi){const bi=Math.abs(vi.offsetX-yi.offsetX),_i=Math.abs(vi.offsetY-yi.offsetY);return bi>=0&&bi<5&&_i>=0&&_i<5}function ke$1(){if(this.session){const yi=[...this.drawingWidgets].map(vi=>vi.pageNumber);return yi.length>0&&!yi.includes(this.session.pageNumber)}return!1}function Ce$1(yi){const vi=this.getPageNumberByEventTarget(yi.target),{offsetX:bi,offsetY:_i}=yi;let $i=!1;return this.drawingWidgets.forEach(Pi=>{this.drawingWidgets.forEach(Ai=>{vi&&Ai.pageNumber===vi&&(Ai.drawing(bi,_i),$i=!0)})}),$i}async function Te$1(){var yi;(yi=this.currentDrawing)!==null&&yi!==void 0&&yi.text&&this.eventBus.dispatch(Z$d,this.currentDrawing),await ht$1.prototype.drawingEnd.call(this)}function Ie$1(){var yi;this.container.addEventListener("mousedown",_classPrivateFieldGet(this,G$2)),this.container.addEventListener("mousemove",this.onMousemove),this.container.addEventListener("mousemove",_classPrivateFieldGet(this,z$3)),(yi=this.viewContainer)===null||yi===void 0||yi.addEventListener("wheel",_classPrivateFieldGet(this,$$2))}function Ee$1(){var yi;this.container.removeEventListener("mousedown",_classPrivateFieldGet(this,G$2)),this.container.removeEventListener("mousemove",this.onMousemove),this.container.removeEventListener("mousemove",_classPrivateFieldGet(this,z$3)),(yi=this.viewContainer)===null||yi===void 0||yi.removeEventListener("wheel",_classPrivateFieldGet(this,$$2))}function We$1(){ht$1.prototype.destroy.call(this),_classPrivateMethodGet(this,X$3,ge).call(this),this.clearDrawingWidgets()}let Me$1=class extends ht$1{constructor(...vi){return super(...vi),we.call(this,vi)}get viewContainer(){return me.call(this)}get currentAnnotLayer(){return ve.call(this)}reset(){return xe$1.call(this)}async handleMultipleClick(vi){return Pe$1.call(this,vi)}async createAnnotationFromEvent(vi){return be$1.call(this,vi)}onAnnotationCreated(vi){return Se$1.call(this,vi)}setSvgCursor(vi){return _e.call(this,vi)}isMissMove(vi,bi){return ye$1.call(this,vi,bi)}get needTriggerDrawingStart(){return ke$1.call(this)}updateDrawingWidgets(vi){return Ce$1.call(this,vi)}async drawingEnd(){return Te$1.call(this)}bindEvent(){return Ie$1.call(this)}unbindEvent(){return Ee$1.call(this)}destroy(){return We$1.call(this)}};function Ne$1(){if(this.session){const[yi,vi]=[this.session.beginPageNumber,this.session.pageNumber].sort((bi,_i)=>bi-_i);this.drawingWidgets.forEach(bi=>{(bi.pageNumbervi)&&(this.uiManager.removeWidget(bi),this.drawingWidgets.delete(bi))})}}function Be$1(){if(this.session){const yi=[...this.drawingWidgets].find(vi=>vi.pageNumber===this.session.pageNumber);yi&&this.currentDrawing&&yi!==this.currentDrawing&&(this.currentDrawing=yi)}}async function Ae$1(yi,vi){await _classPrivateFieldGet(this,Q$3).call(this,this.session.pageNumber,yi,vi),this.removeLineBreak=!0}async function De$1(yi){const vi=new J$8;for await(const bi of yi){const _i=await _classPrivateMethodGet(this,ae,Ve$1).call(this,bi[0].page+1,bi);_i&&vi.addSelection(_i)}await vi.trimSelections(),await _classPrivateFieldGet(this,M$4).call(this,vi)}async function Ve$1(yi,vi){const bi=this.getPageView(yi-1),_i=F$l(vi[0].table).split("_")[0],$i=vi.find(xi=>xi.cell.startsWith("0")&&xi.table.cells[xi.cell].text!==""),Pi=vi.slice().reverse().find(xi=>xi.cell.startsWith(_i)&&xi.table.cells[xi.cell].text!==""),Ai=$i.outline[0]+($i.outline[2]-$i.outline[0])/2,Si=$i.outline[1]+($i.outline[3]-$i.outline[1])/2,[Ei]=await bi.pdfPage.getElementBlockIndexesByPoint(Ai,Si),[,wi]=await bi.pdfPage.getElementBlockIndexesByPoint(Pi.outline[2],Pi.outline[3]),Ci={pageView:bi},ki=new l$c(Ei,wi,Ci);return ki.point=[Ai,Si],ki}async function Le$1(yi,vi){await _classPrivateFieldGet(this,J$2).call(this,this.session.pageNumber,yi,vi),this.removeLineBreak=!0}async function oe(yi,vi,bi=10,_i=10){let[$i,Pi]=this.getPoint(yi,vi.pdfPage.pageNumber);const Ai=await vi.pdfPage.selectTextService.getOriginalPageInfo(vi.pdfPage.pageNumber);return[$i,Pi]=vi.pdfPage.selectTextService.convertToPDFPoint($i,Pi,Ai),vi.pdfPage.getNearPointExactIndexes($i,Pi,bi,_i)}async function ce(yi){const vi=this.getStartAt(yi,this.currentAnnotLayer.pageInfo),bi=[vi.x,vi.y,vi.x,vi.y],_i=this.getPageView(this.session.pageNumber-1),$i=await _classPrivateMethodGet(this,H$2,oe).call(this,yi,_i),Pi={pageView:_i},[Ai,Si]=await _i.pdfPage.selectTextService.getExpandWord({pageIndex:this.session.pageNumber-1,startIndex:$i[0]}),Ei=new l$c(Ai,Si,Pi),wi={rect:bi,id:It$3("widget"),selection:Ei,pageNumber:Ei.pageNumber,subtype:E$p[E$p.SelectText]},Ci=this.createWidget(wi,_i);this.options.onWidgetCreate(Ci),this.onAnnotationCreated(Ci),this.stopDrawing()}async function le(yi){var vi;const bi=this.getStartAt(yi,this.currentAnnotLayer.pageInfo),_i=[bi.x,bi.y,bi.x,bi.y],{pageNumber:$i}=this.session,Pi=await this.app.getElementByRect($i,_i);if(x$m(Pi)&&this.app.mouseBehaviorConfig.dbClickOnCell===o$d.SelectTable){const Ai=await this.app.getTableCellsByClickedCell(Pi);await _classPrivateMethodGet(this,ie,De$1).call(this,Ai)}else await _classPrivateMethodGet(this,se,Ae$1).call(this,_i[0],_i[1]);await((vi=this.currentDrawing)===null||vi===void 0?void 0:vi.handleDrawEnd()),this.currentDrawing=null}async function he(yi,vi){const{pageNumber:bi,pageInfo:_i}=this.currentAnnotLayer,$i=this.getPageView(bi-1),Pi=await $i.pdfPage.selectTextService.convertToPdfRectangle([yi-10,vi-10,yi+10,vi+10],_i),Ai=await $i.pdfPage.selectTextService.getTextInRect(Pi,bi-1);Ai.length>0?this.setSvgCursor("text"):this.setSvgCursor("unset"),_classPrivateFieldSet(this,D$4,Ai)}function ge(){_classPrivateFieldGet(this,W$4)&&clearTimeout(_classPrivateFieldGet(this,W$4))}const T$2=_$o.PDF_VIEWER_EDIT_TEXT_RECT_ID;var v$3=new WeakMap,g$5=new WeakMap,l$4=new WeakMap,m$7=new WeakSet,h$4=new WeakMap;function k$6(yi){_classPrivateMethodInitSpec(this,m$7),_defineProperty(this,"cursorPageNumber",null),_classPrivateFieldInitSpec(this,v$3,{writable:!0,value:async vi=>{var bi;if(!this.currentDrawing)return;const[_i,$i]=this.getPoint(vi,this.currentDrawing.pageNumber),Pi=[_i,$i].map(Si=>Si/this.currentAnnotLayer.pageInfo.viewport.scale),{rect:Ai}=this.currentDrawing.data;Xt$2(Pi,[Ai])&&((bi=this.textDiffUIService)===null||bi===void 0||bi.handleEditText(this.currentDrawing,Pi))}}),_classPrivateFieldInitSpec(this,g$5,{writable:!0,value:async vi=>{var bi;const _i=this.cursorPageNumber,[$i,Pi]=this.getPoint(vi,_i),Ai=[$i,Pi].map(wi=>wi/this.currentAnnotLayer.pageInfo.viewport.scale),Si=await this.getPageView(_i-1).pdfPage.getElementBlockIndexesByPoint(Ai[0],Ai[1]),Ei=await((bi=this.textDiffUIService)===null||bi===void 0?void 0:bi.identifyText(_i,Si,T$2));Ei&&this.onAnnotationCreated(Ei)}}),_classPrivateFieldInitSpec(this,l$4,{writable:!0,value:throttle_1(vi=>{if(this.isTriggeredInPage(vi)){const bi=this.getPageNumberByEventTarget(vi.target);this.cursorPageNumber=bi,_classPrivateFieldGet(this,g$5).call(this,vi),_classPrivateMethodGet(this,m$7,H$1).call(this,vi)}},60,{leading:!0,trailing:!1})}),_classPrivateFieldInitSpec(this,h$4,{writable:!0,value:vi=>{var bi;(bi=this.textDiffUIService)===null||bi===void 0||bi.cancelHighlightMarks(),this.isTriggeredInPage(vi)&&_classPrivateFieldGet(this,v$3).call(this,vi)}}),this.textDiffUIService=yi.textDiffUIService}function E$6(){return this.getLayer(this.cursorPageNumber)}function S$6(){this.container.addEventListener("mousemove",_classPrivateFieldGet(this,l$4)),this.container.addEventListener("click",_classPrivateFieldGet(this,h$4))}function b$4(){this.container.removeEventListener("mousemove",_classPrivateFieldGet(this,l$4)),this.container.removeEventListener("click",_classPrivateFieldGet(this,h$4))}function U$2(){var yi,vi;ht$1.prototype.destroy.call(this),(yi=this.textDiffUIService)===null||yi===void 0||yi.destroyEditingTextAnnot(),(vi=this.textDiffUIService)===null||vi===void 0||vi.hiddenTextInputWidget(!0)}let M$3=class extends ht$1{constructor(vi){return super(vi),k$6.call(this,vi)}get currentAnnotLayer(){return E$6.call(this)}bindEvent(){return S$6.call(this)}unbindEvent(){return b$4.call(this)}destroy(){return U$2.call(this)}};function H$1(yi){var vi;const{offsetX:bi,offsetY:_i}=yi,$i=[bi,_i].map(Pi=>Pi/this.currentAnnotLayer.pageInfo.viewport.scale);(vi=this.textDiffUIService)===null||vi===void 0||vi.checkHighlightMark(this.cursorPageNumber,$i)}var a$1=new WeakMap;function E$5(yi){_classPrivateFieldInitSpec(this,a$1,{writable:!0,value:async()=>{await this.drawingEnd()}}),_defineProperty(this,"onClick",async vi=>{var bi,_i;if(!this.canHandleEvent(vi)||vi.altKey)return;if(!this.currentDrawing){var $i;if(!this.isTriggeredInPage(vi))return;this.prepareSession(vi),document.addEventListener("dblclick",_classPrivateFieldGet(this,a$1),{once:!0}),await this.createAnnotationFromEvent(this.getData(vi)),($i=this.session)===null||$i===void 0||$i.resolveData();return}const[Pi,Ai]=this.getPoint(vi,((bi=this.session)===null||bi===void 0?void 0:bi.pageNumber)||0);if(((_i=this.session)===null||_i===void 0?void 0:_i.pageNumber)===this.currentDrawing.pageNumber){if(this.parentAnnotType===E$p[E$p.Polygon]){const[Si,Ei]=this.currentDrawing.vertices[0],wi=K$a/2,Ci=[Si-wi,Ei-wi,Si+wi,Ei+wi];Vt$2(Ci,[Pi,Ai])?this.currentDrawing.canClose&&(document.removeEventListener("dblclick",_classPrivateFieldGet(this,a$1)),await this.drawingEnd()):this.currentDrawing.addVertex(Pi,Ai);return}this.currentDrawing.addVertex(Pi,Ai)}}),_defineProperty(this,"onMousedown2",vi=>{vi.button===2&&this.currentDrawing&&(this.currentDrawing.undoVertex(),document.addEventListener("contextmenu",bi=>{bi.preventDefault()},{once:!0}))})}function P$4(){this.container.addEventListener("mousedown",this.onClick),this.container.addEventListener("mousemove",this.onMousemove),this.container.addEventListener("mousedown",this.onMousedown2)}function y$5(){this.container.removeEventListener("mousedown",this.onClick),this.container.removeEventListener("mousemove",this.onMousemove),this.container.removeEventListener("mousedown",this.onMousedown2)}let D$3=class extends ht$1{constructor(...vi){return super(...vi),E$5.call(this,vi)}bindEvent(){return P$4.call(this)}unbindEvent(){return y$5.call(this)}};function d$3(){_defineProperty(this,"widgets",new Map),_defineProperty(this,"widgetsOfPage",new Map)}function g$4(yi,vi){this.widgetsOfPage.has(yi.pageNumber)||this.widgetsOfPage.set(yi.pageNumber,new Map),this.widgetsOfPage.get(yi.pageNumber).set(yi.id,yi),this.widgets.set(yi.id,yi)}function o$1(yi){return this.widgets.get(yi)}function h$3(yi){const vi=this.get(yi.id);vi&&(this.widgets.delete(yi.id),this.widgetsOfPage.get(yi.pageNumber).delete(yi.id),vi.destroy())}function u$3(yi){const vi=this.getWidgetsByPage(yi);if(vi.length){const bi=vi.map(_i=>_i.zIndex);return Math.max(...bi)}return 0}function c$5(yi){const vi=this.widgetsOfPage.get(yi);return vi?[...vi.values()]:[]}function l$3(yi){const vi=this.getWidgetsByPage(yi);if(vi.length){var bi;vi.sort(($i,Pi)=>$i.zIndex-Pi.zIndex);const _i=vi.map($i=>$i.dom);(bi=vi[0].dom.parentElement)===null||bi===void 0||bi.append(..._i)}}function f$7(){this.widgets.clear(),this.widgetsOfPage.clear()}let m$6=class{constructor(){return d$3.call(this)}add(vi,bi=!0){return g$4.call(this,vi,bi)}get(vi){return o$1.call(this,vi)}remove(vi){return h$3.call(this,vi)}getMaxZIndex(vi){return u$3.call(this,vi)}getWidgetsByPage(vi){return c$5.call(this,vi)}sortedWidgetDom(vi){return l$3.call(this,vi)}destroy(){return f$7.call(this)}};var p$3=new WeakMap,c$4=new WeakMap,m$5=new WeakMap,r$4=new WeakMap,_$5=new WeakSet,w$3=new WeakSet,l$2=new WeakMap;function F$1(yi){_classPrivateMethodInitSpec(this,w$3),_classPrivateMethodInitSpec(this,_$5),_classPrivateFieldInitSpec(this,p$3,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,c$4,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,m$5,{writable:!0,value:new Set}),_defineProperty(this,"eventBus",new h$g),_defineProperty(this,"widgetManager",new m$6),_classPrivateFieldInitSpec(this,r$4,{writable:!0,value:void 0}),_defineProperty(this,"widgetToolbars",new Map),_defineProperty(this,"getPageView",vi=>this.app.pages[vi]),_defineProperty(this,"getPageLayer",vi=>{const bi=this.getPageView(vi-1);return bi==null?void 0:bi.annotationLayer}),_defineProperty(this,"onWidgetCreate",vi=>{vi.handleDrawStart(),this.eventBus.dispatch(J$h,vi)}),_defineProperty(this,"onWidgetDrawing",(vi,bi,_i,$i)=>{var Pi;(Pi=_classPrivateFieldGet(this,r$4).currentDrawing)===null||Pi===void 0||Pi.drawing(vi,bi,_i,$i)}),_defineProperty(this,"onWidgetDrawEnd",vi=>{vi.handleDrawEnd(),this.eventBus.dispatch(Q$d,vi)}),_classPrivateFieldInitSpec(this,l$2,{writable:!0,value:{isCursorWidget:()=>this.drawingWidgets.size===1&&Array.from(this.drawingWidgets)[0].isCursor,getSortedWidgets:()=>this.drawingWidgets.size?_classPrivateFieldGet(this,l$2).isCursorWidget()?[]:[...this.drawingWidgets].sort((vi,bi)=>vi.pageNumber-bi.pageNumber):[...this.app.getFocusAnnotation()].filter(vi=>vi.widget).sort((vi,bi)=>vi.pageNumber-bi.pageNumber).map(vi=>vi.widget),forEachSelectedWidgets:vi=>{_classPrivateFieldGet(this,l$2).getSortedWidgets().forEach(vi)},mapSelectedWidgets:vi=>_classPrivateFieldGet(this,l$2).getSortedWidgets().map(vi),batchOperation:vi=>{const bi=[];_classPrivateFieldGet(this,l$2).forEachSelectedWidgets(_i=>{const $i=vi(_i),Pi=this.getPageView($i.pageNumber-1),Ai=a$2($i.subtype,{data:$i,pdfPage:Pi.pdfPage,getPageInfo:()=>Pi.annotationLayer.pageInfo,annotationService:this.app.annotationService,zIndex:this.widgetManager.getMaxZIndex($i.pageNumber)+1});this.onWidgetCreate(Ai),Ai.handleDrawEnd(),bi.push(Ai)}),bi.length===1?this.eventBus.dispatch(Q$d,bi[0]):this.eventBus.dispatch(ee$5,bi)}}}),this.app=yi.app,this.rootEle=this.app.appConfig.appContainer,_classPrivateMethodGet(this,_$5,M$2).call(this)}function L$3(){if(_classPrivateFieldGet(this,r$4)instanceof Me$1){var yi;return(yi=_classPrivateFieldGet(this,r$4))===null||yi===void 0?void 0:yi.drawingWidgets}return new Set([])}function O$1(){return _classPrivateFieldGet(this,c$4)===E$p[E$p.SelectText]}function V$1(){return _classPrivateFieldGet(this,l$2).getSortedWidgets()}function R$3(yi,vi){_classPrivateFieldGet(this,p$3)!==yi&&(_classPrivateFieldSet(this,p$3,yi),this.parentAnnotType=vi)}function z$2(yi){var vi;if(_classPrivateFieldGet(this,c$4)!==yi)if(_classPrivateFieldGet(this,c$4)!==E$p[E$p.Null]&&((vi=_classPrivateFieldGet(this,r$4))===null||vi===void 0||vi.destroy()),[_classPrivateFieldGet(this,c$4),yi].includes(E$p[E$p.TextDiff])&&this.cancelFocusAnnots(),_classPrivateFieldSet(this,c$4,yi),yi!==E$p[E$p.Null]&&_classPrivateMethodGet(this,w$3,_t).call(this),_classPrivateFieldGet(this,c$4)===E$p[E$p.TextDiff]){var bi;(bi=this.app.textDiffExtension)===null||bi===void 0||bi.activate()}else{var _i;(_i=this.app.popupListExtension)===null||_i===void 0||_i.activate()}}function j$1(){return _classPrivateFieldGet(this,c$4)}function X$2(){return _classPrivateFieldGet(this,p$3)}function Z$1(yi){var vi;const bi=yi;if(!(bi!=null&&bi.closest(".annotation-canvas")))return null;const _i=bi==null||(vi=bi.closest)===null||vi===void 0?void 0:vi.call(bi,".page"),$i=_i==null?void 0:_i.dataset.pageNumber;return $i?Number($i):null}function q$1(){return _classPrivateFieldGet(this,r$4).currentAnnotLayer}function J$1(){_classPrivateFieldGet(this,r$4).stopDrawing()}async function K$1(yi){let vi=!1;return vi=await yi.validate(),vi}function Q$2(yi){const vi=bi=>bi.genHighligtDatas(yi);_classPrivateFieldGet(this,l$2).batchOperation(vi),this.isSelectTextMode&&_classPrivateFieldGet(this,r$4).clearDrawingWidgets()}function Y$2(yi){_classPrivateFieldGet(this,l$2).forEachSelectedWidgets(yi)}function $$1(){const yi=vi=>vi.genUnderlineDatas();_classPrivateFieldGet(this,l$2).batchOperation(yi),this.isSelectTextMode&&_classPrivateFieldGet(this,r$4).clearDrawingWidgets()}function tt$2(){const yi=vi=>vi.genStrikeOutDatas();_classPrivateFieldGet(this,l$2).batchOperation(yi),this.isSelectTextMode&&_classPrivateFieldGet(this,r$4).clearDrawingWidgets()}async function et$2(){const yi=_classPrivateFieldGet(this,l$2).mapSelectedWidgets(bi=>bi.getText()),vi=(await Promise.all(yi)).filter(Boolean).join("");return _classPrivateFieldGet(this,r$4).removeLineBreak?vi.replace(/\n/g,""):vi}async function it$2(){const yi=[];_classPrivateFieldGet(this,l$2).forEachSelectedWidgets(bi=>{yi.push(bi)});const vi=await this.getSelectedText();Lt$2(vi),this.eventBus.dispatch(q$e,yi),this.isSelectTextMode&&_classPrivateFieldGet(this,r$4).clearDrawingWidgets()}function nt$2(yi){const vi=this.rootEle,bi="hidden-text-diff-annots";yi?vi.classList.add(bi):vi.classList.remove(bi)}function at$2(yi,vi){this.widgetManager.add(yi,vi)}function rt$2(yi){return this.widgetManager.get(yi)}function st$2(yi){this.getPageLayer(yi.pageNumber).renderWidget(yi),this.addWidget(yi,!1)}function ot$2(yi){for(const vi of _classPrivateFieldGet(this,m$5))vi!==yi&&(this.destroyWidgetToolbar(vi),vi.unselect());_classPrivateFieldGet(this,m$5).clear(),_classPrivateFieldGet(this,m$5).add(yi),yi.select(),yi instanceof Rt&&this.createWidgetToolbar(yi,void 0,yi.selection.size>0)}function lt$1(yi){this.destroyWidgetToolbar(yi),this.widgetManager.remove(yi)}async function dt$1(yi,vi,bi){const _i=new _$9({dataset:[["subtype",yi.data.subtype],["customType",yi.data.customType]]}),$i=vi||this.app.getToolbarOperations({subtype:this.parentAnnotType,editable:yi.editable});_i.eventBus.on("ctrlChange",Ei=>{m$b(Ei,yi,this.app)});const Pi=this.getPageLayer(yi.pageNumber),Ai=_i.render({id:yi.id,subtype:this.parentAnnotType,focus:bi},$i),Si=await yi.getToolbarPosition();_i.move(Si[1],Si[0],yi.width,yi.height),Pi.controlBarContainer.append(Ai),this.widgetToolbars.set(yi,_i)}function ct$1(yi){const vi=this.widgetToolbars.get(yi);vi&&(vi.destroy(),this.widgetToolbars.delete(yi))}function ht(yi){const vi=this.widgetToolbars.get(yi);vi&&vi.hide()}function gt(yi){const vi=this.widgetToolbars.get(yi);vi&&vi.show()}function ut$1(yi){const vi=this.widgetToolbars.get(yi);vi&&yi.getToolbarPosition().then(bi=>{vi.move(bi[1],bi[0],yi.width,yi.height)})}function ft(){this.app.getFocusAnnotation().forEach(yi=>{yi.focus=!1})}function pt(yi){var vi;this.eventBus.clear(),(vi=_classPrivateFieldGet(this,r$4))===null||vi===void 0||vi.destroy(),this.widgetManager.destroy(),_classPrivateFieldGet(this,m$5).clear(),this.widgetToolbars.clear(),_classPrivateFieldSet(this,p$3,E$p[E$p.Null]),_classPrivateFieldSet(this,c$4,E$p[E$p.Null]),yi&&_classPrivateMethodGet(this,_$5,M$2).call(this)}function mt(){this.reset(!1)}class vt{constructor(vi){return F$1.call(this,vi)}get drawingWidgets(){return L$3.call(this)}get isSelectTextMode(){return O$1.call(this)}get sortedSelectedWidget(){return V$1.call(this)}setCurrentAnnotType(vi,bi){return R$3.call(this,vi,bi)}set parentAnnotType(vi){return z$2.call(this,vi)}get parentAnnotType(){return j$1.call(this)}get currentAnnotType(){return X$2.call(this)}getPageNumberByEventTarget(vi){return Z$1.call(this,vi)}get currentAnnotLayer(){return q$1.call(this)}stopDrawing(){return J$1.call(this)}async validWiget(vi){return K$1.call(this,vi)}highlightText(vi="Highlight"){return Q$2.call(this,vi)}forEachTextWidget(vi){return Y$2.call(this,vi)}underline(){return $$1.call(this)}strikeOut(){return tt$2.call(this)}async getSelectedText(){return et$2.call(this)}async copy(){return it$2.call(this)}toggleHiddenTextDiffAnnotations(vi){return nt$2.call(this,vi)}addWidget(vi,bi=!0){return at$2.call(this,vi,bi)}getWidget(vi){return rt$2.call(this,vi)}renderWidget(vi){return st$2.call(this,vi)}selectTextAcrossPages(vi){return ot$2.call(this,vi)}removeWidget(vi){return lt$1.call(this,vi)}async createWidgetToolbar(vi,bi,_i=!0){return dt$1.call(this,vi,bi,_i)}destroyWidgetToolbar(vi){return ct$1.call(this,vi)}hideWidgetToolbar(vi){return ht.call(this,vi)}showWidgetToolbar(vi){return gt.call(this,vi)}syncToolbarPosition(vi){return ut$1.call(this,vi)}cancelFocusAnnots(){return ft.call(this)}reset(vi=!0){return pt.call(this,vi)}destroy(){return mt.call(this)}}async function M$2(){this.setCurrentAnnotType(E$p[28],E$p[28])}function _t(){var yi;const vi={container:this.rootEle,getPageView:this.getPageView,eventBus:this.eventBus,uiManager:this,onWidgetCreate:this.onWidgetCreate,onWidgetDrawing:this.onWidgetDrawing,onWidgetDrawEnd:this.onWidgetDrawEnd};switch(_classPrivateFieldGet(this,c$4)){case E$p[E$p.SelectText]:_classPrivateFieldSet(this,r$4,new Me$1(vi));break;case E$p[E$p.TextDiff]:_classPrivateFieldSet(this,r$4,new M$3({...vi,textDiffUIService:(yi=this.app.textDiffExtension)===null||yi===void 0?void 0:yi.textDiffUIService}));break;case E$p[E$p.PolyLine]:case E$p[E$p.Polygon]:_classPrivateFieldSet(this,r$4,new D$3(vi));break;default:_classPrivateFieldSet(this,r$4,new ht$1(vi))}_classPrivateFieldGet(this,r$4).bindEvent()}const PopupAnnotationElementList_svelte_svelte_type_style_lang="";function get_each_context$1(yi,vi,bi){const _i=yi.slice();return _i[35]=vi[bi],_i[36]=vi,_i[37]=bi,_i}function create_each_block$1(yi,vi){let bi,_i,$i=vi[35],Pi;const Ai=[vi[35].popupComponentProps],Si=()=>vi[23](_i,$i),Ei=()=>vi[23](null,$i);let wi={};for(let Ci=0;CiHi[35].annotId;for(let Hi=0;Hi',$i=space(),Pi=element("div"),Ai=element("div"),Si=text("共 "),wi=text(Ei),Ci=text(" 个"),ki=text(yi[0]),xi=space(),Ti=element("div"),Oi=element("button"),Oi.innerHTML='',ji=space(),Li=element("button"),Li.innerHTML='',Ii=space(),Mi=element("button"),Mi.innerHTML='',Fi=space(),Bi=element("div");for(let Hi=0;Himr.annotId===lr)}function wi(lr){return __awaiter(this,void 0,void 0,function*(){lr.pin=!0,lr.listPopupToggleCallback=mr=>__awaiter(this,void 0,void 0,function*(){if(mr){Vi(!0),bi(20,Li=lr.annotId),bi(12,_i.scrollLeft=_i.scrollWidth,_i);const vr=lr.getParentAnnotationElement();if(vr){const Yi=vr.container.getBoundingClientRect().top-navHeight-Ai.getBoundingClientRect().top;Yi<0&&bi(12,_i.scrollTop=_i.scrollTop+Yi-5,_i)}}else bi(20,Li="");yield tick(),Ri()}),lr.listPopupSetPosCallback=mr=>__awaiter(this,void 0,void 0,function*(){mr&&Bi(mr),yield tick(),Ki()}),lr.listPopupRemoveCallback=xi,Bi(lr),bi(6,ji=Object.assign(Object.assign({},ji),{[lr.annotId]:void 0})),yield tick(),lr.popupComponent=ji[lr.annotId],lr.bindComponentEvents(),Ki()})}let Ci={prev:-1,next:-1};function ki(lr){Ci={prev:-1,next:-1}}function xi(lr){return __awaiter(this,void 0,void 0,function*(){const mr=Oi.findIndex(vr=>vr.annotId===lr);mr>-1&&(Li===lr&&(bi(20,Li=""),yield tick(),Ci={prev:Math.max(0,mr-1),next:Math.min(mr,Oi.length-2)}),Oi.splice(mr,1),bi(5,Oi),Ki())})}let Ti=!1;Vi(!0);let Oi=[],ji,Li,Ii={left:0,height:0},Mi;function Fi(){var lr;const mr=_i.querySelector(".pdfViewer"),vr=Array.from(mr.querySelectorAll(".page[data-page-number]")),Yi=vr.map(tr=>tr.offsetLeft+tr.offsetWidth),nr=(lr=$i())!==null&&lr!==void 0?lr:1,ir=Yi[nr-1];bi(7,Ii={left:ir,height:mr.offsetHeight});const cr={};vr.forEach((tr,dr)=>{cr[dr]={top:tr.offsetTop,right:Yi[dr]-ir}}),Mi=cr}function Bi(lr){const mr=lr.alignAnnotPageNumber,vr=Mi[mr-1].right,Yi=lr.pagePos.top+Mi[mr-1].top;lr.setListPos({left:vr,top:Yi});const nr=Oi.findIndex(cr=>{const tr=cr.alignAnnotPageNumber,dr=cr.pagePos.top+Mi[tr-1].top;return Yilr.annotId===cr.annotId);ir>-1?ir===Oi.length-1&&nr===-1||ir===nr-1||(Oi.splice(ir,1),nr===-1?Oi.push(lr):Oi.splice(nr,0,lr),bi(5,Oi)):nr>-1?bi(5,Oi=Oi.slice(0,nr).concat(lr,Oi.slice(nr,Oi.length))):bi(5,Oi=Oi.concat(lr))}function Ri(lr){var mr,vr,Yi,nr;if(Oi.length>0){const ir=Oi.findIndex(er=>er.focus),cr=Math.max(ir,0),tr=Oi[cr],dr=tr.alignAnnotPageNumber,Ji=(mr=tr.popupComponent)===null||mr===void 0?void 0:mr.dom,sr=Ji?Ji.offsetHeight:0;let pr=Number(tr.pagePos.top)+Mi[dr-1].top;pr=Math.max(navHeight,pr);const or=[],Zi=[];Zi[cr]=pr;for(let er=0;er-1;er--){const hr=Oi[er],ur=hr.alignAnnotPageNumber,_r=Number(hr.pagePos.top)+Mi[ur-1].top,$r=or[er],Pr=(Yi=hr.popupComponent)===null||Yi===void 0?void 0:Yi.dom,Sr=Pr?Pr.offsetHeight:0;let Tr=0;er===cr-1?Tr=pr-annotationMargin-Sr:Tr=Zi[er+1]-annotationMargin-Sr;const kr=Math.min(Math.max(_r,$r),Tr);Zi[er]=kr}for(let er=cr+1;er{var ur;(!lr||lr&&lr.includes(hr))&&er.setListPos({top:Zi[hr],left:((ur=er.listPos)===null||ur===void 0?void 0:ur.left)||0})})}}function Vi(lr){if(bi(4,Ti=lr),!Ti&&Li){const mr=Oi.find(vr=>vr.annotId===Li);mr==null||mr.togglePopup(!1),bi(20,Li="")}}function Ni(){var lr;let mr=0;Ci.prev>-1?mr=Ci.prev:mr=Oi.findIndex(Yi=>Yi.annotId===Li)-1,(lr=Oi[mr])===null||lr===void 0||lr.togglePopup(!0,!0)}function Wi(){var lr;let mr=Oi.length-1;Ci.next>-1?mr=Ci.next:mr=Oi.findIndex(Yi=>Yi.annotId===Li)+1,(lr=Oi[mr])===null||lr===void 0||lr.togglePopup(!0,!0)}function zi(){const lr=Oi.findIndex(mr=>mr.annotId===Li);if(lr>-1){const mr=lr+1,vr=Oi.length-1,Yi=new Array(vr-mr+1).fill("").map((nr,ir)=>mr+ir);Ri(Yi)}else Ri()}function Di(){bi(5,Oi=[]),bi(20,Li=""),bi(6,ji={}),Mi={}}function Ui(){Hi.disconnect(),Fi(),Ri(),qi()}const Hi=new MutationObserver(lr=>{lr.forEach(mr=>{const vr=mr.target;mr.type==="attributes"&&vr.dataset.pageNumber&&Qi()})});function qi(){const lr=_i.querySelector(".pdfViewer");lr&&Hi.observe(lr,{childList:!0,subtree:!0,attributeFilter:["style"]})}const Gi=debounce_1(Fi,50,{leading:!1,trailing:!0}),Ki=debounce_1(Ri,50,{leading:!1,trailing:!0}),Qi=debounce_1(Ui,100,{leading:!1,trailing:!0});function Xi(){Vi(!0),Ki()}onMount(()=>{Fi(),qi(),window.addEventListener("resize",()=>Gi())});const rr=()=>Vi(!1);function ar(lr){binding_callbacks[lr?"unshift":"push"](()=>{Ai=lr,bi(3,Ai)})}function gr(lr,mr){binding_callbacks[lr?"unshift":"push"](()=>{ji[mr.annotId]=lr,bi(6,ji)})}function fr(lr){binding_callbacks[lr?"unshift":"push"](()=>{Pi=lr,bi(2,Pi)})}return yi.$$set=lr=>{"container"in lr&&bi(12,_i=lr.container),"getCurrentPageNumber"in lr&&bi(13,$i=lr.getCurrentPageNumber),"typeLabel"in lr&&bi(0,Si=lr.typeLabel)},yi.$$.update=()=>{yi.$$.dirty[0]&1048576&&ki()},[Si,Vi,Pi,Ai,Ti,Oi,ji,Ii,Ni,Wi,zi,Xi,_i,$i,Ei,wi,xi,Di,Ui,Ki,Li,rr,ar,gr,fr]}class PopupAnnotationElementList extends SvelteComponent{constructor(vi){super(),init(this,vi,instance$1,create_fragment$1,safe_not_equal,{container:12,getCurrentPageNumber:13,typeLabel:0,getAnnotRelatedItem:14,addAnnotRelatedItem:15,removeAnnotationElement:16,toggleVisible:1,reset:17,resetPosition:18,updateAnnotationPositionDebounce:19},null,[-1,-1])}get container(){return this.$$.ctx[12]}set container(vi){this.$$set({container:vi}),flush()}get getCurrentPageNumber(){return this.$$.ctx[13]}set getCurrentPageNumber(vi){this.$$set({getCurrentPageNumber:vi}),flush()}get typeLabel(){return this.$$.ctx[0]}set typeLabel(vi){this.$$set({typeLabel:vi}),flush()}get getAnnotRelatedItem(){return this.$$.ctx[14]}get addAnnotRelatedItem(){return this.$$.ctx[15]}get removeAnnotationElement(){return this.$$.ctx[16]}get toggleVisible(){return this.$$.ctx[1]}get reset(){return this.$$.ctx[17]}get resetPosition(){return this.$$.ctx[18]}get updateAnnotationPositionDebounce(){return this.$$.ctx[19]}}const Tabs_svelte_svelte_type_style_lang="";function get_each_context(yi,vi,bi){const _i=yi.slice();return _i[11]=vi[bi],_i[12]=vi,_i[13]=bi,_i}function create_each_block(yi){let vi,bi,_i=yi[11],$i,Pi;const Ai=[yi[11].props],Si=()=>yi[10](bi,_i),Ei=()=>yi[10](null,_i);let wi={};for(let Ci=0;Citransition_out($i[Ai],1,1,()=>{$i[Ai]=null});return{c(){vi=element("div");for(let Ai=0;Ai<$i.length;Ai+=1)$i[Ai].c();attr(vi,"class","viewer-sidebar-tabs svelte-5md6k3")},m(Ai,Si){insert(Ai,vi,Si);for(let Ei=0;Ei<$i.length;Ei+=1)$i[Ei]&&$i[Ei].m(vi,null);bi=!0},p(Ai,[Si]){if(Si&15){_i=Ai[0];let Ei;for(Ei=0;Ei<_i.length;Ei+=1){const wi=get_each_context(Ai,_i,Ei);$i[Ei]?($i[Ei].p(wi,Si),transition_in($i[Ei],1)):($i[Ei]=create_each_block(wi),$i[Ei].c(),transition_in($i[Ei],1),$i[Ei].m(vi,null))}for(group_outros(),Ei=_i.length;Ei<$i.length;Ei+=1)Pi(Ei);check_outros()}},i(Ai){if(!bi){for(let Si=0;Si<_i.length;Si+=1)transition_in($i[Si]);bi=!0}},o(Ai){$i=$i.filter(Boolean);for(let Si=0;Si<$i.length;Si+=1)transition_out($i[Si]);bi=!1},d(Ai){Ai&&detach(vi),destroy_each($i,Ai)}}}function instance(yi,vi,bi){let{items:_i=[]}=vi,{visible:$i=!0}=vi,Pi=_i.length?_i[0].key:null;function Ai(Oi){Oi!==Pi&&bi(2,Pi=Oi)}function Si(){return Pi}function Ei(){return $i}function wi(Oi){bi(1,$i=Oi)}const Ci={};function ki(Oi){return Ci[Oi]}function xi(Oi){bi(0,_i=Oi.items)}function Ti(Oi,ji){binding_callbacks[Oi?"unshift":"push"](()=>{Ci[ji.key]=Oi,bi(3,Ci)})}return yi.$$set=Oi=>{"items"in Oi&&bi(0,_i=Oi.items),"visible"in Oi&&bi(1,$i=Oi.visible)},[_i,$i,Pi,Ci,Ai,Si,Ei,wi,ki,xi,Ti]}class Tabs extends SvelteComponent{constructor(vi){super(),init(this,vi,instance,create_fragment,safe_not_equal,{items:0,visible:1,setActiveTabKey:4,getActiveTabKey:5,getVisible:6,setVisible:7,getComponentIns:8,updateProps:9})}get setActiveTabKey(){return this.$$.ctx[4]}get getActiveTabKey(){return this.$$.ctx[5]}get getVisible(){return this.$$.ctx[6]}get setVisible(){return this.$$.ctx[7]}get getComponentIns(){return this.$$.ctx[8]}get updateProps(){return this.$$.ctx[9]}}var n$1=new WeakSet;function c$3(yi){_classPrivateMethodInitSpec(this,n$1),_defineProperty(this,"tabMap",new Map),this.containerEle=yi,_classPrivateMethodGet(this,n$1,r$3).call(this)}function v$2(yi){this.tabMap.set(yi.key,yi),this.renderTabs()}function h$2(yi){var vi;return(vi=this.tabs)===null||vi===void 0?void 0:vi.getComponentIns(yi)}function b$3(yi){var vi;(vi=this.tabs)===null||vi===void 0||vi.setActiveTabKey(yi),this.visible&&requestAnimationFrame(()=>{var bi,_i;(bi=this.activeComponentIns)===null||bi===void 0||bi.toggleVisible(!0),(_i=this.activeComponentIns)===null||_i===void 0||_i.updateAnnotationPositionDebounce()})}function u$2(){var yi,vi;return(yi=this.tabs)===null||yi===void 0||(vi=yi.getActiveTabKey)===null||vi===void 0?void 0:vi.call(yi)}function m$4(){return this.getActiveTabKey()?this.getComponentIns(this.getActiveTabKey()):null}function _$4(){var yi;(yi=this.tabs)===null||yi===void 0||yi.updateProps({items:[...this.tabMap.values()]})}function p$2(){var yi;return(yi=this.tabs)===null||yi===void 0?void 0:yi.getVisible()}function g$3(yi){var vi;requestAnimationFrame(()=>{var bi;if((bi=this.activeComponentIns)===null||bi===void 0||bi.toggleVisible(yi),yi){var _i;(_i=this.activeComponentIns)===null||_i===void 0||_i.updateAnnotationPositionDebounce()}}),(vi=this.tabs)===null||vi===void 0||vi.setVisible(yi)}function f$6(yi){if(this.tabMap.clear(),document.body.contains(this.containerEle)){var vi;(vi=this.tabs)===null||vi===void 0||vi.$destroy()}this.tabs=void 0,yi&&_classPrivateMethodGet(this,n$1,r$3).call(this)}function M$1(){this.reset(!1)}let S$5=class{constructor({containerEle:vi}){return c$3.call(this,vi)}addTab(vi){return v$2.call(this,vi)}getComponentIns(vi){return h$2.call(this,vi)}setActiveTabKey(vi){return b$3.call(this,vi)}getActiveTabKey(){return u$2.call(this)}get activeComponentIns(){return m$4.call(this)}renderTabs(){return _$4.call(this)}get visible(){return p$2.call(this)}set visible(vi){return g$3.call(this,vi)}reset(vi=!0){return f$6.call(this,vi)}destroy(){return M$1.call(this)}};function r$3(){this.tabs=new Tabs({target:this.containerEle,props:{items:[]}})}const i=[E$p[E$p.SelectText],E$p[E$p.Table],E$p[E$p.Text],E$p[E$p.Ink],E$p[E$p.Square],E$p[E$p.Line],E$p[E$p.Null],E$p[E$p.TextDiff],E$p[E$p.Polygon],E$p[E$p.PolyLine]];function T$1(){return T$6?[E$p[E$p.SelectText],E$p[E$p.Null]]:i}function r$2(){const yi={};return T$6&&(yi.disableDocAnnotation=!0,yi.showAnnotationMenu=!1),D$a&&(yi.annotationMode=pdfExports.AnnotationMode.DISABLE),yi}const A$3=r$2(),f$5=T$1();var n=new WeakMap,p$1=new WeakSet,d$2=new WeakSet;function P$3(){_classPrivateMethodInitSpec(this,d$2),_classPrivateMethodInitSpec(this,p$1),_defineProperty(this,"name","FocusAnnotationExtension"),_classPrivateFieldInitSpec(this,n,{writable:!0,value:{x:0,y:0,count:0}}),_defineProperty(this,"handleAltClick",yi=>{const vi=_classPrivateMethodGet(this,p$1,S$4).call(this,yi);if(yi.altKey&&!isNil_1(vi)){const[bi,_i]=_classPrivateMethodGet(this,d$2,b$2).call(this,yi,vi);_classPrivateFieldGet(this,n).count===0&&(_classPrivateFieldGet(this,n).x=bi,_classPrivateFieldGet(this,n).y=_i);const $i=this.app.getAllAnnotationsInCoord(vi,bi,_i);if($i.length>0){if(Math.abs(_classPrivateFieldGet(this,n).x-bi)<=10&&Math.abs(_classPrivateFieldGet(this,n).y-_i)<=10){const Pi=_classPrivateFieldGet(this,n).count%$i.length,Ai=$i[Pi];Ai&&(Ai.focus=!0),_classPrivateFieldGet(this,n).count+=1}else _classPrivateFieldGet(this,n).count=0;_classPrivateFieldGet(this,n).x=bi,_classPrivateFieldGet(this,n).y=_i}}})}function A$2(yi){this.app=yi}function C$2(yi){this.app=yi}function F(){this.app.appContainer.addEventListener("click",this.handleAltClick)}function y$4(){_classPrivateFieldSet(this,n,{count:0,x:0,y:0})}function E$4(){this.app.appContainer.removeEventListener("click",this.handleAltClick)}let k$5=class{constructor(){return P$3.call(this)}install(vi){return A$2.call(this,vi)}onAppCreated(vi){return C$2.call(this,vi)}onDocCreated(){return F.call(this)}onDocClosed(){return y$4.call(this)}onDocDestroyed(){return E$4.call(this)}};function S$4(yi){const vi=yi.target.closest(".page");return Number(vi==null?void 0:vi.dataset.pageNumber)}function b$2(yi,vi){var bi;const _i=(bi=this.app.pages[vi-1])===null||bi===void 0?void 0:bi.annotationLayer;if(_i){var $i;const Pi=(($i=_i.div)===null||$i===void 0?void 0:$i.getBoundingClientRect())||{left:0,top:0},{clientX:Ai,clientY:Si}=yi,Ei=Ai-Pi.left,wi=Si-Pi.top;return[Ei,wi]}return[0,0]}function g$2(){_defineProperty(this,"name","selectText")}function x$2(){return this.app.pdfluxTransport}async function S$3(yi){return this.pdfiumTransport.getPageAngle(yi)}async function f$4(yi){const vi=yi-1,bi=this.app.pages[vi];let{width:_i,height:$i,rotation:Pi,viewport:{scale:Ai}}=bi;const Si=await this.getAngle(vi);return _i/=Ai,$i/=Ai,Pi+=Si,Pi=X$f(Pi),(Pi===90||Pi===270)&&([$i,_i]=[_i,$i]),{width:_i,height:$i,rotation:Pi,pageNumber:yi}}function m$3(yi,vi,bi){const{width:_i,height:$i,rotation:Pi,pageNumber:Ai}=bi,Si=this.app.pages[Ai-1],{viewport:{scale:Ei}}=Si;return yi/=Ei,vi/=Ei,Mt$2({width:_i,height:$i,rotation:-Pi},[yi,vi])}function _$3(yi,vi){const{width:bi,height:_i,rotation:$i,pageNumber:Pi}=vi,Ai=this.app.pages[Pi-1],{viewport:{scale:Si}}=Ai;return yi=yi.map(Ei=>(Ei=vt$3({width:bi,height:_i,rotation:$i},Ei),Ei=Ei.map(wi=>wi*Si),Ei=tt$a(Ei),Ei)),yi}function v$1(yi,vi){return vi.viewport.convertToPdfRectangle(yi)}async function y$3(yi,vi){return this.pdfiumTransport.getTextAtRect({index:vi,rect:yi})}async function I$2(yi){return this.pdfiumTransport.getCountChars(yi)}async function P$2(yi){return this.pdfiumTransport.getText(yi)}async function C$1(yi){return this.pdfiumTransport.getRects(yi)}async function R$2(yi){return this.pdfiumTransport.getExpandSentence(yi)}async function w$2(yi){return this.pdfiumTransport.selectTextInElementBlock(yi)}async function G$1(yi){return this.pdfiumTransport.getSentenceCountInText(yi)}async function A$1(yi){return this.pdfiumTransport.getIndexNearPoint(yi)}async function E$3(yi){return this.pdfiumTransport.getExpandWord(yi)}async function N$2(yi){return this.pdfiumTransport.getNeighborIndexes(yi)}async function k$4(yi){return this.pdfiumTransport.getTextInRectWithoutLineBreak(yi)}function B$2(yi){this.app=yi}function W$3(yi){this.app=yi}class O{constructor(){return g$2.call(this)}get pdfiumTransport(){return x$2.call(this)}async getAngle(vi){return S$3.call(this,vi)}async getOriginalPageInfo(vi){return f$4.call(this,vi)}convertToPDFPoint(vi,bi,_i){return m$3.call(this,vi,bi,_i)}convertToViewportRectangle(vi,bi){return _$3.call(this,vi,bi)}convertToPdfRectangle(vi,bi){return v$1.call(this,vi,bi)}async getTextInRect(vi,bi){return y$3.call(this,vi,bi)}async getCountChars(vi){return I$2.call(this,vi)}async getText(vi){return P$2.call(this,vi)}async getRects(vi){return C$1.call(this,vi)}async getExpandSentence(vi){return R$2.call(this,vi)}async selectTextInElementBlock(vi){return w$2.call(this,vi)}async getSentenceCountInText(vi){return G$1.call(this,vi)}async getNearPointIndexes(vi){return A$1.call(this,vi)}async getExpandWord(vi){return E$3.call(this,vi)}async getNeighborIndexes(vi){return N$2.call(this,vi)}async getTextInRectWithoutLineBreak(vi){return k$4.call(this,vi)}onAppCreated(vi){return B$2.call(this,vi)}install(vi){return W$3.call(this,vi)}}function a(yi){_defineProperty(this,"size",100),_defineProperty(this,"data",new Map),_defineProperty(this,"recentKeys",[]),this.size=yi}function h$1(yi){return this.data.get(yi)}function r$1(yi,vi){if(this.recentKeys.push(yi),this.recentKeys.length>this.size&&this.recentKeys.shift(),this.data.size===this.size){for(const[bi]of this.data)if(!this.recentKeys.includes(bi)){this.data.delete(bi);break}}this.data.set(yi,vi)}function c$2(yi){this.recentKeys=[];for(const[vi]of this.data)if(vi.startsWith(`${yi-1}_`)){this.data.delete(vi);const bi=this.recentKeys.indexOf(vi);bi>-1&&this.recentKeys.splice(bi,1)}}class o{constructor(vi=50){return a.call(this,vi)}get(vi){return h$1.call(this,vi)}set(vi,bi){return r$1.call(this,vi,bi)}removePageCache(vi){return c$2.call(this,vi)}}function ye(yi,vi){let bi;try{if(bi=new URL(yi),!bi.origin||bi.origin==="null")return!1}catch{return!1}const _i=new URL(vi,bi);return bi.origin===_i.origin}const Q$1=[new k$5,new O];var V=new WeakMap,tt$1=new WeakSet,et$1=new WeakMap,R$1=new WeakSet,nt$1=new WeakSet,it$1=new WeakSet,P$1=new WeakSet,S$2=new WeakSet,ot$1=new WeakSet,L$2=new WeakSet,rt$1=new WeakSet;function Ae(yi,vi){_classPrivateMethodInitSpec(this,rt$1),_classPrivateMethodInitSpec(this,L$2),_classPrivateMethodInitSpec(this,ot$1),_classPrivateMethodInitSpec(this,S$2),_classPrivateMethodInitSpec(this,P$1),_classPrivateMethodInitSpec(this,it$1),_classPrivateMethodInitSpec(this,nt$1),_classPrivateMethodInitSpec(this,R$1),_classPrivateMethodInitSpec(this,tt$1),_defineProperty(this,"widgetMenu",null),_defineProperty(this,"viewerReady",o$c()),_defineProperty(this,"readyPromise",this.viewerReady.promise),_defineProperty(this,"size",0),_classPrivateFieldInitSpec(this,V,{writable:!0,value:new Map}),_defineProperty(this,"customAnnotClassMap",new Map),_defineProperty(this,"customAnnotConfigMap",new Map),_defineProperty(this,"extensionsMap",new Map),_defineProperty(this,"destroyed",!1),_defineProperty(this,"imageCache",new o),_defineProperty(this,"userService",{currentUser:{author:"匿名",avatar:"",authorID:""}}),_defineProperty(this,"pdfluxTransport",null),_defineProperty(this,"renderStack",[]),_defineProperty(this,"rendering",!1),_defineProperty(this,"customOperations",{}),_defineProperty(this,"layers",null),_defineProperty(this,"mouseBehaviorConfig",{dbClick:o$d.SelectWord,thriceClick:o$d.SelectElement}),_defineProperty(this,"renderEngine",""),_classPrivateFieldInitSpec(this,et$1,{writable:!0,value:{[f$k]:bi=>{this.UIManager.removeWidget(bi)},[W$m]:bi=>{this.UIManager.hideWidgetToolbar(bi)},[G$d]:bi=>{this.UIManager.showWidgetToolbar(bi)},[y$r]:bi=>{this.UIManager.syncToolbarPosition(bi)},[j$f]:bi=>{this.eventBus.dispatch(j$f,bi)},[$$h]:bi=>{this.eventBus.dispatch($$h,bi)},[J$h]:bi=>{this.UIManager.renderWidget(bi),this.eventBus.dispatch(J$h,bi)},[q$e]:bi=>{this.eventBus.dispatch(q$e,bi)},[Z$d]:bi=>{this.eventBus.dispatch(Z$d,bi)},[X$g]:bi=>{bi.text?this.UIManager.showWidgetToolbar(bi):this.UIManager.hideWidgetToolbar(bi),this.UIManager.syncToolbarPosition(bi),this.eventBus.dispatch(X$g,bi)},[ee$5]:async bi=>{let _i=null;bi.forEach($i=>{if(!this.UIManager.validWiget($i)){this.UIManager.removeWidget($i);return}this.eventBus.dispatch(Q$d,$i),this.AppOptions.get("autoCreateAnnotation")&&(_i?this.convertWidgetToAnnotation($i,_i):_i=this.convertWidgetToAnnotation($i))})},[Q$d]:async bi=>{if(!await this.UIManager.validWiget(bi)){this.UIManager.removeWidget(bi);return}if(this.eventBus.dispatch(Q$d,bi),bi instanceof Rt){this.UIManager.selectTextAcrossPages(bi);return}this.AppOptions.get("autoCreateAnnotation")&&this.convertWidgetToAnnotation(bi)}}}),_defineProperty(this,"annotScrollIntoView",(bi,_i)=>{var $i;if((($i=_i)===null||$i===void 0?void 0:$i.block)!=="center"){bi.container.scrollIntoView(_i);return}const Pi=this.appConfig.mainContainer,Ai=bi.outline[3]-bi.outline[1];Pi.clientHeight{_classPrivateMethodGet(this,R$1,at$1).call(this,bi.widgetType)}),this.appConfig.appContainer.appendChild(this.widgetMenu.dom)),vi.userOptions.extensions?vi.userOptions.extensions.push(...Q$1):vi.userOptions.extensions=[...Q$1],vi.userOptions.extensions.forEach(bi=>{var _i;this.extensionsMap.set(bi.name,bi),(_i=bi.onAppCreated)===null||_i===void 0||_i.call(bi,this)}),this.initializedPromise.then(()=>{var bi;(bi=this.eventBus)===null||bi===void 0||bi.on("documentinit",()=>{this.viewerReady.resolve(!0),this.handleEvents(),this.extensionsMap.forEach(_i=>{var $i;($i=_i.onDocCreated)===null||$i===void 0||$i.call(_i,this)})})})}function De(){return this.renderEngine==="pdf.js"}function xe(){component_viewerExports.ViewerApplication.prototype.initFields.call(this),this.initialBookmark=null}function Te(yi){return new o$8({...JSON.parse(JSON.stringify(pick_1(yi,["rect","pageNumber","titleObj","contentsObj","authorID"]))),parentId:yi.id,parentRect:yi.rect,parentType:yi.subtype})}function Ee(yi,vi){this.UIManager.removeWidget(yi);const bi=O$8.fromWidget(this,yi.toData(),this.userService.currentUser);let _i=vi;!_i&&!bi.customType&&!O$t.includes(bi.annotationType)&&!bi.identification&&(_i=this.genPopupData(bi)),_i&&(bi.popupId=_i.id);const $i=this.pdfViewer.getPageView(yi.pageNumber-1).annotationLayer.renderAnnot(bi);if($i){const Pi=$i.data.annotationType!==E$p.SelectText;if(this.annotationManager.setData(bi,Pi,!1),this.annotationManager.setAnnot($i),_i){let Ai=!0;this.hasPopupList&&(Ai=_i.parentType===E$p[E$p.Text],this.popupListExtension.setPopupAnnotationToActive(_i.id)),this.annotationManager.setData(_i,!0,Ai)}this.eventBus.dispatch(u$i,$i)}return _i}function Ie(yi,vi){const bi=this.pdfViewer.getPageView(yi.pageNumber-1).annotationLayer.renderAnnot(yi);this.annotationManager.setData(yi,!0,!1),this.annotationManager.setAnnot(bi);let _i=!0;this.hasPopupList&&(_i=vi.parentType===E$p[E$p.Text],this.popupListExtension.setPopupAnnotationToActive(vi.id)),this.annotationManager.setData(vi,!0,_i),this.annotationManager.setFocus(bi)}function Pe(){return this.UIManager.currentAnnotType}function Se(){return this.getExtensionByName("collaboration")}function be(){return this.getExtensionByName("popupList")}function Ce(){var yi;return(yi=this.popupListExtension)===null||yi===void 0?void 0:yi.popupList}function Be(){return this.getExtensionByName("text-diff")}function Me(yi){const vi=this.getExtensionByName("selectOcrText");return vi&&vi.getPageChars(yi).length>0?vi:this.getExtensionByName("selectText")}function Oe(yi){var vi;(vi=this.textDiffExtension)===null||vi===void 0||vi.textDiffAnnotationRender.startRender(yi)}function Ve(){var yi;(yi=this.textDiffExtension)===null||yi===void 0||yi.textDiffAnnotationRender.stopRender()}function Re(yi){return this.extensionsMap.get(yi)}function Le(){return this.AppOptions.get("annotationMode")===pdfExports.AnnotationMode.DISABLE}function ke(){return this.initializedPromise.then(()=>this.pdfViewer.onePageRendered)}function Ne(){return!this.AppOptions.get("disableRange")}function We(){return this.appConfig.appContainer}function Ue(){return this.pdfluxTransport?this.pdfluxTransport.messageHandler.comObj:null}function Ge(yi){const vi=Object.create(null);return vi.zoom=`zoom=${yi},,`,new URLSearchParams(vi).toString()}function Fe(yi,vi){var bi;const _i=this.AppOptions.get("defaultScaleValue")||"auto";(bi=yi)!==null&&bi!==void 0||(yi=this.getInitialHash(_i)),component_viewerExports.ViewerApplication.prototype.setInitialView.call(this,yi,...vi)}function $e(){this.AppOptions.get("renderEngine")&&(this.renderEngine=this.AppOptions.get("renderEngine")||"pdf.js"),this.enableRangeRequest&&this.AppOptions.set("disableAutoFetch",!0);const{userOptions:yi}=this.AppOptions;yi.viewOnLoad===void 0&&this.AppOptions.set("viewOnLoad",1),yi.annotationMode===void 0&&this.AppOptions.set("annotationMode",pdfExports.AnnotationMode.ENABLE),this.savePreferenceOptions(),component_viewerExports.ViewerApplication.prototype.onCreate.call(this)}async function He(yi){await this.overrideWorkerSrc(),await component_viewerExports.ViewerApplication.prototype.initialize.call(this,yi)}function je(yi){return component_viewerExports.ViewerApplication.prototype.createSidebar.call(this,yi)}function qe(){this.renderStack=[],this.rendering=!1,this.layers=null}async function ze(){var yi;this.reset(),this.extensionsMap.forEach(vi=>{var bi;(bi=vi.onDocClosed)===null||bi===void 0||bi.call(vi)}),await((yi=this.pdfluxTransport)===null||yi===void 0?void 0:yi.destroyLibrary()),await component_viewerExports.ViewerApplication.prototype.close.call(this)}function Je(){const yi=document.body.querySelector('input[data-id="fileInput"]'),vi=this.appContainer.querySelector('[data-id="outerContainer"]'),bi=this.appContainer.querySelector('[data-id="printContainer"]');yi==null||yi.remove(),vi.remove(),bi.remove()}async function Ke(){var yi;this.destroyed=!0,(yi=this.widgetMenu)===null||yi===void 0||yi.destroy(),this.clearUnusedDoms(),this.UIManager.destroy(),this.annotationManager.destroy(),this.customAnnotClassMap.clear(),this.customOperations={},this.customAnnotConfigMap.clear(),this.sidebarManager.destroy(),await this.close(),this.extensionsMap.forEach(vi=>{var bi;(bi=vi.onAppDestroyed)===null||bi===void 0||bi.call(vi)}),this.extensionsMap.clear()}function Xe(){const yi=this.AppOptions.getAll(128),vi={};Object.keys(yi).forEach(bi=>{const _i=this.AppOptions.userOptions[bi];_i!==void 0&&(vi[bi]=_i)}),localStorage.setItem("pdfjs.preferences",JSON.stringify(vi))}function Ye(yi){if(yi!=="pdf.js"){const vi=this.AppOptions.get("PDFluxWorkerSrc"),bi=P$r(vi),_i=new message_handlerExports.MessageHandler("main","worker",bi);this.pdfluxTransport=new We$2(_i,this.AppOptions)}}async function Ze(yi,vi){return this.pdfLoadingTask&&(vi===void 0&&(vi=Object.create(null)),vi.openNewDocument=!0),component_viewerExports.ViewerApplication.prototype.open.call(this,yi,vi)}async function Qe(){const yi=[this.updateWorkerSrc("workerSrc")];this.useDefaultRenderEngine||yi.push(this.updateWorkerSrc("PDFluxWorkerSrc")),await Promise.all(yi)}async function tn(yi){const vi=this.AppOptions.get(yi);if(ye(window.location.href,vi))return;const bi=await fetch(vi);bi.ok&&this.AppOptions.set(yi,URL.createObjectURL(await bi.blob()))}async function en(yi){yi.openNewDocument&&(this.setupAdditionalComponents(!0),delete yi.openNewDocument);const vi=this.AppOptions.get("renderEngine");if(yi.createPDFPageProxy=Ce$2.bind(null,{app:this,transport:this.pdfluxTransport,renderEngine:vi}),vi!=="pdf.js"){yi.createDocumentProxy=P$o.bind(null,this.pdfluxTransport);const $i=this.AppOptions.get("rangeChunkSize");$i&&(yi.rangeChunkSize=$i,delete this.AppOptions.userOptions.rangeChunkSize)}this.enableRangeRequest&&this.AppOptions.get("disableStream")&&this.AppOptions.get("useHeadForStreamRequest")&&(yi.streamHttpMethod="HEAD"),this.AppOptions.get("enableCachePassword")&&(yi.password=a$h(this.AppOptions.get("defaultUrl"))),this.AppOptions.get("pdfBugEnabled")&&(yi.inspectFetchUrl=!0);const bi=r$d()?null:async $i=>{var Pi;return(await((Pi=this.pdfluxTransport)===null||Pi===void 0?void 0:Pi.getRange($i))).slice()},_i=pdfExports.getDocument(yi,bi);return this.pdfluxTransport&&(this.pdfluxTransport.loadingTask=_i),_i.promise.catch($i=>{throw $i}),_i}async function nn(){await component_viewerExports.ViewerApplication.prototype._initializeViewerComponents.call(this),this.setupAdditionalComponents()}function on(yi){const vi=this.AppOptions.get("renderEngine");if(vi!=="pdf.js"&&this.preparePDFluxWorker(vi),!yi)this.UIManager=new vt({app:this}),this.sidebarManager=new S$5({containerEle:this.appConfig.viewerContainer}),this.annotationManager=new j$4(this.eventBus);else{var bi;this.UIManager.reset(),this.sidebarManager.reset(),this.annotationManager.reset(),(bi=this.widgetMenu)===null||bi===void 0||bi.reset()}_classPrivateMethodGet(this,tt$1,hi).call(this)}function rn(yi){if(this.extensionsMap.has(yi.name)){console.error("this extension is installed");return}yi.install(this),this.extensionsMap.set(yi.name,yi),this.readyPromise.then(()=>{var vi;(vi=yi.onDocCreated)===null||vi===void 0||vi.call(yi,this)})}function an(yi){return new C$5(yi,this.AppOptions.get("overrideWatchScroll"))}function sn(){return this.pages.filter(yi=>yi.renderingState===RenderingStates.FINISHED)}function ln(){var yi;return((yi=this.pdfViewer)===null||yi===void 0?void 0:yi._pages)||[]}function cn(){var yi;return(yi=this.pdfLoadingTask)===null||yi===void 0?void 0:yi.docId}async function un(yi){var vi;if(!this.pdfThumbnailViewer)return null;const bi=((vi=this.pdfThumbnailViewer)===null||vi===void 0||(vi=vi._thumbnails)===null||vi===void 0?void 0:vi.find(_i=>_i.id===yi))||null;if(!bi)return null;if((bi==null?void 0:bi.renderingState)===RenderingStates.FINISHED)return{page:yi,url:bi.image.getAttribute("src")};try{const _i=await this.pdfDocument.getPage(bi.id);return bi.setPdfPage(_i),await bi.draw(),{page:yi,url:bi.image.getAttribute("src")}}catch(_i){console.error(_i)}return null}function pn(yi){this.fileName=yi,this.AppOptions.get("enableAutoUpdateTitle")&&component_viewerExports.ViewerApplication.prototype.setTitle.call(this,yi)}async function hn(){component_viewerExports.ViewerApplication.prototype.bindEvents.call(this)}function dn(yi,vi,bi){let _i;switch(yi){case E$p.Square:_i=v$l(vi);break;case E$p.Table:_i=V$c(vi);break;case E$p.SelectText:_i=qt(vi);break;case E$p.Highlight:_i=P$e(vi);break;case E$p.StrikeOut:_i=P$d(vi);break;case E$p.Underline:_i=P$c(vi);break;case E$p.Link:_i=y$a(vi);break;case E$p.Polygon:_i=W$8(vi);break;case E$p.PolyLine:_i=J$6(vi);break;default:console.error(`不被支持的"${yi}"类型`);return}bi&&_classPrivateFieldGet(this,V).set(E$p[yi],vi.customType),this.customAnnotClassMap.set(vi.customType,_i),this.customAnnotConfigMap.set(vi.customType,{...vi})}function fn(yi,vi,bi){const _i=yi;if(typeof yi=="number"&&(yi=E$p[yi]),!yi||yi===E$p[E$p.Null]||yi===E$p[E$p.Popup])throw new Error(`"${_i}" is invalid as an Annotation type`);const $i=this.customOperations[yi]||{},Pi=$i[vi]||[];Pi.push(bi),$i[vi]=Pi,this.customOperations[yi]=$i}async function gn(){return this.pdfDocument?this.AppOptions.get("renderEngine")!=="pdf.js"?this.pdfDocument.getPdfiumOutline():this.pdfDocument.getOutline():Promise.reject(new Error("Outline not ready!"))}function mn(yi){return yi.map(vi=>{var bi;return vi.subtype=E$p[vi.annotationType],this.annotationManager.setData(vi,!1),((bi=this.annotationManager.getById(vi.id))===null||bi===void 0?void 0:bi.el)||null})}function vn(yi,vi,bi,_i){var $i,Pi,Ai;const Si=this.pages[yi-1],{annotationManager:Ei}=this;if(!Si||!Ei)return;($i=this.toolbarControl)===null||$i===void 0||$i.goPageByNumber(yi);let wi=(Pi=Ei.getById(vi))===null||Pi===void 0?void 0:Pi.el;if(wi&&Si.renderingState===RenderingStates.FINISHED){this.annotScrollIntoView(wi,_i),wi.focus=bi;return}(Ai=this.eventBus)===null||Ai===void 0||Ai.on("annotationlayerrendered",()=>{var Ci;wi=(Ci=Ei.getById(vi))===null||Ci===void 0?void 0:Ci.el,wi&&(this.annotScrollIntoView(wi,_i),wi.focus=bi)},{once:!0})}function _n(yi){this.annotationManager.removeByType(yi)}function wn(yi){return this.annotationManager.remove(yi)}function yn(){this.annotationManager.removeAll()}function An(yi){return this.annotationManager.getByPage(yi).map(({el:vi})=>vi)}function Dn(yi){var vi;return((vi=this.annotationManager.getById(yi))===null||vi===void 0?void 0:vi.el)||null}function xn(yi){const vi=this.getAnnotationById(yi);vi&&(vi.zIndex=this.UIManager.widgetManager.getMaxZIndex(vi.pageNumber)+1,this.UIManager.widgetManager.sortedWidgetDom(vi.pageNumber))}function Tn(yi){const vi=this.filterAnnotation(bi=>bi.subtype===yi||bi.customType===yi);vi.map(bi=>bi.pageNumber).forEach(bi=>{const _i=this.UIManager.widgetManager.getMaxZIndex(bi)+1;vi.forEach($i=>{$i.zIndex=_i}),this.UIManager.widgetManager.sortedWidgetDom(bi)})}function En(yi){const vi=[];return this.annotationManager.forEach(({el:bi})=>{bi&&(yi?yi(bi)&&vi.push(bi):vi.push(bi))}),vi}function In(yi){const vi=E$p[yi]!==void 0;if(typeof yi=="number"&&vi&&(yi=E$p[yi]),vi){if(!f$5.includes(yi))throw new Error(`Only the following types are allowed: ${f$5.join(", ")},but "${yi}" is passed in`)}else if(!this.customAnnotClassMap.has(yi))throw new Error(`Type "${yi}" is not registered, please check`);_classPrivateMethodGet(this,R$1,at$1).call(this,yi)}function Pn(){this.pdfluxTransport&&this.pdfluxTransport.loadDocSegment()}function Sn(yi,vi){const{author:bi,avatar:_i}=vi;yi&&(_i||bi)&&this.annotationManager.forEach(({el:$i})=>{if($i&&$i.data.authorID===yi){const Ai=$i.toJSON();if(bi&&bi!==Ai.titleObj.str&&(Ai.titleObj.str=bi,this.updateAnnotations([Ai])),_i){var Pi;(Pi=$i.setAvatar)===null||Pi===void 0||Pi.call($i,_i)}}})}function bn(yi){yi.author&&(this.userService.currentUser.author=yi.author),yi.avatar&&(this.userService.currentUser.avatar=yi.avatar)}function Cn(yi){Object.assign(this.userService,yi)}function Bn(yi,vi){let bi=!!this.collabService;yi.forEach(_i=>{var $i;(!(($i=vi==null?void 0:vi.updateModificationDate)!==null&&$i!==void 0)||$i)&&(_i.modificationDate=Date.now()),_i.identification&&(bi=!1),this.annotationManager.setData(_i,bi,vi==null?void 0:vi.forceRender)})}function Mn(yi){return this.annotationManager.remove(yi)}function On(yi){return this.filterAnnotation(yi)}function Vn(){return this.filterAnnotation(yi=>yi.focus===!0)}async function Rn(yi){return this.destroyed?!1:this.pages[yi].pdfPage.isScanned()}async function Ln(yi){let vi={};this.annotationManager.forEach(({data:$i})=>{var Pi,Ai;const{id:Si,pageNumber:Ei,annotationType:wi,customType:Ci}=$i;if(Ci)return;const ki=Ei-1,xi=`page_${ki}`;vi[Si]=JSON.stringify($i),(Ai=(Pi=vi)[xi])!==null&&Ai!==void 0||(Pi[xi]={Annots:[],Type:"Page",page:ki,pageId:xi,pai_annots:[]}),k$n(wi)?vi[xi].pai_annots.push(Si):vi[xi].Annots.push(Si)}),vi=_classPrivateMethodGet(this,it$1,fi).call(this,vi);const{data:bi,pages:_i}=_classPrivateMethodGet(this,P$1,k$3).call(this,vi);await _classPrivateMethodGet(this,S$2,N$1).call(this,bi,_i,yi.fileName)}async function kn(yi,vi){const bi={};if(yi.length===0){for(let Si=0;Si{var Ai;const{page:Si,box:Ei}=Pi.boxes[0],{created_utc:wi,updated_utc:Ci,content:ki}=Pi;if(!ki.length)return;const{uname:xi,text:Ti}=ki[0],Oi=ki.slice(1),ji=`page_${Si}`,Li=Pt$3(E$p.Square),Ii=Pt$3(E$p.Popup),Mi={id:Li,popupId:Ii,rect:Ei,annotationType:E$p.Square,subtype:E$p[E$p.Square],pageNumber:Si+1,titleObj:{str:xi,dir:"ltr"},contentsObj:{str:Ti,dir:"ltr"},color:[...te$5],borderStyle:{width:1,style:1,dashArray:[]},modificationDate:Math.round(Ci*1e3),creationDate:Math.round(wi*1e3)},Fi={...Mi,id:Ii,parentId:Li,annotationType:E$p.Popup,subtype:E$p[E$p.Popup]};bi[Li]=Mi,bi[Ii]=Fi,(Ai=bi[ji])!==null&&Ai!==void 0||(bi[ji]={Annots:[],Type:"Page",page:Si,pageId:ji,pai_annots:[]}),bi[ji].Annots.push(Li),Oi.forEach(Bi=>{const Ri=Pt$3(E$p.Text),Vi={id:Ri,pageNumber:Si+1,annotationType:E$p.Text,subtype:E$p[E$p.Text],subj:"Text",name:"Comment",replyType:"R",inReplyTo:Li,rect:Ei,modificationDate:Math.round(Bi.updated_utc*1e3),creationDate:Math.round(Bi.created_utc*1e3),titleObj:{str:Bi.uname,dir:"ltr"},contentsObj:{str:Bi.text,dir:"ltr"}};bi[Ri]=Vi,bi[ji].Annots.push(Ri)})});const{data:_i,pages:$i}=_classPrivateMethodGet(this,P$1,k$3).call(this,bi);await _classPrivateMethodGet(this,S$2,N$1).call(this,_i,$i,vi.fileName)}async function Nn(yi,vi){await this.pdfluxTransport.setElementBlock({pageIndex:yi-1,outlines:vi})}async function Wn(yi,vi){await this.pdfluxTransport.setWasmConfig({[yi]:vi})}function Un(){var yi;const vi=((yi=this.collabService)===null||yi===void 0?void 0:yi.collabState.objects)||{},bi=[];return Object.values(vi).forEach(_i=>{typeof _i=="string"?bi.push(JSON.parse(_i)):bi.push(_i)}),bi}function Gn(yi,vi,bi){this.eventBus&&this.eventBus.on(yi,vi,bi)}function Fn(yi,vi){this.eventBus&&this.eventBus.off(yi,vi)}function $n(yi){this.eventBus&&this.eventBus.clear(yi)}function Hn(){return{getAnnotations:this.filterAnnotation.bind(this),updateAnnotations:this.updateAnnotations.bind(this),removeAnnotation:this.removeAnnotationById.bind(this),scrollToAnnotation:this.scrollToAnnotation.bind(this),getAnnotationById:this.getAnnotationById.bind(this),getAvatar:_classPrivateMethodGet(this,ot$1,gi).bind(this),getCurrentPageNumber:()=>this.page,copy:()=>this.UIManager.copy(),UIEventBus:this.UIManager.eventBus,APPEventBus:this.eventBus,customAnnotClassMap:this.customAnnotClassMap,customAnnotConfigMap:this.customAnnotConfigMap,textDiffExtension:this.textDiffExtension,activePopup:_classPrivateMethodGet(this,nt$1,di).bind(this),getAllCharBoxInSquare:this.getAllCharBoxInSquare.bind(this),getWidgetMaxZIndex:yi=>this.UIManager.widgetManager.getMaxZIndex(yi),getWidgetCountByPage:yi=>this.UIManager.widgetManager.getWidgetsByPage(yi).length,getAuthorInfo:()=>this.userService.currentUser}}function jn(){this.addEventListener(i$c,({data:vi,forceRender:bi})=>{if(bi){var _i;const $i=this.pages[vi.pageNumber-1];$i==null||(_i=$i.annotationLayer)===null||_i===void 0||_i.renderAnnot(vi)}}),this.addEventListener(R$l,({data:vi})=>{if(vi.annotationType===E$p.Text&&vi.inReplyTo){var bi;const $i=(bi=this.annotationManager.getById(vi.inReplyTo))===null||bi===void 0?void 0:bi.data;if($i){var _i;const Pi=(_i=this.annotationManager.getById($i.popupId||""))===null||_i===void 0?void 0:_i.el;Pi&&Pi.removeReply(vi.id)}}}),this.addEventListener(V$k,vi=>{this.annotationManager.setAnnot(vi)}),this.addEventListener(P$q,vi=>{if(!(vi.data.annotationType===E$p.Popup||vi.data.annotationType===E$p.Text&&vi.data.inReplyTo&&vi.data.replyType==="R")&&(this.annotationManager.setFocus(vi),vi.controlBar)){if(vi.isDrawing)return;const{ctrlBarPoint:bi,width:_i,height:$i}=vi;vi.controlBar.move(bi[1],bi[0],_i,$i),vi.controlBar.show()}}),this.addEventListener(g$m,vi=>{var bi;vi.isAlwaysShowControlBar||(bi=vi.controlBar)===null||bi===void 0||bi.hide()}),this.addEventListener(a$i,vi=>{if(vi.controlBar){if(vi.isDrawing)return;const{ctrlBarPoint:bi,width:_i,height:$i}=vi;vi.controlBar.move(bi[1],bi[0],_i,$i),vi.controlBar.show()}}),this.addEventListener(U$h,vi=>{var bi;vi.isAlwaysShowControlBar||(bi=vi.controlBar)===null||bi===void 0||bi.hide()}),this.addEventListener(b$l,vi=>{var bi;(bi=vi.controlBar)===null||bi===void 0||bi.destroy(),vi.widget&&this.UIManager.removeWidget(vi.widget)}),this.addEventListener(w$s,vi=>{var bi;const{ctrlBarPoint:_i,width:$i,height:Pi}=vi;(bi=vi.controlBar)===null||bi===void 0||bi.move(_i[1],_i[0],$i,Pi)}),this.addEventListener(H$g,vi=>{var bi,_i,$i;(bi=vi.controlBar)===null||bi===void 0||bi.destroy();const Pi=(_i=vi.pageNumber)!==null&&_i!==void 0?_i:vi.data.pageNumber,Ai=this.pages[Pi-1];Ai==null||($i=Ai.annotationLayer)===null||$i===void 0||$i.renderControlBar(vi)}),this.addEventListener(h$i,({event:vi,annotation:bi})=>{if(bi.data.annotationType===E$p.Table){const{target:_i}=vi;if(_i&&_i.tagName.toLowerCase()==="path"&&_i.closest(".table-line-wrapper")&&!bi.deleting&&!bi.inserting){const $i=_i.parentElement.dataset.lineDir;bi.readyMoveLine(_i,$i)}}});const yi=vi=>{if(vi.data.annotationType===E$p.SelectText)return;const bi=vi.toJSON();this.annotationManager.setData(bi,!0,!1);const _i=vi.getPopupAnnotationElement();if(_i){_i.setAlignAnnotInfo(vi,!0),_i.focusRelyEditor();const $i=JSON.parse(JSON.stringify(_i.data));$i.rect=bi.rect;const Pi=this.hasPopupList?$i.parentType===E$p[E$p.Text]:!0;this.annotationManager.setData($i,!0,Pi)}};this.addEventListener(m$v,yi),this.addEventListener(n$9,yi),this.addEventListener(A$r,yi)}async function qn(){if(!this.pdfDocument)return Promise.reject(new Error("Outline not ready!"));if(this.AppOptions.get("renderEngine")!=="pdf.js"){if(this.pdfluxTransport){const yi=await this.pdfluxTransport.getDocLayers();return isEmpty_1(yi)?null:(this.layers=yi,yi)}return null}return null}function zn(yi){this.layers=yi;const vi=this.getMountedPages()||[],bi=vi.find(_i=>_i.id===this.page);bi&&_classPrivateMethodGet(this,L$2,st$1).call(this,bi),vi.forEach(_i=>{_i.id!==this.page&&_classPrivateMethodGet(this,L$2,st$1).call(this,_i)})}function Jn(yi){this.UIManager.toggleHiddenTextDiffAnnotations(yi)}function Kn(){var yi;return(yi=this.pdfluxTransport)===null||yi===void 0?void 0:yi.getPageRotation(0)}function Xn(yi){return O$9.create(yi)}function Yn(yi,vi,bi){const _i=yi&&yi!==vi?{}:E$b[vi],$i=this.customOperations[yi||vi]||{};return mergeWith_1(_i,$i,(Pi,Ai)=>{if(Array.isArray(Pi)&&Array.isArray(Pi))return[...Pi,...Ai]}),_i?(bi||Object.keys(_i).forEach(Pi=>{_i[Pi]=_i[Pi].filter(Ai=>!["move","delete","highlight"].includes(Ai.type))}),_i):{}}function Zn(){return!!this.getExtensionByName("popupList")}async function Qn(yi){var vi,bi;await this.readyPromise;const _i=await((vi=this.pdfluxTransport)===null||vi===void 0?void 0:vi.getCountChars(yi-1));return await((bi=this.pdfluxTransport)===null||bi===void 0?void 0:bi.getText({pageIndex:yi-1,index:0,count:_i}))}async function ti(yi,vi){var bi;const _i=(bi=this.pdfViewer)===null||bi===void 0?void 0:bi.getPageView(vi-1),[$i,Pi]=yi[0],[,,Ai,Si]=yi.at(-1),[,Ei]=await this.pdfluxTransport.getIndexNearPoint({index:vi-1,x:$i+3,y:Pi+3,xTolerance:3,yTolerance:3}),[wi]=await this.pdfluxTransport.getIndexNearPoint({index:vi-1,x:Ai+3,y:Si-3,xTolerance:3,yTolerance:3});return await _i.pdfPage.getRangeText(Ei,wi-Ei)}async function ei(yi,vi,bi){if(!this.pdfluxTransport)return[];const _i=vi,[$i,Pi,Ai,Si]=_i;let Ei,wi;if(bi){const[ji,Li]=[($i+Ai)/2,(Pi+Si)/2];[Ei,wi]=await this.pdfViewer.getPageView(yi-1).pdfPage.getElementBlockIndexesByPoint(ji,Li)}else[,Ei]=await this.pdfluxTransport.getIndexNearPoint({index:yi-1,x:$i+3,y:Pi+3,xTolerance:3,yTolerance:3}),[wi]=await this.pdfluxTransport.getIndexNearPoint({index:yi-1,x:Ai-3,y:Si-3,xTolerance:3,yTolerance:3});const Ci=[],ki=[];for(;Ei<=wi;Ei+=1)Ci.push(this.pdfluxTransport.getRects({pageIndex:yi-1,index:Ei,count:1})),ki.push(this.pdfluxTransport.getText({pageIndex:yi-1,count:1,index:Ei}));const xi=await Promise.all(Ci),Ti=await Promise.all(ki),Oi=[];for(const[ji,Li]of xi.entries())if(Li.length){const Ii=Li[0],Mi=Bt$2(_i,Ii),Fi=Ti[ji];Mi&&Fi!==` `&&Oi.push({index:Oi.length,char:Fi,box:Ii})}return Oi}async function ni(yi){const{sortedSelectedWidget:vi}=this.UIManager,bi=[],_i=[];for await(const $i of vi){const Pi=await this.pdfluxTransport.getElementBlockInfos($i.pageNumber-1);bi.push(...Pi);const Ai=await this.getElementByWidget($i,yi);_i.push(...Ai)}return Q$e(_i,bi)}async function ii(yi,vi){return(await this.pdfluxTransport.getElementBlockInfos(yi-1)).find(bi=>z$g(vi,bi))}async function oi(yi){const vi=[],bi=async Ei=>await this.pdfluxTransport.getElementBlockInfos(Ei),_i=await bi(yi.page),{table:$i}=_i.find(Ei=>{var wi;return((wi=Ei.table)===null||wi===void 0?void 0:wi.index)===yi.table.index}),Pi=await E$q($i,bi.bind(this)),Ai=Pi.findIndex(Ei=>Ei===yi.table.index),Si=Pi.sort().map((Ei,wi)=>({pageIndex:yi.page+wi-Ai,tableIndex:Ei}));for await(const Ei of Si){const wi=(await bi(Ei.pageIndex)).filter(Ci=>x$m(Ci)&&Ci.table.index===Ei.tableIndex);wi.length>0&&vi.push(wi)}return vi}async function ri(yi,vi){const{pageNumber:bi,rects:_i,text:$i}=yi.toData(),Pi=await yi.getOutlinesText();let Ai=await this.pdfluxTransport.getElementBlockInfos(bi-1),Si=[];const Ei={},wi={};if(Ai.length===0)return[{text:$i,type:"SELECTION"}];Ai=J$i(Ai);for await(const[ki,xi]of _i.entries()){const Ti=Ai.find(Oi=>z$g(xi,Oi));Ti&&(x$m(Ti)?Ei[Ti.index]?Ei[Ti.index].push(Ti):Ei[Ti.index]=[Ti]:wi[Ti.index]?wi[Ti.index].push({outline:xi,text:Pi[ki]}):wi[Ti.index]=[{outline:xi,text:Pi[ki]}],Si.push(Ti))}Si=unionBy_1(Si,"index");const Ci=[];for await(const ki of Si)if(x$m(ki)){const xi=Ai.filter(ji=>ji.index===ki.index),Ti={};for await(const ji of xi){const Li=await this.pdfluxTransport.getTextInRectWithoutLineBreak({pageIndex:bi-1,rect:ji.outline});Ti[ji.cell]={text:Li}}const Oi=X$h(Ei[ki.index],ki.table,Ti,vi);Ci.push({index:ki.index,table:ki.table,rows:Oi})}else{let xi=wi[ki.index].map(Ti=>Ti.text).join(` `);vi||(xi=await this.getRangeTextByRects(wi[ki.index].map(Ti=>Ti.outline),bi)),Ci.push({...ki,selectedText:xi})}return Ci}async function ai(yi,vi){const bi=this.pages[yi-1];return bi?bi.pdfPage.getTextInRectWithoutLineBreak(yi-1,vi):""}function si(yi,vi,bi){return this.annotationManager.getByPage(yi).find(_i=>_i.el&&_i.data.annotationType!==E$p.Popup?Vt$2(_i.el.outline,[vi,bi]):!1)}async function li(yi,vi,bi,_i){const $i={acrossColumn:{beforeBlocks:[],afterBlocks:[]},acrossPage:{beforeBlocks:[],afterBlocks:[]},current:null},Pi=this.pages[yi-1];if(!(Pi!=null&&Pi.pdfPage))return $i;const{scale:Ai}=Pi.viewport;_i||(vi/=Ai,bi/=Ai);const Si=await Pi.pdfPage.getParagraphInfos();if(Si!=null&&Si.length){const Ei=Si.find(wi=>Vt$2(wi.outline,[vi,bi]));if($i.current=Ei,Ei!=null&&Ei.page_merged_paragraph){const{page_merged_paragraph:wi,index:Ci}=Ei,{paragraph_indices:ki}=wi,xi=async(Oi,ji,Li=1)=>{let Ii=(await _classPrivateMethodGet(this,rt$1,mi).call(this,Oi)).find(Mi=>Mi.index===ji);return Ii||(Ii=await xi(Oi+Li,ji,Li)),Ii},Ti=ki.findIndex(Oi=>Oi===Ci);for(const[Oi,ji]of ki.entries()){const Li=Si.find(Ii=>Ii.index===ji);if(Oi>Ti)if(Li&&Li.index>Ci)$i.acrossColumn.afterBlocks.push(Li);else{const Ii=await xi(yi+=1,ji,1);Ii&&$i.acrossPage.afterBlocks.push(Ii)}if(Oi{if(_i&&!_i.isPopup&&_i.outline){const[$i,Pi,Ai,Si]=_i.outline;return vi>=$i&&vi<=Ai&&bi>=Pi&&bi<=Si&&_i.width&&_i.height}return!1}).map(({el:_i})=>_i)}function ui(yi){this.mouseBehaviorConfig={...this.mouseBehaviorConfig,...yi}}class pi extends component_viewerExports.ViewerApplication{constructor(vi,bi){return super(vi,bi),Ae.call(this,vi,bi)}get useDefaultRenderEngine(){return De.call(this)}initFields(){return xe.call(this)}genPopupData(vi){return Te.call(this,vi)}convertWidgetToAnnotation(vi,bi=null){return Ee.call(this,vi,bi)}createAnnotationsBasedSelectionData(vi,bi){return Ie.call(this,vi,bi)}get currentAnnotType(){return Pe.call(this)}get collabService(){return Se.call(this)}get popupListExtension(){return be.call(this)}get popupAnnotationList(){return Ce.call(this)}get textDiffExtension(){return Be.call(this)}selectTextService(vi){return Me.call(this,vi)}startTextDiffAnnotRender(vi=!1){return Oe.call(this,vi)}stopTextDiffAnnotRender(){return Ve.call(this)}getExtensionByName(vi){return Re.call(this,vi)}get disableAnnotation(){return Le.call(this)}get onePageRendered(){return ke.call(this)}get enableRangeRequest(){return Ne.call(this)}get appContainer(){return We.call(this)}get pdfluxWorker(){return Ue.call(this)}getInitialHash(vi="auto"){return Ge.call(this,vi)}setInitialView(vi,...bi){return Fe.call(this,vi,bi)}onCreate(){return $e.call(this)}async initialize(vi){return He.call(this,vi)}createSidebar(vi){return je.call(this,vi)}reset(){return qe.call(this)}async close(){return ze.call(this)}clearUnusedDoms(){return Je.call(this)}async destroy(){return Ke.call(this)}savePreferenceOptions(){return Xe.call(this)}preparePDFluxWorker(vi){return Ye.call(this,vi)}async open(vi,bi){return Ze.call(this,vi,bi)}async overrideWorkerSrc(){return Qe.call(this)}async updateWorkerSrc(vi){return tn.call(this,vi)}async getDocument(vi){return en.call(this,vi)}async _initializeViewerComponents(){return nn.call(this)}setupAdditionalComponents(vi=!1){return on.call(this,vi)}installExtension(vi){return rn.call(this,vi)}createPDFViewer(vi){return an.call(this,vi)}getMountedPages(){return sn.call(this)}get pages(){return ln.call(this)}get docId(){return cn.call(this)}async getThumbnailImage(vi){return un.call(this,vi)}setTitle(vi){return pn.call(this,vi)}async bindEvents(){return hn.call(this)}registerAnnotation(vi,bi,_i=!1){return dn.call(this,vi,bi,_i)}registerAnnotationOperation(vi,bi,_i){return fn.call(this,vi,bi,_i)}async getOutline(){return gn.call(this)}insertAnnotation(vi=[]){return mn.call(this,vi)}scrollToAnnotation(vi,bi,_i=!0,$i){return vn.call(this,vi,bi,_i,$i)}removeAnnotationByType(vi){return _n.call(this,vi)}removeAnnotationById(vi){return wn.call(this,vi)}removeAllAnnotation(){return yn.call(this)}getAnnotationByPage(vi){return An.call(this,vi)}getAnnotationById(vi){return Dn.call(this,vi)}setAnnotationToFront(vi){return xn.call(this,vi)}setAnnotationToFrontViaType(vi){return Tn.call(this,vi)}filterAnnotation(vi){return En.call(this,vi)}changeAnnotationType(vi){return In.call(this,vi)}loadTextSegment(){return Pn.call(this)}changeAnnotationProps(vi,bi){return Sn.call(this,vi,bi)}changeAuthorDefaultInfo(vi){return bn.call(this,vi)}setUserService(vi){return Cn.call(this,vi)}updateAnnotations(vi,bi){return Bn.call(this,vi,bi)}removeAnnotation(vi){return Mn.call(this,vi)}getAnnotations(vi){return On.call(this,vi)}getFocusAnnotation(){return Vn.call(this)}async isScannedPage(vi){return Rn.call(this,vi)}async exportPdfFile(vi={}){return Ln.call(this,vi)}async exportPdfForCalliper(vi,bi={}){return kn.call(this,vi,bi)}async setElementBlock(vi,bi){return Nn.call(this,vi,bi)}async setWasmConfigItem(vi,bi){return Wn.call(this,vi,bi)}get collabState(){return Un.call(this)}addEventListener(vi,bi,_i){return Gn.call(this,vi,bi,_i)}removeEventListener(vi,bi){return Fn.call(this,vi,bi)}removeAllEventListener(vi){return $n.call(this,vi)}get annotationService(){return Hn.call(this)}handleEvents(){return jn.call(this)}async getLayer(){return qn.call(this)}setLayer(vi){return zn.call(this,vi)}toggleHiddenTextDiffAnnotations(vi=!0){return Jn.call(this,vi)}getPageRotation(){return Kn.call(this)}createAnnotationElement(vi){return Xn.call(this,vi)}getToolbarOperations({customType:vi,subtype:bi,editable:_i}){return Yn.call(this,vi,bi,_i)}get hasPopupList(){return Zn.call(this)}async getPageText(vi){return Qn.call(this,vi)}async getRangeTextByRects(vi,bi){return ti.call(this,vi,bi)}async getAllCharBoxInSquare(vi,bi,_i=!1){return ei.call(this,vi,bi,_i)}async getElementBySelection(vi=!0){return ni.call(this,vi)}async getElementByRect(vi,bi){return ii.call(this,vi,bi)}async getTableCellsByClickedCell(vi){return oi.call(this,vi)}async getElementByWidget(vi,bi=!0){return ri.call(this,vi,bi)}async getTextInRectWithoutLineBreak(vi,bi){return ai.call(this,vi,bi)}getAnnotationByCoord(vi,bi,_i){return si.call(this,vi,bi,_i)}async getParagraphMerged(vi,bi,_i,$i=!1){return li.call(this,vi,bi,_i,$i)}getAllAnnotationsInCoord(vi,bi,_i){return ci.call(this,vi,bi,_i)}configMouseBehavior(vi){return ui.call(this,vi)}}function hi(){Object.entries(_classPrivateFieldGet(this,et$1)).forEach(([yi,vi])=>{this.UIManager.eventBus.on(yi,vi)})}function at$1(yi){var vi,bi,_i;yi=_classPrivateFieldGet(this,V).get(yi)||yi;const $i=(vi=yi)!==null&&vi!==void 0?vi:E$p[28],Pi=(bi=this.customAnnotClassMap.get($i))===null||bi===void 0?void 0:bi.ParentType,Ai=(_i=Pi&&E$p[Pi])!==null&&_i!==void 0?_i:$i;this.UIManager.setCurrentAnnotType($i,Ai)}function di(yi){var vi;(vi=this.popupListExtension)===null||vi===void 0||vi.setPopupAnnotationToActive(yi.id)}function fi(yi){const vi=Object.keys(yi).reduce((bi,_i)=>(typeof yi[_i]=="string"?bi[_i]=JSON.parse(yi[_i]):bi[_i]=yi[_i],bi),{});return Object.values(vi).forEach(bi=>{const{id:_i,popupId:$i,rect:Pi,pageNumber:Ai}=bi,Si=$i&&vi[$i]?vi[$i].parentId:null;if(_i&&Si&&Si!==_i){const Ei=vi[Si],wi=(Ei.replyIds||[]).map(Ti=>{const Oi=vi[Ti];return Oi?{...Oi,id:Pt$3(Oi.annotationType),inReplyTo:_i,rect:[Pi[0],Pi[1],Pi[0]+p$j,Pi[1]+p$j],pageNumber:Ai}:null}).filter(Boolean),Ci=wi.map(Ti=>Ti.id);vi[_i]={...bi,contentsObj:Ei.contentsObj,replyIds:Ci},wi.forEach(Ti=>{vi[Ti.id]=Ti});const ki=`page_${Ai-1}`,xi=vi[ki];wi.length&&xi!==null&&xi!==void 0&&xi.Annots&&(vi[ki]={...xi,Annots:[...xi.Annots,...Ci]})}}),vi}function k$3(yi){const vi=Object.keys(yi),bi=[],_i=[],$i=[],Pi=[],Ai=[];return vi.forEach(Si=>{if(!Si.startsWith("page")){var Ei;const ki=typeof yi[Si]=="string"?JSON.parse(yi[Si]):yi[Si],xi=ki.pageNumber-1;(Ei=bi[xi])!==null&&Ei!==void 0||(bi[xi]=this.pdfViewer.getPageView(xi).viewport.viewBox),ki.replyType==="R"?$i.push(Si):ki.subtype==="Popup"?Pi.push(Si):Ai.push(Si);return}_i.push(Number(Si.replace("page_","")));const wi=yi[Si].Annots,Ci=wi.filter(ki=>!!yi[ki]||!ki.startsWith("ann_"));wi.length!==Ci.length&&(yi[Si].Annots=Ci,console.warn(`page ${_i.at(-1)} 出现无效的annotId: `,[[...wi],[...Ci]]))}),Ai.forEach(Si=>{const Ei=yi[Si],{pageNumber:wi,annotationType:Ci}=Ei,ki=Pt$3(Ci),xi=`page_${wi-1}`,Ti=new Set(yi[xi].Annots),Oi=new Set(yi[xi].pai_annots);Ei.id=ki,yi[ki]=Ei,Reflect.deleteProperty(yi,Si),k$n(Ci)?(Oi.add(ki),Oi.delete(Si)):(Ti.add(ki),Ti.delete(Si)),Pi.forEach((ji,Li)=>{const Ii=yi[ji];if(Ii.parentId===Si){const Mi=Pt$3(Ii.annotationType);Ii.parentId=ki,Ii.id=Mi,Ei.popupId=Mi,yi[Mi]=Ii,Reflect.deleteProperty(yi,ji),Ti.add(Mi),Ti.delete(ji),Pi.splice(Li,1,Mi)}}),$i.forEach((ji,Li)=>{const Ii=yi[ji];if(Ii.inReplyTo===Si){const Mi=Pt$3(Ii.annotationType);Ii.inReplyTo=ki,Ii.id=Mi,yi[Mi]=Ii,Reflect.deleteProperty(yi,ji),Ti.add(Mi),Ti.delete(ji),$i.splice(Li,1,Mi)}}),yi[xi].Annots=[...Ti],yi[xi].pai_annots=[...Oi]}),{data:St$4({objects:yi},bi),pages:_i}}async function N$1(yi,vi,bi){const _i=vi.map(Pi=>this.pdfluxTransport.loadPage(Pi));if(await Promise.all(_i),await this.pdfluxTransport.setAnnotations(JSON.stringify(yi))){const Pi=await this.pdfluxTransport.saveDocument(),Ai=new Blob([Pi],{type:"application/pdf"}),Si=document.createElement("a");Si.href=URL.createObjectURL(Ai),Si.download=bi||this.fileName,Si.click(),URL.revokeObjectURL(Si.href)}const $i=vi.map(Pi=>this.pdfluxTransport.cleanup(Pi));await Promise.all($i)}async function gi(yi){let vi="";return this.userService.getUserInfo&&(vi=(await this.userService.getUserInfo(yi)).avatar),vi}function st$1(yi){this.imageCache.removePageCache(yi.id);const vi=yi.canvas;yi.paintOnCanvas(vi==null?void 0:vi.parentNode).promise.then(()=>{vi==null||vi.remove()})}async function mi(yi){return(await this.pdfluxTransport.getElementBlockInfos(yi-1)).filter(vi=>vi.type.startsWith("PARAGRAPH"))}var go=pi;function E$2(yi){if(yi.get("renderEngine")==="pdfium"){if(!yi.get("PDFluxWorkerSrc"))throw new Error("PDFluxWorkerSrc is required when renderEngine is pdfium");if(yi.get("enableAutoRotateScannedPage")&&(!yi.get("apiDocId")||!yi.get("apiPrefix")))throw new Error("apiDocId and apiPrefix are required when enableAutoRotateScannedPage is true")}return!0}const k$2={disableAnnotationList:"disablePopupList"},f$3={textLayerMode:0,renderEngine:"pdfium",disableDocAnnotation:!1,disableDraggingAndDropping:!1,locale:"zh-CN",enableWordSegmentation:!0,disableCORSOriginCheck:!1,enableAutoUpdateTitle:!1,showAnnotationMenu:!1,overrideWatchScroll:!1,enableLoadLinearizedPdf:!1,enableCachePassword:!1,rangeChunkSize:65536,autoCreateAnnotation:!0,keepInvisibleText:!1,prefetchStrategy:0,useHeadForStreamRequest:!1,supportMultipleRange:!1};function D$2(yi){const vi=new component_viewerExports.GlobalAppOptions;Object.keys(yi).forEach(Ai=>{vi.set(k$2[Ai]||Ai,yi[Ai])}),Object.keys(f$3).forEach(Ai=>{yi[Ai]===void 0&&vi.set(Ai,f$3[Ai])});const bi=vi.get("showPdfSelfAnnotation");bi!==void 0&&(console.error('The option "showPdfSelfAnnotation" has been removed from standard options, please use "disableDocAnnotation" instead. You can see https://docs.pdflux.com/pdf-viewer/config/#disableDocAnnotation'),vi.set("disableDocAnnotation",!bi));let _i=new URL(window.location.origin),$i=null,Pi=vi.get("resourcePath");if(Pi){typeof Pi=="string"?(Pi.endsWith("/")||(Pi+="/"),_i=new URL(Pi,window.location.origin)):typeof Pi=="object"?(_i=new URL(Pi.resourcePath,window.location.origin),$i=Pi.resolveResourcePath):console.error("Wrong resourcePath option type, must be string or function.");let Ai,Si="assets/pdflux.wasm",Ei;$i?(Si=$i(Si),Ai=$i("assets/words.txt"),Ei=$i("worker/pdflux.worker.js")):(Si=D$q(Si,_i),Ei=D$q("worker/pdflux.worker.js",_i),Ai=D$q("../assets/words.txt",Ei));const wi=D$q("assets/pdf.js/locale/locale.properties",_i);S$r(wi);const Ci=$i||D$q,ki=Ci("worker/pdf.worker.js",_i),xi=Ci("worker/pdf.sandbox.js",_i);vi.set("workerSrc",ki),vi.set("sandboxBundleSrc",xi),vi.get("renderEngine")===f$3.renderEngine&&(vi.set("wasmPath",Si),vi.set("PDFluxWorkerSrc",Ei),vi.set("wordsFileSrc",Ai))}return vi}function W$2(yi,vi){const bi=D$2(vi);if(Object.keys(A$3).forEach(_i=>{bi.set(_i,A$3[_i])}),E$2(bi),yi){const _i=document.createElement("div");_i.innerHTML=component_viewerExports.viewerTemplate,yi.append(..._i.childNodes);const $i=component_viewerExports.getViewerConfiguration(yi);$i.eventBus=new h$g;const Pi=new go($i,bi);if(bi.get("disableViewerToolbar")){const{outerContainer:Ai}=$i.sidebar;Ai.classList.add("toolbarDisabled"),yi.insertBefore(Pi.loadingBar.bar,yi.firstElementChild)}return Pi}}function r(yi,vi,bi){_defineProperty(this,"container",null),_defineProperty(this,"position",""),this.el=yi,this.container=vi||null,bi&&(this.position=bi)}function s$1(){if(!this.el)return!1;if(!this.container)return!0;const yi=this.container.getBoundingClientRect(),vi=this.el.getBoundingClientRect();return vi.left>=yi.left&&vi.top<=yi.bottom&&vi.bottom>=yi.top}let l$1=class{constructor(vi,bi,_i){return r.call(this,vi,bi,_i)}get isVisible(){return s$1.call(this)}};const relationLine="",v=8;var f$2=new WeakMap,c$1=new WeakSet,d$1=new WeakSet;function _$2(yi,vi){_classPrivateMethodInitSpec(this,d$1),_classPrivateMethodInitSpec(this,c$1),_defineProperty(this,"start",null),_defineProperty(this,"end",null),_defineProperty(this,"customPoints",[]),_defineProperty(this,"tail",8),_defineProperty(this,"color","#1465d9"),_defineProperty(this,"width",2),_defineProperty(this,"lineStyle","solid"),_defineProperty(this,"lineDom",null),_defineProperty(this,"zIndex",99),_classPrivateFieldInitSpec(this,f$2,{writable:!0,value:[]}),this.container=yi,vi&&(this.color=vi.color,this.width=vi.width,this.lineStyle=vi.lineStyle,vi.zIndex&&(this.zIndex=vi.zIndex))}function C(yi){this.color=yi.color,this.width=yi.width,this.lineStyle=yi.lineStyle,yi.zIndex&&(this.zIndex=yi.zIndex)}function S$1(yi){var vi;this.start=new l$1(yi.el,yi.container,yi.position);const bi=yi.scrollContainer||((vi=this.start.container)===null||vi===void 0?void 0:vi.querySelector('[data-id="viewerContainer"]'));bi&&_classPrivateMethodGet(this,c$1,m$2).call(this,bi)}function b$1(yi){var vi;this.end=new l$1(yi.el,yi.container,yi.position);const bi=yi.scrollContainer||((vi=this.end.container)===null||vi===void 0?void 0:vi.querySelector('[data-id="viewerContainer"]'));bi&&_classPrivateMethodGet(this,c$1,m$2).call(this,bi)}function w$1(yi){this.customPoints=[],yi.forEach(vi=>{const bi=new l$1(vi.el,vi.container,vi.position);this.customPoints.push(bi),vi.scrollContainer&&_classPrivateMethodGet(this,c$1,m$2).call(this,vi.scrollContainer)})}function L$1(yi){switch(yi){case"start":this.start=null;break;case"end":this.end=null;break;default:this.end=null,this.start=null}}function E$1(){if(this.start&&this.end){var yi,vi;const bi=(yi=this.start.el)===null||yi===void 0?void 0:yi.getBoundingClientRect(),_i=(vi=this.end.el)===null||vi===void 0?void 0:vi.getBoundingClientRect();if(bi.bottom,_i.top,bi&&_i)return bi.bottom<_i.top}return!1}function y$2(){if(this.start&&this.end){var yi,vi;const bi=(yi=this.start.el)===null||yi===void 0?void 0:yi.getBoundingClientRect(),_i=(vi=this.end.el)===null||vi===void 0?void 0:vi.getBoundingClientRect();if(bi&&_i)return bi.top>_i.bottom}return!1}function X$1(){if(this.start){const yi=this.start.el.getBoundingClientRect(),{left:vi,top:bi,height:_i,width:$i,bottom:Pi}=yi;switch(this.start.position){case"top":return[[vi+$i/2,bi],[vi+$i/2,bi-this.tail]];case"bottom":return[[vi+$i/2,Pi],[vi+$i/2,Pi+this.tail]];case"right":return[[vi+$i,bi+_i/2]];default:const Ai=this.isLeftHigherRight?Pi:bi,Si=this.isLeftHigherRight?this.tail:-this.tail;return[[vi+$i/2,Ai],[vi+$i/2,Ai+Si]]}}return null}function Y$1(){var yi;return(yi=this.customPoints)===null||yi===void 0?void 0:yi.map(vi=>{var bi;const _i=(bi=vi.el)===null||bi===void 0?void 0:bi.getBoundingClientRect(),{left:$i,top:Pi,height:Ai,width:Si,bottom:Ei}=_i;return vi.position==="left-right"?[[$i,Pi+Ai/2],[$i+Si,Pi+Ai/2]]:[[$i,Pi+Ai/2],[$i+Si,Pi+Ai/2]]})}function k$1(){if(this.end){const yi=this.end.el.getBoundingClientRect(),{left:vi,top:bi,height:_i,width:$i,bottom:Pi}=yi;switch(this.end.position){case"top":return[[vi+$i/2,bi-this.tail],[vi+$i/2,bi]];case"bottom":return[[vi+$i/2,Pi+this.tail],[vi+$i/2,Pi]];case"left":return[[vi,bi+_i/2]];default:const Ai=this.isRightHeigherLeft?Pi:bi,Si=this.isRightHeigherLeft?this.tail:-this.tail;return[[vi+$i/2,Ai+Si],[vi+$i/2,Ai]]}}return null}function D$1(){var yi,vi;let bi=18,_i=8;if(this.start&&this.start.container){const $i=_classPrivateMethodGet(this,d$1,g$1).call(this,this.start.el);$i&&this.start.container.offsetWidth>$i.offsetWidth&&(bi=(this.start.container.offsetWidth+v-$i.offsetWidth)/2)}if(this.end&&this.end.container){const $i=_classPrivateMethodGet(this,d$1,g$1).call(this,this.end.el);$i&&this.end.container.offsetWidth>$i.offsetWidth&&(_i=(this.end.container.offsetWidth-v-$i.offsetWidth)/2)}if(this.startPointXY&&this.endPointXY&&(yi=this.start)!==null&&yi!==void 0&&yi.container&&(vi=this.end)!==null&&vi!==void 0&&vi.container){const{offsetLeft:$i}=this.container;return[[$i+this.start.container.offsetWidth-bi,this.startPointXY[this.startPointXY.length-1][1]],[$i+this.container.offsetWidth-this.end.container.offsetWidth+_i,this.endPointXY[0][1]]]}return null}function I$1(){return this.start&&this.end?this.start.isVisible&&this.end.isVisible:!1}function W$1(){if(!this.startPointXY||!this.endPointXY||!this.breakPointXY)return null;const[yi,vi]=this.breakPointXY,bi=[];return this.startPointXY.forEach(_i=>{bi.push(_i.join(","))}),bi.push(yi.join(",")),this.customPointsXY.forEach(_i=>{bi.push(_i.join(","))}),bi.push(vi.join(",")),this.endPointXY.forEach(_i=>{bi.push(_i.join(","))}),bi.join(" ")}function A(){if(!this.points)return;this.clean();const yi="http://www.w3.org/2000/svg",vi=document.createElementNS(yi,"svg");vi.setAttribute("width","100%"),vi.setAttribute("height","100%"),vi.setAttribute("data-name","line"),vi.classList.add("collection-line"),vi.setAttribute("style",`z-index: ${String(this.zIndex)}`);const bi=document.createElementNS(yi,"polyline");bi.setAttribute("stroke",this.color),bi.setAttribute("points",this.points),bi.setAttribute("stroke-width",`${this.width}`),this.lineStyle==="dash"&&bi.setAttribute("stroke-dasharray","5,5"),bi.setAttribute("fill","transparent"),bi.classList.add("path"),vi.appendChild(bi),document.body.appendChild(vi),this.lineDom=vi}function x$1(){this.lineDom&&this.points&&this.lineDom.firstElementChild&&(this.lineDom.setAttribute("style",`z-index: ${String(this.zIndex)}`),this.lineDom.firstElementChild.setAttribute("stroke",this.color),this.lineDom.firstElementChild.setAttribute("points",this.points),this.lineDom.firstElementChild.setAttribute("stroke-width",`${this.width}`),this.lineStyle==="dash"&&this.lineDom.firstElementChild.setAttribute("stroke-dasharray","5,5"))}function z$1(){this.lineDom&&(this.lineDom.remove(),this.lineDom=null)}function B$1(){_classPrivateFieldGet(this,f$2).forEach(yi=>{yi.onscroll=null})}let U$1=class{constructor(vi,bi){return _$2.call(this,vi,bi)}updateConfig(vi){return C.call(this,vi)}setStartPoint(vi){return S$1.call(this,vi)}setEndPoint(vi){return b$1.call(this,vi)}setCustomPoints(vi){return w$1.call(this,vi)}clearPoint(vi){return L$1.call(this,vi)}get isLeftHigherRight(){return E$1.call(this)}get isRightHeigherLeft(){return y$2.call(this)}get startPointXY(){return X$1.call(this)}get customPointsXY(){return Y$1.call(this)}get endPointXY(){return k$1.call(this)}get breakPointXY(){return D$1.call(this)}get isShowLine(){return I$1.call(this)}get points(){return W$1.call(this)}draw(){return A.call(this)}update(){return x$1.call(this)}clean(){return z$1.call(this)}removeScrollEventlistener(){return B$1.call(this)}};function m$2(yi){yi.onscroll=()=>{this.isShowLine?this.lineDom?this.update():this.draw():this.clean()},_classPrivateFieldGet(this,f$2).push(yi)}function g$1(yi){return yi.parentElement?yi.parentElement.classList.contains("page")?yi:_classPrivateMethodGet(this,d$1,g$1).call(this,yi.parentElement):null}const sdkPdfViewer="";function f$1(yi){const vi=[];return yi.forEach(bi=>{Object.keys(bi.boxes).forEach(_i=>{const $i=Number(_i)+1,Pi=bi.boxes[$i-1].map(Ai=>[Ai.left,Ai.top,Ai.right,Ai.bottom]);Pi.forEach(Ai=>{const Si={id:`${bi.docId}@${$i}@${bi.id}@${Ai.join("")}`,markId:bi.id,rect:Ai,rects:Pi,docId:bi.docId,annotationType:bi.type||E$p.Square,customType:bi.customType||"",pageNumber:$i,tags:bi.tags||[],titleObj:{str:"",dir:"ltr"},contentsObj:{str:"",dir:"ltr"},modificationDate:0,creationDate:new Date().toDateString(),dataset:[{key:"markId",value:bi.id}]};vi.push(Si)})})}),vi}function s(yi,vi,bi=""){let _i="",$i="";for(const Pi in yi)Object.prototype.hasOwnProperty.call(yi,Pi)&&(typeof yi[Pi]=="string"&&(Pi==="@keyframes"?$i+=yi[Pi]:bi+=`${Pi.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${yi[Pi]};`),(Pi.startsWith("[")||Pi.startsWith("::")||Pi.startsWith(":"))&&(_i+=s(yi[Pi],`${vi}${Pi}`)),typeof yi[Pi]=="object"&&(_i+=s(yi[Pi],`${vi}.${Pi}`)));return bi=`${vi}>rect {${bi}}`,bi+_i+$i}function u$1(yi,vi){const bi=document.createElement("style");bi.setAttribute("type","text/css"),s(yi,vi),bi.innerHTML=s(yi,vi),document.getElementsByTagName("head")[0].appendChild(bi)}function arrayAggregator$1(yi,vi,bi,_i){for(var $i=-1,Pi=yi==null?0:yi.length;++$i{vi.marks?yi.push(...vi.marks):yi.push(vi)}),yi}function h(){return f$1(this.marks)}function l(){return groupBy_1(this.marks,yi=>yi.docId)}function f(){return groupBy_1(this.annotations,yi=>yi.docId)}function D(){const yi={};return Object.keys(this.annotationsGroupedByDocId).forEach(vi=>{const bi=this.annotationsGroupedByDocId[vi];yi[vi]=groupBy_1(bi,_i=>_i.pageNumber)}),yi}function p(yi){const vi=this.annotationsGroupedByDocIdAndPage[yi],bi=sortBy_1(Object.keys(vi),_i=>Number(_i));return vi[bi[0]][0]}function _$1(yi,vi,bi){if(yi){if(vi){const _i=this.annotationsGroupedByDocIdAndPage[yi][vi];return _i?bi?_i.filter($i=>$i.markId===bi):_i:[]}return this.annotationsGroupedByDocId[yi]||[]}return this.annotations}function g(yi){return this.data.filter(vi=>vi.marks&&vi.marks.find(bi=>bi.id===yi))}function y$1(yi){return this.data.filter(vi=>vi.id===yi)}function m$1(yi){this.data.push(...yi)}class I{constructor(vi){return c.call(this,vi)}get marks(){return d.call(this)}get annotations(){return h.call(this)}get marksGroupedByDocId(){return l.call(this)}get annotationsGroupedByDocId(){return f.call(this)}get annotationsGroupedByDocIdAndPage(){return D.call(this)}getFirstAnnotations(vi){return p.call(this,vi)}getAnnotations(vi,bi,_i){return _$1.call(this,vi,bi,_i)}getCorrelationsByMarkId(vi){return g.call(this,vi)}getDataById(vi){return y$1.call(this,vi)}add(vi){return m$1.call(this,vi)}}const N={renderEngine:"pdfium",enableAutoUpdateTitle:!1,disableViewerToolbar:!1,locale:"zh-CN",showAnnotationMenu:!0,annotationMode:1,disableDocAnnotation:!1,textLayerMode:1,disableHistory:!1,enableXfa:!1},W={color:"blue",width:1,lineStyle:"solid"};function R(yi,vi){const bi={};return Object.keys(yi).forEach(_i=>{bi[_i]=yi[_i]}),vi.options&&Object.keys(vi.options).forEach(_i=>{bi[_i]=vi.options[_i]}),bi.defaultUrl=vi.url,bi}function j(yi,vi){vi.forEach(bi=>{bi.style&&u$1(bi.style,`.pdf-document-viewer .annotation-canvas .annotation.${bi.customType}`),yi.registerAnnotation(bi.type,{customType:bi.customType,isAlwaysShow:bi.isAlwaysShow||!1,isAlwaysShowControlBar:bi.isAlwaysShowControlBar||!1,autoFocusOnClick:bi.autoFocusOnClick||!0,autoFocusOnEnter:bi.autoFocusOnEnter||!0,isResizeEnable:bi.isResizeEnable||!1,locked:bi.locked||!1,dataset:bi.dataset||[],classNames:[...bi.classNames||[],bi.customType]})})}async function y(yi,vi,bi,_i){const $i=document.createElement("div");$i.dataset.id=String(vi.id),yi.appendChild($i);const Pi=W$2($i,R(bi,vi));return Pi&&(await Pi.readyPromise,vi.registWidgets&&j(Pi,vi.registWidgets),Pi.addEventListener("annot-click",Ai=>{_i.dispatch("annotation-click",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("annot-mouseenter",Ai=>{_i.dispatch("annotation-mouseenter",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("annot-mousedown",Ai=>{_i.dispatch("annotation-mousedown",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("annot-table-cell-active",Ai=>{_i.dispatch("annotation-table-cell-active",{data:Ai,docId:vi.id,document:vi})}),Pi.eventBus&&(Pi.addEventListener("pagechanging",Ai=>{_i.dispatch("pagechanging",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("pagerendered",Ai=>{_i.dispatch("pagerendered",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("pagerender",Ai=>{_i.dispatch("pagerender",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("pagesloaded",Ai=>{_i.dispatch("pagesloaded",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("resize",Ai=>{_i.dispatch("resize",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("pagesinit",Ai=>{_i.dispatch("pagesinit",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("documentinit",Ai=>{_i.dispatch("documentinit",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("pagenumberchanged",Ai=>{_i.dispatch("pagenumberchanged",{data:Ai,docId:vi.id,document:vi})}),Pi.addEventListener("find",Ai=>{_i.dispatch("find",{data:Ai,app:Pi})}),Pi.addEventListener("findbarclose",Ai=>{_i.dispatch("findbarclose",{data:Ai,app:Pi})}))),Pi}var u=new WeakMap,m=new WeakMap,P=new WeakSet,E=new WeakSet,b=new WeakSet,S=new WeakSet,L=new WeakSet,_=new WeakSet,w=new WeakSet;function q(yi,vi,bi){_classPrivateMethodInitSpec(this,w),_classPrivateMethodInitSpec(this,_),_classPrivateMethodInitSpec(this,L),_classPrivateMethodInitSpec(this,S),_classPrivateMethodInitSpec(this,b),_classPrivateMethodInitSpec(this,E),_classPrivateMethodInitSpec(this,P),_defineProperty(this,"el",null),_defineProperty(this,"documents",[]),_defineProperty(this,"pdfOptions",N),_defineProperty(this,"mainDocumentApp",null),_defineProperty(this,"subDocumentApps",{}),_defineProperty(this,"container",null),_defineProperty(this,"leftDocumentContainer",null),_defineProperty(this,"rightTopSlot",null),_defineProperty(this,"rightBottomSlot",null),_defineProperty(this,"centerSlot",null),_defineProperty(this,"splitDom",null),_defineProperty(this,"tabSlot",null),_defineProperty(this,"rightDocumentContainer",null),_defineProperty(this,"eventBus",new h$g),_defineProperty(this,"dataStore",null),_defineProperty(this,"relationLine",null),_classPrivateFieldInitSpec(this,u,{writable:!0,value:""}),_classPrivateFieldInitSpec(this,m,{writable:!0,value:null}),bi&&(this.pdfOptions={...this.pdfOptions,...bi}),this.documents=vi,this.dataStore=new I,_classPrivateMethodGet(this,L,ct).call(this),yi&&this.render(yi)}function B(yi){if(yi){var vi;(vi=this.splitDom)===null||vi===void 0||vi.classList.add("visible")}else{var bi;(bi=this.splitDom)===null||bi===void 0||bi.classList.remove("visible")}}function z(){return this.documents.find(yi=>yi.isMain)}function G(){return this.documents.filter(yi=>!yi.isMain)}async function H(yi){this.el=yi,_classPrivateMethodGet(this,P,dt).call(this),this.container&&yi.appendChild(this.container),await _classPrivateMethodGet(this,E,lt).call(this),this.subDocuments.length>0&&(await _classPrivateMethodGet(this,b,k).call(this,this.subDocuments[0]),_classPrivateFieldSet(this,u,this.subDocuments[0].id))}async function x(){this.destroy(),this.el&&this.render(this.el)}function U(yi){this.container&&(this.relationLine=new U$1(this.container,yi))}async function J(yi){if(_classPrivateFieldSet(this,u,yi),Object.keys(this.subDocumentApps).forEach(bi=>{var _i;const $i=(_i=this.rightDocumentContainer)===null||_i===void 0?void 0:_i.querySelector(`.pdf-document-viewer[data-id="${bi}"]`);bi!==yi?$i==null||$i.classList.add("hidden"):$i==null||$i.classList.remove("hidden")}),this.subDocumentApps[yi])return this.subDocumentApps[yi];const vi=this.documents.find(bi=>bi.id===yi&&!bi.isMain);return this.rightDocumentContainer?vi?(vi&&await _classPrivateMethodGet(this,b,k).call(this,vi),this.subDocumentApps[yi]):(console.warn("没有找到文档"),null):(console.warn("请先调用render生成右边文档容器"),null)}async function X(yi){var vi;_classPrivateFieldSet(this,m,yi);const{pages:bi,docId:_i,id:$i}=yi,Pi=bi[0]+1,Ai=await this.changeSubDocument(_i);if((vi=this.relationLine)===null||vi===void 0||vi.clean(),Ai){var Si;this.jumpToPage(Ai,Pi),Ai.removeAllAnnotation();const Ei=(Ai==null||(Si=Ai.getMountedPages())===null||Si===void 0?void 0:Si.map(wi=>wi.id))||[];if(Ei!=null&&Ei.includes(Pi)){const wi=this.dataStore.getAnnotations(_i,Pi,$i);_classPrivateMethodGet(this,w,M).call(this,wi)}}return Ai}async function Y(yi,vi){if(!yi)return null;const bi=f$1(vi),_i=sortBy_1(bi,$i=>$i.pageNumber);return yi.insertAnnotation(_i)}async function Q(yi,vi,bi){if(!yi)return null;const _i=f$1(vi),$i=sortBy_1(_i,Pi=>Pi.pageNumber);return this.jumpToPage(yi,$i[0].pageNumber),new Promise(Pi=>{setTimeout(()=>{const Ai=yi.insertAnnotation($i);Ai.length>0&&Ai[0]&&yi.scrollToAnnotation(Ai[0].pageNumber,Ai[0].id,!1,bi),Pi(Ai)},250)})}function Z(yi){if(this.rightDocumentContainer){const $i=this.rightDocumentContainer.querySelector(".pdf-document-viewer:not(.hidden)");if($i){var vi,bi,_i;const Pi=$i==null?void 0:$i.querySelector('[data-id="viewerContainer"]');(vi=this.relationLine)===null||vi===void 0||vi.setEndPoint({el:yi.container,container:$i,scrollContainer:Pi}),(bi=this.relationLine)===null||bi===void 0||bi.clean(),(_i=this.relationLine)===null||_i===void 0||_i.draw()}}}function K(yi,vi,bi){if(yi){var _i,$i,Pi;(_i=this.relationLine)===null||_i===void 0||_i.setEndPoint({el:bi,container:yi,scrollContainer:vi}),($i=this.relationLine)===null||$i===void 0||$i.clean(),(Pi=this.relationLine)===null||Pi===void 0||Pi.draw()}}function $(yi){this.dataStore?this.dataStore.data=yi:this.dataStore=new I(yi)}function tt(yi){if(this.rightDocumentContainer){var vi;if(((vi=this.rightTopSlot)===null||vi===void 0?void 0:vi.childNodes.length)>0){var bi;const _i=(bi=this.rightTopSlot)===null||bi===void 0?void 0:bi.firstChild;_i&&(_i.style.height=`${yi.y}px`)}}}function et(yi,vi){var bi;yi==null||(bi=yi.toolbarControl)===null||bi===void 0||bi.goPageByNumber(vi)}function nt(yi){this.rightTopSlot&&(this.rightTopSlot.innerHTML="",this.rightTopSlot.appendChild(yi),this.enableSplit=!0)}function it(yi){this.tabSlot&&(this.tabSlot.innerHTML="",this.tabSlot.appendChild(yi))}function ot(yi){this.centerSlot&&(this.centerSlot.innerHTML="",this.centerSlot.appendChild(yi))}function at(yi){var vi;(vi=document.querySelector(`g[data-id="${yi}"]`))===null||vi===void 0||vi.dispatchEvent(new Event("click"))}function st(){var yi;(yi=this.container)===null||yi===void 0||yi.remove(),this.destoryDocumentApps(),window.removeEventListener("click",_classPrivateMethodGet(this,S,T).bind(this))}function rt(){var yi;(yi=this.mainDocumentApp)===null||yi===void 0||yi.destroy(),this.mainDocumentApp=null,Object.keys(this.subDocumentApps).forEach(vi=>{var bi;(bi=this.subDocumentApps[vi])===null||bi===void 0||bi.destroy()}),this.subDocumentApps={},this.relationLine&&(this.relationLine.clean(),this.relationLine.removeScrollEventlistener())}class Pt{constructor({el:vi,documents:bi,options:_i}){return q.call(this,vi,bi,_i)}set enableSplit(vi){return B.call(this,vi)}get mainDocument(){return z.call(this)}get subDocuments(){return G.call(this)}async render(vi){return H.call(this,vi)}async rerender(){return x.call(this)}initRelationLine(vi=W){return U.call(this,vi)}async changeSubDocument(vi){return J.call(this,vi)}async drawSubDocumentMark(vi){return X.call(this,vi)}async drawMarks(vi,bi){return Y.call(this,vi,bi)}async drawMarksAndScrollFirstMark(vi,bi,_i={block:"center"}){return Q.call(this,vi,bi,_i)}setLineEndPointToSubDocumentAnnotation(vi){return Z.call(this,vi)}setLineEndPointToRightTop(vi,bi,_i){return K.call(this,vi,bi,_i)}setData(vi){return $.call(this,vi)}onSplitDraggend(vi){return tt.call(this,vi)}jumpToPage(vi,bi){return et.call(this,vi,bi)}setRightTopSlot(vi){return nt.call(this,vi)}setTabSlot(vi){return it.call(this,vi)}setCenterSlot(vi){return ot.call(this,vi)}clickAnnotation(vi){return at.call(this,vi)}destroy(){return st.call(this)}destoryDocumentApps(){return rt.call(this)}}function dt(){const yi=document.createElement("div");yi.classList.add("pdf-viewer-container");const vi=document.createElement("div");vi.classList.add("col","left"),this.leftDocumentContainer=vi,yi.appendChild(vi);const bi=document.createElement("slot");bi.setAttribute("name","center"),yi.appendChild(bi),this.centerSlot=bi;const _i=document.createElement("div");_i.classList.add("col"),_i.style.width="50%",yi.appendChild(_i);const $i=document.createElement("slot");$i.setAttribute("name","right-top"),_i.appendChild($i),this.rightTopSlot=$i,this.splitDom=document.createElement("div"),this.splitDom.classList.add("split-line"),this.splitDom.setAttribute("draggable","true"),this.splitDom.addEventListener("dragend",Si=>this.onSplitDraggend(Si)),_i.appendChild(this.splitDom);const Pi=document.createElement("slot");Pi.setAttribute("name","right-tab"),_i.appendChild(Pi),this.tabSlot=Pi;const Ai=document.createElement("div");Ai.classList.add("col","sub-document"),this.rightDocumentContainer=Ai,_i.appendChild(Ai),this.container=yi}async function lt(){if(this.mainDocumentApp&&this.mainDocumentApp.destroy(),!this.leftDocumentContainer)return null;const yi=this.mainDocument;if(yi){const vi=await y(this.leftDocumentContainer,yi,this.pdfOptions,this.eventBus);vi&&(this.mainDocumentApp=vi)}return this.mainDocumentApp}async function k(yi){if(!this.rightDocumentContainer)return null;const vi=await y(this.rightDocumentContainer,yi,this.pdfOptions,this.eventBus);return vi&&(this.subDocumentApps[yi.id]=vi),vi}function T(yi){var vi;function bi($i){return!$i||$i.tagName==="BODY"?!1:$i.dataset.id==="findbar"?!0:bi($i.parentElement)}if(!(((vi=yi.target)===null||vi===void 0?void 0:vi.dataset.id)==="viewFind"||bi(yi.target))){if(this.mainDocumentApp){var _i;!this.mainDocumentApp.supportsIntegratedFind&&(_i=this.mainDocumentApp.findBar)!==null&&_i!==void 0&&_i.opened&&this.mainDocumentApp.findBar.close()}Object.keys(this.subDocumentApps).forEach($i=>{var Pi;const Ai=this.subDocumentApps[$i];Ai&&!Ai.supportsIntegratedFind&&(Pi=Ai.findBar)!==null&&Pi!==void 0&&Pi.opened&&Ai.findBar.close()})}}function ct(){this.eventBus.on("annotation-click",yi=>_classPrivateMethodGet(this,_,ut).call(this,yi)),this.eventBus.on("pagerendered",yi=>{const{data:vi,docId:bi,document:_i}=yi,{pageNumber:$i}=vi;if(_i.isMain){var Pi;const Ai=this.dataStore.getAnnotations(bi,$i);(Pi=this.mainDocumentApp)===null||Pi===void 0||Pi.insertAnnotation(Ai||[])}else if(this.subDocumentApps[bi]&&_classPrivateFieldGet(this,u)===bi&&_classPrivateFieldGet(this,m)){const Ai=this.dataStore.getAnnotations(bi,$i,_classPrivateFieldGet(this,m).id);_classPrivateMethodGet(this,w,M).call(this,Ai)}}),window.addEventListener("click",_classPrivateMethodGet(this,S,T).bind(this))}function ut(yi){const{data:vi,document:bi}=yi;if(bi.isMain&&(this.relationLine&&this.relationLine.clean(),Object.keys(this.subDocumentApps).forEach($i=>{var Pi;(Pi=this.subDocumentApps[Number($i)])===null||Pi===void 0||Pi.removeAllAnnotation()}),this.relationLine&&this.leftDocumentContainer)){var _i;const $i=(_i=this.leftDocumentContainer)===null||_i===void 0?void 0:_i.querySelector('[data-id="viewerContainer"]');this.relationLine.setStartPoint({el:vi.event.target,container:this.leftDocumentContainer,scrollContainer:$i})}}function M(yi){const vi=this.subDocumentApps[_classPrivateFieldGet(this,u)],bi=(vi==null?void 0:vi.insertAnnotation(yi))||[],_i=bi[bi.length-1];_i&&(vi==null||vi.scrollToAnnotation(_i.pageNumber,_i.id,!1,{block:"center"}),this.setLineEndPointToSubDocumentAnnotation(_i))}exports.AnnotationType=E$p,exports.PdfViewerContainer=Pt,exports.createViewer=W$2,exports.ptToPx=ht$7,exports.pxToPt=mt$5,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
Enter the password to open this PDF file:
-