pdf.js 788 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2020 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, function() {
  32. return /******/ (function(modules) { // webpackBootstrap
  33. /******/ // The module cache
  34. /******/ var installedModules = {};
  35. /******/
  36. /******/ // The require function
  37. /******/ function __w_pdfjs_require__(moduleId) {
  38. /******/
  39. /******/ // Check if module is in cache
  40. /******/ if(installedModules[moduleId]) {
  41. /******/ return installedModules[moduleId].exports;
  42. /******/ }
  43. /******/ // Create a new module (and put it into the cache)
  44. /******/ var module = installedModules[moduleId] = {
  45. /******/ i: moduleId,
  46. /******/ l: false,
  47. /******/ exports: {}
  48. /******/ };
  49. /******/
  50. /******/ // Execute the module function
  51. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  52. /******/
  53. /******/ // Flag the module as loaded
  54. /******/ module.l = true;
  55. /******/
  56. /******/ // Return the exports of the module
  57. /******/ return module.exports;
  58. /******/ }
  59. /******/
  60. /******/
  61. /******/ // expose the modules object (__webpack_modules__)
  62. /******/ __w_pdfjs_require__.m = modules;
  63. /******/
  64. /******/ // expose the module cache
  65. /******/ __w_pdfjs_require__.c = installedModules;
  66. /******/
  67. /******/ // define getter function for harmony exports
  68. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  69. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  70. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  71. /******/ }
  72. /******/ };
  73. /******/
  74. /******/ // define __esModule on exports
  75. /******/ __w_pdfjs_require__.r = function(exports) {
  76. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  77. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  78. /******/ }
  79. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  80. /******/ };
  81. /******/
  82. /******/ // create a fake namespace object
  83. /******/ // mode & 1: value is a module id, require it
  84. /******/ // mode & 2: merge all properties of value into the ns
  85. /******/ // mode & 4: return value when already ns object
  86. /******/ // mode & 8|1: behave like require
  87. /******/ __w_pdfjs_require__.t = function(value, mode) {
  88. /******/ if(mode & 1) value = __w_pdfjs_require__(value);
  89. /******/ if(mode & 8) return value;
  90. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  91. /******/ var ns = Object.create(null);
  92. /******/ __w_pdfjs_require__.r(ns);
  93. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  94. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  95. /******/ return ns;
  96. /******/ };
  97. /******/
  98. /******/ // getDefaultExport function for compatibility with non-harmony modules
  99. /******/ __w_pdfjs_require__.n = function(module) {
  100. /******/ var getter = module && module.__esModule ?
  101. /******/ function getDefault() { return module['default']; } :
  102. /******/ function getModuleExports() { return module; };
  103. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  104. /******/ return getter;
  105. /******/ };
  106. /******/
  107. /******/ // Object.prototype.hasOwnProperty.call
  108. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  109. /******/
  110. /******/ // __webpack_public_path__
  111. /******/ __w_pdfjs_require__.p = "";
  112. /******/
  113. /******/
  114. /******/ // Load entry module and return exports
  115. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0);
  116. /******/ })
  117. /************************************************************************/
  118. /******/ ([
  119. /* 0 */
  120. /***/ (function(module, exports, __w_pdfjs_require__) {
  121. "use strict";
  122. Object.defineProperty(exports, "__esModule", {
  123. value: true
  124. });
  125. Object.defineProperty(exports, "addLinkAttributes", {
  126. enumerable: true,
  127. get: function get() {
  128. return _display_utils.addLinkAttributes;
  129. }
  130. });
  131. Object.defineProperty(exports, "getFilenameFromUrl", {
  132. enumerable: true,
  133. get: function get() {
  134. return _display_utils.getFilenameFromUrl;
  135. }
  136. });
  137. Object.defineProperty(exports, "LinkTarget", {
  138. enumerable: true,
  139. get: function get() {
  140. return _display_utils.LinkTarget;
  141. }
  142. });
  143. Object.defineProperty(exports, "loadScript", {
  144. enumerable: true,
  145. get: function get() {
  146. return _display_utils.loadScript;
  147. }
  148. });
  149. Object.defineProperty(exports, "PDFDateString", {
  150. enumerable: true,
  151. get: function get() {
  152. return _display_utils.PDFDateString;
  153. }
  154. });
  155. Object.defineProperty(exports, "RenderingCancelledException", {
  156. enumerable: true,
  157. get: function get() {
  158. return _display_utils.RenderingCancelledException;
  159. }
  160. });
  161. Object.defineProperty(exports, "build", {
  162. enumerable: true,
  163. get: function get() {
  164. return _api.build;
  165. }
  166. });
  167. Object.defineProperty(exports, "getDocument", {
  168. enumerable: true,
  169. get: function get() {
  170. return _api.getDocument;
  171. }
  172. });
  173. Object.defineProperty(exports, "LoopbackPort", {
  174. enumerable: true,
  175. get: function get() {
  176. return _api.LoopbackPort;
  177. }
  178. });
  179. Object.defineProperty(exports, "PDFDataRangeTransport", {
  180. enumerable: true,
  181. get: function get() {
  182. return _api.PDFDataRangeTransport;
  183. }
  184. });
  185. Object.defineProperty(exports, "PDFWorker", {
  186. enumerable: true,
  187. get: function get() {
  188. return _api.PDFWorker;
  189. }
  190. });
  191. Object.defineProperty(exports, "version", {
  192. enumerable: true,
  193. get: function get() {
  194. return _api.version;
  195. }
  196. });
  197. Object.defineProperty(exports, "CMapCompressionType", {
  198. enumerable: true,
  199. get: function get() {
  200. return _util.CMapCompressionType;
  201. }
  202. });
  203. Object.defineProperty(exports, "createObjectURL", {
  204. enumerable: true,
  205. get: function get() {
  206. return _util.createObjectURL;
  207. }
  208. });
  209. Object.defineProperty(exports, "createPromiseCapability", {
  210. enumerable: true,
  211. get: function get() {
  212. return _util.createPromiseCapability;
  213. }
  214. });
  215. Object.defineProperty(exports, "createValidAbsoluteUrl", {
  216. enumerable: true,
  217. get: function get() {
  218. return _util.createValidAbsoluteUrl;
  219. }
  220. });
  221. Object.defineProperty(exports, "InvalidPDFException", {
  222. enumerable: true,
  223. get: function get() {
  224. return _util.InvalidPDFException;
  225. }
  226. });
  227. Object.defineProperty(exports, "MissingPDFException", {
  228. enumerable: true,
  229. get: function get() {
  230. return _util.MissingPDFException;
  231. }
  232. });
  233. Object.defineProperty(exports, "OPS", {
  234. enumerable: true,
  235. get: function get() {
  236. return _util.OPS;
  237. }
  238. });
  239. Object.defineProperty(exports, "PasswordResponses", {
  240. enumerable: true,
  241. get: function get() {
  242. return _util.PasswordResponses;
  243. }
  244. });
  245. Object.defineProperty(exports, "PermissionFlag", {
  246. enumerable: true,
  247. get: function get() {
  248. return _util.PermissionFlag;
  249. }
  250. });
  251. Object.defineProperty(exports, "removeNullCharacters", {
  252. enumerable: true,
  253. get: function get() {
  254. return _util.removeNullCharacters;
  255. }
  256. });
  257. Object.defineProperty(exports, "shadow", {
  258. enumerable: true,
  259. get: function get() {
  260. return _util.shadow;
  261. }
  262. });
  263. Object.defineProperty(exports, "UnexpectedResponseException", {
  264. enumerable: true,
  265. get: function get() {
  266. return _util.UnexpectedResponseException;
  267. }
  268. });
  269. Object.defineProperty(exports, "UNSUPPORTED_FEATURES", {
  270. enumerable: true,
  271. get: function get() {
  272. return _util.UNSUPPORTED_FEATURES;
  273. }
  274. });
  275. Object.defineProperty(exports, "Util", {
  276. enumerable: true,
  277. get: function get() {
  278. return _util.Util;
  279. }
  280. });
  281. Object.defineProperty(exports, "VerbosityLevel", {
  282. enumerable: true,
  283. get: function get() {
  284. return _util.VerbosityLevel;
  285. }
  286. });
  287. Object.defineProperty(exports, "AnnotationLayer", {
  288. enumerable: true,
  289. get: function get() {
  290. return _annotation_layer.AnnotationLayer;
  291. }
  292. });
  293. Object.defineProperty(exports, "apiCompatibilityParams", {
  294. enumerable: true,
  295. get: function get() {
  296. return _api_compatibility.apiCompatibilityParams;
  297. }
  298. });
  299. Object.defineProperty(exports, "GlobalWorkerOptions", {
  300. enumerable: true,
  301. get: function get() {
  302. return _worker_options.GlobalWorkerOptions;
  303. }
  304. });
  305. Object.defineProperty(exports, "renderTextLayer", {
  306. enumerable: true,
  307. get: function get() {
  308. return _text_layer.renderTextLayer;
  309. }
  310. });
  311. Object.defineProperty(exports, "SVGGraphics", {
  312. enumerable: true,
  313. get: function get() {
  314. return _svg.SVGGraphics;
  315. }
  316. });
  317. var _display_utils = __w_pdfjs_require__(1);
  318. var _api = __w_pdfjs_require__(198);
  319. var _util = __w_pdfjs_require__(5);
  320. var _annotation_layer = __w_pdfjs_require__(209);
  321. var _api_compatibility = __w_pdfjs_require__(200);
  322. var _worker_options = __w_pdfjs_require__(203);
  323. var _text_layer = __w_pdfjs_require__(210);
  324. var _svg = __w_pdfjs_require__(211);
  325. var pdfjsVersion = '2.5.207';
  326. var pdfjsBuild = '0974d6052';
  327. {
  328. var _require = __w_pdfjs_require__(7),
  329. isNodeJS = _require.isNodeJS;
  330. if (isNodeJS) {
  331. var PDFNodeStream = __w_pdfjs_require__(212).PDFNodeStream;
  332. (0, _api.setPDFNetworkStreamFactory)(function (params) {
  333. return new PDFNodeStream(params);
  334. });
  335. } else {
  336. var PDFNetworkStream = __w_pdfjs_require__(215).PDFNetworkStream;
  337. var PDFFetchStream;
  338. if ((0, _display_utils.isFetchSupported)()) {
  339. PDFFetchStream = __w_pdfjs_require__(216).PDFFetchStream;
  340. }
  341. (0, _api.setPDFNetworkStreamFactory)(function (params) {
  342. if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) {
  343. return new PDFFetchStream(params);
  344. }
  345. return new PDFNetworkStream(params);
  346. });
  347. }
  348. }
  349. /***/ }),
  350. /* 1 */
  351. /***/ (function(module, exports, __w_pdfjs_require__) {
  352. "use strict";
  353. Object.defineProperty(exports, "__esModule", {
  354. value: true
  355. });
  356. exports.addLinkAttributes = addLinkAttributes;
  357. exports.getFilenameFromUrl = getFilenameFromUrl;
  358. exports.isFetchSupported = isFetchSupported;
  359. exports.isValidFetchUrl = isValidFetchUrl;
  360. exports.loadScript = loadScript;
  361. exports.deprecated = deprecated;
  362. exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0;
  363. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  364. var _util = __w_pdfjs_require__(5);
  365. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  366. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  367. 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); }
  368. 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; }
  369. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  370. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  371. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  372. 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); }; }
  373. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  374. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  375. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  376. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  377. 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); } }
  378. 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); }); }; }
  379. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  380. 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); } }
  381. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  382. var DEFAULT_LINK_REL = "noopener noreferrer nofollow";
  383. exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
  384. var SVG_NS = "http://www.w3.org/2000/svg";
  385. var DOMCanvasFactory = /*#__PURE__*/function () {
  386. function DOMCanvasFactory() {
  387. _classCallCheck(this, DOMCanvasFactory);
  388. }
  389. _createClass(DOMCanvasFactory, [{
  390. key: "create",
  391. value: function create(width, height) {
  392. if (width <= 0 || height <= 0) {
  393. throw new Error("Invalid canvas size");
  394. }
  395. var canvas = document.createElement("canvas");
  396. var context = canvas.getContext("2d");
  397. canvas.width = width;
  398. canvas.height = height;
  399. return {
  400. canvas: canvas,
  401. context: context
  402. };
  403. }
  404. }, {
  405. key: "reset",
  406. value: function reset(canvasAndContext, width, height) {
  407. if (!canvasAndContext.canvas) {
  408. throw new Error("Canvas is not specified");
  409. }
  410. if (width <= 0 || height <= 0) {
  411. throw new Error("Invalid canvas size");
  412. }
  413. canvasAndContext.canvas.width = width;
  414. canvasAndContext.canvas.height = height;
  415. }
  416. }, {
  417. key: "destroy",
  418. value: function destroy(canvasAndContext) {
  419. if (!canvasAndContext.canvas) {
  420. throw new Error("Canvas is not specified");
  421. }
  422. canvasAndContext.canvas.width = 0;
  423. canvasAndContext.canvas.height = 0;
  424. canvasAndContext.canvas = null;
  425. canvasAndContext.context = null;
  426. }
  427. }]);
  428. return DOMCanvasFactory;
  429. }();
  430. exports.DOMCanvasFactory = DOMCanvasFactory;
  431. var DOMCMapReaderFactory = /*#__PURE__*/function () {
  432. function DOMCMapReaderFactory(_ref) {
  433. var _ref$baseUrl = _ref.baseUrl,
  434. baseUrl = _ref$baseUrl === void 0 ? null : _ref$baseUrl,
  435. _ref$isCompressed = _ref.isCompressed,
  436. isCompressed = _ref$isCompressed === void 0 ? false : _ref$isCompressed;
  437. _classCallCheck(this, DOMCMapReaderFactory);
  438. this.baseUrl = baseUrl;
  439. this.isCompressed = isCompressed;
  440. }
  441. _createClass(DOMCMapReaderFactory, [{
  442. key: "fetch",
  443. value: function (_fetch) {
  444. function fetch(_x) {
  445. return _fetch.apply(this, arguments);
  446. }
  447. fetch.toString = function () {
  448. return _fetch.toString();
  449. };
  450. return fetch;
  451. }( /*#__PURE__*/function () {
  452. var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref2) {
  453. var _this = this;
  454. var name, url, compressionType;
  455. return _regenerator["default"].wrap(function _callee2$(_context2) {
  456. while (1) {
  457. switch (_context2.prev = _context2.next) {
  458. case 0:
  459. name = _ref2.name;
  460. if (this.baseUrl) {
  461. _context2.next = 3;
  462. break;
  463. }
  464. throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.');
  465. case 3:
  466. if (name) {
  467. _context2.next = 5;
  468. break;
  469. }
  470. throw new Error("CMap name must be specified.");
  471. case 5:
  472. url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
  473. compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE;
  474. if (!(isFetchSupported() && isValidFetchUrl(url, document.baseURI))) {
  475. _context2.next = 9;
  476. break;
  477. }
  478. return _context2.abrupt("return", fetch(url).then( /*#__PURE__*/function () {
  479. var _ref4 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(response) {
  480. var cMapData;
  481. return _regenerator["default"].wrap(function _callee$(_context) {
  482. while (1) {
  483. switch (_context.prev = _context.next) {
  484. case 0:
  485. if (response.ok) {
  486. _context.next = 2;
  487. break;
  488. }
  489. throw new Error(response.statusText);
  490. case 2:
  491. if (!_this.isCompressed) {
  492. _context.next = 10;
  493. break;
  494. }
  495. _context.t0 = Uint8Array;
  496. _context.next = 6;
  497. return response.arrayBuffer();
  498. case 6:
  499. _context.t1 = _context.sent;
  500. cMapData = new _context.t0(_context.t1);
  501. _context.next = 15;
  502. break;
  503. case 10:
  504. _context.t2 = _util.stringToBytes;
  505. _context.next = 13;
  506. return response.text();
  507. case 13:
  508. _context.t3 = _context.sent;
  509. cMapData = (0, _context.t2)(_context.t3);
  510. case 15:
  511. return _context.abrupt("return", {
  512. cMapData: cMapData,
  513. compressionType: compressionType
  514. });
  515. case 16:
  516. case "end":
  517. return _context.stop();
  518. }
  519. }
  520. }, _callee);
  521. }));
  522. return function (_x3) {
  523. return _ref4.apply(this, arguments);
  524. };
  525. }())["catch"](function (reason) {
  526. throw new Error("Unable to load ".concat(_this.isCompressed ? "binary " : "") + "CMap at: ".concat(url));
  527. }));
  528. case 9:
  529. return _context2.abrupt("return", new Promise(function (resolve, reject) {
  530. var request = new XMLHttpRequest();
  531. request.open("GET", url, true);
  532. if (_this.isCompressed) {
  533. request.responseType = "arraybuffer";
  534. }
  535. request.onreadystatechange = function () {
  536. if (request.readyState !== XMLHttpRequest.DONE) {
  537. return;
  538. }
  539. if (request.status === 200 || request.status === 0) {
  540. var cMapData;
  541. if (_this.isCompressed && request.response) {
  542. cMapData = new Uint8Array(request.response);
  543. } else if (!_this.isCompressed && request.responseText) {
  544. cMapData = (0, _util.stringToBytes)(request.responseText);
  545. }
  546. if (cMapData) {
  547. resolve({
  548. cMapData: cMapData,
  549. compressionType: compressionType
  550. });
  551. return;
  552. }
  553. }
  554. reject(new Error(request.statusText));
  555. };
  556. request.send(null);
  557. })["catch"](function (reason) {
  558. throw new Error("Unable to load ".concat(_this.isCompressed ? "binary " : "") + "CMap at: ".concat(url));
  559. }));
  560. case 10:
  561. case "end":
  562. return _context2.stop();
  563. }
  564. }
  565. }, _callee2, this);
  566. }));
  567. return function (_x2) {
  568. return _ref3.apply(this, arguments);
  569. };
  570. }())
  571. }]);
  572. return DOMCMapReaderFactory;
  573. }();
  574. exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
  575. var DOMSVGFactory = /*#__PURE__*/function () {
  576. function DOMSVGFactory() {
  577. _classCallCheck(this, DOMSVGFactory);
  578. }
  579. _createClass(DOMSVGFactory, [{
  580. key: "create",
  581. value: function create(width, height) {
  582. (0, _util.assert)(width > 0 && height > 0, "Invalid SVG dimensions");
  583. var svg = document.createElementNS(SVG_NS, "svg:svg");
  584. svg.setAttribute("version", "1.1");
  585. svg.setAttribute("width", width + "px");
  586. svg.setAttribute("height", height + "px");
  587. svg.setAttribute("preserveAspectRatio", "none");
  588. svg.setAttribute("viewBox", "0 0 " + width + " " + height);
  589. return svg;
  590. }
  591. }, {
  592. key: "createElement",
  593. value: function createElement(type) {
  594. (0, _util.assert)(typeof type === "string", "Invalid SVG element type");
  595. return document.createElementNS(SVG_NS, type);
  596. }
  597. }]);
  598. return DOMSVGFactory;
  599. }();
  600. exports.DOMSVGFactory = DOMSVGFactory;
  601. var PageViewport = /*#__PURE__*/function () {
  602. function PageViewport(_ref5) {
  603. var viewBox = _ref5.viewBox,
  604. scale = _ref5.scale,
  605. rotation = _ref5.rotation,
  606. _ref5$offsetX = _ref5.offsetX,
  607. offsetX = _ref5$offsetX === void 0 ? 0 : _ref5$offsetX,
  608. _ref5$offsetY = _ref5.offsetY,
  609. offsetY = _ref5$offsetY === void 0 ? 0 : _ref5$offsetY,
  610. _ref5$dontFlip = _ref5.dontFlip,
  611. dontFlip = _ref5$dontFlip === void 0 ? false : _ref5$dontFlip;
  612. _classCallCheck(this, PageViewport);
  613. this.viewBox = viewBox;
  614. this.scale = scale;
  615. this.rotation = rotation;
  616. this.offsetX = offsetX;
  617. this.offsetY = offsetY;
  618. var centerX = (viewBox[2] + viewBox[0]) / 2;
  619. var centerY = (viewBox[3] + viewBox[1]) / 2;
  620. var rotateA, rotateB, rotateC, rotateD;
  621. rotation = rotation % 360;
  622. rotation = rotation < 0 ? rotation + 360 : rotation;
  623. switch (rotation) {
  624. case 180:
  625. rotateA = -1;
  626. rotateB = 0;
  627. rotateC = 0;
  628. rotateD = 1;
  629. break;
  630. case 90:
  631. rotateA = 0;
  632. rotateB = 1;
  633. rotateC = 1;
  634. rotateD = 0;
  635. break;
  636. case 270:
  637. rotateA = 0;
  638. rotateB = -1;
  639. rotateC = -1;
  640. rotateD = 0;
  641. break;
  642. case 0:
  643. rotateA = 1;
  644. rotateB = 0;
  645. rotateC = 0;
  646. rotateD = -1;
  647. break;
  648. default:
  649. throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
  650. }
  651. if (dontFlip) {
  652. rotateC = -rotateC;
  653. rotateD = -rotateD;
  654. }
  655. var offsetCanvasX, offsetCanvasY;
  656. var width, height;
  657. if (rotateA === 0) {
  658. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  659. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  660. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  661. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  662. } else {
  663. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  664. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  665. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  666. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  667. }
  668. this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
  669. this.width = width;
  670. this.height = height;
  671. }
  672. _createClass(PageViewport, [{
  673. key: "clone",
  674. value: function clone() {
  675. var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  676. _ref6$scale = _ref6.scale,
  677. scale = _ref6$scale === void 0 ? this.scale : _ref6$scale,
  678. _ref6$rotation = _ref6.rotation,
  679. rotation = _ref6$rotation === void 0 ? this.rotation : _ref6$rotation,
  680. _ref6$offsetX = _ref6.offsetX,
  681. offsetX = _ref6$offsetX === void 0 ? this.offsetX : _ref6$offsetX,
  682. _ref6$offsetY = _ref6.offsetY,
  683. offsetY = _ref6$offsetY === void 0 ? this.offsetY : _ref6$offsetY,
  684. _ref6$dontFlip = _ref6.dontFlip,
  685. dontFlip = _ref6$dontFlip === void 0 ? false : _ref6$dontFlip;
  686. return new PageViewport({
  687. viewBox: this.viewBox.slice(),
  688. scale: scale,
  689. rotation: rotation,
  690. offsetX: offsetX,
  691. offsetY: offsetY,
  692. dontFlip: dontFlip
  693. });
  694. }
  695. }, {
  696. key: "convertToViewportPoint",
  697. value: function convertToViewportPoint(x, y) {
  698. return _util.Util.applyTransform([x, y], this.transform);
  699. }
  700. }, {
  701. key: "convertToViewportRectangle",
  702. value: function convertToViewportRectangle(rect) {
  703. var topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform);
  704. var bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform);
  705. return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
  706. }
  707. }, {
  708. key: "convertToPdfPoint",
  709. value: function convertToPdfPoint(x, y) {
  710. return _util.Util.applyInverseTransform([x, y], this.transform);
  711. }
  712. }]);
  713. return PageViewport;
  714. }();
  715. exports.PageViewport = PageViewport;
  716. var RenderingCancelledException = /*#__PURE__*/function (_BaseException) {
  717. _inherits(RenderingCancelledException, _BaseException);
  718. var _super = _createSuper(RenderingCancelledException);
  719. function RenderingCancelledException(msg, type) {
  720. var _this2;
  721. _classCallCheck(this, RenderingCancelledException);
  722. _this2 = _super.call(this, msg);
  723. _this2.type = type;
  724. return _this2;
  725. }
  726. return RenderingCancelledException;
  727. }(_util.BaseException);
  728. exports.RenderingCancelledException = RenderingCancelledException;
  729. var LinkTarget = {
  730. NONE: 0,
  731. SELF: 1,
  732. BLANK: 2,
  733. PARENT: 3,
  734. TOP: 4
  735. };
  736. exports.LinkTarget = LinkTarget;
  737. function addLinkAttributes(link) {
  738. var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  739. url = _ref7.url,
  740. target = _ref7.target,
  741. rel = _ref7.rel,
  742. _ref7$enabled = _ref7.enabled,
  743. enabled = _ref7$enabled === void 0 ? true : _ref7$enabled;
  744. (0, _util.assert)(url && typeof url === "string", 'addLinkAttributes: A valid "url" parameter must provided.');
  745. var urlNullRemoved = (0, _util.removeNullCharacters)(url);
  746. if (enabled) {
  747. link.href = link.title = urlNullRemoved;
  748. } else {
  749. link.href = "";
  750. link.title = "Disabled: ".concat(urlNullRemoved);
  751. link.onclick = function () {
  752. return false;
  753. };
  754. }
  755. var targetStr = "";
  756. switch (target) {
  757. case LinkTarget.NONE:
  758. break;
  759. case LinkTarget.SELF:
  760. targetStr = "_self";
  761. break;
  762. case LinkTarget.BLANK:
  763. targetStr = "_blank";
  764. break;
  765. case LinkTarget.PARENT:
  766. targetStr = "_parent";
  767. break;
  768. case LinkTarget.TOP:
  769. targetStr = "_top";
  770. break;
  771. }
  772. link.target = targetStr;
  773. link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL;
  774. }
  775. function getFilenameFromUrl(url) {
  776. var anchor = url.indexOf("#");
  777. var query = url.indexOf("?");
  778. var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length);
  779. return url.substring(url.lastIndexOf("/", end) + 1, end);
  780. }
  781. var StatTimer = /*#__PURE__*/function () {
  782. function StatTimer() {
  783. _classCallCheck(this, StatTimer);
  784. this.started = Object.create(null);
  785. this.times = [];
  786. }
  787. _createClass(StatTimer, [{
  788. key: "time",
  789. value: function time(name) {
  790. if (name in this.started) {
  791. (0, _util.warn)("Timer is already running for ".concat(name));
  792. }
  793. this.started[name] = Date.now();
  794. }
  795. }, {
  796. key: "timeEnd",
  797. value: function timeEnd(name) {
  798. if (!(name in this.started)) {
  799. (0, _util.warn)("Timer has not been started for ".concat(name));
  800. }
  801. this.times.push({
  802. name: name,
  803. start: this.started[name],
  804. end: Date.now()
  805. });
  806. delete this.started[name];
  807. }
  808. }, {
  809. key: "toString",
  810. value: function toString() {
  811. var outBuf = [];
  812. var longest = 0;
  813. var _iterator = _createForOfIteratorHelper(this.times),
  814. _step;
  815. try {
  816. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  817. var time = _step.value;
  818. var name = time.name;
  819. if (name.length > longest) {
  820. longest = name.length;
  821. }
  822. }
  823. } catch (err) {
  824. _iterator.e(err);
  825. } finally {
  826. _iterator.f();
  827. }
  828. var _iterator2 = _createForOfIteratorHelper(this.times),
  829. _step2;
  830. try {
  831. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  832. var _time = _step2.value;
  833. var duration = _time.end - _time.start;
  834. outBuf.push("".concat(_time.name.padEnd(longest), " ").concat(duration, "ms\n"));
  835. }
  836. } catch (err) {
  837. _iterator2.e(err);
  838. } finally {
  839. _iterator2.f();
  840. }
  841. return outBuf.join("");
  842. }
  843. }]);
  844. return StatTimer;
  845. }();
  846. exports.StatTimer = StatTimer;
  847. function isFetchSupported() {
  848. return typeof fetch !== "undefined" && typeof Response !== "undefined" && "body" in Response.prototype && typeof ReadableStream !== "undefined";
  849. }
  850. function isValidFetchUrl(url, baseUrl) {
  851. try {
  852. var _ref8 = baseUrl ? new URL(url, baseUrl) : new URL(url),
  853. protocol = _ref8.protocol;
  854. return protocol === "http:" || protocol === "https:";
  855. } catch (ex) {
  856. return false;
  857. }
  858. }
  859. function loadScript(src) {
  860. return new Promise(function (resolve, reject) {
  861. var script = document.createElement("script");
  862. script.src = src;
  863. script.onload = resolve;
  864. script.onerror = function () {
  865. reject(new Error("Cannot load script at: ".concat(script.src)));
  866. };
  867. (document.head || document.documentElement).appendChild(script);
  868. });
  869. }
  870. function deprecated(details) {
  871. console.log("Deprecated API usage: " + details);
  872. }
  873. var pdfDateStringRegex;
  874. var PDFDateString = /*#__PURE__*/function () {
  875. function PDFDateString() {
  876. _classCallCheck(this, PDFDateString);
  877. }
  878. _createClass(PDFDateString, null, [{
  879. key: "toDateObject",
  880. value: function toDateObject(input) {
  881. if (!input || !(0, _util.isString)(input)) {
  882. return null;
  883. }
  884. if (!pdfDateStringRegex) {
  885. pdfDateStringRegex = new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?");
  886. }
  887. var matches = pdfDateStringRegex.exec(input);
  888. if (!matches) {
  889. return null;
  890. }
  891. var year = parseInt(matches[1], 10);
  892. var month = parseInt(matches[2], 10);
  893. month = month >= 1 && month <= 12 ? month - 1 : 0;
  894. var day = parseInt(matches[3], 10);
  895. day = day >= 1 && day <= 31 ? day : 1;
  896. var hour = parseInt(matches[4], 10);
  897. hour = hour >= 0 && hour <= 23 ? hour : 0;
  898. var minute = parseInt(matches[5], 10);
  899. minute = minute >= 0 && minute <= 59 ? minute : 0;
  900. var second = parseInt(matches[6], 10);
  901. second = second >= 0 && second <= 59 ? second : 0;
  902. var universalTimeRelation = matches[7] || "Z";
  903. var offsetHour = parseInt(matches[8], 10);
  904. offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
  905. var offsetMinute = parseInt(matches[9], 10) || 0;
  906. offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
  907. if (universalTimeRelation === "-") {
  908. hour += offsetHour;
  909. minute += offsetMinute;
  910. } else if (universalTimeRelation === "+") {
  911. hour -= offsetHour;
  912. minute -= offsetMinute;
  913. }
  914. return new Date(Date.UTC(year, month, day, hour, minute, second));
  915. }
  916. }]);
  917. return PDFDateString;
  918. }();
  919. exports.PDFDateString = PDFDateString;
  920. /***/ }),
  921. /* 2 */
  922. /***/ (function(module, exports, __w_pdfjs_require__) {
  923. "use strict";
  924. module.exports = __w_pdfjs_require__(3);
  925. /***/ }),
  926. /* 3 */
  927. /***/ (function(module, exports, __w_pdfjs_require__) {
  928. "use strict";
  929. /* WEBPACK VAR INJECTION */(function(module) {
  930. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  931. var runtime = function (exports) {
  932. "use strict";
  933. var Op = Object.prototype;
  934. var hasOwn = Op.hasOwnProperty;
  935. var undefined;
  936. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  937. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  938. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  939. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  940. function wrap(innerFn, outerFn, self, tryLocsList) {
  941. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  942. var generator = Object.create(protoGenerator.prototype);
  943. var context = new Context(tryLocsList || []);
  944. generator._invoke = makeInvokeMethod(innerFn, self, context);
  945. return generator;
  946. }
  947. exports.wrap = wrap;
  948. function tryCatch(fn, obj, arg) {
  949. try {
  950. return {
  951. type: "normal",
  952. arg: fn.call(obj, arg)
  953. };
  954. } catch (err) {
  955. return {
  956. type: "throw",
  957. arg: err
  958. };
  959. }
  960. }
  961. var GenStateSuspendedStart = "suspendedStart";
  962. var GenStateSuspendedYield = "suspendedYield";
  963. var GenStateExecuting = "executing";
  964. var GenStateCompleted = "completed";
  965. var ContinueSentinel = {};
  966. function Generator() {}
  967. function GeneratorFunction() {}
  968. function GeneratorFunctionPrototype() {}
  969. var IteratorPrototype = {};
  970. IteratorPrototype[iteratorSymbol] = function () {
  971. return this;
  972. };
  973. var getProto = Object.getPrototypeOf;
  974. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  975. if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  976. IteratorPrototype = NativeIteratorPrototype;
  977. }
  978. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  979. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  980. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  981. GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
  982. function defineIteratorMethods(prototype) {
  983. ["next", "throw", "return"].forEach(function (method) {
  984. prototype[method] = function (arg) {
  985. return this._invoke(method, arg);
  986. };
  987. });
  988. }
  989. exports.isGeneratorFunction = function (genFun) {
  990. var ctor = typeof genFun === "function" && genFun.constructor;
  991. return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
  992. };
  993. exports.mark = function (genFun) {
  994. if (Object.setPrototypeOf) {
  995. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  996. } else {
  997. genFun.__proto__ = GeneratorFunctionPrototype;
  998. if (!(toStringTagSymbol in genFun)) {
  999. genFun[toStringTagSymbol] = "GeneratorFunction";
  1000. }
  1001. }
  1002. genFun.prototype = Object.create(Gp);
  1003. return genFun;
  1004. };
  1005. exports.awrap = function (arg) {
  1006. return {
  1007. __await: arg
  1008. };
  1009. };
  1010. function AsyncIterator(generator, PromiseImpl) {
  1011. function invoke(method, arg, resolve, reject) {
  1012. var record = tryCatch(generator[method], generator, arg);
  1013. if (record.type === "throw") {
  1014. reject(record.arg);
  1015. } else {
  1016. var result = record.arg;
  1017. var value = result.value;
  1018. if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
  1019. return PromiseImpl.resolve(value.__await).then(function (value) {
  1020. invoke("next", value, resolve, reject);
  1021. }, function (err) {
  1022. invoke("throw", err, resolve, reject);
  1023. });
  1024. }
  1025. return PromiseImpl.resolve(value).then(function (unwrapped) {
  1026. result.value = unwrapped;
  1027. resolve(result);
  1028. }, function (error) {
  1029. return invoke("throw", error, resolve, reject);
  1030. });
  1031. }
  1032. }
  1033. var previousPromise;
  1034. function enqueue(method, arg) {
  1035. function callInvokeWithMethodAndArg() {
  1036. return new PromiseImpl(function (resolve, reject) {
  1037. invoke(method, arg, resolve, reject);
  1038. });
  1039. }
  1040. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  1041. }
  1042. this._invoke = enqueue;
  1043. }
  1044. defineIteratorMethods(AsyncIterator.prototype);
  1045. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  1046. return this;
  1047. };
  1048. exports.AsyncIterator = AsyncIterator;
  1049. exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  1050. if (PromiseImpl === void 0) PromiseImpl = Promise;
  1051. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  1052. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  1053. return result.done ? result.value : iter.next();
  1054. });
  1055. };
  1056. function makeInvokeMethod(innerFn, self, context) {
  1057. var state = GenStateSuspendedStart;
  1058. return function invoke(method, arg) {
  1059. if (state === GenStateExecuting) {
  1060. throw new Error("Generator is already running");
  1061. }
  1062. if (state === GenStateCompleted) {
  1063. if (method === "throw") {
  1064. throw arg;
  1065. }
  1066. return doneResult();
  1067. }
  1068. context.method = method;
  1069. context.arg = arg;
  1070. while (true) {
  1071. var delegate = context.delegate;
  1072. if (delegate) {
  1073. var delegateResult = maybeInvokeDelegate(delegate, context);
  1074. if (delegateResult) {
  1075. if (delegateResult === ContinueSentinel) continue;
  1076. return delegateResult;
  1077. }
  1078. }
  1079. if (context.method === "next") {
  1080. context.sent = context._sent = context.arg;
  1081. } else if (context.method === "throw") {
  1082. if (state === GenStateSuspendedStart) {
  1083. state = GenStateCompleted;
  1084. throw context.arg;
  1085. }
  1086. context.dispatchException(context.arg);
  1087. } else if (context.method === "return") {
  1088. context.abrupt("return", context.arg);
  1089. }
  1090. state = GenStateExecuting;
  1091. var record = tryCatch(innerFn, self, context);
  1092. if (record.type === "normal") {
  1093. state = context.done ? GenStateCompleted : GenStateSuspendedYield;
  1094. if (record.arg === ContinueSentinel) {
  1095. continue;
  1096. }
  1097. return {
  1098. value: record.arg,
  1099. done: context.done
  1100. };
  1101. } else if (record.type === "throw") {
  1102. state = GenStateCompleted;
  1103. context.method = "throw";
  1104. context.arg = record.arg;
  1105. }
  1106. }
  1107. };
  1108. }
  1109. function maybeInvokeDelegate(delegate, context) {
  1110. var method = delegate.iterator[context.method];
  1111. if (method === undefined) {
  1112. context.delegate = null;
  1113. if (context.method === "throw") {
  1114. if (delegate.iterator["return"]) {
  1115. context.method = "return";
  1116. context.arg = undefined;
  1117. maybeInvokeDelegate(delegate, context);
  1118. if (context.method === "throw") {
  1119. return ContinueSentinel;
  1120. }
  1121. }
  1122. context.method = "throw";
  1123. context.arg = new TypeError("The iterator does not provide a 'throw' method");
  1124. }
  1125. return ContinueSentinel;
  1126. }
  1127. var record = tryCatch(method, delegate.iterator, context.arg);
  1128. if (record.type === "throw") {
  1129. context.method = "throw";
  1130. context.arg = record.arg;
  1131. context.delegate = null;
  1132. return ContinueSentinel;
  1133. }
  1134. var info = record.arg;
  1135. if (!info) {
  1136. context.method = "throw";
  1137. context.arg = new TypeError("iterator result is not an object");
  1138. context.delegate = null;
  1139. return ContinueSentinel;
  1140. }
  1141. if (info.done) {
  1142. context[delegate.resultName] = info.value;
  1143. context.next = delegate.nextLoc;
  1144. if (context.method !== "return") {
  1145. context.method = "next";
  1146. context.arg = undefined;
  1147. }
  1148. } else {
  1149. return info;
  1150. }
  1151. context.delegate = null;
  1152. return ContinueSentinel;
  1153. }
  1154. defineIteratorMethods(Gp);
  1155. Gp[toStringTagSymbol] = "Generator";
  1156. Gp[iteratorSymbol] = function () {
  1157. return this;
  1158. };
  1159. Gp.toString = function () {
  1160. return "[object Generator]";
  1161. };
  1162. function pushTryEntry(locs) {
  1163. var entry = {
  1164. tryLoc: locs[0]
  1165. };
  1166. if (1 in locs) {
  1167. entry.catchLoc = locs[1];
  1168. }
  1169. if (2 in locs) {
  1170. entry.finallyLoc = locs[2];
  1171. entry.afterLoc = locs[3];
  1172. }
  1173. this.tryEntries.push(entry);
  1174. }
  1175. function resetTryEntry(entry) {
  1176. var record = entry.completion || {};
  1177. record.type = "normal";
  1178. delete record.arg;
  1179. entry.completion = record;
  1180. }
  1181. function Context(tryLocsList) {
  1182. this.tryEntries = [{
  1183. tryLoc: "root"
  1184. }];
  1185. tryLocsList.forEach(pushTryEntry, this);
  1186. this.reset(true);
  1187. }
  1188. exports.keys = function (object) {
  1189. var keys = [];
  1190. for (var key in object) {
  1191. keys.push(key);
  1192. }
  1193. keys.reverse();
  1194. return function next() {
  1195. while (keys.length) {
  1196. var key = keys.pop();
  1197. if (key in object) {
  1198. next.value = key;
  1199. next.done = false;
  1200. return next;
  1201. }
  1202. }
  1203. next.done = true;
  1204. return next;
  1205. };
  1206. };
  1207. function values(iterable) {
  1208. if (iterable) {
  1209. var iteratorMethod = iterable[iteratorSymbol];
  1210. if (iteratorMethod) {
  1211. return iteratorMethod.call(iterable);
  1212. }
  1213. if (typeof iterable.next === "function") {
  1214. return iterable;
  1215. }
  1216. if (!isNaN(iterable.length)) {
  1217. var i = -1,
  1218. next = function next() {
  1219. while (++i < iterable.length) {
  1220. if (hasOwn.call(iterable, i)) {
  1221. next.value = iterable[i];
  1222. next.done = false;
  1223. return next;
  1224. }
  1225. }
  1226. next.value = undefined;
  1227. next.done = true;
  1228. return next;
  1229. };
  1230. return next.next = next;
  1231. }
  1232. }
  1233. return {
  1234. next: doneResult
  1235. };
  1236. }
  1237. exports.values = values;
  1238. function doneResult() {
  1239. return {
  1240. value: undefined,
  1241. done: true
  1242. };
  1243. }
  1244. Context.prototype = {
  1245. constructor: Context,
  1246. reset: function reset(skipTempReset) {
  1247. this.prev = 0;
  1248. this.next = 0;
  1249. this.sent = this._sent = undefined;
  1250. this.done = false;
  1251. this.delegate = null;
  1252. this.method = "next";
  1253. this.arg = undefined;
  1254. this.tryEntries.forEach(resetTryEntry);
  1255. if (!skipTempReset) {
  1256. for (var name in this) {
  1257. if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
  1258. this[name] = undefined;
  1259. }
  1260. }
  1261. }
  1262. },
  1263. stop: function stop() {
  1264. this.done = true;
  1265. var rootEntry = this.tryEntries[0];
  1266. var rootRecord = rootEntry.completion;
  1267. if (rootRecord.type === "throw") {
  1268. throw rootRecord.arg;
  1269. }
  1270. return this.rval;
  1271. },
  1272. dispatchException: function dispatchException(exception) {
  1273. if (this.done) {
  1274. throw exception;
  1275. }
  1276. var context = this;
  1277. function handle(loc, caught) {
  1278. record.type = "throw";
  1279. record.arg = exception;
  1280. context.next = loc;
  1281. if (caught) {
  1282. context.method = "next";
  1283. context.arg = undefined;
  1284. }
  1285. return !!caught;
  1286. }
  1287. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1288. var entry = this.tryEntries[i];
  1289. var record = entry.completion;
  1290. if (entry.tryLoc === "root") {
  1291. return handle("end");
  1292. }
  1293. if (entry.tryLoc <= this.prev) {
  1294. var hasCatch = hasOwn.call(entry, "catchLoc");
  1295. var hasFinally = hasOwn.call(entry, "finallyLoc");
  1296. if (hasCatch && hasFinally) {
  1297. if (this.prev < entry.catchLoc) {
  1298. return handle(entry.catchLoc, true);
  1299. } else if (this.prev < entry.finallyLoc) {
  1300. return handle(entry.finallyLoc);
  1301. }
  1302. } else if (hasCatch) {
  1303. if (this.prev < entry.catchLoc) {
  1304. return handle(entry.catchLoc, true);
  1305. }
  1306. } else if (hasFinally) {
  1307. if (this.prev < entry.finallyLoc) {
  1308. return handle(entry.finallyLoc);
  1309. }
  1310. } else {
  1311. throw new Error("try statement without catch or finally");
  1312. }
  1313. }
  1314. }
  1315. },
  1316. abrupt: function abrupt(type, arg) {
  1317. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1318. var entry = this.tryEntries[i];
  1319. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  1320. var finallyEntry = entry;
  1321. break;
  1322. }
  1323. }
  1324. if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
  1325. finallyEntry = null;
  1326. }
  1327. var record = finallyEntry ? finallyEntry.completion : {};
  1328. record.type = type;
  1329. record.arg = arg;
  1330. if (finallyEntry) {
  1331. this.method = "next";
  1332. this.next = finallyEntry.finallyLoc;
  1333. return ContinueSentinel;
  1334. }
  1335. return this.complete(record);
  1336. },
  1337. complete: function complete(record, afterLoc) {
  1338. if (record.type === "throw") {
  1339. throw record.arg;
  1340. }
  1341. if (record.type === "break" || record.type === "continue") {
  1342. this.next = record.arg;
  1343. } else if (record.type === "return") {
  1344. this.rval = this.arg = record.arg;
  1345. this.method = "return";
  1346. this.next = "end";
  1347. } else if (record.type === "normal" && afterLoc) {
  1348. this.next = afterLoc;
  1349. }
  1350. return ContinueSentinel;
  1351. },
  1352. finish: function finish(finallyLoc) {
  1353. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1354. var entry = this.tryEntries[i];
  1355. if (entry.finallyLoc === finallyLoc) {
  1356. this.complete(entry.completion, entry.afterLoc);
  1357. resetTryEntry(entry);
  1358. return ContinueSentinel;
  1359. }
  1360. }
  1361. },
  1362. "catch": function _catch(tryLoc) {
  1363. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  1364. var entry = this.tryEntries[i];
  1365. if (entry.tryLoc === tryLoc) {
  1366. var record = entry.completion;
  1367. if (record.type === "throw") {
  1368. var thrown = record.arg;
  1369. resetTryEntry(entry);
  1370. }
  1371. return thrown;
  1372. }
  1373. }
  1374. throw new Error("illegal catch attempt");
  1375. },
  1376. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  1377. this.delegate = {
  1378. iterator: values(iterable),
  1379. resultName: resultName,
  1380. nextLoc: nextLoc
  1381. };
  1382. if (this.method === "next") {
  1383. this.arg = undefined;
  1384. }
  1385. return ContinueSentinel;
  1386. }
  1387. };
  1388. return exports;
  1389. }(( false ? undefined : _typeof(module)) === "object" ? module.exports : {});
  1390. try {
  1391. regeneratorRuntime = runtime;
  1392. } catch (accidentalStrictMode) {
  1393. Function("r", "regeneratorRuntime = r")(runtime);
  1394. }
  1395. /* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(4)(module)))
  1396. /***/ }),
  1397. /* 4 */
  1398. /***/ (function(module, exports, __w_pdfjs_require__) {
  1399. "use strict";
  1400. module.exports = function (module) {
  1401. if (!module.webpackPolyfill) {
  1402. module.deprecate = function () {};
  1403. module.paths = [];
  1404. if (!module.children) module.children = [];
  1405. Object.defineProperty(module, "loaded", {
  1406. enumerable: true,
  1407. get: function get() {
  1408. return module.l;
  1409. }
  1410. });
  1411. Object.defineProperty(module, "id", {
  1412. enumerable: true,
  1413. get: function get() {
  1414. return module.i;
  1415. }
  1416. });
  1417. module.webpackPolyfill = 1;
  1418. }
  1419. return module;
  1420. };
  1421. /***/ }),
  1422. /* 5 */
  1423. /***/ (function(module, exports, __w_pdfjs_require__) {
  1424. "use strict";
  1425. Object.defineProperty(exports, "__esModule", {
  1426. value: true
  1427. });
  1428. exports.arrayByteLength = arrayByteLength;
  1429. exports.arraysToBytes = arraysToBytes;
  1430. exports.assert = assert;
  1431. exports.bytesToString = bytesToString;
  1432. exports.createPromiseCapability = createPromiseCapability;
  1433. exports.getVerbosityLevel = getVerbosityLevel;
  1434. exports.info = info;
  1435. exports.isArrayBuffer = isArrayBuffer;
  1436. exports.isArrayEqual = isArrayEqual;
  1437. exports.isBool = isBool;
  1438. exports.isEmptyObj = isEmptyObj;
  1439. exports.isNum = isNum;
  1440. exports.isString = isString;
  1441. exports.isSameOrigin = isSameOrigin;
  1442. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1443. exports.removeNullCharacters = removeNullCharacters;
  1444. exports.setVerbosityLevel = setVerbosityLevel;
  1445. exports.shadow = shadow;
  1446. exports.string32 = string32;
  1447. exports.stringToBytes = stringToBytes;
  1448. exports.stringToPDFString = stringToPDFString;
  1449. exports.stringToUTF8String = stringToUTF8String;
  1450. exports.utf8StringToString = utf8StringToString;
  1451. exports.warn = warn;
  1452. exports.unreachable = unreachable;
  1453. exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0;
  1454. __w_pdfjs_require__(6);
  1455. 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); } }
  1456. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  1457. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1458. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1459. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  1460. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  1461. 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); }; }
  1462. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  1463. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  1464. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  1465. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  1466. var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  1467. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1468. var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  1469. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1470. var PermissionFlag = {
  1471. PRINT: 0x04,
  1472. MODIFY_CONTENTS: 0x08,
  1473. COPY: 0x10,
  1474. MODIFY_ANNOTATIONS: 0x20,
  1475. FILL_INTERACTIVE_FORMS: 0x100,
  1476. COPY_FOR_ACCESSIBILITY: 0x200,
  1477. ASSEMBLE: 0x400,
  1478. PRINT_HIGH_QUALITY: 0x800
  1479. };
  1480. exports.PermissionFlag = PermissionFlag;
  1481. var TextRenderingMode = {
  1482. FILL: 0,
  1483. STROKE: 1,
  1484. FILL_STROKE: 2,
  1485. INVISIBLE: 3,
  1486. FILL_ADD_TO_PATH: 4,
  1487. STROKE_ADD_TO_PATH: 5,
  1488. FILL_STROKE_ADD_TO_PATH: 6,
  1489. ADD_TO_PATH: 7,
  1490. FILL_STROKE_MASK: 3,
  1491. ADD_TO_PATH_FLAG: 4
  1492. };
  1493. exports.TextRenderingMode = TextRenderingMode;
  1494. var ImageKind = {
  1495. GRAYSCALE_1BPP: 1,
  1496. RGB_24BPP: 2,
  1497. RGBA_32BPP: 3
  1498. };
  1499. exports.ImageKind = ImageKind;
  1500. var AnnotationType = {
  1501. TEXT: 1,
  1502. LINK: 2,
  1503. FREETEXT: 3,
  1504. LINE: 4,
  1505. SQUARE: 5,
  1506. CIRCLE: 6,
  1507. POLYGON: 7,
  1508. POLYLINE: 8,
  1509. HIGHLIGHT: 9,
  1510. UNDERLINE: 10,
  1511. SQUIGGLY: 11,
  1512. STRIKEOUT: 12,
  1513. STAMP: 13,
  1514. CARET: 14,
  1515. INK: 15,
  1516. POPUP: 16,
  1517. FILEATTACHMENT: 17,
  1518. SOUND: 18,
  1519. MOVIE: 19,
  1520. WIDGET: 20,
  1521. SCREEN: 21,
  1522. PRINTERMARK: 22,
  1523. TRAPNET: 23,
  1524. WATERMARK: 24,
  1525. THREED: 25,
  1526. REDACT: 26
  1527. };
  1528. exports.AnnotationType = AnnotationType;
  1529. var AnnotationStateModelType = {
  1530. MARKED: "Marked",
  1531. REVIEW: "Review"
  1532. };
  1533. exports.AnnotationStateModelType = AnnotationStateModelType;
  1534. var AnnotationMarkedState = {
  1535. MARKED: "Marked",
  1536. UNMARKED: "Unmarked"
  1537. };
  1538. exports.AnnotationMarkedState = AnnotationMarkedState;
  1539. var AnnotationReviewState = {
  1540. ACCEPTED: "Accepted",
  1541. REJECTED: "Rejected",
  1542. CANCELLED: "Cancelled",
  1543. COMPLETED: "Completed",
  1544. NONE: "None"
  1545. };
  1546. exports.AnnotationReviewState = AnnotationReviewState;
  1547. var AnnotationReplyType = {
  1548. GROUP: "Group",
  1549. REPLY: "R"
  1550. };
  1551. exports.AnnotationReplyType = AnnotationReplyType;
  1552. var AnnotationFlag = {
  1553. INVISIBLE: 0x01,
  1554. HIDDEN: 0x02,
  1555. PRINT: 0x04,
  1556. NOZOOM: 0x08,
  1557. NOROTATE: 0x10,
  1558. NOVIEW: 0x20,
  1559. READONLY: 0x40,
  1560. LOCKED: 0x80,
  1561. TOGGLENOVIEW: 0x100,
  1562. LOCKEDCONTENTS: 0x200
  1563. };
  1564. exports.AnnotationFlag = AnnotationFlag;
  1565. var AnnotationFieldFlag = {
  1566. READONLY: 0x0000001,
  1567. REQUIRED: 0x0000002,
  1568. NOEXPORT: 0x0000004,
  1569. MULTILINE: 0x0001000,
  1570. PASSWORD: 0x0002000,
  1571. NOTOGGLETOOFF: 0x0004000,
  1572. RADIO: 0x0008000,
  1573. PUSHBUTTON: 0x0010000,
  1574. COMBO: 0x0020000,
  1575. EDIT: 0x0040000,
  1576. SORT: 0x0080000,
  1577. FILESELECT: 0x0100000,
  1578. MULTISELECT: 0x0200000,
  1579. DONOTSPELLCHECK: 0x0400000,
  1580. DONOTSCROLL: 0x0800000,
  1581. COMB: 0x1000000,
  1582. RICHTEXT: 0x2000000,
  1583. RADIOSINUNISON: 0x2000000,
  1584. COMMITONSELCHANGE: 0x4000000
  1585. };
  1586. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1587. var AnnotationBorderStyleType = {
  1588. SOLID: 1,
  1589. DASHED: 2,
  1590. BEVELED: 3,
  1591. INSET: 4,
  1592. UNDERLINE: 5
  1593. };
  1594. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1595. var StreamType = {
  1596. UNKNOWN: "UNKNOWN",
  1597. FLATE: "FLATE",
  1598. LZW: "LZW",
  1599. DCT: "DCT",
  1600. JPX: "JPX",
  1601. JBIG: "JBIG",
  1602. A85: "A85",
  1603. AHX: "AHX",
  1604. CCF: "CCF",
  1605. RLX: "RLX"
  1606. };
  1607. exports.StreamType = StreamType;
  1608. var FontType = {
  1609. UNKNOWN: "UNKNOWN",
  1610. TYPE1: "TYPE1",
  1611. TYPE1C: "TYPE1C",
  1612. CIDFONTTYPE0: "CIDFONTTYPE0",
  1613. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  1614. TRUETYPE: "TRUETYPE",
  1615. CIDFONTTYPE2: "CIDFONTTYPE2",
  1616. TYPE3: "TYPE3",
  1617. OPENTYPE: "OPENTYPE",
  1618. TYPE0: "TYPE0",
  1619. MMTYPE1: "MMTYPE1"
  1620. };
  1621. exports.FontType = FontType;
  1622. var VerbosityLevel = {
  1623. ERRORS: 0,
  1624. WARNINGS: 1,
  1625. INFOS: 5
  1626. };
  1627. exports.VerbosityLevel = VerbosityLevel;
  1628. var CMapCompressionType = {
  1629. NONE: 0,
  1630. BINARY: 1,
  1631. STREAM: 2
  1632. };
  1633. exports.CMapCompressionType = CMapCompressionType;
  1634. var OPS = {
  1635. dependency: 1,
  1636. setLineWidth: 2,
  1637. setLineCap: 3,
  1638. setLineJoin: 4,
  1639. setMiterLimit: 5,
  1640. setDash: 6,
  1641. setRenderingIntent: 7,
  1642. setFlatness: 8,
  1643. setGState: 9,
  1644. save: 10,
  1645. restore: 11,
  1646. transform: 12,
  1647. moveTo: 13,
  1648. lineTo: 14,
  1649. curveTo: 15,
  1650. curveTo2: 16,
  1651. curveTo3: 17,
  1652. closePath: 18,
  1653. rectangle: 19,
  1654. stroke: 20,
  1655. closeStroke: 21,
  1656. fill: 22,
  1657. eoFill: 23,
  1658. fillStroke: 24,
  1659. eoFillStroke: 25,
  1660. closeFillStroke: 26,
  1661. closeEOFillStroke: 27,
  1662. endPath: 28,
  1663. clip: 29,
  1664. eoClip: 30,
  1665. beginText: 31,
  1666. endText: 32,
  1667. setCharSpacing: 33,
  1668. setWordSpacing: 34,
  1669. setHScale: 35,
  1670. setLeading: 36,
  1671. setFont: 37,
  1672. setTextRenderingMode: 38,
  1673. setTextRise: 39,
  1674. moveText: 40,
  1675. setLeadingMoveText: 41,
  1676. setTextMatrix: 42,
  1677. nextLine: 43,
  1678. showText: 44,
  1679. showSpacedText: 45,
  1680. nextLineShowText: 46,
  1681. nextLineSetSpacingShowText: 47,
  1682. setCharWidth: 48,
  1683. setCharWidthAndBounds: 49,
  1684. setStrokeColorSpace: 50,
  1685. setFillColorSpace: 51,
  1686. setStrokeColor: 52,
  1687. setStrokeColorN: 53,
  1688. setFillColor: 54,
  1689. setFillColorN: 55,
  1690. setStrokeGray: 56,
  1691. setFillGray: 57,
  1692. setStrokeRGBColor: 58,
  1693. setFillRGBColor: 59,
  1694. setStrokeCMYKColor: 60,
  1695. setFillCMYKColor: 61,
  1696. shadingFill: 62,
  1697. beginInlineImage: 63,
  1698. beginImageData: 64,
  1699. endInlineImage: 65,
  1700. paintXObject: 66,
  1701. markPoint: 67,
  1702. markPointProps: 68,
  1703. beginMarkedContent: 69,
  1704. beginMarkedContentProps: 70,
  1705. endMarkedContent: 71,
  1706. beginCompat: 72,
  1707. endCompat: 73,
  1708. paintFormXObjectBegin: 74,
  1709. paintFormXObjectEnd: 75,
  1710. beginGroup: 76,
  1711. endGroup: 77,
  1712. beginAnnotations: 78,
  1713. endAnnotations: 79,
  1714. beginAnnotation: 80,
  1715. endAnnotation: 81,
  1716. paintJpegXObject: 82,
  1717. paintImageMaskXObject: 83,
  1718. paintImageMaskXObjectGroup: 84,
  1719. paintImageXObject: 85,
  1720. paintInlineImageXObject: 86,
  1721. paintInlineImageXObjectGroup: 87,
  1722. paintImageXObjectRepeat: 88,
  1723. paintImageMaskXObjectRepeat: 89,
  1724. paintSolidColorImageMask: 90,
  1725. constructPath: 91
  1726. };
  1727. exports.OPS = OPS;
  1728. var UNSUPPORTED_FEATURES = {
  1729. unknown: "unknown",
  1730. forms: "forms",
  1731. javaScript: "javaScript",
  1732. smask: "smask",
  1733. shadingPattern: "shadingPattern",
  1734. font: "font",
  1735. errorTilingPattern: "errorTilingPattern",
  1736. errorExtGState: "errorExtGState",
  1737. errorXObject: "errorXObject",
  1738. errorFontLoadType3: "errorFontLoadType3",
  1739. errorFontState: "errorFontState",
  1740. errorFontMissing: "errorFontMissing",
  1741. errorFontTranslate: "errorFontTranslate",
  1742. errorColorSpace: "errorColorSpace",
  1743. errorOperatorList: "errorOperatorList",
  1744. errorFontToUnicode: "errorFontToUnicode",
  1745. errorFontLoadNative: "errorFontLoadNative",
  1746. errorFontGetPath: "errorFontGetPath"
  1747. };
  1748. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1749. var PasswordResponses = {
  1750. NEED_PASSWORD: 1,
  1751. INCORRECT_PASSWORD: 2
  1752. };
  1753. exports.PasswordResponses = PasswordResponses;
  1754. var verbosity = VerbosityLevel.WARNINGS;
  1755. function setVerbosityLevel(level) {
  1756. if (Number.isInteger(level)) {
  1757. verbosity = level;
  1758. }
  1759. }
  1760. function getVerbosityLevel() {
  1761. return verbosity;
  1762. }
  1763. function info(msg) {
  1764. if (verbosity >= VerbosityLevel.INFOS) {
  1765. console.log("Info: ".concat(msg));
  1766. }
  1767. }
  1768. function warn(msg) {
  1769. if (verbosity >= VerbosityLevel.WARNINGS) {
  1770. console.log("Warning: ".concat(msg));
  1771. }
  1772. }
  1773. function unreachable(msg) {
  1774. throw new Error(msg);
  1775. }
  1776. function assert(cond, msg) {
  1777. if (!cond) {
  1778. unreachable(msg);
  1779. }
  1780. }
  1781. function isSameOrigin(baseUrl, otherUrl) {
  1782. var base;
  1783. try {
  1784. base = new URL(baseUrl);
  1785. if (!base.origin || base.origin === "null") {
  1786. return false;
  1787. }
  1788. } catch (e) {
  1789. return false;
  1790. }
  1791. var other = new URL(otherUrl, base);
  1792. return base.origin === other.origin;
  1793. }
  1794. function _isValidProtocol(url) {
  1795. if (!url) {
  1796. return false;
  1797. }
  1798. switch (url.protocol) {
  1799. case "http:":
  1800. case "https:":
  1801. case "ftp:":
  1802. case "mailto:":
  1803. case "tel:":
  1804. return true;
  1805. default:
  1806. return false;
  1807. }
  1808. }
  1809. function createValidAbsoluteUrl(url, baseUrl) {
  1810. if (!url) {
  1811. return null;
  1812. }
  1813. try {
  1814. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1815. if (_isValidProtocol(absoluteUrl)) {
  1816. return absoluteUrl;
  1817. }
  1818. } catch (ex) {}
  1819. return null;
  1820. }
  1821. function shadow(obj, prop, value) {
  1822. Object.defineProperty(obj, prop, {
  1823. value: value,
  1824. enumerable: true,
  1825. configurable: true,
  1826. writable: false
  1827. });
  1828. return value;
  1829. }
  1830. var BaseException = function BaseExceptionClosure() {
  1831. function BaseException(message) {
  1832. if (this.constructor === BaseException) {
  1833. unreachable("Cannot initialize BaseException.");
  1834. }
  1835. this.message = message;
  1836. this.name = this.constructor.name;
  1837. }
  1838. BaseException.prototype = new Error();
  1839. BaseException.constructor = BaseException;
  1840. return BaseException;
  1841. }();
  1842. exports.BaseException = BaseException;
  1843. var PasswordException = /*#__PURE__*/function (_BaseException) {
  1844. _inherits(PasswordException, _BaseException);
  1845. var _super = _createSuper(PasswordException);
  1846. function PasswordException(msg, code) {
  1847. var _this;
  1848. _classCallCheck(this, PasswordException);
  1849. _this = _super.call(this, msg);
  1850. _this.code = code;
  1851. return _this;
  1852. }
  1853. return PasswordException;
  1854. }(BaseException);
  1855. exports.PasswordException = PasswordException;
  1856. var UnknownErrorException = /*#__PURE__*/function (_BaseException2) {
  1857. _inherits(UnknownErrorException, _BaseException2);
  1858. var _super2 = _createSuper(UnknownErrorException);
  1859. function UnknownErrorException(msg, details) {
  1860. var _this2;
  1861. _classCallCheck(this, UnknownErrorException);
  1862. _this2 = _super2.call(this, msg);
  1863. _this2.details = details;
  1864. return _this2;
  1865. }
  1866. return UnknownErrorException;
  1867. }(BaseException);
  1868. exports.UnknownErrorException = UnknownErrorException;
  1869. var InvalidPDFException = /*#__PURE__*/function (_BaseException3) {
  1870. _inherits(InvalidPDFException, _BaseException3);
  1871. var _super3 = _createSuper(InvalidPDFException);
  1872. function InvalidPDFException() {
  1873. _classCallCheck(this, InvalidPDFException);
  1874. return _super3.apply(this, arguments);
  1875. }
  1876. return InvalidPDFException;
  1877. }(BaseException);
  1878. exports.InvalidPDFException = InvalidPDFException;
  1879. var MissingPDFException = /*#__PURE__*/function (_BaseException4) {
  1880. _inherits(MissingPDFException, _BaseException4);
  1881. var _super4 = _createSuper(MissingPDFException);
  1882. function MissingPDFException() {
  1883. _classCallCheck(this, MissingPDFException);
  1884. return _super4.apply(this, arguments);
  1885. }
  1886. return MissingPDFException;
  1887. }(BaseException);
  1888. exports.MissingPDFException = MissingPDFException;
  1889. var UnexpectedResponseException = /*#__PURE__*/function (_BaseException5) {
  1890. _inherits(UnexpectedResponseException, _BaseException5);
  1891. var _super5 = _createSuper(UnexpectedResponseException);
  1892. function UnexpectedResponseException(msg, status) {
  1893. var _this3;
  1894. _classCallCheck(this, UnexpectedResponseException);
  1895. _this3 = _super5.call(this, msg);
  1896. _this3.status = status;
  1897. return _this3;
  1898. }
  1899. return UnexpectedResponseException;
  1900. }(BaseException);
  1901. exports.UnexpectedResponseException = UnexpectedResponseException;
  1902. var FormatError = /*#__PURE__*/function (_BaseException6) {
  1903. _inherits(FormatError, _BaseException6);
  1904. var _super6 = _createSuper(FormatError);
  1905. function FormatError() {
  1906. _classCallCheck(this, FormatError);
  1907. return _super6.apply(this, arguments);
  1908. }
  1909. return FormatError;
  1910. }(BaseException);
  1911. exports.FormatError = FormatError;
  1912. var AbortException = /*#__PURE__*/function (_BaseException7) {
  1913. _inherits(AbortException, _BaseException7);
  1914. var _super7 = _createSuper(AbortException);
  1915. function AbortException() {
  1916. _classCallCheck(this, AbortException);
  1917. return _super7.apply(this, arguments);
  1918. }
  1919. return AbortException;
  1920. }(BaseException);
  1921. exports.AbortException = AbortException;
  1922. var NullCharactersRegExp = /\x00/g;
  1923. function removeNullCharacters(str) {
  1924. if (typeof str !== "string") {
  1925. warn("The argument for removeNullCharacters must be a string.");
  1926. return str;
  1927. }
  1928. return str.replace(NullCharactersRegExp, "");
  1929. }
  1930. function bytesToString(bytes) {
  1931. assert(bytes !== null && _typeof(bytes) === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1932. var length = bytes.length;
  1933. var MAX_ARGUMENT_COUNT = 8192;
  1934. if (length < MAX_ARGUMENT_COUNT) {
  1935. return String.fromCharCode.apply(null, bytes);
  1936. }
  1937. var strBuf = [];
  1938. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1939. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1940. var chunk = bytes.subarray(i, chunkEnd);
  1941. strBuf.push(String.fromCharCode.apply(null, chunk));
  1942. }
  1943. return strBuf.join("");
  1944. }
  1945. function stringToBytes(str) {
  1946. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1947. var length = str.length;
  1948. var bytes = new Uint8Array(length);
  1949. for (var i = 0; i < length; ++i) {
  1950. bytes[i] = str.charCodeAt(i) & 0xff;
  1951. }
  1952. return bytes;
  1953. }
  1954. function arrayByteLength(arr) {
  1955. if (arr.length !== undefined) {
  1956. return arr.length;
  1957. }
  1958. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1959. return arr.byteLength;
  1960. }
  1961. function arraysToBytes(arr) {
  1962. var length = arr.length;
  1963. if (length === 1 && arr[0] instanceof Uint8Array) {
  1964. return arr[0];
  1965. }
  1966. var resultLength = 0;
  1967. for (var i = 0; i < length; i++) {
  1968. resultLength += arrayByteLength(arr[i]);
  1969. }
  1970. var pos = 0;
  1971. var data = new Uint8Array(resultLength);
  1972. for (var _i = 0; _i < length; _i++) {
  1973. var item = arr[_i];
  1974. if (!(item instanceof Uint8Array)) {
  1975. if (typeof item === "string") {
  1976. item = stringToBytes(item);
  1977. } else {
  1978. item = new Uint8Array(item);
  1979. }
  1980. }
  1981. var itemLength = item.byteLength;
  1982. data.set(item, pos);
  1983. pos += itemLength;
  1984. }
  1985. return data;
  1986. }
  1987. function string32(value) {
  1988. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1989. }
  1990. function isLittleEndian() {
  1991. var buffer8 = new Uint8Array(4);
  1992. buffer8[0] = 1;
  1993. var view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1994. return view32[0] === 1;
  1995. }
  1996. var IsLittleEndianCached = {
  1997. get value() {
  1998. return shadow(this, "value", isLittleEndian());
  1999. }
  2000. };
  2001. exports.IsLittleEndianCached = IsLittleEndianCached;
  2002. function isEvalSupported() {
  2003. try {
  2004. new Function("");
  2005. return true;
  2006. } catch (e) {
  2007. return false;
  2008. }
  2009. }
  2010. var IsEvalSupportedCached = {
  2011. get value() {
  2012. return shadow(this, "value", isEvalSupported());
  2013. }
  2014. };
  2015. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  2016. var rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
  2017. var Util = /*#__PURE__*/function () {
  2018. function Util() {
  2019. _classCallCheck(this, Util);
  2020. }
  2021. _createClass(Util, null, [{
  2022. key: "makeCssRgb",
  2023. value: function makeCssRgb(r, g, b) {
  2024. rgbBuf[1] = r;
  2025. rgbBuf[3] = g;
  2026. rgbBuf[5] = b;
  2027. return rgbBuf.join("");
  2028. }
  2029. }, {
  2030. key: "transform",
  2031. value: function transform(m1, m2) {
  2032. 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]];
  2033. }
  2034. }, {
  2035. key: "applyTransform",
  2036. value: function applyTransform(p, m) {
  2037. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  2038. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  2039. return [xt, yt];
  2040. }
  2041. }, {
  2042. key: "applyInverseTransform",
  2043. value: function applyInverseTransform(p, m) {
  2044. var d = m[0] * m[3] - m[1] * m[2];
  2045. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  2046. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  2047. return [xt, yt];
  2048. }
  2049. }, {
  2050. key: "getAxialAlignedBoundingBox",
  2051. value: function getAxialAlignedBoundingBox(r, m) {
  2052. var p1 = Util.applyTransform(r, m);
  2053. var p2 = Util.applyTransform(r.slice(2, 4), m);
  2054. var p3 = Util.applyTransform([r[0], r[3]], m);
  2055. var p4 = Util.applyTransform([r[2], r[1]], m);
  2056. 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])];
  2057. }
  2058. }, {
  2059. key: "inverseTransform",
  2060. value: function inverseTransform(m) {
  2061. var d = m[0] * m[3] - m[1] * m[2];
  2062. 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];
  2063. }
  2064. }, {
  2065. key: "apply3dTransform",
  2066. value: function apply3dTransform(m, v) {
  2067. 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]];
  2068. }
  2069. }, {
  2070. key: "singularValueDecompose2dScale",
  2071. value: function singularValueDecompose2dScale(m) {
  2072. var transpose = [m[0], m[2], m[1], m[3]];
  2073. var a = m[0] * transpose[0] + m[1] * transpose[2];
  2074. var b = m[0] * transpose[1] + m[1] * transpose[3];
  2075. var c = m[2] * transpose[0] + m[3] * transpose[2];
  2076. var d = m[2] * transpose[1] + m[3] * transpose[3];
  2077. var first = (a + d) / 2;
  2078. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  2079. var sx = first + second || 1;
  2080. var sy = first - second || 1;
  2081. return [Math.sqrt(sx), Math.sqrt(sy)];
  2082. }
  2083. }, {
  2084. key: "normalizeRect",
  2085. value: function normalizeRect(rect) {
  2086. var r = rect.slice(0);
  2087. if (rect[0] > rect[2]) {
  2088. r[0] = rect[2];
  2089. r[2] = rect[0];
  2090. }
  2091. if (rect[1] > rect[3]) {
  2092. r[1] = rect[3];
  2093. r[3] = rect[1];
  2094. }
  2095. return r;
  2096. }
  2097. }, {
  2098. key: "intersect",
  2099. value: function intersect(rect1, rect2) {
  2100. function compare(a, b) {
  2101. return a - b;
  2102. }
  2103. var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  2104. var orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  2105. var result = [];
  2106. rect1 = Util.normalizeRect(rect1);
  2107. rect2 = Util.normalizeRect(rect2);
  2108. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  2109. result[0] = orderedX[1];
  2110. result[2] = orderedX[2];
  2111. } else {
  2112. return null;
  2113. }
  2114. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  2115. result[1] = orderedY[1];
  2116. result[3] = orderedY[2];
  2117. } else {
  2118. return null;
  2119. }
  2120. return result;
  2121. }
  2122. }]);
  2123. return Util;
  2124. }();
  2125. exports.Util = Util;
  2126. 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];
  2127. function stringToPDFString(str) {
  2128. var length = str.length,
  2129. strBuf = [];
  2130. if (str[0] === "\xFE" && str[1] === "\xFF") {
  2131. for (var i = 2; i < length; i += 2) {
  2132. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  2133. }
  2134. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  2135. for (var _i2 = 2; _i2 < length; _i2 += 2) {
  2136. strBuf.push(String.fromCharCode(str.charCodeAt(_i2 + 1) << 8 | str.charCodeAt(_i2)));
  2137. }
  2138. } else {
  2139. for (var _i3 = 0; _i3 < length; ++_i3) {
  2140. var code = PDFStringTranslateTable[str.charCodeAt(_i3)];
  2141. strBuf.push(code ? String.fromCharCode(code) : str.charAt(_i3));
  2142. }
  2143. }
  2144. return strBuf.join("");
  2145. }
  2146. function stringToUTF8String(str) {
  2147. return decodeURIComponent(escape(str));
  2148. }
  2149. function utf8StringToString(str) {
  2150. return unescape(encodeURIComponent(str));
  2151. }
  2152. function isEmptyObj(obj) {
  2153. for (var key in obj) {
  2154. return false;
  2155. }
  2156. return true;
  2157. }
  2158. function isBool(v) {
  2159. return typeof v === "boolean";
  2160. }
  2161. function isNum(v) {
  2162. return typeof v === "number";
  2163. }
  2164. function isString(v) {
  2165. return typeof v === "string";
  2166. }
  2167. function isArrayBuffer(v) {
  2168. return _typeof(v) === "object" && v !== null && v.byteLength !== undefined;
  2169. }
  2170. function isArrayEqual(arr1, arr2) {
  2171. if (arr1.length !== arr2.length) {
  2172. return false;
  2173. }
  2174. return arr1.every(function (element, index) {
  2175. return element === arr2[index];
  2176. });
  2177. }
  2178. function createPromiseCapability() {
  2179. var capability = Object.create(null);
  2180. var isSettled = false;
  2181. Object.defineProperty(capability, "settled", {
  2182. get: function get() {
  2183. return isSettled;
  2184. }
  2185. });
  2186. capability.promise = new Promise(function (resolve, reject) {
  2187. capability.resolve = function (data) {
  2188. isSettled = true;
  2189. resolve(data);
  2190. };
  2191. capability.reject = function (reason) {
  2192. isSettled = true;
  2193. reject(reason);
  2194. };
  2195. });
  2196. return capability;
  2197. }
  2198. var createObjectURL = function createObjectURLClosure() {
  2199. var digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  2200. return function createObjectURL(data, contentType) {
  2201. var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2202. if (!forceDataSchema && URL.createObjectURL) {
  2203. var blob = new Blob([data], {
  2204. type: contentType
  2205. });
  2206. return URL.createObjectURL(blob);
  2207. }
  2208. var buffer = "data:".concat(contentType, ";base64,");
  2209. for (var i = 0, ii = data.length; i < ii; i += 3) {
  2210. var b1 = data[i] & 0xff;
  2211. var b2 = data[i + 1] & 0xff;
  2212. var b3 = data[i + 2] & 0xff;
  2213. var d1 = b1 >> 2,
  2214. d2 = (b1 & 3) << 4 | b2 >> 4;
  2215. var d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  2216. var d4 = i + 2 < ii ? b3 & 0x3f : 64;
  2217. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  2218. }
  2219. return buffer;
  2220. };
  2221. }();
  2222. exports.createObjectURL = createObjectURL;
  2223. /***/ }),
  2224. /* 6 */
  2225. /***/ (function(module, exports, __w_pdfjs_require__) {
  2226. "use strict";
  2227. var _is_node = __w_pdfjs_require__(7);
  2228. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2229. if (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked) {
  2230. if (typeof globalThis === "undefined" || globalThis.Math !== Math) {
  2231. globalThis = __w_pdfjs_require__(8);
  2232. }
  2233. globalThis._pdfjsCompatibilityChecked = true;
  2234. var hasDOM = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === "object";
  2235. var userAgent = typeof navigator !== "undefined" && navigator.userAgent || "";
  2236. var isIE = /Trident/.test(userAgent);
  2237. (function checkNodeBtoa() {
  2238. if (globalThis.btoa || !_is_node.isNodeJS) {
  2239. return;
  2240. }
  2241. globalThis.btoa = function (chars) {
  2242. return Buffer.from(chars, "binary").toString("base64");
  2243. };
  2244. })();
  2245. (function checkNodeAtob() {
  2246. if (globalThis.atob || !_is_node.isNodeJS) {
  2247. return;
  2248. }
  2249. globalThis.atob = function (input) {
  2250. return Buffer.from(input, "base64").toString("binary");
  2251. };
  2252. })();
  2253. (function checkChildNodeRemove() {
  2254. if (!hasDOM) {
  2255. return;
  2256. }
  2257. if (typeof Element.prototype.remove !== "undefined") {
  2258. return;
  2259. }
  2260. Element.prototype.remove = function () {
  2261. if (this.parentNode) {
  2262. this.parentNode.removeChild(this);
  2263. }
  2264. };
  2265. })();
  2266. (function checkDOMTokenListAddRemove() {
  2267. if (!hasDOM || _is_node.isNodeJS) {
  2268. return;
  2269. }
  2270. var div = document.createElement("div");
  2271. div.classList.add("testOne", "testTwo");
  2272. if (div.classList.contains("testOne") === true && div.classList.contains("testTwo") === true) {
  2273. return;
  2274. }
  2275. var OriginalDOMTokenListAdd = DOMTokenList.prototype.add;
  2276. var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;
  2277. DOMTokenList.prototype.add = function () {
  2278. for (var _len = arguments.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) {
  2279. tokens[_key] = arguments[_key];
  2280. }
  2281. for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
  2282. var token = _tokens[_i];
  2283. OriginalDOMTokenListAdd.call(this, token);
  2284. }
  2285. };
  2286. DOMTokenList.prototype.remove = function () {
  2287. for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  2288. tokens[_key2] = arguments[_key2];
  2289. }
  2290. for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) {
  2291. var token = _tokens2[_i2];
  2292. OriginalDOMTokenListRemove.call(this, token);
  2293. }
  2294. };
  2295. })();
  2296. (function checkDOMTokenListToggle() {
  2297. if (!hasDOM || _is_node.isNodeJS) {
  2298. return;
  2299. }
  2300. var div = document.createElement("div");
  2301. if (div.classList.toggle("test", 0) === false) {
  2302. return;
  2303. }
  2304. DOMTokenList.prototype.toggle = function (token) {
  2305. var force = arguments.length > 1 ? !!arguments[1] : !this.contains(token);
  2306. return this[force ? "add" : "remove"](token), force;
  2307. };
  2308. })();
  2309. (function checkWindowHistoryPushStateReplaceState() {
  2310. if (!hasDOM || !isIE) {
  2311. return;
  2312. }
  2313. var OriginalPushState = window.history.pushState;
  2314. var OriginalReplaceState = window.history.replaceState;
  2315. window.history.pushState = function (state, title, url) {
  2316. var args = url === undefined ? [state, title] : [state, title, url];
  2317. OriginalPushState.apply(this, args);
  2318. };
  2319. window.history.replaceState = function (state, title, url) {
  2320. var args = url === undefined ? [state, title] : [state, title, url];
  2321. OriginalReplaceState.apply(this, args);
  2322. };
  2323. })();
  2324. (function checkStringStartsWith() {
  2325. if (String.prototype.startsWith) {
  2326. return;
  2327. }
  2328. __w_pdfjs_require__(53);
  2329. })();
  2330. (function checkStringEndsWith() {
  2331. if (String.prototype.endsWith) {
  2332. return;
  2333. }
  2334. __w_pdfjs_require__(64);
  2335. })();
  2336. (function checkStringIncludes() {
  2337. if (String.prototype.includes) {
  2338. return;
  2339. }
  2340. __w_pdfjs_require__(66);
  2341. })();
  2342. (function checkArrayIncludes() {
  2343. if (Array.prototype.includes) {
  2344. return;
  2345. }
  2346. __w_pdfjs_require__(68);
  2347. })();
  2348. (function checkArrayFrom() {
  2349. if (Array.from) {
  2350. return;
  2351. }
  2352. __w_pdfjs_require__(76);
  2353. })();
  2354. (function checkObjectAssign() {
  2355. if (Object.assign) {
  2356. return;
  2357. }
  2358. __w_pdfjs_require__(98);
  2359. })();
  2360. (function checkMathLog2() {
  2361. if (Math.log2) {
  2362. return;
  2363. }
  2364. Math.log2 = __w_pdfjs_require__(101);
  2365. })();
  2366. (function checkNumberIsNaN() {
  2367. if (Number.isNaN) {
  2368. return;
  2369. }
  2370. Number.isNaN = __w_pdfjs_require__(103);
  2371. })();
  2372. (function checkNumberIsInteger() {
  2373. if (Number.isInteger) {
  2374. return;
  2375. }
  2376. Number.isInteger = __w_pdfjs_require__(105);
  2377. })();
  2378. (function checkTypedArraySlice() {
  2379. if (Uint8Array.prototype.slice) {
  2380. return;
  2381. }
  2382. __w_pdfjs_require__(108);
  2383. })();
  2384. (function checkPromise() {
  2385. if (globalThis.Promise && globalThis.Promise.allSettled) {
  2386. return;
  2387. }
  2388. globalThis.Promise = __w_pdfjs_require__(113);
  2389. })();
  2390. (function checkURL() {
  2391. globalThis.URL = __w_pdfjs_require__(136);
  2392. })();
  2393. (function checkReadableStream() {
  2394. var isReadableStreamSupported = false;
  2395. if (typeof ReadableStream !== "undefined") {
  2396. try {
  2397. new ReadableStream({
  2398. start: function start(controller) {
  2399. controller.close();
  2400. }
  2401. });
  2402. isReadableStreamSupported = true;
  2403. } catch (e) {}
  2404. }
  2405. if (isReadableStreamSupported) {
  2406. return;
  2407. }
  2408. globalThis.ReadableStream = __w_pdfjs_require__(143).ReadableStream;
  2409. })();
  2410. (function checkMapEntries() {
  2411. if (globalThis.Map && globalThis.Map.prototype.entries) {
  2412. return;
  2413. }
  2414. globalThis.Map = __w_pdfjs_require__(144);
  2415. })();
  2416. (function checkSetEntries() {
  2417. if (globalThis.Set && globalThis.Set.prototype.entries) {
  2418. return;
  2419. }
  2420. globalThis.Set = __w_pdfjs_require__(151);
  2421. })();
  2422. (function checkWeakMap() {
  2423. if (globalThis.WeakMap) {
  2424. return;
  2425. }
  2426. globalThis.WeakMap = __w_pdfjs_require__(153);
  2427. })();
  2428. (function checkWeakSet() {
  2429. if (globalThis.WeakSet) {
  2430. return;
  2431. }
  2432. globalThis.WeakSet = __w_pdfjs_require__(159);
  2433. })();
  2434. (function checkStringCodePointAt() {
  2435. if (String.prototype.codePointAt) {
  2436. return;
  2437. }
  2438. __w_pdfjs_require__(161);
  2439. })();
  2440. (function checkStringFromCodePoint() {
  2441. if (String.fromCodePoint) {
  2442. return;
  2443. }
  2444. String.fromCodePoint = __w_pdfjs_require__(163);
  2445. })();
  2446. (function checkSymbol() {
  2447. if (globalThis.Symbol) {
  2448. return;
  2449. }
  2450. __w_pdfjs_require__(165);
  2451. })();
  2452. (function checkStringPadStart() {
  2453. if (String.prototype.padStart) {
  2454. return;
  2455. }
  2456. __w_pdfjs_require__(188);
  2457. })();
  2458. (function checkStringPadEnd() {
  2459. if (String.prototype.padEnd) {
  2460. return;
  2461. }
  2462. __w_pdfjs_require__(193);
  2463. })();
  2464. (function checkObjectValues() {
  2465. if (Object.values) {
  2466. return;
  2467. }
  2468. Object.values = __w_pdfjs_require__(195);
  2469. })();
  2470. }
  2471. /***/ }),
  2472. /* 7 */
  2473. /***/ (function(module, exports, __w_pdfjs_require__) {
  2474. "use strict";
  2475. Object.defineProperty(exports, "__esModule", {
  2476. value: true
  2477. });
  2478. exports.isNodeJS = void 0;
  2479. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2480. var isNodeJS = (typeof process === "undefined" ? "undefined" : _typeof(process)) === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron;
  2481. exports.isNodeJS = isNodeJS;
  2482. /***/ }),
  2483. /* 8 */
  2484. /***/ (function(module, exports, __w_pdfjs_require__) {
  2485. __w_pdfjs_require__(9);
  2486. module.exports = __w_pdfjs_require__(11);
  2487. /***/ }),
  2488. /* 9 */
  2489. /***/ (function(module, exports, __w_pdfjs_require__) {
  2490. var $ = __w_pdfjs_require__(10);
  2491. var global = __w_pdfjs_require__(11);
  2492. $({ global: true }, { globalThis: global });
  2493. /***/ }),
  2494. /* 10 */
  2495. /***/ (function(module, exports, __w_pdfjs_require__) {
  2496. var global = __w_pdfjs_require__(11);
  2497. var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
  2498. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  2499. var redefine = __w_pdfjs_require__(29);
  2500. var setGlobal = __w_pdfjs_require__(30);
  2501. var copyConstructorProperties = __w_pdfjs_require__(40);
  2502. var isForced = __w_pdfjs_require__(52);
  2503. module.exports = function (options, source) {
  2504. var TARGET = options.target;
  2505. var GLOBAL = options.global;
  2506. var STATIC = options.stat;
  2507. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  2508. if (GLOBAL) {
  2509. target = global;
  2510. } else if (STATIC) {
  2511. target = global[TARGET] || setGlobal(TARGET, {});
  2512. } else {
  2513. target = (global[TARGET] || {}).prototype;
  2514. }
  2515. if (target)
  2516. for (key in source) {
  2517. sourceProperty = source[key];
  2518. if (options.noTargetGet) {
  2519. descriptor = getOwnPropertyDescriptor(target, key);
  2520. targetProperty = descriptor && descriptor.value;
  2521. } else
  2522. targetProperty = target[key];
  2523. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  2524. if (!FORCED && targetProperty !== undefined) {
  2525. if (typeof sourceProperty === typeof targetProperty)
  2526. continue;
  2527. copyConstructorProperties(sourceProperty, targetProperty);
  2528. }
  2529. if (options.sham || targetProperty && targetProperty.sham) {
  2530. createNonEnumerableProperty(sourceProperty, 'sham', true);
  2531. }
  2532. redefine(target, key, sourceProperty, options);
  2533. }
  2534. };
  2535. /***/ }),
  2536. /* 11 */
  2537. /***/ (function(module, exports) {
  2538. var check = function (it) {
  2539. return it && it.Math == Math && it;
  2540. };
  2541. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || Function('return this')();
  2542. /***/ }),
  2543. /* 12 */
  2544. /***/ (function(module, exports, __w_pdfjs_require__) {
  2545. var DESCRIPTORS = __w_pdfjs_require__(13);
  2546. var propertyIsEnumerableModule = __w_pdfjs_require__(15);
  2547. var createPropertyDescriptor = __w_pdfjs_require__(16);
  2548. var toIndexedObject = __w_pdfjs_require__(17);
  2549. var toPrimitive = __w_pdfjs_require__(21);
  2550. var has = __w_pdfjs_require__(23);
  2551. var IE8_DOM_DEFINE = __w_pdfjs_require__(24);
  2552. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2553. exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  2554. O = toIndexedObject(O);
  2555. P = toPrimitive(P, true);
  2556. if (IE8_DOM_DEFINE)
  2557. try {
  2558. return nativeGetOwnPropertyDescriptor(O, P);
  2559. } catch (error) {
  2560. }
  2561. if (has(O, P))
  2562. return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  2563. };
  2564. /***/ }),
  2565. /* 13 */
  2566. /***/ (function(module, exports, __w_pdfjs_require__) {
  2567. var fails = __w_pdfjs_require__(14);
  2568. module.exports = !fails(function () {
  2569. return Object.defineProperty({}, 1, {
  2570. get: function () {
  2571. return 7;
  2572. }
  2573. })[1] != 7;
  2574. });
  2575. /***/ }),
  2576. /* 14 */
  2577. /***/ (function(module, exports) {
  2578. module.exports = function (exec) {
  2579. try {
  2580. return !!exec();
  2581. } catch (error) {
  2582. return true;
  2583. }
  2584. };
  2585. /***/ }),
  2586. /* 15 */
  2587. /***/ (function(module, exports, __w_pdfjs_require__) {
  2588. "use strict";
  2589. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  2590. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2591. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  2592. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  2593. var descriptor = getOwnPropertyDescriptor(this, V);
  2594. return !!descriptor && descriptor.enumerable;
  2595. } : nativePropertyIsEnumerable;
  2596. /***/ }),
  2597. /* 16 */
  2598. /***/ (function(module, exports) {
  2599. module.exports = function (bitmap, value) {
  2600. return {
  2601. enumerable: !(bitmap & 1),
  2602. configurable: !(bitmap & 2),
  2603. writable: !(bitmap & 4),
  2604. value: value
  2605. };
  2606. };
  2607. /***/ }),
  2608. /* 17 */
  2609. /***/ (function(module, exports, __w_pdfjs_require__) {
  2610. var IndexedObject = __w_pdfjs_require__(18);
  2611. var requireObjectCoercible = __w_pdfjs_require__(20);
  2612. module.exports = function (it) {
  2613. return IndexedObject(requireObjectCoercible(it));
  2614. };
  2615. /***/ }),
  2616. /* 18 */
  2617. /***/ (function(module, exports, __w_pdfjs_require__) {
  2618. var fails = __w_pdfjs_require__(14);
  2619. var classof = __w_pdfjs_require__(19);
  2620. var split = ''.split;
  2621. module.exports = fails(function () {
  2622. return !Object('z').propertyIsEnumerable(0);
  2623. }) ? function (it) {
  2624. return classof(it) == 'String' ? split.call(it, '') : Object(it);
  2625. } : Object;
  2626. /***/ }),
  2627. /* 19 */
  2628. /***/ (function(module, exports) {
  2629. var toString = {}.toString;
  2630. module.exports = function (it) {
  2631. return toString.call(it).slice(8, -1);
  2632. };
  2633. /***/ }),
  2634. /* 20 */
  2635. /***/ (function(module, exports) {
  2636. module.exports = function (it) {
  2637. if (it == undefined)
  2638. throw TypeError("Can't call method on " + it);
  2639. return it;
  2640. };
  2641. /***/ }),
  2642. /* 21 */
  2643. /***/ (function(module, exports, __w_pdfjs_require__) {
  2644. var isObject = __w_pdfjs_require__(22);
  2645. module.exports = function (input, PREFERRED_STRING) {
  2646. if (!isObject(input))
  2647. return input;
  2648. var fn, val;
  2649. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input)))
  2650. return val;
  2651. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input)))
  2652. return val;
  2653. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input)))
  2654. return val;
  2655. throw TypeError("Can't convert object to primitive value");
  2656. };
  2657. /***/ }),
  2658. /* 22 */
  2659. /***/ (function(module, exports) {
  2660. module.exports = function (it) {
  2661. return typeof it === 'object' ? it !== null : typeof it === 'function';
  2662. };
  2663. /***/ }),
  2664. /* 23 */
  2665. /***/ (function(module, exports) {
  2666. var hasOwnProperty = {}.hasOwnProperty;
  2667. module.exports = function (it, key) {
  2668. return hasOwnProperty.call(it, key);
  2669. };
  2670. /***/ }),
  2671. /* 24 */
  2672. /***/ (function(module, exports, __w_pdfjs_require__) {
  2673. var DESCRIPTORS = __w_pdfjs_require__(13);
  2674. var fails = __w_pdfjs_require__(14);
  2675. var createElement = __w_pdfjs_require__(25);
  2676. module.exports = !DESCRIPTORS && !fails(function () {
  2677. return Object.defineProperty(createElement('div'), 'a', {
  2678. get: function () {
  2679. return 7;
  2680. }
  2681. }).a != 7;
  2682. });
  2683. /***/ }),
  2684. /* 25 */
  2685. /***/ (function(module, exports, __w_pdfjs_require__) {
  2686. var global = __w_pdfjs_require__(11);
  2687. var isObject = __w_pdfjs_require__(22);
  2688. var document = global.document;
  2689. var EXISTS = isObject(document) && isObject(document.createElement);
  2690. module.exports = function (it) {
  2691. return EXISTS ? document.createElement(it) : {};
  2692. };
  2693. /***/ }),
  2694. /* 26 */
  2695. /***/ (function(module, exports, __w_pdfjs_require__) {
  2696. var DESCRIPTORS = __w_pdfjs_require__(13);
  2697. var definePropertyModule = __w_pdfjs_require__(27);
  2698. var createPropertyDescriptor = __w_pdfjs_require__(16);
  2699. module.exports = DESCRIPTORS ? function (object, key, value) {
  2700. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  2701. } : function (object, key, value) {
  2702. object[key] = value;
  2703. return object;
  2704. };
  2705. /***/ }),
  2706. /* 27 */
  2707. /***/ (function(module, exports, __w_pdfjs_require__) {
  2708. var DESCRIPTORS = __w_pdfjs_require__(13);
  2709. var IE8_DOM_DEFINE = __w_pdfjs_require__(24);
  2710. var anObject = __w_pdfjs_require__(28);
  2711. var toPrimitive = __w_pdfjs_require__(21);
  2712. var nativeDefineProperty = Object.defineProperty;
  2713. exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  2714. anObject(O);
  2715. P = toPrimitive(P, true);
  2716. anObject(Attributes);
  2717. if (IE8_DOM_DEFINE)
  2718. try {
  2719. return nativeDefineProperty(O, P, Attributes);
  2720. } catch (error) {
  2721. }
  2722. if ('get' in Attributes || 'set' in Attributes)
  2723. throw TypeError('Accessors not supported');
  2724. if ('value' in Attributes)
  2725. O[P] = Attributes.value;
  2726. return O;
  2727. };
  2728. /***/ }),
  2729. /* 28 */
  2730. /***/ (function(module, exports, __w_pdfjs_require__) {
  2731. var isObject = __w_pdfjs_require__(22);
  2732. module.exports = function (it) {
  2733. if (!isObject(it)) {
  2734. throw TypeError(String(it) + ' is not an object');
  2735. }
  2736. return it;
  2737. };
  2738. /***/ }),
  2739. /* 29 */
  2740. /***/ (function(module, exports, __w_pdfjs_require__) {
  2741. var global = __w_pdfjs_require__(11);
  2742. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  2743. var has = __w_pdfjs_require__(23);
  2744. var setGlobal = __w_pdfjs_require__(30);
  2745. var inspectSource = __w_pdfjs_require__(31);
  2746. var InternalStateModule = __w_pdfjs_require__(33);
  2747. var getInternalState = InternalStateModule.get;
  2748. var enforceInternalState = InternalStateModule.enforce;
  2749. var TEMPLATE = String(String).split('String');
  2750. (module.exports = function (O, key, value, options) {
  2751. var unsafe = options ? !!options.unsafe : false;
  2752. var simple = options ? !!options.enumerable : false;
  2753. var noTargetGet = options ? !!options.noTargetGet : false;
  2754. if (typeof value == 'function') {
  2755. if (typeof key == 'string' && !has(value, 'name'))
  2756. createNonEnumerableProperty(value, 'name', key);
  2757. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  2758. }
  2759. if (O === global) {
  2760. if (simple)
  2761. O[key] = value;
  2762. else
  2763. setGlobal(key, value);
  2764. return;
  2765. } else if (!unsafe) {
  2766. delete O[key];
  2767. } else if (!noTargetGet && O[key]) {
  2768. simple = true;
  2769. }
  2770. if (simple)
  2771. O[key] = value;
  2772. else
  2773. createNonEnumerableProperty(O, key, value);
  2774. })(Function.prototype, 'toString', function toString() {
  2775. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  2776. });
  2777. /***/ }),
  2778. /* 30 */
  2779. /***/ (function(module, exports, __w_pdfjs_require__) {
  2780. var global = __w_pdfjs_require__(11);
  2781. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  2782. module.exports = function (key, value) {
  2783. try {
  2784. createNonEnumerableProperty(global, key, value);
  2785. } catch (error) {
  2786. global[key] = value;
  2787. }
  2788. return value;
  2789. };
  2790. /***/ }),
  2791. /* 31 */
  2792. /***/ (function(module, exports, __w_pdfjs_require__) {
  2793. var store = __w_pdfjs_require__(32);
  2794. var functionToString = Function.toString;
  2795. if (typeof store.inspectSource != 'function') {
  2796. store.inspectSource = function (it) {
  2797. return functionToString.call(it);
  2798. };
  2799. }
  2800. module.exports = store.inspectSource;
  2801. /***/ }),
  2802. /* 32 */
  2803. /***/ (function(module, exports, __w_pdfjs_require__) {
  2804. var global = __w_pdfjs_require__(11);
  2805. var setGlobal = __w_pdfjs_require__(30);
  2806. var SHARED = '__core-js_shared__';
  2807. var store = global[SHARED] || setGlobal(SHARED, {});
  2808. module.exports = store;
  2809. /***/ }),
  2810. /* 33 */
  2811. /***/ (function(module, exports, __w_pdfjs_require__) {
  2812. var NATIVE_WEAK_MAP = __w_pdfjs_require__(34);
  2813. var global = __w_pdfjs_require__(11);
  2814. var isObject = __w_pdfjs_require__(22);
  2815. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  2816. var objectHas = __w_pdfjs_require__(23);
  2817. var sharedKey = __w_pdfjs_require__(35);
  2818. var hiddenKeys = __w_pdfjs_require__(39);
  2819. var WeakMap = global.WeakMap;
  2820. var set, get, has;
  2821. var enforce = function (it) {
  2822. return has(it) ? get(it) : set(it, {});
  2823. };
  2824. var getterFor = function (TYPE) {
  2825. return function (it) {
  2826. var state;
  2827. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  2828. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  2829. }
  2830. return state;
  2831. };
  2832. };
  2833. if (NATIVE_WEAK_MAP) {
  2834. var store = new WeakMap();
  2835. var wmget = store.get;
  2836. var wmhas = store.has;
  2837. var wmset = store.set;
  2838. set = function (it, metadata) {
  2839. wmset.call(store, it, metadata);
  2840. return metadata;
  2841. };
  2842. get = function (it) {
  2843. return wmget.call(store, it) || {};
  2844. };
  2845. has = function (it) {
  2846. return wmhas.call(store, it);
  2847. };
  2848. } else {
  2849. var STATE = sharedKey('state');
  2850. hiddenKeys[STATE] = true;
  2851. set = function (it, metadata) {
  2852. createNonEnumerableProperty(it, STATE, metadata);
  2853. return metadata;
  2854. };
  2855. get = function (it) {
  2856. return objectHas(it, STATE) ? it[STATE] : {};
  2857. };
  2858. has = function (it) {
  2859. return objectHas(it, STATE);
  2860. };
  2861. }
  2862. module.exports = {
  2863. set: set,
  2864. get: get,
  2865. has: has,
  2866. enforce: enforce,
  2867. getterFor: getterFor
  2868. };
  2869. /***/ }),
  2870. /* 34 */
  2871. /***/ (function(module, exports, __w_pdfjs_require__) {
  2872. var global = __w_pdfjs_require__(11);
  2873. var inspectSource = __w_pdfjs_require__(31);
  2874. var WeakMap = global.WeakMap;
  2875. module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
  2876. /***/ }),
  2877. /* 35 */
  2878. /***/ (function(module, exports, __w_pdfjs_require__) {
  2879. var shared = __w_pdfjs_require__(36);
  2880. var uid = __w_pdfjs_require__(38);
  2881. var keys = shared('keys');
  2882. module.exports = function (key) {
  2883. return keys[key] || (keys[key] = uid(key));
  2884. };
  2885. /***/ }),
  2886. /* 36 */
  2887. /***/ (function(module, exports, __w_pdfjs_require__) {
  2888. var IS_PURE = __w_pdfjs_require__(37);
  2889. var store = __w_pdfjs_require__(32);
  2890. (module.exports = function (key, value) {
  2891. return store[key] || (store[key] = value !== undefined ? value : {});
  2892. })('versions', []).push({
  2893. version: '3.6.5',
  2894. mode: IS_PURE ? 'pure' : 'global',
  2895. copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
  2896. });
  2897. /***/ }),
  2898. /* 37 */
  2899. /***/ (function(module, exports) {
  2900. module.exports = false;
  2901. /***/ }),
  2902. /* 38 */
  2903. /***/ (function(module, exports) {
  2904. var id = 0;
  2905. var postfix = Math.random();
  2906. module.exports = function (key) {
  2907. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  2908. };
  2909. /***/ }),
  2910. /* 39 */
  2911. /***/ (function(module, exports) {
  2912. module.exports = {};
  2913. /***/ }),
  2914. /* 40 */
  2915. /***/ (function(module, exports, __w_pdfjs_require__) {
  2916. var has = __w_pdfjs_require__(23);
  2917. var ownKeys = __w_pdfjs_require__(41);
  2918. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(12);
  2919. var definePropertyModule = __w_pdfjs_require__(27);
  2920. module.exports = function (target, source) {
  2921. var keys = ownKeys(source);
  2922. var defineProperty = definePropertyModule.f;
  2923. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  2924. for (var i = 0; i < keys.length; i++) {
  2925. var key = keys[i];
  2926. if (!has(target, key))
  2927. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  2928. }
  2929. };
  2930. /***/ }),
  2931. /* 41 */
  2932. /***/ (function(module, exports, __w_pdfjs_require__) {
  2933. var getBuiltIn = __w_pdfjs_require__(42);
  2934. var getOwnPropertyNamesModule = __w_pdfjs_require__(44);
  2935. var getOwnPropertySymbolsModule = __w_pdfjs_require__(51);
  2936. var anObject = __w_pdfjs_require__(28);
  2937. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  2938. var keys = getOwnPropertyNamesModule.f(anObject(it));
  2939. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  2940. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  2941. };
  2942. /***/ }),
  2943. /* 42 */
  2944. /***/ (function(module, exports, __w_pdfjs_require__) {
  2945. var path = __w_pdfjs_require__(43);
  2946. var global = __w_pdfjs_require__(11);
  2947. var aFunction = function (variable) {
  2948. return typeof variable == 'function' ? variable : undefined;
  2949. };
  2950. module.exports = function (namespace, method) {
  2951. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace]) : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  2952. };
  2953. /***/ }),
  2954. /* 43 */
  2955. /***/ (function(module, exports, __w_pdfjs_require__) {
  2956. var global = __w_pdfjs_require__(11);
  2957. module.exports = global;
  2958. /***/ }),
  2959. /* 44 */
  2960. /***/ (function(module, exports, __w_pdfjs_require__) {
  2961. var internalObjectKeys = __w_pdfjs_require__(45);
  2962. var enumBugKeys = __w_pdfjs_require__(50);
  2963. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  2964. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  2965. return internalObjectKeys(O, hiddenKeys);
  2966. };
  2967. /***/ }),
  2968. /* 45 */
  2969. /***/ (function(module, exports, __w_pdfjs_require__) {
  2970. var has = __w_pdfjs_require__(23);
  2971. var toIndexedObject = __w_pdfjs_require__(17);
  2972. var indexOf = __w_pdfjs_require__(46).indexOf;
  2973. var hiddenKeys = __w_pdfjs_require__(39);
  2974. module.exports = function (object, names) {
  2975. var O = toIndexedObject(object);
  2976. var i = 0;
  2977. var result = [];
  2978. var key;
  2979. for (key in O)
  2980. !has(hiddenKeys, key) && has(O, key) && result.push(key);
  2981. while (names.length > i)
  2982. if (has(O, key = names[i++])) {
  2983. ~indexOf(result, key) || result.push(key);
  2984. }
  2985. return result;
  2986. };
  2987. /***/ }),
  2988. /* 46 */
  2989. /***/ (function(module, exports, __w_pdfjs_require__) {
  2990. var toIndexedObject = __w_pdfjs_require__(17);
  2991. var toLength = __w_pdfjs_require__(47);
  2992. var toAbsoluteIndex = __w_pdfjs_require__(49);
  2993. var createMethod = function (IS_INCLUDES) {
  2994. return function ($this, el, fromIndex) {
  2995. var O = toIndexedObject($this);
  2996. var length = toLength(O.length);
  2997. var index = toAbsoluteIndex(fromIndex, length);
  2998. var value;
  2999. if (IS_INCLUDES && el != el)
  3000. while (length > index) {
  3001. value = O[index++];
  3002. if (value != value)
  3003. return true;
  3004. }
  3005. else
  3006. for (; length > index; index++) {
  3007. if ((IS_INCLUDES || index in O) && O[index] === el)
  3008. return IS_INCLUDES || index || 0;
  3009. }
  3010. return !IS_INCLUDES && -1;
  3011. };
  3012. };
  3013. module.exports = {
  3014. includes: createMethod(true),
  3015. indexOf: createMethod(false)
  3016. };
  3017. /***/ }),
  3018. /* 47 */
  3019. /***/ (function(module, exports, __w_pdfjs_require__) {
  3020. var toInteger = __w_pdfjs_require__(48);
  3021. var min = Math.min;
  3022. module.exports = function (argument) {
  3023. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
  3024. };
  3025. /***/ }),
  3026. /* 48 */
  3027. /***/ (function(module, exports) {
  3028. var ceil = Math.ceil;
  3029. var floor = Math.floor;
  3030. module.exports = function (argument) {
  3031. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  3032. };
  3033. /***/ }),
  3034. /* 49 */
  3035. /***/ (function(module, exports, __w_pdfjs_require__) {
  3036. var toInteger = __w_pdfjs_require__(48);
  3037. var max = Math.max;
  3038. var min = Math.min;
  3039. module.exports = function (index, length) {
  3040. var integer = toInteger(index);
  3041. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  3042. };
  3043. /***/ }),
  3044. /* 50 */
  3045. /***/ (function(module, exports) {
  3046. module.exports = [
  3047. 'constructor',
  3048. 'hasOwnProperty',
  3049. 'isPrototypeOf',
  3050. 'propertyIsEnumerable',
  3051. 'toLocaleString',
  3052. 'toString',
  3053. 'valueOf'
  3054. ];
  3055. /***/ }),
  3056. /* 51 */
  3057. /***/ (function(module, exports) {
  3058. exports.f = Object.getOwnPropertySymbols;
  3059. /***/ }),
  3060. /* 52 */
  3061. /***/ (function(module, exports, __w_pdfjs_require__) {
  3062. var fails = __w_pdfjs_require__(14);
  3063. var replacement = /#|\.prototype\./;
  3064. var isForced = function (feature, detection) {
  3065. var value = data[normalize(feature)];
  3066. return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection;
  3067. };
  3068. var normalize = isForced.normalize = function (string) {
  3069. return String(string).replace(replacement, '.').toLowerCase();
  3070. };
  3071. var data = isForced.data = {};
  3072. var NATIVE = isForced.NATIVE = 'N';
  3073. var POLYFILL = isForced.POLYFILL = 'P';
  3074. module.exports = isForced;
  3075. /***/ }),
  3076. /* 53 */
  3077. /***/ (function(module, exports, __w_pdfjs_require__) {
  3078. __w_pdfjs_require__(54);
  3079. var entryUnbind = __w_pdfjs_require__(61);
  3080. module.exports = entryUnbind('String', 'startsWith');
  3081. /***/ }),
  3082. /* 54 */
  3083. /***/ (function(module, exports, __w_pdfjs_require__) {
  3084. "use strict";
  3085. var $ = __w_pdfjs_require__(10);
  3086. var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
  3087. var toLength = __w_pdfjs_require__(47);
  3088. var notARegExp = __w_pdfjs_require__(55);
  3089. var requireObjectCoercible = __w_pdfjs_require__(20);
  3090. var correctIsRegExpLogic = __w_pdfjs_require__(60);
  3091. var IS_PURE = __w_pdfjs_require__(37);
  3092. var nativeStartsWith = ''.startsWith;
  3093. var min = Math.min;
  3094. var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
  3095. var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
  3096. var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
  3097. return descriptor && !descriptor.writable;
  3098. }();
  3099. $({
  3100. target: 'String',
  3101. proto: true,
  3102. forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC
  3103. }, {
  3104. startsWith: function startsWith(searchString) {
  3105. var that = String(requireObjectCoercible(this));
  3106. notARegExp(searchString);
  3107. var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
  3108. var search = String(searchString);
  3109. return nativeStartsWith ? nativeStartsWith.call(that, search, index) : that.slice(index, index + search.length) === search;
  3110. }
  3111. });
  3112. /***/ }),
  3113. /* 55 */
  3114. /***/ (function(module, exports, __w_pdfjs_require__) {
  3115. var isRegExp = __w_pdfjs_require__(56);
  3116. module.exports = function (it) {
  3117. if (isRegExp(it)) {
  3118. throw TypeError("The method doesn't accept regular expressions");
  3119. }
  3120. return it;
  3121. };
  3122. /***/ }),
  3123. /* 56 */
  3124. /***/ (function(module, exports, __w_pdfjs_require__) {
  3125. var isObject = __w_pdfjs_require__(22);
  3126. var classof = __w_pdfjs_require__(19);
  3127. var wellKnownSymbol = __w_pdfjs_require__(57);
  3128. var MATCH = wellKnownSymbol('match');
  3129. module.exports = function (it) {
  3130. var isRegExp;
  3131. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
  3132. };
  3133. /***/ }),
  3134. /* 57 */
  3135. /***/ (function(module, exports, __w_pdfjs_require__) {
  3136. var global = __w_pdfjs_require__(11);
  3137. var shared = __w_pdfjs_require__(36);
  3138. var has = __w_pdfjs_require__(23);
  3139. var uid = __w_pdfjs_require__(38);
  3140. var NATIVE_SYMBOL = __w_pdfjs_require__(58);
  3141. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(59);
  3142. var WellKnownSymbolsStore = shared('wks');
  3143. var Symbol = global.Symbol;
  3144. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  3145. module.exports = function (name) {
  3146. if (!has(WellKnownSymbolsStore, name)) {
  3147. if (NATIVE_SYMBOL && has(Symbol, name))
  3148. WellKnownSymbolsStore[name] = Symbol[name];
  3149. else
  3150. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  3151. }
  3152. return WellKnownSymbolsStore[name];
  3153. };
  3154. /***/ }),
  3155. /* 58 */
  3156. /***/ (function(module, exports, __w_pdfjs_require__) {
  3157. var fails = __w_pdfjs_require__(14);
  3158. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  3159. return !String(Symbol());
  3160. });
  3161. /***/ }),
  3162. /* 59 */
  3163. /***/ (function(module, exports, __w_pdfjs_require__) {
  3164. var NATIVE_SYMBOL = __w_pdfjs_require__(58);
  3165. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  3166. /***/ }),
  3167. /* 60 */
  3168. /***/ (function(module, exports, __w_pdfjs_require__) {
  3169. var wellKnownSymbol = __w_pdfjs_require__(57);
  3170. var MATCH = wellKnownSymbol('match');
  3171. module.exports = function (METHOD_NAME) {
  3172. var regexp = /./;
  3173. try {
  3174. '/./'[METHOD_NAME](regexp);
  3175. } catch (e) {
  3176. try {
  3177. regexp[MATCH] = false;
  3178. return '/./'[METHOD_NAME](regexp);
  3179. } catch (f) {
  3180. }
  3181. }
  3182. return false;
  3183. };
  3184. /***/ }),
  3185. /* 61 */
  3186. /***/ (function(module, exports, __w_pdfjs_require__) {
  3187. var global = __w_pdfjs_require__(11);
  3188. var bind = __w_pdfjs_require__(62);
  3189. var call = Function.call;
  3190. module.exports = function (CONSTRUCTOR, METHOD, length) {
  3191. return bind(call, global[CONSTRUCTOR].prototype[METHOD], length);
  3192. };
  3193. /***/ }),
  3194. /* 62 */
  3195. /***/ (function(module, exports, __w_pdfjs_require__) {
  3196. var aFunction = __w_pdfjs_require__(63);
  3197. module.exports = function (fn, that, length) {
  3198. aFunction(fn);
  3199. if (that === undefined)
  3200. return fn;
  3201. switch (length) {
  3202. case 0:
  3203. return function () {
  3204. return fn.call(that);
  3205. };
  3206. case 1:
  3207. return function (a) {
  3208. return fn.call(that, a);
  3209. };
  3210. case 2:
  3211. return function (a, b) {
  3212. return fn.call(that, a, b);
  3213. };
  3214. case 3:
  3215. return function (a, b, c) {
  3216. return fn.call(that, a, b, c);
  3217. };
  3218. }
  3219. return function () {
  3220. return fn.apply(that, arguments);
  3221. };
  3222. };
  3223. /***/ }),
  3224. /* 63 */
  3225. /***/ (function(module, exports) {
  3226. module.exports = function (it) {
  3227. if (typeof it != 'function') {
  3228. throw TypeError(String(it) + ' is not a function');
  3229. }
  3230. return it;
  3231. };
  3232. /***/ }),
  3233. /* 64 */
  3234. /***/ (function(module, exports, __w_pdfjs_require__) {
  3235. __w_pdfjs_require__(65);
  3236. var entryUnbind = __w_pdfjs_require__(61);
  3237. module.exports = entryUnbind('String', 'endsWith');
  3238. /***/ }),
  3239. /* 65 */
  3240. /***/ (function(module, exports, __w_pdfjs_require__) {
  3241. "use strict";
  3242. var $ = __w_pdfjs_require__(10);
  3243. var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
  3244. var toLength = __w_pdfjs_require__(47);
  3245. var notARegExp = __w_pdfjs_require__(55);
  3246. var requireObjectCoercible = __w_pdfjs_require__(20);
  3247. var correctIsRegExpLogic = __w_pdfjs_require__(60);
  3248. var IS_PURE = __w_pdfjs_require__(37);
  3249. var nativeEndsWith = ''.endsWith;
  3250. var min = Math.min;
  3251. var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith');
  3252. var MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {
  3253. var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
  3254. return descriptor && !descriptor.writable;
  3255. }();
  3256. $({
  3257. target: 'String',
  3258. proto: true,
  3259. forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC
  3260. }, {
  3261. endsWith: function endsWith(searchString) {
  3262. var that = String(requireObjectCoercible(this));
  3263. notARegExp(searchString);
  3264. var endPosition = arguments.length > 1 ? arguments[1] : undefined;
  3265. var len = toLength(that.length);
  3266. var end = endPosition === undefined ? len : min(toLength(endPosition), len);
  3267. var search = String(searchString);
  3268. return nativeEndsWith ? nativeEndsWith.call(that, search, end) : that.slice(end - search.length, end) === search;
  3269. }
  3270. });
  3271. /***/ }),
  3272. /* 66 */
  3273. /***/ (function(module, exports, __w_pdfjs_require__) {
  3274. __w_pdfjs_require__(67);
  3275. var entryUnbind = __w_pdfjs_require__(61);
  3276. module.exports = entryUnbind('String', 'includes');
  3277. /***/ }),
  3278. /* 67 */
  3279. /***/ (function(module, exports, __w_pdfjs_require__) {
  3280. "use strict";
  3281. var $ = __w_pdfjs_require__(10);
  3282. var notARegExp = __w_pdfjs_require__(55);
  3283. var requireObjectCoercible = __w_pdfjs_require__(20);
  3284. var correctIsRegExpLogic = __w_pdfjs_require__(60);
  3285. $({
  3286. target: 'String',
  3287. proto: true,
  3288. forced: !correctIsRegExpLogic('includes')
  3289. }, {
  3290. includes: function includes(searchString) {
  3291. return !!~String(requireObjectCoercible(this)).indexOf(notARegExp(searchString), arguments.length > 1 ? arguments[1] : undefined);
  3292. }
  3293. });
  3294. /***/ }),
  3295. /* 68 */
  3296. /***/ (function(module, exports, __w_pdfjs_require__) {
  3297. __w_pdfjs_require__(69);
  3298. var entryUnbind = __w_pdfjs_require__(61);
  3299. module.exports = entryUnbind('Array', 'includes');
  3300. /***/ }),
  3301. /* 69 */
  3302. /***/ (function(module, exports, __w_pdfjs_require__) {
  3303. "use strict";
  3304. var $ = __w_pdfjs_require__(10);
  3305. var $includes = __w_pdfjs_require__(46).includes;
  3306. var addToUnscopables = __w_pdfjs_require__(70);
  3307. var arrayMethodUsesToLength = __w_pdfjs_require__(75);
  3308. var USES_TO_LENGTH = arrayMethodUsesToLength('indexOf', {
  3309. ACCESSORS: true,
  3310. 1: 0
  3311. });
  3312. $({
  3313. target: 'Array',
  3314. proto: true,
  3315. forced: !USES_TO_LENGTH
  3316. }, {
  3317. includes: function includes(el) {
  3318. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  3319. }
  3320. });
  3321. addToUnscopables('includes');
  3322. /***/ }),
  3323. /* 70 */
  3324. /***/ (function(module, exports, __w_pdfjs_require__) {
  3325. var wellKnownSymbol = __w_pdfjs_require__(57);
  3326. var create = __w_pdfjs_require__(71);
  3327. var definePropertyModule = __w_pdfjs_require__(27);
  3328. var UNSCOPABLES = wellKnownSymbol('unscopables');
  3329. var ArrayPrototype = Array.prototype;
  3330. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  3331. definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
  3332. configurable: true,
  3333. value: create(null)
  3334. });
  3335. }
  3336. module.exports = function (key) {
  3337. ArrayPrototype[UNSCOPABLES][key] = true;
  3338. };
  3339. /***/ }),
  3340. /* 71 */
  3341. /***/ (function(module, exports, __w_pdfjs_require__) {
  3342. var anObject = __w_pdfjs_require__(28);
  3343. var defineProperties = __w_pdfjs_require__(72);
  3344. var enumBugKeys = __w_pdfjs_require__(50);
  3345. var hiddenKeys = __w_pdfjs_require__(39);
  3346. var html = __w_pdfjs_require__(74);
  3347. var documentCreateElement = __w_pdfjs_require__(25);
  3348. var sharedKey = __w_pdfjs_require__(35);
  3349. var GT = '>';
  3350. var LT = '<';
  3351. var PROTOTYPE = 'prototype';
  3352. var SCRIPT = 'script';
  3353. var IE_PROTO = sharedKey('IE_PROTO');
  3354. var EmptyConstructor = function () {
  3355. };
  3356. var scriptTag = function (content) {
  3357. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  3358. };
  3359. var NullProtoObjectViaActiveX = function (activeXDocument) {
  3360. activeXDocument.write(scriptTag(''));
  3361. activeXDocument.close();
  3362. var temp = activeXDocument.parentWindow.Object;
  3363. activeXDocument = null;
  3364. return temp;
  3365. };
  3366. var NullProtoObjectViaIFrame = function () {
  3367. var iframe = documentCreateElement('iframe');
  3368. var JS = 'java' + SCRIPT + ':';
  3369. var iframeDocument;
  3370. iframe.style.display = 'none';
  3371. html.appendChild(iframe);
  3372. iframe.src = String(JS);
  3373. iframeDocument = iframe.contentWindow.document;
  3374. iframeDocument.open();
  3375. iframeDocument.write(scriptTag('document.F=Object'));
  3376. iframeDocument.close();
  3377. return iframeDocument.F;
  3378. };
  3379. var activeXDocument;
  3380. var NullProtoObject = function () {
  3381. try {
  3382. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  3383. } catch (error) {
  3384. }
  3385. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  3386. var length = enumBugKeys.length;
  3387. while (length--)
  3388. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  3389. return NullProtoObject();
  3390. };
  3391. hiddenKeys[IE_PROTO] = true;
  3392. module.exports = Object.create || function create(O, Properties) {
  3393. var result;
  3394. if (O !== null) {
  3395. EmptyConstructor[PROTOTYPE] = anObject(O);
  3396. result = new EmptyConstructor();
  3397. EmptyConstructor[PROTOTYPE] = null;
  3398. result[IE_PROTO] = O;
  3399. } else
  3400. result = NullProtoObject();
  3401. return Properties === undefined ? result : defineProperties(result, Properties);
  3402. };
  3403. /***/ }),
  3404. /* 72 */
  3405. /***/ (function(module, exports, __w_pdfjs_require__) {
  3406. var DESCRIPTORS = __w_pdfjs_require__(13);
  3407. var definePropertyModule = __w_pdfjs_require__(27);
  3408. var anObject = __w_pdfjs_require__(28);
  3409. var objectKeys = __w_pdfjs_require__(73);
  3410. module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  3411. anObject(O);
  3412. var keys = objectKeys(Properties);
  3413. var length = keys.length;
  3414. var index = 0;
  3415. var key;
  3416. while (length > index)
  3417. definePropertyModule.f(O, key = keys[index++], Properties[key]);
  3418. return O;
  3419. };
  3420. /***/ }),
  3421. /* 73 */
  3422. /***/ (function(module, exports, __w_pdfjs_require__) {
  3423. var internalObjectKeys = __w_pdfjs_require__(45);
  3424. var enumBugKeys = __w_pdfjs_require__(50);
  3425. module.exports = Object.keys || function keys(O) {
  3426. return internalObjectKeys(O, enumBugKeys);
  3427. };
  3428. /***/ }),
  3429. /* 74 */
  3430. /***/ (function(module, exports, __w_pdfjs_require__) {
  3431. var getBuiltIn = __w_pdfjs_require__(42);
  3432. module.exports = getBuiltIn('document', 'documentElement');
  3433. /***/ }),
  3434. /* 75 */
  3435. /***/ (function(module, exports, __w_pdfjs_require__) {
  3436. var DESCRIPTORS = __w_pdfjs_require__(13);
  3437. var fails = __w_pdfjs_require__(14);
  3438. var has = __w_pdfjs_require__(23);
  3439. var defineProperty = Object.defineProperty;
  3440. var cache = {};
  3441. var thrower = function (it) {
  3442. throw it;
  3443. };
  3444. module.exports = function (METHOD_NAME, options) {
  3445. if (has(cache, METHOD_NAME))
  3446. return cache[METHOD_NAME];
  3447. if (!options)
  3448. options = {};
  3449. var method = [][METHOD_NAME];
  3450. var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
  3451. var argument0 = has(options, 0) ? options[0] : thrower;
  3452. var argument1 = has(options, 1) ? options[1] : undefined;
  3453. return cache[METHOD_NAME] = !!method && !fails(function () {
  3454. if (ACCESSORS && !DESCRIPTORS)
  3455. return true;
  3456. var O = { length: -1 };
  3457. if (ACCESSORS)
  3458. defineProperty(O, 1, {
  3459. enumerable: true,
  3460. get: thrower
  3461. });
  3462. else
  3463. O[1] = 1;
  3464. method.call(O, argument0, argument1);
  3465. });
  3466. };
  3467. /***/ }),
  3468. /* 76 */
  3469. /***/ (function(module, exports, __w_pdfjs_require__) {
  3470. __w_pdfjs_require__(77);
  3471. __w_pdfjs_require__(89);
  3472. var path = __w_pdfjs_require__(43);
  3473. module.exports = path.Array.from;
  3474. /***/ }),
  3475. /* 77 */
  3476. /***/ (function(module, exports, __w_pdfjs_require__) {
  3477. "use strict";
  3478. var charAt = __w_pdfjs_require__(78).charAt;
  3479. var InternalStateModule = __w_pdfjs_require__(33);
  3480. var defineIterator = __w_pdfjs_require__(79);
  3481. var STRING_ITERATOR = 'String Iterator';
  3482. var setInternalState = InternalStateModule.set;
  3483. var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
  3484. defineIterator(String, 'String', function (iterated) {
  3485. setInternalState(this, {
  3486. type: STRING_ITERATOR,
  3487. string: String(iterated),
  3488. index: 0
  3489. });
  3490. }, function next() {
  3491. var state = getInternalState(this);
  3492. var string = state.string;
  3493. var index = state.index;
  3494. var point;
  3495. if (index >= string.length)
  3496. return {
  3497. value: undefined,
  3498. done: true
  3499. };
  3500. point = charAt(string, index);
  3501. state.index += point.length;
  3502. return {
  3503. value: point,
  3504. done: false
  3505. };
  3506. });
  3507. /***/ }),
  3508. /* 78 */
  3509. /***/ (function(module, exports, __w_pdfjs_require__) {
  3510. var toInteger = __w_pdfjs_require__(48);
  3511. var requireObjectCoercible = __w_pdfjs_require__(20);
  3512. var createMethod = function (CONVERT_TO_STRING) {
  3513. return function ($this, pos) {
  3514. var S = String(requireObjectCoercible($this));
  3515. var position = toInteger(pos);
  3516. var size = S.length;
  3517. var first, second;
  3518. if (position < 0 || position >= size)
  3519. return CONVERT_TO_STRING ? '' : undefined;
  3520. first = S.charCodeAt(position);
  3521. return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  3522. };
  3523. };
  3524. module.exports = {
  3525. codeAt: createMethod(false),
  3526. charAt: createMethod(true)
  3527. };
  3528. /***/ }),
  3529. /* 79 */
  3530. /***/ (function(module, exports, __w_pdfjs_require__) {
  3531. "use strict";
  3532. var $ = __w_pdfjs_require__(10);
  3533. var createIteratorConstructor = __w_pdfjs_require__(80);
  3534. var getPrototypeOf = __w_pdfjs_require__(82);
  3535. var setPrototypeOf = __w_pdfjs_require__(87);
  3536. var setToStringTag = __w_pdfjs_require__(85);
  3537. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  3538. var redefine = __w_pdfjs_require__(29);
  3539. var wellKnownSymbol = __w_pdfjs_require__(57);
  3540. var IS_PURE = __w_pdfjs_require__(37);
  3541. var Iterators = __w_pdfjs_require__(86);
  3542. var IteratorsCore = __w_pdfjs_require__(81);
  3543. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3544. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3545. var ITERATOR = wellKnownSymbol('iterator');
  3546. var KEYS = 'keys';
  3547. var VALUES = 'values';
  3548. var ENTRIES = 'entries';
  3549. var returnThis = function () {
  3550. return this;
  3551. };
  3552. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3553. createIteratorConstructor(IteratorConstructor, NAME, next);
  3554. var getIterationMethod = function (KIND) {
  3555. if (KIND === DEFAULT && defaultIterator)
  3556. return defaultIterator;
  3557. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  3558. return IterablePrototype[KIND];
  3559. switch (KIND) {
  3560. case KEYS:
  3561. return function keys() {
  3562. return new IteratorConstructor(this, KIND);
  3563. };
  3564. case VALUES:
  3565. return function values() {
  3566. return new IteratorConstructor(this, KIND);
  3567. };
  3568. case ENTRIES:
  3569. return function entries() {
  3570. return new IteratorConstructor(this, KIND);
  3571. };
  3572. }
  3573. return function () {
  3574. return new IteratorConstructor(this);
  3575. };
  3576. };
  3577. var TO_STRING_TAG = NAME + ' Iterator';
  3578. var INCORRECT_VALUES_NAME = false;
  3579. var IterablePrototype = Iterable.prototype;
  3580. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  3581. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3582. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3583. var CurrentIteratorPrototype, methods, KEY;
  3584. if (anyNativeIterator) {
  3585. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3586. if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3587. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3588. if (setPrototypeOf) {
  3589. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3590. } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
  3591. createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
  3592. }
  3593. }
  3594. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3595. if (IS_PURE)
  3596. Iterators[TO_STRING_TAG] = returnThis;
  3597. }
  3598. }
  3599. if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3600. INCORRECT_VALUES_NAME = true;
  3601. defaultIterator = function values() {
  3602. return nativeIterator.call(this);
  3603. };
  3604. }
  3605. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3606. createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
  3607. }
  3608. Iterators[NAME] = defaultIterator;
  3609. if (DEFAULT) {
  3610. methods = {
  3611. values: getIterationMethod(VALUES),
  3612. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3613. entries: getIterationMethod(ENTRIES)
  3614. };
  3615. if (FORCED)
  3616. for (KEY in methods) {
  3617. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3618. redefine(IterablePrototype, KEY, methods[KEY]);
  3619. }
  3620. }
  3621. else
  3622. $({
  3623. target: NAME,
  3624. proto: true,
  3625. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  3626. }, methods);
  3627. }
  3628. return methods;
  3629. };
  3630. /***/ }),
  3631. /* 80 */
  3632. /***/ (function(module, exports, __w_pdfjs_require__) {
  3633. "use strict";
  3634. var IteratorPrototype = __w_pdfjs_require__(81).IteratorPrototype;
  3635. var create = __w_pdfjs_require__(71);
  3636. var createPropertyDescriptor = __w_pdfjs_require__(16);
  3637. var setToStringTag = __w_pdfjs_require__(85);
  3638. var Iterators = __w_pdfjs_require__(86);
  3639. var returnThis = function () {
  3640. return this;
  3641. };
  3642. module.exports = function (IteratorConstructor, NAME, next) {
  3643. var TO_STRING_TAG = NAME + ' Iterator';
  3644. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
  3645. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  3646. Iterators[TO_STRING_TAG] = returnThis;
  3647. return IteratorConstructor;
  3648. };
  3649. /***/ }),
  3650. /* 81 */
  3651. /***/ (function(module, exports, __w_pdfjs_require__) {
  3652. "use strict";
  3653. var getPrototypeOf = __w_pdfjs_require__(82);
  3654. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  3655. var has = __w_pdfjs_require__(23);
  3656. var wellKnownSymbol = __w_pdfjs_require__(57);
  3657. var IS_PURE = __w_pdfjs_require__(37);
  3658. var ITERATOR = wellKnownSymbol('iterator');
  3659. var BUGGY_SAFARI_ITERATORS = false;
  3660. var returnThis = function () {
  3661. return this;
  3662. };
  3663. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  3664. if ([].keys) {
  3665. arrayIterator = [].keys();
  3666. if (!('next' in arrayIterator))
  3667. BUGGY_SAFARI_ITERATORS = true;
  3668. else {
  3669. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  3670. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  3671. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  3672. }
  3673. }
  3674. if (IteratorPrototype == undefined)
  3675. IteratorPrototype = {};
  3676. if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
  3677. createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
  3678. }
  3679. module.exports = {
  3680. IteratorPrototype: IteratorPrototype,
  3681. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  3682. };
  3683. /***/ }),
  3684. /* 82 */
  3685. /***/ (function(module, exports, __w_pdfjs_require__) {
  3686. var has = __w_pdfjs_require__(23);
  3687. var toObject = __w_pdfjs_require__(83);
  3688. var sharedKey = __w_pdfjs_require__(35);
  3689. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(84);
  3690. var IE_PROTO = sharedKey('IE_PROTO');
  3691. var ObjectPrototype = Object.prototype;
  3692. module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  3693. O = toObject(O);
  3694. if (has(O, IE_PROTO))
  3695. return O[IE_PROTO];
  3696. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  3697. return O.constructor.prototype;
  3698. }
  3699. return O instanceof Object ? ObjectPrototype : null;
  3700. };
  3701. /***/ }),
  3702. /* 83 */
  3703. /***/ (function(module, exports, __w_pdfjs_require__) {
  3704. var requireObjectCoercible = __w_pdfjs_require__(20);
  3705. module.exports = function (argument) {
  3706. return Object(requireObjectCoercible(argument));
  3707. };
  3708. /***/ }),
  3709. /* 84 */
  3710. /***/ (function(module, exports, __w_pdfjs_require__) {
  3711. var fails = __w_pdfjs_require__(14);
  3712. module.exports = !fails(function () {
  3713. function F() {
  3714. }
  3715. F.prototype.constructor = null;
  3716. return Object.getPrototypeOf(new F()) !== F.prototype;
  3717. });
  3718. /***/ }),
  3719. /* 85 */
  3720. /***/ (function(module, exports, __w_pdfjs_require__) {
  3721. var defineProperty = __w_pdfjs_require__(27).f;
  3722. var has = __w_pdfjs_require__(23);
  3723. var wellKnownSymbol = __w_pdfjs_require__(57);
  3724. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3725. module.exports = function (it, TAG, STATIC) {
  3726. if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
  3727. defineProperty(it, TO_STRING_TAG, {
  3728. configurable: true,
  3729. value: TAG
  3730. });
  3731. }
  3732. };
  3733. /***/ }),
  3734. /* 86 */
  3735. /***/ (function(module, exports) {
  3736. module.exports = {};
  3737. /***/ }),
  3738. /* 87 */
  3739. /***/ (function(module, exports, __w_pdfjs_require__) {
  3740. var anObject = __w_pdfjs_require__(28);
  3741. var aPossiblePrototype = __w_pdfjs_require__(88);
  3742. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  3743. var CORRECT_SETTER = false;
  3744. var test = {};
  3745. var setter;
  3746. try {
  3747. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  3748. setter.call(test, []);
  3749. CORRECT_SETTER = test instanceof Array;
  3750. } catch (error) {
  3751. }
  3752. return function setPrototypeOf(O, proto) {
  3753. anObject(O);
  3754. aPossiblePrototype(proto);
  3755. if (CORRECT_SETTER)
  3756. setter.call(O, proto);
  3757. else
  3758. O.__proto__ = proto;
  3759. return O;
  3760. };
  3761. }() : undefined);
  3762. /***/ }),
  3763. /* 88 */
  3764. /***/ (function(module, exports, __w_pdfjs_require__) {
  3765. var isObject = __w_pdfjs_require__(22);
  3766. module.exports = function (it) {
  3767. if (!isObject(it) && it !== null) {
  3768. throw TypeError("Can't set " + String(it) + ' as a prototype');
  3769. }
  3770. return it;
  3771. };
  3772. /***/ }),
  3773. /* 89 */
  3774. /***/ (function(module, exports, __w_pdfjs_require__) {
  3775. var $ = __w_pdfjs_require__(10);
  3776. var from = __w_pdfjs_require__(90);
  3777. var checkCorrectnessOfIteration = __w_pdfjs_require__(97);
  3778. var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
  3779. Array.from(iterable);
  3780. });
  3781. $({
  3782. target: 'Array',
  3783. stat: true,
  3784. forced: INCORRECT_ITERATION
  3785. }, { from: from });
  3786. /***/ }),
  3787. /* 90 */
  3788. /***/ (function(module, exports, __w_pdfjs_require__) {
  3789. "use strict";
  3790. var bind = __w_pdfjs_require__(62);
  3791. var toObject = __w_pdfjs_require__(83);
  3792. var callWithSafeIterationClosing = __w_pdfjs_require__(91);
  3793. var isArrayIteratorMethod = __w_pdfjs_require__(92);
  3794. var toLength = __w_pdfjs_require__(47);
  3795. var createProperty = __w_pdfjs_require__(93);
  3796. var getIteratorMethod = __w_pdfjs_require__(94);
  3797. module.exports = function from(arrayLike) {
  3798. var O = toObject(arrayLike);
  3799. var C = typeof this == 'function' ? this : Array;
  3800. var argumentsLength = arguments.length;
  3801. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  3802. var mapping = mapfn !== undefined;
  3803. var iteratorMethod = getIteratorMethod(O);
  3804. var index = 0;
  3805. var length, result, step, iterator, next, value;
  3806. if (mapping)
  3807. mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
  3808. if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
  3809. iterator = iteratorMethod.call(O);
  3810. next = iterator.next;
  3811. result = new C();
  3812. for (; !(step = next.call(iterator)).done; index++) {
  3813. value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [
  3814. step.value,
  3815. index
  3816. ], true) : step.value;
  3817. createProperty(result, index, value);
  3818. }
  3819. } else {
  3820. length = toLength(O.length);
  3821. result = new C(length);
  3822. for (; length > index; index++) {
  3823. value = mapping ? mapfn(O[index], index) : O[index];
  3824. createProperty(result, index, value);
  3825. }
  3826. }
  3827. result.length = index;
  3828. return result;
  3829. };
  3830. /***/ }),
  3831. /* 91 */
  3832. /***/ (function(module, exports, __w_pdfjs_require__) {
  3833. var anObject = __w_pdfjs_require__(28);
  3834. module.exports = function (iterator, fn, value, ENTRIES) {
  3835. try {
  3836. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  3837. } catch (error) {
  3838. var returnMethod = iterator['return'];
  3839. if (returnMethod !== undefined)
  3840. anObject(returnMethod.call(iterator));
  3841. throw error;
  3842. }
  3843. };
  3844. /***/ }),
  3845. /* 92 */
  3846. /***/ (function(module, exports, __w_pdfjs_require__) {
  3847. var wellKnownSymbol = __w_pdfjs_require__(57);
  3848. var Iterators = __w_pdfjs_require__(86);
  3849. var ITERATOR = wellKnownSymbol('iterator');
  3850. var ArrayPrototype = Array.prototype;
  3851. module.exports = function (it) {
  3852. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  3853. };
  3854. /***/ }),
  3855. /* 93 */
  3856. /***/ (function(module, exports, __w_pdfjs_require__) {
  3857. "use strict";
  3858. var toPrimitive = __w_pdfjs_require__(21);
  3859. var definePropertyModule = __w_pdfjs_require__(27);
  3860. var createPropertyDescriptor = __w_pdfjs_require__(16);
  3861. module.exports = function (object, key, value) {
  3862. var propertyKey = toPrimitive(key);
  3863. if (propertyKey in object)
  3864. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3865. else
  3866. object[propertyKey] = value;
  3867. };
  3868. /***/ }),
  3869. /* 94 */
  3870. /***/ (function(module, exports, __w_pdfjs_require__) {
  3871. var classof = __w_pdfjs_require__(95);
  3872. var Iterators = __w_pdfjs_require__(86);
  3873. var wellKnownSymbol = __w_pdfjs_require__(57);
  3874. var ITERATOR = wellKnownSymbol('iterator');
  3875. module.exports = function (it) {
  3876. if (it != undefined)
  3877. return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
  3878. };
  3879. /***/ }),
  3880. /* 95 */
  3881. /***/ (function(module, exports, __w_pdfjs_require__) {
  3882. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96);
  3883. var classofRaw = __w_pdfjs_require__(19);
  3884. var wellKnownSymbol = __w_pdfjs_require__(57);
  3885. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3886. var CORRECT_ARGUMENTS = classofRaw(function () {
  3887. return arguments;
  3888. }()) == 'Arguments';
  3889. var tryGet = function (it, key) {
  3890. try {
  3891. return it[key];
  3892. } catch (error) {
  3893. }
  3894. };
  3895. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  3896. var O, tag, result;
  3897. 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' && typeof O.callee == 'function' ? 'Arguments' : result;
  3898. };
  3899. /***/ }),
  3900. /* 96 */
  3901. /***/ (function(module, exports, __w_pdfjs_require__) {
  3902. var wellKnownSymbol = __w_pdfjs_require__(57);
  3903. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3904. var test = {};
  3905. test[TO_STRING_TAG] = 'z';
  3906. module.exports = String(test) === '[object z]';
  3907. /***/ }),
  3908. /* 97 */
  3909. /***/ (function(module, exports, __w_pdfjs_require__) {
  3910. var wellKnownSymbol = __w_pdfjs_require__(57);
  3911. var ITERATOR = wellKnownSymbol('iterator');
  3912. var SAFE_CLOSING = false;
  3913. try {
  3914. var called = 0;
  3915. var iteratorWithReturn = {
  3916. next: function () {
  3917. return { done: !!called++ };
  3918. },
  3919. 'return': function () {
  3920. SAFE_CLOSING = true;
  3921. }
  3922. };
  3923. iteratorWithReturn[ITERATOR] = function () {
  3924. return this;
  3925. };
  3926. Array.from(iteratorWithReturn, function () {
  3927. throw 2;
  3928. });
  3929. } catch (error) {
  3930. }
  3931. module.exports = function (exec, SKIP_CLOSING) {
  3932. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3933. return false;
  3934. var ITERATION_SUPPORT = false;
  3935. try {
  3936. var object = {};
  3937. object[ITERATOR] = function () {
  3938. return {
  3939. next: function () {
  3940. return { done: ITERATION_SUPPORT = true };
  3941. }
  3942. };
  3943. };
  3944. exec(object);
  3945. } catch (error) {
  3946. }
  3947. return ITERATION_SUPPORT;
  3948. };
  3949. /***/ }),
  3950. /* 98 */
  3951. /***/ (function(module, exports, __w_pdfjs_require__) {
  3952. __w_pdfjs_require__(99);
  3953. var path = __w_pdfjs_require__(43);
  3954. module.exports = path.Object.assign;
  3955. /***/ }),
  3956. /* 99 */
  3957. /***/ (function(module, exports, __w_pdfjs_require__) {
  3958. var $ = __w_pdfjs_require__(10);
  3959. var assign = __w_pdfjs_require__(100);
  3960. $({
  3961. target: 'Object',
  3962. stat: true,
  3963. forced: Object.assign !== assign
  3964. }, { assign: assign });
  3965. /***/ }),
  3966. /* 100 */
  3967. /***/ (function(module, exports, __w_pdfjs_require__) {
  3968. "use strict";
  3969. var DESCRIPTORS = __w_pdfjs_require__(13);
  3970. var fails = __w_pdfjs_require__(14);
  3971. var objectKeys = __w_pdfjs_require__(73);
  3972. var getOwnPropertySymbolsModule = __w_pdfjs_require__(51);
  3973. var propertyIsEnumerableModule = __w_pdfjs_require__(15);
  3974. var toObject = __w_pdfjs_require__(83);
  3975. var IndexedObject = __w_pdfjs_require__(18);
  3976. var nativeAssign = Object.assign;
  3977. var defineProperty = Object.defineProperty;
  3978. module.exports = !nativeAssign || fails(function () {
  3979. if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
  3980. enumerable: true,
  3981. get: function () {
  3982. defineProperty(this, 'b', {
  3983. value: 3,
  3984. enumerable: false
  3985. });
  3986. }
  3987. }), { b: 2 })).b !== 1)
  3988. return true;
  3989. var A = {};
  3990. var B = {};
  3991. var symbol = Symbol();
  3992. var alphabet = 'abcdefghijklmnopqrst';
  3993. A[symbol] = 7;
  3994. alphabet.split('').forEach(function (chr) {
  3995. B[chr] = chr;
  3996. });
  3997. return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
  3998. }) ? function assign(target, source) {
  3999. var T = toObject(target);
  4000. var argumentsLength = arguments.length;
  4001. var index = 1;
  4002. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  4003. var propertyIsEnumerable = propertyIsEnumerableModule.f;
  4004. while (argumentsLength > index) {
  4005. var S = IndexedObject(arguments[index++]);
  4006. var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
  4007. var length = keys.length;
  4008. var j = 0;
  4009. var key;
  4010. while (length > j) {
  4011. key = keys[j++];
  4012. if (!DESCRIPTORS || propertyIsEnumerable.call(S, key))
  4013. T[key] = S[key];
  4014. }
  4015. }
  4016. return T;
  4017. } : nativeAssign;
  4018. /***/ }),
  4019. /* 101 */
  4020. /***/ (function(module, exports, __w_pdfjs_require__) {
  4021. __w_pdfjs_require__(102);
  4022. var path = __w_pdfjs_require__(43);
  4023. module.exports = path.Math.log2;
  4024. /***/ }),
  4025. /* 102 */
  4026. /***/ (function(module, exports, __w_pdfjs_require__) {
  4027. var $ = __w_pdfjs_require__(10);
  4028. var log = Math.log;
  4029. var LN2 = Math.LN2;
  4030. $({
  4031. target: 'Math',
  4032. stat: true
  4033. }, {
  4034. log2: function log2(x) {
  4035. return log(x) / LN2;
  4036. }
  4037. });
  4038. /***/ }),
  4039. /* 103 */
  4040. /***/ (function(module, exports, __w_pdfjs_require__) {
  4041. __w_pdfjs_require__(104);
  4042. var path = __w_pdfjs_require__(43);
  4043. module.exports = path.Number.isNaN;
  4044. /***/ }),
  4045. /* 104 */
  4046. /***/ (function(module, exports, __w_pdfjs_require__) {
  4047. var $ = __w_pdfjs_require__(10);
  4048. $({
  4049. target: 'Number',
  4050. stat: true
  4051. }, {
  4052. isNaN: function isNaN(number) {
  4053. return number != number;
  4054. }
  4055. });
  4056. /***/ }),
  4057. /* 105 */
  4058. /***/ (function(module, exports, __w_pdfjs_require__) {
  4059. __w_pdfjs_require__(106);
  4060. var path = __w_pdfjs_require__(43);
  4061. module.exports = path.Number.isInteger;
  4062. /***/ }),
  4063. /* 106 */
  4064. /***/ (function(module, exports, __w_pdfjs_require__) {
  4065. var $ = __w_pdfjs_require__(10);
  4066. var isInteger = __w_pdfjs_require__(107);
  4067. $({
  4068. target: 'Number',
  4069. stat: true
  4070. }, { isInteger: isInteger });
  4071. /***/ }),
  4072. /* 107 */
  4073. /***/ (function(module, exports, __w_pdfjs_require__) {
  4074. var isObject = __w_pdfjs_require__(22);
  4075. var floor = Math.floor;
  4076. module.exports = function isInteger(it) {
  4077. return !isObject(it) && isFinite(it) && floor(it) === it;
  4078. };
  4079. /***/ }),
  4080. /* 108 */
  4081. /***/ (function(module, exports, __w_pdfjs_require__) {
  4082. __w_pdfjs_require__(109);
  4083. /***/ }),
  4084. /* 109 */
  4085. /***/ (function(module, exports, __w_pdfjs_require__) {
  4086. "use strict";
  4087. var ArrayBufferViewCore = __w_pdfjs_require__(110);
  4088. var speciesConstructor = __w_pdfjs_require__(112);
  4089. var fails = __w_pdfjs_require__(14);
  4090. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  4091. var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
  4092. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  4093. var $slice = [].slice;
  4094. var FORCED = fails(function () {
  4095. new Int8Array(1).slice();
  4096. });
  4097. exportTypedArrayMethod('slice', function slice(start, end) {
  4098. var list = $slice.call(aTypedArray(this), start, end);
  4099. var C = speciesConstructor(this, this.constructor);
  4100. var index = 0;
  4101. var length = list.length;
  4102. var result = new (aTypedArrayConstructor(C))(length);
  4103. while (length > index)
  4104. result[index] = list[index++];
  4105. return result;
  4106. }, FORCED);
  4107. /***/ }),
  4108. /* 110 */
  4109. /***/ (function(module, exports, __w_pdfjs_require__) {
  4110. "use strict";
  4111. var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(111);
  4112. var DESCRIPTORS = __w_pdfjs_require__(13);
  4113. var global = __w_pdfjs_require__(11);
  4114. var isObject = __w_pdfjs_require__(22);
  4115. var has = __w_pdfjs_require__(23);
  4116. var classof = __w_pdfjs_require__(95);
  4117. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  4118. var redefine = __w_pdfjs_require__(29);
  4119. var defineProperty = __w_pdfjs_require__(27).f;
  4120. var getPrototypeOf = __w_pdfjs_require__(82);
  4121. var setPrototypeOf = __w_pdfjs_require__(87);
  4122. var wellKnownSymbol = __w_pdfjs_require__(57);
  4123. var uid = __w_pdfjs_require__(38);
  4124. var Int8Array = global.Int8Array;
  4125. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  4126. var Uint8ClampedArray = global.Uint8ClampedArray;
  4127. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  4128. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  4129. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  4130. var ObjectPrototype = Object.prototype;
  4131. var isPrototypeOf = ObjectPrototype.isPrototypeOf;
  4132. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  4133. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  4134. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  4135. var TYPED_ARRAY_TAG_REQIRED = false;
  4136. var NAME;
  4137. var TypedArrayConstructorsList = {
  4138. Int8Array: 1,
  4139. Uint8Array: 1,
  4140. Uint8ClampedArray: 1,
  4141. Int16Array: 2,
  4142. Uint16Array: 2,
  4143. Int32Array: 4,
  4144. Uint32Array: 4,
  4145. Float32Array: 4,
  4146. Float64Array: 8
  4147. };
  4148. var isView = function isView(it) {
  4149. var klass = classof(it);
  4150. return klass === 'DataView' || has(TypedArrayConstructorsList, klass);
  4151. };
  4152. var isTypedArray = function (it) {
  4153. return isObject(it) && has(TypedArrayConstructorsList, classof(it));
  4154. };
  4155. var aTypedArray = function (it) {
  4156. if (isTypedArray(it))
  4157. return it;
  4158. throw TypeError('Target is not a typed array');
  4159. };
  4160. var aTypedArrayConstructor = function (C) {
  4161. if (setPrototypeOf) {
  4162. if (isPrototypeOf.call(TypedArray, C))
  4163. return C;
  4164. } else
  4165. for (var ARRAY in TypedArrayConstructorsList)
  4166. if (has(TypedArrayConstructorsList, NAME)) {
  4167. var TypedArrayConstructor = global[ARRAY];
  4168. if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) {
  4169. return C;
  4170. }
  4171. }
  4172. throw TypeError('Target is not a typed array constructor');
  4173. };
  4174. var exportTypedArrayMethod = function (KEY, property, forced) {
  4175. if (!DESCRIPTORS)
  4176. return;
  4177. if (forced)
  4178. for (var ARRAY in TypedArrayConstructorsList) {
  4179. var TypedArrayConstructor = global[ARRAY];
  4180. if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) {
  4181. delete TypedArrayConstructor.prototype[KEY];
  4182. }
  4183. }
  4184. if (!TypedArrayPrototype[KEY] || forced) {
  4185. redefine(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
  4186. }
  4187. };
  4188. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  4189. var ARRAY, TypedArrayConstructor;
  4190. if (!DESCRIPTORS)
  4191. return;
  4192. if (setPrototypeOf) {
  4193. if (forced)
  4194. for (ARRAY in TypedArrayConstructorsList) {
  4195. TypedArrayConstructor = global[ARRAY];
  4196. if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
  4197. delete TypedArrayConstructor[KEY];
  4198. }
  4199. }
  4200. if (!TypedArray[KEY] || forced) {
  4201. try {
  4202. return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property);
  4203. } catch (error) {
  4204. }
  4205. } else
  4206. return;
  4207. }
  4208. for (ARRAY in TypedArrayConstructorsList) {
  4209. TypedArrayConstructor = global[ARRAY];
  4210. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  4211. redefine(TypedArrayConstructor, KEY, property);
  4212. }
  4213. }
  4214. };
  4215. for (NAME in TypedArrayConstructorsList) {
  4216. if (!global[NAME])
  4217. NATIVE_ARRAY_BUFFER_VIEWS = false;
  4218. }
  4219. if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) {
  4220. TypedArray = function TypedArray() {
  4221. throw TypeError('Incorrect invocation');
  4222. };
  4223. if (NATIVE_ARRAY_BUFFER_VIEWS)
  4224. for (NAME in TypedArrayConstructorsList) {
  4225. if (global[NAME])
  4226. setPrototypeOf(global[NAME], TypedArray);
  4227. }
  4228. }
  4229. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  4230. TypedArrayPrototype = TypedArray.prototype;
  4231. if (NATIVE_ARRAY_BUFFER_VIEWS)
  4232. for (NAME in TypedArrayConstructorsList) {
  4233. if (global[NAME])
  4234. setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  4235. }
  4236. }
  4237. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  4238. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  4239. }
  4240. if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
  4241. TYPED_ARRAY_TAG_REQIRED = true;
  4242. defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
  4243. get: function () {
  4244. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  4245. }
  4246. });
  4247. for (NAME in TypedArrayConstructorsList)
  4248. if (global[NAME]) {
  4249. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  4250. }
  4251. }
  4252. module.exports = {
  4253. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  4254. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
  4255. aTypedArray: aTypedArray,
  4256. aTypedArrayConstructor: aTypedArrayConstructor,
  4257. exportTypedArrayMethod: exportTypedArrayMethod,
  4258. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  4259. isView: isView,
  4260. isTypedArray: isTypedArray,
  4261. TypedArray: TypedArray,
  4262. TypedArrayPrototype: TypedArrayPrototype
  4263. };
  4264. /***/ }),
  4265. /* 111 */
  4266. /***/ (function(module, exports) {
  4267. module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
  4268. /***/ }),
  4269. /* 112 */
  4270. /***/ (function(module, exports, __w_pdfjs_require__) {
  4271. var anObject = __w_pdfjs_require__(28);
  4272. var aFunction = __w_pdfjs_require__(63);
  4273. var wellKnownSymbol = __w_pdfjs_require__(57);
  4274. var SPECIES = wellKnownSymbol('species');
  4275. module.exports = function (O, defaultConstructor) {
  4276. var C = anObject(O).constructor;
  4277. var S;
  4278. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
  4279. };
  4280. /***/ }),
  4281. /* 113 */
  4282. /***/ (function(module, exports, __w_pdfjs_require__) {
  4283. __w_pdfjs_require__(114);
  4284. __w_pdfjs_require__(77);
  4285. __w_pdfjs_require__(116);
  4286. __w_pdfjs_require__(119);
  4287. __w_pdfjs_require__(134);
  4288. __w_pdfjs_require__(135);
  4289. var path = __w_pdfjs_require__(43);
  4290. module.exports = path.Promise;
  4291. /***/ }),
  4292. /* 114 */
  4293. /***/ (function(module, exports, __w_pdfjs_require__) {
  4294. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96);
  4295. var redefine = __w_pdfjs_require__(29);
  4296. var toString = __w_pdfjs_require__(115);
  4297. if (!TO_STRING_TAG_SUPPORT) {
  4298. redefine(Object.prototype, 'toString', toString, { unsafe: true });
  4299. }
  4300. /***/ }),
  4301. /* 115 */
  4302. /***/ (function(module, exports, __w_pdfjs_require__) {
  4303. "use strict";
  4304. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(96);
  4305. var classof = __w_pdfjs_require__(95);
  4306. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  4307. return '[object ' + classof(this) + ']';
  4308. };
  4309. /***/ }),
  4310. /* 116 */
  4311. /***/ (function(module, exports, __w_pdfjs_require__) {
  4312. var global = __w_pdfjs_require__(11);
  4313. var DOMIterables = __w_pdfjs_require__(117);
  4314. var ArrayIteratorMethods = __w_pdfjs_require__(118);
  4315. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  4316. var wellKnownSymbol = __w_pdfjs_require__(57);
  4317. var ITERATOR = wellKnownSymbol('iterator');
  4318. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  4319. var ArrayValues = ArrayIteratorMethods.values;
  4320. for (var COLLECTION_NAME in DOMIterables) {
  4321. var Collection = global[COLLECTION_NAME];
  4322. var CollectionPrototype = Collection && Collection.prototype;
  4323. if (CollectionPrototype) {
  4324. if (CollectionPrototype[ITERATOR] !== ArrayValues)
  4325. try {
  4326. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  4327. } catch (error) {
  4328. CollectionPrototype[ITERATOR] = ArrayValues;
  4329. }
  4330. if (!CollectionPrototype[TO_STRING_TAG]) {
  4331. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  4332. }
  4333. if (DOMIterables[COLLECTION_NAME])
  4334. for (var METHOD_NAME in ArrayIteratorMethods) {
  4335. if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME])
  4336. try {
  4337. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
  4338. } catch (error) {
  4339. CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
  4340. }
  4341. }
  4342. }
  4343. }
  4344. /***/ }),
  4345. /* 117 */
  4346. /***/ (function(module, exports) {
  4347. module.exports = {
  4348. CSSRuleList: 0,
  4349. CSSStyleDeclaration: 0,
  4350. CSSValueList: 0,
  4351. ClientRectList: 0,
  4352. DOMRectList: 0,
  4353. DOMStringList: 0,
  4354. DOMTokenList: 1,
  4355. DataTransferItemList: 0,
  4356. FileList: 0,
  4357. HTMLAllCollection: 0,
  4358. HTMLCollection: 0,
  4359. HTMLFormElement: 0,
  4360. HTMLSelectElement: 0,
  4361. MediaList: 0,
  4362. MimeTypeArray: 0,
  4363. NamedNodeMap: 0,
  4364. NodeList: 1,
  4365. PaintRequestList: 0,
  4366. Plugin: 0,
  4367. PluginArray: 0,
  4368. SVGLengthList: 0,
  4369. SVGNumberList: 0,
  4370. SVGPathSegList: 0,
  4371. SVGPointList: 0,
  4372. SVGStringList: 0,
  4373. SVGTransformList: 0,
  4374. SourceBufferList: 0,
  4375. StyleSheetList: 0,
  4376. TextTrackCueList: 0,
  4377. TextTrackList: 0,
  4378. TouchList: 0
  4379. };
  4380. /***/ }),
  4381. /* 118 */
  4382. /***/ (function(module, exports, __w_pdfjs_require__) {
  4383. "use strict";
  4384. var toIndexedObject = __w_pdfjs_require__(17);
  4385. var addToUnscopables = __w_pdfjs_require__(70);
  4386. var Iterators = __w_pdfjs_require__(86);
  4387. var InternalStateModule = __w_pdfjs_require__(33);
  4388. var defineIterator = __w_pdfjs_require__(79);
  4389. var ARRAY_ITERATOR = 'Array Iterator';
  4390. var setInternalState = InternalStateModule.set;
  4391. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  4392. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  4393. setInternalState(this, {
  4394. type: ARRAY_ITERATOR,
  4395. target: toIndexedObject(iterated),
  4396. index: 0,
  4397. kind: kind
  4398. });
  4399. }, function () {
  4400. var state = getInternalState(this);
  4401. var target = state.target;
  4402. var kind = state.kind;
  4403. var index = state.index++;
  4404. if (!target || index >= target.length) {
  4405. state.target = undefined;
  4406. return {
  4407. value: undefined,
  4408. done: true
  4409. };
  4410. }
  4411. if (kind == 'keys')
  4412. return {
  4413. value: index,
  4414. done: false
  4415. };
  4416. if (kind == 'values')
  4417. return {
  4418. value: target[index],
  4419. done: false
  4420. };
  4421. return {
  4422. value: [
  4423. index,
  4424. target[index]
  4425. ],
  4426. done: false
  4427. };
  4428. }, 'values');
  4429. Iterators.Arguments = Iterators.Array;
  4430. addToUnscopables('keys');
  4431. addToUnscopables('values');
  4432. addToUnscopables('entries');
  4433. /***/ }),
  4434. /* 119 */
  4435. /***/ (function(module, exports, __w_pdfjs_require__) {
  4436. "use strict";
  4437. var $ = __w_pdfjs_require__(10);
  4438. var IS_PURE = __w_pdfjs_require__(37);
  4439. var global = __w_pdfjs_require__(11);
  4440. var getBuiltIn = __w_pdfjs_require__(42);
  4441. var NativePromise = __w_pdfjs_require__(120);
  4442. var redefine = __w_pdfjs_require__(29);
  4443. var redefineAll = __w_pdfjs_require__(121);
  4444. var setToStringTag = __w_pdfjs_require__(85);
  4445. var setSpecies = __w_pdfjs_require__(122);
  4446. var isObject = __w_pdfjs_require__(22);
  4447. var aFunction = __w_pdfjs_require__(63);
  4448. var anInstance = __w_pdfjs_require__(123);
  4449. var classof = __w_pdfjs_require__(19);
  4450. var inspectSource = __w_pdfjs_require__(31);
  4451. var iterate = __w_pdfjs_require__(124);
  4452. var checkCorrectnessOfIteration = __w_pdfjs_require__(97);
  4453. var speciesConstructor = __w_pdfjs_require__(112);
  4454. var task = __w_pdfjs_require__(125).set;
  4455. var microtask = __w_pdfjs_require__(128);
  4456. var promiseResolve = __w_pdfjs_require__(129);
  4457. var hostReportErrors = __w_pdfjs_require__(131);
  4458. var newPromiseCapabilityModule = __w_pdfjs_require__(130);
  4459. var perform = __w_pdfjs_require__(132);
  4460. var InternalStateModule = __w_pdfjs_require__(33);
  4461. var isForced = __w_pdfjs_require__(52);
  4462. var wellKnownSymbol = __w_pdfjs_require__(57);
  4463. var V8_VERSION = __w_pdfjs_require__(133);
  4464. var SPECIES = wellKnownSymbol('species');
  4465. var PROMISE = 'Promise';
  4466. var getInternalState = InternalStateModule.get;
  4467. var setInternalState = InternalStateModule.set;
  4468. var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
  4469. var PromiseConstructor = NativePromise;
  4470. var TypeError = global.TypeError;
  4471. var document = global.document;
  4472. var process = global.process;
  4473. var $fetch = getBuiltIn('fetch');
  4474. var newPromiseCapability = newPromiseCapabilityModule.f;
  4475. var newGenericPromiseCapability = newPromiseCapability;
  4476. var IS_NODE = classof(process) == 'process';
  4477. var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
  4478. var UNHANDLED_REJECTION = 'unhandledrejection';
  4479. var REJECTION_HANDLED = 'rejectionhandled';
  4480. var PENDING = 0;
  4481. var FULFILLED = 1;
  4482. var REJECTED = 2;
  4483. var HANDLED = 1;
  4484. var UNHANDLED = 2;
  4485. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  4486. var FORCED = isForced(PROMISE, function () {
  4487. var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
  4488. if (!GLOBAL_CORE_JS_PROMISE) {
  4489. if (V8_VERSION === 66)
  4490. return true;
  4491. if (!IS_NODE && typeof PromiseRejectionEvent != 'function')
  4492. return true;
  4493. }
  4494. if (IS_PURE && !PromiseConstructor.prototype['finally'])
  4495. return true;
  4496. if (V8_VERSION >= 51 && /native code/.test(PromiseConstructor))
  4497. return false;
  4498. var promise = PromiseConstructor.resolve(1);
  4499. var FakePromise = function (exec) {
  4500. exec(function () {
  4501. }, function () {
  4502. });
  4503. };
  4504. var constructor = promise.constructor = {};
  4505. constructor[SPECIES] = FakePromise;
  4506. return !(promise.then(function () {
  4507. }) instanceof FakePromise);
  4508. });
  4509. var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
  4510. PromiseConstructor.all(iterable)['catch'](function () {
  4511. });
  4512. });
  4513. var isThenable = function (it) {
  4514. var then;
  4515. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  4516. };
  4517. var notify = function (promise, state, isReject) {
  4518. if (state.notified)
  4519. return;
  4520. state.notified = true;
  4521. var chain = state.reactions;
  4522. microtask(function () {
  4523. var value = state.value;
  4524. var ok = state.state == FULFILLED;
  4525. var index = 0;
  4526. while (chain.length > index) {
  4527. var reaction = chain[index++];
  4528. var handler = ok ? reaction.ok : reaction.fail;
  4529. var resolve = reaction.resolve;
  4530. var reject = reaction.reject;
  4531. var domain = reaction.domain;
  4532. var result, then, exited;
  4533. try {
  4534. if (handler) {
  4535. if (!ok) {
  4536. if (state.rejection === UNHANDLED)
  4537. onHandleUnhandled(promise, state);
  4538. state.rejection = HANDLED;
  4539. }
  4540. if (handler === true)
  4541. result = value;
  4542. else {
  4543. if (domain)
  4544. domain.enter();
  4545. result = handler(value);
  4546. if (domain) {
  4547. domain.exit();
  4548. exited = true;
  4549. }
  4550. }
  4551. if (result === reaction.promise) {
  4552. reject(TypeError('Promise-chain cycle'));
  4553. } else if (then = isThenable(result)) {
  4554. then.call(result, resolve, reject);
  4555. } else
  4556. resolve(result);
  4557. } else
  4558. reject(value);
  4559. } catch (error) {
  4560. if (domain && !exited)
  4561. domain.exit();
  4562. reject(error);
  4563. }
  4564. }
  4565. state.reactions = [];
  4566. state.notified = false;
  4567. if (isReject && !state.rejection)
  4568. onUnhandled(promise, state);
  4569. });
  4570. };
  4571. var dispatchEvent = function (name, promise, reason) {
  4572. var event, handler;
  4573. if (DISPATCH_EVENT) {
  4574. event = document.createEvent('Event');
  4575. event.promise = promise;
  4576. event.reason = reason;
  4577. event.initEvent(name, false, true);
  4578. global.dispatchEvent(event);
  4579. } else
  4580. event = {
  4581. promise: promise,
  4582. reason: reason
  4583. };
  4584. if (handler = global['on' + name])
  4585. handler(event);
  4586. else if (name === UNHANDLED_REJECTION)
  4587. hostReportErrors('Unhandled promise rejection', reason);
  4588. };
  4589. var onUnhandled = function (promise, state) {
  4590. task.call(global, function () {
  4591. var value = state.value;
  4592. var IS_UNHANDLED = isUnhandled(state);
  4593. var result;
  4594. if (IS_UNHANDLED) {
  4595. result = perform(function () {
  4596. if (IS_NODE) {
  4597. process.emit('unhandledRejection', value, promise);
  4598. } else
  4599. dispatchEvent(UNHANDLED_REJECTION, promise, value);
  4600. });
  4601. state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
  4602. if (result.error)
  4603. throw result.value;
  4604. }
  4605. });
  4606. };
  4607. var isUnhandled = function (state) {
  4608. return state.rejection !== HANDLED && !state.parent;
  4609. };
  4610. var onHandleUnhandled = function (promise, state) {
  4611. task.call(global, function () {
  4612. if (IS_NODE) {
  4613. process.emit('rejectionHandled', promise);
  4614. } else
  4615. dispatchEvent(REJECTION_HANDLED, promise, state.value);
  4616. });
  4617. };
  4618. var bind = function (fn, promise, state, unwrap) {
  4619. return function (value) {
  4620. fn(promise, state, value, unwrap);
  4621. };
  4622. };
  4623. var internalReject = function (promise, state, value, unwrap) {
  4624. if (state.done)
  4625. return;
  4626. state.done = true;
  4627. if (unwrap)
  4628. state = unwrap;
  4629. state.value = value;
  4630. state.state = REJECTED;
  4631. notify(promise, state, true);
  4632. };
  4633. var internalResolve = function (promise, state, value, unwrap) {
  4634. if (state.done)
  4635. return;
  4636. state.done = true;
  4637. if (unwrap)
  4638. state = unwrap;
  4639. try {
  4640. if (promise === value)
  4641. throw TypeError("Promise can't be resolved itself");
  4642. var then = isThenable(value);
  4643. if (then) {
  4644. microtask(function () {
  4645. var wrapper = { done: false };
  4646. try {
  4647. then.call(value, bind(internalResolve, promise, wrapper, state), bind(internalReject, promise, wrapper, state));
  4648. } catch (error) {
  4649. internalReject(promise, wrapper, error, state);
  4650. }
  4651. });
  4652. } else {
  4653. state.value = value;
  4654. state.state = FULFILLED;
  4655. notify(promise, state, false);
  4656. }
  4657. } catch (error) {
  4658. internalReject(promise, { done: false }, error, state);
  4659. }
  4660. };
  4661. if (FORCED) {
  4662. PromiseConstructor = function Promise(executor) {
  4663. anInstance(this, PromiseConstructor, PROMISE);
  4664. aFunction(executor);
  4665. Internal.call(this);
  4666. var state = getInternalState(this);
  4667. try {
  4668. executor(bind(internalResolve, this, state), bind(internalReject, this, state));
  4669. } catch (error) {
  4670. internalReject(this, state, error);
  4671. }
  4672. };
  4673. Internal = function Promise(executor) {
  4674. setInternalState(this, {
  4675. type: PROMISE,
  4676. done: false,
  4677. notified: false,
  4678. parent: false,
  4679. reactions: [],
  4680. rejection: false,
  4681. state: PENDING,
  4682. value: undefined
  4683. });
  4684. };
  4685. Internal.prototype = redefineAll(PromiseConstructor.prototype, {
  4686. then: function then(onFulfilled, onRejected) {
  4687. var state = getInternalPromiseState(this);
  4688. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  4689. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  4690. reaction.fail = typeof onRejected == 'function' && onRejected;
  4691. reaction.domain = IS_NODE ? process.domain : undefined;
  4692. state.parent = true;
  4693. state.reactions.push(reaction);
  4694. if (state.state != PENDING)
  4695. notify(this, state, false);
  4696. return reaction.promise;
  4697. },
  4698. 'catch': function (onRejected) {
  4699. return this.then(undefined, onRejected);
  4700. }
  4701. });
  4702. OwnPromiseCapability = function () {
  4703. var promise = new Internal();
  4704. var state = getInternalState(promise);
  4705. this.promise = promise;
  4706. this.resolve = bind(internalResolve, promise, state);
  4707. this.reject = bind(internalReject, promise, state);
  4708. };
  4709. newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
  4710. return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
  4711. };
  4712. if (!IS_PURE && typeof NativePromise == 'function') {
  4713. nativeThen = NativePromise.prototype.then;
  4714. redefine(NativePromise.prototype, 'then', function then(onFulfilled, onRejected) {
  4715. var that = this;
  4716. return new PromiseConstructor(function (resolve, reject) {
  4717. nativeThen.call(that, resolve, reject);
  4718. }).then(onFulfilled, onRejected);
  4719. }, { unsafe: true });
  4720. if (typeof $fetch == 'function')
  4721. $({
  4722. global: true,
  4723. enumerable: true,
  4724. forced: true
  4725. }, {
  4726. fetch: function fetch(input) {
  4727. return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
  4728. }
  4729. });
  4730. }
  4731. }
  4732. $({
  4733. global: true,
  4734. wrap: true,
  4735. forced: FORCED
  4736. }, { Promise: PromiseConstructor });
  4737. setToStringTag(PromiseConstructor, PROMISE, false, true);
  4738. setSpecies(PROMISE);
  4739. PromiseWrapper = getBuiltIn(PROMISE);
  4740. $({
  4741. target: PROMISE,
  4742. stat: true,
  4743. forced: FORCED
  4744. }, {
  4745. reject: function reject(r) {
  4746. var capability = newPromiseCapability(this);
  4747. capability.reject.call(undefined, r);
  4748. return capability.promise;
  4749. }
  4750. });
  4751. $({
  4752. target: PROMISE,
  4753. stat: true,
  4754. forced: IS_PURE || FORCED
  4755. }, {
  4756. resolve: function resolve(x) {
  4757. return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
  4758. }
  4759. });
  4760. $({
  4761. target: PROMISE,
  4762. stat: true,
  4763. forced: INCORRECT_ITERATION
  4764. }, {
  4765. all: function all(iterable) {
  4766. var C = this;
  4767. var capability = newPromiseCapability(C);
  4768. var resolve = capability.resolve;
  4769. var reject = capability.reject;
  4770. var result = perform(function () {
  4771. var $promiseResolve = aFunction(C.resolve);
  4772. var values = [];
  4773. var counter = 0;
  4774. var remaining = 1;
  4775. iterate(iterable, function (promise) {
  4776. var index = counter++;
  4777. var alreadyCalled = false;
  4778. values.push(undefined);
  4779. remaining++;
  4780. $promiseResolve.call(C, promise).then(function (value) {
  4781. if (alreadyCalled)
  4782. return;
  4783. alreadyCalled = true;
  4784. values[index] = value;
  4785. --remaining || resolve(values);
  4786. }, reject);
  4787. });
  4788. --remaining || resolve(values);
  4789. });
  4790. if (result.error)
  4791. reject(result.value);
  4792. return capability.promise;
  4793. },
  4794. race: function race(iterable) {
  4795. var C = this;
  4796. var capability = newPromiseCapability(C);
  4797. var reject = capability.reject;
  4798. var result = perform(function () {
  4799. var $promiseResolve = aFunction(C.resolve);
  4800. iterate(iterable, function (promise) {
  4801. $promiseResolve.call(C, promise).then(capability.resolve, reject);
  4802. });
  4803. });
  4804. if (result.error)
  4805. reject(result.value);
  4806. return capability.promise;
  4807. }
  4808. });
  4809. /***/ }),
  4810. /* 120 */
  4811. /***/ (function(module, exports, __w_pdfjs_require__) {
  4812. var global = __w_pdfjs_require__(11);
  4813. module.exports = global.Promise;
  4814. /***/ }),
  4815. /* 121 */
  4816. /***/ (function(module, exports, __w_pdfjs_require__) {
  4817. var redefine = __w_pdfjs_require__(29);
  4818. module.exports = function (target, src, options) {
  4819. for (var key in src)
  4820. redefine(target, key, src[key], options);
  4821. return target;
  4822. };
  4823. /***/ }),
  4824. /* 122 */
  4825. /***/ (function(module, exports, __w_pdfjs_require__) {
  4826. "use strict";
  4827. var getBuiltIn = __w_pdfjs_require__(42);
  4828. var definePropertyModule = __w_pdfjs_require__(27);
  4829. var wellKnownSymbol = __w_pdfjs_require__(57);
  4830. var DESCRIPTORS = __w_pdfjs_require__(13);
  4831. var SPECIES = wellKnownSymbol('species');
  4832. module.exports = function (CONSTRUCTOR_NAME) {
  4833. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  4834. var defineProperty = definePropertyModule.f;
  4835. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  4836. defineProperty(Constructor, SPECIES, {
  4837. configurable: true,
  4838. get: function () {
  4839. return this;
  4840. }
  4841. });
  4842. }
  4843. };
  4844. /***/ }),
  4845. /* 123 */
  4846. /***/ (function(module, exports) {
  4847. module.exports = function (it, Constructor, name) {
  4848. if (!(it instanceof Constructor)) {
  4849. throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
  4850. }
  4851. return it;
  4852. };
  4853. /***/ }),
  4854. /* 124 */
  4855. /***/ (function(module, exports, __w_pdfjs_require__) {
  4856. var anObject = __w_pdfjs_require__(28);
  4857. var isArrayIteratorMethod = __w_pdfjs_require__(92);
  4858. var toLength = __w_pdfjs_require__(47);
  4859. var bind = __w_pdfjs_require__(62);
  4860. var getIteratorMethod = __w_pdfjs_require__(94);
  4861. var callWithSafeIterationClosing = __w_pdfjs_require__(91);
  4862. var Result = function (stopped, result) {
  4863. this.stopped = stopped;
  4864. this.result = result;
  4865. };
  4866. var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
  4867. var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
  4868. var iterator, iterFn, index, length, result, next, step;
  4869. if (IS_ITERATOR) {
  4870. iterator = iterable;
  4871. } else {
  4872. iterFn = getIteratorMethod(iterable);
  4873. if (typeof iterFn != 'function')
  4874. throw TypeError('Target is not iterable');
  4875. if (isArrayIteratorMethod(iterFn)) {
  4876. for (index = 0, length = toLength(iterable.length); length > index; index++) {
  4877. result = AS_ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]);
  4878. if (result && result instanceof Result)
  4879. return result;
  4880. }
  4881. return new Result(false);
  4882. }
  4883. iterator = iterFn.call(iterable);
  4884. }
  4885. next = iterator.next;
  4886. while (!(step = next.call(iterator)).done) {
  4887. result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
  4888. if (typeof result == 'object' && result && result instanceof Result)
  4889. return result;
  4890. }
  4891. return new Result(false);
  4892. };
  4893. iterate.stop = function (result) {
  4894. return new Result(true, result);
  4895. };
  4896. /***/ }),
  4897. /* 125 */
  4898. /***/ (function(module, exports, __w_pdfjs_require__) {
  4899. var global = __w_pdfjs_require__(11);
  4900. var fails = __w_pdfjs_require__(14);
  4901. var classof = __w_pdfjs_require__(19);
  4902. var bind = __w_pdfjs_require__(62);
  4903. var html = __w_pdfjs_require__(74);
  4904. var createElement = __w_pdfjs_require__(25);
  4905. var IS_IOS = __w_pdfjs_require__(126);
  4906. var location = global.location;
  4907. var set = global.setImmediate;
  4908. var clear = global.clearImmediate;
  4909. var process = global.process;
  4910. var MessageChannel = global.MessageChannel;
  4911. var Dispatch = global.Dispatch;
  4912. var counter = 0;
  4913. var queue = {};
  4914. var ONREADYSTATECHANGE = 'onreadystatechange';
  4915. var defer, channel, port;
  4916. var run = function (id) {
  4917. if (queue.hasOwnProperty(id)) {
  4918. var fn = queue[id];
  4919. delete queue[id];
  4920. fn();
  4921. }
  4922. };
  4923. var runner = function (id) {
  4924. return function () {
  4925. run(id);
  4926. };
  4927. };
  4928. var listener = function (event) {
  4929. run(event.data);
  4930. };
  4931. var post = function (id) {
  4932. global.postMessage(id + '', location.protocol + '//' + location.host);
  4933. };
  4934. if (!set || !clear) {
  4935. set = function setImmediate(fn) {
  4936. var args = [];
  4937. var i = 1;
  4938. while (arguments.length > i)
  4939. args.push(arguments[i++]);
  4940. queue[++counter] = function () {
  4941. (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
  4942. };
  4943. defer(counter);
  4944. return counter;
  4945. };
  4946. clear = function clearImmediate(id) {
  4947. delete queue[id];
  4948. };
  4949. if (classof(process) == 'process') {
  4950. defer = function (id) {
  4951. process.nextTick(runner(id));
  4952. };
  4953. } else if (Dispatch && Dispatch.now) {
  4954. defer = function (id) {
  4955. Dispatch.now(runner(id));
  4956. };
  4957. } else if (MessageChannel && !IS_IOS) {
  4958. channel = new MessageChannel();
  4959. port = channel.port2;
  4960. channel.port1.onmessage = listener;
  4961. defer = bind(port.postMessage, port, 1);
  4962. } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && !fails(post) && location.protocol !== 'file:') {
  4963. defer = post;
  4964. global.addEventListener('message', listener, false);
  4965. } else if (ONREADYSTATECHANGE in createElement('script')) {
  4966. defer = function (id) {
  4967. html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
  4968. html.removeChild(this);
  4969. run(id);
  4970. };
  4971. };
  4972. } else {
  4973. defer = function (id) {
  4974. setTimeout(runner(id), 0);
  4975. };
  4976. }
  4977. }
  4978. module.exports = {
  4979. set: set,
  4980. clear: clear
  4981. };
  4982. /***/ }),
  4983. /* 126 */
  4984. /***/ (function(module, exports, __w_pdfjs_require__) {
  4985. var userAgent = __w_pdfjs_require__(127);
  4986. module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
  4987. /***/ }),
  4988. /* 127 */
  4989. /***/ (function(module, exports, __w_pdfjs_require__) {
  4990. var getBuiltIn = __w_pdfjs_require__(42);
  4991. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  4992. /***/ }),
  4993. /* 128 */
  4994. /***/ (function(module, exports, __w_pdfjs_require__) {
  4995. var global = __w_pdfjs_require__(11);
  4996. var getOwnPropertyDescriptor = __w_pdfjs_require__(12).f;
  4997. var classof = __w_pdfjs_require__(19);
  4998. var macrotask = __w_pdfjs_require__(125).set;
  4999. var IS_IOS = __w_pdfjs_require__(126);
  5000. var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
  5001. var process = global.process;
  5002. var Promise = global.Promise;
  5003. var IS_NODE = classof(process) == 'process';
  5004. var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
  5005. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  5006. var flush, head, last, notify, toggle, node, promise, then;
  5007. if (!queueMicrotask) {
  5008. flush = function () {
  5009. var parent, fn;
  5010. if (IS_NODE && (parent = process.domain))
  5011. parent.exit();
  5012. while (head) {
  5013. fn = head.fn;
  5014. head = head.next;
  5015. try {
  5016. fn();
  5017. } catch (error) {
  5018. if (head)
  5019. notify();
  5020. else
  5021. last = undefined;
  5022. throw error;
  5023. }
  5024. }
  5025. last = undefined;
  5026. if (parent)
  5027. parent.enter();
  5028. };
  5029. if (IS_NODE) {
  5030. notify = function () {
  5031. process.nextTick(flush);
  5032. };
  5033. } else if (MutationObserver && !IS_IOS) {
  5034. toggle = true;
  5035. node = document.createTextNode('');
  5036. new MutationObserver(flush).observe(node, { characterData: true });
  5037. notify = function () {
  5038. node.data = toggle = !toggle;
  5039. };
  5040. } else if (Promise && Promise.resolve) {
  5041. promise = Promise.resolve(undefined);
  5042. then = promise.then;
  5043. notify = function () {
  5044. then.call(promise, flush);
  5045. };
  5046. } else {
  5047. notify = function () {
  5048. macrotask.call(global, flush);
  5049. };
  5050. }
  5051. }
  5052. module.exports = queueMicrotask || function (fn) {
  5053. var task = {
  5054. fn: fn,
  5055. next: undefined
  5056. };
  5057. if (last)
  5058. last.next = task;
  5059. if (!head) {
  5060. head = task;
  5061. notify();
  5062. }
  5063. last = task;
  5064. };
  5065. /***/ }),
  5066. /* 129 */
  5067. /***/ (function(module, exports, __w_pdfjs_require__) {
  5068. var anObject = __w_pdfjs_require__(28);
  5069. var isObject = __w_pdfjs_require__(22);
  5070. var newPromiseCapability = __w_pdfjs_require__(130);
  5071. module.exports = function (C, x) {
  5072. anObject(C);
  5073. if (isObject(x) && x.constructor === C)
  5074. return x;
  5075. var promiseCapability = newPromiseCapability.f(C);
  5076. var resolve = promiseCapability.resolve;
  5077. resolve(x);
  5078. return promiseCapability.promise;
  5079. };
  5080. /***/ }),
  5081. /* 130 */
  5082. /***/ (function(module, exports, __w_pdfjs_require__) {
  5083. "use strict";
  5084. var aFunction = __w_pdfjs_require__(63);
  5085. var PromiseCapability = function (C) {
  5086. var resolve, reject;
  5087. this.promise = new C(function ($$resolve, $$reject) {
  5088. if (resolve !== undefined || reject !== undefined)
  5089. throw TypeError('Bad Promise constructor');
  5090. resolve = $$resolve;
  5091. reject = $$reject;
  5092. });
  5093. this.resolve = aFunction(resolve);
  5094. this.reject = aFunction(reject);
  5095. };
  5096. module.exports.f = function (C) {
  5097. return new PromiseCapability(C);
  5098. };
  5099. /***/ }),
  5100. /* 131 */
  5101. /***/ (function(module, exports, __w_pdfjs_require__) {
  5102. var global = __w_pdfjs_require__(11);
  5103. module.exports = function (a, b) {
  5104. var console = global.console;
  5105. if (console && console.error) {
  5106. arguments.length === 1 ? console.error(a) : console.error(a, b);
  5107. }
  5108. };
  5109. /***/ }),
  5110. /* 132 */
  5111. /***/ (function(module, exports) {
  5112. module.exports = function (exec) {
  5113. try {
  5114. return {
  5115. error: false,
  5116. value: exec()
  5117. };
  5118. } catch (error) {
  5119. return {
  5120. error: true,
  5121. value: error
  5122. };
  5123. }
  5124. };
  5125. /***/ }),
  5126. /* 133 */
  5127. /***/ (function(module, exports, __w_pdfjs_require__) {
  5128. var global = __w_pdfjs_require__(11);
  5129. var userAgent = __w_pdfjs_require__(127);
  5130. var process = global.process;
  5131. var versions = process && process.versions;
  5132. var v8 = versions && versions.v8;
  5133. var match, version;
  5134. if (v8) {
  5135. match = v8.split('.');
  5136. version = match[0] + match[1];
  5137. } else if (userAgent) {
  5138. match = userAgent.match(/Edge\/(\d+)/);
  5139. if (!match || match[1] >= 74) {
  5140. match = userAgent.match(/Chrome\/(\d+)/);
  5141. if (match)
  5142. version = match[1];
  5143. }
  5144. }
  5145. module.exports = version && +version;
  5146. /***/ }),
  5147. /* 134 */
  5148. /***/ (function(module, exports, __w_pdfjs_require__) {
  5149. "use strict";
  5150. var $ = __w_pdfjs_require__(10);
  5151. var aFunction = __w_pdfjs_require__(63);
  5152. var newPromiseCapabilityModule = __w_pdfjs_require__(130);
  5153. var perform = __w_pdfjs_require__(132);
  5154. var iterate = __w_pdfjs_require__(124);
  5155. $({
  5156. target: 'Promise',
  5157. stat: true
  5158. }, {
  5159. allSettled: function allSettled(iterable) {
  5160. var C = this;
  5161. var capability = newPromiseCapabilityModule.f(C);
  5162. var resolve = capability.resolve;
  5163. var reject = capability.reject;
  5164. var result = perform(function () {
  5165. var promiseResolve = aFunction(C.resolve);
  5166. var values = [];
  5167. var counter = 0;
  5168. var remaining = 1;
  5169. iterate(iterable, function (promise) {
  5170. var index = counter++;
  5171. var alreadyCalled = false;
  5172. values.push(undefined);
  5173. remaining++;
  5174. promiseResolve.call(C, promise).then(function (value) {
  5175. if (alreadyCalled)
  5176. return;
  5177. alreadyCalled = true;
  5178. values[index] = {
  5179. status: 'fulfilled',
  5180. value: value
  5181. };
  5182. --remaining || resolve(values);
  5183. }, function (e) {
  5184. if (alreadyCalled)
  5185. return;
  5186. alreadyCalled = true;
  5187. values[index] = {
  5188. status: 'rejected',
  5189. reason: e
  5190. };
  5191. --remaining || resolve(values);
  5192. });
  5193. });
  5194. --remaining || resolve(values);
  5195. });
  5196. if (result.error)
  5197. reject(result.value);
  5198. return capability.promise;
  5199. }
  5200. });
  5201. /***/ }),
  5202. /* 135 */
  5203. /***/ (function(module, exports, __w_pdfjs_require__) {
  5204. "use strict";
  5205. var $ = __w_pdfjs_require__(10);
  5206. var IS_PURE = __w_pdfjs_require__(37);
  5207. var NativePromise = __w_pdfjs_require__(120);
  5208. var fails = __w_pdfjs_require__(14);
  5209. var getBuiltIn = __w_pdfjs_require__(42);
  5210. var speciesConstructor = __w_pdfjs_require__(112);
  5211. var promiseResolve = __w_pdfjs_require__(129);
  5212. var redefine = __w_pdfjs_require__(29);
  5213. var NON_GENERIC = !!NativePromise && fails(function () {
  5214. NativePromise.prototype['finally'].call({
  5215. then: function () {
  5216. }
  5217. }, function () {
  5218. });
  5219. });
  5220. $({
  5221. target: 'Promise',
  5222. proto: true,
  5223. real: true,
  5224. forced: NON_GENERIC
  5225. }, {
  5226. 'finally': function (onFinally) {
  5227. var C = speciesConstructor(this, getBuiltIn('Promise'));
  5228. var isFunction = typeof onFinally == 'function';
  5229. return this.then(isFunction ? function (x) {
  5230. return promiseResolve(C, onFinally()).then(function () {
  5231. return x;
  5232. });
  5233. } : onFinally, isFunction ? function (e) {
  5234. return promiseResolve(C, onFinally()).then(function () {
  5235. throw e;
  5236. });
  5237. } : onFinally);
  5238. }
  5239. });
  5240. if (!IS_PURE && typeof NativePromise == 'function' && !NativePromise.prototype['finally']) {
  5241. redefine(NativePromise.prototype, 'finally', getBuiltIn('Promise').prototype['finally']);
  5242. }
  5243. /***/ }),
  5244. /* 136 */
  5245. /***/ (function(module, exports, __w_pdfjs_require__) {
  5246. __w_pdfjs_require__(137);
  5247. __w_pdfjs_require__(142);
  5248. __w_pdfjs_require__(140);
  5249. var path = __w_pdfjs_require__(43);
  5250. module.exports = path.URL;
  5251. /***/ }),
  5252. /* 137 */
  5253. /***/ (function(module, exports, __w_pdfjs_require__) {
  5254. "use strict";
  5255. __w_pdfjs_require__(77);
  5256. var $ = __w_pdfjs_require__(10);
  5257. var DESCRIPTORS = __w_pdfjs_require__(13);
  5258. var USE_NATIVE_URL = __w_pdfjs_require__(138);
  5259. var global = __w_pdfjs_require__(11);
  5260. var defineProperties = __w_pdfjs_require__(72);
  5261. var redefine = __w_pdfjs_require__(29);
  5262. var anInstance = __w_pdfjs_require__(123);
  5263. var has = __w_pdfjs_require__(23);
  5264. var assign = __w_pdfjs_require__(100);
  5265. var arrayFrom = __w_pdfjs_require__(90);
  5266. var codeAt = __w_pdfjs_require__(78).codeAt;
  5267. var toASCII = __w_pdfjs_require__(139);
  5268. var setToStringTag = __w_pdfjs_require__(85);
  5269. var URLSearchParamsModule = __w_pdfjs_require__(140);
  5270. var InternalStateModule = __w_pdfjs_require__(33);
  5271. var NativeURL = global.URL;
  5272. var URLSearchParams = URLSearchParamsModule.URLSearchParams;
  5273. var getInternalSearchParamsState = URLSearchParamsModule.getState;
  5274. var setInternalState = InternalStateModule.set;
  5275. var getInternalURLState = InternalStateModule.getterFor('URL');
  5276. var floor = Math.floor;
  5277. var pow = Math.pow;
  5278. var INVALID_AUTHORITY = 'Invalid authority';
  5279. var INVALID_SCHEME = 'Invalid scheme';
  5280. var INVALID_HOST = 'Invalid host';
  5281. var INVALID_PORT = 'Invalid port';
  5282. var ALPHA = /[A-Za-z]/;
  5283. var ALPHANUMERIC = /[\d+-.A-Za-z]/;
  5284. var DIGIT = /\d/;
  5285. var HEX_START = /^(0x|0X)/;
  5286. var OCT = /^[0-7]+$/;
  5287. var DEC = /^\d+$/;
  5288. var HEX = /^[\dA-Fa-f]+$/;
  5289. var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;
  5290. var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/;
  5291. var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
  5292. var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g;
  5293. var EOF;
  5294. var parseHost = function (url, input) {
  5295. var result, codePoints, index;
  5296. if (input.charAt(0) == '[') {
  5297. if (input.charAt(input.length - 1) != ']')
  5298. return INVALID_HOST;
  5299. result = parseIPv6(input.slice(1, -1));
  5300. if (!result)
  5301. return INVALID_HOST;
  5302. url.host = result;
  5303. } else if (!isSpecial(url)) {
  5304. if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input))
  5305. return INVALID_HOST;
  5306. result = '';
  5307. codePoints = arrayFrom(input);
  5308. for (index = 0; index < codePoints.length; index++) {
  5309. result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
  5310. }
  5311. url.host = result;
  5312. } else {
  5313. input = toASCII(input);
  5314. if (FORBIDDEN_HOST_CODE_POINT.test(input))
  5315. return INVALID_HOST;
  5316. result = parseIPv4(input);
  5317. if (result === null)
  5318. return INVALID_HOST;
  5319. url.host = result;
  5320. }
  5321. };
  5322. var parseIPv4 = function (input) {
  5323. var parts = input.split('.');
  5324. var partsLength, numbers, index, part, radix, number, ipv4;
  5325. if (parts.length && parts[parts.length - 1] == '') {
  5326. parts.pop();
  5327. }
  5328. partsLength = parts.length;
  5329. if (partsLength > 4)
  5330. return input;
  5331. numbers = [];
  5332. for (index = 0; index < partsLength; index++) {
  5333. part = parts[index];
  5334. if (part == '')
  5335. return input;
  5336. radix = 10;
  5337. if (part.length > 1 && part.charAt(0) == '0') {
  5338. radix = HEX_START.test(part) ? 16 : 8;
  5339. part = part.slice(radix == 8 ? 1 : 2);
  5340. }
  5341. if (part === '') {
  5342. number = 0;
  5343. } else {
  5344. if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part))
  5345. return input;
  5346. number = parseInt(part, radix);
  5347. }
  5348. numbers.push(number);
  5349. }
  5350. for (index = 0; index < partsLength; index++) {
  5351. number = numbers[index];
  5352. if (index == partsLength - 1) {
  5353. if (number >= pow(256, 5 - partsLength))
  5354. return null;
  5355. } else if (number > 255)
  5356. return null;
  5357. }
  5358. ipv4 = numbers.pop();
  5359. for (index = 0; index < numbers.length; index++) {
  5360. ipv4 += numbers[index] * pow(256, 3 - index);
  5361. }
  5362. return ipv4;
  5363. };
  5364. var parseIPv6 = function (input) {
  5365. var address = [
  5366. 0,
  5367. 0,
  5368. 0,
  5369. 0,
  5370. 0,
  5371. 0,
  5372. 0,
  5373. 0
  5374. ];
  5375. var pieceIndex = 0;
  5376. var compress = null;
  5377. var pointer = 0;
  5378. var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
  5379. var char = function () {
  5380. return input.charAt(pointer);
  5381. };
  5382. if (char() == ':') {
  5383. if (input.charAt(1) != ':')
  5384. return;
  5385. pointer += 2;
  5386. pieceIndex++;
  5387. compress = pieceIndex;
  5388. }
  5389. while (char()) {
  5390. if (pieceIndex == 8)
  5391. return;
  5392. if (char() == ':') {
  5393. if (compress !== null)
  5394. return;
  5395. pointer++;
  5396. pieceIndex++;
  5397. compress = pieceIndex;
  5398. continue;
  5399. }
  5400. value = length = 0;
  5401. while (length < 4 && HEX.test(char())) {
  5402. value = value * 16 + parseInt(char(), 16);
  5403. pointer++;
  5404. length++;
  5405. }
  5406. if (char() == '.') {
  5407. if (length == 0)
  5408. return;
  5409. pointer -= length;
  5410. if (pieceIndex > 6)
  5411. return;
  5412. numbersSeen = 0;
  5413. while (char()) {
  5414. ipv4Piece = null;
  5415. if (numbersSeen > 0) {
  5416. if (char() == '.' && numbersSeen < 4)
  5417. pointer++;
  5418. else
  5419. return;
  5420. }
  5421. if (!DIGIT.test(char()))
  5422. return;
  5423. while (DIGIT.test(char())) {
  5424. number = parseInt(char(), 10);
  5425. if (ipv4Piece === null)
  5426. ipv4Piece = number;
  5427. else if (ipv4Piece == 0)
  5428. return;
  5429. else
  5430. ipv4Piece = ipv4Piece * 10 + number;
  5431. if (ipv4Piece > 255)
  5432. return;
  5433. pointer++;
  5434. }
  5435. address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
  5436. numbersSeen++;
  5437. if (numbersSeen == 2 || numbersSeen == 4)
  5438. pieceIndex++;
  5439. }
  5440. if (numbersSeen != 4)
  5441. return;
  5442. break;
  5443. } else if (char() == ':') {
  5444. pointer++;
  5445. if (!char())
  5446. return;
  5447. } else if (char())
  5448. return;
  5449. address[pieceIndex++] = value;
  5450. }
  5451. if (compress !== null) {
  5452. swaps = pieceIndex - compress;
  5453. pieceIndex = 7;
  5454. while (pieceIndex != 0 && swaps > 0) {
  5455. swap = address[pieceIndex];
  5456. address[pieceIndex--] = address[compress + swaps - 1];
  5457. address[compress + --swaps] = swap;
  5458. }
  5459. } else if (pieceIndex != 8)
  5460. return;
  5461. return address;
  5462. };
  5463. var findLongestZeroSequence = function (ipv6) {
  5464. var maxIndex = null;
  5465. var maxLength = 1;
  5466. var currStart = null;
  5467. var currLength = 0;
  5468. var index = 0;
  5469. for (; index < 8; index++) {
  5470. if (ipv6[index] !== 0) {
  5471. if (currLength > maxLength) {
  5472. maxIndex = currStart;
  5473. maxLength = currLength;
  5474. }
  5475. currStart = null;
  5476. currLength = 0;
  5477. } else {
  5478. if (currStart === null)
  5479. currStart = index;
  5480. ++currLength;
  5481. }
  5482. }
  5483. if (currLength > maxLength) {
  5484. maxIndex = currStart;
  5485. maxLength = currLength;
  5486. }
  5487. return maxIndex;
  5488. };
  5489. var serializeHost = function (host) {
  5490. var result, index, compress, ignore0;
  5491. if (typeof host == 'number') {
  5492. result = [];
  5493. for (index = 0; index < 4; index++) {
  5494. result.unshift(host % 256);
  5495. host = floor(host / 256);
  5496. }
  5497. return result.join('.');
  5498. } else if (typeof host == 'object') {
  5499. result = '';
  5500. compress = findLongestZeroSequence(host);
  5501. for (index = 0; index < 8; index++) {
  5502. if (ignore0 && host[index] === 0)
  5503. continue;
  5504. if (ignore0)
  5505. ignore0 = false;
  5506. if (compress === index) {
  5507. result += index ? ':' : '::';
  5508. ignore0 = true;
  5509. } else {
  5510. result += host[index].toString(16);
  5511. if (index < 7)
  5512. result += ':';
  5513. }
  5514. }
  5515. return '[' + result + ']';
  5516. }
  5517. return host;
  5518. };
  5519. var C0ControlPercentEncodeSet = {};
  5520. var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
  5521. ' ': 1,
  5522. '"': 1,
  5523. '<': 1,
  5524. '>': 1,
  5525. '`': 1
  5526. });
  5527. var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
  5528. '#': 1,
  5529. '?': 1,
  5530. '{': 1,
  5531. '}': 1
  5532. });
  5533. var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
  5534. '/': 1,
  5535. ':': 1,
  5536. ';': 1,
  5537. '=': 1,
  5538. '@': 1,
  5539. '[': 1,
  5540. '\\': 1,
  5541. ']': 1,
  5542. '^': 1,
  5543. '|': 1
  5544. });
  5545. var percentEncode = function (char, set) {
  5546. var code = codeAt(char, 0);
  5547. return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);
  5548. };
  5549. var specialSchemes = {
  5550. ftp: 21,
  5551. file: null,
  5552. http: 80,
  5553. https: 443,
  5554. ws: 80,
  5555. wss: 443
  5556. };
  5557. var isSpecial = function (url) {
  5558. return has(specialSchemes, url.scheme);
  5559. };
  5560. var includesCredentials = function (url) {
  5561. return url.username != '' || url.password != '';
  5562. };
  5563. var cannotHaveUsernamePasswordPort = function (url) {
  5564. return !url.host || url.cannotBeABaseURL || url.scheme == 'file';
  5565. };
  5566. var isWindowsDriveLetter = function (string, normalized) {
  5567. var second;
  5568. return string.length == 2 && ALPHA.test(string.charAt(0)) && ((second = string.charAt(1)) == ':' || !normalized && second == '|');
  5569. };
  5570. var startsWithWindowsDriveLetter = function (string) {
  5571. var third;
  5572. return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (string.length == 2 || ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#'));
  5573. };
  5574. var shortenURLsPath = function (url) {
  5575. var path = url.path;
  5576. var pathSize = path.length;
  5577. if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {
  5578. path.pop();
  5579. }
  5580. };
  5581. var isSingleDot = function (segment) {
  5582. return segment === '.' || segment.toLowerCase() === '%2e';
  5583. };
  5584. var isDoubleDot = function (segment) {
  5585. segment = segment.toLowerCase();
  5586. return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
  5587. };
  5588. var SCHEME_START = {};
  5589. var SCHEME = {};
  5590. var NO_SCHEME = {};
  5591. var SPECIAL_RELATIVE_OR_AUTHORITY = {};
  5592. var PATH_OR_AUTHORITY = {};
  5593. var RELATIVE = {};
  5594. var RELATIVE_SLASH = {};
  5595. var SPECIAL_AUTHORITY_SLASHES = {};
  5596. var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
  5597. var AUTHORITY = {};
  5598. var HOST = {};
  5599. var HOSTNAME = {};
  5600. var PORT = {};
  5601. var FILE = {};
  5602. var FILE_SLASH = {};
  5603. var FILE_HOST = {};
  5604. var PATH_START = {};
  5605. var PATH = {};
  5606. var CANNOT_BE_A_BASE_URL_PATH = {};
  5607. var QUERY = {};
  5608. var FRAGMENT = {};
  5609. var parseURL = function (url, input, stateOverride, base) {
  5610. var state = stateOverride || SCHEME_START;
  5611. var pointer = 0;
  5612. var buffer = '';
  5613. var seenAt = false;
  5614. var seenBracket = false;
  5615. var seenPasswordToken = false;
  5616. var codePoints, char, bufferCodePoints, failure;
  5617. if (!stateOverride) {
  5618. url.scheme = '';
  5619. url.username = '';
  5620. url.password = '';
  5621. url.host = null;
  5622. url.port = null;
  5623. url.path = [];
  5624. url.query = null;
  5625. url.fragment = null;
  5626. url.cannotBeABaseURL = false;
  5627. input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');
  5628. }
  5629. input = input.replace(TAB_AND_NEW_LINE, '');
  5630. codePoints = arrayFrom(input);
  5631. while (pointer <= codePoints.length) {
  5632. char = codePoints[pointer];
  5633. switch (state) {
  5634. case SCHEME_START:
  5635. if (char && ALPHA.test(char)) {
  5636. buffer += char.toLowerCase();
  5637. state = SCHEME;
  5638. } else if (!stateOverride) {
  5639. state = NO_SCHEME;
  5640. continue;
  5641. } else
  5642. return INVALID_SCHEME;
  5643. break;
  5644. case SCHEME:
  5645. if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {
  5646. buffer += char.toLowerCase();
  5647. } else if (char == ':') {
  5648. if (stateOverride && (isSpecial(url) != has(specialSchemes, buffer) || buffer == 'file' && (includesCredentials(url) || url.port !== null) || url.scheme == 'file' && !url.host))
  5649. return;
  5650. url.scheme = buffer;
  5651. if (stateOverride) {
  5652. if (isSpecial(url) && specialSchemes[url.scheme] == url.port)
  5653. url.port = null;
  5654. return;
  5655. }
  5656. buffer = '';
  5657. if (url.scheme == 'file') {
  5658. state = FILE;
  5659. } else if (isSpecial(url) && base && base.scheme == url.scheme) {
  5660. state = SPECIAL_RELATIVE_OR_AUTHORITY;
  5661. } else if (isSpecial(url)) {
  5662. state = SPECIAL_AUTHORITY_SLASHES;
  5663. } else if (codePoints[pointer + 1] == '/') {
  5664. state = PATH_OR_AUTHORITY;
  5665. pointer++;
  5666. } else {
  5667. url.cannotBeABaseURL = true;
  5668. url.path.push('');
  5669. state = CANNOT_BE_A_BASE_URL_PATH;
  5670. }
  5671. } else if (!stateOverride) {
  5672. buffer = '';
  5673. state = NO_SCHEME;
  5674. pointer = 0;
  5675. continue;
  5676. } else
  5677. return INVALID_SCHEME;
  5678. break;
  5679. case NO_SCHEME:
  5680. if (!base || base.cannotBeABaseURL && char != '#')
  5681. return INVALID_SCHEME;
  5682. if (base.cannotBeABaseURL && char == '#') {
  5683. url.scheme = base.scheme;
  5684. url.path = base.path.slice();
  5685. url.query = base.query;
  5686. url.fragment = '';
  5687. url.cannotBeABaseURL = true;
  5688. state = FRAGMENT;
  5689. break;
  5690. }
  5691. state = base.scheme == 'file' ? FILE : RELATIVE;
  5692. continue;
  5693. case SPECIAL_RELATIVE_OR_AUTHORITY:
  5694. if (char == '/' && codePoints[pointer + 1] == '/') {
  5695. state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
  5696. pointer++;
  5697. } else {
  5698. state = RELATIVE;
  5699. continue;
  5700. }
  5701. break;
  5702. case PATH_OR_AUTHORITY:
  5703. if (char == '/') {
  5704. state = AUTHORITY;
  5705. break;
  5706. } else {
  5707. state = PATH;
  5708. continue;
  5709. }
  5710. case RELATIVE:
  5711. url.scheme = base.scheme;
  5712. if (char == EOF) {
  5713. url.username = base.username;
  5714. url.password = base.password;
  5715. url.host = base.host;
  5716. url.port = base.port;
  5717. url.path = base.path.slice();
  5718. url.query = base.query;
  5719. } else if (char == '/' || char == '\\' && isSpecial(url)) {
  5720. state = RELATIVE_SLASH;
  5721. } else if (char == '?') {
  5722. url.username = base.username;
  5723. url.password = base.password;
  5724. url.host = base.host;
  5725. url.port = base.port;
  5726. url.path = base.path.slice();
  5727. url.query = '';
  5728. state = QUERY;
  5729. } else if (char == '#') {
  5730. url.username = base.username;
  5731. url.password = base.password;
  5732. url.host = base.host;
  5733. url.port = base.port;
  5734. url.path = base.path.slice();
  5735. url.query = base.query;
  5736. url.fragment = '';
  5737. state = FRAGMENT;
  5738. } else {
  5739. url.username = base.username;
  5740. url.password = base.password;
  5741. url.host = base.host;
  5742. url.port = base.port;
  5743. url.path = base.path.slice();
  5744. url.path.pop();
  5745. state = PATH;
  5746. continue;
  5747. }
  5748. break;
  5749. case RELATIVE_SLASH:
  5750. if (isSpecial(url) && (char == '/' || char == '\\')) {
  5751. state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
  5752. } else if (char == '/') {
  5753. state = AUTHORITY;
  5754. } else {
  5755. url.username = base.username;
  5756. url.password = base.password;
  5757. url.host = base.host;
  5758. url.port = base.port;
  5759. state = PATH;
  5760. continue;
  5761. }
  5762. break;
  5763. case SPECIAL_AUTHORITY_SLASHES:
  5764. state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
  5765. if (char != '/' || buffer.charAt(pointer + 1) != '/')
  5766. continue;
  5767. pointer++;
  5768. break;
  5769. case SPECIAL_AUTHORITY_IGNORE_SLASHES:
  5770. if (char != '/' && char != '\\') {
  5771. state = AUTHORITY;
  5772. continue;
  5773. }
  5774. break;
  5775. case AUTHORITY:
  5776. if (char == '@') {
  5777. if (seenAt)
  5778. buffer = '%40' + buffer;
  5779. seenAt = true;
  5780. bufferCodePoints = arrayFrom(buffer);
  5781. for (var i = 0; i < bufferCodePoints.length; i++) {
  5782. var codePoint = bufferCodePoints[i];
  5783. if (codePoint == ':' && !seenPasswordToken) {
  5784. seenPasswordToken = true;
  5785. continue;
  5786. }
  5787. var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
  5788. if (seenPasswordToken)
  5789. url.password += encodedCodePoints;
  5790. else
  5791. url.username += encodedCodePoints;
  5792. }
  5793. buffer = '';
  5794. } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) {
  5795. if (seenAt && buffer == '')
  5796. return INVALID_AUTHORITY;
  5797. pointer -= arrayFrom(buffer).length + 1;
  5798. buffer = '';
  5799. state = HOST;
  5800. } else
  5801. buffer += char;
  5802. break;
  5803. case HOST:
  5804. case HOSTNAME:
  5805. if (stateOverride && url.scheme == 'file') {
  5806. state = FILE_HOST;
  5807. continue;
  5808. } else if (char == ':' && !seenBracket) {
  5809. if (buffer == '')
  5810. return INVALID_HOST;
  5811. failure = parseHost(url, buffer);
  5812. if (failure)
  5813. return failure;
  5814. buffer = '';
  5815. state = PORT;
  5816. if (stateOverride == HOSTNAME)
  5817. return;
  5818. } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) {
  5819. if (isSpecial(url) && buffer == '')
  5820. return INVALID_HOST;
  5821. if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null))
  5822. return;
  5823. failure = parseHost(url, buffer);
  5824. if (failure)
  5825. return failure;
  5826. buffer = '';
  5827. state = PATH_START;
  5828. if (stateOverride)
  5829. return;
  5830. continue;
  5831. } else {
  5832. if (char == '[')
  5833. seenBracket = true;
  5834. else if (char == ']')
  5835. seenBracket = false;
  5836. buffer += char;
  5837. }
  5838. break;
  5839. case PORT:
  5840. if (DIGIT.test(char)) {
  5841. buffer += char;
  5842. } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url) || stateOverride) {
  5843. if (buffer != '') {
  5844. var port = parseInt(buffer, 10);
  5845. if (port > 0xFFFF)
  5846. return INVALID_PORT;
  5847. url.port = isSpecial(url) && port === specialSchemes[url.scheme] ? null : port;
  5848. buffer = '';
  5849. }
  5850. if (stateOverride)
  5851. return;
  5852. state = PATH_START;
  5853. continue;
  5854. } else
  5855. return INVALID_PORT;
  5856. break;
  5857. case FILE:
  5858. url.scheme = 'file';
  5859. if (char == '/' || char == '\\')
  5860. state = FILE_SLASH;
  5861. else if (base && base.scheme == 'file') {
  5862. if (char == EOF) {
  5863. url.host = base.host;
  5864. url.path = base.path.slice();
  5865. url.query = base.query;
  5866. } else if (char == '?') {
  5867. url.host = base.host;
  5868. url.path = base.path.slice();
  5869. url.query = '';
  5870. state = QUERY;
  5871. } else if (char == '#') {
  5872. url.host = base.host;
  5873. url.path = base.path.slice();
  5874. url.query = base.query;
  5875. url.fragment = '';
  5876. state = FRAGMENT;
  5877. } else {
  5878. if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
  5879. url.host = base.host;
  5880. url.path = base.path.slice();
  5881. shortenURLsPath(url);
  5882. }
  5883. state = PATH;
  5884. continue;
  5885. }
  5886. } else {
  5887. state = PATH;
  5888. continue;
  5889. }
  5890. break;
  5891. case FILE_SLASH:
  5892. if (char == '/' || char == '\\') {
  5893. state = FILE_HOST;
  5894. break;
  5895. }
  5896. if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
  5897. if (isWindowsDriveLetter(base.path[0], true))
  5898. url.path.push(base.path[0]);
  5899. else
  5900. url.host = base.host;
  5901. }
  5902. state = PATH;
  5903. continue;
  5904. case FILE_HOST:
  5905. if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') {
  5906. if (!stateOverride && isWindowsDriveLetter(buffer)) {
  5907. state = PATH;
  5908. } else if (buffer == '') {
  5909. url.host = '';
  5910. if (stateOverride)
  5911. return;
  5912. state = PATH_START;
  5913. } else {
  5914. failure = parseHost(url, buffer);
  5915. if (failure)
  5916. return failure;
  5917. if (url.host == 'localhost')
  5918. url.host = '';
  5919. if (stateOverride)
  5920. return;
  5921. buffer = '';
  5922. state = PATH_START;
  5923. }
  5924. continue;
  5925. } else
  5926. buffer += char;
  5927. break;
  5928. case PATH_START:
  5929. if (isSpecial(url)) {
  5930. state = PATH;
  5931. if (char != '/' && char != '\\')
  5932. continue;
  5933. } else if (!stateOverride && char == '?') {
  5934. url.query = '';
  5935. state = QUERY;
  5936. } else if (!stateOverride && char == '#') {
  5937. url.fragment = '';
  5938. state = FRAGMENT;
  5939. } else if (char != EOF) {
  5940. state = PATH;
  5941. if (char != '/')
  5942. continue;
  5943. }
  5944. break;
  5945. case PATH:
  5946. if (char == EOF || char == '/' || char == '\\' && isSpecial(url) || !stateOverride && (char == '?' || char == '#')) {
  5947. if (isDoubleDot(buffer)) {
  5948. shortenURLsPath(url);
  5949. if (char != '/' && !(char == '\\' && isSpecial(url))) {
  5950. url.path.push('');
  5951. }
  5952. } else if (isSingleDot(buffer)) {
  5953. if (char != '/' && !(char == '\\' && isSpecial(url))) {
  5954. url.path.push('');
  5955. }
  5956. } else {
  5957. if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
  5958. if (url.host)
  5959. url.host = '';
  5960. buffer = buffer.charAt(0) + ':';
  5961. }
  5962. url.path.push(buffer);
  5963. }
  5964. buffer = '';
  5965. if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {
  5966. while (url.path.length > 1 && url.path[0] === '') {
  5967. url.path.shift();
  5968. }
  5969. }
  5970. if (char == '?') {
  5971. url.query = '';
  5972. state = QUERY;
  5973. } else if (char == '#') {
  5974. url.fragment = '';
  5975. state = FRAGMENT;
  5976. }
  5977. } else {
  5978. buffer += percentEncode(char, pathPercentEncodeSet);
  5979. }
  5980. break;
  5981. case CANNOT_BE_A_BASE_URL_PATH:
  5982. if (char == '?') {
  5983. url.query = '';
  5984. state = QUERY;
  5985. } else if (char == '#') {
  5986. url.fragment = '';
  5987. state = FRAGMENT;
  5988. } else if (char != EOF) {
  5989. url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);
  5990. }
  5991. break;
  5992. case QUERY:
  5993. if (!stateOverride && char == '#') {
  5994. url.fragment = '';
  5995. state = FRAGMENT;
  5996. } else if (char != EOF) {
  5997. if (char == "'" && isSpecial(url))
  5998. url.query += '%27';
  5999. else if (char == '#')
  6000. url.query += '%23';
  6001. else
  6002. url.query += percentEncode(char, C0ControlPercentEncodeSet);
  6003. }
  6004. break;
  6005. case FRAGMENT:
  6006. if (char != EOF)
  6007. url.fragment += percentEncode(char, fragmentPercentEncodeSet);
  6008. break;
  6009. }
  6010. pointer++;
  6011. }
  6012. };
  6013. var URLConstructor = function URL(url) {
  6014. var that = anInstance(this, URLConstructor, 'URL');
  6015. var base = arguments.length > 1 ? arguments[1] : undefined;
  6016. var urlString = String(url);
  6017. var state = setInternalState(that, { type: 'URL' });
  6018. var baseState, failure;
  6019. if (base !== undefined) {
  6020. if (base instanceof URLConstructor)
  6021. baseState = getInternalURLState(base);
  6022. else {
  6023. failure = parseURL(baseState = {}, String(base));
  6024. if (failure)
  6025. throw TypeError(failure);
  6026. }
  6027. }
  6028. failure = parseURL(state, urlString, null, baseState);
  6029. if (failure)
  6030. throw TypeError(failure);
  6031. var searchParams = state.searchParams = new URLSearchParams();
  6032. var searchParamsState = getInternalSearchParamsState(searchParams);
  6033. searchParamsState.updateSearchParams(state.query);
  6034. searchParamsState.updateURL = function () {
  6035. state.query = String(searchParams) || null;
  6036. };
  6037. if (!DESCRIPTORS) {
  6038. that.href = serializeURL.call(that);
  6039. that.origin = getOrigin.call(that);
  6040. that.protocol = getProtocol.call(that);
  6041. that.username = getUsername.call(that);
  6042. that.password = getPassword.call(that);
  6043. that.host = getHost.call(that);
  6044. that.hostname = getHostname.call(that);
  6045. that.port = getPort.call(that);
  6046. that.pathname = getPathname.call(that);
  6047. that.search = getSearch.call(that);
  6048. that.searchParams = getSearchParams.call(that);
  6049. that.hash = getHash.call(that);
  6050. }
  6051. };
  6052. var URLPrototype = URLConstructor.prototype;
  6053. var serializeURL = function () {
  6054. var url = getInternalURLState(this);
  6055. var scheme = url.scheme;
  6056. var username = url.username;
  6057. var password = url.password;
  6058. var host = url.host;
  6059. var port = url.port;
  6060. var path = url.path;
  6061. var query = url.query;
  6062. var fragment = url.fragment;
  6063. var output = scheme + ':';
  6064. if (host !== null) {
  6065. output += '//';
  6066. if (includesCredentials(url)) {
  6067. output += username + (password ? ':' + password : '') + '@';
  6068. }
  6069. output += serializeHost(host);
  6070. if (port !== null)
  6071. output += ':' + port;
  6072. } else if (scheme == 'file')
  6073. output += '//';
  6074. output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
  6075. if (query !== null)
  6076. output += '?' + query;
  6077. if (fragment !== null)
  6078. output += '#' + fragment;
  6079. return output;
  6080. };
  6081. var getOrigin = function () {
  6082. var url = getInternalURLState(this);
  6083. var scheme = url.scheme;
  6084. var port = url.port;
  6085. if (scheme == 'blob')
  6086. try {
  6087. return new URL(scheme.path[0]).origin;
  6088. } catch (error) {
  6089. return 'null';
  6090. }
  6091. if (scheme == 'file' || !isSpecial(url))
  6092. return 'null';
  6093. return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');
  6094. };
  6095. var getProtocol = function () {
  6096. return getInternalURLState(this).scheme + ':';
  6097. };
  6098. var getUsername = function () {
  6099. return getInternalURLState(this).username;
  6100. };
  6101. var getPassword = function () {
  6102. return getInternalURLState(this).password;
  6103. };
  6104. var getHost = function () {
  6105. var url = getInternalURLState(this);
  6106. var host = url.host;
  6107. var port = url.port;
  6108. return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port;
  6109. };
  6110. var getHostname = function () {
  6111. var host = getInternalURLState(this).host;
  6112. return host === null ? '' : serializeHost(host);
  6113. };
  6114. var getPort = function () {
  6115. var port = getInternalURLState(this).port;
  6116. return port === null ? '' : String(port);
  6117. };
  6118. var getPathname = function () {
  6119. var url = getInternalURLState(this);
  6120. var path = url.path;
  6121. return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
  6122. };
  6123. var getSearch = function () {
  6124. var query = getInternalURLState(this).query;
  6125. return query ? '?' + query : '';
  6126. };
  6127. var getSearchParams = function () {
  6128. return getInternalURLState(this).searchParams;
  6129. };
  6130. var getHash = function () {
  6131. var fragment = getInternalURLState(this).fragment;
  6132. return fragment ? '#' + fragment : '';
  6133. };
  6134. var accessorDescriptor = function (getter, setter) {
  6135. return {
  6136. get: getter,
  6137. set: setter,
  6138. configurable: true,
  6139. enumerable: true
  6140. };
  6141. };
  6142. if (DESCRIPTORS) {
  6143. defineProperties(URLPrototype, {
  6144. href: accessorDescriptor(serializeURL, function (href) {
  6145. var url = getInternalURLState(this);
  6146. var urlString = String(href);
  6147. var failure = parseURL(url, urlString);
  6148. if (failure)
  6149. throw TypeError(failure);
  6150. getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
  6151. }),
  6152. origin: accessorDescriptor(getOrigin),
  6153. protocol: accessorDescriptor(getProtocol, function (protocol) {
  6154. var url = getInternalURLState(this);
  6155. parseURL(url, String(protocol) + ':', SCHEME_START);
  6156. }),
  6157. username: accessorDescriptor(getUsername, function (username) {
  6158. var url = getInternalURLState(this);
  6159. var codePoints = arrayFrom(String(username));
  6160. if (cannotHaveUsernamePasswordPort(url))
  6161. return;
  6162. url.username = '';
  6163. for (var i = 0; i < codePoints.length; i++) {
  6164. url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
  6165. }
  6166. }),
  6167. password: accessorDescriptor(getPassword, function (password) {
  6168. var url = getInternalURLState(this);
  6169. var codePoints = arrayFrom(String(password));
  6170. if (cannotHaveUsernamePasswordPort(url))
  6171. return;
  6172. url.password = '';
  6173. for (var i = 0; i < codePoints.length; i++) {
  6174. url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
  6175. }
  6176. }),
  6177. host: accessorDescriptor(getHost, function (host) {
  6178. var url = getInternalURLState(this);
  6179. if (url.cannotBeABaseURL)
  6180. return;
  6181. parseURL(url, String(host), HOST);
  6182. }),
  6183. hostname: accessorDescriptor(getHostname, function (hostname) {
  6184. var url = getInternalURLState(this);
  6185. if (url.cannotBeABaseURL)
  6186. return;
  6187. parseURL(url, String(hostname), HOSTNAME);
  6188. }),
  6189. port: accessorDescriptor(getPort, function (port) {
  6190. var url = getInternalURLState(this);
  6191. if (cannotHaveUsernamePasswordPort(url))
  6192. return;
  6193. port = String(port);
  6194. if (port == '')
  6195. url.port = null;
  6196. else
  6197. parseURL(url, port, PORT);
  6198. }),
  6199. pathname: accessorDescriptor(getPathname, function (pathname) {
  6200. var url = getInternalURLState(this);
  6201. if (url.cannotBeABaseURL)
  6202. return;
  6203. url.path = [];
  6204. parseURL(url, pathname + '', PATH_START);
  6205. }),
  6206. search: accessorDescriptor(getSearch, function (search) {
  6207. var url = getInternalURLState(this);
  6208. search = String(search);
  6209. if (search == '') {
  6210. url.query = null;
  6211. } else {
  6212. if ('?' == search.charAt(0))
  6213. search = search.slice(1);
  6214. url.query = '';
  6215. parseURL(url, search, QUERY);
  6216. }
  6217. getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
  6218. }),
  6219. searchParams: accessorDescriptor(getSearchParams),
  6220. hash: accessorDescriptor(getHash, function (hash) {
  6221. var url = getInternalURLState(this);
  6222. hash = String(hash);
  6223. if (hash == '') {
  6224. url.fragment = null;
  6225. return;
  6226. }
  6227. if ('#' == hash.charAt(0))
  6228. hash = hash.slice(1);
  6229. url.fragment = '';
  6230. parseURL(url, hash, FRAGMENT);
  6231. })
  6232. });
  6233. }
  6234. redefine(URLPrototype, 'toJSON', function toJSON() {
  6235. return serializeURL.call(this);
  6236. }, { enumerable: true });
  6237. redefine(URLPrototype, 'toString', function toString() {
  6238. return serializeURL.call(this);
  6239. }, { enumerable: true });
  6240. if (NativeURL) {
  6241. var nativeCreateObjectURL = NativeURL.createObjectURL;
  6242. var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
  6243. if (nativeCreateObjectURL)
  6244. redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {
  6245. return nativeCreateObjectURL.apply(NativeURL, arguments);
  6246. });
  6247. if (nativeRevokeObjectURL)
  6248. redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {
  6249. return nativeRevokeObjectURL.apply(NativeURL, arguments);
  6250. });
  6251. }
  6252. setToStringTag(URLConstructor, 'URL');
  6253. $({
  6254. global: true,
  6255. forced: !USE_NATIVE_URL,
  6256. sham: !DESCRIPTORS
  6257. }, { URL: URLConstructor });
  6258. /***/ }),
  6259. /* 138 */
  6260. /***/ (function(module, exports, __w_pdfjs_require__) {
  6261. var fails = __w_pdfjs_require__(14);
  6262. var wellKnownSymbol = __w_pdfjs_require__(57);
  6263. var IS_PURE = __w_pdfjs_require__(37);
  6264. var ITERATOR = wellKnownSymbol('iterator');
  6265. module.exports = !fails(function () {
  6266. var url = new URL('b?a=1&b=2&c=3', 'http://a');
  6267. var searchParams = url.searchParams;
  6268. var result = '';
  6269. url.pathname = 'c%20d';
  6270. searchParams.forEach(function (value, key) {
  6271. searchParams['delete']('b');
  6272. result += key + value;
  6273. });
  6274. return IS_PURE && !url.toJSON || !searchParams.sort || url.href !== 'http://a/c%20d?a=1&c=3' || searchParams.get('c') !== '3' || String(new URLSearchParams('?a=1')) !== 'a=1' || !searchParams[ITERATOR] || new URL('https://a@b').username !== 'a' || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' || new URL('http://тест').host !== 'xn--e1aybc' || new URL('http://a#б').hash !== '#%D0%B1' || result !== 'a1c3' || new URL('http://x', undefined).host !== 'x';
  6275. });
  6276. /***/ }),
  6277. /* 139 */
  6278. /***/ (function(module, exports, __w_pdfjs_require__) {
  6279. "use strict";
  6280. var maxInt = 2147483647;
  6281. var base = 36;
  6282. var tMin = 1;
  6283. var tMax = 26;
  6284. var skew = 38;
  6285. var damp = 700;
  6286. var initialBias = 72;
  6287. var initialN = 128;
  6288. var delimiter = '-';
  6289. var regexNonASCII = /[^\0-\u007E]/;
  6290. var regexSeparators = /[.\u3002\uFF0E\uFF61]/g;
  6291. var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
  6292. var baseMinusTMin = base - tMin;
  6293. var floor = Math.floor;
  6294. var stringFromCharCode = String.fromCharCode;
  6295. var ucs2decode = function (string) {
  6296. var output = [];
  6297. var counter = 0;
  6298. var length = string.length;
  6299. while (counter < length) {
  6300. var value = string.charCodeAt(counter++);
  6301. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  6302. var extra = string.charCodeAt(counter++);
  6303. if ((extra & 0xFC00) == 0xDC00) {
  6304. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  6305. } else {
  6306. output.push(value);
  6307. counter--;
  6308. }
  6309. } else {
  6310. output.push(value);
  6311. }
  6312. }
  6313. return output;
  6314. };
  6315. var digitToBasic = function (digit) {
  6316. return digit + 22 + 75 * (digit < 26);
  6317. };
  6318. var adapt = function (delta, numPoints, firstTime) {
  6319. var k = 0;
  6320. delta = firstTime ? floor(delta / damp) : delta >> 1;
  6321. delta += floor(delta / numPoints);
  6322. for (; delta > baseMinusTMin * tMax >> 1; k += base) {
  6323. delta = floor(delta / baseMinusTMin);
  6324. }
  6325. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  6326. };
  6327. var encode = function (input) {
  6328. var output = [];
  6329. input = ucs2decode(input);
  6330. var inputLength = input.length;
  6331. var n = initialN;
  6332. var delta = 0;
  6333. var bias = initialBias;
  6334. var i, currentValue;
  6335. for (i = 0; i < input.length; i++) {
  6336. currentValue = input[i];
  6337. if (currentValue < 0x80) {
  6338. output.push(stringFromCharCode(currentValue));
  6339. }
  6340. }
  6341. var basicLength = output.length;
  6342. var handledCPCount = basicLength;
  6343. if (basicLength) {
  6344. output.push(delimiter);
  6345. }
  6346. while (handledCPCount < inputLength) {
  6347. var m = maxInt;
  6348. for (i = 0; i < input.length; i++) {
  6349. currentValue = input[i];
  6350. if (currentValue >= n && currentValue < m) {
  6351. m = currentValue;
  6352. }
  6353. }
  6354. var handledCPCountPlusOne = handledCPCount + 1;
  6355. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  6356. throw RangeError(OVERFLOW_ERROR);
  6357. }
  6358. delta += (m - n) * handledCPCountPlusOne;
  6359. n = m;
  6360. for (i = 0; i < input.length; i++) {
  6361. currentValue = input[i];
  6362. if (currentValue < n && ++delta > maxInt) {
  6363. throw RangeError(OVERFLOW_ERROR);
  6364. }
  6365. if (currentValue == n) {
  6366. var q = delta;
  6367. for (var k = base;; k += base) {
  6368. var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  6369. if (q < t)
  6370. break;
  6371. var qMinusT = q - t;
  6372. var baseMinusT = base - t;
  6373. output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
  6374. q = floor(qMinusT / baseMinusT);
  6375. }
  6376. output.push(stringFromCharCode(digitToBasic(q)));
  6377. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  6378. delta = 0;
  6379. ++handledCPCount;
  6380. }
  6381. }
  6382. ++delta;
  6383. ++n;
  6384. }
  6385. return output.join('');
  6386. };
  6387. module.exports = function (input) {
  6388. var encoded = [];
  6389. var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.');
  6390. var i, label;
  6391. for (i = 0; i < labels.length; i++) {
  6392. label = labels[i];
  6393. encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
  6394. }
  6395. return encoded.join('.');
  6396. };
  6397. /***/ }),
  6398. /* 140 */
  6399. /***/ (function(module, exports, __w_pdfjs_require__) {
  6400. "use strict";
  6401. __w_pdfjs_require__(118);
  6402. var $ = __w_pdfjs_require__(10);
  6403. var getBuiltIn = __w_pdfjs_require__(42);
  6404. var USE_NATIVE_URL = __w_pdfjs_require__(138);
  6405. var redefine = __w_pdfjs_require__(29);
  6406. var redefineAll = __w_pdfjs_require__(121);
  6407. var setToStringTag = __w_pdfjs_require__(85);
  6408. var createIteratorConstructor = __w_pdfjs_require__(80);
  6409. var InternalStateModule = __w_pdfjs_require__(33);
  6410. var anInstance = __w_pdfjs_require__(123);
  6411. var hasOwn = __w_pdfjs_require__(23);
  6412. var bind = __w_pdfjs_require__(62);
  6413. var classof = __w_pdfjs_require__(95);
  6414. var anObject = __w_pdfjs_require__(28);
  6415. var isObject = __w_pdfjs_require__(22);
  6416. var create = __w_pdfjs_require__(71);
  6417. var createPropertyDescriptor = __w_pdfjs_require__(16);
  6418. var getIterator = __w_pdfjs_require__(141);
  6419. var getIteratorMethod = __w_pdfjs_require__(94);
  6420. var wellKnownSymbol = __w_pdfjs_require__(57);
  6421. var $fetch = getBuiltIn('fetch');
  6422. var Headers = getBuiltIn('Headers');
  6423. var ITERATOR = wellKnownSymbol('iterator');
  6424. var URL_SEARCH_PARAMS = 'URLSearchParams';
  6425. var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
  6426. var setInternalState = InternalStateModule.set;
  6427. var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
  6428. var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
  6429. var plus = /\+/g;
  6430. var sequences = Array(4);
  6431. var percentSequence = function (bytes) {
  6432. return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
  6433. };
  6434. var percentDecode = function (sequence) {
  6435. try {
  6436. return decodeURIComponent(sequence);
  6437. } catch (error) {
  6438. return sequence;
  6439. }
  6440. };
  6441. var deserialize = function (it) {
  6442. var result = it.replace(plus, ' ');
  6443. var bytes = 4;
  6444. try {
  6445. return decodeURIComponent(result);
  6446. } catch (error) {
  6447. while (bytes) {
  6448. result = result.replace(percentSequence(bytes--), percentDecode);
  6449. }
  6450. return result;
  6451. }
  6452. };
  6453. var find = /[!'()~]|%20/g;
  6454. var replace = {
  6455. '!': '%21',
  6456. "'": '%27',
  6457. '(': '%28',
  6458. ')': '%29',
  6459. '~': '%7E',
  6460. '%20': '+'
  6461. };
  6462. var replacer = function (match) {
  6463. return replace[match];
  6464. };
  6465. var serialize = function (it) {
  6466. return encodeURIComponent(it).replace(find, replacer);
  6467. };
  6468. var parseSearchParams = function (result, query) {
  6469. if (query) {
  6470. var attributes = query.split('&');
  6471. var index = 0;
  6472. var attribute, entry;
  6473. while (index < attributes.length) {
  6474. attribute = attributes[index++];
  6475. if (attribute.length) {
  6476. entry = attribute.split('=');
  6477. result.push({
  6478. key: deserialize(entry.shift()),
  6479. value: deserialize(entry.join('='))
  6480. });
  6481. }
  6482. }
  6483. }
  6484. };
  6485. var updateSearchParams = function (query) {
  6486. this.entries.length = 0;
  6487. parseSearchParams(this.entries, query);
  6488. };
  6489. var validateArgumentsLength = function (passed, required) {
  6490. if (passed < required)
  6491. throw TypeError('Not enough arguments');
  6492. };
  6493. var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
  6494. setInternalState(this, {
  6495. type: URL_SEARCH_PARAMS_ITERATOR,
  6496. iterator: getIterator(getInternalParamsState(params).entries),
  6497. kind: kind
  6498. });
  6499. }, 'Iterator', function next() {
  6500. var state = getInternalIteratorState(this);
  6501. var kind = state.kind;
  6502. var step = state.iterator.next();
  6503. var entry = step.value;
  6504. if (!step.done) {
  6505. step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [
  6506. entry.key,
  6507. entry.value
  6508. ];
  6509. }
  6510. return step;
  6511. });
  6512. var URLSearchParamsConstructor = function URLSearchParams() {
  6513. anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
  6514. var init = arguments.length > 0 ? arguments[0] : undefined;
  6515. var that = this;
  6516. var entries = [];
  6517. var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
  6518. setInternalState(that, {
  6519. type: URL_SEARCH_PARAMS,
  6520. entries: entries,
  6521. updateURL: function () {
  6522. },
  6523. updateSearchParams: updateSearchParams
  6524. });
  6525. if (init !== undefined) {
  6526. if (isObject(init)) {
  6527. iteratorMethod = getIteratorMethod(init);
  6528. if (typeof iteratorMethod === 'function') {
  6529. iterator = iteratorMethod.call(init);
  6530. next = iterator.next;
  6531. while (!(step = next.call(iterator)).done) {
  6532. entryIterator = getIterator(anObject(step.value));
  6533. entryNext = entryIterator.next;
  6534. if ((first = entryNext.call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done)
  6535. throw TypeError('Expected sequence with length 2');
  6536. entries.push({
  6537. key: first.value + '',
  6538. value: second.value + ''
  6539. });
  6540. }
  6541. } else
  6542. for (key in init)
  6543. if (hasOwn(init, key))
  6544. entries.push({
  6545. key: key,
  6546. value: init[key] + ''
  6547. });
  6548. } else {
  6549. parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
  6550. }
  6551. }
  6552. };
  6553. var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
  6554. redefineAll(URLSearchParamsPrototype, {
  6555. append: function append(name, value) {
  6556. validateArgumentsLength(arguments.length, 2);
  6557. var state = getInternalParamsState(this);
  6558. state.entries.push({
  6559. key: name + '',
  6560. value: value + ''
  6561. });
  6562. state.updateURL();
  6563. },
  6564. 'delete': function (name) {
  6565. validateArgumentsLength(arguments.length, 1);
  6566. var state = getInternalParamsState(this);
  6567. var entries = state.entries;
  6568. var key = name + '';
  6569. var index = 0;
  6570. while (index < entries.length) {
  6571. if (entries[index].key === key)
  6572. entries.splice(index, 1);
  6573. else
  6574. index++;
  6575. }
  6576. state.updateURL();
  6577. },
  6578. get: function get(name) {
  6579. validateArgumentsLength(arguments.length, 1);
  6580. var entries = getInternalParamsState(this).entries;
  6581. var key = name + '';
  6582. var index = 0;
  6583. for (; index < entries.length; index++) {
  6584. if (entries[index].key === key)
  6585. return entries[index].value;
  6586. }
  6587. return null;
  6588. },
  6589. getAll: function getAll(name) {
  6590. validateArgumentsLength(arguments.length, 1);
  6591. var entries = getInternalParamsState(this).entries;
  6592. var key = name + '';
  6593. var result = [];
  6594. var index = 0;
  6595. for (; index < entries.length; index++) {
  6596. if (entries[index].key === key)
  6597. result.push(entries[index].value);
  6598. }
  6599. return result;
  6600. },
  6601. has: function has(name) {
  6602. validateArgumentsLength(arguments.length, 1);
  6603. var entries = getInternalParamsState(this).entries;
  6604. var key = name + '';
  6605. var index = 0;
  6606. while (index < entries.length) {
  6607. if (entries[index++].key === key)
  6608. return true;
  6609. }
  6610. return false;
  6611. },
  6612. set: function set(name, value) {
  6613. validateArgumentsLength(arguments.length, 1);
  6614. var state = getInternalParamsState(this);
  6615. var entries = state.entries;
  6616. var found = false;
  6617. var key = name + '';
  6618. var val = value + '';
  6619. var index = 0;
  6620. var entry;
  6621. for (; index < entries.length; index++) {
  6622. entry = entries[index];
  6623. if (entry.key === key) {
  6624. if (found)
  6625. entries.splice(index--, 1);
  6626. else {
  6627. found = true;
  6628. entry.value = val;
  6629. }
  6630. }
  6631. }
  6632. if (!found)
  6633. entries.push({
  6634. key: key,
  6635. value: val
  6636. });
  6637. state.updateURL();
  6638. },
  6639. sort: function sort() {
  6640. var state = getInternalParamsState(this);
  6641. var entries = state.entries;
  6642. var slice = entries.slice();
  6643. var entry, entriesIndex, sliceIndex;
  6644. entries.length = 0;
  6645. for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {
  6646. entry = slice[sliceIndex];
  6647. for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {
  6648. if (entries[entriesIndex].key > entry.key) {
  6649. entries.splice(entriesIndex, 0, entry);
  6650. break;
  6651. }
  6652. }
  6653. if (entriesIndex === sliceIndex)
  6654. entries.push(entry);
  6655. }
  6656. state.updateURL();
  6657. },
  6658. forEach: function forEach(callback) {
  6659. var entries = getInternalParamsState(this).entries;
  6660. var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3);
  6661. var index = 0;
  6662. var entry;
  6663. while (index < entries.length) {
  6664. entry = entries[index++];
  6665. boundFunction(entry.value, entry.key, this);
  6666. }
  6667. },
  6668. keys: function keys() {
  6669. return new URLSearchParamsIterator(this, 'keys');
  6670. },
  6671. values: function values() {
  6672. return new URLSearchParamsIterator(this, 'values');
  6673. },
  6674. entries: function entries() {
  6675. return new URLSearchParamsIterator(this, 'entries');
  6676. }
  6677. }, { enumerable: true });
  6678. redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries);
  6679. redefine(URLSearchParamsPrototype, 'toString', function toString() {
  6680. var entries = getInternalParamsState(this).entries;
  6681. var result = [];
  6682. var index = 0;
  6683. var entry;
  6684. while (index < entries.length) {
  6685. entry = entries[index++];
  6686. result.push(serialize(entry.key) + '=' + serialize(entry.value));
  6687. }
  6688. return result.join('&');
  6689. }, { enumerable: true });
  6690. setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
  6691. $({
  6692. global: true,
  6693. forced: !USE_NATIVE_URL
  6694. }, { URLSearchParams: URLSearchParamsConstructor });
  6695. if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') {
  6696. $({
  6697. global: true,
  6698. enumerable: true,
  6699. forced: true
  6700. }, {
  6701. fetch: function fetch(input) {
  6702. var args = [input];
  6703. var init, body, headers;
  6704. if (arguments.length > 1) {
  6705. init = arguments[1];
  6706. if (isObject(init)) {
  6707. body = init.body;
  6708. if (classof(body) === URL_SEARCH_PARAMS) {
  6709. headers = init.headers ? new Headers(init.headers) : new Headers();
  6710. if (!headers.has('content-type')) {
  6711. headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
  6712. }
  6713. init = create(init, {
  6714. body: createPropertyDescriptor(0, String(body)),
  6715. headers: createPropertyDescriptor(0, headers)
  6716. });
  6717. }
  6718. }
  6719. args.push(init);
  6720. }
  6721. return $fetch.apply(this, args);
  6722. }
  6723. });
  6724. }
  6725. module.exports = {
  6726. URLSearchParams: URLSearchParamsConstructor,
  6727. getState: getInternalParamsState
  6728. };
  6729. /***/ }),
  6730. /* 141 */
  6731. /***/ (function(module, exports, __w_pdfjs_require__) {
  6732. var anObject = __w_pdfjs_require__(28);
  6733. var getIteratorMethod = __w_pdfjs_require__(94);
  6734. module.exports = function (it) {
  6735. var iteratorMethod = getIteratorMethod(it);
  6736. if (typeof iteratorMethod != 'function') {
  6737. throw TypeError(String(it) + ' is not iterable');
  6738. }
  6739. return anObject(iteratorMethod.call(it));
  6740. };
  6741. /***/ }),
  6742. /* 142 */
  6743. /***/ (function(module, exports, __w_pdfjs_require__) {
  6744. "use strict";
  6745. var $ = __w_pdfjs_require__(10);
  6746. $({
  6747. target: 'URL',
  6748. proto: true,
  6749. enumerable: true
  6750. }, {
  6751. toJSON: function toJSON() {
  6752. return URL.prototype.toString.call(this);
  6753. }
  6754. });
  6755. /***/ }),
  6756. /* 143 */
  6757. /***/ (function(module, exports, __w_pdfjs_require__) {
  6758. (function (global, factory) {
  6759. true ? factory(exports) : undefined;
  6760. }(this, function (exports) {
  6761. 'use strict';
  6762. var SymbolPolyfill = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol : function (description) {
  6763. return "Symbol(" + description + ")";
  6764. };
  6765. function noop() {
  6766. }
  6767. var NumberIsNaN = Number.isNaN || function (x) {
  6768. return x !== x;
  6769. };
  6770. var rethrowAssertionErrorRejection = noop;
  6771. function typeIsObject(x) {
  6772. return typeof x === 'object' && x !== null || typeof x === 'function';
  6773. }
  6774. function createArrayFromList(elements) {
  6775. return elements.slice();
  6776. }
  6777. function ArrayBufferCopy(dest, destOffset, src, srcOffset, n) {
  6778. new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
  6779. }
  6780. function IsFiniteNonNegativeNumber(v) {
  6781. if (IsNonNegativeNumber(v) === false) {
  6782. return false;
  6783. }
  6784. if (v === Infinity) {
  6785. return false;
  6786. }
  6787. return true;
  6788. }
  6789. function IsNonNegativeNumber(v) {
  6790. if (typeof v !== 'number') {
  6791. return false;
  6792. }
  6793. if (NumberIsNaN(v)) {
  6794. return false;
  6795. }
  6796. if (v < 0) {
  6797. return false;
  6798. }
  6799. return true;
  6800. }
  6801. function Call(F, V, args) {
  6802. if (typeof F !== 'function') {
  6803. throw new TypeError('Argument is not a function');
  6804. }
  6805. return Function.prototype.apply.call(F, V, args);
  6806. }
  6807. function CreateAlgorithmFromUnderlyingMethod(underlyingObject, methodName, algoArgCount, extraArgs) {
  6808. var method = underlyingObject[methodName];
  6809. if (method !== undefined) {
  6810. if (typeof method !== 'function') {
  6811. throw new TypeError(method + " is not a method");
  6812. }
  6813. switch (algoArgCount) {
  6814. case 0: {
  6815. return function () {
  6816. return PromiseCall(method, underlyingObject, extraArgs);
  6817. };
  6818. }
  6819. case 1: {
  6820. return function (arg) {
  6821. var fullArgs = [arg].concat(extraArgs);
  6822. return PromiseCall(method, underlyingObject, fullArgs);
  6823. };
  6824. }
  6825. }
  6826. }
  6827. return function () {
  6828. return promiseResolvedWith(undefined);
  6829. };
  6830. }
  6831. function InvokeOrNoop(O, P, args) {
  6832. var method = O[P];
  6833. if (method === undefined) {
  6834. return undefined;
  6835. }
  6836. return Call(method, O, args);
  6837. }
  6838. function PromiseCall(F, V, args) {
  6839. try {
  6840. return promiseResolvedWith(Call(F, V, args));
  6841. } catch (value) {
  6842. return promiseRejectedWith(value);
  6843. }
  6844. }
  6845. function TransferArrayBuffer(O) {
  6846. return O;
  6847. }
  6848. function IsDetachedBuffer(O) {
  6849. return false;
  6850. }
  6851. function ValidateAndNormalizeHighWaterMark(highWaterMark) {
  6852. highWaterMark = Number(highWaterMark);
  6853. if (NumberIsNaN(highWaterMark) || highWaterMark < 0) {
  6854. throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN');
  6855. }
  6856. return highWaterMark;
  6857. }
  6858. function MakeSizeAlgorithmFromSizeFunction(size) {
  6859. if (size === undefined) {
  6860. return function () {
  6861. return 1;
  6862. };
  6863. }
  6864. if (typeof size !== 'function') {
  6865. throw new TypeError('size property of a queuing strategy must be a function');
  6866. }
  6867. return function (chunk) {
  6868. return size(chunk);
  6869. };
  6870. }
  6871. var originalPromise = Promise;
  6872. var originalPromiseThen = Promise.prototype.then;
  6873. var originalPromiseResolve = Promise.resolve.bind(originalPromise);
  6874. var originalPromiseReject = Promise.reject.bind(originalPromise);
  6875. function newPromise(executor) {
  6876. return new originalPromise(executor);
  6877. }
  6878. function promiseResolvedWith(value) {
  6879. return originalPromiseResolve(value);
  6880. }
  6881. function promiseRejectedWith(reason) {
  6882. return originalPromiseReject(reason);
  6883. }
  6884. function PerformPromiseThen(promise, onFulfilled, onRejected) {
  6885. return originalPromiseThen.call(promise, onFulfilled, onRejected);
  6886. }
  6887. function uponPromise(promise, onFulfilled, onRejected) {
  6888. PerformPromiseThen(PerformPromiseThen(promise, onFulfilled, onRejected), undefined, rethrowAssertionErrorRejection);
  6889. }
  6890. function uponFulfillment(promise, onFulfilled) {
  6891. uponPromise(promise, onFulfilled);
  6892. }
  6893. function uponRejection(promise, onRejected) {
  6894. uponPromise(promise, undefined, onRejected);
  6895. }
  6896. function transformPromiseWith(promise, fulfillmentHandler, rejectionHandler) {
  6897. return PerformPromiseThen(promise, fulfillmentHandler, rejectionHandler);
  6898. }
  6899. function setPromiseIsHandledToTrue(promise) {
  6900. PerformPromiseThen(promise, undefined, rethrowAssertionErrorRejection);
  6901. }
  6902. var QUEUE_MAX_ARRAY_SIZE = 16384;
  6903. var SimpleQueue = function () {
  6904. function SimpleQueue() {
  6905. this._cursor = 0;
  6906. this._size = 0;
  6907. this._front = {
  6908. _elements: [],
  6909. _next: undefined
  6910. };
  6911. this._back = this._front;
  6912. this._cursor = 0;
  6913. this._size = 0;
  6914. }
  6915. Object.defineProperty(SimpleQueue.prototype, "length", {
  6916. get: function () {
  6917. return this._size;
  6918. },
  6919. enumerable: true,
  6920. configurable: true
  6921. });
  6922. SimpleQueue.prototype.push = function (element) {
  6923. var oldBack = this._back;
  6924. var newBack = oldBack;
  6925. if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {
  6926. newBack = {
  6927. _elements: [],
  6928. _next: undefined
  6929. };
  6930. }
  6931. oldBack._elements.push(element);
  6932. if (newBack !== oldBack) {
  6933. this._back = newBack;
  6934. oldBack._next = newBack;
  6935. }
  6936. ++this._size;
  6937. };
  6938. SimpleQueue.prototype.shift = function () {
  6939. var oldFront = this._front;
  6940. var newFront = oldFront;
  6941. var oldCursor = this._cursor;
  6942. var newCursor = oldCursor + 1;
  6943. var elements = oldFront._elements;
  6944. var element = elements[oldCursor];
  6945. if (newCursor === QUEUE_MAX_ARRAY_SIZE) {
  6946. newFront = oldFront._next;
  6947. newCursor = 0;
  6948. }
  6949. --this._size;
  6950. this._cursor = newCursor;
  6951. if (oldFront !== newFront) {
  6952. this._front = newFront;
  6953. }
  6954. elements[oldCursor] = undefined;
  6955. return element;
  6956. };
  6957. SimpleQueue.prototype.forEach = function (callback) {
  6958. var i = this._cursor;
  6959. var node = this._front;
  6960. var elements = node._elements;
  6961. while (i !== elements.length || node._next !== undefined) {
  6962. if (i === elements.length) {
  6963. node = node._next;
  6964. elements = node._elements;
  6965. i = 0;
  6966. if (elements.length === 0) {
  6967. break;
  6968. }
  6969. }
  6970. callback(elements[i]);
  6971. ++i;
  6972. }
  6973. };
  6974. SimpleQueue.prototype.peek = function () {
  6975. var front = this._front;
  6976. var cursor = this._cursor;
  6977. return front._elements[cursor];
  6978. };
  6979. return SimpleQueue;
  6980. }();
  6981. function ReadableStreamCreateReadResult(value, done, forAuthorCode) {
  6982. var prototype = null;
  6983. if (forAuthorCode === true) {
  6984. prototype = Object.prototype;
  6985. }
  6986. var obj = Object.create(prototype);
  6987. obj.value = value;
  6988. obj.done = done;
  6989. return obj;
  6990. }
  6991. function ReadableStreamReaderGenericInitialize(reader, stream) {
  6992. reader._forAuthorCode = true;
  6993. reader._ownerReadableStream = stream;
  6994. stream._reader = reader;
  6995. if (stream._state === 'readable') {
  6996. defaultReaderClosedPromiseInitialize(reader);
  6997. } else if (stream._state === 'closed') {
  6998. defaultReaderClosedPromiseInitializeAsResolved(reader);
  6999. } else {
  7000. defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);
  7001. }
  7002. }
  7003. function ReadableStreamReaderGenericCancel(reader, reason) {
  7004. var stream = reader._ownerReadableStream;
  7005. return ReadableStreamCancel(stream, reason);
  7006. }
  7007. function ReadableStreamReaderGenericRelease(reader) {
  7008. if (reader._ownerReadableStream._state === 'readable') {
  7009. defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
  7010. } else {
  7011. defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
  7012. }
  7013. reader._ownerReadableStream._reader = undefined;
  7014. reader._ownerReadableStream = undefined;
  7015. }
  7016. function readerLockException(name) {
  7017. return new TypeError('Cannot ' + name + ' a stream using a released reader');
  7018. }
  7019. function defaultReaderClosedPromiseInitialize(reader) {
  7020. reader._closedPromise = newPromise(function (resolve, reject) {
  7021. reader._closedPromise_resolve = resolve;
  7022. reader._closedPromise_reject = reject;
  7023. });
  7024. }
  7025. function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
  7026. defaultReaderClosedPromiseInitialize(reader);
  7027. defaultReaderClosedPromiseReject(reader, reason);
  7028. }
  7029. function defaultReaderClosedPromiseInitializeAsResolved(reader) {
  7030. defaultReaderClosedPromiseInitialize(reader);
  7031. defaultReaderClosedPromiseResolve(reader);
  7032. }
  7033. function defaultReaderClosedPromiseReject(reader, reason) {
  7034. setPromiseIsHandledToTrue(reader._closedPromise);
  7035. reader._closedPromise_reject(reason);
  7036. reader._closedPromise_resolve = undefined;
  7037. reader._closedPromise_reject = undefined;
  7038. }
  7039. function defaultReaderClosedPromiseResetToRejected(reader, reason) {
  7040. defaultReaderClosedPromiseInitializeAsRejected(reader, reason);
  7041. }
  7042. function defaultReaderClosedPromiseResolve(reader) {
  7043. reader._closedPromise_resolve(undefined);
  7044. reader._closedPromise_resolve = undefined;
  7045. reader._closedPromise_reject = undefined;
  7046. }
  7047. var CancelSteps = SymbolPolyfill('[[CancelSteps]]');
  7048. var PullSteps = SymbolPolyfill('[[PullSteps]]');
  7049. function AcquireReadableStreamDefaultReader(stream, forAuthorCode) {
  7050. if (forAuthorCode === void 0) {
  7051. forAuthorCode = false;
  7052. }
  7053. var reader = new ReadableStreamDefaultReader(stream);
  7054. reader._forAuthorCode = forAuthorCode;
  7055. return reader;
  7056. }
  7057. function ReadableStreamAddReadRequest(stream) {
  7058. var promise = newPromise(function (resolve, reject) {
  7059. var readRequest = {
  7060. _resolve: resolve,
  7061. _reject: reject
  7062. };
  7063. stream._reader._readRequests.push(readRequest);
  7064. });
  7065. return promise;
  7066. }
  7067. function ReadableStreamFulfillReadRequest(stream, chunk, done) {
  7068. var reader = stream._reader;
  7069. var readRequest = reader._readRequests.shift();
  7070. readRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode));
  7071. }
  7072. function ReadableStreamGetNumReadRequests(stream) {
  7073. return stream._reader._readRequests.length;
  7074. }
  7075. function ReadableStreamHasDefaultReader(stream) {
  7076. var reader = stream._reader;
  7077. if (reader === undefined) {
  7078. return false;
  7079. }
  7080. if (!IsReadableStreamDefaultReader(reader)) {
  7081. return false;
  7082. }
  7083. return true;
  7084. }
  7085. var ReadableStreamDefaultReader = function () {
  7086. function ReadableStreamDefaultReader(stream) {
  7087. if (IsReadableStream(stream) === false) {
  7088. throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance');
  7089. }
  7090. if (IsReadableStreamLocked(stream) === true) {
  7091. throw new TypeError('This stream has already been locked for exclusive reading by another reader');
  7092. }
  7093. ReadableStreamReaderGenericInitialize(this, stream);
  7094. this._readRequests = new SimpleQueue();
  7095. }
  7096. Object.defineProperty(ReadableStreamDefaultReader.prototype, "closed", {
  7097. get: function () {
  7098. if (!IsReadableStreamDefaultReader(this)) {
  7099. return promiseRejectedWith(defaultReaderBrandCheckException('closed'));
  7100. }
  7101. return this._closedPromise;
  7102. },
  7103. enumerable: true,
  7104. configurable: true
  7105. });
  7106. ReadableStreamDefaultReader.prototype.cancel = function (reason) {
  7107. if (!IsReadableStreamDefaultReader(this)) {
  7108. return promiseRejectedWith(defaultReaderBrandCheckException('cancel'));
  7109. }
  7110. if (this._ownerReadableStream === undefined) {
  7111. return promiseRejectedWith(readerLockException('cancel'));
  7112. }
  7113. return ReadableStreamReaderGenericCancel(this, reason);
  7114. };
  7115. ReadableStreamDefaultReader.prototype.read = function () {
  7116. if (!IsReadableStreamDefaultReader(this)) {
  7117. return promiseRejectedWith(defaultReaderBrandCheckException('read'));
  7118. }
  7119. if (this._ownerReadableStream === undefined) {
  7120. return promiseRejectedWith(readerLockException('read from'));
  7121. }
  7122. return ReadableStreamDefaultReaderRead(this);
  7123. };
  7124. ReadableStreamDefaultReader.prototype.releaseLock = function () {
  7125. if (!IsReadableStreamDefaultReader(this)) {
  7126. throw defaultReaderBrandCheckException('releaseLock');
  7127. }
  7128. if (this._ownerReadableStream === undefined) {
  7129. return;
  7130. }
  7131. if (this._readRequests.length > 0) {
  7132. throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
  7133. }
  7134. ReadableStreamReaderGenericRelease(this);
  7135. };
  7136. return ReadableStreamDefaultReader;
  7137. }();
  7138. function IsReadableStreamDefaultReader(x) {
  7139. if (!typeIsObject(x)) {
  7140. return false;
  7141. }
  7142. if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {
  7143. return false;
  7144. }
  7145. return true;
  7146. }
  7147. function ReadableStreamDefaultReaderRead(reader) {
  7148. var stream = reader._ownerReadableStream;
  7149. stream._disturbed = true;
  7150. if (stream._state === 'closed') {
  7151. return promiseResolvedWith(ReadableStreamCreateReadResult(undefined, true, reader._forAuthorCode));
  7152. }
  7153. if (stream._state === 'errored') {
  7154. return promiseRejectedWith(stream._storedError);
  7155. }
  7156. return stream._readableStreamController[PullSteps]();
  7157. }
  7158. function defaultReaderBrandCheckException(name) {
  7159. return new TypeError("ReadableStreamDefaultReader.prototype." + name + " can only be used on a ReadableStreamDefaultReader");
  7160. }
  7161. var _a;
  7162. var AsyncIteratorPrototype;
  7163. if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
  7164. AsyncIteratorPrototype = (_a = {}, _a[SymbolPolyfill.asyncIterator] = function () {
  7165. return this;
  7166. }, _a);
  7167. Object.defineProperty(AsyncIteratorPrototype, SymbolPolyfill.asyncIterator, { enumerable: false });
  7168. }
  7169. var ReadableStreamAsyncIteratorPrototype = {
  7170. next: function () {
  7171. if (IsReadableStreamAsyncIterator(this) === false) {
  7172. return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));
  7173. }
  7174. var reader = this._asyncIteratorReader;
  7175. if (reader._ownerReadableStream === undefined) {
  7176. return promiseRejectedWith(readerLockException('iterate'));
  7177. }
  7178. return transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function (result) {
  7179. var done = result.done;
  7180. if (done) {
  7181. ReadableStreamReaderGenericRelease(reader);
  7182. }
  7183. var value = result.value;
  7184. return ReadableStreamCreateReadResult(value, done, true);
  7185. });
  7186. },
  7187. return: function (value) {
  7188. if (IsReadableStreamAsyncIterator(this) === false) {
  7189. return promiseRejectedWith(streamAsyncIteratorBrandCheckException('next'));
  7190. }
  7191. var reader = this._asyncIteratorReader;
  7192. if (reader._ownerReadableStream === undefined) {
  7193. return promiseRejectedWith(readerLockException('finish iterating'));
  7194. }
  7195. if (reader._readRequests.length > 0) {
  7196. return promiseRejectedWith(new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'));
  7197. }
  7198. if (this._preventCancel === false) {
  7199. var result = ReadableStreamReaderGenericCancel(reader, value);
  7200. ReadableStreamReaderGenericRelease(reader);
  7201. return transformPromiseWith(result, function () {
  7202. return ReadableStreamCreateReadResult(value, true, true);
  7203. });
  7204. }
  7205. ReadableStreamReaderGenericRelease(reader);
  7206. return promiseResolvedWith(ReadableStreamCreateReadResult(value, true, true));
  7207. }
  7208. };
  7209. if (AsyncIteratorPrototype !== undefined) {
  7210. Object.setPrototypeOf(ReadableStreamAsyncIteratorPrototype, AsyncIteratorPrototype);
  7211. }
  7212. Object.defineProperty(ReadableStreamAsyncIteratorPrototype, 'next', { enumerable: false });
  7213. Object.defineProperty(ReadableStreamAsyncIteratorPrototype, 'return', { enumerable: false });
  7214. function AcquireReadableStreamAsyncIterator(stream, preventCancel) {
  7215. if (preventCancel === void 0) {
  7216. preventCancel = false;
  7217. }
  7218. var reader = AcquireReadableStreamDefaultReader(stream);
  7219. var iterator = Object.create(ReadableStreamAsyncIteratorPrototype);
  7220. iterator._asyncIteratorReader = reader;
  7221. iterator._preventCancel = Boolean(preventCancel);
  7222. return iterator;
  7223. }
  7224. function IsReadableStreamAsyncIterator(x) {
  7225. if (!typeIsObject(x)) {
  7226. return false;
  7227. }
  7228. if (!Object.prototype.hasOwnProperty.call(x, '_asyncIteratorReader')) {
  7229. return false;
  7230. }
  7231. return true;
  7232. }
  7233. function streamAsyncIteratorBrandCheckException(name) {
  7234. return new TypeError("ReadableStreamAsyncIterator." + name + " can only be used on a ReadableSteamAsyncIterator");
  7235. }
  7236. function DequeueValue(container) {
  7237. var pair = container._queue.shift();
  7238. container._queueTotalSize -= pair.size;
  7239. if (container._queueTotalSize < 0) {
  7240. container._queueTotalSize = 0;
  7241. }
  7242. return pair.value;
  7243. }
  7244. function EnqueueValueWithSize(container, value, size) {
  7245. size = Number(size);
  7246. if (!IsFiniteNonNegativeNumber(size)) {
  7247. throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
  7248. }
  7249. container._queue.push({
  7250. value: value,
  7251. size: size
  7252. });
  7253. container._queueTotalSize += size;
  7254. }
  7255. function PeekQueueValue(container) {
  7256. var pair = container._queue.peek();
  7257. return pair.value;
  7258. }
  7259. function ResetQueue(container) {
  7260. container._queue = new SimpleQueue();
  7261. container._queueTotalSize = 0;
  7262. }
  7263. var AbortSteps = SymbolPolyfill('[[AbortSteps]]');
  7264. var ErrorSteps = SymbolPolyfill('[[ErrorSteps]]');
  7265. var WritableStream = function () {
  7266. function WritableStream(underlyingSink, strategy) {
  7267. if (underlyingSink === void 0) {
  7268. underlyingSink = {};
  7269. }
  7270. if (strategy === void 0) {
  7271. strategy = {};
  7272. }
  7273. InitializeWritableStream(this);
  7274. var size = strategy.size;
  7275. var highWaterMark = strategy.highWaterMark;
  7276. var type = underlyingSink.type;
  7277. if (type !== undefined) {
  7278. throw new RangeError('Invalid type is specified');
  7279. }
  7280. var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
  7281. if (highWaterMark === undefined) {
  7282. highWaterMark = 1;
  7283. }
  7284. highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
  7285. SetUpWritableStreamDefaultControllerFromUnderlyingSink(this, underlyingSink, highWaterMark, sizeAlgorithm);
  7286. }
  7287. Object.defineProperty(WritableStream.prototype, "locked", {
  7288. get: function () {
  7289. if (IsWritableStream(this) === false) {
  7290. throw streamBrandCheckException('locked');
  7291. }
  7292. return IsWritableStreamLocked(this);
  7293. },
  7294. enumerable: true,
  7295. configurable: true
  7296. });
  7297. WritableStream.prototype.abort = function (reason) {
  7298. if (IsWritableStream(this) === false) {
  7299. return promiseRejectedWith(streamBrandCheckException('abort'));
  7300. }
  7301. if (IsWritableStreamLocked(this) === true) {
  7302. return promiseRejectedWith(new TypeError('Cannot abort a stream that already has a writer'));
  7303. }
  7304. return WritableStreamAbort(this, reason);
  7305. };
  7306. WritableStream.prototype.close = function () {
  7307. if (IsWritableStream(this) === false) {
  7308. return promiseRejectedWith(streamBrandCheckException('close'));
  7309. }
  7310. if (IsWritableStreamLocked(this) === true) {
  7311. return promiseRejectedWith(new TypeError('Cannot close a stream that already has a writer'));
  7312. }
  7313. if (WritableStreamCloseQueuedOrInFlight(this) === true) {
  7314. return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));
  7315. }
  7316. return WritableStreamClose(this);
  7317. };
  7318. WritableStream.prototype.getWriter = function () {
  7319. if (IsWritableStream(this) === false) {
  7320. throw streamBrandCheckException('getWriter');
  7321. }
  7322. return AcquireWritableStreamDefaultWriter(this);
  7323. };
  7324. return WritableStream;
  7325. }();
  7326. function AcquireWritableStreamDefaultWriter(stream) {
  7327. return new WritableStreamDefaultWriter(stream);
  7328. }
  7329. function CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
  7330. if (highWaterMark === void 0) {
  7331. highWaterMark = 1;
  7332. }
  7333. if (sizeAlgorithm === void 0) {
  7334. sizeAlgorithm = function () {
  7335. return 1;
  7336. };
  7337. }
  7338. var stream = Object.create(WritableStream.prototype);
  7339. InitializeWritableStream(stream);
  7340. var controller = Object.create(WritableStreamDefaultController.prototype);
  7341. SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
  7342. return stream;
  7343. }
  7344. function InitializeWritableStream(stream) {
  7345. stream._state = 'writable';
  7346. stream._storedError = undefined;
  7347. stream._writer = undefined;
  7348. stream._writableStreamController = undefined;
  7349. stream._writeRequests = new SimpleQueue();
  7350. stream._inFlightWriteRequest = undefined;
  7351. stream._closeRequest = undefined;
  7352. stream._inFlightCloseRequest = undefined;
  7353. stream._pendingAbortRequest = undefined;
  7354. stream._backpressure = false;
  7355. }
  7356. function IsWritableStream(x) {
  7357. if (!typeIsObject(x)) {
  7358. return false;
  7359. }
  7360. if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
  7361. return false;
  7362. }
  7363. return true;
  7364. }
  7365. function IsWritableStreamLocked(stream) {
  7366. if (stream._writer === undefined) {
  7367. return false;
  7368. }
  7369. return true;
  7370. }
  7371. function WritableStreamAbort(stream, reason) {
  7372. var state = stream._state;
  7373. if (state === 'closed' || state === 'errored') {
  7374. return promiseResolvedWith(undefined);
  7375. }
  7376. if (stream._pendingAbortRequest !== undefined) {
  7377. return stream._pendingAbortRequest._promise;
  7378. }
  7379. var wasAlreadyErroring = false;
  7380. if (state === 'erroring') {
  7381. wasAlreadyErroring = true;
  7382. reason = undefined;
  7383. }
  7384. var promise = newPromise(function (resolve, reject) {
  7385. stream._pendingAbortRequest = {
  7386. _promise: undefined,
  7387. _resolve: resolve,
  7388. _reject: reject,
  7389. _reason: reason,
  7390. _wasAlreadyErroring: wasAlreadyErroring
  7391. };
  7392. });
  7393. stream._pendingAbortRequest._promise = promise;
  7394. if (wasAlreadyErroring === false) {
  7395. WritableStreamStartErroring(stream, reason);
  7396. }
  7397. return promise;
  7398. }
  7399. function WritableStreamClose(stream) {
  7400. var state = stream._state;
  7401. if (state === 'closed' || state === 'errored') {
  7402. return promiseRejectedWith(new TypeError("The stream (in " + state + " state) is not in the writable state and cannot be closed"));
  7403. }
  7404. var promise = newPromise(function (resolve, reject) {
  7405. var closeRequest = {
  7406. _resolve: resolve,
  7407. _reject: reject
  7408. };
  7409. stream._closeRequest = closeRequest;
  7410. });
  7411. var writer = stream._writer;
  7412. if (writer !== undefined && stream._backpressure === true && state === 'writable') {
  7413. defaultWriterReadyPromiseResolve(writer);
  7414. }
  7415. WritableStreamDefaultControllerClose(stream._writableStreamController);
  7416. return promise;
  7417. }
  7418. function WritableStreamAddWriteRequest(stream) {
  7419. var promise = newPromise(function (resolve, reject) {
  7420. var writeRequest = {
  7421. _resolve: resolve,
  7422. _reject: reject
  7423. };
  7424. stream._writeRequests.push(writeRequest);
  7425. });
  7426. return promise;
  7427. }
  7428. function WritableStreamDealWithRejection(stream, error) {
  7429. var state = stream._state;
  7430. if (state === 'writable') {
  7431. WritableStreamStartErroring(stream, error);
  7432. return;
  7433. }
  7434. WritableStreamFinishErroring(stream);
  7435. }
  7436. function WritableStreamStartErroring(stream, reason) {
  7437. var controller = stream._writableStreamController;
  7438. stream._state = 'erroring';
  7439. stream._storedError = reason;
  7440. var writer = stream._writer;
  7441. if (writer !== undefined) {
  7442. WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
  7443. }
  7444. if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {
  7445. WritableStreamFinishErroring(stream);
  7446. }
  7447. }
  7448. function WritableStreamFinishErroring(stream) {
  7449. stream._state = 'errored';
  7450. stream._writableStreamController[ErrorSteps]();
  7451. var storedError = stream._storedError;
  7452. stream._writeRequests.forEach(function (writeRequest) {
  7453. writeRequest._reject(storedError);
  7454. });
  7455. stream._writeRequests = new SimpleQueue();
  7456. if (stream._pendingAbortRequest === undefined) {
  7457. WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
  7458. return;
  7459. }
  7460. var abortRequest = stream._pendingAbortRequest;
  7461. stream._pendingAbortRequest = undefined;
  7462. if (abortRequest._wasAlreadyErroring === true) {
  7463. abortRequest._reject(storedError);
  7464. WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
  7465. return;
  7466. }
  7467. var promise = stream._writableStreamController[AbortSteps](abortRequest._reason);
  7468. uponPromise(promise, function () {
  7469. abortRequest._resolve();
  7470. WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
  7471. }, function (reason) {
  7472. abortRequest._reject(reason);
  7473. WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
  7474. });
  7475. }
  7476. function WritableStreamFinishInFlightWrite(stream) {
  7477. stream._inFlightWriteRequest._resolve(undefined);
  7478. stream._inFlightWriteRequest = undefined;
  7479. }
  7480. function WritableStreamFinishInFlightWriteWithError(stream, error) {
  7481. stream._inFlightWriteRequest._reject(error);
  7482. stream._inFlightWriteRequest = undefined;
  7483. WritableStreamDealWithRejection(stream, error);
  7484. }
  7485. function WritableStreamFinishInFlightClose(stream) {
  7486. stream._inFlightCloseRequest._resolve(undefined);
  7487. stream._inFlightCloseRequest = undefined;
  7488. var state = stream._state;
  7489. if (state === 'erroring') {
  7490. stream._storedError = undefined;
  7491. if (stream._pendingAbortRequest !== undefined) {
  7492. stream._pendingAbortRequest._resolve();
  7493. stream._pendingAbortRequest = undefined;
  7494. }
  7495. }
  7496. stream._state = 'closed';
  7497. var writer = stream._writer;
  7498. if (writer !== undefined) {
  7499. defaultWriterClosedPromiseResolve(writer);
  7500. }
  7501. }
  7502. function WritableStreamFinishInFlightCloseWithError(stream, error) {
  7503. stream._inFlightCloseRequest._reject(error);
  7504. stream._inFlightCloseRequest = undefined;
  7505. if (stream._pendingAbortRequest !== undefined) {
  7506. stream._pendingAbortRequest._reject(error);
  7507. stream._pendingAbortRequest = undefined;
  7508. }
  7509. WritableStreamDealWithRejection(stream, error);
  7510. }
  7511. function WritableStreamCloseQueuedOrInFlight(stream) {
  7512. if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {
  7513. return false;
  7514. }
  7515. return true;
  7516. }
  7517. function WritableStreamHasOperationMarkedInFlight(stream) {
  7518. if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {
  7519. return false;
  7520. }
  7521. return true;
  7522. }
  7523. function WritableStreamMarkCloseRequestInFlight(stream) {
  7524. stream._inFlightCloseRequest = stream._closeRequest;
  7525. stream._closeRequest = undefined;
  7526. }
  7527. function WritableStreamMarkFirstWriteRequestInFlight(stream) {
  7528. stream._inFlightWriteRequest = stream._writeRequests.shift();
  7529. }
  7530. function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
  7531. if (stream._closeRequest !== undefined) {
  7532. stream._closeRequest._reject(stream._storedError);
  7533. stream._closeRequest = undefined;
  7534. }
  7535. var writer = stream._writer;
  7536. if (writer !== undefined) {
  7537. defaultWriterClosedPromiseReject(writer, stream._storedError);
  7538. }
  7539. }
  7540. function WritableStreamUpdateBackpressure(stream, backpressure) {
  7541. var writer = stream._writer;
  7542. if (writer !== undefined && backpressure !== stream._backpressure) {
  7543. if (backpressure === true) {
  7544. defaultWriterReadyPromiseReset(writer);
  7545. } else {
  7546. defaultWriterReadyPromiseResolve(writer);
  7547. }
  7548. }
  7549. stream._backpressure = backpressure;
  7550. }
  7551. var WritableStreamDefaultWriter = function () {
  7552. function WritableStreamDefaultWriter(stream) {
  7553. if (IsWritableStream(stream) === false) {
  7554. throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance');
  7555. }
  7556. if (IsWritableStreamLocked(stream) === true) {
  7557. throw new TypeError('This stream has already been locked for exclusive writing by another writer');
  7558. }
  7559. this._ownerWritableStream = stream;
  7560. stream._writer = this;
  7561. var state = stream._state;
  7562. if (state === 'writable') {
  7563. if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
  7564. defaultWriterReadyPromiseInitialize(this);
  7565. } else {
  7566. defaultWriterReadyPromiseInitializeAsResolved(this);
  7567. }
  7568. defaultWriterClosedPromiseInitialize(this);
  7569. } else if (state === 'erroring') {
  7570. defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);
  7571. defaultWriterClosedPromiseInitialize(this);
  7572. } else if (state === 'closed') {
  7573. defaultWriterReadyPromiseInitializeAsResolved(this);
  7574. defaultWriterClosedPromiseInitializeAsResolved(this);
  7575. } else {
  7576. var storedError = stream._storedError;
  7577. defaultWriterReadyPromiseInitializeAsRejected(this, storedError);
  7578. defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
  7579. }
  7580. }
  7581. Object.defineProperty(WritableStreamDefaultWriter.prototype, "closed", {
  7582. get: function () {
  7583. if (IsWritableStreamDefaultWriter(this) === false) {
  7584. return promiseRejectedWith(defaultWriterBrandCheckException('closed'));
  7585. }
  7586. return this._closedPromise;
  7587. },
  7588. enumerable: true,
  7589. configurable: true
  7590. });
  7591. Object.defineProperty(WritableStreamDefaultWriter.prototype, "desiredSize", {
  7592. get: function () {
  7593. if (IsWritableStreamDefaultWriter(this) === false) {
  7594. throw defaultWriterBrandCheckException('desiredSize');
  7595. }
  7596. if (this._ownerWritableStream === undefined) {
  7597. throw defaultWriterLockException('desiredSize');
  7598. }
  7599. return WritableStreamDefaultWriterGetDesiredSize(this);
  7600. },
  7601. enumerable: true,
  7602. configurable: true
  7603. });
  7604. Object.defineProperty(WritableStreamDefaultWriter.prototype, "ready", {
  7605. get: function () {
  7606. if (IsWritableStreamDefaultWriter(this) === false) {
  7607. return promiseRejectedWith(defaultWriterBrandCheckException('ready'));
  7608. }
  7609. return this._readyPromise;
  7610. },
  7611. enumerable: true,
  7612. configurable: true
  7613. });
  7614. WritableStreamDefaultWriter.prototype.abort = function (reason) {
  7615. if (IsWritableStreamDefaultWriter(this) === false) {
  7616. return promiseRejectedWith(defaultWriterBrandCheckException('abort'));
  7617. }
  7618. if (this._ownerWritableStream === undefined) {
  7619. return promiseRejectedWith(defaultWriterLockException('abort'));
  7620. }
  7621. return WritableStreamDefaultWriterAbort(this, reason);
  7622. };
  7623. WritableStreamDefaultWriter.prototype.close = function () {
  7624. if (IsWritableStreamDefaultWriter(this) === false) {
  7625. return promiseRejectedWith(defaultWriterBrandCheckException('close'));
  7626. }
  7627. var stream = this._ownerWritableStream;
  7628. if (stream === undefined) {
  7629. return promiseRejectedWith(defaultWriterLockException('close'));
  7630. }
  7631. if (WritableStreamCloseQueuedOrInFlight(stream) === true) {
  7632. return promiseRejectedWith(new TypeError('Cannot close an already-closing stream'));
  7633. }
  7634. return WritableStreamDefaultWriterClose(this);
  7635. };
  7636. WritableStreamDefaultWriter.prototype.releaseLock = function () {
  7637. if (IsWritableStreamDefaultWriter(this) === false) {
  7638. throw defaultWriterBrandCheckException('releaseLock');
  7639. }
  7640. var stream = this._ownerWritableStream;
  7641. if (stream === undefined) {
  7642. return;
  7643. }
  7644. WritableStreamDefaultWriterRelease(this);
  7645. };
  7646. WritableStreamDefaultWriter.prototype.write = function (chunk) {
  7647. if (IsWritableStreamDefaultWriter(this) === false) {
  7648. return promiseRejectedWith(defaultWriterBrandCheckException('write'));
  7649. }
  7650. if (this._ownerWritableStream === undefined) {
  7651. return promiseRejectedWith(defaultWriterLockException('write to'));
  7652. }
  7653. return WritableStreamDefaultWriterWrite(this, chunk);
  7654. };
  7655. return WritableStreamDefaultWriter;
  7656. }();
  7657. function IsWritableStreamDefaultWriter(x) {
  7658. if (!typeIsObject(x)) {
  7659. return false;
  7660. }
  7661. if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
  7662. return false;
  7663. }
  7664. return true;
  7665. }
  7666. function WritableStreamDefaultWriterAbort(writer, reason) {
  7667. var stream = writer._ownerWritableStream;
  7668. return WritableStreamAbort(stream, reason);
  7669. }
  7670. function WritableStreamDefaultWriterClose(writer) {
  7671. var stream = writer._ownerWritableStream;
  7672. return WritableStreamClose(stream);
  7673. }
  7674. function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {
  7675. var stream = writer._ownerWritableStream;
  7676. var state = stream._state;
  7677. if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
  7678. return promiseResolvedWith(undefined);
  7679. }
  7680. if (state === 'errored') {
  7681. return promiseRejectedWith(stream._storedError);
  7682. }
  7683. return WritableStreamDefaultWriterClose(writer);
  7684. }
  7685. function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {
  7686. if (writer._closedPromiseState === 'pending') {
  7687. defaultWriterClosedPromiseReject(writer, error);
  7688. } else {
  7689. defaultWriterClosedPromiseResetToRejected(writer, error);
  7690. }
  7691. }
  7692. function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {
  7693. if (writer._readyPromiseState === 'pending') {
  7694. defaultWriterReadyPromiseReject(writer, error);
  7695. } else {
  7696. defaultWriterReadyPromiseResetToRejected(writer, error);
  7697. }
  7698. }
  7699. function WritableStreamDefaultWriterGetDesiredSize(writer) {
  7700. var stream = writer._ownerWritableStream;
  7701. var state = stream._state;
  7702. if (state === 'errored' || state === 'erroring') {
  7703. return null;
  7704. }
  7705. if (state === 'closed') {
  7706. return 0;
  7707. }
  7708. return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);
  7709. }
  7710. function WritableStreamDefaultWriterRelease(writer) {
  7711. var stream = writer._ownerWritableStream;
  7712. var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness');
  7713. WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
  7714. WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);
  7715. stream._writer = undefined;
  7716. writer._ownerWritableStream = undefined;
  7717. }
  7718. function WritableStreamDefaultWriterWrite(writer, chunk) {
  7719. var stream = writer._ownerWritableStream;
  7720. var controller = stream._writableStreamController;
  7721. var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);
  7722. if (stream !== writer._ownerWritableStream) {
  7723. return promiseRejectedWith(defaultWriterLockException('write to'));
  7724. }
  7725. var state = stream._state;
  7726. if (state === 'errored') {
  7727. return promiseRejectedWith(stream._storedError);
  7728. }
  7729. if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
  7730. return promiseRejectedWith(new TypeError('The stream is closing or closed and cannot be written to'));
  7731. }
  7732. if (state === 'erroring') {
  7733. return promiseRejectedWith(stream._storedError);
  7734. }
  7735. var promise = WritableStreamAddWriteRequest(stream);
  7736. WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);
  7737. return promise;
  7738. }
  7739. var WritableStreamDefaultController = function () {
  7740. function WritableStreamDefaultController() {
  7741. throw new TypeError('WritableStreamDefaultController cannot be constructed explicitly');
  7742. }
  7743. WritableStreamDefaultController.prototype.error = function (e) {
  7744. if (IsWritableStreamDefaultController(this) === false) {
  7745. throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController');
  7746. }
  7747. var state = this._controlledWritableStream._state;
  7748. if (state !== 'writable') {
  7749. return;
  7750. }
  7751. WritableStreamDefaultControllerError(this, e);
  7752. };
  7753. WritableStreamDefaultController.prototype[AbortSteps] = function (reason) {
  7754. var result = this._abortAlgorithm(reason);
  7755. WritableStreamDefaultControllerClearAlgorithms(this);
  7756. return result;
  7757. };
  7758. WritableStreamDefaultController.prototype[ErrorSteps] = function () {
  7759. ResetQueue(this);
  7760. };
  7761. return WritableStreamDefaultController;
  7762. }();
  7763. function IsWritableStreamDefaultController(x) {
  7764. if (!typeIsObject(x)) {
  7765. return false;
  7766. }
  7767. if (!Object.prototype.hasOwnProperty.call(x, '_controlledWritableStream')) {
  7768. return false;
  7769. }
  7770. return true;
  7771. }
  7772. function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
  7773. controller._controlledWritableStream = stream;
  7774. stream._writableStreamController = controller;
  7775. controller._queue = undefined;
  7776. controller._queueTotalSize = undefined;
  7777. ResetQueue(controller);
  7778. controller._started = false;
  7779. controller._strategySizeAlgorithm = sizeAlgorithm;
  7780. controller._strategyHWM = highWaterMark;
  7781. controller._writeAlgorithm = writeAlgorithm;
  7782. controller._closeAlgorithm = closeAlgorithm;
  7783. controller._abortAlgorithm = abortAlgorithm;
  7784. var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
  7785. WritableStreamUpdateBackpressure(stream, backpressure);
  7786. var startResult = startAlgorithm();
  7787. var startPromise = promiseResolvedWith(startResult);
  7788. uponPromise(startPromise, function () {
  7789. controller._started = true;
  7790. WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
  7791. }, function (r) {
  7792. controller._started = true;
  7793. WritableStreamDealWithRejection(stream, r);
  7794. });
  7795. }
  7796. function SetUpWritableStreamDefaultControllerFromUnderlyingSink(stream, underlyingSink, highWaterMark, sizeAlgorithm) {
  7797. var controller = Object.create(WritableStreamDefaultController.prototype);
  7798. function startAlgorithm() {
  7799. return InvokeOrNoop(underlyingSink, 'start', [controller]);
  7800. }
  7801. var writeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'write', 1, [controller]);
  7802. var closeAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'close', 0, []);
  7803. var abortAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSink, 'abort', 1, []);
  7804. SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm);
  7805. }
  7806. function WritableStreamDefaultControllerClearAlgorithms(controller) {
  7807. controller._writeAlgorithm = undefined;
  7808. controller._closeAlgorithm = undefined;
  7809. controller._abortAlgorithm = undefined;
  7810. controller._strategySizeAlgorithm = undefined;
  7811. }
  7812. function WritableStreamDefaultControllerClose(controller) {
  7813. EnqueueValueWithSize(controller, 'close', 0);
  7814. WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
  7815. }
  7816. function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
  7817. try {
  7818. return controller._strategySizeAlgorithm(chunk);
  7819. } catch (chunkSizeE) {
  7820. WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
  7821. return 1;
  7822. }
  7823. }
  7824. function WritableStreamDefaultControllerGetDesiredSize(controller) {
  7825. return controller._strategyHWM - controller._queueTotalSize;
  7826. }
  7827. function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
  7828. var writeRecord = { chunk: chunk };
  7829. try {
  7830. EnqueueValueWithSize(controller, writeRecord, chunkSize);
  7831. } catch (enqueueE) {
  7832. WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
  7833. return;
  7834. }
  7835. var stream = controller._controlledWritableStream;
  7836. if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') {
  7837. var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
  7838. WritableStreamUpdateBackpressure(stream, backpressure);
  7839. }
  7840. WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
  7841. }
  7842. function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
  7843. var stream = controller._controlledWritableStream;
  7844. if (controller._started === false) {
  7845. return;
  7846. }
  7847. if (stream._inFlightWriteRequest !== undefined) {
  7848. return;
  7849. }
  7850. var state = stream._state;
  7851. if (state === 'erroring') {
  7852. WritableStreamFinishErroring(stream);
  7853. return;
  7854. }
  7855. if (controller._queue.length === 0) {
  7856. return;
  7857. }
  7858. var writeRecord = PeekQueueValue(controller);
  7859. if (writeRecord === 'close') {
  7860. WritableStreamDefaultControllerProcessClose(controller);
  7861. } else {
  7862. WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);
  7863. }
  7864. }
  7865. function WritableStreamDefaultControllerErrorIfNeeded(controller, error) {
  7866. if (controller._controlledWritableStream._state === 'writable') {
  7867. WritableStreamDefaultControllerError(controller, error);
  7868. }
  7869. }
  7870. function WritableStreamDefaultControllerProcessClose(controller) {
  7871. var stream = controller._controlledWritableStream;
  7872. WritableStreamMarkCloseRequestInFlight(stream);
  7873. DequeueValue(controller);
  7874. var sinkClosePromise = controller._closeAlgorithm();
  7875. WritableStreamDefaultControllerClearAlgorithms(controller);
  7876. uponPromise(sinkClosePromise, function () {
  7877. WritableStreamFinishInFlightClose(stream);
  7878. }, function (reason) {
  7879. WritableStreamFinishInFlightCloseWithError(stream, reason);
  7880. });
  7881. }
  7882. function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
  7883. var stream = controller._controlledWritableStream;
  7884. WritableStreamMarkFirstWriteRequestInFlight(stream);
  7885. var sinkWritePromise = controller._writeAlgorithm(chunk);
  7886. uponPromise(sinkWritePromise, function () {
  7887. WritableStreamFinishInFlightWrite(stream);
  7888. var state = stream._state;
  7889. DequeueValue(controller);
  7890. if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') {
  7891. var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
  7892. WritableStreamUpdateBackpressure(stream, backpressure);
  7893. }
  7894. WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
  7895. }, function (reason) {
  7896. if (stream._state === 'writable') {
  7897. WritableStreamDefaultControllerClearAlgorithms(controller);
  7898. }
  7899. WritableStreamFinishInFlightWriteWithError(stream, reason);
  7900. });
  7901. }
  7902. function WritableStreamDefaultControllerGetBackpressure(controller) {
  7903. var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
  7904. return desiredSize <= 0;
  7905. }
  7906. function WritableStreamDefaultControllerError(controller, error) {
  7907. var stream = controller._controlledWritableStream;
  7908. WritableStreamDefaultControllerClearAlgorithms(controller);
  7909. WritableStreamStartErroring(stream, error);
  7910. }
  7911. function streamBrandCheckException(name) {
  7912. return new TypeError("WritableStream.prototype." + name + " can only be used on a WritableStream");
  7913. }
  7914. function defaultWriterBrandCheckException(name) {
  7915. return new TypeError("WritableStreamDefaultWriter.prototype." + name + " can only be used on a WritableStreamDefaultWriter");
  7916. }
  7917. function defaultWriterLockException(name) {
  7918. return new TypeError('Cannot ' + name + ' a stream using a released writer');
  7919. }
  7920. function defaultWriterClosedPromiseInitialize(writer) {
  7921. writer._closedPromise = newPromise(function (resolve, reject) {
  7922. writer._closedPromise_resolve = resolve;
  7923. writer._closedPromise_reject = reject;
  7924. writer._closedPromiseState = 'pending';
  7925. });
  7926. }
  7927. function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {
  7928. defaultWriterClosedPromiseInitialize(writer);
  7929. defaultWriterClosedPromiseReject(writer, reason);
  7930. }
  7931. function defaultWriterClosedPromiseInitializeAsResolved(writer) {
  7932. defaultWriterClosedPromiseInitialize(writer);
  7933. defaultWriterClosedPromiseResolve(writer);
  7934. }
  7935. function defaultWriterClosedPromiseReject(writer, reason) {
  7936. setPromiseIsHandledToTrue(writer._closedPromise);
  7937. writer._closedPromise_reject(reason);
  7938. writer._closedPromise_resolve = undefined;
  7939. writer._closedPromise_reject = undefined;
  7940. writer._closedPromiseState = 'rejected';
  7941. }
  7942. function defaultWriterClosedPromiseResetToRejected(writer, reason) {
  7943. defaultWriterClosedPromiseInitializeAsRejected(writer, reason);
  7944. }
  7945. function defaultWriterClosedPromiseResolve(writer) {
  7946. writer._closedPromise_resolve(undefined);
  7947. writer._closedPromise_resolve = undefined;
  7948. writer._closedPromise_reject = undefined;
  7949. writer._closedPromiseState = 'resolved';
  7950. }
  7951. function defaultWriterReadyPromiseInitialize(writer) {
  7952. writer._readyPromise = newPromise(function (resolve, reject) {
  7953. writer._readyPromise_resolve = resolve;
  7954. writer._readyPromise_reject = reject;
  7955. });
  7956. writer._readyPromiseState = 'pending';
  7957. }
  7958. function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {
  7959. defaultWriterReadyPromiseInitialize(writer);
  7960. defaultWriterReadyPromiseReject(writer, reason);
  7961. }
  7962. function defaultWriterReadyPromiseInitializeAsResolved(writer) {
  7963. defaultWriterReadyPromiseInitialize(writer);
  7964. defaultWriterReadyPromiseResolve(writer);
  7965. }
  7966. function defaultWriterReadyPromiseReject(writer, reason) {
  7967. setPromiseIsHandledToTrue(writer._readyPromise);
  7968. writer._readyPromise_reject(reason);
  7969. writer._readyPromise_resolve = undefined;
  7970. writer._readyPromise_reject = undefined;
  7971. writer._readyPromiseState = 'rejected';
  7972. }
  7973. function defaultWriterReadyPromiseReset(writer) {
  7974. defaultWriterReadyPromiseInitialize(writer);
  7975. }
  7976. function defaultWriterReadyPromiseResetToRejected(writer, reason) {
  7977. defaultWriterReadyPromiseInitializeAsRejected(writer, reason);
  7978. }
  7979. function defaultWriterReadyPromiseResolve(writer) {
  7980. writer._readyPromise_resolve(undefined);
  7981. writer._readyPromise_resolve = undefined;
  7982. writer._readyPromise_reject = undefined;
  7983. writer._readyPromiseState = 'fulfilled';
  7984. }
  7985. function isAbortSignal(value) {
  7986. if (typeof value !== 'object' || value === null) {
  7987. return false;
  7988. }
  7989. try {
  7990. return typeof value.aborted === 'boolean';
  7991. } catch (_a) {
  7992. return false;
  7993. }
  7994. }
  7995. var NativeDOMException = typeof DOMException !== 'undefined' ? DOMException : undefined;
  7996. function isDOMExceptionConstructor(ctor) {
  7997. if (!(typeof ctor === 'function' || typeof ctor === 'object')) {
  7998. return false;
  7999. }
  8000. try {
  8001. new ctor();
  8002. return true;
  8003. } catch (_a) {
  8004. return false;
  8005. }
  8006. }
  8007. function createDOMExceptionPolyfill() {
  8008. var ctor = function DOMException(message, name) {
  8009. this.message = message || '';
  8010. this.name = name || 'Error';
  8011. if (Error.captureStackTrace) {
  8012. Error.captureStackTrace(this, this.constructor);
  8013. }
  8014. };
  8015. ctor.prototype = Object.create(Error.prototype);
  8016. Object.defineProperty(ctor.prototype, 'constructor', {
  8017. value: ctor,
  8018. writable: true,
  8019. configurable: true
  8020. });
  8021. return ctor;
  8022. }
  8023. var DOMException$1 = isDOMExceptionConstructor(NativeDOMException) ? NativeDOMException : createDOMExceptionPolyfill();
  8024. function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventCancel, signal) {
  8025. var reader = AcquireReadableStreamDefaultReader(source);
  8026. var writer = AcquireWritableStreamDefaultWriter(dest);
  8027. source._disturbed = true;
  8028. var shuttingDown = false;
  8029. var currentWrite = promiseResolvedWith(undefined);
  8030. return newPromise(function (resolve, reject) {
  8031. var abortAlgorithm;
  8032. if (signal !== undefined) {
  8033. abortAlgorithm = function () {
  8034. var error = new DOMException$1('Aborted', 'AbortError');
  8035. var actions = [];
  8036. if (preventAbort === false) {
  8037. actions.push(function () {
  8038. if (dest._state === 'writable') {
  8039. return WritableStreamAbort(dest, error);
  8040. }
  8041. return promiseResolvedWith(undefined);
  8042. });
  8043. }
  8044. if (preventCancel === false) {
  8045. actions.push(function () {
  8046. if (source._state === 'readable') {
  8047. return ReadableStreamCancel(source, error);
  8048. }
  8049. return promiseResolvedWith(undefined);
  8050. });
  8051. }
  8052. shutdownWithAction(function () {
  8053. return Promise.all(actions.map(function (action) {
  8054. return action();
  8055. }));
  8056. }, true, error);
  8057. };
  8058. if (signal.aborted === true) {
  8059. abortAlgorithm();
  8060. return;
  8061. }
  8062. signal.addEventListener('abort', abortAlgorithm);
  8063. }
  8064. function pipeLoop() {
  8065. return newPromise(function (resolveLoop, rejectLoop) {
  8066. function next(done) {
  8067. if (done) {
  8068. resolveLoop();
  8069. } else {
  8070. PerformPromiseThen(pipeStep(), next, rejectLoop);
  8071. }
  8072. }
  8073. next(false);
  8074. });
  8075. }
  8076. function pipeStep() {
  8077. if (shuttingDown === true) {
  8078. return promiseResolvedWith(true);
  8079. }
  8080. return PerformPromiseThen(writer._readyPromise, function () {
  8081. return PerformPromiseThen(ReadableStreamDefaultReaderRead(reader), function (result) {
  8082. if (result.done === true) {
  8083. return true;
  8084. }
  8085. currentWrite = PerformPromiseThen(WritableStreamDefaultWriterWrite(writer, result.value), undefined, noop);
  8086. return false;
  8087. });
  8088. });
  8089. }
  8090. isOrBecomesErrored(source, reader._closedPromise, function (storedError) {
  8091. if (preventAbort === false) {
  8092. shutdownWithAction(function () {
  8093. return WritableStreamAbort(dest, storedError);
  8094. }, true, storedError);
  8095. } else {
  8096. shutdown(true, storedError);
  8097. }
  8098. });
  8099. isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
  8100. if (preventCancel === false) {
  8101. shutdownWithAction(function () {
  8102. return ReadableStreamCancel(source, storedError);
  8103. }, true, storedError);
  8104. } else {
  8105. shutdown(true, storedError);
  8106. }
  8107. });
  8108. isOrBecomesClosed(source, reader._closedPromise, function () {
  8109. if (preventClose === false) {
  8110. shutdownWithAction(function () {
  8111. return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);
  8112. });
  8113. } else {
  8114. shutdown();
  8115. }
  8116. });
  8117. if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') {
  8118. var destClosed_1 = new TypeError('the destination writable stream closed before all data could be piped to it');
  8119. if (preventCancel === false) {
  8120. shutdownWithAction(function () {
  8121. return ReadableStreamCancel(source, destClosed_1);
  8122. }, true, destClosed_1);
  8123. } else {
  8124. shutdown(true, destClosed_1);
  8125. }
  8126. }
  8127. setPromiseIsHandledToTrue(pipeLoop());
  8128. function waitForWritesToFinish() {
  8129. var oldCurrentWrite = currentWrite;
  8130. return PerformPromiseThen(currentWrite, function () {
  8131. return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined;
  8132. });
  8133. }
  8134. function isOrBecomesErrored(stream, promise, action) {
  8135. if (stream._state === 'errored') {
  8136. action(stream._storedError);
  8137. } else {
  8138. uponRejection(promise, action);
  8139. }
  8140. }
  8141. function isOrBecomesClosed(stream, promise, action) {
  8142. if (stream._state === 'closed') {
  8143. action();
  8144. } else {
  8145. uponFulfillment(promise, action);
  8146. }
  8147. }
  8148. function shutdownWithAction(action, originalIsError, originalError) {
  8149. if (shuttingDown === true) {
  8150. return;
  8151. }
  8152. shuttingDown = true;
  8153. if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
  8154. uponFulfillment(waitForWritesToFinish(), doTheRest);
  8155. } else {
  8156. doTheRest();
  8157. }
  8158. function doTheRest() {
  8159. uponPromise(action(), function () {
  8160. return finalize(originalIsError, originalError);
  8161. }, function (newError) {
  8162. return finalize(true, newError);
  8163. });
  8164. }
  8165. }
  8166. function shutdown(isError, error) {
  8167. if (shuttingDown === true) {
  8168. return;
  8169. }
  8170. shuttingDown = true;
  8171. if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
  8172. uponFulfillment(waitForWritesToFinish(), function () {
  8173. return finalize(isError, error);
  8174. });
  8175. } else {
  8176. finalize(isError, error);
  8177. }
  8178. }
  8179. function finalize(isError, error) {
  8180. WritableStreamDefaultWriterRelease(writer);
  8181. ReadableStreamReaderGenericRelease(reader);
  8182. if (signal !== undefined) {
  8183. signal.removeEventListener('abort', abortAlgorithm);
  8184. }
  8185. if (isError) {
  8186. reject(error);
  8187. } else {
  8188. resolve(undefined);
  8189. }
  8190. }
  8191. });
  8192. }
  8193. var ReadableStreamDefaultController = function () {
  8194. function ReadableStreamDefaultController() {
  8195. throw new TypeError();
  8196. }
  8197. Object.defineProperty(ReadableStreamDefaultController.prototype, "desiredSize", {
  8198. get: function () {
  8199. if (IsReadableStreamDefaultController(this) === false) {
  8200. throw defaultControllerBrandCheckException('desiredSize');
  8201. }
  8202. return ReadableStreamDefaultControllerGetDesiredSize(this);
  8203. },
  8204. enumerable: true,
  8205. configurable: true
  8206. });
  8207. ReadableStreamDefaultController.prototype.close = function () {
  8208. if (IsReadableStreamDefaultController(this) === false) {
  8209. throw defaultControllerBrandCheckException('close');
  8210. }
  8211. if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
  8212. throw new TypeError('The stream is not in a state that permits close');
  8213. }
  8214. ReadableStreamDefaultControllerClose(this);
  8215. };
  8216. ReadableStreamDefaultController.prototype.enqueue = function (chunk) {
  8217. if (IsReadableStreamDefaultController(this) === false) {
  8218. throw defaultControllerBrandCheckException('enqueue');
  8219. }
  8220. if (ReadableStreamDefaultControllerCanCloseOrEnqueue(this) === false) {
  8221. throw new TypeError('The stream is not in a state that permits enqueue');
  8222. }
  8223. return ReadableStreamDefaultControllerEnqueue(this, chunk);
  8224. };
  8225. ReadableStreamDefaultController.prototype.error = function (e) {
  8226. if (IsReadableStreamDefaultController(this) === false) {
  8227. throw defaultControllerBrandCheckException('error');
  8228. }
  8229. ReadableStreamDefaultControllerError(this, e);
  8230. };
  8231. ReadableStreamDefaultController.prototype[CancelSteps] = function (reason) {
  8232. ResetQueue(this);
  8233. var result = this._cancelAlgorithm(reason);
  8234. ReadableStreamDefaultControllerClearAlgorithms(this);
  8235. return result;
  8236. };
  8237. ReadableStreamDefaultController.prototype[PullSteps] = function () {
  8238. var stream = this._controlledReadableStream;
  8239. if (this._queue.length > 0) {
  8240. var chunk = DequeueValue(this);
  8241. if (this._closeRequested === true && this._queue.length === 0) {
  8242. ReadableStreamDefaultControllerClearAlgorithms(this);
  8243. ReadableStreamClose(stream);
  8244. } else {
  8245. ReadableStreamDefaultControllerCallPullIfNeeded(this);
  8246. }
  8247. return promiseResolvedWith(ReadableStreamCreateReadResult(chunk, false, stream._reader._forAuthorCode));
  8248. }
  8249. var pendingPromise = ReadableStreamAddReadRequest(stream);
  8250. ReadableStreamDefaultControllerCallPullIfNeeded(this);
  8251. return pendingPromise;
  8252. };
  8253. return ReadableStreamDefaultController;
  8254. }();
  8255. function IsReadableStreamDefaultController(x) {
  8256. if (!typeIsObject(x)) {
  8257. return false;
  8258. }
  8259. if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableStream')) {
  8260. return false;
  8261. }
  8262. return true;
  8263. }
  8264. function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
  8265. var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
  8266. if (shouldPull === false) {
  8267. return;
  8268. }
  8269. if (controller._pulling === true) {
  8270. controller._pullAgain = true;
  8271. return;
  8272. }
  8273. controller._pulling = true;
  8274. var pullPromise = controller._pullAlgorithm();
  8275. uponPromise(pullPromise, function () {
  8276. controller._pulling = false;
  8277. if (controller._pullAgain === true) {
  8278. controller._pullAgain = false;
  8279. ReadableStreamDefaultControllerCallPullIfNeeded(controller);
  8280. }
  8281. }, function (e) {
  8282. ReadableStreamDefaultControllerError(controller, e);
  8283. });
  8284. }
  8285. function ReadableStreamDefaultControllerShouldCallPull(controller) {
  8286. var stream = controller._controlledReadableStream;
  8287. if (ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) === false) {
  8288. return false;
  8289. }
  8290. if (controller._started === false) {
  8291. return false;
  8292. }
  8293. if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
  8294. return true;
  8295. }
  8296. var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
  8297. if (desiredSize > 0) {
  8298. return true;
  8299. }
  8300. return false;
  8301. }
  8302. function ReadableStreamDefaultControllerClearAlgorithms(controller) {
  8303. controller._pullAlgorithm = undefined;
  8304. controller._cancelAlgorithm = undefined;
  8305. controller._strategySizeAlgorithm = undefined;
  8306. }
  8307. function ReadableStreamDefaultControllerClose(controller) {
  8308. var stream = controller._controlledReadableStream;
  8309. controller._closeRequested = true;
  8310. if (controller._queue.length === 0) {
  8311. ReadableStreamDefaultControllerClearAlgorithms(controller);
  8312. ReadableStreamClose(stream);
  8313. }
  8314. }
  8315. function ReadableStreamDefaultControllerEnqueue(controller, chunk) {
  8316. var stream = controller._controlledReadableStream;
  8317. if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
  8318. ReadableStreamFulfillReadRequest(stream, chunk, false);
  8319. } else {
  8320. var chunkSize = void 0;
  8321. try {
  8322. chunkSize = controller._strategySizeAlgorithm(chunk);
  8323. } catch (chunkSizeE) {
  8324. ReadableStreamDefaultControllerError(controller, chunkSizeE);
  8325. throw chunkSizeE;
  8326. }
  8327. try {
  8328. EnqueueValueWithSize(controller, chunk, chunkSize);
  8329. } catch (enqueueE) {
  8330. ReadableStreamDefaultControllerError(controller, enqueueE);
  8331. throw enqueueE;
  8332. }
  8333. }
  8334. ReadableStreamDefaultControllerCallPullIfNeeded(controller);
  8335. }
  8336. function ReadableStreamDefaultControllerError(controller, e) {
  8337. var stream = controller._controlledReadableStream;
  8338. if (stream._state !== 'readable') {
  8339. return;
  8340. }
  8341. ResetQueue(controller);
  8342. ReadableStreamDefaultControllerClearAlgorithms(controller);
  8343. ReadableStreamError(stream, e);
  8344. }
  8345. function ReadableStreamDefaultControllerGetDesiredSize(controller) {
  8346. var stream = controller._controlledReadableStream;
  8347. var state = stream._state;
  8348. if (state === 'errored') {
  8349. return null;
  8350. }
  8351. if (state === 'closed') {
  8352. return 0;
  8353. }
  8354. return controller._strategyHWM - controller._queueTotalSize;
  8355. }
  8356. function ReadableStreamDefaultControllerHasBackpressure(controller) {
  8357. if (ReadableStreamDefaultControllerShouldCallPull(controller) === true) {
  8358. return false;
  8359. }
  8360. return true;
  8361. }
  8362. function ReadableStreamDefaultControllerCanCloseOrEnqueue(controller) {
  8363. var state = controller._controlledReadableStream._state;
  8364. if (controller._closeRequested === false && state === 'readable') {
  8365. return true;
  8366. }
  8367. return false;
  8368. }
  8369. function SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
  8370. controller._controlledReadableStream = stream;
  8371. controller._queue = undefined;
  8372. controller._queueTotalSize = undefined;
  8373. ResetQueue(controller);
  8374. controller._started = false;
  8375. controller._closeRequested = false;
  8376. controller._pullAgain = false;
  8377. controller._pulling = false;
  8378. controller._strategySizeAlgorithm = sizeAlgorithm;
  8379. controller._strategyHWM = highWaterMark;
  8380. controller._pullAlgorithm = pullAlgorithm;
  8381. controller._cancelAlgorithm = cancelAlgorithm;
  8382. stream._readableStreamController = controller;
  8383. var startResult = startAlgorithm();
  8384. uponPromise(promiseResolvedWith(startResult), function () {
  8385. controller._started = true;
  8386. ReadableStreamDefaultControllerCallPullIfNeeded(controller);
  8387. }, function (r) {
  8388. ReadableStreamDefaultControllerError(controller, r);
  8389. });
  8390. }
  8391. function SetUpReadableStreamDefaultControllerFromUnderlyingSource(stream, underlyingSource, highWaterMark, sizeAlgorithm) {
  8392. var controller = Object.create(ReadableStreamDefaultController.prototype);
  8393. function startAlgorithm() {
  8394. return InvokeOrNoop(underlyingSource, 'start', [controller]);
  8395. }
  8396. var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, 'pull', 0, [controller]);
  8397. var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingSource, 'cancel', 1, []);
  8398. SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
  8399. }
  8400. function defaultControllerBrandCheckException(name) {
  8401. return new TypeError("ReadableStreamDefaultController.prototype." + name + " can only be used on a ReadableStreamDefaultController");
  8402. }
  8403. function ReadableStreamTee(stream, cloneForBranch2) {
  8404. var reader = AcquireReadableStreamDefaultReader(stream);
  8405. var reading = false;
  8406. var canceled1 = false;
  8407. var canceled2 = false;
  8408. var reason1;
  8409. var reason2;
  8410. var branch1;
  8411. var branch2;
  8412. var resolveCancelPromise;
  8413. var cancelPromise = newPromise(function (resolve) {
  8414. resolveCancelPromise = resolve;
  8415. });
  8416. function pullAlgorithm() {
  8417. if (reading === true) {
  8418. return promiseResolvedWith(undefined);
  8419. }
  8420. reading = true;
  8421. var readPromise = transformPromiseWith(ReadableStreamDefaultReaderRead(reader), function (result) {
  8422. reading = false;
  8423. var done = result.done;
  8424. if (done === true) {
  8425. if (canceled1 === false) {
  8426. ReadableStreamDefaultControllerClose(branch1._readableStreamController);
  8427. }
  8428. if (canceled2 === false) {
  8429. ReadableStreamDefaultControllerClose(branch2._readableStreamController);
  8430. }
  8431. return;
  8432. }
  8433. var value = result.value;
  8434. var value1 = value;
  8435. var value2 = value;
  8436. if (canceled1 === false) {
  8437. ReadableStreamDefaultControllerEnqueue(branch1._readableStreamController, value1);
  8438. }
  8439. if (canceled2 === false) {
  8440. ReadableStreamDefaultControllerEnqueue(branch2._readableStreamController, value2);
  8441. }
  8442. });
  8443. setPromiseIsHandledToTrue(readPromise);
  8444. return promiseResolvedWith(undefined);
  8445. }
  8446. function cancel1Algorithm(reason) {
  8447. canceled1 = true;
  8448. reason1 = reason;
  8449. if (canceled2 === true) {
  8450. var compositeReason = createArrayFromList([
  8451. reason1,
  8452. reason2
  8453. ]);
  8454. var cancelResult = ReadableStreamCancel(stream, compositeReason);
  8455. resolveCancelPromise(cancelResult);
  8456. }
  8457. return cancelPromise;
  8458. }
  8459. function cancel2Algorithm(reason) {
  8460. canceled2 = true;
  8461. reason2 = reason;
  8462. if (canceled1 === true) {
  8463. var compositeReason = createArrayFromList([
  8464. reason1,
  8465. reason2
  8466. ]);
  8467. var cancelResult = ReadableStreamCancel(stream, compositeReason);
  8468. resolveCancelPromise(cancelResult);
  8469. }
  8470. return cancelPromise;
  8471. }
  8472. function startAlgorithm() {
  8473. }
  8474. branch1 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel1Algorithm);
  8475. branch2 = CreateReadableStream(startAlgorithm, pullAlgorithm, cancel2Algorithm);
  8476. uponRejection(reader._closedPromise, function (r) {
  8477. ReadableStreamDefaultControllerError(branch1._readableStreamController, r);
  8478. ReadableStreamDefaultControllerError(branch2._readableStreamController, r);
  8479. });
  8480. return [
  8481. branch1,
  8482. branch2
  8483. ];
  8484. }
  8485. var NumberIsInteger = Number.isInteger || function (value) {
  8486. return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
  8487. };
  8488. var ReadableStreamBYOBRequest = function () {
  8489. function ReadableStreamBYOBRequest() {
  8490. throw new TypeError('ReadableStreamBYOBRequest cannot be used directly');
  8491. }
  8492. Object.defineProperty(ReadableStreamBYOBRequest.prototype, "view", {
  8493. get: function () {
  8494. if (IsReadableStreamBYOBRequest(this) === false) {
  8495. throw byobRequestBrandCheckException('view');
  8496. }
  8497. return this._view;
  8498. },
  8499. enumerable: true,
  8500. configurable: true
  8501. });
  8502. ReadableStreamBYOBRequest.prototype.respond = function (bytesWritten) {
  8503. if (IsReadableStreamBYOBRequest(this) === false) {
  8504. throw byobRequestBrandCheckException('respond');
  8505. }
  8506. if (this._associatedReadableByteStreamController === undefined) {
  8507. throw new TypeError('This BYOB request has been invalidated');
  8508. }
  8509. if (IsDetachedBuffer(this._view.buffer) === true);
  8510. ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
  8511. };
  8512. ReadableStreamBYOBRequest.prototype.respondWithNewView = function (view) {
  8513. if (IsReadableStreamBYOBRequest(this) === false) {
  8514. throw byobRequestBrandCheckException('respond');
  8515. }
  8516. if (this._associatedReadableByteStreamController === undefined) {
  8517. throw new TypeError('This BYOB request has been invalidated');
  8518. }
  8519. if (!ArrayBuffer.isView(view)) {
  8520. throw new TypeError('You can only respond with array buffer views');
  8521. }
  8522. if (IsDetachedBuffer(view.buffer) === true);
  8523. ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
  8524. };
  8525. return ReadableStreamBYOBRequest;
  8526. }();
  8527. var ReadableByteStreamController = function () {
  8528. function ReadableByteStreamController() {
  8529. throw new TypeError('ReadableByteStreamController constructor cannot be used directly');
  8530. }
  8531. Object.defineProperty(ReadableByteStreamController.prototype, "byobRequest", {
  8532. get: function () {
  8533. if (IsReadableByteStreamController(this) === false) {
  8534. throw byteStreamControllerBrandCheckException('byobRequest');
  8535. }
  8536. if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) {
  8537. var firstDescriptor = this._pendingPullIntos.peek();
  8538. var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
  8539. var byobRequest = Object.create(ReadableStreamBYOBRequest.prototype);
  8540. SetUpReadableStreamBYOBRequest(byobRequest, this, view);
  8541. this._byobRequest = byobRequest;
  8542. }
  8543. return this._byobRequest;
  8544. },
  8545. enumerable: true,
  8546. configurable: true
  8547. });
  8548. Object.defineProperty(ReadableByteStreamController.prototype, "desiredSize", {
  8549. get: function () {
  8550. if (IsReadableByteStreamController(this) === false) {
  8551. throw byteStreamControllerBrandCheckException('desiredSize');
  8552. }
  8553. return ReadableByteStreamControllerGetDesiredSize(this);
  8554. },
  8555. enumerable: true,
  8556. configurable: true
  8557. });
  8558. ReadableByteStreamController.prototype.close = function () {
  8559. if (IsReadableByteStreamController(this) === false) {
  8560. throw byteStreamControllerBrandCheckException('close');
  8561. }
  8562. if (this._closeRequested === true) {
  8563. throw new TypeError('The stream has already been closed; do not close it again!');
  8564. }
  8565. var state = this._controlledReadableByteStream._state;
  8566. if (state !== 'readable') {
  8567. throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be closed");
  8568. }
  8569. ReadableByteStreamControllerClose(this);
  8570. };
  8571. ReadableByteStreamController.prototype.enqueue = function (chunk) {
  8572. if (IsReadableByteStreamController(this) === false) {
  8573. throw byteStreamControllerBrandCheckException('enqueue');
  8574. }
  8575. if (this._closeRequested === true) {
  8576. throw new TypeError('stream is closed or draining');
  8577. }
  8578. var state = this._controlledReadableByteStream._state;
  8579. if (state !== 'readable') {
  8580. throw new TypeError("The stream (in " + state + " state) is not in the readable state and cannot be enqueued to");
  8581. }
  8582. if (!ArrayBuffer.isView(chunk)) {
  8583. throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController');
  8584. }
  8585. if (IsDetachedBuffer(chunk.buffer) === true);
  8586. ReadableByteStreamControllerEnqueue(this, chunk);
  8587. };
  8588. ReadableByteStreamController.prototype.error = function (e) {
  8589. if (IsReadableByteStreamController(this) === false) {
  8590. throw byteStreamControllerBrandCheckException('error');
  8591. }
  8592. ReadableByteStreamControllerError(this, e);
  8593. };
  8594. ReadableByteStreamController.prototype[CancelSteps] = function (reason) {
  8595. if (this._pendingPullIntos.length > 0) {
  8596. var firstDescriptor = this._pendingPullIntos.peek();
  8597. firstDescriptor.bytesFilled = 0;
  8598. }
  8599. ResetQueue(this);
  8600. var result = this._cancelAlgorithm(reason);
  8601. ReadableByteStreamControllerClearAlgorithms(this);
  8602. return result;
  8603. };
  8604. ReadableByteStreamController.prototype[PullSteps] = function () {
  8605. var stream = this._controlledReadableByteStream;
  8606. if (this._queueTotalSize > 0) {
  8607. var entry = this._queue.shift();
  8608. this._queueTotalSize -= entry.byteLength;
  8609. ReadableByteStreamControllerHandleQueueDrain(this);
  8610. var view = void 0;
  8611. try {
  8612. view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
  8613. } catch (viewE) {
  8614. return promiseRejectedWith(viewE);
  8615. }
  8616. return promiseResolvedWith(ReadableStreamCreateReadResult(view, false, stream._reader._forAuthorCode));
  8617. }
  8618. var autoAllocateChunkSize = this._autoAllocateChunkSize;
  8619. if (autoAllocateChunkSize !== undefined) {
  8620. var buffer = void 0;
  8621. try {
  8622. buffer = new ArrayBuffer(autoAllocateChunkSize);
  8623. } catch (bufferE) {
  8624. return promiseRejectedWith(bufferE);
  8625. }
  8626. var pullIntoDescriptor = {
  8627. buffer: buffer,
  8628. byteOffset: 0,
  8629. byteLength: autoAllocateChunkSize,
  8630. bytesFilled: 0,
  8631. elementSize: 1,
  8632. ctor: Uint8Array,
  8633. readerType: 'default'
  8634. };
  8635. this._pendingPullIntos.push(pullIntoDescriptor);
  8636. }
  8637. var promise = ReadableStreamAddReadRequest(stream);
  8638. ReadableByteStreamControllerCallPullIfNeeded(this);
  8639. return promise;
  8640. };
  8641. return ReadableByteStreamController;
  8642. }();
  8643. function IsReadableByteStreamController(x) {
  8644. if (!typeIsObject(x)) {
  8645. return false;
  8646. }
  8647. if (!Object.prototype.hasOwnProperty.call(x, '_controlledReadableByteStream')) {
  8648. return false;
  8649. }
  8650. return true;
  8651. }
  8652. function IsReadableStreamBYOBRequest(x) {
  8653. if (!typeIsObject(x)) {
  8654. return false;
  8655. }
  8656. if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
  8657. return false;
  8658. }
  8659. return true;
  8660. }
  8661. function ReadableByteStreamControllerCallPullIfNeeded(controller) {
  8662. var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
  8663. if (shouldPull === false) {
  8664. return;
  8665. }
  8666. if (controller._pulling === true) {
  8667. controller._pullAgain = true;
  8668. return;
  8669. }
  8670. controller._pulling = true;
  8671. var pullPromise = controller._pullAlgorithm();
  8672. uponPromise(pullPromise, function () {
  8673. controller._pulling = false;
  8674. if (controller._pullAgain === true) {
  8675. controller._pullAgain = false;
  8676. ReadableByteStreamControllerCallPullIfNeeded(controller);
  8677. }
  8678. }, function (e) {
  8679. ReadableByteStreamControllerError(controller, e);
  8680. });
  8681. }
  8682. function ReadableByteStreamControllerClearPendingPullIntos(controller) {
  8683. ReadableByteStreamControllerInvalidateBYOBRequest(controller);
  8684. controller._pendingPullIntos = new SimpleQueue();
  8685. }
  8686. function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {
  8687. var done = false;
  8688. if (stream._state === 'closed') {
  8689. done = true;
  8690. }
  8691. var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
  8692. if (pullIntoDescriptor.readerType === 'default') {
  8693. ReadableStreamFulfillReadRequest(stream, filledView, done);
  8694. } else {
  8695. ReadableStreamFulfillReadIntoRequest(stream, filledView, done);
  8696. }
  8697. }
  8698. function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {
  8699. var bytesFilled = pullIntoDescriptor.bytesFilled;
  8700. var elementSize = pullIntoDescriptor.elementSize;
  8701. return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);
  8702. }
  8703. function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {
  8704. controller._queue.push({
  8705. buffer: buffer,
  8706. byteOffset: byteOffset,
  8707. byteLength: byteLength
  8708. });
  8709. controller._queueTotalSize += byteLength;
  8710. }
  8711. function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
  8712. var elementSize = pullIntoDescriptor.elementSize;
  8713. var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
  8714. var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
  8715. var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
  8716. var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
  8717. var totalBytesToCopyRemaining = maxBytesToCopy;
  8718. var ready = false;
  8719. if (maxAlignedBytes > currentAlignedBytes) {
  8720. totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
  8721. ready = true;
  8722. }
  8723. var queue = controller._queue;
  8724. while (totalBytesToCopyRemaining > 0) {
  8725. var headOfQueue = queue.peek();
  8726. var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);
  8727. var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
  8728. ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);
  8729. if (headOfQueue.byteLength === bytesToCopy) {
  8730. queue.shift();
  8731. } else {
  8732. headOfQueue.byteOffset += bytesToCopy;
  8733. headOfQueue.byteLength -= bytesToCopy;
  8734. }
  8735. controller._queueTotalSize -= bytesToCopy;
  8736. ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);
  8737. totalBytesToCopyRemaining -= bytesToCopy;
  8738. }
  8739. return ready;
  8740. }
  8741. function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
  8742. ReadableByteStreamControllerInvalidateBYOBRequest(controller);
  8743. pullIntoDescriptor.bytesFilled += size;
  8744. }
  8745. function ReadableByteStreamControllerHandleQueueDrain(controller) {
  8746. if (controller._queueTotalSize === 0 && controller._closeRequested === true) {
  8747. ReadableByteStreamControllerClearAlgorithms(controller);
  8748. ReadableStreamClose(controller._controlledReadableByteStream);
  8749. } else {
  8750. ReadableByteStreamControllerCallPullIfNeeded(controller);
  8751. }
  8752. }
  8753. function ReadableByteStreamControllerInvalidateBYOBRequest(controller) {
  8754. if (controller._byobRequest === undefined) {
  8755. return;
  8756. }
  8757. controller._byobRequest._associatedReadableByteStreamController = undefined;
  8758. controller._byobRequest._view = undefined;
  8759. controller._byobRequest = undefined;
  8760. }
  8761. function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {
  8762. while (controller._pendingPullIntos.length > 0) {
  8763. if (controller._queueTotalSize === 0) {
  8764. return;
  8765. }
  8766. var pullIntoDescriptor = controller._pendingPullIntos.peek();
  8767. if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
  8768. ReadableByteStreamControllerShiftPendingPullInto(controller);
  8769. ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
  8770. }
  8771. }
  8772. }
  8773. function ReadableByteStreamControllerPullInto(controller, view) {
  8774. var stream = controller._controlledReadableByteStream;
  8775. var elementSize = 1;
  8776. if (view.constructor !== DataView) {
  8777. elementSize = view.constructor.BYTES_PER_ELEMENT;
  8778. }
  8779. var ctor = view.constructor;
  8780. var buffer = TransferArrayBuffer(view.buffer);
  8781. var pullIntoDescriptor = {
  8782. buffer: buffer,
  8783. byteOffset: view.byteOffset,
  8784. byteLength: view.byteLength,
  8785. bytesFilled: 0,
  8786. elementSize: elementSize,
  8787. ctor: ctor,
  8788. readerType: 'byob'
  8789. };
  8790. if (controller._pendingPullIntos.length > 0) {
  8791. controller._pendingPullIntos.push(pullIntoDescriptor);
  8792. return ReadableStreamAddReadIntoRequest(stream);
  8793. }
  8794. if (stream._state === 'closed') {
  8795. var emptyView = new ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);
  8796. return promiseResolvedWith(ReadableStreamCreateReadResult(emptyView, true, stream._reader._forAuthorCode));
  8797. }
  8798. if (controller._queueTotalSize > 0) {
  8799. if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
  8800. var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
  8801. ReadableByteStreamControllerHandleQueueDrain(controller);
  8802. return promiseResolvedWith(ReadableStreamCreateReadResult(filledView, false, stream._reader._forAuthorCode));
  8803. }
  8804. if (controller._closeRequested === true) {
  8805. var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
  8806. ReadableByteStreamControllerError(controller, e);
  8807. return promiseRejectedWith(e);
  8808. }
  8809. }
  8810. controller._pendingPullIntos.push(pullIntoDescriptor);
  8811. var promise = ReadableStreamAddReadIntoRequest(stream);
  8812. ReadableByteStreamControllerCallPullIfNeeded(controller);
  8813. return promise;
  8814. }
  8815. function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
  8816. firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
  8817. var stream = controller._controlledReadableByteStream;
  8818. if (ReadableStreamHasBYOBReader(stream) === true) {
  8819. while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
  8820. var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);
  8821. ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);
  8822. }
  8823. }
  8824. }
  8825. function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
  8826. if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
  8827. throw new RangeError('bytesWritten out of range');
  8828. }
  8829. ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
  8830. if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
  8831. return;
  8832. }
  8833. ReadableByteStreamControllerShiftPendingPullInto(controller);
  8834. var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
  8835. if (remainderSize > 0) {
  8836. var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
  8837. var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);
  8838. ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
  8839. }
  8840. pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
  8841. pullIntoDescriptor.bytesFilled -= remainderSize;
  8842. ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableByteStream, pullIntoDescriptor);
  8843. ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
  8844. }
  8845. function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
  8846. var firstDescriptor = controller._pendingPullIntos.peek();
  8847. var stream = controller._controlledReadableByteStream;
  8848. if (stream._state === 'closed') {
  8849. if (bytesWritten !== 0) {
  8850. throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
  8851. }
  8852. ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
  8853. } else {
  8854. ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
  8855. }
  8856. ReadableByteStreamControllerCallPullIfNeeded(controller);
  8857. }
  8858. function ReadableByteStreamControllerShiftPendingPullInto(controller) {
  8859. var descriptor = controller._pendingPullIntos.shift();
  8860. ReadableByteStreamControllerInvalidateBYOBRequest(controller);
  8861. return descriptor;
  8862. }
  8863. function ReadableByteStreamControllerShouldCallPull(controller) {
  8864. var stream = controller._controlledReadableByteStream;
  8865. if (stream._state !== 'readable') {
  8866. return false;
  8867. }
  8868. if (controller._closeRequested === true) {
  8869. return false;
  8870. }
  8871. if (controller._started === false) {
  8872. return false;
  8873. }
  8874. if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
  8875. return true;
  8876. }
  8877. if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {
  8878. return true;
  8879. }
  8880. var desiredSize = ReadableByteStreamControllerGetDesiredSize(controller);
  8881. if (desiredSize > 0) {
  8882. return true;
  8883. }
  8884. return false;
  8885. }
  8886. function ReadableByteStreamControllerClearAlgorithms(controller) {
  8887. controller._pullAlgorithm = undefined;
  8888. controller._cancelAlgorithm = undefined;
  8889. }
  8890. function ReadableByteStreamControllerClose(controller) {
  8891. var stream = controller._controlledReadableByteStream;
  8892. if (controller._queueTotalSize > 0) {
  8893. controller._closeRequested = true;
  8894. return;
  8895. }
  8896. if (controller._pendingPullIntos.length > 0) {
  8897. var firstPendingPullInto = controller._pendingPullIntos.peek();
  8898. if (firstPendingPullInto.bytesFilled > 0) {
  8899. var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
  8900. ReadableByteStreamControllerError(controller, e);
  8901. throw e;
  8902. }
  8903. }
  8904. ReadableByteStreamControllerClearAlgorithms(controller);
  8905. ReadableStreamClose(stream);
  8906. }
  8907. function ReadableByteStreamControllerEnqueue(controller, chunk) {
  8908. var stream = controller._controlledReadableByteStream;
  8909. var buffer = chunk.buffer;
  8910. var byteOffset = chunk.byteOffset;
  8911. var byteLength = chunk.byteLength;
  8912. var transferredBuffer = TransferArrayBuffer(buffer);
  8913. if (ReadableStreamHasDefaultReader(stream) === true) {
  8914. if (ReadableStreamGetNumReadRequests(stream) === 0) {
  8915. ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
  8916. } else {
  8917. var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
  8918. ReadableStreamFulfillReadRequest(stream, transferredView, false);
  8919. }
  8920. } else if (ReadableStreamHasBYOBReader(stream) === true) {
  8921. ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
  8922. ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
  8923. } else {
  8924. ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
  8925. }
  8926. ReadableByteStreamControllerCallPullIfNeeded(controller);
  8927. }
  8928. function ReadableByteStreamControllerError(controller, e) {
  8929. var stream = controller._controlledReadableByteStream;
  8930. if (stream._state !== 'readable') {
  8931. return;
  8932. }
  8933. ReadableByteStreamControllerClearPendingPullIntos(controller);
  8934. ResetQueue(controller);
  8935. ReadableByteStreamControllerClearAlgorithms(controller);
  8936. ReadableStreamError(stream, e);
  8937. }
  8938. function ReadableByteStreamControllerGetDesiredSize(controller) {
  8939. var stream = controller._controlledReadableByteStream;
  8940. var state = stream._state;
  8941. if (state === 'errored') {
  8942. return null;
  8943. }
  8944. if (state === 'closed') {
  8945. return 0;
  8946. }
  8947. return controller._strategyHWM - controller._queueTotalSize;
  8948. }
  8949. function ReadableByteStreamControllerRespond(controller, bytesWritten) {
  8950. bytesWritten = Number(bytesWritten);
  8951. if (IsFiniteNonNegativeNumber(bytesWritten) === false) {
  8952. throw new RangeError('bytesWritten must be a finite');
  8953. }
  8954. ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
  8955. }
  8956. function ReadableByteStreamControllerRespondWithNewView(controller, view) {
  8957. var firstDescriptor = controller._pendingPullIntos.peek();
  8958. if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
  8959. throw new RangeError('The region specified by view does not match byobRequest');
  8960. }
  8961. if (firstDescriptor.byteLength !== view.byteLength) {
  8962. throw new RangeError('The buffer of view has different capacity than byobRequest');
  8963. }
  8964. firstDescriptor.buffer = view.buffer;
  8965. ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
  8966. }
  8967. function SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize) {
  8968. controller._controlledReadableByteStream = stream;
  8969. controller._pullAgain = false;
  8970. controller._pulling = false;
  8971. controller._byobRequest = undefined;
  8972. controller._queue = controller._queueTotalSize = undefined;
  8973. ResetQueue(controller);
  8974. controller._closeRequested = false;
  8975. controller._started = false;
  8976. controller._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);
  8977. controller._pullAlgorithm = pullAlgorithm;
  8978. controller._cancelAlgorithm = cancelAlgorithm;
  8979. controller._autoAllocateChunkSize = autoAllocateChunkSize;
  8980. controller._pendingPullIntos = new SimpleQueue();
  8981. stream._readableStreamController = controller;
  8982. var startResult = startAlgorithm();
  8983. uponPromise(promiseResolvedWith(startResult), function () {
  8984. controller._started = true;
  8985. ReadableByteStreamControllerCallPullIfNeeded(controller);
  8986. }, function (r) {
  8987. ReadableByteStreamControllerError(controller, r);
  8988. });
  8989. }
  8990. function SetUpReadableByteStreamControllerFromUnderlyingSource(stream, underlyingByteSource, highWaterMark) {
  8991. var controller = Object.create(ReadableByteStreamController.prototype);
  8992. function startAlgorithm() {
  8993. return InvokeOrNoop(underlyingByteSource, 'start', [controller]);
  8994. }
  8995. var pullAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, 'pull', 0, [controller]);
  8996. var cancelAlgorithm = CreateAlgorithmFromUnderlyingMethod(underlyingByteSource, 'cancel', 1, []);
  8997. var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
  8998. if (autoAllocateChunkSize !== undefined) {
  8999. autoAllocateChunkSize = Number(autoAllocateChunkSize);
  9000. if (NumberIsInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {
  9001. throw new RangeError('autoAllocateChunkSize must be a positive integer');
  9002. }
  9003. }
  9004. SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize);
  9005. }
  9006. function SetUpReadableStreamBYOBRequest(request, controller, view) {
  9007. request._associatedReadableByteStreamController = controller;
  9008. request._view = view;
  9009. }
  9010. function byobRequestBrandCheckException(name) {
  9011. return new TypeError("ReadableStreamBYOBRequest.prototype." + name + " can only be used on a ReadableStreamBYOBRequest");
  9012. }
  9013. function byteStreamControllerBrandCheckException(name) {
  9014. return new TypeError("ReadableByteStreamController.prototype." + name + " can only be used on a ReadableByteStreamController");
  9015. }
  9016. function AcquireReadableStreamBYOBReader(stream, forAuthorCode) {
  9017. if (forAuthorCode === void 0) {
  9018. forAuthorCode = false;
  9019. }
  9020. var reader = new ReadableStreamBYOBReader(stream);
  9021. reader._forAuthorCode = forAuthorCode;
  9022. return reader;
  9023. }
  9024. function ReadableStreamAddReadIntoRequest(stream) {
  9025. var promise = newPromise(function (resolve, reject) {
  9026. var readIntoRequest = {
  9027. _resolve: resolve,
  9028. _reject: reject
  9029. };
  9030. stream._reader._readIntoRequests.push(readIntoRequest);
  9031. });
  9032. return promise;
  9033. }
  9034. function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
  9035. var reader = stream._reader;
  9036. var readIntoRequest = reader._readIntoRequests.shift();
  9037. readIntoRequest._resolve(ReadableStreamCreateReadResult(chunk, done, reader._forAuthorCode));
  9038. }
  9039. function ReadableStreamGetNumReadIntoRequests(stream) {
  9040. return stream._reader._readIntoRequests.length;
  9041. }
  9042. function ReadableStreamHasBYOBReader(stream) {
  9043. var reader = stream._reader;
  9044. if (reader === undefined) {
  9045. return false;
  9046. }
  9047. if (!IsReadableStreamBYOBReader(reader)) {
  9048. return false;
  9049. }
  9050. return true;
  9051. }
  9052. var ReadableStreamBYOBReader = function () {
  9053. function ReadableStreamBYOBReader(stream) {
  9054. if (!IsReadableStream(stream)) {
  9055. throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source');
  9056. }
  9057. if (IsReadableByteStreamController(stream._readableStreamController) === false) {
  9058. throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source');
  9059. }
  9060. if (IsReadableStreamLocked(stream)) {
  9061. throw new TypeError('This stream has already been locked for exclusive reading by another reader');
  9062. }
  9063. ReadableStreamReaderGenericInitialize(this, stream);
  9064. this._readIntoRequests = new SimpleQueue();
  9065. }
  9066. Object.defineProperty(ReadableStreamBYOBReader.prototype, "closed", {
  9067. get: function () {
  9068. if (!IsReadableStreamBYOBReader(this)) {
  9069. return promiseRejectedWith(byobReaderBrandCheckException('closed'));
  9070. }
  9071. return this._closedPromise;
  9072. },
  9073. enumerable: true,
  9074. configurable: true
  9075. });
  9076. ReadableStreamBYOBReader.prototype.cancel = function (reason) {
  9077. if (!IsReadableStreamBYOBReader(this)) {
  9078. return promiseRejectedWith(byobReaderBrandCheckException('cancel'));
  9079. }
  9080. if (this._ownerReadableStream === undefined) {
  9081. return promiseRejectedWith(readerLockException('cancel'));
  9082. }
  9083. return ReadableStreamReaderGenericCancel(this, reason);
  9084. };
  9085. ReadableStreamBYOBReader.prototype.read = function (view) {
  9086. if (!IsReadableStreamBYOBReader(this)) {
  9087. return promiseRejectedWith(byobReaderBrandCheckException('read'));
  9088. }
  9089. if (this._ownerReadableStream === undefined) {
  9090. return promiseRejectedWith(readerLockException('read from'));
  9091. }
  9092. if (!ArrayBuffer.isView(view)) {
  9093. return promiseRejectedWith(new TypeError('view must be an array buffer view'));
  9094. }
  9095. if (IsDetachedBuffer(view.buffer) === true);
  9096. if (view.byteLength === 0) {
  9097. return promiseRejectedWith(new TypeError('view must have non-zero byteLength'));
  9098. }
  9099. return ReadableStreamBYOBReaderRead(this, view);
  9100. };
  9101. ReadableStreamBYOBReader.prototype.releaseLock = function () {
  9102. if (!IsReadableStreamBYOBReader(this)) {
  9103. throw byobReaderBrandCheckException('releaseLock');
  9104. }
  9105. if (this._ownerReadableStream === undefined) {
  9106. return;
  9107. }
  9108. if (this._readIntoRequests.length > 0) {
  9109. throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
  9110. }
  9111. ReadableStreamReaderGenericRelease(this);
  9112. };
  9113. return ReadableStreamBYOBReader;
  9114. }();
  9115. function IsReadableStreamBYOBReader(x) {
  9116. if (!typeIsObject(x)) {
  9117. return false;
  9118. }
  9119. if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
  9120. return false;
  9121. }
  9122. return true;
  9123. }
  9124. function ReadableStreamBYOBReaderRead(reader, view) {
  9125. var stream = reader._ownerReadableStream;
  9126. stream._disturbed = true;
  9127. if (stream._state === 'errored') {
  9128. return promiseRejectedWith(stream._storedError);
  9129. }
  9130. return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);
  9131. }
  9132. function byobReaderBrandCheckException(name) {
  9133. return new TypeError("ReadableStreamBYOBReader.prototype." + name + " can only be used on a ReadableStreamBYOBReader");
  9134. }
  9135. var ReadableStream = function () {
  9136. function ReadableStream(underlyingSource, strategy) {
  9137. if (underlyingSource === void 0) {
  9138. underlyingSource = {};
  9139. }
  9140. if (strategy === void 0) {
  9141. strategy = {};
  9142. }
  9143. InitializeReadableStream(this);
  9144. var size = strategy.size;
  9145. var highWaterMark = strategy.highWaterMark;
  9146. var type = underlyingSource.type;
  9147. var typeString = String(type);
  9148. if (typeString === 'bytes') {
  9149. if (size !== undefined) {
  9150. throw new RangeError('The strategy for a byte stream cannot have a size function');
  9151. }
  9152. if (highWaterMark === undefined) {
  9153. highWaterMark = 0;
  9154. }
  9155. highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
  9156. SetUpReadableByteStreamControllerFromUnderlyingSource(this, underlyingSource, highWaterMark);
  9157. } else if (type === undefined) {
  9158. var sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
  9159. if (highWaterMark === undefined) {
  9160. highWaterMark = 1;
  9161. }
  9162. highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
  9163. SetUpReadableStreamDefaultControllerFromUnderlyingSource(this, underlyingSource, highWaterMark, sizeAlgorithm);
  9164. } else {
  9165. throw new RangeError('Invalid type is specified');
  9166. }
  9167. }
  9168. Object.defineProperty(ReadableStream.prototype, "locked", {
  9169. get: function () {
  9170. if (IsReadableStream(this) === false) {
  9171. throw streamBrandCheckException$1('locked');
  9172. }
  9173. return IsReadableStreamLocked(this);
  9174. },
  9175. enumerable: true,
  9176. configurable: true
  9177. });
  9178. ReadableStream.prototype.cancel = function (reason) {
  9179. if (IsReadableStream(this) === false) {
  9180. return promiseRejectedWith(streamBrandCheckException$1('cancel'));
  9181. }
  9182. if (IsReadableStreamLocked(this) === true) {
  9183. return promiseRejectedWith(new TypeError('Cannot cancel a stream that already has a reader'));
  9184. }
  9185. return ReadableStreamCancel(this, reason);
  9186. };
  9187. ReadableStream.prototype.getReader = function (_a) {
  9188. var mode = (_a === void 0 ? {} : _a).mode;
  9189. if (IsReadableStream(this) === false) {
  9190. throw streamBrandCheckException$1('getReader');
  9191. }
  9192. if (mode === undefined) {
  9193. return AcquireReadableStreamDefaultReader(this, true);
  9194. }
  9195. mode = String(mode);
  9196. if (mode === 'byob') {
  9197. return AcquireReadableStreamBYOBReader(this, true);
  9198. }
  9199. throw new RangeError('Invalid mode is specified');
  9200. };
  9201. ReadableStream.prototype.pipeThrough = function (_a, _b) {
  9202. var writable = _a.writable, readable = _a.readable;
  9203. var _c = _b === void 0 ? {} : _b, preventClose = _c.preventClose, preventAbort = _c.preventAbort, preventCancel = _c.preventCancel, signal = _c.signal;
  9204. if (IsReadableStream(this) === false) {
  9205. throw streamBrandCheckException$1('pipeThrough');
  9206. }
  9207. if (IsWritableStream(writable) === false) {
  9208. throw new TypeError('writable argument to pipeThrough must be a WritableStream');
  9209. }
  9210. if (IsReadableStream(readable) === false) {
  9211. throw new TypeError('readable argument to pipeThrough must be a ReadableStream');
  9212. }
  9213. preventClose = Boolean(preventClose);
  9214. preventAbort = Boolean(preventAbort);
  9215. preventCancel = Boolean(preventCancel);
  9216. if (signal !== undefined && !isAbortSignal(signal)) {
  9217. throw new TypeError('ReadableStream.prototype.pipeThrough\'s signal option must be an AbortSignal');
  9218. }
  9219. if (IsReadableStreamLocked(this) === true) {
  9220. throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream');
  9221. }
  9222. if (IsWritableStreamLocked(writable) === true) {
  9223. throw new TypeError('ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream');
  9224. }
  9225. var promise = ReadableStreamPipeTo(this, writable, preventClose, preventAbort, preventCancel, signal);
  9226. setPromiseIsHandledToTrue(promise);
  9227. return readable;
  9228. };
  9229. ReadableStream.prototype.pipeTo = function (dest, _a) {
  9230. var _b = _a === void 0 ? {} : _a, preventClose = _b.preventClose, preventAbort = _b.preventAbort, preventCancel = _b.preventCancel, signal = _b.signal;
  9231. if (IsReadableStream(this) === false) {
  9232. return promiseRejectedWith(streamBrandCheckException$1('pipeTo'));
  9233. }
  9234. if (IsWritableStream(dest) === false) {
  9235. return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream'));
  9236. }
  9237. preventClose = Boolean(preventClose);
  9238. preventAbort = Boolean(preventAbort);
  9239. preventCancel = Boolean(preventCancel);
  9240. if (signal !== undefined && !isAbortSignal(signal)) {
  9241. return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo\'s signal option must be an AbortSignal'));
  9242. }
  9243. if (IsReadableStreamLocked(this) === true) {
  9244. return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream'));
  9245. }
  9246. if (IsWritableStreamLocked(dest) === true) {
  9247. return promiseRejectedWith(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream'));
  9248. }
  9249. return ReadableStreamPipeTo(this, dest, preventClose, preventAbort, preventCancel, signal);
  9250. };
  9251. ReadableStream.prototype.tee = function () {
  9252. if (IsReadableStream(this) === false) {
  9253. throw streamBrandCheckException$1('tee');
  9254. }
  9255. var branches = ReadableStreamTee(this);
  9256. return createArrayFromList(branches);
  9257. };
  9258. ReadableStream.prototype.getIterator = function (_a) {
  9259. var _b = (_a === void 0 ? {} : _a).preventCancel, preventCancel = _b === void 0 ? false : _b;
  9260. if (IsReadableStream(this) === false) {
  9261. throw streamBrandCheckException$1('getIterator');
  9262. }
  9263. return AcquireReadableStreamAsyncIterator(this, preventCancel);
  9264. };
  9265. return ReadableStream;
  9266. }();
  9267. if (typeof SymbolPolyfill.asyncIterator === 'symbol') {
  9268. Object.defineProperty(ReadableStream.prototype, SymbolPolyfill.asyncIterator, {
  9269. value: ReadableStream.prototype.getIterator,
  9270. enumerable: false,
  9271. writable: true,
  9272. configurable: true
  9273. });
  9274. }
  9275. function CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm) {
  9276. if (highWaterMark === void 0) {
  9277. highWaterMark = 1;
  9278. }
  9279. if (sizeAlgorithm === void 0) {
  9280. sizeAlgorithm = function () {
  9281. return 1;
  9282. };
  9283. }
  9284. var stream = Object.create(ReadableStream.prototype);
  9285. InitializeReadableStream(stream);
  9286. var controller = Object.create(ReadableStreamDefaultController.prototype);
  9287. SetUpReadableStreamDefaultController(stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, sizeAlgorithm);
  9288. return stream;
  9289. }
  9290. function InitializeReadableStream(stream) {
  9291. stream._state = 'readable';
  9292. stream._reader = undefined;
  9293. stream._storedError = undefined;
  9294. stream._disturbed = false;
  9295. }
  9296. function IsReadableStream(x) {
  9297. if (!typeIsObject(x)) {
  9298. return false;
  9299. }
  9300. if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
  9301. return false;
  9302. }
  9303. return true;
  9304. }
  9305. function IsReadableStreamLocked(stream) {
  9306. if (stream._reader === undefined) {
  9307. return false;
  9308. }
  9309. return true;
  9310. }
  9311. function ReadableStreamCancel(stream, reason) {
  9312. stream._disturbed = true;
  9313. if (stream._state === 'closed') {
  9314. return promiseResolvedWith(undefined);
  9315. }
  9316. if (stream._state === 'errored') {
  9317. return promiseRejectedWith(stream._storedError);
  9318. }
  9319. ReadableStreamClose(stream);
  9320. var sourceCancelPromise = stream._readableStreamController[CancelSteps](reason);
  9321. return transformPromiseWith(sourceCancelPromise, noop);
  9322. }
  9323. function ReadableStreamClose(stream) {
  9324. stream._state = 'closed';
  9325. var reader = stream._reader;
  9326. if (reader === undefined) {
  9327. return;
  9328. }
  9329. if (IsReadableStreamDefaultReader(reader)) {
  9330. reader._readRequests.forEach(function (readRequest) {
  9331. readRequest._resolve(ReadableStreamCreateReadResult(undefined, true, reader._forAuthorCode));
  9332. });
  9333. reader._readRequests = new SimpleQueue();
  9334. }
  9335. defaultReaderClosedPromiseResolve(reader);
  9336. }
  9337. function ReadableStreamError(stream, e) {
  9338. stream._state = 'errored';
  9339. stream._storedError = e;
  9340. var reader = stream._reader;
  9341. if (reader === undefined) {
  9342. return;
  9343. }
  9344. if (IsReadableStreamDefaultReader(reader)) {
  9345. reader._readRequests.forEach(function (readRequest) {
  9346. readRequest._reject(e);
  9347. });
  9348. reader._readRequests = new SimpleQueue();
  9349. } else {
  9350. reader._readIntoRequests.forEach(function (readIntoRequest) {
  9351. readIntoRequest._reject(e);
  9352. });
  9353. reader._readIntoRequests = new SimpleQueue();
  9354. }
  9355. defaultReaderClosedPromiseReject(reader, e);
  9356. }
  9357. function streamBrandCheckException$1(name) {
  9358. return new TypeError("ReadableStream.prototype." + name + " can only be used on a ReadableStream");
  9359. }
  9360. var ByteLengthQueuingStrategy = function () {
  9361. function ByteLengthQueuingStrategy(_a) {
  9362. var highWaterMark = _a.highWaterMark;
  9363. this.highWaterMark = highWaterMark;
  9364. }
  9365. ByteLengthQueuingStrategy.prototype.size = function (chunk) {
  9366. return chunk.byteLength;
  9367. };
  9368. return ByteLengthQueuingStrategy;
  9369. }();
  9370. var CountQueuingStrategy = function () {
  9371. function CountQueuingStrategy(_a) {
  9372. var highWaterMark = _a.highWaterMark;
  9373. this.highWaterMark = highWaterMark;
  9374. }
  9375. CountQueuingStrategy.prototype.size = function () {
  9376. return 1;
  9377. };
  9378. return CountQueuingStrategy;
  9379. }();
  9380. var TransformStream = function () {
  9381. function TransformStream(transformer, writableStrategy, readableStrategy) {
  9382. if (transformer === void 0) {
  9383. transformer = {};
  9384. }
  9385. if (writableStrategy === void 0) {
  9386. writableStrategy = {};
  9387. }
  9388. if (readableStrategy === void 0) {
  9389. readableStrategy = {};
  9390. }
  9391. var writableSizeFunction = writableStrategy.size;
  9392. var writableHighWaterMark = writableStrategy.highWaterMark;
  9393. var readableSizeFunction = readableStrategy.size;
  9394. var readableHighWaterMark = readableStrategy.highWaterMark;
  9395. var writableType = transformer.writableType;
  9396. if (writableType !== undefined) {
  9397. throw new RangeError('Invalid writable type specified');
  9398. }
  9399. var writableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(writableSizeFunction);
  9400. if (writableHighWaterMark === undefined) {
  9401. writableHighWaterMark = 1;
  9402. }
  9403. writableHighWaterMark = ValidateAndNormalizeHighWaterMark(writableHighWaterMark);
  9404. var readableType = transformer.readableType;
  9405. if (readableType !== undefined) {
  9406. throw new RangeError('Invalid readable type specified');
  9407. }
  9408. var readableSizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(readableSizeFunction);
  9409. if (readableHighWaterMark === undefined) {
  9410. readableHighWaterMark = 0;
  9411. }
  9412. readableHighWaterMark = ValidateAndNormalizeHighWaterMark(readableHighWaterMark);
  9413. var startPromise_resolve;
  9414. var startPromise = newPromise(function (resolve) {
  9415. startPromise_resolve = resolve;
  9416. });
  9417. InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
  9418. SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
  9419. var startResult = InvokeOrNoop(transformer, 'start', [this._transformStreamController]);
  9420. startPromise_resolve(startResult);
  9421. }
  9422. Object.defineProperty(TransformStream.prototype, "readable", {
  9423. get: function () {
  9424. if (IsTransformStream(this) === false) {
  9425. throw streamBrandCheckException$2('readable');
  9426. }
  9427. return this._readable;
  9428. },
  9429. enumerable: true,
  9430. configurable: true
  9431. });
  9432. Object.defineProperty(TransformStream.prototype, "writable", {
  9433. get: function () {
  9434. if (IsTransformStream(this) === false) {
  9435. throw streamBrandCheckException$2('writable');
  9436. }
  9437. return this._writable;
  9438. },
  9439. enumerable: true,
  9440. configurable: true
  9441. });
  9442. return TransformStream;
  9443. }();
  9444. function InitializeTransformStream(stream, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm) {
  9445. function startAlgorithm() {
  9446. return startPromise;
  9447. }
  9448. function writeAlgorithm(chunk) {
  9449. return TransformStreamDefaultSinkWriteAlgorithm(stream, chunk);
  9450. }
  9451. function abortAlgorithm(reason) {
  9452. return TransformStreamDefaultSinkAbortAlgorithm(stream, reason);
  9453. }
  9454. function closeAlgorithm() {
  9455. return TransformStreamDefaultSinkCloseAlgorithm(stream);
  9456. }
  9457. stream._writable = CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm);
  9458. function pullAlgorithm() {
  9459. return TransformStreamDefaultSourcePullAlgorithm(stream);
  9460. }
  9461. function cancelAlgorithm(reason) {
  9462. TransformStreamErrorWritableAndUnblockWrite(stream, reason);
  9463. return promiseResolvedWith(undefined);
  9464. }
  9465. stream._readable = CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
  9466. stream._backpressure = undefined;
  9467. stream._backpressureChangePromise = undefined;
  9468. stream._backpressureChangePromise_resolve = undefined;
  9469. TransformStreamSetBackpressure(stream, true);
  9470. stream._transformStreamController = undefined;
  9471. }
  9472. function IsTransformStream(x) {
  9473. if (!typeIsObject(x)) {
  9474. return false;
  9475. }
  9476. if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
  9477. return false;
  9478. }
  9479. return true;
  9480. }
  9481. function TransformStreamError(stream, e) {
  9482. ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e);
  9483. TransformStreamErrorWritableAndUnblockWrite(stream, e);
  9484. }
  9485. function TransformStreamErrorWritableAndUnblockWrite(stream, e) {
  9486. TransformStreamDefaultControllerClearAlgorithms(stream._transformStreamController);
  9487. WritableStreamDefaultControllerErrorIfNeeded(stream._writable._writableStreamController, e);
  9488. if (stream._backpressure === true) {
  9489. TransformStreamSetBackpressure(stream, false);
  9490. }
  9491. }
  9492. function TransformStreamSetBackpressure(stream, backpressure) {
  9493. if (stream._backpressureChangePromise !== undefined) {
  9494. stream._backpressureChangePromise_resolve();
  9495. }
  9496. stream._backpressureChangePromise = newPromise(function (resolve) {
  9497. stream._backpressureChangePromise_resolve = resolve;
  9498. });
  9499. stream._backpressure = backpressure;
  9500. }
  9501. var TransformStreamDefaultController = function () {
  9502. function TransformStreamDefaultController() {
  9503. throw new TypeError('TransformStreamDefaultController instances cannot be created directly');
  9504. }
  9505. Object.defineProperty(TransformStreamDefaultController.prototype, "desiredSize", {
  9506. get: function () {
  9507. if (IsTransformStreamDefaultController(this) === false) {
  9508. throw defaultControllerBrandCheckException$1('desiredSize');
  9509. }
  9510. var readableController = this._controlledTransformStream._readable._readableStreamController;
  9511. return ReadableStreamDefaultControllerGetDesiredSize(readableController);
  9512. },
  9513. enumerable: true,
  9514. configurable: true
  9515. });
  9516. TransformStreamDefaultController.prototype.enqueue = function (chunk) {
  9517. if (IsTransformStreamDefaultController(this) === false) {
  9518. throw defaultControllerBrandCheckException$1('enqueue');
  9519. }
  9520. TransformStreamDefaultControllerEnqueue(this, chunk);
  9521. };
  9522. TransformStreamDefaultController.prototype.error = function (reason) {
  9523. if (IsTransformStreamDefaultController(this) === false) {
  9524. throw defaultControllerBrandCheckException$1('error');
  9525. }
  9526. TransformStreamDefaultControllerError(this, reason);
  9527. };
  9528. TransformStreamDefaultController.prototype.terminate = function () {
  9529. if (IsTransformStreamDefaultController(this) === false) {
  9530. throw defaultControllerBrandCheckException$1('terminate');
  9531. }
  9532. TransformStreamDefaultControllerTerminate(this);
  9533. };
  9534. return TransformStreamDefaultController;
  9535. }();
  9536. function IsTransformStreamDefaultController(x) {
  9537. if (!typeIsObject(x)) {
  9538. return false;
  9539. }
  9540. if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
  9541. return false;
  9542. }
  9543. return true;
  9544. }
  9545. function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm) {
  9546. controller._controlledTransformStream = stream;
  9547. stream._transformStreamController = controller;
  9548. controller._transformAlgorithm = transformAlgorithm;
  9549. controller._flushAlgorithm = flushAlgorithm;
  9550. }
  9551. function SetUpTransformStreamDefaultControllerFromTransformer(stream, transformer) {
  9552. var controller = Object.create(TransformStreamDefaultController.prototype);
  9553. var transformAlgorithm = function (chunk) {
  9554. try {
  9555. TransformStreamDefaultControllerEnqueue(controller, chunk);
  9556. return promiseResolvedWith(undefined);
  9557. } catch (transformResultE) {
  9558. return promiseRejectedWith(transformResultE);
  9559. }
  9560. };
  9561. var transformMethod = transformer.transform;
  9562. if (transformMethod !== undefined) {
  9563. if (typeof transformMethod !== 'function') {
  9564. throw new TypeError('transform is not a method');
  9565. }
  9566. transformAlgorithm = function (chunk) {
  9567. return PromiseCall(transformMethod, transformer, [
  9568. chunk,
  9569. controller
  9570. ]);
  9571. };
  9572. }
  9573. var flushAlgorithm = CreateAlgorithmFromUnderlyingMethod(transformer, 'flush', 0, [controller]);
  9574. SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm);
  9575. }
  9576. function TransformStreamDefaultControllerClearAlgorithms(controller) {
  9577. controller._transformAlgorithm = undefined;
  9578. controller._flushAlgorithm = undefined;
  9579. }
  9580. function TransformStreamDefaultControllerEnqueue(controller, chunk) {
  9581. var stream = controller._controlledTransformStream;
  9582. var readableController = stream._readable._readableStreamController;
  9583. if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === false) {
  9584. throw new TypeError('Readable side is not in a state that permits enqueue');
  9585. }
  9586. try {
  9587. ReadableStreamDefaultControllerEnqueue(readableController, chunk);
  9588. } catch (e) {
  9589. TransformStreamErrorWritableAndUnblockWrite(stream, e);
  9590. throw stream._readable._storedError;
  9591. }
  9592. var backpressure = ReadableStreamDefaultControllerHasBackpressure(readableController);
  9593. if (backpressure !== stream._backpressure) {
  9594. TransformStreamSetBackpressure(stream, true);
  9595. }
  9596. }
  9597. function TransformStreamDefaultControllerError(controller, e) {
  9598. TransformStreamError(controller._controlledTransformStream, e);
  9599. }
  9600. function TransformStreamDefaultControllerPerformTransform(controller, chunk) {
  9601. var transformPromise = controller._transformAlgorithm(chunk);
  9602. return transformPromiseWith(transformPromise, undefined, function (r) {
  9603. TransformStreamError(controller._controlledTransformStream, r);
  9604. throw r;
  9605. });
  9606. }
  9607. function TransformStreamDefaultControllerTerminate(controller) {
  9608. var stream = controller._controlledTransformStream;
  9609. var readableController = stream._readable._readableStreamController;
  9610. if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) {
  9611. ReadableStreamDefaultControllerClose(readableController);
  9612. }
  9613. var error = new TypeError('TransformStream terminated');
  9614. TransformStreamErrorWritableAndUnblockWrite(stream, error);
  9615. }
  9616. function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
  9617. var controller = stream._transformStreamController;
  9618. if (stream._backpressure === true) {
  9619. var backpressureChangePromise = stream._backpressureChangePromise;
  9620. return transformPromiseWith(backpressureChangePromise, function () {
  9621. var writable = stream._writable;
  9622. var state = writable._state;
  9623. if (state === 'erroring') {
  9624. throw writable._storedError;
  9625. }
  9626. return TransformStreamDefaultControllerPerformTransform(controller, chunk);
  9627. });
  9628. }
  9629. return TransformStreamDefaultControllerPerformTransform(controller, chunk);
  9630. }
  9631. function TransformStreamDefaultSinkAbortAlgorithm(stream, reason) {
  9632. TransformStreamError(stream, reason);
  9633. return promiseResolvedWith(undefined);
  9634. }
  9635. function TransformStreamDefaultSinkCloseAlgorithm(stream) {
  9636. var readable = stream._readable;
  9637. var controller = stream._transformStreamController;
  9638. var flushPromise = controller._flushAlgorithm();
  9639. TransformStreamDefaultControllerClearAlgorithms(controller);
  9640. return transformPromiseWith(flushPromise, function () {
  9641. if (readable._state === 'errored') {
  9642. throw readable._storedError;
  9643. }
  9644. var readableController = readable._readableStreamController;
  9645. if (ReadableStreamDefaultControllerCanCloseOrEnqueue(readableController) === true) {
  9646. ReadableStreamDefaultControllerClose(readableController);
  9647. }
  9648. }, function (r) {
  9649. TransformStreamError(stream, r);
  9650. throw readable._storedError;
  9651. });
  9652. }
  9653. function TransformStreamDefaultSourcePullAlgorithm(stream) {
  9654. TransformStreamSetBackpressure(stream, false);
  9655. return stream._backpressureChangePromise;
  9656. }
  9657. function defaultControllerBrandCheckException$1(name) {
  9658. return new TypeError("TransformStreamDefaultController.prototype." + name + " can only be used on a TransformStreamDefaultController");
  9659. }
  9660. function streamBrandCheckException$2(name) {
  9661. return new TypeError("TransformStream.prototype." + name + " can only be used on a TransformStream");
  9662. }
  9663. exports.ByteLengthQueuingStrategy = ByteLengthQueuingStrategy;
  9664. exports.CountQueuingStrategy = CountQueuingStrategy;
  9665. exports.ReadableStream = ReadableStream;
  9666. exports.TransformStream = TransformStream;
  9667. exports.WritableStream = WritableStream;
  9668. Object.defineProperty(exports, '__esModule', { value: true });
  9669. }));
  9670. /***/ }),
  9671. /* 144 */
  9672. /***/ (function(module, exports, __w_pdfjs_require__) {
  9673. __w_pdfjs_require__(145);
  9674. __w_pdfjs_require__(114);
  9675. __w_pdfjs_require__(77);
  9676. __w_pdfjs_require__(116);
  9677. var path = __w_pdfjs_require__(43);
  9678. module.exports = path.Map;
  9679. /***/ }),
  9680. /* 145 */
  9681. /***/ (function(module, exports, __w_pdfjs_require__) {
  9682. "use strict";
  9683. var collection = __w_pdfjs_require__(146);
  9684. var collectionStrong = __w_pdfjs_require__(150);
  9685. module.exports = collection('Map', function (init) {
  9686. return function Map() {
  9687. return init(this, arguments.length ? arguments[0] : undefined);
  9688. };
  9689. }, collectionStrong);
  9690. /***/ }),
  9691. /* 146 */
  9692. /***/ (function(module, exports, __w_pdfjs_require__) {
  9693. "use strict";
  9694. var $ = __w_pdfjs_require__(10);
  9695. var global = __w_pdfjs_require__(11);
  9696. var isForced = __w_pdfjs_require__(52);
  9697. var redefine = __w_pdfjs_require__(29);
  9698. var InternalMetadataModule = __w_pdfjs_require__(147);
  9699. var iterate = __w_pdfjs_require__(124);
  9700. var anInstance = __w_pdfjs_require__(123);
  9701. var isObject = __w_pdfjs_require__(22);
  9702. var fails = __w_pdfjs_require__(14);
  9703. var checkCorrectnessOfIteration = __w_pdfjs_require__(97);
  9704. var setToStringTag = __w_pdfjs_require__(85);
  9705. var inheritIfRequired = __w_pdfjs_require__(149);
  9706. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  9707. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  9708. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  9709. var ADDER = IS_MAP ? 'set' : 'add';
  9710. var NativeConstructor = global[CONSTRUCTOR_NAME];
  9711. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  9712. var Constructor = NativeConstructor;
  9713. var exported = {};
  9714. var fixMethod = function (KEY) {
  9715. var nativeMethod = NativePrototype[KEY];
  9716. redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  9717. nativeMethod.call(this, value === 0 ? 0 : value);
  9718. return this;
  9719. } : KEY == 'delete' ? function (key) {
  9720. return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
  9721. } : KEY == 'get' ? function get(key) {
  9722. return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key);
  9723. } : KEY == 'has' ? function has(key) {
  9724. return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key);
  9725. } : function set(key, value) {
  9726. nativeMethod.call(this, key === 0 ? 0 : key, value);
  9727. return this;
  9728. });
  9729. };
  9730. if (isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  9731. new NativeConstructor().entries().next();
  9732. })))) {
  9733. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  9734. InternalMetadataModule.REQUIRED = true;
  9735. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  9736. var instance = new Constructor();
  9737. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  9738. var THROWS_ON_PRIMITIVES = fails(function () {
  9739. instance.has(1);
  9740. });
  9741. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  9742. new NativeConstructor(iterable);
  9743. });
  9744. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  9745. var $instance = new NativeConstructor();
  9746. var index = 5;
  9747. while (index--)
  9748. $instance[ADDER](index, index);
  9749. return !$instance.has(-0);
  9750. });
  9751. if (!ACCEPT_ITERABLES) {
  9752. Constructor = wrapper(function (dummy, iterable) {
  9753. anInstance(dummy, Constructor, CONSTRUCTOR_NAME);
  9754. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  9755. if (iterable != undefined)
  9756. iterate(iterable, that[ADDER], that, IS_MAP);
  9757. return that;
  9758. });
  9759. Constructor.prototype = NativePrototype;
  9760. NativePrototype.constructor = Constructor;
  9761. }
  9762. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  9763. fixMethod('delete');
  9764. fixMethod('has');
  9765. IS_MAP && fixMethod('get');
  9766. }
  9767. if (BUGGY_ZERO || HASNT_CHAINING)
  9768. fixMethod(ADDER);
  9769. if (IS_WEAK && NativePrototype.clear)
  9770. delete NativePrototype.clear;
  9771. }
  9772. exported[CONSTRUCTOR_NAME] = Constructor;
  9773. $({
  9774. global: true,
  9775. forced: Constructor != NativeConstructor
  9776. }, exported);
  9777. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  9778. if (!IS_WEAK)
  9779. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  9780. return Constructor;
  9781. };
  9782. /***/ }),
  9783. /* 147 */
  9784. /***/ (function(module, exports, __w_pdfjs_require__) {
  9785. var hiddenKeys = __w_pdfjs_require__(39);
  9786. var isObject = __w_pdfjs_require__(22);
  9787. var has = __w_pdfjs_require__(23);
  9788. var defineProperty = __w_pdfjs_require__(27).f;
  9789. var uid = __w_pdfjs_require__(38);
  9790. var FREEZING = __w_pdfjs_require__(148);
  9791. var METADATA = uid('meta');
  9792. var id = 0;
  9793. var isExtensible = Object.isExtensible || function () {
  9794. return true;
  9795. };
  9796. var setMetadata = function (it) {
  9797. defineProperty(it, METADATA, {
  9798. value: {
  9799. objectID: 'O' + ++id,
  9800. weakData: {}
  9801. }
  9802. });
  9803. };
  9804. var fastKey = function (it, create) {
  9805. if (!isObject(it))
  9806. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  9807. if (!has(it, METADATA)) {
  9808. if (!isExtensible(it))
  9809. return 'F';
  9810. if (!create)
  9811. return 'E';
  9812. setMetadata(it);
  9813. }
  9814. return it[METADATA].objectID;
  9815. };
  9816. var getWeakData = function (it, create) {
  9817. if (!has(it, METADATA)) {
  9818. if (!isExtensible(it))
  9819. return true;
  9820. if (!create)
  9821. return false;
  9822. setMetadata(it);
  9823. }
  9824. return it[METADATA].weakData;
  9825. };
  9826. var onFreeze = function (it) {
  9827. if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA))
  9828. setMetadata(it);
  9829. return it;
  9830. };
  9831. var meta = module.exports = {
  9832. REQUIRED: false,
  9833. fastKey: fastKey,
  9834. getWeakData: getWeakData,
  9835. onFreeze: onFreeze
  9836. };
  9837. hiddenKeys[METADATA] = true;
  9838. /***/ }),
  9839. /* 148 */
  9840. /***/ (function(module, exports, __w_pdfjs_require__) {
  9841. var fails = __w_pdfjs_require__(14);
  9842. module.exports = !fails(function () {
  9843. return Object.isExtensible(Object.preventExtensions({}));
  9844. });
  9845. /***/ }),
  9846. /* 149 */
  9847. /***/ (function(module, exports, __w_pdfjs_require__) {
  9848. var isObject = __w_pdfjs_require__(22);
  9849. var setPrototypeOf = __w_pdfjs_require__(87);
  9850. module.exports = function ($this, dummy, Wrapper) {
  9851. var NewTarget, NewTargetPrototype;
  9852. if (setPrototypeOf && typeof (NewTarget = dummy.constructor) == 'function' && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  9853. setPrototypeOf($this, NewTargetPrototype);
  9854. return $this;
  9855. };
  9856. /***/ }),
  9857. /* 150 */
  9858. /***/ (function(module, exports, __w_pdfjs_require__) {
  9859. "use strict";
  9860. var defineProperty = __w_pdfjs_require__(27).f;
  9861. var create = __w_pdfjs_require__(71);
  9862. var redefineAll = __w_pdfjs_require__(121);
  9863. var bind = __w_pdfjs_require__(62);
  9864. var anInstance = __w_pdfjs_require__(123);
  9865. var iterate = __w_pdfjs_require__(124);
  9866. var defineIterator = __w_pdfjs_require__(79);
  9867. var setSpecies = __w_pdfjs_require__(122);
  9868. var DESCRIPTORS = __w_pdfjs_require__(13);
  9869. var fastKey = __w_pdfjs_require__(147).fastKey;
  9870. var InternalStateModule = __w_pdfjs_require__(33);
  9871. var setInternalState = InternalStateModule.set;
  9872. var internalStateGetterFor = InternalStateModule.getterFor;
  9873. module.exports = {
  9874. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  9875. var C = wrapper(function (that, iterable) {
  9876. anInstance(that, C, CONSTRUCTOR_NAME);
  9877. setInternalState(that, {
  9878. type: CONSTRUCTOR_NAME,
  9879. index: create(null),
  9880. first: undefined,
  9881. last: undefined,
  9882. size: 0
  9883. });
  9884. if (!DESCRIPTORS)
  9885. that.size = 0;
  9886. if (iterable != undefined)
  9887. iterate(iterable, that[ADDER], that, IS_MAP);
  9888. });
  9889. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  9890. var define = function (that, key, value) {
  9891. var state = getInternalState(that);
  9892. var entry = getEntry(that, key);
  9893. var previous, index;
  9894. if (entry) {
  9895. entry.value = value;
  9896. } else {
  9897. state.last = entry = {
  9898. index: index = fastKey(key, true),
  9899. key: key,
  9900. value: value,
  9901. previous: previous = state.last,
  9902. next: undefined,
  9903. removed: false
  9904. };
  9905. if (!state.first)
  9906. state.first = entry;
  9907. if (previous)
  9908. previous.next = entry;
  9909. if (DESCRIPTORS)
  9910. state.size++;
  9911. else
  9912. that.size++;
  9913. if (index !== 'F')
  9914. state.index[index] = entry;
  9915. }
  9916. return that;
  9917. };
  9918. var getEntry = function (that, key) {
  9919. var state = getInternalState(that);
  9920. var index = fastKey(key);
  9921. var entry;
  9922. if (index !== 'F')
  9923. return state.index[index];
  9924. for (entry = state.first; entry; entry = entry.next) {
  9925. if (entry.key == key)
  9926. return entry;
  9927. }
  9928. };
  9929. redefineAll(C.prototype, {
  9930. clear: function clear() {
  9931. var that = this;
  9932. var state = getInternalState(that);
  9933. var data = state.index;
  9934. var entry = state.first;
  9935. while (entry) {
  9936. entry.removed = true;
  9937. if (entry.previous)
  9938. entry.previous = entry.previous.next = undefined;
  9939. delete data[entry.index];
  9940. entry = entry.next;
  9941. }
  9942. state.first = state.last = undefined;
  9943. if (DESCRIPTORS)
  9944. state.size = 0;
  9945. else
  9946. that.size = 0;
  9947. },
  9948. 'delete': function (key) {
  9949. var that = this;
  9950. var state = getInternalState(that);
  9951. var entry = getEntry(that, key);
  9952. if (entry) {
  9953. var next = entry.next;
  9954. var prev = entry.previous;
  9955. delete state.index[entry.index];
  9956. entry.removed = true;
  9957. if (prev)
  9958. prev.next = next;
  9959. if (next)
  9960. next.previous = prev;
  9961. if (state.first == entry)
  9962. state.first = next;
  9963. if (state.last == entry)
  9964. state.last = prev;
  9965. if (DESCRIPTORS)
  9966. state.size--;
  9967. else
  9968. that.size--;
  9969. }
  9970. return !!entry;
  9971. },
  9972. forEach: function forEach(callbackfn) {
  9973. var state = getInternalState(this);
  9974. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  9975. var entry;
  9976. while (entry = entry ? entry.next : state.first) {
  9977. boundFunction(entry.value, entry.key, this);
  9978. while (entry && entry.removed)
  9979. entry = entry.previous;
  9980. }
  9981. },
  9982. has: function has(key) {
  9983. return !!getEntry(this, key);
  9984. }
  9985. });
  9986. redefineAll(C.prototype, IS_MAP ? {
  9987. get: function get(key) {
  9988. var entry = getEntry(this, key);
  9989. return entry && entry.value;
  9990. },
  9991. set: function set(key, value) {
  9992. return define(this, key === 0 ? 0 : key, value);
  9993. }
  9994. } : {
  9995. add: function add(value) {
  9996. return define(this, value = value === 0 ? 0 : value, value);
  9997. }
  9998. });
  9999. if (DESCRIPTORS)
  10000. defineProperty(C.prototype, 'size', {
  10001. get: function () {
  10002. return getInternalState(this).size;
  10003. }
  10004. });
  10005. return C;
  10006. },
  10007. setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
  10008. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  10009. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  10010. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  10011. defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
  10012. setInternalState(this, {
  10013. type: ITERATOR_NAME,
  10014. target: iterated,
  10015. state: getInternalCollectionState(iterated),
  10016. kind: kind,
  10017. last: undefined
  10018. });
  10019. }, function () {
  10020. var state = getInternalIteratorState(this);
  10021. var kind = state.kind;
  10022. var entry = state.last;
  10023. while (entry && entry.removed)
  10024. entry = entry.previous;
  10025. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  10026. state.target = undefined;
  10027. return {
  10028. value: undefined,
  10029. done: true
  10030. };
  10031. }
  10032. if (kind == 'keys')
  10033. return {
  10034. value: entry.key,
  10035. done: false
  10036. };
  10037. if (kind == 'values')
  10038. return {
  10039. value: entry.value,
  10040. done: false
  10041. };
  10042. return {
  10043. value: [
  10044. entry.key,
  10045. entry.value
  10046. ],
  10047. done: false
  10048. };
  10049. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  10050. setSpecies(CONSTRUCTOR_NAME);
  10051. }
  10052. };
  10053. /***/ }),
  10054. /* 151 */
  10055. /***/ (function(module, exports, __w_pdfjs_require__) {
  10056. __w_pdfjs_require__(152);
  10057. __w_pdfjs_require__(114);
  10058. __w_pdfjs_require__(77);
  10059. __w_pdfjs_require__(116);
  10060. var path = __w_pdfjs_require__(43);
  10061. module.exports = path.Set;
  10062. /***/ }),
  10063. /* 152 */
  10064. /***/ (function(module, exports, __w_pdfjs_require__) {
  10065. "use strict";
  10066. var collection = __w_pdfjs_require__(146);
  10067. var collectionStrong = __w_pdfjs_require__(150);
  10068. module.exports = collection('Set', function (init) {
  10069. return function Set() {
  10070. return init(this, arguments.length ? arguments[0] : undefined);
  10071. };
  10072. }, collectionStrong);
  10073. /***/ }),
  10074. /* 153 */
  10075. /***/ (function(module, exports, __w_pdfjs_require__) {
  10076. __w_pdfjs_require__(114);
  10077. __w_pdfjs_require__(154);
  10078. __w_pdfjs_require__(116);
  10079. var path = __w_pdfjs_require__(43);
  10080. module.exports = path.WeakMap;
  10081. /***/ }),
  10082. /* 154 */
  10083. /***/ (function(module, exports, __w_pdfjs_require__) {
  10084. "use strict";
  10085. var global = __w_pdfjs_require__(11);
  10086. var redefineAll = __w_pdfjs_require__(121);
  10087. var InternalMetadataModule = __w_pdfjs_require__(147);
  10088. var collection = __w_pdfjs_require__(146);
  10089. var collectionWeak = __w_pdfjs_require__(155);
  10090. var isObject = __w_pdfjs_require__(22);
  10091. var enforceIternalState = __w_pdfjs_require__(33).enforce;
  10092. var NATIVE_WEAK_MAP = __w_pdfjs_require__(34);
  10093. var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
  10094. var isExtensible = Object.isExtensible;
  10095. var InternalWeakMap;
  10096. var wrapper = function (init) {
  10097. return function WeakMap() {
  10098. return init(this, arguments.length ? arguments[0] : undefined);
  10099. };
  10100. };
  10101. var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak);
  10102. if (NATIVE_WEAK_MAP && IS_IE11) {
  10103. InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
  10104. InternalMetadataModule.REQUIRED = true;
  10105. var WeakMapPrototype = $WeakMap.prototype;
  10106. var nativeDelete = WeakMapPrototype['delete'];
  10107. var nativeHas = WeakMapPrototype.has;
  10108. var nativeGet = WeakMapPrototype.get;
  10109. var nativeSet = WeakMapPrototype.set;
  10110. redefineAll(WeakMapPrototype, {
  10111. 'delete': function (key) {
  10112. if (isObject(key) && !isExtensible(key)) {
  10113. var state = enforceIternalState(this);
  10114. if (!state.frozen)
  10115. state.frozen = new InternalWeakMap();
  10116. return nativeDelete.call(this, key) || state.frozen['delete'](key);
  10117. }
  10118. return nativeDelete.call(this, key);
  10119. },
  10120. has: function has(key) {
  10121. if (isObject(key) && !isExtensible(key)) {
  10122. var state = enforceIternalState(this);
  10123. if (!state.frozen)
  10124. state.frozen = new InternalWeakMap();
  10125. return nativeHas.call(this, key) || state.frozen.has(key);
  10126. }
  10127. return nativeHas.call(this, key);
  10128. },
  10129. get: function get(key) {
  10130. if (isObject(key) && !isExtensible(key)) {
  10131. var state = enforceIternalState(this);
  10132. if (!state.frozen)
  10133. state.frozen = new InternalWeakMap();
  10134. return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key);
  10135. }
  10136. return nativeGet.call(this, key);
  10137. },
  10138. set: function set(key, value) {
  10139. if (isObject(key) && !isExtensible(key)) {
  10140. var state = enforceIternalState(this);
  10141. if (!state.frozen)
  10142. state.frozen = new InternalWeakMap();
  10143. nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value);
  10144. } else
  10145. nativeSet.call(this, key, value);
  10146. return this;
  10147. }
  10148. });
  10149. }
  10150. /***/ }),
  10151. /* 155 */
  10152. /***/ (function(module, exports, __w_pdfjs_require__) {
  10153. "use strict";
  10154. var redefineAll = __w_pdfjs_require__(121);
  10155. var getWeakData = __w_pdfjs_require__(147).getWeakData;
  10156. var anObject = __w_pdfjs_require__(28);
  10157. var isObject = __w_pdfjs_require__(22);
  10158. var anInstance = __w_pdfjs_require__(123);
  10159. var iterate = __w_pdfjs_require__(124);
  10160. var ArrayIterationModule = __w_pdfjs_require__(156);
  10161. var $has = __w_pdfjs_require__(23);
  10162. var InternalStateModule = __w_pdfjs_require__(33);
  10163. var setInternalState = InternalStateModule.set;
  10164. var internalStateGetterFor = InternalStateModule.getterFor;
  10165. var find = ArrayIterationModule.find;
  10166. var findIndex = ArrayIterationModule.findIndex;
  10167. var id = 0;
  10168. var uncaughtFrozenStore = function (store) {
  10169. return store.frozen || (store.frozen = new UncaughtFrozenStore());
  10170. };
  10171. var UncaughtFrozenStore = function () {
  10172. this.entries = [];
  10173. };
  10174. var findUncaughtFrozen = function (store, key) {
  10175. return find(store.entries, function (it) {
  10176. return it[0] === key;
  10177. });
  10178. };
  10179. UncaughtFrozenStore.prototype = {
  10180. get: function (key) {
  10181. var entry = findUncaughtFrozen(this, key);
  10182. if (entry)
  10183. return entry[1];
  10184. },
  10185. has: function (key) {
  10186. return !!findUncaughtFrozen(this, key);
  10187. },
  10188. set: function (key, value) {
  10189. var entry = findUncaughtFrozen(this, key);
  10190. if (entry)
  10191. entry[1] = value;
  10192. else
  10193. this.entries.push([
  10194. key,
  10195. value
  10196. ]);
  10197. },
  10198. 'delete': function (key) {
  10199. var index = findIndex(this.entries, function (it) {
  10200. return it[0] === key;
  10201. });
  10202. if (~index)
  10203. this.entries.splice(index, 1);
  10204. return !!~index;
  10205. }
  10206. };
  10207. module.exports = {
  10208. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  10209. var C = wrapper(function (that, iterable) {
  10210. anInstance(that, C, CONSTRUCTOR_NAME);
  10211. setInternalState(that, {
  10212. type: CONSTRUCTOR_NAME,
  10213. id: id++,
  10214. frozen: undefined
  10215. });
  10216. if (iterable != undefined)
  10217. iterate(iterable, that[ADDER], that, IS_MAP);
  10218. });
  10219. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  10220. var define = function (that, key, value) {
  10221. var state = getInternalState(that);
  10222. var data = getWeakData(anObject(key), true);
  10223. if (data === true)
  10224. uncaughtFrozenStore(state).set(key, value);
  10225. else
  10226. data[state.id] = value;
  10227. return that;
  10228. };
  10229. redefineAll(C.prototype, {
  10230. 'delete': function (key) {
  10231. var state = getInternalState(this);
  10232. if (!isObject(key))
  10233. return false;
  10234. var data = getWeakData(key);
  10235. if (data === true)
  10236. return uncaughtFrozenStore(state)['delete'](key);
  10237. return data && $has(data, state.id) && delete data[state.id];
  10238. },
  10239. has: function has(key) {
  10240. var state = getInternalState(this);
  10241. if (!isObject(key))
  10242. return false;
  10243. var data = getWeakData(key);
  10244. if (data === true)
  10245. return uncaughtFrozenStore(state).has(key);
  10246. return data && $has(data, state.id);
  10247. }
  10248. });
  10249. redefineAll(C.prototype, IS_MAP ? {
  10250. get: function get(key) {
  10251. var state = getInternalState(this);
  10252. if (isObject(key)) {
  10253. var data = getWeakData(key);
  10254. if (data === true)
  10255. return uncaughtFrozenStore(state).get(key);
  10256. return data ? data[state.id] : undefined;
  10257. }
  10258. },
  10259. set: function set(key, value) {
  10260. return define(this, key, value);
  10261. }
  10262. } : {
  10263. add: function add(value) {
  10264. return define(this, value, true);
  10265. }
  10266. });
  10267. return C;
  10268. }
  10269. };
  10270. /***/ }),
  10271. /* 156 */
  10272. /***/ (function(module, exports, __w_pdfjs_require__) {
  10273. var bind = __w_pdfjs_require__(62);
  10274. var IndexedObject = __w_pdfjs_require__(18);
  10275. var toObject = __w_pdfjs_require__(83);
  10276. var toLength = __w_pdfjs_require__(47);
  10277. var arraySpeciesCreate = __w_pdfjs_require__(157);
  10278. var push = [].push;
  10279. var createMethod = function (TYPE) {
  10280. var IS_MAP = TYPE == 1;
  10281. var IS_FILTER = TYPE == 2;
  10282. var IS_SOME = TYPE == 3;
  10283. var IS_EVERY = TYPE == 4;
  10284. var IS_FIND_INDEX = TYPE == 6;
  10285. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  10286. return function ($this, callbackfn, that, specificCreate) {
  10287. var O = toObject($this);
  10288. var self = IndexedObject(O);
  10289. var boundFunction = bind(callbackfn, that, 3);
  10290. var length = toLength(self.length);
  10291. var index = 0;
  10292. var create = specificCreate || arraySpeciesCreate;
  10293. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  10294. var value, result;
  10295. for (; length > index; index++)
  10296. if (NO_HOLES || index in self) {
  10297. value = self[index];
  10298. result = boundFunction(value, index, O);
  10299. if (TYPE) {
  10300. if (IS_MAP)
  10301. target[index] = result;
  10302. else if (result)
  10303. switch (TYPE) {
  10304. case 3:
  10305. return true;
  10306. case 5:
  10307. return value;
  10308. case 6:
  10309. return index;
  10310. case 2:
  10311. push.call(target, value);
  10312. }
  10313. else if (IS_EVERY)
  10314. return false;
  10315. }
  10316. }
  10317. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  10318. };
  10319. };
  10320. module.exports = {
  10321. forEach: createMethod(0),
  10322. map: createMethod(1),
  10323. filter: createMethod(2),
  10324. some: createMethod(3),
  10325. every: createMethod(4),
  10326. find: createMethod(5),
  10327. findIndex: createMethod(6)
  10328. };
  10329. /***/ }),
  10330. /* 157 */
  10331. /***/ (function(module, exports, __w_pdfjs_require__) {
  10332. var isObject = __w_pdfjs_require__(22);
  10333. var isArray = __w_pdfjs_require__(158);
  10334. var wellKnownSymbol = __w_pdfjs_require__(57);
  10335. var SPECIES = wellKnownSymbol('species');
  10336. module.exports = function (originalArray, length) {
  10337. var C;
  10338. if (isArray(originalArray)) {
  10339. C = originalArray.constructor;
  10340. if (typeof C == 'function' && (C === Array || isArray(C.prototype)))
  10341. C = undefined;
  10342. else if (isObject(C)) {
  10343. C = C[SPECIES];
  10344. if (C === null)
  10345. C = undefined;
  10346. }
  10347. }
  10348. return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  10349. };
  10350. /***/ }),
  10351. /* 158 */
  10352. /***/ (function(module, exports, __w_pdfjs_require__) {
  10353. var classof = __w_pdfjs_require__(19);
  10354. module.exports = Array.isArray || function isArray(arg) {
  10355. return classof(arg) == 'Array';
  10356. };
  10357. /***/ }),
  10358. /* 159 */
  10359. /***/ (function(module, exports, __w_pdfjs_require__) {
  10360. __w_pdfjs_require__(114);
  10361. __w_pdfjs_require__(160);
  10362. __w_pdfjs_require__(116);
  10363. var path = __w_pdfjs_require__(43);
  10364. module.exports = path.WeakSet;
  10365. /***/ }),
  10366. /* 160 */
  10367. /***/ (function(module, exports, __w_pdfjs_require__) {
  10368. "use strict";
  10369. var collection = __w_pdfjs_require__(146);
  10370. var collectionWeak = __w_pdfjs_require__(155);
  10371. collection('WeakSet', function (init) {
  10372. return function WeakSet() {
  10373. return init(this, arguments.length ? arguments[0] : undefined);
  10374. };
  10375. }, collectionWeak);
  10376. /***/ }),
  10377. /* 161 */
  10378. /***/ (function(module, exports, __w_pdfjs_require__) {
  10379. __w_pdfjs_require__(162);
  10380. var entryUnbind = __w_pdfjs_require__(61);
  10381. module.exports = entryUnbind('String', 'codePointAt');
  10382. /***/ }),
  10383. /* 162 */
  10384. /***/ (function(module, exports, __w_pdfjs_require__) {
  10385. "use strict";
  10386. var $ = __w_pdfjs_require__(10);
  10387. var codeAt = __w_pdfjs_require__(78).codeAt;
  10388. $({
  10389. target: 'String',
  10390. proto: true
  10391. }, {
  10392. codePointAt: function codePointAt(pos) {
  10393. return codeAt(this, pos);
  10394. }
  10395. });
  10396. /***/ }),
  10397. /* 163 */
  10398. /***/ (function(module, exports, __w_pdfjs_require__) {
  10399. __w_pdfjs_require__(164);
  10400. var path = __w_pdfjs_require__(43);
  10401. module.exports = path.String.fromCodePoint;
  10402. /***/ }),
  10403. /* 164 */
  10404. /***/ (function(module, exports, __w_pdfjs_require__) {
  10405. var $ = __w_pdfjs_require__(10);
  10406. var toAbsoluteIndex = __w_pdfjs_require__(49);
  10407. var fromCharCode = String.fromCharCode;
  10408. var nativeFromCodePoint = String.fromCodePoint;
  10409. var INCORRECT_LENGTH = !!nativeFromCodePoint && nativeFromCodePoint.length != 1;
  10410. $({
  10411. target: 'String',
  10412. stat: true,
  10413. forced: INCORRECT_LENGTH
  10414. }, {
  10415. fromCodePoint: function fromCodePoint(x) {
  10416. var elements = [];
  10417. var length = arguments.length;
  10418. var i = 0;
  10419. var code;
  10420. while (length > i) {
  10421. code = +arguments[i++];
  10422. if (toAbsoluteIndex(code, 0x10FFFF) !== code)
  10423. throw RangeError(code + ' is not a valid code point');
  10424. elements.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00));
  10425. }
  10426. return elements.join('');
  10427. }
  10428. });
  10429. /***/ }),
  10430. /* 165 */
  10431. /***/ (function(module, exports, __w_pdfjs_require__) {
  10432. __w_pdfjs_require__(166);
  10433. __w_pdfjs_require__(114);
  10434. __w_pdfjs_require__(168);
  10435. __w_pdfjs_require__(172);
  10436. __w_pdfjs_require__(173);
  10437. __w_pdfjs_require__(174);
  10438. __w_pdfjs_require__(175);
  10439. __w_pdfjs_require__(176);
  10440. __w_pdfjs_require__(177);
  10441. __w_pdfjs_require__(178);
  10442. __w_pdfjs_require__(179);
  10443. __w_pdfjs_require__(180);
  10444. __w_pdfjs_require__(181);
  10445. __w_pdfjs_require__(182);
  10446. __w_pdfjs_require__(183);
  10447. __w_pdfjs_require__(184);
  10448. __w_pdfjs_require__(185);
  10449. __w_pdfjs_require__(186);
  10450. __w_pdfjs_require__(187);
  10451. var path = __w_pdfjs_require__(43);
  10452. module.exports = path.Symbol;
  10453. /***/ }),
  10454. /* 166 */
  10455. /***/ (function(module, exports, __w_pdfjs_require__) {
  10456. "use strict";
  10457. var $ = __w_pdfjs_require__(10);
  10458. var fails = __w_pdfjs_require__(14);
  10459. var isArray = __w_pdfjs_require__(158);
  10460. var isObject = __w_pdfjs_require__(22);
  10461. var toObject = __w_pdfjs_require__(83);
  10462. var toLength = __w_pdfjs_require__(47);
  10463. var createProperty = __w_pdfjs_require__(93);
  10464. var arraySpeciesCreate = __w_pdfjs_require__(157);
  10465. var arrayMethodHasSpeciesSupport = __w_pdfjs_require__(167);
  10466. var wellKnownSymbol = __w_pdfjs_require__(57);
  10467. var V8_VERSION = __w_pdfjs_require__(133);
  10468. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  10469. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  10470. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  10471. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  10472. var array = [];
  10473. array[IS_CONCAT_SPREADABLE] = false;
  10474. return array.concat()[0] !== array;
  10475. });
  10476. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  10477. var isConcatSpreadable = function (O) {
  10478. if (!isObject(O))
  10479. return false;
  10480. var spreadable = O[IS_CONCAT_SPREADABLE];
  10481. return spreadable !== undefined ? !!spreadable : isArray(O);
  10482. };
  10483. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  10484. $({
  10485. target: 'Array',
  10486. proto: true,
  10487. forced: FORCED
  10488. }, {
  10489. concat: function concat(arg) {
  10490. var O = toObject(this);
  10491. var A = arraySpeciesCreate(O, 0);
  10492. var n = 0;
  10493. var i, k, length, len, E;
  10494. for (i = -1, length = arguments.length; i < length; i++) {
  10495. E = i === -1 ? O : arguments[i];
  10496. if (isConcatSpreadable(E)) {
  10497. len = toLength(E.length);
  10498. if (n + len > MAX_SAFE_INTEGER)
  10499. throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  10500. for (k = 0; k < len; k++, n++)
  10501. if (k in E)
  10502. createProperty(A, n, E[k]);
  10503. } else {
  10504. if (n >= MAX_SAFE_INTEGER)
  10505. throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  10506. createProperty(A, n++, E);
  10507. }
  10508. }
  10509. A.length = n;
  10510. return A;
  10511. }
  10512. });
  10513. /***/ }),
  10514. /* 167 */
  10515. /***/ (function(module, exports, __w_pdfjs_require__) {
  10516. var fails = __w_pdfjs_require__(14);
  10517. var wellKnownSymbol = __w_pdfjs_require__(57);
  10518. var V8_VERSION = __w_pdfjs_require__(133);
  10519. var SPECIES = wellKnownSymbol('species');
  10520. module.exports = function (METHOD_NAME) {
  10521. return V8_VERSION >= 51 || !fails(function () {
  10522. var array = [];
  10523. var constructor = array.constructor = {};
  10524. constructor[SPECIES] = function () {
  10525. return { foo: 1 };
  10526. };
  10527. return array[METHOD_NAME](Boolean).foo !== 1;
  10528. });
  10529. };
  10530. /***/ }),
  10531. /* 168 */
  10532. /***/ (function(module, exports, __w_pdfjs_require__) {
  10533. "use strict";
  10534. var $ = __w_pdfjs_require__(10);
  10535. var global = __w_pdfjs_require__(11);
  10536. var getBuiltIn = __w_pdfjs_require__(42);
  10537. var IS_PURE = __w_pdfjs_require__(37);
  10538. var DESCRIPTORS = __w_pdfjs_require__(13);
  10539. var NATIVE_SYMBOL = __w_pdfjs_require__(58);
  10540. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(59);
  10541. var fails = __w_pdfjs_require__(14);
  10542. var has = __w_pdfjs_require__(23);
  10543. var isArray = __w_pdfjs_require__(158);
  10544. var isObject = __w_pdfjs_require__(22);
  10545. var anObject = __w_pdfjs_require__(28);
  10546. var toObject = __w_pdfjs_require__(83);
  10547. var toIndexedObject = __w_pdfjs_require__(17);
  10548. var toPrimitive = __w_pdfjs_require__(21);
  10549. var createPropertyDescriptor = __w_pdfjs_require__(16);
  10550. var nativeObjectCreate = __w_pdfjs_require__(71);
  10551. var objectKeys = __w_pdfjs_require__(73);
  10552. var getOwnPropertyNamesModule = __w_pdfjs_require__(44);
  10553. var getOwnPropertyNamesExternal = __w_pdfjs_require__(169);
  10554. var getOwnPropertySymbolsModule = __w_pdfjs_require__(51);
  10555. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(12);
  10556. var definePropertyModule = __w_pdfjs_require__(27);
  10557. var propertyIsEnumerableModule = __w_pdfjs_require__(15);
  10558. var createNonEnumerableProperty = __w_pdfjs_require__(26);
  10559. var redefine = __w_pdfjs_require__(29);
  10560. var shared = __w_pdfjs_require__(36);
  10561. var sharedKey = __w_pdfjs_require__(35);
  10562. var hiddenKeys = __w_pdfjs_require__(39);
  10563. var uid = __w_pdfjs_require__(38);
  10564. var wellKnownSymbol = __w_pdfjs_require__(57);
  10565. var wrappedWellKnownSymbolModule = __w_pdfjs_require__(170);
  10566. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10567. var setToStringTag = __w_pdfjs_require__(85);
  10568. var InternalStateModule = __w_pdfjs_require__(33);
  10569. var $forEach = __w_pdfjs_require__(156).forEach;
  10570. var HIDDEN = sharedKey('hidden');
  10571. var SYMBOL = 'Symbol';
  10572. var PROTOTYPE = 'prototype';
  10573. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  10574. var setInternalState = InternalStateModule.set;
  10575. var getInternalState = InternalStateModule.getterFor(SYMBOL);
  10576. var ObjectPrototype = Object[PROTOTYPE];
  10577. var $Symbol = global.Symbol;
  10578. var $stringify = getBuiltIn('JSON', 'stringify');
  10579. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  10580. var nativeDefineProperty = definePropertyModule.f;
  10581. var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
  10582. var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
  10583. var AllSymbols = shared('symbols');
  10584. var ObjectPrototypeSymbols = shared('op-symbols');
  10585. var StringToSymbolRegistry = shared('string-to-symbol-registry');
  10586. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  10587. var WellKnownSymbolsStore = shared('wks');
  10588. var QObject = global.QObject;
  10589. var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  10590. var setSymbolDescriptor = DESCRIPTORS && fails(function () {
  10591. return nativeObjectCreate(nativeDefineProperty({}, 'a', {
  10592. get: function () {
  10593. return nativeDefineProperty(this, 'a', { value: 7 }).a;
  10594. }
  10595. })).a != 7;
  10596. }) ? function (O, P, Attributes) {
  10597. var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
  10598. if (ObjectPrototypeDescriptor)
  10599. delete ObjectPrototype[P];
  10600. nativeDefineProperty(O, P, Attributes);
  10601. if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
  10602. nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
  10603. }
  10604. } : nativeDefineProperty;
  10605. var wrap = function (tag, description) {
  10606. var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
  10607. setInternalState(symbol, {
  10608. type: SYMBOL,
  10609. tag: tag,
  10610. description: description
  10611. });
  10612. if (!DESCRIPTORS)
  10613. symbol.description = description;
  10614. return symbol;
  10615. };
  10616. var isSymbol = USE_SYMBOL_AS_UID ? function (it) {
  10617. return typeof it == 'symbol';
  10618. } : function (it) {
  10619. return Object(it) instanceof $Symbol;
  10620. };
  10621. var $defineProperty = function defineProperty(O, P, Attributes) {
  10622. if (O === ObjectPrototype)
  10623. $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  10624. anObject(O);
  10625. var key = toPrimitive(P, true);
  10626. anObject(Attributes);
  10627. if (has(AllSymbols, key)) {
  10628. if (!Attributes.enumerable) {
  10629. if (!has(O, HIDDEN))
  10630. nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
  10631. O[HIDDEN][key] = true;
  10632. } else {
  10633. if (has(O, HIDDEN) && O[HIDDEN][key])
  10634. O[HIDDEN][key] = false;
  10635. Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
  10636. }
  10637. return setSymbolDescriptor(O, key, Attributes);
  10638. }
  10639. return nativeDefineProperty(O, key, Attributes);
  10640. };
  10641. var $defineProperties = function defineProperties(O, Properties) {
  10642. anObject(O);
  10643. var properties = toIndexedObject(Properties);
  10644. var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  10645. $forEach(keys, function (key) {
  10646. if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key))
  10647. $defineProperty(O, key, properties[key]);
  10648. });
  10649. return O;
  10650. };
  10651. var $create = function create(O, Properties) {
  10652. return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
  10653. };
  10654. var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  10655. var P = toPrimitive(V, true);
  10656. var enumerable = nativePropertyIsEnumerable.call(this, P);
  10657. if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P))
  10658. return false;
  10659. return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
  10660. };
  10661. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  10662. var it = toIndexedObject(O);
  10663. var key = toPrimitive(P, true);
  10664. if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key))
  10665. return;
  10666. var descriptor = nativeGetOwnPropertyDescriptor(it, key);
  10667. if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
  10668. descriptor.enumerable = true;
  10669. }
  10670. return descriptor;
  10671. };
  10672. var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  10673. var names = nativeGetOwnPropertyNames(toIndexedObject(O));
  10674. var result = [];
  10675. $forEach(names, function (key) {
  10676. if (!has(AllSymbols, key) && !has(hiddenKeys, key))
  10677. result.push(key);
  10678. });
  10679. return result;
  10680. };
  10681. var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
  10682. var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  10683. var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  10684. var result = [];
  10685. $forEach(names, function (key) {
  10686. if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
  10687. result.push(AllSymbols[key]);
  10688. }
  10689. });
  10690. return result;
  10691. };
  10692. if (!NATIVE_SYMBOL) {
  10693. $Symbol = function Symbol() {
  10694. if (this instanceof $Symbol)
  10695. throw TypeError('Symbol is not a constructor');
  10696. var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
  10697. var tag = uid(description);
  10698. var setter = function (value) {
  10699. if (this === ObjectPrototype)
  10700. setter.call(ObjectPrototypeSymbols, value);
  10701. if (has(this, HIDDEN) && has(this[HIDDEN], tag))
  10702. this[HIDDEN][tag] = false;
  10703. setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
  10704. };
  10705. if (DESCRIPTORS && USE_SETTER)
  10706. setSymbolDescriptor(ObjectPrototype, tag, {
  10707. configurable: true,
  10708. set: setter
  10709. });
  10710. return wrap(tag, description);
  10711. };
  10712. redefine($Symbol[PROTOTYPE], 'toString', function toString() {
  10713. return getInternalState(this).tag;
  10714. });
  10715. redefine($Symbol, 'withoutSetter', function (description) {
  10716. return wrap(uid(description), description);
  10717. });
  10718. propertyIsEnumerableModule.f = $propertyIsEnumerable;
  10719. definePropertyModule.f = $defineProperty;
  10720. getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
  10721. getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  10722. getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
  10723. wrappedWellKnownSymbolModule.f = function (name) {
  10724. return wrap(wellKnownSymbol(name), name);
  10725. };
  10726. if (DESCRIPTORS) {
  10727. nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
  10728. configurable: true,
  10729. get: function description() {
  10730. return getInternalState(this).description;
  10731. }
  10732. });
  10733. if (!IS_PURE) {
  10734. redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
  10735. }
  10736. }
  10737. }
  10738. $({
  10739. global: true,
  10740. wrap: true,
  10741. forced: !NATIVE_SYMBOL,
  10742. sham: !NATIVE_SYMBOL
  10743. }, { Symbol: $Symbol });
  10744. $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  10745. defineWellKnownSymbol(name);
  10746. });
  10747. $({
  10748. target: SYMBOL,
  10749. stat: true,
  10750. forced: !NATIVE_SYMBOL
  10751. }, {
  10752. 'for': function (key) {
  10753. var string = String(key);
  10754. if (has(StringToSymbolRegistry, string))
  10755. return StringToSymbolRegistry[string];
  10756. var symbol = $Symbol(string);
  10757. StringToSymbolRegistry[string] = symbol;
  10758. SymbolToStringRegistry[symbol] = string;
  10759. return symbol;
  10760. },
  10761. keyFor: function keyFor(sym) {
  10762. if (!isSymbol(sym))
  10763. throw TypeError(sym + ' is not a symbol');
  10764. if (has(SymbolToStringRegistry, sym))
  10765. return SymbolToStringRegistry[sym];
  10766. },
  10767. useSetter: function () {
  10768. USE_SETTER = true;
  10769. },
  10770. useSimple: function () {
  10771. USE_SETTER = false;
  10772. }
  10773. });
  10774. $({
  10775. target: 'Object',
  10776. stat: true,
  10777. forced: !NATIVE_SYMBOL,
  10778. sham: !DESCRIPTORS
  10779. }, {
  10780. create: $create,
  10781. defineProperty: $defineProperty,
  10782. defineProperties: $defineProperties,
  10783. getOwnPropertyDescriptor: $getOwnPropertyDescriptor
  10784. });
  10785. $({
  10786. target: 'Object',
  10787. stat: true,
  10788. forced: !NATIVE_SYMBOL
  10789. }, {
  10790. getOwnPropertyNames: $getOwnPropertyNames,
  10791. getOwnPropertySymbols: $getOwnPropertySymbols
  10792. });
  10793. $({
  10794. target: 'Object',
  10795. stat: true,
  10796. forced: fails(function () {
  10797. getOwnPropertySymbolsModule.f(1);
  10798. })
  10799. }, {
  10800. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  10801. return getOwnPropertySymbolsModule.f(toObject(it));
  10802. }
  10803. });
  10804. if ($stringify) {
  10805. var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
  10806. var symbol = $Symbol();
  10807. return $stringify([symbol]) != '[null]' || $stringify({ a: symbol }) != '{}' || $stringify(Object(symbol)) != '{}';
  10808. });
  10809. $({
  10810. target: 'JSON',
  10811. stat: true,
  10812. forced: FORCED_JSON_STRINGIFY
  10813. }, {
  10814. stringify: function stringify(it, replacer, space) {
  10815. var args = [it];
  10816. var index = 1;
  10817. var $replacer;
  10818. while (arguments.length > index)
  10819. args.push(arguments[index++]);
  10820. $replacer = replacer;
  10821. if (!isObject(replacer) && it === undefined || isSymbol(it))
  10822. return;
  10823. if (!isArray(replacer))
  10824. replacer = function (key, value) {
  10825. if (typeof $replacer == 'function')
  10826. value = $replacer.call(this, key, value);
  10827. if (!isSymbol(value))
  10828. return value;
  10829. };
  10830. args[1] = replacer;
  10831. return $stringify.apply(null, args);
  10832. }
  10833. });
  10834. }
  10835. if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
  10836. createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
  10837. }
  10838. setToStringTag($Symbol, SYMBOL);
  10839. hiddenKeys[HIDDEN] = true;
  10840. /***/ }),
  10841. /* 169 */
  10842. /***/ (function(module, exports, __w_pdfjs_require__) {
  10843. var toIndexedObject = __w_pdfjs_require__(17);
  10844. var nativeGetOwnPropertyNames = __w_pdfjs_require__(44).f;
  10845. var toString = {}.toString;
  10846. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  10847. var getWindowNames = function (it) {
  10848. try {
  10849. return nativeGetOwnPropertyNames(it);
  10850. } catch (error) {
  10851. return windowNames.slice();
  10852. }
  10853. };
  10854. module.exports.f = function getOwnPropertyNames(it) {
  10855. return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : nativeGetOwnPropertyNames(toIndexedObject(it));
  10856. };
  10857. /***/ }),
  10858. /* 170 */
  10859. /***/ (function(module, exports, __w_pdfjs_require__) {
  10860. var wellKnownSymbol = __w_pdfjs_require__(57);
  10861. exports.f = wellKnownSymbol;
  10862. /***/ }),
  10863. /* 171 */
  10864. /***/ (function(module, exports, __w_pdfjs_require__) {
  10865. var path = __w_pdfjs_require__(43);
  10866. var has = __w_pdfjs_require__(23);
  10867. var wrappedWellKnownSymbolModule = __w_pdfjs_require__(170);
  10868. var defineProperty = __w_pdfjs_require__(27).f;
  10869. module.exports = function (NAME) {
  10870. var Symbol = path.Symbol || (path.Symbol = {});
  10871. if (!has(Symbol, NAME))
  10872. defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) });
  10873. };
  10874. /***/ }),
  10875. /* 172 */
  10876. /***/ (function(module, exports, __w_pdfjs_require__) {
  10877. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10878. defineWellKnownSymbol('asyncIterator');
  10879. /***/ }),
  10880. /* 173 */
  10881. /***/ (function(module, exports, __w_pdfjs_require__) {
  10882. "use strict";
  10883. var $ = __w_pdfjs_require__(10);
  10884. var DESCRIPTORS = __w_pdfjs_require__(13);
  10885. var global = __w_pdfjs_require__(11);
  10886. var has = __w_pdfjs_require__(23);
  10887. var isObject = __w_pdfjs_require__(22);
  10888. var defineProperty = __w_pdfjs_require__(27).f;
  10889. var copyConstructorProperties = __w_pdfjs_require__(40);
  10890. var NativeSymbol = global.Symbol;
  10891. if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || NativeSymbol().description !== undefined)) {
  10892. var EmptyStringDescriptionStore = {};
  10893. var SymbolWrapper = function Symbol() {
  10894. var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
  10895. var result = this instanceof SymbolWrapper ? new NativeSymbol(description) : description === undefined ? NativeSymbol() : NativeSymbol(description);
  10896. if (description === '')
  10897. EmptyStringDescriptionStore[result] = true;
  10898. return result;
  10899. };
  10900. copyConstructorProperties(SymbolWrapper, NativeSymbol);
  10901. var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
  10902. symbolPrototype.constructor = SymbolWrapper;
  10903. var symbolToString = symbolPrototype.toString;
  10904. var native = String(NativeSymbol('test')) == 'Symbol(test)';
  10905. var regexp = /^Symbol\((.*)\)[^)]+$/;
  10906. defineProperty(symbolPrototype, 'description', {
  10907. configurable: true,
  10908. get: function description() {
  10909. var symbol = isObject(this) ? this.valueOf() : this;
  10910. var string = symbolToString.call(symbol);
  10911. if (has(EmptyStringDescriptionStore, symbol))
  10912. return '';
  10913. var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
  10914. return desc === '' ? undefined : desc;
  10915. }
  10916. });
  10917. $({
  10918. global: true,
  10919. forced: true
  10920. }, { Symbol: SymbolWrapper });
  10921. }
  10922. /***/ }),
  10923. /* 174 */
  10924. /***/ (function(module, exports, __w_pdfjs_require__) {
  10925. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10926. defineWellKnownSymbol('hasInstance');
  10927. /***/ }),
  10928. /* 175 */
  10929. /***/ (function(module, exports, __w_pdfjs_require__) {
  10930. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10931. defineWellKnownSymbol('isConcatSpreadable');
  10932. /***/ }),
  10933. /* 176 */
  10934. /***/ (function(module, exports, __w_pdfjs_require__) {
  10935. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10936. defineWellKnownSymbol('iterator');
  10937. /***/ }),
  10938. /* 177 */
  10939. /***/ (function(module, exports, __w_pdfjs_require__) {
  10940. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10941. defineWellKnownSymbol('match');
  10942. /***/ }),
  10943. /* 178 */
  10944. /***/ (function(module, exports, __w_pdfjs_require__) {
  10945. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10946. defineWellKnownSymbol('matchAll');
  10947. /***/ }),
  10948. /* 179 */
  10949. /***/ (function(module, exports, __w_pdfjs_require__) {
  10950. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10951. defineWellKnownSymbol('replace');
  10952. /***/ }),
  10953. /* 180 */
  10954. /***/ (function(module, exports, __w_pdfjs_require__) {
  10955. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10956. defineWellKnownSymbol('search');
  10957. /***/ }),
  10958. /* 181 */
  10959. /***/ (function(module, exports, __w_pdfjs_require__) {
  10960. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10961. defineWellKnownSymbol('species');
  10962. /***/ }),
  10963. /* 182 */
  10964. /***/ (function(module, exports, __w_pdfjs_require__) {
  10965. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10966. defineWellKnownSymbol('split');
  10967. /***/ }),
  10968. /* 183 */
  10969. /***/ (function(module, exports, __w_pdfjs_require__) {
  10970. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10971. defineWellKnownSymbol('toPrimitive');
  10972. /***/ }),
  10973. /* 184 */
  10974. /***/ (function(module, exports, __w_pdfjs_require__) {
  10975. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10976. defineWellKnownSymbol('toStringTag');
  10977. /***/ }),
  10978. /* 185 */
  10979. /***/ (function(module, exports, __w_pdfjs_require__) {
  10980. var defineWellKnownSymbol = __w_pdfjs_require__(171);
  10981. defineWellKnownSymbol('unscopables');
  10982. /***/ }),
  10983. /* 186 */
  10984. /***/ (function(module, exports, __w_pdfjs_require__) {
  10985. var setToStringTag = __w_pdfjs_require__(85);
  10986. setToStringTag(Math, 'Math', true);
  10987. /***/ }),
  10988. /* 187 */
  10989. /***/ (function(module, exports, __w_pdfjs_require__) {
  10990. var global = __w_pdfjs_require__(11);
  10991. var setToStringTag = __w_pdfjs_require__(85);
  10992. setToStringTag(global.JSON, 'JSON', true);
  10993. /***/ }),
  10994. /* 188 */
  10995. /***/ (function(module, exports, __w_pdfjs_require__) {
  10996. __w_pdfjs_require__(189);
  10997. var entryUnbind = __w_pdfjs_require__(61);
  10998. module.exports = entryUnbind('String', 'padStart');
  10999. /***/ }),
  11000. /* 189 */
  11001. /***/ (function(module, exports, __w_pdfjs_require__) {
  11002. "use strict";
  11003. var $ = __w_pdfjs_require__(10);
  11004. var $padStart = __w_pdfjs_require__(190).start;
  11005. var WEBKIT_BUG = __w_pdfjs_require__(192);
  11006. $({
  11007. target: 'String',
  11008. proto: true,
  11009. forced: WEBKIT_BUG
  11010. }, {
  11011. padStart: function padStart(maxLength) {
  11012. return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
  11013. }
  11014. });
  11015. /***/ }),
  11016. /* 190 */
  11017. /***/ (function(module, exports, __w_pdfjs_require__) {
  11018. var toLength = __w_pdfjs_require__(47);
  11019. var repeat = __w_pdfjs_require__(191);
  11020. var requireObjectCoercible = __w_pdfjs_require__(20);
  11021. var ceil = Math.ceil;
  11022. var createMethod = function (IS_END) {
  11023. return function ($this, maxLength, fillString) {
  11024. var S = String(requireObjectCoercible($this));
  11025. var stringLength = S.length;
  11026. var fillStr = fillString === undefined ? ' ' : String(fillString);
  11027. var intMaxLength = toLength(maxLength);
  11028. var fillLen, stringFiller;
  11029. if (intMaxLength <= stringLength || fillStr == '')
  11030. return S;
  11031. fillLen = intMaxLength - stringLength;
  11032. stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length));
  11033. if (stringFiller.length > fillLen)
  11034. stringFiller = stringFiller.slice(0, fillLen);
  11035. return IS_END ? S + stringFiller : stringFiller + S;
  11036. };
  11037. };
  11038. module.exports = {
  11039. start: createMethod(false),
  11040. end: createMethod(true)
  11041. };
  11042. /***/ }),
  11043. /* 191 */
  11044. /***/ (function(module, exports, __w_pdfjs_require__) {
  11045. "use strict";
  11046. var toInteger = __w_pdfjs_require__(48);
  11047. var requireObjectCoercible = __w_pdfjs_require__(20);
  11048. module.exports = ''.repeat || function repeat(count) {
  11049. var str = String(requireObjectCoercible(this));
  11050. var result = '';
  11051. var n = toInteger(count);
  11052. if (n < 0 || n == Infinity)
  11053. throw RangeError('Wrong number of repetitions');
  11054. for (; n > 0; (n >>>= 1) && (str += str))
  11055. if (n & 1)
  11056. result += str;
  11057. return result;
  11058. };
  11059. /***/ }),
  11060. /* 192 */
  11061. /***/ (function(module, exports, __w_pdfjs_require__) {
  11062. var userAgent = __w_pdfjs_require__(127);
  11063. module.exports = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
  11064. /***/ }),
  11065. /* 193 */
  11066. /***/ (function(module, exports, __w_pdfjs_require__) {
  11067. __w_pdfjs_require__(194);
  11068. var entryUnbind = __w_pdfjs_require__(61);
  11069. module.exports = entryUnbind('String', 'padEnd');
  11070. /***/ }),
  11071. /* 194 */
  11072. /***/ (function(module, exports, __w_pdfjs_require__) {
  11073. "use strict";
  11074. var $ = __w_pdfjs_require__(10);
  11075. var $padEnd = __w_pdfjs_require__(190).end;
  11076. var WEBKIT_BUG = __w_pdfjs_require__(192);
  11077. $({
  11078. target: 'String',
  11079. proto: true,
  11080. forced: WEBKIT_BUG
  11081. }, {
  11082. padEnd: function padEnd(maxLength) {
  11083. return $padEnd(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
  11084. }
  11085. });
  11086. /***/ }),
  11087. /* 195 */
  11088. /***/ (function(module, exports, __w_pdfjs_require__) {
  11089. __w_pdfjs_require__(196);
  11090. var path = __w_pdfjs_require__(43);
  11091. module.exports = path.Object.values;
  11092. /***/ }),
  11093. /* 196 */
  11094. /***/ (function(module, exports, __w_pdfjs_require__) {
  11095. var $ = __w_pdfjs_require__(10);
  11096. var $values = __w_pdfjs_require__(197).values;
  11097. $({
  11098. target: 'Object',
  11099. stat: true
  11100. }, {
  11101. values: function values(O) {
  11102. return $values(O);
  11103. }
  11104. });
  11105. /***/ }),
  11106. /* 197 */
  11107. /***/ (function(module, exports, __w_pdfjs_require__) {
  11108. var DESCRIPTORS = __w_pdfjs_require__(13);
  11109. var objectKeys = __w_pdfjs_require__(73);
  11110. var toIndexedObject = __w_pdfjs_require__(17);
  11111. var propertyIsEnumerable = __w_pdfjs_require__(15).f;
  11112. var createMethod = function (TO_ENTRIES) {
  11113. return function (it) {
  11114. var O = toIndexedObject(it);
  11115. var keys = objectKeys(O);
  11116. var length = keys.length;
  11117. var i = 0;
  11118. var result = [];
  11119. var key;
  11120. while (length > i) {
  11121. key = keys[i++];
  11122. if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {
  11123. result.push(TO_ENTRIES ? [
  11124. key,
  11125. O[key]
  11126. ] : O[key]);
  11127. }
  11128. }
  11129. return result;
  11130. };
  11131. };
  11132. module.exports = {
  11133. entries: createMethod(true),
  11134. values: createMethod(false)
  11135. };
  11136. /***/ }),
  11137. /* 198 */
  11138. /***/ (function(module, exports, __w_pdfjs_require__) {
  11139. "use strict";
  11140. Object.defineProperty(exports, "__esModule", {
  11141. value: true
  11142. });
  11143. exports.getDocument = getDocument;
  11144. exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory;
  11145. exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = void 0;
  11146. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  11147. var _util = __w_pdfjs_require__(5);
  11148. var _display_utils = __w_pdfjs_require__(1);
  11149. var _font_loader = __w_pdfjs_require__(199);
  11150. var _api_compatibility = __w_pdfjs_require__(200);
  11151. var _canvas = __w_pdfjs_require__(201);
  11152. var _worker_options = __w_pdfjs_require__(203);
  11153. var _is_node = __w_pdfjs_require__(7);
  11154. var _message_handler = __w_pdfjs_require__(204);
  11155. var _metadata = __w_pdfjs_require__(205);
  11156. var _transport_stream = __w_pdfjs_require__(207);
  11157. var _webgl = __w_pdfjs_require__(208);
  11158. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11159. 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); } }
  11160. 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); }); }; }
  11161. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  11162. 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."); }
  11163. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
  11164. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  11165. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  11166. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  11167. 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); } }
  11168. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  11169. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  11170. 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."); }
  11171. 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); }
  11172. 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; }
  11173. function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; }
  11174. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  11175. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  11176. var DEFAULT_RANGE_CHUNK_SIZE = 65536;
  11177. var RENDERING_CANCELLED_TIMEOUT = 100;
  11178. var createPDFNetworkStream;
  11179. function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
  11180. createPDFNetworkStream = pdfNetworkStreamFactory;
  11181. }
  11182. function getDocument(src) {
  11183. var task = new PDFDocumentLoadingTask();
  11184. var source;
  11185. if (typeof src === "string") {
  11186. source = {
  11187. url: src
  11188. };
  11189. } else if ((0, _util.isArrayBuffer)(src)) {
  11190. source = {
  11191. data: src
  11192. };
  11193. } else if (src instanceof PDFDataRangeTransport) {
  11194. source = {
  11195. range: src
  11196. };
  11197. } else {
  11198. if (_typeof(src) !== "object") {
  11199. throw new Error("Invalid parameter in getDocument, " + "need either Uint8Array, string or a parameter object");
  11200. }
  11201. if (!src.url && !src.data && !src.range) {
  11202. throw new Error("Invalid parameter object: need either .data, .range or .url");
  11203. }
  11204. source = src;
  11205. }
  11206. var params = Object.create(null);
  11207. var rangeTransport = null,
  11208. worker = null;
  11209. for (var key in source) {
  11210. if (key === "url" && typeof window !== "undefined") {
  11211. params[key] = new URL(source[key], window.location).href;
  11212. continue;
  11213. } else if (key === "range") {
  11214. rangeTransport = source[key];
  11215. continue;
  11216. } else if (key === "worker") {
  11217. worker = source[key];
  11218. continue;
  11219. } else if (key === "data" && !(source[key] instanceof Uint8Array)) {
  11220. var pdfBytes = source[key];
  11221. if (typeof pdfBytes === "string") {
  11222. params[key] = (0, _util.stringToBytes)(pdfBytes);
  11223. } else if (_typeof(pdfBytes) === "object" && pdfBytes !== null && !isNaN(pdfBytes.length)) {
  11224. params[key] = new Uint8Array(pdfBytes);
  11225. } else if ((0, _util.isArrayBuffer)(pdfBytes)) {
  11226. params[key] = new Uint8Array(pdfBytes);
  11227. } else {
  11228. throw new Error("Invalid PDF binary data: either typed array, " + "string or array-like object is expected in the " + "data property.");
  11229. }
  11230. continue;
  11231. }
  11232. params[key] = source[key];
  11233. }
  11234. params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;
  11235. params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory;
  11236. params.ignoreErrors = params.stopAtErrors !== true;
  11237. params.fontExtraProperties = params.fontExtraProperties === true;
  11238. params.pdfBug = params.pdfBug === true;
  11239. if (!Number.isInteger(params.maxImageSize)) {
  11240. params.maxImageSize = -1;
  11241. }
  11242. if (typeof params.isEvalSupported !== "boolean") {
  11243. params.isEvalSupported = true;
  11244. }
  11245. if (typeof params.disableFontFace !== "boolean") {
  11246. params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false;
  11247. }
  11248. if (typeof params.disableRange !== "boolean") {
  11249. params.disableRange = false;
  11250. }
  11251. if (typeof params.disableStream !== "boolean") {
  11252. params.disableStream = false;
  11253. }
  11254. if (typeof params.disableAutoFetch !== "boolean") {
  11255. params.disableAutoFetch = false;
  11256. }
  11257. (0, _util.setVerbosityLevel)(params.verbosity);
  11258. if (!worker) {
  11259. var workerParams = {
  11260. verbosity: params.verbosity,
  11261. port: _worker_options.GlobalWorkerOptions.workerPort
  11262. };
  11263. worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);
  11264. task._worker = worker;
  11265. }
  11266. var docId = task.docId;
  11267. worker.promise.then(function () {
  11268. if (task.destroyed) {
  11269. throw new Error("Loading aborted");
  11270. }
  11271. var workerIdPromise = _fetchDocument(worker, params, rangeTransport, docId);
  11272. var networkStreamPromise = new Promise(function (resolve) {
  11273. var networkStream;
  11274. if (rangeTransport) {
  11275. networkStream = new _transport_stream.PDFDataTransportStream({
  11276. length: params.length,
  11277. initialData: params.initialData,
  11278. progressiveDone: params.progressiveDone,
  11279. disableRange: params.disableRange,
  11280. disableStream: params.disableStream
  11281. }, rangeTransport);
  11282. } else if (!params.data) {
  11283. networkStream = createPDFNetworkStream({
  11284. url: params.url,
  11285. length: params.length,
  11286. httpHeaders: params.httpHeaders,
  11287. withCredentials: params.withCredentials,
  11288. rangeChunkSize: params.rangeChunkSize,
  11289. disableRange: params.disableRange,
  11290. disableStream: params.disableStream
  11291. });
  11292. }
  11293. resolve(networkStream);
  11294. });
  11295. return Promise.all([workerIdPromise, networkStreamPromise]).then(function (_ref) {
  11296. var _ref2 = _slicedToArray(_ref, 2),
  11297. workerId = _ref2[0],
  11298. networkStream = _ref2[1];
  11299. if (task.destroyed) {
  11300. throw new Error("Loading aborted");
  11301. }
  11302. var messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);
  11303. messageHandler.postMessageTransfers = worker.postMessageTransfers;
  11304. var transport = new WorkerTransport(messageHandler, task, networkStream, params);
  11305. task._transport = transport;
  11306. messageHandler.send("Ready", null);
  11307. });
  11308. })["catch"](task._capability.reject);
  11309. return task;
  11310. }
  11311. function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
  11312. if (worker.destroyed) {
  11313. return Promise.reject(new Error("Worker was destroyed"));
  11314. }
  11315. if (pdfDataRangeTransport) {
  11316. source.length = pdfDataRangeTransport.length;
  11317. source.initialData = pdfDataRangeTransport.initialData;
  11318. source.progressiveDone = pdfDataRangeTransport.progressiveDone;
  11319. }
  11320. return worker.messageHandler.sendWithPromise("GetDocRequest", {
  11321. docId: docId,
  11322. apiVersion: '2.5.207',
  11323. source: {
  11324. data: source.data,
  11325. url: source.url,
  11326. password: source.password,
  11327. disableAutoFetch: source.disableAutoFetch,
  11328. rangeChunkSize: source.rangeChunkSize,
  11329. length: source.length
  11330. },
  11331. maxImageSize: source.maxImageSize,
  11332. disableFontFace: source.disableFontFace,
  11333. postMessageTransfers: worker.postMessageTransfers,
  11334. docBaseUrl: source.docBaseUrl,
  11335. ignoreErrors: source.ignoreErrors,
  11336. isEvalSupported: source.isEvalSupported,
  11337. fontExtraProperties: source.fontExtraProperties
  11338. }).then(function (workerId) {
  11339. if (worker.destroyed) {
  11340. throw new Error("Worker was destroyed");
  11341. }
  11342. return workerId;
  11343. });
  11344. }
  11345. var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() {
  11346. var nextDocumentId = 0;
  11347. var PDFDocumentLoadingTask = /*#__PURE__*/function () {
  11348. function PDFDocumentLoadingTask() {
  11349. _classCallCheck(this, PDFDocumentLoadingTask);
  11350. this._capability = (0, _util.createPromiseCapability)();
  11351. this._transport = null;
  11352. this._worker = null;
  11353. this.docId = "d" + nextDocumentId++;
  11354. this.destroyed = false;
  11355. this.onPassword = null;
  11356. this.onProgress = null;
  11357. this.onUnsupportedFeature = null;
  11358. }
  11359. _createClass(PDFDocumentLoadingTask, [{
  11360. key: "destroy",
  11361. value: function destroy() {
  11362. var _this = this;
  11363. this.destroyed = true;
  11364. var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy();
  11365. return transportDestroyed.then(function () {
  11366. _this._transport = null;
  11367. if (_this._worker) {
  11368. _this._worker.destroy();
  11369. _this._worker = null;
  11370. }
  11371. });
  11372. }
  11373. }, {
  11374. key: "promise",
  11375. get: function get() {
  11376. return this._capability.promise;
  11377. }
  11378. }]);
  11379. return PDFDocumentLoadingTask;
  11380. }();
  11381. return PDFDocumentLoadingTask;
  11382. }();
  11383. var PDFDataRangeTransport = /*#__PURE__*/function () {
  11384. function PDFDataRangeTransport(length, initialData) {
  11385. var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  11386. _classCallCheck(this, PDFDataRangeTransport);
  11387. this.length = length;
  11388. this.initialData = initialData;
  11389. this.progressiveDone = progressiveDone;
  11390. this._rangeListeners = [];
  11391. this._progressListeners = [];
  11392. this._progressiveReadListeners = [];
  11393. this._progressiveDoneListeners = [];
  11394. this._readyCapability = (0, _util.createPromiseCapability)();
  11395. }
  11396. _createClass(PDFDataRangeTransport, [{
  11397. key: "addRangeListener",
  11398. value: function addRangeListener(listener) {
  11399. this._rangeListeners.push(listener);
  11400. }
  11401. }, {
  11402. key: "addProgressListener",
  11403. value: function addProgressListener(listener) {
  11404. this._progressListeners.push(listener);
  11405. }
  11406. }, {
  11407. key: "addProgressiveReadListener",
  11408. value: function addProgressiveReadListener(listener) {
  11409. this._progressiveReadListeners.push(listener);
  11410. }
  11411. }, {
  11412. key: "addProgressiveDoneListener",
  11413. value: function addProgressiveDoneListener(listener) {
  11414. this._progressiveDoneListeners.push(listener);
  11415. }
  11416. }, {
  11417. key: "onDataRange",
  11418. value: function onDataRange(begin, chunk) {
  11419. var _iterator = _createForOfIteratorHelper(this._rangeListeners),
  11420. _step;
  11421. try {
  11422. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  11423. var listener = _step.value;
  11424. listener(begin, chunk);
  11425. }
  11426. } catch (err) {
  11427. _iterator.e(err);
  11428. } finally {
  11429. _iterator.f();
  11430. }
  11431. }
  11432. }, {
  11433. key: "onDataProgress",
  11434. value: function onDataProgress(loaded, total) {
  11435. var _this2 = this;
  11436. this._readyCapability.promise.then(function () {
  11437. var _iterator2 = _createForOfIteratorHelper(_this2._progressListeners),
  11438. _step2;
  11439. try {
  11440. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  11441. var listener = _step2.value;
  11442. listener(loaded, total);
  11443. }
  11444. } catch (err) {
  11445. _iterator2.e(err);
  11446. } finally {
  11447. _iterator2.f();
  11448. }
  11449. });
  11450. }
  11451. }, {
  11452. key: "onDataProgressiveRead",
  11453. value: function onDataProgressiveRead(chunk) {
  11454. var _this3 = this;
  11455. this._readyCapability.promise.then(function () {
  11456. var _iterator3 = _createForOfIteratorHelper(_this3._progressiveReadListeners),
  11457. _step3;
  11458. try {
  11459. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  11460. var listener = _step3.value;
  11461. listener(chunk);
  11462. }
  11463. } catch (err) {
  11464. _iterator3.e(err);
  11465. } finally {
  11466. _iterator3.f();
  11467. }
  11468. });
  11469. }
  11470. }, {
  11471. key: "onDataProgressiveDone",
  11472. value: function onDataProgressiveDone() {
  11473. var _this4 = this;
  11474. this._readyCapability.promise.then(function () {
  11475. var _iterator4 = _createForOfIteratorHelper(_this4._progressiveDoneListeners),
  11476. _step4;
  11477. try {
  11478. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  11479. var listener = _step4.value;
  11480. listener();
  11481. }
  11482. } catch (err) {
  11483. _iterator4.e(err);
  11484. } finally {
  11485. _iterator4.f();
  11486. }
  11487. });
  11488. }
  11489. }, {
  11490. key: "transportReady",
  11491. value: function transportReady() {
  11492. this._readyCapability.resolve();
  11493. }
  11494. }, {
  11495. key: "requestDataRange",
  11496. value: function requestDataRange(begin, end) {
  11497. (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange");
  11498. }
  11499. }, {
  11500. key: "abort",
  11501. value: function abort() {}
  11502. }]);
  11503. return PDFDataRangeTransport;
  11504. }();
  11505. exports.PDFDataRangeTransport = PDFDataRangeTransport;
  11506. var PDFDocumentProxy = /*#__PURE__*/function () {
  11507. function PDFDocumentProxy(pdfInfo, transport) {
  11508. _classCallCheck(this, PDFDocumentProxy);
  11509. this._pdfInfo = pdfInfo;
  11510. this._transport = transport;
  11511. }
  11512. _createClass(PDFDocumentProxy, [{
  11513. key: "getPage",
  11514. value: function getPage(pageNumber) {
  11515. return this._transport.getPage(pageNumber);
  11516. }
  11517. }, {
  11518. key: "getPageIndex",
  11519. value: function getPageIndex(ref) {
  11520. return this._transport.getPageIndex(ref);
  11521. }
  11522. }, {
  11523. key: "getDestinations",
  11524. value: function getDestinations() {
  11525. return this._transport.getDestinations();
  11526. }
  11527. }, {
  11528. key: "getDestination",
  11529. value: function getDestination(id) {
  11530. return this._transport.getDestination(id);
  11531. }
  11532. }, {
  11533. key: "getPageLabels",
  11534. value: function getPageLabels() {
  11535. return this._transport.getPageLabels();
  11536. }
  11537. }, {
  11538. key: "getPageLayout",
  11539. value: function getPageLayout() {
  11540. return this._transport.getPageLayout();
  11541. }
  11542. }, {
  11543. key: "getPageMode",
  11544. value: function getPageMode() {
  11545. return this._transport.getPageMode();
  11546. }
  11547. }, {
  11548. key: "getViewerPreferences",
  11549. value: function getViewerPreferences() {
  11550. return this._transport.getViewerPreferences();
  11551. }
  11552. }, {
  11553. key: "getOpenAction",
  11554. value: function getOpenAction() {
  11555. return this._transport.getOpenAction();
  11556. }
  11557. }, {
  11558. key: "getOpenActionDestination",
  11559. value: function getOpenActionDestination() {
  11560. (0, _display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead.");
  11561. return this.getOpenAction().then(function (openAction) {
  11562. return openAction && openAction.dest ? openAction.dest : null;
  11563. });
  11564. }
  11565. }, {
  11566. key: "getAttachments",
  11567. value: function getAttachments() {
  11568. return this._transport.getAttachments();
  11569. }
  11570. }, {
  11571. key: "getJavaScript",
  11572. value: function getJavaScript() {
  11573. return this._transport.getJavaScript();
  11574. }
  11575. }, {
  11576. key: "getOutline",
  11577. value: function getOutline() {
  11578. return this._transport.getOutline();
  11579. }
  11580. }, {
  11581. key: "getPermissions",
  11582. value: function getPermissions() {
  11583. return this._transport.getPermissions();
  11584. }
  11585. }, {
  11586. key: "getMetadata",
  11587. value: function getMetadata() {
  11588. return this._transport.getMetadata();
  11589. }
  11590. }, {
  11591. key: "getData",
  11592. value: function getData() {
  11593. return this._transport.getData();
  11594. }
  11595. }, {
  11596. key: "getDownloadInfo",
  11597. value: function getDownloadInfo() {
  11598. return this._transport.downloadInfoCapability.promise;
  11599. }
  11600. }, {
  11601. key: "getStats",
  11602. value: function getStats() {
  11603. return this._transport.getStats();
  11604. }
  11605. }, {
  11606. key: "cleanup",
  11607. value: function cleanup() {
  11608. return this._transport.startCleanup();
  11609. }
  11610. }, {
  11611. key: "destroy",
  11612. value: function destroy() {
  11613. return this.loadingTask.destroy();
  11614. }
  11615. }, {
  11616. key: "numPages",
  11617. get: function get() {
  11618. return this._pdfInfo.numPages;
  11619. }
  11620. }, {
  11621. key: "fingerprint",
  11622. get: function get() {
  11623. return this._pdfInfo.fingerprint;
  11624. }
  11625. }, {
  11626. key: "loadingParams",
  11627. get: function get() {
  11628. return this._transport.loadingParams;
  11629. }
  11630. }, {
  11631. key: "loadingTask",
  11632. get: function get() {
  11633. return this._transport.loadingTask;
  11634. }
  11635. }]);
  11636. return PDFDocumentProxy;
  11637. }();
  11638. exports.PDFDocumentProxy = PDFDocumentProxy;
  11639. var PDFPageProxy = /*#__PURE__*/function () {
  11640. function PDFPageProxy(pageIndex, pageInfo, transport) {
  11641. var pdfBug = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  11642. _classCallCheck(this, PDFPageProxy);
  11643. this._pageIndex = pageIndex;
  11644. this._pageInfo = pageInfo;
  11645. this._transport = transport;
  11646. this._stats = pdfBug ? new _display_utils.StatTimer() : null;
  11647. this._pdfBug = pdfBug;
  11648. this.commonObjs = transport.commonObjs;
  11649. this.objs = new PDFObjects();
  11650. this.cleanupAfterRender = false;
  11651. this.pendingCleanup = false;
  11652. this.intentStates = Object.create(null);
  11653. this.destroyed = false;
  11654. }
  11655. _createClass(PDFPageProxy, [{
  11656. key: "getViewport",
  11657. value: function getViewport() {
  11658. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  11659. scale = _ref3.scale,
  11660. _ref3$rotation = _ref3.rotation,
  11661. rotation = _ref3$rotation === void 0 ? this.rotate : _ref3$rotation,
  11662. _ref3$offsetX = _ref3.offsetX,
  11663. offsetX = _ref3$offsetX === void 0 ? 0 : _ref3$offsetX,
  11664. _ref3$offsetY = _ref3.offsetY,
  11665. offsetY = _ref3$offsetY === void 0 ? 0 : _ref3$offsetY,
  11666. _ref3$dontFlip = _ref3.dontFlip,
  11667. dontFlip = _ref3$dontFlip === void 0 ? false : _ref3$dontFlip;
  11668. return new _display_utils.PageViewport({
  11669. viewBox: this.view,
  11670. scale: scale,
  11671. rotation: rotation,
  11672. offsetX: offsetX,
  11673. offsetY: offsetY,
  11674. dontFlip: dontFlip
  11675. });
  11676. }
  11677. }, {
  11678. key: "getAnnotations",
  11679. value: function getAnnotations() {
  11680. var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  11681. _ref4$intent = _ref4.intent,
  11682. intent = _ref4$intent === void 0 ? null : _ref4$intent;
  11683. if (!this.annotationsPromise || this.annotationsIntent !== intent) {
  11684. this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent);
  11685. this.annotationsIntent = intent;
  11686. }
  11687. return this.annotationsPromise;
  11688. }
  11689. }, {
  11690. key: "render",
  11691. value: function render(_ref5) {
  11692. var _this5 = this;
  11693. var canvasContext = _ref5.canvasContext,
  11694. viewport = _ref5.viewport,
  11695. _ref5$intent = _ref5.intent,
  11696. intent = _ref5$intent === void 0 ? "display" : _ref5$intent,
  11697. _ref5$enableWebGL = _ref5.enableWebGL,
  11698. enableWebGL = _ref5$enableWebGL === void 0 ? false : _ref5$enableWebGL,
  11699. _ref5$renderInteracti = _ref5.renderInteractiveForms,
  11700. renderInteractiveForms = _ref5$renderInteracti === void 0 ? false : _ref5$renderInteracti,
  11701. _ref5$transform = _ref5.transform,
  11702. transform = _ref5$transform === void 0 ? null : _ref5$transform,
  11703. _ref5$imageLayer = _ref5.imageLayer,
  11704. imageLayer = _ref5$imageLayer === void 0 ? null : _ref5$imageLayer,
  11705. _ref5$canvasFactory = _ref5.canvasFactory,
  11706. canvasFactory = _ref5$canvasFactory === void 0 ? null : _ref5$canvasFactory,
  11707. _ref5$background = _ref5.background,
  11708. background = _ref5$background === void 0 ? null : _ref5$background;
  11709. if (this._stats) {
  11710. this._stats.time("Overall");
  11711. }
  11712. var renderingIntent = intent === "print" ? "print" : "display";
  11713. this.pendingCleanup = false;
  11714. if (!this.intentStates[renderingIntent]) {
  11715. this.intentStates[renderingIntent] = Object.create(null);
  11716. }
  11717. var intentState = this.intentStates[renderingIntent];
  11718. if (intentState.streamReaderCancelTimeout) {
  11719. clearTimeout(intentState.streamReaderCancelTimeout);
  11720. intentState.streamReaderCancelTimeout = null;
  11721. }
  11722. var canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory();
  11723. var webGLContext = new _webgl.WebGLContext({
  11724. enable: enableWebGL
  11725. });
  11726. if (!intentState.displayReadyCapability) {
  11727. intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
  11728. intentState.operatorList = {
  11729. fnArray: [],
  11730. argsArray: [],
  11731. lastChunk: false
  11732. };
  11733. if (this._stats) {
  11734. this._stats.time("Page Request");
  11735. }
  11736. this._pumpOperatorList({
  11737. pageIndex: this._pageIndex,
  11738. intent: renderingIntent,
  11739. renderInteractiveForms: renderInteractiveForms === true
  11740. });
  11741. }
  11742. var complete = function complete(error) {
  11743. var i = intentState.renderTasks.indexOf(internalRenderTask);
  11744. if (i >= 0) {
  11745. intentState.renderTasks.splice(i, 1);
  11746. }
  11747. if (_this5.cleanupAfterRender || renderingIntent === "print") {
  11748. _this5.pendingCleanup = true;
  11749. }
  11750. _this5._tryCleanup();
  11751. if (error) {
  11752. internalRenderTask.capability.reject(error);
  11753. _this5._abortOperatorList({
  11754. intentState: intentState,
  11755. reason: error
  11756. });
  11757. } else {
  11758. internalRenderTask.capability.resolve();
  11759. }
  11760. if (_this5._stats) {
  11761. _this5._stats.timeEnd("Rendering");
  11762. _this5._stats.timeEnd("Overall");
  11763. }
  11764. };
  11765. var internalRenderTask = new InternalRenderTask({
  11766. callback: complete,
  11767. params: {
  11768. canvasContext: canvasContext,
  11769. viewport: viewport,
  11770. transform: transform,
  11771. imageLayer: imageLayer,
  11772. background: background
  11773. },
  11774. objs: this.objs,
  11775. commonObjs: this.commonObjs,
  11776. operatorList: intentState.operatorList,
  11777. pageIndex: this._pageIndex,
  11778. canvasFactory: canvasFactoryInstance,
  11779. webGLContext: webGLContext,
  11780. useRequestAnimationFrame: renderingIntent !== "print",
  11781. pdfBug: this._pdfBug
  11782. });
  11783. if (!intentState.renderTasks) {
  11784. intentState.renderTasks = [];
  11785. }
  11786. intentState.renderTasks.push(internalRenderTask);
  11787. var renderTask = internalRenderTask.task;
  11788. intentState.displayReadyCapability.promise.then(function (transparency) {
  11789. if (_this5.pendingCleanup) {
  11790. complete();
  11791. return;
  11792. }
  11793. if (_this5._stats) {
  11794. _this5._stats.time("Rendering");
  11795. }
  11796. internalRenderTask.initializeGraphics(transparency);
  11797. internalRenderTask.operatorListChanged();
  11798. })["catch"](complete);
  11799. return renderTask;
  11800. }
  11801. }, {
  11802. key: "getOperatorList",
  11803. value: function getOperatorList() {
  11804. function operatorListChanged() {
  11805. if (intentState.operatorList.lastChunk) {
  11806. intentState.opListReadCapability.resolve(intentState.operatorList);
  11807. var i = intentState.renderTasks.indexOf(opListTask);
  11808. if (i >= 0) {
  11809. intentState.renderTasks.splice(i, 1);
  11810. }
  11811. }
  11812. }
  11813. var renderingIntent = "oplist";
  11814. if (!this.intentStates[renderingIntent]) {
  11815. this.intentStates[renderingIntent] = Object.create(null);
  11816. }
  11817. var intentState = this.intentStates[renderingIntent];
  11818. var opListTask;
  11819. if (!intentState.opListReadCapability) {
  11820. opListTask = {};
  11821. opListTask.operatorListChanged = operatorListChanged;
  11822. intentState.opListReadCapability = (0, _util.createPromiseCapability)();
  11823. intentState.renderTasks = [];
  11824. intentState.renderTasks.push(opListTask);
  11825. intentState.operatorList = {
  11826. fnArray: [],
  11827. argsArray: [],
  11828. lastChunk: false
  11829. };
  11830. if (this._stats) {
  11831. this._stats.time("Page Request");
  11832. }
  11833. this._pumpOperatorList({
  11834. pageIndex: this._pageIndex,
  11835. intent: renderingIntent
  11836. });
  11837. }
  11838. return intentState.opListReadCapability.promise;
  11839. }
  11840. }, {
  11841. key: "streamTextContent",
  11842. value: function streamTextContent() {
  11843. var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  11844. _ref6$normalizeWhites = _ref6.normalizeWhitespace,
  11845. normalizeWhitespace = _ref6$normalizeWhites === void 0 ? false : _ref6$normalizeWhites,
  11846. _ref6$disableCombineT = _ref6.disableCombineTextItems,
  11847. disableCombineTextItems = _ref6$disableCombineT === void 0 ? false : _ref6$disableCombineT;
  11848. var TEXT_CONTENT_CHUNK_SIZE = 100;
  11849. return this._transport.messageHandler.sendWithStream("GetTextContent", {
  11850. pageIndex: this._pageIndex,
  11851. normalizeWhitespace: normalizeWhitespace === true,
  11852. combineTextItems: disableCombineTextItems !== true
  11853. }, {
  11854. highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
  11855. size: function size(textContent) {
  11856. return textContent.items.length;
  11857. }
  11858. });
  11859. }
  11860. }, {
  11861. key: "getTextContent",
  11862. value: function getTextContent() {
  11863. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  11864. var readableStream = this.streamTextContent(params);
  11865. return new Promise(function (resolve, reject) {
  11866. function pump() {
  11867. reader.read().then(function (_ref7) {
  11868. var _textContent$items;
  11869. var value = _ref7.value,
  11870. done = _ref7.done;
  11871. if (done) {
  11872. resolve(textContent);
  11873. return;
  11874. }
  11875. Object.assign(textContent.styles, value.styles);
  11876. (_textContent$items = textContent.items).push.apply(_textContent$items, _toConsumableArray(value.items));
  11877. pump();
  11878. }, reject);
  11879. }
  11880. var reader = readableStream.getReader();
  11881. var textContent = {
  11882. items: [],
  11883. styles: Object.create(null)
  11884. };
  11885. pump();
  11886. });
  11887. }
  11888. }, {
  11889. key: "_destroy",
  11890. value: function _destroy() {
  11891. var _this6 = this;
  11892. this.destroyed = true;
  11893. this._transport.pageCache[this._pageIndex] = null;
  11894. var waitOn = [];
  11895. Object.keys(this.intentStates).forEach(function (intent) {
  11896. var intentState = _this6.intentStates[intent];
  11897. _this6._abortOperatorList({
  11898. intentState: intentState,
  11899. reason: new Error("Page was destroyed."),
  11900. force: true
  11901. });
  11902. if (intent === "oplist") {
  11903. return;
  11904. }
  11905. intentState.renderTasks.forEach(function (renderTask) {
  11906. var renderCompleted = renderTask.capability.promise["catch"](function () {});
  11907. waitOn.push(renderCompleted);
  11908. renderTask.cancel();
  11909. });
  11910. });
  11911. this.objs.clear();
  11912. this.annotationsPromise = null;
  11913. this.pendingCleanup = false;
  11914. return Promise.all(waitOn);
  11915. }
  11916. }, {
  11917. key: "cleanup",
  11918. value: function cleanup() {
  11919. var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  11920. this.pendingCleanup = true;
  11921. return this._tryCleanup(resetStats);
  11922. }
  11923. }, {
  11924. key: "_tryCleanup",
  11925. value: function _tryCleanup() {
  11926. var _this7 = this;
  11927. var resetStats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  11928. if (!this.pendingCleanup || Object.keys(this.intentStates).some(function (intent) {
  11929. var intentState = _this7.intentStates[intent];
  11930. return intentState.renderTasks.length !== 0 || !intentState.operatorList.lastChunk;
  11931. })) {
  11932. return false;
  11933. }
  11934. Object.keys(this.intentStates).forEach(function (intent) {
  11935. delete _this7.intentStates[intent];
  11936. });
  11937. this.objs.clear();
  11938. this.annotationsPromise = null;
  11939. if (resetStats && this._stats) {
  11940. this._stats = new _display_utils.StatTimer();
  11941. }
  11942. this.pendingCleanup = false;
  11943. return true;
  11944. }
  11945. }, {
  11946. key: "_startRenderPage",
  11947. value: function _startRenderPage(transparency, intent) {
  11948. var intentState = this.intentStates[intent];
  11949. if (!intentState) {
  11950. return;
  11951. }
  11952. if (this._stats) {
  11953. this._stats.timeEnd("Page Request");
  11954. }
  11955. if (intentState.displayReadyCapability) {
  11956. intentState.displayReadyCapability.resolve(transparency);
  11957. }
  11958. }
  11959. }, {
  11960. key: "_renderPageChunk",
  11961. value: function _renderPageChunk(operatorListChunk, intentState) {
  11962. for (var i = 0, ii = operatorListChunk.length; i < ii; i++) {
  11963. intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
  11964. intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
  11965. }
  11966. intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
  11967. for (var _i2 = 0; _i2 < intentState.renderTasks.length; _i2++) {
  11968. intentState.renderTasks[_i2].operatorListChanged();
  11969. }
  11970. if (operatorListChunk.lastChunk) {
  11971. this._tryCleanup();
  11972. }
  11973. }
  11974. }, {
  11975. key: "_pumpOperatorList",
  11976. value: function _pumpOperatorList(args) {
  11977. var _this8 = this;
  11978. (0, _util.assert)(args.intent, 'PDFPageProxy._pumpOperatorList: Expected "intent" argument.');
  11979. var readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", args);
  11980. var reader = readableStream.getReader();
  11981. var intentState = this.intentStates[args.intent];
  11982. intentState.streamReader = reader;
  11983. var pump = function pump() {
  11984. reader.read().then(function (_ref8) {
  11985. var value = _ref8.value,
  11986. done = _ref8.done;
  11987. if (done) {
  11988. intentState.streamReader = null;
  11989. return;
  11990. }
  11991. if (_this8._transport.destroyed) {
  11992. return;
  11993. }
  11994. _this8._renderPageChunk(value, intentState);
  11995. pump();
  11996. }, function (reason) {
  11997. intentState.streamReader = null;
  11998. if (_this8._transport.destroyed) {
  11999. return;
  12000. }
  12001. if (intentState.operatorList) {
  12002. intentState.operatorList.lastChunk = true;
  12003. for (var i = 0; i < intentState.renderTasks.length; i++) {
  12004. intentState.renderTasks[i].operatorListChanged();
  12005. }
  12006. _this8._tryCleanup();
  12007. }
  12008. if (intentState.displayReadyCapability) {
  12009. intentState.displayReadyCapability.reject(reason);
  12010. } else if (intentState.opListReadCapability) {
  12011. intentState.opListReadCapability.reject(reason);
  12012. } else {
  12013. throw reason;
  12014. }
  12015. });
  12016. };
  12017. pump();
  12018. }
  12019. }, {
  12020. key: "_abortOperatorList",
  12021. value: function _abortOperatorList(_ref9) {
  12022. var _this9 = this;
  12023. var intentState = _ref9.intentState,
  12024. reason = _ref9.reason,
  12025. _ref9$force = _ref9.force,
  12026. force = _ref9$force === void 0 ? false : _ref9$force;
  12027. (0, _util.assert)(reason instanceof Error || _typeof(reason) === "object" && reason !== null, 'PDFPageProxy._abortOperatorList: Expected "reason" argument.');
  12028. if (!intentState.streamReader) {
  12029. return;
  12030. }
  12031. if (!force) {
  12032. if (intentState.renderTasks.length !== 0) {
  12033. return;
  12034. }
  12035. if (reason instanceof _display_utils.RenderingCancelledException) {
  12036. intentState.streamReaderCancelTimeout = setTimeout(function () {
  12037. _this9._abortOperatorList({
  12038. intentState: intentState,
  12039. reason: reason,
  12040. force: true
  12041. });
  12042. intentState.streamReaderCancelTimeout = null;
  12043. }, RENDERING_CANCELLED_TIMEOUT);
  12044. return;
  12045. }
  12046. }
  12047. intentState.streamReader.cancel(new _util.AbortException(reason && reason.message));
  12048. intentState.streamReader = null;
  12049. if (this._transport.destroyed) {
  12050. return;
  12051. }
  12052. Object.keys(this.intentStates).some(function (intent) {
  12053. if (_this9.intentStates[intent] === intentState) {
  12054. delete _this9.intentStates[intent];
  12055. return true;
  12056. }
  12057. return false;
  12058. });
  12059. this.cleanup();
  12060. }
  12061. }, {
  12062. key: "pageNumber",
  12063. get: function get() {
  12064. return this._pageIndex + 1;
  12065. }
  12066. }, {
  12067. key: "rotate",
  12068. get: function get() {
  12069. return this._pageInfo.rotate;
  12070. }
  12071. }, {
  12072. key: "ref",
  12073. get: function get() {
  12074. return this._pageInfo.ref;
  12075. }
  12076. }, {
  12077. key: "userUnit",
  12078. get: function get() {
  12079. return this._pageInfo.userUnit;
  12080. }
  12081. }, {
  12082. key: "view",
  12083. get: function get() {
  12084. return this._pageInfo.view;
  12085. }
  12086. }, {
  12087. key: "stats",
  12088. get: function get() {
  12089. return this._stats;
  12090. }
  12091. }]);
  12092. return PDFPageProxy;
  12093. }();
  12094. exports.PDFPageProxy = PDFPageProxy;
  12095. var LoopbackPort = /*#__PURE__*/function () {
  12096. function LoopbackPort() {
  12097. var defer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  12098. _classCallCheck(this, LoopbackPort);
  12099. this._listeners = [];
  12100. this._defer = defer;
  12101. this._deferred = Promise.resolve(undefined);
  12102. }
  12103. _createClass(LoopbackPort, [{
  12104. key: "postMessage",
  12105. value: function postMessage(obj, transfers) {
  12106. var _this10 = this;
  12107. function cloneValue(value) {
  12108. if (_typeof(value) !== "object" || value === null) {
  12109. return value;
  12110. }
  12111. if (cloned.has(value)) {
  12112. return cloned.get(value);
  12113. }
  12114. var buffer, result;
  12115. if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
  12116. var transferable = transfers && transfers.includes(buffer);
  12117. if (transferable) {
  12118. result = new value.constructor(buffer, value.byteOffset, value.byteLength);
  12119. } else {
  12120. result = new value.constructor(value);
  12121. }
  12122. cloned.set(value, result);
  12123. return result;
  12124. }
  12125. result = Array.isArray(value) ? [] : {};
  12126. cloned.set(value, result);
  12127. for (var i in value) {
  12128. var desc = void 0,
  12129. p = value;
  12130. while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
  12131. p = Object.getPrototypeOf(p);
  12132. }
  12133. if (typeof desc.value === "undefined") {
  12134. continue;
  12135. }
  12136. if (typeof desc.value === "function") {
  12137. if (value.hasOwnProperty && value.hasOwnProperty(i)) {
  12138. throw new Error("LoopbackPort.postMessage - cannot clone: ".concat(value[i]));
  12139. }
  12140. continue;
  12141. }
  12142. result[i] = cloneValue(desc.value);
  12143. }
  12144. return result;
  12145. }
  12146. if (!this._defer) {
  12147. this._listeners.forEach(function (listener) {
  12148. listener.call(_this10, {
  12149. data: obj
  12150. });
  12151. });
  12152. return;
  12153. }
  12154. var cloned = new WeakMap();
  12155. var e = {
  12156. data: cloneValue(obj)
  12157. };
  12158. this._deferred.then(function () {
  12159. _this10._listeners.forEach(function (listener) {
  12160. listener.call(_this10, e);
  12161. });
  12162. });
  12163. }
  12164. }, {
  12165. key: "addEventListener",
  12166. value: function addEventListener(name, listener) {
  12167. this._listeners.push(listener);
  12168. }
  12169. }, {
  12170. key: "removeEventListener",
  12171. value: function removeEventListener(name, listener) {
  12172. var i = this._listeners.indexOf(listener);
  12173. this._listeners.splice(i, 1);
  12174. }
  12175. }, {
  12176. key: "terminate",
  12177. value: function terminate() {
  12178. this._listeners.length = 0;
  12179. }
  12180. }]);
  12181. return LoopbackPort;
  12182. }();
  12183. exports.LoopbackPort = LoopbackPort;
  12184. var PDFWorker = function PDFWorkerClosure() {
  12185. var pdfWorkerPorts = new WeakMap();
  12186. var isWorkerDisabled = false;
  12187. var fallbackWorkerSrc;
  12188. var nextFakeWorkerId = 0;
  12189. var fakeWorkerCapability;
  12190. if (_is_node.isNodeJS && typeof require === "function") {
  12191. isWorkerDisabled = true;
  12192. fallbackWorkerSrc = "./pdf.worker.js";
  12193. } else if ((typeof document === "undefined" ? "undefined" : _typeof(document)) === "object" && "currentScript" in document) {
  12194. var pdfjsFilePath = document.currentScript && document.currentScript.src;
  12195. if (pdfjsFilePath) {
  12196. fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2");
  12197. }
  12198. }
  12199. function _getWorkerSrc() {
  12200. if (_worker_options.GlobalWorkerOptions.workerSrc) {
  12201. return _worker_options.GlobalWorkerOptions.workerSrc;
  12202. }
  12203. if (typeof fallbackWorkerSrc !== "undefined") {
  12204. if (!_is_node.isNodeJS) {
  12205. (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');
  12206. }
  12207. return fallbackWorkerSrc;
  12208. }
  12209. throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
  12210. }
  12211. function getMainThreadWorkerMessageHandler() {
  12212. var mainWorkerMessageHandler;
  12213. try {
  12214. mainWorkerMessageHandler = globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler;
  12215. } catch (ex) {}
  12216. return mainWorkerMessageHandler || null;
  12217. }
  12218. function setupFakeWorkerGlobal() {
  12219. if (fakeWorkerCapability) {
  12220. return fakeWorkerCapability.promise;
  12221. }
  12222. fakeWorkerCapability = (0, _util.createPromiseCapability)();
  12223. var loader = /*#__PURE__*/function () {
  12224. var _ref10 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  12225. var mainWorkerMessageHandler, worker;
  12226. return _regenerator["default"].wrap(function _callee$(_context) {
  12227. while (1) {
  12228. switch (_context.prev = _context.next) {
  12229. case 0:
  12230. mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();
  12231. if (!mainWorkerMessageHandler) {
  12232. _context.next = 3;
  12233. break;
  12234. }
  12235. return _context.abrupt("return", mainWorkerMessageHandler);
  12236. case 3:
  12237. if (!(_is_node.isNodeJS && typeof require === "function")) {
  12238. _context.next = 6;
  12239. break;
  12240. }
  12241. worker = eval("require")(_getWorkerSrc());
  12242. return _context.abrupt("return", worker.WorkerMessageHandler);
  12243. case 6:
  12244. _context.next = 8;
  12245. return (0, _display_utils.loadScript)(_getWorkerSrc());
  12246. case 8:
  12247. return _context.abrupt("return", window.pdfjsWorker.WorkerMessageHandler);
  12248. case 9:
  12249. case "end":
  12250. return _context.stop();
  12251. }
  12252. }
  12253. }, _callee);
  12254. }));
  12255. return function loader() {
  12256. return _ref10.apply(this, arguments);
  12257. };
  12258. }();
  12259. loader().then(fakeWorkerCapability.resolve, fakeWorkerCapability.reject);
  12260. return fakeWorkerCapability.promise;
  12261. }
  12262. function createCDNWrapper(url) {
  12263. var wrapper = "importScripts('" + url + "');";
  12264. return URL.createObjectURL(new Blob([wrapper]));
  12265. }
  12266. var PDFWorker = /*#__PURE__*/function () {
  12267. function PDFWorker() {
  12268. var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  12269. _ref11$name = _ref11.name,
  12270. name = _ref11$name === void 0 ? null : _ref11$name,
  12271. _ref11$port = _ref11.port,
  12272. port = _ref11$port === void 0 ? null : _ref11$port,
  12273. _ref11$verbosity = _ref11.verbosity,
  12274. verbosity = _ref11$verbosity === void 0 ? (0, _util.getVerbosityLevel)() : _ref11$verbosity;
  12275. _classCallCheck(this, PDFWorker);
  12276. if (port && pdfWorkerPorts.has(port)) {
  12277. throw new Error("Cannot use more than one PDFWorker per port");
  12278. }
  12279. this.name = name;
  12280. this.destroyed = false;
  12281. this.postMessageTransfers = true;
  12282. this.verbosity = verbosity;
  12283. this._readyCapability = (0, _util.createPromiseCapability)();
  12284. this._port = null;
  12285. this._webWorker = null;
  12286. this._messageHandler = null;
  12287. if (port) {
  12288. pdfWorkerPorts.set(port, this);
  12289. this._initializeFromPort(port);
  12290. return;
  12291. }
  12292. this._initialize();
  12293. }
  12294. _createClass(PDFWorker, [{
  12295. key: "_initializeFromPort",
  12296. value: function _initializeFromPort(port) {
  12297. this._port = port;
  12298. this._messageHandler = new _message_handler.MessageHandler("main", "worker", port);
  12299. this._messageHandler.on("ready", function () {});
  12300. this._readyCapability.resolve();
  12301. }
  12302. }, {
  12303. key: "_initialize",
  12304. value: function _initialize() {
  12305. var _this11 = this;
  12306. if (typeof Worker !== "undefined" && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) {
  12307. var workerSrc = _getWorkerSrc();
  12308. try {
  12309. if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) {
  12310. workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href);
  12311. }
  12312. var worker = new Worker(workerSrc);
  12313. var messageHandler = new _message_handler.MessageHandler("main", "worker", worker);
  12314. var terminateEarly = function terminateEarly() {
  12315. worker.removeEventListener("error", onWorkerError);
  12316. messageHandler.destroy();
  12317. worker.terminate();
  12318. if (_this11.destroyed) {
  12319. _this11._readyCapability.reject(new Error("Worker was destroyed"));
  12320. } else {
  12321. _this11._setupFakeWorker();
  12322. }
  12323. };
  12324. var onWorkerError = function onWorkerError() {
  12325. if (!_this11._webWorker) {
  12326. terminateEarly();
  12327. }
  12328. };
  12329. worker.addEventListener("error", onWorkerError);
  12330. messageHandler.on("test", function (data) {
  12331. worker.removeEventListener("error", onWorkerError);
  12332. if (_this11.destroyed) {
  12333. terminateEarly();
  12334. return;
  12335. }
  12336. if (data) {
  12337. _this11._messageHandler = messageHandler;
  12338. _this11._port = worker;
  12339. _this11._webWorker = worker;
  12340. if (!data.supportTransfers) {
  12341. _this11.postMessageTransfers = false;
  12342. }
  12343. _this11._readyCapability.resolve();
  12344. messageHandler.send("configure", {
  12345. verbosity: _this11.verbosity
  12346. });
  12347. } else {
  12348. _this11._setupFakeWorker();
  12349. messageHandler.destroy();
  12350. worker.terminate();
  12351. }
  12352. });
  12353. messageHandler.on("ready", function (data) {
  12354. worker.removeEventListener("error", onWorkerError);
  12355. if (_this11.destroyed) {
  12356. terminateEarly();
  12357. return;
  12358. }
  12359. try {
  12360. sendTest();
  12361. } catch (e) {
  12362. _this11._setupFakeWorker();
  12363. }
  12364. });
  12365. var sendTest = function sendTest() {
  12366. var testObj = new Uint8Array([_this11.postMessageTransfers ? 255 : 0]);
  12367. try {
  12368. messageHandler.send("test", testObj, [testObj.buffer]);
  12369. } catch (ex) {
  12370. (0, _util.warn)("Cannot use postMessage transfers.");
  12371. testObj[0] = 0;
  12372. messageHandler.send("test", testObj);
  12373. }
  12374. };
  12375. sendTest();
  12376. return;
  12377. } catch (e) {
  12378. (0, _util.info)("The worker has been disabled.");
  12379. }
  12380. }
  12381. this._setupFakeWorker();
  12382. }
  12383. }, {
  12384. key: "_setupFakeWorker",
  12385. value: function _setupFakeWorker() {
  12386. var _this12 = this;
  12387. if (!isWorkerDisabled) {
  12388. (0, _util.warn)("Setting up fake worker.");
  12389. isWorkerDisabled = true;
  12390. }
  12391. setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
  12392. if (_this12.destroyed) {
  12393. _this12._readyCapability.reject(new Error("Worker was destroyed"));
  12394. return;
  12395. }
  12396. var port = new LoopbackPort();
  12397. _this12._port = port;
  12398. var id = "fake" + nextFakeWorkerId++;
  12399. var workerHandler = new _message_handler.MessageHandler(id + "_worker", id, port);
  12400. WorkerMessageHandler.setup(workerHandler, port);
  12401. var messageHandler = new _message_handler.MessageHandler(id, id + "_worker", port);
  12402. _this12._messageHandler = messageHandler;
  12403. _this12._readyCapability.resolve();
  12404. messageHandler.send("configure", {
  12405. verbosity: _this12.verbosity
  12406. });
  12407. })["catch"](function (reason) {
  12408. _this12._readyCapability.reject(new Error("Setting up fake worker failed: \"".concat(reason.message, "\".")));
  12409. });
  12410. }
  12411. }, {
  12412. key: "destroy",
  12413. value: function destroy() {
  12414. this.destroyed = true;
  12415. if (this._webWorker) {
  12416. this._webWorker.terminate();
  12417. this._webWorker = null;
  12418. }
  12419. pdfWorkerPorts["delete"](this._port);
  12420. this._port = null;
  12421. if (this._messageHandler) {
  12422. this._messageHandler.destroy();
  12423. this._messageHandler = null;
  12424. }
  12425. }
  12426. }, {
  12427. key: "promise",
  12428. get: function get() {
  12429. return this._readyCapability.promise;
  12430. }
  12431. }, {
  12432. key: "port",
  12433. get: function get() {
  12434. return this._port;
  12435. }
  12436. }, {
  12437. key: "messageHandler",
  12438. get: function get() {
  12439. return this._messageHandler;
  12440. }
  12441. }], [{
  12442. key: "fromPort",
  12443. value: function fromPort(params) {
  12444. if (!params || !params.port) {
  12445. throw new Error("PDFWorker.fromPort - invalid method signature.");
  12446. }
  12447. if (pdfWorkerPorts.has(params.port)) {
  12448. return pdfWorkerPorts.get(params.port);
  12449. }
  12450. return new PDFWorker(params);
  12451. }
  12452. }, {
  12453. key: "getWorkerSrc",
  12454. value: function getWorkerSrc() {
  12455. return _getWorkerSrc();
  12456. }
  12457. }]);
  12458. return PDFWorker;
  12459. }();
  12460. return PDFWorker;
  12461. }();
  12462. exports.PDFWorker = PDFWorker;
  12463. var WorkerTransport = /*#__PURE__*/function () {
  12464. function WorkerTransport(messageHandler, loadingTask, networkStream, params) {
  12465. _classCallCheck(this, WorkerTransport);
  12466. this.messageHandler = messageHandler;
  12467. this.loadingTask = loadingTask;
  12468. this.commonObjs = new PDFObjects();
  12469. this.fontLoader = new _font_loader.FontLoader({
  12470. docId: loadingTask.docId,
  12471. onUnsupportedFeature: this._onUnsupportedFeature.bind(this)
  12472. });
  12473. this._params = params;
  12474. this.CMapReaderFactory = new params.CMapReaderFactory({
  12475. baseUrl: params.cMapUrl,
  12476. isCompressed: params.cMapPacked
  12477. });
  12478. this.destroyed = false;
  12479. this.destroyCapability = null;
  12480. this._passwordCapability = null;
  12481. this._networkStream = networkStream;
  12482. this._fullReader = null;
  12483. this._lastProgress = null;
  12484. this.pageCache = [];
  12485. this.pagePromises = [];
  12486. this.downloadInfoCapability = (0, _util.createPromiseCapability)();
  12487. this.setupMessageHandler();
  12488. }
  12489. _createClass(WorkerTransport, [{
  12490. key: "destroy",
  12491. value: function destroy() {
  12492. var _this13 = this;
  12493. if (this.destroyCapability) {
  12494. return this.destroyCapability.promise;
  12495. }
  12496. this.destroyed = true;
  12497. this.destroyCapability = (0, _util.createPromiseCapability)();
  12498. if (this._passwordCapability) {
  12499. this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));
  12500. }
  12501. var waitOn = [];
  12502. this.pageCache.forEach(function (page) {
  12503. if (page) {
  12504. waitOn.push(page._destroy());
  12505. }
  12506. });
  12507. this.pageCache.length = 0;
  12508. this.pagePromises.length = 0;
  12509. var terminated = this.messageHandler.sendWithPromise("Terminate", null);
  12510. waitOn.push(terminated);
  12511. Promise.all(waitOn).then(function () {
  12512. _this13.fontLoader.clear();
  12513. if (_this13._networkStream) {
  12514. _this13._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));
  12515. }
  12516. if (_this13.messageHandler) {
  12517. _this13.messageHandler.destroy();
  12518. _this13.messageHandler = null;
  12519. }
  12520. _this13.destroyCapability.resolve();
  12521. }, this.destroyCapability.reject);
  12522. return this.destroyCapability.promise;
  12523. }
  12524. }, {
  12525. key: "setupMessageHandler",
  12526. value: function setupMessageHandler() {
  12527. var _this14 = this;
  12528. var messageHandler = this.messageHandler,
  12529. loadingTask = this.loadingTask;
  12530. messageHandler.on("GetReader", function (data, sink) {
  12531. (0, _util.assert)(_this14._networkStream, "GetReader - no `IPDFStream` instance available.");
  12532. _this14._fullReader = _this14._networkStream.getFullReader();
  12533. _this14._fullReader.onProgress = function (evt) {
  12534. _this14._lastProgress = {
  12535. loaded: evt.loaded,
  12536. total: evt.total
  12537. };
  12538. };
  12539. sink.onPull = function () {
  12540. _this14._fullReader.read().then(function (_ref12) {
  12541. var value = _ref12.value,
  12542. done = _ref12.done;
  12543. if (done) {
  12544. sink.close();
  12545. return;
  12546. }
  12547. (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetReader - expected an ArrayBuffer.");
  12548. sink.enqueue(new Uint8Array(value), 1, [value]);
  12549. })["catch"](function (reason) {
  12550. sink.error(reason);
  12551. });
  12552. };
  12553. sink.onCancel = function (reason) {
  12554. _this14._fullReader.cancel(reason);
  12555. };
  12556. });
  12557. messageHandler.on("ReaderHeadersReady", function (data) {
  12558. var headersCapability = (0, _util.createPromiseCapability)();
  12559. var fullReader = _this14._fullReader;
  12560. fullReader.headersReady.then(function () {
  12561. if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
  12562. if (_this14._lastProgress && loadingTask.onProgress) {
  12563. loadingTask.onProgress(_this14._lastProgress);
  12564. }
  12565. fullReader.onProgress = function (evt) {
  12566. if (loadingTask.onProgress) {
  12567. loadingTask.onProgress({
  12568. loaded: evt.loaded,
  12569. total: evt.total
  12570. });
  12571. }
  12572. };
  12573. }
  12574. headersCapability.resolve({
  12575. isStreamingSupported: fullReader.isStreamingSupported,
  12576. isRangeSupported: fullReader.isRangeSupported,
  12577. contentLength: fullReader.contentLength
  12578. });
  12579. }, headersCapability.reject);
  12580. return headersCapability.promise;
  12581. });
  12582. messageHandler.on("GetRangeReader", function (data, sink) {
  12583. (0, _util.assert)(_this14._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
  12584. var rangeReader = _this14._networkStream.getRangeReader(data.begin, data.end);
  12585. if (!rangeReader) {
  12586. sink.close();
  12587. return;
  12588. }
  12589. sink.onPull = function () {
  12590. rangeReader.read().then(function (_ref13) {
  12591. var value = _ref13.value,
  12592. done = _ref13.done;
  12593. if (done) {
  12594. sink.close();
  12595. return;
  12596. }
  12597. (0, _util.assert)((0, _util.isArrayBuffer)(value), "GetRangeReader - expected an ArrayBuffer.");
  12598. sink.enqueue(new Uint8Array(value), 1, [value]);
  12599. })["catch"](function (reason) {
  12600. sink.error(reason);
  12601. });
  12602. };
  12603. sink.onCancel = function (reason) {
  12604. rangeReader.cancel(reason);
  12605. };
  12606. });
  12607. messageHandler.on("GetDoc", function (_ref14) {
  12608. var pdfInfo = _ref14.pdfInfo;
  12609. _this14._numPages = pdfInfo.numPages;
  12610. loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, _this14));
  12611. });
  12612. messageHandler.on("DocException", function (ex) {
  12613. var reason;
  12614. switch (ex.name) {
  12615. case "PasswordException":
  12616. reason = new _util.PasswordException(ex.message, ex.code);
  12617. break;
  12618. case "InvalidPDFException":
  12619. reason = new _util.InvalidPDFException(ex.message);
  12620. break;
  12621. case "MissingPDFException":
  12622. reason = new _util.MissingPDFException(ex.message);
  12623. break;
  12624. case "UnexpectedResponseException":
  12625. reason = new _util.UnexpectedResponseException(ex.message, ex.status);
  12626. break;
  12627. case "UnknownErrorException":
  12628. reason = new _util.UnknownErrorException(ex.message, ex.details);
  12629. break;
  12630. }
  12631. loadingTask._capability.reject(reason);
  12632. });
  12633. messageHandler.on("PasswordRequest", function (exception) {
  12634. _this14._passwordCapability = (0, _util.createPromiseCapability)();
  12635. if (loadingTask.onPassword) {
  12636. var updatePassword = function updatePassword(password) {
  12637. _this14._passwordCapability.resolve({
  12638. password: password
  12639. });
  12640. };
  12641. try {
  12642. loadingTask.onPassword(updatePassword, exception.code);
  12643. } catch (ex) {
  12644. _this14._passwordCapability.reject(ex);
  12645. }
  12646. } else {
  12647. _this14._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
  12648. }
  12649. return _this14._passwordCapability.promise;
  12650. });
  12651. messageHandler.on("DataLoaded", function (data) {
  12652. if (loadingTask.onProgress) {
  12653. loadingTask.onProgress({
  12654. loaded: data.length,
  12655. total: data.length
  12656. });
  12657. }
  12658. _this14.downloadInfoCapability.resolve(data);
  12659. });
  12660. messageHandler.on("StartRenderPage", function (data) {
  12661. if (_this14.destroyed) {
  12662. return;
  12663. }
  12664. var page = _this14.pageCache[data.pageIndex];
  12665. page._startRenderPage(data.transparency, data.intent);
  12666. });
  12667. messageHandler.on("commonobj", function (data) {
  12668. if (_this14.destroyed) {
  12669. return;
  12670. }
  12671. var _data = _slicedToArray(data, 3),
  12672. id = _data[0],
  12673. type = _data[1],
  12674. exportedData = _data[2];
  12675. if (_this14.commonObjs.has(id)) {
  12676. return;
  12677. }
  12678. switch (type) {
  12679. case "Font":
  12680. var params = _this14._params;
  12681. if ("error" in exportedData) {
  12682. var exportedError = exportedData.error;
  12683. (0, _util.warn)("Error during font loading: ".concat(exportedError));
  12684. _this14.commonObjs.resolve(id, exportedError);
  12685. break;
  12686. }
  12687. var fontRegistry = null;
  12688. if (params.pdfBug && globalThis.FontInspector && globalThis.FontInspector.enabled) {
  12689. fontRegistry = {
  12690. registerFont: function registerFont(font, url) {
  12691. globalThis.FontInspector.fontAdded(font, url);
  12692. }
  12693. };
  12694. }
  12695. var font = new _font_loader.FontFaceObject(exportedData, {
  12696. isEvalSupported: params.isEvalSupported,
  12697. disableFontFace: params.disableFontFace,
  12698. ignoreErrors: params.ignoreErrors,
  12699. onUnsupportedFeature: _this14._onUnsupportedFeature.bind(_this14),
  12700. fontRegistry: fontRegistry
  12701. });
  12702. _this14.fontLoader.bind(font)["catch"](function (reason) {
  12703. return messageHandler.sendWithPromise("FontFallback", {
  12704. id: id
  12705. });
  12706. })["finally"](function () {
  12707. if (!params.fontExtraProperties && font.data) {
  12708. font.data = null;
  12709. }
  12710. _this14.commonObjs.resolve(id, font);
  12711. });
  12712. break;
  12713. case "FontPath":
  12714. case "FontType3Res":
  12715. case "Image":
  12716. _this14.commonObjs.resolve(id, exportedData);
  12717. break;
  12718. default:
  12719. throw new Error("Got unknown common object type ".concat(type));
  12720. }
  12721. });
  12722. messageHandler.on("obj", function (data) {
  12723. if (_this14.destroyed) {
  12724. return undefined;
  12725. }
  12726. var _data2 = _slicedToArray(data, 4),
  12727. id = _data2[0],
  12728. pageIndex = _data2[1],
  12729. type = _data2[2],
  12730. imageData = _data2[3];
  12731. var pageProxy = _this14.pageCache[pageIndex];
  12732. if (pageProxy.objs.has(id)) {
  12733. return undefined;
  12734. }
  12735. switch (type) {
  12736. case "Image":
  12737. pageProxy.objs.resolve(id, imageData);
  12738. var MAX_IMAGE_SIZE_TO_STORE = 8000000;
  12739. if (imageData && "data" in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) {
  12740. pageProxy.cleanupAfterRender = true;
  12741. }
  12742. break;
  12743. default:
  12744. throw new Error("Got unknown object type ".concat(type));
  12745. }
  12746. return undefined;
  12747. });
  12748. messageHandler.on("DocProgress", function (data) {
  12749. if (_this14.destroyed) {
  12750. return;
  12751. }
  12752. if (loadingTask.onProgress) {
  12753. loadingTask.onProgress({
  12754. loaded: data.loaded,
  12755. total: data.total
  12756. });
  12757. }
  12758. });
  12759. messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this));
  12760. messageHandler.on("FetchBuiltInCMap", function (data, sink) {
  12761. if (_this14.destroyed) {
  12762. sink.error(new Error("Worker was destroyed"));
  12763. return;
  12764. }
  12765. var fetched = false;
  12766. sink.onPull = function () {
  12767. if (fetched) {
  12768. sink.close();
  12769. return;
  12770. }
  12771. fetched = true;
  12772. _this14.CMapReaderFactory.fetch(data).then(function (builtInCMap) {
  12773. sink.enqueue(builtInCMap, 1, [builtInCMap.cMapData.buffer]);
  12774. })["catch"](function (reason) {
  12775. sink.error(reason);
  12776. });
  12777. };
  12778. });
  12779. }
  12780. }, {
  12781. key: "_onUnsupportedFeature",
  12782. value: function _onUnsupportedFeature(_ref15) {
  12783. var featureId = _ref15.featureId;
  12784. if (this.destroyed) {
  12785. return;
  12786. }
  12787. if (this.loadingTask.onUnsupportedFeature) {
  12788. this.loadingTask.onUnsupportedFeature(featureId);
  12789. }
  12790. }
  12791. }, {
  12792. key: "getData",
  12793. value: function getData() {
  12794. return this.messageHandler.sendWithPromise("GetData", null);
  12795. }
  12796. }, {
  12797. key: "getPage",
  12798. value: function getPage(pageNumber) {
  12799. var _this15 = this;
  12800. if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
  12801. return Promise.reject(new Error("Invalid page request"));
  12802. }
  12803. var pageIndex = pageNumber - 1;
  12804. if (pageIndex in this.pagePromises) {
  12805. return this.pagePromises[pageIndex];
  12806. }
  12807. var promise = this.messageHandler.sendWithPromise("GetPage", {
  12808. pageIndex: pageIndex
  12809. }).then(function (pageInfo) {
  12810. if (_this15.destroyed) {
  12811. throw new Error("Transport destroyed");
  12812. }
  12813. var page = new PDFPageProxy(pageIndex, pageInfo, _this15, _this15._params.pdfBug);
  12814. _this15.pageCache[pageIndex] = page;
  12815. return page;
  12816. });
  12817. this.pagePromises[pageIndex] = promise;
  12818. return promise;
  12819. }
  12820. }, {
  12821. key: "getPageIndex",
  12822. value: function getPageIndex(ref) {
  12823. return this.messageHandler.sendWithPromise("GetPageIndex", {
  12824. ref: ref
  12825. })["catch"](function (reason) {
  12826. return Promise.reject(new Error(reason));
  12827. });
  12828. }
  12829. }, {
  12830. key: "getAnnotations",
  12831. value: function getAnnotations(pageIndex, intent) {
  12832. return this.messageHandler.sendWithPromise("GetAnnotations", {
  12833. pageIndex: pageIndex,
  12834. intent: intent
  12835. });
  12836. }
  12837. }, {
  12838. key: "getDestinations",
  12839. value: function getDestinations() {
  12840. return this.messageHandler.sendWithPromise("GetDestinations", null);
  12841. }
  12842. }, {
  12843. key: "getDestination",
  12844. value: function getDestination(id) {
  12845. if (typeof id !== "string") {
  12846. return Promise.reject(new Error("Invalid destination request."));
  12847. }
  12848. return this.messageHandler.sendWithPromise("GetDestination", {
  12849. id: id
  12850. });
  12851. }
  12852. }, {
  12853. key: "getPageLabels",
  12854. value: function getPageLabels() {
  12855. return this.messageHandler.sendWithPromise("GetPageLabels", null);
  12856. }
  12857. }, {
  12858. key: "getPageLayout",
  12859. value: function getPageLayout() {
  12860. return this.messageHandler.sendWithPromise("GetPageLayout", null);
  12861. }
  12862. }, {
  12863. key: "getPageMode",
  12864. value: function getPageMode() {
  12865. return this.messageHandler.sendWithPromise("GetPageMode", null);
  12866. }
  12867. }, {
  12868. key: "getViewerPreferences",
  12869. value: function getViewerPreferences() {
  12870. return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
  12871. }
  12872. }, {
  12873. key: "getOpenAction",
  12874. value: function getOpenAction() {
  12875. return this.messageHandler.sendWithPromise("GetOpenAction", null);
  12876. }
  12877. }, {
  12878. key: "getAttachments",
  12879. value: function getAttachments() {
  12880. return this.messageHandler.sendWithPromise("GetAttachments", null);
  12881. }
  12882. }, {
  12883. key: "getJavaScript",
  12884. value: function getJavaScript() {
  12885. return this.messageHandler.sendWithPromise("GetJavaScript", null);
  12886. }
  12887. }, {
  12888. key: "getOutline",
  12889. value: function getOutline() {
  12890. return this.messageHandler.sendWithPromise("GetOutline", null);
  12891. }
  12892. }, {
  12893. key: "getPermissions",
  12894. value: function getPermissions() {
  12895. return this.messageHandler.sendWithPromise("GetPermissions", null);
  12896. }
  12897. }, {
  12898. key: "getMetadata",
  12899. value: function getMetadata() {
  12900. var _this16 = this;
  12901. return this.messageHandler.sendWithPromise("GetMetadata", null).then(function (results) {
  12902. return {
  12903. info: results[0],
  12904. metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
  12905. contentDispositionFilename: _this16._fullReader ? _this16._fullReader.filename : null
  12906. };
  12907. });
  12908. }
  12909. }, {
  12910. key: "getStats",
  12911. value: function getStats() {
  12912. return this.messageHandler.sendWithPromise("GetStats", null);
  12913. }
  12914. }, {
  12915. key: "startCleanup",
  12916. value: function startCleanup() {
  12917. var _this17 = this;
  12918. return this.messageHandler.sendWithPromise("Cleanup", null).then(function () {
  12919. for (var i = 0, ii = _this17.pageCache.length; i < ii; i++) {
  12920. var page = _this17.pageCache[i];
  12921. if (page) {
  12922. var cleanupSuccessful = page.cleanup();
  12923. if (!cleanupSuccessful) {
  12924. throw new Error("startCleanup: Page ".concat(i + 1, " is currently rendering."));
  12925. }
  12926. }
  12927. }
  12928. _this17.commonObjs.clear();
  12929. _this17.fontLoader.clear();
  12930. });
  12931. }
  12932. }, {
  12933. key: "loadingParams",
  12934. get: function get() {
  12935. var params = this._params;
  12936. return (0, _util.shadow)(this, "loadingParams", {
  12937. disableAutoFetch: params.disableAutoFetch,
  12938. disableFontFace: params.disableFontFace
  12939. });
  12940. }
  12941. }]);
  12942. return WorkerTransport;
  12943. }();
  12944. var PDFObjects = /*#__PURE__*/function () {
  12945. function PDFObjects() {
  12946. _classCallCheck(this, PDFObjects);
  12947. this._objs = Object.create(null);
  12948. }
  12949. _createClass(PDFObjects, [{
  12950. key: "_ensureObj",
  12951. value: function _ensureObj(objId) {
  12952. if (this._objs[objId]) {
  12953. return this._objs[objId];
  12954. }
  12955. return this._objs[objId] = {
  12956. capability: (0, _util.createPromiseCapability)(),
  12957. data: null,
  12958. resolved: false
  12959. };
  12960. }
  12961. }, {
  12962. key: "get",
  12963. value: function get(objId) {
  12964. var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  12965. if (callback) {
  12966. this._ensureObj(objId).capability.promise.then(callback);
  12967. return null;
  12968. }
  12969. var obj = this._objs[objId];
  12970. if (!obj || !obj.resolved) {
  12971. throw new Error("Requesting object that isn't resolved yet ".concat(objId, "."));
  12972. }
  12973. return obj.data;
  12974. }
  12975. }, {
  12976. key: "has",
  12977. value: function has(objId) {
  12978. var obj = this._objs[objId];
  12979. return obj ? obj.resolved : false;
  12980. }
  12981. }, {
  12982. key: "resolve",
  12983. value: function resolve(objId, data) {
  12984. var obj = this._ensureObj(objId);
  12985. obj.resolved = true;
  12986. obj.data = data;
  12987. obj.capability.resolve(data);
  12988. }
  12989. }, {
  12990. key: "clear",
  12991. value: function clear() {
  12992. this._objs = Object.create(null);
  12993. }
  12994. }]);
  12995. return PDFObjects;
  12996. }();
  12997. var RenderTask = /*#__PURE__*/function () {
  12998. function RenderTask(internalRenderTask) {
  12999. _classCallCheck(this, RenderTask);
  13000. this._internalRenderTask = internalRenderTask;
  13001. this.onContinue = null;
  13002. }
  13003. _createClass(RenderTask, [{
  13004. key: "cancel",
  13005. value: function cancel() {
  13006. this._internalRenderTask.cancel();
  13007. }
  13008. }, {
  13009. key: "promise",
  13010. get: function get() {
  13011. return this._internalRenderTask.capability.promise;
  13012. }
  13013. }]);
  13014. return RenderTask;
  13015. }();
  13016. var InternalRenderTask = function InternalRenderTaskClosure() {
  13017. var canvasInRendering = new WeakSet();
  13018. var InternalRenderTask = /*#__PURE__*/function () {
  13019. function InternalRenderTask(_ref16) {
  13020. var callback = _ref16.callback,
  13021. params = _ref16.params,
  13022. objs = _ref16.objs,
  13023. commonObjs = _ref16.commonObjs,
  13024. operatorList = _ref16.operatorList,
  13025. pageIndex = _ref16.pageIndex,
  13026. canvasFactory = _ref16.canvasFactory,
  13027. webGLContext = _ref16.webGLContext,
  13028. _ref16$useRequestAnim = _ref16.useRequestAnimationFrame,
  13029. useRequestAnimationFrame = _ref16$useRequestAnim === void 0 ? false : _ref16$useRequestAnim,
  13030. _ref16$pdfBug = _ref16.pdfBug,
  13031. pdfBug = _ref16$pdfBug === void 0 ? false : _ref16$pdfBug;
  13032. _classCallCheck(this, InternalRenderTask);
  13033. this.callback = callback;
  13034. this.params = params;
  13035. this.objs = objs;
  13036. this.commonObjs = commonObjs;
  13037. this.operatorListIdx = null;
  13038. this.operatorList = operatorList;
  13039. this._pageIndex = pageIndex;
  13040. this.canvasFactory = canvasFactory;
  13041. this.webGLContext = webGLContext;
  13042. this._pdfBug = pdfBug;
  13043. this.running = false;
  13044. this.graphicsReadyCallback = null;
  13045. this.graphicsReady = false;
  13046. this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
  13047. this.cancelled = false;
  13048. this.capability = (0, _util.createPromiseCapability)();
  13049. this.task = new RenderTask(this);
  13050. this._continueBound = this._continue.bind(this);
  13051. this._scheduleNextBound = this._scheduleNext.bind(this);
  13052. this._nextBound = this._next.bind(this);
  13053. this._canvas = params.canvasContext.canvas;
  13054. }
  13055. _createClass(InternalRenderTask, [{
  13056. key: "initializeGraphics",
  13057. value: function initializeGraphics() {
  13058. var transparency = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  13059. if (this.cancelled) {
  13060. return;
  13061. }
  13062. if (this._canvas) {
  13063. if (canvasInRendering.has(this._canvas)) {
  13064. throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed.");
  13065. }
  13066. canvasInRendering.add(this._canvas);
  13067. }
  13068. if (this._pdfBug && globalThis.StepperManager && globalThis.StepperManager.enabled) {
  13069. this.stepper = globalThis.StepperManager.create(this._pageIndex);
  13070. this.stepper.init(this.operatorList);
  13071. this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
  13072. }
  13073. var _this$params = this.params,
  13074. canvasContext = _this$params.canvasContext,
  13075. viewport = _this$params.viewport,
  13076. transform = _this$params.transform,
  13077. imageLayer = _this$params.imageLayer,
  13078. background = _this$params.background;
  13079. this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, imageLayer);
  13080. this.gfx.beginDrawing({
  13081. transform: transform,
  13082. viewport: viewport,
  13083. transparency: transparency,
  13084. background: background
  13085. });
  13086. this.operatorListIdx = 0;
  13087. this.graphicsReady = true;
  13088. if (this.graphicsReadyCallback) {
  13089. this.graphicsReadyCallback();
  13090. }
  13091. }
  13092. }, {
  13093. key: "cancel",
  13094. value: function cancel() {
  13095. var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  13096. this.running = false;
  13097. this.cancelled = true;
  13098. if (this.gfx) {
  13099. this.gfx.endDrawing();
  13100. }
  13101. if (this._canvas) {
  13102. canvasInRendering["delete"](this._canvas);
  13103. }
  13104. this.callback(error || new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex + 1), "canvas"));
  13105. }
  13106. }, {
  13107. key: "operatorListChanged",
  13108. value: function operatorListChanged() {
  13109. if (!this.graphicsReady) {
  13110. if (!this.graphicsReadyCallback) {
  13111. this.graphicsReadyCallback = this._continueBound;
  13112. }
  13113. return;
  13114. }
  13115. if (this.stepper) {
  13116. this.stepper.updateOperatorList(this.operatorList);
  13117. }
  13118. if (this.running) {
  13119. return;
  13120. }
  13121. this._continue();
  13122. }
  13123. }, {
  13124. key: "_continue",
  13125. value: function _continue() {
  13126. this.running = true;
  13127. if (this.cancelled) {
  13128. return;
  13129. }
  13130. if (this.task.onContinue) {
  13131. this.task.onContinue(this._scheduleNextBound);
  13132. } else {
  13133. this._scheduleNext();
  13134. }
  13135. }
  13136. }, {
  13137. key: "_scheduleNext",
  13138. value: function _scheduleNext() {
  13139. var _this18 = this;
  13140. if (this._useRequestAnimationFrame) {
  13141. window.requestAnimationFrame(function () {
  13142. _this18._nextBound()["catch"](_this18.cancel.bind(_this18));
  13143. });
  13144. } else {
  13145. Promise.resolve().then(this._nextBound)["catch"](this.cancel.bind(this));
  13146. }
  13147. }
  13148. }, {
  13149. key: "_next",
  13150. value: function () {
  13151. var _next2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  13152. return _regenerator["default"].wrap(function _callee2$(_context2) {
  13153. while (1) {
  13154. switch (_context2.prev = _context2.next) {
  13155. case 0:
  13156. if (!this.cancelled) {
  13157. _context2.next = 2;
  13158. break;
  13159. }
  13160. return _context2.abrupt("return");
  13161. case 2:
  13162. this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
  13163. if (this.operatorListIdx === this.operatorList.argsArray.length) {
  13164. this.running = false;
  13165. if (this.operatorList.lastChunk) {
  13166. this.gfx.endDrawing();
  13167. if (this._canvas) {
  13168. canvasInRendering["delete"](this._canvas);
  13169. }
  13170. this.callback();
  13171. }
  13172. }
  13173. case 4:
  13174. case "end":
  13175. return _context2.stop();
  13176. }
  13177. }
  13178. }, _callee2, this);
  13179. }));
  13180. function _next() {
  13181. return _next2.apply(this, arguments);
  13182. }
  13183. return _next;
  13184. }()
  13185. }]);
  13186. return InternalRenderTask;
  13187. }();
  13188. return InternalRenderTask;
  13189. }();
  13190. var version = '2.5.207';
  13191. exports.version = version;
  13192. var build = '0974d6052';
  13193. exports.build = build;
  13194. /***/ }),
  13195. /* 199 */
  13196. /***/ (function(module, exports, __w_pdfjs_require__) {
  13197. "use strict";
  13198. Object.defineProperty(exports, "__esModule", {
  13199. value: true
  13200. });
  13201. exports.FontLoader = exports.FontFaceObject = void 0;
  13202. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  13203. var _util = __w_pdfjs_require__(5);
  13204. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  13205. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  13206. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  13207. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13208. 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); }; }
  13209. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  13210. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  13211. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  13212. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  13213. 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); } }
  13214. 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); }); }; }
  13215. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  13216. 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); } }
  13217. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  13218. var BaseFontLoader = /*#__PURE__*/function () {
  13219. function BaseFontLoader(_ref) {
  13220. var docId = _ref.docId,
  13221. onUnsupportedFeature = _ref.onUnsupportedFeature;
  13222. _classCallCheck(this, BaseFontLoader);
  13223. if (this.constructor === BaseFontLoader) {
  13224. (0, _util.unreachable)("Cannot initialize BaseFontLoader.");
  13225. }
  13226. this.docId = docId;
  13227. this._onUnsupportedFeature = onUnsupportedFeature;
  13228. this.nativeFontFaces = [];
  13229. this.styleElement = null;
  13230. }
  13231. _createClass(BaseFontLoader, [{
  13232. key: "addNativeFontFace",
  13233. value: function addNativeFontFace(nativeFontFace) {
  13234. this.nativeFontFaces.push(nativeFontFace);
  13235. document.fonts.add(nativeFontFace);
  13236. }
  13237. }, {
  13238. key: "insertRule",
  13239. value: function insertRule(rule) {
  13240. var styleElement = this.styleElement;
  13241. if (!styleElement) {
  13242. styleElement = this.styleElement = document.createElement("style");
  13243. styleElement.id = "PDFJS_FONT_STYLE_TAG_".concat(this.docId);
  13244. document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement);
  13245. }
  13246. var styleSheet = styleElement.sheet;
  13247. styleSheet.insertRule(rule, styleSheet.cssRules.length);
  13248. }
  13249. }, {
  13250. key: "clear",
  13251. value: function clear() {
  13252. this.nativeFontFaces.forEach(function (nativeFontFace) {
  13253. document.fonts["delete"](nativeFontFace);
  13254. });
  13255. this.nativeFontFaces.length = 0;
  13256. if (this.styleElement) {
  13257. this.styleElement.remove();
  13258. this.styleElement = null;
  13259. }
  13260. }
  13261. }, {
  13262. key: "bind",
  13263. value: function () {
  13264. var _bind = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(font) {
  13265. var _this = this;
  13266. var nativeFontFace, rule;
  13267. return _regenerator["default"].wrap(function _callee$(_context) {
  13268. while (1) {
  13269. switch (_context.prev = _context.next) {
  13270. case 0:
  13271. if (!(font.attached || font.missingFile)) {
  13272. _context.next = 2;
  13273. break;
  13274. }
  13275. return _context.abrupt("return");
  13276. case 2:
  13277. font.attached = true;
  13278. if (!this.isFontLoadingAPISupported) {
  13279. _context.next = 19;
  13280. break;
  13281. }
  13282. nativeFontFace = font.createNativeFontFace();
  13283. if (!nativeFontFace) {
  13284. _context.next = 18;
  13285. break;
  13286. }
  13287. this.addNativeFontFace(nativeFontFace);
  13288. _context.prev = 7;
  13289. _context.next = 10;
  13290. return nativeFontFace.loaded;
  13291. case 10:
  13292. _context.next = 18;
  13293. break;
  13294. case 12:
  13295. _context.prev = 12;
  13296. _context.t0 = _context["catch"](7);
  13297. this._onUnsupportedFeature({
  13298. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadNative
  13299. });
  13300. (0, _util.warn)("Failed to load font '".concat(nativeFontFace.family, "': '").concat(_context.t0, "'."));
  13301. font.disableFontFace = true;
  13302. throw _context.t0;
  13303. case 18:
  13304. return _context.abrupt("return");
  13305. case 19:
  13306. rule = font.createFontFaceRule();
  13307. if (!rule) {
  13308. _context.next = 26;
  13309. break;
  13310. }
  13311. this.insertRule(rule);
  13312. if (!this.isSyncFontLoadingSupported) {
  13313. _context.next = 24;
  13314. break;
  13315. }
  13316. return _context.abrupt("return");
  13317. case 24:
  13318. _context.next = 26;
  13319. return new Promise(function (resolve) {
  13320. var request = _this._queueLoadingCallback(resolve);
  13321. _this._prepareFontLoadEvent([rule], [font], request);
  13322. });
  13323. case 26:
  13324. case "end":
  13325. return _context.stop();
  13326. }
  13327. }
  13328. }, _callee, this, [[7, 12]]);
  13329. }));
  13330. function bind(_x) {
  13331. return _bind.apply(this, arguments);
  13332. }
  13333. return bind;
  13334. }()
  13335. }, {
  13336. key: "_queueLoadingCallback",
  13337. value: function _queueLoadingCallback(callback) {
  13338. (0, _util.unreachable)("Abstract method `_queueLoadingCallback`.");
  13339. }
  13340. }, {
  13341. key: "_prepareFontLoadEvent",
  13342. value: function _prepareFontLoadEvent(rules, fontsToLoad, request) {
  13343. (0, _util.unreachable)("Abstract method `_prepareFontLoadEvent`.");
  13344. }
  13345. }, {
  13346. key: "isFontLoadingAPISupported",
  13347. get: function get() {
  13348. var supported = typeof document !== "undefined" && !!document.fonts;
  13349. return (0, _util.shadow)(this, "isFontLoadingAPISupported", supported);
  13350. }
  13351. }, {
  13352. key: "isSyncFontLoadingSupported",
  13353. get: function get() {
  13354. (0, _util.unreachable)("Abstract method `isSyncFontLoadingSupported`.");
  13355. }
  13356. }, {
  13357. key: "_loadTestFont",
  13358. get: function get() {
  13359. (0, _util.unreachable)("Abstract method `_loadTestFont`.");
  13360. }
  13361. }]);
  13362. return BaseFontLoader;
  13363. }();
  13364. var FontLoader;
  13365. exports.FontLoader = FontLoader;
  13366. {
  13367. exports.FontLoader = FontLoader = /*#__PURE__*/function (_BaseFontLoader) {
  13368. _inherits(GenericFontLoader, _BaseFontLoader);
  13369. var _super = _createSuper(GenericFontLoader);
  13370. function GenericFontLoader(docId) {
  13371. var _this2;
  13372. _classCallCheck(this, GenericFontLoader);
  13373. _this2 = _super.call(this, docId);
  13374. _this2.loadingContext = {
  13375. requests: [],
  13376. nextRequestId: 0
  13377. };
  13378. _this2.loadTestFontId = 0;
  13379. return _this2;
  13380. }
  13381. _createClass(GenericFontLoader, [{
  13382. key: "_queueLoadingCallback",
  13383. value: function _queueLoadingCallback(callback) {
  13384. function completeRequest() {
  13385. (0, _util.assert)(!request.done, "completeRequest() cannot be called twice.");
  13386. request.done = true;
  13387. while (context.requests.length > 0 && context.requests[0].done) {
  13388. var otherRequest = context.requests.shift();
  13389. setTimeout(otherRequest.callback, 0);
  13390. }
  13391. }
  13392. var context = this.loadingContext;
  13393. var request = {
  13394. id: "pdfjs-font-loading-".concat(context.nextRequestId++),
  13395. done: false,
  13396. complete: completeRequest,
  13397. callback: callback
  13398. };
  13399. context.requests.push(request);
  13400. return request;
  13401. }
  13402. }, {
  13403. key: "_prepareFontLoadEvent",
  13404. value: function _prepareFontLoadEvent(rules, fonts, request) {
  13405. function int32(data, offset) {
  13406. return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
  13407. }
  13408. function spliceString(s, offset, remove, insert) {
  13409. var chunk1 = s.substring(0, offset);
  13410. var chunk2 = s.substring(offset + remove);
  13411. return chunk1 + insert + chunk2;
  13412. }
  13413. var i, ii;
  13414. var canvas = document.createElement("canvas");
  13415. canvas.width = 1;
  13416. canvas.height = 1;
  13417. var ctx = canvas.getContext("2d");
  13418. var called = 0;
  13419. function isFontReady(name, callback) {
  13420. called++;
  13421. if (called > 30) {
  13422. (0, _util.warn)("Load test font never loaded.");
  13423. callback();
  13424. return;
  13425. }
  13426. ctx.font = "30px " + name;
  13427. ctx.fillText(".", 0, 20);
  13428. var imageData = ctx.getImageData(0, 0, 1, 1);
  13429. if (imageData.data[3] > 0) {
  13430. callback();
  13431. return;
  13432. }
  13433. setTimeout(isFontReady.bind(null, name, callback));
  13434. }
  13435. var loadTestFontId = "lt".concat(Date.now()).concat(this.loadTestFontId++);
  13436. var data = this._loadTestFont;
  13437. var COMMENT_OFFSET = 976;
  13438. data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
  13439. var CFF_CHECKSUM_OFFSET = 16;
  13440. var XXXX_VALUE = 0x58585858;
  13441. var checksum = int32(data, CFF_CHECKSUM_OFFSET);
  13442. for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
  13443. checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
  13444. }
  13445. if (i < loadTestFontId.length) {
  13446. checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0;
  13447. }
  13448. data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum));
  13449. var url = "url(data:font/opentype;base64,".concat(btoa(data), ");");
  13450. var rule = "@font-face {font-family:\"".concat(loadTestFontId, "\";src:").concat(url, "}");
  13451. this.insertRule(rule);
  13452. var names = [];
  13453. for (i = 0, ii = fonts.length; i < ii; i++) {
  13454. names.push(fonts[i].loadedName);
  13455. }
  13456. names.push(loadTestFontId);
  13457. var div = document.createElement("div");
  13458. div.style.visibility = "hidden";
  13459. div.style.width = div.style.height = "10px";
  13460. div.style.position = "absolute";
  13461. div.style.top = div.style.left = "0px";
  13462. for (i = 0, ii = names.length; i < ii; ++i) {
  13463. var span = document.createElement("span");
  13464. span.textContent = "Hi";
  13465. span.style.fontFamily = names[i];
  13466. div.appendChild(span);
  13467. }
  13468. document.body.appendChild(div);
  13469. isFontReady(loadTestFontId, function () {
  13470. document.body.removeChild(div);
  13471. request.complete();
  13472. });
  13473. }
  13474. }, {
  13475. key: "isSyncFontLoadingSupported",
  13476. get: function get() {
  13477. var supported = false;
  13478. if (typeof navigator === "undefined") {
  13479. supported = true;
  13480. } else {
  13481. var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
  13482. if (m && m[1] >= 14) {
  13483. supported = true;
  13484. }
  13485. }
  13486. return (0, _util.shadow)(this, "isSyncFontLoadingSupported", supported);
  13487. }
  13488. }, {
  13489. key: "_loadTestFont",
  13490. get: function get() {
  13491. var getLoadTestFont = function getLoadTestFont() {
  13492. 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==");
  13493. };
  13494. return (0, _util.shadow)(this, "_loadTestFont", getLoadTestFont());
  13495. }
  13496. }]);
  13497. return GenericFontLoader;
  13498. }(BaseFontLoader);
  13499. }
  13500. var FontFaceObject = /*#__PURE__*/function () {
  13501. function FontFaceObject(translatedData, _ref2) {
  13502. var _ref2$isEvalSupported = _ref2.isEvalSupported,
  13503. isEvalSupported = _ref2$isEvalSupported === void 0 ? true : _ref2$isEvalSupported,
  13504. _ref2$disableFontFace = _ref2.disableFontFace,
  13505. disableFontFace = _ref2$disableFontFace === void 0 ? false : _ref2$disableFontFace,
  13506. _ref2$ignoreErrors = _ref2.ignoreErrors,
  13507. ignoreErrors = _ref2$ignoreErrors === void 0 ? false : _ref2$ignoreErrors,
  13508. _ref2$onUnsupportedFe = _ref2.onUnsupportedFeature,
  13509. onUnsupportedFeature = _ref2$onUnsupportedFe === void 0 ? null : _ref2$onUnsupportedFe,
  13510. _ref2$fontRegistry = _ref2.fontRegistry,
  13511. fontRegistry = _ref2$fontRegistry === void 0 ? null : _ref2$fontRegistry;
  13512. _classCallCheck(this, FontFaceObject);
  13513. this.compiledGlyphs = Object.create(null);
  13514. for (var i in translatedData) {
  13515. this[i] = translatedData[i];
  13516. }
  13517. this.isEvalSupported = isEvalSupported !== false;
  13518. this.disableFontFace = disableFontFace === true;
  13519. this.ignoreErrors = ignoreErrors === true;
  13520. this._onUnsupportedFeature = onUnsupportedFeature;
  13521. this.fontRegistry = fontRegistry;
  13522. }
  13523. _createClass(FontFaceObject, [{
  13524. key: "createNativeFontFace",
  13525. value: function createNativeFontFace() {
  13526. if (!this.data || this.disableFontFace) {
  13527. return null;
  13528. }
  13529. var nativeFontFace = new FontFace(this.loadedName, this.data, {});
  13530. if (this.fontRegistry) {
  13531. this.fontRegistry.registerFont(this);
  13532. }
  13533. return nativeFontFace;
  13534. }
  13535. }, {
  13536. key: "createFontFaceRule",
  13537. value: function createFontFaceRule() {
  13538. if (!this.data || this.disableFontFace) {
  13539. return null;
  13540. }
  13541. var data = (0, _util.bytesToString)(new Uint8Array(this.data));
  13542. var url = "url(data:".concat(this.mimetype, ";base64,").concat(btoa(data), ");");
  13543. var rule = "@font-face {font-family:\"".concat(this.loadedName, "\";src:").concat(url, "}");
  13544. if (this.fontRegistry) {
  13545. this.fontRegistry.registerFont(this, url);
  13546. }
  13547. return rule;
  13548. }
  13549. }, {
  13550. key: "getPathGenerator",
  13551. value: function getPathGenerator(objs, character) {
  13552. if (this.compiledGlyphs[character] !== undefined) {
  13553. return this.compiledGlyphs[character];
  13554. }
  13555. var cmds, current;
  13556. try {
  13557. cmds = objs.get(this.loadedName + "_path_" + character);
  13558. } catch (ex) {
  13559. if (!this.ignoreErrors) {
  13560. throw ex;
  13561. }
  13562. if (this._onUnsupportedFeature) {
  13563. this._onUnsupportedFeature({
  13564. featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath
  13565. });
  13566. }
  13567. (0, _util.warn)("getPathGenerator - ignoring character: \"".concat(ex, "\"."));
  13568. return this.compiledGlyphs[character] = function (c, size) {};
  13569. }
  13570. if (this.isEvalSupported && _util.IsEvalSupportedCached.value) {
  13571. var args,
  13572. js = "";
  13573. for (var i = 0, ii = cmds.length; i < ii; i++) {
  13574. current = cmds[i];
  13575. if (current.args !== undefined) {
  13576. args = current.args.join(",");
  13577. } else {
  13578. args = "";
  13579. }
  13580. js += "c." + current.cmd + "(" + args + ");\n";
  13581. }
  13582. return this.compiledGlyphs[character] = new Function("c", "size", js);
  13583. }
  13584. return this.compiledGlyphs[character] = function (c, size) {
  13585. for (var _i = 0, _ii = cmds.length; _i < _ii; _i++) {
  13586. current = cmds[_i];
  13587. if (current.cmd === "scale") {
  13588. current.args = [size, -size];
  13589. }
  13590. c[current.cmd].apply(c, current.args);
  13591. }
  13592. };
  13593. }
  13594. }]);
  13595. return FontFaceObject;
  13596. }();
  13597. exports.FontFaceObject = FontFaceObject;
  13598. /***/ }),
  13599. /* 200 */
  13600. /***/ (function(module, exports, __w_pdfjs_require__) {
  13601. "use strict";
  13602. Object.defineProperty(exports, "__esModule", {
  13603. value: true
  13604. });
  13605. exports.apiCompatibilityParams = void 0;
  13606. var _is_node = __w_pdfjs_require__(7);
  13607. var compatibilityParams = Object.create(null);
  13608. {
  13609. (function checkFontFace() {
  13610. if (_is_node.isNodeJS) {
  13611. compatibilityParams.disableFontFace = true;
  13612. }
  13613. })();
  13614. }
  13615. var apiCompatibilityParams = Object.freeze(compatibilityParams);
  13616. exports.apiCompatibilityParams = apiCompatibilityParams;
  13617. /***/ }),
  13618. /* 201 */
  13619. /***/ (function(module, exports, __w_pdfjs_require__) {
  13620. "use strict";
  13621. Object.defineProperty(exports, "__esModule", {
  13622. value: true
  13623. });
  13624. exports.CanvasGraphics = void 0;
  13625. var _util = __w_pdfjs_require__(5);
  13626. var _pattern_helper = __w_pdfjs_require__(202);
  13627. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  13628. 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); }
  13629. 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; }
  13630. var MIN_FONT_SIZE = 16;
  13631. var MAX_FONT_SIZE = 100;
  13632. var MAX_GROUP_SIZE = 4096;
  13633. var MIN_WIDTH_FACTOR = 0.65;
  13634. var COMPILE_TYPE3_GLYPHS = true;
  13635. var MAX_SIZE_TO_COMPILE = 1000;
  13636. var FULL_CHUNK_HEIGHT = 16;
  13637. function addContextCurrentTransform(ctx) {
  13638. if (!ctx.mozCurrentTransform) {
  13639. ctx._originalSave = ctx.save;
  13640. ctx._originalRestore = ctx.restore;
  13641. ctx._originalRotate = ctx.rotate;
  13642. ctx._originalScale = ctx.scale;
  13643. ctx._originalTranslate = ctx.translate;
  13644. ctx._originalTransform = ctx.transform;
  13645. ctx._originalSetTransform = ctx.setTransform;
  13646. ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0];
  13647. ctx._transformStack = [];
  13648. Object.defineProperty(ctx, "mozCurrentTransform", {
  13649. get: function getCurrentTransform() {
  13650. return this._transformMatrix;
  13651. }
  13652. });
  13653. Object.defineProperty(ctx, "mozCurrentTransformInverse", {
  13654. get: function getCurrentTransformInverse() {
  13655. var m = this._transformMatrix;
  13656. var a = m[0],
  13657. b = m[1],
  13658. c = m[2],
  13659. d = m[3],
  13660. e = m[4],
  13661. f = m[5];
  13662. var ad_bc = a * d - b * c;
  13663. var bc_ad = b * c - a * d;
  13664. 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];
  13665. }
  13666. });
  13667. ctx.save = function ctxSave() {
  13668. var old = this._transformMatrix;
  13669. this._transformStack.push(old);
  13670. this._transformMatrix = old.slice(0, 6);
  13671. this._originalSave();
  13672. };
  13673. ctx.restore = function ctxRestore() {
  13674. var prev = this._transformStack.pop();
  13675. if (prev) {
  13676. this._transformMatrix = prev;
  13677. this._originalRestore();
  13678. }
  13679. };
  13680. ctx.translate = function ctxTranslate(x, y) {
  13681. var m = this._transformMatrix;
  13682. m[4] = m[0] * x + m[2] * y + m[4];
  13683. m[5] = m[1] * x + m[3] * y + m[5];
  13684. this._originalTranslate(x, y);
  13685. };
  13686. ctx.scale = function ctxScale(x, y) {
  13687. var m = this._transformMatrix;
  13688. m[0] = m[0] * x;
  13689. m[1] = m[1] * x;
  13690. m[2] = m[2] * y;
  13691. m[3] = m[3] * y;
  13692. this._originalScale(x, y);
  13693. };
  13694. ctx.transform = function ctxTransform(a, b, c, d, e, f) {
  13695. var m = this._transformMatrix;
  13696. 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]];
  13697. ctx._originalTransform(a, b, c, d, e, f);
  13698. };
  13699. ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
  13700. this._transformMatrix = [a, b, c, d, e, f];
  13701. ctx._originalSetTransform(a, b, c, d, e, f);
  13702. };
  13703. ctx.rotate = function ctxRotate(angle) {
  13704. var cosValue = Math.cos(angle);
  13705. var sinValue = Math.sin(angle);
  13706. var m = this._transformMatrix;
  13707. 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]];
  13708. this._originalRotate(angle);
  13709. };
  13710. }
  13711. }
  13712. var CachedCanvases = function CachedCanvasesClosure() {
  13713. function CachedCanvases(canvasFactory) {
  13714. this.canvasFactory = canvasFactory;
  13715. this.cache = Object.create(null);
  13716. }
  13717. CachedCanvases.prototype = {
  13718. getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) {
  13719. var canvasEntry;
  13720. if (this.cache[id] !== undefined) {
  13721. canvasEntry = this.cache[id];
  13722. this.canvasFactory.reset(canvasEntry, width, height);
  13723. canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);
  13724. } else {
  13725. canvasEntry = this.canvasFactory.create(width, height);
  13726. this.cache[id] = canvasEntry;
  13727. }
  13728. if (trackTransform) {
  13729. addContextCurrentTransform(canvasEntry.context);
  13730. }
  13731. return canvasEntry;
  13732. },
  13733. clear: function clear() {
  13734. for (var id in this.cache) {
  13735. var canvasEntry = this.cache[id];
  13736. this.canvasFactory.destroy(canvasEntry);
  13737. delete this.cache[id];
  13738. }
  13739. }
  13740. };
  13741. return CachedCanvases;
  13742. }();
  13743. function compileType3Glyph(imgData) {
  13744. var POINT_TO_PROCESS_LIMIT = 1000;
  13745. var width = imgData.width,
  13746. height = imgData.height;
  13747. var i,
  13748. j,
  13749. j0,
  13750. width1 = width + 1;
  13751. var points = new Uint8Array(width1 * (height + 1));
  13752. var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
  13753. var lineSize = width + 7 & ~7,
  13754. data0 = imgData.data;
  13755. var data = new Uint8Array(lineSize * height),
  13756. pos = 0,
  13757. ii;
  13758. for (i = 0, ii = data0.length; i < ii; i++) {
  13759. var mask = 128,
  13760. elem = data0[i];
  13761. while (mask > 0) {
  13762. data[pos++] = elem & mask ? 0 : 255;
  13763. mask >>= 1;
  13764. }
  13765. }
  13766. var count = 0;
  13767. pos = 0;
  13768. if (data[pos] !== 0) {
  13769. points[0] = 1;
  13770. ++count;
  13771. }
  13772. for (j = 1; j < width; j++) {
  13773. if (data[pos] !== data[pos + 1]) {
  13774. points[j] = data[pos] ? 2 : 1;
  13775. ++count;
  13776. }
  13777. pos++;
  13778. }
  13779. if (data[pos] !== 0) {
  13780. points[j] = 2;
  13781. ++count;
  13782. }
  13783. for (i = 1; i < height; i++) {
  13784. pos = i * lineSize;
  13785. j0 = i * width1;
  13786. if (data[pos - lineSize] !== data[pos]) {
  13787. points[j0] = data[pos] ? 1 : 8;
  13788. ++count;
  13789. }
  13790. var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
  13791. for (j = 1; j < width; j++) {
  13792. sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
  13793. if (POINT_TYPES[sum]) {
  13794. points[j0 + j] = POINT_TYPES[sum];
  13795. ++count;
  13796. }
  13797. pos++;
  13798. }
  13799. if (data[pos - lineSize] !== data[pos]) {
  13800. points[j0 + j] = data[pos] ? 2 : 4;
  13801. ++count;
  13802. }
  13803. if (count > POINT_TO_PROCESS_LIMIT) {
  13804. return null;
  13805. }
  13806. }
  13807. pos = lineSize * (height - 1);
  13808. j0 = i * width1;
  13809. if (data[pos] !== 0) {
  13810. points[j0] = 8;
  13811. ++count;
  13812. }
  13813. for (j = 1; j < width; j++) {
  13814. if (data[pos] !== data[pos + 1]) {
  13815. points[j0 + j] = data[pos] ? 4 : 8;
  13816. ++count;
  13817. }
  13818. pos++;
  13819. }
  13820. if (data[pos] !== 0) {
  13821. points[j0 + j] = 4;
  13822. ++count;
  13823. }
  13824. if (count > POINT_TO_PROCESS_LIMIT) {
  13825. return null;
  13826. }
  13827. var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
  13828. var outlines = [];
  13829. for (i = 0; count && i <= height; i++) {
  13830. var p = i * width1;
  13831. var end = p + width;
  13832. while (p < end && !points[p]) {
  13833. p++;
  13834. }
  13835. if (p === end) {
  13836. continue;
  13837. }
  13838. var coords = [p % width1, i];
  13839. var type = points[p],
  13840. p0 = p,
  13841. pp;
  13842. do {
  13843. var step = steps[type];
  13844. do {
  13845. p += step;
  13846. } while (!points[p]);
  13847. pp = points[p];
  13848. if (pp !== 5 && pp !== 10) {
  13849. type = pp;
  13850. points[p] = 0;
  13851. } else {
  13852. type = pp & 0x33 * type >> 4;
  13853. points[p] &= type >> 2 | type << 2;
  13854. }
  13855. coords.push(p % width1);
  13856. coords.push(p / width1 | 0);
  13857. if (!points[p]) {
  13858. --count;
  13859. }
  13860. } while (p0 !== p);
  13861. outlines.push(coords);
  13862. --i;
  13863. }
  13864. var drawOutline = function drawOutline(c) {
  13865. c.save();
  13866. c.scale(1 / width, -1 / height);
  13867. c.translate(0, -height);
  13868. c.beginPath();
  13869. for (var k = 0, kk = outlines.length; k < kk; k++) {
  13870. var o = outlines[k];
  13871. c.moveTo(o[0], o[1]);
  13872. for (var l = 2, ll = o.length; l < ll; l += 2) {
  13873. c.lineTo(o[l], o[l + 1]);
  13874. }
  13875. }
  13876. c.fill();
  13877. c.beginPath();
  13878. c.restore();
  13879. };
  13880. return drawOutline;
  13881. }
  13882. var CanvasExtraState = function CanvasExtraStateClosure() {
  13883. function CanvasExtraState() {
  13884. this.alphaIsShape = false;
  13885. this.fontSize = 0;
  13886. this.fontSizeScale = 1;
  13887. this.textMatrix = _util.IDENTITY_MATRIX;
  13888. this.textMatrixScale = 1;
  13889. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  13890. this.leading = 0;
  13891. this.x = 0;
  13892. this.y = 0;
  13893. this.lineX = 0;
  13894. this.lineY = 0;
  13895. this.charSpacing = 0;
  13896. this.wordSpacing = 0;
  13897. this.textHScale = 1;
  13898. this.textRenderingMode = _util.TextRenderingMode.FILL;
  13899. this.textRise = 0;
  13900. this.fillColor = "#000000";
  13901. this.strokeColor = "#000000";
  13902. this.patternFill = false;
  13903. this.fillAlpha = 1;
  13904. this.strokeAlpha = 1;
  13905. this.lineWidth = 1;
  13906. this.activeSMask = null;
  13907. this.resumeSMaskCtx = null;
  13908. }
  13909. CanvasExtraState.prototype = {
  13910. clone: function CanvasExtraState_clone() {
  13911. return Object.create(this);
  13912. },
  13913. setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) {
  13914. this.x = x;
  13915. this.y = y;
  13916. }
  13917. };
  13918. return CanvasExtraState;
  13919. }();
  13920. var CanvasGraphics = function CanvasGraphicsClosure() {
  13921. var EXECUTION_TIME = 15;
  13922. var EXECUTION_STEPS = 10;
  13923. function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) {
  13924. this.ctx = canvasCtx;
  13925. this.current = new CanvasExtraState();
  13926. this.stateStack = [];
  13927. this.pendingClip = null;
  13928. this.pendingEOFill = false;
  13929. this.res = null;
  13930. this.xobjs = null;
  13931. this.commonObjs = commonObjs;
  13932. this.objs = objs;
  13933. this.canvasFactory = canvasFactory;
  13934. this.webGLContext = webGLContext;
  13935. this.imageLayer = imageLayer;
  13936. this.groupStack = [];
  13937. this.processingType3 = null;
  13938. this.baseTransform = null;
  13939. this.baseTransformStack = [];
  13940. this.groupLevel = 0;
  13941. this.smaskStack = [];
  13942. this.smaskCounter = 0;
  13943. this.tempSMask = null;
  13944. this.cachedCanvases = new CachedCanvases(this.canvasFactory);
  13945. if (canvasCtx) {
  13946. addContextCurrentTransform(canvasCtx);
  13947. }
  13948. this._cachedGetSinglePixelWidth = null;
  13949. }
  13950. function putBinaryImageData(ctx, imgData) {
  13951. if (typeof ImageData !== "undefined" && imgData instanceof ImageData) {
  13952. ctx.putImageData(imgData, 0, 0);
  13953. return;
  13954. }
  13955. var height = imgData.height,
  13956. width = imgData.width;
  13957. var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
  13958. var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
  13959. var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
  13960. var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
  13961. var srcPos = 0,
  13962. destPos;
  13963. var src = imgData.data;
  13964. var dest = chunkImgData.data;
  13965. var i, j, thisChunkHeight, elemsInThisChunk;
  13966. if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) {
  13967. var srcLength = src.byteLength;
  13968. var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
  13969. var dest32DataLength = dest32.length;
  13970. var fullSrcDiff = width + 7 >> 3;
  13971. var white = 0xffffffff;
  13972. var black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff;
  13973. for (i = 0; i < totalChunks; i++) {
  13974. thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
  13975. destPos = 0;
  13976. for (j = 0; j < thisChunkHeight; j++) {
  13977. var srcDiff = srcLength - srcPos;
  13978. var k = 0;
  13979. var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;
  13980. var kEndUnrolled = kEnd & ~7;
  13981. var mask = 0;
  13982. var srcByte = 0;
  13983. for (; k < kEndUnrolled; k += 8) {
  13984. srcByte = src[srcPos++];
  13985. dest32[destPos++] = srcByte & 128 ? white : black;
  13986. dest32[destPos++] = srcByte & 64 ? white : black;
  13987. dest32[destPos++] = srcByte & 32 ? white : black;
  13988. dest32[destPos++] = srcByte & 16 ? white : black;
  13989. dest32[destPos++] = srcByte & 8 ? white : black;
  13990. dest32[destPos++] = srcByte & 4 ? white : black;
  13991. dest32[destPos++] = srcByte & 2 ? white : black;
  13992. dest32[destPos++] = srcByte & 1 ? white : black;
  13993. }
  13994. for (; k < kEnd; k++) {
  13995. if (mask === 0) {
  13996. srcByte = src[srcPos++];
  13997. mask = 128;
  13998. }
  13999. dest32[destPos++] = srcByte & mask ? white : black;
  14000. mask >>= 1;
  14001. }
  14002. }
  14003. while (destPos < dest32DataLength) {
  14004. dest32[destPos++] = 0;
  14005. }
  14006. ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  14007. }
  14008. } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) {
  14009. j = 0;
  14010. elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
  14011. for (i = 0; i < fullChunks; i++) {
  14012. dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
  14013. srcPos += elemsInThisChunk;
  14014. ctx.putImageData(chunkImgData, 0, j);
  14015. j += FULL_CHUNK_HEIGHT;
  14016. }
  14017. if (i < totalChunks) {
  14018. elemsInThisChunk = width * partialChunkHeight * 4;
  14019. dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
  14020. ctx.putImageData(chunkImgData, 0, j);
  14021. }
  14022. } else if (imgData.kind === _util.ImageKind.RGB_24BPP) {
  14023. thisChunkHeight = FULL_CHUNK_HEIGHT;
  14024. elemsInThisChunk = width * thisChunkHeight;
  14025. for (i = 0; i < totalChunks; i++) {
  14026. if (i >= fullChunks) {
  14027. thisChunkHeight = partialChunkHeight;
  14028. elemsInThisChunk = width * thisChunkHeight;
  14029. }
  14030. destPos = 0;
  14031. for (j = elemsInThisChunk; j--;) {
  14032. dest[destPos++] = src[srcPos++];
  14033. dest[destPos++] = src[srcPos++];
  14034. dest[destPos++] = src[srcPos++];
  14035. dest[destPos++] = 255;
  14036. }
  14037. ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  14038. }
  14039. } else {
  14040. throw new Error("bad image kind: ".concat(imgData.kind));
  14041. }
  14042. }
  14043. function putBinaryImageMask(ctx, imgData) {
  14044. var height = imgData.height,
  14045. width = imgData.width;
  14046. var partialChunkHeight = height % FULL_CHUNK_HEIGHT;
  14047. var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
  14048. var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
  14049. var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
  14050. var srcPos = 0;
  14051. var src = imgData.data;
  14052. var dest = chunkImgData.data;
  14053. for (var i = 0; i < totalChunks; i++) {
  14054. var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
  14055. var destPos = 3;
  14056. for (var j = 0; j < thisChunkHeight; j++) {
  14057. var mask = 0;
  14058. for (var k = 0; k < width; k++) {
  14059. if (!mask) {
  14060. var elem = src[srcPos++];
  14061. mask = 128;
  14062. }
  14063. dest[destPos] = elem & mask ? 0 : 255;
  14064. destPos += 4;
  14065. mask >>= 1;
  14066. }
  14067. }
  14068. ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
  14069. }
  14070. }
  14071. function copyCtxState(sourceCtx, destCtx) {
  14072. var properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"];
  14073. for (var i = 0, ii = properties.length; i < ii; i++) {
  14074. var property = properties[i];
  14075. if (sourceCtx[property] !== undefined) {
  14076. destCtx[property] = sourceCtx[property];
  14077. }
  14078. }
  14079. if (sourceCtx.setLineDash !== undefined) {
  14080. destCtx.setLineDash(sourceCtx.getLineDash());
  14081. destCtx.lineDashOffset = sourceCtx.lineDashOffset;
  14082. }
  14083. }
  14084. function resetCtxToDefault(ctx) {
  14085. ctx.strokeStyle = "#000000";
  14086. ctx.fillStyle = "#000000";
  14087. ctx.fillRule = "nonzero";
  14088. ctx.globalAlpha = 1;
  14089. ctx.lineWidth = 1;
  14090. ctx.lineCap = "butt";
  14091. ctx.lineJoin = "miter";
  14092. ctx.miterLimit = 10;
  14093. ctx.globalCompositeOperation = "source-over";
  14094. ctx.font = "10px sans-serif";
  14095. if (ctx.setLineDash !== undefined) {
  14096. ctx.setLineDash([]);
  14097. ctx.lineDashOffset = 0;
  14098. }
  14099. }
  14100. function composeSMaskBackdrop(bytes, r0, g0, b0) {
  14101. var length = bytes.length;
  14102. for (var i = 3; i < length; i += 4) {
  14103. var alpha = bytes[i];
  14104. if (alpha === 0) {
  14105. bytes[i - 3] = r0;
  14106. bytes[i - 2] = g0;
  14107. bytes[i - 1] = b0;
  14108. } else if (alpha < 255) {
  14109. var alpha_ = 255 - alpha;
  14110. bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8;
  14111. bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8;
  14112. bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8;
  14113. }
  14114. }
  14115. }
  14116. function composeSMaskAlpha(maskData, layerData, transferMap) {
  14117. var length = maskData.length;
  14118. var scale = 1 / 255;
  14119. for (var i = 3; i < length; i += 4) {
  14120. var alpha = transferMap ? transferMap[maskData[i]] : maskData[i];
  14121. layerData[i] = layerData[i] * alpha * scale | 0;
  14122. }
  14123. }
  14124. function composeSMaskLuminosity(maskData, layerData, transferMap) {
  14125. var length = maskData.length;
  14126. for (var i = 3; i < length; i += 4) {
  14127. var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28;
  14128. layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16;
  14129. }
  14130. }
  14131. function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) {
  14132. var hasBackdrop = !!backdrop;
  14133. var r0 = hasBackdrop ? backdrop[0] : 0;
  14134. var g0 = hasBackdrop ? backdrop[1] : 0;
  14135. var b0 = hasBackdrop ? backdrop[2] : 0;
  14136. var composeFn;
  14137. if (subtype === "Luminosity") {
  14138. composeFn = composeSMaskLuminosity;
  14139. } else {
  14140. composeFn = composeSMaskAlpha;
  14141. }
  14142. var PIXELS_TO_PROCESS = 1048576;
  14143. var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
  14144. for (var row = 0; row < height; row += chunkSize) {
  14145. var chunkHeight = Math.min(chunkSize, height - row);
  14146. var maskData = maskCtx.getImageData(0, row, width, chunkHeight);
  14147. var layerData = layerCtx.getImageData(0, row, width, chunkHeight);
  14148. if (hasBackdrop) {
  14149. composeSMaskBackdrop(maskData.data, r0, g0, b0);
  14150. }
  14151. composeFn(maskData.data, layerData.data, transferMap);
  14152. maskCtx.putImageData(layerData, 0, row);
  14153. }
  14154. }
  14155. function composeSMask(ctx, smask, layerCtx, webGLContext) {
  14156. var mask = smask.canvas;
  14157. var maskCtx = smask.context;
  14158. ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY);
  14159. var backdrop = smask.backdrop || null;
  14160. if (!smask.transferMap && webGLContext.isEnabled) {
  14161. var composed = webGLContext.composeSMask({
  14162. layer: layerCtx.canvas,
  14163. mask: mask,
  14164. properties: {
  14165. subtype: smask.subtype,
  14166. backdrop: backdrop
  14167. }
  14168. });
  14169. ctx.setTransform(1, 0, 0, 1, 0, 0);
  14170. ctx.drawImage(composed, smask.offsetX, smask.offsetY);
  14171. return;
  14172. }
  14173. genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap);
  14174. ctx.drawImage(mask, 0, 0);
  14175. }
  14176. var LINE_CAP_STYLES = ["butt", "round", "square"];
  14177. var LINE_JOIN_STYLES = ["miter", "round", "bevel"];
  14178. var NORMAL_CLIP = {};
  14179. var EO_CLIP = {};
  14180. CanvasGraphics.prototype = {
  14181. beginDrawing: function beginDrawing(_ref) {
  14182. var transform = _ref.transform,
  14183. viewport = _ref.viewport,
  14184. _ref$transparency = _ref.transparency,
  14185. transparency = _ref$transparency === void 0 ? false : _ref$transparency,
  14186. _ref$background = _ref.background,
  14187. background = _ref$background === void 0 ? null : _ref$background;
  14188. var width = this.ctx.canvas.width;
  14189. var height = this.ctx.canvas.height;
  14190. this.ctx.save();
  14191. this.ctx.fillStyle = background || "rgb(255, 255, 255)";
  14192. this.ctx.fillRect(0, 0, width, height);
  14193. this.ctx.restore();
  14194. if (transparency) {
  14195. var transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true);
  14196. this.compositeCtx = this.ctx;
  14197. this.transparentCanvas = transparentCanvas.canvas;
  14198. this.ctx = transparentCanvas.context;
  14199. this.ctx.save();
  14200. this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform);
  14201. }
  14202. this.ctx.save();
  14203. resetCtxToDefault(this.ctx);
  14204. if (transform) {
  14205. this.ctx.transform.apply(this.ctx, transform);
  14206. }
  14207. this.ctx.transform.apply(this.ctx, viewport.transform);
  14208. this.baseTransform = this.ctx.mozCurrentTransform.slice();
  14209. if (this.imageLayer) {
  14210. this.imageLayer.beginLayout();
  14211. }
  14212. },
  14213. executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
  14214. var argsArray = operatorList.argsArray;
  14215. var fnArray = operatorList.fnArray;
  14216. var i = executionStartIdx || 0;
  14217. var argsArrayLen = argsArray.length;
  14218. if (argsArrayLen === i) {
  14219. return i;
  14220. }
  14221. var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
  14222. var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
  14223. var steps = 0;
  14224. var commonObjs = this.commonObjs;
  14225. var objs = this.objs;
  14226. var fnId;
  14227. while (true) {
  14228. if (stepper !== undefined && i === stepper.nextBreakPoint) {
  14229. stepper.breakIt(i, continueCallback);
  14230. return i;
  14231. }
  14232. fnId = fnArray[i];
  14233. if (fnId !== _util.OPS.dependency) {
  14234. this[fnId].apply(this, argsArray[i]);
  14235. } else {
  14236. var _iterator = _createForOfIteratorHelper(argsArray[i]),
  14237. _step;
  14238. try {
  14239. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  14240. var depObjId = _step.value;
  14241. var objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
  14242. if (!objsPool.has(depObjId)) {
  14243. objsPool.get(depObjId, continueCallback);
  14244. return i;
  14245. }
  14246. }
  14247. } catch (err) {
  14248. _iterator.e(err);
  14249. } finally {
  14250. _iterator.f();
  14251. }
  14252. }
  14253. i++;
  14254. if (i === argsArrayLen) {
  14255. return i;
  14256. }
  14257. if (chunkOperations && ++steps > EXECUTION_STEPS) {
  14258. if (Date.now() > endTime) {
  14259. continueCallback();
  14260. return i;
  14261. }
  14262. steps = 0;
  14263. }
  14264. }
  14265. },
  14266. endDrawing: function CanvasGraphics_endDrawing() {
  14267. if (this.current.activeSMask !== null) {
  14268. this.endSMaskGroup();
  14269. }
  14270. this.ctx.restore();
  14271. if (this.transparentCanvas) {
  14272. this.ctx = this.compositeCtx;
  14273. this.ctx.save();
  14274. this.ctx.setTransform(1, 0, 0, 1, 0, 0);
  14275. this.ctx.drawImage(this.transparentCanvas, 0, 0);
  14276. this.ctx.restore();
  14277. this.transparentCanvas = null;
  14278. }
  14279. this.cachedCanvases.clear();
  14280. this.webGLContext.clear();
  14281. if (this.imageLayer) {
  14282. this.imageLayer.endLayout();
  14283. }
  14284. },
  14285. setLineWidth: function CanvasGraphics_setLineWidth(width) {
  14286. this.current.lineWidth = width;
  14287. this.ctx.lineWidth = width;
  14288. },
  14289. setLineCap: function CanvasGraphics_setLineCap(style) {
  14290. this.ctx.lineCap = LINE_CAP_STYLES[style];
  14291. },
  14292. setLineJoin: function CanvasGraphics_setLineJoin(style) {
  14293. this.ctx.lineJoin = LINE_JOIN_STYLES[style];
  14294. },
  14295. setMiterLimit: function CanvasGraphics_setMiterLimit(limit) {
  14296. this.ctx.miterLimit = limit;
  14297. },
  14298. setDash: function CanvasGraphics_setDash(dashArray, dashPhase) {
  14299. var ctx = this.ctx;
  14300. if (ctx.setLineDash !== undefined) {
  14301. ctx.setLineDash(dashArray);
  14302. ctx.lineDashOffset = dashPhase;
  14303. }
  14304. },
  14305. setRenderingIntent: function setRenderingIntent(intent) {},
  14306. setFlatness: function setFlatness(flatness) {},
  14307. setGState: function CanvasGraphics_setGState(states) {
  14308. for (var i = 0, ii = states.length; i < ii; i++) {
  14309. var state = states[i];
  14310. var key = state[0];
  14311. var value = state[1];
  14312. switch (key) {
  14313. case "LW":
  14314. this.setLineWidth(value);
  14315. break;
  14316. case "LC":
  14317. this.setLineCap(value);
  14318. break;
  14319. case "LJ":
  14320. this.setLineJoin(value);
  14321. break;
  14322. case "ML":
  14323. this.setMiterLimit(value);
  14324. break;
  14325. case "D":
  14326. this.setDash(value[0], value[1]);
  14327. break;
  14328. case "RI":
  14329. this.setRenderingIntent(value);
  14330. break;
  14331. case "FL":
  14332. this.setFlatness(value);
  14333. break;
  14334. case "Font":
  14335. this.setFont(value[0], value[1]);
  14336. break;
  14337. case "CA":
  14338. this.current.strokeAlpha = state[1];
  14339. break;
  14340. case "ca":
  14341. this.current.fillAlpha = state[1];
  14342. this.ctx.globalAlpha = state[1];
  14343. break;
  14344. case "BM":
  14345. this.ctx.globalCompositeOperation = value;
  14346. break;
  14347. case "SMask":
  14348. if (this.current.activeSMask) {
  14349. if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) {
  14350. this.suspendSMaskGroup();
  14351. } else {
  14352. this.endSMaskGroup();
  14353. }
  14354. }
  14355. this.current.activeSMask = value ? this.tempSMask : null;
  14356. if (this.current.activeSMask) {
  14357. this.beginSMaskGroup();
  14358. }
  14359. this.tempSMask = null;
  14360. break;
  14361. }
  14362. }
  14363. },
  14364. beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() {
  14365. var activeSMask = this.current.activeSMask;
  14366. var drawnWidth = activeSMask.canvas.width;
  14367. var drawnHeight = activeSMask.canvas.height;
  14368. var cacheId = "smaskGroupAt" + this.groupLevel;
  14369. var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
  14370. var currentCtx = this.ctx;
  14371. var currentTransform = currentCtx.mozCurrentTransform;
  14372. this.ctx.save();
  14373. var groupCtx = scratchCanvas.context;
  14374. groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY);
  14375. groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY);
  14376. groupCtx.transform.apply(groupCtx, currentTransform);
  14377. activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse;
  14378. copyCtxState(currentCtx, groupCtx);
  14379. this.ctx = groupCtx;
  14380. this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
  14381. this.groupStack.push(currentCtx);
  14382. this.groupLevel++;
  14383. },
  14384. suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() {
  14385. var groupCtx = this.ctx;
  14386. this.groupLevel--;
  14387. this.ctx = this.groupStack.pop();
  14388. composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext);
  14389. this.ctx.restore();
  14390. this.ctx.save();
  14391. copyCtxState(groupCtx, this.ctx);
  14392. this.current.resumeSMaskCtx = groupCtx;
  14393. var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform);
  14394. this.ctx.transform.apply(this.ctx, deltaTransform);
  14395. groupCtx.save();
  14396. groupCtx.setTransform(1, 0, 0, 1, 0, 0);
  14397. groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
  14398. groupCtx.restore();
  14399. },
  14400. resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() {
  14401. var groupCtx = this.current.resumeSMaskCtx;
  14402. var currentCtx = this.ctx;
  14403. this.ctx = groupCtx;
  14404. this.groupStack.push(currentCtx);
  14405. this.groupLevel++;
  14406. },
  14407. endSMaskGroup: function CanvasGraphics_endSMaskGroup() {
  14408. var groupCtx = this.ctx;
  14409. this.groupLevel--;
  14410. this.ctx = this.groupStack.pop();
  14411. composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext);
  14412. this.ctx.restore();
  14413. copyCtxState(groupCtx, this.ctx);
  14414. var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform);
  14415. this.ctx.transform.apply(this.ctx, deltaTransform);
  14416. },
  14417. save: function CanvasGraphics_save() {
  14418. this.ctx.save();
  14419. var old = this.current;
  14420. this.stateStack.push(old);
  14421. this.current = old.clone();
  14422. this.current.resumeSMaskCtx = null;
  14423. },
  14424. restore: function CanvasGraphics_restore() {
  14425. if (this.current.resumeSMaskCtx) {
  14426. this.resumeSMaskGroup();
  14427. }
  14428. if (this.current.activeSMask !== null && (this.stateStack.length === 0 || this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) {
  14429. this.endSMaskGroup();
  14430. }
  14431. if (this.stateStack.length !== 0) {
  14432. this.current = this.stateStack.pop();
  14433. this.ctx.restore();
  14434. this.pendingClip = null;
  14435. this._cachedGetSinglePixelWidth = null;
  14436. }
  14437. },
  14438. transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
  14439. this.ctx.transform(a, b, c, d, e, f);
  14440. this._cachedGetSinglePixelWidth = null;
  14441. },
  14442. constructPath: function CanvasGraphics_constructPath(ops, args) {
  14443. var ctx = this.ctx;
  14444. var current = this.current;
  14445. var x = current.x,
  14446. y = current.y;
  14447. for (var i = 0, j = 0, ii = ops.length; i < ii; i++) {
  14448. switch (ops[i] | 0) {
  14449. case _util.OPS.rectangle:
  14450. x = args[j++];
  14451. y = args[j++];
  14452. var width = args[j++];
  14453. var height = args[j++];
  14454. if (width === 0) {
  14455. width = this.getSinglePixelWidth();
  14456. }
  14457. if (height === 0) {
  14458. height = this.getSinglePixelWidth();
  14459. }
  14460. var xw = x + width;
  14461. var yh = y + height;
  14462. this.ctx.moveTo(x, y);
  14463. this.ctx.lineTo(xw, y);
  14464. this.ctx.lineTo(xw, yh);
  14465. this.ctx.lineTo(x, yh);
  14466. this.ctx.lineTo(x, y);
  14467. this.ctx.closePath();
  14468. break;
  14469. case _util.OPS.moveTo:
  14470. x = args[j++];
  14471. y = args[j++];
  14472. ctx.moveTo(x, y);
  14473. break;
  14474. case _util.OPS.lineTo:
  14475. x = args[j++];
  14476. y = args[j++];
  14477. ctx.lineTo(x, y);
  14478. break;
  14479. case _util.OPS.curveTo:
  14480. x = args[j + 4];
  14481. y = args[j + 5];
  14482. ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
  14483. j += 6;
  14484. break;
  14485. case _util.OPS.curveTo2:
  14486. ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
  14487. x = args[j + 2];
  14488. y = args[j + 3];
  14489. j += 4;
  14490. break;
  14491. case _util.OPS.curveTo3:
  14492. x = args[j + 2];
  14493. y = args[j + 3];
  14494. ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
  14495. j += 4;
  14496. break;
  14497. case _util.OPS.closePath:
  14498. ctx.closePath();
  14499. break;
  14500. }
  14501. }
  14502. current.setCurrentPoint(x, y);
  14503. },
  14504. closePath: function CanvasGraphics_closePath() {
  14505. this.ctx.closePath();
  14506. },
  14507. stroke: function CanvasGraphics_stroke(consumePath) {
  14508. consumePath = typeof consumePath !== "undefined" ? consumePath : true;
  14509. var ctx = this.ctx;
  14510. var strokeColor = this.current.strokeColor;
  14511. ctx.globalAlpha = this.current.strokeAlpha;
  14512. if (strokeColor && strokeColor.hasOwnProperty("type") && strokeColor.type === "Pattern") {
  14513. ctx.save();
  14514. var transform = ctx.mozCurrentTransform;
  14515. var scale = _util.Util.singularValueDecompose2dScale(transform)[0];
  14516. ctx.strokeStyle = strokeColor.getPattern(ctx, this);
  14517. ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth * scale);
  14518. ctx.stroke();
  14519. ctx.restore();
  14520. } else {
  14521. ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth);
  14522. ctx.stroke();
  14523. }
  14524. if (consumePath) {
  14525. this.consumePath();
  14526. }
  14527. ctx.globalAlpha = this.current.fillAlpha;
  14528. },
  14529. closeStroke: function CanvasGraphics_closeStroke() {
  14530. this.closePath();
  14531. this.stroke();
  14532. },
  14533. fill: function CanvasGraphics_fill(consumePath) {
  14534. consumePath = typeof consumePath !== "undefined" ? consumePath : true;
  14535. var ctx = this.ctx;
  14536. var fillColor = this.current.fillColor;
  14537. var isPatternFill = this.current.patternFill;
  14538. var needRestore = false;
  14539. if (isPatternFill) {
  14540. ctx.save();
  14541. if (this.baseTransform) {
  14542. ctx.setTransform.apply(ctx, this.baseTransform);
  14543. }
  14544. ctx.fillStyle = fillColor.getPattern(ctx, this);
  14545. needRestore = true;
  14546. }
  14547. if (this.pendingEOFill) {
  14548. ctx.fill("evenodd");
  14549. this.pendingEOFill = false;
  14550. } else {
  14551. ctx.fill();
  14552. }
  14553. if (needRestore) {
  14554. ctx.restore();
  14555. }
  14556. if (consumePath) {
  14557. this.consumePath();
  14558. }
  14559. },
  14560. eoFill: function CanvasGraphics_eoFill() {
  14561. this.pendingEOFill = true;
  14562. this.fill();
  14563. },
  14564. fillStroke: function CanvasGraphics_fillStroke() {
  14565. this.fill(false);
  14566. this.stroke(false);
  14567. this.consumePath();
  14568. },
  14569. eoFillStroke: function CanvasGraphics_eoFillStroke() {
  14570. this.pendingEOFill = true;
  14571. this.fillStroke();
  14572. },
  14573. closeFillStroke: function CanvasGraphics_closeFillStroke() {
  14574. this.closePath();
  14575. this.fillStroke();
  14576. },
  14577. closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() {
  14578. this.pendingEOFill = true;
  14579. this.closePath();
  14580. this.fillStroke();
  14581. },
  14582. endPath: function CanvasGraphics_endPath() {
  14583. this.consumePath();
  14584. },
  14585. clip: function CanvasGraphics_clip() {
  14586. this.pendingClip = NORMAL_CLIP;
  14587. },
  14588. eoClip: function CanvasGraphics_eoClip() {
  14589. this.pendingClip = EO_CLIP;
  14590. },
  14591. beginText: function CanvasGraphics_beginText() {
  14592. this.current.textMatrix = _util.IDENTITY_MATRIX;
  14593. this.current.textMatrixScale = 1;
  14594. this.current.x = this.current.lineX = 0;
  14595. this.current.y = this.current.lineY = 0;
  14596. },
  14597. endText: function CanvasGraphics_endText() {
  14598. var paths = this.pendingTextPaths;
  14599. var ctx = this.ctx;
  14600. if (paths === undefined) {
  14601. ctx.beginPath();
  14602. return;
  14603. }
  14604. ctx.save();
  14605. ctx.beginPath();
  14606. for (var i = 0; i < paths.length; i++) {
  14607. var path = paths[i];
  14608. ctx.setTransform.apply(ctx, path.transform);
  14609. ctx.translate(path.x, path.y);
  14610. path.addToPath(ctx, path.fontSize);
  14611. }
  14612. ctx.restore();
  14613. ctx.clip();
  14614. ctx.beginPath();
  14615. delete this.pendingTextPaths;
  14616. },
  14617. setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) {
  14618. this.current.charSpacing = spacing;
  14619. },
  14620. setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) {
  14621. this.current.wordSpacing = spacing;
  14622. },
  14623. setHScale: function CanvasGraphics_setHScale(scale) {
  14624. this.current.textHScale = scale / 100;
  14625. },
  14626. setLeading: function CanvasGraphics_setLeading(leading) {
  14627. this.current.leading = -leading;
  14628. },
  14629. setFont: function CanvasGraphics_setFont(fontRefName, size) {
  14630. var fontObj = this.commonObjs.get(fontRefName);
  14631. var current = this.current;
  14632. if (!fontObj) {
  14633. throw new Error("Can't find font for ".concat(fontRefName));
  14634. }
  14635. current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX;
  14636. if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
  14637. (0, _util.warn)("Invalid font matrix for font " + fontRefName);
  14638. }
  14639. if (size < 0) {
  14640. size = -size;
  14641. current.fontDirection = -1;
  14642. } else {
  14643. current.fontDirection = 1;
  14644. }
  14645. this.current.font = fontObj;
  14646. this.current.fontSize = size;
  14647. if (fontObj.isType3Font) {
  14648. return;
  14649. }
  14650. var name = fontObj.loadedName || "sans-serif";
  14651. var bold = "normal";
  14652. if (fontObj.black) {
  14653. bold = "900";
  14654. } else if (fontObj.bold) {
  14655. bold = "bold";
  14656. }
  14657. var italic = fontObj.italic ? "italic" : "normal";
  14658. var typeface = "\"".concat(name, "\", ").concat(fontObj.fallbackName);
  14659. var browserFontSize = size;
  14660. if (size < MIN_FONT_SIZE) {
  14661. browserFontSize = MIN_FONT_SIZE;
  14662. } else if (size > MAX_FONT_SIZE) {
  14663. browserFontSize = MAX_FONT_SIZE;
  14664. }
  14665. this.current.fontSizeScale = size / browserFontSize;
  14666. this.ctx.font = "".concat(italic, " ").concat(bold, " ").concat(browserFontSize, "px ").concat(typeface);
  14667. },
  14668. setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {
  14669. this.current.textRenderingMode = mode;
  14670. },
  14671. setTextRise: function CanvasGraphics_setTextRise(rise) {
  14672. this.current.textRise = rise;
  14673. },
  14674. moveText: function CanvasGraphics_moveText(x, y) {
  14675. this.current.x = this.current.lineX += x;
  14676. this.current.y = this.current.lineY += y;
  14677. },
  14678. setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) {
  14679. this.setLeading(-y);
  14680. this.moveText(x, y);
  14681. },
  14682. setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) {
  14683. this.current.textMatrix = [a, b, c, d, e, f];
  14684. this.current.textMatrixScale = Math.sqrt(a * a + b * b);
  14685. this.current.x = this.current.lineX = 0;
  14686. this.current.y = this.current.lineY = 0;
  14687. },
  14688. nextLine: function CanvasGraphics_nextLine() {
  14689. this.moveText(0, this.current.leading);
  14690. },
  14691. paintChar: function paintChar(character, x, y, patternTransform) {
  14692. var ctx = this.ctx;
  14693. var current = this.current;
  14694. var font = current.font;
  14695. var textRenderingMode = current.textRenderingMode;
  14696. var fontSize = current.fontSize / current.fontSizeScale;
  14697. var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
  14698. var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  14699. var patternFill = current.patternFill && !font.missingFile;
  14700. var addToPath;
  14701. if (font.disableFontFace || isAddToPathSet || patternFill) {
  14702. addToPath = font.getPathGenerator(this.commonObjs, character);
  14703. }
  14704. if (font.disableFontFace || patternFill) {
  14705. ctx.save();
  14706. ctx.translate(x, y);
  14707. ctx.beginPath();
  14708. addToPath(ctx, fontSize);
  14709. if (patternTransform) {
  14710. ctx.setTransform.apply(ctx, patternTransform);
  14711. }
  14712. if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  14713. ctx.fill();
  14714. }
  14715. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  14716. ctx.stroke();
  14717. }
  14718. ctx.restore();
  14719. } else {
  14720. if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  14721. ctx.fillText(character, x, y);
  14722. }
  14723. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  14724. ctx.strokeText(character, x, y);
  14725. }
  14726. }
  14727. if (isAddToPathSet) {
  14728. var paths = this.pendingTextPaths || (this.pendingTextPaths = []);
  14729. paths.push({
  14730. transform: ctx.mozCurrentTransform,
  14731. x: x,
  14732. y: y,
  14733. fontSize: fontSize,
  14734. addToPath: addToPath
  14735. });
  14736. }
  14737. },
  14738. get isFontSubpixelAAEnabled() {
  14739. var _this$cachedCanvases$ = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10),
  14740. ctx = _this$cachedCanvases$.context;
  14741. ctx.scale(1.5, 1);
  14742. ctx.fillText("I", 0, 10);
  14743. var data = ctx.getImageData(0, 0, 10, 10).data;
  14744. var enabled = false;
  14745. for (var i = 3; i < data.length; i += 4) {
  14746. if (data[i] > 0 && data[i] < 255) {
  14747. enabled = true;
  14748. break;
  14749. }
  14750. }
  14751. return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled);
  14752. },
  14753. showText: function CanvasGraphics_showText(glyphs) {
  14754. var current = this.current;
  14755. var font = current.font;
  14756. if (font.isType3Font) {
  14757. return this.showType3Text(glyphs);
  14758. }
  14759. var fontSize = current.fontSize;
  14760. if (fontSize === 0) {
  14761. return undefined;
  14762. }
  14763. var ctx = this.ctx;
  14764. var fontSizeScale = current.fontSizeScale;
  14765. var charSpacing = current.charSpacing;
  14766. var wordSpacing = current.wordSpacing;
  14767. var fontDirection = current.fontDirection;
  14768. var textHScale = current.textHScale * fontDirection;
  14769. var glyphsLength = glyphs.length;
  14770. var vertical = font.vertical;
  14771. var spacingDir = vertical ? 1 : -1;
  14772. var defaultVMetrics = font.defaultVMetrics;
  14773. var widthAdvanceScale = fontSize * current.fontMatrix[0];
  14774. var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
  14775. ctx.save();
  14776. var patternTransform;
  14777. if (current.patternFill) {
  14778. ctx.save();
  14779. var pattern = current.fillColor.getPattern(ctx, this);
  14780. patternTransform = ctx.mozCurrentTransform;
  14781. ctx.restore();
  14782. ctx.fillStyle = pattern;
  14783. }
  14784. ctx.transform.apply(ctx, current.textMatrix);
  14785. ctx.translate(current.x, current.y + current.textRise);
  14786. if (fontDirection > 0) {
  14787. ctx.scale(textHScale, -1);
  14788. } else {
  14789. ctx.scale(textHScale, 1);
  14790. }
  14791. var lineWidth = current.lineWidth;
  14792. var scale = current.textMatrixScale;
  14793. if (scale === 0 || lineWidth === 0) {
  14794. var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
  14795. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  14796. this._cachedGetSinglePixelWidth = null;
  14797. lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR;
  14798. }
  14799. } else {
  14800. lineWidth /= scale;
  14801. }
  14802. if (fontSizeScale !== 1.0) {
  14803. ctx.scale(fontSizeScale, fontSizeScale);
  14804. lineWidth /= fontSizeScale;
  14805. }
  14806. ctx.lineWidth = lineWidth;
  14807. var x = 0,
  14808. i;
  14809. for (i = 0; i < glyphsLength; ++i) {
  14810. var glyph = glyphs[i];
  14811. if ((0, _util.isNum)(glyph)) {
  14812. x += spacingDir * glyph * fontSize / 1000;
  14813. continue;
  14814. }
  14815. var restoreNeeded = false;
  14816. var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
  14817. var character = glyph.fontChar;
  14818. var accent = glyph.accent;
  14819. var scaledX, scaledY, scaledAccentX, scaledAccentY;
  14820. var width = glyph.width;
  14821. if (vertical) {
  14822. var vmetric, vx, vy;
  14823. vmetric = glyph.vmetric || defaultVMetrics;
  14824. vx = glyph.vmetric ? vmetric[1] : width * 0.5;
  14825. vx = -vx * widthAdvanceScale;
  14826. vy = vmetric[2] * widthAdvanceScale;
  14827. width = vmetric ? -vmetric[0] : width;
  14828. scaledX = vx / fontSizeScale;
  14829. scaledY = (x + vy) / fontSizeScale;
  14830. } else {
  14831. scaledX = x / fontSizeScale;
  14832. scaledY = 0;
  14833. }
  14834. if (font.remeasure && width > 0) {
  14835. var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;
  14836. if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
  14837. var characterScaleX = width / measuredWidth;
  14838. restoreNeeded = true;
  14839. ctx.save();
  14840. ctx.scale(characterScaleX, 1);
  14841. scaledX /= characterScaleX;
  14842. } else if (width !== measuredWidth) {
  14843. scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;
  14844. }
  14845. }
  14846. if (glyph.isInFont || font.missingFile) {
  14847. if (simpleFillText && !accent) {
  14848. ctx.fillText(character, scaledX, scaledY);
  14849. } else {
  14850. this.paintChar(character, scaledX, scaledY, patternTransform);
  14851. if (accent) {
  14852. scaledAccentX = scaledX + accent.offset.x / fontSizeScale;
  14853. scaledAccentY = scaledY - accent.offset.y / fontSizeScale;
  14854. this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform);
  14855. }
  14856. }
  14857. }
  14858. var charWidth;
  14859. if (vertical) {
  14860. charWidth = width * widthAdvanceScale - spacing * fontDirection;
  14861. } else {
  14862. charWidth = width * widthAdvanceScale + spacing * fontDirection;
  14863. }
  14864. x += charWidth;
  14865. if (restoreNeeded) {
  14866. ctx.restore();
  14867. }
  14868. }
  14869. if (vertical) {
  14870. current.y -= x;
  14871. } else {
  14872. current.x += x * textHScale;
  14873. }
  14874. ctx.restore();
  14875. },
  14876. showType3Text: function CanvasGraphics_showType3Text(glyphs) {
  14877. var ctx = this.ctx;
  14878. var current = this.current;
  14879. var font = current.font;
  14880. var fontSize = current.fontSize;
  14881. var fontDirection = current.fontDirection;
  14882. var spacingDir = font.vertical ? 1 : -1;
  14883. var charSpacing = current.charSpacing;
  14884. var wordSpacing = current.wordSpacing;
  14885. var textHScale = current.textHScale * fontDirection;
  14886. var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  14887. var glyphsLength = glyphs.length;
  14888. var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE;
  14889. var i, glyph, width, spacingLength;
  14890. if (isTextInvisible || fontSize === 0) {
  14891. return;
  14892. }
  14893. this._cachedGetSinglePixelWidth = null;
  14894. ctx.save();
  14895. ctx.transform.apply(ctx, current.textMatrix);
  14896. ctx.translate(current.x, current.y);
  14897. ctx.scale(textHScale, fontDirection);
  14898. for (i = 0; i < glyphsLength; ++i) {
  14899. glyph = glyphs[i];
  14900. if ((0, _util.isNum)(glyph)) {
  14901. spacingLength = spacingDir * glyph * fontSize / 1000;
  14902. this.ctx.translate(spacingLength, 0);
  14903. current.x += spacingLength * textHScale;
  14904. continue;
  14905. }
  14906. var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
  14907. var operatorList = font.charProcOperatorList[glyph.operatorListId];
  14908. if (!operatorList) {
  14909. (0, _util.warn)("Type3 character \"".concat(glyph.operatorListId, "\" is not available."));
  14910. continue;
  14911. }
  14912. this.processingType3 = glyph;
  14913. this.save();
  14914. ctx.scale(fontSize, fontSize);
  14915. ctx.transform.apply(ctx, fontMatrix);
  14916. this.executeOperatorList(operatorList);
  14917. this.restore();
  14918. var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix);
  14919. width = transformed[0] * fontSize + spacing;
  14920. ctx.translate(width, 0);
  14921. current.x += width * textHScale;
  14922. }
  14923. ctx.restore();
  14924. this.processingType3 = null;
  14925. },
  14926. setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {},
  14927. setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
  14928. this.ctx.rect(llx, lly, urx - llx, ury - lly);
  14929. this.clip();
  14930. this.endPath();
  14931. },
  14932. getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) {
  14933. var _this = this;
  14934. var pattern;
  14935. if (IR[0] === "TilingPattern") {
  14936. var color = IR[1];
  14937. var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice();
  14938. var canvasGraphicsFactory = {
  14939. createCanvasGraphics: function createCanvasGraphics(ctx) {
  14940. return new CanvasGraphics(ctx, _this.commonObjs, _this.objs, _this.canvasFactory, _this.webGLContext);
  14941. }
  14942. };
  14943. pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
  14944. } else {
  14945. pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR);
  14946. }
  14947. return pattern;
  14948. },
  14949. setStrokeColorN: function CanvasGraphics_setStrokeColorN() {
  14950. this.current.strokeColor = this.getColorN_Pattern(arguments);
  14951. },
  14952. setFillColorN: function CanvasGraphics_setFillColorN() {
  14953. this.current.fillColor = this.getColorN_Pattern(arguments);
  14954. this.current.patternFill = true;
  14955. },
  14956. setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) {
  14957. var color = _util.Util.makeCssRgb(r, g, b);
  14958. this.ctx.strokeStyle = color;
  14959. this.current.strokeColor = color;
  14960. },
  14961. setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) {
  14962. var color = _util.Util.makeCssRgb(r, g, b);
  14963. this.ctx.fillStyle = color;
  14964. this.current.fillColor = color;
  14965. this.current.patternFill = false;
  14966. },
  14967. shadingFill: function CanvasGraphics_shadingFill(patternIR) {
  14968. var ctx = this.ctx;
  14969. this.save();
  14970. var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR);
  14971. ctx.fillStyle = pattern.getPattern(ctx, this, true);
  14972. var inv = ctx.mozCurrentTransformInverse;
  14973. if (inv) {
  14974. var canvas = ctx.canvas;
  14975. var width = canvas.width;
  14976. var height = canvas.height;
  14977. var bl = _util.Util.applyTransform([0, 0], inv);
  14978. var br = _util.Util.applyTransform([0, height], inv);
  14979. var ul = _util.Util.applyTransform([width, 0], inv);
  14980. var ur = _util.Util.applyTransform([width, height], inv);
  14981. var x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
  14982. var y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
  14983. var x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
  14984. var y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
  14985. this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
  14986. } else {
  14987. this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
  14988. }
  14989. this.restore();
  14990. },
  14991. beginInlineImage: function CanvasGraphics_beginInlineImage() {
  14992. (0, _util.unreachable)("Should not call beginInlineImage");
  14993. },
  14994. beginImageData: function CanvasGraphics_beginImageData() {
  14995. (0, _util.unreachable)("Should not call beginImageData");
  14996. },
  14997. paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) {
  14998. this.save();
  14999. this.baseTransformStack.push(this.baseTransform);
  15000. if (Array.isArray(matrix) && matrix.length === 6) {
  15001. this.transform.apply(this, matrix);
  15002. }
  15003. this.baseTransform = this.ctx.mozCurrentTransform;
  15004. if (bbox) {
  15005. var width = bbox[2] - bbox[0];
  15006. var height = bbox[3] - bbox[1];
  15007. this.ctx.rect(bbox[0], bbox[1], width, height);
  15008. this.clip();
  15009. this.endPath();
  15010. }
  15011. },
  15012. paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
  15013. this.restore();
  15014. this.baseTransform = this.baseTransformStack.pop();
  15015. },
  15016. beginGroup: function CanvasGraphics_beginGroup(group) {
  15017. this.save();
  15018. var currentCtx = this.ctx;
  15019. if (!group.isolated) {
  15020. (0, _util.info)("TODO: Support non-isolated groups.");
  15021. }
  15022. if (group.knockout) {
  15023. (0, _util.warn)("Knockout groups not supported.");
  15024. }
  15025. var currentTransform = currentCtx.mozCurrentTransform;
  15026. if (group.matrix) {
  15027. currentCtx.transform.apply(currentCtx, group.matrix);
  15028. }
  15029. if (!group.bbox) {
  15030. throw new Error("Bounding box is required.");
  15031. }
  15032. var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform);
  15033. var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
  15034. bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
  15035. var offsetX = Math.floor(bounds[0]);
  15036. var offsetY = Math.floor(bounds[1]);
  15037. var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
  15038. var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
  15039. var scaleX = 1,
  15040. scaleY = 1;
  15041. if (drawnWidth > MAX_GROUP_SIZE) {
  15042. scaleX = drawnWidth / MAX_GROUP_SIZE;
  15043. drawnWidth = MAX_GROUP_SIZE;
  15044. }
  15045. if (drawnHeight > MAX_GROUP_SIZE) {
  15046. scaleY = drawnHeight / MAX_GROUP_SIZE;
  15047. drawnHeight = MAX_GROUP_SIZE;
  15048. }
  15049. var cacheId = "groupAt" + this.groupLevel;
  15050. if (group.smask) {
  15051. cacheId += "_smask_" + this.smaskCounter++ % 2;
  15052. }
  15053. var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true);
  15054. var groupCtx = scratchCanvas.context;
  15055. groupCtx.scale(1 / scaleX, 1 / scaleY);
  15056. groupCtx.translate(-offsetX, -offsetY);
  15057. groupCtx.transform.apply(groupCtx, currentTransform);
  15058. if (group.smask) {
  15059. this.smaskStack.push({
  15060. canvas: scratchCanvas.canvas,
  15061. context: groupCtx,
  15062. offsetX: offsetX,
  15063. offsetY: offsetY,
  15064. scaleX: scaleX,
  15065. scaleY: scaleY,
  15066. subtype: group.smask.subtype,
  15067. backdrop: group.smask.backdrop,
  15068. transferMap: group.smask.transferMap || null,
  15069. startTransformInverse: null
  15070. });
  15071. } else {
  15072. currentCtx.setTransform(1, 0, 0, 1, 0, 0);
  15073. currentCtx.translate(offsetX, offsetY);
  15074. currentCtx.scale(scaleX, scaleY);
  15075. }
  15076. copyCtxState(currentCtx, groupCtx);
  15077. this.ctx = groupCtx;
  15078. this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
  15079. this.groupStack.push(currentCtx);
  15080. this.groupLevel++;
  15081. this.current.activeSMask = null;
  15082. },
  15083. endGroup: function CanvasGraphics_endGroup(group) {
  15084. this.groupLevel--;
  15085. var groupCtx = this.ctx;
  15086. this.ctx = this.groupStack.pop();
  15087. if (this.ctx.imageSmoothingEnabled !== undefined) {
  15088. this.ctx.imageSmoothingEnabled = false;
  15089. } else {
  15090. this.ctx.mozImageSmoothingEnabled = false;
  15091. }
  15092. if (group.smask) {
  15093. this.tempSMask = this.smaskStack.pop();
  15094. } else {
  15095. this.ctx.drawImage(groupCtx.canvas, 0, 0);
  15096. }
  15097. this.restore();
  15098. },
  15099. beginAnnotations: function CanvasGraphics_beginAnnotations() {
  15100. this.save();
  15101. if (this.baseTransform) {
  15102. this.ctx.setTransform.apply(this.ctx, this.baseTransform);
  15103. }
  15104. },
  15105. endAnnotations: function CanvasGraphics_endAnnotations() {
  15106. this.restore();
  15107. },
  15108. beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) {
  15109. this.save();
  15110. resetCtxToDefault(this.ctx);
  15111. this.current = new CanvasExtraState();
  15112. if (Array.isArray(rect) && rect.length === 4) {
  15113. var width = rect[2] - rect[0];
  15114. var height = rect[3] - rect[1];
  15115. this.ctx.rect(rect[0], rect[1], width, height);
  15116. this.clip();
  15117. this.endPath();
  15118. }
  15119. this.transform.apply(this, transform);
  15120. this.transform.apply(this, matrix);
  15121. },
  15122. endAnnotation: function CanvasGraphics_endAnnotation() {
  15123. this.restore();
  15124. },
  15125. paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) {
  15126. var ctx = this.ctx;
  15127. var width = img.width,
  15128. height = img.height;
  15129. var fillColor = this.current.fillColor;
  15130. var isPatternFill = this.current.patternFill;
  15131. var glyph = this.processingType3;
  15132. if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) {
  15133. if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) {
  15134. glyph.compiled = compileType3Glyph({
  15135. data: img.data,
  15136. width: width,
  15137. height: height
  15138. });
  15139. } else {
  15140. glyph.compiled = null;
  15141. }
  15142. }
  15143. if (glyph && glyph.compiled) {
  15144. glyph.compiled(ctx);
  15145. return;
  15146. }
  15147. var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
  15148. var maskCtx = maskCanvas.context;
  15149. maskCtx.save();
  15150. putBinaryImageMask(maskCtx, img);
  15151. maskCtx.globalCompositeOperation = "source-in";
  15152. maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor;
  15153. maskCtx.fillRect(0, 0, width, height);
  15154. maskCtx.restore();
  15155. this.paintInlineImageXObject(maskCanvas.canvas);
  15156. },
  15157. paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) {
  15158. var width = imgData.width;
  15159. var height = imgData.height;
  15160. var fillColor = this.current.fillColor;
  15161. var isPatternFill = this.current.patternFill;
  15162. var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
  15163. var maskCtx = maskCanvas.context;
  15164. maskCtx.save();
  15165. putBinaryImageMask(maskCtx, imgData);
  15166. maskCtx.globalCompositeOperation = "source-in";
  15167. maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor;
  15168. maskCtx.fillRect(0, 0, width, height);
  15169. maskCtx.restore();
  15170. var ctx = this.ctx;
  15171. for (var i = 0, ii = positions.length; i < ii; i += 2) {
  15172. ctx.save();
  15173. ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]);
  15174. ctx.scale(1, -1);
  15175. ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
  15176. ctx.restore();
  15177. }
  15178. },
  15179. paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) {
  15180. var ctx = this.ctx;
  15181. var fillColor = this.current.fillColor;
  15182. var isPatternFill = this.current.patternFill;
  15183. for (var i = 0, ii = images.length; i < ii; i++) {
  15184. var image = images[i];
  15185. var width = image.width,
  15186. height = image.height;
  15187. var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
  15188. var maskCtx = maskCanvas.context;
  15189. maskCtx.save();
  15190. putBinaryImageMask(maskCtx, image);
  15191. maskCtx.globalCompositeOperation = "source-in";
  15192. maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor;
  15193. maskCtx.fillRect(0, 0, width, height);
  15194. maskCtx.restore();
  15195. ctx.save();
  15196. ctx.transform.apply(ctx, image.transform);
  15197. ctx.scale(1, -1);
  15198. ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
  15199. ctx.restore();
  15200. }
  15201. },
  15202. paintImageXObject: function CanvasGraphics_paintImageXObject(objId) {
  15203. var imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
  15204. if (!imgData) {
  15205. (0, _util.warn)("Dependent image isn't ready yet");
  15206. return;
  15207. }
  15208. this.paintInlineImageXObject(imgData);
  15209. },
  15210. paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
  15211. var imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId);
  15212. if (!imgData) {
  15213. (0, _util.warn)("Dependent image isn't ready yet");
  15214. return;
  15215. }
  15216. var width = imgData.width;
  15217. var height = imgData.height;
  15218. var map = [];
  15219. for (var i = 0, ii = positions.length; i < ii; i += 2) {
  15220. map.push({
  15221. transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
  15222. x: 0,
  15223. y: 0,
  15224. w: width,
  15225. h: height
  15226. });
  15227. }
  15228. this.paintInlineImageXObjectGroup(imgData, map);
  15229. },
  15230. paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) {
  15231. var width = imgData.width;
  15232. var height = imgData.height;
  15233. var ctx = this.ctx;
  15234. this.save();
  15235. ctx.scale(1 / width, -1 / height);
  15236. var currentTransform = ctx.mozCurrentTransformInverse;
  15237. var a = currentTransform[0],
  15238. b = currentTransform[1];
  15239. var widthScale = Math.max(Math.sqrt(a * a + b * b), 1);
  15240. var c = currentTransform[2],
  15241. d = currentTransform[3];
  15242. var heightScale = Math.max(Math.sqrt(c * c + d * d), 1);
  15243. var imgToPaint, tmpCanvas;
  15244. if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
  15245. imgToPaint = imgData;
  15246. } else {
  15247. tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
  15248. var tmpCtx = tmpCanvas.context;
  15249. putBinaryImageData(tmpCtx, imgData);
  15250. imgToPaint = tmpCanvas.canvas;
  15251. }
  15252. var paintWidth = width,
  15253. paintHeight = height;
  15254. var tmpCanvasId = "prescale1";
  15255. while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {
  15256. var newWidth = paintWidth,
  15257. newHeight = paintHeight;
  15258. if (widthScale > 2 && paintWidth > 1) {
  15259. newWidth = Math.ceil(paintWidth / 2);
  15260. widthScale /= paintWidth / newWidth;
  15261. }
  15262. if (heightScale > 2 && paintHeight > 1) {
  15263. newHeight = Math.ceil(paintHeight / 2);
  15264. heightScale /= paintHeight / newHeight;
  15265. }
  15266. tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
  15267. tmpCtx = tmpCanvas.context;
  15268. tmpCtx.clearRect(0, 0, newWidth, newHeight);
  15269. tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
  15270. imgToPaint = tmpCanvas.canvas;
  15271. paintWidth = newWidth;
  15272. paintHeight = newHeight;
  15273. tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1";
  15274. }
  15275. ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height);
  15276. if (this.imageLayer) {
  15277. var position = this.getCanvasPosition(0, -height);
  15278. this.imageLayer.appendImage({
  15279. imgData: imgData,
  15280. left: position[0],
  15281. top: position[1],
  15282. width: width / currentTransform[0],
  15283. height: height / currentTransform[3]
  15284. });
  15285. }
  15286. this.restore();
  15287. },
  15288. paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) {
  15289. var ctx = this.ctx;
  15290. var w = imgData.width;
  15291. var h = imgData.height;
  15292. var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h);
  15293. var tmpCtx = tmpCanvas.context;
  15294. putBinaryImageData(tmpCtx, imgData);
  15295. for (var i = 0, ii = map.length; i < ii; i++) {
  15296. var entry = map[i];
  15297. ctx.save();
  15298. ctx.transform.apply(ctx, entry.transform);
  15299. ctx.scale(1, -1);
  15300. ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
  15301. if (this.imageLayer) {
  15302. var position = this.getCanvasPosition(entry.x, entry.y);
  15303. this.imageLayer.appendImage({
  15304. imgData: imgData,
  15305. left: position[0],
  15306. top: position[1],
  15307. width: w,
  15308. height: h
  15309. });
  15310. }
  15311. ctx.restore();
  15312. }
  15313. },
  15314. paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() {
  15315. this.ctx.fillRect(0, 0, 1, 1);
  15316. },
  15317. paintXObject: function CanvasGraphics_paintXObject() {
  15318. (0, _util.warn)("Unsupported 'paintXObject' command.");
  15319. },
  15320. markPoint: function CanvasGraphics_markPoint(tag) {},
  15321. markPointProps: function CanvasGraphics_markPointProps(tag, properties) {},
  15322. beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {},
  15323. beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {},
  15324. endMarkedContent: function CanvasGraphics_endMarkedContent() {},
  15325. beginCompat: function CanvasGraphics_beginCompat() {},
  15326. endCompat: function CanvasGraphics_endCompat() {},
  15327. consumePath: function CanvasGraphics_consumePath() {
  15328. var ctx = this.ctx;
  15329. if (this.pendingClip) {
  15330. if (this.pendingClip === EO_CLIP) {
  15331. ctx.clip("evenodd");
  15332. } else {
  15333. ctx.clip();
  15334. }
  15335. this.pendingClip = null;
  15336. }
  15337. ctx.beginPath();
  15338. },
  15339. getSinglePixelWidth: function getSinglePixelWidth(scale) {
  15340. if (this._cachedGetSinglePixelWidth === null) {
  15341. var inverse = this.ctx.mozCurrentTransformInverse;
  15342. this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3]));
  15343. }
  15344. return this._cachedGetSinglePixelWidth;
  15345. },
  15346. getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) {
  15347. var transform = this.ctx.mozCurrentTransform;
  15348. return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]];
  15349. }
  15350. };
  15351. for (var op in _util.OPS) {
  15352. CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op];
  15353. }
  15354. return CanvasGraphics;
  15355. }();
  15356. exports.CanvasGraphics = CanvasGraphics;
  15357. /***/ }),
  15358. /* 202 */
  15359. /***/ (function(module, exports, __w_pdfjs_require__) {
  15360. "use strict";
  15361. Object.defineProperty(exports, "__esModule", {
  15362. value: true
  15363. });
  15364. exports.getShadingPatternFromIR = getShadingPatternFromIR;
  15365. exports.TilingPattern = void 0;
  15366. var _util = __w_pdfjs_require__(5);
  15367. var ShadingIRs = {};
  15368. function applyBoundingBox(ctx, bbox) {
  15369. if (!bbox || typeof Path2D === "undefined") {
  15370. return;
  15371. }
  15372. var width = bbox[2] - bbox[0];
  15373. var height = bbox[3] - bbox[1];
  15374. var region = new Path2D();
  15375. region.rect(bbox[0], bbox[1], width, height);
  15376. ctx.clip(region);
  15377. }
  15378. ShadingIRs.RadialAxial = {
  15379. fromIR: function RadialAxial_fromIR(raw) {
  15380. var type = raw[1];
  15381. var bbox = raw[2];
  15382. var colorStops = raw[3];
  15383. var p0 = raw[4];
  15384. var p1 = raw[5];
  15385. var r0 = raw[6];
  15386. var r1 = raw[7];
  15387. return {
  15388. type: "Pattern",
  15389. getPattern: function RadialAxial_getPattern(ctx) {
  15390. applyBoundingBox(ctx, bbox);
  15391. var grad;
  15392. if (type === "axial") {
  15393. grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]);
  15394. } else if (type === "radial") {
  15395. grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1);
  15396. }
  15397. for (var i = 0, ii = colorStops.length; i < ii; ++i) {
  15398. var c = colorStops[i];
  15399. grad.addColorStop(c[0], c[1]);
  15400. }
  15401. return grad;
  15402. }
  15403. };
  15404. }
  15405. };
  15406. var createMeshCanvas = function createMeshCanvasClosure() {
  15407. function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
  15408. var coords = context.coords,
  15409. colors = context.colors;
  15410. var bytes = data.data,
  15411. rowSize = data.width * 4;
  15412. var tmp;
  15413. if (coords[p1 + 1] > coords[p2 + 1]) {
  15414. tmp = p1;
  15415. p1 = p2;
  15416. p2 = tmp;
  15417. tmp = c1;
  15418. c1 = c2;
  15419. c2 = tmp;
  15420. }
  15421. if (coords[p2 + 1] > coords[p3 + 1]) {
  15422. tmp = p2;
  15423. p2 = p3;
  15424. p3 = tmp;
  15425. tmp = c2;
  15426. c2 = c3;
  15427. c3 = tmp;
  15428. }
  15429. if (coords[p1 + 1] > coords[p2 + 1]) {
  15430. tmp = p1;
  15431. p1 = p2;
  15432. p2 = tmp;
  15433. tmp = c1;
  15434. c1 = c2;
  15435. c2 = tmp;
  15436. }
  15437. var x1 = (coords[p1] + context.offsetX) * context.scaleX;
  15438. var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
  15439. var x2 = (coords[p2] + context.offsetX) * context.scaleX;
  15440. var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
  15441. var x3 = (coords[p3] + context.offsetX) * context.scaleX;
  15442. var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
  15443. if (y1 >= y3) {
  15444. return;
  15445. }
  15446. var c1r = colors[c1],
  15447. c1g = colors[c1 + 1],
  15448. c1b = colors[c1 + 2];
  15449. var c2r = colors[c2],
  15450. c2g = colors[c2 + 1],
  15451. c2b = colors[c2 + 2];
  15452. var c3r = colors[c3],
  15453. c3g = colors[c3 + 1],
  15454. c3b = colors[c3 + 2];
  15455. var minY = Math.round(y1),
  15456. maxY = Math.round(y3);
  15457. var xa, car, cag, cab;
  15458. var xb, cbr, cbg, cbb;
  15459. for (var y = minY; y <= maxY; y++) {
  15460. if (y < y2) {
  15461. var _k = void 0;
  15462. if (y < y1) {
  15463. _k = 0;
  15464. } else if (y1 === y2) {
  15465. _k = 1;
  15466. } else {
  15467. _k = (y1 - y) / (y1 - y2);
  15468. }
  15469. xa = x1 - (x1 - x2) * _k;
  15470. car = c1r - (c1r - c2r) * _k;
  15471. cag = c1g - (c1g - c2g) * _k;
  15472. cab = c1b - (c1b - c2b) * _k;
  15473. } else {
  15474. var _k2 = void 0;
  15475. if (y > y3) {
  15476. _k2 = 1;
  15477. } else if (y2 === y3) {
  15478. _k2 = 0;
  15479. } else {
  15480. _k2 = (y2 - y) / (y2 - y3);
  15481. }
  15482. xa = x2 - (x2 - x3) * _k2;
  15483. car = c2r - (c2r - c3r) * _k2;
  15484. cag = c2g - (c2g - c3g) * _k2;
  15485. cab = c2b - (c2b - c3b) * _k2;
  15486. }
  15487. var k = void 0;
  15488. if (y < y1) {
  15489. k = 0;
  15490. } else if (y > y3) {
  15491. k = 1;
  15492. } else {
  15493. k = (y1 - y) / (y1 - y3);
  15494. }
  15495. xb = x1 - (x1 - x3) * k;
  15496. cbr = c1r - (c1r - c3r) * k;
  15497. cbg = c1g - (c1g - c3g) * k;
  15498. cbb = c1b - (c1b - c3b) * k;
  15499. var x1_ = Math.round(Math.min(xa, xb));
  15500. var x2_ = Math.round(Math.max(xa, xb));
  15501. var j = rowSize * y + x1_ * 4;
  15502. for (var x = x1_; x <= x2_; x++) {
  15503. k = (xa - x) / (xa - xb);
  15504. if (k < 0) {
  15505. k = 0;
  15506. } else if (k > 1) {
  15507. k = 1;
  15508. }
  15509. bytes[j++] = car - (car - cbr) * k | 0;
  15510. bytes[j++] = cag - (cag - cbg) * k | 0;
  15511. bytes[j++] = cab - (cab - cbb) * k | 0;
  15512. bytes[j++] = 255;
  15513. }
  15514. }
  15515. }
  15516. function drawFigure(data, figure, context) {
  15517. var ps = figure.coords;
  15518. var cs = figure.colors;
  15519. var i, ii;
  15520. switch (figure.type) {
  15521. case "lattice":
  15522. var verticesPerRow = figure.verticesPerRow;
  15523. var rows = Math.floor(ps.length / verticesPerRow) - 1;
  15524. var cols = verticesPerRow - 1;
  15525. for (i = 0; i < rows; i++) {
  15526. var q = i * verticesPerRow;
  15527. for (var j = 0; j < cols; j++, q++) {
  15528. drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
  15529. drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
  15530. }
  15531. }
  15532. break;
  15533. case "triangles":
  15534. for (i = 0, ii = ps.length; i < ii; i += 3) {
  15535. drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
  15536. }
  15537. break;
  15538. default:
  15539. throw new Error("illegal figure");
  15540. }
  15541. }
  15542. function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) {
  15543. var EXPECTED_SCALE = 1.1;
  15544. var MAX_PATTERN_SIZE = 3000;
  15545. var BORDER_SIZE = 2;
  15546. var offsetX = Math.floor(bounds[0]);
  15547. var offsetY = Math.floor(bounds[1]);
  15548. var boundsWidth = Math.ceil(bounds[2]) - offsetX;
  15549. var boundsHeight = Math.ceil(bounds[3]) - offsetY;
  15550. var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
  15551. var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
  15552. var scaleX = boundsWidth / width;
  15553. var scaleY = boundsHeight / height;
  15554. var context = {
  15555. coords: coords,
  15556. colors: colors,
  15557. offsetX: -offsetX,
  15558. offsetY: -offsetY,
  15559. scaleX: 1 / scaleX,
  15560. scaleY: 1 / scaleY
  15561. };
  15562. var paddedWidth = width + BORDER_SIZE * 2;
  15563. var paddedHeight = height + BORDER_SIZE * 2;
  15564. var canvas, tmpCanvas, i, ii;
  15565. if (webGLContext.isEnabled) {
  15566. canvas = webGLContext.drawFigures({
  15567. width: width,
  15568. height: height,
  15569. backgroundColor: backgroundColor,
  15570. figures: figures,
  15571. context: context
  15572. });
  15573. tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false);
  15574. tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE);
  15575. canvas = tmpCanvas.canvas;
  15576. } else {
  15577. tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false);
  15578. var tmpCtx = tmpCanvas.context;
  15579. var data = tmpCtx.createImageData(width, height);
  15580. if (backgroundColor) {
  15581. var bytes = data.data;
  15582. for (i = 0, ii = bytes.length; i < ii; i += 4) {
  15583. bytes[i] = backgroundColor[0];
  15584. bytes[i + 1] = backgroundColor[1];
  15585. bytes[i + 2] = backgroundColor[2];
  15586. bytes[i + 3] = 255;
  15587. }
  15588. }
  15589. for (i = 0; i < figures.length; i++) {
  15590. drawFigure(data, figures[i], context);
  15591. }
  15592. tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
  15593. canvas = tmpCanvas.canvas;
  15594. }
  15595. return {
  15596. canvas: canvas,
  15597. offsetX: offsetX - BORDER_SIZE * scaleX,
  15598. offsetY: offsetY - BORDER_SIZE * scaleY,
  15599. scaleX: scaleX,
  15600. scaleY: scaleY
  15601. };
  15602. }
  15603. return createMeshCanvas;
  15604. }();
  15605. ShadingIRs.Mesh = {
  15606. fromIR: function Mesh_fromIR(raw) {
  15607. var coords = raw[2];
  15608. var colors = raw[3];
  15609. var figures = raw[4];
  15610. var bounds = raw[5];
  15611. var matrix = raw[6];
  15612. var bbox = raw[7];
  15613. var background = raw[8];
  15614. return {
  15615. type: "Pattern",
  15616. getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
  15617. applyBoundingBox(ctx, bbox);
  15618. var scale;
  15619. if (shadingFill) {
  15620. scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);
  15621. } else {
  15622. scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform);
  15623. if (matrix) {
  15624. var matrixScale = _util.Util.singularValueDecompose2dScale(matrix);
  15625. scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
  15626. }
  15627. }
  15628. var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext);
  15629. if (!shadingFill) {
  15630. ctx.setTransform.apply(ctx, owner.baseTransform);
  15631. if (matrix) {
  15632. ctx.transform.apply(ctx, matrix);
  15633. }
  15634. }
  15635. ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
  15636. ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
  15637. return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
  15638. }
  15639. };
  15640. }
  15641. };
  15642. ShadingIRs.Dummy = {
  15643. fromIR: function Dummy_fromIR() {
  15644. return {
  15645. type: "Pattern",
  15646. getPattern: function Dummy_fromIR_getPattern() {
  15647. return "hotpink";
  15648. }
  15649. };
  15650. }
  15651. };
  15652. function getShadingPatternFromIR(raw) {
  15653. var shadingIR = ShadingIRs[raw[0]];
  15654. if (!shadingIR) {
  15655. throw new Error("Unknown IR type: ".concat(raw[0]));
  15656. }
  15657. return shadingIR.fromIR(raw);
  15658. }
  15659. var TilingPattern = function TilingPatternClosure() {
  15660. var PaintType = {
  15661. COLORED: 1,
  15662. UNCOLORED: 2
  15663. };
  15664. var MAX_PATTERN_SIZE = 3000;
  15665. function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
  15666. this.operatorList = IR[2];
  15667. this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
  15668. this.bbox = IR[4];
  15669. this.xstep = IR[5];
  15670. this.ystep = IR[6];
  15671. this.paintType = IR[7];
  15672. this.tilingType = IR[8];
  15673. this.color = color;
  15674. this.canvasGraphicsFactory = canvasGraphicsFactory;
  15675. this.baseTransform = baseTransform;
  15676. this.type = "Pattern";
  15677. this.ctx = ctx;
  15678. }
  15679. TilingPattern.prototype = {
  15680. createPatternCanvas: function TilinPattern_createPatternCanvas(owner) {
  15681. var operatorList = this.operatorList;
  15682. var bbox = this.bbox;
  15683. var xstep = this.xstep;
  15684. var ystep = this.ystep;
  15685. var paintType = this.paintType;
  15686. var tilingType = this.tilingType;
  15687. var color = this.color;
  15688. var canvasGraphicsFactory = this.canvasGraphicsFactory;
  15689. (0, _util.info)("TilingType: " + tilingType);
  15690. var x0 = bbox[0],
  15691. y0 = bbox[1],
  15692. x1 = bbox[2],
  15693. y1 = bbox[3];
  15694. var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);
  15695. var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform);
  15696. var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];
  15697. var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);
  15698. var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);
  15699. var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true);
  15700. var tmpCtx = tmpCanvas.context;
  15701. var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
  15702. graphics.groupLevel = owner.groupLevel;
  15703. this.setFillAndStrokeStyleToContext(graphics, paintType, color);
  15704. graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
  15705. graphics.transform(1, 0, 0, 1, -x0, -y0);
  15706. this.clipBbox(graphics, bbox, x0, y0, x1, y1);
  15707. graphics.executeOperatorList(operatorList);
  15708. this.ctx.transform(1, 0, 0, 1, x0, y0);
  15709. this.ctx.scale(1 / dimx.scale, 1 / dimy.scale);
  15710. return tmpCanvas.canvas;
  15711. },
  15712. getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) {
  15713. step = Math.abs(step);
  15714. var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize);
  15715. var size = Math.ceil(step * scale);
  15716. if (size >= maxSize) {
  15717. size = maxSize;
  15718. } else {
  15719. scale = size / step;
  15720. }
  15721. return {
  15722. scale: scale,
  15723. size: size
  15724. };
  15725. },
  15726. clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
  15727. if (Array.isArray(bbox) && bbox.length === 4) {
  15728. var bboxWidth = x1 - x0;
  15729. var bboxHeight = y1 - y0;
  15730. graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
  15731. graphics.clip();
  15732. graphics.endPath();
  15733. }
  15734. },
  15735. setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) {
  15736. var context = graphics.ctx,
  15737. current = graphics.current;
  15738. switch (paintType) {
  15739. case PaintType.COLORED:
  15740. var ctx = this.ctx;
  15741. context.fillStyle = ctx.fillStyle;
  15742. context.strokeStyle = ctx.strokeStyle;
  15743. current.fillColor = ctx.fillStyle;
  15744. current.strokeColor = ctx.strokeStyle;
  15745. break;
  15746. case PaintType.UNCOLORED:
  15747. var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]);
  15748. context.fillStyle = cssColor;
  15749. context.strokeStyle = cssColor;
  15750. current.fillColor = cssColor;
  15751. current.strokeColor = cssColor;
  15752. break;
  15753. default:
  15754. throw new _util.FormatError("Unsupported paint type: ".concat(paintType));
  15755. }
  15756. },
  15757. getPattern: function TilingPattern_getPattern(ctx, owner) {
  15758. ctx = this.ctx;
  15759. ctx.setTransform.apply(ctx, this.baseTransform);
  15760. ctx.transform.apply(ctx, this.matrix);
  15761. var temporaryPatternCanvas = this.createPatternCanvas(owner);
  15762. return ctx.createPattern(temporaryPatternCanvas, "repeat");
  15763. }
  15764. };
  15765. return TilingPattern;
  15766. }();
  15767. exports.TilingPattern = TilingPattern;
  15768. /***/ }),
  15769. /* 203 */
  15770. /***/ (function(module, exports, __w_pdfjs_require__) {
  15771. "use strict";
  15772. Object.defineProperty(exports, "__esModule", {
  15773. value: true
  15774. });
  15775. exports.GlobalWorkerOptions = void 0;
  15776. var GlobalWorkerOptions = Object.create(null);
  15777. exports.GlobalWorkerOptions = GlobalWorkerOptions;
  15778. GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort;
  15779. GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc;
  15780. /***/ }),
  15781. /* 204 */
  15782. /***/ (function(module, exports, __w_pdfjs_require__) {
  15783. "use strict";
  15784. Object.defineProperty(exports, "__esModule", {
  15785. value: true
  15786. });
  15787. exports.MessageHandler = void 0;
  15788. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  15789. var _util = __w_pdfjs_require__(5);
  15790. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  15791. 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); } }
  15792. 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); }); }; }
  15793. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  15794. 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); } }
  15795. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  15796. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  15797. var CallbackKind = {
  15798. UNKNOWN: 0,
  15799. DATA: 1,
  15800. ERROR: 2
  15801. };
  15802. var StreamKind = {
  15803. UNKNOWN: 0,
  15804. CANCEL: 1,
  15805. CANCEL_COMPLETE: 2,
  15806. CLOSE: 3,
  15807. ENQUEUE: 4,
  15808. ERROR: 5,
  15809. PULL: 6,
  15810. PULL_COMPLETE: 7,
  15811. START_COMPLETE: 8
  15812. };
  15813. function wrapReason(reason) {
  15814. if (_typeof(reason) !== "object" || reason === null) {
  15815. return reason;
  15816. }
  15817. switch (reason.name) {
  15818. case "AbortException":
  15819. return new _util.AbortException(reason.message);
  15820. case "MissingPDFException":
  15821. return new _util.MissingPDFException(reason.message);
  15822. case "UnexpectedResponseException":
  15823. return new _util.UnexpectedResponseException(reason.message, reason.status);
  15824. case "UnknownErrorException":
  15825. return new _util.UnknownErrorException(reason.message, reason.details);
  15826. default:
  15827. return new _util.UnknownErrorException(reason.message, reason.toString());
  15828. }
  15829. }
  15830. var MessageHandler = /*#__PURE__*/function () {
  15831. function MessageHandler(sourceName, targetName, comObj) {
  15832. var _this = this;
  15833. _classCallCheck(this, MessageHandler);
  15834. this.sourceName = sourceName;
  15835. this.targetName = targetName;
  15836. this.comObj = comObj;
  15837. this.callbackId = 1;
  15838. this.streamId = 1;
  15839. this.postMessageTransfers = true;
  15840. this.streamSinks = Object.create(null);
  15841. this.streamControllers = Object.create(null);
  15842. this.callbackCapabilities = Object.create(null);
  15843. this.actionHandler = Object.create(null);
  15844. this._onComObjOnMessage = function (event) {
  15845. var data = event.data;
  15846. if (data.targetName !== _this.sourceName) {
  15847. return;
  15848. }
  15849. if (data.stream) {
  15850. _this._processStreamMessage(data);
  15851. return;
  15852. }
  15853. if (data.callback) {
  15854. var callbackId = data.callbackId;
  15855. var capability = _this.callbackCapabilities[callbackId];
  15856. if (!capability) {
  15857. throw new Error("Cannot resolve callback ".concat(callbackId));
  15858. }
  15859. delete _this.callbackCapabilities[callbackId];
  15860. if (data.callback === CallbackKind.DATA) {
  15861. capability.resolve(data.data);
  15862. } else if (data.callback === CallbackKind.ERROR) {
  15863. capability.reject(wrapReason(data.reason));
  15864. } else {
  15865. throw new Error("Unexpected callback case");
  15866. }
  15867. return;
  15868. }
  15869. var action = _this.actionHandler[data.action];
  15870. if (!action) {
  15871. throw new Error("Unknown action from worker: ".concat(data.action));
  15872. }
  15873. if (data.callbackId) {
  15874. var cbSourceName = _this.sourceName;
  15875. var cbTargetName = data.sourceName;
  15876. new Promise(function (resolve) {
  15877. resolve(action(data.data));
  15878. }).then(function (result) {
  15879. comObj.postMessage({
  15880. sourceName: cbSourceName,
  15881. targetName: cbTargetName,
  15882. callback: CallbackKind.DATA,
  15883. callbackId: data.callbackId,
  15884. data: result
  15885. });
  15886. }, function (reason) {
  15887. comObj.postMessage({
  15888. sourceName: cbSourceName,
  15889. targetName: cbTargetName,
  15890. callback: CallbackKind.ERROR,
  15891. callbackId: data.callbackId,
  15892. reason: wrapReason(reason)
  15893. });
  15894. });
  15895. return;
  15896. }
  15897. if (data.streamId) {
  15898. _this._createStreamSink(data);
  15899. return;
  15900. }
  15901. action(data.data);
  15902. };
  15903. comObj.addEventListener("message", this._onComObjOnMessage);
  15904. }
  15905. _createClass(MessageHandler, [{
  15906. key: "on",
  15907. value: function on(actionName, handler) {
  15908. var ah = this.actionHandler;
  15909. if (ah[actionName]) {
  15910. throw new Error("There is already an actionName called \"".concat(actionName, "\""));
  15911. }
  15912. ah[actionName] = handler;
  15913. }
  15914. }, {
  15915. key: "send",
  15916. value: function send(actionName, data, transfers) {
  15917. this._postMessage({
  15918. sourceName: this.sourceName,
  15919. targetName: this.targetName,
  15920. action: actionName,
  15921. data: data
  15922. }, transfers);
  15923. }
  15924. }, {
  15925. key: "sendWithPromise",
  15926. value: function sendWithPromise(actionName, data, transfers) {
  15927. var callbackId = this.callbackId++;
  15928. var capability = (0, _util.createPromiseCapability)();
  15929. this.callbackCapabilities[callbackId] = capability;
  15930. try {
  15931. this._postMessage({
  15932. sourceName: this.sourceName,
  15933. targetName: this.targetName,
  15934. action: actionName,
  15935. callbackId: callbackId,
  15936. data: data
  15937. }, transfers);
  15938. } catch (ex) {
  15939. capability.reject(ex);
  15940. }
  15941. return capability.promise;
  15942. }
  15943. }, {
  15944. key: "sendWithStream",
  15945. value: function sendWithStream(actionName, data, queueingStrategy, transfers) {
  15946. var _this2 = this;
  15947. var streamId = this.streamId++;
  15948. var sourceName = this.sourceName;
  15949. var targetName = this.targetName;
  15950. var comObj = this.comObj;
  15951. return new ReadableStream({
  15952. start: function start(controller) {
  15953. var startCapability = (0, _util.createPromiseCapability)();
  15954. _this2.streamControllers[streamId] = {
  15955. controller: controller,
  15956. startCall: startCapability,
  15957. pullCall: null,
  15958. cancelCall: null,
  15959. isClosed: false
  15960. };
  15961. _this2._postMessage({
  15962. sourceName: sourceName,
  15963. targetName: targetName,
  15964. action: actionName,
  15965. streamId: streamId,
  15966. data: data,
  15967. desiredSize: controller.desiredSize
  15968. }, transfers);
  15969. return startCapability.promise;
  15970. },
  15971. pull: function pull(controller) {
  15972. var pullCapability = (0, _util.createPromiseCapability)();
  15973. _this2.streamControllers[streamId].pullCall = pullCapability;
  15974. comObj.postMessage({
  15975. sourceName: sourceName,
  15976. targetName: targetName,
  15977. stream: StreamKind.PULL,
  15978. streamId: streamId,
  15979. desiredSize: controller.desiredSize
  15980. });
  15981. return pullCapability.promise;
  15982. },
  15983. cancel: function cancel(reason) {
  15984. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  15985. var cancelCapability = (0, _util.createPromiseCapability)();
  15986. _this2.streamControllers[streamId].cancelCall = cancelCapability;
  15987. _this2.streamControllers[streamId].isClosed = true;
  15988. comObj.postMessage({
  15989. sourceName: sourceName,
  15990. targetName: targetName,
  15991. stream: StreamKind.CANCEL,
  15992. streamId: streamId,
  15993. reason: wrapReason(reason)
  15994. });
  15995. return cancelCapability.promise;
  15996. }
  15997. }, queueingStrategy);
  15998. }
  15999. }, {
  16000. key: "_createStreamSink",
  16001. value: function _createStreamSink(data) {
  16002. var self = this;
  16003. var action = this.actionHandler[data.action];
  16004. var streamId = data.streamId;
  16005. var sourceName = this.sourceName;
  16006. var targetName = data.sourceName;
  16007. var comObj = this.comObj;
  16008. var streamSink = {
  16009. enqueue: function enqueue(chunk) {
  16010. var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  16011. var transfers = arguments.length > 2 ? arguments[2] : undefined;
  16012. if (this.isCancelled) {
  16013. return;
  16014. }
  16015. var lastDesiredSize = this.desiredSize;
  16016. this.desiredSize -= size;
  16017. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  16018. this.sinkCapability = (0, _util.createPromiseCapability)();
  16019. this.ready = this.sinkCapability.promise;
  16020. }
  16021. self._postMessage({
  16022. sourceName: sourceName,
  16023. targetName: targetName,
  16024. stream: StreamKind.ENQUEUE,
  16025. streamId: streamId,
  16026. chunk: chunk
  16027. }, transfers);
  16028. },
  16029. close: function close() {
  16030. if (this.isCancelled) {
  16031. return;
  16032. }
  16033. this.isCancelled = true;
  16034. comObj.postMessage({
  16035. sourceName: sourceName,
  16036. targetName: targetName,
  16037. stream: StreamKind.CLOSE,
  16038. streamId: streamId
  16039. });
  16040. delete self.streamSinks[streamId];
  16041. },
  16042. error: function error(reason) {
  16043. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  16044. if (this.isCancelled) {
  16045. return;
  16046. }
  16047. this.isCancelled = true;
  16048. comObj.postMessage({
  16049. sourceName: sourceName,
  16050. targetName: targetName,
  16051. stream: StreamKind.ERROR,
  16052. streamId: streamId,
  16053. reason: wrapReason(reason)
  16054. });
  16055. },
  16056. sinkCapability: (0, _util.createPromiseCapability)(),
  16057. onPull: null,
  16058. onCancel: null,
  16059. isCancelled: false,
  16060. desiredSize: data.desiredSize,
  16061. ready: null
  16062. };
  16063. streamSink.sinkCapability.resolve();
  16064. streamSink.ready = streamSink.sinkCapability.promise;
  16065. this.streamSinks[streamId] = streamSink;
  16066. new Promise(function (resolve) {
  16067. resolve(action(data.data, streamSink));
  16068. }).then(function () {
  16069. comObj.postMessage({
  16070. sourceName: sourceName,
  16071. targetName: targetName,
  16072. stream: StreamKind.START_COMPLETE,
  16073. streamId: streamId,
  16074. success: true
  16075. });
  16076. }, function (reason) {
  16077. comObj.postMessage({
  16078. sourceName: sourceName,
  16079. targetName: targetName,
  16080. stream: StreamKind.START_COMPLETE,
  16081. streamId: streamId,
  16082. reason: wrapReason(reason)
  16083. });
  16084. });
  16085. }
  16086. }, {
  16087. key: "_processStreamMessage",
  16088. value: function _processStreamMessage(data) {
  16089. var streamId = data.streamId;
  16090. var sourceName = this.sourceName;
  16091. var targetName = data.sourceName;
  16092. var comObj = this.comObj;
  16093. switch (data.stream) {
  16094. case StreamKind.START_COMPLETE:
  16095. if (data.success) {
  16096. this.streamControllers[streamId].startCall.resolve();
  16097. } else {
  16098. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  16099. }
  16100. break;
  16101. case StreamKind.PULL_COMPLETE:
  16102. if (data.success) {
  16103. this.streamControllers[streamId].pullCall.resolve();
  16104. } else {
  16105. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  16106. }
  16107. break;
  16108. case StreamKind.PULL:
  16109. if (!this.streamSinks[streamId]) {
  16110. comObj.postMessage({
  16111. sourceName: sourceName,
  16112. targetName: targetName,
  16113. stream: StreamKind.PULL_COMPLETE,
  16114. streamId: streamId,
  16115. success: true
  16116. });
  16117. break;
  16118. }
  16119. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  16120. this.streamSinks[streamId].sinkCapability.resolve();
  16121. }
  16122. this.streamSinks[streamId].desiredSize = data.desiredSize;
  16123. var onPull = this.streamSinks[data.streamId].onPull;
  16124. new Promise(function (resolve) {
  16125. resolve(onPull && onPull());
  16126. }).then(function () {
  16127. comObj.postMessage({
  16128. sourceName: sourceName,
  16129. targetName: targetName,
  16130. stream: StreamKind.PULL_COMPLETE,
  16131. streamId: streamId,
  16132. success: true
  16133. });
  16134. }, function (reason) {
  16135. comObj.postMessage({
  16136. sourceName: sourceName,
  16137. targetName: targetName,
  16138. stream: StreamKind.PULL_COMPLETE,
  16139. streamId: streamId,
  16140. reason: wrapReason(reason)
  16141. });
  16142. });
  16143. break;
  16144. case StreamKind.ENQUEUE:
  16145. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  16146. if (this.streamControllers[streamId].isClosed) {
  16147. break;
  16148. }
  16149. this.streamControllers[streamId].controller.enqueue(data.chunk);
  16150. break;
  16151. case StreamKind.CLOSE:
  16152. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  16153. if (this.streamControllers[streamId].isClosed) {
  16154. break;
  16155. }
  16156. this.streamControllers[streamId].isClosed = true;
  16157. this.streamControllers[streamId].controller.close();
  16158. this._deleteStreamController(streamId);
  16159. break;
  16160. case StreamKind.ERROR:
  16161. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  16162. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  16163. this._deleteStreamController(streamId);
  16164. break;
  16165. case StreamKind.CANCEL_COMPLETE:
  16166. if (data.success) {
  16167. this.streamControllers[streamId].cancelCall.resolve();
  16168. } else {
  16169. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  16170. }
  16171. this._deleteStreamController(streamId);
  16172. break;
  16173. case StreamKind.CANCEL:
  16174. if (!this.streamSinks[streamId]) {
  16175. break;
  16176. }
  16177. var onCancel = this.streamSinks[data.streamId].onCancel;
  16178. new Promise(function (resolve) {
  16179. resolve(onCancel && onCancel(wrapReason(data.reason)));
  16180. }).then(function () {
  16181. comObj.postMessage({
  16182. sourceName: sourceName,
  16183. targetName: targetName,
  16184. stream: StreamKind.CANCEL_COMPLETE,
  16185. streamId: streamId,
  16186. success: true
  16187. });
  16188. }, function (reason) {
  16189. comObj.postMessage({
  16190. sourceName: sourceName,
  16191. targetName: targetName,
  16192. stream: StreamKind.CANCEL_COMPLETE,
  16193. streamId: streamId,
  16194. reason: wrapReason(reason)
  16195. });
  16196. });
  16197. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  16198. this.streamSinks[streamId].isCancelled = true;
  16199. delete this.streamSinks[streamId];
  16200. break;
  16201. default:
  16202. throw new Error("Unexpected stream case");
  16203. }
  16204. }
  16205. }, {
  16206. key: "_deleteStreamController",
  16207. value: function () {
  16208. var _deleteStreamController2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee(streamId) {
  16209. return _regenerator["default"].wrap(function _callee$(_context) {
  16210. while (1) {
  16211. switch (_context.prev = _context.next) {
  16212. case 0:
  16213. _context.next = 2;
  16214. return Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  16215. return capability && capability.promise;
  16216. }));
  16217. case 2:
  16218. delete this.streamControllers[streamId];
  16219. case 3:
  16220. case "end":
  16221. return _context.stop();
  16222. }
  16223. }
  16224. }, _callee, this);
  16225. }));
  16226. function _deleteStreamController(_x) {
  16227. return _deleteStreamController2.apply(this, arguments);
  16228. }
  16229. return _deleteStreamController;
  16230. }()
  16231. }, {
  16232. key: "_postMessage",
  16233. value: function _postMessage(message, transfers) {
  16234. if (transfers && this.postMessageTransfers) {
  16235. this.comObj.postMessage(message, transfers);
  16236. } else {
  16237. this.comObj.postMessage(message);
  16238. }
  16239. }
  16240. }, {
  16241. key: "destroy",
  16242. value: function destroy() {
  16243. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  16244. }
  16245. }]);
  16246. return MessageHandler;
  16247. }();
  16248. exports.MessageHandler = MessageHandler;
  16249. /***/ }),
  16250. /* 205 */
  16251. /***/ (function(module, exports, __w_pdfjs_require__) {
  16252. "use strict";
  16253. Object.defineProperty(exports, "__esModule", {
  16254. value: true
  16255. });
  16256. exports.Metadata = void 0;
  16257. var _util = __w_pdfjs_require__(5);
  16258. var _xml_parser = __w_pdfjs_require__(206);
  16259. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  16260. 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."); }
  16261. function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; }
  16262. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  16263. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  16264. 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); }
  16265. 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; }
  16266. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16267. 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); } }
  16268. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  16269. var Metadata = /*#__PURE__*/function () {
  16270. function Metadata(data) {
  16271. _classCallCheck(this, Metadata);
  16272. (0, _util.assert)(typeof data === "string", "Metadata: input is not a string");
  16273. data = this._repair(data);
  16274. var parser = new _xml_parser.SimpleXMLParser();
  16275. var xmlDocument = parser.parseFromString(data);
  16276. this._metadataMap = new Map();
  16277. if (xmlDocument) {
  16278. this._parse(xmlDocument);
  16279. }
  16280. }
  16281. _createClass(Metadata, [{
  16282. key: "_repair",
  16283. value: function _repair(data) {
  16284. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  16285. var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  16286. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  16287. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  16288. switch (name) {
  16289. case "amp":
  16290. return "&";
  16291. case "apos":
  16292. return "'";
  16293. case "gt":
  16294. return ">";
  16295. case "lt":
  16296. return "<";
  16297. case "quot":
  16298. return '"';
  16299. }
  16300. throw new Error("_repair: ".concat(name, " isn't defined."));
  16301. });
  16302. var chars = "";
  16303. for (var i = 0, ii = bytes.length; i < ii; i += 2) {
  16304. var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  16305. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  16306. chars += String.fromCharCode(code);
  16307. } else {
  16308. chars += "&#x" + (0x10000 + code).toString(16).substring(1) + ";";
  16309. }
  16310. }
  16311. return ">" + chars;
  16312. });
  16313. }
  16314. }, {
  16315. key: "_parse",
  16316. value: function _parse(xmlDocument) {
  16317. var rdf = xmlDocument.documentElement;
  16318. if (rdf.nodeName.toLowerCase() !== "rdf:rdf") {
  16319. rdf = rdf.firstChild;
  16320. while (rdf && rdf.nodeName.toLowerCase() !== "rdf:rdf") {
  16321. rdf = rdf.nextSibling;
  16322. }
  16323. }
  16324. var nodeName = rdf ? rdf.nodeName.toLowerCase() : null;
  16325. if (!rdf || nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  16326. return;
  16327. }
  16328. var children = rdf.childNodes;
  16329. for (var i = 0, ii = children.length; i < ii; i++) {
  16330. var desc = children[i];
  16331. if (desc.nodeName.toLowerCase() !== "rdf:description") {
  16332. continue;
  16333. }
  16334. for (var j = 0, jj = desc.childNodes.length; j < jj; j++) {
  16335. if (desc.childNodes[j].nodeName.toLowerCase() !== "#text") {
  16336. var entry = desc.childNodes[j];
  16337. var name = entry.nodeName.toLowerCase();
  16338. this._metadataMap.set(name, entry.textContent.trim());
  16339. }
  16340. }
  16341. }
  16342. }
  16343. }, {
  16344. key: "get",
  16345. value: function get(name) {
  16346. return this._metadataMap.has(name) ? this._metadataMap.get(name) : null;
  16347. }
  16348. }, {
  16349. key: "getAll",
  16350. value: function getAll() {
  16351. var obj = Object.create(null);
  16352. var _iterator = _createForOfIteratorHelper(this._metadataMap),
  16353. _step;
  16354. try {
  16355. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  16356. var _step$value = _slicedToArray(_step.value, 2),
  16357. key = _step$value[0],
  16358. value = _step$value[1];
  16359. obj[key] = value;
  16360. }
  16361. } catch (err) {
  16362. _iterator.e(err);
  16363. } finally {
  16364. _iterator.f();
  16365. }
  16366. return obj;
  16367. }
  16368. }, {
  16369. key: "has",
  16370. value: function has(name) {
  16371. return this._metadataMap.has(name);
  16372. }
  16373. }]);
  16374. return Metadata;
  16375. }();
  16376. exports.Metadata = Metadata;
  16377. /***/ }),
  16378. /* 206 */
  16379. /***/ (function(module, exports, __w_pdfjs_require__) {
  16380. "use strict";
  16381. Object.defineProperty(exports, "__esModule", {
  16382. value: true
  16383. });
  16384. exports.SimpleXMLParser = void 0;
  16385. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  16386. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  16387. 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."); }
  16388. 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); }
  16389. 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; }
  16390. function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; }
  16391. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  16392. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  16393. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  16394. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  16395. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  16396. 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); }; }
  16397. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  16398. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  16399. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  16400. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  16401. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16402. 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); } }
  16403. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  16404. var XMLParserErrorCode = {
  16405. NoError: 0,
  16406. EndOfDocument: -1,
  16407. UnterminatedCdat: -2,
  16408. UnterminatedXmlDeclaration: -3,
  16409. UnterminatedDoctypeDeclaration: -4,
  16410. UnterminatedComment: -5,
  16411. MalformedElement: -6,
  16412. OutOfMemory: -7,
  16413. UnterminatedAttributeValue: -8,
  16414. UnterminatedElement: -9,
  16415. ElementNeverBegun: -10
  16416. };
  16417. function isWhitespace(s, index) {
  16418. var ch = s[index];
  16419. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  16420. }
  16421. function isWhitespaceString(s) {
  16422. for (var i = 0, ii = s.length; i < ii; i++) {
  16423. if (!isWhitespace(s, i)) {
  16424. return false;
  16425. }
  16426. }
  16427. return true;
  16428. }
  16429. var XMLParserBase = /*#__PURE__*/function () {
  16430. function XMLParserBase() {
  16431. _classCallCheck(this, XMLParserBase);
  16432. }
  16433. _createClass(XMLParserBase, [{
  16434. key: "_resolveEntities",
  16435. value: function _resolveEntities(s) {
  16436. var _this = this;
  16437. return s.replace(/&([^;]+);/g, function (all, entity) {
  16438. if (entity.substring(0, 2) === "#x") {
  16439. return String.fromCharCode(parseInt(entity.substring(2), 16));
  16440. } else if (entity.substring(0, 1) === "#") {
  16441. return String.fromCharCode(parseInt(entity.substring(1), 10));
  16442. }
  16443. switch (entity) {
  16444. case "lt":
  16445. return "<";
  16446. case "gt":
  16447. return ">";
  16448. case "amp":
  16449. return "&";
  16450. case "quot":
  16451. return '"';
  16452. }
  16453. return _this.onResolveEntity(entity);
  16454. });
  16455. }
  16456. }, {
  16457. key: "_parseContent",
  16458. value: function _parseContent(s, start) {
  16459. var attributes = [];
  16460. var pos = start;
  16461. function skipWs() {
  16462. while (pos < s.length && isWhitespace(s, pos)) {
  16463. ++pos;
  16464. }
  16465. }
  16466. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  16467. ++pos;
  16468. }
  16469. var name = s.substring(start, pos);
  16470. skipWs();
  16471. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  16472. skipWs();
  16473. var attrName = "",
  16474. attrValue = "";
  16475. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  16476. attrName += s[pos];
  16477. ++pos;
  16478. }
  16479. skipWs();
  16480. if (s[pos] !== "=") {
  16481. return null;
  16482. }
  16483. ++pos;
  16484. skipWs();
  16485. var attrEndChar = s[pos];
  16486. if (attrEndChar !== '"' && attrEndChar !== "'") {
  16487. return null;
  16488. }
  16489. var attrEndIndex = s.indexOf(attrEndChar, ++pos);
  16490. if (attrEndIndex < 0) {
  16491. return null;
  16492. }
  16493. attrValue = s.substring(pos, attrEndIndex);
  16494. attributes.push({
  16495. name: attrName,
  16496. value: this._resolveEntities(attrValue)
  16497. });
  16498. pos = attrEndIndex + 1;
  16499. skipWs();
  16500. }
  16501. return {
  16502. name: name,
  16503. attributes: attributes,
  16504. parsed: pos - start
  16505. };
  16506. }
  16507. }, {
  16508. key: "_parseProcessingInstruction",
  16509. value: function _parseProcessingInstruction(s, start) {
  16510. var pos = start;
  16511. function skipWs() {
  16512. while (pos < s.length && isWhitespace(s, pos)) {
  16513. ++pos;
  16514. }
  16515. }
  16516. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  16517. ++pos;
  16518. }
  16519. var name = s.substring(start, pos);
  16520. skipWs();
  16521. var attrStart = pos;
  16522. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  16523. ++pos;
  16524. }
  16525. var value = s.substring(attrStart, pos);
  16526. return {
  16527. name: name,
  16528. value: value,
  16529. parsed: pos - start
  16530. };
  16531. }
  16532. }, {
  16533. key: "parseXml",
  16534. value: function parseXml(s) {
  16535. var i = 0;
  16536. while (i < s.length) {
  16537. var ch = s[i];
  16538. var j = i;
  16539. if (ch === "<") {
  16540. ++j;
  16541. var ch2 = s[j];
  16542. var q = void 0;
  16543. switch (ch2) {
  16544. case "/":
  16545. ++j;
  16546. q = s.indexOf(">", j);
  16547. if (q < 0) {
  16548. this.onError(XMLParserErrorCode.UnterminatedElement);
  16549. return;
  16550. }
  16551. this.onEndElement(s.substring(j, q));
  16552. j = q + 1;
  16553. break;
  16554. case "?":
  16555. ++j;
  16556. var pi = this._parseProcessingInstruction(s, j);
  16557. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  16558. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  16559. return;
  16560. }
  16561. this.onPi(pi.name, pi.value);
  16562. j += pi.parsed + 2;
  16563. break;
  16564. case "!":
  16565. if (s.substring(j + 1, j + 3) === "--") {
  16566. q = s.indexOf("-->", j + 3);
  16567. if (q < 0) {
  16568. this.onError(XMLParserErrorCode.UnterminatedComment);
  16569. return;
  16570. }
  16571. this.onComment(s.substring(j + 3, q));
  16572. j = q + 3;
  16573. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  16574. q = s.indexOf("]]>", j + 8);
  16575. if (q < 0) {
  16576. this.onError(XMLParserErrorCode.UnterminatedCdat);
  16577. return;
  16578. }
  16579. this.onCdata(s.substring(j + 8, q));
  16580. j = q + 3;
  16581. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  16582. var q2 = s.indexOf("[", j + 8);
  16583. var complexDoctype = false;
  16584. q = s.indexOf(">", j + 8);
  16585. if (q < 0) {
  16586. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  16587. return;
  16588. }
  16589. if (q2 > 0 && q > q2) {
  16590. q = s.indexOf("]>", j + 8);
  16591. if (q < 0) {
  16592. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  16593. return;
  16594. }
  16595. complexDoctype = true;
  16596. }
  16597. var doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  16598. this.onDoctype(doctypeContent);
  16599. j = q + (complexDoctype ? 2 : 1);
  16600. } else {
  16601. this.onError(XMLParserErrorCode.MalformedElement);
  16602. return;
  16603. }
  16604. break;
  16605. default:
  16606. var content = this._parseContent(s, j);
  16607. if (content === null) {
  16608. this.onError(XMLParserErrorCode.MalformedElement);
  16609. return;
  16610. }
  16611. var isClosed = false;
  16612. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  16613. isClosed = true;
  16614. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  16615. this.onError(XMLParserErrorCode.UnterminatedElement);
  16616. return;
  16617. }
  16618. this.onBeginElement(content.name, content.attributes, isClosed);
  16619. j += content.parsed + (isClosed ? 2 : 1);
  16620. break;
  16621. }
  16622. } else {
  16623. while (j < s.length && s[j] !== "<") {
  16624. j++;
  16625. }
  16626. var text = s.substring(i, j);
  16627. this.onText(this._resolveEntities(text));
  16628. }
  16629. i = j;
  16630. }
  16631. }
  16632. }, {
  16633. key: "onResolveEntity",
  16634. value: function onResolveEntity(name) {
  16635. return "&".concat(name, ";");
  16636. }
  16637. }, {
  16638. key: "onPi",
  16639. value: function onPi(name, value) {}
  16640. }, {
  16641. key: "onComment",
  16642. value: function onComment(text) {}
  16643. }, {
  16644. key: "onCdata",
  16645. value: function onCdata(text) {}
  16646. }, {
  16647. key: "onDoctype",
  16648. value: function onDoctype(doctypeContent) {}
  16649. }, {
  16650. key: "onText",
  16651. value: function onText(text) {}
  16652. }, {
  16653. key: "onBeginElement",
  16654. value: function onBeginElement(name, attributes, isEmpty) {}
  16655. }, {
  16656. key: "onEndElement",
  16657. value: function onEndElement(name) {}
  16658. }, {
  16659. key: "onError",
  16660. value: function onError(code) {}
  16661. }]);
  16662. return XMLParserBase;
  16663. }();
  16664. var SimpleDOMNode = /*#__PURE__*/function () {
  16665. function SimpleDOMNode(nodeName, nodeValue) {
  16666. _classCallCheck(this, SimpleDOMNode);
  16667. this.nodeName = nodeName;
  16668. this.nodeValue = nodeValue;
  16669. Object.defineProperty(this, "parentNode", {
  16670. value: null,
  16671. writable: true
  16672. });
  16673. }
  16674. _createClass(SimpleDOMNode, [{
  16675. key: "hasChildNodes",
  16676. value: function hasChildNodes() {
  16677. return this.childNodes && this.childNodes.length > 0;
  16678. }
  16679. }, {
  16680. key: "firstChild",
  16681. get: function get() {
  16682. return this.childNodes && this.childNodes[0];
  16683. }
  16684. }, {
  16685. key: "nextSibling",
  16686. get: function get() {
  16687. var childNodes = this.parentNode.childNodes;
  16688. if (!childNodes) {
  16689. return undefined;
  16690. }
  16691. var index = childNodes.indexOf(this);
  16692. if (index === -1) {
  16693. return undefined;
  16694. }
  16695. return childNodes[index + 1];
  16696. }
  16697. }, {
  16698. key: "textContent",
  16699. get: function get() {
  16700. if (!this.childNodes) {
  16701. return this.nodeValue || "";
  16702. }
  16703. return this.childNodes.map(function (child) {
  16704. return child.textContent;
  16705. }).join("");
  16706. }
  16707. }]);
  16708. return SimpleDOMNode;
  16709. }();
  16710. var SimpleXMLParser = /*#__PURE__*/function (_XMLParserBase) {
  16711. _inherits(SimpleXMLParser, _XMLParserBase);
  16712. var _super = _createSuper(SimpleXMLParser);
  16713. function SimpleXMLParser() {
  16714. var _this2;
  16715. _classCallCheck(this, SimpleXMLParser);
  16716. _this2 = _super.call(this);
  16717. _this2._currentFragment = null;
  16718. _this2._stack = null;
  16719. _this2._errorCode = XMLParserErrorCode.NoError;
  16720. return _this2;
  16721. }
  16722. _createClass(SimpleXMLParser, [{
  16723. key: "parseFromString",
  16724. value: function parseFromString(data) {
  16725. this._currentFragment = [];
  16726. this._stack = [];
  16727. this._errorCode = XMLParserErrorCode.NoError;
  16728. this.parseXml(data);
  16729. if (this._errorCode !== XMLParserErrorCode.NoError) {
  16730. return undefined;
  16731. }
  16732. var _this$_currentFragmen = _slicedToArray(this._currentFragment, 1),
  16733. documentElement = _this$_currentFragmen[0];
  16734. if (!documentElement) {
  16735. return undefined;
  16736. }
  16737. return {
  16738. documentElement: documentElement
  16739. };
  16740. }
  16741. }, {
  16742. key: "onResolveEntity",
  16743. value: function onResolveEntity(name) {
  16744. switch (name) {
  16745. case "apos":
  16746. return "'";
  16747. }
  16748. return _get(_getPrototypeOf(SimpleXMLParser.prototype), "onResolveEntity", this).call(this, name);
  16749. }
  16750. }, {
  16751. key: "onText",
  16752. value: function onText(text) {
  16753. if (isWhitespaceString(text)) {
  16754. return;
  16755. }
  16756. var node = new SimpleDOMNode("#text", text);
  16757. this._currentFragment.push(node);
  16758. }
  16759. }, {
  16760. key: "onCdata",
  16761. value: function onCdata(text) {
  16762. var node = new SimpleDOMNode("#text", text);
  16763. this._currentFragment.push(node);
  16764. }
  16765. }, {
  16766. key: "onBeginElement",
  16767. value: function onBeginElement(name, attributes, isEmpty) {
  16768. var node = new SimpleDOMNode(name);
  16769. node.childNodes = [];
  16770. this._currentFragment.push(node);
  16771. if (isEmpty) {
  16772. return;
  16773. }
  16774. this._stack.push(this._currentFragment);
  16775. this._currentFragment = node.childNodes;
  16776. }
  16777. }, {
  16778. key: "onEndElement",
  16779. value: function onEndElement(name) {
  16780. this._currentFragment = this._stack.pop() || [];
  16781. var lastElement = this._currentFragment[this._currentFragment.length - 1];
  16782. if (!lastElement) {
  16783. return;
  16784. }
  16785. for (var i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  16786. lastElement.childNodes[i].parentNode = lastElement;
  16787. }
  16788. }
  16789. }, {
  16790. key: "onError",
  16791. value: function onError(code) {
  16792. this._errorCode = code;
  16793. }
  16794. }]);
  16795. return SimpleXMLParser;
  16796. }(XMLParserBase);
  16797. exports.SimpleXMLParser = SimpleXMLParser;
  16798. /***/ }),
  16799. /* 207 */
  16800. /***/ (function(module, exports, __w_pdfjs_require__) {
  16801. "use strict";
  16802. Object.defineProperty(exports, "__esModule", {
  16803. value: true
  16804. });
  16805. exports.PDFDataTransportStream = void 0;
  16806. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  16807. var _util = __w_pdfjs_require__(5);
  16808. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  16809. 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); } }
  16810. 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); }); }; }
  16811. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  16812. 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); }
  16813. 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; }
  16814. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  16815. 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); } }
  16816. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  16817. var PDFDataTransportStream = /*#__PURE__*/function () {
  16818. function PDFDataTransportStream(params, pdfDataRangeTransport) {
  16819. var _this = this;
  16820. _classCallCheck(this, PDFDataTransportStream);
  16821. (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
  16822. this._queuedChunks = [];
  16823. this._progressiveDone = params.progressiveDone || false;
  16824. var initialData = params.initialData;
  16825. if (initialData && initialData.length > 0) {
  16826. var buffer = new Uint8Array(initialData).buffer;
  16827. this._queuedChunks.push(buffer);
  16828. }
  16829. this._pdfDataRangeTransport = pdfDataRangeTransport;
  16830. this._isStreamingSupported = !params.disableStream;
  16831. this._isRangeSupported = !params.disableRange;
  16832. this._contentLength = params.length;
  16833. this._fullRequestReader = null;
  16834. this._rangeReaders = [];
  16835. this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
  16836. _this._onReceiveData({
  16837. begin: begin,
  16838. chunk: chunk
  16839. });
  16840. });
  16841. this._pdfDataRangeTransport.addProgressListener(function (loaded, total) {
  16842. _this._onProgress({
  16843. loaded: loaded,
  16844. total: total
  16845. });
  16846. });
  16847. this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
  16848. _this._onReceiveData({
  16849. chunk: chunk
  16850. });
  16851. });
  16852. this._pdfDataRangeTransport.addProgressiveDoneListener(function () {
  16853. _this._onProgressiveDone();
  16854. });
  16855. this._pdfDataRangeTransport.transportReady();
  16856. }
  16857. _createClass(PDFDataTransportStream, [{
  16858. key: "_onReceiveData",
  16859. value: function _onReceiveData(args) {
  16860. var buffer = new Uint8Array(args.chunk).buffer;
  16861. if (args.begin === undefined) {
  16862. if (this._fullRequestReader) {
  16863. this._fullRequestReader._enqueue(buffer);
  16864. } else {
  16865. this._queuedChunks.push(buffer);
  16866. }
  16867. } else {
  16868. var found = this._rangeReaders.some(function (rangeReader) {
  16869. if (rangeReader._begin !== args.begin) {
  16870. return false;
  16871. }
  16872. rangeReader._enqueue(buffer);
  16873. return true;
  16874. });
  16875. (0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
  16876. }
  16877. }
  16878. }, {
  16879. key: "_onProgress",
  16880. value: function _onProgress(evt) {
  16881. if (evt.total === undefined) {
  16882. var firstReader = this._rangeReaders[0];
  16883. if (firstReader && firstReader.onProgress) {
  16884. firstReader.onProgress({
  16885. loaded: evt.loaded
  16886. });
  16887. }
  16888. } else {
  16889. var fullReader = this._fullRequestReader;
  16890. if (fullReader && fullReader.onProgress) {
  16891. fullReader.onProgress({
  16892. loaded: evt.loaded,
  16893. total: evt.total
  16894. });
  16895. }
  16896. }
  16897. }
  16898. }, {
  16899. key: "_onProgressiveDone",
  16900. value: function _onProgressiveDone() {
  16901. if (this._fullRequestReader) {
  16902. this._fullRequestReader.progressiveDone();
  16903. }
  16904. this._progressiveDone = true;
  16905. }
  16906. }, {
  16907. key: "_removeRangeReader",
  16908. value: function _removeRangeReader(reader) {
  16909. var i = this._rangeReaders.indexOf(reader);
  16910. if (i >= 0) {
  16911. this._rangeReaders.splice(i, 1);
  16912. }
  16913. }
  16914. }, {
  16915. key: "getFullReader",
  16916. value: function getFullReader() {
  16917. (0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
  16918. var queuedChunks = this._queuedChunks;
  16919. this._queuedChunks = null;
  16920. return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone);
  16921. }
  16922. }, {
  16923. key: "getRangeReader",
  16924. value: function getRangeReader(begin, end) {
  16925. if (end <= this._progressiveDataLength) {
  16926. return null;
  16927. }
  16928. var reader = new PDFDataTransportStreamRangeReader(this, begin, end);
  16929. this._pdfDataRangeTransport.requestDataRange(begin, end);
  16930. this._rangeReaders.push(reader);
  16931. return reader;
  16932. }
  16933. }, {
  16934. key: "cancelAllRequests",
  16935. value: function cancelAllRequests(reason) {
  16936. if (this._fullRequestReader) {
  16937. this._fullRequestReader.cancel(reason);
  16938. }
  16939. var readers = this._rangeReaders.slice(0);
  16940. readers.forEach(function (rangeReader) {
  16941. rangeReader.cancel(reason);
  16942. });
  16943. this._pdfDataRangeTransport.abort();
  16944. }
  16945. }, {
  16946. key: "_progressiveDataLength",
  16947. get: function get() {
  16948. return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
  16949. }
  16950. }]);
  16951. return PDFDataTransportStream;
  16952. }();
  16953. exports.PDFDataTransportStream = PDFDataTransportStream;
  16954. var PDFDataTransportStreamReader = /*#__PURE__*/function () {
  16955. function PDFDataTransportStreamReader(stream, queuedChunks) {
  16956. var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  16957. _classCallCheck(this, PDFDataTransportStreamReader);
  16958. this._stream = stream;
  16959. this._done = progressiveDone || false;
  16960. this._filename = null;
  16961. this._queuedChunks = queuedChunks || [];
  16962. this._loaded = 0;
  16963. var _iterator = _createForOfIteratorHelper(this._queuedChunks),
  16964. _step;
  16965. try {
  16966. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  16967. var chunk = _step.value;
  16968. this._loaded += chunk.byteLength;
  16969. }
  16970. } catch (err) {
  16971. _iterator.e(err);
  16972. } finally {
  16973. _iterator.f();
  16974. }
  16975. this._requests = [];
  16976. this._headersReady = Promise.resolve();
  16977. stream._fullRequestReader = this;
  16978. this.onProgress = null;
  16979. }
  16980. _createClass(PDFDataTransportStreamReader, [{
  16981. key: "_enqueue",
  16982. value: function _enqueue(chunk) {
  16983. if (this._done) {
  16984. return;
  16985. }
  16986. if (this._requests.length > 0) {
  16987. var requestCapability = this._requests.shift();
  16988. requestCapability.resolve({
  16989. value: chunk,
  16990. done: false
  16991. });
  16992. } else {
  16993. this._queuedChunks.push(chunk);
  16994. }
  16995. this._loaded += chunk.byteLength;
  16996. }
  16997. }, {
  16998. key: "read",
  16999. value: function () {
  17000. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  17001. var chunk, requestCapability;
  17002. return _regenerator["default"].wrap(function _callee$(_context) {
  17003. while (1) {
  17004. switch (_context.prev = _context.next) {
  17005. case 0:
  17006. if (!(this._queuedChunks.length > 0)) {
  17007. _context.next = 3;
  17008. break;
  17009. }
  17010. chunk = this._queuedChunks.shift();
  17011. return _context.abrupt("return", {
  17012. value: chunk,
  17013. done: false
  17014. });
  17015. case 3:
  17016. if (!this._done) {
  17017. _context.next = 5;
  17018. break;
  17019. }
  17020. return _context.abrupt("return", {
  17021. value: undefined,
  17022. done: true
  17023. });
  17024. case 5:
  17025. requestCapability = (0, _util.createPromiseCapability)();
  17026. this._requests.push(requestCapability);
  17027. return _context.abrupt("return", requestCapability.promise);
  17028. case 8:
  17029. case "end":
  17030. return _context.stop();
  17031. }
  17032. }
  17033. }, _callee, this);
  17034. }));
  17035. function read() {
  17036. return _read.apply(this, arguments);
  17037. }
  17038. return read;
  17039. }()
  17040. }, {
  17041. key: "cancel",
  17042. value: function cancel(reason) {
  17043. this._done = true;
  17044. this._requests.forEach(function (requestCapability) {
  17045. requestCapability.resolve({
  17046. value: undefined,
  17047. done: true
  17048. });
  17049. });
  17050. this._requests = [];
  17051. }
  17052. }, {
  17053. key: "progressiveDone",
  17054. value: function progressiveDone() {
  17055. if (this._done) {
  17056. return;
  17057. }
  17058. this._done = true;
  17059. }
  17060. }, {
  17061. key: "headersReady",
  17062. get: function get() {
  17063. return this._headersReady;
  17064. }
  17065. }, {
  17066. key: "filename",
  17067. get: function get() {
  17068. return this._filename;
  17069. }
  17070. }, {
  17071. key: "isRangeSupported",
  17072. get: function get() {
  17073. return this._stream._isRangeSupported;
  17074. }
  17075. }, {
  17076. key: "isStreamingSupported",
  17077. get: function get() {
  17078. return this._stream._isStreamingSupported;
  17079. }
  17080. }, {
  17081. key: "contentLength",
  17082. get: function get() {
  17083. return this._stream._contentLength;
  17084. }
  17085. }]);
  17086. return PDFDataTransportStreamReader;
  17087. }();
  17088. var PDFDataTransportStreamRangeReader = /*#__PURE__*/function () {
  17089. function PDFDataTransportStreamRangeReader(stream, begin, end) {
  17090. _classCallCheck(this, PDFDataTransportStreamRangeReader);
  17091. this._stream = stream;
  17092. this._begin = begin;
  17093. this._end = end;
  17094. this._queuedChunk = null;
  17095. this._requests = [];
  17096. this._done = false;
  17097. this.onProgress = null;
  17098. }
  17099. _createClass(PDFDataTransportStreamRangeReader, [{
  17100. key: "_enqueue",
  17101. value: function _enqueue(chunk) {
  17102. if (this._done) {
  17103. return;
  17104. }
  17105. if (this._requests.length === 0) {
  17106. this._queuedChunk = chunk;
  17107. } else {
  17108. var requestsCapability = this._requests.shift();
  17109. requestsCapability.resolve({
  17110. value: chunk,
  17111. done: false
  17112. });
  17113. this._requests.forEach(function (requestCapability) {
  17114. requestCapability.resolve({
  17115. value: undefined,
  17116. done: true
  17117. });
  17118. });
  17119. this._requests = [];
  17120. }
  17121. this._done = true;
  17122. this._stream._removeRangeReader(this);
  17123. }
  17124. }, {
  17125. key: "read",
  17126. value: function () {
  17127. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  17128. var chunk, requestCapability;
  17129. return _regenerator["default"].wrap(function _callee2$(_context2) {
  17130. while (1) {
  17131. switch (_context2.prev = _context2.next) {
  17132. case 0:
  17133. if (!this._queuedChunk) {
  17134. _context2.next = 4;
  17135. break;
  17136. }
  17137. chunk = this._queuedChunk;
  17138. this._queuedChunk = null;
  17139. return _context2.abrupt("return", {
  17140. value: chunk,
  17141. done: false
  17142. });
  17143. case 4:
  17144. if (!this._done) {
  17145. _context2.next = 6;
  17146. break;
  17147. }
  17148. return _context2.abrupt("return", {
  17149. value: undefined,
  17150. done: true
  17151. });
  17152. case 6:
  17153. requestCapability = (0, _util.createPromiseCapability)();
  17154. this._requests.push(requestCapability);
  17155. return _context2.abrupt("return", requestCapability.promise);
  17156. case 9:
  17157. case "end":
  17158. return _context2.stop();
  17159. }
  17160. }
  17161. }, _callee2, this);
  17162. }));
  17163. function read() {
  17164. return _read2.apply(this, arguments);
  17165. }
  17166. return read;
  17167. }()
  17168. }, {
  17169. key: "cancel",
  17170. value: function cancel(reason) {
  17171. this._done = true;
  17172. this._requests.forEach(function (requestCapability) {
  17173. requestCapability.resolve({
  17174. value: undefined,
  17175. done: true
  17176. });
  17177. });
  17178. this._requests = [];
  17179. this._stream._removeRangeReader(this);
  17180. }
  17181. }, {
  17182. key: "isStreamingSupported",
  17183. get: function get() {
  17184. return false;
  17185. }
  17186. }]);
  17187. return PDFDataTransportStreamRangeReader;
  17188. }();
  17189. /***/ }),
  17190. /* 208 */
  17191. /***/ (function(module, exports, __w_pdfjs_require__) {
  17192. "use strict";
  17193. Object.defineProperty(exports, "__esModule", {
  17194. value: true
  17195. });
  17196. exports.WebGLContext = void 0;
  17197. var _util = __w_pdfjs_require__(5);
  17198. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17199. 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); } }
  17200. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  17201. var WebGLContext = /*#__PURE__*/function () {
  17202. function WebGLContext(_ref) {
  17203. var _ref$enable = _ref.enable,
  17204. enable = _ref$enable === void 0 ? false : _ref$enable;
  17205. _classCallCheck(this, WebGLContext);
  17206. this._enabled = enable === true;
  17207. }
  17208. _createClass(WebGLContext, [{
  17209. key: "composeSMask",
  17210. value: function composeSMask(_ref2) {
  17211. var layer = _ref2.layer,
  17212. mask = _ref2.mask,
  17213. properties = _ref2.properties;
  17214. return WebGLUtils.composeSMask(layer, mask, properties);
  17215. }
  17216. }, {
  17217. key: "drawFigures",
  17218. value: function drawFigures(_ref3) {
  17219. var width = _ref3.width,
  17220. height = _ref3.height,
  17221. backgroundColor = _ref3.backgroundColor,
  17222. figures = _ref3.figures,
  17223. context = _ref3.context;
  17224. return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context);
  17225. }
  17226. }, {
  17227. key: "clear",
  17228. value: function clear() {
  17229. WebGLUtils.cleanup();
  17230. }
  17231. }, {
  17232. key: "isEnabled",
  17233. get: function get() {
  17234. var enabled = this._enabled;
  17235. if (enabled) {
  17236. enabled = WebGLUtils.tryInitGL();
  17237. }
  17238. return (0, _util.shadow)(this, "isEnabled", enabled);
  17239. }
  17240. }]);
  17241. return WebGLContext;
  17242. }();
  17243. exports.WebGLContext = WebGLContext;
  17244. var WebGLUtils = function WebGLUtilsClosure() {
  17245. function loadShader(gl, code, shaderType) {
  17246. var shader = gl.createShader(shaderType);
  17247. gl.shaderSource(shader, code);
  17248. gl.compileShader(shader);
  17249. var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
  17250. if (!compiled) {
  17251. var errorMsg = gl.getShaderInfoLog(shader);
  17252. throw new Error("Error during shader compilation: " + errorMsg);
  17253. }
  17254. return shader;
  17255. }
  17256. function createVertexShader(gl, code) {
  17257. return loadShader(gl, code, gl.VERTEX_SHADER);
  17258. }
  17259. function createFragmentShader(gl, code) {
  17260. return loadShader(gl, code, gl.FRAGMENT_SHADER);
  17261. }
  17262. function createProgram(gl, shaders) {
  17263. var program = gl.createProgram();
  17264. for (var i = 0, ii = shaders.length; i < ii; ++i) {
  17265. gl.attachShader(program, shaders[i]);
  17266. }
  17267. gl.linkProgram(program);
  17268. var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
  17269. if (!linked) {
  17270. var errorMsg = gl.getProgramInfoLog(program);
  17271. throw new Error("Error during program linking: " + errorMsg);
  17272. }
  17273. return program;
  17274. }
  17275. function createTexture(gl, image, textureId) {
  17276. gl.activeTexture(textureId);
  17277. var texture = gl.createTexture();
  17278. gl.bindTexture(gl.TEXTURE_2D, texture);
  17279. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
  17280. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
  17281. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
  17282. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
  17283. gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
  17284. return texture;
  17285. }
  17286. var currentGL, currentCanvas;
  17287. function generateGL() {
  17288. if (currentGL) {
  17289. return;
  17290. }
  17291. currentCanvas = document.createElement("canvas");
  17292. currentGL = currentCanvas.getContext("webgl", {
  17293. premultipliedalpha: false
  17294. });
  17295. }
  17296. var smaskVertexShaderCode = "\
  17297. attribute vec2 a_position; \
  17298. attribute vec2 a_texCoord; \
  17299. \
  17300. uniform vec2 u_resolution; \
  17301. \
  17302. varying vec2 v_texCoord; \
  17303. \
  17304. void main() { \
  17305. vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \
  17306. gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
  17307. \
  17308. v_texCoord = a_texCoord; \
  17309. } ";
  17310. var smaskFragmentShaderCode = "\
  17311. precision mediump float; \
  17312. \
  17313. uniform vec4 u_backdrop; \
  17314. uniform int u_subtype; \
  17315. uniform sampler2D u_image; \
  17316. uniform sampler2D u_mask; \
  17317. \
  17318. varying vec2 v_texCoord; \
  17319. \
  17320. void main() { \
  17321. vec4 imageColor = texture2D(u_image, v_texCoord); \
  17322. vec4 maskColor = texture2D(u_mask, v_texCoord); \
  17323. if (u_backdrop.a > 0.0) { \
  17324. maskColor.rgb = maskColor.rgb * maskColor.a + \
  17325. u_backdrop.rgb * (1.0 - maskColor.a); \
  17326. } \
  17327. float lum; \
  17328. if (u_subtype == 0) { \
  17329. lum = maskColor.a; \
  17330. } else { \
  17331. lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \
  17332. maskColor.b * 0.11; \
  17333. } \
  17334. imageColor.a *= lum; \
  17335. imageColor.rgb *= imageColor.a; \
  17336. gl_FragColor = imageColor; \
  17337. } ";
  17338. var smaskCache = null;
  17339. function initSmaskGL() {
  17340. var canvas, gl;
  17341. generateGL();
  17342. canvas = currentCanvas;
  17343. currentCanvas = null;
  17344. gl = currentGL;
  17345. currentGL = null;
  17346. var vertexShader = createVertexShader(gl, smaskVertexShaderCode);
  17347. var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode);
  17348. var program = createProgram(gl, [vertexShader, fragmentShader]);
  17349. gl.useProgram(program);
  17350. var cache = {};
  17351. cache.gl = gl;
  17352. cache.canvas = canvas;
  17353. cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution");
  17354. cache.positionLocation = gl.getAttribLocation(program, "a_position");
  17355. cache.backdropLocation = gl.getUniformLocation(program, "u_backdrop");
  17356. cache.subtypeLocation = gl.getUniformLocation(program, "u_subtype");
  17357. var texCoordLocation = gl.getAttribLocation(program, "a_texCoord");
  17358. var texLayerLocation = gl.getUniformLocation(program, "u_image");
  17359. var texMaskLocation = gl.getUniformLocation(program, "u_mask");
  17360. var texCoordBuffer = gl.createBuffer();
  17361. gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
  17362. gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW);
  17363. gl.enableVertexAttribArray(texCoordLocation);
  17364. gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0);
  17365. gl.uniform1i(texLayerLocation, 0);
  17366. gl.uniform1i(texMaskLocation, 1);
  17367. smaskCache = cache;
  17368. }
  17369. function composeSMask(layer, mask, properties) {
  17370. var width = layer.width,
  17371. height = layer.height;
  17372. if (!smaskCache) {
  17373. initSmaskGL();
  17374. }
  17375. var cache = smaskCache,
  17376. canvas = cache.canvas,
  17377. gl = cache.gl;
  17378. canvas.width = width;
  17379. canvas.height = height;
  17380. gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
  17381. gl.uniform2f(cache.resolutionLocation, width, height);
  17382. if (properties.backdrop) {
  17383. gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1);
  17384. } else {
  17385. gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0);
  17386. }
  17387. gl.uniform1i(cache.subtypeLocation, properties.subtype === "Luminosity" ? 1 : 0);
  17388. var texture = createTexture(gl, layer, gl.TEXTURE0);
  17389. var maskTexture = createTexture(gl, mask, gl.TEXTURE1);
  17390. var buffer = gl.createBuffer();
  17391. gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
  17392. gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW);
  17393. gl.enableVertexAttribArray(cache.positionLocation);
  17394. gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
  17395. gl.clearColor(0, 0, 0, 0);
  17396. gl.enable(gl.BLEND);
  17397. gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
  17398. gl.clear(gl.COLOR_BUFFER_BIT);
  17399. gl.drawArrays(gl.TRIANGLES, 0, 6);
  17400. gl.flush();
  17401. gl.deleteTexture(texture);
  17402. gl.deleteTexture(maskTexture);
  17403. gl.deleteBuffer(buffer);
  17404. return canvas;
  17405. }
  17406. var figuresVertexShaderCode = "\
  17407. attribute vec2 a_position; \
  17408. attribute vec3 a_color; \
  17409. \
  17410. uniform vec2 u_resolution; \
  17411. uniform vec2 u_scale; \
  17412. uniform vec2 u_offset; \
  17413. \
  17414. varying vec4 v_color; \
  17415. \
  17416. void main() { \
  17417. vec2 position = (a_position + u_offset) * u_scale; \
  17418. vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \
  17419. gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \
  17420. \
  17421. v_color = vec4(a_color / 255.0, 1.0); \
  17422. } ";
  17423. var figuresFragmentShaderCode = "\
  17424. precision mediump float; \
  17425. \
  17426. varying vec4 v_color; \
  17427. \
  17428. void main() { \
  17429. gl_FragColor = v_color; \
  17430. } ";
  17431. var figuresCache = null;
  17432. function initFiguresGL() {
  17433. var canvas, gl;
  17434. generateGL();
  17435. canvas = currentCanvas;
  17436. currentCanvas = null;
  17437. gl = currentGL;
  17438. currentGL = null;
  17439. var vertexShader = createVertexShader(gl, figuresVertexShaderCode);
  17440. var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode);
  17441. var program = createProgram(gl, [vertexShader, fragmentShader]);
  17442. gl.useProgram(program);
  17443. var cache = {};
  17444. cache.gl = gl;
  17445. cache.canvas = canvas;
  17446. cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution");
  17447. cache.scaleLocation = gl.getUniformLocation(program, "u_scale");
  17448. cache.offsetLocation = gl.getUniformLocation(program, "u_offset");
  17449. cache.positionLocation = gl.getAttribLocation(program, "a_position");
  17450. cache.colorLocation = gl.getAttribLocation(program, "a_color");
  17451. figuresCache = cache;
  17452. }
  17453. function drawFigures(width, height, backgroundColor, figures, context) {
  17454. if (!figuresCache) {
  17455. initFiguresGL();
  17456. }
  17457. var cache = figuresCache,
  17458. canvas = cache.canvas,
  17459. gl = cache.gl;
  17460. canvas.width = width;
  17461. canvas.height = height;
  17462. gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
  17463. gl.uniform2f(cache.resolutionLocation, width, height);
  17464. var count = 0;
  17465. var i, ii, rows;
  17466. for (i = 0, ii = figures.length; i < ii; i++) {
  17467. switch (figures[i].type) {
  17468. case "lattice":
  17469. rows = figures[i].coords.length / figures[i].verticesPerRow | 0;
  17470. count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6;
  17471. break;
  17472. case "triangles":
  17473. count += figures[i].coords.length;
  17474. break;
  17475. }
  17476. }
  17477. var coords = new Float32Array(count * 2);
  17478. var colors = new Uint8Array(count * 3);
  17479. var coordsMap = context.coords,
  17480. colorsMap = context.colors;
  17481. var pIndex = 0,
  17482. cIndex = 0;
  17483. for (i = 0, ii = figures.length; i < ii; i++) {
  17484. var figure = figures[i],
  17485. ps = figure.coords,
  17486. cs = figure.colors;
  17487. switch (figure.type) {
  17488. case "lattice":
  17489. var cols = figure.verticesPerRow;
  17490. rows = ps.length / cols | 0;
  17491. for (var row = 1; row < rows; row++) {
  17492. var offset = row * cols + 1;
  17493. for (var col = 1; col < cols; col++, offset++) {
  17494. coords[pIndex] = coordsMap[ps[offset - cols - 1]];
  17495. coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1];
  17496. coords[pIndex + 2] = coordsMap[ps[offset - cols]];
  17497. coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1];
  17498. coords[pIndex + 4] = coordsMap[ps[offset - 1]];
  17499. coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1];
  17500. colors[cIndex] = colorsMap[cs[offset - cols - 1]];
  17501. colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1];
  17502. colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2];
  17503. colors[cIndex + 3] = colorsMap[cs[offset - cols]];
  17504. colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1];
  17505. colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2];
  17506. colors[cIndex + 6] = colorsMap[cs[offset - 1]];
  17507. colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1];
  17508. colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2];
  17509. coords[pIndex + 6] = coords[pIndex + 2];
  17510. coords[pIndex + 7] = coords[pIndex + 3];
  17511. coords[pIndex + 8] = coords[pIndex + 4];
  17512. coords[pIndex + 9] = coords[pIndex + 5];
  17513. coords[pIndex + 10] = coordsMap[ps[offset]];
  17514. coords[pIndex + 11] = coordsMap[ps[offset] + 1];
  17515. colors[cIndex + 9] = colors[cIndex + 3];
  17516. colors[cIndex + 10] = colors[cIndex + 4];
  17517. colors[cIndex + 11] = colors[cIndex + 5];
  17518. colors[cIndex + 12] = colors[cIndex + 6];
  17519. colors[cIndex + 13] = colors[cIndex + 7];
  17520. colors[cIndex + 14] = colors[cIndex + 8];
  17521. colors[cIndex + 15] = colorsMap[cs[offset]];
  17522. colors[cIndex + 16] = colorsMap[cs[offset] + 1];
  17523. colors[cIndex + 17] = colorsMap[cs[offset] + 2];
  17524. pIndex += 12;
  17525. cIndex += 18;
  17526. }
  17527. }
  17528. break;
  17529. case "triangles":
  17530. for (var j = 0, jj = ps.length; j < jj; j++) {
  17531. coords[pIndex] = coordsMap[ps[j]];
  17532. coords[pIndex + 1] = coordsMap[ps[j] + 1];
  17533. colors[cIndex] = colorsMap[cs[j]];
  17534. colors[cIndex + 1] = colorsMap[cs[j] + 1];
  17535. colors[cIndex + 2] = colorsMap[cs[j] + 2];
  17536. pIndex += 2;
  17537. cIndex += 3;
  17538. }
  17539. break;
  17540. }
  17541. }
  17542. if (backgroundColor) {
  17543. gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0);
  17544. } else {
  17545. gl.clearColor(0, 0, 0, 0);
  17546. }
  17547. gl.clear(gl.COLOR_BUFFER_BIT);
  17548. var coordsBuffer = gl.createBuffer();
  17549. gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer);
  17550. gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW);
  17551. gl.enableVertexAttribArray(cache.positionLocation);
  17552. gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0);
  17553. var colorsBuffer = gl.createBuffer();
  17554. gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer);
  17555. gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
  17556. gl.enableVertexAttribArray(cache.colorLocation);
  17557. gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0);
  17558. gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY);
  17559. gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY);
  17560. gl.drawArrays(gl.TRIANGLES, 0, count);
  17561. gl.flush();
  17562. gl.deleteBuffer(coordsBuffer);
  17563. gl.deleteBuffer(colorsBuffer);
  17564. return canvas;
  17565. }
  17566. return {
  17567. tryInitGL: function tryInitGL() {
  17568. try {
  17569. generateGL();
  17570. return !!currentGL;
  17571. } catch (ex) {}
  17572. return false;
  17573. },
  17574. composeSMask: composeSMask,
  17575. drawFigures: drawFigures,
  17576. cleanup: function cleanup() {
  17577. if (smaskCache && smaskCache.canvas) {
  17578. smaskCache.canvas.width = 0;
  17579. smaskCache.canvas.height = 0;
  17580. }
  17581. if (figuresCache && figuresCache.canvas) {
  17582. figuresCache.canvas.width = 0;
  17583. figuresCache.canvas.height = 0;
  17584. }
  17585. smaskCache = null;
  17586. figuresCache = null;
  17587. }
  17588. };
  17589. }();
  17590. /***/ }),
  17591. /* 209 */
  17592. /***/ (function(module, exports, __w_pdfjs_require__) {
  17593. "use strict";
  17594. Object.defineProperty(exports, "__esModule", {
  17595. value: true
  17596. });
  17597. exports.AnnotationLayer = void 0;
  17598. var _display_utils = __w_pdfjs_require__(1);
  17599. var _util = __w_pdfjs_require__(5);
  17600. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  17601. 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); }
  17602. 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; }
  17603. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  17604. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  17605. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  17606. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  17607. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  17608. 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); }; }
  17609. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  17610. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  17611. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  17612. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  17613. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  17614. 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); } }
  17615. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  17616. var AnnotationElementFactory = /*#__PURE__*/function () {
  17617. function AnnotationElementFactory() {
  17618. _classCallCheck(this, AnnotationElementFactory);
  17619. }
  17620. _createClass(AnnotationElementFactory, null, [{
  17621. key: "create",
  17622. value: function create(parameters) {
  17623. var subtype = parameters.data.annotationType;
  17624. switch (subtype) {
  17625. case _util.AnnotationType.LINK:
  17626. return new LinkAnnotationElement(parameters);
  17627. case _util.AnnotationType.TEXT:
  17628. return new TextAnnotationElement(parameters);
  17629. case _util.AnnotationType.WIDGET:
  17630. var fieldType = parameters.data.fieldType;
  17631. switch (fieldType) {
  17632. case "Tx":
  17633. return new TextWidgetAnnotationElement(parameters);
  17634. case "Btn":
  17635. if (parameters.data.radioButton) {
  17636. return new RadioButtonWidgetAnnotationElement(parameters);
  17637. } else if (parameters.data.checkBox) {
  17638. return new CheckboxWidgetAnnotationElement(parameters);
  17639. }
  17640. return new PushButtonWidgetAnnotationElement(parameters);
  17641. case "Ch":
  17642. return new ChoiceWidgetAnnotationElement(parameters);
  17643. }
  17644. return new WidgetAnnotationElement(parameters);
  17645. case _util.AnnotationType.POPUP:
  17646. return new PopupAnnotationElement(parameters);
  17647. case _util.AnnotationType.FREETEXT:
  17648. return new FreeTextAnnotationElement(parameters);
  17649. case _util.AnnotationType.LINE:
  17650. return new LineAnnotationElement(parameters);
  17651. case _util.AnnotationType.SQUARE:
  17652. return new SquareAnnotationElement(parameters);
  17653. case _util.AnnotationType.CIRCLE:
  17654. return new CircleAnnotationElement(parameters);
  17655. case _util.AnnotationType.POLYLINE:
  17656. return new PolylineAnnotationElement(parameters);
  17657. case _util.AnnotationType.CARET:
  17658. return new CaretAnnotationElement(parameters);
  17659. case _util.AnnotationType.INK:
  17660. return new InkAnnotationElement(parameters);
  17661. case _util.AnnotationType.POLYGON:
  17662. return new PolygonAnnotationElement(parameters);
  17663. case _util.AnnotationType.HIGHLIGHT:
  17664. return new HighlightAnnotationElement(parameters);
  17665. case _util.AnnotationType.UNDERLINE:
  17666. return new UnderlineAnnotationElement(parameters);
  17667. case _util.AnnotationType.SQUIGGLY:
  17668. return new SquigglyAnnotationElement(parameters);
  17669. case _util.AnnotationType.STRIKEOUT:
  17670. return new StrikeOutAnnotationElement(parameters);
  17671. case _util.AnnotationType.STAMP:
  17672. return new StampAnnotationElement(parameters);
  17673. case _util.AnnotationType.FILEATTACHMENT:
  17674. return new FileAttachmentAnnotationElement(parameters);
  17675. default:
  17676. return new AnnotationElement(parameters);
  17677. }
  17678. }
  17679. }]);
  17680. return AnnotationElementFactory;
  17681. }();
  17682. var AnnotationElement = /*#__PURE__*/function () {
  17683. function AnnotationElement(parameters) {
  17684. var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  17685. var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  17686. _classCallCheck(this, AnnotationElement);
  17687. this.isRenderable = isRenderable;
  17688. this.data = parameters.data;
  17689. this.layer = parameters.layer;
  17690. this.page = parameters.page;
  17691. this.viewport = parameters.viewport;
  17692. this.linkService = parameters.linkService;
  17693. this.downloadManager = parameters.downloadManager;
  17694. this.imageResourcesPath = parameters.imageResourcesPath;
  17695. this.renderInteractiveForms = parameters.renderInteractiveForms;
  17696. this.svgFactory = parameters.svgFactory;
  17697. if (isRenderable) {
  17698. this.container = this._createContainer(ignoreBorder);
  17699. }
  17700. }
  17701. _createClass(AnnotationElement, [{
  17702. key: "_createContainer",
  17703. value: function _createContainer() {
  17704. var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  17705. var data = this.data,
  17706. page = this.page,
  17707. viewport = this.viewport;
  17708. var container = document.createElement("section");
  17709. var width = data.rect[2] - data.rect[0];
  17710. var height = data.rect[3] - data.rect[1];
  17711. container.setAttribute("data-annotation-id", data.id);
  17712. 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]]);
  17713. container.style.transform = "matrix(".concat(viewport.transform.join(","), ")");
  17714. container.style.transformOrigin = "-".concat(rect[0], "px -").concat(rect[1], "px");
  17715. if (!ignoreBorder && data.borderStyle.width > 0) {
  17716. container.style.borderWidth = "".concat(data.borderStyle.width, "px");
  17717. if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
  17718. width = width - 2 * data.borderStyle.width;
  17719. height = height - 2 * data.borderStyle.width;
  17720. }
  17721. var horizontalRadius = data.borderStyle.horizontalCornerRadius;
  17722. var verticalRadius = data.borderStyle.verticalCornerRadius;
  17723. if (horizontalRadius > 0 || verticalRadius > 0) {
  17724. var radius = "".concat(horizontalRadius, "px / ").concat(verticalRadius, "px");
  17725. container.style.borderRadius = radius;
  17726. }
  17727. switch (data.borderStyle.style) {
  17728. case _util.AnnotationBorderStyleType.SOLID:
  17729. container.style.borderStyle = "solid";
  17730. break;
  17731. case _util.AnnotationBorderStyleType.DASHED:
  17732. container.style.borderStyle = "dashed";
  17733. break;
  17734. case _util.AnnotationBorderStyleType.BEVELED:
  17735. (0, _util.warn)("Unimplemented border style: beveled");
  17736. break;
  17737. case _util.AnnotationBorderStyleType.INSET:
  17738. (0, _util.warn)("Unimplemented border style: inset");
  17739. break;
  17740. case _util.AnnotationBorderStyleType.UNDERLINE:
  17741. container.style.borderBottomStyle = "solid";
  17742. break;
  17743. default:
  17744. break;
  17745. }
  17746. if (data.color) {
  17747. container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0);
  17748. } else {
  17749. container.style.borderWidth = 0;
  17750. }
  17751. }
  17752. container.style.left = "".concat(rect[0], "px");
  17753. container.style.top = "".concat(rect[1], "px");
  17754. container.style.width = "".concat(width, "px");
  17755. container.style.height = "".concat(height, "px");
  17756. return container;
  17757. }
  17758. }, {
  17759. key: "_createPopup",
  17760. value: function _createPopup(container, trigger, data) {
  17761. if (!trigger) {
  17762. trigger = document.createElement("div");
  17763. trigger.style.height = container.style.height;
  17764. trigger.style.width = container.style.width;
  17765. container.appendChild(trigger);
  17766. }
  17767. var popupElement = new PopupElement({
  17768. container: container,
  17769. trigger: trigger,
  17770. color: data.color,
  17771. title: data.title,
  17772. modificationDate: data.modificationDate,
  17773. contents: data.contents,
  17774. hideWrapper: true
  17775. });
  17776. var popup = popupElement.render();
  17777. popup.style.left = container.style.width;
  17778. container.appendChild(popup);
  17779. }
  17780. }, {
  17781. key: "render",
  17782. value: function render() {
  17783. (0, _util.unreachable)("Abstract method `AnnotationElement.render` called");
  17784. }
  17785. }]);
  17786. return AnnotationElement;
  17787. }();
  17788. var LinkAnnotationElement = /*#__PURE__*/function (_AnnotationElement) {
  17789. _inherits(LinkAnnotationElement, _AnnotationElement);
  17790. var _super = _createSuper(LinkAnnotationElement);
  17791. function LinkAnnotationElement(parameters) {
  17792. _classCallCheck(this, LinkAnnotationElement);
  17793. var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action);
  17794. return _super.call(this, parameters, isRenderable);
  17795. }
  17796. _createClass(LinkAnnotationElement, [{
  17797. key: "render",
  17798. value: function render() {
  17799. this.container.className = "linkAnnotation";
  17800. var data = this.data,
  17801. linkService = this.linkService;
  17802. var link = document.createElement("a");
  17803. if (data.url) {
  17804. (0, _display_utils.addLinkAttributes)(link, {
  17805. url: data.url,
  17806. target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
  17807. rel: linkService.externalLinkRel,
  17808. enabled: linkService.externalLinkEnabled
  17809. });
  17810. } else if (data.action) {
  17811. this._bindNamedAction(link, data.action);
  17812. } else {
  17813. this._bindLink(link, data.dest);
  17814. }
  17815. this.container.appendChild(link);
  17816. return this.container;
  17817. }
  17818. }, {
  17819. key: "_bindLink",
  17820. value: function _bindLink(link, destination) {
  17821. var _this = this;
  17822. link.href = this.linkService.getDestinationHash(destination);
  17823. link.onclick = function () {
  17824. if (destination) {
  17825. _this.linkService.navigateTo(destination);
  17826. }
  17827. return false;
  17828. };
  17829. if (destination) {
  17830. link.className = "internalLink";
  17831. }
  17832. }
  17833. }, {
  17834. key: "_bindNamedAction",
  17835. value: function _bindNamedAction(link, action) {
  17836. var _this2 = this;
  17837. link.href = this.linkService.getAnchorUrl("");
  17838. link.onclick = function () {
  17839. _this2.linkService.executeNamedAction(action);
  17840. return false;
  17841. };
  17842. link.className = "internalLink";
  17843. }
  17844. }]);
  17845. return LinkAnnotationElement;
  17846. }(AnnotationElement);
  17847. var TextAnnotationElement = /*#__PURE__*/function (_AnnotationElement2) {
  17848. _inherits(TextAnnotationElement, _AnnotationElement2);
  17849. var _super2 = _createSuper(TextAnnotationElement);
  17850. function TextAnnotationElement(parameters) {
  17851. _classCallCheck(this, TextAnnotationElement);
  17852. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  17853. return _super2.call(this, parameters, isRenderable);
  17854. }
  17855. _createClass(TextAnnotationElement, [{
  17856. key: "render",
  17857. value: function render() {
  17858. this.container.className = "textAnnotation";
  17859. var image = document.createElement("img");
  17860. image.style.height = this.container.style.height;
  17861. image.style.width = this.container.style.width;
  17862. image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
  17863. image.alt = "[{{type}} Annotation]";
  17864. image.dataset.l10nId = "text_annotation_type";
  17865. image.dataset.l10nArgs = JSON.stringify({
  17866. type: this.data.name
  17867. });
  17868. if (!this.data.hasPopup) {
  17869. this._createPopup(this.container, image, this.data);
  17870. }
  17871. this.container.appendChild(image);
  17872. return this.container;
  17873. }
  17874. }]);
  17875. return TextAnnotationElement;
  17876. }(AnnotationElement);
  17877. var WidgetAnnotationElement = /*#__PURE__*/function (_AnnotationElement3) {
  17878. _inherits(WidgetAnnotationElement, _AnnotationElement3);
  17879. var _super3 = _createSuper(WidgetAnnotationElement);
  17880. function WidgetAnnotationElement() {
  17881. _classCallCheck(this, WidgetAnnotationElement);
  17882. return _super3.apply(this, arguments);
  17883. }
  17884. _createClass(WidgetAnnotationElement, [{
  17885. key: "render",
  17886. value: function render() {
  17887. return this.container;
  17888. }
  17889. }]);
  17890. return WidgetAnnotationElement;
  17891. }(AnnotationElement);
  17892. var TextWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem) {
  17893. _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem);
  17894. var _super4 = _createSuper(TextWidgetAnnotationElement);
  17895. function TextWidgetAnnotationElement(parameters) {
  17896. _classCallCheck(this, TextWidgetAnnotationElement);
  17897. var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
  17898. return _super4.call(this, parameters, isRenderable);
  17899. }
  17900. _createClass(TextWidgetAnnotationElement, [{
  17901. key: "render",
  17902. value: function render() {
  17903. var TEXT_ALIGNMENT = ["left", "center", "right"];
  17904. this.container.className = "textWidgetAnnotation";
  17905. var element = null;
  17906. if (this.renderInteractiveForms) {
  17907. if (this.data.multiLine) {
  17908. element = document.createElement("textarea");
  17909. element.textContent = this.data.fieldValue;
  17910. } else {
  17911. element = document.createElement("input");
  17912. element.type = "text";
  17913. element.setAttribute("value", this.data.fieldValue);
  17914. }
  17915. element.disabled = this.data.readOnly;
  17916. element.name = this.data.fieldName;
  17917. if (this.data.maxLen !== null) {
  17918. element.maxLength = this.data.maxLen;
  17919. }
  17920. if (this.data.comb) {
  17921. var fieldWidth = this.data.rect[2] - this.data.rect[0];
  17922. var combWidth = fieldWidth / this.data.maxLen;
  17923. element.classList.add("comb");
  17924. element.style.letterSpacing = "calc(".concat(combWidth, "px - 1ch)");
  17925. }
  17926. } else {
  17927. element = document.createElement("div");
  17928. element.textContent = this.data.fieldValue;
  17929. element.style.verticalAlign = "middle";
  17930. element.style.display = "table-cell";
  17931. var font = null;
  17932. if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) {
  17933. font = this.page.commonObjs.get(this.data.fontRefName);
  17934. }
  17935. this._setTextStyle(element, font);
  17936. }
  17937. if (this.data.textAlignment !== null) {
  17938. element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
  17939. }
  17940. this.container.appendChild(element);
  17941. return this.container;
  17942. }
  17943. }, {
  17944. key: "_setTextStyle",
  17945. value: function _setTextStyle(element, font) {
  17946. var style = element.style;
  17947. style.fontSize = "".concat(this.data.fontSize, "px");
  17948. style.direction = this.data.fontDirection < 0 ? "rtl" : "ltr";
  17949. if (!font) {
  17950. return;
  17951. }
  17952. var bold = "normal";
  17953. if (font.black) {
  17954. bold = "900";
  17955. } else if (font.bold) {
  17956. bold = "bold";
  17957. }
  17958. style.fontWeight = bold;
  17959. style.fontStyle = font.italic ? "italic" : "normal";
  17960. var fontFamily = font.loadedName ? "\"".concat(font.loadedName, "\", ") : "";
  17961. var fallbackName = font.fallbackName || "Helvetica, sans-serif";
  17962. style.fontFamily = fontFamily + fallbackName;
  17963. }
  17964. }]);
  17965. return TextWidgetAnnotationElement;
  17966. }(WidgetAnnotationElement);
  17967. var CheckboxWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem2) {
  17968. _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2);
  17969. var _super5 = _createSuper(CheckboxWidgetAnnotationElement);
  17970. function CheckboxWidgetAnnotationElement(parameters) {
  17971. _classCallCheck(this, CheckboxWidgetAnnotationElement);
  17972. return _super5.call(this, parameters, parameters.renderInteractiveForms);
  17973. }
  17974. _createClass(CheckboxWidgetAnnotationElement, [{
  17975. key: "render",
  17976. value: function render() {
  17977. this.container.className = "buttonWidgetAnnotation checkBox";
  17978. var element = document.createElement("input");
  17979. element.disabled = this.data.readOnly;
  17980. element.type = "checkbox";
  17981. element.name = this.data.fieldName;
  17982. if (this.data.fieldValue && this.data.fieldValue !== "Off") {
  17983. element.setAttribute("checked", true);
  17984. }
  17985. this.container.appendChild(element);
  17986. return this.container;
  17987. }
  17988. }]);
  17989. return CheckboxWidgetAnnotationElement;
  17990. }(WidgetAnnotationElement);
  17991. var RadioButtonWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem3) {
  17992. _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3);
  17993. var _super6 = _createSuper(RadioButtonWidgetAnnotationElement);
  17994. function RadioButtonWidgetAnnotationElement(parameters) {
  17995. _classCallCheck(this, RadioButtonWidgetAnnotationElement);
  17996. return _super6.call(this, parameters, parameters.renderInteractiveForms);
  17997. }
  17998. _createClass(RadioButtonWidgetAnnotationElement, [{
  17999. key: "render",
  18000. value: function render() {
  18001. this.container.className = "buttonWidgetAnnotation radioButton";
  18002. var element = document.createElement("input");
  18003. element.disabled = this.data.readOnly;
  18004. element.type = "radio";
  18005. element.name = this.data.fieldName;
  18006. if (this.data.fieldValue === this.data.buttonValue) {
  18007. element.setAttribute("checked", true);
  18008. }
  18009. this.container.appendChild(element);
  18010. return this.container;
  18011. }
  18012. }]);
  18013. return RadioButtonWidgetAnnotationElement;
  18014. }(WidgetAnnotationElement);
  18015. var PushButtonWidgetAnnotationElement = /*#__PURE__*/function (_LinkAnnotationElemen) {
  18016. _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen);
  18017. var _super7 = _createSuper(PushButtonWidgetAnnotationElement);
  18018. function PushButtonWidgetAnnotationElement() {
  18019. _classCallCheck(this, PushButtonWidgetAnnotationElement);
  18020. return _super7.apply(this, arguments);
  18021. }
  18022. _createClass(PushButtonWidgetAnnotationElement, [{
  18023. key: "render",
  18024. value: function render() {
  18025. var container = _get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), "render", this).call(this);
  18026. container.className = "buttonWidgetAnnotation pushButton";
  18027. return container;
  18028. }
  18029. }]);
  18030. return PushButtonWidgetAnnotationElement;
  18031. }(LinkAnnotationElement);
  18032. var ChoiceWidgetAnnotationElement = /*#__PURE__*/function (_WidgetAnnotationElem4) {
  18033. _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4);
  18034. var _super8 = _createSuper(ChoiceWidgetAnnotationElement);
  18035. function ChoiceWidgetAnnotationElement(parameters) {
  18036. _classCallCheck(this, ChoiceWidgetAnnotationElement);
  18037. return _super8.call(this, parameters, parameters.renderInteractiveForms);
  18038. }
  18039. _createClass(ChoiceWidgetAnnotationElement, [{
  18040. key: "render",
  18041. value: function render() {
  18042. this.container.className = "choiceWidgetAnnotation";
  18043. var selectElement = document.createElement("select");
  18044. selectElement.disabled = this.data.readOnly;
  18045. selectElement.name = this.data.fieldName;
  18046. if (!this.data.combo) {
  18047. selectElement.size = this.data.options.length;
  18048. if (this.data.multiSelect) {
  18049. selectElement.multiple = true;
  18050. }
  18051. }
  18052. var _iterator = _createForOfIteratorHelper(this.data.options),
  18053. _step;
  18054. try {
  18055. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  18056. var option = _step.value;
  18057. var optionElement = document.createElement("option");
  18058. optionElement.textContent = option.displayValue;
  18059. optionElement.value = option.exportValue;
  18060. if (this.data.fieldValue.includes(option.displayValue)) {
  18061. optionElement.setAttribute("selected", true);
  18062. }
  18063. selectElement.appendChild(optionElement);
  18064. }
  18065. } catch (err) {
  18066. _iterator.e(err);
  18067. } finally {
  18068. _iterator.f();
  18069. }
  18070. this.container.appendChild(selectElement);
  18071. return this.container;
  18072. }
  18073. }]);
  18074. return ChoiceWidgetAnnotationElement;
  18075. }(WidgetAnnotationElement);
  18076. var PopupAnnotationElement = /*#__PURE__*/function (_AnnotationElement4) {
  18077. _inherits(PopupAnnotationElement, _AnnotationElement4);
  18078. var _super9 = _createSuper(PopupAnnotationElement);
  18079. function PopupAnnotationElement(parameters) {
  18080. _classCallCheck(this, PopupAnnotationElement);
  18081. var isRenderable = !!(parameters.data.title || parameters.data.contents);
  18082. return _super9.call(this, parameters, isRenderable);
  18083. }
  18084. _createClass(PopupAnnotationElement, [{
  18085. key: "render",
  18086. value: function render() {
  18087. var IGNORE_TYPES = ["Line", "Square", "Circle", "PolyLine", "Polygon", "Ink"];
  18088. this.container.className = "popupAnnotation";
  18089. if (IGNORE_TYPES.includes(this.data.parentType)) {
  18090. return this.container;
  18091. }
  18092. var selector = "[data-annotation-id=\"".concat(this.data.parentId, "\"]");
  18093. var parentElement = this.layer.querySelector(selector);
  18094. if (!parentElement) {
  18095. return this.container;
  18096. }
  18097. var popup = new PopupElement({
  18098. container: this.container,
  18099. trigger: parentElement,
  18100. color: this.data.color,
  18101. title: this.data.title,
  18102. modificationDate: this.data.modificationDate,
  18103. contents: this.data.contents
  18104. });
  18105. var parentLeft = parseFloat(parentElement.style.left);
  18106. var parentWidth = parseFloat(parentElement.style.width);
  18107. this.container.style.transformOrigin = "-".concat(parentLeft + parentWidth, "px -").concat(parentElement.style.top);
  18108. this.container.style.left = "".concat(parentLeft + parentWidth, "px");
  18109. this.container.appendChild(popup.render());
  18110. return this.container;
  18111. }
  18112. }]);
  18113. return PopupAnnotationElement;
  18114. }(AnnotationElement);
  18115. var PopupElement = /*#__PURE__*/function () {
  18116. function PopupElement(parameters) {
  18117. _classCallCheck(this, PopupElement);
  18118. this.container = parameters.container;
  18119. this.trigger = parameters.trigger;
  18120. this.color = parameters.color;
  18121. this.title = parameters.title;
  18122. this.modificationDate = parameters.modificationDate;
  18123. this.contents = parameters.contents;
  18124. this.hideWrapper = parameters.hideWrapper || false;
  18125. this.pinned = false;
  18126. }
  18127. _createClass(PopupElement, [{
  18128. key: "render",
  18129. value: function render() {
  18130. var BACKGROUND_ENLIGHT = 0.7;
  18131. var wrapper = document.createElement("div");
  18132. wrapper.className = "popupWrapper";
  18133. this.hideElement = this.hideWrapper ? wrapper : this.container;
  18134. this.hideElement.setAttribute("hidden", true);
  18135. var popup = document.createElement("div");
  18136. popup.className = "popup";
  18137. var color = this.color;
  18138. if (color) {
  18139. var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
  18140. var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
  18141. var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
  18142. popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0);
  18143. }
  18144. var title = document.createElement("h1");
  18145. title.textContent = this.title;
  18146. popup.appendChild(title);
  18147. var dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate);
  18148. if (dateObject) {
  18149. var modificationDate = document.createElement("span");
  18150. modificationDate.textContent = "{{date}}, {{time}}";
  18151. modificationDate.dataset.l10nId = "annotation_date_string";
  18152. modificationDate.dataset.l10nArgs = JSON.stringify({
  18153. date: dateObject.toLocaleDateString(),
  18154. time: dateObject.toLocaleTimeString()
  18155. });
  18156. popup.appendChild(modificationDate);
  18157. }
  18158. var contents = this._formatContents(this.contents);
  18159. popup.appendChild(contents);
  18160. this.trigger.addEventListener("click", this._toggle.bind(this));
  18161. this.trigger.addEventListener("mouseover", this._show.bind(this, false));
  18162. this.trigger.addEventListener("mouseout", this._hide.bind(this, false));
  18163. popup.addEventListener("click", this._hide.bind(this, true));
  18164. wrapper.appendChild(popup);
  18165. return wrapper;
  18166. }
  18167. }, {
  18168. key: "_formatContents",
  18169. value: function _formatContents(contents) {
  18170. var p = document.createElement("p");
  18171. var lines = contents.split(/(?:\r\n?|\n)/);
  18172. for (var i = 0, ii = lines.length; i < ii; ++i) {
  18173. var line = lines[i];
  18174. p.appendChild(document.createTextNode(line));
  18175. if (i < ii - 1) {
  18176. p.appendChild(document.createElement("br"));
  18177. }
  18178. }
  18179. return p;
  18180. }
  18181. }, {
  18182. key: "_toggle",
  18183. value: function _toggle() {
  18184. if (this.pinned) {
  18185. this._hide(true);
  18186. } else {
  18187. this._show(true);
  18188. }
  18189. }
  18190. }, {
  18191. key: "_show",
  18192. value: function _show() {
  18193. var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  18194. if (pin) {
  18195. this.pinned = true;
  18196. }
  18197. if (this.hideElement.hasAttribute("hidden")) {
  18198. this.hideElement.removeAttribute("hidden");
  18199. this.container.style.zIndex += 1;
  18200. }
  18201. }
  18202. }, {
  18203. key: "_hide",
  18204. value: function _hide() {
  18205. var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  18206. if (unpin) {
  18207. this.pinned = false;
  18208. }
  18209. if (!this.hideElement.hasAttribute("hidden") && !this.pinned) {
  18210. this.hideElement.setAttribute("hidden", true);
  18211. this.container.style.zIndex -= 1;
  18212. }
  18213. }
  18214. }]);
  18215. return PopupElement;
  18216. }();
  18217. var FreeTextAnnotationElement = /*#__PURE__*/function (_AnnotationElement5) {
  18218. _inherits(FreeTextAnnotationElement, _AnnotationElement5);
  18219. var _super10 = _createSuper(FreeTextAnnotationElement);
  18220. function FreeTextAnnotationElement(parameters) {
  18221. _classCallCheck(this, FreeTextAnnotationElement);
  18222. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18223. return _super10.call(this, parameters, isRenderable, true);
  18224. }
  18225. _createClass(FreeTextAnnotationElement, [{
  18226. key: "render",
  18227. value: function render() {
  18228. this.container.className = "freeTextAnnotation";
  18229. if (!this.data.hasPopup) {
  18230. this._createPopup(this.container, null, this.data);
  18231. }
  18232. return this.container;
  18233. }
  18234. }]);
  18235. return FreeTextAnnotationElement;
  18236. }(AnnotationElement);
  18237. var LineAnnotationElement = /*#__PURE__*/function (_AnnotationElement6) {
  18238. _inherits(LineAnnotationElement, _AnnotationElement6);
  18239. var _super11 = _createSuper(LineAnnotationElement);
  18240. function LineAnnotationElement(parameters) {
  18241. _classCallCheck(this, LineAnnotationElement);
  18242. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18243. return _super11.call(this, parameters, isRenderable, true);
  18244. }
  18245. _createClass(LineAnnotationElement, [{
  18246. key: "render",
  18247. value: function render() {
  18248. this.container.className = "lineAnnotation";
  18249. var data = this.data;
  18250. var width = data.rect[2] - data.rect[0];
  18251. var height = data.rect[3] - data.rect[1];
  18252. var svg = this.svgFactory.create(width, height);
  18253. var line = this.svgFactory.createElement("svg:line");
  18254. line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
  18255. line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
  18256. line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
  18257. line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
  18258. line.setAttribute("stroke-width", data.borderStyle.width || 1);
  18259. line.setAttribute("stroke", "transparent");
  18260. svg.appendChild(line);
  18261. this.container.append(svg);
  18262. this._createPopup(this.container, line, data);
  18263. return this.container;
  18264. }
  18265. }]);
  18266. return LineAnnotationElement;
  18267. }(AnnotationElement);
  18268. var SquareAnnotationElement = /*#__PURE__*/function (_AnnotationElement7) {
  18269. _inherits(SquareAnnotationElement, _AnnotationElement7);
  18270. var _super12 = _createSuper(SquareAnnotationElement);
  18271. function SquareAnnotationElement(parameters) {
  18272. _classCallCheck(this, SquareAnnotationElement);
  18273. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18274. return _super12.call(this, parameters, isRenderable, true);
  18275. }
  18276. _createClass(SquareAnnotationElement, [{
  18277. key: "render",
  18278. value: function render() {
  18279. this.container.className = "squareAnnotation";
  18280. var data = this.data;
  18281. var width = data.rect[2] - data.rect[0];
  18282. var height = data.rect[3] - data.rect[1];
  18283. var svg = this.svgFactory.create(width, height);
  18284. var borderWidth = data.borderStyle.width;
  18285. var square = this.svgFactory.createElement("svg:rect");
  18286. square.setAttribute("x", borderWidth / 2);
  18287. square.setAttribute("y", borderWidth / 2);
  18288. square.setAttribute("width", width - borderWidth);
  18289. square.setAttribute("height", height - borderWidth);
  18290. square.setAttribute("stroke-width", borderWidth || 1);
  18291. square.setAttribute("stroke", "transparent");
  18292. square.setAttribute("fill", "none");
  18293. svg.appendChild(square);
  18294. this.container.append(svg);
  18295. this._createPopup(this.container, square, data);
  18296. return this.container;
  18297. }
  18298. }]);
  18299. return SquareAnnotationElement;
  18300. }(AnnotationElement);
  18301. var CircleAnnotationElement = /*#__PURE__*/function (_AnnotationElement8) {
  18302. _inherits(CircleAnnotationElement, _AnnotationElement8);
  18303. var _super13 = _createSuper(CircleAnnotationElement);
  18304. function CircleAnnotationElement(parameters) {
  18305. _classCallCheck(this, CircleAnnotationElement);
  18306. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18307. return _super13.call(this, parameters, isRenderable, true);
  18308. }
  18309. _createClass(CircleAnnotationElement, [{
  18310. key: "render",
  18311. value: function render() {
  18312. this.container.className = "circleAnnotation";
  18313. var data = this.data;
  18314. var width = data.rect[2] - data.rect[0];
  18315. var height = data.rect[3] - data.rect[1];
  18316. var svg = this.svgFactory.create(width, height);
  18317. var borderWidth = data.borderStyle.width;
  18318. var circle = this.svgFactory.createElement("svg:ellipse");
  18319. circle.setAttribute("cx", width / 2);
  18320. circle.setAttribute("cy", height / 2);
  18321. circle.setAttribute("rx", width / 2 - borderWidth / 2);
  18322. circle.setAttribute("ry", height / 2 - borderWidth / 2);
  18323. circle.setAttribute("stroke-width", borderWidth || 1);
  18324. circle.setAttribute("stroke", "transparent");
  18325. circle.setAttribute("fill", "none");
  18326. svg.appendChild(circle);
  18327. this.container.append(svg);
  18328. this._createPopup(this.container, circle, data);
  18329. return this.container;
  18330. }
  18331. }]);
  18332. return CircleAnnotationElement;
  18333. }(AnnotationElement);
  18334. var PolylineAnnotationElement = /*#__PURE__*/function (_AnnotationElement9) {
  18335. _inherits(PolylineAnnotationElement, _AnnotationElement9);
  18336. var _super14 = _createSuper(PolylineAnnotationElement);
  18337. function PolylineAnnotationElement(parameters) {
  18338. var _this3;
  18339. _classCallCheck(this, PolylineAnnotationElement);
  18340. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18341. _this3 = _super14.call(this, parameters, isRenderable, true);
  18342. _this3.containerClassName = "polylineAnnotation";
  18343. _this3.svgElementName = "svg:polyline";
  18344. return _this3;
  18345. }
  18346. _createClass(PolylineAnnotationElement, [{
  18347. key: "render",
  18348. value: function render() {
  18349. this.container.className = this.containerClassName;
  18350. var data = this.data;
  18351. var width = data.rect[2] - data.rect[0];
  18352. var height = data.rect[3] - data.rect[1];
  18353. var svg = this.svgFactory.create(width, height);
  18354. var points = [];
  18355. var _iterator2 = _createForOfIteratorHelper(data.vertices),
  18356. _step2;
  18357. try {
  18358. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  18359. var coordinate = _step2.value;
  18360. var x = coordinate.x - data.rect[0];
  18361. var y = data.rect[3] - coordinate.y;
  18362. points.push(x + "," + y);
  18363. }
  18364. } catch (err) {
  18365. _iterator2.e(err);
  18366. } finally {
  18367. _iterator2.f();
  18368. }
  18369. points = points.join(" ");
  18370. var polyline = this.svgFactory.createElement(this.svgElementName);
  18371. polyline.setAttribute("points", points);
  18372. polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
  18373. polyline.setAttribute("stroke", "transparent");
  18374. polyline.setAttribute("fill", "none");
  18375. svg.appendChild(polyline);
  18376. this.container.append(svg);
  18377. this._createPopup(this.container, polyline, data);
  18378. return this.container;
  18379. }
  18380. }]);
  18381. return PolylineAnnotationElement;
  18382. }(AnnotationElement);
  18383. var PolygonAnnotationElement = /*#__PURE__*/function (_PolylineAnnotationEl) {
  18384. _inherits(PolygonAnnotationElement, _PolylineAnnotationEl);
  18385. var _super15 = _createSuper(PolygonAnnotationElement);
  18386. function PolygonAnnotationElement(parameters) {
  18387. var _this4;
  18388. _classCallCheck(this, PolygonAnnotationElement);
  18389. _this4 = _super15.call(this, parameters);
  18390. _this4.containerClassName = "polygonAnnotation";
  18391. _this4.svgElementName = "svg:polygon";
  18392. return _this4;
  18393. }
  18394. return PolygonAnnotationElement;
  18395. }(PolylineAnnotationElement);
  18396. var CaretAnnotationElement = /*#__PURE__*/function (_AnnotationElement10) {
  18397. _inherits(CaretAnnotationElement, _AnnotationElement10);
  18398. var _super16 = _createSuper(CaretAnnotationElement);
  18399. function CaretAnnotationElement(parameters) {
  18400. _classCallCheck(this, CaretAnnotationElement);
  18401. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18402. return _super16.call(this, parameters, isRenderable, true);
  18403. }
  18404. _createClass(CaretAnnotationElement, [{
  18405. key: "render",
  18406. value: function render() {
  18407. this.container.className = "caretAnnotation";
  18408. if (!this.data.hasPopup) {
  18409. this._createPopup(this.container, null, this.data);
  18410. }
  18411. return this.container;
  18412. }
  18413. }]);
  18414. return CaretAnnotationElement;
  18415. }(AnnotationElement);
  18416. var InkAnnotationElement = /*#__PURE__*/function (_AnnotationElement11) {
  18417. _inherits(InkAnnotationElement, _AnnotationElement11);
  18418. var _super17 = _createSuper(InkAnnotationElement);
  18419. function InkAnnotationElement(parameters) {
  18420. var _this5;
  18421. _classCallCheck(this, InkAnnotationElement);
  18422. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18423. _this5 = _super17.call(this, parameters, isRenderable, true);
  18424. _this5.containerClassName = "inkAnnotation";
  18425. _this5.svgElementName = "svg:polyline";
  18426. return _this5;
  18427. }
  18428. _createClass(InkAnnotationElement, [{
  18429. key: "render",
  18430. value: function render() {
  18431. this.container.className = this.containerClassName;
  18432. var data = this.data;
  18433. var width = data.rect[2] - data.rect[0];
  18434. var height = data.rect[3] - data.rect[1];
  18435. var svg = this.svgFactory.create(width, height);
  18436. var _iterator3 = _createForOfIteratorHelper(data.inkLists),
  18437. _step3;
  18438. try {
  18439. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  18440. var inkList = _step3.value;
  18441. var points = [];
  18442. var _iterator4 = _createForOfIteratorHelper(inkList),
  18443. _step4;
  18444. try {
  18445. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  18446. var coordinate = _step4.value;
  18447. var x = coordinate.x - data.rect[0];
  18448. var y = data.rect[3] - coordinate.y;
  18449. points.push("".concat(x, ",").concat(y));
  18450. }
  18451. } catch (err) {
  18452. _iterator4.e(err);
  18453. } finally {
  18454. _iterator4.f();
  18455. }
  18456. points = points.join(" ");
  18457. var polyline = this.svgFactory.createElement(this.svgElementName);
  18458. polyline.setAttribute("points", points);
  18459. polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
  18460. polyline.setAttribute("stroke", "transparent");
  18461. polyline.setAttribute("fill", "none");
  18462. this._createPopup(this.container, polyline, data);
  18463. svg.appendChild(polyline);
  18464. }
  18465. } catch (err) {
  18466. _iterator3.e(err);
  18467. } finally {
  18468. _iterator3.f();
  18469. }
  18470. this.container.append(svg);
  18471. return this.container;
  18472. }
  18473. }]);
  18474. return InkAnnotationElement;
  18475. }(AnnotationElement);
  18476. var HighlightAnnotationElement = /*#__PURE__*/function (_AnnotationElement12) {
  18477. _inherits(HighlightAnnotationElement, _AnnotationElement12);
  18478. var _super18 = _createSuper(HighlightAnnotationElement);
  18479. function HighlightAnnotationElement(parameters) {
  18480. _classCallCheck(this, HighlightAnnotationElement);
  18481. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18482. return _super18.call(this, parameters, isRenderable, true);
  18483. }
  18484. _createClass(HighlightAnnotationElement, [{
  18485. key: "render",
  18486. value: function render() {
  18487. this.container.className = "highlightAnnotation";
  18488. if (!this.data.hasPopup) {
  18489. this._createPopup(this.container, null, this.data);
  18490. }
  18491. return this.container;
  18492. }
  18493. }]);
  18494. return HighlightAnnotationElement;
  18495. }(AnnotationElement);
  18496. var UnderlineAnnotationElement = /*#__PURE__*/function (_AnnotationElement13) {
  18497. _inherits(UnderlineAnnotationElement, _AnnotationElement13);
  18498. var _super19 = _createSuper(UnderlineAnnotationElement);
  18499. function UnderlineAnnotationElement(parameters) {
  18500. _classCallCheck(this, UnderlineAnnotationElement);
  18501. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18502. return _super19.call(this, parameters, isRenderable, true);
  18503. }
  18504. _createClass(UnderlineAnnotationElement, [{
  18505. key: "render",
  18506. value: function render() {
  18507. this.container.className = "underlineAnnotation";
  18508. if (!this.data.hasPopup) {
  18509. this._createPopup(this.container, null, this.data);
  18510. }
  18511. return this.container;
  18512. }
  18513. }]);
  18514. return UnderlineAnnotationElement;
  18515. }(AnnotationElement);
  18516. var SquigglyAnnotationElement = /*#__PURE__*/function (_AnnotationElement14) {
  18517. _inherits(SquigglyAnnotationElement, _AnnotationElement14);
  18518. var _super20 = _createSuper(SquigglyAnnotationElement);
  18519. function SquigglyAnnotationElement(parameters) {
  18520. _classCallCheck(this, SquigglyAnnotationElement);
  18521. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18522. return _super20.call(this, parameters, isRenderable, true);
  18523. }
  18524. _createClass(SquigglyAnnotationElement, [{
  18525. key: "render",
  18526. value: function render() {
  18527. this.container.className = "squigglyAnnotation";
  18528. if (!this.data.hasPopup) {
  18529. this._createPopup(this.container, null, this.data);
  18530. }
  18531. return this.container;
  18532. }
  18533. }]);
  18534. return SquigglyAnnotationElement;
  18535. }(AnnotationElement);
  18536. var StrikeOutAnnotationElement = /*#__PURE__*/function (_AnnotationElement15) {
  18537. _inherits(StrikeOutAnnotationElement, _AnnotationElement15);
  18538. var _super21 = _createSuper(StrikeOutAnnotationElement);
  18539. function StrikeOutAnnotationElement(parameters) {
  18540. _classCallCheck(this, StrikeOutAnnotationElement);
  18541. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18542. return _super21.call(this, parameters, isRenderable, true);
  18543. }
  18544. _createClass(StrikeOutAnnotationElement, [{
  18545. key: "render",
  18546. value: function render() {
  18547. this.container.className = "strikeoutAnnotation";
  18548. if (!this.data.hasPopup) {
  18549. this._createPopup(this.container, null, this.data);
  18550. }
  18551. return this.container;
  18552. }
  18553. }]);
  18554. return StrikeOutAnnotationElement;
  18555. }(AnnotationElement);
  18556. var StampAnnotationElement = /*#__PURE__*/function (_AnnotationElement16) {
  18557. _inherits(StampAnnotationElement, _AnnotationElement16);
  18558. var _super22 = _createSuper(StampAnnotationElement);
  18559. function StampAnnotationElement(parameters) {
  18560. _classCallCheck(this, StampAnnotationElement);
  18561. var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
  18562. return _super22.call(this, parameters, isRenderable, true);
  18563. }
  18564. _createClass(StampAnnotationElement, [{
  18565. key: "render",
  18566. value: function render() {
  18567. this.container.className = "stampAnnotation";
  18568. if (!this.data.hasPopup) {
  18569. this._createPopup(this.container, null, this.data);
  18570. }
  18571. return this.container;
  18572. }
  18573. }]);
  18574. return StampAnnotationElement;
  18575. }(AnnotationElement);
  18576. var FileAttachmentAnnotationElement = /*#__PURE__*/function (_AnnotationElement17) {
  18577. _inherits(FileAttachmentAnnotationElement, _AnnotationElement17);
  18578. var _super23 = _createSuper(FileAttachmentAnnotationElement);
  18579. function FileAttachmentAnnotationElement(parameters) {
  18580. var _this6;
  18581. _classCallCheck(this, FileAttachmentAnnotationElement);
  18582. _this6 = _super23.call(this, parameters, true);
  18583. var _this6$data$file = _this6.data.file,
  18584. filename = _this6$data$file.filename,
  18585. content = _this6$data$file.content;
  18586. _this6.filename = (0, _display_utils.getFilenameFromUrl)(filename);
  18587. _this6.content = content;
  18588. if (_this6.linkService.eventBus) {
  18589. _this6.linkService.eventBus.dispatch("fileattachmentannotation", {
  18590. source: _assertThisInitialized(_this6),
  18591. id: (0, _util.stringToPDFString)(filename),
  18592. filename: filename,
  18593. content: content
  18594. });
  18595. }
  18596. return _this6;
  18597. }
  18598. _createClass(FileAttachmentAnnotationElement, [{
  18599. key: "render",
  18600. value: function render() {
  18601. this.container.className = "fileAttachmentAnnotation";
  18602. var trigger = document.createElement("div");
  18603. trigger.style.height = this.container.style.height;
  18604. trigger.style.width = this.container.style.width;
  18605. trigger.addEventListener("dblclick", this._download.bind(this));
  18606. if (!this.data.hasPopup && (this.data.title || this.data.contents)) {
  18607. this._createPopup(this.container, trigger, this.data);
  18608. }
  18609. this.container.appendChild(trigger);
  18610. return this.container;
  18611. }
  18612. }, {
  18613. key: "_download",
  18614. value: function _download() {
  18615. if (!this.downloadManager) {
  18616. (0, _util.warn)("Download cannot be started due to unavailable download manager");
  18617. return;
  18618. }
  18619. this.downloadManager.downloadData(this.content, this.filename, "");
  18620. }
  18621. }]);
  18622. return FileAttachmentAnnotationElement;
  18623. }(AnnotationElement);
  18624. var AnnotationLayer = /*#__PURE__*/function () {
  18625. function AnnotationLayer() {
  18626. _classCallCheck(this, AnnotationLayer);
  18627. }
  18628. _createClass(AnnotationLayer, null, [{
  18629. key: "render",
  18630. value: function render(parameters) {
  18631. var sortedAnnotations = [],
  18632. popupAnnotations = [];
  18633. var _iterator5 = _createForOfIteratorHelper(parameters.annotations),
  18634. _step5;
  18635. try {
  18636. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  18637. var _data = _step5.value;
  18638. if (!_data) {
  18639. continue;
  18640. }
  18641. if (_data.annotationType === _util.AnnotationType.POPUP) {
  18642. popupAnnotations.push(_data);
  18643. continue;
  18644. }
  18645. sortedAnnotations.push(_data);
  18646. }
  18647. } catch (err) {
  18648. _iterator5.e(err);
  18649. } finally {
  18650. _iterator5.f();
  18651. }
  18652. if (popupAnnotations.length) {
  18653. sortedAnnotations.push.apply(sortedAnnotations, popupAnnotations);
  18654. }
  18655. for (var _i = 0, _sortedAnnotations = sortedAnnotations; _i < _sortedAnnotations.length; _i++) {
  18656. var data = _sortedAnnotations[_i];
  18657. var element = AnnotationElementFactory.create({
  18658. data: data,
  18659. layer: parameters.div,
  18660. page: parameters.page,
  18661. viewport: parameters.viewport,
  18662. linkService: parameters.linkService,
  18663. downloadManager: parameters.downloadManager,
  18664. imageResourcesPath: parameters.imageResourcesPath || "",
  18665. renderInteractiveForms: parameters.renderInteractiveForms || false,
  18666. svgFactory: new _display_utils.DOMSVGFactory()
  18667. });
  18668. if (element.isRenderable) {
  18669. parameters.div.appendChild(element.render());
  18670. }
  18671. }
  18672. }
  18673. }, {
  18674. key: "update",
  18675. value: function update(parameters) {
  18676. var _iterator6 = _createForOfIteratorHelper(parameters.annotations),
  18677. _step6;
  18678. try {
  18679. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  18680. var data = _step6.value;
  18681. var element = parameters.div.querySelector("[data-annotation-id=\"".concat(data.id, "\"]"));
  18682. if (element) {
  18683. element.style.transform = "matrix(".concat(parameters.viewport.transform.join(","), ")");
  18684. }
  18685. }
  18686. } catch (err) {
  18687. _iterator6.e(err);
  18688. } finally {
  18689. _iterator6.f();
  18690. }
  18691. parameters.div.removeAttribute("hidden");
  18692. }
  18693. }]);
  18694. return AnnotationLayer;
  18695. }();
  18696. exports.AnnotationLayer = AnnotationLayer;
  18697. /***/ }),
  18698. /* 210 */
  18699. /***/ (function(module, exports, __w_pdfjs_require__) {
  18700. "use strict";
  18701. Object.defineProperty(exports, "__esModule", {
  18702. value: true
  18703. });
  18704. exports.renderTextLayer = void 0;
  18705. var _util = __w_pdfjs_require__(5);
  18706. var renderTextLayer = function renderTextLayerClosure() {
  18707. var MAX_TEXT_DIVS_TO_RENDER = 100000;
  18708. var NonWhitespaceRegexp = /\S/;
  18709. function isAllWhitespace(str) {
  18710. return !NonWhitespaceRegexp.test(str);
  18711. }
  18712. function appendText(task, geom, styles) {
  18713. var textDiv = document.createElement("span");
  18714. var textDivProperties = {
  18715. angle: 0,
  18716. canvasWidth: 0,
  18717. isWhitespace: false,
  18718. originalTransform: null,
  18719. paddingBottom: 0,
  18720. paddingLeft: 0,
  18721. paddingRight: 0,
  18722. paddingTop: 0,
  18723. scale: 1
  18724. };
  18725. task._textDivs.push(textDiv);
  18726. if (isAllWhitespace(geom.str)) {
  18727. textDivProperties.isWhitespace = true;
  18728. task._textDivProperties.set(textDiv, textDivProperties);
  18729. return;
  18730. }
  18731. var tx = _util.Util.transform(task._viewport.transform, geom.transform);
  18732. var angle = Math.atan2(tx[1], tx[0]);
  18733. var style = styles[geom.fontName];
  18734. if (style.vertical) {
  18735. angle += Math.PI / 2;
  18736. }
  18737. var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]);
  18738. var fontAscent = fontHeight;
  18739. if (style.ascent) {
  18740. fontAscent = style.ascent * fontAscent;
  18741. } else if (style.descent) {
  18742. fontAscent = (1 + style.descent) * fontAscent;
  18743. }
  18744. var left, top;
  18745. if (angle === 0) {
  18746. left = tx[4];
  18747. top = tx[5] - fontAscent;
  18748. } else {
  18749. left = tx[4] + fontAscent * Math.sin(angle);
  18750. top = tx[5] - fontAscent * Math.cos(angle);
  18751. }
  18752. textDiv.style.left = "".concat(left, "px");
  18753. textDiv.style.top = "".concat(top, "px");
  18754. textDiv.style.fontSize = "".concat(fontHeight, "px");
  18755. textDiv.style.fontFamily = style.fontFamily;
  18756. textDiv.textContent = geom.str;
  18757. if (task._fontInspectorEnabled) {
  18758. textDiv.dataset.fontName = geom.fontName;
  18759. }
  18760. if (angle !== 0) {
  18761. textDivProperties.angle = angle * (180 / Math.PI);
  18762. }
  18763. var shouldScaleText = false;
  18764. if (geom.str.length > 1) {
  18765. shouldScaleText = true;
  18766. } else if (geom.transform[0] !== geom.transform[3]) {
  18767. var absScaleX = Math.abs(geom.transform[0]),
  18768. absScaleY = Math.abs(geom.transform[3]);
  18769. if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
  18770. shouldScaleText = true;
  18771. }
  18772. }
  18773. if (shouldScaleText) {
  18774. if (style.vertical) {
  18775. textDivProperties.canvasWidth = geom.height * task._viewport.scale;
  18776. } else {
  18777. textDivProperties.canvasWidth = geom.width * task._viewport.scale;
  18778. }
  18779. }
  18780. task._textDivProperties.set(textDiv, textDivProperties);
  18781. if (task._textContentStream) {
  18782. task._layoutText(textDiv);
  18783. }
  18784. if (task._enhanceTextSelection) {
  18785. var angleCos = 1,
  18786. angleSin = 0;
  18787. if (angle !== 0) {
  18788. angleCos = Math.cos(angle);
  18789. angleSin = Math.sin(angle);
  18790. }
  18791. var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale;
  18792. var divHeight = fontHeight;
  18793. var m, b;
  18794. if (angle !== 0) {
  18795. m = [angleCos, angleSin, -angleSin, angleCos, left, top];
  18796. b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m);
  18797. } else {
  18798. b = [left, top, left + divWidth, top + divHeight];
  18799. }
  18800. task._bounds.push({
  18801. left: b[0],
  18802. top: b[1],
  18803. right: b[2],
  18804. bottom: b[3],
  18805. div: textDiv,
  18806. size: [divWidth, divHeight],
  18807. m: m
  18808. });
  18809. }
  18810. }
  18811. function render(task) {
  18812. if (task._canceled) {
  18813. return;
  18814. }
  18815. var textDivs = task._textDivs;
  18816. var capability = task._capability;
  18817. var textDivsLength = textDivs.length;
  18818. if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {
  18819. task._renderingDone = true;
  18820. capability.resolve();
  18821. return;
  18822. }
  18823. if (!task._textContentStream) {
  18824. for (var i = 0; i < textDivsLength; i++) {
  18825. task._layoutText(textDivs[i]);
  18826. }
  18827. }
  18828. task._renderingDone = true;
  18829. capability.resolve();
  18830. }
  18831. function findPositiveMin(ts, offset, count) {
  18832. var result = 0;
  18833. for (var i = 0; i < count; i++) {
  18834. var t = ts[offset++];
  18835. if (t > 0) {
  18836. result = result ? Math.min(t, result) : t;
  18837. }
  18838. }
  18839. return result;
  18840. }
  18841. function expand(task) {
  18842. var bounds = task._bounds;
  18843. var viewport = task._viewport;
  18844. var expanded = expandBounds(viewport.width, viewport.height, bounds);
  18845. for (var i = 0; i < expanded.length; i++) {
  18846. var div = bounds[i].div;
  18847. var divProperties = task._textDivProperties.get(div);
  18848. if (divProperties.angle === 0) {
  18849. divProperties.paddingLeft = bounds[i].left - expanded[i].left;
  18850. divProperties.paddingTop = bounds[i].top - expanded[i].top;
  18851. divProperties.paddingRight = expanded[i].right - bounds[i].right;
  18852. divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom;
  18853. task._textDivProperties.set(div, divProperties);
  18854. continue;
  18855. }
  18856. var e = expanded[i],
  18857. b = bounds[i];
  18858. var m = b.m,
  18859. c = m[0],
  18860. s = m[1];
  18861. var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size];
  18862. var ts = new Float64Array(64);
  18863. points.forEach(function (p, j) {
  18864. var t = _util.Util.applyTransform(p, m);
  18865. ts[j + 0] = c && (e.left - t[0]) / c;
  18866. ts[j + 4] = s && (e.top - t[1]) / s;
  18867. ts[j + 8] = c && (e.right - t[0]) / c;
  18868. ts[j + 12] = s && (e.bottom - t[1]) / s;
  18869. ts[j + 16] = s && (e.left - t[0]) / -s;
  18870. ts[j + 20] = c && (e.top - t[1]) / c;
  18871. ts[j + 24] = s && (e.right - t[0]) / -s;
  18872. ts[j + 28] = c && (e.bottom - t[1]) / c;
  18873. ts[j + 32] = c && (e.left - t[0]) / -c;
  18874. ts[j + 36] = s && (e.top - t[1]) / -s;
  18875. ts[j + 40] = c && (e.right - t[0]) / -c;
  18876. ts[j + 44] = s && (e.bottom - t[1]) / -s;
  18877. ts[j + 48] = s && (e.left - t[0]) / s;
  18878. ts[j + 52] = c && (e.top - t[1]) / -c;
  18879. ts[j + 56] = s && (e.right - t[0]) / s;
  18880. ts[j + 60] = c && (e.bottom - t[1]) / -c;
  18881. });
  18882. var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
  18883. divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale;
  18884. divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale;
  18885. divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale;
  18886. divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale;
  18887. task._textDivProperties.set(div, divProperties);
  18888. }
  18889. }
  18890. function expandBounds(width, height, boxes) {
  18891. var bounds = boxes.map(function (box, i) {
  18892. return {
  18893. x1: box.left,
  18894. y1: box.top,
  18895. x2: box.right,
  18896. y2: box.bottom,
  18897. index: i,
  18898. x1New: undefined,
  18899. x2New: undefined
  18900. };
  18901. });
  18902. expandBoundsLTR(width, bounds);
  18903. var expanded = new Array(boxes.length);
  18904. bounds.forEach(function (b) {
  18905. var i = b.index;
  18906. expanded[i] = {
  18907. left: b.x1New,
  18908. top: 0,
  18909. right: b.x2New,
  18910. bottom: 0
  18911. };
  18912. });
  18913. boxes.map(function (box, i) {
  18914. var e = expanded[i],
  18915. b = bounds[i];
  18916. b.x1 = box.top;
  18917. b.y1 = width - e.right;
  18918. b.x2 = box.bottom;
  18919. b.y2 = width - e.left;
  18920. b.index = i;
  18921. b.x1New = undefined;
  18922. b.x2New = undefined;
  18923. });
  18924. expandBoundsLTR(height, bounds);
  18925. bounds.forEach(function (b) {
  18926. var i = b.index;
  18927. expanded[i].top = b.x1New;
  18928. expanded[i].bottom = b.x2New;
  18929. });
  18930. return expanded;
  18931. }
  18932. function expandBoundsLTR(width, bounds) {
  18933. bounds.sort(function (a, b) {
  18934. return a.x1 - b.x1 || a.index - b.index;
  18935. });
  18936. var fakeBoundary = {
  18937. x1: -Infinity,
  18938. y1: -Infinity,
  18939. x2: 0,
  18940. y2: Infinity,
  18941. index: -1,
  18942. x1New: 0,
  18943. x2New: 0
  18944. };
  18945. var horizon = [{
  18946. start: -Infinity,
  18947. end: Infinity,
  18948. boundary: fakeBoundary
  18949. }];
  18950. bounds.forEach(function (boundary) {
  18951. var i = 0;
  18952. while (i < horizon.length && horizon[i].end <= boundary.y1) {
  18953. i++;
  18954. }
  18955. var j = horizon.length - 1;
  18956. while (j >= 0 && horizon[j].start >= boundary.y2) {
  18957. j--;
  18958. }
  18959. var horizonPart, affectedBoundary;
  18960. var q,
  18961. k,
  18962. maxXNew = -Infinity;
  18963. for (q = i; q <= j; q++) {
  18964. horizonPart = horizon[q];
  18965. affectedBoundary = horizonPart.boundary;
  18966. var xNew;
  18967. if (affectedBoundary.x2 > boundary.x1) {
  18968. xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1;
  18969. } else if (affectedBoundary.x2New === undefined) {
  18970. xNew = (affectedBoundary.x2 + boundary.x1) / 2;
  18971. } else {
  18972. xNew = affectedBoundary.x2New;
  18973. }
  18974. if (xNew > maxXNew) {
  18975. maxXNew = xNew;
  18976. }
  18977. }
  18978. boundary.x1New = maxXNew;
  18979. for (q = i; q <= j; q++) {
  18980. horizonPart = horizon[q];
  18981. affectedBoundary = horizonPart.boundary;
  18982. if (affectedBoundary.x2New === undefined) {
  18983. if (affectedBoundary.x2 > boundary.x1) {
  18984. if (affectedBoundary.index > boundary.index) {
  18985. affectedBoundary.x2New = affectedBoundary.x2;
  18986. }
  18987. } else {
  18988. affectedBoundary.x2New = maxXNew;
  18989. }
  18990. } else if (affectedBoundary.x2New > maxXNew) {
  18991. affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2);
  18992. }
  18993. }
  18994. var changedHorizon = [],
  18995. lastBoundary = null;
  18996. for (q = i; q <= j; q++) {
  18997. horizonPart = horizon[q];
  18998. affectedBoundary = horizonPart.boundary;
  18999. var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary;
  19000. if (lastBoundary === useBoundary) {
  19001. changedHorizon[changedHorizon.length - 1].end = horizonPart.end;
  19002. } else {
  19003. changedHorizon.push({
  19004. start: horizonPart.start,
  19005. end: horizonPart.end,
  19006. boundary: useBoundary
  19007. });
  19008. lastBoundary = useBoundary;
  19009. }
  19010. }
  19011. if (horizon[i].start < boundary.y1) {
  19012. changedHorizon[0].start = boundary.y1;
  19013. changedHorizon.unshift({
  19014. start: horizon[i].start,
  19015. end: boundary.y1,
  19016. boundary: horizon[i].boundary
  19017. });
  19018. }
  19019. if (boundary.y2 < horizon[j].end) {
  19020. changedHorizon[changedHorizon.length - 1].end = boundary.y2;
  19021. changedHorizon.push({
  19022. start: boundary.y2,
  19023. end: horizon[j].end,
  19024. boundary: horizon[j].boundary
  19025. });
  19026. }
  19027. for (q = i; q <= j; q++) {
  19028. horizonPart = horizon[q];
  19029. affectedBoundary = horizonPart.boundary;
  19030. if (affectedBoundary.x2New !== undefined) {
  19031. continue;
  19032. }
  19033. var used = false;
  19034. for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) {
  19035. used = horizon[k].boundary === affectedBoundary;
  19036. }
  19037. for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) {
  19038. used = horizon[k].boundary === affectedBoundary;
  19039. }
  19040. for (k = 0; !used && k < changedHorizon.length; k++) {
  19041. used = changedHorizon[k].boundary === affectedBoundary;
  19042. }
  19043. if (!used) {
  19044. affectedBoundary.x2New = maxXNew;
  19045. }
  19046. }
  19047. Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon));
  19048. });
  19049. horizon.forEach(function (horizonPart) {
  19050. var affectedBoundary = horizonPart.boundary;
  19051. if (affectedBoundary.x2New === undefined) {
  19052. affectedBoundary.x2New = Math.max(width, affectedBoundary.x2);
  19053. }
  19054. });
  19055. }
  19056. function TextLayerRenderTask(_ref) {
  19057. var _this = this;
  19058. var textContent = _ref.textContent,
  19059. textContentStream = _ref.textContentStream,
  19060. container = _ref.container,
  19061. viewport = _ref.viewport,
  19062. textDivs = _ref.textDivs,
  19063. textContentItemsStr = _ref.textContentItemsStr,
  19064. enhanceTextSelection = _ref.enhanceTextSelection;
  19065. this._textContent = textContent;
  19066. this._textContentStream = textContentStream;
  19067. this._container = container;
  19068. this._viewport = viewport;
  19069. this._textDivs = textDivs || [];
  19070. this._textContentItemsStr = textContentItemsStr || [];
  19071. this._enhanceTextSelection = !!enhanceTextSelection;
  19072. this._fontInspectorEnabled = !!(globalThis.FontInspector && globalThis.FontInspector.enabled);
  19073. this._reader = null;
  19074. this._layoutTextLastFontSize = null;
  19075. this._layoutTextLastFontFamily = null;
  19076. this._layoutTextCtx = null;
  19077. this._textDivProperties = new WeakMap();
  19078. this._renderingDone = false;
  19079. this._canceled = false;
  19080. this._capability = (0, _util.createPromiseCapability)();
  19081. this._renderTimer = null;
  19082. this._bounds = [];
  19083. this._capability.promise["finally"](function () {
  19084. if (_this._layoutTextCtx) {
  19085. _this._layoutTextCtx.canvas.width = 0;
  19086. _this._layoutTextCtx.canvas.height = 0;
  19087. _this._layoutTextCtx = null;
  19088. }
  19089. })["catch"](function () {});
  19090. }
  19091. TextLayerRenderTask.prototype = {
  19092. get promise() {
  19093. return this._capability.promise;
  19094. },
  19095. cancel: function TextLayer_cancel() {
  19096. this._canceled = true;
  19097. if (this._reader) {
  19098. this._reader.cancel(new _util.AbortException("TextLayer task cancelled."));
  19099. this._reader = null;
  19100. }
  19101. if (this._renderTimer !== null) {
  19102. clearTimeout(this._renderTimer);
  19103. this._renderTimer = null;
  19104. }
  19105. this._capability.reject(new Error("TextLayer task cancelled."));
  19106. },
  19107. _processItems: function _processItems(items, styleCache) {
  19108. for (var i = 0, len = items.length; i < len; i++) {
  19109. this._textContentItemsStr.push(items[i].str);
  19110. appendText(this, items[i], styleCache);
  19111. }
  19112. },
  19113. _layoutText: function _layoutText(textDiv) {
  19114. var textDivProperties = this._textDivProperties.get(textDiv);
  19115. if (textDivProperties.isWhitespace) {
  19116. return;
  19117. }
  19118. var transform = "";
  19119. if (textDivProperties.canvasWidth !== 0) {
  19120. var _textDiv$style = textDiv.style,
  19121. fontSize = _textDiv$style.fontSize,
  19122. fontFamily = _textDiv$style.fontFamily;
  19123. if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) {
  19124. this._layoutTextCtx.font = "".concat(fontSize, " ").concat(fontFamily);
  19125. this._layoutTextLastFontSize = fontSize;
  19126. this._layoutTextLastFontFamily = fontFamily;
  19127. }
  19128. var _this$_layoutTextCtx$ = this._layoutTextCtx.measureText(textDiv.textContent),
  19129. width = _this$_layoutTextCtx$.width;
  19130. if (width > 0) {
  19131. textDivProperties.scale = textDivProperties.canvasWidth / width;
  19132. transform = "scaleX(".concat(textDivProperties.scale, ")");
  19133. }
  19134. }
  19135. if (textDivProperties.angle !== 0) {
  19136. transform = "rotate(".concat(textDivProperties.angle, "deg) ").concat(transform);
  19137. }
  19138. if (transform.length > 0) {
  19139. if (this._enhanceTextSelection) {
  19140. textDivProperties.originalTransform = transform;
  19141. }
  19142. textDiv.style.transform = transform;
  19143. }
  19144. this._textDivProperties.set(textDiv, textDivProperties);
  19145. this._container.appendChild(textDiv);
  19146. },
  19147. _render: function TextLayer_render(timeout) {
  19148. var _this2 = this;
  19149. var capability = (0, _util.createPromiseCapability)();
  19150. var styleCache = Object.create(null);
  19151. var canvas = document.createElement("canvas");
  19152. canvas.mozOpaque = true;
  19153. this._layoutTextCtx = canvas.getContext("2d", {
  19154. alpha: false
  19155. });
  19156. if (this._textContent) {
  19157. var textItems = this._textContent.items;
  19158. var textStyles = this._textContent.styles;
  19159. this._processItems(textItems, textStyles);
  19160. capability.resolve();
  19161. } else if (this._textContentStream) {
  19162. var pump = function pump() {
  19163. _this2._reader.read().then(function (_ref2) {
  19164. var value = _ref2.value,
  19165. done = _ref2.done;
  19166. if (done) {
  19167. capability.resolve();
  19168. return;
  19169. }
  19170. Object.assign(styleCache, value.styles);
  19171. _this2._processItems(value.items, styleCache);
  19172. pump();
  19173. }, capability.reject);
  19174. };
  19175. this._reader = this._textContentStream.getReader();
  19176. pump();
  19177. } else {
  19178. throw new Error('Neither "textContent" nor "textContentStream"' + " parameters specified.");
  19179. }
  19180. capability.promise.then(function () {
  19181. styleCache = null;
  19182. if (!timeout) {
  19183. render(_this2);
  19184. } else {
  19185. _this2._renderTimer = setTimeout(function () {
  19186. render(_this2);
  19187. _this2._renderTimer = null;
  19188. }, timeout);
  19189. }
  19190. }, this._capability.reject);
  19191. },
  19192. expandTextDivs: function TextLayer_expandTextDivs(expandDivs) {
  19193. if (!this._enhanceTextSelection || !this._renderingDone) {
  19194. return;
  19195. }
  19196. if (this._bounds !== null) {
  19197. expand(this);
  19198. this._bounds = null;
  19199. }
  19200. var transformBuf = [],
  19201. paddingBuf = [];
  19202. for (var i = 0, ii = this._textDivs.length; i < ii; i++) {
  19203. var div = this._textDivs[i];
  19204. var divProps = this._textDivProperties.get(div);
  19205. if (divProps.isWhitespace) {
  19206. continue;
  19207. }
  19208. if (expandDivs) {
  19209. transformBuf.length = 0;
  19210. paddingBuf.length = 0;
  19211. if (divProps.originalTransform) {
  19212. transformBuf.push(divProps.originalTransform);
  19213. }
  19214. if (divProps.paddingTop > 0) {
  19215. paddingBuf.push("".concat(divProps.paddingTop, "px"));
  19216. transformBuf.push("translateY(".concat(-divProps.paddingTop, "px)"));
  19217. } else {
  19218. paddingBuf.push(0);
  19219. }
  19220. if (divProps.paddingRight > 0) {
  19221. paddingBuf.push("".concat(divProps.paddingRight / divProps.scale, "px"));
  19222. } else {
  19223. paddingBuf.push(0);
  19224. }
  19225. if (divProps.paddingBottom > 0) {
  19226. paddingBuf.push("".concat(divProps.paddingBottom, "px"));
  19227. } else {
  19228. paddingBuf.push(0);
  19229. }
  19230. if (divProps.paddingLeft > 0) {
  19231. paddingBuf.push("".concat(divProps.paddingLeft / divProps.scale, "px"));
  19232. transformBuf.push("translateX(".concat(-divProps.paddingLeft / divProps.scale, "px)"));
  19233. } else {
  19234. paddingBuf.push(0);
  19235. }
  19236. div.style.padding = paddingBuf.join(" ");
  19237. if (transformBuf.length) {
  19238. div.style.transform = transformBuf.join(" ");
  19239. }
  19240. } else {
  19241. div.style.padding = null;
  19242. div.style.transform = divProps.originalTransform;
  19243. }
  19244. }
  19245. }
  19246. };
  19247. function renderTextLayer(renderParameters) {
  19248. var task = new TextLayerRenderTask({
  19249. textContent: renderParameters.textContent,
  19250. textContentStream: renderParameters.textContentStream,
  19251. container: renderParameters.container,
  19252. viewport: renderParameters.viewport,
  19253. textDivs: renderParameters.textDivs,
  19254. textContentItemsStr: renderParameters.textContentItemsStr,
  19255. enhanceTextSelection: renderParameters.enhanceTextSelection
  19256. });
  19257. task._render(renderParameters.timeout);
  19258. return task;
  19259. }
  19260. return renderTextLayer;
  19261. }();
  19262. exports.renderTextLayer = renderTextLayer;
  19263. /***/ }),
  19264. /* 211 */
  19265. /***/ (function(module, exports, __w_pdfjs_require__) {
  19266. "use strict";
  19267. Object.defineProperty(exports, "__esModule", {
  19268. value: true
  19269. });
  19270. exports.SVGGraphics = void 0;
  19271. var _util = __w_pdfjs_require__(5);
  19272. var _display_utils = __w_pdfjs_require__(1);
  19273. var _is_node = __w_pdfjs_require__(7);
  19274. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  19275. 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."); }
  19276. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
  19277. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  19278. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  19279. 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."); }
  19280. function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; }
  19281. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  19282. function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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; } } }; }
  19283. 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); }
  19284. 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; }
  19285. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19286. 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); } }
  19287. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19288. var SVGGraphics = function SVGGraphics() {
  19289. throw new Error("Not implemented: SVGGraphics");
  19290. };
  19291. exports.SVGGraphics = SVGGraphics;
  19292. {
  19293. var opListToTree = function opListToTree(opList) {
  19294. var opTree = [];
  19295. var tmp = [];
  19296. var _iterator = _createForOfIteratorHelper(opList),
  19297. _step;
  19298. try {
  19299. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  19300. var opListElement = _step.value;
  19301. if (opListElement.fn === "save") {
  19302. opTree.push({
  19303. fnId: 92,
  19304. fn: "group",
  19305. items: []
  19306. });
  19307. tmp.push(opTree);
  19308. opTree = opTree[opTree.length - 1].items;
  19309. continue;
  19310. }
  19311. if (opListElement.fn === "restore") {
  19312. opTree = tmp.pop();
  19313. } else {
  19314. opTree.push(opListElement);
  19315. }
  19316. }
  19317. } catch (err) {
  19318. _iterator.e(err);
  19319. } finally {
  19320. _iterator.f();
  19321. }
  19322. return opTree;
  19323. };
  19324. var pf = function pf(value) {
  19325. if (Number.isInteger(value)) {
  19326. return value.toString();
  19327. }
  19328. var s = value.toFixed(10);
  19329. var i = s.length - 1;
  19330. if (s[i] !== "0") {
  19331. return s;
  19332. }
  19333. do {
  19334. i--;
  19335. } while (s[i] === "0");
  19336. return s.substring(0, s[i] === "." ? i : i + 1);
  19337. };
  19338. var pm = function pm(m) {
  19339. if (m[4] === 0 && m[5] === 0) {
  19340. if (m[1] === 0 && m[2] === 0) {
  19341. if (m[0] === 1 && m[3] === 1) {
  19342. return "";
  19343. }
  19344. return "scale(".concat(pf(m[0]), " ").concat(pf(m[3]), ")");
  19345. }
  19346. if (m[0] === m[3] && m[1] === -m[2]) {
  19347. var a = Math.acos(m[0]) * 180 / Math.PI;
  19348. return "rotate(".concat(pf(a), ")");
  19349. }
  19350. } else {
  19351. if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {
  19352. return "translate(".concat(pf(m[4]), " ").concat(pf(m[5]), ")");
  19353. }
  19354. }
  19355. 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]), ")");
  19356. };
  19357. var SVG_DEFAULTS = {
  19358. fontStyle: "normal",
  19359. fontWeight: "normal",
  19360. fillColor: "#000000"
  19361. };
  19362. var XML_NS = "http://www.w3.org/XML/1998/namespace";
  19363. var XLINK_NS = "http://www.w3.org/1999/xlink";
  19364. var LINE_CAP_STYLES = ["butt", "round", "square"];
  19365. var LINE_JOIN_STYLES = ["miter", "round", "bevel"];
  19366. var convertImgDataToPng = function () {
  19367. var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
  19368. var CHUNK_WRAPPER_SIZE = 12;
  19369. var crcTable = new Int32Array(256);
  19370. for (var i = 0; i < 256; i++) {
  19371. var c = i;
  19372. for (var h = 0; h < 8; h++) {
  19373. if (c & 1) {
  19374. c = 0xedb88320 ^ c >> 1 & 0x7fffffff;
  19375. } else {
  19376. c = c >> 1 & 0x7fffffff;
  19377. }
  19378. }
  19379. crcTable[i] = c;
  19380. }
  19381. function crc32(data, start, end) {
  19382. var crc = -1;
  19383. for (var _i = start; _i < end; _i++) {
  19384. var a = (crc ^ data[_i]) & 0xff;
  19385. var b = crcTable[a];
  19386. crc = crc >>> 8 ^ b;
  19387. }
  19388. return crc ^ -1;
  19389. }
  19390. function writePngChunk(type, body, data, offset) {
  19391. var p = offset;
  19392. var len = body.length;
  19393. data[p] = len >> 24 & 0xff;
  19394. data[p + 1] = len >> 16 & 0xff;
  19395. data[p + 2] = len >> 8 & 0xff;
  19396. data[p + 3] = len & 0xff;
  19397. p += 4;
  19398. data[p] = type.charCodeAt(0) & 0xff;
  19399. data[p + 1] = type.charCodeAt(1) & 0xff;
  19400. data[p + 2] = type.charCodeAt(2) & 0xff;
  19401. data[p + 3] = type.charCodeAt(3) & 0xff;
  19402. p += 4;
  19403. data.set(body, p);
  19404. p += body.length;
  19405. var crc = crc32(data, offset + 4, p);
  19406. data[p] = crc >> 24 & 0xff;
  19407. data[p + 1] = crc >> 16 & 0xff;
  19408. data[p + 2] = crc >> 8 & 0xff;
  19409. data[p + 3] = crc & 0xff;
  19410. }
  19411. function adler32(data, start, end) {
  19412. var a = 1;
  19413. var b = 0;
  19414. for (var _i2 = start; _i2 < end; ++_i2) {
  19415. a = (a + (data[_i2] & 0xff)) % 65521;
  19416. b = (b + a) % 65521;
  19417. }
  19418. return b << 16 | a;
  19419. }
  19420. function deflateSync(literals) {
  19421. if (!_is_node.isNodeJS) {
  19422. return deflateSyncUncompressed(literals);
  19423. }
  19424. try {
  19425. var input;
  19426. if (parseInt(process.versions.node) >= 8) {
  19427. input = literals;
  19428. } else {
  19429. input = Buffer.from(literals);
  19430. }
  19431. var output = require("zlib").deflateSync(input, {
  19432. level: 9
  19433. });
  19434. return output instanceof Uint8Array ? output : new Uint8Array(output);
  19435. } catch (e) {
  19436. (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e);
  19437. }
  19438. return deflateSyncUncompressed(literals);
  19439. }
  19440. function deflateSyncUncompressed(literals) {
  19441. var len = literals.length;
  19442. var maxBlockLength = 0xffff;
  19443. var deflateBlocks = Math.ceil(len / maxBlockLength);
  19444. var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);
  19445. var pi = 0;
  19446. idat[pi++] = 0x78;
  19447. idat[pi++] = 0x9c;
  19448. var pos = 0;
  19449. while (len > maxBlockLength) {
  19450. idat[pi++] = 0x00;
  19451. idat[pi++] = 0xff;
  19452. idat[pi++] = 0xff;
  19453. idat[pi++] = 0x00;
  19454. idat[pi++] = 0x00;
  19455. idat.set(literals.subarray(pos, pos + maxBlockLength), pi);
  19456. pi += maxBlockLength;
  19457. pos += maxBlockLength;
  19458. len -= maxBlockLength;
  19459. }
  19460. idat[pi++] = 0x01;
  19461. idat[pi++] = len & 0xff;
  19462. idat[pi++] = len >> 8 & 0xff;
  19463. idat[pi++] = ~len & 0xffff & 0xff;
  19464. idat[pi++] = (~len & 0xffff) >> 8 & 0xff;
  19465. idat.set(literals.subarray(pos), pi);
  19466. pi += literals.length - pos;
  19467. var adler = adler32(literals, 0, literals.length);
  19468. idat[pi++] = adler >> 24 & 0xff;
  19469. idat[pi++] = adler >> 16 & 0xff;
  19470. idat[pi++] = adler >> 8 & 0xff;
  19471. idat[pi++] = adler & 0xff;
  19472. return idat;
  19473. }
  19474. function encode(imgData, kind, forceDataSchema, isMask) {
  19475. var width = imgData.width;
  19476. var height = imgData.height;
  19477. var bitDepth, colorType, lineSize;
  19478. var bytes = imgData.data;
  19479. switch (kind) {
  19480. case _util.ImageKind.GRAYSCALE_1BPP:
  19481. colorType = 0;
  19482. bitDepth = 1;
  19483. lineSize = width + 7 >> 3;
  19484. break;
  19485. case _util.ImageKind.RGB_24BPP:
  19486. colorType = 2;
  19487. bitDepth = 8;
  19488. lineSize = width * 3;
  19489. break;
  19490. case _util.ImageKind.RGBA_32BPP:
  19491. colorType = 6;
  19492. bitDepth = 8;
  19493. lineSize = width * 4;
  19494. break;
  19495. default:
  19496. throw new Error("invalid format");
  19497. }
  19498. var literals = new Uint8Array((1 + lineSize) * height);
  19499. var offsetLiterals = 0,
  19500. offsetBytes = 0;
  19501. for (var y = 0; y < height; ++y) {
  19502. literals[offsetLiterals++] = 0;
  19503. literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);
  19504. offsetBytes += lineSize;
  19505. offsetLiterals += lineSize;
  19506. }
  19507. if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {
  19508. offsetLiterals = 0;
  19509. for (var _y = 0; _y < height; _y++) {
  19510. offsetLiterals++;
  19511. for (var _i3 = 0; _i3 < lineSize; _i3++) {
  19512. literals[offsetLiterals++] ^= 0xff;
  19513. }
  19514. }
  19515. }
  19516. 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]);
  19517. var idat = deflateSync(literals);
  19518. var pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;
  19519. var data = new Uint8Array(pngLength);
  19520. var offset = 0;
  19521. data.set(PNG_HEADER, offset);
  19522. offset += PNG_HEADER.length;
  19523. writePngChunk("IHDR", ihdr, data, offset);
  19524. offset += CHUNK_WRAPPER_SIZE + ihdr.length;
  19525. writePngChunk("IDATA", idat, data, offset);
  19526. offset += CHUNK_WRAPPER_SIZE + idat.length;
  19527. writePngChunk("IEND", new Uint8Array(0), data, offset);
  19528. return (0, _util.createObjectURL)(data, "image/png", forceDataSchema);
  19529. }
  19530. return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
  19531. var kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;
  19532. return encode(imgData, kind, forceDataSchema, isMask);
  19533. };
  19534. }();
  19535. var SVGExtraState = /*#__PURE__*/function () {
  19536. function SVGExtraState() {
  19537. _classCallCheck(this, SVGExtraState);
  19538. this.fontSizeScale = 1;
  19539. this.fontWeight = SVG_DEFAULTS.fontWeight;
  19540. this.fontSize = 0;
  19541. this.textMatrix = _util.IDENTITY_MATRIX;
  19542. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  19543. this.leading = 0;
  19544. this.textRenderingMode = _util.TextRenderingMode.FILL;
  19545. this.textMatrixScale = 1;
  19546. this.x = 0;
  19547. this.y = 0;
  19548. this.lineX = 0;
  19549. this.lineY = 0;
  19550. this.charSpacing = 0;
  19551. this.wordSpacing = 0;
  19552. this.textHScale = 1;
  19553. this.textRise = 0;
  19554. this.fillColor = SVG_DEFAULTS.fillColor;
  19555. this.strokeColor = "#000000";
  19556. this.fillAlpha = 1;
  19557. this.strokeAlpha = 1;
  19558. this.lineWidth = 1;
  19559. this.lineJoin = "";
  19560. this.lineCap = "";
  19561. this.miterLimit = 0;
  19562. this.dashArray = [];
  19563. this.dashPhase = 0;
  19564. this.dependencies = [];
  19565. this.activeClipUrl = null;
  19566. this.clipGroup = null;
  19567. this.maskId = "";
  19568. }
  19569. _createClass(SVGExtraState, [{
  19570. key: "clone",
  19571. value: function clone() {
  19572. return Object.create(this);
  19573. }
  19574. }, {
  19575. key: "setCurrentPoint",
  19576. value: function setCurrentPoint(x, y) {
  19577. this.x = x;
  19578. this.y = y;
  19579. }
  19580. }]);
  19581. return SVGExtraState;
  19582. }();
  19583. var clipCount = 0;
  19584. var maskCount = 0;
  19585. var shadingCount = 0;
  19586. exports.SVGGraphics = SVGGraphics = /*#__PURE__*/function () {
  19587. function SVGGraphics(commonObjs, objs) {
  19588. var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19589. _classCallCheck(this, SVGGraphics);
  19590. this.svgFactory = new _display_utils.DOMSVGFactory();
  19591. this.current = new SVGExtraState();
  19592. this.transformMatrix = _util.IDENTITY_MATRIX;
  19593. this.transformStack = [];
  19594. this.extraStack = [];
  19595. this.commonObjs = commonObjs;
  19596. this.objs = objs;
  19597. this.pendingClip = null;
  19598. this.pendingEOFill = false;
  19599. this.embedFonts = false;
  19600. this.embeddedFonts = Object.create(null);
  19601. this.cssStyle = null;
  19602. this.forceDataSchema = !!forceDataSchema;
  19603. this._operatorIdMapping = [];
  19604. for (var op in _util.OPS) {
  19605. this._operatorIdMapping[_util.OPS[op]] = op;
  19606. }
  19607. }
  19608. _createClass(SVGGraphics, [{
  19609. key: "save",
  19610. value: function save() {
  19611. this.transformStack.push(this.transformMatrix);
  19612. var old = this.current;
  19613. this.extraStack.push(old);
  19614. this.current = old.clone();
  19615. }
  19616. }, {
  19617. key: "restore",
  19618. value: function restore() {
  19619. this.transformMatrix = this.transformStack.pop();
  19620. this.current = this.extraStack.pop();
  19621. this.pendingClip = null;
  19622. this.tgrp = null;
  19623. }
  19624. }, {
  19625. key: "group",
  19626. value: function group(items) {
  19627. this.save();
  19628. this.executeOpTree(items);
  19629. this.restore();
  19630. }
  19631. }, {
  19632. key: "loadDependencies",
  19633. value: function loadDependencies(operatorList) {
  19634. var _this = this;
  19635. var fnArray = operatorList.fnArray;
  19636. var argsArray = operatorList.argsArray;
  19637. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  19638. if (fnArray[i] !== _util.OPS.dependency) {
  19639. continue;
  19640. }
  19641. var _iterator2 = _createForOfIteratorHelper(argsArray[i]),
  19642. _step2;
  19643. try {
  19644. var _loop = function _loop() {
  19645. var obj = _step2.value;
  19646. var objsPool = obj.startsWith("g_") ? _this.commonObjs : _this.objs;
  19647. var promise = new Promise(function (resolve) {
  19648. objsPool.get(obj, resolve);
  19649. });
  19650. _this.current.dependencies.push(promise);
  19651. };
  19652. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  19653. _loop();
  19654. }
  19655. } catch (err) {
  19656. _iterator2.e(err);
  19657. } finally {
  19658. _iterator2.f();
  19659. }
  19660. }
  19661. return Promise.all(this.current.dependencies);
  19662. }
  19663. }, {
  19664. key: "transform",
  19665. value: function transform(a, b, c, d, e, f) {
  19666. var transformMatrix = [a, b, c, d, e, f];
  19667. this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
  19668. this.tgrp = null;
  19669. }
  19670. }, {
  19671. key: "getSVG",
  19672. value: function getSVG(operatorList, viewport) {
  19673. var _this2 = this;
  19674. this.viewport = viewport;
  19675. var svgElement = this._initialize(viewport);
  19676. return this.loadDependencies(operatorList).then(function () {
  19677. _this2.transformMatrix = _util.IDENTITY_MATRIX;
  19678. _this2.executeOpTree(_this2.convertOpList(operatorList));
  19679. return svgElement;
  19680. });
  19681. }
  19682. }, {
  19683. key: "convertOpList",
  19684. value: function convertOpList(operatorList) {
  19685. var operatorIdMapping = this._operatorIdMapping;
  19686. var argsArray = operatorList.argsArray;
  19687. var fnArray = operatorList.fnArray;
  19688. var opList = [];
  19689. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  19690. var fnId = fnArray[i];
  19691. opList.push({
  19692. fnId: fnId,
  19693. fn: operatorIdMapping[fnId],
  19694. args: argsArray[i]
  19695. });
  19696. }
  19697. return opListToTree(opList);
  19698. }
  19699. }, {
  19700. key: "executeOpTree",
  19701. value: function executeOpTree(opTree) {
  19702. var _iterator3 = _createForOfIteratorHelper(opTree),
  19703. _step3;
  19704. try {
  19705. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  19706. var opTreeElement = _step3.value;
  19707. var fn = opTreeElement.fn;
  19708. var fnId = opTreeElement.fnId;
  19709. var args = opTreeElement.args;
  19710. switch (fnId | 0) {
  19711. case _util.OPS.beginText:
  19712. this.beginText();
  19713. break;
  19714. case _util.OPS.dependency:
  19715. break;
  19716. case _util.OPS.setLeading:
  19717. this.setLeading(args);
  19718. break;
  19719. case _util.OPS.setLeadingMoveText:
  19720. this.setLeadingMoveText(args[0], args[1]);
  19721. break;
  19722. case _util.OPS.setFont:
  19723. this.setFont(args);
  19724. break;
  19725. case _util.OPS.showText:
  19726. this.showText(args[0]);
  19727. break;
  19728. case _util.OPS.showSpacedText:
  19729. this.showText(args[0]);
  19730. break;
  19731. case _util.OPS.endText:
  19732. this.endText();
  19733. break;
  19734. case _util.OPS.moveText:
  19735. this.moveText(args[0], args[1]);
  19736. break;
  19737. case _util.OPS.setCharSpacing:
  19738. this.setCharSpacing(args[0]);
  19739. break;
  19740. case _util.OPS.setWordSpacing:
  19741. this.setWordSpacing(args[0]);
  19742. break;
  19743. case _util.OPS.setHScale:
  19744. this.setHScale(args[0]);
  19745. break;
  19746. case _util.OPS.setTextMatrix:
  19747. this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  19748. break;
  19749. case _util.OPS.setTextRise:
  19750. this.setTextRise(args[0]);
  19751. break;
  19752. case _util.OPS.setTextRenderingMode:
  19753. this.setTextRenderingMode(args[0]);
  19754. break;
  19755. case _util.OPS.setLineWidth:
  19756. this.setLineWidth(args[0]);
  19757. break;
  19758. case _util.OPS.setLineJoin:
  19759. this.setLineJoin(args[0]);
  19760. break;
  19761. case _util.OPS.setLineCap:
  19762. this.setLineCap(args[0]);
  19763. break;
  19764. case _util.OPS.setMiterLimit:
  19765. this.setMiterLimit(args[0]);
  19766. break;
  19767. case _util.OPS.setFillRGBColor:
  19768. this.setFillRGBColor(args[0], args[1], args[2]);
  19769. break;
  19770. case _util.OPS.setStrokeRGBColor:
  19771. this.setStrokeRGBColor(args[0], args[1], args[2]);
  19772. break;
  19773. case _util.OPS.setStrokeColorN:
  19774. this.setStrokeColorN(args);
  19775. break;
  19776. case _util.OPS.setFillColorN:
  19777. this.setFillColorN(args);
  19778. break;
  19779. case _util.OPS.shadingFill:
  19780. this.shadingFill(args[0]);
  19781. break;
  19782. case _util.OPS.setDash:
  19783. this.setDash(args[0], args[1]);
  19784. break;
  19785. case _util.OPS.setRenderingIntent:
  19786. this.setRenderingIntent(args[0]);
  19787. break;
  19788. case _util.OPS.setFlatness:
  19789. this.setFlatness(args[0]);
  19790. break;
  19791. case _util.OPS.setGState:
  19792. this.setGState(args[0]);
  19793. break;
  19794. case _util.OPS.fill:
  19795. this.fill();
  19796. break;
  19797. case _util.OPS.eoFill:
  19798. this.eoFill();
  19799. break;
  19800. case _util.OPS.stroke:
  19801. this.stroke();
  19802. break;
  19803. case _util.OPS.fillStroke:
  19804. this.fillStroke();
  19805. break;
  19806. case _util.OPS.eoFillStroke:
  19807. this.eoFillStroke();
  19808. break;
  19809. case _util.OPS.clip:
  19810. this.clip("nonzero");
  19811. break;
  19812. case _util.OPS.eoClip:
  19813. this.clip("evenodd");
  19814. break;
  19815. case _util.OPS.paintSolidColorImageMask:
  19816. this.paintSolidColorImageMask();
  19817. break;
  19818. case _util.OPS.paintImageXObject:
  19819. this.paintImageXObject(args[0]);
  19820. break;
  19821. case _util.OPS.paintInlineImageXObject:
  19822. this.paintInlineImageXObject(args[0]);
  19823. break;
  19824. case _util.OPS.paintImageMaskXObject:
  19825. this.paintImageMaskXObject(args[0]);
  19826. break;
  19827. case _util.OPS.paintFormXObjectBegin:
  19828. this.paintFormXObjectBegin(args[0], args[1]);
  19829. break;
  19830. case _util.OPS.paintFormXObjectEnd:
  19831. this.paintFormXObjectEnd();
  19832. break;
  19833. case _util.OPS.closePath:
  19834. this.closePath();
  19835. break;
  19836. case _util.OPS.closeStroke:
  19837. this.closeStroke();
  19838. break;
  19839. case _util.OPS.closeFillStroke:
  19840. this.closeFillStroke();
  19841. break;
  19842. case _util.OPS.closeEOFillStroke:
  19843. this.closeEOFillStroke();
  19844. break;
  19845. case _util.OPS.nextLine:
  19846. this.nextLine();
  19847. break;
  19848. case _util.OPS.transform:
  19849. this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
  19850. break;
  19851. case _util.OPS.constructPath:
  19852. this.constructPath(args[0], args[1]);
  19853. break;
  19854. case _util.OPS.endPath:
  19855. this.endPath();
  19856. break;
  19857. case 92:
  19858. this.group(opTreeElement.items);
  19859. break;
  19860. default:
  19861. (0, _util.warn)("Unimplemented operator ".concat(fn));
  19862. break;
  19863. }
  19864. }
  19865. } catch (err) {
  19866. _iterator3.e(err);
  19867. } finally {
  19868. _iterator3.f();
  19869. }
  19870. }
  19871. }, {
  19872. key: "setWordSpacing",
  19873. value: function setWordSpacing(wordSpacing) {
  19874. this.current.wordSpacing = wordSpacing;
  19875. }
  19876. }, {
  19877. key: "setCharSpacing",
  19878. value: function setCharSpacing(charSpacing) {
  19879. this.current.charSpacing = charSpacing;
  19880. }
  19881. }, {
  19882. key: "nextLine",
  19883. value: function nextLine() {
  19884. this.moveText(0, this.current.leading);
  19885. }
  19886. }, {
  19887. key: "setTextMatrix",
  19888. value: function setTextMatrix(a, b, c, d, e, f) {
  19889. var current = this.current;
  19890. current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];
  19891. current.textMatrixScale = Math.sqrt(a * a + b * b);
  19892. current.x = current.lineX = 0;
  19893. current.y = current.lineY = 0;
  19894. current.xcoords = [];
  19895. current.ycoords = [];
  19896. current.tspan = this.svgFactory.createElement("svg:tspan");
  19897. current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
  19898. current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px"));
  19899. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  19900. current.txtElement = this.svgFactory.createElement("svg:text");
  19901. current.txtElement.appendChild(current.tspan);
  19902. }
  19903. }, {
  19904. key: "beginText",
  19905. value: function beginText() {
  19906. var current = this.current;
  19907. current.x = current.lineX = 0;
  19908. current.y = current.lineY = 0;
  19909. current.textMatrix = _util.IDENTITY_MATRIX;
  19910. current.lineMatrix = _util.IDENTITY_MATRIX;
  19911. current.textMatrixScale = 1;
  19912. current.tspan = this.svgFactory.createElement("svg:tspan");
  19913. current.txtElement = this.svgFactory.createElement("svg:text");
  19914. current.txtgrp = this.svgFactory.createElement("svg:g");
  19915. current.xcoords = [];
  19916. current.ycoords = [];
  19917. }
  19918. }, {
  19919. key: "moveText",
  19920. value: function moveText(x, y) {
  19921. var current = this.current;
  19922. current.x = current.lineX += x;
  19923. current.y = current.lineY += y;
  19924. current.xcoords = [];
  19925. current.ycoords = [];
  19926. current.tspan = this.svgFactory.createElement("svg:tspan");
  19927. current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
  19928. current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px"));
  19929. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  19930. }
  19931. }, {
  19932. key: "showText",
  19933. value: function showText(glyphs) {
  19934. var current = this.current;
  19935. var font = current.font;
  19936. var fontSize = current.fontSize;
  19937. if (fontSize === 0) {
  19938. return;
  19939. }
  19940. var fontSizeScale = current.fontSizeScale;
  19941. var charSpacing = current.charSpacing;
  19942. var wordSpacing = current.wordSpacing;
  19943. var fontDirection = current.fontDirection;
  19944. var textHScale = current.textHScale * fontDirection;
  19945. var vertical = font.vertical;
  19946. var spacingDir = vertical ? 1 : -1;
  19947. var defaultVMetrics = font.defaultVMetrics;
  19948. var widthAdvanceScale = fontSize * current.fontMatrix[0];
  19949. var x = 0;
  19950. var _iterator4 = _createForOfIteratorHelper(glyphs),
  19951. _step4;
  19952. try {
  19953. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  19954. var glyph = _step4.value;
  19955. if (glyph === null) {
  19956. x += fontDirection * wordSpacing;
  19957. continue;
  19958. } else if ((0, _util.isNum)(glyph)) {
  19959. x += spacingDir * glyph * fontSize / 1000;
  19960. continue;
  19961. }
  19962. var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
  19963. var character = glyph.fontChar;
  19964. var scaledX = void 0,
  19965. scaledY = void 0;
  19966. var width = glyph.width;
  19967. if (vertical) {
  19968. var vx = void 0;
  19969. var vmetric = glyph.vmetric || defaultVMetrics;
  19970. vx = glyph.vmetric ? vmetric[1] : width * 0.5;
  19971. vx = -vx * widthAdvanceScale;
  19972. var vy = vmetric[2] * widthAdvanceScale;
  19973. width = vmetric ? -vmetric[0] : width;
  19974. scaledX = vx / fontSizeScale;
  19975. scaledY = (x + vy) / fontSizeScale;
  19976. } else {
  19977. scaledX = x / fontSizeScale;
  19978. scaledY = 0;
  19979. }
  19980. if (glyph.isInFont || font.missingFile) {
  19981. current.xcoords.push(current.x + scaledX);
  19982. if (vertical) {
  19983. current.ycoords.push(-current.y + scaledY);
  19984. }
  19985. current.tspan.textContent += character;
  19986. } else {}
  19987. var charWidth = void 0;
  19988. if (vertical) {
  19989. charWidth = width * widthAdvanceScale - spacing * fontDirection;
  19990. } else {
  19991. charWidth = width * widthAdvanceScale + spacing * fontDirection;
  19992. }
  19993. x += charWidth;
  19994. }
  19995. } catch (err) {
  19996. _iterator4.e(err);
  19997. } finally {
  19998. _iterator4.f();
  19999. }
  20000. current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
  20001. if (vertical) {
  20002. current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
  20003. } else {
  20004. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  20005. }
  20006. if (vertical) {
  20007. current.y -= x;
  20008. } else {
  20009. current.x += x * textHScale;
  20010. }
  20011. current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
  20012. current.tspan.setAttributeNS(null, "font-size", "".concat(pf(current.fontSize), "px"));
  20013. if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {
  20014. current.tspan.setAttributeNS(null, "font-style", current.fontStyle);
  20015. }
  20016. if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {
  20017. current.tspan.setAttributeNS(null, "font-weight", current.fontWeight);
  20018. }
  20019. var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
  20020. if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  20021. if (current.fillColor !== SVG_DEFAULTS.fillColor) {
  20022. current.tspan.setAttributeNS(null, "fill", current.fillColor);
  20023. }
  20024. if (current.fillAlpha < 1) {
  20025. current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha);
  20026. }
  20027. } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {
  20028. current.tspan.setAttributeNS(null, "fill", "transparent");
  20029. } else {
  20030. current.tspan.setAttributeNS(null, "fill", "none");
  20031. }
  20032. if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
  20033. var lineWidthScale = 1 / (current.textMatrixScale || 1);
  20034. this._setStrokeAttributes(current.tspan, lineWidthScale);
  20035. }
  20036. var textMatrix = current.textMatrix;
  20037. if (current.textRise !== 0) {
  20038. textMatrix = textMatrix.slice();
  20039. textMatrix[5] += current.textRise;
  20040. }
  20041. current.txtElement.setAttributeNS(null, "transform", "".concat(pm(textMatrix), " scale(").concat(pf(textHScale), ", -1)"));
  20042. current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve");
  20043. current.txtElement.appendChild(current.tspan);
  20044. current.txtgrp.appendChild(current.txtElement);
  20045. this._ensureTransformGroup().appendChild(current.txtElement);
  20046. }
  20047. }, {
  20048. key: "setLeadingMoveText",
  20049. value: function setLeadingMoveText(x, y) {
  20050. this.setLeading(-y);
  20051. this.moveText(x, y);
  20052. }
  20053. }, {
  20054. key: "addFontStyle",
  20055. value: function addFontStyle(fontObj) {
  20056. if (!fontObj.data) {
  20057. throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
  20058. }
  20059. if (!this.cssStyle) {
  20060. this.cssStyle = this.svgFactory.createElement("svg:style");
  20061. this.cssStyle.setAttributeNS(null, "type", "text/css");
  20062. this.defs.appendChild(this.cssStyle);
  20063. }
  20064. var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema);
  20065. this.cssStyle.textContent += "@font-face { font-family: \"".concat(fontObj.loadedName, "\";") + " src: url(".concat(url, "); }\n");
  20066. }
  20067. }, {
  20068. key: "setFont",
  20069. value: function setFont(details) {
  20070. var current = this.current;
  20071. var fontObj = this.commonObjs.get(details[0]);
  20072. var size = details[1];
  20073. current.font = fontObj;
  20074. if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
  20075. this.addFontStyle(fontObj);
  20076. this.embeddedFonts[fontObj.loadedName] = fontObj;
  20077. }
  20078. current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX;
  20079. var bold = "normal";
  20080. if (fontObj.black) {
  20081. bold = "900";
  20082. } else if (fontObj.bold) {
  20083. bold = "bold";
  20084. }
  20085. var italic = fontObj.italic ? "italic" : "normal";
  20086. if (size < 0) {
  20087. size = -size;
  20088. current.fontDirection = -1;
  20089. } else {
  20090. current.fontDirection = 1;
  20091. }
  20092. current.fontSize = size;
  20093. current.fontFamily = fontObj.loadedName;
  20094. current.fontWeight = bold;
  20095. current.fontStyle = italic;
  20096. current.tspan = this.svgFactory.createElement("svg:tspan");
  20097. current.tspan.setAttributeNS(null, "y", pf(-current.y));
  20098. current.xcoords = [];
  20099. current.ycoords = [];
  20100. }
  20101. }, {
  20102. key: "endText",
  20103. value: function endText() {
  20104. var current = this.current;
  20105. if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) {
  20106. current.element = current.txtElement;
  20107. this.clip("nonzero");
  20108. this.endPath();
  20109. }
  20110. }
  20111. }, {
  20112. key: "setLineWidth",
  20113. value: function setLineWidth(width) {
  20114. if (width > 0) {
  20115. this.current.lineWidth = width;
  20116. }
  20117. }
  20118. }, {
  20119. key: "setLineCap",
  20120. value: function setLineCap(style) {
  20121. this.current.lineCap = LINE_CAP_STYLES[style];
  20122. }
  20123. }, {
  20124. key: "setLineJoin",
  20125. value: function setLineJoin(style) {
  20126. this.current.lineJoin = LINE_JOIN_STYLES[style];
  20127. }
  20128. }, {
  20129. key: "setMiterLimit",
  20130. value: function setMiterLimit(limit) {
  20131. this.current.miterLimit = limit;
  20132. }
  20133. }, {
  20134. key: "setStrokeAlpha",
  20135. value: function setStrokeAlpha(strokeAlpha) {
  20136. this.current.strokeAlpha = strokeAlpha;
  20137. }
  20138. }, {
  20139. key: "setStrokeRGBColor",
  20140. value: function setStrokeRGBColor(r, g, b) {
  20141. this.current.strokeColor = _util.Util.makeCssRgb(r, g, b);
  20142. }
  20143. }, {
  20144. key: "setFillAlpha",
  20145. value: function setFillAlpha(fillAlpha) {
  20146. this.current.fillAlpha = fillAlpha;
  20147. }
  20148. }, {
  20149. key: "setFillRGBColor",
  20150. value: function setFillRGBColor(r, g, b) {
  20151. this.current.fillColor = _util.Util.makeCssRgb(r, g, b);
  20152. this.current.tspan = this.svgFactory.createElement("svg:tspan");
  20153. this.current.xcoords = [];
  20154. this.current.ycoords = [];
  20155. }
  20156. }, {
  20157. key: "setStrokeColorN",
  20158. value: function setStrokeColorN(args) {
  20159. this.current.strokeColor = this._makeColorN_Pattern(args);
  20160. }
  20161. }, {
  20162. key: "setFillColorN",
  20163. value: function setFillColorN(args) {
  20164. this.current.fillColor = this._makeColorN_Pattern(args);
  20165. }
  20166. }, {
  20167. key: "shadingFill",
  20168. value: function shadingFill(args) {
  20169. var width = this.viewport.width;
  20170. var height = this.viewport.height;
  20171. var inv = _util.Util.inverseTransform(this.transformMatrix);
  20172. var bl = _util.Util.applyTransform([0, 0], inv);
  20173. var br = _util.Util.applyTransform([0, height], inv);
  20174. var ul = _util.Util.applyTransform([width, 0], inv);
  20175. var ur = _util.Util.applyTransform([width, height], inv);
  20176. var x0 = Math.min(bl[0], br[0], ul[0], ur[0]);
  20177. var y0 = Math.min(bl[1], br[1], ul[1], ur[1]);
  20178. var x1 = Math.max(bl[0], br[0], ul[0], ur[0]);
  20179. var y1 = Math.max(bl[1], br[1], ul[1], ur[1]);
  20180. var rect = this.svgFactory.createElement("svg:rect");
  20181. rect.setAttributeNS(null, "x", x0);
  20182. rect.setAttributeNS(null, "y", y0);
  20183. rect.setAttributeNS(null, "width", x1 - x0);
  20184. rect.setAttributeNS(null, "height", y1 - y0);
  20185. rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
  20186. if (this.current.fillAlpha < 1) {
  20187. rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
  20188. }
  20189. this._ensureTransformGroup().appendChild(rect);
  20190. }
  20191. }, {
  20192. key: "_makeColorN_Pattern",
  20193. value: function _makeColorN_Pattern(args) {
  20194. if (args[0] === "TilingPattern") {
  20195. return this._makeTilingPattern(args);
  20196. }
  20197. return this._makeShadingPattern(args);
  20198. }
  20199. }, {
  20200. key: "_makeTilingPattern",
  20201. value: function _makeTilingPattern(args) {
  20202. var color = args[1];
  20203. var operatorList = args[2];
  20204. var matrix = args[3] || _util.IDENTITY_MATRIX;
  20205. var _args$ = _slicedToArray(args[4], 4),
  20206. x0 = _args$[0],
  20207. y0 = _args$[1],
  20208. x1 = _args$[2],
  20209. y1 = _args$[3];
  20210. var xstep = args[5];
  20211. var ystep = args[6];
  20212. var paintType = args[7];
  20213. var tilingId = "shading".concat(shadingCount++);
  20214. var _Util$applyTransform = _util.Util.applyTransform([x0, y0], matrix),
  20215. _Util$applyTransform2 = _slicedToArray(_Util$applyTransform, 2),
  20216. tx0 = _Util$applyTransform2[0],
  20217. ty0 = _Util$applyTransform2[1];
  20218. var _Util$applyTransform3 = _util.Util.applyTransform([x1, y1], matrix),
  20219. _Util$applyTransform4 = _slicedToArray(_Util$applyTransform3, 2),
  20220. tx1 = _Util$applyTransform4[0],
  20221. ty1 = _Util$applyTransform4[1];
  20222. var _Util$singularValueDe = _util.Util.singularValueDecompose2dScale(matrix),
  20223. _Util$singularValueDe2 = _slicedToArray(_Util$singularValueDe, 2),
  20224. xscale = _Util$singularValueDe2[0],
  20225. yscale = _Util$singularValueDe2[1];
  20226. var txstep = xstep * xscale;
  20227. var tystep = ystep * yscale;
  20228. var tiling = this.svgFactory.createElement("svg:pattern");
  20229. tiling.setAttributeNS(null, "id", tilingId);
  20230. tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
  20231. tiling.setAttributeNS(null, "width", txstep);
  20232. tiling.setAttributeNS(null, "height", tystep);
  20233. tiling.setAttributeNS(null, "x", "".concat(tx0));
  20234. tiling.setAttributeNS(null, "y", "".concat(ty0));
  20235. var svg = this.svg;
  20236. var transformMatrix = this.transformMatrix;
  20237. var fillColor = this.current.fillColor;
  20238. var strokeColor = this.current.strokeColor;
  20239. var bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);
  20240. this.svg = bbox;
  20241. this.transformMatrix = matrix;
  20242. if (paintType === 2) {
  20243. var cssColor = _util.Util.makeCssRgb.apply(_util.Util, _toConsumableArray(color));
  20244. this.current.fillColor = cssColor;
  20245. this.current.strokeColor = cssColor;
  20246. }
  20247. this.executeOpTree(this.convertOpList(operatorList));
  20248. this.svg = svg;
  20249. this.transformMatrix = transformMatrix;
  20250. this.current.fillColor = fillColor;
  20251. this.current.strokeColor = strokeColor;
  20252. tiling.appendChild(bbox.childNodes[0]);
  20253. this.defs.appendChild(tiling);
  20254. return "url(#".concat(tilingId, ")");
  20255. }
  20256. }, {
  20257. key: "_makeShadingPattern",
  20258. value: function _makeShadingPattern(args) {
  20259. switch (args[0]) {
  20260. case "RadialAxial":
  20261. var shadingId = "shading".concat(shadingCount++);
  20262. var colorStops = args[3];
  20263. var gradient;
  20264. switch (args[1]) {
  20265. case "axial":
  20266. var point0 = args[4];
  20267. var point1 = args[5];
  20268. gradient = this.svgFactory.createElement("svg:linearGradient");
  20269. gradient.setAttributeNS(null, "id", shadingId);
  20270. gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
  20271. gradient.setAttributeNS(null, "x1", point0[0]);
  20272. gradient.setAttributeNS(null, "y1", point0[1]);
  20273. gradient.setAttributeNS(null, "x2", point1[0]);
  20274. gradient.setAttributeNS(null, "y2", point1[1]);
  20275. break;
  20276. case "radial":
  20277. var focalPoint = args[4];
  20278. var circlePoint = args[5];
  20279. var focalRadius = args[6];
  20280. var circleRadius = args[7];
  20281. gradient = this.svgFactory.createElement("svg:radialGradient");
  20282. gradient.setAttributeNS(null, "id", shadingId);
  20283. gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
  20284. gradient.setAttributeNS(null, "cx", circlePoint[0]);
  20285. gradient.setAttributeNS(null, "cy", circlePoint[1]);
  20286. gradient.setAttributeNS(null, "r", circleRadius);
  20287. gradient.setAttributeNS(null, "fx", focalPoint[0]);
  20288. gradient.setAttributeNS(null, "fy", focalPoint[1]);
  20289. gradient.setAttributeNS(null, "fr", focalRadius);
  20290. break;
  20291. default:
  20292. throw new Error("Unknown RadialAxial type: ".concat(args[1]));
  20293. }
  20294. var _iterator5 = _createForOfIteratorHelper(colorStops),
  20295. _step5;
  20296. try {
  20297. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  20298. var colorStop = _step5.value;
  20299. var stop = this.svgFactory.createElement("svg:stop");
  20300. stop.setAttributeNS(null, "offset", colorStop[0]);
  20301. stop.setAttributeNS(null, "stop-color", colorStop[1]);
  20302. gradient.appendChild(stop);
  20303. }
  20304. } catch (err) {
  20305. _iterator5.e(err);
  20306. } finally {
  20307. _iterator5.f();
  20308. }
  20309. this.defs.appendChild(gradient);
  20310. return "url(#".concat(shadingId, ")");
  20311. case "Mesh":
  20312. (0, _util.warn)("Unimplemented pattern Mesh");
  20313. return null;
  20314. case "Dummy":
  20315. return "hotpink";
  20316. default:
  20317. throw new Error("Unknown IR type: ".concat(args[0]));
  20318. }
  20319. }
  20320. }, {
  20321. key: "setDash",
  20322. value: function setDash(dashArray, dashPhase) {
  20323. this.current.dashArray = dashArray;
  20324. this.current.dashPhase = dashPhase;
  20325. }
  20326. }, {
  20327. key: "constructPath",
  20328. value: function constructPath(ops, args) {
  20329. var current = this.current;
  20330. var x = current.x,
  20331. y = current.y;
  20332. var d = [];
  20333. var j = 0;
  20334. var _iterator6 = _createForOfIteratorHelper(ops),
  20335. _step6;
  20336. try {
  20337. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  20338. var op = _step6.value;
  20339. switch (op | 0) {
  20340. case _util.OPS.rectangle:
  20341. x = args[j++];
  20342. y = args[j++];
  20343. var width = args[j++];
  20344. var height = args[j++];
  20345. var xw = x + width;
  20346. var yh = y + height;
  20347. d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z");
  20348. break;
  20349. case _util.OPS.moveTo:
  20350. x = args[j++];
  20351. y = args[j++];
  20352. d.push("M", pf(x), pf(y));
  20353. break;
  20354. case _util.OPS.lineTo:
  20355. x = args[j++];
  20356. y = args[j++];
  20357. d.push("L", pf(x), pf(y));
  20358. break;
  20359. case _util.OPS.curveTo:
  20360. x = args[j + 4];
  20361. y = args[j + 5];
  20362. d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y));
  20363. j += 6;
  20364. break;
  20365. case _util.OPS.curveTo2:
  20366. d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]));
  20367. x = args[j + 2];
  20368. y = args[j + 3];
  20369. j += 4;
  20370. break;
  20371. case _util.OPS.curveTo3:
  20372. x = args[j + 2];
  20373. y = args[j + 3];
  20374. d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y));
  20375. j += 4;
  20376. break;
  20377. case _util.OPS.closePath:
  20378. d.push("Z");
  20379. break;
  20380. }
  20381. }
  20382. } catch (err) {
  20383. _iterator6.e(err);
  20384. } finally {
  20385. _iterator6.f();
  20386. }
  20387. d = d.join(" ");
  20388. if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) {
  20389. d = current.path.getAttributeNS(null, "d") + d;
  20390. } else {
  20391. current.path = this.svgFactory.createElement("svg:path");
  20392. this._ensureTransformGroup().appendChild(current.path);
  20393. }
  20394. current.path.setAttributeNS(null, "d", d);
  20395. current.path.setAttributeNS(null, "fill", "none");
  20396. current.element = current.path;
  20397. current.setCurrentPoint(x, y);
  20398. }
  20399. }, {
  20400. key: "endPath",
  20401. value: function endPath() {
  20402. var current = this.current;
  20403. current.path = null;
  20404. if (!this.pendingClip) {
  20405. return;
  20406. }
  20407. if (!current.element) {
  20408. this.pendingClip = null;
  20409. return;
  20410. }
  20411. var clipId = "clippath".concat(clipCount++);
  20412. var clipPath = this.svgFactory.createElement("svg:clipPath");
  20413. clipPath.setAttributeNS(null, "id", clipId);
  20414. clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix));
  20415. var clipElement = current.element.cloneNode(true);
  20416. if (this.pendingClip === "evenodd") {
  20417. clipElement.setAttributeNS(null, "clip-rule", "evenodd");
  20418. } else {
  20419. clipElement.setAttributeNS(null, "clip-rule", "nonzero");
  20420. }
  20421. this.pendingClip = null;
  20422. clipPath.appendChild(clipElement);
  20423. this.defs.appendChild(clipPath);
  20424. if (current.activeClipUrl) {
  20425. current.clipGroup = null;
  20426. this.extraStack.forEach(function (prev) {
  20427. prev.clipGroup = null;
  20428. });
  20429. clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl);
  20430. }
  20431. current.activeClipUrl = "url(#".concat(clipId, ")");
  20432. this.tgrp = null;
  20433. }
  20434. }, {
  20435. key: "clip",
  20436. value: function clip(type) {
  20437. this.pendingClip = type;
  20438. }
  20439. }, {
  20440. key: "closePath",
  20441. value: function closePath() {
  20442. var current = this.current;
  20443. if (current.path) {
  20444. var d = "".concat(current.path.getAttributeNS(null, "d"), "Z");
  20445. current.path.setAttributeNS(null, "d", d);
  20446. }
  20447. }
  20448. }, {
  20449. key: "setLeading",
  20450. value: function setLeading(leading) {
  20451. this.current.leading = -leading;
  20452. }
  20453. }, {
  20454. key: "setTextRise",
  20455. value: function setTextRise(textRise) {
  20456. this.current.textRise = textRise;
  20457. }
  20458. }, {
  20459. key: "setTextRenderingMode",
  20460. value: function setTextRenderingMode(textRenderingMode) {
  20461. this.current.textRenderingMode = textRenderingMode;
  20462. }
  20463. }, {
  20464. key: "setHScale",
  20465. value: function setHScale(scale) {
  20466. this.current.textHScale = scale / 100;
  20467. }
  20468. }, {
  20469. key: "setRenderingIntent",
  20470. value: function setRenderingIntent(intent) {}
  20471. }, {
  20472. key: "setFlatness",
  20473. value: function setFlatness(flatness) {}
  20474. }, {
  20475. key: "setGState",
  20476. value: function setGState(states) {
  20477. var _iterator7 = _createForOfIteratorHelper(states),
  20478. _step7;
  20479. try {
  20480. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  20481. var _step7$value = _slicedToArray(_step7.value, 2),
  20482. key = _step7$value[0],
  20483. value = _step7$value[1];
  20484. switch (key) {
  20485. case "LW":
  20486. this.setLineWidth(value);
  20487. break;
  20488. case "LC":
  20489. this.setLineCap(value);
  20490. break;
  20491. case "LJ":
  20492. this.setLineJoin(value);
  20493. break;
  20494. case "ML":
  20495. this.setMiterLimit(value);
  20496. break;
  20497. case "D":
  20498. this.setDash(value[0], value[1]);
  20499. break;
  20500. case "RI":
  20501. this.setRenderingIntent(value);
  20502. break;
  20503. case "FL":
  20504. this.setFlatness(value);
  20505. break;
  20506. case "Font":
  20507. this.setFont(value);
  20508. break;
  20509. case "CA":
  20510. this.setStrokeAlpha(value);
  20511. break;
  20512. case "ca":
  20513. this.setFillAlpha(value);
  20514. break;
  20515. default:
  20516. (0, _util.warn)("Unimplemented graphic state operator ".concat(key));
  20517. break;
  20518. }
  20519. }
  20520. } catch (err) {
  20521. _iterator7.e(err);
  20522. } finally {
  20523. _iterator7.f();
  20524. }
  20525. }
  20526. }, {
  20527. key: "fill",
  20528. value: function fill() {
  20529. var current = this.current;
  20530. if (current.element) {
  20531. current.element.setAttributeNS(null, "fill", current.fillColor);
  20532. current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha);
  20533. this.endPath();
  20534. }
  20535. }
  20536. }, {
  20537. key: "stroke",
  20538. value: function stroke() {
  20539. var current = this.current;
  20540. if (current.element) {
  20541. this._setStrokeAttributes(current.element);
  20542. current.element.setAttributeNS(null, "fill", "none");
  20543. this.endPath();
  20544. }
  20545. }
  20546. }, {
  20547. key: "_setStrokeAttributes",
  20548. value: function _setStrokeAttributes(element) {
  20549. var lineWidthScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  20550. var current = this.current;
  20551. var dashArray = current.dashArray;
  20552. if (lineWidthScale !== 1 && dashArray.length > 0) {
  20553. dashArray = dashArray.map(function (value) {
  20554. return lineWidthScale * value;
  20555. });
  20556. }
  20557. element.setAttributeNS(null, "stroke", current.strokeColor);
  20558. element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha);
  20559. element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit));
  20560. element.setAttributeNS(null, "stroke-linecap", current.lineCap);
  20561. element.setAttributeNS(null, "stroke-linejoin", current.lineJoin);
  20562. element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px");
  20563. element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" "));
  20564. element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px");
  20565. }
  20566. }, {
  20567. key: "eoFill",
  20568. value: function eoFill() {
  20569. if (this.current.element) {
  20570. this.current.element.setAttributeNS(null, "fill-rule", "evenodd");
  20571. }
  20572. this.fill();
  20573. }
  20574. }, {
  20575. key: "fillStroke",
  20576. value: function fillStroke() {
  20577. this.stroke();
  20578. this.fill();
  20579. }
  20580. }, {
  20581. key: "eoFillStroke",
  20582. value: function eoFillStroke() {
  20583. if (this.current.element) {
  20584. this.current.element.setAttributeNS(null, "fill-rule", "evenodd");
  20585. }
  20586. this.fillStroke();
  20587. }
  20588. }, {
  20589. key: "closeStroke",
  20590. value: function closeStroke() {
  20591. this.closePath();
  20592. this.stroke();
  20593. }
  20594. }, {
  20595. key: "closeFillStroke",
  20596. value: function closeFillStroke() {
  20597. this.closePath();
  20598. this.fillStroke();
  20599. }
  20600. }, {
  20601. key: "closeEOFillStroke",
  20602. value: function closeEOFillStroke() {
  20603. this.closePath();
  20604. this.eoFillStroke();
  20605. }
  20606. }, {
  20607. key: "paintSolidColorImageMask",
  20608. value: function paintSolidColorImageMask() {
  20609. var rect = this.svgFactory.createElement("svg:rect");
  20610. rect.setAttributeNS(null, "x", "0");
  20611. rect.setAttributeNS(null, "y", "0");
  20612. rect.setAttributeNS(null, "width", "1px");
  20613. rect.setAttributeNS(null, "height", "1px");
  20614. rect.setAttributeNS(null, "fill", this.current.fillColor);
  20615. this._ensureTransformGroup().appendChild(rect);
  20616. }
  20617. }, {
  20618. key: "paintImageXObject",
  20619. value: function paintImageXObject(objId) {
  20620. var imgData = this.objs.get(objId);
  20621. if (!imgData) {
  20622. (0, _util.warn)("Dependent image with object ID ".concat(objId, " is not ready yet"));
  20623. return;
  20624. }
  20625. this.paintInlineImageXObject(imgData);
  20626. }
  20627. }, {
  20628. key: "paintInlineImageXObject",
  20629. value: function paintInlineImageXObject(imgData, mask) {
  20630. var width = imgData.width;
  20631. var height = imgData.height;
  20632. var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);
  20633. var cliprect = this.svgFactory.createElement("svg:rect");
  20634. cliprect.setAttributeNS(null, "x", "0");
  20635. cliprect.setAttributeNS(null, "y", "0");
  20636. cliprect.setAttributeNS(null, "width", pf(width));
  20637. cliprect.setAttributeNS(null, "height", pf(height));
  20638. this.current.element = cliprect;
  20639. this.clip("nonzero");
  20640. var imgEl = this.svgFactory.createElement("svg:image");
  20641. imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc);
  20642. imgEl.setAttributeNS(null, "x", "0");
  20643. imgEl.setAttributeNS(null, "y", pf(-height));
  20644. imgEl.setAttributeNS(null, "width", pf(width) + "px");
  20645. imgEl.setAttributeNS(null, "height", pf(height) + "px");
  20646. imgEl.setAttributeNS(null, "transform", "scale(".concat(pf(1 / width), " ").concat(pf(-1 / height), ")"));
  20647. if (mask) {
  20648. mask.appendChild(imgEl);
  20649. } else {
  20650. this._ensureTransformGroup().appendChild(imgEl);
  20651. }
  20652. }
  20653. }, {
  20654. key: "paintImageMaskXObject",
  20655. value: function paintImageMaskXObject(imgData) {
  20656. var current = this.current;
  20657. var width = imgData.width;
  20658. var height = imgData.height;
  20659. var fillColor = current.fillColor;
  20660. current.maskId = "mask".concat(maskCount++);
  20661. var mask = this.svgFactory.createElement("svg:mask");
  20662. mask.setAttributeNS(null, "id", current.maskId);
  20663. var rect = this.svgFactory.createElement("svg:rect");
  20664. rect.setAttributeNS(null, "x", "0");
  20665. rect.setAttributeNS(null, "y", "0");
  20666. rect.setAttributeNS(null, "width", pf(width));
  20667. rect.setAttributeNS(null, "height", pf(height));
  20668. rect.setAttributeNS(null, "fill", fillColor);
  20669. rect.setAttributeNS(null, "mask", "url(#".concat(current.maskId, ")"));
  20670. this.defs.appendChild(mask);
  20671. this._ensureTransformGroup().appendChild(rect);
  20672. this.paintInlineImageXObject(imgData, mask);
  20673. }
  20674. }, {
  20675. key: "paintFormXObjectBegin",
  20676. value: function paintFormXObjectBegin(matrix, bbox) {
  20677. if (Array.isArray(matrix) && matrix.length === 6) {
  20678. this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
  20679. }
  20680. if (bbox) {
  20681. var width = bbox[2] - bbox[0];
  20682. var height = bbox[3] - bbox[1];
  20683. var cliprect = this.svgFactory.createElement("svg:rect");
  20684. cliprect.setAttributeNS(null, "x", bbox[0]);
  20685. cliprect.setAttributeNS(null, "y", bbox[1]);
  20686. cliprect.setAttributeNS(null, "width", pf(width));
  20687. cliprect.setAttributeNS(null, "height", pf(height));
  20688. this.current.element = cliprect;
  20689. this.clip("nonzero");
  20690. this.endPath();
  20691. }
  20692. }
  20693. }, {
  20694. key: "paintFormXObjectEnd",
  20695. value: function paintFormXObjectEnd() {}
  20696. }, {
  20697. key: "_initialize",
  20698. value: function _initialize(viewport) {
  20699. var svg = this.svgFactory.create(viewport.width, viewport.height);
  20700. var definitions = this.svgFactory.createElement("svg:defs");
  20701. svg.appendChild(definitions);
  20702. this.defs = definitions;
  20703. var rootGroup = this.svgFactory.createElement("svg:g");
  20704. rootGroup.setAttributeNS(null, "transform", pm(viewport.transform));
  20705. svg.appendChild(rootGroup);
  20706. this.svg = rootGroup;
  20707. return svg;
  20708. }
  20709. }, {
  20710. key: "_ensureClipGroup",
  20711. value: function _ensureClipGroup() {
  20712. if (!this.current.clipGroup) {
  20713. var clipGroup = this.svgFactory.createElement("svg:g");
  20714. clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl);
  20715. this.svg.appendChild(clipGroup);
  20716. this.current.clipGroup = clipGroup;
  20717. }
  20718. return this.current.clipGroup;
  20719. }
  20720. }, {
  20721. key: "_ensureTransformGroup",
  20722. value: function _ensureTransformGroup() {
  20723. if (!this.tgrp) {
  20724. this.tgrp = this.svgFactory.createElement("svg:g");
  20725. this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix));
  20726. if (this.current.activeClipUrl) {
  20727. this._ensureClipGroup().appendChild(this.tgrp);
  20728. } else {
  20729. this.svg.appendChild(this.tgrp);
  20730. }
  20731. }
  20732. return this.tgrp;
  20733. }
  20734. }]);
  20735. return SVGGraphics;
  20736. }();
  20737. }
  20738. /***/ }),
  20739. /* 212 */
  20740. /***/ (function(module, exports, __w_pdfjs_require__) {
  20741. "use strict";
  20742. Object.defineProperty(exports, "__esModule", {
  20743. value: true
  20744. });
  20745. exports.PDFNodeStream = void 0;
  20746. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  20747. var _util = __w_pdfjs_require__(5);
  20748. var _network_utils = __w_pdfjs_require__(213);
  20749. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  20750. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  20751. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  20752. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  20753. 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); }; }
  20754. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  20755. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  20756. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  20757. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  20758. 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); } }
  20759. 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); }); }; }
  20760. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20761. 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); } }
  20762. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  20763. ;
  20764. var fs = require("fs");
  20765. var http = require("http");
  20766. var https = require("https");
  20767. var url = require("url");
  20768. var fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
  20769. function parseUrl(sourceUrl) {
  20770. var parsedUrl = url.parse(sourceUrl);
  20771. if (parsedUrl.protocol === "file:" || parsedUrl.host) {
  20772. return parsedUrl;
  20773. }
  20774. if (/^[a-z]:[/\\]/i.test(sourceUrl)) {
  20775. return url.parse("file:///".concat(sourceUrl));
  20776. }
  20777. if (!parsedUrl.host) {
  20778. parsedUrl.protocol = "file:";
  20779. }
  20780. return parsedUrl;
  20781. }
  20782. var PDFNodeStream = /*#__PURE__*/function () {
  20783. function PDFNodeStream(source) {
  20784. _classCallCheck(this, PDFNodeStream);
  20785. this.source = source;
  20786. this.url = parseUrl(source.url);
  20787. this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:";
  20788. this.isFsUrl = this.url.protocol === "file:";
  20789. this.httpHeaders = this.isHttp && source.httpHeaders || {};
  20790. this._fullRequestReader = null;
  20791. this._rangeRequestReaders = [];
  20792. }
  20793. _createClass(PDFNodeStream, [{
  20794. key: "getFullReader",
  20795. value: function getFullReader() {
  20796. (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
  20797. this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
  20798. return this._fullRequestReader;
  20799. }
  20800. }, {
  20801. key: "getRangeReader",
  20802. value: function getRangeReader(start, end) {
  20803. if (end <= this._progressiveDataLength) {
  20804. return null;
  20805. }
  20806. var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
  20807. this._rangeRequestReaders.push(rangeReader);
  20808. return rangeReader;
  20809. }
  20810. }, {
  20811. key: "cancelAllRequests",
  20812. value: function cancelAllRequests(reason) {
  20813. if (this._fullRequestReader) {
  20814. this._fullRequestReader.cancel(reason);
  20815. }
  20816. var readers = this._rangeRequestReaders.slice(0);
  20817. readers.forEach(function (reader) {
  20818. reader.cancel(reason);
  20819. });
  20820. }
  20821. }, {
  20822. key: "_progressiveDataLength",
  20823. get: function get() {
  20824. return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
  20825. }
  20826. }]);
  20827. return PDFNodeStream;
  20828. }();
  20829. exports.PDFNodeStream = PDFNodeStream;
  20830. var BaseFullReader = /*#__PURE__*/function () {
  20831. function BaseFullReader(stream) {
  20832. _classCallCheck(this, BaseFullReader);
  20833. this._url = stream.url;
  20834. this._done = false;
  20835. this._storedError = null;
  20836. this.onProgress = null;
  20837. var source = stream.source;
  20838. this._contentLength = source.length;
  20839. this._loaded = 0;
  20840. this._filename = null;
  20841. this._disableRange = source.disableRange || false;
  20842. this._rangeChunkSize = source.rangeChunkSize;
  20843. if (!this._rangeChunkSize && !this._disableRange) {
  20844. this._disableRange = true;
  20845. }
  20846. this._isStreamingSupported = !source.disableStream;
  20847. this._isRangeSupported = !source.disableRange;
  20848. this._readableStream = null;
  20849. this._readCapability = (0, _util.createPromiseCapability)();
  20850. this._headersCapability = (0, _util.createPromiseCapability)();
  20851. }
  20852. _createClass(BaseFullReader, [{
  20853. key: "read",
  20854. value: function () {
  20855. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  20856. var chunk, buffer;
  20857. return _regenerator["default"].wrap(function _callee$(_context) {
  20858. while (1) {
  20859. switch (_context.prev = _context.next) {
  20860. case 0:
  20861. _context.next = 2;
  20862. return this._readCapability.promise;
  20863. case 2:
  20864. if (!this._done) {
  20865. _context.next = 4;
  20866. break;
  20867. }
  20868. return _context.abrupt("return", {
  20869. value: undefined,
  20870. done: true
  20871. });
  20872. case 4:
  20873. if (!this._storedError) {
  20874. _context.next = 6;
  20875. break;
  20876. }
  20877. throw this._storedError;
  20878. case 6:
  20879. chunk = this._readableStream.read();
  20880. if (!(chunk === null)) {
  20881. _context.next = 10;
  20882. break;
  20883. }
  20884. this._readCapability = (0, _util.createPromiseCapability)();
  20885. return _context.abrupt("return", this.read());
  20886. case 10:
  20887. this._loaded += chunk.length;
  20888. if (this.onProgress) {
  20889. this.onProgress({
  20890. loaded: this._loaded,
  20891. total: this._contentLength
  20892. });
  20893. }
  20894. buffer = new Uint8Array(chunk).buffer;
  20895. return _context.abrupt("return", {
  20896. value: buffer,
  20897. done: false
  20898. });
  20899. case 14:
  20900. case "end":
  20901. return _context.stop();
  20902. }
  20903. }
  20904. }, _callee, this);
  20905. }));
  20906. function read() {
  20907. return _read.apply(this, arguments);
  20908. }
  20909. return read;
  20910. }()
  20911. }, {
  20912. key: "cancel",
  20913. value: function cancel(reason) {
  20914. if (!this._readableStream) {
  20915. this._error(reason);
  20916. return;
  20917. }
  20918. this._readableStream.destroy(reason);
  20919. }
  20920. }, {
  20921. key: "_error",
  20922. value: function _error(reason) {
  20923. this._storedError = reason;
  20924. this._readCapability.resolve();
  20925. }
  20926. }, {
  20927. key: "_setReadableStream",
  20928. value: function _setReadableStream(readableStream) {
  20929. var _this = this;
  20930. this._readableStream = readableStream;
  20931. readableStream.on("readable", function () {
  20932. _this._readCapability.resolve();
  20933. });
  20934. readableStream.on("end", function () {
  20935. readableStream.destroy();
  20936. _this._done = true;
  20937. _this._readCapability.resolve();
  20938. });
  20939. readableStream.on("error", function (reason) {
  20940. _this._error(reason);
  20941. });
  20942. if (!this._isStreamingSupported && this._isRangeSupported) {
  20943. this._error(new _util.AbortException("streaming is disabled"));
  20944. }
  20945. if (this._storedError) {
  20946. this._readableStream.destroy(this._storedError);
  20947. }
  20948. }
  20949. }, {
  20950. key: "headersReady",
  20951. get: function get() {
  20952. return this._headersCapability.promise;
  20953. }
  20954. }, {
  20955. key: "filename",
  20956. get: function get() {
  20957. return this._filename;
  20958. }
  20959. }, {
  20960. key: "contentLength",
  20961. get: function get() {
  20962. return this._contentLength;
  20963. }
  20964. }, {
  20965. key: "isRangeSupported",
  20966. get: function get() {
  20967. return this._isRangeSupported;
  20968. }
  20969. }, {
  20970. key: "isStreamingSupported",
  20971. get: function get() {
  20972. return this._isStreamingSupported;
  20973. }
  20974. }]);
  20975. return BaseFullReader;
  20976. }();
  20977. var BaseRangeReader = /*#__PURE__*/function () {
  20978. function BaseRangeReader(stream) {
  20979. _classCallCheck(this, BaseRangeReader);
  20980. this._url = stream.url;
  20981. this._done = false;
  20982. this._storedError = null;
  20983. this.onProgress = null;
  20984. this._loaded = 0;
  20985. this._readableStream = null;
  20986. this._readCapability = (0, _util.createPromiseCapability)();
  20987. var source = stream.source;
  20988. this._isStreamingSupported = !source.disableStream;
  20989. }
  20990. _createClass(BaseRangeReader, [{
  20991. key: "read",
  20992. value: function () {
  20993. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  20994. var chunk, buffer;
  20995. return _regenerator["default"].wrap(function _callee2$(_context2) {
  20996. while (1) {
  20997. switch (_context2.prev = _context2.next) {
  20998. case 0:
  20999. _context2.next = 2;
  21000. return this._readCapability.promise;
  21001. case 2:
  21002. if (!this._done) {
  21003. _context2.next = 4;
  21004. break;
  21005. }
  21006. return _context2.abrupt("return", {
  21007. value: undefined,
  21008. done: true
  21009. });
  21010. case 4:
  21011. if (!this._storedError) {
  21012. _context2.next = 6;
  21013. break;
  21014. }
  21015. throw this._storedError;
  21016. case 6:
  21017. chunk = this._readableStream.read();
  21018. if (!(chunk === null)) {
  21019. _context2.next = 10;
  21020. break;
  21021. }
  21022. this._readCapability = (0, _util.createPromiseCapability)();
  21023. return _context2.abrupt("return", this.read());
  21024. case 10:
  21025. this._loaded += chunk.length;
  21026. if (this.onProgress) {
  21027. this.onProgress({
  21028. loaded: this._loaded
  21029. });
  21030. }
  21031. buffer = new Uint8Array(chunk).buffer;
  21032. return _context2.abrupt("return", {
  21033. value: buffer,
  21034. done: false
  21035. });
  21036. case 14:
  21037. case "end":
  21038. return _context2.stop();
  21039. }
  21040. }
  21041. }, _callee2, this);
  21042. }));
  21043. function read() {
  21044. return _read2.apply(this, arguments);
  21045. }
  21046. return read;
  21047. }()
  21048. }, {
  21049. key: "cancel",
  21050. value: function cancel(reason) {
  21051. if (!this._readableStream) {
  21052. this._error(reason);
  21053. return;
  21054. }
  21055. this._readableStream.destroy(reason);
  21056. }
  21057. }, {
  21058. key: "_error",
  21059. value: function _error(reason) {
  21060. this._storedError = reason;
  21061. this._readCapability.resolve();
  21062. }
  21063. }, {
  21064. key: "_setReadableStream",
  21065. value: function _setReadableStream(readableStream) {
  21066. var _this2 = this;
  21067. this._readableStream = readableStream;
  21068. readableStream.on("readable", function () {
  21069. _this2._readCapability.resolve();
  21070. });
  21071. readableStream.on("end", function () {
  21072. readableStream.destroy();
  21073. _this2._done = true;
  21074. _this2._readCapability.resolve();
  21075. });
  21076. readableStream.on("error", function (reason) {
  21077. _this2._error(reason);
  21078. });
  21079. if (this._storedError) {
  21080. this._readableStream.destroy(this._storedError);
  21081. }
  21082. }
  21083. }, {
  21084. key: "isStreamingSupported",
  21085. get: function get() {
  21086. return this._isStreamingSupported;
  21087. }
  21088. }]);
  21089. return BaseRangeReader;
  21090. }();
  21091. function createRequestOptions(parsedUrl, headers) {
  21092. return {
  21093. protocol: parsedUrl.protocol,
  21094. auth: parsedUrl.auth,
  21095. host: parsedUrl.hostname,
  21096. port: parsedUrl.port,
  21097. path: parsedUrl.path,
  21098. method: "GET",
  21099. headers: headers
  21100. };
  21101. }
  21102. var PDFNodeStreamFullReader = /*#__PURE__*/function (_BaseFullReader) {
  21103. _inherits(PDFNodeStreamFullReader, _BaseFullReader);
  21104. var _super = _createSuper(PDFNodeStreamFullReader);
  21105. function PDFNodeStreamFullReader(stream) {
  21106. var _this3;
  21107. _classCallCheck(this, PDFNodeStreamFullReader);
  21108. _this3 = _super.call(this, stream);
  21109. var handleResponse = function handleResponse(response) {
  21110. if (response.statusCode === 404) {
  21111. var error = new _util.MissingPDFException("Missing PDF \"".concat(_this3._url, "\"."));
  21112. _this3._storedError = error;
  21113. _this3._headersCapability.reject(error);
  21114. return;
  21115. }
  21116. _this3._headersCapability.resolve();
  21117. _this3._setReadableStream(response);
  21118. var getResponseHeader = function getResponseHeader(name) {
  21119. return _this3._readableStream.headers[name.toLowerCase()];
  21120. };
  21121. var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
  21122. getResponseHeader: getResponseHeader,
  21123. isHttp: stream.isHttp,
  21124. rangeChunkSize: _this3._rangeChunkSize,
  21125. disableRange: _this3._disableRange
  21126. }),
  21127. allowRangeRequests = _validateRangeRequest.allowRangeRequests,
  21128. suggestedLength = _validateRangeRequest.suggestedLength;
  21129. _this3._isRangeSupported = allowRangeRequests;
  21130. _this3._contentLength = suggestedLength || _this3._contentLength;
  21131. _this3._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
  21132. };
  21133. _this3._request = null;
  21134. if (_this3._url.protocol === "http:") {
  21135. _this3._request = http.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse);
  21136. } else {
  21137. _this3._request = https.request(createRequestOptions(_this3._url, stream.httpHeaders), handleResponse);
  21138. }
  21139. _this3._request.on("error", function (reason) {
  21140. _this3._storedError = reason;
  21141. _this3._headersCapability.reject(reason);
  21142. });
  21143. _this3._request.end();
  21144. return _this3;
  21145. }
  21146. return PDFNodeStreamFullReader;
  21147. }(BaseFullReader);
  21148. var PDFNodeStreamRangeReader = /*#__PURE__*/function (_BaseRangeReader) {
  21149. _inherits(PDFNodeStreamRangeReader, _BaseRangeReader);
  21150. var _super2 = _createSuper(PDFNodeStreamRangeReader);
  21151. function PDFNodeStreamRangeReader(stream, start, end) {
  21152. var _this4;
  21153. _classCallCheck(this, PDFNodeStreamRangeReader);
  21154. _this4 = _super2.call(this, stream);
  21155. _this4._httpHeaders = {};
  21156. for (var property in stream.httpHeaders) {
  21157. var value = stream.httpHeaders[property];
  21158. if (typeof value === "undefined") {
  21159. continue;
  21160. }
  21161. _this4._httpHeaders[property] = value;
  21162. }
  21163. _this4._httpHeaders.Range = "bytes=".concat(start, "-").concat(end - 1);
  21164. var handleResponse = function handleResponse(response) {
  21165. if (response.statusCode === 404) {
  21166. var error = new _util.MissingPDFException("Missing PDF \"".concat(_this4._url, "\"."));
  21167. _this4._storedError = error;
  21168. return;
  21169. }
  21170. _this4._setReadableStream(response);
  21171. };
  21172. _this4._request = null;
  21173. if (_this4._url.protocol === "http:") {
  21174. _this4._request = http.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse);
  21175. } else {
  21176. _this4._request = https.request(createRequestOptions(_this4._url, _this4._httpHeaders), handleResponse);
  21177. }
  21178. _this4._request.on("error", function (reason) {
  21179. _this4._storedError = reason;
  21180. });
  21181. _this4._request.end();
  21182. return _this4;
  21183. }
  21184. return PDFNodeStreamRangeReader;
  21185. }(BaseRangeReader);
  21186. var PDFNodeStreamFsFullReader = /*#__PURE__*/function (_BaseFullReader2) {
  21187. _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2);
  21188. var _super3 = _createSuper(PDFNodeStreamFsFullReader);
  21189. function PDFNodeStreamFsFullReader(stream) {
  21190. var _this5;
  21191. _classCallCheck(this, PDFNodeStreamFsFullReader);
  21192. _this5 = _super3.call(this, stream);
  21193. var path = decodeURIComponent(_this5._url.path);
  21194. if (fileUriRegex.test(_this5._url.href)) {
  21195. path = path.replace(/^\//, "");
  21196. }
  21197. fs.lstat(path, function (error, stat) {
  21198. if (error) {
  21199. if (error.code === "ENOENT") {
  21200. error = new _util.MissingPDFException("Missing PDF \"".concat(path, "\"."));
  21201. }
  21202. _this5._storedError = error;
  21203. _this5._headersCapability.reject(error);
  21204. return;
  21205. }
  21206. _this5._contentLength = stat.size;
  21207. _this5._setReadableStream(fs.createReadStream(path));
  21208. _this5._headersCapability.resolve();
  21209. });
  21210. return _this5;
  21211. }
  21212. return PDFNodeStreamFsFullReader;
  21213. }(BaseFullReader);
  21214. var PDFNodeStreamFsRangeReader = /*#__PURE__*/function (_BaseRangeReader2) {
  21215. _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2);
  21216. var _super4 = _createSuper(PDFNodeStreamFsRangeReader);
  21217. function PDFNodeStreamFsRangeReader(stream, start, end) {
  21218. var _this6;
  21219. _classCallCheck(this, PDFNodeStreamFsRangeReader);
  21220. _this6 = _super4.call(this, stream);
  21221. var path = decodeURIComponent(_this6._url.path);
  21222. if (fileUriRegex.test(_this6._url.href)) {
  21223. path = path.replace(/^\//, "");
  21224. }
  21225. _this6._setReadableStream(fs.createReadStream(path, {
  21226. start: start,
  21227. end: end - 1
  21228. }));
  21229. return _this6;
  21230. }
  21231. return PDFNodeStreamFsRangeReader;
  21232. }(BaseRangeReader);
  21233. /***/ }),
  21234. /* 213 */
  21235. /***/ (function(module, exports, __w_pdfjs_require__) {
  21236. "use strict";
  21237. Object.defineProperty(exports, "__esModule", {
  21238. value: true
  21239. });
  21240. exports.createResponseStatusError = createResponseStatusError;
  21241. exports.extractFilenameFromHeader = extractFilenameFromHeader;
  21242. exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
  21243. exports.validateResponseStatus = validateResponseStatus;
  21244. var _util = __w_pdfjs_require__(5);
  21245. var _content_disposition = __w_pdfjs_require__(214);
  21246. function validateRangeRequestCapabilities(_ref) {
  21247. var getResponseHeader = _ref.getResponseHeader,
  21248. isHttp = _ref.isHttp,
  21249. rangeChunkSize = _ref.rangeChunkSize,
  21250. disableRange = _ref.disableRange;
  21251. (0, _util.assert)(rangeChunkSize > 0, "Range chunk size must be larger than zero");
  21252. var returnValues = {
  21253. allowRangeRequests: false,
  21254. suggestedLength: undefined
  21255. };
  21256. var length = parseInt(getResponseHeader("Content-Length"), 10);
  21257. if (!Number.isInteger(length)) {
  21258. return returnValues;
  21259. }
  21260. returnValues.suggestedLength = length;
  21261. if (length <= 2 * rangeChunkSize) {
  21262. return returnValues;
  21263. }
  21264. if (disableRange || !isHttp) {
  21265. return returnValues;
  21266. }
  21267. if (getResponseHeader("Accept-Ranges") !== "bytes") {
  21268. return returnValues;
  21269. }
  21270. var contentEncoding = getResponseHeader("Content-Encoding") || "identity";
  21271. if (contentEncoding !== "identity") {
  21272. return returnValues;
  21273. }
  21274. returnValues.allowRangeRequests = true;
  21275. return returnValues;
  21276. }
  21277. function extractFilenameFromHeader(getResponseHeader) {
  21278. var contentDisposition = getResponseHeader("Content-Disposition");
  21279. if (contentDisposition) {
  21280. var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
  21281. if (filename.includes("%")) {
  21282. try {
  21283. filename = decodeURIComponent(filename);
  21284. } catch (ex) {}
  21285. }
  21286. if (/\.pdf$/i.test(filename)) {
  21287. return filename;
  21288. }
  21289. }
  21290. return null;
  21291. }
  21292. function createResponseStatusError(status, url) {
  21293. if (status === 404 || status === 0 && url.startsWith("file:")) {
  21294. return new _util.MissingPDFException('Missing PDF "' + url + '".');
  21295. }
  21296. return new _util.UnexpectedResponseException("Unexpected server response (" + status + ') while retrieving PDF "' + url + '".', status);
  21297. }
  21298. function validateResponseStatus(status) {
  21299. return status === 200 || status === 206;
  21300. }
  21301. /***/ }),
  21302. /* 214 */
  21303. /***/ (function(module, exports, __w_pdfjs_require__) {
  21304. "use strict";
  21305. Object.defineProperty(exports, "__esModule", {
  21306. value: true
  21307. });
  21308. exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;
  21309. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  21310. 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."); }
  21311. 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); }
  21312. 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; }
  21313. function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_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; }
  21314. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  21315. function getFilenameFromContentDispositionHeader(contentDisposition) {
  21316. var needsEncodingFixup = true;
  21317. var tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition);
  21318. if (tmp) {
  21319. tmp = tmp[1];
  21320. var filename = rfc2616unquote(tmp);
  21321. filename = unescape(filename);
  21322. filename = rfc5987decode(filename);
  21323. filename = rfc2047decode(filename);
  21324. return fixupEncoding(filename);
  21325. }
  21326. tmp = rfc2231getparam(contentDisposition);
  21327. if (tmp) {
  21328. var _filename = rfc2047decode(tmp);
  21329. return fixupEncoding(_filename);
  21330. }
  21331. tmp = toParamRegExp("filename", "i").exec(contentDisposition);
  21332. if (tmp) {
  21333. tmp = tmp[1];
  21334. var _filename2 = rfc2616unquote(tmp);
  21335. _filename2 = rfc2047decode(_filename2);
  21336. return fixupEncoding(_filename2);
  21337. }
  21338. function toParamRegExp(attributePattern, flags) {
  21339. return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags);
  21340. }
  21341. function textdecode(encoding, value) {
  21342. if (encoding) {
  21343. if (!/^[\x00-\xFF]+$/.test(value)) {
  21344. return value;
  21345. }
  21346. try {
  21347. var decoder = new TextDecoder(encoding, {
  21348. fatal: true
  21349. });
  21350. var bytes = Array.from(value, function (ch) {
  21351. return ch.charCodeAt(0) & 0xff;
  21352. });
  21353. value = decoder.decode(new Uint8Array(bytes));
  21354. needsEncodingFixup = false;
  21355. } catch (e) {
  21356. if (/^utf-?8$/i.test(encoding)) {
  21357. try {
  21358. value = decodeURIComponent(escape(value));
  21359. needsEncodingFixup = false;
  21360. } catch (err) {}
  21361. }
  21362. }
  21363. }
  21364. return value;
  21365. }
  21366. function fixupEncoding(value) {
  21367. if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
  21368. value = textdecode("utf-8", value);
  21369. if (needsEncodingFixup) {
  21370. value = textdecode("iso-8859-1", value);
  21371. }
  21372. }
  21373. return value;
  21374. }
  21375. function rfc2231getparam(contentDispositionStr) {
  21376. var matches = [];
  21377. var match;
  21378. var iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
  21379. while ((match = iter.exec(contentDispositionStr)) !== null) {
  21380. var _match = match,
  21381. _match2 = _slicedToArray(_match, 4),
  21382. n = _match2[1],
  21383. quot = _match2[2],
  21384. part = _match2[3];
  21385. n = parseInt(n, 10);
  21386. if (n in matches) {
  21387. if (n === 0) {
  21388. break;
  21389. }
  21390. continue;
  21391. }
  21392. matches[n] = [quot, part];
  21393. }
  21394. var parts = [];
  21395. for (var _n2 = 0; _n2 < matches.length; ++_n2) {
  21396. if (!(_n2 in matches)) {
  21397. break;
  21398. }
  21399. var _matches$_n = _slicedToArray(matches[_n2], 2),
  21400. _quot = _matches$_n[0],
  21401. _part = _matches$_n[1];
  21402. _part = rfc2616unquote(_part);
  21403. if (_quot) {
  21404. _part = unescape(_part);
  21405. if (_n2 === 0) {
  21406. _part = rfc5987decode(_part);
  21407. }
  21408. }
  21409. parts.push(_part);
  21410. }
  21411. return parts.join("");
  21412. }
  21413. function rfc2616unquote(value) {
  21414. if (value.startsWith('"')) {
  21415. var parts = value.slice(1).split('\\"');
  21416. for (var i = 0; i < parts.length; ++i) {
  21417. var quotindex = parts[i].indexOf('"');
  21418. if (quotindex !== -1) {
  21419. parts[i] = parts[i].slice(0, quotindex);
  21420. parts.length = i + 1;
  21421. }
  21422. parts[i] = parts[i].replace(/\\(.)/g, "$1");
  21423. }
  21424. value = parts.join('"');
  21425. }
  21426. return value;
  21427. }
  21428. function rfc5987decode(extvalue) {
  21429. var encodingend = extvalue.indexOf("'");
  21430. if (encodingend === -1) {
  21431. return extvalue;
  21432. }
  21433. var encoding = extvalue.slice(0, encodingend);
  21434. var langvalue = extvalue.slice(encodingend + 1);
  21435. var value = langvalue.replace(/^[^']*'/, "");
  21436. return textdecode(encoding, value);
  21437. }
  21438. function rfc2047decode(value) {
  21439. if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
  21440. return value;
  21441. }
  21442. return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
  21443. if (encoding === "q" || encoding === "Q") {
  21444. text = text.replace(/_/g, " ");
  21445. text = text.replace(/=([0-9a-fA-F]{2})/g, function (match, hex) {
  21446. return String.fromCharCode(parseInt(hex, 16));
  21447. });
  21448. return textdecode(charset, text);
  21449. }
  21450. try {
  21451. text = atob(text);
  21452. } catch (e) {}
  21453. return textdecode(charset, text);
  21454. });
  21455. }
  21456. return "";
  21457. }
  21458. /***/ }),
  21459. /* 215 */
  21460. /***/ (function(module, exports, __w_pdfjs_require__) {
  21461. "use strict";
  21462. Object.defineProperty(exports, "__esModule", {
  21463. value: true
  21464. });
  21465. exports.PDFNetworkStream = void 0;
  21466. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  21467. var _util = __w_pdfjs_require__(5);
  21468. var _network_utils = __w_pdfjs_require__(213);
  21469. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21470. 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); } }
  21471. 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); }); }; }
  21472. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  21473. 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); } }
  21474. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  21475. ;
  21476. var OK_RESPONSE = 200;
  21477. var PARTIAL_CONTENT_RESPONSE = 206;
  21478. function getArrayBuffer(xhr) {
  21479. var data = xhr.response;
  21480. if (typeof data !== "string") {
  21481. return data;
  21482. }
  21483. var array = (0, _util.stringToBytes)(data);
  21484. return array.buffer;
  21485. }
  21486. var NetworkManager = /*#__PURE__*/function () {
  21487. function NetworkManager(url, args) {
  21488. _classCallCheck(this, NetworkManager);
  21489. this.url = url;
  21490. args = args || {};
  21491. this.isHttp = /^https?:/i.test(url);
  21492. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  21493. this.withCredentials = args.withCredentials || false;
  21494. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  21495. return new XMLHttpRequest();
  21496. };
  21497. this.currXhrId = 0;
  21498. this.pendingRequests = Object.create(null);
  21499. }
  21500. _createClass(NetworkManager, [{
  21501. key: "requestRange",
  21502. value: function requestRange(begin, end, listeners) {
  21503. var args = {
  21504. begin: begin,
  21505. end: end
  21506. };
  21507. for (var prop in listeners) {
  21508. args[prop] = listeners[prop];
  21509. }
  21510. return this.request(args);
  21511. }
  21512. }, {
  21513. key: "requestFull",
  21514. value: function requestFull(listeners) {
  21515. return this.request(listeners);
  21516. }
  21517. }, {
  21518. key: "request",
  21519. value: function request(args) {
  21520. var xhr = this.getXhr();
  21521. var xhrId = this.currXhrId++;
  21522. var pendingRequest = this.pendingRequests[xhrId] = {
  21523. xhr: xhr
  21524. };
  21525. xhr.open("GET", this.url);
  21526. xhr.withCredentials = this.withCredentials;
  21527. for (var property in this.httpHeaders) {
  21528. var value = this.httpHeaders[property];
  21529. if (typeof value === "undefined") {
  21530. continue;
  21531. }
  21532. xhr.setRequestHeader(property, value);
  21533. }
  21534. if (this.isHttp && "begin" in args && "end" in args) {
  21535. xhr.setRequestHeader("Range", "bytes=".concat(args.begin, "-").concat(args.end - 1));
  21536. pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
  21537. } else {
  21538. pendingRequest.expectedStatus = OK_RESPONSE;
  21539. }
  21540. xhr.responseType = "arraybuffer";
  21541. if (args.onError) {
  21542. xhr.onerror = function (evt) {
  21543. args.onError(xhr.status);
  21544. };
  21545. }
  21546. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  21547. xhr.onprogress = this.onProgress.bind(this, xhrId);
  21548. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  21549. pendingRequest.onDone = args.onDone;
  21550. pendingRequest.onError = args.onError;
  21551. pendingRequest.onProgress = args.onProgress;
  21552. xhr.send(null);
  21553. return xhrId;
  21554. }
  21555. }, {
  21556. key: "onProgress",
  21557. value: function onProgress(xhrId, evt) {
  21558. var pendingRequest = this.pendingRequests[xhrId];
  21559. if (!pendingRequest) {
  21560. return;
  21561. }
  21562. if (pendingRequest.onProgress) {
  21563. pendingRequest.onProgress(evt);
  21564. }
  21565. }
  21566. }, {
  21567. key: "onStateChange",
  21568. value: function onStateChange(xhrId, evt) {
  21569. var pendingRequest = this.pendingRequests[xhrId];
  21570. if (!pendingRequest) {
  21571. return;
  21572. }
  21573. var xhr = pendingRequest.xhr;
  21574. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  21575. pendingRequest.onHeadersReceived();
  21576. delete pendingRequest.onHeadersReceived;
  21577. }
  21578. if (xhr.readyState !== 4) {
  21579. return;
  21580. }
  21581. if (!(xhrId in this.pendingRequests)) {
  21582. return;
  21583. }
  21584. delete this.pendingRequests[xhrId];
  21585. if (xhr.status === 0 && this.isHttp) {
  21586. if (pendingRequest.onError) {
  21587. pendingRequest.onError(xhr.status);
  21588. }
  21589. return;
  21590. }
  21591. var xhrStatus = xhr.status || OK_RESPONSE;
  21592. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  21593. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  21594. if (pendingRequest.onError) {
  21595. pendingRequest.onError(xhr.status);
  21596. }
  21597. return;
  21598. }
  21599. var chunk = getArrayBuffer(xhr);
  21600. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  21601. var rangeHeader = xhr.getResponseHeader("Content-Range");
  21602. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  21603. pendingRequest.onDone({
  21604. begin: parseInt(matches[1], 10),
  21605. chunk: chunk
  21606. });
  21607. } else if (chunk) {
  21608. pendingRequest.onDone({
  21609. begin: 0,
  21610. chunk: chunk
  21611. });
  21612. } else if (pendingRequest.onError) {
  21613. pendingRequest.onError(xhr.status);
  21614. }
  21615. }
  21616. }, {
  21617. key: "hasPendingRequests",
  21618. value: function hasPendingRequests() {
  21619. for (var xhrId in this.pendingRequests) {
  21620. return true;
  21621. }
  21622. return false;
  21623. }
  21624. }, {
  21625. key: "getRequestXhr",
  21626. value: function getRequestXhr(xhrId) {
  21627. return this.pendingRequests[xhrId].xhr;
  21628. }
  21629. }, {
  21630. key: "isPendingRequest",
  21631. value: function isPendingRequest(xhrId) {
  21632. return xhrId in this.pendingRequests;
  21633. }
  21634. }, {
  21635. key: "abortAllRequests",
  21636. value: function abortAllRequests() {
  21637. for (var xhrId in this.pendingRequests) {
  21638. this.abortRequest(xhrId | 0);
  21639. }
  21640. }
  21641. }, {
  21642. key: "abortRequest",
  21643. value: function abortRequest(xhrId) {
  21644. var xhr = this.pendingRequests[xhrId].xhr;
  21645. delete this.pendingRequests[xhrId];
  21646. xhr.abort();
  21647. }
  21648. }]);
  21649. return NetworkManager;
  21650. }();
  21651. var PDFNetworkStream = /*#__PURE__*/function () {
  21652. function PDFNetworkStream(source) {
  21653. _classCallCheck(this, PDFNetworkStream);
  21654. this._source = source;
  21655. this._manager = new NetworkManager(source.url, {
  21656. httpHeaders: source.httpHeaders,
  21657. withCredentials: source.withCredentials
  21658. });
  21659. this._rangeChunkSize = source.rangeChunkSize;
  21660. this._fullRequestReader = null;
  21661. this._rangeRequestReaders = [];
  21662. }
  21663. _createClass(PDFNetworkStream, [{
  21664. key: "_onRangeRequestReaderClosed",
  21665. value: function _onRangeRequestReaderClosed(reader) {
  21666. var i = this._rangeRequestReaders.indexOf(reader);
  21667. if (i >= 0) {
  21668. this._rangeRequestReaders.splice(i, 1);
  21669. }
  21670. }
  21671. }, {
  21672. key: "getFullReader",
  21673. value: function getFullReader() {
  21674. (0, _util.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
  21675. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
  21676. return this._fullRequestReader;
  21677. }
  21678. }, {
  21679. key: "getRangeReader",
  21680. value: function getRangeReader(begin, end) {
  21681. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  21682. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  21683. this._rangeRequestReaders.push(reader);
  21684. return reader;
  21685. }
  21686. }, {
  21687. key: "cancelAllRequests",
  21688. value: function cancelAllRequests(reason) {
  21689. if (this._fullRequestReader) {
  21690. this._fullRequestReader.cancel(reason);
  21691. }
  21692. var readers = this._rangeRequestReaders.slice(0);
  21693. readers.forEach(function (reader) {
  21694. reader.cancel(reason);
  21695. });
  21696. }
  21697. }]);
  21698. return PDFNetworkStream;
  21699. }();
  21700. exports.PDFNetworkStream = PDFNetworkStream;
  21701. var PDFNetworkStreamFullRequestReader = /*#__PURE__*/function () {
  21702. function PDFNetworkStreamFullRequestReader(manager, source) {
  21703. _classCallCheck(this, PDFNetworkStreamFullRequestReader);
  21704. this._manager = manager;
  21705. var args = {
  21706. onHeadersReceived: this._onHeadersReceived.bind(this),
  21707. onDone: this._onDone.bind(this),
  21708. onError: this._onError.bind(this),
  21709. onProgress: this._onProgress.bind(this)
  21710. };
  21711. this._url = source.url;
  21712. this._fullRequestId = manager.requestFull(args);
  21713. this._headersReceivedCapability = (0, _util.createPromiseCapability)();
  21714. this._disableRange = source.disableRange || false;
  21715. this._contentLength = source.length;
  21716. this._rangeChunkSize = source.rangeChunkSize;
  21717. if (!this._rangeChunkSize && !this._disableRange) {
  21718. this._disableRange = true;
  21719. }
  21720. this._isStreamingSupported = false;
  21721. this._isRangeSupported = false;
  21722. this._cachedChunks = [];
  21723. this._requests = [];
  21724. this._done = false;
  21725. this._storedError = undefined;
  21726. this._filename = null;
  21727. this.onProgress = null;
  21728. }
  21729. _createClass(PDFNetworkStreamFullRequestReader, [{
  21730. key: "_onHeadersReceived",
  21731. value: function _onHeadersReceived() {
  21732. var fullRequestXhrId = this._fullRequestId;
  21733. var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
  21734. var getResponseHeader = function getResponseHeader(name) {
  21735. return fullRequestXhr.getResponseHeader(name);
  21736. };
  21737. var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
  21738. getResponseHeader: getResponseHeader,
  21739. isHttp: this._manager.isHttp,
  21740. rangeChunkSize: this._rangeChunkSize,
  21741. disableRange: this._disableRange
  21742. }),
  21743. allowRangeRequests = _validateRangeRequest.allowRangeRequests,
  21744. suggestedLength = _validateRangeRequest.suggestedLength;
  21745. if (allowRangeRequests) {
  21746. this._isRangeSupported = true;
  21747. }
  21748. this._contentLength = suggestedLength || this._contentLength;
  21749. this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
  21750. if (this._isRangeSupported) {
  21751. this._manager.abortRequest(fullRequestXhrId);
  21752. }
  21753. this._headersReceivedCapability.resolve();
  21754. }
  21755. }, {
  21756. key: "_onDone",
  21757. value: function _onDone(args) {
  21758. if (args) {
  21759. if (this._requests.length > 0) {
  21760. var requestCapability = this._requests.shift();
  21761. requestCapability.resolve({
  21762. value: args.chunk,
  21763. done: false
  21764. });
  21765. } else {
  21766. this._cachedChunks.push(args.chunk);
  21767. }
  21768. }
  21769. this._done = true;
  21770. if (this._cachedChunks.length > 0) {
  21771. return;
  21772. }
  21773. this._requests.forEach(function (requestCapability) {
  21774. requestCapability.resolve({
  21775. value: undefined,
  21776. done: true
  21777. });
  21778. });
  21779. this._requests = [];
  21780. }
  21781. }, {
  21782. key: "_onError",
  21783. value: function _onError(status) {
  21784. var url = this._url;
  21785. var exception = (0, _network_utils.createResponseStatusError)(status, url);
  21786. this._storedError = exception;
  21787. this._headersReceivedCapability.reject(exception);
  21788. this._requests.forEach(function (requestCapability) {
  21789. requestCapability.reject(exception);
  21790. });
  21791. this._requests = [];
  21792. this._cachedChunks = [];
  21793. }
  21794. }, {
  21795. key: "_onProgress",
  21796. value: function _onProgress(data) {
  21797. if (this.onProgress) {
  21798. this.onProgress({
  21799. loaded: data.loaded,
  21800. total: data.lengthComputable ? data.total : this._contentLength
  21801. });
  21802. }
  21803. }
  21804. }, {
  21805. key: "read",
  21806. value: function () {
  21807. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  21808. var chunk, requestCapability;
  21809. return _regenerator["default"].wrap(function _callee$(_context) {
  21810. while (1) {
  21811. switch (_context.prev = _context.next) {
  21812. case 0:
  21813. if (!this._storedError) {
  21814. _context.next = 2;
  21815. break;
  21816. }
  21817. throw this._storedError;
  21818. case 2:
  21819. if (!(this._cachedChunks.length > 0)) {
  21820. _context.next = 5;
  21821. break;
  21822. }
  21823. chunk = this._cachedChunks.shift();
  21824. return _context.abrupt("return", {
  21825. value: chunk,
  21826. done: false
  21827. });
  21828. case 5:
  21829. if (!this._done) {
  21830. _context.next = 7;
  21831. break;
  21832. }
  21833. return _context.abrupt("return", {
  21834. value: undefined,
  21835. done: true
  21836. });
  21837. case 7:
  21838. requestCapability = (0, _util.createPromiseCapability)();
  21839. this._requests.push(requestCapability);
  21840. return _context.abrupt("return", requestCapability.promise);
  21841. case 10:
  21842. case "end":
  21843. return _context.stop();
  21844. }
  21845. }
  21846. }, _callee, this);
  21847. }));
  21848. function read() {
  21849. return _read.apply(this, arguments);
  21850. }
  21851. return read;
  21852. }()
  21853. }, {
  21854. key: "cancel",
  21855. value: function cancel(reason) {
  21856. this._done = true;
  21857. this._headersReceivedCapability.reject(reason);
  21858. this._requests.forEach(function (requestCapability) {
  21859. requestCapability.resolve({
  21860. value: undefined,
  21861. done: true
  21862. });
  21863. });
  21864. this._requests = [];
  21865. if (this._manager.isPendingRequest(this._fullRequestId)) {
  21866. this._manager.abortRequest(this._fullRequestId);
  21867. }
  21868. this._fullRequestReader = null;
  21869. }
  21870. }, {
  21871. key: "filename",
  21872. get: function get() {
  21873. return this._filename;
  21874. }
  21875. }, {
  21876. key: "isRangeSupported",
  21877. get: function get() {
  21878. return this._isRangeSupported;
  21879. }
  21880. }, {
  21881. key: "isStreamingSupported",
  21882. get: function get() {
  21883. return this._isStreamingSupported;
  21884. }
  21885. }, {
  21886. key: "contentLength",
  21887. get: function get() {
  21888. return this._contentLength;
  21889. }
  21890. }, {
  21891. key: "headersReady",
  21892. get: function get() {
  21893. return this._headersReceivedCapability.promise;
  21894. }
  21895. }]);
  21896. return PDFNetworkStreamFullRequestReader;
  21897. }();
  21898. var PDFNetworkStreamRangeRequestReader = /*#__PURE__*/function () {
  21899. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  21900. _classCallCheck(this, PDFNetworkStreamRangeRequestReader);
  21901. this._manager = manager;
  21902. var args = {
  21903. onDone: this._onDone.bind(this),
  21904. onProgress: this._onProgress.bind(this)
  21905. };
  21906. this._requestId = manager.requestRange(begin, end, args);
  21907. this._requests = [];
  21908. this._queuedChunk = null;
  21909. this._done = false;
  21910. this.onProgress = null;
  21911. this.onClosed = null;
  21912. }
  21913. _createClass(PDFNetworkStreamRangeRequestReader, [{
  21914. key: "_close",
  21915. value: function _close() {
  21916. if (this.onClosed) {
  21917. this.onClosed(this);
  21918. }
  21919. }
  21920. }, {
  21921. key: "_onDone",
  21922. value: function _onDone(data) {
  21923. var chunk = data.chunk;
  21924. if (this._requests.length > 0) {
  21925. var requestCapability = this._requests.shift();
  21926. requestCapability.resolve({
  21927. value: chunk,
  21928. done: false
  21929. });
  21930. } else {
  21931. this._queuedChunk = chunk;
  21932. }
  21933. this._done = true;
  21934. this._requests.forEach(function (requestCapability) {
  21935. requestCapability.resolve({
  21936. value: undefined,
  21937. done: true
  21938. });
  21939. });
  21940. this._requests = [];
  21941. this._close();
  21942. }
  21943. }, {
  21944. key: "_onProgress",
  21945. value: function _onProgress(evt) {
  21946. if (!this.isStreamingSupported && this.onProgress) {
  21947. this.onProgress({
  21948. loaded: evt.loaded
  21949. });
  21950. }
  21951. }
  21952. }, {
  21953. key: "read",
  21954. value: function () {
  21955. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  21956. var chunk, requestCapability;
  21957. return _regenerator["default"].wrap(function _callee2$(_context2) {
  21958. while (1) {
  21959. switch (_context2.prev = _context2.next) {
  21960. case 0:
  21961. if (!(this._queuedChunk !== null)) {
  21962. _context2.next = 4;
  21963. break;
  21964. }
  21965. chunk = this._queuedChunk;
  21966. this._queuedChunk = null;
  21967. return _context2.abrupt("return", {
  21968. value: chunk,
  21969. done: false
  21970. });
  21971. case 4:
  21972. if (!this._done) {
  21973. _context2.next = 6;
  21974. break;
  21975. }
  21976. return _context2.abrupt("return", {
  21977. value: undefined,
  21978. done: true
  21979. });
  21980. case 6:
  21981. requestCapability = (0, _util.createPromiseCapability)();
  21982. this._requests.push(requestCapability);
  21983. return _context2.abrupt("return", requestCapability.promise);
  21984. case 9:
  21985. case "end":
  21986. return _context2.stop();
  21987. }
  21988. }
  21989. }, _callee2, this);
  21990. }));
  21991. function read() {
  21992. return _read2.apply(this, arguments);
  21993. }
  21994. return read;
  21995. }()
  21996. }, {
  21997. key: "cancel",
  21998. value: function cancel(reason) {
  21999. this._done = true;
  22000. this._requests.forEach(function (requestCapability) {
  22001. requestCapability.resolve({
  22002. value: undefined,
  22003. done: true
  22004. });
  22005. });
  22006. this._requests = [];
  22007. if (this._manager.isPendingRequest(this._requestId)) {
  22008. this._manager.abortRequest(this._requestId);
  22009. }
  22010. this._close();
  22011. }
  22012. }, {
  22013. key: "isStreamingSupported",
  22014. get: function get() {
  22015. return false;
  22016. }
  22017. }]);
  22018. return PDFNetworkStreamRangeRequestReader;
  22019. }();
  22020. /***/ }),
  22021. /* 216 */
  22022. /***/ (function(module, exports, __w_pdfjs_require__) {
  22023. "use strict";
  22024. Object.defineProperty(exports, "__esModule", {
  22025. value: true
  22026. });
  22027. exports.PDFFetchStream = void 0;
  22028. var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
  22029. var _util = __w_pdfjs_require__(5);
  22030. var _network_utils = __w_pdfjs_require__(213);
  22031. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  22032. 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); } }
  22033. 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); }); }; }
  22034. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  22035. 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); } }
  22036. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  22037. ;
  22038. function createFetchOptions(headers, withCredentials, abortController) {
  22039. return {
  22040. method: "GET",
  22041. headers: headers,
  22042. signal: abortController && abortController.signal,
  22043. mode: "cors",
  22044. credentials: withCredentials ? "include" : "same-origin",
  22045. redirect: "follow"
  22046. };
  22047. }
  22048. function createHeaders(httpHeaders) {
  22049. var headers = new Headers();
  22050. for (var property in httpHeaders) {
  22051. var value = httpHeaders[property];
  22052. if (typeof value === "undefined") {
  22053. continue;
  22054. }
  22055. headers.append(property, value);
  22056. }
  22057. return headers;
  22058. }
  22059. var PDFFetchStream = /*#__PURE__*/function () {
  22060. function PDFFetchStream(source) {
  22061. _classCallCheck(this, PDFFetchStream);
  22062. this.source = source;
  22063. this.isHttp = /^https?:/i.test(source.url);
  22064. this.httpHeaders = this.isHttp && source.httpHeaders || {};
  22065. this._fullRequestReader = null;
  22066. this._rangeRequestReaders = [];
  22067. }
  22068. _createClass(PDFFetchStream, [{
  22069. key: "getFullReader",
  22070. value: function getFullReader() {
  22071. (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
  22072. this._fullRequestReader = new PDFFetchStreamReader(this);
  22073. return this._fullRequestReader;
  22074. }
  22075. }, {
  22076. key: "getRangeReader",
  22077. value: function getRangeReader(begin, end) {
  22078. if (end <= this._progressiveDataLength) {
  22079. return null;
  22080. }
  22081. var reader = new PDFFetchStreamRangeReader(this, begin, end);
  22082. this._rangeRequestReaders.push(reader);
  22083. return reader;
  22084. }
  22085. }, {
  22086. key: "cancelAllRequests",
  22087. value: function cancelAllRequests(reason) {
  22088. if (this._fullRequestReader) {
  22089. this._fullRequestReader.cancel(reason);
  22090. }
  22091. var readers = this._rangeRequestReaders.slice(0);
  22092. readers.forEach(function (reader) {
  22093. reader.cancel(reason);
  22094. });
  22095. }
  22096. }, {
  22097. key: "_progressiveDataLength",
  22098. get: function get() {
  22099. return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
  22100. }
  22101. }]);
  22102. return PDFFetchStream;
  22103. }();
  22104. exports.PDFFetchStream = PDFFetchStream;
  22105. var PDFFetchStreamReader = /*#__PURE__*/function () {
  22106. function PDFFetchStreamReader(stream) {
  22107. var _this = this;
  22108. _classCallCheck(this, PDFFetchStreamReader);
  22109. this._stream = stream;
  22110. this._reader = null;
  22111. this._loaded = 0;
  22112. this._filename = null;
  22113. var source = stream.source;
  22114. this._withCredentials = source.withCredentials || false;
  22115. this._contentLength = source.length;
  22116. this._headersCapability = (0, _util.createPromiseCapability)();
  22117. this._disableRange = source.disableRange || false;
  22118. this._rangeChunkSize = source.rangeChunkSize;
  22119. if (!this._rangeChunkSize && !this._disableRange) {
  22120. this._disableRange = true;
  22121. }
  22122. if (typeof AbortController !== "undefined") {
  22123. this._abortController = new AbortController();
  22124. }
  22125. this._isStreamingSupported = !source.disableStream;
  22126. this._isRangeSupported = !source.disableRange;
  22127. this._headers = createHeaders(this._stream.httpHeaders);
  22128. var url = source.url;
  22129. fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) {
  22130. if (!(0, _network_utils.validateResponseStatus)(response.status)) {
  22131. throw (0, _network_utils.createResponseStatusError)(response.status, url);
  22132. }
  22133. _this._reader = response.body.getReader();
  22134. _this._headersCapability.resolve();
  22135. var getResponseHeader = function getResponseHeader(name) {
  22136. return response.headers.get(name);
  22137. };
  22138. var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
  22139. getResponseHeader: getResponseHeader,
  22140. isHttp: _this._stream.isHttp,
  22141. rangeChunkSize: _this._rangeChunkSize,
  22142. disableRange: _this._disableRange
  22143. }),
  22144. allowRangeRequests = _validateRangeRequest.allowRangeRequests,
  22145. suggestedLength = _validateRangeRequest.suggestedLength;
  22146. _this._isRangeSupported = allowRangeRequests;
  22147. _this._contentLength = suggestedLength || _this._contentLength;
  22148. _this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
  22149. if (!_this._isStreamingSupported && _this._isRangeSupported) {
  22150. _this.cancel(new _util.AbortException("Streaming is disabled."));
  22151. }
  22152. })["catch"](this._headersCapability.reject);
  22153. this.onProgress = null;
  22154. }
  22155. _createClass(PDFFetchStreamReader, [{
  22156. key: "read",
  22157. value: function () {
  22158. var _read = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
  22159. var _yield$this$_reader$r, value, done, buffer;
  22160. return _regenerator["default"].wrap(function _callee$(_context) {
  22161. while (1) {
  22162. switch (_context.prev = _context.next) {
  22163. case 0:
  22164. _context.next = 2;
  22165. return this._headersCapability.promise;
  22166. case 2:
  22167. _context.next = 4;
  22168. return this._reader.read();
  22169. case 4:
  22170. _yield$this$_reader$r = _context.sent;
  22171. value = _yield$this$_reader$r.value;
  22172. done = _yield$this$_reader$r.done;
  22173. if (!done) {
  22174. _context.next = 9;
  22175. break;
  22176. }
  22177. return _context.abrupt("return", {
  22178. value: value,
  22179. done: done
  22180. });
  22181. case 9:
  22182. this._loaded += value.byteLength;
  22183. if (this.onProgress) {
  22184. this.onProgress({
  22185. loaded: this._loaded,
  22186. total: this._contentLength
  22187. });
  22188. }
  22189. buffer = new Uint8Array(value).buffer;
  22190. return _context.abrupt("return", {
  22191. value: buffer,
  22192. done: false
  22193. });
  22194. case 13:
  22195. case "end":
  22196. return _context.stop();
  22197. }
  22198. }
  22199. }, _callee, this);
  22200. }));
  22201. function read() {
  22202. return _read.apply(this, arguments);
  22203. }
  22204. return read;
  22205. }()
  22206. }, {
  22207. key: "cancel",
  22208. value: function cancel(reason) {
  22209. if (this._reader) {
  22210. this._reader.cancel(reason);
  22211. }
  22212. if (this._abortController) {
  22213. this._abortController.abort();
  22214. }
  22215. }
  22216. }, {
  22217. key: "headersReady",
  22218. get: function get() {
  22219. return this._headersCapability.promise;
  22220. }
  22221. }, {
  22222. key: "filename",
  22223. get: function get() {
  22224. return this._filename;
  22225. }
  22226. }, {
  22227. key: "contentLength",
  22228. get: function get() {
  22229. return this._contentLength;
  22230. }
  22231. }, {
  22232. key: "isRangeSupported",
  22233. get: function get() {
  22234. return this._isRangeSupported;
  22235. }
  22236. }, {
  22237. key: "isStreamingSupported",
  22238. get: function get() {
  22239. return this._isStreamingSupported;
  22240. }
  22241. }]);
  22242. return PDFFetchStreamReader;
  22243. }();
  22244. var PDFFetchStreamRangeReader = /*#__PURE__*/function () {
  22245. function PDFFetchStreamRangeReader(stream, begin, end) {
  22246. var _this2 = this;
  22247. _classCallCheck(this, PDFFetchStreamRangeReader);
  22248. this._stream = stream;
  22249. this._reader = null;
  22250. this._loaded = 0;
  22251. var source = stream.source;
  22252. this._withCredentials = source.withCredentials || false;
  22253. this._readCapability = (0, _util.createPromiseCapability)();
  22254. this._isStreamingSupported = !source.disableStream;
  22255. if (typeof AbortController !== "undefined") {
  22256. this._abortController = new AbortController();
  22257. }
  22258. this._headers = createHeaders(this._stream.httpHeaders);
  22259. this._headers.append("Range", "bytes=".concat(begin, "-").concat(end - 1));
  22260. var url = source.url;
  22261. fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(function (response) {
  22262. if (!(0, _network_utils.validateResponseStatus)(response.status)) {
  22263. throw (0, _network_utils.createResponseStatusError)(response.status, url);
  22264. }
  22265. _this2._readCapability.resolve();
  22266. _this2._reader = response.body.getReader();
  22267. });
  22268. this.onProgress = null;
  22269. }
  22270. _createClass(PDFFetchStreamRangeReader, [{
  22271. key: "read",
  22272. value: function () {
  22273. var _read2 = _asyncToGenerator( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
  22274. var _yield$this$_reader$r2, value, done, buffer;
  22275. return _regenerator["default"].wrap(function _callee2$(_context2) {
  22276. while (1) {
  22277. switch (_context2.prev = _context2.next) {
  22278. case 0:
  22279. _context2.next = 2;
  22280. return this._readCapability.promise;
  22281. case 2:
  22282. _context2.next = 4;
  22283. return this._reader.read();
  22284. case 4:
  22285. _yield$this$_reader$r2 = _context2.sent;
  22286. value = _yield$this$_reader$r2.value;
  22287. done = _yield$this$_reader$r2.done;
  22288. if (!done) {
  22289. _context2.next = 9;
  22290. break;
  22291. }
  22292. return _context2.abrupt("return", {
  22293. value: value,
  22294. done: done
  22295. });
  22296. case 9:
  22297. this._loaded += value.byteLength;
  22298. if (this.onProgress) {
  22299. this.onProgress({
  22300. loaded: this._loaded
  22301. });
  22302. }
  22303. buffer = new Uint8Array(value).buffer;
  22304. return _context2.abrupt("return", {
  22305. value: buffer,
  22306. done: false
  22307. });
  22308. case 13:
  22309. case "end":
  22310. return _context2.stop();
  22311. }
  22312. }
  22313. }, _callee2, this);
  22314. }));
  22315. function read() {
  22316. return _read2.apply(this, arguments);
  22317. }
  22318. return read;
  22319. }()
  22320. }, {
  22321. key: "cancel",
  22322. value: function cancel(reason) {
  22323. if (this._reader) {
  22324. this._reader.cancel(reason);
  22325. }
  22326. if (this._abortController) {
  22327. this._abortController.abort();
  22328. }
  22329. }
  22330. }, {
  22331. key: "isStreamingSupported",
  22332. get: function get() {
  22333. return this._isStreamingSupported;
  22334. }
  22335. }]);
  22336. return PDFFetchStreamRangeReader;
  22337. }();
  22338. /***/ })
  22339. /******/ ]);
  22340. });
  22341. //# sourceMappingURL=pdf.js.map