pdf.js 799 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory();
  31. })(this, () => {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ var __webpack_modules__ = ([
  34. /* 0 */,
  35. /* 1 */
  36. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37. "use strict";
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  42. exports.arrayByteLength = arrayByteLength;
  43. exports.arraysToBytes = arraysToBytes;
  44. exports.assert = assert;
  45. exports.bytesToString = bytesToString;
  46. exports.createPromiseCapability = createPromiseCapability;
  47. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  48. exports.escapeString = escapeString;
  49. exports.getModificationDate = getModificationDate;
  50. exports.getVerbosityLevel = getVerbosityLevel;
  51. exports.info = info;
  52. exports.isArrayBuffer = isArrayBuffer;
  53. exports.isArrayEqual = isArrayEqual;
  54. exports.isAscii = isAscii;
  55. exports.objectFromMap = objectFromMap;
  56. exports.objectSize = objectSize;
  57. exports.setVerbosityLevel = setVerbosityLevel;
  58. exports.shadow = shadow;
  59. exports.string32 = string32;
  60. exports.stringToBytes = stringToBytes;
  61. exports.stringToPDFString = stringToPDFString;
  62. exports.stringToUTF16BEString = stringToUTF16BEString;
  63. exports.stringToUTF8String = stringToUTF8String;
  64. exports.unreachable = unreachable;
  65. exports.utf8StringToString = utf8StringToString;
  66. exports.warn = warn;
  67. __w_pdfjs_require__(2);
  68. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  69. 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."); }
  70. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  71. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  72. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  73. 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."); }
  74. 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; }
  75. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  76. 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; } } }; }
  77. 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); }
  78. 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; }
  79. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  80. 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); } }
  81. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  82. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  83. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  84. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  85. 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); }; }
  86. 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); }
  87. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  88. 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; } }
  89. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  90. var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  91. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  92. var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  93. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  94. var RenderingIntentFlag = {
  95. ANY: 0x01,
  96. DISPLAY: 0x02,
  97. PRINT: 0x04,
  98. ANNOTATIONS_FORMS: 0x10,
  99. ANNOTATIONS_STORAGE: 0x20,
  100. ANNOTATIONS_DISABLE: 0x40,
  101. OPLIST: 0x100
  102. };
  103. exports.RenderingIntentFlag = RenderingIntentFlag;
  104. var AnnotationMode = {
  105. DISABLE: 0,
  106. ENABLE: 1,
  107. ENABLE_FORMS: 2,
  108. ENABLE_STORAGE: 3
  109. };
  110. exports.AnnotationMode = AnnotationMode;
  111. var PermissionFlag = {
  112. PRINT: 0x04,
  113. MODIFY_CONTENTS: 0x08,
  114. COPY: 0x10,
  115. MODIFY_ANNOTATIONS: 0x20,
  116. FILL_INTERACTIVE_FORMS: 0x100,
  117. COPY_FOR_ACCESSIBILITY: 0x200,
  118. ASSEMBLE: 0x400,
  119. PRINT_HIGH_QUALITY: 0x800
  120. };
  121. exports.PermissionFlag = PermissionFlag;
  122. var TextRenderingMode = {
  123. FILL: 0,
  124. STROKE: 1,
  125. FILL_STROKE: 2,
  126. INVISIBLE: 3,
  127. FILL_ADD_TO_PATH: 4,
  128. STROKE_ADD_TO_PATH: 5,
  129. FILL_STROKE_ADD_TO_PATH: 6,
  130. ADD_TO_PATH: 7,
  131. FILL_STROKE_MASK: 3,
  132. ADD_TO_PATH_FLAG: 4
  133. };
  134. exports.TextRenderingMode = TextRenderingMode;
  135. var ImageKind = {
  136. GRAYSCALE_1BPP: 1,
  137. RGB_24BPP: 2,
  138. RGBA_32BPP: 3
  139. };
  140. exports.ImageKind = ImageKind;
  141. var AnnotationType = {
  142. TEXT: 1,
  143. LINK: 2,
  144. FREETEXT: 3,
  145. LINE: 4,
  146. SQUARE: 5,
  147. CIRCLE: 6,
  148. POLYGON: 7,
  149. POLYLINE: 8,
  150. HIGHLIGHT: 9,
  151. UNDERLINE: 10,
  152. SQUIGGLY: 11,
  153. STRIKEOUT: 12,
  154. STAMP: 13,
  155. CARET: 14,
  156. INK: 15,
  157. POPUP: 16,
  158. FILEATTACHMENT: 17,
  159. SOUND: 18,
  160. MOVIE: 19,
  161. WIDGET: 20,
  162. SCREEN: 21,
  163. PRINTERMARK: 22,
  164. TRAPNET: 23,
  165. WATERMARK: 24,
  166. THREED: 25,
  167. REDACT: 26
  168. };
  169. exports.AnnotationType = AnnotationType;
  170. var AnnotationStateModelType = {
  171. MARKED: "Marked",
  172. REVIEW: "Review"
  173. };
  174. exports.AnnotationStateModelType = AnnotationStateModelType;
  175. var AnnotationMarkedState = {
  176. MARKED: "Marked",
  177. UNMARKED: "Unmarked"
  178. };
  179. exports.AnnotationMarkedState = AnnotationMarkedState;
  180. var AnnotationReviewState = {
  181. ACCEPTED: "Accepted",
  182. REJECTED: "Rejected",
  183. CANCELLED: "Cancelled",
  184. COMPLETED: "Completed",
  185. NONE: "None"
  186. };
  187. exports.AnnotationReviewState = AnnotationReviewState;
  188. var AnnotationReplyType = {
  189. GROUP: "Group",
  190. REPLY: "R"
  191. };
  192. exports.AnnotationReplyType = AnnotationReplyType;
  193. var AnnotationFlag = {
  194. INVISIBLE: 0x01,
  195. HIDDEN: 0x02,
  196. PRINT: 0x04,
  197. NOZOOM: 0x08,
  198. NOROTATE: 0x10,
  199. NOVIEW: 0x20,
  200. READONLY: 0x40,
  201. LOCKED: 0x80,
  202. TOGGLENOVIEW: 0x100,
  203. LOCKEDCONTENTS: 0x200
  204. };
  205. exports.AnnotationFlag = AnnotationFlag;
  206. var AnnotationFieldFlag = {
  207. READONLY: 0x0000001,
  208. REQUIRED: 0x0000002,
  209. NOEXPORT: 0x0000004,
  210. MULTILINE: 0x0001000,
  211. PASSWORD: 0x0002000,
  212. NOTOGGLETOOFF: 0x0004000,
  213. RADIO: 0x0008000,
  214. PUSHBUTTON: 0x0010000,
  215. COMBO: 0x0020000,
  216. EDIT: 0x0040000,
  217. SORT: 0x0080000,
  218. FILESELECT: 0x0100000,
  219. MULTISELECT: 0x0200000,
  220. DONOTSPELLCHECK: 0x0400000,
  221. DONOTSCROLL: 0x0800000,
  222. COMB: 0x1000000,
  223. RICHTEXT: 0x2000000,
  224. RADIOSINUNISON: 0x2000000,
  225. COMMITONSELCHANGE: 0x4000000
  226. };
  227. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  228. var AnnotationBorderStyleType = {
  229. SOLID: 1,
  230. DASHED: 2,
  231. BEVELED: 3,
  232. INSET: 4,
  233. UNDERLINE: 5
  234. };
  235. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  236. var AnnotationActionEventType = {
  237. E: "Mouse Enter",
  238. X: "Mouse Exit",
  239. D: "Mouse Down",
  240. U: "Mouse Up",
  241. Fo: "Focus",
  242. Bl: "Blur",
  243. PO: "PageOpen",
  244. PC: "PageClose",
  245. PV: "PageVisible",
  246. PI: "PageInvisible",
  247. K: "Keystroke",
  248. F: "Format",
  249. V: "Validate",
  250. C: "Calculate"
  251. };
  252. exports.AnnotationActionEventType = AnnotationActionEventType;
  253. var DocumentActionEventType = {
  254. WC: "WillClose",
  255. WS: "WillSave",
  256. DS: "DidSave",
  257. WP: "WillPrint",
  258. DP: "DidPrint"
  259. };
  260. exports.DocumentActionEventType = DocumentActionEventType;
  261. var PageActionEventType = {
  262. O: "PageOpen",
  263. C: "PageClose"
  264. };
  265. exports.PageActionEventType = PageActionEventType;
  266. var StreamType = {
  267. UNKNOWN: "UNKNOWN",
  268. FLATE: "FLATE",
  269. LZW: "LZW",
  270. DCT: "DCT",
  271. JPX: "JPX",
  272. JBIG: "JBIG",
  273. A85: "A85",
  274. AHX: "AHX",
  275. CCF: "CCF",
  276. RLX: "RLX"
  277. };
  278. exports.StreamType = StreamType;
  279. var FontType = {
  280. UNKNOWN: "UNKNOWN",
  281. TYPE1: "TYPE1",
  282. TYPE1STANDARD: "TYPE1STANDARD",
  283. TYPE1C: "TYPE1C",
  284. CIDFONTTYPE0: "CIDFONTTYPE0",
  285. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  286. TRUETYPE: "TRUETYPE",
  287. CIDFONTTYPE2: "CIDFONTTYPE2",
  288. TYPE3: "TYPE3",
  289. OPENTYPE: "OPENTYPE",
  290. TYPE0: "TYPE0",
  291. MMTYPE1: "MMTYPE1"
  292. };
  293. exports.FontType = FontType;
  294. var VerbosityLevel = {
  295. ERRORS: 0,
  296. WARNINGS: 1,
  297. INFOS: 5
  298. };
  299. exports.VerbosityLevel = VerbosityLevel;
  300. var CMapCompressionType = {
  301. NONE: 0,
  302. BINARY: 1,
  303. STREAM: 2
  304. };
  305. exports.CMapCompressionType = CMapCompressionType;
  306. var OPS = {
  307. dependency: 1,
  308. setLineWidth: 2,
  309. setLineCap: 3,
  310. setLineJoin: 4,
  311. setMiterLimit: 5,
  312. setDash: 6,
  313. setRenderingIntent: 7,
  314. setFlatness: 8,
  315. setGState: 9,
  316. save: 10,
  317. restore: 11,
  318. transform: 12,
  319. moveTo: 13,
  320. lineTo: 14,
  321. curveTo: 15,
  322. curveTo2: 16,
  323. curveTo3: 17,
  324. closePath: 18,
  325. rectangle: 19,
  326. stroke: 20,
  327. closeStroke: 21,
  328. fill: 22,
  329. eoFill: 23,
  330. fillStroke: 24,
  331. eoFillStroke: 25,
  332. closeFillStroke: 26,
  333. closeEOFillStroke: 27,
  334. endPath: 28,
  335. clip: 29,
  336. eoClip: 30,
  337. beginText: 31,
  338. endText: 32,
  339. setCharSpacing: 33,
  340. setWordSpacing: 34,
  341. setHScale: 35,
  342. setLeading: 36,
  343. setFont: 37,
  344. setTextRenderingMode: 38,
  345. setTextRise: 39,
  346. moveText: 40,
  347. setLeadingMoveText: 41,
  348. setTextMatrix: 42,
  349. nextLine: 43,
  350. showText: 44,
  351. showSpacedText: 45,
  352. nextLineShowText: 46,
  353. nextLineSetSpacingShowText: 47,
  354. setCharWidth: 48,
  355. setCharWidthAndBounds: 49,
  356. setStrokeColorSpace: 50,
  357. setFillColorSpace: 51,
  358. setStrokeColor: 52,
  359. setStrokeColorN: 53,
  360. setFillColor: 54,
  361. setFillColorN: 55,
  362. setStrokeGray: 56,
  363. setFillGray: 57,
  364. setStrokeRGBColor: 58,
  365. setFillRGBColor: 59,
  366. setStrokeCMYKColor: 60,
  367. setFillCMYKColor: 61,
  368. shadingFill: 62,
  369. beginInlineImage: 63,
  370. beginImageData: 64,
  371. endInlineImage: 65,
  372. paintXObject: 66,
  373. markPoint: 67,
  374. markPointProps: 68,
  375. beginMarkedContent: 69,
  376. beginMarkedContentProps: 70,
  377. endMarkedContent: 71,
  378. beginCompat: 72,
  379. endCompat: 73,
  380. paintFormXObjectBegin: 74,
  381. paintFormXObjectEnd: 75,
  382. beginGroup: 76,
  383. endGroup: 77,
  384. beginAnnotations: 78,
  385. endAnnotations: 79,
  386. beginAnnotation: 80,
  387. endAnnotation: 81,
  388. paintJpegXObject: 82,
  389. paintImageMaskXObject: 83,
  390. paintImageMaskXObjectGroup: 84,
  391. paintImageXObject: 85,
  392. paintInlineImageXObject: 86,
  393. paintInlineImageXObjectGroup: 87,
  394. paintImageXObjectRepeat: 88,
  395. paintImageMaskXObjectRepeat: 89,
  396. paintSolidColorImageMask: 90,
  397. constructPath: 91
  398. };
  399. exports.OPS = OPS;
  400. var UNSUPPORTED_FEATURES = {
  401. unknown: "unknown",
  402. forms: "forms",
  403. javaScript: "javaScript",
  404. signatures: "signatures",
  405. smask: "smask",
  406. shadingPattern: "shadingPattern",
  407. font: "font",
  408. errorTilingPattern: "errorTilingPattern",
  409. errorExtGState: "errorExtGState",
  410. errorXObject: "errorXObject",
  411. errorFontLoadType3: "errorFontLoadType3",
  412. errorFontState: "errorFontState",
  413. errorFontMissing: "errorFontMissing",
  414. errorFontTranslate: "errorFontTranslate",
  415. errorColorSpace: "errorColorSpace",
  416. errorOperatorList: "errorOperatorList",
  417. errorFontToUnicode: "errorFontToUnicode",
  418. errorFontLoadNative: "errorFontLoadNative",
  419. errorFontBuildPath: "errorFontBuildPath",
  420. errorFontGetPath: "errorFontGetPath",
  421. errorMarkedContent: "errorMarkedContent",
  422. errorContentSubStream: "errorContentSubStream"
  423. };
  424. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  425. var PasswordResponses = {
  426. NEED_PASSWORD: 1,
  427. INCORRECT_PASSWORD: 2
  428. };
  429. exports.PasswordResponses = PasswordResponses;
  430. var verbosity = VerbosityLevel.WARNINGS;
  431. function setVerbosityLevel(level) {
  432. if (Number.isInteger(level)) {
  433. verbosity = level;
  434. }
  435. }
  436. function getVerbosityLevel() {
  437. return verbosity;
  438. }
  439. function info(msg) {
  440. if (verbosity >= VerbosityLevel.INFOS) {
  441. console.log("Info: ".concat(msg));
  442. }
  443. }
  444. function warn(msg) {
  445. if (verbosity >= VerbosityLevel.WARNINGS) {
  446. console.log("Warning: ".concat(msg));
  447. }
  448. }
  449. function unreachable(msg) {
  450. throw new Error(msg);
  451. }
  452. function assert(cond, msg) {
  453. if (!cond) {
  454. unreachable(msg);
  455. }
  456. }
  457. function _isValidProtocol(url) {
  458. if (!url) {
  459. return false;
  460. }
  461. switch (url.protocol) {
  462. case "http:":
  463. case "https:":
  464. case "ftp:":
  465. case "mailto:":
  466. case "tel:":
  467. return true;
  468. default:
  469. return false;
  470. }
  471. }
  472. function createValidAbsoluteUrl(url) {
  473. var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  474. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  475. if (!url) {
  476. return null;
  477. }
  478. try {
  479. if (options && typeof url === "string") {
  480. if (options.addDefaultProtocol && url.startsWith("www.")) {
  481. var dots = url.match(/\./g);
  482. if (dots && dots.length >= 2) {
  483. url = "http://".concat(url);
  484. }
  485. }
  486. if (options.tryConvertEncoding) {
  487. try {
  488. url = stringToUTF8String(url);
  489. } catch (ex) {}
  490. }
  491. }
  492. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  493. if (_isValidProtocol(absoluteUrl)) {
  494. return absoluteUrl;
  495. }
  496. } catch (ex) {}
  497. return null;
  498. }
  499. function shadow(obj, prop, value) {
  500. Object.defineProperty(obj, prop, {
  501. value: value,
  502. enumerable: true,
  503. configurable: true,
  504. writable: false
  505. });
  506. return value;
  507. }
  508. var BaseException = function BaseExceptionClosure() {
  509. function BaseException(message, name) {
  510. if (this.constructor === BaseException) {
  511. unreachable("Cannot initialize BaseException.");
  512. }
  513. this.message = message;
  514. this.name = name;
  515. }
  516. BaseException.prototype = new Error();
  517. BaseException.constructor = BaseException;
  518. return BaseException;
  519. }();
  520. exports.BaseException = BaseException;
  521. var PasswordException = /*#__PURE__*/function (_BaseException) {
  522. _inherits(PasswordException, _BaseException);
  523. var _super = _createSuper(PasswordException);
  524. function PasswordException(msg, code) {
  525. var _this;
  526. _classCallCheck(this, PasswordException);
  527. _this = _super.call(this, msg, "PasswordException");
  528. _this.code = code;
  529. return _this;
  530. }
  531. return _createClass(PasswordException);
  532. }(BaseException);
  533. exports.PasswordException = PasswordException;
  534. var UnknownErrorException = /*#__PURE__*/function (_BaseException2) {
  535. _inherits(UnknownErrorException, _BaseException2);
  536. var _super2 = _createSuper(UnknownErrorException);
  537. function UnknownErrorException(msg, details) {
  538. var _this2;
  539. _classCallCheck(this, UnknownErrorException);
  540. _this2 = _super2.call(this, msg, "UnknownErrorException");
  541. _this2.details = details;
  542. return _this2;
  543. }
  544. return _createClass(UnknownErrorException);
  545. }(BaseException);
  546. exports.UnknownErrorException = UnknownErrorException;
  547. var InvalidPDFException = /*#__PURE__*/function (_BaseException3) {
  548. _inherits(InvalidPDFException, _BaseException3);
  549. var _super3 = _createSuper(InvalidPDFException);
  550. function InvalidPDFException(msg) {
  551. _classCallCheck(this, InvalidPDFException);
  552. return _super3.call(this, msg, "InvalidPDFException");
  553. }
  554. return _createClass(InvalidPDFException);
  555. }(BaseException);
  556. exports.InvalidPDFException = InvalidPDFException;
  557. var MissingPDFException = /*#__PURE__*/function (_BaseException4) {
  558. _inherits(MissingPDFException, _BaseException4);
  559. var _super4 = _createSuper(MissingPDFException);
  560. function MissingPDFException(msg) {
  561. _classCallCheck(this, MissingPDFException);
  562. return _super4.call(this, msg, "MissingPDFException");
  563. }
  564. return _createClass(MissingPDFException);
  565. }(BaseException);
  566. exports.MissingPDFException = MissingPDFException;
  567. var UnexpectedResponseException = /*#__PURE__*/function (_BaseException5) {
  568. _inherits(UnexpectedResponseException, _BaseException5);
  569. var _super5 = _createSuper(UnexpectedResponseException);
  570. function UnexpectedResponseException(msg, status) {
  571. var _this3;
  572. _classCallCheck(this, UnexpectedResponseException);
  573. _this3 = _super5.call(this, msg, "UnexpectedResponseException");
  574. _this3.status = status;
  575. return _this3;
  576. }
  577. return _createClass(UnexpectedResponseException);
  578. }(BaseException);
  579. exports.UnexpectedResponseException = UnexpectedResponseException;
  580. var FormatError = /*#__PURE__*/function (_BaseException6) {
  581. _inherits(FormatError, _BaseException6);
  582. var _super6 = _createSuper(FormatError);
  583. function FormatError(msg) {
  584. _classCallCheck(this, FormatError);
  585. return _super6.call(this, msg, "FormatError");
  586. }
  587. return _createClass(FormatError);
  588. }(BaseException);
  589. exports.FormatError = FormatError;
  590. var AbortException = /*#__PURE__*/function (_BaseException7) {
  591. _inherits(AbortException, _BaseException7);
  592. var _super7 = _createSuper(AbortException);
  593. function AbortException(msg) {
  594. _classCallCheck(this, AbortException);
  595. return _super7.call(this, msg, "AbortException");
  596. }
  597. return _createClass(AbortException);
  598. }(BaseException);
  599. exports.AbortException = AbortException;
  600. function bytesToString(bytes) {
  601. if (_typeof(bytes) !== "object" || bytes === null || bytes.length === undefined) {
  602. unreachable("Invalid argument for bytesToString");
  603. }
  604. var length = bytes.length;
  605. var MAX_ARGUMENT_COUNT = 8192;
  606. if (length < MAX_ARGUMENT_COUNT) {
  607. return String.fromCharCode.apply(null, bytes);
  608. }
  609. var strBuf = [];
  610. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  611. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  612. var chunk = bytes.subarray(i, chunkEnd);
  613. strBuf.push(String.fromCharCode.apply(null, chunk));
  614. }
  615. return strBuf.join("");
  616. }
  617. function stringToBytes(str) {
  618. if (typeof str !== "string") {
  619. unreachable("Invalid argument for stringToBytes");
  620. }
  621. var length = str.length;
  622. var bytes = new Uint8Array(length);
  623. for (var i = 0; i < length; ++i) {
  624. bytes[i] = str.charCodeAt(i) & 0xff;
  625. }
  626. return bytes;
  627. }
  628. function arrayByteLength(arr) {
  629. if (arr.length !== undefined) {
  630. return arr.length;
  631. }
  632. if (arr.byteLength !== undefined) {
  633. return arr.byteLength;
  634. }
  635. unreachable("Invalid argument for arrayByteLength");
  636. }
  637. function arraysToBytes(arr) {
  638. var length = arr.length;
  639. if (length === 1 && arr[0] instanceof Uint8Array) {
  640. return arr[0];
  641. }
  642. var resultLength = 0;
  643. for (var i = 0; i < length; i++) {
  644. resultLength += arrayByteLength(arr[i]);
  645. }
  646. var pos = 0;
  647. var data = new Uint8Array(resultLength);
  648. for (var _i = 0; _i < length; _i++) {
  649. var item = arr[_i];
  650. if (!(item instanceof Uint8Array)) {
  651. if (typeof item === "string") {
  652. item = stringToBytes(item);
  653. } else {
  654. item = new Uint8Array(item);
  655. }
  656. }
  657. var itemLength = item.byteLength;
  658. data.set(item, pos);
  659. pos += itemLength;
  660. }
  661. return data;
  662. }
  663. function string32(value) {
  664. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  665. }
  666. function objectSize(obj) {
  667. return Object.keys(obj).length;
  668. }
  669. function objectFromMap(map) {
  670. var obj = Object.create(null);
  671. var _iterator = _createForOfIteratorHelper(map),
  672. _step;
  673. try {
  674. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  675. var _step$value = _slicedToArray(_step.value, 2),
  676. key = _step$value[0],
  677. value = _step$value[1];
  678. obj[key] = value;
  679. }
  680. } catch (err) {
  681. _iterator.e(err);
  682. } finally {
  683. _iterator.f();
  684. }
  685. return obj;
  686. }
  687. function isLittleEndian() {
  688. var buffer8 = new Uint8Array(4);
  689. buffer8[0] = 1;
  690. var view32 = new Uint32Array(buffer8.buffer, 0, 1);
  691. return view32[0] === 1;
  692. }
  693. function isEvalSupported() {
  694. try {
  695. new Function("");
  696. return true;
  697. } catch (e) {
  698. return false;
  699. }
  700. }
  701. var FeatureTest = /*#__PURE__*/function () {
  702. function FeatureTest() {
  703. _classCallCheck(this, FeatureTest);
  704. }
  705. _createClass(FeatureTest, null, [{
  706. key: "isLittleEndian",
  707. get: function get() {
  708. return shadow(this, "isLittleEndian", isLittleEndian());
  709. }
  710. }, {
  711. key: "isEvalSupported",
  712. get: function get() {
  713. return shadow(this, "isEvalSupported", isEvalSupported());
  714. }
  715. }, {
  716. key: "isOffscreenCanvasSupported",
  717. get: function get() {
  718. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  719. }
  720. }]);
  721. return FeatureTest;
  722. }();
  723. exports.FeatureTest = FeatureTest;
  724. var hexNumbers = _toConsumableArray(Array(256).keys()).map(function (n) {
  725. return n.toString(16).padStart(2, "0");
  726. });
  727. var Util = /*#__PURE__*/function () {
  728. function Util() {
  729. _classCallCheck(this, Util);
  730. }
  731. _createClass(Util, null, [{
  732. key: "makeHexColor",
  733. value: function makeHexColor(r, g, b) {
  734. return "#".concat(hexNumbers[r]).concat(hexNumbers[g]).concat(hexNumbers[b]);
  735. }
  736. }, {
  737. key: "scaleMinMax",
  738. value: function scaleMinMax(transform, minMax) {
  739. var temp;
  740. if (transform[0]) {
  741. if (transform[0] < 0) {
  742. temp = minMax[0];
  743. minMax[0] = minMax[1];
  744. minMax[1] = temp;
  745. }
  746. minMax[0] *= transform[0];
  747. minMax[1] *= transform[0];
  748. if (transform[3] < 0) {
  749. temp = minMax[2];
  750. minMax[2] = minMax[3];
  751. minMax[3] = temp;
  752. }
  753. minMax[2] *= transform[3];
  754. minMax[3] *= transform[3];
  755. } else {
  756. temp = minMax[0];
  757. minMax[0] = minMax[2];
  758. minMax[2] = temp;
  759. temp = minMax[1];
  760. minMax[1] = minMax[3];
  761. minMax[3] = temp;
  762. if (transform[1] < 0) {
  763. temp = minMax[2];
  764. minMax[2] = minMax[3];
  765. minMax[3] = temp;
  766. }
  767. minMax[2] *= transform[1];
  768. minMax[3] *= transform[1];
  769. if (transform[2] < 0) {
  770. temp = minMax[0];
  771. minMax[0] = minMax[1];
  772. minMax[1] = temp;
  773. }
  774. minMax[0] *= transform[2];
  775. minMax[1] *= transform[2];
  776. }
  777. minMax[0] += transform[4];
  778. minMax[1] += transform[4];
  779. minMax[2] += transform[5];
  780. minMax[3] += transform[5];
  781. }
  782. }, {
  783. key: "transform",
  784. value: function transform(m1, m2) {
  785. return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
  786. }
  787. }, {
  788. key: "applyTransform",
  789. value: function applyTransform(p, m) {
  790. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  791. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  792. return [xt, yt];
  793. }
  794. }, {
  795. key: "applyInverseTransform",
  796. value: function applyInverseTransform(p, m) {
  797. var d = m[0] * m[3] - m[1] * m[2];
  798. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  799. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  800. return [xt, yt];
  801. }
  802. }, {
  803. key: "getAxialAlignedBoundingBox",
  804. value: function getAxialAlignedBoundingBox(r, m) {
  805. var p1 = Util.applyTransform(r, m);
  806. var p2 = Util.applyTransform(r.slice(2, 4), m);
  807. var p3 = Util.applyTransform([r[0], r[3]], m);
  808. var p4 = Util.applyTransform([r[2], r[1]], m);
  809. return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
  810. }
  811. }, {
  812. key: "inverseTransform",
  813. value: function inverseTransform(m) {
  814. var d = m[0] * m[3] - m[1] * m[2];
  815. return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
  816. }
  817. }, {
  818. key: "apply3dTransform",
  819. value: function apply3dTransform(m, v) {
  820. return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
  821. }
  822. }, {
  823. key: "singularValueDecompose2dScale",
  824. value: function singularValueDecompose2dScale(m) {
  825. var transpose = [m[0], m[2], m[1], m[3]];
  826. var a = m[0] * transpose[0] + m[1] * transpose[2];
  827. var b = m[0] * transpose[1] + m[1] * transpose[3];
  828. var c = m[2] * transpose[0] + m[3] * transpose[2];
  829. var d = m[2] * transpose[1] + m[3] * transpose[3];
  830. var first = (a + d) / 2;
  831. var second = Math.sqrt(Math.pow(a + d, 2) - 4 * (a * d - c * b)) / 2;
  832. var sx = first + second || 1;
  833. var sy = first - second || 1;
  834. return [Math.sqrt(sx), Math.sqrt(sy)];
  835. }
  836. }, {
  837. key: "normalizeRect",
  838. value: function normalizeRect(rect) {
  839. var r = rect.slice(0);
  840. if (rect[0] > rect[2]) {
  841. r[0] = rect[2];
  842. r[2] = rect[0];
  843. }
  844. if (rect[1] > rect[3]) {
  845. r[1] = rect[3];
  846. r[3] = rect[1];
  847. }
  848. return r;
  849. }
  850. }, {
  851. key: "intersect",
  852. value: function intersect(rect1, rect2) {
  853. var xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  854. var xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  855. if (xLow > xHigh) {
  856. return null;
  857. }
  858. var yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  859. var yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  860. if (yLow > yHigh) {
  861. return null;
  862. }
  863. return [xLow, yLow, xHigh, yHigh];
  864. }
  865. }, {
  866. key: "bezierBoundingBox",
  867. value: function bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  868. var tvalues = [],
  869. bounds = [[], []];
  870. var a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  871. for (var i = 0; i < 2; ++i) {
  872. if (i === 0) {
  873. b = 6 * x0 - 12 * x1 + 6 * x2;
  874. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  875. c = 3 * x1 - 3 * x0;
  876. } else {
  877. b = 6 * y0 - 12 * y1 + 6 * y2;
  878. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  879. c = 3 * y1 - 3 * y0;
  880. }
  881. if (Math.abs(a) < 1e-12) {
  882. if (Math.abs(b) < 1e-12) {
  883. continue;
  884. }
  885. t = -c / b;
  886. if (0 < t && t < 1) {
  887. tvalues.push(t);
  888. }
  889. continue;
  890. }
  891. b2ac = b * b - 4 * c * a;
  892. sqrtb2ac = Math.sqrt(b2ac);
  893. if (b2ac < 0) {
  894. continue;
  895. }
  896. t1 = (-b + sqrtb2ac) / (2 * a);
  897. if (0 < t1 && t1 < 1) {
  898. tvalues.push(t1);
  899. }
  900. t2 = (-b - sqrtb2ac) / (2 * a);
  901. if (0 < t2 && t2 < 1) {
  902. tvalues.push(t2);
  903. }
  904. }
  905. var j = tvalues.length,
  906. mt;
  907. var jlen = j;
  908. while (j--) {
  909. t = tvalues[j];
  910. mt = 1 - t;
  911. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  912. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  913. }
  914. bounds[0][jlen] = x0;
  915. bounds[1][jlen] = y0;
  916. bounds[0][jlen + 1] = x3;
  917. bounds[1][jlen + 1] = y3;
  918. bounds[0].length = bounds[1].length = jlen + 2;
  919. return [Math.min.apply(Math, _toConsumableArray(bounds[0])), Math.min.apply(Math, _toConsumableArray(bounds[1])), Math.max.apply(Math, _toConsumableArray(bounds[0])), Math.max.apply(Math, _toConsumableArray(bounds[1]))];
  920. }
  921. }]);
  922. return Util;
  923. }();
  924. exports.Util = Util;
  925. var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
  926. function stringToPDFString(str) {
  927. if (str[0] >= "\xEF") {
  928. var encoding;
  929. if (str[0] === "\xFE" && str[1] === "\xFF") {
  930. encoding = "utf-16be";
  931. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  932. encoding = "utf-16le";
  933. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  934. encoding = "utf-8";
  935. }
  936. if (encoding) {
  937. try {
  938. var decoder = new TextDecoder(encoding, {
  939. fatal: true
  940. });
  941. var buffer = stringToBytes(str);
  942. return decoder.decode(buffer);
  943. } catch (ex) {
  944. warn("stringToPDFString: \"".concat(ex, "\"."));
  945. }
  946. }
  947. }
  948. var strBuf = [];
  949. for (var i = 0, ii = str.length; i < ii; i++) {
  950. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  951. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  952. }
  953. return strBuf.join("");
  954. }
  955. function escapeString(str) {
  956. return str.replace(/([()\\\n\r])/g, function (match) {
  957. if (match === "\n") {
  958. return "\\n";
  959. } else if (match === "\r") {
  960. return "\\r";
  961. }
  962. return "\\".concat(match);
  963. });
  964. }
  965. function isAscii(str) {
  966. return /^[\x00-\x7F]*$/.test(str);
  967. }
  968. function stringToUTF16BEString(str) {
  969. var buf = ["\xFE\xFF"];
  970. for (var i = 0, ii = str.length; i < ii; i++) {
  971. var _char = str.charCodeAt(i);
  972. buf.push(String.fromCharCode(_char >> 8 & 0xff), String.fromCharCode(_char & 0xff));
  973. }
  974. return buf.join("");
  975. }
  976. function stringToUTF8String(str) {
  977. return decodeURIComponent(escape(str));
  978. }
  979. function utf8StringToString(str) {
  980. return unescape(encodeURIComponent(str));
  981. }
  982. function isArrayBuffer(v) {
  983. return _typeof(v) === "object" && v !== null && v.byteLength !== undefined;
  984. }
  985. function isArrayEqual(arr1, arr2) {
  986. if (arr1.length !== arr2.length) {
  987. return false;
  988. }
  989. for (var i = 0, ii = arr1.length; i < ii; i++) {
  990. if (arr1[i] !== arr2[i]) {
  991. return false;
  992. }
  993. }
  994. return true;
  995. }
  996. function getModificationDate() {
  997. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  998. var buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
  999. return buffer.join("");
  1000. }
  1001. function createPromiseCapability() {
  1002. var capability = Object.create(null);
  1003. var isSettled = false;
  1004. Object.defineProperty(capability, "settled", {
  1005. get: function get() {
  1006. return isSettled;
  1007. }
  1008. });
  1009. capability.promise = new Promise(function (resolve, reject) {
  1010. capability.resolve = function (data) {
  1011. isSettled = true;
  1012. resolve(data);
  1013. };
  1014. capability.reject = function (reason) {
  1015. isSettled = true;
  1016. reject(reason);
  1017. };
  1018. });
  1019. return capability;
  1020. }
  1021. /***/ }),
  1022. /* 2 */
  1023. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1024. "use strict";
  1025. var _is_node = __w_pdfjs_require__(3);
  1026. if (!globalThis._pdfjsCompatibilityChecked) {
  1027. globalThis._pdfjsCompatibilityChecked = true;
  1028. (function checkNodeBtoa() {
  1029. if (globalThis.btoa || !_is_node.isNodeJS) {
  1030. return;
  1031. }
  1032. globalThis.btoa = function (chars) {
  1033. return Buffer.from(chars, "binary").toString("base64");
  1034. };
  1035. })();
  1036. (function checkNodeAtob() {
  1037. if (globalThis.atob || !_is_node.isNodeJS) {
  1038. return;
  1039. }
  1040. globalThis.atob = function (input) {
  1041. return Buffer.from(input, "base64").toString("binary");
  1042. };
  1043. })();
  1044. (function checkDOMMatrix() {
  1045. if (globalThis.DOMMatrix || !_is_node.isNodeJS) {
  1046. return;
  1047. }
  1048. globalThis.DOMMatrix = require("dommatrix/dist/dommatrix.js");
  1049. })();
  1050. (function checkPromise() {
  1051. if (globalThis.Promise.allSettled) {
  1052. return;
  1053. }
  1054. globalThis.Promise = __w_pdfjs_require__(4);
  1055. })();
  1056. (function checkReadableStream() {
  1057. if (globalThis.ReadableStream || !_is_node.isNodeJS) {
  1058. return;
  1059. }
  1060. globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
  1061. })();
  1062. (function checkStructuredClone() {
  1063. if (globalThis.structuredClone) {
  1064. return;
  1065. }
  1066. __w_pdfjs_require__(137);
  1067. })();
  1068. }
  1069. /***/ }),
  1070. /* 3 */
  1071. /***/ ((__unused_webpack_module, exports) => {
  1072. "use strict";
  1073. Object.defineProperty(exports, "__esModule", ({
  1074. value: true
  1075. }));
  1076. exports.isNodeJS = void 0;
  1077. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  1078. var isNodeJS = (typeof process === "undefined" ? "undefined" : _typeof(process)) === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1079. exports.isNodeJS = isNodeJS;
  1080. /***/ }),
  1081. /* 4 */
  1082. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1083. __w_pdfjs_require__(5);
  1084. __w_pdfjs_require__(91);
  1085. __w_pdfjs_require__(97);
  1086. __w_pdfjs_require__(99);
  1087. __w_pdfjs_require__(131);
  1088. __w_pdfjs_require__(132);
  1089. __w_pdfjs_require__(133);
  1090. __w_pdfjs_require__(134);
  1091. var path = __w_pdfjs_require__(136);
  1092. module.exports = path.Promise;
  1093. /***/ }),
  1094. /* 5 */
  1095. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1096. __w_pdfjs_require__(6);
  1097. /***/ }),
  1098. /* 6 */
  1099. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1100. "use strict";
  1101. var $ = __w_pdfjs_require__(7);
  1102. var global = __w_pdfjs_require__(8);
  1103. var isPrototypeOf = __w_pdfjs_require__(27);
  1104. var getPrototypeOf = __w_pdfjs_require__(69);
  1105. var setPrototypeOf = __w_pdfjs_require__(71);
  1106. var copyConstructorProperties = __w_pdfjs_require__(57);
  1107. var create = __w_pdfjs_require__(73);
  1108. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  1109. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1110. var clearErrorStack = __w_pdfjs_require__(77);
  1111. var installErrorCause = __w_pdfjs_require__(78);
  1112. var iterate = __w_pdfjs_require__(79);
  1113. var normalizeStringArgument = __w_pdfjs_require__(88);
  1114. var wellKnownSymbol = __w_pdfjs_require__(36);
  1115. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(90);
  1116. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1117. var Error = global.Error;
  1118. var push = [].push;
  1119. var $AggregateError = function AggregateError(errors, message) {
  1120. var options = arguments.length > 2 ? arguments[2] : undefined;
  1121. var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
  1122. var that;
  1123. if (setPrototypeOf) {
  1124. that = setPrototypeOf(new Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
  1125. } else {
  1126. that = isInstance ? this : create(AggregateErrorPrototype);
  1127. createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
  1128. }
  1129. if (message !== undefined)
  1130. createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
  1131. if (ERROR_STACK_INSTALLABLE)
  1132. createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
  1133. installErrorCause(that, options);
  1134. var errorsArray = [];
  1135. iterate(errors, push, { that: errorsArray });
  1136. createNonEnumerableProperty(that, 'errors', errorsArray);
  1137. return that;
  1138. };
  1139. if (setPrototypeOf)
  1140. setPrototypeOf($AggregateError, Error);
  1141. else
  1142. copyConstructorProperties($AggregateError, Error, { name: true });
  1143. var AggregateErrorPrototype = $AggregateError.prototype = create(Error.prototype, {
  1144. constructor: createPropertyDescriptor(1, $AggregateError),
  1145. message: createPropertyDescriptor(1, ''),
  1146. name: createPropertyDescriptor(1, 'AggregateError')
  1147. });
  1148. $({ global: true }, { AggregateError: $AggregateError });
  1149. /***/ }),
  1150. /* 7 */
  1151. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1152. var global = __w_pdfjs_require__(8);
  1153. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  1154. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  1155. var redefine = __w_pdfjs_require__(50);
  1156. var setGlobal = __w_pdfjs_require__(40);
  1157. var copyConstructorProperties = __w_pdfjs_require__(57);
  1158. var isForced = __w_pdfjs_require__(68);
  1159. module.exports = function (options, source) {
  1160. var TARGET = options.target;
  1161. var GLOBAL = options.global;
  1162. var STATIC = options.stat;
  1163. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1164. if (GLOBAL) {
  1165. target = global;
  1166. } else if (STATIC) {
  1167. target = global[TARGET] || setGlobal(TARGET, {});
  1168. } else {
  1169. target = (global[TARGET] || {}).prototype;
  1170. }
  1171. if (target)
  1172. for (key in source) {
  1173. sourceProperty = source[key];
  1174. if (options.noTargetGet) {
  1175. descriptor = getOwnPropertyDescriptor(target, key);
  1176. targetProperty = descriptor && descriptor.value;
  1177. } else
  1178. targetProperty = target[key];
  1179. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1180. if (!FORCED && targetProperty !== undefined) {
  1181. if (typeof sourceProperty == typeof targetProperty)
  1182. continue;
  1183. copyConstructorProperties(sourceProperty, targetProperty);
  1184. }
  1185. if (options.sham || targetProperty && targetProperty.sham) {
  1186. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1187. }
  1188. redefine(target, key, sourceProperty, options);
  1189. }
  1190. };
  1191. /***/ }),
  1192. /* 8 */
  1193. /***/ ((module) => {
  1194. var check = function (it) {
  1195. return it && it.Math == Math && it;
  1196. };
  1197. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || (function () {
  1198. return this;
  1199. }()) || Function('return this')();
  1200. /***/ }),
  1201. /* 9 */
  1202. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1203. var DESCRIPTORS = __w_pdfjs_require__(10);
  1204. var call = __w_pdfjs_require__(12);
  1205. var propertyIsEnumerableModule = __w_pdfjs_require__(14);
  1206. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1207. var toIndexedObject = __w_pdfjs_require__(16);
  1208. var toPropertyKey = __w_pdfjs_require__(21);
  1209. var hasOwn = __w_pdfjs_require__(41);
  1210. var IE8_DOM_DEFINE = __w_pdfjs_require__(44);
  1211. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1212. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1213. O = toIndexedObject(O);
  1214. P = toPropertyKey(P);
  1215. if (IE8_DOM_DEFINE)
  1216. try {
  1217. return $getOwnPropertyDescriptor(O, P);
  1218. } catch (error) {
  1219. }
  1220. if (hasOwn(O, P))
  1221. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  1222. };
  1223. /***/ }),
  1224. /* 10 */
  1225. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1226. var fails = __w_pdfjs_require__(11);
  1227. module.exports = !fails(function () {
  1228. return Object.defineProperty({}, 1, {
  1229. get: function () {
  1230. return 7;
  1231. }
  1232. })[1] != 7;
  1233. });
  1234. /***/ }),
  1235. /* 11 */
  1236. /***/ ((module) => {
  1237. module.exports = function (exec) {
  1238. try {
  1239. return !!exec();
  1240. } catch (error) {
  1241. return true;
  1242. }
  1243. };
  1244. /***/ }),
  1245. /* 12 */
  1246. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1247. var NATIVE_BIND = __w_pdfjs_require__(13);
  1248. var call = Function.prototype.call;
  1249. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  1250. return call.apply(call, arguments);
  1251. };
  1252. /***/ }),
  1253. /* 13 */
  1254. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1255. var fails = __w_pdfjs_require__(11);
  1256. module.exports = !fails(function () {
  1257. var test = function () {
  1258. }.bind();
  1259. return typeof test != 'function' || test.hasOwnProperty('prototype');
  1260. });
  1261. /***/ }),
  1262. /* 14 */
  1263. /***/ ((__unused_webpack_module, exports) => {
  1264. "use strict";
  1265. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  1266. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1267. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  1268. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1269. var descriptor = getOwnPropertyDescriptor(this, V);
  1270. return !!descriptor && descriptor.enumerable;
  1271. } : $propertyIsEnumerable;
  1272. /***/ }),
  1273. /* 15 */
  1274. /***/ ((module) => {
  1275. module.exports = function (bitmap, value) {
  1276. return {
  1277. enumerable: !(bitmap & 1),
  1278. configurable: !(bitmap & 2),
  1279. writable: !(bitmap & 4),
  1280. value: value
  1281. };
  1282. };
  1283. /***/ }),
  1284. /* 16 */
  1285. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1286. var IndexedObject = __w_pdfjs_require__(17);
  1287. var requireObjectCoercible = __w_pdfjs_require__(20);
  1288. module.exports = function (it) {
  1289. return IndexedObject(requireObjectCoercible(it));
  1290. };
  1291. /***/ }),
  1292. /* 17 */
  1293. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1294. var global = __w_pdfjs_require__(8);
  1295. var uncurryThis = __w_pdfjs_require__(18);
  1296. var fails = __w_pdfjs_require__(11);
  1297. var classof = __w_pdfjs_require__(19);
  1298. var Object = global.Object;
  1299. var split = uncurryThis(''.split);
  1300. module.exports = fails(function () {
  1301. return !Object('z').propertyIsEnumerable(0);
  1302. }) ? function (it) {
  1303. return classof(it) == 'String' ? split(it, '') : Object(it);
  1304. } : Object;
  1305. /***/ }),
  1306. /* 18 */
  1307. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1308. var NATIVE_BIND = __w_pdfjs_require__(13);
  1309. var FunctionPrototype = Function.prototype;
  1310. var bind = FunctionPrototype.bind;
  1311. var call = FunctionPrototype.call;
  1312. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  1313. module.exports = NATIVE_BIND ? function (fn) {
  1314. return fn && uncurryThis(fn);
  1315. } : function (fn) {
  1316. return fn && function () {
  1317. return call.apply(fn, arguments);
  1318. };
  1319. };
  1320. /***/ }),
  1321. /* 19 */
  1322. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1323. var uncurryThis = __w_pdfjs_require__(18);
  1324. var toString = uncurryThis({}.toString);
  1325. var stringSlice = uncurryThis(''.slice);
  1326. module.exports = function (it) {
  1327. return stringSlice(toString(it), 8, -1);
  1328. };
  1329. /***/ }),
  1330. /* 20 */
  1331. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1332. var global = __w_pdfjs_require__(8);
  1333. var TypeError = global.TypeError;
  1334. module.exports = function (it) {
  1335. if (it == undefined)
  1336. throw TypeError("Can't call method on " + it);
  1337. return it;
  1338. };
  1339. /***/ }),
  1340. /* 21 */
  1341. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1342. var toPrimitive = __w_pdfjs_require__(22);
  1343. var isSymbol = __w_pdfjs_require__(25);
  1344. module.exports = function (argument) {
  1345. var key = toPrimitive(argument, 'string');
  1346. return isSymbol(key) ? key : key + '';
  1347. };
  1348. /***/ }),
  1349. /* 22 */
  1350. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1351. var global = __w_pdfjs_require__(8);
  1352. var call = __w_pdfjs_require__(12);
  1353. var isObject = __w_pdfjs_require__(23);
  1354. var isSymbol = __w_pdfjs_require__(25);
  1355. var getMethod = __w_pdfjs_require__(32);
  1356. var ordinaryToPrimitive = __w_pdfjs_require__(35);
  1357. var wellKnownSymbol = __w_pdfjs_require__(36);
  1358. var TypeError = global.TypeError;
  1359. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  1360. module.exports = function (input, pref) {
  1361. if (!isObject(input) || isSymbol(input))
  1362. return input;
  1363. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  1364. var result;
  1365. if (exoticToPrim) {
  1366. if (pref === undefined)
  1367. pref = 'default';
  1368. result = call(exoticToPrim, input, pref);
  1369. if (!isObject(result) || isSymbol(result))
  1370. return result;
  1371. throw TypeError("Can't convert object to primitive value");
  1372. }
  1373. if (pref === undefined)
  1374. pref = 'number';
  1375. return ordinaryToPrimitive(input, pref);
  1376. };
  1377. /***/ }),
  1378. /* 23 */
  1379. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1380. var isCallable = __w_pdfjs_require__(24);
  1381. module.exports = function (it) {
  1382. return typeof it == 'object' ? it !== null : isCallable(it);
  1383. };
  1384. /***/ }),
  1385. /* 24 */
  1386. /***/ ((module) => {
  1387. module.exports = function (argument) {
  1388. return typeof argument == 'function';
  1389. };
  1390. /***/ }),
  1391. /* 25 */
  1392. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1393. var global = __w_pdfjs_require__(8);
  1394. var getBuiltIn = __w_pdfjs_require__(26);
  1395. var isCallable = __w_pdfjs_require__(24);
  1396. var isPrototypeOf = __w_pdfjs_require__(27);
  1397. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(28);
  1398. var Object = global.Object;
  1399. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  1400. return typeof it == 'symbol';
  1401. } : function (it) {
  1402. var $Symbol = getBuiltIn('Symbol');
  1403. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it));
  1404. };
  1405. /***/ }),
  1406. /* 26 */
  1407. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1408. var global = __w_pdfjs_require__(8);
  1409. var isCallable = __w_pdfjs_require__(24);
  1410. var aFunction = function (argument) {
  1411. return isCallable(argument) ? argument : undefined;
  1412. };
  1413. module.exports = function (namespace, method) {
  1414. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  1415. };
  1416. /***/ }),
  1417. /* 27 */
  1418. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1419. var uncurryThis = __w_pdfjs_require__(18);
  1420. module.exports = uncurryThis({}.isPrototypeOf);
  1421. /***/ }),
  1422. /* 28 */
  1423. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1424. var NATIVE_SYMBOL = __w_pdfjs_require__(29);
  1425. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  1426. /***/ }),
  1427. /* 29 */
  1428. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1429. var V8_VERSION = __w_pdfjs_require__(30);
  1430. var fails = __w_pdfjs_require__(11);
  1431. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  1432. var symbol = Symbol();
  1433. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  1434. });
  1435. /***/ }),
  1436. /* 30 */
  1437. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1438. var global = __w_pdfjs_require__(8);
  1439. var userAgent = __w_pdfjs_require__(31);
  1440. var process = global.process;
  1441. var Deno = global.Deno;
  1442. var versions = process && process.versions || Deno && Deno.version;
  1443. var v8 = versions && versions.v8;
  1444. var match, version;
  1445. if (v8) {
  1446. match = v8.split('.');
  1447. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  1448. }
  1449. if (!version && userAgent) {
  1450. match = userAgent.match(/Edge\/(\d+)/);
  1451. if (!match || match[1] >= 74) {
  1452. match = userAgent.match(/Chrome\/(\d+)/);
  1453. if (match)
  1454. version = +match[1];
  1455. }
  1456. }
  1457. module.exports = version;
  1458. /***/ }),
  1459. /* 31 */
  1460. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1461. var getBuiltIn = __w_pdfjs_require__(26);
  1462. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  1463. /***/ }),
  1464. /* 32 */
  1465. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1466. var aCallable = __w_pdfjs_require__(33);
  1467. module.exports = function (V, P) {
  1468. var func = V[P];
  1469. return func == null ? undefined : aCallable(func);
  1470. };
  1471. /***/ }),
  1472. /* 33 */
  1473. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1474. var global = __w_pdfjs_require__(8);
  1475. var isCallable = __w_pdfjs_require__(24);
  1476. var tryToString = __w_pdfjs_require__(34);
  1477. var TypeError = global.TypeError;
  1478. module.exports = function (argument) {
  1479. if (isCallable(argument))
  1480. return argument;
  1481. throw TypeError(tryToString(argument) + ' is not a function');
  1482. };
  1483. /***/ }),
  1484. /* 34 */
  1485. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1486. var global = __w_pdfjs_require__(8);
  1487. var String = global.String;
  1488. module.exports = function (argument) {
  1489. try {
  1490. return String(argument);
  1491. } catch (error) {
  1492. return 'Object';
  1493. }
  1494. };
  1495. /***/ }),
  1496. /* 35 */
  1497. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1498. var global = __w_pdfjs_require__(8);
  1499. var call = __w_pdfjs_require__(12);
  1500. var isCallable = __w_pdfjs_require__(24);
  1501. var isObject = __w_pdfjs_require__(23);
  1502. var TypeError = global.TypeError;
  1503. module.exports = function (input, pref) {
  1504. var fn, val;
  1505. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1506. return val;
  1507. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  1508. return val;
  1509. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1510. return val;
  1511. throw TypeError("Can't convert object to primitive value");
  1512. };
  1513. /***/ }),
  1514. /* 36 */
  1515. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1516. var global = __w_pdfjs_require__(8);
  1517. var shared = __w_pdfjs_require__(37);
  1518. var hasOwn = __w_pdfjs_require__(41);
  1519. var uid = __w_pdfjs_require__(43);
  1520. var NATIVE_SYMBOL = __w_pdfjs_require__(29);
  1521. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(28);
  1522. var WellKnownSymbolsStore = shared('wks');
  1523. var Symbol = global.Symbol;
  1524. var symbolFor = Symbol && Symbol['for'];
  1525. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  1526. module.exports = function (name) {
  1527. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  1528. var description = 'Symbol.' + name;
  1529. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  1530. WellKnownSymbolsStore[name] = Symbol[name];
  1531. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  1532. WellKnownSymbolsStore[name] = symbolFor(description);
  1533. } else {
  1534. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  1535. }
  1536. }
  1537. return WellKnownSymbolsStore[name];
  1538. };
  1539. /***/ }),
  1540. /* 37 */
  1541. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1542. var IS_PURE = __w_pdfjs_require__(38);
  1543. var store = __w_pdfjs_require__(39);
  1544. (module.exports = function (key, value) {
  1545. return store[key] || (store[key] = value !== undefined ? value : {});
  1546. })('versions', []).push({
  1547. version: '3.22.3',
  1548. mode: IS_PURE ? 'pure' : 'global',
  1549. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  1550. license: 'https://github.com/zloirock/core-js/blob/v3.22.3/LICENSE',
  1551. source: 'https://github.com/zloirock/core-js'
  1552. });
  1553. /***/ }),
  1554. /* 38 */
  1555. /***/ ((module) => {
  1556. module.exports = false;
  1557. /***/ }),
  1558. /* 39 */
  1559. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1560. var global = __w_pdfjs_require__(8);
  1561. var setGlobal = __w_pdfjs_require__(40);
  1562. var SHARED = '__core-js_shared__';
  1563. var store = global[SHARED] || setGlobal(SHARED, {});
  1564. module.exports = store;
  1565. /***/ }),
  1566. /* 40 */
  1567. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1568. var global = __w_pdfjs_require__(8);
  1569. var defineProperty = Object.defineProperty;
  1570. module.exports = function (key, value) {
  1571. try {
  1572. defineProperty(global, key, {
  1573. value: value,
  1574. configurable: true,
  1575. writable: true
  1576. });
  1577. } catch (error) {
  1578. global[key] = value;
  1579. }
  1580. return value;
  1581. };
  1582. /***/ }),
  1583. /* 41 */
  1584. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1585. var uncurryThis = __w_pdfjs_require__(18);
  1586. var toObject = __w_pdfjs_require__(42);
  1587. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  1588. module.exports = Object.hasOwn || function hasOwn(it, key) {
  1589. return hasOwnProperty(toObject(it), key);
  1590. };
  1591. /***/ }),
  1592. /* 42 */
  1593. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1594. var global = __w_pdfjs_require__(8);
  1595. var requireObjectCoercible = __w_pdfjs_require__(20);
  1596. var Object = global.Object;
  1597. module.exports = function (argument) {
  1598. return Object(requireObjectCoercible(argument));
  1599. };
  1600. /***/ }),
  1601. /* 43 */
  1602. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1603. var uncurryThis = __w_pdfjs_require__(18);
  1604. var id = 0;
  1605. var postfix = Math.random();
  1606. var toString = uncurryThis(1.0.toString);
  1607. module.exports = function (key) {
  1608. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  1609. };
  1610. /***/ }),
  1611. /* 44 */
  1612. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1613. var DESCRIPTORS = __w_pdfjs_require__(10);
  1614. var fails = __w_pdfjs_require__(11);
  1615. var createElement = __w_pdfjs_require__(45);
  1616. module.exports = !DESCRIPTORS && !fails(function () {
  1617. return Object.defineProperty(createElement('div'), 'a', {
  1618. get: function () {
  1619. return 7;
  1620. }
  1621. }).a != 7;
  1622. });
  1623. /***/ }),
  1624. /* 45 */
  1625. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1626. var global = __w_pdfjs_require__(8);
  1627. var isObject = __w_pdfjs_require__(23);
  1628. var document = global.document;
  1629. var EXISTS = isObject(document) && isObject(document.createElement);
  1630. module.exports = function (it) {
  1631. return EXISTS ? document.createElement(it) : {};
  1632. };
  1633. /***/ }),
  1634. /* 46 */
  1635. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1636. var DESCRIPTORS = __w_pdfjs_require__(10);
  1637. var definePropertyModule = __w_pdfjs_require__(47);
  1638. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1639. module.exports = DESCRIPTORS ? function (object, key, value) {
  1640. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  1641. } : function (object, key, value) {
  1642. object[key] = value;
  1643. return object;
  1644. };
  1645. /***/ }),
  1646. /* 47 */
  1647. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1648. var global = __w_pdfjs_require__(8);
  1649. var DESCRIPTORS = __w_pdfjs_require__(10);
  1650. var IE8_DOM_DEFINE = __w_pdfjs_require__(44);
  1651. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(48);
  1652. var anObject = __w_pdfjs_require__(49);
  1653. var toPropertyKey = __w_pdfjs_require__(21);
  1654. var TypeError = global.TypeError;
  1655. var $defineProperty = Object.defineProperty;
  1656. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1657. var ENUMERABLE = 'enumerable';
  1658. var CONFIGURABLE = 'configurable';
  1659. var WRITABLE = 'writable';
  1660. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  1661. anObject(O);
  1662. P = toPropertyKey(P);
  1663. anObject(Attributes);
  1664. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  1665. var current = $getOwnPropertyDescriptor(O, P);
  1666. if (current && current[WRITABLE]) {
  1667. O[P] = Attributes.value;
  1668. Attributes = {
  1669. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  1670. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  1671. writable: false
  1672. };
  1673. }
  1674. }
  1675. return $defineProperty(O, P, Attributes);
  1676. } : $defineProperty : function defineProperty(O, P, Attributes) {
  1677. anObject(O);
  1678. P = toPropertyKey(P);
  1679. anObject(Attributes);
  1680. if (IE8_DOM_DEFINE)
  1681. try {
  1682. return $defineProperty(O, P, Attributes);
  1683. } catch (error) {
  1684. }
  1685. if ('get' in Attributes || 'set' in Attributes)
  1686. throw TypeError('Accessors not supported');
  1687. if ('value' in Attributes)
  1688. O[P] = Attributes.value;
  1689. return O;
  1690. };
  1691. /***/ }),
  1692. /* 48 */
  1693. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1694. var DESCRIPTORS = __w_pdfjs_require__(10);
  1695. var fails = __w_pdfjs_require__(11);
  1696. module.exports = DESCRIPTORS && fails(function () {
  1697. return Object.defineProperty(function () {
  1698. }, 'prototype', {
  1699. value: 42,
  1700. writable: false
  1701. }).prototype != 42;
  1702. });
  1703. /***/ }),
  1704. /* 49 */
  1705. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1706. var global = __w_pdfjs_require__(8);
  1707. var isObject = __w_pdfjs_require__(23);
  1708. var String = global.String;
  1709. var TypeError = global.TypeError;
  1710. module.exports = function (argument) {
  1711. if (isObject(argument))
  1712. return argument;
  1713. throw TypeError(String(argument) + ' is not an object');
  1714. };
  1715. /***/ }),
  1716. /* 50 */
  1717. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1718. var global = __w_pdfjs_require__(8);
  1719. var isCallable = __w_pdfjs_require__(24);
  1720. var hasOwn = __w_pdfjs_require__(41);
  1721. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  1722. var setGlobal = __w_pdfjs_require__(40);
  1723. var inspectSource = __w_pdfjs_require__(51);
  1724. var InternalStateModule = __w_pdfjs_require__(52);
  1725. var CONFIGURABLE_FUNCTION_NAME = (__w_pdfjs_require__(56).CONFIGURABLE);
  1726. var getInternalState = InternalStateModule.get;
  1727. var enforceInternalState = InternalStateModule.enforce;
  1728. var TEMPLATE = String(String).split('String');
  1729. (module.exports = function (O, key, value, options) {
  1730. var unsafe = options ? !!options.unsafe : false;
  1731. var simple = options ? !!options.enumerable : false;
  1732. var noTargetGet = options ? !!options.noTargetGet : false;
  1733. var name = options && options.name !== undefined ? options.name : key;
  1734. var state;
  1735. if (isCallable(value)) {
  1736. if (String(name).slice(0, 7) === 'Symbol(') {
  1737. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  1738. }
  1739. if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  1740. createNonEnumerableProperty(value, 'name', name);
  1741. }
  1742. state = enforceInternalState(value);
  1743. if (!state.source) {
  1744. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  1745. }
  1746. }
  1747. if (O === global) {
  1748. if (simple)
  1749. O[key] = value;
  1750. else
  1751. setGlobal(key, value);
  1752. return;
  1753. } else if (!unsafe) {
  1754. delete O[key];
  1755. } else if (!noTargetGet && O[key]) {
  1756. simple = true;
  1757. }
  1758. if (simple)
  1759. O[key] = value;
  1760. else
  1761. createNonEnumerableProperty(O, key, value);
  1762. })(Function.prototype, 'toString', function toString() {
  1763. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  1764. });
  1765. /***/ }),
  1766. /* 51 */
  1767. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1768. var uncurryThis = __w_pdfjs_require__(18);
  1769. var isCallable = __w_pdfjs_require__(24);
  1770. var store = __w_pdfjs_require__(39);
  1771. var functionToString = uncurryThis(Function.toString);
  1772. if (!isCallable(store.inspectSource)) {
  1773. store.inspectSource = function (it) {
  1774. return functionToString(it);
  1775. };
  1776. }
  1777. module.exports = store.inspectSource;
  1778. /***/ }),
  1779. /* 52 */
  1780. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1781. var NATIVE_WEAK_MAP = __w_pdfjs_require__(53);
  1782. var global = __w_pdfjs_require__(8);
  1783. var uncurryThis = __w_pdfjs_require__(18);
  1784. var isObject = __w_pdfjs_require__(23);
  1785. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  1786. var hasOwn = __w_pdfjs_require__(41);
  1787. var shared = __w_pdfjs_require__(39);
  1788. var sharedKey = __w_pdfjs_require__(54);
  1789. var hiddenKeys = __w_pdfjs_require__(55);
  1790. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  1791. var TypeError = global.TypeError;
  1792. var WeakMap = global.WeakMap;
  1793. var set, get, has;
  1794. var enforce = function (it) {
  1795. return has(it) ? get(it) : set(it, {});
  1796. };
  1797. var getterFor = function (TYPE) {
  1798. return function (it) {
  1799. var state;
  1800. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  1801. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  1802. }
  1803. return state;
  1804. };
  1805. };
  1806. if (NATIVE_WEAK_MAP || shared.state) {
  1807. var store = shared.state || (shared.state = new WeakMap());
  1808. var wmget = uncurryThis(store.get);
  1809. var wmhas = uncurryThis(store.has);
  1810. var wmset = uncurryThis(store.set);
  1811. set = function (it, metadata) {
  1812. if (wmhas(store, it))
  1813. throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  1814. metadata.facade = it;
  1815. wmset(store, it, metadata);
  1816. return metadata;
  1817. };
  1818. get = function (it) {
  1819. return wmget(store, it) || {};
  1820. };
  1821. has = function (it) {
  1822. return wmhas(store, it);
  1823. };
  1824. } else {
  1825. var STATE = sharedKey('state');
  1826. hiddenKeys[STATE] = true;
  1827. set = function (it, metadata) {
  1828. if (hasOwn(it, STATE))
  1829. throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  1830. metadata.facade = it;
  1831. createNonEnumerableProperty(it, STATE, metadata);
  1832. return metadata;
  1833. };
  1834. get = function (it) {
  1835. return hasOwn(it, STATE) ? it[STATE] : {};
  1836. };
  1837. has = function (it) {
  1838. return hasOwn(it, STATE);
  1839. };
  1840. }
  1841. module.exports = {
  1842. set: set,
  1843. get: get,
  1844. has: has,
  1845. enforce: enforce,
  1846. getterFor: getterFor
  1847. };
  1848. /***/ }),
  1849. /* 53 */
  1850. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1851. var global = __w_pdfjs_require__(8);
  1852. var isCallable = __w_pdfjs_require__(24);
  1853. var inspectSource = __w_pdfjs_require__(51);
  1854. var WeakMap = global.WeakMap;
  1855. module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
  1856. /***/ }),
  1857. /* 54 */
  1858. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1859. var shared = __w_pdfjs_require__(37);
  1860. var uid = __w_pdfjs_require__(43);
  1861. var keys = shared('keys');
  1862. module.exports = function (key) {
  1863. return keys[key] || (keys[key] = uid(key));
  1864. };
  1865. /***/ }),
  1866. /* 55 */
  1867. /***/ ((module) => {
  1868. module.exports = {};
  1869. /***/ }),
  1870. /* 56 */
  1871. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1872. var DESCRIPTORS = __w_pdfjs_require__(10);
  1873. var hasOwn = __w_pdfjs_require__(41);
  1874. var FunctionPrototype = Function.prototype;
  1875. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  1876. var EXISTS = hasOwn(FunctionPrototype, 'name');
  1877. var PROPER = EXISTS && function something() {
  1878. }.name === 'something';
  1879. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
  1880. module.exports = {
  1881. EXISTS: EXISTS,
  1882. PROPER: PROPER,
  1883. CONFIGURABLE: CONFIGURABLE
  1884. };
  1885. /***/ }),
  1886. /* 57 */
  1887. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1888. var hasOwn = __w_pdfjs_require__(41);
  1889. var ownKeys = __w_pdfjs_require__(58);
  1890. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(9);
  1891. var definePropertyModule = __w_pdfjs_require__(47);
  1892. module.exports = function (target, source, exceptions) {
  1893. var keys = ownKeys(source);
  1894. var defineProperty = definePropertyModule.f;
  1895. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  1896. for (var i = 0; i < keys.length; i++) {
  1897. var key = keys[i];
  1898. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  1899. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  1900. }
  1901. }
  1902. };
  1903. /***/ }),
  1904. /* 58 */
  1905. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1906. var getBuiltIn = __w_pdfjs_require__(26);
  1907. var uncurryThis = __w_pdfjs_require__(18);
  1908. var getOwnPropertyNamesModule = __w_pdfjs_require__(59);
  1909. var getOwnPropertySymbolsModule = __w_pdfjs_require__(67);
  1910. var anObject = __w_pdfjs_require__(49);
  1911. var concat = uncurryThis([].concat);
  1912. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  1913. var keys = getOwnPropertyNamesModule.f(anObject(it));
  1914. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  1915. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  1916. };
  1917. /***/ }),
  1918. /* 59 */
  1919. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1920. var internalObjectKeys = __w_pdfjs_require__(60);
  1921. var enumBugKeys = __w_pdfjs_require__(66);
  1922. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  1923. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  1924. return internalObjectKeys(O, hiddenKeys);
  1925. };
  1926. /***/ }),
  1927. /* 60 */
  1928. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1929. var uncurryThis = __w_pdfjs_require__(18);
  1930. var hasOwn = __w_pdfjs_require__(41);
  1931. var toIndexedObject = __w_pdfjs_require__(16);
  1932. var indexOf = (__w_pdfjs_require__(61).indexOf);
  1933. var hiddenKeys = __w_pdfjs_require__(55);
  1934. var push = uncurryThis([].push);
  1935. module.exports = function (object, names) {
  1936. var O = toIndexedObject(object);
  1937. var i = 0;
  1938. var result = [];
  1939. var key;
  1940. for (key in O)
  1941. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  1942. while (names.length > i)
  1943. if (hasOwn(O, key = names[i++])) {
  1944. ~indexOf(result, key) || push(result, key);
  1945. }
  1946. return result;
  1947. };
  1948. /***/ }),
  1949. /* 61 */
  1950. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1951. var toIndexedObject = __w_pdfjs_require__(16);
  1952. var toAbsoluteIndex = __w_pdfjs_require__(62);
  1953. var lengthOfArrayLike = __w_pdfjs_require__(64);
  1954. var createMethod = function (IS_INCLUDES) {
  1955. return function ($this, el, fromIndex) {
  1956. var O = toIndexedObject($this);
  1957. var length = lengthOfArrayLike(O);
  1958. var index = toAbsoluteIndex(fromIndex, length);
  1959. var value;
  1960. if (IS_INCLUDES && el != el)
  1961. while (length > index) {
  1962. value = O[index++];
  1963. if (value != value)
  1964. return true;
  1965. }
  1966. else
  1967. for (; length > index; index++) {
  1968. if ((IS_INCLUDES || index in O) && O[index] === el)
  1969. return IS_INCLUDES || index || 0;
  1970. }
  1971. return !IS_INCLUDES && -1;
  1972. };
  1973. };
  1974. module.exports = {
  1975. includes: createMethod(true),
  1976. indexOf: createMethod(false)
  1977. };
  1978. /***/ }),
  1979. /* 62 */
  1980. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1981. var toIntegerOrInfinity = __w_pdfjs_require__(63);
  1982. var max = Math.max;
  1983. var min = Math.min;
  1984. module.exports = function (index, length) {
  1985. var integer = toIntegerOrInfinity(index);
  1986. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  1987. };
  1988. /***/ }),
  1989. /* 63 */
  1990. /***/ ((module) => {
  1991. var ceil = Math.ceil;
  1992. var floor = Math.floor;
  1993. module.exports = function (argument) {
  1994. var number = +argument;
  1995. return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
  1996. };
  1997. /***/ }),
  1998. /* 64 */
  1999. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2000. var toLength = __w_pdfjs_require__(65);
  2001. module.exports = function (obj) {
  2002. return toLength(obj.length);
  2003. };
  2004. /***/ }),
  2005. /* 65 */
  2006. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2007. var toIntegerOrInfinity = __w_pdfjs_require__(63);
  2008. var min = Math.min;
  2009. module.exports = function (argument) {
  2010. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0;
  2011. };
  2012. /***/ }),
  2013. /* 66 */
  2014. /***/ ((module) => {
  2015. module.exports = [
  2016. 'constructor',
  2017. 'hasOwnProperty',
  2018. 'isPrototypeOf',
  2019. 'propertyIsEnumerable',
  2020. 'toLocaleString',
  2021. 'toString',
  2022. 'valueOf'
  2023. ];
  2024. /***/ }),
  2025. /* 67 */
  2026. /***/ ((__unused_webpack_module, exports) => {
  2027. exports.f = Object.getOwnPropertySymbols;
  2028. /***/ }),
  2029. /* 68 */
  2030. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2031. var fails = __w_pdfjs_require__(11);
  2032. var isCallable = __w_pdfjs_require__(24);
  2033. var replacement = /#|\.prototype\./;
  2034. var isForced = function (feature, detection) {
  2035. var value = data[normalize(feature)];
  2036. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  2037. };
  2038. var normalize = isForced.normalize = function (string) {
  2039. return String(string).replace(replacement, '.').toLowerCase();
  2040. };
  2041. var data = isForced.data = {};
  2042. var NATIVE = isForced.NATIVE = 'N';
  2043. var POLYFILL = isForced.POLYFILL = 'P';
  2044. module.exports = isForced;
  2045. /***/ }),
  2046. /* 69 */
  2047. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2048. var global = __w_pdfjs_require__(8);
  2049. var hasOwn = __w_pdfjs_require__(41);
  2050. var isCallable = __w_pdfjs_require__(24);
  2051. var toObject = __w_pdfjs_require__(42);
  2052. var sharedKey = __w_pdfjs_require__(54);
  2053. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(70);
  2054. var IE_PROTO = sharedKey('IE_PROTO');
  2055. var Object = global.Object;
  2056. var ObjectPrototype = Object.prototype;
  2057. module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  2058. var object = toObject(O);
  2059. if (hasOwn(object, IE_PROTO))
  2060. return object[IE_PROTO];
  2061. var constructor = object.constructor;
  2062. if (isCallable(constructor) && object instanceof constructor) {
  2063. return constructor.prototype;
  2064. }
  2065. return object instanceof Object ? ObjectPrototype : null;
  2066. };
  2067. /***/ }),
  2068. /* 70 */
  2069. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2070. var fails = __w_pdfjs_require__(11);
  2071. module.exports = !fails(function () {
  2072. function F() {
  2073. }
  2074. F.prototype.constructor = null;
  2075. return Object.getPrototypeOf(new F()) !== F.prototype;
  2076. });
  2077. /***/ }),
  2078. /* 71 */
  2079. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2080. var uncurryThis = __w_pdfjs_require__(18);
  2081. var anObject = __w_pdfjs_require__(49);
  2082. var aPossiblePrototype = __w_pdfjs_require__(72);
  2083. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? (function () {
  2084. var CORRECT_SETTER = false;
  2085. var test = {};
  2086. var setter;
  2087. try {
  2088. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2089. setter(test, []);
  2090. CORRECT_SETTER = test instanceof Array;
  2091. } catch (error) {
  2092. }
  2093. return function setPrototypeOf(O, proto) {
  2094. anObject(O);
  2095. aPossiblePrototype(proto);
  2096. if (CORRECT_SETTER)
  2097. setter(O, proto);
  2098. else
  2099. O.__proto__ = proto;
  2100. return O;
  2101. };
  2102. }()) : undefined);
  2103. /***/ }),
  2104. /* 72 */
  2105. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2106. var global = __w_pdfjs_require__(8);
  2107. var isCallable = __w_pdfjs_require__(24);
  2108. var String = global.String;
  2109. var TypeError = global.TypeError;
  2110. module.exports = function (argument) {
  2111. if (typeof argument == 'object' || isCallable(argument))
  2112. return argument;
  2113. throw TypeError("Can't set " + String(argument) + ' as a prototype');
  2114. };
  2115. /***/ }),
  2116. /* 73 */
  2117. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2118. var anObject = __w_pdfjs_require__(49);
  2119. var definePropertiesModule = __w_pdfjs_require__(74);
  2120. var enumBugKeys = __w_pdfjs_require__(66);
  2121. var hiddenKeys = __w_pdfjs_require__(55);
  2122. var html = __w_pdfjs_require__(76);
  2123. var documentCreateElement = __w_pdfjs_require__(45);
  2124. var sharedKey = __w_pdfjs_require__(54);
  2125. var GT = '>';
  2126. var LT = '<';
  2127. var PROTOTYPE = 'prototype';
  2128. var SCRIPT = 'script';
  2129. var IE_PROTO = sharedKey('IE_PROTO');
  2130. var EmptyConstructor = function () {
  2131. };
  2132. var scriptTag = function (content) {
  2133. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2134. };
  2135. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2136. activeXDocument.write(scriptTag(''));
  2137. activeXDocument.close();
  2138. var temp = activeXDocument.parentWindow.Object;
  2139. activeXDocument = null;
  2140. return temp;
  2141. };
  2142. var NullProtoObjectViaIFrame = function () {
  2143. var iframe = documentCreateElement('iframe');
  2144. var JS = 'java' + SCRIPT + ':';
  2145. var iframeDocument;
  2146. iframe.style.display = 'none';
  2147. html.appendChild(iframe);
  2148. iframe.src = String(JS);
  2149. iframeDocument = iframe.contentWindow.document;
  2150. iframeDocument.open();
  2151. iframeDocument.write(scriptTag('document.F=Object'));
  2152. iframeDocument.close();
  2153. return iframeDocument.F;
  2154. };
  2155. var activeXDocument;
  2156. var NullProtoObject = function () {
  2157. try {
  2158. activeXDocument = new ActiveXObject('htmlfile');
  2159. } catch (error) {
  2160. }
  2161. NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
  2162. var length = enumBugKeys.length;
  2163. while (length--)
  2164. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2165. return NullProtoObject();
  2166. };
  2167. hiddenKeys[IE_PROTO] = true;
  2168. module.exports = Object.create || function create(O, Properties) {
  2169. var result;
  2170. if (O !== null) {
  2171. EmptyConstructor[PROTOTYPE] = anObject(O);
  2172. result = new EmptyConstructor();
  2173. EmptyConstructor[PROTOTYPE] = null;
  2174. result[IE_PROTO] = O;
  2175. } else
  2176. result = NullProtoObject();
  2177. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  2178. };
  2179. /***/ }),
  2180. /* 74 */
  2181. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2182. var DESCRIPTORS = __w_pdfjs_require__(10);
  2183. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(48);
  2184. var definePropertyModule = __w_pdfjs_require__(47);
  2185. var anObject = __w_pdfjs_require__(49);
  2186. var toIndexedObject = __w_pdfjs_require__(16);
  2187. var objectKeys = __w_pdfjs_require__(75);
  2188. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  2189. anObject(O);
  2190. var props = toIndexedObject(Properties);
  2191. var keys = objectKeys(Properties);
  2192. var length = keys.length;
  2193. var index = 0;
  2194. var key;
  2195. while (length > index)
  2196. definePropertyModule.f(O, key = keys[index++], props[key]);
  2197. return O;
  2198. };
  2199. /***/ }),
  2200. /* 75 */
  2201. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2202. var internalObjectKeys = __w_pdfjs_require__(60);
  2203. var enumBugKeys = __w_pdfjs_require__(66);
  2204. module.exports = Object.keys || function keys(O) {
  2205. return internalObjectKeys(O, enumBugKeys);
  2206. };
  2207. /***/ }),
  2208. /* 76 */
  2209. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2210. var getBuiltIn = __w_pdfjs_require__(26);
  2211. module.exports = getBuiltIn('document', 'documentElement');
  2212. /***/ }),
  2213. /* 77 */
  2214. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2215. var uncurryThis = __w_pdfjs_require__(18);
  2216. var $Error = Error;
  2217. var replace = uncurryThis(''.replace);
  2218. var TEST = function (arg) {
  2219. return String($Error(arg).stack);
  2220. }('zxcasd');
  2221. var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
  2222. var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
  2223. module.exports = function (stack, dropEntries) {
  2224. if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
  2225. while (dropEntries--)
  2226. stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
  2227. }
  2228. return stack;
  2229. };
  2230. /***/ }),
  2231. /* 78 */
  2232. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2233. var isObject = __w_pdfjs_require__(23);
  2234. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  2235. module.exports = function (O, options) {
  2236. if (isObject(options) && 'cause' in options) {
  2237. createNonEnumerableProperty(O, 'cause', options.cause);
  2238. }
  2239. };
  2240. /***/ }),
  2241. /* 79 */
  2242. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2243. var global = __w_pdfjs_require__(8);
  2244. var bind = __w_pdfjs_require__(80);
  2245. var call = __w_pdfjs_require__(12);
  2246. var anObject = __w_pdfjs_require__(49);
  2247. var tryToString = __w_pdfjs_require__(34);
  2248. var isArrayIteratorMethod = __w_pdfjs_require__(81);
  2249. var lengthOfArrayLike = __w_pdfjs_require__(64);
  2250. var isPrototypeOf = __w_pdfjs_require__(27);
  2251. var getIterator = __w_pdfjs_require__(83);
  2252. var getIteratorMethod = __w_pdfjs_require__(84);
  2253. var iteratorClose = __w_pdfjs_require__(87);
  2254. var TypeError = global.TypeError;
  2255. var Result = function (stopped, result) {
  2256. this.stopped = stopped;
  2257. this.result = result;
  2258. };
  2259. var ResultPrototype = Result.prototype;
  2260. module.exports = function (iterable, unboundFunction, options) {
  2261. var that = options && options.that;
  2262. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  2263. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  2264. var INTERRUPTED = !!(options && options.INTERRUPTED);
  2265. var fn = bind(unboundFunction, that);
  2266. var iterator, iterFn, index, length, result, next, step;
  2267. var stop = function (condition) {
  2268. if (iterator)
  2269. iteratorClose(iterator, 'normal', condition);
  2270. return new Result(true, condition);
  2271. };
  2272. var callFn = function (value) {
  2273. if (AS_ENTRIES) {
  2274. anObject(value);
  2275. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  2276. }
  2277. return INTERRUPTED ? fn(value, stop) : fn(value);
  2278. };
  2279. if (IS_ITERATOR) {
  2280. iterator = iterable;
  2281. } else {
  2282. iterFn = getIteratorMethod(iterable);
  2283. if (!iterFn)
  2284. throw TypeError(tryToString(iterable) + ' is not iterable');
  2285. if (isArrayIteratorMethod(iterFn)) {
  2286. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  2287. result = callFn(iterable[index]);
  2288. if (result && isPrototypeOf(ResultPrototype, result))
  2289. return result;
  2290. }
  2291. return new Result(false);
  2292. }
  2293. iterator = getIterator(iterable, iterFn);
  2294. }
  2295. next = iterator.next;
  2296. while (!(step = call(next, iterator)).done) {
  2297. try {
  2298. result = callFn(step.value);
  2299. } catch (error) {
  2300. iteratorClose(iterator, 'throw', error);
  2301. }
  2302. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result))
  2303. return result;
  2304. }
  2305. return new Result(false);
  2306. };
  2307. /***/ }),
  2308. /* 80 */
  2309. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2310. var uncurryThis = __w_pdfjs_require__(18);
  2311. var aCallable = __w_pdfjs_require__(33);
  2312. var NATIVE_BIND = __w_pdfjs_require__(13);
  2313. var bind = uncurryThis(uncurryThis.bind);
  2314. module.exports = function (fn, that) {
  2315. aCallable(fn);
  2316. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function () {
  2317. return fn.apply(that, arguments);
  2318. };
  2319. };
  2320. /***/ }),
  2321. /* 81 */
  2322. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2323. var wellKnownSymbol = __w_pdfjs_require__(36);
  2324. var Iterators = __w_pdfjs_require__(82);
  2325. var ITERATOR = wellKnownSymbol('iterator');
  2326. var ArrayPrototype = Array.prototype;
  2327. module.exports = function (it) {
  2328. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  2329. };
  2330. /***/ }),
  2331. /* 82 */
  2332. /***/ ((module) => {
  2333. module.exports = {};
  2334. /***/ }),
  2335. /* 83 */
  2336. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2337. var global = __w_pdfjs_require__(8);
  2338. var call = __w_pdfjs_require__(12);
  2339. var aCallable = __w_pdfjs_require__(33);
  2340. var anObject = __w_pdfjs_require__(49);
  2341. var tryToString = __w_pdfjs_require__(34);
  2342. var getIteratorMethod = __w_pdfjs_require__(84);
  2343. var TypeError = global.TypeError;
  2344. module.exports = function (argument, usingIterator) {
  2345. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  2346. if (aCallable(iteratorMethod))
  2347. return anObject(call(iteratorMethod, argument));
  2348. throw TypeError(tryToString(argument) + ' is not iterable');
  2349. };
  2350. /***/ }),
  2351. /* 84 */
  2352. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2353. var classof = __w_pdfjs_require__(85);
  2354. var getMethod = __w_pdfjs_require__(32);
  2355. var Iterators = __w_pdfjs_require__(82);
  2356. var wellKnownSymbol = __w_pdfjs_require__(36);
  2357. var ITERATOR = wellKnownSymbol('iterator');
  2358. module.exports = function (it) {
  2359. if (it != undefined)
  2360. return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];
  2361. };
  2362. /***/ }),
  2363. /* 85 */
  2364. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2365. var global = __w_pdfjs_require__(8);
  2366. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(86);
  2367. var isCallable = __w_pdfjs_require__(24);
  2368. var classofRaw = __w_pdfjs_require__(19);
  2369. var wellKnownSymbol = __w_pdfjs_require__(36);
  2370. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2371. var Object = global.Object;
  2372. var CORRECT_ARGUMENTS = classofRaw((function () {
  2373. return arguments;
  2374. }())) == 'Arguments';
  2375. var tryGet = function (it, key) {
  2376. try {
  2377. return it[key];
  2378. } catch (error) {
  2379. }
  2380. };
  2381. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  2382. var O, tag, result;
  2383. return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  2384. };
  2385. /***/ }),
  2386. /* 86 */
  2387. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2388. var wellKnownSymbol = __w_pdfjs_require__(36);
  2389. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2390. var test = {};
  2391. test[TO_STRING_TAG] = 'z';
  2392. module.exports = String(test) === '[object z]';
  2393. /***/ }),
  2394. /* 87 */
  2395. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2396. var call = __w_pdfjs_require__(12);
  2397. var anObject = __w_pdfjs_require__(49);
  2398. var getMethod = __w_pdfjs_require__(32);
  2399. module.exports = function (iterator, kind, value) {
  2400. var innerResult, innerError;
  2401. anObject(iterator);
  2402. try {
  2403. innerResult = getMethod(iterator, 'return');
  2404. if (!innerResult) {
  2405. if (kind === 'throw')
  2406. throw value;
  2407. return value;
  2408. }
  2409. innerResult = call(innerResult, iterator);
  2410. } catch (error) {
  2411. innerError = true;
  2412. innerResult = error;
  2413. }
  2414. if (kind === 'throw')
  2415. throw value;
  2416. if (innerError)
  2417. throw innerResult;
  2418. anObject(innerResult);
  2419. return value;
  2420. };
  2421. /***/ }),
  2422. /* 88 */
  2423. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2424. var toString = __w_pdfjs_require__(89);
  2425. module.exports = function (argument, $default) {
  2426. return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
  2427. };
  2428. /***/ }),
  2429. /* 89 */
  2430. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2431. var global = __w_pdfjs_require__(8);
  2432. var classof = __w_pdfjs_require__(85);
  2433. var String = global.String;
  2434. module.exports = function (argument) {
  2435. if (classof(argument) === 'Symbol')
  2436. throw TypeError('Cannot convert a Symbol value to a string');
  2437. return String(argument);
  2438. };
  2439. /***/ }),
  2440. /* 90 */
  2441. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2442. var fails = __w_pdfjs_require__(11);
  2443. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2444. module.exports = !fails(function () {
  2445. var error = Error('a');
  2446. if (!('stack' in error))
  2447. return true;
  2448. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  2449. return error.stack !== 7;
  2450. });
  2451. /***/ }),
  2452. /* 91 */
  2453. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2454. "use strict";
  2455. var toIndexedObject = __w_pdfjs_require__(16);
  2456. var addToUnscopables = __w_pdfjs_require__(92);
  2457. var Iterators = __w_pdfjs_require__(82);
  2458. var InternalStateModule = __w_pdfjs_require__(52);
  2459. var defineProperty = (__w_pdfjs_require__(47).f);
  2460. var defineIterator = __w_pdfjs_require__(93);
  2461. var IS_PURE = __w_pdfjs_require__(38);
  2462. var DESCRIPTORS = __w_pdfjs_require__(10);
  2463. var ARRAY_ITERATOR = 'Array Iterator';
  2464. var setInternalState = InternalStateModule.set;
  2465. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  2466. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  2467. setInternalState(this, {
  2468. type: ARRAY_ITERATOR,
  2469. target: toIndexedObject(iterated),
  2470. index: 0,
  2471. kind: kind
  2472. });
  2473. }, function () {
  2474. var state = getInternalState(this);
  2475. var target = state.target;
  2476. var kind = state.kind;
  2477. var index = state.index++;
  2478. if (!target || index >= target.length) {
  2479. state.target = undefined;
  2480. return {
  2481. value: undefined,
  2482. done: true
  2483. };
  2484. }
  2485. if (kind == 'keys')
  2486. return {
  2487. value: index,
  2488. done: false
  2489. };
  2490. if (kind == 'values')
  2491. return {
  2492. value: target[index],
  2493. done: false
  2494. };
  2495. return {
  2496. value: [
  2497. index,
  2498. target[index]
  2499. ],
  2500. done: false
  2501. };
  2502. }, 'values');
  2503. var values = Iterators.Arguments = Iterators.Array;
  2504. addToUnscopables('keys');
  2505. addToUnscopables('values');
  2506. addToUnscopables('entries');
  2507. if (!IS_PURE && DESCRIPTORS && values.name !== 'values')
  2508. try {
  2509. defineProperty(values, 'name', { value: 'values' });
  2510. } catch (error) {
  2511. }
  2512. /***/ }),
  2513. /* 92 */
  2514. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2515. var wellKnownSymbol = __w_pdfjs_require__(36);
  2516. var create = __w_pdfjs_require__(73);
  2517. var definePropertyModule = __w_pdfjs_require__(47);
  2518. var UNSCOPABLES = wellKnownSymbol('unscopables');
  2519. var ArrayPrototype = Array.prototype;
  2520. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  2521. definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
  2522. configurable: true,
  2523. value: create(null)
  2524. });
  2525. }
  2526. module.exports = function (key) {
  2527. ArrayPrototype[UNSCOPABLES][key] = true;
  2528. };
  2529. /***/ }),
  2530. /* 93 */
  2531. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2532. "use strict";
  2533. var $ = __w_pdfjs_require__(7);
  2534. var call = __w_pdfjs_require__(12);
  2535. var IS_PURE = __w_pdfjs_require__(38);
  2536. var FunctionName = __w_pdfjs_require__(56);
  2537. var isCallable = __w_pdfjs_require__(24);
  2538. var createIteratorConstructor = __w_pdfjs_require__(94);
  2539. var getPrototypeOf = __w_pdfjs_require__(69);
  2540. var setPrototypeOf = __w_pdfjs_require__(71);
  2541. var setToStringTag = __w_pdfjs_require__(96);
  2542. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  2543. var redefine = __w_pdfjs_require__(50);
  2544. var wellKnownSymbol = __w_pdfjs_require__(36);
  2545. var Iterators = __w_pdfjs_require__(82);
  2546. var IteratorsCore = __w_pdfjs_require__(95);
  2547. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  2548. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  2549. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  2550. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  2551. var ITERATOR = wellKnownSymbol('iterator');
  2552. var KEYS = 'keys';
  2553. var VALUES = 'values';
  2554. var ENTRIES = 'entries';
  2555. var returnThis = function () {
  2556. return this;
  2557. };
  2558. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  2559. createIteratorConstructor(IteratorConstructor, NAME, next);
  2560. var getIterationMethod = function (KIND) {
  2561. if (KIND === DEFAULT && defaultIterator)
  2562. return defaultIterator;
  2563. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  2564. return IterablePrototype[KIND];
  2565. switch (KIND) {
  2566. case KEYS:
  2567. return function keys() {
  2568. return new IteratorConstructor(this, KIND);
  2569. };
  2570. case VALUES:
  2571. return function values() {
  2572. return new IteratorConstructor(this, KIND);
  2573. };
  2574. case ENTRIES:
  2575. return function entries() {
  2576. return new IteratorConstructor(this, KIND);
  2577. };
  2578. }
  2579. return function () {
  2580. return new IteratorConstructor(this);
  2581. };
  2582. };
  2583. var TO_STRING_TAG = NAME + ' Iterator';
  2584. var INCORRECT_VALUES_NAME = false;
  2585. var IterablePrototype = Iterable.prototype;
  2586. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  2587. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  2588. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  2589. var CurrentIteratorPrototype, methods, KEY;
  2590. if (anyNativeIterator) {
  2591. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  2592. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  2593. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  2594. if (setPrototypeOf) {
  2595. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  2596. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  2597. redefine(CurrentIteratorPrototype, ITERATOR, returnThis);
  2598. }
  2599. }
  2600. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  2601. if (IS_PURE)
  2602. Iterators[TO_STRING_TAG] = returnThis;
  2603. }
  2604. }
  2605. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  2606. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  2607. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  2608. } else {
  2609. INCORRECT_VALUES_NAME = true;
  2610. defaultIterator = function values() {
  2611. return call(nativeIterator, this);
  2612. };
  2613. }
  2614. }
  2615. if (DEFAULT) {
  2616. methods = {
  2617. values: getIterationMethod(VALUES),
  2618. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  2619. entries: getIterationMethod(ENTRIES)
  2620. };
  2621. if (FORCED)
  2622. for (KEY in methods) {
  2623. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  2624. redefine(IterablePrototype, KEY, methods[KEY]);
  2625. }
  2626. }
  2627. else
  2628. $({
  2629. target: NAME,
  2630. proto: true,
  2631. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  2632. }, methods);
  2633. }
  2634. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  2635. redefine(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  2636. }
  2637. Iterators[NAME] = defaultIterator;
  2638. return methods;
  2639. };
  2640. /***/ }),
  2641. /* 94 */
  2642. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2643. "use strict";
  2644. var IteratorPrototype = (__w_pdfjs_require__(95).IteratorPrototype);
  2645. var create = __w_pdfjs_require__(73);
  2646. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2647. var setToStringTag = __w_pdfjs_require__(96);
  2648. var Iterators = __w_pdfjs_require__(82);
  2649. var returnThis = function () {
  2650. return this;
  2651. };
  2652. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  2653. var TO_STRING_TAG = NAME + ' Iterator';
  2654. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  2655. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  2656. Iterators[TO_STRING_TAG] = returnThis;
  2657. return IteratorConstructor;
  2658. };
  2659. /***/ }),
  2660. /* 95 */
  2661. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2662. "use strict";
  2663. var fails = __w_pdfjs_require__(11);
  2664. var isCallable = __w_pdfjs_require__(24);
  2665. var create = __w_pdfjs_require__(73);
  2666. var getPrototypeOf = __w_pdfjs_require__(69);
  2667. var redefine = __w_pdfjs_require__(50);
  2668. var wellKnownSymbol = __w_pdfjs_require__(36);
  2669. var IS_PURE = __w_pdfjs_require__(38);
  2670. var ITERATOR = wellKnownSymbol('iterator');
  2671. var BUGGY_SAFARI_ITERATORS = false;
  2672. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  2673. if ([].keys) {
  2674. arrayIterator = [].keys();
  2675. if (!('next' in arrayIterator))
  2676. BUGGY_SAFARI_ITERATORS = true;
  2677. else {
  2678. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  2679. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  2680. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  2681. }
  2682. }
  2683. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
  2684. var test = {};
  2685. return IteratorPrototype[ITERATOR].call(test) !== test;
  2686. });
  2687. if (NEW_ITERATOR_PROTOTYPE)
  2688. IteratorPrototype = {};
  2689. else if (IS_PURE)
  2690. IteratorPrototype = create(IteratorPrototype);
  2691. if (!isCallable(IteratorPrototype[ITERATOR])) {
  2692. redefine(IteratorPrototype, ITERATOR, function () {
  2693. return this;
  2694. });
  2695. }
  2696. module.exports = {
  2697. IteratorPrototype: IteratorPrototype,
  2698. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  2699. };
  2700. /***/ }),
  2701. /* 96 */
  2702. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2703. var defineProperty = (__w_pdfjs_require__(47).f);
  2704. var hasOwn = __w_pdfjs_require__(41);
  2705. var wellKnownSymbol = __w_pdfjs_require__(36);
  2706. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2707. module.exports = function (target, TAG, STATIC) {
  2708. if (target && !STATIC)
  2709. target = target.prototype;
  2710. if (target && !hasOwn(target, TO_STRING_TAG)) {
  2711. defineProperty(target, TO_STRING_TAG, {
  2712. configurable: true,
  2713. value: TAG
  2714. });
  2715. }
  2716. };
  2717. /***/ }),
  2718. /* 97 */
  2719. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2720. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(86);
  2721. var redefine = __w_pdfjs_require__(50);
  2722. var toString = __w_pdfjs_require__(98);
  2723. if (!TO_STRING_TAG_SUPPORT) {
  2724. redefine(Object.prototype, 'toString', toString, { unsafe: true });
  2725. }
  2726. /***/ }),
  2727. /* 98 */
  2728. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2729. "use strict";
  2730. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(86);
  2731. var classof = __w_pdfjs_require__(85);
  2732. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  2733. return '[object ' + classof(this) + ']';
  2734. };
  2735. /***/ }),
  2736. /* 99 */
  2737. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2738. __w_pdfjs_require__(100);
  2739. __w_pdfjs_require__(123);
  2740. __w_pdfjs_require__(126);
  2741. __w_pdfjs_require__(127);
  2742. __w_pdfjs_require__(128);
  2743. __w_pdfjs_require__(129);
  2744. /***/ }),
  2745. /* 100 */
  2746. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2747. "use strict";
  2748. var $ = __w_pdfjs_require__(7);
  2749. var IS_PURE = __w_pdfjs_require__(38);
  2750. var IS_NODE = __w_pdfjs_require__(101);
  2751. var global = __w_pdfjs_require__(8);
  2752. var call = __w_pdfjs_require__(12);
  2753. var redefine = __w_pdfjs_require__(50);
  2754. var redefineAll = __w_pdfjs_require__(102);
  2755. var setPrototypeOf = __w_pdfjs_require__(71);
  2756. var setToStringTag = __w_pdfjs_require__(96);
  2757. var setSpecies = __w_pdfjs_require__(103);
  2758. var aCallable = __w_pdfjs_require__(33);
  2759. var isCallable = __w_pdfjs_require__(24);
  2760. var isObject = __w_pdfjs_require__(23);
  2761. var anInstance = __w_pdfjs_require__(104);
  2762. var speciesConstructor = __w_pdfjs_require__(105);
  2763. var task = (__w_pdfjs_require__(108).set);
  2764. var microtask = __w_pdfjs_require__(113);
  2765. var hostReportErrors = __w_pdfjs_require__(116);
  2766. var perform = __w_pdfjs_require__(117);
  2767. var Queue = __w_pdfjs_require__(118);
  2768. var InternalStateModule = __w_pdfjs_require__(52);
  2769. var NativePromiseConstructor = __w_pdfjs_require__(119);
  2770. var PromiseConstructorDetection = __w_pdfjs_require__(120);
  2771. var newPromiseCapabilityModule = __w_pdfjs_require__(122);
  2772. var PROMISE = 'Promise';
  2773. var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
  2774. var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
  2775. var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
  2776. var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
  2777. var setInternalState = InternalStateModule.set;
  2778. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  2779. var PromiseConstructor = NativePromiseConstructor;
  2780. var PromisePrototype = NativePromisePrototype;
  2781. var TypeError = global.TypeError;
  2782. var document = global.document;
  2783. var process = global.process;
  2784. var newPromiseCapability = newPromiseCapabilityModule.f;
  2785. var newGenericPromiseCapability = newPromiseCapability;
  2786. var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
  2787. var UNHANDLED_REJECTION = 'unhandledrejection';
  2788. var REJECTION_HANDLED = 'rejectionhandled';
  2789. var PENDING = 0;
  2790. var FULFILLED = 1;
  2791. var REJECTED = 2;
  2792. var HANDLED = 1;
  2793. var UNHANDLED = 2;
  2794. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  2795. var isThenable = function (it) {
  2796. var then;
  2797. return isObject(it) && isCallable(then = it.then) ? then : false;
  2798. };
  2799. var callReaction = function (reaction, state) {
  2800. var value = state.value;
  2801. var ok = state.state == FULFILLED;
  2802. var handler = ok ? reaction.ok : reaction.fail;
  2803. var resolve = reaction.resolve;
  2804. var reject = reaction.reject;
  2805. var domain = reaction.domain;
  2806. var result, then, exited;
  2807. try {
  2808. if (handler) {
  2809. if (!ok) {
  2810. if (state.rejection === UNHANDLED)
  2811. onHandleUnhandled(state);
  2812. state.rejection = HANDLED;
  2813. }
  2814. if (handler === true)
  2815. result = value;
  2816. else {
  2817. if (domain)
  2818. domain.enter();
  2819. result = handler(value);
  2820. if (domain) {
  2821. domain.exit();
  2822. exited = true;
  2823. }
  2824. }
  2825. if (result === reaction.promise) {
  2826. reject(TypeError('Promise-chain cycle'));
  2827. } else if (then = isThenable(result)) {
  2828. call(then, result, resolve, reject);
  2829. } else
  2830. resolve(result);
  2831. } else
  2832. reject(value);
  2833. } catch (error) {
  2834. if (domain && !exited)
  2835. domain.exit();
  2836. reject(error);
  2837. }
  2838. };
  2839. var notify = function (state, isReject) {
  2840. if (state.notified)
  2841. return;
  2842. state.notified = true;
  2843. microtask(function () {
  2844. var reactions = state.reactions;
  2845. var reaction;
  2846. while (reaction = reactions.get()) {
  2847. callReaction(reaction, state);
  2848. }
  2849. state.notified = false;
  2850. if (isReject && !state.rejection)
  2851. onUnhandled(state);
  2852. });
  2853. };
  2854. var dispatchEvent = function (name, promise, reason) {
  2855. var event, handler;
  2856. if (DISPATCH_EVENT) {
  2857. event = document.createEvent('Event');
  2858. event.promise = promise;
  2859. event.reason = reason;
  2860. event.initEvent(name, false, true);
  2861. global.dispatchEvent(event);
  2862. } else
  2863. event = {
  2864. promise: promise,
  2865. reason: reason
  2866. };
  2867. if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name]))
  2868. handler(event);
  2869. else if (name === UNHANDLED_REJECTION)
  2870. hostReportErrors('Unhandled promise rejection', reason);
  2871. };
  2872. var onUnhandled = function (state) {
  2873. call(task, global, function () {
  2874. var promise = state.facade;
  2875. var value = state.value;
  2876. var IS_UNHANDLED = isUnhandled(state);
  2877. var result;
  2878. if (IS_UNHANDLED) {
  2879. result = perform(function () {
  2880. if (IS_NODE) {
  2881. process.emit('unhandledRejection', value, promise);
  2882. } else
  2883. dispatchEvent(UNHANDLED_REJECTION, promise, value);
  2884. });
  2885. state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
  2886. if (result.error)
  2887. throw result.value;
  2888. }
  2889. });
  2890. };
  2891. var isUnhandled = function (state) {
  2892. return state.rejection !== HANDLED && !state.parent;
  2893. };
  2894. var onHandleUnhandled = function (state) {
  2895. call(task, global, function () {
  2896. var promise = state.facade;
  2897. if (IS_NODE) {
  2898. process.emit('rejectionHandled', promise);
  2899. } else
  2900. dispatchEvent(REJECTION_HANDLED, promise, state.value);
  2901. });
  2902. };
  2903. var bind = function (fn, state, unwrap) {
  2904. return function (value) {
  2905. fn(state, value, unwrap);
  2906. };
  2907. };
  2908. var internalReject = function (state, value, unwrap) {
  2909. if (state.done)
  2910. return;
  2911. state.done = true;
  2912. if (unwrap)
  2913. state = unwrap;
  2914. state.value = value;
  2915. state.state = REJECTED;
  2916. notify(state, true);
  2917. };
  2918. var internalResolve = function (state, value, unwrap) {
  2919. if (state.done)
  2920. return;
  2921. state.done = true;
  2922. if (unwrap)
  2923. state = unwrap;
  2924. try {
  2925. if (state.facade === value)
  2926. throw TypeError("Promise can't be resolved itself");
  2927. var then = isThenable(value);
  2928. if (then) {
  2929. microtask(function () {
  2930. var wrapper = { done: false };
  2931. try {
  2932. call(then, value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state));
  2933. } catch (error) {
  2934. internalReject(wrapper, error, state);
  2935. }
  2936. });
  2937. } else {
  2938. state.value = value;
  2939. state.state = FULFILLED;
  2940. notify(state, false);
  2941. }
  2942. } catch (error) {
  2943. internalReject({ done: false }, error, state);
  2944. }
  2945. };
  2946. if (FORCED_PROMISE_CONSTRUCTOR) {
  2947. PromiseConstructor = function Promise(executor) {
  2948. anInstance(this, PromisePrototype);
  2949. aCallable(executor);
  2950. call(Internal, this);
  2951. var state = getInternalPromiseState(this);
  2952. try {
  2953. executor(bind(internalResolve, state), bind(internalReject, state));
  2954. } catch (error) {
  2955. internalReject(state, error);
  2956. }
  2957. };
  2958. PromisePrototype = PromiseConstructor.prototype;
  2959. Internal = function Promise(executor) {
  2960. setInternalState(this, {
  2961. type: PROMISE,
  2962. done: false,
  2963. notified: false,
  2964. parent: false,
  2965. reactions: new Queue(),
  2966. rejection: false,
  2967. state: PENDING,
  2968. value: undefined
  2969. });
  2970. };
  2971. Internal.prototype = redefineAll(PromisePrototype, {
  2972. then: function then(onFulfilled, onRejected) {
  2973. var state = getInternalPromiseState(this);
  2974. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  2975. state.parent = true;
  2976. reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
  2977. reaction.fail = isCallable(onRejected) && onRejected;
  2978. reaction.domain = IS_NODE ? process.domain : undefined;
  2979. if (state.state == PENDING)
  2980. state.reactions.add(reaction);
  2981. else
  2982. microtask(function () {
  2983. callReaction(reaction, state);
  2984. });
  2985. return reaction.promise;
  2986. }
  2987. });
  2988. OwnPromiseCapability = function () {
  2989. var promise = new Internal();
  2990. var state = getInternalPromiseState(promise);
  2991. this.promise = promise;
  2992. this.resolve = bind(internalResolve, state);
  2993. this.reject = bind(internalReject, state);
  2994. };
  2995. newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
  2996. return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
  2997. };
  2998. if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
  2999. nativeThen = NativePromisePrototype.then;
  3000. if (!NATIVE_PROMISE_SUBCLASSING) {
  3001. redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
  3002. var that = this;
  3003. return new PromiseConstructor(function (resolve, reject) {
  3004. call(nativeThen, that, resolve, reject);
  3005. }).then(onFulfilled, onRejected);
  3006. }, { unsafe: true });
  3007. }
  3008. try {
  3009. delete NativePromisePrototype.constructor;
  3010. } catch (error) {
  3011. }
  3012. if (setPrototypeOf) {
  3013. setPrototypeOf(NativePromisePrototype, PromisePrototype);
  3014. }
  3015. }
  3016. }
  3017. $({
  3018. global: true,
  3019. wrap: true,
  3020. forced: FORCED_PROMISE_CONSTRUCTOR
  3021. }, { Promise: PromiseConstructor });
  3022. setToStringTag(PromiseConstructor, PROMISE, false, true);
  3023. setSpecies(PROMISE);
  3024. /***/ }),
  3025. /* 101 */
  3026. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3027. var classof = __w_pdfjs_require__(19);
  3028. var global = __w_pdfjs_require__(8);
  3029. module.exports = classof(global.process) == 'process';
  3030. /***/ }),
  3031. /* 102 */
  3032. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3033. var redefine = __w_pdfjs_require__(50);
  3034. module.exports = function (target, src, options) {
  3035. for (var key in src)
  3036. redefine(target, key, src[key], options);
  3037. return target;
  3038. };
  3039. /***/ }),
  3040. /* 103 */
  3041. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3042. "use strict";
  3043. var getBuiltIn = __w_pdfjs_require__(26);
  3044. var definePropertyModule = __w_pdfjs_require__(47);
  3045. var wellKnownSymbol = __w_pdfjs_require__(36);
  3046. var DESCRIPTORS = __w_pdfjs_require__(10);
  3047. var SPECIES = wellKnownSymbol('species');
  3048. module.exports = function (CONSTRUCTOR_NAME) {
  3049. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  3050. var defineProperty = definePropertyModule.f;
  3051. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  3052. defineProperty(Constructor, SPECIES, {
  3053. configurable: true,
  3054. get: function () {
  3055. return this;
  3056. }
  3057. });
  3058. }
  3059. };
  3060. /***/ }),
  3061. /* 104 */
  3062. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3063. var global = __w_pdfjs_require__(8);
  3064. var isPrototypeOf = __w_pdfjs_require__(27);
  3065. var TypeError = global.TypeError;
  3066. module.exports = function (it, Prototype) {
  3067. if (isPrototypeOf(Prototype, it))
  3068. return it;
  3069. throw TypeError('Incorrect invocation');
  3070. };
  3071. /***/ }),
  3072. /* 105 */
  3073. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3074. var anObject = __w_pdfjs_require__(49);
  3075. var aConstructor = __w_pdfjs_require__(106);
  3076. var wellKnownSymbol = __w_pdfjs_require__(36);
  3077. var SPECIES = wellKnownSymbol('species');
  3078. module.exports = function (O, defaultConstructor) {
  3079. var C = anObject(O).constructor;
  3080. var S;
  3081. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
  3082. };
  3083. /***/ }),
  3084. /* 106 */
  3085. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3086. var global = __w_pdfjs_require__(8);
  3087. var isConstructor = __w_pdfjs_require__(107);
  3088. var tryToString = __w_pdfjs_require__(34);
  3089. var TypeError = global.TypeError;
  3090. module.exports = function (argument) {
  3091. if (isConstructor(argument))
  3092. return argument;
  3093. throw TypeError(tryToString(argument) + ' is not a constructor');
  3094. };
  3095. /***/ }),
  3096. /* 107 */
  3097. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3098. var uncurryThis = __w_pdfjs_require__(18);
  3099. var fails = __w_pdfjs_require__(11);
  3100. var isCallable = __w_pdfjs_require__(24);
  3101. var classof = __w_pdfjs_require__(85);
  3102. var getBuiltIn = __w_pdfjs_require__(26);
  3103. var inspectSource = __w_pdfjs_require__(51);
  3104. var noop = function () {
  3105. };
  3106. var empty = [];
  3107. var construct = getBuiltIn('Reflect', 'construct');
  3108. var constructorRegExp = /^\s*(?:class|function)\b/;
  3109. var exec = uncurryThis(constructorRegExp.exec);
  3110. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  3111. var isConstructorModern = function isConstructor(argument) {
  3112. if (!isCallable(argument))
  3113. return false;
  3114. try {
  3115. construct(noop, empty, argument);
  3116. return true;
  3117. } catch (error) {
  3118. return false;
  3119. }
  3120. };
  3121. var isConstructorLegacy = function isConstructor(argument) {
  3122. if (!isCallable(argument))
  3123. return false;
  3124. switch (classof(argument)) {
  3125. case 'AsyncFunction':
  3126. case 'GeneratorFunction':
  3127. case 'AsyncGeneratorFunction':
  3128. return false;
  3129. }
  3130. try {
  3131. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  3132. } catch (error) {
  3133. return true;
  3134. }
  3135. };
  3136. isConstructorLegacy.sham = true;
  3137. module.exports = !construct || fails(function () {
  3138. var called;
  3139. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
  3140. called = true;
  3141. }) || called;
  3142. }) ? isConstructorLegacy : isConstructorModern;
  3143. /***/ }),
  3144. /* 108 */
  3145. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3146. var global = __w_pdfjs_require__(8);
  3147. var apply = __w_pdfjs_require__(109);
  3148. var bind = __w_pdfjs_require__(80);
  3149. var isCallable = __w_pdfjs_require__(24);
  3150. var hasOwn = __w_pdfjs_require__(41);
  3151. var fails = __w_pdfjs_require__(11);
  3152. var html = __w_pdfjs_require__(76);
  3153. var arraySlice = __w_pdfjs_require__(110);
  3154. var createElement = __w_pdfjs_require__(45);
  3155. var validateArgumentsLength = __w_pdfjs_require__(111);
  3156. var IS_IOS = __w_pdfjs_require__(112);
  3157. var IS_NODE = __w_pdfjs_require__(101);
  3158. var set = global.setImmediate;
  3159. var clear = global.clearImmediate;
  3160. var process = global.process;
  3161. var Dispatch = global.Dispatch;
  3162. var Function = global.Function;
  3163. var MessageChannel = global.MessageChannel;
  3164. var String = global.String;
  3165. var counter = 0;
  3166. var queue = {};
  3167. var ONREADYSTATECHANGE = 'onreadystatechange';
  3168. var location, defer, channel, port;
  3169. try {
  3170. location = global.location;
  3171. } catch (error) {
  3172. }
  3173. var run = function (id) {
  3174. if (hasOwn(queue, id)) {
  3175. var fn = queue[id];
  3176. delete queue[id];
  3177. fn();
  3178. }
  3179. };
  3180. var runner = function (id) {
  3181. return function () {
  3182. run(id);
  3183. };
  3184. };
  3185. var listener = function (event) {
  3186. run(event.data);
  3187. };
  3188. var post = function (id) {
  3189. global.postMessage(String(id), location.protocol + '//' + location.host);
  3190. };
  3191. if (!set || !clear) {
  3192. set = function setImmediate(handler) {
  3193. validateArgumentsLength(arguments.length, 1);
  3194. var fn = isCallable(handler) ? handler : Function(handler);
  3195. var args = arraySlice(arguments, 1);
  3196. queue[++counter] = function () {
  3197. apply(fn, undefined, args);
  3198. };
  3199. defer(counter);
  3200. return counter;
  3201. };
  3202. clear = function clearImmediate(id) {
  3203. delete queue[id];
  3204. };
  3205. if (IS_NODE) {
  3206. defer = function (id) {
  3207. process.nextTick(runner(id));
  3208. };
  3209. } else if (Dispatch && Dispatch.now) {
  3210. defer = function (id) {
  3211. Dispatch.now(runner(id));
  3212. };
  3213. } else if (MessageChannel && !IS_IOS) {
  3214. channel = new MessageChannel();
  3215. port = channel.port2;
  3216. channel.port1.onmessage = listener;
  3217. defer = bind(port.postMessage, port);
  3218. } else if (global.addEventListener && isCallable(global.postMessage) && !global.importScripts && location && location.protocol !== 'file:' && !fails(post)) {
  3219. defer = post;
  3220. global.addEventListener('message', listener, false);
  3221. } else if (ONREADYSTATECHANGE in createElement('script')) {
  3222. defer = function (id) {
  3223. html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
  3224. html.removeChild(this);
  3225. run(id);
  3226. };
  3227. };
  3228. } else {
  3229. defer = function (id) {
  3230. setTimeout(runner(id), 0);
  3231. };
  3232. }
  3233. }
  3234. module.exports = {
  3235. set: set,
  3236. clear: clear
  3237. };
  3238. /***/ }),
  3239. /* 109 */
  3240. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3241. var NATIVE_BIND = __w_pdfjs_require__(13);
  3242. var FunctionPrototype = Function.prototype;
  3243. var apply = FunctionPrototype.apply;
  3244. var call = FunctionPrototype.call;
  3245. module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
  3246. return call.apply(apply, arguments);
  3247. });
  3248. /***/ }),
  3249. /* 110 */
  3250. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3251. var uncurryThis = __w_pdfjs_require__(18);
  3252. module.exports = uncurryThis([].slice);
  3253. /***/ }),
  3254. /* 111 */
  3255. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3256. var global = __w_pdfjs_require__(8);
  3257. var TypeError = global.TypeError;
  3258. module.exports = function (passed, required) {
  3259. if (passed < required)
  3260. throw TypeError('Not enough arguments');
  3261. return passed;
  3262. };
  3263. /***/ }),
  3264. /* 112 */
  3265. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3266. var userAgent = __w_pdfjs_require__(31);
  3267. module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
  3268. /***/ }),
  3269. /* 113 */
  3270. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3271. var global = __w_pdfjs_require__(8);
  3272. var bind = __w_pdfjs_require__(80);
  3273. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  3274. var macrotask = (__w_pdfjs_require__(108).set);
  3275. var IS_IOS = __w_pdfjs_require__(112);
  3276. var IS_IOS_PEBBLE = __w_pdfjs_require__(114);
  3277. var IS_WEBOS_WEBKIT = __w_pdfjs_require__(115);
  3278. var IS_NODE = __w_pdfjs_require__(101);
  3279. var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
  3280. var document = global.document;
  3281. var process = global.process;
  3282. var Promise = global.Promise;
  3283. var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
  3284. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  3285. var flush, head, last, notify, toggle, node, promise, then;
  3286. if (!queueMicrotask) {
  3287. flush = function () {
  3288. var parent, fn;
  3289. if (IS_NODE && (parent = process.domain))
  3290. parent.exit();
  3291. while (head) {
  3292. fn = head.fn;
  3293. head = head.next;
  3294. try {
  3295. fn();
  3296. } catch (error) {
  3297. if (head)
  3298. notify();
  3299. else
  3300. last = undefined;
  3301. throw error;
  3302. }
  3303. }
  3304. last = undefined;
  3305. if (parent)
  3306. parent.enter();
  3307. };
  3308. if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
  3309. toggle = true;
  3310. node = document.createTextNode('');
  3311. new MutationObserver(flush).observe(node, { characterData: true });
  3312. notify = function () {
  3313. node.data = toggle = !toggle;
  3314. };
  3315. } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
  3316. promise = Promise.resolve(undefined);
  3317. promise.constructor = Promise;
  3318. then = bind(promise.then, promise);
  3319. notify = function () {
  3320. then(flush);
  3321. };
  3322. } else if (IS_NODE) {
  3323. notify = function () {
  3324. process.nextTick(flush);
  3325. };
  3326. } else {
  3327. macrotask = bind(macrotask, global);
  3328. notify = function () {
  3329. macrotask(flush);
  3330. };
  3331. }
  3332. }
  3333. module.exports = queueMicrotask || function (fn) {
  3334. var task = {
  3335. fn: fn,
  3336. next: undefined
  3337. };
  3338. if (last)
  3339. last.next = task;
  3340. if (!head) {
  3341. head = task;
  3342. notify();
  3343. }
  3344. last = task;
  3345. };
  3346. /***/ }),
  3347. /* 114 */
  3348. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3349. var userAgent = __w_pdfjs_require__(31);
  3350. var global = __w_pdfjs_require__(8);
  3351. module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
  3352. /***/ }),
  3353. /* 115 */
  3354. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3355. var userAgent = __w_pdfjs_require__(31);
  3356. module.exports = /web0s(?!.*chrome)/i.test(userAgent);
  3357. /***/ }),
  3358. /* 116 */
  3359. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3360. var global = __w_pdfjs_require__(8);
  3361. module.exports = function (a, b) {
  3362. var console = global.console;
  3363. if (console && console.error) {
  3364. arguments.length == 1 ? console.error(a) : console.error(a, b);
  3365. }
  3366. };
  3367. /***/ }),
  3368. /* 117 */
  3369. /***/ ((module) => {
  3370. module.exports = function (exec) {
  3371. try {
  3372. return {
  3373. error: false,
  3374. value: exec()
  3375. };
  3376. } catch (error) {
  3377. return {
  3378. error: true,
  3379. value: error
  3380. };
  3381. }
  3382. };
  3383. /***/ }),
  3384. /* 118 */
  3385. /***/ ((module) => {
  3386. var Queue = function () {
  3387. this.head = null;
  3388. this.tail = null;
  3389. };
  3390. Queue.prototype = {
  3391. add: function (item) {
  3392. var entry = {
  3393. item: item,
  3394. next: null
  3395. };
  3396. if (this.head)
  3397. this.tail.next = entry;
  3398. else
  3399. this.head = entry;
  3400. this.tail = entry;
  3401. },
  3402. get: function () {
  3403. var entry = this.head;
  3404. if (entry) {
  3405. this.head = entry.next;
  3406. if (this.tail === entry)
  3407. this.tail = null;
  3408. return entry.item;
  3409. }
  3410. }
  3411. };
  3412. module.exports = Queue;
  3413. /***/ }),
  3414. /* 119 */
  3415. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3416. var global = __w_pdfjs_require__(8);
  3417. module.exports = global.Promise;
  3418. /***/ }),
  3419. /* 120 */
  3420. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3421. var global = __w_pdfjs_require__(8);
  3422. var NativePromiseConstructor = __w_pdfjs_require__(119);
  3423. var isCallable = __w_pdfjs_require__(24);
  3424. var isForced = __w_pdfjs_require__(68);
  3425. var inspectSource = __w_pdfjs_require__(51);
  3426. var wellKnownSymbol = __w_pdfjs_require__(36);
  3427. var IS_BROWSER = __w_pdfjs_require__(121);
  3428. var IS_PURE = __w_pdfjs_require__(38);
  3429. var V8_VERSION = __w_pdfjs_require__(30);
  3430. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  3431. var SPECIES = wellKnownSymbol('species');
  3432. var SUBCLASSING = false;
  3433. var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
  3434. var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
  3435. var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
  3436. var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
  3437. if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66)
  3438. return true;
  3439. if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally']))
  3440. return true;
  3441. if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE))
  3442. return false;
  3443. var promise = new NativePromiseConstructor(function (resolve) {
  3444. resolve(1);
  3445. });
  3446. var FakePromise = function (exec) {
  3447. exec(function () {
  3448. }, function () {
  3449. });
  3450. };
  3451. var constructor = promise.constructor = {};
  3452. constructor[SPECIES] = FakePromise;
  3453. SUBCLASSING = promise.then(function () {
  3454. }) instanceof FakePromise;
  3455. if (!SUBCLASSING)
  3456. return true;
  3457. return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
  3458. });
  3459. module.exports = {
  3460. CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
  3461. REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
  3462. SUBCLASSING: SUBCLASSING
  3463. };
  3464. /***/ }),
  3465. /* 121 */
  3466. /***/ ((module) => {
  3467. module.exports = typeof window == 'object' && typeof Deno != 'object';
  3468. /***/ }),
  3469. /* 122 */
  3470. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3471. "use strict";
  3472. var aCallable = __w_pdfjs_require__(33);
  3473. var PromiseCapability = function (C) {
  3474. var resolve, reject;
  3475. this.promise = new C(function ($$resolve, $$reject) {
  3476. if (resolve !== undefined || reject !== undefined)
  3477. throw TypeError('Bad Promise constructor');
  3478. resolve = $$resolve;
  3479. reject = $$reject;
  3480. });
  3481. this.resolve = aCallable(resolve);
  3482. this.reject = aCallable(reject);
  3483. };
  3484. module.exports.f = function (C) {
  3485. return new PromiseCapability(C);
  3486. };
  3487. /***/ }),
  3488. /* 123 */
  3489. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3490. "use strict";
  3491. var $ = __w_pdfjs_require__(7);
  3492. var call = __w_pdfjs_require__(12);
  3493. var aCallable = __w_pdfjs_require__(33);
  3494. var newPromiseCapabilityModule = __w_pdfjs_require__(122);
  3495. var perform = __w_pdfjs_require__(117);
  3496. var iterate = __w_pdfjs_require__(79);
  3497. var PROMISE_STATICS_INCORRECT_ITERATION = __w_pdfjs_require__(124);
  3498. $({
  3499. target: 'Promise',
  3500. stat: true,
  3501. forced: PROMISE_STATICS_INCORRECT_ITERATION
  3502. }, {
  3503. all: function all(iterable) {
  3504. var C = this;
  3505. var capability = newPromiseCapabilityModule.f(C);
  3506. var resolve = capability.resolve;
  3507. var reject = capability.reject;
  3508. var result = perform(function () {
  3509. var $promiseResolve = aCallable(C.resolve);
  3510. var values = [];
  3511. var counter = 0;
  3512. var remaining = 1;
  3513. iterate(iterable, function (promise) {
  3514. var index = counter++;
  3515. var alreadyCalled = false;
  3516. remaining++;
  3517. call($promiseResolve, C, promise).then(function (value) {
  3518. if (alreadyCalled)
  3519. return;
  3520. alreadyCalled = true;
  3521. values[index] = value;
  3522. --remaining || resolve(values);
  3523. }, reject);
  3524. });
  3525. --remaining || resolve(values);
  3526. });
  3527. if (result.error)
  3528. reject(result.value);
  3529. return capability.promise;
  3530. }
  3531. });
  3532. /***/ }),
  3533. /* 124 */
  3534. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3535. var NativePromiseConstructor = __w_pdfjs_require__(119);
  3536. var checkCorrectnessOfIteration = __w_pdfjs_require__(125);
  3537. var FORCED_PROMISE_CONSTRUCTOR = (__w_pdfjs_require__(120).CONSTRUCTOR);
  3538. module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
  3539. NativePromiseConstructor.all(iterable).then(undefined, function () {
  3540. });
  3541. });
  3542. /***/ }),
  3543. /* 125 */
  3544. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3545. var wellKnownSymbol = __w_pdfjs_require__(36);
  3546. var ITERATOR = wellKnownSymbol('iterator');
  3547. var SAFE_CLOSING = false;
  3548. try {
  3549. var called = 0;
  3550. var iteratorWithReturn = {
  3551. next: function () {
  3552. return { done: !!called++ };
  3553. },
  3554. 'return': function () {
  3555. SAFE_CLOSING = true;
  3556. }
  3557. };
  3558. iteratorWithReturn[ITERATOR] = function () {
  3559. return this;
  3560. };
  3561. Array.from(iteratorWithReturn, function () {
  3562. throw 2;
  3563. });
  3564. } catch (error) {
  3565. }
  3566. module.exports = function (exec, SKIP_CLOSING) {
  3567. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3568. return false;
  3569. var ITERATION_SUPPORT = false;
  3570. try {
  3571. var object = {};
  3572. object[ITERATOR] = function () {
  3573. return {
  3574. next: function () {
  3575. return { done: ITERATION_SUPPORT = true };
  3576. }
  3577. };
  3578. };
  3579. exec(object);
  3580. } catch (error) {
  3581. }
  3582. return ITERATION_SUPPORT;
  3583. };
  3584. /***/ }),
  3585. /* 126 */
  3586. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3587. "use strict";
  3588. var $ = __w_pdfjs_require__(7);
  3589. var IS_PURE = __w_pdfjs_require__(38);
  3590. var FORCED_PROMISE_CONSTRUCTOR = (__w_pdfjs_require__(120).CONSTRUCTOR);
  3591. var NativePromiseConstructor = __w_pdfjs_require__(119);
  3592. var getBuiltIn = __w_pdfjs_require__(26);
  3593. var isCallable = __w_pdfjs_require__(24);
  3594. var redefine = __w_pdfjs_require__(50);
  3595. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  3596. $({
  3597. target: 'Promise',
  3598. proto: true,
  3599. forced: FORCED_PROMISE_CONSTRUCTOR,
  3600. real: true
  3601. }, {
  3602. 'catch': function (onRejected) {
  3603. return this.then(undefined, onRejected);
  3604. }
  3605. });
  3606. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  3607. var method = getBuiltIn('Promise').prototype['catch'];
  3608. if (NativePromisePrototype['catch'] !== method) {
  3609. redefine(NativePromisePrototype, 'catch', method, { unsafe: true });
  3610. }
  3611. }
  3612. /***/ }),
  3613. /* 127 */
  3614. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3615. "use strict";
  3616. var $ = __w_pdfjs_require__(7);
  3617. var call = __w_pdfjs_require__(12);
  3618. var aCallable = __w_pdfjs_require__(33);
  3619. var newPromiseCapabilityModule = __w_pdfjs_require__(122);
  3620. var perform = __w_pdfjs_require__(117);
  3621. var iterate = __w_pdfjs_require__(79);
  3622. var PROMISE_STATICS_INCORRECT_ITERATION = __w_pdfjs_require__(124);
  3623. $({
  3624. target: 'Promise',
  3625. stat: true,
  3626. forced: PROMISE_STATICS_INCORRECT_ITERATION
  3627. }, {
  3628. race: function race(iterable) {
  3629. var C = this;
  3630. var capability = newPromiseCapabilityModule.f(C);
  3631. var reject = capability.reject;
  3632. var result = perform(function () {
  3633. var $promiseResolve = aCallable(C.resolve);
  3634. iterate(iterable, function (promise) {
  3635. call($promiseResolve, C, promise).then(capability.resolve, reject);
  3636. });
  3637. });
  3638. if (result.error)
  3639. reject(result.value);
  3640. return capability.promise;
  3641. }
  3642. });
  3643. /***/ }),
  3644. /* 128 */
  3645. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3646. "use strict";
  3647. var $ = __w_pdfjs_require__(7);
  3648. var call = __w_pdfjs_require__(12);
  3649. var newPromiseCapabilityModule = __w_pdfjs_require__(122);
  3650. var FORCED_PROMISE_CONSTRUCTOR = (__w_pdfjs_require__(120).CONSTRUCTOR);
  3651. $({
  3652. target: 'Promise',
  3653. stat: true,
  3654. forced: FORCED_PROMISE_CONSTRUCTOR
  3655. }, {
  3656. reject: function reject(r) {
  3657. var capability = newPromiseCapabilityModule.f(this);
  3658. call(capability.reject, undefined, r);
  3659. return capability.promise;
  3660. }
  3661. });
  3662. /***/ }),
  3663. /* 129 */
  3664. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3665. "use strict";
  3666. var $ = __w_pdfjs_require__(7);
  3667. var getBuiltIn = __w_pdfjs_require__(26);
  3668. var IS_PURE = __w_pdfjs_require__(38);
  3669. var NativePromiseConstructor = __w_pdfjs_require__(119);
  3670. var FORCED_PROMISE_CONSTRUCTOR = (__w_pdfjs_require__(120).CONSTRUCTOR);
  3671. var promiseResolve = __w_pdfjs_require__(130);
  3672. var PromiseConstructorWrapper = getBuiltIn('Promise');
  3673. var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
  3674. $({
  3675. target: 'Promise',
  3676. stat: true,
  3677. forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR
  3678. }, {
  3679. resolve: function resolve(x) {
  3680. return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
  3681. }
  3682. });
  3683. /***/ }),
  3684. /* 130 */
  3685. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3686. var anObject = __w_pdfjs_require__(49);
  3687. var isObject = __w_pdfjs_require__(23);
  3688. var newPromiseCapability = __w_pdfjs_require__(122);
  3689. module.exports = function (C, x) {
  3690. anObject(C);
  3691. if (isObject(x) && x.constructor === C)
  3692. return x;
  3693. var promiseCapability = newPromiseCapability.f(C);
  3694. var resolve = promiseCapability.resolve;
  3695. resolve(x);
  3696. return promiseCapability.promise;
  3697. };
  3698. /***/ }),
  3699. /* 131 */
  3700. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3701. "use strict";
  3702. var $ = __w_pdfjs_require__(7);
  3703. var call = __w_pdfjs_require__(12);
  3704. var aCallable = __w_pdfjs_require__(33);
  3705. var newPromiseCapabilityModule = __w_pdfjs_require__(122);
  3706. var perform = __w_pdfjs_require__(117);
  3707. var iterate = __w_pdfjs_require__(79);
  3708. $({
  3709. target: 'Promise',
  3710. stat: true
  3711. }, {
  3712. allSettled: function allSettled(iterable) {
  3713. var C = this;
  3714. var capability = newPromiseCapabilityModule.f(C);
  3715. var resolve = capability.resolve;
  3716. var reject = capability.reject;
  3717. var result = perform(function () {
  3718. var promiseResolve = aCallable(C.resolve);
  3719. var values = [];
  3720. var counter = 0;
  3721. var remaining = 1;
  3722. iterate(iterable, function (promise) {
  3723. var index = counter++;
  3724. var alreadyCalled = false;
  3725. remaining++;
  3726. call(promiseResolve, C, promise).then(function (value) {
  3727. if (alreadyCalled)
  3728. return;
  3729. alreadyCalled = true;
  3730. values[index] = {
  3731. status: 'fulfilled',
  3732. value: value
  3733. };
  3734. --remaining || resolve(values);
  3735. }, function (error) {
  3736. if (alreadyCalled)
  3737. return;
  3738. alreadyCalled = true;
  3739. values[index] = {
  3740. status: 'rejected',
  3741. reason: error
  3742. };
  3743. --remaining || resolve(values);
  3744. });
  3745. });
  3746. --remaining || resolve(values);
  3747. });
  3748. if (result.error)
  3749. reject(result.value);
  3750. return capability.promise;
  3751. }
  3752. });
  3753. /***/ }),
  3754. /* 132 */
  3755. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3756. "use strict";
  3757. var $ = __w_pdfjs_require__(7);
  3758. var call = __w_pdfjs_require__(12);
  3759. var aCallable = __w_pdfjs_require__(33);
  3760. var getBuiltIn = __w_pdfjs_require__(26);
  3761. var newPromiseCapabilityModule = __w_pdfjs_require__(122);
  3762. var perform = __w_pdfjs_require__(117);
  3763. var iterate = __w_pdfjs_require__(79);
  3764. var PROMISE_ANY_ERROR = 'No one promise resolved';
  3765. $({
  3766. target: 'Promise',
  3767. stat: true
  3768. }, {
  3769. any: function any(iterable) {
  3770. var C = this;
  3771. var AggregateError = getBuiltIn('AggregateError');
  3772. var capability = newPromiseCapabilityModule.f(C);
  3773. var resolve = capability.resolve;
  3774. var reject = capability.reject;
  3775. var result = perform(function () {
  3776. var promiseResolve = aCallable(C.resolve);
  3777. var errors = [];
  3778. var counter = 0;
  3779. var remaining = 1;
  3780. var alreadyResolved = false;
  3781. iterate(iterable, function (promise) {
  3782. var index = counter++;
  3783. var alreadyRejected = false;
  3784. remaining++;
  3785. call(promiseResolve, C, promise).then(function (value) {
  3786. if (alreadyRejected || alreadyResolved)
  3787. return;
  3788. alreadyResolved = true;
  3789. resolve(value);
  3790. }, function (error) {
  3791. if (alreadyRejected || alreadyResolved)
  3792. return;
  3793. alreadyRejected = true;
  3794. errors[index] = error;
  3795. --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
  3796. });
  3797. });
  3798. --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
  3799. });
  3800. if (result.error)
  3801. reject(result.value);
  3802. return capability.promise;
  3803. }
  3804. });
  3805. /***/ }),
  3806. /* 133 */
  3807. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3808. "use strict";
  3809. var $ = __w_pdfjs_require__(7);
  3810. var IS_PURE = __w_pdfjs_require__(38);
  3811. var NativePromiseConstructor = __w_pdfjs_require__(119);
  3812. var fails = __w_pdfjs_require__(11);
  3813. var getBuiltIn = __w_pdfjs_require__(26);
  3814. var isCallable = __w_pdfjs_require__(24);
  3815. var speciesConstructor = __w_pdfjs_require__(105);
  3816. var promiseResolve = __w_pdfjs_require__(130);
  3817. var redefine = __w_pdfjs_require__(50);
  3818. var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
  3819. var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
  3820. NativePromisePrototype['finally'].call({
  3821. then: function () {
  3822. }
  3823. }, function () {
  3824. });
  3825. });
  3826. $({
  3827. target: 'Promise',
  3828. proto: true,
  3829. real: true,
  3830. forced: NON_GENERIC
  3831. }, {
  3832. 'finally': function (onFinally) {
  3833. var C = speciesConstructor(this, getBuiltIn('Promise'));
  3834. var isFunction = isCallable(onFinally);
  3835. return this.then(isFunction ? function (x) {
  3836. return promiseResolve(C, onFinally()).then(function () {
  3837. return x;
  3838. });
  3839. } : onFinally, isFunction ? function (e) {
  3840. return promiseResolve(C, onFinally()).then(function () {
  3841. throw e;
  3842. });
  3843. } : onFinally);
  3844. }
  3845. });
  3846. if (!IS_PURE && isCallable(NativePromiseConstructor)) {
  3847. var method = getBuiltIn('Promise').prototype['finally'];
  3848. if (NativePromisePrototype['finally'] !== method) {
  3849. redefine(NativePromisePrototype, 'finally', method, { unsafe: true });
  3850. }
  3851. }
  3852. /***/ }),
  3853. /* 134 */
  3854. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3855. "use strict";
  3856. var charAt = (__w_pdfjs_require__(135).charAt);
  3857. var toString = __w_pdfjs_require__(89);
  3858. var InternalStateModule = __w_pdfjs_require__(52);
  3859. var defineIterator = __w_pdfjs_require__(93);
  3860. var STRING_ITERATOR = 'String Iterator';
  3861. var setInternalState = InternalStateModule.set;
  3862. var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
  3863. defineIterator(String, 'String', function (iterated) {
  3864. setInternalState(this, {
  3865. type: STRING_ITERATOR,
  3866. string: toString(iterated),
  3867. index: 0
  3868. });
  3869. }, function next() {
  3870. var state = getInternalState(this);
  3871. var string = state.string;
  3872. var index = state.index;
  3873. var point;
  3874. if (index >= string.length)
  3875. return {
  3876. value: undefined,
  3877. done: true
  3878. };
  3879. point = charAt(string, index);
  3880. state.index += point.length;
  3881. return {
  3882. value: point,
  3883. done: false
  3884. };
  3885. });
  3886. /***/ }),
  3887. /* 135 */
  3888. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3889. var uncurryThis = __w_pdfjs_require__(18);
  3890. var toIntegerOrInfinity = __w_pdfjs_require__(63);
  3891. var toString = __w_pdfjs_require__(89);
  3892. var requireObjectCoercible = __w_pdfjs_require__(20);
  3893. var charAt = uncurryThis(''.charAt);
  3894. var charCodeAt = uncurryThis(''.charCodeAt);
  3895. var stringSlice = uncurryThis(''.slice);
  3896. var createMethod = function (CONVERT_TO_STRING) {
  3897. return function ($this, pos) {
  3898. var S = toString(requireObjectCoercible($this));
  3899. var position = toIntegerOrInfinity(pos);
  3900. var size = S.length;
  3901. var first, second;
  3902. if (position < 0 || position >= size)
  3903. return CONVERT_TO_STRING ? '' : undefined;
  3904. first = charCodeAt(S, position);
  3905. return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  3906. };
  3907. };
  3908. module.exports = {
  3909. codeAt: createMethod(false),
  3910. charAt: createMethod(true)
  3911. };
  3912. /***/ }),
  3913. /* 136 */
  3914. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3915. var global = __w_pdfjs_require__(8);
  3916. module.exports = global;
  3917. /***/ }),
  3918. /* 137 */
  3919. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3920. __w_pdfjs_require__(91);
  3921. __w_pdfjs_require__(97);
  3922. __w_pdfjs_require__(138);
  3923. __w_pdfjs_require__(150);
  3924. __w_pdfjs_require__(152);
  3925. var path = __w_pdfjs_require__(136);
  3926. module.exports = path.structuredClone;
  3927. /***/ }),
  3928. /* 138 */
  3929. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3930. __w_pdfjs_require__(139);
  3931. /***/ }),
  3932. /* 139 */
  3933. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3934. "use strict";
  3935. var collection = __w_pdfjs_require__(140);
  3936. var collectionStrong = __w_pdfjs_require__(149);
  3937. collection('Map', function (init) {
  3938. return function Map() {
  3939. return init(this, arguments.length ? arguments[0] : undefined);
  3940. };
  3941. }, collectionStrong);
  3942. /***/ }),
  3943. /* 140 */
  3944. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3945. "use strict";
  3946. var $ = __w_pdfjs_require__(7);
  3947. var global = __w_pdfjs_require__(8);
  3948. var uncurryThis = __w_pdfjs_require__(18);
  3949. var isForced = __w_pdfjs_require__(68);
  3950. var redefine = __w_pdfjs_require__(50);
  3951. var InternalMetadataModule = __w_pdfjs_require__(141);
  3952. var iterate = __w_pdfjs_require__(79);
  3953. var anInstance = __w_pdfjs_require__(104);
  3954. var isCallable = __w_pdfjs_require__(24);
  3955. var isObject = __w_pdfjs_require__(23);
  3956. var fails = __w_pdfjs_require__(11);
  3957. var checkCorrectnessOfIteration = __w_pdfjs_require__(125);
  3958. var setToStringTag = __w_pdfjs_require__(96);
  3959. var inheritIfRequired = __w_pdfjs_require__(148);
  3960. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  3961. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  3962. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  3963. var ADDER = IS_MAP ? 'set' : 'add';
  3964. var NativeConstructor = global[CONSTRUCTOR_NAME];
  3965. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  3966. var Constructor = NativeConstructor;
  3967. var exported = {};
  3968. var fixMethod = function (KEY) {
  3969. var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
  3970. redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  3971. uncurriedNativeMethod(this, value === 0 ? 0 : value);
  3972. return this;
  3973. } : KEY == 'delete' ? function (key) {
  3974. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3975. } : KEY == 'get' ? function get(key) {
  3976. return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3977. } : KEY == 'has' ? function has(key) {
  3978. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3979. } : function set(key, value) {
  3980. uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
  3981. return this;
  3982. });
  3983. };
  3984. var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  3985. new NativeConstructor().entries().next();
  3986. })));
  3987. if (REPLACE) {
  3988. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  3989. InternalMetadataModule.enable();
  3990. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  3991. var instance = new Constructor();
  3992. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  3993. var THROWS_ON_PRIMITIVES = fails(function () {
  3994. instance.has(1);
  3995. });
  3996. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  3997. new NativeConstructor(iterable);
  3998. });
  3999. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  4000. var $instance = new NativeConstructor();
  4001. var index = 5;
  4002. while (index--)
  4003. $instance[ADDER](index, index);
  4004. return !$instance.has(-0);
  4005. });
  4006. if (!ACCEPT_ITERABLES) {
  4007. Constructor = wrapper(function (dummy, iterable) {
  4008. anInstance(dummy, NativePrototype);
  4009. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  4010. if (iterable != undefined)
  4011. iterate(iterable, that[ADDER], {
  4012. that: that,
  4013. AS_ENTRIES: IS_MAP
  4014. });
  4015. return that;
  4016. });
  4017. Constructor.prototype = NativePrototype;
  4018. NativePrototype.constructor = Constructor;
  4019. }
  4020. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  4021. fixMethod('delete');
  4022. fixMethod('has');
  4023. IS_MAP && fixMethod('get');
  4024. }
  4025. if (BUGGY_ZERO || HASNT_CHAINING)
  4026. fixMethod(ADDER);
  4027. if (IS_WEAK && NativePrototype.clear)
  4028. delete NativePrototype.clear;
  4029. }
  4030. exported[CONSTRUCTOR_NAME] = Constructor;
  4031. $({
  4032. global: true,
  4033. forced: Constructor != NativeConstructor
  4034. }, exported);
  4035. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  4036. if (!IS_WEAK)
  4037. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  4038. return Constructor;
  4039. };
  4040. /***/ }),
  4041. /* 141 */
  4042. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4043. var $ = __w_pdfjs_require__(7);
  4044. var uncurryThis = __w_pdfjs_require__(18);
  4045. var hiddenKeys = __w_pdfjs_require__(55);
  4046. var isObject = __w_pdfjs_require__(23);
  4047. var hasOwn = __w_pdfjs_require__(41);
  4048. var defineProperty = (__w_pdfjs_require__(47).f);
  4049. var getOwnPropertyNamesModule = __w_pdfjs_require__(59);
  4050. var getOwnPropertyNamesExternalModule = __w_pdfjs_require__(142);
  4051. var isExtensible = __w_pdfjs_require__(145);
  4052. var uid = __w_pdfjs_require__(43);
  4053. var FREEZING = __w_pdfjs_require__(147);
  4054. var REQUIRED = false;
  4055. var METADATA = uid('meta');
  4056. var id = 0;
  4057. var setMetadata = function (it) {
  4058. defineProperty(it, METADATA, {
  4059. value: {
  4060. objectID: 'O' + id++,
  4061. weakData: {}
  4062. }
  4063. });
  4064. };
  4065. var fastKey = function (it, create) {
  4066. if (!isObject(it))
  4067. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  4068. if (!hasOwn(it, METADATA)) {
  4069. if (!isExtensible(it))
  4070. return 'F';
  4071. if (!create)
  4072. return 'E';
  4073. setMetadata(it);
  4074. }
  4075. return it[METADATA].objectID;
  4076. };
  4077. var getWeakData = function (it, create) {
  4078. if (!hasOwn(it, METADATA)) {
  4079. if (!isExtensible(it))
  4080. return true;
  4081. if (!create)
  4082. return false;
  4083. setMetadata(it);
  4084. }
  4085. return it[METADATA].weakData;
  4086. };
  4087. var onFreeze = function (it) {
  4088. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA))
  4089. setMetadata(it);
  4090. return it;
  4091. };
  4092. var enable = function () {
  4093. meta.enable = function () {
  4094. };
  4095. REQUIRED = true;
  4096. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  4097. var splice = uncurryThis([].splice);
  4098. var test = {};
  4099. test[METADATA] = 1;
  4100. if (getOwnPropertyNames(test).length) {
  4101. getOwnPropertyNamesModule.f = function (it) {
  4102. var result = getOwnPropertyNames(it);
  4103. for (var i = 0, length = result.length; i < length; i++) {
  4104. if (result[i] === METADATA) {
  4105. splice(result, i, 1);
  4106. break;
  4107. }
  4108. }
  4109. return result;
  4110. };
  4111. $({
  4112. target: 'Object',
  4113. stat: true,
  4114. forced: true
  4115. }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f });
  4116. }
  4117. };
  4118. var meta = module.exports = {
  4119. enable: enable,
  4120. fastKey: fastKey,
  4121. getWeakData: getWeakData,
  4122. onFreeze: onFreeze
  4123. };
  4124. hiddenKeys[METADATA] = true;
  4125. /***/ }),
  4126. /* 142 */
  4127. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4128. var classof = __w_pdfjs_require__(19);
  4129. var toIndexedObject = __w_pdfjs_require__(16);
  4130. var $getOwnPropertyNames = (__w_pdfjs_require__(59).f);
  4131. var arraySlice = __w_pdfjs_require__(143);
  4132. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  4133. var getWindowNames = function (it) {
  4134. try {
  4135. return $getOwnPropertyNames(it);
  4136. } catch (error) {
  4137. return arraySlice(windowNames);
  4138. }
  4139. };
  4140. module.exports.f = function getOwnPropertyNames(it) {
  4141. return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
  4142. };
  4143. /***/ }),
  4144. /* 143 */
  4145. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4146. var global = __w_pdfjs_require__(8);
  4147. var toAbsoluteIndex = __w_pdfjs_require__(62);
  4148. var lengthOfArrayLike = __w_pdfjs_require__(64);
  4149. var createProperty = __w_pdfjs_require__(144);
  4150. var Array = global.Array;
  4151. var max = Math.max;
  4152. module.exports = function (O, start, end) {
  4153. var length = lengthOfArrayLike(O);
  4154. var k = toAbsoluteIndex(start, length);
  4155. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  4156. var result = Array(max(fin - k, 0));
  4157. for (var n = 0; k < fin; k++, n++)
  4158. createProperty(result, n, O[k]);
  4159. result.length = n;
  4160. return result;
  4161. };
  4162. /***/ }),
  4163. /* 144 */
  4164. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4165. "use strict";
  4166. var toPropertyKey = __w_pdfjs_require__(21);
  4167. var definePropertyModule = __w_pdfjs_require__(47);
  4168. var createPropertyDescriptor = __w_pdfjs_require__(15);
  4169. module.exports = function (object, key, value) {
  4170. var propertyKey = toPropertyKey(key);
  4171. if (propertyKey in object)
  4172. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  4173. else
  4174. object[propertyKey] = value;
  4175. };
  4176. /***/ }),
  4177. /* 145 */
  4178. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4179. var fails = __w_pdfjs_require__(11);
  4180. var isObject = __w_pdfjs_require__(23);
  4181. var classof = __w_pdfjs_require__(19);
  4182. var ARRAY_BUFFER_NON_EXTENSIBLE = __w_pdfjs_require__(146);
  4183. var $isExtensible = Object.isExtensible;
  4184. var FAILS_ON_PRIMITIVES = fails(function () {
  4185. $isExtensible(1);
  4186. });
  4187. module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
  4188. if (!isObject(it))
  4189. return false;
  4190. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer')
  4191. return false;
  4192. return $isExtensible ? $isExtensible(it) : true;
  4193. } : $isExtensible;
  4194. /***/ }),
  4195. /* 146 */
  4196. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4197. var fails = __w_pdfjs_require__(11);
  4198. module.exports = fails(function () {
  4199. if (typeof ArrayBuffer == 'function') {
  4200. var buffer = new ArrayBuffer(8);
  4201. if (Object.isExtensible(buffer))
  4202. Object.defineProperty(buffer, 'a', { value: 8 });
  4203. }
  4204. });
  4205. /***/ }),
  4206. /* 147 */
  4207. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4208. var fails = __w_pdfjs_require__(11);
  4209. module.exports = !fails(function () {
  4210. return Object.isExtensible(Object.preventExtensions({}));
  4211. });
  4212. /***/ }),
  4213. /* 148 */
  4214. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4215. var isCallable = __w_pdfjs_require__(24);
  4216. var isObject = __w_pdfjs_require__(23);
  4217. var setPrototypeOf = __w_pdfjs_require__(71);
  4218. module.exports = function ($this, dummy, Wrapper) {
  4219. var NewTarget, NewTargetPrototype;
  4220. if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  4221. setPrototypeOf($this, NewTargetPrototype);
  4222. return $this;
  4223. };
  4224. /***/ }),
  4225. /* 149 */
  4226. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4227. "use strict";
  4228. var defineProperty = (__w_pdfjs_require__(47).f);
  4229. var create = __w_pdfjs_require__(73);
  4230. var redefineAll = __w_pdfjs_require__(102);
  4231. var bind = __w_pdfjs_require__(80);
  4232. var anInstance = __w_pdfjs_require__(104);
  4233. var iterate = __w_pdfjs_require__(79);
  4234. var defineIterator = __w_pdfjs_require__(93);
  4235. var setSpecies = __w_pdfjs_require__(103);
  4236. var DESCRIPTORS = __w_pdfjs_require__(10);
  4237. var fastKey = (__w_pdfjs_require__(141).fastKey);
  4238. var InternalStateModule = __w_pdfjs_require__(52);
  4239. var setInternalState = InternalStateModule.set;
  4240. var internalStateGetterFor = InternalStateModule.getterFor;
  4241. module.exports = {
  4242. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  4243. var Constructor = wrapper(function (that, iterable) {
  4244. anInstance(that, Prototype);
  4245. setInternalState(that, {
  4246. type: CONSTRUCTOR_NAME,
  4247. index: create(null),
  4248. first: undefined,
  4249. last: undefined,
  4250. size: 0
  4251. });
  4252. if (!DESCRIPTORS)
  4253. that.size = 0;
  4254. if (iterable != undefined)
  4255. iterate(iterable, that[ADDER], {
  4256. that: that,
  4257. AS_ENTRIES: IS_MAP
  4258. });
  4259. });
  4260. var Prototype = Constructor.prototype;
  4261. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  4262. var define = function (that, key, value) {
  4263. var state = getInternalState(that);
  4264. var entry = getEntry(that, key);
  4265. var previous, index;
  4266. if (entry) {
  4267. entry.value = value;
  4268. } else {
  4269. state.last = entry = {
  4270. index: index = fastKey(key, true),
  4271. key: key,
  4272. value: value,
  4273. previous: previous = state.last,
  4274. next: undefined,
  4275. removed: false
  4276. };
  4277. if (!state.first)
  4278. state.first = entry;
  4279. if (previous)
  4280. previous.next = entry;
  4281. if (DESCRIPTORS)
  4282. state.size++;
  4283. else
  4284. that.size++;
  4285. if (index !== 'F')
  4286. state.index[index] = entry;
  4287. }
  4288. return that;
  4289. };
  4290. var getEntry = function (that, key) {
  4291. var state = getInternalState(that);
  4292. var index = fastKey(key);
  4293. var entry;
  4294. if (index !== 'F')
  4295. return state.index[index];
  4296. for (entry = state.first; entry; entry = entry.next) {
  4297. if (entry.key == key)
  4298. return entry;
  4299. }
  4300. };
  4301. redefineAll(Prototype, {
  4302. clear: function clear() {
  4303. var that = this;
  4304. var state = getInternalState(that);
  4305. var data = state.index;
  4306. var entry = state.first;
  4307. while (entry) {
  4308. entry.removed = true;
  4309. if (entry.previous)
  4310. entry.previous = entry.previous.next = undefined;
  4311. delete data[entry.index];
  4312. entry = entry.next;
  4313. }
  4314. state.first = state.last = undefined;
  4315. if (DESCRIPTORS)
  4316. state.size = 0;
  4317. else
  4318. that.size = 0;
  4319. },
  4320. 'delete': function (key) {
  4321. var that = this;
  4322. var state = getInternalState(that);
  4323. var entry = getEntry(that, key);
  4324. if (entry) {
  4325. var next = entry.next;
  4326. var prev = entry.previous;
  4327. delete state.index[entry.index];
  4328. entry.removed = true;
  4329. if (prev)
  4330. prev.next = next;
  4331. if (next)
  4332. next.previous = prev;
  4333. if (state.first == entry)
  4334. state.first = next;
  4335. if (state.last == entry)
  4336. state.last = prev;
  4337. if (DESCRIPTORS)
  4338. state.size--;
  4339. else
  4340. that.size--;
  4341. }
  4342. return !!entry;
  4343. },
  4344. forEach: function forEach(callbackfn) {
  4345. var state = getInternalState(this);
  4346. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  4347. var entry;
  4348. while (entry = entry ? entry.next : state.first) {
  4349. boundFunction(entry.value, entry.key, this);
  4350. while (entry && entry.removed)
  4351. entry = entry.previous;
  4352. }
  4353. },
  4354. has: function has(key) {
  4355. return !!getEntry(this, key);
  4356. }
  4357. });
  4358. redefineAll(Prototype, IS_MAP ? {
  4359. get: function get(key) {
  4360. var entry = getEntry(this, key);
  4361. return entry && entry.value;
  4362. },
  4363. set: function set(key, value) {
  4364. return define(this, key === 0 ? 0 : key, value);
  4365. }
  4366. } : {
  4367. add: function add(value) {
  4368. return define(this, value = value === 0 ? 0 : value, value);
  4369. }
  4370. });
  4371. if (DESCRIPTORS)
  4372. defineProperty(Prototype, 'size', {
  4373. get: function () {
  4374. return getInternalState(this).size;
  4375. }
  4376. });
  4377. return Constructor;
  4378. },
  4379. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  4380. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  4381. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  4382. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  4383. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  4384. setInternalState(this, {
  4385. type: ITERATOR_NAME,
  4386. target: iterated,
  4387. state: getInternalCollectionState(iterated),
  4388. kind: kind,
  4389. last: undefined
  4390. });
  4391. }, function () {
  4392. var state = getInternalIteratorState(this);
  4393. var kind = state.kind;
  4394. var entry = state.last;
  4395. while (entry && entry.removed)
  4396. entry = entry.previous;
  4397. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  4398. state.target = undefined;
  4399. return {
  4400. value: undefined,
  4401. done: true
  4402. };
  4403. }
  4404. if (kind == 'keys')
  4405. return {
  4406. value: entry.key,
  4407. done: false
  4408. };
  4409. if (kind == 'values')
  4410. return {
  4411. value: entry.value,
  4412. done: false
  4413. };
  4414. return {
  4415. value: [
  4416. entry.key,
  4417. entry.value
  4418. ],
  4419. done: false
  4420. };
  4421. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  4422. setSpecies(CONSTRUCTOR_NAME);
  4423. }
  4424. };
  4425. /***/ }),
  4426. /* 150 */
  4427. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4428. __w_pdfjs_require__(151);
  4429. /***/ }),
  4430. /* 151 */
  4431. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4432. "use strict";
  4433. var collection = __w_pdfjs_require__(140);
  4434. var collectionStrong = __w_pdfjs_require__(149);
  4435. collection('Set', function (init) {
  4436. return function Set() {
  4437. return init(this, arguments.length ? arguments[0] : undefined);
  4438. };
  4439. }, collectionStrong);
  4440. /***/ }),
  4441. /* 152 */
  4442. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4443. var IS_PURE = __w_pdfjs_require__(38);
  4444. var $ = __w_pdfjs_require__(7);
  4445. var global = __w_pdfjs_require__(8);
  4446. var getBuiltin = __w_pdfjs_require__(26);
  4447. var uncurryThis = __w_pdfjs_require__(18);
  4448. var fails = __w_pdfjs_require__(11);
  4449. var uid = __w_pdfjs_require__(43);
  4450. var isCallable = __w_pdfjs_require__(24);
  4451. var isConstructor = __w_pdfjs_require__(107);
  4452. var isObject = __w_pdfjs_require__(23);
  4453. var isSymbol = __w_pdfjs_require__(25);
  4454. var iterate = __w_pdfjs_require__(79);
  4455. var anObject = __w_pdfjs_require__(49);
  4456. var classof = __w_pdfjs_require__(85);
  4457. var hasOwn = __w_pdfjs_require__(41);
  4458. var createProperty = __w_pdfjs_require__(144);
  4459. var createNonEnumerableProperty = __w_pdfjs_require__(46);
  4460. var lengthOfArrayLike = __w_pdfjs_require__(64);
  4461. var validateArgumentsLength = __w_pdfjs_require__(111);
  4462. var getRegExpFlags = __w_pdfjs_require__(153);
  4463. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(90);
  4464. var Object = global.Object;
  4465. var Date = global.Date;
  4466. var Error = global.Error;
  4467. var EvalError = global.EvalError;
  4468. var RangeError = global.RangeError;
  4469. var ReferenceError = global.ReferenceError;
  4470. var SyntaxError = global.SyntaxError;
  4471. var TypeError = global.TypeError;
  4472. var URIError = global.URIError;
  4473. var PerformanceMark = global.PerformanceMark;
  4474. var WebAssembly = global.WebAssembly;
  4475. var CompileError = WebAssembly && WebAssembly.CompileError || Error;
  4476. var LinkError = WebAssembly && WebAssembly.LinkError || Error;
  4477. var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error;
  4478. var DOMException = getBuiltin('DOMException');
  4479. var Set = getBuiltin('Set');
  4480. var Map = getBuiltin('Map');
  4481. var MapPrototype = Map.prototype;
  4482. var mapHas = uncurryThis(MapPrototype.has);
  4483. var mapGet = uncurryThis(MapPrototype.get);
  4484. var mapSet = uncurryThis(MapPrototype.set);
  4485. var setAdd = uncurryThis(Set.prototype.add);
  4486. var objectKeys = getBuiltin('Object', 'keys');
  4487. var push = uncurryThis([].push);
  4488. var booleanValueOf = uncurryThis(true.valueOf);
  4489. var numberValueOf = uncurryThis(1.0.valueOf);
  4490. var stringValueOf = uncurryThis(''.valueOf);
  4491. var getTime = uncurryThis(Date.prototype.getTime);
  4492. var PERFORMANCE_MARK = uid('structuredClone');
  4493. var DATA_CLONE_ERROR = 'DataCloneError';
  4494. var TRANSFERRING = 'Transferring';
  4495. var checkBasicSemantic = function (structuredCloneImplementation) {
  4496. return !fails(function () {
  4497. var set1 = new global.Set([7]);
  4498. var set2 = structuredCloneImplementation(set1);
  4499. var number = structuredCloneImplementation(Object(7));
  4500. return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7;
  4501. }) && structuredCloneImplementation;
  4502. };
  4503. var checkNewErrorsSemantic = function (structuredCloneImplementation) {
  4504. return !fails(function () {
  4505. var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
  4506. return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
  4507. }) && structuredCloneImplementation;
  4508. };
  4509. var nativeStructuredClone = global.structuredClone;
  4510. var FORCED_REPLACEMENT = IS_PURE || !checkNewErrorsSemantic(nativeStructuredClone);
  4511. var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
  4512. return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
  4513. });
  4514. var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark;
  4515. var throwUncloneable = function (type) {
  4516. throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR);
  4517. };
  4518. var throwUnpolyfillable = function (type, kind) {
  4519. throw new DOMException((kind || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR);
  4520. };
  4521. var structuredCloneInternal = function (value, map) {
  4522. if (isSymbol(value))
  4523. throwUncloneable('Symbol');
  4524. if (!isObject(value))
  4525. return value;
  4526. if (map) {
  4527. if (mapHas(map, value))
  4528. return mapGet(map, value);
  4529. } else
  4530. map = new Map();
  4531. var type = classof(value);
  4532. var deep = false;
  4533. var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
  4534. switch (type) {
  4535. case 'Array':
  4536. cloned = [];
  4537. deep = true;
  4538. break;
  4539. case 'Object':
  4540. cloned = {};
  4541. deep = true;
  4542. break;
  4543. case 'Map':
  4544. cloned = new Map();
  4545. deep = true;
  4546. break;
  4547. case 'Set':
  4548. cloned = new Set();
  4549. deep = true;
  4550. break;
  4551. case 'RegExp':
  4552. cloned = new RegExp(value.source, getRegExpFlags(value));
  4553. break;
  4554. case 'Error':
  4555. name = value.name;
  4556. switch (name) {
  4557. case 'AggregateError':
  4558. cloned = getBuiltin('AggregateError')([]);
  4559. break;
  4560. case 'EvalError':
  4561. cloned = EvalError();
  4562. break;
  4563. case 'RangeError':
  4564. cloned = RangeError();
  4565. break;
  4566. case 'ReferenceError':
  4567. cloned = ReferenceError();
  4568. break;
  4569. case 'SyntaxError':
  4570. cloned = SyntaxError();
  4571. break;
  4572. case 'TypeError':
  4573. cloned = TypeError();
  4574. break;
  4575. case 'URIError':
  4576. cloned = URIError();
  4577. break;
  4578. case 'CompileError':
  4579. cloned = CompileError();
  4580. break;
  4581. case 'LinkError':
  4582. cloned = LinkError();
  4583. break;
  4584. case 'RuntimeError':
  4585. cloned = RuntimeError();
  4586. break;
  4587. default:
  4588. cloned = Error();
  4589. }
  4590. deep = true;
  4591. break;
  4592. case 'DOMException':
  4593. cloned = new DOMException(value.message, value.name);
  4594. deep = true;
  4595. break;
  4596. case 'DataView':
  4597. case 'Int8Array':
  4598. case 'Uint8Array':
  4599. case 'Uint8ClampedArray':
  4600. case 'Int16Array':
  4601. case 'Uint16Array':
  4602. case 'Int32Array':
  4603. case 'Uint32Array':
  4604. case 'Float32Array':
  4605. case 'Float64Array':
  4606. case 'BigInt64Array':
  4607. case 'BigUint64Array':
  4608. C = global[type];
  4609. if (!isObject(C))
  4610. throwUnpolyfillable(type);
  4611. cloned = new C(structuredCloneInternal(value.buffer, map), value.byteOffset, type === 'DataView' ? value.byteLength : value.length);
  4612. break;
  4613. case 'DOMQuad':
  4614. try {
  4615. cloned = new DOMQuad(structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map));
  4616. } catch (error) {
  4617. if (nativeRestrictedStructuredClone) {
  4618. cloned = nativeRestrictedStructuredClone(value);
  4619. } else
  4620. throwUnpolyfillable(type);
  4621. }
  4622. break;
  4623. case 'FileList':
  4624. C = global.DataTransfer;
  4625. if (isConstructor(C)) {
  4626. dataTransfer = new C();
  4627. for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
  4628. dataTransfer.items.add(structuredCloneInternal(value[i], map));
  4629. }
  4630. cloned = dataTransfer.files;
  4631. } else if (nativeRestrictedStructuredClone) {
  4632. cloned = nativeRestrictedStructuredClone(value);
  4633. } else
  4634. throwUnpolyfillable(type);
  4635. break;
  4636. case 'ImageData':
  4637. try {
  4638. cloned = new ImageData(structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace });
  4639. } catch (error) {
  4640. if (nativeRestrictedStructuredClone) {
  4641. cloned = nativeRestrictedStructuredClone(value);
  4642. } else
  4643. throwUnpolyfillable(type);
  4644. }
  4645. break;
  4646. default:
  4647. if (nativeRestrictedStructuredClone) {
  4648. cloned = nativeRestrictedStructuredClone(value);
  4649. } else
  4650. switch (type) {
  4651. case 'BigInt':
  4652. cloned = Object(value.valueOf());
  4653. break;
  4654. case 'Boolean':
  4655. cloned = Object(booleanValueOf(value));
  4656. break;
  4657. case 'Number':
  4658. cloned = Object(numberValueOf(value));
  4659. break;
  4660. case 'String':
  4661. cloned = Object(stringValueOf(value));
  4662. break;
  4663. case 'Date':
  4664. cloned = new Date(getTime(value));
  4665. break;
  4666. case 'ArrayBuffer':
  4667. C = global.DataView;
  4668. if (!C && typeof value.slice != 'function')
  4669. throwUnpolyfillable(type);
  4670. try {
  4671. if (typeof value.slice == 'function') {
  4672. cloned = value.slice(0);
  4673. } else {
  4674. length = value.byteLength;
  4675. cloned = new ArrayBuffer(length);
  4676. source = new C(value);
  4677. target = new C(cloned);
  4678. for (i = 0; i < length; i++) {
  4679. target.setUint8(i, source.getUint8(i));
  4680. }
  4681. }
  4682. } catch (error) {
  4683. throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
  4684. }
  4685. break;
  4686. case 'SharedArrayBuffer':
  4687. cloned = value;
  4688. break;
  4689. case 'Blob':
  4690. try {
  4691. cloned = value.slice(0, value.size, value.type);
  4692. } catch (error) {
  4693. throwUnpolyfillable(type);
  4694. }
  4695. break;
  4696. case 'DOMPoint':
  4697. case 'DOMPointReadOnly':
  4698. C = global[type];
  4699. try {
  4700. cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w);
  4701. } catch (error) {
  4702. throwUnpolyfillable(type);
  4703. }
  4704. break;
  4705. case 'DOMRect':
  4706. case 'DOMRectReadOnly':
  4707. C = global[type];
  4708. try {
  4709. cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height);
  4710. } catch (error) {
  4711. throwUnpolyfillable(type);
  4712. }
  4713. break;
  4714. case 'DOMMatrix':
  4715. case 'DOMMatrixReadOnly':
  4716. C = global[type];
  4717. try {
  4718. cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value);
  4719. } catch (error) {
  4720. throwUnpolyfillable(type);
  4721. }
  4722. break;
  4723. case 'AudioData':
  4724. case 'VideoFrame':
  4725. if (!isCallable(value.clone))
  4726. throwUnpolyfillable(type);
  4727. try {
  4728. cloned = value.clone();
  4729. } catch (error) {
  4730. throwUncloneable(type);
  4731. }
  4732. break;
  4733. case 'File':
  4734. try {
  4735. cloned = new File([value], value.name, value);
  4736. } catch (error) {
  4737. throwUnpolyfillable(type);
  4738. }
  4739. break;
  4740. case 'CryptoKey':
  4741. case 'GPUCompilationMessage':
  4742. case 'GPUCompilationInfo':
  4743. case 'ImageBitmap':
  4744. case 'RTCCertificate':
  4745. case 'WebAssembly.Module':
  4746. throwUnpolyfillable(type);
  4747. default:
  4748. throwUncloneable(type);
  4749. }
  4750. }
  4751. mapSet(map, value, cloned);
  4752. if (deep)
  4753. switch (type) {
  4754. case 'Array':
  4755. case 'Object':
  4756. keys = objectKeys(value);
  4757. for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
  4758. key = keys[i];
  4759. createProperty(cloned, key, structuredCloneInternal(value[key], map));
  4760. }
  4761. break;
  4762. case 'Map':
  4763. value.forEach(function (v, k) {
  4764. mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
  4765. });
  4766. break;
  4767. case 'Set':
  4768. value.forEach(function (v) {
  4769. setAdd(cloned, structuredCloneInternal(v, map));
  4770. });
  4771. break;
  4772. case 'Error':
  4773. createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
  4774. if (hasOwn(value, 'cause')) {
  4775. createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
  4776. }
  4777. if (name == 'AggregateError') {
  4778. cloned.errors = structuredCloneInternal(value.errors, map);
  4779. }
  4780. case 'DOMException':
  4781. if (ERROR_STACK_INSTALLABLE) {
  4782. createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
  4783. }
  4784. }
  4785. return cloned;
  4786. };
  4787. var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
  4788. var buffer = new ArrayBuffer(8);
  4789. var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
  4790. return buffer.byteLength != 0 || clone.byteLength != 8;
  4791. });
  4792. var tryToTransfer = function (rawTransfer, map) {
  4793. if (!isObject(rawTransfer))
  4794. throw TypeError('Transfer option cannot be converted to a sequence');
  4795. var transfer = [];
  4796. iterate(rawTransfer, function (value) {
  4797. push(transfer, anObject(value));
  4798. });
  4799. var i = 0;
  4800. var length = lengthOfArrayLike(transfer);
  4801. var value, type, C, transferredArray, transferred, canvas, context;
  4802. if (PROPER_TRANSFER) {
  4803. transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
  4804. while (i < length)
  4805. mapSet(map, transfer[i], transferredArray[i++]);
  4806. } else
  4807. while (i < length) {
  4808. value = transfer[i++];
  4809. if (mapHas(map, value))
  4810. throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
  4811. type = classof(value);
  4812. switch (type) {
  4813. case 'ImageBitmap':
  4814. C = global.OffscreenCanvas;
  4815. if (!isConstructor(C))
  4816. throwUnpolyfillable(type, TRANSFERRING);
  4817. try {
  4818. canvas = new C(value.width, value.height);
  4819. context = canvas.getContext('bitmaprenderer');
  4820. context.transferFromImageBitmap(value);
  4821. transferred = canvas.transferToImageBitmap();
  4822. } catch (error) {
  4823. }
  4824. break;
  4825. case 'AudioData':
  4826. case 'VideoFrame':
  4827. if (!isCallable(value.clone) || !isCallable(value.close))
  4828. throwUnpolyfillable(type, TRANSFERRING);
  4829. try {
  4830. transferred = value.clone();
  4831. value.close();
  4832. } catch (error) {
  4833. }
  4834. break;
  4835. case 'ArrayBuffer':
  4836. case 'MessagePort':
  4837. case 'OffscreenCanvas':
  4838. case 'ReadableStream':
  4839. case 'TransformStream':
  4840. case 'WritableStream':
  4841. throwUnpolyfillable(type, TRANSFERRING);
  4842. }
  4843. if (transferred === undefined)
  4844. throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
  4845. mapSet(map, value, transferred);
  4846. }
  4847. };
  4848. $({
  4849. global: true,
  4850. enumerable: true,
  4851. sham: !PROPER_TRANSFER,
  4852. forced: FORCED_REPLACEMENT
  4853. }, {
  4854. structuredClone: function structuredClone(value) {
  4855. var options = validateArgumentsLength(arguments.length, 1) > 1 && arguments[1] != null ? anObject(arguments[1]) : undefined;
  4856. var transfer = options ? options.transfer : undefined;
  4857. var map;
  4858. if (transfer !== undefined) {
  4859. map = new Map();
  4860. tryToTransfer(transfer, map);
  4861. }
  4862. return structuredCloneInternal(value, map);
  4863. }
  4864. });
  4865. /***/ }),
  4866. /* 153 */
  4867. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4868. var call = __w_pdfjs_require__(12);
  4869. var hasOwn = __w_pdfjs_require__(41);
  4870. var isPrototypeOf = __w_pdfjs_require__(27);
  4871. var regExpFlags = __w_pdfjs_require__(154);
  4872. var RegExpPrototype = RegExp.prototype;
  4873. module.exports = function (R) {
  4874. var flags = R.flags;
  4875. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags;
  4876. };
  4877. /***/ }),
  4878. /* 154 */
  4879. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4880. "use strict";
  4881. var anObject = __w_pdfjs_require__(49);
  4882. module.exports = function () {
  4883. var that = anObject(this);
  4884. var result = '';
  4885. if (that.hasIndices)
  4886. result += 'd';
  4887. if (that.global)
  4888. result += 'g';
  4889. if (that.ignoreCase)
  4890. result += 'i';
  4891. if (that.multiline)
  4892. result += 'm';
  4893. if (that.dotAll)
  4894. result += 's';
  4895. if (that.unicode)
  4896. result += 'u';
  4897. if (that.sticky)
  4898. result += 'y';
  4899. return result;
  4900. };
  4901. /***/ }),
  4902. /* 155 */
  4903. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4904. "use strict";
  4905. Object.defineProperty(exports, "__esModule", ({
  4906. value: true
  4907. }));
  4908. exports.build = exports.RenderTask = exports.PDFWorkerUtil = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0;
  4909. exports.getDocument = getDocument;
  4910. exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory;
  4911. exports.version = void 0;
  4912. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  4913. var _util = __w_pdfjs_require__(1);
  4914. var _display_utils = __w_pdfjs_require__(158);
  4915. var _font_loader = __w_pdfjs_require__(160);
  4916. var _annotation_storage = __w_pdfjs_require__(161);
  4917. var _canvas = __w_pdfjs_require__(163);
  4918. var _worker_options = __w_pdfjs_require__(166);
  4919. var _is_node = __w_pdfjs_require__(3);
  4920. var _message_handler = __w_pdfjs_require__(167);
  4921. var _metadata = __w_pdfjs_require__(168);
  4922. var _optional_content_config = __w_pdfjs_require__(169);
  4923. var _transport_stream = __w_pdfjs_require__(170);
  4924. var _xfa_text = __w_pdfjs_require__(171);
  4925. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4926. function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
  4927. function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
  4928. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  4929. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  4930. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  4931. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  4932. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  4933. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  4934. 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."); }
  4935. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  4936. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  4937. 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; } } }; }
  4938. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4939. 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); } }
  4940. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  4941. function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { _classCheckPrivateStaticAccess(receiver, classConstructor); _classCheckPrivateStaticFieldDescriptor(descriptor, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  4942. 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; } }
  4943. function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { _classCheckPrivateStaticAccess(receiver, classConstructor); _classCheckPrivateStaticFieldDescriptor(descriptor, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  4944. function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { if (descriptor === undefined) { throw new TypeError("attempted to " + action + " private static field before its declaration"); } }
  4945. function _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } }
  4946. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  4947. 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); } }
  4948. 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); }); }; }
  4949. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  4950. 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."); }
  4951. 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); }
  4952. 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; }
  4953. 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; }
  4954. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  4955. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  4956. var DEFAULT_RANGE_CHUNK_SIZE = 65536;
  4957. var RENDERING_CANCELLED_TIMEOUT = 100;
  4958. var DefaultCanvasFactory = _display_utils.DOMCanvasFactory;
  4959. exports.DefaultCanvasFactory = DefaultCanvasFactory;
  4960. var DefaultCMapReaderFactory = _display_utils.DOMCMapReaderFactory;
  4961. exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory;
  4962. var DefaultStandardFontDataFactory = _display_utils.DOMStandardFontDataFactory;
  4963. exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory;
  4964. if (_is_node.isNodeJS) {
  4965. var _require = __w_pdfjs_require__(172),
  4966. NodeCanvasFactory = _require.NodeCanvasFactory,
  4967. NodeCMapReaderFactory = _require.NodeCMapReaderFactory,
  4968. NodeStandardFontDataFactory = _require.NodeStandardFontDataFactory;
  4969. exports.DefaultCanvasFactory = DefaultCanvasFactory = NodeCanvasFactory;
  4970. exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory = NodeCMapReaderFactory;
  4971. exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory = NodeStandardFontDataFactory;
  4972. }
  4973. var createPDFNetworkStream;
  4974. function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
  4975. createPDFNetworkStream = pdfNetworkStreamFactory;
  4976. }
  4977. function getDocument(src) {
  4978. var task = new PDFDocumentLoadingTask();
  4979. var source;
  4980. if (typeof src === "string" || src instanceof URL) {
  4981. source = {
  4982. url: src
  4983. };
  4984. } else if ((0, _util.isArrayBuffer)(src)) {
  4985. source = {
  4986. data: src
  4987. };
  4988. } else if (src instanceof PDFDataRangeTransport) {
  4989. source = {
  4990. range: src
  4991. };
  4992. } else {
  4993. if (_typeof(src) !== "object") {
  4994. throw new Error("Invalid parameter in getDocument, " + "need either string, URL, Uint8Array, or parameter object.");
  4995. }
  4996. if (!src.url && !src.data && !src.range) {
  4997. throw new Error("Invalid parameter object: need either .data, .range or .url");
  4998. }
  4999. source = src;
  5000. }
  5001. var params = Object.create(null);
  5002. var rangeTransport = null,
  5003. worker = null;
  5004. for (var key in source) {
  5005. var value = source[key];
  5006. switch (key) {
  5007. case "url":
  5008. if (typeof window !== "undefined") {
  5009. try {
  5010. params[key] = new URL(value, window.location).href;
  5011. continue;
  5012. } catch (ex) {
  5013. (0, _util.warn)("Cannot create valid URL: \"".concat(ex, "\"."));
  5014. }
  5015. } else if (typeof value === "string" || value instanceof URL) {
  5016. params[key] = value.toString();
  5017. continue;
  5018. }
  5019. throw new Error("Invalid PDF url data: " + "either string or URL-object is expected in the url property.");
  5020. case "range":
  5021. rangeTransport = value;
  5022. continue;
  5023. case "worker":
  5024. worker = value;
  5025. continue;
  5026. case "data":
  5027. if (_is_node.isNodeJS && typeof Buffer !== "undefined" && value instanceof Buffer) {
  5028. params[key] = new Uint8Array(value);
  5029. } else if (value instanceof Uint8Array) {
  5030. break;
  5031. } else if (typeof value === "string") {
  5032. params[key] = (0, _util.stringToBytes)(value);
  5033. } else if (_typeof(value) === "object" && value !== null && !isNaN(value.length)) {
  5034. params[key] = new Uint8Array(value);
  5035. } else if ((0, _util.isArrayBuffer)(value)) {
  5036. params[key] = new Uint8Array(value);
  5037. } else {
  5038. throw new Error("Invalid PDF binary data: either typed array, " + "string, or array-like object is expected in the data property.");
  5039. }
  5040. continue;
  5041. }
  5042. params[key] = value;
  5043. }
  5044. params.CMapReaderFactory = params.CMapReaderFactory || DefaultCMapReaderFactory;
  5045. params.StandardFontDataFactory = params.StandardFontDataFactory || DefaultStandardFontDataFactory;
  5046. params.ignoreErrors = params.stopAtErrors !== true;
  5047. params.fontExtraProperties = params.fontExtraProperties === true;
  5048. params.pdfBug = params.pdfBug === true;
  5049. params.enableXfa = params.enableXfa === true;
  5050. if (!Number.isInteger(params.rangeChunkSize) || params.rangeChunkSize < 1) {
  5051. params.rangeChunkSize = DEFAULT_RANGE_CHUNK_SIZE;
  5052. }
  5053. if (typeof params.docBaseUrl !== "string" || (0, _display_utils.isDataScheme)(params.docBaseUrl)) {
  5054. params.docBaseUrl = null;
  5055. }
  5056. if (!Number.isInteger(params.maxImageSize) || params.maxImageSize < -1) {
  5057. params.maxImageSize = -1;
  5058. }
  5059. if (typeof params.cMapUrl !== "string") {
  5060. params.cMapUrl = null;
  5061. }
  5062. if (typeof params.standardFontDataUrl !== "string") {
  5063. params.standardFontDataUrl = null;
  5064. }
  5065. if (typeof params.useWorkerFetch !== "boolean") {
  5066. params.useWorkerFetch = params.CMapReaderFactory === _display_utils.DOMCMapReaderFactory && params.StandardFontDataFactory === _display_utils.DOMStandardFontDataFactory;
  5067. }
  5068. if (typeof params.isEvalSupported !== "boolean") {
  5069. params.isEvalSupported = true;
  5070. }
  5071. if (typeof params.disableFontFace !== "boolean") {
  5072. params.disableFontFace = _is_node.isNodeJS;
  5073. }
  5074. if (typeof params.useSystemFonts !== "boolean") {
  5075. params.useSystemFonts = !_is_node.isNodeJS && !params.disableFontFace;
  5076. }
  5077. if (_typeof(params.ownerDocument) !== "object" || params.ownerDocument === null) {
  5078. params.ownerDocument = globalThis.document;
  5079. }
  5080. if (typeof params.disableRange !== "boolean") {
  5081. params.disableRange = false;
  5082. }
  5083. if (typeof params.disableStream !== "boolean") {
  5084. params.disableStream = false;
  5085. }
  5086. if (typeof params.disableAutoFetch !== "boolean") {
  5087. params.disableAutoFetch = false;
  5088. }
  5089. (0, _util.setVerbosityLevel)(params.verbosity);
  5090. if (!worker) {
  5091. var workerParams = {
  5092. verbosity: params.verbosity,
  5093. port: _worker_options.GlobalWorkerOptions.workerPort
  5094. };
  5095. worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);
  5096. task._worker = worker;
  5097. }
  5098. var docId = task.docId;
  5099. worker.promise.then(function () {
  5100. if (task.destroyed) {
  5101. throw new Error("Loading aborted");
  5102. }
  5103. var workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId);
  5104. var networkStreamPromise = new Promise(function (resolve) {
  5105. var networkStream;
  5106. if (rangeTransport) {
  5107. networkStream = new _transport_stream.PDFDataTransportStream({
  5108. length: params.length,
  5109. initialData: params.initialData,
  5110. progressiveDone: params.progressiveDone,
  5111. contentDispositionFilename: params.contentDispositionFilename,
  5112. disableRange: params.disableRange,
  5113. disableStream: params.disableStream
  5114. }, rangeTransport);
  5115. } else if (!params.data) {
  5116. networkStream = createPDFNetworkStream({
  5117. url: params.url,
  5118. length: params.length,
  5119. httpHeaders: params.httpHeaders,
  5120. withCredentials: params.withCredentials,
  5121. rangeChunkSize: params.rangeChunkSize,
  5122. disableRange: params.disableRange,
  5123. disableStream: params.disableStream
  5124. });
  5125. }
  5126. resolve(networkStream);
  5127. });
  5128. return Promise.all([workerIdPromise, networkStreamPromise]).then(function (_ref) {
  5129. var _ref2 = _slicedToArray(_ref, 2),
  5130. workerId = _ref2[0],
  5131. networkStream = _ref2[1];
  5132. if (task.destroyed) {
  5133. throw new Error("Loading aborted");
  5134. }
  5135. var messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);
  5136. var transport = new WorkerTransport(messageHandler, task, networkStream, params);
  5137. task._transport = transport;
  5138. messageHandler.send("Ready", null);
  5139. });
  5140. })["catch"](task._capability.reject);
  5141. return task;
  5142. }
  5143. function _fetchDocument(_x, _x2, _x3, _x4) {
  5144. return _fetchDocument2.apply(this, arguments);
  5145. }
  5146. function _fetchDocument2() {
  5147. _fetchDocument2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee7(worker, source, pdfDataRangeTransport, docId) {
  5148. var workerId;
  5149. return _regenerator["default"].wrap(function _callee7$(_context7) {
  5150. while (1) {
  5151. switch (_context7.prev = _context7.next) {
  5152. case 0:
  5153. if (!worker.destroyed) {
  5154. _context7.next = 2;
  5155. break;
  5156. }
  5157. throw new Error("Worker was destroyed");
  5158. case 2:
  5159. if (pdfDataRangeTransport) {
  5160. source.length = pdfDataRangeTransport.length;
  5161. source.initialData = pdfDataRangeTransport.initialData;
  5162. source.progressiveDone = pdfDataRangeTransport.progressiveDone;
  5163. source.contentDispositionFilename = pdfDataRangeTransport.contentDispositionFilename;
  5164. }
  5165. _context7.next = 5;
  5166. return worker.messageHandler.sendWithPromise("GetDocRequest", {
  5167. docId: docId,
  5168. apiVersion: '2.14.305',
  5169. source: {
  5170. data: source.data,
  5171. url: source.url,
  5172. password: source.password,
  5173. disableAutoFetch: source.disableAutoFetch,
  5174. rangeChunkSize: source.rangeChunkSize,
  5175. length: source.length
  5176. },
  5177. maxImageSize: source.maxImageSize,
  5178. disableFontFace: source.disableFontFace,
  5179. docBaseUrl: source.docBaseUrl,
  5180. ignoreErrors: source.ignoreErrors,
  5181. isEvalSupported: source.isEvalSupported,
  5182. fontExtraProperties: source.fontExtraProperties,
  5183. enableXfa: source.enableXfa,
  5184. useSystemFonts: source.useSystemFonts,
  5185. cMapUrl: source.useWorkerFetch ? source.cMapUrl : null,
  5186. standardFontDataUrl: source.useWorkerFetch ? source.standardFontDataUrl : null
  5187. });
  5188. case 5:
  5189. workerId = _context7.sent;
  5190. if (!worker.destroyed) {
  5191. _context7.next = 8;
  5192. break;
  5193. }
  5194. throw new Error("Worker was destroyed");
  5195. case 8:
  5196. return _context7.abrupt("return", workerId);
  5197. case 9:
  5198. case "end":
  5199. return _context7.stop();
  5200. }
  5201. }
  5202. }, _callee7);
  5203. }));
  5204. return _fetchDocument2.apply(this, arguments);
  5205. }
  5206. var PDFDocumentLoadingTask = /*#__PURE__*/function () {
  5207. function PDFDocumentLoadingTask() {
  5208. var _PDFDocumentLoadingTa, _PDFDocumentLoadingTa2;
  5209. _classCallCheck(this, PDFDocumentLoadingTask);
  5210. this._capability = (0, _util.createPromiseCapability)();
  5211. this._transport = null;
  5212. this._worker = null;
  5213. this.docId = "d".concat((_classStaticPrivateFieldSpecSet(PDFDocumentLoadingTask, PDFDocumentLoadingTask, _docId, (_PDFDocumentLoadingTa = _classStaticPrivateFieldSpecGet(PDFDocumentLoadingTask, PDFDocumentLoadingTask, _docId), _PDFDocumentLoadingTa2 = _PDFDocumentLoadingTa++, _PDFDocumentLoadingTa)), _PDFDocumentLoadingTa2));
  5214. this.destroyed = false;
  5215. this.onPassword = null;
  5216. this.onProgress = null;
  5217. this.onUnsupportedFeature = null;
  5218. }
  5219. _createClass(PDFDocumentLoadingTask, [{
  5220. key: "promise",
  5221. get: function get() {
  5222. return this._capability.promise;
  5223. }
  5224. }, {
  5225. key: "destroy",
  5226. value: function () {
  5227. var _destroy = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  5228. var _this$_transport;
  5229. return _regenerator["default"].wrap(function _callee$(_context) {
  5230. while (1) {
  5231. switch (_context.prev = _context.next) {
  5232. case 0:
  5233. this.destroyed = true;
  5234. _context.next = 3;
  5235. return (_this$_transport = this._transport) === null || _this$_transport === void 0 ? void 0 : _this$_transport.destroy();
  5236. case 3:
  5237. this._transport = null;
  5238. if (this._worker) {
  5239. this._worker.destroy();
  5240. this._worker = null;
  5241. }
  5242. case 5:
  5243. case "end":
  5244. return _context.stop();
  5245. }
  5246. }
  5247. }, _callee, this);
  5248. }));
  5249. function destroy() {
  5250. return _destroy.apply(this, arguments);
  5251. }
  5252. return destroy;
  5253. }()
  5254. }]);
  5255. return PDFDocumentLoadingTask;
  5256. }();
  5257. exports.PDFDocumentLoadingTask = PDFDocumentLoadingTask;
  5258. var _docId = {
  5259. writable: true,
  5260. value: 0
  5261. };
  5262. var PDFDataRangeTransport = /*#__PURE__*/function () {
  5263. function PDFDataRangeTransport(length, initialData) {
  5264. var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  5265. var contentDispositionFilename = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  5266. _classCallCheck(this, PDFDataRangeTransport);
  5267. this.length = length;
  5268. this.initialData = initialData;
  5269. this.progressiveDone = progressiveDone;
  5270. this.contentDispositionFilename = contentDispositionFilename;
  5271. this._rangeListeners = [];
  5272. this._progressListeners = [];
  5273. this._progressiveReadListeners = [];
  5274. this._progressiveDoneListeners = [];
  5275. this._readyCapability = (0, _util.createPromiseCapability)();
  5276. }
  5277. _createClass(PDFDataRangeTransport, [{
  5278. key: "addRangeListener",
  5279. value: function addRangeListener(listener) {
  5280. this._rangeListeners.push(listener);
  5281. }
  5282. }, {
  5283. key: "addProgressListener",
  5284. value: function addProgressListener(listener) {
  5285. this._progressListeners.push(listener);
  5286. }
  5287. }, {
  5288. key: "addProgressiveReadListener",
  5289. value: function addProgressiveReadListener(listener) {
  5290. this._progressiveReadListeners.push(listener);
  5291. }
  5292. }, {
  5293. key: "addProgressiveDoneListener",
  5294. value: function addProgressiveDoneListener(listener) {
  5295. this._progressiveDoneListeners.push(listener);
  5296. }
  5297. }, {
  5298. key: "onDataRange",
  5299. value: function onDataRange(begin, chunk) {
  5300. var _iterator = _createForOfIteratorHelper(this._rangeListeners),
  5301. _step;
  5302. try {
  5303. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  5304. var listener = _step.value;
  5305. listener(begin, chunk);
  5306. }
  5307. } catch (err) {
  5308. _iterator.e(err);
  5309. } finally {
  5310. _iterator.f();
  5311. }
  5312. }
  5313. }, {
  5314. key: "onDataProgress",
  5315. value: function onDataProgress(loaded, total) {
  5316. var _this = this;
  5317. this._readyCapability.promise.then(function () {
  5318. var _iterator2 = _createForOfIteratorHelper(_this._progressListeners),
  5319. _step2;
  5320. try {
  5321. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5322. var listener = _step2.value;
  5323. listener(loaded, total);
  5324. }
  5325. } catch (err) {
  5326. _iterator2.e(err);
  5327. } finally {
  5328. _iterator2.f();
  5329. }
  5330. });
  5331. }
  5332. }, {
  5333. key: "onDataProgressiveRead",
  5334. value: function onDataProgressiveRead(chunk) {
  5335. var _this2 = this;
  5336. this._readyCapability.promise.then(function () {
  5337. var _iterator3 = _createForOfIteratorHelper(_this2._progressiveReadListeners),
  5338. _step3;
  5339. try {
  5340. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  5341. var listener = _step3.value;
  5342. listener(chunk);
  5343. }
  5344. } catch (err) {
  5345. _iterator3.e(err);
  5346. } finally {
  5347. _iterator3.f();
  5348. }
  5349. });
  5350. }
  5351. }, {
  5352. key: "onDataProgressiveDone",
  5353. value: function onDataProgressiveDone() {
  5354. var _this3 = this;
  5355. this._readyCapability.promise.then(function () {
  5356. var _iterator4 = _createForOfIteratorHelper(_this3._progressiveDoneListeners),
  5357. _step4;
  5358. try {
  5359. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  5360. var listener = _step4.value;
  5361. listener();
  5362. }
  5363. } catch (err) {
  5364. _iterator4.e(err);
  5365. } finally {
  5366. _iterator4.f();
  5367. }
  5368. });
  5369. }
  5370. }, {
  5371. key: "transportReady",
  5372. value: function transportReady() {
  5373. this._readyCapability.resolve();
  5374. }
  5375. }, {
  5376. key: "requestDataRange",
  5377. value: function requestDataRange(begin, end) {
  5378. (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange");
  5379. }
  5380. }, {
  5381. key: "abort",
  5382. value: function abort() {}
  5383. }]);
  5384. return PDFDataRangeTransport;
  5385. }();
  5386. exports.PDFDataRangeTransport = PDFDataRangeTransport;
  5387. var PDFDocumentProxy = /*#__PURE__*/function () {
  5388. function PDFDocumentProxy(pdfInfo, transport) {
  5389. var _this4 = this;
  5390. _classCallCheck(this, PDFDocumentProxy);
  5391. this._pdfInfo = pdfInfo;
  5392. this._transport = transport;
  5393. Object.defineProperty(this, "fingerprint", {
  5394. get: function get() {
  5395. (0, _display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, " + "please use `PDFDocumentProxy.fingerprints` instead.");
  5396. return this.fingerprints[0];
  5397. }
  5398. });
  5399. Object.defineProperty(this, "getStats", {
  5400. value: function () {
  5401. var _value = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  5402. return _regenerator["default"].wrap(function _callee2$(_context2) {
  5403. while (1) {
  5404. switch (_context2.prev = _context2.next) {
  5405. case 0:
  5406. (0, _display_utils.deprecated)("`PDFDocumentProxy.getStats`, " + "please use the `PDFDocumentProxy.stats`-getter instead.");
  5407. return _context2.abrupt("return", _this4.stats || {
  5408. streamTypes: {},
  5409. fontTypes: {}
  5410. });
  5411. case 2:
  5412. case "end":
  5413. return _context2.stop();
  5414. }
  5415. }
  5416. }, _callee2);
  5417. }));
  5418. function value() {
  5419. return _value.apply(this, arguments);
  5420. }
  5421. return value;
  5422. }()
  5423. });
  5424. }
  5425. _createClass(PDFDocumentProxy, [{
  5426. key: "annotationStorage",
  5427. get: function get() {
  5428. return this._transport.annotationStorage;
  5429. }
  5430. }, {
  5431. key: "numPages",
  5432. get: function get() {
  5433. return this._pdfInfo.numPages;
  5434. }
  5435. }, {
  5436. key: "fingerprints",
  5437. get: function get() {
  5438. return this._pdfInfo.fingerprints;
  5439. }
  5440. }, {
  5441. key: "stats",
  5442. get: function get() {
  5443. return this._transport.stats;
  5444. }
  5445. }, {
  5446. key: "isPureXfa",
  5447. get: function get() {
  5448. return !!this._transport._htmlForXfa;
  5449. }
  5450. }, {
  5451. key: "allXfaHtml",
  5452. get: function get() {
  5453. return this._transport._htmlForXfa;
  5454. }
  5455. }, {
  5456. key: "getPage",
  5457. value: function getPage(pageNumber) {
  5458. return this._transport.getPage(pageNumber);
  5459. }
  5460. }, {
  5461. key: "getPageIndex",
  5462. value: function getPageIndex(ref) {
  5463. return this._transport.getPageIndex(ref);
  5464. }
  5465. }, {
  5466. key: "getDestinations",
  5467. value: function getDestinations() {
  5468. return this._transport.getDestinations();
  5469. }
  5470. }, {
  5471. key: "getDestination",
  5472. value: function getDestination(id) {
  5473. return this._transport.getDestination(id);
  5474. }
  5475. }, {
  5476. key: "getPageLabels",
  5477. value: function getPageLabels() {
  5478. return this._transport.getPageLabels();
  5479. }
  5480. }, {
  5481. key: "getPageLayout",
  5482. value: function getPageLayout() {
  5483. return this._transport.getPageLayout();
  5484. }
  5485. }, {
  5486. key: "getPageMode",
  5487. value: function getPageMode() {
  5488. return this._transport.getPageMode();
  5489. }
  5490. }, {
  5491. key: "getViewerPreferences",
  5492. value: function getViewerPreferences() {
  5493. return this._transport.getViewerPreferences();
  5494. }
  5495. }, {
  5496. key: "getOpenAction",
  5497. value: function getOpenAction() {
  5498. return this._transport.getOpenAction();
  5499. }
  5500. }, {
  5501. key: "getAttachments",
  5502. value: function getAttachments() {
  5503. return this._transport.getAttachments();
  5504. }
  5505. }, {
  5506. key: "getJavaScript",
  5507. value: function getJavaScript() {
  5508. return this._transport.getJavaScript();
  5509. }
  5510. }, {
  5511. key: "getJSActions",
  5512. value: function getJSActions() {
  5513. return this._transport.getDocJSActions();
  5514. }
  5515. }, {
  5516. key: "getOutline",
  5517. value: function getOutline() {
  5518. return this._transport.getOutline();
  5519. }
  5520. }, {
  5521. key: "getOptionalContentConfig",
  5522. value: function getOptionalContentConfig() {
  5523. return this._transport.getOptionalContentConfig();
  5524. }
  5525. }, {
  5526. key: "getPermissions",
  5527. value: function getPermissions() {
  5528. return this._transport.getPermissions();
  5529. }
  5530. }, {
  5531. key: "getMetadata",
  5532. value: function getMetadata() {
  5533. return this._transport.getMetadata();
  5534. }
  5535. }, {
  5536. key: "getMarkInfo",
  5537. value: function getMarkInfo() {
  5538. return this._transport.getMarkInfo();
  5539. }
  5540. }, {
  5541. key: "getData",
  5542. value: function getData() {
  5543. return this._transport.getData();
  5544. }
  5545. }, {
  5546. key: "getDownloadInfo",
  5547. value: function getDownloadInfo() {
  5548. return this._transport.downloadInfoCapability.promise;
  5549. }
  5550. }, {
  5551. key: "cleanup",
  5552. value: function cleanup() {
  5553. var keepLoadedFonts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5554. return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
  5555. }
  5556. }, {
  5557. key: "destroy",
  5558. value: function destroy() {
  5559. return this.loadingTask.destroy();
  5560. }
  5561. }, {
  5562. key: "loadingParams",
  5563. get: function get() {
  5564. return this._transport.loadingParams;
  5565. }
  5566. }, {
  5567. key: "loadingTask",
  5568. get: function get() {
  5569. return this._transport.loadingTask;
  5570. }
  5571. }, {
  5572. key: "saveDocument",
  5573. value: function saveDocument() {
  5574. if (this._transport.annotationStorage.size <= 0) {
  5575. (0, _display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead.");
  5576. }
  5577. return this._transport.saveDocument();
  5578. }
  5579. }, {
  5580. key: "getFieldObjects",
  5581. value: function getFieldObjects() {
  5582. return this._transport.getFieldObjects();
  5583. }
  5584. }, {
  5585. key: "hasJSActions",
  5586. value: function hasJSActions() {
  5587. return this._transport.hasJSActions();
  5588. }
  5589. }, {
  5590. key: "getCalculationOrderIds",
  5591. value: function getCalculationOrderIds() {
  5592. return this._transport.getCalculationOrderIds();
  5593. }
  5594. }]);
  5595. return PDFDocumentProxy;
  5596. }();
  5597. exports.PDFDocumentProxy = PDFDocumentProxy;
  5598. var PDFPageProxy = /*#__PURE__*/function () {
  5599. function PDFPageProxy(pageIndex, pageInfo, transport, ownerDocument) {
  5600. var pdfBug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  5601. _classCallCheck(this, PDFPageProxy);
  5602. this._pageIndex = pageIndex;
  5603. this._pageInfo = pageInfo;
  5604. this._ownerDocument = ownerDocument;
  5605. this._transport = transport;
  5606. this._stats = pdfBug ? new _display_utils.StatTimer() : null;
  5607. this._pdfBug = pdfBug;
  5608. this.commonObjs = transport.commonObjs;
  5609. this.objs = new PDFObjects();
  5610. this._bitmaps = new Set();
  5611. this.cleanupAfterRender = false;
  5612. this.pendingCleanup = false;
  5613. this._intentStates = new Map();
  5614. this._annotationPromises = new Map();
  5615. this.destroyed = false;
  5616. }
  5617. _createClass(PDFPageProxy, [{
  5618. key: "pageNumber",
  5619. get: function get() {
  5620. return this._pageIndex + 1;
  5621. }
  5622. }, {
  5623. key: "rotate",
  5624. get: function get() {
  5625. return this._pageInfo.rotate;
  5626. }
  5627. }, {
  5628. key: "ref",
  5629. get: function get() {
  5630. return this._pageInfo.ref;
  5631. }
  5632. }, {
  5633. key: "userUnit",
  5634. get: function get() {
  5635. return this._pageInfo.userUnit;
  5636. }
  5637. }, {
  5638. key: "view",
  5639. get: function get() {
  5640. return this._pageInfo.view;
  5641. }
  5642. }, {
  5643. key: "getViewport",
  5644. value: function getViewport() {
  5645. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5646. scale = _ref3.scale,
  5647. _ref3$rotation = _ref3.rotation,
  5648. rotation = _ref3$rotation === void 0 ? this.rotate : _ref3$rotation,
  5649. _ref3$offsetX = _ref3.offsetX,
  5650. offsetX = _ref3$offsetX === void 0 ? 0 : _ref3$offsetX,
  5651. _ref3$offsetY = _ref3.offsetY,
  5652. offsetY = _ref3$offsetY === void 0 ? 0 : _ref3$offsetY,
  5653. _ref3$dontFlip = _ref3.dontFlip,
  5654. dontFlip = _ref3$dontFlip === void 0 ? false : _ref3$dontFlip;
  5655. return new _display_utils.PageViewport({
  5656. viewBox: this.view,
  5657. scale: scale,
  5658. rotation: rotation,
  5659. offsetX: offsetX,
  5660. offsetY: offsetY,
  5661. dontFlip: dontFlip
  5662. });
  5663. }
  5664. }, {
  5665. key: "getAnnotations",
  5666. value: function getAnnotations() {
  5667. var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5668. _ref4$intent = _ref4.intent,
  5669. intent = _ref4$intent === void 0 ? "display" : _ref4$intent;
  5670. var intentArgs = this._transport.getRenderingIntent(intent);
  5671. var promise = this._annotationPromises.get(intentArgs.cacheKey);
  5672. if (!promise) {
  5673. promise = this._transport.getAnnotations(this._pageIndex, intentArgs.renderingIntent);
  5674. this._annotationPromises.set(intentArgs.cacheKey, promise);
  5675. promise = promise.then(function (annotations) {
  5676. var _iterator5 = _createForOfIteratorHelper(annotations),
  5677. _step5;
  5678. try {
  5679. var _loop = function _loop() {
  5680. var annotation = _step5.value;
  5681. if (annotation.titleObj !== undefined) {
  5682. Object.defineProperty(annotation, "title", {
  5683. get: function get() {
  5684. (0, _display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead.");
  5685. return annotation.titleObj.str;
  5686. }
  5687. });
  5688. }
  5689. if (annotation.contentsObj !== undefined) {
  5690. Object.defineProperty(annotation, "contents", {
  5691. get: function get() {
  5692. (0, _display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead.");
  5693. return annotation.contentsObj.str;
  5694. }
  5695. });
  5696. }
  5697. };
  5698. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  5699. _loop();
  5700. }
  5701. } catch (err) {
  5702. _iterator5.e(err);
  5703. } finally {
  5704. _iterator5.f();
  5705. }
  5706. return annotations;
  5707. });
  5708. }
  5709. return promise;
  5710. }
  5711. }, {
  5712. key: "getJSActions",
  5713. value: function getJSActions() {
  5714. return this._jsActionsPromise || (this._jsActionsPromise = this._transport.getPageJSActions(this._pageIndex));
  5715. }
  5716. }, {
  5717. key: "getXfa",
  5718. value: function () {
  5719. var _getXfa = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
  5720. var _this$_transport$_htm;
  5721. return _regenerator["default"].wrap(function _callee3$(_context3) {
  5722. while (1) {
  5723. switch (_context3.prev = _context3.next) {
  5724. case 0:
  5725. return _context3.abrupt("return", ((_this$_transport$_htm = this._transport._htmlForXfa) === null || _this$_transport$_htm === void 0 ? void 0 : _this$_transport$_htm.children[this._pageIndex]) || null);
  5726. case 1:
  5727. case "end":
  5728. return _context3.stop();
  5729. }
  5730. }
  5731. }, _callee3, this);
  5732. }));
  5733. function getXfa() {
  5734. return _getXfa.apply(this, arguments);
  5735. }
  5736. return getXfa;
  5737. }()
  5738. }, {
  5739. key: "render",
  5740. value: function render(_ref5) {
  5741. var _arguments$,
  5742. _arguments$2,
  5743. _this5 = this,
  5744. _intentState;
  5745. var canvasContext = _ref5.canvasContext,
  5746. viewport = _ref5.viewport,
  5747. _ref5$intent = _ref5.intent,
  5748. intent = _ref5$intent === void 0 ? "display" : _ref5$intent,
  5749. _ref5$annotationMode = _ref5.annotationMode,
  5750. annotationMode = _ref5$annotationMode === void 0 ? _util.AnnotationMode.ENABLE : _ref5$annotationMode,
  5751. _ref5$transform = _ref5.transform,
  5752. transform = _ref5$transform === void 0 ? null : _ref5$transform,
  5753. _ref5$imageLayer = _ref5.imageLayer,
  5754. imageLayer = _ref5$imageLayer === void 0 ? null : _ref5$imageLayer,
  5755. _ref5$canvasFactory = _ref5.canvasFactory,
  5756. canvasFactory = _ref5$canvasFactory === void 0 ? null : _ref5$canvasFactory,
  5757. _ref5$background = _ref5.background,
  5758. background = _ref5$background === void 0 ? null : _ref5$background,
  5759. _ref5$optionalContent = _ref5.optionalContentConfigPromise,
  5760. optionalContentConfigPromise = _ref5$optionalContent === void 0 ? null : _ref5$optionalContent,
  5761. _ref5$annotationCanva = _ref5.annotationCanvasMap,
  5762. annotationCanvasMap = _ref5$annotationCanva === void 0 ? null : _ref5$annotationCanva,
  5763. _ref5$pageColors = _ref5.pageColors,
  5764. pageColors = _ref5$pageColors === void 0 ? null : _ref5$pageColors;
  5765. if (((_arguments$ = arguments[0]) === null || _arguments$ === void 0 ? void 0 : _arguments$.renderInteractiveForms) !== undefined) {
  5766. (0, _display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, " + "please use the `annotationMode`-option instead.");
  5767. if (arguments[0].renderInteractiveForms === true && annotationMode === _util.AnnotationMode.ENABLE) {
  5768. annotationMode = _util.AnnotationMode.ENABLE_FORMS;
  5769. }
  5770. }
  5771. if (((_arguments$2 = arguments[0]) === null || _arguments$2 === void 0 ? void 0 : _arguments$2.includeAnnotationStorage) !== undefined) {
  5772. (0, _display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, " + "please use the `annotationMode`-option instead.");
  5773. if (arguments[0].includeAnnotationStorage === true && annotationMode === _util.AnnotationMode.ENABLE) {
  5774. annotationMode = _util.AnnotationMode.ENABLE_STORAGE;
  5775. }
  5776. }
  5777. if (this._stats) {
  5778. this._stats.time("Overall");
  5779. }
  5780. var intentArgs = this._transport.getRenderingIntent(intent, annotationMode);
  5781. this.pendingCleanup = false;
  5782. if (!optionalContentConfigPromise) {
  5783. optionalContentConfigPromise = this._transport.getOptionalContentConfig();
  5784. }
  5785. var intentState = this._intentStates.get(intentArgs.cacheKey);
  5786. if (!intentState) {
  5787. intentState = Object.create(null);
  5788. this._intentStates.set(intentArgs.cacheKey, intentState);
  5789. }
  5790. if (intentState.streamReaderCancelTimeout) {
  5791. clearTimeout(intentState.streamReaderCancelTimeout);
  5792. intentState.streamReaderCancelTimeout = null;
  5793. }
  5794. var canvasFactoryInstance = canvasFactory || new DefaultCanvasFactory({
  5795. ownerDocument: this._ownerDocument
  5796. });
  5797. var intentPrint = !!(intentArgs.renderingIntent & _util.RenderingIntentFlag.PRINT);
  5798. if (!intentState.displayReadyCapability) {
  5799. intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
  5800. intentState.operatorList = {
  5801. fnArray: [],
  5802. argsArray: [],
  5803. lastChunk: false
  5804. };
  5805. if (this._stats) {
  5806. this._stats.time("Page Request");
  5807. }
  5808. this._pumpOperatorList(intentArgs);
  5809. }
  5810. var complete = function complete(error) {
  5811. intentState.renderTasks["delete"](internalRenderTask);
  5812. if (_this5.cleanupAfterRender || intentPrint) {
  5813. _this5.pendingCleanup = true;
  5814. }
  5815. _this5._tryCleanup();
  5816. if (error) {
  5817. internalRenderTask.capability.reject(error);
  5818. _this5._abortOperatorList({
  5819. intentState: intentState,
  5820. reason: error instanceof Error ? error : new Error(error)
  5821. });
  5822. } else {
  5823. internalRenderTask.capability.resolve();
  5824. }
  5825. if (_this5._stats) {
  5826. _this5._stats.timeEnd("Rendering");
  5827. _this5._stats.timeEnd("Overall");
  5828. }
  5829. };
  5830. var internalRenderTask = new InternalRenderTask({
  5831. callback: complete,
  5832. params: {
  5833. canvasContext: canvasContext,
  5834. viewport: viewport,
  5835. transform: transform,
  5836. imageLayer: imageLayer,
  5837. background: background
  5838. },
  5839. objs: this.objs,
  5840. commonObjs: this.commonObjs,
  5841. annotationCanvasMap: annotationCanvasMap,
  5842. operatorList: intentState.operatorList,
  5843. pageIndex: this._pageIndex,
  5844. canvasFactory: canvasFactoryInstance,
  5845. useRequestAnimationFrame: !intentPrint,
  5846. pdfBug: this._pdfBug,
  5847. pageColors: pageColors
  5848. });
  5849. ((_intentState = intentState).renderTasks || (_intentState.renderTasks = new Set())).add(internalRenderTask);
  5850. var renderTask = internalRenderTask.task;
  5851. Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(function (_ref6) {
  5852. var _ref7 = _slicedToArray(_ref6, 2),
  5853. transparency = _ref7[0],
  5854. optionalContentConfig = _ref7[1];
  5855. if (_this5.pendingCleanup) {
  5856. complete();
  5857. return;
  5858. }
  5859. if (_this5._stats) {
  5860. _this5._stats.time("Rendering");
  5861. }
  5862. internalRenderTask.initializeGraphics({
  5863. transparency: transparency,
  5864. optionalContentConfig: optionalContentConfig
  5865. });
  5866. internalRenderTask.operatorListChanged();
  5867. })["catch"](complete);
  5868. return renderTask;
  5869. }
  5870. }, {
  5871. key: "getOperatorList",
  5872. value: function getOperatorList() {
  5873. var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5874. _ref8$intent = _ref8.intent,
  5875. intent = _ref8$intent === void 0 ? "display" : _ref8$intent,
  5876. _ref8$annotationMode = _ref8.annotationMode,
  5877. annotationMode = _ref8$annotationMode === void 0 ? _util.AnnotationMode.ENABLE : _ref8$annotationMode;
  5878. function operatorListChanged() {
  5879. if (intentState.operatorList.lastChunk) {
  5880. intentState.opListReadCapability.resolve(intentState.operatorList);
  5881. intentState.renderTasks["delete"](opListTask);
  5882. }
  5883. }
  5884. var intentArgs = this._transport.getRenderingIntent(intent, annotationMode, true);
  5885. var intentState = this._intentStates.get(intentArgs.cacheKey);
  5886. if (!intentState) {
  5887. intentState = Object.create(null);
  5888. this._intentStates.set(intentArgs.cacheKey, intentState);
  5889. }
  5890. var opListTask;
  5891. if (!intentState.opListReadCapability) {
  5892. var _intentState2;
  5893. opListTask = Object.create(null);
  5894. opListTask.operatorListChanged = operatorListChanged;
  5895. intentState.opListReadCapability = (0, _util.createPromiseCapability)();
  5896. ((_intentState2 = intentState).renderTasks || (_intentState2.renderTasks = new Set())).add(opListTask);
  5897. intentState.operatorList = {
  5898. fnArray: [],
  5899. argsArray: [],
  5900. lastChunk: false
  5901. };
  5902. if (this._stats) {
  5903. this._stats.time("Page Request");
  5904. }
  5905. this._pumpOperatorList(intentArgs);
  5906. }
  5907. return intentState.opListReadCapability.promise;
  5908. }
  5909. }, {
  5910. key: "streamTextContent",
  5911. value: function streamTextContent() {
  5912. var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  5913. _ref9$disableCombineT = _ref9.disableCombineTextItems,
  5914. disableCombineTextItems = _ref9$disableCombineT === void 0 ? false : _ref9$disableCombineT,
  5915. _ref9$includeMarkedCo = _ref9.includeMarkedContent,
  5916. includeMarkedContent = _ref9$includeMarkedCo === void 0 ? false : _ref9$includeMarkedCo;
  5917. var TEXT_CONTENT_CHUNK_SIZE = 100;
  5918. return this._transport.messageHandler.sendWithStream("GetTextContent", {
  5919. pageIndex: this._pageIndex,
  5920. combineTextItems: disableCombineTextItems !== true,
  5921. includeMarkedContent: includeMarkedContent === true
  5922. }, {
  5923. highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
  5924. size: function size(textContent) {
  5925. return textContent.items.length;
  5926. }
  5927. });
  5928. }
  5929. }, {
  5930. key: "getTextContent",
  5931. value: function getTextContent() {
  5932. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  5933. if (this._transport._htmlForXfa) {
  5934. return this.getXfa().then(function (xfa) {
  5935. return _xfa_text.XfaText.textContent(xfa);
  5936. });
  5937. }
  5938. var readableStream = this.streamTextContent(params);
  5939. return new Promise(function (resolve, reject) {
  5940. function pump() {
  5941. reader.read().then(function (_ref10) {
  5942. var _textContent$items;
  5943. var value = _ref10.value,
  5944. done = _ref10.done;
  5945. if (done) {
  5946. resolve(textContent);
  5947. return;
  5948. }
  5949. Object.assign(textContent.styles, value.styles);
  5950. (_textContent$items = textContent.items).push.apply(_textContent$items, _toConsumableArray(value.items));
  5951. pump();
  5952. }, reject);
  5953. }
  5954. var reader = readableStream.getReader();
  5955. var textContent = {
  5956. items: [],
  5957. styles: Object.create(null)
  5958. };
  5959. pump();
  5960. });
  5961. }
  5962. }, {
  5963. key: "getStructTree",
  5964. value: function getStructTree() {
  5965. return this._structTreePromise || (this._structTreePromise = this._transport.getStructTree(this._pageIndex));
  5966. }
  5967. }, {
  5968. key: "_destroy",
  5969. value: function _destroy() {
  5970. this.destroyed = true;
  5971. var waitOn = [];
  5972. var _iterator6 = _createForOfIteratorHelper(this._intentStates.values()),
  5973. _step6;
  5974. try {
  5975. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  5976. var intentState = _step6.value;
  5977. this._abortOperatorList({
  5978. intentState: intentState,
  5979. reason: new Error("Page was destroyed."),
  5980. force: true
  5981. });
  5982. if (intentState.opListReadCapability) {
  5983. continue;
  5984. }
  5985. var _iterator8 = _createForOfIteratorHelper(intentState.renderTasks),
  5986. _step8;
  5987. try {
  5988. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  5989. var internalRenderTask = _step8.value;
  5990. waitOn.push(internalRenderTask.completed);
  5991. internalRenderTask.cancel();
  5992. }
  5993. } catch (err) {
  5994. _iterator8.e(err);
  5995. } finally {
  5996. _iterator8.f();
  5997. }
  5998. }
  5999. } catch (err) {
  6000. _iterator6.e(err);
  6001. } finally {
  6002. _iterator6.f();
  6003. }
  6004. this.objs.clear();
  6005. var _iterator7 = _createForOfIteratorHelper(this._bitmaps),
  6006. _step7;
  6007. try {
  6008. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  6009. var bitmap = _step7.value;
  6010. bitmap.close();
  6011. }
  6012. } catch (err) {
  6013. _iterator7.e(err);
  6014. } finally {
  6015. _iterator7.f();
  6016. }
  6017. this._bitmaps.clear();
  6018. this._annotationPromises.clear();
  6019. this._jsActionsPromise = null;
  6020. this._structTreePromise = null;
  6021. this.pendingCleanup = false;
  6022. return Promise.all(waitOn);
  6023. }
  6024. }, {
  6025. key: "cleanup",
  6026. value: function cleanup() {
  6027. var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  6028. this.pendingCleanup = true;
  6029. return this._tryCleanup(resetStats);
  6030. }
  6031. }, {
  6032. key: "_tryCleanup",
  6033. value: function _tryCleanup() {
  6034. var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  6035. if (!this.pendingCleanup) {
  6036. return false;
  6037. }
  6038. var _iterator9 = _createForOfIteratorHelper(this._intentStates.values()),
  6039. _step9;
  6040. try {
  6041. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  6042. var _step9$value = _step9.value,
  6043. renderTasks = _step9$value.renderTasks,
  6044. operatorList = _step9$value.operatorList;
  6045. if (renderTasks.size > 0 || !operatorList.lastChunk) {
  6046. return false;
  6047. }
  6048. }
  6049. } catch (err) {
  6050. _iterator9.e(err);
  6051. } finally {
  6052. _iterator9.f();
  6053. }
  6054. this._intentStates.clear();
  6055. this.objs.clear();
  6056. this._annotationPromises.clear();
  6057. this._jsActionsPromise = null;
  6058. this._structTreePromise = null;
  6059. if (resetStats && this._stats) {
  6060. this._stats = new _display_utils.StatTimer();
  6061. }
  6062. var _iterator10 = _createForOfIteratorHelper(this._bitmaps),
  6063. _step10;
  6064. try {
  6065. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  6066. var bitmap = _step10.value;
  6067. bitmap.close();
  6068. }
  6069. } catch (err) {
  6070. _iterator10.e(err);
  6071. } finally {
  6072. _iterator10.f();
  6073. }
  6074. this._bitmaps.clear();
  6075. this.pendingCleanup = false;
  6076. return true;
  6077. }
  6078. }, {
  6079. key: "_startRenderPage",
  6080. value: function _startRenderPage(transparency, cacheKey) {
  6081. var intentState = this._intentStates.get(cacheKey);
  6082. if (!intentState) {
  6083. return;
  6084. }
  6085. if (this._stats) {
  6086. this._stats.timeEnd("Page Request");
  6087. }
  6088. if (intentState.displayReadyCapability) {
  6089. intentState.displayReadyCapability.resolve(transparency);
  6090. }
  6091. }
  6092. }, {
  6093. key: "_renderPageChunk",
  6094. value: function _renderPageChunk(operatorListChunk, intentState) {
  6095. for (var i = 0, ii = operatorListChunk.length; i < ii; i++) {
  6096. intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
  6097. intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
  6098. }
  6099. intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
  6100. var _iterator11 = _createForOfIteratorHelper(intentState.renderTasks),
  6101. _step11;
  6102. try {
  6103. for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
  6104. var internalRenderTask = _step11.value;
  6105. internalRenderTask.operatorListChanged();
  6106. }
  6107. } catch (err) {
  6108. _iterator11.e(err);
  6109. } finally {
  6110. _iterator11.f();
  6111. }
  6112. if (operatorListChunk.lastChunk) {
  6113. this._tryCleanup();
  6114. }
  6115. }
  6116. }, {
  6117. key: "_pumpOperatorList",
  6118. value: function _pumpOperatorList(_ref11) {
  6119. var _this6 = this;
  6120. var renderingIntent = _ref11.renderingIntent,
  6121. cacheKey = _ref11.cacheKey;
  6122. var readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
  6123. pageIndex: this._pageIndex,
  6124. intent: renderingIntent,
  6125. cacheKey: cacheKey,
  6126. annotationStorage: renderingIntent & _util.RenderingIntentFlag.ANNOTATIONS_STORAGE ? this._transport.annotationStorage.serializable : null
  6127. });
  6128. var reader = readableStream.getReader();
  6129. var intentState = this._intentStates.get(cacheKey);
  6130. intentState.streamReader = reader;
  6131. var pump = function pump() {
  6132. reader.read().then(function (_ref12) {
  6133. var value = _ref12.value,
  6134. done = _ref12.done;
  6135. if (done) {
  6136. intentState.streamReader = null;
  6137. return;
  6138. }
  6139. if (_this6._transport.destroyed) {
  6140. return;
  6141. }
  6142. _this6._renderPageChunk(value, intentState);
  6143. pump();
  6144. }, function (reason) {
  6145. intentState.streamReader = null;
  6146. if (_this6._transport.destroyed) {
  6147. return;
  6148. }
  6149. if (intentState.operatorList) {
  6150. intentState.operatorList.lastChunk = true;
  6151. var _iterator12 = _createForOfIteratorHelper(intentState.renderTasks),
  6152. _step12;
  6153. try {
  6154. for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
  6155. var internalRenderTask = _step12.value;
  6156. internalRenderTask.operatorListChanged();
  6157. }
  6158. } catch (err) {
  6159. _iterator12.e(err);
  6160. } finally {
  6161. _iterator12.f();
  6162. }
  6163. _this6._tryCleanup();
  6164. }
  6165. if (intentState.displayReadyCapability) {
  6166. intentState.displayReadyCapability.reject(reason);
  6167. } else if (intentState.opListReadCapability) {
  6168. intentState.opListReadCapability.reject(reason);
  6169. } else {
  6170. throw reason;
  6171. }
  6172. });
  6173. };
  6174. pump();
  6175. }
  6176. }, {
  6177. key: "_abortOperatorList",
  6178. value: function _abortOperatorList(_ref13) {
  6179. var _this7 = this;
  6180. var intentState = _ref13.intentState,
  6181. reason = _ref13.reason,
  6182. _ref13$force = _ref13.force,
  6183. force = _ref13$force === void 0 ? false : _ref13$force;
  6184. if (!intentState.streamReader) {
  6185. return;
  6186. }
  6187. if (!force) {
  6188. if (intentState.renderTasks.size > 0) {
  6189. return;
  6190. }
  6191. if (reason instanceof _display_utils.RenderingCancelledException) {
  6192. intentState.streamReaderCancelTimeout = setTimeout(function () {
  6193. _this7._abortOperatorList({
  6194. intentState: intentState,
  6195. reason: reason,
  6196. force: true
  6197. });
  6198. intentState.streamReaderCancelTimeout = null;
  6199. }, RENDERING_CANCELLED_TIMEOUT);
  6200. return;
  6201. }
  6202. }
  6203. intentState.streamReader.cancel(new _util.AbortException(reason.message))["catch"](function () {});
  6204. intentState.streamReader = null;
  6205. if (this._transport.destroyed) {
  6206. return;
  6207. }
  6208. var _iterator13 = _createForOfIteratorHelper(this._intentStates),
  6209. _step13;
  6210. try {
  6211. for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
  6212. var _step13$value = _slicedToArray(_step13.value, 2),
  6213. curCacheKey = _step13$value[0],
  6214. curIntentState = _step13$value[1];
  6215. if (curIntentState === intentState) {
  6216. this._intentStates["delete"](curCacheKey);
  6217. break;
  6218. }
  6219. }
  6220. } catch (err) {
  6221. _iterator13.e(err);
  6222. } finally {
  6223. _iterator13.f();
  6224. }
  6225. this.cleanup();
  6226. }
  6227. }, {
  6228. key: "stats",
  6229. get: function get() {
  6230. return this._stats;
  6231. }
  6232. }]);
  6233. return PDFPageProxy;
  6234. }();
  6235. exports.PDFPageProxy = PDFPageProxy;
  6236. var LoopbackPort = /*#__PURE__*/function () {
  6237. function LoopbackPort() {
  6238. _classCallCheck(this, LoopbackPort);
  6239. this._listeners = [];
  6240. this._deferred = Promise.resolve();
  6241. }
  6242. _createClass(LoopbackPort, [{
  6243. key: "postMessage",
  6244. value: function postMessage(obj, transfers) {
  6245. var _this8 = this;
  6246. var event = {
  6247. data: structuredClone(obj, transfers)
  6248. };
  6249. this._deferred.then(function () {
  6250. var _iterator14 = _createForOfIteratorHelper(_this8._listeners),
  6251. _step14;
  6252. try {
  6253. for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
  6254. var listener = _step14.value;
  6255. listener.call(_this8, event);
  6256. }
  6257. } catch (err) {
  6258. _iterator14.e(err);
  6259. } finally {
  6260. _iterator14.f();
  6261. }
  6262. });
  6263. }
  6264. }, {
  6265. key: "addEventListener",
  6266. value: function addEventListener(name, listener) {
  6267. this._listeners.push(listener);
  6268. }
  6269. }, {
  6270. key: "removeEventListener",
  6271. value: function removeEventListener(name, listener) {
  6272. var i = this._listeners.indexOf(listener);
  6273. this._listeners.splice(i, 1);
  6274. }
  6275. }, {
  6276. key: "terminate",
  6277. value: function terminate() {
  6278. this._listeners.length = 0;
  6279. }
  6280. }]);
  6281. return LoopbackPort;
  6282. }();
  6283. exports.LoopbackPort = LoopbackPort;
  6284. var PDFWorkerUtil = {
  6285. isWorkerDisabled: false,
  6286. fallbackWorkerSrc: null,
  6287. fakeWorkerId: 0
  6288. };
  6289. exports.PDFWorkerUtil = PDFWorkerUtil;
  6290. {
  6291. if (_is_node.isNodeJS && typeof require === "function") {
  6292. PDFWorkerUtil.isWorkerDisabled = true;
  6293. PDFWorkerUtil.fallbackWorkerSrc = "./pdf.worker.js";
  6294. } else if ((typeof document === "undefined" ? "undefined" : _typeof(document)) === "object") {
  6295. var _document, _document$currentScri;
  6296. var pdfjsFilePath = (_document = document) === null || _document === void 0 ? void 0 : (_document$currentScri = _document.currentScript) === null || _document$currentScri === void 0 ? void 0 : _document$currentScri.src;
  6297. if (pdfjsFilePath) {
  6298. PDFWorkerUtil.fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2");
  6299. }
  6300. }
  6301. PDFWorkerUtil.isSameOrigin = function (baseUrl, otherUrl) {
  6302. var base;
  6303. try {
  6304. base = new URL(baseUrl);
  6305. if (!base.origin || base.origin === "null") {
  6306. return false;
  6307. }
  6308. } catch (e) {
  6309. return false;
  6310. }
  6311. var other = new URL(otherUrl, base);
  6312. return base.origin === other.origin;
  6313. };
  6314. PDFWorkerUtil.createCDNWrapper = function (url) {
  6315. var wrapper = "importScripts(\"".concat(url, "\");");
  6316. return URL.createObjectURL(new Blob([wrapper]));
  6317. };
  6318. }
  6319. var PDFWorker = /*#__PURE__*/function () {
  6320. function PDFWorker() {
  6321. var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  6322. _ref14$name = _ref14.name,
  6323. name = _ref14$name === void 0 ? null : _ref14$name,
  6324. _ref14$port = _ref14.port,
  6325. port = _ref14$port === void 0 ? null : _ref14$port,
  6326. _ref14$verbosity = _ref14.verbosity,
  6327. verbosity = _ref14$verbosity === void 0 ? (0, _util.getVerbosityLevel)() : _ref14$verbosity;
  6328. _classCallCheck(this, PDFWorker);
  6329. if (port && _classStaticPrivateFieldSpecGet(PDFWorker, PDFWorker, _workerPorts).has(port)) {
  6330. throw new Error("Cannot use more than one PDFWorker per port.");
  6331. }
  6332. this.name = name;
  6333. this.destroyed = false;
  6334. this.verbosity = verbosity;
  6335. this._readyCapability = (0, _util.createPromiseCapability)();
  6336. this._port = null;
  6337. this._webWorker = null;
  6338. this._messageHandler = null;
  6339. if (port) {
  6340. _classStaticPrivateFieldSpecGet(PDFWorker, PDFWorker, _workerPorts).set(port, this);
  6341. this._initializeFromPort(port);
  6342. return;
  6343. }
  6344. this._initialize();
  6345. }
  6346. _createClass(PDFWorker, [{
  6347. key: "promise",
  6348. get: function get() {
  6349. return this._readyCapability.promise;
  6350. }
  6351. }, {
  6352. key: "port",
  6353. get: function get() {
  6354. return this._port;
  6355. }
  6356. }, {
  6357. key: "messageHandler",
  6358. get: function get() {
  6359. return this._messageHandler;
  6360. }
  6361. }, {
  6362. key: "_initializeFromPort",
  6363. value: function _initializeFromPort(port) {
  6364. this._port = port;
  6365. this._messageHandler = new _message_handler.MessageHandler("main", "worker", port);
  6366. this._messageHandler.on("ready", function () {});
  6367. this._readyCapability.resolve();
  6368. }
  6369. }, {
  6370. key: "_initialize",
  6371. value: function _initialize() {
  6372. var _this9 = this;
  6373. if (typeof Worker !== "undefined" && !PDFWorkerUtil.isWorkerDisabled && !PDFWorker._mainThreadWorkerMessageHandler) {
  6374. var workerSrc = PDFWorker.workerSrc;
  6375. try {
  6376. if (!PDFWorkerUtil.isSameOrigin(window.location.href, workerSrc)) {
  6377. workerSrc = PDFWorkerUtil.createCDNWrapper(new URL(workerSrc, window.location).href);
  6378. }
  6379. var worker = new Worker(workerSrc);
  6380. var messageHandler = new _message_handler.MessageHandler("main", "worker", worker);
  6381. var terminateEarly = function terminateEarly() {
  6382. worker.removeEventListener("error", onWorkerError);
  6383. messageHandler.destroy();
  6384. worker.terminate();
  6385. if (_this9.destroyed) {
  6386. _this9._readyCapability.reject(new Error("Worker was destroyed"));
  6387. } else {
  6388. _this9._setupFakeWorker();
  6389. }
  6390. };
  6391. var onWorkerError = function onWorkerError() {
  6392. if (!_this9._webWorker) {
  6393. terminateEarly();
  6394. }
  6395. };
  6396. worker.addEventListener("error", onWorkerError);
  6397. messageHandler.on("test", function (data) {
  6398. worker.removeEventListener("error", onWorkerError);
  6399. if (_this9.destroyed) {
  6400. terminateEarly();
  6401. return;
  6402. }
  6403. if (data) {
  6404. _this9._messageHandler = messageHandler;
  6405. _this9._port = worker;
  6406. _this9._webWorker = worker;
  6407. _this9._readyCapability.resolve();
  6408. messageHandler.send("configure", {
  6409. verbosity: _this9.verbosity
  6410. });
  6411. } else {
  6412. _this9._setupFakeWorker();
  6413. messageHandler.destroy();
  6414. worker.terminate();
  6415. }
  6416. });
  6417. messageHandler.on("ready", function (data) {
  6418. worker.removeEventListener("error", onWorkerError);
  6419. if (_this9.destroyed) {
  6420. terminateEarly();
  6421. return;
  6422. }
  6423. try {
  6424. sendTest();
  6425. } catch (e) {
  6426. _this9._setupFakeWorker();
  6427. }
  6428. });
  6429. var sendTest = function sendTest() {
  6430. var testObj = new Uint8Array();
  6431. messageHandler.send("test", testObj, [testObj.buffer]);
  6432. };
  6433. sendTest();
  6434. return;
  6435. } catch (e) {
  6436. (0, _util.info)("The worker has been disabled.");
  6437. }
  6438. }
  6439. this._setupFakeWorker();
  6440. }
  6441. }, {
  6442. key: "_setupFakeWorker",
  6443. value: function _setupFakeWorker() {
  6444. var _this10 = this;
  6445. if (!PDFWorkerUtil.isWorkerDisabled) {
  6446. (0, _util.warn)("Setting up fake worker.");
  6447. PDFWorkerUtil.isWorkerDisabled = true;
  6448. }
  6449. PDFWorker._setupFakeWorkerGlobal.then(function (WorkerMessageHandler) {
  6450. if (_this10.destroyed) {
  6451. _this10._readyCapability.reject(new Error("Worker was destroyed"));
  6452. return;
  6453. }
  6454. var port = new LoopbackPort();
  6455. _this10._port = port;
  6456. var id = "fake".concat(PDFWorkerUtil.fakeWorkerId++);
  6457. var workerHandler = new _message_handler.MessageHandler(id + "_worker", id, port);
  6458. WorkerMessageHandler.setup(workerHandler, port);
  6459. var messageHandler = new _message_handler.MessageHandler(id, id + "_worker", port);
  6460. _this10._messageHandler = messageHandler;
  6461. _this10._readyCapability.resolve();
  6462. messageHandler.send("configure", {
  6463. verbosity: _this10.verbosity
  6464. });
  6465. })["catch"](function (reason) {
  6466. _this10._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\".")));
  6467. });
  6468. }
  6469. }, {
  6470. key: "destroy",
  6471. value: function destroy() {
  6472. this.destroyed = true;
  6473. if (this._webWorker) {
  6474. this._webWorker.terminate();
  6475. this._webWorker = null;
  6476. }
  6477. _classStaticPrivateFieldSpecGet(PDFWorker, PDFWorker, _workerPorts)["delete"](this._port);
  6478. this._port = null;
  6479. if (this._messageHandler) {
  6480. this._messageHandler.destroy();
  6481. this._messageHandler = null;
  6482. }
  6483. }
  6484. }], [{
  6485. key: "fromPort",
  6486. value: function fromPort(params) {
  6487. if (!(params !== null && params !== void 0 && params.port)) {
  6488. throw new Error("PDFWorker.fromPort - invalid method signature.");
  6489. }
  6490. if (_classStaticPrivateFieldSpecGet(this, PDFWorker, _workerPorts).has(params.port)) {
  6491. return _classStaticPrivateFieldSpecGet(this, PDFWorker, _workerPorts).get(params.port);
  6492. }
  6493. return new PDFWorker(params);
  6494. }
  6495. }, {
  6496. key: "workerSrc",
  6497. get: function get() {
  6498. if (_worker_options.GlobalWorkerOptions.workerSrc) {
  6499. return _worker_options.GlobalWorkerOptions.workerSrc;
  6500. }
  6501. if (PDFWorkerUtil.fallbackWorkerSrc !== null) {
  6502. if (!_is_node.isNodeJS) {
  6503. (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');
  6504. }
  6505. return PDFWorkerUtil.fallbackWorkerSrc;
  6506. }
  6507. throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
  6508. }
  6509. }, {
  6510. key: "_mainThreadWorkerMessageHandler",
  6511. get: function get() {
  6512. try {
  6513. var _globalThis$pdfjsWork;
  6514. return ((_globalThis$pdfjsWork = globalThis.pdfjsWorker) === null || _globalThis$pdfjsWork === void 0 ? void 0 : _globalThis$pdfjsWork.WorkerMessageHandler) || null;
  6515. } catch (ex) {
  6516. return null;
  6517. }
  6518. }
  6519. }, {
  6520. key: "_setupFakeWorkerGlobal",
  6521. get: function get() {
  6522. var _this11 = this;
  6523. var loader = /*#__PURE__*/function () {
  6524. var _ref15 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
  6525. var mainWorkerMessageHandler, worker;
  6526. return _regenerator["default"].wrap(function _callee4$(_context4) {
  6527. while (1) {
  6528. switch (_context4.prev = _context4.next) {
  6529. case 0:
  6530. mainWorkerMessageHandler = _this11._mainThreadWorkerMessageHandler;
  6531. if (!mainWorkerMessageHandler) {
  6532. _context4.next = 3;
  6533. break;
  6534. }
  6535. return _context4.abrupt("return", mainWorkerMessageHandler);
  6536. case 3:
  6537. if (!(_is_node.isNodeJS && typeof require === "function")) {
  6538. _context4.next = 6;
  6539. break;
  6540. }
  6541. worker = eval("require")(_this11.workerSrc);
  6542. return _context4.abrupt("return", worker.WorkerMessageHandler);
  6543. case 6:
  6544. _context4.next = 8;
  6545. return (0, _display_utils.loadScript)(_this11.workerSrc);
  6546. case 8:
  6547. return _context4.abrupt("return", window.pdfjsWorker.WorkerMessageHandler);
  6548. case 9:
  6549. case "end":
  6550. return _context4.stop();
  6551. }
  6552. }
  6553. }, _callee4);
  6554. }));
  6555. return function loader() {
  6556. return _ref15.apply(this, arguments);
  6557. };
  6558. }();
  6559. return (0, _util.shadow)(this, "_setupFakeWorkerGlobal", loader());
  6560. }
  6561. }]);
  6562. return PDFWorker;
  6563. }();
  6564. exports.PDFWorker = PDFWorker;
  6565. var _workerPorts = {
  6566. writable: true,
  6567. value: new WeakMap()
  6568. };
  6569. {
  6570. PDFWorker.getWorkerSrc = function () {
  6571. (0, _display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead.");
  6572. return this.workerSrc;
  6573. };
  6574. }
  6575. var _docStats = /*#__PURE__*/new WeakMap();
  6576. var _pageCache = /*#__PURE__*/new WeakMap();
  6577. var _pagePromises = /*#__PURE__*/new WeakMap();
  6578. var _metadataPromise = /*#__PURE__*/new WeakMap();
  6579. var WorkerTransport = /*#__PURE__*/function () {
  6580. function WorkerTransport(messageHandler, loadingTask, networkStream, params) {
  6581. _classCallCheck(this, WorkerTransport);
  6582. _classPrivateFieldInitSpec(this, _docStats, {
  6583. writable: true,
  6584. value: null
  6585. });
  6586. _classPrivateFieldInitSpec(this, _pageCache, {
  6587. writable: true,
  6588. value: new Map()
  6589. });
  6590. _classPrivateFieldInitSpec(this, _pagePromises, {
  6591. writable: true,
  6592. value: new Map()
  6593. });
  6594. _classPrivateFieldInitSpec(this, _metadataPromise, {
  6595. writable: true,
  6596. value: null
  6597. });
  6598. this.messageHandler = messageHandler;
  6599. this.loadingTask = loadingTask;
  6600. this.commonObjs = new PDFObjects();
  6601. this.fontLoader = new _font_loader.FontLoader({
  6602. docId: loadingTask.docId,
  6603. onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
  6604. ownerDocument: params.ownerDocument,
  6605. styleElement: params.styleElement
  6606. });
  6607. this._params = params;
  6608. if (!params.useWorkerFetch) {
  6609. this.CMapReaderFactory = new params.CMapReaderFactory({
  6610. baseUrl: params.cMapUrl,
  6611. isCompressed: params.cMapPacked
  6612. });
  6613. this.StandardFontDataFactory = new params.StandardFontDataFactory({
  6614. baseUrl: params.standardFontDataUrl
  6615. });
  6616. }
  6617. this.destroyed = false;
  6618. this.destroyCapability = null;
  6619. this._passwordCapability = null;
  6620. this._networkStream = networkStream;
  6621. this._fullReader = null;
  6622. this._lastProgress = null;
  6623. this.downloadInfoCapability = (0, _util.createPromiseCapability)();
  6624. this.setupMessageHandler();
  6625. }
  6626. _createClass(WorkerTransport, [{
  6627. key: "annotationStorage",
  6628. get: function get() {
  6629. return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
  6630. }
  6631. }, {
  6632. key: "stats",
  6633. get: function get() {
  6634. return _classPrivateFieldGet(this, _docStats);
  6635. }
  6636. }, {
  6637. key: "getRenderingIntent",
  6638. value: function getRenderingIntent(intent) {
  6639. var annotationMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _util.AnnotationMode.ENABLE;
  6640. var isOpList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6641. var renderingIntent = _util.RenderingIntentFlag.DISPLAY;
  6642. var annotationHash = "";
  6643. switch (intent) {
  6644. case "any":
  6645. renderingIntent = _util.RenderingIntentFlag.ANY;
  6646. break;
  6647. case "display":
  6648. break;
  6649. case "print":
  6650. renderingIntent = _util.RenderingIntentFlag.PRINT;
  6651. break;
  6652. default:
  6653. (0, _util.warn)("getRenderingIntent - invalid intent: ".concat(intent));
  6654. }
  6655. switch (annotationMode) {
  6656. case _util.AnnotationMode.DISABLE:
  6657. renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_DISABLE;
  6658. break;
  6659. case _util.AnnotationMode.ENABLE:
  6660. break;
  6661. case _util.AnnotationMode.ENABLE_FORMS:
  6662. renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_FORMS;
  6663. break;
  6664. case _util.AnnotationMode.ENABLE_STORAGE:
  6665. renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_STORAGE;
  6666. annotationHash = this.annotationStorage.hash;
  6667. break;
  6668. default:
  6669. (0, _util.warn)("getRenderingIntent - invalid annotationMode: ".concat(annotationMode));
  6670. }
  6671. if (isOpList) {
  6672. renderingIntent += _util.RenderingIntentFlag.OPLIST;
  6673. }
  6674. return {
  6675. renderingIntent: renderingIntent,
  6676. cacheKey: "".concat(renderingIntent, "_").concat(annotationHash)
  6677. };
  6678. }
  6679. }, {
  6680. key: "destroy",
  6681. value: function destroy() {
  6682. var _this12 = this;
  6683. if (this.destroyCapability) {
  6684. return this.destroyCapability.promise;
  6685. }
  6686. this.destroyed = true;
  6687. this.destroyCapability = (0, _util.createPromiseCapability)();
  6688. if (this._passwordCapability) {
  6689. this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));
  6690. }
  6691. var waitOn = [];
  6692. var _iterator15 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _pageCache).values()),
  6693. _step15;
  6694. try {
  6695. for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
  6696. var page = _step15.value;
  6697. waitOn.push(page._destroy());
  6698. }
  6699. } catch (err) {
  6700. _iterator15.e(err);
  6701. } finally {
  6702. _iterator15.f();
  6703. }
  6704. _classPrivateFieldGet(this, _pageCache).clear();
  6705. _classPrivateFieldGet(this, _pagePromises).clear();
  6706. if (this.hasOwnProperty("annotationStorage")) {
  6707. this.annotationStorage.resetModified();
  6708. }
  6709. var terminated = this.messageHandler.sendWithPromise("Terminate", null);
  6710. waitOn.push(terminated);
  6711. Promise.all(waitOn).then(function () {
  6712. _this12.commonObjs.clear();
  6713. _this12.fontLoader.clear();
  6714. _classPrivateFieldSet(_this12, _metadataPromise, null);
  6715. _this12._getFieldObjectsPromise = null;
  6716. _this12._hasJSActionsPromise = null;
  6717. if (_this12._networkStream) {
  6718. _this12._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));
  6719. }
  6720. if (_this12.messageHandler) {
  6721. _this12.messageHandler.destroy();
  6722. _this12.messageHandler = null;
  6723. }
  6724. _this12.destroyCapability.resolve();
  6725. }, this.destroyCapability.reject);
  6726. return this.destroyCapability.promise;
  6727. }
  6728. }, {
  6729. key: "setupMessageHandler",
  6730. value: function setupMessageHandler() {
  6731. var _this13 = this;
  6732. var messageHandler = this.messageHandler,
  6733. loadingTask = this.loadingTask;
  6734. messageHandler.on("GetReader", function (data, sink) {
  6735. (0, _util.assert)(_this13._networkStream, "GetReader - no `IPDFStream` instance available.");
  6736. _this13._fullReader = _this13._networkStream.getFullReader();
  6737. _this13._fullReader.onProgress = function (evt) {
  6738. _this13._lastProgress = {
  6739. loaded: evt.loaded,
  6740. total: evt.total
  6741. };
  6742. };
  6743. sink.onPull = function () {
  6744. _this13._fullReader.read().then(function (_ref16) {
  6745. var value = _ref16.value,
  6746. done = _ref16.done;
  6747. if (done) {
  6748. sink.close();
  6749. return;
  6750. }
  6751. (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetReader - expected an ArrayBuffer.");
  6752. sink.enqueue(new Uint8Array(value), 1, [value]);
  6753. })["catch"](function (reason) {
  6754. sink.error(reason);
  6755. });
  6756. };
  6757. sink.onCancel = function (reason) {
  6758. _this13._fullReader.cancel(reason);
  6759. sink.ready["catch"](function (readyReason) {
  6760. if (_this13.destroyed) {
  6761. return;
  6762. }
  6763. throw readyReason;
  6764. });
  6765. };
  6766. });
  6767. messageHandler.on("ReaderHeadersReady", function (data) {
  6768. var headersCapability = (0, _util.createPromiseCapability)();
  6769. var fullReader = _this13._fullReader;
  6770. fullReader.headersReady.then(function () {
  6771. if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
  6772. if (_this13._lastProgress) {
  6773. var _loadingTask$onProgre;
  6774. (_loadingTask$onProgre = loadingTask.onProgress) === null || _loadingTask$onProgre === void 0 ? void 0 : _loadingTask$onProgre.call(loadingTask, _this13._lastProgress);
  6775. }
  6776. fullReader.onProgress = function (evt) {
  6777. var _loadingTask$onProgre2;
  6778. (_loadingTask$onProgre2 = loadingTask.onProgress) === null || _loadingTask$onProgre2 === void 0 ? void 0 : _loadingTask$onProgre2.call(loadingTask, {
  6779. loaded: evt.loaded,
  6780. total: evt.total
  6781. });
  6782. };
  6783. }
  6784. headersCapability.resolve({
  6785. isStreamingSupported: fullReader.isStreamingSupported,
  6786. isRangeSupported: fullReader.isRangeSupported,
  6787. contentLength: fullReader.contentLength
  6788. });
  6789. }, headersCapability.reject);
  6790. return headersCapability.promise;
  6791. });
  6792. messageHandler.on("GetRangeReader", function (data, sink) {
  6793. (0, _util.assert)(_this13._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
  6794. var rangeReader = _this13._networkStream.getRangeReader(data.begin, data.end);
  6795. if (!rangeReader) {
  6796. sink.close();
  6797. return;
  6798. }
  6799. sink.onPull = function () {
  6800. rangeReader.read().then(function (_ref17) {
  6801. var value = _ref17.value,
  6802. done = _ref17.done;
  6803. if (done) {
  6804. sink.close();
  6805. return;
  6806. }
  6807. (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetRangeReader - expected an ArrayBuffer.");
  6808. sink.enqueue(new Uint8Array(value), 1, [value]);
  6809. })["catch"](function (reason) {
  6810. sink.error(reason);
  6811. });
  6812. };
  6813. sink.onCancel = function (reason) {
  6814. rangeReader.cancel(reason);
  6815. sink.ready["catch"](function (readyReason) {
  6816. if (_this13.destroyed) {
  6817. return;
  6818. }
  6819. throw readyReason;
  6820. });
  6821. };
  6822. });
  6823. messageHandler.on("GetDoc", function (_ref18) {
  6824. var pdfInfo = _ref18.pdfInfo;
  6825. _this13._numPages = pdfInfo.numPages;
  6826. _this13._htmlForXfa = pdfInfo.htmlForXfa;
  6827. delete pdfInfo.htmlForXfa;
  6828. loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, _this13));
  6829. });
  6830. messageHandler.on("DocException", function (ex) {
  6831. var reason;
  6832. switch (ex.name) {
  6833. case "PasswordException":
  6834. reason = new _util.PasswordException(ex.message, ex.code);
  6835. break;
  6836. case "InvalidPDFException":
  6837. reason = new _util.InvalidPDFException(ex.message);
  6838. break;
  6839. case "MissingPDFException":
  6840. reason = new _util.MissingPDFException(ex.message);
  6841. break;
  6842. case "UnexpectedResponseException":
  6843. reason = new _util.UnexpectedResponseException(ex.message, ex.status);
  6844. break;
  6845. case "UnknownErrorException":
  6846. reason = new _util.UnknownErrorException(ex.message, ex.details);
  6847. break;
  6848. default:
  6849. (0, _util.unreachable)("DocException - expected a valid Error.");
  6850. }
  6851. loadingTask._capability.reject(reason);
  6852. });
  6853. messageHandler.on("PasswordRequest", function (exception) {
  6854. _this13._passwordCapability = (0, _util.createPromiseCapability)();
  6855. if (loadingTask.onPassword) {
  6856. var updatePassword = function updatePassword(password) {
  6857. if (password instanceof Error) {
  6858. _this13._passwordCapability.reject(password);
  6859. } else {
  6860. _this13._passwordCapability.resolve({
  6861. password: password
  6862. });
  6863. }
  6864. };
  6865. try {
  6866. loadingTask.onPassword(updatePassword, exception.code);
  6867. } catch (ex) {
  6868. _this13._passwordCapability.reject(ex);
  6869. }
  6870. } else {
  6871. _this13._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
  6872. }
  6873. return _this13._passwordCapability.promise;
  6874. });
  6875. messageHandler.on("DataLoaded", function (data) {
  6876. var _loadingTask$onProgre3;
  6877. (_loadingTask$onProgre3 = loadingTask.onProgress) === null || _loadingTask$onProgre3 === void 0 ? void 0 : _loadingTask$onProgre3.call(loadingTask, {
  6878. loaded: data.length,
  6879. total: data.length
  6880. });
  6881. _this13.downloadInfoCapability.resolve(data);
  6882. });
  6883. messageHandler.on("StartRenderPage", function (data) {
  6884. if (_this13.destroyed) {
  6885. return;
  6886. }
  6887. var page = _classPrivateFieldGet(_this13, _pageCache).get(data.pageIndex);
  6888. page._startRenderPage(data.transparency, data.cacheKey);
  6889. });
  6890. messageHandler.on("commonobj", function (_ref19) {
  6891. var _globalThis$FontInspe;
  6892. var _ref20 = _slicedToArray(_ref19, 3),
  6893. id = _ref20[0],
  6894. type = _ref20[1],
  6895. exportedData = _ref20[2];
  6896. if (_this13.destroyed) {
  6897. return;
  6898. }
  6899. if (_this13.commonObjs.has(id)) {
  6900. return;
  6901. }
  6902. switch (type) {
  6903. case "Font":
  6904. var params = _this13._params;
  6905. if ("error" in exportedData) {
  6906. var exportedError = exportedData.error;
  6907. (0, _util.warn)("Error during font loading: ".concat(exportedError));
  6908. _this13.commonObjs.resolve(id, exportedError);
  6909. break;
  6910. }
  6911. var fontRegistry = null;
  6912. if (params.pdfBug && (_globalThis$FontInspe = globalThis.FontInspector) !== null && _globalThis$FontInspe !== void 0 && _globalThis$FontInspe.enabled) {
  6913. fontRegistry = {
  6914. registerFont: function registerFont(font, url) {
  6915. globalThis.FontInspector.fontAdded(font, url);
  6916. }
  6917. };
  6918. }
  6919. var font = new _font_loader.FontFaceObject(exportedData, {
  6920. isEvalSupported: params.isEvalSupported,
  6921. disableFontFace: params.disableFontFace,
  6922. ignoreErrors: params.ignoreErrors,
  6923. onUnsupportedFeature: _this13._onUnsupportedFeature.bind(_this13),
  6924. fontRegistry: fontRegistry
  6925. });
  6926. _this13.fontLoader.bind(font)["catch"](function (reason) {
  6927. return messageHandler.sendWithPromise("FontFallback", {
  6928. id: id
  6929. });
  6930. })["finally"](function () {
  6931. if (!params.fontExtraProperties && font.data) {
  6932. font.data = null;
  6933. }
  6934. _this13.commonObjs.resolve(id, font);
  6935. });
  6936. break;
  6937. case "FontPath":
  6938. case "Image":
  6939. _this13.commonObjs.resolve(id, exportedData);
  6940. break;
  6941. default:
  6942. throw new Error("Got unknown common object type ".concat(type));
  6943. }
  6944. });
  6945. messageHandler.on("obj", function (_ref21) {
  6946. var _ref22 = _slicedToArray(_ref21, 4),
  6947. id = _ref22[0],
  6948. pageIndex = _ref22[1],
  6949. type = _ref22[2],
  6950. imageData = _ref22[3];
  6951. if (_this13.destroyed) {
  6952. return;
  6953. }
  6954. var pageProxy = _classPrivateFieldGet(_this13, _pageCache).get(pageIndex);
  6955. if (pageProxy.objs.has(id)) {
  6956. return;
  6957. }
  6958. switch (type) {
  6959. case "Image":
  6960. pageProxy.objs.resolve(id, imageData);
  6961. var MAX_IMAGE_SIZE_TO_STORE = 8000000;
  6962. if (imageData) {
  6963. var length;
  6964. if (imageData.bitmap) {
  6965. var bitmap = imageData.bitmap,
  6966. width = imageData.width,
  6967. height = imageData.height;
  6968. length = width * height * 4;
  6969. pageProxy._bitmaps.add(bitmap);
  6970. } else {
  6971. var _imageData$data;
  6972. length = ((_imageData$data = imageData.data) === null || _imageData$data === void 0 ? void 0 : _imageData$data.length) || 0;
  6973. }
  6974. if (length > MAX_IMAGE_SIZE_TO_STORE) {
  6975. pageProxy.cleanupAfterRender = true;
  6976. }
  6977. }
  6978. break;
  6979. case "Pattern":
  6980. pageProxy.objs.resolve(id, imageData);
  6981. break;
  6982. default:
  6983. throw new Error("Got unknown object type ".concat(type));
  6984. }
  6985. });
  6986. messageHandler.on("DocProgress", function (data) {
  6987. var _loadingTask$onProgre4;
  6988. if (_this13.destroyed) {
  6989. return;
  6990. }
  6991. (_loadingTask$onProgre4 = loadingTask.onProgress) === null || _loadingTask$onProgre4 === void 0 ? void 0 : _loadingTask$onProgre4.call(loadingTask, {
  6992. loaded: data.loaded,
  6993. total: data.total
  6994. });
  6995. });
  6996. messageHandler.on("DocStats", function (data) {
  6997. if (_this13.destroyed) {
  6998. return;
  6999. }
  7000. _classPrivateFieldSet(_this13, _docStats, Object.freeze({
  7001. streamTypes: Object.freeze(data.streamTypes),
  7002. fontTypes: Object.freeze(data.fontTypes)
  7003. }));
  7004. });
  7005. messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this));
  7006. messageHandler.on("FetchBuiltInCMap", function (data) {
  7007. if (_this13.destroyed) {
  7008. return Promise.reject(new Error("Worker was destroyed."));
  7009. }
  7010. if (!_this13.CMapReaderFactory) {
  7011. return Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."));
  7012. }
  7013. return _this13.CMapReaderFactory.fetch(data);
  7014. });
  7015. messageHandler.on("FetchStandardFontData", function (data) {
  7016. if (_this13.destroyed) {
  7017. return Promise.reject(new Error("Worker was destroyed."));
  7018. }
  7019. if (!_this13.StandardFontDataFactory) {
  7020. return Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."));
  7021. }
  7022. return _this13.StandardFontDataFactory.fetch(data);
  7023. });
  7024. }
  7025. }, {
  7026. key: "_onUnsupportedFeature",
  7027. value: function _onUnsupportedFeature(_ref23) {
  7028. var _this$loadingTask$onU, _this$loadingTask;
  7029. var featureId = _ref23.featureId;
  7030. if (this.destroyed) {
  7031. return;
  7032. }
  7033. (_this$loadingTask$onU = (_this$loadingTask = this.loadingTask).onUnsupportedFeature) === null || _this$loadingTask$onU === void 0 ? void 0 : _this$loadingTask$onU.call(_this$loadingTask, featureId);
  7034. }
  7035. }, {
  7036. key: "getData",
  7037. value: function getData() {
  7038. return this.messageHandler.sendWithPromise("GetData", null);
  7039. }
  7040. }, {
  7041. key: "getPage",
  7042. value: function getPage(pageNumber) {
  7043. var _this14 = this;
  7044. if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
  7045. return Promise.reject(new Error("Invalid page request."));
  7046. }
  7047. var pageIndex = pageNumber - 1,
  7048. cachedPromise = _classPrivateFieldGet(this, _pagePromises).get(pageIndex);
  7049. if (cachedPromise) {
  7050. return cachedPromise;
  7051. }
  7052. var promise = this.messageHandler.sendWithPromise("GetPage", {
  7053. pageIndex: pageIndex
  7054. }).then(function (pageInfo) {
  7055. if (_this14.destroyed) {
  7056. throw new Error("Transport destroyed");
  7057. }
  7058. var page = new PDFPageProxy(pageIndex, pageInfo, _this14, _this14._params.ownerDocument, _this14._params.pdfBug);
  7059. _classPrivateFieldGet(_this14, _pageCache).set(pageIndex, page);
  7060. return page;
  7061. });
  7062. _classPrivateFieldGet(this, _pagePromises).set(pageIndex, promise);
  7063. return promise;
  7064. }
  7065. }, {
  7066. key: "getPageIndex",
  7067. value: function getPageIndex(ref) {
  7068. if (_typeof(ref) !== "object" || ref === null || !Number.isInteger(ref.num) || ref.num < 0 || !Number.isInteger(ref.gen) || ref.gen < 0) {
  7069. return Promise.reject(new Error("Invalid pageIndex request."));
  7070. }
  7071. return this.messageHandler.sendWithPromise("GetPageIndex", {
  7072. num: ref.num,
  7073. gen: ref.gen
  7074. });
  7075. }
  7076. }, {
  7077. key: "getAnnotations",
  7078. value: function getAnnotations(pageIndex, intent) {
  7079. return this.messageHandler.sendWithPromise("GetAnnotations", {
  7080. pageIndex: pageIndex,
  7081. intent: intent
  7082. });
  7083. }
  7084. }, {
  7085. key: "saveDocument",
  7086. value: function saveDocument() {
  7087. var _this$_fullReader$fil,
  7088. _this$_fullReader,
  7089. _this15 = this;
  7090. return this.messageHandler.sendWithPromise("SaveDocument", {
  7091. isPureXfa: !!this._htmlForXfa,
  7092. numPages: this._numPages,
  7093. annotationStorage: this.annotationStorage.serializable,
  7094. filename: (_this$_fullReader$fil = (_this$_fullReader = this._fullReader) === null || _this$_fullReader === void 0 ? void 0 : _this$_fullReader.filename) !== null && _this$_fullReader$fil !== void 0 ? _this$_fullReader$fil : null
  7095. })["finally"](function () {
  7096. _this15.annotationStorage.resetModified();
  7097. });
  7098. }
  7099. }, {
  7100. key: "getFieldObjects",
  7101. value: function getFieldObjects() {
  7102. return this._getFieldObjectsPromise || (this._getFieldObjectsPromise = this.messageHandler.sendWithPromise("GetFieldObjects", null));
  7103. }
  7104. }, {
  7105. key: "hasJSActions",
  7106. value: function hasJSActions() {
  7107. return this._hasJSActionsPromise || (this._hasJSActionsPromise = this.messageHandler.sendWithPromise("HasJSActions", null));
  7108. }
  7109. }, {
  7110. key: "getCalculationOrderIds",
  7111. value: function getCalculationOrderIds() {
  7112. return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
  7113. }
  7114. }, {
  7115. key: "getDestinations",
  7116. value: function getDestinations() {
  7117. return this.messageHandler.sendWithPromise("GetDestinations", null);
  7118. }
  7119. }, {
  7120. key: "getDestination",
  7121. value: function getDestination(id) {
  7122. if (typeof id !== "string") {
  7123. return Promise.reject(new Error("Invalid destination request."));
  7124. }
  7125. return this.messageHandler.sendWithPromise("GetDestination", {
  7126. id: id
  7127. });
  7128. }
  7129. }, {
  7130. key: "getPageLabels",
  7131. value: function getPageLabels() {
  7132. return this.messageHandler.sendWithPromise("GetPageLabels", null);
  7133. }
  7134. }, {
  7135. key: "getPageLayout",
  7136. value: function getPageLayout() {
  7137. return this.messageHandler.sendWithPromise("GetPageLayout", null);
  7138. }
  7139. }, {
  7140. key: "getPageMode",
  7141. value: function getPageMode() {
  7142. return this.messageHandler.sendWithPromise("GetPageMode", null);
  7143. }
  7144. }, {
  7145. key: "getViewerPreferences",
  7146. value: function getViewerPreferences() {
  7147. return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
  7148. }
  7149. }, {
  7150. key: "getOpenAction",
  7151. value: function getOpenAction() {
  7152. return this.messageHandler.sendWithPromise("GetOpenAction", null);
  7153. }
  7154. }, {
  7155. key: "getAttachments",
  7156. value: function getAttachments() {
  7157. return this.messageHandler.sendWithPromise("GetAttachments", null);
  7158. }
  7159. }, {
  7160. key: "getJavaScript",
  7161. value: function getJavaScript() {
  7162. return this.messageHandler.sendWithPromise("GetJavaScript", null);
  7163. }
  7164. }, {
  7165. key: "getDocJSActions",
  7166. value: function getDocJSActions() {
  7167. return this.messageHandler.sendWithPromise("GetDocJSActions", null);
  7168. }
  7169. }, {
  7170. key: "getPageJSActions",
  7171. value: function getPageJSActions(pageIndex) {
  7172. return this.messageHandler.sendWithPromise("GetPageJSActions", {
  7173. pageIndex: pageIndex
  7174. });
  7175. }
  7176. }, {
  7177. key: "getStructTree",
  7178. value: function getStructTree(pageIndex) {
  7179. return this.messageHandler.sendWithPromise("GetStructTree", {
  7180. pageIndex: pageIndex
  7181. });
  7182. }
  7183. }, {
  7184. key: "getOutline",
  7185. value: function getOutline() {
  7186. return this.messageHandler.sendWithPromise("GetOutline", null);
  7187. }
  7188. }, {
  7189. key: "getOptionalContentConfig",
  7190. value: function getOptionalContentConfig() {
  7191. return this.messageHandler.sendWithPromise("GetOptionalContentConfig", null).then(function (results) {
  7192. return new _optional_content_config.OptionalContentConfig(results);
  7193. });
  7194. }
  7195. }, {
  7196. key: "getPermissions",
  7197. value: function getPermissions() {
  7198. return this.messageHandler.sendWithPromise("GetPermissions", null);
  7199. }
  7200. }, {
  7201. key: "getMetadata",
  7202. value: function getMetadata() {
  7203. var _this16 = this;
  7204. return _classPrivateFieldGet(this, _metadataPromise) || _classPrivateFieldSet(this, _metadataPromise, this.messageHandler.sendWithPromise("GetMetadata", null).then(function (results) {
  7205. var _this16$_fullReader$f, _this16$_fullReader, _this16$_fullReader$c, _this16$_fullReader2;
  7206. return {
  7207. info: results[0],
  7208. metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
  7209. contentDispositionFilename: (_this16$_fullReader$f = (_this16$_fullReader = _this16._fullReader) === null || _this16$_fullReader === void 0 ? void 0 : _this16$_fullReader.filename) !== null && _this16$_fullReader$f !== void 0 ? _this16$_fullReader$f : null,
  7210. contentLength: (_this16$_fullReader$c = (_this16$_fullReader2 = _this16._fullReader) === null || _this16$_fullReader2 === void 0 ? void 0 : _this16$_fullReader2.contentLength) !== null && _this16$_fullReader$c !== void 0 ? _this16$_fullReader$c : null
  7211. };
  7212. }));
  7213. }
  7214. }, {
  7215. key: "getMarkInfo",
  7216. value: function getMarkInfo() {
  7217. return this.messageHandler.sendWithPromise("GetMarkInfo", null);
  7218. }
  7219. }, {
  7220. key: "startCleanup",
  7221. value: function () {
  7222. var _startCleanup = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
  7223. var keepLoadedFonts,
  7224. _iterator16,
  7225. _step16,
  7226. page,
  7227. cleanupSuccessful,
  7228. _args5 = arguments;
  7229. return _regenerator["default"].wrap(function _callee5$(_context5) {
  7230. while (1) {
  7231. switch (_context5.prev = _context5.next) {
  7232. case 0:
  7233. keepLoadedFonts = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
  7234. _context5.next = 3;
  7235. return this.messageHandler.sendWithPromise("Cleanup", null);
  7236. case 3:
  7237. if (!this.destroyed) {
  7238. _context5.next = 5;
  7239. break;
  7240. }
  7241. return _context5.abrupt("return");
  7242. case 5:
  7243. _iterator16 = _createForOfIteratorHelper(_classPrivateFieldGet(this, _pageCache).values());
  7244. _context5.prev = 6;
  7245. _iterator16.s();
  7246. case 8:
  7247. if ((_step16 = _iterator16.n()).done) {
  7248. _context5.next = 15;
  7249. break;
  7250. }
  7251. page = _step16.value;
  7252. cleanupSuccessful = page.cleanup();
  7253. if (cleanupSuccessful) {
  7254. _context5.next = 13;
  7255. break;
  7256. }
  7257. throw new Error("startCleanup: Page ".concat(page.pageNumber, " is currently rendering."));
  7258. case 13:
  7259. _context5.next = 8;
  7260. break;
  7261. case 15:
  7262. _context5.next = 20;
  7263. break;
  7264. case 17:
  7265. _context5.prev = 17;
  7266. _context5.t0 = _context5["catch"](6);
  7267. _iterator16.e(_context5.t0);
  7268. case 20:
  7269. _context5.prev = 20;
  7270. _iterator16.f();
  7271. return _context5.finish(20);
  7272. case 23:
  7273. this.commonObjs.clear();
  7274. if (!keepLoadedFonts) {
  7275. this.fontLoader.clear();
  7276. }
  7277. _classPrivateFieldSet(this, _metadataPromise, null);
  7278. this._getFieldObjectsPromise = null;
  7279. this._hasJSActionsPromise = null;
  7280. case 28:
  7281. case "end":
  7282. return _context5.stop();
  7283. }
  7284. }
  7285. }, _callee5, this, [[6, 17, 20, 23]]);
  7286. }));
  7287. function startCleanup() {
  7288. return _startCleanup.apply(this, arguments);
  7289. }
  7290. return startCleanup;
  7291. }()
  7292. }, {
  7293. key: "loadingParams",
  7294. get: function get() {
  7295. var params = this._params;
  7296. return (0, _util.shadow)(this, "loadingParams", {
  7297. disableAutoFetch: params.disableAutoFetch,
  7298. enableXfa: params.enableXfa
  7299. });
  7300. }
  7301. }]);
  7302. return WorkerTransport;
  7303. }();
  7304. var _objs = /*#__PURE__*/new WeakMap();
  7305. var _ensureObj = /*#__PURE__*/new WeakSet();
  7306. var PDFObjects = /*#__PURE__*/function () {
  7307. function PDFObjects() {
  7308. _classCallCheck(this, PDFObjects);
  7309. _classPrivateMethodInitSpec(this, _ensureObj);
  7310. _classPrivateFieldInitSpec(this, _objs, {
  7311. writable: true,
  7312. value: Object.create(null)
  7313. });
  7314. }
  7315. _createClass(PDFObjects, [{
  7316. key: "get",
  7317. value: function get(objId) {
  7318. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  7319. if (callback) {
  7320. var _obj = _classPrivateMethodGet(this, _ensureObj, _ensureObj2).call(this, objId);
  7321. _obj.capability.promise.then(function () {
  7322. return callback(_obj.data);
  7323. });
  7324. return null;
  7325. }
  7326. var obj = _classPrivateFieldGet(this, _objs)[objId];
  7327. if (!(obj !== null && obj !== void 0 && obj.capability.settled)) {
  7328. throw new Error("Requesting object that isn't resolved yet ".concat(objId, "."));
  7329. }
  7330. return obj.data;
  7331. }
  7332. }, {
  7333. key: "has",
  7334. value: function has(objId) {
  7335. var obj = _classPrivateFieldGet(this, _objs)[objId];
  7336. return (obj === null || obj === void 0 ? void 0 : obj.capability.settled) || false;
  7337. }
  7338. }, {
  7339. key: "resolve",
  7340. value: function resolve(objId) {
  7341. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  7342. var obj = _classPrivateMethodGet(this, _ensureObj, _ensureObj2).call(this, objId);
  7343. obj.data = data;
  7344. obj.capability.resolve();
  7345. }
  7346. }, {
  7347. key: "clear",
  7348. value: function clear() {
  7349. _classPrivateFieldSet(this, _objs, Object.create(null));
  7350. }
  7351. }]);
  7352. return PDFObjects;
  7353. }();
  7354. function _ensureObj2(objId) {
  7355. var obj = _classPrivateFieldGet(this, _objs)[objId];
  7356. if (obj) {
  7357. return obj;
  7358. }
  7359. return _classPrivateFieldGet(this, _objs)[objId] = {
  7360. capability: (0, _util.createPromiseCapability)(),
  7361. data: null
  7362. };
  7363. }
  7364. var RenderTask = /*#__PURE__*/function () {
  7365. function RenderTask(internalRenderTask) {
  7366. _classCallCheck(this, RenderTask);
  7367. this._internalRenderTask = internalRenderTask;
  7368. this.onContinue = null;
  7369. }
  7370. _createClass(RenderTask, [{
  7371. key: "promise",
  7372. get: function get() {
  7373. return this._internalRenderTask.capability.promise;
  7374. }
  7375. }, {
  7376. key: "cancel",
  7377. value: function cancel() {
  7378. this._internalRenderTask.cancel();
  7379. }
  7380. }]);
  7381. return RenderTask;
  7382. }();
  7383. exports.RenderTask = RenderTask;
  7384. var InternalRenderTask = /*#__PURE__*/function () {
  7385. function InternalRenderTask(_ref24) {
  7386. var callback = _ref24.callback,
  7387. params = _ref24.params,
  7388. objs = _ref24.objs,
  7389. commonObjs = _ref24.commonObjs,
  7390. annotationCanvasMap = _ref24.annotationCanvasMap,
  7391. operatorList = _ref24.operatorList,
  7392. pageIndex = _ref24.pageIndex,
  7393. canvasFactory = _ref24.canvasFactory,
  7394. _ref24$useRequestAnim = _ref24.useRequestAnimationFrame,
  7395. useRequestAnimationFrame = _ref24$useRequestAnim === void 0 ? false : _ref24$useRequestAnim,
  7396. _ref24$pdfBug = _ref24.pdfBug,
  7397. pdfBug = _ref24$pdfBug === void 0 ? false : _ref24$pdfBug,
  7398. _ref24$pageColors = _ref24.pageColors,
  7399. pageColors = _ref24$pageColors === void 0 ? null : _ref24$pageColors;
  7400. _classCallCheck(this, InternalRenderTask);
  7401. this.callback = callback;
  7402. this.params = params;
  7403. this.objs = objs;
  7404. this.commonObjs = commonObjs;
  7405. this.annotationCanvasMap = annotationCanvasMap;
  7406. this.operatorListIdx = null;
  7407. this.operatorList = operatorList;
  7408. this._pageIndex = pageIndex;
  7409. this.canvasFactory = canvasFactory;
  7410. this._pdfBug = pdfBug;
  7411. this.pageColors = pageColors;
  7412. this.running = false;
  7413. this.graphicsReadyCallback = null;
  7414. this.graphicsReady = false;
  7415. this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
  7416. this.cancelled = false;
  7417. this.capability = (0, _util.createPromiseCapability)();
  7418. this.task = new RenderTask(this);
  7419. this._cancelBound = this.cancel.bind(this);
  7420. this._continueBound = this._continue.bind(this);
  7421. this._scheduleNextBound = this._scheduleNext.bind(this);
  7422. this._nextBound = this._next.bind(this);
  7423. this._canvas = params.canvasContext.canvas;
  7424. }
  7425. _createClass(InternalRenderTask, [{
  7426. key: "completed",
  7427. get: function get() {
  7428. return this.capability.promise["catch"](function () {});
  7429. }
  7430. }, {
  7431. key: "initializeGraphics",
  7432. value: function initializeGraphics(_ref25) {
  7433. var _globalThis$StepperMa;
  7434. var _ref25$transparency = _ref25.transparency,
  7435. transparency = _ref25$transparency === void 0 ? false : _ref25$transparency,
  7436. optionalContentConfig = _ref25.optionalContentConfig;
  7437. if (this.cancelled) {
  7438. return;
  7439. }
  7440. if (this._canvas) {
  7441. if (_classStaticPrivateFieldSpecGet(InternalRenderTask, InternalRenderTask, _canvasInUse).has(this._canvas)) {
  7442. throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed.");
  7443. }
  7444. _classStaticPrivateFieldSpecGet(InternalRenderTask, InternalRenderTask, _canvasInUse).add(this._canvas);
  7445. }
  7446. if (this._pdfBug && (_globalThis$StepperMa = globalThis.StepperManager) !== null && _globalThis$StepperMa !== void 0 && _globalThis$StepperMa.enabled) {
  7447. this.stepper = globalThis.StepperManager.create(this._pageIndex);
  7448. this.stepper.init(this.operatorList);
  7449. this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
  7450. }
  7451. var _this$params = this.params,
  7452. canvasContext = _this$params.canvasContext,
  7453. viewport = _this$params.viewport,
  7454. transform = _this$params.transform,
  7455. imageLayer = _this$params.imageLayer,
  7456. background = _this$params.background;
  7457. this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, imageLayer, optionalContentConfig, this.annotationCanvasMap, this.pageColors);
  7458. this.gfx.beginDrawing({
  7459. transform: transform,
  7460. viewport: viewport,
  7461. transparency: transparency,
  7462. background: background
  7463. });
  7464. this.operatorListIdx = 0;
  7465. this.graphicsReady = true;
  7466. if (this.graphicsReadyCallback) {
  7467. this.graphicsReadyCallback();
  7468. }
  7469. }
  7470. }, {
  7471. key: "cancel",
  7472. value: function cancel() {
  7473. var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  7474. this.running = false;
  7475. this.cancelled = true;
  7476. if (this.gfx) {
  7477. this.gfx.endDrawing();
  7478. }
  7479. if (this._canvas) {
  7480. _classStaticPrivateFieldSpecGet(InternalRenderTask, InternalRenderTask, _canvasInUse)["delete"](this._canvas);
  7481. }
  7482. this.callback(error || new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex + 1), "canvas"));
  7483. }
  7484. }, {
  7485. key: "operatorListChanged",
  7486. value: function operatorListChanged() {
  7487. if (!this.graphicsReady) {
  7488. if (!this.graphicsReadyCallback) {
  7489. this.graphicsReadyCallback = this._continueBound;
  7490. }
  7491. return;
  7492. }
  7493. if (this.stepper) {
  7494. this.stepper.updateOperatorList(this.operatorList);
  7495. }
  7496. if (this.running) {
  7497. return;
  7498. }
  7499. this._continue();
  7500. }
  7501. }, {
  7502. key: "_continue",
  7503. value: function _continue() {
  7504. this.running = true;
  7505. if (this.cancelled) {
  7506. return;
  7507. }
  7508. if (this.task.onContinue) {
  7509. this.task.onContinue(this._scheduleNextBound);
  7510. } else {
  7511. this._scheduleNext();
  7512. }
  7513. }
  7514. }, {
  7515. key: "_scheduleNext",
  7516. value: function _scheduleNext() {
  7517. var _this17 = this;
  7518. if (this._useRequestAnimationFrame) {
  7519. window.requestAnimationFrame(function () {
  7520. _this17._nextBound()["catch"](_this17._cancelBound);
  7521. });
  7522. } else {
  7523. Promise.resolve().then(this._nextBound)["catch"](this._cancelBound);
  7524. }
  7525. }
  7526. }, {
  7527. key: "_next",
  7528. value: function () {
  7529. var _next2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
  7530. return _regenerator["default"].wrap(function _callee6$(_context6) {
  7531. while (1) {
  7532. switch (_context6.prev = _context6.next) {
  7533. case 0:
  7534. if (!this.cancelled) {
  7535. _context6.next = 2;
  7536. break;
  7537. }
  7538. return _context6.abrupt("return");
  7539. case 2:
  7540. this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
  7541. if (this.operatorListIdx === this.operatorList.argsArray.length) {
  7542. this.running = false;
  7543. if (this.operatorList.lastChunk) {
  7544. this.gfx.endDrawing();
  7545. if (this._canvas) {
  7546. _classStaticPrivateFieldSpecGet(InternalRenderTask, InternalRenderTask, _canvasInUse)["delete"](this._canvas);
  7547. }
  7548. this.callback();
  7549. }
  7550. }
  7551. case 4:
  7552. case "end":
  7553. return _context6.stop();
  7554. }
  7555. }
  7556. }, _callee6, this);
  7557. }));
  7558. function _next() {
  7559. return _next2.apply(this, arguments);
  7560. }
  7561. return _next;
  7562. }()
  7563. }]);
  7564. return InternalRenderTask;
  7565. }();
  7566. var _canvasInUse = {
  7567. writable: true,
  7568. value: new WeakSet()
  7569. };
  7570. var version = '2.14.305';
  7571. exports.version = version;
  7572. var build = 'eaaa8b4ad';
  7573. exports.build = build;
  7574. /***/ }),
  7575. /* 156 */
  7576. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  7577. "use strict";
  7578. module.exports = __w_pdfjs_require__(157);
  7579. /***/ }),
  7580. /* 157 */
  7581. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  7582. "use strict";
  7583. /* module decorator */ module = __w_pdfjs_require__.nmd(module);
  7584. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  7585. var runtime = function (exports) {
  7586. "use strict";
  7587. var Op = Object.prototype;
  7588. var hasOwn = Op.hasOwnProperty;
  7589. var undefined;
  7590. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  7591. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  7592. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  7593. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7594. function define(obj, key, value) {
  7595. Object.defineProperty(obj, key, {
  7596. value: value,
  7597. enumerable: true,
  7598. configurable: true,
  7599. writable: true
  7600. });
  7601. return obj[key];
  7602. }
  7603. try {
  7604. define({}, "");
  7605. } catch (err) {
  7606. define = function define(obj, key, value) {
  7607. return obj[key] = value;
  7608. };
  7609. }
  7610. function wrap(innerFn, outerFn, self, tryLocsList) {
  7611. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  7612. var generator = Object.create(protoGenerator.prototype);
  7613. var context = new Context(tryLocsList || []);
  7614. generator._invoke = makeInvokeMethod(innerFn, self, context);
  7615. return generator;
  7616. }
  7617. exports.wrap = wrap;
  7618. function tryCatch(fn, obj, arg) {
  7619. try {
  7620. return {
  7621. type: "normal",
  7622. arg: fn.call(obj, arg)
  7623. };
  7624. } catch (err) {
  7625. return {
  7626. type: "throw",
  7627. arg: err
  7628. };
  7629. }
  7630. }
  7631. var GenStateSuspendedStart = "suspendedStart";
  7632. var GenStateSuspendedYield = "suspendedYield";
  7633. var GenStateExecuting = "executing";
  7634. var GenStateCompleted = "completed";
  7635. var ContinueSentinel = {};
  7636. function Generator() {}
  7637. function GeneratorFunction() {}
  7638. function GeneratorFunctionPrototype() {}
  7639. var IteratorPrototype = {};
  7640. define(IteratorPrototype, iteratorSymbol, function () {
  7641. return this;
  7642. });
  7643. var getProto = Object.getPrototypeOf;
  7644. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  7645. if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  7646. IteratorPrototype = NativeIteratorPrototype;
  7647. }
  7648. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  7649. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  7650. define(Gp, "constructor", GeneratorFunctionPrototype);
  7651. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  7652. GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
  7653. function defineIteratorMethods(prototype) {
  7654. ["next", "throw", "return"].forEach(function (method) {
  7655. define(prototype, method, function (arg) {
  7656. return this._invoke(method, arg);
  7657. });
  7658. });
  7659. }
  7660. exports.isGeneratorFunction = function (genFun) {
  7661. var ctor = typeof genFun === "function" && genFun.constructor;
  7662. return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  7663. };
  7664. exports.mark = function (genFun) {
  7665. if (Object.setPrototypeOf) {
  7666. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  7667. } else {
  7668. genFun.__proto__ = GeneratorFunctionPrototype;
  7669. define(genFun, toStringTagSymbol, "GeneratorFunction");
  7670. }
  7671. genFun.prototype = Object.create(Gp);
  7672. return genFun;
  7673. };
  7674. exports.awrap = function (arg) {
  7675. return {
  7676. __await: arg
  7677. };
  7678. };
  7679. function AsyncIterator(generator, PromiseImpl) {
  7680. function invoke(method, arg, resolve, reject) {
  7681. var record = tryCatch(generator[method], generator, arg);
  7682. if (record.type === "throw") {
  7683. reject(record.arg);
  7684. } else {
  7685. var result = record.arg;
  7686. var value = result.value;
  7687. if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
  7688. return PromiseImpl.resolve(value.__await).then(function (value) {
  7689. invoke("next", value, resolve, reject);
  7690. }, function (err) {
  7691. invoke("throw", err, resolve, reject);
  7692. });
  7693. }
  7694. return PromiseImpl.resolve(value).then(function (unwrapped) {
  7695. result.value = unwrapped;
  7696. resolve(result);
  7697. }, function (error) {
  7698. return invoke("throw", error, resolve, reject);
  7699. });
  7700. }
  7701. }
  7702. var previousPromise;
  7703. function enqueue(method, arg) {
  7704. function callInvokeWithMethodAndArg() {
  7705. return new PromiseImpl(function (resolve, reject) {
  7706. invoke(method, arg, resolve, reject);
  7707. });
  7708. }
  7709. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  7710. }
  7711. this._invoke = enqueue;
  7712. }
  7713. defineIteratorMethods(AsyncIterator.prototype);
  7714. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  7715. return this;
  7716. });
  7717. exports.AsyncIterator = AsyncIterator;
  7718. exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  7719. if (PromiseImpl === void 0) PromiseImpl = Promise;
  7720. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  7721. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  7722. return result.done ? result.value : iter.next();
  7723. });
  7724. };
  7725. function makeInvokeMethod(innerFn, self, context) {
  7726. var state = GenStateSuspendedStart;
  7727. return function invoke(method, arg) {
  7728. if (state === GenStateExecuting) {
  7729. throw new Error("Generator is already running");
  7730. }
  7731. if (state === GenStateCompleted) {
  7732. if (method === "throw") {
  7733. throw arg;
  7734. }
  7735. return doneResult();
  7736. }
  7737. context.method = method;
  7738. context.arg = arg;
  7739. while (true) {
  7740. var delegate = context.delegate;
  7741. if (delegate) {
  7742. var delegateResult = maybeInvokeDelegate(delegate, context);
  7743. if (delegateResult) {
  7744. if (delegateResult === ContinueSentinel) continue;
  7745. return delegateResult;
  7746. }
  7747. }
  7748. if (context.method === "next") {
  7749. context.sent = context._sent = context.arg;
  7750. } else if (context.method === "throw") {
  7751. if (state === GenStateSuspendedStart) {
  7752. state = GenStateCompleted;
  7753. throw context.arg;
  7754. }
  7755. context.dispatchException(context.arg);
  7756. } else if (context.method === "return") {
  7757. context.abrupt("return", context.arg);
  7758. }
  7759. state = GenStateExecuting;
  7760. var record = tryCatch(innerFn, self, context);
  7761. if (record.type === "normal") {
  7762. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  7763. if (record.arg === ContinueSentinel) {
  7764. continue;
  7765. }
  7766. return {
  7767. value: record.arg,
  7768. done: context.done
  7769. };
  7770. } else if (record.type === "throw") {
  7771. state = GenStateCompleted;
  7772. context.method = "throw";
  7773. context.arg = record.arg;
  7774. }
  7775. }
  7776. };
  7777. }
  7778. function maybeInvokeDelegate(delegate, context) {
  7779. var method = delegate.iterator[context.method];
  7780. if (method === undefined) {
  7781. context.delegate = null;
  7782. if (context.method === "throw") {
  7783. if (delegate.iterator["return"]) {
  7784. context.method = "return";
  7785. context.arg = undefined;
  7786. maybeInvokeDelegate(delegate, context);
  7787. if (context.method === "throw") {
  7788. return ContinueSentinel;
  7789. }
  7790. }
  7791. context.method = "throw";
  7792. context.arg = new TypeError("The iterator does not provide a 'throw' method");
  7793. }
  7794. return ContinueSentinel;
  7795. }
  7796. var record = tryCatch(method, delegate.iterator, context.arg);
  7797. if (record.type === "throw") {
  7798. context.method = "throw";
  7799. context.arg = record.arg;
  7800. context.delegate = null;
  7801. return ContinueSentinel;
  7802. }
  7803. var info = record.arg;
  7804. if (!info) {
  7805. context.method = "throw";
  7806. context.arg = new TypeError("iterator result is not an object");
  7807. context.delegate = null;
  7808. return ContinueSentinel;
  7809. }
  7810. if (info.done) {
  7811. context[delegate.resultName] = info.value;
  7812. context.next = delegate.nextLoc;
  7813. if (context.method !== "return") {
  7814. context.method = "next";
  7815. context.arg = undefined;
  7816. }
  7817. } else {
  7818. return info;
  7819. }
  7820. context.delegate = null;
  7821. return ContinueSentinel;
  7822. }
  7823. defineIteratorMethods(Gp);
  7824. define(Gp, toStringTagSymbol, "Generator");
  7825. define(Gp, iteratorSymbol, function () {
  7826. return this;
  7827. });
  7828. define(Gp, "toString", function () {
  7829. return "[object Generator]";
  7830. });
  7831. function pushTryEntry(locs) {
  7832. var entry = {
  7833. tryLoc: locs[0]
  7834. };
  7835. if (1 in locs) {
  7836. entry.catchLoc = locs[1];
  7837. }
  7838. if (2 in locs) {
  7839. entry.finallyLoc = locs[2];
  7840. entry.afterLoc = locs[3];
  7841. }
  7842. this.tryEntries.push(entry);
  7843. }
  7844. function resetTryEntry(entry) {
  7845. var record = entry.completion || {};
  7846. record.type = "normal";
  7847. delete record.arg;
  7848. entry.completion = record;
  7849. }
  7850. function Context(tryLocsList) {
  7851. this.tryEntries = [{
  7852. tryLoc: "root"
  7853. }];
  7854. tryLocsList.forEach(pushTryEntry, this);
  7855. this.reset(true);
  7856. }
  7857. exports.keys = function (object) {
  7858. var keys = [];
  7859. for (var key in object) {
  7860. keys.push(key);
  7861. }
  7862. keys.reverse();
  7863. return function next() {
  7864. while (keys.length) {
  7865. var key = keys.pop();
  7866. if (key in object) {
  7867. next.value = key;
  7868. next.done = false;
  7869. return next;
  7870. }
  7871. }
  7872. next.done = true;
  7873. return next;
  7874. };
  7875. };
  7876. function values(iterable) {
  7877. if (iterable) {
  7878. var iteratorMethod = iterable[iteratorSymbol];
  7879. if (iteratorMethod) {
  7880. return iteratorMethod.call(iterable);
  7881. }
  7882. if (typeof iterable.next === "function") {
  7883. return iterable;
  7884. }
  7885. if (!isNaN(iterable.length)) {
  7886. var i = -1,
  7887. next = function next() {
  7888. while (++i < iterable.length) {
  7889. if (hasOwn.call(iterable, i)) {
  7890. next.value = iterable[i];
  7891. next.done = false;
  7892. return next;
  7893. }
  7894. }
  7895. next.value = undefined;
  7896. next.done = true;
  7897. return next;
  7898. };
  7899. return next.next = next;
  7900. }
  7901. }
  7902. return {
  7903. next: doneResult
  7904. };
  7905. }
  7906. exports.values = values;
  7907. function doneResult() {
  7908. return {
  7909. value: undefined,
  7910. done: true
  7911. };
  7912. }
  7913. Context.prototype = {
  7914. constructor: Context,
  7915. reset: function reset(skipTempReset) {
  7916. this.prev = 0;
  7917. this.next = 0;
  7918. this.sent = this._sent = undefined;
  7919. this.done = false;
  7920. this.delegate = null;
  7921. this.method = "next";
  7922. this.arg = undefined;
  7923. this.tryEntries.forEach(resetTryEntry);
  7924. if (!skipTempReset) {
  7925. for (var name in this) {
  7926. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  7927. this[name] = undefined;
  7928. }
  7929. }
  7930. }
  7931. },
  7932. stop: function stop() {
  7933. this.done = true;
  7934. var rootEntry = this.tryEntries[0];
  7935. var rootRecord = rootEntry.completion;
  7936. if (rootRecord.type === "throw") {
  7937. throw rootRecord.arg;
  7938. }
  7939. return this.rval;
  7940. },
  7941. dispatchException: function dispatchException(exception) {
  7942. if (this.done) {
  7943. throw exception;
  7944. }
  7945. var context = this;
  7946. function handle(loc, caught) {
  7947. record.type = "throw";
  7948. record.arg = exception;
  7949. context.next = loc;
  7950. if (caught) {
  7951. context.method = "next";
  7952. context.arg = undefined;
  7953. }
  7954. return !!caught;
  7955. }
  7956. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7957. var entry = this.tryEntries[i];
  7958. var record = entry.completion;
  7959. if (entry.tryLoc === "root") {
  7960. return handle("end");
  7961. }
  7962. if (entry.tryLoc <= this.prev) {
  7963. var hasCatch = hasOwn.call(entry, "catchLoc");
  7964. var hasFinally = hasOwn.call(entry, "finallyLoc");
  7965. if (hasCatch && hasFinally) {
  7966. if (this.prev < entry.catchLoc) {
  7967. return handle(entry.catchLoc, true);
  7968. } else if (this.prev < entry.finallyLoc) {
  7969. return handle(entry.finallyLoc);
  7970. }
  7971. } else if (hasCatch) {
  7972. if (this.prev < entry.catchLoc) {
  7973. return handle(entry.catchLoc, true);
  7974. }
  7975. } else if (hasFinally) {
  7976. if (this.prev < entry.finallyLoc) {
  7977. return handle(entry.finallyLoc);
  7978. }
  7979. } else {
  7980. throw new Error("try statement without catch or finally");
  7981. }
  7982. }
  7983. }
  7984. },
  7985. abrupt: function abrupt(type, arg) {
  7986. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7987. var entry = this.tryEntries[i];
  7988. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  7989. var finallyEntry = entry;
  7990. break;
  7991. }
  7992. }
  7993. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  7994. finallyEntry = null;
  7995. }
  7996. var record = finallyEntry ? finallyEntry.completion : {};
  7997. record.type = type;
  7998. record.arg = arg;
  7999. if (finallyEntry) {
  8000. this.method = "next";
  8001. this.next = finallyEntry.finallyLoc;
  8002. return ContinueSentinel;
  8003. }
  8004. return this.complete(record);
  8005. },
  8006. complete: function complete(record, afterLoc) {
  8007. if (record.type === "throw") {
  8008. throw record.arg;
  8009. }
  8010. if (record.type === "break" || record.type === "continue") {
  8011. this.next = record.arg;
  8012. } else if (record.type === "return") {
  8013. this.rval = this.arg = record.arg;
  8014. this.method = "return";
  8015. this.next = "end";
  8016. } else if (record.type === "normal" && afterLoc) {
  8017. this.next = afterLoc;
  8018. }
  8019. return ContinueSentinel;
  8020. },
  8021. finish: function finish(finallyLoc) {
  8022. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8023. var entry = this.tryEntries[i];
  8024. if (entry.finallyLoc === finallyLoc) {
  8025. this.complete(entry.completion, entry.afterLoc);
  8026. resetTryEntry(entry);
  8027. return ContinueSentinel;
  8028. }
  8029. }
  8030. },
  8031. "catch": function _catch(tryLoc) {
  8032. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  8033. var entry = this.tryEntries[i];
  8034. if (entry.tryLoc === tryLoc) {
  8035. var record = entry.completion;
  8036. if (record.type === "throw") {
  8037. var thrown = record.arg;
  8038. resetTryEntry(entry);
  8039. }
  8040. return thrown;
  8041. }
  8042. }
  8043. throw new Error("illegal catch attempt");
  8044. },
  8045. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  8046. this.delegate = {
  8047. iterator: values(iterable),
  8048. resultName: resultName,
  8049. nextLoc: nextLoc
  8050. };
  8051. if (this.method === "next") {
  8052. this.arg = undefined;
  8053. }
  8054. return ContinueSentinel;
  8055. }
  8056. };
  8057. return exports;
  8058. }(( false ? 0 : _typeof(module)) === "object" ? module.exports : {});
  8059. try {
  8060. regeneratorRuntime = runtime;
  8061. } catch (accidentalStrictMode) {
  8062. if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
  8063. globalThis.regeneratorRuntime = runtime;
  8064. } else {
  8065. Function("r", "regeneratorRuntime = r")(runtime);
  8066. }
  8067. }
  8068. /***/ }),
  8069. /* 158 */
  8070. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8071. "use strict";
  8072. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  8073. Object.defineProperty(exports, "__esModule", ({
  8074. value: true
  8075. }));
  8076. exports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PageViewport = exports.PDFDateString = exports.DOMStandardFontDataFactory = exports.DOMSVGFactory = exports.DOMCanvasFactory = exports.DOMCMapReaderFactory = void 0;
  8077. exports.deprecated = deprecated;
  8078. exports.getFilenameFromUrl = getFilenameFromUrl;
  8079. exports.getPdfFilenameFromUrl = getPdfFilenameFromUrl;
  8080. exports.getXfaPageViewport = getXfaPageViewport;
  8081. exports.isDataScheme = isDataScheme;
  8082. exports.isPdfFile = isPdfFile;
  8083. exports.isValidFetchUrl = isValidFetchUrl;
  8084. exports.loadScript = loadScript;
  8085. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  8086. var _base_factory = __w_pdfjs_require__(159);
  8087. var _util = __w_pdfjs_require__(1);
  8088. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8089. 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; } } }; }
  8090. 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); }
  8091. 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; }
  8092. 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); } }
  8093. 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); }); }; }
  8094. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8095. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8096. 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); }; }
  8097. 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); }
  8098. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8099. 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; } }
  8100. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8101. 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); } }
  8102. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8103. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8104. 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; }
  8105. var SVG_NS = "http://www.w3.org/2000/svg";
  8106. var PixelsPerInch = /*#__PURE__*/_createClass(function PixelsPerInch() {
  8107. _classCallCheck(this, PixelsPerInch);
  8108. });
  8109. exports.PixelsPerInch = PixelsPerInch;
  8110. _defineProperty(PixelsPerInch, "CSS", 96.0);
  8111. _defineProperty(PixelsPerInch, "PDF", 72.0);
  8112. _defineProperty(PixelsPerInch, "PDF_TO_CSS_UNITS", PixelsPerInch.CSS / PixelsPerInch.PDF);
  8113. var DOMCanvasFactory = /*#__PURE__*/function (_BaseCanvasFactory) {
  8114. _inherits(DOMCanvasFactory, _BaseCanvasFactory);
  8115. var _super = _createSuper(DOMCanvasFactory);
  8116. function DOMCanvasFactory() {
  8117. var _this;
  8118. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  8119. _ref$ownerDocument = _ref.ownerDocument,
  8120. ownerDocument = _ref$ownerDocument === void 0 ? globalThis.document : _ref$ownerDocument;
  8121. _classCallCheck(this, DOMCanvasFactory);
  8122. _this = _super.call(this);
  8123. _this._document = ownerDocument;
  8124. return _this;
  8125. }
  8126. _createClass(DOMCanvasFactory, [{
  8127. key: "_createCanvas",
  8128. value: function _createCanvas(width, height) {
  8129. var canvas = this._document.createElement("canvas");
  8130. canvas.width = width;
  8131. canvas.height = height;
  8132. return canvas;
  8133. }
  8134. }]);
  8135. return DOMCanvasFactory;
  8136. }(_base_factory.BaseCanvasFactory);
  8137. exports.DOMCanvasFactory = DOMCanvasFactory;
  8138. function fetchData(_x) {
  8139. return _fetchData.apply(this, arguments);
  8140. }
  8141. function _fetchData() {
  8142. _fetchData = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(url) {
  8143. var asTypedArray,
  8144. response,
  8145. _args = arguments;
  8146. return _regenerator["default"].wrap(function _callee$(_context) {
  8147. while (1) {
  8148. switch (_context.prev = _context.next) {
  8149. case 0:
  8150. asTypedArray = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
  8151. if (!isValidFetchUrl(url, document.baseURI)) {
  8152. _context.next = 21;
  8153. break;
  8154. }
  8155. _context.next = 4;
  8156. return fetch(url);
  8157. case 4:
  8158. response = _context.sent;
  8159. if (response.ok) {
  8160. _context.next = 7;
  8161. break;
  8162. }
  8163. throw new Error(response.statusText);
  8164. case 7:
  8165. if (!asTypedArray) {
  8166. _context.next = 15;
  8167. break;
  8168. }
  8169. _context.t1 = Uint8Array;
  8170. _context.next = 11;
  8171. return response.arrayBuffer();
  8172. case 11:
  8173. _context.t2 = _context.sent;
  8174. _context.t0 = new _context.t1(_context.t2);
  8175. _context.next = 20;
  8176. break;
  8177. case 15:
  8178. _context.t3 = _util.stringToBytes;
  8179. _context.next = 18;
  8180. return response.text();
  8181. case 18:
  8182. _context.t4 = _context.sent;
  8183. _context.t0 = (0, _context.t3)(_context.t4);
  8184. case 20:
  8185. return _context.abrupt("return", _context.t0);
  8186. case 21:
  8187. return _context.abrupt("return", new Promise(function (resolve, reject) {
  8188. var request = new XMLHttpRequest();
  8189. request.open("GET", url, true);
  8190. if (asTypedArray) {
  8191. request.responseType = "arraybuffer";
  8192. }
  8193. request.onreadystatechange = function () {
  8194. if (request.readyState !== XMLHttpRequest.DONE) {
  8195. return;
  8196. }
  8197. if (request.status === 200 || request.status === 0) {
  8198. var data;
  8199. if (asTypedArray && request.response) {
  8200. data = new Uint8Array(request.response);
  8201. } else if (!asTypedArray && request.responseText) {
  8202. data = (0, _util.stringToBytes)(request.responseText);
  8203. }
  8204. if (data) {
  8205. resolve(data);
  8206. return;
  8207. }
  8208. }
  8209. reject(new Error(request.statusText));
  8210. };
  8211. request.send(null);
  8212. }));
  8213. case 22:
  8214. case "end":
  8215. return _context.stop();
  8216. }
  8217. }
  8218. }, _callee);
  8219. }));
  8220. return _fetchData.apply(this, arguments);
  8221. }
  8222. var DOMCMapReaderFactory = /*#__PURE__*/function (_BaseCMapReaderFactor) {
  8223. _inherits(DOMCMapReaderFactory, _BaseCMapReaderFactor);
  8224. var _super2 = _createSuper(DOMCMapReaderFactory);
  8225. function DOMCMapReaderFactory() {
  8226. _classCallCheck(this, DOMCMapReaderFactory);
  8227. return _super2.apply(this, arguments);
  8228. }
  8229. _createClass(DOMCMapReaderFactory, [{
  8230. key: "_fetchData",
  8231. value: function _fetchData(url, compressionType) {
  8232. return fetchData(url, this.isCompressed).then(function (data) {
  8233. return {
  8234. cMapData: data,
  8235. compressionType: compressionType
  8236. };
  8237. });
  8238. }
  8239. }]);
  8240. return DOMCMapReaderFactory;
  8241. }(_base_factory.BaseCMapReaderFactory);
  8242. exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
  8243. var DOMStandardFontDataFactory = /*#__PURE__*/function (_BaseStandardFontData) {
  8244. _inherits(DOMStandardFontDataFactory, _BaseStandardFontData);
  8245. var _super3 = _createSuper(DOMStandardFontDataFactory);
  8246. function DOMStandardFontDataFactory() {
  8247. _classCallCheck(this, DOMStandardFontDataFactory);
  8248. return _super3.apply(this, arguments);
  8249. }
  8250. _createClass(DOMStandardFontDataFactory, [{
  8251. key: "_fetchData",
  8252. value: function _fetchData(url) {
  8253. return fetchData(url, true);
  8254. }
  8255. }]);
  8256. return DOMStandardFontDataFactory;
  8257. }(_base_factory.BaseStandardFontDataFactory);
  8258. exports.DOMStandardFontDataFactory = DOMStandardFontDataFactory;
  8259. var DOMSVGFactory = /*#__PURE__*/function (_BaseSVGFactory) {
  8260. _inherits(DOMSVGFactory, _BaseSVGFactory);
  8261. var _super4 = _createSuper(DOMSVGFactory);
  8262. function DOMSVGFactory() {
  8263. _classCallCheck(this, DOMSVGFactory);
  8264. return _super4.apply(this, arguments);
  8265. }
  8266. _createClass(DOMSVGFactory, [{
  8267. key: "_createSVG",
  8268. value: function _createSVG(type) {
  8269. return document.createElementNS(SVG_NS, type);
  8270. }
  8271. }]);
  8272. return DOMSVGFactory;
  8273. }(_base_factory.BaseSVGFactory);
  8274. exports.DOMSVGFactory = DOMSVGFactory;
  8275. var PageViewport = /*#__PURE__*/function () {
  8276. function PageViewport(_ref2) {
  8277. var viewBox = _ref2.viewBox,
  8278. scale = _ref2.scale,
  8279. rotation = _ref2.rotation,
  8280. _ref2$offsetX = _ref2.offsetX,
  8281. offsetX = _ref2$offsetX === void 0 ? 0 : _ref2$offsetX,
  8282. _ref2$offsetY = _ref2.offsetY,
  8283. offsetY = _ref2$offsetY === void 0 ? 0 : _ref2$offsetY,
  8284. _ref2$dontFlip = _ref2.dontFlip,
  8285. dontFlip = _ref2$dontFlip === void 0 ? false : _ref2$dontFlip;
  8286. _classCallCheck(this, PageViewport);
  8287. this.viewBox = viewBox;
  8288. this.scale = scale;
  8289. this.rotation = rotation;
  8290. this.offsetX = offsetX;
  8291. this.offsetY = offsetY;
  8292. var centerX = (viewBox[2] + viewBox[0]) / 2;
  8293. var centerY = (viewBox[3] + viewBox[1]) / 2;
  8294. var rotateA, rotateB, rotateC, rotateD;
  8295. rotation %= 360;
  8296. if (rotation < 0) {
  8297. rotation += 360;
  8298. }
  8299. switch (rotation) {
  8300. case 180:
  8301. rotateA = -1;
  8302. rotateB = 0;
  8303. rotateC = 0;
  8304. rotateD = 1;
  8305. break;
  8306. case 90:
  8307. rotateA = 0;
  8308. rotateB = 1;
  8309. rotateC = 1;
  8310. rotateD = 0;
  8311. break;
  8312. case 270:
  8313. rotateA = 0;
  8314. rotateB = -1;
  8315. rotateC = -1;
  8316. rotateD = 0;
  8317. break;
  8318. case 0:
  8319. rotateA = 1;
  8320. rotateB = 0;
  8321. rotateC = 0;
  8322. rotateD = -1;
  8323. break;
  8324. default:
  8325. throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
  8326. }
  8327. if (dontFlip) {
  8328. rotateC = -rotateC;
  8329. rotateD = -rotateD;
  8330. }
  8331. var offsetCanvasX, offsetCanvasY;
  8332. var width, height;
  8333. if (rotateA === 0) {
  8334. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  8335. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  8336. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  8337. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  8338. } else {
  8339. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  8340. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  8341. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  8342. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  8343. }
  8344. this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
  8345. this.width = width;
  8346. this.height = height;
  8347. }
  8348. _createClass(PageViewport, [{
  8349. key: "clone",
  8350. value: function clone() {
  8351. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  8352. _ref3$scale = _ref3.scale,
  8353. scale = _ref3$scale === void 0 ? this.scale : _ref3$scale,
  8354. _ref3$rotation = _ref3.rotation,
  8355. rotation = _ref3$rotation === void 0 ? this.rotation : _ref3$rotation,
  8356. _ref3$offsetX = _ref3.offsetX,
  8357. offsetX = _ref3$offsetX === void 0 ? this.offsetX : _ref3$offsetX,
  8358. _ref3$offsetY = _ref3.offsetY,
  8359. offsetY = _ref3$offsetY === void 0 ? this.offsetY : _ref3$offsetY,
  8360. _ref3$dontFlip = _ref3.dontFlip,
  8361. dontFlip = _ref3$dontFlip === void 0 ? false : _ref3$dontFlip;
  8362. return new PageViewport({
  8363. viewBox: this.viewBox.slice(),
  8364. scale: scale,
  8365. rotation: rotation,
  8366. offsetX: offsetX,
  8367. offsetY: offsetY,
  8368. dontFlip: dontFlip
  8369. });
  8370. }
  8371. }, {
  8372. key: "convertToViewportPoint",
  8373. value: function convertToViewportPoint(x, y) {
  8374. return _util.Util.applyTransform([x, y], this.transform);
  8375. }
  8376. }, {
  8377. key: "convertToViewportRectangle",
  8378. value: function convertToViewportRectangle(rect) {
  8379. var topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform);
  8380. var bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform);
  8381. return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
  8382. }
  8383. }, {
  8384. key: "convertToPdfPoint",
  8385. value: function convertToPdfPoint(x, y) {
  8386. return _util.Util.applyInverseTransform([x, y], this.transform);
  8387. }
  8388. }]);
  8389. return PageViewport;
  8390. }();
  8391. exports.PageViewport = PageViewport;
  8392. var RenderingCancelledException = /*#__PURE__*/function (_BaseException) {
  8393. _inherits(RenderingCancelledException, _BaseException);
  8394. var _super5 = _createSuper(RenderingCancelledException);
  8395. function RenderingCancelledException(msg, type) {
  8396. var _this2;
  8397. _classCallCheck(this, RenderingCancelledException);
  8398. _this2 = _super5.call(this, msg, "RenderingCancelledException");
  8399. _this2.type = type;
  8400. return _this2;
  8401. }
  8402. return _createClass(RenderingCancelledException);
  8403. }(_util.BaseException);
  8404. exports.RenderingCancelledException = RenderingCancelledException;
  8405. function isDataScheme(url) {
  8406. var ii = url.length;
  8407. var i = 0;
  8408. while (i < ii && url[i].trim() === "") {
  8409. i++;
  8410. }
  8411. return url.substring(i, i + 5).toLowerCase() === "data:";
  8412. }
  8413. function isPdfFile(filename) {
  8414. return typeof filename === "string" && /\.pdf$/i.test(filename);
  8415. }
  8416. function getFilenameFromUrl(url) {
  8417. var anchor = url.indexOf("#");
  8418. var query = url.indexOf("?");
  8419. var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);
  8420. return url.substring(url.lastIndexOf("/", end) + 1, end);
  8421. }
  8422. function getPdfFilenameFromUrl(url) {
  8423. var defaultFilename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "document.pdf";
  8424. if (typeof url !== "string") {
  8425. return defaultFilename;
  8426. }
  8427. if (isDataScheme(url)) {
  8428. (0, _util.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');
  8429. return defaultFilename;
  8430. }
  8431. var reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
  8432. var reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
  8433. var splitURI = reURI.exec(url);
  8434. var suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);
  8435. if (suggestedFilename) {
  8436. suggestedFilename = suggestedFilename[0];
  8437. if (suggestedFilename.includes("%")) {
  8438. try {
  8439. suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
  8440. } catch (ex) {}
  8441. }
  8442. }
  8443. return suggestedFilename || defaultFilename;
  8444. }
  8445. var StatTimer = /*#__PURE__*/function () {
  8446. function StatTimer() {
  8447. _classCallCheck(this, StatTimer);
  8448. this.started = Object.create(null);
  8449. this.times = [];
  8450. }
  8451. _createClass(StatTimer, [{
  8452. key: "time",
  8453. value: function time(name) {
  8454. if (name in this.started) {
  8455. (0, _util.warn)("Timer is already running for ".concat(name));
  8456. }
  8457. this.started[name] = Date.now();
  8458. }
  8459. }, {
  8460. key: "timeEnd",
  8461. value: function timeEnd(name) {
  8462. if (!(name in this.started)) {
  8463. (0, _util.warn)("Timer has not been started for ".concat(name));
  8464. }
  8465. this.times.push({
  8466. name: name,
  8467. start: this.started[name],
  8468. end: Date.now()
  8469. });
  8470. delete this.started[name];
  8471. }
  8472. }, {
  8473. key: "toString",
  8474. value: function toString() {
  8475. var outBuf = [];
  8476. var longest = 0;
  8477. var _iterator = _createForOfIteratorHelper(this.times),
  8478. _step;
  8479. try {
  8480. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  8481. var time = _step.value;
  8482. var name = time.name;
  8483. if (name.length > longest) {
  8484. longest = name.length;
  8485. }
  8486. }
  8487. } catch (err) {
  8488. _iterator.e(err);
  8489. } finally {
  8490. _iterator.f();
  8491. }
  8492. var _iterator2 = _createForOfIteratorHelper(this.times),
  8493. _step2;
  8494. try {
  8495. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  8496. var _time = _step2.value;
  8497. var duration = _time.end - _time.start;
  8498. outBuf.push("".concat(_time.name.padEnd(longest), " ").concat(duration, "ms\n"));
  8499. }
  8500. } catch (err) {
  8501. _iterator2.e(err);
  8502. } finally {
  8503. _iterator2.f();
  8504. }
  8505. return outBuf.join("");
  8506. }
  8507. }]);
  8508. return StatTimer;
  8509. }();
  8510. exports.StatTimer = StatTimer;
  8511. function isValidFetchUrl(url, baseUrl) {
  8512. try {
  8513. var _ref4 = baseUrl ? new URL(url, baseUrl) : new URL(url),
  8514. protocol = _ref4.protocol;
  8515. return protocol === "http:" || protocol === "https:";
  8516. } catch (ex) {
  8517. return false;
  8518. }
  8519. }
  8520. function loadScript(src) {
  8521. var removeScriptElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8522. return new Promise(function (resolve, reject) {
  8523. var script = document.createElement("script");
  8524. script.src = src;
  8525. script.onload = function (evt) {
  8526. if (removeScriptElement) {
  8527. script.remove();
  8528. }
  8529. resolve(evt);
  8530. };
  8531. script.onerror = function () {
  8532. reject(new Error("Cannot load script at: ".concat(script.src)));
  8533. };
  8534. (document.head || document.documentElement).appendChild(script);
  8535. });
  8536. }
  8537. function deprecated(details) {
  8538. console.log("Deprecated API usage: " + details);
  8539. }
  8540. var pdfDateStringRegex;
  8541. var PDFDateString = /*#__PURE__*/function () {
  8542. function PDFDateString() {
  8543. _classCallCheck(this, PDFDateString);
  8544. }
  8545. _createClass(PDFDateString, null, [{
  8546. key: "toDateObject",
  8547. value: function toDateObject(input) {
  8548. if (!input || typeof input !== "string") {
  8549. return null;
  8550. }
  8551. if (!pdfDateStringRegex) {
  8552. pdfDateStringRegex = new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?");
  8553. }
  8554. var matches = pdfDateStringRegex.exec(input);
  8555. if (!matches) {
  8556. return null;
  8557. }
  8558. var year = parseInt(matches[1], 10);
  8559. var month = parseInt(matches[2], 10);
  8560. month = month >= 1 && month <= 12 ? month - 1 : 0;
  8561. var day = parseInt(matches[3], 10);
  8562. day = day >= 1 && day <= 31 ? day : 1;
  8563. var hour = parseInt(matches[4], 10);
  8564. hour = hour >= 0 && hour <= 23 ? hour : 0;
  8565. var minute = parseInt(matches[5], 10);
  8566. minute = minute >= 0 && minute <= 59 ? minute : 0;
  8567. var second = parseInt(matches[6], 10);
  8568. second = second >= 0 && second <= 59 ? second : 0;
  8569. var universalTimeRelation = matches[7] || "Z";
  8570. var offsetHour = parseInt(matches[8], 10);
  8571. offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
  8572. var offsetMinute = parseInt(matches[9], 10) || 0;
  8573. offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
  8574. if (universalTimeRelation === "-") {
  8575. hour += offsetHour;
  8576. minute += offsetMinute;
  8577. } else if (universalTimeRelation === "+") {
  8578. hour -= offsetHour;
  8579. minute -= offsetMinute;
  8580. }
  8581. return new Date(Date.UTC(year, month, day, hour, minute, second));
  8582. }
  8583. }]);
  8584. return PDFDateString;
  8585. }();
  8586. exports.PDFDateString = PDFDateString;
  8587. function getXfaPageViewport(xfaPage, _ref5) {
  8588. var _ref5$scale = _ref5.scale,
  8589. scale = _ref5$scale === void 0 ? 1 : _ref5$scale,
  8590. _ref5$rotation = _ref5.rotation,
  8591. rotation = _ref5$rotation === void 0 ? 0 : _ref5$rotation;
  8592. var _xfaPage$attributes$s = xfaPage.attributes.style,
  8593. width = _xfaPage$attributes$s.width,
  8594. height = _xfaPage$attributes$s.height;
  8595. var viewBox = [0, 0, parseInt(width), parseInt(height)];
  8596. return new PageViewport({
  8597. viewBox: viewBox,
  8598. scale: scale,
  8599. rotation: rotation
  8600. });
  8601. }
  8602. /***/ }),
  8603. /* 159 */
  8604. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8605. "use strict";
  8606. Object.defineProperty(exports, "__esModule", ({
  8607. value: true
  8608. }));
  8609. exports.BaseStandardFontDataFactory = exports.BaseSVGFactory = exports.BaseCanvasFactory = exports.BaseCMapReaderFactory = void 0;
  8610. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  8611. var _util = __w_pdfjs_require__(1);
  8612. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8613. 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); } }
  8614. 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); }); }; }
  8615. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8616. 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); } }
  8617. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8618. var BaseCanvasFactory = /*#__PURE__*/function () {
  8619. function BaseCanvasFactory() {
  8620. _classCallCheck(this, BaseCanvasFactory);
  8621. if (this.constructor === BaseCanvasFactory) {
  8622. (0, _util.unreachable)("Cannot initialize BaseCanvasFactory.");
  8623. }
  8624. }
  8625. _createClass(BaseCanvasFactory, [{
  8626. key: "create",
  8627. value: function create(width, height) {
  8628. if (width <= 0 || height <= 0) {
  8629. throw new Error("Invalid canvas size");
  8630. }
  8631. var canvas = this._createCanvas(width, height);
  8632. return {
  8633. canvas: canvas,
  8634. context: canvas.getContext("2d")
  8635. };
  8636. }
  8637. }, {
  8638. key: "reset",
  8639. value: function reset(canvasAndContext, width, height) {
  8640. if (!canvasAndContext.canvas) {
  8641. throw new Error("Canvas is not specified");
  8642. }
  8643. if (width <= 0 || height <= 0) {
  8644. throw new Error("Invalid canvas size");
  8645. }
  8646. canvasAndContext.canvas.width = width;
  8647. canvasAndContext.canvas.height = height;
  8648. }
  8649. }, {
  8650. key: "destroy",
  8651. value: function destroy(canvasAndContext) {
  8652. if (!canvasAndContext.canvas) {
  8653. throw new Error("Canvas is not specified");
  8654. }
  8655. canvasAndContext.canvas.width = 0;
  8656. canvasAndContext.canvas.height = 0;
  8657. canvasAndContext.canvas = null;
  8658. canvasAndContext.context = null;
  8659. }
  8660. }, {
  8661. key: "_createCanvas",
  8662. value: function _createCanvas(width, height) {
  8663. (0, _util.unreachable)("Abstract method `_createCanvas` called.");
  8664. }
  8665. }]);
  8666. return BaseCanvasFactory;
  8667. }();
  8668. exports.BaseCanvasFactory = BaseCanvasFactory;
  8669. var BaseCMapReaderFactory = /*#__PURE__*/function () {
  8670. function BaseCMapReaderFactory(_ref) {
  8671. var _ref$baseUrl = _ref.baseUrl,
  8672. baseUrl = _ref$baseUrl === void 0 ? null : _ref$baseUrl,
  8673. _ref$isCompressed = _ref.isCompressed,
  8674. isCompressed = _ref$isCompressed === void 0 ? false : _ref$isCompressed;
  8675. _classCallCheck(this, BaseCMapReaderFactory);
  8676. if (this.constructor === BaseCMapReaderFactory) {
  8677. (0, _util.unreachable)("Cannot initialize BaseCMapReaderFactory.");
  8678. }
  8679. this.baseUrl = baseUrl;
  8680. this.isCompressed = isCompressed;
  8681. }
  8682. _createClass(BaseCMapReaderFactory, [{
  8683. key: "fetch",
  8684. value: function () {
  8685. var _fetch = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref2) {
  8686. var _this = this;
  8687. var name, url, compressionType;
  8688. return _regenerator["default"].wrap(function _callee$(_context) {
  8689. while (1) {
  8690. switch (_context.prev = _context.next) {
  8691. case 0:
  8692. name = _ref2.name;
  8693. if (this.baseUrl) {
  8694. _context.next = 3;
  8695. break;
  8696. }
  8697. throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.');
  8698. case 3:
  8699. if (name) {
  8700. _context.next = 5;
  8701. break;
  8702. }
  8703. throw new Error("CMap name must be specified.");
  8704. case 5:
  8705. url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
  8706. compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE;
  8707. return _context.abrupt("return", this._fetchData(url, compressionType)["catch"](function (reason) {
  8708. throw new Error("Unable to load ".concat(_this.isCompressed ? "binary " : "", "CMap at: ").concat(url));
  8709. }));
  8710. case 8:
  8711. case "end":
  8712. return _context.stop();
  8713. }
  8714. }
  8715. }, _callee, this);
  8716. }));
  8717. function fetch(_x) {
  8718. return _fetch.apply(this, arguments);
  8719. }
  8720. return fetch;
  8721. }()
  8722. }, {
  8723. key: "_fetchData",
  8724. value: function _fetchData(url, compressionType) {
  8725. (0, _util.unreachable)("Abstract method `_fetchData` called.");
  8726. }
  8727. }]);
  8728. return BaseCMapReaderFactory;
  8729. }();
  8730. exports.BaseCMapReaderFactory = BaseCMapReaderFactory;
  8731. var BaseStandardFontDataFactory = /*#__PURE__*/function () {
  8732. function BaseStandardFontDataFactory(_ref3) {
  8733. var _ref3$baseUrl = _ref3.baseUrl,
  8734. baseUrl = _ref3$baseUrl === void 0 ? null : _ref3$baseUrl;
  8735. _classCallCheck(this, BaseStandardFontDataFactory);
  8736. if (this.constructor === BaseStandardFontDataFactory) {
  8737. (0, _util.unreachable)("Cannot initialize BaseStandardFontDataFactory.");
  8738. }
  8739. this.baseUrl = baseUrl;
  8740. }
  8741. _createClass(BaseStandardFontDataFactory, [{
  8742. key: "fetch",
  8743. value: function () {
  8744. var _fetch2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref4) {
  8745. var filename, url;
  8746. return _regenerator["default"].wrap(function _callee2$(_context2) {
  8747. while (1) {
  8748. switch (_context2.prev = _context2.next) {
  8749. case 0:
  8750. filename = _ref4.filename;
  8751. if (this.baseUrl) {
  8752. _context2.next = 3;
  8753. break;
  8754. }
  8755. throw new Error('The standard font "baseUrl" parameter must be specified, ensure that ' + 'the "standardFontDataUrl" API parameter is provided.');
  8756. case 3:
  8757. if (filename) {
  8758. _context2.next = 5;
  8759. break;
  8760. }
  8761. throw new Error("Font filename must be specified.");
  8762. case 5:
  8763. url = "".concat(this.baseUrl).concat(filename);
  8764. return _context2.abrupt("return", this._fetchData(url)["catch"](function (reason) {
  8765. throw new Error("Unable to load font data at: ".concat(url));
  8766. }));
  8767. case 7:
  8768. case "end":
  8769. return _context2.stop();
  8770. }
  8771. }
  8772. }, _callee2, this);
  8773. }));
  8774. function fetch(_x2) {
  8775. return _fetch2.apply(this, arguments);
  8776. }
  8777. return fetch;
  8778. }()
  8779. }, {
  8780. key: "_fetchData",
  8781. value: function _fetchData(url) {
  8782. (0, _util.unreachable)("Abstract method `_fetchData` called.");
  8783. }
  8784. }]);
  8785. return BaseStandardFontDataFactory;
  8786. }();
  8787. exports.BaseStandardFontDataFactory = BaseStandardFontDataFactory;
  8788. var BaseSVGFactory = /*#__PURE__*/function () {
  8789. function BaseSVGFactory() {
  8790. _classCallCheck(this, BaseSVGFactory);
  8791. if (this.constructor === BaseSVGFactory) {
  8792. (0, _util.unreachable)("Cannot initialize BaseSVGFactory.");
  8793. }
  8794. }
  8795. _createClass(BaseSVGFactory, [{
  8796. key: "create",
  8797. value: function create(width, height) {
  8798. if (width <= 0 || height <= 0) {
  8799. throw new Error("Invalid SVG dimensions");
  8800. }
  8801. var svg = this._createSVG("svg:svg");
  8802. svg.setAttribute("version", "1.1");
  8803. svg.setAttribute("width", "".concat(width, "px"));
  8804. svg.setAttribute("height", "".concat(height, "px"));
  8805. svg.setAttribute("preserveAspectRatio", "none");
  8806. svg.setAttribute("viewBox", "0 0 ".concat(width, " ").concat(height));
  8807. return svg;
  8808. }
  8809. }, {
  8810. key: "createElement",
  8811. value: function createElement(type) {
  8812. if (typeof type !== "string") {
  8813. throw new Error("Invalid SVG element type");
  8814. }
  8815. return this._createSVG(type);
  8816. }
  8817. }, {
  8818. key: "_createSVG",
  8819. value: function _createSVG(type) {
  8820. (0, _util.unreachable)("Abstract method `_createSVG` called.");
  8821. }
  8822. }]);
  8823. return BaseSVGFactory;
  8824. }();
  8825. exports.BaseSVGFactory = BaseSVGFactory;
  8826. /***/ }),
  8827. /* 160 */
  8828. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8829. "use strict";
  8830. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  8831. Object.defineProperty(exports, "__esModule", ({
  8832. value: true
  8833. }));
  8834. exports.FontLoader = exports.FontFaceObject = void 0;
  8835. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  8836. var _util = __w_pdfjs_require__(1);
  8837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8838. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  8839. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  8840. 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); }; }
  8841. 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); }
  8842. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  8843. 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; } }
  8844. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  8845. 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); } }
  8846. 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); }); }; }
  8847. 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; } } }; }
  8848. 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); }
  8849. 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; }
  8850. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8851. 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); } }
  8852. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  8853. var BaseFontLoader = /*#__PURE__*/function () {
  8854. function BaseFontLoader(_ref) {
  8855. var docId = _ref.docId,
  8856. onUnsupportedFeature = _ref.onUnsupportedFeature,
  8857. _ref$ownerDocument = _ref.ownerDocument,
  8858. ownerDocument = _ref$ownerDocument === void 0 ? globalThis.document : _ref$ownerDocument,
  8859. _ref$styleElement = _ref.styleElement,
  8860. styleElement = _ref$styleElement === void 0 ? null : _ref$styleElement;
  8861. _classCallCheck(this, BaseFontLoader);
  8862. if (this.constructor === BaseFontLoader) {
  8863. (0, _util.unreachable)("Cannot initialize BaseFontLoader.");
  8864. }
  8865. this.docId = docId;
  8866. this._onUnsupportedFeature = onUnsupportedFeature;
  8867. this._document = ownerDocument;
  8868. this.nativeFontFaces = [];
  8869. this.styleElement = null;
  8870. }
  8871. _createClass(BaseFontLoader, [{
  8872. key: "addNativeFontFace",
  8873. value: function addNativeFontFace(nativeFontFace) {
  8874. this.nativeFontFaces.push(nativeFontFace);
  8875. this._document.fonts.add(nativeFontFace);
  8876. }
  8877. }, {
  8878. key: "insertRule",
  8879. value: function insertRule(rule) {
  8880. var styleElement = this.styleElement;
  8881. if (!styleElement) {
  8882. styleElement = this.styleElement = this._document.createElement("style");
  8883. styleElement.id = "PDFJS_FONT_STYLE_TAG_".concat(this.docId);
  8884. this._document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement);
  8885. }
  8886. var styleSheet = styleElement.sheet;
  8887. styleSheet.insertRule(rule, styleSheet.cssRules.length);
  8888. }
  8889. }, {
  8890. key: "clear",
  8891. value: function clear() {
  8892. var _iterator = _createForOfIteratorHelper(this.nativeFontFaces),
  8893. _step;
  8894. try {
  8895. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  8896. var nativeFontFace = _step.value;
  8897. this._document.fonts["delete"](nativeFontFace);
  8898. }
  8899. } catch (err) {
  8900. _iterator.e(err);
  8901. } finally {
  8902. _iterator.f();
  8903. }
  8904. this.nativeFontFaces.length = 0;
  8905. if (this.styleElement) {
  8906. this.styleElement.remove();
  8907. this.styleElement = null;
  8908. }
  8909. }
  8910. }, {
  8911. key: "bind",
  8912. value: function () {
  8913. var _bind = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(font) {
  8914. var _this = this;
  8915. var nativeFontFace, rule;
  8916. return _regenerator["default"].wrap(function _callee$(_context) {
  8917. while (1) {
  8918. switch (_context.prev = _context.next) {
  8919. case 0:
  8920. if (!(font.attached || font.missingFile)) {
  8921. _context.next = 2;
  8922. break;
  8923. }
  8924. return _context.abrupt("return");
  8925. case 2:
  8926. font.attached = true;
  8927. if (!this.isFontLoadingAPISupported) {
  8928. _context.next = 19;
  8929. break;
  8930. }
  8931. nativeFontFace = font.createNativeFontFace();
  8932. if (!nativeFontFace) {
  8933. _context.next = 18;
  8934. break;
  8935. }
  8936. this.addNativeFontFace(nativeFontFace);
  8937. _context.prev = 7;
  8938. _context.next = 10;
  8939. return nativeFontFace.loaded;
  8940. case 10:
  8941. _context.next = 18;
  8942. break;
  8943. case 12:
  8944. _context.prev = 12;
  8945. _context.t0 = _context["catch"](7);
  8946. this._onUnsupportedFeature({
  8947. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative
  8948. });
  8949. (0, _util.warn)("Failed to load font '".concat(nativeFontFace.family, "': '").concat(_context.t0, "'."));
  8950. font.disableFontFace = true;
  8951. throw _context.t0;
  8952. case 18:
  8953. return _context.abrupt("return");
  8954. case 19:
  8955. rule = font.createFontFaceRule();
  8956. if (!rule) {
  8957. _context.next = 26;
  8958. break;
  8959. }
  8960. this.insertRule(rule);
  8961. if (!this.isSyncFontLoadingSupported) {
  8962. _context.next = 24;
  8963. break;
  8964. }
  8965. return _context.abrupt("return");
  8966. case 24:
  8967. _context.next = 26;
  8968. return new Promise(function (resolve) {
  8969. var request = _this._queueLoadingCallback(resolve);
  8970. _this._prepareFontLoadEvent([rule], [font], request);
  8971. });
  8972. case 26:
  8973. case "end":
  8974. return _context.stop();
  8975. }
  8976. }
  8977. }, _callee, this, [[7, 12]]);
  8978. }));
  8979. function bind(_x) {
  8980. return _bind.apply(this, arguments);
  8981. }
  8982. return bind;
  8983. }()
  8984. }, {
  8985. key: "_queueLoadingCallback",
  8986. value: function _queueLoadingCallback(callback) {
  8987. (0, _util.unreachable)("Abstract method `_queueLoadingCallback`.");
  8988. }
  8989. }, {
  8990. key: "isFontLoadingAPISupported",
  8991. get: function get() {
  8992. var _this$_document;
  8993. var hasFonts = !!((_this$_document = this._document) !== null && _this$_document !== void 0 && _this$_document.fonts);
  8994. return (0, _util.shadow)(this, "isFontLoadingAPISupported", hasFonts);
  8995. }
  8996. }, {
  8997. key: "isSyncFontLoadingSupported",
  8998. get: function get() {
  8999. (0, _util.unreachable)("Abstract method `isSyncFontLoadingSupported`.");
  9000. }
  9001. }, {
  9002. key: "_loadTestFont",
  9003. get: function get() {
  9004. (0, _util.unreachable)("Abstract method `_loadTestFont`.");
  9005. }
  9006. }, {
  9007. key: "_prepareFontLoadEvent",
  9008. value: function _prepareFontLoadEvent(rules, fontsToLoad, request) {
  9009. (0, _util.unreachable)("Abstract method `_prepareFontLoadEvent`.");
  9010. }
  9011. }]);
  9012. return BaseFontLoader;
  9013. }();
  9014. var FontLoader;
  9015. exports.FontLoader = FontLoader;
  9016. {
  9017. exports.FontLoader = FontLoader = /*#__PURE__*/function (_BaseFontLoader) {
  9018. _inherits(GenericFontLoader, _BaseFontLoader);
  9019. var _super = _createSuper(GenericFontLoader);
  9020. function GenericFontLoader(params) {
  9021. var _this2;
  9022. _classCallCheck(this, GenericFontLoader);
  9023. _this2 = _super.call(this, params);
  9024. _this2.loadingContext = {
  9025. requests: [],
  9026. nextRequestId: 0
  9027. };
  9028. _this2.loadTestFontId = 0;
  9029. return _this2;
  9030. }
  9031. _createClass(GenericFontLoader, [{
  9032. key: "isSyncFontLoadingSupported",
  9033. get: function get() {
  9034. var supported = false;
  9035. if (typeof navigator === "undefined") {
  9036. supported = true;
  9037. } else {
  9038. var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
  9039. if ((m === null || m === void 0 ? void 0 : m[1]) >= 14) {
  9040. supported = true;
  9041. }
  9042. }
  9043. return (0, _util.shadow)(this, "isSyncFontLoadingSupported", supported);
  9044. }
  9045. }, {
  9046. key: "_queueLoadingCallback",
  9047. value: function _queueLoadingCallback(callback) {
  9048. function completeRequest() {
  9049. (0, _util.assert)(!request.done, "completeRequest() cannot be called twice.");
  9050. request.done = true;
  9051. while (context.requests.length > 0 && context.requests[0].done) {
  9052. var otherRequest = context.requests.shift();
  9053. setTimeout(otherRequest.callback, 0);
  9054. }
  9055. }
  9056. var context = this.loadingContext;
  9057. var request = {
  9058. id: "pdfjs-font-loading-".concat(context.nextRequestId++),
  9059. done: false,
  9060. complete: completeRequest,
  9061. callback: callback
  9062. };
  9063. context.requests.push(request);
  9064. return request;
  9065. }
  9066. }, {
  9067. key: "_loadTestFont",
  9068. get: function get() {
  9069. var getLoadTestFont = function getLoadTestFont() {
  9070. return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA" + "FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA" + "ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA" + "AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1" + "AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD" + "6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM" + "AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D" + "IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA" + "AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA" + "AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB" + "AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY" + "AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA" + "AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA" + "AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC" + "AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3" + "Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj" + "FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
  9071. };
  9072. return (0, _util.shadow)(this, "_loadTestFont", getLoadTestFont());
  9073. }
  9074. }, {
  9075. key: "_prepareFontLoadEvent",
  9076. value: function _prepareFontLoadEvent(rules, fonts, request) {
  9077. function int32(data, offset) {
  9078. return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
  9079. }
  9080. function spliceString(s, offset, remove, insert) {
  9081. var chunk1 = s.substring(0, offset);
  9082. var chunk2 = s.substring(offset + remove);
  9083. return chunk1 + insert + chunk2;
  9084. }
  9085. var i, ii;
  9086. var canvas = this._document.createElement("canvas");
  9087. canvas.width = 1;
  9088. canvas.height = 1;
  9089. var ctx = canvas.getContext("2d");
  9090. var called = 0;
  9091. function isFontReady(name, callback) {
  9092. called++;
  9093. if (called > 30) {
  9094. (0, _util.warn)("Load test font never loaded.");
  9095. callback();
  9096. return;
  9097. }
  9098. ctx.font = "30px " + name;
  9099. ctx.fillText(".", 0, 20);
  9100. var imageData = ctx.getImageData(0, 0, 1, 1);
  9101. if (imageData.data[3] > 0) {
  9102. callback();
  9103. return;
  9104. }
  9105. setTimeout(isFontReady.bind(null, name, callback));
  9106. }
  9107. var loadTestFontId = "lt".concat(Date.now()).concat(this.loadTestFontId++);
  9108. var data = this._loadTestFont;
  9109. var COMMENT_OFFSET = 976;
  9110. data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
  9111. var CFF_CHECKSUM_OFFSET = 16;
  9112. var XXXX_VALUE = 0x58585858;
  9113. var checksum = int32(data, CFF_CHECKSUM_OFFSET);
  9114. for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
  9115. checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
  9116. }
  9117. if (i < loadTestFontId.length) {
  9118. checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0;
  9119. }
  9120. data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum));
  9121. var url = "url(data:font/opentype;base64,".concat(btoa(data), ");");
  9122. var rule = "@font-face {font-family:\"".concat(loadTestFontId, "\";src:").concat(url, "}");
  9123. this.insertRule(rule);
  9124. var names = [];
  9125. var _iterator2 = _createForOfIteratorHelper(fonts),
  9126. _step2;
  9127. try {
  9128. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  9129. var font = _step2.value;
  9130. names.push(font.loadedName);
  9131. }
  9132. } catch (err) {
  9133. _iterator2.e(err);
  9134. } finally {
  9135. _iterator2.f();
  9136. }
  9137. names.push(loadTestFontId);
  9138. var div = this._document.createElement("div");
  9139. div.style.visibility = "hidden";
  9140. div.style.width = div.style.height = "10px";
  9141. div.style.position = "absolute";
  9142. div.style.top = div.style.left = "0px";
  9143. for (var _i = 0, _names = names; _i < _names.length; _i++) {
  9144. var name = _names[_i];
  9145. var span = this._document.createElement("span");
  9146. span.textContent = "Hi";
  9147. span.style.fontFamily = name;
  9148. div.appendChild(span);
  9149. }
  9150. this._document.body.appendChild(div);
  9151. isFontReady(loadTestFontId, function () {
  9152. div.remove();
  9153. request.complete();
  9154. });
  9155. }
  9156. }]);
  9157. return GenericFontLoader;
  9158. }(BaseFontLoader);
  9159. }
  9160. var FontFaceObject = /*#__PURE__*/function () {
  9161. function FontFaceObject(translatedData, _ref2) {
  9162. var _ref2$isEvalSupported = _ref2.isEvalSupported,
  9163. isEvalSupported = _ref2$isEvalSupported === void 0 ? true : _ref2$isEvalSupported,
  9164. _ref2$disableFontFace = _ref2.disableFontFace,
  9165. disableFontFace = _ref2$disableFontFace === void 0 ? false : _ref2$disableFontFace,
  9166. _ref2$ignoreErrors = _ref2.ignoreErrors,
  9167. ignoreErrors = _ref2$ignoreErrors === void 0 ? false : _ref2$ignoreErrors,
  9168. onUnsupportedFeature = _ref2.onUnsupportedFeature,
  9169. _ref2$fontRegistry = _ref2.fontRegistry,
  9170. fontRegistry = _ref2$fontRegistry === void 0 ? null : _ref2$fontRegistry;
  9171. _classCallCheck(this, FontFaceObject);
  9172. this.compiledGlyphs = Object.create(null);
  9173. for (var i in translatedData) {
  9174. this[i] = translatedData[i];
  9175. }
  9176. this.isEvalSupported = isEvalSupported !== false;
  9177. this.disableFontFace = disableFontFace === true;
  9178. this.ignoreErrors = ignoreErrors === true;
  9179. this._onUnsupportedFeature = onUnsupportedFeature;
  9180. this.fontRegistry = fontRegistry;
  9181. }
  9182. _createClass(FontFaceObject, [{
  9183. key: "createNativeFontFace",
  9184. value: function createNativeFontFace() {
  9185. if (!this.data || this.disableFontFace) {
  9186. return null;
  9187. }
  9188. var nativeFontFace;
  9189. if (!this.cssFontInfo) {
  9190. nativeFontFace = new FontFace(this.loadedName, this.data, {});
  9191. } else {
  9192. var css = {
  9193. weight: this.cssFontInfo.fontWeight
  9194. };
  9195. if (this.cssFontInfo.italicAngle) {
  9196. css.style = "oblique ".concat(this.cssFontInfo.italicAngle, "deg");
  9197. }
  9198. nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css);
  9199. }
  9200. if (this.fontRegistry) {
  9201. this.fontRegistry.registerFont(this);
  9202. }
  9203. return nativeFontFace;
  9204. }
  9205. }, {
  9206. key: "createFontFaceRule",
  9207. value: function createFontFaceRule() {
  9208. if (!this.data || this.disableFontFace) {
  9209. return null;
  9210. }
  9211. var data = (0, _util.bytesToString)(this.data);
  9212. var url = "url(data:".concat(this.mimetype, ";base64,").concat(btoa(data), ");");
  9213. var rule;
  9214. if (!this.cssFontInfo) {
  9215. rule = "@font-face {font-family:\"".concat(this.loadedName, "\";src:").concat(url, "}");
  9216. } else {
  9217. var css = "font-weight: ".concat(this.cssFontInfo.fontWeight, ";");
  9218. if (this.cssFontInfo.italicAngle) {
  9219. css += "font-style: oblique ".concat(this.cssFontInfo.italicAngle, "deg;");
  9220. }
  9221. rule = "@font-face {font-family:\"".concat(this.cssFontInfo.fontFamily, "\";").concat(css, "src:").concat(url, "}");
  9222. }
  9223. if (this.fontRegistry) {
  9224. this.fontRegistry.registerFont(this, url);
  9225. }
  9226. return rule;
  9227. }
  9228. }, {
  9229. key: "getPathGenerator",
  9230. value: function getPathGenerator(objs, character) {
  9231. if (this.compiledGlyphs[character] !== undefined) {
  9232. return this.compiledGlyphs[character];
  9233. }
  9234. var cmds;
  9235. try {
  9236. cmds = objs.get(this.loadedName + "_path_" + character);
  9237. } catch (ex) {
  9238. if (!this.ignoreErrors) {
  9239. throw ex;
  9240. }
  9241. this._onUnsupportedFeature({
  9242. featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath
  9243. });
  9244. (0, _util.warn)("getPathGenerator - ignoring character: \"".concat(ex, "\"."));
  9245. return this.compiledGlyphs[character] = function (c, size) {};
  9246. }
  9247. if (this.isEvalSupported && _util.FeatureTest.isEvalSupported) {
  9248. var jsBuf = [];
  9249. var _iterator3 = _createForOfIteratorHelper(cmds),
  9250. _step3;
  9251. try {
  9252. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  9253. var current = _step3.value;
  9254. var args = current.args !== undefined ? current.args.join(",") : "";
  9255. jsBuf.push("c.", current.cmd, "(", args, ");\n");
  9256. }
  9257. } catch (err) {
  9258. _iterator3.e(err);
  9259. } finally {
  9260. _iterator3.f();
  9261. }
  9262. return this.compiledGlyphs[character] = new Function("c", "size", jsBuf.join(""));
  9263. }
  9264. return this.compiledGlyphs[character] = function (c, size) {
  9265. var _iterator4 = _createForOfIteratorHelper(cmds),
  9266. _step4;
  9267. try {
  9268. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  9269. var _current = _step4.value;
  9270. if (_current.cmd === "scale") {
  9271. _current.args = [size, -size];
  9272. }
  9273. c[_current.cmd].apply(c, _current.args);
  9274. }
  9275. } catch (err) {
  9276. _iterator4.e(err);
  9277. } finally {
  9278. _iterator4.f();
  9279. }
  9280. };
  9281. }
  9282. }]);
  9283. return FontFaceObject;
  9284. }();
  9285. exports.FontFaceObject = FontFaceObject;
  9286. /***/ }),
  9287. /* 161 */
  9288. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9289. "use strict";
  9290. Object.defineProperty(exports, "__esModule", ({
  9291. value: true
  9292. }));
  9293. exports.AnnotationStorage = void 0;
  9294. var _murmurhash = __w_pdfjs_require__(162);
  9295. var _util = __w_pdfjs_require__(1);
  9296. 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; } } }; }
  9297. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  9298. 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."); }
  9299. 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); }
  9300. 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; }
  9301. 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; }
  9302. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  9303. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9304. 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); } }
  9305. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  9306. var AnnotationStorage = /*#__PURE__*/function () {
  9307. function AnnotationStorage() {
  9308. _classCallCheck(this, AnnotationStorage);
  9309. this._storage = new Map();
  9310. this._modified = false;
  9311. this.onSetModified = null;
  9312. this.onResetModified = null;
  9313. }
  9314. _createClass(AnnotationStorage, [{
  9315. key: "getValue",
  9316. value: function getValue(key, defaultValue) {
  9317. var value = this._storage.get(key);
  9318. if (value === undefined) {
  9319. return defaultValue;
  9320. }
  9321. return Object.assign(defaultValue, value);
  9322. }
  9323. }, {
  9324. key: "getRawValue",
  9325. value: function getRawValue(key) {
  9326. return this._storage.get(key);
  9327. }
  9328. }, {
  9329. key: "setValue",
  9330. value: function setValue(key, value) {
  9331. var obj = this._storage.get(key);
  9332. var modified = false;
  9333. if (obj !== undefined) {
  9334. for (var _i = 0, _Object$entries = Object.entries(value); _i < _Object$entries.length; _i++) {
  9335. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  9336. entry = _Object$entries$_i[0],
  9337. val = _Object$entries$_i[1];
  9338. if (obj[entry] !== val) {
  9339. modified = true;
  9340. obj[entry] = val;
  9341. }
  9342. }
  9343. } else {
  9344. modified = true;
  9345. this._storage.set(key, value);
  9346. }
  9347. if (modified) {
  9348. this._setModified();
  9349. }
  9350. }
  9351. }, {
  9352. key: "getAll",
  9353. value: function getAll() {
  9354. return this._storage.size > 0 ? (0, _util.objectFromMap)(this._storage) : null;
  9355. }
  9356. }, {
  9357. key: "size",
  9358. get: function get() {
  9359. return this._storage.size;
  9360. }
  9361. }, {
  9362. key: "_setModified",
  9363. value: function _setModified() {
  9364. if (!this._modified) {
  9365. this._modified = true;
  9366. if (typeof this.onSetModified === "function") {
  9367. this.onSetModified();
  9368. }
  9369. }
  9370. }
  9371. }, {
  9372. key: "resetModified",
  9373. value: function resetModified() {
  9374. if (this._modified) {
  9375. this._modified = false;
  9376. if (typeof this.onResetModified === "function") {
  9377. this.onResetModified();
  9378. }
  9379. }
  9380. }
  9381. }, {
  9382. key: "serializable",
  9383. get: function get() {
  9384. return this._storage.size > 0 ? this._storage : null;
  9385. }
  9386. }, {
  9387. key: "hash",
  9388. get: function get() {
  9389. var hash = new _murmurhash.MurmurHash3_64();
  9390. var _iterator = _createForOfIteratorHelper(this._storage),
  9391. _step;
  9392. try {
  9393. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  9394. var _step$value = _slicedToArray(_step.value, 2),
  9395. key = _step$value[0],
  9396. value = _step$value[1];
  9397. hash.update("".concat(key, ":").concat(JSON.stringify(value)));
  9398. }
  9399. } catch (err) {
  9400. _iterator.e(err);
  9401. } finally {
  9402. _iterator.f();
  9403. }
  9404. return hash.hexdigest();
  9405. }
  9406. }]);
  9407. return AnnotationStorage;
  9408. }();
  9409. exports.AnnotationStorage = AnnotationStorage;
  9410. /***/ }),
  9411. /* 162 */
  9412. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9413. "use strict";
  9414. Object.defineProperty(exports, "__esModule", ({
  9415. value: true
  9416. }));
  9417. exports.MurmurHash3_64 = void 0;
  9418. var _util = __w_pdfjs_require__(1);
  9419. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9420. 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); } }
  9421. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  9422. var SEED = 0xc3d2e1f0;
  9423. var MASK_HIGH = 0xffff0000;
  9424. var MASK_LOW = 0xffff;
  9425. var MurmurHash3_64 = /*#__PURE__*/function () {
  9426. function MurmurHash3_64(seed) {
  9427. _classCallCheck(this, MurmurHash3_64);
  9428. this.h1 = seed ? seed & 0xffffffff : SEED;
  9429. this.h2 = seed ? seed & 0xffffffff : SEED;
  9430. }
  9431. _createClass(MurmurHash3_64, [{
  9432. key: "update",
  9433. value: function update(input) {
  9434. var data, length;
  9435. if (typeof input === "string") {
  9436. data = new Uint8Array(input.length * 2);
  9437. length = 0;
  9438. for (var i = 0, ii = input.length; i < ii; i++) {
  9439. var code = input.charCodeAt(i);
  9440. if (code <= 0xff) {
  9441. data[length++] = code;
  9442. } else {
  9443. data[length++] = code >>> 8;
  9444. data[length++] = code & 0xff;
  9445. }
  9446. }
  9447. } else if ((0, _util.isArrayBuffer)(input)) {
  9448. data = input.slice();
  9449. length = data.byteLength;
  9450. } else {
  9451. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  9452. }
  9453. var blockCounts = length >> 2;
  9454. var tailLength = length - blockCounts * 4;
  9455. var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  9456. var k1 = 0,
  9457. k2 = 0;
  9458. var h1 = this.h1,
  9459. h2 = this.h2;
  9460. var C1 = 0xcc9e2d51,
  9461. C2 = 0x1b873593;
  9462. var C1_LOW = C1 & MASK_LOW,
  9463. C2_LOW = C2 & MASK_LOW;
  9464. for (var _i = 0; _i < blockCounts; _i++) {
  9465. if (_i & 1) {
  9466. k1 = dataUint32[_i];
  9467. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  9468. k1 = k1 << 15 | k1 >>> 17;
  9469. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  9470. h1 ^= k1;
  9471. h1 = h1 << 13 | h1 >>> 19;
  9472. h1 = h1 * 5 + 0xe6546b64;
  9473. } else {
  9474. k2 = dataUint32[_i];
  9475. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  9476. k2 = k2 << 15 | k2 >>> 17;
  9477. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  9478. h2 ^= k2;
  9479. h2 = h2 << 13 | h2 >>> 19;
  9480. h2 = h2 * 5 + 0xe6546b64;
  9481. }
  9482. }
  9483. k1 = 0;
  9484. switch (tailLength) {
  9485. case 3:
  9486. k1 ^= data[blockCounts * 4 + 2] << 16;
  9487. case 2:
  9488. k1 ^= data[blockCounts * 4 + 1] << 8;
  9489. case 1:
  9490. k1 ^= data[blockCounts * 4];
  9491. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  9492. k1 = k1 << 15 | k1 >>> 17;
  9493. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  9494. if (blockCounts & 1) {
  9495. h1 ^= k1;
  9496. } else {
  9497. h2 ^= k1;
  9498. }
  9499. }
  9500. this.h1 = h1;
  9501. this.h2 = h2;
  9502. }
  9503. }, {
  9504. key: "hexdigest",
  9505. value: function hexdigest() {
  9506. var h1 = this.h1,
  9507. h2 = this.h2;
  9508. h1 ^= h2 >>> 1;
  9509. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  9510. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  9511. h1 ^= h2 >>> 1;
  9512. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  9513. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  9514. h1 ^= h2 >>> 1;
  9515. var hex1 = (h1 >>> 0).toString(16),
  9516. hex2 = (h2 >>> 0).toString(16);
  9517. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  9518. }
  9519. }]);
  9520. return MurmurHash3_64;
  9521. }();
  9522. exports.MurmurHash3_64 = MurmurHash3_64;
  9523. /***/ }),
  9524. /* 163 */
  9525. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  9526. "use strict";
  9527. Object.defineProperty(exports, "__esModule", ({
  9528. value: true
  9529. }));
  9530. exports.CanvasGraphics = void 0;
  9531. var _util = __w_pdfjs_require__(1);
  9532. var _pattern_helper = __w_pdfjs_require__(164);
  9533. var _image_utils = __w_pdfjs_require__(165);
  9534. var _is_node = __w_pdfjs_require__(3);
  9535. var _display_utils = __w_pdfjs_require__(158);
  9536. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  9537. 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."); }
  9538. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  9539. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  9540. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  9541. 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; } } }; }
  9542. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9543. 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); } }
  9544. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  9545. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  9546. 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."); }
  9547. 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); }
  9548. 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; }
  9549. 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; }
  9550. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  9551. var MIN_FONT_SIZE = 16;
  9552. var MAX_FONT_SIZE = 100;
  9553. var MAX_GROUP_SIZE = 4096;
  9554. var EXECUTION_TIME = 15;
  9555. var EXECUTION_STEPS = 10;
  9556. var COMPILE_TYPE3_GLYPHS = true;
  9557. var MAX_SIZE_TO_COMPILE = 1000;
  9558. var FULL_CHUNK_HEIGHT = 16;
  9559. var LINEWIDTH_SCALE_FACTOR = 1.000001;
  9560. function mirrorContextOperations(ctx, destCtx) {
  9561. if (ctx._removeMirroring) {
  9562. throw new Error("Context is already forwarding operations.");
  9563. }
  9564. ctx.__originalSave = ctx.save;
  9565. ctx.__originalRestore = ctx.restore;
  9566. ctx.__originalRotate = ctx.rotate;
  9567. ctx.__originalScale = ctx.scale;
  9568. ctx.__originalTranslate = ctx.translate;
  9569. ctx.__originalTransform = ctx.transform;
  9570. ctx.__originalSetTransform = ctx.setTransform;
  9571. ctx.__originalResetTransform = ctx.resetTransform;
  9572. ctx.__originalClip = ctx.clip;
  9573. ctx.__originalMoveTo = ctx.moveTo;
  9574. ctx.__originalLineTo = ctx.lineTo;
  9575. ctx.__originalBezierCurveTo = ctx.bezierCurveTo;
  9576. ctx.__originalRect = ctx.rect;
  9577. ctx.__originalClosePath = ctx.closePath;
  9578. ctx.__originalBeginPath = ctx.beginPath;
  9579. ctx._removeMirroring = function () {
  9580. ctx.save = ctx.__originalSave;
  9581. ctx.restore = ctx.__originalRestore;
  9582. ctx.rotate = ctx.__originalRotate;
  9583. ctx.scale = ctx.__originalScale;
  9584. ctx.translate = ctx.__originalTranslate;
  9585. ctx.transform = ctx.__originalTransform;
  9586. ctx.setTransform = ctx.__originalSetTransform;
  9587. ctx.resetTransform = ctx.__originalResetTransform;
  9588. ctx.clip = ctx.__originalClip;
  9589. ctx.moveTo = ctx.__originalMoveTo;
  9590. ctx.lineTo = ctx.__originalLineTo;
  9591. ctx.bezierCurveTo = ctx.__originalBezierCurveTo;
  9592. ctx.rect = ctx.__originalRect;
  9593. ctx.closePath = ctx.__originalClosePath;
  9594. ctx.beginPath = ctx.__originalBeginPath;
  9595. delete ctx._removeMirroring;
  9596. };
  9597. ctx.save = function ctxSave() {
  9598. destCtx.save();
  9599. this.__originalSave();
  9600. };
  9601. ctx.restore = function ctxRestore() {
  9602. destCtx.restore();
  9603. this.__originalRestore();
  9604. };
  9605. ctx.translate = function ctxTranslate(x, y) {
  9606. destCtx.translate(x, y);
  9607. this.__originalTranslate(x, y);
  9608. };
  9609. ctx.scale = function ctxScale(x, y) {
  9610. destCtx.scale(x, y);
  9611. this.__originalScale(x, y);
  9612. };
  9613. ctx.transform = function ctxTransform(a, b, c, d, e, f) {
  9614. destCtx.transform(a, b, c, d, e, f);
  9615. this.__originalTransform(a, b, c, d, e, f);
  9616. };
  9617. ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
  9618. destCtx.setTransform(a, b, c, d, e, f);
  9619. this.__originalSetTransform(a, b, c, d, e, f);
  9620. };
  9621. ctx.resetTransform = function ctxResetTransform() {
  9622. destCtx.resetTransform();
  9623. this.__originalResetTransform();
  9624. };
  9625. ctx.rotate = function ctxRotate(angle) {
  9626. destCtx.rotate(angle);
  9627. this.__originalRotate(angle);
  9628. };
  9629. ctx.clip = function ctxRotate(rule) {
  9630. destCtx.clip(rule);
  9631. this.__originalClip(rule);
  9632. };
  9633. ctx.moveTo = function (x, y) {
  9634. destCtx.moveTo(x, y);
  9635. this.__originalMoveTo(x, y);
  9636. };
  9637. ctx.lineTo = function (x, y) {
  9638. destCtx.lineTo(x, y);
  9639. this.__originalLineTo(x, y);
  9640. };
  9641. ctx.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
  9642. destCtx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
  9643. this.__originalBezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
  9644. };
  9645. ctx.rect = function (x, y, width, height) {
  9646. destCtx.rect(x, y, width, height);
  9647. this.__originalRect(x, y, width, height);
  9648. };
  9649. ctx.closePath = function () {
  9650. destCtx.closePath();
  9651. this.__originalClosePath();
  9652. };
  9653. ctx.beginPath = function () {
  9654. destCtx.beginPath();
  9655. this.__originalBeginPath();
  9656. };
  9657. }
  9658. function addContextCurrentTransform(ctx) {
  9659. if (ctx._transformStack) {
  9660. ctx._transformStack = [];
  9661. }
  9662. if (ctx.mozCurrentTransform) {
  9663. return;
  9664. }
  9665. ctx._originalSave = ctx.save;
  9666. ctx._originalRestore = ctx.restore;
  9667. ctx._originalRotate = ctx.rotate;
  9668. ctx._originalScale = ctx.scale;
  9669. ctx._originalTranslate = ctx.translate;
  9670. ctx._originalTransform = ctx.transform;
  9671. ctx._originalSetTransform = ctx.setTransform;
  9672. ctx._originalResetTransform = ctx.resetTransform;
  9673. ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0];
  9674. ctx._transformStack = [];
  9675. try {
  9676. var desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(ctx), "lineWidth");
  9677. ctx._setLineWidth = desc.set;
  9678. ctx._getLineWidth = desc.get;
  9679. Object.defineProperty(ctx, "lineWidth", {
  9680. set: function setLineWidth(width) {
  9681. this._setLineWidth(width * LINEWIDTH_SCALE_FACTOR);
  9682. },
  9683. get: function getLineWidth() {
  9684. return this._getLineWidth();
  9685. }
  9686. });
  9687. } catch (_) {}
  9688. Object.defineProperty(ctx, "mozCurrentTransform", {
  9689. get: function getCurrentTransform() {
  9690. return this._transformMatrix;
  9691. }
  9692. });
  9693. Object.defineProperty(ctx, "mozCurrentTransformInverse", {
  9694. get: function getCurrentTransformInverse() {
  9695. var _this$_transformMatri = _slicedToArray(this._transformMatrix, 6),
  9696. a = _this$_transformMatri[0],
  9697. b = _this$_transformMatri[1],
  9698. c = _this$_transformMatri[2],
  9699. d = _this$_transformMatri[3],
  9700. e = _this$_transformMatri[4],
  9701. f = _this$_transformMatri[5];
  9702. var ad_bc = a * d - b * c;
  9703. var bc_ad = b * c - a * d;
  9704. return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc];
  9705. }
  9706. });
  9707. ctx.save = function ctxSave() {
  9708. var old = this._transformMatrix;
  9709. this._transformStack.push(old);
  9710. this._transformMatrix = old.slice(0, 6);
  9711. this._originalSave();
  9712. };
  9713. ctx.restore = function ctxRestore() {
  9714. if (this._transformStack.length === 0) {
  9715. (0, _util.warn)("Tried to restore a ctx when the stack was already empty.");
  9716. }
  9717. var prev = this._transformStack.pop();
  9718. if (prev) {
  9719. this._transformMatrix = prev;
  9720. this._originalRestore();
  9721. }
  9722. };
  9723. ctx.translate = function ctxTranslate(x, y) {
  9724. var m = this._transformMatrix;
  9725. m[4] = m[0] * x + m[2] * y + m[4];
  9726. m[5] = m[1] * x + m[3] * y + m[5];
  9727. this._originalTranslate(x, y);
  9728. };
  9729. ctx.scale = function ctxScale(x, y) {
  9730. var m = this._transformMatrix;
  9731. m[0] *= x;
  9732. m[1] *= x;
  9733. m[2] *= y;
  9734. m[3] *= y;
  9735. this._originalScale(x, y);
  9736. };
  9737. ctx.transform = function ctxTransform(a, b, c, d, e, f) {
  9738. var m = this._transformMatrix;
  9739. this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]];
  9740. ctx._originalTransform(a, b, c, d, e, f);
  9741. };
  9742. ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
  9743. this._transformMatrix = [a, b, c, d, e, f];
  9744. ctx._originalSetTransform(a, b, c, d, e, f);
  9745. };
  9746. ctx.resetTransform = function ctxResetTransform() {
  9747. this._transformMatrix = [1, 0, 0, 1, 0, 0];
  9748. ctx._originalResetTransform();
  9749. };
  9750. ctx.rotate = function ctxRotate(angle) {
  9751. var cosValue = Math.cos(angle);
  9752. var sinValue = Math.sin(angle);
  9753. var m = this._transformMatrix;
  9754. this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]];
  9755. this._originalRotate(angle);
  9756. };
  9757. }
  9758. var CachedCanvases = /*#__PURE__*/function () {
  9759. function CachedCanvases(canvasFactory) {
  9760. _classCallCheck(this, CachedCanvases);
  9761. this.canvasFactory = canvasFactory;
  9762. this.cache = Object.create(null);
  9763. }
  9764. _createClass(CachedCanvases, [{
  9765. key: "getCanvas",
  9766. value: function getCanvas(id, width, height, trackTransform) {
  9767. var canvasEntry;
  9768. if (this.cache[id] !== undefined) {
  9769. canvasEntry = this.cache[id];
  9770. this.canvasFactory.reset(canvasEntry, width, height);
  9771. canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);
  9772. } else {
  9773. canvasEntry = this.canvasFactory.create(width, height);
  9774. this.cache[id] = canvasEntry;
  9775. }
  9776. if (trackTransform) {
  9777. addContextCurrentTransform(canvasEntry.context);
  9778. }
  9779. return canvasEntry;
  9780. }
  9781. }, {
  9782. key: "delete",
  9783. value: function _delete(id) {
  9784. delete this.cache[id];
  9785. }
  9786. }, {
  9787. key: "clear",
  9788. value: function clear() {
  9789. for (var id in this.cache) {
  9790. var canvasEntry = this.cache[id];
  9791. this.canvasFactory.destroy(canvasEntry);
  9792. delete this.cache[id];
  9793. }
  9794. }
  9795. }]);
  9796. return CachedCanvases;
  9797. }();
  9798. function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
  9799. var _ctx$mozCurrentTransf = _slicedToArray(ctx.mozCurrentTransform, 6),
  9800. a = _ctx$mozCurrentTransf[0],
  9801. b = _ctx$mozCurrentTransf[1],
  9802. c = _ctx$mozCurrentTransf[2],
  9803. d = _ctx$mozCurrentTransf[3],
  9804. tx = _ctx$mozCurrentTransf[4],
  9805. ty = _ctx$mozCurrentTransf[5];
  9806. if (b === 0 && c === 0) {
  9807. var tlX = destX * a + tx;
  9808. var rTlX = Math.round(tlX);
  9809. var tlY = destY * d + ty;
  9810. var rTlY = Math.round(tlY);
  9811. var brX = (destX + destW) * a + tx;
  9812. var rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
  9813. var brY = (destY + destH) * d + ty;
  9814. var rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
  9815. ctx.setTransform(Math.sign(a), 0, 0, Math.sign(d), rTlX, rTlY);
  9816. ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rWidth, rHeight);
  9817. ctx.setTransform(a, b, c, d, tx, ty);
  9818. return [rWidth, rHeight];
  9819. }
  9820. if (a === 0 && d === 0) {
  9821. var _tlX = destY * c + tx;
  9822. var _rTlX = Math.round(_tlX);
  9823. var _tlY = destX * b + ty;
  9824. var _rTlY = Math.round(_tlY);
  9825. var _brX = (destY + destH) * c + tx;
  9826. var _rWidth = Math.abs(Math.round(_brX) - _rTlX) || 1;
  9827. var _brY = (destX + destW) * b + ty;
  9828. var _rHeight = Math.abs(Math.round(_brY) - _rTlY) || 1;
  9829. ctx.setTransform(0, Math.sign(b), Math.sign(c), 0, _rTlX, _rTlY);
  9830. ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, _rHeight, _rWidth);
  9831. ctx.setTransform(a, b, c, d, tx, ty);
  9832. return [_rHeight, _rWidth];
  9833. }
  9834. ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
  9835. var scaleX = Math.hypot(a, b);
  9836. var scaleY = Math.hypot(c, d);
  9837. return [scaleX * destW, scaleY * destH];
  9838. }
  9839. function compileType3Glyph(imgData) {
  9840. var width = imgData.width,
  9841. height = imgData.height;
  9842. if (!COMPILE_TYPE3_GLYPHS || width > MAX_SIZE_TO_COMPILE || height > MAX_SIZE_TO_COMPILE) {
  9843. return null;
  9844. }
  9845. var POINT_TO_PROCESS_LIMIT = 1000;
  9846. var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
  9847. var width1 = width + 1;
  9848. var points = new Uint8Array(width1 * (height + 1));
  9849. var i, j, j0;
  9850. var lineSize = width + 7 & ~7;
  9851. var data = new Uint8Array(lineSize * height),
  9852. pos = 0;
  9853. var _iterator = _createForOfIteratorHelper(imgData.data),
  9854. _step;
  9855. try {
  9856. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  9857. var elem = _step.value;
  9858. var mask = 128;
  9859. while (mask > 0) {
  9860. data[pos++] = elem & mask ? 0 : 255;
  9861. mask >>= 1;
  9862. }
  9863. }
  9864. } catch (err) {
  9865. _iterator.e(err);
  9866. } finally {
  9867. _iterator.f();
  9868. }
  9869. var count = 0;
  9870. pos = 0;
  9871. if (data[pos] !== 0) {
  9872. points[0] = 1;
  9873. ++count;
  9874. }
  9875. for (j = 1; j < width; j++) {
  9876. if (data[pos] !== data[pos + 1]) {
  9877. points[j] = data[pos] ? 2 : 1;
  9878. ++count;
  9879. }
  9880. pos++;
  9881. }
  9882. if (data[pos] !== 0) {
  9883. points[j] = 2;
  9884. ++count;
  9885. }
  9886. for (i = 1; i < height; i++) {
  9887. pos = i * lineSize;
  9888. j0 = i * width1;
  9889. if (data[pos - lineSize] !== data[pos]) {
  9890. points[j0] = data[pos] ? 1 : 8;
  9891. ++count;
  9892. }
  9893. var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
  9894. for (j = 1; j < width; j++) {
  9895. sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
  9896. if (POINT_TYPES[sum]) {
  9897. points[j0 + j] = POINT_TYPES[sum];
  9898. ++count;
  9899. }
  9900. pos++;
  9901. }
  9902. if (data[pos - lineSize] !== data[pos]) {
  9903. points[j0 + j] = data[pos] ? 2 : 4;
  9904. ++count;
  9905. }
  9906. if (count > POINT_TO_PROCESS_LIMIT) {
  9907. return null;
  9908. }
  9909. }
  9910. pos = lineSize * (height - 1);
  9911. j0 = i * width1;
  9912. if (data[pos] !== 0) {
  9913. points[j0] = 8;
  9914. ++count;
  9915. }
  9916. for (j = 1; j < width; j++) {
  9917. if (data[pos] !== data[pos + 1]) {
  9918. points[j0 + j] = data[pos] ? 4 : 8;
  9919. ++count;
  9920. }
  9921. pos++;
  9922. }
  9923. if (data[pos] !== 0) {
  9924. points[j0 + j] = 4;
  9925. ++count;
  9926. }
  9927. if (count > POINT_TO_PROCESS_LIMIT) {
  9928. return null;
  9929. }
  9930. var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
  9931. var path, outlines, coords;
  9932. if (!_is_node.isNodeJS) {
  9933. path = new Path2D();
  9934. } else {
  9935. outlines = [];
  9936. }
  9937. for (i = 0; count && i <= height; i++) {
  9938. var p = i * width1;
  9939. var end = p + width;
  9940. while (p < end && !points[p]) {
  9941. p++;
  9942. }
  9943. if (p === end) {
  9944. continue;
  9945. }
  9946. if (path) {
  9947. path.moveTo(p % width1, i);
  9948. } else {
  9949. coords = [p % width1, i];
  9950. }
  9951. var p0 = p;
  9952. var type = points[p];
  9953. do {
  9954. var step = steps[type];
  9955. do {
  9956. p += step;
  9957. } while (!points[p]);
  9958. var pp = points[p];
  9959. if (pp !== 5 && pp !== 10) {
  9960. type = pp;
  9961. points[p] = 0;
  9962. } else {
  9963. type = pp & 0x33 * type >> 4;
  9964. points[p] &= type >> 2 | type << 2;
  9965. }
  9966. if (path) {
  9967. path.lineTo(p % width1, p / width1 | 0);
  9968. } else {
  9969. coords.push(p % width1, p / width1 | 0);
  9970. }
  9971. if (!points[p]) {
  9972. --count;
  9973. }
  9974. } while (p0 !== p);
  9975. if (!path) {
  9976. outlines.push(coords);
  9977. }
  9978. --i;
  9979. }
  9980. data = null;
  9981. points = null;
  9982. var drawOutline = function drawOutline(c) {
  9983. c.save();
  9984. c.scale(1 / width, -1 / height);
  9985. c.translate(0, -height);
  9986. if (path) {
  9987. c.fill(path);
  9988. } else {
  9989. c.beginPath();
  9990. var _iterator2 = _createForOfIteratorHelper(outlines),
  9991. _step2;
  9992. try {
  9993. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  9994. var o = _step2.value;
  9995. c.moveTo(o[0], o[1]);
  9996. for (var l = 2, ll = o.length; l < ll; l += 2) {
  9997. c.lineTo(o[l], o[l + 1]);
  9998. }
  9999. }
  10000. } catch (err) {
  10001. _iterator2.e(err);
  10002. } finally {
  10003. _iterator2.f();
  10004. }
  10005. c.fill();
  10006. }
  10007. c.beginPath();
  10008. c.restore();
  10009. };
  10010. return drawOutline;
  10011. }
  10012. var CanvasExtraState = /*#__PURE__*/function () {
  10013. function CanvasExtraState(width, height) {
  10014. _classCallCheck(this, CanvasExtraState);
  10015. this.alphaIsShape = false;
  10016. this.fontSize = 0;
  10017. this.fontSizeScale = 1;
  10018. this.textMatrix = _util.IDENTITY_MATRIX;
  10019. this.textMatrixScale = 1;
  10020. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  10021. this.leading = 0;
  10022. this.x = 0;
  10023. this.y = 0;
  10024. this.lineX = 0;
  10025. this.lineY = 0;
  10026. this.charSpacing = 0;
  10027. this.wordSpacing = 0;
  10028. this.textHScale = 1;
  10029. this.textRenderingMode = _util.TextRenderingMode.FILL;
  10030. this.textRise = 0;
  10031. this.fillColor = "#000000";
  10032. this.strokeColor = "#000000";
  10033. this.patternFill = false;
  10034. this.fillAlpha = 1;
  10035. this.strokeAlpha = 1;
  10036. this.lineWidth = 1;
  10037. this.activeSMask = null;
  10038. this.transferMaps = null;
  10039. this.startNewPathAndClipBox([0, 0, width, height]);
  10040. }
  10041. _createClass(CanvasExtraState, [{
  10042. key: "clone",
  10043. value: function clone() {
  10044. var clone = Object.create(this);
  10045. clone.clipBox = this.clipBox.slice();
  10046. return clone;
  10047. }
  10048. }, {
  10049. key: "setCurrentPoint",
  10050. value: function setCurrentPoint(x, y) {
  10051. this.x = x;
  10052. this.y = y;
  10053. }
  10054. }, {
  10055. key: "updatePathMinMax",
  10056. value: function updatePathMinMax(transform, x, y) {
  10057. var _Util$applyTransform = _util.Util.applyTransform([x, y], transform);
  10058. var _Util$applyTransform2 = _slicedToArray(_Util$applyTransform, 2);
  10059. x = _Util$applyTransform2[0];
  10060. y = _Util$applyTransform2[1];
  10061. this.minX = Math.min(this.minX, x);
  10062. this.minY = Math.min(this.minY, y);
  10063. this.maxX = Math.max(this.maxX, x);
  10064. this.maxY = Math.max(this.maxY, y);
  10065. }
  10066. }, {
  10067. key: "updateRectMinMax",
  10068. value: function updateRectMinMax(transform, rect) {
  10069. var p1 = _util.Util.applyTransform(rect, transform);
  10070. var p2 = _util.Util.applyTransform(rect.slice(2), transform);
  10071. this.minX = Math.min(this.minX, p1[0], p2[0]);
  10072. this.minY = Math.min(this.minY, p1[1], p2[1]);
  10073. this.maxX = Math.max(this.maxX, p1[0], p2[0]);
  10074. this.maxY = Math.max(this.maxY, p1[1], p2[1]);
  10075. }
  10076. }, {
  10077. key: "updateScalingPathMinMax",
  10078. value: function updateScalingPathMinMax(transform, minMax) {
  10079. _util.Util.scaleMinMax(transform, minMax);
  10080. this.minX = Math.min(this.minX, minMax[0]);
  10081. this.maxX = Math.max(this.maxX, minMax[1]);
  10082. this.minY = Math.min(this.minY, minMax[2]);
  10083. this.maxY = Math.max(this.maxY, minMax[3]);
  10084. }
  10085. }, {
  10086. key: "updateCurvePathMinMax",
  10087. value: function updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
  10088. var box = _util.Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3);
  10089. if (minMax) {
  10090. minMax[0] = Math.min(minMax[0], box[0], box[2]);
  10091. minMax[1] = Math.max(minMax[1], box[0], box[2]);
  10092. minMax[2] = Math.min(minMax[2], box[1], box[3]);
  10093. minMax[3] = Math.max(minMax[3], box[1], box[3]);
  10094. return;
  10095. }
  10096. this.updateRectMinMax(transform, box);
  10097. }
  10098. }, {
  10099. key: "getPathBoundingBox",
  10100. value: function getPathBoundingBox() {
  10101. var pathType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _pattern_helper.PathType.FILL;
  10102. var transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  10103. var box = [this.minX, this.minY, this.maxX, this.maxY];
  10104. if (pathType === _pattern_helper.PathType.STROKE) {
  10105. if (!transform) {
  10106. (0, _util.unreachable)("Stroke bounding box must include transform.");
  10107. }
  10108. var scale = _util.Util.singularValueDecompose2dScale(transform);
  10109. var xStrokePad = scale[0] * this.lineWidth / 2;
  10110. var yStrokePad = scale[1] * this.lineWidth / 2;
  10111. box[0] -= xStrokePad;
  10112. box[1] -= yStrokePad;
  10113. box[2] += xStrokePad;
  10114. box[3] += yStrokePad;
  10115. }
  10116. return box;
  10117. }
  10118. }, {
  10119. key: "updateClipFromPath",
  10120. value: function updateClipFromPath() {
  10121. var intersect = _util.Util.intersect(this.clipBox, this.getPathBoundingBox());
  10122. this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
  10123. }
  10124. }, {
  10125. key: "isEmptyClip",
  10126. value: function isEmptyClip() {
  10127. return this.minX === Infinity;
  10128. }
  10129. }, {
  10130. key: "startNewPathAndClipBox",
  10131. value: function startNewPathAndClipBox(box) {
  10132. this.clipBox = box;
  10133. this.minX = Infinity;
  10134. this.minY = Infinity;
  10135. this.maxX = 0;
  10136. this.maxY = 0;
  10137. }
  10138. }, {
  10139. key: "getClippedPathBoundingBox",
  10140. value: function getClippedPathBoundingBox() {
  10141. var pathType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _pattern_helper.PathType.FILL;
  10142. var transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  10143. return _util.Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
  10144. }
  10145. }]);
  10146. return CanvasExtraState;
  10147. }();
  10148. function putBinaryImageData(ctx, imgData) {
  10149. var transferMaps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10150. if (typeof ImageData !== "undefined" && imgData instanceof ImageData) {
  10151. ctx.putImageData(imgData, 0, 0);
  10152. return;
  10153. }
  10154. var height = imgData.height,
  10155. width = imgData.width;
  10156. var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
  10157. var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
  10158. var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
  10159. var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
  10160. var srcPos = 0,
  10161. destPos;
  10162. var src = imgData.data;
  10163. var dest = chunkImgData.data;
  10164. var i, j, thisChunkHeight, elemsInThisChunk;
  10165. var transferMapRed, transferMapGreen, transferMapBlue, transferMapGray;
  10166. if (transferMaps) {
  10167. switch (transferMaps.length) {
  10168. case 1:
  10169. transferMapRed = transferMaps[0];
  10170. transferMapGreen = transferMaps[0];
  10171. transferMapBlue = transferMaps[0];
  10172. transferMapGray = transferMaps[0];
  10173. break;
  10174. case 4:
  10175. transferMapRed = transferMaps[0];
  10176. transferMapGreen = transferMaps[1];
  10177. transferMapBlue = transferMaps[2];
  10178. transferMapGray = transferMaps[3];
  10179. break;
  10180. }
  10181. }
  10182. if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) {
  10183. var srcLength = src.byteLength;
  10184. var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
  10185. var dest32DataLength = dest32.length;
  10186. var fullSrcDiff = width + 7 >> 3;
  10187. var white = 0xffffffff;
  10188. var black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  10189. if (transferMapGray) {
  10190. if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) {
  10191. var _ref = [black, white];
  10192. white = _ref[0];
  10193. black = _ref[1];
  10194. }
  10195. }
  10196. for (i = 0; i < totalChunks; i++) {
  10197. thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
  10198. destPos = 0;
  10199. for (j = 0; j < thisChunkHeight; j++) {
  10200. var srcDiff = srcLength - srcPos;
  10201. var k = 0;
  10202. var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;
  10203. var kEndUnrolled = kEnd & ~7;
  10204. var mask = 0;
  10205. var srcByte = 0;
  10206. for (; k < kEndUnrolled; k += 8) {
  10207. srcByte = src[srcPos++];
  10208. dest32[destPos++] = srcByte & 128 ? white : black;
  10209. dest32[destPos++] = srcByte & 64 ? white : black;
  10210. dest32[destPos++] = srcByte & 32 ? white : black;
  10211. dest32[destPos++] = srcByte & 16 ? white : black;
  10212. dest32[destPos++] = srcByte & 8 ? white : black;
  10213. dest32[destPos++] = srcByte & 4 ? white : black;
  10214. dest32[destPos++] = srcByte & 2 ? white : black;
  10215. dest32[destPos++] = srcByte & 1 ? white : black;
  10216. }
  10217. for (; k < kEnd; k++) {
  10218. if (mask === 0) {
  10219. srcByte = src[srcPos++];
  10220. mask = 128;
  10221. }
  10222. dest32[destPos++] = srcByte & mask ? white : black;
  10223. mask >>= 1;
  10224. }
  10225. }
  10226. while (destPos < dest32DataLength) {
  10227. dest32[destPos++] = 0;
  10228. }
  10229. ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  10230. }
  10231. } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) {
  10232. var hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue);
  10233. j = 0;
  10234. elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
  10235. for (i = 0; i < fullChunks; i++) {
  10236. dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
  10237. srcPos += elemsInThisChunk;
  10238. if (hasTransferMaps) {
  10239. for (var _k = 0; _k < elemsInThisChunk; _k += 4) {
  10240. if (transferMapRed) {
  10241. dest[_k + 0] = transferMapRed[dest[_k + 0]];
  10242. }
  10243. if (transferMapGreen) {
  10244. dest[_k + 1] = transferMapGreen[dest[_k + 1]];
  10245. }
  10246. if (transferMapBlue) {
  10247. dest[_k + 2] = transferMapBlue[dest[_k + 2]];
  10248. }
  10249. }
  10250. }
  10251. ctx.putImageData(chunkImgData, 0, j);
  10252. j += FULL_CHUNK_HEIGHT;
  10253. }
  10254. if (i < totalChunks) {
  10255. elemsInThisChunk = width * partialChunkHeight * 4;
  10256. dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
  10257. if (hasTransferMaps) {
  10258. for (var _k2 = 0; _k2 < elemsInThisChunk; _k2 += 4) {
  10259. if (transferMapRed) {
  10260. dest[_k2 + 0] = transferMapRed[dest[_k2 + 0]];
  10261. }
  10262. if (transferMapGreen) {
  10263. dest[_k2 + 1] = transferMapGreen[dest[_k2 + 1]];
  10264. }
  10265. if (transferMapBlue) {
  10266. dest[_k2 + 2] = transferMapBlue[dest[_k2 + 2]];
  10267. }
  10268. }
  10269. }
  10270. ctx.putImageData(chunkImgData, 0, j);
  10271. }
  10272. } else if (imgData.kind === _util.ImageKind.RGB_24BPP) {
  10273. var _hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue);
  10274. thisChunkHeight = FULL_CHUNK_HEIGHT;
  10275. elemsInThisChunk = width * thisChunkHeight;
  10276. for (i = 0; i < totalChunks; i++) {
  10277. if (i >= fullChunks) {
  10278. thisChunkHeight = partialChunkHeight;
  10279. elemsInThisChunk = width * thisChunkHeight;
  10280. }
  10281. destPos = 0;
  10282. for (j = elemsInThisChunk; j--;) {
  10283. dest[destPos++] = src[srcPos++];
  10284. dest[destPos++] = src[srcPos++];
  10285. dest[destPos++] = src[srcPos++];
  10286. dest[destPos++] = 255;
  10287. }
  10288. if (_hasTransferMaps) {
  10289. for (var _k3 = 0; _k3 < destPos; _k3 += 4) {
  10290. if (transferMapRed) {
  10291. dest[_k3 + 0] = transferMapRed[dest[_k3 + 0]];
  10292. }
  10293. if (transferMapGreen) {
  10294. dest[_k3 + 1] = transferMapGreen[dest[_k3 + 1]];
  10295. }
  10296. if (transferMapBlue) {
  10297. dest[_k3 + 2] = transferMapBlue[dest[_k3 + 2]];
  10298. }
  10299. }
  10300. }
  10301. ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  10302. }
  10303. } else {
  10304. throw new Error("bad image kind: ".concat(imgData.kind));
  10305. }
  10306. }
  10307. function putBinaryImageMask(ctx, imgData) {
  10308. if (imgData.bitmap) {
  10309. ctx.drawImage(imgData.bitmap, 0, 0);
  10310. return;
  10311. }
  10312. var height = imgData.height,
  10313. width = imgData.width;
  10314. var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
  10315. var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
  10316. var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
  10317. var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
  10318. var srcPos = 0;
  10319. var src = imgData.data;
  10320. var dest = chunkImgData.data;
  10321. for (var i = 0; i < totalChunks; i++) {
  10322. var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
  10323. var _applyMaskImageData = (0, _image_utils.applyMaskImageData)({
  10324. src: src,
  10325. srcPos: srcPos,
  10326. dest: dest,
  10327. width: width,
  10328. height: thisChunkHeight
  10329. });
  10330. srcPos = _applyMaskImageData.srcPos;
  10331. ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  10332. }
  10333. }
  10334. function copyCtxState(sourceCtx, destCtx) {
  10335. var properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"];
  10336. for (var i = 0, ii = properties.length; i < ii; i++) {
  10337. var property = properties[i];
  10338. if (sourceCtx[property] !== undefined) {
  10339. destCtx[property] = sourceCtx[property];
  10340. }
  10341. }
  10342. if (sourceCtx.setLineDash !== undefined) {
  10343. destCtx.setLineDash(sourceCtx.getLineDash());
  10344. destCtx.lineDashOffset = sourceCtx.lineDashOffset;
  10345. }
  10346. }
  10347. function resetCtxToDefault(ctx, foregroundColor) {
  10348. ctx.strokeStyle = ctx.fillStyle = foregroundColor || "#000000";
  10349. ctx.fillRule = "nonzero";
  10350. ctx.globalAlpha = 1;
  10351. ctx.lineWidth = 1;
  10352. ctx.lineCap = "butt";
  10353. ctx.lineJoin = "miter";
  10354. ctx.miterLimit = 10;
  10355. ctx.globalCompositeOperation = "source-over";
  10356. ctx.font = "10px sans-serif";
  10357. if (ctx.setLineDash !== undefined) {
  10358. ctx.setLineDash([]);
  10359. ctx.lineDashOffset = 0;
  10360. }
  10361. }
  10362. function composeSMaskBackdrop(bytes, r0, g0, b0) {
  10363. var length = bytes.length;
  10364. for (var i = 3; i < length; i += 4) {
  10365. var alpha = bytes[i];
  10366. if (alpha === 0) {
  10367. bytes[i - 3] = r0;
  10368. bytes[i - 2] = g0;
  10369. bytes[i - 1] = b0;
  10370. } else if (alpha < 255) {
  10371. var alpha_ = 255 - alpha;
  10372. bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8;
  10373. bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8;
  10374. bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8;
  10375. }
  10376. }
  10377. }
  10378. function composeSMaskAlpha(maskData, layerData, transferMap) {
  10379. var length = maskData.length;
  10380. var scale = 1 / 255;
  10381. for (var i = 3; i < length; i += 4) {
  10382. var alpha = transferMap ? transferMap[maskData[i]] : maskData[i];
  10383. layerData[i] = layerData[i] * alpha * scale | 0;
  10384. }
  10385. }
  10386. function composeSMaskLuminosity(maskData, layerData, transferMap) {
  10387. var length = maskData.length;
  10388. for (var i = 3; i < length; i += 4) {
  10389. var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28;
  10390. layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16;
  10391. }
  10392. }
  10393. function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap, layerOffsetX, layerOffsetY, maskOffsetX, maskOffsetY) {
  10394. var hasBackdrop = !!backdrop;
  10395. var r0 = hasBackdrop ? backdrop[0] : 0;
  10396. var g0 = hasBackdrop ? backdrop[1] : 0;
  10397. var b0 = hasBackdrop ? backdrop[2] : 0;
  10398. var composeFn;
  10399. if (subtype === "Luminosity") {
  10400. composeFn = composeSMaskLuminosity;
  10401. } else {
  10402. composeFn = composeSMaskAlpha;
  10403. }
  10404. var PIXELS_TO_PROCESS = 1048576;
  10405. var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
  10406. for (var row = 0; row < height; row += chunkSize) {
  10407. var chunkHeight = Math.min(chunkSize, height - row);
  10408. var maskData = maskCtx.getImageData(layerOffsetX - maskOffsetX, row + (layerOffsetY - maskOffsetY), width, chunkHeight);
  10409. var layerData = layerCtx.getImageData(layerOffsetX, row + layerOffsetY, width, chunkHeight);
  10410. if (hasBackdrop) {
  10411. composeSMaskBackdrop(maskData.data, r0, g0, b0);
  10412. }
  10413. composeFn(maskData.data, layerData.data, transferMap);
  10414. layerCtx.putImageData(layerData, layerOffsetX, row + layerOffsetY);
  10415. }
  10416. }
  10417. function composeSMask(ctx, smask, layerCtx, layerBox) {
  10418. var layerOffsetX = layerBox[0];
  10419. var layerOffsetY = layerBox[1];
  10420. var layerWidth = layerBox[2] - layerOffsetX;
  10421. var layerHeight = layerBox[3] - layerOffsetY;
  10422. if (layerWidth === 0 || layerHeight === 0) {
  10423. return;
  10424. }
  10425. genericComposeSMask(smask.context, layerCtx, layerWidth, layerHeight, smask.subtype, smask.backdrop, smask.transferMap, layerOffsetX, layerOffsetY, smask.offsetX, smask.offsetY);
  10426. ctx.save();
  10427. ctx.globalAlpha = 1;
  10428. ctx.globalCompositeOperation = "source-over";
  10429. ctx.setTransform(1, 0, 0, 1, 0, 0);
  10430. ctx.drawImage(layerCtx.canvas, 0, 0);
  10431. ctx.restore();
  10432. }
  10433. function getImageSmoothingEnabled(transform, interpolate) {
  10434. var scale = _util.Util.singularValueDecompose2dScale(transform);
  10435. scale[0] = Math.fround(scale[0]);
  10436. scale[1] = Math.fround(scale[1]);
  10437. var actualScale = Math.fround((globalThis.devicePixelRatio || 1) * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
  10438. if (interpolate !== undefined) {
  10439. return interpolate;
  10440. } else if (scale[0] <= actualScale || scale[1] <= actualScale) {
  10441. return true;
  10442. }
  10443. return false;
  10444. }
  10445. var LINE_CAP_STYLES = ["butt", "round", "square"];
  10446. var LINE_JOIN_STYLES = ["miter", "round", "bevel"];
  10447. var NORMAL_CLIP = {};
  10448. var EO_CLIP = {};
  10449. var CanvasGraphics = /*#__PURE__*/function () {
  10450. function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, imageLayer, optionalContentConfig, annotationCanvasMap, pageColors) {
  10451. _classCallCheck(this, CanvasGraphics);
  10452. this.ctx = canvasCtx;
  10453. this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
  10454. this.stateStack = [];
  10455. this.pendingClip = null;
  10456. this.pendingEOFill = false;
  10457. this.res = null;
  10458. this.xobjs = null;
  10459. this.commonObjs = commonObjs;
  10460. this.objs = objs;
  10461. this.canvasFactory = canvasFactory;
  10462. this.imageLayer = imageLayer;
  10463. this.groupStack = [];
  10464. this.processingType3 = null;
  10465. this.baseTransform = null;
  10466. this.baseTransformStack = [];
  10467. this.groupLevel = 0;
  10468. this.smaskStack = [];
  10469. this.smaskCounter = 0;
  10470. this.tempSMask = null;
  10471. this.suspendedCtx = null;
  10472. this.contentVisible = true;
  10473. this.markedContentStack = [];
  10474. this.optionalContentConfig = optionalContentConfig;
  10475. this.cachedCanvases = new CachedCanvases(this.canvasFactory);
  10476. this.cachedPatterns = new Map();
  10477. this.annotationCanvasMap = annotationCanvasMap;
  10478. this.viewportScale = 1;
  10479. this.outputScaleX = 1;
  10480. this.outputScaleY = 1;
  10481. this.backgroundColor = (pageColors === null || pageColors === void 0 ? void 0 : pageColors.background) || null;
  10482. this.foregroundColor = (pageColors === null || pageColors === void 0 ? void 0 : pageColors.foreground) || null;
  10483. if (canvasCtx) {
  10484. addContextCurrentTransform(canvasCtx);
  10485. }
  10486. this._cachedScaleForStroking = null;
  10487. this._cachedGetSinglePixelWidth = null;
  10488. this._cachedBitmapsMap = new Map();
  10489. }
  10490. _createClass(CanvasGraphics, [{
  10491. key: "getObject",
  10492. value: function getObject(data) {
  10493. var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  10494. if (typeof data === "string") {
  10495. return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
  10496. }
  10497. return fallback;
  10498. }
  10499. }, {
  10500. key: "beginDrawing",
  10501. value: function beginDrawing(_ref2) {
  10502. var transform = _ref2.transform,
  10503. viewport = _ref2.viewport,
  10504. _ref2$transparency = _ref2.transparency,
  10505. transparency = _ref2$transparency === void 0 ? false : _ref2$transparency,
  10506. _ref2$background = _ref2.background,
  10507. background = _ref2$background === void 0 ? null : _ref2$background;
  10508. var width = this.ctx.canvas.width;
  10509. var height = this.ctx.canvas.height;
  10510. var defaultBackgroundColor = background || "#ffffff";
  10511. this.ctx.save();
  10512. if (this.foregroundColor && this.backgroundColor) {
  10513. this.ctx.fillStyle = this.foregroundColor;
  10514. var fg = this.foregroundColor = this.ctx.fillStyle;
  10515. this.ctx.fillStyle = this.backgroundColor;
  10516. var bg = this.backgroundColor = this.ctx.fillStyle;
  10517. var isValidDefaultBg = true;
  10518. var defaultBg = defaultBackgroundColor;
  10519. this.ctx.fillStyle = defaultBackgroundColor;
  10520. defaultBg = this.ctx.fillStyle;
  10521. isValidDefaultBg = typeof defaultBg === "string" && /^#[0-9A-Fa-f]{6}$/.test(defaultBg);
  10522. if (fg === "#000000" && bg === "#ffffff" || fg === bg || !isValidDefaultBg) {
  10523. this.foregroundColor = this.backgroundColor = null;
  10524. } else {
  10525. var cB = parseInt(defaultBg.slice(1), 16);
  10526. var rB = (cB && 0xff0000) >> 16;
  10527. var gB = (cB && 0x00ff00) >> 8;
  10528. var bB = cB && 0x0000ff;
  10529. var newComp = function newComp(x) {
  10530. x /= 255;
  10531. return x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
  10532. };
  10533. var lumB = Math.round(0.2126 * newComp(rB) + 0.7152 * newComp(gB) + 0.0722 * newComp(bB));
  10534. this.selectColor = function (r, g, b) {
  10535. var lumC = 0.2126 * newComp(r) + 0.7152 * newComp(g) + 0.0722 * newComp(b);
  10536. return Math.round(lumC) === lumB ? bg : fg;
  10537. };
  10538. }
  10539. }
  10540. this.ctx.fillStyle = this.backgroundColor || defaultBackgroundColor;
  10541. this.ctx.fillRect(0, 0, width, height);
  10542. this.ctx.restore();
  10543. if (transparency) {
  10544. var transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true);
  10545. this.compositeCtx = this.ctx;
  10546. this.transparentCanvas = transparentCanvas.canvas;
  10547. this.ctx = transparentCanvas.context;
  10548. this.ctx.save();
  10549. this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform);
  10550. }
  10551. this.ctx.save();
  10552. resetCtxToDefault(this.ctx, this.foregroundColor);
  10553. if (transform) {
  10554. this.ctx.transform.apply(this.ctx, transform);
  10555. this.outputScaleX = transform[0];
  10556. this.outputScaleY = transform[0];
  10557. }
  10558. this.ctx.transform.apply(this.ctx, viewport.transform);
  10559. this.viewportScale = viewport.scale;
  10560. this.baseTransform = this.ctx.mozCurrentTransform.slice();
  10561. if (this.imageLayer) {
  10562. this.imageLayer.beginLayout();
  10563. }
  10564. }
  10565. }, {
  10566. key: "executeOperatorList",
  10567. value: function executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
  10568. var argsArray = operatorList.argsArray;
  10569. var fnArray = operatorList.fnArray;
  10570. var i = executionStartIdx || 0;
  10571. var argsArrayLen = argsArray.length;
  10572. if (argsArrayLen === i) {
  10573. return i;
  10574. }
  10575. var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
  10576. var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
  10577. var steps = 0;
  10578. var commonObjs = this.commonObjs;
  10579. var objs = this.objs;
  10580. var fnId;
  10581. while (true) {
  10582. if (stepper !== undefined && i === stepper.nextBreakPoint) {
  10583. stepper.breakIt(i, continueCallback);
  10584. return i;
  10585. }
  10586. fnId = fnArray[i];
  10587. if (fnId !== _util.OPS.dependency) {
  10588. this[fnId].apply(this, argsArray[i]);
  10589. } else {
  10590. var _iterator3 = _createForOfIteratorHelper(argsArray[i]),
  10591. _step3;
  10592. try {
  10593. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  10594. var depObjId = _step3.value;
  10595. var objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
  10596. if (!objsPool.has(depObjId)) {
  10597. objsPool.get(depObjId, continueCallback);
  10598. return i;
  10599. }
  10600. }
  10601. } catch (err) {
  10602. _iterator3.e(err);
  10603. } finally {
  10604. _iterator3.f();
  10605. }
  10606. }
  10607. i++;
  10608. if (i === argsArrayLen) {
  10609. return i;
  10610. }
  10611. if (chunkOperations && ++steps > EXECUTION_STEPS) {
  10612. if (Date.now() > endTime) {
  10613. continueCallback();
  10614. return i;
  10615. }
  10616. steps = 0;
  10617. }
  10618. }
  10619. }
  10620. }, {
  10621. key: "endDrawing",
  10622. value: function endDrawing() {
  10623. while (this.stateStack.length || this.inSMaskMode) {
  10624. this.restore();
  10625. }
  10626. this.ctx.restore();
  10627. if (this.transparentCanvas) {
  10628. this.ctx = this.compositeCtx;
  10629. this.ctx.save();
  10630. this.ctx.setTransform(1, 0, 0, 1, 0, 0);
  10631. this.ctx.drawImage(this.transparentCanvas, 0, 0);
  10632. this.ctx.restore();
  10633. this.transparentCanvas = null;
  10634. }
  10635. this.cachedCanvases.clear();
  10636. this.cachedPatterns.clear();
  10637. var _iterator4 = _createForOfIteratorHelper(this._cachedBitmapsMap.values()),
  10638. _step4;
  10639. try {
  10640. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  10641. var cache = _step4.value;
  10642. var _iterator5 = _createForOfIteratorHelper(cache.values()),
  10643. _step5;
  10644. try {
  10645. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  10646. var canvas = _step5.value;
  10647. if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
  10648. canvas.width = canvas.height = 0;
  10649. }
  10650. }
  10651. } catch (err) {
  10652. _iterator5.e(err);
  10653. } finally {
  10654. _iterator5.f();
  10655. }
  10656. cache.clear();
  10657. }
  10658. } catch (err) {
  10659. _iterator4.e(err);
  10660. } finally {
  10661. _iterator4.f();
  10662. }
  10663. this._cachedBitmapsMap.clear();
  10664. if (this.imageLayer) {
  10665. this.imageLayer.endLayout();
  10666. }
  10667. }
  10668. }, {
  10669. key: "_scaleImage",
  10670. value: function _scaleImage(img, inverseTransform) {
  10671. var width = img.width;
  10672. var height = img.height;
  10673. var widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);
  10674. var heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);
  10675. var paintWidth = width,
  10676. paintHeight = height;
  10677. var tmpCanvasId = "prescale1";
  10678. var tmpCanvas, tmpCtx;
  10679. while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {
  10680. var newWidth = paintWidth,
  10681. newHeight = paintHeight;
  10682. if (widthScale > 2 && paintWidth > 1) {
  10683. newWidth = Math.ceil(paintWidth / 2);
  10684. widthScale /= paintWidth / newWidth;
  10685. }
  10686. if (heightScale > 2 && paintHeight > 1) {
  10687. newHeight = Math.ceil(paintHeight / 2);
  10688. heightScale /= paintHeight / newHeight;
  10689. }
  10690. tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight, false);
  10691. tmpCtx = tmpCanvas.context;
  10692. tmpCtx.clearRect(0, 0, newWidth, newHeight);
  10693. tmpCtx.drawImage(img, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
  10694. img = tmpCanvas.canvas;
  10695. paintWidth = newWidth;
  10696. paintHeight = newHeight;
  10697. tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1";
  10698. }
  10699. return {
  10700. img: img,
  10701. paintWidth: paintWidth,
  10702. paintHeight: paintHeight
  10703. };
  10704. }
  10705. }, {
  10706. key: "_createMaskCanvas",
  10707. value: function _createMaskCanvas(img) {
  10708. var ctx = this.ctx;
  10709. var width = img.width,
  10710. height = img.height;
  10711. var fillColor = this.current.fillColor;
  10712. var isPatternFill = this.current.patternFill;
  10713. var currentTransform = ctx.mozCurrentTransform;
  10714. var cache, cacheKey, scaled, maskCanvas;
  10715. if ((img.bitmap || img.data) && img.count > 1) {
  10716. var mainKey = img.bitmap || img.data.buffer;
  10717. var withoutTranslation = currentTransform.slice(0, 4);
  10718. cacheKey = JSON.stringify(isPatternFill ? withoutTranslation : [withoutTranslation, fillColor]);
  10719. cache = this._cachedBitmapsMap.get(mainKey);
  10720. if (!cache) {
  10721. cache = new Map();
  10722. this._cachedBitmapsMap.set(mainKey, cache);
  10723. }
  10724. var cachedImage = cache.get(cacheKey);
  10725. if (cachedImage && !isPatternFill) {
  10726. var _offsetX = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
  10727. var _offsetY = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
  10728. return {
  10729. canvas: cachedImage,
  10730. offsetX: _offsetX,
  10731. offsetY: _offsetY
  10732. };
  10733. }
  10734. scaled = cachedImage;
  10735. }
  10736. if (!scaled) {
  10737. maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height, false);
  10738. putBinaryImageMask(maskCanvas.context, img);
  10739. }
  10740. var maskToCanvas = _util.Util.transform(currentTransform, [1 / width, 0, 0, -1 / height, 0, 0]);
  10741. maskToCanvas = _util.Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);
  10742. var cord1 = _util.Util.applyTransform([0, 0], maskToCanvas);
  10743. var cord2 = _util.Util.applyTransform([width, height], maskToCanvas);
  10744. var rect = _util.Util.normalizeRect([cord1[0], cord1[1], cord2[0], cord2[1]]);
  10745. var drawnWidth = Math.round(rect[2] - rect[0]) || 1;
  10746. var drawnHeight = Math.round(rect[3] - rect[1]) || 1;
  10747. var fillCanvas = this.cachedCanvases.getCanvas("fillCanvas", drawnWidth, drawnHeight, true);
  10748. var fillCtx = fillCanvas.context;
  10749. var offsetX = Math.min(cord1[0], cord2[0]);
  10750. var offsetY = Math.min(cord1[1], cord2[1]);
  10751. fillCtx.translate(-offsetX, -offsetY);
  10752. fillCtx.transform.apply(fillCtx, maskToCanvas);
  10753. if (!scaled) {
  10754. scaled = this._scaleImage(maskCanvas.canvas, fillCtx.mozCurrentTransformInverse);
  10755. scaled = scaled.img;
  10756. if (cache && isPatternFill) {
  10757. cache.set(cacheKey, scaled);
  10758. }
  10759. }
  10760. fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled(fillCtx.mozCurrentTransform, img.interpolate);
  10761. drawImageAtIntegerCoords(fillCtx, scaled, 0, 0, scaled.width, scaled.height, 0, 0, width, height);
  10762. fillCtx.globalCompositeOperation = "source-in";
  10763. var inverse = _util.Util.transform(fillCtx.mozCurrentTransformInverse, [1, 0, 0, 1, -offsetX, -offsetY]);
  10764. fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, _pattern_helper.PathType.FILL) : fillColor;
  10765. fillCtx.fillRect(0, 0, width, height);
  10766. if (cache && !isPatternFill) {
  10767. this.cachedCanvases["delete"]("fillCanvas");
  10768. cache.set(cacheKey, fillCanvas.canvas);
  10769. }
  10770. return {
  10771. canvas: fillCanvas.canvas,
  10772. offsetX: Math.round(offsetX),
  10773. offsetY: Math.round(offsetY)
  10774. };
  10775. }
  10776. }, {
  10777. key: "setLineWidth",
  10778. value: function setLineWidth(width) {
  10779. if (width !== this.current.lineWidth) {
  10780. this._cachedScaleForStroking = null;
  10781. }
  10782. this.current.lineWidth = width;
  10783. this.ctx.lineWidth = width;
  10784. }
  10785. }, {
  10786. key: "setLineCap",
  10787. value: function setLineCap(style) {
  10788. this.ctx.lineCap = LINE_CAP_STYLES[style];
  10789. }
  10790. }, {
  10791. key: "setLineJoin",
  10792. value: function setLineJoin(style) {
  10793. this.ctx.lineJoin = LINE_JOIN_STYLES[style];
  10794. }
  10795. }, {
  10796. key: "setMiterLimit",
  10797. value: function setMiterLimit(limit) {
  10798. this.ctx.miterLimit = limit;
  10799. }
  10800. }, {
  10801. key: "setDash",
  10802. value: function setDash(dashArray, dashPhase) {
  10803. var ctx = this.ctx;
  10804. if (ctx.setLineDash !== undefined) {
  10805. ctx.setLineDash(dashArray);
  10806. ctx.lineDashOffset = dashPhase;
  10807. }
  10808. }
  10809. }, {
  10810. key: "setRenderingIntent",
  10811. value: function setRenderingIntent(intent) {}
  10812. }, {
  10813. key: "setFlatness",
  10814. value: function setFlatness(flatness) {}
  10815. }, {
  10816. key: "setGState",
  10817. value: function setGState(states) {
  10818. for (var i = 0, ii = states.length; i < ii; i++) {
  10819. var state = states[i];
  10820. var key = state[0];
  10821. var value = state[1];
  10822. switch (key) {
  10823. case "LW":
  10824. this.setLineWidth(value);
  10825. break;
  10826. case "LC":
  10827. this.setLineCap(value);
  10828. break;
  10829. case "LJ":
  10830. this.setLineJoin(value);
  10831. break;
  10832. case "ML":
  10833. this.setMiterLimit(value);
  10834. break;
  10835. case "D":
  10836. this.setDash(value[0], value[1]);
  10837. break;
  10838. case "RI":
  10839. this.setRenderingIntent(value);
  10840. break;
  10841. case "FL":
  10842. this.setFlatness(value);
  10843. break;
  10844. case "Font":
  10845. this.setFont(value[0], value[1]);
  10846. break;
  10847. case "CA":
  10848. this.current.strokeAlpha = state[1];
  10849. break;
  10850. case "ca":
  10851. this.current.fillAlpha = state[1];
  10852. this.ctx.globalAlpha = state[1];
  10853. break;
  10854. case "BM":
  10855. this.ctx.globalCompositeOperation = value;
  10856. break;
  10857. case "SMask":
  10858. this.current.activeSMask = value ? this.tempSMask : null;
  10859. this.tempSMask = null;
  10860. this.checkSMaskState();
  10861. break;
  10862. case "TR":
  10863. this.current.transferMaps = value;
  10864. }
  10865. }
  10866. }
  10867. }, {
  10868. key: "inSMaskMode",
  10869. get: function get() {
  10870. return !!this.suspendedCtx;
  10871. }
  10872. }, {
  10873. key: "checkSMaskState",
  10874. value: function checkSMaskState() {
  10875. var inSMaskMode = this.inSMaskMode;
  10876. if (this.current.activeSMask && !inSMaskMode) {
  10877. this.beginSMaskMode();
  10878. } else if (!this.current.activeSMask && inSMaskMode) {
  10879. this.endSMaskMode();
  10880. }
  10881. }
  10882. }, {
  10883. key: "beginSMaskMode",
  10884. value: function beginSMaskMode() {
  10885. if (this.inSMaskMode) {
  10886. throw new Error("beginSMaskMode called while already in smask mode");
  10887. }
  10888. var drawnWidth = this.ctx.canvas.width;
  10889. var drawnHeight = this.ctx.canvas.height;
  10890. var cacheId = "smaskGroupAt" + this.groupLevel;
  10891. var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
  10892. this.suspendedCtx = this.ctx;
  10893. this.ctx = scratchCanvas.context;
  10894. var ctx = this.ctx;
  10895. ctx.setTransform.apply(ctx, this.suspendedCtx.mozCurrentTransform);
  10896. copyCtxState(this.suspendedCtx, ctx);
  10897. mirrorContextOperations(ctx, this.suspendedCtx);
  10898. this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
  10899. }
  10900. }, {
  10901. key: "endSMaskMode",
  10902. value: function endSMaskMode() {
  10903. if (!this.inSMaskMode) {
  10904. throw new Error("endSMaskMode called while not in smask mode");
  10905. }
  10906. this.ctx._removeMirroring();
  10907. copyCtxState(this.ctx, this.suspendedCtx);
  10908. this.ctx = this.suspendedCtx;
  10909. this.suspendedCtx = null;
  10910. }
  10911. }, {
  10912. key: "compose",
  10913. value: function compose(dirtyBox) {
  10914. if (!this.current.activeSMask) {
  10915. return;
  10916. }
  10917. if (!dirtyBox) {
  10918. dirtyBox = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
  10919. } else {
  10920. dirtyBox[0] = Math.floor(dirtyBox[0]);
  10921. dirtyBox[1] = Math.floor(dirtyBox[1]);
  10922. dirtyBox[2] = Math.ceil(dirtyBox[2]);
  10923. dirtyBox[3] = Math.ceil(dirtyBox[3]);
  10924. }
  10925. var smask = this.current.activeSMask;
  10926. var suspendedCtx = this.suspendedCtx;
  10927. composeSMask(suspendedCtx, smask, this.ctx, dirtyBox);
  10928. this.ctx.save();
  10929. this.ctx.setTransform(1, 0, 0, 1, 0, 0);
  10930. this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
  10931. this.ctx.restore();
  10932. }
  10933. }, {
  10934. key: "save",
  10935. value: function save() {
  10936. if (this.inSMaskMode) {
  10937. copyCtxState(this.ctx, this.suspendedCtx);
  10938. this.suspendedCtx.save();
  10939. } else {
  10940. this.ctx.save();
  10941. }
  10942. var old = this.current;
  10943. this.stateStack.push(old);
  10944. this.current = old.clone();
  10945. }
  10946. }, {
  10947. key: "restore",
  10948. value: function restore() {
  10949. if (this.stateStack.length === 0 && this.inSMaskMode) {
  10950. this.endSMaskMode();
  10951. }
  10952. if (this.stateStack.length !== 0) {
  10953. this.current = this.stateStack.pop();
  10954. if (this.inSMaskMode) {
  10955. this.suspendedCtx.restore();
  10956. copyCtxState(this.suspendedCtx, this.ctx);
  10957. } else {
  10958. this.ctx.restore();
  10959. }
  10960. this.checkSMaskState();
  10961. this.pendingClip = null;
  10962. this._cachedScaleForStroking = null;
  10963. this._cachedGetSinglePixelWidth = null;
  10964. }
  10965. }
  10966. }, {
  10967. key: "transform",
  10968. value: function transform(a, b, c, d, e, f) {
  10969. this.ctx.transform(a, b, c, d, e, f);
  10970. this._cachedScaleForStroking = null;
  10971. this._cachedGetSinglePixelWidth = null;
  10972. }
  10973. }, {
  10974. key: "constructPath",
  10975. value: function constructPath(ops, args, minMax) {
  10976. var ctx = this.ctx;
  10977. var current = this.current;
  10978. var x = current.x,
  10979. y = current.y;
  10980. var startX, startY;
  10981. var currentTransform = ctx.mozCurrentTransform;
  10982. var isScalingMatrix = currentTransform[0] === 0 && currentTransform[3] === 0 || currentTransform[1] === 0 && currentTransform[2] === 0;
  10983. var minMaxForBezier = isScalingMatrix ? minMax.slice(0) : null;
  10984. for (var i = 0, j = 0, ii = ops.length; i < ii; i++) {
  10985. switch (ops[i] | 0) {
  10986. case _util.OPS.rectangle:
  10987. x = args[j++];
  10988. y = args[j++];
  10989. var width = args[j++];
  10990. var height = args[j++];
  10991. var xw = x + width;
  10992. var yh = y + height;
  10993. ctx.moveTo(x, y);
  10994. if (width === 0 || height === 0) {
  10995. ctx.lineTo(xw, yh);
  10996. } else {
  10997. ctx.lineTo(xw, y);
  10998. ctx.lineTo(xw, yh);
  10999. ctx.lineTo(x, yh);
  11000. }
  11001. if (!isScalingMatrix) {
  11002. current.updateRectMinMax(currentTransform, [x, y, xw, yh]);
  11003. }
  11004. ctx.closePath();
  11005. break;
  11006. case _util.OPS.moveTo:
  11007. x = args[j++];
  11008. y = args[j++];
  11009. ctx.moveTo(x, y);
  11010. if (!isScalingMatrix) {
  11011. current.updatePathMinMax(currentTransform, x, y);
  11012. }
  11013. break;
  11014. case _util.OPS.lineTo:
  11015. x = args[j++];
  11016. y = args[j++];
  11017. ctx.lineTo(x, y);
  11018. if (!isScalingMatrix) {
  11019. current.updatePathMinMax(currentTransform, x, y);
  11020. }
  11021. break;
  11022. case _util.OPS.curveTo:
  11023. startX = x;
  11024. startY = y;
  11025. x = args[j + 4];
  11026. y = args[j + 5];
  11027. ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
  11028. current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], args[j + 2], args[j + 3], x, y, minMaxForBezier);
  11029. j += 6;
  11030. break;
  11031. case _util.OPS.curveTo2:
  11032. startX = x;
  11033. startY = y;
  11034. ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
  11035. current.updateCurvePathMinMax(currentTransform, startX, startY, x, y, args[j], args[j + 1], args[j + 2], args[j + 3], minMaxForBezier);
  11036. x = args[j + 2];
  11037. y = args[j + 3];
  11038. j += 4;
  11039. break;
  11040. case _util.OPS.curveTo3:
  11041. startX = x;
  11042. startY = y;
  11043. x = args[j + 2];
  11044. y = args[j + 3];
  11045. ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
  11046. current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], x, y, x, y, minMaxForBezier);
  11047. j += 4;
  11048. break;
  11049. case _util.OPS.closePath:
  11050. ctx.closePath();
  11051. break;
  11052. }
  11053. }
  11054. if (isScalingMatrix) {
  11055. current.updateScalingPathMinMax(currentTransform, minMaxForBezier);
  11056. }
  11057. current.setCurrentPoint(x, y);
  11058. }
  11059. }, {
  11060. key: "closePath",
  11061. value: function closePath() {
  11062. this.ctx.closePath();
  11063. }
  11064. }, {
  11065. key: "stroke",
  11066. value: function stroke(consumePath) {
  11067. consumePath = typeof consumePath !== "undefined" ? consumePath : true;
  11068. var ctx = this.ctx;
  11069. var strokeColor = this.current.strokeColor;
  11070. ctx.globalAlpha = this.current.strokeAlpha;
  11071. if (this.contentVisible) {
  11072. if (_typeof(strokeColor) === "object" && strokeColor !== null && strokeColor !== void 0 && strokeColor.getPattern) {
  11073. ctx.save();
  11074. ctx.strokeStyle = strokeColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.STROKE);
  11075. this.rescaleAndStroke(false);
  11076. ctx.restore();
  11077. } else {
  11078. this.rescaleAndStroke(true);
  11079. }
  11080. }
  11081. if (consumePath) {
  11082. this.consumePath(this.current.getClippedPathBoundingBox());
  11083. }
  11084. ctx.globalAlpha = this.current.fillAlpha;
  11085. }
  11086. }, {
  11087. key: "closeStroke",
  11088. value: function closeStroke() {
  11089. this.closePath();
  11090. this.stroke();
  11091. }
  11092. }, {
  11093. key: "fill",
  11094. value: function fill(consumePath) {
  11095. consumePath = typeof consumePath !== "undefined" ? consumePath : true;
  11096. var ctx = this.ctx;
  11097. var fillColor = this.current.fillColor;
  11098. var isPatternFill = this.current.patternFill;
  11099. var needRestore = false;
  11100. if (isPatternFill) {
  11101. ctx.save();
  11102. ctx.fillStyle = fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL);
  11103. needRestore = true;
  11104. }
  11105. var intersect = this.current.getClippedPathBoundingBox();
  11106. if (this.contentVisible && intersect !== null) {
  11107. if (this.pendingEOFill) {
  11108. ctx.fill("evenodd");
  11109. this.pendingEOFill = false;
  11110. } else {
  11111. ctx.fill();
  11112. }
  11113. }
  11114. if (needRestore) {
  11115. ctx.restore();
  11116. }
  11117. if (consumePath) {
  11118. this.consumePath(intersect);
  11119. }
  11120. }
  11121. }, {
  11122. key: "eoFill",
  11123. value: function eoFill() {
  11124. this.pendingEOFill = true;
  11125. this.fill();
  11126. }
  11127. }, {
  11128. key: "fillStroke",
  11129. value: function fillStroke() {
  11130. this.fill(false);
  11131. this.stroke(false);
  11132. this.consumePath();
  11133. }
  11134. }, {
  11135. key: "eoFillStroke",
  11136. value: function eoFillStroke() {
  11137. this.pendingEOFill = true;
  11138. this.fillStroke();
  11139. }
  11140. }, {
  11141. key: "closeFillStroke",
  11142. value: function closeFillStroke() {
  11143. this.closePath();
  11144. this.fillStroke();
  11145. }
  11146. }, {
  11147. key: "closeEOFillStroke",
  11148. value: function closeEOFillStroke() {
  11149. this.pendingEOFill = true;
  11150. this.closePath();
  11151. this.fillStroke();
  11152. }
  11153. }, {
  11154. key: "endPath",
  11155. value: function endPath() {
  11156. this.consumePath();
  11157. }
  11158. }, {
  11159. key: "clip",
  11160. value: function clip() {
  11161. this.pendingClip = NORMAL_CLIP;
  11162. }
  11163. }, {
  11164. key: "eoClip",
  11165. value: function eoClip() {
  11166. this.pendingClip = EO_CLIP;
  11167. }
  11168. }, {
  11169. key: "beginText",
  11170. value: function beginText() {
  11171. this.current.textMatrix = _util.IDENTITY_MATRIX;
  11172. this.current.textMatrixScale = 1;
  11173. this.current.x = this.current.lineX = 0;
  11174. this.current.y = this.current.lineY = 0;
  11175. }
  11176. }, {
  11177. key: "endText",
  11178. value: function endText() {
  11179. var paths = this.pendingTextPaths;
  11180. var ctx = this.ctx;
  11181. if (paths === undefined) {
  11182. ctx.beginPath();
  11183. return;
  11184. }
  11185. ctx.save();
  11186. ctx.beginPath();
  11187. for (var i = 0; i < paths.length; i++) {
  11188. var path = paths[i];
  11189. ctx.setTransform.apply(ctx, path.transform);
  11190. ctx.translate(path.x, path.y);
  11191. path.addToPath(ctx, path.fontSize);
  11192. }
  11193. ctx.restore();
  11194. ctx.clip();
  11195. ctx.beginPath();
  11196. delete this.pendingTextPaths;
  11197. }
  11198. }, {
  11199. key: "setCharSpacing",
  11200. value: function setCharSpacing(spacing) {
  11201. this.current.charSpacing = spacing;
  11202. }
  11203. }, {
  11204. key: "setWordSpacing",
  11205. value: function setWordSpacing(spacing) {
  11206. this.current.wordSpacing = spacing;
  11207. }
  11208. }, {
  11209. key: "setHScale",
  11210. value: function setHScale(scale) {
  11211. this.current.textHScale = scale / 100;
  11212. }
  11213. }, {
  11214. key: "setLeading",
  11215. value: function setLeading(leading) {
  11216. this.current.leading = -leading;
  11217. }
  11218. }, {
  11219. key: "setFont",
  11220. value: function setFont(fontRefName, size) {
  11221. var fontObj = this.commonObjs.get(fontRefName);
  11222. var current = this.current;
  11223. if (!fontObj) {
  11224. throw new Error("Can't find font for ".concat(fontRefName));
  11225. }
  11226. current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  11227. if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
  11228. (0, _util.warn)("Invalid font matrix for font " + fontRefName);
  11229. }
  11230. if (size < 0) {
  11231. size = -size;
  11232. current.fontDirection = -1;
  11233. } else {
  11234. current.fontDirection = 1;
  11235. }
  11236. this.current.font = fontObj;
  11237. this.current.fontSize = size;
  11238. if (fontObj.isType3Font) {
  11239. return;
  11240. }
  11241. var name = fontObj.loadedName || "sans-serif";
  11242. var bold = "normal";
  11243. if (fontObj.black) {
  11244. bold = "900";
  11245. } else if (fontObj.bold) {
  11246. bold = "bold";
  11247. }
  11248. var italic = fontObj.italic ? "italic" : "normal";
  11249. var typeface = "\"".concat(name, "\", ").concat(fontObj.fallbackName);
  11250. var browserFontSize = size;
  11251. if (size < MIN_FONT_SIZE) {
  11252. browserFontSize = MIN_FONT_SIZE;
  11253. } else if (size > MAX_FONT_SIZE) {
  11254. browserFontSize = MAX_FONT_SIZE;
  11255. }
  11256. this.current.fontSizeScale = size / browserFontSize;
  11257. this.ctx.font = "".concat(italic, " ").concat(bold, " ").concat(browserFontSize, "px ").concat(typeface);
  11258. }
  11259. }, {
  11260. key: "setTextRenderingMode",
  11261. value: function setTextRenderingMode(mode) {
  11262. this.current.textRenderingMode = mode;
  11263. }
  11264. }, {
  11265. key: "setTextRise",
  11266. value: function setTextRise(rise) {
  11267. this.current.textRise = rise;
  11268. }
  11269. }, {
  11270. key: "moveText",
  11271. value: function moveText(x, y) {
  11272. this.current.x = this.current.lineX += x;
  11273. this.current.y = this.current.lineY += y;
  11274. }
  11275. }, {
  11276. key: "setLeadingMoveText",
  11277. value: function setLeadingMoveText(x, y) {
  11278. this.setLeading(-y);
  11279. this.moveText(x, y);
  11280. }
  11281. }, {
  11282. key: "setTextMatrix",
  11283. value: function setTextMatrix(a, b, c, d, e, f) {
  11284. this.current.textMatrix = [a, b, c, d, e, f];
  11285. this.current.textMatrixScale = Math.hypot(a, b);
  11286. this.current.x = this.current.lineX = 0;
  11287. this.current.y = this.current.lineY = 0;
  11288. }
  11289. }, {
  11290. key: "nextLine",
  11291. value: function nextLine() {
  11292. this.moveText(0, this.current.leading);
  11293. }
  11294. }, {
  11295. key: "paintChar",
  11296. value: function paintChar(character, x, y, patternTransform) {
  11297. var ctx = this.ctx;
  11298. var current = this.current;
  11299. var font = current.font;
  11300. var textRenderingMode = current.textRenderingMode;
  11301. var fontSize = current.fontSize / current.fontSizeScale;
  11302. var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
  11303. var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  11304. var patternFill = current.patternFill && !font.missingFile;
  11305. var addToPath;
  11306. if (font.disableFontFace || isAddToPathSet || patternFill) {
  11307. addToPath = font.getPathGenerator(this.commonObjs, character);
  11308. }
  11309. if (font.disableFontFace || patternFill) {
  11310. ctx.save();
  11311. ctx.translate(x, y);
  11312. ctx.beginPath();
  11313. addToPath(ctx, fontSize);
  11314. if (patternTransform) {
  11315. ctx.setTransform.apply(ctx, patternTransform);
  11316. }
  11317. if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  11318. ctx.fill();
  11319. }
  11320. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  11321. ctx.stroke();
  11322. }
  11323. ctx.restore();
  11324. } else {
  11325. if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  11326. ctx.fillText(character, x, y);
  11327. }
  11328. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  11329. ctx.strokeText(character, x, y);
  11330. }
  11331. }
  11332. if (isAddToPathSet) {
  11333. var paths = this.pendingTextPaths || (this.pendingTextPaths = []);
  11334. paths.push({
  11335. transform: ctx.mozCurrentTransform,
  11336. x: x,
  11337. y: y,
  11338. fontSize: fontSize,
  11339. addToPath: addToPath
  11340. });
  11341. }
  11342. }
  11343. }, {
  11344. key: "isFontSubpixelAAEnabled",
  11345. get: function get() {
  11346. var _this$cachedCanvases$ = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10, false),
  11347. ctx = _this$cachedCanvases$.context;
  11348. ctx.scale(1.5, 1);
  11349. ctx.fillText("I", 0, 10);
  11350. var data = ctx.getImageData(0, 0, 10, 10).data;
  11351. var enabled = false;
  11352. for (var i = 3; i < data.length; i += 4) {
  11353. if (data[i] > 0 && data[i] < 255) {
  11354. enabled = true;
  11355. break;
  11356. }
  11357. }
  11358. return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled);
  11359. }
  11360. }, {
  11361. key: "showText",
  11362. value: function showText(glyphs) {
  11363. var current = this.current;
  11364. var font = current.font;
  11365. if (font.isType3Font) {
  11366. return this.showType3Text(glyphs);
  11367. }
  11368. var fontSize = current.fontSize;
  11369. if (fontSize === 0) {
  11370. return undefined;
  11371. }
  11372. var ctx = this.ctx;
  11373. var fontSizeScale = current.fontSizeScale;
  11374. var charSpacing = current.charSpacing;
  11375. var wordSpacing = current.wordSpacing;
  11376. var fontDirection = current.fontDirection;
  11377. var textHScale = current.textHScale * fontDirection;
  11378. var glyphsLength = glyphs.length;
  11379. var vertical = font.vertical;
  11380. var spacingDir = vertical ? 1 : -1;
  11381. var defaultVMetrics = font.defaultVMetrics;
  11382. var widthAdvanceScale = fontSize * current.fontMatrix[0];
  11383. var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
  11384. ctx.save();
  11385. ctx.transform.apply(ctx, current.textMatrix);
  11386. ctx.translate(current.x, current.y + current.textRise);
  11387. if (fontDirection > 0) {
  11388. ctx.scale(textHScale, -1);
  11389. } else {
  11390. ctx.scale(textHScale, 1);
  11391. }
  11392. var patternTransform;
  11393. if (current.patternFill) {
  11394. ctx.save();
  11395. var pattern = current.fillColor.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL);
  11396. patternTransform = ctx.mozCurrentTransform;
  11397. ctx.restore();
  11398. ctx.fillStyle = pattern;
  11399. }
  11400. var lineWidth = current.lineWidth;
  11401. var scale = current.textMatrixScale;
  11402. if (scale === 0 || lineWidth === 0) {
  11403. var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
  11404. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  11405. lineWidth = this.getSinglePixelWidth();
  11406. }
  11407. } else {
  11408. lineWidth /= scale;
  11409. }
  11410. if (fontSizeScale !== 1.0) {
  11411. ctx.scale(fontSizeScale, fontSizeScale);
  11412. lineWidth /= fontSizeScale;
  11413. }
  11414. ctx.lineWidth = lineWidth;
  11415. var x = 0,
  11416. i;
  11417. for (i = 0; i < glyphsLength; ++i) {
  11418. var glyph = glyphs[i];
  11419. if (typeof glyph === "number") {
  11420. x += spacingDir * glyph * fontSize / 1000;
  11421. continue;
  11422. }
  11423. var restoreNeeded = false;
  11424. var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
  11425. var character = glyph.fontChar;
  11426. var accent = glyph.accent;
  11427. var scaledX = void 0,
  11428. scaledY = void 0;
  11429. var width = glyph.width;
  11430. if (vertical) {
  11431. var vmetric = glyph.vmetric || defaultVMetrics;
  11432. var vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;
  11433. var vy = vmetric[2] * widthAdvanceScale;
  11434. width = vmetric ? -vmetric[0] : width;
  11435. scaledX = vx / fontSizeScale;
  11436. scaledY = (x + vy) / fontSizeScale;
  11437. } else {
  11438. scaledX = x / fontSizeScale;
  11439. scaledY = 0;
  11440. }
  11441. if (font.remeasure && width > 0) {
  11442. var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;
  11443. if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
  11444. var characterScaleX = width / measuredWidth;
  11445. restoreNeeded = true;
  11446. ctx.save();
  11447. ctx.scale(characterScaleX, 1);
  11448. scaledX /= characterScaleX;
  11449. } else if (width !== measuredWidth) {
  11450. scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;
  11451. }
  11452. }
  11453. if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
  11454. if (simpleFillText && !accent) {
  11455. ctx.fillText(character, scaledX, scaledY);
  11456. } else {
  11457. this.paintChar(character, scaledX, scaledY, patternTransform);
  11458. if (accent) {
  11459. var scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
  11460. var scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
  11461. this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform);
  11462. }
  11463. }
  11464. }
  11465. var charWidth = void 0;
  11466. if (vertical) {
  11467. charWidth = width * widthAdvanceScale - spacing * fontDirection;
  11468. } else {
  11469. charWidth = width * widthAdvanceScale + spacing * fontDirection;
  11470. }
  11471. x += charWidth;
  11472. if (restoreNeeded) {
  11473. ctx.restore();
  11474. }
  11475. }
  11476. if (vertical) {
  11477. current.y -= x;
  11478. } else {
  11479. current.x += x * textHScale;
  11480. }
  11481. ctx.restore();
  11482. this.compose();
  11483. return undefined;
  11484. }
  11485. }, {
  11486. key: "showType3Text",
  11487. value: function showType3Text(glyphs) {
  11488. var ctx = this.ctx;
  11489. var current = this.current;
  11490. var font = current.font;
  11491. var fontSize = current.fontSize;
  11492. var fontDirection = current.fontDirection;
  11493. var spacingDir = font.vertical ? 1 : -1;
  11494. var charSpacing = current.charSpacing;
  11495. var wordSpacing = current.wordSpacing;
  11496. var textHScale = current.textHScale * fontDirection;
  11497. var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  11498. var glyphsLength = glyphs.length;
  11499. var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE;
  11500. var i, glyph, width, spacingLength;
  11501. if (isTextInvisible || fontSize === 0) {
  11502. return;
  11503. }
  11504. this._cachedScaleForStroking = null;
  11505. this._cachedGetSinglePixelWidth = null;
  11506. ctx.save();
  11507. ctx.transform.apply(ctx, current.textMatrix);
  11508. ctx.translate(current.x, current.y);
  11509. ctx.scale(textHScale, fontDirection);
  11510. for (i = 0; i < glyphsLength; ++i) {
  11511. glyph = glyphs[i];
  11512. if (typeof glyph === "number") {
  11513. spacingLength = spacingDir * glyph * fontSize / 1000;
  11514. this.ctx.translate(spacingLength, 0);
  11515. current.x += spacingLength * textHScale;
  11516. continue;
  11517. }
  11518. var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
  11519. var operatorList = font.charProcOperatorList[glyph.operatorListId];
  11520. if (!operatorList) {
  11521. (0, _util.warn)("Type3 character \"".concat(glyph.operatorListId, "\" is not available."));
  11522. continue;
  11523. }
  11524. if (this.contentVisible) {
  11525. this.processingType3 = glyph;
  11526. this.save();
  11527. ctx.scale(fontSize, fontSize);
  11528. ctx.transform.apply(ctx, fontMatrix);
  11529. this.executeOperatorList(operatorList);
  11530. this.restore();
  11531. }
  11532. var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix);
  11533. width = transformed[0] * fontSize + spacing;
  11534. ctx.translate(width, 0);
  11535. current.x += width * textHScale;
  11536. }
  11537. ctx.restore();
  11538. this.processingType3 = null;
  11539. }
  11540. }, {
  11541. key: "setCharWidth",
  11542. value: function setCharWidth(xWidth, yWidth) {}
  11543. }, {
  11544. key: "setCharWidthAndBounds",
  11545. value: function setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
  11546. this.ctx.rect(llx, lly, urx - llx, ury - lly);
  11547. this.ctx.clip();
  11548. this.endPath();
  11549. }
  11550. }, {
  11551. key: "getColorN_Pattern",
  11552. value: function getColorN_Pattern(IR) {
  11553. var _this = this;
  11554. var pattern;
  11555. if (IR[0] === "TilingPattern") {
  11556. var color = IR[1];
  11557. var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice();
  11558. var canvasGraphicsFactory = {
  11559. createCanvasGraphics: function createCanvasGraphics(ctx) {
  11560. return new CanvasGraphics(ctx, _this.commonObjs, _this.objs, _this.canvasFactory);
  11561. }
  11562. };
  11563. pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
  11564. } else {
  11565. pattern = this._getPattern(IR[1], IR[2]);
  11566. }
  11567. return pattern;
  11568. }
  11569. }, {
  11570. key: "setStrokeColorN",
  11571. value: function setStrokeColorN() {
  11572. this.current.strokeColor = this.getColorN_Pattern(arguments);
  11573. }
  11574. }, {
  11575. key: "setFillColorN",
  11576. value: function setFillColorN() {
  11577. this.current.fillColor = this.getColorN_Pattern(arguments);
  11578. this.current.patternFill = true;
  11579. }
  11580. }, {
  11581. key: "setStrokeRGBColor",
  11582. value: function setStrokeRGBColor(r, g, b) {
  11583. var _this$selectColor;
  11584. var color = ((_this$selectColor = this.selectColor) === null || _this$selectColor === void 0 ? void 0 : _this$selectColor.call(this, r, g, b)) || _util.Util.makeHexColor(r, g, b);
  11585. this.ctx.strokeStyle = color;
  11586. this.current.strokeColor = color;
  11587. }
  11588. }, {
  11589. key: "setFillRGBColor",
  11590. value: function setFillRGBColor(r, g, b) {
  11591. var _this$selectColor2;
  11592. var color = ((_this$selectColor2 = this.selectColor) === null || _this$selectColor2 === void 0 ? void 0 : _this$selectColor2.call(this, r, g, b)) || _util.Util.makeHexColor(r, g, b);
  11593. this.ctx.fillStyle = color;
  11594. this.current.fillColor = color;
  11595. this.current.patternFill = false;
  11596. }
  11597. }, {
  11598. key: "_getPattern",
  11599. value: function _getPattern(objId) {
  11600. var matrix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  11601. var pattern;
  11602. if (this.cachedPatterns.has(objId)) {
  11603. pattern = this.cachedPatterns.get(objId);
  11604. } else {
  11605. pattern = (0, _pattern_helper.getShadingPattern)(this.objs.get(objId));
  11606. this.cachedPatterns.set(objId, pattern);
  11607. }
  11608. if (matrix) {
  11609. pattern.matrix = matrix;
  11610. }
  11611. return pattern;
  11612. }
  11613. }, {
  11614. key: "shadingFill",
  11615. value: function shadingFill(objId) {
  11616. if (!this.contentVisible) {
  11617. return;
  11618. }
  11619. var ctx = this.ctx;
  11620. this.save();
  11621. var pattern = this._getPattern(objId);
  11622. ctx.fillStyle = pattern.getPattern(ctx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.SHADING);
  11623. var inv = ctx.mozCurrentTransformInverse;
  11624. if (inv) {
  11625. var canvas = ctx.canvas;
  11626. var width = canvas.width;
  11627. var height = canvas.height;
  11628. var bl = _util.Util.applyTransform([0, 0], inv);
  11629. var br = _util.Util.applyTransform([0, height], inv);
  11630. var ul = _util.Util.applyTransform([width, 0], inv);
  11631. var ur = _util.Util.applyTransform([width, height], inv);
  11632. var x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
  11633. var y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
  11634. var x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
  11635. var y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
  11636. this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
  11637. } else {
  11638. this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
  11639. }
  11640. this.compose(this.current.getClippedPathBoundingBox());
  11641. this.restore();
  11642. }
  11643. }, {
  11644. key: "beginInlineImage",
  11645. value: function beginInlineImage() {
  11646. (0, _util.unreachable)("Should not call beginInlineImage");
  11647. }
  11648. }, {
  11649. key: "beginImageData",
  11650. value: function beginImageData() {
  11651. (0, _util.unreachable)("Should not call beginImageData");
  11652. }
  11653. }, {
  11654. key: "paintFormXObjectBegin",
  11655. value: function paintFormXObjectBegin(matrix, bbox) {
  11656. if (!this.contentVisible) {
  11657. return;
  11658. }
  11659. this.save();
  11660. this.baseTransformStack.push(this.baseTransform);
  11661. if (Array.isArray(matrix) && matrix.length === 6) {
  11662. this.transform.apply(this, matrix);
  11663. }
  11664. this.baseTransform = this.ctx.mozCurrentTransform;
  11665. if (bbox) {
  11666. var width = bbox[2] - bbox[0];
  11667. var height = bbox[3] - bbox[1];
  11668. this.ctx.rect(bbox[0], bbox[1], width, height);
  11669. this.current.updateRectMinMax(this.ctx.mozCurrentTransform, bbox);
  11670. this.clip();
  11671. this.endPath();
  11672. }
  11673. }
  11674. }, {
  11675. key: "paintFormXObjectEnd",
  11676. value: function paintFormXObjectEnd() {
  11677. if (!this.contentVisible) {
  11678. return;
  11679. }
  11680. this.restore();
  11681. this.baseTransform = this.baseTransformStack.pop();
  11682. }
  11683. }, {
  11684. key: "beginGroup",
  11685. value: function beginGroup(group) {
  11686. if (!this.contentVisible) {
  11687. return;
  11688. }
  11689. this.save();
  11690. if (this.inSMaskMode) {
  11691. this.endSMaskMode();
  11692. this.current.activeSMask = null;
  11693. }
  11694. var currentCtx = this.ctx;
  11695. if (!group.isolated) {
  11696. (0, _util.info)("TODO: Support non-isolated groups.");
  11697. }
  11698. if (group.knockout) {
  11699. (0, _util.warn)("Knockout groups not supported.");
  11700. }
  11701. var currentTransform = currentCtx.mozCurrentTransform;
  11702. if (group.matrix) {
  11703. currentCtx.transform.apply(currentCtx, group.matrix);
  11704. }
  11705. if (!group.bbox) {
  11706. throw new Error("Bounding box is required.");
  11707. }
  11708. var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform);
  11709. var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
  11710. bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
  11711. var offsetX = Math.floor(bounds[0]);
  11712. var offsetY = Math.floor(bounds[1]);
  11713. var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
  11714. var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
  11715. var scaleX = 1,
  11716. scaleY = 1;
  11717. if (drawnWidth > MAX_GROUP_SIZE) {
  11718. scaleX = drawnWidth / MAX_GROUP_SIZE;
  11719. drawnWidth = MAX_GROUP_SIZE;
  11720. }
  11721. if (drawnHeight > MAX_GROUP_SIZE) {
  11722. scaleY = drawnHeight / MAX_GROUP_SIZE;
  11723. drawnHeight = MAX_GROUP_SIZE;
  11724. }
  11725. this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
  11726. var cacheId = "groupAt" + this.groupLevel;
  11727. if (group.smask) {
  11728. cacheId += "_smask_" + this.smaskCounter++ % 2;
  11729. }
  11730. var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
  11731. var groupCtx = scratchCanvas.context;
  11732. groupCtx.scale(1 / scaleX, 1 / scaleY);
  11733. groupCtx.translate(-offsetX, -offsetY);
  11734. groupCtx.transform.apply(groupCtx, currentTransform);
  11735. if (group.smask) {
  11736. this.smaskStack.push({
  11737. canvas: scratchCanvas.canvas,
  11738. context: groupCtx,
  11739. offsetX: offsetX,
  11740. offsetY: offsetY,
  11741. scaleX: scaleX,
  11742. scaleY: scaleY,
  11743. subtype: group.smask.subtype,
  11744. backdrop: group.smask.backdrop,
  11745. transferMap: group.smask.transferMap || null,
  11746. startTransformInverse: null
  11747. });
  11748. } else {
  11749. currentCtx.setTransform(1, 0, 0, 1, 0, 0);
  11750. currentCtx.translate(offsetX, offsetY);
  11751. currentCtx.scale(scaleX, scaleY);
  11752. currentCtx.save();
  11753. }
  11754. copyCtxState(currentCtx, groupCtx);
  11755. this.ctx = groupCtx;
  11756. this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
  11757. this.groupStack.push(currentCtx);
  11758. this.groupLevel++;
  11759. }
  11760. }, {
  11761. key: "endGroup",
  11762. value: function endGroup(group) {
  11763. if (!this.contentVisible) {
  11764. return;
  11765. }
  11766. this.groupLevel--;
  11767. var groupCtx = this.ctx;
  11768. var ctx = this.groupStack.pop();
  11769. this.ctx = ctx;
  11770. this.ctx.imageSmoothingEnabled = false;
  11771. if (group.smask) {
  11772. this.tempSMask = this.smaskStack.pop();
  11773. this.restore();
  11774. } else {
  11775. this.ctx.restore();
  11776. var currentMtx = this.ctx.mozCurrentTransform;
  11777. this.restore();
  11778. this.ctx.save();
  11779. this.ctx.setTransform.apply(this.ctx, currentMtx);
  11780. var dirtyBox = _util.Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx);
  11781. this.ctx.drawImage(groupCtx.canvas, 0, 0);
  11782. this.ctx.restore();
  11783. this.compose(dirtyBox);
  11784. }
  11785. }
  11786. }, {
  11787. key: "beginAnnotations",
  11788. value: function beginAnnotations() {
  11789. this.save();
  11790. if (this.baseTransform) {
  11791. this.ctx.setTransform.apply(this.ctx, this.baseTransform);
  11792. }
  11793. }
  11794. }, {
  11795. key: "endAnnotations",
  11796. value: function endAnnotations() {
  11797. this.restore();
  11798. }
  11799. }, {
  11800. key: "beginAnnotation",
  11801. value: function beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {
  11802. this.save();
  11803. if (Array.isArray(rect) && rect.length === 4) {
  11804. var width = rect[2] - rect[0];
  11805. var height = rect[3] - rect[1];
  11806. if (hasOwnCanvas && this.annotationCanvasMap) {
  11807. transform = transform.slice();
  11808. transform[4] -= rect[0];
  11809. transform[5] -= rect[1];
  11810. rect = rect.slice();
  11811. rect[0] = rect[1] = 0;
  11812. rect[2] = width;
  11813. rect[3] = height;
  11814. var _Util$singularValueDe = _util.Util.singularValueDecompose2dScale(this.ctx.mozCurrentTransform),
  11815. _Util$singularValueDe2 = _slicedToArray(_Util$singularValueDe, 2),
  11816. scaleX = _Util$singularValueDe2[0],
  11817. scaleY = _Util$singularValueDe2[1];
  11818. var viewportScale = this.viewportScale;
  11819. var canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
  11820. var canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
  11821. this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
  11822. var _this$annotationCanva = this.annotationCanvas,
  11823. canvas = _this$annotationCanva.canvas,
  11824. context = _this$annotationCanva.context;
  11825. var viewportScaleFactorStr = "var(--zoom-factor) * ".concat(_display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
  11826. canvas.style.width = "calc(".concat(width, "px * ").concat(viewportScaleFactorStr, ")");
  11827. canvas.style.height = "calc(".concat(height, "px * ").concat(viewportScaleFactorStr, ")");
  11828. this.annotationCanvasMap.set(id, canvas);
  11829. this.annotationCanvas.savedCtx = this.ctx;
  11830. this.ctx = context;
  11831. this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);
  11832. addContextCurrentTransform(this.ctx);
  11833. resetCtxToDefault(this.ctx, this.foregroundColor);
  11834. } else {
  11835. resetCtxToDefault(this.ctx, this.foregroundColor);
  11836. this.ctx.rect(rect[0], rect[1], width, height);
  11837. this.ctx.clip();
  11838. this.endPath();
  11839. }
  11840. }
  11841. this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
  11842. this.transform.apply(this, transform);
  11843. this.transform.apply(this, matrix);
  11844. }
  11845. }, {
  11846. key: "endAnnotation",
  11847. value: function endAnnotation() {
  11848. if (this.annotationCanvas) {
  11849. this.ctx = this.annotationCanvas.savedCtx;
  11850. delete this.annotationCanvas.savedCtx;
  11851. delete this.annotationCanvas;
  11852. }
  11853. this.restore();
  11854. }
  11855. }, {
  11856. key: "paintImageMaskXObject",
  11857. value: function paintImageMaskXObject(img) {
  11858. if (!this.contentVisible) {
  11859. return;
  11860. }
  11861. var count = img.count;
  11862. img = this.getObject(img.data, img);
  11863. img.count = count;
  11864. var ctx = this.ctx;
  11865. var glyph = this.processingType3;
  11866. if (glyph) {
  11867. if (glyph.compiled === undefined) {
  11868. glyph.compiled = compileType3Glyph(img);
  11869. }
  11870. if (glyph.compiled) {
  11871. glyph.compiled(ctx);
  11872. return;
  11873. }
  11874. }
  11875. var mask = this._createMaskCanvas(img);
  11876. var maskCanvas = mask.canvas;
  11877. ctx.save();
  11878. ctx.setTransform(1, 0, 0, 1, 0, 0);
  11879. ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
  11880. ctx.restore();
  11881. this.compose();
  11882. }
  11883. }, {
  11884. key: "paintImageMaskXObjectRepeat",
  11885. value: function paintImageMaskXObjectRepeat(img, scaleX) {
  11886. var skewX = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  11887. var skewY = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  11888. var scaleY = arguments.length > 4 ? arguments[4] : undefined;
  11889. var positions = arguments.length > 5 ? arguments[5] : undefined;
  11890. if (!this.contentVisible) {
  11891. return;
  11892. }
  11893. img = this.getObject(img.data, img);
  11894. var ctx = this.ctx;
  11895. ctx.save();
  11896. var currentTransform = ctx.mozCurrentTransform;
  11897. ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
  11898. var mask = this._createMaskCanvas(img);
  11899. ctx.setTransform(1, 0, 0, 1, 0, 0);
  11900. for (var i = 0, ii = positions.length; i < ii; i += 2) {
  11901. var trans = _util.Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
  11902. var _Util$applyTransform3 = _util.Util.applyTransform([0, 0], trans),
  11903. _Util$applyTransform4 = _slicedToArray(_Util$applyTransform3, 2),
  11904. x = _Util$applyTransform4[0],
  11905. y = _Util$applyTransform4[1];
  11906. ctx.drawImage(mask.canvas, x, y);
  11907. }
  11908. ctx.restore();
  11909. this.compose();
  11910. }
  11911. }, {
  11912. key: "paintImageMaskXObjectGroup",
  11913. value: function paintImageMaskXObjectGroup(images) {
  11914. if (!this.contentVisible) {
  11915. return;
  11916. }
  11917. var ctx = this.ctx;
  11918. var fillColor = this.current.fillColor;
  11919. var isPatternFill = this.current.patternFill;
  11920. for (var i = 0, ii = images.length; i < ii; i++) {
  11921. var image = images[i];
  11922. var width = image.width,
  11923. height = image.height;
  11924. var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height, false);
  11925. var maskCtx = maskCanvas.context;
  11926. maskCtx.save();
  11927. putBinaryImageMask(maskCtx, image);
  11928. maskCtx.globalCompositeOperation = "source-in";
  11929. maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, ctx.mozCurrentTransformInverse, _pattern_helper.PathType.FILL) : fillColor;
  11930. maskCtx.fillRect(0, 0, width, height);
  11931. maskCtx.restore();
  11932. ctx.save();
  11933. ctx.transform.apply(ctx, image.transform);
  11934. ctx.scale(1, -1);
  11935. drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
  11936. ctx.restore();
  11937. }
  11938. this.compose();
  11939. }
  11940. }, {
  11941. key: "paintImageXObject",
  11942. value: function paintImageXObject(objId) {
  11943. if (!this.contentVisible) {
  11944. return;
  11945. }
  11946. var imgData = this.getObject(objId);
  11947. if (!imgData) {
  11948. (0, _util.warn)("Dependent image isn't ready yet");
  11949. return;
  11950. }
  11951. this.paintInlineImageXObject(imgData);
  11952. }
  11953. }, {
  11954. key: "paintImageXObjectRepeat",
  11955. value: function paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
  11956. if (!this.contentVisible) {
  11957. return;
  11958. }
  11959. var imgData = this.getObject(objId);
  11960. if (!imgData) {
  11961. (0, _util.warn)("Dependent image isn't ready yet");
  11962. return;
  11963. }
  11964. var width = imgData.width;
  11965. var height = imgData.height;
  11966. var map = [];
  11967. for (var i = 0, ii = positions.length; i < ii; i += 2) {
  11968. map.push({
  11969. transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
  11970. x: 0,
  11971. y: 0,
  11972. w: width,
  11973. h: height
  11974. });
  11975. }
  11976. this.paintInlineImageXObjectGroup(imgData, map);
  11977. }
  11978. }, {
  11979. key: "paintInlineImageXObject",
  11980. value: function paintInlineImageXObject(imgData) {
  11981. if (!this.contentVisible) {
  11982. return;
  11983. }
  11984. var width = imgData.width;
  11985. var height = imgData.height;
  11986. var ctx = this.ctx;
  11987. this.save();
  11988. ctx.scale(1 / width, -1 / height);
  11989. var imgToPaint;
  11990. if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
  11991. imgToPaint = imgData;
  11992. } else {
  11993. var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height, false);
  11994. var tmpCtx = tmpCanvas.context;
  11995. putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);
  11996. imgToPaint = tmpCanvas.canvas;
  11997. }
  11998. var scaled = this._scaleImage(imgToPaint, ctx.mozCurrentTransformInverse);
  11999. ctx.imageSmoothingEnabled = getImageSmoothingEnabled(ctx.mozCurrentTransform, imgData.interpolate);
  12000. var _drawImageAtIntegerCo = drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height),
  12001. _drawImageAtIntegerCo2 = _slicedToArray(_drawImageAtIntegerCo, 2),
  12002. rWidth = _drawImageAtIntegerCo2[0],
  12003. rHeight = _drawImageAtIntegerCo2[1];
  12004. if (this.imageLayer) {
  12005. var position = this.getCanvasPosition(0, -height);
  12006. this.imageLayer.appendImage({
  12007. imgData: imgData,
  12008. left: position[0],
  12009. top: position[1],
  12010. width: rWidth,
  12011. height: rHeight
  12012. });
  12013. }
  12014. this.compose();
  12015. this.restore();
  12016. }
  12017. }, {
  12018. key: "paintInlineImageXObjectGroup",
  12019. value: function paintInlineImageXObjectGroup(imgData, map) {
  12020. if (!this.contentVisible) {
  12021. return;
  12022. }
  12023. var ctx = this.ctx;
  12024. var w = imgData.width;
  12025. var h = imgData.height;
  12026. var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h, false);
  12027. var tmpCtx = tmpCanvas.context;
  12028. putBinaryImageData(tmpCtx, imgData, this.current.transferMaps);
  12029. for (var i = 0, ii = map.length; i < ii; i++) {
  12030. var entry = map[i];
  12031. ctx.save();
  12032. ctx.transform.apply(ctx, entry.transform);
  12033. ctx.scale(1, -1);
  12034. drawImageAtIntegerCoords(ctx, tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
  12035. if (this.imageLayer) {
  12036. var position = this.getCanvasPosition(entry.x, entry.y);
  12037. this.imageLayer.appendImage({
  12038. imgData: imgData,
  12039. left: position[0],
  12040. top: position[1],
  12041. width: w,
  12042. height: h
  12043. });
  12044. }
  12045. ctx.restore();
  12046. }
  12047. this.compose();
  12048. }
  12049. }, {
  12050. key: "paintSolidColorImageMask",
  12051. value: function paintSolidColorImageMask() {
  12052. if (!this.contentVisible) {
  12053. return;
  12054. }
  12055. this.ctx.fillRect(0, 0, 1, 1);
  12056. this.compose();
  12057. }
  12058. }, {
  12059. key: "markPoint",
  12060. value: function markPoint(tag) {}
  12061. }, {
  12062. key: "markPointProps",
  12063. value: function markPointProps(tag, properties) {}
  12064. }, {
  12065. key: "beginMarkedContent",
  12066. value: function beginMarkedContent(tag) {
  12067. this.markedContentStack.push({
  12068. visible: true
  12069. });
  12070. }
  12071. }, {
  12072. key: "beginMarkedContentProps",
  12073. value: function beginMarkedContentProps(tag, properties) {
  12074. if (tag === "OC") {
  12075. this.markedContentStack.push({
  12076. visible: this.optionalContentConfig.isVisible(properties)
  12077. });
  12078. } else {
  12079. this.markedContentStack.push({
  12080. visible: true
  12081. });
  12082. }
  12083. this.contentVisible = this.isContentVisible();
  12084. }
  12085. }, {
  12086. key: "endMarkedContent",
  12087. value: function endMarkedContent() {
  12088. this.markedContentStack.pop();
  12089. this.contentVisible = this.isContentVisible();
  12090. }
  12091. }, {
  12092. key: "beginCompat",
  12093. value: function beginCompat() {}
  12094. }, {
  12095. key: "endCompat",
  12096. value: function endCompat() {}
  12097. }, {
  12098. key: "consumePath",
  12099. value: function consumePath(clipBox) {
  12100. var isEmpty = this.current.isEmptyClip();
  12101. if (this.pendingClip) {
  12102. this.current.updateClipFromPath();
  12103. }
  12104. if (!this.pendingClip) {
  12105. this.compose(clipBox);
  12106. }
  12107. var ctx = this.ctx;
  12108. if (this.pendingClip) {
  12109. if (!isEmpty) {
  12110. if (this.pendingClip === EO_CLIP) {
  12111. ctx.clip("evenodd");
  12112. } else {
  12113. ctx.clip();
  12114. }
  12115. }
  12116. this.pendingClip = null;
  12117. }
  12118. this.current.startNewPathAndClipBox(this.current.clipBox);
  12119. ctx.beginPath();
  12120. }
  12121. }, {
  12122. key: "getSinglePixelWidth",
  12123. value: function getSinglePixelWidth() {
  12124. if (!this._cachedGetSinglePixelWidth) {
  12125. var m = this.ctx.mozCurrentTransform;
  12126. if (m[1] === 0 && m[2] === 0) {
  12127. this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
  12128. } else {
  12129. var absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
  12130. var normX = Math.hypot(m[0], m[2]);
  12131. var normY = Math.hypot(m[1], m[3]);
  12132. this._cachedGetSinglePixelWidth = Math.max(normX, normY) / absDet;
  12133. }
  12134. }
  12135. return this._cachedGetSinglePixelWidth;
  12136. }
  12137. }, {
  12138. key: "getScaleForStroking",
  12139. value: function getScaleForStroking() {
  12140. if (!this._cachedScaleForStroking) {
  12141. var lineWidth = this.current.lineWidth;
  12142. var m = this.ctx.mozCurrentTransform;
  12143. var scaleX, scaleY;
  12144. if (m[1] === 0 && m[2] === 0) {
  12145. var normX = Math.abs(m[0]);
  12146. var normY = Math.abs(m[3]);
  12147. if (lineWidth === 0) {
  12148. scaleX = 1 / normX;
  12149. scaleY = 1 / normY;
  12150. } else {
  12151. var scaledXLineWidth = normX * lineWidth;
  12152. var scaledYLineWidth = normY * lineWidth;
  12153. scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
  12154. scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
  12155. }
  12156. } else {
  12157. var absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
  12158. var _normX = Math.hypot(m[0], m[1]);
  12159. var _normY = Math.hypot(m[2], m[3]);
  12160. if (lineWidth === 0) {
  12161. scaleX = _normY / absDet;
  12162. scaleY = _normX / absDet;
  12163. } else {
  12164. var baseArea = lineWidth * absDet;
  12165. scaleX = _normY > baseArea ? _normY / baseArea : 1;
  12166. scaleY = _normX > baseArea ? _normX / baseArea : 1;
  12167. }
  12168. }
  12169. this._cachedScaleForStroking = [scaleX, scaleY];
  12170. }
  12171. return this._cachedScaleForStroking;
  12172. }
  12173. }, {
  12174. key: "rescaleAndStroke",
  12175. value: function rescaleAndStroke(saveRestore) {
  12176. var ctx = this.ctx;
  12177. var lineWidth = this.current.lineWidth;
  12178. var _this$getScaleForStro = this.getScaleForStroking(),
  12179. _this$getScaleForStro2 = _slicedToArray(_this$getScaleForStro, 2),
  12180. scaleX = _this$getScaleForStro2[0],
  12181. scaleY = _this$getScaleForStro2[1];
  12182. ctx.lineWidth = lineWidth || 1;
  12183. if (scaleX === 1 && scaleY === 1) {
  12184. ctx.stroke();
  12185. return;
  12186. }
  12187. var savedMatrix, savedDashes, savedDashOffset;
  12188. if (saveRestore) {
  12189. savedMatrix = ctx.mozCurrentTransform.slice();
  12190. savedDashes = ctx.getLineDash().slice();
  12191. savedDashOffset = ctx.lineDashOffset;
  12192. }
  12193. ctx.scale(scaleX, scaleY);
  12194. var scale = Math.max(scaleX, scaleY);
  12195. ctx.setLineDash(ctx.getLineDash().map(function (x) {
  12196. return x / scale;
  12197. }));
  12198. ctx.lineDashOffset /= scale;
  12199. ctx.stroke();
  12200. if (saveRestore) {
  12201. ctx.setTransform.apply(ctx, _toConsumableArray(savedMatrix));
  12202. ctx.setLineDash(savedDashes);
  12203. ctx.lineDashOffset = savedDashOffset;
  12204. }
  12205. }
  12206. }, {
  12207. key: "getCanvasPosition",
  12208. value: function getCanvasPosition(x, y) {
  12209. var transform = this.ctx.mozCurrentTransform;
  12210. return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]];
  12211. }
  12212. }, {
  12213. key: "isContentVisible",
  12214. value: function isContentVisible() {
  12215. for (var i = this.markedContentStack.length - 1; i >= 0; i--) {
  12216. if (!this.markedContentStack[i].visible) {
  12217. return false;
  12218. }
  12219. }
  12220. return true;
  12221. }
  12222. }]);
  12223. return CanvasGraphics;
  12224. }();
  12225. exports.CanvasGraphics = CanvasGraphics;
  12226. for (var op in _util.OPS) {
  12227. if (CanvasGraphics.prototype[op] !== undefined) {
  12228. CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op];
  12229. }
  12230. }
  12231. /***/ }),
  12232. /* 164 */
  12233. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12234. "use strict";
  12235. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  12236. Object.defineProperty(exports, "__esModule", ({
  12237. value: true
  12238. }));
  12239. exports.TilingPattern = exports.PathType = void 0;
  12240. exports.getShadingPattern = getShadingPattern;
  12241. var _util = __w_pdfjs_require__(1);
  12242. var _is_node = __w_pdfjs_require__(3);
  12243. 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; } } }; }
  12244. 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); }
  12245. 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; }
  12246. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  12247. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  12248. 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); }; }
  12249. 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); }
  12250. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  12251. 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; } }
  12252. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  12253. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12254. 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); } }
  12255. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  12256. var PathType = {
  12257. FILL: "Fill",
  12258. STROKE: "Stroke",
  12259. SHADING: "Shading"
  12260. };
  12261. exports.PathType = PathType;
  12262. function applyBoundingBox(ctx, bbox) {
  12263. if (!bbox || _is_node.isNodeJS) {
  12264. return;
  12265. }
  12266. var width = bbox[2] - bbox[0];
  12267. var height = bbox[3] - bbox[1];
  12268. var region = new Path2D();
  12269. region.rect(bbox[0], bbox[1], width, height);
  12270. ctx.clip(region);
  12271. }
  12272. var BaseShadingPattern = /*#__PURE__*/function () {
  12273. function BaseShadingPattern() {
  12274. _classCallCheck(this, BaseShadingPattern);
  12275. if (this.constructor === BaseShadingPattern) {
  12276. (0, _util.unreachable)("Cannot initialize BaseShadingPattern.");
  12277. }
  12278. }
  12279. _createClass(BaseShadingPattern, [{
  12280. key: "getPattern",
  12281. value: function getPattern() {
  12282. (0, _util.unreachable)("Abstract method `getPattern` called.");
  12283. }
  12284. }]);
  12285. return BaseShadingPattern;
  12286. }();
  12287. var RadialAxialShadingPattern = /*#__PURE__*/function (_BaseShadingPattern) {
  12288. _inherits(RadialAxialShadingPattern, _BaseShadingPattern);
  12289. var _super = _createSuper(RadialAxialShadingPattern);
  12290. function RadialAxialShadingPattern(IR) {
  12291. var _this;
  12292. _classCallCheck(this, RadialAxialShadingPattern);
  12293. _this = _super.call(this);
  12294. _this._type = IR[1];
  12295. _this._bbox = IR[2];
  12296. _this._colorStops = IR[3];
  12297. _this._p0 = IR[4];
  12298. _this._p1 = IR[5];
  12299. _this._r0 = IR[6];
  12300. _this._r1 = IR[7];
  12301. _this.matrix = null;
  12302. return _this;
  12303. }
  12304. _createClass(RadialAxialShadingPattern, [{
  12305. key: "_createGradient",
  12306. value: function _createGradient(ctx) {
  12307. var grad;
  12308. if (this._type === "axial") {
  12309. grad = ctx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]);
  12310. } else if (this._type === "radial") {
  12311. grad = ctx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1);
  12312. }
  12313. var _iterator = _createForOfIteratorHelper(this._colorStops),
  12314. _step;
  12315. try {
  12316. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  12317. var colorStop = _step.value;
  12318. grad.addColorStop(colorStop[0], colorStop[1]);
  12319. }
  12320. } catch (err) {
  12321. _iterator.e(err);
  12322. } finally {
  12323. _iterator.f();
  12324. }
  12325. return grad;
  12326. }
  12327. }, {
  12328. key: "getPattern",
  12329. value: function getPattern(ctx, owner, inverse, pathType) {
  12330. var pattern;
  12331. if (pathType === PathType.STROKE || pathType === PathType.FILL) {
  12332. var ownerBBox = owner.current.getClippedPathBoundingBox(pathType, ctx.mozCurrentTransform) || [0, 0, 0, 0];
  12333. var width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
  12334. var height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
  12335. var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", width, height, true);
  12336. var tmpCtx = tmpCanvas.context;
  12337. tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
  12338. tmpCtx.beginPath();
  12339. tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
  12340. tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
  12341. inverse = _util.Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
  12342. tmpCtx.transform.apply(tmpCtx, owner.baseTransform);
  12343. if (this.matrix) {
  12344. tmpCtx.transform.apply(tmpCtx, this.matrix);
  12345. }
  12346. applyBoundingBox(tmpCtx, this._bbox);
  12347. tmpCtx.fillStyle = this._createGradient(tmpCtx);
  12348. tmpCtx.fill();
  12349. pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
  12350. var domMatrix = new DOMMatrix(inverse);
  12351. try {
  12352. pattern.setTransform(domMatrix);
  12353. } catch (ex) {
  12354. (0, _util.warn)("RadialAxialShadingPattern.getPattern: \"".concat(ex === null || ex === void 0 ? void 0 : ex.message, "\"."));
  12355. }
  12356. } else {
  12357. applyBoundingBox(ctx, this._bbox);
  12358. pattern = this._createGradient(ctx);
  12359. }
  12360. return pattern;
  12361. }
  12362. }]);
  12363. return RadialAxialShadingPattern;
  12364. }(BaseShadingPattern);
  12365. function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
  12366. var coords = context.coords,
  12367. colors = context.colors;
  12368. var bytes = data.data,
  12369. rowSize = data.width * 4;
  12370. var tmp;
  12371. if (coords[p1 + 1] > coords[p2 + 1]) {
  12372. tmp = p1;
  12373. p1 = p2;
  12374. p2 = tmp;
  12375. tmp = c1;
  12376. c1 = c2;
  12377. c2 = tmp;
  12378. }
  12379. if (coords[p2 + 1] > coords[p3 + 1]) {
  12380. tmp = p2;
  12381. p2 = p3;
  12382. p3 = tmp;
  12383. tmp = c2;
  12384. c2 = c3;
  12385. c3 = tmp;
  12386. }
  12387. if (coords[p1 + 1] > coords[p2 + 1]) {
  12388. tmp = p1;
  12389. p1 = p2;
  12390. p2 = tmp;
  12391. tmp = c1;
  12392. c1 = c2;
  12393. c2 = tmp;
  12394. }
  12395. var x1 = (coords[p1] + context.offsetX) * context.scaleX;
  12396. var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
  12397. var x2 = (coords[p2] + context.offsetX) * context.scaleX;
  12398. var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
  12399. var x3 = (coords[p3] + context.offsetX) * context.scaleX;
  12400. var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
  12401. if (y1 >= y3) {
  12402. return;
  12403. }
  12404. var c1r = colors[c1],
  12405. c1g = colors[c1 + 1],
  12406. c1b = colors[c1 + 2];
  12407. var c2r = colors[c2],
  12408. c2g = colors[c2 + 1],
  12409. c2b = colors[c2 + 2];
  12410. var c3r = colors[c3],
  12411. c3g = colors[c3 + 1],
  12412. c3b = colors[c3 + 2];
  12413. var minY = Math.round(y1),
  12414. maxY = Math.round(y3);
  12415. var xa, car, cag, cab;
  12416. var xb, cbr, cbg, cbb;
  12417. for (var y = minY; y <= maxY; y++) {
  12418. if (y < y2) {
  12419. var _k = void 0;
  12420. if (y < y1) {
  12421. _k = 0;
  12422. } else {
  12423. _k = (y1 - y) / (y1 - y2);
  12424. }
  12425. xa = x1 - (x1 - x2) * _k;
  12426. car = c1r - (c1r - c2r) * _k;
  12427. cag = c1g - (c1g - c2g) * _k;
  12428. cab = c1b - (c1b - c2b) * _k;
  12429. } else {
  12430. var _k2 = void 0;
  12431. if (y > y3) {
  12432. _k2 = 1;
  12433. } else if (y2 === y3) {
  12434. _k2 = 0;
  12435. } else {
  12436. _k2 = (y2 - y) / (y2 - y3);
  12437. }
  12438. xa = x2 - (x2 - x3) * _k2;
  12439. car = c2r - (c2r - c3r) * _k2;
  12440. cag = c2g - (c2g - c3g) * _k2;
  12441. cab = c2b - (c2b - c3b) * _k2;
  12442. }
  12443. var k = void 0;
  12444. if (y < y1) {
  12445. k = 0;
  12446. } else if (y > y3) {
  12447. k = 1;
  12448. } else {
  12449. k = (y1 - y) / (y1 - y3);
  12450. }
  12451. xb = x1 - (x1 - x3) * k;
  12452. cbr = c1r - (c1r - c3r) * k;
  12453. cbg = c1g - (c1g - c3g) * k;
  12454. cbb = c1b - (c1b - c3b) * k;
  12455. var x1_ = Math.round(Math.min(xa, xb));
  12456. var x2_ = Math.round(Math.max(xa, xb));
  12457. var j = rowSize * y + x1_ * 4;
  12458. for (var x = x1_; x <= x2_; x++) {
  12459. k = (xa - x) / (xa - xb);
  12460. if (k < 0) {
  12461. k = 0;
  12462. } else if (k > 1) {
  12463. k = 1;
  12464. }
  12465. bytes[j++] = car - (car - cbr) * k | 0;
  12466. bytes[j++] = cag - (cag - cbg) * k | 0;
  12467. bytes[j++] = cab - (cab - cbb) * k | 0;
  12468. bytes[j++] = 255;
  12469. }
  12470. }
  12471. }
  12472. function drawFigure(data, figure, context) {
  12473. var ps = figure.coords;
  12474. var cs = figure.colors;
  12475. var i, ii;
  12476. switch (figure.type) {
  12477. case "lattice":
  12478. var verticesPerRow = figure.verticesPerRow;
  12479. var rows = Math.floor(ps.length / verticesPerRow) - 1;
  12480. var cols = verticesPerRow - 1;
  12481. for (i = 0; i < rows; i++) {
  12482. var q = i * verticesPerRow;
  12483. for (var j = 0; j < cols; j++, q++) {
  12484. drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
  12485. drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
  12486. }
  12487. }
  12488. break;
  12489. case "triangles":
  12490. for (i = 0, ii = ps.length; i < ii; i += 3) {
  12491. drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
  12492. }
  12493. break;
  12494. default:
  12495. throw new Error("illegal figure");
  12496. }
  12497. }
  12498. var MeshShadingPattern = /*#__PURE__*/function (_BaseShadingPattern2) {
  12499. _inherits(MeshShadingPattern, _BaseShadingPattern2);
  12500. var _super2 = _createSuper(MeshShadingPattern);
  12501. function MeshShadingPattern(IR) {
  12502. var _this2;
  12503. _classCallCheck(this, MeshShadingPattern);
  12504. _this2 = _super2.call(this);
  12505. _this2._coords = IR[2];
  12506. _this2._colors = IR[3];
  12507. _this2._figures = IR[4];
  12508. _this2._bounds = IR[5];
  12509. _this2._bbox = IR[7];
  12510. _this2._background = IR[8];
  12511. _this2.matrix = null;
  12512. return _this2;
  12513. }
  12514. _createClass(MeshShadingPattern, [{
  12515. key: "_createMeshCanvas",
  12516. value: function _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {
  12517. var EXPECTED_SCALE = 1.1;
  12518. var MAX_PATTERN_SIZE = 3000;
  12519. var BORDER_SIZE = 2;
  12520. var offsetX = Math.floor(this._bounds[0]);
  12521. var offsetY = Math.floor(this._bounds[1]);
  12522. var boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
  12523. var boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
  12524. var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
  12525. var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
  12526. var scaleX = boundsWidth / width;
  12527. var scaleY = boundsHeight / height;
  12528. var context = {
  12529. coords: this._coords,
  12530. colors: this._colors,
  12531. offsetX: -offsetX,
  12532. offsetY: -offsetY,
  12533. scaleX: 1 / scaleX,
  12534. scaleY: 1 / scaleY
  12535. };
  12536. var paddedWidth = width + BORDER_SIZE * 2;
  12537. var paddedHeight = height + BORDER_SIZE * 2;
  12538. var tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false);
  12539. var tmpCtx = tmpCanvas.context;
  12540. var data = tmpCtx.createImageData(width, height);
  12541. if (backgroundColor) {
  12542. var bytes = data.data;
  12543. for (var i = 0, ii = bytes.length; i < ii; i += 4) {
  12544. bytes[i] = backgroundColor[0];
  12545. bytes[i + 1] = backgroundColor[1];
  12546. bytes[i + 2] = backgroundColor[2];
  12547. bytes[i + 3] = 255;
  12548. }
  12549. }
  12550. var _iterator2 = _createForOfIteratorHelper(this._figures),
  12551. _step2;
  12552. try {
  12553. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  12554. var figure = _step2.value;
  12555. drawFigure(data, figure, context);
  12556. }
  12557. } catch (err) {
  12558. _iterator2.e(err);
  12559. } finally {
  12560. _iterator2.f();
  12561. }
  12562. tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
  12563. var canvas = tmpCanvas.canvas;
  12564. return {
  12565. canvas: canvas,
  12566. offsetX: offsetX - BORDER_SIZE * scaleX,
  12567. offsetY: offsetY - BORDER_SIZE * scaleY,
  12568. scaleX: scaleX,
  12569. scaleY: scaleY
  12570. };
  12571. }
  12572. }, {
  12573. key: "getPattern",
  12574. value: function getPattern(ctx, owner, inverse, pathType) {
  12575. applyBoundingBox(ctx, this._bbox);
  12576. var scale;
  12577. if (pathType === PathType.SHADING) {
  12578. scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);
  12579. } else {
  12580. scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform);
  12581. if (this.matrix) {
  12582. var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);
  12583. scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
  12584. }
  12585. }
  12586. var temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.cachedCanvases);
  12587. if (pathType !== PathType.SHADING) {
  12588. ctx.setTransform.apply(ctx, owner.baseTransform);
  12589. if (this.matrix) {
  12590. ctx.transform.apply(ctx, this.matrix);
  12591. }
  12592. }
  12593. ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
  12594. ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
  12595. return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
  12596. }
  12597. }]);
  12598. return MeshShadingPattern;
  12599. }(BaseShadingPattern);
  12600. var DummyShadingPattern = /*#__PURE__*/function (_BaseShadingPattern3) {
  12601. _inherits(DummyShadingPattern, _BaseShadingPattern3);
  12602. var _super3 = _createSuper(DummyShadingPattern);
  12603. function DummyShadingPattern() {
  12604. _classCallCheck(this, DummyShadingPattern);
  12605. return _super3.apply(this, arguments);
  12606. }
  12607. _createClass(DummyShadingPattern, [{
  12608. key: "getPattern",
  12609. value: function getPattern() {
  12610. return "hotpink";
  12611. }
  12612. }]);
  12613. return DummyShadingPattern;
  12614. }(BaseShadingPattern);
  12615. function getShadingPattern(IR) {
  12616. switch (IR[0]) {
  12617. case "RadialAxial":
  12618. return new RadialAxialShadingPattern(IR);
  12619. case "Mesh":
  12620. return new MeshShadingPattern(IR);
  12621. case "Dummy":
  12622. return new DummyShadingPattern();
  12623. }
  12624. throw new Error("Unknown IR type: ".concat(IR[0]));
  12625. }
  12626. var PaintType = {
  12627. COLORED: 1,
  12628. UNCOLORED: 2
  12629. };
  12630. var TilingPattern = /*#__PURE__*/function () {
  12631. function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
  12632. _classCallCheck(this, TilingPattern);
  12633. this.operatorList = IR[2];
  12634. this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
  12635. this.bbox = IR[4];
  12636. this.xstep = IR[5];
  12637. this.ystep = IR[6];
  12638. this.paintType = IR[7];
  12639. this.tilingType = IR[8];
  12640. this.color = color;
  12641. this.ctx = ctx;
  12642. this.canvasGraphicsFactory = canvasGraphicsFactory;
  12643. this.baseTransform = baseTransform;
  12644. }
  12645. _createClass(TilingPattern, [{
  12646. key: "createPatternCanvas",
  12647. value: function createPatternCanvas(owner) {
  12648. var operatorList = this.operatorList;
  12649. var bbox = this.bbox;
  12650. var xstep = this.xstep;
  12651. var ystep = this.ystep;
  12652. var paintType = this.paintType;
  12653. var tilingType = this.tilingType;
  12654. var color = this.color;
  12655. var canvasGraphicsFactory = this.canvasGraphicsFactory;
  12656. (0, _util.info)("TilingType: " + tilingType);
  12657. var x0 = bbox[0],
  12658. y0 = bbox[1],
  12659. x1 = bbox[2],
  12660. y1 = bbox[3];
  12661. var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);
  12662. var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform);
  12663. var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];
  12664. var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);
  12665. var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);
  12666. var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true);
  12667. var tmpCtx = tmpCanvas.context;
  12668. var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
  12669. graphics.groupLevel = owner.groupLevel;
  12670. this.setFillAndStrokeStyleToContext(graphics, paintType, color);
  12671. var adjustedX0 = x0;
  12672. var adjustedY0 = y0;
  12673. var adjustedX1 = x1;
  12674. var adjustedY1 = y1;
  12675. if (x0 < 0) {
  12676. adjustedX0 = 0;
  12677. adjustedX1 += Math.abs(x0);
  12678. }
  12679. if (y0 < 0) {
  12680. adjustedY0 = 0;
  12681. adjustedY1 += Math.abs(y0);
  12682. }
  12683. tmpCtx.translate(-(dimx.scale * adjustedX0), -(dimy.scale * adjustedY0));
  12684. graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
  12685. tmpCtx.save();
  12686. this.clipBbox(graphics, adjustedX0, adjustedY0, adjustedX1, adjustedY1);
  12687. graphics.baseTransform = graphics.ctx.mozCurrentTransform.slice();
  12688. graphics.executeOperatorList(operatorList);
  12689. graphics.endDrawing();
  12690. return {
  12691. canvas: tmpCanvas.canvas,
  12692. scaleX: dimx.scale,
  12693. scaleY: dimy.scale,
  12694. offsetX: adjustedX0,
  12695. offsetY: adjustedY0
  12696. };
  12697. }
  12698. }, {
  12699. key: "getSizeAndScale",
  12700. value: function getSizeAndScale(step, realOutputSize, scale) {
  12701. step = Math.abs(step);
  12702. var maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);
  12703. var size = Math.ceil(step * scale);
  12704. if (size >= maxSize) {
  12705. size = maxSize;
  12706. } else {
  12707. scale = size / step;
  12708. }
  12709. return {
  12710. scale: scale,
  12711. size: size
  12712. };
  12713. }
  12714. }, {
  12715. key: "clipBbox",
  12716. value: function clipBbox(graphics, x0, y0, x1, y1) {
  12717. var bboxWidth = x1 - x0;
  12718. var bboxHeight = y1 - y0;
  12719. graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
  12720. graphics.current.updateRectMinMax(graphics.ctx.mozCurrentTransform, [x0, y0, x1, y1]);
  12721. graphics.clip();
  12722. graphics.endPath();
  12723. }
  12724. }, {
  12725. key: "setFillAndStrokeStyleToContext",
  12726. value: function setFillAndStrokeStyleToContext(graphics, paintType, color) {
  12727. var context = graphics.ctx,
  12728. current = graphics.current;
  12729. switch (paintType) {
  12730. case PaintType.COLORED:
  12731. var ctx = this.ctx;
  12732. context.fillStyle = ctx.fillStyle;
  12733. context.strokeStyle = ctx.strokeStyle;
  12734. current.fillColor = ctx.fillStyle;
  12735. current.strokeColor = ctx.strokeStyle;
  12736. break;
  12737. case PaintType.UNCOLORED:
  12738. var cssColor = _util.Util.makeHexColor(color[0], color[1], color[2]);
  12739. context.fillStyle = cssColor;
  12740. context.strokeStyle = cssColor;
  12741. current.fillColor = cssColor;
  12742. current.strokeColor = cssColor;
  12743. break;
  12744. default:
  12745. throw new _util.FormatError("Unsupported paint type: ".concat(paintType));
  12746. }
  12747. }
  12748. }, {
  12749. key: "getPattern",
  12750. value: function getPattern(ctx, owner, inverse, pathType) {
  12751. var matrix = inverse;
  12752. if (pathType !== PathType.SHADING) {
  12753. matrix = _util.Util.transform(matrix, owner.baseTransform);
  12754. if (this.matrix) {
  12755. matrix = _util.Util.transform(matrix, this.matrix);
  12756. }
  12757. }
  12758. var temporaryPatternCanvas = this.createPatternCanvas(owner);
  12759. var domMatrix = new DOMMatrix(matrix);
  12760. domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
  12761. domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);
  12762. var pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
  12763. try {
  12764. pattern.setTransform(domMatrix);
  12765. } catch (ex) {
  12766. (0, _util.warn)("TilingPattern.getPattern: \"".concat(ex === null || ex === void 0 ? void 0 : ex.message, "\"."));
  12767. }
  12768. return pattern;
  12769. }
  12770. }], [{
  12771. key: "MAX_PATTERN_SIZE",
  12772. get: function get() {
  12773. return (0, _util.shadow)(this, "MAX_PATTERN_SIZE", 3000);
  12774. }
  12775. }]);
  12776. return TilingPattern;
  12777. }();
  12778. exports.TilingPattern = TilingPattern;
  12779. /***/ }),
  12780. /* 165 */
  12781. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12782. "use strict";
  12783. Object.defineProperty(exports, "__esModule", ({
  12784. value: true
  12785. }));
  12786. exports.applyMaskImageData = applyMaskImageData;
  12787. var _util = __w_pdfjs_require__(1);
  12788. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  12789. 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."); }
  12790. 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); }
  12791. 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; }
  12792. 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; }
  12793. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  12794. function applyMaskImageData(_ref) {
  12795. var src = _ref.src,
  12796. _ref$srcPos = _ref.srcPos,
  12797. srcPos = _ref$srcPos === void 0 ? 0 : _ref$srcPos,
  12798. dest = _ref.dest,
  12799. _ref$destPos = _ref.destPos,
  12800. destPos = _ref$destPos === void 0 ? 0 : _ref$destPos,
  12801. width = _ref.width,
  12802. height = _ref.height,
  12803. _ref$inverseDecode = _ref.inverseDecode,
  12804. inverseDecode = _ref$inverseDecode === void 0 ? false : _ref$inverseDecode;
  12805. var opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  12806. var _ref2 = !inverseDecode ? [opaque, 0] : [0, opaque],
  12807. _ref3 = _slicedToArray(_ref2, 2),
  12808. zeroMapping = _ref3[0],
  12809. oneMapping = _ref3[1];
  12810. var widthInSource = width >> 3;
  12811. var widthRemainder = width & 7;
  12812. var srcLength = src.length;
  12813. dest = new Uint32Array(dest.buffer);
  12814. for (var i = 0; i < height; i++) {
  12815. for (var max = srcPos + widthInSource; srcPos < max; srcPos++) {
  12816. var _elem = srcPos < srcLength ? src[srcPos] : 255;
  12817. dest[destPos++] = _elem & 128 ? oneMapping : zeroMapping;
  12818. dest[destPos++] = _elem & 64 ? oneMapping : zeroMapping;
  12819. dest[destPos++] = _elem & 32 ? oneMapping : zeroMapping;
  12820. dest[destPos++] = _elem & 16 ? oneMapping : zeroMapping;
  12821. dest[destPos++] = _elem & 8 ? oneMapping : zeroMapping;
  12822. dest[destPos++] = _elem & 4 ? oneMapping : zeroMapping;
  12823. dest[destPos++] = _elem & 2 ? oneMapping : zeroMapping;
  12824. dest[destPos++] = _elem & 1 ? oneMapping : zeroMapping;
  12825. }
  12826. if (widthRemainder === 0) {
  12827. continue;
  12828. }
  12829. var elem = srcPos < srcLength ? src[srcPos++] : 255;
  12830. for (var j = 0; j < widthRemainder; j++) {
  12831. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  12832. }
  12833. }
  12834. return {
  12835. srcPos: srcPos,
  12836. destPos: destPos
  12837. };
  12838. }
  12839. /***/ }),
  12840. /* 166 */
  12841. /***/ ((__unused_webpack_module, exports) => {
  12842. "use strict";
  12843. Object.defineProperty(exports, "__esModule", ({
  12844. value: true
  12845. }));
  12846. exports.GlobalWorkerOptions = void 0;
  12847. var GlobalWorkerOptions = Object.create(null);
  12848. exports.GlobalWorkerOptions = GlobalWorkerOptions;
  12849. GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort;
  12850. GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc;
  12851. /***/ }),
  12852. /* 167 */
  12853. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12854. "use strict";
  12855. Object.defineProperty(exports, "__esModule", ({
  12856. value: true
  12857. }));
  12858. exports.MessageHandler = void 0;
  12859. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  12860. var _util = __w_pdfjs_require__(1);
  12861. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  12862. 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); } }
  12863. 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); }); }; }
  12864. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  12865. 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); } }
  12866. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  12867. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  12868. var CallbackKind = {
  12869. UNKNOWN: 0,
  12870. DATA: 1,
  12871. ERROR: 2
  12872. };
  12873. var StreamKind = {
  12874. UNKNOWN: 0,
  12875. CANCEL: 1,
  12876. CANCEL_COMPLETE: 2,
  12877. CLOSE: 3,
  12878. ENQUEUE: 4,
  12879. ERROR: 5,
  12880. PULL: 6,
  12881. PULL_COMPLETE: 7,
  12882. START_COMPLETE: 8
  12883. };
  12884. function wrapReason(reason) {
  12885. if (!(reason instanceof Error || _typeof(reason) === "object" && reason !== null)) {
  12886. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  12887. }
  12888. switch (reason.name) {
  12889. case "AbortException":
  12890. return new _util.AbortException(reason.message);
  12891. case "MissingPDFException":
  12892. return new _util.MissingPDFException(reason.message);
  12893. case "PasswordException":
  12894. return new _util.PasswordException(reason.message, reason.code);
  12895. case "UnexpectedResponseException":
  12896. return new _util.UnexpectedResponseException(reason.message, reason.status);
  12897. case "UnknownErrorException":
  12898. return new _util.UnknownErrorException(reason.message, reason.details);
  12899. default:
  12900. return new _util.UnknownErrorException(reason.message, reason.toString());
  12901. }
  12902. }
  12903. var MessageHandler = /*#__PURE__*/function () {
  12904. function MessageHandler(sourceName, targetName, comObj) {
  12905. var _this = this;
  12906. _classCallCheck(this, MessageHandler);
  12907. this.sourceName = sourceName;
  12908. this.targetName = targetName;
  12909. this.comObj = comObj;
  12910. this.callbackId = 1;
  12911. this.streamId = 1;
  12912. this.streamSinks = Object.create(null);
  12913. this.streamControllers = Object.create(null);
  12914. this.callbackCapabilities = Object.create(null);
  12915. this.actionHandler = Object.create(null);
  12916. this._onComObjOnMessage = function (event) {
  12917. var data = event.data;
  12918. if (data.targetName !== _this.sourceName) {
  12919. return;
  12920. }
  12921. if (data.stream) {
  12922. _this._processStreamMessage(data);
  12923. return;
  12924. }
  12925. if (data.callback) {
  12926. var callbackId = data.callbackId;
  12927. var capability = _this.callbackCapabilities[callbackId];
  12928. if (!capability) {
  12929. throw new Error("Cannot resolve callback ".concat(callbackId));
  12930. }
  12931. delete _this.callbackCapabilities[callbackId];
  12932. if (data.callback === CallbackKind.DATA) {
  12933. capability.resolve(data.data);
  12934. } else if (data.callback === CallbackKind.ERROR) {
  12935. capability.reject(wrapReason(data.reason));
  12936. } else {
  12937. throw new Error("Unexpected callback case");
  12938. }
  12939. return;
  12940. }
  12941. var action = _this.actionHandler[data.action];
  12942. if (!action) {
  12943. throw new Error("Unknown action from worker: ".concat(data.action));
  12944. }
  12945. if (data.callbackId) {
  12946. var cbSourceName = _this.sourceName;
  12947. var cbTargetName = data.sourceName;
  12948. new Promise(function (resolve) {
  12949. resolve(action(data.data));
  12950. }).then(function (result) {
  12951. comObj.postMessage({
  12952. sourceName: cbSourceName,
  12953. targetName: cbTargetName,
  12954. callback: CallbackKind.DATA,
  12955. callbackId: data.callbackId,
  12956. data: result
  12957. });
  12958. }, function (reason) {
  12959. comObj.postMessage({
  12960. sourceName: cbSourceName,
  12961. targetName: cbTargetName,
  12962. callback: CallbackKind.ERROR,
  12963. callbackId: data.callbackId,
  12964. reason: wrapReason(reason)
  12965. });
  12966. });
  12967. return;
  12968. }
  12969. if (data.streamId) {
  12970. _this._createStreamSink(data);
  12971. return;
  12972. }
  12973. action(data.data);
  12974. };
  12975. comObj.addEventListener("message", this._onComObjOnMessage);
  12976. }
  12977. _createClass(MessageHandler, [{
  12978. key: "on",
  12979. value: function on(actionName, handler) {
  12980. var ah = this.actionHandler;
  12981. if (ah[actionName]) {
  12982. throw new Error("There is already an actionName called \"".concat(actionName, "\""));
  12983. }
  12984. ah[actionName] = handler;
  12985. }
  12986. }, {
  12987. key: "send",
  12988. value: function send(actionName, data, transfers) {
  12989. this.comObj.postMessage({
  12990. sourceName: this.sourceName,
  12991. targetName: this.targetName,
  12992. action: actionName,
  12993. data: data
  12994. }, transfers);
  12995. }
  12996. }, {
  12997. key: "sendWithPromise",
  12998. value: function sendWithPromise(actionName, data, transfers) {
  12999. var callbackId = this.callbackId++;
  13000. var capability = (0, _util.createPromiseCapability)();
  13001. this.callbackCapabilities[callbackId] = capability;
  13002. try {
  13003. this.comObj.postMessage({
  13004. sourceName: this.sourceName,
  13005. targetName: this.targetName,
  13006. action: actionName,
  13007. callbackId: callbackId,
  13008. data: data
  13009. }, transfers);
  13010. } catch (ex) {
  13011. capability.reject(ex);
  13012. }
  13013. return capability.promise;
  13014. }
  13015. }, {
  13016. key: "sendWithStream",
  13017. value: function sendWithStream(actionName, data, queueingStrategy, transfers) {
  13018. var _this2 = this;
  13019. var streamId = this.streamId++,
  13020. sourceName = this.sourceName,
  13021. targetName = this.targetName,
  13022. comObj = this.comObj;
  13023. return new ReadableStream({
  13024. start: function start(controller) {
  13025. var startCapability = (0, _util.createPromiseCapability)();
  13026. _this2.streamControllers[streamId] = {
  13027. controller: controller,
  13028. startCall: startCapability,
  13029. pullCall: null,
  13030. cancelCall: null,
  13031. isClosed: false
  13032. };
  13033. comObj.postMessage({
  13034. sourceName: sourceName,
  13035. targetName: targetName,
  13036. action: actionName,
  13037. streamId: streamId,
  13038. data: data,
  13039. desiredSize: controller.desiredSize
  13040. }, transfers);
  13041. return startCapability.promise;
  13042. },
  13043. pull: function pull(controller) {
  13044. var pullCapability = (0, _util.createPromiseCapability)();
  13045. _this2.streamControllers[streamId].pullCall = pullCapability;
  13046. comObj.postMessage({
  13047. sourceName: sourceName,
  13048. targetName: targetName,
  13049. stream: StreamKind.PULL,
  13050. streamId: streamId,
  13051. desiredSize: controller.desiredSize
  13052. });
  13053. return pullCapability.promise;
  13054. },
  13055. cancel: function cancel(reason) {
  13056. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  13057. var cancelCapability = (0, _util.createPromiseCapability)();
  13058. _this2.streamControllers[streamId].cancelCall = cancelCapability;
  13059. _this2.streamControllers[streamId].isClosed = true;
  13060. comObj.postMessage({
  13061. sourceName: sourceName,
  13062. targetName: targetName,
  13063. stream: StreamKind.CANCEL,
  13064. streamId: streamId,
  13065. reason: wrapReason(reason)
  13066. });
  13067. return cancelCapability.promise;
  13068. }
  13069. }, queueingStrategy);
  13070. }
  13071. }, {
  13072. key: "_createStreamSink",
  13073. value: function _createStreamSink(data) {
  13074. var streamId = data.streamId,
  13075. sourceName = this.sourceName,
  13076. targetName = data.sourceName,
  13077. comObj = this.comObj;
  13078. var self = this,
  13079. action = this.actionHandler[data.action];
  13080. var streamSink = {
  13081. enqueue: function enqueue(chunk) {
  13082. var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  13083. var transfers = arguments.length > 2 ? arguments[2] : undefined;
  13084. if (this.isCancelled) {
  13085. return;
  13086. }
  13087. var lastDesiredSize = this.desiredSize;
  13088. this.desiredSize -= size;
  13089. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  13090. this.sinkCapability = (0, _util.createPromiseCapability)();
  13091. this.ready = this.sinkCapability.promise;
  13092. }
  13093. comObj.postMessage({
  13094. sourceName: sourceName,
  13095. targetName: targetName,
  13096. stream: StreamKind.ENQUEUE,
  13097. streamId: streamId,
  13098. chunk: chunk
  13099. }, transfers);
  13100. },
  13101. close: function close() {
  13102. if (this.isCancelled) {
  13103. return;
  13104. }
  13105. this.isCancelled = true;
  13106. comObj.postMessage({
  13107. sourceName: sourceName,
  13108. targetName: targetName,
  13109. stream: StreamKind.CLOSE,
  13110. streamId: streamId
  13111. });
  13112. delete self.streamSinks[streamId];
  13113. },
  13114. error: function error(reason) {
  13115. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  13116. if (this.isCancelled) {
  13117. return;
  13118. }
  13119. this.isCancelled = true;
  13120. comObj.postMessage({
  13121. sourceName: sourceName,
  13122. targetName: targetName,
  13123. stream: StreamKind.ERROR,
  13124. streamId: streamId,
  13125. reason: wrapReason(reason)
  13126. });
  13127. },
  13128. sinkCapability: (0, _util.createPromiseCapability)(),
  13129. onPull: null,
  13130. onCancel: null,
  13131. isCancelled: false,
  13132. desiredSize: data.desiredSize,
  13133. ready: null
  13134. };
  13135. streamSink.sinkCapability.resolve();
  13136. streamSink.ready = streamSink.sinkCapability.promise;
  13137. this.streamSinks[streamId] = streamSink;
  13138. new Promise(function (resolve) {
  13139. resolve(action(data.data, streamSink));
  13140. }).then(function () {
  13141. comObj.postMessage({
  13142. sourceName: sourceName,
  13143. targetName: targetName,
  13144. stream: StreamKind.START_COMPLETE,
  13145. streamId: streamId,
  13146. success: true
  13147. });
  13148. }, function (reason) {
  13149. comObj.postMessage({
  13150. sourceName: sourceName,
  13151. targetName: targetName,
  13152. stream: StreamKind.START_COMPLETE,
  13153. streamId: streamId,
  13154. reason: wrapReason(reason)
  13155. });
  13156. });
  13157. }
  13158. }, {
  13159. key: "_processStreamMessage",
  13160. value: function _processStreamMessage(data) {
  13161. var streamId = data.streamId,
  13162. sourceName = this.sourceName,
  13163. targetName = data.sourceName,
  13164. comObj = this.comObj;
  13165. var streamController = this.streamControllers[streamId],
  13166. streamSink = this.streamSinks[streamId];
  13167. switch (data.stream) {
  13168. case StreamKind.START_COMPLETE:
  13169. if (data.success) {
  13170. streamController.startCall.resolve();
  13171. } else {
  13172. streamController.startCall.reject(wrapReason(data.reason));
  13173. }
  13174. break;
  13175. case StreamKind.PULL_COMPLETE:
  13176. if (data.success) {
  13177. streamController.pullCall.resolve();
  13178. } else {
  13179. streamController.pullCall.reject(wrapReason(data.reason));
  13180. }
  13181. break;
  13182. case StreamKind.PULL:
  13183. if (!streamSink) {
  13184. comObj.postMessage({
  13185. sourceName: sourceName,
  13186. targetName: targetName,
  13187. stream: StreamKind.PULL_COMPLETE,
  13188. streamId: streamId,
  13189. success: true
  13190. });
  13191. break;
  13192. }
  13193. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  13194. streamSink.sinkCapability.resolve();
  13195. }
  13196. streamSink.desiredSize = data.desiredSize;
  13197. new Promise(function (resolve) {
  13198. resolve(streamSink.onPull && streamSink.onPull());
  13199. }).then(function () {
  13200. comObj.postMessage({
  13201. sourceName: sourceName,
  13202. targetName: targetName,
  13203. stream: StreamKind.PULL_COMPLETE,
  13204. streamId: streamId,
  13205. success: true
  13206. });
  13207. }, function (reason) {
  13208. comObj.postMessage({
  13209. sourceName: sourceName,
  13210. targetName: targetName,
  13211. stream: StreamKind.PULL_COMPLETE,
  13212. streamId: streamId,
  13213. reason: wrapReason(reason)
  13214. });
  13215. });
  13216. break;
  13217. case StreamKind.ENQUEUE:
  13218. (0, _util.assert)(streamController, "enqueue should have stream controller");
  13219. if (streamController.isClosed) {
  13220. break;
  13221. }
  13222. streamController.controller.enqueue(data.chunk);
  13223. break;
  13224. case StreamKind.CLOSE:
  13225. (0, _util.assert)(streamController, "close should have stream controller");
  13226. if (streamController.isClosed) {
  13227. break;
  13228. }
  13229. streamController.isClosed = true;
  13230. streamController.controller.close();
  13231. this._deleteStreamController(streamController, streamId);
  13232. break;
  13233. case StreamKind.ERROR:
  13234. (0, _util.assert)(streamController, "error should have stream controller");
  13235. streamController.controller.error(wrapReason(data.reason));
  13236. this._deleteStreamController(streamController, streamId);
  13237. break;
  13238. case StreamKind.CANCEL_COMPLETE:
  13239. if (data.success) {
  13240. streamController.cancelCall.resolve();
  13241. } else {
  13242. streamController.cancelCall.reject(wrapReason(data.reason));
  13243. }
  13244. this._deleteStreamController(streamController, streamId);
  13245. break;
  13246. case StreamKind.CANCEL:
  13247. if (!streamSink) {
  13248. break;
  13249. }
  13250. new Promise(function (resolve) {
  13251. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  13252. }).then(function () {
  13253. comObj.postMessage({
  13254. sourceName: sourceName,
  13255. targetName: targetName,
  13256. stream: StreamKind.CANCEL_COMPLETE,
  13257. streamId: streamId,
  13258. success: true
  13259. });
  13260. }, function (reason) {
  13261. comObj.postMessage({
  13262. sourceName: sourceName,
  13263. targetName: targetName,
  13264. stream: StreamKind.CANCEL_COMPLETE,
  13265. streamId: streamId,
  13266. reason: wrapReason(reason)
  13267. });
  13268. });
  13269. streamSink.sinkCapability.reject(wrapReason(data.reason));
  13270. streamSink.isCancelled = true;
  13271. delete this.streamSinks[streamId];
  13272. break;
  13273. default:
  13274. throw new Error("Unexpected stream case");
  13275. }
  13276. }
  13277. }, {
  13278. key: "_deleteStreamController",
  13279. value: function () {
  13280. var _deleteStreamController2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(streamController, streamId) {
  13281. return _regenerator["default"].wrap(function _callee$(_context) {
  13282. while (1) {
  13283. switch (_context.prev = _context.next) {
  13284. case 0:
  13285. _context.next = 2;
  13286. return Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  13287. case 2:
  13288. delete this.streamControllers[streamId];
  13289. case 3:
  13290. case "end":
  13291. return _context.stop();
  13292. }
  13293. }
  13294. }, _callee, this);
  13295. }));
  13296. function _deleteStreamController(_x, _x2) {
  13297. return _deleteStreamController2.apply(this, arguments);
  13298. }
  13299. return _deleteStreamController;
  13300. }()
  13301. }, {
  13302. key: "destroy",
  13303. value: function destroy() {
  13304. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  13305. }
  13306. }]);
  13307. return MessageHandler;
  13308. }();
  13309. exports.MessageHandler = MessageHandler;
  13310. /***/ }),
  13311. /* 168 */
  13312. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13313. "use strict";
  13314. Object.defineProperty(exports, "__esModule", ({
  13315. value: true
  13316. }));
  13317. exports.Metadata = void 0;
  13318. var _util = __w_pdfjs_require__(1);
  13319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13320. 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); } }
  13321. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  13322. function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
  13323. function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
  13324. function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
  13325. function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
  13326. function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
  13327. function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
  13328. 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; } }
  13329. var _metadataMap = /*#__PURE__*/new WeakMap();
  13330. var _data = /*#__PURE__*/new WeakMap();
  13331. var Metadata = /*#__PURE__*/function () {
  13332. function Metadata(_ref) {
  13333. var parsedData = _ref.parsedData,
  13334. rawData = _ref.rawData;
  13335. _classCallCheck(this, Metadata);
  13336. _classPrivateFieldInitSpec(this, _metadataMap, {
  13337. writable: true,
  13338. value: void 0
  13339. });
  13340. _classPrivateFieldInitSpec(this, _data, {
  13341. writable: true,
  13342. value: void 0
  13343. });
  13344. _classPrivateFieldSet(this, _metadataMap, parsedData);
  13345. _classPrivateFieldSet(this, _data, rawData);
  13346. }
  13347. _createClass(Metadata, [{
  13348. key: "getRaw",
  13349. value: function getRaw() {
  13350. return _classPrivateFieldGet(this, _data);
  13351. }
  13352. }, {
  13353. key: "get",
  13354. value: function get(name) {
  13355. var _classPrivateFieldGet2;
  13356. return (_classPrivateFieldGet2 = _classPrivateFieldGet(this, _metadataMap).get(name)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : null;
  13357. }
  13358. }, {
  13359. key: "getAll",
  13360. value: function getAll() {
  13361. return (0, _util.objectFromMap)(_classPrivateFieldGet(this, _metadataMap));
  13362. }
  13363. }, {
  13364. key: "has",
  13365. value: function has(name) {
  13366. return _classPrivateFieldGet(this, _metadataMap).has(name);
  13367. }
  13368. }]);
  13369. return Metadata;
  13370. }();
  13371. exports.Metadata = Metadata;
  13372. /***/ }),
  13373. /* 169 */
  13374. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13375. "use strict";
  13376. Object.defineProperty(exports, "__esModule", ({
  13377. value: true
  13378. }));
  13379. exports.OptionalContentConfig = void 0;
  13380. var _util = __w_pdfjs_require__(1);
  13381. 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; } } }; }
  13382. 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); }
  13383. 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; }
  13384. 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); } }
  13385. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  13386. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13387. var OptionalContentGroup = /*#__PURE__*/_createClass(function OptionalContentGroup(name, intent) {
  13388. _classCallCheck(this, OptionalContentGroup);
  13389. this.visible = true;
  13390. this.name = name;
  13391. this.intent = intent;
  13392. });
  13393. var OptionalContentConfig = /*#__PURE__*/function () {
  13394. function OptionalContentConfig(data) {
  13395. _classCallCheck(this, OptionalContentConfig);
  13396. this.name = null;
  13397. this.creator = null;
  13398. this._order = null;
  13399. this._groups = new Map();
  13400. if (data === null) {
  13401. return;
  13402. }
  13403. this.name = data.name;
  13404. this.creator = data.creator;
  13405. this._order = data.order;
  13406. var _iterator = _createForOfIteratorHelper(data.groups),
  13407. _step;
  13408. try {
  13409. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  13410. var _group = _step.value;
  13411. this._groups.set(_group.id, new OptionalContentGroup(_group.name, _group.intent));
  13412. }
  13413. } catch (err) {
  13414. _iterator.e(err);
  13415. } finally {
  13416. _iterator.f();
  13417. }
  13418. if (data.baseState === "OFF") {
  13419. var _iterator2 = _createForOfIteratorHelper(this._groups),
  13420. _step2;
  13421. try {
  13422. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  13423. var group = _step2.value;
  13424. group.visible = false;
  13425. }
  13426. } catch (err) {
  13427. _iterator2.e(err);
  13428. } finally {
  13429. _iterator2.f();
  13430. }
  13431. }
  13432. var _iterator3 = _createForOfIteratorHelper(data.on),
  13433. _step3;
  13434. try {
  13435. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  13436. var on = _step3.value;
  13437. this._groups.get(on).visible = true;
  13438. }
  13439. } catch (err) {
  13440. _iterator3.e(err);
  13441. } finally {
  13442. _iterator3.f();
  13443. }
  13444. var _iterator4 = _createForOfIteratorHelper(data.off),
  13445. _step4;
  13446. try {
  13447. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  13448. var off = _step4.value;
  13449. this._groups.get(off).visible = false;
  13450. }
  13451. } catch (err) {
  13452. _iterator4.e(err);
  13453. } finally {
  13454. _iterator4.f();
  13455. }
  13456. }
  13457. _createClass(OptionalContentConfig, [{
  13458. key: "_evaluateVisibilityExpression",
  13459. value: function _evaluateVisibilityExpression(array) {
  13460. var length = array.length;
  13461. if (length < 2) {
  13462. return true;
  13463. }
  13464. var operator = array[0];
  13465. for (var i = 1; i < length; i++) {
  13466. var element = array[i];
  13467. var state = void 0;
  13468. if (Array.isArray(element)) {
  13469. state = this._evaluateVisibilityExpression(element);
  13470. } else if (this._groups.has(element)) {
  13471. state = this._groups.get(element).visible;
  13472. } else {
  13473. (0, _util.warn)("Optional content group not found: ".concat(element));
  13474. return true;
  13475. }
  13476. switch (operator) {
  13477. case "And":
  13478. if (!state) {
  13479. return false;
  13480. }
  13481. break;
  13482. case "Or":
  13483. if (state) {
  13484. return true;
  13485. }
  13486. break;
  13487. case "Not":
  13488. return !state;
  13489. default:
  13490. return true;
  13491. }
  13492. }
  13493. return operator === "And";
  13494. }
  13495. }, {
  13496. key: "isVisible",
  13497. value: function isVisible(group) {
  13498. if (this._groups.size === 0) {
  13499. return true;
  13500. }
  13501. if (!group) {
  13502. (0, _util.warn)("Optional content group not defined.");
  13503. return true;
  13504. }
  13505. if (group.type === "OCG") {
  13506. if (!this._groups.has(group.id)) {
  13507. (0, _util.warn)("Optional content group not found: ".concat(group.id));
  13508. return true;
  13509. }
  13510. return this._groups.get(group.id).visible;
  13511. } else if (group.type === "OCMD") {
  13512. if (group.expression) {
  13513. return this._evaluateVisibilityExpression(group.expression);
  13514. }
  13515. if (!group.policy || group.policy === "AnyOn") {
  13516. var _iterator5 = _createForOfIteratorHelper(group.ids),
  13517. _step5;
  13518. try {
  13519. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  13520. var id = _step5.value;
  13521. if (!this._groups.has(id)) {
  13522. (0, _util.warn)("Optional content group not found: ".concat(id));
  13523. return true;
  13524. }
  13525. if (this._groups.get(id).visible) {
  13526. return true;
  13527. }
  13528. }
  13529. } catch (err) {
  13530. _iterator5.e(err);
  13531. } finally {
  13532. _iterator5.f();
  13533. }
  13534. return false;
  13535. } else if (group.policy === "AllOn") {
  13536. var _iterator6 = _createForOfIteratorHelper(group.ids),
  13537. _step6;
  13538. try {
  13539. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  13540. var _id = _step6.value;
  13541. if (!this._groups.has(_id)) {
  13542. (0, _util.warn)("Optional content group not found: ".concat(_id));
  13543. return true;
  13544. }
  13545. if (!this._groups.get(_id).visible) {
  13546. return false;
  13547. }
  13548. }
  13549. } catch (err) {
  13550. _iterator6.e(err);
  13551. } finally {
  13552. _iterator6.f();
  13553. }
  13554. return true;
  13555. } else if (group.policy === "AnyOff") {
  13556. var _iterator7 = _createForOfIteratorHelper(group.ids),
  13557. _step7;
  13558. try {
  13559. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  13560. var _id2 = _step7.value;
  13561. if (!this._groups.has(_id2)) {
  13562. (0, _util.warn)("Optional content group not found: ".concat(_id2));
  13563. return true;
  13564. }
  13565. if (!this._groups.get(_id2).visible) {
  13566. return true;
  13567. }
  13568. }
  13569. } catch (err) {
  13570. _iterator7.e(err);
  13571. } finally {
  13572. _iterator7.f();
  13573. }
  13574. return false;
  13575. } else if (group.policy === "AllOff") {
  13576. var _iterator8 = _createForOfIteratorHelper(group.ids),
  13577. _step8;
  13578. try {
  13579. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  13580. var _id3 = _step8.value;
  13581. if (!this._groups.has(_id3)) {
  13582. (0, _util.warn)("Optional content group not found: ".concat(_id3));
  13583. return true;
  13584. }
  13585. if (this._groups.get(_id3).visible) {
  13586. return false;
  13587. }
  13588. }
  13589. } catch (err) {
  13590. _iterator8.e(err);
  13591. } finally {
  13592. _iterator8.f();
  13593. }
  13594. return true;
  13595. }
  13596. (0, _util.warn)("Unknown optional content policy ".concat(group.policy, "."));
  13597. return true;
  13598. }
  13599. (0, _util.warn)("Unknown group type ".concat(group.type, "."));
  13600. return true;
  13601. }
  13602. }, {
  13603. key: "setVisibility",
  13604. value: function setVisibility(id) {
  13605. var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  13606. if (!this._groups.has(id)) {
  13607. (0, _util.warn)("Optional content group not found: ".concat(id));
  13608. return;
  13609. }
  13610. this._groups.get(id).visible = !!visible;
  13611. }
  13612. }, {
  13613. key: "getOrder",
  13614. value: function getOrder() {
  13615. if (!this._groups.size) {
  13616. return null;
  13617. }
  13618. if (this._order) {
  13619. return this._order.slice();
  13620. }
  13621. return Array.from(this._groups.keys());
  13622. }
  13623. }, {
  13624. key: "getGroups",
  13625. value: function getGroups() {
  13626. return this._groups.size > 0 ? (0, _util.objectFromMap)(this._groups) : null;
  13627. }
  13628. }, {
  13629. key: "getGroup",
  13630. value: function getGroup(id) {
  13631. return this._groups.get(id) || null;
  13632. }
  13633. }]);
  13634. return OptionalContentConfig;
  13635. }();
  13636. exports.OptionalContentConfig = OptionalContentConfig;
  13637. /***/ }),
  13638. /* 170 */
  13639. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13640. "use strict";
  13641. Object.defineProperty(exports, "__esModule", ({
  13642. value: true
  13643. }));
  13644. exports.PDFDataTransportStream = void 0;
  13645. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  13646. var _util = __w_pdfjs_require__(1);
  13647. var _display_utils = __w_pdfjs_require__(158);
  13648. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13649. 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); } }
  13650. 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); }); }; }
  13651. 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; } } }; }
  13652. 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); }
  13653. 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; }
  13654. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13655. 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); } }
  13656. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  13657. var PDFDataTransportStream = /*#__PURE__*/function () {
  13658. function PDFDataTransportStream(params, pdfDataRangeTransport) {
  13659. var _this = this;
  13660. _classCallCheck(this, PDFDataTransportStream);
  13661. (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
  13662. this._queuedChunks = [];
  13663. this._progressiveDone = params.progressiveDone || false;
  13664. this._contentDispositionFilename = params.contentDispositionFilename || null;
  13665. var initialData = params.initialData;
  13666. if ((initialData === null || initialData === void 0 ? void 0 : initialData.length) > 0) {
  13667. var buffer = new Uint8Array(initialData).buffer;
  13668. this._queuedChunks.push(buffer);
  13669. }
  13670. this._pdfDataRangeTransport = pdfDataRangeTransport;
  13671. this._isStreamingSupported = !params.disableStream;
  13672. this._isRangeSupported = !params.disableRange;
  13673. this._contentLength = params.length;
  13674. this._fullRequestReader = null;
  13675. this._rangeReaders = [];
  13676. this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
  13677. _this._onReceiveData({
  13678. begin: begin,
  13679. chunk: chunk
  13680. });
  13681. });
  13682. this._pdfDataRangeTransport.addProgressListener(function (loaded, total) {
  13683. _this._onProgress({
  13684. loaded: loaded,
  13685. total: total
  13686. });
  13687. });
  13688. this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
  13689. _this._onReceiveData({
  13690. chunk: chunk
  13691. });
  13692. });
  13693. this._pdfDataRangeTransport.addProgressiveDoneListener(function () {
  13694. _this._onProgressiveDone();
  13695. });
  13696. this._pdfDataRangeTransport.transportReady();
  13697. }
  13698. _createClass(PDFDataTransportStream, [{
  13699. key: "_onReceiveData",
  13700. value: function _onReceiveData(args) {
  13701. var buffer = new Uint8Array(args.chunk).buffer;
  13702. if (args.begin === undefined) {
  13703. if (this._fullRequestReader) {
  13704. this._fullRequestReader._enqueue(buffer);
  13705. } else {
  13706. this._queuedChunks.push(buffer);
  13707. }
  13708. } else {
  13709. var found = this._rangeReaders.some(function (rangeReader) {
  13710. if (rangeReader._begin !== args.begin) {
  13711. return false;
  13712. }
  13713. rangeReader._enqueue(buffer);
  13714. return true;
  13715. });
  13716. (0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
  13717. }
  13718. }
  13719. }, {
  13720. key: "_progressiveDataLength",
  13721. get: function get() {
  13722. var _this$_fullRequestRea, _this$_fullRequestRea2;
  13723. return (_this$_fullRequestRea = (_this$_fullRequestRea2 = this._fullRequestReader) === null || _this$_fullRequestRea2 === void 0 ? void 0 : _this$_fullRequestRea2._loaded) !== null && _this$_fullRequestRea !== void 0 ? _this$_fullRequestRea : 0;
  13724. }
  13725. }, {
  13726. key: "_onProgress",
  13727. value: function _onProgress(evt) {
  13728. if (evt.total === undefined) {
  13729. var firstReader = this._rangeReaders[0];
  13730. if (firstReader !== null && firstReader !== void 0 && firstReader.onProgress) {
  13731. firstReader.onProgress({
  13732. loaded: evt.loaded
  13733. });
  13734. }
  13735. } else {
  13736. var fullReader = this._fullRequestReader;
  13737. if (fullReader !== null && fullReader !== void 0 && fullReader.onProgress) {
  13738. fullReader.onProgress({
  13739. loaded: evt.loaded,
  13740. total: evt.total
  13741. });
  13742. }
  13743. }
  13744. }
  13745. }, {
  13746. key: "_onProgressiveDone",
  13747. value: function _onProgressiveDone() {
  13748. if (this._fullRequestReader) {
  13749. this._fullRequestReader.progressiveDone();
  13750. }
  13751. this._progressiveDone = true;
  13752. }
  13753. }, {
  13754. key: "_removeRangeReader",
  13755. value: function _removeRangeReader(reader) {
  13756. var i = this._rangeReaders.indexOf(reader);
  13757. if (i >= 0) {
  13758. this._rangeReaders.splice(i, 1);
  13759. }
  13760. }
  13761. }, {
  13762. key: "getFullReader",
  13763. value: function getFullReader() {
  13764. (0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
  13765. var queuedChunks = this._queuedChunks;
  13766. this._queuedChunks = null;
  13767. return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone, this._contentDispositionFilename);
  13768. }
  13769. }, {
  13770. key: "getRangeReader",
  13771. value: function getRangeReader(begin, end) {
  13772. if (end <= this._progressiveDataLength) {
  13773. return null;
  13774. }
  13775. var reader = new PDFDataTransportStreamRangeReader(this, begin, end);
  13776. this._pdfDataRangeTransport.requestDataRange(begin, end);
  13777. this._rangeReaders.push(reader);
  13778. return reader;
  13779. }
  13780. }, {
  13781. key: "cancelAllRequests",
  13782. value: function cancelAllRequests(reason) {
  13783. if (this._fullRequestReader) {
  13784. this._fullRequestReader.cancel(reason);
  13785. }
  13786. var _iterator = _createForOfIteratorHelper(this._rangeReaders.slice(0)),
  13787. _step;
  13788. try {
  13789. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  13790. var reader = _step.value;
  13791. reader.cancel(reason);
  13792. }
  13793. } catch (err) {
  13794. _iterator.e(err);
  13795. } finally {
  13796. _iterator.f();
  13797. }
  13798. this._pdfDataRangeTransport.abort();
  13799. }
  13800. }]);
  13801. return PDFDataTransportStream;
  13802. }();
  13803. exports.PDFDataTransportStream = PDFDataTransportStream;
  13804. var PDFDataTransportStreamReader = /*#__PURE__*/function () {
  13805. function PDFDataTransportStreamReader(stream, queuedChunks) {
  13806. var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  13807. var contentDispositionFilename = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  13808. _classCallCheck(this, PDFDataTransportStreamReader);
  13809. this._stream = stream;
  13810. this._done = progressiveDone || false;
  13811. this._filename = (0, _display_utils.isPdfFile)(contentDispositionFilename) ? contentDispositionFilename : null;
  13812. this._queuedChunks = queuedChunks || [];
  13813. this._loaded = 0;
  13814. var _iterator2 = _createForOfIteratorHelper(this._queuedChunks),
  13815. _step2;
  13816. try {
  13817. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  13818. var chunk = _step2.value;
  13819. this._loaded += chunk.byteLength;
  13820. }
  13821. } catch (err) {
  13822. _iterator2.e(err);
  13823. } finally {
  13824. _iterator2.f();
  13825. }
  13826. this._requests = [];
  13827. this._headersReady = Promise.resolve();
  13828. stream._fullRequestReader = this;
  13829. this.onProgress = null;
  13830. }
  13831. _createClass(PDFDataTransportStreamReader, [{
  13832. key: "_enqueue",
  13833. value: function _enqueue(chunk) {
  13834. if (this._done) {
  13835. return;
  13836. }
  13837. if (this._requests.length > 0) {
  13838. var requestCapability = this._requests.shift();
  13839. requestCapability.resolve({
  13840. value: chunk,
  13841. done: false
  13842. });
  13843. } else {
  13844. this._queuedChunks.push(chunk);
  13845. }
  13846. this._loaded += chunk.byteLength;
  13847. }
  13848. }, {
  13849. key: "headersReady",
  13850. get: function get() {
  13851. return this._headersReady;
  13852. }
  13853. }, {
  13854. key: "filename",
  13855. get: function get() {
  13856. return this._filename;
  13857. }
  13858. }, {
  13859. key: "isRangeSupported",
  13860. get: function get() {
  13861. return this._stream._isRangeSupported;
  13862. }
  13863. }, {
  13864. key: "isStreamingSupported",
  13865. get: function get() {
  13866. return this._stream._isStreamingSupported;
  13867. }
  13868. }, {
  13869. key: "contentLength",
  13870. get: function get() {
  13871. return this._stream._contentLength;
  13872. }
  13873. }, {
  13874. key: "read",
  13875. value: function () {
  13876. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  13877. var chunk, requestCapability;
  13878. return _regenerator["default"].wrap(function _callee$(_context) {
  13879. while (1) {
  13880. switch (_context.prev = _context.next) {
  13881. case 0:
  13882. if (!(this._queuedChunks.length > 0)) {
  13883. _context.next = 3;
  13884. break;
  13885. }
  13886. chunk = this._queuedChunks.shift();
  13887. return _context.abrupt("return", {
  13888. value: chunk,
  13889. done: false
  13890. });
  13891. case 3:
  13892. if (!this._done) {
  13893. _context.next = 5;
  13894. break;
  13895. }
  13896. return _context.abrupt("return", {
  13897. value: undefined,
  13898. done: true
  13899. });
  13900. case 5:
  13901. requestCapability = (0, _util.createPromiseCapability)();
  13902. this._requests.push(requestCapability);
  13903. return _context.abrupt("return", requestCapability.promise);
  13904. case 8:
  13905. case "end":
  13906. return _context.stop();
  13907. }
  13908. }
  13909. }, _callee, this);
  13910. }));
  13911. function read() {
  13912. return _read.apply(this, arguments);
  13913. }
  13914. return read;
  13915. }()
  13916. }, {
  13917. key: "cancel",
  13918. value: function cancel(reason) {
  13919. this._done = true;
  13920. var _iterator3 = _createForOfIteratorHelper(this._requests),
  13921. _step3;
  13922. try {
  13923. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  13924. var requestCapability = _step3.value;
  13925. requestCapability.resolve({
  13926. value: undefined,
  13927. done: true
  13928. });
  13929. }
  13930. } catch (err) {
  13931. _iterator3.e(err);
  13932. } finally {
  13933. _iterator3.f();
  13934. }
  13935. this._requests.length = 0;
  13936. }
  13937. }, {
  13938. key: "progressiveDone",
  13939. value: function progressiveDone() {
  13940. if (this._done) {
  13941. return;
  13942. }
  13943. this._done = true;
  13944. }
  13945. }]);
  13946. return PDFDataTransportStreamReader;
  13947. }();
  13948. var PDFDataTransportStreamRangeReader = /*#__PURE__*/function () {
  13949. function PDFDataTransportStreamRangeReader(stream, begin, end) {
  13950. _classCallCheck(this, PDFDataTransportStreamRangeReader);
  13951. this._stream = stream;
  13952. this._begin = begin;
  13953. this._end = end;
  13954. this._queuedChunk = null;
  13955. this._requests = [];
  13956. this._done = false;
  13957. this.onProgress = null;
  13958. }
  13959. _createClass(PDFDataTransportStreamRangeReader, [{
  13960. key: "_enqueue",
  13961. value: function _enqueue(chunk) {
  13962. if (this._done) {
  13963. return;
  13964. }
  13965. if (this._requests.length === 0) {
  13966. this._queuedChunk = chunk;
  13967. } else {
  13968. var requestsCapability = this._requests.shift();
  13969. requestsCapability.resolve({
  13970. value: chunk,
  13971. done: false
  13972. });
  13973. var _iterator4 = _createForOfIteratorHelper(this._requests),
  13974. _step4;
  13975. try {
  13976. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  13977. var requestCapability = _step4.value;
  13978. requestCapability.resolve({
  13979. value: undefined,
  13980. done: true
  13981. });
  13982. }
  13983. } catch (err) {
  13984. _iterator4.e(err);
  13985. } finally {
  13986. _iterator4.f();
  13987. }
  13988. this._requests.length = 0;
  13989. }
  13990. this._done = true;
  13991. this._stream._removeRangeReader(this);
  13992. }
  13993. }, {
  13994. key: "isStreamingSupported",
  13995. get: function get() {
  13996. return false;
  13997. }
  13998. }, {
  13999. key: "read",
  14000. value: function () {
  14001. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  14002. var chunk, requestCapability;
  14003. return _regenerator["default"].wrap(function _callee2$(_context2) {
  14004. while (1) {
  14005. switch (_context2.prev = _context2.next) {
  14006. case 0:
  14007. if (!this._queuedChunk) {
  14008. _context2.next = 4;
  14009. break;
  14010. }
  14011. chunk = this._queuedChunk;
  14012. this._queuedChunk = null;
  14013. return _context2.abrupt("return", {
  14014. value: chunk,
  14015. done: false
  14016. });
  14017. case 4:
  14018. if (!this._done) {
  14019. _context2.next = 6;
  14020. break;
  14021. }
  14022. return _context2.abrupt("return", {
  14023. value: undefined,
  14024. done: true
  14025. });
  14026. case 6:
  14027. requestCapability = (0, _util.createPromiseCapability)();
  14028. this._requests.push(requestCapability);
  14029. return _context2.abrupt("return", requestCapability.promise);
  14030. case 9:
  14031. case "end":
  14032. return _context2.stop();
  14033. }
  14034. }
  14035. }, _callee2, this);
  14036. }));
  14037. function read() {
  14038. return _read2.apply(this, arguments);
  14039. }
  14040. return read;
  14041. }()
  14042. }, {
  14043. key: "cancel",
  14044. value: function cancel(reason) {
  14045. this._done = true;
  14046. var _iterator5 = _createForOfIteratorHelper(this._requests),
  14047. _step5;
  14048. try {
  14049. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  14050. var requestCapability = _step5.value;
  14051. requestCapability.resolve({
  14052. value: undefined,
  14053. done: true
  14054. });
  14055. }
  14056. } catch (err) {
  14057. _iterator5.e(err);
  14058. } finally {
  14059. _iterator5.f();
  14060. }
  14061. this._requests.length = 0;
  14062. this._stream._removeRangeReader(this);
  14063. }
  14064. }]);
  14065. return PDFDataTransportStreamRangeReader;
  14066. }();
  14067. /***/ }),
  14068. /* 171 */
  14069. /***/ ((__unused_webpack_module, exports) => {
  14070. "use strict";
  14071. Object.defineProperty(exports, "__esModule", ({
  14072. value: true
  14073. }));
  14074. exports.XfaText = void 0;
  14075. 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; } } }; }
  14076. 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); }
  14077. 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; }
  14078. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14079. 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); } }
  14080. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  14081. var XfaText = /*#__PURE__*/function () {
  14082. function XfaText() {
  14083. _classCallCheck(this, XfaText);
  14084. }
  14085. _createClass(XfaText, null, [{
  14086. key: "textContent",
  14087. value: function textContent(xfa) {
  14088. var items = [];
  14089. var output = {
  14090. items: items,
  14091. styles: Object.create(null)
  14092. };
  14093. function walk(node) {
  14094. var _node$attributes;
  14095. if (!node) {
  14096. return;
  14097. }
  14098. var str = null;
  14099. var name = node.name;
  14100. if (name === "#text") {
  14101. str = node.value;
  14102. } else if (!XfaText.shouldBuildText(name)) {
  14103. return;
  14104. } else if (node !== null && node !== void 0 && (_node$attributes = node.attributes) !== null && _node$attributes !== void 0 && _node$attributes.textContent) {
  14105. str = node.attributes.textContent;
  14106. } else if (node.value) {
  14107. str = node.value;
  14108. }
  14109. if (str !== null) {
  14110. items.push({
  14111. str: str
  14112. });
  14113. }
  14114. if (!node.children) {
  14115. return;
  14116. }
  14117. var _iterator = _createForOfIteratorHelper(node.children),
  14118. _step;
  14119. try {
  14120. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  14121. var child = _step.value;
  14122. walk(child);
  14123. }
  14124. } catch (err) {
  14125. _iterator.e(err);
  14126. } finally {
  14127. _iterator.f();
  14128. }
  14129. }
  14130. walk(xfa);
  14131. return output;
  14132. }
  14133. }, {
  14134. key: "shouldBuildText",
  14135. value: function shouldBuildText(name) {
  14136. return !(name === "textarea" || name === "input" || name === "option" || name === "select");
  14137. }
  14138. }]);
  14139. return XfaText;
  14140. }();
  14141. exports.XfaText = XfaText;
  14142. /***/ }),
  14143. /* 172 */
  14144. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14145. "use strict";
  14146. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  14147. Object.defineProperty(exports, "__esModule", ({
  14148. value: true
  14149. }));
  14150. exports.NodeStandardFontDataFactory = exports.NodeCanvasFactory = exports.NodeCMapReaderFactory = void 0;
  14151. var _base_factory = __w_pdfjs_require__(159);
  14152. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14153. 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); } }
  14154. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  14155. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  14156. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  14157. 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); }; }
  14158. 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); }
  14159. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  14160. 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; } }
  14161. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  14162. ;
  14163. var fetchData = function fetchData(url) {
  14164. return new Promise(function (resolve, reject) {
  14165. var fs = require("fs");
  14166. fs.readFile(url, function (error, data) {
  14167. if (error || !data) {
  14168. reject(new Error(error));
  14169. return;
  14170. }
  14171. resolve(new Uint8Array(data));
  14172. });
  14173. });
  14174. };
  14175. var NodeCanvasFactory = /*#__PURE__*/function (_BaseCanvasFactory) {
  14176. _inherits(NodeCanvasFactory, _BaseCanvasFactory);
  14177. var _super = _createSuper(NodeCanvasFactory);
  14178. function NodeCanvasFactory() {
  14179. _classCallCheck(this, NodeCanvasFactory);
  14180. return _super.apply(this, arguments);
  14181. }
  14182. _createClass(NodeCanvasFactory, [{
  14183. key: "_createCanvas",
  14184. value: function _createCanvas(width, height) {
  14185. var Canvas = require("canvas");
  14186. return Canvas.createCanvas(width, height);
  14187. }
  14188. }]);
  14189. return NodeCanvasFactory;
  14190. }(_base_factory.BaseCanvasFactory);
  14191. exports.NodeCanvasFactory = NodeCanvasFactory;
  14192. var NodeCMapReaderFactory = /*#__PURE__*/function (_BaseCMapReaderFactor) {
  14193. _inherits(NodeCMapReaderFactory, _BaseCMapReaderFactor);
  14194. var _super2 = _createSuper(NodeCMapReaderFactory);
  14195. function NodeCMapReaderFactory() {
  14196. _classCallCheck(this, NodeCMapReaderFactory);
  14197. return _super2.apply(this, arguments);
  14198. }
  14199. _createClass(NodeCMapReaderFactory, [{
  14200. key: "_fetchData",
  14201. value: function _fetchData(url, compressionType) {
  14202. return fetchData(url).then(function (data) {
  14203. return {
  14204. cMapData: data,
  14205. compressionType: compressionType
  14206. };
  14207. });
  14208. }
  14209. }]);
  14210. return NodeCMapReaderFactory;
  14211. }(_base_factory.BaseCMapReaderFactory);
  14212. exports.NodeCMapReaderFactory = NodeCMapReaderFactory;
  14213. var NodeStandardFontDataFactory = /*#__PURE__*/function (_BaseStandardFontData) {
  14214. _inherits(NodeStandardFontDataFactory, _BaseStandardFontData);
  14215. var _super3 = _createSuper(NodeStandardFontDataFactory);
  14216. function NodeStandardFontDataFactory() {
  14217. _classCallCheck(this, NodeStandardFontDataFactory);
  14218. return _super3.apply(this, arguments);
  14219. }
  14220. _createClass(NodeStandardFontDataFactory, [{
  14221. key: "_fetchData",
  14222. value: function _fetchData(url) {
  14223. return fetchData(url);
  14224. }
  14225. }]);
  14226. return NodeStandardFontDataFactory;
  14227. }(_base_factory.BaseStandardFontDataFactory);
  14228. exports.NodeStandardFontDataFactory = NodeStandardFontDataFactory;
  14229. /***/ }),
  14230. /* 173 */
  14231. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14232. "use strict";
  14233. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  14234. Object.defineProperty(exports, "__esModule", ({
  14235. value: true
  14236. }));
  14237. exports.AnnotationLayer = void 0;
  14238. var _util = __w_pdfjs_require__(1);
  14239. var _display_utils = __w_pdfjs_require__(158);
  14240. var _annotation_storage = __w_pdfjs_require__(161);
  14241. var _scripting_utils = __w_pdfjs_require__(174);
  14242. var _xfa_layer = __w_pdfjs_require__(175);
  14243. function _classStaticPrivateMethodGet(receiver, classConstructor, method) { _classCheckPrivateStaticAccess(receiver, classConstructor); return method; }
  14244. function _classCheckPrivateStaticAccess(receiver, classConstructor) { if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } }
  14245. function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
  14246. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  14247. 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; }
  14248. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  14249. 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."); }
  14250. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  14251. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  14252. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  14253. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  14254. 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); }; }
  14255. 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); }
  14256. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  14257. 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; } }
  14258. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  14259. 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; } } }; }
  14260. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  14261. 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."); }
  14262. 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); }
  14263. 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; }
  14264. 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; }
  14265. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  14266. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14267. 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); } }
  14268. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  14269. var DEFAULT_TAB_INDEX = 1000;
  14270. var GetElementsByNameSet = new WeakSet();
  14271. function getRectDims(rect) {
  14272. return {
  14273. width: rect[2] - rect[0],
  14274. height: rect[3] - rect[1]
  14275. };
  14276. }
  14277. var AnnotationElementFactory = /*#__PURE__*/function () {
  14278. function AnnotationElementFactory() {
  14279. _classCallCheck(this, AnnotationElementFactory);
  14280. }
  14281. _createClass(AnnotationElementFactory, null, [{
  14282. key: "create",
  14283. value: function create(parameters) {
  14284. var subtype = parameters.data.annotationType;
  14285. switch (subtype) {
  14286. case _util.AnnotationType.LINK:
  14287. return new LinkAnnotationElement(parameters);
  14288. case _util.AnnotationType.TEXT:
  14289. return new TextAnnotationElement(parameters);
  14290. case _util.AnnotationType.WIDGET:
  14291. var fieldType = parameters.data.fieldType;
  14292. switch (fieldType) {
  14293. case "Tx":
  14294. return new TextWidgetAnnotationElement(parameters);
  14295. case "Btn":
  14296. if (parameters.data.radioButton) {
  14297. return new RadioButtonWidgetAnnotationElement(parameters);
  14298. } else if (parameters.data.checkBox) {
  14299. return new CheckboxWidgetAnnotationElement(parameters);
  14300. }
  14301. return new PushButtonWidgetAnnotationElement(parameters);
  14302. case "Ch":
  14303. return new ChoiceWidgetAnnotationElement(parameters);
  14304. }
  14305. return new WidgetAnnotationElement(parameters);
  14306. case _util.AnnotationType.POPUP:
  14307. return new PopupAnnotationElement(parameters);
  14308. case _util.AnnotationType.FREETEXT:
  14309. return new FreeTextAnnotationElement(parameters);
  14310. case _util.AnnotationType.LINE:
  14311. return new LineAnnotationElement(parameters);
  14312. case _util.AnnotationType.SQUARE:
  14313. return new SquareAnnotationElement(parameters);
  14314. case _util.AnnotationType.CIRCLE:
  14315. return new CircleAnnotationElement(parameters);
  14316. case _util.AnnotationType.POLYLINE:
  14317. return new PolylineAnnotationElement(parameters);
  14318. case _util.AnnotationType.CARET:
  14319. return new CaretAnnotationElement(parameters);
  14320. case _util.AnnotationType.INK:
  14321. return new InkAnnotationElement(parameters);
  14322. case _util.AnnotationType.POLYGON:
  14323. return new PolygonAnnotationElement(parameters);
  14324. case _util.AnnotationType.HIGHLIGHT:
  14325. return new HighlightAnnotationElement(parameters);
  14326. case _util.AnnotationType.UNDERLINE:
  14327. return new UnderlineAnnotationElement(parameters);
  14328. case _util.AnnotationType.SQUIGGLY:
  14329. return new SquigglyAnnotationElement(parameters);
  14330. case _util.AnnotationType.STRIKEOUT:
  14331. return new StrikeOutAnnotationElement(parameters);
  14332. case _util.AnnotationType.STAMP:
  14333. return new StampAnnotationElement(parameters);
  14334. case _util.AnnotationType.FILEATTACHMENT:
  14335. return new FileAttachmentAnnotationElement(parameters);
  14336. default:
  14337. return new AnnotationElement(parameters);
  14338. }
  14339. }
  14340. }]);
  14341. return AnnotationElementFactory;
  14342. }();
  14343. var AnnotationElement = /*#__PURE__*/function () {
  14344. function AnnotationElement(parameters) {
  14345. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  14346. _ref$isRenderable = _ref.isRenderable,
  14347. isRenderable = _ref$isRenderable === void 0 ? false : _ref$isRenderable,
  14348. _ref$ignoreBorder = _ref.ignoreBorder,
  14349. ignoreBorder = _ref$ignoreBorder === void 0 ? false : _ref$ignoreBorder,
  14350. _ref$createQuadrilate = _ref.createQuadrilaterals,
  14351. createQuadrilaterals = _ref$createQuadrilate === void 0 ? false : _ref$createQuadrilate;
  14352. _classCallCheck(this, AnnotationElement);
  14353. this.isRenderable = isRenderable;
  14354. this.data = parameters.data;
  14355. this.layer = parameters.layer;
  14356. this.page = parameters.page;
  14357. this.viewport = parameters.viewport;
  14358. this.linkService = parameters.linkService;
  14359. this.downloadManager = parameters.downloadManager;
  14360. this.imageResourcesPath = parameters.imageResourcesPath;
  14361. this.renderForms = parameters.renderForms;
  14362. this.svgFactory = parameters.svgFactory;
  14363. this.annotationStorage = parameters.annotationStorage;
  14364. this.enableScripting = parameters.enableScripting;
  14365. this.hasJSActions = parameters.hasJSActions;
  14366. this._fieldObjects = parameters.fieldObjects;
  14367. this._mouseState = parameters.mouseState;
  14368. if (isRenderable) {
  14369. this.container = this._createContainer(ignoreBorder);
  14370. }
  14371. if (createQuadrilaterals) {
  14372. this.quadrilaterals = this._createQuadrilaterals(ignoreBorder);
  14373. }
  14374. }
  14375. _createClass(AnnotationElement, [{
  14376. key: "_createContainer",
  14377. value: function _createContainer() {
  14378. var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  14379. var data = this.data,
  14380. page = this.page,
  14381. viewport = this.viewport;
  14382. var container = document.createElement("section");
  14383. var _getRectDims = getRectDims(data.rect),
  14384. width = _getRectDims.width,
  14385. height = _getRectDims.height;
  14386. container.setAttribute("data-annotation-id", data.id);
  14387. var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
  14388. if (data.hasOwnCanvas) {
  14389. var transform = viewport.transform.slice();
  14390. var _Util$singularValueDe = _util.Util.singularValueDecompose2dScale(transform),
  14391. _Util$singularValueDe2 = _slicedToArray(_Util$singularValueDe, 2),
  14392. scaleX = _Util$singularValueDe2[0],
  14393. scaleY = _Util$singularValueDe2[1];
  14394. width = Math.ceil(width * scaleX);
  14395. height = Math.ceil(height * scaleY);
  14396. rect[0] *= scaleX;
  14397. rect[1] *= scaleY;
  14398. for (var i = 0; i < 4; i++) {
  14399. transform[i] = Math.sign(transform[i]);
  14400. }
  14401. container.style.transform = "matrix(".concat(transform.join(","), ")");
  14402. } else {
  14403. container.style.transform = "matrix(".concat(viewport.transform.join(","), ")");
  14404. }
  14405. container.style.transformOrigin = "".concat(-rect[0], "px ").concat(-rect[1], "px");
  14406. if (!ignoreBorder && data.borderStyle.width > 0) {
  14407. container.style.borderWidth = "".concat(data.borderStyle.width, "px");
  14408. if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
  14409. width -= 2 * data.borderStyle.width;
  14410. height -= 2 * data.borderStyle.width;
  14411. }
  14412. var horizontalRadius = data.borderStyle.horizontalCornerRadius;
  14413. var verticalRadius = data.borderStyle.verticalCornerRadius;
  14414. if (horizontalRadius > 0 || verticalRadius > 0) {
  14415. var radius = "".concat(horizontalRadius, "px / ").concat(verticalRadius, "px");
  14416. container.style.borderRadius = radius;
  14417. }
  14418. switch (data.borderStyle.style) {
  14419. case _util.AnnotationBorderStyleType.SOLID:
  14420. container.style.borderStyle = "solid";
  14421. break;
  14422. case _util.AnnotationBorderStyleType.DASHED:
  14423. container.style.borderStyle = "dashed";
  14424. break;
  14425. case _util.AnnotationBorderStyleType.BEVELED:
  14426. (0, _util.warn)("Unimplemented border style: beveled");
  14427. break;
  14428. case _util.AnnotationBorderStyleType.INSET:
  14429. (0, _util.warn)("Unimplemented border style: inset");
  14430. break;
  14431. case _util.AnnotationBorderStyleType.UNDERLINE:
  14432. container.style.borderBottomStyle = "solid";
  14433. break;
  14434. default:
  14435. break;
  14436. }
  14437. var borderColor = data.borderColor || data.color || null;
  14438. if (borderColor) {
  14439. container.style.borderColor = _util.Util.makeHexColor(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0);
  14440. } else {
  14441. container.style.borderWidth = 0;
  14442. }
  14443. }
  14444. container.style.left = "".concat(rect[0], "px");
  14445. container.style.top = "".concat(rect[1], "px");
  14446. if (data.hasOwnCanvas) {
  14447. container.style.width = container.style.height = "auto";
  14448. } else {
  14449. container.style.width = "".concat(width, "px");
  14450. container.style.height = "".concat(height, "px");
  14451. }
  14452. return container;
  14453. }
  14454. }, {
  14455. key: "_commonActions",
  14456. get: function get() {
  14457. var _this = this;
  14458. var setColor = function setColor(jsName, styleName, event) {
  14459. var color = event.detail[jsName];
  14460. event.target.style[styleName] = _scripting_utils.ColorConverters["".concat(color[0], "_HTML")](color.slice(1));
  14461. };
  14462. return (0, _util.shadow)(this, "_commonActions", {
  14463. display: function display(event) {
  14464. var hidden = event.detail.display % 2 === 1;
  14465. event.target.style.visibility = hidden ? "hidden" : "visible";
  14466. _this.annotationStorage.setValue(_this.data.id, {
  14467. hidden: hidden,
  14468. print: event.detail.display === 0 || event.detail.display === 3
  14469. });
  14470. },
  14471. print: function print(event) {
  14472. _this.annotationStorage.setValue(_this.data.id, {
  14473. print: event.detail.print
  14474. });
  14475. },
  14476. hidden: function hidden(event) {
  14477. event.target.style.visibility = event.detail.hidden ? "hidden" : "visible";
  14478. _this.annotationStorage.setValue(_this.data.id, {
  14479. hidden: event.detail.hidden
  14480. });
  14481. },
  14482. focus: function focus(event) {
  14483. setTimeout(function () {
  14484. return event.target.focus({
  14485. preventScroll: false
  14486. });
  14487. }, 0);
  14488. },
  14489. userName: function userName(event) {
  14490. event.target.title = event.detail.userName;
  14491. },
  14492. readonly: function readonly(event) {
  14493. if (event.detail.readonly) {
  14494. event.target.setAttribute("readonly", "");
  14495. } else {
  14496. event.target.removeAttribute("readonly");
  14497. }
  14498. },
  14499. required: function required(event) {
  14500. if (event.detail.required) {
  14501. event.target.setAttribute("required", "");
  14502. } else {
  14503. event.target.removeAttribute("required");
  14504. }
  14505. },
  14506. bgColor: function bgColor(event) {
  14507. setColor("bgColor", "backgroundColor", event);
  14508. },
  14509. fillColor: function fillColor(event) {
  14510. setColor("fillColor", "backgroundColor", event);
  14511. },
  14512. fgColor: function fgColor(event) {
  14513. setColor("fgColor", "color", event);
  14514. },
  14515. textColor: function textColor(event) {
  14516. setColor("textColor", "color", event);
  14517. },
  14518. borderColor: function borderColor(event) {
  14519. setColor("borderColor", "borderColor", event);
  14520. },
  14521. strokeColor: function strokeColor(event) {
  14522. setColor("strokeColor", "borderColor", event);
  14523. }
  14524. });
  14525. }
  14526. }, {
  14527. key: "_dispatchEventFromSandbox",
  14528. value: function _dispatchEventFromSandbox(actions, jsEvent) {
  14529. var commonActions = this._commonActions;
  14530. for (var _i2 = 0, _Object$keys = Object.keys(jsEvent.detail); _i2 < _Object$keys.length; _i2++) {
  14531. var name = _Object$keys[_i2];
  14532. var action = actions[name] || commonActions[name];
  14533. if (action) {
  14534. action(jsEvent);
  14535. }
  14536. }
  14537. }
  14538. }, {
  14539. key: "_setDefaultPropertiesFromJS",
  14540. value: function _setDefaultPropertiesFromJS(element) {
  14541. if (!this.enableScripting) {
  14542. return;
  14543. }
  14544. var storedData = this.annotationStorage.getRawValue(this.data.id);
  14545. if (!storedData) {
  14546. return;
  14547. }
  14548. var commonActions = this._commonActions;
  14549. for (var _i3 = 0, _Object$entries = Object.entries(storedData); _i3 < _Object$entries.length; _i3++) {
  14550. var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
  14551. actionName = _Object$entries$_i[0],
  14552. detail = _Object$entries$_i[1];
  14553. var action = commonActions[actionName];
  14554. if (action) {
  14555. action({
  14556. detail: detail,
  14557. target: element
  14558. });
  14559. delete storedData[actionName];
  14560. }
  14561. }
  14562. }
  14563. }, {
  14564. key: "_createQuadrilaterals",
  14565. value: function _createQuadrilaterals() {
  14566. var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  14567. if (!this.data.quadPoints) {
  14568. return null;
  14569. }
  14570. var quadrilaterals = [];
  14571. var savedRect = this.data.rect;
  14572. var _iterator = _createForOfIteratorHelper(this.data.quadPoints),
  14573. _step;
  14574. try {
  14575. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  14576. var quadPoint = _step.value;
  14577. this.data.rect = [quadPoint[2].x, quadPoint[2].y, quadPoint[1].x, quadPoint[1].y];
  14578. quadrilaterals.push(this._createContainer(ignoreBorder));
  14579. }
  14580. } catch (err) {
  14581. _iterator.e(err);
  14582. } finally {
  14583. _iterator.f();
  14584. }
  14585. this.data.rect = savedRect;
  14586. return quadrilaterals;
  14587. }
  14588. }, {
  14589. key: "_createPopup",
  14590. value: function _createPopup(trigger, data) {
  14591. var container = this.container;
  14592. if (this.quadrilaterals) {
  14593. trigger = trigger || this.quadrilaterals;
  14594. container = this.quadrilaterals[0];
  14595. }
  14596. if (!trigger) {
  14597. trigger = document.createElement("div");
  14598. trigger.style.height = container.style.height;
  14599. trigger.style.width = container.style.width;
  14600. container.appendChild(trigger);
  14601. }
  14602. var popupElement = new PopupElement({
  14603. container: container,
  14604. trigger: trigger,
  14605. color: data.color,
  14606. titleObj: data.titleObj,
  14607. modificationDate: data.modificationDate,
  14608. contentsObj: data.contentsObj,
  14609. richText: data.richText,
  14610. hideWrapper: true
  14611. });
  14612. var popup = popupElement.render();
  14613. popup.style.left = container.style.width;
  14614. container.appendChild(popup);
  14615. }
  14616. }, {
  14617. key: "_renderQuadrilaterals",
  14618. value: function _renderQuadrilaterals(className) {
  14619. var _iterator2 = _createForOfIteratorHelper(this.quadrilaterals),
  14620. _step2;
  14621. try {
  14622. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  14623. var quadrilateral = _step2.value;
  14624. quadrilateral.className = className;
  14625. }
  14626. } catch (err) {
  14627. _iterator2.e(err);
  14628. } finally {
  14629. _iterator2.f();
  14630. }
  14631. return this.quadrilaterals;
  14632. }
  14633. }, {
  14634. key: "render",
  14635. value: function render() {
  14636. (0, _util.unreachable)("Abstract method `AnnotationElement.render` called");
  14637. }
  14638. }, {
  14639. key: "_getElementsByName",
  14640. value: function _getElementsByName(name) {
  14641. var skipId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  14642. var fields = [];
  14643. if (this._fieldObjects) {
  14644. var fieldObj = this._fieldObjects[name];
  14645. if (fieldObj) {
  14646. var _iterator3 = _createForOfIteratorHelper(fieldObj),
  14647. _step3;
  14648. try {
  14649. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  14650. var _step3$value = _step3.value,
  14651. page = _step3$value.page,
  14652. id = _step3$value.id,
  14653. exportValues = _step3$value.exportValues;
  14654. if (page === -1) {
  14655. continue;
  14656. }
  14657. if (id === skipId) {
  14658. continue;
  14659. }
  14660. var exportValue = typeof exportValues === "string" ? exportValues : null;
  14661. var domElement = document.getElementById(id);
  14662. if (domElement && !GetElementsByNameSet.has(domElement)) {
  14663. (0, _util.warn)("_getElementsByName - element not allowed: ".concat(id));
  14664. continue;
  14665. }
  14666. fields.push({
  14667. id: id,
  14668. exportValue: exportValue,
  14669. domElement: domElement
  14670. });
  14671. }
  14672. } catch (err) {
  14673. _iterator3.e(err);
  14674. } finally {
  14675. _iterator3.f();
  14676. }
  14677. }
  14678. return fields;
  14679. }
  14680. var _iterator4 = _createForOfIteratorHelper(document.getElementsByName(name)),
  14681. _step4;
  14682. try {
  14683. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  14684. var _domElement = _step4.value;
  14685. var _id = _domElement.id,
  14686. _exportValue = _domElement.exportValue;
  14687. if (_id === skipId) {
  14688. continue;
  14689. }
  14690. if (!GetElementsByNameSet.has(_domElement)) {
  14691. continue;
  14692. }
  14693. fields.push({
  14694. id: _id,
  14695. exportValue: _exportValue,
  14696. domElement: _domElement
  14697. });
  14698. }
  14699. } catch (err) {
  14700. _iterator4.e(err);
  14701. } finally {
  14702. _iterator4.f();
  14703. }
  14704. return fields;
  14705. }
  14706. }], [{
  14707. key: "platform",
  14708. get: function get() {
  14709. var platform = typeof navigator !== "undefined" ? navigator.platform : "";
  14710. return (0, _util.shadow)(this, "platform", {
  14711. isWin: platform.includes("Win"),
  14712. isMac: platform.includes("Mac")
  14713. });
  14714. }
  14715. }]);
  14716. return AnnotationElement;
  14717. }();
  14718. var LinkAnnotationElement = /*#__PURE__*/function (_AnnotationElement) {
  14719. _inherits(LinkAnnotationElement, _AnnotationElement);
  14720. var _super = _createSuper(LinkAnnotationElement);
  14721. function LinkAnnotationElement(parameters) {
  14722. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  14723. _classCallCheck(this, LinkAnnotationElement);
  14724. var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action || parameters.data.isTooltipOnly || parameters.data.resetForm || parameters.data.actions && (parameters.data.actions.Action || parameters.data.actions["Mouse Up"] || parameters.data.actions["Mouse Down"]));
  14725. return _super.call(this, parameters, {
  14726. isRenderable: isRenderable,
  14727. ignoreBorder: !!(options !== null && options !== void 0 && options.ignoreBorder),
  14728. createQuadrilaterals: true
  14729. });
  14730. }
  14731. _createClass(LinkAnnotationElement, [{
  14732. key: "render",
  14733. value: function render() {
  14734. var data = this.data,
  14735. linkService = this.linkService;
  14736. var link = document.createElement("a");
  14737. if (data.url) {
  14738. linkService.addLinkAttributes(link, data.url, data.newWindow);
  14739. } else if (data.action) {
  14740. this._bindNamedAction(link, data.action);
  14741. } else if (data.dest) {
  14742. this._bindLink(link, data.dest);
  14743. } else {
  14744. var hasClickAction = false;
  14745. if (data.actions && (data.actions.Action || data.actions["Mouse Up"] || data.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions) {
  14746. hasClickAction = true;
  14747. this._bindJSAction(link, data);
  14748. }
  14749. if (data.resetForm) {
  14750. this._bindResetFormAction(link, data.resetForm);
  14751. } else if (!hasClickAction) {
  14752. this._bindLink(link, "");
  14753. }
  14754. }
  14755. if (this.quadrilaterals) {
  14756. return this._renderQuadrilaterals("linkAnnotation").map(function (quadrilateral, index) {
  14757. var linkElement = index === 0 ? link : link.cloneNode();
  14758. quadrilateral.appendChild(linkElement);
  14759. return quadrilateral;
  14760. });
  14761. }
  14762. this.container.className = "linkAnnotation";
  14763. this.container.appendChild(link);
  14764. return this.container;
  14765. }
  14766. }, {
  14767. key: "_bindLink",
  14768. value: function _bindLink(link, destination) {
  14769. var _this2 = this;
  14770. link.href = this.linkService.getDestinationHash(destination);
  14771. link.onclick = function () {
  14772. if (destination) {
  14773. _this2.linkService.goToDestination(destination);
  14774. }
  14775. return false;
  14776. };
  14777. if (destination || destination === "") {
  14778. link.className = "internalLink";
  14779. }
  14780. }
  14781. }, {
  14782. key: "_bindNamedAction",
  14783. value: function _bindNamedAction(link, action) {
  14784. var _this3 = this;
  14785. link.href = this.linkService.getAnchorUrl("");
  14786. link.onclick = function () {
  14787. _this3.linkService.executeNamedAction(action);
  14788. return false;
  14789. };
  14790. link.className = "internalLink";
  14791. }
  14792. }, {
  14793. key: "_bindJSAction",
  14794. value: function _bindJSAction(link, data) {
  14795. var _this4 = this;
  14796. link.href = this.linkService.getAnchorUrl("");
  14797. var map = new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
  14798. var _loop = function _loop() {
  14799. var name = _Object$keys2[_i4];
  14800. var jsName = map.get(name);
  14801. if (!jsName) {
  14802. return "continue";
  14803. }
  14804. link[jsName] = function () {
  14805. var _this4$linkService$ev;
  14806. (_this4$linkService$ev = _this4.linkService.eventBus) === null || _this4$linkService$ev === void 0 ? void 0 : _this4$linkService$ev.dispatch("dispatcheventinsandbox", {
  14807. source: _this4,
  14808. detail: {
  14809. id: data.id,
  14810. name: name
  14811. }
  14812. });
  14813. return false;
  14814. };
  14815. };
  14816. for (var _i4 = 0, _Object$keys2 = Object.keys(data.actions); _i4 < _Object$keys2.length; _i4++) {
  14817. var _ret = _loop();
  14818. if (_ret === "continue") continue;
  14819. }
  14820. if (!link.onclick) {
  14821. link.onclick = function () {
  14822. return false;
  14823. };
  14824. }
  14825. link.className = "internalLink";
  14826. }
  14827. }, {
  14828. key: "_bindResetFormAction",
  14829. value: function _bindResetFormAction(link, resetForm) {
  14830. var _this5 = this;
  14831. var otherClickAction = link.onclick;
  14832. if (!otherClickAction) {
  14833. link.href = this.linkService.getAnchorUrl("");
  14834. }
  14835. link.className = "internalLink";
  14836. if (!this._fieldObjects) {
  14837. (0, _util.warn)("_bindResetFormAction - \"resetForm\" action not supported, " + "ensure that the `fieldObjects` parameter is provided.");
  14838. if (!otherClickAction) {
  14839. link.onclick = function () {
  14840. return false;
  14841. };
  14842. }
  14843. return;
  14844. }
  14845. link.onclick = function () {
  14846. if (otherClickAction) {
  14847. otherClickAction();
  14848. }
  14849. var resetFormFields = resetForm.fields,
  14850. resetFormRefs = resetForm.refs,
  14851. include = resetForm.include;
  14852. var allFields = [];
  14853. if (resetFormFields.length !== 0 || resetFormRefs.length !== 0) {
  14854. var fieldIds = new Set(resetFormRefs);
  14855. var _iterator5 = _createForOfIteratorHelper(resetFormFields),
  14856. _step5;
  14857. try {
  14858. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  14859. var fieldName = _step5.value;
  14860. var _fields = _this5._fieldObjects[fieldName] || [];
  14861. var _iterator7 = _createForOfIteratorHelper(_fields),
  14862. _step7;
  14863. try {
  14864. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  14865. var id = _step7.value.id;
  14866. fieldIds.add(id);
  14867. }
  14868. } catch (err) {
  14869. _iterator7.e(err);
  14870. } finally {
  14871. _iterator7.f();
  14872. }
  14873. }
  14874. } catch (err) {
  14875. _iterator5.e(err);
  14876. } finally {
  14877. _iterator5.f();
  14878. }
  14879. for (var _i5 = 0, _Object$values = Object.values(_this5._fieldObjects); _i5 < _Object$values.length; _i5++) {
  14880. var fields = _Object$values[_i5];
  14881. var _iterator6 = _createForOfIteratorHelper(fields),
  14882. _step6;
  14883. try {
  14884. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  14885. var field = _step6.value;
  14886. if (fieldIds.has(field.id) === include) {
  14887. allFields.push(field);
  14888. }
  14889. }
  14890. } catch (err) {
  14891. _iterator6.e(err);
  14892. } finally {
  14893. _iterator6.f();
  14894. }
  14895. }
  14896. } else {
  14897. for (var _i6 = 0, _Object$values2 = Object.values(_this5._fieldObjects); _i6 < _Object$values2.length; _i6++) {
  14898. var _fields2 = _Object$values2[_i6];
  14899. allFields.push.apply(allFields, _toConsumableArray(_fields2));
  14900. }
  14901. }
  14902. var storage = _this5.annotationStorage;
  14903. var allIds = [];
  14904. for (var _i7 = 0, _allFields = allFields; _i7 < _allFields.length; _i7++) {
  14905. var _field = _allFields[_i7];
  14906. var _id2 = _field.id;
  14907. allIds.push(_id2);
  14908. switch (_field.type) {
  14909. case "text":
  14910. {
  14911. var value = _field.defaultValue || "";
  14912. storage.setValue(_id2, {
  14913. value: value
  14914. });
  14915. break;
  14916. }
  14917. case "checkbox":
  14918. case "radiobutton":
  14919. {
  14920. var _value = _field.defaultValue === _field.exportValues;
  14921. storage.setValue(_id2, {
  14922. value: _value
  14923. });
  14924. break;
  14925. }
  14926. case "combobox":
  14927. case "listbox":
  14928. {
  14929. var _value2 = _field.defaultValue || "";
  14930. storage.setValue(_id2, {
  14931. value: _value2
  14932. });
  14933. break;
  14934. }
  14935. default:
  14936. continue;
  14937. }
  14938. var domElement = document.getElementById(_id2);
  14939. if (!domElement || !GetElementsByNameSet.has(domElement)) {
  14940. continue;
  14941. }
  14942. domElement.dispatchEvent(new Event("resetform"));
  14943. }
  14944. if (_this5.enableScripting) {
  14945. var _this5$linkService$ev;
  14946. (_this5$linkService$ev = _this5.linkService.eventBus) === null || _this5$linkService$ev === void 0 ? void 0 : _this5$linkService$ev.dispatch("dispatcheventinsandbox", {
  14947. source: _this5,
  14948. detail: {
  14949. id: "app",
  14950. ids: allIds,
  14951. name: "ResetForm"
  14952. }
  14953. });
  14954. }
  14955. return false;
  14956. };
  14957. }
  14958. }]);
  14959. return LinkAnnotationElement;
  14960. }(AnnotationElement);
  14961. var TextAnnotationElement = /*#__PURE__*/function (_AnnotationElement2) {
  14962. _inherits(TextAnnotationElement, _AnnotationElement2);
  14963. var _super2 = _createSuper(TextAnnotationElement);
  14964. function TextAnnotationElement(parameters) {
  14965. var _parameters$data$titl, _parameters$data$cont, _parameters$data$rich;
  14966. _classCallCheck(this, TextAnnotationElement);
  14967. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl = parameters.data.titleObj) !== null && _parameters$data$titl !== void 0 && _parameters$data$titl.str || (_parameters$data$cont = parameters.data.contentsObj) !== null && _parameters$data$cont !== void 0 && _parameters$data$cont.str || (_parameters$data$rich = parameters.data.richText) !== null && _parameters$data$rich !== void 0 && _parameters$data$rich.str);
  14968. return _super2.call(this, parameters, {
  14969. isRenderable: isRenderable
  14970. });
  14971. }
  14972. _createClass(TextAnnotationElement, [{
  14973. key: "render",
  14974. value: function render() {
  14975. this.container.className = "textAnnotation";
  14976. var image = document.createElement("img");
  14977. image.style.height = this.container.style.height;
  14978. image.style.width = this.container.style.width;
  14979. image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
  14980. image.alt = "[{{type}} Annotation]";
  14981. image.dataset.l10nId = "text_annotation_type";
  14982. image.dataset.l10nArgs = JSON.stringify({
  14983. type: this.data.name
  14984. });
  14985. if (!this.data.hasPopup) {
  14986. this._createPopup(image, this.data);
  14987. }
  14988. this.container.appendChild(image);
  14989. return this.container;
  14990. }
  14991. }]);
  14992. return TextAnnotationElement;
  14993. }(AnnotationElement);
  14994. var WidgetAnnotationElement = /*#__PURE__*/function (_AnnotationElement3) {
  14995. _inherits(WidgetAnnotationElement, _AnnotationElement3);
  14996. var _super3 = _createSuper(WidgetAnnotationElement);
  14997. function WidgetAnnotationElement() {
  14998. _classCallCheck(this, WidgetAnnotationElement);
  14999. return _super3.apply(this, arguments);
  15000. }
  15001. _createClass(WidgetAnnotationElement, [{
  15002. key: "render",
  15003. value: function render() {
  15004. if (this.data.alternativeText) {
  15005. this.container.title = this.data.alternativeText;
  15006. }
  15007. return this.container;
  15008. }
  15009. }, {
  15010. key: "_getKeyModifier",
  15011. value: function _getKeyModifier(event) {
  15012. var _AnnotationElement$pl = AnnotationElement.platform,
  15013. isWin = _AnnotationElement$pl.isWin,
  15014. isMac = _AnnotationElement$pl.isMac;
  15015. return isWin && event.ctrlKey || isMac && event.metaKey;
  15016. }
  15017. }, {
  15018. key: "_setEventListener",
  15019. value: function _setEventListener(element, baseName, eventName, valueGetter) {
  15020. var _this6 = this;
  15021. if (baseName.includes("mouse")) {
  15022. element.addEventListener(baseName, function (event) {
  15023. var _this6$linkService$ev;
  15024. (_this6$linkService$ev = _this6.linkService.eventBus) === null || _this6$linkService$ev === void 0 ? void 0 : _this6$linkService$ev.dispatch("dispatcheventinsandbox", {
  15025. source: _this6,
  15026. detail: {
  15027. id: _this6.data.id,
  15028. name: eventName,
  15029. value: valueGetter(event),
  15030. shift: event.shiftKey,
  15031. modifier: _this6._getKeyModifier(event)
  15032. }
  15033. });
  15034. });
  15035. } else {
  15036. element.addEventListener(baseName, function (event) {
  15037. var _this6$linkService$ev2;
  15038. (_this6$linkService$ev2 = _this6.linkService.eventBus) === null || _this6$linkService$ev2 === void 0 ? void 0 : _this6$linkService$ev2.dispatch("dispatcheventinsandbox", {
  15039. source: _this6,
  15040. detail: {
  15041. id: _this6.data.id,
  15042. name: eventName,
  15043. value: valueGetter(event)
  15044. }
  15045. });
  15046. });
  15047. }
  15048. }
  15049. }, {
  15050. key: "_setEventListeners",
  15051. value: function _setEventListeners(element, names, getter) {
  15052. var _iterator8 = _createForOfIteratorHelper(names),
  15053. _step8;
  15054. try {
  15055. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  15056. var _this$data$actions;
  15057. var _step8$value = _slicedToArray(_step8.value, 2),
  15058. baseName = _step8$value[0],
  15059. eventName = _step8$value[1];
  15060. if (eventName === "Action" || (_this$data$actions = this.data.actions) !== null && _this$data$actions !== void 0 && _this$data$actions[eventName]) {
  15061. this._setEventListener(element, baseName, eventName, getter);
  15062. }
  15063. }
  15064. } catch (err) {
  15065. _iterator8.e(err);
  15066. } finally {
  15067. _iterator8.f();
  15068. }
  15069. }
  15070. }, {
  15071. key: "_setBackgroundColor",
  15072. value: function _setBackgroundColor(element) {
  15073. var color = this.data.backgroundColor || null;
  15074. element.style.backgroundColor = color === null ? "transparent" : _util.Util.makeHexColor(color[0], color[1], color[2]);
  15075. }
  15076. }]);
  15077. return WidgetAnnotationElement;
  15078. }(AnnotationElement);
  15079. var TextWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem) {
  15080. _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem);
  15081. var _super4 = _createSuper(TextWidgetAnnotationElement);
  15082. function TextWidgetAnnotationElement(parameters) {
  15083. _classCallCheck(this, TextWidgetAnnotationElement);
  15084. var isRenderable = parameters.renderForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
  15085. return _super4.call(this, parameters, {
  15086. isRenderable: isRenderable
  15087. });
  15088. }
  15089. _createClass(TextWidgetAnnotationElement, [{
  15090. key: "setPropertyOnSiblings",
  15091. value: function setPropertyOnSiblings(base, key, value, keyInStorage) {
  15092. var storage = this.annotationStorage;
  15093. var _iterator9 = _createForOfIteratorHelper(this._getElementsByName(base.name, base.id)),
  15094. _step9;
  15095. try {
  15096. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  15097. var element = _step9.value;
  15098. if (element.domElement) {
  15099. element.domElement[key] = value;
  15100. }
  15101. storage.setValue(element.id, _defineProperty({}, keyInStorage, value));
  15102. }
  15103. } catch (err) {
  15104. _iterator9.e(err);
  15105. } finally {
  15106. _iterator9.f();
  15107. }
  15108. }
  15109. }, {
  15110. key: "render",
  15111. value: function render() {
  15112. var _this7 = this;
  15113. var storage = this.annotationStorage;
  15114. var id = this.data.id;
  15115. this.container.className = "textWidgetAnnotation";
  15116. var element = null;
  15117. if (this.renderForms) {
  15118. var storedData = storage.getValue(id, {
  15119. value: this.data.fieldValue
  15120. });
  15121. var textContent = storedData.formattedValue || storedData.value || "";
  15122. var elementData = {
  15123. userValue: null,
  15124. formattedValue: null,
  15125. valueOnFocus: ""
  15126. };
  15127. if (this.data.multiLine) {
  15128. element = document.createElement("textarea");
  15129. element.textContent = textContent;
  15130. } else {
  15131. element = document.createElement("input");
  15132. element.type = "text";
  15133. element.setAttribute("value", textContent);
  15134. }
  15135. GetElementsByNameSet.add(element);
  15136. element.disabled = this.data.readOnly;
  15137. element.name = this.data.fieldName;
  15138. element.tabIndex = DEFAULT_TAB_INDEX;
  15139. elementData.userValue = textContent;
  15140. element.setAttribute("id", id);
  15141. element.addEventListener("input", function (event) {
  15142. storage.setValue(id, {
  15143. value: event.target.value
  15144. });
  15145. _this7.setPropertyOnSiblings(element, "value", event.target.value, "value");
  15146. });
  15147. element.addEventListener("resetform", function (event) {
  15148. var _this7$data$defaultFi;
  15149. var defaultValue = (_this7$data$defaultFi = _this7.data.defaultFieldValue) !== null && _this7$data$defaultFi !== void 0 ? _this7$data$defaultFi : "";
  15150. element.value = elementData.userValue = defaultValue;
  15151. elementData.formattedValue = null;
  15152. });
  15153. var blurListener = function blurListener(event) {
  15154. var formattedValue = elementData.formattedValue;
  15155. if (formattedValue !== null && formattedValue !== undefined) {
  15156. event.target.value = formattedValue;
  15157. }
  15158. event.target.scrollLeft = 0;
  15159. };
  15160. if (this.enableScripting && this.hasJSActions) {
  15161. var _this$data$actions2;
  15162. element.addEventListener("focus", function (event) {
  15163. if (elementData.userValue) {
  15164. event.target.value = elementData.userValue;
  15165. }
  15166. elementData.valueOnFocus = event.target.value;
  15167. });
  15168. element.addEventListener("updatefromsandbox", function (jsEvent) {
  15169. var actions = {
  15170. value: function value(event) {
  15171. var _event$detail$value;
  15172. elementData.userValue = (_event$detail$value = event.detail.value) !== null && _event$detail$value !== void 0 ? _event$detail$value : "";
  15173. storage.setValue(id, {
  15174. value: elementData.userValue.toString()
  15175. });
  15176. event.target.value = elementData.userValue;
  15177. },
  15178. formattedValue: function formattedValue(event) {
  15179. var formattedValue = event.detail.formattedValue;
  15180. elementData.formattedValue = formattedValue;
  15181. if (formattedValue !== null && formattedValue !== undefined && event.target !== document.activeElement) {
  15182. event.target.value = formattedValue;
  15183. }
  15184. storage.setValue(id, {
  15185. formattedValue: formattedValue
  15186. });
  15187. },
  15188. selRange: function selRange(event) {
  15189. var _event$target;
  15190. (_event$target = event.target).setSelectionRange.apply(_event$target, _toConsumableArray(event.detail.selRange));
  15191. }
  15192. };
  15193. _this7._dispatchEventFromSandbox(actions, jsEvent);
  15194. });
  15195. element.addEventListener("keydown", function (event) {
  15196. var _this7$linkService$ev;
  15197. var commitKey = -1;
  15198. if (event.key === "Escape") {
  15199. commitKey = 0;
  15200. } else if (event.key === "Enter") {
  15201. commitKey = 2;
  15202. } else if (event.key === "Tab") {
  15203. commitKey = 3;
  15204. }
  15205. if (commitKey === -1) {
  15206. return;
  15207. }
  15208. var value = event.target.value;
  15209. if (elementData.valueOnFocus === value) {
  15210. return;
  15211. }
  15212. elementData.userValue = value;
  15213. (_this7$linkService$ev = _this7.linkService.eventBus) === null || _this7$linkService$ev === void 0 ? void 0 : _this7$linkService$ev.dispatch("dispatcheventinsandbox", {
  15214. source: _this7,
  15215. detail: {
  15216. id: id,
  15217. name: "Keystroke",
  15218. value: value,
  15219. willCommit: true,
  15220. commitKey: commitKey,
  15221. selStart: event.target.selectionStart,
  15222. selEnd: event.target.selectionEnd
  15223. }
  15224. });
  15225. });
  15226. var _blurListener = blurListener;
  15227. blurListener = null;
  15228. element.addEventListener("blur", function (event) {
  15229. var value = event.target.value;
  15230. elementData.userValue = value;
  15231. if (_this7._mouseState.isDown && elementData.valueOnFocus !== value) {
  15232. var _this7$linkService$ev2;
  15233. (_this7$linkService$ev2 = _this7.linkService.eventBus) === null || _this7$linkService$ev2 === void 0 ? void 0 : _this7$linkService$ev2.dispatch("dispatcheventinsandbox", {
  15234. source: _this7,
  15235. detail: {
  15236. id: id,
  15237. name: "Keystroke",
  15238. value: value,
  15239. willCommit: true,
  15240. commitKey: 1,
  15241. selStart: event.target.selectionStart,
  15242. selEnd: event.target.selectionEnd
  15243. }
  15244. });
  15245. }
  15246. _blurListener(event);
  15247. });
  15248. if ((_this$data$actions2 = this.data.actions) !== null && _this$data$actions2 !== void 0 && _this$data$actions2.Keystroke) {
  15249. element.addEventListener("beforeinput", function (event) {
  15250. var _this7$linkService$ev3;
  15251. var data = event.data,
  15252. target = event.target;
  15253. var value = target.value,
  15254. selectionStart = target.selectionStart,
  15255. selectionEnd = target.selectionEnd;
  15256. var selStart = selectionStart,
  15257. selEnd = selectionEnd;
  15258. switch (event.inputType) {
  15259. case "deleteWordBackward":
  15260. {
  15261. var match = value.substring(0, selectionStart).match(/\w*[^\w]*$/);
  15262. if (match) {
  15263. selStart -= match[0].length;
  15264. }
  15265. break;
  15266. }
  15267. case "deleteWordForward":
  15268. {
  15269. var _match = value.substring(selectionStart).match(/^[^\w]*\w*/);
  15270. if (_match) {
  15271. selEnd += _match[0].length;
  15272. }
  15273. break;
  15274. }
  15275. case "deleteContentBackward":
  15276. if (selectionStart === selectionEnd) {
  15277. selStart -= 1;
  15278. }
  15279. break;
  15280. case "deleteContentForward":
  15281. if (selectionStart === selectionEnd) {
  15282. selEnd += 1;
  15283. }
  15284. break;
  15285. }
  15286. event.preventDefault();
  15287. (_this7$linkService$ev3 = _this7.linkService.eventBus) === null || _this7$linkService$ev3 === void 0 ? void 0 : _this7$linkService$ev3.dispatch("dispatcheventinsandbox", {
  15288. source: _this7,
  15289. detail: {
  15290. id: id,
  15291. name: "Keystroke",
  15292. value: value,
  15293. change: data || "",
  15294. willCommit: false,
  15295. selStart: selStart,
  15296. selEnd: selEnd
  15297. }
  15298. });
  15299. });
  15300. }
  15301. this._setEventListeners(element, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], function (event) {
  15302. return event.target.value;
  15303. });
  15304. }
  15305. if (blurListener) {
  15306. element.addEventListener("blur", blurListener);
  15307. }
  15308. if (this.data.maxLen !== null) {
  15309. element.maxLength = this.data.maxLen;
  15310. }
  15311. if (this.data.comb) {
  15312. var fieldWidth = this.data.rect[2] - this.data.rect[0];
  15313. var combWidth = fieldWidth / this.data.maxLen;
  15314. element.classList.add("comb");
  15315. element.style.letterSpacing = "calc(".concat(combWidth, "px - 1ch)");
  15316. }
  15317. } else {
  15318. element = document.createElement("div");
  15319. element.textContent = this.data.fieldValue;
  15320. element.style.verticalAlign = "middle";
  15321. element.style.display = "table-cell";
  15322. }
  15323. this._setTextStyle(element);
  15324. this._setBackgroundColor(element);
  15325. this._setDefaultPropertiesFromJS(element);
  15326. this.container.appendChild(element);
  15327. return this.container;
  15328. }
  15329. }, {
  15330. key: "_setTextStyle",
  15331. value: function _setTextStyle(element) {
  15332. var TEXT_ALIGNMENT = ["left", "center", "right"];
  15333. var _this$data$defaultApp = this.data.defaultAppearanceData,
  15334. fontSize = _this$data$defaultApp.fontSize,
  15335. fontColor = _this$data$defaultApp.fontColor;
  15336. var style = element.style;
  15337. if (fontSize) {
  15338. style.fontSize = "".concat(fontSize, "px");
  15339. }
  15340. style.color = _util.Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);
  15341. if (this.data.textAlignment !== null) {
  15342. style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
  15343. }
  15344. }
  15345. }]);
  15346. return TextWidgetAnnotationElement;
  15347. }(WidgetAnnotationElement);
  15348. var CheckboxWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem2) {
  15349. _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2);
  15350. var _super5 = _createSuper(CheckboxWidgetAnnotationElement);
  15351. function CheckboxWidgetAnnotationElement(parameters) {
  15352. _classCallCheck(this, CheckboxWidgetAnnotationElement);
  15353. return _super5.call(this, parameters, {
  15354. isRenderable: parameters.renderForms
  15355. });
  15356. }
  15357. _createClass(CheckboxWidgetAnnotationElement, [{
  15358. key: "render",
  15359. value: function render() {
  15360. var _this8 = this;
  15361. var storage = this.annotationStorage;
  15362. var data = this.data;
  15363. var id = data.id;
  15364. var value = storage.getValue(id, {
  15365. value: data.exportValue === data.fieldValue
  15366. }).value;
  15367. if (typeof value === "string") {
  15368. value = value !== "Off";
  15369. storage.setValue(id, {
  15370. value: value
  15371. });
  15372. }
  15373. this.container.className = "buttonWidgetAnnotation checkBox";
  15374. var element = document.createElement("input");
  15375. GetElementsByNameSet.add(element);
  15376. element.disabled = data.readOnly;
  15377. element.type = "checkbox";
  15378. element.name = data.fieldName;
  15379. if (value) {
  15380. element.setAttribute("checked", true);
  15381. }
  15382. element.setAttribute("id", id);
  15383. element.setAttribute("exportValue", data.exportValue);
  15384. element.tabIndex = DEFAULT_TAB_INDEX;
  15385. element.addEventListener("change", function (event) {
  15386. var _event$target2 = event.target,
  15387. name = _event$target2.name,
  15388. checked = _event$target2.checked;
  15389. var _iterator10 = _createForOfIteratorHelper(_this8._getElementsByName(name, id)),
  15390. _step10;
  15391. try {
  15392. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  15393. var checkbox = _step10.value;
  15394. var curChecked = checked && checkbox.exportValue === data.exportValue;
  15395. if (checkbox.domElement) {
  15396. checkbox.domElement.checked = curChecked;
  15397. }
  15398. storage.setValue(checkbox.id, {
  15399. value: curChecked
  15400. });
  15401. }
  15402. } catch (err) {
  15403. _iterator10.e(err);
  15404. } finally {
  15405. _iterator10.f();
  15406. }
  15407. storage.setValue(id, {
  15408. value: checked
  15409. });
  15410. });
  15411. element.addEventListener("resetform", function (event) {
  15412. var defaultValue = data.defaultFieldValue || "Off";
  15413. event.target.checked = defaultValue === data.exportValue;
  15414. });
  15415. if (this.enableScripting && this.hasJSActions) {
  15416. element.addEventListener("updatefromsandbox", function (jsEvent) {
  15417. var actions = {
  15418. value: function value(event) {
  15419. event.target.checked = event.detail.value !== "Off";
  15420. storage.setValue(id, {
  15421. value: event.target.checked
  15422. });
  15423. }
  15424. };
  15425. _this8._dispatchEventFromSandbox(actions, jsEvent);
  15426. });
  15427. this._setEventListeners(element, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], function (event) {
  15428. return event.target.checked;
  15429. });
  15430. }
  15431. this._setBackgroundColor(element);
  15432. this._setDefaultPropertiesFromJS(element);
  15433. this.container.appendChild(element);
  15434. return this.container;
  15435. }
  15436. }]);
  15437. return CheckboxWidgetAnnotationElement;
  15438. }(WidgetAnnotationElement);
  15439. var RadioButtonWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem3) {
  15440. _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3);
  15441. var _super6 = _createSuper(RadioButtonWidgetAnnotationElement);
  15442. function RadioButtonWidgetAnnotationElement(parameters) {
  15443. _classCallCheck(this, RadioButtonWidgetAnnotationElement);
  15444. return _super6.call(this, parameters, {
  15445. isRenderable: parameters.renderForms
  15446. });
  15447. }
  15448. _createClass(RadioButtonWidgetAnnotationElement, [{
  15449. key: "render",
  15450. value: function render() {
  15451. var _this9 = this;
  15452. this.container.className = "buttonWidgetAnnotation radioButton";
  15453. var storage = this.annotationStorage;
  15454. var data = this.data;
  15455. var id = data.id;
  15456. var value = storage.getValue(id, {
  15457. value: data.fieldValue === data.buttonValue
  15458. }).value;
  15459. if (typeof value === "string") {
  15460. value = value !== data.buttonValue;
  15461. storage.setValue(id, {
  15462. value: value
  15463. });
  15464. }
  15465. var element = document.createElement("input");
  15466. GetElementsByNameSet.add(element);
  15467. element.disabled = data.readOnly;
  15468. element.type = "radio";
  15469. element.name = data.fieldName;
  15470. if (value) {
  15471. element.setAttribute("checked", true);
  15472. }
  15473. element.setAttribute("id", id);
  15474. element.tabIndex = DEFAULT_TAB_INDEX;
  15475. element.addEventListener("change", function (event) {
  15476. var _event$target3 = event.target,
  15477. name = _event$target3.name,
  15478. checked = _event$target3.checked;
  15479. var _iterator11 = _createForOfIteratorHelper(_this9._getElementsByName(name, id)),
  15480. _step11;
  15481. try {
  15482. for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
  15483. var radio = _step11.value;
  15484. storage.setValue(radio.id, {
  15485. value: false
  15486. });
  15487. }
  15488. } catch (err) {
  15489. _iterator11.e(err);
  15490. } finally {
  15491. _iterator11.f();
  15492. }
  15493. storage.setValue(id, {
  15494. value: checked
  15495. });
  15496. });
  15497. element.addEventListener("resetform", function (event) {
  15498. var defaultValue = data.defaultFieldValue;
  15499. event.target.checked = defaultValue !== null && defaultValue !== undefined && defaultValue === data.buttonValue;
  15500. });
  15501. if (this.enableScripting && this.hasJSActions) {
  15502. var pdfButtonValue = data.buttonValue;
  15503. element.addEventListener("updatefromsandbox", function (jsEvent) {
  15504. var actions = {
  15505. value: function value(event) {
  15506. var checked = pdfButtonValue === event.detail.value;
  15507. var _iterator12 = _createForOfIteratorHelper(_this9._getElementsByName(event.target.name)),
  15508. _step12;
  15509. try {
  15510. for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
  15511. var radio = _step12.value;
  15512. var curChecked = checked && radio.id === id;
  15513. if (radio.domElement) {
  15514. radio.domElement.checked = curChecked;
  15515. }
  15516. storage.setValue(radio.id, {
  15517. value: curChecked
  15518. });
  15519. }
  15520. } catch (err) {
  15521. _iterator12.e(err);
  15522. } finally {
  15523. _iterator12.f();
  15524. }
  15525. }
  15526. };
  15527. _this9._dispatchEventFromSandbox(actions, jsEvent);
  15528. });
  15529. this._setEventListeners(element, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], function (event) {
  15530. return event.target.checked;
  15531. });
  15532. }
  15533. this._setBackgroundColor(element);
  15534. this._setDefaultPropertiesFromJS(element);
  15535. this.container.appendChild(element);
  15536. return this.container;
  15537. }
  15538. }]);
  15539. return RadioButtonWidgetAnnotationElement;
  15540. }(WidgetAnnotationElement);
  15541. var PushButtonWidgetAnnotationElement = /*#__PURE__*/function (_LinkAnnotationElemen) {
  15542. _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen);
  15543. var _super7 = _createSuper(PushButtonWidgetAnnotationElement);
  15544. function PushButtonWidgetAnnotationElement(parameters) {
  15545. _classCallCheck(this, PushButtonWidgetAnnotationElement);
  15546. return _super7.call(this, parameters, {
  15547. ignoreBorder: parameters.data.hasAppearance
  15548. });
  15549. }
  15550. _createClass(PushButtonWidgetAnnotationElement, [{
  15551. key: "render",
  15552. value: function render() {
  15553. var container = _get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), "render", this).call(this);
  15554. container.className = "buttonWidgetAnnotation pushButton";
  15555. if (this.data.alternativeText) {
  15556. container.title = this.data.alternativeText;
  15557. }
  15558. this._setDefaultPropertiesFromJS(container);
  15559. return container;
  15560. }
  15561. }]);
  15562. return PushButtonWidgetAnnotationElement;
  15563. }(LinkAnnotationElement);
  15564. var ChoiceWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem4) {
  15565. _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4);
  15566. var _super8 = _createSuper(ChoiceWidgetAnnotationElement);
  15567. function ChoiceWidgetAnnotationElement(parameters) {
  15568. _classCallCheck(this, ChoiceWidgetAnnotationElement);
  15569. return _super8.call(this, parameters, {
  15570. isRenderable: parameters.renderForms
  15571. });
  15572. }
  15573. _createClass(ChoiceWidgetAnnotationElement, [{
  15574. key: "render",
  15575. value: function render() {
  15576. var _this10 = this;
  15577. this.container.className = "choiceWidgetAnnotation";
  15578. var storage = this.annotationStorage;
  15579. var id = this.data.id;
  15580. var storedData = storage.getValue(id, {
  15581. value: this.data.fieldValue
  15582. });
  15583. var fontSize = this.data.defaultAppearanceData.fontSize;
  15584. if (!fontSize) {
  15585. fontSize = 9;
  15586. }
  15587. var fontSizeStyle = "calc(".concat(fontSize, "px * var(--zoom-factor))");
  15588. var selectElement = document.createElement("select");
  15589. GetElementsByNameSet.add(selectElement);
  15590. selectElement.disabled = this.data.readOnly;
  15591. selectElement.name = this.data.fieldName;
  15592. selectElement.setAttribute("id", id);
  15593. selectElement.tabIndex = DEFAULT_TAB_INDEX;
  15594. selectElement.style.fontSize = "".concat(fontSize, "px");
  15595. if (!this.data.combo) {
  15596. selectElement.size = this.data.options.length;
  15597. if (this.data.multiSelect) {
  15598. selectElement.multiple = true;
  15599. }
  15600. }
  15601. selectElement.addEventListener("resetform", function (event) {
  15602. var defaultValue = _this10.data.defaultFieldValue;
  15603. var _iterator13 = _createForOfIteratorHelper(selectElement.options),
  15604. _step13;
  15605. try {
  15606. for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
  15607. var option = _step13.value;
  15608. option.selected = option.value === defaultValue;
  15609. }
  15610. } catch (err) {
  15611. _iterator13.e(err);
  15612. } finally {
  15613. _iterator13.f();
  15614. }
  15615. });
  15616. var _iterator14 = _createForOfIteratorHelper(this.data.options),
  15617. _step14;
  15618. try {
  15619. for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
  15620. var option = _step14.value;
  15621. var optionElement = document.createElement("option");
  15622. optionElement.textContent = option.displayValue;
  15623. optionElement.value = option.exportValue;
  15624. if (this.data.combo) {
  15625. optionElement.style.fontSize = fontSizeStyle;
  15626. }
  15627. if (storedData.value.includes(option.exportValue)) {
  15628. optionElement.setAttribute("selected", true);
  15629. }
  15630. selectElement.appendChild(optionElement);
  15631. }
  15632. } catch (err) {
  15633. _iterator14.e(err);
  15634. } finally {
  15635. _iterator14.f();
  15636. }
  15637. var getValue = function getValue(event, isExport) {
  15638. var name = isExport ? "value" : "textContent";
  15639. var options = event.target.options;
  15640. if (!event.target.multiple) {
  15641. return options.selectedIndex === -1 ? null : options[options.selectedIndex][name];
  15642. }
  15643. return Array.prototype.filter.call(options, function (option) {
  15644. return option.selected;
  15645. }).map(function (option) {
  15646. return option[name];
  15647. });
  15648. };
  15649. var getItems = function getItems(event) {
  15650. var options = event.target.options;
  15651. return Array.prototype.map.call(options, function (option) {
  15652. return {
  15653. displayValue: option.textContent,
  15654. exportValue: option.value
  15655. };
  15656. });
  15657. };
  15658. if (this.enableScripting && this.hasJSActions) {
  15659. selectElement.addEventListener("updatefromsandbox", function (jsEvent) {
  15660. var actions = {
  15661. value: function value(event) {
  15662. var value = event.detail.value;
  15663. var values = new Set(Array.isArray(value) ? value : [value]);
  15664. var _iterator15 = _createForOfIteratorHelper(selectElement.options),
  15665. _step15;
  15666. try {
  15667. for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
  15668. var option = _step15.value;
  15669. option.selected = values.has(option.value);
  15670. }
  15671. } catch (err) {
  15672. _iterator15.e(err);
  15673. } finally {
  15674. _iterator15.f();
  15675. }
  15676. storage.setValue(id, {
  15677. value: getValue(event, true)
  15678. });
  15679. },
  15680. multipleSelection: function multipleSelection(event) {
  15681. selectElement.multiple = true;
  15682. },
  15683. remove: function remove(event) {
  15684. var options = selectElement.options;
  15685. var index = event.detail.remove;
  15686. options[index].selected = false;
  15687. selectElement.remove(index);
  15688. if (options.length > 0) {
  15689. var i = Array.prototype.findIndex.call(options, function (option) {
  15690. return option.selected;
  15691. });
  15692. if (i === -1) {
  15693. options[0].selected = true;
  15694. }
  15695. }
  15696. storage.setValue(id, {
  15697. value: getValue(event, true),
  15698. items: getItems(event)
  15699. });
  15700. },
  15701. clear: function clear(event) {
  15702. while (selectElement.length !== 0) {
  15703. selectElement.remove(0);
  15704. }
  15705. storage.setValue(id, {
  15706. value: null,
  15707. items: []
  15708. });
  15709. },
  15710. insert: function insert(event) {
  15711. var _event$detail$insert = event.detail.insert,
  15712. index = _event$detail$insert.index,
  15713. displayValue = _event$detail$insert.displayValue,
  15714. exportValue = _event$detail$insert.exportValue;
  15715. var optionElement = document.createElement("option");
  15716. optionElement.textContent = displayValue;
  15717. optionElement.value = exportValue;
  15718. selectElement.insertBefore(optionElement, selectElement.children[index]);
  15719. storage.setValue(id, {
  15720. value: getValue(event, true),
  15721. items: getItems(event)
  15722. });
  15723. },
  15724. items: function items(event) {
  15725. var items = event.detail.items;
  15726. while (selectElement.length !== 0) {
  15727. selectElement.remove(0);
  15728. }
  15729. var _iterator16 = _createForOfIteratorHelper(items),
  15730. _step16;
  15731. try {
  15732. for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
  15733. var item = _step16.value;
  15734. var displayValue = item.displayValue,
  15735. exportValue = item.exportValue;
  15736. var optionElement = document.createElement("option");
  15737. optionElement.textContent = displayValue;
  15738. optionElement.value = exportValue;
  15739. selectElement.appendChild(optionElement);
  15740. }
  15741. } catch (err) {
  15742. _iterator16.e(err);
  15743. } finally {
  15744. _iterator16.f();
  15745. }
  15746. if (selectElement.options.length > 0) {
  15747. selectElement.options[0].selected = true;
  15748. }
  15749. storage.setValue(id, {
  15750. value: getValue(event, true),
  15751. items: getItems(event)
  15752. });
  15753. },
  15754. indices: function indices(event) {
  15755. var indices = new Set(event.detail.indices);
  15756. var _iterator17 = _createForOfIteratorHelper(event.target.options),
  15757. _step17;
  15758. try {
  15759. for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
  15760. var option = _step17.value;
  15761. option.selected = indices.has(option.index);
  15762. }
  15763. } catch (err) {
  15764. _iterator17.e(err);
  15765. } finally {
  15766. _iterator17.f();
  15767. }
  15768. storage.setValue(id, {
  15769. value: getValue(event, true)
  15770. });
  15771. },
  15772. editable: function editable(event) {
  15773. event.target.disabled = !event.detail.editable;
  15774. }
  15775. };
  15776. _this10._dispatchEventFromSandbox(actions, jsEvent);
  15777. });
  15778. selectElement.addEventListener("input", function (event) {
  15779. var _this10$linkService$e;
  15780. var exportValue = getValue(event, true);
  15781. var value = getValue(event, false);
  15782. storage.setValue(id, {
  15783. value: exportValue
  15784. });
  15785. (_this10$linkService$e = _this10.linkService.eventBus) === null || _this10$linkService$e === void 0 ? void 0 : _this10$linkService$e.dispatch("dispatcheventinsandbox", {
  15786. source: _this10,
  15787. detail: {
  15788. id: id,
  15789. name: "Keystroke",
  15790. value: value,
  15791. changeEx: exportValue,
  15792. willCommit: true,
  15793. commitKey: 1,
  15794. keyDown: false
  15795. }
  15796. });
  15797. });
  15798. this._setEventListeners(selectElement, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"]], function (event) {
  15799. return event.target.checked;
  15800. });
  15801. } else {
  15802. selectElement.addEventListener("input", function (event) {
  15803. storage.setValue(id, {
  15804. value: getValue(event, true)
  15805. });
  15806. });
  15807. }
  15808. this._setBackgroundColor(selectElement);
  15809. this._setDefaultPropertiesFromJS(selectElement);
  15810. this.container.appendChild(selectElement);
  15811. return this.container;
  15812. }
  15813. }]);
  15814. return ChoiceWidgetAnnotationElement;
  15815. }(WidgetAnnotationElement);
  15816. var PopupAnnotationElement = /*#__PURE__*/function (_AnnotationElement4) {
  15817. _inherits(PopupAnnotationElement, _AnnotationElement4);
  15818. var _super9 = _createSuper(PopupAnnotationElement);
  15819. function PopupAnnotationElement(parameters) {
  15820. var _parameters$data$titl2, _parameters$data$cont2, _parameters$data$rich2;
  15821. _classCallCheck(this, PopupAnnotationElement);
  15822. var isRenderable = !!((_parameters$data$titl2 = parameters.data.titleObj) !== null && _parameters$data$titl2 !== void 0 && _parameters$data$titl2.str || (_parameters$data$cont2 = parameters.data.contentsObj) !== null && _parameters$data$cont2 !== void 0 && _parameters$data$cont2.str || (_parameters$data$rich2 = parameters.data.richText) !== null && _parameters$data$rich2 !== void 0 && _parameters$data$rich2.str);
  15823. return _super9.call(this, parameters, {
  15824. isRenderable: isRenderable
  15825. });
  15826. }
  15827. _createClass(PopupAnnotationElement, [{
  15828. key: "render",
  15829. value: function render() {
  15830. var IGNORE_TYPES = ["Line", "Square", "Circle", "PolyLine", "Polygon", "Ink"];
  15831. this.container.className = "popupAnnotation";
  15832. if (IGNORE_TYPES.includes(this.data.parentType)) {
  15833. return this.container;
  15834. }
  15835. var selector = "[data-annotation-id=\"".concat(this.data.parentId, "\"]");
  15836. var parentElements = this.layer.querySelectorAll(selector);
  15837. if (parentElements.length === 0) {
  15838. return this.container;
  15839. }
  15840. var popup = new PopupElement({
  15841. container: this.container,
  15842. trigger: Array.from(parentElements),
  15843. color: this.data.color,
  15844. titleObj: this.data.titleObj,
  15845. modificationDate: this.data.modificationDate,
  15846. contentsObj: this.data.contentsObj,
  15847. richText: this.data.richText
  15848. });
  15849. var page = this.page;
  15850. var rect = _util.Util.normalizeRect([this.data.parentRect[0], page.view[3] - this.data.parentRect[1] + page.view[1], this.data.parentRect[2], page.view[3] - this.data.parentRect[3] + page.view[1]]);
  15851. var popupLeft = rect[0] + this.data.parentRect[2] - this.data.parentRect[0];
  15852. var popupTop = rect[1];
  15853. this.container.style.transformOrigin = "".concat(-popupLeft, "px ").concat(-popupTop, "px");
  15854. this.container.style.left = "".concat(popupLeft, "px");
  15855. this.container.style.top = "".concat(popupTop, "px");
  15856. this.container.appendChild(popup.render());
  15857. return this.container;
  15858. }
  15859. }]);
  15860. return PopupAnnotationElement;
  15861. }(AnnotationElement);
  15862. var PopupElement = /*#__PURE__*/function () {
  15863. function PopupElement(parameters) {
  15864. _classCallCheck(this, PopupElement);
  15865. this.container = parameters.container;
  15866. this.trigger = parameters.trigger;
  15867. this.color = parameters.color;
  15868. this.titleObj = parameters.titleObj;
  15869. this.modificationDate = parameters.modificationDate;
  15870. this.contentsObj = parameters.contentsObj;
  15871. this.richText = parameters.richText;
  15872. this.hideWrapper = parameters.hideWrapper || false;
  15873. this.pinned = false;
  15874. }
  15875. _createClass(PopupElement, [{
  15876. key: "render",
  15877. value: function render() {
  15878. var _this$richText, _this$contentsObj;
  15879. var BACKGROUND_ENLIGHT = 0.7;
  15880. var wrapper = document.createElement("div");
  15881. wrapper.className = "popupWrapper";
  15882. this.hideElement = this.hideWrapper ? wrapper : this.container;
  15883. this.hideElement.hidden = true;
  15884. var popup = document.createElement("div");
  15885. popup.className = "popup";
  15886. var color = this.color;
  15887. if (color) {
  15888. var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
  15889. var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
  15890. var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
  15891. popup.style.backgroundColor = _util.Util.makeHexColor(r | 0, g | 0, b | 0);
  15892. }
  15893. var title = document.createElement("h1");
  15894. title.dir = this.titleObj.dir;
  15895. title.textContent = this.titleObj.str;
  15896. popup.appendChild(title);
  15897. var dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate);
  15898. if (dateObject) {
  15899. var modificationDate = document.createElement("span");
  15900. modificationDate.className = "popupDate";
  15901. modificationDate.textContent = "{{date}}, {{time}}";
  15902. modificationDate.dataset.l10nId = "annotation_date_string";
  15903. modificationDate.dataset.l10nArgs = JSON.stringify({
  15904. date: dateObject.toLocaleDateString(),
  15905. time: dateObject.toLocaleTimeString()
  15906. });
  15907. popup.appendChild(modificationDate);
  15908. }
  15909. if ((_this$richText = this.richText) !== null && _this$richText !== void 0 && _this$richText.str && (!((_this$contentsObj = this.contentsObj) !== null && _this$contentsObj !== void 0 && _this$contentsObj.str) || this.contentsObj.str === this.richText.str)) {
  15910. _xfa_layer.XfaLayer.render({
  15911. xfaHtml: this.richText.html,
  15912. intent: "richText",
  15913. div: popup
  15914. });
  15915. popup.lastChild.className = "richText popupContent";
  15916. } else {
  15917. var contents = this._formatContents(this.contentsObj);
  15918. popup.appendChild(contents);
  15919. }
  15920. if (!Array.isArray(this.trigger)) {
  15921. this.trigger = [this.trigger];
  15922. }
  15923. var _iterator18 = _createForOfIteratorHelper(this.trigger),
  15924. _step18;
  15925. try {
  15926. for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
  15927. var element = _step18.value;
  15928. element.addEventListener("click", this._toggle.bind(this));
  15929. element.addEventListener("mouseover", this._show.bind(this, false));
  15930. element.addEventListener("mouseout", this._hide.bind(this, false));
  15931. }
  15932. } catch (err) {
  15933. _iterator18.e(err);
  15934. } finally {
  15935. _iterator18.f();
  15936. }
  15937. popup.addEventListener("click", this._hide.bind(this, true));
  15938. wrapper.appendChild(popup);
  15939. return wrapper;
  15940. }
  15941. }, {
  15942. key: "_formatContents",
  15943. value: function _formatContents(_ref2) {
  15944. var str = _ref2.str,
  15945. dir = _ref2.dir;
  15946. var p = document.createElement("p");
  15947. p.className = "popupContent";
  15948. p.dir = dir;
  15949. var lines = str.split(/(?:\r\n?|\n)/);
  15950. for (var i = 0, ii = lines.length; i < ii; ++i) {
  15951. var line = lines[i];
  15952. p.appendChild(document.createTextNode(line));
  15953. if (i < ii - 1) {
  15954. p.appendChild(document.createElement("br"));
  15955. }
  15956. }
  15957. return p;
  15958. }
  15959. }, {
  15960. key: "_toggle",
  15961. value: function _toggle() {
  15962. if (this.pinned) {
  15963. this._hide(true);
  15964. } else {
  15965. this._show(true);
  15966. }
  15967. }
  15968. }, {
  15969. key: "_show",
  15970. value: function _show() {
  15971. var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  15972. if (pin) {
  15973. this.pinned = true;
  15974. }
  15975. if (this.hideElement.hidden) {
  15976. this.hideElement.hidden = false;
  15977. this.container.style.zIndex += 1;
  15978. }
  15979. }
  15980. }, {
  15981. key: "_hide",
  15982. value: function _hide() {
  15983. var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  15984. if (unpin) {
  15985. this.pinned = false;
  15986. }
  15987. if (!this.hideElement.hidden && !this.pinned) {
  15988. this.hideElement.hidden = true;
  15989. this.container.style.zIndex -= 1;
  15990. }
  15991. }
  15992. }]);
  15993. return PopupElement;
  15994. }();
  15995. var FreeTextAnnotationElement = /*#__PURE__*/function (_AnnotationElement5) {
  15996. _inherits(FreeTextAnnotationElement, _AnnotationElement5);
  15997. var _super10 = _createSuper(FreeTextAnnotationElement);
  15998. function FreeTextAnnotationElement(parameters) {
  15999. var _parameters$data$titl3, _parameters$data$cont3, _parameters$data$rich3;
  16000. _classCallCheck(this, FreeTextAnnotationElement);
  16001. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl3 = parameters.data.titleObj) !== null && _parameters$data$titl3 !== void 0 && _parameters$data$titl3.str || (_parameters$data$cont3 = parameters.data.contentsObj) !== null && _parameters$data$cont3 !== void 0 && _parameters$data$cont3.str || (_parameters$data$rich3 = parameters.data.richText) !== null && _parameters$data$rich3 !== void 0 && _parameters$data$rich3.str);
  16002. return _super10.call(this, parameters, {
  16003. isRenderable: isRenderable,
  16004. ignoreBorder: true
  16005. });
  16006. }
  16007. _createClass(FreeTextAnnotationElement, [{
  16008. key: "render",
  16009. value: function render() {
  16010. this.container.className = "freeTextAnnotation";
  16011. if (!this.data.hasPopup) {
  16012. this._createPopup(null, this.data);
  16013. }
  16014. return this.container;
  16015. }
  16016. }]);
  16017. return FreeTextAnnotationElement;
  16018. }(AnnotationElement);
  16019. var LineAnnotationElement = /*#__PURE__*/function (_AnnotationElement6) {
  16020. _inherits(LineAnnotationElement, _AnnotationElement6);
  16021. var _super11 = _createSuper(LineAnnotationElement);
  16022. function LineAnnotationElement(parameters) {
  16023. var _parameters$data$titl4, _parameters$data$cont4, _parameters$data$rich4;
  16024. _classCallCheck(this, LineAnnotationElement);
  16025. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl4 = parameters.data.titleObj) !== null && _parameters$data$titl4 !== void 0 && _parameters$data$titl4.str || (_parameters$data$cont4 = parameters.data.contentsObj) !== null && _parameters$data$cont4 !== void 0 && _parameters$data$cont4.str || (_parameters$data$rich4 = parameters.data.richText) !== null && _parameters$data$rich4 !== void 0 && _parameters$data$rich4.str);
  16026. return _super11.call(this, parameters, {
  16027. isRenderable: isRenderable,
  16028. ignoreBorder: true
  16029. });
  16030. }
  16031. _createClass(LineAnnotationElement, [{
  16032. key: "render",
  16033. value: function render() {
  16034. this.container.className = "lineAnnotation";
  16035. var data = this.data;
  16036. var _getRectDims2 = getRectDims(data.rect),
  16037. width = _getRectDims2.width,
  16038. height = _getRectDims2.height;
  16039. var svg = this.svgFactory.create(width, height);
  16040. var line = this.svgFactory.createElement("svg:line");
  16041. line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
  16042. line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
  16043. line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
  16044. line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
  16045. line.setAttribute("stroke-width", data.borderStyle.width || 1);
  16046. line.setAttribute("stroke", "transparent");
  16047. line.setAttribute("fill", "transparent");
  16048. svg.appendChild(line);
  16049. this.container.append(svg);
  16050. this._createPopup(line, data);
  16051. return this.container;
  16052. }
  16053. }]);
  16054. return LineAnnotationElement;
  16055. }(AnnotationElement);
  16056. var SquareAnnotationElement = /*#__PURE__*/function (_AnnotationElement7) {
  16057. _inherits(SquareAnnotationElement, _AnnotationElement7);
  16058. var _super12 = _createSuper(SquareAnnotationElement);
  16059. function SquareAnnotationElement(parameters) {
  16060. var _parameters$data$titl5, _parameters$data$cont5, _parameters$data$rich5;
  16061. _classCallCheck(this, SquareAnnotationElement);
  16062. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl5 = parameters.data.titleObj) !== null && _parameters$data$titl5 !== void 0 && _parameters$data$titl5.str || (_parameters$data$cont5 = parameters.data.contentsObj) !== null && _parameters$data$cont5 !== void 0 && _parameters$data$cont5.str || (_parameters$data$rich5 = parameters.data.richText) !== null && _parameters$data$rich5 !== void 0 && _parameters$data$rich5.str);
  16063. return _super12.call(this, parameters, {
  16064. isRenderable: isRenderable,
  16065. ignoreBorder: true
  16066. });
  16067. }
  16068. _createClass(SquareAnnotationElement, [{
  16069. key: "render",
  16070. value: function render() {
  16071. this.container.className = "squareAnnotation";
  16072. var data = this.data;
  16073. var _getRectDims3 = getRectDims(data.rect),
  16074. width = _getRectDims3.width,
  16075. height = _getRectDims3.height;
  16076. var svg = this.svgFactory.create(width, height);
  16077. var borderWidth = data.borderStyle.width;
  16078. var square = this.svgFactory.createElement("svg:rect");
  16079. square.setAttribute("x", borderWidth / 2);
  16080. square.setAttribute("y", borderWidth / 2);
  16081. square.setAttribute("width", width - borderWidth);
  16082. square.setAttribute("height", height - borderWidth);
  16083. square.setAttribute("stroke-width", borderWidth || 1);
  16084. square.setAttribute("stroke", "transparent");
  16085. square.setAttribute("fill", "transparent");
  16086. svg.appendChild(square);
  16087. this.container.append(svg);
  16088. this._createPopup(square, data);
  16089. return this.container;
  16090. }
  16091. }]);
  16092. return SquareAnnotationElement;
  16093. }(AnnotationElement);
  16094. var CircleAnnotationElement = /*#__PURE__*/function (_AnnotationElement8) {
  16095. _inherits(CircleAnnotationElement, _AnnotationElement8);
  16096. var _super13 = _createSuper(CircleAnnotationElement);
  16097. function CircleAnnotationElement(parameters) {
  16098. var _parameters$data$titl6, _parameters$data$cont6, _parameters$data$rich6;
  16099. _classCallCheck(this, CircleAnnotationElement);
  16100. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl6 = parameters.data.titleObj) !== null && _parameters$data$titl6 !== void 0 && _parameters$data$titl6.str || (_parameters$data$cont6 = parameters.data.contentsObj) !== null && _parameters$data$cont6 !== void 0 && _parameters$data$cont6.str || (_parameters$data$rich6 = parameters.data.richText) !== null && _parameters$data$rich6 !== void 0 && _parameters$data$rich6.str);
  16101. return _super13.call(this, parameters, {
  16102. isRenderable: isRenderable,
  16103. ignoreBorder: true
  16104. });
  16105. }
  16106. _createClass(CircleAnnotationElement, [{
  16107. key: "render",
  16108. value: function render() {
  16109. this.container.className = "circleAnnotation";
  16110. var data = this.data;
  16111. var _getRectDims4 = getRectDims(data.rect),
  16112. width = _getRectDims4.width,
  16113. height = _getRectDims4.height;
  16114. var svg = this.svgFactory.create(width, height);
  16115. var borderWidth = data.borderStyle.width;
  16116. var circle = this.svgFactory.createElement("svg:ellipse");
  16117. circle.setAttribute("cx", width / 2);
  16118. circle.setAttribute("cy", height / 2);
  16119. circle.setAttribute("rx", width / 2 - borderWidth / 2);
  16120. circle.setAttribute("ry", height / 2 - borderWidth / 2);
  16121. circle.setAttribute("stroke-width", borderWidth || 1);
  16122. circle.setAttribute("stroke", "transparent");
  16123. circle.setAttribute("fill", "transparent");
  16124. svg.appendChild(circle);
  16125. this.container.append(svg);
  16126. this._createPopup(circle, data);
  16127. return this.container;
  16128. }
  16129. }]);
  16130. return CircleAnnotationElement;
  16131. }(AnnotationElement);
  16132. var PolylineAnnotationElement = /*#__PURE__*/function (_AnnotationElement9) {
  16133. _inherits(PolylineAnnotationElement, _AnnotationElement9);
  16134. var _super14 = _createSuper(PolylineAnnotationElement);
  16135. function PolylineAnnotationElement(parameters) {
  16136. var _parameters$data$titl7, _parameters$data$cont7, _parameters$data$rich7;
  16137. var _this11;
  16138. _classCallCheck(this, PolylineAnnotationElement);
  16139. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl7 = parameters.data.titleObj) !== null && _parameters$data$titl7 !== void 0 && _parameters$data$titl7.str || (_parameters$data$cont7 = parameters.data.contentsObj) !== null && _parameters$data$cont7 !== void 0 && _parameters$data$cont7.str || (_parameters$data$rich7 = parameters.data.richText) !== null && _parameters$data$rich7 !== void 0 && _parameters$data$rich7.str);
  16140. _this11 = _super14.call(this, parameters, {
  16141. isRenderable: isRenderable,
  16142. ignoreBorder: true
  16143. });
  16144. _this11.containerClassName = "polylineAnnotation";
  16145. _this11.svgElementName = "svg:polyline";
  16146. return _this11;
  16147. }
  16148. _createClass(PolylineAnnotationElement, [{
  16149. key: "render",
  16150. value: function render() {
  16151. this.container.className = this.containerClassName;
  16152. var data = this.data;
  16153. var _getRectDims5 = getRectDims(data.rect),
  16154. width = _getRectDims5.width,
  16155. height = _getRectDims5.height;
  16156. var svg = this.svgFactory.create(width, height);
  16157. var points = [];
  16158. var _iterator19 = _createForOfIteratorHelper(data.vertices),
  16159. _step19;
  16160. try {
  16161. for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
  16162. var coordinate = _step19.value;
  16163. var x = coordinate.x - data.rect[0];
  16164. var y = data.rect[3] - coordinate.y;
  16165. points.push(x + "," + y);
  16166. }
  16167. } catch (err) {
  16168. _iterator19.e(err);
  16169. } finally {
  16170. _iterator19.f();
  16171. }
  16172. points = points.join(" ");
  16173. var polyline = this.svgFactory.createElement(this.svgElementName);
  16174. polyline.setAttribute("points", points);
  16175. polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
  16176. polyline.setAttribute("stroke", "transparent");
  16177. polyline.setAttribute("fill", "transparent");
  16178. svg.appendChild(polyline);
  16179. this.container.append(svg);
  16180. this._createPopup(polyline, data);
  16181. return this.container;
  16182. }
  16183. }]);
  16184. return PolylineAnnotationElement;
  16185. }(AnnotationElement);
  16186. var PolygonAnnotationElement = /*#__PURE__*/function (_PolylineAnnotationEl) {
  16187. _inherits(PolygonAnnotationElement, _PolylineAnnotationEl);
  16188. var _super15 = _createSuper(PolygonAnnotationElement);
  16189. function PolygonAnnotationElement(parameters) {
  16190. var _this12;
  16191. _classCallCheck(this, PolygonAnnotationElement);
  16192. _this12 = _super15.call(this, parameters);
  16193. _this12.containerClassName = "polygonAnnotation";
  16194. _this12.svgElementName = "svg:polygon";
  16195. return _this12;
  16196. }
  16197. return _createClass(PolygonAnnotationElement);
  16198. }(PolylineAnnotationElement);
  16199. var CaretAnnotationElement = /*#__PURE__*/function (_AnnotationElement10) {
  16200. _inherits(CaretAnnotationElement, _AnnotationElement10);
  16201. var _super16 = _createSuper(CaretAnnotationElement);
  16202. function CaretAnnotationElement(parameters) {
  16203. var _parameters$data$titl8, _parameters$data$cont8, _parameters$data$rich8;
  16204. _classCallCheck(this, CaretAnnotationElement);
  16205. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl8 = parameters.data.titleObj) !== null && _parameters$data$titl8 !== void 0 && _parameters$data$titl8.str || (_parameters$data$cont8 = parameters.data.contentsObj) !== null && _parameters$data$cont8 !== void 0 && _parameters$data$cont8.str || (_parameters$data$rich8 = parameters.data.richText) !== null && _parameters$data$rich8 !== void 0 && _parameters$data$rich8.str);
  16206. return _super16.call(this, parameters, {
  16207. isRenderable: isRenderable,
  16208. ignoreBorder: true
  16209. });
  16210. }
  16211. _createClass(CaretAnnotationElement, [{
  16212. key: "render",
  16213. value: function render() {
  16214. this.container.className = "caretAnnotation";
  16215. if (!this.data.hasPopup) {
  16216. this._createPopup(null, this.data);
  16217. }
  16218. return this.container;
  16219. }
  16220. }]);
  16221. return CaretAnnotationElement;
  16222. }(AnnotationElement);
  16223. var InkAnnotationElement = /*#__PURE__*/function (_AnnotationElement11) {
  16224. _inherits(InkAnnotationElement, _AnnotationElement11);
  16225. var _super17 = _createSuper(InkAnnotationElement);
  16226. function InkAnnotationElement(parameters) {
  16227. var _parameters$data$titl9, _parameters$data$cont9, _parameters$data$rich9;
  16228. var _this13;
  16229. _classCallCheck(this, InkAnnotationElement);
  16230. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl9 = parameters.data.titleObj) !== null && _parameters$data$titl9 !== void 0 && _parameters$data$titl9.str || (_parameters$data$cont9 = parameters.data.contentsObj) !== null && _parameters$data$cont9 !== void 0 && _parameters$data$cont9.str || (_parameters$data$rich9 = parameters.data.richText) !== null && _parameters$data$rich9 !== void 0 && _parameters$data$rich9.str);
  16231. _this13 = _super17.call(this, parameters, {
  16232. isRenderable: isRenderable,
  16233. ignoreBorder: true
  16234. });
  16235. _this13.containerClassName = "inkAnnotation";
  16236. _this13.svgElementName = "svg:polyline";
  16237. return _this13;
  16238. }
  16239. _createClass(InkAnnotationElement, [{
  16240. key: "render",
  16241. value: function render() {
  16242. this.container.className = this.containerClassName;
  16243. var data = this.data;
  16244. var _getRectDims6 = getRectDims(data.rect),
  16245. width = _getRectDims6.width,
  16246. height = _getRectDims6.height;
  16247. var svg = this.svgFactory.create(width, height);
  16248. var _iterator20 = _createForOfIteratorHelper(data.inkLists),
  16249. _step20;
  16250. try {
  16251. for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
  16252. var inkList = _step20.value;
  16253. var points = [];
  16254. var _iterator21 = _createForOfIteratorHelper(inkList),
  16255. _step21;
  16256. try {
  16257. for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
  16258. var coordinate = _step21.value;
  16259. var x = coordinate.x - data.rect[0];
  16260. var y = data.rect[3] - coordinate.y;
  16261. points.push("".concat(x, ",").concat(y));
  16262. }
  16263. } catch (err) {
  16264. _iterator21.e(err);
  16265. } finally {
  16266. _iterator21.f();
  16267. }
  16268. points = points.join(" ");
  16269. var polyline = this.svgFactory.createElement(this.svgElementName);
  16270. polyline.setAttribute("points", points);
  16271. polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
  16272. polyline.setAttribute("stroke", "transparent");
  16273. polyline.setAttribute("fill", "transparent");
  16274. this._createPopup(polyline, data);
  16275. svg.appendChild(polyline);
  16276. }
  16277. } catch (err) {
  16278. _iterator20.e(err);
  16279. } finally {
  16280. _iterator20.f();
  16281. }
  16282. this.container.append(svg);
  16283. return this.container;
  16284. }
  16285. }]);
  16286. return InkAnnotationElement;
  16287. }(AnnotationElement);
  16288. var HighlightAnnotationElement = /*#__PURE__*/function (_AnnotationElement12) {
  16289. _inherits(HighlightAnnotationElement, _AnnotationElement12);
  16290. var _super18 = _createSuper(HighlightAnnotationElement);
  16291. function HighlightAnnotationElement(parameters) {
  16292. var _parameters$data$titl10, _parameters$data$cont10, _parameters$data$rich10;
  16293. _classCallCheck(this, HighlightAnnotationElement);
  16294. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl10 = parameters.data.titleObj) !== null && _parameters$data$titl10 !== void 0 && _parameters$data$titl10.str || (_parameters$data$cont10 = parameters.data.contentsObj) !== null && _parameters$data$cont10 !== void 0 && _parameters$data$cont10.str || (_parameters$data$rich10 = parameters.data.richText) !== null && _parameters$data$rich10 !== void 0 && _parameters$data$rich10.str);
  16295. return _super18.call(this, parameters, {
  16296. isRenderable: isRenderable,
  16297. ignoreBorder: true,
  16298. createQuadrilaterals: true
  16299. });
  16300. }
  16301. _createClass(HighlightAnnotationElement, [{
  16302. key: "render",
  16303. value: function render() {
  16304. if (!this.data.hasPopup) {
  16305. this._createPopup(null, this.data);
  16306. }
  16307. if (this.quadrilaterals) {
  16308. return this._renderQuadrilaterals("highlightAnnotation");
  16309. }
  16310. this.container.className = "highlightAnnotation";
  16311. return this.container;
  16312. }
  16313. }]);
  16314. return HighlightAnnotationElement;
  16315. }(AnnotationElement);
  16316. var UnderlineAnnotationElement = /*#__PURE__*/function (_AnnotationElement13) {
  16317. _inherits(UnderlineAnnotationElement, _AnnotationElement13);
  16318. var _super19 = _createSuper(UnderlineAnnotationElement);
  16319. function UnderlineAnnotationElement(parameters) {
  16320. var _parameters$data$titl11, _parameters$data$cont11, _parameters$data$rich11;
  16321. _classCallCheck(this, UnderlineAnnotationElement);
  16322. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl11 = parameters.data.titleObj) !== null && _parameters$data$titl11 !== void 0 && _parameters$data$titl11.str || (_parameters$data$cont11 = parameters.data.contentsObj) !== null && _parameters$data$cont11 !== void 0 && _parameters$data$cont11.str || (_parameters$data$rich11 = parameters.data.richText) !== null && _parameters$data$rich11 !== void 0 && _parameters$data$rich11.str);
  16323. return _super19.call(this, parameters, {
  16324. isRenderable: isRenderable,
  16325. ignoreBorder: true,
  16326. createQuadrilaterals: true
  16327. });
  16328. }
  16329. _createClass(UnderlineAnnotationElement, [{
  16330. key: "render",
  16331. value: function render() {
  16332. if (!this.data.hasPopup) {
  16333. this._createPopup(null, this.data);
  16334. }
  16335. if (this.quadrilaterals) {
  16336. return this._renderQuadrilaterals("underlineAnnotation");
  16337. }
  16338. this.container.className = "underlineAnnotation";
  16339. return this.container;
  16340. }
  16341. }]);
  16342. return UnderlineAnnotationElement;
  16343. }(AnnotationElement);
  16344. var SquigglyAnnotationElement = /*#__PURE__*/function (_AnnotationElement14) {
  16345. _inherits(SquigglyAnnotationElement, _AnnotationElement14);
  16346. var _super20 = _createSuper(SquigglyAnnotationElement);
  16347. function SquigglyAnnotationElement(parameters) {
  16348. var _parameters$data$titl12, _parameters$data$cont12, _parameters$data$rich12;
  16349. _classCallCheck(this, SquigglyAnnotationElement);
  16350. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl12 = parameters.data.titleObj) !== null && _parameters$data$titl12 !== void 0 && _parameters$data$titl12.str || (_parameters$data$cont12 = parameters.data.contentsObj) !== null && _parameters$data$cont12 !== void 0 && _parameters$data$cont12.str || (_parameters$data$rich12 = parameters.data.richText) !== null && _parameters$data$rich12 !== void 0 && _parameters$data$rich12.str);
  16351. return _super20.call(this, parameters, {
  16352. isRenderable: isRenderable,
  16353. ignoreBorder: true,
  16354. createQuadrilaterals: true
  16355. });
  16356. }
  16357. _createClass(SquigglyAnnotationElement, [{
  16358. key: "render",
  16359. value: function render() {
  16360. if (!this.data.hasPopup) {
  16361. this._createPopup(null, this.data);
  16362. }
  16363. if (this.quadrilaterals) {
  16364. return this._renderQuadrilaterals("squigglyAnnotation");
  16365. }
  16366. this.container.className = "squigglyAnnotation";
  16367. return this.container;
  16368. }
  16369. }]);
  16370. return SquigglyAnnotationElement;
  16371. }(AnnotationElement);
  16372. var StrikeOutAnnotationElement = /*#__PURE__*/function (_AnnotationElement15) {
  16373. _inherits(StrikeOutAnnotationElement, _AnnotationElement15);
  16374. var _super21 = _createSuper(StrikeOutAnnotationElement);
  16375. function StrikeOutAnnotationElement(parameters) {
  16376. var _parameters$data$titl13, _parameters$data$cont13, _parameters$data$rich13;
  16377. _classCallCheck(this, StrikeOutAnnotationElement);
  16378. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl13 = parameters.data.titleObj) !== null && _parameters$data$titl13 !== void 0 && _parameters$data$titl13.str || (_parameters$data$cont13 = parameters.data.contentsObj) !== null && _parameters$data$cont13 !== void 0 && _parameters$data$cont13.str || (_parameters$data$rich13 = parameters.data.richText) !== null && _parameters$data$rich13 !== void 0 && _parameters$data$rich13.str);
  16379. return _super21.call(this, parameters, {
  16380. isRenderable: isRenderable,
  16381. ignoreBorder: true,
  16382. createQuadrilaterals: true
  16383. });
  16384. }
  16385. _createClass(StrikeOutAnnotationElement, [{
  16386. key: "render",
  16387. value: function render() {
  16388. if (!this.data.hasPopup) {
  16389. this._createPopup(null, this.data);
  16390. }
  16391. if (this.quadrilaterals) {
  16392. return this._renderQuadrilaterals("strikeoutAnnotation");
  16393. }
  16394. this.container.className = "strikeoutAnnotation";
  16395. return this.container;
  16396. }
  16397. }]);
  16398. return StrikeOutAnnotationElement;
  16399. }(AnnotationElement);
  16400. var StampAnnotationElement = /*#__PURE__*/function (_AnnotationElement16) {
  16401. _inherits(StampAnnotationElement, _AnnotationElement16);
  16402. var _super22 = _createSuper(StampAnnotationElement);
  16403. function StampAnnotationElement(parameters) {
  16404. var _parameters$data$titl14, _parameters$data$cont14, _parameters$data$rich14;
  16405. _classCallCheck(this, StampAnnotationElement);
  16406. var isRenderable = !!(parameters.data.hasPopup || (_parameters$data$titl14 = parameters.data.titleObj) !== null && _parameters$data$titl14 !== void 0 && _parameters$data$titl14.str || (_parameters$data$cont14 = parameters.data.contentsObj) !== null && _parameters$data$cont14 !== void 0 && _parameters$data$cont14.str || (_parameters$data$rich14 = parameters.data.richText) !== null && _parameters$data$rich14 !== void 0 && _parameters$data$rich14.str);
  16407. return _super22.call(this, parameters, {
  16408. isRenderable: isRenderable,
  16409. ignoreBorder: true
  16410. });
  16411. }
  16412. _createClass(StampAnnotationElement, [{
  16413. key: "render",
  16414. value: function render() {
  16415. this.container.className = "stampAnnotation";
  16416. if (!this.data.hasPopup) {
  16417. this._createPopup(null, this.data);
  16418. }
  16419. return this.container;
  16420. }
  16421. }]);
  16422. return StampAnnotationElement;
  16423. }(AnnotationElement);
  16424. var FileAttachmentAnnotationElement = /*#__PURE__*/function (_AnnotationElement17) {
  16425. _inherits(FileAttachmentAnnotationElement, _AnnotationElement17);
  16426. var _super23 = _createSuper(FileAttachmentAnnotationElement);
  16427. function FileAttachmentAnnotationElement(parameters) {
  16428. var _this14$linkService$e;
  16429. var _this14;
  16430. _classCallCheck(this, FileAttachmentAnnotationElement);
  16431. _this14 = _super23.call(this, parameters, {
  16432. isRenderable: true
  16433. });
  16434. var _this14$data$file = _this14.data.file,
  16435. filename = _this14$data$file.filename,
  16436. content = _this14$data$file.content;
  16437. _this14.filename = (0, _display_utils.getFilenameFromUrl)(filename);
  16438. _this14.content = content;
  16439. (_this14$linkService$e = _this14.linkService.eventBus) === null || _this14$linkService$e === void 0 ? void 0 : _this14$linkService$e.dispatch("fileattachmentannotation", {
  16440. source: _assertThisInitialized(_this14),
  16441. filename: filename,
  16442. content: content
  16443. });
  16444. return _this14;
  16445. }
  16446. _createClass(FileAttachmentAnnotationElement, [{
  16447. key: "render",
  16448. value: function render() {
  16449. var _this$data$titleObj, _this$data$contentsOb;
  16450. this.container.className = "fileAttachmentAnnotation";
  16451. var trigger = document.createElement("div");
  16452. trigger.style.height = this.container.style.height;
  16453. trigger.style.width = this.container.style.width;
  16454. trigger.addEventListener("dblclick", this._download.bind(this));
  16455. if (!this.data.hasPopup && ((_this$data$titleObj = this.data.titleObj) !== null && _this$data$titleObj !== void 0 && _this$data$titleObj.str || (_this$data$contentsOb = this.data.contentsObj) !== null && _this$data$contentsOb !== void 0 && _this$data$contentsOb.str || this.data.richText)) {
  16456. this._createPopup(trigger, this.data);
  16457. }
  16458. this.container.appendChild(trigger);
  16459. return this.container;
  16460. }
  16461. }, {
  16462. key: "_download",
  16463. value: function _download() {
  16464. var _this$downloadManager;
  16465. (_this$downloadManager = this.downloadManager) === null || _this$downloadManager === void 0 ? void 0 : _this$downloadManager.openOrDownloadData(this.container, this.content, this.filename);
  16466. }
  16467. }]);
  16468. return FileAttachmentAnnotationElement;
  16469. }(AnnotationElement);
  16470. var AnnotationLayer = /*#__PURE__*/function () {
  16471. function AnnotationLayer() {
  16472. _classCallCheck(this, AnnotationLayer);
  16473. }
  16474. _createClass(AnnotationLayer, null, [{
  16475. key: "render",
  16476. value: function render(parameters) {
  16477. var sortedAnnotations = [],
  16478. popupAnnotations = [];
  16479. var _iterator22 = _createForOfIteratorHelper(parameters.annotations),
  16480. _step22;
  16481. try {
  16482. for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
  16483. var _data = _step22.value;
  16484. if (!_data) {
  16485. continue;
  16486. }
  16487. var _getRectDims7 = getRectDims(_data.rect),
  16488. width = _getRectDims7.width,
  16489. height = _getRectDims7.height;
  16490. if (width <= 0 || height <= 0) {
  16491. continue;
  16492. }
  16493. if (_data.annotationType === _util.AnnotationType.POPUP) {
  16494. popupAnnotations.push(_data);
  16495. continue;
  16496. }
  16497. sortedAnnotations.push(_data);
  16498. }
  16499. } catch (err) {
  16500. _iterator22.e(err);
  16501. } finally {
  16502. _iterator22.f();
  16503. }
  16504. if (popupAnnotations.length) {
  16505. sortedAnnotations.push.apply(sortedAnnotations, popupAnnotations);
  16506. }
  16507. var div = parameters.div;
  16508. for (var _i8 = 0, _sortedAnnotations = sortedAnnotations; _i8 < _sortedAnnotations.length; _i8++) {
  16509. var data = _sortedAnnotations[_i8];
  16510. var element = AnnotationElementFactory.create({
  16511. data: data,
  16512. layer: div,
  16513. page: parameters.page,
  16514. viewport: parameters.viewport,
  16515. linkService: parameters.linkService,
  16516. downloadManager: parameters.downloadManager,
  16517. imageResourcesPath: parameters.imageResourcesPath || "",
  16518. renderForms: parameters.renderForms !== false,
  16519. svgFactory: new _display_utils.DOMSVGFactory(),
  16520. annotationStorage: parameters.annotationStorage || new _annotation_storage.AnnotationStorage(),
  16521. enableScripting: parameters.enableScripting,
  16522. hasJSActions: parameters.hasJSActions,
  16523. fieldObjects: parameters.fieldObjects,
  16524. mouseState: parameters.mouseState || {
  16525. isDown: false
  16526. }
  16527. });
  16528. if (element.isRenderable) {
  16529. var rendered = element.render();
  16530. if (data.hidden) {
  16531. rendered.style.visibility = "hidden";
  16532. }
  16533. if (Array.isArray(rendered)) {
  16534. var _iterator23 = _createForOfIteratorHelper(rendered),
  16535. _step23;
  16536. try {
  16537. for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
  16538. var renderedElement = _step23.value;
  16539. div.appendChild(renderedElement);
  16540. }
  16541. } catch (err) {
  16542. _iterator23.e(err);
  16543. } finally {
  16544. _iterator23.f();
  16545. }
  16546. } else {
  16547. if (element instanceof PopupAnnotationElement) {
  16548. div.prepend(rendered);
  16549. } else {
  16550. div.appendChild(rendered);
  16551. }
  16552. }
  16553. }
  16554. }
  16555. _classStaticPrivateMethodGet(this, AnnotationLayer, _setAnnotationCanvasMap).call(this, div, parameters.annotationCanvasMap);
  16556. }
  16557. }, {
  16558. key: "update",
  16559. value: function update(parameters) {
  16560. var page = parameters.page,
  16561. viewport = parameters.viewport,
  16562. annotations = parameters.annotations,
  16563. annotationCanvasMap = parameters.annotationCanvasMap,
  16564. div = parameters.div;
  16565. var transform = viewport.transform;
  16566. var matrix = "matrix(".concat(transform.join(","), ")");
  16567. var scale, ownMatrix;
  16568. var _iterator24 = _createForOfIteratorHelper(annotations),
  16569. _step24;
  16570. try {
  16571. for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
  16572. var data = _step24.value;
  16573. var elements = div.querySelectorAll("[data-annotation-id=\"".concat(data.id, "\"]"));
  16574. if (elements) {
  16575. var _iterator25 = _createForOfIteratorHelper(elements),
  16576. _step25;
  16577. try {
  16578. for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) {
  16579. var element = _step25.value;
  16580. if (data.hasOwnCanvas) {
  16581. var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
  16582. if (!ownMatrix) {
  16583. scale = Math.abs(transform[0] || transform[1]);
  16584. var ownTransform = transform.slice();
  16585. for (var i = 0; i < 4; i++) {
  16586. ownTransform[i] = Math.sign(ownTransform[i]);
  16587. }
  16588. ownMatrix = "matrix(".concat(ownTransform.join(","), ")");
  16589. }
  16590. var left = rect[0] * scale;
  16591. var top = rect[1] * scale;
  16592. element.style.left = "".concat(left, "px");
  16593. element.style.top = "".concat(top, "px");
  16594. element.style.transformOrigin = "".concat(-left, "px ").concat(-top, "px");
  16595. element.style.transform = ownMatrix;
  16596. } else {
  16597. element.style.transform = matrix;
  16598. }
  16599. }
  16600. } catch (err) {
  16601. _iterator25.e(err);
  16602. } finally {
  16603. _iterator25.f();
  16604. }
  16605. }
  16606. }
  16607. } catch (err) {
  16608. _iterator24.e(err);
  16609. } finally {
  16610. _iterator24.f();
  16611. }
  16612. _classStaticPrivateMethodGet(this, AnnotationLayer, _setAnnotationCanvasMap).call(this, div, annotationCanvasMap);
  16613. div.hidden = false;
  16614. }
  16615. }]);
  16616. return AnnotationLayer;
  16617. }();
  16618. exports.AnnotationLayer = AnnotationLayer;
  16619. function _setAnnotationCanvasMap(div, annotationCanvasMap) {
  16620. if (!annotationCanvasMap) {
  16621. return;
  16622. }
  16623. var _iterator26 = _createForOfIteratorHelper(annotationCanvasMap),
  16624. _step26;
  16625. try {
  16626. for (_iterator26.s(); !(_step26 = _iterator26.n()).done;) {
  16627. var _step26$value = _slicedToArray(_step26.value, 2),
  16628. id = _step26$value[0],
  16629. canvas = _step26$value[1];
  16630. var element = div.querySelector("[data-annotation-id=\"".concat(id, "\"]"));
  16631. if (!element) {
  16632. continue;
  16633. }
  16634. var firstChild = element.firstChild;
  16635. if (firstChild.nodeName === "CANVAS") {
  16636. element.replaceChild(canvas, firstChild);
  16637. } else {
  16638. element.insertBefore(canvas, firstChild);
  16639. }
  16640. }
  16641. } catch (err) {
  16642. _iterator26.e(err);
  16643. } finally {
  16644. _iterator26.f();
  16645. }
  16646. annotationCanvasMap.clear();
  16647. }
  16648. /***/ }),
  16649. /* 174 */
  16650. /***/ ((__unused_webpack_module, exports) => {
  16651. "use strict";
  16652. Object.defineProperty(exports, "__esModule", ({
  16653. value: true
  16654. }));
  16655. exports.ColorConverters = void 0;
  16656. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  16657. 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."); }
  16658. 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); }
  16659. 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; }
  16660. 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; }
  16661. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  16662. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16663. 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); } }
  16664. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  16665. function makeColorComp(n) {
  16666. return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
  16667. }
  16668. var ColorConverters = /*#__PURE__*/function () {
  16669. function ColorConverters() {
  16670. _classCallCheck(this, ColorConverters);
  16671. }
  16672. _createClass(ColorConverters, null, [{
  16673. key: "CMYK_G",
  16674. value: function CMYK_G(_ref) {
  16675. var _ref2 = _slicedToArray(_ref, 4),
  16676. c = _ref2[0],
  16677. y = _ref2[1],
  16678. m = _ref2[2],
  16679. k = _ref2[3];
  16680. return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
  16681. }
  16682. }, {
  16683. key: "G_CMYK",
  16684. value: function G_CMYK(_ref3) {
  16685. var _ref4 = _slicedToArray(_ref3, 1),
  16686. g = _ref4[0];
  16687. return ["CMYK", 0, 0, 0, 1 - g];
  16688. }
  16689. }, {
  16690. key: "G_RGB",
  16691. value: function G_RGB(_ref5) {
  16692. var _ref6 = _slicedToArray(_ref5, 1),
  16693. g = _ref6[0];
  16694. return ["RGB", g, g, g];
  16695. }
  16696. }, {
  16697. key: "G_HTML",
  16698. value: function G_HTML(_ref7) {
  16699. var _ref8 = _slicedToArray(_ref7, 1),
  16700. g = _ref8[0];
  16701. var G = makeColorComp(g);
  16702. return "#".concat(G).concat(G).concat(G);
  16703. }
  16704. }, {
  16705. key: "RGB_G",
  16706. value: function RGB_G(_ref9) {
  16707. var _ref10 = _slicedToArray(_ref9, 3),
  16708. r = _ref10[0],
  16709. g = _ref10[1],
  16710. b = _ref10[2];
  16711. return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
  16712. }
  16713. }, {
  16714. key: "RGB_HTML",
  16715. value: function RGB_HTML(_ref11) {
  16716. var _ref12 = _slicedToArray(_ref11, 3),
  16717. r = _ref12[0],
  16718. g = _ref12[1],
  16719. b = _ref12[2];
  16720. var R = makeColorComp(r);
  16721. var G = makeColorComp(g);
  16722. var B = makeColorComp(b);
  16723. return "#".concat(R).concat(G).concat(B);
  16724. }
  16725. }, {
  16726. key: "T_HTML",
  16727. value: function T_HTML() {
  16728. return "#00000000";
  16729. }
  16730. }, {
  16731. key: "CMYK_RGB",
  16732. value: function CMYK_RGB(_ref13) {
  16733. var _ref14 = _slicedToArray(_ref13, 4),
  16734. c = _ref14[0],
  16735. y = _ref14[1],
  16736. m = _ref14[2],
  16737. k = _ref14[3];
  16738. return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];
  16739. }
  16740. }, {
  16741. key: "CMYK_HTML",
  16742. value: function CMYK_HTML(components) {
  16743. return this.RGB_HTML(this.CMYK_RGB(components));
  16744. }
  16745. }, {
  16746. key: "RGB_CMYK",
  16747. value: function RGB_CMYK(_ref15) {
  16748. var _ref16 = _slicedToArray(_ref15, 3),
  16749. r = _ref16[0],
  16750. g = _ref16[1],
  16751. b = _ref16[2];
  16752. var c = 1 - r;
  16753. var m = 1 - g;
  16754. var y = 1 - b;
  16755. var k = Math.min(c, m, y);
  16756. return ["CMYK", c, m, y, k];
  16757. }
  16758. }]);
  16759. return ColorConverters;
  16760. }();
  16761. exports.ColorConverters = ColorConverters;
  16762. /***/ }),
  16763. /* 175 */
  16764. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16765. "use strict";
  16766. Object.defineProperty(exports, "__esModule", ({
  16767. value: true
  16768. }));
  16769. exports.XfaLayer = void 0;
  16770. var _xfa_text = __w_pdfjs_require__(171);
  16771. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  16772. 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."); }
  16773. 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; }
  16774. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  16775. 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; } } }; }
  16776. 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); }
  16777. 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; }
  16778. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16779. 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); } }
  16780. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  16781. var XfaLayer = /*#__PURE__*/function () {
  16782. function XfaLayer() {
  16783. _classCallCheck(this, XfaLayer);
  16784. }
  16785. _createClass(XfaLayer, null, [{
  16786. key: "setupStorage",
  16787. value: function setupStorage(html, id, element, storage, intent) {
  16788. var storedData = storage.getValue(id, {
  16789. value: null
  16790. });
  16791. switch (element.name) {
  16792. case "textarea":
  16793. if (storedData.value !== null) {
  16794. html.textContent = storedData.value;
  16795. }
  16796. if (intent === "print") {
  16797. break;
  16798. }
  16799. html.addEventListener("input", function (event) {
  16800. storage.setValue(id, {
  16801. value: event.target.value
  16802. });
  16803. });
  16804. break;
  16805. case "input":
  16806. if (element.attributes.type === "radio" || element.attributes.type === "checkbox") {
  16807. if (storedData.value === element.attributes.xfaOn) {
  16808. html.setAttribute("checked", true);
  16809. } else if (storedData.value === element.attributes.xfaOff) {
  16810. html.removeAttribute("checked");
  16811. }
  16812. if (intent === "print") {
  16813. break;
  16814. }
  16815. html.addEventListener("change", function (event) {
  16816. storage.setValue(id, {
  16817. value: event.target.checked ? event.target.getAttribute("xfaOn") : event.target.getAttribute("xfaOff")
  16818. });
  16819. });
  16820. } else {
  16821. if (storedData.value !== null) {
  16822. html.setAttribute("value", storedData.value);
  16823. }
  16824. if (intent === "print") {
  16825. break;
  16826. }
  16827. html.addEventListener("input", function (event) {
  16828. storage.setValue(id, {
  16829. value: event.target.value
  16830. });
  16831. });
  16832. }
  16833. break;
  16834. case "select":
  16835. if (storedData.value !== null) {
  16836. var _iterator = _createForOfIteratorHelper(element.children),
  16837. _step;
  16838. try {
  16839. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  16840. var option = _step.value;
  16841. if (option.attributes.value === storedData.value) {
  16842. option.attributes.selected = true;
  16843. }
  16844. }
  16845. } catch (err) {
  16846. _iterator.e(err);
  16847. } finally {
  16848. _iterator.f();
  16849. }
  16850. }
  16851. html.addEventListener("input", function (event) {
  16852. var options = event.target.options;
  16853. var value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
  16854. storage.setValue(id, {
  16855. value: value
  16856. });
  16857. });
  16858. break;
  16859. }
  16860. }
  16861. }, {
  16862. key: "setAttributes",
  16863. value: function setAttributes(_ref) {
  16864. var html = _ref.html,
  16865. element = _ref.element,
  16866. _ref$storage = _ref.storage,
  16867. storage = _ref$storage === void 0 ? null : _ref$storage,
  16868. intent = _ref.intent,
  16869. linkService = _ref.linkService;
  16870. var attributes = element.attributes;
  16871. var isHTMLAnchorElement = html instanceof HTMLAnchorElement;
  16872. if (attributes.type === "radio") {
  16873. attributes.name = "".concat(attributes.name, "-").concat(intent);
  16874. }
  16875. for (var _i = 0, _Object$entries = Object.entries(attributes); _i < _Object$entries.length; _i++) {
  16876. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  16877. key = _Object$entries$_i[0],
  16878. value = _Object$entries$_i[1];
  16879. if (value === null || value === undefined || key === "dataId") {
  16880. continue;
  16881. }
  16882. if (key !== "style") {
  16883. if (key === "textContent") {
  16884. html.textContent = value;
  16885. } else if (key === "class") {
  16886. if (value.length) {
  16887. html.setAttribute(key, value.join(" "));
  16888. }
  16889. } else {
  16890. if (isHTMLAnchorElement && (key === "href" || key === "newWindow")) {
  16891. continue;
  16892. }
  16893. html.setAttribute(key, value);
  16894. }
  16895. } else {
  16896. Object.assign(html.style, value);
  16897. }
  16898. }
  16899. if (isHTMLAnchorElement) {
  16900. linkService.addLinkAttributes(html, attributes.href, attributes.newWindow);
  16901. }
  16902. if (storage && attributes.dataId) {
  16903. this.setupStorage(html, attributes.dataId, element, storage);
  16904. }
  16905. }
  16906. }, {
  16907. key: "render",
  16908. value: function render(parameters) {
  16909. var storage = parameters.annotationStorage;
  16910. var linkService = parameters.linkService;
  16911. var root = parameters.xfaHtml;
  16912. var intent = parameters.intent || "display";
  16913. var rootHtml = document.createElement(root.name);
  16914. if (root.attributes) {
  16915. this.setAttributes({
  16916. html: rootHtml,
  16917. element: root,
  16918. intent: intent,
  16919. linkService: linkService
  16920. });
  16921. }
  16922. var stack = [[root, -1, rootHtml]];
  16923. var rootDiv = parameters.div;
  16924. rootDiv.appendChild(rootHtml);
  16925. if (parameters.viewport) {
  16926. var transform = "matrix(".concat(parameters.viewport.transform.join(","), ")");
  16927. rootDiv.style.transform = transform;
  16928. }
  16929. if (intent !== "richText") {
  16930. rootDiv.setAttribute("class", "xfaLayer xfaFont");
  16931. }
  16932. var textDivs = [];
  16933. while (stack.length > 0) {
  16934. var _child$attributes;
  16935. var _stack = _slicedToArray(stack[stack.length - 1], 3),
  16936. parent = _stack[0],
  16937. i = _stack[1],
  16938. html = _stack[2];
  16939. if (i + 1 === parent.children.length) {
  16940. stack.pop();
  16941. continue;
  16942. }
  16943. var child = parent.children[++stack[stack.length - 1][1]];
  16944. if (child === null) {
  16945. continue;
  16946. }
  16947. var name = child.name;
  16948. if (name === "#text") {
  16949. var node = document.createTextNode(child.value);
  16950. textDivs.push(node);
  16951. html.appendChild(node);
  16952. continue;
  16953. }
  16954. var childHtml = void 0;
  16955. if (child !== null && child !== void 0 && (_child$attributes = child.attributes) !== null && _child$attributes !== void 0 && _child$attributes.xmlns) {
  16956. childHtml = document.createElementNS(child.attributes.xmlns, name);
  16957. } else {
  16958. childHtml = document.createElement(name);
  16959. }
  16960. html.appendChild(childHtml);
  16961. if (child.attributes) {
  16962. this.setAttributes({
  16963. html: childHtml,
  16964. element: child,
  16965. storage: storage,
  16966. intent: intent,
  16967. linkService: linkService
  16968. });
  16969. }
  16970. if (child.children && child.children.length > 0) {
  16971. stack.push([child, -1, childHtml]);
  16972. } else if (child.value) {
  16973. var _node = document.createTextNode(child.value);
  16974. if (_xfa_text.XfaText.shouldBuildText(name)) {
  16975. textDivs.push(_node);
  16976. }
  16977. childHtml.appendChild(_node);
  16978. }
  16979. }
  16980. var _iterator2 = _createForOfIteratorHelper(rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")),
  16981. _step2;
  16982. try {
  16983. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  16984. var el = _step2.value;
  16985. el.setAttribute("readOnly", true);
  16986. }
  16987. } catch (err) {
  16988. _iterator2.e(err);
  16989. } finally {
  16990. _iterator2.f();
  16991. }
  16992. return {
  16993. textDivs: textDivs
  16994. };
  16995. }
  16996. }, {
  16997. key: "update",
  16998. value: function update(parameters) {
  16999. var transform = "matrix(".concat(parameters.viewport.transform.join(","), ")");
  17000. parameters.div.style.transform = transform;
  17001. parameters.div.hidden = false;
  17002. }
  17003. }]);
  17004. return XfaLayer;
  17005. }();
  17006. exports.XfaLayer = XfaLayer;
  17007. /***/ }),
  17008. /* 176 */
  17009. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17010. "use strict";
  17011. Object.defineProperty(exports, "__esModule", ({
  17012. value: true
  17013. }));
  17014. exports.renderTextLayer = renderTextLayer;
  17015. var _util = __w_pdfjs_require__(1);
  17016. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17017. 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); } }
  17018. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  17019. 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; } } }; }
  17020. 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); }
  17021. 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; }
  17022. var MAX_TEXT_DIVS_TO_RENDER = 100000;
  17023. var DEFAULT_FONT_SIZE = 30;
  17024. var DEFAULT_FONT_ASCENT = 0.8;
  17025. var ascentCache = new Map();
  17026. var AllWhitespaceRegexp = /^\s+$/g;
  17027. function getAscent(fontFamily, ctx) {
  17028. var cachedAscent = ascentCache.get(fontFamily);
  17029. if (cachedAscent) {
  17030. return cachedAscent;
  17031. }
  17032. ctx.save();
  17033. ctx.font = "".concat(DEFAULT_FONT_SIZE, "px ").concat(fontFamily);
  17034. var metrics = ctx.measureText("");
  17035. var ascent = metrics.fontBoundingBoxAscent;
  17036. var descent = Math.abs(metrics.fontBoundingBoxDescent);
  17037. if (ascent) {
  17038. ctx.restore();
  17039. var ratio = ascent / (ascent + descent);
  17040. ascentCache.set(fontFamily, ratio);
  17041. return ratio;
  17042. }
  17043. ctx.strokeStyle = "red";
  17044. ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
  17045. ctx.strokeText("g", 0, 0);
  17046. var pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
  17047. descent = 0;
  17048. for (var i = pixels.length - 1 - 3; i >= 0; i -= 4) {
  17049. if (pixels[i] > 0) {
  17050. descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);
  17051. break;
  17052. }
  17053. }
  17054. ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
  17055. ctx.strokeText("A", 0, DEFAULT_FONT_SIZE);
  17056. pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
  17057. ascent = 0;
  17058. for (var _i = 0, ii = pixels.length; _i < ii; _i += 4) {
  17059. if (pixels[_i] > 0) {
  17060. ascent = DEFAULT_FONT_SIZE - Math.floor(_i / 4 / DEFAULT_FONT_SIZE);
  17061. break;
  17062. }
  17063. }
  17064. ctx.restore();
  17065. if (ascent) {
  17066. var _ratio = ascent / (ascent + descent);
  17067. ascentCache.set(fontFamily, _ratio);
  17068. return _ratio;
  17069. }
  17070. ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT);
  17071. return DEFAULT_FONT_ASCENT;
  17072. }
  17073. function appendText(task, geom, styles, ctx) {
  17074. var textDiv = document.createElement("span");
  17075. var textDivProperties = task._enhanceTextSelection ? {
  17076. angle: 0,
  17077. canvasWidth: 0,
  17078. hasText: geom.str !== "",
  17079. hasEOL: geom.hasEOL,
  17080. originalTransform: null,
  17081. paddingBottom: 0,
  17082. paddingLeft: 0,
  17083. paddingRight: 0,
  17084. paddingTop: 0,
  17085. scale: 1
  17086. } : {
  17087. angle: 0,
  17088. canvasWidth: 0,
  17089. hasText: geom.str !== "",
  17090. hasEOL: geom.hasEOL
  17091. };
  17092. task._textDivs.push(textDiv);
  17093. var tx = _util.Util.transform(task._viewport.transform, geom.transform);
  17094. var angle = Math.atan2(tx[1], tx[0]);
  17095. var style = styles[geom.fontName];
  17096. if (style.vertical) {
  17097. angle += Math.PI / 2;
  17098. }
  17099. var fontHeight = Math.hypot(tx[2], tx[3]);
  17100. var fontAscent = fontHeight * getAscent(style.fontFamily, ctx);
  17101. var left, top;
  17102. if (angle === 0) {
  17103. left = tx[4];
  17104. top = tx[5] - fontAscent;
  17105. } else {
  17106. left = tx[4] + fontAscent * Math.sin(angle);
  17107. top = tx[5] - fontAscent * Math.cos(angle);
  17108. }
  17109. textDiv.style.left = "".concat(left, "px");
  17110. textDiv.style.top = "".concat(top, "px");
  17111. textDiv.style.fontSize = "".concat(fontHeight, "px");
  17112. textDiv.style.fontFamily = style.fontFamily;
  17113. textDiv.setAttribute("role", "presentation");
  17114. textDiv.textContent = geom.str;
  17115. textDiv.dir = geom.dir;
  17116. if (task._fontInspectorEnabled) {
  17117. textDiv.dataset.fontName = geom.fontName;
  17118. }
  17119. if (angle !== 0) {
  17120. textDivProperties.angle = angle * (180 / Math.PI);
  17121. }
  17122. var shouldScaleText = false;
  17123. if (geom.str.length > 1 || task._enhanceTextSelection && AllWhitespaceRegexp.test(geom.str)) {
  17124. shouldScaleText = true;
  17125. } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) {
  17126. var absScaleX = Math.abs(geom.transform[0]),
  17127. absScaleY = Math.abs(geom.transform[3]);
  17128. if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
  17129. shouldScaleText = true;
  17130. }
  17131. }
  17132. if (shouldScaleText) {
  17133. if (style.vertical) {
  17134. textDivProperties.canvasWidth = geom.height * task._viewport.scale;
  17135. } else {
  17136. textDivProperties.canvasWidth = geom.width * task._viewport.scale;
  17137. }
  17138. }
  17139. task._textDivProperties.set(textDiv, textDivProperties);
  17140. if (task._textContentStream) {
  17141. task._layoutText(textDiv);
  17142. }
  17143. if (task._enhanceTextSelection && textDivProperties.hasText) {
  17144. var angleCos = 1,
  17145. angleSin = 0;
  17146. if (angle !== 0) {
  17147. angleCos = Math.cos(angle);
  17148. angleSin = Math.sin(angle);
  17149. }
  17150. var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale;
  17151. var divHeight = fontHeight;
  17152. var m, b;
  17153. if (angle !== 0) {
  17154. m = [angleCos, angleSin, -angleSin, angleCos, left, top];
  17155. b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m);
  17156. } else {
  17157. b = [left, top, left + divWidth, top + divHeight];
  17158. }
  17159. task._bounds.push({
  17160. left: b[0],
  17161. top: b[1],
  17162. right: b[2],
  17163. bottom: b[3],
  17164. div: textDiv,
  17165. size: [divWidth, divHeight],
  17166. m: m
  17167. });
  17168. }
  17169. }
  17170. function render(task) {
  17171. if (task._canceled) {
  17172. return;
  17173. }
  17174. var textDivs = task._textDivs;
  17175. var capability = task._capability;
  17176. var textDivsLength = textDivs.length;
  17177. if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {
  17178. task._renderingDone = true;
  17179. capability.resolve();
  17180. return;
  17181. }
  17182. if (!task._textContentStream) {
  17183. for (var i = 0; i < textDivsLength; i++) {
  17184. task._layoutText(textDivs[i]);
  17185. }
  17186. }
  17187. task._renderingDone = true;
  17188. capability.resolve();
  17189. }
  17190. function findPositiveMin(ts, offset, count) {
  17191. var result = 0;
  17192. for (var i = 0; i < count; i++) {
  17193. var t = ts[offset++];
  17194. if (t > 0) {
  17195. result = result ? Math.min(t, result) : t;
  17196. }
  17197. }
  17198. return result;
  17199. }
  17200. function expand(task) {
  17201. var bounds = task._bounds;
  17202. var viewport = task._viewport;
  17203. var expanded = expandBounds(viewport.width, viewport.height, bounds);
  17204. for (var i = 0; i < expanded.length; i++) {
  17205. var div = bounds[i].div;
  17206. var divProperties = task._textDivProperties.get(div);
  17207. if (divProperties.angle === 0) {
  17208. divProperties.paddingLeft = bounds[i].left - expanded[i].left;
  17209. divProperties.paddingTop = bounds[i].top - expanded[i].top;
  17210. divProperties.paddingRight = expanded[i].right - bounds[i].right;
  17211. divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom;
  17212. task._textDivProperties.set(div, divProperties);
  17213. continue;
  17214. }
  17215. var e = expanded[i],
  17216. b = bounds[i];
  17217. var m = b.m,
  17218. c = m[0],
  17219. s = m[1];
  17220. var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];
  17221. var ts = new Float64Array(64);
  17222. for (var j = 0, jj = points.length; j < jj; j++) {
  17223. var t = _util.Util.applyTransform(points[j], m);
  17224. ts[j + 0] = c && (e.left - t[0]) / c;
  17225. ts[j + 4] = s && (e.top - t[1]) / s;
  17226. ts[j + 8] = c && (e.right - t[0]) / c;
  17227. ts[j + 12] = s && (e.bottom - t[1]) / s;
  17228. ts[j + 16] = s && (e.left - t[0]) / -s;
  17229. ts[j + 20] = c && (e.top - t[1]) / c;
  17230. ts[j + 24] = s && (e.right - t[0]) / -s;
  17231. ts[j + 28] = c && (e.bottom - t[1]) / c;
  17232. ts[j + 32] = c && (e.left - t[0]) / -c;
  17233. ts[j + 36] = s && (e.top - t[1]) / -s;
  17234. ts[j + 40] = c && (e.right - t[0]) / -c;
  17235. ts[j + 44] = s && (e.bottom - t[1]) / -s;
  17236. ts[j + 48] = s && (e.left - t[0]) / s;
  17237. ts[j + 52] = c && (e.top - t[1]) / -c;
  17238. ts[j + 56] = s && (e.right - t[0]) / s;
  17239. ts[j + 60] = c && (e.bottom - t[1]) / -c;
  17240. }
  17241. var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
  17242. divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;
  17243. divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;
  17244. divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale;
  17245. divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale;
  17246. task._textDivProperties.set(div, divProperties);
  17247. }
  17248. }
  17249. function expandBounds(width, height, boxes) {
  17250. var bounds = boxes.map(function (box, i) {
  17251. return {
  17252. x1: box.left,
  17253. y1: box.top,
  17254. x2: box.right,
  17255. y2: box.bottom,
  17256. index: i,
  17257. x1New: undefined,
  17258. x2New: undefined
  17259. };
  17260. });
  17261. expandBoundsLTR(width, bounds);
  17262. var expanded = new Array(boxes.length);
  17263. var _iterator = _createForOfIteratorHelper(bounds),
  17264. _step;
  17265. try {
  17266. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  17267. var b = _step.value;
  17268. var i = b.index;
  17269. expanded[i] = {
  17270. left: b.x1New,
  17271. top: 0,
  17272. right: b.x2New,
  17273. bottom: 0
  17274. };
  17275. }
  17276. } catch (err) {
  17277. _iterator.e(err);
  17278. } finally {
  17279. _iterator.f();
  17280. }
  17281. boxes.map(function (box, i) {
  17282. var e = expanded[i],
  17283. b = bounds[i];
  17284. b.x1 = box.top;
  17285. b.y1 = width - e.right;
  17286. b.x2 = box.bottom;
  17287. b.y2 = width - e.left;
  17288. b.index = i;
  17289. b.x1New = undefined;
  17290. b.x2New = undefined;
  17291. });
  17292. expandBoundsLTR(height, bounds);
  17293. var _iterator2 = _createForOfIteratorHelper(bounds),
  17294. _step2;
  17295. try {
  17296. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  17297. var _b = _step2.value;
  17298. var _i2 = _b.index;
  17299. expanded[_i2].top = _b.x1New;
  17300. expanded[_i2].bottom = _b.x2New;
  17301. }
  17302. } catch (err) {
  17303. _iterator2.e(err);
  17304. } finally {
  17305. _iterator2.f();
  17306. }
  17307. return expanded;
  17308. }
  17309. function expandBoundsLTR(width, bounds) {
  17310. bounds.sort(function (a, b) {
  17311. return a.x1 - b.x1 || a.index - b.index;
  17312. });
  17313. var fakeBoundary = {
  17314. x1: -Infinity,
  17315. y1: -Infinity,
  17316. x2: 0,
  17317. y2: Infinity,
  17318. index: -1,
  17319. x1New: 0,
  17320. x2New: 0
  17321. };
  17322. var horizon = [{
  17323. start: -Infinity,
  17324. end: Infinity,
  17325. boundary: fakeBoundary
  17326. }];
  17327. var _iterator3 = _createForOfIteratorHelper(bounds),
  17328. _step3;
  17329. try {
  17330. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  17331. var boundary = _step3.value;
  17332. var i = 0;
  17333. while (i < horizon.length && horizon[i].end <= boundary.y1) {
  17334. i++;
  17335. }
  17336. var j = horizon.length - 1;
  17337. while (j >= 0 && horizon[j].start >= boundary.y2) {
  17338. j--;
  17339. }
  17340. var _horizonPart = void 0,
  17341. _affectedBoundary = void 0;
  17342. var q = void 0,
  17343. k = void 0,
  17344. maxXNew = -Infinity;
  17345. for (q = i; q <= j; q++) {
  17346. _horizonPart = horizon[q];
  17347. _affectedBoundary = _horizonPart.boundary;
  17348. var xNew = void 0;
  17349. if (_affectedBoundary.x2 > boundary.x1) {
  17350. xNew = _affectedBoundary.index > boundary.index ? _affectedBoundary.x1New : boundary.x1;
  17351. } else if (_affectedBoundary.x2New === undefined) {
  17352. xNew = (_affectedBoundary.x2 + boundary.x1) / 2;
  17353. } else {
  17354. xNew = _affectedBoundary.x2New;
  17355. }
  17356. if (xNew > maxXNew) {
  17357. maxXNew = xNew;
  17358. }
  17359. }
  17360. boundary.x1New = maxXNew;
  17361. for (q = i; q <= j; q++) {
  17362. _horizonPart = horizon[q];
  17363. _affectedBoundary = _horizonPart.boundary;
  17364. if (_affectedBoundary.x2New === undefined) {
  17365. if (_affectedBoundary.x2 > boundary.x1) {
  17366. if (_affectedBoundary.index > boundary.index) {
  17367. _affectedBoundary.x2New = _affectedBoundary.x2;
  17368. }
  17369. } else {
  17370. _affectedBoundary.x2New = maxXNew;
  17371. }
  17372. } else if (_affectedBoundary.x2New > maxXNew) {
  17373. _affectedBoundary.x2New = Math.max(maxXNew, _affectedBoundary.x2);
  17374. }
  17375. }
  17376. var changedHorizon = [];
  17377. var lastBoundary = null;
  17378. for (q = i; q <= j; q++) {
  17379. _horizonPart = horizon[q];
  17380. _affectedBoundary = _horizonPart.boundary;
  17381. var useBoundary = _affectedBoundary.x2 > boundary.x2 ? _affectedBoundary : boundary;
  17382. if (lastBoundary === useBoundary) {
  17383. changedHorizon[changedHorizon.length - 1].end = _horizonPart.end;
  17384. } else {
  17385. changedHorizon.push({
  17386. start: _horizonPart.start,
  17387. end: _horizonPart.end,
  17388. boundary: useBoundary
  17389. });
  17390. lastBoundary = useBoundary;
  17391. }
  17392. }
  17393. if (horizon[i].start < boundary.y1) {
  17394. changedHorizon[0].start = boundary.y1;
  17395. changedHorizon.unshift({
  17396. start: horizon[i].start,
  17397. end: boundary.y1,
  17398. boundary: horizon[i].boundary
  17399. });
  17400. }
  17401. if (boundary.y2 < horizon[j].end) {
  17402. changedHorizon[changedHorizon.length - 1].end = boundary.y2;
  17403. changedHorizon.push({
  17404. start: boundary.y2,
  17405. end: horizon[j].end,
  17406. boundary: horizon[j].boundary
  17407. });
  17408. }
  17409. for (q = i; q <= j; q++) {
  17410. _horizonPart = horizon[q];
  17411. _affectedBoundary = _horizonPart.boundary;
  17412. if (_affectedBoundary.x2New !== undefined) {
  17413. continue;
  17414. }
  17415. var used = false;
  17416. for (k = i - 1; !used && k >= 0 && horizon[k].start >= _affectedBoundary.y1; k--) {
  17417. used = horizon[k].boundary === _affectedBoundary;
  17418. }
  17419. for (k = j + 1; !used && k < horizon.length && horizon[k].end <= _affectedBoundary.y2; k++) {
  17420. used = horizon[k].boundary === _affectedBoundary;
  17421. }
  17422. for (k = 0; !used && k < changedHorizon.length; k++) {
  17423. used = changedHorizon[k].boundary === _affectedBoundary;
  17424. }
  17425. if (!used) {
  17426. _affectedBoundary.x2New = maxXNew;
  17427. }
  17428. }
  17429. Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon));
  17430. }
  17431. } catch (err) {
  17432. _iterator3.e(err);
  17433. } finally {
  17434. _iterator3.f();
  17435. }
  17436. for (var _i3 = 0, _horizon = horizon; _i3 < _horizon.length; _i3++) {
  17437. var horizonPart = _horizon[_i3];
  17438. var affectedBoundary = horizonPart.boundary;
  17439. if (affectedBoundary.x2New === undefined) {
  17440. affectedBoundary.x2New = Math.max(width, affectedBoundary.x2);
  17441. }
  17442. }
  17443. }
  17444. var TextLayerRenderTask = /*#__PURE__*/function () {
  17445. function TextLayerRenderTask(_ref) {
  17446. var _globalThis$FontInspe,
  17447. _this = this;
  17448. var textContent = _ref.textContent,
  17449. textContentStream = _ref.textContentStream,
  17450. container = _ref.container,
  17451. viewport = _ref.viewport,
  17452. textDivs = _ref.textDivs,
  17453. textContentItemsStr = _ref.textContentItemsStr,
  17454. enhanceTextSelection = _ref.enhanceTextSelection;
  17455. _classCallCheck(this, TextLayerRenderTask);
  17456. this._textContent = textContent;
  17457. this._textContentStream = textContentStream;
  17458. this._container = container;
  17459. this._document = container.ownerDocument;
  17460. this._viewport = viewport;
  17461. this._textDivs = textDivs || [];
  17462. this._textContentItemsStr = textContentItemsStr || [];
  17463. this._enhanceTextSelection = !!enhanceTextSelection;
  17464. this._fontInspectorEnabled = !!((_globalThis$FontInspe = globalThis.FontInspector) !== null && _globalThis$FontInspe !== void 0 && _globalThis$FontInspe.enabled);
  17465. this._reader = null;
  17466. this._layoutTextLastFontSize = null;
  17467. this._layoutTextLastFontFamily = null;
  17468. this._layoutTextCtx = null;
  17469. this._textDivProperties = new WeakMap();
  17470. this._renderingDone = false;
  17471. this._canceled = false;
  17472. this._capability = (0, _util.createPromiseCapability)();
  17473. this._renderTimer = null;
  17474. this._bounds = [];
  17475. this._capability.promise["finally"](function () {
  17476. if (!_this._enhanceTextSelection) {
  17477. _this._textDivProperties = null;
  17478. }
  17479. if (_this._layoutTextCtx) {
  17480. _this._layoutTextCtx.canvas.width = 0;
  17481. _this._layoutTextCtx.canvas.height = 0;
  17482. _this._layoutTextCtx = null;
  17483. }
  17484. })["catch"](function () {});
  17485. }
  17486. _createClass(TextLayerRenderTask, [{
  17487. key: "promise",
  17488. get: function get() {
  17489. return this._capability.promise;
  17490. }
  17491. }, {
  17492. key: "cancel",
  17493. value: function cancel() {
  17494. this._canceled = true;
  17495. if (this._reader) {
  17496. this._reader.cancel(new _util.AbortException("TextLayer task cancelled."))["catch"](function () {});
  17497. this._reader = null;
  17498. }
  17499. if (this._renderTimer !== null) {
  17500. clearTimeout(this._renderTimer);
  17501. this._renderTimer = null;
  17502. }
  17503. this._capability.reject(new Error("TextLayer task cancelled."));
  17504. }
  17505. }, {
  17506. key: "_processItems",
  17507. value: function _processItems(items, styleCache) {
  17508. for (var i = 0, len = items.length; i < len; i++) {
  17509. if (items[i].str === undefined) {
  17510. if (items[i].type === "beginMarkedContentProps" || items[i].type === "beginMarkedContent") {
  17511. var parent = this._container;
  17512. this._container = document.createElement("span");
  17513. this._container.classList.add("markedContent");
  17514. if (items[i].id !== null) {
  17515. this._container.setAttribute("id", "".concat(items[i].id));
  17516. }
  17517. parent.appendChild(this._container);
  17518. } else if (items[i].type === "endMarkedContent") {
  17519. this._container = this._container.parentNode;
  17520. }
  17521. continue;
  17522. }
  17523. this._textContentItemsStr.push(items[i].str);
  17524. appendText(this, items[i], styleCache, this._layoutTextCtx);
  17525. }
  17526. }
  17527. }, {
  17528. key: "_layoutText",
  17529. value: function _layoutText(textDiv) {
  17530. var textDivProperties = this._textDivProperties.get(textDiv);
  17531. var transform = "";
  17532. if (textDivProperties.canvasWidth !== 0 && textDivProperties.hasText) {
  17533. var _textDiv$style = textDiv.style,
  17534. fontSize = _textDiv$style.fontSize,
  17535. fontFamily = _textDiv$style.fontFamily;
  17536. if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) {
  17537. this._layoutTextCtx.font = "".concat(fontSize, " ").concat(fontFamily);
  17538. this._layoutTextLastFontSize = fontSize;
  17539. this._layoutTextLastFontFamily = fontFamily;
  17540. }
  17541. var _this$_layoutTextCtx$ = this._layoutTextCtx.measureText(textDiv.textContent),
  17542. width = _this$_layoutTextCtx$.width;
  17543. if (width > 0) {
  17544. var scale = textDivProperties.canvasWidth / width;
  17545. if (this._enhanceTextSelection) {
  17546. textDivProperties.scale = scale;
  17547. }
  17548. transform = "scaleX(".concat(scale, ")");
  17549. }
  17550. }
  17551. if (textDivProperties.angle !== 0) {
  17552. transform = "rotate(".concat(textDivProperties.angle, "deg) ").concat(transform);
  17553. }
  17554. if (transform.length > 0) {
  17555. if (this._enhanceTextSelection) {
  17556. textDivProperties.originalTransform = transform;
  17557. }
  17558. textDiv.style.transform = transform;
  17559. }
  17560. if (textDivProperties.hasText) {
  17561. this._container.appendChild(textDiv);
  17562. }
  17563. if (textDivProperties.hasEOL) {
  17564. var br = document.createElement("br");
  17565. br.setAttribute("role", "presentation");
  17566. this._container.appendChild(br);
  17567. }
  17568. }
  17569. }, {
  17570. key: "_render",
  17571. value: function _render() {
  17572. var _this2 = this;
  17573. var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  17574. var capability = (0, _util.createPromiseCapability)();
  17575. var styleCache = Object.create(null);
  17576. var canvas = this._document.createElement("canvas");
  17577. canvas.height = canvas.width = DEFAULT_FONT_SIZE;
  17578. this._layoutTextCtx = canvas.getContext("2d", {
  17579. alpha: false
  17580. });
  17581. if (this._textContent) {
  17582. var textItems = this._textContent.items;
  17583. var textStyles = this._textContent.styles;
  17584. this._processItems(textItems, textStyles);
  17585. capability.resolve();
  17586. } else if (this._textContentStream) {
  17587. var pump = function pump() {
  17588. _this2._reader.read().then(function (_ref2) {
  17589. var value = _ref2.value,
  17590. done = _ref2.done;
  17591. if (done) {
  17592. capability.resolve();
  17593. return;
  17594. }
  17595. Object.assign(styleCache, value.styles);
  17596. _this2._processItems(value.items, styleCache);
  17597. pump();
  17598. }, capability.reject);
  17599. };
  17600. this._reader = this._textContentStream.getReader();
  17601. pump();
  17602. } else {
  17603. throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');
  17604. }
  17605. capability.promise.then(function () {
  17606. styleCache = null;
  17607. if (!timeout) {
  17608. render(_this2);
  17609. } else {
  17610. _this2._renderTimer = setTimeout(function () {
  17611. render(_this2);
  17612. _this2._renderTimer = null;
  17613. }, timeout);
  17614. }
  17615. }, this._capability.reject);
  17616. }
  17617. }, {
  17618. key: "expandTextDivs",
  17619. value: function expandTextDivs() {
  17620. var expandDivs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  17621. if (!this._enhanceTextSelection || !this._renderingDone) {
  17622. return;
  17623. }
  17624. if (this._bounds !== null) {
  17625. expand(this);
  17626. this._bounds = null;
  17627. }
  17628. var transformBuf = [],
  17629. paddingBuf = [];
  17630. for (var i = 0, ii = this._textDivs.length; i < ii; i++) {
  17631. var div = this._textDivs[i];
  17632. var divProps = this._textDivProperties.get(div);
  17633. if (!divProps.hasText) {
  17634. continue;
  17635. }
  17636. if (expandDivs) {
  17637. transformBuf.length = 0;
  17638. paddingBuf.length = 0;
  17639. if (divProps.originalTransform) {
  17640. transformBuf.push(divProps.originalTransform);
  17641. }
  17642. if (divProps.paddingTop > 0) {
  17643. paddingBuf.push("".concat(divProps.paddingTop, "px"));
  17644. transformBuf.push("translateY(".concat(-divProps.paddingTop, "px)"));
  17645. } else {
  17646. paddingBuf.push(0);
  17647. }
  17648. if (divProps.paddingRight > 0) {
  17649. paddingBuf.push("".concat(divProps.paddingRight / divProps.scale, "px"));
  17650. } else {
  17651. paddingBuf.push(0);
  17652. }
  17653. if (divProps.paddingBottom > 0) {
  17654. paddingBuf.push("".concat(divProps.paddingBottom, "px"));
  17655. } else {
  17656. paddingBuf.push(0);
  17657. }
  17658. if (divProps.paddingLeft > 0) {
  17659. paddingBuf.push("".concat(divProps.paddingLeft / divProps.scale, "px"));
  17660. transformBuf.push("translateX(".concat(-divProps.paddingLeft / divProps.scale, "px)"));
  17661. } else {
  17662. paddingBuf.push(0);
  17663. }
  17664. div.style.padding = paddingBuf.join(" ");
  17665. if (transformBuf.length) {
  17666. div.style.transform = transformBuf.join(" ");
  17667. }
  17668. } else {
  17669. div.style.padding = null;
  17670. div.style.transform = divProps.originalTransform;
  17671. }
  17672. }
  17673. }
  17674. }]);
  17675. return TextLayerRenderTask;
  17676. }();
  17677. function renderTextLayer(renderParameters) {
  17678. var task = new TextLayerRenderTask({
  17679. textContent: renderParameters.textContent,
  17680. textContentStream: renderParameters.textContentStream,
  17681. container: renderParameters.container,
  17682. viewport: renderParameters.viewport,
  17683. textDivs: renderParameters.textDivs,
  17684. textContentItemsStr: renderParameters.textContentItemsStr,
  17685. enhanceTextSelection: renderParameters.enhanceTextSelection
  17686. });
  17687. task._render(renderParameters.timeout);
  17688. return task;
  17689. }
  17690. /***/ }),
  17691. /* 177 */
  17692. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17693. "use strict";
  17694. Object.defineProperty(exports, "__esModule", ({
  17695. value: true
  17696. }));
  17697. exports.SVGGraphics = void 0;
  17698. var _util = __w_pdfjs_require__(1);
  17699. var _display_utils = __w_pdfjs_require__(158);
  17700. var _is_node = __w_pdfjs_require__(3);
  17701. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  17702. 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."); }
  17703. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  17704. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  17705. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  17706. 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."); }
  17707. 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; }
  17708. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  17709. 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; } } }; }
  17710. 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); }
  17711. 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; }
  17712. 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); } }
  17713. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  17714. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17715. var SVGGraphics = /*#__PURE__*/_createClass(function SVGGraphics() {
  17716. _classCallCheck(this, SVGGraphics);
  17717. (0, _util.unreachable)("Not implemented: SVGGraphics");
  17718. });
  17719. exports.SVGGraphics = SVGGraphics;
  17720. {
  17721. var opListToTree = function opListToTree(opList) {
  17722. var opTree = [];
  17723. var tmp = [];
  17724. var _iterator = _createForOfIteratorHelper(opList),
  17725. _step;
  17726. try {
  17727. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  17728. var opListElement = _step.value;
  17729. if (opListElement.fn === "save") {
  17730. opTree.push({
  17731. fnId: 92,
  17732. fn: "group",
  17733. items: []
  17734. });
  17735. tmp.push(opTree);
  17736. opTree = opTree[opTree.length - 1].items;
  17737. continue;
  17738. }
  17739. if (opListElement.fn === "restore") {
  17740. opTree = tmp.pop();
  17741. } else {
  17742. opTree.push(opListElement);
  17743. }
  17744. }
  17745. } catch (err) {
  17746. _iterator.e(err);
  17747. } finally {
  17748. _iterator.f();
  17749. }
  17750. return opTree;
  17751. };
  17752. var pf = function pf(value) {
  17753. if (Number.isInteger(value)) {
  17754. return value.toString();
  17755. }
  17756. var s = value.toFixed(10);
  17757. var i = s.length - 1;
  17758. if (s[i] !== "0") {
  17759. return s;
  17760. }
  17761. do {
  17762. i--;
  17763. } while (s[i] === "0");
  17764. return s.substring(0, s[i] === "." ? i : i + 1);
  17765. };
  17766. var pm = function pm(m) {
  17767. if (m[4] === 0 && m[5] === 0) {
  17768. if (m[1] === 0 && m[2] === 0) {
  17769. if (m[0] === 1 && m[3] === 1) {
  17770. return "";
  17771. }
  17772. return "scale(".concat(pf(m[0]), " ").concat(pf(m[3]), ")");
  17773. }
  17774. if (m[0] === m[3] && m[1] === -m[2]) {
  17775. var a = Math.acos(m[0]) * 180 / Math.PI;
  17776. return "rotate(".concat(pf(a), ")");
  17777. }
  17778. } else {
  17779. if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {
  17780. return "translate(".concat(pf(m[4]), " ").concat(pf(m[5]), ")");
  17781. }
  17782. }
  17783. return "matrix(".concat(pf(m[0]), " ").concat(pf(m[1]), " ").concat(pf(m[2]), " ").concat(pf(m[3]), " ").concat(pf(m[4]), " ") + "".concat(pf(m[5]), ")");
  17784. };
  17785. var SVG_DEFAULTS = {
  17786. fontStyle: "normal",
  17787. fontWeight: "normal",
  17788. fillColor: "#000000"
  17789. };
  17790. var XML_NS = "http://www.w3.org/XML/1998/namespace";
  17791. var XLINK_NS = "http://www.w3.org/1999/xlink";
  17792. var LINE_CAP_STYLES = ["butt", "round", "square"];
  17793. var LINE_JOIN_STYLES = ["miter", "round", "bevel"];
  17794. var createObjectURL = function createObjectURL(data) {
  17795. var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  17796. var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  17797. if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
  17798. return URL.createObjectURL(new Blob([data], {
  17799. type: contentType
  17800. }));
  17801. }
  17802. var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  17803. var buffer = "data:".concat(contentType, ";base64,");
  17804. for (var i = 0, ii = data.length; i < ii; i += 3) {
  17805. var b1 = data[i] & 0xff;
  17806. var b2 = data[i + 1] & 0xff;
  17807. var b3 = data[i + 2] & 0xff;
  17808. var d1 = b1 >> 2,
  17809. d2 = (b1 & 3) << 4 | b2 >> 4;
  17810. var d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  17811. var d4 = i + 2 < ii ? b3 & 0x3f : 64;
  17812. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  17813. }
  17814. return buffer;
  17815. };
  17816. var convertImgDataToPng = function () {
  17817. var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
  17818. var CHUNK_WRAPPER_SIZE = 12;
  17819. var crcTable = new Int32Array(256);
  17820. for (var i = 0; i < 256; i++) {
  17821. var c = i;
  17822. for (var h = 0; h < 8; h++) {
  17823. if (c & 1) {
  17824. c = 0xedb88320 ^ c >> 1 & 0x7fffffff;
  17825. } else {
  17826. c = c >> 1 & 0x7fffffff;
  17827. }
  17828. }
  17829. crcTable[i] = c;
  17830. }
  17831. function crc32(data, start, end) {
  17832. var crc = -1;
  17833. for (var _i = start; _i < end; _i++) {
  17834. var a = (crc ^ data[_i]) & 0xff;
  17835. var b = crcTable[a];
  17836. crc = crc >>> 8 ^ b;
  17837. }
  17838. return crc ^ -1;
  17839. }
  17840. function writePngChunk(type, body, data, offset) {
  17841. var p = offset;
  17842. var len = body.length;
  17843. data[p] = len >> 24 & 0xff;
  17844. data[p + 1] = len >> 16 & 0xff;
  17845. data[p + 2] = len >> 8 & 0xff;
  17846. data[p + 3] = len & 0xff;
  17847. p += 4;
  17848. data[p] = type.charCodeAt(0) & 0xff;
  17849. data[p + 1] = type.charCodeAt(1) & 0xff;
  17850. data[p + 2] = type.charCodeAt(2) & 0xff;
  17851. data[p + 3] = type.charCodeAt(3) & 0xff;
  17852. p += 4;
  17853. data.set(body, p);
  17854. p += body.length;
  17855. var crc = crc32(data, offset + 4, p);
  17856. data[p] = crc >> 24 & 0xff;
  17857. data[p + 1] = crc >> 16 & 0xff;
  17858. data[p + 2] = crc >> 8 & 0xff;
  17859. data[p + 3] = crc & 0xff;
  17860. }
  17861. function adler32(data, start, end) {
  17862. var a = 1;
  17863. var b = 0;
  17864. for (var _i2 = start; _i2 < end; ++_i2) {
  17865. a = (a + (data[_i2] & 0xff)) % 65521;
  17866. b = (b + a) % 65521;
  17867. }
  17868. return b << 16 | a;
  17869. }
  17870. function deflateSync(literals) {
  17871. if (!_is_node.isNodeJS) {
  17872. return deflateSyncUncompressed(literals);
  17873. }
  17874. try {
  17875. var input;
  17876. if (parseInt(process.versions.node) >= 8) {
  17877. input = literals;
  17878. } else {
  17879. input = Buffer.from(literals);
  17880. }
  17881. var output = require("zlib").deflateSync(input, {
  17882. level: 9
  17883. });
  17884. return output instanceof Uint8Array ? output : new Uint8Array(output);
  17885. } catch (e) {
  17886. (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e);
  17887. }
  17888. return deflateSyncUncompressed(literals);
  17889. }
  17890. function deflateSyncUncompressed(literals) {
  17891. var len = literals.length;
  17892. var maxBlockLength = 0xffff;
  17893. var deflateBlocks = Math.ceil(len / maxBlockLength);
  17894. var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);
  17895. var pi = 0;
  17896. idat[pi++] = 0x78;
  17897. idat[pi++] = 0x9c;
  17898. var pos = 0;
  17899. while (len > maxBlockLength) {
  17900. idat[pi++] = 0x00;
  17901. idat[pi++] = 0xff;
  17902. idat[pi++] = 0xff;
  17903. idat[pi++] = 0x00;
  17904. idat[pi++] = 0x00;
  17905. idat.set(literals.subarray(pos, pos + maxBlockLength), pi);
  17906. pi += maxBlockLength;
  17907. pos += maxBlockLength;
  17908. len -= maxBlockLength;
  17909. }
  17910. idat[pi++] = 0x01;
  17911. idat[pi++] = len & 0xff;
  17912. idat[pi++] = len >> 8 & 0xff;
  17913. idat[pi++] = ~len & 0xffff & 0xff;
  17914. idat[pi++] = (~len & 0xffff) >> 8 & 0xff;
  17915. idat.set(literals.subarray(pos), pi);
  17916. pi += literals.length - pos;
  17917. var adler = adler32(literals, 0, literals.length);
  17918. idat[pi++] = adler >> 24 & 0xff;
  17919. idat[pi++] = adler >> 16 & 0xff;
  17920. idat[pi++] = adler >> 8 & 0xff;
  17921. idat[pi++] = adler & 0xff;
  17922. return idat;
  17923. }
  17924. function encode(imgData, kind, forceDataSchema, isMask) {
  17925. var width = imgData.width;
  17926. var height = imgData.height;
  17927. var bitDepth, colorType, lineSize;
  17928. var bytes = imgData.data;
  17929. switch (kind) {
  17930. case _util.ImageKind.GRAYSCALE_1BPP:
  17931. colorType = 0;
  17932. bitDepth = 1;
  17933. lineSize = width + 7 >> 3;
  17934. break;
  17935. case _util.ImageKind.RGB_24BPP:
  17936. colorType = 2;
  17937. bitDepth = 8;
  17938. lineSize = width * 3;
  17939. break;
  17940. case _util.ImageKind.RGBA_32BPP:
  17941. colorType = 6;
  17942. bitDepth = 8;
  17943. lineSize = width * 4;
  17944. break;
  17945. default:
  17946. throw new Error("invalid format");
  17947. }
  17948. var literals = new Uint8Array((1 + lineSize) * height);
  17949. var offsetLiterals = 0,
  17950. offsetBytes = 0;
  17951. for (var y = 0; y < height; ++y) {
  17952. literals[offsetLiterals++] = 0;
  17953. literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);
  17954. offsetBytes += lineSize;
  17955. offsetLiterals += lineSize;
  17956. }
  17957. if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {
  17958. offsetLiterals = 0;
  17959. for (var _y = 0; _y < height; _y++) {
  17960. offsetLiterals++;
  17961. for (var _i3 = 0; _i3 < lineSize; _i3++) {
  17962. literals[offsetLiterals++] ^= 0xff;
  17963. }
  17964. }
  17965. }
  17966. var ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]);
  17967. var idat = deflateSync(literals);
  17968. var pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;
  17969. var data = new Uint8Array(pngLength);
  17970. var offset = 0;
  17971. data.set(PNG_HEADER, offset);
  17972. offset += PNG_HEADER.length;
  17973. writePngChunk("IHDR", ihdr, data, offset);
  17974. offset += CHUNK_WRAPPER_SIZE + ihdr.length;
  17975. writePngChunk("IDATA", idat, data, offset);
  17976. offset += CHUNK_WRAPPER_SIZE + idat.length;
  17977. writePngChunk("IEND", new Uint8Array(0), data, offset);
  17978. return createObjectURL(data, "image/png", forceDataSchema);
  17979. }
  17980. return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
  17981. var kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;
  17982. return encode(imgData, kind, forceDataSchema, isMask);
  17983. };
  17984. }();
  17985. var SVGExtraState = /*#__PURE__*/function () {
  17986. function SVGExtraState() {
  17987. _classCallCheck(this, SVGExtraState);
  17988. this.fontSizeScale = 1;
  17989. this.fontWeight = SVG_DEFAULTS.fontWeight;
  17990. this.fontSize = 0;
  17991. this.textMatrix = _util.IDENTITY_MATRIX;
  17992. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  17993. this.leading = 0;
  17994. this.textRenderingMode = _util.TextRenderingMode.FILL;
  17995. this.textMatrixScale = 1;
  17996. this.x = 0;
  17997. this.y = 0;
  17998. this.lineX = 0;
  17999. this.lineY = 0;
  18000. this.charSpacing = 0;
  18001. this.wordSpacing = 0;
  18002. this.textHScale = 1;
  18003. this.textRise = 0;
  18004. this.fillColor = SVG_DEFAULTS.fillColor;
  18005. this.strokeColor = "#000000";
  18006. this.fillAlpha = 1;
  18007. this.strokeAlpha = 1;
  18008. this.lineWidth = 1;
  18009. this.lineJoin = "";
  18010. this.lineCap = "";
  18011. this.miterLimit = 0;
  18012. this.dashArray = [];
  18013. this.dashPhase = 0;
  18014. this.dependencies = [];
  18015. this.activeClipUrl = null;
  18016. this.clipGroup = null;
  18017. this.maskId = "";
  18018. }
  18019. _createClass(SVGExtraState, [{
  18020. key: "clone",
  18021. value: function clone() {
  18022. return Object.create(this);
  18023. }
  18024. }, {
  18025. key: "setCurrentPoint",
  18026. value: function setCurrentPoint(x, y) {
  18027. this.x = x;
  18028. this.y = y;
  18029. }
  18030. }]);
  18031. return SVGExtraState;
  18032. }();
  18033. var clipCount = 0;
  18034. var maskCount = 0;
  18035. var shadingCount = 0;
  18036. exports.SVGGraphics = SVGGraphics = /*#__PURE__*/function () {
  18037. function SVGGraphics(commonObjs, objs) {
  18038. var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  18039. _classCallCheck(this, SVGGraphics);
  18040. this.svgFactory = new _display_utils.DOMSVGFactory();
  18041. this.current = new SVGExtraState();
  18042. this.transformMatrix = _util.IDENTITY_MATRIX;
  18043. this.transformStack = [];
  18044. this.extraStack = [];
  18045. this.commonObjs = commonObjs;
  18046. this.objs = objs;
  18047. this.pendingClip = null;
  18048. this.pendingEOFill = false;
  18049. this.embedFonts = false;
  18050. this.embeddedFonts = Object.create(null);
  18051. this.cssStyle = null;
  18052. this.forceDataSchema = !!forceDataSchema;
  18053. this._operatorIdMapping = [];
  18054. for (var op in _util.OPS) {
  18055. this._operatorIdMapping[_util.OPS[op]] = op;
  18056. }
  18057. }
  18058. _createClass(SVGGraphics, [{
  18059. key: "save",
  18060. value: function save() {
  18061. this.transformStack.push(this.transformMatrix);
  18062. var old = this.current;
  18063. this.extraStack.push(old);
  18064. this.current = old.clone();
  18065. }
  18066. }, {
  18067. key: "restore",
  18068. value: function restore() {
  18069. this.transformMatrix = this.transformStack.pop();
  18070. this.current = this.extraStack.pop();
  18071. this.pendingClip = null;
  18072. this.tgrp = null;
  18073. }
  18074. }, {
  18075. key: "group",
  18076. value: function group(items) {
  18077. this.save();
  18078. this.executeOpTree(items);
  18079. this.restore();
  18080. }
  18081. }, {
  18082. key: "loadDependencies",
  18083. value: function loadDependencies(operatorList) {
  18084. var _this = this;
  18085. var fnArray = operatorList.fnArray;
  18086. var argsArray = operatorList.argsArray;
  18087. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  18088. if (fnArray[i] !== _util.OPS.dependency) {
  18089. continue;
  18090. }
  18091. var _iterator2 = _createForOfIteratorHelper(argsArray[i]),
  18092. _step2;
  18093. try {
  18094. var _loop = function _loop() {
  18095. var obj = _step2.value;
  18096. var objsPool = obj.startsWith("g_") ? _this.commonObjs : _this.objs;
  18097. var promise = new Promise(function (resolve) {
  18098. objsPool.get(obj, resolve);
  18099. });
  18100. _this.current.dependencies.push(promise);
  18101. };
  18102. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  18103. _loop();
  18104. }
  18105. } catch (err) {
  18106. _iterator2.e(err);
  18107. } finally {
  18108. _iterator2.f();
  18109. }
  18110. }
  18111. return Promise.all(this.current.dependencies);
  18112. }
  18113. }, {
  18114. key: "transform",
  18115. value: function transform(a, b, c, d, e, f) {
  18116. var transformMatrix = [a, b, c, d, e, f];
  18117. this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
  18118. this.tgrp = null;
  18119. }
  18120. }, {
  18121. key: "getSVG",
  18122. value: function getSVG(operatorList, viewport) {
  18123. var _this2 = this;
  18124. this.viewport = viewport;
  18125. var svgElement = this._initialize(viewport);
  18126. return this.loadDependencies(operatorList).then(function () {
  18127. _this2.transformMatrix = _util.IDENTITY_MATRIX;
  18128. _this2.executeOpTree(_this2.convertOpList(operatorList));
  18129. return svgElement;
  18130. });
  18131. }
  18132. }, {
  18133. key: "convertOpList",
  18134. value: function convertOpList(operatorList) {
  18135. var operatorIdMapping = this._operatorIdMapping;
  18136. var argsArray = operatorList.argsArray;
  18137. var fnArray = operatorList.fnArray;
  18138. var opList = [];
  18139. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  18140. var fnId = fnArray[i];
  18141. opList.push({
  18142. fnId: fnId,
  18143. fn: operatorIdMapping[fnId],
  18144. args: argsArray[i]
  18145. });
  18146. }
  18147. return opListToTree(opList);
  18148. }
  18149. }, {
  18150. key: "executeOpTree",
  18151. value: function executeOpTree(opTree) {
  18152. var _iterator3 = _createForOfIteratorHelper(opTree),
  18153. _step3;
  18154. try {
  18155. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  18156. var opTreeElement = _step3.value;
  18157. var fn = opTreeElement.fn;
  18158. var fnId = opTreeElement.fnId;
  18159. var args = opTreeElement.args;
  18160. switch (fnId | 0) {
  18161. case _util.OPS.beginText:
  18162. this.beginText();
  18163. break;
  18164. case _util.OPS.dependency:
  18165. break;
  18166. case _util.OPS.setLeading:
  18167. this.setLeading(args);
  18168. break;
  18169. case _util.OPS.setLeadingMoveText:
  18170. this.setLeadingMoveText(args[0], args[1]);
  18171. break;
  18172. case _util.OPS.setFont:
  18173. this.setFont(args);
  18174. break;
  18175. case _util.OPS.showText:
  18176. this.showText(args[0]);
  18177. break;
  18178. case _util.OPS.showSpacedText:
  18179. this.showText(args[0]);
  18180. break;
  18181. case _util.OPS.endText:
  18182. this.endText();
  18183. break;
  18184. case _util.OPS.moveText:
  18185. this.moveText(args[0], args[1]);
  18186. break;
  18187. case _util.OPS.setCharSpacing:
  18188. this.setCharSpacing(args[0]);
  18189. break;
  18190. case _util.OPS.setWordSpacing:
  18191. this.setWordSpacing(args[0]);
  18192. break;
  18193. case _util.OPS.setHScale:
  18194. this.setHScale(args[0]);
  18195. break;
  18196. case _util.OPS.setTextMatrix:
  18197. this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  18198. break;
  18199. case _util.OPS.setTextRise:
  18200. this.setTextRise(args[0]);
  18201. break;
  18202. case _util.OPS.setTextRenderingMode:
  18203. this.setTextRenderingMode(args[0]);
  18204. break;
  18205. case _util.OPS.setLineWidth:
  18206. this.setLineWidth(args[0]);
  18207. break;
  18208. case _util.OPS.setLineJoin:
  18209. this.setLineJoin(args[0]);
  18210. break;
  18211. case _util.OPS.setLineCap:
  18212. this.setLineCap(args[0]);
  18213. break;
  18214. case _util.OPS.setMiterLimit:
  18215. this.setMiterLimit(args[0]);
  18216. break;
  18217. case _util.OPS.setFillRGBColor:
  18218. this.setFillRGBColor(args[0], args[1], args[2]);
  18219. break;
  18220. case _util.OPS.setStrokeRGBColor:
  18221. this.setStrokeRGBColor(args[0], args[1], args[2]);
  18222. break;
  18223. case _util.OPS.setStrokeColorN:
  18224. this.setStrokeColorN(args);
  18225. break;
  18226. case _util.OPS.setFillColorN:
  18227. this.setFillColorN(args);
  18228. break;
  18229. case _util.OPS.shadingFill:
  18230. this.shadingFill(args[0]);
  18231. break;
  18232. case _util.OPS.setDash:
  18233. this.setDash(args[0], args[1]);
  18234. break;
  18235. case _util.OPS.setRenderingIntent:
  18236. this.setRenderingIntent(args[0]);
  18237. break;
  18238. case _util.OPS.setFlatness:
  18239. this.setFlatness(args[0]);
  18240. break;
  18241. case _util.OPS.setGState:
  18242. this.setGState(args[0]);
  18243. break;
  18244. case _util.OPS.fill:
  18245. this.fill();
  18246. break;
  18247. case _util.OPS.eoFill:
  18248. this.eoFill();
  18249. break;
  18250. case _util.OPS.stroke:
  18251. this.stroke();
  18252. break;
  18253. case _util.OPS.fillStroke:
  18254. this.fillStroke();
  18255. break;
  18256. case _util.OPS.eoFillStroke:
  18257. this.eoFillStroke();
  18258. break;
  18259. case _util.OPS.clip:
  18260. this.clip("nonzero");
  18261. break;
  18262. case _util.OPS.eoClip:
  18263. this.clip("evenodd");
  18264. break;
  18265. case _util.OPS.paintSolidColorImageMask:
  18266. this.paintSolidColorImageMask();
  18267. break;
  18268. case _util.OPS.paintImageXObject:
  18269. this.paintImageXObject(args[0]);
  18270. break;
  18271. case _util.OPS.paintInlineImageXObject:
  18272. this.paintInlineImageXObject(args[0]);
  18273. break;
  18274. case _util.OPS.paintImageMaskXObject:
  18275. this.paintImageMaskXObject(args[0]);
  18276. break;
  18277. case _util.OPS.paintFormXObjectBegin:
  18278. this.paintFormXObjectBegin(args[0], args[1]);
  18279. break;
  18280. case _util.OPS.paintFormXObjectEnd:
  18281. this.paintFormXObjectEnd();
  18282. break;
  18283. case _util.OPS.closePath:
  18284. this.closePath();
  18285. break;
  18286. case _util.OPS.closeStroke:
  18287. this.closeStroke();
  18288. break;
  18289. case _util.OPS.closeFillStroke:
  18290. this.closeFillStroke();
  18291. break;
  18292. case _util.OPS.closeEOFillStroke:
  18293. this.closeEOFillStroke();
  18294. break;
  18295. case _util.OPS.nextLine:
  18296. this.nextLine();
  18297. break;
  18298. case _util.OPS.transform:
  18299. this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
  18300. break;
  18301. case _util.OPS.constructPath:
  18302. this.constructPath(args[0], args[1]);
  18303. break;
  18304. case _util.OPS.endPath:
  18305. this.endPath();
  18306. break;
  18307. case 92:
  18308. this.group(opTreeElement.items);
  18309. break;
  18310. default:
  18311. (0, _util.warn)("Unimplemented operator ".concat(fn));
  18312. break;
  18313. }
  18314. }
  18315. } catch (err) {
  18316. _iterator3.e(err);
  18317. } finally {
  18318. _iterator3.f();
  18319. }
  18320. }
  18321. }, {
  18322. key: "setWordSpacing",
  18323. value: function setWordSpacing(wordSpacing) {
  18324. this.current.wordSpacing = wordSpacing;
  18325. }
  18326. }, {
  18327. key: "setCharSpacing",
  18328. value: function setCharSpacing(charSpacing) {
  18329. this.current.charSpacing = charSpacing;
  18330. }
  18331. }, {
  18332. key: "nextLine",
  18333. value: function nextLine() {
  18334. this.moveText(0, this.current.leading);
  18335. }
  18336. }, {
  18337. key: "setTextMatrix",
  18338. value: function setTextMatrix(a, b, c, d, e, f) {
  18339. var current = this.current;
  18340. current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];
  18341. current.textMatrixScale = Math.hypot(a, b);
  18342. current.x = current.lineX = 0;
  18343. current.y = current.lineY = 0;
  18344. current.xcoords = [];
  18345. current.ycoords = [];
  18346. current.tspan = this.svgFactory.createElement("svg:tspan");
  18347. current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
  18348. current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px"));
  18349. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  18350. current.txtElement = this.svgFactory.createElement("svg:text");
  18351. current.txtElement.appendChild(current.tspan);
  18352. }
  18353. }, {
  18354. key: "beginText",
  18355. value: function beginText() {
  18356. var current = this.current;
  18357. current.x = current.lineX = 0;
  18358. current.y = current.lineY = 0;
  18359. current.textMatrix = _util.IDENTITY_MATRIX;
  18360. current.lineMatrix = _util.IDENTITY_MATRIX;
  18361. current.textMatrixScale = 1;
  18362. current.tspan = this.svgFactory.createElement("svg:tspan");
  18363. current.txtElement = this.svgFactory.createElement("svg:text");
  18364. current.txtgrp = this.svgFactory.createElement("svg:g");
  18365. current.xcoords = [];
  18366. current.ycoords = [];
  18367. }
  18368. }, {
  18369. key: "moveText",
  18370. value: function moveText(x, y) {
  18371. var current = this.current;
  18372. current.x = current.lineX += x;
  18373. current.y = current.lineY += y;
  18374. current.xcoords = [];
  18375. current.ycoords = [];
  18376. current.tspan = this.svgFactory.createElement("svg:tspan");
  18377. current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
  18378. current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px"));
  18379. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  18380. }
  18381. }, {
  18382. key: "showText",
  18383. value: function showText(glyphs) {
  18384. var current = this.current;
  18385. var font = current.font;
  18386. var fontSize = current.fontSize;
  18387. if (fontSize === 0) {
  18388. return;
  18389. }
  18390. var fontSizeScale = current.fontSizeScale;
  18391. var charSpacing = current.charSpacing;
  18392. var wordSpacing = current.wordSpacing;
  18393. var fontDirection = current.fontDirection;
  18394. var textHScale = current.textHScale * fontDirection;
  18395. var vertical = font.vertical;
  18396. var spacingDir = vertical ? 1 : -1;
  18397. var defaultVMetrics = font.defaultVMetrics;
  18398. var widthAdvanceScale = fontSize * current.fontMatrix[0];
  18399. var x = 0;
  18400. var _iterator4 = _createForOfIteratorHelper(glyphs),
  18401. _step4;
  18402. try {
  18403. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  18404. var glyph = _step4.value;
  18405. if (glyph === null) {
  18406. x += fontDirection * wordSpacing;
  18407. continue;
  18408. } else if (typeof glyph === "number") {
  18409. x += spacingDir * glyph * fontSize / 1000;
  18410. continue;
  18411. }
  18412. var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
  18413. var character = glyph.fontChar;
  18414. var scaledX = void 0,
  18415. scaledY = void 0;
  18416. var width = glyph.width;
  18417. if (vertical) {
  18418. var vx = void 0;
  18419. var vmetric = glyph.vmetric || defaultVMetrics;
  18420. vx = glyph.vmetric ? vmetric[1] : width * 0.5;
  18421. vx = -vx * widthAdvanceScale;
  18422. var vy = vmetric[2] * widthAdvanceScale;
  18423. width = vmetric ? -vmetric[0] : width;
  18424. scaledX = vx / fontSizeScale;
  18425. scaledY = (x + vy) / fontSizeScale;
  18426. } else {
  18427. scaledX = x / fontSizeScale;
  18428. scaledY = 0;
  18429. }
  18430. if (glyph.isInFont || font.missingFile) {
  18431. current.xcoords.push(current.x + scaledX);
  18432. if (vertical) {
  18433. current.ycoords.push(-current.y + scaledY);
  18434. }
  18435. current.tspan.textContent += character;
  18436. } else {}
  18437. var charWidth = void 0;
  18438. if (vertical) {
  18439. charWidth = width * widthAdvanceScale - spacing * fontDirection;
  18440. } else {
  18441. charWidth = width * widthAdvanceScale + spacing * fontDirection;
  18442. }
  18443. x += charWidth;
  18444. }
  18445. } catch (err) {
  18446. _iterator4.e(err);
  18447. } finally {
  18448. _iterator4.f();
  18449. }
  18450. current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
  18451. if (vertical) {
  18452. current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
  18453. } else {
  18454. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  18455. }
  18456. if (vertical) {
  18457. current.y -= x;
  18458. } else {
  18459. current.x += x * textHScale;
  18460. }
  18461. current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
  18462. current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px"));
  18463. if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {
  18464. current.tspan.setAttributeNS(null, "font-style", current.fontStyle);
  18465. }
  18466. if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {
  18467. current.tspan.setAttributeNS(null, "font-weight", current.fontWeight);
  18468. }
  18469. var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
  18470. if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  18471. if (current.fillColor !== SVG_DEFAULTS.fillColor) {
  18472. current.tspan.setAttributeNS(null, "fill", current.fillColor);
  18473. }
  18474. if (current.fillAlpha < 1) {
  18475. current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha);
  18476. }
  18477. } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {
  18478. current.tspan.setAttributeNS(null, "fill", "transparent");
  18479. } else {
  18480. current.tspan.setAttributeNS(null, "fill", "none");
  18481. }
  18482. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  18483. var lineWidthScale = 1 / (current.textMatrixScale || 1);
  18484. this._setStrokeAttributes(current.tspan, lineWidthScale);
  18485. }
  18486. var textMatrix = current.textMatrix;
  18487. if (current.textRise !== 0) {
  18488. textMatrix = textMatrix.slice();
  18489. textMatrix[5] += current.textRise;
  18490. }
  18491. current.txtElement.setAttributeNS(null, "transform", "".concat(pm(textMatrix), " scale(").concat(pf(textHScale), ", -1)"));
  18492. current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve");
  18493. current.txtElement.appendChild(current.tspan);
  18494. current.txtgrp.appendChild(current.txtElement);
  18495. this._ensureTransformGroup().appendChild(current.txtElement);
  18496. }
  18497. }, {
  18498. key: "setLeadingMoveText",
  18499. value: function setLeadingMoveText(x, y) {
  18500. this.setLeading(-y);
  18501. this.moveText(x, y);
  18502. }
  18503. }, {
  18504. key: "addFontStyle",
  18505. value: function addFontStyle(fontObj) {
  18506. if (!fontObj.data) {
  18507. throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
  18508. }
  18509. if (!this.cssStyle) {
  18510. this.cssStyle = this.svgFactory.createElement("svg:style");
  18511. this.cssStyle.setAttributeNS(null, "type", "text/css");
  18512. this.defs.appendChild(this.cssStyle);
  18513. }
  18514. var url = createObjectURL(fontObj.data, fontObj.mimetype, this.forceDataSchema);
  18515. this.cssStyle.textContent += "@font-face { font-family: \"".concat(fontObj.loadedName, "\";") + " src: url(".concat(url, "); }\n");
  18516. }
  18517. }, {
  18518. key: "setFont",
  18519. value: function setFont(details) {
  18520. var current = this.current;
  18521. var fontObj = this.commonObjs.get(details[0]);
  18522. var size = details[1];
  18523. current.font = fontObj;
  18524. if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
  18525. this.addFontStyle(fontObj);
  18526. this.embeddedFonts[fontObj.loadedName] = fontObj;
  18527. }
  18528. current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  18529. var bold = "normal";
  18530. if (fontObj.black) {
  18531. bold = "900";
  18532. } else if (fontObj.bold) {
  18533. bold = "bold";
  18534. }
  18535. var italic = fontObj.italic ? "italic" : "normal";
  18536. if (size < 0) {
  18537. size = -size;
  18538. current.fontDirection = -1;
  18539. } else {
  18540. current.fontDirection = 1;
  18541. }
  18542. current.fontSize = size;
  18543. current.fontFamily = fontObj.loadedName;
  18544. current.fontWeight = bold;
  18545. current.fontStyle = italic;
  18546. current.tspan = this.svgFactory.createElement("svg:tspan");
  18547. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  18548. current.xcoords = [];
  18549. current.ycoords = [];
  18550. }
  18551. }, {
  18552. key: "endText",
  18553. value: function endText() {
  18554. var _current$txtElement;
  18555. var current = this.current;
  18556. if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && (_current$txtElement = current.txtElement) !== null && _current$txtElement !== void 0 && _current$txtElement.hasChildNodes()) {
  18557. current.element = current.txtElement;
  18558. this.clip("nonzero");
  18559. this.endPath();
  18560. }
  18561. }
  18562. }, {
  18563. key: "setLineWidth",
  18564. value: function setLineWidth(width) {
  18565. if (width > 0) {
  18566. this.current.lineWidth = width;
  18567. }
  18568. }
  18569. }, {
  18570. key: "setLineCap",
  18571. value: function setLineCap(style) {
  18572. this.current.lineCap = LINE_CAP_STYLES[style];
  18573. }
  18574. }, {
  18575. key: "setLineJoin",
  18576. value: function setLineJoin(style) {
  18577. this.current.lineJoin = LINE_JOIN_STYLES[style];
  18578. }
  18579. }, {
  18580. key: "setMiterLimit",
  18581. value: function setMiterLimit(limit) {
  18582. this.current.miterLimit = limit;
  18583. }
  18584. }, {
  18585. key: "setStrokeAlpha",
  18586. value: function setStrokeAlpha(strokeAlpha) {
  18587. this.current.strokeAlpha = strokeAlpha;
  18588. }
  18589. }, {
  18590. key: "setStrokeRGBColor",
  18591. value: function setStrokeRGBColor(r, g, b) {
  18592. this.current.strokeColor = _util.Util.makeHexColor(r, g, b);
  18593. }
  18594. }, {
  18595. key: "setFillAlpha",
  18596. value: function setFillAlpha(fillAlpha) {
  18597. this.current.fillAlpha = fillAlpha;
  18598. }
  18599. }, {
  18600. key: "setFillRGBColor",
  18601. value: function setFillRGBColor(r, g, b) {
  18602. this.current.fillColor = _util.Util.makeHexColor(r, g, b);
  18603. this.current.tspan = this.svgFactory.createElement("svg:tspan");
  18604. this.current.xcoords = [];
  18605. this.current.ycoords = [];
  18606. }
  18607. }, {
  18608. key: "setStrokeColorN",
  18609. value: function setStrokeColorN(args) {
  18610. this.current.strokeColor = this._makeColorN_Pattern(args);
  18611. }
  18612. }, {
  18613. key: "setFillColorN",
  18614. value: function setFillColorN(args) {
  18615. this.current.fillColor = this._makeColorN_Pattern(args);
  18616. }
  18617. }, {
  18618. key: "shadingFill",
  18619. value: function shadingFill(args) {
  18620. var width = this.viewport.width;
  18621. var height = this.viewport.height;
  18622. var inv = _util.Util.inverseTransform(this.transformMatrix);
  18623. var bl = _util.Util.applyTransform([0, 0], inv);
  18624. var br = _util.Util.applyTransform([0, height], inv);
  18625. var ul = _util.Util.applyTransform([width, 0], inv);
  18626. var ur = _util.Util.applyTransform([width, height], inv);
  18627. var x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
  18628. var y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
  18629. var x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
  18630. var y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
  18631. var rect = this.svgFactory.createElement("svg:rect");
  18632. rect.setAttributeNS(null, "x", x0);
  18633. rect.setAttributeNS(null, "y", y0);
  18634. rect.setAttributeNS(null, "width", x1 - x0);
  18635. rect.setAttributeNS(null, "height", y1 - y0);
  18636. rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
  18637. if (this.current.fillAlpha < 1) {
  18638. rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
  18639. }
  18640. this._ensureTransformGroup().appendChild(rect);
  18641. }
  18642. }, {
  18643. key: "_makeColorN_Pattern",
  18644. value: function _makeColorN_Pattern(args) {
  18645. if (args[0] === "TilingPattern") {
  18646. return this._makeTilingPattern(args);
  18647. }
  18648. return this._makeShadingPattern(args);
  18649. }
  18650. }, {
  18651. key: "_makeTilingPattern",
  18652. value: function _makeTilingPattern(args) {
  18653. var color = args[1];
  18654. var operatorList = args[2];
  18655. var matrix = args[3] || _util.IDENTITY_MATRIX;
  18656. var _args$ = _slicedToArray(args[4], 4),
  18657. x0 = _args$[0],
  18658. y0 = _args$[1],
  18659. x1 = _args$[2],
  18660. y1 = _args$[3];
  18661. var xstep = args[5];
  18662. var ystep = args[6];
  18663. var paintType = args[7];
  18664. var tilingId = "shading".concat(shadingCount++);
  18665. var _Util$normalizeRect = _util.Util.normalizeRect([].concat(_toConsumableArray(_util.Util.applyTransform([x0, y0], matrix)), _toConsumableArray(_util.Util.applyTransform([x1, y1], matrix)))),
  18666. _Util$normalizeRect2 = _slicedToArray(_Util$normalizeRect, 4),
  18667. tx0 = _Util$normalizeRect2[0],
  18668. ty0 = _Util$normalizeRect2[1],
  18669. tx1 = _Util$normalizeRect2[2],
  18670. ty1 = _Util$normalizeRect2[3];
  18671. var _Util$singularValueDe = _util.Util.singularValueDecompose2dScale(matrix),
  18672. _Util$singularValueDe2 = _slicedToArray(_Util$singularValueDe, 2),
  18673. xscale = _Util$singularValueDe2[0],
  18674. yscale = _Util$singularValueDe2[1];
  18675. var txstep = xstep * xscale;
  18676. var tystep = ystep * yscale;
  18677. var tiling = this.svgFactory.createElement("svg:pattern");
  18678. tiling.setAttributeNS(null, "id", tilingId);
  18679. tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
  18680. tiling.setAttributeNS(null, "width", txstep);
  18681. tiling.setAttributeNS(null, "height", tystep);
  18682. tiling.setAttributeNS(null, "x", "".concat(tx0));
  18683. tiling.setAttributeNS(null, "y", "".concat(ty0));
  18684. var svg = this.svg;
  18685. var transformMatrix = this.transformMatrix;
  18686. var fillColor = this.current.fillColor;
  18687. var strokeColor = this.current.strokeColor;
  18688. var bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);
  18689. this.svg = bbox;
  18690. this.transformMatrix = matrix;
  18691. if (paintType === 2) {
  18692. var cssColor = _util.Util.makeHexColor.apply(_util.Util, _toConsumableArray(color));
  18693. this.current.fillColor = cssColor;
  18694. this.current.strokeColor = cssColor;
  18695. }
  18696. this.executeOpTree(this.convertOpList(operatorList));
  18697. this.svg = svg;
  18698. this.transformMatrix = transformMatrix;
  18699. this.current.fillColor = fillColor;
  18700. this.current.strokeColor = strokeColor;
  18701. tiling.appendChild(bbox.childNodes[0]);
  18702. this.defs.appendChild(tiling);
  18703. return "url(#".concat(tilingId, ")");
  18704. }
  18705. }, {
  18706. key: "_makeShadingPattern",
  18707. value: function _makeShadingPattern(args) {
  18708. if (typeof args === "string") {
  18709. args = this.objs.get(args);
  18710. }
  18711. switch (args[0]) {
  18712. case "RadialAxial":
  18713. var shadingId = "shading".concat(shadingCount++);
  18714. var colorStops = args[3];
  18715. var gradient;
  18716. switch (args[1]) {
  18717. case "axial":
  18718. var point0 = args[4];
  18719. var point1 = args[5];
  18720. gradient = this.svgFactory.createElement("svg:linearGradient");
  18721. gradient.setAttributeNS(null, "id", shadingId);
  18722. gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
  18723. gradient.setAttributeNS(null, "x1", point0[0]);
  18724. gradient.setAttributeNS(null, "y1", point0[1]);
  18725. gradient.setAttributeNS(null, "x2", point1[0]);
  18726. gradient.setAttributeNS(null, "y2", point1[1]);
  18727. break;
  18728. case "radial":
  18729. var focalPoint = args[4];
  18730. var circlePoint = args[5];
  18731. var focalRadius = args[6];
  18732. var circleRadius = args[7];
  18733. gradient = this.svgFactory.createElement("svg:radialGradient");
  18734. gradient.setAttributeNS(null, "id", shadingId);
  18735. gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
  18736. gradient.setAttributeNS(null, "cx", circlePoint[0]);
  18737. gradient.setAttributeNS(null, "cy", circlePoint[1]);
  18738. gradient.setAttributeNS(null, "r", circleRadius);
  18739. gradient.setAttributeNS(null, "fx", focalPoint[0]);
  18740. gradient.setAttributeNS(null, "fy", focalPoint[1]);
  18741. gradient.setAttributeNS(null, "fr", focalRadius);
  18742. break;
  18743. default:
  18744. throw new Error("Unknown RadialAxial type: ".concat(args[1]));
  18745. }
  18746. var _iterator5 = _createForOfIteratorHelper(colorStops),
  18747. _step5;
  18748. try {
  18749. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  18750. var colorStop = _step5.value;
  18751. var stop = this.svgFactory.createElement("svg:stop");
  18752. stop.setAttributeNS(null, "offset", colorStop[0]);
  18753. stop.setAttributeNS(null, "stop-color", colorStop[1]);
  18754. gradient.appendChild(stop);
  18755. }
  18756. } catch (err) {
  18757. _iterator5.e(err);
  18758. } finally {
  18759. _iterator5.f();
  18760. }
  18761. this.defs.appendChild(gradient);
  18762. return "url(#".concat(shadingId, ")");
  18763. case "Mesh":
  18764. (0, _util.warn)("Unimplemented pattern Mesh");
  18765. return null;
  18766. case "Dummy":
  18767. return "hotpink";
  18768. default:
  18769. throw new Error("Unknown IR type: ".concat(args[0]));
  18770. }
  18771. }
  18772. }, {
  18773. key: "setDash",
  18774. value: function setDash(dashArray, dashPhase) {
  18775. this.current.dashArray = dashArray;
  18776. this.current.dashPhase = dashPhase;
  18777. }
  18778. }, {
  18779. key: "constructPath",
  18780. value: function constructPath(ops, args) {
  18781. var current = this.current;
  18782. var x = current.x,
  18783. y = current.y;
  18784. var d = [];
  18785. var j = 0;
  18786. var _iterator6 = _createForOfIteratorHelper(ops),
  18787. _step6;
  18788. try {
  18789. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  18790. var op = _step6.value;
  18791. switch (op | 0) {
  18792. case _util.OPS.rectangle:
  18793. x = args[j++];
  18794. y = args[j++];
  18795. var width = args[j++];
  18796. var height = args[j++];
  18797. var xw = x + width;
  18798. var yh = y + height;
  18799. d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z");
  18800. break;
  18801. case _util.OPS.moveTo:
  18802. x = args[j++];
  18803. y = args[j++];
  18804. d.push("M", pf(x), pf(y));
  18805. break;
  18806. case _util.OPS.lineTo:
  18807. x = args[j++];
  18808. y = args[j++];
  18809. d.push("L", pf(x), pf(y));
  18810. break;
  18811. case _util.OPS.curveTo:
  18812. x = args[j + 4];
  18813. y = args[j + 5];
  18814. d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y));
  18815. j += 6;
  18816. break;
  18817. case _util.OPS.curveTo2:
  18818. d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]));
  18819. x = args[j + 2];
  18820. y = args[j + 3];
  18821. j += 4;
  18822. break;
  18823. case _util.OPS.curveTo3:
  18824. x = args[j + 2];
  18825. y = args[j + 3];
  18826. d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y));
  18827. j += 4;
  18828. break;
  18829. case _util.OPS.closePath:
  18830. d.push("Z");
  18831. break;
  18832. }
  18833. }
  18834. } catch (err) {
  18835. _iterator6.e(err);
  18836. } finally {
  18837. _iterator6.f();
  18838. }
  18839. d = d.join(" ");
  18840. if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) {
  18841. d = current.path.getAttributeNS(null, "d") + d;
  18842. } else {
  18843. current.path = this.svgFactory.createElement("svg:path");
  18844. this._ensureTransformGroup().appendChild(current.path);
  18845. }
  18846. current.path.setAttributeNS(null, "d", d);
  18847. current.path.setAttributeNS(null, "fill", "none");
  18848. current.element = current.path;
  18849. current.setCurrentPoint(x, y);
  18850. }
  18851. }, {
  18852. key: "endPath",
  18853. value: function endPath() {
  18854. var current = this.current;
  18855. current.path = null;
  18856. if (!this.pendingClip) {
  18857. return;
  18858. }
  18859. if (!current.element) {
  18860. this.pendingClip = null;
  18861. return;
  18862. }
  18863. var clipId = "clippath".concat(clipCount++);
  18864. var clipPath = this.svgFactory.createElement("svg:clipPath");
  18865. clipPath.setAttributeNS(null, "id", clipId);
  18866. clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix));
  18867. var clipElement = current.element.cloneNode(true);
  18868. if (this.pendingClip === "evenodd") {
  18869. clipElement.setAttributeNS(null, "clip-rule", "evenodd");
  18870. } else {
  18871. clipElement.setAttributeNS(null, "clip-rule", "nonzero");
  18872. }
  18873. this.pendingClip = null;
  18874. clipPath.appendChild(clipElement);
  18875. this.defs.appendChild(clipPath);
  18876. if (current.activeClipUrl) {
  18877. current.clipGroup = null;
  18878. var _iterator7 = _createForOfIteratorHelper(this.extraStack),
  18879. _step7;
  18880. try {
  18881. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  18882. var prev = _step7.value;
  18883. prev.clipGroup = null;
  18884. }
  18885. } catch (err) {
  18886. _iterator7.e(err);
  18887. } finally {
  18888. _iterator7.f();
  18889. }
  18890. clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl);
  18891. }
  18892. current.activeClipUrl = "url(#".concat(clipId, ")");
  18893. this.tgrp = null;
  18894. }
  18895. }, {
  18896. key: "clip",
  18897. value: function clip(type) {
  18898. this.pendingClip = type;
  18899. }
  18900. }, {
  18901. key: "closePath",
  18902. value: function closePath() {
  18903. var current = this.current;
  18904. if (current.path) {
  18905. var d = "".concat(current.path.getAttributeNS(null, "d"), "Z");
  18906. current.path.setAttributeNS(null, "d", d);
  18907. }
  18908. }
  18909. }, {
  18910. key: "setLeading",
  18911. value: function setLeading(leading) {
  18912. this.current.leading = -leading;
  18913. }
  18914. }, {
  18915. key: "setTextRise",
  18916. value: function setTextRise(textRise) {
  18917. this.current.textRise = textRise;
  18918. }
  18919. }, {
  18920. key: "setTextRenderingMode",
  18921. value: function setTextRenderingMode(textRenderingMode) {
  18922. this.current.textRenderingMode = textRenderingMode;
  18923. }
  18924. }, {
  18925. key: "setHScale",
  18926. value: function setHScale(scale) {
  18927. this.current.textHScale = scale / 100;
  18928. }
  18929. }, {
  18930. key: "setRenderingIntent",
  18931. value: function setRenderingIntent(intent) {}
  18932. }, {
  18933. key: "setFlatness",
  18934. value: function setFlatness(flatness) {}
  18935. }, {
  18936. key: "setGState",
  18937. value: function setGState(states) {
  18938. var _iterator8 = _createForOfIteratorHelper(states),
  18939. _step8;
  18940. try {
  18941. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  18942. var _step8$value = _slicedToArray(_step8.value, 2),
  18943. key = _step8$value[0],
  18944. value = _step8$value[1];
  18945. switch (key) {
  18946. case "LW":
  18947. this.setLineWidth(value);
  18948. break;
  18949. case "LC":
  18950. this.setLineCap(value);
  18951. break;
  18952. case "LJ":
  18953. this.setLineJoin(value);
  18954. break;
  18955. case "ML":
  18956. this.setMiterLimit(value);
  18957. break;
  18958. case "D":
  18959. this.setDash(value[0], value[1]);
  18960. break;
  18961. case "RI":
  18962. this.setRenderingIntent(value);
  18963. break;
  18964. case "FL":
  18965. this.setFlatness(value);
  18966. break;
  18967. case "Font":
  18968. this.setFont(value);
  18969. break;
  18970. case "CA":
  18971. this.setStrokeAlpha(value);
  18972. break;
  18973. case "ca":
  18974. this.setFillAlpha(value);
  18975. break;
  18976. default:
  18977. (0, _util.warn)("Unimplemented graphic state operator ".concat(key));
  18978. break;
  18979. }
  18980. }
  18981. } catch (err) {
  18982. _iterator8.e(err);
  18983. } finally {
  18984. _iterator8.f();
  18985. }
  18986. }
  18987. }, {
  18988. key: "fill",
  18989. value: function fill() {
  18990. var current = this.current;
  18991. if (current.element) {
  18992. current.element.setAttributeNS(null, "fill", current.fillColor);
  18993. current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha);
  18994. this.endPath();
  18995. }
  18996. }
  18997. }, {
  18998. key: "stroke",
  18999. value: function stroke() {
  19000. var current = this.current;
  19001. if (current.element) {
  19002. this._setStrokeAttributes(current.element);
  19003. current.element.setAttributeNS(null, "fill", "none");
  19004. this.endPath();
  19005. }
  19006. }
  19007. }, {
  19008. key: "_setStrokeAttributes",
  19009. value: function _setStrokeAttributes(element) {
  19010. var lineWidthScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  19011. var current = this.current;
  19012. var dashArray = current.dashArray;
  19013. if (lineWidthScale !== 1 && dashArray.length > 0) {
  19014. dashArray = dashArray.map(function (value) {
  19015. return lineWidthScale * value;
  19016. });
  19017. }
  19018. element.setAttributeNS(null, "stroke", current.strokeColor);
  19019. element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha);
  19020. element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit));
  19021. element.setAttributeNS(null, "stroke-linecap", current.lineCap);
  19022. element.setAttributeNS(null, "stroke-linejoin", current.lineJoin);
  19023. element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px");
  19024. element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" "));
  19025. element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px");
  19026. }
  19027. }, {
  19028. key: "eoFill",
  19029. value: function eoFill() {
  19030. if (this.current.element) {
  19031. this.current.element.setAttributeNS(null, "fill-rule", "evenodd");
  19032. }
  19033. this.fill();
  19034. }
  19035. }, {
  19036. key: "fillStroke",
  19037. value: function fillStroke() {
  19038. this.stroke();
  19039. this.fill();
  19040. }
  19041. }, {
  19042. key: "eoFillStroke",
  19043. value: function eoFillStroke() {
  19044. if (this.current.element) {
  19045. this.current.element.setAttributeNS(null, "fill-rule", "evenodd");
  19046. }
  19047. this.fillStroke();
  19048. }
  19049. }, {
  19050. key: "closeStroke",
  19051. value: function closeStroke() {
  19052. this.closePath();
  19053. this.stroke();
  19054. }
  19055. }, {
  19056. key: "closeFillStroke",
  19057. value: function closeFillStroke() {
  19058. this.closePath();
  19059. this.fillStroke();
  19060. }
  19061. }, {
  19062. key: "closeEOFillStroke",
  19063. value: function closeEOFillStroke() {
  19064. this.closePath();
  19065. this.eoFillStroke();
  19066. }
  19067. }, {
  19068. key: "paintSolidColorImageMask",
  19069. value: function paintSolidColorImageMask() {
  19070. var rect = this.svgFactory.createElement("svg:rect");
  19071. rect.setAttributeNS(null, "x", "0");
  19072. rect.setAttributeNS(null, "y", "0");
  19073. rect.setAttributeNS(null, "width", "1px");
  19074. rect.setAttributeNS(null, "height", "1px");
  19075. rect.setAttributeNS(null, "fill", this.current.fillColor);
  19076. this._ensureTransformGroup().appendChild(rect);
  19077. }
  19078. }, {
  19079. key: "paintImageXObject",
  19080. value: function paintImageXObject(objId) {
  19081. var imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
  19082. if (!imgData) {
  19083. (0, _util.warn)("Dependent image with object ID ".concat(objId, " is not ready yet"));
  19084. return;
  19085. }
  19086. this.paintInlineImageXObject(imgData);
  19087. }
  19088. }, {
  19089. key: "paintInlineImageXObject",
  19090. value: function paintInlineImageXObject(imgData, mask) {
  19091. var width = imgData.width;
  19092. var height = imgData.height;
  19093. var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);
  19094. var cliprect = this.svgFactory.createElement("svg:rect");
  19095. cliprect.setAttributeNS(null, "x", "0");
  19096. cliprect.setAttributeNS(null, "y", "0");
  19097. cliprect.setAttributeNS(null, "width", pf(width));
  19098. cliprect.setAttributeNS(null, "height", pf(height));
  19099. this.current.element = cliprect;
  19100. this.clip("nonzero");
  19101. var imgEl = this.svgFactory.createElement("svg:image");
  19102. imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc);
  19103. imgEl.setAttributeNS(null, "x", "0");
  19104. imgEl.setAttributeNS(null, "y", pf(-height));
  19105. imgEl.setAttributeNS(null, "width", pf(width) + "px");
  19106. imgEl.setAttributeNS(null, "height", pf(height) + "px");
  19107. imgEl.setAttributeNS(null, "transform", "scale(".concat(pf(1 / width), " ").concat(pf(-1 / height), ")"));
  19108. if (mask) {
  19109. mask.appendChild(imgEl);
  19110. } else {
  19111. this._ensureTransformGroup().appendChild(imgEl);
  19112. }
  19113. }
  19114. }, {
  19115. key: "paintImageMaskXObject",
  19116. value: function paintImageMaskXObject(imgData) {
  19117. var current = this.current;
  19118. var width = imgData.width;
  19119. var height = imgData.height;
  19120. var fillColor = current.fillColor;
  19121. current.maskId = "mask".concat(maskCount++);
  19122. var mask = this.svgFactory.createElement("svg:mask");
  19123. mask.setAttributeNS(null, "id", current.maskId);
  19124. var rect = this.svgFactory.createElement("svg:rect");
  19125. rect.setAttributeNS(null, "x", "0");
  19126. rect.setAttributeNS(null, "y", "0");
  19127. rect.setAttributeNS(null, "width", pf(width));
  19128. rect.setAttributeNS(null, "height", pf(height));
  19129. rect.setAttributeNS(null, "fill", fillColor);
  19130. rect.setAttributeNS(null, "mask", "url(#".concat(current.maskId, ")"));
  19131. this.defs.appendChild(mask);
  19132. this._ensureTransformGroup().appendChild(rect);
  19133. this.paintInlineImageXObject(imgData, mask);
  19134. }
  19135. }, {
  19136. key: "paintFormXObjectBegin",
  19137. value: function paintFormXObjectBegin(matrix, bbox) {
  19138. if (Array.isArray(matrix) && matrix.length === 6) {
  19139. this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
  19140. }
  19141. if (bbox) {
  19142. var width = bbox[2] - bbox[0];
  19143. var height = bbox[3] - bbox[1];
  19144. var cliprect = this.svgFactory.createElement("svg:rect");
  19145. cliprect.setAttributeNS(null, "x", bbox[0]);
  19146. cliprect.setAttributeNS(null, "y", bbox[1]);
  19147. cliprect.setAttributeNS(null, "width", pf(width));
  19148. cliprect.setAttributeNS(null, "height", pf(height));
  19149. this.current.element = cliprect;
  19150. this.clip("nonzero");
  19151. this.endPath();
  19152. }
  19153. }
  19154. }, {
  19155. key: "paintFormXObjectEnd",
  19156. value: function paintFormXObjectEnd() {}
  19157. }, {
  19158. key: "_initialize",
  19159. value: function _initialize(viewport) {
  19160. var svg = this.svgFactory.create(viewport.width, viewport.height);
  19161. var definitions = this.svgFactory.createElement("svg:defs");
  19162. svg.appendChild(definitions);
  19163. this.defs = definitions;
  19164. var rootGroup = this.svgFactory.createElement("svg:g");
  19165. rootGroup.setAttributeNS(null, "transform", pm(viewport.transform));
  19166. svg.appendChild(rootGroup);
  19167. this.svg = rootGroup;
  19168. return svg;
  19169. }
  19170. }, {
  19171. key: "_ensureClipGroup",
  19172. value: function _ensureClipGroup() {
  19173. if (!this.current.clipGroup) {
  19174. var clipGroup = this.svgFactory.createElement("svg:g");
  19175. clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl);
  19176. this.svg.appendChild(clipGroup);
  19177. this.current.clipGroup = clipGroup;
  19178. }
  19179. return this.current.clipGroup;
  19180. }
  19181. }, {
  19182. key: "_ensureTransformGroup",
  19183. value: function _ensureTransformGroup() {
  19184. if (!this.tgrp) {
  19185. this.tgrp = this.svgFactory.createElement("svg:g");
  19186. this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix));
  19187. if (this.current.activeClipUrl) {
  19188. this._ensureClipGroup().appendChild(this.tgrp);
  19189. } else {
  19190. this.svg.appendChild(this.tgrp);
  19191. }
  19192. }
  19193. return this.tgrp;
  19194. }
  19195. }]);
  19196. return SVGGraphics;
  19197. }();
  19198. }
  19199. /***/ }),
  19200. /* 178 */
  19201. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19202. "use strict";
  19203. function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
  19204. Object.defineProperty(exports, "__esModule", ({
  19205. value: true
  19206. }));
  19207. exports.PDFNodeStream = void 0;
  19208. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  19209. var _util = __w_pdfjs_require__(1);
  19210. var _network_utils = __w_pdfjs_require__(179);
  19211. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  19212. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19213. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19214. 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); }; }
  19215. 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); }
  19216. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19217. 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; } }
  19218. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19219. 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); } }
  19220. 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); }); }; }
  19221. 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; } } }; }
  19222. 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); }
  19223. 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; }
  19224. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19225. 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); } }
  19226. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  19227. ;
  19228. var fs = require("fs");
  19229. var http = require("http");
  19230. var https = require("https");
  19231. var url = require("url");
  19232. var fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
  19233. function parseUrl(sourceUrl) {
  19234. var parsedUrl = url.parse(sourceUrl);
  19235. if (parsedUrl.protocol === "file:" || parsedUrl.host) {
  19236. return parsedUrl;
  19237. }
  19238. if (/^[a-z]:[/\\]/i.test(sourceUrl)) {
  19239. return url.parse("file:///".concat(sourceUrl));
  19240. }
  19241. if (!parsedUrl.host) {
  19242. parsedUrl.protocol = "file:";
  19243. }
  19244. return parsedUrl;
  19245. }
  19246. var PDFNodeStream = /*#__PURE__*/function () {
  19247. function PDFNodeStream(source) {
  19248. _classCallCheck(this, PDFNodeStream);
  19249. this.source = source;
  19250. this.url = parseUrl(source.url);
  19251. this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:";
  19252. this.isFsUrl = this.url.protocol === "file:";
  19253. this.httpHeaders = this.isHttp && source.httpHeaders || {};
  19254. this._fullRequestReader = null;
  19255. this._rangeRequestReaders = [];
  19256. }
  19257. _createClass(PDFNodeStream, [{
  19258. key: "_progressiveDataLength",
  19259. get: function get() {
  19260. var _this$_fullRequestRea, _this$_fullRequestRea2;
  19261. return (_this$_fullRequestRea = (_this$_fullRequestRea2 = this._fullRequestReader) === null || _this$_fullRequestRea2 === void 0 ? void 0 : _this$_fullRequestRea2._loaded) !== null && _this$_fullRequestRea !== void 0 ? _this$_fullRequestRea : 0;
  19262. }
  19263. }, {
  19264. key: "getFullReader",
  19265. value: function getFullReader() {
  19266. (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
  19267. this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
  19268. return this._fullRequestReader;
  19269. }
  19270. }, {
  19271. key: "getRangeReader",
  19272. value: function getRangeReader(start, end) {
  19273. if (end <= this._progressiveDataLength) {
  19274. return null;
  19275. }
  19276. var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
  19277. this._rangeRequestReaders.push(rangeReader);
  19278. return rangeReader;
  19279. }
  19280. }, {
  19281. key: "cancelAllRequests",
  19282. value: function cancelAllRequests(reason) {
  19283. if (this._fullRequestReader) {
  19284. this._fullRequestReader.cancel(reason);
  19285. }
  19286. var _iterator = _createForOfIteratorHelper(this._rangeRequestReaders.slice(0)),
  19287. _step;
  19288. try {
  19289. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  19290. var reader = _step.value;
  19291. reader.cancel(reason);
  19292. }
  19293. } catch (err) {
  19294. _iterator.e(err);
  19295. } finally {
  19296. _iterator.f();
  19297. }
  19298. }
  19299. }]);
  19300. return PDFNodeStream;
  19301. }();
  19302. exports.PDFNodeStream = PDFNodeStream;
  19303. var BaseFullReader = /*#__PURE__*/function () {
  19304. function BaseFullReader(stream) {
  19305. _classCallCheck(this, BaseFullReader);
  19306. this._url = stream.url;
  19307. this._done = false;
  19308. this._storedError = null;
  19309. this.onProgress = null;
  19310. var source = stream.source;
  19311. this._contentLength = source.length;
  19312. this._loaded = 0;
  19313. this._filename = null;
  19314. this._disableRange = source.disableRange || false;
  19315. this._rangeChunkSize = source.rangeChunkSize;
  19316. if (!this._rangeChunkSize && !this._disableRange) {
  19317. this._disableRange = true;
  19318. }
  19319. this._isStreamingSupported = !source.disableStream;
  19320. this._isRangeSupported = !source.disableRange;
  19321. this._readableStream = null;
  19322. this._readCapability = (0, _util.createPromiseCapability)();
  19323. this._headersCapability = (0, _util.createPromiseCapability)();
  19324. }
  19325. _createClass(BaseFullReader, [{
  19326. key: "headersReady",
  19327. get: function get() {
  19328. return this._headersCapability.promise;
  19329. }
  19330. }, {
  19331. key: "filename",
  19332. get: function get() {
  19333. return this._filename;
  19334. }
  19335. }, {
  19336. key: "contentLength",
  19337. get: function get() {
  19338. return this._contentLength;
  19339. }
  19340. }, {
  19341. key: "isRangeSupported",
  19342. get: function get() {
  19343. return this._isRangeSupported;
  19344. }
  19345. }, {
  19346. key: "isStreamingSupported",
  19347. get: function get() {
  19348. return this._isStreamingSupported;
  19349. }
  19350. }, {
  19351. key: "read",
  19352. value: function () {
  19353. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  19354. var chunk, buffer;
  19355. return _regenerator["default"].wrap(function _callee$(_context) {
  19356. while (1) {
  19357. switch (_context.prev = _context.next) {
  19358. case 0:
  19359. _context.next = 2;
  19360. return this._readCapability.promise;
  19361. case 2:
  19362. if (!this._done) {
  19363. _context.next = 4;
  19364. break;
  19365. }
  19366. return _context.abrupt("return", {
  19367. value: undefined,
  19368. done: true
  19369. });
  19370. case 4:
  19371. if (!this._storedError) {
  19372. _context.next = 6;
  19373. break;
  19374. }
  19375. throw this._storedError;
  19376. case 6:
  19377. chunk = this._readableStream.read();
  19378. if (!(chunk === null)) {
  19379. _context.next = 10;
  19380. break;
  19381. }
  19382. this._readCapability = (0, _util.createPromiseCapability)();
  19383. return _context.abrupt("return", this.read());
  19384. case 10:
  19385. this._loaded += chunk.length;
  19386. if (this.onProgress) {
  19387. this.onProgress({
  19388. loaded: this._loaded,
  19389. total: this._contentLength
  19390. });
  19391. }
  19392. buffer = new Uint8Array(chunk).buffer;
  19393. return _context.abrupt("return", {
  19394. value: buffer,
  19395. done: false
  19396. });
  19397. case 14:
  19398. case "end":
  19399. return _context.stop();
  19400. }
  19401. }
  19402. }, _callee, this);
  19403. }));
  19404. function read() {
  19405. return _read.apply(this, arguments);
  19406. }
  19407. return read;
  19408. }()
  19409. }, {
  19410. key: "cancel",
  19411. value: function cancel(reason) {
  19412. if (!this._readableStream) {
  19413. this._error(reason);
  19414. return;
  19415. }
  19416. this._readableStream.destroy(reason);
  19417. }
  19418. }, {
  19419. key: "_error",
  19420. value: function _error(reason) {
  19421. this._storedError = reason;
  19422. this._readCapability.resolve();
  19423. }
  19424. }, {
  19425. key: "_setReadableStream",
  19426. value: function _setReadableStream(readableStream) {
  19427. var _this = this;
  19428. this._readableStream = readableStream;
  19429. readableStream.on("readable", function () {
  19430. _this._readCapability.resolve();
  19431. });
  19432. readableStream.on("end", function () {
  19433. readableStream.destroy();
  19434. _this._done = true;
  19435. _this._readCapability.resolve();
  19436. });
  19437. readableStream.on("error", function (reason) {
  19438. _this._error(reason);
  19439. });
  19440. if (!this._isStreamingSupported && this._isRangeSupported) {
  19441. this._error(new _util.AbortException("streaming is disabled"));
  19442. }
  19443. if (this._storedError) {
  19444. this._readableStream.destroy(this._storedError);
  19445. }
  19446. }
  19447. }]);
  19448. return BaseFullReader;
  19449. }();
  19450. var BaseRangeReader = /*#__PURE__*/function () {
  19451. function BaseRangeReader(stream) {
  19452. _classCallCheck(this, BaseRangeReader);
  19453. this._url = stream.url;
  19454. this._done = false;
  19455. this._storedError = null;
  19456. this.onProgress = null;
  19457. this._loaded = 0;
  19458. this._readableStream = null;
  19459. this._readCapability = (0, _util.createPromiseCapability)();
  19460. var source = stream.source;
  19461. this._isStreamingSupported = !source.disableStream;
  19462. }
  19463. _createClass(BaseRangeReader, [{
  19464. key: "isStreamingSupported",
  19465. get: function get() {
  19466. return this._isStreamingSupported;
  19467. }
  19468. }, {
  19469. key: "read",
  19470. value: function () {
  19471. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  19472. var chunk, buffer;
  19473. return _regenerator["default"].wrap(function _callee2$(_context2) {
  19474. while (1) {
  19475. switch (_context2.prev = _context2.next) {
  19476. case 0:
  19477. _context2.next = 2;
  19478. return this._readCapability.promise;
  19479. case 2:
  19480. if (!this._done) {
  19481. _context2.next = 4;
  19482. break;
  19483. }
  19484. return _context2.abrupt("return", {
  19485. value: undefined,
  19486. done: true
  19487. });
  19488. case 4:
  19489. if (!this._storedError) {
  19490. _context2.next = 6;
  19491. break;
  19492. }
  19493. throw this._storedError;
  19494. case 6:
  19495. chunk = this._readableStream.read();
  19496. if (!(chunk === null)) {
  19497. _context2.next = 10;
  19498. break;
  19499. }
  19500. this._readCapability = (0, _util.createPromiseCapability)();
  19501. return _context2.abrupt("return", this.read());
  19502. case 10:
  19503. this._loaded += chunk.length;
  19504. if (this.onProgress) {
  19505. this.onProgress({
  19506. loaded: this._loaded
  19507. });
  19508. }
  19509. buffer = new Uint8Array(chunk).buffer;
  19510. return _context2.abrupt("return", {
  19511. value: buffer,
  19512. done: false
  19513. });
  19514. case 14:
  19515. case "end":
  19516. return _context2.stop();
  19517. }
  19518. }
  19519. }, _callee2, this);
  19520. }));
  19521. function read() {
  19522. return _read2.apply(this, arguments);
  19523. }
  19524. return read;
  19525. }()
  19526. }, {
  19527. key: "cancel",
  19528. value: function cancel(reason) {
  19529. if (!this._readableStream) {
  19530. this._error(reason);
  19531. return;
  19532. }
  19533. this._readableStream.destroy(reason);
  19534. }
  19535. }, {
  19536. key: "_error",
  19537. value: function _error(reason) {
  19538. this._storedError = reason;
  19539. this._readCapability.resolve();
  19540. }
  19541. }, {
  19542. key: "_setReadableStream",
  19543. value: function _setReadableStream(readableStream) {
  19544. var _this2 = this;
  19545. this._readableStream = readableStream;
  19546. readableStream.on("readable", function () {
  19547. _this2._readCapability.resolve();
  19548. });
  19549. readableStream.on("end", function () {
  19550. readableStream.destroy();
  19551. _this2._done = true;
  19552. _this2._readCapability.resolve();
  19553. });
  19554. readableStream.on("error", function (reason) {
  19555. _this2._error(reason);
  19556. });
  19557. if (this._storedError) {
  19558. this._readableStream.destroy(this._storedError);
  19559. }
  19560. }
  19561. }]);
  19562. return BaseRangeReader;
  19563. }();
  19564. function createRequestOptions(parsedUrl, headers) {
  19565. return {
  19566. protocol: parsedUrl.protocol,
  19567. auth: parsedUrl.auth,
  19568. host: parsedUrl.hostname,
  19569. port: parsedUrl.port,
  19570. path: parsedUrl.path,
  19571. method: "GET",
  19572. headers: headers
  19573. };
  19574. }
  19575. var PDFNodeStreamFullReader = /*#__PURE__*/function (_BaseFullReader) {
  19576. _inherits(PDFNodeStreamFullReader, _BaseFullReader);
  19577. var _super = _createSuper(PDFNodeStreamFullReader);
  19578. function PDFNodeStreamFullReader(stream) {
  19579. var _this3;
  19580. _classCallCheck(this, PDFNodeStreamFullReader);
  19581. _this3 = _super.call(this, stream);
  19582. var handleResponse = function handleResponse(response) {
  19583. if (response.statusCode === 404) {
  19584. var error = new _util.MissingPDFException("Missing PDF \"".concat(_this3._url, "\"."));
  19585. _this3._storedError = error;
  19586. _this3._headersCapability.reject(error);
  19587. return;
  19588. }
  19589. _this3._headersCapability.resolve();
  19590. _this3._setReadableStream(response);
  19591. var getResponseHeader = function getResponseHeader(name) {
  19592. return _this3._readableStream.headers[name.toLowerCase()];
  19593. };
  19594. var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
  19595. getResponseHeader: getResponseHeader,
  19596. isHttp: stream.isHttp,
  19597. rangeChunkSize: _this3._rangeChunkSize,
  19598. disableRange: _this3._disableRange
  19599. }),
  19600. allowRangeRequests = _validateRangeRequest.allowRangeRequests,
  19601. suggestedLength = _validateRangeRequest.suggestedLength;
  19602. _this3._isRangeSupported = allowRangeRequests;
  19603. _this3._contentLength = suggestedLength || _this3._contentLength;
  19604. _this3._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
  19605. };
  19606. _this3._request = null;
  19607. if (_this3._url.protocol === "http:") {
  19608. _this3._request = http.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse);
  19609. } else {
  19610. _this3._request = https.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse);
  19611. }
  19612. _this3._request.on("error", function (reason) {
  19613. _this3._storedError = reason;
  19614. _this3._headersCapability.reject(reason);
  19615. });
  19616. _this3._request.end();
  19617. return _this3;
  19618. }
  19619. return _createClass(PDFNodeStreamFullReader);
  19620. }(BaseFullReader);
  19621. var PDFNodeStreamRangeReader = /*#__PURE__*/function (_BaseRangeReader) {
  19622. _inherits(PDFNodeStreamRangeReader, _BaseRangeReader);
  19623. var _super2 = _createSuper(PDFNodeStreamRangeReader);
  19624. function PDFNodeStreamRangeReader(stream, start, end) {
  19625. var _this4;
  19626. _classCallCheck(this, PDFNodeStreamRangeReader);
  19627. _this4 = _super2.call(this, stream);
  19628. _this4._httpHeaders = {};
  19629. for (var property in stream.httpHeaders) {
  19630. var value = stream.httpHeaders[property];
  19631. if (typeof value === "undefined") {
  19632. continue;
  19633. }
  19634. _this4._httpHeaders[property] = value;
  19635. }
  19636. _this4._httpHeaders.Range = "bytes=".concat(start, "-").concat(end - 1);
  19637. var handleResponse = function handleResponse(response) {
  19638. if (response.statusCode === 404) {
  19639. var error = new _util.MissingPDFException("Missing PDF \"".concat(_this4._url, "\"."));
  19640. _this4._storedError = error;
  19641. return;
  19642. }
  19643. _this4._setReadableStream(response);
  19644. };
  19645. _this4._request = null;
  19646. if (_this4._url.protocol === "http:") {
  19647. _this4._request = http.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse);
  19648. } else {
  19649. _this4._request = https.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse);
  19650. }
  19651. _this4._request.on("error", function (reason) {
  19652. _this4._storedError = reason;
  19653. });
  19654. _this4._request.end();
  19655. return _this4;
  19656. }
  19657. return _createClass(PDFNodeStreamRangeReader);
  19658. }(BaseRangeReader);
  19659. var PDFNodeStreamFsFullReader = /*#__PURE__*/function (_BaseFullReader2) {
  19660. _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2);
  19661. var _super3 = _createSuper(PDFNodeStreamFsFullReader);
  19662. function PDFNodeStreamFsFullReader(stream) {
  19663. var _this5;
  19664. _classCallCheck(this, PDFNodeStreamFsFullReader);
  19665. _this5 = _super3.call(this, stream);
  19666. var path = decodeURIComponent(_this5._url.path);
  19667. if (fileUriRegex.test(_this5._url.href)) {
  19668. path = path.replace(/^\//, "");
  19669. }
  19670. fs.lstat(path, function (error, stat) {
  19671. if (error) {
  19672. if (error.code === "ENOENT") {
  19673. error = new _util.MissingPDFException("Missing PDF \"".concat(path, "\"."));
  19674. }
  19675. _this5._storedError = error;
  19676. _this5._headersCapability.reject(error);
  19677. return;
  19678. }
  19679. _this5._contentLength = stat.size;
  19680. _this5._setReadableStream(fs.createReadStream(path));
  19681. _this5._headersCapability.resolve();
  19682. });
  19683. return _this5;
  19684. }
  19685. return _createClass(PDFNodeStreamFsFullReader);
  19686. }(BaseFullReader);
  19687. var PDFNodeStreamFsRangeReader = /*#__PURE__*/function (_BaseRangeReader2) {
  19688. _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2);
  19689. var _super4 = _createSuper(PDFNodeStreamFsRangeReader);
  19690. function PDFNodeStreamFsRangeReader(stream, start, end) {
  19691. var _this6;
  19692. _classCallCheck(this, PDFNodeStreamFsRangeReader);
  19693. _this6 = _super4.call(this, stream);
  19694. var path = decodeURIComponent(_this6._url.path);
  19695. if (fileUriRegex.test(_this6._url.href)) {
  19696. path = path.replace(/^\//, "");
  19697. }
  19698. _this6._setReadableStream(fs.createReadStream(path, {
  19699. start: start,
  19700. end: end - 1
  19701. }));
  19702. return _this6;
  19703. }
  19704. return _createClass(PDFNodeStreamFsRangeReader);
  19705. }(BaseRangeReader);
  19706. /***/ }),
  19707. /* 179 */
  19708. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19709. "use strict";
  19710. Object.defineProperty(exports, "__esModule", ({
  19711. value: true
  19712. }));
  19713. exports.createResponseStatusError = createResponseStatusError;
  19714. exports.extractFilenameFromHeader = extractFilenameFromHeader;
  19715. exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
  19716. exports.validateResponseStatus = validateResponseStatus;
  19717. var _util = __w_pdfjs_require__(1);
  19718. var _content_disposition = __w_pdfjs_require__(180);
  19719. var _display_utils = __w_pdfjs_require__(158);
  19720. function validateRangeRequestCapabilities(_ref) {
  19721. var getResponseHeader = _ref.getResponseHeader,
  19722. isHttp = _ref.isHttp,
  19723. rangeChunkSize = _ref.rangeChunkSize,
  19724. disableRange = _ref.disableRange;
  19725. var returnValues = {
  19726. allowRangeRequests: false,
  19727. suggestedLength: undefined
  19728. };
  19729. var length = parseInt(getResponseHeader("Content-Length"), 10);
  19730. if (!Number.isInteger(length)) {
  19731. return returnValues;
  19732. }
  19733. returnValues.suggestedLength = length;
  19734. if (length <= 2 * rangeChunkSize) {
  19735. return returnValues;
  19736. }
  19737. if (disableRange || !isHttp) {
  19738. return returnValues;
  19739. }
  19740. if (getResponseHeader("Accept-Ranges") !== "bytes") {
  19741. return returnValues;
  19742. }
  19743. var contentEncoding = getResponseHeader("Content-Encoding") || "identity";
  19744. if (contentEncoding !== "identity") {
  19745. return returnValues;
  19746. }
  19747. returnValues.allowRangeRequests = true;
  19748. return returnValues;
  19749. }
  19750. function extractFilenameFromHeader(getResponseHeader) {
  19751. var contentDisposition = getResponseHeader("Content-Disposition");
  19752. if (contentDisposition) {
  19753. var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
  19754. if (filename.includes("%")) {
  19755. try {
  19756. filename = decodeURIComponent(filename);
  19757. } catch (ex) {}
  19758. }
  19759. if ((0, _display_utils.isPdfFile)(filename)) {
  19760. return filename;
  19761. }
  19762. }
  19763. return null;
  19764. }
  19765. function createResponseStatusError(status, url) {
  19766. if (status === 404 || status === 0 && url.startsWith("file:")) {
  19767. return new _util.MissingPDFException('Missing PDF "' + url + '".');
  19768. }
  19769. return new _util.UnexpectedResponseException("Unexpected server response (".concat(status, ") while retrieving PDF \"").concat(url, "\"."), status);
  19770. }
  19771. function validateResponseStatus(status) {
  19772. return status === 200 || status === 206;
  19773. }
  19774. /***/ }),
  19775. /* 180 */
  19776. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19777. "use strict";
  19778. Object.defineProperty(exports, "__esModule", ({
  19779. value: true
  19780. }));
  19781. exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;
  19782. var _util = __w_pdfjs_require__(1);
  19783. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  19784. 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."); }
  19785. 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); }
  19786. 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; }
  19787. 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; }
  19788. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  19789. function getFilenameFromContentDispositionHeader(contentDisposition) {
  19790. var needsEncodingFixup = true;
  19791. var tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition);
  19792. if (tmp) {
  19793. tmp = tmp[1];
  19794. var filename = rfc2616unquote(tmp);
  19795. filename = unescape(filename);
  19796. filename = rfc5987decode(filename);
  19797. filename = rfc2047decode(filename);
  19798. return fixupEncoding(filename);
  19799. }
  19800. tmp = rfc2231getparam(contentDisposition);
  19801. if (tmp) {
  19802. var _filename = rfc2047decode(tmp);
  19803. return fixupEncoding(_filename);
  19804. }
  19805. tmp = toParamRegExp("filename", "i").exec(contentDisposition);
  19806. if (tmp) {
  19807. tmp = tmp[1];
  19808. var _filename2 = rfc2616unquote(tmp);
  19809. _filename2 = rfc2047decode(_filename2);
  19810. return fixupEncoding(_filename2);
  19811. }
  19812. function toParamRegExp(attributePattern, flags) {
  19813. return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags);
  19814. }
  19815. function textdecode(encoding, value) {
  19816. if (encoding) {
  19817. if (!/^[\x00-\xFF]+$/.test(value)) {
  19818. return value;
  19819. }
  19820. try {
  19821. var decoder = new TextDecoder(encoding, {
  19822. fatal: true
  19823. });
  19824. var buffer = (0, _util.stringToBytes)(value);
  19825. value = decoder.decode(buffer);
  19826. needsEncodingFixup = false;
  19827. } catch (e) {}
  19828. }
  19829. return value;
  19830. }
  19831. function fixupEncoding(value) {
  19832. if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
  19833. value = textdecode("utf-8", value);
  19834. if (needsEncodingFixup) {
  19835. value = textdecode("iso-8859-1", value);
  19836. }
  19837. }
  19838. return value;
  19839. }
  19840. function rfc2231getparam(contentDispositionStr) {
  19841. var matches = [];
  19842. var match;
  19843. var iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
  19844. while ((match = iter.exec(contentDispositionStr)) !== null) {
  19845. var _match = match,
  19846. _match2 = _slicedToArray(_match, 4),
  19847. n = _match2[1],
  19848. quot = _match2[2],
  19849. part = _match2[3];
  19850. n = parseInt(n, 10);
  19851. if (n in matches) {
  19852. if (n === 0) {
  19853. break;
  19854. }
  19855. continue;
  19856. }
  19857. matches[n] = [quot, part];
  19858. }
  19859. var parts = [];
  19860. for (var _n2 = 0; _n2 < matches.length; ++_n2) {
  19861. if (!(_n2 in matches)) {
  19862. break;
  19863. }
  19864. var _matches$_n = _slicedToArray(matches[_n2], 2),
  19865. _quot = _matches$_n[0],
  19866. _part = _matches$_n[1];
  19867. _part = rfc2616unquote(_part);
  19868. if (_quot) {
  19869. _part = unescape(_part);
  19870. if (_n2 === 0) {
  19871. _part = rfc5987decode(_part);
  19872. }
  19873. }
  19874. parts.push(_part);
  19875. }
  19876. return parts.join("");
  19877. }
  19878. function rfc2616unquote(value) {
  19879. if (value.startsWith('"')) {
  19880. var parts = value.slice(1).split('\\"');
  19881. for (var i = 0; i < parts.length; ++i) {
  19882. var quotindex = parts[i].indexOf('"');
  19883. if (quotindex !== -1) {
  19884. parts[i] = parts[i].slice(0, quotindex);
  19885. parts.length = i + 1;
  19886. }
  19887. parts[i] = parts[i].replace(/\\(.)/g, "$1");
  19888. }
  19889. value = parts.join('"');
  19890. }
  19891. return value;
  19892. }
  19893. function rfc5987decode(extvalue) {
  19894. var encodingend = extvalue.indexOf("'");
  19895. if (encodingend === -1) {
  19896. return extvalue;
  19897. }
  19898. var encoding = extvalue.slice(0, encodingend);
  19899. var langvalue = extvalue.slice(encodingend + 1);
  19900. var value = langvalue.replace(/^[^']*'/, "");
  19901. return textdecode(encoding, value);
  19902. }
  19903. function rfc2047decode(value) {
  19904. if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
  19905. return value;
  19906. }
  19907. return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
  19908. if (encoding === "q" || encoding === "Q") {
  19909. text = text.replace(/_/g, " ");
  19910. text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) {
  19911. return String.fromCharCode(parseInt(hex, 16));
  19912. });
  19913. return textdecode(charset, text);
  19914. }
  19915. try {
  19916. text = atob(text);
  19917. } catch (e) {}
  19918. return textdecode(charset, text);
  19919. });
  19920. }
  19921. return "";
  19922. }
  19923. /***/ }),
  19924. /* 181 */
  19925. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19926. "use strict";
  19927. Object.defineProperty(exports, "__esModule", ({
  19928. value: true
  19929. }));
  19930. exports.PDFNetworkStream = void 0;
  19931. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  19932. var _util = __w_pdfjs_require__(1);
  19933. var _network_utils = __w_pdfjs_require__(179);
  19934. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  19935. 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); } }
  19936. 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); }); }; }
  19937. 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; } } }; }
  19938. 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); }
  19939. 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; }
  19940. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19941. 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); } }
  19942. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  19943. ;
  19944. var OK_RESPONSE = 200;
  19945. var PARTIAL_CONTENT_RESPONSE = 206;
  19946. function getArrayBuffer(xhr) {
  19947. var data = xhr.response;
  19948. if (typeof data !== "string") {
  19949. return data;
  19950. }
  19951. var array = (0, _util.stringToBytes)(data);
  19952. return array.buffer;
  19953. }
  19954. var NetworkManager = /*#__PURE__*/function () {
  19955. function NetworkManager(url) {
  19956. var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19957. _classCallCheck(this, NetworkManager);
  19958. this.url = url;
  19959. this.isHttp = /^https?:/i.test(url);
  19960. this.httpHeaders = this.isHttp && args.httpHeaders || Object.create(null);
  19961. this.withCredentials = args.withCredentials || false;
  19962. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  19963. return new XMLHttpRequest();
  19964. };
  19965. this.currXhrId = 0;
  19966. this.pendingRequests = Object.create(null);
  19967. }
  19968. _createClass(NetworkManager, [{
  19969. key: "requestRange",
  19970. value: function requestRange(begin, end, listeners) {
  19971. var args = {
  19972. begin: begin,
  19973. end: end
  19974. };
  19975. for (var prop in listeners) {
  19976. args[prop] = listeners[prop];
  19977. }
  19978. return this.request(args);
  19979. }
  19980. }, {
  19981. key: "requestFull",
  19982. value: function requestFull(listeners) {
  19983. return this.request(listeners);
  19984. }
  19985. }, {
  19986. key: "request",
  19987. value: function request(args) {
  19988. var xhr = this.getXhr();
  19989. var xhrId = this.currXhrId++;
  19990. var pendingRequest = this.pendingRequests[xhrId] = {
  19991. xhr: xhr
  19992. };
  19993. xhr.open("GET", this.url);
  19994. xhr.withCredentials = this.withCredentials;
  19995. for (var property in this.httpHeaders) {
  19996. var value = this.httpHeaders[property];
  19997. if (typeof value === "undefined") {
  19998. continue;
  19999. }
  20000. xhr.setRequestHeader(property, value);
  20001. }
  20002. if (this.isHttp && "begin" in args && "end" in args) {
  20003. xhr.setRequestHeader("Range", "bytes=".concat(args.begin, "-").concat(args.end - 1));
  20004. pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
  20005. } else {
  20006. pendingRequest.expectedStatus = OK_RESPONSE;
  20007. }
  20008. xhr.responseType = "arraybuffer";
  20009. if (args.onError) {
  20010. xhr.onerror = function (evt) {
  20011. args.onError(xhr.status);
  20012. };
  20013. }
  20014. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  20015. xhr.onprogress = this.onProgress.bind(this, xhrId);
  20016. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  20017. pendingRequest.onDone = args.onDone;
  20018. pendingRequest.onError = args.onError;
  20019. pendingRequest.onProgress = args.onProgress;
  20020. xhr.send(null);
  20021. return xhrId;
  20022. }
  20023. }, {
  20024. key: "onProgress",
  20025. value: function onProgress(xhrId, evt) {
  20026. var _pendingRequest$onPro;
  20027. var pendingRequest = this.pendingRequests[xhrId];
  20028. if (!pendingRequest) {
  20029. return;
  20030. }
  20031. (_pendingRequest$onPro = pendingRequest.onProgress) === null || _pendingRequest$onPro === void 0 ? void 0 : _pendingRequest$onPro.call(pendingRequest, evt);
  20032. }
  20033. }, {
  20034. key: "onStateChange",
  20035. value: function onStateChange(xhrId, evt) {
  20036. var pendingRequest = this.pendingRequests[xhrId];
  20037. if (!pendingRequest) {
  20038. return;
  20039. }
  20040. var xhr = pendingRequest.xhr;
  20041. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  20042. pendingRequest.onHeadersReceived();
  20043. delete pendingRequest.onHeadersReceived;
  20044. }
  20045. if (xhr.readyState !== 4) {
  20046. return;
  20047. }
  20048. if (!(xhrId in this.pendingRequests)) {
  20049. return;
  20050. }
  20051. delete this.pendingRequests[xhrId];
  20052. if (xhr.status === 0 && this.isHttp) {
  20053. var _pendingRequest$onErr;
  20054. (_pendingRequest$onErr = pendingRequest.onError) === null || _pendingRequest$onErr === void 0 ? void 0 : _pendingRequest$onErr.call(pendingRequest, xhr.status);
  20055. return;
  20056. }
  20057. var xhrStatus = xhr.status || OK_RESPONSE;
  20058. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  20059. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  20060. var _pendingRequest$onErr2;
  20061. (_pendingRequest$onErr2 = pendingRequest.onError) === null || _pendingRequest$onErr2 === void 0 ? void 0 : _pendingRequest$onErr2.call(pendingRequest, xhr.status);
  20062. return;
  20063. }
  20064. var chunk = getArrayBuffer(xhr);
  20065. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  20066. var rangeHeader = xhr.getResponseHeader("Content-Range");
  20067. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  20068. pendingRequest.onDone({
  20069. begin: parseInt(matches[1], 10),
  20070. chunk: chunk
  20071. });
  20072. } else if (chunk) {
  20073. pendingRequest.onDone({
  20074. begin: 0,
  20075. chunk: chunk
  20076. });
  20077. } else {
  20078. var _pendingRequest$onErr3;
  20079. (_pendingRequest$onErr3 = pendingRequest.onError) === null || _pendingRequest$onErr3 === void 0 ? void 0 : _pendingRequest$onErr3.call(pendingRequest, xhr.status);
  20080. }
  20081. }
  20082. }, {
  20083. key: "getRequestXhr",
  20084. value: function getRequestXhr(xhrId) {
  20085. return this.pendingRequests[xhrId].xhr;
  20086. }
  20087. }, {
  20088. key: "isPendingRequest",
  20089. value: function isPendingRequest(xhrId) {
  20090. return xhrId in this.pendingRequests;
  20091. }
  20092. }, {
  20093. key: "abortRequest",
  20094. value: function abortRequest(xhrId) {
  20095. var xhr = this.pendingRequests[xhrId].xhr;
  20096. delete this.pendingRequests[xhrId];
  20097. xhr.abort();
  20098. }
  20099. }]);
  20100. return NetworkManager;
  20101. }();
  20102. var PDFNetworkStream = /*#__PURE__*/function () {
  20103. function PDFNetworkStream(source) {
  20104. _classCallCheck(this, PDFNetworkStream);
  20105. this._source = source;
  20106. this._manager = new NetworkManager(source.url, {
  20107. httpHeaders: source.httpHeaders,
  20108. withCredentials: source.withCredentials
  20109. });
  20110. this._rangeChunkSize = source.rangeChunkSize;
  20111. this._fullRequestReader = null;
  20112. this._rangeRequestReaders = [];
  20113. }
  20114. _createClass(PDFNetworkStream, [{
  20115. key: "_onRangeRequestReaderClosed",
  20116. value: function _onRangeRequestReaderClosed(reader) {
  20117. var i = this._rangeRequestReaders.indexOf(reader);
  20118. if (i >= 0) {
  20119. this._rangeRequestReaders.splice(i, 1);
  20120. }
  20121. }
  20122. }, {
  20123. key: "getFullReader",
  20124. value: function getFullReader() {
  20125. (0, _util.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
  20126. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
  20127. return this._fullRequestReader;
  20128. }
  20129. }, {
  20130. key: "getRangeReader",
  20131. value: function getRangeReader(begin, end) {
  20132. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  20133. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  20134. this._rangeRequestReaders.push(reader);
  20135. return reader;
  20136. }
  20137. }, {
  20138. key: "cancelAllRequests",
  20139. value: function cancelAllRequests(reason) {
  20140. var _this$_fullRequestRea;
  20141. (_this$_fullRequestRea = this._fullRequestReader) === null || _this$_fullRequestRea === void 0 ? void 0 : _this$_fullRequestRea.cancel(reason);
  20142. var _iterator = _createForOfIteratorHelper(this._rangeRequestReaders.slice(0)),
  20143. _step;
  20144. try {
  20145. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  20146. var reader = _step.value;
  20147. reader.cancel(reason);
  20148. }
  20149. } catch (err) {
  20150. _iterator.e(err);
  20151. } finally {
  20152. _iterator.f();
  20153. }
  20154. }
  20155. }]);
  20156. return PDFNetworkStream;
  20157. }();
  20158. exports.PDFNetworkStream = PDFNetworkStream;
  20159. var PDFNetworkStreamFullRequestReader = /*#__PURE__*/function () {
  20160. function PDFNetworkStreamFullRequestReader(manager, source) {
  20161. _classCallCheck(this, PDFNetworkStreamFullRequestReader);
  20162. this._manager = manager;
  20163. var args = {
  20164. onHeadersReceived: this._onHeadersReceived.bind(this),
  20165. onDone: this._onDone.bind(this),
  20166. onError: this._onError.bind(this),
  20167. onProgress: this._onProgress.bind(this)
  20168. };
  20169. this._url = source.url;
  20170. this._fullRequestId = manager.requestFull(args);
  20171. this._headersReceivedCapability = (0, _util.createPromiseCapability)();
  20172. this._disableRange = source.disableRange || false;
  20173. this._contentLength = source.length;
  20174. this._rangeChunkSize = source.rangeChunkSize;
  20175. if (!this._rangeChunkSize && !this._disableRange) {
  20176. this._disableRange = true;
  20177. }
  20178. this._isStreamingSupported = false;
  20179. this._isRangeSupported = false;
  20180. this._cachedChunks = [];
  20181. this._requests = [];
  20182. this._done = false;
  20183. this._storedError = undefined;
  20184. this._filename = null;
  20185. this.onProgress = null;
  20186. }
  20187. _createClass(PDFNetworkStreamFullRequestReader, [{
  20188. key: "_onHeadersReceived",
  20189. value: function _onHeadersReceived() {
  20190. var fullRequestXhrId = this._fullRequestId;
  20191. var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
  20192. var getResponseHeader = function getResponseHeader(name) {
  20193. return fullRequestXhr.getResponseHeader(name);
  20194. };
  20195. var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
  20196. getResponseHeader: getResponseHeader,
  20197. isHttp: this._manager.isHttp,
  20198. rangeChunkSize: this._rangeChunkSize,
  20199. disableRange: this._disableRange
  20200. }),
  20201. allowRangeRequests = _validateRangeRequest.allowRangeRequests,
  20202. suggestedLength = _validateRangeRequest.suggestedLength;
  20203. if (allowRangeRequests) {
  20204. this._isRangeSupported = true;
  20205. }
  20206. this._contentLength = suggestedLength || this._contentLength;
  20207. this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
  20208. if (this._isRangeSupported) {
  20209. this._manager.abortRequest(fullRequestXhrId);
  20210. }
  20211. this._headersReceivedCapability.resolve();
  20212. }
  20213. }, {
  20214. key: "_onDone",
  20215. value: function _onDone(data) {
  20216. if (data) {
  20217. if (this._requests.length > 0) {
  20218. var requestCapability = this._requests.shift();
  20219. requestCapability.resolve({
  20220. value: data.chunk,
  20221. done: false
  20222. });
  20223. } else {
  20224. this._cachedChunks.push(data.chunk);
  20225. }
  20226. }
  20227. this._done = true;
  20228. if (this._cachedChunks.length > 0) {
  20229. return;
  20230. }
  20231. var _iterator2 = _createForOfIteratorHelper(this._requests),
  20232. _step2;
  20233. try {
  20234. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  20235. var _requestCapability = _step2.value;
  20236. _requestCapability.resolve({
  20237. value: undefined,
  20238. done: true
  20239. });
  20240. }
  20241. } catch (err) {
  20242. _iterator2.e(err);
  20243. } finally {
  20244. _iterator2.f();
  20245. }
  20246. this._requests.length = 0;
  20247. }
  20248. }, {
  20249. key: "_onError",
  20250. value: function _onError(status) {
  20251. this._storedError = (0, _network_utils.createResponseStatusError)(status, this._url);
  20252. this._headersReceivedCapability.reject(this._storedError);
  20253. var _iterator3 = _createForOfIteratorHelper(this._requests),
  20254. _step3;
  20255. try {
  20256. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  20257. var requestCapability = _step3.value;
  20258. requestCapability.reject(this._storedError);
  20259. }
  20260. } catch (err) {
  20261. _iterator3.e(err);
  20262. } finally {
  20263. _iterator3.f();
  20264. }
  20265. this._requests.length = 0;
  20266. this._cachedChunks.length = 0;
  20267. }
  20268. }, {
  20269. key: "_onProgress",
  20270. value: function _onProgress(evt) {
  20271. var _this$onProgress;
  20272. (_this$onProgress = this.onProgress) === null || _this$onProgress === void 0 ? void 0 : _this$onProgress.call(this, {
  20273. loaded: evt.loaded,
  20274. total: evt.lengthComputable ? evt.total : this._contentLength
  20275. });
  20276. }
  20277. }, {
  20278. key: "filename",
  20279. get: function get() {
  20280. return this._filename;
  20281. }
  20282. }, {
  20283. key: "isRangeSupported",
  20284. get: function get() {
  20285. return this._isRangeSupported;
  20286. }
  20287. }, {
  20288. key: "isStreamingSupported",
  20289. get: function get() {
  20290. return this._isStreamingSupported;
  20291. }
  20292. }, {
  20293. key: "contentLength",
  20294. get: function get() {
  20295. return this._contentLength;
  20296. }
  20297. }, {
  20298. key: "headersReady",
  20299. get: function get() {
  20300. return this._headersReceivedCapability.promise;
  20301. }
  20302. }, {
  20303. key: "read",
  20304. value: function () {
  20305. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  20306. var chunk, requestCapability;
  20307. return _regenerator["default"].wrap(function _callee$(_context) {
  20308. while (1) {
  20309. switch (_context.prev = _context.next) {
  20310. case 0:
  20311. if (!this._storedError) {
  20312. _context.next = 2;
  20313. break;
  20314. }
  20315. throw this._storedError;
  20316. case 2:
  20317. if (!(this._cachedChunks.length > 0)) {
  20318. _context.next = 5;
  20319. break;
  20320. }
  20321. chunk = this._cachedChunks.shift();
  20322. return _context.abrupt("return", {
  20323. value: chunk,
  20324. done: false
  20325. });
  20326. case 5:
  20327. if (!this._done) {
  20328. _context.next = 7;
  20329. break;
  20330. }
  20331. return _context.abrupt("return", {
  20332. value: undefined,
  20333. done: true
  20334. });
  20335. case 7:
  20336. requestCapability = (0, _util.createPromiseCapability)();
  20337. this._requests.push(requestCapability);
  20338. return _context.abrupt("return", requestCapability.promise);
  20339. case 10:
  20340. case "end":
  20341. return _context.stop();
  20342. }
  20343. }
  20344. }, _callee, this);
  20345. }));
  20346. function read() {
  20347. return _read.apply(this, arguments);
  20348. }
  20349. return read;
  20350. }()
  20351. }, {
  20352. key: "cancel",
  20353. value: function cancel(reason) {
  20354. this._done = true;
  20355. this._headersReceivedCapability.reject(reason);
  20356. var _iterator4 = _createForOfIteratorHelper(this._requests),
  20357. _step4;
  20358. try {
  20359. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  20360. var requestCapability = _step4.value;
  20361. requestCapability.resolve({
  20362. value: undefined,
  20363. done: true
  20364. });
  20365. }
  20366. } catch (err) {
  20367. _iterator4.e(err);
  20368. } finally {
  20369. _iterator4.f();
  20370. }
  20371. this._requests.length = 0;
  20372. if (this._manager.isPendingRequest(this._fullRequestId)) {
  20373. this._manager.abortRequest(this._fullRequestId);
  20374. }
  20375. this._fullRequestReader = null;
  20376. }
  20377. }]);
  20378. return PDFNetworkStreamFullRequestReader;
  20379. }();
  20380. var PDFNetworkStreamRangeRequestReader = /*#__PURE__*/function () {
  20381. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  20382. _classCallCheck(this, PDFNetworkStreamRangeRequestReader);
  20383. this._manager = manager;
  20384. var args = {
  20385. onDone: this._onDone.bind(this),
  20386. onError: this._onError.bind(this),
  20387. onProgress: this._onProgress.bind(this)
  20388. };
  20389. this._url = manager.url;
  20390. this._requestId = manager.requestRange(begin, end, args);
  20391. this._requests = [];
  20392. this._queuedChunk = null;
  20393. this._done = false;
  20394. this._storedError = undefined;
  20395. this.onProgress = null;
  20396. this.onClosed = null;
  20397. }
  20398. _createClass(PDFNetworkStreamRangeRequestReader, [{
  20399. key: "_close",
  20400. value: function _close() {
  20401. var _this$onClosed;
  20402. (_this$onClosed = this.onClosed) === null || _this$onClosed === void 0 ? void 0 : _this$onClosed.call(this, this);
  20403. }
  20404. }, {
  20405. key: "_onDone",
  20406. value: function _onDone(data) {
  20407. var chunk = data.chunk;
  20408. if (this._requests.length > 0) {
  20409. var requestCapability = this._requests.shift();
  20410. requestCapability.resolve({
  20411. value: chunk,
  20412. done: false
  20413. });
  20414. } else {
  20415. this._queuedChunk = chunk;
  20416. }
  20417. this._done = true;
  20418. var _iterator5 = _createForOfIteratorHelper(this._requests),
  20419. _step5;
  20420. try {
  20421. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  20422. var _requestCapability2 = _step5.value;
  20423. _requestCapability2.resolve({
  20424. value: undefined,
  20425. done: true
  20426. });
  20427. }
  20428. } catch (err) {
  20429. _iterator5.e(err);
  20430. } finally {
  20431. _iterator5.f();
  20432. }
  20433. this._requests.length = 0;
  20434. this._close();
  20435. }
  20436. }, {
  20437. key: "_onError",
  20438. value: function _onError(status) {
  20439. this._storedError = (0, _network_utils.createResponseStatusError)(status, this._url);
  20440. var _iterator6 = _createForOfIteratorHelper(this._requests),
  20441. _step6;
  20442. try {
  20443. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  20444. var requestCapability = _step6.value;
  20445. requestCapability.reject(this._storedError);
  20446. }
  20447. } catch (err) {
  20448. _iterator6.e(err);
  20449. } finally {
  20450. _iterator6.f();
  20451. }
  20452. this._requests.length = 0;
  20453. this._queuedChunk = null;
  20454. }
  20455. }, {
  20456. key: "_onProgress",
  20457. value: function _onProgress(evt) {
  20458. if (!this.isStreamingSupported) {
  20459. var _this$onProgress2;
  20460. (_this$onProgress2 = this.onProgress) === null || _this$onProgress2 === void 0 ? void 0 : _this$onProgress2.call(this, {
  20461. loaded: evt.loaded
  20462. });
  20463. }
  20464. }
  20465. }, {
  20466. key: "isStreamingSupported",
  20467. get: function get() {
  20468. return false;
  20469. }
  20470. }, {
  20471. key: "read",
  20472. value: function () {
  20473. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  20474. var chunk, requestCapability;
  20475. return _regenerator["default"].wrap(function _callee2$(_context2) {
  20476. while (1) {
  20477. switch (_context2.prev = _context2.next) {
  20478. case 0:
  20479. if (!this._storedError) {
  20480. _context2.next = 2;
  20481. break;
  20482. }
  20483. throw this._storedError;
  20484. case 2:
  20485. if (!(this._queuedChunk !== null)) {
  20486. _context2.next = 6;
  20487. break;
  20488. }
  20489. chunk = this._queuedChunk;
  20490. this._queuedChunk = null;
  20491. return _context2.abrupt("return", {
  20492. value: chunk,
  20493. done: false
  20494. });
  20495. case 6:
  20496. if (!this._done) {
  20497. _context2.next = 8;
  20498. break;
  20499. }
  20500. return _context2.abrupt("return", {
  20501. value: undefined,
  20502. done: true
  20503. });
  20504. case 8:
  20505. requestCapability = (0, _util.createPromiseCapability)();
  20506. this._requests.push(requestCapability);
  20507. return _context2.abrupt("return", requestCapability.promise);
  20508. case 11:
  20509. case "end":
  20510. return _context2.stop();
  20511. }
  20512. }
  20513. }, _callee2, this);
  20514. }));
  20515. function read() {
  20516. return _read2.apply(this, arguments);
  20517. }
  20518. return read;
  20519. }()
  20520. }, {
  20521. key: "cancel",
  20522. value: function cancel(reason) {
  20523. this._done = true;
  20524. var _iterator7 = _createForOfIteratorHelper(this._requests),
  20525. _step7;
  20526. try {
  20527. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  20528. var requestCapability = _step7.value;
  20529. requestCapability.resolve({
  20530. value: undefined,
  20531. done: true
  20532. });
  20533. }
  20534. } catch (err) {
  20535. _iterator7.e(err);
  20536. } finally {
  20537. _iterator7.f();
  20538. }
  20539. this._requests.length = 0;
  20540. if (this._manager.isPendingRequest(this._requestId)) {
  20541. this._manager.abortRequest(this._requestId);
  20542. }
  20543. this._close();
  20544. }
  20545. }]);
  20546. return PDFNetworkStreamRangeRequestReader;
  20547. }();
  20548. /***/ }),
  20549. /* 182 */
  20550. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20551. "use strict";
  20552. Object.defineProperty(exports, "__esModule", ({
  20553. value: true
  20554. }));
  20555. exports.PDFFetchStream = void 0;
  20556. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(156));
  20557. var _util = __w_pdfjs_require__(1);
  20558. var _network_utils = __w_pdfjs_require__(179);
  20559. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  20560. 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); } }
  20561. 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); }); }; }
  20562. 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; } } }; }
  20563. 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); }
  20564. 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; }
  20565. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20566. 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); } }
  20567. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  20568. ;
  20569. function createFetchOptions(headers, withCredentials, abortController) {
  20570. return {
  20571. method: "GET",
  20572. headers: headers,
  20573. signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
  20574. mode: "cors",
  20575. credentials: withCredentials ? "include" : "same-origin",
  20576. redirect: "follow"
  20577. };
  20578. }
  20579. function createHeaders(httpHeaders) {
  20580. var headers = new Headers();
  20581. for (var property in httpHeaders) {
  20582. var value = httpHeaders[property];
  20583. if (typeof value === "undefined") {
  20584. continue;
  20585. }
  20586. headers.append(property, value);
  20587. }
  20588. return headers;
  20589. }
  20590. var PDFFetchStream = /*#__PURE__*/function () {
  20591. function PDFFetchStream(source) {
  20592. _classCallCheck(this, PDFFetchStream);
  20593. this.source = source;
  20594. this.isHttp = /^https?:/i.test(source.url);
  20595. this.httpHeaders = this.isHttp && source.httpHeaders || {};
  20596. this._fullRequestReader = null;
  20597. this._rangeRequestReaders = [];
  20598. }
  20599. _createClass(PDFFetchStream, [{
  20600. key: "_progressiveDataLength",
  20601. get: function get() {
  20602. var _this$_fullRequestRea, _this$_fullRequestRea2;
  20603. return (_this$_fullRequestRea = (_this$_fullRequestRea2 = this._fullRequestReader) === null || _this$_fullRequestRea2 === void 0 ? void 0 : _this$_fullRequestRea2._loaded) !== null && _this$_fullRequestRea !== void 0 ? _this$_fullRequestRea : 0;
  20604. }
  20605. }, {
  20606. key: "getFullReader",
  20607. value: function getFullReader() {
  20608. (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
  20609. this._fullRequestReader = new PDFFetchStreamReader(this);
  20610. return this._fullRequestReader;
  20611. }
  20612. }, {
  20613. key: "getRangeReader",
  20614. value: function getRangeReader(begin, end) {
  20615. if (end <= this._progressiveDataLength) {
  20616. return null;
  20617. }
  20618. var reader = new PDFFetchStreamRangeReader(this, begin, end);
  20619. this._rangeRequestReaders.push(reader);
  20620. return reader;
  20621. }
  20622. }, {
  20623. key: "cancelAllRequests",
  20624. value: function cancelAllRequests(reason) {
  20625. if (this._fullRequestReader) {
  20626. this._fullRequestReader.cancel(reason);
  20627. }
  20628. var _iterator = _createForOfIteratorHelper(this._rangeRequestReaders.slice(0)),
  20629. _step;
  20630. try {
  20631. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  20632. var reader = _step.value;
  20633. reader.cancel(reason);
  20634. }
  20635. } catch (err) {
  20636. _iterator.e(err);
  20637. } finally {
  20638. _iterator.f();
  20639. }
  20640. }
  20641. }]);
  20642. return PDFFetchStream;
  20643. }();
  20644. exports.PDFFetchStream = PDFFetchStream;
  20645. var PDFFetchStreamReader = /*#__PURE__*/function () {
  20646. function PDFFetchStreamReader(stream) {
  20647. var _this = this;
  20648. _classCallCheck(this, PDFFetchStreamReader);
  20649. this._stream = stream;
  20650. this._reader = null;
  20651. this._loaded = 0;
  20652. this._filename = null;
  20653. var source = stream.source;
  20654. this._withCredentials = source.withCredentials || false;
  20655. this._contentLength = source.length;
  20656. this._headersCapability = (0, _util.createPromiseCapability)();
  20657. this._disableRange = source.disableRange || false;
  20658. this._rangeChunkSize = source.rangeChunkSize;
  20659. if (!this._rangeChunkSize && !this._disableRange) {
  20660. this._disableRange = true;
  20661. }
  20662. if (typeof AbortController !== "undefined") {
  20663. this._abortController = new AbortController();
  20664. }
  20665. this._isStreamingSupported = !source.disableStream;
  20666. this._isRangeSupported = !source.disableRange;
  20667. this._headers = createHeaders(this._stream.httpHeaders);
  20668. var url = source.url;
  20669. fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) {
  20670. if (!(0, _network_utils.validateResponseStatus)(response.status)) {
  20671. throw (0, _network_utils.createResponseStatusError)(response.status, url);
  20672. }
  20673. _this._reader = response.body.getReader();
  20674. _this._headersCapability.resolve();
  20675. var getResponseHeader = function getResponseHeader(name) {
  20676. return response.headers.get(name);
  20677. };
  20678. var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
  20679. getResponseHeader: getResponseHeader,
  20680. isHttp: _this._stream.isHttp,
  20681. rangeChunkSize: _this._rangeChunkSize,
  20682. disableRange: _this._disableRange
  20683. }),
  20684. allowRangeRequests = _validateRangeRequest.allowRangeRequests,
  20685. suggestedLength = _validateRangeRequest.suggestedLength;
  20686. _this._isRangeSupported = allowRangeRequests;
  20687. _this._contentLength = suggestedLength || _this._contentLength;
  20688. _this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
  20689. if (!_this._isStreamingSupported && _this._isRangeSupported) {
  20690. _this.cancel(new _util.AbortException("Streaming is disabled."));
  20691. }
  20692. })["catch"](this._headersCapability.reject);
  20693. this.onProgress = null;
  20694. }
  20695. _createClass(PDFFetchStreamReader, [{
  20696. key: "headersReady",
  20697. get: function get() {
  20698. return this._headersCapability.promise;
  20699. }
  20700. }, {
  20701. key: "filename",
  20702. get: function get() {
  20703. return this._filename;
  20704. }
  20705. }, {
  20706. key: "contentLength",
  20707. get: function get() {
  20708. return this._contentLength;
  20709. }
  20710. }, {
  20711. key: "isRangeSupported",
  20712. get: function get() {
  20713. return this._isRangeSupported;
  20714. }
  20715. }, {
  20716. key: "isStreamingSupported",
  20717. get: function get() {
  20718. return this._isStreamingSupported;
  20719. }
  20720. }, {
  20721. key: "read",
  20722. value: function () {
  20723. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  20724. var _yield$this$_reader$r, value, done, buffer;
  20725. return _regenerator["default"].wrap(function _callee$(_context) {
  20726. while (1) {
  20727. switch (_context.prev = _context.next) {
  20728. case 0:
  20729. _context.next = 2;
  20730. return this._headersCapability.promise;
  20731. case 2:
  20732. _context.next = 4;
  20733. return this._reader.read();
  20734. case 4:
  20735. _yield$this$_reader$r = _context.sent;
  20736. value = _yield$this$_reader$r.value;
  20737. done = _yield$this$_reader$r.done;
  20738. if (!done) {
  20739. _context.next = 9;
  20740. break;
  20741. }
  20742. return _context.abrupt("return", {
  20743. value: value,
  20744. done: done
  20745. });
  20746. case 9:
  20747. this._loaded += value.byteLength;
  20748. if (this.onProgress) {
  20749. this.onProgress({
  20750. loaded: this._loaded,
  20751. total: this._contentLength
  20752. });
  20753. }
  20754. buffer = new Uint8Array(value).buffer;
  20755. return _context.abrupt("return", {
  20756. value: buffer,
  20757. done: false
  20758. });
  20759. case 13:
  20760. case "end":
  20761. return _context.stop();
  20762. }
  20763. }
  20764. }, _callee, this);
  20765. }));
  20766. function read() {
  20767. return _read.apply(this, arguments);
  20768. }
  20769. return read;
  20770. }()
  20771. }, {
  20772. key: "cancel",
  20773. value: function cancel(reason) {
  20774. if (this._reader) {
  20775. this._reader.cancel(reason);
  20776. }
  20777. if (this._abortController) {
  20778. this._abortController.abort();
  20779. }
  20780. }
  20781. }]);
  20782. return PDFFetchStreamReader;
  20783. }();
  20784. var PDFFetchStreamRangeReader = /*#__PURE__*/function () {
  20785. function PDFFetchStreamRangeReader(stream, begin, end) {
  20786. var _this2 = this;
  20787. _classCallCheck(this, PDFFetchStreamRangeReader);
  20788. this._stream = stream;
  20789. this._reader = null;
  20790. this._loaded = 0;
  20791. var source = stream.source;
  20792. this._withCredentials = source.withCredentials || false;
  20793. this._readCapability = (0, _util.createPromiseCapability)();
  20794. this._isStreamingSupported = !source.disableStream;
  20795. if (typeof AbortController !== "undefined") {
  20796. this._abortController = new AbortController();
  20797. }
  20798. this._headers = createHeaders(this._stream.httpHeaders);
  20799. this._headers.append("Range", "bytes=".concat(begin, "-").concat(end - 1));
  20800. var url = source.url;
  20801. fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) {
  20802. if (!(0, _network_utils.validateResponseStatus)(response.status)) {
  20803. throw (0, _network_utils.createResponseStatusError)(response.status, url);
  20804. }
  20805. _this2._readCapability.resolve();
  20806. _this2._reader = response.body.getReader();
  20807. })["catch"](this._readCapability.reject);
  20808. this.onProgress = null;
  20809. }
  20810. _createClass(PDFFetchStreamRangeReader, [{
  20811. key: "isStreamingSupported",
  20812. get: function get() {
  20813. return this._isStreamingSupported;
  20814. }
  20815. }, {
  20816. key: "read",
  20817. value: function () {
  20818. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  20819. var _yield$this$_reader$r2, value, done, buffer;
  20820. return _regenerator["default"].wrap(function _callee2$(_context2) {
  20821. while (1) {
  20822. switch (_context2.prev = _context2.next) {
  20823. case 0:
  20824. _context2.next = 2;
  20825. return this._readCapability.promise;
  20826. case 2:
  20827. _context2.next = 4;
  20828. return this._reader.read();
  20829. case 4:
  20830. _yield$this$_reader$r2 = _context2.sent;
  20831. value = _yield$this$_reader$r2.value;
  20832. done = _yield$this$_reader$r2.done;
  20833. if (!done) {
  20834. _context2.next = 9;
  20835. break;
  20836. }
  20837. return _context2.abrupt("return", {
  20838. value: value,
  20839. done: done
  20840. });
  20841. case 9:
  20842. this._loaded += value.byteLength;
  20843. if (this.onProgress) {
  20844. this.onProgress({
  20845. loaded: this._loaded
  20846. });
  20847. }
  20848. buffer = new Uint8Array(value).buffer;
  20849. return _context2.abrupt("return", {
  20850. value: buffer,
  20851. done: false
  20852. });
  20853. case 13:
  20854. case "end":
  20855. return _context2.stop();
  20856. }
  20857. }
  20858. }, _callee2, this);
  20859. }));
  20860. function read() {
  20861. return _read2.apply(this, arguments);
  20862. }
  20863. return read;
  20864. }()
  20865. }, {
  20866. key: "cancel",
  20867. value: function cancel(reason) {
  20868. if (this._reader) {
  20869. this._reader.cancel(reason);
  20870. }
  20871. if (this._abortController) {
  20872. this._abortController.abort();
  20873. }
  20874. }
  20875. }]);
  20876. return PDFFetchStreamRangeReader;
  20877. }();
  20878. /***/ })
  20879. /******/ ]);
  20880. /************************************************************************/
  20881. /******/ // The module cache
  20882. /******/ var __webpack_module_cache__ = {};
  20883. /******/
  20884. /******/ // The require function
  20885. /******/ function __w_pdfjs_require__(moduleId) {
  20886. /******/ // Check if module is in cache
  20887. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  20888. /******/ if (cachedModule !== undefined) {
  20889. /******/ return cachedModule.exports;
  20890. /******/ }
  20891. /******/ // Create a new module (and put it into the cache)
  20892. /******/ var module = __webpack_module_cache__[moduleId] = {
  20893. /******/ id: moduleId,
  20894. /******/ loaded: false,
  20895. /******/ exports: {}
  20896. /******/ };
  20897. /******/
  20898. /******/ // Execute the module function
  20899. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  20900. /******/
  20901. /******/ // Flag the module as loaded
  20902. /******/ module.loaded = true;
  20903. /******/
  20904. /******/ // Return the exports of the module
  20905. /******/ return module.exports;
  20906. /******/ }
  20907. /******/
  20908. /************************************************************************/
  20909. /******/ /* webpack/runtime/node module decorator */
  20910. /******/ (() => {
  20911. /******/ __w_pdfjs_require__.nmd = (module) => {
  20912. /******/ module.paths = [];
  20913. /******/ if (!module.children) module.children = [];
  20914. /******/ return module;
  20915. /******/ };
  20916. /******/ })();
  20917. /******/
  20918. /************************************************************************/
  20919. var __webpack_exports__ = {};
  20920. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  20921. (() => {
  20922. "use strict";
  20923. var exports = __webpack_exports__;
  20924. Object.defineProperty(exports, "__esModule", ({
  20925. value: true
  20926. }));
  20927. Object.defineProperty(exports, "AnnotationLayer", ({
  20928. enumerable: true,
  20929. get: function get() {
  20930. return _annotation_layer.AnnotationLayer;
  20931. }
  20932. }));
  20933. Object.defineProperty(exports, "AnnotationMode", ({
  20934. enumerable: true,
  20935. get: function get() {
  20936. return _util.AnnotationMode;
  20937. }
  20938. }));
  20939. Object.defineProperty(exports, "CMapCompressionType", ({
  20940. enumerable: true,
  20941. get: function get() {
  20942. return _util.CMapCompressionType;
  20943. }
  20944. }));
  20945. Object.defineProperty(exports, "GlobalWorkerOptions", ({
  20946. enumerable: true,
  20947. get: function get() {
  20948. return _worker_options.GlobalWorkerOptions;
  20949. }
  20950. }));
  20951. Object.defineProperty(exports, "InvalidPDFException", ({
  20952. enumerable: true,
  20953. get: function get() {
  20954. return _util.InvalidPDFException;
  20955. }
  20956. }));
  20957. Object.defineProperty(exports, "LoopbackPort", ({
  20958. enumerable: true,
  20959. get: function get() {
  20960. return _api.LoopbackPort;
  20961. }
  20962. }));
  20963. Object.defineProperty(exports, "MissingPDFException", ({
  20964. enumerable: true,
  20965. get: function get() {
  20966. return _util.MissingPDFException;
  20967. }
  20968. }));
  20969. Object.defineProperty(exports, "OPS", ({
  20970. enumerable: true,
  20971. get: function get() {
  20972. return _util.OPS;
  20973. }
  20974. }));
  20975. Object.defineProperty(exports, "PDFDataRangeTransport", ({
  20976. enumerable: true,
  20977. get: function get() {
  20978. return _api.PDFDataRangeTransport;
  20979. }
  20980. }));
  20981. Object.defineProperty(exports, "PDFDateString", ({
  20982. enumerable: true,
  20983. get: function get() {
  20984. return _display_utils.PDFDateString;
  20985. }
  20986. }));
  20987. Object.defineProperty(exports, "PDFWorker", ({
  20988. enumerable: true,
  20989. get: function get() {
  20990. return _api.PDFWorker;
  20991. }
  20992. }));
  20993. Object.defineProperty(exports, "PasswordResponses", ({
  20994. enumerable: true,
  20995. get: function get() {
  20996. return _util.PasswordResponses;
  20997. }
  20998. }));
  20999. Object.defineProperty(exports, "PermissionFlag", ({
  21000. enumerable: true,
  21001. get: function get() {
  21002. return _util.PermissionFlag;
  21003. }
  21004. }));
  21005. Object.defineProperty(exports, "PixelsPerInch", ({
  21006. enumerable: true,
  21007. get: function get() {
  21008. return _display_utils.PixelsPerInch;
  21009. }
  21010. }));
  21011. Object.defineProperty(exports, "RenderingCancelledException", ({
  21012. enumerable: true,
  21013. get: function get() {
  21014. return _display_utils.RenderingCancelledException;
  21015. }
  21016. }));
  21017. Object.defineProperty(exports, "SVGGraphics", ({
  21018. enumerable: true,
  21019. get: function get() {
  21020. return _svg.SVGGraphics;
  21021. }
  21022. }));
  21023. Object.defineProperty(exports, "UNSUPPORTED_FEATURES", ({
  21024. enumerable: true,
  21025. get: function get() {
  21026. return _util.UNSUPPORTED_FEATURES;
  21027. }
  21028. }));
  21029. Object.defineProperty(exports, "UnexpectedResponseException", ({
  21030. enumerable: true,
  21031. get: function get() {
  21032. return _util.UnexpectedResponseException;
  21033. }
  21034. }));
  21035. Object.defineProperty(exports, "Util", ({
  21036. enumerable: true,
  21037. get: function get() {
  21038. return _util.Util;
  21039. }
  21040. }));
  21041. Object.defineProperty(exports, "VerbosityLevel", ({
  21042. enumerable: true,
  21043. get: function get() {
  21044. return _util.VerbosityLevel;
  21045. }
  21046. }));
  21047. Object.defineProperty(exports, "XfaLayer", ({
  21048. enumerable: true,
  21049. get: function get() {
  21050. return _xfa_layer.XfaLayer;
  21051. }
  21052. }));
  21053. Object.defineProperty(exports, "build", ({
  21054. enumerable: true,
  21055. get: function get() {
  21056. return _api.build;
  21057. }
  21058. }));
  21059. Object.defineProperty(exports, "createPromiseCapability", ({
  21060. enumerable: true,
  21061. get: function get() {
  21062. return _util.createPromiseCapability;
  21063. }
  21064. }));
  21065. Object.defineProperty(exports, "createValidAbsoluteUrl", ({
  21066. enumerable: true,
  21067. get: function get() {
  21068. return _util.createValidAbsoluteUrl;
  21069. }
  21070. }));
  21071. Object.defineProperty(exports, "getDocument", ({
  21072. enumerable: true,
  21073. get: function get() {
  21074. return _api.getDocument;
  21075. }
  21076. }));
  21077. Object.defineProperty(exports, "getFilenameFromUrl", ({
  21078. enumerable: true,
  21079. get: function get() {
  21080. return _display_utils.getFilenameFromUrl;
  21081. }
  21082. }));
  21083. Object.defineProperty(exports, "getPdfFilenameFromUrl", ({
  21084. enumerable: true,
  21085. get: function get() {
  21086. return _display_utils.getPdfFilenameFromUrl;
  21087. }
  21088. }));
  21089. Object.defineProperty(exports, "getXfaPageViewport", ({
  21090. enumerable: true,
  21091. get: function get() {
  21092. return _display_utils.getXfaPageViewport;
  21093. }
  21094. }));
  21095. Object.defineProperty(exports, "isPdfFile", ({
  21096. enumerable: true,
  21097. get: function get() {
  21098. return _display_utils.isPdfFile;
  21099. }
  21100. }));
  21101. Object.defineProperty(exports, "loadScript", ({
  21102. enumerable: true,
  21103. get: function get() {
  21104. return _display_utils.loadScript;
  21105. }
  21106. }));
  21107. Object.defineProperty(exports, "renderTextLayer", ({
  21108. enumerable: true,
  21109. get: function get() {
  21110. return _text_layer.renderTextLayer;
  21111. }
  21112. }));
  21113. Object.defineProperty(exports, "shadow", ({
  21114. enumerable: true,
  21115. get: function get() {
  21116. return _util.shadow;
  21117. }
  21118. }));
  21119. Object.defineProperty(exports, "version", ({
  21120. enumerable: true,
  21121. get: function get() {
  21122. return _api.version;
  21123. }
  21124. }));
  21125. var _util = __w_pdfjs_require__(1);
  21126. var _api = __w_pdfjs_require__(155);
  21127. var _display_utils = __w_pdfjs_require__(158);
  21128. var _annotation_layer = __w_pdfjs_require__(173);
  21129. var _worker_options = __w_pdfjs_require__(166);
  21130. var _is_node = __w_pdfjs_require__(3);
  21131. var _text_layer = __w_pdfjs_require__(176);
  21132. var _svg = __w_pdfjs_require__(177);
  21133. var _xfa_layer = __w_pdfjs_require__(175);
  21134. var pdfjsVersion = '2.14.305';
  21135. var pdfjsBuild = 'eaaa8b4ad';
  21136. {
  21137. if (_is_node.isNodeJS) {
  21138. var _require = __w_pdfjs_require__(178),
  21139. PDFNodeStream = _require.PDFNodeStream;
  21140. (0, _api.setPDFNetworkStreamFactory)(function (params) {
  21141. return new PDFNodeStream(params);
  21142. });
  21143. } else {
  21144. var _require2 = __w_pdfjs_require__(181),
  21145. PDFNetworkStream = _require2.PDFNetworkStream;
  21146. var _require3 = __w_pdfjs_require__(182),
  21147. PDFFetchStream = _require3.PDFFetchStream;
  21148. (0, _api.setPDFNetworkStreamFactory)(function (params) {
  21149. if ((0, _display_utils.isValidFetchUrl)(params.url)) {
  21150. return new PDFFetchStream(params);
  21151. }
  21152. return new PDFNetworkStream(params);
  21153. });
  21154. }
  21155. }
  21156. })();
  21157. /******/ return __webpack_exports__;
  21158. /******/ })()
  21159. ;
  21160. });
  21161. //# sourceMappingURL=pdf.js.map