pdf_viewer.js 363 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2021 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, function() {
  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); 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); 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"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _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 = void 0;
  979. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  980. var _pdfjsLib = __w_pdfjs_require__(5);
  981. var _ui_utils = __w_pdfjs_require__(8);
  982. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": 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 _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  986. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  987. 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); } }
  988. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  989. var PDFLinkService = /*#__PURE__*/function () {
  990. function PDFLinkService() {
  991. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  992. eventBus = _ref.eventBus,
  993. _ref$externalLinkTarg = _ref.externalLinkTarget,
  994. externalLinkTarget = _ref$externalLinkTarg === void 0 ? null : _ref$externalLinkTarg,
  995. _ref$externalLinkRel = _ref.externalLinkRel,
  996. externalLinkRel = _ref$externalLinkRel === void 0 ? null : _ref$externalLinkRel,
  997. _ref$ignoreDestinatio = _ref.ignoreDestinationZoom,
  998. ignoreDestinationZoom = _ref$ignoreDestinatio === void 0 ? false : _ref$ignoreDestinatio;
  999. _classCallCheck(this, PDFLinkService);
  1000. this.eventBus = eventBus;
  1001. this.externalLinkTarget = externalLinkTarget;
  1002. this.externalLinkRel = externalLinkRel;
  1003. this.externalLinkEnabled = true;
  1004. this._ignoreDestinationZoom = ignoreDestinationZoom;
  1005. this.baseUrl = null;
  1006. this.pdfDocument = null;
  1007. this.pdfViewer = null;
  1008. this.pdfHistory = null;
  1009. this._pagesRefCache = null;
  1010. }
  1011. _createClass(PDFLinkService, [{
  1012. key: "setDocument",
  1013. value: function setDocument(pdfDocument) {
  1014. var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1015. this.baseUrl = baseUrl;
  1016. this.pdfDocument = pdfDocument;
  1017. this._pagesRefCache = Object.create(null);
  1018. }
  1019. }, {
  1020. key: "setViewer",
  1021. value: function setViewer(pdfViewer) {
  1022. this.pdfViewer = pdfViewer;
  1023. }
  1024. }, {
  1025. key: "setHistory",
  1026. value: function setHistory(pdfHistory) {
  1027. this.pdfHistory = pdfHistory;
  1028. }
  1029. }, {
  1030. key: "pagesCount",
  1031. get: function get() {
  1032. return this.pdfDocument ? this.pdfDocument.numPages : 0;
  1033. }
  1034. }, {
  1035. key: "page",
  1036. get: function get() {
  1037. return this.pdfViewer.currentPageNumber;
  1038. },
  1039. set: function set(value) {
  1040. this.pdfViewer.currentPageNumber = value;
  1041. }
  1042. }, {
  1043. key: "rotation",
  1044. get: function get() {
  1045. return this.pdfViewer.pagesRotation;
  1046. },
  1047. set: function set(value) {
  1048. this.pdfViewer.pagesRotation = value;
  1049. }
  1050. }, {
  1051. key: "_goToDestinationHelper",
  1052. value: function _goToDestinationHelper(rawDest) {
  1053. var _this = this;
  1054. var namedDest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1055. var explicitDest = arguments.length > 2 ? arguments[2] : undefined;
  1056. var destRef = explicitDest[0];
  1057. var pageNumber;
  1058. if (_typeof(destRef) === "object" && destRef !== null) {
  1059. pageNumber = this._cachedPageNumber(destRef);
  1060. if (!pageNumber) {
  1061. this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
  1062. _this.cachePageRef(pageIndex + 1, destRef);
  1063. _this._goToDestinationHelper(rawDest, namedDest, explicitDest);
  1064. })["catch"](function () {
  1065. console.error("PDFLinkService._goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(rawDest, "\"."));
  1066. });
  1067. return;
  1068. }
  1069. } else if (Number.isInteger(destRef)) {
  1070. pageNumber = destRef + 1;
  1071. } else {
  1072. console.error("PDFLinkService._goToDestinationHelper: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(rawDest, "\"."));
  1073. return;
  1074. }
  1075. if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {
  1076. console.error("PDFLinkService._goToDestinationHelper: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(rawDest, "\"."));
  1077. return;
  1078. }
  1079. if (this.pdfHistory) {
  1080. this.pdfHistory.pushCurrentPosition();
  1081. this.pdfHistory.push({
  1082. namedDest: namedDest,
  1083. explicitDest: explicitDest,
  1084. pageNumber: pageNumber
  1085. });
  1086. }
  1087. this.pdfViewer.scrollPageIntoView({
  1088. pageNumber: pageNumber,
  1089. destArray: explicitDest,
  1090. ignoreDestinationZoom: this._ignoreDestinationZoom
  1091. });
  1092. }
  1093. }, {
  1094. key: "goToDestination",
  1095. value: function () {
  1096. var _goToDestination = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(dest) {
  1097. var namedDest, explicitDest;
  1098. return _regenerator["default"].wrap(function _callee$(_context) {
  1099. while (1) {
  1100. switch (_context.prev = _context.next) {
  1101. case 0:
  1102. if (this.pdfDocument) {
  1103. _context.next = 2;
  1104. break;
  1105. }
  1106. return _context.abrupt("return");
  1107. case 2:
  1108. if (!(typeof dest === "string")) {
  1109. _context.next = 9;
  1110. break;
  1111. }
  1112. namedDest = dest;
  1113. _context.next = 6;
  1114. return this.pdfDocument.getDestination(dest);
  1115. case 6:
  1116. explicitDest = _context.sent;
  1117. _context.next = 13;
  1118. break;
  1119. case 9:
  1120. namedDest = null;
  1121. _context.next = 12;
  1122. return dest;
  1123. case 12:
  1124. explicitDest = _context.sent;
  1125. case 13:
  1126. if (Array.isArray(explicitDest)) {
  1127. _context.next = 16;
  1128. break;
  1129. }
  1130. console.error("PDFLinkService.goToDestination: \"".concat(explicitDest, "\" is not ") + "a valid destination array, for dest=\"".concat(dest, "\"."));
  1131. return _context.abrupt("return");
  1132. case 16:
  1133. this._goToDestinationHelper(dest, namedDest, explicitDest);
  1134. case 17:
  1135. case "end":
  1136. return _context.stop();
  1137. }
  1138. }
  1139. }, _callee, this);
  1140. }));
  1141. function goToDestination(_x) {
  1142. return _goToDestination.apply(this, arguments);
  1143. }
  1144. return goToDestination;
  1145. }()
  1146. }, {
  1147. key: "goToPage",
  1148. value: function goToPage(val) {
  1149. if (!this.pdfDocument) {
  1150. return;
  1151. }
  1152. var pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0;
  1153. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  1154. console.error("PDFLinkService.goToPage: \"".concat(val, "\" is not a valid page."));
  1155. return;
  1156. }
  1157. if (this.pdfHistory) {
  1158. this.pdfHistory.pushCurrentPosition();
  1159. this.pdfHistory.pushPage(pageNumber);
  1160. }
  1161. this.pdfViewer.scrollPageIntoView({
  1162. pageNumber: pageNumber
  1163. });
  1164. }
  1165. }, {
  1166. key: "addLinkAttributes",
  1167. value: function addLinkAttributes(link, url) {
  1168. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1169. (0, _pdfjsLib.addLinkAttributes)(link, {
  1170. url: url,
  1171. target: newWindow ? _pdfjsLib.LinkTarget.BLANK : this.externalLinkTarget,
  1172. rel: this.externalLinkRel,
  1173. enabled: this.externalLinkEnabled
  1174. });
  1175. }
  1176. }, {
  1177. key: "getDestinationHash",
  1178. value: function getDestinationHash(dest) {
  1179. if (typeof dest === "string") {
  1180. if (dest.length > 0) {
  1181. return this.getAnchorUrl("#" + escape(dest));
  1182. }
  1183. } else if (Array.isArray(dest)) {
  1184. var str = JSON.stringify(dest);
  1185. if (str.length > 0) {
  1186. return this.getAnchorUrl("#" + escape(str));
  1187. }
  1188. }
  1189. return this.getAnchorUrl("");
  1190. }
  1191. }, {
  1192. key: "getAnchorUrl",
  1193. value: function getAnchorUrl(anchor) {
  1194. return (this.baseUrl || "") + anchor;
  1195. }
  1196. }, {
  1197. key: "setHash",
  1198. value: function setHash(hash) {
  1199. if (!this.pdfDocument) {
  1200. return;
  1201. }
  1202. var pageNumber, dest;
  1203. if (hash.includes("=")) {
  1204. var params = (0, _ui_utils.parseQueryString)(hash);
  1205. if (params.has("search")) {
  1206. this.eventBus.dispatch("findfromurlhash", {
  1207. source: this,
  1208. query: params.get("search").replace(/"/g, ""),
  1209. phraseSearch: params.get("phrase") === "true"
  1210. });
  1211. }
  1212. if (params.has("page")) {
  1213. pageNumber = params.get("page") | 0 || 1;
  1214. }
  1215. if (params.has("zoom")) {
  1216. var zoomArgs = params.get("zoom").split(",");
  1217. var zoomArg = zoomArgs[0];
  1218. var zoomArgNumber = parseFloat(zoomArg);
  1219. if (!zoomArg.includes("Fit")) {
  1220. dest = [null, {
  1221. name: "XYZ"
  1222. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
  1223. } else {
  1224. if (zoomArg === "Fit" || zoomArg === "FitB") {
  1225. dest = [null, {
  1226. name: zoomArg
  1227. }];
  1228. } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") {
  1229. dest = [null, {
  1230. name: zoomArg
  1231. }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
  1232. } else if (zoomArg === "FitR") {
  1233. if (zoomArgs.length !== 5) {
  1234. console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
  1235. } else {
  1236. dest = [null, {
  1237. name: zoomArg
  1238. }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
  1239. }
  1240. } else {
  1241. console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not ") + "a valid zoom value.");
  1242. }
  1243. }
  1244. }
  1245. if (dest) {
  1246. this.pdfViewer.scrollPageIntoView({
  1247. pageNumber: pageNumber || this.page,
  1248. destArray: dest,
  1249. allowNegativeOffset: true
  1250. });
  1251. } else if (pageNumber) {
  1252. this.page = pageNumber;
  1253. }
  1254. if (params.has("pagemode")) {
  1255. this.eventBus.dispatch("pagemode", {
  1256. source: this,
  1257. mode: params.get("pagemode")
  1258. });
  1259. }
  1260. if (params.has("nameddest")) {
  1261. this.goToDestination(params.get("nameddest"));
  1262. }
  1263. } else {
  1264. dest = unescape(hash);
  1265. try {
  1266. dest = JSON.parse(dest);
  1267. if (!Array.isArray(dest)) {
  1268. dest = dest.toString();
  1269. }
  1270. } catch (ex) {}
  1271. if (typeof dest === "string" || isValidExplicitDestination(dest)) {
  1272. this.goToDestination(dest);
  1273. return;
  1274. }
  1275. console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not ") + "a valid destination.");
  1276. }
  1277. }
  1278. }, {
  1279. key: "executeNamedAction",
  1280. value: function executeNamedAction(action) {
  1281. var _this$pdfHistory, _this$pdfHistory2;
  1282. switch (action) {
  1283. case "GoBack":
  1284. (_this$pdfHistory = this.pdfHistory) === null || _this$pdfHistory === void 0 ? void 0 : _this$pdfHistory.back();
  1285. break;
  1286. case "GoForward":
  1287. (_this$pdfHistory2 = this.pdfHistory) === null || _this$pdfHistory2 === void 0 ? void 0 : _this$pdfHistory2.forward();
  1288. break;
  1289. case "NextPage":
  1290. this.pdfViewer.nextPage();
  1291. break;
  1292. case "PrevPage":
  1293. this.pdfViewer.previousPage();
  1294. break;
  1295. case "LastPage":
  1296. this.page = this.pagesCount;
  1297. break;
  1298. case "FirstPage":
  1299. this.page = 1;
  1300. break;
  1301. default:
  1302. break;
  1303. }
  1304. this.eventBus.dispatch("namedaction", {
  1305. source: this,
  1306. action: action
  1307. });
  1308. }
  1309. }, {
  1310. key: "cachePageRef",
  1311. value: function cachePageRef(pageNum, pageRef) {
  1312. if (!pageRef) {
  1313. return;
  1314. }
  1315. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1316. this._pagesRefCache[refStr] = pageNum;
  1317. }
  1318. }, {
  1319. key: "_cachedPageNumber",
  1320. value: function _cachedPageNumber(pageRef) {
  1321. var _this$_pagesRefCache;
  1322. if (!pageRef) {
  1323. return null;
  1324. }
  1325. var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
  1326. return ((_this$_pagesRefCache = this._pagesRefCache) === null || _this$_pagesRefCache === void 0 ? void 0 : _this$_pagesRefCache[refStr]) || null;
  1327. }
  1328. }, {
  1329. key: "isPageVisible",
  1330. value: function isPageVisible(pageNumber) {
  1331. return this.pdfViewer.isPageVisible(pageNumber);
  1332. }
  1333. }, {
  1334. key: "isPageCached",
  1335. value: function isPageCached(pageNumber) {
  1336. return this.pdfViewer.isPageCached(pageNumber);
  1337. }
  1338. }]);
  1339. return PDFLinkService;
  1340. }();
  1341. exports.PDFLinkService = PDFLinkService;
  1342. function isValidExplicitDestination(dest) {
  1343. if (!Array.isArray(dest)) {
  1344. return false;
  1345. }
  1346. var destLength = dest.length;
  1347. if (destLength < 2) {
  1348. return false;
  1349. }
  1350. var page = dest[0];
  1351. if (!(_typeof(page) === "object" && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
  1352. return false;
  1353. }
  1354. var zoom = dest[1];
  1355. if (!(_typeof(zoom) === "object" && typeof zoom.name === "string")) {
  1356. return false;
  1357. }
  1358. var allowNull = true;
  1359. switch (zoom.name) {
  1360. case "XYZ":
  1361. if (destLength !== 5) {
  1362. return false;
  1363. }
  1364. break;
  1365. case "Fit":
  1366. case "FitB":
  1367. return destLength === 2;
  1368. case "FitH":
  1369. case "FitBH":
  1370. case "FitV":
  1371. case "FitBV":
  1372. if (destLength !== 3) {
  1373. return false;
  1374. }
  1375. break;
  1376. case "FitR":
  1377. if (destLength !== 6) {
  1378. return false;
  1379. }
  1380. allowNull = false;
  1381. break;
  1382. default:
  1383. return false;
  1384. }
  1385. for (var i = 2; i < destLength; i++) {
  1386. var param = dest[i];
  1387. if (!(typeof param === "number" || allowNull && param === null)) {
  1388. return false;
  1389. }
  1390. }
  1391. return true;
  1392. }
  1393. var SimpleLinkService = /*#__PURE__*/function () {
  1394. function SimpleLinkService() {
  1395. _classCallCheck(this, SimpleLinkService);
  1396. this.externalLinkEnabled = true;
  1397. }
  1398. _createClass(SimpleLinkService, [{
  1399. key: "pagesCount",
  1400. get: function get() {
  1401. return 0;
  1402. }
  1403. }, {
  1404. key: "page",
  1405. get: function get() {
  1406. return 0;
  1407. },
  1408. set: function set(value) {}
  1409. }, {
  1410. key: "rotation",
  1411. get: function get() {
  1412. return 0;
  1413. },
  1414. set: function set(value) {}
  1415. }, {
  1416. key: "goToDestination",
  1417. value: function () {
  1418. var _goToDestination2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(dest) {
  1419. return _regenerator["default"].wrap(function _callee2$(_context2) {
  1420. while (1) {
  1421. switch (_context2.prev = _context2.next) {
  1422. case 0:
  1423. case "end":
  1424. return _context2.stop();
  1425. }
  1426. }
  1427. }, _callee2);
  1428. }));
  1429. function goToDestination(_x2) {
  1430. return _goToDestination2.apply(this, arguments);
  1431. }
  1432. return goToDestination;
  1433. }()
  1434. }, {
  1435. key: "goToPage",
  1436. value: function goToPage(val) {}
  1437. }, {
  1438. key: "addLinkAttributes",
  1439. value: function addLinkAttributes(link, url) {
  1440. var newWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1441. (0, _pdfjsLib.addLinkAttributes)(link, {
  1442. url: url,
  1443. enabled: this.externalLinkEnabled
  1444. });
  1445. }
  1446. }, {
  1447. key: "getDestinationHash",
  1448. value: function getDestinationHash(dest) {
  1449. return "#";
  1450. }
  1451. }, {
  1452. key: "getAnchorUrl",
  1453. value: function getAnchorUrl(hash) {
  1454. return "#";
  1455. }
  1456. }, {
  1457. key: "setHash",
  1458. value: function setHash(hash) {}
  1459. }, {
  1460. key: "executeNamedAction",
  1461. value: function executeNamedAction(action) {}
  1462. }, {
  1463. key: "cachePageRef",
  1464. value: function cachePageRef(pageNum, pageRef) {}
  1465. }, {
  1466. key: "isPageVisible",
  1467. value: function isPageVisible(pageNumber) {
  1468. return true;
  1469. }
  1470. }, {
  1471. key: "isPageCached",
  1472. value: function isPageCached(pageNumber) {
  1473. return true;
  1474. }
  1475. }]);
  1476. return SimpleLinkService;
  1477. }();
  1478. exports.SimpleLinkService = SimpleLinkService;
  1479. /***/ }),
  1480. /* 8 */
  1481. /***/ ((__unused_webpack_module, exports) => {
  1482. Object.defineProperty(exports, "__esModule", ({
  1483. value: true
  1484. }));
  1485. 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.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = void 0;
  1486. exports.apiPageLayoutToViewerModes = apiPageLayoutToViewerModes;
  1487. exports.apiPageModeToSidebarView = apiPageModeToSidebarView;
  1488. exports.approximateFraction = approximateFraction;
  1489. exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements;
  1490. exports.binarySearchFirstItem = binarySearchFirstItem;
  1491. exports.getActiveOrFocusedElement = getActiveOrFocusedElement;
  1492. exports.getOutputScale = getOutputScale;
  1493. exports.getPageSizeInches = getPageSizeInches;
  1494. exports.getVisibleElements = getVisibleElements;
  1495. exports.isPortraitOrientation = isPortraitOrientation;
  1496. exports.isValidRotation = isValidRotation;
  1497. exports.isValidScrollMode = isValidScrollMode;
  1498. exports.isValidSpreadMode = isValidSpreadMode;
  1499. exports.noContextMenuHandler = noContextMenuHandler;
  1500. exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
  1501. exports.normalizeWheelEventDirection = normalizeWheelEventDirection;
  1502. exports.parseQueryString = parseQueryString;
  1503. exports.roundToDivide = roundToDivide;
  1504. exports.scrollIntoView = scrollIntoView;
  1505. exports.watchScroll = watchScroll;
  1506. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1507. 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); } }
  1508. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  1509. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  1510. 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."); }
  1511. 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; }
  1512. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  1513. 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; } } }; }
  1514. 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); }
  1515. 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; }
  1516. var DEFAULT_SCALE_VALUE = "auto";
  1517. exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
  1518. var DEFAULT_SCALE = 1.0;
  1519. exports.DEFAULT_SCALE = DEFAULT_SCALE;
  1520. var DEFAULT_SCALE_DELTA = 1.1;
  1521. exports.DEFAULT_SCALE_DELTA = DEFAULT_SCALE_DELTA;
  1522. var MIN_SCALE = 0.1;
  1523. exports.MIN_SCALE = MIN_SCALE;
  1524. var MAX_SCALE = 10.0;
  1525. exports.MAX_SCALE = MAX_SCALE;
  1526. var UNKNOWN_SCALE = 0;
  1527. exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
  1528. var MAX_AUTO_SCALE = 1.25;
  1529. exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
  1530. var SCROLLBAR_PADDING = 40;
  1531. exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
  1532. var VERTICAL_PADDING = 5;
  1533. exports.VERTICAL_PADDING = VERTICAL_PADDING;
  1534. var LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset";
  1535. var RenderingStates = {
  1536. INITIAL: 0,
  1537. RUNNING: 1,
  1538. PAUSED: 2,
  1539. FINISHED: 3
  1540. };
  1541. exports.RenderingStates = RenderingStates;
  1542. var PresentationModeState = {
  1543. UNKNOWN: 0,
  1544. NORMAL: 1,
  1545. CHANGING: 2,
  1546. FULLSCREEN: 3
  1547. };
  1548. exports.PresentationModeState = PresentationModeState;
  1549. var SidebarView = {
  1550. UNKNOWN: -1,
  1551. NONE: 0,
  1552. THUMBS: 1,
  1553. OUTLINE: 2,
  1554. ATTACHMENTS: 3,
  1555. LAYERS: 4
  1556. };
  1557. exports.SidebarView = SidebarView;
  1558. var RendererType = {
  1559. CANVAS: "canvas",
  1560. SVG: "svg"
  1561. };
  1562. exports.RendererType = RendererType;
  1563. var TextLayerMode = {
  1564. DISABLE: 0,
  1565. ENABLE: 1,
  1566. ENABLE_ENHANCE: 2
  1567. };
  1568. exports.TextLayerMode = TextLayerMode;
  1569. var ScrollMode = {
  1570. UNKNOWN: -1,
  1571. VERTICAL: 0,
  1572. HORIZONTAL: 1,
  1573. WRAPPED: 2,
  1574. PAGE: 3
  1575. };
  1576. exports.ScrollMode = ScrollMode;
  1577. var SpreadMode = {
  1578. UNKNOWN: -1,
  1579. NONE: 0,
  1580. ODD: 1,
  1581. EVEN: 2
  1582. };
  1583. exports.SpreadMode = SpreadMode;
  1584. var AutoPrintRegExp = /\bprint\s*\(/;
  1585. exports.AutoPrintRegExp = AutoPrintRegExp;
  1586. function getOutputScale(ctx) {
  1587. var devicePixelRatio = window.devicePixelRatio || 1;
  1588. var backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
  1589. var pixelRatio = devicePixelRatio / backingStoreRatio;
  1590. return {
  1591. sx: pixelRatio,
  1592. sy: pixelRatio,
  1593. scaled: pixelRatio !== 1
  1594. };
  1595. }
  1596. function scrollIntoView(element, spot) {
  1597. var scrollMatches = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1598. var parent = element.offsetParent;
  1599. if (!parent) {
  1600. console.error("offsetParent is not set -- cannot scroll");
  1601. return;
  1602. }
  1603. var offsetY = element.offsetTop + element.clientTop;
  1604. var offsetX = element.offsetLeft + element.clientLeft;
  1605. while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) {
  1606. offsetY += parent.offsetTop;
  1607. offsetX += parent.offsetLeft;
  1608. parent = parent.offsetParent;
  1609. if (!parent) {
  1610. return;
  1611. }
  1612. }
  1613. if (spot) {
  1614. if (spot.top !== undefined) {
  1615. offsetY += spot.top;
  1616. }
  1617. if (spot.left !== undefined) {
  1618. offsetX += spot.left;
  1619. parent.scrollLeft = offsetX;
  1620. }
  1621. }
  1622. parent.scrollTop = offsetY;
  1623. }
  1624. function watchScroll(viewAreaElement, callback) {
  1625. var debounceScroll = function debounceScroll(evt) {
  1626. if (rAF) {
  1627. return;
  1628. }
  1629. rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
  1630. rAF = null;
  1631. var currentX = viewAreaElement.scrollLeft;
  1632. var lastX = state.lastX;
  1633. if (currentX !== lastX) {
  1634. state.right = currentX > lastX;
  1635. }
  1636. state.lastX = currentX;
  1637. var currentY = viewAreaElement.scrollTop;
  1638. var lastY = state.lastY;
  1639. if (currentY !== lastY) {
  1640. state.down = currentY > lastY;
  1641. }
  1642. state.lastY = currentY;
  1643. callback(state);
  1644. });
  1645. };
  1646. var state = {
  1647. right: true,
  1648. down: true,
  1649. lastX: viewAreaElement.scrollLeft,
  1650. lastY: viewAreaElement.scrollTop,
  1651. _eventHandler: debounceScroll
  1652. };
  1653. var rAF = null;
  1654. viewAreaElement.addEventListener("scroll", debounceScroll, true);
  1655. return state;
  1656. }
  1657. function parseQueryString(query) {
  1658. var params = new Map();
  1659. var _iterator = _createForOfIteratorHelper(new URLSearchParams(query)),
  1660. _step;
  1661. try {
  1662. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  1663. var _step$value = _slicedToArray(_step.value, 2),
  1664. key = _step$value[0],
  1665. value = _step$value[1];
  1666. params.set(key.toLowerCase(), value);
  1667. }
  1668. } catch (err) {
  1669. _iterator.e(err);
  1670. } finally {
  1671. _iterator.f();
  1672. }
  1673. return params;
  1674. }
  1675. function binarySearchFirstItem(items, condition) {
  1676. var minIndex = 0;
  1677. var maxIndex = items.length - 1;
  1678. if (maxIndex < 0 || !condition(items[maxIndex])) {
  1679. return items.length;
  1680. }
  1681. if (condition(items[minIndex])) {
  1682. return minIndex;
  1683. }
  1684. while (minIndex < maxIndex) {
  1685. var currentIndex = minIndex + maxIndex >> 1;
  1686. var currentItem = items[currentIndex];
  1687. if (condition(currentItem)) {
  1688. maxIndex = currentIndex;
  1689. } else {
  1690. minIndex = currentIndex + 1;
  1691. }
  1692. }
  1693. return minIndex;
  1694. }
  1695. function approximateFraction(x) {
  1696. if (Math.floor(x) === x) {
  1697. return [x, 1];
  1698. }
  1699. var xinv = 1 / x;
  1700. var limit = 8;
  1701. if (xinv > limit) {
  1702. return [1, limit];
  1703. } else if (Math.floor(xinv) === xinv) {
  1704. return [1, xinv];
  1705. }
  1706. var x_ = x > 1 ? xinv : x;
  1707. var a = 0,
  1708. b = 1,
  1709. c = 1,
  1710. d = 1;
  1711. while (true) {
  1712. var p = a + c,
  1713. q = b + d;
  1714. if (q > limit) {
  1715. break;
  1716. }
  1717. if (x_ <= p / q) {
  1718. c = p;
  1719. d = q;
  1720. } else {
  1721. a = p;
  1722. b = q;
  1723. }
  1724. }
  1725. var result;
  1726. if (x_ - a / b < c / d - x_) {
  1727. result = x_ === x ? [a, b] : [b, a];
  1728. } else {
  1729. result = x_ === x ? [c, d] : [d, c];
  1730. }
  1731. return result;
  1732. }
  1733. function roundToDivide(x, div) {
  1734. var r = x % div;
  1735. return r === 0 ? x : Math.round(x - r + div);
  1736. }
  1737. function getPageSizeInches(_ref) {
  1738. var view = _ref.view,
  1739. userUnit = _ref.userUnit,
  1740. rotate = _ref.rotate;
  1741. var _view = _slicedToArray(view, 4),
  1742. x1 = _view[0],
  1743. y1 = _view[1],
  1744. x2 = _view[2],
  1745. y2 = _view[3];
  1746. var changeOrientation = rotate % 180 !== 0;
  1747. var width = (x2 - x1) / 72 * userUnit;
  1748. var height = (y2 - y1) / 72 * userUnit;
  1749. return {
  1750. width: changeOrientation ? height : width,
  1751. height: changeOrientation ? width : height
  1752. };
  1753. }
  1754. function backtrackBeforeAllVisibleElements(index, views, top) {
  1755. if (index < 2) {
  1756. return index;
  1757. }
  1758. var elt = views[index].div;
  1759. var pageTop = elt.offsetTop + elt.clientTop;
  1760. if (pageTop >= top) {
  1761. elt = views[index - 1].div;
  1762. pageTop = elt.offsetTop + elt.clientTop;
  1763. }
  1764. for (var i = index - 2; i >= 0; --i) {
  1765. elt = views[i].div;
  1766. if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {
  1767. break;
  1768. }
  1769. index = i;
  1770. }
  1771. return index;
  1772. }
  1773. function getVisibleElements(_ref2) {
  1774. var scrollEl = _ref2.scrollEl,
  1775. views = _ref2.views,
  1776. _ref2$sortByVisibilit = _ref2.sortByVisibility,
  1777. sortByVisibility = _ref2$sortByVisibilit === void 0 ? false : _ref2$sortByVisibilit,
  1778. _ref2$horizontal = _ref2.horizontal,
  1779. horizontal = _ref2$horizontal === void 0 ? false : _ref2$horizontal,
  1780. _ref2$rtl = _ref2.rtl,
  1781. rtl = _ref2$rtl === void 0 ? false : _ref2$rtl;
  1782. var top = scrollEl.scrollTop,
  1783. bottom = top + scrollEl.clientHeight;
  1784. var left = scrollEl.scrollLeft,
  1785. right = left + scrollEl.clientWidth;
  1786. function isElementBottomAfterViewTop(view) {
  1787. var element = view.div;
  1788. var elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
  1789. return elementBottom > top;
  1790. }
  1791. function isElementNextAfterViewHorizontally(view) {
  1792. var element = view.div;
  1793. var elementLeft = element.offsetLeft + element.clientLeft;
  1794. var elementRight = elementLeft + element.clientWidth;
  1795. return rtl ? elementLeft < right : elementRight > left;
  1796. }
  1797. var visible = [],
  1798. ids = new Set(),
  1799. numViews = views.length;
  1800. var firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop);
  1801. if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) {
  1802. firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top);
  1803. }
  1804. var lastEdge = horizontal ? right : -1;
  1805. for (var i = firstVisibleElementInd; i < numViews; i++) {
  1806. var view = views[i],
  1807. element = view.div;
  1808. var currentWidth = element.offsetLeft + element.clientLeft;
  1809. var currentHeight = element.offsetTop + element.clientTop;
  1810. var viewWidth = element.clientWidth,
  1811. viewHeight = element.clientHeight;
  1812. var viewRight = currentWidth + viewWidth;
  1813. var viewBottom = currentHeight + viewHeight;
  1814. if (lastEdge === -1) {
  1815. if (viewBottom >= bottom) {
  1816. lastEdge = viewBottom;
  1817. }
  1818. } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {
  1819. break;
  1820. }
  1821. if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) {
  1822. continue;
  1823. }
  1824. var hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);
  1825. var hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);
  1826. var fractionHeight = (viewHeight - hiddenHeight) / viewHeight,
  1827. fractionWidth = (viewWidth - hiddenWidth) / viewWidth;
  1828. var percent = fractionHeight * fractionWidth * 100 | 0;
  1829. visible.push({
  1830. id: view.id,
  1831. x: currentWidth,
  1832. y: currentHeight,
  1833. view: view,
  1834. percent: percent,
  1835. widthPercent: fractionWidth * 100 | 0
  1836. });
  1837. ids.add(view.id);
  1838. }
  1839. var first = visible[0],
  1840. last = visible[visible.length - 1];
  1841. if (sortByVisibility) {
  1842. visible.sort(function (a, b) {
  1843. var pc = a.percent - b.percent;
  1844. if (Math.abs(pc) > 0.001) {
  1845. return -pc;
  1846. }
  1847. return a.id - b.id;
  1848. });
  1849. }
  1850. return {
  1851. first: first,
  1852. last: last,
  1853. views: visible,
  1854. ids: ids
  1855. };
  1856. }
  1857. function noContextMenuHandler(evt) {
  1858. evt.preventDefault();
  1859. }
  1860. function normalizeWheelEventDirection(evt) {
  1861. var delta = Math.hypot(evt.deltaX, evt.deltaY);
  1862. var angle = Math.atan2(evt.deltaY, evt.deltaX);
  1863. if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
  1864. delta = -delta;
  1865. }
  1866. return delta;
  1867. }
  1868. function normalizeWheelEventDelta(evt) {
  1869. var delta = normalizeWheelEventDirection(evt);
  1870. var MOUSE_DOM_DELTA_PIXEL_MODE = 0;
  1871. var MOUSE_DOM_DELTA_LINE_MODE = 1;
  1872. var MOUSE_PIXELS_PER_LINE = 30;
  1873. var MOUSE_LINES_PER_PAGE = 30;
  1874. if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
  1875. delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
  1876. } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
  1877. delta /= MOUSE_LINES_PER_PAGE;
  1878. }
  1879. return delta;
  1880. }
  1881. function isValidRotation(angle) {
  1882. return Number.isInteger(angle) && angle % 90 === 0;
  1883. }
  1884. function isValidScrollMode(mode) {
  1885. return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN;
  1886. }
  1887. function isValidSpreadMode(mode) {
  1888. return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN;
  1889. }
  1890. function isPortraitOrientation(size) {
  1891. return size.width <= size.height;
  1892. }
  1893. var animationStarted = new Promise(function (resolve) {
  1894. window.requestAnimationFrame(resolve);
  1895. });
  1896. exports.animationStarted = animationStarted;
  1897. function clamp(v, min, max) {
  1898. return Math.min(Math.max(v, min), max);
  1899. }
  1900. var ProgressBar = /*#__PURE__*/function () {
  1901. function ProgressBar(id) {
  1902. var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  1903. height = _ref3.height,
  1904. width = _ref3.width,
  1905. units = _ref3.units;
  1906. _classCallCheck(this, ProgressBar);
  1907. this.visible = true;
  1908. this.div = document.querySelector(id + " .progress");
  1909. this.bar = this.div.parentNode;
  1910. this.height = height || 100;
  1911. this.width = width || 100;
  1912. this.units = units || "%";
  1913. this.div.style.height = this.height + this.units;
  1914. this.percent = 0;
  1915. }
  1916. _createClass(ProgressBar, [{
  1917. key: "_updateBar",
  1918. value: function _updateBar() {
  1919. if (this._indeterminate) {
  1920. this.div.classList.add("indeterminate");
  1921. this.div.style.width = this.width + this.units;
  1922. return;
  1923. }
  1924. this.div.classList.remove("indeterminate");
  1925. var progressSize = this.width * this._percent / 100;
  1926. this.div.style.width = progressSize + this.units;
  1927. }
  1928. }, {
  1929. key: "percent",
  1930. get: function get() {
  1931. return this._percent;
  1932. },
  1933. set: function set(val) {
  1934. this._indeterminate = isNaN(val);
  1935. this._percent = clamp(val, 0, 100);
  1936. this._updateBar();
  1937. }
  1938. }, {
  1939. key: "setWidth",
  1940. value: function setWidth(viewer) {
  1941. if (!viewer) {
  1942. return;
  1943. }
  1944. var container = viewer.parentNode;
  1945. var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
  1946. if (scrollbarWidth > 0) {
  1947. var doc = document.documentElement;
  1948. doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, "".concat(scrollbarWidth, "px"));
  1949. }
  1950. }
  1951. }, {
  1952. key: "hide",
  1953. value: function hide() {
  1954. if (!this.visible) {
  1955. return;
  1956. }
  1957. this.visible = false;
  1958. this.bar.classList.add("hidden");
  1959. }
  1960. }, {
  1961. key: "show",
  1962. value: function show() {
  1963. if (this.visible) {
  1964. return;
  1965. }
  1966. this.visible = true;
  1967. this.bar.classList.remove("hidden");
  1968. }
  1969. }]);
  1970. return ProgressBar;
  1971. }();
  1972. exports.ProgressBar = ProgressBar;
  1973. function getActiveOrFocusedElement() {
  1974. var curRoot = document;
  1975. var curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  1976. while ((_curActiveOrFocused = curActiveOrFocused) !== null && _curActiveOrFocused !== void 0 && _curActiveOrFocused.shadowRoot) {
  1977. var _curActiveOrFocused;
  1978. curRoot = curActiveOrFocused.shadowRoot;
  1979. curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus");
  1980. }
  1981. return curActiveOrFocused;
  1982. }
  1983. function apiPageLayoutToViewerModes(layout) {
  1984. var scrollMode = ScrollMode.VERTICAL,
  1985. spreadMode = SpreadMode.NONE;
  1986. switch (layout) {
  1987. case "SinglePage":
  1988. scrollMode = ScrollMode.PAGE;
  1989. break;
  1990. case "OneColumn":
  1991. break;
  1992. case "TwoPageLeft":
  1993. scrollMode = ScrollMode.PAGE;
  1994. case "TwoColumnLeft":
  1995. spreadMode = SpreadMode.ODD;
  1996. break;
  1997. case "TwoPageRight":
  1998. scrollMode = ScrollMode.PAGE;
  1999. case "TwoColumnRight":
  2000. spreadMode = SpreadMode.EVEN;
  2001. break;
  2002. }
  2003. return {
  2004. scrollMode: scrollMode,
  2005. spreadMode: spreadMode
  2006. };
  2007. }
  2008. function apiPageModeToSidebarView(mode) {
  2009. switch (mode) {
  2010. case "UseNone":
  2011. return SidebarView.NONE;
  2012. case "UseThumbs":
  2013. return SidebarView.THUMBS;
  2014. case "UseOutlines":
  2015. return SidebarView.OUTLINE;
  2016. case "UseAttachments":
  2017. return SidebarView.ATTACHMENTS;
  2018. case "UseOC":
  2019. return SidebarView.LAYERS;
  2020. }
  2021. return SidebarView.NONE;
  2022. }
  2023. /***/ }),
  2024. /* 9 */
  2025. /***/ ((__unused_webpack_module, exports) => {
  2026. Object.defineProperty(exports, "__esModule", ({
  2027. value: true
  2028. }));
  2029. exports.StructTreeLayerBuilder = void 0;
  2030. 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; } } }; }
  2031. 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); }
  2032. 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; }
  2033. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2034. 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); } }
  2035. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2036. var PDF_ROLE_TO_HTML_ROLE = {
  2037. Document: null,
  2038. DocumentFragment: null,
  2039. Part: "group",
  2040. Sect: "group",
  2041. Div: "group",
  2042. Aside: "note",
  2043. NonStruct: "none",
  2044. P: null,
  2045. H: "heading",
  2046. Title: null,
  2047. FENote: "note",
  2048. Sub: "group",
  2049. Lbl: null,
  2050. Span: null,
  2051. Em: null,
  2052. Strong: null,
  2053. Link: "link",
  2054. Annot: "note",
  2055. Form: "form",
  2056. Ruby: null,
  2057. RB: null,
  2058. RT: null,
  2059. RP: null,
  2060. Warichu: null,
  2061. WT: null,
  2062. WP: null,
  2063. L: "list",
  2064. LI: "listitem",
  2065. LBody: null,
  2066. Table: "table",
  2067. TR: "row",
  2068. TH: "columnheader",
  2069. TD: "cell",
  2070. THead: "columnheader",
  2071. TBody: null,
  2072. TFoot: null,
  2073. Caption: null,
  2074. Figure: "figure",
  2075. Formula: null,
  2076. Artifact: null
  2077. };
  2078. var HEADING_PATTERN = /^H(\d+)$/;
  2079. var StructTreeLayerBuilder = /*#__PURE__*/function () {
  2080. function StructTreeLayerBuilder(_ref) {
  2081. var pdfPage = _ref.pdfPage;
  2082. _classCallCheck(this, StructTreeLayerBuilder);
  2083. this.pdfPage = pdfPage;
  2084. }
  2085. _createClass(StructTreeLayerBuilder, [{
  2086. key: "render",
  2087. value: function render(structTree) {
  2088. return this._walk(structTree);
  2089. }
  2090. }, {
  2091. key: "_setAttributes",
  2092. value: function _setAttributes(structElement, htmlElement) {
  2093. if (structElement.alt !== undefined) {
  2094. htmlElement.setAttribute("aria-label", structElement.alt);
  2095. }
  2096. if (structElement.id !== undefined) {
  2097. htmlElement.setAttribute("aria-owns", structElement.id);
  2098. }
  2099. if (structElement.lang !== undefined) {
  2100. htmlElement.setAttribute("lang", structElement.lang);
  2101. }
  2102. }
  2103. }, {
  2104. key: "_walk",
  2105. value: function _walk(node) {
  2106. if (!node) {
  2107. return null;
  2108. }
  2109. var element = document.createElement("span");
  2110. if ("role" in node) {
  2111. var role = node.role;
  2112. var match = role.match(HEADING_PATTERN);
  2113. if (match) {
  2114. element.setAttribute("role", "heading");
  2115. element.setAttribute("aria-level", match[1]);
  2116. } else if (PDF_ROLE_TO_HTML_ROLE[role]) {
  2117. element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
  2118. }
  2119. }
  2120. this._setAttributes(node, element);
  2121. if (node.children) {
  2122. if (node.children.length === 1 && "id" in node.children[0]) {
  2123. this._setAttributes(node.children[0], element);
  2124. } else {
  2125. var _iterator = _createForOfIteratorHelper(node.children),
  2126. _step;
  2127. try {
  2128. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2129. var kid = _step.value;
  2130. element.appendChild(this._walk(kid));
  2131. }
  2132. } catch (err) {
  2133. _iterator.e(err);
  2134. } finally {
  2135. _iterator.f();
  2136. }
  2137. }
  2138. }
  2139. return element;
  2140. }
  2141. }]);
  2142. return StructTreeLayerBuilder;
  2143. }();
  2144. exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
  2145. /***/ }),
  2146. /* 10 */
  2147. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2148. Object.defineProperty(exports, "__esModule", ({
  2149. value: true
  2150. }));
  2151. exports.TextLayerBuilder = void 0;
  2152. var _pdfjsLib = __w_pdfjs_require__(5);
  2153. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2154. 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); } }
  2155. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2156. var EXPAND_DIVS_TIMEOUT = 300;
  2157. var TextLayerBuilder = /*#__PURE__*/function () {
  2158. function TextLayerBuilder(_ref) {
  2159. var textLayerDiv = _ref.textLayerDiv,
  2160. eventBus = _ref.eventBus,
  2161. pageIndex = _ref.pageIndex,
  2162. viewport = _ref.viewport,
  2163. _ref$highlighter = _ref.highlighter,
  2164. highlighter = _ref$highlighter === void 0 ? null : _ref$highlighter,
  2165. _ref$enhanceTextSelec = _ref.enhanceTextSelection,
  2166. enhanceTextSelection = _ref$enhanceTextSelec === void 0 ? false : _ref$enhanceTextSelec;
  2167. _classCallCheck(this, TextLayerBuilder);
  2168. this.textLayerDiv = textLayerDiv;
  2169. this.eventBus = eventBus;
  2170. this.textContent = null;
  2171. this.textContentItemsStr = [];
  2172. this.textContentStream = null;
  2173. this.renderingDone = false;
  2174. this.pageNumber = pageIndex + 1;
  2175. this.viewport = viewport;
  2176. this.textDivs = [];
  2177. this.textLayerRenderTask = null;
  2178. this.highlighter = highlighter;
  2179. this.enhanceTextSelection = enhanceTextSelection;
  2180. this._bindMouse();
  2181. }
  2182. _createClass(TextLayerBuilder, [{
  2183. key: "_finishRendering",
  2184. value: function _finishRendering() {
  2185. this.renderingDone = true;
  2186. if (!this.enhanceTextSelection) {
  2187. var endOfContent = document.createElement("div");
  2188. endOfContent.className = "endOfContent";
  2189. this.textLayerDiv.appendChild(endOfContent);
  2190. }
  2191. this.eventBus.dispatch("textlayerrendered", {
  2192. source: this,
  2193. pageNumber: this.pageNumber,
  2194. numTextDivs: this.textDivs.length
  2195. });
  2196. }
  2197. }, {
  2198. key: "render",
  2199. value: function render() {
  2200. var _this$highlighter,
  2201. _this = this;
  2202. var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  2203. if (!(this.textContent || this.textContentStream) || this.renderingDone) {
  2204. return;
  2205. }
  2206. this.cancel();
  2207. this.textDivs.length = 0;
  2208. (_this$highlighter = this.highlighter) === null || _this$highlighter === void 0 ? void 0 : _this$highlighter.setTextMapping(this.textDivs, this.textContentItemsStr);
  2209. var textLayerFrag = document.createDocumentFragment();
  2210. this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
  2211. textContent: this.textContent,
  2212. textContentStream: this.textContentStream,
  2213. container: textLayerFrag,
  2214. viewport: this.viewport,
  2215. textDivs: this.textDivs,
  2216. textContentItemsStr: this.textContentItemsStr,
  2217. timeout: timeout,
  2218. enhanceTextSelection: this.enhanceTextSelection
  2219. });
  2220. this.textLayerRenderTask.promise.then(function () {
  2221. var _this$highlighter2;
  2222. _this.textLayerDiv.appendChild(textLayerFrag);
  2223. _this._finishRendering();
  2224. (_this$highlighter2 = _this.highlighter) === null || _this$highlighter2 === void 0 ? void 0 : _this$highlighter2.enable();
  2225. }, function (reason) {});
  2226. }
  2227. }, {
  2228. key: "cancel",
  2229. value: function cancel() {
  2230. var _this$highlighter3;
  2231. if (this.textLayerRenderTask) {
  2232. this.textLayerRenderTask.cancel();
  2233. this.textLayerRenderTask = null;
  2234. }
  2235. (_this$highlighter3 = this.highlighter) === null || _this$highlighter3 === void 0 ? void 0 : _this$highlighter3.disable();
  2236. }
  2237. }, {
  2238. key: "setTextContentStream",
  2239. value: function setTextContentStream(readableStream) {
  2240. this.cancel();
  2241. this.textContentStream = readableStream;
  2242. }
  2243. }, {
  2244. key: "setTextContent",
  2245. value: function setTextContent(textContent) {
  2246. this.cancel();
  2247. this.textContent = textContent;
  2248. }
  2249. }, {
  2250. key: "_bindMouse",
  2251. value: function _bindMouse() {
  2252. var _this2 = this;
  2253. var div = this.textLayerDiv;
  2254. var expandDivsTimer = null;
  2255. div.addEventListener("mousedown", function (evt) {
  2256. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2257. _this2.textLayerRenderTask.expandTextDivs(true);
  2258. if (expandDivsTimer) {
  2259. clearTimeout(expandDivsTimer);
  2260. expandDivsTimer = null;
  2261. }
  2262. return;
  2263. }
  2264. var end = div.querySelector(".endOfContent");
  2265. if (!end) {
  2266. return;
  2267. }
  2268. var adjustTop = evt.target !== div;
  2269. adjustTop = adjustTop && window.getComputedStyle(end).getPropertyValue("-moz-user-select") !== "none";
  2270. if (adjustTop) {
  2271. var divBounds = div.getBoundingClientRect();
  2272. var r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);
  2273. end.style.top = (r * 100).toFixed(2) + "%";
  2274. }
  2275. end.classList.add("active");
  2276. });
  2277. div.addEventListener("mouseup", function () {
  2278. if (_this2.enhanceTextSelection && _this2.textLayerRenderTask) {
  2279. expandDivsTimer = setTimeout(function () {
  2280. if (_this2.textLayerRenderTask) {
  2281. _this2.textLayerRenderTask.expandTextDivs(false);
  2282. }
  2283. expandDivsTimer = null;
  2284. }, EXPAND_DIVS_TIMEOUT);
  2285. return;
  2286. }
  2287. var end = div.querySelector(".endOfContent");
  2288. if (!end) {
  2289. return;
  2290. }
  2291. end.style.top = "";
  2292. end.classList.remove("active");
  2293. });
  2294. }
  2295. }]);
  2296. return TextLayerBuilder;
  2297. }();
  2298. exports.TextLayerBuilder = TextLayerBuilder;
  2299. /***/ }),
  2300. /* 11 */
  2301. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2302. Object.defineProperty(exports, "__esModule", ({
  2303. value: true
  2304. }));
  2305. exports.XfaLayerBuilder = void 0;
  2306. var _pdfjsLib = __w_pdfjs_require__(5);
  2307. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2308. 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); } }
  2309. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2310. var XfaLayerBuilder = /*#__PURE__*/function () {
  2311. function XfaLayerBuilder(_ref) {
  2312. var pageDiv = _ref.pageDiv,
  2313. pdfPage = _ref.pdfPage,
  2314. _ref$annotationStorag = _ref.annotationStorage,
  2315. annotationStorage = _ref$annotationStorag === void 0 ? null : _ref$annotationStorag,
  2316. linkService = _ref.linkService,
  2317. _ref$xfaHtml = _ref.xfaHtml,
  2318. xfaHtml = _ref$xfaHtml === void 0 ? null : _ref$xfaHtml;
  2319. _classCallCheck(this, XfaLayerBuilder);
  2320. this.pageDiv = pageDiv;
  2321. this.pdfPage = pdfPage;
  2322. this.annotationStorage = annotationStorage;
  2323. this.linkService = linkService;
  2324. this.xfaHtml = xfaHtml;
  2325. this.div = null;
  2326. this._cancelled = false;
  2327. }
  2328. _createClass(XfaLayerBuilder, [{
  2329. key: "render",
  2330. value: function render(viewport) {
  2331. var _this = this;
  2332. var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "display";
  2333. if (intent === "print") {
  2334. var parameters = {
  2335. viewport: viewport.clone({
  2336. dontFlip: true
  2337. }),
  2338. div: this.div,
  2339. xfaHtml: this.xfaHtml,
  2340. annotationStorage: this.annotationStorage,
  2341. linkService: this.linkService,
  2342. intent: intent
  2343. };
  2344. var div = document.createElement("div");
  2345. this.pageDiv.appendChild(div);
  2346. parameters.div = div;
  2347. var result = _pdfjsLib.XfaLayer.render(parameters);
  2348. return Promise.resolve(result);
  2349. }
  2350. return this.pdfPage.getXfa().then(function (xfaHtml) {
  2351. if (_this._cancelled || !xfaHtml) {
  2352. return {
  2353. textDivs: []
  2354. };
  2355. }
  2356. var parameters = {
  2357. viewport: viewport.clone({
  2358. dontFlip: true
  2359. }),
  2360. div: _this.div,
  2361. xfaHtml: xfaHtml,
  2362. annotationStorage: _this.annotationStorage,
  2363. linkService: _this.linkService,
  2364. intent: intent
  2365. };
  2366. if (_this.div) {
  2367. return _pdfjsLib.XfaLayer.update(parameters);
  2368. }
  2369. _this.div = document.createElement("div");
  2370. _this.pageDiv.appendChild(_this.div);
  2371. parameters.div = _this.div;
  2372. return _pdfjsLib.XfaLayer.render(parameters);
  2373. })["catch"](function (error) {
  2374. console.error(error);
  2375. });
  2376. }
  2377. }, {
  2378. key: "cancel",
  2379. value: function cancel() {
  2380. this._cancelled = true;
  2381. }
  2382. }, {
  2383. key: "hide",
  2384. value: function hide() {
  2385. if (!this.div) {
  2386. return;
  2387. }
  2388. this.div.hidden = true;
  2389. }
  2390. }]);
  2391. return XfaLayerBuilder;
  2392. }();
  2393. exports.XfaLayerBuilder = XfaLayerBuilder;
  2394. /***/ }),
  2395. /* 12 */
  2396. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2397. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2398. Object.defineProperty(exports, "__esModule", ({
  2399. value: true
  2400. }));
  2401. exports.PDFViewer = exports.PDFSinglePageViewer = void 0;
  2402. var _ui_utils = __w_pdfjs_require__(8);
  2403. var _base_viewer = __w_pdfjs_require__(13);
  2404. 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); } }
  2405. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2406. function _get(target, property, receiver) { 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(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  2407. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  2408. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2409. 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  2410. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  2411. 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); }; }
  2412. 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); }
  2413. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  2414. 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; } }
  2415. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  2416. var PDFViewer = /*#__PURE__*/function (_BaseViewer) {
  2417. _inherits(PDFViewer, _BaseViewer);
  2418. var _super = _createSuper(PDFViewer);
  2419. function PDFViewer() {
  2420. _classCallCheck(this, PDFViewer);
  2421. return _super.apply(this, arguments);
  2422. }
  2423. return PDFViewer;
  2424. }(_base_viewer.BaseViewer);
  2425. exports.PDFViewer = PDFViewer;
  2426. var PDFSinglePageViewer = /*#__PURE__*/function (_BaseViewer2) {
  2427. _inherits(PDFSinglePageViewer, _BaseViewer2);
  2428. var _super2 = _createSuper(PDFSinglePageViewer);
  2429. function PDFSinglePageViewer() {
  2430. _classCallCheck(this, PDFSinglePageViewer);
  2431. return _super2.apply(this, arguments);
  2432. }
  2433. _createClass(PDFSinglePageViewer, [{
  2434. key: "_resetView",
  2435. value: function _resetView() {
  2436. _get(_getPrototypeOf(PDFSinglePageViewer.prototype), "_resetView", this).call(this);
  2437. this._scrollMode = _ui_utils.ScrollMode.PAGE;
  2438. this._spreadMode = _ui_utils.SpreadMode.NONE;
  2439. }
  2440. }, {
  2441. key: "scrollMode",
  2442. set: function set(mode) {}
  2443. }, {
  2444. key: "_updateScrollMode",
  2445. value: function _updateScrollMode() {}
  2446. }, {
  2447. key: "spreadMode",
  2448. set: function set(mode) {}
  2449. }, {
  2450. key: "_updateSpreadMode",
  2451. value: function _updateSpreadMode() {}
  2452. }]);
  2453. return PDFSinglePageViewer;
  2454. }(_base_viewer.BaseViewer);
  2455. exports.PDFSinglePageViewer = PDFSinglePageViewer;
  2456. /***/ }),
  2457. /* 13 */
  2458. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2459. Object.defineProperty(exports, "__esModule", ({
  2460. value: true
  2461. }));
  2462. exports.PagesCountLimit = exports.PDFPageViewBuffer = exports.BaseViewer = void 0;
  2463. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  2464. var _pdfjsLib = __w_pdfjs_require__(5);
  2465. var _ui_utils = __w_pdfjs_require__(8);
  2466. var _annotation_layer_builder = __w_pdfjs_require__(2);
  2467. var _l10n_utils = __w_pdfjs_require__(6);
  2468. var _pdf_page_view = __w_pdfjs_require__(14);
  2469. var _pdf_rendering_queue = __w_pdfjs_require__(16);
  2470. var _pdf_link_service = __w_pdfjs_require__(7);
  2471. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  2472. var _text_highlighter = __w_pdfjs_require__(17);
  2473. var _text_layer_builder = __w_pdfjs_require__(10);
  2474. var _xfa_layer_builder = __w_pdfjs_require__(11);
  2475. var _Symbol$iterator;
  2476. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2477. 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); } }
  2478. 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); }); }; }
  2479. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  2480. 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."); }
  2481. 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; }
  2482. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  2483. 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; } } }; }
  2484. 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); }
  2485. 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; }
  2486. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2487. 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); } }
  2488. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2489. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  2490. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  2491. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  2492. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  2493. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  2494. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  2495. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  2496. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  2497. 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; } }
  2498. var DEFAULT_CACHE_SIZE = 10;
  2499. var ENABLE_PERMISSIONS_CLASS = "enablePermissions";
  2500. var PagesCountLimit = {
  2501. FORCE_SCROLL_MODE_PAGE: 15000,
  2502. FORCE_LAZY_PAGE_INIT: 7500,
  2503. PAUSE_EAGER_PAGE_INIT: 500
  2504. };
  2505. exports.PagesCountLimit = PagesCountLimit;
  2506. var _buf = /*#__PURE__*/new WeakMap();
  2507. var _size = /*#__PURE__*/new WeakMap();
  2508. var _destroyFirstView = /*#__PURE__*/new WeakSet();
  2509. _Symbol$iterator = Symbol.iterator;
  2510. var PDFPageViewBuffer = /*#__PURE__*/function (_Symbol$iterator2) {
  2511. function PDFPageViewBuffer(size) {
  2512. _classCallCheck(this, PDFPageViewBuffer);
  2513. _classPrivateMethodInitSpec(this, _destroyFirstView);
  2514. _classPrivateFieldInitSpec(this, _buf, {
  2515. writable: true,
  2516. value: new Set()
  2517. });
  2518. _classPrivateFieldInitSpec(this, _size, {
  2519. writable: true,
  2520. value: 0
  2521. });
  2522. _classPrivateFieldSet(this, _size, size);
  2523. }
  2524. _createClass(PDFPageViewBuffer, [{
  2525. key: "push",
  2526. value: function push(view) {
  2527. var buf = _classPrivateFieldGet(this, _buf);
  2528. if (buf.has(view)) {
  2529. buf["delete"](view);
  2530. }
  2531. buf.add(view);
  2532. if (buf.size > _classPrivateFieldGet(this, _size)) {
  2533. _classPrivateMethodGet(this, _destroyFirstView, _destroyFirstView2).call(this);
  2534. }
  2535. }
  2536. }, {
  2537. key: "resize",
  2538. value: function resize(newSize) {
  2539. var idsToKeep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  2540. _classPrivateFieldSet(this, _size, newSize);
  2541. var buf = _classPrivateFieldGet(this, _buf);
  2542. if (idsToKeep) {
  2543. var ii = buf.size;
  2544. var i = 1;
  2545. var _iterator = _createForOfIteratorHelper(buf),
  2546. _step;
  2547. try {
  2548. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  2549. var view = _step.value;
  2550. if (idsToKeep.has(view.id)) {
  2551. buf["delete"](view);
  2552. buf.add(view);
  2553. }
  2554. if (++i > ii) {
  2555. break;
  2556. }
  2557. }
  2558. } catch (err) {
  2559. _iterator.e(err);
  2560. } finally {
  2561. _iterator.f();
  2562. }
  2563. }
  2564. while (buf.size > _classPrivateFieldGet(this, _size)) {
  2565. _classPrivateMethodGet(this, _destroyFirstView, _destroyFirstView2).call(this);
  2566. }
  2567. }
  2568. }, {
  2569. key: "has",
  2570. value: function has(view) {
  2571. return _classPrivateFieldGet(this, _buf).has(view);
  2572. }
  2573. }, {
  2574. key: _Symbol$iterator2,
  2575. value: function value() {
  2576. return _classPrivateFieldGet(this, _buf).keys();
  2577. }
  2578. }]);
  2579. return PDFPageViewBuffer;
  2580. }(_Symbol$iterator);
  2581. exports.PDFPageViewBuffer = PDFPageViewBuffer;
  2582. function _destroyFirstView2() {
  2583. var firstView = _classPrivateFieldGet(this, _buf).keys().next().value;
  2584. firstView === null || firstView === void 0 ? void 0 : firstView.destroy();
  2585. _classPrivateFieldGet(this, _buf)["delete"](firstView);
  2586. }
  2587. var _buffer = /*#__PURE__*/new WeakMap();
  2588. var _annotationMode = /*#__PURE__*/new WeakMap();
  2589. var _previousAnnotationMode = /*#__PURE__*/new WeakMap();
  2590. var _enablePermissions = /*#__PURE__*/new WeakMap();
  2591. var _previousContainerHeight = /*#__PURE__*/new WeakMap();
  2592. var _scrollModePageState = /*#__PURE__*/new WeakMap();
  2593. var _initializePermissions = /*#__PURE__*/new WeakSet();
  2594. var _onePageRenderedOrForceFetch = /*#__PURE__*/new WeakSet();
  2595. var _ensurePageViewVisible = /*#__PURE__*/new WeakSet();
  2596. var _isSameScale = /*#__PURE__*/new WeakSet();
  2597. var _ensurePdfPageLoaded = /*#__PURE__*/new WeakSet();
  2598. var _getScrollAhead = /*#__PURE__*/new WeakSet();
  2599. var _toggleLoadingIconSpinner = /*#__PURE__*/new WeakSet();
  2600. var BaseViewer = /*#__PURE__*/function () {
  2601. function BaseViewer(options) {
  2602. var _this$container,
  2603. _this$viewer,
  2604. _options$textLayerMod,
  2605. _options$annotationMo,
  2606. _this = this;
  2607. _classCallCheck(this, BaseViewer);
  2608. _classPrivateMethodInitSpec(this, _toggleLoadingIconSpinner);
  2609. _classPrivateMethodInitSpec(this, _getScrollAhead);
  2610. _classPrivateMethodInitSpec(this, _ensurePdfPageLoaded);
  2611. _classPrivateMethodInitSpec(this, _isSameScale);
  2612. _classPrivateMethodInitSpec(this, _ensurePageViewVisible);
  2613. _classPrivateMethodInitSpec(this, _onePageRenderedOrForceFetch);
  2614. _classPrivateMethodInitSpec(this, _initializePermissions);
  2615. _classPrivateFieldInitSpec(this, _buffer, {
  2616. writable: true,
  2617. value: null
  2618. });
  2619. _classPrivateFieldInitSpec(this, _annotationMode, {
  2620. writable: true,
  2621. value: _pdfjsLib.AnnotationMode.ENABLE_FORMS
  2622. });
  2623. _classPrivateFieldInitSpec(this, _previousAnnotationMode, {
  2624. writable: true,
  2625. value: null
  2626. });
  2627. _classPrivateFieldInitSpec(this, _enablePermissions, {
  2628. writable: true,
  2629. value: false
  2630. });
  2631. _classPrivateFieldInitSpec(this, _previousContainerHeight, {
  2632. writable: true,
  2633. value: 0
  2634. });
  2635. _classPrivateFieldInitSpec(this, _scrollModePageState, {
  2636. writable: true,
  2637. value: null
  2638. });
  2639. if (this.constructor === BaseViewer) {
  2640. throw new Error("Cannot initialize BaseViewer.");
  2641. }
  2642. var viewerVersion = '2.12.313';
  2643. if (_pdfjsLib.version !== viewerVersion) {
  2644. throw new Error("The API version \"".concat(_pdfjsLib.version, "\" does not match the Viewer version \"").concat(viewerVersion, "\"."));
  2645. }
  2646. this.container = options.container;
  2647. this.viewer = options.viewer || options.container.firstElementChild;
  2648. 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")) {
  2649. throw new Error("Invalid `container` and/or `viewer` option.");
  2650. }
  2651. if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") {
  2652. throw new Error("The `container` must be absolutely positioned.");
  2653. }
  2654. this.eventBus = options.eventBus;
  2655. this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
  2656. this.downloadManager = options.downloadManager || null;
  2657. this.findController = options.findController || null;
  2658. this._scriptingManager = options.scriptingManager || null;
  2659. this.removePageBorders = options.removePageBorders || false;
  2660. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  2661. _classPrivateFieldSet(this, _annotationMode, (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS);
  2662. this.imageResourcesPath = options.imageResourcesPath || "";
  2663. this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
  2664. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  2665. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  2666. this.maxCanvasPixels = options.maxCanvasPixels;
  2667. this.l10n = options.l10n || _l10n_utils.NullL10n;
  2668. _classPrivateFieldSet(this, _enablePermissions, options.enablePermissions || false);
  2669. this.defaultRenderingQueue = !options.renderingQueue;
  2670. if (this.defaultRenderingQueue) {
  2671. this.renderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
  2672. this.renderingQueue.setViewer(this);
  2673. } else {
  2674. this.renderingQueue = options.renderingQueue;
  2675. }
  2676. this._doc = document.documentElement;
  2677. this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this));
  2678. this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
  2679. this._onBeforeDraw = this._onAfterDraw = null;
  2680. this._resetView();
  2681. if (this.removePageBorders) {
  2682. this.viewer.classList.add("removePageBorders");
  2683. }
  2684. Promise.resolve().then(function () {
  2685. _this.eventBus.dispatch("baseviewerinit", {
  2686. source: _this
  2687. });
  2688. });
  2689. }
  2690. _createClass(BaseViewer, [{
  2691. key: "pagesCount",
  2692. get: function get() {
  2693. return this._pages.length;
  2694. }
  2695. }, {
  2696. key: "getPageView",
  2697. value: function getPageView(index) {
  2698. return this._pages[index];
  2699. }
  2700. }, {
  2701. key: "pageViewsReady",
  2702. get: function get() {
  2703. if (!this._pagesCapability.settled) {
  2704. return false;
  2705. }
  2706. return this._pages.every(function (pageView) {
  2707. return pageView === null || pageView === void 0 ? void 0 : pageView.pdfPage;
  2708. });
  2709. }
  2710. }, {
  2711. key: "renderForms",
  2712. get: function get() {
  2713. return _classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS;
  2714. }
  2715. }, {
  2716. key: "enableScripting",
  2717. get: function get() {
  2718. return !!this._scriptingManager;
  2719. }
  2720. }, {
  2721. key: "currentPageNumber",
  2722. get: function get() {
  2723. return this._currentPageNumber;
  2724. },
  2725. set: function set(val) {
  2726. if (!Number.isInteger(val)) {
  2727. throw new Error("Invalid page number.");
  2728. }
  2729. if (!this.pdfDocument) {
  2730. return;
  2731. }
  2732. if (!this._setCurrentPageNumber(val, true)) {
  2733. console.error("currentPageNumber: \"".concat(val, "\" is not a valid page."));
  2734. }
  2735. }
  2736. }, {
  2737. key: "_setCurrentPageNumber",
  2738. value: function _setCurrentPageNumber(val) {
  2739. var _this$_pageLabels, _this$_pageLabels2;
  2740. var resetCurrentPageView = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2741. if (this._currentPageNumber === val) {
  2742. if (resetCurrentPageView) {
  2743. this._resetCurrentPageView();
  2744. }
  2745. return true;
  2746. }
  2747. if (!(0 < val && val <= this.pagesCount)) {
  2748. return false;
  2749. }
  2750. var previous = this._currentPageNumber;
  2751. this._currentPageNumber = val;
  2752. this.eventBus.dispatch("pagechanging", {
  2753. source: this,
  2754. pageNumber: val,
  2755. 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,
  2756. previous: previous
  2757. });
  2758. if (resetCurrentPageView) {
  2759. this._resetCurrentPageView();
  2760. }
  2761. return true;
  2762. }
  2763. }, {
  2764. key: "currentPageLabel",
  2765. get: function get() {
  2766. var _this$_pageLabels3, _this$_pageLabels4;
  2767. 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;
  2768. },
  2769. set: function set(val) {
  2770. if (!this.pdfDocument) {
  2771. return;
  2772. }
  2773. var page = val | 0;
  2774. if (this._pageLabels) {
  2775. var i = this._pageLabels.indexOf(val);
  2776. if (i >= 0) {
  2777. page = i + 1;
  2778. }
  2779. }
  2780. if (!this._setCurrentPageNumber(page, true)) {
  2781. console.error("currentPageLabel: \"".concat(val, "\" is not a valid page."));
  2782. }
  2783. }
  2784. }, {
  2785. key: "currentScale",
  2786. get: function get() {
  2787. return this._currentScale !== _ui_utils.UNKNOWN_SCALE ? this._currentScale : _ui_utils.DEFAULT_SCALE;
  2788. },
  2789. set: function set(val) {
  2790. if (isNaN(val)) {
  2791. throw new Error("Invalid numeric scale.");
  2792. }
  2793. if (!this.pdfDocument) {
  2794. return;
  2795. }
  2796. this._setScale(val, false);
  2797. }
  2798. }, {
  2799. key: "currentScaleValue",
  2800. get: function get() {
  2801. return this._currentScaleValue;
  2802. },
  2803. set: function set(val) {
  2804. if (!this.pdfDocument) {
  2805. return;
  2806. }
  2807. this._setScale(val, false);
  2808. }
  2809. }, {
  2810. key: "pagesRotation",
  2811. get: function get() {
  2812. return this._pagesRotation;
  2813. },
  2814. set: function set(rotation) {
  2815. if (!(0, _ui_utils.isValidRotation)(rotation)) {
  2816. throw new Error("Invalid pages rotation angle.");
  2817. }
  2818. if (!this.pdfDocument) {
  2819. return;
  2820. }
  2821. rotation %= 360;
  2822. if (rotation < 0) {
  2823. rotation += 360;
  2824. }
  2825. if (this._pagesRotation === rotation) {
  2826. return;
  2827. }
  2828. this._pagesRotation = rotation;
  2829. var pageNumber = this._currentPageNumber;
  2830. var updateArgs = {
  2831. rotation: rotation
  2832. };
  2833. var _iterator2 = _createForOfIteratorHelper(this._pages),
  2834. _step2;
  2835. try {
  2836. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  2837. var pageView = _step2.value;
  2838. pageView.update(updateArgs);
  2839. }
  2840. } catch (err) {
  2841. _iterator2.e(err);
  2842. } finally {
  2843. _iterator2.f();
  2844. }
  2845. if (this._currentScaleValue) {
  2846. this._setScale(this._currentScaleValue, true);
  2847. }
  2848. this.eventBus.dispatch("rotationchanging", {
  2849. source: this,
  2850. pagesRotation: rotation,
  2851. pageNumber: pageNumber
  2852. });
  2853. if (this.defaultRenderingQueue) {
  2854. this.update();
  2855. }
  2856. }
  2857. }, {
  2858. key: "firstPagePromise",
  2859. get: function get() {
  2860. return this.pdfDocument ? this._firstPageCapability.promise : null;
  2861. }
  2862. }, {
  2863. key: "onePageRendered",
  2864. get: function get() {
  2865. return this.pdfDocument ? this._onePageRenderedCapability.promise : null;
  2866. }
  2867. }, {
  2868. key: "pagesPromise",
  2869. get: function get() {
  2870. return this.pdfDocument ? this._pagesCapability.promise : null;
  2871. }
  2872. }, {
  2873. key: "setDocument",
  2874. value: function setDocument(pdfDocument) {
  2875. var _this2 = this;
  2876. if (this.pdfDocument) {
  2877. this.eventBus.dispatch("pagesdestroy", {
  2878. source: this
  2879. });
  2880. this._cancelRendering();
  2881. this._resetView();
  2882. if (this.findController) {
  2883. this.findController.setDocument(null);
  2884. }
  2885. if (this._scriptingManager) {
  2886. this._scriptingManager.setDocument(null);
  2887. }
  2888. }
  2889. this.pdfDocument = pdfDocument;
  2890. if (!pdfDocument) {
  2891. return;
  2892. }
  2893. var isPureXfa = pdfDocument.isPureXfa;
  2894. var pagesCount = pdfDocument.numPages;
  2895. var firstPagePromise = pdfDocument.getPage(1);
  2896. var optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();
  2897. var permissionsPromise = _classPrivateFieldGet(this, _enablePermissions) ? pdfDocument.getPermissions() : Promise.resolve();
  2898. if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
  2899. console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");
  2900. var mode = this._scrollMode = _ui_utils.ScrollMode.PAGE;
  2901. this.eventBus.dispatch("scrollmodechanged", {
  2902. source: this,
  2903. mode: mode
  2904. });
  2905. }
  2906. this._pagesCapability.promise.then(function () {
  2907. _this2.eventBus.dispatch("pagesloaded", {
  2908. source: _this2,
  2909. pagesCount: pagesCount
  2910. });
  2911. }, function () {});
  2912. this._onBeforeDraw = function (evt) {
  2913. var pageView = _this2._pages[evt.pageNumber - 1];
  2914. if (!pageView) {
  2915. return;
  2916. }
  2917. _classPrivateFieldGet(_this2, _buffer).push(pageView);
  2918. };
  2919. this.eventBus._on("pagerender", this._onBeforeDraw);
  2920. this._onAfterDraw = function (evt) {
  2921. if (evt.cssTransform || _this2._onePageRenderedCapability.settled) {
  2922. return;
  2923. }
  2924. _this2._onePageRenderedCapability.resolve({
  2925. timestamp: evt.timestamp
  2926. });
  2927. _this2.eventBus._off("pagerendered", _this2._onAfterDraw);
  2928. _this2._onAfterDraw = null;
  2929. };
  2930. this.eventBus._on("pagerendered", this._onAfterDraw);
  2931. Promise.all([firstPagePromise, permissionsPromise]).then(function (_ref) {
  2932. var _ref2 = _slicedToArray(_ref, 2),
  2933. firstPdfPage = _ref2[0],
  2934. permissions = _ref2[1];
  2935. if (pdfDocument !== _this2.pdfDocument) {
  2936. return;
  2937. }
  2938. _this2._firstPageCapability.resolve(firstPdfPage);
  2939. _this2._optionalContentConfigPromise = optionalContentConfigPromise;
  2940. _classPrivateMethodGet(_this2, _initializePermissions, _initializePermissions2).call(_this2, permissions);
  2941. var viewerElement = _this2._scrollMode === _ui_utils.ScrollMode.PAGE ? null : _this2.viewer;
  2942. var scale = _this2.currentScale;
  2943. var viewport = firstPdfPage.getViewport({
  2944. scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  2945. });
  2946. var textLayerFactory = _this2.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? _this2 : null;
  2947. var annotationLayerFactory = _classPrivateFieldGet(_this2, _annotationMode) !== _pdfjsLib.AnnotationMode.DISABLE ? _this2 : null;
  2948. var xfaLayerFactory = isPureXfa ? _this2 : null;
  2949. for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
  2950. var pageView = new _pdf_page_view.PDFPageView({
  2951. container: viewerElement,
  2952. eventBus: _this2.eventBus,
  2953. id: pageNum,
  2954. scale: scale,
  2955. defaultViewport: viewport.clone(),
  2956. optionalContentConfigPromise: optionalContentConfigPromise,
  2957. renderingQueue: _this2.renderingQueue,
  2958. textLayerFactory: textLayerFactory,
  2959. textLayerMode: _this2.textLayerMode,
  2960. annotationLayerFactory: annotationLayerFactory,
  2961. annotationMode: _classPrivateFieldGet(_this2, _annotationMode),
  2962. xfaLayerFactory: xfaLayerFactory,
  2963. textHighlighterFactory: _this2,
  2964. structTreeLayerFactory: _this2,
  2965. imageResourcesPath: _this2.imageResourcesPath,
  2966. renderer: _this2.renderer,
  2967. useOnlyCssZoom: _this2.useOnlyCssZoom,
  2968. maxCanvasPixels: _this2.maxCanvasPixels,
  2969. l10n: _this2.l10n
  2970. });
  2971. _this2._pages.push(pageView);
  2972. }
  2973. var firstPageView = _this2._pages[0];
  2974. if (firstPageView) {
  2975. firstPageView.setPdfPage(firstPdfPage);
  2976. _this2.linkService.cachePageRef(1, firstPdfPage.ref);
  2977. }
  2978. if (_this2._scrollMode === _ui_utils.ScrollMode.PAGE) {
  2979. _classPrivateMethodGet(_this2, _ensurePageViewVisible, _ensurePageViewVisible2).call(_this2);
  2980. } else if (_this2._spreadMode !== _ui_utils.SpreadMode.NONE) {
  2981. _this2._updateSpreadMode();
  2982. }
  2983. _classPrivateMethodGet(_this2, _onePageRenderedOrForceFetch, _onePageRenderedOrForceFetch2).call(_this2).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  2984. var getPagesLeft, _loop, _pageNum;
  2985. return _regenerator["default"].wrap(function _callee$(_context2) {
  2986. while (1) {
  2987. switch (_context2.prev = _context2.next) {
  2988. case 0:
  2989. if (_this2.findController) {
  2990. _this2.findController.setDocument(pdfDocument);
  2991. }
  2992. if (_this2._scriptingManager) {
  2993. _this2._scriptingManager.setDocument(pdfDocument);
  2994. }
  2995. if (!(pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT)) {
  2996. _context2.next = 5;
  2997. break;
  2998. }
  2999. _this2._pagesCapability.resolve();
  3000. return _context2.abrupt("return");
  3001. case 5:
  3002. getPagesLeft = pagesCount - 1;
  3003. if (!(getPagesLeft <= 0)) {
  3004. _context2.next = 9;
  3005. break;
  3006. }
  3007. _this2._pagesCapability.resolve();
  3008. return _context2.abrupt("return");
  3009. case 9:
  3010. _loop = /*#__PURE__*/_regenerator["default"].mark(function _loop(_pageNum) {
  3011. var promise;
  3012. return _regenerator["default"].wrap(function _loop$(_context) {
  3013. while (1) {
  3014. switch (_context.prev = _context.next) {
  3015. case 0:
  3016. promise = pdfDocument.getPage(_pageNum).then(function (pdfPage) {
  3017. var pageView = _this2._pages[_pageNum - 1];
  3018. if (!pageView.pdfPage) {
  3019. pageView.setPdfPage(pdfPage);
  3020. }
  3021. _this2.linkService.cachePageRef(_pageNum, pdfPage.ref);
  3022. if (--getPagesLeft === 0) {
  3023. _this2._pagesCapability.resolve();
  3024. }
  3025. }, function (reason) {
  3026. console.error("Unable to get page ".concat(_pageNum, " to initialize viewer"), reason);
  3027. if (--getPagesLeft === 0) {
  3028. _this2._pagesCapability.resolve();
  3029. }
  3030. });
  3031. if (!(_pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0)) {
  3032. _context.next = 4;
  3033. break;
  3034. }
  3035. _context.next = 4;
  3036. return promise;
  3037. case 4:
  3038. case "end":
  3039. return _context.stop();
  3040. }
  3041. }
  3042. }, _loop);
  3043. });
  3044. _pageNum = 2;
  3045. case 11:
  3046. if (!(_pageNum <= pagesCount)) {
  3047. _context2.next = 16;
  3048. break;
  3049. }
  3050. return _context2.delegateYield(_loop(_pageNum), "t0", 13);
  3051. case 13:
  3052. ++_pageNum;
  3053. _context2.next = 11;
  3054. break;
  3055. case 16:
  3056. case "end":
  3057. return _context2.stop();
  3058. }
  3059. }
  3060. }, _callee);
  3061. })));
  3062. _this2.eventBus.dispatch("pagesinit", {
  3063. source: _this2
  3064. });
  3065. pdfDocument.getMetadata().then(function (_ref4) {
  3066. var info = _ref4.info;
  3067. if (pdfDocument !== _this2.pdfDocument) {
  3068. return;
  3069. }
  3070. if (info.Language) {
  3071. _this2.viewer.lang = info.Language;
  3072. }
  3073. });
  3074. if (_this2.defaultRenderingQueue) {
  3075. _this2.update();
  3076. }
  3077. })["catch"](function (reason) {
  3078. console.error("Unable to initialize viewer", reason);
  3079. _this2._pagesCapability.reject(reason);
  3080. });
  3081. }
  3082. }, {
  3083. key: "setPageLabels",
  3084. value: function setPageLabels(labels) {
  3085. if (!this.pdfDocument) {
  3086. return;
  3087. }
  3088. if (!labels) {
  3089. this._pageLabels = null;
  3090. } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
  3091. this._pageLabels = null;
  3092. console.error("setPageLabels: Invalid page labels.");
  3093. } else {
  3094. this._pageLabels = labels;
  3095. }
  3096. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3097. var _this$_pageLabels$i, _this$_pageLabels5;
  3098. 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);
  3099. }
  3100. }
  3101. }, {
  3102. key: "_resetView",
  3103. value: function _resetView() {
  3104. this._pages = [];
  3105. this._currentPageNumber = 1;
  3106. this._currentScale = _ui_utils.UNKNOWN_SCALE;
  3107. this._currentScaleValue = null;
  3108. this._pageLabels = null;
  3109. _classPrivateFieldSet(this, _buffer, new PDFPageViewBuffer(DEFAULT_CACHE_SIZE));
  3110. this._location = null;
  3111. this._pagesRotation = 0;
  3112. this._optionalContentConfigPromise = null;
  3113. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  3114. this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)();
  3115. this._pagesCapability = (0, _pdfjsLib.createPromiseCapability)();
  3116. this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
  3117. this._previousScrollMode = _ui_utils.ScrollMode.UNKNOWN;
  3118. this._spreadMode = _ui_utils.SpreadMode.NONE;
  3119. _classPrivateFieldSet(this, _scrollModePageState, {
  3120. previousPageNumber: 1,
  3121. scrollDown: true,
  3122. pages: []
  3123. });
  3124. if (this._onBeforeDraw) {
  3125. this.eventBus._off("pagerender", this._onBeforeDraw);
  3126. this._onBeforeDraw = null;
  3127. }
  3128. if (this._onAfterDraw) {
  3129. this.eventBus._off("pagerendered", this._onAfterDraw);
  3130. this._onAfterDraw = null;
  3131. }
  3132. this.viewer.textContent = "";
  3133. this._updateScrollMode();
  3134. this.viewer.removeAttribute("lang");
  3135. this.viewer.classList.remove(ENABLE_PERMISSIONS_CLASS);
  3136. if (_classPrivateFieldGet(this, _previousAnnotationMode) !== null) {
  3137. _classPrivateFieldSet(this, _annotationMode, _classPrivateFieldGet(this, _previousAnnotationMode));
  3138. _classPrivateFieldSet(this, _previousAnnotationMode, null);
  3139. }
  3140. }
  3141. }, {
  3142. key: "_scrollUpdate",
  3143. value: function _scrollUpdate() {
  3144. if (this.pagesCount === 0) {
  3145. return;
  3146. }
  3147. this.update();
  3148. }
  3149. }, {
  3150. key: "_scrollIntoView",
  3151. value: function _scrollIntoView(_ref5) {
  3152. var pageDiv = _ref5.pageDiv,
  3153. _ref5$pageSpot = _ref5.pageSpot,
  3154. pageSpot = _ref5$pageSpot === void 0 ? null : _ref5$pageSpot,
  3155. _ref5$pageNumber = _ref5.pageNumber,
  3156. pageNumber = _ref5$pageNumber === void 0 ? null : _ref5$pageNumber;
  3157. if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3158. if (pageNumber) {
  3159. this._setCurrentPageNumber(pageNumber);
  3160. }
  3161. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3162. this.update();
  3163. }
  3164. if (!pageSpot && !this.isInPresentationMode) {
  3165. var left = pageDiv.offsetLeft + pageDiv.clientLeft;
  3166. var right = left + pageDiv.clientWidth;
  3167. var _this$container2 = this.container,
  3168. scrollLeft = _this$container2.scrollLeft,
  3169. clientWidth = _this$container2.clientWidth;
  3170. if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) {
  3171. pageSpot = {
  3172. left: 0,
  3173. top: 0
  3174. };
  3175. }
  3176. }
  3177. (0, _ui_utils.scrollIntoView)(pageDiv, pageSpot);
  3178. }
  3179. }, {
  3180. key: "_setScaleUpdatePages",
  3181. value: function _setScaleUpdatePages(newScale, newValue) {
  3182. var noScroll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3183. var preset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3184. this._currentScaleValue = newValue.toString();
  3185. if (_classPrivateMethodGet(this, _isSameScale, _isSameScale2).call(this, newScale)) {
  3186. if (preset) {
  3187. this.eventBus.dispatch("scalechanging", {
  3188. source: this,
  3189. scale: newScale,
  3190. presetValue: newValue
  3191. });
  3192. }
  3193. return;
  3194. }
  3195. this._doc.style.setProperty("--zoom-factor", newScale);
  3196. this._doc.style.setProperty("--viewport-scale-factor", newScale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS);
  3197. var updateArgs = {
  3198. scale: newScale
  3199. };
  3200. var _iterator3 = _createForOfIteratorHelper(this._pages),
  3201. _step3;
  3202. try {
  3203. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  3204. var pageView = _step3.value;
  3205. pageView.update(updateArgs);
  3206. }
  3207. } catch (err) {
  3208. _iterator3.e(err);
  3209. } finally {
  3210. _iterator3.f();
  3211. }
  3212. this._currentScale = newScale;
  3213. if (!noScroll) {
  3214. var page = this._currentPageNumber,
  3215. dest;
  3216. if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) {
  3217. page = this._location.pageNumber;
  3218. dest = [null, {
  3219. name: "XYZ"
  3220. }, this._location.left, this._location.top, null];
  3221. }
  3222. this.scrollPageIntoView({
  3223. pageNumber: page,
  3224. destArray: dest,
  3225. allowNegativeOffset: true
  3226. });
  3227. }
  3228. this.eventBus.dispatch("scalechanging", {
  3229. source: this,
  3230. scale: newScale,
  3231. presetValue: preset ? newValue : undefined
  3232. });
  3233. if (this.defaultRenderingQueue) {
  3234. this.update();
  3235. }
  3236. _classPrivateFieldSet(this, _previousContainerHeight, this.container.clientHeight);
  3237. }
  3238. }, {
  3239. key: "_pageWidthScaleFactor",
  3240. get: function get() {
  3241. if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL) {
  3242. return 2;
  3243. }
  3244. return 1;
  3245. }
  3246. }, {
  3247. key: "_setScale",
  3248. value: function _setScale(value) {
  3249. var noScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3250. var scale = parseFloat(value);
  3251. if (scale > 0) {
  3252. this._setScaleUpdatePages(scale, value, noScroll, false);
  3253. } else {
  3254. var currentPage = this._pages[this._currentPageNumber - 1];
  3255. if (!currentPage) {
  3256. return;
  3257. }
  3258. var hPadding = _ui_utils.SCROLLBAR_PADDING,
  3259. vPadding = _ui_utils.VERTICAL_PADDING;
  3260. if (this.isInPresentationMode) {
  3261. hPadding = vPadding = 4;
  3262. } else if (this.removePageBorders) {
  3263. hPadding = vPadding = 0;
  3264. }
  3265. if (this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL) {
  3266. var _ref6 = [vPadding, hPadding];
  3267. hPadding = _ref6[0];
  3268. vPadding = _ref6[1];
  3269. }
  3270. var pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this._pageWidthScaleFactor;
  3271. var pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale;
  3272. switch (value) {
  3273. case "page-actual":
  3274. scale = 1;
  3275. break;
  3276. case "page-width":
  3277. scale = pageWidthScale;
  3278. break;
  3279. case "page-height":
  3280. scale = pageHeightScale;
  3281. break;
  3282. case "page-fit":
  3283. scale = Math.min(pageWidthScale, pageHeightScale);
  3284. break;
  3285. case "auto":
  3286. var horizontalScale = (0, _ui_utils.isPortraitOrientation)(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale);
  3287. scale = Math.min(_ui_utils.MAX_AUTO_SCALE, horizontalScale);
  3288. break;
  3289. default:
  3290. console.error("_setScale: \"".concat(value, "\" is an unknown zoom value."));
  3291. return;
  3292. }
  3293. this._setScaleUpdatePages(scale, value, noScroll, true);
  3294. }
  3295. }
  3296. }, {
  3297. key: "_resetCurrentPageView",
  3298. value: function _resetCurrentPageView() {
  3299. if (this.isInPresentationMode) {
  3300. this._setScale(this._currentScaleValue, true);
  3301. }
  3302. var pageView = this._pages[this._currentPageNumber - 1];
  3303. this._scrollIntoView({
  3304. pageDiv: pageView.div
  3305. });
  3306. }
  3307. }, {
  3308. key: "pageLabelToPageNumber",
  3309. value: function pageLabelToPageNumber(label) {
  3310. if (!this._pageLabels) {
  3311. return null;
  3312. }
  3313. var i = this._pageLabels.indexOf(label);
  3314. if (i < 0) {
  3315. return null;
  3316. }
  3317. return i + 1;
  3318. }
  3319. }, {
  3320. key: "scrollPageIntoView",
  3321. value: function scrollPageIntoView(_ref7) {
  3322. var pageNumber = _ref7.pageNumber,
  3323. _ref7$destArray = _ref7.destArray,
  3324. destArray = _ref7$destArray === void 0 ? null : _ref7$destArray,
  3325. _ref7$allowNegativeOf = _ref7.allowNegativeOffset,
  3326. allowNegativeOffset = _ref7$allowNegativeOf === void 0 ? false : _ref7$allowNegativeOf,
  3327. _ref7$ignoreDestinati = _ref7.ignoreDestinationZoom,
  3328. ignoreDestinationZoom = _ref7$ignoreDestinati === void 0 ? false : _ref7$ignoreDestinati;
  3329. if (!this.pdfDocument) {
  3330. return;
  3331. }
  3332. var pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
  3333. if (!pageView) {
  3334. console.error("scrollPageIntoView: \"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  3335. return;
  3336. }
  3337. if (this.isInPresentationMode || !destArray) {
  3338. this._setCurrentPageNumber(pageNumber, true);
  3339. return;
  3340. }
  3341. var x = 0,
  3342. y = 0;
  3343. var width = 0,
  3344. height = 0,
  3345. widthScale,
  3346. heightScale;
  3347. var changeOrientation = pageView.rotation % 180 !== 0;
  3348. var pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3349. var pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3350. var scale = 0;
  3351. switch (destArray[1].name) {
  3352. case "XYZ":
  3353. x = destArray[2];
  3354. y = destArray[3];
  3355. scale = destArray[4];
  3356. x = x !== null ? x : 0;
  3357. y = y !== null ? y : pageHeight;
  3358. break;
  3359. case "Fit":
  3360. case "FitB":
  3361. scale = "page-fit";
  3362. break;
  3363. case "FitH":
  3364. case "FitBH":
  3365. y = destArray[2];
  3366. scale = "page-width";
  3367. if (y === null && this._location) {
  3368. x = this._location.left;
  3369. y = this._location.top;
  3370. } else if (typeof y !== "number" || y < 0) {
  3371. y = pageHeight;
  3372. }
  3373. break;
  3374. case "FitV":
  3375. case "FitBV":
  3376. x = destArray[2];
  3377. width = pageWidth;
  3378. height = pageHeight;
  3379. scale = "page-height";
  3380. break;
  3381. case "FitR":
  3382. x = destArray[2];
  3383. y = destArray[3];
  3384. width = destArray[4] - x;
  3385. height = destArray[5] - y;
  3386. var hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
  3387. var vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
  3388. widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3389. heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  3390. scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
  3391. break;
  3392. default:
  3393. console.error("scrollPageIntoView: \"".concat(destArray[1].name, "\" is not a valid destination type."));
  3394. return;
  3395. }
  3396. if (!ignoreDestinationZoom) {
  3397. if (scale && scale !== this._currentScale) {
  3398. this.currentScaleValue = scale;
  3399. } else if (this._currentScale === _ui_utils.UNKNOWN_SCALE) {
  3400. this.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
  3401. }
  3402. }
  3403. if (scale === "page-fit" && !destArray[4]) {
  3404. this._scrollIntoView({
  3405. pageDiv: pageView.div,
  3406. pageNumber: pageNumber
  3407. });
  3408. return;
  3409. }
  3410. var boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)];
  3411. var left = Math.min(boundingRect[0][0], boundingRect[1][0]);
  3412. var top = Math.min(boundingRect[0][1], boundingRect[1][1]);
  3413. if (!allowNegativeOffset) {
  3414. left = Math.max(left, 0);
  3415. top = Math.max(top, 0);
  3416. }
  3417. this._scrollIntoView({
  3418. pageDiv: pageView.div,
  3419. pageSpot: {
  3420. left: left,
  3421. top: top
  3422. },
  3423. pageNumber: pageNumber
  3424. });
  3425. }
  3426. }, {
  3427. key: "_updateLocation",
  3428. value: function _updateLocation(firstPage) {
  3429. var currentScale = this._currentScale;
  3430. var currentScaleValue = this._currentScaleValue;
  3431. var normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue;
  3432. var pageNumber = firstPage.id;
  3433. var pdfOpenParams = "#page=" + pageNumber;
  3434. pdfOpenParams += "&zoom=" + normalizedScaleValue;
  3435. var currentPageView = this._pages[pageNumber - 1];
  3436. var container = this.container;
  3437. var topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y);
  3438. var intLeft = Math.round(topLeft[0]);
  3439. var intTop = Math.round(topLeft[1]);
  3440. pdfOpenParams += "," + intLeft + "," + intTop;
  3441. this._location = {
  3442. pageNumber: pageNumber,
  3443. scale: normalizedScaleValue,
  3444. top: intTop,
  3445. left: intLeft,
  3446. rotation: this._pagesRotation,
  3447. pdfOpenParams: pdfOpenParams
  3448. };
  3449. }
  3450. }, {
  3451. key: "update",
  3452. value: function update() {
  3453. var visible = this._getVisiblePages();
  3454. var visiblePages = visible.views,
  3455. numVisiblePages = visiblePages.length;
  3456. if (numVisiblePages === 0) {
  3457. return;
  3458. }
  3459. var newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);
  3460. _classPrivateFieldGet(this, _buffer).resize(newCacheSize, visible.ids);
  3461. this.renderingQueue.renderHighestPriority(visible);
  3462. if (!this.isInPresentationMode) {
  3463. var isSimpleLayout = this._spreadMode === _ui_utils.SpreadMode.NONE && (this._scrollMode === _ui_utils.ScrollMode.PAGE || this._scrollMode === _ui_utils.ScrollMode.VERTICAL);
  3464. var currentId = this._currentPageNumber;
  3465. var stillFullyVisible = false;
  3466. var _iterator4 = _createForOfIteratorHelper(visiblePages),
  3467. _step4;
  3468. try {
  3469. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3470. var page = _step4.value;
  3471. if (page.percent < 100) {
  3472. break;
  3473. }
  3474. if (page.id === currentId && isSimpleLayout) {
  3475. stillFullyVisible = true;
  3476. break;
  3477. }
  3478. }
  3479. } catch (err) {
  3480. _iterator4.e(err);
  3481. } finally {
  3482. _iterator4.f();
  3483. }
  3484. if (!stillFullyVisible) {
  3485. currentId = visiblePages[0].id;
  3486. }
  3487. this._setCurrentPageNumber(currentId);
  3488. }
  3489. this._updateLocation(visible.first);
  3490. this.eventBus.dispatch("updateviewarea", {
  3491. source: this,
  3492. location: this._location
  3493. });
  3494. }
  3495. }, {
  3496. key: "containsElement",
  3497. value: function containsElement(element) {
  3498. return this.container.contains(element);
  3499. }
  3500. }, {
  3501. key: "focus",
  3502. value: function focus() {
  3503. this.container.focus();
  3504. }
  3505. }, {
  3506. key: "_isContainerRtl",
  3507. get: function get() {
  3508. return getComputedStyle(this.container).direction === "rtl";
  3509. }
  3510. }, {
  3511. key: "isInPresentationMode",
  3512. get: function get() {
  3513. return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN;
  3514. }
  3515. }, {
  3516. key: "isChangingPresentationMode",
  3517. get: function get() {
  3518. return this.presentationModeState === _ui_utils.PresentationModeState.CHANGING;
  3519. }
  3520. }, {
  3521. key: "isHorizontalScrollbarEnabled",
  3522. get: function get() {
  3523. return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth;
  3524. }
  3525. }, {
  3526. key: "isVerticalScrollbarEnabled",
  3527. get: function get() {
  3528. return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight;
  3529. }
  3530. }, {
  3531. key: "_getCurrentVisiblePage",
  3532. value: function _getCurrentVisiblePage() {
  3533. if (!this.pagesCount) {
  3534. return {
  3535. views: []
  3536. };
  3537. }
  3538. var pageView = this._pages[this._currentPageNumber - 1];
  3539. var element = pageView.div;
  3540. var view = {
  3541. id: pageView.id,
  3542. x: element.offsetLeft + element.clientLeft,
  3543. y: element.offsetTop + element.clientTop,
  3544. view: pageView
  3545. };
  3546. var ids = new Set([pageView.id]);
  3547. return {
  3548. first: view,
  3549. last: view,
  3550. views: [view],
  3551. ids: ids
  3552. };
  3553. }
  3554. }, {
  3555. key: "_getVisiblePages",
  3556. value: function _getVisiblePages() {
  3557. if (this.isInPresentationMode) {
  3558. return this._getCurrentVisiblePage();
  3559. }
  3560. var views = this._scrollMode === _ui_utils.ScrollMode.PAGE ? _classPrivateFieldGet(this, _scrollModePageState).pages : this._pages,
  3561. horizontal = this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL,
  3562. rtl = horizontal && this._isContainerRtl;
  3563. return (0, _ui_utils.getVisibleElements)({
  3564. scrollEl: this.container,
  3565. views: views,
  3566. sortByVisibility: true,
  3567. horizontal: horizontal,
  3568. rtl: rtl
  3569. });
  3570. }
  3571. }, {
  3572. key: "isPageVisible",
  3573. value: function isPageVisible(pageNumber) {
  3574. if (!this.pdfDocument) {
  3575. return false;
  3576. }
  3577. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  3578. console.error("isPageVisible: \"".concat(pageNumber, "\" is not a valid page."));
  3579. return false;
  3580. }
  3581. return this._getVisiblePages().ids.has(pageNumber);
  3582. }
  3583. }, {
  3584. key: "isPageCached",
  3585. value: function isPageCached(pageNumber) {
  3586. if (!this.pdfDocument) {
  3587. return false;
  3588. }
  3589. if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
  3590. console.error("isPageCached: \"".concat(pageNumber, "\" is not a valid page."));
  3591. return false;
  3592. }
  3593. var pageView = this._pages[pageNumber - 1];
  3594. return _classPrivateFieldGet(this, _buffer).has(pageView);
  3595. }
  3596. }, {
  3597. key: "cleanup",
  3598. value: function cleanup() {
  3599. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3600. if (this._pages[i] && this._pages[i].renderingState !== _ui_utils.RenderingStates.FINISHED) {
  3601. this._pages[i].reset();
  3602. }
  3603. }
  3604. }
  3605. }, {
  3606. key: "_cancelRendering",
  3607. value: function _cancelRendering() {
  3608. for (var i = 0, ii = this._pages.length; i < ii; i++) {
  3609. if (this._pages[i]) {
  3610. this._pages[i].cancelRendering();
  3611. }
  3612. }
  3613. }
  3614. }, {
  3615. key: "forceRendering",
  3616. value: function forceRendering(currentlyVisiblePages) {
  3617. var _this3 = this;
  3618. var visiblePages = currentlyVisiblePages || this._getVisiblePages();
  3619. var scrollAhead = _classPrivateMethodGet(this, _getScrollAhead, _getScrollAhead2).call(this, visiblePages);
  3620. var preRenderExtra = this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL;
  3621. var pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra);
  3622. _classPrivateMethodGet(this, _toggleLoadingIconSpinner, _toggleLoadingIconSpinner2).call(this, visiblePages.ids);
  3623. if (pageView) {
  3624. _classPrivateMethodGet(this, _ensurePdfPageLoaded, _ensurePdfPageLoaded2).call(this, pageView).then(function () {
  3625. _this3.renderingQueue.renderView(pageView);
  3626. });
  3627. return true;
  3628. }
  3629. return false;
  3630. }
  3631. }, {
  3632. key: "createTextLayerBuilder",
  3633. value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
  3634. var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  3635. var eventBus = arguments.length > 4 ? arguments[4] : undefined;
  3636. var highlighter = arguments.length > 5 ? arguments[5] : undefined;
  3637. return new _text_layer_builder.TextLayerBuilder({
  3638. textLayerDiv: textLayerDiv,
  3639. eventBus: eventBus,
  3640. pageIndex: pageIndex,
  3641. viewport: viewport,
  3642. enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection,
  3643. highlighter: highlighter
  3644. });
  3645. }
  3646. }, {
  3647. key: "createTextHighlighter",
  3648. value: function createTextHighlighter(pageIndex, eventBus) {
  3649. return new _text_highlighter.TextHighlighter({
  3650. eventBus: eventBus,
  3651. pageIndex: pageIndex,
  3652. findController: this.isInPresentationMode ? null : this.findController
  3653. });
  3654. }
  3655. }, {
  3656. key: "createAnnotationLayerBuilder",
  3657. value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
  3658. var _this$pdfDocument, _this$pdfDocument2, _this$pdfDocument3, _this$_scriptingManag;
  3659. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  3660. var imageResourcesPath = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
  3661. var renderForms = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  3662. var l10n = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : _l10n_utils.NullL10n;
  3663. var enableScripting = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  3664. var hasJSActionsPromise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  3665. var mouseState = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
  3666. var fieldObjectsPromise = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : null;
  3667. var annotationCanvasMap = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
  3668. return new _annotation_layer_builder.AnnotationLayerBuilder({
  3669. pageDiv: pageDiv,
  3670. pdfPage: pdfPage,
  3671. annotationStorage: annotationStorage || ((_this$pdfDocument = this.pdfDocument) === null || _this$pdfDocument === void 0 ? void 0 : _this$pdfDocument.annotationStorage),
  3672. imageResourcesPath: imageResourcesPath,
  3673. renderForms: renderForms,
  3674. linkService: this.linkService,
  3675. downloadManager: this.downloadManager,
  3676. l10n: l10n,
  3677. enableScripting: enableScripting !== null && enableScripting !== void 0 ? enableScripting : this.enableScripting,
  3678. hasJSActionsPromise: hasJSActionsPromise || ((_this$pdfDocument2 = this.pdfDocument) === null || _this$pdfDocument2 === void 0 ? void 0 : _this$pdfDocument2.hasJSActions()),
  3679. fieldObjectsPromise: fieldObjectsPromise || ((_this$pdfDocument3 = this.pdfDocument) === null || _this$pdfDocument3 === void 0 ? void 0 : _this$pdfDocument3.getFieldObjects()),
  3680. mouseState: mouseState || ((_this$_scriptingManag = this._scriptingManager) === null || _this$_scriptingManag === void 0 ? void 0 : _this$_scriptingManag.mouseState),
  3681. annotationCanvasMap: annotationCanvasMap
  3682. });
  3683. }
  3684. }, {
  3685. key: "createXfaLayerBuilder",
  3686. value: function createXfaLayerBuilder(pageDiv, pdfPage) {
  3687. var _this$pdfDocument4;
  3688. var annotationStorage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  3689. return new _xfa_layer_builder.XfaLayerBuilder({
  3690. pageDiv: pageDiv,
  3691. pdfPage: pdfPage,
  3692. annotationStorage: annotationStorage || ((_this$pdfDocument4 = this.pdfDocument) === null || _this$pdfDocument4 === void 0 ? void 0 : _this$pdfDocument4.annotationStorage),
  3693. linkService: this.linkService
  3694. });
  3695. }
  3696. }, {
  3697. key: "createStructTreeLayerBuilder",
  3698. value: function createStructTreeLayerBuilder(pdfPage) {
  3699. return new _struct_tree_layer_builder.StructTreeLayerBuilder({
  3700. pdfPage: pdfPage
  3701. });
  3702. }
  3703. }, {
  3704. key: "hasEqualPageSizes",
  3705. get: function get() {
  3706. var firstPageView = this._pages[0];
  3707. for (var i = 1, ii = this._pages.length; i < ii; ++i) {
  3708. var pageView = this._pages[i];
  3709. if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) {
  3710. return false;
  3711. }
  3712. }
  3713. return true;
  3714. }
  3715. }, {
  3716. key: "getPagesOverview",
  3717. value: function getPagesOverview() {
  3718. var _this4 = this;
  3719. return this._pages.map(function (pageView) {
  3720. var viewport = pageView.pdfPage.getViewport({
  3721. scale: 1
  3722. });
  3723. if (!_this4.enablePrintAutoRotate || (0, _ui_utils.isPortraitOrientation)(viewport)) {
  3724. return {
  3725. width: viewport.width,
  3726. height: viewport.height,
  3727. rotation: viewport.rotation
  3728. };
  3729. }
  3730. return {
  3731. width: viewport.height,
  3732. height: viewport.width,
  3733. rotation: (viewport.rotation - 90) % 360
  3734. };
  3735. });
  3736. }
  3737. }, {
  3738. key: "optionalContentConfigPromise",
  3739. get: function get() {
  3740. if (!this.pdfDocument) {
  3741. return Promise.resolve(null);
  3742. }
  3743. if (!this._optionalContentConfigPromise) {
  3744. return this.pdfDocument.getOptionalContentConfig();
  3745. }
  3746. return this._optionalContentConfigPromise;
  3747. },
  3748. set: function set(promise) {
  3749. if (!(promise instanceof Promise)) {
  3750. throw new Error("Invalid optionalContentConfigPromise: ".concat(promise));
  3751. }
  3752. if (!this.pdfDocument) {
  3753. return;
  3754. }
  3755. if (!this._optionalContentConfigPromise) {
  3756. return;
  3757. }
  3758. this._optionalContentConfigPromise = promise;
  3759. var updateArgs = {
  3760. optionalContentConfigPromise: promise
  3761. };
  3762. var _iterator5 = _createForOfIteratorHelper(this._pages),
  3763. _step5;
  3764. try {
  3765. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3766. var pageView = _step5.value;
  3767. pageView.update(updateArgs);
  3768. }
  3769. } catch (err) {
  3770. _iterator5.e(err);
  3771. } finally {
  3772. _iterator5.f();
  3773. }
  3774. this.update();
  3775. this.eventBus.dispatch("optionalcontentconfigchanged", {
  3776. source: this,
  3777. promise: promise
  3778. });
  3779. }
  3780. }, {
  3781. key: "scrollMode",
  3782. get: function get() {
  3783. return this._scrollMode;
  3784. },
  3785. set: function set(mode) {
  3786. if (this._scrollMode === mode) {
  3787. return;
  3788. }
  3789. if (!(0, _ui_utils.isValidScrollMode)(mode)) {
  3790. throw new Error("Invalid scroll mode: ".concat(mode));
  3791. }
  3792. if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {
  3793. return;
  3794. }
  3795. this._previousScrollMode = this._scrollMode;
  3796. this._scrollMode = mode;
  3797. this.eventBus.dispatch("scrollmodechanged", {
  3798. source: this,
  3799. mode: mode
  3800. });
  3801. this._updateScrollMode(this._currentPageNumber);
  3802. }
  3803. }, {
  3804. key: "_updateScrollMode",
  3805. value: function _updateScrollMode() {
  3806. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  3807. var scrollMode = this._scrollMode,
  3808. viewer = this.viewer;
  3809. viewer.classList.toggle("scrollHorizontal", scrollMode === _ui_utils.ScrollMode.HORIZONTAL);
  3810. viewer.classList.toggle("scrollWrapped", scrollMode === _ui_utils.ScrollMode.WRAPPED);
  3811. if (!this.pdfDocument || !pageNumber) {
  3812. return;
  3813. }
  3814. if (scrollMode === _ui_utils.ScrollMode.PAGE) {
  3815. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3816. } else if (this._previousScrollMode === _ui_utils.ScrollMode.PAGE) {
  3817. this._updateSpreadMode();
  3818. }
  3819. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  3820. this._setScale(this._currentScaleValue, true);
  3821. }
  3822. this._setCurrentPageNumber(pageNumber, true);
  3823. this.update();
  3824. }
  3825. }, {
  3826. key: "spreadMode",
  3827. get: function get() {
  3828. return this._spreadMode;
  3829. },
  3830. set: function set(mode) {
  3831. if (this._spreadMode === mode) {
  3832. return;
  3833. }
  3834. if (!(0, _ui_utils.isValidSpreadMode)(mode)) {
  3835. throw new Error("Invalid spread mode: ".concat(mode));
  3836. }
  3837. this._spreadMode = mode;
  3838. this.eventBus.dispatch("spreadmodechanged", {
  3839. source: this,
  3840. mode: mode
  3841. });
  3842. this._updateSpreadMode(this._currentPageNumber);
  3843. }
  3844. }, {
  3845. key: "_updateSpreadMode",
  3846. value: function _updateSpreadMode() {
  3847. var pageNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  3848. if (!this.pdfDocument) {
  3849. return;
  3850. }
  3851. var viewer = this.viewer,
  3852. pages = this._pages;
  3853. if (this._scrollMode === _ui_utils.ScrollMode.PAGE) {
  3854. _classPrivateMethodGet(this, _ensurePageViewVisible, _ensurePageViewVisible2).call(this);
  3855. } else {
  3856. viewer.textContent = "";
  3857. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  3858. for (var i = 0, ii = pages.length; i < ii; ++i) {
  3859. viewer.appendChild(pages[i].div);
  3860. }
  3861. } else {
  3862. var parity = this._spreadMode - 1;
  3863. var spread = null;
  3864. for (var _i2 = 0, _ii = pages.length; _i2 < _ii; ++_i2) {
  3865. if (spread === null) {
  3866. spread = document.createElement("div");
  3867. spread.className = "spread";
  3868. viewer.appendChild(spread);
  3869. } else if (_i2 % 2 === parity) {
  3870. spread = spread.cloneNode(false);
  3871. viewer.appendChild(spread);
  3872. }
  3873. spread.appendChild(pages[_i2].div);
  3874. }
  3875. }
  3876. }
  3877. if (!pageNumber) {
  3878. return;
  3879. }
  3880. if (this._currentScaleValue && isNaN(this._currentScaleValue)) {
  3881. this._setScale(this._currentScaleValue, true);
  3882. }
  3883. this._setCurrentPageNumber(pageNumber, true);
  3884. this.update();
  3885. }
  3886. }, {
  3887. key: "_getPageAdvance",
  3888. value: function _getPageAdvance(currentPageNumber) {
  3889. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  3890. switch (this._scrollMode) {
  3891. case _ui_utils.ScrollMode.WRAPPED:
  3892. {
  3893. var _this$_getVisiblePage = this._getVisiblePages(),
  3894. views = _this$_getVisiblePage.views,
  3895. pageLayout = new Map();
  3896. var _iterator6 = _createForOfIteratorHelper(views),
  3897. _step6;
  3898. try {
  3899. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3900. var _step6$value = _step6.value,
  3901. id = _step6$value.id,
  3902. y = _step6$value.y,
  3903. percent = _step6$value.percent,
  3904. widthPercent = _step6$value.widthPercent;
  3905. if (percent === 0 || widthPercent < 100) {
  3906. continue;
  3907. }
  3908. var yArray = pageLayout.get(y);
  3909. if (!yArray) {
  3910. pageLayout.set(y, yArray || (yArray = []));
  3911. }
  3912. yArray.push(id);
  3913. }
  3914. } catch (err) {
  3915. _iterator6.e(err);
  3916. } finally {
  3917. _iterator6.f();
  3918. }
  3919. var _iterator7 = _createForOfIteratorHelper(pageLayout.values()),
  3920. _step7;
  3921. try {
  3922. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  3923. var _yArray = _step7.value;
  3924. var currentIndex = _yArray.indexOf(currentPageNumber);
  3925. if (currentIndex === -1) {
  3926. continue;
  3927. }
  3928. var numPages = _yArray.length;
  3929. if (numPages === 1) {
  3930. break;
  3931. }
  3932. if (previous) {
  3933. for (var i = currentIndex - 1, ii = 0; i >= ii; i--) {
  3934. var currentId = _yArray[i],
  3935. expectedId = _yArray[i + 1] - 1;
  3936. if (currentId < expectedId) {
  3937. return currentPageNumber - expectedId;
  3938. }
  3939. }
  3940. } else {
  3941. for (var _i3 = currentIndex + 1, _ii2 = numPages; _i3 < _ii2; _i3++) {
  3942. var _currentId = _yArray[_i3],
  3943. _expectedId = _yArray[_i3 - 1] + 1;
  3944. if (_currentId > _expectedId) {
  3945. return _expectedId - currentPageNumber;
  3946. }
  3947. }
  3948. }
  3949. if (previous) {
  3950. var firstId = _yArray[0];
  3951. if (firstId < currentPageNumber) {
  3952. return currentPageNumber - firstId + 1;
  3953. }
  3954. } else {
  3955. var lastId = _yArray[numPages - 1];
  3956. if (lastId > currentPageNumber) {
  3957. return lastId - currentPageNumber + 1;
  3958. }
  3959. }
  3960. break;
  3961. }
  3962. } catch (err) {
  3963. _iterator7.e(err);
  3964. } finally {
  3965. _iterator7.f();
  3966. }
  3967. break;
  3968. }
  3969. case _ui_utils.ScrollMode.HORIZONTAL:
  3970. {
  3971. break;
  3972. }
  3973. case _ui_utils.ScrollMode.PAGE:
  3974. case _ui_utils.ScrollMode.VERTICAL:
  3975. {
  3976. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  3977. break;
  3978. }
  3979. var parity = this._spreadMode - 1;
  3980. if (previous && currentPageNumber % 2 !== parity) {
  3981. break;
  3982. } else if (!previous && currentPageNumber % 2 === parity) {
  3983. break;
  3984. }
  3985. var _this$_getVisiblePage2 = this._getVisiblePages(),
  3986. _views = _this$_getVisiblePage2.views,
  3987. _expectedId2 = previous ? currentPageNumber - 1 : currentPageNumber + 1;
  3988. var _iterator8 = _createForOfIteratorHelper(_views),
  3989. _step8;
  3990. try {
  3991. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  3992. var _step8$value = _step8.value,
  3993. _id = _step8$value.id,
  3994. _percent = _step8$value.percent,
  3995. _widthPercent = _step8$value.widthPercent;
  3996. if (_id !== _expectedId2) {
  3997. continue;
  3998. }
  3999. if (_percent > 0 && _widthPercent === 100) {
  4000. return 2;
  4001. }
  4002. break;
  4003. }
  4004. } catch (err) {
  4005. _iterator8.e(err);
  4006. } finally {
  4007. _iterator8.f();
  4008. }
  4009. break;
  4010. }
  4011. }
  4012. return 1;
  4013. }
  4014. }, {
  4015. key: "nextPage",
  4016. value: function nextPage() {
  4017. var currentPageNumber = this._currentPageNumber,
  4018. pagesCount = this.pagesCount;
  4019. if (currentPageNumber >= pagesCount) {
  4020. return false;
  4021. }
  4022. var advance = this._getPageAdvance(currentPageNumber, false) || 1;
  4023. this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);
  4024. return true;
  4025. }
  4026. }, {
  4027. key: "previousPage",
  4028. value: function previousPage() {
  4029. var currentPageNumber = this._currentPageNumber;
  4030. if (currentPageNumber <= 1) {
  4031. return false;
  4032. }
  4033. var advance = this._getPageAdvance(currentPageNumber, true) || 1;
  4034. this.currentPageNumber = Math.max(currentPageNumber - advance, 1);
  4035. return true;
  4036. }
  4037. }, {
  4038. key: "increaseScale",
  4039. value: function increaseScale() {
  4040. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  4041. var newScale = this._currentScale;
  4042. do {
  4043. newScale = (newScale * _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  4044. newScale = Math.ceil(newScale * 10) / 10;
  4045. newScale = Math.min(_ui_utils.MAX_SCALE, newScale);
  4046. } while (--steps > 0 && newScale < _ui_utils.MAX_SCALE);
  4047. this.currentScaleValue = newScale;
  4048. }
  4049. }, {
  4050. key: "decreaseScale",
  4051. value: function decreaseScale() {
  4052. var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  4053. var newScale = this._currentScale;
  4054. do {
  4055. newScale = (newScale / _ui_utils.DEFAULT_SCALE_DELTA).toFixed(2);
  4056. newScale = Math.floor(newScale * 10) / 10;
  4057. newScale = Math.max(_ui_utils.MIN_SCALE, newScale);
  4058. } while (--steps > 0 && newScale > _ui_utils.MIN_SCALE);
  4059. this.currentScaleValue = newScale;
  4060. }
  4061. }]);
  4062. return BaseViewer;
  4063. }();
  4064. exports.BaseViewer = BaseViewer;
  4065. function _initializePermissions2(permissions) {
  4066. if (!permissions) {
  4067. return;
  4068. }
  4069. if (!permissions.includes(_pdfjsLib.PermissionFlag.COPY)) {
  4070. this.viewer.classList.add(ENABLE_PERMISSIONS_CLASS);
  4071. }
  4072. if (!permissions.includes(_pdfjsLib.PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(_pdfjsLib.PermissionFlag.FILL_INTERACTIVE_FORMS)) {
  4073. if (_classPrivateFieldGet(this, _annotationMode) === _pdfjsLib.AnnotationMode.ENABLE_FORMS) {
  4074. _classPrivateFieldSet(this, _previousAnnotationMode, _classPrivateFieldGet(this, _annotationMode));
  4075. _classPrivateFieldSet(this, _annotationMode, _pdfjsLib.AnnotationMode.ENABLE);
  4076. }
  4077. }
  4078. }
  4079. function _onePageRenderedOrForceFetch2() {
  4080. if (!this.container.offsetParent || this._getVisiblePages().views.length === 0) {
  4081. return Promise.resolve();
  4082. }
  4083. return this._onePageRenderedCapability.promise;
  4084. }
  4085. function _ensurePageViewVisible2() {
  4086. if (this._scrollMode !== _ui_utils.ScrollMode.PAGE) {
  4087. throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");
  4088. }
  4089. var pageNumber = this._currentPageNumber,
  4090. state = _classPrivateFieldGet(this, _scrollModePageState),
  4091. viewer = this.viewer;
  4092. viewer.textContent = "";
  4093. state.pages.length = 0;
  4094. if (this._spreadMode === _ui_utils.SpreadMode.NONE) {
  4095. var pageView = this._pages[pageNumber - 1];
  4096. if (this.isInPresentationMode) {
  4097. var spread = document.createElement("div");
  4098. spread.className = "spread";
  4099. var dummyPage = document.createElement("div");
  4100. dummyPage.className = "dummyPage";
  4101. dummyPage.style.height = "".concat(this.container.clientHeight, "px");
  4102. spread.appendChild(dummyPage);
  4103. spread.appendChild(pageView.div);
  4104. viewer.appendChild(spread);
  4105. } else {
  4106. viewer.appendChild(pageView.div);
  4107. }
  4108. state.pages.push(pageView);
  4109. } else {
  4110. var pageIndexSet = new Set(),
  4111. parity = this._spreadMode - 1;
  4112. if (pageNumber % 2 !== parity) {
  4113. pageIndexSet.add(pageNumber - 1);
  4114. pageIndexSet.add(pageNumber);
  4115. } else {
  4116. pageIndexSet.add(pageNumber - 2);
  4117. pageIndexSet.add(pageNumber - 1);
  4118. }
  4119. var _spread = null;
  4120. var _iterator9 = _createForOfIteratorHelper(pageIndexSet),
  4121. _step9;
  4122. try {
  4123. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  4124. var i = _step9.value;
  4125. var _pageView = this._pages[i];
  4126. if (!_pageView) {
  4127. continue;
  4128. }
  4129. if (_spread === null) {
  4130. _spread = document.createElement("div");
  4131. _spread.className = "spread";
  4132. viewer.appendChild(_spread);
  4133. } else if (i % 2 === parity) {
  4134. _spread = _spread.cloneNode(false);
  4135. viewer.appendChild(_spread);
  4136. }
  4137. _spread.appendChild(_pageView.div);
  4138. state.pages.push(_pageView);
  4139. }
  4140. } catch (err) {
  4141. _iterator9.e(err);
  4142. } finally {
  4143. _iterator9.f();
  4144. }
  4145. }
  4146. state.scrollDown = pageNumber >= state.previousPageNumber;
  4147. state.previousPageNumber = pageNumber;
  4148. }
  4149. function _isSameScale2(newScale) {
  4150. if (this.isInPresentationMode && this.container.clientHeight !== _classPrivateFieldGet(this, _previousContainerHeight)) {
  4151. return false;
  4152. }
  4153. return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15;
  4154. }
  4155. function _ensurePdfPageLoaded2(_x) {
  4156. return _ensurePdfPageLoaded3.apply(this, arguments);
  4157. }
  4158. function _ensurePdfPageLoaded3() {
  4159. _ensurePdfPageLoaded3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pageView) {
  4160. var pdfPage;
  4161. return _regenerator["default"].wrap(function _callee2$(_context3) {
  4162. while (1) {
  4163. switch (_context3.prev = _context3.next) {
  4164. case 0:
  4165. if (!pageView.pdfPage) {
  4166. _context3.next = 2;
  4167. break;
  4168. }
  4169. return _context3.abrupt("return", pageView.pdfPage);
  4170. case 2:
  4171. _context3.prev = 2;
  4172. _context3.next = 5;
  4173. return this.pdfDocument.getPage(pageView.id);
  4174. case 5:
  4175. pdfPage = _context3.sent;
  4176. if (!pageView.pdfPage) {
  4177. pageView.setPdfPage(pdfPage);
  4178. }
  4179. if (!this.linkService._cachedPageNumber(pdfPage.ref)) {
  4180. this.linkService.cachePageRef(pageView.id, pdfPage.ref);
  4181. }
  4182. return _context3.abrupt("return", pdfPage);
  4183. case 11:
  4184. _context3.prev = 11;
  4185. _context3.t0 = _context3["catch"](2);
  4186. console.error("Unable to get page for page view", _context3.t0);
  4187. return _context3.abrupt("return", null);
  4188. case 15:
  4189. case "end":
  4190. return _context3.stop();
  4191. }
  4192. }
  4193. }, _callee2, this, [[2, 11]]);
  4194. }));
  4195. return _ensurePdfPageLoaded3.apply(this, arguments);
  4196. }
  4197. function _getScrollAhead2(visible) {
  4198. var _visible$first, _visible$last;
  4199. if (((_visible$first = visible.first) === null || _visible$first === void 0 ? void 0 : _visible$first.id) === 1) {
  4200. return true;
  4201. } else if (((_visible$last = visible.last) === null || _visible$last === void 0 ? void 0 : _visible$last.id) === this.pagesCount) {
  4202. return false;
  4203. }
  4204. switch (this._scrollMode) {
  4205. case _ui_utils.ScrollMode.PAGE:
  4206. return _classPrivateFieldGet(this, _scrollModePageState).scrollDown;
  4207. case _ui_utils.ScrollMode.HORIZONTAL:
  4208. return this.scroll.right;
  4209. }
  4210. return this.scroll.down;
  4211. }
  4212. function _toggleLoadingIconSpinner2(visibleIds) {
  4213. var _iterator10 = _createForOfIteratorHelper(visibleIds),
  4214. _step10;
  4215. try {
  4216. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  4217. var id = _step10.value;
  4218. var pageView = this._pages[id - 1];
  4219. pageView === null || pageView === void 0 ? void 0 : pageView.toggleLoadingIconSpinner(true);
  4220. }
  4221. } catch (err) {
  4222. _iterator10.e(err);
  4223. } finally {
  4224. _iterator10.f();
  4225. }
  4226. var _iterator11 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _buffer)),
  4227. _step11;
  4228. try {
  4229. for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
  4230. var _pageView2 = _step11.value;
  4231. if (visibleIds.has(_pageView2.id)) {
  4232. continue;
  4233. }
  4234. _pageView2.toggleLoadingIconSpinner(false);
  4235. }
  4236. } catch (err) {
  4237. _iterator11.e(err);
  4238. } finally {
  4239. _iterator11.f();
  4240. }
  4241. }
  4242. /***/ }),
  4243. /* 14 */
  4244. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4245. Object.defineProperty(exports, "__esModule", ({
  4246. value: true
  4247. }));
  4248. exports.PDFPageView = void 0;
  4249. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  4250. var _pdfjsLib = __w_pdfjs_require__(5);
  4251. var _ui_utils = __w_pdfjs_require__(8);
  4252. var _app_options = __w_pdfjs_require__(15);
  4253. var _l10n_utils = __w_pdfjs_require__(6);
  4254. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4255. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4256. 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; } } }; }
  4257. 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); }
  4258. 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; }
  4259. 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); } }
  4260. 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); }); }; }
  4261. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4262. 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); } }
  4263. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4264. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  4265. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  4266. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  4267. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  4268. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  4269. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  4270. 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; } }
  4271. var MAX_CANVAS_PIXELS = _app_options.compatibilityParams.maxCanvasPixels || 16777216;
  4272. var _annotationMode = /*#__PURE__*/new WeakMap();
  4273. var PDFPageView = /*#__PURE__*/function () {
  4274. function PDFPageView(options) {
  4275. var _options$textLayerMod, _options$annotationMo, _options$textHighligh, _this$renderingQueue;
  4276. _classCallCheck(this, PDFPageView);
  4277. _classPrivateFieldInitSpec(this, _annotationMode, {
  4278. writable: true,
  4279. value: _pdfjsLib.AnnotationMode.ENABLE_FORMS
  4280. });
  4281. var container = options.container;
  4282. var defaultViewport = options.defaultViewport;
  4283. this.id = options.id;
  4284. this.renderingId = "page" + this.id;
  4285. this.pdfPage = null;
  4286. this.pageLabel = null;
  4287. this.rotation = 0;
  4288. this.scale = options.scale || _ui_utils.DEFAULT_SCALE;
  4289. this.viewport = defaultViewport;
  4290. this.pdfPageRotate = defaultViewport.rotation;
  4291. this._optionalContentConfigPromise = options.optionalContentConfigPromise || null;
  4292. this.hasRestrictedScaling = false;
  4293. this.textLayerMode = (_options$textLayerMod = options.textLayerMode) !== null && _options$textLayerMod !== void 0 ? _options$textLayerMod : _ui_utils.TextLayerMode.ENABLE;
  4294. _classPrivateFieldSet(this, _annotationMode, (_options$annotationMo = options.annotationMode) !== null && _options$annotationMo !== void 0 ? _options$annotationMo : _pdfjsLib.AnnotationMode.ENABLE_FORMS);
  4295. this.imageResourcesPath = options.imageResourcesPath || "";
  4296. this.useOnlyCssZoom = options.useOnlyCssZoom || false;
  4297. this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
  4298. this.eventBus = options.eventBus;
  4299. this.renderingQueue = options.renderingQueue;
  4300. this.textLayerFactory = options.textLayerFactory;
  4301. this.annotationLayerFactory = options.annotationLayerFactory;
  4302. this.xfaLayerFactory = options.xfaLayerFactory;
  4303. this.textHighlighter = (_options$textHighligh = options.textHighlighterFactory) === null || _options$textHighligh === void 0 ? void 0 : _options$textHighligh.createTextHighlighter(this.id - 1, this.eventBus);
  4304. this.structTreeLayerFactory = options.structTreeLayerFactory;
  4305. this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
  4306. this.l10n = options.l10n || _l10n_utils.NullL10n;
  4307. this.paintTask = null;
  4308. this.paintedViewportMap = new WeakMap();
  4309. this.renderingState = _ui_utils.RenderingStates.INITIAL;
  4310. this.resume = null;
  4311. this._renderError = null;
  4312. this._isStandalone = !((_this$renderingQueue = this.renderingQueue) !== null && _this$renderingQueue !== void 0 && _this$renderingQueue.hasViewer());
  4313. this._annotationCanvasMap = null;
  4314. this.annotationLayer = null;
  4315. this.textLayer = null;
  4316. this.zoomLayer = null;
  4317. this.xfaLayer = null;
  4318. this.structTreeLayer = null;
  4319. var div = document.createElement("div");
  4320. div.className = "page";
  4321. div.style.width = Math.floor(this.viewport.width) + "px";
  4322. div.style.height = Math.floor(this.viewport.height) + "px";
  4323. div.setAttribute("data-page-number", this.id);
  4324. div.setAttribute("role", "region");
  4325. this.l10n.get("page_landmark", {
  4326. page: this.id
  4327. }).then(function (msg) {
  4328. div.setAttribute("aria-label", msg);
  4329. });
  4330. this.div = div;
  4331. container === null || container === void 0 ? void 0 : container.appendChild(div);
  4332. }
  4333. _createClass(PDFPageView, [{
  4334. key: "setPdfPage",
  4335. value: function setPdfPage(pdfPage) {
  4336. this.pdfPage = pdfPage;
  4337. this.pdfPageRotate = pdfPage.rotate;
  4338. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  4339. this.viewport = pdfPage.getViewport({
  4340. scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
  4341. rotation: totalRotation
  4342. });
  4343. this.reset();
  4344. }
  4345. }, {
  4346. key: "destroy",
  4347. value: function destroy() {
  4348. this.reset();
  4349. if (this.pdfPage) {
  4350. this.pdfPage.cleanup();
  4351. }
  4352. }
  4353. }, {
  4354. key: "_renderAnnotationLayer",
  4355. value: function () {
  4356. var _renderAnnotationLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  4357. var error;
  4358. return _regenerator["default"].wrap(function _callee$(_context) {
  4359. while (1) {
  4360. switch (_context.prev = _context.next) {
  4361. case 0:
  4362. error = null;
  4363. _context.prev = 1;
  4364. _context.next = 4;
  4365. return this.annotationLayer.render(this.viewport, "display");
  4366. case 4:
  4367. _context.next = 9;
  4368. break;
  4369. case 6:
  4370. _context.prev = 6;
  4371. _context.t0 = _context["catch"](1);
  4372. error = _context.t0;
  4373. case 9:
  4374. _context.prev = 9;
  4375. this.eventBus.dispatch("annotationlayerrendered", {
  4376. source: this,
  4377. pageNumber: this.id,
  4378. error: error
  4379. });
  4380. return _context.finish(9);
  4381. case 12:
  4382. case "end":
  4383. return _context.stop();
  4384. }
  4385. }
  4386. }, _callee, this, [[1, 6, 9, 12]]);
  4387. }));
  4388. function _renderAnnotationLayer() {
  4389. return _renderAnnotationLayer2.apply(this, arguments);
  4390. }
  4391. return _renderAnnotationLayer;
  4392. }()
  4393. }, {
  4394. key: "_renderXfaLayer",
  4395. value: function () {
  4396. var _renderXfaLayer2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  4397. var error, result;
  4398. return _regenerator["default"].wrap(function _callee2$(_context2) {
  4399. while (1) {
  4400. switch (_context2.prev = _context2.next) {
  4401. case 0:
  4402. error = null;
  4403. _context2.prev = 1;
  4404. _context2.next = 4;
  4405. return this.xfaLayer.render(this.viewport, "display");
  4406. case 4:
  4407. result = _context2.sent;
  4408. if (this.textHighlighter) {
  4409. this._buildXfaTextContentItems(result.textDivs);
  4410. }
  4411. _context2.next = 11;
  4412. break;
  4413. case 8:
  4414. _context2.prev = 8;
  4415. _context2.t0 = _context2["catch"](1);
  4416. error = _context2.t0;
  4417. case 11:
  4418. _context2.prev = 11;
  4419. this.eventBus.dispatch("xfalayerrendered", {
  4420. source: this,
  4421. pageNumber: this.id,
  4422. error: error
  4423. });
  4424. return _context2.finish(11);
  4425. case 14:
  4426. case "end":
  4427. return _context2.stop();
  4428. }
  4429. }
  4430. }, _callee2, this, [[1, 8, 11, 14]]);
  4431. }));
  4432. function _renderXfaLayer() {
  4433. return _renderXfaLayer2.apply(this, arguments);
  4434. }
  4435. return _renderXfaLayer;
  4436. }()
  4437. }, {
  4438. key: "_buildXfaTextContentItems",
  4439. value: function () {
  4440. var _buildXfaTextContentItems2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(textDivs) {
  4441. var text, items, _iterator, _step, item;
  4442. return _regenerator["default"].wrap(function _callee3$(_context3) {
  4443. while (1) {
  4444. switch (_context3.prev = _context3.next) {
  4445. case 0:
  4446. _context3.next = 2;
  4447. return this.pdfPage.getTextContent();
  4448. case 2:
  4449. text = _context3.sent;
  4450. items = [];
  4451. _iterator = _createForOfIteratorHelper(text.items);
  4452. try {
  4453. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4454. item = _step.value;
  4455. items.push(item.str);
  4456. }
  4457. } catch (err) {
  4458. _iterator.e(err);
  4459. } finally {
  4460. _iterator.f();
  4461. }
  4462. this.textHighlighter.setTextMapping(textDivs, items);
  4463. this.textHighlighter.enable();
  4464. case 8:
  4465. case "end":
  4466. return _context3.stop();
  4467. }
  4468. }
  4469. }, _callee3, this);
  4470. }));
  4471. function _buildXfaTextContentItems(_x) {
  4472. return _buildXfaTextContentItems2.apply(this, arguments);
  4473. }
  4474. return _buildXfaTextContentItems;
  4475. }()
  4476. }, {
  4477. key: "_resetZoomLayer",
  4478. value: function _resetZoomLayer() {
  4479. var removeFromDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4480. if (!this.zoomLayer) {
  4481. return;
  4482. }
  4483. var zoomLayerCanvas = this.zoomLayer.firstChild;
  4484. this.paintedViewportMap["delete"](zoomLayerCanvas);
  4485. zoomLayerCanvas.width = 0;
  4486. zoomLayerCanvas.height = 0;
  4487. if (removeFromDOM) {
  4488. this.zoomLayer.remove();
  4489. }
  4490. this.zoomLayer = null;
  4491. }
  4492. }, {
  4493. key: "reset",
  4494. value: function reset() {
  4495. var _this$annotationLayer,
  4496. _this$xfaLayer,
  4497. _this = this;
  4498. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4499. _ref$keepZoomLayer = _ref.keepZoomLayer,
  4500. keepZoomLayer = _ref$keepZoomLayer === void 0 ? false : _ref$keepZoomLayer,
  4501. _ref$keepAnnotationLa = _ref.keepAnnotationLayer,
  4502. keepAnnotationLayer = _ref$keepAnnotationLa === void 0 ? false : _ref$keepAnnotationLa,
  4503. _ref$keepXfaLayer = _ref.keepXfaLayer,
  4504. keepXfaLayer = _ref$keepXfaLayer === void 0 ? false : _ref$keepXfaLayer;
  4505. this.cancelRendering({
  4506. keepAnnotationLayer: keepAnnotationLayer,
  4507. keepXfaLayer: keepXfaLayer
  4508. });
  4509. this.renderingState = _ui_utils.RenderingStates.INITIAL;
  4510. var div = this.div;
  4511. div.style.width = Math.floor(this.viewport.width) + "px";
  4512. div.style.height = Math.floor(this.viewport.height) + "px";
  4513. var childNodes = div.childNodes,
  4514. zoomLayerNode = keepZoomLayer && this.zoomLayer || null,
  4515. annotationLayerNode = keepAnnotationLayer && ((_this$annotationLayer = this.annotationLayer) === null || _this$annotationLayer === void 0 ? void 0 : _this$annotationLayer.div) || null,
  4516. xfaLayerNode = keepXfaLayer && ((_this$xfaLayer = this.xfaLayer) === null || _this$xfaLayer === void 0 ? void 0 : _this$xfaLayer.div) || null;
  4517. for (var i = childNodes.length - 1; i >= 0; i--) {
  4518. var node = childNodes[i];
  4519. switch (node) {
  4520. case zoomLayerNode:
  4521. case annotationLayerNode:
  4522. case xfaLayerNode:
  4523. continue;
  4524. }
  4525. node.remove();
  4526. }
  4527. div.removeAttribute("data-loaded");
  4528. if (annotationLayerNode) {
  4529. this.annotationLayer.hide();
  4530. }
  4531. if (xfaLayerNode) {
  4532. this.xfaLayer.hide();
  4533. }
  4534. if (!zoomLayerNode) {
  4535. if (this.canvas) {
  4536. this.paintedViewportMap["delete"](this.canvas);
  4537. this.canvas.width = 0;
  4538. this.canvas.height = 0;
  4539. delete this.canvas;
  4540. }
  4541. this._resetZoomLayer();
  4542. }
  4543. if (this.svg) {
  4544. this.paintedViewportMap["delete"](this.svg);
  4545. delete this.svg;
  4546. }
  4547. this.loadingIconDiv = document.createElement("div");
  4548. this.loadingIconDiv.className = "loadingIcon notVisible";
  4549. if (this._isStandalone) {
  4550. this.toggleLoadingIconSpinner(true);
  4551. }
  4552. this.loadingIconDiv.setAttribute("role", "img");
  4553. this.l10n.get("loading").then(function (msg) {
  4554. var _this$loadingIconDiv;
  4555. (_this$loadingIconDiv = _this.loadingIconDiv) === null || _this$loadingIconDiv === void 0 ? void 0 : _this$loadingIconDiv.setAttribute("aria-label", msg);
  4556. });
  4557. div.appendChild(this.loadingIconDiv);
  4558. }
  4559. }, {
  4560. key: "update",
  4561. value: function update(_ref2) {
  4562. var _ref2$scale = _ref2.scale,
  4563. scale = _ref2$scale === void 0 ? 0 : _ref2$scale,
  4564. _ref2$rotation = _ref2.rotation,
  4565. rotation = _ref2$rotation === void 0 ? null : _ref2$rotation,
  4566. _ref2$optionalContent = _ref2.optionalContentConfigPromise,
  4567. optionalContentConfigPromise = _ref2$optionalContent === void 0 ? null : _ref2$optionalContent;
  4568. if (_typeof(arguments[0]) !== "object") {
  4569. console.error("PDFPageView.update called with separate parameters, please use an object instead.");
  4570. this.update({
  4571. scale: arguments[0],
  4572. rotation: arguments[1],
  4573. optionalContentConfigPromise: arguments[2]
  4574. });
  4575. return;
  4576. }
  4577. this.scale = scale || this.scale;
  4578. if (typeof rotation === "number") {
  4579. this.rotation = rotation;
  4580. }
  4581. if (optionalContentConfigPromise instanceof Promise) {
  4582. this._optionalContentConfigPromise = optionalContentConfigPromise;
  4583. }
  4584. var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
  4585. var viewportScale = this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
  4586. this.viewport = this.viewport.clone({
  4587. scale: viewportScale,
  4588. rotation: totalRotation
  4589. });
  4590. if (this._isStandalone) {
  4591. var style = document.documentElement.style;
  4592. style.setProperty("--zoom-factor", this.scale);
  4593. style.setProperty("--viewport-scale-factor", viewportScale);
  4594. }
  4595. if (this.svg) {
  4596. this.cssTransform({
  4597. target: this.svg,
  4598. redrawAnnotationLayer: true,
  4599. redrawXfaLayer: true
  4600. });
  4601. this.eventBus.dispatch("pagerendered", {
  4602. source: this,
  4603. pageNumber: this.id,
  4604. cssTransform: true,
  4605. timestamp: performance.now(),
  4606. error: this._renderError
  4607. });
  4608. return;
  4609. }
  4610. var isScalingRestricted = false;
  4611. if (this.canvas && this.maxCanvasPixels > 0) {
  4612. var outputScale = this.outputScale;
  4613. if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) {
  4614. isScalingRestricted = true;
  4615. }
  4616. }
  4617. if (this.canvas) {
  4618. if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
  4619. this.cssTransform({
  4620. target: this.canvas,
  4621. redrawAnnotationLayer: true,
  4622. redrawXfaLayer: true
  4623. });
  4624. this.eventBus.dispatch("pagerendered", {
  4625. source: this,
  4626. pageNumber: this.id,
  4627. cssTransform: true,
  4628. timestamp: performance.now(),
  4629. error: this._renderError
  4630. });
  4631. return;
  4632. }
  4633. if (!this.zoomLayer && !this.canvas.hidden) {
  4634. this.zoomLayer = this.canvas.parentNode;
  4635. this.zoomLayer.style.position = "absolute";
  4636. }
  4637. }
  4638. if (this.zoomLayer) {
  4639. this.cssTransform({
  4640. target: this.zoomLayer.firstChild
  4641. });
  4642. }
  4643. this.reset({
  4644. keepZoomLayer: true,
  4645. keepAnnotationLayer: true,
  4646. keepXfaLayer: true
  4647. });
  4648. }
  4649. }, {
  4650. key: "cancelRendering",
  4651. value: function cancelRendering() {
  4652. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4653. _ref3$keepAnnotationL = _ref3.keepAnnotationLayer,
  4654. keepAnnotationLayer = _ref3$keepAnnotationL === void 0 ? false : _ref3$keepAnnotationL,
  4655. _ref3$keepXfaLayer = _ref3.keepXfaLayer,
  4656. keepXfaLayer = _ref3$keepXfaLayer === void 0 ? false : _ref3$keepXfaLayer;
  4657. if (this.paintTask) {
  4658. this.paintTask.cancel();
  4659. this.paintTask = null;
  4660. }
  4661. this.resume = null;
  4662. if (this.textLayer) {
  4663. this.textLayer.cancel();
  4664. this.textLayer = null;
  4665. }
  4666. if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
  4667. this.annotationLayer.cancel();
  4668. this.annotationLayer = null;
  4669. this._annotationCanvasMap = null;
  4670. }
  4671. if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
  4672. var _this$textHighlighter;
  4673. this.xfaLayer.cancel();
  4674. this.xfaLayer = null;
  4675. (_this$textHighlighter = this.textHighlighter) === null || _this$textHighlighter === void 0 ? void 0 : _this$textHighlighter.disable();
  4676. }
  4677. if (this._onTextLayerRendered) {
  4678. this.eventBus._off("textlayerrendered", this._onTextLayerRendered);
  4679. this._onTextLayerRendered = null;
  4680. }
  4681. }
  4682. }, {
  4683. key: "cssTransform",
  4684. value: function cssTransform(_ref4) {
  4685. var target = _ref4.target,
  4686. _ref4$redrawAnnotatio = _ref4.redrawAnnotationLayer,
  4687. redrawAnnotationLayer = _ref4$redrawAnnotatio === void 0 ? false : _ref4$redrawAnnotatio,
  4688. _ref4$redrawXfaLayer = _ref4.redrawXfaLayer,
  4689. redrawXfaLayer = _ref4$redrawXfaLayer === void 0 ? false : _ref4$redrawXfaLayer;
  4690. var width = this.viewport.width;
  4691. var height = this.viewport.height;
  4692. var div = this.div;
  4693. target.style.width = target.parentNode.style.width = div.style.width = Math.floor(width) + "px";
  4694. target.style.height = target.parentNode.style.height = div.style.height = Math.floor(height) + "px";
  4695. var relativeRotation = this.viewport.rotation - this.paintedViewportMap.get(target).rotation;
  4696. var absRotation = Math.abs(relativeRotation);
  4697. var scaleX = 1,
  4698. scaleY = 1;
  4699. if (absRotation === 90 || absRotation === 270) {
  4700. scaleX = height / width;
  4701. scaleY = width / height;
  4702. }
  4703. target.style.transform = "rotate(".concat(relativeRotation, "deg) scale(").concat(scaleX, ", ").concat(scaleY, ")");
  4704. if (this.textLayer) {
  4705. var textLayerViewport = this.textLayer.viewport;
  4706. var textRelativeRotation = this.viewport.rotation - textLayerViewport.rotation;
  4707. var textAbsRotation = Math.abs(textRelativeRotation);
  4708. var scale = width / textLayerViewport.width;
  4709. if (textAbsRotation === 90 || textAbsRotation === 270) {
  4710. scale = width / textLayerViewport.height;
  4711. }
  4712. var textLayerDiv = this.textLayer.textLayerDiv;
  4713. var transX, transY;
  4714. switch (textAbsRotation) {
  4715. case 0:
  4716. transX = transY = 0;
  4717. break;
  4718. case 90:
  4719. transX = 0;
  4720. transY = "-" + textLayerDiv.style.height;
  4721. break;
  4722. case 180:
  4723. transX = "-" + textLayerDiv.style.width;
  4724. transY = "-" + textLayerDiv.style.height;
  4725. break;
  4726. case 270:
  4727. transX = "-" + textLayerDiv.style.width;
  4728. transY = 0;
  4729. break;
  4730. default:
  4731. console.error("Bad rotation value.");
  4732. break;
  4733. }
  4734. textLayerDiv.style.transform = "rotate(".concat(textAbsRotation, "deg) ") + "scale(".concat(scale, ") ") + "translate(".concat(transX, ", ").concat(transY, ")");
  4735. textLayerDiv.style.transformOrigin = "0% 0%";
  4736. }
  4737. if (redrawAnnotationLayer && this.annotationLayer) {
  4738. this._renderAnnotationLayer();
  4739. }
  4740. if (redrawXfaLayer && this.xfaLayer) {
  4741. this._renderXfaLayer();
  4742. }
  4743. }
  4744. }, {
  4745. key: "width",
  4746. get: function get() {
  4747. return this.viewport.width;
  4748. }
  4749. }, {
  4750. key: "height",
  4751. get: function get() {
  4752. return this.viewport.height;
  4753. }
  4754. }, {
  4755. key: "getPagePoint",
  4756. value: function getPagePoint(x, y) {
  4757. return this.viewport.convertToPdfPoint(x, y);
  4758. }
  4759. }, {
  4760. key: "toggleLoadingIconSpinner",
  4761. value: function toggleLoadingIconSpinner() {
  4762. var _this$loadingIconDiv2;
  4763. var viewVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4764. (_this$loadingIconDiv2 = this.loadingIconDiv) === null || _this$loadingIconDiv2 === void 0 ? void 0 : _this$loadingIconDiv2.classList.toggle("notVisible", !viewVisible);
  4765. }
  4766. }, {
  4767. key: "draw",
  4768. value: function draw() {
  4769. var _this$annotationLayer2,
  4770. _this$xfaLayer2,
  4771. _this2 = this;
  4772. if (this.renderingState !== _ui_utils.RenderingStates.INITIAL) {
  4773. console.error("Must be in new state before drawing");
  4774. this.reset();
  4775. }
  4776. var div = this.div,
  4777. pdfPage = this.pdfPage;
  4778. if (!pdfPage) {
  4779. this.renderingState = _ui_utils.RenderingStates.FINISHED;
  4780. if (this.loadingIconDiv) {
  4781. this.loadingIconDiv.remove();
  4782. delete this.loadingIconDiv;
  4783. }
  4784. return Promise.reject(new Error("pdfPage is not loaded"));
  4785. }
  4786. this.renderingState = _ui_utils.RenderingStates.RUNNING;
  4787. var canvasWrapper = document.createElement("div");
  4788. canvasWrapper.style.width = div.style.width;
  4789. canvasWrapper.style.height = div.style.height;
  4790. canvasWrapper.classList.add("canvasWrapper");
  4791. if ((_this$annotationLayer2 = this.annotationLayer) !== null && _this$annotationLayer2 !== void 0 && _this$annotationLayer2.div) {
  4792. div.insertBefore(canvasWrapper, this.annotationLayer.div);
  4793. } else {
  4794. div.appendChild(canvasWrapper);
  4795. }
  4796. var textLayer = null;
  4797. if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) {
  4798. var _this$annotationLayer3;
  4799. var textLayerDiv = document.createElement("div");
  4800. textLayerDiv.className = "textLayer";
  4801. textLayerDiv.style.width = canvasWrapper.style.width;
  4802. textLayerDiv.style.height = canvasWrapper.style.height;
  4803. if ((_this$annotationLayer3 = this.annotationLayer) !== null && _this$annotationLayer3 !== void 0 && _this$annotationLayer3.div) {
  4804. div.insertBefore(textLayerDiv, this.annotationLayer.div);
  4805. } else {
  4806. div.appendChild(textLayerDiv);
  4807. }
  4808. textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus, this.textHighlighter);
  4809. }
  4810. this.textLayer = textLayer;
  4811. if (_classPrivateFieldGet(this, _annotationMode) !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
  4812. this._annotationCanvasMap || (this._annotationCanvasMap = new Map());
  4813. 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));
  4814. }
  4815. if ((_this$xfaLayer2 = this.xfaLayer) !== null && _this$xfaLayer2 !== void 0 && _this$xfaLayer2.div) {
  4816. div.appendChild(this.xfaLayer.div);
  4817. }
  4818. var renderContinueCallback = null;
  4819. if (this.renderingQueue) {
  4820. renderContinueCallback = function renderContinueCallback(cont) {
  4821. if (!_this2.renderingQueue.isHighestPriority(_this2)) {
  4822. _this2.renderingState = _ui_utils.RenderingStates.PAUSED;
  4823. _this2.resume = function () {
  4824. _this2.renderingState = _ui_utils.RenderingStates.RUNNING;
  4825. cont();
  4826. };
  4827. return;
  4828. }
  4829. cont();
  4830. };
  4831. }
  4832. var finishPaintTask = /*#__PURE__*/function () {
  4833. var _ref5 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  4834. var error,
  4835. _args4 = arguments;
  4836. return _regenerator["default"].wrap(function _callee4$(_context4) {
  4837. while (1) {
  4838. switch (_context4.prev = _context4.next) {
  4839. case 0:
  4840. error = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
  4841. if (paintTask === _this2.paintTask) {
  4842. _this2.paintTask = null;
  4843. }
  4844. if (!(error instanceof _pdfjsLib.RenderingCancelledException)) {
  4845. _context4.next = 5;
  4846. break;
  4847. }
  4848. _this2._renderError = null;
  4849. return _context4.abrupt("return");
  4850. case 5:
  4851. _this2._renderError = error;
  4852. _this2.renderingState = _ui_utils.RenderingStates.FINISHED;
  4853. if (_this2.loadingIconDiv) {
  4854. _this2.loadingIconDiv.remove();
  4855. delete _this2.loadingIconDiv;
  4856. }
  4857. _this2._resetZoomLayer(true);
  4858. _this2.eventBus.dispatch("pagerendered", {
  4859. source: _this2,
  4860. pageNumber: _this2.id,
  4861. cssTransform: false,
  4862. timestamp: performance.now(),
  4863. error: _this2._renderError
  4864. });
  4865. if (!error) {
  4866. _context4.next = 12;
  4867. break;
  4868. }
  4869. throw error;
  4870. case 12:
  4871. case "end":
  4872. return _context4.stop();
  4873. }
  4874. }
  4875. }, _callee4);
  4876. }));
  4877. return function finishPaintTask() {
  4878. return _ref5.apply(this, arguments);
  4879. };
  4880. }();
  4881. var paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper);
  4882. paintTask.onRenderContinue = renderContinueCallback;
  4883. this.paintTask = paintTask;
  4884. var resultPromise = paintTask.promise.then(function () {
  4885. return finishPaintTask(null).then(function () {
  4886. if (textLayer) {
  4887. var readableStream = pdfPage.streamTextContent({
  4888. normalizeWhitespace: true,
  4889. includeMarkedContent: true
  4890. });
  4891. textLayer.setTextContentStream(readableStream);
  4892. textLayer.render();
  4893. }
  4894. if (_this2.annotationLayer) {
  4895. _this2._renderAnnotationLayer();
  4896. }
  4897. });
  4898. }, function (reason) {
  4899. return finishPaintTask(reason);
  4900. });
  4901. if (this.xfaLayerFactory) {
  4902. if (!this.xfaLayer) {
  4903. this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(div, pdfPage, null);
  4904. }
  4905. this._renderXfaLayer();
  4906. }
  4907. if (this.structTreeLayerFactory && this.textLayer && this.canvas) {
  4908. this._onTextLayerRendered = function (event) {
  4909. if (event.pageNumber !== _this2.id) {
  4910. return;
  4911. }
  4912. _this2.eventBus._off("textlayerrendered", _this2._onTextLayerRendered);
  4913. _this2._onTextLayerRendered = null;
  4914. if (!_this2.canvas) {
  4915. return;
  4916. }
  4917. _this2.pdfPage.getStructTree().then(function (tree) {
  4918. if (!tree) {
  4919. return;
  4920. }
  4921. if (!_this2.canvas) {
  4922. return;
  4923. }
  4924. var treeDom = _this2.structTreeLayer.render(tree);
  4925. treeDom.classList.add("structTree");
  4926. _this2.canvas.appendChild(treeDom);
  4927. });
  4928. };
  4929. this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
  4930. this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
  4931. }
  4932. div.setAttribute("data-loaded", true);
  4933. this.eventBus.dispatch("pagerender", {
  4934. source: this,
  4935. pageNumber: this.id
  4936. });
  4937. return resultPromise;
  4938. }
  4939. }, {
  4940. key: "paintOnCanvas",
  4941. value: function paintOnCanvas(canvasWrapper) {
  4942. var renderCapability = (0, _pdfjsLib.createPromiseCapability)();
  4943. var result = {
  4944. promise: renderCapability.promise,
  4945. onRenderContinue: function onRenderContinue(cont) {
  4946. cont();
  4947. },
  4948. cancel: function cancel() {
  4949. renderTask.cancel();
  4950. }
  4951. };
  4952. var viewport = this.viewport;
  4953. var canvas = document.createElement("canvas");
  4954. canvas.hidden = true;
  4955. var isCanvasHidden = true;
  4956. var showCanvas = function showCanvas() {
  4957. if (isCanvasHidden) {
  4958. canvas.hidden = false;
  4959. isCanvasHidden = false;
  4960. }
  4961. };
  4962. canvasWrapper.appendChild(canvas);
  4963. this.canvas = canvas;
  4964. canvas.mozOpaque = true;
  4965. var ctx = canvas.getContext("2d", {
  4966. alpha: false
  4967. });
  4968. var outputScale = (0, _ui_utils.getOutputScale)(ctx);
  4969. this.outputScale = outputScale;
  4970. if (this.useOnlyCssZoom) {
  4971. var actualSizeViewport = viewport.clone({
  4972. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  4973. });
  4974. outputScale.sx *= actualSizeViewport.width / viewport.width;
  4975. outputScale.sy *= actualSizeViewport.height / viewport.height;
  4976. outputScale.scaled = true;
  4977. }
  4978. if (this.maxCanvasPixels > 0) {
  4979. var pixelsInViewport = viewport.width * viewport.height;
  4980. var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
  4981. if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
  4982. outputScale.sx = maxScale;
  4983. outputScale.sy = maxScale;
  4984. outputScale.scaled = true;
  4985. this.hasRestrictedScaling = true;
  4986. } else {
  4987. this.hasRestrictedScaling = false;
  4988. }
  4989. }
  4990. var sfx = (0, _ui_utils.approximateFraction)(outputScale.sx);
  4991. var sfy = (0, _ui_utils.approximateFraction)(outputScale.sy);
  4992. canvas.width = (0, _ui_utils.roundToDivide)(viewport.width * outputScale.sx, sfx[0]);
  4993. canvas.height = (0, _ui_utils.roundToDivide)(viewport.height * outputScale.sy, sfy[0]);
  4994. canvas.style.width = (0, _ui_utils.roundToDivide)(viewport.width, sfx[1]) + "px";
  4995. canvas.style.height = (0, _ui_utils.roundToDivide)(viewport.height, sfy[1]) + "px";
  4996. this.paintedViewportMap.set(canvas, viewport);
  4997. var transform = !outputScale.scaled ? null : [outputScale.sx, 0, 0, outputScale.sy, 0, 0];
  4998. var renderContext = {
  4999. canvasContext: ctx,
  5000. transform: transform,
  5001. viewport: this.viewport,
  5002. annotationMode: _classPrivateFieldGet(this, _annotationMode),
  5003. optionalContentConfigPromise: this._optionalContentConfigPromise,
  5004. annotationCanvasMap: this._annotationCanvasMap
  5005. };
  5006. var renderTask = this.pdfPage.render(renderContext);
  5007. renderTask.onContinue = function (cont) {
  5008. showCanvas();
  5009. if (result.onRenderContinue) {
  5010. result.onRenderContinue(cont);
  5011. } else {
  5012. cont();
  5013. }
  5014. };
  5015. renderTask.promise.then(function () {
  5016. showCanvas();
  5017. renderCapability.resolve();
  5018. }, function (error) {
  5019. showCanvas();
  5020. renderCapability.reject(error);
  5021. });
  5022. return result;
  5023. }
  5024. }, {
  5025. key: "paintOnSvg",
  5026. value: function paintOnSvg(wrapper) {
  5027. var _this3 = this;
  5028. var cancelled = false;
  5029. var ensureNotCancelled = function ensureNotCancelled() {
  5030. if (cancelled) {
  5031. throw new _pdfjsLib.RenderingCancelledException("Rendering cancelled, page ".concat(_this3.id), "svg");
  5032. }
  5033. };
  5034. var pdfPage = this.pdfPage;
  5035. var actualSizeViewport = this.viewport.clone({
  5036. scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
  5037. });
  5038. var promise = pdfPage.getOperatorList({
  5039. annotationMode: _classPrivateFieldGet(this, _annotationMode)
  5040. }).then(function (opList) {
  5041. ensureNotCancelled();
  5042. var svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs, _app_options.compatibilityParams.disableCreateObjectURL);
  5043. return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {
  5044. ensureNotCancelled();
  5045. _this3.svg = svg;
  5046. _this3.paintedViewportMap.set(svg, actualSizeViewport);
  5047. svg.style.width = wrapper.style.width;
  5048. svg.style.height = wrapper.style.height;
  5049. _this3.renderingState = _ui_utils.RenderingStates.FINISHED;
  5050. wrapper.appendChild(svg);
  5051. });
  5052. });
  5053. return {
  5054. promise: promise,
  5055. onRenderContinue: function onRenderContinue(cont) {
  5056. cont();
  5057. },
  5058. cancel: function cancel() {
  5059. cancelled = true;
  5060. }
  5061. };
  5062. }
  5063. }, {
  5064. key: "setPageLabel",
  5065. value: function setPageLabel(label) {
  5066. this.pageLabel = typeof label === "string" ? label : null;
  5067. if (this.pageLabel !== null) {
  5068. this.div.setAttribute("data-page-label", this.pageLabel);
  5069. } else {
  5070. this.div.removeAttribute("data-page-label");
  5071. }
  5072. }
  5073. }]);
  5074. return PDFPageView;
  5075. }();
  5076. exports.PDFPageView = PDFPageView;
  5077. /***/ }),
  5078. /* 15 */
  5079. /***/ ((__unused_webpack_module, exports) => {
  5080. Object.defineProperty(exports, "__esModule", ({
  5081. value: true
  5082. }));
  5083. exports.compatibilityParams = exports.OptionKind = exports.AppOptions = void 0;
  5084. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  5085. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5086. 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); } }
  5087. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5088. var compatibilityParams = Object.create(null);
  5089. exports.compatibilityParams = compatibilityParams;
  5090. {
  5091. var userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
  5092. var platform = typeof navigator !== "undefined" && navigator.platform || "";
  5093. var maxTouchPoints = typeof navigator !== "undefined" && navigator.maxTouchPoints || 1;
  5094. var isAndroid = /Android/.test(userAgent);
  5095. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1;
  5096. var isIOSChrome = /CriOS/.test(userAgent);
  5097. (function checkOnBlobSupport() {
  5098. if (isIOSChrome) {
  5099. compatibilityParams.disableCreateObjectURL = true;
  5100. }
  5101. })();
  5102. (function checkCanvasSizeLimitation() {
  5103. if (isIOS || isAndroid) {
  5104. compatibilityParams.maxCanvasPixels = 5242880;
  5105. }
  5106. })();
  5107. }
  5108. var OptionKind = {
  5109. VIEWER: 0x02,
  5110. API: 0x04,
  5111. WORKER: 0x08,
  5112. PREFERENCE: 0x80
  5113. };
  5114. exports.OptionKind = OptionKind;
  5115. var defaultOptions = {
  5116. annotationMode: {
  5117. value: 2,
  5118. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5119. },
  5120. cursorToolOnLoad: {
  5121. value: 0,
  5122. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5123. },
  5124. defaultUrl: {
  5125. value: "compressed.tracemonkey-pldi-09.pdf",
  5126. kind: OptionKind.VIEWER
  5127. },
  5128. defaultZoomValue: {
  5129. value: "",
  5130. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5131. },
  5132. disableHistory: {
  5133. value: false,
  5134. kind: OptionKind.VIEWER
  5135. },
  5136. disablePageLabels: {
  5137. value: false,
  5138. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5139. },
  5140. enablePermissions: {
  5141. value: false,
  5142. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5143. },
  5144. enablePrintAutoRotate: {
  5145. value: true,
  5146. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5147. },
  5148. enableScripting: {
  5149. value: true,
  5150. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5151. },
  5152. externalLinkRel: {
  5153. value: "noopener noreferrer nofollow",
  5154. kind: OptionKind.VIEWER
  5155. },
  5156. externalLinkTarget: {
  5157. value: 0,
  5158. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5159. },
  5160. historyUpdateUrl: {
  5161. value: false,
  5162. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5163. },
  5164. ignoreDestinationZoom: {
  5165. value: false,
  5166. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5167. },
  5168. imageResourcesPath: {
  5169. value: "./images/",
  5170. kind: OptionKind.VIEWER
  5171. },
  5172. maxCanvasPixels: {
  5173. value: 16777216,
  5174. compatibility: compatibilityParams.maxCanvasPixels,
  5175. kind: OptionKind.VIEWER
  5176. },
  5177. pdfBugEnabled: {
  5178. value: false,
  5179. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5180. },
  5181. printResolution: {
  5182. value: 150,
  5183. kind: OptionKind.VIEWER
  5184. },
  5185. renderer: {
  5186. value: "canvas",
  5187. kind: OptionKind.VIEWER
  5188. },
  5189. sidebarViewOnLoad: {
  5190. value: -1,
  5191. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5192. },
  5193. scrollModeOnLoad: {
  5194. value: -1,
  5195. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5196. },
  5197. spreadModeOnLoad: {
  5198. value: -1,
  5199. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5200. },
  5201. textLayerMode: {
  5202. value: 1,
  5203. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5204. },
  5205. useOnlyCssZoom: {
  5206. value: false,
  5207. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5208. },
  5209. viewerCssTheme: {
  5210. value: 0,
  5211. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5212. },
  5213. viewOnLoad: {
  5214. value: 0,
  5215. kind: OptionKind.VIEWER + OptionKind.PREFERENCE
  5216. },
  5217. cMapPacked: {
  5218. value: true,
  5219. kind: OptionKind.API
  5220. },
  5221. cMapUrl: {
  5222. value: "../web/cmaps/",
  5223. kind: OptionKind.API
  5224. },
  5225. disableAutoFetch: {
  5226. value: false,
  5227. kind: OptionKind.API + OptionKind.PREFERENCE
  5228. },
  5229. disableFontFace: {
  5230. value: false,
  5231. kind: OptionKind.API + OptionKind.PREFERENCE
  5232. },
  5233. disableRange: {
  5234. value: false,
  5235. kind: OptionKind.API + OptionKind.PREFERENCE
  5236. },
  5237. disableStream: {
  5238. value: false,
  5239. kind: OptionKind.API + OptionKind.PREFERENCE
  5240. },
  5241. docBaseUrl: {
  5242. value: "",
  5243. kind: OptionKind.API
  5244. },
  5245. enableXfa: {
  5246. value: true,
  5247. kind: OptionKind.API + OptionKind.PREFERENCE
  5248. },
  5249. fontExtraProperties: {
  5250. value: false,
  5251. kind: OptionKind.API
  5252. },
  5253. isEvalSupported: {
  5254. value: true,
  5255. kind: OptionKind.API
  5256. },
  5257. maxImageSize: {
  5258. value: -1,
  5259. kind: OptionKind.API
  5260. },
  5261. pdfBug: {
  5262. value: false,
  5263. kind: OptionKind.API
  5264. },
  5265. standardFontDataUrl: {
  5266. value: "../web/standard_fonts/",
  5267. kind: OptionKind.API
  5268. },
  5269. verbosity: {
  5270. value: 1,
  5271. kind: OptionKind.API
  5272. },
  5273. workerPort: {
  5274. value: null,
  5275. kind: OptionKind.WORKER
  5276. },
  5277. workerSrc: {
  5278. value: "../build/pdf.worker.js",
  5279. kind: OptionKind.WORKER
  5280. }
  5281. };
  5282. {
  5283. defaultOptions.disablePreferences = {
  5284. value: false,
  5285. kind: OptionKind.VIEWER
  5286. };
  5287. defaultOptions.locale = {
  5288. value: typeof navigator !== "undefined" ? navigator.language : "en-US",
  5289. kind: OptionKind.VIEWER
  5290. };
  5291. defaultOptions.sandboxBundleSrc = {
  5292. value: "../build/pdf.sandbox.js",
  5293. kind: OptionKind.VIEWER
  5294. };
  5295. defaultOptions.renderer.kind += OptionKind.PREFERENCE;
  5296. }
  5297. var userOptions = Object.create(null);
  5298. var AppOptions = /*#__PURE__*/function () {
  5299. function AppOptions() {
  5300. _classCallCheck(this, AppOptions);
  5301. throw new Error("Cannot initialize AppOptions.");
  5302. }
  5303. _createClass(AppOptions, null, [{
  5304. key: "get",
  5305. value: function get(name) {
  5306. var userOption = userOptions[name];
  5307. if (userOption !== undefined) {
  5308. return userOption;
  5309. }
  5310. var defaultOption = defaultOptions[name];
  5311. if (defaultOption !== undefined) {
  5312. var _defaultOption$compat;
  5313. return (_defaultOption$compat = defaultOption.compatibility) !== null && _defaultOption$compat !== void 0 ? _defaultOption$compat : defaultOption.value;
  5314. }
  5315. return undefined;
  5316. }
  5317. }, {
  5318. key: "getAll",
  5319. value: function getAll() {
  5320. var kind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  5321. var options = Object.create(null);
  5322. for (var name in defaultOptions) {
  5323. var _defaultOption$compat2;
  5324. var defaultOption = defaultOptions[name];
  5325. if (kind) {
  5326. if ((kind & defaultOption.kind) === 0) {
  5327. continue;
  5328. }
  5329. if (kind === OptionKind.PREFERENCE) {
  5330. var value = defaultOption.value,
  5331. valueType = _typeof(value);
  5332. if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) {
  5333. options[name] = value;
  5334. continue;
  5335. }
  5336. throw new Error("Invalid type for preference: ".concat(name));
  5337. }
  5338. }
  5339. var userOption = userOptions[name];
  5340. options[name] = userOption !== undefined ? userOption : (_defaultOption$compat2 = defaultOption.compatibility) !== null && _defaultOption$compat2 !== void 0 ? _defaultOption$compat2 : defaultOption.value;
  5341. }
  5342. return options;
  5343. }
  5344. }, {
  5345. key: "set",
  5346. value: function set(name, value) {
  5347. userOptions[name] = value;
  5348. }
  5349. }, {
  5350. key: "setAll",
  5351. value: function setAll(options) {
  5352. for (var name in options) {
  5353. userOptions[name] = options[name];
  5354. }
  5355. }
  5356. }, {
  5357. key: "remove",
  5358. value: function remove(name) {
  5359. delete userOptions[name];
  5360. }
  5361. }, {
  5362. key: "_hasUserOptions",
  5363. value: function _hasUserOptions() {
  5364. return Object.keys(userOptions).length > 0;
  5365. }
  5366. }]);
  5367. return AppOptions;
  5368. }();
  5369. exports.AppOptions = AppOptions;
  5370. /***/ }),
  5371. /* 16 */
  5372. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5373. Object.defineProperty(exports, "__esModule", ({
  5374. value: true
  5375. }));
  5376. exports.PDFRenderingQueue = void 0;
  5377. var _pdfjsLib = __w_pdfjs_require__(5);
  5378. var _ui_utils = __w_pdfjs_require__(8);
  5379. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5380. 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); } }
  5381. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5382. var CLEANUP_TIMEOUT = 30000;
  5383. var PDFRenderingQueue = /*#__PURE__*/function () {
  5384. function PDFRenderingQueue() {
  5385. _classCallCheck(this, PDFRenderingQueue);
  5386. this.pdfViewer = null;
  5387. this.pdfThumbnailViewer = null;
  5388. this.onIdle = null;
  5389. this.highestPriorityPage = null;
  5390. this.idleTimeout = null;
  5391. this.printing = false;
  5392. this.isThumbnailViewEnabled = false;
  5393. }
  5394. _createClass(PDFRenderingQueue, [{
  5395. key: "setViewer",
  5396. value: function setViewer(pdfViewer) {
  5397. this.pdfViewer = pdfViewer;
  5398. }
  5399. }, {
  5400. key: "setThumbnailViewer",
  5401. value: function setThumbnailViewer(pdfThumbnailViewer) {
  5402. this.pdfThumbnailViewer = pdfThumbnailViewer;
  5403. }
  5404. }, {
  5405. key: "isHighestPriority",
  5406. value: function isHighestPriority(view) {
  5407. return this.highestPriorityPage === view.renderingId;
  5408. }
  5409. }, {
  5410. key: "hasViewer",
  5411. value: function hasViewer() {
  5412. return !!this.pdfViewer;
  5413. }
  5414. }, {
  5415. key: "renderHighestPriority",
  5416. value: function renderHighestPriority(currentlyVisiblePages) {
  5417. var _this$pdfThumbnailVie;
  5418. if (this.idleTimeout) {
  5419. clearTimeout(this.idleTimeout);
  5420. this.idleTimeout = null;
  5421. }
  5422. if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
  5423. return;
  5424. }
  5425. if (this.isThumbnailViewEnabled && (_this$pdfThumbnailVie = this.pdfThumbnailViewer) !== null && _this$pdfThumbnailVie !== void 0 && _this$pdfThumbnailVie.forceRendering()) {
  5426. return;
  5427. }
  5428. if (this.printing) {
  5429. return;
  5430. }
  5431. if (this.onIdle) {
  5432. this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
  5433. }
  5434. }
  5435. }, {
  5436. key: "getHighestPriority",
  5437. value: function getHighestPriority(visible, views, scrolledDown) {
  5438. var preRenderExtra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  5439. var visibleViews = visible.views,
  5440. numVisible = visibleViews.length;
  5441. if (numVisible === 0) {
  5442. return null;
  5443. }
  5444. for (var i = 0; i < numVisible; i++) {
  5445. var view = visibleViews[i].view;
  5446. if (!this.isViewFinished(view)) {
  5447. return view;
  5448. }
  5449. }
  5450. var firstId = visible.first.id,
  5451. lastId = visible.last.id;
  5452. if (lastId - firstId + 1 > numVisible) {
  5453. var visibleIds = visible.ids;
  5454. for (var _i = 1, ii = lastId - firstId; _i < ii; _i++) {
  5455. var holeId = scrolledDown ? firstId + _i : lastId - _i;
  5456. if (visibleIds.has(holeId)) {
  5457. continue;
  5458. }
  5459. var holeView = views[holeId - 1];
  5460. if (!this.isViewFinished(holeView)) {
  5461. return holeView;
  5462. }
  5463. }
  5464. }
  5465. var preRenderIndex = scrolledDown ? lastId : firstId - 2;
  5466. var preRenderView = views[preRenderIndex];
  5467. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5468. return preRenderView;
  5469. }
  5470. if (preRenderExtra) {
  5471. preRenderIndex += scrolledDown ? 1 : -1;
  5472. preRenderView = views[preRenderIndex];
  5473. if (preRenderView && !this.isViewFinished(preRenderView)) {
  5474. return preRenderView;
  5475. }
  5476. }
  5477. return null;
  5478. }
  5479. }, {
  5480. key: "isViewFinished",
  5481. value: function isViewFinished(view) {
  5482. return view.renderingState === _ui_utils.RenderingStates.FINISHED;
  5483. }
  5484. }, {
  5485. key: "renderView",
  5486. value: function renderView(view) {
  5487. var _this = this;
  5488. switch (view.renderingState) {
  5489. case _ui_utils.RenderingStates.FINISHED:
  5490. return false;
  5491. case _ui_utils.RenderingStates.PAUSED:
  5492. this.highestPriorityPage = view.renderingId;
  5493. view.resume();
  5494. break;
  5495. case _ui_utils.RenderingStates.RUNNING:
  5496. this.highestPriorityPage = view.renderingId;
  5497. break;
  5498. case _ui_utils.RenderingStates.INITIAL:
  5499. this.highestPriorityPage = view.renderingId;
  5500. view.draw()["finally"](function () {
  5501. _this.renderHighestPriority();
  5502. })["catch"](function (reason) {
  5503. if (reason instanceof _pdfjsLib.RenderingCancelledException) {
  5504. return;
  5505. }
  5506. console.error("renderView: \"".concat(reason, "\""));
  5507. });
  5508. break;
  5509. }
  5510. return true;
  5511. }
  5512. }]);
  5513. return PDFRenderingQueue;
  5514. }();
  5515. exports.PDFRenderingQueue = PDFRenderingQueue;
  5516. /***/ }),
  5517. /* 17 */
  5518. /***/ ((__unused_webpack_module, exports) => {
  5519. Object.defineProperty(exports, "__esModule", ({
  5520. value: true
  5521. }));
  5522. exports.TextHighlighter = void 0;
  5523. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5524. 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); } }
  5525. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5526. var TextHighlighter = /*#__PURE__*/function () {
  5527. function TextHighlighter(_ref) {
  5528. var findController = _ref.findController,
  5529. eventBus = _ref.eventBus,
  5530. pageIndex = _ref.pageIndex;
  5531. _classCallCheck(this, TextHighlighter);
  5532. this.findController = findController;
  5533. this.matches = [];
  5534. this.eventBus = eventBus;
  5535. this.pageIdx = pageIndex;
  5536. this._onUpdateTextLayerMatches = null;
  5537. this.textDivs = null;
  5538. this.textContentItemsStr = null;
  5539. this.enabled = false;
  5540. }
  5541. _createClass(TextHighlighter, [{
  5542. key: "setTextMapping",
  5543. value: function setTextMapping(divs, texts) {
  5544. this.textDivs = divs;
  5545. this.textContentItemsStr = texts;
  5546. }
  5547. }, {
  5548. key: "enable",
  5549. value: function enable() {
  5550. var _this = this;
  5551. if (!this.textDivs || !this.textContentItemsStr) {
  5552. throw new Error("Text divs and strings have not been set.");
  5553. }
  5554. if (this.enabled) {
  5555. throw new Error("TextHighlighter is already enabled.");
  5556. }
  5557. this.enabled = true;
  5558. if (!this._onUpdateTextLayerMatches) {
  5559. this._onUpdateTextLayerMatches = function (evt) {
  5560. if (evt.pageIndex === _this.pageIdx || evt.pageIndex === -1) {
  5561. _this._updateMatches();
  5562. }
  5563. };
  5564. this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
  5565. }
  5566. this._updateMatches();
  5567. }
  5568. }, {
  5569. key: "disable",
  5570. value: function disable() {
  5571. if (!this.enabled) {
  5572. return;
  5573. }
  5574. this.enabled = false;
  5575. if (this._onUpdateTextLayerMatches) {
  5576. this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
  5577. this._onUpdateTextLayerMatches = null;
  5578. }
  5579. }
  5580. }, {
  5581. key: "_convertMatches",
  5582. value: function _convertMatches(matches, matchesLength) {
  5583. if (!matches) {
  5584. return [];
  5585. }
  5586. var textContentItemsStr = this.textContentItemsStr;
  5587. var i = 0,
  5588. iIndex = 0;
  5589. var end = textContentItemsStr.length - 1;
  5590. var result = [];
  5591. for (var m = 0, mm = matches.length; m < mm; m++) {
  5592. var matchIdx = matches[m];
  5593. while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {
  5594. iIndex += textContentItemsStr[i].length;
  5595. i++;
  5596. }
  5597. if (i === textContentItemsStr.length) {
  5598. console.error("Could not find a matching mapping");
  5599. }
  5600. var match = {
  5601. begin: {
  5602. divIdx: i,
  5603. offset: matchIdx - iIndex
  5604. }
  5605. };
  5606. matchIdx += matchesLength[m];
  5607. while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {
  5608. iIndex += textContentItemsStr[i].length;
  5609. i++;
  5610. }
  5611. match.end = {
  5612. divIdx: i,
  5613. offset: matchIdx - iIndex
  5614. };
  5615. result.push(match);
  5616. }
  5617. return result;
  5618. }
  5619. }, {
  5620. key: "_renderMatches",
  5621. value: function _renderMatches(matches) {
  5622. if (matches.length === 0) {
  5623. return;
  5624. }
  5625. var findController = this.findController,
  5626. pageIdx = this.pageIdx;
  5627. var textContentItemsStr = this.textContentItemsStr,
  5628. textDivs = this.textDivs;
  5629. var isSelectedPage = pageIdx === findController.selected.pageIdx;
  5630. var selectedMatchIdx = findController.selected.matchIdx;
  5631. var highlightAll = findController.state.highlightAll;
  5632. var prevEnd = null;
  5633. var infinity = {
  5634. divIdx: -1,
  5635. offset: undefined
  5636. };
  5637. function beginText(begin, className) {
  5638. var divIdx = begin.divIdx;
  5639. textDivs[divIdx].textContent = "";
  5640. return appendTextToDiv(divIdx, 0, begin.offset, className);
  5641. }
  5642. function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
  5643. var div = textDivs[divIdx];
  5644. if (div.nodeType === Node.TEXT_NODE) {
  5645. var span = document.createElement("span");
  5646. div.parentNode.insertBefore(span, div);
  5647. span.appendChild(div);
  5648. textDivs[divIdx] = span;
  5649. div = span;
  5650. }
  5651. var content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
  5652. var node = document.createTextNode(content);
  5653. if (className) {
  5654. var _span = document.createElement("span");
  5655. _span.className = "".concat(className, " appended");
  5656. _span.appendChild(node);
  5657. div.appendChild(_span);
  5658. return className.includes("selected") ? _span.offsetLeft : 0;
  5659. }
  5660. div.appendChild(node);
  5661. return 0;
  5662. }
  5663. var i0 = selectedMatchIdx,
  5664. i1 = i0 + 1;
  5665. if (highlightAll) {
  5666. i0 = 0;
  5667. i1 = matches.length;
  5668. } else if (!isSelectedPage) {
  5669. return;
  5670. }
  5671. for (var i = i0; i < i1; i++) {
  5672. var match = matches[i];
  5673. var begin = match.begin;
  5674. var end = match.end;
  5675. var isSelected = isSelectedPage && i === selectedMatchIdx;
  5676. var highlightSuffix = isSelected ? " selected" : "";
  5677. var selectedLeft = 0;
  5678. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
  5679. if (prevEnd !== null) {
  5680. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  5681. }
  5682. beginText(begin);
  5683. } else {
  5684. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
  5685. }
  5686. if (begin.divIdx === end.divIdx) {
  5687. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix);
  5688. } else {
  5689. selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix);
  5690. for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
  5691. textDivs[n0].className = "highlight middle" + highlightSuffix;
  5692. }
  5693. beginText(end, "highlight end" + highlightSuffix);
  5694. }
  5695. prevEnd = end;
  5696. if (isSelected) {
  5697. findController.scrollMatchIntoView({
  5698. element: textDivs[begin.divIdx],
  5699. selectedLeft: selectedLeft,
  5700. pageIndex: pageIdx,
  5701. matchIndex: selectedMatchIdx
  5702. });
  5703. }
  5704. }
  5705. if (prevEnd) {
  5706. appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
  5707. }
  5708. }
  5709. }, {
  5710. key: "_updateMatches",
  5711. value: function _updateMatches() {
  5712. if (!this.enabled) {
  5713. return;
  5714. }
  5715. var findController = this.findController,
  5716. matches = this.matches,
  5717. pageIdx = this.pageIdx;
  5718. var textContentItemsStr = this.textContentItemsStr,
  5719. textDivs = this.textDivs;
  5720. var clearedUntilDivIdx = -1;
  5721. for (var i = 0, ii = matches.length; i < ii; i++) {
  5722. var match = matches[i];
  5723. var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
  5724. for (var n = begin, end = match.end.divIdx; n <= end; n++) {
  5725. var div = textDivs[n];
  5726. div.textContent = textContentItemsStr[n];
  5727. div.className = "";
  5728. }
  5729. clearedUntilDivIdx = match.end.divIdx + 1;
  5730. }
  5731. if (!(findController !== null && findController !== void 0 && findController.highlightMatches)) {
  5732. return;
  5733. }
  5734. var pageMatches = findController.pageMatches[pageIdx] || null;
  5735. var pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;
  5736. this.matches = this._convertMatches(pageMatches, pageMatchesLength);
  5737. this._renderMatches(this.matches);
  5738. }
  5739. }]);
  5740. return TextHighlighter;
  5741. }();
  5742. exports.TextHighlighter = TextHighlighter;
  5743. /***/ }),
  5744. /* 18 */
  5745. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5746. Object.defineProperty(exports, "__esModule", ({
  5747. value: true
  5748. }));
  5749. exports.DownloadManager = void 0;
  5750. var _pdfjsLib = __w_pdfjs_require__(5);
  5751. var _app_options = __w_pdfjs_require__(15);
  5752. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5753. 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); } }
  5754. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5755. ;
  5756. function _download(blobUrl, filename) {
  5757. var a = document.createElement("a");
  5758. if (!a.click) {
  5759. throw new Error('DownloadManager: "a.click()" is not supported.');
  5760. }
  5761. a.href = blobUrl;
  5762. a.target = "_parent";
  5763. if ("download" in a) {
  5764. a.download = filename;
  5765. }
  5766. (document.body || document.documentElement).appendChild(a);
  5767. a.click();
  5768. a.remove();
  5769. }
  5770. var DownloadManager = /*#__PURE__*/function () {
  5771. function DownloadManager() {
  5772. _classCallCheck(this, DownloadManager);
  5773. this._openBlobUrls = new WeakMap();
  5774. }
  5775. _createClass(DownloadManager, [{
  5776. key: "downloadUrl",
  5777. value: function downloadUrl(url, filename) {
  5778. if (!(0, _pdfjsLib.createValidAbsoluteUrl)(url, "http://example.com")) {
  5779. console.error("downloadUrl - not a valid URL: ".concat(url));
  5780. return;
  5781. }
  5782. _download(url + "#pdfjs.action=download", filename);
  5783. }
  5784. }, {
  5785. key: "downloadData",
  5786. value: function downloadData(data, filename, contentType) {
  5787. var blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _app_options.compatibilityParams.disableCreateObjectURL);
  5788. _download(blobUrl, filename);
  5789. }
  5790. }, {
  5791. key: "openOrDownloadData",
  5792. value: function openOrDownloadData(element, data, filename) {
  5793. var isPdfData = (0, _pdfjsLib.isPdfFile)(filename);
  5794. var contentType = isPdfData ? "application/pdf" : "";
  5795. if (isPdfData && !_app_options.compatibilityParams.disableCreateObjectURL) {
  5796. var blobUrl = this._openBlobUrls.get(element);
  5797. if (!blobUrl) {
  5798. blobUrl = URL.createObjectURL(new Blob([data], {
  5799. type: contentType
  5800. }));
  5801. this._openBlobUrls.set(element, blobUrl);
  5802. }
  5803. var viewerUrl;
  5804. viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
  5805. try {
  5806. window.open(viewerUrl);
  5807. return true;
  5808. } catch (ex) {
  5809. console.error("openOrDownloadData: ".concat(ex));
  5810. URL.revokeObjectURL(blobUrl);
  5811. this._openBlobUrls["delete"](element);
  5812. }
  5813. }
  5814. this.downloadData(data, filename, contentType);
  5815. return false;
  5816. }
  5817. }, {
  5818. key: "download",
  5819. value: function download(blob, url, filename) {
  5820. var sourceEventType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "download";
  5821. if (_app_options.compatibilityParams.disableCreateObjectURL) {
  5822. this.downloadUrl(url, filename);
  5823. return;
  5824. }
  5825. var blobUrl = URL.createObjectURL(blob);
  5826. _download(blobUrl, filename);
  5827. }
  5828. }]);
  5829. return DownloadManager;
  5830. }();
  5831. exports.DownloadManager = DownloadManager;
  5832. /***/ }),
  5833. /* 19 */
  5834. /***/ ((__unused_webpack_module, exports) => {
  5835. Object.defineProperty(exports, "__esModule", ({
  5836. value: true
  5837. }));
  5838. exports.WaitOnType = exports.EventBus = exports.AutomationEventBus = void 0;
  5839. exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
  5840. 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  5841. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  5842. 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); }; }
  5843. 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); }
  5844. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  5845. 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; } }
  5846. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  5847. 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; } } }; }
  5848. 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); }
  5849. 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; }
  5850. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5851. 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); } }
  5852. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5853. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  5854. var WaitOnType = {
  5855. EVENT: "event",
  5856. TIMEOUT: "timeout"
  5857. };
  5858. exports.WaitOnType = WaitOnType;
  5859. function waitOnEventOrTimeout(_ref) {
  5860. var target = _ref.target,
  5861. name = _ref.name,
  5862. _ref$delay = _ref.delay,
  5863. delay = _ref$delay === void 0 ? 0 : _ref$delay;
  5864. return new Promise(function (resolve, reject) {
  5865. if (_typeof(target) !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) {
  5866. throw new Error("waitOnEventOrTimeout - invalid parameters.");
  5867. }
  5868. function handler(type) {
  5869. if (target instanceof EventBus) {
  5870. target._off(name, eventHandler);
  5871. } else {
  5872. target.removeEventListener(name, eventHandler);
  5873. }
  5874. if (timeout) {
  5875. clearTimeout(timeout);
  5876. }
  5877. resolve(type);
  5878. }
  5879. var eventHandler = handler.bind(null, WaitOnType.EVENT);
  5880. if (target instanceof EventBus) {
  5881. target._on(name, eventHandler);
  5882. } else {
  5883. target.addEventListener(name, eventHandler);
  5884. }
  5885. var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
  5886. var timeout = setTimeout(timeoutHandler, delay);
  5887. });
  5888. }
  5889. var EventBus = /*#__PURE__*/function () {
  5890. function EventBus() {
  5891. _classCallCheck(this, EventBus);
  5892. this._listeners = Object.create(null);
  5893. }
  5894. _createClass(EventBus, [{
  5895. key: "on",
  5896. value: function on(eventName, listener) {
  5897. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5898. this._on(eventName, listener, {
  5899. external: true,
  5900. once: options === null || options === void 0 ? void 0 : options.once
  5901. });
  5902. }
  5903. }, {
  5904. key: "off",
  5905. value: function off(eventName, listener) {
  5906. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5907. this._off(eventName, listener, {
  5908. external: true,
  5909. once: options === null || options === void 0 ? void 0 : options.once
  5910. });
  5911. }
  5912. }, {
  5913. key: "dispatch",
  5914. value: function dispatch(eventName, data) {
  5915. var eventListeners = this._listeners[eventName];
  5916. if (!eventListeners || eventListeners.length === 0) {
  5917. return;
  5918. }
  5919. var externalListeners;
  5920. var _iterator = _createForOfIteratorHelper(eventListeners.slice(0)),
  5921. _step;
  5922. try {
  5923. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5924. var _step$value = _step.value,
  5925. _listener = _step$value.listener,
  5926. external = _step$value.external,
  5927. once = _step$value.once;
  5928. if (once) {
  5929. this._off(eventName, _listener);
  5930. }
  5931. if (external) {
  5932. (externalListeners || (externalListeners = [])).push(_listener);
  5933. continue;
  5934. }
  5935. _listener(data);
  5936. }
  5937. } catch (err) {
  5938. _iterator.e(err);
  5939. } finally {
  5940. _iterator.f();
  5941. }
  5942. if (externalListeners) {
  5943. var _iterator2 = _createForOfIteratorHelper(externalListeners),
  5944. _step2;
  5945. try {
  5946. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5947. var listener = _step2.value;
  5948. listener(data);
  5949. }
  5950. } catch (err) {
  5951. _iterator2.e(err);
  5952. } finally {
  5953. _iterator2.f();
  5954. }
  5955. externalListeners = null;
  5956. }
  5957. }
  5958. }, {
  5959. key: "_on",
  5960. value: function _on(eventName, listener) {
  5961. var _this$_listeners;
  5962. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5963. var eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []);
  5964. eventListeners.push({
  5965. listener: listener,
  5966. external: (options === null || options === void 0 ? void 0 : options.external) === true,
  5967. once: (options === null || options === void 0 ? void 0 : options.once) === true
  5968. });
  5969. }
  5970. }, {
  5971. key: "_off",
  5972. value: function _off(eventName, listener) {
  5973. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5974. var eventListeners = this._listeners[eventName];
  5975. if (!eventListeners) {
  5976. return;
  5977. }
  5978. for (var i = 0, ii = eventListeners.length; i < ii; i++) {
  5979. if (eventListeners[i].listener === listener) {
  5980. eventListeners.splice(i, 1);
  5981. return;
  5982. }
  5983. }
  5984. }
  5985. }]);
  5986. return EventBus;
  5987. }();
  5988. exports.EventBus = EventBus;
  5989. var AutomationEventBus = /*#__PURE__*/function (_EventBus) {
  5990. _inherits(AutomationEventBus, _EventBus);
  5991. var _super = _createSuper(AutomationEventBus);
  5992. function AutomationEventBus() {
  5993. _classCallCheck(this, AutomationEventBus);
  5994. return _super.apply(this, arguments);
  5995. }
  5996. _createClass(AutomationEventBus, [{
  5997. key: "dispatch",
  5998. value: function dispatch(eventName, data) {
  5999. throw new Error("Not implemented: AutomationEventBus.dispatch");
  6000. }
  6001. }]);
  6002. return AutomationEventBus;
  6003. }(EventBus);
  6004. exports.AutomationEventBus = AutomationEventBus;
  6005. /***/ }),
  6006. /* 20 */
  6007. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6008. Object.defineProperty(exports, "__esModule", ({
  6009. value: true
  6010. }));
  6011. exports.GenericL10n = void 0;
  6012. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  6013. __w_pdfjs_require__(21);
  6014. var _l10n_utils = __w_pdfjs_require__(6);
  6015. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6016. 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); } }
  6017. 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); }); }; }
  6018. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6019. 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); } }
  6020. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6021. var webL10n = document.webL10n;
  6022. var GenericL10n = /*#__PURE__*/function () {
  6023. function GenericL10n(lang) {
  6024. _classCallCheck(this, GenericL10n);
  6025. this._lang = lang;
  6026. this._ready = new Promise(function (resolve, reject) {
  6027. webL10n.setLanguage((0, _l10n_utils.fixupLangCode)(lang), function () {
  6028. resolve(webL10n);
  6029. });
  6030. });
  6031. }
  6032. _createClass(GenericL10n, [{
  6033. key: "getLanguage",
  6034. value: function () {
  6035. var _getLanguage = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  6036. var l10n;
  6037. return _regenerator["default"].wrap(function _callee$(_context) {
  6038. while (1) {
  6039. switch (_context.prev = _context.next) {
  6040. case 0:
  6041. _context.next = 2;
  6042. return this._ready;
  6043. case 2:
  6044. l10n = _context.sent;
  6045. return _context.abrupt("return", l10n.getLanguage());
  6046. case 4:
  6047. case "end":
  6048. return _context.stop();
  6049. }
  6050. }
  6051. }, _callee, this);
  6052. }));
  6053. function getLanguage() {
  6054. return _getLanguage.apply(this, arguments);
  6055. }
  6056. return getLanguage;
  6057. }()
  6058. }, {
  6059. key: "getDirection",
  6060. value: function () {
  6061. var _getDirection = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  6062. var l10n;
  6063. return _regenerator["default"].wrap(function _callee2$(_context2) {
  6064. while (1) {
  6065. switch (_context2.prev = _context2.next) {
  6066. case 0:
  6067. _context2.next = 2;
  6068. return this._ready;
  6069. case 2:
  6070. l10n = _context2.sent;
  6071. return _context2.abrupt("return", l10n.getDirection());
  6072. case 4:
  6073. case "end":
  6074. return _context2.stop();
  6075. }
  6076. }
  6077. }, _callee2, this);
  6078. }));
  6079. function getDirection() {
  6080. return _getDirection.apply(this, arguments);
  6081. }
  6082. return getDirection;
  6083. }()
  6084. }, {
  6085. key: "get",
  6086. value: function () {
  6087. var _get = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(key) {
  6088. var args,
  6089. fallback,
  6090. l10n,
  6091. _args3 = arguments;
  6092. return _regenerator["default"].wrap(function _callee3$(_context3) {
  6093. while (1) {
  6094. switch (_context3.prev = _context3.next) {
  6095. case 0:
  6096. args = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
  6097. fallback = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : (0, _l10n_utils.getL10nFallback)(key, args);
  6098. _context3.next = 4;
  6099. return this._ready;
  6100. case 4:
  6101. l10n = _context3.sent;
  6102. return _context3.abrupt("return", l10n.get(key, args, fallback));
  6103. case 6:
  6104. case "end":
  6105. return _context3.stop();
  6106. }
  6107. }
  6108. }, _callee3, this);
  6109. }));
  6110. function get(_x) {
  6111. return _get.apply(this, arguments);
  6112. }
  6113. return get;
  6114. }()
  6115. }, {
  6116. key: "translate",
  6117. value: function () {
  6118. var _translate = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(element) {
  6119. var l10n;
  6120. return _regenerator["default"].wrap(function _callee4$(_context4) {
  6121. while (1) {
  6122. switch (_context4.prev = _context4.next) {
  6123. case 0:
  6124. _context4.next = 2;
  6125. return this._ready;
  6126. case 2:
  6127. l10n = _context4.sent;
  6128. return _context4.abrupt("return", l10n.translate(element));
  6129. case 4:
  6130. case "end":
  6131. return _context4.stop();
  6132. }
  6133. }
  6134. }, _callee4, this);
  6135. }));
  6136. function translate(_x2) {
  6137. return _translate.apply(this, arguments);
  6138. }
  6139. return translate;
  6140. }()
  6141. }]);
  6142. return GenericL10n;
  6143. }();
  6144. exports.GenericL10n = GenericL10n;
  6145. /***/ }),
  6146. /* 21 */
  6147. /***/ (() => {
  6148. document.webL10n = function (window, document, undefined) {
  6149. var gL10nData = {};
  6150. var gTextData = '';
  6151. var gTextProp = 'textContent';
  6152. var gLanguage = '';
  6153. var gMacros = {};
  6154. var gReadyState = 'loading';
  6155. var gAsyncResourceLoading = true;
  6156. function getL10nResourceLinks() {
  6157. return document.querySelectorAll('link[type="application/l10n"]');
  6158. }
  6159. function getL10nDictionary() {
  6160. var script = document.querySelector('script[type="application/l10n"]');
  6161. return script ? JSON.parse(script.innerHTML) : null;
  6162. }
  6163. function getTranslatableChildren(element) {
  6164. return element ? element.querySelectorAll('*[data-l10n-id]') : [];
  6165. }
  6166. function getL10nAttributes(element) {
  6167. if (!element) return {};
  6168. var l10nId = element.getAttribute('data-l10n-id');
  6169. var l10nArgs = element.getAttribute('data-l10n-args');
  6170. var args = {};
  6171. if (l10nArgs) {
  6172. try {
  6173. args = JSON.parse(l10nArgs);
  6174. } catch (e) {
  6175. console.warn('could not parse arguments for #' + l10nId);
  6176. }
  6177. }
  6178. return {
  6179. id: l10nId,
  6180. args: args
  6181. };
  6182. }
  6183. function xhrLoadText(url, onSuccess, onFailure) {
  6184. onSuccess = onSuccess || function _onSuccess(data) {};
  6185. onFailure = onFailure || function _onFailure() {};
  6186. var xhr = new XMLHttpRequest();
  6187. xhr.open('GET', url, gAsyncResourceLoading);
  6188. if (xhr.overrideMimeType) {
  6189. xhr.overrideMimeType('text/plain; charset=utf-8');
  6190. }
  6191. xhr.onreadystatechange = function () {
  6192. if (xhr.readyState == 4) {
  6193. if (xhr.status == 200 || xhr.status === 0) {
  6194. onSuccess(xhr.responseText);
  6195. } else {
  6196. onFailure();
  6197. }
  6198. }
  6199. };
  6200. xhr.onerror = onFailure;
  6201. xhr.ontimeout = onFailure;
  6202. try {
  6203. xhr.send(null);
  6204. } catch (e) {
  6205. onFailure();
  6206. }
  6207. }
  6208. function parseResource(href, lang, successCallback, failureCallback) {
  6209. var baseURL = href.replace(/[^\/]*$/, '') || './';
  6210. function evalString(text) {
  6211. if (text.lastIndexOf('\\') < 0) return text;
  6212. 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, "'");
  6213. }
  6214. function parseProperties(text, parsedPropertiesCallback) {
  6215. var dictionary = {};
  6216. var reBlank = /^\s*|\s*$/;
  6217. var reComment = /^\s*#|^\s*$/;
  6218. var reSection = /^\s*\[(.*)\]\s*$/;
  6219. var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
  6220. var reSplit = /^([^=\s]*)\s*=\s*(.+)$/;
  6221. function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
  6222. var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
  6223. var currentLang = '*';
  6224. var genericLang = lang.split('-', 1)[0];
  6225. var skipLang = false;
  6226. var match = '';
  6227. function nextEntry() {
  6228. while (true) {
  6229. if (!entries.length) {
  6230. parsedRawLinesCallback();
  6231. return;
  6232. }
  6233. var line = entries.shift();
  6234. if (reComment.test(line)) continue;
  6235. if (extendedSyntax) {
  6236. match = reSection.exec(line);
  6237. if (match) {
  6238. currentLang = match[1].toLowerCase();
  6239. skipLang = currentLang !== '*' && currentLang !== lang && currentLang !== genericLang;
  6240. continue;
  6241. } else if (skipLang) {
  6242. continue;
  6243. }
  6244. match = reImport.exec(line);
  6245. if (match) {
  6246. loadImport(baseURL + match[1], nextEntry);
  6247. return;
  6248. }
  6249. }
  6250. var tmp = line.match(reSplit);
  6251. if (tmp && tmp.length == 3) {
  6252. dictionary[tmp[1]] = evalString(tmp[2]);
  6253. }
  6254. }
  6255. }
  6256. nextEntry();
  6257. }
  6258. function loadImport(url, callback) {
  6259. xhrLoadText(url, function (content) {
  6260. parseRawLines(content, false, callback);
  6261. }, function () {
  6262. console.warn(url + ' not found.');
  6263. callback();
  6264. });
  6265. }
  6266. parseRawLines(text, true, function () {
  6267. parsedPropertiesCallback(dictionary);
  6268. });
  6269. }
  6270. xhrLoadText(href, function (response) {
  6271. gTextData += response;
  6272. parseProperties(response, function (data) {
  6273. for (var key in data) {
  6274. var id,
  6275. prop,
  6276. index = key.lastIndexOf('.');
  6277. if (index > 0) {
  6278. id = key.substring(0, index);
  6279. prop = key.substring(index + 1);
  6280. } else {
  6281. id = key;
  6282. prop = gTextProp;
  6283. }
  6284. if (!gL10nData[id]) {
  6285. gL10nData[id] = {};
  6286. }
  6287. gL10nData[id][prop] = data[key];
  6288. }
  6289. if (successCallback) {
  6290. successCallback();
  6291. }
  6292. });
  6293. }, failureCallback);
  6294. }
  6295. function loadLocale(lang, callback) {
  6296. if (lang) {
  6297. lang = lang.toLowerCase();
  6298. }
  6299. callback = callback || function _callback() {};
  6300. clear();
  6301. gLanguage = lang;
  6302. var langLinks = getL10nResourceLinks();
  6303. var langCount = langLinks.length;
  6304. if (langCount === 0) {
  6305. var dict = getL10nDictionary();
  6306. if (dict && dict.locales && dict.default_locale) {
  6307. console.log('using the embedded JSON directory, early way out');
  6308. gL10nData = dict.locales[lang];
  6309. if (!gL10nData) {
  6310. var defaultLocale = dict.default_locale.toLowerCase();
  6311. for (var anyCaseLang in dict.locales) {
  6312. anyCaseLang = anyCaseLang.toLowerCase();
  6313. if (anyCaseLang === lang) {
  6314. gL10nData = dict.locales[lang];
  6315. break;
  6316. } else if (anyCaseLang === defaultLocale) {
  6317. gL10nData = dict.locales[defaultLocale];
  6318. }
  6319. }
  6320. }
  6321. callback();
  6322. } else {
  6323. console.log('no resource to load, early way out');
  6324. }
  6325. gReadyState = 'complete';
  6326. return;
  6327. }
  6328. var onResourceLoaded = null;
  6329. var gResourceCount = 0;
  6330. onResourceLoaded = function onResourceLoaded() {
  6331. gResourceCount++;
  6332. if (gResourceCount >= langCount) {
  6333. callback();
  6334. gReadyState = 'complete';
  6335. }
  6336. };
  6337. function L10nResourceLink(link) {
  6338. var href = link.href;
  6339. this.load = function (lang, callback) {
  6340. parseResource(href, lang, callback, function () {
  6341. console.warn(href + ' not found.');
  6342. console.warn('"' + lang + '" resource not found');
  6343. gLanguage = '';
  6344. callback();
  6345. });
  6346. };
  6347. }
  6348. for (var i = 0; i < langCount; i++) {
  6349. var resource = new L10nResourceLink(langLinks[i]);
  6350. resource.load(lang, onResourceLoaded);
  6351. }
  6352. }
  6353. function clear() {
  6354. gL10nData = {};
  6355. gTextData = '';
  6356. gLanguage = '';
  6357. }
  6358. function getPluralRules(lang) {
  6359. var locales2rules = {
  6360. 'af': 3,
  6361. 'ak': 4,
  6362. 'am': 4,
  6363. 'ar': 1,
  6364. 'asa': 3,
  6365. 'az': 0,
  6366. 'be': 11,
  6367. 'bem': 3,
  6368. 'bez': 3,
  6369. 'bg': 3,
  6370. 'bh': 4,
  6371. 'bm': 0,
  6372. 'bn': 3,
  6373. 'bo': 0,
  6374. 'br': 20,
  6375. 'brx': 3,
  6376. 'bs': 11,
  6377. 'ca': 3,
  6378. 'cgg': 3,
  6379. 'chr': 3,
  6380. 'cs': 12,
  6381. 'cy': 17,
  6382. 'da': 3,
  6383. 'de': 3,
  6384. 'dv': 3,
  6385. 'dz': 0,
  6386. 'ee': 3,
  6387. 'el': 3,
  6388. 'en': 3,
  6389. 'eo': 3,
  6390. 'es': 3,
  6391. 'et': 3,
  6392. 'eu': 3,
  6393. 'fa': 0,
  6394. 'ff': 5,
  6395. 'fi': 3,
  6396. 'fil': 4,
  6397. 'fo': 3,
  6398. 'fr': 5,
  6399. 'fur': 3,
  6400. 'fy': 3,
  6401. 'ga': 8,
  6402. 'gd': 24,
  6403. 'gl': 3,
  6404. 'gsw': 3,
  6405. 'gu': 3,
  6406. 'guw': 4,
  6407. 'gv': 23,
  6408. 'ha': 3,
  6409. 'haw': 3,
  6410. 'he': 2,
  6411. 'hi': 4,
  6412. 'hr': 11,
  6413. 'hu': 0,
  6414. 'id': 0,
  6415. 'ig': 0,
  6416. 'ii': 0,
  6417. 'is': 3,
  6418. 'it': 3,
  6419. 'iu': 7,
  6420. 'ja': 0,
  6421. 'jmc': 3,
  6422. 'jv': 0,
  6423. 'ka': 0,
  6424. 'kab': 5,
  6425. 'kaj': 3,
  6426. 'kcg': 3,
  6427. 'kde': 0,
  6428. 'kea': 0,
  6429. 'kk': 3,
  6430. 'kl': 3,
  6431. 'km': 0,
  6432. 'kn': 0,
  6433. 'ko': 0,
  6434. 'ksb': 3,
  6435. 'ksh': 21,
  6436. 'ku': 3,
  6437. 'kw': 7,
  6438. 'lag': 18,
  6439. 'lb': 3,
  6440. 'lg': 3,
  6441. 'ln': 4,
  6442. 'lo': 0,
  6443. 'lt': 10,
  6444. 'lv': 6,
  6445. 'mas': 3,
  6446. 'mg': 4,
  6447. 'mk': 16,
  6448. 'ml': 3,
  6449. 'mn': 3,
  6450. 'mo': 9,
  6451. 'mr': 3,
  6452. 'ms': 0,
  6453. 'mt': 15,
  6454. 'my': 0,
  6455. 'nah': 3,
  6456. 'naq': 7,
  6457. 'nb': 3,
  6458. 'nd': 3,
  6459. 'ne': 3,
  6460. 'nl': 3,
  6461. 'nn': 3,
  6462. 'no': 3,
  6463. 'nr': 3,
  6464. 'nso': 4,
  6465. 'ny': 3,
  6466. 'nyn': 3,
  6467. 'om': 3,
  6468. 'or': 3,
  6469. 'pa': 3,
  6470. 'pap': 3,
  6471. 'pl': 13,
  6472. 'ps': 3,
  6473. 'pt': 3,
  6474. 'rm': 3,
  6475. 'ro': 9,
  6476. 'rof': 3,
  6477. 'ru': 11,
  6478. 'rwk': 3,
  6479. 'sah': 0,
  6480. 'saq': 3,
  6481. 'se': 7,
  6482. 'seh': 3,
  6483. 'ses': 0,
  6484. 'sg': 0,
  6485. 'sh': 11,
  6486. 'shi': 19,
  6487. 'sk': 12,
  6488. 'sl': 14,
  6489. 'sma': 7,
  6490. 'smi': 7,
  6491. 'smj': 7,
  6492. 'smn': 7,
  6493. 'sms': 7,
  6494. 'sn': 3,
  6495. 'so': 3,
  6496. 'sq': 3,
  6497. 'sr': 11,
  6498. 'ss': 3,
  6499. 'ssy': 3,
  6500. 'st': 3,
  6501. 'sv': 3,
  6502. 'sw': 3,
  6503. 'syr': 3,
  6504. 'ta': 3,
  6505. 'te': 3,
  6506. 'teo': 3,
  6507. 'th': 0,
  6508. 'ti': 4,
  6509. 'tig': 3,
  6510. 'tk': 3,
  6511. 'tl': 4,
  6512. 'tn': 3,
  6513. 'to': 0,
  6514. 'tr': 0,
  6515. 'ts': 3,
  6516. 'tzm': 22,
  6517. 'uk': 11,
  6518. 'ur': 3,
  6519. 've': 3,
  6520. 'vi': 0,
  6521. 'vun': 3,
  6522. 'wa': 4,
  6523. 'wae': 3,
  6524. 'wo': 0,
  6525. 'xh': 3,
  6526. 'xog': 3,
  6527. 'yo': 0,
  6528. 'zh': 0,
  6529. 'zu': 3
  6530. };
  6531. function isIn(n, list) {
  6532. return list.indexOf(n) !== -1;
  6533. }
  6534. function isBetween(n, start, end) {
  6535. return start <= n && n <= end;
  6536. }
  6537. var pluralRules = {
  6538. '0': function _(n) {
  6539. return 'other';
  6540. },
  6541. '1': function _(n) {
  6542. if (isBetween(n % 100, 3, 10)) return 'few';
  6543. if (n === 0) return 'zero';
  6544. if (isBetween(n % 100, 11, 99)) return 'many';
  6545. if (n == 2) return 'two';
  6546. if (n == 1) return 'one';
  6547. return 'other';
  6548. },
  6549. '2': function _(n) {
  6550. if (n !== 0 && n % 10 === 0) return 'many';
  6551. if (n == 2) return 'two';
  6552. if (n == 1) return 'one';
  6553. return 'other';
  6554. },
  6555. '3': function _(n) {
  6556. if (n == 1) return 'one';
  6557. return 'other';
  6558. },
  6559. '4': function _(n) {
  6560. if (isBetween(n, 0, 1)) return 'one';
  6561. return 'other';
  6562. },
  6563. '5': function _(n) {
  6564. if (isBetween(n, 0, 2) && n != 2) return 'one';
  6565. return 'other';
  6566. },
  6567. '6': function _(n) {
  6568. if (n === 0) return 'zero';
  6569. if (n % 10 == 1 && n % 100 != 11) return 'one';
  6570. return 'other';
  6571. },
  6572. '7': function _(n) {
  6573. if (n == 2) return 'two';
  6574. if (n == 1) return 'one';
  6575. return 'other';
  6576. },
  6577. '8': function _(n) {
  6578. if (isBetween(n, 3, 6)) return 'few';
  6579. if (isBetween(n, 7, 10)) return 'many';
  6580. if (n == 2) return 'two';
  6581. if (n == 1) return 'one';
  6582. return 'other';
  6583. },
  6584. '9': function _(n) {
  6585. if (n === 0 || n != 1 && isBetween(n % 100, 1, 19)) return 'few';
  6586. if (n == 1) return 'one';
  6587. return 'other';
  6588. },
  6589. '10': function _(n) {
  6590. if (isBetween(n % 10, 2, 9) && !isBetween(n % 100, 11, 19)) return 'few';
  6591. if (n % 10 == 1 && !isBetween(n % 100, 11, 19)) return 'one';
  6592. return 'other';
  6593. },
  6594. '11': function _(n) {
  6595. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  6596. if (n % 10 === 0 || isBetween(n % 10, 5, 9) || isBetween(n % 100, 11, 14)) return 'many';
  6597. if (n % 10 == 1 && n % 100 != 11) return 'one';
  6598. return 'other';
  6599. },
  6600. '12': function _(n) {
  6601. if (isBetween(n, 2, 4)) return 'few';
  6602. if (n == 1) return 'one';
  6603. return 'other';
  6604. },
  6605. '13': function _(n) {
  6606. if (isBetween(n % 10, 2, 4) && !isBetween(n % 100, 12, 14)) return 'few';
  6607. if (n != 1 && isBetween(n % 10, 0, 1) || isBetween(n % 10, 5, 9) || isBetween(n % 100, 12, 14)) return 'many';
  6608. if (n == 1) return 'one';
  6609. return 'other';
  6610. },
  6611. '14': function _(n) {
  6612. if (isBetween(n % 100, 3, 4)) return 'few';
  6613. if (n % 100 == 2) return 'two';
  6614. if (n % 100 == 1) return 'one';
  6615. return 'other';
  6616. },
  6617. '15': function _(n) {
  6618. if (n === 0 || isBetween(n % 100, 2, 10)) return 'few';
  6619. if (isBetween(n % 100, 11, 19)) return 'many';
  6620. if (n == 1) return 'one';
  6621. return 'other';
  6622. },
  6623. '16': function _(n) {
  6624. if (n % 10 == 1 && n != 11) return 'one';
  6625. return 'other';
  6626. },
  6627. '17': function _(n) {
  6628. if (n == 3) return 'few';
  6629. if (n === 0) return 'zero';
  6630. if (n == 6) return 'many';
  6631. if (n == 2) return 'two';
  6632. if (n == 1) return 'one';
  6633. return 'other';
  6634. },
  6635. '18': function _(n) {
  6636. if (n === 0) return 'zero';
  6637. if (isBetween(n, 0, 2) && n !== 0 && n != 2) return 'one';
  6638. return 'other';
  6639. },
  6640. '19': function _(n) {
  6641. if (isBetween(n, 2, 10)) return 'few';
  6642. if (isBetween(n, 0, 1)) return 'one';
  6643. return 'other';
  6644. },
  6645. '20': function _(n) {
  6646. 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';
  6647. if (n % 1000000 === 0 && n !== 0) return 'many';
  6648. if (n % 10 == 2 && !isIn(n % 100, [12, 72, 92])) return 'two';
  6649. if (n % 10 == 1 && !isIn(n % 100, [11, 71, 91])) return 'one';
  6650. return 'other';
  6651. },
  6652. '21': function _(n) {
  6653. if (n === 0) return 'zero';
  6654. if (n == 1) return 'one';
  6655. return 'other';
  6656. },
  6657. '22': function _(n) {
  6658. if (isBetween(n, 0, 1) || isBetween(n, 11, 99)) return 'one';
  6659. return 'other';
  6660. },
  6661. '23': function _(n) {
  6662. if (isBetween(n % 10, 1, 2) || n % 20 === 0) return 'one';
  6663. return 'other';
  6664. },
  6665. '24': function _(n) {
  6666. if (isBetween(n, 3, 10) || isBetween(n, 13, 19)) return 'few';
  6667. if (isIn(n, [2, 12])) return 'two';
  6668. if (isIn(n, [1, 11])) return 'one';
  6669. return 'other';
  6670. }
  6671. };
  6672. var index = locales2rules[lang.replace(/-.*$/, '')];
  6673. if (!(index in pluralRules)) {
  6674. console.warn('plural form unknown for [' + lang + ']');
  6675. return function () {
  6676. return 'other';
  6677. };
  6678. }
  6679. return pluralRules[index];
  6680. }
  6681. gMacros.plural = function (str, param, key, prop) {
  6682. var n = parseFloat(param);
  6683. if (isNaN(n)) return str;
  6684. if (prop != gTextProp) return str;
  6685. if (!gMacros._pluralRules) {
  6686. gMacros._pluralRules = getPluralRules(gLanguage);
  6687. }
  6688. var index = '[' + gMacros._pluralRules(n) + ']';
  6689. if (n === 0 && key + '[zero]' in gL10nData) {
  6690. str = gL10nData[key + '[zero]'][prop];
  6691. } else if (n == 1 && key + '[one]' in gL10nData) {
  6692. str = gL10nData[key + '[one]'][prop];
  6693. } else if (n == 2 && key + '[two]' in gL10nData) {
  6694. str = gL10nData[key + '[two]'][prop];
  6695. } else if (key + index in gL10nData) {
  6696. str = gL10nData[key + index][prop];
  6697. } else if (key + '[other]' in gL10nData) {
  6698. str = gL10nData[key + '[other]'][prop];
  6699. }
  6700. return str;
  6701. };
  6702. function getL10nData(key, args, fallback) {
  6703. var data = gL10nData[key];
  6704. if (!data) {
  6705. console.warn('#' + key + ' is undefined.');
  6706. if (!fallback) {
  6707. return null;
  6708. }
  6709. data = fallback;
  6710. }
  6711. var rv = {};
  6712. for (var prop in data) {
  6713. var str = data[prop];
  6714. str = substIndexes(str, args, key, prop);
  6715. str = substArguments(str, args, key);
  6716. rv[prop] = str;
  6717. }
  6718. return rv;
  6719. }
  6720. function substIndexes(str, args, key, prop) {
  6721. var reIndex = /\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/;
  6722. var reMatch = reIndex.exec(str);
  6723. if (!reMatch || !reMatch.length) return str;
  6724. var macroName = reMatch[1];
  6725. var paramName = reMatch[2];
  6726. var param;
  6727. if (args && paramName in args) {
  6728. param = args[paramName];
  6729. } else if (paramName in gL10nData) {
  6730. param = gL10nData[paramName];
  6731. }
  6732. if (macroName in gMacros) {
  6733. var macro = gMacros[macroName];
  6734. str = macro(str, param, key, prop);
  6735. }
  6736. return str;
  6737. }
  6738. function substArguments(str, args, key) {
  6739. var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
  6740. return str.replace(reArgs, function (matched_text, arg) {
  6741. if (args && arg in args) {
  6742. return args[arg];
  6743. }
  6744. if (arg in gL10nData) {
  6745. return gL10nData[arg];
  6746. }
  6747. console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');
  6748. return matched_text;
  6749. });
  6750. }
  6751. function translateElement(element) {
  6752. var l10n = getL10nAttributes(element);
  6753. if (!l10n.id) return;
  6754. var data = getL10nData(l10n.id, l10n.args);
  6755. if (!data) {
  6756. console.warn('#' + l10n.id + ' is undefined.');
  6757. return;
  6758. }
  6759. if (data[gTextProp]) {
  6760. if (getChildElementCount(element) === 0) {
  6761. element[gTextProp] = data[gTextProp];
  6762. } else {
  6763. var children = element.childNodes;
  6764. var found = false;
  6765. for (var i = 0, l = children.length; i < l; i++) {
  6766. if (children[i].nodeType === 3 && /\S/.test(children[i].nodeValue)) {
  6767. if (found) {
  6768. children[i].nodeValue = '';
  6769. } else {
  6770. children[i].nodeValue = data[gTextProp];
  6771. found = true;
  6772. }
  6773. }
  6774. }
  6775. if (!found) {
  6776. var textNode = document.createTextNode(data[gTextProp]);
  6777. element.insertBefore(textNode, element.firstChild);
  6778. }
  6779. }
  6780. delete data[gTextProp];
  6781. }
  6782. for (var k in data) {
  6783. element[k] = data[k];
  6784. }
  6785. }
  6786. function getChildElementCount(element) {
  6787. if (element.children) {
  6788. return element.children.length;
  6789. }
  6790. if (typeof element.childElementCount !== 'undefined') {
  6791. return element.childElementCount;
  6792. }
  6793. var count = 0;
  6794. for (var i = 0; i < element.childNodes.length; i++) {
  6795. count += element.nodeType === 1 ? 1 : 0;
  6796. }
  6797. return count;
  6798. }
  6799. function translateFragment(element) {
  6800. element = element || document.documentElement;
  6801. var children = getTranslatableChildren(element);
  6802. var elementCount = children.length;
  6803. for (var i = 0; i < elementCount; i++) {
  6804. translateElement(children[i]);
  6805. }
  6806. translateElement(element);
  6807. }
  6808. return {
  6809. get: function get(key, args, fallbackString) {
  6810. var index = key.lastIndexOf('.');
  6811. var prop = gTextProp;
  6812. if (index > 0) {
  6813. prop = key.substring(index + 1);
  6814. key = key.substring(0, index);
  6815. }
  6816. var fallback;
  6817. if (fallbackString) {
  6818. fallback = {};
  6819. fallback[prop] = fallbackString;
  6820. }
  6821. var data = getL10nData(key, args, fallback);
  6822. if (data && prop in data) {
  6823. return data[prop];
  6824. }
  6825. return '{{' + key + '}}';
  6826. },
  6827. getData: function getData() {
  6828. return gL10nData;
  6829. },
  6830. getText: function getText() {
  6831. return gTextData;
  6832. },
  6833. getLanguage: function getLanguage() {
  6834. return gLanguage;
  6835. },
  6836. setLanguage: function setLanguage(lang, callback) {
  6837. loadLocale(lang, function () {
  6838. if (callback) callback();
  6839. });
  6840. },
  6841. getDirection: function getDirection() {
  6842. var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];
  6843. var shortCode = gLanguage.split('-', 1)[0];
  6844. return rtlList.indexOf(shortCode) >= 0 ? 'rtl' : 'ltr';
  6845. },
  6846. translate: translateFragment,
  6847. getReadyState: function getReadyState() {
  6848. return gReadyState;
  6849. },
  6850. ready: function ready(callback) {
  6851. if (!callback) {
  6852. return;
  6853. } else if (gReadyState == 'complete' || gReadyState == 'interactive') {
  6854. window.setTimeout(function () {
  6855. callback();
  6856. });
  6857. } else if (document.addEventListener) {
  6858. document.addEventListener('localized', function once() {
  6859. document.removeEventListener('localized', once);
  6860. callback();
  6861. });
  6862. }
  6863. }
  6864. };
  6865. }(window, document);
  6866. /***/ }),
  6867. /* 22 */
  6868. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6869. Object.defineProperty(exports, "__esModule", ({
  6870. value: true
  6871. }));
  6872. exports.PDFFindController = exports.FindState = void 0;
  6873. var _pdfjsLib = __w_pdfjs_require__(5);
  6874. var _pdf_find_utils = __w_pdfjs_require__(23);
  6875. var _ui_utils = __w_pdfjs_require__(8);
  6876. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6877. 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); } }
  6878. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6879. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  6880. 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."); }
  6881. 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; }
  6882. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  6883. 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; } } }; }
  6884. 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); }
  6885. 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; }
  6886. var FindState = {
  6887. FOUND: 0,
  6888. NOT_FOUND: 1,
  6889. WRAPPED: 2,
  6890. PENDING: 3
  6891. };
  6892. exports.FindState = FindState;
  6893. var FIND_TIMEOUT = 250;
  6894. var MATCH_SCROLL_OFFSET_TOP = -50;
  6895. var MATCH_SCROLL_OFFSET_LEFT = -400;
  6896. var CHARACTERS_TO_NORMALIZE = {
  6897. "\u2010": "-",
  6898. "\u2018": "'",
  6899. "\u2019": "'",
  6900. "\u201A": "'",
  6901. "\u201B": "'",
  6902. "\u201C": '"',
  6903. "\u201D": '"',
  6904. "\u201E": '"',
  6905. "\u201F": '"',
  6906. "\xBC": "1/4",
  6907. "\xBD": "1/2",
  6908. "\xBE": "3/4"
  6909. };
  6910. var normalizationRegex = null;
  6911. function normalize(text) {
  6912. if (!normalizationRegex) {
  6913. var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
  6914. normalizationRegex = new RegExp("[".concat(replace, "]"), "g");
  6915. }
  6916. var diffs = null;
  6917. var normalizedText = text.replace(normalizationRegex, function (ch, index) {
  6918. var normalizedCh = CHARACTERS_TO_NORMALIZE[ch],
  6919. diff = normalizedCh.length - ch.length;
  6920. if (diff !== 0) {
  6921. (diffs || (diffs = [])).push([index, diff]);
  6922. }
  6923. return normalizedCh;
  6924. });
  6925. return [normalizedText, diffs];
  6926. }
  6927. function getOriginalIndex(matchIndex) {
  6928. var diffs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6929. if (!diffs) {
  6930. return matchIndex;
  6931. }
  6932. var totalDiff = 0;
  6933. var _iterator = _createForOfIteratorHelper(diffs),
  6934. _step;
  6935. try {
  6936. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  6937. var _step$value = _slicedToArray(_step.value, 2),
  6938. index = _step$value[0],
  6939. diff = _step$value[1];
  6940. var currentIndex = index + totalDiff;
  6941. if (currentIndex >= matchIndex) {
  6942. break;
  6943. }
  6944. if (currentIndex + diff > matchIndex) {
  6945. totalDiff += matchIndex - currentIndex;
  6946. break;
  6947. }
  6948. totalDiff += diff;
  6949. }
  6950. } catch (err) {
  6951. _iterator.e(err);
  6952. } finally {
  6953. _iterator.f();
  6954. }
  6955. return matchIndex - totalDiff;
  6956. }
  6957. var PDFFindController = /*#__PURE__*/function () {
  6958. function PDFFindController(_ref) {
  6959. var _this = this;
  6960. var linkService = _ref.linkService,
  6961. eventBus = _ref.eventBus;
  6962. _classCallCheck(this, PDFFindController);
  6963. this._linkService = linkService;
  6964. this._eventBus = eventBus;
  6965. this._reset();
  6966. eventBus._on("find", this._onFind.bind(this));
  6967. eventBus._on("findbarclose", this._onFindBarClose.bind(this));
  6968. this.executeCommand = function (cmd, state) {
  6969. console.error("Deprecated method `PDFFindController.executeCommand` called, " + 'please dispatch a "find"-event using the EventBus instead.');
  6970. var eventState = Object.assign(Object.create(null), state, {
  6971. type: cmd.substring("find".length)
  6972. });
  6973. _this._onFind(eventState);
  6974. };
  6975. }
  6976. _createClass(PDFFindController, [{
  6977. key: "highlightMatches",
  6978. get: function get() {
  6979. return this._highlightMatches;
  6980. }
  6981. }, {
  6982. key: "pageMatches",
  6983. get: function get() {
  6984. return this._pageMatches;
  6985. }
  6986. }, {
  6987. key: "pageMatchesLength",
  6988. get: function get() {
  6989. return this._pageMatchesLength;
  6990. }
  6991. }, {
  6992. key: "selected",
  6993. get: function get() {
  6994. return this._selected;
  6995. }
  6996. }, {
  6997. key: "state",
  6998. get: function get() {
  6999. return this._state;
  7000. }
  7001. }, {
  7002. key: "setDocument",
  7003. value: function setDocument(pdfDocument) {
  7004. if (this._pdfDocument) {
  7005. this._reset();
  7006. }
  7007. if (!pdfDocument) {
  7008. return;
  7009. }
  7010. this._pdfDocument = pdfDocument;
  7011. this._firstPageCapability.resolve();
  7012. }
  7013. }, {
  7014. key: "_onFind",
  7015. value: function _onFind(state) {
  7016. var _this2 = this;
  7017. if (!state) {
  7018. return;
  7019. }
  7020. var pdfDocument = this._pdfDocument;
  7021. var type = state.type;
  7022. if (this._state === null || this._shouldDirtyMatch(state)) {
  7023. this._dirtyMatch = true;
  7024. }
  7025. this._state = state;
  7026. if (type !== "highlightallchange") {
  7027. this._updateUIState(FindState.PENDING);
  7028. }
  7029. this._firstPageCapability.promise.then(function () {
  7030. if (!_this2._pdfDocument || pdfDocument && _this2._pdfDocument !== pdfDocument) {
  7031. return;
  7032. }
  7033. _this2._extractText();
  7034. var findbarClosed = !_this2._highlightMatches;
  7035. var pendingTimeout = !!_this2._findTimeout;
  7036. if (_this2._findTimeout) {
  7037. clearTimeout(_this2._findTimeout);
  7038. _this2._findTimeout = null;
  7039. }
  7040. if (!type) {
  7041. _this2._findTimeout = setTimeout(function () {
  7042. _this2._nextMatch();
  7043. _this2._findTimeout = null;
  7044. }, FIND_TIMEOUT);
  7045. } else if (_this2._dirtyMatch) {
  7046. _this2._nextMatch();
  7047. } else if (type === "again") {
  7048. _this2._nextMatch();
  7049. if (findbarClosed && _this2._state.highlightAll) {
  7050. _this2._updateAllPages();
  7051. }
  7052. } else if (type === "highlightallchange") {
  7053. if (pendingTimeout) {
  7054. _this2._nextMatch();
  7055. } else {
  7056. _this2._highlightMatches = true;
  7057. }
  7058. _this2._updateAllPages();
  7059. } else {
  7060. _this2._nextMatch();
  7061. }
  7062. });
  7063. }
  7064. }, {
  7065. key: "scrollMatchIntoView",
  7066. value: function scrollMatchIntoView(_ref2) {
  7067. var _ref2$element = _ref2.element,
  7068. element = _ref2$element === void 0 ? null : _ref2$element,
  7069. _ref2$selectedLeft = _ref2.selectedLeft,
  7070. selectedLeft = _ref2$selectedLeft === void 0 ? 0 : _ref2$selectedLeft,
  7071. _ref2$pageIndex = _ref2.pageIndex,
  7072. pageIndex = _ref2$pageIndex === void 0 ? -1 : _ref2$pageIndex,
  7073. _ref2$matchIndex = _ref2.matchIndex,
  7074. matchIndex = _ref2$matchIndex === void 0 ? -1 : _ref2$matchIndex;
  7075. if (!this._scrollMatches || !element) {
  7076. return;
  7077. } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
  7078. return;
  7079. } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
  7080. return;
  7081. }
  7082. this._scrollMatches = false;
  7083. var spot = {
  7084. top: MATCH_SCROLL_OFFSET_TOP,
  7085. left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT
  7086. };
  7087. (0, _ui_utils.scrollIntoView)(element, spot, true);
  7088. }
  7089. }, {
  7090. key: "_reset",
  7091. value: function _reset() {
  7092. this._highlightMatches = false;
  7093. this._scrollMatches = false;
  7094. this._pdfDocument = null;
  7095. this._pageMatches = [];
  7096. this._pageMatchesLength = [];
  7097. this._state = null;
  7098. this._selected = {
  7099. pageIdx: -1,
  7100. matchIdx: -1
  7101. };
  7102. this._offset = {
  7103. pageIdx: null,
  7104. matchIdx: null,
  7105. wrapped: false
  7106. };
  7107. this._extractTextPromises = [];
  7108. this._pageContents = [];
  7109. this._pageDiffs = [];
  7110. this._matchesCountTotal = 0;
  7111. this._pagesToSearch = null;
  7112. this._pendingFindMatches = new Set();
  7113. this._resumePageIdx = null;
  7114. this._dirtyMatch = false;
  7115. clearTimeout(this._findTimeout);
  7116. this._findTimeout = null;
  7117. this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)();
  7118. }
  7119. }, {
  7120. key: "_query",
  7121. get: function get() {
  7122. if (this._state.query !== this._rawQuery) {
  7123. this._rawQuery = this._state.query;
  7124. var _normalize = normalize(this._state.query);
  7125. var _normalize2 = _slicedToArray(_normalize, 1);
  7126. this._normalizedQuery = _normalize2[0];
  7127. }
  7128. return this._normalizedQuery;
  7129. }
  7130. }, {
  7131. key: "_shouldDirtyMatch",
  7132. value: function _shouldDirtyMatch(state) {
  7133. if (state.query !== this._state.query) {
  7134. return true;
  7135. }
  7136. switch (state.type) {
  7137. case "again":
  7138. var pageNumber = this._selected.pageIdx + 1;
  7139. var linkService = this._linkService;
  7140. if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) {
  7141. return true;
  7142. }
  7143. return false;
  7144. case "highlightallchange":
  7145. return false;
  7146. }
  7147. return true;
  7148. }
  7149. }, {
  7150. key: "_prepareMatches",
  7151. value: function _prepareMatches(matchesWithLength, matches, matchesLength) {
  7152. function isSubTerm(currentIndex) {
  7153. var currentElem = matchesWithLength[currentIndex];
  7154. var nextElem = matchesWithLength[currentIndex + 1];
  7155. if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) {
  7156. currentElem.skipped = true;
  7157. return true;
  7158. }
  7159. for (var i = currentIndex - 1; i >= 0; i--) {
  7160. var prevElem = matchesWithLength[i];
  7161. if (prevElem.skipped) {
  7162. continue;
  7163. }
  7164. if (prevElem.match + prevElem.matchLength < currentElem.match) {
  7165. break;
  7166. }
  7167. if (prevElem.match + prevElem.matchLength >= currentElem.match + currentElem.matchLength) {
  7168. currentElem.skipped = true;
  7169. return true;
  7170. }
  7171. }
  7172. return false;
  7173. }
  7174. matchesWithLength.sort(function (a, b) {
  7175. return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match;
  7176. });
  7177. for (var i = 0, len = matchesWithLength.length; i < len; i++) {
  7178. if (isSubTerm(i)) {
  7179. continue;
  7180. }
  7181. matches.push(matchesWithLength[i].match);
  7182. matchesLength.push(matchesWithLength[i].matchLength);
  7183. }
  7184. }
  7185. }, {
  7186. key: "_isEntireWord",
  7187. value: function _isEntireWord(content, startIdx, length) {
  7188. if (startIdx > 0) {
  7189. var first = content.charCodeAt(startIdx);
  7190. var limit = content.charCodeAt(startIdx - 1);
  7191. if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
  7192. return false;
  7193. }
  7194. }
  7195. var endIdx = startIdx + length - 1;
  7196. if (endIdx < content.length - 1) {
  7197. var last = content.charCodeAt(endIdx);
  7198. var _limit = content.charCodeAt(endIdx + 1);
  7199. if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(_limit)) {
  7200. return false;
  7201. }
  7202. }
  7203. return true;
  7204. }
  7205. }, {
  7206. key: "_calculatePhraseMatch",
  7207. value: function _calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
  7208. var matches = [],
  7209. matchesLength = [];
  7210. var queryLen = query.length;
  7211. var matchIdx = -queryLen;
  7212. while (true) {
  7213. matchIdx = pageContent.indexOf(query, matchIdx + queryLen);
  7214. if (matchIdx === -1) {
  7215. break;
  7216. }
  7217. if (entireWord && !this._isEntireWord(pageContent, matchIdx, queryLen)) {
  7218. continue;
  7219. }
  7220. var originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
  7221. matchEnd = matchIdx + queryLen - 1,
  7222. originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
  7223. matches.push(originalMatchIdx);
  7224. matchesLength.push(originalQueryLen);
  7225. }
  7226. this._pageMatches[pageIndex] = matches;
  7227. this._pageMatchesLength[pageIndex] = matchesLength;
  7228. }
  7229. }, {
  7230. key: "_calculateWordMatch",
  7231. value: function _calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
  7232. var matchesWithLength = [];
  7233. var queryArray = query.match(/\S+/g);
  7234. for (var i = 0, len = queryArray.length; i < len; i++) {
  7235. var subquery = queryArray[i];
  7236. var subqueryLen = subquery.length;
  7237. var matchIdx = -subqueryLen;
  7238. while (true) {
  7239. matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);
  7240. if (matchIdx === -1) {
  7241. break;
  7242. }
  7243. if (entireWord && !this._isEntireWord(pageContent, matchIdx, subqueryLen)) {
  7244. continue;
  7245. }
  7246. var originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
  7247. matchEnd = matchIdx + subqueryLen - 1,
  7248. originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
  7249. matchesWithLength.push({
  7250. match: originalMatchIdx,
  7251. matchLength: originalQueryLen,
  7252. skipped: false
  7253. });
  7254. }
  7255. }
  7256. this._pageMatchesLength[pageIndex] = [];
  7257. this._pageMatches[pageIndex] = [];
  7258. this._prepareMatches(matchesWithLength, this._pageMatches[pageIndex], this._pageMatchesLength[pageIndex]);
  7259. }
  7260. }, {
  7261. key: "_calculateMatch",
  7262. value: function _calculateMatch(pageIndex) {
  7263. var pageContent = this._pageContents[pageIndex];
  7264. var pageDiffs = this._pageDiffs[pageIndex];
  7265. var query = this._query;
  7266. var _this$_state = this._state,
  7267. caseSensitive = _this$_state.caseSensitive,
  7268. entireWord = _this$_state.entireWord,
  7269. phraseSearch = _this$_state.phraseSearch;
  7270. if (query.length === 0) {
  7271. return;
  7272. }
  7273. if (!caseSensitive) {
  7274. pageContent = pageContent.toLowerCase();
  7275. query = query.toLowerCase();
  7276. }
  7277. if (phraseSearch) {
  7278. this._calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
  7279. } else {
  7280. this._calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
  7281. }
  7282. if (this._state.highlightAll) {
  7283. this._updatePage(pageIndex);
  7284. }
  7285. if (this._resumePageIdx === pageIndex) {
  7286. this._resumePageIdx = null;
  7287. this._nextPageMatch();
  7288. }
  7289. var pageMatchesCount = this._pageMatches[pageIndex].length;
  7290. if (pageMatchesCount > 0) {
  7291. this._matchesCountTotal += pageMatchesCount;
  7292. this._updateUIResultsCount();
  7293. }
  7294. }
  7295. }, {
  7296. key: "_extractText",
  7297. value: function _extractText() {
  7298. var _this3 = this;
  7299. if (this._extractTextPromises.length > 0) {
  7300. return;
  7301. }
  7302. var promise = Promise.resolve();
  7303. var _loop = function _loop(i, ii) {
  7304. var extractTextCapability = (0, _pdfjsLib.createPromiseCapability)();
  7305. _this3._extractTextPromises[i] = extractTextCapability.promise;
  7306. promise = promise.then(function () {
  7307. return _this3._pdfDocument.getPage(i + 1).then(function (pdfPage) {
  7308. return pdfPage.getTextContent({
  7309. normalizeWhitespace: true
  7310. });
  7311. }).then(function (textContent) {
  7312. var textItems = textContent.items;
  7313. var strBuf = [];
  7314. for (var j = 0, jj = textItems.length; j < jj; j++) {
  7315. strBuf.push(textItems[j].str);
  7316. }
  7317. var _normalize3 = normalize(strBuf.join(""));
  7318. var _normalize4 = _slicedToArray(_normalize3, 2);
  7319. _this3._pageContents[i] = _normalize4[0];
  7320. _this3._pageDiffs[i] = _normalize4[1];
  7321. extractTextCapability.resolve(i);
  7322. }, function (reason) {
  7323. console.error("Unable to get text content for page ".concat(i + 1), reason);
  7324. _this3._pageContents[i] = "";
  7325. _this3._pageDiffs[i] = null;
  7326. extractTextCapability.resolve(i);
  7327. });
  7328. });
  7329. };
  7330. for (var i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
  7331. _loop(i, ii);
  7332. }
  7333. }
  7334. }, {
  7335. key: "_updatePage",
  7336. value: function _updatePage(index) {
  7337. if (this._scrollMatches && this._selected.pageIdx === index) {
  7338. this._linkService.page = index + 1;
  7339. }
  7340. this._eventBus.dispatch("updatetextlayermatches", {
  7341. source: this,
  7342. pageIndex: index
  7343. });
  7344. }
  7345. }, {
  7346. key: "_updateAllPages",
  7347. value: function _updateAllPages() {
  7348. this._eventBus.dispatch("updatetextlayermatches", {
  7349. source: this,
  7350. pageIndex: -1
  7351. });
  7352. }
  7353. }, {
  7354. key: "_nextMatch",
  7355. value: function _nextMatch() {
  7356. var _this4 = this;
  7357. var previous = this._state.findPrevious;
  7358. var currentPageIndex = this._linkService.page - 1;
  7359. var numPages = this._linkService.pagesCount;
  7360. this._highlightMatches = true;
  7361. if (this._dirtyMatch) {
  7362. this._dirtyMatch = false;
  7363. this._selected.pageIdx = this._selected.matchIdx = -1;
  7364. this._offset.pageIdx = currentPageIndex;
  7365. this._offset.matchIdx = null;
  7366. this._offset.wrapped = false;
  7367. this._resumePageIdx = null;
  7368. this._pageMatches.length = 0;
  7369. this._pageMatchesLength.length = 0;
  7370. this._matchesCountTotal = 0;
  7371. this._updateAllPages();
  7372. for (var i = 0; i < numPages; i++) {
  7373. if (this._pendingFindMatches.has(i)) {
  7374. continue;
  7375. }
  7376. this._pendingFindMatches.add(i);
  7377. this._extractTextPromises[i].then(function (pageIdx) {
  7378. _this4._pendingFindMatches["delete"](pageIdx);
  7379. _this4._calculateMatch(pageIdx);
  7380. });
  7381. }
  7382. }
  7383. if (this._query === "") {
  7384. this._updateUIState(FindState.FOUND);
  7385. return;
  7386. }
  7387. if (this._resumePageIdx) {
  7388. return;
  7389. }
  7390. var offset = this._offset;
  7391. this._pagesToSearch = numPages;
  7392. if (offset.matchIdx !== null) {
  7393. var numPageMatches = this._pageMatches[offset.pageIdx].length;
  7394. if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
  7395. offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
  7396. this._updateMatch(true);
  7397. return;
  7398. }
  7399. this._advanceOffsetPage(previous);
  7400. }
  7401. this._nextPageMatch();
  7402. }
  7403. }, {
  7404. key: "_matchesReady",
  7405. value: function _matchesReady(matches) {
  7406. var offset = this._offset;
  7407. var numMatches = matches.length;
  7408. var previous = this._state.findPrevious;
  7409. if (numMatches) {
  7410. offset.matchIdx = previous ? numMatches - 1 : 0;
  7411. this._updateMatch(true);
  7412. return true;
  7413. }
  7414. this._advanceOffsetPage(previous);
  7415. if (offset.wrapped) {
  7416. offset.matchIdx = null;
  7417. if (this._pagesToSearch < 0) {
  7418. this._updateMatch(false);
  7419. return true;
  7420. }
  7421. }
  7422. return false;
  7423. }
  7424. }, {
  7425. key: "_nextPageMatch",
  7426. value: function _nextPageMatch() {
  7427. if (this._resumePageIdx !== null) {
  7428. console.error("There can only be one pending page.");
  7429. }
  7430. var matches = null;
  7431. do {
  7432. var pageIdx = this._offset.pageIdx;
  7433. matches = this._pageMatches[pageIdx];
  7434. if (!matches) {
  7435. this._resumePageIdx = pageIdx;
  7436. break;
  7437. }
  7438. } while (!this._matchesReady(matches));
  7439. }
  7440. }, {
  7441. key: "_advanceOffsetPage",
  7442. value: function _advanceOffsetPage(previous) {
  7443. var offset = this._offset;
  7444. var numPages = this._linkService.pagesCount;
  7445. offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
  7446. offset.matchIdx = null;
  7447. this._pagesToSearch--;
  7448. if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
  7449. offset.pageIdx = previous ? numPages - 1 : 0;
  7450. offset.wrapped = true;
  7451. }
  7452. }
  7453. }, {
  7454. key: "_updateMatch",
  7455. value: function _updateMatch() {
  7456. var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7457. var state = FindState.NOT_FOUND;
  7458. var wrapped = this._offset.wrapped;
  7459. this._offset.wrapped = false;
  7460. if (found) {
  7461. var previousPage = this._selected.pageIdx;
  7462. this._selected.pageIdx = this._offset.pageIdx;
  7463. this._selected.matchIdx = this._offset.matchIdx;
  7464. state = wrapped ? FindState.WRAPPED : FindState.FOUND;
  7465. if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
  7466. this._updatePage(previousPage);
  7467. }
  7468. }
  7469. this._updateUIState(state, this._state.findPrevious);
  7470. if (this._selected.pageIdx !== -1) {
  7471. this._scrollMatches = true;
  7472. this._updatePage(this._selected.pageIdx);
  7473. }
  7474. }
  7475. }, {
  7476. key: "_onFindBarClose",
  7477. value: function _onFindBarClose(evt) {
  7478. var _this5 = this;
  7479. var pdfDocument = this._pdfDocument;
  7480. this._firstPageCapability.promise.then(function () {
  7481. if (!_this5._pdfDocument || pdfDocument && _this5._pdfDocument !== pdfDocument) {
  7482. return;
  7483. }
  7484. if (_this5._findTimeout) {
  7485. clearTimeout(_this5._findTimeout);
  7486. _this5._findTimeout = null;
  7487. }
  7488. if (_this5._resumePageIdx) {
  7489. _this5._resumePageIdx = null;
  7490. _this5._dirtyMatch = true;
  7491. }
  7492. _this5._updateUIState(FindState.FOUND);
  7493. _this5._highlightMatches = false;
  7494. _this5._updateAllPages();
  7495. });
  7496. }
  7497. }, {
  7498. key: "_requestMatchesCount",
  7499. value: function _requestMatchesCount() {
  7500. var _this$_selected = this._selected,
  7501. pageIdx = _this$_selected.pageIdx,
  7502. matchIdx = _this$_selected.matchIdx;
  7503. var current = 0,
  7504. total = this._matchesCountTotal;
  7505. if (matchIdx !== -1) {
  7506. for (var i = 0; i < pageIdx; i++) {
  7507. var _this$_pageMatches$i;
  7508. current += ((_this$_pageMatches$i = this._pageMatches[i]) === null || _this$_pageMatches$i === void 0 ? void 0 : _this$_pageMatches$i.length) || 0;
  7509. }
  7510. current += matchIdx + 1;
  7511. }
  7512. if (current < 1 || current > total) {
  7513. current = total = 0;
  7514. }
  7515. return {
  7516. current: current,
  7517. total: total
  7518. };
  7519. }
  7520. }, {
  7521. key: "_updateUIResultsCount",
  7522. value: function _updateUIResultsCount() {
  7523. this._eventBus.dispatch("updatefindmatchescount", {
  7524. source: this,
  7525. matchesCount: this._requestMatchesCount()
  7526. });
  7527. }
  7528. }, {
  7529. key: "_updateUIState",
  7530. value: function _updateUIState(state) {
  7531. var _this$_state$query, _this$_state2;
  7532. var previous = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7533. this._eventBus.dispatch("updatefindcontrolstate", {
  7534. source: this,
  7535. state: state,
  7536. previous: previous,
  7537. matchesCount: this._requestMatchesCount(),
  7538. 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
  7539. });
  7540. }
  7541. }]);
  7542. return PDFFindController;
  7543. }();
  7544. exports.PDFFindController = PDFFindController;
  7545. /***/ }),
  7546. /* 23 */
  7547. /***/ ((__unused_webpack_module, exports) => {
  7548. Object.defineProperty(exports, "__esModule", ({
  7549. value: true
  7550. }));
  7551. exports.CharacterType = void 0;
  7552. exports.getCharacterType = getCharacterType;
  7553. var CharacterType = {
  7554. SPACE: 0,
  7555. ALPHA_LETTER: 1,
  7556. PUNCT: 2,
  7557. HAN_LETTER: 3,
  7558. KATAKANA_LETTER: 4,
  7559. HIRAGANA_LETTER: 5,
  7560. HALFWIDTH_KATAKANA_LETTER: 6,
  7561. THAI_LETTER: 7
  7562. };
  7563. exports.CharacterType = CharacterType;
  7564. function isAlphabeticalScript(charCode) {
  7565. return charCode < 0x2e80;
  7566. }
  7567. function isAscii(charCode) {
  7568. return (charCode & 0xff80) === 0;
  7569. }
  7570. function isAsciiAlpha(charCode) {
  7571. return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a;
  7572. }
  7573. function isAsciiDigit(charCode) {
  7574. return charCode >= 0x30 && charCode <= 0x39;
  7575. }
  7576. function isAsciiSpace(charCode) {
  7577. return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a;
  7578. }
  7579. function isHan(charCode) {
  7580. return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff;
  7581. }
  7582. function isKatakana(charCode) {
  7583. return charCode >= 0x30a0 && charCode <= 0x30ff;
  7584. }
  7585. function isHiragana(charCode) {
  7586. return charCode >= 0x3040 && charCode <= 0x309f;
  7587. }
  7588. function isHalfwidthKatakana(charCode) {
  7589. return charCode >= 0xff60 && charCode <= 0xff9f;
  7590. }
  7591. function isThai(charCode) {
  7592. return (charCode & 0xff80) === 0x0e00;
  7593. }
  7594. function getCharacterType(charCode) {
  7595. if (isAlphabeticalScript(charCode)) {
  7596. if (isAscii(charCode)) {
  7597. if (isAsciiSpace(charCode)) {
  7598. return CharacterType.SPACE;
  7599. } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) {
  7600. return CharacterType.ALPHA_LETTER;
  7601. }
  7602. return CharacterType.PUNCT;
  7603. } else if (isThai(charCode)) {
  7604. return CharacterType.THAI_LETTER;
  7605. } else if (charCode === 0xa0) {
  7606. return CharacterType.SPACE;
  7607. }
  7608. return CharacterType.ALPHA_LETTER;
  7609. }
  7610. if (isHan(charCode)) {
  7611. return CharacterType.HAN_LETTER;
  7612. } else if (isKatakana(charCode)) {
  7613. return CharacterType.KATAKANA_LETTER;
  7614. } else if (isHiragana(charCode)) {
  7615. return CharacterType.HIRAGANA_LETTER;
  7616. } else if (isHalfwidthKatakana(charCode)) {
  7617. return CharacterType.HALFWIDTH_KATAKANA_LETTER;
  7618. }
  7619. return CharacterType.ALPHA_LETTER;
  7620. }
  7621. /***/ }),
  7622. /* 24 */
  7623. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7624. Object.defineProperty(exports, "__esModule", ({
  7625. value: true
  7626. }));
  7627. exports.PDFHistory = void 0;
  7628. exports.isDestArraysEqual = isDestArraysEqual;
  7629. exports.isDestHashesEqual = isDestHashesEqual;
  7630. var _ui_utils = __w_pdfjs_require__(8);
  7631. var _event_utils = __w_pdfjs_require__(19);
  7632. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7633. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  7634. 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."); }
  7635. 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); }
  7636. 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; }
  7637. 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; }
  7638. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  7639. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7640. 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); } }
  7641. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  7642. var HASH_CHANGE_TIMEOUT = 1000;
  7643. var POSITION_UPDATED_THRESHOLD = 50;
  7644. var UPDATE_VIEWAREA_TIMEOUT = 1000;
  7645. function getCurrentHash() {
  7646. return document.location.hash;
  7647. }
  7648. var PDFHistory = /*#__PURE__*/function () {
  7649. function PDFHistory(_ref) {
  7650. var _this = this;
  7651. var linkService = _ref.linkService,
  7652. eventBus = _ref.eventBus;
  7653. _classCallCheck(this, PDFHistory);
  7654. this.linkService = linkService;
  7655. this.eventBus = eventBus;
  7656. this._initialized = false;
  7657. this._fingerprint = "";
  7658. this.reset();
  7659. this._boundEvents = null;
  7660. this._isViewerInPresentationMode = false;
  7661. this.eventBus._on("presentationmodechanged", function (evt) {
  7662. _this._isViewerInPresentationMode = evt.state !== _ui_utils.PresentationModeState.NORMAL;
  7663. });
  7664. this.eventBus._on("pagesinit", function () {
  7665. _this._isPagesLoaded = false;
  7666. _this.eventBus._on("pagesloaded", function (evt) {
  7667. _this._isPagesLoaded = !!evt.pagesCount;
  7668. }, {
  7669. once: true
  7670. });
  7671. });
  7672. }
  7673. _createClass(PDFHistory, [{
  7674. key: "initialize",
  7675. value: function initialize(_ref2) {
  7676. var fingerprint = _ref2.fingerprint,
  7677. _ref2$resetHistory = _ref2.resetHistory,
  7678. resetHistory = _ref2$resetHistory === void 0 ? false : _ref2$resetHistory,
  7679. _ref2$updateUrl = _ref2.updateUrl,
  7680. updateUrl = _ref2$updateUrl === void 0 ? false : _ref2$updateUrl;
  7681. if (!fingerprint || typeof fingerprint !== "string") {
  7682. console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
  7683. return;
  7684. }
  7685. if (this._initialized) {
  7686. this.reset();
  7687. }
  7688. var reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
  7689. this._fingerprint = fingerprint;
  7690. this._updateUrl = updateUrl === true;
  7691. this._initialized = true;
  7692. this._bindEvents();
  7693. var state = window.history.state;
  7694. this._popStateInProgress = false;
  7695. this._blockHashChange = 0;
  7696. this._currentHash = getCurrentHash();
  7697. this._numPositionUpdates = 0;
  7698. this._uid = this._maxUid = 0;
  7699. this._destination = null;
  7700. this._position = null;
  7701. if (!this._isValidState(state, true) || resetHistory) {
  7702. var _this$_parseCurrentHa = this._parseCurrentHash(true),
  7703. hash = _this$_parseCurrentHa.hash,
  7704. page = _this$_parseCurrentHa.page,
  7705. rotation = _this$_parseCurrentHa.rotation;
  7706. if (!hash || reInitialized || resetHistory) {
  7707. this._pushOrReplaceState(null, true);
  7708. return;
  7709. }
  7710. this._pushOrReplaceState({
  7711. hash: hash,
  7712. page: page,
  7713. rotation: rotation
  7714. }, true);
  7715. return;
  7716. }
  7717. var destination = state.destination;
  7718. this._updateInternalState(destination, state.uid, true);
  7719. if (destination.rotation !== undefined) {
  7720. this._initialRotation = destination.rotation;
  7721. }
  7722. if (destination.dest) {
  7723. this._initialBookmark = JSON.stringify(destination.dest);
  7724. this._destination.page = null;
  7725. } else if (destination.hash) {
  7726. this._initialBookmark = destination.hash;
  7727. } else if (destination.page) {
  7728. this._initialBookmark = "page=".concat(destination.page);
  7729. }
  7730. }
  7731. }, {
  7732. key: "reset",
  7733. value: function reset() {
  7734. if (this._initialized) {
  7735. this._pageHide();
  7736. this._initialized = false;
  7737. this._unbindEvents();
  7738. }
  7739. if (this._updateViewareaTimeout) {
  7740. clearTimeout(this._updateViewareaTimeout);
  7741. this._updateViewareaTimeout = null;
  7742. }
  7743. this._initialBookmark = null;
  7744. this._initialRotation = null;
  7745. }
  7746. }, {
  7747. key: "push",
  7748. value: function push(_ref3) {
  7749. var _this2 = this;
  7750. var _ref3$namedDest = _ref3.namedDest,
  7751. namedDest = _ref3$namedDest === void 0 ? null : _ref3$namedDest,
  7752. explicitDest = _ref3.explicitDest,
  7753. pageNumber = _ref3.pageNumber;
  7754. if (!this._initialized) {
  7755. return;
  7756. }
  7757. if (namedDest && typeof namedDest !== "string") {
  7758. console.error("PDFHistory.push: " + "\"".concat(namedDest, "\" is not a valid namedDest parameter."));
  7759. return;
  7760. } else if (!Array.isArray(explicitDest)) {
  7761. console.error("PDFHistory.push: " + "\"".concat(explicitDest, "\" is not a valid explicitDest parameter."));
  7762. return;
  7763. } else if (!this._isValidPage(pageNumber)) {
  7764. if (pageNumber !== null || this._destination) {
  7765. console.error("PDFHistory.push: " + "\"".concat(pageNumber, "\" is not a valid pageNumber parameter."));
  7766. return;
  7767. }
  7768. }
  7769. var hash = namedDest || JSON.stringify(explicitDest);
  7770. if (!hash) {
  7771. return;
  7772. }
  7773. var forceReplace = false;
  7774. if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
  7775. if (this._destination.page) {
  7776. return;
  7777. }
  7778. forceReplace = true;
  7779. }
  7780. if (this._popStateInProgress && !forceReplace) {
  7781. return;
  7782. }
  7783. this._pushOrReplaceState({
  7784. dest: explicitDest,
  7785. hash: hash,
  7786. page: pageNumber,
  7787. rotation: this.linkService.rotation
  7788. }, forceReplace);
  7789. if (!this._popStateInProgress) {
  7790. this._popStateInProgress = true;
  7791. Promise.resolve().then(function () {
  7792. _this2._popStateInProgress = false;
  7793. });
  7794. }
  7795. }
  7796. }, {
  7797. key: "pushPage",
  7798. value: function pushPage(pageNumber) {
  7799. var _this$_destination,
  7800. _this3 = this;
  7801. if (!this._initialized) {
  7802. return;
  7803. }
  7804. if (!this._isValidPage(pageNumber)) {
  7805. console.error("PDFHistory.pushPage: \"".concat(pageNumber, "\" is not a valid page number."));
  7806. return;
  7807. }
  7808. if (((_this$_destination = this._destination) === null || _this$_destination === void 0 ? void 0 : _this$_destination.page) === pageNumber) {
  7809. return;
  7810. }
  7811. if (this._popStateInProgress) {
  7812. return;
  7813. }
  7814. this._pushOrReplaceState({
  7815. dest: null,
  7816. hash: "page=".concat(pageNumber),
  7817. page: pageNumber,
  7818. rotation: this.linkService.rotation
  7819. });
  7820. if (!this._popStateInProgress) {
  7821. this._popStateInProgress = true;
  7822. Promise.resolve().then(function () {
  7823. _this3._popStateInProgress = false;
  7824. });
  7825. }
  7826. }
  7827. }, {
  7828. key: "pushCurrentPosition",
  7829. value: function pushCurrentPosition() {
  7830. if (!this._initialized || this._popStateInProgress) {
  7831. return;
  7832. }
  7833. this._tryPushCurrentPosition();
  7834. }
  7835. }, {
  7836. key: "back",
  7837. value: function back() {
  7838. if (!this._initialized || this._popStateInProgress) {
  7839. return;
  7840. }
  7841. var state = window.history.state;
  7842. if (this._isValidState(state) && state.uid > 0) {
  7843. window.history.back();
  7844. }
  7845. }
  7846. }, {
  7847. key: "forward",
  7848. value: function forward() {
  7849. if (!this._initialized || this._popStateInProgress) {
  7850. return;
  7851. }
  7852. var state = window.history.state;
  7853. if (this._isValidState(state) && state.uid < this._maxUid) {
  7854. window.history.forward();
  7855. }
  7856. }
  7857. }, {
  7858. key: "popStateInProgress",
  7859. get: function get() {
  7860. return this._initialized && (this._popStateInProgress || this._blockHashChange > 0);
  7861. }
  7862. }, {
  7863. key: "initialBookmark",
  7864. get: function get() {
  7865. return this._initialized ? this._initialBookmark : null;
  7866. }
  7867. }, {
  7868. key: "initialRotation",
  7869. get: function get() {
  7870. return this._initialized ? this._initialRotation : null;
  7871. }
  7872. }, {
  7873. key: "_pushOrReplaceState",
  7874. value: function _pushOrReplaceState(destination) {
  7875. var forceReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7876. var shouldReplace = forceReplace || !this._destination;
  7877. var newState = {
  7878. fingerprint: this._fingerprint,
  7879. uid: shouldReplace ? this._uid : this._uid + 1,
  7880. destination: destination
  7881. };
  7882. this._updateInternalState(destination, newState.uid);
  7883. var newUrl;
  7884. if (this._updateUrl && destination !== null && destination !== void 0 && destination.hash) {
  7885. var baseUrl = document.location.href.split("#")[0];
  7886. if (!baseUrl.startsWith("file://")) {
  7887. newUrl = "".concat(baseUrl, "#").concat(destination.hash);
  7888. }
  7889. }
  7890. if (shouldReplace) {
  7891. window.history.replaceState(newState, "", newUrl);
  7892. } else {
  7893. window.history.pushState(newState, "", newUrl);
  7894. }
  7895. }
  7896. }, {
  7897. key: "_tryPushCurrentPosition",
  7898. value: function _tryPushCurrentPosition() {
  7899. var temporary = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7900. if (!this._position) {
  7901. return;
  7902. }
  7903. var position = this._position;
  7904. if (temporary) {
  7905. position = Object.assign(Object.create(null), this._position);
  7906. position.temporary = true;
  7907. }
  7908. if (!this._destination) {
  7909. this._pushOrReplaceState(position);
  7910. return;
  7911. }
  7912. if (this._destination.temporary) {
  7913. this._pushOrReplaceState(position, true);
  7914. return;
  7915. }
  7916. if (this._destination.hash === position.hash) {
  7917. return;
  7918. }
  7919. if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {
  7920. return;
  7921. }
  7922. var forceReplace = false;
  7923. if (this._destination.page >= position.first && this._destination.page <= position.page) {
  7924. if (this._destination.dest !== undefined || !this._destination.first) {
  7925. return;
  7926. }
  7927. forceReplace = true;
  7928. }
  7929. this._pushOrReplaceState(position, forceReplace);
  7930. }
  7931. }, {
  7932. key: "_isValidPage",
  7933. value: function _isValidPage(val) {
  7934. return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount;
  7935. }
  7936. }, {
  7937. key: "_isValidState",
  7938. value: function _isValidState(state) {
  7939. var checkReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7940. if (!state) {
  7941. return false;
  7942. }
  7943. if (state.fingerprint !== this._fingerprint) {
  7944. if (checkReload) {
  7945. if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) {
  7946. return false;
  7947. }
  7948. var _performance$getEntri = performance.getEntriesByType("navigation"),
  7949. _performance$getEntri2 = _slicedToArray(_performance$getEntri, 1),
  7950. perfEntry = _performance$getEntri2[0];
  7951. if ((perfEntry === null || perfEntry === void 0 ? void 0 : perfEntry.type) !== "reload") {
  7952. return false;
  7953. }
  7954. } else {
  7955. return false;
  7956. }
  7957. }
  7958. if (!Number.isInteger(state.uid) || state.uid < 0) {
  7959. return false;
  7960. }
  7961. if (state.destination === null || _typeof(state.destination) !== "object") {
  7962. return false;
  7963. }
  7964. return true;
  7965. }
  7966. }, {
  7967. key: "_updateInternalState",
  7968. value: function _updateInternalState(destination, uid) {
  7969. var removeTemporary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  7970. if (this._updateViewareaTimeout) {
  7971. clearTimeout(this._updateViewareaTimeout);
  7972. this._updateViewareaTimeout = null;
  7973. }
  7974. if (removeTemporary && destination !== null && destination !== void 0 && destination.temporary) {
  7975. delete destination.temporary;
  7976. }
  7977. this._destination = destination;
  7978. this._uid = uid;
  7979. this._maxUid = Math.max(this._maxUid, uid);
  7980. this._numPositionUpdates = 0;
  7981. }
  7982. }, {
  7983. key: "_parseCurrentHash",
  7984. value: function _parseCurrentHash() {
  7985. var checkNameddest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7986. var hash = unescape(getCurrentHash()).substring(1);
  7987. var params = (0, _ui_utils.parseQueryString)(hash);
  7988. var nameddest = params.get("nameddest") || "";
  7989. var page = params.get("page") | 0;
  7990. if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) {
  7991. page = null;
  7992. }
  7993. return {
  7994. hash: hash,
  7995. page: page,
  7996. rotation: this.linkService.rotation
  7997. };
  7998. }
  7999. }, {
  8000. key: "_updateViewarea",
  8001. value: function _updateViewarea(_ref4) {
  8002. var _this4 = this;
  8003. var location = _ref4.location;
  8004. if (this._updateViewareaTimeout) {
  8005. clearTimeout(this._updateViewareaTimeout);
  8006. this._updateViewareaTimeout = null;
  8007. }
  8008. this._position = {
  8009. hash: this._isViewerInPresentationMode ? "page=".concat(location.pageNumber) : location.pdfOpenParams.substring(1),
  8010. page: this.linkService.page,
  8011. first: location.pageNumber,
  8012. rotation: location.rotation
  8013. };
  8014. if (this._popStateInProgress) {
  8015. return;
  8016. }
  8017. if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) {
  8018. this._numPositionUpdates++;
  8019. }
  8020. if (UPDATE_VIEWAREA_TIMEOUT > 0) {
  8021. this._updateViewareaTimeout = setTimeout(function () {
  8022. if (!_this4._popStateInProgress) {
  8023. _this4._tryPushCurrentPosition(true);
  8024. }
  8025. _this4._updateViewareaTimeout = null;
  8026. }, UPDATE_VIEWAREA_TIMEOUT);
  8027. }
  8028. }
  8029. }, {
  8030. key: "_popState",
  8031. value: function _popState(_ref5) {
  8032. var _this5 = this;
  8033. var state = _ref5.state;
  8034. var newHash = getCurrentHash(),
  8035. hashChanged = this._currentHash !== newHash;
  8036. this._currentHash = newHash;
  8037. if (!state) {
  8038. this._uid++;
  8039. var _this$_parseCurrentHa2 = this._parseCurrentHash(),
  8040. hash = _this$_parseCurrentHa2.hash,
  8041. page = _this$_parseCurrentHa2.page,
  8042. rotation = _this$_parseCurrentHa2.rotation;
  8043. this._pushOrReplaceState({
  8044. hash: hash,
  8045. page: page,
  8046. rotation: rotation
  8047. }, true);
  8048. return;
  8049. }
  8050. if (!this._isValidState(state)) {
  8051. return;
  8052. }
  8053. this._popStateInProgress = true;
  8054. if (hashChanged) {
  8055. this._blockHashChange++;
  8056. (0, _event_utils.waitOnEventOrTimeout)({
  8057. target: window,
  8058. name: "hashchange",
  8059. delay: HASH_CHANGE_TIMEOUT
  8060. }).then(function () {
  8061. _this5._blockHashChange--;
  8062. });
  8063. }
  8064. var destination = state.destination;
  8065. this._updateInternalState(destination, state.uid, true);
  8066. if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
  8067. this.linkService.rotation = destination.rotation;
  8068. }
  8069. if (destination.dest) {
  8070. this.linkService.goToDestination(destination.dest);
  8071. } else if (destination.hash) {
  8072. this.linkService.setHash(destination.hash);
  8073. } else if (destination.page) {
  8074. this.linkService.page = destination.page;
  8075. }
  8076. Promise.resolve().then(function () {
  8077. _this5._popStateInProgress = false;
  8078. });
  8079. }
  8080. }, {
  8081. key: "_pageHide",
  8082. value: function _pageHide() {
  8083. if (!this._destination || this._destination.temporary) {
  8084. this._tryPushCurrentPosition();
  8085. }
  8086. }
  8087. }, {
  8088. key: "_bindEvents",
  8089. value: function _bindEvents() {
  8090. if (this._boundEvents) {
  8091. return;
  8092. }
  8093. this._boundEvents = {
  8094. updateViewarea: this._updateViewarea.bind(this),
  8095. popState: this._popState.bind(this),
  8096. pageHide: this._pageHide.bind(this)
  8097. };
  8098. this.eventBus._on("updateviewarea", this._boundEvents.updateViewarea);
  8099. window.addEventListener("popstate", this._boundEvents.popState);
  8100. window.addEventListener("pagehide", this._boundEvents.pageHide);
  8101. }
  8102. }, {
  8103. key: "_unbindEvents",
  8104. value: function _unbindEvents() {
  8105. if (!this._boundEvents) {
  8106. return;
  8107. }
  8108. this.eventBus._off("updateviewarea", this._boundEvents.updateViewarea);
  8109. window.removeEventListener("popstate", this._boundEvents.popState);
  8110. window.removeEventListener("pagehide", this._boundEvents.pageHide);
  8111. this._boundEvents = null;
  8112. }
  8113. }]);
  8114. return PDFHistory;
  8115. }();
  8116. exports.PDFHistory = PDFHistory;
  8117. function isDestHashesEqual(destHash, pushHash) {
  8118. if (typeof destHash !== "string" || typeof pushHash !== "string") {
  8119. return false;
  8120. }
  8121. if (destHash === pushHash) {
  8122. return true;
  8123. }
  8124. var nameddest = (0, _ui_utils.parseQueryString)(destHash).get("nameddest");
  8125. if (nameddest === pushHash) {
  8126. return true;
  8127. }
  8128. return false;
  8129. }
  8130. function isDestArraysEqual(firstDest, secondDest) {
  8131. function isEntryEqual(first, second) {
  8132. if (_typeof(first) !== _typeof(second)) {
  8133. return false;
  8134. }
  8135. if (Array.isArray(first) || Array.isArray(second)) {
  8136. return false;
  8137. }
  8138. if (first !== null && _typeof(first) === "object" && second !== null) {
  8139. if (Object.keys(first).length !== Object.keys(second).length) {
  8140. return false;
  8141. }
  8142. for (var key in first) {
  8143. if (!isEntryEqual(first[key], second[key])) {
  8144. return false;
  8145. }
  8146. }
  8147. return true;
  8148. }
  8149. return first === second || Number.isNaN(first) && Number.isNaN(second);
  8150. }
  8151. if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {
  8152. return false;
  8153. }
  8154. if (firstDest.length !== secondDest.length) {
  8155. return false;
  8156. }
  8157. for (var i = 0, ii = firstDest.length; i < ii; i++) {
  8158. if (!isEntryEqual(firstDest[i], secondDest[i])) {
  8159. return false;
  8160. }
  8161. }
  8162. return true;
  8163. }
  8164. /***/ }),
  8165. /* 25 */
  8166. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8167. Object.defineProperty(exports, "__esModule", ({
  8168. value: true
  8169. }));
  8170. exports.PDFScriptingManager = void 0;
  8171. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  8172. var _ui_utils = __w_pdfjs_require__(8);
  8173. var _pdfjsLib = __w_pdfjs_require__(5);
  8174. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8175. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  8176. 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."); }
  8177. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  8178. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  8179. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  8180. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  8181. 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; }
  8182. 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; } } }; }
  8183. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  8184. 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."); }
  8185. 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); }
  8186. 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; }
  8187. 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; }
  8188. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  8189. 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); } }
  8190. 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); }); }; }
  8191. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8192. 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); } }
  8193. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8194. var PDFScriptingManager = /*#__PURE__*/function () {
  8195. function PDFScriptingManager(_ref) {
  8196. var _this = this;
  8197. var eventBus = _ref.eventBus,
  8198. _ref$sandboxBundleSrc = _ref.sandboxBundleSrc,
  8199. sandboxBundleSrc = _ref$sandboxBundleSrc === void 0 ? null : _ref$sandboxBundleSrc,
  8200. _ref$scriptingFactory = _ref.scriptingFactory,
  8201. scriptingFactory = _ref$scriptingFactory === void 0 ? null : _ref$scriptingFactory,
  8202. _ref$docPropertiesLoo = _ref.docPropertiesLookup,
  8203. docPropertiesLookup = _ref$docPropertiesLoo === void 0 ? null : _ref$docPropertiesLoo;
  8204. _classCallCheck(this, PDFScriptingManager);
  8205. this._pdfDocument = null;
  8206. this._pdfViewer = null;
  8207. this._closeCapability = null;
  8208. this._destroyCapability = null;
  8209. this._scripting = null;
  8210. this._mouseState = Object.create(null);
  8211. this._ready = false;
  8212. this._eventBus = eventBus;
  8213. this._sandboxBundleSrc = sandboxBundleSrc;
  8214. this._scriptingFactory = scriptingFactory;
  8215. this._docPropertiesLookup = docPropertiesLookup;
  8216. if (!this._scriptingFactory) {
  8217. window.addEventListener("updatefromsandbox", function (event) {
  8218. _this._eventBus.dispatch("updatefromsandbox", {
  8219. source: window,
  8220. detail: event.detail
  8221. });
  8222. });
  8223. }
  8224. }
  8225. _createClass(PDFScriptingManager, [{
  8226. key: "setViewer",
  8227. value: function setViewer(pdfViewer) {
  8228. this._pdfViewer = pdfViewer;
  8229. }
  8230. }, {
  8231. key: "setDocument",
  8232. value: function () {
  8233. var _setDocument = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pdfDocument) {
  8234. var _this2 = this,
  8235. _this$_scripting;
  8236. var _yield$Promise$all, _yield$Promise$all2, objects, calculationOrder, docActions, _iterator, _step, _step$value, name, listener, _iterator2, _step2, _step2$value, _name, _listener, docProperties;
  8237. return _regenerator["default"].wrap(function _callee2$(_context2) {
  8238. while (1) {
  8239. switch (_context2.prev = _context2.next) {
  8240. case 0:
  8241. if (!this._pdfDocument) {
  8242. _context2.next = 3;
  8243. break;
  8244. }
  8245. _context2.next = 3;
  8246. return this._destroyScripting();
  8247. case 3:
  8248. this._pdfDocument = pdfDocument;
  8249. if (pdfDocument) {
  8250. _context2.next = 6;
  8251. break;
  8252. }
  8253. return _context2.abrupt("return");
  8254. case 6:
  8255. _context2.next = 8;
  8256. return Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]);
  8257. case 8:
  8258. _yield$Promise$all = _context2.sent;
  8259. _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
  8260. objects = _yield$Promise$all2[0];
  8261. calculationOrder = _yield$Promise$all2[1];
  8262. docActions = _yield$Promise$all2[2];
  8263. if (!(!objects && !docActions)) {
  8264. _context2.next = 17;
  8265. break;
  8266. }
  8267. _context2.next = 16;
  8268. return this._destroyScripting();
  8269. case 16:
  8270. return _context2.abrupt("return");
  8271. case 17:
  8272. if (!(pdfDocument !== this._pdfDocument)) {
  8273. _context2.next = 19;
  8274. break;
  8275. }
  8276. return _context2.abrupt("return");
  8277. case 19:
  8278. _context2.prev = 19;
  8279. this._scripting = this._createScripting();
  8280. _context2.next = 29;
  8281. break;
  8282. case 23:
  8283. _context2.prev = 23;
  8284. _context2.t0 = _context2["catch"](19);
  8285. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message, "\"."));
  8286. _context2.next = 28;
  8287. return this._destroyScripting();
  8288. case 28:
  8289. return _context2.abrupt("return");
  8290. case 29:
  8291. this._internalEvents.set("updatefromsandbox", function (event) {
  8292. if ((event === null || event === void 0 ? void 0 : event.source) !== window) {
  8293. return;
  8294. }
  8295. _this2._updateFromSandbox(event.detail);
  8296. });
  8297. this._internalEvents.set("dispatcheventinsandbox", function (event) {
  8298. var _this2$_scripting;
  8299. (_this2$_scripting = _this2._scripting) === null || _this2$_scripting === void 0 ? void 0 : _this2$_scripting.dispatchEventInSandbox(event.detail);
  8300. });
  8301. this._internalEvents.set("pagechanging", function (_ref2) {
  8302. var pageNumber = _ref2.pageNumber,
  8303. previous = _ref2.previous;
  8304. if (pageNumber === previous) {
  8305. return;
  8306. }
  8307. _this2._dispatchPageClose(previous);
  8308. _this2._dispatchPageOpen(pageNumber);
  8309. });
  8310. this._internalEvents.set("pagerendered", function (_ref3) {
  8311. var pageNumber = _ref3.pageNumber;
  8312. if (!_this2._pageOpenPending.has(pageNumber)) {
  8313. return;
  8314. }
  8315. if (pageNumber !== _this2._pdfViewer.currentPageNumber) {
  8316. return;
  8317. }
  8318. _this2._dispatchPageOpen(pageNumber);
  8319. });
  8320. this._internalEvents.set("pagesdestroy", /*#__PURE__*/function () {
  8321. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
  8322. var _this2$_scripting2, _this2$_closeCapabili;
  8323. return _regenerator["default"].wrap(function _callee$(_context) {
  8324. while (1) {
  8325. switch (_context.prev = _context.next) {
  8326. case 0:
  8327. _context.next = 2;
  8328. return _this2._dispatchPageClose(_this2._pdfViewer.currentPageNumber);
  8329. case 2:
  8330. _context.next = 4;
  8331. return (_this2$_scripting2 = _this2._scripting) === null || _this2$_scripting2 === void 0 ? void 0 : _this2$_scripting2.dispatchEventInSandbox({
  8332. id: "doc",
  8333. name: "WillClose"
  8334. });
  8335. case 4:
  8336. (_this2$_closeCapabili = _this2._closeCapability) === null || _this2$_closeCapabili === void 0 ? void 0 : _this2$_closeCapabili.resolve();
  8337. case 5:
  8338. case "end":
  8339. return _context.stop();
  8340. }
  8341. }
  8342. }, _callee);
  8343. }));
  8344. return function (_x2) {
  8345. return _ref4.apply(this, arguments);
  8346. };
  8347. }());
  8348. this._domEvents.set("mousedown", function (event) {
  8349. _this2._mouseState.isDown = true;
  8350. });
  8351. this._domEvents.set("mouseup", function (event) {
  8352. _this2._mouseState.isDown = false;
  8353. });
  8354. _iterator = _createForOfIteratorHelper(this._internalEvents);
  8355. try {
  8356. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  8357. _step$value = _slicedToArray(_step.value, 2), name = _step$value[0], listener = _step$value[1];
  8358. this._eventBus._on(name, listener);
  8359. }
  8360. } catch (err) {
  8361. _iterator.e(err);
  8362. } finally {
  8363. _iterator.f();
  8364. }
  8365. _iterator2 = _createForOfIteratorHelper(this._domEvents);
  8366. try {
  8367. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  8368. _step2$value = _slicedToArray(_step2.value, 2), _name = _step2$value[0], _listener = _step2$value[1];
  8369. window.addEventListener(_name, _listener);
  8370. }
  8371. } catch (err) {
  8372. _iterator2.e(err);
  8373. } finally {
  8374. _iterator2.f();
  8375. }
  8376. _context2.prev = 40;
  8377. _context2.next = 43;
  8378. return this._getDocProperties();
  8379. case 43:
  8380. docProperties = _context2.sent;
  8381. if (!(pdfDocument !== this._pdfDocument)) {
  8382. _context2.next = 46;
  8383. break;
  8384. }
  8385. return _context2.abrupt("return");
  8386. case 46:
  8387. _context2.next = 48;
  8388. return this._scripting.createSandbox({
  8389. objects: objects,
  8390. calculationOrder: calculationOrder,
  8391. appInfo: {
  8392. platform: navigator.platform,
  8393. language: navigator.language
  8394. },
  8395. docInfo: _objectSpread(_objectSpread({}, docProperties), {}, {
  8396. actions: docActions
  8397. })
  8398. });
  8399. case 48:
  8400. this._eventBus.dispatch("sandboxcreated", {
  8401. source: this
  8402. });
  8403. _context2.next = 57;
  8404. break;
  8405. case 51:
  8406. _context2.prev = 51;
  8407. _context2.t1 = _context2["catch"](40);
  8408. console.error("PDFScriptingManager.setDocument: \"".concat(_context2.t1 === null || _context2.t1 === void 0 ? void 0 : _context2.t1.message, "\"."));
  8409. _context2.next = 56;
  8410. return this._destroyScripting();
  8411. case 56:
  8412. return _context2.abrupt("return");
  8413. case 57:
  8414. _context2.next = 59;
  8415. return (_this$_scripting = this._scripting) === null || _this$_scripting === void 0 ? void 0 : _this$_scripting.dispatchEventInSandbox({
  8416. id: "doc",
  8417. name: "Open"
  8418. });
  8419. case 59:
  8420. _context2.next = 61;
  8421. return this._dispatchPageOpen(this._pdfViewer.currentPageNumber, true);
  8422. case 61:
  8423. Promise.resolve().then(function () {
  8424. if (pdfDocument === _this2._pdfDocument) {
  8425. _this2._ready = true;
  8426. }
  8427. });
  8428. case 62:
  8429. case "end":
  8430. return _context2.stop();
  8431. }
  8432. }
  8433. }, _callee2, this, [[19, 23], [40, 51]]);
  8434. }));
  8435. function setDocument(_x) {
  8436. return _setDocument.apply(this, arguments);
  8437. }
  8438. return setDocument;
  8439. }()
  8440. }, {
  8441. key: "dispatchWillSave",
  8442. value: function () {
  8443. var _dispatchWillSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3(detail) {
  8444. var _this$_scripting2;
  8445. return _regenerator["default"].wrap(function _callee3$(_context3) {
  8446. while (1) {
  8447. switch (_context3.prev = _context3.next) {
  8448. case 0:
  8449. return _context3.abrupt("return", (_this$_scripting2 = this._scripting) === null || _this$_scripting2 === void 0 ? void 0 : _this$_scripting2.dispatchEventInSandbox({
  8450. id: "doc",
  8451. name: "WillSave"
  8452. }));
  8453. case 1:
  8454. case "end":
  8455. return _context3.stop();
  8456. }
  8457. }
  8458. }, _callee3, this);
  8459. }));
  8460. function dispatchWillSave(_x3) {
  8461. return _dispatchWillSave.apply(this, arguments);
  8462. }
  8463. return dispatchWillSave;
  8464. }()
  8465. }, {
  8466. key: "dispatchDidSave",
  8467. value: function () {
  8468. var _dispatchDidSave = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(detail) {
  8469. var _this$_scripting3;
  8470. return _regenerator["default"].wrap(function _callee4$(_context4) {
  8471. while (1) {
  8472. switch (_context4.prev = _context4.next) {
  8473. case 0:
  8474. return _context4.abrupt("return", (_this$_scripting3 = this._scripting) === null || _this$_scripting3 === void 0 ? void 0 : _this$_scripting3.dispatchEventInSandbox({
  8475. id: "doc",
  8476. name: "DidSave"
  8477. }));
  8478. case 1:
  8479. case "end":
  8480. return _context4.stop();
  8481. }
  8482. }
  8483. }, _callee4, this);
  8484. }));
  8485. function dispatchDidSave(_x4) {
  8486. return _dispatchDidSave.apply(this, arguments);
  8487. }
  8488. return dispatchDidSave;
  8489. }()
  8490. }, {
  8491. key: "dispatchWillPrint",
  8492. value: function () {
  8493. var _dispatchWillPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5(detail) {
  8494. var _this$_scripting4;
  8495. return _regenerator["default"].wrap(function _callee5$(_context5) {
  8496. while (1) {
  8497. switch (_context5.prev = _context5.next) {
  8498. case 0:
  8499. return _context5.abrupt("return", (_this$_scripting4 = this._scripting) === null || _this$_scripting4 === void 0 ? void 0 : _this$_scripting4.dispatchEventInSandbox({
  8500. id: "doc",
  8501. name: "WillPrint"
  8502. }));
  8503. case 1:
  8504. case "end":
  8505. return _context5.stop();
  8506. }
  8507. }
  8508. }, _callee5, this);
  8509. }));
  8510. function dispatchWillPrint(_x5) {
  8511. return _dispatchWillPrint.apply(this, arguments);
  8512. }
  8513. return dispatchWillPrint;
  8514. }()
  8515. }, {
  8516. key: "dispatchDidPrint",
  8517. value: function () {
  8518. var _dispatchDidPrint = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6(detail) {
  8519. var _this$_scripting5;
  8520. return _regenerator["default"].wrap(function _callee6$(_context6) {
  8521. while (1) {
  8522. switch (_context6.prev = _context6.next) {
  8523. case 0:
  8524. return _context6.abrupt("return", (_this$_scripting5 = this._scripting) === null || _this$_scripting5 === void 0 ? void 0 : _this$_scripting5.dispatchEventInSandbox({
  8525. id: "doc",
  8526. name: "DidPrint"
  8527. }));
  8528. case 1:
  8529. case "end":
  8530. return _context6.stop();
  8531. }
  8532. }
  8533. }, _callee6, this);
  8534. }));
  8535. function dispatchDidPrint(_x6) {
  8536. return _dispatchDidPrint.apply(this, arguments);
  8537. }
  8538. return dispatchDidPrint;
  8539. }()
  8540. }, {
  8541. key: "mouseState",
  8542. get: function get() {
  8543. return this._mouseState;
  8544. }
  8545. }, {
  8546. key: "destroyPromise",
  8547. get: function get() {
  8548. var _this$_destroyCapabil;
  8549. return ((_this$_destroyCapabil = this._destroyCapability) === null || _this$_destroyCapabil === void 0 ? void 0 : _this$_destroyCapabil.promise) || null;
  8550. }
  8551. }, {
  8552. key: "ready",
  8553. get: function get() {
  8554. return this._ready;
  8555. }
  8556. }, {
  8557. key: "_internalEvents",
  8558. get: function get() {
  8559. return (0, _pdfjsLib.shadow)(this, "_internalEvents", new Map());
  8560. }
  8561. }, {
  8562. key: "_domEvents",
  8563. get: function get() {
  8564. return (0, _pdfjsLib.shadow)(this, "_domEvents", new Map());
  8565. }
  8566. }, {
  8567. key: "_pageOpenPending",
  8568. get: function get() {
  8569. return (0, _pdfjsLib.shadow)(this, "_pageOpenPending", new Set());
  8570. }
  8571. }, {
  8572. key: "_visitedPages",
  8573. get: function get() {
  8574. return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map());
  8575. }
  8576. }, {
  8577. key: "_updateFromSandbox",
  8578. value: function () {
  8579. var _updateFromSandbox2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee7(detail) {
  8580. var isInPresentationMode, id, siblings, command, value, modes, ids, _iterator3, _step3, elementId, element, _this$_pdfDocument;
  8581. return _regenerator["default"].wrap(function _callee7$(_context7) {
  8582. while (1) {
  8583. switch (_context7.prev = _context7.next) {
  8584. case 0:
  8585. isInPresentationMode = this._pdfViewer.isInPresentationMode || this._pdfViewer.isChangingPresentationMode;
  8586. id = detail.id, siblings = detail.siblings, command = detail.command, value = detail.value;
  8587. if (id) {
  8588. _context7.next = 46;
  8589. break;
  8590. }
  8591. _context7.t0 = command;
  8592. _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;
  8593. break;
  8594. case 6:
  8595. console.clear();
  8596. return _context7.abrupt("break", 45);
  8597. case 8:
  8598. console.error(value);
  8599. return _context7.abrupt("break", 45);
  8600. case 10:
  8601. if (!isInPresentationMode) {
  8602. _context7.next = 12;
  8603. break;
  8604. }
  8605. return _context7.abrupt("return");
  8606. case 12:
  8607. modes = (0, _ui_utils.apiPageLayoutToViewerModes)(value);
  8608. this._pdfViewer.spreadMode = modes.spreadMode;
  8609. return _context7.abrupt("break", 45);
  8610. case 15:
  8611. this._pdfViewer.currentPageNumber = value + 1;
  8612. return _context7.abrupt("break", 45);
  8613. case 17:
  8614. _context7.next = 19;
  8615. return this._pdfViewer.pagesPromise;
  8616. case 19:
  8617. this._eventBus.dispatch("print", {
  8618. source: this
  8619. });
  8620. return _context7.abrupt("break", 45);
  8621. case 21:
  8622. console.log(value);
  8623. return _context7.abrupt("break", 45);
  8624. case 23:
  8625. if (!isInPresentationMode) {
  8626. _context7.next = 25;
  8627. break;
  8628. }
  8629. return _context7.abrupt("return");
  8630. case 25:
  8631. this._pdfViewer.currentScaleValue = value;
  8632. return _context7.abrupt("break", 45);
  8633. case 27:
  8634. this._eventBus.dispatch("save", {
  8635. source: this
  8636. });
  8637. return _context7.abrupt("break", 45);
  8638. case 29:
  8639. this._pdfViewer.currentPageNumber = 1;
  8640. return _context7.abrupt("break", 45);
  8641. case 31:
  8642. this._pdfViewer.currentPageNumber = this._pdfViewer.pagesCount;
  8643. return _context7.abrupt("break", 45);
  8644. case 33:
  8645. this._pdfViewer.nextPage();
  8646. return _context7.abrupt("break", 45);
  8647. case 35:
  8648. this._pdfViewer.previousPage();
  8649. return _context7.abrupt("break", 45);
  8650. case 37:
  8651. if (!isInPresentationMode) {
  8652. _context7.next = 39;
  8653. break;
  8654. }
  8655. return _context7.abrupt("return");
  8656. case 39:
  8657. this._pdfViewer.increaseScale();
  8658. return _context7.abrupt("break", 45);
  8659. case 41:
  8660. if (!isInPresentationMode) {
  8661. _context7.next = 43;
  8662. break;
  8663. }
  8664. return _context7.abrupt("return");
  8665. case 43:
  8666. this._pdfViewer.decreaseScale();
  8667. return _context7.abrupt("break", 45);
  8668. case 45:
  8669. return _context7.abrupt("return");
  8670. case 46:
  8671. if (!isInPresentationMode) {
  8672. _context7.next = 49;
  8673. break;
  8674. }
  8675. if (!detail.focus) {
  8676. _context7.next = 49;
  8677. break;
  8678. }
  8679. return _context7.abrupt("return");
  8680. case 49:
  8681. delete detail.id;
  8682. delete detail.siblings;
  8683. ids = siblings ? [id].concat(_toConsumableArray(siblings)) : [id];
  8684. _iterator3 = _createForOfIteratorHelper(ids);
  8685. try {
  8686. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  8687. elementId = _step3.value;
  8688. element = document.getElementById(elementId);
  8689. if (element) {
  8690. element.dispatchEvent(new CustomEvent("updatefromsandbox", {
  8691. detail: detail
  8692. }));
  8693. } else {
  8694. (_this$_pdfDocument = this._pdfDocument) === null || _this$_pdfDocument === void 0 ? void 0 : _this$_pdfDocument.annotationStorage.setValue(elementId, detail);
  8695. }
  8696. }
  8697. } catch (err) {
  8698. _iterator3.e(err);
  8699. } finally {
  8700. _iterator3.f();
  8701. }
  8702. case 54:
  8703. case "end":
  8704. return _context7.stop();
  8705. }
  8706. }
  8707. }, _callee7, this);
  8708. }));
  8709. function _updateFromSandbox(_x7) {
  8710. return _updateFromSandbox2.apply(this, arguments);
  8711. }
  8712. return _updateFromSandbox;
  8713. }()
  8714. }, {
  8715. key: "_dispatchPageOpen",
  8716. value: function () {
  8717. var _dispatchPageOpen2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee9(pageNumber) {
  8718. var _this3 = this;
  8719. var initialize,
  8720. pdfDocument,
  8721. visitedPages,
  8722. pageView,
  8723. actionsPromise,
  8724. _args9 = arguments;
  8725. return _regenerator["default"].wrap(function _callee9$(_context9) {
  8726. while (1) {
  8727. switch (_context9.prev = _context9.next) {
  8728. case 0:
  8729. initialize = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : false;
  8730. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  8731. if (initialize) {
  8732. this._closeCapability = (0, _pdfjsLib.createPromiseCapability)();
  8733. }
  8734. if (this._closeCapability) {
  8735. _context9.next = 5;
  8736. break;
  8737. }
  8738. return _context9.abrupt("return");
  8739. case 5:
  8740. pageView = this._pdfViewer.getPageView(pageNumber - 1);
  8741. if (!((pageView === null || pageView === void 0 ? void 0 : pageView.renderingState) !== _ui_utils.RenderingStates.FINISHED)) {
  8742. _context9.next = 9;
  8743. break;
  8744. }
  8745. this._pageOpenPending.add(pageNumber);
  8746. return _context9.abrupt("return");
  8747. case 9:
  8748. this._pageOpenPending["delete"](pageNumber);
  8749. actionsPromise = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
  8750. var _pageView$pdfPage, _this3$_scripting;
  8751. var actions;
  8752. return _regenerator["default"].wrap(function _callee8$(_context8) {
  8753. while (1) {
  8754. switch (_context8.prev = _context8.next) {
  8755. case 0:
  8756. _context8.next = 2;
  8757. return !visitedPages.has(pageNumber) ? (_pageView$pdfPage = pageView.pdfPage) === null || _pageView$pdfPage === void 0 ? void 0 : _pageView$pdfPage.getJSActions() : null;
  8758. case 2:
  8759. actions = _context8.sent;
  8760. if (!(pdfDocument !== _this3._pdfDocument)) {
  8761. _context8.next = 5;
  8762. break;
  8763. }
  8764. return _context8.abrupt("return");
  8765. case 5:
  8766. _context8.next = 7;
  8767. return (_this3$_scripting = _this3._scripting) === null || _this3$_scripting === void 0 ? void 0 : _this3$_scripting.dispatchEventInSandbox({
  8768. id: "page",
  8769. name: "PageOpen",
  8770. pageNumber: pageNumber,
  8771. actions: actions
  8772. });
  8773. case 7:
  8774. case "end":
  8775. return _context8.stop();
  8776. }
  8777. }
  8778. }, _callee8);
  8779. }))();
  8780. visitedPages.set(pageNumber, actionsPromise);
  8781. case 12:
  8782. case "end":
  8783. return _context9.stop();
  8784. }
  8785. }
  8786. }, _callee9, this);
  8787. }));
  8788. function _dispatchPageOpen(_x8) {
  8789. return _dispatchPageOpen2.apply(this, arguments);
  8790. }
  8791. return _dispatchPageOpen;
  8792. }()
  8793. }, {
  8794. key: "_dispatchPageClose",
  8795. value: function () {
  8796. var _dispatchPageClose2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee10(pageNumber) {
  8797. var _this$_scripting6;
  8798. var pdfDocument, visitedPages, actionsPromise;
  8799. return _regenerator["default"].wrap(function _callee10$(_context10) {
  8800. while (1) {
  8801. switch (_context10.prev = _context10.next) {
  8802. case 0:
  8803. pdfDocument = this._pdfDocument, visitedPages = this._visitedPages;
  8804. if (this._closeCapability) {
  8805. _context10.next = 3;
  8806. break;
  8807. }
  8808. return _context10.abrupt("return");
  8809. case 3:
  8810. if (!this._pageOpenPending.has(pageNumber)) {
  8811. _context10.next = 5;
  8812. break;
  8813. }
  8814. return _context10.abrupt("return");
  8815. case 5:
  8816. actionsPromise = visitedPages.get(pageNumber);
  8817. if (actionsPromise) {
  8818. _context10.next = 8;
  8819. break;
  8820. }
  8821. return _context10.abrupt("return");
  8822. case 8:
  8823. visitedPages.set(pageNumber, null);
  8824. _context10.next = 11;
  8825. return actionsPromise;
  8826. case 11:
  8827. if (!(pdfDocument !== this._pdfDocument)) {
  8828. _context10.next = 13;
  8829. break;
  8830. }
  8831. return _context10.abrupt("return");
  8832. case 13:
  8833. _context10.next = 15;
  8834. return (_this$_scripting6 = this._scripting) === null || _this$_scripting6 === void 0 ? void 0 : _this$_scripting6.dispatchEventInSandbox({
  8835. id: "page",
  8836. name: "PageClose",
  8837. pageNumber: pageNumber
  8838. });
  8839. case 15:
  8840. case "end":
  8841. return _context10.stop();
  8842. }
  8843. }
  8844. }, _callee10, this);
  8845. }));
  8846. function _dispatchPageClose(_x9) {
  8847. return _dispatchPageClose2.apply(this, arguments);
  8848. }
  8849. return _dispatchPageClose;
  8850. }()
  8851. }, {
  8852. key: "_getDocProperties",
  8853. value: function () {
  8854. var _getDocProperties2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
  8855. var _require, docPropertiesLookup;
  8856. return _regenerator["default"].wrap(function _callee11$(_context11) {
  8857. while (1) {
  8858. switch (_context11.prev = _context11.next) {
  8859. case 0:
  8860. if (!this._docPropertiesLookup) {
  8861. _context11.next = 2;
  8862. break;
  8863. }
  8864. return _context11.abrupt("return", this._docPropertiesLookup(this._pdfDocument));
  8865. case 2:
  8866. _require = __w_pdfjs_require__(26), docPropertiesLookup = _require.docPropertiesLookup;
  8867. return _context11.abrupt("return", docPropertiesLookup(this._pdfDocument));
  8868. case 4:
  8869. case "end":
  8870. return _context11.stop();
  8871. }
  8872. }
  8873. }, _callee11, this);
  8874. }));
  8875. function _getDocProperties() {
  8876. return _getDocProperties2.apply(this, arguments);
  8877. }
  8878. return _getDocProperties;
  8879. }()
  8880. }, {
  8881. key: "_createScripting",
  8882. value: function _createScripting() {
  8883. this._destroyCapability = (0, _pdfjsLib.createPromiseCapability)();
  8884. if (this._scripting) {
  8885. throw new Error("_createScripting: Scripting already exists.");
  8886. }
  8887. if (this._scriptingFactory) {
  8888. return this._scriptingFactory.createScripting({
  8889. sandboxBundleSrc: this._sandboxBundleSrc
  8890. });
  8891. }
  8892. var _require2 = __w_pdfjs_require__(26),
  8893. GenericScripting = _require2.GenericScripting;
  8894. return new GenericScripting(this._sandboxBundleSrc);
  8895. }
  8896. }, {
  8897. key: "_destroyScripting",
  8898. value: function () {
  8899. var _destroyScripting2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
  8900. var _this$_destroyCapabil3;
  8901. var _this$_destroyCapabil2, _iterator4, _step4, _step4$value, name, listener, _iterator5, _step5, _step5$value, _name2, _listener2;
  8902. return _regenerator["default"].wrap(function _callee12$(_context12) {
  8903. while (1) {
  8904. switch (_context12.prev = _context12.next) {
  8905. case 0:
  8906. if (this._scripting) {
  8907. _context12.next = 4;
  8908. break;
  8909. }
  8910. this._pdfDocument = null;
  8911. (_this$_destroyCapabil2 = this._destroyCapability) === null || _this$_destroyCapabil2 === void 0 ? void 0 : _this$_destroyCapabil2.resolve();
  8912. return _context12.abrupt("return");
  8913. case 4:
  8914. if (!this._closeCapability) {
  8915. _context12.next = 8;
  8916. break;
  8917. }
  8918. _context12.next = 7;
  8919. return Promise.race([this._closeCapability.promise, new Promise(function (resolve) {
  8920. setTimeout(resolve, 1000);
  8921. })])["catch"](function (reason) {});
  8922. case 7:
  8923. this._closeCapability = null;
  8924. case 8:
  8925. this._pdfDocument = null;
  8926. _context12.prev = 9;
  8927. _context12.next = 12;
  8928. return this._scripting.destroySandbox();
  8929. case 12:
  8930. _context12.next = 16;
  8931. break;
  8932. case 14:
  8933. _context12.prev = 14;
  8934. _context12.t0 = _context12["catch"](9);
  8935. case 16:
  8936. _iterator4 = _createForOfIteratorHelper(this._internalEvents);
  8937. try {
  8938. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  8939. _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], listener = _step4$value[1];
  8940. this._eventBus._off(name, listener);
  8941. }
  8942. } catch (err) {
  8943. _iterator4.e(err);
  8944. } finally {
  8945. _iterator4.f();
  8946. }
  8947. this._internalEvents.clear();
  8948. _iterator5 = _createForOfIteratorHelper(this._domEvents);
  8949. try {
  8950. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  8951. _step5$value = _slicedToArray(_step5.value, 2), _name2 = _step5$value[0], _listener2 = _step5$value[1];
  8952. window.removeEventListener(_name2, _listener2);
  8953. }
  8954. } catch (err) {
  8955. _iterator5.e(err);
  8956. } finally {
  8957. _iterator5.f();
  8958. }
  8959. this._domEvents.clear();
  8960. this._pageOpenPending.clear();
  8961. this._visitedPages.clear();
  8962. this._scripting = null;
  8963. delete this._mouseState.isDown;
  8964. this._ready = false;
  8965. (_this$_destroyCapabil3 = this._destroyCapability) === null || _this$_destroyCapabil3 === void 0 ? void 0 : _this$_destroyCapabil3.resolve();
  8966. case 28:
  8967. case "end":
  8968. return _context12.stop();
  8969. }
  8970. }
  8971. }, _callee12, this, [[9, 14]]);
  8972. }));
  8973. function _destroyScripting() {
  8974. return _destroyScripting2.apply(this, arguments);
  8975. }
  8976. return _destroyScripting;
  8977. }()
  8978. }]);
  8979. return PDFScriptingManager;
  8980. }();
  8981. exports.PDFScriptingManager = PDFScriptingManager;
  8982. /***/ }),
  8983. /* 26 */
  8984. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8985. Object.defineProperty(exports, "__esModule", ({
  8986. value: true
  8987. }));
  8988. exports.GenericScripting = void 0;
  8989. exports.docPropertiesLookup = docPropertiesLookup;
  8990. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(3));
  8991. var _pdfjsLib = __w_pdfjs_require__(5);
  8992. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8993. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
  8994. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  8995. 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; }
  8996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8997. 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); } }
  8998. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8999. 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); } }
  9000. 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); }); }; }
  9001. function docPropertiesLookup(_x) {
  9002. return _docPropertiesLookup.apply(this, arguments);
  9003. }
  9004. function _docPropertiesLookup() {
  9005. _docPropertiesLookup = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4(pdfDocument) {
  9006. var url, baseUrl, _yield$pdfDocument$ge, info, metadata, contentDispositionFilename, contentLength, _yield$pdfDocument$ge2, length;
  9007. return _regenerator["default"].wrap(function _callee4$(_context4) {
  9008. while (1) {
  9009. switch (_context4.prev = _context4.next) {
  9010. case 0:
  9011. url = "", baseUrl = url.split("#")[0];
  9012. _context4.next = 3;
  9013. return pdfDocument.getMetadata();
  9014. case 3:
  9015. _yield$pdfDocument$ge = _context4.sent;
  9016. info = _yield$pdfDocument$ge.info;
  9017. metadata = _yield$pdfDocument$ge.metadata;
  9018. contentDispositionFilename = _yield$pdfDocument$ge.contentDispositionFilename;
  9019. contentLength = _yield$pdfDocument$ge.contentLength;
  9020. if (contentLength) {
  9021. _context4.next = 14;
  9022. break;
  9023. }
  9024. _context4.next = 11;
  9025. return pdfDocument.getDownloadInfo();
  9026. case 11:
  9027. _yield$pdfDocument$ge2 = _context4.sent;
  9028. length = _yield$pdfDocument$ge2.length;
  9029. contentLength = length;
  9030. case 14:
  9031. return _context4.abrupt("return", _objectSpread(_objectSpread({}, info), {}, {
  9032. baseURL: baseUrl,
  9033. filesize: contentLength,
  9034. filename: contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(url),
  9035. metadata: metadata === null || metadata === void 0 ? void 0 : metadata.getRaw(),
  9036. authors: metadata === null || metadata === void 0 ? void 0 : metadata.get("dc:creator"),
  9037. numPages: pdfDocument.numPages,
  9038. URL: url
  9039. }));
  9040. case 15:
  9041. case "end":
  9042. return _context4.stop();
  9043. }
  9044. }
  9045. }, _callee4);
  9046. }));
  9047. return _docPropertiesLookup.apply(this, arguments);
  9048. }
  9049. var GenericScripting = /*#__PURE__*/function () {
  9050. function GenericScripting(sandboxBundleSrc) {
  9051. _classCallCheck(this, GenericScripting);
  9052. this._ready = (0, _pdfjsLib.loadScript)(sandboxBundleSrc, true).then(function () {
  9053. return window.pdfjsSandbox.QuickJSSandbox();
  9054. });
  9055. }
  9056. _createClass(GenericScripting, [{
  9057. key: "createSandbox",
  9058. value: function () {
  9059. var _createSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
  9060. var sandbox;
  9061. return _regenerator["default"].wrap(function _callee$(_context) {
  9062. while (1) {
  9063. switch (_context.prev = _context.next) {
  9064. case 0:
  9065. _context.next = 2;
  9066. return this._ready;
  9067. case 2:
  9068. sandbox = _context.sent;
  9069. sandbox.create(data);
  9070. case 4:
  9071. case "end":
  9072. return _context.stop();
  9073. }
  9074. }
  9075. }, _callee, this);
  9076. }));
  9077. function createSandbox(_x2) {
  9078. return _createSandbox.apply(this, arguments);
  9079. }
  9080. return createSandbox;
  9081. }()
  9082. }, {
  9083. key: "dispatchEventInSandbox",
  9084. value: function () {
  9085. var _dispatchEventInSandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(event) {
  9086. var sandbox;
  9087. return _regenerator["default"].wrap(function _callee2$(_context2) {
  9088. while (1) {
  9089. switch (_context2.prev = _context2.next) {
  9090. case 0:
  9091. _context2.next = 2;
  9092. return this._ready;
  9093. case 2:
  9094. sandbox = _context2.sent;
  9095. sandbox.dispatchEvent(event);
  9096. case 4:
  9097. case "end":
  9098. return _context2.stop();
  9099. }
  9100. }
  9101. }, _callee2, this);
  9102. }));
  9103. function dispatchEventInSandbox(_x3) {
  9104. return _dispatchEventInSandbox.apply(this, arguments);
  9105. }
  9106. return dispatchEventInSandbox;
  9107. }()
  9108. }, {
  9109. key: "destroySandbox",
  9110. value: function () {
  9111. var _destroySandbox = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  9112. var sandbox;
  9113. return _regenerator["default"].wrap(function _callee3$(_context3) {
  9114. while (1) {
  9115. switch (_context3.prev = _context3.next) {
  9116. case 0:
  9117. _context3.next = 2;
  9118. return this._ready;
  9119. case 2:
  9120. sandbox = _context3.sent;
  9121. sandbox.nukeSandbox();
  9122. case 4:
  9123. case "end":
  9124. return _context3.stop();
  9125. }
  9126. }
  9127. }, _callee3, this);
  9128. }));
  9129. function destroySandbox() {
  9130. return _destroySandbox.apply(this, arguments);
  9131. }
  9132. return destroySandbox;
  9133. }()
  9134. }]);
  9135. return GenericScripting;
  9136. }();
  9137. exports.GenericScripting = GenericScripting;
  9138. /***/ })
  9139. /******/ ]);
  9140. /************************************************************************/
  9141. /******/ // The module cache
  9142. /******/ var __webpack_module_cache__ = {};
  9143. /******/
  9144. /******/ // The require function
  9145. /******/ function __w_pdfjs_require__(moduleId) {
  9146. /******/ // Check if module is in cache
  9147. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  9148. /******/ if (cachedModule !== undefined) {
  9149. /******/ return cachedModule.exports;
  9150. /******/ }
  9151. /******/ // Create a new module (and put it into the cache)
  9152. /******/ var module = __webpack_module_cache__[moduleId] = {
  9153. /******/ id: moduleId,
  9154. /******/ loaded: false,
  9155. /******/ exports: {}
  9156. /******/ };
  9157. /******/
  9158. /******/ // Execute the module function
  9159. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  9160. /******/
  9161. /******/ // Flag the module as loaded
  9162. /******/ module.loaded = true;
  9163. /******/
  9164. /******/ // Return the exports of the module
  9165. /******/ return module.exports;
  9166. /******/ }
  9167. /******/
  9168. /************************************************************************/
  9169. /******/ /* webpack/runtime/node module decorator */
  9170. /******/ (() => {
  9171. /******/ __w_pdfjs_require__.nmd = (module) => {
  9172. /******/ module.paths = [];
  9173. /******/ if (!module.children) module.children = [];
  9174. /******/ return module;
  9175. /******/ };
  9176. /******/ })();
  9177. /******/
  9178. /************************************************************************/
  9179. var __webpack_exports__ = {};
  9180. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  9181. (() => {
  9182. var exports = __webpack_exports__;
  9183. Object.defineProperty(exports, "__esModule", ({
  9184. value: true
  9185. }));
  9186. Object.defineProperty(exports, "AnnotationLayerBuilder", ({
  9187. enumerable: true,
  9188. get: function get() {
  9189. return _annotation_layer_builder.AnnotationLayerBuilder;
  9190. }
  9191. }));
  9192. Object.defineProperty(exports, "DefaultAnnotationLayerFactory", ({
  9193. enumerable: true,
  9194. get: function get() {
  9195. return _default_factory.DefaultAnnotationLayerFactory;
  9196. }
  9197. }));
  9198. Object.defineProperty(exports, "DefaultStructTreeLayerFactory", ({
  9199. enumerable: true,
  9200. get: function get() {
  9201. return _default_factory.DefaultStructTreeLayerFactory;
  9202. }
  9203. }));
  9204. Object.defineProperty(exports, "DefaultTextLayerFactory", ({
  9205. enumerable: true,
  9206. get: function get() {
  9207. return _default_factory.DefaultTextLayerFactory;
  9208. }
  9209. }));
  9210. Object.defineProperty(exports, "DefaultXfaLayerFactory", ({
  9211. enumerable: true,
  9212. get: function get() {
  9213. return _default_factory.DefaultXfaLayerFactory;
  9214. }
  9215. }));
  9216. Object.defineProperty(exports, "DownloadManager", ({
  9217. enumerable: true,
  9218. get: function get() {
  9219. return _download_manager.DownloadManager;
  9220. }
  9221. }));
  9222. Object.defineProperty(exports, "EventBus", ({
  9223. enumerable: true,
  9224. get: function get() {
  9225. return _event_utils.EventBus;
  9226. }
  9227. }));
  9228. Object.defineProperty(exports, "GenericL10n", ({
  9229. enumerable: true,
  9230. get: function get() {
  9231. return _genericl10n.GenericL10n;
  9232. }
  9233. }));
  9234. Object.defineProperty(exports, "NullL10n", ({
  9235. enumerable: true,
  9236. get: function get() {
  9237. return _l10n_utils.NullL10n;
  9238. }
  9239. }));
  9240. Object.defineProperty(exports, "PDFFindController", ({
  9241. enumerable: true,
  9242. get: function get() {
  9243. return _pdf_find_controller.PDFFindController;
  9244. }
  9245. }));
  9246. Object.defineProperty(exports, "PDFHistory", ({
  9247. enumerable: true,
  9248. get: function get() {
  9249. return _pdf_history.PDFHistory;
  9250. }
  9251. }));
  9252. Object.defineProperty(exports, "PDFLinkService", ({
  9253. enumerable: true,
  9254. get: function get() {
  9255. return _pdf_link_service.PDFLinkService;
  9256. }
  9257. }));
  9258. Object.defineProperty(exports, "PDFPageView", ({
  9259. enumerable: true,
  9260. get: function get() {
  9261. return _pdf_page_view.PDFPageView;
  9262. }
  9263. }));
  9264. Object.defineProperty(exports, "PDFScriptingManager", ({
  9265. enumerable: true,
  9266. get: function get() {
  9267. return _pdf_scripting_manager.PDFScriptingManager;
  9268. }
  9269. }));
  9270. Object.defineProperty(exports, "PDFSinglePageViewer", ({
  9271. enumerable: true,
  9272. get: function get() {
  9273. return _pdf_viewer.PDFSinglePageViewer;
  9274. }
  9275. }));
  9276. Object.defineProperty(exports, "PDFViewer", ({
  9277. enumerable: true,
  9278. get: function get() {
  9279. return _pdf_viewer.PDFViewer;
  9280. }
  9281. }));
  9282. Object.defineProperty(exports, "ProgressBar", ({
  9283. enumerable: true,
  9284. get: function get() {
  9285. return _ui_utils.ProgressBar;
  9286. }
  9287. }));
  9288. Object.defineProperty(exports, "SimpleLinkService", ({
  9289. enumerable: true,
  9290. get: function get() {
  9291. return _pdf_link_service.SimpleLinkService;
  9292. }
  9293. }));
  9294. Object.defineProperty(exports, "StructTreeLayerBuilder", ({
  9295. enumerable: true,
  9296. get: function get() {
  9297. return _struct_tree_layer_builder.StructTreeLayerBuilder;
  9298. }
  9299. }));
  9300. Object.defineProperty(exports, "TextLayerBuilder", ({
  9301. enumerable: true,
  9302. get: function get() {
  9303. return _text_layer_builder.TextLayerBuilder;
  9304. }
  9305. }));
  9306. Object.defineProperty(exports, "XfaLayerBuilder", ({
  9307. enumerable: true,
  9308. get: function get() {
  9309. return _xfa_layer_builder.XfaLayerBuilder;
  9310. }
  9311. }));
  9312. var _default_factory = __w_pdfjs_require__(1);
  9313. var _pdf_link_service = __w_pdfjs_require__(7);
  9314. var _pdf_viewer = __w_pdfjs_require__(12);
  9315. var _annotation_layer_builder = __w_pdfjs_require__(2);
  9316. var _download_manager = __w_pdfjs_require__(18);
  9317. var _event_utils = __w_pdfjs_require__(19);
  9318. var _genericl10n = __w_pdfjs_require__(20);
  9319. var _l10n_utils = __w_pdfjs_require__(6);
  9320. var _pdf_find_controller = __w_pdfjs_require__(22);
  9321. var _pdf_history = __w_pdfjs_require__(24);
  9322. var _pdf_page_view = __w_pdfjs_require__(14);
  9323. var _pdf_scripting_manager = __w_pdfjs_require__(25);
  9324. var _ui_utils = __w_pdfjs_require__(8);
  9325. var _struct_tree_layer_builder = __w_pdfjs_require__(9);
  9326. var _text_layer_builder = __w_pdfjs_require__(10);
  9327. var _xfa_layer_builder = __w_pdfjs_require__(11);
  9328. var pdfjsVersion = '2.12.313';
  9329. var pdfjsBuild = 'a2ae56f39';
  9330. })();
  9331. /******/ return __webpack_exports__;
  9332. /******/ })()
  9333. ;
  9334. });
  9335. //# sourceMappingURL=pdf_viewer.js.map