2
0

pdf_viewer.js 404 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/web/pdf_viewer", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/web/pdf_viewer"] = factory();
  29. else
  30. root["pdfjs-dist/web/pdf_viewer"] = root.pdfjsViewer = factory();
  31. })(this, () => {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.DefaultXfaLayerFactory = exports.DefaultTextLayerFactory = exports.DefaultStructTreeLayerFactory = exports.DefaultAnnotationLayerFactory = void 0;
  42. var _annotation_layer_builder = __w_pdfjs_require__(2);
  43. var _l10n_utils = __w_pdfjs_require__(6);
  44. var _pdf_link_service = __w_pdfjs_require__(7);
  45. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  46. var _text_layer_builder = __w_pdfjs_require__(10);
  47. var _xfa_layer_builder = __w_pdfjs_require__(11);
  48. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  49. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  50. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  51. var DefaultAnnotationLayerFactory = /*#__PURE__*/function () {
  52. function DefaultAnnotationLayerFactory() {
  53. _classCallCheck(this, DefaultAnnotationLayerFactory);
  54. }
  55. _createClass(DefaultAnnotationLayerFactory, [{
  56. key: "createAnnotationLayerBuilder",
  57. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  58. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  59. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  60. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  61. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  62. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  63. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  64. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  65. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  66. var annotationCanvasMap = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
  67. return new _annotation_layer_builder.AnnotationLayerBuilder({
  68. pageDiv: pageDiv,
  69. pdfPage: pdfPage,
  70. imageResourcesPath: imageResourcesPath,
  71. renderForms: renderForms,
  72. linkService: new _pdf_link_service.SimpleLinkService(),
  73. l10n: l10n,
  74. annotationStorage: annotationStorage,
  75. enableScripting: enableScripting,
  76. hasJSActionsPromise: hasJSActionsPromise,
  77. fieldObjectsPromise: fieldObjectsPromise,
  78. mouseState: mouseState,
  79. annotationCanvasMap: annotationCanvasMap
  80. });
  81. }
  82. }]);
  83. return DefaultAnnotationLayerFactory;
  84. }();
  85. exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;
  86. var DefaultStructTreeLayerFactory = /*#__PURE__*/function () {
  87. function DefaultStructTreeLayerFactory() {
  88. _classCallCheck(this, DefaultStructTreeLayerFactory);
  89. }
  90. _createClass(DefaultStructTreeLayerFactory, [{
  91. key: "createStructTreeLayerBuilder",
  92. value: function createStructTreeLayerBuilder(pdfPage) {
  93. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  94. pdfPage: pdfPage
  95. });
  96. }
  97. }]);
  98. return DefaultStructTreeLayerFactory;
  99. }();
  100. exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
  101. var DefaultTextLayerFactory = /*#__PURE__*/function () {
  102. function DefaultTextLayerFactory() {
  103. _classCallCheck(this, DefaultTextLayerFactory);
  104. }
  105. _createClass(DefaultTextLayerFactory, [{
  106. key: "createTextLayerBuilder",
  107. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  108. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  109. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  110. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  111. return new _text_layer_builder.TextLayerBuilder({
  112. textLayerDiv: textLayerDiv,
  113. pageIndex: pageIndex,
  114. viewport: viewport,
  115. enhanceTextSelection: enhanceTextSelection,
  116. eventBus: eventBus,
  117. highlighter: highlighter
  118. });
  119. }
  120. }]);
  121. return DefaultTextLayerFactory;
  122. }();
  123. exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
  124. var DefaultXfaLayerFactory = /*#__PURE__*/function () {
  125. function DefaultXfaLayerFactory() {
  126. _classCallCheck(this, DefaultXfaLayerFactory);
  127. }
  128. _createClass(DefaultXfaLayerFactory, [{
  129. key: "createXfaLayerBuilder",
  130. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  131. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  132. var xfaHtml = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  133. return new _xfa_layer_builder.XfaLayerBuilder({
  134. pageDiv: pageDiv,
  135. pdfPage: pdfPage,
  136. annotationStorage: annotationStorage,
  137. linkService: new _pdf_link_service.SimpleLinkService(),
  138. xfaHtml: xfaHtml
  139. });
  140. }
  141. }]);
  142. return DefaultXfaLayerFactory;
  143. }();
  144. exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;
  145. /***/ }),
  146. /* 2 */
  147. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  148. Object.defineProperty(exports, "__esModule", ({
  149. value: true
  150. }));
  151. exports.AnnotationLayerBuilder = void 0;
  152. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  153. var _pdfjsLib = __w_pdfjs_require__(5);
  154. var _l10n_utils = __w_pdfjs_require__(6);
  155. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  156. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  157. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  158. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  159. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  160. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  161. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  162. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  163. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  164. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  165. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  166. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  167. var AnnotationLayerBuilder = /*#__PURE__*/function () {
  168. function AnnotationLayerBuilder(_ref) {
  169. var pageDiv = _ref.pageDiv,
  170. pdfPage = _ref.pdfPage,
  171. linkService = _ref.linkService,
  172. downloadManager = _ref.downloadManager,
  173. _ref$annotationStorag = _ref.annotationStorage,
  174. annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
  175. _ref$imageResourcesPa = _ref.imageResourcesPath,
  176. imageResourcesPath = _ref$imageResourcesPa === void 0 ? "" : _ref$imageResourcesPa,
  177. _ref$renderForms = _ref.renderForms,
  178. renderForms = _ref$renderForms === void 0 ? true : _ref$renderForms,
  179. _ref$l10n = _ref.l10n,
  180. l10n = _ref$l10n === void 0 ? _l10n_utils.NullL10n : _ref$l10n,
  181. _ref$enableScripting = _ref.enableScripting,
  182. enableScripting = _ref$enableScripting === void 0 ? false : _ref$enableScripting,
  183. _ref$hasJSActionsProm = _ref.hasJSActionsPromise,
  184. hasJSActionsPromise = _ref$hasJSActionsProm === void 0 ? null : _ref$hasJSActionsProm,
  185. _ref$fieldObjectsProm = _ref.fieldObjectsPromise,
  186. fieldObjectsPromise = _ref$fieldObjectsProm === void 0 ? null : _ref$fieldObjectsProm,
  187. _ref$mouseState = _ref.mouseState,
  188. mouseState = _ref$mouseState === void 0 ? null : _ref$mouseState,
  189. _ref$annotationCanvas = _ref.annotationCanvasMap,
  190. annotationCanvasMap = _ref$annotationCanvas === void 0 ? null : _ref$annotationCanvas;
  191. _classCallCheck(this, AnnotationLayerBuilder);
  192. this.pageDiv = pageDiv;
  193. this.pdfPage = pdfPage;
  194. this.linkService = linkService;
  195. this.downloadManager = downloadManager;
  196. this.imageResourcesPath = imageResourcesPath;
  197. this.renderForms = renderForms;
  198. this.l10n = l10n;
  199. this.annotationStorage = annotationStorage;
  200. this.enableScripting = enableScripting;
  201. this._hasJSActionsPromise = hasJSActionsPromise;
  202. this._fieldObjectsPromise = fieldObjectsPromise;
  203. this._mouseState = mouseState;
  204. this._annotationCanvasMap = annotationCanvasMap;
  205. this.div = null;
  206. this._cancelled = false;
  207. }
  208. _createClass(AnnotationLayerBuilder, [{
  209. key: "render",
  210. value: function () {
  211. var _render = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(viewport) {
  212. var intent,
  213. _yield$Promise$all,
  214. _yield$Promise$all2,
  215. annotations,
  216. _yield$Promise$all2$,
  217. hasJSActions,
  218. _yield$Promise$all2$2,
  219. fieldObjects,
  220. parameters,
  221. _args = arguments;
  222. return _regenerator["default"].wrap(function _callee$(_context) {
  223. while (1) {
  224. switch (_context.prev = _context.next) {
  225. case 0:
  226. intent = _args.length > 1 && _args[1] !== undefined ? _args[1] : "display";
  227. _context.next = 3;
  228. return Promise.all([this.pdfPage.getAnnotations({
  229. intent: intent
  230. }), this._hasJSActionsPromise, this._fieldObjectsPromise]);
  231. case 3:
  232. _yield$Promise$all = _context.sent;
  233. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  234. annotations = _yield$Promise$all2[0];
  235. _yield$Promise$all2$ = _yield$Promise$all2[1];
  236. hasJSActions = _yield$Promise$all2$ === void 0 ? false : _yield$Promise$all2$;
  237. _yield$Promise$all2$2 = _yield$Promise$all2[2];
  238. fieldObjects = _yield$Promise$all2$2 === void 0 ? null : _yield$Promise$all2$2;
  239. if (!(this._cancelled || annotations.length === 0)) {
  240. _context.next = 12;
  241. break;
  242. }
  243. return _context.abrupt("return");
  244. case 12:
  245. parameters = {
  246. viewport: viewport.clone({
  247. dontFlip: true
  248. }),
  249. div: this.div,
  250. annotations: annotations,
  251. page: this.pdfPage,
  252. imageResourcesPath: this.imageResourcesPath,
  253. renderForms: this.renderForms,
  254. linkService: this.linkService,
  255. downloadManager: this.downloadManager,
  256. annotationStorage: this.annotationStorage,
  257. enableScripting: this.enableScripting,
  258. hasJSActions: hasJSActions,
  259. fieldObjects: fieldObjects,
  260. mouseState: this._mouseState,
  261. annotationCanvasMap: this._annotationCanvasMap
  262. };
  263. if (this.div) {
  264. _pdfjsLib.AnnotationLayer.update(parameters);
  265. } else {
  266. this.div = document.createElement("div");
  267. this.div.className = "annotationLayer";
  268. this.pageDiv.appendChild(this.div);
  269. parameters.div = this.div;
  270. _pdfjsLib.AnnotationLayer.render(parameters);
  271. this.l10n.translate(this.div);
  272. }
  273. case 14:
  274. case "end":
  275. return _context.stop();
  276. }
  277. }
  278. }, _callee, this);
  279. }));
  280. function render(_x) {
  281. return _render.apply(this, arguments);
  282. }
  283. return render;
  284. }()
  285. }, {
  286. key: "cancel",
  287. value: function cancel() {
  288. this._cancelled = true;
  289. }
  290. }, {
  291. key: "hide",
  292. value: function hide() {
  293. if (!this.div) {
  294. return;
  295. }
  296. this.div.hidden = true;
  297. }
  298. }]);
  299. return AnnotationLayerBuilder;
  300. }();
  301. exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
  302. /***/ }),
  303. /* 3 */
  304. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  305. module.exports = __w_pdfjs_require__(4);
  306. /***/ }),
  307. /* 4 */
  308. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  309. /* module decorator */ module = __w_pdfjs_require__.nmd(module);
  310. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  311. var runtime = function (exports) {
  312. "use strict";
  313. var Op = Object.prototype;
  314. var hasOwn = Op.hasOwnProperty;
  315. var undefined;
  316. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  317. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  318. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  319. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  320. function define(obj, key, value) {
  321. Object.defineProperty(obj, key, {
  322. value: value,
  323. enumerable: true,
  324. configurable: true,
  325. writable: true
  326. });
  327. return obj[key];
  328. }
  329. try {
  330. define({}, "");
  331. } catch (err) {
  332. define = function define(obj, key, value) {
  333. return obj[key] = value;
  334. };
  335. }
  336. function wrap(innerFn, outerFn, self, tryLocsList) {
  337. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  338. var generator = Object.create(protoGenerator.prototype);
  339. var context = new Context(tryLocsList || []);
  340. generator._invoke = makeInvokeMethod(innerFn, self, context);
  341. return generator;
  342. }
  343. exports.wrap = wrap;
  344. function tryCatch(fn, obj, arg) {
  345. try {
  346. return {
  347. type: "normal",
  348. arg: fn.call(obj, arg)
  349. };
  350. } catch (err) {
  351. return {
  352. type: "throw",
  353. arg: err
  354. };
  355. }
  356. }
  357. var GenStateSuspendedStart = "suspendedStart";
  358. var GenStateSuspendedYield = "suspendedYield";
  359. var GenStateExecuting = "executing";
  360. var GenStateCompleted = "completed";
  361. var ContinueSentinel = {};
  362. function Generator() {}
  363. function GeneratorFunction() {}
  364. function GeneratorFunctionPrototype() {}
  365. var IteratorPrototype = {};
  366. define(IteratorPrototype, iteratorSymbol, function () {
  367. return this;
  368. });
  369. var getProto = Object.getPrototypeOf;
  370. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  371. if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  372. IteratorPrototype = NativeIteratorPrototype;
  373. }
  374. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  375. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  376. define(Gp, "constructor", GeneratorFunctionPrototype);
  377. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  378. GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
  379. function defineIteratorMethods(prototype) {
  380. ["next", "throw", "return"].forEach(function (method) {
  381. define(prototype, method, function (arg) {
  382. return this._invoke(method, arg);
  383. });
  384. });
  385. }
  386. exports.isGeneratorFunction = function (genFun) {
  387. var ctor = typeof genFun === "function" && genFun.constructor;
  388. return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  389. };
  390. exports.mark = function (genFun) {
  391. if (Object.setPrototypeOf) {
  392. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  393. } else {
  394. genFun.__proto__ = GeneratorFunctionPrototype;
  395. define(genFun, toStringTagSymbol, "GeneratorFunction");
  396. }
  397. genFun.prototype = Object.create(Gp);
  398. return genFun;
  399. };
  400. exports.awrap = function (arg) {
  401. return {
  402. __await: arg
  403. };
  404. };
  405. function AsyncIterator(generator, PromiseImpl) {
  406. function invoke(method, arg, resolve, reject) {
  407. var record = tryCatch(generator[method], generator, arg);
  408. if (record.type === "throw") {
  409. reject(record.arg);
  410. } else {
  411. var result = record.arg;
  412. var value = result.value;
  413. if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
  414. return PromiseImpl.resolve(value.__await).then(function (value) {
  415. invoke("next", value, resolve, reject);
  416. }, function (err) {
  417. invoke("throw", err, resolve, reject);
  418. });
  419. }
  420. return PromiseImpl.resolve(value).then(function (unwrapped) {
  421. result.value = unwrapped;
  422. resolve(result);
  423. }, function (error) {
  424. return invoke("throw", error, resolve, reject);
  425. });
  426. }
  427. }
  428. var previousPromise;
  429. function enqueue(method, arg) {
  430. function callInvokeWithMethodAndArg() {
  431. return new PromiseImpl(function (resolve, reject) {
  432. invoke(method, arg, resolve, reject);
  433. });
  434. }
  435. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  436. }
  437. this._invoke = enqueue;
  438. }
  439. defineIteratorMethods(AsyncIterator.prototype);
  440. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  441. return this;
  442. });
  443. exports.AsyncIterator = AsyncIterator;
  444. exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  445. if (PromiseImpl === void 0) PromiseImpl = Promise;
  446. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  447. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  448. return result.done ? result.value : iter.next();
  449. });
  450. };
  451. function makeInvokeMethod(innerFn, self, context) {
  452. var state = GenStateSuspendedStart;
  453. return function invoke(method, arg) {
  454. if (state === GenStateExecuting) {
  455. throw new Error("Generator is already running");
  456. }
  457. if (state === GenStateCompleted) {
  458. if (method === "throw") {
  459. throw arg;
  460. }
  461. return doneResult();
  462. }
  463. context.method = method;
  464. context.arg = arg;
  465. while (true) {
  466. var delegate = context.delegate;
  467. if (delegate) {
  468. var delegateResult = maybeInvokeDelegate(delegate, context);
  469. if (delegateResult) {
  470. if (delegateResult === ContinueSentinel) continue;
  471. return delegateResult;
  472. }
  473. }
  474. if (context.method === "next") {
  475. context.sent = context._sent = context.arg;
  476. } else if (context.method === "throw") {
  477. if (state === GenStateSuspendedStart) {
  478. state = GenStateCompleted;
  479. throw context.arg;
  480. }
  481. context.dispatchException(context.arg);
  482. } else if (context.method === "return") {
  483. context.abrupt("return", context.arg);
  484. }
  485. state = GenStateExecuting;
  486. var record = tryCatch(innerFn, self, context);
  487. if (record.type === "normal") {
  488. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  489. if (record.arg === ContinueSentinel) {
  490. continue;
  491. }
  492. return {
  493. value: record.arg,
  494. done: context.done
  495. };
  496. } else if (record.type === "throw") {
  497. state = GenStateCompleted;
  498. context.method = "throw";
  499. context.arg = record.arg;
  500. }
  501. }
  502. };
  503. }
  504. function maybeInvokeDelegate(delegate, context) {
  505. var method = delegate.iterator[context.method];
  506. if (method === undefined) {
  507. context.delegate = null;
  508. if (context.method === "throw") {
  509. if (delegate.iterator["return"]) {
  510. context.method = "return";
  511. context.arg = undefined;
  512. maybeInvokeDelegate(delegate, context);
  513. if (context.method === "throw") {
  514. return ContinueSentinel;
  515. }
  516. }
  517. context.method = "throw";
  518. context.arg = new TypeError("The iterator does not provide a 'throw' method");
  519. }
  520. return ContinueSentinel;
  521. }
  522. var record = tryCatch(method, delegate.iterator, context.arg);
  523. if (record.type === "throw") {
  524. context.method = "throw";
  525. context.arg = record.arg;
  526. context.delegate = null;
  527. return ContinueSentinel;
  528. }
  529. var info = record.arg;
  530. if (!info) {
  531. context.method = "throw";
  532. context.arg = new TypeError("iterator result is not an object");
  533. context.delegate = null;
  534. return ContinueSentinel;
  535. }
  536. if (info.done) {
  537. context[delegate.resultName] = info.value;
  538. context.next = delegate.nextLoc;
  539. if (context.method !== "return") {
  540. context.method = "next";
  541. context.arg = undefined;
  542. }
  543. } else {
  544. return info;
  545. }
  546. context.delegate = null;
  547. return ContinueSentinel;
  548. }
  549. defineIteratorMethods(Gp);
  550. define(Gp, toStringTagSymbol, "Generator");
  551. define(Gp, iteratorSymbol, function () {
  552. return this;
  553. });
  554. define(Gp, "toString", function () {
  555. return "[object Generator]";
  556. });
  557. function pushTryEntry(locs) {
  558. var entry = {
  559. tryLoc: locs[0]
  560. };
  561. if (1 in locs) {
  562. entry.catchLoc = locs[1];
  563. }
  564. if (2 in locs) {
  565. entry.finallyLoc = locs[2];
  566. entry.afterLoc = locs[3];
  567. }
  568. this.tryEntries.push(entry);
  569. }
  570. function resetTryEntry(entry) {
  571. var record = entry.completion || {};
  572. record.type = "normal";
  573. delete record.arg;
  574. entry.completion = record;
  575. }
  576. function Context(tryLocsList) {
  577. this.tryEntries = [{
  578. tryLoc: "root"
  579. }];
  580. tryLocsList.forEach(pushTryEntry, this);
  581. this.reset(true);
  582. }
  583. exports.keys = function (object) {
  584. var keys = [];
  585. for (var key in object) {
  586. keys.push(key);
  587. }
  588. keys.reverse();
  589. return function next() {
  590. while (keys.length) {
  591. var key = keys.pop();
  592. if (key in object) {
  593. next.value = key;
  594. next.done = false;
  595. return next;
  596. }
  597. }
  598. next.done = true;
  599. return next;
  600. };
  601. };
  602. function values(iterable) {
  603. if (iterable) {
  604. var iteratorMethod = iterable[iteratorSymbol];
  605. if (iteratorMethod) {
  606. return iteratorMethod.call(iterable);
  607. }
  608. if (typeof iterable.next === "function") {
  609. return iterable;
  610. }
  611. if (!isNaN(iterable.length)) {
  612. var i = -1,
  613. next = function next() {
  614. while (++i < iterable.length) {
  615. if (hasOwn.call(iterable, i)) {
  616. next.value = iterable[i];
  617. next.done = false;
  618. return next;
  619. }
  620. }
  621. next.value = undefined;
  622. next.done = true;
  623. return next;
  624. };
  625. return next.next = next;
  626. }
  627. }
  628. return {
  629. next: doneResult
  630. };
  631. }
  632. exports.values = values;
  633. function doneResult() {
  634. return {
  635. value: undefined,
  636. done: true
  637. };
  638. }
  639. Context.prototype = {
  640. constructor: Context,
  641. reset: function reset(skipTempReset) {
  642. this.prev = 0;
  643. this.next = 0;
  644. this.sent = this._sent = undefined;
  645. this.done = false;
  646. this.delegate = null;
  647. this.method = "next";
  648. this.arg = undefined;
  649. this.tryEntries.forEach(resetTryEntry);
  650. if (!skipTempReset) {
  651. for (var name in this) {
  652. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  653. this[name] = undefined;
  654. }
  655. }
  656. }
  657. },
  658. stop: function stop() {
  659. this.done = true;
  660. var rootEntry = this.tryEntries[0];
  661. var rootRecord = rootEntry.completion;
  662. if (rootRecord.type === "throw") {
  663. throw rootRecord.arg;
  664. }
  665. return this.rval;
  666. },
  667. dispatchException: function dispatchException(exception) {
  668. if (this.done) {
  669. throw exception;
  670. }
  671. var context = this;
  672. function handle(loc, caught) {
  673. record.type = "throw";
  674. record.arg = exception;
  675. context.next = loc;
  676. if (caught) {
  677. context.method = "next";
  678. context.arg = undefined;
  679. }
  680. return !!caught;
  681. }
  682. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  683. var entry = this.tryEntries[i];
  684. var record = entry.completion;
  685. if (entry.tryLoc === "root") {
  686. return handle("end");
  687. }
  688. if (entry.tryLoc <= this.prev) {
  689. var hasCatch = hasOwn.call(entry, "catchLoc");
  690. var hasFinally = hasOwn.call(entry, "finallyLoc");
  691. if (hasCatch && hasFinally) {
  692. if (this.prev < entry.catchLoc) {
  693. return handle(entry.catchLoc, true);
  694. } else if (this.prev < entry.finallyLoc) {
  695. return handle(entry.finallyLoc);
  696. }
  697. } else if (hasCatch) {
  698. if (this.prev < entry.catchLoc) {
  699. return handle(entry.catchLoc, true);
  700. }
  701. } else if (hasFinally) {
  702. if (this.prev < entry.finallyLoc) {
  703. return handle(entry.finallyLoc);
  704. }
  705. } else {
  706. throw new Error("try statement without catch or finally");
  707. }
  708. }
  709. }
  710. },
  711. abrupt: function abrupt(type, arg) {
  712. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  713. var entry = this.tryEntries[i];
  714. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  715. var finallyEntry = entry;
  716. break;
  717. }
  718. }
  719. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  720. finallyEntry = null;
  721. }
  722. var record = finallyEntry ? finallyEntry.completion : {};
  723. record.type = type;
  724. record.arg = arg;
  725. if (finallyEntry) {
  726. this.method = "next";
  727. this.next = finallyEntry.finallyLoc;
  728. return ContinueSentinel;
  729. }
  730. return this.complete(record);
  731. },
  732. complete: function complete(record, afterLoc) {
  733. if (record.type === "throw") {
  734. throw record.arg;
  735. }
  736. if (record.type === "break" || record.type === "continue") {
  737. this.next = record.arg;
  738. } else if (record.type === "return") {
  739. this.rval = this.arg = record.arg;
  740. this.method = "return";
  741. this.next = "end";
  742. } else if (record.type === "normal" && afterLoc) {
  743. this.next = afterLoc;
  744. }
  745. return ContinueSentinel;
  746. },
  747. finish: function finish(finallyLoc) {
  748. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  749. var entry = this.tryEntries[i];
  750. if (entry.finallyLoc === finallyLoc) {
  751. this.complete(entry.completion, entry.afterLoc);
  752. resetTryEntry(entry);
  753. return ContinueSentinel;
  754. }
  755. }
  756. },
  757. "catch": function _catch(tryLoc) {
  758. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  759. var entry = this.tryEntries[i];
  760. if (entry.tryLoc === tryLoc) {
  761. var record = entry.completion;
  762. if (record.type === "throw") {
  763. var thrown = record.arg;
  764. resetTryEntry(entry);
  765. }
  766. return thrown;
  767. }
  768. }
  769. throw new Error("illegal catch attempt");
  770. },
  771. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  772. this.delegate = {
  773. iterator: values(iterable),
  774. resultName: resultName,
  775. nextLoc: nextLoc
  776. };
  777. if (this.method === "next") {
  778. this.arg = undefined;
  779. }
  780. return ContinueSentinel;
  781. }
  782. };
  783. return exports;
  784. }(( false ? 0 : _typeof(module)) === "object" ? module.exports : {});
  785. try {
  786. regeneratorRuntime = runtime;
  787. } catch (accidentalStrictMode) {
  788. if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
  789. globalThis.regeneratorRuntime = runtime;
  790. } else {
  791. Function("r", "regeneratorRuntime = r")(runtime);
  792. }
  793. }
  794. /***/ }),
  795. /* 5 */
  796. /***/ ((module) => {
  797. var pdfjsLib;
  798. if (typeof window !== "undefined" && window["pdfjs-dist/build/pdf"]) {
  799. pdfjsLib = window["pdfjs-dist/build/pdf"];
  800. } else {
  801. pdfjsLib = require("../build/pdf.js");
  802. }
  803. module.exports = pdfjsLib;
  804. /***/ }),
  805. /* 6 */
  806. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  807. Object.defineProperty(exports, "__esModule", ({
  808. value: true
  809. }));
  810. exports.NullL10n = void 0;
  811. exports.fixupLangCode = fixupLangCode;
  812. exports.getL10nFallback = getL10nFallback;
  813. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  814. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  815. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  816. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  817. var DEFAULT_L10N_STRINGS = {
  818. of_pages: "of {{pagesCount}}",
  819. page_of_pages: "({{pageNumber}} of {{pagesCount}})",
  820. document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
  821. document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
  822. document_properties_date_string: "{{date}}, {{time}}",
  823. document_properties_page_size_unit_inches: "in",
  824. document_properties_page_size_unit_millimeters: "mm",
  825. document_properties_page_size_orientation_portrait: "portrait",
  826. document_properties_page_size_orientation_landscape: "landscape",
  827. document_properties_page_size_name_a3: "A3",
  828. document_properties_page_size_name_a4: "A4",
  829. document_properties_page_size_name_letter: "Letter",
  830. document_properties_page_size_name_legal: "Legal",
  831. document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
  832. document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
  833. document_properties_linearized_yes: "Yes",
  834. document_properties_linearized_no: "No",
  835. print_progress_percent: "{{progress}}%",
  836. "toggle_sidebar.title": "Toggle Sidebar",
  837. "toggle_sidebar_notification2.title": "Toggle Sidebar (document contains outline/attachments/layers)",
  838. additional_layers: "Additional Layers",
  839. page_landmark: "Page {{page}}",
  840. thumb_page_title: "Page {{page}}",
  841. thumb_page_canvas: "Thumbnail of Page {{page}}",
  842. find_reached_top: "Reached top of document, continued from bottom",
  843. find_reached_bottom: "Reached end of document, continued from top",
  844. "find_match_count[one]": "{{current}} of {{total}} match",
  845. "find_match_count[other]": "{{current}} of {{total}} matches",
  846. "find_match_count_limit[one]": "More than {{limit}} match",
  847. "find_match_count_limit[other]": "More than {{limit}} matches",
  848. find_not_found: "Phrase not found",
  849. error_version_info: "PDF.js v{{version}} (build: {{build}})",
  850. error_message: "Message: {{message}}",
  851. error_stack: "Stack: {{stack}}",
  852. error_file: "File: {{file}}",
  853. error_line: "Line: {{line}}",
  854. rendering_error: "An error occurred while rendering the page.",
  855. page_scale_width: "Page Width",
  856. page_scale_fit: "Page Fit",
  857. page_scale_auto: "Automatic Zoom",
  858. page_scale_actual: "Actual Size",
  859. page_scale_percent: "{{scale}}%",
  860. loading: "Loading…",
  861. loading_error: "An error occurred while loading the PDF.",
  862. invalid_file_error: "Invalid or corrupted PDF file.",
  863. missing_file_error: "Missing PDF file.",
  864. unexpected_response_error: "Unexpected server response.",
  865. printing_not_supported: "Warning: Printing is not fully supported by this browser.",
  866. printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
  867. web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts."
  868. };
  869. function getL10nFallback(key, args) {
  870. switch (key) {
  871. case "find_match_count":
  872. key = "find_match_count[".concat(args.total === 1 ? "one" : "other", "]");
  873. break;
  874. case "find_match_count_limit":
  875. key = "find_match_count_limit[".concat(args.limit === 1 ? "one" : "other", "]");
  876. break;
  877. }
  878. return DEFAULT_L10N_STRINGS[key] || "";
  879. }
  880. var PARTIAL_LANG_CODES = {
  881. en: "en-US",
  882. es: "es-ES",
  883. fy: "fy-NL",
  884. ga: "ga-IE",
  885. gu: "gu-IN",
  886. hi: "hi-IN",
  887. hy: "hy-AM",
  888. nb: "nb-NO",
  889. ne: "ne-NP",
  890. nn: "nn-NO",
  891. pa: "pa-IN",
  892. pt: "pt-PT",
  893. sv: "sv-SE",
  894. zh: "zh-CN"
  895. };
  896. function fixupLangCode(langCode) {
  897. return PARTIAL_LANG_CODES[langCode === null || langCode === void 0 ? void 0 : langCode.toLowerCase()] || langCode;
  898. }
  899. function formatL10nValue(text, args) {
  900. if (!args) {
  901. return text;
  902. }
  903. return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) {
  904. return name in args ? args[name] : "{{" + name + "}}";
  905. });
  906. }
  907. var NullL10n = {
  908. getLanguage: function getLanguage() {
  909. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  910. return _regenerator["default"].wrap(function _callee$(_context) {
  911. while (1) {
  912. switch (_context.prev = _context.next) {
  913. case 0:
  914. return _context.abrupt("return", "en-us");
  915. case 1:
  916. case "end":
  917. return _context.stop();
  918. }
  919. }
  920. }, _callee);
  921. }))();
  922. },
  923. getDirection: function getDirection() {
  924. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  925. return _regenerator["default"].wrap(function _callee2$(_context2) {
  926. while (1) {
  927. switch (_context2.prev = _context2.next) {
  928. case 0:
  929. return _context2.abrupt("return", "ltr");
  930. case 1:
  931. case "end":
  932. return _context2.stop();
  933. }
  934. }
  935. }, _callee2);
  936. }))();
  937. },
  938. get: function get(key) {
  939. var _arguments = arguments;
  940. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  941. var args, fallback;
  942. return _regenerator["default"].wrap(function _callee3$(_context3) {
  943. while (1) {
  944. switch (_context3.prev = _context3.next) {
  945. case 0:
  946. args = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : null;
  947. fallback = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : getL10nFallback(key, args);
  948. return _context3.abrupt("return", formatL10nValue(fallback, args));
  949. case 3:
  950. case "end":
  951. return _context3.stop();
  952. }
  953. }
  954. }, _callee3);
  955. }))();
  956. },
  957. translate: function translate(element) {
  958. return _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  959. return _regenerator["default"].wrap(function _callee4$(_context4) {
  960. while (1) {
  961. switch (_context4.prev = _context4.next) {
  962. case 0:
  963. case "end":
  964. return _context4.stop();
  965. }
  966. }
  967. }, _callee4);
  968. }))();
  969. }
  970. };
  971. exports.NullL10n = NullL10n;
  972. /***/ }),
  973. /* 7 */
  974. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  975. Object.defineProperty(exports, "__esModule", ({
  976. value: true
  977. }));
  978. exports.SimpleLinkService = exports.PDFLinkService = exports.LinkTarget = void 0;
  979. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  980. var _ui_utils = __w_pdfjs_require__(8);
  981. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  982. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  983. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  984. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  985. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  986. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  987. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  988. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  989. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  990. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  991. function _classStaticPrivateMethodGet(receiver, classConstructor, method) { _classCheckPrivateStaticAccess(receiver, classConstructor); return method; }
  992. function _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } }
  993. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  994. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  995. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  996. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  997. var DEFAULT_LINK_REL = "noopener noreferrer nofollow";
  998. var LinkTarget = {
  999. NONE: 0,
  1000. SELF: 1,
  1001. BLANK: 2,
  1002. PARENT: 3,
  1003. TOP: 4
  1004. };
  1005. exports.LinkTarget = LinkTarget;
  1006. function _addLinkAttributes(link) {
  1007. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  1008. url = _ref.url,
  1009. target = _ref.target,
  1010. rel = _ref.rel,
  1011. _ref$enabled = _ref.enabled,
  1012. enabled = _ref$enabled === void 0 ? true : _ref$enabled;
  1013. if (!url || typeof url !== "string") {
  1014. throw new Error('A valid "url" parameter must provided.');
  1015. }
  1016. var urlNullRemoved = (0, _ui_utils.removeNullCharacters)(url);
  1017. if (enabled) {
  1018. link.href = link.title = urlNullRemoved;
  1019. } else {
  1020. link.href = "";
  1021. link.title = "Disabled: ".concat(urlNullRemoved);
  1022. link.onclick = function () {
  1023. return false;
  1024. };
  1025. }
  1026. var targetStr = "";
  1027. switch (target) {
  1028. case LinkTarget.NONE:
  1029. break;
  1030. case LinkTarget.SELF:
  1031. targetStr = "_self";
  1032. break;
  1033. case LinkTarget.BLANK:
  1034. targetStr = "_blank";
  1035. break;
  1036. case LinkTarget.PARENT:
  1037. targetStr = "_parent";
  1038. break;
  1039. case LinkTarget.TOP:
  1040. targetStr = "_top";
  1041. break;
  1042. }
  1043. link.target = targetStr;
  1044. link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
  1045. }
  1046. var _pagesRefCache = /*#__PURE__*/new WeakMap();
  1047. var _goToDestinationHelper = /*#__PURE__*/new WeakSet();
  1048. var PDFLinkService = /*#__PURE__*/function () {
  1049. function PDFLinkService() {
  1050. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  1051. eventBus = _ref2.eventBus,
  1052. _ref2$externalLinkTar = _ref2.externalLinkTarget,
  1053. externalLinkTarget = _ref2$externalLinkTar === void 0 ? null : _ref2$externalLinkTar,
  1054. _ref2$externalLinkRel = _ref2.externalLinkRel,
  1055. externalLinkRel = _ref2$externalLinkRel === void 0 ? null : _ref2$externalLinkRel,
  1056. _ref2$ignoreDestinati = _ref2.ignoreDestinationZoom,
  1057. ignoreDestinationZoom = _ref2$ignoreDestinati === void 0 ? false : _ref2$ignoreDestinati;
  1058. _classCallCheck(this, PDFLinkService);
  1059. _classPrivateMethodInitSpec(this, _goToDestinationHelper);
  1060. _classPrivateFieldInitSpec(this, _pagesRefCache, {
  1061. writable: true,
  1062. value: new Map()
  1063. });
  1064. this.eventBus = eventBus;
  1065. this.externalLinkTarget = externalLinkTarget;
  1066. this.externalLinkRel = externalLinkRel;
  1067. this.externalLinkEnabled = true;
  1068. this._ignoreDestinationZoom = ignoreDestinationZoom;
  1069. this.baseUrl = null;
  1070. this.pdfDocument = null;
  1071. this.pdfViewer = null;
  1072. this.pdfHistory = null;
  1073. }
  1074. _createClass(PDFLinkService, [{
  1075. key: "setDocument",
  1076. value: function setDocument(pdfDocument) {
  1077. var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1078. this.baseUrl = baseUrl;
  1079. this.pdfDocument = pdfDocument;
  1080. _classPrivateFieldGet(this, _pagesRefCache).clear();
  1081. }
  1082. }, {
  1083. key: "setViewer",
  1084. value: function setViewer(pdfViewer) {
  1085. this.pdfViewer = pdfViewer;
  1086. }
  1087. }, {
  1088. key: "setHistory",
  1089. value: function setHistory(pdfHistory) {
  1090. this.pdfHistory = pdfHistory;
  1091. }
  1092. }, {
  1093. key: "pagesCount",
  1094. get: function get() {
  1095. return this.pdfDocument ? this.pdfDocument.numPages : 0;
  1096. }
  1097. }, {
  1098. key: "page",
  1099. get: function get() {
  1100. return this.pdfViewer.currentPageNumber;
  1101. },
  1102. set: function set(value) {
  1103. this.pdfViewer.currentPageNumber = value;
  1104. }
  1105. }, {
  1106. key: "rotation",
  1107. get: function get() {
  1108. return this.pdfViewer.pagesRotation;
  1109. },
  1110. set: function set(value) {
  1111. this.pdfViewer.pagesRotation = value;
  1112. }
  1113. }, {
  1114. key: "goToDestination",
  1115. value: function () {
  1116. var _goToDestination = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(dest) {
  1117. var namedDest, explicitDest;
  1118. return _regenerator["default"].wrap(function _callee$(_context) {
  1119. while (1) {
  1120. switch (_context.prev = _context.next) {
  1121. case 0:
  1122. if (this.pdfDocument) {
  1123. _context.next = 2;
  1124. break;
  1125. }
  1126. return _context.abrupt("return");
  1127. case 2:
  1128. if (!(typeof dest === "string")) {
  1129. _context.next = 9;
  1130. break;
  1131. }
  1132. namedDest = dest;
  1133. _context.next = 6;
  1134. return this.pdfDocument.getDestination(dest);
  1135. case 6:
  1136. explicitDest = _context.sent;
  1137. _context.next = 13;
  1138. break;
  1139. case 9:
  1140. namedDest = null;
  1141. _context.next = 12;
  1142. return dest;
  1143. case 12:
  1144. explicitDest = _context.sent;
  1145. case 13:
  1146. if (Array.isArray(explicitDest)) {
  1147. _context.next = 16;
  1148. break;
  1149. }
  1150. console.error("PDFLinkService.goToDestination: \"".concat(explicitDest, "\" is not ") + "a valid destination array, for dest=\"".concat(dest, "\"."));
  1151. return _context.abrupt("return");
  1152. case 16:
  1153. _classPrivateMethodGet(this, _goToDestinationHelper, _goToDestinationHelper2).call(this, dest, namedDest, explicitDest);
  1154. case 17:
  1155. case "end":
  1156. return _context.stop();
  1157. }
  1158. }
  1159. }, _callee, this);
  1160. }));
  1161. function goToDestination(_x) {
  1162. return _goToDestination.apply(this, arguments);
  1163. }
  1164. return goToDestination;
  1165. }()
  1166. }, {
  1167. key: "goToPage",
  1168. value: function goToPage(val) {
  1169. if (!this.pdfDocument) {
  1170. return;
  1171. }
  1172. var pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
  1173. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  1174. console.error("PDFLinkService.goToPage: \"".concat(val, "\" is not a valid page."));
  1175. return;
  1176. }
  1177. if (this.pdfHistory) {
  1178. this.pdfHistory.pushCurrentPosition();
  1179. this.pdfHistory.pushPage(pageNumber);
  1180. }
  1181. this.pdfViewer.scrollPageIntoView({
  1182. pageNumber: pageNumber
  1183. });
  1184. }
  1185. }, {
  1186. key: "addLinkAttributes",
  1187. value: function addLinkAttributes(link, url) {
  1188. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1189. _addLinkAttributes(link, {
  1190. url: url,
  1191. target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,
  1192. rel: this.externalLinkRel,
  1193. enabled: this.externalLinkEnabled
  1194. });
  1195. }
  1196. }, {
  1197. key: "getDestinationHash",
  1198. value: function getDestinationHash(dest) {
  1199. if (typeof dest === "string") {
  1200. if (dest.length > 0) {
  1201. return this.getAnchorUrl("#" + escape(dest));
  1202. }
  1203. } else if (Array.isArray(dest)) {
  1204. var str = JSON.stringify(dest);
  1205. if (str.length > 0) {
  1206. return this.getAnchorUrl("#" + escape(str));
  1207. }
  1208. }
  1209. return this.getAnchorUrl("");
  1210. }
  1211. }, {
  1212. key: "getAnchorUrl",
  1213. value: function getAnchorUrl(anchor) {
  1214. return (this.baseUrl || "") + anchor;
  1215. }
  1216. }, {
  1217. key: "setHash",
  1218. value: function setHash(hash) {
  1219. if (!this.pdfDocument) {
  1220. return;
  1221. }
  1222. var pageNumber, dest;
  1223. if (hash.includes("=")) {
  1224. var params = (0, _ui_utils.parseQueryString)(hash);
  1225. if (params.has("search")) {
  1226. this.eventBus.dispatch("findfromurlhash", {
  1227. source: this,
  1228. query: params.get("search").replace(/"/g, ""),
  1229. phraseSearch: params.get("phrase") === "true"
  1230. });
  1231. }
  1232. if (params.has("page")) {
  1233. pageNumber = params.get("page") | 0 || 1;
  1234. }
  1235. if (params.has("zoom")) {
  1236. var zoomArgs = params.get("zoom").split(",");
  1237. var zoomArg = zoomArgs[0];
  1238. var zoomArgNumber = parseFloat(zoomArg);
  1239. if (!zoomArg.includes("Fit")) {
  1240. dest = [null, {
  1241. name: "XYZ"
  1242. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
  1243. } else {
  1244. if (zoomArg === "Fit" || zoomArg === "FitB") {
  1245. dest = [null, {
  1246. name: zoomArg
  1247. }];
  1248. } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
  1249. dest = [null, {
  1250. name: zoomArg
  1251. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
  1252. } else if (zoomArg === "FitR") {
  1253. if (zoomArgs.length !== 5) {
  1254. console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
  1255. } else {
  1256. dest = [null, {
  1257. name: zoomArg
  1258. }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
  1259. }
  1260. } else {
  1261. console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not a valid zoom value."));
  1262. }
  1263. }
  1264. }
  1265. if (dest) {
  1266. this.pdfViewer.scrollPageIntoView({
  1267. pageNumber: pageNumber || this.page,
  1268. destArray: dest,
  1269. allowNegativeOffset: true
  1270. });
  1271. } else if (pageNumber) {
  1272. this.page = pageNumber;
  1273. }
  1274. if (params.has("pagemode")) {
  1275. this.eventBus.dispatch("pagemode", {
  1276. source: this,
  1277. mode: params.get("pagemode")
  1278. });
  1279. }
  1280. if (params.has("nameddest")) {
  1281. this.goToDestination(params.get("nameddest"));
  1282. }
  1283. } else {
  1284. dest = unescape(hash);
  1285. try {
  1286. dest = JSON.parse(dest);
  1287. if (!Array.isArray(dest)) {
  1288. dest = dest.toString();
  1289. }
  1290. } catch (ex) {}
  1291. if (typeof dest === "string" || _classStaticPrivateMethodGet(PDFLinkService, PDFLinkService, _isValidExplicitDestination).call(PDFLinkService, dest)) {
  1292. this.goToDestination(dest);
  1293. return;
  1294. }
  1295. console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not a valid destination."));
  1296. }
  1297. }
  1298. }, {
  1299. key: "executeNamedAction",
  1300. value: function executeNamedAction(action) {
  1301. var _this$pdfHistory, _this$pdfHistory2;
  1302. switch (action) {
  1303. case "GoBack":
  1304. (_this$pdfHistory = this.pdfHistory) === null || _this$pdfHistory === void 0 ? void 0 : _this$pdfHistory.back();
  1305. break;
  1306. case "GoForward":
  1307. (_this$pdfHistory2 = this.pdfHistory) === null || _this$pdfHistory2 === void 0 ? void 0 : _this$pdfHistory2.forward();
  1308. break;
  1309. case "NextPage":
  1310. this.pdfViewer.nextPage();
  1311. break;
  1312. case "PrevPage":
  1313. this.pdfViewer.previousPage();
  1314. break;
  1315. case "LastPage":
  1316. this.page = this.pagesCount;
  1317. break;
  1318. case "FirstPage":
  1319. this.page = 1;
  1320. break;
  1321. default:
  1322. break;
  1323. }
  1324. this.eventBus.dispatch("namedaction", {
  1325. source: this,
  1326. action: action
  1327. });
  1328. }
  1329. }, {
  1330. key: "cachePageRef",
  1331. value: function cachePageRef(pageNum, pageRef) {
  1332. if (!pageRef) {
  1333. return;
  1334. }
  1335. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1336. _classPrivateFieldGet(this, _pagesRefCache).set(refStr, pageNum);
  1337. }
  1338. }, {
  1339. key: "_cachedPageNumber",
  1340. value: function _cachedPageNumber(pageRef) {
  1341. if (!pageRef) {
  1342. return null;
  1343. }
  1344. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1345. return _classPrivateFieldGet(this, _pagesRefCache).get(refStr) || null;
  1346. }
  1347. }, {
  1348. key: "isPageVisible",
  1349. value: function isPageVisible(pageNumber) {
  1350. return this.pdfViewer.isPageVisible(pageNumber);
  1351. }
  1352. }, {
  1353. key: "isPageCached",
  1354. value: function isPageCached(pageNumber) {
  1355. return this.pdfViewer.isPageCached(pageNumber);
  1356. }
  1357. }]);
  1358. return PDFLinkService;
  1359. }();
  1360. exports.PDFLinkService = PDFLinkService;
  1361. function _goToDestinationHelper2(rawDest) {
  1362. var _this = this;
  1363. var namedDest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1364. var explicitDest = arguments.length > 2 ? arguments[2] : undefined;
  1365. var destRef = explicitDest[0];
  1366. var pageNumber;
  1367. if (_typeof(destRef) === "object" && destRef !== null) {
  1368. pageNumber = this._cachedPageNumber(destRef);
  1369. if (!pageNumber) {
  1370. this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
  1371. _this.cachePageRef(pageIndex + 1, destRef);
  1372. _classPrivateMethodGet(_this, _goToDestinationHelper, _goToDestinationHelper2).call(_this, rawDest, namedDest, explicitDest);
  1373. })["catch"](function () {
  1374. console.error("PDFLinkService.#goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(rawDest, "\"."));
  1375. });
  1376. return;
  1377. }
  1378. } else if (Number.isInteger(destRef)) {
  1379. pageNumber = destRef + 1;
  1380. } else {
  1381. console.error("PDFLinkService.#goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(rawDest, "\"."));
  1382. return;
  1383. }
  1384. if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
  1385. console.error("PDFLinkService.#goToDestinationHelper: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(rawDest, "\"."));
  1386. return;
  1387. }
  1388. if (this.pdfHistory) {
  1389. this.pdfHistory.pushCurrentPosition();
  1390. this.pdfHistory.push({
  1391. namedDest: namedDest,
  1392. explicitDest: explicitDest,
  1393. pageNumber: pageNumber
  1394. });
  1395. }
  1396. this.pdfViewer.scrollPageIntoView({
  1397. pageNumber: pageNumber,
  1398. destArray: explicitDest,
  1399. ignoreDestinationZoom: this._ignoreDestinationZoom
  1400. });
  1401. }
  1402. function _isValidExplicitDestination(dest) {
  1403. if (!Array.isArray(dest)) {
  1404. return false;
  1405. }
  1406. var destLength = dest.length;
  1407. if (destLength < 2) {
  1408. return false;
  1409. }
  1410. var page = dest[0];
  1411. if (!(_typeof(page) === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
  1412. return false;
  1413. }
  1414. var zoom = dest[1];
  1415. if (!(_typeof(zoom) === "object" && typeof zoom.name === "string")) {
  1416. return false;
  1417. }
  1418. var allowNull = true;
  1419. switch (zoom.name) {
  1420. case "XYZ":
  1421. if (destLength !== 5) {
  1422. return false;
  1423. }
  1424. break;
  1425. case "Fit":
  1426. case "FitB":
  1427. return destLength === 2;
  1428. case "FitH":
  1429. case "FitBH":
  1430. case "FitV":
  1431. case "FitBV":
  1432. if (destLength !== 3) {
  1433. return false;
  1434. }
  1435. break;
  1436. case "FitR":
  1437. if (destLength !== 6) {
  1438. return false;
  1439. }
  1440. allowNull = false;
  1441. break;
  1442. default:
  1443. return false;
  1444. }
  1445. for (var i = 2; i < destLength; i++) {
  1446. var param = dest[i];
  1447. if (!(typeof param === "number" || allowNull && param === null)) {
  1448. return false;
  1449. }
  1450. }
  1451. return true;
  1452. }
  1453. var SimpleLinkService = /*#__PURE__*/function () {
  1454. function SimpleLinkService() {
  1455. _classCallCheck(this, SimpleLinkService);
  1456. this.externalLinkEnabled = true;
  1457. }
  1458. _createClass(SimpleLinkService, [{
  1459. key: "pagesCount",
  1460. get: function get() {
  1461. return 0;
  1462. }
  1463. }, {
  1464. key: "page",
  1465. get: function get() {
  1466. return 0;
  1467. },
  1468. set: function set(value) {}
  1469. }, {
  1470. key: "rotation",
  1471. get: function get() {
  1472. return 0;
  1473. },
  1474. set: function set(value) {}
  1475. }, {
  1476. key: "goToDestination",
  1477. value: function () {
  1478. var _goToDestination2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(dest) {
  1479. return _regenerator["default"].wrap(function _callee2$(_context2) {
  1480. while (1) {
  1481. switch (_context2.prev = _context2.next) {
  1482. case 0:
  1483. case "end":
  1484. return _context2.stop();
  1485. }
  1486. }
  1487. }, _callee2);
  1488. }));
  1489. function goToDestination(_x2) {
  1490. return _goToDestination2.apply(this, arguments);
  1491. }
  1492. return goToDestination;
  1493. }()
  1494. }, {
  1495. key: "goToPage",
  1496. value: function goToPage(val) {}
  1497. }, {
  1498. key: "addLinkAttributes",
  1499. value: function addLinkAttributes(link, url) {
  1500. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1501. _addLinkAttributes(link, {
  1502. url: url,
  1503. enabled: this.externalLinkEnabled
  1504. });
  1505. }
  1506. }, {
  1507. key: "getDestinationHash",
  1508. value: function getDestinationHash(dest) {
  1509. return "#";
  1510. }
  1511. }, {
  1512. key: "getAnchorUrl",
  1513. value: function getAnchorUrl(hash) {
  1514. return "#";
  1515. }
  1516. }, {
  1517. key: "setHash",
  1518. value: function setHash(hash) {}
  1519. }, {
  1520. key: "executeNamedAction",
  1521. value: function executeNamedAction(action) {}
  1522. }, {
  1523. key: "cachePageRef",
  1524. value: function cachePageRef(pageNum, pageRef) {}
  1525. }, {
  1526. key: "isPageVisible",
  1527. value: function isPageVisible(pageNumber) {
  1528. return true;
  1529. }
  1530. }, {
  1531. key: "isPageCached",
  1532. value: function isPageCached(pageNumber) {
  1533. return true;
  1534. }
  1535. }]);
  1536. return SimpleLinkService;
  1537. }();
  1538. exports.SimpleLinkService = SimpleLinkService;
  1539. /***/ }),
  1540. /* 8 */
  1541. /***/ ((__unused_webpack_module, exports) => {
  1542. Object.defineProperty(exports, "__esModule", ({
  1543. value: true
  1544. }));
  1545. exports.animationStarted = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RenderingStates = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.OutputScale = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = void 0;
  1546. exports.apiPageLayoutToViewerModes = apiPageLayoutToViewerModes;
  1547. exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
  1548. exports.approximateFraction = approximateFraction;
  1549. exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
  1550. exports.binarySearchFirstItem = binarySearchFirstItem;
  1551. exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
  1552. exports.getPageSizeInches = getPageSizeInches;
  1553. exports.getVisibleElements = getVisibleElements;
  1554. exports.isPortraitOrientation = isPortraitOrientation;
  1555. exports.isValidRotation = isValidRotation;
  1556. exports.isValidScrollMode = isValidScrollMode;
  1557. exports.isValidSpreadMode = isValidSpreadMode;
  1558. exports.noContextMenuHandler = noContextMenuHandler;
  1559. exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
  1560. exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
  1561. exports.parseQueryString = parseQueryString;
  1562. exports.removeNullCharacters = removeNullCharacters;
  1563. exports.roundToDivide = roundToDivide;
  1564. exports.scrollIntoView = scrollIntoView;
  1565. exports.watchScroll = watchScroll;
  1566. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  1567. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  1568. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  1569. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  1570. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  1571. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  1572. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  1573. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  1574. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  1575. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  1576. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1577. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  1578. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  1579. var DEFAULT_SCALE_VALUE = "auto";
  1580. exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
  1581. var DEFAULT_SCALE = 1.0;
  1582. exports.DEFAULT_SCALE = DEFAULT_SCALE;
  1583. var DEFAULT_SCALE_DELTA = 1.1;
  1584. exports.DEFAULT_SCALE_DELTA = DEFAULT_SCALE_DELTA;
  1585. var MIN_SCALE = 0.1;
  1586. exports.MIN_SCALE = MIN_SCALE;
  1587. var MAX_SCALE = 10.0;
  1588. exports.MAX_SCALE = MAX_SCALE;
  1589. var UNKNOWN_SCALE = 0;
  1590. exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
  1591. var MAX_AUTO_SCALE = 1.25;
  1592. exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
  1593. var SCROLLBAR_PADDING = 40;
  1594. exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
  1595. var VERTICAL_PADDING = 5;
  1596. exports.VERTICAL_PADDING = VERTICAL_PADDING;
  1597. var RenderingStates = {
  1598. INITIAL: 0,
  1599. RUNNING: 1,
  1600. PAUSED: 2,
  1601. FINISHED: 3
  1602. };
  1603. exports.RenderingStates = RenderingStates;
  1604. var PresentationModeState = {
  1605. UNKNOWN: 0,
  1606. NORMAL: 1,
  1607. CHANGING: 2,
  1608. FULLSCREEN: 3
  1609. };
  1610. exports.PresentationModeState = PresentationModeState;
  1611. var SidebarView = {
  1612. UNKNOWN: -1,
  1613. NONE: 0,
  1614. THUMBS: 1,
  1615. OUTLINE: 2,
  1616. ATTACHMENTS: 3,
  1617. LAYERS: 4
  1618. };
  1619. exports.SidebarView = SidebarView;
  1620. var RendererType = {
  1621. CANVAS: "canvas",
  1622. SVG: "svg"
  1623. };
  1624. exports.RendererType = RendererType;
  1625. var TextLayerMode = {
  1626. DISABLE: 0,
  1627. ENABLE: 1,
  1628. ENABLE_ENHANCE: 2
  1629. };
  1630. exports.TextLayerMode = TextLayerMode;
  1631. var ScrollMode = {
  1632. UNKNOWN: -1,
  1633. VERTICAL: 0,
  1634. HORIZONTAL: 1,
  1635. WRAPPED: 2,
  1636. PAGE: 3
  1637. };
  1638. exports.ScrollMode = ScrollMode;
  1639. var SpreadMode = {
  1640. UNKNOWN: -1,
  1641. NONE: 0,
  1642. ODD: 1,
  1643. EVEN: 2
  1644. };
  1645. exports.SpreadMode = SpreadMode;
  1646. var AutoPrintRegExp = /\bprint\s*\(/;
  1647. exports.AutoPrintRegExp = AutoPrintRegExp;
  1648. var OutputScale = /*#__PURE__*/function () {
  1649. function OutputScale() {
  1650. _classCallCheck(this, OutputScale);
  1651. var pixelRatio = window.devicePixelRatio || 1;
  1652. this.sx = pixelRatio;
  1653. this.sy = pixelRatio;
  1654. }
  1655. _createClass(OutputScale, [{
  1656. key: "scaled",
  1657. get: function get() {
  1658. return this.sx !== 1 || this.sy !== 1;
  1659. }
  1660. }]);
  1661. return OutputScale;
  1662. }();
  1663. exports.OutputScale = OutputScale;
  1664. function scrollIntoView(element, spot) {
  1665. var scrollMatches = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1666. var parent = element.offsetParent;
  1667. if (!parent) {
  1668. console.error("offsetParent is not set -- cannot scroll");
  1669. return;
  1670. }
  1671. var offsetY = element.offsetTop + element.clientTop;
  1672. var offsetX = element.offsetLeft + element.clientLeft;
  1673. while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {
  1674. offsetY += parent.offsetTop;
  1675. offsetX += parent.offsetLeft;
  1676. parent = parent.offsetParent;
  1677. if (!parent) {
  1678. return;
  1679. }
  1680. }
  1681. if (spot) {
  1682. if (spot.top !== undefined) {
  1683. offsetY += spot.top;
  1684. }
  1685. if (spot.left !== undefined) {
  1686. offsetX += spot.left;
  1687. parent.scrollLeft = offsetX;
  1688. }
  1689. }
  1690. parent.scrollTop = offsetY;
  1691. }
  1692. function watchScroll(viewAreaElement, callback) {
  1693. var debounceScroll = function debounceScroll(evt) {
  1694. if (rAF) {
  1695. return;
  1696. }
  1697. rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
  1698. rAF = null;
  1699. var currentX = viewAreaElement.scrollLeft;
  1700. var lastX = state.lastX;
  1701. if (currentX !== lastX) {
  1702. state.right = currentX > lastX;
  1703. }
  1704. state.lastX = currentX;
  1705. var currentY = viewAreaElement.scrollTop;
  1706. var lastY = state.lastY;
  1707. if (currentY !== lastY) {
  1708. state.down = currentY > lastY;
  1709. }
  1710. state.lastY = currentY;
  1711. callback(state);
  1712. });
  1713. };
  1714. var state = {
  1715. right: true,
  1716. down: true,
  1717. lastX: viewAreaElement.scrollLeft,
  1718. lastY: viewAreaElement.scrollTop,
  1719. _eventHandler: debounceScroll
  1720. };
  1721. var rAF = null;
  1722. viewAreaElement.addEventListener("scroll", debounceScroll, true);
  1723. return state;
  1724. }
  1725. function parseQueryString(query) {
  1726. var params = new Map();
  1727. var _iterator = _createForOfIteratorHelper(new URLSearchParams(query)),
  1728. _step;
  1729. try {
  1730. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  1731. var _step$value = _slicedToArray(_step.value, 2),
  1732. key = _step$value[0],
  1733. value = _step$value[1];
  1734. params.set(key.toLowerCase(), value);
  1735. }
  1736. } catch (err) {
  1737. _iterator.e(err);
  1738. } finally {
  1739. _iterator.f();
  1740. }
  1741. return params;
  1742. }
  1743. var NullCharactersRegExp = /\x00/g;
  1744. var InvisibleCharactersRegExp = /[\x01-\x1F]/g;
  1745. function removeNullCharacters(str) {
  1746. var replaceInvisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1747. if (typeof str !== "string") {
  1748. console.error("The argument must be a string.");
  1749. return str;
  1750. }
  1751. if (replaceInvisible) {
  1752. str = str.replace(InvisibleCharactersRegExp, " ");
  1753. }
  1754. return str.replace(NullCharactersRegExp, "");
  1755. }
  1756. function binarySearchFirstItem(items, condition) {
  1757. var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  1758. var minIndex = start;
  1759. var maxIndex = items.length - 1;
  1760. if (maxIndex < 0 || !condition(items[maxIndex])) {
  1761. return items.length;
  1762. }
  1763. if (condition(items[minIndex])) {
  1764. return minIndex;
  1765. }
  1766. while (minIndex < maxIndex) {
  1767. var currentIndex = minIndex + maxIndex >> 1;
  1768. var currentItem = items[currentIndex];
  1769. if (condition(currentItem)) {
  1770. maxIndex = currentIndex;
  1771. } else {
  1772. minIndex = currentIndex + 1;
  1773. }
  1774. }
  1775. return minIndex;
  1776. }
  1777. function approximateFraction(x) {
  1778. if (Math.floor(x) === x) {
  1779. return [x, 1];
  1780. }
  1781. var xinv = 1 / x;
  1782. var limit = 8;
  1783. if (xinv > limit) {
  1784. return [1, limit];
  1785. } else if (Math.floor(xinv) === xinv) {
  1786. return [1, xinv];
  1787. }
  1788. var x_ = x > 1 ? xinv : x;
  1789. var a = 0,
  1790. b = 1,
  1791. c = 1,
  1792. d = 1;
  1793. while (true) {
  1794. var p = a + c,
  1795. q = b + d;
  1796. if (q > limit) {
  1797. break;
  1798. }
  1799. if (x_ <= p / q) {
  1800. c = p;
  1801. d = q;
  1802. } else {
  1803. a = p;
  1804. b = q;
  1805. }
  1806. }
  1807. var result;
  1808. if (x_ - a / b < c / d - x_) {
  1809. result = x_ === x ? [a, b] : [b, a];
  1810. } else {
  1811. result = x_ === x ? [c, d] : [d, c];
  1812. }
  1813. return result;
  1814. }
  1815. function roundToDivide(x, div) {
  1816. var r = x % div;
  1817. return r === 0 ? x : Math.round(x - r + div);
  1818. }
  1819. function getPageSizeInches(_ref) {
  1820. var view = _ref.view,
  1821. userUnit = _ref.userUnit,
  1822. rotate = _ref.rotate;
  1823. var _view = _slicedToArray(view, 4),
  1824. x1 = _view[0],
  1825. y1 = _view[1],
  1826. x2 = _view[2],
  1827. y2 = _view[3];
  1828. var changeOrientation = rotate % 180 !== 0;
  1829. var width = (x2 - x1) / 72 * userUnit;
  1830. var height = (y2 - y1) / 72 * userUnit;
  1831. return {
  1832. width: changeOrientation ? height : width,
  1833. height: changeOrientation ? width : height
  1834. };
  1835. }
  1836. function backtrackBeforeAllVisibleElements(index, views, top) {
  1837. if (index < 2) {
  1838. return index;
  1839. }
  1840. var elt = views[index].div;
  1841. var pageTop = elt.offsetTop + elt.clientTop;
  1842. if (pageTop >= top) {
  1843. elt = views[index - 1].div;
  1844. pageTop = elt.offsetTop + elt.clientTop;
  1845. }
  1846. for (var i = index - 2; i >= 0; --i) {
  1847. elt = views[i].div;
  1848. if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
  1849. break;
  1850. }
  1851. index = i;
  1852. }
  1853. return index;
  1854. }
  1855. function getVisibleElements(_ref2) {
  1856. var scrollEl = _ref2.scrollEl,
  1857. views = _ref2.views,
  1858. _ref2$sortByVisibilit = _ref2.sortByVisibility,
  1859. sortByVisibility = _ref2$sortByVisibilit === void 0 ? false : _ref2$sortByVisibilit,
  1860. _ref2$horizontal = _ref2.horizontal,
  1861. horizontal = _ref2$horizontal === void 0 ? false : _ref2$horizontal,
  1862. _ref2$rtl = _ref2.rtl,
  1863. rtl = _ref2$rtl === void 0 ? false : _ref2$rtl;
  1864. var top = scrollEl.scrollTop,
  1865. bottom = top + scrollEl.clientHeight;
  1866. var left = scrollEl.scrollLeft,
  1867. right = left + scrollEl.clientWidth;
  1868. function isElementBottomAfterViewTop(view) {
  1869. var element = view.div;
  1870. var elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
  1871. return elementBottom > top;
  1872. }
  1873. function isElementNextAfterViewHorizontally(view) {
  1874. var element = view.div;
  1875. var elementLeft = element.offsetLeft + element.clientLeft;
  1876. var elementRight = elementLeft + element.clientWidth;
  1877. return rtl ? elementLeft < right : elementRight > left;
  1878. }
  1879. var visible = [],
  1880. ids = new Set(),
  1881. numViews = views.length;
  1882. var firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
  1883. if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
  1884. firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
  1885. }
  1886. var lastEdge = horizontal ? right : -1;
  1887. for (var i = firstVisibleElementInd; i < numViews; i++) {
  1888. var view = views[i],
  1889. element = view.div;
  1890. var currentWidth = element.offsetLeft + element.clientLeft;
  1891. var currentHeight = element.offsetTop + element.clientTop;
  1892. var viewWidth = element.clientWidth,
  1893. viewHeight = element.clientHeight;
  1894. var viewRight = currentWidth + viewWidth;
  1895. var viewBottom = currentHeight + viewHeight;
  1896. if (lastEdge === -1) {
  1897. if (viewBottom >= bottom) {
  1898. lastEdge = viewBottom;
  1899. }
  1900. } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
  1901. break;
  1902. }
  1903. if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
  1904. continue;
  1905. }
  1906. var hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
  1907. var hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
  1908. var fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
  1909. fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
  1910. var percent = fractionHeight * fractionWidth * 100 | 0;
  1911. visible.push({
  1912. id: view.id,
  1913. x: currentWidth,
  1914. y: currentHeight,
  1915. view: view,
  1916. percent: percent,
  1917. widthPercent: fractionWidth * 100 | 0
  1918. });
  1919. ids.add(view.id);
  1920. }
  1921. var first = visible[0],
  1922. last = visible[visible.length - 1];
  1923. if (sortByVisibility) {
  1924. visible.sort(function (a, b) {
  1925. var pc = a.percent - b.percent;
  1926. if (Math.abs(pc) > 0.001) {
  1927. return -pc;
  1928. }
  1929. return a.id - b.id;
  1930. });
  1931. }
  1932. return {
  1933. first: first,
  1934. last: last,
  1935. views: visible,
  1936. ids: ids
  1937. };
  1938. }
  1939. function noContextMenuHandler(evt) {
  1940. evt.preventDefault();
  1941. }
  1942. function normalizeWheelEventDirection(evt) {
  1943. var delta = Math.hypot(evt.deltaX, evt.deltaY);
  1944. var angle = Math.atan2(evt.deltaY, evt.deltaX);
  1945. if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
  1946. delta = -delta;
  1947. }
  1948. return delta;
  1949. }
  1950. function normalizeWheelEventDelta(evt) {
  1951. var delta = normalizeWheelEventDirection(evt);
  1952. var MOUSE_DOM_DELTA_PIXEL_MODE = 0;
  1953. var MOUSE_DOM_DELTA_LINE_MODE = 1;
  1954. var MOUSE_PIXELS_PER_LINE = 30;
  1955. var MOUSE_LINES_PER_PAGE = 30;
  1956. if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
  1957. delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
  1958. } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
  1959. delta /= MOUSE_LINES_PER_PAGE;
  1960. }
  1961. return delta;
  1962. }
  1963. function isValidRotation(angle) {
  1964. return Number.isInteger(angle) && angle % 90 === 0;
  1965. }
  1966. function isValidScrollMode(mode) {
  1967. return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
  1968. }
  1969. function isValidSpreadMode(mode) {
  1970. return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
  1971. }
  1972. function isPortraitOrientation(size) {
  1973. return size.width <= size.height;
  1974. }
  1975. var animationStarted = new Promise(function (resolve) {
  1976. window.requestAnimationFrame(resolve);
  1977. });
  1978. exports.animationStarted = animationStarted;
  1979. function clamp(v, min, max) {
  1980. return Math.min(Math.max(v, min), max);
  1981. }
  1982. var _updateBar = /*#__PURE__*/new WeakSet();
  1983. var ProgressBar = /*#__PURE__*/function () {
  1984. function ProgressBar(id) {
  1985. _classCallCheck(this, ProgressBar);
  1986. _classPrivateMethodInitSpec(this, _updateBar);
  1987. if (arguments.length > 1) {
  1988. throw new Error("ProgressBar no longer accepts any additional options, " + "please use CSS rules to modify its appearance instead.");
  1989. }
  1990. this.visible = true;
  1991. this.div = document.querySelector(id + " .progress");
  1992. this.bar = this.div.parentNode;
  1993. this.percent = 0;
  1994. }
  1995. _createClass(ProgressBar, [{
  1996. key: "percent",
  1997. get: function get() {
  1998. return this._percent;
  1999. },
  2000. set: function set(val) {
  2001. this._indeterminate = isNaN(val);
  2002. this._percent = clamp(val, 0, 100);
  2003. _classPrivateMethodGet(this, _updateBar, _updateBar2).call(this);
  2004. }
  2005. }, {
  2006. key: "setWidth",
  2007. value: function setWidth(viewer) {
  2008. if (!viewer) {
  2009. return;
  2010. }
  2011. var container = viewer.parentNode;
  2012. var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
  2013. if (scrollbarWidth > 0) {
  2014. var doc = document.documentElement;
  2015. doc.style.setProperty("--progressBar-end-offset", "".concat(scrollbarWidth, "px"));
  2016. }
  2017. }
  2018. }, {
  2019. key: "hide",
  2020. value: function hide() {
  2021. if (!this.visible) {
  2022. return;
  2023. }
  2024. this.visible = false;
  2025. this.bar.classList.add("hidden");
  2026. }
  2027. }, {
  2028. key: "show",
  2029. value: function show() {
  2030. if (this.visible) {
  2031. return;
  2032. }
  2033. this.visible = true;
  2034. this.bar.classList.remove("hidden");
  2035. }
  2036. }]);
  2037. return ProgressBar;
  2038. }();
  2039. exports.ProgressBar = ProgressBar;
  2040. function _updateBar2() {
  2041. if (this._indeterminate) {
  2042. this.div.classList.add("indeterminate");
  2043. return;
  2044. }
  2045. this.div.classList.remove("indeterminate");
  2046. var doc = document.documentElement;
  2047. doc.style.setProperty("--progressBar-percent", "".concat(this._percent, "%"));
  2048. }
  2049. function getActiveOrFocusedElement() {
  2050. var curRoot = document;
  2051. var curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  2052. while ((_curActiveOrFocused = curActiveOrFocused) !== null && _curActiveOrFocused !== void 0 && _curActiveOrFocused.shadowRoot) {
  2053. var _curActiveOrFocused;
  2054. curRoot = curActiveOrFocused.shadowRoot;
  2055. curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  2056. }
  2057. return curActiveOrFocused;
  2058. }
  2059. function apiPageLayoutToViewerModes(layout) {
  2060. var scrollMode = ScrollMode.VERTICAL,
  2061. spreadMode = SpreadMode.NONE;
  2062. switch (layout) {
  2063. case "SinglePage":
  2064. scrollMode = ScrollMode.PAGE;
  2065. break;
  2066. case "OneColumn":
  2067. break;
  2068. case "TwoPageLeft":
  2069. scrollMode = ScrollMode.PAGE;
  2070. case "TwoColumnLeft":
  2071. spreadMode = SpreadMode.ODD;
  2072. break;
  2073. case "TwoPageRight":
  2074. scrollMode = ScrollMode.PAGE;
  2075. case "TwoColumnRight":
  2076. spreadMode = SpreadMode.EVEN;
  2077. break;
  2078. }
  2079. return {
  2080. scrollMode: scrollMode,
  2081. spreadMode: spreadMode
  2082. };
  2083. }
  2084. function apiPageModeToSidebarView(mode) {
  2085. switch (mode) {
  2086. case "UseNone":
  2087. return SidebarView.NONE;
  2088. case "UseThumbs":
  2089. return SidebarView.THUMBS;
  2090. case "UseOutlines":
  2091. return SidebarView.OUTLINE;
  2092. case "UseAttachments":
  2093. return SidebarView.ATTACHMENTS;
  2094. case "UseOC":
  2095. return SidebarView.LAYERS;
  2096. }
  2097. return SidebarView.NONE;
  2098. }
  2099. /***/ }),
  2100. /* 9 */
  2101. /***/ ((__unused_webpack_module, exports) => {
  2102. Object.defineProperty(exports, "__esModule", ({
  2103. value: true
  2104. }));
  2105. exports.StructTreeLayerBuilder = void 0;
  2106. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  2107. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  2108. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  2109. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2110. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2111. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2112. var PDF_ROLE_TO_HTML_ROLE = {
  2113. Document: null,
  2114. DocumentFragment: null,
  2115. Part: "group",
  2116. Sect: "group",
  2117. Div: "group",
  2118. Aside: "note",
  2119. NonStruct: "none",
  2120. P: null,
  2121. H: "heading",
  2122. Title: null,
  2123. FENote: "note",
  2124. Sub: "group",
  2125. Lbl: null,
  2126. Span: null,
  2127. Em: null,
  2128. Strong: null,
  2129. Link: "link",
  2130. Annot: "note",
  2131. Form: "form",
  2132. Ruby: null,
  2133. RB: null,
  2134. RT: null,
  2135. RP: null,
  2136. Warichu: null,
  2137. WT: null,
  2138. WP: null,
  2139. L: "list",
  2140. LI: "listitem",
  2141. LBody: null,
  2142. Table: "table",
  2143. TR: "row",
  2144. TH: "columnheader",
  2145. TD: "cell",
  2146. THead: "columnheader",
  2147. TBody: null,
  2148. TFoot: null,
  2149. Caption: null,
  2150. Figure: "figure",
  2151. Formula: null,
  2152. Artifact: null
  2153. };
  2154. var HEADING_PATTERN = /^H(\d+)$/;
  2155. var StructTreeLayerBuilder = /*#__PURE__*/function () {
  2156. function StructTreeLayerBuilder(_ref) {
  2157. var pdfPage = _ref.pdfPage;
  2158. _classCallCheck(this, StructTreeLayerBuilder);
  2159. this.pdfPage = pdfPage;
  2160. }
  2161. _createClass(StructTreeLayerBuilder, [{
  2162. key: "render",
  2163. value: function render(structTree) {
  2164. return this._walk(structTree);
  2165. }
  2166. }, {
  2167. key: "_setAttributes",
  2168. value: function _setAttributes(structElement, htmlElement) {
  2169. if (structElement.alt !== undefined) {
  2170. htmlElement.setAttribute("aria-label", structElement.alt);
  2171. }
  2172. if (structElement.id !== undefined) {
  2173. htmlElement.setAttribute("aria-owns", structElement.id);
  2174. }
  2175. if (structElement.lang !== undefined) {
  2176. htmlElement.setAttribute("lang", structElement.lang);
  2177. }
  2178. }
  2179. }, {
  2180. key: "_walk",
  2181. value: function _walk(node) {
  2182. if (!node) {
  2183. return null;
  2184. }
  2185. var element = document.createElement("span");
  2186. if ("role" in node) {
  2187. var role = node.role;
  2188. var match = role.match(HEADING_PATTERN);
  2189. if (match) {
  2190. element.setAttribute("role", "heading");
  2191. element.setAttribute("aria-level", match[1]);
  2192. } else if (PDF_ROLE_TO_HTML_ROLE[role]) {
  2193. element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
  2194. }
  2195. }
  2196. this._setAttributes(node, element);
  2197. if (node.children) {
  2198. if (node.children.length === 1 && "id" in node.children[0]) {
  2199. this._setAttributes(node.children[0], element);
  2200. } else {
  2201. var _iterator = _createForOfIteratorHelper(node.children),
  2202. _step;
  2203. try {
  2204. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2205. var kid = _step.value;
  2206. element.appendChild(this._walk(kid));
  2207. }
  2208. } catch (err) {
  2209. _iterator.e(err);
  2210. } finally {
  2211. _iterator.f();
  2212. }
  2213. }
  2214. }
  2215. return element;
  2216. }
  2217. }]);
  2218. return StructTreeLayerBuilder;
  2219. }();
  2220. exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
  2221. /***/ }),
  2222. /* 10 */
  2223. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2224. Object.defineProperty(exports, "__esModule", ({
  2225. value: true
  2226. }));
  2227. exports.TextLayerBuilder = void 0;
  2228. var _pdfjsLib = __w_pdfjs_require__(5);
  2229. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2230. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2231. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2232. var EXPAND_DIVS_TIMEOUT = 300;
  2233. var TextLayerBuilder = /*#__PURE__*/function () {
  2234. function TextLayerBuilder(_ref) {
  2235. var textLayerDiv = _ref.textLayerDiv,
  2236. eventBus = _ref.eventBus,
  2237. pageIndex = _ref.pageIndex,
  2238. viewport = _ref.viewport,
  2239. _ref$highlighter = _ref.highlighter,
  2240. highlighter = _ref$highlighter === void 0 ? null : _ref$highlighter,
  2241. _ref$enhanceTextSelec = _ref.enhanceTextSelection,
  2242. enhanceTextSelection = _ref$enhanceTextSelec === void 0 ? false : _ref$enhanceTextSelec;
  2243. _classCallCheck(this, TextLayerBuilder);
  2244. this.textLayerDiv = textLayerDiv;
  2245. this.eventBus = eventBus;
  2246. this.textContent = null;
  2247. this.textContentItemsStr = [];
  2248. this.textContentStream = null;
  2249. this.renderingDone = false;
  2250. this.pageNumber = pageIndex + 1;
  2251. this.viewport = viewport;
  2252. this.textDivs = [];
  2253. this.textLayerRenderTask = null;
  2254. this.highlighter = highlighter;
  2255. this.enhanceTextSelection = enhanceTextSelection;
  2256. this._bindMouse();
  2257. }
  2258. _createClass(TextLayerBuilder, [{
  2259. key: "_finishRendering",
  2260. value: function _finishRendering() {
  2261. this.renderingDone = true;
  2262. if (!this.enhanceTextSelection) {
  2263. var endOfContent = document.createElement("div");
  2264. endOfContent.className = "endOfContent";
  2265. this.textLayerDiv.appendChild(endOfContent);
  2266. }
  2267. this.eventBus.dispatch("textlayerrendered", {
  2268. source: this,
  2269. pageNumber: this.pageNumber,
  2270. numTextDivs: this.textDivs.length
  2271. });
  2272. }
  2273. }, {
  2274. key: "render",
  2275. value: function render() {
  2276. var _this$highlighter,
  2277. _this = this;
  2278. var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  2279. if (!(this.textContent || this.textContentStream) || this.renderingDone) {
  2280. return;
  2281. }
  2282. this.cancel();
  2283. this.textDivs.length = 0;
  2284. (_this$highlighter = this.highlighter) === null || _this$highlighter === void 0 ? void 0 : _this$highlighter.setTextMapping(this.textDivs, this.textContentItemsStr);
  2285. var textLayerFrag = document.createDocumentFragment();
  2286. this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
  2287. textContent: this.textContent,
  2288. textContentStream: this.textContentStream,
  2289. container: textLayerFrag,
  2290. viewport: this.viewport,
  2291. textDivs: this.textDivs,
  2292. textContentItemsStr: this.textContentItemsStr,
  2293. timeout: timeout,
  2294. enhanceTextSelection: this.enhanceTextSelection
  2295. });
  2296. this.textLayerRenderTask.promise.then(function () {
  2297. var _this$highlighter2;
  2298. _this.textLayerDiv.appendChild(textLayerFrag);
  2299. _this._finishRendering();
  2300. (_this$highlighter2 = _this.highlighter) === null || _this$highlighter2 === void 0 ? void 0 : _this$highlighter2.enable();
  2301. }, function (reason) {});
  2302. }
  2303. }, {
  2304. key: "cancel",
  2305. value: function cancel() {
  2306. var _this$highlighter3;
  2307. if (this.textLayerRenderTask) {
  2308. this.textLayerRenderTask.cancel();
  2309. this.textLayerRenderTask = null;
  2310. }
  2311. (_this$highlighter3 = this.highlighter) === null || _this$highlighter3 === void 0 ? void 0 : _this$highlighter3.disable();
  2312. }
  2313. }, {
  2314. key: "setTextContentStream",
  2315. value: function setTextContentStream(readableStream) {
  2316. this.cancel();
  2317. this.textContentStream = readableStream;
  2318. }
  2319. }, {
  2320. key: "setTextContent",
  2321. value: function setTextContent(textContent) {
  2322. this.cancel();
  2323. this.textContent = textContent;
  2324. }
  2325. }, {
  2326. key: "_bindMouse",
  2327. value: function _bindMouse() {
  2328. var _this2 = this;
  2329. var div = this.textLayerDiv;
  2330. var expandDivsTimer = null;
  2331. div.addEventListener("mousedown", function (evt) {
  2332. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2333. _this2.textLayerRenderTask.expandTextDivs(true);
  2334. if (expandDivsTimer) {
  2335. clearTimeout(expandDivsTimer);
  2336. expandDivsTimer = null;
  2337. }
  2338. return;
  2339. }
  2340. var end = div.querySelector(".endOfContent");
  2341. if (!end) {
  2342. return;
  2343. }
  2344. var adjustTop = evt.target !== div;
  2345. adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
  2346. if (adjustTop) {
  2347. var divBounds = div.getBoundingClientRect();
  2348. var r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
  2349. end.style.top = (r * 100).toFixed(2) + "%";
  2350. }
  2351. end.classList.add("active");
  2352. });
  2353. div.addEventListener("mouseup", function () {
  2354. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2355. expandDivsTimer = setTimeout(function () {
  2356. if (_this2.textLayerRenderTask) {
  2357. _this2.textLayerRenderTask.expandTextDivs(false);
  2358. }
  2359. expandDivsTimer = null;
  2360. }, EXPAND_DIVS_TIMEOUT);
  2361. return;
  2362. }
  2363. var end = div.querySelector(".endOfContent");
  2364. if (!end) {
  2365. return;
  2366. }
  2367. end.style.top = "";
  2368. end.classList.remove("active");
  2369. });
  2370. }
  2371. }]);
  2372. return TextLayerBuilder;
  2373. }();
  2374. exports.TextLayerBuilder = TextLayerBuilder;
  2375. /***/ }),
  2376. /* 11 */
  2377. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2378. Object.defineProperty(exports, "__esModule", ({
  2379. value: true
  2380. }));
  2381. exports.XfaLayerBuilder = void 0;
  2382. var _pdfjsLib = __w_pdfjs_require__(5);
  2383. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2384. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2385. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2386. var XfaLayerBuilder = /*#__PURE__*/function () {
  2387. function XfaLayerBuilder(_ref) {
  2388. var pageDiv = _ref.pageDiv,
  2389. pdfPage = _ref.pdfPage,
  2390. _ref$annotationStorag = _ref.annotationStorage,
  2391. annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
  2392. linkService = _ref.linkService,
  2393. _ref$xfaHtml = _ref.xfaHtml,
  2394. xfaHtml = _ref$xfaHtml === void 0 ? null : _ref$xfaHtml;
  2395. _classCallCheck(this, XfaLayerBuilder);
  2396. this.pageDiv = pageDiv;
  2397. this.pdfPage = pdfPage;
  2398. this.annotationStorage = annotationStorage;
  2399. this.linkService = linkService;
  2400. this.xfaHtml = xfaHtml;
  2401. this.div = null;
  2402. this._cancelled = false;
  2403. }
  2404. _createClass(XfaLayerBuilder, [{
  2405. key: "render",
  2406. value: function render(viewport) {
  2407. var _this = this;
  2408. var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "display";
  2409. if (intent === "print") {
  2410. var parameters = {
  2411. viewport: viewport.clone({
  2412. dontFlip: true
  2413. }),
  2414. div: this.div,
  2415. xfaHtml: this.xfaHtml,
  2416. annotationStorage: this.annotationStorage,
  2417. linkService: this.linkService,
  2418. intent: intent
  2419. };
  2420. var div = document.createElement("div");
  2421. this.pageDiv.appendChild(div);
  2422. parameters.div = div;
  2423. var result = _pdfjsLib.XfaLayer.render(parameters);
  2424. return Promise.resolve(result);
  2425. }
  2426. return this.pdfPage.getXfa().then(function (xfaHtml) {
  2427. if (_this._cancelled || !xfaHtml) {
  2428. return {
  2429. textDivs: []
  2430. };
  2431. }
  2432. var parameters = {
  2433. viewport: viewport.clone({
  2434. dontFlip: true
  2435. }),
  2436. div: _this.div,
  2437. xfaHtml: xfaHtml,
  2438. annotationStorage: _this.annotationStorage,
  2439. linkService: _this.linkService,
  2440. intent: intent
  2441. };
  2442. if (_this.div) {
  2443. return _pdfjsLib.XfaLayer.update(parameters);
  2444. }
  2445. _this.div = document.createElement("div");
  2446. _this.pageDiv.appendChild(_this.div);
  2447. parameters.div = _this.div;
  2448. return _pdfjsLib.XfaLayer.render(parameters);
  2449. })["catch"](function (error) {
  2450. console.error(error);
  2451. });
  2452. }
  2453. }, {
  2454. key: "cancel",
  2455. value: function cancel() {
  2456. this._cancelled = true;
  2457. }
  2458. }, {
  2459. key: "hide",
  2460. value: function hide() {
  2461. if (!this.div) {
  2462. return;
  2463. }
  2464. this.div.hidden = true;
  2465. }
  2466. }]);
  2467. return XfaLayerBuilder;
  2468. }();
  2469. exports.XfaLayerBuilder = XfaLayerBuilder;
  2470. /***/ }),
  2471. /* 12 */
  2472. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2473. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  2474. Object.defineProperty(exports, "__esModule", ({
  2475. value: true
  2476. }));
  2477. exports.PDFViewer = exports.PDFSinglePageViewer = void 0;
  2478. var _ui_utils = __w_pdfjs_require__(8);
  2479. var _base_viewer = __w_pdfjs_require__(13);
  2480. function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
  2481. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  2482. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2483. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2484. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2485. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  2486. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  2487. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  2488. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  2489. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  2490. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  2491. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  2492. var PDFViewer = /*#__PURE__*/function (_BaseViewer) {
  2493. _inherits(PDFViewer, _BaseViewer);
  2494. var _super = _createSuper(PDFViewer);
  2495. function PDFViewer() {
  2496. _classCallCheck(this, PDFViewer);
  2497. return _super.apply(this, arguments);
  2498. }
  2499. return _createClass(PDFViewer);
  2500. }(_base_viewer.BaseViewer);
  2501. exports.PDFViewer = PDFViewer;
  2502. var PDFSinglePageViewer = /*#__PURE__*/function (_BaseViewer2) {
  2503. _inherits(PDFSinglePageViewer, _BaseViewer2);
  2504. var _super2 = _createSuper(PDFSinglePageViewer);
  2505. function PDFSinglePageViewer() {
  2506. _classCallCheck(this, PDFSinglePageViewer);
  2507. return _super2.apply(this, arguments);
  2508. }
  2509. _createClass(PDFSinglePageViewer, [{
  2510. key: "_resetView",
  2511. value: function _resetView() {
  2512. _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_resetView", this).call(this);
  2513. this._scrollMode = _ui_utils.ScrollMode.PAGE;
  2514. this._spreadMode = _ui_utils.SpreadMode.NONE;
  2515. }
  2516. }, {
  2517. key: "scrollMode",
  2518. set: function set(mode) {}
  2519. }, {
  2520. key: "_updateScrollMode",
  2521. value: function _updateScrollMode() {}
  2522. }, {
  2523. key: "spreadMode",
  2524. set: function set(mode) {}
  2525. }, {
  2526. key: "_updateSpreadMode",
  2527. value: function _updateSpreadMode() {}
  2528. }]);
  2529. return PDFSinglePageViewer;
  2530. }(_base_viewer.BaseViewer);
  2531. exports.PDFSinglePageViewer = PDFSinglePageViewer;
  2532. /***/ }),
  2533. /* 13 */
  2534. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2535. Object.defineProperty(exports, "__esModule", ({
  2536. value: true
  2537. }));
  2538. exports.PagesCountLimit = exports.PDFPageViewBuffer = exports.BaseViewer = void 0;
  2539. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  2540. var _pdfjsLib = __w_pdfjs_require__(5);
  2541. var _ui_utils = __w_pdfjs_require__(8);
  2542. var _annotation_layer_builder = __w_pdfjs_require__(2);
  2543. var _l10n_utils = __w_pdfjs_require__(6);
  2544. var _pdf_page_view = __w_pdfjs_require__(14);
  2545. var _pdf_rendering_queue = __w_pdfjs_require__(16);
  2546. var _pdf_link_service = __w_pdfjs_require__(7);
  2547. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  2548. var _text_highlighter = __w_pdfjs_require__(17);
  2549. var _text_layer_builder = __w_pdfjs_require__(10);
  2550. var _xfa_layer_builder = __w_pdfjs_require__(11);
  2551. var _Symbol$iterator;
  2552. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2553. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  2554. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  2555. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  2556. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  2557. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  2558. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  2559. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  2560. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  2561. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  2562. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2563. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2564. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  2565. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  2566. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  2567. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  2568. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  2569. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  2570. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  2571. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  2572. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  2573. function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
  2574. var DEFAULT_CACHE_SIZE = 10;
  2575. var ENABLE_PERMISSIONS_CLASS = "enablePermissions";
  2576. var PagesCountLimit = {
  2577. FORCE_SCROLL_MODE_PAGE: 15000,
  2578. FORCE_LAZY_PAGE_INIT: 7500,
  2579. PAUSE_EAGER_PAGE_INIT: 250
  2580. };
  2581. exports.PagesCountLimit = PagesCountLimit;
  2582. var _buf = /*#__PURE__*/new WeakMap();
  2583. var _size = /*#__PURE__*/new WeakMap();
  2584. var _destroyFirstView = /*#__PURE__*/new WeakSet();
  2585. _Symbol$iterator = Symbol.iterator;
  2586. var PDFPageViewBuffer = /*#__PURE__*/function () {
  2587. function PDFPageViewBuffer(size) {
  2588. _classCallCheck(this, PDFPageViewBuffer);
  2589. _classPrivateMethodInitSpec(this, _destroyFirstView);
  2590. _classPrivateFieldInitSpec(this, _buf, {
  2591. writable: true,
  2592. value: new Set()
  2593. });
  2594. _classPrivateFieldInitSpec(this, _size, {
  2595. writable: true,
  2596. value: 0
  2597. });
  2598. _classPrivateFieldSet(this, _size, size);
  2599. }
  2600. _createClass(PDFPageViewBuffer, [{
  2601. key: "push",
  2602. value: function push(view) {
  2603. var buf = _classPrivateFieldGet(this, _buf);
  2604. if (buf.has(view)) {
  2605. buf["delete"](view);
  2606. }
  2607. buf.add(view);
  2608. if (buf.size > _classPrivateFieldGet(this, _size)) {
  2609. _classPrivateMethodGet(this, _destroyFirstView, _destroyFirstView2).call(this);
  2610. }
  2611. }
  2612. }, {
  2613. key: "resize",
  2614. value: function resize(newSize) {
  2615. var idsToKeep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  2616. _classPrivateFieldSet(this, _size, newSize);
  2617. var buf = _classPrivateFieldGet(this, _buf);
  2618. if (idsToKeep) {
  2619. var ii = buf.size;
  2620. var i = 1;
  2621. var _iterator = _createForOfIteratorHelper(buf),
  2622. _step;
  2623. try {
  2624. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2625. var view = _step.value;
  2626. if (idsToKeep.has(view.id)) {
  2627. buf["delete"](view);
  2628. buf.add(view);
  2629. }
  2630. if (++i > ii) {
  2631. break;
  2632. }
  2633. }
  2634. } catch (err) {
  2635. _iterator.e(err);
  2636. } finally {
  2637. _iterator.f();
  2638. }
  2639. }
  2640. while (buf.size > _classPrivateFieldGet(this, _size)) {
  2641. _classPrivateMethodGet(this, _destroyFirstView, _destroyFirstView2).call(this);
  2642. }
  2643. }
  2644. }, {
  2645. key: "has",
  2646. value: function has(view) {
  2647. return _classPrivateFieldGet(this, _buf).has(view);
  2648. }
  2649. }, {
  2650. key: _Symbol$iterator,
  2651. value: function value() {
  2652. return _classPrivateFieldGet(this, _buf).keys();
  2653. }
  2654. }]);
  2655. return PDFPageViewBuffer;
  2656. }();
  2657. exports.PDFPageViewBuffer = PDFPageViewBuffer;
  2658. function _destroyFirstView2() {
  2659. var firstView = _classPrivateFieldGet(this, _buf).keys().next().value;
  2660. firstView === null || firstView === void 0 ? void 0 : firstView.destroy();
  2661. _classPrivateFieldGet(this, _buf)["delete"](firstView);
  2662. }
  2663. var _buffer = /*#__PURE__*/new WeakMap();
  2664. var _annotationMode = /*#__PURE__*/new WeakMap();
  2665. var _previousAnnotationMode = /*#__PURE__*/new WeakMap();
  2666. var _enablePermissions = /*#__PURE__*/new WeakMap();
  2667. var _previousContainerHeight = /*#__PURE__*/new WeakMap();
  2668. var _scrollModePageState = /*#__PURE__*/new WeakMap();
  2669. var _onVisibilityChange = /*#__PURE__*/new WeakMap();
  2670. var _initializePermissions = /*#__PURE__*/new WeakSet();
  2671. var _onePageRenderedOrForceFetch = /*#__PURE__*/new WeakSet();
  2672. var _ensurePageViewVisible = /*#__PURE__*/new WeakSet();
  2673. var _scrollIntoView = /*#__PURE__*/new WeakSet();
  2674. var _isSameScale = /*#__PURE__*/new WeakSet();
  2675. var _resetCurrentPageView = /*#__PURE__*/new WeakSet();
  2676. var _ensurePdfPageLoaded = /*#__PURE__*/new WeakSet();
  2677. var _getScrollAhead = /*#__PURE__*/new WeakSet();
  2678. var _toggleLoadingIconSpinner = /*#__PURE__*/new WeakSet();
  2679. var BaseViewer = /*#__PURE__*/function () {
  2680. function BaseViewer(options) {
  2681. var _this$container,
  2682. _this$viewer,
  2683. _options$textLayerMod,
  2684. _options$annotationMo,
  2685. _this = this;
  2686. _classCallCheck(this, BaseViewer);
  2687. _classPrivateMethodInitSpec(this, _toggleLoadingIconSpinner);
  2688. _classPrivateMethodInitSpec(this, _getScrollAhead);
  2689. _classPrivateMethodInitSpec(this, _ensurePdfPageLoaded);
  2690. _classPrivateMethodInitSpec(this, _resetCurrentPageView);
  2691. _classPrivateMethodInitSpec(this, _isSameScale);
  2692. _classPrivateMethodInitSpec(this, _scrollIntoView);
  2693. _classPrivateMethodInitSpec(this, _ensurePageViewVisible);
  2694. _classPrivateMethodInitSpec(this, _onePageRenderedOrForceFetch);
  2695. _classPrivateMethodInitSpec(this, _initializePermissions);
  2696. _classPrivateFieldInitSpec(this, _buffer, {
  2697. writable: true,
  2698. value: null
  2699. });
  2700. _classPrivateFieldInitSpec(this, _annotationMode, {
  2701. writable: true,
  2702. value: _pdfjsLib.AnnotationMode.ENABLE_FORMS
  2703. });
  2704. _classPrivateFieldInitSpec(this, _previousAnnotationMode, {
  2705. writable: true,
  2706. value: null
  2707. });
  2708. _classPrivateFieldInitSpec(this, _enablePermissions, {
  2709. writable: true,
  2710. value: false
  2711. });
  2712. _classPrivateFieldInitSpec(this, _previousContainerHeight, {
  2713. writable: true,
  2714. value: 0
  2715. });
  2716. _classPrivateFieldInitSpec(this, _scrollModePageState, {
  2717. writable: true,
  2718. value: null
  2719. });
  2720. _classPrivateFieldInitSpec(this, _onVisibilityChange, {
  2721. writable: true,
  2722. value: null
  2723. });
  2724. if (this.constructor === BaseViewer) {
  2725. throw new Error("Cannot initialize BaseViewer.");
  2726. }
  2727. var viewerVersion = '2.14.305';
  2728. if (_pdfjsLib.version !== viewerVersion) {
  2729. throw new Error("The API version \"".concat(_pdfjsLib.version, "\" does not match the Viewer version \"").concat(viewerVersion, "\"."));
  2730. }
  2731. this.container = options.container;
  2732. this.viewer = options.viewer || options.container.firstElementChild;
  2733. if (!(((_this$container = this.container) === null || _this$container === void 0 ? void 0 : _this$container.tagName.toUpperCase()) === "DIV" && ((_this$viewer = this.viewer) === null || _this$viewer === void 0 ? void 0 : _this$viewer.tagName.toUpperCase()) === "DIV")) {
  2734. throw new Error("Invalid `container` and/or `viewer` option.");
  2735. }
  2736. if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {
  2737. throw new Error("The `container` must be absolutely positioned.");
  2738. }
  2739. this.eventBus = options.eventBus;
  2740. this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
  2741. this.downloadManager = options.downloadManager || null;
  2742. this.findController = options.findController || null;
  2743. this._scriptingManager = options.scriptingManager || null;
  2744. this.removePageBorders = options.removePageBorders || false;
  2745. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  2746. _classPrivateFieldSet(this, _annotationMode, (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS);
  2747. this.imageResourcesPath = options.imageResourcesPath || "";
  2748. this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
  2749. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  2750. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  2751. this.maxCanvasPixels = options.maxCanvasPixels;
  2752. this.l10n = options.l10n || _l10n_utils.NullL10n;
  2753. _classPrivateFieldSet(this, _enablePermissions, options.enablePermissions || false);
  2754. this.pageColors = options.pageColors || null;
  2755. if (options.pageColors && (!CSS.supports("color", options.pageColors.background) || !CSS.supports("color", options.pageColors.foreground))) {
  2756. if (options.pageColors.background || options.pageColors.foreground) {
  2757. console.warn("Ignoring `pageColors`-option, since the browser doesn't support the values used.");
  2758. }
  2759. this.pageColors = null;
  2760. }
  2761. this.defaultRenderingQueue = !options.renderingQueue;
  2762. if (this.defaultRenderingQueue) {
  2763. this.renderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
  2764. this.renderingQueue.setViewer(this);
  2765. } else {
  2766. this.renderingQueue = options.renderingQueue;
  2767. }
  2768. this._doc = document.documentElement;
  2769. this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this));
  2770. this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
  2771. this._onBeforeDraw = this._onAfterDraw = null;
  2772. this._resetView();
  2773. if (this.removePageBorders) {
  2774. this.viewer.classList.add("removePageBorders");
  2775. }
  2776. this.updateContainerHeightCss();
  2777. Promise.resolve().then(function () {
  2778. _this.eventBus.dispatch("baseviewerinit", {
  2779. source: _this
  2780. });
  2781. });
  2782. }
  2783. _createClass(BaseViewer, [{
  2784. key: "pagesCount",
  2785. get: function get() {
  2786. return this._pages.length;
  2787. }
  2788. }, {
  2789. key: "getPageView",
  2790. value: function getPageView(index) {
  2791. return this._pages[index];
  2792. }
  2793. }, {
  2794. key: "pageViewsReady",
  2795. get: function get() {
  2796. if (!this._pagesCapability.settled) {
  2797. return false;
  2798. }
  2799. return this._pages.every(function (pageView) {
  2800. return pageView === null || pageView === void 0 ? void 0 : pageView.pdfPage;
  2801. });
  2802. }
  2803. }, {
  2804. key: "renderForms",
  2805. get: function get() {
  2806. return _classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
  2807. }
  2808. }, {
  2809. key: "enableScripting",
  2810. get: function get() {
  2811. return !!this._scriptingManager;
  2812. }
  2813. }, {
  2814. key: "currentPageNumber",
  2815. get: function get() {
  2816. return this._currentPageNumber;
  2817. },
  2818. set: function set(val) {
  2819. if (!Number.isInteger(val)) {
  2820. throw new Error("Invalid page number.");
  2821. }
  2822. if (!this.pdfDocument) {
  2823. return;
  2824. }
  2825. if (!this._setCurrentPageNumber(val, true)) {
  2826. console.error("currentPageNumber: \"".concat(val, "\" is not a valid page."));
  2827. }
  2828. }
  2829. }, {
  2830. key: "_setCurrentPageNumber",
  2831. value: function _setCurrentPageNumber(val) {
  2832. var _this$_pageLabels, _this$_pageLabels2;
  2833. var resetCurrentPageView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2834. if (this._currentPageNumber === val) {
  2835. if (resetCurrentPageView) {
  2836. _classPrivateMethodGet(this, _resetCurrentPageView, _resetCurrentPageView2).call(this);
  2837. }
  2838. return true;
  2839. }
  2840. if (!(0 < val && val <= this.pagesCount)) {
  2841. return false;
  2842. }
  2843. var previous = this._currentPageNumber;
  2844. this._currentPageNumber = val;
  2845. this.eventBus.dispatch("pagechanging", {
  2846. source: this,
  2847. pageNumber: val,
  2848. pageLabel: (_this$_pageLabels = (_this$_pageLabels2 = this._pageLabels) === null || _this$_pageLabels2 === void 0 ? void 0 : _this$_pageLabels2[val - 1]) !== null && _this$_pageLabels !== void 0 ? _this$_pageLabels : null,
  2849. previous: previous
  2850. });
  2851. if (resetCurrentPageView) {
  2852. _classPrivateMethodGet(this, _resetCurrentPageView, _resetCurrentPageView2).call(this);
  2853. }
  2854. return true;
  2855. }
  2856. }, {
  2857. key: "currentPageLabel",
  2858. get: function get() {
  2859. var _this$_pageLabels3, _this$_pageLabels4;
  2860. return (_this$_pageLabels3 = (_this$_pageLabels4 = this._pageLabels) === null || _this$_pageLabels4 === void 0 ? void 0 : _this$_pageLabels4[this._currentPageNumber - 1]) !== null && _this$_pageLabels3 !== void 0 ? _this$_pageLabels3 : null;
  2861. },
  2862. set: function set(val) {
  2863. if (!this.pdfDocument) {
  2864. return;
  2865. }
  2866. var page = val | 0;
  2867. if (this._pageLabels) {
  2868. var i = this._pageLabels.indexOf(val);
  2869. if (i >= 0) {
  2870. page = i + 1;
  2871. }
  2872. }
  2873. if (!this._setCurrentPageNumber(page, true)) {
  2874. console.error("currentPageLabel: \"".concat(val, "\" is not a valid page."));
  2875. }
  2876. }
  2877. }, {
  2878. key: "currentScale",
  2879. get: function get() {
  2880. return this._currentScale !== _ui_utils.UNKNOWN_SCALE ? this._currentScale : _ui_utils.DEFAULT_SCALE;
  2881. },
  2882. set: function set(val) {
  2883. if (isNaN(val)) {
  2884. throw new Error("Invalid numeric scale.");
  2885. }
  2886. if (!this.pdfDocument) {
  2887. return;
  2888. }
  2889. this._setScale(val, false);
  2890. }
  2891. }, {
  2892. key: "currentScaleValue",
  2893. get: function get() {
  2894. return this._currentScaleValue;
  2895. },
  2896. set: function set(val) {
  2897. if (!this.pdfDocument) {
  2898. return;
  2899. }
  2900. this._setScale(val, false);
  2901. }
  2902. }, {
  2903. key: "pagesRotation",
  2904. get: function get() {
  2905. return this._pagesRotation;
  2906. },
  2907. set: function set(rotation) {
  2908. if (!(0, _ui_utils.isValidRotation)(rotation)) {
  2909. throw new Error("Invalid pages rotation angle.");
  2910. }
  2911. if (!this.pdfDocument) {
  2912. return;
  2913. }
  2914. rotation %= 360;
  2915. if (rotation < 0) {
  2916. rotation += 360;
  2917. }
  2918. if (this._pagesRotation === rotation) {
  2919. return;
  2920. }
  2921. this._pagesRotation = rotation;
  2922. var pageNumber = this._currentPageNumber;
  2923. var updateArgs = {
  2924. rotation: rotation
  2925. };
  2926. var _iterator2 = _createForOfIteratorHelper(this._pages),
  2927. _step2;
  2928. try {
  2929. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  2930. var pageView = _step2.value;
  2931. pageView.update(updateArgs);
  2932. }
  2933. } catch (err) {
  2934. _iterator2.e(err);
  2935. } finally {
  2936. _iterator2.f();
  2937. }
  2938. if (this._currentScaleValue) {
  2939. this._setScale(this._currentScaleValue, true);
  2940. }
  2941. this.eventBus.dispatch("rotationchanging", {
  2942. source: this,
  2943. pagesRotation: rotation,
  2944. pageNumber: pageNumber
  2945. });
  2946. if (this.defaultRenderingQueue) {
  2947. this.update();
  2948. }
  2949. }
  2950. }, {
  2951. key: "firstPagePromise",
  2952. get: function get() {
  2953. return this.pdfDocument ? this._firstPageCapability.promise : null;
  2954. }
  2955. }, {
  2956. key: "onePageRendered",
  2957. get: function get() {
  2958. return this.pdfDocument ? this._onePageRenderedCapability.promise : null;
  2959. }
  2960. }, {
  2961. key: "pagesPromise",
  2962. get: function get() {
  2963. return this.pdfDocument ? this._pagesCapability.promise : null;
  2964. }
  2965. }, {
  2966. key: "setDocument",
  2967. value: function setDocument(pdfDocument) {
  2968. var _this2 = this;
  2969. if (this.pdfDocument) {
  2970. this.eventBus.dispatch("pagesdestroy", {
  2971. source: this
  2972. });
  2973. this._cancelRendering();
  2974. this._resetView();
  2975. if (this.findController) {
  2976. this.findController.setDocument(null);
  2977. }
  2978. if (this._scriptingManager) {
  2979. this._scriptingManager.setDocument(null);
  2980. }
  2981. }
  2982. this.pdfDocument = pdfDocument;
  2983. if (!pdfDocument) {
  2984. return;
  2985. }
  2986. var isPureXfa = pdfDocument.isPureXfa;
  2987. var pagesCount = pdfDocument.numPages;
  2988. var firstPagePromise = pdfDocument.getPage(1);
  2989. var optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
  2990. var permissionsPromise = _classPrivateFieldGet(this, _enablePermissions) ? pdfDocument.getPermissions() : Promise.resolve();
  2991. if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
  2992. console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");
  2993. var mode = this._scrollMode = _ui_utils.ScrollMode.PAGE;
  2994. this.eventBus.dispatch("scrollmodechanged", {
  2995. source: this,
  2996. mode: mode
  2997. });
  2998. }
  2999. this._pagesCapability.promise.then(function () {
  3000. _this2.eventBus.dispatch("pagesloaded", {
  3001. source: _this2,
  3002. pagesCount: pagesCount
  3003. });
  3004. }, function () {});
  3005. this._onBeforeDraw = function (evt) {
  3006. var pageView = _this2._pages[evt.pageNumber - 1];
  3007. if (!pageView) {
  3008. return;
  3009. }
  3010. _classPrivateFieldGet(_this2, _buffer).push(pageView);
  3011. };
  3012. this.eventBus._on("pagerender", this._onBeforeDraw);
  3013. this._onAfterDraw = function (evt) {
  3014. if (evt.cssTransform || _this2._onePageRenderedCapability.settled) {
  3015. return;
  3016. }
  3017. _this2._onePageRenderedCapability.resolve({
  3018. timestamp: evt.timestamp
  3019. });
  3020. _this2.eventBus._off("pagerendered", _this2._onAfterDraw);
  3021. _this2._onAfterDraw = null;
  3022. if (_classPrivateFieldGet(_this2, _onVisibilityChange)) {
  3023. document.removeEventListener("visibilitychange", _classPrivateFieldGet(_this2, _onVisibilityChange));
  3024. _classPrivateFieldSet(_this2, _onVisibilityChange, null);
  3025. }
  3026. };
  3027. this.eventBus._on("pagerendered", this._onAfterDraw);
  3028. Promise.all([firstPagePromise, permissionsPromise]).then(function (_ref) {
  3029. var _ref2 = _slicedToArray(_ref, 2),
  3030. firstPdfPage = _ref2[0],
  3031. permissions = _ref2[1];
  3032. if (pdfDocument !== _this2.pdfDocument) {
  3033. return;
  3034. }
  3035. _this2._firstPageCapability.resolve(firstPdfPage);
  3036. _this2._optionalContentConfigPromise = optionalContentConfigPromise;
  3037. _classPrivateMethodGet(_this2, _initializePermissions, _initializePermissions2).call(_this2, permissions);
  3038. var viewerElement = _this2._scrollMode === _ui_utils.ScrollMode.PAGE ? null : _this2.viewer;
  3039. var scale = _this2.currentScale;
  3040. var viewport = firstPdfPage.getViewport({
  3041. scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  3042. });
  3043. var textLayerFactory = _this2.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? _this2 : null;
  3044. var annotationLayerFactory = _classPrivateFieldGet(_this2, _annotationMode) !== _pdfjsLib.AnnotationMode.DISABLE ? _this2 : null;
  3045. var xfaLayerFactory = isPureXfa ? _this2 : null;
  3046. for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
  3047. var pageView = new _pdf_page_view.PDFPageView({
  3048. container: viewerElement,
  3049. eventBus: _this2.eventBus,
  3050. id: pageNum,
  3051. scale: scale,
  3052. defaultViewport: viewport.clone(),
  3053. optionalContentConfigPromise: optionalContentConfigPromise,
  3054. renderingQueue: _this2.renderingQueue,
  3055. textLayerFactory: textLayerFactory,
  3056. textLayerMode: _this2.textLayerMode,
  3057. annotationLayerFactory: annotationLayerFactory,
  3058. annotationMode: _classPrivateFieldGet(_this2, _annotationMode),
  3059. xfaLayerFactory: xfaLayerFactory,
  3060. textHighlighterFactory: _this2,
  3061. structTreeLayerFactory: _this2,
  3062. imageResourcesPath: _this2.imageResourcesPath,
  3063. renderer: _this2.renderer,
  3064. useOnlyCssZoom: _this2.useOnlyCssZoom,
  3065. maxCanvasPixels: _this2.maxCanvasPixels,
  3066. pageColors: _this2.pageColors,
  3067. l10n: _this2.l10n
  3068. });
  3069. _this2._pages.push(pageView);
  3070. }
  3071. var firstPageView = _this2._pages[0];
  3072. if (firstPageView) {
  3073. firstPageView.setPdfPage(firstPdfPage);
  3074. _this2.linkService.cachePageRef(1, firstPdfPage.ref);
  3075. }
  3076. if (_this2._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3077. _classPrivateMethodGet(_this2, _ensurePageViewVisible, _ensurePageViewVisible2).call(_this2);
  3078. } else if (_this2._spreadMode !== _ui_utils.SpreadMode.NONE) {
  3079. _this2._updateSpreadMode();
  3080. }
  3081. _classPrivateMethodGet(_this2, _onePageRenderedOrForceFetch, _onePageRenderedOrForceFetch2).call(_this2).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  3082. var getPagesLeft, _loop, _pageNum;
  3083. return _regenerator["default"].wrap(function _callee$(_context2) {
  3084. while (1) {
  3085. switch (_context2.prev = _context2.next) {
  3086. case 0:
  3087. if (_this2.findController) {
  3088. _this2.findController.setDocument(pdfDocument);
  3089. }
  3090. if (_this2._scriptingManager) {
  3091. _this2._scriptingManager.setDocument(pdfDocument);
  3092. }
  3093. if (!(pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT)) {
  3094. _context2.next = 5;
  3095. break;
  3096. }
  3097. _this2._pagesCapability.resolve();
  3098. return _context2.abrupt("return");
  3099. case 5:
  3100. getPagesLeft = pagesCount - 1;
  3101. if (!(getPagesLeft <= 0)) {
  3102. _context2.next = 9;
  3103. break;
  3104. }
  3105. _this2._pagesCapability.resolve();
  3106. return _context2.abrupt("return");
  3107. case 9:
  3108. _loop = /*#__PURE__*/_regenerator["default"].mark(function _loop(_pageNum) {
  3109. var promise;
  3110. return _regenerator["default"].wrap(function _loop$(_context) {
  3111. while (1) {
  3112. switch (_context.prev = _context.next) {
  3113. case 0:
  3114. promise = pdfDocument.getPage(_pageNum).then(function (pdfPage) {
  3115. var pageView = _this2._pages[_pageNum - 1];
  3116. if (!pageView.pdfPage) {
  3117. pageView.setPdfPage(pdfPage);
  3118. }
  3119. _this2.linkService.cachePageRef(_pageNum, pdfPage.ref);
  3120. if (--getPagesLeft === 0) {
  3121. _this2._pagesCapability.resolve();
  3122. }
  3123. }, function (reason) {
  3124. console.error("Unable to get page ".concat(_pageNum, " to initialize viewer"), reason);
  3125. if (--getPagesLeft === 0) {
  3126. _this2._pagesCapability.resolve();
  3127. }
  3128. });
  3129. if (!(_pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0)) {
  3130. _context.next = 4;
  3131. break;
  3132. }
  3133. _context.next = 4;
  3134. return promise;
  3135. case 4:
  3136. case "end":
  3137. return _context.stop();
  3138. }
  3139. }
  3140. }, _loop);
  3141. });
  3142. _pageNum = 2;
  3143. case 11:
  3144. if (!(_pageNum <= pagesCount)) {
  3145. _context2.next = 16;
  3146. break;
  3147. }
  3148. return _context2.delegateYield(_loop(_pageNum), "t0", 13);
  3149. case 13:
  3150. ++_pageNum;
  3151. _context2.next = 11;
  3152. break;
  3153. case 16:
  3154. case "end":
  3155. return _context2.stop();
  3156. }
  3157. }
  3158. }, _callee);
  3159. })));
  3160. _this2.eventBus.dispatch("pagesinit", {
  3161. source: _this2
  3162. });
  3163. pdfDocument.getMetadata().then(function (_ref4) {
  3164. var info = _ref4.info;
  3165. if (pdfDocument !== _this2.pdfDocument) {
  3166. return;
  3167. }
  3168. if (info.Language) {
  3169. _this2.viewer.lang = info.Language;
  3170. }
  3171. });
  3172. if (_this2.defaultRenderingQueue) {
  3173. _this2.update();
  3174. }
  3175. })["catch"](function (reason) {
  3176. console.error("Unable to initialize viewer", reason);
  3177. _this2._pagesCapability.reject(reason);
  3178. });
  3179. }
  3180. }, {
  3181. key: "setPageLabels",
  3182. value: function setPageLabels(labels) {
  3183. if (!this.pdfDocument) {
  3184. return;
  3185. }
  3186. if (!labels) {
  3187. this._pageLabels = null;
  3188. } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
  3189. this._pageLabels = null;
  3190. console.error("setPageLabels: Invalid page labels.");
  3191. } else {
  3192. this._pageLabels = labels;
  3193. }
  3194. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3195. var _this$_pageLabels$i, _this$_pageLabels5;
  3196. this._pages[i].setPageLabel((_this$_pageLabels$i = (_this$_pageLabels5 = this._pageLabels) === null || _this$_pageLabels5 === void 0 ? void 0 : _this$_pageLabels5[i]) !== null && _this$_pageLabels$i !== void 0 ? _this$_pageLabels$i : null);
  3197. }
  3198. }
  3199. }, {
  3200. key: "_resetView",
  3201. value: function _resetView() {
  3202. this._pages = [];
  3203. this._currentPageNumber = 1;
  3204. this._currentScale = _ui_utils.UNKNOWN_SCALE;
  3205. this._currentScaleValue = null;
  3206. this._pageLabels = null;
  3207. _classPrivateFieldSet(this, _buffer, new PDFPageViewBuffer(DEFAULT_CACHE_SIZE));
  3208. this._location = null;
  3209. this._pagesRotation = 0;
  3210. this._optionalContentConfigPromise = null;
  3211. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  3212. this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
  3213. this._pagesCapability = (0, _pdfjsLib.createPromiseCapability)();
  3214. this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
  3215. this._previousScrollMode = _ui_utils.ScrollMode.UNKNOWN;
  3216. this._spreadMode = _ui_utils.SpreadMode.NONE;
  3217. _classPrivateFieldSet(this, _scrollModePageState, {
  3218. previousPageNumber: 1,
  3219. scrollDown: true,
  3220. pages: []
  3221. });
  3222. if (this._onBeforeDraw) {
  3223. this.eventBus._off("pagerender", this._onBeforeDraw);
  3224. this._onBeforeDraw = null;
  3225. }
  3226. if (this._onAfterDraw) {
  3227. this.eventBus._off("pagerendered", this._onAfterDraw);
  3228. this._onAfterDraw = null;
  3229. }
  3230. if (_classPrivateFieldGet(this, _onVisibilityChange)) {
  3231. document.removeEventListener("visibilitychange", _classPrivateFieldGet(this, _onVisibilityChange));
  3232. _classPrivateFieldSet(this, _onVisibilityChange, null);
  3233. }
  3234. this.viewer.textContent = "";
  3235. this._updateScrollMode();
  3236. this.viewer.removeAttribute("lang");
  3237. this.viewer.classList.remove(ENABLE_PERMISSIONS_CLASS);
  3238. if (_classPrivateFieldGet(this, _previousAnnotationMode) !== null) {
  3239. _classPrivateFieldSet(this, _annotationMode, _classPrivateFieldGet(this, _previousAnnotationMode));
  3240. _classPrivateFieldSet(this, _previousAnnotationMode, null);
  3241. }
  3242. }
  3243. }, {
  3244. key: "_scrollUpdate",
  3245. value: function _scrollUpdate() {
  3246. if (this.pagesCount === 0) {
  3247. return;
  3248. }
  3249. this.update();
  3250. }
  3251. }, {
  3252. key: "_setScaleUpdatePages",
  3253. value: function _setScaleUpdatePages(newScale, newValue) {
  3254. var noScroll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3255. var preset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3256. this._currentScaleValue = newValue.toString();
  3257. if (_classPrivateMethodGet(this, _isSameScale, _isSameScale2).call(this, newScale)) {
  3258. if (preset) {
  3259. this.eventBus.dispatch("scalechanging", {
  3260. source: this,
  3261. scale: newScale,
  3262. presetValue: newValue
  3263. });
  3264. }
  3265. return;
  3266. }
  3267. this._doc.style.setProperty("--zoom-factor", newScale);
  3268. var updateArgs = {
  3269. scale: newScale
  3270. };
  3271. var _iterator3 = _createForOfIteratorHelper(this._pages),
  3272. _step3;
  3273. try {
  3274. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  3275. var pageView = _step3.value;
  3276. pageView.update(updateArgs);
  3277. }
  3278. } catch (err) {
  3279. _iterator3.e(err);
  3280. } finally {
  3281. _iterator3.f();
  3282. }
  3283. this._currentScale = newScale;
  3284. if (!noScroll) {
  3285. var page = this._currentPageNumber,
  3286. dest;
  3287. if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
  3288. page = this._location.pageNumber;
  3289. dest = [null, {
  3290. name: "XYZ"
  3291. }, this._location.left, this._location.top, null];
  3292. }
  3293. this.scrollPageIntoView({
  3294. pageNumber: page,
  3295. destArray: dest,
  3296. allowNegativeOffset: true
  3297. });
  3298. }
  3299. this.eventBus.dispatch("scalechanging", {
  3300. source: this,
  3301. scale: newScale,
  3302. presetValue: preset ? newValue : undefined
  3303. });
  3304. if (this.defaultRenderingQueue) {
  3305. this.update();
  3306. }
  3307. this.updateContainerHeightCss();
  3308. }
  3309. }, {
  3310. key: "_pageWidthScaleFactor",
  3311. get: function get() {
  3312. if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL) {
  3313. return 2;
  3314. }
  3315. return 1;
  3316. }
  3317. }, {
  3318. key: "_setScale",
  3319. value: function _setScale(value) {
  3320. var noScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3321. var scale = parseFloat(value);
  3322. if (scale > 0) {
  3323. this._setScaleUpdatePages(scale, value, noScroll, false);
  3324. } else {
  3325. var currentPage = this._pages[this._currentPageNumber - 1];
  3326. if (!currentPage) {
  3327. return;
  3328. }
  3329. var hPadding = _ui_utils.SCROLLBAR_PADDING,
  3330. vPadding = _ui_utils.VERTICAL_PADDING;
  3331. if (this.isInPresentationMode) {
  3332. hPadding = vPadding = 4;
  3333. } else if (this.removePageBorders) {
  3334. hPadding = vPadding = 0;
  3335. } else if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
  3336. var _ref5 = [vPadding, hPadding];
  3337. hPadding = _ref5[0];
  3338. vPadding = _ref5[1];
  3339. }
  3340. var pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this._pageWidthScaleFactor;
  3341. var pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
  3342. switch (value) {
  3343. case "page-actual":
  3344. scale = 1;
  3345. break;
  3346. case "page-width":
  3347. scale = pageWidthScale;
  3348. break;
  3349. case "page-height":
  3350. scale = pageHeightScale;
  3351. break;
  3352. case "page-fit":
  3353. scale = Math.min(pageWidthScale, pageHeightScale);
  3354. break;
  3355. case "auto":
  3356. var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
  3357. scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
  3358. break;
  3359. default:
  3360. console.error("_setScale: \"".concat(value, "\" is an unknown zoom value."));
  3361. return;
  3362. }
  3363. this._setScaleUpdatePages(scale, value, noScroll, true);
  3364. }
  3365. }
  3366. }, {
  3367. key: "pageLabelToPageNumber",
  3368. value: function pageLabelToPageNumber(label) {
  3369. if (!this._pageLabels) {
  3370. return null;
  3371. }
  3372. var i = this._pageLabels.indexOf(label);
  3373. if (i < 0) {
  3374. return null;
  3375. }
  3376. return i + 1;
  3377. }
  3378. }, {
  3379. key: "scrollPageIntoView",
  3380. value: function scrollPageIntoView(_ref6) {
  3381. var pageNumber = _ref6.pageNumber,
  3382. _ref6$destArray = _ref6.destArray,
  3383. destArray = _ref6$destArray === void 0 ? null : _ref6$destArray,
  3384. _ref6$allowNegativeOf = _ref6.allowNegativeOffset,
  3385. allowNegativeOffset = _ref6$allowNegativeOf === void 0 ? false : _ref6$allowNegativeOf,
  3386. _ref6$ignoreDestinati = _ref6.ignoreDestinationZoom,
  3387. ignoreDestinationZoom = _ref6$ignoreDestinati === void 0 ? false : _ref6$ignoreDestinati;
  3388. if (!this.pdfDocument) {
  3389. return;
  3390. }
  3391. var pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
  3392. if (!pageView) {
  3393. console.error("scrollPageIntoView: \"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  3394. return;
  3395. }
  3396. if (this.isInPresentationMode || !destArray) {
  3397. this._setCurrentPageNumber(pageNumber, true);
  3398. return;
  3399. }
  3400. var x = 0,
  3401. y = 0;
  3402. var width = 0,
  3403. height = 0,
  3404. widthScale,
  3405. heightScale;
  3406. var changeOrientation = pageView.rotation % 180 !== 0;
  3407. var pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3408. var pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3409. var scale = 0;
  3410. switch (destArray[1].name) {
  3411. case "XYZ":
  3412. x = destArray[2];
  3413. y = destArray[3];
  3414. scale = destArray[4];
  3415. x = x !== null ? x : 0;
  3416. y = y !== null ? y : pageHeight;
  3417. break;
  3418. case "Fit":
  3419. case "FitB":
  3420. scale = "page-fit";
  3421. break;
  3422. case "FitH":
  3423. case "FitBH":
  3424. y = destArray[2];
  3425. scale = "page-width";
  3426. if (y === null && this._location) {
  3427. x = this._location.left;
  3428. y = this._location.top;
  3429. } else if (typeof y !== "number" || y < 0) {
  3430. y = pageHeight;
  3431. }
  3432. break;
  3433. case "FitV":
  3434. case "FitBV":
  3435. x = destArray[2];
  3436. width = pageWidth;
  3437. height = pageHeight;
  3438. scale = "page-height";
  3439. break;
  3440. case "FitR":
  3441. x = destArray[2];
  3442. y = destArray[3];
  3443. width = destArray[4] - x;
  3444. height = destArray[5] - y;
  3445. var hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
  3446. var vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
  3447. widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3448. heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3449. scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
  3450. break;
  3451. default:
  3452. console.error("scrollPageIntoView: \"".concat(destArray[1].name, "\" is not a valid destination type."));
  3453. return;
  3454. }
  3455. if (!ignoreDestinationZoom) {
  3456. if (scale && scale !== this._currentScale) {
  3457. this.currentScaleValue = scale;
  3458. } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) {
  3459. this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
  3460. }
  3461. }
  3462. if (scale === "page-fit" && !destArray[4]) {
  3463. _classPrivateMethodGet(this, _scrollIntoView, _scrollIntoView2).call(this, pageView);
  3464. return;
  3465. }
  3466. var boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
  3467. var left = Math.min(boundingRect[0][0], boundingRect[1][0]);
  3468. var top = Math.min(boundingRect[0][1], boundingRect[1][1]);
  3469. if (!allowNegativeOffset) {
  3470. left = Math.max(left, 0);
  3471. top = Math.max(top, 0);
  3472. }
  3473. _classPrivateMethodGet(this, _scrollIntoView, _scrollIntoView2).call(this, pageView, {
  3474. left: left,
  3475. top: top
  3476. });
  3477. }
  3478. }, {
  3479. key: "_updateLocation",
  3480. value: function _updateLocation(firstPage) {
  3481. var currentScale = this._currentScale;
  3482. var currentScaleValue = this._currentScaleValue;
  3483. var normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
  3484. var pageNumber = firstPage.id;
  3485. var currentPageView = this._pages[pageNumber - 1];
  3486. var container = this.container;
  3487. var topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
  3488. var intLeft = Math.round(topLeft[0]);
  3489. var intTop = Math.round(topLeft[1]);
  3490. var pdfOpenParams = "#page=".concat(pageNumber);
  3491. if (!this.isInPresentationMode) {
  3492. pdfOpenParams += "&zoom=".concat(normalizedScaleValue, ",").concat(intLeft, ",").concat(intTop);
  3493. }
  3494. this._location = {
  3495. pageNumber: pageNumber,
  3496. scale: normalizedScaleValue,
  3497. top: intTop,
  3498. left: intLeft,
  3499. rotation: this._pagesRotation,
  3500. pdfOpenParams: pdfOpenParams
  3501. };
  3502. }
  3503. }, {
  3504. key: "update",
  3505. value: function update() {
  3506. var visible = this._getVisiblePages();
  3507. var visiblePages = visible.views,
  3508. numVisiblePages = visiblePages.length;
  3509. if (numVisiblePages === 0) {
  3510. return;
  3511. }
  3512. var newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
  3513. _classPrivateFieldGet(this, _buffer).resize(newCacheSize, visible.ids);
  3514. this.renderingQueue.renderHighestPriority(visible);
  3515. var isSimpleLayout = this._spreadMode === _ui_utils.SpreadMode.NONE && (this._scrollMode === _ui_utils.ScrollMode.PAGE || this._scrollMode === _ui_utils.ScrollMode.VERTICAL);
  3516. var currentId = this._currentPageNumber;
  3517. var stillFullyVisible = false;
  3518. var _iterator4 = _createForOfIteratorHelper(visiblePages),
  3519. _step4;
  3520. try {
  3521. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3522. var page = _step4.value;
  3523. if (page.percent < 100) {
  3524. break;
  3525. }
  3526. if (page.id === currentId && isSimpleLayout) {
  3527. stillFullyVisible = true;
  3528. break;
  3529. }
  3530. }
  3531. } catch (err) {
  3532. _iterator4.e(err);
  3533. } finally {
  3534. _iterator4.f();
  3535. }
  3536. this._setCurrentPageNumber(stillFullyVisible ? currentId : visiblePages[0].id);
  3537. this._updateLocation(visible.first);
  3538. this.eventBus.dispatch("updateviewarea", {
  3539. source: this,
  3540. location: this._location
  3541. });
  3542. }
  3543. }, {
  3544. key: "containsElement",
  3545. value: function containsElement(element) {
  3546. return this.container.contains(element);
  3547. }
  3548. }, {
  3549. key: "focus",
  3550. value: function focus() {
  3551. this.container.focus();
  3552. }
  3553. }, {
  3554. key: "_isContainerRtl",
  3555. get: function get() {
  3556. return getComputedStyle(this.container).direction === "rtl";
  3557. }
  3558. }, {
  3559. key: "isInPresentationMode",
  3560. get: function get() {
  3561. return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN;
  3562. }
  3563. }, {
  3564. key: "isChangingPresentationMode",
  3565. get: function get() {
  3566. return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING;
  3567. }
  3568. }, {
  3569. key: "isHorizontalScrollbarEnabled",
  3570. get: function get() {
  3571. return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
  3572. }
  3573. }, {
  3574. key: "isVerticalScrollbarEnabled",
  3575. get: function get() {
  3576. return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
  3577. }
  3578. }, {
  3579. key: "_getVisiblePages",
  3580. value: function _getVisiblePages() {
  3581. var views = this._scrollMode === _ui_utils.ScrollMode.PAGE ? _classPrivateFieldGet(this, _scrollModePageState).pages : this._pages,
  3582. horizontal = this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL,
  3583. rtl = horizontal && this._isContainerRtl;
  3584. return (0, _ui_utils.getVisibleElements)({
  3585. scrollEl: this.container,
  3586. views: views,
  3587. sortByVisibility: true,
  3588. horizontal: horizontal,
  3589. rtl: rtl
  3590. });
  3591. }
  3592. }, {
  3593. key: "isPageVisible",
  3594. value: function isPageVisible(pageNumber) {
  3595. if (!this.pdfDocument) {
  3596. return false;
  3597. }
  3598. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  3599. console.error("isPageVisible: \"".concat(pageNumber, "\" is not a valid page."));
  3600. return false;
  3601. }
  3602. return this._getVisiblePages().ids.has(pageNumber);
  3603. }
  3604. }, {
  3605. key: "isPageCached",
  3606. value: function isPageCached(pageNumber) {
  3607. if (!this.pdfDocument) {
  3608. return false;
  3609. }
  3610. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  3611. console.error("isPageCached: \"".concat(pageNumber, "\" is not a valid page."));
  3612. return false;
  3613. }
  3614. var pageView = this._pages[pageNumber - 1];
  3615. return _classPrivateFieldGet(this, _buffer).has(pageView);
  3616. }
  3617. }, {
  3618. key: "cleanup",
  3619. value: function cleanup() {
  3620. var _iterator5 = _createForOfIteratorHelper(this._pages),
  3621. _step5;
  3622. try {
  3623. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3624. var pageView = _step5.value;
  3625. if (pageView.renderingState !== _ui_utils.RenderingStates.FINISHED) {
  3626. pageView.reset();
  3627. }
  3628. }
  3629. } catch (err) {
  3630. _iterator5.e(err);
  3631. } finally {
  3632. _iterator5.f();
  3633. }
  3634. }
  3635. }, {
  3636. key: "_cancelRendering",
  3637. value: function _cancelRendering() {
  3638. var _iterator6 = _createForOfIteratorHelper(this._pages),
  3639. _step6;
  3640. try {
  3641. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3642. var pageView = _step6.value;
  3643. pageView.cancelRendering();
  3644. }
  3645. } catch (err) {
  3646. _iterator6.e(err);
  3647. } finally {
  3648. _iterator6.f();
  3649. }
  3650. }
  3651. }, {
  3652. key: "forceRendering",
  3653. value: function forceRendering(currentlyVisiblePages) {
  3654. var _this3 = this;
  3655. var visiblePages = currentlyVisiblePages || this._getVisiblePages();
  3656. var scrollAhead = _classPrivateMethodGet(this, _getScrollAhead, _getScrollAhead2).call(this, visiblePages);
  3657. var preRenderExtra = this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL;
  3658. var pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra);
  3659. _classPrivateMethodGet(this, _toggleLoadingIconSpinner, _toggleLoadingIconSpinner2).call(this, visiblePages.ids);
  3660. if (pageView) {
  3661. _classPrivateMethodGet(this, _ensurePdfPageLoaded, _ensurePdfPageLoaded2).call(this, pageView).then(function () {
  3662. _this3.renderingQueue.renderView(pageView);
  3663. });
  3664. return true;
  3665. }
  3666. return false;
  3667. }
  3668. }, {
  3669. key: "createTextLayerBuilder",
  3670. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  3671. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3672. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  3673. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  3674. return new _text_layer_builder.TextLayerBuilder({
  3675. textLayerDiv: textLayerDiv,
  3676. eventBus: eventBus,
  3677. pageIndex: pageIndex,
  3678. viewport: viewport,
  3679. enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection,
  3680. highlighter: highlighter
  3681. });
  3682. }
  3683. }, {
  3684. key: "createTextHighlighter",
  3685. value: function createTextHighlighter(pageIndex, eventBus) {
  3686. return new _text_highlighter.TextHighlighter({
  3687. eventBus: eventBus,
  3688. pageIndex: pageIndex,
  3689. findController: this.isInPresentationMode ? null : this.findController
  3690. });
  3691. }
  3692. }, {
  3693. key: "createAnnotationLayerBuilder",
  3694. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  3695. var _this$pdfDocument, _this$pdfDocument2, _this$pdfDocument3, _this$_scriptingManag;
  3696. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  3697. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  3698. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  3699. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  3700. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  3701. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  3702. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  3703. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  3704. var annotationCanvasMap = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
  3705. return new _annotation_layer_builder.AnnotationLayerBuilder({
  3706. pageDiv: pageDiv,
  3707. pdfPage: pdfPage,
  3708. annotationStorage: annotationStorage || ((_this$pdfDocument = this.pdfDocument) === null || _this$pdfDocument === void 0 ? void 0 : _this$pdfDocument.annotationStorage),
  3709. imageResourcesPath: imageResourcesPath,
  3710. renderForms: renderForms,
  3711. linkService: this.linkService,
  3712. downloadManager: this.downloadManager,
  3713. l10n: l10n,
  3714. enableScripting: enableScripting !== null && enableScripting !== void 0 ? enableScripting : this.enableScripting,
  3715. hasJSActionsPromise: hasJSActionsPromise || ((_this$pdfDocument2 = this.pdfDocument) === null || _this$pdfDocument2 === void 0 ? void 0 : _this$pdfDocument2.hasJSActions()),
  3716. fieldObjectsPromise: fieldObjectsPromise || ((_this$pdfDocument3 = this.pdfDocument) === null || _this$pdfDocument3 === void 0 ? void 0 : _this$pdfDocument3.getFieldObjects()),
  3717. mouseState: mouseState || ((_this$_scriptingManag = this._scriptingManager) === null || _this$_scriptingManag === void 0 ? void 0 : _this$_scriptingManag.mouseState),
  3718. annotationCanvasMap: annotationCanvasMap
  3719. });
  3720. }
  3721. }, {
  3722. key: "createXfaLayerBuilder",
  3723. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  3724. var _this$pdfDocument4;
  3725. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  3726. return new _xfa_layer_builder.XfaLayerBuilder({
  3727. pageDiv: pageDiv,
  3728. pdfPage: pdfPage,
  3729. annotationStorage: annotationStorage || ((_this$pdfDocument4 = this.pdfDocument) === null || _this$pdfDocument4 === void 0 ? void 0 : _this$pdfDocument4.annotationStorage),
  3730. linkService: this.linkService
  3731. });
  3732. }
  3733. }, {
  3734. key: "createStructTreeLayerBuilder",
  3735. value: function createStructTreeLayerBuilder(pdfPage) {
  3736. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  3737. pdfPage: pdfPage
  3738. });
  3739. }
  3740. }, {
  3741. key: "hasEqualPageSizes",
  3742. get: function get() {
  3743. var firstPageView = this._pages[0];
  3744. for (var i = 1, ii = this._pages.length; i < ii; ++i) {
  3745. var pageView = this._pages[i];
  3746. if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {
  3747. return false;
  3748. }
  3749. }
  3750. return true;
  3751. }
  3752. }, {
  3753. key: "getPagesOverview",
  3754. value: function getPagesOverview() {
  3755. var _this4 = this;
  3756. return this._pages.map(function (pageView) {
  3757. var viewport = pageView.pdfPage.getViewport({
  3758. scale: 1
  3759. });
  3760. if (!_this4.enablePrintAutoRotate || (0, _ui_utils.isPortraitOrientation)(viewport)) {
  3761. return {
  3762. width: viewport.width,
  3763. height: viewport.height,
  3764. rotation: viewport.rotation
  3765. };
  3766. }
  3767. return {
  3768. width: viewport.height,
  3769. height: viewport.width,
  3770. rotation: (viewport.rotation - 90) % 360
  3771. };
  3772. });
  3773. }
  3774. }, {
  3775. key: "optionalContentConfigPromise",
  3776. get: function get() {
  3777. if (!this.pdfDocument) {
  3778. return Promise.resolve(null);
  3779. }
  3780. if (!this._optionalContentConfigPromise) {
  3781. return this.pdfDocument.getOptionalContentConfig();
  3782. }
  3783. return this._optionalContentConfigPromise;
  3784. },
  3785. set: function set(promise) {
  3786. if (!(promise instanceof Promise)) {
  3787. throw new Error("Invalid optionalContentConfigPromise: ".concat(promise));
  3788. }
  3789. if (!this.pdfDocument) {
  3790. return;
  3791. }
  3792. if (!this._optionalContentConfigPromise) {
  3793. return;
  3794. }
  3795. this._optionalContentConfigPromise = promise;
  3796. var updateArgs = {
  3797. optionalContentConfigPromise: promise
  3798. };
  3799. var _iterator7 = _createForOfIteratorHelper(this._pages),
  3800. _step7;
  3801. try {
  3802. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  3803. var pageView = _step7.value;
  3804. pageView.update(updateArgs);
  3805. }
  3806. } catch (err) {
  3807. _iterator7.e(err);
  3808. } finally {
  3809. _iterator7.f();
  3810. }
  3811. this.update();
  3812. this.eventBus.dispatch("optionalcontentconfigchanged", {
  3813. source: this,
  3814. promise: promise
  3815. });
  3816. }
  3817. }, {
  3818. key: "scrollMode",
  3819. get: function get() {
  3820. return this._scrollMode;
  3821. },
  3822. set: function set(mode) {
  3823. if (this._scrollMode === mode) {
  3824. return;
  3825. }
  3826. if (!(0, _ui_utils.isValidScrollMode)(mode)) {
  3827. throw new Error("Invalid scroll mode: ".concat(mode));
  3828. }
  3829. if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
  3830. return;
  3831. }
  3832. this._previousScrollMode = this._scrollMode;
  3833. this._scrollMode = mode;
  3834. this.eventBus.dispatch("scrollmodechanged", {
  3835. source: this,
  3836. mode: mode
  3837. });
  3838. this._updateScrollMode(this._currentPageNumber);
  3839. }
  3840. }, {
  3841. key: "_updateScrollMode",
  3842. value: function _updateScrollMode() {
  3843. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  3844. var scrollMode = this._scrollMode,
  3845. viewer = this.viewer;
  3846. viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils.ScrollMode.HORIZONTAL);
  3847. viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils.ScrollMode.WRAPPED);
  3848. if (!this.pdfDocument || !pageNumber) {
  3849. return;
  3850. }
  3851. if (scrollMode === _ui_utils.ScrollMode.PAGE) {
  3852. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3853. } else if (this._previousScrollMode === _ui_utils.ScrollMode.PAGE) {
  3854. this._updateSpreadMode();
  3855. }
  3856. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  3857. this._setScale(this._currentScaleValue, true);
  3858. }
  3859. this._setCurrentPageNumber(pageNumber, true);
  3860. this.update();
  3861. }
  3862. }, {
  3863. key: "spreadMode",
  3864. get: function get() {
  3865. return this._spreadMode;
  3866. },
  3867. set: function set(mode) {
  3868. if (this._spreadMode === mode) {
  3869. return;
  3870. }
  3871. if (!(0, _ui_utils.isValidSpreadMode)(mode)) {
  3872. throw new Error("Invalid spread mode: ".concat(mode));
  3873. }
  3874. this._spreadMode = mode;
  3875. this.eventBus.dispatch("spreadmodechanged", {
  3876. source: this,
  3877. mode: mode
  3878. });
  3879. this._updateSpreadMode(this._currentPageNumber);
  3880. }
  3881. }, {
  3882. key: "_updateSpreadMode",
  3883. value: function _updateSpreadMode() {
  3884. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  3885. if (!this.pdfDocument) {
  3886. return;
  3887. }
  3888. var viewer = this.viewer,
  3889. pages = this._pages;
  3890. if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3891. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3892. } else {
  3893. viewer.textContent = "";
  3894. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  3895. var _iterator8 = _createForOfIteratorHelper(this._pages),
  3896. _step8;
  3897. try {
  3898. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  3899. var pageView = _step8.value;
  3900. viewer.appendChild(pageView.div);
  3901. }
  3902. } catch (err) {
  3903. _iterator8.e(err);
  3904. } finally {
  3905. _iterator8.f();
  3906. }
  3907. } else {
  3908. var parity = this._spreadMode - 1;
  3909. var spread = null;
  3910. for (var i = 0, ii = pages.length; i < ii; ++i) {
  3911. if (spread === null) {
  3912. spread = document.createElement("div");
  3913. spread.className = "spread";
  3914. viewer.appendChild(spread);
  3915. } else if (i % 2 === parity) {
  3916. spread = spread.cloneNode(false);
  3917. viewer.appendChild(spread);
  3918. }
  3919. spread.appendChild(pages[i].div);
  3920. }
  3921. }
  3922. }
  3923. if (!pageNumber) {
  3924. return;
  3925. }
  3926. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  3927. this._setScale(this._currentScaleValue, true);
  3928. }
  3929. this._setCurrentPageNumber(pageNumber, true);
  3930. this.update();
  3931. }
  3932. }, {
  3933. key: "_getPageAdvance",
  3934. value: function _getPageAdvance(currentPageNumber) {
  3935. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3936. switch (this._scrollMode) {
  3937. case _ui_utils.ScrollMode.WRAPPED:
  3938. {
  3939. var _this$_getVisiblePage = this._getVisiblePages(),
  3940. views = _this$_getVisiblePage.views,
  3941. pageLayout = new Map();
  3942. var _iterator9 = _createForOfIteratorHelper(views),
  3943. _step9;
  3944. try {
  3945. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  3946. var _step9$value = _step9.value,
  3947. id = _step9$value.id,
  3948. y = _step9$value.y,
  3949. percent = _step9$value.percent,
  3950. widthPercent = _step9$value.widthPercent;
  3951. if (percent === 0 || widthPercent < 100) {
  3952. continue;
  3953. }
  3954. var yArray = pageLayout.get(y);
  3955. if (!yArray) {
  3956. pageLayout.set(y, yArray || (yArray = []));
  3957. }
  3958. yArray.push(id);
  3959. }
  3960. } catch (err) {
  3961. _iterator9.e(err);
  3962. } finally {
  3963. _iterator9.f();
  3964. }
  3965. var _iterator10 = _createForOfIteratorHelper(pageLayout.values()),
  3966. _step10;
  3967. try {
  3968. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  3969. var _yArray = _step10.value;
  3970. var currentIndex = _yArray.indexOf(currentPageNumber);
  3971. if (currentIndex === -1) {
  3972. continue;
  3973. }
  3974. var numPages = _yArray.length;
  3975. if (numPages === 1) {
  3976. break;
  3977. }
  3978. if (previous) {
  3979. for (var i = currentIndex - 1, ii = 0; i >= ii; i--) {
  3980. var currentId = _yArray[i],
  3981. expectedId = _yArray[i + 1] - 1;
  3982. if (currentId < expectedId) {
  3983. return currentPageNumber - expectedId;
  3984. }
  3985. }
  3986. } else {
  3987. for (var _i2 = currentIndex + 1, _ii = numPages; _i2 < _ii; _i2++) {
  3988. var _currentId = _yArray[_i2],
  3989. _expectedId = _yArray[_i2 - 1] + 1;
  3990. if (_currentId > _expectedId) {
  3991. return _expectedId - currentPageNumber;
  3992. }
  3993. }
  3994. }
  3995. if (previous) {
  3996. var firstId = _yArray[0];
  3997. if (firstId < currentPageNumber) {
  3998. return currentPageNumber - firstId + 1;
  3999. }
  4000. } else {
  4001. var lastId = _yArray[numPages - 1];
  4002. if (lastId > currentPageNumber) {
  4003. return lastId - currentPageNumber + 1;
  4004. }
  4005. }
  4006. break;
  4007. }
  4008. } catch (err) {
  4009. _iterator10.e(err);
  4010. } finally {
  4011. _iterator10.f();
  4012. }
  4013. break;
  4014. }
  4015. case _ui_utils.ScrollMode.HORIZONTAL:
  4016. {
  4017. break;
  4018. }
  4019. case _ui_utils.ScrollMode.PAGE:
  4020. case _ui_utils.ScrollMode.VERTICAL:
  4021. {
  4022. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  4023. break;
  4024. }
  4025. var parity = this._spreadMode - 1;
  4026. if (previous && currentPageNumber % 2 !== parity) {
  4027. break;
  4028. } else if (!previous && currentPageNumber % 2 === parity) {
  4029. break;
  4030. }
  4031. var _this$_getVisiblePage2 = this._getVisiblePages(),
  4032. _views = _this$_getVisiblePage2.views,
  4033. _expectedId2 = previous ? currentPageNumber - 1 : currentPageNumber + 1;
  4034. var _iterator11 = _createForOfIteratorHelper(_views),
  4035. _step11;
  4036. try {
  4037. for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
  4038. var _step11$value = _step11.value,
  4039. _id = _step11$value.id,
  4040. _percent = _step11$value.percent,
  4041. _widthPercent = _step11$value.widthPercent;
  4042. if (_id !== _expectedId2) {
  4043. continue;
  4044. }
  4045. if (_percent > 0 && _widthPercent === 100) {
  4046. return 2;
  4047. }
  4048. break;
  4049. }
  4050. } catch (err) {
  4051. _iterator11.e(err);
  4052. } finally {
  4053. _iterator11.f();
  4054. }
  4055. break;
  4056. }
  4057. }
  4058. return 1;
  4059. }
  4060. }, {
  4061. key: "nextPage",
  4062. value: function nextPage() {
  4063. var currentPageNumber = this._currentPageNumber,
  4064. pagesCount = this.pagesCount;
  4065. if (currentPageNumber >= pagesCount) {
  4066. return false;
  4067. }
  4068. var advance = this._getPageAdvance(currentPageNumber, false) || 1;
  4069. this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
  4070. return true;
  4071. }
  4072. }, {
  4073. key: "previousPage",
  4074. value: function previousPage() {
  4075. var currentPageNumber = this._currentPageNumber;
  4076. if (currentPageNumber <= 1) {
  4077. return false;
  4078. }
  4079. var advance = this._getPageAdvance(currentPageNumber, true) || 1;
  4080. this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
  4081. return true;
  4082. }
  4083. }, {
  4084. key: "increaseScale",
  4085. value: function increaseScale() {
  4086. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  4087. var newScale = this._currentScale;
  4088. do {
  4089. newScale = (newScale * _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  4090. newScale = Math.ceil(newScale * 10) / 10;
  4091. newScale = Math.min(_ui_utils.MAX_SCALE, newScale);
  4092. } while (--steps > 0 && newScale < _ui_utils.MAX_SCALE);
  4093. this.currentScaleValue = newScale;
  4094. }
  4095. }, {
  4096. key: "decreaseScale",
  4097. value: function decreaseScale() {
  4098. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  4099. var newScale = this._currentScale;
  4100. do {
  4101. newScale = (newScale / _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  4102. newScale = Math.floor(newScale * 10) / 10;
  4103. newScale = Math.max(_ui_utils.MIN_SCALE, newScale);
  4104. } while (--steps > 0 && newScale > _ui_utils.MIN_SCALE);
  4105. this.currentScaleValue = newScale;
  4106. }
  4107. }, {
  4108. key: "updateContainerHeightCss",
  4109. value: function updateContainerHeightCss() {
  4110. var height = this.container.clientHeight;
  4111. if (height !== _classPrivateFieldGet(this, _previousContainerHeight)) {
  4112. _classPrivateFieldSet(this, _previousContainerHeight, height);
  4113. this._doc.style.setProperty("--viewer-container-height", "".concat(height, "px"));
  4114. }
  4115. }
  4116. }]);
  4117. return BaseViewer;
  4118. }();
  4119. exports.BaseViewer = BaseViewer;
  4120. function _initializePermissions2(permissions) {
  4121. if (!permissions) {
  4122. return;
  4123. }
  4124. if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY)) {
  4125. this.viewer.classList.add(ENABLE_PERMISSIONS_CLASS);
  4126. }
  4127. if (!permissions.includes(_pdfjsLib.PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(_pdfjsLib.PermissionFlag.FILL_INTERACTIVE_FORMS)) {
  4128. if (_classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS) {
  4129. _classPrivateFieldSet(this, _previousAnnotationMode, _classPrivateFieldGet(this, _annotationMode));
  4130. _classPrivateFieldSet(this, _annotationMode, _pdfjsLib.AnnotationMode.ENABLE);
  4131. }
  4132. }
  4133. }
  4134. function _onePageRenderedOrForceFetch2() {
  4135. var _this5 = this;
  4136. if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) {
  4137. return Promise.resolve();
  4138. }
  4139. var visibilityChangePromise = new Promise(function (resolve) {
  4140. _classPrivateFieldSet(_this5, _onVisibilityChange, function () {
  4141. if (document.visibilityState !== "hidden") {
  4142. return;
  4143. }
  4144. resolve();
  4145. document.removeEventListener("visibilitychange", _classPrivateFieldGet(_this5, _onVisibilityChange));
  4146. _classPrivateFieldSet(_this5, _onVisibilityChange, null);
  4147. });
  4148. document.addEventListener("visibilitychange", _classPrivateFieldGet(_this5, _onVisibilityChange));
  4149. });
  4150. return Promise.race([this._onePageRenderedCapability.promise, visibilityChangePromise]);
  4151. }
  4152. function _ensurePageViewVisible2() {
  4153. if (this._scrollMode !== _ui_utils.ScrollMode.PAGE) {
  4154. throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
  4155. }
  4156. var pageNumber = this._currentPageNumber,
  4157. state = _classPrivateFieldGet(this, _scrollModePageState),
  4158. viewer = this.viewer;
  4159. viewer.textContent = "";
  4160. state.pages.length = 0;
  4161. if (this._spreadMode === _ui_utils.SpreadMode.NONE && !this.isInPresentationMode) {
  4162. var pageView = this._pages[pageNumber - 1];
  4163. viewer.appendChild(pageView.div);
  4164. state.pages.push(pageView);
  4165. } else {
  4166. var pageIndexSet = new Set(),
  4167. parity = this._spreadMode - 1;
  4168. if (parity === -1) {
  4169. pageIndexSet.add(pageNumber - 1);
  4170. } else if (pageNumber % 2 !== parity) {
  4171. pageIndexSet.add(pageNumber - 1);
  4172. pageIndexSet.add(pageNumber);
  4173. } else {
  4174. pageIndexSet.add(pageNumber - 2);
  4175. pageIndexSet.add(pageNumber - 1);
  4176. }
  4177. var spread = document.createElement("div");
  4178. spread.className = "spread";
  4179. if (this.isInPresentationMode) {
  4180. var dummyPage = document.createElement("div");
  4181. dummyPage.className = "dummyPage";
  4182. spread.appendChild(dummyPage);
  4183. }
  4184. var _iterator12 = _createForOfIteratorHelper(pageIndexSet),
  4185. _step12;
  4186. try {
  4187. for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
  4188. var i = _step12.value;
  4189. var _pageView = this._pages[i];
  4190. if (!_pageView) {
  4191. continue;
  4192. }
  4193. spread.appendChild(_pageView.div);
  4194. state.pages.push(_pageView);
  4195. }
  4196. } catch (err) {
  4197. _iterator12.e(err);
  4198. } finally {
  4199. _iterator12.f();
  4200. }
  4201. viewer.appendChild(spread);
  4202. }
  4203. state.scrollDown = pageNumber >= state.previousPageNumber;
  4204. state.previousPageNumber = pageNumber;
  4205. }
  4206. function _scrollIntoView2(pageView) {
  4207. var pageSpot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  4208. var div = pageView.div,
  4209. id = pageView.id;
  4210. if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
  4211. this._setCurrentPageNumber(id);
  4212. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  4213. this.update();
  4214. }
  4215. if (!pageSpot && !this.isInPresentationMode) {
  4216. var left = div.offsetLeft + div.clientLeft,
  4217. right = left + div.clientWidth;
  4218. var _this$container2 = this.container,
  4219. scrollLeft = _this$container2.scrollLeft,
  4220. clientWidth = _this$container2.clientWidth;
  4221. if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {
  4222. pageSpot = {
  4223. left: 0,
  4224. top: 0
  4225. };
  4226. }
  4227. }
  4228. (0, _ui_utils.scrollIntoView)(div, pageSpot);
  4229. }
  4230. function _isSameScale2(newScale) {
  4231. return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
  4232. }
  4233. function _resetCurrentPageView2() {
  4234. var pageView = this._pages[this._currentPageNumber - 1];
  4235. if (this.isInPresentationMode) {
  4236. this._setScale(this._currentScaleValue, true);
  4237. }
  4238. _classPrivateMethodGet(this, _scrollIntoView, _scrollIntoView2).call(this, pageView);
  4239. }
  4240. function _ensurePdfPageLoaded2(_x) {
  4241. return _ensurePdfPageLoaded3.apply(this, arguments);
  4242. }
  4243. function _ensurePdfPageLoaded3() {
  4244. _ensurePdfPageLoaded3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pageView) {
  4245. var _this$linkService$_ca, _this$linkService, pdfPage;
  4246. return _regenerator["default"].wrap(function _callee2$(_context3) {
  4247. while (1) {
  4248. switch (_context3.prev = _context3.next) {
  4249. case 0:
  4250. if (!pageView.pdfPage) {
  4251. _context3.next = 2;
  4252. break;
  4253. }
  4254. return _context3.abrupt("return", pageView.pdfPage);
  4255. case 2:
  4256. _context3.prev = 2;
  4257. _context3.next = 5;
  4258. return this.pdfDocument.getPage(pageView.id);
  4259. case 5:
  4260. pdfPage = _context3.sent;
  4261. if (!pageView.pdfPage) {
  4262. pageView.setPdfPage(pdfPage);
  4263. }
  4264. if (!((_this$linkService$_ca = (_this$linkService = this.linkService)._cachedPageNumber) !== null && _this$linkService$_ca !== void 0 && _this$linkService$_ca.call(_this$linkService, pdfPage.ref))) {
  4265. this.linkService.cachePageRef(pageView.id, pdfPage.ref);
  4266. }
  4267. return _context3.abrupt("return", pdfPage);
  4268. case 11:
  4269. _context3.prev = 11;
  4270. _context3.t0 = _context3["catch"](2);
  4271. console.error("Unable to get page for page view", _context3.t0);
  4272. return _context3.abrupt("return", null);
  4273. case 15:
  4274. case "end":
  4275. return _context3.stop();
  4276. }
  4277. }
  4278. }, _callee2, this, [[2, 11]]);
  4279. }));
  4280. return _ensurePdfPageLoaded3.apply(this, arguments);
  4281. }
  4282. function _getScrollAhead2(visible) {
  4283. var _visible$first, _visible$last;
  4284. if (((_visible$first = visible.first) === null || _visible$first === void 0 ? void 0 : _visible$first.id) === 1) {
  4285. return true;
  4286. } else if (((_visible$last = visible.last) === null || _visible$last === void 0 ? void 0 : _visible$last.id) === this.pagesCount) {
  4287. return false;
  4288. }
  4289. switch (this._scrollMode) {
  4290. case _ui_utils.ScrollMode.PAGE:
  4291. return _classPrivateFieldGet(this, _scrollModePageState).scrollDown;
  4292. case _ui_utils.ScrollMode.HORIZONTAL:
  4293. return this.scroll.right;
  4294. }
  4295. return this.scroll.down;
  4296. }
  4297. function _toggleLoadingIconSpinner2(visibleIds) {
  4298. var _iterator13 = _createForOfIteratorHelper(visibleIds),
  4299. _step13;
  4300. try {
  4301. for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
  4302. var id = _step13.value;
  4303. var pageView = this._pages[id - 1];
  4304. pageView === null || pageView === void 0 ? void 0 : pageView.toggleLoadingIconSpinner(true);
  4305. }
  4306. } catch (err) {
  4307. _iterator13.e(err);
  4308. } finally {
  4309. _iterator13.f();
  4310. }
  4311. var _iterator14 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _buffer)),
  4312. _step14;
  4313. try {
  4314. for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
  4315. var _pageView2 = _step14.value;
  4316. if (visibleIds.has(_pageView2.id)) {
  4317. continue;
  4318. }
  4319. _pageView2.toggleLoadingIconSpinner(false);
  4320. }
  4321. } catch (err) {
  4322. _iterator14.e(err);
  4323. } finally {
  4324. _iterator14.f();
  4325. }
  4326. }
  4327. /***/ }),
  4328. /* 14 */
  4329. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4330. Object.defineProperty(exports, "__esModule", ({
  4331. value: true
  4332. }));
  4333. exports.PDFPageView = void 0;
  4334. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  4335. var _pdfjsLib = __w_pdfjs_require__(5);
  4336. var _ui_utils = __w_pdfjs_require__(8);
  4337. var _app_options = __w_pdfjs_require__(15);
  4338. var _l10n_utils = __w_pdfjs_require__(6);
  4339. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4340. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  4341. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  4342. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  4343. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  4344. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  4345. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4346. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4347. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  4348. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  4349. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  4350. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  4351. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  4352. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  4353. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  4354. function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
  4355. var MAX_CANVAS_PIXELS = _app_options.compatibilityParams.maxCanvasPixels || 16777216;
  4356. var _annotationMode = /*#__PURE__*/new WeakMap();
  4357. var PDFPageView = /*#__PURE__*/function () {
  4358. function PDFPageView(options) {
  4359. var _options$textLayerMod, _options$annotationMo, _options$textHighligh, _this$renderingQueue;
  4360. _classCallCheck(this, PDFPageView);
  4361. _classPrivateFieldInitSpec(this, _annotationMode, {
  4362. writable: true,
  4363. value: _pdfjsLib.AnnotationMode.ENABLE_FORMS
  4364. });
  4365. var container = options.container;
  4366. var defaultViewport = options.defaultViewport;
  4367. this.id = options.id;
  4368. this.renderingId = "page" + this.id;
  4369. this.pdfPage = null;
  4370. this.pageLabel = null;
  4371. this.rotation = 0;
  4372. this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
  4373. this.viewport = defaultViewport;
  4374. this.pdfPageRotate = defaultViewport.rotation;
  4375. this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
  4376. this.hasRestrictedScaling = false;
  4377. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  4378. _classPrivateFieldSet(this, _annotationMode, (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS);
  4379. this.imageResourcesPath = options.imageResourcesPath || "";
  4380. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  4381. this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
  4382. this.pageColors = options.pageColors || null;
  4383. this.eventBus = options.eventBus;
  4384. this.renderingQueue = options.renderingQueue;
  4385. this.textLayerFactory = options.textLayerFactory;
  4386. this.annotationLayerFactory = options.annotationLayerFactory;
  4387. this.xfaLayerFactory = options.xfaLayerFactory;
  4388. this.textHighlighter = (_options$textHighligh = options.textHighlighterFactory) === null || _options$textHighligh === void 0 ? void 0 : _options$textHighligh.createTextHighlighter(this.id - 1, this.eventBus);
  4389. this.structTreeLayerFactory = options.structTreeLayerFactory;
  4390. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  4391. this.l10n = options.l10n || _l10n_utils.NullL10n;
  4392. this.paintTask = null;
  4393. this.paintedViewportMap = new WeakMap();
  4394. this.renderingState = _ui_utils.RenderingStates.INITIAL;
  4395. this.resume = null;
  4396. this._renderError = null;
  4397. this._isStandalone = !((_this$renderingQueue = this.renderingQueue) !== null && _this$renderingQueue !== void 0 && _this$renderingQueue.hasViewer());
  4398. this._annotationCanvasMap = null;
  4399. this.annotationLayer = null;
  4400. this.textLayer = null;
  4401. this.zoomLayer = null;
  4402. this.xfaLayer = null;
  4403. this.structTreeLayer = null;
  4404. var div = document.createElement("div");
  4405. div.className = "page";
  4406. div.style.width = Math.floor(this.viewport.width) + "px";
  4407. div.style.height = Math.floor(this.viewport.height) + "px";
  4408. div.setAttribute("data-page-number", this.id);
  4409. div.setAttribute("role", "region");
  4410. this.l10n.get("page_landmark", {
  4411. page: this.id
  4412. }).then(function (msg) {
  4413. div.setAttribute("aria-label", msg);
  4414. });
  4415. this.div = div;
  4416. container === null || container === void 0 ? void 0 : container.appendChild(div);
  4417. }
  4418. _createClass(PDFPageView, [{
  4419. key: "setPdfPage",
  4420. value: function setPdfPage(pdfPage) {
  4421. this.pdfPage = pdfPage;
  4422. this.pdfPageRotate = pdfPage.rotate;
  4423. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  4424. this.viewport = pdfPage.getViewport({
  4425. scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
  4426. rotation: totalRotation
  4427. });
  4428. this.reset();
  4429. }
  4430. }, {
  4431. key: "destroy",
  4432. value: function destroy() {
  4433. this.reset();
  4434. if (this.pdfPage) {
  4435. this.pdfPage.cleanup();
  4436. }
  4437. }
  4438. }, {
  4439. key: "_renderAnnotationLayer",
  4440. value: function () {
  4441. var _renderAnnotationLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  4442. var error;
  4443. return _regenerator["default"].wrap(function _callee$(_context) {
  4444. while (1) {
  4445. switch (_context.prev = _context.next) {
  4446. case 0:
  4447. error = null;
  4448. _context.prev = 1;
  4449. _context.next = 4;
  4450. return this.annotationLayer.render(this.viewport, "display");
  4451. case 4:
  4452. _context.next = 9;
  4453. break;
  4454. case 6:
  4455. _context.prev = 6;
  4456. _context.t0 = _context["catch"](1);
  4457. error = _context.t0;
  4458. case 9:
  4459. _context.prev = 9;
  4460. this.eventBus.dispatch("annotationlayerrendered", {
  4461. source: this,
  4462. pageNumber: this.id,
  4463. error: error
  4464. });
  4465. return _context.finish(9);
  4466. case 12:
  4467. case "end":
  4468. return _context.stop();
  4469. }
  4470. }
  4471. }, _callee, this, [[1, 6, 9, 12]]);
  4472. }));
  4473. function _renderAnnotationLayer() {
  4474. return _renderAnnotationLayer2.apply(this, arguments);
  4475. }
  4476. return _renderAnnotationLayer;
  4477. }()
  4478. }, {
  4479. key: "_renderXfaLayer",
  4480. value: function () {
  4481. var _renderXfaLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  4482. var error, result;
  4483. return _regenerator["default"].wrap(function _callee2$(_context2) {
  4484. while (1) {
  4485. switch (_context2.prev = _context2.next) {
  4486. case 0:
  4487. error = null;
  4488. _context2.prev = 1;
  4489. _context2.next = 4;
  4490. return this.xfaLayer.render(this.viewport, "display");
  4491. case 4:
  4492. result = _context2.sent;
  4493. if (this.textHighlighter) {
  4494. this._buildXfaTextContentItems(result.textDivs);
  4495. }
  4496. _context2.next = 11;
  4497. break;
  4498. case 8:
  4499. _context2.prev = 8;
  4500. _context2.t0 = _context2["catch"](1);
  4501. error = _context2.t0;
  4502. case 11:
  4503. _context2.prev = 11;
  4504. this.eventBus.dispatch("xfalayerrendered", {
  4505. source: this,
  4506. pageNumber: this.id,
  4507. error: error
  4508. });
  4509. return _context2.finish(11);
  4510. case 14:
  4511. case "end":
  4512. return _context2.stop();
  4513. }
  4514. }
  4515. }, _callee2, this, [[1, 8, 11, 14]]);
  4516. }));
  4517. function _renderXfaLayer() {
  4518. return _renderXfaLayer2.apply(this, arguments);
  4519. }
  4520. return _renderXfaLayer;
  4521. }()
  4522. }, {
  4523. key: "_buildXfaTextContentItems",
  4524. value: function () {
  4525. var _buildXfaTextContentItems2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(textDivs) {
  4526. var text, items, _iterator, _step, item;
  4527. return _regenerator["default"].wrap(function _callee3$(_context3) {
  4528. while (1) {
  4529. switch (_context3.prev = _context3.next) {
  4530. case 0:
  4531. _context3.next = 2;
  4532. return this.pdfPage.getTextContent();
  4533. case 2:
  4534. text = _context3.sent;
  4535. items = [];
  4536. _iterator = _createForOfIteratorHelper(text.items);
  4537. try {
  4538. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4539. item = _step.value;
  4540. items.push(item.str);
  4541. }
  4542. } catch (err) {
  4543. _iterator.e(err);
  4544. } finally {
  4545. _iterator.f();
  4546. }
  4547. this.textHighlighter.setTextMapping(textDivs, items);
  4548. this.textHighlighter.enable();
  4549. case 8:
  4550. case "end":
  4551. return _context3.stop();
  4552. }
  4553. }
  4554. }, _callee3, this);
  4555. }));
  4556. function _buildXfaTextContentItems(_x) {
  4557. return _buildXfaTextContentItems2.apply(this, arguments);
  4558. }
  4559. return _buildXfaTextContentItems;
  4560. }()
  4561. }, {
  4562. key: "_resetZoomLayer",
  4563. value: function _resetZoomLayer() {
  4564. var removeFromDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4565. if (!this.zoomLayer) {
  4566. return;
  4567. }
  4568. var zoomLayerCanvas = this.zoomLayer.firstChild;
  4569. this.paintedViewportMap["delete"](zoomLayerCanvas);
  4570. zoomLayerCanvas.width = 0;
  4571. zoomLayerCanvas.height = 0;
  4572. if (removeFromDOM) {
  4573. this.zoomLayer.remove();
  4574. }
  4575. this.zoomLayer = null;
  4576. }
  4577. }, {
  4578. key: "reset",
  4579. value: function reset() {
  4580. var _this$annotationLayer,
  4581. _this$xfaLayer,
  4582. _this = this;
  4583. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4584. _ref$keepZoomLayer = _ref.keepZoomLayer,
  4585. keepZoomLayer = _ref$keepZoomLayer === void 0 ? false : _ref$keepZoomLayer,
  4586. _ref$keepAnnotationLa = _ref.keepAnnotationLayer,
  4587. keepAnnotationLayer = _ref$keepAnnotationLa === void 0 ? false : _ref$keepAnnotationLa,
  4588. _ref$keepXfaLayer = _ref.keepXfaLayer,
  4589. keepXfaLayer = _ref$keepXfaLayer === void 0 ? false : _ref$keepXfaLayer;
  4590. this.cancelRendering({
  4591. keepAnnotationLayer: keepAnnotationLayer,
  4592. keepXfaLayer: keepXfaLayer
  4593. });
  4594. this.renderingState = _ui_utils.RenderingStates.INITIAL;
  4595. var div = this.div;
  4596. div.style.width = Math.floor(this.viewport.width) + "px";
  4597. div.style.height = Math.floor(this.viewport.height) + "px";
  4598. var childNodes = div.childNodes,
  4599. zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
  4600. annotationLayerNode = keepAnnotationLayer && ((_this$annotationLayer = this.annotationLayer) === null || _this$annotationLayer === void 0 ? void 0 : _this$annotationLayer.div) || null,
  4601. xfaLayerNode = keepXfaLayer && ((_this$xfaLayer = this.xfaLayer) === null || _this$xfaLayer === void 0 ? void 0 : _this$xfaLayer.div) || null;
  4602. for (var i = childNodes.length - 1; i >= 0; i--) {
  4603. var node = childNodes[i];
  4604. switch (node) {
  4605. case zoomLayerNode:
  4606. case annotationLayerNode:
  4607. case xfaLayerNode:
  4608. continue;
  4609. }
  4610. node.remove();
  4611. }
  4612. div.removeAttribute("data-loaded");
  4613. if (annotationLayerNode) {
  4614. this.annotationLayer.hide();
  4615. }
  4616. if (xfaLayerNode) {
  4617. this.xfaLayer.hide();
  4618. }
  4619. if (!zoomLayerNode) {
  4620. if (this.canvas) {
  4621. this.paintedViewportMap["delete"](this.canvas);
  4622. this.canvas.width = 0;
  4623. this.canvas.height = 0;
  4624. delete this.canvas;
  4625. }
  4626. this._resetZoomLayer();
  4627. }
  4628. if (this.svg) {
  4629. this.paintedViewportMap["delete"](this.svg);
  4630. delete this.svg;
  4631. }
  4632. this.loadingIconDiv = document.createElement("div");
  4633. this.loadingIconDiv.className = "loadingIcon notVisible";
  4634. if (this._isStandalone) {
  4635. this.toggleLoadingIconSpinner(true);
  4636. }
  4637. this.loadingIconDiv.setAttribute("role", "img");
  4638. this.l10n.get("loading").then(function (msg) {
  4639. var _this$loadingIconDiv;
  4640. (_this$loadingIconDiv = _this.loadingIconDiv) === null || _this$loadingIconDiv === void 0 ? void 0 : _this$loadingIconDiv.setAttribute("aria-label", msg);
  4641. });
  4642. div.appendChild(this.loadingIconDiv);
  4643. }
  4644. }, {
  4645. key: "update",
  4646. value: function update(_ref2) {
  4647. var _ref2$scale = _ref2.scale,
  4648. scale = _ref2$scale === void 0 ? 0 : _ref2$scale,
  4649. _ref2$rotation = _ref2.rotation,
  4650. rotation = _ref2$rotation === void 0 ? null : _ref2$rotation,
  4651. _ref2$optionalContent = _ref2.optionalContentConfigPromise,
  4652. optionalContentConfigPromise = _ref2$optionalContent === void 0 ? null : _ref2$optionalContent;
  4653. this.scale = scale || this.scale;
  4654. if (typeof rotation === "number") {
  4655. this.rotation = rotation;
  4656. }
  4657. if (optionalContentConfigPromise instanceof Promise) {
  4658. this._optionalContentConfigPromise = optionalContentConfigPromise;
  4659. }
  4660. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  4661. this.viewport = this.viewport.clone({
  4662. scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
  4663. rotation: totalRotation
  4664. });
  4665. if (this._isStandalone) {
  4666. var style = document.documentElement.style;
  4667. style.setProperty("--zoom-factor", this.scale);
  4668. }
  4669. if (this.svg) {
  4670. this.cssTransform({
  4671. target: this.svg,
  4672. redrawAnnotationLayer: true,
  4673. redrawXfaLayer: true
  4674. });
  4675. this.eventBus.dispatch("pagerendered", {
  4676. source: this,
  4677. pageNumber: this.id,
  4678. cssTransform: true,
  4679. timestamp: performance.now(),
  4680. error: this._renderError
  4681. });
  4682. return;
  4683. }
  4684. var isScalingRestricted = false;
  4685. if (this.canvas && this.maxCanvasPixels > 0) {
  4686. var outputScale = this.outputScale;
  4687. if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) {
  4688. isScalingRestricted = true;
  4689. }
  4690. }
  4691. if (this.canvas) {
  4692. if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
  4693. this.cssTransform({
  4694. target: this.canvas,
  4695. redrawAnnotationLayer: true,
  4696. redrawXfaLayer: true
  4697. });
  4698. this.eventBus.dispatch("pagerendered", {
  4699. source: this,
  4700. pageNumber: this.id,
  4701. cssTransform: true,
  4702. timestamp: performance.now(),
  4703. error: this._renderError
  4704. });
  4705. return;
  4706. }
  4707. if (!this.zoomLayer && !this.canvas.hidden) {
  4708. this.zoomLayer = this.canvas.parentNode;
  4709. this.zoomLayer.style.position = "absolute";
  4710. }
  4711. }
  4712. if (this.zoomLayer) {
  4713. this.cssTransform({
  4714. target: this.zoomLayer.firstChild
  4715. });
  4716. }
  4717. this.reset({
  4718. keepZoomLayer: true,
  4719. keepAnnotationLayer: true,
  4720. keepXfaLayer: true
  4721. });
  4722. }
  4723. }, {
  4724. key: "cancelRendering",
  4725. value: function cancelRendering() {
  4726. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4727. _ref3$keepAnnotationL = _ref3.keepAnnotationLayer,
  4728. keepAnnotationLayer = _ref3$keepAnnotationL === void 0 ? false : _ref3$keepAnnotationL,
  4729. _ref3$keepXfaLayer = _ref3.keepXfaLayer,
  4730. keepXfaLayer = _ref3$keepXfaLayer === void 0 ? false : _ref3$keepXfaLayer;
  4731. if (this.paintTask) {
  4732. this.paintTask.cancel();
  4733. this.paintTask = null;
  4734. }
  4735. this.resume = null;
  4736. if (this.textLayer) {
  4737. this.textLayer.cancel();
  4738. this.textLayer = null;
  4739. }
  4740. if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
  4741. this.annotationLayer.cancel();
  4742. this.annotationLayer = null;
  4743. this._annotationCanvasMap = null;
  4744. }
  4745. if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
  4746. var _this$textHighlighter;
  4747. this.xfaLayer.cancel();
  4748. this.xfaLayer = null;
  4749. (_this$textHighlighter = this.textHighlighter) === null || _this$textHighlighter === void 0 ? void 0 : _this$textHighlighter.disable();
  4750. }
  4751. if (this._onTextLayerRendered) {
  4752. this.eventBus._off("textlayerrendered", this._onTextLayerRendered);
  4753. this._onTextLayerRendered = null;
  4754. }
  4755. }
  4756. }, {
  4757. key: "cssTransform",
  4758. value: function cssTransform(_ref4) {
  4759. var target = _ref4.target,
  4760. _ref4$redrawAnnotatio = _ref4.redrawAnnotationLayer,
  4761. redrawAnnotationLayer = _ref4$redrawAnnotatio === void 0 ? false : _ref4$redrawAnnotatio,
  4762. _ref4$redrawXfaLayer = _ref4.redrawXfaLayer,
  4763. redrawXfaLayer = _ref4$redrawXfaLayer === void 0 ? false : _ref4$redrawXfaLayer;
  4764. var width = this.viewport.width;
  4765. var height = this.viewport.height;
  4766. var div = this.div;
  4767. target.style.width = target.parentNode.style.width = div.style.width = Math.floor(width) + "px";
  4768. target.style.height = target.parentNode.style.height = div.style.height = Math.floor(height) + "px";
  4769. var relativeRotation = this.viewport.rotation - this.paintedViewportMap.get(target).rotation;
  4770. var absRotation = Math.abs(relativeRotation);
  4771. var scaleX = 1,
  4772. scaleY = 1;
  4773. if (absRotation === 90 || absRotation === 270) {
  4774. scaleX = height / width;
  4775. scaleY = width / height;
  4776. }
  4777. target.style.transform = "rotate(".concat(relativeRotation, "deg) scale(").concat(scaleX, ", ").concat(scaleY, ")");
  4778. if (this.textLayer) {
  4779. var textLayerViewport = this.textLayer.viewport;
  4780. var textRelativeRotation = this.viewport.rotation - textLayerViewport.rotation;
  4781. var textAbsRotation = Math.abs(textRelativeRotation);
  4782. var scale = width / textLayerViewport.width;
  4783. if (textAbsRotation === 90 || textAbsRotation === 270) {
  4784. scale = width / textLayerViewport.height;
  4785. }
  4786. var textLayerDiv = this.textLayer.textLayerDiv;
  4787. var transX, transY;
  4788. switch (textAbsRotation) {
  4789. case 0:
  4790. transX = transY = 0;
  4791. break;
  4792. case 90:
  4793. transX = 0;
  4794. transY = "-" + textLayerDiv.style.height;
  4795. break;
  4796. case 180:
  4797. transX = "-" + textLayerDiv.style.width;
  4798. transY = "-" + textLayerDiv.style.height;
  4799. break;
  4800. case 270:
  4801. transX = "-" + textLayerDiv.style.width;
  4802. transY = 0;
  4803. break;
  4804. default:
  4805. console.error("Bad rotation value.");
  4806. break;
  4807. }
  4808. textLayerDiv.style.transform = "rotate(".concat(textAbsRotation, "deg) ") + "scale(".concat(scale, ") ") + "translate(".concat(transX, ", ").concat(transY, ")");
  4809. textLayerDiv.style.transformOrigin = "0% 0%";
  4810. }
  4811. if (redrawAnnotationLayer && this.annotationLayer) {
  4812. this._renderAnnotationLayer();
  4813. }
  4814. if (redrawXfaLayer && this.xfaLayer) {
  4815. this._renderXfaLayer();
  4816. }
  4817. }
  4818. }, {
  4819. key: "width",
  4820. get: function get() {
  4821. return this.viewport.width;
  4822. }
  4823. }, {
  4824. key: "height",
  4825. get: function get() {
  4826. return this.viewport.height;
  4827. }
  4828. }, {
  4829. key: "getPagePoint",
  4830. value: function getPagePoint(x, y) {
  4831. return this.viewport.convertToPdfPoint(x, y);
  4832. }
  4833. }, {
  4834. key: "toggleLoadingIconSpinner",
  4835. value: function toggleLoadingIconSpinner() {
  4836. var _this$loadingIconDiv2;
  4837. var viewVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4838. (_this$loadingIconDiv2 = this.loadingIconDiv) === null || _this$loadingIconDiv2 === void 0 ? void 0 : _this$loadingIconDiv2.classList.toggle("notVisible", !viewVisible);
  4839. }
  4840. }, {
  4841. key: "draw",
  4842. value: function draw() {
  4843. var _this$annotationLayer2,
  4844. _this$xfaLayer2,
  4845. _this2 = this;
  4846. if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
  4847. console.error("Must be in new state before drawing");
  4848. this.reset();
  4849. }
  4850. var div = this.div,
  4851. pdfPage = this.pdfPage;
  4852. if (!pdfPage) {
  4853. this.renderingState = _ui_utils.RenderingStates.FINISHED;
  4854. if (this.loadingIconDiv) {
  4855. this.loadingIconDiv.remove();
  4856. delete this.loadingIconDiv;
  4857. }
  4858. return Promise.reject(new Error("pdfPage is not loaded"));
  4859. }
  4860. this.renderingState = _ui_utils.RenderingStates.RUNNING;
  4861. var canvasWrapper = document.createElement("div");
  4862. canvasWrapper.style.width = div.style.width;
  4863. canvasWrapper.style.height = div.style.height;
  4864. canvasWrapper.classList.add("canvasWrapper");
  4865. if ((_this$annotationLayer2 = this.annotationLayer) !== null && _this$annotationLayer2 !== void 0 && _this$annotationLayer2.div) {
  4866. div.insertBefore(canvasWrapper, this.annotationLayer.div);
  4867. } else {
  4868. div.appendChild(canvasWrapper);
  4869. }
  4870. var textLayer = null;
  4871. if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) {
  4872. var _this$annotationLayer3;
  4873. var textLayerDiv = document.createElement("div");
  4874. textLayerDiv.className = "textLayer";
  4875. textLayerDiv.style.width = canvasWrapper.style.width;
  4876. textLayerDiv.style.height = canvasWrapper.style.height;
  4877. if ((_this$annotationLayer3 = this.annotationLayer) !== null && _this$annotationLayer3 !== void 0 && _this$annotationLayer3.div) {
  4878. div.insertBefore(textLayerDiv, this.annotationLayer.div);
  4879. } else {
  4880. div.appendChild(textLayerDiv);
  4881. }
  4882. textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus, this.textHighlighter);
  4883. }
  4884. this.textLayer = textLayer;
  4885. if (_classPrivateFieldGet(this, _annotationMode) !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
  4886. this._annotationCanvasMap || (this._annotationCanvasMap = new Map());
  4887. this.annotationLayer || (this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, _classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, null, null, null, this._annotationCanvasMap));
  4888. }
  4889. if ((_this$xfaLayer2 = this.xfaLayer) !== null && _this$xfaLayer2 !== void 0 && _this$xfaLayer2.div) {
  4890. div.appendChild(this.xfaLayer.div);
  4891. }
  4892. var renderContinueCallback = null;
  4893. if (this.renderingQueue) {
  4894. renderContinueCallback = function renderContinueCallback(cont) {
  4895. if (!_this2.renderingQueue.isHighestPriority(_this2)) {
  4896. _this2.renderingState = _ui_utils.RenderingStates.PAUSED;
  4897. _this2.resume = function () {
  4898. _this2.renderingState = _ui_utils.RenderingStates.RUNNING;
  4899. cont();
  4900. };
  4901. return;
  4902. }
  4903. cont();
  4904. };
  4905. }
  4906. var finishPaintTask = /*#__PURE__*/function () {
  4907. var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  4908. var error,
  4909. _args4 = arguments;
  4910. return _regenerator["default"].wrap(function _callee4$(_context4) {
  4911. while (1) {
  4912. switch (_context4.prev = _context4.next) {
  4913. case 0:
  4914. error = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
  4915. if (paintTask === _this2.paintTask) {
  4916. _this2.paintTask = null;
  4917. }
  4918. if (!(error instanceof _pdfjsLib.RenderingCancelledException)) {
  4919. _context4.next = 5;
  4920. break;
  4921. }
  4922. _this2._renderError = null;
  4923. return _context4.abrupt("return");
  4924. case 5:
  4925. _this2._renderError = error;
  4926. _this2.renderingState = _ui_utils.RenderingStates.FINISHED;
  4927. if (_this2.loadingIconDiv) {
  4928. _this2.loadingIconDiv.remove();
  4929. delete _this2.loadingIconDiv;
  4930. }
  4931. _this2._resetZoomLayer(true);
  4932. _this2.eventBus.dispatch("pagerendered", {
  4933. source: _this2,
  4934. pageNumber: _this2.id,
  4935. cssTransform: false,
  4936. timestamp: performance.now(),
  4937. error: _this2._renderError
  4938. });
  4939. if (!error) {
  4940. _context4.next = 12;
  4941. break;
  4942. }
  4943. throw error;
  4944. case 12:
  4945. case "end":
  4946. return _context4.stop();
  4947. }
  4948. }
  4949. }, _callee4);
  4950. }));
  4951. return function finishPaintTask() {
  4952. return _ref5.apply(this, arguments);
  4953. };
  4954. }();
  4955. var paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper);
  4956. paintTask.onRenderContinue = renderContinueCallback;
  4957. this.paintTask = paintTask;
  4958. var resultPromise = paintTask.promise.then(function () {
  4959. return finishPaintTask(null).then(function () {
  4960. if (textLayer) {
  4961. var readableStream = pdfPage.streamTextContent({
  4962. includeMarkedContent: true
  4963. });
  4964. textLayer.setTextContentStream(readableStream);
  4965. textLayer.render();
  4966. }
  4967. if (_this2.annotationLayer) {
  4968. _this2._renderAnnotationLayer();
  4969. }
  4970. });
  4971. }, function (reason) {
  4972. return finishPaintTask(reason);
  4973. });
  4974. if (this.xfaLayerFactory) {
  4975. if (!this.xfaLayer) {
  4976. this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(div, pdfPage, null);
  4977. }
  4978. this._renderXfaLayer();
  4979. }
  4980. if (this.structTreeLayerFactory && this.textLayer && this.canvas) {
  4981. this._onTextLayerRendered = function (event) {
  4982. if (event.pageNumber !== _this2.id) {
  4983. return;
  4984. }
  4985. _this2.eventBus._off("textlayerrendered", _this2._onTextLayerRendered);
  4986. _this2._onTextLayerRendered = null;
  4987. if (!_this2.canvas) {
  4988. return;
  4989. }
  4990. _this2.pdfPage.getStructTree().then(function (tree) {
  4991. if (!tree) {
  4992. return;
  4993. }
  4994. if (!_this2.canvas) {
  4995. return;
  4996. }
  4997. var treeDom = _this2.structTreeLayer.render(tree);
  4998. treeDom.classList.add("structTree");
  4999. _this2.canvas.appendChild(treeDom);
  5000. });
  5001. };
  5002. this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
  5003. this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
  5004. }
  5005. div.setAttribute("data-loaded", true);
  5006. this.eventBus.dispatch("pagerender", {
  5007. source: this,
  5008. pageNumber: this.id
  5009. });
  5010. return resultPromise;
  5011. }
  5012. }, {
  5013. key: "paintOnCanvas",
  5014. value: function paintOnCanvas(canvasWrapper) {
  5015. var renderCapability = (0, _pdfjsLib.createPromiseCapability)();
  5016. var result = {
  5017. promise: renderCapability.promise,
  5018. onRenderContinue: function onRenderContinue(cont) {
  5019. cont();
  5020. },
  5021. cancel: function cancel() {
  5022. renderTask.cancel();
  5023. }
  5024. };
  5025. var viewport = this.viewport;
  5026. var canvas = document.createElement("canvas");
  5027. canvas.hidden = true;
  5028. var isCanvasHidden = true;
  5029. var showCanvas = function showCanvas() {
  5030. if (isCanvasHidden) {
  5031. canvas.hidden = false;
  5032. isCanvasHidden = false;
  5033. }
  5034. };
  5035. canvasWrapper.appendChild(canvas);
  5036. this.canvas = canvas;
  5037. var ctx = canvas.getContext("2d", {
  5038. alpha: false
  5039. });
  5040. var outputScale = this.outputScale = new _ui_utils.OutputScale();
  5041. if (this.useOnlyCssZoom) {
  5042. var actualSizeViewport = viewport.clone({
  5043. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5044. });
  5045. outputScale.sx *= actualSizeViewport.width / viewport.width;
  5046. outputScale.sy *= actualSizeViewport.height / viewport.height;
  5047. }
  5048. if (this.maxCanvasPixels > 0) {
  5049. var pixelsInViewport = viewport.width * viewport.height;
  5050. var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
  5051. if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
  5052. outputScale.sx = maxScale;
  5053. outputScale.sy = maxScale;
  5054. this.hasRestrictedScaling = true;
  5055. } else {
  5056. this.hasRestrictedScaling = false;
  5057. }
  5058. }
  5059. var sfx = (0, _ui_utils.approximateFraction)(outputScale.sx);
  5060. var sfy = (0, _ui_utils.approximateFraction)(outputScale.sy);
  5061. canvas.width = (0, _ui_utils.roundToDivide)(viewport.width * outputScale.sx, sfx[0]);
  5062. canvas.height = (0, _ui_utils.roundToDivide)(viewport.height * outputScale.sy, sfy[0]);
  5063. canvas.style.width = (0, _ui_utils.roundToDivide)(viewport.width, sfx[1]) + "px";
  5064. canvas.style.height = (0, _ui_utils.roundToDivide)(viewport.height, sfy[1]) + "px";
  5065. this.paintedViewportMap.set(canvas, viewport);
  5066. var transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
  5067. var renderContext = {
  5068. canvasContext: ctx,
  5069. transform: transform,
  5070. viewport: this.viewport,
  5071. annotationMode: _classPrivateFieldGet(this, _annotationMode),
  5072. optionalContentConfigPromise: this._optionalContentConfigPromise,
  5073. annotationCanvasMap: this._annotationCanvasMap,
  5074. pageColors: this.pageColors
  5075. };
  5076. var renderTask = this.pdfPage.render(renderContext);
  5077. renderTask.onContinue = function (cont) {
  5078. showCanvas();
  5079. if (result.onRenderContinue) {
  5080. result.onRenderContinue(cont);
  5081. } else {
  5082. cont();
  5083. }
  5084. };
  5085. renderTask.promise.then(function () {
  5086. showCanvas();
  5087. renderCapability.resolve();
  5088. }, function (error) {
  5089. showCanvas();
  5090. renderCapability.reject(error);
  5091. });
  5092. return result;
  5093. }
  5094. }, {
  5095. key: "paintOnSvg",
  5096. value: function paintOnSvg(wrapper) {
  5097. var _this3 = this;
  5098. var cancelled = false;
  5099. var ensureNotCancelled = function ensureNotCancelled() {
  5100. if (cancelled) {
  5101. throw new _pdfjsLib.RenderingCancelledException("Rendering cancelled, page ".concat(_this3.id), "svg");
  5102. }
  5103. };
  5104. var pdfPage = this.pdfPage;
  5105. var actualSizeViewport = this.viewport.clone({
  5106. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5107. });
  5108. var promise = pdfPage.getOperatorList({
  5109. annotationMode: _classPrivateFieldGet(this, _annotationMode)
  5110. }).then(function (opList) {
  5111. ensureNotCancelled();
  5112. var svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs);
  5113. return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {
  5114. ensureNotCancelled();
  5115. _this3.svg = svg;
  5116. _this3.paintedViewportMap.set(svg, actualSizeViewport);
  5117. svg.style.width = wrapper.style.width;
  5118. svg.style.height = wrapper.style.height;
  5119. _this3.renderingState = _ui_utils.RenderingStates.FINISHED;
  5120. wrapper.appendChild(svg);
  5121. });
  5122. });
  5123. return {
  5124. promise: promise,
  5125. onRenderContinue: function onRenderContinue(cont) {
  5126. cont();
  5127. },
  5128. cancel: function cancel() {
  5129. cancelled = true;
  5130. }
  5131. };
  5132. }
  5133. }, {
  5134. key: "setPageLabel",
  5135. value: function setPageLabel(label) {
  5136. this.pageLabel = typeof label === "string" ? label : null;
  5137. if (this.pageLabel !== null) {
  5138. this.div.setAttribute("data-page-label", this.pageLabel);
  5139. } else {
  5140. this.div.removeAttribute("data-page-label");
  5141. }
  5142. }
  5143. }]);
  5144. return PDFPageView;
  5145. }();
  5146. exports.PDFPageView = PDFPageView;
  5147. /***/ }),
  5148. /* 15 */
  5149. /***/ ((__unused_webpack_module, exports) => {
  5150. Object.defineProperty(exports, "__esModule", ({
  5151. value: true
  5152. }));
  5153. exports.compatibilityParams = exports.OptionKind = exports.AppOptions = void 0;
  5154. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  5155. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5156. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5157. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5158. var compatibilityParams = Object.create(null);
  5159. exports.compatibilityParams = compatibilityParams;
  5160. {
  5161. var userAgent = navigator.userAgent || "";
  5162. var platform = navigator.platform || "";
  5163. var maxTouchPoints = navigator.maxTouchPoints || 1;
  5164. var isAndroid = /Android/.test(userAgent);
  5165. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
  5166. (function checkCanvasSizeLimitation() {
  5167. if (isIOS || isAndroid) {
  5168. compatibilityParams.maxCanvasPixels = 5242880;
  5169. }
  5170. })();
  5171. }
  5172. var OptionKind = {
  5173. VIEWER: 0x02,
  5174. API: 0x04,
  5175. WORKER: 0x08,
  5176. PREFERENCE: 0x80
  5177. };
  5178. exports.OptionKind = OptionKind;
  5179. var defaultOptions = {
  5180. annotationMode: {
  5181. value: 2,
  5182. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5183. },
  5184. cursorToolOnLoad: {
  5185. value: 0,
  5186. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5187. },
  5188. defaultUrl: {
  5189. value: "compressed.tracemonkey-pldi-09.pdf",
  5190. kind: OptionKind.VIEWER
  5191. },
  5192. defaultZoomValue: {
  5193. value: "",
  5194. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5195. },
  5196. disableHistory: {
  5197. value: false,
  5198. kind: OptionKind.VIEWER
  5199. },
  5200. disablePageLabels: {
  5201. value: false,
  5202. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5203. },
  5204. enablePermissions: {
  5205. value: false,
  5206. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5207. },
  5208. enablePrintAutoRotate: {
  5209. value: true,
  5210. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5211. },
  5212. enableScripting: {
  5213. value: true,
  5214. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5215. },
  5216. externalLinkRel: {
  5217. value: "noopener noreferrer nofollow",
  5218. kind: OptionKind.VIEWER
  5219. },
  5220. externalLinkTarget: {
  5221. value: 0,
  5222. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5223. },
  5224. historyUpdateUrl: {
  5225. value: false,
  5226. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5227. },
  5228. ignoreDestinationZoom: {
  5229. value: false,
  5230. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5231. },
  5232. imageResourcesPath: {
  5233. value: "./images/",
  5234. kind: OptionKind.VIEWER
  5235. },
  5236. maxCanvasPixels: {
  5237. value: 16777216,
  5238. compatibility: compatibilityParams.maxCanvasPixels,
  5239. kind: OptionKind.VIEWER
  5240. },
  5241. pageColorsBackground: {
  5242. value: "Canvas",
  5243. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5244. },
  5245. pageColorsForeground: {
  5246. value: "CanvasText",
  5247. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5248. },
  5249. pdfBugEnabled: {
  5250. value: false,
  5251. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5252. },
  5253. printResolution: {
  5254. value: 150,
  5255. kind: OptionKind.VIEWER
  5256. },
  5257. renderer: {
  5258. value: "canvas",
  5259. kind: OptionKind.VIEWER
  5260. },
  5261. sidebarViewOnLoad: {
  5262. value: -1,
  5263. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5264. },
  5265. scrollModeOnLoad: {
  5266. value: -1,
  5267. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5268. },
  5269. spreadModeOnLoad: {
  5270. value: -1,
  5271. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5272. },
  5273. textLayerMode: {
  5274. value: 1,
  5275. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5276. },
  5277. useOnlyCssZoom: {
  5278. value: false,
  5279. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5280. },
  5281. viewerCssTheme: {
  5282. value: 0,
  5283. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5284. },
  5285. viewOnLoad: {
  5286. value: 0,
  5287. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5288. },
  5289. cMapPacked: {
  5290. value: true,
  5291. kind: OptionKind.API
  5292. },
  5293. cMapUrl: {
  5294. value: "../web/cmaps/",
  5295. kind: OptionKind.API
  5296. },
  5297. disableAutoFetch: {
  5298. value: false,
  5299. kind: OptionKind.API + OptionKind.PREFERENCE
  5300. },
  5301. disableFontFace: {
  5302. value: false,
  5303. kind: OptionKind.API + OptionKind.PREFERENCE
  5304. },
  5305. disableRange: {
  5306. value: false,
  5307. kind: OptionKind.API + OptionKind.PREFERENCE
  5308. },
  5309. disableStream: {
  5310. value: false,
  5311. kind: OptionKind.API + OptionKind.PREFERENCE
  5312. },
  5313. docBaseUrl: {
  5314. value: "",
  5315. kind: OptionKind.API
  5316. },
  5317. enableXfa: {
  5318. value: true,
  5319. kind: OptionKind.API + OptionKind.PREFERENCE
  5320. },
  5321. fontExtraProperties: {
  5322. value: false,
  5323. kind: OptionKind.API
  5324. },
  5325. isEvalSupported: {
  5326. value: true,
  5327. kind: OptionKind.API
  5328. },
  5329. maxImageSize: {
  5330. value: -1,
  5331. kind: OptionKind.API
  5332. },
  5333. pdfBug: {
  5334. value: false,
  5335. kind: OptionKind.API
  5336. },
  5337. standardFontDataUrl: {
  5338. value: "../web/standard_fonts/",
  5339. kind: OptionKind.API
  5340. },
  5341. verbosity: {
  5342. value: 1,
  5343. kind: OptionKind.API
  5344. },
  5345. workerPort: {
  5346. value: null,
  5347. kind: OptionKind.WORKER
  5348. },
  5349. workerSrc: {
  5350. value: "../build/pdf.worker.js",
  5351. kind: OptionKind.WORKER
  5352. }
  5353. };
  5354. {
  5355. defaultOptions.disablePreferences = {
  5356. value: false,
  5357. kind: OptionKind.VIEWER
  5358. };
  5359. defaultOptions.locale = {
  5360. value: navigator.language || "en-US",
  5361. kind: OptionKind.VIEWER
  5362. };
  5363. defaultOptions.sandboxBundleSrc = {
  5364. value: "../build/pdf.sandbox.js",
  5365. kind: OptionKind.VIEWER
  5366. };
  5367. defaultOptions.renderer.kind += OptionKind.PREFERENCE;
  5368. }
  5369. var userOptions = Object.create(null);
  5370. var AppOptions = /*#__PURE__*/function () {
  5371. function AppOptions() {
  5372. _classCallCheck(this, AppOptions);
  5373. throw new Error("Cannot initialize AppOptions.");
  5374. }
  5375. _createClass(AppOptions, null, [{
  5376. key: "get",
  5377. value: function get(name) {
  5378. var userOption = userOptions[name];
  5379. if (userOption !== undefined) {
  5380. return userOption;
  5381. }
  5382. var defaultOption = defaultOptions[name];
  5383. if (defaultOption !== undefined) {
  5384. var _defaultOption$compat;
  5385. return (_defaultOption$compat = defaultOption.compatibility) !== null && _defaultOption$compat !== void 0 ? _defaultOption$compat : defaultOption.value;
  5386. }
  5387. return undefined;
  5388. }
  5389. }, {
  5390. key: "getAll",
  5391. value: function getAll() {
  5392. var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  5393. var options = Object.create(null);
  5394. for (var name in defaultOptions) {
  5395. var _defaultOption$compat2;
  5396. var defaultOption = defaultOptions[name];
  5397. if (kind) {
  5398. if ((kind & defaultOption.kind) === 0) {
  5399. continue;
  5400. }
  5401. if (kind === OptionKind.PREFERENCE) {
  5402. var value = defaultOption.value,
  5403. valueType = _typeof(value);
  5404. if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) {
  5405. options[name] = value;
  5406. continue;
  5407. }
  5408. throw new Error("Invalid type for preference: ".concat(name));
  5409. }
  5410. }
  5411. var userOption = userOptions[name];
  5412. options[name] = userOption !== undefined ? userOption : (_defaultOption$compat2 = defaultOption.compatibility) !== null && _defaultOption$compat2 !== void 0 ? _defaultOption$compat2 : defaultOption.value;
  5413. }
  5414. return options;
  5415. }
  5416. }, {
  5417. key: "set",
  5418. value: function set(name, value) {
  5419. userOptions[name] = value;
  5420. }
  5421. }, {
  5422. key: "setAll",
  5423. value: function setAll(options) {
  5424. for (var name in options) {
  5425. userOptions[name] = options[name];
  5426. }
  5427. }
  5428. }, {
  5429. key: "remove",
  5430. value: function remove(name) {
  5431. delete userOptions[name];
  5432. }
  5433. }, {
  5434. key: "_hasUserOptions",
  5435. value: function _hasUserOptions() {
  5436. return Object.keys(userOptions).length > 0;
  5437. }
  5438. }]);
  5439. return AppOptions;
  5440. }();
  5441. exports.AppOptions = AppOptions;
  5442. /***/ }),
  5443. /* 16 */
  5444. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5445. Object.defineProperty(exports, "__esModule", ({
  5446. value: true
  5447. }));
  5448. exports.PDFRenderingQueue = void 0;
  5449. var _pdfjsLib = __w_pdfjs_require__(5);
  5450. var _ui_utils = __w_pdfjs_require__(8);
  5451. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5452. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5453. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5454. var CLEANUP_TIMEOUT = 30000;
  5455. var PDFRenderingQueue = /*#__PURE__*/function () {
  5456. function PDFRenderingQueue() {
  5457. _classCallCheck(this, PDFRenderingQueue);
  5458. this.pdfViewer = null;
  5459. this.pdfThumbnailViewer = null;
  5460. this.onIdle = null;
  5461. this.highestPriorityPage = null;
  5462. this.idleTimeout = null;
  5463. this.printing = false;
  5464. this.isThumbnailViewEnabled = false;
  5465. }
  5466. _createClass(PDFRenderingQueue, [{
  5467. key: "setViewer",
  5468. value: function setViewer(pdfViewer) {
  5469. this.pdfViewer = pdfViewer;
  5470. }
  5471. }, {
  5472. key: "setThumbnailViewer",
  5473. value: function setThumbnailViewer(pdfThumbnailViewer) {
  5474. this.pdfThumbnailViewer = pdfThumbnailViewer;
  5475. }
  5476. }, {
  5477. key: "isHighestPriority",
  5478. value: function isHighestPriority(view) {
  5479. return this.highestPriorityPage === view.renderingId;
  5480. }
  5481. }, {
  5482. key: "hasViewer",
  5483. value: function hasViewer() {
  5484. return !!this.pdfViewer;
  5485. }
  5486. }, {
  5487. key: "renderHighestPriority",
  5488. value: function renderHighestPriority(currentlyVisiblePages) {
  5489. var _this$pdfThumbnailVie;
  5490. if (this.idleTimeout) {
  5491. clearTimeout(this.idleTimeout);
  5492. this.idleTimeout = null;
  5493. }
  5494. if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
  5495. return;
  5496. }
  5497. if (this.isThumbnailViewEnabled && (_this$pdfThumbnailVie = this.pdfThumbnailViewer) !== null && _this$pdfThumbnailVie !== void 0 && _this$pdfThumbnailVie.forceRendering()) {
  5498. return;
  5499. }
  5500. if (this.printing) {
  5501. return;
  5502. }
  5503. if (this.onIdle) {
  5504. this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
  5505. }
  5506. }
  5507. }, {
  5508. key: "getHighestPriority",
  5509. value: function getHighestPriority(visible, views, scrolledDown) {
  5510. var preRenderExtra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  5511. var visibleViews = visible.views,
  5512. numVisible = visibleViews.length;
  5513. if (numVisible === 0) {
  5514. return null;
  5515. }
  5516. for (var i = 0; i < numVisible; i++) {
  5517. var view = visibleViews[i].view;
  5518. if (!this.isViewFinished(view)) {
  5519. return view;
  5520. }
  5521. }
  5522. var firstId = visible.first.id,
  5523. lastId = visible.last.id;
  5524. if (lastId - firstId + 1 > numVisible) {
  5525. var visibleIds = visible.ids;
  5526. for (var _i = 1, ii = lastId - firstId; _i < ii; _i++) {
  5527. var holeId = scrolledDown ? firstId + _i : lastId - _i;
  5528. if (visibleIds.has(holeId)) {
  5529. continue;
  5530. }
  5531. var holeView = views[holeId - 1];
  5532. if (!this.isViewFinished(holeView)) {
  5533. return holeView;
  5534. }
  5535. }
  5536. }
  5537. var preRenderIndex = scrolledDown ? lastId : firstId - 2;
  5538. var preRenderView = views[preRenderIndex];
  5539. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5540. return preRenderView;
  5541. }
  5542. if (preRenderExtra) {
  5543. preRenderIndex += scrolledDown ? 1 : -1;
  5544. preRenderView = views[preRenderIndex];
  5545. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5546. return preRenderView;
  5547. }
  5548. }
  5549. return null;
  5550. }
  5551. }, {
  5552. key: "isViewFinished",
  5553. value: function isViewFinished(view) {
  5554. return view.renderingState === _ui_utils.RenderingStates.FINISHED;
  5555. }
  5556. }, {
  5557. key: "renderView",
  5558. value: function renderView(view) {
  5559. var _this = this;
  5560. switch (view.renderingState) {
  5561. case _ui_utils.RenderingStates.FINISHED:
  5562. return false;
  5563. case _ui_utils.RenderingStates.PAUSED:
  5564. this.highestPriorityPage = view.renderingId;
  5565. view.resume();
  5566. break;
  5567. case _ui_utils.RenderingStates.RUNNING:
  5568. this.highestPriorityPage = view.renderingId;
  5569. break;
  5570. case _ui_utils.RenderingStates.INITIAL:
  5571. this.highestPriorityPage = view.renderingId;
  5572. view.draw()["finally"](function () {
  5573. _this.renderHighestPriority();
  5574. })["catch"](function (reason) {
  5575. if (reason instanceof _pdfjsLib.RenderingCancelledException) {
  5576. return;
  5577. }
  5578. console.error("renderView: \"".concat(reason, "\""));
  5579. });
  5580. break;
  5581. }
  5582. return true;
  5583. }
  5584. }]);
  5585. return PDFRenderingQueue;
  5586. }();
  5587. exports.PDFRenderingQueue = PDFRenderingQueue;
  5588. /***/ }),
  5589. /* 17 */
  5590. /***/ ((__unused_webpack_module, exports) => {
  5591. Object.defineProperty(exports, "__esModule", ({
  5592. value: true
  5593. }));
  5594. exports.TextHighlighter = void 0;
  5595. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5596. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5597. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5598. var TextHighlighter = /*#__PURE__*/function () {
  5599. function TextHighlighter(_ref) {
  5600. var findController = _ref.findController,
  5601. eventBus = _ref.eventBus,
  5602. pageIndex = _ref.pageIndex;
  5603. _classCallCheck(this, TextHighlighter);
  5604. this.findController = findController;
  5605. this.matches = [];
  5606. this.eventBus = eventBus;
  5607. this.pageIdx = pageIndex;
  5608. this._onUpdateTextLayerMatches = null;
  5609. this.textDivs = null;
  5610. this.textContentItemsStr = null;
  5611. this.enabled = false;
  5612. }
  5613. _createClass(TextHighlighter, [{
  5614. key: "setTextMapping",
  5615. value: function setTextMapping(divs, texts) {
  5616. this.textDivs = divs;
  5617. this.textContentItemsStr = texts;
  5618. }
  5619. }, {
  5620. key: "enable",
  5621. value: function enable() {
  5622. var _this = this;
  5623. if (!this.textDivs || !this.textContentItemsStr) {
  5624. throw new Error("Text divs and strings have not been set.");
  5625. }
  5626. if (this.enabled) {
  5627. throw new Error("TextHighlighter is already enabled.");
  5628. }
  5629. this.enabled = true;
  5630. if (!this._onUpdateTextLayerMatches) {
  5631. this._onUpdateTextLayerMatches = function (evt) {
  5632. if (evt.pageIndex === _this.pageIdx || evt.pageIndex === -1) {
  5633. _this._updateMatches();
  5634. }
  5635. };
  5636. this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
  5637. }
  5638. this._updateMatches();
  5639. }
  5640. }, {
  5641. key: "disable",
  5642. value: function disable() {
  5643. if (!this.enabled) {
  5644. return;
  5645. }
  5646. this.enabled = false;
  5647. if (this._onUpdateTextLayerMatches) {
  5648. this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
  5649. this._onUpdateTextLayerMatches = null;
  5650. }
  5651. }
  5652. }, {
  5653. key: "_convertMatches",
  5654. value: function _convertMatches(matches, matchesLength) {
  5655. if (!matches) {
  5656. return [];
  5657. }
  5658. var textContentItemsStr = this.textContentItemsStr;
  5659. var i = 0,
  5660. iIndex = 0;
  5661. var end = textContentItemsStr.length - 1;
  5662. var result = [];
  5663. for (var m = 0, mm = matches.length; m < mm; m++) {
  5664. var matchIdx = matches[m];
  5665. while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
  5666. iIndex += textContentItemsStr[i].length;
  5667. i++;
  5668. }
  5669. if (i === textContentItemsStr.length) {
  5670. console.error("Could not find a matching mapping");
  5671. }
  5672. var match = {
  5673. begin: {
  5674. divIdx: i,
  5675. offset: matchIdx - iIndex
  5676. }
  5677. };
  5678. matchIdx += matchesLength[m];
  5679. while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
  5680. iIndex += textContentItemsStr[i].length;
  5681. i++;
  5682. }
  5683. match.end = {
  5684. divIdx: i,
  5685. offset: matchIdx - iIndex
  5686. };
  5687. result.push(match);
  5688. }
  5689. return result;
  5690. }
  5691. }, {
  5692. key: "_renderMatches",
  5693. value: function _renderMatches(matches) {
  5694. if (matches.length === 0) {
  5695. return;
  5696. }
  5697. var findController = this.findController,
  5698. pageIdx = this.pageIdx;
  5699. var textContentItemsStr = this.textContentItemsStr,
  5700. textDivs = this.textDivs;
  5701. var isSelectedPage = pageIdx === findController.selected.pageIdx;
  5702. var selectedMatchIdx = findController.selected.matchIdx;
  5703. var highlightAll = findController.state.highlightAll;
  5704. var prevEnd = null;
  5705. var infinity = {
  5706. divIdx: -1,
  5707. offset: undefined
  5708. };
  5709. function beginText(begin, className) {
  5710. var divIdx = begin.divIdx;
  5711. textDivs[divIdx].textContent = "";
  5712. return appendTextToDiv(divIdx, 0, begin.offset, className);
  5713. }
  5714. function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
  5715. var div = textDivs[divIdx];
  5716. if (div.nodeType === Node.TEXT_NODE) {
  5717. var span = document.createElement("span");
  5718. div.parentNode.insertBefore(span, div);
  5719. span.appendChild(div);
  5720. textDivs[divIdx] = span;
  5721. div = span;
  5722. }
  5723. var content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
  5724. var node = document.createTextNode(content);
  5725. if (className) {
  5726. var _span = document.createElement("span");
  5727. _span.className = "".concat(className, " appended");
  5728. _span.appendChild(node);
  5729. div.appendChild(_span);
  5730. return className.includes("selected") ? _span.offsetLeft : 0;
  5731. }
  5732. div.appendChild(node);
  5733. return 0;
  5734. }
  5735. var i0 = selectedMatchIdx,
  5736. i1 = i0 + 1;
  5737. if (highlightAll) {
  5738. i0 = 0;
  5739. i1 = matches.length;
  5740. } else if (!isSelectedPage) {
  5741. return;
  5742. }
  5743. for (var i = i0; i < i1; i++) {
  5744. var match = matches[i];
  5745. var begin = match.begin;
  5746. var end = match.end;
  5747. var isSelected = isSelectedPage && i === selectedMatchIdx;
  5748. var highlightSuffix = isSelected ? " selected" : "";
  5749. var selectedLeft = 0;
  5750. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
  5751. if (prevEnd !== null) {
  5752. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  5753. }
  5754. beginText(begin);
  5755. } else {
  5756. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
  5757. }
  5758. if (begin.divIdx === end.divIdx) {
  5759. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
  5760. } else {
  5761. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
  5762. for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
  5763. textDivs[n0].className = "highlight middle" + highlightSuffix;
  5764. }
  5765. beginText(end, "highlight end" + highlightSuffix);
  5766. }
  5767. prevEnd = end;
  5768. if (isSelected) {
  5769. findController.scrollMatchIntoView({
  5770. element: textDivs[begin.divIdx],
  5771. selectedLeft: selectedLeft,
  5772. pageIndex: pageIdx,
  5773. matchIndex: selectedMatchIdx
  5774. });
  5775. }
  5776. }
  5777. if (prevEnd) {
  5778. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  5779. }
  5780. }
  5781. }, {
  5782. key: "_updateMatches",
  5783. value: function _updateMatches() {
  5784. if (!this.enabled) {
  5785. return;
  5786. }
  5787. var findController = this.findController,
  5788. matches = this.matches,
  5789. pageIdx = this.pageIdx;
  5790. var textContentItemsStr = this.textContentItemsStr,
  5791. textDivs = this.textDivs;
  5792. var clearedUntilDivIdx = -1;
  5793. for (var i = 0, ii = matches.length; i < ii; i++) {
  5794. var match = matches[i];
  5795. var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
  5796. for (var n = begin, end = match.end.divIdx; n <= end; n++) {
  5797. var div = textDivs[n];
  5798. div.textContent = textContentItemsStr[n];
  5799. div.className = "";
  5800. }
  5801. clearedUntilDivIdx = match.end.divIdx + 1;
  5802. }
  5803. if (!(findController !== null && findController !== void 0 && findController.highlightMatches)) {
  5804. return;
  5805. }
  5806. var pageMatches = findController.pageMatches[pageIdx] || null;
  5807. var pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
  5808. this.matches = this._convertMatches(pageMatches, pageMatchesLength);
  5809. this._renderMatches(this.matches);
  5810. }
  5811. }]);
  5812. return TextHighlighter;
  5813. }();
  5814. exports.TextHighlighter = TextHighlighter;
  5815. /***/ }),
  5816. /* 18 */
  5817. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5818. Object.defineProperty(exports, "__esModule", ({
  5819. value: true
  5820. }));
  5821. exports.DownloadManager = void 0;
  5822. var _pdfjsLib = __w_pdfjs_require__(5);
  5823. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5824. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5825. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5826. ;
  5827. function _download(blobUrl, filename) {
  5828. var a = document.createElement("a");
  5829. if (!a.click) {
  5830. throw new Error('DownloadManager: "a.click()" is not supported.');
  5831. }
  5832. a.href = blobUrl;
  5833. a.target = "_parent";
  5834. if ("download" in a) {
  5835. a.download = filename;
  5836. }
  5837. (document.body || document.documentElement).appendChild(a);
  5838. a.click();
  5839. a.remove();
  5840. }
  5841. var DownloadManager = /*#__PURE__*/function () {
  5842. function DownloadManager() {
  5843. _classCallCheck(this, DownloadManager);
  5844. this._openBlobUrls = new WeakMap();
  5845. }
  5846. _createClass(DownloadManager, [{
  5847. key: "downloadUrl",
  5848. value: function downloadUrl(url, filename) {
  5849. if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
  5850. console.error("downloadUrl - not a valid URL: ".concat(url));
  5851. return;
  5852. }
  5853. _download(url + "#pdfjs.action=download", filename);
  5854. }
  5855. }, {
  5856. key: "downloadData",
  5857. value: function downloadData(data, filename, contentType) {
  5858. var blobUrl = URL.createObjectURL(new Blob([data], {
  5859. type: contentType
  5860. }));
  5861. _download(blobUrl, filename);
  5862. }
  5863. }, {
  5864. key: "openOrDownloadData",
  5865. value: function openOrDownloadData(element, data, filename) {
  5866. var isPdfData = (0, _pdfjsLib.isPdfFile)(filename);
  5867. var contentType = isPdfData ? "application/pdf" : "";
  5868. if (isPdfData) {
  5869. var blobUrl = this._openBlobUrls.get(element);
  5870. if (!blobUrl) {
  5871. blobUrl = URL.createObjectURL(new Blob([data], {
  5872. type: contentType
  5873. }));
  5874. this._openBlobUrls.set(element, blobUrl);
  5875. }
  5876. var viewerUrl;
  5877. viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
  5878. try {
  5879. window.open(viewerUrl);
  5880. return true;
  5881. } catch (ex) {
  5882. console.error("openOrDownloadData: ".concat(ex));
  5883. URL.revokeObjectURL(blobUrl);
  5884. this._openBlobUrls["delete"](element);
  5885. }
  5886. }
  5887. this.downloadData(data, filename, contentType);
  5888. return false;
  5889. }
  5890. }, {
  5891. key: "download",
  5892. value: function download(blob, url, filename) {
  5893. var sourceEventType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "download";
  5894. var blobUrl = URL.createObjectURL(blob);
  5895. _download(blobUrl, filename);
  5896. }
  5897. }]);
  5898. return DownloadManager;
  5899. }();
  5900. exports.DownloadManager = DownloadManager;
  5901. /***/ }),
  5902. /* 19 */
  5903. /***/ ((__unused_webpack_module, exports) => {
  5904. Object.defineProperty(exports, "__esModule", ({
  5905. value: true
  5906. }));
  5907. exports.WaitOnType = exports.EventBus = exports.AutomationEventBus = void 0;
  5908. exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
  5909. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  5910. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5911. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  5912. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
  5913. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  5914. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  5915. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  5916. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  5917. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  5918. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  5919. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5920. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  5921. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  5922. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  5923. var WaitOnType = {
  5924. EVENT: "event",
  5925. TIMEOUT: "timeout"
  5926. };
  5927. exports.WaitOnType = WaitOnType;
  5928. function waitOnEventOrTimeout(_ref) {
  5929. var target = _ref.target,
  5930. name = _ref.name,
  5931. _ref$delay = _ref.delay,
  5932. delay = _ref$delay === void 0 ? 0 : _ref$delay;
  5933. return new Promise(function (resolve, reject) {
  5934. if (_typeof(target) !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
  5935. throw new Error("waitOnEventOrTimeout - invalid parameters.");
  5936. }
  5937. function handler(type) {
  5938. if (target instanceof EventBus) {
  5939. target._off(name, eventHandler);
  5940. } else {
  5941. target.removeEventListener(name, eventHandler);
  5942. }
  5943. if (timeout) {
  5944. clearTimeout(timeout);
  5945. }
  5946. resolve(type);
  5947. }
  5948. var eventHandler = handler.bind(null, WaitOnType.EVENT);
  5949. if (target instanceof EventBus) {
  5950. target._on(name, eventHandler);
  5951. } else {
  5952. target.addEventListener(name, eventHandler);
  5953. }
  5954. var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
  5955. var timeout = setTimeout(timeoutHandler, delay);
  5956. });
  5957. }
  5958. var EventBus = /*#__PURE__*/function () {
  5959. function EventBus() {
  5960. _classCallCheck(this, EventBus);
  5961. this._listeners = Object.create(null);
  5962. }
  5963. _createClass(EventBus, [{
  5964. key: "on",
  5965. value: function on(eventName, listener) {
  5966. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5967. this._on(eventName, listener, {
  5968. external: true,
  5969. once: options === null || options === void 0 ? void 0 : options.once
  5970. });
  5971. }
  5972. }, {
  5973. key: "off",
  5974. value: function off(eventName, listener) {
  5975. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5976. this._off(eventName, listener, {
  5977. external: true,
  5978. once: options === null || options === void 0 ? void 0 : options.once
  5979. });
  5980. }
  5981. }, {
  5982. key: "dispatch",
  5983. value: function dispatch(eventName, data) {
  5984. var eventListeners = this._listeners[eventName];
  5985. if (!eventListeners || eventListeners.length === 0) {
  5986. return;
  5987. }
  5988. var externalListeners;
  5989. var _iterator = _createForOfIteratorHelper(eventListeners.slice(0)),
  5990. _step;
  5991. try {
  5992. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5993. var _step$value = _step.value,
  5994. _listener = _step$value.listener,
  5995. external = _step$value.external,
  5996. once = _step$value.once;
  5997. if (once) {
  5998. this._off(eventName, _listener);
  5999. }
  6000. if (external) {
  6001. (externalListeners || (externalListeners = [])).push(_listener);
  6002. continue;
  6003. }
  6004. _listener(data);
  6005. }
  6006. } catch (err) {
  6007. _iterator.e(err);
  6008. } finally {
  6009. _iterator.f();
  6010. }
  6011. if (externalListeners) {
  6012. var _iterator2 = _createForOfIteratorHelper(externalListeners),
  6013. _step2;
  6014. try {
  6015. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  6016. var listener = _step2.value;
  6017. listener(data);
  6018. }
  6019. } catch (err) {
  6020. _iterator2.e(err);
  6021. } finally {
  6022. _iterator2.f();
  6023. }
  6024. externalListeners = null;
  6025. }
  6026. }
  6027. }, {
  6028. key: "_on",
  6029. value: function _on(eventName, listener) {
  6030. var _this$_listeners;
  6031. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6032. var eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []);
  6033. eventListeners.push({
  6034. listener: listener,
  6035. external: (options === null || options === void 0 ? void 0 : options.external) === true,
  6036. once: (options === null || options === void 0 ? void 0 : options.once) === true
  6037. });
  6038. }
  6039. }, {
  6040. key: "_off",
  6041. value: function _off(eventName, listener) {
  6042. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6043. var eventListeners = this._listeners[eventName];
  6044. if (!eventListeners) {
  6045. return;
  6046. }
  6047. for (var i = 0, ii = eventListeners.length; i < ii; i++) {
  6048. if (eventListeners[i].listener === listener) {
  6049. eventListeners.splice(i, 1);
  6050. return;
  6051. }
  6052. }
  6053. }
  6054. }]);
  6055. return EventBus;
  6056. }();
  6057. exports.EventBus = EventBus;
  6058. var AutomationEventBus = /*#__PURE__*/function (_EventBus) {
  6059. _inherits(AutomationEventBus, _EventBus);
  6060. var _super = _createSuper(AutomationEventBus);
  6061. function AutomationEventBus() {
  6062. _classCallCheck(this, AutomationEventBus);
  6063. return _super.apply(this, arguments);
  6064. }
  6065. _createClass(AutomationEventBus, [{
  6066. key: "dispatch",
  6067. value: function dispatch(eventName, data) {
  6068. throw new Error("Not implemented: AutomationEventBus.dispatch");
  6069. }
  6070. }]);
  6071. return AutomationEventBus;
  6072. }(EventBus);
  6073. exports.AutomationEventBus = AutomationEventBus;
  6074. /***/ }),
  6075. /* 20 */
  6076. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6077. Object.defineProperty(exports, "__esModule", ({
  6078. value: true
  6079. }));
  6080. exports.GenericL10n = void 0;
  6081. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  6082. __w_pdfjs_require__(21);
  6083. var _l10n_utils = __w_pdfjs_require__(6);
  6084. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6085. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  6086. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  6087. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6088. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6089. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  6090. var webL10n = document.webL10n;
  6091. var GenericL10n = /*#__PURE__*/function () {
  6092. function GenericL10n(lang) {
  6093. _classCallCheck(this, GenericL10n);
  6094. this._lang = lang;
  6095. this._ready = new Promise(function (resolve, reject) {
  6096. webL10n.setLanguage((0, _l10n_utils.fixupLangCode)(lang), function () {
  6097. resolve(webL10n);
  6098. });
  6099. });
  6100. }
  6101. _createClass(GenericL10n, [{
  6102. key: "getLanguage",
  6103. value: function () {
  6104. var _getLanguage = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  6105. var l10n;
  6106. return _regenerator["default"].wrap(function _callee$(_context) {
  6107. while (1) {
  6108. switch (_context.prev = _context.next) {
  6109. case 0:
  6110. _context.next = 2;
  6111. return this._ready;
  6112. case 2:
  6113. l10n = _context.sent;
  6114. return _context.abrupt("return", l10n.getLanguage());
  6115. case 4:
  6116. case "end":
  6117. return _context.stop();
  6118. }
  6119. }
  6120. }, _callee, this);
  6121. }));
  6122. function getLanguage() {
  6123. return _getLanguage.apply(this, arguments);
  6124. }
  6125. return getLanguage;
  6126. }()
  6127. }, {
  6128. key: "getDirection",
  6129. value: function () {
  6130. var _getDirection = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  6131. var l10n;
  6132. return _regenerator["default"].wrap(function _callee2$(_context2) {
  6133. while (1) {
  6134. switch (_context2.prev = _context2.next) {
  6135. case 0:
  6136. _context2.next = 2;
  6137. return this._ready;
  6138. case 2:
  6139. l10n = _context2.sent;
  6140. return _context2.abrupt("return", l10n.getDirection());
  6141. case 4:
  6142. case "end":
  6143. return _context2.stop();
  6144. }
  6145. }
  6146. }, _callee2, this);
  6147. }));
  6148. function getDirection() {
  6149. return _getDirection.apply(this, arguments);
  6150. }
  6151. return getDirection;
  6152. }()
  6153. }, {
  6154. key: "get",
  6155. value: function () {
  6156. var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(key) {
  6157. var args,
  6158. fallback,
  6159. l10n,
  6160. _args3 = arguments;
  6161. return _regenerator["default"].wrap(function _callee3$(_context3) {
  6162. while (1) {
  6163. switch (_context3.prev = _context3.next) {
  6164. case 0:
  6165. args = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
  6166. fallback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : (0, _l10n_utils.getL10nFallback)(key, args);
  6167. _context3.next = 4;
  6168. return this._ready;
  6169. case 4:
  6170. l10n = _context3.sent;
  6171. return _context3.abrupt("return", l10n.get(key, args, fallback));
  6172. case 6:
  6173. case "end":
  6174. return _context3.stop();
  6175. }
  6176. }
  6177. }, _callee3, this);
  6178. }));
  6179. function get(_x) {
  6180. return _get.apply(this, arguments);
  6181. }
  6182. return get;
  6183. }()
  6184. }, {
  6185. key: "translate",
  6186. value: function () {
  6187. var _translate = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(element) {
  6188. var l10n;
  6189. return _regenerator["default"].wrap(function _callee4$(_context4) {
  6190. while (1) {
  6191. switch (_context4.prev = _context4.next) {
  6192. case 0:
  6193. _context4.next = 2;
  6194. return this._ready;
  6195. case 2:
  6196. l10n = _context4.sent;
  6197. return _context4.abrupt("return", l10n.translate(element));
  6198. case 4:
  6199. case "end":
  6200. return _context4.stop();
  6201. }
  6202. }
  6203. }, _callee4, this);
  6204. }));
  6205. function translate(_x2) {
  6206. return _translate.apply(this, arguments);
  6207. }
  6208. return translate;
  6209. }()
  6210. }]);
  6211. return GenericL10n;
  6212. }();
  6213. exports.GenericL10n = GenericL10n;
  6214. /***/ }),
  6215. /* 21 */
  6216. /***/ (() => {
  6217. document.webL10n = function (window, document, undefined) {
  6218. var gL10nData = {};
  6219. var gTextData = '';
  6220. var gTextProp = 'textContent';
  6221. var gLanguage = '';
  6222. var gMacros = {};
  6223. var gReadyState = 'loading';
  6224. var gAsyncResourceLoading = true;
  6225. function getL10nResourceLinks() {
  6226. return document.querySelectorAll('link[type="application/l10n"]');
  6227. }
  6228. function getL10nDictionary() {
  6229. var script = document.querySelector('script[type="application/l10n"]');
  6230. return script ? JSON.parse(script.innerHTML) : null;
  6231. }
  6232. function getTranslatableChildren(element) {
  6233. return element ? element.querySelectorAll('*[data-l10n-id]') : [];
  6234. }
  6235. function getL10nAttributes(element) {
  6236. if (!element) return {};
  6237. var l10nId = element.getAttribute('data-l10n-id');
  6238. var l10nArgs = element.getAttribute('data-l10n-args');
  6239. var args = {};
  6240. if (l10nArgs) {
  6241. try {
  6242. args = JSON.parse(l10nArgs);
  6243. } catch (e) {
  6244. console.warn('could not parse arguments for #' + l10nId);
  6245. }
  6246. }
  6247. return {
  6248. id: l10nId,
  6249. args: args
  6250. };
  6251. }
  6252. function xhrLoadText(url, onSuccess, onFailure) {
  6253. onSuccess = onSuccess || function _onSuccess(data) {};
  6254. onFailure = onFailure || function _onFailure() {};
  6255. var xhr = new XMLHttpRequest();
  6256. xhr.open('GET', url, gAsyncResourceLoading);
  6257. if (xhr.overrideMimeType) {
  6258. xhr.overrideMimeType('text/plain; charset=utf-8');
  6259. }
  6260. xhr.onreadystatechange = function () {
  6261. if (xhr.readyState == 4) {
  6262. if (xhr.status == 200 || xhr.status === 0) {
  6263. onSuccess(xhr.responseText);
  6264. } else {
  6265. onFailure();
  6266. }
  6267. }
  6268. };
  6269. xhr.onerror = onFailure;
  6270. xhr.ontimeout = onFailure;
  6271. try {
  6272. xhr.send(null);
  6273. } catch (e) {
  6274. onFailure();
  6275. }
  6276. }
  6277. function parseResource(href, lang, successCallback, failureCallback) {
  6278. var baseURL = href.replace(/[^\/]*$/, '') || './';
  6279. function evalString(text) {
  6280. if (text.lastIndexOf('\\') < 0) return text;
  6281. return text.replace(/\\\\/g, '\\').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\b/g, '\b').replace(/\\f/g, '\f').replace(/\\{/g, '{').replace(/\\}/g, '}').replace(/\\"/g, '"').replace(/\\'/g, "'");
  6282. }
  6283. function parseProperties(text, parsedPropertiesCallback) {
  6284. var dictionary = {};
  6285. var reBlank = /^\s*|\s*$/;
  6286. var reComment = /^\s*#|^\s*$/;
  6287. var reSection = /^\s*\[(.*)\]\s*$/;
  6288. var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
  6289. var reSplit = /^([^=\s]*)\s*=\s*(.+)$/;
  6290. function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
  6291. var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
  6292. var currentLang = '*';
  6293. var genericLang = lang.split('-', 1)[0];
  6294. var skipLang = false;
  6295. var match = '';
  6296. function nextEntry() {
  6297. while (true) {
  6298. if (!entries.length) {
  6299. parsedRawLinesCallback();
  6300. return;
  6301. }
  6302. var line = entries.shift();
  6303. if (reComment.test(line)) continue;
  6304. if (extendedSyntax) {
  6305. match = reSection.exec(line);
  6306. if (match) {
  6307. currentLang = match[1].toLowerCase();
  6308. skipLang = currentLang !== '*' && currentLang !== lang && currentLang !== genericLang;
  6309. continue;
  6310. } else if (skipLang) {
  6311. continue;
  6312. }
  6313. match = reImport.exec(line);
  6314. if (match) {
  6315. loadImport(baseURL + match[1], nextEntry);
  6316. return;
  6317. }
  6318. }
  6319. var tmp = line.match(reSplit);
  6320. if (tmp && tmp.length == 3) {
  6321. dictionary[tmp[1]] = evalString(tmp[2]);
  6322. }
  6323. }
  6324. }
  6325. nextEntry();
  6326. }
  6327. function loadImport(url, callback) {
  6328. xhrLoadText(url, function (content) {
  6329. parseRawLines(content, false, callback);
  6330. }, function () {
  6331. console.warn(url + ' not found.');
  6332. callback();
  6333. });
  6334. }
  6335. parseRawLines(text, true, function () {
  6336. parsedPropertiesCallback(dictionary);
  6337. });
  6338. }
  6339. xhrLoadText(href, function (response) {
  6340. gTextData += response;
  6341. parseProperties(response, function (data) {
  6342. for (var key in data) {
  6343. var id,
  6344. prop,
  6345. index = key.lastIndexOf('.');
  6346. if (index > 0) {
  6347. id = key.substring(0, index);
  6348. prop = key.substring(index + 1);
  6349. } else {
  6350. id = key;
  6351. prop = gTextProp;
  6352. }
  6353. if (!gL10nData[id]) {
  6354. gL10nData[id] = {};
  6355. }
  6356. gL10nData[id][prop] = data[key];
  6357. }
  6358. if (successCallback) {
  6359. successCallback();
  6360. }
  6361. });
  6362. }, failureCallback);
  6363. }
  6364. function loadLocale(lang, callback) {
  6365. if (lang) {
  6366. lang = lang.toLowerCase();
  6367. }
  6368. callback = callback || function _callback() {};
  6369. clear();
  6370. gLanguage = lang;
  6371. var langLinks = getL10nResourceLinks();
  6372. var langCount = langLinks.length;
  6373. if (langCount === 0) {
  6374. var dict = getL10nDictionary();
  6375. if (dict && dict.locales && dict.default_locale) {
  6376. console.log('using the embedded JSON directory, early way out');
  6377. gL10nData = dict.locales[lang];
  6378. if (!gL10nData) {
  6379. var defaultLocale = dict.default_locale.toLowerCase();
  6380. for (var anyCaseLang in dict.locales) {
  6381. anyCaseLang = anyCaseLang.toLowerCase();
  6382. if (anyCaseLang === lang) {
  6383. gL10nData = dict.locales[lang];
  6384. break;
  6385. } else if (anyCaseLang === defaultLocale) {
  6386. gL10nData = dict.locales[defaultLocale];
  6387. }
  6388. }
  6389. }
  6390. callback();
  6391. } else {
  6392. console.log('no resource to load, early way out');
  6393. }
  6394. gReadyState = 'complete';
  6395. return;
  6396. }
  6397. var onResourceLoaded = null;
  6398. var gResourceCount = 0;
  6399. onResourceLoaded = function onResourceLoaded() {
  6400. gResourceCount++;
  6401. if (gResourceCount >= langCount) {
  6402. callback();
  6403. gReadyState = 'complete';
  6404. }
  6405. };
  6406. function L10nResourceLink(link) {
  6407. var href = link.href;
  6408. this.load = function (lang, callback) {
  6409. parseResource(href, lang, callback, function () {
  6410. console.warn(href + ' not found.');
  6411. console.warn('"' + lang + '" resource not found');
  6412. gLanguage = '';
  6413. callback();
  6414. });
  6415. };
  6416. }
  6417. for (var i = 0; i < langCount; i++) {
  6418. var resource = new L10nResourceLink(langLinks[i]);
  6419. resource.load(lang, onResourceLoaded);
  6420. }
  6421. }
  6422. function clear() {
  6423. gL10nData = {};
  6424. gTextData = '';
  6425. gLanguage = '';
  6426. }
  6427. function getPluralRules(lang) {
  6428. var locales2rules = {
  6429. 'af': 3,
  6430. 'ak': 4,
  6431. 'am': 4,
  6432. 'ar': 1,
  6433. 'asa': 3,
  6434. 'az': 0,
  6435. 'be': 11,
  6436. 'bem': 3,
  6437. 'bez': 3,
  6438. 'bg': 3,
  6439. 'bh': 4,
  6440. 'bm': 0,
  6441. 'bn': 3,
  6442. 'bo': 0,
  6443. 'br': 20,
  6444. 'brx': 3,
  6445. 'bs': 11,
  6446. 'ca': 3,
  6447. 'cgg': 3,
  6448. 'chr': 3,
  6449. 'cs': 12,
  6450. 'cy': 17,
  6451. 'da': 3,
  6452. 'de': 3,
  6453. 'dv': 3,
  6454. 'dz': 0,
  6455. 'ee': 3,
  6456. 'el': 3,
  6457. 'en': 3,
  6458. 'eo': 3,
  6459. 'es': 3,
  6460. 'et': 3,
  6461. 'eu': 3,
  6462. 'fa': 0,
  6463. 'ff': 5,
  6464. 'fi': 3,
  6465. 'fil': 4,
  6466. 'fo': 3,
  6467. 'fr': 5,
  6468. 'fur': 3,
  6469. 'fy': 3,
  6470. 'ga': 8,
  6471. 'gd': 24,
  6472. 'gl': 3,
  6473. 'gsw': 3,
  6474. 'gu': 3,
  6475. 'guw': 4,
  6476. 'gv': 23,
  6477. 'ha': 3,
  6478. 'haw': 3,
  6479. 'he': 2,
  6480. 'hi': 4,
  6481. 'hr': 11,
  6482. 'hu': 0,
  6483. 'id': 0,
  6484. 'ig': 0,
  6485. 'ii': 0,
  6486. 'is': 3,
  6487. 'it': 3,
  6488. 'iu': 7,
  6489. 'ja': 0,
  6490. 'jmc': 3,
  6491. 'jv': 0,
  6492. 'ka': 0,
  6493. 'kab': 5,
  6494. 'kaj': 3,
  6495. 'kcg': 3,
  6496. 'kde': 0,
  6497. 'kea': 0,
  6498. 'kk': 3,
  6499. 'kl': 3,
  6500. 'km': 0,
  6501. 'kn': 0,
  6502. 'ko': 0,
  6503. 'ksb': 3,
  6504. 'ksh': 21,
  6505. 'ku': 3,
  6506. 'kw': 7,
  6507. 'lag': 18,
  6508. 'lb': 3,
  6509. 'lg': 3,
  6510. 'ln': 4,
  6511. 'lo': 0,
  6512. 'lt': 10,
  6513. 'lv': 6,
  6514. 'mas': 3,
  6515. 'mg': 4,
  6516. 'mk': 16,
  6517. 'ml': 3,
  6518. 'mn': 3,
  6519. 'mo': 9,
  6520. 'mr': 3,
  6521. 'ms': 0,
  6522. 'mt': 15,
  6523. 'my': 0,
  6524. 'nah': 3,
  6525. 'naq': 7,
  6526. 'nb': 3,
  6527. 'nd': 3,
  6528. 'ne': 3,
  6529. 'nl': 3,
  6530. 'nn': 3,
  6531. 'no': 3,
  6532. 'nr': 3,
  6533. 'nso': 4,
  6534. 'ny': 3,
  6535. 'nyn': 3,
  6536. 'om': 3,
  6537. 'or': 3,
  6538. 'pa': 3,
  6539. 'pap': 3,
  6540. 'pl': 13,
  6541. 'ps': 3,
  6542. 'pt': 3,
  6543. 'rm': 3,
  6544. 'ro': 9,
  6545. 'rof': 3,
  6546. 'ru': 11,
  6547. 'rwk': 3,
  6548. 'sah': 0,
  6549. 'saq': 3,
  6550. 'se': 7,
  6551. 'seh': 3,
  6552. 'ses': 0,
  6553. 'sg': 0,
  6554. 'sh': 11,
  6555. 'shi': 19,
  6556. 'sk': 12,
  6557. 'sl': 14,
  6558. 'sma': 7,
  6559. 'smi': 7,
  6560. 'smj': 7,
  6561. 'smn': 7,
  6562. 'sms': 7,
  6563. 'sn': 3,
  6564. 'so': 3,
  6565. 'sq': 3,
  6566. 'sr': 11,
  6567. 'ss': 3,
  6568. 'ssy': 3,
  6569. 'st': 3,
  6570. 'sv': 3,
  6571. 'sw': 3,
  6572. 'syr': 3,
  6573. 'ta': 3,
  6574. 'te': 3,
  6575. 'teo': 3,
  6576. 'th': 0,
  6577. 'ti': 4,
  6578. 'tig': 3,
  6579. 'tk': 3,
  6580. 'tl': 4,
  6581. 'tn': 3,
  6582. 'to': 0,
  6583. 'tr': 0,
  6584. 'ts': 3,
  6585. 'tzm': 22,
  6586. 'uk': 11,
  6587. 'ur': 3,
  6588. 've': 3,
  6589. 'vi': 0,
  6590. 'vun': 3,
  6591. 'wa': 4,
  6592. 'wae': 3,
  6593. 'wo': 0,
  6594. 'xh': 3,
  6595. 'xog': 3,
  6596. 'yo': 0,
  6597. 'zh': 0,
  6598. 'zu': 3
  6599. };
  6600. function isIn(n, list) {
  6601. return list.indexOf(n) !== -1;
  6602. }
  6603. function isBetween(n, start, end) {
  6604. return start <= n && n <= end;
  6605. }
  6606. var pluralRules = {
  6607. '0': function _(n) {
  6608. return 'other';
  6609. },
  6610. '1': function _(n) {
  6611. if (isBetween(n % 100, 3, 10)) return 'few';
  6612. if (n === 0) return 'zero';
  6613. if (isBetween(n % 100, 11, 99)) return 'many';
  6614. if (n == 2) return 'two';
  6615. if (n == 1) return 'one';
  6616. return 'other';
  6617. },
  6618. '2': function _(n) {
  6619. if (n !== 0 && n % 10 === 0) return 'many';
  6620. if (n == 2) return 'two';
  6621. if (n == 1) return 'one';
  6622. return 'other';
  6623. },
  6624. '3': function _(n) {
  6625. if (n == 1) return 'one';
  6626. return 'other';
  6627. },
  6628. '4': function _(n) {
  6629. if (isBetween(n, 0, 1)) return 'one';
  6630. return 'other';
  6631. },
  6632. '5': function _(n) {
  6633. if (isBetween(n, 0, 2) && n != 2) return 'one';
  6634. return 'other';
  6635. },
  6636. '6': function _(n) {
  6637. if (n === 0) return 'zero';
  6638. if (n % 10 == 1 && n % 100 != 11) return 'one';
  6639. return 'other';
  6640. },
  6641. '7': function _(n) {
  6642. if (n == 2) return 'two';
  6643. if (n == 1) return 'one';
  6644. return 'other';
  6645. },
  6646. '8': function _(n) {
  6647. if (isBetween(n, 3, 6)) return 'few';
  6648. if (isBetween(n, 7, 10)) return 'many';
  6649. if (n == 2) return 'two';
  6650. if (n == 1) return 'one';
  6651. return 'other';
  6652. },
  6653. '9': function _(n) {
  6654. if (n === 0 || n != 1 && isBetween(n % 100, 1, 19)) return 'few';
  6655. if (n == 1) return 'one';
  6656. return 'other';
  6657. },
  6658. '10': function _(n) {
  6659. if (isBetween(n % 10, 2, 9) && !isBetween(n % 100, 11, 19)) return 'few';
  6660. if (n % 10 == 1 && !isBetween(n % 100, 11, 19)) return 'one';
  6661. return 'other';
  6662. },
  6663. '11': function _(n) {
  6664. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  6665. if (n % 10 === 0 || isBetween(n % 10, 5, 9) || isBetween(n % 100, 11, 14)) return 'many';
  6666. if (n % 10 == 1 && n % 100 != 11) return 'one';
  6667. return 'other';
  6668. },
  6669. '12': function _(n) {
  6670. if (isBetween(n, 2, 4)) return 'few';
  6671. if (n == 1) return 'one';
  6672. return 'other';
  6673. },
  6674. '13': function _(n) {
  6675. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  6676. if (n != 1 && isBetween(n % 10, 0, 1) || isBetween(n % 10, 5, 9) || isBetween(n % 100, 12, 14)) return 'many';
  6677. if (n == 1) return 'one';
  6678. return 'other';
  6679. },
  6680. '14': function _(n) {
  6681. if (isBetween(n % 100, 3, 4)) return 'few';
  6682. if (n % 100 == 2) return 'two';
  6683. if (n % 100 == 1) return 'one';
  6684. return 'other';
  6685. },
  6686. '15': function _(n) {
  6687. if (n === 0 || isBetween(n % 100, 2, 10)) return 'few';
  6688. if (isBetween(n % 100, 11, 19)) return 'many';
  6689. if (n == 1) return 'one';
  6690. return 'other';
  6691. },
  6692. '16': function _(n) {
  6693. if (n % 10 == 1 && n != 11) return 'one';
  6694. return 'other';
  6695. },
  6696. '17': function _(n) {
  6697. if (n == 3) return 'few';
  6698. if (n === 0) return 'zero';
  6699. if (n == 6) return 'many';
  6700. if (n == 2) return 'two';
  6701. if (n == 1) return 'one';
  6702. return 'other';
  6703. },
  6704. '18': function _(n) {
  6705. if (n === 0) return 'zero';
  6706. if (isBetween(n, 0, 2) && n !== 0 && n != 2) return 'one';
  6707. return 'other';
  6708. },
  6709. '19': function _(n) {
  6710. if (isBetween(n, 2, 10)) return 'few';
  6711. if (isBetween(n, 0, 1)) return 'one';
  6712. return 'other';
  6713. },
  6714. '20': function _(n) {
  6715. if ((isBetween(n % 10, 3, 4) || n % 10 == 9) && !(isBetween(n % 100, 10, 19) || isBetween(n % 100, 70, 79) || isBetween(n % 100, 90, 99))) return 'few';
  6716. if (n % 1000000 === 0 && n !== 0) return 'many';
  6717. if (n % 10 == 2 && !isIn(n % 100, [12, 72, 92])) return 'two';
  6718. if (n % 10 == 1 && !isIn(n % 100, [11, 71, 91])) return 'one';
  6719. return 'other';
  6720. },
  6721. '21': function _(n) {
  6722. if (n === 0) return 'zero';
  6723. if (n == 1) return 'one';
  6724. return 'other';
  6725. },
  6726. '22': function _(n) {
  6727. if (isBetween(n, 0, 1) || isBetween(n, 11, 99)) return 'one';
  6728. return 'other';
  6729. },
  6730. '23': function _(n) {
  6731. if (isBetween(n % 10, 1, 2) || n % 20 === 0) return 'one';
  6732. return 'other';
  6733. },
  6734. '24': function _(n) {
  6735. if (isBetween(n, 3, 10) || isBetween(n, 13, 19)) return 'few';
  6736. if (isIn(n, [2, 12])) return 'two';
  6737. if (isIn(n, [1, 11])) return 'one';
  6738. return 'other';
  6739. }
  6740. };
  6741. var index = locales2rules[lang.replace(/-.*$/, '')];
  6742. if (!(index in pluralRules)) {
  6743. console.warn('plural form unknown for [' + lang + ']');
  6744. return function () {
  6745. return 'other';
  6746. };
  6747. }
  6748. return pluralRules[index];
  6749. }
  6750. gMacros.plural = function (str, param, key, prop) {
  6751. var n = parseFloat(param);
  6752. if (isNaN(n)) return str;
  6753. if (prop != gTextProp) return str;
  6754. if (!gMacros._pluralRules) {
  6755. gMacros._pluralRules = getPluralRules(gLanguage);
  6756. }
  6757. var index = '[' + gMacros._pluralRules(n) + ']';
  6758. if (n === 0 && key + '[zero]' in gL10nData) {
  6759. str = gL10nData[key + '[zero]'][prop];
  6760. } else if (n == 1 && key + '[one]' in gL10nData) {
  6761. str = gL10nData[key + '[one]'][prop];
  6762. } else if (n == 2 && key + '[two]' in gL10nData) {
  6763. str = gL10nData[key + '[two]'][prop];
  6764. } else if (key + index in gL10nData) {
  6765. str = gL10nData[key + index][prop];
  6766. } else if (key + '[other]' in gL10nData) {
  6767. str = gL10nData[key + '[other]'][prop];
  6768. }
  6769. return str;
  6770. };
  6771. function getL10nData(key, args, fallback) {
  6772. var data = gL10nData[key];
  6773. if (!data) {
  6774. console.warn('#' + key + ' is undefined.');
  6775. if (!fallback) {
  6776. return null;
  6777. }
  6778. data = fallback;
  6779. }
  6780. var rv = {};
  6781. for (var prop in data) {
  6782. var str = data[prop];
  6783. str = substIndexes(str, args, key, prop);
  6784. str = substArguments(str, args, key);
  6785. rv[prop] = str;
  6786. }
  6787. return rv;
  6788. }
  6789. function substIndexes(str, args, key, prop) {
  6790. var reIndex = /\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/;
  6791. var reMatch = reIndex.exec(str);
  6792. if (!reMatch || !reMatch.length) return str;
  6793. var macroName = reMatch[1];
  6794. var paramName = reMatch[2];
  6795. var param;
  6796. if (args && paramName in args) {
  6797. param = args[paramName];
  6798. } else if (paramName in gL10nData) {
  6799. param = gL10nData[paramName];
  6800. }
  6801. if (macroName in gMacros) {
  6802. var macro = gMacros[macroName];
  6803. str = macro(str, param, key, prop);
  6804. }
  6805. return str;
  6806. }
  6807. function substArguments(str, args, key) {
  6808. var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
  6809. return str.replace(reArgs, function (matched_text, arg) {
  6810. if (args && arg in args) {
  6811. return args[arg];
  6812. }
  6813. if (arg in gL10nData) {
  6814. return gL10nData[arg];
  6815. }
  6816. console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');
  6817. return matched_text;
  6818. });
  6819. }
  6820. function translateElement(element) {
  6821. var l10n = getL10nAttributes(element);
  6822. if (!l10n.id) return;
  6823. var data = getL10nData(l10n.id, l10n.args);
  6824. if (!data) {
  6825. console.warn('#' + l10n.id + ' is undefined.');
  6826. return;
  6827. }
  6828. if (data[gTextProp]) {
  6829. if (getChildElementCount(element) === 0) {
  6830. element[gTextProp] = data[gTextProp];
  6831. } else {
  6832. var children = element.childNodes;
  6833. var found = false;
  6834. for (var i = 0, l = children.length; i < l; i++) {
  6835. if (children[i].nodeType === 3 && /\S/.test(children[i].nodeValue)) {
  6836. if (found) {
  6837. children[i].nodeValue = '';
  6838. } else {
  6839. children[i].nodeValue = data[gTextProp];
  6840. found = true;
  6841. }
  6842. }
  6843. }
  6844. if (!found) {
  6845. var textNode = document.createTextNode(data[gTextProp]);
  6846. element.insertBefore(textNode, element.firstChild);
  6847. }
  6848. }
  6849. delete data[gTextProp];
  6850. }
  6851. for (var k in data) {
  6852. element[k] = data[k];
  6853. }
  6854. }
  6855. function getChildElementCount(element) {
  6856. if (element.children) {
  6857. return element.children.length;
  6858. }
  6859. if (typeof element.childElementCount !== 'undefined') {
  6860. return element.childElementCount;
  6861. }
  6862. var count = 0;
  6863. for (var i = 0; i < element.childNodes.length; i++) {
  6864. count += element.nodeType === 1 ? 1 : 0;
  6865. }
  6866. return count;
  6867. }
  6868. function translateFragment(element) {
  6869. element = element || document.documentElement;
  6870. var children = getTranslatableChildren(element);
  6871. var elementCount = children.length;
  6872. for (var i = 0; i < elementCount; i++) {
  6873. translateElement(children[i]);
  6874. }
  6875. translateElement(element);
  6876. }
  6877. return {
  6878. get: function get(key, args, fallbackString) {
  6879. var index = key.lastIndexOf('.');
  6880. var prop = gTextProp;
  6881. if (index > 0) {
  6882. prop = key.substring(index + 1);
  6883. key = key.substring(0, index);
  6884. }
  6885. var fallback;
  6886. if (fallbackString) {
  6887. fallback = {};
  6888. fallback[prop] = fallbackString;
  6889. }
  6890. var data = getL10nData(key, args, fallback);
  6891. if (data && prop in data) {
  6892. return data[prop];
  6893. }
  6894. return '{{' + key + '}}';
  6895. },
  6896. getData: function getData() {
  6897. return gL10nData;
  6898. },
  6899. getText: function getText() {
  6900. return gTextData;
  6901. },
  6902. getLanguage: function getLanguage() {
  6903. return gLanguage;
  6904. },
  6905. setLanguage: function setLanguage(lang, callback) {
  6906. loadLocale(lang, function () {
  6907. if (callback) callback();
  6908. });
  6909. },
  6910. getDirection: function getDirection() {
  6911. var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
  6912. var shortCode = gLanguage.split('-', 1)[0];
  6913. return rtlList.indexOf(shortCode) >= 0 ? 'rtl' : 'ltr';
  6914. },
  6915. translate: translateFragment,
  6916. getReadyState: function getReadyState() {
  6917. return gReadyState;
  6918. },
  6919. ready: function ready(callback) {
  6920. if (!callback) {
  6921. return;
  6922. } else if (gReadyState == 'complete' || gReadyState == 'interactive') {
  6923. window.setTimeout(function () {
  6924. callback();
  6925. });
  6926. } else if (document.addEventListener) {
  6927. document.addEventListener('localized', function once() {
  6928. document.removeEventListener('localized', once);
  6929. callback();
  6930. });
  6931. }
  6932. }
  6933. };
  6934. }(window, document);
  6935. /***/ }),
  6936. /* 22 */
  6937. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6938. Object.defineProperty(exports, "__esModule", ({
  6939. value: true
  6940. }));
  6941. exports.PDFFindController = exports.FindState = void 0;
  6942. var _ui_utils = __w_pdfjs_require__(8);
  6943. var _pdfjsLib = __w_pdfjs_require__(5);
  6944. var _pdf_find_utils = __w_pdfjs_require__(23);
  6945. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  6946. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  6947. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  6948. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  6949. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  6950. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6951. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6952. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  6953. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  6954. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  6955. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  6956. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  6957. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  6958. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  6959. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  6960. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  6961. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  6962. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  6963. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  6964. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  6965. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  6966. var FindState = {
  6967. FOUND: 0,
  6968. NOT_FOUND: 1,
  6969. WRAPPED: 2,
  6970. PENDING: 3
  6971. };
  6972. exports.FindState = FindState;
  6973. var FIND_TIMEOUT = 250;
  6974. var MATCH_SCROLL_OFFSET_TOP = -50;
  6975. var MATCH_SCROLL_OFFSET_LEFT = -400;
  6976. var CHARACTERS_TO_NORMALIZE = {
  6977. "\u2010": "-",
  6978. "\u2018": "'",
  6979. "\u2019": "'",
  6980. "\u201A": "'",
  6981. "\u201B": "'",
  6982. "\u201C": '"',
  6983. "\u201D": '"',
  6984. "\u201E": '"',
  6985. "\u201F": '"',
  6986. "\xBC": "1/4",
  6987. "\xBD": "1/2",
  6988. "\xBE": "3/4"
  6989. };
  6990. var DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]);
  6991. var DIACRITICS_EXCEPTION_STR = _toConsumableArray(DIACRITICS_EXCEPTION.values()).map(function (x) {
  6992. return String.fromCharCode(x);
  6993. }).join("");
  6994. var DIACRITICS_REG_EXP = /(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])+/g;
  6995. var SPECIAL_CHARS_REG_EXP = /([\$\(-\+\.\?\[-\^\{-\}])|((?:[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]))|([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+)|((?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF]))|((?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]))/g;
  6996. var NOT_DIACRITIC_FROM_END_REG_EXP = /((?:(?![\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])[\s\S]))(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])*$/;
  6997. var NOT_DIACRITIC_FROM_START_REG_EXP = /^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])*((?:(?![\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD3E\uDD40\uDD42\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])[\s\S]))/;
  6998. var normalizationRegex = null;
  6999. function normalize(text) {
  7000. if (!normalizationRegex) {
  7001. var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
  7002. normalizationRegex = new RegExp("([".concat(replace, "])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(\\n)"), "gum");
  7003. }
  7004. var rawDiacriticsPositions = [];
  7005. var m;
  7006. while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {
  7007. rawDiacriticsPositions.push([m[0].length, m.index]);
  7008. }
  7009. var normalized = text.normalize("NFD");
  7010. var positions = [[0, 0]];
  7011. var k = 0;
  7012. var shift = 0;
  7013. var shiftOrigin = 0;
  7014. var eol = 0;
  7015. var hasDiacritics = false;
  7016. normalized = normalized.replace(normalizationRegex, function (match, p1, p2, p3, p4, i) {
  7017. i -= shiftOrigin;
  7018. if (p1) {
  7019. var replacement = CHARACTERS_TO_NORMALIZE[match];
  7020. var jj = replacement.length;
  7021. for (var j = 1; j < jj; j++) {
  7022. positions.push([i - shift + j, shift - j]);
  7023. }
  7024. shift -= jj - 1;
  7025. return replacement;
  7026. }
  7027. if (p2) {
  7028. var _rawDiacriticsPositio;
  7029. var hasTrailingDashEOL = p2.endsWith("\n");
  7030. var len = hasTrailingDashEOL ? p2.length - 2 : p2.length;
  7031. hasDiacritics = true;
  7032. var _jj = len;
  7033. if (i + eol === ((_rawDiacriticsPositio = rawDiacriticsPositions[k]) === null || _rawDiacriticsPositio === void 0 ? void 0 : _rawDiacriticsPositio[1])) {
  7034. _jj -= rawDiacriticsPositions[k][0];
  7035. ++k;
  7036. }
  7037. for (var _j = 1; _j < _jj + 1; _j++) {
  7038. positions.push([i - 1 - shift + _j, shift - _j]);
  7039. }
  7040. shift -= _jj;
  7041. shiftOrigin += _jj;
  7042. if (hasTrailingDashEOL) {
  7043. i += len - 1;
  7044. positions.push([i - shift + 1, 1 + shift]);
  7045. shift += 1;
  7046. shiftOrigin += 1;
  7047. eol += 1;
  7048. return p2.slice(0, len);
  7049. }
  7050. return p2;
  7051. }
  7052. if (p3) {
  7053. positions.push([i - shift + 1, 1 + shift]);
  7054. shift += 1;
  7055. shiftOrigin += 1;
  7056. eol += 1;
  7057. return p3.charAt(0);
  7058. }
  7059. positions.push([i - shift + 1, shift - 1]);
  7060. shift -= 1;
  7061. shiftOrigin += 1;
  7062. eol += 1;
  7063. return " ";
  7064. });
  7065. positions.push([normalized.length, shift]);
  7066. return [normalized, positions, hasDiacritics];
  7067. }
  7068. function getOriginalIndex(diffs, pos, len) {
  7069. if (!diffs) {
  7070. return [pos, len];
  7071. }
  7072. var start = pos;
  7073. var end = pos + len;
  7074. var i = (0, _ui_utils.binarySearchFirstItem)(diffs, function (x) {
  7075. return x[0] >= start;
  7076. });
  7077. if (diffs[i][0] > start) {
  7078. --i;
  7079. }
  7080. var j = (0, _ui_utils.binarySearchFirstItem)(diffs, function (x) {
  7081. return x[0] >= end;
  7082. }, i);
  7083. if (diffs[j][0] > end) {
  7084. --j;
  7085. }
  7086. return [start + diffs[i][1], len + diffs[j][1] - diffs[i][1]];
  7087. }
  7088. var _onFind = /*#__PURE__*/new WeakSet();
  7089. var _reset = /*#__PURE__*/new WeakSet();
  7090. var _query = /*#__PURE__*/new WeakMap();
  7091. var _shouldDirtyMatch = /*#__PURE__*/new WeakSet();
  7092. var _isEntireWord = /*#__PURE__*/new WeakSet();
  7093. var _calculateRegExpMatch = /*#__PURE__*/new WeakSet();
  7094. var _convertToRegExpString = /*#__PURE__*/new WeakSet();
  7095. var _calculateMatch = /*#__PURE__*/new WeakSet();
  7096. var _extractText = /*#__PURE__*/new WeakSet();
  7097. var _updatePage = /*#__PURE__*/new WeakSet();
  7098. var _updateAllPages = /*#__PURE__*/new WeakSet();
  7099. var _nextMatch = /*#__PURE__*/new WeakSet();
  7100. var _matchesReady = /*#__PURE__*/new WeakSet();
  7101. var _nextPageMatch = /*#__PURE__*/new WeakSet();
  7102. var _advanceOffsetPage = /*#__PURE__*/new WeakSet();
  7103. var _updateMatch = /*#__PURE__*/new WeakSet();
  7104. var _onFindBarClose = /*#__PURE__*/new WeakSet();
  7105. var _requestMatchesCount = /*#__PURE__*/new WeakSet();
  7106. var _updateUIResultsCount = /*#__PURE__*/new WeakSet();
  7107. var _updateUIState = /*#__PURE__*/new WeakSet();
  7108. var PDFFindController = /*#__PURE__*/function () {
  7109. function PDFFindController(_ref) {
  7110. var _linkService = _ref.linkService,
  7111. eventBus = _ref.eventBus;
  7112. _classCallCheck(this, PDFFindController);
  7113. _classPrivateMethodInitSpec(this, _updateUIState);
  7114. _classPrivateMethodInitSpec(this, _updateUIResultsCount);
  7115. _classPrivateMethodInitSpec(this, _requestMatchesCount);
  7116. _classPrivateMethodInitSpec(this, _onFindBarClose);
  7117. _classPrivateMethodInitSpec(this, _updateMatch);
  7118. _classPrivateMethodInitSpec(this, _advanceOffsetPage);
  7119. _classPrivateMethodInitSpec(this, _nextPageMatch);
  7120. _classPrivateMethodInitSpec(this, _matchesReady);
  7121. _classPrivateMethodInitSpec(this, _nextMatch);
  7122. _classPrivateMethodInitSpec(this, _updateAllPages);
  7123. _classPrivateMethodInitSpec(this, _updatePage);
  7124. _classPrivateMethodInitSpec(this, _extractText);
  7125. _classPrivateMethodInitSpec(this, _calculateMatch);
  7126. _classPrivateMethodInitSpec(this, _convertToRegExpString);
  7127. _classPrivateMethodInitSpec(this, _calculateRegExpMatch);
  7128. _classPrivateMethodInitSpec(this, _isEntireWord);
  7129. _classPrivateMethodInitSpec(this, _shouldDirtyMatch);
  7130. _classPrivateFieldInitSpec(this, _query, {
  7131. get: _get_query,
  7132. set: void 0
  7133. });
  7134. _classPrivateMethodInitSpec(this, _reset);
  7135. _classPrivateMethodInitSpec(this, _onFind);
  7136. this._linkService = _linkService;
  7137. this._eventBus = eventBus;
  7138. _classPrivateMethodGet(this, _reset, _reset2).call(this);
  7139. eventBus._on("find", _classPrivateMethodGet(this, _onFind, _onFind2).bind(this));
  7140. eventBus._on("findbarclose", _classPrivateMethodGet(this, _onFindBarClose, _onFindBarClose2).bind(this));
  7141. }
  7142. _createClass(PDFFindController, [{
  7143. key: "highlightMatches",
  7144. get: function get() {
  7145. return this._highlightMatches;
  7146. }
  7147. }, {
  7148. key: "pageMatches",
  7149. get: function get() {
  7150. return this._pageMatches;
  7151. }
  7152. }, {
  7153. key: "pageMatchesLength",
  7154. get: function get() {
  7155. return this._pageMatchesLength;
  7156. }
  7157. }, {
  7158. key: "selected",
  7159. get: function get() {
  7160. return this._selected;
  7161. }
  7162. }, {
  7163. key: "state",
  7164. get: function get() {
  7165. return this._state;
  7166. }
  7167. }, {
  7168. key: "setDocument",
  7169. value: function setDocument(pdfDocument) {
  7170. if (this._pdfDocument) {
  7171. _classPrivateMethodGet(this, _reset, _reset2).call(this);
  7172. }
  7173. if (!pdfDocument) {
  7174. return;
  7175. }
  7176. this._pdfDocument = pdfDocument;
  7177. this._firstPageCapability.resolve();
  7178. }
  7179. }, {
  7180. key: "scrollMatchIntoView",
  7181. value: function scrollMatchIntoView(_ref2) {
  7182. var _ref2$element = _ref2.element,
  7183. element = _ref2$element === void 0 ? null : _ref2$element,
  7184. _ref2$selectedLeft = _ref2.selectedLeft,
  7185. selectedLeft = _ref2$selectedLeft === void 0 ? 0 : _ref2$selectedLeft,
  7186. _ref2$pageIndex = _ref2.pageIndex,
  7187. pageIndex = _ref2$pageIndex === void 0 ? -1 : _ref2$pageIndex,
  7188. _ref2$matchIndex = _ref2.matchIndex,
  7189. matchIndex = _ref2$matchIndex === void 0 ? -1 : _ref2$matchIndex;
  7190. if (!this._scrollMatches || !element) {
  7191. return;
  7192. } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
  7193. return;
  7194. } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
  7195. return;
  7196. }
  7197. this._scrollMatches = false;
  7198. var spot = {
  7199. top: MATCH_SCROLL_OFFSET_TOP,
  7200. left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT
  7201. };
  7202. (0, _ui_utils.scrollIntoView)(element, spot, true);
  7203. }
  7204. }]);
  7205. return PDFFindController;
  7206. }();
  7207. exports.PDFFindController = PDFFindController;
  7208. function _onFind2(state) {
  7209. var _this = this;
  7210. if (!state) {
  7211. return;
  7212. }
  7213. var pdfDocument = this._pdfDocument;
  7214. var type = state.type;
  7215. if (this._state === null || _classPrivateMethodGet(this, _shouldDirtyMatch, _shouldDirtyMatch2).call(this, state)) {
  7216. this._dirtyMatch = true;
  7217. }
  7218. this._state = state;
  7219. if (type !== "highlightallchange") {
  7220. _classPrivateMethodGet(this, _updateUIState, _updateUIState2).call(this, FindState.PENDING);
  7221. }
  7222. this._firstPageCapability.promise.then(function () {
  7223. if (!_this._pdfDocument || pdfDocument && _this._pdfDocument !== pdfDocument) {
  7224. return;
  7225. }
  7226. _classPrivateMethodGet(_this, _extractText, _extractText2).call(_this);
  7227. var findbarClosed = !_this._highlightMatches;
  7228. var pendingTimeout = !!_this._findTimeout;
  7229. if (_this._findTimeout) {
  7230. clearTimeout(_this._findTimeout);
  7231. _this._findTimeout = null;
  7232. }
  7233. if (!type) {
  7234. _this._findTimeout = setTimeout(function () {
  7235. _classPrivateMethodGet(_this, _nextMatch, _nextMatch2).call(_this);
  7236. _this._findTimeout = null;
  7237. }, FIND_TIMEOUT);
  7238. } else if (_this._dirtyMatch) {
  7239. _classPrivateMethodGet(_this, _nextMatch, _nextMatch2).call(_this);
  7240. } else if (type === "again") {
  7241. _classPrivateMethodGet(_this, _nextMatch, _nextMatch2).call(_this);
  7242. if (findbarClosed && _this._state.highlightAll) {
  7243. _classPrivateMethodGet(_this, _updateAllPages, _updateAllPages2).call(_this);
  7244. }
  7245. } else if (type === "highlightallchange") {
  7246. if (pendingTimeout) {
  7247. _classPrivateMethodGet(_this, _nextMatch, _nextMatch2).call(_this);
  7248. } else {
  7249. _this._highlightMatches = true;
  7250. }
  7251. _classPrivateMethodGet(_this, _updateAllPages, _updateAllPages2).call(_this);
  7252. } else {
  7253. _classPrivateMethodGet(_this, _nextMatch, _nextMatch2).call(_this);
  7254. }
  7255. });
  7256. }
  7257. function _reset2() {
  7258. this._highlightMatches = false;
  7259. this._scrollMatches = false;
  7260. this._pdfDocument = null;
  7261. this._pageMatches = [];
  7262. this._pageMatchesLength = [];
  7263. this._state = null;
  7264. this._selected = {
  7265. pageIdx: -1,
  7266. matchIdx: -1
  7267. };
  7268. this._offset = {
  7269. pageIdx: null,
  7270. matchIdx: null,
  7271. wrapped: false
  7272. };
  7273. this._extractTextPromises = [];
  7274. this._pageContents = [];
  7275. this._pageDiffs = [];
  7276. this._hasDiacritics = [];
  7277. this._matchesCountTotal = 0;
  7278. this._pagesToSearch = null;
  7279. this._pendingFindMatches = new Set();
  7280. this._resumePageIdx = null;
  7281. this._dirtyMatch = false;
  7282. clearTimeout(this._findTimeout);
  7283. this._findTimeout = null;
  7284. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  7285. }
  7286. function _get_query() {
  7287. if (this._state.query !== this._rawQuery) {
  7288. this._rawQuery = this._state.query;
  7289. var _normalize = normalize(this._state.query);
  7290. var _normalize2 = _slicedToArray(_normalize, 1);
  7291. this._normalizedQuery = _normalize2[0];
  7292. }
  7293. return this._normalizedQuery;
  7294. }
  7295. function _shouldDirtyMatch2(state) {
  7296. if (state.query !== this._state.query) {
  7297. return true;
  7298. }
  7299. switch (state.type) {
  7300. case "again":
  7301. var pageNumber = this._selected.pageIdx + 1;
  7302. var linkService = this._linkService;
  7303. if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) {
  7304. return true;
  7305. }
  7306. return false;
  7307. case "highlightallchange":
  7308. return false;
  7309. }
  7310. return true;
  7311. }
  7312. function _isEntireWord2(content, startIdx, length) {
  7313. var match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP);
  7314. if (match) {
  7315. var first = content.charCodeAt(startIdx);
  7316. var limit = match[1].charCodeAt(0);
  7317. if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
  7318. return false;
  7319. }
  7320. }
  7321. match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP);
  7322. if (match) {
  7323. var last = content.charCodeAt(startIdx + length - 1);
  7324. var _limit = match[1].charCodeAt(0);
  7325. if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(_limit)) {
  7326. return false;
  7327. }
  7328. }
  7329. return true;
  7330. }
  7331. function _calculateRegExpMatch2(query, entireWord, pageIndex, pageContent) {
  7332. var matches = [],
  7333. matchesLength = [];
  7334. var diffs = this._pageDiffs[pageIndex];
  7335. var match;
  7336. while ((match = query.exec(pageContent)) !== null) {
  7337. if (entireWord && !_classPrivateMethodGet(this, _isEntireWord, _isEntireWord2).call(this, pageContent, match.index, match[0].length)) {
  7338. continue;
  7339. }
  7340. var _getOriginalIndex = getOriginalIndex(diffs, match.index, match[0].length),
  7341. _getOriginalIndex2 = _slicedToArray(_getOriginalIndex, 2),
  7342. matchPos = _getOriginalIndex2[0],
  7343. matchLen = _getOriginalIndex2[1];
  7344. if (matchLen) {
  7345. matches.push(matchPos);
  7346. matchesLength.push(matchLen);
  7347. }
  7348. }
  7349. this._pageMatches[pageIndex] = matches;
  7350. this._pageMatchesLength[pageIndex] = matchesLength;
  7351. }
  7352. function _convertToRegExpString2(query, hasDiacritics) {
  7353. var matchDiacritics = this._state.matchDiacritics;
  7354. var isUnicode = false;
  7355. query = query.replace(SPECIAL_CHARS_REG_EXP, function (match, p1, p2, p3, p4, p5) {
  7356. if (p1) {
  7357. return "[ ]*\\".concat(p1, "[ ]*");
  7358. }
  7359. if (p2) {
  7360. return "[ ]*".concat(p2, "[ ]*");
  7361. }
  7362. if (p3) {
  7363. return "[ ]+";
  7364. }
  7365. if (matchDiacritics) {
  7366. return p4 || p5;
  7367. }
  7368. if (p4) {
  7369. return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";
  7370. }
  7371. if (hasDiacritics) {
  7372. isUnicode = true;
  7373. return "".concat(p5, "\\p{M}*");
  7374. }
  7375. return p5;
  7376. });
  7377. var trailingSpaces = "[ ]*";
  7378. if (query.endsWith(trailingSpaces)) {
  7379. query = query.slice(0, query.length - trailingSpaces.length);
  7380. }
  7381. if (matchDiacritics) {
  7382. if (hasDiacritics) {
  7383. isUnicode = true;
  7384. query = "".concat(query, "(?=[").concat(DIACRITICS_EXCEPTION_STR, "]|[^\\p{M}]|$)");
  7385. }
  7386. }
  7387. return [isUnicode, query];
  7388. }
  7389. function _calculateMatch2(pageIndex) {
  7390. var _this2 = this;
  7391. var query = _classPrivateFieldGet(this, _query);
  7392. if (query.length === 0) {
  7393. return;
  7394. }
  7395. var _this$_state = this._state,
  7396. caseSensitive = _this$_state.caseSensitive,
  7397. entireWord = _this$_state.entireWord,
  7398. phraseSearch = _this$_state.phraseSearch;
  7399. var pageContent = this._pageContents[pageIndex];
  7400. var hasDiacritics = this._hasDiacritics[pageIndex];
  7401. var isUnicode = false;
  7402. if (phraseSearch) {
  7403. var _classPrivateMethodGe = _classPrivateMethodGet(this, _convertToRegExpString, _convertToRegExpString2).call(this, query, hasDiacritics);
  7404. var _classPrivateMethodGe2 = _slicedToArray(_classPrivateMethodGe, 2);
  7405. isUnicode = _classPrivateMethodGe2[0];
  7406. query = _classPrivateMethodGe2[1];
  7407. } else {
  7408. var match = query.match(/\S+/g);
  7409. if (match) {
  7410. query = match.sort().reverse().map(function (q) {
  7411. var _classPrivateMethodGe3 = _classPrivateMethodGet(_this2, _convertToRegExpString, _convertToRegExpString2).call(_this2, q, hasDiacritics),
  7412. _classPrivateMethodGe4 = _slicedToArray(_classPrivateMethodGe3, 2),
  7413. isUnicodePart = _classPrivateMethodGe4[0],
  7414. queryPart = _classPrivateMethodGe4[1];
  7415. isUnicode || (isUnicode = isUnicodePart);
  7416. return "(".concat(queryPart, ")");
  7417. }).join("|");
  7418. }
  7419. }
  7420. var flags = "g".concat(isUnicode ? "u" : "").concat(caseSensitive ? "" : "i");
  7421. query = new RegExp(query, flags);
  7422. _classPrivateMethodGet(this, _calculateRegExpMatch, _calculateRegExpMatch2).call(this, query, entireWord, pageIndex, pageContent);
  7423. if (this._state.highlightAll) {
  7424. _classPrivateMethodGet(this, _updatePage, _updatePage2).call(this, pageIndex);
  7425. }
  7426. if (this._resumePageIdx === pageIndex) {
  7427. this._resumePageIdx = null;
  7428. _classPrivateMethodGet(this, _nextPageMatch, _nextPageMatch2).call(this);
  7429. }
  7430. var pageMatchesCount = this._pageMatches[pageIndex].length;
  7431. if (pageMatchesCount > 0) {
  7432. this._matchesCountTotal += pageMatchesCount;
  7433. _classPrivateMethodGet(this, _updateUIResultsCount, _updateUIResultsCount2).call(this);
  7434. }
  7435. }
  7436. function _extractText2() {
  7437. var _this3 = this;
  7438. if (this._extractTextPromises.length > 0) {
  7439. return;
  7440. }
  7441. var promise = Promise.resolve();
  7442. var _loop = function _loop(i, ii) {
  7443. var extractTextCapability = (0, _pdfjsLib.createPromiseCapability)();
  7444. _this3._extractTextPromises[i] = extractTextCapability.promise;
  7445. promise = promise.then(function () {
  7446. return _this3._pdfDocument.getPage(i + 1).then(function (pdfPage) {
  7447. return pdfPage.getTextContent();
  7448. }).then(function (textContent) {
  7449. var strBuf = [];
  7450. var _iterator = _createForOfIteratorHelper(textContent.items),
  7451. _step;
  7452. try {
  7453. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  7454. var textItem = _step.value;
  7455. strBuf.push(textItem.str);
  7456. if (textItem.hasEOL) {
  7457. strBuf.push("\n");
  7458. }
  7459. }
  7460. } catch (err) {
  7461. _iterator.e(err);
  7462. } finally {
  7463. _iterator.f();
  7464. }
  7465. var _normalize3 = normalize(strBuf.join(""));
  7466. var _normalize4 = _slicedToArray(_normalize3, 3);
  7467. _this3._pageContents[i] = _normalize4[0];
  7468. _this3._pageDiffs[i] = _normalize4[1];
  7469. _this3._hasDiacritics[i] = _normalize4[2];
  7470. extractTextCapability.resolve();
  7471. }, function (reason) {
  7472. console.error("Unable to get text content for page ".concat(i + 1), reason);
  7473. _this3._pageContents[i] = "";
  7474. _this3._pageDiffs[i] = null;
  7475. _this3._hasDiacritics[i] = false;
  7476. extractTextCapability.resolve();
  7477. });
  7478. });
  7479. };
  7480. for (var i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
  7481. _loop(i, ii);
  7482. }
  7483. }
  7484. function _updatePage2(index) {
  7485. if (this._scrollMatches && this._selected.pageIdx === index) {
  7486. this._linkService.page = index + 1;
  7487. }
  7488. this._eventBus.dispatch("updatetextlayermatches", {
  7489. source: this,
  7490. pageIndex: index
  7491. });
  7492. }
  7493. function _updateAllPages2() {
  7494. this._eventBus.dispatch("updatetextlayermatches", {
  7495. source: this,
  7496. pageIndex: -1
  7497. });
  7498. }
  7499. function _nextMatch2() {
  7500. var _this4 = this;
  7501. var previous = this._state.findPrevious;
  7502. var currentPageIndex = this._linkService.page - 1;
  7503. var numPages = this._linkService.pagesCount;
  7504. this._highlightMatches = true;
  7505. if (this._dirtyMatch) {
  7506. this._dirtyMatch = false;
  7507. this._selected.pageIdx = this._selected.matchIdx = -1;
  7508. this._offset.pageIdx = currentPageIndex;
  7509. this._offset.matchIdx = null;
  7510. this._offset.wrapped = false;
  7511. this._resumePageIdx = null;
  7512. this._pageMatches.length = 0;
  7513. this._pageMatchesLength.length = 0;
  7514. this._matchesCountTotal = 0;
  7515. _classPrivateMethodGet(this, _updateAllPages, _updateAllPages2).call(this);
  7516. var _loop2 = function _loop2(i) {
  7517. if (_this4._pendingFindMatches.has(i)) {
  7518. return "continue";
  7519. }
  7520. _this4._pendingFindMatches.add(i);
  7521. _this4._extractTextPromises[i].then(function () {
  7522. _this4._pendingFindMatches["delete"](i);
  7523. _classPrivateMethodGet(_this4, _calculateMatch, _calculateMatch2).call(_this4, i);
  7524. });
  7525. };
  7526. for (var i = 0; i < numPages; i++) {
  7527. var _ret = _loop2(i);
  7528. if (_ret === "continue") continue;
  7529. }
  7530. }
  7531. if (_classPrivateFieldGet(this, _query) === "") {
  7532. _classPrivateMethodGet(this, _updateUIState, _updateUIState2).call(this, FindState.FOUND);
  7533. return;
  7534. }
  7535. if (this._resumePageIdx) {
  7536. return;
  7537. }
  7538. var offset = this._offset;
  7539. this._pagesToSearch = numPages;
  7540. if (offset.matchIdx !== null) {
  7541. var numPageMatches = this._pageMatches[offset.pageIdx].length;
  7542. if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
  7543. offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
  7544. _classPrivateMethodGet(this, _updateMatch, _updateMatch2).call(this, true);
  7545. return;
  7546. }
  7547. _classPrivateMethodGet(this, _advanceOffsetPage, _advanceOffsetPage2).call(this, previous);
  7548. }
  7549. _classPrivateMethodGet(this, _nextPageMatch, _nextPageMatch2).call(this);
  7550. }
  7551. function _matchesReady2(matches) {
  7552. var offset = this._offset;
  7553. var numMatches = matches.length;
  7554. var previous = this._state.findPrevious;
  7555. if (numMatches) {
  7556. offset.matchIdx = previous ? numMatches - 1 : 0;
  7557. _classPrivateMethodGet(this, _updateMatch, _updateMatch2).call(this, true);
  7558. return true;
  7559. }
  7560. _classPrivateMethodGet(this, _advanceOffsetPage, _advanceOffsetPage2).call(this, previous);
  7561. if (offset.wrapped) {
  7562. offset.matchIdx = null;
  7563. if (this._pagesToSearch < 0) {
  7564. _classPrivateMethodGet(this, _updateMatch, _updateMatch2).call(this, false);
  7565. return true;
  7566. }
  7567. }
  7568. return false;
  7569. }
  7570. function _nextPageMatch2() {
  7571. if (this._resumePageIdx !== null) {
  7572. console.error("There can only be one pending page.");
  7573. }
  7574. var matches = null;
  7575. do {
  7576. var pageIdx = this._offset.pageIdx;
  7577. matches = this._pageMatches[pageIdx];
  7578. if (!matches) {
  7579. this._resumePageIdx = pageIdx;
  7580. break;
  7581. }
  7582. } while (!_classPrivateMethodGet(this, _matchesReady, _matchesReady2).call(this, matches));
  7583. }
  7584. function _advanceOffsetPage2(previous) {
  7585. var offset = this._offset;
  7586. var numPages = this._linkService.pagesCount;
  7587. offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
  7588. offset.matchIdx = null;
  7589. this._pagesToSearch--;
  7590. if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
  7591. offset.pageIdx = previous ? numPages - 1 : 0;
  7592. offset.wrapped = true;
  7593. }
  7594. }
  7595. function _updateMatch2() {
  7596. var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7597. var state = FindState.NOT_FOUND;
  7598. var wrapped = this._offset.wrapped;
  7599. this._offset.wrapped = false;
  7600. if (found) {
  7601. var previousPage = this._selected.pageIdx;
  7602. this._selected.pageIdx = this._offset.pageIdx;
  7603. this._selected.matchIdx = this._offset.matchIdx;
  7604. state = wrapped ? FindState.WRAPPED : FindState.FOUND;
  7605. if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
  7606. _classPrivateMethodGet(this, _updatePage, _updatePage2).call(this, previousPage);
  7607. }
  7608. }
  7609. _classPrivateMethodGet(this, _updateUIState, _updateUIState2).call(this, state, this._state.findPrevious);
  7610. if (this._selected.pageIdx !== -1) {
  7611. this._scrollMatches = true;
  7612. _classPrivateMethodGet(this, _updatePage, _updatePage2).call(this, this._selected.pageIdx);
  7613. }
  7614. }
  7615. function _onFindBarClose2(evt) {
  7616. var _this5 = this;
  7617. var pdfDocument = this._pdfDocument;
  7618. this._firstPageCapability.promise.then(function () {
  7619. if (!_this5._pdfDocument || pdfDocument && _this5._pdfDocument !== pdfDocument) {
  7620. return;
  7621. }
  7622. if (_this5._findTimeout) {
  7623. clearTimeout(_this5._findTimeout);
  7624. _this5._findTimeout = null;
  7625. }
  7626. if (_this5._resumePageIdx) {
  7627. _this5._resumePageIdx = null;
  7628. _this5._dirtyMatch = true;
  7629. }
  7630. _classPrivateMethodGet(_this5, _updateUIState, _updateUIState2).call(_this5, FindState.FOUND);
  7631. _this5._highlightMatches = false;
  7632. _classPrivateMethodGet(_this5, _updateAllPages, _updateAllPages2).call(_this5);
  7633. });
  7634. }
  7635. function _requestMatchesCount2() {
  7636. var _this$_selected = this._selected,
  7637. pageIdx = _this$_selected.pageIdx,
  7638. matchIdx = _this$_selected.matchIdx;
  7639. var current = 0,
  7640. total = this._matchesCountTotal;
  7641. if (matchIdx !== -1) {
  7642. for (var i = 0; i < pageIdx; i++) {
  7643. var _this$_pageMatches$i;
  7644. current += ((_this$_pageMatches$i = this._pageMatches[i]) === null || _this$_pageMatches$i === void 0 ? void 0 : _this$_pageMatches$i.length) || 0;
  7645. }
  7646. current += matchIdx + 1;
  7647. }
  7648. if (current < 1 || current > total) {
  7649. current = total = 0;
  7650. }
  7651. return {
  7652. current: current,
  7653. total: total
  7654. };
  7655. }
  7656. function _updateUIResultsCount2() {
  7657. this._eventBus.dispatch("updatefindmatchescount", {
  7658. source: this,
  7659. matchesCount: _classPrivateMethodGet(this, _requestMatchesCount, _requestMatchesCount2).call(this)
  7660. });
  7661. }
  7662. function _updateUIState2(state) {
  7663. var _this$_state$query, _this$_state2;
  7664. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7665. this._eventBus.dispatch("updatefindcontrolstate", {
  7666. source: this,
  7667. state: state,
  7668. previous: previous,
  7669. matchesCount: _classPrivateMethodGet(this, _requestMatchesCount, _requestMatchesCount2).call(this),
  7670. rawQuery: (_this$_state$query = (_this$_state2 = this._state) === null || _this$_state2 === void 0 ? void 0 : _this$_state2.query) !== null && _this$_state$query !== void 0 ? _this$_state$query : null
  7671. });
  7672. }
  7673. /***/ }),
  7674. /* 23 */
  7675. /***/ ((__unused_webpack_module, exports) => {
  7676. Object.defineProperty(exports, "__esModule", ({
  7677. value: true
  7678. }));
  7679. exports.CharacterType = void 0;
  7680. exports.getCharacterType = getCharacterType;
  7681. var CharacterType = {
  7682. SPACE: 0,
  7683. ALPHA_LETTER: 1,
  7684. PUNCT: 2,
  7685. HAN_LETTER: 3,
  7686. KATAKANA_LETTER: 4,
  7687. HIRAGANA_LETTER: 5,
  7688. HALFWIDTH_KATAKANA_LETTER: 6,
  7689. THAI_LETTER: 7
  7690. };
  7691. exports.CharacterType = CharacterType;
  7692. function isAlphabeticalScript(charCode) {
  7693. return charCode < 0x2e80;
  7694. }
  7695. function isAscii(charCode) {
  7696. return (charCode & 0xff80) === 0;
  7697. }
  7698. function isAsciiAlpha(charCode) {
  7699. return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a;
  7700. }
  7701. function isAsciiDigit(charCode) {
  7702. return charCode >= 0x30 && charCode <= 0x39;
  7703. }
  7704. function isAsciiSpace(charCode) {
  7705. return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;
  7706. }
  7707. function isHan(charCode) {
  7708. return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;
  7709. }
  7710. function isKatakana(charCode) {
  7711. return charCode >= 0x30a0 && charCode <= 0x30ff;
  7712. }
  7713. function isHiragana(charCode) {
  7714. return charCode >= 0x3040 && charCode <= 0x309f;
  7715. }
  7716. function isHalfwidthKatakana(charCode) {
  7717. return charCode >= 0xff60 && charCode <= 0xff9f;
  7718. }
  7719. function isThai(charCode) {
  7720. return (charCode & 0xff80) === 0x0e00;
  7721. }
  7722. function getCharacterType(charCode) {
  7723. if (isAlphabeticalScript(charCode)) {
  7724. if (isAscii(charCode)) {
  7725. if (isAsciiSpace(charCode)) {
  7726. return CharacterType.SPACE;
  7727. } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {
  7728. return CharacterType.ALPHA_LETTER;
  7729. }
  7730. return CharacterType.PUNCT;
  7731. } else if (isThai(charCode)) {
  7732. return CharacterType.THAI_LETTER;
  7733. } else if (charCode === 0xa0) {
  7734. return CharacterType.SPACE;
  7735. }
  7736. return CharacterType.ALPHA_LETTER;
  7737. }
  7738. if (isHan(charCode)) {
  7739. return CharacterType.HAN_LETTER;
  7740. } else if (isKatakana(charCode)) {
  7741. return CharacterType.KATAKANA_LETTER;
  7742. } else if (isHiragana(charCode)) {
  7743. return CharacterType.HIRAGANA_LETTER;
  7744. } else if (isHalfwidthKatakana(charCode)) {
  7745. return CharacterType.HALFWIDTH_KATAKANA_LETTER;
  7746. }
  7747. return CharacterType.ALPHA_LETTER;
  7748. }
  7749. /***/ }),
  7750. /* 24 */
  7751. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7752. Object.defineProperty(exports, "__esModule", ({
  7753. value: true
  7754. }));
  7755. exports.PDFHistory = void 0;
  7756. exports.isDestArraysEqual = isDestArraysEqual;
  7757. exports.isDestHashesEqual = isDestHashesEqual;
  7758. var _ui_utils = __w_pdfjs_require__(8);
  7759. var _event_utils = __w_pdfjs_require__(19);
  7760. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  7761. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  7762. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  7763. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  7764. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  7765. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  7766. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  7767. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7768. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7769. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  7770. var HASH_CHANGE_TIMEOUT = 1000;
  7771. var POSITION_UPDATED_THRESHOLD = 50;
  7772. var UPDATE_VIEWAREA_TIMEOUT = 1000;
  7773. function getCurrentHash() {
  7774. return document.location.hash;
  7775. }
  7776. var PDFHistory = /*#__PURE__*/function () {
  7777. function PDFHistory(_ref) {
  7778. var _this = this;
  7779. var linkService = _ref.linkService,
  7780. eventBus = _ref.eventBus;
  7781. _classCallCheck(this, PDFHistory);
  7782. this.linkService = linkService;
  7783. this.eventBus = eventBus;
  7784. this._initialized = false;
  7785. this._fingerprint = "";
  7786. this.reset();
  7787. this._boundEvents = null;
  7788. this.eventBus._on("pagesinit", function () {
  7789. _this._isPagesLoaded = false;
  7790. _this.eventBus._on("pagesloaded", function (evt) {
  7791. _this._isPagesLoaded = !!evt.pagesCount;
  7792. }, {
  7793. once: true
  7794. });
  7795. });
  7796. }
  7797. _createClass(PDFHistory, [{
  7798. key: "initialize",
  7799. value: function initialize(_ref2) {
  7800. var fingerprint = _ref2.fingerprint,
  7801. _ref2$resetHistory = _ref2.resetHistory,
  7802. resetHistory = _ref2$resetHistory === void 0 ? false : _ref2$resetHistory,
  7803. _ref2$updateUrl = _ref2.updateUrl,
  7804. updateUrl = _ref2$updateUrl === void 0 ? false : _ref2$updateUrl;
  7805. if (!fingerprint || typeof fingerprint !== "string") {
  7806. console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
  7807. return;
  7808. }
  7809. if (this._initialized) {
  7810. this.reset();
  7811. }
  7812. var reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
  7813. this._fingerprint = fingerprint;
  7814. this._updateUrl = updateUrl === true;
  7815. this._initialized = true;
  7816. this._bindEvents();
  7817. var state = window.history.state;
  7818. this._popStateInProgress = false;
  7819. this._blockHashChange = 0;
  7820. this._currentHash = getCurrentHash();
  7821. this._numPositionUpdates = 0;
  7822. this._uid = this._maxUid = 0;
  7823. this._destination = null;
  7824. this._position = null;
  7825. if (!this._isValidState(state, true) || resetHistory) {
  7826. var _this$_parseCurrentHa = this._parseCurrentHash(true),
  7827. hash = _this$_parseCurrentHa.hash,
  7828. page = _this$_parseCurrentHa.page,
  7829. rotation = _this$_parseCurrentHa.rotation;
  7830. if (!hash || reInitialized || resetHistory) {
  7831. this._pushOrReplaceState(null, true);
  7832. return;
  7833. }
  7834. this._pushOrReplaceState({
  7835. hash: hash,
  7836. page: page,
  7837. rotation: rotation
  7838. }, true);
  7839. return;
  7840. }
  7841. var destination = state.destination;
  7842. this._updateInternalState(destination, state.uid, true);
  7843. if (destination.rotation !== undefined) {
  7844. this._initialRotation = destination.rotation;
  7845. }
  7846. if (destination.dest) {
  7847. this._initialBookmark = JSON.stringify(destination.dest);
  7848. this._destination.page = null;
  7849. } else if (destination.hash) {
  7850. this._initialBookmark = destination.hash;
  7851. } else if (destination.page) {
  7852. this._initialBookmark = "page=".concat(destination.page);
  7853. }
  7854. }
  7855. }, {
  7856. key: "reset",
  7857. value: function reset() {
  7858. if (this._initialized) {
  7859. this._pageHide();
  7860. this._initialized = false;
  7861. this._unbindEvents();
  7862. }
  7863. if (this._updateViewareaTimeout) {
  7864. clearTimeout(this._updateViewareaTimeout);
  7865. this._updateViewareaTimeout = null;
  7866. }
  7867. this._initialBookmark = null;
  7868. this._initialRotation = null;
  7869. }
  7870. }, {
  7871. key: "push",
  7872. value: function push(_ref3) {
  7873. var _this2 = this;
  7874. var _ref3$namedDest = _ref3.namedDest,
  7875. namedDest = _ref3$namedDest === void 0 ? null : _ref3$namedDest,
  7876. explicitDest = _ref3.explicitDest,
  7877. pageNumber = _ref3.pageNumber;
  7878. if (!this._initialized) {
  7879. return;
  7880. }
  7881. if (namedDest && typeof namedDest !== "string") {
  7882. console.error("PDFHistory.push: " + "\"".concat(namedDest, "\" is not a valid namedDest parameter."));
  7883. return;
  7884. } else if (!Array.isArray(explicitDest)) {
  7885. console.error("PDFHistory.push: " + "\"".concat(explicitDest, "\" is not a valid explicitDest parameter."));
  7886. return;
  7887. } else if (!this._isValidPage(pageNumber)) {
  7888. if (pageNumber !== null || this._destination) {
  7889. console.error("PDFHistory.push: " + "\"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  7890. return;
  7891. }
  7892. }
  7893. var hash = namedDest || JSON.stringify(explicitDest);
  7894. if (!hash) {
  7895. return;
  7896. }
  7897. var forceReplace = false;
  7898. if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
  7899. if (this._destination.page) {
  7900. return;
  7901. }
  7902. forceReplace = true;
  7903. }
  7904. if (this._popStateInProgress && !forceReplace) {
  7905. return;
  7906. }
  7907. this._pushOrReplaceState({
  7908. dest: explicitDest,
  7909. hash: hash,
  7910. page: pageNumber,
  7911. rotation: this.linkService.rotation
  7912. }, forceReplace);
  7913. if (!this._popStateInProgress) {
  7914. this._popStateInProgress = true;
  7915. Promise.resolve().then(function () {
  7916. _this2._popStateInProgress = false;
  7917. });
  7918. }
  7919. }
  7920. }, {
  7921. key: "pushPage",
  7922. value: function pushPage(pageNumber) {
  7923. var _this$_destination,
  7924. _this3 = this;
  7925. if (!this._initialized) {
  7926. return;
  7927. }
  7928. if (!this._isValidPage(pageNumber)) {
  7929. console.error("PDFHistory.pushPage: \"".concat(pageNumber, "\" is not a valid page number."));
  7930. return;
  7931. }
  7932. if (((_this$_destination = this._destination) === null || _this$_destination === void 0 ? void 0 : _this$_destination.page) === pageNumber) {
  7933. return;
  7934. }
  7935. if (this._popStateInProgress) {
  7936. return;
  7937. }
  7938. this._pushOrReplaceState({
  7939. dest: null,
  7940. hash: "page=".concat(pageNumber),
  7941. page: pageNumber,
  7942. rotation: this.linkService.rotation
  7943. });
  7944. if (!this._popStateInProgress) {
  7945. this._popStateInProgress = true;
  7946. Promise.resolve().then(function () {
  7947. _this3._popStateInProgress = false;
  7948. });
  7949. }
  7950. }
  7951. }, {
  7952. key: "pushCurrentPosition",
  7953. value: function pushCurrentPosition() {
  7954. if (!this._initialized || this._popStateInProgress) {
  7955. return;
  7956. }
  7957. this._tryPushCurrentPosition();
  7958. }
  7959. }, {
  7960. key: "back",
  7961. value: function back() {
  7962. if (!this._initialized || this._popStateInProgress) {
  7963. return;
  7964. }
  7965. var state = window.history.state;
  7966. if (this._isValidState(state) && state.uid > 0) {
  7967. window.history.back();
  7968. }
  7969. }
  7970. }, {
  7971. key: "forward",
  7972. value: function forward() {
  7973. if (!this._initialized || this._popStateInProgress) {
  7974. return;
  7975. }
  7976. var state = window.history.state;
  7977. if (this._isValidState(state) && state.uid < this._maxUid) {
  7978. window.history.forward();
  7979. }
  7980. }
  7981. }, {
  7982. key: "popStateInProgress",
  7983. get: function get() {
  7984. return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);
  7985. }
  7986. }, {
  7987. key: "initialBookmark",
  7988. get: function get() {
  7989. return this._initialized ? this._initialBookmark : null;
  7990. }
  7991. }, {
  7992. key: "initialRotation",
  7993. get: function get() {
  7994. return this._initialized ? this._initialRotation : null;
  7995. }
  7996. }, {
  7997. key: "_pushOrReplaceState",
  7998. value: function _pushOrReplaceState(destination) {
  7999. var forceReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8000. var shouldReplace = forceReplace || !this._destination;
  8001. var newState = {
  8002. fingerprint: this._fingerprint,
  8003. uid: shouldReplace ? this._uid : this._uid + 1,
  8004. destination: destination
  8005. };
  8006. this._updateInternalState(destination, newState.uid);
  8007. var newUrl;
  8008. if (this._updateUrl && destination !== null && destination !== void 0 && destination.hash) {
  8009. var baseUrl = document.location.href.split("#")[0];
  8010. if (!baseUrl.startsWith("file://")) {
  8011. newUrl = "".concat(baseUrl, "#").concat(destination.hash);
  8012. }
  8013. }
  8014. if (shouldReplace) {
  8015. window.history.replaceState(newState, "", newUrl);
  8016. } else {
  8017. window.history.pushState(newState, "", newUrl);
  8018. }
  8019. }
  8020. }, {
  8021. key: "_tryPushCurrentPosition",
  8022. value: function _tryPushCurrentPosition() {
  8023. var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  8024. if (!this._position) {
  8025. return;
  8026. }
  8027. var position = this._position;
  8028. if (temporary) {
  8029. position = Object.assign(Object.create(null), this._position);
  8030. position.temporary = true;
  8031. }
  8032. if (!this._destination) {
  8033. this._pushOrReplaceState(position);
  8034. return;
  8035. }
  8036. if (this._destination.temporary) {
  8037. this._pushOrReplaceState(position, true);
  8038. return;
  8039. }
  8040. if (this._destination.hash === position.hash) {
  8041. return;
  8042. }
  8043. if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {
  8044. return;
  8045. }
  8046. var forceReplace = false;
  8047. if (this._destination.page >= position.first && this._destination.page <= position.page) {
  8048. if (this._destination.dest !== undefined || !this._destination.first) {
  8049. return;
  8050. }
  8051. forceReplace = true;
  8052. }
  8053. this._pushOrReplaceState(position, forceReplace);
  8054. }
  8055. }, {
  8056. key: "_isValidPage",
  8057. value: function _isValidPage(val) {
  8058. return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;
  8059. }
  8060. }, {
  8061. key: "_isValidState",
  8062. value: function _isValidState(state) {
  8063. var checkReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8064. if (!state) {
  8065. return false;
  8066. }
  8067. if (state.fingerprint !== this._fingerprint) {
  8068. if (checkReload) {
  8069. if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {
  8070. return false;
  8071. }
  8072. var _performance$getEntri = performance.getEntriesByType("navigation"),
  8073. _performance$getEntri2 = _slicedToArray(_performance$getEntri, 1),
  8074. perfEntry = _performance$getEntri2[0];
  8075. if ((perfEntry === null || perfEntry === void 0 ? void 0 : perfEntry.type) !== "reload") {
  8076. return false;
  8077. }
  8078. } else {
  8079. return false;
  8080. }
  8081. }
  8082. if (!Number.isInteger(state.uid) || state.uid < 0) {
  8083. return false;
  8084. }
  8085. if (state.destination === null || _typeof(state.destination) !== "object") {
  8086. return false;
  8087. }
  8088. return true;
  8089. }
  8090. }, {
  8091. key: "_updateInternalState",
  8092. value: function _updateInternalState(destination, uid) {
  8093. var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  8094. if (this._updateViewareaTimeout) {
  8095. clearTimeout(this._updateViewareaTimeout);
  8096. this._updateViewareaTimeout = null;
  8097. }
  8098. if (removeTemporary && destination !== null && destination !== void 0 && destination.temporary) {
  8099. delete destination.temporary;
  8100. }
  8101. this._destination = destination;
  8102. this._uid = uid;
  8103. this._maxUid = Math.max(this._maxUid, uid);
  8104. this._numPositionUpdates = 0;
  8105. }
  8106. }, {
  8107. key: "_parseCurrentHash",
  8108. value: function _parseCurrentHash() {
  8109. var checkNameddest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  8110. var hash = unescape(getCurrentHash()).substring(1);
  8111. var params = (0, _ui_utils.parseQueryString)(hash);
  8112. var nameddest = params.get("nameddest") || "";
  8113. var page = params.get("page") | 0;
  8114. if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) {
  8115. page = null;
  8116. }
  8117. return {
  8118. hash: hash,
  8119. page: page,
  8120. rotation: this.linkService.rotation
  8121. };
  8122. }
  8123. }, {
  8124. key: "_updateViewarea",
  8125. value: function _updateViewarea(_ref4) {
  8126. var _this4 = this;
  8127. var location = _ref4.location;
  8128. if (this._updateViewareaTimeout) {
  8129. clearTimeout(this._updateViewareaTimeout);
  8130. this._updateViewareaTimeout = null;
  8131. }
  8132. this._position = {
  8133. hash: location.pdfOpenParams.substring(1),
  8134. page: this.linkService.page,
  8135. first: location.pageNumber,
  8136. rotation: location.rotation
  8137. };
  8138. if (this._popStateInProgress) {
  8139. return;
  8140. }
  8141. if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {
  8142. this._numPositionUpdates++;
  8143. }
  8144. if (UPDATE_VIEWAREA_TIMEOUT > 0) {
  8145. this._updateViewareaTimeout = setTimeout(function () {
  8146. if (!_this4._popStateInProgress) {
  8147. _this4._tryPushCurrentPosition(true);
  8148. }
  8149. _this4._updateViewareaTimeout = null;
  8150. }, UPDATE_VIEWAREA_TIMEOUT);
  8151. }
  8152. }
  8153. }, {
  8154. key: "_popState",
  8155. value: function _popState(_ref5) {
  8156. var _this5 = this;
  8157. var state = _ref5.state;
  8158. var newHash = getCurrentHash(),
  8159. hashChanged = this._currentHash !== newHash;
  8160. this._currentHash = newHash;
  8161. if (!state) {
  8162. this._uid++;
  8163. var _this$_parseCurrentHa2 = this._parseCurrentHash(),
  8164. hash = _this$_parseCurrentHa2.hash,
  8165. page = _this$_parseCurrentHa2.page,
  8166. rotation = _this$_parseCurrentHa2.rotation;
  8167. this._pushOrReplaceState({
  8168. hash: hash,
  8169. page: page,
  8170. rotation: rotation
  8171. }, true);
  8172. return;
  8173. }
  8174. if (!this._isValidState(state)) {
  8175. return;
  8176. }
  8177. this._popStateInProgress = true;
  8178. if (hashChanged) {
  8179. this._blockHashChange++;
  8180. (0, _event_utils.waitOnEventOrTimeout)({
  8181. target: window,
  8182. name: "hashchange",
  8183. delay: HASH_CHANGE_TIMEOUT
  8184. }).then(function () {
  8185. _this5._blockHashChange--;
  8186. });
  8187. }
  8188. var destination = state.destination;
  8189. this._updateInternalState(destination, state.uid, true);
  8190. if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
  8191. this.linkService.rotation = destination.rotation;
  8192. }
  8193. if (destination.dest) {
  8194. this.linkService.goToDestination(destination.dest);
  8195. } else if (destination.hash) {
  8196. this.linkService.setHash(destination.hash);
  8197. } else if (destination.page) {
  8198. this.linkService.page = destination.page;
  8199. }
  8200. Promise.resolve().then(function () {
  8201. _this5._popStateInProgress = false;
  8202. });
  8203. }
  8204. }, {
  8205. key: "_pageHide",
  8206. value: function _pageHide() {
  8207. if (!this._destination || this._destination.temporary) {
  8208. this._tryPushCurrentPosition();
  8209. }
  8210. }
  8211. }, {
  8212. key: "_bindEvents",
  8213. value: function _bindEvents() {
  8214. if (this._boundEvents) {
  8215. return;
  8216. }
  8217. this._boundEvents = {
  8218. updateViewarea: this._updateViewarea.bind(this),
  8219. popState: this._popState.bind(this),
  8220. pageHide: this._pageHide.bind(this)
  8221. };
  8222. this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea);
  8223. window.addEventListener("popstate", this._boundEvents.popState);
  8224. window.addEventListener("pagehide", this._boundEvents.pageHide);
  8225. }
  8226. }, {
  8227. key: "_unbindEvents",
  8228. value: function _unbindEvents() {
  8229. if (!this._boundEvents) {
  8230. return;
  8231. }
  8232. this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea);
  8233. window.removeEventListener("popstate", this._boundEvents.popState);
  8234. window.removeEventListener("pagehide", this._boundEvents.pageHide);
  8235. this._boundEvents = null;
  8236. }
  8237. }]);
  8238. return PDFHistory;
  8239. }();
  8240. exports.PDFHistory = PDFHistory;
  8241. function isDestHashesEqual(destHash, pushHash) {
  8242. if (typeof destHash !== "string" || typeof pushHash !== "string") {
  8243. return false;
  8244. }
  8245. if (destHash === pushHash) {
  8246. return true;
  8247. }
  8248. var nameddest = (0, _ui_utils.parseQueryString)(destHash).get("nameddest");
  8249. if (nameddest === pushHash) {
  8250. return true;
  8251. }
  8252. return false;
  8253. }
  8254. function isDestArraysEqual(firstDest, secondDest) {
  8255. function isEntryEqual(first, second) {
  8256. if (_typeof(first) !== _typeof(second)) {
  8257. return false;
  8258. }
  8259. if (Array.isArray(first) || Array.isArray(second)) {
  8260. return false;
  8261. }
  8262. if (first !== null && _typeof(first) === "object" && second !== null) {
  8263. if (Object.keys(first).length !== Object.keys(second).length) {
  8264. return false;
  8265. }
  8266. for (var key in first) {
  8267. if (!isEntryEqual(first[key], second[key])) {
  8268. return false;
  8269. }
  8270. }
  8271. return true;
  8272. }
  8273. return first === second || Number.isNaN(first) && Number.isNaN(second);
  8274. }
  8275. if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {
  8276. return false;
  8277. }
  8278. if (firstDest.length !== secondDest.length) {
  8279. return false;
  8280. }
  8281. for (var i = 0, ii = firstDest.length; i < ii; i++) {
  8282. if (!isEntryEqual(firstDest[i], secondDest[i])) {
  8283. return false;
  8284. }
  8285. }
  8286. return true;
  8287. }
  8288. /***/ }),
  8289. /* 25 */
  8290. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8291. Object.defineProperty(exports, "__esModule", ({
  8292. value: true
  8293. }));
  8294. exports.PDFScriptingManager = void 0;
  8295. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  8296. var _ui_utils = __w_pdfjs_require__(8);
  8297. var _pdfjsLib = __w_pdfjs_require__(5);
  8298. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8299. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  8300. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  8301. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  8302. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  8303. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  8304. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  8305. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  8306. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
  8307. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  8308. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  8309. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  8310. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  8311. function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  8312. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  8313. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  8314. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  8315. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8316. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8317. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8318. var PDFScriptingManager = /*#__PURE__*/function () {
  8319. function PDFScriptingManager(_ref) {
  8320. var _this = this;
  8321. var eventBus = _ref.eventBus,
  8322. _ref$sandboxBundleSrc = _ref.sandboxBundleSrc,
  8323. sandboxBundleSrc = _ref$sandboxBundleSrc === void 0 ? null : _ref$sandboxBundleSrc,
  8324. _ref$scriptingFactory = _ref.scriptingFactory,
  8325. scriptingFactory = _ref$scriptingFactory === void 0 ? null : _ref$scriptingFactory,
  8326. _ref$docPropertiesLoo = _ref.docPropertiesLookup,
  8327. docPropertiesLookup = _ref$docPropertiesLoo === void 0 ? null : _ref$docPropertiesLoo;
  8328. _classCallCheck(this, PDFScriptingManager);
  8329. this._pdfDocument = null;
  8330. this._pdfViewer = null;
  8331. this._closeCapability = null;
  8332. this._destroyCapability = null;
  8333. this._scripting = null;
  8334. this._mouseState = Object.create(null);
  8335. this._ready = false;
  8336. this._eventBus = eventBus;
  8337. this._sandboxBundleSrc = sandboxBundleSrc;
  8338. this._scriptingFactory = scriptingFactory;
  8339. this._docPropertiesLookup = docPropertiesLookup;
  8340. if (!this._scriptingFactory) {
  8341. window.addEventListener("updatefromsandbox", function (event) {
  8342. _this._eventBus.dispatch("updatefromsandbox", {
  8343. source: window,
  8344. detail: event.detail
  8345. });
  8346. });
  8347. }
  8348. }
  8349. _createClass(PDFScriptingManager, [{
  8350. key: "setViewer",
  8351. value: function setViewer(pdfViewer) {
  8352. this._pdfViewer = pdfViewer;
  8353. }
  8354. }, {
  8355. key: "setDocument",
  8356. value: function () {
  8357. var _setDocument = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pdfDocument) {
  8358. var _this2 = this,
  8359. _this$_scripting;
  8360. var _yield$Promise$all, _yield$Promise$all2, objects, calculationOrder, docActions, _iterator, _step, _step$value, name, listener, _iterator2, _step2, _step2$value, _name, _listener, docProperties;
  8361. return _regenerator["default"].wrap(function _callee2$(_context2) {
  8362. while (1) {
  8363. switch (_context2.prev = _context2.next) {
  8364. case 0:
  8365. if (!this._pdfDocument) {
  8366. _context2.next = 3;
  8367. break;
  8368. }
  8369. _context2.next = 3;
  8370. return this._destroyScripting();
  8371. case 3:
  8372. this._pdfDocument = pdfDocument;
  8373. if (pdfDocument) {
  8374. _context2.next = 6;
  8375. break;
  8376. }
  8377. return _context2.abrupt("return");
  8378. case 6:
  8379. _context2.next = 8;
  8380. return Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);
  8381. case 8:
  8382. _yield$Promise$all = _context2.sent;
  8383. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  8384. objects = _yield$Promise$all2[0];
  8385. calculationOrder = _yield$Promise$all2[1];
  8386. docActions = _yield$Promise$all2[2];
  8387. if (!(!objects && !docActions)) {
  8388. _context2.next = 17;
  8389. break;
  8390. }
  8391. _context2.next = 16;
  8392. return this._destroyScripting();
  8393. case 16:
  8394. return _context2.abrupt("return");
  8395. case 17:
  8396. if (!(pdfDocument !== this._pdfDocument)) {
  8397. _context2.next = 19;
  8398. break;
  8399. }
  8400. return _context2.abrupt("return");
  8401. case 19:
  8402. _context2.prev = 19;
  8403. this._scripting = this._createScripting();
  8404. _context2.next = 29;
  8405. break;
  8406. case 23:
  8407. _context2.prev = 23;
  8408. _context2.t0 = _context2["catch"](19);
  8409. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message, "\"."));
  8410. _context2.next = 28;
  8411. return this._destroyScripting();
  8412. case 28:
  8413. return _context2.abrupt("return");
  8414. case 29:
  8415. this._internalEvents.set("updatefromsandbox", function (event) {
  8416. if ((event === null || event === void 0 ? void 0 : event.source) !== window) {
  8417. return;
  8418. }
  8419. _this2._updateFromSandbox(event.detail);
  8420. });
  8421. this._internalEvents.set("dispatcheventinsandbox", function (event) {
  8422. var _this2$_scripting;
  8423. (_this2$_scripting = _this2._scripting) === null || _this2$_scripting === void 0 ? void 0 : _this2$_scripting.dispatchEventInSandbox(event.detail);
  8424. });
  8425. this._internalEvents.set("pagechanging", function (_ref2) {
  8426. var pageNumber = _ref2.pageNumber,
  8427. previous = _ref2.previous;
  8428. if (pageNumber === previous) {
  8429. return;
  8430. }
  8431. _this2._dispatchPageClose(previous);
  8432. _this2._dispatchPageOpen(pageNumber);
  8433. });
  8434. this._internalEvents.set("pagerendered", function (_ref3) {
  8435. var pageNumber = _ref3.pageNumber;
  8436. if (!_this2._pageOpenPending.has(pageNumber)) {
  8437. return;
  8438. }
  8439. if (pageNumber !== _this2._pdfViewer.currentPageNumber) {
  8440. return;
  8441. }
  8442. _this2._dispatchPageOpen(pageNumber);
  8443. });
  8444. this._internalEvents.set("pagesdestroy", /*#__PURE__*/function () {
  8445. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
  8446. var _this2$_scripting2, _this2$_closeCapabili;
  8447. return _regenerator["default"].wrap(function _callee$(_context) {
  8448. while (1) {
  8449. switch (_context.prev = _context.next) {
  8450. case 0:
  8451. _context.next = 2;
  8452. return _this2._dispatchPageClose(_this2._pdfViewer.currentPageNumber);
  8453. case 2:
  8454. _context.next = 4;
  8455. return (_this2$_scripting2 = _this2._scripting) === null || _this2$_scripting2 === void 0 ? void 0 : _this2$_scripting2.dispatchEventInSandbox({
  8456. id: "doc",
  8457. name: "WillClose"
  8458. });
  8459. case 4:
  8460. (_this2$_closeCapabili = _this2._closeCapability) === null || _this2$_closeCapabili === void 0 ? void 0 : _this2$_closeCapabili.resolve();
  8461. case 5:
  8462. case "end":
  8463. return _context.stop();
  8464. }
  8465. }
  8466. }, _callee);
  8467. }));
  8468. return function (_x2) {
  8469. return _ref4.apply(this, arguments);
  8470. };
  8471. }());
  8472. this._domEvents.set("mousedown", function (event) {
  8473. _this2._mouseState.isDown = true;
  8474. });
  8475. this._domEvents.set("mouseup", function (event) {
  8476. _this2._mouseState.isDown = false;
  8477. });
  8478. _iterator = _createForOfIteratorHelper(this._internalEvents);
  8479. try {
  8480. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  8481. _step$value = _slicedToArray(_step.value, 2), name = _step$value[0], listener = _step$value[1];
  8482. this._eventBus._on(name, listener);
  8483. }
  8484. } catch (err) {
  8485. _iterator.e(err);
  8486. } finally {
  8487. _iterator.f();
  8488. }
  8489. _iterator2 = _createForOfIteratorHelper(this._domEvents);
  8490. try {
  8491. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  8492. _step2$value = _slicedToArray(_step2.value, 2), _name = _step2$value[0], _listener = _step2$value[1];
  8493. window.addEventListener(_name, _listener, true);
  8494. }
  8495. } catch (err) {
  8496. _iterator2.e(err);
  8497. } finally {
  8498. _iterator2.f();
  8499. }
  8500. _context2.prev = 40;
  8501. _context2.next = 43;
  8502. return this._getDocProperties();
  8503. case 43:
  8504. docProperties = _context2.sent;
  8505. if (!(pdfDocument !== this._pdfDocument)) {
  8506. _context2.next = 46;
  8507. break;
  8508. }
  8509. return _context2.abrupt("return");
  8510. case 46:
  8511. _context2.next = 48;
  8512. return this._scripting.createSandbox({
  8513. objects: objects,
  8514. calculationOrder: calculationOrder,
  8515. appInfo: {
  8516. platform: navigator.platform,
  8517. language: navigator.language
  8518. },
  8519. docInfo: _objectSpread(_objectSpread({}, docProperties), {}, {
  8520. actions: docActions
  8521. })
  8522. });
  8523. case 48:
  8524. this._eventBus.dispatch("sandboxcreated", {
  8525. source: this
  8526. });
  8527. _context2.next = 57;
  8528. break;
  8529. case 51:
  8530. _context2.prev = 51;
  8531. _context2.t1 = _context2["catch"](40);
  8532. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t1 === null || _context2.t1 === void 0 ? void 0 : _context2.t1.message, "\"."));
  8533. _context2.next = 56;
  8534. return this._destroyScripting();
  8535. case 56:
  8536. return _context2.abrupt("return");
  8537. case 57:
  8538. _context2.next = 59;
  8539. return (_this$_scripting = this._scripting) === null || _this$_scripting === void 0 ? void 0 : _this$_scripting.dispatchEventInSandbox({
  8540. id: "doc",
  8541. name: "Open"
  8542. });
  8543. case 59:
  8544. _context2.next = 61;
  8545. return this._dispatchPageOpen(this._pdfViewer.currentPageNumber, true);
  8546. case 61:
  8547. Promise.resolve().then(function () {
  8548. if (pdfDocument === _this2._pdfDocument) {
  8549. _this2._ready = true;
  8550. }
  8551. });
  8552. case 62:
  8553. case "end":
  8554. return _context2.stop();
  8555. }
  8556. }
  8557. }, _callee2, this, [[19, 23], [40, 51]]);
  8558. }));
  8559. function setDocument(_x) {
  8560. return _setDocument.apply(this, arguments);
  8561. }
  8562. return setDocument;
  8563. }()
  8564. }, {
  8565. key: "dispatchWillSave",
  8566. value: function () {
  8567. var _dispatchWillSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(detail) {
  8568. var _this$_scripting2;
  8569. return _regenerator["default"].wrap(function _callee3$(_context3) {
  8570. while (1) {
  8571. switch (_context3.prev = _context3.next) {
  8572. case 0:
  8573. return _context3.abrupt("return", (_this$_scripting2 = this._scripting) === null || _this$_scripting2 === void 0 ? void 0 : _this$_scripting2.dispatchEventInSandbox({
  8574. id: "doc",
  8575. name: "WillSave"
  8576. }));
  8577. case 1:
  8578. case "end":
  8579. return _context3.stop();
  8580. }
  8581. }
  8582. }, _callee3, this);
  8583. }));
  8584. function dispatchWillSave(_x3) {
  8585. return _dispatchWillSave.apply(this, arguments);
  8586. }
  8587. return dispatchWillSave;
  8588. }()
  8589. }, {
  8590. key: "dispatchDidSave",
  8591. value: function () {
  8592. var _dispatchDidSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(detail) {
  8593. var _this$_scripting3;
  8594. return _regenerator["default"].wrap(function _callee4$(_context4) {
  8595. while (1) {
  8596. switch (_context4.prev = _context4.next) {
  8597. case 0:
  8598. return _context4.abrupt("return", (_this$_scripting3 = this._scripting) === null || _this$_scripting3 === void 0 ? void 0 : _this$_scripting3.dispatchEventInSandbox({
  8599. id: "doc",
  8600. name: "DidSave"
  8601. }));
  8602. case 1:
  8603. case "end":
  8604. return _context4.stop();
  8605. }
  8606. }
  8607. }, _callee4, this);
  8608. }));
  8609. function dispatchDidSave(_x4) {
  8610. return _dispatchDidSave.apply(this, arguments);
  8611. }
  8612. return dispatchDidSave;
  8613. }()
  8614. }, {
  8615. key: "dispatchWillPrint",
  8616. value: function () {
  8617. var _dispatchWillPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5(detail) {
  8618. var _this$_scripting4;
  8619. return _regenerator["default"].wrap(function _callee5$(_context5) {
  8620. while (1) {
  8621. switch (_context5.prev = _context5.next) {
  8622. case 0:
  8623. return _context5.abrupt("return", (_this$_scripting4 = this._scripting) === null || _this$_scripting4 === void 0 ? void 0 : _this$_scripting4.dispatchEventInSandbox({
  8624. id: "doc",
  8625. name: "WillPrint"
  8626. }));
  8627. case 1:
  8628. case "end":
  8629. return _context5.stop();
  8630. }
  8631. }
  8632. }, _callee5, this);
  8633. }));
  8634. function dispatchWillPrint(_x5) {
  8635. return _dispatchWillPrint.apply(this, arguments);
  8636. }
  8637. return dispatchWillPrint;
  8638. }()
  8639. }, {
  8640. key: "dispatchDidPrint",
  8641. value: function () {
  8642. var _dispatchDidPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6(detail) {
  8643. var _this$_scripting5;
  8644. return _regenerator["default"].wrap(function _callee6$(_context6) {
  8645. while (1) {
  8646. switch (_context6.prev = _context6.next) {
  8647. case 0:
  8648. return _context6.abrupt("return", (_this$_scripting5 = this._scripting) === null || _this$_scripting5 === void 0 ? void 0 : _this$_scripting5.dispatchEventInSandbox({
  8649. id: "doc",
  8650. name: "DidPrint"
  8651. }));
  8652. case 1:
  8653. case "end":
  8654. return _context6.stop();
  8655. }
  8656. }
  8657. }, _callee6, this);
  8658. }));
  8659. function dispatchDidPrint(_x6) {
  8660. return _dispatchDidPrint.apply(this, arguments);
  8661. }
  8662. return dispatchDidPrint;
  8663. }()
  8664. }, {
  8665. key: "mouseState",
  8666. get: function get() {
  8667. return this._mouseState;
  8668. }
  8669. }, {
  8670. key: "destroyPromise",
  8671. get: function get() {
  8672. var _this$_destroyCapabil;
  8673. return ((_this$_destroyCapabil = this._destroyCapability) === null || _this$_destroyCapabil === void 0 ? void 0 : _this$_destroyCapabil.promise) || null;
  8674. }
  8675. }, {
  8676. key: "ready",
  8677. get: function get() {
  8678. return this._ready;
  8679. }
  8680. }, {
  8681. key: "_internalEvents",
  8682. get: function get() {
  8683. return (0, _pdfjsLib.shadow)(this, "_internalEvents", new Map());
  8684. }
  8685. }, {
  8686. key: "_domEvents",
  8687. get: function get() {
  8688. return (0, _pdfjsLib.shadow)(this, "_domEvents", new Map());
  8689. }
  8690. }, {
  8691. key: "_pageOpenPending",
  8692. get: function get() {
  8693. return (0, _pdfjsLib.shadow)(this, "_pageOpenPending", new Set());
  8694. }
  8695. }, {
  8696. key: "_visitedPages",
  8697. get: function get() {
  8698. return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map());
  8699. }
  8700. }, {
  8701. key: "_updateFromSandbox",
  8702. value: function () {
  8703. var _updateFromSandbox2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee7(detail) {
  8704. var isInPresentationMode, id, siblings, command, value, modes, ids, _iterator3, _step3, elementId, element, _this$_pdfDocument;
  8705. return _regenerator["default"].wrap(function _callee7$(_context7) {
  8706. while (1) {
  8707. switch (_context7.prev = _context7.next) {
  8708. case 0:
  8709. isInPresentationMode = this._pdfViewer.isInPresentationMode || this._pdfViewer.isChangingPresentationMode;
  8710. id = detail.id, siblings = detail.siblings, command = detail.command, value = detail.value;
  8711. if (id) {
  8712. _context7.next = 46;
  8713. break;
  8714. }
  8715. _context7.t0 = command;
  8716. _context7.next = _context7.t0 === "clear" ? 6 : _context7.t0 === "error" ? 8 : _context7.t0 === "layout" ? 10 : _context7.t0 === "page-num" ? 15 : _context7.t0 === "print" ? 17 : _context7.t0 === "println" ? 21 : _context7.t0 === "zoom" ? 23 : _context7.t0 === "SaveAs" ? 27 : _context7.t0 === "FirstPage" ? 29 : _context7.t0 === "LastPage" ? 31 : _context7.t0 === "NextPage" ? 33 : _context7.t0 === "PrevPage" ? 35 : _context7.t0 === "ZoomViewIn" ? 37 : _context7.t0 === "ZoomViewOut" ? 41 : 45;
  8717. break;
  8718. case 6:
  8719. console.clear();
  8720. return _context7.abrupt("break", 45);
  8721. case 8:
  8722. console.error(value);
  8723. return _context7.abrupt("break", 45);
  8724. case 10:
  8725. if (!isInPresentationMode) {
  8726. _context7.next = 12;
  8727. break;
  8728. }
  8729. return _context7.abrupt("return");
  8730. case 12:
  8731. modes = (0, _ui_utils.apiPageLayoutToViewerModes)(value);
  8732. this._pdfViewer.spreadMode = modes.spreadMode;
  8733. return _context7.abrupt("break", 45);
  8734. case 15:
  8735. this._pdfViewer.currentPageNumber = value + 1;
  8736. return _context7.abrupt("break", 45);
  8737. case 17:
  8738. _context7.next = 19;
  8739. return this._pdfViewer.pagesPromise;
  8740. case 19:
  8741. this._eventBus.dispatch("print", {
  8742. source: this
  8743. });
  8744. return _context7.abrupt("break", 45);
  8745. case 21:
  8746. console.log(value);
  8747. return _context7.abrupt("break", 45);
  8748. case 23:
  8749. if (!isInPresentationMode) {
  8750. _context7.next = 25;
  8751. break;
  8752. }
  8753. return _context7.abrupt("return");
  8754. case 25:
  8755. this._pdfViewer.currentScaleValue = value;
  8756. return _context7.abrupt("break", 45);
  8757. case 27:
  8758. this._eventBus.dispatch("save", {
  8759. source: this
  8760. });
  8761. return _context7.abrupt("break", 45);
  8762. case 29:
  8763. this._pdfViewer.currentPageNumber = 1;
  8764. return _context7.abrupt("break", 45);
  8765. case 31:
  8766. this._pdfViewer.currentPageNumber = this._pdfViewer.pagesCount;
  8767. return _context7.abrupt("break", 45);
  8768. case 33:
  8769. this._pdfViewer.nextPage();
  8770. return _context7.abrupt("break", 45);
  8771. case 35:
  8772. this._pdfViewer.previousPage();
  8773. return _context7.abrupt("break", 45);
  8774. case 37:
  8775. if (!isInPresentationMode) {
  8776. _context7.next = 39;
  8777. break;
  8778. }
  8779. return _context7.abrupt("return");
  8780. case 39:
  8781. this._pdfViewer.increaseScale();
  8782. return _context7.abrupt("break", 45);
  8783. case 41:
  8784. if (!isInPresentationMode) {
  8785. _context7.next = 43;
  8786. break;
  8787. }
  8788. return _context7.abrupt("return");
  8789. case 43:
  8790. this._pdfViewer.decreaseScale();
  8791. return _context7.abrupt("break", 45);
  8792. case 45:
  8793. return _context7.abrupt("return");
  8794. case 46:
  8795. if (!isInPresentationMode) {
  8796. _context7.next = 49;
  8797. break;
  8798. }
  8799. if (!detail.focus) {
  8800. _context7.next = 49;
  8801. break;
  8802. }
  8803. return _context7.abrupt("return");
  8804. case 49:
  8805. delete detail.id;
  8806. delete detail.siblings;
  8807. ids = siblings ? [id].concat(_toConsumableArray(siblings)) : [id];
  8808. _iterator3 = _createForOfIteratorHelper(ids);
  8809. try {
  8810. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  8811. elementId = _step3.value;
  8812. element = document.getElementById(elementId);
  8813. if (element) {
  8814. element.dispatchEvent(new CustomEvent("updatefromsandbox", {
  8815. detail: detail
  8816. }));
  8817. } else {
  8818. (_this$_pdfDocument = this._pdfDocument) === null || _this$_pdfDocument === void 0 ? void 0 : _this$_pdfDocument.annotationStorage.setValue(elementId, detail);
  8819. }
  8820. }
  8821. } catch (err) {
  8822. _iterator3.e(err);
  8823. } finally {
  8824. _iterator3.f();
  8825. }
  8826. case 54:
  8827. case "end":
  8828. return _context7.stop();
  8829. }
  8830. }
  8831. }, _callee7, this);
  8832. }));
  8833. function _updateFromSandbox(_x7) {
  8834. return _updateFromSandbox2.apply(this, arguments);
  8835. }
  8836. return _updateFromSandbox;
  8837. }()
  8838. }, {
  8839. key: "_dispatchPageOpen",
  8840. value: function () {
  8841. var _dispatchPageOpen2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee9(pageNumber) {
  8842. var _this3 = this;
  8843. var initialize,
  8844. pdfDocument,
  8845. visitedPages,
  8846. pageView,
  8847. actionsPromise,
  8848. _args9 = arguments;
  8849. return _regenerator["default"].wrap(function _callee9$(_context9) {
  8850. while (1) {
  8851. switch (_context9.prev = _context9.next) {
  8852. case 0:
  8853. initialize = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : false;
  8854. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  8855. if (initialize) {
  8856. this._closeCapability = (0, _pdfjsLib.createPromiseCapability)();
  8857. }
  8858. if (this._closeCapability) {
  8859. _context9.next = 5;
  8860. break;
  8861. }
  8862. return _context9.abrupt("return");
  8863. case 5:
  8864. pageView = this._pdfViewer.getPageView(pageNumber - 1);
  8865. if (!((pageView === null || pageView === void 0 ? void 0 : pageView.renderingState) !== _ui_utils.RenderingStates.FINISHED)) {
  8866. _context9.next = 9;
  8867. break;
  8868. }
  8869. this._pageOpenPending.add(pageNumber);
  8870. return _context9.abrupt("return");
  8871. case 9:
  8872. this._pageOpenPending["delete"](pageNumber);
  8873. actionsPromise = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
  8874. var _pageView$pdfPage, _this3$_scripting;
  8875. var actions;
  8876. return _regenerator["default"].wrap(function _callee8$(_context8) {
  8877. while (1) {
  8878. switch (_context8.prev = _context8.next) {
  8879. case 0:
  8880. _context8.next = 2;
  8881. return !visitedPages.has(pageNumber) ? (_pageView$pdfPage = pageView.pdfPage) === null || _pageView$pdfPage === void 0 ? void 0 : _pageView$pdfPage.getJSActions() : null;
  8882. case 2:
  8883. actions = _context8.sent;
  8884. if (!(pdfDocument !== _this3._pdfDocument)) {
  8885. _context8.next = 5;
  8886. break;
  8887. }
  8888. return _context8.abrupt("return");
  8889. case 5:
  8890. _context8.next = 7;
  8891. return (_this3$_scripting = _this3._scripting) === null || _this3$_scripting === void 0 ? void 0 : _this3$_scripting.dispatchEventInSandbox({
  8892. id: "page",
  8893. name: "PageOpen",
  8894. pageNumber: pageNumber,
  8895. actions: actions
  8896. });
  8897. case 7:
  8898. case "end":
  8899. return _context8.stop();
  8900. }
  8901. }
  8902. }, _callee8);
  8903. }))();
  8904. visitedPages.set(pageNumber, actionsPromise);
  8905. case 12:
  8906. case "end":
  8907. return _context9.stop();
  8908. }
  8909. }
  8910. }, _callee9, this);
  8911. }));
  8912. function _dispatchPageOpen(_x8) {
  8913. return _dispatchPageOpen2.apply(this, arguments);
  8914. }
  8915. return _dispatchPageOpen;
  8916. }()
  8917. }, {
  8918. key: "_dispatchPageClose",
  8919. value: function () {
  8920. var _dispatchPageClose2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee10(pageNumber) {
  8921. var _this$_scripting6;
  8922. var pdfDocument, visitedPages, actionsPromise;
  8923. return _regenerator["default"].wrap(function _callee10$(_context10) {
  8924. while (1) {
  8925. switch (_context10.prev = _context10.next) {
  8926. case 0:
  8927. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  8928. if (this._closeCapability) {
  8929. _context10.next = 3;
  8930. break;
  8931. }
  8932. return _context10.abrupt("return");
  8933. case 3:
  8934. if (!this._pageOpenPending.has(pageNumber)) {
  8935. _context10.next = 5;
  8936. break;
  8937. }
  8938. return _context10.abrupt("return");
  8939. case 5:
  8940. actionsPromise = visitedPages.get(pageNumber);
  8941. if (actionsPromise) {
  8942. _context10.next = 8;
  8943. break;
  8944. }
  8945. return _context10.abrupt("return");
  8946. case 8:
  8947. visitedPages.set(pageNumber, null);
  8948. _context10.next = 11;
  8949. return actionsPromise;
  8950. case 11:
  8951. if (!(pdfDocument !== this._pdfDocument)) {
  8952. _context10.next = 13;
  8953. break;
  8954. }
  8955. return _context10.abrupt("return");
  8956. case 13:
  8957. _context10.next = 15;
  8958. return (_this$_scripting6 = this._scripting) === null || _this$_scripting6 === void 0 ? void 0 : _this$_scripting6.dispatchEventInSandbox({
  8959. id: "page",
  8960. name: "PageClose",
  8961. pageNumber: pageNumber
  8962. });
  8963. case 15:
  8964. case "end":
  8965. return _context10.stop();
  8966. }
  8967. }
  8968. }, _callee10, this);
  8969. }));
  8970. function _dispatchPageClose(_x9) {
  8971. return _dispatchPageClose2.apply(this, arguments);
  8972. }
  8973. return _dispatchPageClose;
  8974. }()
  8975. }, {
  8976. key: "_getDocProperties",
  8977. value: function () {
  8978. var _getDocProperties2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
  8979. var _require, docPropertiesLookup;
  8980. return _regenerator["default"].wrap(function _callee11$(_context11) {
  8981. while (1) {
  8982. switch (_context11.prev = _context11.next) {
  8983. case 0:
  8984. if (!this._docPropertiesLookup) {
  8985. _context11.next = 2;
  8986. break;
  8987. }
  8988. return _context11.abrupt("return", this._docPropertiesLookup(this._pdfDocument));
  8989. case 2:
  8990. _require = __w_pdfjs_require__(26), docPropertiesLookup = _require.docPropertiesLookup;
  8991. return _context11.abrupt("return", docPropertiesLookup(this._pdfDocument));
  8992. case 4:
  8993. case "end":
  8994. return _context11.stop();
  8995. }
  8996. }
  8997. }, _callee11, this);
  8998. }));
  8999. function _getDocProperties() {
  9000. return _getDocProperties2.apply(this, arguments);
  9001. }
  9002. return _getDocProperties;
  9003. }()
  9004. }, {
  9005. key: "_createScripting",
  9006. value: function _createScripting() {
  9007. this._destroyCapability = (0, _pdfjsLib.createPromiseCapability)();
  9008. if (this._scripting) {
  9009. throw new Error("_createScripting: Scripting already exists.");
  9010. }
  9011. if (this._scriptingFactory) {
  9012. return this._scriptingFactory.createScripting({
  9013. sandboxBundleSrc: this._sandboxBundleSrc
  9014. });
  9015. }
  9016. var _require2 = __w_pdfjs_require__(26),
  9017. GenericScripting = _require2.GenericScripting;
  9018. return new GenericScripting(this._sandboxBundleSrc);
  9019. }
  9020. }, {
  9021. key: "_destroyScripting",
  9022. value: function () {
  9023. var _destroyScripting2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
  9024. var _this$_destroyCapabil3;
  9025. var _this$_destroyCapabil2, _iterator4, _step4, _step4$value, name, listener, _iterator5, _step5, _step5$value, _name2, _listener2;
  9026. return _regenerator["default"].wrap(function _callee12$(_context12) {
  9027. while (1) {
  9028. switch (_context12.prev = _context12.next) {
  9029. case 0:
  9030. if (this._scripting) {
  9031. _context12.next = 4;
  9032. break;
  9033. }
  9034. this._pdfDocument = null;
  9035. (_this$_destroyCapabil2 = this._destroyCapability) === null || _this$_destroyCapabil2 === void 0 ? void 0 : _this$_destroyCapabil2.resolve();
  9036. return _context12.abrupt("return");
  9037. case 4:
  9038. if (!this._closeCapability) {
  9039. _context12.next = 8;
  9040. break;
  9041. }
  9042. _context12.next = 7;
  9043. return Promise.race([this._closeCapability.promise, new Promise(function (resolve) {
  9044. setTimeout(resolve, 1000);
  9045. })])["catch"](function (reason) {});
  9046. case 7:
  9047. this._closeCapability = null;
  9048. case 8:
  9049. this._pdfDocument = null;
  9050. _context12.prev = 9;
  9051. _context12.next = 12;
  9052. return this._scripting.destroySandbox();
  9053. case 12:
  9054. _context12.next = 16;
  9055. break;
  9056. case 14:
  9057. _context12.prev = 14;
  9058. _context12.t0 = _context12["catch"](9);
  9059. case 16:
  9060. _iterator4 = _createForOfIteratorHelper(this._internalEvents);
  9061. try {
  9062. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  9063. _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], listener = _step4$value[1];
  9064. this._eventBus._off(name, listener);
  9065. }
  9066. } catch (err) {
  9067. _iterator4.e(err);
  9068. } finally {
  9069. _iterator4.f();
  9070. }
  9071. this._internalEvents.clear();
  9072. _iterator5 = _createForOfIteratorHelper(this._domEvents);
  9073. try {
  9074. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  9075. _step5$value = _slicedToArray(_step5.value, 2), _name2 = _step5$value[0], _listener2 = _step5$value[1];
  9076. window.removeEventListener(_name2, _listener2, true);
  9077. }
  9078. } catch (err) {
  9079. _iterator5.e(err);
  9080. } finally {
  9081. _iterator5.f();
  9082. }
  9083. this._domEvents.clear();
  9084. this._pageOpenPending.clear();
  9085. this._visitedPages.clear();
  9086. this._scripting = null;
  9087. delete this._mouseState.isDown;
  9088. this._ready = false;
  9089. (_this$_destroyCapabil3 = this._destroyCapability) === null || _this$_destroyCapabil3 === void 0 ? void 0 : _this$_destroyCapabil3.resolve();
  9090. case 28:
  9091. case "end":
  9092. return _context12.stop();
  9093. }
  9094. }
  9095. }, _callee12, this, [[9, 14]]);
  9096. }));
  9097. function _destroyScripting() {
  9098. return _destroyScripting2.apply(this, arguments);
  9099. }
  9100. return _destroyScripting;
  9101. }()
  9102. }]);
  9103. return PDFScriptingManager;
  9104. }();
  9105. exports.PDFScriptingManager = PDFScriptingManager;
  9106. /***/ }),
  9107. /* 26 */
  9108. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9109. Object.defineProperty(exports, "__esModule", ({
  9110. value: true
  9111. }));
  9112. exports.GenericScripting = void 0;
  9113. exports.docPropertiesLookup = docPropertiesLookup;
  9114. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  9115. var _pdfjsLib = __w_pdfjs_require__(5);
  9116. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  9117. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  9118. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  9119. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  9120. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9121. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9122. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  9123. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  9124. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  9125. function docPropertiesLookup(_x) {
  9126. return _docPropertiesLookup.apply(this, arguments);
  9127. }
  9128. function _docPropertiesLookup() {
  9129. _docPropertiesLookup = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(pdfDocument) {
  9130. var url, baseUrl, _yield$pdfDocument$ge, info, metadata, contentDispositionFilename, contentLength, _yield$pdfDocument$ge2, length;
  9131. return _regenerator["default"].wrap(function _callee4$(_context4) {
  9132. while (1) {
  9133. switch (_context4.prev = _context4.next) {
  9134. case 0:
  9135. url = "", baseUrl = url.split("#")[0];
  9136. _context4.next = 3;
  9137. return pdfDocument.getMetadata();
  9138. case 3:
  9139. _yield$pdfDocument$ge = _context4.sent;
  9140. info = _yield$pdfDocument$ge.info;
  9141. metadata = _yield$pdfDocument$ge.metadata;
  9142. contentDispositionFilename = _yield$pdfDocument$ge.contentDispositionFilename;
  9143. contentLength = _yield$pdfDocument$ge.contentLength;
  9144. if (contentLength) {
  9145. _context4.next = 14;
  9146. break;
  9147. }
  9148. _context4.next = 11;
  9149. return pdfDocument.getDownloadInfo();
  9150. case 11:
  9151. _yield$pdfDocument$ge2 = _context4.sent;
  9152. length = _yield$pdfDocument$ge2.length;
  9153. contentLength = length;
  9154. case 14:
  9155. return _context4.abrupt("return", _objectSpread(_objectSpread({}, info), {}, {
  9156. baseURL: baseUrl,
  9157. filesize: contentLength,
  9158. filename: contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(url),
  9159. metadata: metadata === null || metadata === void 0 ? void 0 : metadata.getRaw(),
  9160. authors: metadata === null || metadata === void 0 ? void 0 : metadata.get("dc:creator"),
  9161. numPages: pdfDocument.numPages,
  9162. URL: url
  9163. }));
  9164. case 15:
  9165. case "end":
  9166. return _context4.stop();
  9167. }
  9168. }
  9169. }, _callee4);
  9170. }));
  9171. return _docPropertiesLookup.apply(this, arguments);
  9172. }
  9173. var GenericScripting = /*#__PURE__*/function () {
  9174. function GenericScripting(sandboxBundleSrc) {
  9175. _classCallCheck(this, GenericScripting);
  9176. this._ready = (0, _pdfjsLib.loadScript)(sandboxBundleSrc, true).then(function () {
  9177. return window.pdfjsSandbox.QuickJSSandbox();
  9178. });
  9179. }
  9180. _createClass(GenericScripting, [{
  9181. key: "createSandbox",
  9182. value: function () {
  9183. var _createSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
  9184. var sandbox;
  9185. return _regenerator["default"].wrap(function _callee$(_context) {
  9186. while (1) {
  9187. switch (_context.prev = _context.next) {
  9188. case 0:
  9189. _context.next = 2;
  9190. return this._ready;
  9191. case 2:
  9192. sandbox = _context.sent;
  9193. sandbox.create(data);
  9194. case 4:
  9195. case "end":
  9196. return _context.stop();
  9197. }
  9198. }
  9199. }, _callee, this);
  9200. }));
  9201. function createSandbox(_x2) {
  9202. return _createSandbox.apply(this, arguments);
  9203. }
  9204. return createSandbox;
  9205. }()
  9206. }, {
  9207. key: "dispatchEventInSandbox",
  9208. value: function () {
  9209. var _dispatchEventInSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(event) {
  9210. var sandbox;
  9211. return _regenerator["default"].wrap(function _callee2$(_context2) {
  9212. while (1) {
  9213. switch (_context2.prev = _context2.next) {
  9214. case 0:
  9215. _context2.next = 2;
  9216. return this._ready;
  9217. case 2:
  9218. sandbox = _context2.sent;
  9219. setTimeout(function () {
  9220. return sandbox.dispatchEvent(event);
  9221. }, 0);
  9222. case 4:
  9223. case "end":
  9224. return _context2.stop();
  9225. }
  9226. }
  9227. }, _callee2, this);
  9228. }));
  9229. function dispatchEventInSandbox(_x3) {
  9230. return _dispatchEventInSandbox.apply(this, arguments);
  9231. }
  9232. return dispatchEventInSandbox;
  9233. }()
  9234. }, {
  9235. key: "destroySandbox",
  9236. value: function () {
  9237. var _destroySandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  9238. var sandbox;
  9239. return _regenerator["default"].wrap(function _callee3$(_context3) {
  9240. while (1) {
  9241. switch (_context3.prev = _context3.next) {
  9242. case 0:
  9243. _context3.next = 2;
  9244. return this._ready;
  9245. case 2:
  9246. sandbox = _context3.sent;
  9247. sandbox.nukeSandbox();
  9248. case 4:
  9249. case "end":
  9250. return _context3.stop();
  9251. }
  9252. }
  9253. }, _callee3, this);
  9254. }));
  9255. function destroySandbox() {
  9256. return _destroySandbox.apply(this, arguments);
  9257. }
  9258. return destroySandbox;
  9259. }()
  9260. }]);
  9261. return GenericScripting;
  9262. }();
  9263. exports.GenericScripting = GenericScripting;
  9264. /***/ })
  9265. /******/ ]);
  9266. /************************************************************************/
  9267. /******/ // The module cache
  9268. /******/ var __webpack_module_cache__ = {};
  9269. /******/
  9270. /******/ // The require function
  9271. /******/ function __w_pdfjs_require__(moduleId) {
  9272. /******/ // Check if module is in cache
  9273. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  9274. /******/ if (cachedModule !== undefined) {
  9275. /******/ return cachedModule.exports;
  9276. /******/ }
  9277. /******/ // Create a new module (and put it into the cache)
  9278. /******/ var module = __webpack_module_cache__[moduleId] = {
  9279. /******/ id: moduleId,
  9280. /******/ loaded: false,
  9281. /******/ exports: {}
  9282. /******/ };
  9283. /******/
  9284. /******/ // Execute the module function
  9285. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  9286. /******/
  9287. /******/ // Flag the module as loaded
  9288. /******/ module.loaded = true;
  9289. /******/
  9290. /******/ // Return the exports of the module
  9291. /******/ return module.exports;
  9292. /******/ }
  9293. /******/
  9294. /************************************************************************/
  9295. /******/ /* webpack/runtime/node module decorator */
  9296. /******/ (() => {
  9297. /******/ __w_pdfjs_require__.nmd = (module) => {
  9298. /******/ module.paths = [];
  9299. /******/ if (!module.children) module.children = [];
  9300. /******/ return module;
  9301. /******/ };
  9302. /******/ })();
  9303. /******/
  9304. /************************************************************************/
  9305. var __webpack_exports__ = {};
  9306. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  9307. (() => {
  9308. var exports = __webpack_exports__;
  9309. Object.defineProperty(exports, "__esModule", ({
  9310. value: true
  9311. }));
  9312. Object.defineProperty(exports, "AnnotationLayerBuilder", ({
  9313. enumerable: true,
  9314. get: function get() {
  9315. return _annotation_layer_builder.AnnotationLayerBuilder;
  9316. }
  9317. }));
  9318. Object.defineProperty(exports, "DefaultAnnotationLayerFactory", ({
  9319. enumerable: true,
  9320. get: function get() {
  9321. return _default_factory.DefaultAnnotationLayerFactory;
  9322. }
  9323. }));
  9324. Object.defineProperty(exports, "DefaultStructTreeLayerFactory", ({
  9325. enumerable: true,
  9326. get: function get() {
  9327. return _default_factory.DefaultStructTreeLayerFactory;
  9328. }
  9329. }));
  9330. Object.defineProperty(exports, "DefaultTextLayerFactory", ({
  9331. enumerable: true,
  9332. get: function get() {
  9333. return _default_factory.DefaultTextLayerFactory;
  9334. }
  9335. }));
  9336. Object.defineProperty(exports, "DefaultXfaLayerFactory", ({
  9337. enumerable: true,
  9338. get: function get() {
  9339. return _default_factory.DefaultXfaLayerFactory;
  9340. }
  9341. }));
  9342. Object.defineProperty(exports, "DownloadManager", ({
  9343. enumerable: true,
  9344. get: function get() {
  9345. return _download_manager.DownloadManager;
  9346. }
  9347. }));
  9348. Object.defineProperty(exports, "EventBus", ({
  9349. enumerable: true,
  9350. get: function get() {
  9351. return _event_utils.EventBus;
  9352. }
  9353. }));
  9354. Object.defineProperty(exports, "GenericL10n", ({
  9355. enumerable: true,
  9356. get: function get() {
  9357. return _genericl10n.GenericL10n;
  9358. }
  9359. }));
  9360. Object.defineProperty(exports, "LinkTarget", ({
  9361. enumerable: true,
  9362. get: function get() {
  9363. return _pdf_link_service.LinkTarget;
  9364. }
  9365. }));
  9366. Object.defineProperty(exports, "NullL10n", ({
  9367. enumerable: true,
  9368. get: function get() {
  9369. return _l10n_utils.NullL10n;
  9370. }
  9371. }));
  9372. Object.defineProperty(exports, "PDFFindController", ({
  9373. enumerable: true,
  9374. get: function get() {
  9375. return _pdf_find_controller.PDFFindController;
  9376. }
  9377. }));
  9378. Object.defineProperty(exports, "PDFHistory", ({
  9379. enumerable: true,
  9380. get: function get() {
  9381. return _pdf_history.PDFHistory;
  9382. }
  9383. }));
  9384. Object.defineProperty(exports, "PDFLinkService", ({
  9385. enumerable: true,
  9386. get: function get() {
  9387. return _pdf_link_service.PDFLinkService;
  9388. }
  9389. }));
  9390. Object.defineProperty(exports, "PDFPageView", ({
  9391. enumerable: true,
  9392. get: function get() {
  9393. return _pdf_page_view.PDFPageView;
  9394. }
  9395. }));
  9396. Object.defineProperty(exports, "PDFScriptingManager", ({
  9397. enumerable: true,
  9398. get: function get() {
  9399. return _pdf_scripting_manager.PDFScriptingManager;
  9400. }
  9401. }));
  9402. Object.defineProperty(exports, "PDFSinglePageViewer", ({
  9403. enumerable: true,
  9404. get: function get() {
  9405. return _pdf_viewer.PDFSinglePageViewer;
  9406. }
  9407. }));
  9408. Object.defineProperty(exports, "PDFViewer", ({
  9409. enumerable: true,
  9410. get: function get() {
  9411. return _pdf_viewer.PDFViewer;
  9412. }
  9413. }));
  9414. Object.defineProperty(exports, "ProgressBar", ({
  9415. enumerable: true,
  9416. get: function get() {
  9417. return _ui_utils.ProgressBar;
  9418. }
  9419. }));
  9420. Object.defineProperty(exports, "SimpleLinkService", ({
  9421. enumerable: true,
  9422. get: function get() {
  9423. return _pdf_link_service.SimpleLinkService;
  9424. }
  9425. }));
  9426. Object.defineProperty(exports, "StructTreeLayerBuilder", ({
  9427. enumerable: true,
  9428. get: function get() {
  9429. return _struct_tree_layer_builder.StructTreeLayerBuilder;
  9430. }
  9431. }));
  9432. Object.defineProperty(exports, "TextLayerBuilder", ({
  9433. enumerable: true,
  9434. get: function get() {
  9435. return _text_layer_builder.TextLayerBuilder;
  9436. }
  9437. }));
  9438. Object.defineProperty(exports, "XfaLayerBuilder", ({
  9439. enumerable: true,
  9440. get: function get() {
  9441. return _xfa_layer_builder.XfaLayerBuilder;
  9442. }
  9443. }));
  9444. Object.defineProperty(exports, "parseQueryString", ({
  9445. enumerable: true,
  9446. get: function get() {
  9447. return _ui_utils.parseQueryString;
  9448. }
  9449. }));
  9450. var _default_factory = __w_pdfjs_require__(1);
  9451. var _pdf_link_service = __w_pdfjs_require__(7);
  9452. var _ui_utils = __w_pdfjs_require__(8);
  9453. var _pdf_viewer = __w_pdfjs_require__(12);
  9454. var _annotation_layer_builder = __w_pdfjs_require__(2);
  9455. var _download_manager = __w_pdfjs_require__(18);
  9456. var _event_utils = __w_pdfjs_require__(19);
  9457. var _genericl10n = __w_pdfjs_require__(20);
  9458. var _l10n_utils = __w_pdfjs_require__(6);
  9459. var _pdf_find_controller = __w_pdfjs_require__(22);
  9460. var _pdf_history = __w_pdfjs_require__(24);
  9461. var _pdf_page_view = __w_pdfjs_require__(14);
  9462. var _pdf_scripting_manager = __w_pdfjs_require__(25);
  9463. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  9464. var _text_layer_builder = __w_pdfjs_require__(10);
  9465. var _xfa_layer_builder = __w_pdfjs_require__(11);
  9466. var pdfjsVersion = '2.14.305';
  9467. var pdfjsBuild = 'eaaa8b4ad';
  9468. })();
  9469. /******/ return __webpack_exports__;
  9470. /******/ })()
  9471. ;
  9472. });
  9473. //# sourceMappingURL=pdf_viewer.js.map