pdf.worker.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929
  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.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = 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. const pdfjsVersion = '2.4.456';
  123. const pdfjsBuild = '228a591c';
  124. const pdfjsCoreWorker = __w_pdfjs_require__(1);
  125. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  126. /***/ }),
  127. /* 1 */
  128. /***/ (function(module, exports, __w_pdfjs_require__) {
  129. "use strict";
  130. Object.defineProperty(exports, "__esModule", {
  131. value: true
  132. });
  133. exports.WorkerMessageHandler = exports.WorkerTask = void 0;
  134. var _util = __w_pdfjs_require__(2);
  135. var _primitives = __w_pdfjs_require__(4);
  136. var _pdf_manager = __w_pdfjs_require__(5);
  137. var _is_node = __w_pdfjs_require__(44);
  138. var _message_handler = __w_pdfjs_require__(45);
  139. var _worker_stream = __w_pdfjs_require__(46);
  140. var _core_utils = __w_pdfjs_require__(7);
  141. var WorkerTask = function WorkerTaskClosure() {
  142. function WorkerTask(name) {
  143. this.name = name;
  144. this.terminated = false;
  145. this._capability = (0, _util.createPromiseCapability)();
  146. }
  147. WorkerTask.prototype = {
  148. get finished() {
  149. return this._capability.promise;
  150. },
  151. finish() {
  152. this._capability.resolve();
  153. },
  154. terminate() {
  155. this.terminated = true;
  156. },
  157. ensureNotTerminated() {
  158. if (this.terminated) {
  159. throw new Error("Worker task was terminated");
  160. }
  161. }
  162. };
  163. return WorkerTask;
  164. }();
  165. exports.WorkerTask = WorkerTask;
  166. var WorkerMessageHandler = {
  167. setup(handler, port) {
  168. var testMessageProcessed = false;
  169. handler.on("test", function wphSetupTest(data) {
  170. if (testMessageProcessed) {
  171. return;
  172. }
  173. testMessageProcessed = true;
  174. if (!(data instanceof Uint8Array)) {
  175. handler.send("test", null);
  176. return;
  177. }
  178. const supportTransfers = data[0] === 255;
  179. handler.postMessageTransfers = supportTransfers;
  180. handler.send("test", {
  181. supportTransfers
  182. });
  183. });
  184. handler.on("configure", function wphConfigure(data) {
  185. (0, _util.setVerbosityLevel)(data.verbosity);
  186. });
  187. handler.on("GetDocRequest", function wphSetupDoc(data) {
  188. return WorkerMessageHandler.createDocumentHandler(data, port);
  189. });
  190. },
  191. createDocumentHandler(docParams, port) {
  192. var pdfManager;
  193. var terminated = false;
  194. var cancelXHRs = null;
  195. var WorkerTasks = [];
  196. const verbosity = (0, _util.getVerbosityLevel)();
  197. const apiVersion = docParams.apiVersion;
  198. const workerVersion = '2.4.456';
  199. if (apiVersion !== workerVersion) {
  200. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  201. }
  202. const enumerableProperties = [];
  203. for (const property in []) {
  204. enumerableProperties.push(property);
  205. }
  206. if (enumerableProperties.length) {
  207. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  208. }
  209. var docId = docParams.docId;
  210. var docBaseUrl = docParams.docBaseUrl;
  211. var workerHandlerName = docParams.docId + "_worker";
  212. var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  213. handler.postMessageTransfers = docParams.postMessageTransfers;
  214. function ensureNotTerminated() {
  215. if (terminated) {
  216. throw new Error("Worker was terminated");
  217. }
  218. }
  219. function startWorkerTask(task) {
  220. WorkerTasks.push(task);
  221. }
  222. function finishWorkerTask(task) {
  223. task.finish();
  224. var i = WorkerTasks.indexOf(task);
  225. WorkerTasks.splice(i, 1);
  226. }
  227. async function loadDocument(recoveryMode) {
  228. await pdfManager.ensureDoc("checkHeader");
  229. await pdfManager.ensureDoc("parseStartXRef");
  230. await pdfManager.ensureDoc("parse", [recoveryMode]);
  231. if (!recoveryMode) {
  232. await pdfManager.ensureDoc("checkFirstPage");
  233. }
  234. const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]);
  235. return {
  236. numPages,
  237. fingerprint
  238. };
  239. }
  240. function getPdfManager(data, evaluatorOptions) {
  241. var pdfManagerCapability = (0, _util.createPromiseCapability)();
  242. var pdfManager;
  243. var source = data.source;
  244. if (source.data) {
  245. try {
  246. pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  247. pdfManagerCapability.resolve(pdfManager);
  248. } catch (ex) {
  249. pdfManagerCapability.reject(ex);
  250. }
  251. return pdfManagerCapability.promise;
  252. }
  253. var pdfStream,
  254. cachedChunks = [];
  255. try {
  256. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  257. } catch (ex) {
  258. pdfManagerCapability.reject(ex);
  259. return pdfManagerCapability.promise;
  260. }
  261. var fullRequest = pdfStream.getFullReader();
  262. fullRequest.headersReady.then(function () {
  263. if (!fullRequest.isRangeSupported) {
  264. return;
  265. }
  266. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  267. pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  268. msgHandler: handler,
  269. password: source.password,
  270. length: fullRequest.contentLength,
  271. disableAutoFetch,
  272. rangeChunkSize: source.rangeChunkSize
  273. }, evaluatorOptions, docBaseUrl);
  274. for (let i = 0; i < cachedChunks.length; i++) {
  275. pdfManager.sendProgressiveData(cachedChunks[i]);
  276. }
  277. cachedChunks = [];
  278. pdfManagerCapability.resolve(pdfManager);
  279. cancelXHRs = null;
  280. }).catch(function (reason) {
  281. pdfManagerCapability.reject(reason);
  282. cancelXHRs = null;
  283. });
  284. var loaded = 0;
  285. var flushChunks = function () {
  286. var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  287. if (source.length && pdfFile.length !== source.length) {
  288. (0, _util.warn)("reported HTTP length is different from actual");
  289. }
  290. try {
  291. pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  292. pdfManagerCapability.resolve(pdfManager);
  293. } catch (ex) {
  294. pdfManagerCapability.reject(ex);
  295. }
  296. cachedChunks = [];
  297. };
  298. var readPromise = new Promise(function (resolve, reject) {
  299. var readChunk = function (chunk) {
  300. try {
  301. ensureNotTerminated();
  302. if (chunk.done) {
  303. if (!pdfManager) {
  304. flushChunks();
  305. }
  306. cancelXHRs = null;
  307. return;
  308. }
  309. var data = chunk.value;
  310. loaded += (0, _util.arrayByteLength)(data);
  311. if (!fullRequest.isStreamingSupported) {
  312. handler.send("DocProgress", {
  313. loaded,
  314. total: Math.max(loaded, fullRequest.contentLength || 0)
  315. });
  316. }
  317. if (pdfManager) {
  318. pdfManager.sendProgressiveData(data);
  319. } else {
  320. cachedChunks.push(data);
  321. }
  322. fullRequest.read().then(readChunk, reject);
  323. } catch (e) {
  324. reject(e);
  325. }
  326. };
  327. fullRequest.read().then(readChunk, reject);
  328. });
  329. readPromise.catch(function (e) {
  330. pdfManagerCapability.reject(e);
  331. cancelXHRs = null;
  332. });
  333. cancelXHRs = function (reason) {
  334. pdfStream.cancelAllRequests(reason);
  335. };
  336. return pdfManagerCapability.promise;
  337. }
  338. function setupDoc(data) {
  339. function onSuccess(doc) {
  340. ensureNotTerminated();
  341. handler.send("GetDoc", {
  342. pdfInfo: doc
  343. });
  344. }
  345. function onFailure(ex) {
  346. ensureNotTerminated();
  347. if (ex instanceof _util.PasswordException) {
  348. var task = new WorkerTask(`PasswordException: response ${ex.code}`);
  349. startWorkerTask(task);
  350. handler.sendWithPromise("PasswordRequest", ex).then(function (data) {
  351. finishWorkerTask(task);
  352. pdfManager.updatePassword(data.password);
  353. pdfManagerReady();
  354. }).catch(function () {
  355. finishWorkerTask(task);
  356. handler.send("DocException", ex);
  357. });
  358. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  359. handler.send("DocException", ex);
  360. } else {
  361. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  362. }
  363. }
  364. function pdfManagerReady() {
  365. ensureNotTerminated();
  366. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  367. ensureNotTerminated();
  368. if (!(ex instanceof _core_utils.XRefParseException)) {
  369. onFailure(ex);
  370. return;
  371. }
  372. pdfManager.requestLoadedStream();
  373. pdfManager.onLoadedStream().then(function () {
  374. ensureNotTerminated();
  375. loadDocument(true).then(onSuccess, onFailure);
  376. });
  377. }, onFailure);
  378. }
  379. ensureNotTerminated();
  380. var evaluatorOptions = {
  381. forceDataSchema: data.disableCreateObjectURL,
  382. maxImageSize: data.maxImageSize,
  383. disableFontFace: data.disableFontFace,
  384. nativeImageDecoderSupport: data.nativeImageDecoderSupport,
  385. ignoreErrors: data.ignoreErrors,
  386. isEvalSupported: data.isEvalSupported
  387. };
  388. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  389. if (terminated) {
  390. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  391. throw new Error("Worker was terminated");
  392. }
  393. pdfManager = newPdfManager;
  394. pdfManager.onLoadedStream().then(function (stream) {
  395. handler.send("DataLoaded", {
  396. length: stream.bytes.byteLength
  397. });
  398. });
  399. }).then(pdfManagerReady, onFailure);
  400. }
  401. handler.on("GetPage", function wphSetupGetPage(data) {
  402. return pdfManager.getPage(data.pageIndex).then(function (page) {
  403. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  404. return {
  405. rotate,
  406. ref,
  407. userUnit,
  408. view
  409. };
  410. });
  411. });
  412. });
  413. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  414. var ref = _primitives.Ref.get(data.ref.num, data.ref.gen);
  415. var catalog = pdfManager.pdfDocument.catalog;
  416. return catalog.getPageIndex(ref);
  417. });
  418. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  419. return pdfManager.ensureCatalog("destinations");
  420. });
  421. handler.on("GetDestination", function wphSetupGetDestination(data) {
  422. return pdfManager.ensureCatalog("getDestination", [data.id]);
  423. });
  424. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  425. return pdfManager.ensureCatalog("pageLabels");
  426. });
  427. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  428. return pdfManager.ensureCatalog("pageLayout");
  429. });
  430. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  431. return pdfManager.ensureCatalog("pageMode");
  432. });
  433. handler.on("GetViewerPreferences", function (data) {
  434. return pdfManager.ensureCatalog("viewerPreferences");
  435. });
  436. handler.on("GetOpenAction", function (data) {
  437. return pdfManager.ensureCatalog("openAction");
  438. });
  439. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  440. return pdfManager.ensureCatalog("attachments");
  441. });
  442. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  443. return pdfManager.ensureCatalog("javaScript");
  444. });
  445. handler.on("GetOutline", function wphSetupGetOutline(data) {
  446. return pdfManager.ensureCatalog("documentOutline");
  447. });
  448. handler.on("GetPermissions", function (data) {
  449. return pdfManager.ensureCatalog("permissions");
  450. });
  451. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  452. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  453. });
  454. handler.on("GetData", function wphSetupGetData(data) {
  455. pdfManager.requestLoadedStream();
  456. return pdfManager.onLoadedStream().then(function (stream) {
  457. return stream.bytes;
  458. });
  459. });
  460. handler.on("GetStats", function wphSetupGetStats(data) {
  461. return pdfManager.pdfDocument.xref.stats;
  462. });
  463. handler.on("GetAnnotations", function ({
  464. pageIndex,
  465. intent
  466. }) {
  467. return pdfManager.getPage(pageIndex).then(function (page) {
  468. return page.getAnnotationsData(intent);
  469. });
  470. });
  471. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  472. var pageIndex = data.pageIndex;
  473. pdfManager.getPage(pageIndex).then(function (page) {
  474. var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  475. startWorkerTask(task);
  476. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  477. page.getOperatorList({
  478. handler,
  479. sink,
  480. task,
  481. intent: data.intent,
  482. renderInteractiveForms: data.renderInteractiveForms
  483. }).then(function (operatorListInfo) {
  484. finishWorkerTask(task);
  485. if (start) {
  486. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  487. }
  488. sink.close();
  489. }, function (reason) {
  490. finishWorkerTask(task);
  491. if (task.terminated) {
  492. return;
  493. }
  494. handler.send("UnsupportedFeature", {
  495. featureId: _util.UNSUPPORTED_FEATURES.unknown
  496. });
  497. sink.error(reason);
  498. });
  499. });
  500. }, this);
  501. handler.on("GetTextContent", function wphExtractText(data, sink) {
  502. var pageIndex = data.pageIndex;
  503. sink.onPull = function (desiredSize) {};
  504. sink.onCancel = function (reason) {};
  505. pdfManager.getPage(pageIndex).then(function (page) {
  506. var task = new WorkerTask("GetTextContent: page " + pageIndex);
  507. startWorkerTask(task);
  508. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  509. page.extractTextContent({
  510. handler,
  511. task,
  512. sink,
  513. normalizeWhitespace: data.normalizeWhitespace,
  514. combineTextItems: data.combineTextItems
  515. }).then(function () {
  516. finishWorkerTask(task);
  517. if (start) {
  518. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  519. }
  520. sink.close();
  521. }, function (reason) {
  522. finishWorkerTask(task);
  523. if (task.terminated) {
  524. return;
  525. }
  526. sink.error(reason);
  527. });
  528. });
  529. });
  530. handler.on("FontFallback", function (data) {
  531. return pdfManager.fontFallback(data.id, handler);
  532. });
  533. handler.on("Cleanup", function wphCleanup(data) {
  534. return pdfManager.cleanup();
  535. });
  536. handler.on("Terminate", function wphTerminate(data) {
  537. terminated = true;
  538. const waitOn = [];
  539. if (pdfManager) {
  540. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  541. const cleanupPromise = pdfManager.cleanup();
  542. waitOn.push(cleanupPromise);
  543. pdfManager = null;
  544. } else {
  545. (0, _primitives.clearPrimitiveCaches)();
  546. }
  547. if (cancelXHRs) {
  548. cancelXHRs(new _util.AbortException("Worker was terminated."));
  549. }
  550. WorkerTasks.forEach(function (task) {
  551. waitOn.push(task.finished);
  552. task.terminate();
  553. });
  554. return Promise.all(waitOn).then(function () {
  555. handler.destroy();
  556. handler = null;
  557. });
  558. });
  559. handler.on("Ready", function wphReady(data) {
  560. setupDoc(docParams);
  561. docParams = null;
  562. });
  563. return workerHandlerName;
  564. },
  565. initializeFromPort(port) {
  566. var handler = new _message_handler.MessageHandler("worker", "main", port);
  567. WorkerMessageHandler.setup(handler, port);
  568. handler.send("ready", null);
  569. }
  570. };
  571. exports.WorkerMessageHandler = WorkerMessageHandler;
  572. function isMessagePort(maybePort) {
  573. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  574. }
  575. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  576. WorkerMessageHandler.initializeFromPort(self);
  577. }
  578. /***/ }),
  579. /* 2 */
  580. /***/ (function(module, exports, __w_pdfjs_require__) {
  581. "use strict";
  582. Object.defineProperty(exports, "__esModule", {
  583. value: true
  584. });
  585. exports.arrayByteLength = arrayByteLength;
  586. exports.arraysToBytes = arraysToBytes;
  587. exports.assert = assert;
  588. exports.bytesToString = bytesToString;
  589. exports.createPromiseCapability = createPromiseCapability;
  590. exports.getVerbosityLevel = getVerbosityLevel;
  591. exports.info = info;
  592. exports.isArrayBuffer = isArrayBuffer;
  593. exports.isArrayEqual = isArrayEqual;
  594. exports.isBool = isBool;
  595. exports.isEmptyObj = isEmptyObj;
  596. exports.isNum = isNum;
  597. exports.isString = isString;
  598. exports.isSameOrigin = isSameOrigin;
  599. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  600. exports.removeNullCharacters = removeNullCharacters;
  601. exports.setVerbosityLevel = setVerbosityLevel;
  602. exports.shadow = shadow;
  603. exports.string32 = string32;
  604. exports.stringToBytes = stringToBytes;
  605. exports.stringToPDFString = stringToPDFString;
  606. exports.stringToUTF8String = stringToUTF8String;
  607. exports.utf8StringToString = utf8StringToString;
  608. exports.warn = warn;
  609. exports.unreachable = unreachable;
  610. 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.NativeImageDecoding = 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;
  611. __w_pdfjs_require__(3);
  612. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  613. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  614. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  615. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  616. const NativeImageDecoding = {
  617. NONE: "none",
  618. DECODE: "decode",
  619. DISPLAY: "display"
  620. };
  621. exports.NativeImageDecoding = NativeImageDecoding;
  622. const PermissionFlag = {
  623. PRINT: 0x04,
  624. MODIFY_CONTENTS: 0x08,
  625. COPY: 0x10,
  626. MODIFY_ANNOTATIONS: 0x20,
  627. FILL_INTERACTIVE_FORMS: 0x100,
  628. COPY_FOR_ACCESSIBILITY: 0x200,
  629. ASSEMBLE: 0x400,
  630. PRINT_HIGH_QUALITY: 0x800
  631. };
  632. exports.PermissionFlag = PermissionFlag;
  633. const TextRenderingMode = {
  634. FILL: 0,
  635. STROKE: 1,
  636. FILL_STROKE: 2,
  637. INVISIBLE: 3,
  638. FILL_ADD_TO_PATH: 4,
  639. STROKE_ADD_TO_PATH: 5,
  640. FILL_STROKE_ADD_TO_PATH: 6,
  641. ADD_TO_PATH: 7,
  642. FILL_STROKE_MASK: 3,
  643. ADD_TO_PATH_FLAG: 4
  644. };
  645. exports.TextRenderingMode = TextRenderingMode;
  646. const ImageKind = {
  647. GRAYSCALE_1BPP: 1,
  648. RGB_24BPP: 2,
  649. RGBA_32BPP: 3
  650. };
  651. exports.ImageKind = ImageKind;
  652. const AnnotationType = {
  653. TEXT: 1,
  654. LINK: 2,
  655. FREETEXT: 3,
  656. LINE: 4,
  657. SQUARE: 5,
  658. CIRCLE: 6,
  659. POLYGON: 7,
  660. POLYLINE: 8,
  661. HIGHLIGHT: 9,
  662. UNDERLINE: 10,
  663. SQUIGGLY: 11,
  664. STRIKEOUT: 12,
  665. STAMP: 13,
  666. CARET: 14,
  667. INK: 15,
  668. POPUP: 16,
  669. FILEATTACHMENT: 17,
  670. SOUND: 18,
  671. MOVIE: 19,
  672. WIDGET: 20,
  673. SCREEN: 21,
  674. PRINTERMARK: 22,
  675. TRAPNET: 23,
  676. WATERMARK: 24,
  677. THREED: 25,
  678. REDACT: 26
  679. };
  680. exports.AnnotationType = AnnotationType;
  681. const AnnotationStateModelType = {
  682. MARKED: "Marked",
  683. REVIEW: "Review"
  684. };
  685. exports.AnnotationStateModelType = AnnotationStateModelType;
  686. const AnnotationMarkedState = {
  687. MARKED: "Marked",
  688. UNMARKED: "Unmarked"
  689. };
  690. exports.AnnotationMarkedState = AnnotationMarkedState;
  691. const AnnotationReviewState = {
  692. ACCEPTED: "Accepted",
  693. REJECTED: "Rejected",
  694. CANCELLED: "Cancelled",
  695. COMPLETED: "Completed",
  696. NONE: "None"
  697. };
  698. exports.AnnotationReviewState = AnnotationReviewState;
  699. const AnnotationReplyType = {
  700. GROUP: "Group",
  701. REPLY: "R"
  702. };
  703. exports.AnnotationReplyType = AnnotationReplyType;
  704. const AnnotationFlag = {
  705. INVISIBLE: 0x01,
  706. HIDDEN: 0x02,
  707. PRINT: 0x04,
  708. NOZOOM: 0x08,
  709. NOROTATE: 0x10,
  710. NOVIEW: 0x20,
  711. READONLY: 0x40,
  712. LOCKED: 0x80,
  713. TOGGLENOVIEW: 0x100,
  714. LOCKEDCONTENTS: 0x200
  715. };
  716. exports.AnnotationFlag = AnnotationFlag;
  717. const AnnotationFieldFlag = {
  718. READONLY: 0x0000001,
  719. REQUIRED: 0x0000002,
  720. NOEXPORT: 0x0000004,
  721. MULTILINE: 0x0001000,
  722. PASSWORD: 0x0002000,
  723. NOTOGGLETOOFF: 0x0004000,
  724. RADIO: 0x0008000,
  725. PUSHBUTTON: 0x0010000,
  726. COMBO: 0x0020000,
  727. EDIT: 0x0040000,
  728. SORT: 0x0080000,
  729. FILESELECT: 0x0100000,
  730. MULTISELECT: 0x0200000,
  731. DONOTSPELLCHECK: 0x0400000,
  732. DONOTSCROLL: 0x0800000,
  733. COMB: 0x1000000,
  734. RICHTEXT: 0x2000000,
  735. RADIOSINUNISON: 0x2000000,
  736. COMMITONSELCHANGE: 0x4000000
  737. };
  738. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  739. const AnnotationBorderStyleType = {
  740. SOLID: 1,
  741. DASHED: 2,
  742. BEVELED: 3,
  743. INSET: 4,
  744. UNDERLINE: 5
  745. };
  746. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  747. const StreamType = {
  748. UNKNOWN: "UNKNOWN",
  749. FLATE: "FLATE",
  750. LZW: "LZW",
  751. DCT: "DCT",
  752. JPX: "JPX",
  753. JBIG: "JBIG",
  754. A85: "A85",
  755. AHX: "AHX",
  756. CCF: "CCF",
  757. RLX: "RLX"
  758. };
  759. exports.StreamType = StreamType;
  760. const FontType = {
  761. UNKNOWN: "UNKNOWN",
  762. TYPE1: "TYPE1",
  763. TYPE1C: "TYPE1C",
  764. CIDFONTTYPE0: "CIDFONTTYPE0",
  765. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  766. TRUETYPE: "TRUETYPE",
  767. CIDFONTTYPE2: "CIDFONTTYPE2",
  768. TYPE3: "TYPE3",
  769. OPENTYPE: "OPENTYPE",
  770. TYPE0: "TYPE0",
  771. MMTYPE1: "MMTYPE1"
  772. };
  773. exports.FontType = FontType;
  774. const VerbosityLevel = {
  775. ERRORS: 0,
  776. WARNINGS: 1,
  777. INFOS: 5
  778. };
  779. exports.VerbosityLevel = VerbosityLevel;
  780. const CMapCompressionType = {
  781. NONE: 0,
  782. BINARY: 1,
  783. STREAM: 2
  784. };
  785. exports.CMapCompressionType = CMapCompressionType;
  786. const OPS = {
  787. dependency: 1,
  788. setLineWidth: 2,
  789. setLineCap: 3,
  790. setLineJoin: 4,
  791. setMiterLimit: 5,
  792. setDash: 6,
  793. setRenderingIntent: 7,
  794. setFlatness: 8,
  795. setGState: 9,
  796. save: 10,
  797. restore: 11,
  798. transform: 12,
  799. moveTo: 13,
  800. lineTo: 14,
  801. curveTo: 15,
  802. curveTo2: 16,
  803. curveTo3: 17,
  804. closePath: 18,
  805. rectangle: 19,
  806. stroke: 20,
  807. closeStroke: 21,
  808. fill: 22,
  809. eoFill: 23,
  810. fillStroke: 24,
  811. eoFillStroke: 25,
  812. closeFillStroke: 26,
  813. closeEOFillStroke: 27,
  814. endPath: 28,
  815. clip: 29,
  816. eoClip: 30,
  817. beginText: 31,
  818. endText: 32,
  819. setCharSpacing: 33,
  820. setWordSpacing: 34,
  821. setHScale: 35,
  822. setLeading: 36,
  823. setFont: 37,
  824. setTextRenderingMode: 38,
  825. setTextRise: 39,
  826. moveText: 40,
  827. setLeadingMoveText: 41,
  828. setTextMatrix: 42,
  829. nextLine: 43,
  830. showText: 44,
  831. showSpacedText: 45,
  832. nextLineShowText: 46,
  833. nextLineSetSpacingShowText: 47,
  834. setCharWidth: 48,
  835. setCharWidthAndBounds: 49,
  836. setStrokeColorSpace: 50,
  837. setFillColorSpace: 51,
  838. setStrokeColor: 52,
  839. setStrokeColorN: 53,
  840. setFillColor: 54,
  841. setFillColorN: 55,
  842. setStrokeGray: 56,
  843. setFillGray: 57,
  844. setStrokeRGBColor: 58,
  845. setFillRGBColor: 59,
  846. setStrokeCMYKColor: 60,
  847. setFillCMYKColor: 61,
  848. shadingFill: 62,
  849. beginInlineImage: 63,
  850. beginImageData: 64,
  851. endInlineImage: 65,
  852. paintXObject: 66,
  853. markPoint: 67,
  854. markPointProps: 68,
  855. beginMarkedContent: 69,
  856. beginMarkedContentProps: 70,
  857. endMarkedContent: 71,
  858. beginCompat: 72,
  859. endCompat: 73,
  860. paintFormXObjectBegin: 74,
  861. paintFormXObjectEnd: 75,
  862. beginGroup: 76,
  863. endGroup: 77,
  864. beginAnnotations: 78,
  865. endAnnotations: 79,
  866. beginAnnotation: 80,
  867. endAnnotation: 81,
  868. paintJpegXObject: 82,
  869. paintImageMaskXObject: 83,
  870. paintImageMaskXObjectGroup: 84,
  871. paintImageXObject: 85,
  872. paintInlineImageXObject: 86,
  873. paintInlineImageXObjectGroup: 87,
  874. paintImageXObjectRepeat: 88,
  875. paintImageMaskXObjectRepeat: 89,
  876. paintSolidColorImageMask: 90,
  877. constructPath: 91
  878. };
  879. exports.OPS = OPS;
  880. const UNSUPPORTED_FEATURES = {
  881. unknown: "unknown",
  882. forms: "forms",
  883. javaScript: "javaScript",
  884. smask: "smask",
  885. shadingPattern: "shadingPattern",
  886. font: "font"
  887. };
  888. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  889. const PasswordResponses = {
  890. NEED_PASSWORD: 1,
  891. INCORRECT_PASSWORD: 2
  892. };
  893. exports.PasswordResponses = PasswordResponses;
  894. let verbosity = VerbosityLevel.WARNINGS;
  895. function setVerbosityLevel(level) {
  896. if (Number.isInteger(level)) {
  897. verbosity = level;
  898. }
  899. }
  900. function getVerbosityLevel() {
  901. return verbosity;
  902. }
  903. function info(msg) {
  904. if (verbosity >= VerbosityLevel.INFOS) {
  905. console.log(`Info: ${msg}`);
  906. }
  907. }
  908. function warn(msg) {
  909. if (verbosity >= VerbosityLevel.WARNINGS) {
  910. console.log(`Warning: ${msg}`);
  911. }
  912. }
  913. function unreachable(msg) {
  914. throw new Error(msg);
  915. }
  916. function assert(cond, msg) {
  917. if (!cond) {
  918. unreachable(msg);
  919. }
  920. }
  921. function isSameOrigin(baseUrl, otherUrl) {
  922. let base;
  923. try {
  924. base = new URL(baseUrl);
  925. if (!base.origin || base.origin === "null") {
  926. return false;
  927. }
  928. } catch (e) {
  929. return false;
  930. }
  931. const other = new URL(otherUrl, base);
  932. return base.origin === other.origin;
  933. }
  934. function _isValidProtocol(url) {
  935. if (!url) {
  936. return false;
  937. }
  938. switch (url.protocol) {
  939. case "http:":
  940. case "https:":
  941. case "ftp:":
  942. case "mailto:":
  943. case "tel:":
  944. return true;
  945. default:
  946. return false;
  947. }
  948. }
  949. function createValidAbsoluteUrl(url, baseUrl) {
  950. if (!url) {
  951. return null;
  952. }
  953. try {
  954. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  955. if (_isValidProtocol(absoluteUrl)) {
  956. return absoluteUrl;
  957. }
  958. } catch (ex) {}
  959. return null;
  960. }
  961. function shadow(obj, prop, value) {
  962. Object.defineProperty(obj, prop, {
  963. value,
  964. enumerable: true,
  965. configurable: true,
  966. writable: false
  967. });
  968. return value;
  969. }
  970. const BaseException = function BaseExceptionClosure() {
  971. function BaseException(message) {
  972. if (this.constructor === BaseException) {
  973. unreachable("Cannot initialize BaseException.");
  974. }
  975. this.message = message;
  976. this.name = this.constructor.name;
  977. }
  978. BaseException.prototype = new Error();
  979. BaseException.constructor = BaseException;
  980. return BaseException;
  981. }();
  982. exports.BaseException = BaseException;
  983. class PasswordException extends BaseException {
  984. constructor(msg, code) {
  985. super(msg);
  986. this.code = code;
  987. }
  988. }
  989. exports.PasswordException = PasswordException;
  990. class UnknownErrorException extends BaseException {
  991. constructor(msg, details) {
  992. super(msg);
  993. this.details = details;
  994. }
  995. }
  996. exports.UnknownErrorException = UnknownErrorException;
  997. class InvalidPDFException extends BaseException {}
  998. exports.InvalidPDFException = InvalidPDFException;
  999. class MissingPDFException extends BaseException {}
  1000. exports.MissingPDFException = MissingPDFException;
  1001. class UnexpectedResponseException extends BaseException {
  1002. constructor(msg, status) {
  1003. super(msg);
  1004. this.status = status;
  1005. }
  1006. }
  1007. exports.UnexpectedResponseException = UnexpectedResponseException;
  1008. class FormatError extends BaseException {}
  1009. exports.FormatError = FormatError;
  1010. class AbortException extends BaseException {}
  1011. exports.AbortException = AbortException;
  1012. const NullCharactersRegExp = /\x00/g;
  1013. function removeNullCharacters(str) {
  1014. if (typeof str !== "string") {
  1015. warn("The argument for removeNullCharacters must be a string.");
  1016. return str;
  1017. }
  1018. return str.replace(NullCharactersRegExp, "");
  1019. }
  1020. function bytesToString(bytes) {
  1021. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1022. const length = bytes.length;
  1023. const MAX_ARGUMENT_COUNT = 8192;
  1024. if (length < MAX_ARGUMENT_COUNT) {
  1025. return String.fromCharCode.apply(null, bytes);
  1026. }
  1027. const strBuf = [];
  1028. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1029. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1030. const chunk = bytes.subarray(i, chunkEnd);
  1031. strBuf.push(String.fromCharCode.apply(null, chunk));
  1032. }
  1033. return strBuf.join("");
  1034. }
  1035. function stringToBytes(str) {
  1036. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1037. const length = str.length;
  1038. const bytes = new Uint8Array(length);
  1039. for (let i = 0; i < length; ++i) {
  1040. bytes[i] = str.charCodeAt(i) & 0xff;
  1041. }
  1042. return bytes;
  1043. }
  1044. function arrayByteLength(arr) {
  1045. if (arr.length !== undefined) {
  1046. return arr.length;
  1047. }
  1048. assert(arr.byteLength !== undefined);
  1049. return arr.byteLength;
  1050. }
  1051. function arraysToBytes(arr) {
  1052. const length = arr.length;
  1053. if (length === 1 && arr[0] instanceof Uint8Array) {
  1054. return arr[0];
  1055. }
  1056. let resultLength = 0;
  1057. for (let i = 0; i < length; i++) {
  1058. resultLength += arrayByteLength(arr[i]);
  1059. }
  1060. let pos = 0;
  1061. const data = new Uint8Array(resultLength);
  1062. for (let i = 0; i < length; i++) {
  1063. let item = arr[i];
  1064. if (!(item instanceof Uint8Array)) {
  1065. if (typeof item === "string") {
  1066. item = stringToBytes(item);
  1067. } else {
  1068. item = new Uint8Array(item);
  1069. }
  1070. }
  1071. const itemLength = item.byteLength;
  1072. data.set(item, pos);
  1073. pos += itemLength;
  1074. }
  1075. return data;
  1076. }
  1077. function string32(value) {
  1078. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1079. }
  1080. function isLittleEndian() {
  1081. const buffer8 = new Uint8Array(4);
  1082. buffer8[0] = 1;
  1083. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1084. return view32[0] === 1;
  1085. }
  1086. const IsLittleEndianCached = {
  1087. get value() {
  1088. return shadow(this, "value", isLittleEndian());
  1089. }
  1090. };
  1091. exports.IsLittleEndianCached = IsLittleEndianCached;
  1092. function isEvalSupported() {
  1093. try {
  1094. new Function("");
  1095. return true;
  1096. } catch (e) {
  1097. return false;
  1098. }
  1099. }
  1100. const IsEvalSupportedCached = {
  1101. get value() {
  1102. return shadow(this, "value", isEvalSupported());
  1103. }
  1104. };
  1105. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1106. const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
  1107. class Util {
  1108. static makeCssRgb(r, g, b) {
  1109. rgbBuf[1] = r;
  1110. rgbBuf[3] = g;
  1111. rgbBuf[5] = b;
  1112. return rgbBuf.join("");
  1113. }
  1114. static transform(m1, m2) {
  1115. 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]];
  1116. }
  1117. static applyTransform(p, m) {
  1118. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1119. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1120. return [xt, yt];
  1121. }
  1122. static applyInverseTransform(p, m) {
  1123. const d = m[0] * m[3] - m[1] * m[2];
  1124. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1125. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1126. return [xt, yt];
  1127. }
  1128. static getAxialAlignedBoundingBox(r, m) {
  1129. const p1 = Util.applyTransform(r, m);
  1130. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1131. const p3 = Util.applyTransform([r[0], r[3]], m);
  1132. const p4 = Util.applyTransform([r[2], r[1]], m);
  1133. 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])];
  1134. }
  1135. static inverseTransform(m) {
  1136. const d = m[0] * m[3] - m[1] * m[2];
  1137. 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];
  1138. }
  1139. static apply3dTransform(m, v) {
  1140. 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]];
  1141. }
  1142. static singularValueDecompose2dScale(m) {
  1143. const transpose = [m[0], m[2], m[1], m[3]];
  1144. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1145. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1146. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1147. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1148. const first = (a + d) / 2;
  1149. const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  1150. const sx = first + second || 1;
  1151. const sy = first - second || 1;
  1152. return [Math.sqrt(sx), Math.sqrt(sy)];
  1153. }
  1154. static normalizeRect(rect) {
  1155. const r = rect.slice(0);
  1156. if (rect[0] > rect[2]) {
  1157. r[0] = rect[2];
  1158. r[2] = rect[0];
  1159. }
  1160. if (rect[1] > rect[3]) {
  1161. r[1] = rect[3];
  1162. r[3] = rect[1];
  1163. }
  1164. return r;
  1165. }
  1166. static intersect(rect1, rect2) {
  1167. function compare(a, b) {
  1168. return a - b;
  1169. }
  1170. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1171. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1172. const result = [];
  1173. rect1 = Util.normalizeRect(rect1);
  1174. rect2 = Util.normalizeRect(rect2);
  1175. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1176. result[0] = orderedX[1];
  1177. result[2] = orderedX[2];
  1178. } else {
  1179. return null;
  1180. }
  1181. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1182. result[1] = orderedY[1];
  1183. result[3] = orderedY[2];
  1184. } else {
  1185. return null;
  1186. }
  1187. return result;
  1188. }
  1189. }
  1190. exports.Util = Util;
  1191. const 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];
  1192. function stringToPDFString(str) {
  1193. const length = str.length,
  1194. strBuf = [];
  1195. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1196. for (let i = 2; i < length; i += 2) {
  1197. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1198. }
  1199. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1200. for (let i = 2; i < length; i += 2) {
  1201. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1202. }
  1203. } else {
  1204. for (let i = 0; i < length; ++i) {
  1205. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1206. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1207. }
  1208. }
  1209. return strBuf.join("");
  1210. }
  1211. function stringToUTF8String(str) {
  1212. return decodeURIComponent(escape(str));
  1213. }
  1214. function utf8StringToString(str) {
  1215. return unescape(encodeURIComponent(str));
  1216. }
  1217. function isEmptyObj(obj) {
  1218. for (const key in obj) {
  1219. return false;
  1220. }
  1221. return true;
  1222. }
  1223. function isBool(v) {
  1224. return typeof v === "boolean";
  1225. }
  1226. function isNum(v) {
  1227. return typeof v === "number";
  1228. }
  1229. function isString(v) {
  1230. return typeof v === "string";
  1231. }
  1232. function isArrayBuffer(v) {
  1233. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1234. }
  1235. function isArrayEqual(arr1, arr2) {
  1236. if (arr1.length !== arr2.length) {
  1237. return false;
  1238. }
  1239. return arr1.every(function (element, index) {
  1240. return element === arr2[index];
  1241. });
  1242. }
  1243. function createPromiseCapability() {
  1244. const capability = Object.create(null);
  1245. let isSettled = false;
  1246. Object.defineProperty(capability, "settled", {
  1247. get() {
  1248. return isSettled;
  1249. }
  1250. });
  1251. capability.promise = new Promise(function (resolve, reject) {
  1252. capability.resolve = function (data) {
  1253. isSettled = true;
  1254. resolve(data);
  1255. };
  1256. capability.reject = function (reason) {
  1257. isSettled = true;
  1258. reject(reason);
  1259. };
  1260. });
  1261. return capability;
  1262. }
  1263. const createObjectURL = function createObjectURLClosure() {
  1264. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1265. return function createObjectURL(data, contentType, forceDataSchema = false) {
  1266. if (!forceDataSchema && URL.createObjectURL) {
  1267. const blob = new Blob([data], {
  1268. type: contentType
  1269. });
  1270. return URL.createObjectURL(blob);
  1271. }
  1272. let buffer = `data:${contentType};base64,`;
  1273. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1274. const b1 = data[i] & 0xff;
  1275. const b2 = data[i + 1] & 0xff;
  1276. const b3 = data[i + 2] & 0xff;
  1277. const d1 = b1 >> 2,
  1278. d2 = (b1 & 3) << 4 | b2 >> 4;
  1279. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1280. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1281. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1282. }
  1283. return buffer;
  1284. };
  1285. }();
  1286. exports.createObjectURL = createObjectURL;
  1287. /***/ }),
  1288. /* 3 */
  1289. /***/ (function(module, exports, __w_pdfjs_require__) {
  1290. "use strict";
  1291. ;
  1292. /***/ }),
  1293. /* 4 */
  1294. /***/ (function(module, exports, __w_pdfjs_require__) {
  1295. "use strict";
  1296. Object.defineProperty(exports, "__esModule", {
  1297. value: true
  1298. });
  1299. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1300. exports.isEOF = isEOF;
  1301. exports.isCmd = isCmd;
  1302. exports.isDict = isDict;
  1303. exports.isName = isName;
  1304. exports.isRef = isRef;
  1305. exports.isRefsEqual = isRefsEqual;
  1306. exports.isStream = isStream;
  1307. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0;
  1308. var _util = __w_pdfjs_require__(2);
  1309. var EOF = {};
  1310. exports.EOF = EOF;
  1311. var Name = function NameClosure() {
  1312. let nameCache = Object.create(null);
  1313. function Name(name) {
  1314. this.name = name;
  1315. }
  1316. Name.prototype = {};
  1317. Name.get = function Name_get(name) {
  1318. var nameValue = nameCache[name];
  1319. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1320. };
  1321. Name._clearCache = function () {
  1322. nameCache = Object.create(null);
  1323. };
  1324. return Name;
  1325. }();
  1326. exports.Name = Name;
  1327. var Cmd = function CmdClosure() {
  1328. let cmdCache = Object.create(null);
  1329. function Cmd(cmd) {
  1330. this.cmd = cmd;
  1331. }
  1332. Cmd.prototype = {};
  1333. Cmd.get = function Cmd_get(cmd) {
  1334. var cmdValue = cmdCache[cmd];
  1335. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1336. };
  1337. Cmd._clearCache = function () {
  1338. cmdCache = Object.create(null);
  1339. };
  1340. return Cmd;
  1341. }();
  1342. exports.Cmd = Cmd;
  1343. var Dict = function DictClosure() {
  1344. var nonSerializable = function nonSerializableClosure() {
  1345. return nonSerializable;
  1346. };
  1347. function Dict(xref) {
  1348. this._map = Object.create(null);
  1349. this.xref = xref;
  1350. this.objId = null;
  1351. this.suppressEncryption = false;
  1352. this.__nonSerializable__ = nonSerializable;
  1353. }
  1354. Dict.prototype = {
  1355. assignXref: function Dict_assignXref(newXref) {
  1356. this.xref = newXref;
  1357. },
  1358. get(key1, key2, key3) {
  1359. let value = this._map[key1];
  1360. if (value === undefined && key2 !== undefined) {
  1361. value = this._map[key2];
  1362. if (value === undefined && key3 !== undefined) {
  1363. value = this._map[key3];
  1364. }
  1365. }
  1366. if (value instanceof Ref && this.xref) {
  1367. return this.xref.fetch(value, this.suppressEncryption);
  1368. }
  1369. return value;
  1370. },
  1371. async getAsync(key1, key2, key3) {
  1372. let value = this._map[key1];
  1373. if (value === undefined && key2 !== undefined) {
  1374. value = this._map[key2];
  1375. if (value === undefined && key3 !== undefined) {
  1376. value = this._map[key3];
  1377. }
  1378. }
  1379. if (value instanceof Ref && this.xref) {
  1380. return this.xref.fetchAsync(value, this.suppressEncryption);
  1381. }
  1382. return value;
  1383. },
  1384. getArray(key1, key2, key3) {
  1385. let value = this.get(key1, key2, key3);
  1386. if (!Array.isArray(value) || !this.xref) {
  1387. return value;
  1388. }
  1389. value = value.slice();
  1390. for (let i = 0, ii = value.length; i < ii; i++) {
  1391. if (!(value[i] instanceof Ref)) {
  1392. continue;
  1393. }
  1394. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1395. }
  1396. return value;
  1397. },
  1398. getRaw: function Dict_getRaw(key) {
  1399. return this._map[key];
  1400. },
  1401. getKeys: function Dict_getKeys() {
  1402. return Object.keys(this._map);
  1403. },
  1404. set: function Dict_set(key, value) {
  1405. this._map[key] = value;
  1406. },
  1407. has: function Dict_has(key) {
  1408. return this._map[key] !== undefined;
  1409. },
  1410. forEach: function Dict_forEach(callback) {
  1411. for (var key in this._map) {
  1412. callback(key, this.get(key));
  1413. }
  1414. }
  1415. };
  1416. Dict.empty = new Dict(null);
  1417. Dict.merge = function (xref, dictArray) {
  1418. const mergedDict = new Dict(xref);
  1419. for (let i = 0, ii = dictArray.length; i < ii; i++) {
  1420. const dict = dictArray[i];
  1421. if (!isDict(dict)) {
  1422. continue;
  1423. }
  1424. for (const keyName in dict._map) {
  1425. if (mergedDict._map[keyName] !== undefined) {
  1426. continue;
  1427. }
  1428. mergedDict._map[keyName] = dict._map[keyName];
  1429. }
  1430. }
  1431. return mergedDict;
  1432. };
  1433. return Dict;
  1434. }();
  1435. exports.Dict = Dict;
  1436. var Ref = function RefClosure() {
  1437. let refCache = Object.create(null);
  1438. function Ref(num, gen) {
  1439. this.num = num;
  1440. this.gen = gen;
  1441. }
  1442. Ref.prototype = {
  1443. toString: function Ref_toString() {
  1444. if (this.gen === 0) {
  1445. return `${this.num}R`;
  1446. }
  1447. return `${this.num}R${this.gen}`;
  1448. }
  1449. };
  1450. Ref.get = function (num, gen) {
  1451. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1452. const refValue = refCache[key];
  1453. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1454. };
  1455. Ref._clearCache = function () {
  1456. refCache = Object.create(null);
  1457. };
  1458. return Ref;
  1459. }();
  1460. exports.Ref = Ref;
  1461. var RefSet = function RefSetClosure() {
  1462. function RefSet() {
  1463. this.dict = Object.create(null);
  1464. }
  1465. RefSet.prototype = {
  1466. has: function RefSet_has(ref) {
  1467. return ref.toString() in this.dict;
  1468. },
  1469. put: function RefSet_put(ref) {
  1470. this.dict[ref.toString()] = true;
  1471. },
  1472. remove: function RefSet_remove(ref) {
  1473. delete this.dict[ref.toString()];
  1474. }
  1475. };
  1476. return RefSet;
  1477. }();
  1478. exports.RefSet = RefSet;
  1479. var RefSetCache = function RefSetCacheClosure() {
  1480. function RefSetCache() {
  1481. this.dict = Object.create(null);
  1482. }
  1483. RefSetCache.prototype = {
  1484. get: function RefSetCache_get(ref) {
  1485. return this.dict[ref.toString()];
  1486. },
  1487. has: function RefSetCache_has(ref) {
  1488. return ref.toString() in this.dict;
  1489. },
  1490. put: function RefSetCache_put(ref, obj) {
  1491. this.dict[ref.toString()] = obj;
  1492. },
  1493. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1494. this.dict[ref.toString()] = this.get(aliasRef);
  1495. },
  1496. forEach: function RefSetCache_forEach(callback) {
  1497. for (const i in this.dict) {
  1498. callback(this.dict[i]);
  1499. }
  1500. },
  1501. clear: function RefSetCache_clear() {
  1502. this.dict = Object.create(null);
  1503. }
  1504. };
  1505. return RefSetCache;
  1506. }();
  1507. exports.RefSetCache = RefSetCache;
  1508. function isEOF(v) {
  1509. return v === EOF;
  1510. }
  1511. function isName(v, name) {
  1512. return v instanceof Name && (name === undefined || v.name === name);
  1513. }
  1514. function isCmd(v, cmd) {
  1515. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1516. }
  1517. function isDict(v, type) {
  1518. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1519. }
  1520. function isRef(v) {
  1521. return v instanceof Ref;
  1522. }
  1523. function isRefsEqual(v1, v2) {
  1524. return v1.num === v2.num && v1.gen === v2.gen;
  1525. }
  1526. function isStream(v) {
  1527. return typeof v === "object" && v !== null && v.getBytes !== undefined;
  1528. }
  1529. function clearPrimitiveCaches() {
  1530. Cmd._clearCache();
  1531. Name._clearCache();
  1532. Ref._clearCache();
  1533. }
  1534. /***/ }),
  1535. /* 5 */
  1536. /***/ (function(module, exports, __w_pdfjs_require__) {
  1537. "use strict";
  1538. Object.defineProperty(exports, "__esModule", {
  1539. value: true
  1540. });
  1541. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1542. var _util = __w_pdfjs_require__(2);
  1543. var _chunked_stream = __w_pdfjs_require__(6);
  1544. var _core_utils = __w_pdfjs_require__(7);
  1545. var _document = __w_pdfjs_require__(8);
  1546. var _stream = __w_pdfjs_require__(11);
  1547. class BasePdfManager {
  1548. constructor() {
  1549. if (this.constructor === BasePdfManager) {
  1550. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1551. }
  1552. }
  1553. get docId() {
  1554. return this._docId;
  1555. }
  1556. get password() {
  1557. return this._password;
  1558. }
  1559. get docBaseUrl() {
  1560. let docBaseUrl = null;
  1561. if (this._docBaseUrl) {
  1562. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
  1563. if (absoluteUrl) {
  1564. docBaseUrl = absoluteUrl.href;
  1565. } else {
  1566. (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`);
  1567. }
  1568. }
  1569. return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
  1570. }
  1571. onLoadedStream() {
  1572. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1573. }
  1574. ensureDoc(prop, args) {
  1575. return this.ensure(this.pdfDocument, prop, args);
  1576. }
  1577. ensureXRef(prop, args) {
  1578. return this.ensure(this.pdfDocument.xref, prop, args);
  1579. }
  1580. ensureCatalog(prop, args) {
  1581. return this.ensure(this.pdfDocument.catalog, prop, args);
  1582. }
  1583. getPage(pageIndex) {
  1584. return this.pdfDocument.getPage(pageIndex);
  1585. }
  1586. fontFallback(id, handler) {
  1587. return this.pdfDocument.fontFallback(id, handler);
  1588. }
  1589. cleanup() {
  1590. return this.pdfDocument.cleanup();
  1591. }
  1592. async ensure(obj, prop, args) {
  1593. (0, _util.unreachable)("Abstract method `ensure` called");
  1594. }
  1595. requestRange(begin, end) {
  1596. (0, _util.unreachable)("Abstract method `requestRange` called");
  1597. }
  1598. requestLoadedStream() {
  1599. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1600. }
  1601. sendProgressiveData(chunk) {
  1602. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1603. }
  1604. updatePassword(password) {
  1605. this._password = password;
  1606. }
  1607. terminate(reason) {
  1608. (0, _util.unreachable)("Abstract method `terminate` called");
  1609. }
  1610. }
  1611. class LocalPdfManager extends BasePdfManager {
  1612. constructor(docId, data, password, evaluatorOptions, docBaseUrl) {
  1613. super();
  1614. this._docId = docId;
  1615. this._password = password;
  1616. this._docBaseUrl = docBaseUrl;
  1617. this.evaluatorOptions = evaluatorOptions;
  1618. const stream = new _stream.Stream(data);
  1619. this.pdfDocument = new _document.PDFDocument(this, stream);
  1620. this._loadedStreamPromise = Promise.resolve(stream);
  1621. }
  1622. async ensure(obj, prop, args) {
  1623. const value = obj[prop];
  1624. if (typeof value === "function") {
  1625. return value.apply(obj, args);
  1626. }
  1627. return value;
  1628. }
  1629. requestRange(begin, end) {
  1630. return Promise.resolve();
  1631. }
  1632. requestLoadedStream() {}
  1633. onLoadedStream() {
  1634. return this._loadedStreamPromise;
  1635. }
  1636. terminate(reason) {}
  1637. }
  1638. exports.LocalPdfManager = LocalPdfManager;
  1639. class NetworkPdfManager extends BasePdfManager {
  1640. constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  1641. super();
  1642. this._docId = docId;
  1643. this._password = args.password;
  1644. this._docBaseUrl = docBaseUrl;
  1645. this.msgHandler = args.msgHandler;
  1646. this.evaluatorOptions = evaluatorOptions;
  1647. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1648. msgHandler: args.msgHandler,
  1649. length: args.length,
  1650. disableAutoFetch: args.disableAutoFetch,
  1651. rangeChunkSize: args.rangeChunkSize
  1652. });
  1653. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1654. }
  1655. async ensure(obj, prop, args) {
  1656. try {
  1657. const value = obj[prop];
  1658. if (typeof value === "function") {
  1659. return value.apply(obj, args);
  1660. }
  1661. return value;
  1662. } catch (ex) {
  1663. if (!(ex instanceof _core_utils.MissingDataException)) {
  1664. throw ex;
  1665. }
  1666. await this.requestRange(ex.begin, ex.end);
  1667. return this.ensure(obj, prop, args);
  1668. }
  1669. }
  1670. requestRange(begin, end) {
  1671. return this.streamManager.requestRange(begin, end);
  1672. }
  1673. requestLoadedStream() {
  1674. this.streamManager.requestAllChunks();
  1675. }
  1676. sendProgressiveData(chunk) {
  1677. this.streamManager.onReceiveData({
  1678. chunk
  1679. });
  1680. }
  1681. onLoadedStream() {
  1682. return this.streamManager.onLoadedStream();
  1683. }
  1684. terminate(reason) {
  1685. this.streamManager.abort(reason);
  1686. }
  1687. }
  1688. exports.NetworkPdfManager = NetworkPdfManager;
  1689. /***/ }),
  1690. /* 6 */
  1691. /***/ (function(module, exports, __w_pdfjs_require__) {
  1692. "use strict";
  1693. Object.defineProperty(exports, "__esModule", {
  1694. value: true
  1695. });
  1696. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1697. var _util = __w_pdfjs_require__(2);
  1698. var _core_utils = __w_pdfjs_require__(7);
  1699. class ChunkedStream {
  1700. constructor(length, chunkSize, manager) {
  1701. this.bytes = new Uint8Array(length);
  1702. this.start = 0;
  1703. this.pos = 0;
  1704. this.end = length;
  1705. this.chunkSize = chunkSize;
  1706. this.loadedChunks = [];
  1707. this.numChunksLoaded = 0;
  1708. this.numChunks = Math.ceil(length / chunkSize);
  1709. this.manager = manager;
  1710. this.progressiveDataLength = 0;
  1711. this.lastSuccessfulEnsureByteChunk = -1;
  1712. }
  1713. getMissingChunks() {
  1714. const chunks = [];
  1715. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1716. if (!this.loadedChunks[chunk]) {
  1717. chunks.push(chunk);
  1718. }
  1719. }
  1720. return chunks;
  1721. }
  1722. getBaseStreams() {
  1723. return [this];
  1724. }
  1725. allChunksLoaded() {
  1726. return this.numChunksLoaded === this.numChunks;
  1727. }
  1728. onReceiveData(begin, chunk) {
  1729. const chunkSize = this.chunkSize;
  1730. if (begin % chunkSize !== 0) {
  1731. throw new Error(`Bad begin offset: ${begin}`);
  1732. }
  1733. const end = begin + chunk.byteLength;
  1734. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1735. throw new Error(`Bad end offset: ${end}`);
  1736. }
  1737. this.bytes.set(new Uint8Array(chunk), begin);
  1738. const beginChunk = Math.floor(begin / chunkSize);
  1739. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1740. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1741. if (!this.loadedChunks[curChunk]) {
  1742. this.loadedChunks[curChunk] = true;
  1743. ++this.numChunksLoaded;
  1744. }
  1745. }
  1746. }
  1747. onReceiveProgressiveData(data) {
  1748. let position = this.progressiveDataLength;
  1749. const beginChunk = Math.floor(position / this.chunkSize);
  1750. this.bytes.set(new Uint8Array(data), position);
  1751. position += data.byteLength;
  1752. this.progressiveDataLength = position;
  1753. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1754. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1755. if (!this.loadedChunks[curChunk]) {
  1756. this.loadedChunks[curChunk] = true;
  1757. ++this.numChunksLoaded;
  1758. }
  1759. }
  1760. }
  1761. ensureByte(pos) {
  1762. if (pos < this.progressiveDataLength) {
  1763. return;
  1764. }
  1765. const chunk = Math.floor(pos / this.chunkSize);
  1766. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1767. return;
  1768. }
  1769. if (!this.loadedChunks[chunk]) {
  1770. throw new _core_utils.MissingDataException(pos, pos + 1);
  1771. }
  1772. this.lastSuccessfulEnsureByteChunk = chunk;
  1773. }
  1774. ensureRange(begin, end) {
  1775. if (begin >= end) {
  1776. return;
  1777. }
  1778. if (end <= this.progressiveDataLength) {
  1779. return;
  1780. }
  1781. const chunkSize = this.chunkSize;
  1782. const beginChunk = Math.floor(begin / chunkSize);
  1783. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1784. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1785. if (!this.loadedChunks[chunk]) {
  1786. throw new _core_utils.MissingDataException(begin, end);
  1787. }
  1788. }
  1789. }
  1790. nextEmptyChunk(beginChunk) {
  1791. const numChunks = this.numChunks;
  1792. for (let i = 0; i < numChunks; ++i) {
  1793. const chunk = (beginChunk + i) % numChunks;
  1794. if (!this.loadedChunks[chunk]) {
  1795. return chunk;
  1796. }
  1797. }
  1798. return null;
  1799. }
  1800. hasChunk(chunk) {
  1801. return !!this.loadedChunks[chunk];
  1802. }
  1803. get length() {
  1804. return this.end - this.start;
  1805. }
  1806. get isEmpty() {
  1807. return this.length === 0;
  1808. }
  1809. getByte() {
  1810. const pos = this.pos;
  1811. if (pos >= this.end) {
  1812. return -1;
  1813. }
  1814. if (pos >= this.progressiveDataLength) {
  1815. this.ensureByte(pos);
  1816. }
  1817. return this.bytes[this.pos++];
  1818. }
  1819. getUint16() {
  1820. const b0 = this.getByte();
  1821. const b1 = this.getByte();
  1822. if (b0 === -1 || b1 === -1) {
  1823. return -1;
  1824. }
  1825. return (b0 << 8) + b1;
  1826. }
  1827. getInt32() {
  1828. const b0 = this.getByte();
  1829. const b1 = this.getByte();
  1830. const b2 = this.getByte();
  1831. const b3 = this.getByte();
  1832. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1833. }
  1834. getBytes(length, forceClamped = false) {
  1835. const bytes = this.bytes;
  1836. const pos = this.pos;
  1837. const strEnd = this.end;
  1838. if (!length) {
  1839. if (strEnd > this.progressiveDataLength) {
  1840. this.ensureRange(pos, strEnd);
  1841. }
  1842. const subarray = bytes.subarray(pos, strEnd);
  1843. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  1844. }
  1845. let end = pos + length;
  1846. if (end > strEnd) {
  1847. end = strEnd;
  1848. }
  1849. if (end > this.progressiveDataLength) {
  1850. this.ensureRange(pos, end);
  1851. }
  1852. this.pos = end;
  1853. const subarray = bytes.subarray(pos, end);
  1854. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  1855. }
  1856. peekByte() {
  1857. const peekedByte = this.getByte();
  1858. if (peekedByte !== -1) {
  1859. this.pos--;
  1860. }
  1861. return peekedByte;
  1862. }
  1863. peekBytes(length, forceClamped = false) {
  1864. const bytes = this.getBytes(length, forceClamped);
  1865. this.pos -= bytes.length;
  1866. return bytes;
  1867. }
  1868. getByteRange(begin, end) {
  1869. if (begin < 0) {
  1870. begin = 0;
  1871. }
  1872. if (end > this.end) {
  1873. end = this.end;
  1874. }
  1875. if (end > this.progressiveDataLength) {
  1876. this.ensureRange(begin, end);
  1877. }
  1878. return this.bytes.subarray(begin, end);
  1879. }
  1880. skip(n) {
  1881. if (!n) {
  1882. n = 1;
  1883. }
  1884. this.pos += n;
  1885. }
  1886. reset() {
  1887. this.pos = this.start;
  1888. }
  1889. moveStart() {
  1890. this.start = this.pos;
  1891. }
  1892. makeSubStream(start, length, dict) {
  1893. if (length) {
  1894. if (start + length > this.progressiveDataLength) {
  1895. this.ensureRange(start, start + length);
  1896. }
  1897. } else {
  1898. if (start >= this.progressiveDataLength) {
  1899. this.ensureByte(start);
  1900. }
  1901. }
  1902. function ChunkedStreamSubstream() {}
  1903. ChunkedStreamSubstream.prototype = Object.create(this);
  1904. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  1905. const chunkSize = this.chunkSize;
  1906. const beginChunk = Math.floor(this.start / chunkSize);
  1907. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  1908. const missingChunks = [];
  1909. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1910. if (!this.loadedChunks[chunk]) {
  1911. missingChunks.push(chunk);
  1912. }
  1913. }
  1914. return missingChunks;
  1915. };
  1916. ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
  1917. if (this.numChunksLoaded === this.numChunks) {
  1918. return true;
  1919. }
  1920. return this.getMissingChunks().length === 0;
  1921. };
  1922. const subStream = new ChunkedStreamSubstream();
  1923. subStream.pos = subStream.start = start;
  1924. subStream.end = start + length || this.end;
  1925. subStream.dict = dict;
  1926. return subStream;
  1927. }
  1928. }
  1929. exports.ChunkedStream = ChunkedStream;
  1930. class ChunkedStreamManager {
  1931. constructor(pdfNetworkStream, args) {
  1932. this.length = args.length;
  1933. this.chunkSize = args.rangeChunkSize;
  1934. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  1935. this.pdfNetworkStream = pdfNetworkStream;
  1936. this.disableAutoFetch = args.disableAutoFetch;
  1937. this.msgHandler = args.msgHandler;
  1938. this.currRequestId = 0;
  1939. this.chunksNeededByRequest = Object.create(null);
  1940. this.requestsByChunk = Object.create(null);
  1941. this.promisesByRequest = Object.create(null);
  1942. this.progressiveDataLength = 0;
  1943. this.aborted = false;
  1944. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  1945. }
  1946. onLoadedStream() {
  1947. return this._loadedStreamCapability.promise;
  1948. }
  1949. sendRequest(begin, end) {
  1950. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  1951. if (!rangeReader.isStreamingSupported) {
  1952. rangeReader.onProgress = this.onProgress.bind(this);
  1953. }
  1954. let chunks = [],
  1955. loaded = 0;
  1956. const promise = new Promise((resolve, reject) => {
  1957. const readChunk = chunk => {
  1958. try {
  1959. if (!chunk.done) {
  1960. const data = chunk.value;
  1961. chunks.push(data);
  1962. loaded += (0, _util.arrayByteLength)(data);
  1963. if (rangeReader.isStreamingSupported) {
  1964. this.onProgress({
  1965. loaded
  1966. });
  1967. }
  1968. rangeReader.read().then(readChunk, reject);
  1969. return;
  1970. }
  1971. const chunkData = (0, _util.arraysToBytes)(chunks);
  1972. chunks = null;
  1973. resolve(chunkData);
  1974. } catch (e) {
  1975. reject(e);
  1976. }
  1977. };
  1978. rangeReader.read().then(readChunk, reject);
  1979. });
  1980. promise.then(data => {
  1981. if (this.aborted) {
  1982. return;
  1983. }
  1984. this.onReceiveData({
  1985. chunk: data,
  1986. begin
  1987. });
  1988. });
  1989. }
  1990. requestAllChunks() {
  1991. const missingChunks = this.stream.getMissingChunks();
  1992. this._requestChunks(missingChunks);
  1993. return this._loadedStreamCapability.promise;
  1994. }
  1995. _requestChunks(chunks) {
  1996. const requestId = this.currRequestId++;
  1997. const chunksNeeded = Object.create(null);
  1998. this.chunksNeededByRequest[requestId] = chunksNeeded;
  1999. for (const chunk of chunks) {
  2000. if (!this.stream.hasChunk(chunk)) {
  2001. chunksNeeded[chunk] = true;
  2002. }
  2003. }
  2004. if ((0, _util.isEmptyObj)(chunksNeeded)) {
  2005. return Promise.resolve();
  2006. }
  2007. const capability = (0, _util.createPromiseCapability)();
  2008. this.promisesByRequest[requestId] = capability;
  2009. const chunksToRequest = [];
  2010. for (let chunk in chunksNeeded) {
  2011. chunk = chunk | 0;
  2012. if (!(chunk in this.requestsByChunk)) {
  2013. this.requestsByChunk[chunk] = [];
  2014. chunksToRequest.push(chunk);
  2015. }
  2016. this.requestsByChunk[chunk].push(requestId);
  2017. }
  2018. if (!chunksToRequest.length) {
  2019. return capability.promise;
  2020. }
  2021. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2022. for (const groupedChunk of groupedChunksToRequest) {
  2023. const begin = groupedChunk.beginChunk * this.chunkSize;
  2024. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2025. this.sendRequest(begin, end);
  2026. }
  2027. return capability.promise;
  2028. }
  2029. getStream() {
  2030. return this.stream;
  2031. }
  2032. requestRange(begin, end) {
  2033. end = Math.min(end, this.length);
  2034. const beginChunk = this.getBeginChunk(begin);
  2035. const endChunk = this.getEndChunk(end);
  2036. const chunks = [];
  2037. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2038. chunks.push(chunk);
  2039. }
  2040. return this._requestChunks(chunks);
  2041. }
  2042. requestRanges(ranges = []) {
  2043. const chunksToRequest = [];
  2044. for (const range of ranges) {
  2045. const beginChunk = this.getBeginChunk(range.begin);
  2046. const endChunk = this.getEndChunk(range.end);
  2047. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2048. if (!chunksToRequest.includes(chunk)) {
  2049. chunksToRequest.push(chunk);
  2050. }
  2051. }
  2052. }
  2053. chunksToRequest.sort(function (a, b) {
  2054. return a - b;
  2055. });
  2056. return this._requestChunks(chunksToRequest);
  2057. }
  2058. groupChunks(chunks) {
  2059. const groupedChunks = [];
  2060. let beginChunk = -1;
  2061. let prevChunk = -1;
  2062. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2063. const chunk = chunks[i];
  2064. if (beginChunk < 0) {
  2065. beginChunk = chunk;
  2066. }
  2067. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2068. groupedChunks.push({
  2069. beginChunk,
  2070. endChunk: prevChunk + 1
  2071. });
  2072. beginChunk = chunk;
  2073. }
  2074. if (i + 1 === chunks.length) {
  2075. groupedChunks.push({
  2076. beginChunk,
  2077. endChunk: chunk + 1
  2078. });
  2079. }
  2080. prevChunk = chunk;
  2081. }
  2082. return groupedChunks;
  2083. }
  2084. onProgress(args) {
  2085. this.msgHandler.send("DocProgress", {
  2086. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2087. total: this.length
  2088. });
  2089. }
  2090. onReceiveData(args) {
  2091. const chunk = args.chunk;
  2092. const isProgressive = args.begin === undefined;
  2093. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2094. const end = begin + chunk.byteLength;
  2095. const beginChunk = Math.floor(begin / this.chunkSize);
  2096. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2097. if (isProgressive) {
  2098. this.stream.onReceiveProgressiveData(chunk);
  2099. this.progressiveDataLength = end;
  2100. } else {
  2101. this.stream.onReceiveData(begin, chunk);
  2102. }
  2103. if (this.stream.allChunksLoaded()) {
  2104. this._loadedStreamCapability.resolve(this.stream);
  2105. }
  2106. const loadedRequests = [];
  2107. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2108. const requestIds = this.requestsByChunk[chunk] || [];
  2109. delete this.requestsByChunk[chunk];
  2110. for (const requestId of requestIds) {
  2111. const chunksNeeded = this.chunksNeededByRequest[requestId];
  2112. if (chunk in chunksNeeded) {
  2113. delete chunksNeeded[chunk];
  2114. }
  2115. if (!(0, _util.isEmptyObj)(chunksNeeded)) {
  2116. continue;
  2117. }
  2118. loadedRequests.push(requestId);
  2119. }
  2120. }
  2121. if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
  2122. let nextEmptyChunk;
  2123. if (this.stream.numChunksLoaded === 1) {
  2124. const lastChunk = this.stream.numChunks - 1;
  2125. if (!this.stream.hasChunk(lastChunk)) {
  2126. nextEmptyChunk = lastChunk;
  2127. }
  2128. } else {
  2129. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2130. }
  2131. if (Number.isInteger(nextEmptyChunk)) {
  2132. this._requestChunks([nextEmptyChunk]);
  2133. }
  2134. }
  2135. for (const requestId of loadedRequests) {
  2136. const capability = this.promisesByRequest[requestId];
  2137. delete this.promisesByRequest[requestId];
  2138. capability.resolve();
  2139. }
  2140. this.msgHandler.send("DocProgress", {
  2141. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2142. total: this.length
  2143. });
  2144. }
  2145. onError(err) {
  2146. this._loadedStreamCapability.reject(err);
  2147. }
  2148. getBeginChunk(begin) {
  2149. return Math.floor(begin / this.chunkSize);
  2150. }
  2151. getEndChunk(end) {
  2152. return Math.floor((end - 1) / this.chunkSize) + 1;
  2153. }
  2154. abort(reason) {
  2155. this.aborted = true;
  2156. if (this.pdfNetworkStream) {
  2157. this.pdfNetworkStream.cancelAllRequests(reason);
  2158. }
  2159. for (const requestId in this.promisesByRequest) {
  2160. this.promisesByRequest[requestId].reject(reason);
  2161. }
  2162. }
  2163. }
  2164. exports.ChunkedStreamManager = ChunkedStreamManager;
  2165. /***/ }),
  2166. /* 7 */
  2167. /***/ (function(module, exports, __w_pdfjs_require__) {
  2168. "use strict";
  2169. Object.defineProperty(exports, "__esModule", {
  2170. value: true
  2171. });
  2172. exports.getLookupTableFactory = getLookupTableFactory;
  2173. exports.getInheritableProperty = getInheritableProperty;
  2174. exports.toRomanNumerals = toRomanNumerals;
  2175. exports.log2 = log2;
  2176. exports.readInt8 = readInt8;
  2177. exports.readUint16 = readUint16;
  2178. exports.readUint32 = readUint32;
  2179. exports.isWhiteSpace = isWhiteSpace;
  2180. exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
  2181. var _util = __w_pdfjs_require__(2);
  2182. function getLookupTableFactory(initializer) {
  2183. let lookup;
  2184. return function () {
  2185. if (initializer) {
  2186. lookup = Object.create(null);
  2187. initializer(lookup);
  2188. initializer = null;
  2189. }
  2190. return lookup;
  2191. };
  2192. }
  2193. class MissingDataException extends _util.BaseException {
  2194. constructor(begin, end) {
  2195. super(`Missing data [${begin}, ${end})`);
  2196. this.begin = begin;
  2197. this.end = end;
  2198. }
  2199. }
  2200. exports.MissingDataException = MissingDataException;
  2201. class XRefEntryException extends _util.BaseException {}
  2202. exports.XRefEntryException = XRefEntryException;
  2203. class XRefParseException extends _util.BaseException {}
  2204. exports.XRefParseException = XRefParseException;
  2205. function getInheritableProperty({
  2206. dict,
  2207. key,
  2208. getArray = false,
  2209. stopWhenFound = true
  2210. }) {
  2211. const LOOP_LIMIT = 100;
  2212. let loopCount = 0;
  2213. let values;
  2214. while (dict) {
  2215. const value = getArray ? dict.getArray(key) : dict.get(key);
  2216. if (value !== undefined) {
  2217. if (stopWhenFound) {
  2218. return value;
  2219. }
  2220. if (!values) {
  2221. values = [];
  2222. }
  2223. values.push(value);
  2224. }
  2225. if (++loopCount > LOOP_LIMIT) {
  2226. (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for "${key}"`);
  2227. break;
  2228. }
  2229. dict = dict.get("Parent");
  2230. }
  2231. return values;
  2232. }
  2233. const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  2234. function toRomanNumerals(number, lowerCase = false) {
  2235. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2236. const romanBuf = [];
  2237. let pos;
  2238. while (number >= 1000) {
  2239. number -= 1000;
  2240. romanBuf.push("M");
  2241. }
  2242. pos = number / 100 | 0;
  2243. number %= 100;
  2244. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2245. pos = number / 10 | 0;
  2246. number %= 10;
  2247. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2248. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2249. const romanStr = romanBuf.join("");
  2250. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2251. }
  2252. function log2(x) {
  2253. if (x <= 0) {
  2254. return 0;
  2255. }
  2256. return Math.ceil(Math.log2(x));
  2257. }
  2258. function readInt8(data, offset) {
  2259. return data[offset] << 24 >> 24;
  2260. }
  2261. function readUint16(data, offset) {
  2262. return data[offset] << 8 | data[offset + 1];
  2263. }
  2264. function readUint32(data, offset) {
  2265. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2266. }
  2267. function isWhiteSpace(ch) {
  2268. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2269. }
  2270. /***/ }),
  2271. /* 8 */
  2272. /***/ (function(module, exports, __w_pdfjs_require__) {
  2273. "use strict";
  2274. Object.defineProperty(exports, "__esModule", {
  2275. value: true
  2276. });
  2277. exports.PDFDocument = exports.Page = void 0;
  2278. var _util = __w_pdfjs_require__(2);
  2279. var _obj = __w_pdfjs_require__(9);
  2280. var _primitives = __w_pdfjs_require__(4);
  2281. var _core_utils = __w_pdfjs_require__(7);
  2282. var _stream = __w_pdfjs_require__(11);
  2283. var _annotation = __w_pdfjs_require__(23);
  2284. var _crypto = __w_pdfjs_require__(21);
  2285. var _parser = __w_pdfjs_require__(10);
  2286. var _operator_list = __w_pdfjs_require__(24);
  2287. var _evaluator = __w_pdfjs_require__(25);
  2288. var _function = __w_pdfjs_require__(39);
  2289. const DEFAULT_USER_UNIT = 1.0;
  2290. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2291. function isAnnotationRenderable(annotation, intent) {
  2292. return intent === "display" && annotation.viewable || intent === "print" && annotation.printable;
  2293. }
  2294. class Page {
  2295. constructor({
  2296. pdfManager,
  2297. xref,
  2298. pageIndex,
  2299. pageDict,
  2300. ref,
  2301. fontCache,
  2302. builtInCMapCache,
  2303. pdfFunctionFactory
  2304. }) {
  2305. this.pdfManager = pdfManager;
  2306. this.pageIndex = pageIndex;
  2307. this.pageDict = pageDict;
  2308. this.xref = xref;
  2309. this.ref = ref;
  2310. this.fontCache = fontCache;
  2311. this.builtInCMapCache = builtInCMapCache;
  2312. this.pdfFunctionFactory = pdfFunctionFactory;
  2313. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2314. this.resourcesPromise = null;
  2315. const idCounters = {
  2316. obj: 0
  2317. };
  2318. this.idFactory = {
  2319. createObjId() {
  2320. return `p${pageIndex}_${++idCounters.obj}`;
  2321. },
  2322. getDocId() {
  2323. return `g_${pdfManager.docId}`;
  2324. }
  2325. };
  2326. }
  2327. _getInheritableProperty(key, getArray = false) {
  2328. const value = (0, _core_utils.getInheritableProperty)({
  2329. dict: this.pageDict,
  2330. key,
  2331. getArray,
  2332. stopWhenFound: false
  2333. });
  2334. if (!Array.isArray(value)) {
  2335. return value;
  2336. }
  2337. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2338. return value[0];
  2339. }
  2340. return _primitives.Dict.merge(this.xref, value);
  2341. }
  2342. get content() {
  2343. return this.pageDict.get("Contents");
  2344. }
  2345. get resources() {
  2346. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2347. }
  2348. _getBoundingBox(name) {
  2349. const box = this._getInheritableProperty(name, true);
  2350. if (Array.isArray(box) && box.length === 4) {
  2351. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2352. return box;
  2353. }
  2354. (0, _util.warn)(`Empty /${name} entry.`);
  2355. }
  2356. return null;
  2357. }
  2358. get mediaBox() {
  2359. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2360. }
  2361. get cropBox() {
  2362. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2363. }
  2364. get userUnit() {
  2365. let obj = this.pageDict.get("UserUnit");
  2366. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2367. obj = DEFAULT_USER_UNIT;
  2368. }
  2369. return (0, _util.shadow)(this, "userUnit", obj);
  2370. }
  2371. get view() {
  2372. const {
  2373. cropBox,
  2374. mediaBox
  2375. } = this;
  2376. let view;
  2377. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2378. view = mediaBox;
  2379. } else {
  2380. const box = _util.Util.intersect(cropBox, mediaBox);
  2381. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2382. view = box;
  2383. } else {
  2384. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2385. }
  2386. }
  2387. return (0, _util.shadow)(this, "view", view || mediaBox);
  2388. }
  2389. get rotate() {
  2390. let rotate = this._getInheritableProperty("Rotate") || 0;
  2391. if (rotate % 90 !== 0) {
  2392. rotate = 0;
  2393. } else if (rotate >= 360) {
  2394. rotate = rotate % 360;
  2395. } else if (rotate < 0) {
  2396. rotate = (rotate % 360 + 360) % 360;
  2397. }
  2398. return (0, _util.shadow)(this, "rotate", rotate);
  2399. }
  2400. getContentStream() {
  2401. const content = this.content;
  2402. let stream;
  2403. if (Array.isArray(content)) {
  2404. const xref = this.xref;
  2405. const streams = [];
  2406. for (const stream of content) {
  2407. streams.push(xref.fetchIfRef(stream));
  2408. }
  2409. stream = new _stream.StreamsSequenceStream(streams);
  2410. } else if ((0, _primitives.isStream)(content)) {
  2411. stream = content;
  2412. } else {
  2413. stream = new _stream.NullStream();
  2414. }
  2415. return stream;
  2416. }
  2417. loadResources(keys) {
  2418. if (!this.resourcesPromise) {
  2419. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  2420. }
  2421. return this.resourcesPromise.then(() => {
  2422. const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
  2423. return objectLoader.load();
  2424. });
  2425. }
  2426. getOperatorList({
  2427. handler,
  2428. sink,
  2429. task,
  2430. intent,
  2431. renderInteractiveForms
  2432. }) {
  2433. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2434. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  2435. const partialEvaluator = new _evaluator.PartialEvaluator({
  2436. xref: this.xref,
  2437. handler,
  2438. pageIndex: this.pageIndex,
  2439. idFactory: this.idFactory,
  2440. fontCache: this.fontCache,
  2441. builtInCMapCache: this.builtInCMapCache,
  2442. options: this.evaluatorOptions,
  2443. pdfFunctionFactory: this.pdfFunctionFactory
  2444. });
  2445. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2446. const pageListPromise = dataPromises.then(([contentStream]) => {
  2447. const opList = new _operator_list.OperatorList(intent, sink, this.pageIndex);
  2448. handler.send("StartRenderPage", {
  2449. transparency: partialEvaluator.hasBlendModes(this.resources),
  2450. pageIndex: this.pageIndex,
  2451. intent
  2452. });
  2453. return partialEvaluator.getOperatorList({
  2454. stream: contentStream,
  2455. task,
  2456. resources: this.resources,
  2457. operatorList: opList
  2458. }).then(function () {
  2459. return opList;
  2460. });
  2461. });
  2462. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  2463. if (annotations.length === 0) {
  2464. pageOpList.flush(true);
  2465. return {
  2466. length: pageOpList.totalLength
  2467. };
  2468. }
  2469. const opListPromises = [];
  2470. for (const annotation of annotations) {
  2471. if (isAnnotationRenderable(annotation, intent)) {
  2472. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms));
  2473. }
  2474. }
  2475. return Promise.all(opListPromises).then(function (opLists) {
  2476. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  2477. for (const opList of opLists) {
  2478. pageOpList.addOpList(opList);
  2479. }
  2480. pageOpList.addOp(_util.OPS.endAnnotations, []);
  2481. pageOpList.flush(true);
  2482. return {
  2483. length: pageOpList.totalLength
  2484. };
  2485. });
  2486. });
  2487. }
  2488. extractTextContent({
  2489. handler,
  2490. task,
  2491. normalizeWhitespace,
  2492. sink,
  2493. combineTextItems
  2494. }) {
  2495. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2496. const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]);
  2497. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2498. return dataPromises.then(([contentStream]) => {
  2499. const partialEvaluator = new _evaluator.PartialEvaluator({
  2500. xref: this.xref,
  2501. handler,
  2502. pageIndex: this.pageIndex,
  2503. idFactory: this.idFactory,
  2504. fontCache: this.fontCache,
  2505. builtInCMapCache: this.builtInCMapCache,
  2506. options: this.evaluatorOptions,
  2507. pdfFunctionFactory: this.pdfFunctionFactory
  2508. });
  2509. return partialEvaluator.getTextContent({
  2510. stream: contentStream,
  2511. task,
  2512. resources: this.resources,
  2513. normalizeWhitespace,
  2514. combineTextItems,
  2515. sink
  2516. });
  2517. });
  2518. }
  2519. getAnnotationsData(intent) {
  2520. return this._parsedAnnotations.then(function (annotations) {
  2521. const annotationsData = [];
  2522. for (let i = 0, ii = annotations.length; i < ii; i++) {
  2523. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  2524. annotationsData.push(annotations[i].data);
  2525. }
  2526. }
  2527. return annotationsData;
  2528. });
  2529. }
  2530. get annotations() {
  2531. return (0, _util.shadow)(this, "annotations", this._getInheritableProperty("Annots") || []);
  2532. }
  2533. get _parsedAnnotations() {
  2534. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  2535. const annotationRefs = this.annotations;
  2536. const annotationPromises = [];
  2537. for (let i = 0, ii = annotationRefs.length; i < ii; i++) {
  2538. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRefs[i], this.pdfManager, this.idFactory));
  2539. }
  2540. return Promise.all(annotationPromises).then(function (annotations) {
  2541. return annotations.filter(function isDefined(annotation) {
  2542. return !!annotation;
  2543. });
  2544. }, function (reason) {
  2545. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  2546. return [];
  2547. });
  2548. });
  2549. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  2550. }
  2551. }
  2552. exports.Page = Page;
  2553. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  2554. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  2555. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  2556. const FINGERPRINT_FIRST_BYTES = 1024;
  2557. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  2558. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
  2559. function find(stream, signature, limit = 1024, backwards = false) {
  2560. const signatureLength = signature.length;
  2561. const scanBytes = stream.peekBytes(limit);
  2562. const scanLength = scanBytes.length - signatureLength;
  2563. if (scanLength <= 0) {
  2564. return false;
  2565. }
  2566. if (backwards) {
  2567. const signatureEnd = signatureLength - 1;
  2568. let pos = scanBytes.length - 1;
  2569. while (pos >= signatureEnd) {
  2570. let j = 0;
  2571. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  2572. j++;
  2573. }
  2574. if (j >= signatureLength) {
  2575. stream.pos += pos - signatureEnd;
  2576. return true;
  2577. }
  2578. pos--;
  2579. }
  2580. } else {
  2581. let pos = 0;
  2582. while (pos <= scanLength) {
  2583. let j = 0;
  2584. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  2585. j++;
  2586. }
  2587. if (j >= signatureLength) {
  2588. stream.pos += pos;
  2589. return true;
  2590. }
  2591. pos++;
  2592. }
  2593. }
  2594. return false;
  2595. }
  2596. class PDFDocument {
  2597. constructor(pdfManager, arg) {
  2598. let stream;
  2599. if ((0, _primitives.isStream)(arg)) {
  2600. stream = arg;
  2601. } else if ((0, _util.isArrayBuffer)(arg)) {
  2602. stream = new _stream.Stream(arg);
  2603. } else {
  2604. throw new Error("PDFDocument: Unknown argument type");
  2605. }
  2606. if (stream.length <= 0) {
  2607. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  2608. }
  2609. this.pdfManager = pdfManager;
  2610. this.stream = stream;
  2611. this.xref = new _obj.XRef(stream, pdfManager);
  2612. this.pdfFunctionFactory = new _function.PDFFunctionFactory({
  2613. xref: this.xref,
  2614. isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported
  2615. });
  2616. this._pagePromises = [];
  2617. }
  2618. parse(recoveryMode) {
  2619. this.setup(recoveryMode);
  2620. const version = this.catalog.catDict.get("Version");
  2621. if ((0, _primitives.isName)(version)) {
  2622. this.pdfFormatVersion = version.name;
  2623. }
  2624. try {
  2625. this.acroForm = this.catalog.catDict.get("AcroForm");
  2626. if (this.acroForm) {
  2627. this.xfa = this.acroForm.get("XFA");
  2628. const fields = this.acroForm.get("Fields");
  2629. if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
  2630. this.acroForm = null;
  2631. }
  2632. }
  2633. } catch (ex) {
  2634. if (ex instanceof _core_utils.MissingDataException) {
  2635. throw ex;
  2636. }
  2637. (0, _util.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present");
  2638. this.acroForm = null;
  2639. }
  2640. try {
  2641. const collection = this.catalog.catDict.get("Collection");
  2642. if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {
  2643. this.collection = collection;
  2644. }
  2645. } catch (ex) {
  2646. if (ex instanceof _core_utils.MissingDataException) {
  2647. throw ex;
  2648. }
  2649. (0, _util.info)("Cannot fetch Collection dictionary.");
  2650. }
  2651. }
  2652. get linearization() {
  2653. let linearization = null;
  2654. try {
  2655. linearization = _parser.Linearization.create(this.stream);
  2656. } catch (err) {
  2657. if (err instanceof _core_utils.MissingDataException) {
  2658. throw err;
  2659. }
  2660. (0, _util.info)(err);
  2661. }
  2662. return (0, _util.shadow)(this, "linearization", linearization);
  2663. }
  2664. get startXRef() {
  2665. const stream = this.stream;
  2666. let startXRef = 0;
  2667. if (this.linearization) {
  2668. stream.reset();
  2669. if (find(stream, ENDOBJ_SIGNATURE)) {
  2670. startXRef = stream.pos + 6 - stream.start;
  2671. }
  2672. } else {
  2673. const step = 1024;
  2674. const startXRefLength = STARTXREF_SIGNATURE.length;
  2675. let found = false,
  2676. pos = stream.end;
  2677. while (!found && pos > 0) {
  2678. pos -= step - startXRefLength;
  2679. if (pos < 0) {
  2680. pos = 0;
  2681. }
  2682. stream.pos = pos;
  2683. found = find(stream, STARTXREF_SIGNATURE, step, true);
  2684. }
  2685. if (found) {
  2686. stream.skip(9);
  2687. let ch;
  2688. do {
  2689. ch = stream.getByte();
  2690. } while ((0, _core_utils.isWhiteSpace)(ch));
  2691. let str = "";
  2692. while (ch >= 0x20 && ch <= 0x39) {
  2693. str += String.fromCharCode(ch);
  2694. ch = stream.getByte();
  2695. }
  2696. startXRef = parseInt(str, 10);
  2697. if (isNaN(startXRef)) {
  2698. startXRef = 0;
  2699. }
  2700. }
  2701. }
  2702. return (0, _util.shadow)(this, "startXRef", startXRef);
  2703. }
  2704. checkHeader() {
  2705. const stream = this.stream;
  2706. stream.reset();
  2707. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  2708. return;
  2709. }
  2710. stream.moveStart();
  2711. const MAX_PDF_VERSION_LENGTH = 12;
  2712. let version = "",
  2713. ch;
  2714. while ((ch = stream.getByte()) > 0x20) {
  2715. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  2716. break;
  2717. }
  2718. version += String.fromCharCode(ch);
  2719. }
  2720. if (!this.pdfFormatVersion) {
  2721. this.pdfFormatVersion = version.substring(5);
  2722. }
  2723. }
  2724. parseStartXRef() {
  2725. this.xref.setStartXRef(this.startXRef);
  2726. }
  2727. setup(recoveryMode) {
  2728. this.xref.parse(recoveryMode);
  2729. this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
  2730. }
  2731. get numPages() {
  2732. const linearization = this.linearization;
  2733. const num = linearization ? linearization.numPages : this.catalog.numPages;
  2734. return (0, _util.shadow)(this, "numPages", num);
  2735. }
  2736. get documentInfo() {
  2737. const DocumentInfoValidators = {
  2738. Title: _util.isString,
  2739. Author: _util.isString,
  2740. Subject: _util.isString,
  2741. Keywords: _util.isString,
  2742. Creator: _util.isString,
  2743. Producer: _util.isString,
  2744. CreationDate: _util.isString,
  2745. ModDate: _util.isString,
  2746. Trapped: _primitives.isName
  2747. };
  2748. let version = this.pdfFormatVersion;
  2749. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  2750. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  2751. version = null;
  2752. }
  2753. const docInfo = {
  2754. PDFFormatVersion: version,
  2755. IsLinearized: !!this.linearization,
  2756. IsAcroFormPresent: !!this.acroForm,
  2757. IsXFAPresent: !!this.xfa,
  2758. IsCollectionPresent: !!this.collection
  2759. };
  2760. let infoDict;
  2761. try {
  2762. infoDict = this.xref.trailer.get("Info");
  2763. } catch (err) {
  2764. if (err instanceof _core_utils.MissingDataException) {
  2765. throw err;
  2766. }
  2767. (0, _util.info)("The document information dictionary is invalid.");
  2768. }
  2769. if ((0, _primitives.isDict)(infoDict)) {
  2770. for (const key of infoDict.getKeys()) {
  2771. const value = infoDict.get(key);
  2772. if (DocumentInfoValidators[key]) {
  2773. if (DocumentInfoValidators[key](value)) {
  2774. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  2775. } else {
  2776. (0, _util.info)(`Bad value in document info for "${key}".`);
  2777. }
  2778. } else if (typeof key === "string") {
  2779. let customValue;
  2780. if ((0, _util.isString)(value)) {
  2781. customValue = (0, _util.stringToPDFString)(value);
  2782. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  2783. customValue = value;
  2784. } else {
  2785. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  2786. continue;
  2787. }
  2788. if (!docInfo["Custom"]) {
  2789. docInfo["Custom"] = Object.create(null);
  2790. }
  2791. docInfo["Custom"][key] = customValue;
  2792. }
  2793. }
  2794. }
  2795. return (0, _util.shadow)(this, "documentInfo", docInfo);
  2796. }
  2797. get fingerprint() {
  2798. let hash;
  2799. const idArray = this.xref.trailer.get("ID");
  2800. if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  2801. hash = (0, _util.stringToBytes)(idArray[0]);
  2802. } else {
  2803. hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  2804. }
  2805. const fingerprintBuf = [];
  2806. for (let i = 0, ii = hash.length; i < ii; i++) {
  2807. const hex = hash[i].toString(16);
  2808. fingerprintBuf.push(hex.padStart(2, "0"));
  2809. }
  2810. return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
  2811. }
  2812. _getLinearizationPage(pageIndex) {
  2813. const {
  2814. catalog,
  2815. linearization
  2816. } = this;
  2817. (0, _util.assert)(linearization && linearization.pageFirst === pageIndex);
  2818. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  2819. return this.xref.fetchAsync(ref).then(obj => {
  2820. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  2821. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  2822. catalog.pageKidsCountCache.put(ref, 1);
  2823. }
  2824. return [obj, ref];
  2825. }
  2826. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  2827. }).catch(reason => {
  2828. (0, _util.info)(reason);
  2829. return catalog.getPageDict(pageIndex);
  2830. });
  2831. }
  2832. getPage(pageIndex) {
  2833. if (this._pagePromises[pageIndex] !== undefined) {
  2834. return this._pagePromises[pageIndex];
  2835. }
  2836. const {
  2837. catalog,
  2838. linearization
  2839. } = this;
  2840. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  2841. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  2842. return new Page({
  2843. pdfManager: this.pdfManager,
  2844. xref: this.xref,
  2845. pageIndex,
  2846. pageDict,
  2847. ref,
  2848. fontCache: catalog.fontCache,
  2849. builtInCMapCache: catalog.builtInCMapCache,
  2850. pdfFunctionFactory: this.pdfFunctionFactory
  2851. });
  2852. });
  2853. }
  2854. checkFirstPage() {
  2855. return this.getPage(0).catch(async reason => {
  2856. if (reason instanceof _core_utils.XRefEntryException) {
  2857. this._pagePromises.length = 0;
  2858. await this.cleanup();
  2859. throw new _core_utils.XRefParseException();
  2860. }
  2861. });
  2862. }
  2863. fontFallback(id, handler) {
  2864. return this.catalog.fontFallback(id, handler);
  2865. }
  2866. async cleanup() {
  2867. return this.catalog ? this.catalog.cleanup() : (0, _primitives.clearPrimitiveCaches)();
  2868. }
  2869. }
  2870. exports.PDFDocument = PDFDocument;
  2871. /***/ }),
  2872. /* 9 */
  2873. /***/ (function(module, exports, __w_pdfjs_require__) {
  2874. "use strict";
  2875. Object.defineProperty(exports, "__esModule", {
  2876. value: true
  2877. });
  2878. exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0;
  2879. var _util = __w_pdfjs_require__(2);
  2880. var _primitives = __w_pdfjs_require__(4);
  2881. var _parser = __w_pdfjs_require__(10);
  2882. var _core_utils = __w_pdfjs_require__(7);
  2883. var _crypto = __w_pdfjs_require__(21);
  2884. var _colorspace = __w_pdfjs_require__(22);
  2885. function fetchDestination(dest) {
  2886. return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
  2887. }
  2888. class Catalog {
  2889. constructor(pdfManager, xref) {
  2890. this.pdfManager = pdfManager;
  2891. this.xref = xref;
  2892. this.catDict = xref.getCatalogObj();
  2893. if (!(0, _primitives.isDict)(this.catDict)) {
  2894. throw new _util.FormatError("Catalog object is not a dictionary.");
  2895. }
  2896. this.fontCache = new _primitives.RefSetCache();
  2897. this.builtInCMapCache = new Map();
  2898. this.pageKidsCountCache = new _primitives.RefSetCache();
  2899. }
  2900. get metadata() {
  2901. const streamRef = this.catDict.getRaw("Metadata");
  2902. if (!(0, _primitives.isRef)(streamRef)) {
  2903. return (0, _util.shadow)(this, "metadata", null);
  2904. }
  2905. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  2906. const stream = this.xref.fetch(streamRef, suppressEncryption);
  2907. let metadata;
  2908. if (stream && (0, _primitives.isDict)(stream.dict)) {
  2909. const type = stream.dict.get("Type");
  2910. const subtype = stream.dict.get("Subtype");
  2911. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  2912. try {
  2913. metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
  2914. } catch (e) {
  2915. if (e instanceof _core_utils.MissingDataException) {
  2916. throw e;
  2917. }
  2918. (0, _util.info)("Skipping invalid metadata.");
  2919. }
  2920. }
  2921. }
  2922. return (0, _util.shadow)(this, "metadata", metadata);
  2923. }
  2924. get toplevelPagesDict() {
  2925. const pagesObj = this.catDict.get("Pages");
  2926. if (!(0, _primitives.isDict)(pagesObj)) {
  2927. throw new _util.FormatError("Invalid top-level pages dictionary.");
  2928. }
  2929. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  2930. }
  2931. get documentOutline() {
  2932. let obj = null;
  2933. try {
  2934. obj = this._readDocumentOutline();
  2935. } catch (ex) {
  2936. if (ex instanceof _core_utils.MissingDataException) {
  2937. throw ex;
  2938. }
  2939. (0, _util.warn)("Unable to read document outline.");
  2940. }
  2941. return (0, _util.shadow)(this, "documentOutline", obj);
  2942. }
  2943. _readDocumentOutline() {
  2944. let obj = this.catDict.get("Outlines");
  2945. if (!(0, _primitives.isDict)(obj)) {
  2946. return null;
  2947. }
  2948. obj = obj.getRaw("First");
  2949. if (!(0, _primitives.isRef)(obj)) {
  2950. return null;
  2951. }
  2952. const root = {
  2953. items: []
  2954. };
  2955. const queue = [{
  2956. obj,
  2957. parent: root
  2958. }];
  2959. const processed = new _primitives.RefSet();
  2960. processed.put(obj);
  2961. const xref = this.xref,
  2962. blackColor = new Uint8ClampedArray(3);
  2963. while (queue.length > 0) {
  2964. const i = queue.shift();
  2965. const outlineDict = xref.fetchIfRef(i.obj);
  2966. if (outlineDict === null) {
  2967. continue;
  2968. }
  2969. if (!outlineDict.has("Title")) {
  2970. throw new _util.FormatError("Invalid outline item encountered.");
  2971. }
  2972. const data = {
  2973. url: null,
  2974. dest: null
  2975. };
  2976. Catalog.parseDestDictionary({
  2977. destDict: outlineDict,
  2978. resultObj: data,
  2979. docBaseUrl: this.pdfManager.docBaseUrl
  2980. });
  2981. const title = outlineDict.get("Title");
  2982. const flags = outlineDict.get("F") || 0;
  2983. const color = outlineDict.getArray("C");
  2984. const count = outlineDict.get("Count");
  2985. let rgbColor = blackColor;
  2986. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  2987. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  2988. }
  2989. const outlineItem = {
  2990. dest: data.dest,
  2991. url: data.url,
  2992. unsafeUrl: data.unsafeUrl,
  2993. newWindow: data.newWindow,
  2994. title: (0, _util.stringToPDFString)(title),
  2995. color: rgbColor,
  2996. count: Number.isInteger(count) ? count : undefined,
  2997. bold: !!(flags & 2),
  2998. italic: !!(flags & 1),
  2999. items: []
  3000. };
  3001. i.parent.items.push(outlineItem);
  3002. obj = outlineDict.getRaw("First");
  3003. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3004. queue.push({
  3005. obj,
  3006. parent: outlineItem
  3007. });
  3008. processed.put(obj);
  3009. }
  3010. obj = outlineDict.getRaw("Next");
  3011. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3012. queue.push({
  3013. obj,
  3014. parent: i.parent
  3015. });
  3016. processed.put(obj);
  3017. }
  3018. }
  3019. return root.items.length > 0 ? root.items : null;
  3020. }
  3021. get permissions() {
  3022. let permissions = null;
  3023. try {
  3024. permissions = this._readPermissions();
  3025. } catch (ex) {
  3026. if (ex instanceof _core_utils.MissingDataException) {
  3027. throw ex;
  3028. }
  3029. (0, _util.warn)("Unable to read permissions.");
  3030. }
  3031. return (0, _util.shadow)(this, "permissions", permissions);
  3032. }
  3033. _readPermissions() {
  3034. const encrypt = this.xref.trailer.get("Encrypt");
  3035. if (!(0, _primitives.isDict)(encrypt)) {
  3036. return null;
  3037. }
  3038. let flags = encrypt.get("P");
  3039. if (!(0, _util.isNum)(flags)) {
  3040. return null;
  3041. }
  3042. flags += 2 ** 32;
  3043. const permissions = [];
  3044. for (const key in _util.PermissionFlag) {
  3045. const value = _util.PermissionFlag[key];
  3046. if (flags & value) {
  3047. permissions.push(value);
  3048. }
  3049. }
  3050. return permissions;
  3051. }
  3052. get numPages() {
  3053. const obj = this.toplevelPagesDict.get("Count");
  3054. if (!Number.isInteger(obj)) {
  3055. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  3056. }
  3057. return (0, _util.shadow)(this, "numPages", obj);
  3058. }
  3059. get destinations() {
  3060. const obj = this._readDests(),
  3061. dests = Object.create(null);
  3062. if (obj instanceof NameTree) {
  3063. const names = obj.getAll();
  3064. for (const name in names) {
  3065. dests[name] = fetchDestination(names[name]);
  3066. }
  3067. } else if (obj instanceof _primitives.Dict) {
  3068. obj.forEach(function (key, value) {
  3069. if (value) {
  3070. dests[key] = fetchDestination(value);
  3071. }
  3072. });
  3073. }
  3074. return (0, _util.shadow)(this, "destinations", dests);
  3075. }
  3076. getDestination(destinationId) {
  3077. const obj = this._readDests();
  3078. if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
  3079. return fetchDestination(obj.get(destinationId) || null);
  3080. }
  3081. return null;
  3082. }
  3083. _readDests() {
  3084. const obj = this.catDict.get("Names");
  3085. if (obj && obj.has("Dests")) {
  3086. return new NameTree(obj.getRaw("Dests"), this.xref);
  3087. } else if (this.catDict.has("Dests")) {
  3088. return this.catDict.get("Dests");
  3089. }
  3090. return undefined;
  3091. }
  3092. get pageLabels() {
  3093. let obj = null;
  3094. try {
  3095. obj = this._readPageLabels();
  3096. } catch (ex) {
  3097. if (ex instanceof _core_utils.MissingDataException) {
  3098. throw ex;
  3099. }
  3100. (0, _util.warn)("Unable to read page labels.");
  3101. }
  3102. return (0, _util.shadow)(this, "pageLabels", obj);
  3103. }
  3104. _readPageLabels() {
  3105. const obj = this.catDict.getRaw("PageLabels");
  3106. if (!obj) {
  3107. return null;
  3108. }
  3109. const pageLabels = new Array(this.numPages);
  3110. let style = null,
  3111. prefix = "";
  3112. const numberTree = new NumberTree(obj, this.xref);
  3113. const nums = numberTree.getAll();
  3114. let currentLabel = "",
  3115. currentIndex = 1;
  3116. for (let i = 0, ii = this.numPages; i < ii; i++) {
  3117. if (i in nums) {
  3118. const labelDict = nums[i];
  3119. if (!(0, _primitives.isDict)(labelDict)) {
  3120. throw new _util.FormatError("PageLabel is not a dictionary.");
  3121. }
  3122. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  3123. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  3124. }
  3125. if (labelDict.has("S")) {
  3126. const s = labelDict.get("S");
  3127. if (!(0, _primitives.isName)(s)) {
  3128. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  3129. }
  3130. style = s.name;
  3131. } else {
  3132. style = null;
  3133. }
  3134. if (labelDict.has("P")) {
  3135. const p = labelDict.get("P");
  3136. if (!(0, _util.isString)(p)) {
  3137. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  3138. }
  3139. prefix = (0, _util.stringToPDFString)(p);
  3140. } else {
  3141. prefix = "";
  3142. }
  3143. if (labelDict.has("St")) {
  3144. const st = labelDict.get("St");
  3145. if (!(Number.isInteger(st) && st >= 1)) {
  3146. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  3147. }
  3148. currentIndex = st;
  3149. } else {
  3150. currentIndex = 1;
  3151. }
  3152. }
  3153. switch (style) {
  3154. case "D":
  3155. currentLabel = currentIndex;
  3156. break;
  3157. case "R":
  3158. case "r":
  3159. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  3160. break;
  3161. case "A":
  3162. case "a":
  3163. const LIMIT = 26;
  3164. const A_UPPER_CASE = 0x41,
  3165. A_LOWER_CASE = 0x61;
  3166. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  3167. const letterIndex = currentIndex - 1;
  3168. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  3169. const charBuf = [];
  3170. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  3171. charBuf.push(character);
  3172. }
  3173. currentLabel = charBuf.join("");
  3174. break;
  3175. default:
  3176. if (style) {
  3177. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  3178. }
  3179. currentLabel = "";
  3180. }
  3181. pageLabels[i] = prefix + currentLabel;
  3182. currentIndex++;
  3183. }
  3184. return pageLabels;
  3185. }
  3186. get pageLayout() {
  3187. const obj = this.catDict.get("PageLayout");
  3188. let pageLayout = "";
  3189. if ((0, _primitives.isName)(obj)) {
  3190. switch (obj.name) {
  3191. case "SinglePage":
  3192. case "OneColumn":
  3193. case "TwoColumnLeft":
  3194. case "TwoColumnRight":
  3195. case "TwoPageLeft":
  3196. case "TwoPageRight":
  3197. pageLayout = obj.name;
  3198. }
  3199. }
  3200. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  3201. }
  3202. get pageMode() {
  3203. const obj = this.catDict.get("PageMode");
  3204. let pageMode = "UseNone";
  3205. if ((0, _primitives.isName)(obj)) {
  3206. switch (obj.name) {
  3207. case "UseNone":
  3208. case "UseOutlines":
  3209. case "UseThumbs":
  3210. case "FullScreen":
  3211. case "UseOC":
  3212. case "UseAttachments":
  3213. pageMode = obj.name;
  3214. }
  3215. }
  3216. return (0, _util.shadow)(this, "pageMode", pageMode);
  3217. }
  3218. get viewerPreferences() {
  3219. const ViewerPreferencesValidators = {
  3220. HideToolbar: _util.isBool,
  3221. HideMenubar: _util.isBool,
  3222. HideWindowUI: _util.isBool,
  3223. FitWindow: _util.isBool,
  3224. CenterWindow: _util.isBool,
  3225. DisplayDocTitle: _util.isBool,
  3226. NonFullScreenPageMode: _primitives.isName,
  3227. Direction: _primitives.isName,
  3228. ViewArea: _primitives.isName,
  3229. ViewClip: _primitives.isName,
  3230. PrintArea: _primitives.isName,
  3231. PrintClip: _primitives.isName,
  3232. PrintScaling: _primitives.isName,
  3233. Duplex: _primitives.isName,
  3234. PickTrayByPDFSize: _util.isBool,
  3235. PrintPageRange: Array.isArray,
  3236. NumCopies: Number.isInteger
  3237. };
  3238. const obj = this.catDict.get("ViewerPreferences");
  3239. const prefs = Object.create(null);
  3240. if ((0, _primitives.isDict)(obj)) {
  3241. for (const key in ViewerPreferencesValidators) {
  3242. if (!obj.has(key)) {
  3243. continue;
  3244. }
  3245. const value = obj.get(key);
  3246. if (!ViewerPreferencesValidators[key](value)) {
  3247. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3248. continue;
  3249. }
  3250. let prefValue;
  3251. switch (key) {
  3252. case "NonFullScreenPageMode":
  3253. switch (value.name) {
  3254. case "UseNone":
  3255. case "UseOutlines":
  3256. case "UseThumbs":
  3257. case "UseOC":
  3258. prefValue = value.name;
  3259. break;
  3260. default:
  3261. prefValue = "UseNone";
  3262. }
  3263. break;
  3264. case "Direction":
  3265. switch (value.name) {
  3266. case "L2R":
  3267. case "R2L":
  3268. prefValue = value.name;
  3269. break;
  3270. default:
  3271. prefValue = "L2R";
  3272. }
  3273. break;
  3274. case "ViewArea":
  3275. case "ViewClip":
  3276. case "PrintArea":
  3277. case "PrintClip":
  3278. switch (value.name) {
  3279. case "MediaBox":
  3280. case "CropBox":
  3281. case "BleedBox":
  3282. case "TrimBox":
  3283. case "ArtBox":
  3284. prefValue = value.name;
  3285. break;
  3286. default:
  3287. prefValue = "CropBox";
  3288. }
  3289. break;
  3290. case "PrintScaling":
  3291. switch (value.name) {
  3292. case "None":
  3293. case "AppDefault":
  3294. prefValue = value.name;
  3295. break;
  3296. default:
  3297. prefValue = "AppDefault";
  3298. }
  3299. break;
  3300. case "Duplex":
  3301. switch (value.name) {
  3302. case "Simplex":
  3303. case "DuplexFlipShortEdge":
  3304. case "DuplexFlipLongEdge":
  3305. prefValue = value.name;
  3306. break;
  3307. default:
  3308. prefValue = "None";
  3309. }
  3310. break;
  3311. case "PrintPageRange":
  3312. const length = value.length;
  3313. if (length % 2 !== 0) {
  3314. break;
  3315. }
  3316. const isValid = value.every((page, i, arr) => {
  3317. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  3318. });
  3319. if (isValid) {
  3320. prefValue = value;
  3321. }
  3322. break;
  3323. case "NumCopies":
  3324. if (value > 0) {
  3325. prefValue = value;
  3326. }
  3327. break;
  3328. default:
  3329. (0, _util.assert)(typeof value === "boolean");
  3330. prefValue = value;
  3331. }
  3332. if (prefValue !== undefined) {
  3333. prefs[key] = prefValue;
  3334. } else {
  3335. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3336. }
  3337. }
  3338. }
  3339. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  3340. }
  3341. get openAction() {
  3342. const obj = this.catDict.get("OpenAction");
  3343. let openAction = null;
  3344. if ((0, _primitives.isDict)(obj)) {
  3345. const destDict = new _primitives.Dict(this.xref);
  3346. destDict.set("A", obj);
  3347. const resultObj = {
  3348. url: null,
  3349. dest: null,
  3350. action: null
  3351. };
  3352. Catalog.parseDestDictionary({
  3353. destDict,
  3354. resultObj
  3355. });
  3356. if (Array.isArray(resultObj.dest)) {
  3357. if (!openAction) {
  3358. openAction = Object.create(null);
  3359. }
  3360. openAction.dest = resultObj.dest;
  3361. } else if (resultObj.action) {
  3362. if (!openAction) {
  3363. openAction = Object.create(null);
  3364. }
  3365. openAction.action = resultObj.action;
  3366. }
  3367. } else if (Array.isArray(obj)) {
  3368. if (!openAction) {
  3369. openAction = Object.create(null);
  3370. }
  3371. openAction.dest = obj;
  3372. }
  3373. return (0, _util.shadow)(this, "openAction", openAction);
  3374. }
  3375. get attachments() {
  3376. const obj = this.catDict.get("Names");
  3377. let attachments = null;
  3378. if (obj && obj.has("EmbeddedFiles")) {
  3379. const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  3380. const names = nameTree.getAll();
  3381. for (const name in names) {
  3382. const fs = new FileSpec(names[name], this.xref);
  3383. if (!attachments) {
  3384. attachments = Object.create(null);
  3385. }
  3386. attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
  3387. }
  3388. }
  3389. return (0, _util.shadow)(this, "attachments", attachments);
  3390. }
  3391. get javaScript() {
  3392. const obj = this.catDict.get("Names");
  3393. let javaScript = null;
  3394. function appendIfJavaScriptDict(jsDict) {
  3395. const type = jsDict.get("S");
  3396. if (!(0, _primitives.isName)(type, "JavaScript")) {
  3397. return;
  3398. }
  3399. let js = jsDict.get("JS");
  3400. if ((0, _primitives.isStream)(js)) {
  3401. js = (0, _util.bytesToString)(js.getBytes());
  3402. } else if (!(0, _util.isString)(js)) {
  3403. return;
  3404. }
  3405. if (!javaScript) {
  3406. javaScript = [];
  3407. }
  3408. javaScript.push((0, _util.stringToPDFString)(js));
  3409. }
  3410. if (obj && obj.has("JavaScript")) {
  3411. const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
  3412. const names = nameTree.getAll();
  3413. for (const name in names) {
  3414. const jsDict = names[name];
  3415. if ((0, _primitives.isDict)(jsDict)) {
  3416. appendIfJavaScriptDict(jsDict);
  3417. }
  3418. }
  3419. }
  3420. const openAction = this.catDict.get("OpenAction");
  3421. if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
  3422. appendIfJavaScriptDict(openAction);
  3423. }
  3424. return (0, _util.shadow)(this, "javaScript", javaScript);
  3425. }
  3426. fontFallback(id, handler) {
  3427. const promises = [];
  3428. this.fontCache.forEach(function (promise) {
  3429. promises.push(promise);
  3430. });
  3431. return Promise.all(promises).then(translatedFonts => {
  3432. for (const translatedFont of translatedFonts) {
  3433. if (translatedFont.loadedName === id) {
  3434. translatedFont.fallback(handler);
  3435. return;
  3436. }
  3437. }
  3438. });
  3439. }
  3440. cleanup() {
  3441. (0, _primitives.clearPrimitiveCaches)();
  3442. this.pageKidsCountCache.clear();
  3443. const promises = [];
  3444. this.fontCache.forEach(function (promise) {
  3445. promises.push(promise);
  3446. });
  3447. return Promise.all(promises).then(translatedFonts => {
  3448. for (const {
  3449. dict
  3450. } of translatedFonts) {
  3451. delete dict.translated;
  3452. }
  3453. this.fontCache.clear();
  3454. this.builtInCMapCache.clear();
  3455. });
  3456. }
  3457. getPageDict(pageIndex) {
  3458. const capability = (0, _util.createPromiseCapability)();
  3459. const nodesToVisit = [this.catDict.getRaw("Pages")];
  3460. const visitedNodes = new _primitives.RefSet();
  3461. const xref = this.xref,
  3462. pageKidsCountCache = this.pageKidsCountCache;
  3463. let count,
  3464. currentPageIndex = 0;
  3465. function next() {
  3466. while (nodesToVisit.length) {
  3467. const currentNode = nodesToVisit.pop();
  3468. if ((0, _primitives.isRef)(currentNode)) {
  3469. count = pageKidsCountCache.get(currentNode);
  3470. if (count > 0 && currentPageIndex + count < pageIndex) {
  3471. currentPageIndex += count;
  3472. continue;
  3473. }
  3474. if (visitedNodes.has(currentNode)) {
  3475. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  3476. return;
  3477. }
  3478. visitedNodes.put(currentNode);
  3479. xref.fetchAsync(currentNode).then(function (obj) {
  3480. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  3481. if (pageIndex === currentPageIndex) {
  3482. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  3483. pageKidsCountCache.put(currentNode, 1);
  3484. }
  3485. capability.resolve([obj, currentNode]);
  3486. } else {
  3487. currentPageIndex++;
  3488. next();
  3489. }
  3490. return;
  3491. }
  3492. nodesToVisit.push(obj);
  3493. next();
  3494. }, capability.reject);
  3495. return;
  3496. }
  3497. if (!(0, _primitives.isDict)(currentNode)) {
  3498. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  3499. return;
  3500. }
  3501. count = currentNode.get("Count");
  3502. if (Number.isInteger(count) && count >= 0) {
  3503. const objId = currentNode.objId;
  3504. if (objId && !pageKidsCountCache.has(objId)) {
  3505. pageKidsCountCache.put(objId, count);
  3506. }
  3507. if (currentPageIndex + count <= pageIndex) {
  3508. currentPageIndex += count;
  3509. continue;
  3510. }
  3511. }
  3512. const kids = currentNode.get("Kids");
  3513. if (!Array.isArray(kids)) {
  3514. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  3515. if (currentPageIndex === pageIndex) {
  3516. capability.resolve([currentNode, null]);
  3517. return;
  3518. }
  3519. currentPageIndex++;
  3520. continue;
  3521. }
  3522. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  3523. return;
  3524. }
  3525. for (let last = kids.length - 1; last >= 0; last--) {
  3526. nodesToVisit.push(kids[last]);
  3527. }
  3528. }
  3529. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  3530. }
  3531. next();
  3532. return capability.promise;
  3533. }
  3534. getPageIndex(pageRef) {
  3535. const xref = this.xref;
  3536. function pagesBeforeRef(kidRef) {
  3537. let total = 0,
  3538. parentRef;
  3539. return xref.fetchAsync(kidRef).then(function (node) {
  3540. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  3541. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  3542. }
  3543. if (!node) {
  3544. return null;
  3545. }
  3546. if (!(0, _primitives.isDict)(node)) {
  3547. throw new _util.FormatError("Node must be a dictionary.");
  3548. }
  3549. parentRef = node.getRaw("Parent");
  3550. return node.getAsync("Parent");
  3551. }).then(function (parent) {
  3552. if (!parent) {
  3553. return null;
  3554. }
  3555. if (!(0, _primitives.isDict)(parent)) {
  3556. throw new _util.FormatError("Parent must be a dictionary.");
  3557. }
  3558. return parent.getAsync("Kids");
  3559. }).then(function (kids) {
  3560. if (!kids) {
  3561. return null;
  3562. }
  3563. const kidPromises = [];
  3564. let found = false;
  3565. for (let i = 0, ii = kids.length; i < ii; i++) {
  3566. const kid = kids[i];
  3567. if (!(0, _primitives.isRef)(kid)) {
  3568. throw new _util.FormatError("Kid must be a reference.");
  3569. }
  3570. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  3571. found = true;
  3572. break;
  3573. }
  3574. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  3575. if (!(0, _primitives.isDict)(kid)) {
  3576. throw new _util.FormatError("Kid node must be a dictionary.");
  3577. }
  3578. if (kid.has("Count")) {
  3579. total += kid.get("Count");
  3580. } else {
  3581. total++;
  3582. }
  3583. }));
  3584. }
  3585. if (!found) {
  3586. throw new _util.FormatError("Kid reference not found in parent's kids.");
  3587. }
  3588. return Promise.all(kidPromises).then(function () {
  3589. return [total, parentRef];
  3590. });
  3591. });
  3592. }
  3593. let total = 0;
  3594. function next(ref) {
  3595. return pagesBeforeRef(ref).then(function (args) {
  3596. if (!args) {
  3597. return total;
  3598. }
  3599. const [count, parentRef] = args;
  3600. total += count;
  3601. return next(parentRef);
  3602. });
  3603. }
  3604. return next(pageRef);
  3605. }
  3606. static parseDestDictionary(params) {
  3607. function addDefaultProtocolToUrl(url) {
  3608. return url.startsWith("www.") ? `http://${url}` : url;
  3609. }
  3610. function tryConvertUrlEncoding(url) {
  3611. try {
  3612. return (0, _util.stringToUTF8String)(url);
  3613. } catch (e) {
  3614. return url;
  3615. }
  3616. }
  3617. const destDict = params.destDict;
  3618. if (!(0, _primitives.isDict)(destDict)) {
  3619. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  3620. return;
  3621. }
  3622. const resultObj = params.resultObj;
  3623. if (typeof resultObj !== "object") {
  3624. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  3625. return;
  3626. }
  3627. const docBaseUrl = params.docBaseUrl || null;
  3628. let action = destDict.get("A"),
  3629. url,
  3630. dest;
  3631. if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) {
  3632. action = destDict.get("Dest");
  3633. }
  3634. if ((0, _primitives.isDict)(action)) {
  3635. const actionType = action.get("S");
  3636. if (!(0, _primitives.isName)(actionType)) {
  3637. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  3638. return;
  3639. }
  3640. const actionName = actionType.name;
  3641. switch (actionName) {
  3642. case "URI":
  3643. url = action.get("URI");
  3644. if ((0, _primitives.isName)(url)) {
  3645. url = "/" + url.name;
  3646. } else if ((0, _util.isString)(url)) {
  3647. url = addDefaultProtocolToUrl(url);
  3648. }
  3649. break;
  3650. case "GoTo":
  3651. dest = action.get("D");
  3652. break;
  3653. case "Launch":
  3654. case "GoToR":
  3655. const urlDict = action.get("F");
  3656. if ((0, _primitives.isDict)(urlDict)) {
  3657. url = urlDict.get("F") || null;
  3658. } else if ((0, _util.isString)(urlDict)) {
  3659. url = urlDict;
  3660. }
  3661. let remoteDest = action.get("D");
  3662. if (remoteDest) {
  3663. if ((0, _primitives.isName)(remoteDest)) {
  3664. remoteDest = remoteDest.name;
  3665. }
  3666. if ((0, _util.isString)(url)) {
  3667. const baseUrl = url.split("#")[0];
  3668. if ((0, _util.isString)(remoteDest)) {
  3669. url = baseUrl + "#" + remoteDest;
  3670. } else if (Array.isArray(remoteDest)) {
  3671. url = baseUrl + "#" + JSON.stringify(remoteDest);
  3672. }
  3673. }
  3674. }
  3675. const newWindow = action.get("NewWindow");
  3676. if ((0, _util.isBool)(newWindow)) {
  3677. resultObj.newWindow = newWindow;
  3678. }
  3679. break;
  3680. case "Named":
  3681. const namedAction = action.get("N");
  3682. if ((0, _primitives.isName)(namedAction)) {
  3683. resultObj.action = namedAction.name;
  3684. }
  3685. break;
  3686. case "JavaScript":
  3687. const jsAction = action.get("JS");
  3688. let js;
  3689. if ((0, _primitives.isStream)(jsAction)) {
  3690. js = (0, _util.bytesToString)(jsAction.getBytes());
  3691. } else if ((0, _util.isString)(jsAction)) {
  3692. js = jsAction;
  3693. }
  3694. if (js) {
  3695. const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
  3696. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  3697. const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  3698. if (jsUrl && jsUrl[2]) {
  3699. url = jsUrl[2];
  3700. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  3701. resultObj.newWindow = true;
  3702. }
  3703. break;
  3704. }
  3705. }
  3706. default:
  3707. (0, _util.warn)(`parseDestDictionary: unsupported action type "${actionName}".`);
  3708. break;
  3709. }
  3710. } else if (destDict.has("Dest")) {
  3711. dest = destDict.get("Dest");
  3712. }
  3713. if ((0, _util.isString)(url)) {
  3714. url = tryConvertUrlEncoding(url);
  3715. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  3716. if (absoluteUrl) {
  3717. resultObj.url = absoluteUrl.href;
  3718. }
  3719. resultObj.unsafeUrl = url;
  3720. }
  3721. if (dest) {
  3722. if ((0, _primitives.isName)(dest)) {
  3723. dest = dest.name;
  3724. }
  3725. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  3726. resultObj.dest = dest;
  3727. }
  3728. }
  3729. }
  3730. }
  3731. exports.Catalog = Catalog;
  3732. var XRef = function XRefClosure() {
  3733. function XRef(stream, pdfManager) {
  3734. this.stream = stream;
  3735. this.pdfManager = pdfManager;
  3736. this.entries = [];
  3737. this.xrefstms = Object.create(null);
  3738. this._cacheMap = new Map();
  3739. this.stats = {
  3740. streamTypes: Object.create(null),
  3741. fontTypes: Object.create(null)
  3742. };
  3743. }
  3744. XRef.prototype = {
  3745. setStartXRef: function XRef_setStartXRef(startXRef) {
  3746. this.startXRefQueue = [startXRef];
  3747. },
  3748. parse: function XRef_parse(recoveryMode) {
  3749. var trailerDict;
  3750. if (!recoveryMode) {
  3751. trailerDict = this.readXRef();
  3752. } else {
  3753. (0, _util.warn)("Indexing all PDF objects");
  3754. trailerDict = this.indexObjects();
  3755. }
  3756. trailerDict.assignXref(this);
  3757. this.trailer = trailerDict;
  3758. let encrypt;
  3759. try {
  3760. encrypt = trailerDict.get("Encrypt");
  3761. } catch (ex) {
  3762. if (ex instanceof _core_utils.MissingDataException) {
  3763. throw ex;
  3764. }
  3765. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  3766. }
  3767. if ((0, _primitives.isDict)(encrypt)) {
  3768. var ids = trailerDict.get("ID");
  3769. var fileId = ids && ids.length ? ids[0] : "";
  3770. encrypt.suppressEncryption = true;
  3771. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  3772. }
  3773. let root;
  3774. try {
  3775. root = trailerDict.get("Root");
  3776. } catch (ex) {
  3777. if (ex instanceof _core_utils.MissingDataException) {
  3778. throw ex;
  3779. }
  3780. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  3781. }
  3782. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  3783. this.root = root;
  3784. } else {
  3785. if (!recoveryMode) {
  3786. throw new _core_utils.XRefParseException();
  3787. }
  3788. throw new _util.FormatError("Invalid root reference");
  3789. }
  3790. },
  3791. processXRefTable: function XRef_processXRefTable(parser) {
  3792. if (!("tableState" in this)) {
  3793. this.tableState = {
  3794. entryNum: 0,
  3795. streamPos: parser.lexer.stream.pos,
  3796. parserBuf1: parser.buf1,
  3797. parserBuf2: parser.buf2
  3798. };
  3799. }
  3800. var obj = this.readXRefTable(parser);
  3801. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  3802. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  3803. }
  3804. var dict = parser.getObj();
  3805. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  3806. dict = dict.dict;
  3807. }
  3808. if (!(0, _primitives.isDict)(dict)) {
  3809. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  3810. }
  3811. delete this.tableState;
  3812. return dict;
  3813. },
  3814. readXRefTable: function XRef_readXRefTable(parser) {
  3815. var stream = parser.lexer.stream;
  3816. var tableState = this.tableState;
  3817. stream.pos = tableState.streamPos;
  3818. parser.buf1 = tableState.parserBuf1;
  3819. parser.buf2 = tableState.parserBuf2;
  3820. var obj;
  3821. while (true) {
  3822. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  3823. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  3824. break;
  3825. }
  3826. tableState.firstEntryNum = obj;
  3827. tableState.entryCount = parser.getObj();
  3828. }
  3829. var first = tableState.firstEntryNum;
  3830. var count = tableState.entryCount;
  3831. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  3832. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  3833. }
  3834. for (var i = tableState.entryNum; i < count; i++) {
  3835. tableState.streamPos = stream.pos;
  3836. tableState.entryNum = i;
  3837. tableState.parserBuf1 = parser.buf1;
  3838. tableState.parserBuf2 = parser.buf2;
  3839. var entry = {};
  3840. entry.offset = parser.getObj();
  3841. entry.gen = parser.getObj();
  3842. var type = parser.getObj();
  3843. if (type instanceof _primitives.Cmd) {
  3844. switch (type.cmd) {
  3845. case "f":
  3846. entry.free = true;
  3847. break;
  3848. case "n":
  3849. entry.uncompressed = true;
  3850. break;
  3851. }
  3852. }
  3853. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  3854. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  3855. }
  3856. if (i === 0 && entry.free && first === 1) {
  3857. first = 0;
  3858. }
  3859. if (!this.entries[i + first]) {
  3860. this.entries[i + first] = entry;
  3861. }
  3862. }
  3863. tableState.entryNum = 0;
  3864. tableState.streamPos = stream.pos;
  3865. tableState.parserBuf1 = parser.buf1;
  3866. tableState.parserBuf2 = parser.buf2;
  3867. delete tableState.firstEntryNum;
  3868. delete tableState.entryCount;
  3869. }
  3870. if (this.entries[0] && !this.entries[0].free) {
  3871. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  3872. }
  3873. return obj;
  3874. },
  3875. processXRefStream: function XRef_processXRefStream(stream) {
  3876. if (!("streamState" in this)) {
  3877. var streamParameters = stream.dict;
  3878. var byteWidths = streamParameters.get("W");
  3879. var range = streamParameters.get("Index");
  3880. if (!range) {
  3881. range = [0, streamParameters.get("Size")];
  3882. }
  3883. this.streamState = {
  3884. entryRanges: range,
  3885. byteWidths,
  3886. entryNum: 0,
  3887. streamPos: stream.pos
  3888. };
  3889. }
  3890. this.readXRefStream(stream);
  3891. delete this.streamState;
  3892. return stream.dict;
  3893. },
  3894. readXRefStream: function XRef_readXRefStream(stream) {
  3895. var i, j;
  3896. var streamState = this.streamState;
  3897. stream.pos = streamState.streamPos;
  3898. var byteWidths = streamState.byteWidths;
  3899. var typeFieldWidth = byteWidths[0];
  3900. var offsetFieldWidth = byteWidths[1];
  3901. var generationFieldWidth = byteWidths[2];
  3902. var entryRanges = streamState.entryRanges;
  3903. while (entryRanges.length > 0) {
  3904. var first = entryRanges[0];
  3905. var n = entryRanges[1];
  3906. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  3907. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  3908. }
  3909. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  3910. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  3911. }
  3912. for (i = streamState.entryNum; i < n; ++i) {
  3913. streamState.entryNum = i;
  3914. streamState.streamPos = stream.pos;
  3915. var type = 0,
  3916. offset = 0,
  3917. generation = 0;
  3918. for (j = 0; j < typeFieldWidth; ++j) {
  3919. type = type << 8 | stream.getByte();
  3920. }
  3921. if (typeFieldWidth === 0) {
  3922. type = 1;
  3923. }
  3924. for (j = 0; j < offsetFieldWidth; ++j) {
  3925. offset = offset << 8 | stream.getByte();
  3926. }
  3927. for (j = 0; j < generationFieldWidth; ++j) {
  3928. generation = generation << 8 | stream.getByte();
  3929. }
  3930. var entry = {};
  3931. entry.offset = offset;
  3932. entry.gen = generation;
  3933. switch (type) {
  3934. case 0:
  3935. entry.free = true;
  3936. break;
  3937. case 1:
  3938. entry.uncompressed = true;
  3939. break;
  3940. case 2:
  3941. break;
  3942. default:
  3943. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  3944. }
  3945. if (!this.entries[first + i]) {
  3946. this.entries[first + i] = entry;
  3947. }
  3948. }
  3949. streamState.entryNum = 0;
  3950. streamState.streamPos = stream.pos;
  3951. entryRanges.splice(0, 2);
  3952. }
  3953. },
  3954. indexObjects: function XRef_indexObjects() {
  3955. var TAB = 0x9,
  3956. LF = 0xa,
  3957. CR = 0xd,
  3958. SPACE = 0x20;
  3959. var PERCENT = 0x25,
  3960. LT = 0x3c;
  3961. function readToken(data, offset) {
  3962. var token = "",
  3963. ch = data[offset];
  3964. while (ch !== LF && ch !== CR && ch !== LT) {
  3965. if (++offset >= data.length) {
  3966. break;
  3967. }
  3968. token += String.fromCharCode(ch);
  3969. ch = data[offset];
  3970. }
  3971. return token;
  3972. }
  3973. function skipUntil(data, offset, what) {
  3974. var length = what.length,
  3975. dataLength = data.length;
  3976. var skipped = 0;
  3977. while (offset < dataLength) {
  3978. var i = 0;
  3979. while (i < length && data[offset + i] === what[i]) {
  3980. ++i;
  3981. }
  3982. if (i >= length) {
  3983. break;
  3984. }
  3985. offset++;
  3986. skipped++;
  3987. }
  3988. return skipped;
  3989. }
  3990. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  3991. const endobjRegExp = /\bendobj[\b\s]$/;
  3992. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  3993. const CHECK_CONTENT_LENGTH = 25;
  3994. var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  3995. var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  3996. const objBytes = new Uint8Array([111, 98, 106]);
  3997. var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  3998. this.entries.length = 0;
  3999. var stream = this.stream;
  4000. stream.pos = 0;
  4001. var buffer = stream.getBytes();
  4002. var position = stream.start,
  4003. length = buffer.length;
  4004. var trailers = [],
  4005. xrefStms = [];
  4006. while (position < length) {
  4007. var ch = buffer[position];
  4008. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  4009. ++position;
  4010. continue;
  4011. }
  4012. if (ch === PERCENT) {
  4013. do {
  4014. ++position;
  4015. if (position >= length) {
  4016. break;
  4017. }
  4018. ch = buffer[position];
  4019. } while (ch !== LF && ch !== CR);
  4020. continue;
  4021. }
  4022. var token = readToken(buffer, position);
  4023. var m;
  4024. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  4025. position += skipUntil(buffer, position, trailerBytes);
  4026. trailers.push(position);
  4027. position += skipUntil(buffer, position, startxrefBytes);
  4028. } else if (m = objRegExp.exec(token)) {
  4029. const num = m[1] | 0,
  4030. gen = m[2] | 0;
  4031. if (!this.entries[num] || this.entries[num].gen === gen) {
  4032. this.entries[num] = {
  4033. offset: position - stream.start,
  4034. gen,
  4035. uncompressed: true
  4036. };
  4037. }
  4038. let contentLength,
  4039. startPos = position + token.length;
  4040. while (startPos < buffer.length) {
  4041. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  4042. contentLength = endPos - position;
  4043. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  4044. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  4045. if (endobjRegExp.test(tokenStr)) {
  4046. break;
  4047. } else {
  4048. const objToken = nestedObjRegExp.exec(tokenStr);
  4049. if (objToken && objToken[1]) {
  4050. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  4051. contentLength -= objToken[1].length;
  4052. break;
  4053. }
  4054. }
  4055. startPos = endPos;
  4056. }
  4057. const content = buffer.subarray(position, position + contentLength);
  4058. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  4059. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  4060. xrefStms.push(position - stream.start);
  4061. this.xrefstms[position - stream.start] = 1;
  4062. }
  4063. position += contentLength;
  4064. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  4065. trailers.push(position);
  4066. position += skipUntil(buffer, position, startxrefBytes);
  4067. } else {
  4068. position += token.length + 1;
  4069. }
  4070. }
  4071. var i, ii;
  4072. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  4073. this.startXRefQueue.push(xrefStms[i]);
  4074. this.readXRef(true);
  4075. }
  4076. let trailerDict;
  4077. for (i = 0, ii = trailers.length; i < ii; ++i) {
  4078. stream.pos = trailers[i];
  4079. const parser = new _parser.Parser({
  4080. lexer: new _parser.Lexer(stream),
  4081. xref: this,
  4082. allowStreams: true,
  4083. recoveryMode: true
  4084. });
  4085. var obj = parser.getObj();
  4086. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  4087. continue;
  4088. }
  4089. const dict = parser.getObj();
  4090. if (!(0, _primitives.isDict)(dict)) {
  4091. continue;
  4092. }
  4093. let rootDict;
  4094. try {
  4095. rootDict = dict.get("Root");
  4096. } catch (ex) {
  4097. if (ex instanceof _core_utils.MissingDataException) {
  4098. throw ex;
  4099. }
  4100. continue;
  4101. }
  4102. if (!(0, _primitives.isDict)(rootDict) || !rootDict.has("Pages")) {
  4103. continue;
  4104. }
  4105. if (dict.has("ID")) {
  4106. return dict;
  4107. }
  4108. trailerDict = dict;
  4109. }
  4110. if (trailerDict) {
  4111. return trailerDict;
  4112. }
  4113. throw new _util.InvalidPDFException("Invalid PDF structure.");
  4114. },
  4115. readXRef: function XRef_readXRef(recoveryMode) {
  4116. var stream = this.stream;
  4117. const startXRefParsedCache = Object.create(null);
  4118. try {
  4119. while (this.startXRefQueue.length) {
  4120. var startXRef = this.startXRefQueue[0];
  4121. if (startXRefParsedCache[startXRef]) {
  4122. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  4123. this.startXRefQueue.shift();
  4124. continue;
  4125. }
  4126. startXRefParsedCache[startXRef] = true;
  4127. stream.pos = startXRef + stream.start;
  4128. const parser = new _parser.Parser({
  4129. lexer: new _parser.Lexer(stream),
  4130. xref: this,
  4131. allowStreams: true
  4132. });
  4133. var obj = parser.getObj();
  4134. var dict;
  4135. if ((0, _primitives.isCmd)(obj, "xref")) {
  4136. dict = this.processXRefTable(parser);
  4137. if (!this.topDict) {
  4138. this.topDict = dict;
  4139. }
  4140. obj = dict.get("XRefStm");
  4141. if (Number.isInteger(obj)) {
  4142. var pos = obj;
  4143. if (!(pos in this.xrefstms)) {
  4144. this.xrefstms[pos] = 1;
  4145. this.startXRefQueue.push(pos);
  4146. }
  4147. }
  4148. } else if (Number.isInteger(obj)) {
  4149. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  4150. throw new _util.FormatError("Invalid XRef stream");
  4151. }
  4152. dict = this.processXRefStream(obj);
  4153. if (!this.topDict) {
  4154. this.topDict = dict;
  4155. }
  4156. if (!dict) {
  4157. throw new _util.FormatError("Failed to read XRef stream");
  4158. }
  4159. } else {
  4160. throw new _util.FormatError("Invalid XRef stream header");
  4161. }
  4162. obj = dict.get("Prev");
  4163. if (Number.isInteger(obj)) {
  4164. this.startXRefQueue.push(obj);
  4165. } else if ((0, _primitives.isRef)(obj)) {
  4166. this.startXRefQueue.push(obj.num);
  4167. }
  4168. this.startXRefQueue.shift();
  4169. }
  4170. return this.topDict;
  4171. } catch (e) {
  4172. if (e instanceof _core_utils.MissingDataException) {
  4173. throw e;
  4174. }
  4175. (0, _util.info)("(while reading XRef): " + e);
  4176. }
  4177. if (recoveryMode) {
  4178. return undefined;
  4179. }
  4180. throw new _core_utils.XRefParseException();
  4181. },
  4182. getEntry: function XRef_getEntry(i) {
  4183. var xrefEntry = this.entries[i];
  4184. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  4185. return xrefEntry;
  4186. }
  4187. return null;
  4188. },
  4189. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  4190. if (obj instanceof _primitives.Ref) {
  4191. return this.fetch(obj, suppressEncryption);
  4192. }
  4193. return obj;
  4194. },
  4195. fetch: function XRef_fetch(ref, suppressEncryption) {
  4196. if (!(ref instanceof _primitives.Ref)) {
  4197. throw new Error("ref object is not a reference");
  4198. }
  4199. const num = ref.num;
  4200. const cacheEntry = this._cacheMap.get(num);
  4201. if (cacheEntry !== undefined) {
  4202. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  4203. cacheEntry.objId = ref.toString();
  4204. }
  4205. return cacheEntry;
  4206. }
  4207. let xrefEntry = this.getEntry(num);
  4208. if (xrefEntry === null) {
  4209. this._cacheMap.set(num, xrefEntry);
  4210. return xrefEntry;
  4211. }
  4212. if (xrefEntry.uncompressed) {
  4213. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  4214. } else {
  4215. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  4216. }
  4217. if ((0, _primitives.isDict)(xrefEntry)) {
  4218. xrefEntry.objId = ref.toString();
  4219. } else if ((0, _primitives.isStream)(xrefEntry)) {
  4220. xrefEntry.dict.objId = ref.toString();
  4221. }
  4222. return xrefEntry;
  4223. },
  4224. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  4225. var gen = ref.gen;
  4226. var num = ref.num;
  4227. if (xrefEntry.gen !== gen) {
  4228. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  4229. }
  4230. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  4231. const parser = new _parser.Parser({
  4232. lexer: new _parser.Lexer(stream),
  4233. xref: this,
  4234. allowStreams: true
  4235. });
  4236. var obj1 = parser.getObj();
  4237. var obj2 = parser.getObj();
  4238. var obj3 = parser.getObj();
  4239. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  4240. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  4241. }
  4242. if (obj3.cmd !== "obj") {
  4243. if (obj3.cmd.startsWith("obj")) {
  4244. num = parseInt(obj3.cmd.substring(3), 10);
  4245. if (!Number.isNaN(num)) {
  4246. return num;
  4247. }
  4248. }
  4249. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  4250. }
  4251. if (this.encrypt && !suppressEncryption) {
  4252. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  4253. } else {
  4254. xrefEntry = parser.getObj();
  4255. }
  4256. if (!(0, _primitives.isStream)(xrefEntry)) {
  4257. this._cacheMap.set(num, xrefEntry);
  4258. }
  4259. return xrefEntry;
  4260. },
  4261. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  4262. const tableOffset = xrefEntry.offset;
  4263. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  4264. if (!(0, _primitives.isStream)(stream)) {
  4265. throw new _util.FormatError("bad ObjStm stream");
  4266. }
  4267. const first = stream.dict.get("First");
  4268. const n = stream.dict.get("N");
  4269. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  4270. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  4271. }
  4272. const parser = new _parser.Parser({
  4273. lexer: new _parser.Lexer(stream),
  4274. xref: this,
  4275. allowStreams: true
  4276. });
  4277. const nums = new Array(n);
  4278. for (let i = 0; i < n; ++i) {
  4279. const num = parser.getObj();
  4280. if (!Number.isInteger(num)) {
  4281. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  4282. }
  4283. const offset = parser.getObj();
  4284. if (!Number.isInteger(offset)) {
  4285. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  4286. }
  4287. nums[i] = num;
  4288. }
  4289. const entries = new Array(n);
  4290. for (let i = 0; i < n; ++i) {
  4291. const obj = parser.getObj();
  4292. entries[i] = obj;
  4293. if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === "endobj") {
  4294. parser.shift();
  4295. }
  4296. if ((0, _primitives.isStream)(obj)) {
  4297. continue;
  4298. }
  4299. const num = nums[i],
  4300. entry = this.entries[num];
  4301. if (entry && entry.offset === tableOffset && entry.gen === i) {
  4302. this._cacheMap.set(num, obj);
  4303. }
  4304. }
  4305. xrefEntry = entries[xrefEntry.gen];
  4306. if (xrefEntry === undefined) {
  4307. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  4308. }
  4309. return xrefEntry;
  4310. },
  4311. async fetchIfRefAsync(obj, suppressEncryption) {
  4312. if (obj instanceof _primitives.Ref) {
  4313. return this.fetchAsync(obj, suppressEncryption);
  4314. }
  4315. return obj;
  4316. },
  4317. async fetchAsync(ref, suppressEncryption) {
  4318. try {
  4319. return this.fetch(ref, suppressEncryption);
  4320. } catch (ex) {
  4321. if (!(ex instanceof _core_utils.MissingDataException)) {
  4322. throw ex;
  4323. }
  4324. await this.pdfManager.requestRange(ex.begin, ex.end);
  4325. return this.fetchAsync(ref, suppressEncryption);
  4326. }
  4327. },
  4328. getCatalogObj: function XRef_getCatalogObj() {
  4329. return this.root;
  4330. }
  4331. };
  4332. return XRef;
  4333. }();
  4334. exports.XRef = XRef;
  4335. class NameOrNumberTree {
  4336. constructor(root, xref, type) {
  4337. if (this.constructor === NameOrNumberTree) {
  4338. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  4339. }
  4340. this.root = root;
  4341. this.xref = xref;
  4342. this._type = type;
  4343. }
  4344. getAll() {
  4345. const dict = Object.create(null);
  4346. if (!this.root) {
  4347. return dict;
  4348. }
  4349. const xref = this.xref;
  4350. const processed = new _primitives.RefSet();
  4351. processed.put(this.root);
  4352. const queue = [this.root];
  4353. while (queue.length > 0) {
  4354. const obj = xref.fetchIfRef(queue.shift());
  4355. if (!(0, _primitives.isDict)(obj)) {
  4356. continue;
  4357. }
  4358. if (obj.has("Kids")) {
  4359. const kids = obj.get("Kids");
  4360. for (let i = 0, ii = kids.length; i < ii; i++) {
  4361. const kid = kids[i];
  4362. if (processed.has(kid)) {
  4363. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  4364. }
  4365. queue.push(kid);
  4366. processed.put(kid);
  4367. }
  4368. continue;
  4369. }
  4370. const entries = obj.get(this._type);
  4371. if (Array.isArray(entries)) {
  4372. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  4373. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  4374. }
  4375. }
  4376. }
  4377. return dict;
  4378. }
  4379. get(key) {
  4380. if (!this.root) {
  4381. return null;
  4382. }
  4383. const xref = this.xref;
  4384. let kidsOrEntries = xref.fetchIfRef(this.root);
  4385. let loopCount = 0;
  4386. const MAX_LEVELS = 10;
  4387. while (kidsOrEntries.has("Kids")) {
  4388. if (++loopCount > MAX_LEVELS) {
  4389. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  4390. return null;
  4391. }
  4392. const kids = kidsOrEntries.get("Kids");
  4393. if (!Array.isArray(kids)) {
  4394. return null;
  4395. }
  4396. let l = 0,
  4397. r = kids.length - 1;
  4398. while (l <= r) {
  4399. const m = l + r >> 1;
  4400. const kid = xref.fetchIfRef(kids[m]);
  4401. const limits = kid.get("Limits");
  4402. if (key < xref.fetchIfRef(limits[0])) {
  4403. r = m - 1;
  4404. } else if (key > xref.fetchIfRef(limits[1])) {
  4405. l = m + 1;
  4406. } else {
  4407. kidsOrEntries = xref.fetchIfRef(kids[m]);
  4408. break;
  4409. }
  4410. }
  4411. if (l > r) {
  4412. return null;
  4413. }
  4414. }
  4415. const entries = kidsOrEntries.get(this._type);
  4416. if (Array.isArray(entries)) {
  4417. let l = 0,
  4418. r = entries.length - 2;
  4419. while (l <= r) {
  4420. const tmp = l + r >> 1,
  4421. m = tmp + (tmp & 1);
  4422. const currentKey = xref.fetchIfRef(entries[m]);
  4423. if (key < currentKey) {
  4424. r = m - 2;
  4425. } else if (key > currentKey) {
  4426. l = m + 2;
  4427. } else {
  4428. return xref.fetchIfRef(entries[m + 1]);
  4429. }
  4430. }
  4431. (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`);
  4432. for (let m = 0, mm = entries.length; m < mm; m += 2) {
  4433. const currentKey = xref.fetchIfRef(entries[m]);
  4434. if (currentKey === key) {
  4435. (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`);
  4436. return xref.fetchIfRef(entries[m + 1]);
  4437. }
  4438. }
  4439. }
  4440. return null;
  4441. }
  4442. }
  4443. class NameTree extends NameOrNumberTree {
  4444. constructor(root, xref) {
  4445. super(root, xref, "Names");
  4446. }
  4447. }
  4448. class NumberTree extends NameOrNumberTree {
  4449. constructor(root, xref) {
  4450. super(root, xref, "Nums");
  4451. }
  4452. }
  4453. var FileSpec = function FileSpecClosure() {
  4454. function FileSpec(root, xref) {
  4455. if (!root || !(0, _primitives.isDict)(root)) {
  4456. return;
  4457. }
  4458. this.xref = xref;
  4459. this.root = root;
  4460. if (root.has("FS")) {
  4461. this.fs = root.get("FS");
  4462. }
  4463. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  4464. if (root.has("RF")) {
  4465. (0, _util.warn)("Related file specifications are not supported");
  4466. }
  4467. this.contentAvailable = true;
  4468. if (!root.has("EF")) {
  4469. this.contentAvailable = false;
  4470. (0, _util.warn)("Non-embedded file specifications are not supported");
  4471. }
  4472. }
  4473. function pickPlatformItem(dict) {
  4474. if (dict.has("UF")) {
  4475. return dict.get("UF");
  4476. } else if (dict.has("F")) {
  4477. return dict.get("F");
  4478. } else if (dict.has("Unix")) {
  4479. return dict.get("Unix");
  4480. } else if (dict.has("Mac")) {
  4481. return dict.get("Mac");
  4482. } else if (dict.has("DOS")) {
  4483. return dict.get("DOS");
  4484. }
  4485. return null;
  4486. }
  4487. FileSpec.prototype = {
  4488. get filename() {
  4489. if (!this._filename && this.root) {
  4490. var filename = pickPlatformItem(this.root) || "unnamed";
  4491. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  4492. }
  4493. return this._filename;
  4494. },
  4495. get content() {
  4496. if (!this.contentAvailable) {
  4497. return null;
  4498. }
  4499. if (!this.contentRef && this.root) {
  4500. this.contentRef = pickPlatformItem(this.root.get("EF"));
  4501. }
  4502. var content = null;
  4503. if (this.contentRef) {
  4504. var xref = this.xref;
  4505. var fileObj = xref.fetchIfRef(this.contentRef);
  4506. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  4507. content = fileObj.getBytes();
  4508. } else {
  4509. (0, _util.warn)("Embedded file specification points to non-existing/invalid " + "content");
  4510. }
  4511. } else {
  4512. (0, _util.warn)("Embedded file specification does not have a content");
  4513. }
  4514. return content;
  4515. },
  4516. get serializable() {
  4517. return {
  4518. filename: this.filename,
  4519. content: this.content
  4520. };
  4521. }
  4522. };
  4523. return FileSpec;
  4524. }();
  4525. exports.FileSpec = FileSpec;
  4526. const ObjectLoader = function () {
  4527. function mayHaveChildren(value) {
  4528. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  4529. }
  4530. function addChildren(node, nodesToVisit) {
  4531. if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) {
  4532. const dict = node instanceof _primitives.Dict ? node : node.dict;
  4533. const dictKeys = dict.getKeys();
  4534. for (let i = 0, ii = dictKeys.length; i < ii; i++) {
  4535. const rawValue = dict.getRaw(dictKeys[i]);
  4536. if (mayHaveChildren(rawValue)) {
  4537. nodesToVisit.push(rawValue);
  4538. }
  4539. }
  4540. } else if (Array.isArray(node)) {
  4541. for (let i = 0, ii = node.length; i < ii; i++) {
  4542. const value = node[i];
  4543. if (mayHaveChildren(value)) {
  4544. nodesToVisit.push(value);
  4545. }
  4546. }
  4547. }
  4548. }
  4549. function ObjectLoader(dict, keys, xref) {
  4550. this.dict = dict;
  4551. this.keys = keys;
  4552. this.xref = xref;
  4553. this.refSet = null;
  4554. }
  4555. ObjectLoader.prototype = {
  4556. async load() {
  4557. if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {
  4558. return undefined;
  4559. }
  4560. const {
  4561. keys,
  4562. dict
  4563. } = this;
  4564. this.refSet = new _primitives.RefSet();
  4565. const nodesToVisit = [];
  4566. for (let i = 0, ii = keys.length; i < ii; i++) {
  4567. const rawValue = dict.getRaw(keys[i]);
  4568. if (rawValue !== undefined) {
  4569. nodesToVisit.push(rawValue);
  4570. }
  4571. }
  4572. return this._walk(nodesToVisit);
  4573. },
  4574. async _walk(nodesToVisit) {
  4575. const nodesToRevisit = [];
  4576. const pendingRequests = [];
  4577. while (nodesToVisit.length) {
  4578. let currentNode = nodesToVisit.pop();
  4579. if (currentNode instanceof _primitives.Ref) {
  4580. if (this.refSet.has(currentNode)) {
  4581. continue;
  4582. }
  4583. try {
  4584. this.refSet.put(currentNode);
  4585. currentNode = this.xref.fetch(currentNode);
  4586. } catch (ex) {
  4587. if (!(ex instanceof _core_utils.MissingDataException)) {
  4588. throw ex;
  4589. }
  4590. nodesToRevisit.push(currentNode);
  4591. pendingRequests.push({
  4592. begin: ex.begin,
  4593. end: ex.end
  4594. });
  4595. }
  4596. }
  4597. if (currentNode && currentNode.getBaseStreams) {
  4598. const baseStreams = currentNode.getBaseStreams();
  4599. let foundMissingData = false;
  4600. for (let i = 0, ii = baseStreams.length; i < ii; i++) {
  4601. const stream = baseStreams[i];
  4602. if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
  4603. foundMissingData = true;
  4604. pendingRequests.push({
  4605. begin: stream.start,
  4606. end: stream.end
  4607. });
  4608. }
  4609. }
  4610. if (foundMissingData) {
  4611. nodesToRevisit.push(currentNode);
  4612. }
  4613. }
  4614. addChildren(currentNode, nodesToVisit);
  4615. }
  4616. if (pendingRequests.length) {
  4617. await this.xref.stream.manager.requestRanges(pendingRequests);
  4618. for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
  4619. const node = nodesToRevisit[i];
  4620. if (node instanceof _primitives.Ref) {
  4621. this.refSet.remove(node);
  4622. }
  4623. }
  4624. return this._walk(nodesToRevisit);
  4625. }
  4626. this.refSet = null;
  4627. return undefined;
  4628. }
  4629. };
  4630. return ObjectLoader;
  4631. }();
  4632. exports.ObjectLoader = ObjectLoader;
  4633. /***/ }),
  4634. /* 10 */
  4635. /***/ (function(module, exports, __w_pdfjs_require__) {
  4636. "use strict";
  4637. Object.defineProperty(exports, "__esModule", {
  4638. value: true
  4639. });
  4640. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  4641. var _stream = __w_pdfjs_require__(11);
  4642. var _util = __w_pdfjs_require__(2);
  4643. var _primitives = __w_pdfjs_require__(4);
  4644. var _core_utils = __w_pdfjs_require__(7);
  4645. var _ccitt_stream = __w_pdfjs_require__(12);
  4646. var _jbig2_stream = __w_pdfjs_require__(14);
  4647. var _jpeg_stream = __w_pdfjs_require__(17);
  4648. var _jpx_stream = __w_pdfjs_require__(19);
  4649. const MAX_LENGTH_TO_CACHE = 1000;
  4650. const MAX_ADLER32_LENGTH = 5552;
  4651. function computeAdler32(bytes) {
  4652. const bytesLength = bytes.length;
  4653. let a = 1,
  4654. b = 0;
  4655. for (let i = 0; i < bytesLength; ++i) {
  4656. a += bytes[i] & 0xff;
  4657. b += a;
  4658. }
  4659. return b % 65521 << 16 | a % 65521;
  4660. }
  4661. class Parser {
  4662. constructor({
  4663. lexer,
  4664. xref,
  4665. allowStreams = false,
  4666. recoveryMode = false
  4667. }) {
  4668. this.lexer = lexer;
  4669. this.xref = xref;
  4670. this.allowStreams = allowStreams;
  4671. this.recoveryMode = recoveryMode;
  4672. this.imageCache = Object.create(null);
  4673. this.refill();
  4674. }
  4675. refill() {
  4676. this.buf1 = this.lexer.getObj();
  4677. this.buf2 = this.lexer.getObj();
  4678. }
  4679. shift() {
  4680. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  4681. this.buf1 = this.buf2;
  4682. this.buf2 = null;
  4683. } else {
  4684. this.buf1 = this.buf2;
  4685. this.buf2 = this.lexer.getObj();
  4686. }
  4687. }
  4688. tryShift() {
  4689. try {
  4690. this.shift();
  4691. return true;
  4692. } catch (e) {
  4693. if (e instanceof _core_utils.MissingDataException) {
  4694. throw e;
  4695. }
  4696. return false;
  4697. }
  4698. }
  4699. getObj(cipherTransform = null) {
  4700. const buf1 = this.buf1;
  4701. this.shift();
  4702. if (buf1 instanceof _primitives.Cmd) {
  4703. switch (buf1.cmd) {
  4704. case "BI":
  4705. return this.makeInlineImage(cipherTransform);
  4706. case "[":
  4707. const array = [];
  4708. while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
  4709. array.push(this.getObj(cipherTransform));
  4710. }
  4711. if ((0, _primitives.isEOF)(this.buf1)) {
  4712. if (!this.recoveryMode) {
  4713. throw new _util.FormatError("End of file inside array");
  4714. }
  4715. return array;
  4716. }
  4717. this.shift();
  4718. return array;
  4719. case "<<":
  4720. const dict = new _primitives.Dict(this.xref);
  4721. while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
  4722. if (!(0, _primitives.isName)(this.buf1)) {
  4723. (0, _util.info)("Malformed dictionary: key must be a name object");
  4724. this.shift();
  4725. continue;
  4726. }
  4727. const key = this.buf1.name;
  4728. this.shift();
  4729. if ((0, _primitives.isEOF)(this.buf1)) {
  4730. break;
  4731. }
  4732. dict.set(key, this.getObj(cipherTransform));
  4733. }
  4734. if ((0, _primitives.isEOF)(this.buf1)) {
  4735. if (!this.recoveryMode) {
  4736. throw new _util.FormatError("End of file inside dictionary");
  4737. }
  4738. return dict;
  4739. }
  4740. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  4741. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  4742. }
  4743. this.shift();
  4744. return dict;
  4745. default:
  4746. return buf1;
  4747. }
  4748. }
  4749. if (Number.isInteger(buf1)) {
  4750. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  4751. const ref = _primitives.Ref.get(buf1, this.buf1);
  4752. this.shift();
  4753. this.shift();
  4754. return ref;
  4755. }
  4756. return buf1;
  4757. }
  4758. if (typeof buf1 === "string") {
  4759. if (cipherTransform) {
  4760. return cipherTransform.decryptString(buf1);
  4761. }
  4762. return buf1;
  4763. }
  4764. return buf1;
  4765. }
  4766. findDefaultInlineStreamEnd(stream) {
  4767. const E = 0x45,
  4768. I = 0x49,
  4769. SPACE = 0x20,
  4770. LF = 0xa,
  4771. CR = 0xd;
  4772. const n = 10,
  4773. NUL = 0x0;
  4774. const startPos = stream.pos;
  4775. let state = 0,
  4776. ch,
  4777. maybeEIPos;
  4778. while ((ch = stream.getByte()) !== -1) {
  4779. if (state === 0) {
  4780. state = ch === E ? 1 : 0;
  4781. } else if (state === 1) {
  4782. state = ch === I ? 2 : 0;
  4783. } else {
  4784. (0, _util.assert)(state === 2);
  4785. if (ch === SPACE || ch === LF || ch === CR) {
  4786. maybeEIPos = stream.pos;
  4787. const followingBytes = stream.peekBytes(n);
  4788. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  4789. ch = followingBytes[i];
  4790. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  4791. continue;
  4792. }
  4793. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  4794. state = 0;
  4795. break;
  4796. }
  4797. }
  4798. if (state === 2) {
  4799. break;
  4800. }
  4801. } else {
  4802. state = 0;
  4803. }
  4804. }
  4805. }
  4806. if (ch === -1) {
  4807. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  4808. if (maybeEIPos) {
  4809. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  4810. stream.skip(-(stream.pos - maybeEIPos));
  4811. }
  4812. }
  4813. let endOffset = 4;
  4814. stream.skip(-endOffset);
  4815. ch = stream.peekByte();
  4816. stream.skip(endOffset);
  4817. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  4818. endOffset--;
  4819. }
  4820. return stream.pos - endOffset - startPos;
  4821. }
  4822. findDCTDecodeInlineStreamEnd(stream) {
  4823. const startPos = stream.pos;
  4824. let foundEOI = false,
  4825. b,
  4826. markerLength;
  4827. while ((b = stream.getByte()) !== -1) {
  4828. if (b !== 0xff) {
  4829. continue;
  4830. }
  4831. switch (stream.getByte()) {
  4832. case 0x00:
  4833. break;
  4834. case 0xff:
  4835. stream.skip(-1);
  4836. break;
  4837. case 0xd9:
  4838. foundEOI = true;
  4839. break;
  4840. case 0xc0:
  4841. case 0xc1:
  4842. case 0xc2:
  4843. case 0xc3:
  4844. case 0xc5:
  4845. case 0xc6:
  4846. case 0xc7:
  4847. case 0xc9:
  4848. case 0xca:
  4849. case 0xcb:
  4850. case 0xcd:
  4851. case 0xce:
  4852. case 0xcf:
  4853. case 0xc4:
  4854. case 0xcc:
  4855. case 0xda:
  4856. case 0xdb:
  4857. case 0xdc:
  4858. case 0xdd:
  4859. case 0xde:
  4860. case 0xdf:
  4861. case 0xe0:
  4862. case 0xe1:
  4863. case 0xe2:
  4864. case 0xe3:
  4865. case 0xe4:
  4866. case 0xe5:
  4867. case 0xe6:
  4868. case 0xe7:
  4869. case 0xe8:
  4870. case 0xe9:
  4871. case 0xea:
  4872. case 0xeb:
  4873. case 0xec:
  4874. case 0xed:
  4875. case 0xee:
  4876. case 0xef:
  4877. case 0xfe:
  4878. markerLength = stream.getUint16();
  4879. if (markerLength > 2) {
  4880. stream.skip(markerLength - 2);
  4881. } else {
  4882. stream.skip(-2);
  4883. }
  4884. break;
  4885. }
  4886. if (foundEOI) {
  4887. break;
  4888. }
  4889. }
  4890. const length = stream.pos - startPos;
  4891. if (b === -1) {
  4892. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  4893. stream.skip(-length);
  4894. return this.findDefaultInlineStreamEnd(stream);
  4895. }
  4896. this.inlineStreamSkipEI(stream);
  4897. return length;
  4898. }
  4899. findASCII85DecodeInlineStreamEnd(stream) {
  4900. const TILDE = 0x7e,
  4901. GT = 0x3e;
  4902. const startPos = stream.pos;
  4903. let ch;
  4904. while ((ch = stream.getByte()) !== -1) {
  4905. if (ch === TILDE) {
  4906. const tildePos = stream.pos;
  4907. ch = stream.peekByte();
  4908. while ((0, _core_utils.isWhiteSpace)(ch)) {
  4909. stream.skip();
  4910. ch = stream.peekByte();
  4911. }
  4912. if (ch === GT) {
  4913. stream.skip();
  4914. break;
  4915. }
  4916. if (stream.pos > tildePos) {
  4917. const maybeEI = stream.peekBytes(2);
  4918. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  4919. break;
  4920. }
  4921. }
  4922. }
  4923. }
  4924. const length = stream.pos - startPos;
  4925. if (ch === -1) {
  4926. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  4927. stream.skip(-length);
  4928. return this.findDefaultInlineStreamEnd(stream);
  4929. }
  4930. this.inlineStreamSkipEI(stream);
  4931. return length;
  4932. }
  4933. findASCIIHexDecodeInlineStreamEnd(stream) {
  4934. const GT = 0x3e;
  4935. const startPos = stream.pos;
  4936. let ch;
  4937. while ((ch = stream.getByte()) !== -1) {
  4938. if (ch === GT) {
  4939. break;
  4940. }
  4941. }
  4942. const length = stream.pos - startPos;
  4943. if (ch === -1) {
  4944. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  4945. stream.skip(-length);
  4946. return this.findDefaultInlineStreamEnd(stream);
  4947. }
  4948. this.inlineStreamSkipEI(stream);
  4949. return length;
  4950. }
  4951. inlineStreamSkipEI(stream) {
  4952. const E = 0x45,
  4953. I = 0x49;
  4954. let state = 0,
  4955. ch;
  4956. while ((ch = stream.getByte()) !== -1) {
  4957. if (state === 0) {
  4958. state = ch === E ? 1 : 0;
  4959. } else if (state === 1) {
  4960. state = ch === I ? 2 : 0;
  4961. } else if (state === 2) {
  4962. break;
  4963. }
  4964. }
  4965. }
  4966. makeInlineImage(cipherTransform) {
  4967. const lexer = this.lexer;
  4968. const stream = lexer.stream;
  4969. const dict = new _primitives.Dict(this.xref);
  4970. let dictLength;
  4971. while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
  4972. if (!(0, _primitives.isName)(this.buf1)) {
  4973. throw new _util.FormatError("Dictionary key must be a name object");
  4974. }
  4975. const key = this.buf1.name;
  4976. this.shift();
  4977. if ((0, _primitives.isEOF)(this.buf1)) {
  4978. break;
  4979. }
  4980. dict.set(key, this.getObj(cipherTransform));
  4981. }
  4982. if (lexer.beginInlineImagePos !== -1) {
  4983. dictLength = stream.pos - lexer.beginInlineImagePos;
  4984. }
  4985. const filter = dict.get("Filter", "F");
  4986. let filterName;
  4987. if ((0, _primitives.isName)(filter)) {
  4988. filterName = filter.name;
  4989. } else if (Array.isArray(filter)) {
  4990. const filterZero = this.xref.fetchIfRef(filter[0]);
  4991. if ((0, _primitives.isName)(filterZero)) {
  4992. filterName = filterZero.name;
  4993. }
  4994. }
  4995. const startPos = stream.pos;
  4996. let length;
  4997. if (filterName === "DCTDecode" || filterName === "DCT") {
  4998. length = this.findDCTDecodeInlineStreamEnd(stream);
  4999. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  5000. length = this.findASCII85DecodeInlineStreamEnd(stream);
  5001. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  5002. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  5003. } else {
  5004. length = this.findDefaultInlineStreamEnd(stream);
  5005. }
  5006. let imageStream = stream.makeSubStream(startPos, length, dict);
  5007. let cacheKey;
  5008. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  5009. const imageBytes = imageStream.getBytes();
  5010. imageStream.reset();
  5011. const initialStreamPos = stream.pos;
  5012. stream.pos = lexer.beginInlineImagePos;
  5013. const dictBytes = stream.getBytes(dictLength);
  5014. stream.pos = initialStreamPos;
  5015. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  5016. const cacheEntry = this.imageCache[cacheKey];
  5017. if (cacheEntry !== undefined) {
  5018. this.buf2 = _primitives.Cmd.get("EI");
  5019. this.shift();
  5020. cacheEntry.reset();
  5021. return cacheEntry;
  5022. }
  5023. }
  5024. if (cipherTransform) {
  5025. imageStream = cipherTransform.createStream(imageStream, length);
  5026. }
  5027. imageStream = this.filter(imageStream, dict, length);
  5028. imageStream.dict = dict;
  5029. if (cacheKey !== undefined) {
  5030. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  5031. this.imageCache[cacheKey] = imageStream;
  5032. }
  5033. this.buf2 = _primitives.Cmd.get("EI");
  5034. this.shift();
  5035. return imageStream;
  5036. }
  5037. _findStreamLength(startPos, signature) {
  5038. const {
  5039. stream
  5040. } = this.lexer;
  5041. stream.pos = startPos;
  5042. const SCAN_BLOCK_LENGTH = 2048;
  5043. const signatureLength = signature.length;
  5044. while (stream.pos < stream.end) {
  5045. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  5046. const scanLength = scanBytes.length - signatureLength;
  5047. if (scanLength <= 0) {
  5048. break;
  5049. }
  5050. let pos = 0;
  5051. while (pos < scanLength) {
  5052. let j = 0;
  5053. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  5054. j++;
  5055. }
  5056. if (j >= signatureLength) {
  5057. stream.pos += pos;
  5058. return stream.pos - startPos;
  5059. }
  5060. pos++;
  5061. }
  5062. stream.pos += scanLength;
  5063. }
  5064. return -1;
  5065. }
  5066. makeStream(dict, cipherTransform) {
  5067. const lexer = this.lexer;
  5068. let stream = lexer.stream;
  5069. lexer.skipToNextLine();
  5070. const startPos = stream.pos - 1;
  5071. let length = dict.get("Length");
  5072. if (!Number.isInteger(length)) {
  5073. (0, _util.info)(`Bad length "${length}" in stream`);
  5074. length = 0;
  5075. }
  5076. stream.pos = startPos + length;
  5077. lexer.nextChar();
  5078. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  5079. this.shift();
  5080. } else {
  5081. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
  5082. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  5083. if (actualLength < 0) {
  5084. const MAX_TRUNCATION = 1;
  5085. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  5086. const end = ENDSTREAM_SIGNATURE.length - i;
  5087. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  5088. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  5089. if (maybeLength >= 0) {
  5090. const lastByte = stream.peekBytes(end + 1)[end];
  5091. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  5092. break;
  5093. }
  5094. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  5095. actualLength = maybeLength;
  5096. break;
  5097. }
  5098. }
  5099. if (actualLength < 0) {
  5100. throw new _util.FormatError("Missing endstream command.");
  5101. }
  5102. }
  5103. length = actualLength;
  5104. lexer.nextChar();
  5105. this.shift();
  5106. this.shift();
  5107. }
  5108. this.shift();
  5109. stream = stream.makeSubStream(startPos, length, dict);
  5110. if (cipherTransform) {
  5111. stream = cipherTransform.createStream(stream, length);
  5112. }
  5113. stream = this.filter(stream, dict, length);
  5114. stream.dict = dict;
  5115. return stream;
  5116. }
  5117. filter(stream, dict, length) {
  5118. let filter = dict.get("Filter", "F");
  5119. let params = dict.get("DecodeParms", "DP");
  5120. if ((0, _primitives.isName)(filter)) {
  5121. if (Array.isArray(params)) {
  5122. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  5123. }
  5124. return this.makeFilter(stream, filter.name, length, params);
  5125. }
  5126. let maybeLength = length;
  5127. if (Array.isArray(filter)) {
  5128. const filterArray = filter;
  5129. const paramsArray = params;
  5130. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  5131. filter = this.xref.fetchIfRef(filterArray[i]);
  5132. if (!(0, _primitives.isName)(filter)) {
  5133. throw new _util.FormatError(`Bad filter name "${filter}"`);
  5134. }
  5135. params = null;
  5136. if (Array.isArray(paramsArray) && i in paramsArray) {
  5137. params = this.xref.fetchIfRef(paramsArray[i]);
  5138. }
  5139. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  5140. maybeLength = null;
  5141. }
  5142. }
  5143. return stream;
  5144. }
  5145. makeFilter(stream, name, maybeLength, params) {
  5146. if (maybeLength === 0) {
  5147. (0, _util.warn)(`Empty "${name}" stream.`);
  5148. return new _stream.NullStream();
  5149. }
  5150. try {
  5151. const xrefStreamStats = this.xref.stats.streamTypes;
  5152. if (name === "FlateDecode" || name === "Fl") {
  5153. xrefStreamStats[_util.StreamType.FLATE] = true;
  5154. if (params) {
  5155. return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
  5156. }
  5157. return new _stream.FlateStream(stream, maybeLength);
  5158. }
  5159. if (name === "LZWDecode" || name === "LZW") {
  5160. xrefStreamStats[_util.StreamType.LZW] = true;
  5161. let earlyChange = 1;
  5162. if (params) {
  5163. if (params.has("EarlyChange")) {
  5164. earlyChange = params.get("EarlyChange");
  5165. }
  5166. return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  5167. }
  5168. return new _stream.LZWStream(stream, maybeLength, earlyChange);
  5169. }
  5170. if (name === "DCTDecode" || name === "DCT") {
  5171. xrefStreamStats[_util.StreamType.DCT] = true;
  5172. return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
  5173. }
  5174. if (name === "JPXDecode" || name === "JPX") {
  5175. xrefStreamStats[_util.StreamType.JPX] = true;
  5176. return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
  5177. }
  5178. if (name === "ASCII85Decode" || name === "A85") {
  5179. xrefStreamStats[_util.StreamType.A85] = true;
  5180. return new _stream.Ascii85Stream(stream, maybeLength);
  5181. }
  5182. if (name === "ASCIIHexDecode" || name === "AHx") {
  5183. xrefStreamStats[_util.StreamType.AHX] = true;
  5184. return new _stream.AsciiHexStream(stream, maybeLength);
  5185. }
  5186. if (name === "CCITTFaxDecode" || name === "CCF") {
  5187. xrefStreamStats[_util.StreamType.CCF] = true;
  5188. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  5189. }
  5190. if (name === "RunLengthDecode" || name === "RL") {
  5191. xrefStreamStats[_util.StreamType.RLX] = true;
  5192. return new _stream.RunLengthStream(stream, maybeLength);
  5193. }
  5194. if (name === "JBIG2Decode") {
  5195. xrefStreamStats[_util.StreamType.JBIG] = true;
  5196. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
  5197. }
  5198. (0, _util.warn)(`Filter "${name}" is not supported.`);
  5199. return stream;
  5200. } catch (ex) {
  5201. if (ex instanceof _core_utils.MissingDataException) {
  5202. throw ex;
  5203. }
  5204. (0, _util.warn)(`Invalid stream: "${ex}"`);
  5205. return new _stream.NullStream();
  5206. }
  5207. }
  5208. }
  5209. exports.Parser = Parser;
  5210. const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 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, 2, 0, 2, 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, 2, 0, 2, 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, 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];
  5211. function toHexDigit(ch) {
  5212. if (ch >= 0x30 && ch <= 0x39) {
  5213. return ch & 0x0f;
  5214. }
  5215. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  5216. return (ch & 0x0f) + 9;
  5217. }
  5218. return -1;
  5219. }
  5220. class Lexer {
  5221. constructor(stream, knownCommands = null) {
  5222. this.stream = stream;
  5223. this.nextChar();
  5224. this.strBuf = [];
  5225. this.knownCommands = knownCommands;
  5226. this._hexStringNumWarn = 0;
  5227. this.beginInlineImagePos = -1;
  5228. }
  5229. nextChar() {
  5230. return this.currentChar = this.stream.getByte();
  5231. }
  5232. peekChar() {
  5233. return this.stream.peekByte();
  5234. }
  5235. getNumber() {
  5236. let ch = this.currentChar;
  5237. let eNotation = false;
  5238. let divideBy = 0;
  5239. let sign = 0;
  5240. if (ch === 0x2d) {
  5241. sign = -1;
  5242. ch = this.nextChar();
  5243. if (ch === 0x2d) {
  5244. ch = this.nextChar();
  5245. }
  5246. } else if (ch === 0x2b) {
  5247. sign = 1;
  5248. ch = this.nextChar();
  5249. }
  5250. if (ch === 0x0a || ch === 0x0d) {
  5251. do {
  5252. ch = this.nextChar();
  5253. } while (ch === 0x0a || ch === 0x0d);
  5254. }
  5255. if (ch === 0x2e) {
  5256. divideBy = 10;
  5257. ch = this.nextChar();
  5258. }
  5259. if (ch < 0x30 || ch > 0x39) {
  5260. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  5261. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  5262. return 0;
  5263. }
  5264. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  5265. }
  5266. sign = sign || 1;
  5267. let baseValue = ch - 0x30;
  5268. let powerValue = 0;
  5269. let powerValueSign = 1;
  5270. while ((ch = this.nextChar()) >= 0) {
  5271. if (ch >= 0x30 && ch <= 0x39) {
  5272. const currentDigit = ch - 0x30;
  5273. if (eNotation) {
  5274. powerValue = powerValue * 10 + currentDigit;
  5275. } else {
  5276. if (divideBy !== 0) {
  5277. divideBy *= 10;
  5278. }
  5279. baseValue = baseValue * 10 + currentDigit;
  5280. }
  5281. } else if (ch === 0x2e) {
  5282. if (divideBy === 0) {
  5283. divideBy = 1;
  5284. } else {
  5285. break;
  5286. }
  5287. } else if (ch === 0x2d) {
  5288. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  5289. } else if (ch === 0x45 || ch === 0x65) {
  5290. ch = this.peekChar();
  5291. if (ch === 0x2b || ch === 0x2d) {
  5292. powerValueSign = ch === 0x2d ? -1 : 1;
  5293. this.nextChar();
  5294. } else if (ch < 0x30 || ch > 0x39) {
  5295. break;
  5296. }
  5297. eNotation = true;
  5298. } else {
  5299. break;
  5300. }
  5301. }
  5302. if (divideBy !== 0) {
  5303. baseValue /= divideBy;
  5304. }
  5305. if (eNotation) {
  5306. baseValue *= 10 ** (powerValueSign * powerValue);
  5307. }
  5308. return sign * baseValue;
  5309. }
  5310. getString() {
  5311. let numParen = 1;
  5312. let done = false;
  5313. const strBuf = this.strBuf;
  5314. strBuf.length = 0;
  5315. let ch = this.nextChar();
  5316. while (true) {
  5317. let charBuffered = false;
  5318. switch (ch | 0) {
  5319. case -1:
  5320. (0, _util.warn)("Unterminated string");
  5321. done = true;
  5322. break;
  5323. case 0x28:
  5324. ++numParen;
  5325. strBuf.push("(");
  5326. break;
  5327. case 0x29:
  5328. if (--numParen === 0) {
  5329. this.nextChar();
  5330. done = true;
  5331. } else {
  5332. strBuf.push(")");
  5333. }
  5334. break;
  5335. case 0x5c:
  5336. ch = this.nextChar();
  5337. switch (ch) {
  5338. case -1:
  5339. (0, _util.warn)("Unterminated string");
  5340. done = true;
  5341. break;
  5342. case 0x6e:
  5343. strBuf.push("\n");
  5344. break;
  5345. case 0x72:
  5346. strBuf.push("\r");
  5347. break;
  5348. case 0x74:
  5349. strBuf.push("\t");
  5350. break;
  5351. case 0x62:
  5352. strBuf.push("\b");
  5353. break;
  5354. case 0x66:
  5355. strBuf.push("\f");
  5356. break;
  5357. case 0x5c:
  5358. case 0x28:
  5359. case 0x29:
  5360. strBuf.push(String.fromCharCode(ch));
  5361. break;
  5362. case 0x30:
  5363. case 0x31:
  5364. case 0x32:
  5365. case 0x33:
  5366. case 0x34:
  5367. case 0x35:
  5368. case 0x36:
  5369. case 0x37:
  5370. let x = ch & 0x0f;
  5371. ch = this.nextChar();
  5372. charBuffered = true;
  5373. if (ch >= 0x30 && ch <= 0x37) {
  5374. x = (x << 3) + (ch & 0x0f);
  5375. ch = this.nextChar();
  5376. if (ch >= 0x30 && ch <= 0x37) {
  5377. charBuffered = false;
  5378. x = (x << 3) + (ch & 0x0f);
  5379. }
  5380. }
  5381. strBuf.push(String.fromCharCode(x));
  5382. break;
  5383. case 0x0d:
  5384. if (this.peekChar() === 0x0a) {
  5385. this.nextChar();
  5386. }
  5387. break;
  5388. case 0x0a:
  5389. break;
  5390. default:
  5391. strBuf.push(String.fromCharCode(ch));
  5392. break;
  5393. }
  5394. break;
  5395. default:
  5396. strBuf.push(String.fromCharCode(ch));
  5397. break;
  5398. }
  5399. if (done) {
  5400. break;
  5401. }
  5402. if (!charBuffered) {
  5403. ch = this.nextChar();
  5404. }
  5405. }
  5406. return strBuf.join("");
  5407. }
  5408. getName() {
  5409. let ch, previousCh;
  5410. const strBuf = this.strBuf;
  5411. strBuf.length = 0;
  5412. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  5413. if (ch === 0x23) {
  5414. ch = this.nextChar();
  5415. if (specialChars[ch]) {
  5416. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  5417. strBuf.push("#");
  5418. break;
  5419. }
  5420. const x = toHexDigit(ch);
  5421. if (x !== -1) {
  5422. previousCh = ch;
  5423. ch = this.nextChar();
  5424. const x2 = toHexDigit(ch);
  5425. if (x2 === -1) {
  5426. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  5427. strBuf.push("#", String.fromCharCode(previousCh));
  5428. if (specialChars[ch]) {
  5429. break;
  5430. }
  5431. strBuf.push(String.fromCharCode(ch));
  5432. continue;
  5433. }
  5434. strBuf.push(String.fromCharCode(x << 4 | x2));
  5435. } else {
  5436. strBuf.push("#", String.fromCharCode(ch));
  5437. }
  5438. } else {
  5439. strBuf.push(String.fromCharCode(ch));
  5440. }
  5441. }
  5442. if (strBuf.length > 127) {
  5443. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  5444. }
  5445. return _primitives.Name.get(strBuf.join(""));
  5446. }
  5447. _hexStringWarn(ch) {
  5448. const MAX_HEX_STRING_NUM_WARN = 5;
  5449. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  5450. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  5451. return;
  5452. }
  5453. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  5454. return;
  5455. }
  5456. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  5457. }
  5458. getHexString() {
  5459. const strBuf = this.strBuf;
  5460. strBuf.length = 0;
  5461. let ch = this.currentChar;
  5462. let isFirstHex = true;
  5463. let firstDigit, secondDigit;
  5464. this._hexStringNumWarn = 0;
  5465. while (true) {
  5466. if (ch < 0) {
  5467. (0, _util.warn)("Unterminated hex string");
  5468. break;
  5469. } else if (ch === 0x3e) {
  5470. this.nextChar();
  5471. break;
  5472. } else if (specialChars[ch] === 1) {
  5473. ch = this.nextChar();
  5474. continue;
  5475. } else {
  5476. if (isFirstHex) {
  5477. firstDigit = toHexDigit(ch);
  5478. if (firstDigit === -1) {
  5479. this._hexStringWarn(ch);
  5480. ch = this.nextChar();
  5481. continue;
  5482. }
  5483. } else {
  5484. secondDigit = toHexDigit(ch);
  5485. if (secondDigit === -1) {
  5486. this._hexStringWarn(ch);
  5487. ch = this.nextChar();
  5488. continue;
  5489. }
  5490. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  5491. }
  5492. isFirstHex = !isFirstHex;
  5493. ch = this.nextChar();
  5494. }
  5495. }
  5496. return strBuf.join("");
  5497. }
  5498. getObj() {
  5499. let comment = false;
  5500. let ch = this.currentChar;
  5501. while (true) {
  5502. if (ch < 0) {
  5503. return _primitives.EOF;
  5504. }
  5505. if (comment) {
  5506. if (ch === 0x0a || ch === 0x0d) {
  5507. comment = false;
  5508. }
  5509. } else if (ch === 0x25) {
  5510. comment = true;
  5511. } else if (specialChars[ch] !== 1) {
  5512. break;
  5513. }
  5514. ch = this.nextChar();
  5515. }
  5516. switch (ch | 0) {
  5517. case 0x30:
  5518. case 0x31:
  5519. case 0x32:
  5520. case 0x33:
  5521. case 0x34:
  5522. case 0x35:
  5523. case 0x36:
  5524. case 0x37:
  5525. case 0x38:
  5526. case 0x39:
  5527. case 0x2b:
  5528. case 0x2d:
  5529. case 0x2e:
  5530. return this.getNumber();
  5531. case 0x28:
  5532. return this.getString();
  5533. case 0x2f:
  5534. return this.getName();
  5535. case 0x5b:
  5536. this.nextChar();
  5537. return _primitives.Cmd.get("[");
  5538. case 0x5d:
  5539. this.nextChar();
  5540. return _primitives.Cmd.get("]");
  5541. case 0x3c:
  5542. ch = this.nextChar();
  5543. if (ch === 0x3c) {
  5544. this.nextChar();
  5545. return _primitives.Cmd.get("<<");
  5546. }
  5547. return this.getHexString();
  5548. case 0x3e:
  5549. ch = this.nextChar();
  5550. if (ch === 0x3e) {
  5551. this.nextChar();
  5552. return _primitives.Cmd.get(">>");
  5553. }
  5554. return _primitives.Cmd.get(">");
  5555. case 0x7b:
  5556. this.nextChar();
  5557. return _primitives.Cmd.get("{");
  5558. case 0x7d:
  5559. this.nextChar();
  5560. return _primitives.Cmd.get("}");
  5561. case 0x29:
  5562. this.nextChar();
  5563. throw new _util.FormatError(`Illegal character: ${ch}`);
  5564. }
  5565. let str = String.fromCharCode(ch);
  5566. const knownCommands = this.knownCommands;
  5567. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  5568. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  5569. const possibleCommand = str + String.fromCharCode(ch);
  5570. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  5571. break;
  5572. }
  5573. if (str.length === 128) {
  5574. throw new _util.FormatError(`Command token too long: ${str.length}`);
  5575. }
  5576. str = possibleCommand;
  5577. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  5578. }
  5579. if (str === "true") {
  5580. return true;
  5581. }
  5582. if (str === "false") {
  5583. return false;
  5584. }
  5585. if (str === "null") {
  5586. return null;
  5587. }
  5588. if (str === "BI") {
  5589. this.beginInlineImagePos = this.stream.pos;
  5590. }
  5591. return _primitives.Cmd.get(str);
  5592. }
  5593. skipToNextLine() {
  5594. let ch = this.currentChar;
  5595. while (ch >= 0) {
  5596. if (ch === 0x0d) {
  5597. ch = this.nextChar();
  5598. if (ch === 0x0a) {
  5599. this.nextChar();
  5600. }
  5601. break;
  5602. } else if (ch === 0x0a) {
  5603. this.nextChar();
  5604. break;
  5605. }
  5606. ch = this.nextChar();
  5607. }
  5608. }
  5609. }
  5610. exports.Lexer = Lexer;
  5611. class Linearization {
  5612. static create(stream) {
  5613. function getInt(linDict, name, allowZeroValue = false) {
  5614. const obj = linDict.get(name);
  5615. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  5616. return obj;
  5617. }
  5618. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  5619. }
  5620. function getHints(linDict) {
  5621. const hints = linDict.get("H");
  5622. let hintsLength;
  5623. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  5624. for (let index = 0; index < hintsLength; index++) {
  5625. const hint = hints[index];
  5626. if (!(Number.isInteger(hint) && hint > 0)) {
  5627. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  5628. }
  5629. }
  5630. return hints;
  5631. }
  5632. throw new Error("Hint array in the linearization dictionary is invalid.");
  5633. }
  5634. const parser = new Parser({
  5635. lexer: new Lexer(stream),
  5636. xref: null
  5637. });
  5638. const obj1 = parser.getObj();
  5639. const obj2 = parser.getObj();
  5640. const obj3 = parser.getObj();
  5641. const linDict = parser.getObj();
  5642. let obj, length;
  5643. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) {
  5644. return null;
  5645. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  5646. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  5647. }
  5648. return {
  5649. length,
  5650. hints: getHints(linDict),
  5651. objectNumberFirst: getInt(linDict, "O"),
  5652. endFirst: getInt(linDict, "E"),
  5653. numPages: getInt(linDict, "N"),
  5654. mainXRefEntriesOffset: getInt(linDict, "T"),
  5655. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  5656. };
  5657. }
  5658. }
  5659. exports.Linearization = Linearization;
  5660. /***/ }),
  5661. /* 11 */
  5662. /***/ (function(module, exports, __w_pdfjs_require__) {
  5663. "use strict";
  5664. Object.defineProperty(exports, "__esModule", {
  5665. value: true
  5666. });
  5667. exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
  5668. var _util = __w_pdfjs_require__(2);
  5669. var _primitives = __w_pdfjs_require__(4);
  5670. var _core_utils = __w_pdfjs_require__(7);
  5671. var Stream = function StreamClosure() {
  5672. function Stream(arrayBuffer, start, length, dict) {
  5673. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  5674. this.start = start || 0;
  5675. this.pos = this.start;
  5676. this.end = start + length || this.bytes.length;
  5677. this.dict = dict;
  5678. }
  5679. Stream.prototype = {
  5680. get length() {
  5681. return this.end - this.start;
  5682. },
  5683. get isEmpty() {
  5684. return this.length === 0;
  5685. },
  5686. getByte: function Stream_getByte() {
  5687. if (this.pos >= this.end) {
  5688. return -1;
  5689. }
  5690. return this.bytes[this.pos++];
  5691. },
  5692. getUint16: function Stream_getUint16() {
  5693. var b0 = this.getByte();
  5694. var b1 = this.getByte();
  5695. if (b0 === -1 || b1 === -1) {
  5696. return -1;
  5697. }
  5698. return (b0 << 8) + b1;
  5699. },
  5700. getInt32: function Stream_getInt32() {
  5701. var b0 = this.getByte();
  5702. var b1 = this.getByte();
  5703. var b2 = this.getByte();
  5704. var b3 = this.getByte();
  5705. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5706. },
  5707. getBytes(length, forceClamped = false) {
  5708. var bytes = this.bytes;
  5709. var pos = this.pos;
  5710. var strEnd = this.end;
  5711. if (!length) {
  5712. const subarray = bytes.subarray(pos, strEnd);
  5713. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  5714. }
  5715. var end = pos + length;
  5716. if (end > strEnd) {
  5717. end = strEnd;
  5718. }
  5719. this.pos = end;
  5720. const subarray = bytes.subarray(pos, end);
  5721. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  5722. },
  5723. peekByte: function Stream_peekByte() {
  5724. var peekedByte = this.getByte();
  5725. if (peekedByte !== -1) {
  5726. this.pos--;
  5727. }
  5728. return peekedByte;
  5729. },
  5730. peekBytes(length, forceClamped = false) {
  5731. var bytes = this.getBytes(length, forceClamped);
  5732. this.pos -= bytes.length;
  5733. return bytes;
  5734. },
  5735. getByteRange(begin, end) {
  5736. if (begin < 0) {
  5737. begin = 0;
  5738. }
  5739. if (end > this.end) {
  5740. end = this.end;
  5741. }
  5742. return this.bytes.subarray(begin, end);
  5743. },
  5744. skip: function Stream_skip(n) {
  5745. if (!n) {
  5746. n = 1;
  5747. }
  5748. this.pos += n;
  5749. },
  5750. reset: function Stream_reset() {
  5751. this.pos = this.start;
  5752. },
  5753. moveStart: function Stream_moveStart() {
  5754. this.start = this.pos;
  5755. },
  5756. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  5757. return new Stream(this.bytes.buffer, start, length, dict);
  5758. }
  5759. };
  5760. return Stream;
  5761. }();
  5762. exports.Stream = Stream;
  5763. var StringStream = function StringStreamClosure() {
  5764. function StringStream(str) {
  5765. const bytes = (0, _util.stringToBytes)(str);
  5766. Stream.call(this, bytes);
  5767. }
  5768. StringStream.prototype = Stream.prototype;
  5769. return StringStream;
  5770. }();
  5771. exports.StringStream = StringStream;
  5772. var DecodeStream = function DecodeStreamClosure() {
  5773. var emptyBuffer = new Uint8Array(0);
  5774. function DecodeStream(maybeMinBufferLength) {
  5775. this._rawMinBufferLength = maybeMinBufferLength || 0;
  5776. this.pos = 0;
  5777. this.bufferLength = 0;
  5778. this.eof = false;
  5779. this.buffer = emptyBuffer;
  5780. this.minBufferLength = 512;
  5781. if (maybeMinBufferLength) {
  5782. while (this.minBufferLength < maybeMinBufferLength) {
  5783. this.minBufferLength *= 2;
  5784. }
  5785. }
  5786. }
  5787. DecodeStream.prototype = {
  5788. get isEmpty() {
  5789. while (!this.eof && this.bufferLength === 0) {
  5790. this.readBlock();
  5791. }
  5792. return this.bufferLength === 0;
  5793. },
  5794. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  5795. var buffer = this.buffer;
  5796. if (requested <= buffer.byteLength) {
  5797. return buffer;
  5798. }
  5799. var size = this.minBufferLength;
  5800. while (size < requested) {
  5801. size *= 2;
  5802. }
  5803. var buffer2 = new Uint8Array(size);
  5804. buffer2.set(buffer);
  5805. return this.buffer = buffer2;
  5806. },
  5807. getByte: function DecodeStream_getByte() {
  5808. var pos = this.pos;
  5809. while (this.bufferLength <= pos) {
  5810. if (this.eof) {
  5811. return -1;
  5812. }
  5813. this.readBlock();
  5814. }
  5815. return this.buffer[this.pos++];
  5816. },
  5817. getUint16: function DecodeStream_getUint16() {
  5818. var b0 = this.getByte();
  5819. var b1 = this.getByte();
  5820. if (b0 === -1 || b1 === -1) {
  5821. return -1;
  5822. }
  5823. return (b0 << 8) + b1;
  5824. },
  5825. getInt32: function DecodeStream_getInt32() {
  5826. var b0 = this.getByte();
  5827. var b1 = this.getByte();
  5828. var b2 = this.getByte();
  5829. var b3 = this.getByte();
  5830. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5831. },
  5832. getBytes(length, forceClamped = false) {
  5833. var end,
  5834. pos = this.pos;
  5835. if (length) {
  5836. this.ensureBuffer(pos + length);
  5837. end = pos + length;
  5838. while (!this.eof && this.bufferLength < end) {
  5839. this.readBlock();
  5840. }
  5841. var bufEnd = this.bufferLength;
  5842. if (end > bufEnd) {
  5843. end = bufEnd;
  5844. }
  5845. } else {
  5846. while (!this.eof) {
  5847. this.readBlock();
  5848. }
  5849. end = this.bufferLength;
  5850. }
  5851. this.pos = end;
  5852. const subarray = this.buffer.subarray(pos, end);
  5853. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  5854. },
  5855. peekByte: function DecodeStream_peekByte() {
  5856. var peekedByte = this.getByte();
  5857. if (peekedByte !== -1) {
  5858. this.pos--;
  5859. }
  5860. return peekedByte;
  5861. },
  5862. peekBytes(length, forceClamped = false) {
  5863. var bytes = this.getBytes(length, forceClamped);
  5864. this.pos -= bytes.length;
  5865. return bytes;
  5866. },
  5867. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  5868. var end = start + length;
  5869. while (this.bufferLength <= end && !this.eof) {
  5870. this.readBlock();
  5871. }
  5872. return new Stream(this.buffer, start, length, dict);
  5873. },
  5874. getByteRange(begin, end) {
  5875. (0, _util.unreachable)("Should not call DecodeStream.getByteRange");
  5876. },
  5877. skip: function DecodeStream_skip(n) {
  5878. if (!n) {
  5879. n = 1;
  5880. }
  5881. this.pos += n;
  5882. },
  5883. reset: function DecodeStream_reset() {
  5884. this.pos = 0;
  5885. },
  5886. getBaseStreams: function DecodeStream_getBaseStreams() {
  5887. if (this.str && this.str.getBaseStreams) {
  5888. return this.str.getBaseStreams();
  5889. }
  5890. return [];
  5891. }
  5892. };
  5893. return DecodeStream;
  5894. }();
  5895. exports.DecodeStream = DecodeStream;
  5896. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  5897. function StreamsSequenceStream(streams) {
  5898. this.streams = streams;
  5899. let maybeLength = 0;
  5900. for (let i = 0, ii = streams.length; i < ii; i++) {
  5901. const stream = streams[i];
  5902. if (stream instanceof DecodeStream) {
  5903. maybeLength += stream._rawMinBufferLength;
  5904. } else {
  5905. maybeLength += stream.length;
  5906. }
  5907. }
  5908. DecodeStream.call(this, maybeLength);
  5909. }
  5910. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  5911. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  5912. var streams = this.streams;
  5913. if (streams.length === 0) {
  5914. this.eof = true;
  5915. return;
  5916. }
  5917. var stream = streams.shift();
  5918. var chunk = stream.getBytes();
  5919. var bufferLength = this.bufferLength;
  5920. var newLength = bufferLength + chunk.length;
  5921. var buffer = this.ensureBuffer(newLength);
  5922. buffer.set(chunk, bufferLength);
  5923. this.bufferLength = newLength;
  5924. };
  5925. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  5926. var baseStreams = [];
  5927. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  5928. var stream = this.streams[i];
  5929. if (stream.getBaseStreams) {
  5930. baseStreams.push(...stream.getBaseStreams());
  5931. }
  5932. }
  5933. return baseStreams;
  5934. };
  5935. return StreamsSequenceStream;
  5936. }();
  5937. exports.StreamsSequenceStream = StreamsSequenceStream;
  5938. var FlateStream = function FlateStreamClosure() {
  5939. var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  5940. var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
  5941. var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
  5942. var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
  5943. var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
  5944. function FlateStream(str, maybeLength) {
  5945. this.str = str;
  5946. this.dict = str.dict;
  5947. var cmf = str.getByte();
  5948. var flg = str.getByte();
  5949. if (cmf === -1 || flg === -1) {
  5950. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  5951. }
  5952. if ((cmf & 0x0f) !== 0x08) {
  5953. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  5954. }
  5955. if (((cmf << 8) + flg) % 31 !== 0) {
  5956. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  5957. }
  5958. if (flg & 0x20) {
  5959. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  5960. }
  5961. this.codeSize = 0;
  5962. this.codeBuf = 0;
  5963. DecodeStream.call(this, maybeLength);
  5964. }
  5965. FlateStream.prototype = Object.create(DecodeStream.prototype);
  5966. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  5967. var str = this.str;
  5968. var codeSize = this.codeSize;
  5969. var codeBuf = this.codeBuf;
  5970. var b;
  5971. while (codeSize < bits) {
  5972. if ((b = str.getByte()) === -1) {
  5973. throw new _util.FormatError("Bad encoding in flate stream");
  5974. }
  5975. codeBuf |= b << codeSize;
  5976. codeSize += 8;
  5977. }
  5978. b = codeBuf & (1 << bits) - 1;
  5979. this.codeBuf = codeBuf >> bits;
  5980. this.codeSize = codeSize -= bits;
  5981. return b;
  5982. };
  5983. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  5984. var str = this.str;
  5985. var codes = table[0];
  5986. var maxLen = table[1];
  5987. var codeSize = this.codeSize;
  5988. var codeBuf = this.codeBuf;
  5989. var b;
  5990. while (codeSize < maxLen) {
  5991. if ((b = str.getByte()) === -1) {
  5992. break;
  5993. }
  5994. codeBuf |= b << codeSize;
  5995. codeSize += 8;
  5996. }
  5997. var code = codes[codeBuf & (1 << maxLen) - 1];
  5998. var codeLen = code >> 16;
  5999. var codeVal = code & 0xffff;
  6000. if (codeLen < 1 || codeSize < codeLen) {
  6001. throw new _util.FormatError("Bad encoding in flate stream");
  6002. }
  6003. this.codeBuf = codeBuf >> codeLen;
  6004. this.codeSize = codeSize - codeLen;
  6005. return codeVal;
  6006. };
  6007. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  6008. var n = lengths.length;
  6009. var maxLen = 0;
  6010. var i;
  6011. for (i = 0; i < n; ++i) {
  6012. if (lengths[i] > maxLen) {
  6013. maxLen = lengths[i];
  6014. }
  6015. }
  6016. var size = 1 << maxLen;
  6017. var codes = new Int32Array(size);
  6018. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  6019. for (var val = 0; val < n; ++val) {
  6020. if (lengths[val] === len) {
  6021. var code2 = 0;
  6022. var t = code;
  6023. for (i = 0; i < len; ++i) {
  6024. code2 = code2 << 1 | t & 1;
  6025. t >>= 1;
  6026. }
  6027. for (i = code2; i < size; i += skip) {
  6028. codes[i] = len << 16 | val;
  6029. }
  6030. ++code;
  6031. }
  6032. }
  6033. }
  6034. return [codes, maxLen];
  6035. };
  6036. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  6037. var buffer, len;
  6038. var str = this.str;
  6039. var hdr = this.getBits(3);
  6040. if (hdr & 1) {
  6041. this.eof = true;
  6042. }
  6043. hdr >>= 1;
  6044. if (hdr === 0) {
  6045. var b;
  6046. if ((b = str.getByte()) === -1) {
  6047. throw new _util.FormatError("Bad block header in flate stream");
  6048. }
  6049. var blockLen = b;
  6050. if ((b = str.getByte()) === -1) {
  6051. throw new _util.FormatError("Bad block header in flate stream");
  6052. }
  6053. blockLen |= b << 8;
  6054. if ((b = str.getByte()) === -1) {
  6055. throw new _util.FormatError("Bad block header in flate stream");
  6056. }
  6057. var check = b;
  6058. if ((b = str.getByte()) === -1) {
  6059. throw new _util.FormatError("Bad block header in flate stream");
  6060. }
  6061. check |= b << 8;
  6062. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  6063. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  6064. }
  6065. this.codeBuf = 0;
  6066. this.codeSize = 0;
  6067. const bufferLength = this.bufferLength,
  6068. end = bufferLength + blockLen;
  6069. buffer = this.ensureBuffer(end);
  6070. this.bufferLength = end;
  6071. if (blockLen === 0) {
  6072. if (str.peekByte() === -1) {
  6073. this.eof = true;
  6074. }
  6075. } else {
  6076. const block = str.getBytes(blockLen);
  6077. buffer.set(block, bufferLength);
  6078. if (block.length < blockLen) {
  6079. this.eof = true;
  6080. }
  6081. }
  6082. return;
  6083. }
  6084. var litCodeTable;
  6085. var distCodeTable;
  6086. if (hdr === 1) {
  6087. litCodeTable = fixedLitCodeTab;
  6088. distCodeTable = fixedDistCodeTab;
  6089. } else if (hdr === 2) {
  6090. var numLitCodes = this.getBits(5) + 257;
  6091. var numDistCodes = this.getBits(5) + 1;
  6092. var numCodeLenCodes = this.getBits(4) + 4;
  6093. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  6094. var i;
  6095. for (i = 0; i < numCodeLenCodes; ++i) {
  6096. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  6097. }
  6098. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  6099. len = 0;
  6100. i = 0;
  6101. var codes = numLitCodes + numDistCodes;
  6102. var codeLengths = new Uint8Array(codes);
  6103. var bitsLength, bitsOffset, what;
  6104. while (i < codes) {
  6105. var code = this.getCode(codeLenCodeTab);
  6106. if (code === 16) {
  6107. bitsLength = 2;
  6108. bitsOffset = 3;
  6109. what = len;
  6110. } else if (code === 17) {
  6111. bitsLength = 3;
  6112. bitsOffset = 3;
  6113. what = len = 0;
  6114. } else if (code === 18) {
  6115. bitsLength = 7;
  6116. bitsOffset = 11;
  6117. what = len = 0;
  6118. } else {
  6119. codeLengths[i++] = len = code;
  6120. continue;
  6121. }
  6122. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  6123. while (repeatLength-- > 0) {
  6124. codeLengths[i++] = what;
  6125. }
  6126. }
  6127. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  6128. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  6129. } else {
  6130. throw new _util.FormatError("Unknown block type in flate stream");
  6131. }
  6132. buffer = this.buffer;
  6133. var limit = buffer ? buffer.length : 0;
  6134. var pos = this.bufferLength;
  6135. while (true) {
  6136. var code1 = this.getCode(litCodeTable);
  6137. if (code1 < 256) {
  6138. if (pos + 1 >= limit) {
  6139. buffer = this.ensureBuffer(pos + 1);
  6140. limit = buffer.length;
  6141. }
  6142. buffer[pos++] = code1;
  6143. continue;
  6144. }
  6145. if (code1 === 256) {
  6146. this.bufferLength = pos;
  6147. return;
  6148. }
  6149. code1 -= 257;
  6150. code1 = lengthDecode[code1];
  6151. var code2 = code1 >> 16;
  6152. if (code2 > 0) {
  6153. code2 = this.getBits(code2);
  6154. }
  6155. len = (code1 & 0xffff) + code2;
  6156. code1 = this.getCode(distCodeTable);
  6157. code1 = distDecode[code1];
  6158. code2 = code1 >> 16;
  6159. if (code2 > 0) {
  6160. code2 = this.getBits(code2);
  6161. }
  6162. var dist = (code1 & 0xffff) + code2;
  6163. if (pos + len >= limit) {
  6164. buffer = this.ensureBuffer(pos + len);
  6165. limit = buffer.length;
  6166. }
  6167. for (var k = 0; k < len; ++k, ++pos) {
  6168. buffer[pos] = buffer[pos - dist];
  6169. }
  6170. }
  6171. };
  6172. return FlateStream;
  6173. }();
  6174. exports.FlateStream = FlateStream;
  6175. var PredictorStream = function PredictorStreamClosure() {
  6176. function PredictorStream(str, maybeLength, params) {
  6177. if (!(0, _primitives.isDict)(params)) {
  6178. return str;
  6179. }
  6180. var predictor = this.predictor = params.get("Predictor") || 1;
  6181. if (predictor <= 1) {
  6182. return str;
  6183. }
  6184. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  6185. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  6186. }
  6187. if (predictor === 2) {
  6188. this.readBlock = this.readBlockTiff;
  6189. } else {
  6190. this.readBlock = this.readBlockPng;
  6191. }
  6192. this.str = str;
  6193. this.dict = str.dict;
  6194. var colors = this.colors = params.get("Colors") || 1;
  6195. var bits = this.bits = params.get("BitsPerComponent") || 8;
  6196. var columns = this.columns = params.get("Columns") || 1;
  6197. this.pixBytes = colors * bits + 7 >> 3;
  6198. this.rowBytes = columns * colors * bits + 7 >> 3;
  6199. DecodeStream.call(this, maybeLength);
  6200. return this;
  6201. }
  6202. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  6203. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  6204. var rowBytes = this.rowBytes;
  6205. var bufferLength = this.bufferLength;
  6206. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  6207. var bits = this.bits;
  6208. var colors = this.colors;
  6209. var rawBytes = this.str.getBytes(rowBytes);
  6210. this.eof = !rawBytes.length;
  6211. if (this.eof) {
  6212. return;
  6213. }
  6214. var inbuf = 0,
  6215. outbuf = 0;
  6216. var inbits = 0,
  6217. outbits = 0;
  6218. var pos = bufferLength;
  6219. var i;
  6220. if (bits === 1 && colors === 1) {
  6221. for (i = 0; i < rowBytes; ++i) {
  6222. var c = rawBytes[i] ^ inbuf;
  6223. c ^= c >> 1;
  6224. c ^= c >> 2;
  6225. c ^= c >> 4;
  6226. inbuf = (c & 1) << 7;
  6227. buffer[pos++] = c;
  6228. }
  6229. } else if (bits === 8) {
  6230. for (i = 0; i < colors; ++i) {
  6231. buffer[pos++] = rawBytes[i];
  6232. }
  6233. for (; i < rowBytes; ++i) {
  6234. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  6235. pos++;
  6236. }
  6237. } else if (bits === 16) {
  6238. var bytesPerPixel = colors * 2;
  6239. for (i = 0; i < bytesPerPixel; ++i) {
  6240. buffer[pos++] = rawBytes[i];
  6241. }
  6242. for (; i < rowBytes; i += 2) {
  6243. var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  6244. buffer[pos++] = sum >> 8 & 0xff;
  6245. buffer[pos++] = sum & 0xff;
  6246. }
  6247. } else {
  6248. var compArray = new Uint8Array(colors + 1);
  6249. var bitMask = (1 << bits) - 1;
  6250. var j = 0,
  6251. k = bufferLength;
  6252. var columns = this.columns;
  6253. for (i = 0; i < columns; ++i) {
  6254. for (var kk = 0; kk < colors; ++kk) {
  6255. if (inbits < bits) {
  6256. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  6257. inbits += 8;
  6258. }
  6259. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  6260. inbits -= bits;
  6261. outbuf = outbuf << bits | compArray[kk];
  6262. outbits += bits;
  6263. if (outbits >= 8) {
  6264. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  6265. outbits -= 8;
  6266. }
  6267. }
  6268. }
  6269. if (outbits > 0) {
  6270. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  6271. }
  6272. }
  6273. this.bufferLength += rowBytes;
  6274. };
  6275. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  6276. var rowBytes = this.rowBytes;
  6277. var pixBytes = this.pixBytes;
  6278. var predictor = this.str.getByte();
  6279. var rawBytes = this.str.getBytes(rowBytes);
  6280. this.eof = !rawBytes.length;
  6281. if (this.eof) {
  6282. return;
  6283. }
  6284. var bufferLength = this.bufferLength;
  6285. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  6286. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  6287. if (prevRow.length === 0) {
  6288. prevRow = new Uint8Array(rowBytes);
  6289. }
  6290. var i,
  6291. j = bufferLength,
  6292. up,
  6293. c;
  6294. switch (predictor) {
  6295. case 0:
  6296. for (i = 0; i < rowBytes; ++i) {
  6297. buffer[j++] = rawBytes[i];
  6298. }
  6299. break;
  6300. case 1:
  6301. for (i = 0; i < pixBytes; ++i) {
  6302. buffer[j++] = rawBytes[i];
  6303. }
  6304. for (; i < rowBytes; ++i) {
  6305. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  6306. j++;
  6307. }
  6308. break;
  6309. case 2:
  6310. for (i = 0; i < rowBytes; ++i) {
  6311. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  6312. }
  6313. break;
  6314. case 3:
  6315. for (i = 0; i < pixBytes; ++i) {
  6316. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  6317. }
  6318. for (; i < rowBytes; ++i) {
  6319. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  6320. j++;
  6321. }
  6322. break;
  6323. case 4:
  6324. for (i = 0; i < pixBytes; ++i) {
  6325. up = prevRow[i];
  6326. c = rawBytes[i];
  6327. buffer[j++] = up + c;
  6328. }
  6329. for (; i < rowBytes; ++i) {
  6330. up = prevRow[i];
  6331. var upLeft = prevRow[i - pixBytes];
  6332. var left = buffer[j - pixBytes];
  6333. var p = left + up - upLeft;
  6334. var pa = p - left;
  6335. if (pa < 0) {
  6336. pa = -pa;
  6337. }
  6338. var pb = p - up;
  6339. if (pb < 0) {
  6340. pb = -pb;
  6341. }
  6342. var pc = p - upLeft;
  6343. if (pc < 0) {
  6344. pc = -pc;
  6345. }
  6346. c = rawBytes[i];
  6347. if (pa <= pb && pa <= pc) {
  6348. buffer[j++] = left + c;
  6349. } else if (pb <= pc) {
  6350. buffer[j++] = up + c;
  6351. } else {
  6352. buffer[j++] = upLeft + c;
  6353. }
  6354. }
  6355. break;
  6356. default:
  6357. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  6358. }
  6359. this.bufferLength += rowBytes;
  6360. };
  6361. return PredictorStream;
  6362. }();
  6363. exports.PredictorStream = PredictorStream;
  6364. var DecryptStream = function DecryptStreamClosure() {
  6365. function DecryptStream(str, maybeLength, decrypt) {
  6366. this.str = str;
  6367. this.dict = str.dict;
  6368. this.decrypt = decrypt;
  6369. this.nextChunk = null;
  6370. this.initialized = false;
  6371. DecodeStream.call(this, maybeLength);
  6372. }
  6373. var chunkSize = 512;
  6374. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  6375. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  6376. var chunk;
  6377. if (this.initialized) {
  6378. chunk = this.nextChunk;
  6379. } else {
  6380. chunk = this.str.getBytes(chunkSize);
  6381. this.initialized = true;
  6382. }
  6383. if (!chunk || chunk.length === 0) {
  6384. this.eof = true;
  6385. return;
  6386. }
  6387. this.nextChunk = this.str.getBytes(chunkSize);
  6388. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  6389. var decrypt = this.decrypt;
  6390. chunk = decrypt(chunk, !hasMoreData);
  6391. var bufferLength = this.bufferLength;
  6392. var i,
  6393. n = chunk.length;
  6394. var buffer = this.ensureBuffer(bufferLength + n);
  6395. for (i = 0; i < n; i++) {
  6396. buffer[bufferLength++] = chunk[i];
  6397. }
  6398. this.bufferLength = bufferLength;
  6399. };
  6400. return DecryptStream;
  6401. }();
  6402. exports.DecryptStream = DecryptStream;
  6403. var Ascii85Stream = function Ascii85StreamClosure() {
  6404. function Ascii85Stream(str, maybeLength) {
  6405. this.str = str;
  6406. this.dict = str.dict;
  6407. this.input = new Uint8Array(5);
  6408. if (maybeLength) {
  6409. maybeLength = 0.8 * maybeLength;
  6410. }
  6411. DecodeStream.call(this, maybeLength);
  6412. }
  6413. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  6414. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  6415. var TILDA_CHAR = 0x7e;
  6416. var Z_LOWER_CHAR = 0x7a;
  6417. var EOF = -1;
  6418. var str = this.str;
  6419. var c = str.getByte();
  6420. while ((0, _core_utils.isWhiteSpace)(c)) {
  6421. c = str.getByte();
  6422. }
  6423. if (c === EOF || c === TILDA_CHAR) {
  6424. this.eof = true;
  6425. return;
  6426. }
  6427. var bufferLength = this.bufferLength,
  6428. buffer;
  6429. var i;
  6430. if (c === Z_LOWER_CHAR) {
  6431. buffer = this.ensureBuffer(bufferLength + 4);
  6432. for (i = 0; i < 4; ++i) {
  6433. buffer[bufferLength + i] = 0;
  6434. }
  6435. this.bufferLength += 4;
  6436. } else {
  6437. var input = this.input;
  6438. input[0] = c;
  6439. for (i = 1; i < 5; ++i) {
  6440. c = str.getByte();
  6441. while ((0, _core_utils.isWhiteSpace)(c)) {
  6442. c = str.getByte();
  6443. }
  6444. input[i] = c;
  6445. if (c === EOF || c === TILDA_CHAR) {
  6446. break;
  6447. }
  6448. }
  6449. buffer = this.ensureBuffer(bufferLength + i - 1);
  6450. this.bufferLength += i - 1;
  6451. if (i < 5) {
  6452. for (; i < 5; ++i) {
  6453. input[i] = 0x21 + 84;
  6454. }
  6455. this.eof = true;
  6456. }
  6457. var t = 0;
  6458. for (i = 0; i < 5; ++i) {
  6459. t = t * 85 + (input[i] - 0x21);
  6460. }
  6461. for (i = 3; i >= 0; --i) {
  6462. buffer[bufferLength + i] = t & 0xff;
  6463. t >>= 8;
  6464. }
  6465. }
  6466. };
  6467. return Ascii85Stream;
  6468. }();
  6469. exports.Ascii85Stream = Ascii85Stream;
  6470. var AsciiHexStream = function AsciiHexStreamClosure() {
  6471. function AsciiHexStream(str, maybeLength) {
  6472. this.str = str;
  6473. this.dict = str.dict;
  6474. this.firstDigit = -1;
  6475. if (maybeLength) {
  6476. maybeLength = 0.5 * maybeLength;
  6477. }
  6478. DecodeStream.call(this, maybeLength);
  6479. }
  6480. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  6481. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  6482. var UPSTREAM_BLOCK_SIZE = 8000;
  6483. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  6484. if (!bytes.length) {
  6485. this.eof = true;
  6486. return;
  6487. }
  6488. var maxDecodeLength = bytes.length + 1 >> 1;
  6489. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  6490. var bufferLength = this.bufferLength;
  6491. var firstDigit = this.firstDigit;
  6492. for (var i = 0, ii = bytes.length; i < ii; i++) {
  6493. var ch = bytes[i],
  6494. digit;
  6495. if (ch >= 0x30 && ch <= 0x39) {
  6496. digit = ch & 0x0f;
  6497. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  6498. digit = (ch & 0x0f) + 9;
  6499. } else if (ch === 0x3e) {
  6500. this.eof = true;
  6501. break;
  6502. } else {
  6503. continue;
  6504. }
  6505. if (firstDigit < 0) {
  6506. firstDigit = digit;
  6507. } else {
  6508. buffer[bufferLength++] = firstDigit << 4 | digit;
  6509. firstDigit = -1;
  6510. }
  6511. }
  6512. if (firstDigit >= 0 && this.eof) {
  6513. buffer[bufferLength++] = firstDigit << 4;
  6514. firstDigit = -1;
  6515. }
  6516. this.firstDigit = firstDigit;
  6517. this.bufferLength = bufferLength;
  6518. };
  6519. return AsciiHexStream;
  6520. }();
  6521. exports.AsciiHexStream = AsciiHexStream;
  6522. var RunLengthStream = function RunLengthStreamClosure() {
  6523. function RunLengthStream(str, maybeLength) {
  6524. this.str = str;
  6525. this.dict = str.dict;
  6526. DecodeStream.call(this, maybeLength);
  6527. }
  6528. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  6529. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  6530. var repeatHeader = this.str.getBytes(2);
  6531. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  6532. this.eof = true;
  6533. return;
  6534. }
  6535. var buffer;
  6536. var bufferLength = this.bufferLength;
  6537. var n = repeatHeader[0];
  6538. if (n < 128) {
  6539. buffer = this.ensureBuffer(bufferLength + n + 1);
  6540. buffer[bufferLength++] = repeatHeader[1];
  6541. if (n > 0) {
  6542. var source = this.str.getBytes(n);
  6543. buffer.set(source, bufferLength);
  6544. bufferLength += n;
  6545. }
  6546. } else {
  6547. n = 257 - n;
  6548. var b = repeatHeader[1];
  6549. buffer = this.ensureBuffer(bufferLength + n + 1);
  6550. for (var i = 0; i < n; i++) {
  6551. buffer[bufferLength++] = b;
  6552. }
  6553. }
  6554. this.bufferLength = bufferLength;
  6555. };
  6556. return RunLengthStream;
  6557. }();
  6558. exports.RunLengthStream = RunLengthStream;
  6559. var LZWStream = function LZWStreamClosure() {
  6560. function LZWStream(str, maybeLength, earlyChange) {
  6561. this.str = str;
  6562. this.dict = str.dict;
  6563. this.cachedData = 0;
  6564. this.bitsCached = 0;
  6565. var maxLzwDictionarySize = 4096;
  6566. var lzwState = {
  6567. earlyChange,
  6568. codeLength: 9,
  6569. nextCode: 258,
  6570. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  6571. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  6572. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  6573. currentSequence: new Uint8Array(maxLzwDictionarySize),
  6574. currentSequenceLength: 0
  6575. };
  6576. for (var i = 0; i < 256; ++i) {
  6577. lzwState.dictionaryValues[i] = i;
  6578. lzwState.dictionaryLengths[i] = 1;
  6579. }
  6580. this.lzwState = lzwState;
  6581. DecodeStream.call(this, maybeLength);
  6582. }
  6583. LZWStream.prototype = Object.create(DecodeStream.prototype);
  6584. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  6585. var bitsCached = this.bitsCached;
  6586. var cachedData = this.cachedData;
  6587. while (bitsCached < n) {
  6588. var c = this.str.getByte();
  6589. if (c === -1) {
  6590. this.eof = true;
  6591. return null;
  6592. }
  6593. cachedData = cachedData << 8 | c;
  6594. bitsCached += 8;
  6595. }
  6596. this.bitsCached = bitsCached -= n;
  6597. this.cachedData = cachedData;
  6598. this.lastCode = null;
  6599. return cachedData >>> bitsCached & (1 << n) - 1;
  6600. };
  6601. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  6602. var blockSize = 512;
  6603. var estimatedDecodedSize = blockSize * 2,
  6604. decodedSizeDelta = blockSize;
  6605. var i, j, q;
  6606. var lzwState = this.lzwState;
  6607. if (!lzwState) {
  6608. return;
  6609. }
  6610. var earlyChange = lzwState.earlyChange;
  6611. var nextCode = lzwState.nextCode;
  6612. var dictionaryValues = lzwState.dictionaryValues;
  6613. var dictionaryLengths = lzwState.dictionaryLengths;
  6614. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  6615. var codeLength = lzwState.codeLength;
  6616. var prevCode = lzwState.prevCode;
  6617. var currentSequence = lzwState.currentSequence;
  6618. var currentSequenceLength = lzwState.currentSequenceLength;
  6619. var decodedLength = 0;
  6620. var currentBufferLength = this.bufferLength;
  6621. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  6622. for (i = 0; i < blockSize; i++) {
  6623. var code = this.readBits(codeLength);
  6624. var hasPrev = currentSequenceLength > 0;
  6625. if (code < 256) {
  6626. currentSequence[0] = code;
  6627. currentSequenceLength = 1;
  6628. } else if (code >= 258) {
  6629. if (code < nextCode) {
  6630. currentSequenceLength = dictionaryLengths[code];
  6631. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  6632. currentSequence[j] = dictionaryValues[q];
  6633. q = dictionaryPrevCodes[q];
  6634. }
  6635. } else {
  6636. currentSequence[currentSequenceLength++] = currentSequence[0];
  6637. }
  6638. } else if (code === 256) {
  6639. codeLength = 9;
  6640. nextCode = 258;
  6641. currentSequenceLength = 0;
  6642. continue;
  6643. } else {
  6644. this.eof = true;
  6645. delete this.lzwState;
  6646. break;
  6647. }
  6648. if (hasPrev) {
  6649. dictionaryPrevCodes[nextCode] = prevCode;
  6650. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  6651. dictionaryValues[nextCode] = currentSequence[0];
  6652. nextCode++;
  6653. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  6654. }
  6655. prevCode = code;
  6656. decodedLength += currentSequenceLength;
  6657. if (estimatedDecodedSize < decodedLength) {
  6658. do {
  6659. estimatedDecodedSize += decodedSizeDelta;
  6660. } while (estimatedDecodedSize < decodedLength);
  6661. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  6662. }
  6663. for (j = 0; j < currentSequenceLength; j++) {
  6664. buffer[currentBufferLength++] = currentSequence[j];
  6665. }
  6666. }
  6667. lzwState.nextCode = nextCode;
  6668. lzwState.codeLength = codeLength;
  6669. lzwState.prevCode = prevCode;
  6670. lzwState.currentSequenceLength = currentSequenceLength;
  6671. this.bufferLength = currentBufferLength;
  6672. };
  6673. return LZWStream;
  6674. }();
  6675. exports.LZWStream = LZWStream;
  6676. var NullStream = function NullStreamClosure() {
  6677. function NullStream() {
  6678. Stream.call(this, new Uint8Array(0));
  6679. }
  6680. NullStream.prototype = Stream.prototype;
  6681. return NullStream;
  6682. }();
  6683. exports.NullStream = NullStream;
  6684. /***/ }),
  6685. /* 12 */
  6686. /***/ (function(module, exports, __w_pdfjs_require__) {
  6687. "use strict";
  6688. Object.defineProperty(exports, "__esModule", {
  6689. value: true
  6690. });
  6691. exports.CCITTFaxStream = void 0;
  6692. var _primitives = __w_pdfjs_require__(4);
  6693. var _ccitt = __w_pdfjs_require__(13);
  6694. var _stream = __w_pdfjs_require__(11);
  6695. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  6696. function CCITTFaxStream(str, maybeLength, params) {
  6697. this.str = str;
  6698. this.dict = str.dict;
  6699. if (!(0, _primitives.isDict)(params)) {
  6700. params = _primitives.Dict.empty;
  6701. }
  6702. const source = {
  6703. next() {
  6704. return str.getByte();
  6705. }
  6706. };
  6707. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  6708. K: params.get("K"),
  6709. EndOfLine: params.get("EndOfLine"),
  6710. EncodedByteAlign: params.get("EncodedByteAlign"),
  6711. Columns: params.get("Columns"),
  6712. Rows: params.get("Rows"),
  6713. EndOfBlock: params.get("EndOfBlock"),
  6714. BlackIs1: params.get("BlackIs1")
  6715. });
  6716. _stream.DecodeStream.call(this, maybeLength);
  6717. }
  6718. CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  6719. CCITTFaxStream.prototype.readBlock = function () {
  6720. while (!this.eof) {
  6721. const c = this.ccittFaxDecoder.readNextChar();
  6722. if (c === -1) {
  6723. this.eof = true;
  6724. return;
  6725. }
  6726. this.ensureBuffer(this.bufferLength + 1);
  6727. this.buffer[this.bufferLength++] = c;
  6728. }
  6729. };
  6730. return CCITTFaxStream;
  6731. }();
  6732. exports.CCITTFaxStream = CCITTFaxStream;
  6733. /***/ }),
  6734. /* 13 */
  6735. /***/ (function(module, exports, __w_pdfjs_require__) {
  6736. "use strict";
  6737. Object.defineProperty(exports, "__esModule", {
  6738. value: true
  6739. });
  6740. exports.CCITTFaxDecoder = void 0;
  6741. var _util = __w_pdfjs_require__(2);
  6742. const CCITTFaxDecoder = function CCITTFaxDecoder() {
  6743. const ccittEOL = -2;
  6744. const ccittEOF = -1;
  6745. const twoDimPass = 0;
  6746. const twoDimHoriz = 1;
  6747. const twoDimVert0 = 2;
  6748. const twoDimVertR1 = 3;
  6749. const twoDimVertL1 = 4;
  6750. const twoDimVertR2 = 5;
  6751. const twoDimVertL2 = 6;
  6752. const twoDimVertR3 = 7;
  6753. const twoDimVertL3 = 8;
  6754. const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
  6755. const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
  6756. const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
  6757. const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
  6758. const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
  6759. const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
  6760. function CCITTFaxDecoder(source, options = {}) {
  6761. if (!source || typeof source.next !== "function") {
  6762. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  6763. }
  6764. this.source = source;
  6765. this.eof = false;
  6766. this.encoding = options["K"] || 0;
  6767. this.eoline = options["EndOfLine"] || false;
  6768. this.byteAlign = options["EncodedByteAlign"] || false;
  6769. this.columns = options["Columns"] || 1728;
  6770. this.rows = options["Rows"] || 0;
  6771. let eoblock = options["EndOfBlock"];
  6772. if (eoblock === null || eoblock === undefined) {
  6773. eoblock = true;
  6774. }
  6775. this.eoblock = eoblock;
  6776. this.black = options["BlackIs1"] || false;
  6777. this.codingLine = new Uint32Array(this.columns + 1);
  6778. this.refLine = new Uint32Array(this.columns + 2);
  6779. this.codingLine[0] = this.columns;
  6780. this.codingPos = 0;
  6781. this.row = 0;
  6782. this.nextLine2D = this.encoding < 0;
  6783. this.inputBits = 0;
  6784. this.inputBuf = 0;
  6785. this.outputBits = 0;
  6786. this.rowsDone = false;
  6787. let code1;
  6788. while ((code1 = this._lookBits(12)) === 0) {
  6789. this._eatBits(1);
  6790. }
  6791. if (code1 === 1) {
  6792. this._eatBits(12);
  6793. }
  6794. if (this.encoding > 0) {
  6795. this.nextLine2D = !this._lookBits(1);
  6796. this._eatBits(1);
  6797. }
  6798. }
  6799. CCITTFaxDecoder.prototype = {
  6800. readNextChar() {
  6801. if (this.eof) {
  6802. return -1;
  6803. }
  6804. const refLine = this.refLine;
  6805. const codingLine = this.codingLine;
  6806. const columns = this.columns;
  6807. let refPos, blackPixels, bits, i;
  6808. if (this.outputBits === 0) {
  6809. if (this.rowsDone) {
  6810. this.eof = true;
  6811. }
  6812. if (this.eof) {
  6813. return -1;
  6814. }
  6815. this.err = false;
  6816. let code1, code2, code3;
  6817. if (this.nextLine2D) {
  6818. for (i = 0; codingLine[i] < columns; ++i) {
  6819. refLine[i] = codingLine[i];
  6820. }
  6821. refLine[i++] = columns;
  6822. refLine[i] = columns;
  6823. codingLine[0] = 0;
  6824. this.codingPos = 0;
  6825. refPos = 0;
  6826. blackPixels = 0;
  6827. while (codingLine[this.codingPos] < columns) {
  6828. code1 = this._getTwoDimCode();
  6829. switch (code1) {
  6830. case twoDimPass:
  6831. this._addPixels(refLine[refPos + 1], blackPixels);
  6832. if (refLine[refPos + 1] < columns) {
  6833. refPos += 2;
  6834. }
  6835. break;
  6836. case twoDimHoriz:
  6837. code1 = code2 = 0;
  6838. if (blackPixels) {
  6839. do {
  6840. code1 += code3 = this._getBlackCode();
  6841. } while (code3 >= 64);
  6842. do {
  6843. code2 += code3 = this._getWhiteCode();
  6844. } while (code3 >= 64);
  6845. } else {
  6846. do {
  6847. code1 += code3 = this._getWhiteCode();
  6848. } while (code3 >= 64);
  6849. do {
  6850. code2 += code3 = this._getBlackCode();
  6851. } while (code3 >= 64);
  6852. }
  6853. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  6854. if (codingLine[this.codingPos] < columns) {
  6855. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  6856. }
  6857. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6858. refPos += 2;
  6859. }
  6860. break;
  6861. case twoDimVertR3:
  6862. this._addPixels(refLine[refPos] + 3, blackPixels);
  6863. blackPixels ^= 1;
  6864. if (codingLine[this.codingPos] < columns) {
  6865. ++refPos;
  6866. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6867. refPos += 2;
  6868. }
  6869. }
  6870. break;
  6871. case twoDimVertR2:
  6872. this._addPixels(refLine[refPos] + 2, blackPixels);
  6873. blackPixels ^= 1;
  6874. if (codingLine[this.codingPos] < columns) {
  6875. ++refPos;
  6876. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6877. refPos += 2;
  6878. }
  6879. }
  6880. break;
  6881. case twoDimVertR1:
  6882. this._addPixels(refLine[refPos] + 1, blackPixels);
  6883. blackPixels ^= 1;
  6884. if (codingLine[this.codingPos] < columns) {
  6885. ++refPos;
  6886. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6887. refPos += 2;
  6888. }
  6889. }
  6890. break;
  6891. case twoDimVert0:
  6892. this._addPixels(refLine[refPos], blackPixels);
  6893. blackPixels ^= 1;
  6894. if (codingLine[this.codingPos] < columns) {
  6895. ++refPos;
  6896. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6897. refPos += 2;
  6898. }
  6899. }
  6900. break;
  6901. case twoDimVertL3:
  6902. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  6903. blackPixels ^= 1;
  6904. if (codingLine[this.codingPos] < columns) {
  6905. if (refPos > 0) {
  6906. --refPos;
  6907. } else {
  6908. ++refPos;
  6909. }
  6910. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6911. refPos += 2;
  6912. }
  6913. }
  6914. break;
  6915. case twoDimVertL2:
  6916. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  6917. blackPixels ^= 1;
  6918. if (codingLine[this.codingPos] < columns) {
  6919. if (refPos > 0) {
  6920. --refPos;
  6921. } else {
  6922. ++refPos;
  6923. }
  6924. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6925. refPos += 2;
  6926. }
  6927. }
  6928. break;
  6929. case twoDimVertL1:
  6930. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  6931. blackPixels ^= 1;
  6932. if (codingLine[this.codingPos] < columns) {
  6933. if (refPos > 0) {
  6934. --refPos;
  6935. } else {
  6936. ++refPos;
  6937. }
  6938. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6939. refPos += 2;
  6940. }
  6941. }
  6942. break;
  6943. case ccittEOF:
  6944. this._addPixels(columns, 0);
  6945. this.eof = true;
  6946. break;
  6947. default:
  6948. (0, _util.info)("bad 2d code");
  6949. this._addPixels(columns, 0);
  6950. this.err = true;
  6951. }
  6952. }
  6953. } else {
  6954. codingLine[0] = 0;
  6955. this.codingPos = 0;
  6956. blackPixels = 0;
  6957. while (codingLine[this.codingPos] < columns) {
  6958. code1 = 0;
  6959. if (blackPixels) {
  6960. do {
  6961. code1 += code3 = this._getBlackCode();
  6962. } while (code3 >= 64);
  6963. } else {
  6964. do {
  6965. code1 += code3 = this._getWhiteCode();
  6966. } while (code3 >= 64);
  6967. }
  6968. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  6969. blackPixels ^= 1;
  6970. }
  6971. }
  6972. let gotEOL = false;
  6973. if (this.byteAlign) {
  6974. this.inputBits &= ~7;
  6975. }
  6976. if (!this.eoblock && this.row === this.rows - 1) {
  6977. this.rowsDone = true;
  6978. } else {
  6979. code1 = this._lookBits(12);
  6980. if (this.eoline) {
  6981. while (code1 !== ccittEOF && code1 !== 1) {
  6982. this._eatBits(1);
  6983. code1 = this._lookBits(12);
  6984. }
  6985. } else {
  6986. while (code1 === 0) {
  6987. this._eatBits(1);
  6988. code1 = this._lookBits(12);
  6989. }
  6990. }
  6991. if (code1 === 1) {
  6992. this._eatBits(12);
  6993. gotEOL = true;
  6994. } else if (code1 === ccittEOF) {
  6995. this.eof = true;
  6996. }
  6997. }
  6998. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  6999. this.nextLine2D = !this._lookBits(1);
  7000. this._eatBits(1);
  7001. }
  7002. if (this.eoblock && gotEOL && this.byteAlign) {
  7003. code1 = this._lookBits(12);
  7004. if (code1 === 1) {
  7005. this._eatBits(12);
  7006. if (this.encoding > 0) {
  7007. this._lookBits(1);
  7008. this._eatBits(1);
  7009. }
  7010. if (this.encoding >= 0) {
  7011. for (i = 0; i < 4; ++i) {
  7012. code1 = this._lookBits(12);
  7013. if (code1 !== 1) {
  7014. (0, _util.info)("bad rtc code: " + code1);
  7015. }
  7016. this._eatBits(12);
  7017. if (this.encoding > 0) {
  7018. this._lookBits(1);
  7019. this._eatBits(1);
  7020. }
  7021. }
  7022. }
  7023. this.eof = true;
  7024. }
  7025. } else if (this.err && this.eoline) {
  7026. while (true) {
  7027. code1 = this._lookBits(13);
  7028. if (code1 === ccittEOF) {
  7029. this.eof = true;
  7030. return -1;
  7031. }
  7032. if (code1 >> 1 === 1) {
  7033. break;
  7034. }
  7035. this._eatBits(1);
  7036. }
  7037. this._eatBits(12);
  7038. if (this.encoding > 0) {
  7039. this._eatBits(1);
  7040. this.nextLine2D = !(code1 & 1);
  7041. }
  7042. }
  7043. if (codingLine[0] > 0) {
  7044. this.outputBits = codingLine[this.codingPos = 0];
  7045. } else {
  7046. this.outputBits = codingLine[this.codingPos = 1];
  7047. }
  7048. this.row++;
  7049. }
  7050. let c;
  7051. if (this.outputBits >= 8) {
  7052. c = this.codingPos & 1 ? 0 : 0xff;
  7053. this.outputBits -= 8;
  7054. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7055. this.codingPos++;
  7056. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7057. }
  7058. } else {
  7059. bits = 8;
  7060. c = 0;
  7061. do {
  7062. if (this.outputBits > bits) {
  7063. c <<= bits;
  7064. if (!(this.codingPos & 1)) {
  7065. c |= 0xff >> 8 - bits;
  7066. }
  7067. this.outputBits -= bits;
  7068. bits = 0;
  7069. } else {
  7070. c <<= this.outputBits;
  7071. if (!(this.codingPos & 1)) {
  7072. c |= 0xff >> 8 - this.outputBits;
  7073. }
  7074. bits -= this.outputBits;
  7075. this.outputBits = 0;
  7076. if (codingLine[this.codingPos] < columns) {
  7077. this.codingPos++;
  7078. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7079. } else if (bits > 0) {
  7080. c <<= bits;
  7081. bits = 0;
  7082. }
  7083. }
  7084. } while (bits);
  7085. }
  7086. if (this.black) {
  7087. c ^= 0xff;
  7088. }
  7089. return c;
  7090. },
  7091. _addPixels(a1, blackPixels) {
  7092. const codingLine = this.codingLine;
  7093. let codingPos = this.codingPos;
  7094. if (a1 > codingLine[codingPos]) {
  7095. if (a1 > this.columns) {
  7096. (0, _util.info)("row is wrong length");
  7097. this.err = true;
  7098. a1 = this.columns;
  7099. }
  7100. if (codingPos & 1 ^ blackPixels) {
  7101. ++codingPos;
  7102. }
  7103. codingLine[codingPos] = a1;
  7104. }
  7105. this.codingPos = codingPos;
  7106. },
  7107. _addPixelsNeg(a1, blackPixels) {
  7108. const codingLine = this.codingLine;
  7109. let codingPos = this.codingPos;
  7110. if (a1 > codingLine[codingPos]) {
  7111. if (a1 > this.columns) {
  7112. (0, _util.info)("row is wrong length");
  7113. this.err = true;
  7114. a1 = this.columns;
  7115. }
  7116. if (codingPos & 1 ^ blackPixels) {
  7117. ++codingPos;
  7118. }
  7119. codingLine[codingPos] = a1;
  7120. } else if (a1 < codingLine[codingPos]) {
  7121. if (a1 < 0) {
  7122. (0, _util.info)("invalid code");
  7123. this.err = true;
  7124. a1 = 0;
  7125. }
  7126. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7127. --codingPos;
  7128. }
  7129. codingLine[codingPos] = a1;
  7130. }
  7131. this.codingPos = codingPos;
  7132. },
  7133. _findTableCode(start, end, table, limit) {
  7134. const limitValue = limit || 0;
  7135. for (let i = start; i <= end; ++i) {
  7136. let code = this._lookBits(i);
  7137. if (code === ccittEOF) {
  7138. return [true, 1, false];
  7139. }
  7140. if (i < end) {
  7141. code <<= end - i;
  7142. }
  7143. if (!limitValue || code >= limitValue) {
  7144. const p = table[code - limitValue];
  7145. if (p[0] === i) {
  7146. this._eatBits(i);
  7147. return [true, p[1], true];
  7148. }
  7149. }
  7150. }
  7151. return [false, 0, false];
  7152. },
  7153. _getTwoDimCode() {
  7154. let code = 0;
  7155. let p;
  7156. if (this.eoblock) {
  7157. code = this._lookBits(7);
  7158. p = twoDimTable[code];
  7159. if (p && p[0] > 0) {
  7160. this._eatBits(p[0]);
  7161. return p[1];
  7162. }
  7163. } else {
  7164. const result = this._findTableCode(1, 7, twoDimTable);
  7165. if (result[0] && result[2]) {
  7166. return result[1];
  7167. }
  7168. }
  7169. (0, _util.info)("Bad two dim code");
  7170. return ccittEOF;
  7171. },
  7172. _getWhiteCode() {
  7173. let code = 0;
  7174. let p;
  7175. if (this.eoblock) {
  7176. code = this._lookBits(12);
  7177. if (code === ccittEOF) {
  7178. return 1;
  7179. }
  7180. if (code >> 5 === 0) {
  7181. p = whiteTable1[code];
  7182. } else {
  7183. p = whiteTable2[code >> 3];
  7184. }
  7185. if (p[0] > 0) {
  7186. this._eatBits(p[0]);
  7187. return p[1];
  7188. }
  7189. } else {
  7190. let result = this._findTableCode(1, 9, whiteTable2);
  7191. if (result[0]) {
  7192. return result[1];
  7193. }
  7194. result = this._findTableCode(11, 12, whiteTable1);
  7195. if (result[0]) {
  7196. return result[1];
  7197. }
  7198. }
  7199. (0, _util.info)("bad white code");
  7200. this._eatBits(1);
  7201. return 1;
  7202. },
  7203. _getBlackCode() {
  7204. let code, p;
  7205. if (this.eoblock) {
  7206. code = this._lookBits(13);
  7207. if (code === ccittEOF) {
  7208. return 1;
  7209. }
  7210. if (code >> 7 === 0) {
  7211. p = blackTable1[code];
  7212. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  7213. p = blackTable2[(code >> 1) - 64];
  7214. } else {
  7215. p = blackTable3[code >> 7];
  7216. }
  7217. if (p[0] > 0) {
  7218. this._eatBits(p[0]);
  7219. return p[1];
  7220. }
  7221. } else {
  7222. let result = this._findTableCode(2, 6, blackTable3);
  7223. if (result[0]) {
  7224. return result[1];
  7225. }
  7226. result = this._findTableCode(7, 12, blackTable2, 64);
  7227. if (result[0]) {
  7228. return result[1];
  7229. }
  7230. result = this._findTableCode(10, 13, blackTable1);
  7231. if (result[0]) {
  7232. return result[1];
  7233. }
  7234. }
  7235. (0, _util.info)("bad black code");
  7236. this._eatBits(1);
  7237. return 1;
  7238. },
  7239. _lookBits(n) {
  7240. let c;
  7241. while (this.inputBits < n) {
  7242. if ((c = this.source.next()) === -1) {
  7243. if (this.inputBits === 0) {
  7244. return ccittEOF;
  7245. }
  7246. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  7247. }
  7248. this.inputBuf = this.inputBuf << 8 | c;
  7249. this.inputBits += 8;
  7250. }
  7251. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  7252. },
  7253. _eatBits(n) {
  7254. if ((this.inputBits -= n) < 0) {
  7255. this.inputBits = 0;
  7256. }
  7257. }
  7258. };
  7259. return CCITTFaxDecoder;
  7260. }();
  7261. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  7262. /***/ }),
  7263. /* 14 */
  7264. /***/ (function(module, exports, __w_pdfjs_require__) {
  7265. "use strict";
  7266. Object.defineProperty(exports, "__esModule", {
  7267. value: true
  7268. });
  7269. exports.Jbig2Stream = void 0;
  7270. var _primitives = __w_pdfjs_require__(4);
  7271. var _stream = __w_pdfjs_require__(11);
  7272. var _jbig = __w_pdfjs_require__(15);
  7273. var _util = __w_pdfjs_require__(2);
  7274. const Jbig2Stream = function Jbig2StreamClosure() {
  7275. function Jbig2Stream(stream, maybeLength, dict, params) {
  7276. this.stream = stream;
  7277. this.maybeLength = maybeLength;
  7278. this.dict = dict;
  7279. this.params = params;
  7280. _stream.DecodeStream.call(this, maybeLength);
  7281. }
  7282. Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
  7283. Object.defineProperty(Jbig2Stream.prototype, "bytes", {
  7284. get() {
  7285. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  7286. },
  7287. configurable: true
  7288. });
  7289. Jbig2Stream.prototype.ensureBuffer = function (requested) {};
  7290. Jbig2Stream.prototype.readBlock = function () {
  7291. if (this.eof) {
  7292. return;
  7293. }
  7294. const jbig2Image = new _jbig.Jbig2Image();
  7295. const chunks = [];
  7296. if ((0, _primitives.isDict)(this.params)) {
  7297. const globalsStream = this.params.get("JBIG2Globals");
  7298. if ((0, _primitives.isStream)(globalsStream)) {
  7299. const globals = globalsStream.getBytes();
  7300. chunks.push({
  7301. data: globals,
  7302. start: 0,
  7303. end: globals.length
  7304. });
  7305. }
  7306. }
  7307. chunks.push({
  7308. data: this.bytes,
  7309. start: 0,
  7310. end: this.bytes.length
  7311. });
  7312. const data = jbig2Image.parseChunks(chunks);
  7313. const dataLength = data.length;
  7314. for (let i = 0; i < dataLength; i++) {
  7315. data[i] ^= 0xff;
  7316. }
  7317. this.buffer = data;
  7318. this.bufferLength = dataLength;
  7319. this.eof = true;
  7320. };
  7321. return Jbig2Stream;
  7322. }();
  7323. exports.Jbig2Stream = Jbig2Stream;
  7324. /***/ }),
  7325. /* 15 */
  7326. /***/ (function(module, exports, __w_pdfjs_require__) {
  7327. "use strict";
  7328. Object.defineProperty(exports, "__esModule", {
  7329. value: true
  7330. });
  7331. exports.Jbig2Image = void 0;
  7332. var _util = __w_pdfjs_require__(2);
  7333. var _core_utils = __w_pdfjs_require__(7);
  7334. var _arithmetic_decoder = __w_pdfjs_require__(16);
  7335. var _ccitt = __w_pdfjs_require__(13);
  7336. class Jbig2Error extends _util.BaseException {
  7337. constructor(msg) {
  7338. super(`JBIG2 error: ${msg}`);
  7339. }
  7340. }
  7341. var Jbig2Image = function Jbig2ImageClosure() {
  7342. function ContextCache() {}
  7343. ContextCache.prototype = {
  7344. getContexts(id) {
  7345. if (id in this) {
  7346. return this[id];
  7347. }
  7348. return this[id] = new Int8Array(1 << 16);
  7349. }
  7350. };
  7351. function DecodingContext(data, start, end) {
  7352. this.data = data;
  7353. this.start = start;
  7354. this.end = end;
  7355. }
  7356. DecodingContext.prototype = {
  7357. get decoder() {
  7358. var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  7359. return (0, _util.shadow)(this, "decoder", decoder);
  7360. },
  7361. get contextCache() {
  7362. var cache = new ContextCache();
  7363. return (0, _util.shadow)(this, "contextCache", cache);
  7364. }
  7365. };
  7366. function decodeInteger(contextCache, procedure, decoder) {
  7367. var contexts = contextCache.getContexts(procedure);
  7368. var prev = 1;
  7369. function readBits(length) {
  7370. var v = 0;
  7371. for (var i = 0; i < length; i++) {
  7372. var bit = decoder.readBit(contexts, prev);
  7373. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  7374. v = v << 1 | bit;
  7375. }
  7376. return v >>> 0;
  7377. }
  7378. var sign = readBits(1);
  7379. var value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
  7380. if (sign === 0) {
  7381. return value;
  7382. } else if (value > 0) {
  7383. return -value;
  7384. }
  7385. return null;
  7386. }
  7387. function decodeIAID(contextCache, decoder, codeLength) {
  7388. var contexts = contextCache.getContexts("IAID");
  7389. var prev = 1;
  7390. for (var i = 0; i < codeLength; i++) {
  7391. var bit = decoder.readBit(contexts, prev);
  7392. prev = prev << 1 | bit;
  7393. }
  7394. if (codeLength < 31) {
  7395. return prev & (1 << codeLength) - 1;
  7396. }
  7397. return prev & 0x7fffffff;
  7398. }
  7399. var SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"];
  7400. var CodingTemplates = [[{
  7401. x: -1,
  7402. y: -2
  7403. }, {
  7404. x: 0,
  7405. y: -2
  7406. }, {
  7407. x: 1,
  7408. y: -2
  7409. }, {
  7410. x: -2,
  7411. y: -1
  7412. }, {
  7413. x: -1,
  7414. y: -1
  7415. }, {
  7416. x: 0,
  7417. y: -1
  7418. }, {
  7419. x: 1,
  7420. y: -1
  7421. }, {
  7422. x: 2,
  7423. y: -1
  7424. }, {
  7425. x: -4,
  7426. y: 0
  7427. }, {
  7428. x: -3,
  7429. y: 0
  7430. }, {
  7431. x: -2,
  7432. y: 0
  7433. }, {
  7434. x: -1,
  7435. y: 0
  7436. }], [{
  7437. x: -1,
  7438. y: -2
  7439. }, {
  7440. x: 0,
  7441. y: -2
  7442. }, {
  7443. x: 1,
  7444. y: -2
  7445. }, {
  7446. x: 2,
  7447. y: -2
  7448. }, {
  7449. x: -2,
  7450. y: -1
  7451. }, {
  7452. x: -1,
  7453. y: -1
  7454. }, {
  7455. x: 0,
  7456. y: -1
  7457. }, {
  7458. x: 1,
  7459. y: -1
  7460. }, {
  7461. x: 2,
  7462. y: -1
  7463. }, {
  7464. x: -3,
  7465. y: 0
  7466. }, {
  7467. x: -2,
  7468. y: 0
  7469. }, {
  7470. x: -1,
  7471. y: 0
  7472. }], [{
  7473. x: -1,
  7474. y: -2
  7475. }, {
  7476. x: 0,
  7477. y: -2
  7478. }, {
  7479. x: 1,
  7480. y: -2
  7481. }, {
  7482. x: -2,
  7483. y: -1
  7484. }, {
  7485. x: -1,
  7486. y: -1
  7487. }, {
  7488. x: 0,
  7489. y: -1
  7490. }, {
  7491. x: 1,
  7492. y: -1
  7493. }, {
  7494. x: -2,
  7495. y: 0
  7496. }, {
  7497. x: -1,
  7498. y: 0
  7499. }], [{
  7500. x: -3,
  7501. y: -1
  7502. }, {
  7503. x: -2,
  7504. y: -1
  7505. }, {
  7506. x: -1,
  7507. y: -1
  7508. }, {
  7509. x: 0,
  7510. y: -1
  7511. }, {
  7512. x: 1,
  7513. y: -1
  7514. }, {
  7515. x: -4,
  7516. y: 0
  7517. }, {
  7518. x: -3,
  7519. y: 0
  7520. }, {
  7521. x: -2,
  7522. y: 0
  7523. }, {
  7524. x: -1,
  7525. y: 0
  7526. }]];
  7527. var RefinementTemplates = [{
  7528. coding: [{
  7529. x: 0,
  7530. y: -1
  7531. }, {
  7532. x: 1,
  7533. y: -1
  7534. }, {
  7535. x: -1,
  7536. y: 0
  7537. }],
  7538. reference: [{
  7539. x: 0,
  7540. y: -1
  7541. }, {
  7542. x: 1,
  7543. y: -1
  7544. }, {
  7545. x: -1,
  7546. y: 0
  7547. }, {
  7548. x: 0,
  7549. y: 0
  7550. }, {
  7551. x: 1,
  7552. y: 0
  7553. }, {
  7554. x: -1,
  7555. y: 1
  7556. }, {
  7557. x: 0,
  7558. y: 1
  7559. }, {
  7560. x: 1,
  7561. y: 1
  7562. }]
  7563. }, {
  7564. coding: [{
  7565. x: -1,
  7566. y: -1
  7567. }, {
  7568. x: 0,
  7569. y: -1
  7570. }, {
  7571. x: 1,
  7572. y: -1
  7573. }, {
  7574. x: -1,
  7575. y: 0
  7576. }],
  7577. reference: [{
  7578. x: 0,
  7579. y: -1
  7580. }, {
  7581. x: -1,
  7582. y: 0
  7583. }, {
  7584. x: 0,
  7585. y: 0
  7586. }, {
  7587. x: 1,
  7588. y: 0
  7589. }, {
  7590. x: 0,
  7591. y: 1
  7592. }, {
  7593. x: 1,
  7594. y: 1
  7595. }]
  7596. }];
  7597. var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  7598. var RefinementReusedContexts = [0x0020, 0x0008];
  7599. function decodeBitmapTemplate0(width, height, decodingContext) {
  7600. var decoder = decodingContext.decoder;
  7601. var contexts = decodingContext.contextCache.getContexts("GB");
  7602. var contextLabel,
  7603. i,
  7604. j,
  7605. pixel,
  7606. row,
  7607. row1,
  7608. row2,
  7609. bitmap = [];
  7610. var OLD_PIXEL_MASK = 0x7bf7;
  7611. for (i = 0; i < height; i++) {
  7612. row = bitmap[i] = new Uint8Array(width);
  7613. row1 = i < 1 ? row : bitmap[i - 1];
  7614. row2 = i < 2 ? row : bitmap[i - 2];
  7615. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  7616. for (j = 0; j < width; j++) {
  7617. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  7618. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  7619. }
  7620. }
  7621. return bitmap;
  7622. }
  7623. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  7624. if (mmr) {
  7625. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  7626. return decodeMMRBitmap(input, width, height, false);
  7627. }
  7628. if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
  7629. return decodeBitmapTemplate0(width, height, decodingContext);
  7630. }
  7631. var useskip = !!skip;
  7632. var template = CodingTemplates[templateIndex].concat(at);
  7633. template.sort(function (a, b) {
  7634. return a.y - b.y || a.x - b.x;
  7635. });
  7636. var templateLength = template.length;
  7637. var templateX = new Int8Array(templateLength);
  7638. var templateY = new Int8Array(templateLength);
  7639. var changingTemplateEntries = [];
  7640. var reuseMask = 0,
  7641. minX = 0,
  7642. maxX = 0,
  7643. minY = 0;
  7644. var c, k;
  7645. for (k = 0; k < templateLength; k++) {
  7646. templateX[k] = template[k].x;
  7647. templateY[k] = template[k].y;
  7648. minX = Math.min(minX, template[k].x);
  7649. maxX = Math.max(maxX, template[k].x);
  7650. minY = Math.min(minY, template[k].y);
  7651. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  7652. reuseMask |= 1 << templateLength - 1 - k;
  7653. } else {
  7654. changingTemplateEntries.push(k);
  7655. }
  7656. }
  7657. var changingEntriesLength = changingTemplateEntries.length;
  7658. var changingTemplateX = new Int8Array(changingEntriesLength);
  7659. var changingTemplateY = new Int8Array(changingEntriesLength);
  7660. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  7661. for (c = 0; c < changingEntriesLength; c++) {
  7662. k = changingTemplateEntries[c];
  7663. changingTemplateX[c] = template[k].x;
  7664. changingTemplateY[c] = template[k].y;
  7665. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  7666. }
  7667. var sbb_left = -minX;
  7668. var sbb_top = -minY;
  7669. var sbb_right = width - maxX;
  7670. var pseudoPixelContext = ReusedContexts[templateIndex];
  7671. var row = new Uint8Array(width);
  7672. var bitmap = [];
  7673. var decoder = decodingContext.decoder;
  7674. var contexts = decodingContext.contextCache.getContexts("GB");
  7675. var ltp = 0,
  7676. j,
  7677. i0,
  7678. j0,
  7679. contextLabel = 0,
  7680. bit,
  7681. shift;
  7682. for (var i = 0; i < height; i++) {
  7683. if (prediction) {
  7684. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  7685. ltp ^= sltp;
  7686. if (ltp) {
  7687. bitmap.push(row);
  7688. continue;
  7689. }
  7690. }
  7691. row = new Uint8Array(row);
  7692. bitmap.push(row);
  7693. for (j = 0; j < width; j++) {
  7694. if (useskip && skip[i][j]) {
  7695. row[j] = 0;
  7696. continue;
  7697. }
  7698. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  7699. contextLabel = contextLabel << 1 & reuseMask;
  7700. for (k = 0; k < changingEntriesLength; k++) {
  7701. i0 = i + changingTemplateY[k];
  7702. j0 = j + changingTemplateX[k];
  7703. bit = bitmap[i0][j0];
  7704. if (bit) {
  7705. bit = changingTemplateBit[k];
  7706. contextLabel |= bit;
  7707. }
  7708. }
  7709. } else {
  7710. contextLabel = 0;
  7711. shift = templateLength - 1;
  7712. for (k = 0; k < templateLength; k++, shift--) {
  7713. j0 = j + templateX[k];
  7714. if (j0 >= 0 && j0 < width) {
  7715. i0 = i + templateY[k];
  7716. if (i0 >= 0) {
  7717. bit = bitmap[i0][j0];
  7718. if (bit) {
  7719. contextLabel |= bit << shift;
  7720. }
  7721. }
  7722. }
  7723. }
  7724. }
  7725. var pixel = decoder.readBit(contexts, contextLabel);
  7726. row[j] = pixel;
  7727. }
  7728. }
  7729. return bitmap;
  7730. }
  7731. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  7732. var codingTemplate = RefinementTemplates[templateIndex].coding;
  7733. if (templateIndex === 0) {
  7734. codingTemplate = codingTemplate.concat([at[0]]);
  7735. }
  7736. var codingTemplateLength = codingTemplate.length;
  7737. var codingTemplateX = new Int32Array(codingTemplateLength);
  7738. var codingTemplateY = new Int32Array(codingTemplateLength);
  7739. var k;
  7740. for (k = 0; k < codingTemplateLength; k++) {
  7741. codingTemplateX[k] = codingTemplate[k].x;
  7742. codingTemplateY[k] = codingTemplate[k].y;
  7743. }
  7744. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  7745. if (templateIndex === 0) {
  7746. referenceTemplate = referenceTemplate.concat([at[1]]);
  7747. }
  7748. var referenceTemplateLength = referenceTemplate.length;
  7749. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  7750. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  7751. for (k = 0; k < referenceTemplateLength; k++) {
  7752. referenceTemplateX[k] = referenceTemplate[k].x;
  7753. referenceTemplateY[k] = referenceTemplate[k].y;
  7754. }
  7755. var referenceWidth = referenceBitmap[0].length;
  7756. var referenceHeight = referenceBitmap.length;
  7757. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  7758. var bitmap = [];
  7759. var decoder = decodingContext.decoder;
  7760. var contexts = decodingContext.contextCache.getContexts("GR");
  7761. var ltp = 0;
  7762. for (var i = 0; i < height; i++) {
  7763. if (prediction) {
  7764. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  7765. ltp ^= sltp;
  7766. if (ltp) {
  7767. throw new Jbig2Error("prediction is not supported");
  7768. }
  7769. }
  7770. var row = new Uint8Array(width);
  7771. bitmap.push(row);
  7772. for (var j = 0; j < width; j++) {
  7773. var i0, j0;
  7774. var contextLabel = 0;
  7775. for (k = 0; k < codingTemplateLength; k++) {
  7776. i0 = i + codingTemplateY[k];
  7777. j0 = j + codingTemplateX[k];
  7778. if (i0 < 0 || j0 < 0 || j0 >= width) {
  7779. contextLabel <<= 1;
  7780. } else {
  7781. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  7782. }
  7783. }
  7784. for (k = 0; k < referenceTemplateLength; k++) {
  7785. i0 = i + referenceTemplateY[k] - offsetY;
  7786. j0 = j + referenceTemplateX[k] - offsetX;
  7787. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  7788. contextLabel <<= 1;
  7789. } else {
  7790. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  7791. }
  7792. }
  7793. var pixel = decoder.readBit(contexts, contextLabel);
  7794. row[j] = pixel;
  7795. }
  7796. }
  7797. return bitmap;
  7798. }
  7799. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  7800. if (huffman && refinement) {
  7801. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  7802. }
  7803. var newSymbols = [];
  7804. var currentHeight = 0;
  7805. var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  7806. var decoder = decodingContext.decoder;
  7807. var contextCache = decodingContext.contextCache;
  7808. let tableB1, symbolWidths;
  7809. if (huffman) {
  7810. tableB1 = getStandardTable(1);
  7811. symbolWidths = [];
  7812. symbolCodeLength = Math.max(symbolCodeLength, 1);
  7813. }
  7814. while (newSymbols.length < numberOfNewSymbols) {
  7815. var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  7816. currentHeight += deltaHeight;
  7817. let currentWidth = 0,
  7818. totalWidth = 0;
  7819. const firstSymbol = huffman ? symbolWidths.length : 0;
  7820. while (true) {
  7821. var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  7822. if (deltaWidth === null) {
  7823. break;
  7824. }
  7825. currentWidth += deltaWidth;
  7826. totalWidth += currentWidth;
  7827. var bitmap;
  7828. if (refinement) {
  7829. var numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  7830. if (numberOfInstances > 1) {
  7831. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  7832. } else {
  7833. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  7834. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  7835. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  7836. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  7837. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  7838. }
  7839. newSymbols.push(bitmap);
  7840. } else if (huffman) {
  7841. symbolWidths.push(currentWidth);
  7842. } else {
  7843. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  7844. newSymbols.push(bitmap);
  7845. }
  7846. }
  7847. if (huffman && !refinement) {
  7848. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  7849. huffmanInput.byteAlign();
  7850. let collectiveBitmap;
  7851. if (bitmapSize === 0) {
  7852. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  7853. } else {
  7854. const originalEnd = huffmanInput.end;
  7855. const bitmapEnd = huffmanInput.position + bitmapSize;
  7856. huffmanInput.end = bitmapEnd;
  7857. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  7858. huffmanInput.end = originalEnd;
  7859. huffmanInput.position = bitmapEnd;
  7860. }
  7861. const numberOfSymbolsDecoded = symbolWidths.length;
  7862. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  7863. newSymbols.push(collectiveBitmap);
  7864. } else {
  7865. let i,
  7866. y,
  7867. xMin = 0,
  7868. xMax,
  7869. bitmapWidth,
  7870. symbolBitmap;
  7871. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  7872. bitmapWidth = symbolWidths[i];
  7873. xMax = xMin + bitmapWidth;
  7874. symbolBitmap = [];
  7875. for (y = 0; y < currentHeight; y++) {
  7876. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  7877. }
  7878. newSymbols.push(symbolBitmap);
  7879. xMin = xMax;
  7880. }
  7881. }
  7882. }
  7883. }
  7884. var exportedSymbols = [];
  7885. var flags = [],
  7886. currentFlag = false;
  7887. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  7888. while (flags.length < totalSymbolsLength) {
  7889. var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  7890. while (runLength--) {
  7891. flags.push(currentFlag);
  7892. }
  7893. currentFlag = !currentFlag;
  7894. }
  7895. for (var i = 0, ii = symbols.length; i < ii; i++) {
  7896. if (flags[i]) {
  7897. exportedSymbols.push(symbols[i]);
  7898. }
  7899. }
  7900. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  7901. if (flags[i]) {
  7902. exportedSymbols.push(newSymbols[j]);
  7903. }
  7904. }
  7905. return exportedSymbols;
  7906. }
  7907. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  7908. if (huffman && refinement) {
  7909. throw new Jbig2Error("refinement with Huffman is not supported");
  7910. }
  7911. var bitmap = [];
  7912. var i, row;
  7913. for (i = 0; i < height; i++) {
  7914. row = new Uint8Array(width);
  7915. if (defaultPixelValue) {
  7916. for (var j = 0; j < width; j++) {
  7917. row[j] = defaultPixelValue;
  7918. }
  7919. }
  7920. bitmap.push(row);
  7921. }
  7922. var decoder = decodingContext.decoder;
  7923. var contextCache = decodingContext.contextCache;
  7924. var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  7925. var firstS = 0;
  7926. i = 0;
  7927. while (i < numberOfSymbolInstances) {
  7928. var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  7929. stripT += deltaT;
  7930. var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  7931. firstS += deltaFirstS;
  7932. var currentS = firstS;
  7933. do {
  7934. let currentT = 0;
  7935. if (stripSize > 1) {
  7936. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  7937. }
  7938. var t = stripSize * stripT + currentT;
  7939. var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  7940. var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  7941. var symbolBitmap = inputSymbols[symbolId];
  7942. var symbolWidth = symbolBitmap[0].length;
  7943. var symbolHeight = symbolBitmap.length;
  7944. if (applyRefinement) {
  7945. var rdw = decodeInteger(contextCache, "IARDW", decoder);
  7946. var rdh = decodeInteger(contextCache, "IARDH", decoder);
  7947. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  7948. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  7949. symbolWidth += rdw;
  7950. symbolHeight += rdh;
  7951. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  7952. }
  7953. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  7954. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  7955. var s2, t2, symbolRow;
  7956. if (transposed) {
  7957. for (s2 = 0; s2 < symbolHeight; s2++) {
  7958. row = bitmap[offsetS + s2];
  7959. if (!row) {
  7960. continue;
  7961. }
  7962. symbolRow = symbolBitmap[s2];
  7963. var maxWidth = Math.min(width - offsetT, symbolWidth);
  7964. switch (combinationOperator) {
  7965. case 0:
  7966. for (t2 = 0; t2 < maxWidth; t2++) {
  7967. row[offsetT + t2] |= symbolRow[t2];
  7968. }
  7969. break;
  7970. case 2:
  7971. for (t2 = 0; t2 < maxWidth; t2++) {
  7972. row[offsetT + t2] ^= symbolRow[t2];
  7973. }
  7974. break;
  7975. default:
  7976. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  7977. }
  7978. }
  7979. currentS += symbolHeight - 1;
  7980. } else {
  7981. for (t2 = 0; t2 < symbolHeight; t2++) {
  7982. row = bitmap[offsetT + t2];
  7983. if (!row) {
  7984. continue;
  7985. }
  7986. symbolRow = symbolBitmap[t2];
  7987. switch (combinationOperator) {
  7988. case 0:
  7989. for (s2 = 0; s2 < symbolWidth; s2++) {
  7990. row[offsetS + s2] |= symbolRow[s2];
  7991. }
  7992. break;
  7993. case 2:
  7994. for (s2 = 0; s2 < symbolWidth; s2++) {
  7995. row[offsetS + s2] ^= symbolRow[s2];
  7996. }
  7997. break;
  7998. default:
  7999. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8000. }
  8001. }
  8002. currentS += symbolWidth - 1;
  8003. }
  8004. i++;
  8005. var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  8006. if (deltaS === null) {
  8007. break;
  8008. }
  8009. currentS += deltaS + dsOffset;
  8010. } while (true);
  8011. }
  8012. return bitmap;
  8013. }
  8014. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  8015. const at = [];
  8016. if (!mmr) {
  8017. at.push({
  8018. x: -patternWidth,
  8019. y: 0
  8020. });
  8021. if (template === 0) {
  8022. at.push({
  8023. x: -3,
  8024. y: -1
  8025. });
  8026. at.push({
  8027. x: 2,
  8028. y: -2
  8029. });
  8030. at.push({
  8031. x: -2,
  8032. y: -2
  8033. });
  8034. }
  8035. }
  8036. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  8037. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  8038. const patterns = [];
  8039. for (let i = 0; i <= maxPatternIndex; i++) {
  8040. const patternBitmap = [];
  8041. const xMin = patternWidth * i;
  8042. const xMax = xMin + patternWidth;
  8043. for (let y = 0; y < patternHeight; y++) {
  8044. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  8045. }
  8046. patterns.push(patternBitmap);
  8047. }
  8048. return patterns;
  8049. }
  8050. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  8051. const skip = null;
  8052. if (enableSkip) {
  8053. throw new Jbig2Error("skip is not supported");
  8054. }
  8055. if (combinationOperator !== 0) {
  8056. throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region");
  8057. }
  8058. const regionBitmap = [];
  8059. let i, j, row;
  8060. for (i = 0; i < regionHeight; i++) {
  8061. row = new Uint8Array(regionWidth);
  8062. if (defaultPixelValue) {
  8063. for (j = 0; j < regionWidth; j++) {
  8064. row[j] = defaultPixelValue;
  8065. }
  8066. }
  8067. regionBitmap.push(row);
  8068. }
  8069. const numberOfPatterns = patterns.length;
  8070. const pattern0 = patterns[0];
  8071. const patternWidth = pattern0[0].length,
  8072. patternHeight = pattern0.length;
  8073. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  8074. const at = [];
  8075. if (!mmr) {
  8076. at.push({
  8077. x: template <= 1 ? 3 : 2,
  8078. y: -1
  8079. });
  8080. if (template === 0) {
  8081. at.push({
  8082. x: -3,
  8083. y: -1
  8084. });
  8085. at.push({
  8086. x: 2,
  8087. y: -2
  8088. });
  8089. at.push({
  8090. x: -2,
  8091. y: -2
  8092. });
  8093. }
  8094. }
  8095. const grayScaleBitPlanes = [];
  8096. let mmrInput, bitmap;
  8097. if (mmr) {
  8098. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  8099. }
  8100. for (i = bitsPerValue - 1; i >= 0; i--) {
  8101. if (mmr) {
  8102. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  8103. } else {
  8104. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  8105. }
  8106. grayScaleBitPlanes[i] = bitmap;
  8107. }
  8108. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  8109. for (mg = 0; mg < gridHeight; mg++) {
  8110. for (ng = 0; ng < gridWidth; ng++) {
  8111. bit = 0;
  8112. patternIndex = 0;
  8113. for (j = bitsPerValue - 1; j >= 0; j--) {
  8114. bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
  8115. patternIndex |= bit << j;
  8116. }
  8117. patternBitmap = patterns[patternIndex];
  8118. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  8119. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  8120. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  8121. for (i = 0; i < patternHeight; i++) {
  8122. regionRow = regionBitmap[y + i];
  8123. patternRow = patternBitmap[i];
  8124. for (j = 0; j < patternWidth; j++) {
  8125. regionRow[x + j] |= patternRow[j];
  8126. }
  8127. }
  8128. } else {
  8129. let regionX, regionY;
  8130. for (i = 0; i < patternHeight; i++) {
  8131. regionY = y + i;
  8132. if (regionY < 0 || regionY >= regionHeight) {
  8133. continue;
  8134. }
  8135. regionRow = regionBitmap[regionY];
  8136. patternRow = patternBitmap[i];
  8137. for (j = 0; j < patternWidth; j++) {
  8138. regionX = x + j;
  8139. if (regionX >= 0 && regionX < regionWidth) {
  8140. regionRow[regionX] |= patternRow[j];
  8141. }
  8142. }
  8143. }
  8144. }
  8145. }
  8146. }
  8147. return regionBitmap;
  8148. }
  8149. function readSegmentHeader(data, start) {
  8150. var segmentHeader = {};
  8151. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  8152. var flags = data[start + 4];
  8153. var segmentType = flags & 0x3f;
  8154. if (!SegmentTypes[segmentType]) {
  8155. throw new Jbig2Error("invalid segment type: " + segmentType);
  8156. }
  8157. segmentHeader.type = segmentType;
  8158. segmentHeader.typeName = SegmentTypes[segmentType];
  8159. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  8160. var pageAssociationFieldSize = !!(flags & 0x40);
  8161. var referredFlags = data[start + 5];
  8162. var referredToCount = referredFlags >> 5 & 7;
  8163. var retainBits = [referredFlags & 31];
  8164. var position = start + 6;
  8165. if (referredFlags === 7) {
  8166. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  8167. position += 3;
  8168. var bytes = referredToCount + 7 >> 3;
  8169. retainBits[0] = data[position++];
  8170. while (--bytes > 0) {
  8171. retainBits.push(data[position++]);
  8172. }
  8173. } else if (referredFlags === 5 || referredFlags === 6) {
  8174. throw new Jbig2Error("invalid referred-to flags");
  8175. }
  8176. segmentHeader.retainBits = retainBits;
  8177. let referredToSegmentNumberSize = 4;
  8178. if (segmentHeader.number <= 256) {
  8179. referredToSegmentNumberSize = 1;
  8180. } else if (segmentHeader.number <= 65536) {
  8181. referredToSegmentNumberSize = 2;
  8182. }
  8183. var referredTo = [];
  8184. var i, ii;
  8185. for (i = 0; i < referredToCount; i++) {
  8186. let number;
  8187. if (referredToSegmentNumberSize === 1) {
  8188. number = data[position];
  8189. } else if (referredToSegmentNumberSize === 2) {
  8190. number = (0, _core_utils.readUint16)(data, position);
  8191. } else {
  8192. number = (0, _core_utils.readUint32)(data, position);
  8193. }
  8194. referredTo.push(number);
  8195. position += referredToSegmentNumberSize;
  8196. }
  8197. segmentHeader.referredTo = referredTo;
  8198. if (!pageAssociationFieldSize) {
  8199. segmentHeader.pageAssociation = data[position++];
  8200. } else {
  8201. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  8202. position += 4;
  8203. }
  8204. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  8205. position += 4;
  8206. if (segmentHeader.length === 0xffffffff) {
  8207. if (segmentType === 38) {
  8208. var genericRegionInfo = readRegionSegmentInformation(data, position);
  8209. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  8210. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  8211. var searchPatternLength = 6;
  8212. var searchPattern = new Uint8Array(searchPatternLength);
  8213. if (!genericRegionMmr) {
  8214. searchPattern[0] = 0xff;
  8215. searchPattern[1] = 0xac;
  8216. }
  8217. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  8218. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  8219. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  8220. searchPattern[5] = genericRegionInfo.height & 0xff;
  8221. for (i = position, ii = data.length; i < ii; i++) {
  8222. var j = 0;
  8223. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  8224. j++;
  8225. }
  8226. if (j === searchPatternLength) {
  8227. segmentHeader.length = i + searchPatternLength;
  8228. break;
  8229. }
  8230. }
  8231. if (segmentHeader.length === 0xffffffff) {
  8232. throw new Jbig2Error("segment end was not found");
  8233. }
  8234. } else {
  8235. throw new Jbig2Error("invalid unknown segment length");
  8236. }
  8237. }
  8238. segmentHeader.headerEnd = position;
  8239. return segmentHeader;
  8240. }
  8241. function readSegments(header, data, start, end) {
  8242. var segments = [];
  8243. var position = start;
  8244. while (position < end) {
  8245. var segmentHeader = readSegmentHeader(data, position);
  8246. position = segmentHeader.headerEnd;
  8247. var segment = {
  8248. header: segmentHeader,
  8249. data
  8250. };
  8251. if (!header.randomAccess) {
  8252. segment.start = position;
  8253. position += segmentHeader.length;
  8254. segment.end = position;
  8255. }
  8256. segments.push(segment);
  8257. if (segmentHeader.type === 51) {
  8258. break;
  8259. }
  8260. }
  8261. if (header.randomAccess) {
  8262. for (var i = 0, ii = segments.length; i < ii; i++) {
  8263. segments[i].start = position;
  8264. position += segments[i].header.length;
  8265. segments[i].end = position;
  8266. }
  8267. }
  8268. return segments;
  8269. }
  8270. function readRegionSegmentInformation(data, start) {
  8271. return {
  8272. width: (0, _core_utils.readUint32)(data, start),
  8273. height: (0, _core_utils.readUint32)(data, start + 4),
  8274. x: (0, _core_utils.readUint32)(data, start + 8),
  8275. y: (0, _core_utils.readUint32)(data, start + 12),
  8276. combinationOperator: data[start + 16] & 7
  8277. };
  8278. }
  8279. var RegionSegmentInformationFieldLength = 17;
  8280. function processSegment(segment, visitor) {
  8281. var header = segment.header;
  8282. var data = segment.data,
  8283. position = segment.start,
  8284. end = segment.end;
  8285. var args, at, i, atLength;
  8286. switch (header.type) {
  8287. case 0:
  8288. var dictionary = {};
  8289. var dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  8290. dictionary.huffman = !!(dictionaryFlags & 1);
  8291. dictionary.refinement = !!(dictionaryFlags & 2);
  8292. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  8293. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  8294. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  8295. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  8296. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  8297. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  8298. dictionary.template = dictionaryFlags >> 10 & 3;
  8299. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  8300. position += 2;
  8301. if (!dictionary.huffman) {
  8302. atLength = dictionary.template === 0 ? 4 : 1;
  8303. at = [];
  8304. for (i = 0; i < atLength; i++) {
  8305. at.push({
  8306. x: (0, _core_utils.readInt8)(data, position),
  8307. y: (0, _core_utils.readInt8)(data, position + 1)
  8308. });
  8309. position += 2;
  8310. }
  8311. dictionary.at = at;
  8312. }
  8313. if (dictionary.refinement && !dictionary.refinementTemplate) {
  8314. at = [];
  8315. for (i = 0; i < 2; i++) {
  8316. at.push({
  8317. x: (0, _core_utils.readInt8)(data, position),
  8318. y: (0, _core_utils.readInt8)(data, position + 1)
  8319. });
  8320. position += 2;
  8321. }
  8322. dictionary.refinementAt = at;
  8323. }
  8324. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  8325. position += 4;
  8326. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  8327. position += 4;
  8328. args = [dictionary, header.number, header.referredTo, data, position, end];
  8329. break;
  8330. case 6:
  8331. case 7:
  8332. var textRegion = {};
  8333. textRegion.info = readRegionSegmentInformation(data, position);
  8334. position += RegionSegmentInformationFieldLength;
  8335. var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  8336. position += 2;
  8337. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  8338. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  8339. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  8340. textRegion.stripSize = 1 << textRegion.logStripSize;
  8341. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  8342. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  8343. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  8344. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  8345. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  8346. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  8347. if (textRegion.huffman) {
  8348. var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  8349. position += 2;
  8350. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  8351. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  8352. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  8353. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  8354. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  8355. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  8356. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  8357. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  8358. }
  8359. if (textRegion.refinement && !textRegion.refinementTemplate) {
  8360. at = [];
  8361. for (i = 0; i < 2; i++) {
  8362. at.push({
  8363. x: (0, _core_utils.readInt8)(data, position),
  8364. y: (0, _core_utils.readInt8)(data, position + 1)
  8365. });
  8366. position += 2;
  8367. }
  8368. textRegion.refinementAt = at;
  8369. }
  8370. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  8371. position += 4;
  8372. args = [textRegion, header.referredTo, data, position, end];
  8373. break;
  8374. case 16:
  8375. const patternDictionary = {};
  8376. const patternDictionaryFlags = data[position++];
  8377. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  8378. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  8379. patternDictionary.patternWidth = data[position++];
  8380. patternDictionary.patternHeight = data[position++];
  8381. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  8382. position += 4;
  8383. args = [patternDictionary, header.number, data, position, end];
  8384. break;
  8385. case 22:
  8386. case 23:
  8387. const halftoneRegion = {};
  8388. halftoneRegion.info = readRegionSegmentInformation(data, position);
  8389. position += RegionSegmentInformationFieldLength;
  8390. const halftoneRegionFlags = data[position++];
  8391. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  8392. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  8393. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  8394. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  8395. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  8396. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  8397. position += 4;
  8398. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  8399. position += 4;
  8400. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  8401. position += 4;
  8402. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  8403. position += 4;
  8404. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  8405. position += 2;
  8406. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  8407. position += 2;
  8408. args = [halftoneRegion, header.referredTo, data, position, end];
  8409. break;
  8410. case 38:
  8411. case 39:
  8412. var genericRegion = {};
  8413. genericRegion.info = readRegionSegmentInformation(data, position);
  8414. position += RegionSegmentInformationFieldLength;
  8415. var genericRegionSegmentFlags = data[position++];
  8416. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  8417. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  8418. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  8419. if (!genericRegion.mmr) {
  8420. atLength = genericRegion.template === 0 ? 4 : 1;
  8421. at = [];
  8422. for (i = 0; i < atLength; i++) {
  8423. at.push({
  8424. x: (0, _core_utils.readInt8)(data, position),
  8425. y: (0, _core_utils.readInt8)(data, position + 1)
  8426. });
  8427. position += 2;
  8428. }
  8429. genericRegion.at = at;
  8430. }
  8431. args = [genericRegion, data, position, end];
  8432. break;
  8433. case 48:
  8434. var pageInfo = {
  8435. width: (0, _core_utils.readUint32)(data, position),
  8436. height: (0, _core_utils.readUint32)(data, position + 4),
  8437. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  8438. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  8439. };
  8440. if (pageInfo.height === 0xffffffff) {
  8441. delete pageInfo.height;
  8442. }
  8443. var pageSegmentFlags = data[position + 16];
  8444. (0, _core_utils.readUint16)(data, position + 17);
  8445. pageInfo.lossless = !!(pageSegmentFlags & 1);
  8446. pageInfo.refinement = !!(pageSegmentFlags & 2);
  8447. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  8448. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  8449. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  8450. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  8451. args = [pageInfo];
  8452. break;
  8453. case 49:
  8454. break;
  8455. case 50:
  8456. break;
  8457. case 51:
  8458. break;
  8459. case 53:
  8460. args = [header.number, data, position, end];
  8461. break;
  8462. case 62:
  8463. break;
  8464. default:
  8465. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  8466. }
  8467. var callbackName = "on" + header.typeName;
  8468. if (callbackName in visitor) {
  8469. visitor[callbackName].apply(visitor, args);
  8470. }
  8471. }
  8472. function processSegments(segments, visitor) {
  8473. for (var i = 0, ii = segments.length; i < ii; i++) {
  8474. processSegment(segments[i], visitor);
  8475. }
  8476. }
  8477. function parseJbig2Chunks(chunks) {
  8478. var visitor = new SimpleSegmentVisitor();
  8479. for (var i = 0, ii = chunks.length; i < ii; i++) {
  8480. var chunk = chunks[i];
  8481. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  8482. processSegments(segments, visitor);
  8483. }
  8484. return visitor.buffer;
  8485. }
  8486. function parseJbig2(data) {
  8487. const end = data.length;
  8488. let position = 0;
  8489. if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) {
  8490. throw new Jbig2Error("parseJbig2 - invalid header.");
  8491. }
  8492. const header = Object.create(null);
  8493. position += 8;
  8494. const flags = data[position++];
  8495. header.randomAccess = !(flags & 1);
  8496. if (!(flags & 2)) {
  8497. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  8498. position += 4;
  8499. }
  8500. const segments = readSegments(header, data, position, end);
  8501. const visitor = new SimpleSegmentVisitor();
  8502. processSegments(segments, visitor);
  8503. const {
  8504. width,
  8505. height
  8506. } = visitor.currentPageInfo;
  8507. const bitPacked = visitor.buffer;
  8508. const imgData = new Uint8ClampedArray(width * height);
  8509. let q = 0,
  8510. k = 0;
  8511. for (let i = 0; i < height; i++) {
  8512. let mask = 0,
  8513. buffer;
  8514. for (let j = 0; j < width; j++) {
  8515. if (!mask) {
  8516. mask = 128;
  8517. buffer = bitPacked[k++];
  8518. }
  8519. imgData[q++] = buffer & mask ? 0 : 255;
  8520. mask >>= 1;
  8521. }
  8522. }
  8523. return {
  8524. imgData,
  8525. width,
  8526. height
  8527. };
  8528. }
  8529. function SimpleSegmentVisitor() {}
  8530. SimpleSegmentVisitor.prototype = {
  8531. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  8532. this.currentPageInfo = info;
  8533. var rowSize = info.width + 7 >> 3;
  8534. var buffer = new Uint8ClampedArray(rowSize * info.height);
  8535. if (info.defaultPixelValue) {
  8536. for (var i = 0, ii = buffer.length; i < ii; i++) {
  8537. buffer[i] = 0xff;
  8538. }
  8539. }
  8540. this.buffer = buffer;
  8541. },
  8542. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  8543. var pageInfo = this.currentPageInfo;
  8544. var width = regionInfo.width,
  8545. height = regionInfo.height;
  8546. var rowSize = pageInfo.width + 7 >> 3;
  8547. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  8548. var buffer = this.buffer;
  8549. var mask0 = 128 >> (regionInfo.x & 7);
  8550. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  8551. var i, j, mask, offset;
  8552. switch (combinationOperator) {
  8553. case 0:
  8554. for (i = 0; i < height; i++) {
  8555. mask = mask0;
  8556. offset = offset0;
  8557. for (j = 0; j < width; j++) {
  8558. if (bitmap[i][j]) {
  8559. buffer[offset] |= mask;
  8560. }
  8561. mask >>= 1;
  8562. if (!mask) {
  8563. mask = 128;
  8564. offset++;
  8565. }
  8566. }
  8567. offset0 += rowSize;
  8568. }
  8569. break;
  8570. case 2:
  8571. for (i = 0; i < height; i++) {
  8572. mask = mask0;
  8573. offset = offset0;
  8574. for (j = 0; j < width; j++) {
  8575. if (bitmap[i][j]) {
  8576. buffer[offset] ^= mask;
  8577. }
  8578. mask >>= 1;
  8579. if (!mask) {
  8580. mask = 128;
  8581. offset++;
  8582. }
  8583. }
  8584. offset0 += rowSize;
  8585. }
  8586. break;
  8587. default:
  8588. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8589. }
  8590. },
  8591. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  8592. var regionInfo = region.info;
  8593. var decodingContext = new DecodingContext(data, start, end);
  8594. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  8595. this.drawBitmap(regionInfo, bitmap);
  8596. },
  8597. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  8598. this.onImmediateGenericRegion.apply(this, arguments);
  8599. },
  8600. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  8601. let huffmanTables, huffmanInput;
  8602. if (dictionary.huffman) {
  8603. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  8604. huffmanInput = new Reader(data, start, end);
  8605. }
  8606. var symbols = this.symbols;
  8607. if (!symbols) {
  8608. this.symbols = symbols = {};
  8609. }
  8610. var inputSymbols = [];
  8611. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  8612. const referredSymbols = symbols[referredSegments[i]];
  8613. if (referredSymbols) {
  8614. inputSymbols = inputSymbols.concat(referredSymbols);
  8615. }
  8616. }
  8617. var decodingContext = new DecodingContext(data, start, end);
  8618. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  8619. },
  8620. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  8621. var regionInfo = region.info;
  8622. let huffmanTables, huffmanInput;
  8623. var symbols = this.symbols;
  8624. var inputSymbols = [];
  8625. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  8626. const referredSymbols = symbols[referredSegments[i]];
  8627. if (referredSymbols) {
  8628. inputSymbols = inputSymbols.concat(referredSymbols);
  8629. }
  8630. }
  8631. var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  8632. if (region.huffman) {
  8633. huffmanInput = new Reader(data, start, end);
  8634. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  8635. }
  8636. var decodingContext = new DecodingContext(data, start, end);
  8637. var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
  8638. this.drawBitmap(regionInfo, bitmap);
  8639. },
  8640. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  8641. this.onImmediateTextRegion.apply(this, arguments);
  8642. },
  8643. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  8644. let patterns = this.patterns;
  8645. if (!patterns) {
  8646. this.patterns = patterns = {};
  8647. }
  8648. const decodingContext = new DecodingContext(data, start, end);
  8649. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  8650. },
  8651. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  8652. const patterns = this.patterns[referredSegments[0]];
  8653. const regionInfo = region.info;
  8654. const decodingContext = new DecodingContext(data, start, end);
  8655. const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
  8656. this.drawBitmap(regionInfo, bitmap);
  8657. },
  8658. onImmediateLosslessHalftoneRegion() {
  8659. this.onImmediateHalftoneRegion.apply(this, arguments);
  8660. },
  8661. onTables(currentSegment, data, start, end) {
  8662. let customTables = this.customTables;
  8663. if (!customTables) {
  8664. this.customTables = customTables = {};
  8665. }
  8666. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  8667. }
  8668. };
  8669. function HuffmanLine(lineData) {
  8670. if (lineData.length === 2) {
  8671. this.isOOB = true;
  8672. this.rangeLow = 0;
  8673. this.prefixLength = lineData[0];
  8674. this.rangeLength = 0;
  8675. this.prefixCode = lineData[1];
  8676. this.isLowerRange = false;
  8677. } else {
  8678. this.isOOB = false;
  8679. this.rangeLow = lineData[0];
  8680. this.prefixLength = lineData[1];
  8681. this.rangeLength = lineData[2];
  8682. this.prefixCode = lineData[3];
  8683. this.isLowerRange = lineData[4] === "lower";
  8684. }
  8685. }
  8686. function HuffmanTreeNode(line) {
  8687. this.children = [];
  8688. if (line) {
  8689. this.isLeaf = true;
  8690. this.rangeLength = line.rangeLength;
  8691. this.rangeLow = line.rangeLow;
  8692. this.isLowerRange = line.isLowerRange;
  8693. this.isOOB = line.isOOB;
  8694. } else {
  8695. this.isLeaf = false;
  8696. }
  8697. }
  8698. HuffmanTreeNode.prototype = {
  8699. buildTree(line, shift) {
  8700. const bit = line.prefixCode >> shift & 1;
  8701. if (shift <= 0) {
  8702. this.children[bit] = new HuffmanTreeNode(line);
  8703. } else {
  8704. let node = this.children[bit];
  8705. if (!node) {
  8706. this.children[bit] = node = new HuffmanTreeNode(null);
  8707. }
  8708. node.buildTree(line, shift - 1);
  8709. }
  8710. },
  8711. decodeNode(reader) {
  8712. if (this.isLeaf) {
  8713. if (this.isOOB) {
  8714. return null;
  8715. }
  8716. const htOffset = reader.readBits(this.rangeLength);
  8717. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  8718. }
  8719. const node = this.children[reader.readBit()];
  8720. if (!node) {
  8721. throw new Jbig2Error("invalid Huffman data");
  8722. }
  8723. return node.decodeNode(reader);
  8724. }
  8725. };
  8726. function HuffmanTable(lines, prefixCodesDone) {
  8727. if (!prefixCodesDone) {
  8728. this.assignPrefixCodes(lines);
  8729. }
  8730. this.rootNode = new HuffmanTreeNode(null);
  8731. for (let i = 0, ii = lines.length; i < ii; i++) {
  8732. const line = lines[i];
  8733. if (line.prefixLength > 0) {
  8734. this.rootNode.buildTree(line, line.prefixLength - 1);
  8735. }
  8736. }
  8737. }
  8738. HuffmanTable.prototype = {
  8739. decode(reader) {
  8740. return this.rootNode.decodeNode(reader);
  8741. },
  8742. assignPrefixCodes(lines) {
  8743. const linesLength = lines.length;
  8744. let prefixLengthMax = 0;
  8745. for (let i = 0; i < linesLength; i++) {
  8746. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  8747. }
  8748. const histogram = new Uint32Array(prefixLengthMax + 1);
  8749. for (let i = 0; i < linesLength; i++) {
  8750. histogram[lines[i].prefixLength]++;
  8751. }
  8752. let currentLength = 1,
  8753. firstCode = 0,
  8754. currentCode,
  8755. currentTemp,
  8756. line;
  8757. histogram[0] = 0;
  8758. while (currentLength <= prefixLengthMax) {
  8759. firstCode = firstCode + histogram[currentLength - 1] << 1;
  8760. currentCode = firstCode;
  8761. currentTemp = 0;
  8762. while (currentTemp < linesLength) {
  8763. line = lines[currentTemp];
  8764. if (line.prefixLength === currentLength) {
  8765. line.prefixCode = currentCode;
  8766. currentCode++;
  8767. }
  8768. currentTemp++;
  8769. }
  8770. currentLength++;
  8771. }
  8772. }
  8773. };
  8774. function decodeTablesSegment(data, start, end) {
  8775. const flags = data[start];
  8776. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  8777. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  8778. const reader = new Reader(data, start + 9, end);
  8779. const prefixSizeBits = (flags >> 1 & 7) + 1;
  8780. const rangeSizeBits = (flags >> 4 & 7) + 1;
  8781. const lines = [];
  8782. let prefixLength,
  8783. rangeLength,
  8784. currentRangeLow = lowestValue;
  8785. do {
  8786. prefixLength = reader.readBits(prefixSizeBits);
  8787. rangeLength = reader.readBits(rangeSizeBits);
  8788. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  8789. currentRangeLow += 1 << rangeLength;
  8790. } while (currentRangeLow < highestValue);
  8791. prefixLength = reader.readBits(prefixSizeBits);
  8792. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  8793. prefixLength = reader.readBits(prefixSizeBits);
  8794. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  8795. if (flags & 1) {
  8796. prefixLength = reader.readBits(prefixSizeBits);
  8797. lines.push(new HuffmanLine([prefixLength, 0]));
  8798. }
  8799. return new HuffmanTable(lines, false);
  8800. }
  8801. const standardTablesCache = {};
  8802. function getStandardTable(number) {
  8803. let table = standardTablesCache[number];
  8804. if (table) {
  8805. return table;
  8806. }
  8807. let lines;
  8808. switch (number) {
  8809. case 1:
  8810. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  8811. break;
  8812. case 2:
  8813. lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
  8814. break;
  8815. case 3:
  8816. lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
  8817. break;
  8818. case 4:
  8819. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
  8820. break;
  8821. case 5:
  8822. lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
  8823. break;
  8824. case 6:
  8825. lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
  8826. break;
  8827. case 7:
  8828. lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
  8829. break;
  8830. case 8:
  8831. lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
  8832. break;
  8833. case 9:
  8834. lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
  8835. break;
  8836. case 10:
  8837. lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
  8838. break;
  8839. case 11:
  8840. lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  8841. break;
  8842. case 12:
  8843. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
  8844. break;
  8845. case 13:
  8846. lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  8847. break;
  8848. case 14:
  8849. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  8850. break;
  8851. case 15:
  8852. lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
  8853. break;
  8854. default:
  8855. throw new Jbig2Error(`standard table B.${number} does not exist`);
  8856. }
  8857. for (let i = 0, ii = lines.length; i < ii; i++) {
  8858. lines[i] = new HuffmanLine(lines[i]);
  8859. }
  8860. table = new HuffmanTable(lines, true);
  8861. standardTablesCache[number] = table;
  8862. return table;
  8863. }
  8864. function Reader(data, start, end) {
  8865. this.data = data;
  8866. this.start = start;
  8867. this.end = end;
  8868. this.position = start;
  8869. this.shift = -1;
  8870. this.currentByte = 0;
  8871. }
  8872. Reader.prototype = {
  8873. readBit() {
  8874. if (this.shift < 0) {
  8875. if (this.position >= this.end) {
  8876. throw new Jbig2Error("end of data while reading bit");
  8877. }
  8878. this.currentByte = this.data[this.position++];
  8879. this.shift = 7;
  8880. }
  8881. const bit = this.currentByte >> this.shift & 1;
  8882. this.shift--;
  8883. return bit;
  8884. },
  8885. readBits(numBits) {
  8886. let result = 0,
  8887. i;
  8888. for (i = numBits - 1; i >= 0; i--) {
  8889. result |= this.readBit() << i;
  8890. }
  8891. return result;
  8892. },
  8893. byteAlign() {
  8894. this.shift = -1;
  8895. },
  8896. next() {
  8897. if (this.position >= this.end) {
  8898. return -1;
  8899. }
  8900. return this.data[this.position++];
  8901. }
  8902. };
  8903. function getCustomHuffmanTable(index, referredTo, customTables) {
  8904. let currentIndex = 0;
  8905. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  8906. const table = customTables[referredTo[i]];
  8907. if (table) {
  8908. if (index === currentIndex) {
  8909. return table;
  8910. }
  8911. currentIndex++;
  8912. }
  8913. }
  8914. throw new Jbig2Error("can't find custom Huffman table");
  8915. }
  8916. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  8917. const codes = [];
  8918. for (let i = 0; i <= 34; i++) {
  8919. const codeLength = reader.readBits(4);
  8920. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  8921. }
  8922. const runCodesTable = new HuffmanTable(codes, false);
  8923. codes.length = 0;
  8924. for (let i = 0; i < numberOfSymbols;) {
  8925. const codeLength = runCodesTable.decode(reader);
  8926. if (codeLength >= 32) {
  8927. let repeatedLength, numberOfRepeats, j;
  8928. switch (codeLength) {
  8929. case 32:
  8930. if (i === 0) {
  8931. throw new Jbig2Error("no previous value in symbol ID table");
  8932. }
  8933. numberOfRepeats = reader.readBits(2) + 3;
  8934. repeatedLength = codes[i - 1].prefixLength;
  8935. break;
  8936. case 33:
  8937. numberOfRepeats = reader.readBits(3) + 3;
  8938. repeatedLength = 0;
  8939. break;
  8940. case 34:
  8941. numberOfRepeats = reader.readBits(7) + 11;
  8942. repeatedLength = 0;
  8943. break;
  8944. default:
  8945. throw new Jbig2Error("invalid code length in symbol ID table");
  8946. }
  8947. for (j = 0; j < numberOfRepeats; j++) {
  8948. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  8949. i++;
  8950. }
  8951. } else {
  8952. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  8953. i++;
  8954. }
  8955. }
  8956. reader.byteAlign();
  8957. const symbolIDTable = new HuffmanTable(codes, false);
  8958. let customIndex = 0,
  8959. tableFirstS,
  8960. tableDeltaS,
  8961. tableDeltaT;
  8962. switch (textRegion.huffmanFS) {
  8963. case 0:
  8964. case 1:
  8965. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  8966. break;
  8967. case 3:
  8968. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  8969. customIndex++;
  8970. break;
  8971. default:
  8972. throw new Jbig2Error("invalid Huffman FS selector");
  8973. }
  8974. switch (textRegion.huffmanDS) {
  8975. case 0:
  8976. case 1:
  8977. case 2:
  8978. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  8979. break;
  8980. case 3:
  8981. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  8982. customIndex++;
  8983. break;
  8984. default:
  8985. throw new Jbig2Error("invalid Huffman DS selector");
  8986. }
  8987. switch (textRegion.huffmanDT) {
  8988. case 0:
  8989. case 1:
  8990. case 2:
  8991. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  8992. break;
  8993. case 3:
  8994. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  8995. customIndex++;
  8996. break;
  8997. default:
  8998. throw new Jbig2Error("invalid Huffman DT selector");
  8999. }
  9000. if (textRegion.refinement) {
  9001. throw new Jbig2Error("refinement with Huffman is not supported");
  9002. }
  9003. return {
  9004. symbolIDTable,
  9005. tableFirstS,
  9006. tableDeltaS,
  9007. tableDeltaT
  9008. };
  9009. }
  9010. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  9011. let customIndex = 0,
  9012. tableDeltaHeight,
  9013. tableDeltaWidth;
  9014. switch (dictionary.huffmanDHSelector) {
  9015. case 0:
  9016. case 1:
  9017. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  9018. break;
  9019. case 3:
  9020. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9021. customIndex++;
  9022. break;
  9023. default:
  9024. throw new Jbig2Error("invalid Huffman DH selector");
  9025. }
  9026. switch (dictionary.huffmanDWSelector) {
  9027. case 0:
  9028. case 1:
  9029. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  9030. break;
  9031. case 3:
  9032. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9033. customIndex++;
  9034. break;
  9035. default:
  9036. throw new Jbig2Error("invalid Huffman DW selector");
  9037. }
  9038. let tableBitmapSize, tableAggregateInstances;
  9039. if (dictionary.bitmapSizeSelector) {
  9040. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9041. customIndex++;
  9042. } else {
  9043. tableBitmapSize = getStandardTable(1);
  9044. }
  9045. if (dictionary.aggregationInstancesSelector) {
  9046. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9047. } else {
  9048. tableAggregateInstances = getStandardTable(1);
  9049. }
  9050. return {
  9051. tableDeltaHeight,
  9052. tableDeltaWidth,
  9053. tableBitmapSize,
  9054. tableAggregateInstances
  9055. };
  9056. }
  9057. function readUncompressedBitmap(reader, width, height) {
  9058. const bitmap = [];
  9059. for (let y = 0; y < height; y++) {
  9060. const row = new Uint8Array(width);
  9061. bitmap.push(row);
  9062. for (let x = 0; x < width; x++) {
  9063. row[x] = reader.readBit();
  9064. }
  9065. reader.byteAlign();
  9066. }
  9067. return bitmap;
  9068. }
  9069. function decodeMMRBitmap(input, width, height, endOfBlock) {
  9070. const params = {
  9071. K: -1,
  9072. Columns: width,
  9073. Rows: height,
  9074. BlackIs1: true,
  9075. EndOfBlock: endOfBlock
  9076. };
  9077. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  9078. const bitmap = [];
  9079. let currentByte,
  9080. eof = false;
  9081. for (let y = 0; y < height; y++) {
  9082. const row = new Uint8Array(width);
  9083. bitmap.push(row);
  9084. let shift = -1;
  9085. for (let x = 0; x < width; x++) {
  9086. if (shift < 0) {
  9087. currentByte = decoder.readNextChar();
  9088. if (currentByte === -1) {
  9089. currentByte = 0;
  9090. eof = true;
  9091. }
  9092. shift = 7;
  9093. }
  9094. row[x] = currentByte >> shift & 1;
  9095. shift--;
  9096. }
  9097. }
  9098. if (endOfBlock && !eof) {
  9099. const lookForEOFLimit = 5;
  9100. for (let i = 0; i < lookForEOFLimit; i++) {
  9101. if (decoder.readNextChar() === -1) {
  9102. break;
  9103. }
  9104. }
  9105. }
  9106. return bitmap;
  9107. }
  9108. function Jbig2Image() {}
  9109. Jbig2Image.prototype = {
  9110. parseChunks(chunks) {
  9111. return parseJbig2Chunks(chunks);
  9112. },
  9113. parse(data) {
  9114. const {
  9115. imgData,
  9116. width,
  9117. height
  9118. } = parseJbig2(data);
  9119. this.width = width;
  9120. this.height = height;
  9121. return imgData;
  9122. }
  9123. };
  9124. return Jbig2Image;
  9125. }();
  9126. exports.Jbig2Image = Jbig2Image;
  9127. /***/ }),
  9128. /* 16 */
  9129. /***/ (function(module, exports, __w_pdfjs_require__) {
  9130. "use strict";
  9131. Object.defineProperty(exports, "__esModule", {
  9132. value: true
  9133. });
  9134. exports.ArithmeticDecoder = void 0;
  9135. const QeTable = [{
  9136. qe: 0x5601,
  9137. nmps: 1,
  9138. nlps: 1,
  9139. switchFlag: 1
  9140. }, {
  9141. qe: 0x3401,
  9142. nmps: 2,
  9143. nlps: 6,
  9144. switchFlag: 0
  9145. }, {
  9146. qe: 0x1801,
  9147. nmps: 3,
  9148. nlps: 9,
  9149. switchFlag: 0
  9150. }, {
  9151. qe: 0x0ac1,
  9152. nmps: 4,
  9153. nlps: 12,
  9154. switchFlag: 0
  9155. }, {
  9156. qe: 0x0521,
  9157. nmps: 5,
  9158. nlps: 29,
  9159. switchFlag: 0
  9160. }, {
  9161. qe: 0x0221,
  9162. nmps: 38,
  9163. nlps: 33,
  9164. switchFlag: 0
  9165. }, {
  9166. qe: 0x5601,
  9167. nmps: 7,
  9168. nlps: 6,
  9169. switchFlag: 1
  9170. }, {
  9171. qe: 0x5401,
  9172. nmps: 8,
  9173. nlps: 14,
  9174. switchFlag: 0
  9175. }, {
  9176. qe: 0x4801,
  9177. nmps: 9,
  9178. nlps: 14,
  9179. switchFlag: 0
  9180. }, {
  9181. qe: 0x3801,
  9182. nmps: 10,
  9183. nlps: 14,
  9184. switchFlag: 0
  9185. }, {
  9186. qe: 0x3001,
  9187. nmps: 11,
  9188. nlps: 17,
  9189. switchFlag: 0
  9190. }, {
  9191. qe: 0x2401,
  9192. nmps: 12,
  9193. nlps: 18,
  9194. switchFlag: 0
  9195. }, {
  9196. qe: 0x1c01,
  9197. nmps: 13,
  9198. nlps: 20,
  9199. switchFlag: 0
  9200. }, {
  9201. qe: 0x1601,
  9202. nmps: 29,
  9203. nlps: 21,
  9204. switchFlag: 0
  9205. }, {
  9206. qe: 0x5601,
  9207. nmps: 15,
  9208. nlps: 14,
  9209. switchFlag: 1
  9210. }, {
  9211. qe: 0x5401,
  9212. nmps: 16,
  9213. nlps: 14,
  9214. switchFlag: 0
  9215. }, {
  9216. qe: 0x5101,
  9217. nmps: 17,
  9218. nlps: 15,
  9219. switchFlag: 0
  9220. }, {
  9221. qe: 0x4801,
  9222. nmps: 18,
  9223. nlps: 16,
  9224. switchFlag: 0
  9225. }, {
  9226. qe: 0x3801,
  9227. nmps: 19,
  9228. nlps: 17,
  9229. switchFlag: 0
  9230. }, {
  9231. qe: 0x3401,
  9232. nmps: 20,
  9233. nlps: 18,
  9234. switchFlag: 0
  9235. }, {
  9236. qe: 0x3001,
  9237. nmps: 21,
  9238. nlps: 19,
  9239. switchFlag: 0
  9240. }, {
  9241. qe: 0x2801,
  9242. nmps: 22,
  9243. nlps: 19,
  9244. switchFlag: 0
  9245. }, {
  9246. qe: 0x2401,
  9247. nmps: 23,
  9248. nlps: 20,
  9249. switchFlag: 0
  9250. }, {
  9251. qe: 0x2201,
  9252. nmps: 24,
  9253. nlps: 21,
  9254. switchFlag: 0
  9255. }, {
  9256. qe: 0x1c01,
  9257. nmps: 25,
  9258. nlps: 22,
  9259. switchFlag: 0
  9260. }, {
  9261. qe: 0x1801,
  9262. nmps: 26,
  9263. nlps: 23,
  9264. switchFlag: 0
  9265. }, {
  9266. qe: 0x1601,
  9267. nmps: 27,
  9268. nlps: 24,
  9269. switchFlag: 0
  9270. }, {
  9271. qe: 0x1401,
  9272. nmps: 28,
  9273. nlps: 25,
  9274. switchFlag: 0
  9275. }, {
  9276. qe: 0x1201,
  9277. nmps: 29,
  9278. nlps: 26,
  9279. switchFlag: 0
  9280. }, {
  9281. qe: 0x1101,
  9282. nmps: 30,
  9283. nlps: 27,
  9284. switchFlag: 0
  9285. }, {
  9286. qe: 0x0ac1,
  9287. nmps: 31,
  9288. nlps: 28,
  9289. switchFlag: 0
  9290. }, {
  9291. qe: 0x09c1,
  9292. nmps: 32,
  9293. nlps: 29,
  9294. switchFlag: 0
  9295. }, {
  9296. qe: 0x08a1,
  9297. nmps: 33,
  9298. nlps: 30,
  9299. switchFlag: 0
  9300. }, {
  9301. qe: 0x0521,
  9302. nmps: 34,
  9303. nlps: 31,
  9304. switchFlag: 0
  9305. }, {
  9306. qe: 0x0441,
  9307. nmps: 35,
  9308. nlps: 32,
  9309. switchFlag: 0
  9310. }, {
  9311. qe: 0x02a1,
  9312. nmps: 36,
  9313. nlps: 33,
  9314. switchFlag: 0
  9315. }, {
  9316. qe: 0x0221,
  9317. nmps: 37,
  9318. nlps: 34,
  9319. switchFlag: 0
  9320. }, {
  9321. qe: 0x0141,
  9322. nmps: 38,
  9323. nlps: 35,
  9324. switchFlag: 0
  9325. }, {
  9326. qe: 0x0111,
  9327. nmps: 39,
  9328. nlps: 36,
  9329. switchFlag: 0
  9330. }, {
  9331. qe: 0x0085,
  9332. nmps: 40,
  9333. nlps: 37,
  9334. switchFlag: 0
  9335. }, {
  9336. qe: 0x0049,
  9337. nmps: 41,
  9338. nlps: 38,
  9339. switchFlag: 0
  9340. }, {
  9341. qe: 0x0025,
  9342. nmps: 42,
  9343. nlps: 39,
  9344. switchFlag: 0
  9345. }, {
  9346. qe: 0x0015,
  9347. nmps: 43,
  9348. nlps: 40,
  9349. switchFlag: 0
  9350. }, {
  9351. qe: 0x0009,
  9352. nmps: 44,
  9353. nlps: 41,
  9354. switchFlag: 0
  9355. }, {
  9356. qe: 0x0005,
  9357. nmps: 45,
  9358. nlps: 42,
  9359. switchFlag: 0
  9360. }, {
  9361. qe: 0x0001,
  9362. nmps: 45,
  9363. nlps: 43,
  9364. switchFlag: 0
  9365. }, {
  9366. qe: 0x5601,
  9367. nmps: 46,
  9368. nlps: 46,
  9369. switchFlag: 0
  9370. }];
  9371. class ArithmeticDecoder {
  9372. constructor(data, start, end) {
  9373. this.data = data;
  9374. this.bp = start;
  9375. this.dataEnd = end;
  9376. this.chigh = data[start];
  9377. this.clow = 0;
  9378. this.byteIn();
  9379. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  9380. this.clow = this.clow << 7 & 0xffff;
  9381. this.ct -= 7;
  9382. this.a = 0x8000;
  9383. }
  9384. byteIn() {
  9385. const data = this.data;
  9386. let bp = this.bp;
  9387. if (data[bp] === 0xff) {
  9388. if (data[bp + 1] > 0x8f) {
  9389. this.clow += 0xff00;
  9390. this.ct = 8;
  9391. } else {
  9392. bp++;
  9393. this.clow += data[bp] << 9;
  9394. this.ct = 7;
  9395. this.bp = bp;
  9396. }
  9397. } else {
  9398. bp++;
  9399. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  9400. this.ct = 8;
  9401. this.bp = bp;
  9402. }
  9403. if (this.clow > 0xffff) {
  9404. this.chigh += this.clow >> 16;
  9405. this.clow &= 0xffff;
  9406. }
  9407. }
  9408. readBit(contexts, pos) {
  9409. let cx_index = contexts[pos] >> 1,
  9410. cx_mps = contexts[pos] & 1;
  9411. const qeTableIcx = QeTable[cx_index];
  9412. const qeIcx = qeTableIcx.qe;
  9413. let d;
  9414. let a = this.a - qeIcx;
  9415. if (this.chigh < qeIcx) {
  9416. if (a < qeIcx) {
  9417. a = qeIcx;
  9418. d = cx_mps;
  9419. cx_index = qeTableIcx.nmps;
  9420. } else {
  9421. a = qeIcx;
  9422. d = 1 ^ cx_mps;
  9423. if (qeTableIcx.switchFlag === 1) {
  9424. cx_mps = d;
  9425. }
  9426. cx_index = qeTableIcx.nlps;
  9427. }
  9428. } else {
  9429. this.chigh -= qeIcx;
  9430. if ((a & 0x8000) !== 0) {
  9431. this.a = a;
  9432. return cx_mps;
  9433. }
  9434. if (a < qeIcx) {
  9435. d = 1 ^ cx_mps;
  9436. if (qeTableIcx.switchFlag === 1) {
  9437. cx_mps = d;
  9438. }
  9439. cx_index = qeTableIcx.nlps;
  9440. } else {
  9441. d = cx_mps;
  9442. cx_index = qeTableIcx.nmps;
  9443. }
  9444. }
  9445. do {
  9446. if (this.ct === 0) {
  9447. this.byteIn();
  9448. }
  9449. a <<= 1;
  9450. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  9451. this.clow = this.clow << 1 & 0xffff;
  9452. this.ct--;
  9453. } while ((a & 0x8000) === 0);
  9454. this.a = a;
  9455. contexts[pos] = cx_index << 1 | cx_mps;
  9456. return d;
  9457. }
  9458. }
  9459. exports.ArithmeticDecoder = ArithmeticDecoder;
  9460. /***/ }),
  9461. /* 17 */
  9462. /***/ (function(module, exports, __w_pdfjs_require__) {
  9463. "use strict";
  9464. Object.defineProperty(exports, "__esModule", {
  9465. value: true
  9466. });
  9467. exports.JpegStream = void 0;
  9468. var _util = __w_pdfjs_require__(2);
  9469. var _stream = __w_pdfjs_require__(11);
  9470. var _primitives = __w_pdfjs_require__(4);
  9471. var _jpg = __w_pdfjs_require__(18);
  9472. const JpegStream = function JpegStreamClosure() {
  9473. function JpegStream(stream, maybeLength, dict, params) {
  9474. let ch;
  9475. while ((ch = stream.getByte()) !== -1) {
  9476. if (ch === 0xff) {
  9477. stream.skip(-1);
  9478. break;
  9479. }
  9480. }
  9481. this.stream = stream;
  9482. this.maybeLength = maybeLength;
  9483. this.dict = dict;
  9484. this.params = params;
  9485. _stream.DecodeStream.call(this, maybeLength);
  9486. }
  9487. JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);
  9488. Object.defineProperty(JpegStream.prototype, "bytes", {
  9489. get: function JpegStream_bytes() {
  9490. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  9491. },
  9492. configurable: true
  9493. });
  9494. JpegStream.prototype.ensureBuffer = function (requested) {};
  9495. JpegStream.prototype.readBlock = function () {
  9496. if (this.eof) {
  9497. return;
  9498. }
  9499. const jpegOptions = {
  9500. decodeTransform: undefined,
  9501. colorTransform: undefined
  9502. };
  9503. const decodeArr = this.dict.getArray("Decode", "D");
  9504. if (this.forceRGB && Array.isArray(decodeArr)) {
  9505. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  9506. const decodeArrLength = decodeArr.length;
  9507. const transform = new Int32Array(decodeArrLength);
  9508. let transformNeeded = false;
  9509. const maxValue = (1 << bitsPerComponent) - 1;
  9510. for (let i = 0; i < decodeArrLength; i += 2) {
  9511. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  9512. transform[i + 1] = decodeArr[i] * maxValue | 0;
  9513. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  9514. transformNeeded = true;
  9515. }
  9516. }
  9517. if (transformNeeded) {
  9518. jpegOptions.decodeTransform = transform;
  9519. }
  9520. }
  9521. if ((0, _primitives.isDict)(this.params)) {
  9522. const colorTransform = this.params.get("ColorTransform");
  9523. if (Number.isInteger(colorTransform)) {
  9524. jpegOptions.colorTransform = colorTransform;
  9525. }
  9526. }
  9527. const jpegImage = new _jpg.JpegImage(jpegOptions);
  9528. jpegImage.parse(this.bytes);
  9529. const data = jpegImage.getData({
  9530. width: this.drawWidth,
  9531. height: this.drawHeight,
  9532. forceRGB: this.forceRGB,
  9533. isSourcePDF: true
  9534. });
  9535. this.buffer = data;
  9536. this.bufferLength = data.length;
  9537. this.eof = true;
  9538. };
  9539. Object.defineProperty(JpegStream.prototype, "maybeValidDimensions", {
  9540. get: function JpegStream_maybeValidDimensions() {
  9541. const {
  9542. dict,
  9543. stream
  9544. } = this;
  9545. const dictHeight = dict.get("Height", "H");
  9546. const startPos = stream.pos;
  9547. let validDimensions = true,
  9548. foundSOF = false,
  9549. b;
  9550. while ((b = stream.getByte()) !== -1) {
  9551. if (b !== 0xff) {
  9552. continue;
  9553. }
  9554. switch (stream.getByte()) {
  9555. case 0xc0:
  9556. case 0xc1:
  9557. case 0xc2:
  9558. foundSOF = true;
  9559. stream.pos += 2;
  9560. stream.pos += 1;
  9561. const scanLines = stream.getUint16();
  9562. if (scanLines === dictHeight) {
  9563. break;
  9564. }
  9565. if (scanLines === 0) {
  9566. validDimensions = false;
  9567. break;
  9568. }
  9569. if (scanLines > dictHeight * 10) {
  9570. validDimensions = false;
  9571. break;
  9572. }
  9573. break;
  9574. case 0xc3:
  9575. case 0xc5:
  9576. case 0xc6:
  9577. case 0xc7:
  9578. case 0xc9:
  9579. case 0xca:
  9580. case 0xcb:
  9581. case 0xcd:
  9582. case 0xce:
  9583. case 0xcf:
  9584. foundSOF = true;
  9585. break;
  9586. case 0xc4:
  9587. case 0xcc:
  9588. case 0xda:
  9589. case 0xdb:
  9590. case 0xdc:
  9591. case 0xdd:
  9592. case 0xde:
  9593. case 0xdf:
  9594. case 0xe0:
  9595. case 0xe1:
  9596. case 0xe2:
  9597. case 0xe3:
  9598. case 0xe4:
  9599. case 0xe5:
  9600. case 0xe6:
  9601. case 0xe7:
  9602. case 0xe8:
  9603. case 0xe9:
  9604. case 0xea:
  9605. case 0xeb:
  9606. case 0xec:
  9607. case 0xed:
  9608. case 0xee:
  9609. case 0xef:
  9610. case 0xfe:
  9611. const markerLength = stream.getUint16();
  9612. if (markerLength > 2) {
  9613. stream.skip(markerLength - 2);
  9614. } else {
  9615. stream.skip(-2);
  9616. }
  9617. break;
  9618. case 0xff:
  9619. stream.skip(-1);
  9620. break;
  9621. case 0xd9:
  9622. foundSOF = true;
  9623. break;
  9624. }
  9625. if (foundSOF) {
  9626. break;
  9627. }
  9628. }
  9629. stream.pos = startPos;
  9630. return (0, _util.shadow)(this, "maybeValidDimensions", validDimensions);
  9631. },
  9632. configurable: true
  9633. });
  9634. JpegStream.prototype.getIR = function (forceDataSchema = false) {
  9635. return (0, _util.createObjectURL)(this.bytes, "image/jpeg", forceDataSchema);
  9636. };
  9637. return JpegStream;
  9638. }();
  9639. exports.JpegStream = JpegStream;
  9640. /***/ }),
  9641. /* 18 */
  9642. /***/ (function(module, exports, __w_pdfjs_require__) {
  9643. "use strict";
  9644. Object.defineProperty(exports, "__esModule", {
  9645. value: true
  9646. });
  9647. exports.JpegImage = void 0;
  9648. var _util = __w_pdfjs_require__(2);
  9649. var _core_utils = __w_pdfjs_require__(7);
  9650. class JpegError extends _util.BaseException {
  9651. constructor(msg) {
  9652. super(`JPEG error: ${msg}`);
  9653. }
  9654. }
  9655. class DNLMarkerError extends _util.BaseException {
  9656. constructor(message, scanLines) {
  9657. super(message);
  9658. this.scanLines = scanLines;
  9659. }
  9660. }
  9661. class EOIMarkerError extends _util.BaseException {}
  9662. var JpegImage = function JpegImageClosure() {
  9663. var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
  9664. var dctCos1 = 4017;
  9665. var dctSin1 = 799;
  9666. var dctCos3 = 3406;
  9667. var dctSin3 = 2276;
  9668. var dctCos6 = 1567;
  9669. var dctSin6 = 3784;
  9670. var dctSqrt2 = 5793;
  9671. var dctSqrt1d2 = 2896;
  9672. function JpegImage({
  9673. decodeTransform = null,
  9674. colorTransform = -1
  9675. } = {}) {
  9676. this._decodeTransform = decodeTransform;
  9677. this._colorTransform = colorTransform;
  9678. }
  9679. function buildHuffmanTable(codeLengths, values) {
  9680. var k = 0,
  9681. code = [],
  9682. i,
  9683. j,
  9684. length = 16;
  9685. while (length > 0 && !codeLengths[length - 1]) {
  9686. length--;
  9687. }
  9688. code.push({
  9689. children: [],
  9690. index: 0
  9691. });
  9692. var p = code[0],
  9693. q;
  9694. for (i = 0; i < length; i++) {
  9695. for (j = 0; j < codeLengths[i]; j++) {
  9696. p = code.pop();
  9697. p.children[p.index] = values[k];
  9698. while (p.index > 0) {
  9699. p = code.pop();
  9700. }
  9701. p.index++;
  9702. code.push(p);
  9703. while (code.length <= i) {
  9704. code.push(q = {
  9705. children: [],
  9706. index: 0
  9707. });
  9708. p.children[p.index] = q.children;
  9709. p = q;
  9710. }
  9711. k++;
  9712. }
  9713. if (i + 1 < length) {
  9714. code.push(q = {
  9715. children: [],
  9716. index: 0
  9717. });
  9718. p.children[p.index] = q.children;
  9719. p = q;
  9720. }
  9721. }
  9722. return code[0].children;
  9723. }
  9724. function getBlockBufferOffset(component, row, col) {
  9725. return 64 * ((component.blocksPerLine + 1) * row + col);
  9726. }
  9727. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  9728. var mcusPerLine = frame.mcusPerLine;
  9729. var progressive = frame.progressive;
  9730. var startOffset = offset,
  9731. bitsData = 0,
  9732. bitsCount = 0;
  9733. function readBit() {
  9734. if (bitsCount > 0) {
  9735. bitsCount--;
  9736. return bitsData >> bitsCount & 1;
  9737. }
  9738. bitsData = data[offset++];
  9739. if (bitsData === 0xff) {
  9740. var nextByte = data[offset++];
  9741. if (nextByte) {
  9742. if (nextByte === 0xdc && parseDNLMarker) {
  9743. offset += 2;
  9744. const scanLines = (0, _core_utils.readUint16)(data, offset);
  9745. offset += 2;
  9746. if (scanLines > 0 && scanLines !== frame.scanLines) {
  9747. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  9748. }
  9749. } else if (nextByte === 0xd9) {
  9750. if (parseDNLMarker) {
  9751. const maybeScanLines = blockRow * 8;
  9752. if (maybeScanLines > 0 && maybeScanLines < frame.scanLines / 10) {
  9753. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  9754. }
  9755. }
  9756. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  9757. }
  9758. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  9759. }
  9760. }
  9761. bitsCount = 7;
  9762. return bitsData >>> 7;
  9763. }
  9764. function decodeHuffman(tree) {
  9765. var node = tree;
  9766. while (true) {
  9767. node = node[readBit()];
  9768. switch (typeof node) {
  9769. case "number":
  9770. return node;
  9771. case "object":
  9772. continue;
  9773. }
  9774. throw new JpegError("invalid huffman sequence");
  9775. }
  9776. }
  9777. function receive(length) {
  9778. var n = 0;
  9779. while (length > 0) {
  9780. n = n << 1 | readBit();
  9781. length--;
  9782. }
  9783. return n;
  9784. }
  9785. function receiveAndExtend(length) {
  9786. if (length === 1) {
  9787. return readBit() === 1 ? 1 : -1;
  9788. }
  9789. var n = receive(length);
  9790. if (n >= 1 << length - 1) {
  9791. return n;
  9792. }
  9793. return n + (-1 << length) + 1;
  9794. }
  9795. function decodeBaseline(component, offset) {
  9796. var t = decodeHuffman(component.huffmanTableDC);
  9797. var diff = t === 0 ? 0 : receiveAndExtend(t);
  9798. component.blockData[offset] = component.pred += diff;
  9799. var k = 1;
  9800. while (k < 64) {
  9801. var rs = decodeHuffman(component.huffmanTableAC);
  9802. var s = rs & 15,
  9803. r = rs >> 4;
  9804. if (s === 0) {
  9805. if (r < 15) {
  9806. break;
  9807. }
  9808. k += 16;
  9809. continue;
  9810. }
  9811. k += r;
  9812. var z = dctZigZag[k];
  9813. component.blockData[offset + z] = receiveAndExtend(s);
  9814. k++;
  9815. }
  9816. }
  9817. function decodeDCFirst(component, offset) {
  9818. var t = decodeHuffman(component.huffmanTableDC);
  9819. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  9820. component.blockData[offset] = component.pred += diff;
  9821. }
  9822. function decodeDCSuccessive(component, offset) {
  9823. component.blockData[offset] |= readBit() << successive;
  9824. }
  9825. var eobrun = 0;
  9826. function decodeACFirst(component, offset) {
  9827. if (eobrun > 0) {
  9828. eobrun--;
  9829. return;
  9830. }
  9831. var k = spectralStart,
  9832. e = spectralEnd;
  9833. while (k <= e) {
  9834. var rs = decodeHuffman(component.huffmanTableAC);
  9835. var s = rs & 15,
  9836. r = rs >> 4;
  9837. if (s === 0) {
  9838. if (r < 15) {
  9839. eobrun = receive(r) + (1 << r) - 1;
  9840. break;
  9841. }
  9842. k += 16;
  9843. continue;
  9844. }
  9845. k += r;
  9846. var z = dctZigZag[k];
  9847. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  9848. k++;
  9849. }
  9850. }
  9851. var successiveACState = 0,
  9852. successiveACNextValue;
  9853. function decodeACSuccessive(component, offset) {
  9854. var k = spectralStart;
  9855. var e = spectralEnd;
  9856. var r = 0;
  9857. var s;
  9858. var rs;
  9859. while (k <= e) {
  9860. const offsetZ = offset + dctZigZag[k];
  9861. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  9862. switch (successiveACState) {
  9863. case 0:
  9864. rs = decodeHuffman(component.huffmanTableAC);
  9865. s = rs & 15;
  9866. r = rs >> 4;
  9867. if (s === 0) {
  9868. if (r < 15) {
  9869. eobrun = receive(r) + (1 << r);
  9870. successiveACState = 4;
  9871. } else {
  9872. r = 16;
  9873. successiveACState = 1;
  9874. }
  9875. } else {
  9876. if (s !== 1) {
  9877. throw new JpegError("invalid ACn encoding");
  9878. }
  9879. successiveACNextValue = receiveAndExtend(s);
  9880. successiveACState = r ? 2 : 3;
  9881. }
  9882. continue;
  9883. case 1:
  9884. case 2:
  9885. if (component.blockData[offsetZ]) {
  9886. component.blockData[offsetZ] += sign * (readBit() << successive);
  9887. } else {
  9888. r--;
  9889. if (r === 0) {
  9890. successiveACState = successiveACState === 2 ? 3 : 0;
  9891. }
  9892. }
  9893. break;
  9894. case 3:
  9895. if (component.blockData[offsetZ]) {
  9896. component.blockData[offsetZ] += sign * (readBit() << successive);
  9897. } else {
  9898. component.blockData[offsetZ] = successiveACNextValue << successive;
  9899. successiveACState = 0;
  9900. }
  9901. break;
  9902. case 4:
  9903. if (component.blockData[offsetZ]) {
  9904. component.blockData[offsetZ] += sign * (readBit() << successive);
  9905. }
  9906. break;
  9907. }
  9908. k++;
  9909. }
  9910. if (successiveACState === 4) {
  9911. eobrun--;
  9912. if (eobrun === 0) {
  9913. successiveACState = 0;
  9914. }
  9915. }
  9916. }
  9917. let blockRow = 0;
  9918. function decodeMcu(component, decode, mcu, row, col) {
  9919. var mcuRow = mcu / mcusPerLine | 0;
  9920. var mcuCol = mcu % mcusPerLine;
  9921. blockRow = mcuRow * component.v + row;
  9922. var blockCol = mcuCol * component.h + col;
  9923. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  9924. decode(component, offset);
  9925. }
  9926. function decodeBlock(component, decode, mcu) {
  9927. blockRow = mcu / component.blocksPerLine | 0;
  9928. var blockCol = mcu % component.blocksPerLine;
  9929. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  9930. decode(component, offset);
  9931. }
  9932. var componentsLength = components.length;
  9933. var component, i, j, k, n;
  9934. var decodeFn;
  9935. if (progressive) {
  9936. if (spectralStart === 0) {
  9937. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  9938. } else {
  9939. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  9940. }
  9941. } else {
  9942. decodeFn = decodeBaseline;
  9943. }
  9944. var mcu = 0,
  9945. fileMarker;
  9946. var mcuExpected;
  9947. if (componentsLength === 1) {
  9948. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  9949. } else {
  9950. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  9951. }
  9952. var h, v;
  9953. while (mcu < mcuExpected) {
  9954. var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  9955. for (i = 0; i < componentsLength; i++) {
  9956. components[i].pred = 0;
  9957. }
  9958. eobrun = 0;
  9959. if (componentsLength === 1) {
  9960. component = components[0];
  9961. for (n = 0; n < mcuToRead; n++) {
  9962. decodeBlock(component, decodeFn, mcu);
  9963. mcu++;
  9964. }
  9965. } else {
  9966. for (n = 0; n < mcuToRead; n++) {
  9967. for (i = 0; i < componentsLength; i++) {
  9968. component = components[i];
  9969. h = component.h;
  9970. v = component.v;
  9971. for (j = 0; j < v; j++) {
  9972. for (k = 0; k < h; k++) {
  9973. decodeMcu(component, decodeFn, mcu, j, k);
  9974. }
  9975. }
  9976. }
  9977. mcu++;
  9978. }
  9979. }
  9980. bitsCount = 0;
  9981. fileMarker = findNextFileMarker(data, offset);
  9982. if (!fileMarker) {
  9983. break;
  9984. } else if (fileMarker.invalid) {
  9985. (0, _util.warn)("decodeScan - unexpected MCU data, current marker is: " + fileMarker.invalid);
  9986. offset = fileMarker.offset;
  9987. }
  9988. var marker = fileMarker && fileMarker.marker;
  9989. if (!marker || marker <= 0xff00) {
  9990. throw new JpegError("decodeScan - a valid marker was not found.");
  9991. }
  9992. if (marker >= 0xffd0 && marker <= 0xffd7) {
  9993. offset += 2;
  9994. } else {
  9995. break;
  9996. }
  9997. }
  9998. fileMarker = findNextFileMarker(data, offset);
  9999. if (fileMarker && fileMarker.invalid) {
  10000. (0, _util.warn)("decodeScan - unexpected Scan data, current marker is: " + fileMarker.invalid);
  10001. offset = fileMarker.offset;
  10002. }
  10003. return offset - startOffset;
  10004. }
  10005. function quantizeAndInverse(component, blockBufferOffset, p) {
  10006. var qt = component.quantizationTable,
  10007. blockData = component.blockData;
  10008. var v0, v1, v2, v3, v4, v5, v6, v7;
  10009. var p0, p1, p2, p3, p4, p5, p6, p7;
  10010. var t;
  10011. if (!qt) {
  10012. throw new JpegError("missing required Quantization Table.");
  10013. }
  10014. for (var row = 0; row < 64; row += 8) {
  10015. p0 = blockData[blockBufferOffset + row];
  10016. p1 = blockData[blockBufferOffset + row + 1];
  10017. p2 = blockData[blockBufferOffset + row + 2];
  10018. p3 = blockData[blockBufferOffset + row + 3];
  10019. p4 = blockData[blockBufferOffset + row + 4];
  10020. p5 = blockData[blockBufferOffset + row + 5];
  10021. p6 = blockData[blockBufferOffset + row + 6];
  10022. p7 = blockData[blockBufferOffset + row + 7];
  10023. p0 *= qt[row];
  10024. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10025. t = dctSqrt2 * p0 + 512 >> 10;
  10026. p[row] = t;
  10027. p[row + 1] = t;
  10028. p[row + 2] = t;
  10029. p[row + 3] = t;
  10030. p[row + 4] = t;
  10031. p[row + 5] = t;
  10032. p[row + 6] = t;
  10033. p[row + 7] = t;
  10034. continue;
  10035. }
  10036. p1 *= qt[row + 1];
  10037. p2 *= qt[row + 2];
  10038. p3 *= qt[row + 3];
  10039. p4 *= qt[row + 4];
  10040. p5 *= qt[row + 5];
  10041. p6 *= qt[row + 6];
  10042. p7 *= qt[row + 7];
  10043. v0 = dctSqrt2 * p0 + 128 >> 8;
  10044. v1 = dctSqrt2 * p4 + 128 >> 8;
  10045. v2 = p2;
  10046. v3 = p6;
  10047. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  10048. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  10049. v5 = p3 << 4;
  10050. v6 = p5 << 4;
  10051. v0 = v0 + v1 + 1 >> 1;
  10052. v1 = v0 - v1;
  10053. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  10054. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  10055. v3 = t;
  10056. v4 = v4 + v6 + 1 >> 1;
  10057. v6 = v4 - v6;
  10058. v7 = v7 + v5 + 1 >> 1;
  10059. v5 = v7 - v5;
  10060. v0 = v0 + v3 + 1 >> 1;
  10061. v3 = v0 - v3;
  10062. v1 = v1 + v2 + 1 >> 1;
  10063. v2 = v1 - v2;
  10064. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10065. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10066. v7 = t;
  10067. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10068. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10069. v6 = t;
  10070. p[row] = v0 + v7;
  10071. p[row + 7] = v0 - v7;
  10072. p[row + 1] = v1 + v6;
  10073. p[row + 6] = v1 - v6;
  10074. p[row + 2] = v2 + v5;
  10075. p[row + 5] = v2 - v5;
  10076. p[row + 3] = v3 + v4;
  10077. p[row + 4] = v3 - v4;
  10078. }
  10079. for (var col = 0; col < 8; ++col) {
  10080. p0 = p[col];
  10081. p1 = p[col + 8];
  10082. p2 = p[col + 16];
  10083. p3 = p[col + 24];
  10084. p4 = p[col + 32];
  10085. p5 = p[col + 40];
  10086. p6 = p[col + 48];
  10087. p7 = p[col + 56];
  10088. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10089. t = dctSqrt2 * p0 + 8192 >> 14;
  10090. if (t < -2040) {
  10091. t = 0;
  10092. } else if (t >= 2024) {
  10093. t = 255;
  10094. } else {
  10095. t = t + 2056 >> 4;
  10096. }
  10097. blockData[blockBufferOffset + col] = t;
  10098. blockData[blockBufferOffset + col + 8] = t;
  10099. blockData[blockBufferOffset + col + 16] = t;
  10100. blockData[blockBufferOffset + col + 24] = t;
  10101. blockData[blockBufferOffset + col + 32] = t;
  10102. blockData[blockBufferOffset + col + 40] = t;
  10103. blockData[blockBufferOffset + col + 48] = t;
  10104. blockData[blockBufferOffset + col + 56] = t;
  10105. continue;
  10106. }
  10107. v0 = dctSqrt2 * p0 + 2048 >> 12;
  10108. v1 = dctSqrt2 * p4 + 2048 >> 12;
  10109. v2 = p2;
  10110. v3 = p6;
  10111. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  10112. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  10113. v5 = p3;
  10114. v6 = p5;
  10115. v0 = (v0 + v1 + 1 >> 1) + 4112;
  10116. v1 = v0 - v1;
  10117. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  10118. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  10119. v3 = t;
  10120. v4 = v4 + v6 + 1 >> 1;
  10121. v6 = v4 - v6;
  10122. v7 = v7 + v5 + 1 >> 1;
  10123. v5 = v7 - v5;
  10124. v0 = v0 + v3 + 1 >> 1;
  10125. v3 = v0 - v3;
  10126. v1 = v1 + v2 + 1 >> 1;
  10127. v2 = v1 - v2;
  10128. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10129. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10130. v7 = t;
  10131. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10132. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10133. v6 = t;
  10134. p0 = v0 + v7;
  10135. p7 = v0 - v7;
  10136. p1 = v1 + v6;
  10137. p6 = v1 - v6;
  10138. p2 = v2 + v5;
  10139. p5 = v2 - v5;
  10140. p3 = v3 + v4;
  10141. p4 = v3 - v4;
  10142. if (p0 < 16) {
  10143. p0 = 0;
  10144. } else if (p0 >= 4080) {
  10145. p0 = 255;
  10146. } else {
  10147. p0 >>= 4;
  10148. }
  10149. if (p1 < 16) {
  10150. p1 = 0;
  10151. } else if (p1 >= 4080) {
  10152. p1 = 255;
  10153. } else {
  10154. p1 >>= 4;
  10155. }
  10156. if (p2 < 16) {
  10157. p2 = 0;
  10158. } else if (p2 >= 4080) {
  10159. p2 = 255;
  10160. } else {
  10161. p2 >>= 4;
  10162. }
  10163. if (p3 < 16) {
  10164. p3 = 0;
  10165. } else if (p3 >= 4080) {
  10166. p3 = 255;
  10167. } else {
  10168. p3 >>= 4;
  10169. }
  10170. if (p4 < 16) {
  10171. p4 = 0;
  10172. } else if (p4 >= 4080) {
  10173. p4 = 255;
  10174. } else {
  10175. p4 >>= 4;
  10176. }
  10177. if (p5 < 16) {
  10178. p5 = 0;
  10179. } else if (p5 >= 4080) {
  10180. p5 = 255;
  10181. } else {
  10182. p5 >>= 4;
  10183. }
  10184. if (p6 < 16) {
  10185. p6 = 0;
  10186. } else if (p6 >= 4080) {
  10187. p6 = 255;
  10188. } else {
  10189. p6 >>= 4;
  10190. }
  10191. if (p7 < 16) {
  10192. p7 = 0;
  10193. } else if (p7 >= 4080) {
  10194. p7 = 255;
  10195. } else {
  10196. p7 >>= 4;
  10197. }
  10198. blockData[blockBufferOffset + col] = p0;
  10199. blockData[blockBufferOffset + col + 8] = p1;
  10200. blockData[blockBufferOffset + col + 16] = p2;
  10201. blockData[blockBufferOffset + col + 24] = p3;
  10202. blockData[blockBufferOffset + col + 32] = p4;
  10203. blockData[blockBufferOffset + col + 40] = p5;
  10204. blockData[blockBufferOffset + col + 48] = p6;
  10205. blockData[blockBufferOffset + col + 56] = p7;
  10206. }
  10207. }
  10208. function buildComponentData(frame, component) {
  10209. var blocksPerLine = component.blocksPerLine;
  10210. var blocksPerColumn = component.blocksPerColumn;
  10211. var computationBuffer = new Int16Array(64);
  10212. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  10213. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  10214. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  10215. quantizeAndInverse(component, offset, computationBuffer);
  10216. }
  10217. }
  10218. return component.blockData;
  10219. }
  10220. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  10221. const maxPos = data.length - 1;
  10222. var newPos = startPos < currentPos ? startPos : currentPos;
  10223. if (currentPos >= maxPos) {
  10224. return null;
  10225. }
  10226. var currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  10227. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  10228. return {
  10229. invalid: null,
  10230. marker: currentMarker,
  10231. offset: currentPos
  10232. };
  10233. }
  10234. var newMarker = (0, _core_utils.readUint16)(data, newPos);
  10235. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  10236. if (++newPos >= maxPos) {
  10237. return null;
  10238. }
  10239. newMarker = (0, _core_utils.readUint16)(data, newPos);
  10240. }
  10241. return {
  10242. invalid: currentMarker.toString(16),
  10243. marker: newMarker,
  10244. offset: newPos
  10245. };
  10246. }
  10247. JpegImage.prototype = {
  10248. parse(data, {
  10249. dnlScanLines = null
  10250. } = {}) {
  10251. function readDataBlock() {
  10252. const length = (0, _core_utils.readUint16)(data, offset);
  10253. offset += 2;
  10254. let endOffset = offset + length - 2;
  10255. var fileMarker = findNextFileMarker(data, endOffset, offset);
  10256. if (fileMarker && fileMarker.invalid) {
  10257. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  10258. endOffset = fileMarker.offset;
  10259. }
  10260. var array = data.subarray(offset, endOffset);
  10261. offset += array.length;
  10262. return array;
  10263. }
  10264. function prepareComponents(frame) {
  10265. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  10266. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  10267. for (var i = 0; i < frame.components.length; i++) {
  10268. component = frame.components[i];
  10269. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  10270. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  10271. var blocksPerLineForMcu = mcusPerLine * component.h;
  10272. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  10273. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  10274. component.blockData = new Int16Array(blocksBufferSize);
  10275. component.blocksPerLine = blocksPerLine;
  10276. component.blocksPerColumn = blocksPerColumn;
  10277. }
  10278. frame.mcusPerLine = mcusPerLine;
  10279. frame.mcusPerColumn = mcusPerColumn;
  10280. }
  10281. var offset = 0;
  10282. var jfif = null;
  10283. var adobe = null;
  10284. var frame, resetInterval;
  10285. let numSOSMarkers = 0;
  10286. var quantizationTables = [];
  10287. var huffmanTablesAC = [],
  10288. huffmanTablesDC = [];
  10289. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  10290. offset += 2;
  10291. if (fileMarker !== 0xffd8) {
  10292. throw new JpegError("SOI not found");
  10293. }
  10294. fileMarker = (0, _core_utils.readUint16)(data, offset);
  10295. offset += 2;
  10296. markerLoop: while (fileMarker !== 0xffd9) {
  10297. var i, j, l;
  10298. switch (fileMarker) {
  10299. case 0xffe0:
  10300. case 0xffe1:
  10301. case 0xffe2:
  10302. case 0xffe3:
  10303. case 0xffe4:
  10304. case 0xffe5:
  10305. case 0xffe6:
  10306. case 0xffe7:
  10307. case 0xffe8:
  10308. case 0xffe9:
  10309. case 0xffea:
  10310. case 0xffeb:
  10311. case 0xffec:
  10312. case 0xffed:
  10313. case 0xffee:
  10314. case 0xffef:
  10315. case 0xfffe:
  10316. var appData = readDataBlock();
  10317. if (fileMarker === 0xffe0) {
  10318. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  10319. jfif = {
  10320. version: {
  10321. major: appData[5],
  10322. minor: appData[6]
  10323. },
  10324. densityUnits: appData[7],
  10325. xDensity: appData[8] << 8 | appData[9],
  10326. yDensity: appData[10] << 8 | appData[11],
  10327. thumbWidth: appData[12],
  10328. thumbHeight: appData[13],
  10329. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  10330. };
  10331. }
  10332. }
  10333. if (fileMarker === 0xffee) {
  10334. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  10335. adobe = {
  10336. version: appData[5] << 8 | appData[6],
  10337. flags0: appData[7] << 8 | appData[8],
  10338. flags1: appData[9] << 8 | appData[10],
  10339. transformCode: appData[11]
  10340. };
  10341. }
  10342. }
  10343. break;
  10344. case 0xffdb:
  10345. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  10346. offset += 2;
  10347. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  10348. var z;
  10349. while (offset < quantizationTablesEnd) {
  10350. var quantizationTableSpec = data[offset++];
  10351. var tableData = new Uint16Array(64);
  10352. if (quantizationTableSpec >> 4 === 0) {
  10353. for (j = 0; j < 64; j++) {
  10354. z = dctZigZag[j];
  10355. tableData[z] = data[offset++];
  10356. }
  10357. } else if (quantizationTableSpec >> 4 === 1) {
  10358. for (j = 0; j < 64; j++) {
  10359. z = dctZigZag[j];
  10360. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  10361. offset += 2;
  10362. }
  10363. } else {
  10364. throw new JpegError("DQT - invalid table spec");
  10365. }
  10366. quantizationTables[quantizationTableSpec & 15] = tableData;
  10367. }
  10368. break;
  10369. case 0xffc0:
  10370. case 0xffc1:
  10371. case 0xffc2:
  10372. if (frame) {
  10373. throw new JpegError("Only single frame JPEGs supported");
  10374. }
  10375. offset += 2;
  10376. frame = {};
  10377. frame.extended = fileMarker === 0xffc1;
  10378. frame.progressive = fileMarker === 0xffc2;
  10379. frame.precision = data[offset++];
  10380. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  10381. offset += 2;
  10382. frame.scanLines = dnlScanLines || sofScanLines;
  10383. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  10384. offset += 2;
  10385. frame.components = [];
  10386. frame.componentIds = {};
  10387. var componentsCount = data[offset++],
  10388. componentId;
  10389. var maxH = 0,
  10390. maxV = 0;
  10391. for (i = 0; i < componentsCount; i++) {
  10392. componentId = data[offset];
  10393. var h = data[offset + 1] >> 4;
  10394. var v = data[offset + 1] & 15;
  10395. if (maxH < h) {
  10396. maxH = h;
  10397. }
  10398. if (maxV < v) {
  10399. maxV = v;
  10400. }
  10401. var qId = data[offset + 2];
  10402. l = frame.components.push({
  10403. h,
  10404. v,
  10405. quantizationId: qId,
  10406. quantizationTable: null
  10407. });
  10408. frame.componentIds[componentId] = l - 1;
  10409. offset += 3;
  10410. }
  10411. frame.maxH = maxH;
  10412. frame.maxV = maxV;
  10413. prepareComponents(frame);
  10414. break;
  10415. case 0xffc4:
  10416. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  10417. offset += 2;
  10418. for (i = 2; i < huffmanLength;) {
  10419. var huffmanTableSpec = data[offset++];
  10420. var codeLengths = new Uint8Array(16);
  10421. var codeLengthSum = 0;
  10422. for (j = 0; j < 16; j++, offset++) {
  10423. codeLengthSum += codeLengths[j] = data[offset];
  10424. }
  10425. var huffmanValues = new Uint8Array(codeLengthSum);
  10426. for (j = 0; j < codeLengthSum; j++, offset++) {
  10427. huffmanValues[j] = data[offset];
  10428. }
  10429. i += 17 + codeLengthSum;
  10430. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  10431. }
  10432. break;
  10433. case 0xffdd:
  10434. offset += 2;
  10435. resetInterval = (0, _core_utils.readUint16)(data, offset);
  10436. offset += 2;
  10437. break;
  10438. case 0xffda:
  10439. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  10440. offset += 2;
  10441. var selectorsCount = data[offset++];
  10442. var components = [],
  10443. component;
  10444. for (i = 0; i < selectorsCount; i++) {
  10445. var componentIndex = frame.componentIds[data[offset++]];
  10446. component = frame.components[componentIndex];
  10447. var tableSpec = data[offset++];
  10448. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  10449. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  10450. components.push(component);
  10451. }
  10452. var spectralStart = data[offset++];
  10453. var spectralEnd = data[offset++];
  10454. var successiveApproximation = data[offset++];
  10455. try {
  10456. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  10457. offset += processed;
  10458. } catch (ex) {
  10459. if (ex instanceof DNLMarkerError) {
  10460. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  10461. return this.parse(data, {
  10462. dnlScanLines: ex.scanLines
  10463. });
  10464. } else if (ex instanceof EOIMarkerError) {
  10465. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  10466. break markerLoop;
  10467. }
  10468. throw ex;
  10469. }
  10470. break;
  10471. case 0xffdc:
  10472. offset += 4;
  10473. break;
  10474. case 0xffff:
  10475. if (data[offset] !== 0xff) {
  10476. offset--;
  10477. }
  10478. break;
  10479. default:
  10480. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  10481. if (nextFileMarker && nextFileMarker.invalid) {
  10482. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  10483. offset = nextFileMarker.offset;
  10484. break;
  10485. }
  10486. if (offset >= data.length - 1) {
  10487. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  10488. break markerLoop;
  10489. }
  10490. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  10491. }
  10492. fileMarker = (0, _core_utils.readUint16)(data, offset);
  10493. offset += 2;
  10494. }
  10495. this.width = frame.samplesPerLine;
  10496. this.height = frame.scanLines;
  10497. this.jfif = jfif;
  10498. this.adobe = adobe;
  10499. this.components = [];
  10500. for (i = 0; i < frame.components.length; i++) {
  10501. component = frame.components[i];
  10502. var quantizationTable = quantizationTables[component.quantizationId];
  10503. if (quantizationTable) {
  10504. component.quantizationTable = quantizationTable;
  10505. }
  10506. this.components.push({
  10507. output: buildComponentData(frame, component),
  10508. scaleX: component.h / frame.maxH,
  10509. scaleY: component.v / frame.maxV,
  10510. blocksPerLine: component.blocksPerLine,
  10511. blocksPerColumn: component.blocksPerColumn
  10512. });
  10513. }
  10514. this.numComponents = this.components.length;
  10515. return undefined;
  10516. },
  10517. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  10518. var scaleX = this.width / width,
  10519. scaleY = this.height / height;
  10520. var component, componentScaleX, componentScaleY, blocksPerScanline;
  10521. var x, y, i, j, k;
  10522. var index;
  10523. var offset = 0;
  10524. var output;
  10525. var numComponents = this.components.length;
  10526. var dataLength = width * height * numComponents;
  10527. var data = new Uint8ClampedArray(dataLength);
  10528. var xScaleBlockOffset = new Uint32Array(width);
  10529. var mask3LSB = 0xfffffff8;
  10530. let lastComponentScaleX;
  10531. for (i = 0; i < numComponents; i++) {
  10532. component = this.components[i];
  10533. componentScaleX = component.scaleX * scaleX;
  10534. componentScaleY = component.scaleY * scaleY;
  10535. offset = i;
  10536. output = component.output;
  10537. blocksPerScanline = component.blocksPerLine + 1 << 3;
  10538. if (componentScaleX !== lastComponentScaleX) {
  10539. for (x = 0; x < width; x++) {
  10540. j = 0 | x * componentScaleX;
  10541. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  10542. }
  10543. lastComponentScaleX = componentScaleX;
  10544. }
  10545. for (y = 0; y < height; y++) {
  10546. j = 0 | y * componentScaleY;
  10547. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  10548. for (x = 0; x < width; x++) {
  10549. data[offset] = output[index + xScaleBlockOffset[x]];
  10550. offset += numComponents;
  10551. }
  10552. }
  10553. }
  10554. let transform = this._decodeTransform;
  10555. if (!isSourcePDF && numComponents === 4 && !transform) {
  10556. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  10557. }
  10558. if (transform) {
  10559. for (i = 0; i < dataLength;) {
  10560. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  10561. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  10562. }
  10563. }
  10564. }
  10565. return data;
  10566. },
  10567. get _isColorConversionNeeded() {
  10568. if (this.adobe) {
  10569. return !!this.adobe.transformCode;
  10570. }
  10571. if (this.numComponents === 3) {
  10572. if (this._colorTransform === 0) {
  10573. return false;
  10574. }
  10575. return true;
  10576. }
  10577. if (this._colorTransform === 1) {
  10578. return true;
  10579. }
  10580. return false;
  10581. },
  10582. _convertYccToRgb: function convertYccToRgb(data) {
  10583. var Y, Cb, Cr;
  10584. for (var i = 0, length = data.length; i < length; i += 3) {
  10585. Y = data[i];
  10586. Cb = data[i + 1];
  10587. Cr = data[i + 2];
  10588. data[i] = Y - 179.456 + 1.402 * Cr;
  10589. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  10590. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  10591. }
  10592. return data;
  10593. },
  10594. _convertYcckToRgb: function convertYcckToRgb(data) {
  10595. var Y, Cb, Cr, k;
  10596. var offset = 0;
  10597. for (var i = 0, length = data.length; i < length; i += 4) {
  10598. Y = data[i];
  10599. Cb = data[i + 1];
  10600. Cr = data[i + 2];
  10601. k = data[i + 3];
  10602. data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  10603. data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  10604. data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  10605. }
  10606. return data.subarray(0, offset);
  10607. },
  10608. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  10609. var Y, Cb, Cr;
  10610. for (var i = 0, length = data.length; i < length; i += 4) {
  10611. Y = data[i];
  10612. Cb = data[i + 1];
  10613. Cr = data[i + 2];
  10614. data[i] = 434.456 - Y - 1.402 * Cr;
  10615. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  10616. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  10617. }
  10618. return data;
  10619. },
  10620. _convertCmykToRgb: function convertCmykToRgb(data) {
  10621. var c, m, y, k;
  10622. var offset = 0;
  10623. for (var i = 0, length = data.length; i < length; i += 4) {
  10624. c = data[i];
  10625. m = data[i + 1];
  10626. y = data[i + 2];
  10627. k = data[i + 3];
  10628. data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  10629. data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.00031891311758832814 * k + 0.7364883807733168);
  10630. data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  10631. }
  10632. return data.subarray(0, offset);
  10633. },
  10634. getData({
  10635. width,
  10636. height,
  10637. forceRGB = false,
  10638. isSourcePDF = false
  10639. }) {
  10640. if (this.numComponents > 4) {
  10641. throw new JpegError("Unsupported color mode");
  10642. }
  10643. var data = this._getLinearizedBlockData(width, height, isSourcePDF);
  10644. if (this.numComponents === 1 && forceRGB) {
  10645. var dataLength = data.length;
  10646. var rgbData = new Uint8ClampedArray(dataLength * 3);
  10647. var offset = 0;
  10648. for (var i = 0; i < dataLength; i++) {
  10649. var grayColor = data[i];
  10650. rgbData[offset++] = grayColor;
  10651. rgbData[offset++] = grayColor;
  10652. rgbData[offset++] = grayColor;
  10653. }
  10654. return rgbData;
  10655. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  10656. return this._convertYccToRgb(data);
  10657. } else if (this.numComponents === 4) {
  10658. if (this._isColorConversionNeeded) {
  10659. if (forceRGB) {
  10660. return this._convertYcckToRgb(data);
  10661. }
  10662. return this._convertYcckToCmyk(data);
  10663. } else if (forceRGB) {
  10664. return this._convertCmykToRgb(data);
  10665. }
  10666. }
  10667. return data;
  10668. }
  10669. };
  10670. return JpegImage;
  10671. }();
  10672. exports.JpegImage = JpegImage;
  10673. /***/ }),
  10674. /* 19 */
  10675. /***/ (function(module, exports, __w_pdfjs_require__) {
  10676. "use strict";
  10677. Object.defineProperty(exports, "__esModule", {
  10678. value: true
  10679. });
  10680. exports.JpxStream = void 0;
  10681. var _stream = __w_pdfjs_require__(11);
  10682. var _jpx = __w_pdfjs_require__(20);
  10683. var _util = __w_pdfjs_require__(2);
  10684. const JpxStream = function JpxStreamClosure() {
  10685. function JpxStream(stream, maybeLength, dict, params) {
  10686. this.stream = stream;
  10687. this.maybeLength = maybeLength;
  10688. this.dict = dict;
  10689. this.params = params;
  10690. _stream.DecodeStream.call(this, maybeLength);
  10691. }
  10692. JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  10693. Object.defineProperty(JpxStream.prototype, "bytes", {
  10694. get: function JpxStream_bytes() {
  10695. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  10696. },
  10697. configurable: true
  10698. });
  10699. JpxStream.prototype.ensureBuffer = function (requested) {};
  10700. JpxStream.prototype.readBlock = function () {
  10701. if (this.eof) {
  10702. return;
  10703. }
  10704. const jpxImage = new _jpx.JpxImage();
  10705. jpxImage.parse(this.bytes);
  10706. const width = jpxImage.width;
  10707. const height = jpxImage.height;
  10708. const componentsCount = jpxImage.componentsCount;
  10709. const tileCount = jpxImage.tiles.length;
  10710. if (tileCount === 1) {
  10711. this.buffer = jpxImage.tiles[0].items;
  10712. } else {
  10713. const data = new Uint8ClampedArray(width * height * componentsCount);
  10714. for (let k = 0; k < tileCount; k++) {
  10715. const tileComponents = jpxImage.tiles[k];
  10716. const tileWidth = tileComponents.width;
  10717. const tileHeight = tileComponents.height;
  10718. const tileLeft = tileComponents.left;
  10719. const tileTop = tileComponents.top;
  10720. const src = tileComponents.items;
  10721. let srcPosition = 0;
  10722. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  10723. const imgRowSize = width * componentsCount;
  10724. const tileRowSize = tileWidth * componentsCount;
  10725. for (let j = 0; j < tileHeight; j++) {
  10726. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  10727. data.set(rowBytes, dataPosition);
  10728. srcPosition += tileRowSize;
  10729. dataPosition += imgRowSize;
  10730. }
  10731. }
  10732. this.buffer = data;
  10733. }
  10734. this.bufferLength = this.buffer.length;
  10735. this.eof = true;
  10736. };
  10737. return JpxStream;
  10738. }();
  10739. exports.JpxStream = JpxStream;
  10740. /***/ }),
  10741. /* 20 */
  10742. /***/ (function(module, exports, __w_pdfjs_require__) {
  10743. "use strict";
  10744. Object.defineProperty(exports, "__esModule", {
  10745. value: true
  10746. });
  10747. exports.JpxImage = void 0;
  10748. var _util = __w_pdfjs_require__(2);
  10749. var _core_utils = __w_pdfjs_require__(7);
  10750. var _arithmetic_decoder = __w_pdfjs_require__(16);
  10751. class JpxError extends _util.BaseException {
  10752. constructor(msg) {
  10753. super(`JPX error: ${msg}`);
  10754. }
  10755. }
  10756. var JpxImage = function JpxImageClosure() {
  10757. var SubbandsGainLog2 = {
  10758. LL: 0,
  10759. LH: 1,
  10760. HL: 1,
  10761. HH: 2
  10762. };
  10763. function JpxImage() {
  10764. this.failOnCorruptedImage = false;
  10765. }
  10766. JpxImage.prototype = {
  10767. parse: function JpxImage_parse(data) {
  10768. var head = (0, _core_utils.readUint16)(data, 0);
  10769. if (head === 0xff4f) {
  10770. this.parseCodestream(data, 0, data.length);
  10771. return;
  10772. }
  10773. var position = 0,
  10774. length = data.length;
  10775. while (position < length) {
  10776. var headerSize = 8;
  10777. var lbox = (0, _core_utils.readUint32)(data, position);
  10778. var tbox = (0, _core_utils.readUint32)(data, position + 4);
  10779. position += headerSize;
  10780. if (lbox === 1) {
  10781. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  10782. position += 8;
  10783. headerSize += 8;
  10784. }
  10785. if (lbox === 0) {
  10786. lbox = length - position + headerSize;
  10787. }
  10788. if (lbox < headerSize) {
  10789. throw new JpxError("Invalid box field size");
  10790. }
  10791. var dataLength = lbox - headerSize;
  10792. var jumpDataLength = true;
  10793. switch (tbox) {
  10794. case 0x6a703268:
  10795. jumpDataLength = false;
  10796. break;
  10797. case 0x636f6c72:
  10798. var method = data[position];
  10799. if (method === 1) {
  10800. var colorspace = (0, _core_utils.readUint32)(data, position + 3);
  10801. switch (colorspace) {
  10802. case 16:
  10803. case 17:
  10804. case 18:
  10805. break;
  10806. default:
  10807. (0, _util.warn)("Unknown colorspace " + colorspace);
  10808. break;
  10809. }
  10810. } else if (method === 2) {
  10811. (0, _util.info)("ICC profile not supported");
  10812. }
  10813. break;
  10814. case 0x6a703263:
  10815. this.parseCodestream(data, position, position + dataLength);
  10816. break;
  10817. case 0x6a502020:
  10818. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  10819. (0, _util.warn)("Invalid JP2 signature");
  10820. }
  10821. break;
  10822. case 0x6a501a1a:
  10823. case 0x66747970:
  10824. case 0x72726571:
  10825. case 0x72657320:
  10826. case 0x69686472:
  10827. break;
  10828. default:
  10829. var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  10830. (0, _util.warn)("Unsupported header type " + tbox + " (" + headerType + ")");
  10831. break;
  10832. }
  10833. if (jumpDataLength) {
  10834. position += dataLength;
  10835. }
  10836. }
  10837. },
  10838. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  10839. var newByte = stream.getByte();
  10840. while (newByte >= 0) {
  10841. var oldByte = newByte;
  10842. newByte = stream.getByte();
  10843. var code = oldByte << 8 | newByte;
  10844. if (code === 0xff51) {
  10845. stream.skip(4);
  10846. var Xsiz = stream.getInt32() >>> 0;
  10847. var Ysiz = stream.getInt32() >>> 0;
  10848. var XOsiz = stream.getInt32() >>> 0;
  10849. var YOsiz = stream.getInt32() >>> 0;
  10850. stream.skip(16);
  10851. var Csiz = stream.getUint16();
  10852. this.width = Xsiz - XOsiz;
  10853. this.height = Ysiz - YOsiz;
  10854. this.componentsCount = Csiz;
  10855. this.bitsPerComponent = 8;
  10856. return;
  10857. }
  10858. }
  10859. throw new JpxError("No size marker found in JPX stream");
  10860. },
  10861. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  10862. var context = {};
  10863. var doNotRecover = false;
  10864. try {
  10865. var position = start;
  10866. while (position + 1 < end) {
  10867. var code = (0, _core_utils.readUint16)(data, position);
  10868. position += 2;
  10869. var length = 0,
  10870. j,
  10871. sqcd,
  10872. spqcds,
  10873. spqcdSize,
  10874. scalarExpounded,
  10875. tile;
  10876. switch (code) {
  10877. case 0xff4f:
  10878. context.mainHeader = true;
  10879. break;
  10880. case 0xffd9:
  10881. break;
  10882. case 0xff51:
  10883. length = (0, _core_utils.readUint16)(data, position);
  10884. var siz = {};
  10885. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  10886. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  10887. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  10888. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  10889. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  10890. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  10891. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  10892. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  10893. var componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  10894. siz.Csiz = componentsCount;
  10895. var components = [];
  10896. j = position + 38;
  10897. for (var i = 0; i < componentsCount; i++) {
  10898. var component = {
  10899. precision: (data[j] & 0x7f) + 1,
  10900. isSigned: !!(data[j] & 0x80),
  10901. XRsiz: data[j + 1],
  10902. YRsiz: data[j + 2]
  10903. };
  10904. j += 3;
  10905. calculateComponentDimensions(component, siz);
  10906. components.push(component);
  10907. }
  10908. context.SIZ = siz;
  10909. context.components = components;
  10910. calculateTileGrids(context, components);
  10911. context.QCC = [];
  10912. context.COC = [];
  10913. break;
  10914. case 0xff5c:
  10915. length = (0, _core_utils.readUint16)(data, position);
  10916. var qcd = {};
  10917. j = position + 2;
  10918. sqcd = data[j++];
  10919. switch (sqcd & 0x1f) {
  10920. case 0:
  10921. spqcdSize = 8;
  10922. scalarExpounded = true;
  10923. break;
  10924. case 1:
  10925. spqcdSize = 16;
  10926. scalarExpounded = false;
  10927. break;
  10928. case 2:
  10929. spqcdSize = 16;
  10930. scalarExpounded = true;
  10931. break;
  10932. default:
  10933. throw new Error("Invalid SQcd value " + sqcd);
  10934. }
  10935. qcd.noQuantization = spqcdSize === 8;
  10936. qcd.scalarExpounded = scalarExpounded;
  10937. qcd.guardBits = sqcd >> 5;
  10938. spqcds = [];
  10939. while (j < length + position) {
  10940. var spqcd = {};
  10941. if (spqcdSize === 8) {
  10942. spqcd.epsilon = data[j++] >> 3;
  10943. spqcd.mu = 0;
  10944. } else {
  10945. spqcd.epsilon = data[j] >> 3;
  10946. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  10947. j += 2;
  10948. }
  10949. spqcds.push(spqcd);
  10950. }
  10951. qcd.SPqcds = spqcds;
  10952. if (context.mainHeader) {
  10953. context.QCD = qcd;
  10954. } else {
  10955. context.currentTile.QCD = qcd;
  10956. context.currentTile.QCC = [];
  10957. }
  10958. break;
  10959. case 0xff5d:
  10960. length = (0, _core_utils.readUint16)(data, position);
  10961. var qcc = {};
  10962. j = position + 2;
  10963. var cqcc;
  10964. if (context.SIZ.Csiz < 257) {
  10965. cqcc = data[j++];
  10966. } else {
  10967. cqcc = (0, _core_utils.readUint16)(data, j);
  10968. j += 2;
  10969. }
  10970. sqcd = data[j++];
  10971. switch (sqcd & 0x1f) {
  10972. case 0:
  10973. spqcdSize = 8;
  10974. scalarExpounded = true;
  10975. break;
  10976. case 1:
  10977. spqcdSize = 16;
  10978. scalarExpounded = false;
  10979. break;
  10980. case 2:
  10981. spqcdSize = 16;
  10982. scalarExpounded = true;
  10983. break;
  10984. default:
  10985. throw new Error("Invalid SQcd value " + sqcd);
  10986. }
  10987. qcc.noQuantization = spqcdSize === 8;
  10988. qcc.scalarExpounded = scalarExpounded;
  10989. qcc.guardBits = sqcd >> 5;
  10990. spqcds = [];
  10991. while (j < length + position) {
  10992. spqcd = {};
  10993. if (spqcdSize === 8) {
  10994. spqcd.epsilon = data[j++] >> 3;
  10995. spqcd.mu = 0;
  10996. } else {
  10997. spqcd.epsilon = data[j] >> 3;
  10998. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  10999. j += 2;
  11000. }
  11001. spqcds.push(spqcd);
  11002. }
  11003. qcc.SPqcds = spqcds;
  11004. if (context.mainHeader) {
  11005. context.QCC[cqcc] = qcc;
  11006. } else {
  11007. context.currentTile.QCC[cqcc] = qcc;
  11008. }
  11009. break;
  11010. case 0xff52:
  11011. length = (0, _core_utils.readUint16)(data, position);
  11012. var cod = {};
  11013. j = position + 2;
  11014. var scod = data[j++];
  11015. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  11016. cod.sopMarkerUsed = !!(scod & 2);
  11017. cod.ephMarkerUsed = !!(scod & 4);
  11018. cod.progressionOrder = data[j++];
  11019. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  11020. j += 2;
  11021. cod.multipleComponentTransform = data[j++];
  11022. cod.decompositionLevelsCount = data[j++];
  11023. cod.xcb = (data[j++] & 0xf) + 2;
  11024. cod.ycb = (data[j++] & 0xf) + 2;
  11025. var blockStyle = data[j++];
  11026. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  11027. cod.resetContextProbabilities = !!(blockStyle & 2);
  11028. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  11029. cod.verticallyStripe = !!(blockStyle & 8);
  11030. cod.predictableTermination = !!(blockStyle & 16);
  11031. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  11032. cod.reversibleTransformation = data[j++];
  11033. if (cod.entropyCoderWithCustomPrecincts) {
  11034. var precinctsSizes = [];
  11035. while (j < length + position) {
  11036. var precinctsSize = data[j++];
  11037. precinctsSizes.push({
  11038. PPx: precinctsSize & 0xf,
  11039. PPy: precinctsSize >> 4
  11040. });
  11041. }
  11042. cod.precinctsSizes = precinctsSizes;
  11043. }
  11044. var unsupported = [];
  11045. if (cod.selectiveArithmeticCodingBypass) {
  11046. unsupported.push("selectiveArithmeticCodingBypass");
  11047. }
  11048. if (cod.resetContextProbabilities) {
  11049. unsupported.push("resetContextProbabilities");
  11050. }
  11051. if (cod.terminationOnEachCodingPass) {
  11052. unsupported.push("terminationOnEachCodingPass");
  11053. }
  11054. if (cod.verticallyStripe) {
  11055. unsupported.push("verticallyStripe");
  11056. }
  11057. if (cod.predictableTermination) {
  11058. unsupported.push("predictableTermination");
  11059. }
  11060. if (unsupported.length > 0) {
  11061. doNotRecover = true;
  11062. throw new Error("Unsupported COD options (" + unsupported.join(", ") + ")");
  11063. }
  11064. if (context.mainHeader) {
  11065. context.COD = cod;
  11066. } else {
  11067. context.currentTile.COD = cod;
  11068. context.currentTile.COC = [];
  11069. }
  11070. break;
  11071. case 0xff90:
  11072. length = (0, _core_utils.readUint16)(data, position);
  11073. tile = {};
  11074. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  11075. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  11076. tile.dataEnd = tile.length + position - 2;
  11077. tile.partIndex = data[position + 8];
  11078. tile.partsCount = data[position + 9];
  11079. context.mainHeader = false;
  11080. if (tile.partIndex === 0) {
  11081. tile.COD = context.COD;
  11082. tile.COC = context.COC.slice(0);
  11083. tile.QCD = context.QCD;
  11084. tile.QCC = context.QCC.slice(0);
  11085. }
  11086. context.currentTile = tile;
  11087. break;
  11088. case 0xff93:
  11089. tile = context.currentTile;
  11090. if (tile.partIndex === 0) {
  11091. initializeTile(context, tile.index);
  11092. buildPackets(context);
  11093. }
  11094. length = tile.dataEnd - position;
  11095. parseTilePackets(context, data, position, length);
  11096. break;
  11097. case 0xff55:
  11098. case 0xff57:
  11099. case 0xff58:
  11100. case 0xff64:
  11101. length = (0, _core_utils.readUint16)(data, position);
  11102. break;
  11103. case 0xff53:
  11104. throw new Error("Codestream code 0xFF53 (COC) is not implemented");
  11105. default:
  11106. throw new Error("Unknown codestream code: " + code.toString(16));
  11107. }
  11108. position += length;
  11109. }
  11110. } catch (e) {
  11111. if (doNotRecover || this.failOnCorruptedImage) {
  11112. throw new JpxError(e.message);
  11113. } else {
  11114. (0, _util.warn)("JPX: Trying to recover from: " + e.message);
  11115. }
  11116. }
  11117. this.tiles = transformComponents(context);
  11118. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  11119. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  11120. this.componentsCount = context.SIZ.Csiz;
  11121. }
  11122. };
  11123. function calculateComponentDimensions(component, siz) {
  11124. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  11125. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  11126. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  11127. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  11128. component.width = component.x1 - component.x0;
  11129. component.height = component.y1 - component.y0;
  11130. }
  11131. function calculateTileGrids(context, components) {
  11132. var siz = context.SIZ;
  11133. var tile,
  11134. tiles = [];
  11135. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  11136. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  11137. for (var q = 0; q < numYtiles; q++) {
  11138. for (var p = 0; p < numXtiles; p++) {
  11139. tile = {};
  11140. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  11141. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  11142. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  11143. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  11144. tile.width = tile.tx1 - tile.tx0;
  11145. tile.height = tile.ty1 - tile.ty0;
  11146. tile.components = [];
  11147. tiles.push(tile);
  11148. }
  11149. }
  11150. context.tiles = tiles;
  11151. var componentsCount = siz.Csiz;
  11152. for (var i = 0, ii = componentsCount; i < ii; i++) {
  11153. var component = components[i];
  11154. for (var j = 0, jj = tiles.length; j < jj; j++) {
  11155. var tileComponent = {};
  11156. tile = tiles[j];
  11157. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  11158. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  11159. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  11160. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  11161. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  11162. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  11163. tile.components[i] = tileComponent;
  11164. }
  11165. }
  11166. }
  11167. function getBlocksDimensions(context, component, r) {
  11168. var codOrCoc = component.codingStyleParameters;
  11169. var result = {};
  11170. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  11171. result.PPx = 15;
  11172. result.PPy = 15;
  11173. } else {
  11174. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  11175. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  11176. }
  11177. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  11178. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  11179. return result;
  11180. }
  11181. function buildPrecincts(context, resolution, dimensions) {
  11182. var precinctWidth = 1 << dimensions.PPx;
  11183. var precinctHeight = 1 << dimensions.PPy;
  11184. var isZeroRes = resolution.resLevel === 0;
  11185. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  11186. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  11187. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  11188. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  11189. var numprecincts = numprecinctswide * numprecinctshigh;
  11190. resolution.precinctParameters = {
  11191. precinctWidth,
  11192. precinctHeight,
  11193. numprecinctswide,
  11194. numprecinctshigh,
  11195. numprecincts,
  11196. precinctWidthInSubband,
  11197. precinctHeightInSubband
  11198. };
  11199. }
  11200. function buildCodeblocks(context, subband, dimensions) {
  11201. var xcb_ = dimensions.xcb_;
  11202. var ycb_ = dimensions.ycb_;
  11203. var codeblockWidth = 1 << xcb_;
  11204. var codeblockHeight = 1 << ycb_;
  11205. var cbx0 = subband.tbx0 >> xcb_;
  11206. var cby0 = subband.tby0 >> ycb_;
  11207. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  11208. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  11209. var precinctParameters = subband.resolution.precinctParameters;
  11210. var codeblocks = [];
  11211. var precincts = [];
  11212. var i, j, codeblock, precinctNumber;
  11213. for (j = cby0; j < cby1; j++) {
  11214. for (i = cbx0; i < cbx1; i++) {
  11215. codeblock = {
  11216. cbx: i,
  11217. cby: j,
  11218. tbx0: codeblockWidth * i,
  11219. tby0: codeblockHeight * j,
  11220. tbx1: codeblockWidth * (i + 1),
  11221. tby1: codeblockHeight * (j + 1)
  11222. };
  11223. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  11224. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  11225. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  11226. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  11227. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  11228. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  11229. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  11230. codeblock.precinctNumber = precinctNumber;
  11231. codeblock.subbandType = subband.type;
  11232. codeblock.Lblock = 3;
  11233. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  11234. continue;
  11235. }
  11236. codeblocks.push(codeblock);
  11237. var precinct = precincts[precinctNumber];
  11238. if (precinct !== undefined) {
  11239. if (i < precinct.cbxMin) {
  11240. precinct.cbxMin = i;
  11241. } else if (i > precinct.cbxMax) {
  11242. precinct.cbxMax = i;
  11243. }
  11244. if (j < precinct.cbyMin) {
  11245. precinct.cbxMin = j;
  11246. } else if (j > precinct.cbyMax) {
  11247. precinct.cbyMax = j;
  11248. }
  11249. } else {
  11250. precincts[precinctNumber] = precinct = {
  11251. cbxMin: i,
  11252. cbyMin: j,
  11253. cbxMax: i,
  11254. cbyMax: j
  11255. };
  11256. }
  11257. codeblock.precinct = precinct;
  11258. }
  11259. }
  11260. subband.codeblockParameters = {
  11261. codeblockWidth: xcb_,
  11262. codeblockHeight: ycb_,
  11263. numcodeblockwide: cbx1 - cbx0 + 1,
  11264. numcodeblockhigh: cby1 - cby0 + 1
  11265. };
  11266. subband.codeblocks = codeblocks;
  11267. subband.precincts = precincts;
  11268. }
  11269. function createPacket(resolution, precinctNumber, layerNumber) {
  11270. var precinctCodeblocks = [];
  11271. var subbands = resolution.subbands;
  11272. for (var i = 0, ii = subbands.length; i < ii; i++) {
  11273. var subband = subbands[i];
  11274. var codeblocks = subband.codeblocks;
  11275. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  11276. var codeblock = codeblocks[j];
  11277. if (codeblock.precinctNumber !== precinctNumber) {
  11278. continue;
  11279. }
  11280. precinctCodeblocks.push(codeblock);
  11281. }
  11282. }
  11283. return {
  11284. layerNumber,
  11285. codeblocks: precinctCodeblocks
  11286. };
  11287. }
  11288. function LayerResolutionComponentPositionIterator(context) {
  11289. var siz = context.SIZ;
  11290. var tileIndex = context.currentTile.index;
  11291. var tile = context.tiles[tileIndex];
  11292. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11293. var componentsCount = siz.Csiz;
  11294. var maxDecompositionLevelsCount = 0;
  11295. for (var q = 0; q < componentsCount; q++) {
  11296. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  11297. }
  11298. var l = 0,
  11299. r = 0,
  11300. i = 0,
  11301. k = 0;
  11302. this.nextPacket = function JpxImage_nextPacket() {
  11303. for (; l < layersCount; l++) {
  11304. for (; r <= maxDecompositionLevelsCount; r++) {
  11305. for (; i < componentsCount; i++) {
  11306. var component = tile.components[i];
  11307. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11308. continue;
  11309. }
  11310. var resolution = component.resolutions[r];
  11311. var numprecincts = resolution.precinctParameters.numprecincts;
  11312. for (; k < numprecincts;) {
  11313. var packet = createPacket(resolution, k, l);
  11314. k++;
  11315. return packet;
  11316. }
  11317. k = 0;
  11318. }
  11319. i = 0;
  11320. }
  11321. r = 0;
  11322. }
  11323. throw new JpxError("Out of packets");
  11324. };
  11325. }
  11326. function ResolutionLayerComponentPositionIterator(context) {
  11327. var siz = context.SIZ;
  11328. var tileIndex = context.currentTile.index;
  11329. var tile = context.tiles[tileIndex];
  11330. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11331. var componentsCount = siz.Csiz;
  11332. var maxDecompositionLevelsCount = 0;
  11333. for (var q = 0; q < componentsCount; q++) {
  11334. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  11335. }
  11336. var r = 0,
  11337. l = 0,
  11338. i = 0,
  11339. k = 0;
  11340. this.nextPacket = function JpxImage_nextPacket() {
  11341. for (; r <= maxDecompositionLevelsCount; r++) {
  11342. for (; l < layersCount; l++) {
  11343. for (; i < componentsCount; i++) {
  11344. var component = tile.components[i];
  11345. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11346. continue;
  11347. }
  11348. var resolution = component.resolutions[r];
  11349. var numprecincts = resolution.precinctParameters.numprecincts;
  11350. for (; k < numprecincts;) {
  11351. var packet = createPacket(resolution, k, l);
  11352. k++;
  11353. return packet;
  11354. }
  11355. k = 0;
  11356. }
  11357. i = 0;
  11358. }
  11359. l = 0;
  11360. }
  11361. throw new JpxError("Out of packets");
  11362. };
  11363. }
  11364. function ResolutionPositionComponentLayerIterator(context) {
  11365. var siz = context.SIZ;
  11366. var tileIndex = context.currentTile.index;
  11367. var tile = context.tiles[tileIndex];
  11368. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11369. var componentsCount = siz.Csiz;
  11370. var l, r, c, p;
  11371. var maxDecompositionLevelsCount = 0;
  11372. for (c = 0; c < componentsCount; c++) {
  11373. var component = tile.components[c];
  11374. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  11375. }
  11376. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  11377. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  11378. var maxNumPrecincts = 0;
  11379. for (c = 0; c < componentsCount; ++c) {
  11380. var resolutions = tile.components[c].resolutions;
  11381. if (r < resolutions.length) {
  11382. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  11383. }
  11384. }
  11385. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  11386. }
  11387. l = 0;
  11388. r = 0;
  11389. c = 0;
  11390. p = 0;
  11391. this.nextPacket = function JpxImage_nextPacket() {
  11392. for (; r <= maxDecompositionLevelsCount; r++) {
  11393. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  11394. for (; c < componentsCount; c++) {
  11395. var component = tile.components[c];
  11396. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11397. continue;
  11398. }
  11399. var resolution = component.resolutions[r];
  11400. var numprecincts = resolution.precinctParameters.numprecincts;
  11401. if (p >= numprecincts) {
  11402. continue;
  11403. }
  11404. for (; l < layersCount;) {
  11405. var packet = createPacket(resolution, p, l);
  11406. l++;
  11407. return packet;
  11408. }
  11409. l = 0;
  11410. }
  11411. c = 0;
  11412. }
  11413. p = 0;
  11414. }
  11415. throw new JpxError("Out of packets");
  11416. };
  11417. }
  11418. function PositionComponentResolutionLayerIterator(context) {
  11419. var siz = context.SIZ;
  11420. var tileIndex = context.currentTile.index;
  11421. var tile = context.tiles[tileIndex];
  11422. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11423. var componentsCount = siz.Csiz;
  11424. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  11425. var precinctsIterationSizes = precinctsSizes;
  11426. var l = 0,
  11427. r = 0,
  11428. c = 0,
  11429. px = 0,
  11430. py = 0;
  11431. this.nextPacket = function JpxImage_nextPacket() {
  11432. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  11433. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  11434. for (; c < componentsCount; c++) {
  11435. var component = tile.components[c];
  11436. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11437. for (; r <= decompositionLevelsCount; r++) {
  11438. var resolution = component.resolutions[r];
  11439. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  11440. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  11441. if (k === null) {
  11442. continue;
  11443. }
  11444. for (; l < layersCount;) {
  11445. var packet = createPacket(resolution, k, l);
  11446. l++;
  11447. return packet;
  11448. }
  11449. l = 0;
  11450. }
  11451. r = 0;
  11452. }
  11453. c = 0;
  11454. }
  11455. px = 0;
  11456. }
  11457. throw new JpxError("Out of packets");
  11458. };
  11459. }
  11460. function ComponentPositionResolutionLayerIterator(context) {
  11461. var siz = context.SIZ;
  11462. var tileIndex = context.currentTile.index;
  11463. var tile = context.tiles[tileIndex];
  11464. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11465. var componentsCount = siz.Csiz;
  11466. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  11467. var l = 0,
  11468. r = 0,
  11469. c = 0,
  11470. px = 0,
  11471. py = 0;
  11472. this.nextPacket = function JpxImage_nextPacket() {
  11473. for (; c < componentsCount; ++c) {
  11474. var component = tile.components[c];
  11475. var precinctsIterationSizes = precinctsSizes.components[c];
  11476. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11477. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  11478. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  11479. for (; r <= decompositionLevelsCount; r++) {
  11480. var resolution = component.resolutions[r];
  11481. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  11482. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  11483. if (k === null) {
  11484. continue;
  11485. }
  11486. for (; l < layersCount;) {
  11487. var packet = createPacket(resolution, k, l);
  11488. l++;
  11489. return packet;
  11490. }
  11491. l = 0;
  11492. }
  11493. r = 0;
  11494. }
  11495. px = 0;
  11496. }
  11497. py = 0;
  11498. }
  11499. throw new JpxError("Out of packets");
  11500. };
  11501. }
  11502. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  11503. var posX = pxIndex * precinctIterationSizes.minWidth;
  11504. var posY = pyIndex * precinctIterationSizes.minHeight;
  11505. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  11506. return null;
  11507. }
  11508. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  11509. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  11510. }
  11511. function getPrecinctSizesInImageScale(tile) {
  11512. var componentsCount = tile.components.length;
  11513. var minWidth = Number.MAX_VALUE;
  11514. var minHeight = Number.MAX_VALUE;
  11515. var maxNumWide = 0;
  11516. var maxNumHigh = 0;
  11517. var sizePerComponent = new Array(componentsCount);
  11518. for (var c = 0; c < componentsCount; c++) {
  11519. var component = tile.components[c];
  11520. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11521. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  11522. var minWidthCurrentComponent = Number.MAX_VALUE;
  11523. var minHeightCurrentComponent = Number.MAX_VALUE;
  11524. var maxNumWideCurrentComponent = 0;
  11525. var maxNumHighCurrentComponent = 0;
  11526. var scale = 1;
  11527. for (var r = decompositionLevelsCount; r >= 0; --r) {
  11528. var resolution = component.resolutions[r];
  11529. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  11530. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  11531. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  11532. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  11533. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  11534. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  11535. sizePerResolution[r] = {
  11536. width: widthCurrentResolution,
  11537. height: heightCurrentResolution
  11538. };
  11539. scale <<= 1;
  11540. }
  11541. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  11542. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  11543. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  11544. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  11545. sizePerComponent[c] = {
  11546. resolutions: sizePerResolution,
  11547. minWidth: minWidthCurrentComponent,
  11548. minHeight: minHeightCurrentComponent,
  11549. maxNumWide: maxNumWideCurrentComponent,
  11550. maxNumHigh: maxNumHighCurrentComponent
  11551. };
  11552. }
  11553. return {
  11554. components: sizePerComponent,
  11555. minWidth,
  11556. minHeight,
  11557. maxNumWide,
  11558. maxNumHigh
  11559. };
  11560. }
  11561. function buildPackets(context) {
  11562. var siz = context.SIZ;
  11563. var tileIndex = context.currentTile.index;
  11564. var tile = context.tiles[tileIndex];
  11565. var componentsCount = siz.Csiz;
  11566. for (var c = 0; c < componentsCount; c++) {
  11567. var component = tile.components[c];
  11568. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11569. var resolutions = [];
  11570. var subbands = [];
  11571. for (var r = 0; r <= decompositionLevelsCount; r++) {
  11572. var blocksDimensions = getBlocksDimensions(context, component, r);
  11573. var resolution = {};
  11574. var scale = 1 << decompositionLevelsCount - r;
  11575. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  11576. resolution.try0 = Math.ceil(component.tcy0 / scale);
  11577. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  11578. resolution.try1 = Math.ceil(component.tcy1 / scale);
  11579. resolution.resLevel = r;
  11580. buildPrecincts(context, resolution, blocksDimensions);
  11581. resolutions.push(resolution);
  11582. var subband;
  11583. if (r === 0) {
  11584. subband = {};
  11585. subband.type = "LL";
  11586. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  11587. subband.tby0 = Math.ceil(component.tcy0 / scale);
  11588. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  11589. subband.tby1 = Math.ceil(component.tcy1 / scale);
  11590. subband.resolution = resolution;
  11591. buildCodeblocks(context, subband, blocksDimensions);
  11592. subbands.push(subband);
  11593. resolution.subbands = [subband];
  11594. } else {
  11595. var bscale = 1 << decompositionLevelsCount - r + 1;
  11596. var resolutionSubbands = [];
  11597. subband = {};
  11598. subband.type = "HL";
  11599. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  11600. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  11601. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  11602. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  11603. subband.resolution = resolution;
  11604. buildCodeblocks(context, subband, blocksDimensions);
  11605. subbands.push(subband);
  11606. resolutionSubbands.push(subband);
  11607. subband = {};
  11608. subband.type = "LH";
  11609. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  11610. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  11611. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  11612. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  11613. subband.resolution = resolution;
  11614. buildCodeblocks(context, subband, blocksDimensions);
  11615. subbands.push(subband);
  11616. resolutionSubbands.push(subband);
  11617. subband = {};
  11618. subband.type = "HH";
  11619. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  11620. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  11621. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  11622. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  11623. subband.resolution = resolution;
  11624. buildCodeblocks(context, subband, blocksDimensions);
  11625. subbands.push(subband);
  11626. resolutionSubbands.push(subband);
  11627. resolution.subbands = resolutionSubbands;
  11628. }
  11629. }
  11630. component.resolutions = resolutions;
  11631. component.subbands = subbands;
  11632. }
  11633. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  11634. switch (progressionOrder) {
  11635. case 0:
  11636. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  11637. break;
  11638. case 1:
  11639. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  11640. break;
  11641. case 2:
  11642. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  11643. break;
  11644. case 3:
  11645. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  11646. break;
  11647. case 4:
  11648. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  11649. break;
  11650. default:
  11651. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  11652. }
  11653. }
  11654. function parseTilePackets(context, data, offset, dataLength) {
  11655. var position = 0;
  11656. var buffer,
  11657. bufferSize = 0,
  11658. skipNextBit = false;
  11659. function readBits(count) {
  11660. while (bufferSize < count) {
  11661. var b = data[offset + position];
  11662. position++;
  11663. if (skipNextBit) {
  11664. buffer = buffer << 7 | b;
  11665. bufferSize += 7;
  11666. skipNextBit = false;
  11667. } else {
  11668. buffer = buffer << 8 | b;
  11669. bufferSize += 8;
  11670. }
  11671. if (b === 0xff) {
  11672. skipNextBit = true;
  11673. }
  11674. }
  11675. bufferSize -= count;
  11676. return buffer >>> bufferSize & (1 << count) - 1;
  11677. }
  11678. function skipMarkerIfEqual(value) {
  11679. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  11680. skipBytes(1);
  11681. return true;
  11682. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  11683. skipBytes(2);
  11684. return true;
  11685. }
  11686. return false;
  11687. }
  11688. function skipBytes(count) {
  11689. position += count;
  11690. }
  11691. function alignToByte() {
  11692. bufferSize = 0;
  11693. if (skipNextBit) {
  11694. position++;
  11695. skipNextBit = false;
  11696. }
  11697. }
  11698. function readCodingpasses() {
  11699. if (readBits(1) === 0) {
  11700. return 1;
  11701. }
  11702. if (readBits(1) === 0) {
  11703. return 2;
  11704. }
  11705. var value = readBits(2);
  11706. if (value < 3) {
  11707. return value + 3;
  11708. }
  11709. value = readBits(5);
  11710. if (value < 31) {
  11711. return value + 6;
  11712. }
  11713. value = readBits(7);
  11714. return value + 37;
  11715. }
  11716. var tileIndex = context.currentTile.index;
  11717. var tile = context.tiles[tileIndex];
  11718. var sopMarkerUsed = context.COD.sopMarkerUsed;
  11719. var ephMarkerUsed = context.COD.ephMarkerUsed;
  11720. var packetsIterator = tile.packetsIterator;
  11721. while (position < dataLength) {
  11722. alignToByte();
  11723. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  11724. skipBytes(4);
  11725. }
  11726. var packet = packetsIterator.nextPacket();
  11727. if (!readBits(1)) {
  11728. continue;
  11729. }
  11730. var layerNumber = packet.layerNumber;
  11731. var queue = [],
  11732. codeblock;
  11733. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  11734. codeblock = packet.codeblocks[i];
  11735. var precinct = codeblock.precinct;
  11736. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  11737. var codeblockRow = codeblock.cby - precinct.cbyMin;
  11738. var codeblockIncluded = false;
  11739. var firstTimeInclusion = false;
  11740. var valueReady;
  11741. if (codeblock["included"] !== undefined) {
  11742. codeblockIncluded = !!readBits(1);
  11743. } else {
  11744. precinct = codeblock.precinct;
  11745. var inclusionTree, zeroBitPlanesTree;
  11746. if (precinct["inclusionTree"] !== undefined) {
  11747. inclusionTree = precinct.inclusionTree;
  11748. } else {
  11749. var width = precinct.cbxMax - precinct.cbxMin + 1;
  11750. var height = precinct.cbyMax - precinct.cbyMin + 1;
  11751. inclusionTree = new InclusionTree(width, height, layerNumber);
  11752. zeroBitPlanesTree = new TagTree(width, height);
  11753. precinct.inclusionTree = inclusionTree;
  11754. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  11755. }
  11756. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  11757. while (true) {
  11758. if (readBits(1)) {
  11759. valueReady = !inclusionTree.nextLevel();
  11760. if (valueReady) {
  11761. codeblock.included = true;
  11762. codeblockIncluded = firstTimeInclusion = true;
  11763. break;
  11764. }
  11765. } else {
  11766. inclusionTree.incrementValue(layerNumber);
  11767. break;
  11768. }
  11769. }
  11770. }
  11771. }
  11772. if (!codeblockIncluded) {
  11773. continue;
  11774. }
  11775. if (firstTimeInclusion) {
  11776. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  11777. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  11778. while (true) {
  11779. if (readBits(1)) {
  11780. valueReady = !zeroBitPlanesTree.nextLevel();
  11781. if (valueReady) {
  11782. break;
  11783. }
  11784. } else {
  11785. zeroBitPlanesTree.incrementValue();
  11786. }
  11787. }
  11788. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  11789. }
  11790. var codingpasses = readCodingpasses();
  11791. while (readBits(1)) {
  11792. codeblock.Lblock++;
  11793. }
  11794. var codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  11795. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  11796. var codedDataLength = readBits(bits);
  11797. queue.push({
  11798. codeblock,
  11799. codingpasses,
  11800. dataLength: codedDataLength
  11801. });
  11802. }
  11803. alignToByte();
  11804. if (ephMarkerUsed) {
  11805. skipMarkerIfEqual(0x92);
  11806. }
  11807. while (queue.length > 0) {
  11808. var packetItem = queue.shift();
  11809. codeblock = packetItem.codeblock;
  11810. if (codeblock["data"] === undefined) {
  11811. codeblock.data = [];
  11812. }
  11813. codeblock.data.push({
  11814. data,
  11815. start: offset + position,
  11816. end: offset + position + packetItem.dataLength,
  11817. codingpasses: packetItem.codingpasses
  11818. });
  11819. position += packetItem.dataLength;
  11820. }
  11821. }
  11822. return position;
  11823. }
  11824. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  11825. var x0 = subband.tbx0;
  11826. var y0 = subband.tby0;
  11827. var width = subband.tbx1 - subband.tbx0;
  11828. var codeblocks = subband.codeblocks;
  11829. var right = subband.type.charAt(0) === "H" ? 1 : 0;
  11830. var bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  11831. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  11832. var codeblock = codeblocks[i];
  11833. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  11834. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  11835. if (blockWidth === 0 || blockHeight === 0) {
  11836. continue;
  11837. }
  11838. if (codeblock["data"] === undefined) {
  11839. continue;
  11840. }
  11841. var bitModel, currentCodingpassType;
  11842. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  11843. currentCodingpassType = 2;
  11844. var data = codeblock.data,
  11845. totalLength = 0,
  11846. codingpasses = 0;
  11847. var j, jj, dataItem;
  11848. for (j = 0, jj = data.length; j < jj; j++) {
  11849. dataItem = data[j];
  11850. totalLength += dataItem.end - dataItem.start;
  11851. codingpasses += dataItem.codingpasses;
  11852. }
  11853. var encodedData = new Uint8Array(totalLength);
  11854. var position = 0;
  11855. for (j = 0, jj = data.length; j < jj; j++) {
  11856. dataItem = data[j];
  11857. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  11858. encodedData.set(chunk, position);
  11859. position += chunk.length;
  11860. }
  11861. var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  11862. bitModel.setDecoder(decoder);
  11863. for (j = 0; j < codingpasses; j++) {
  11864. switch (currentCodingpassType) {
  11865. case 0:
  11866. bitModel.runSignificancePropagationPass();
  11867. break;
  11868. case 1:
  11869. bitModel.runMagnitudeRefinementPass();
  11870. break;
  11871. case 2:
  11872. bitModel.runCleanupPass();
  11873. if (segmentationSymbolUsed) {
  11874. bitModel.checkSegmentationSymbol();
  11875. }
  11876. break;
  11877. }
  11878. currentCodingpassType = (currentCodingpassType + 1) % 3;
  11879. }
  11880. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  11881. var sign = bitModel.coefficentsSign;
  11882. var magnitude = bitModel.coefficentsMagnitude;
  11883. var bitsDecoded = bitModel.bitsDecoded;
  11884. var magnitudeCorrection = reversible ? 0 : 0.5;
  11885. var k, n, nb;
  11886. position = 0;
  11887. var interleave = subband.type !== "LL";
  11888. for (j = 0; j < blockHeight; j++) {
  11889. var row = offset / width | 0;
  11890. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  11891. for (k = 0; k < blockWidth; k++) {
  11892. n = magnitude[position];
  11893. if (n !== 0) {
  11894. n = (n + magnitudeCorrection) * delta;
  11895. if (sign[position] !== 0) {
  11896. n = -n;
  11897. }
  11898. nb = bitsDecoded[position];
  11899. var pos = interleave ? levelOffset + (offset << 1) : offset;
  11900. if (reversible && nb >= mb) {
  11901. coefficients[pos] = n;
  11902. } else {
  11903. coefficients[pos] = n * (1 << mb - nb);
  11904. }
  11905. }
  11906. offset++;
  11907. position++;
  11908. }
  11909. offset += width - blockWidth;
  11910. }
  11911. }
  11912. }
  11913. function transformTile(context, tile, c) {
  11914. var component = tile.components[c];
  11915. var codingStyleParameters = component.codingStyleParameters;
  11916. var quantizationParameters = component.quantizationParameters;
  11917. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  11918. var spqcds = quantizationParameters.SPqcds;
  11919. var scalarExpounded = quantizationParameters.scalarExpounded;
  11920. var guardBits = quantizationParameters.guardBits;
  11921. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  11922. var precision = context.components[c].precision;
  11923. var reversible = codingStyleParameters.reversibleTransformation;
  11924. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  11925. var subbandCoefficients = [];
  11926. var b = 0;
  11927. for (var i = 0; i <= decompositionLevelsCount; i++) {
  11928. var resolution = component.resolutions[i];
  11929. var width = resolution.trx1 - resolution.trx0;
  11930. var height = resolution.try1 - resolution.try0;
  11931. var coefficients = new Float32Array(width * height);
  11932. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  11933. var mu, epsilon;
  11934. if (!scalarExpounded) {
  11935. mu = spqcds[0].mu;
  11936. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  11937. } else {
  11938. mu = spqcds[b].mu;
  11939. epsilon = spqcds[b].epsilon;
  11940. b++;
  11941. }
  11942. var subband = resolution.subbands[j];
  11943. var gainLog2 = SubbandsGainLog2[subband.type];
  11944. var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  11945. var mb = guardBits + epsilon - 1;
  11946. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  11947. }
  11948. subbandCoefficients.push({
  11949. width,
  11950. height,
  11951. items: coefficients
  11952. });
  11953. }
  11954. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  11955. return {
  11956. left: component.tcx0,
  11957. top: component.tcy0,
  11958. width: result.width,
  11959. height: result.height,
  11960. items: result.items
  11961. };
  11962. }
  11963. function transformComponents(context) {
  11964. var siz = context.SIZ;
  11965. var components = context.components;
  11966. var componentsCount = siz.Csiz;
  11967. var resultImages = [];
  11968. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  11969. var tile = context.tiles[i];
  11970. var transformedTiles = [];
  11971. var c;
  11972. for (c = 0; c < componentsCount; c++) {
  11973. transformedTiles[c] = transformTile(context, tile, c);
  11974. }
  11975. var tile0 = transformedTiles[0];
  11976. var out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  11977. var result = {
  11978. left: tile0.left,
  11979. top: tile0.top,
  11980. width: tile0.width,
  11981. height: tile0.height,
  11982. items: out
  11983. };
  11984. var shift, offset;
  11985. var pos = 0,
  11986. j,
  11987. jj,
  11988. y0,
  11989. y1,
  11990. y2;
  11991. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  11992. var fourComponents = componentsCount === 4;
  11993. var y0items = transformedTiles[0].items;
  11994. var y1items = transformedTiles[1].items;
  11995. var y2items = transformedTiles[2].items;
  11996. var y3items = fourComponents ? transformedTiles[3].items : null;
  11997. shift = components[0].precision - 8;
  11998. offset = (128 << shift) + 0.5;
  11999. var component0 = tile.components[0];
  12000. var alpha01 = componentsCount - 3;
  12001. jj = y0items.length;
  12002. if (!component0.codingStyleParameters.reversibleTransformation) {
  12003. for (j = 0; j < jj; j++, pos += alpha01) {
  12004. y0 = y0items[j] + offset;
  12005. y1 = y1items[j];
  12006. y2 = y2items[j];
  12007. out[pos++] = y0 + 1.402 * y2 >> shift;
  12008. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  12009. out[pos++] = y0 + 1.772 * y1 >> shift;
  12010. }
  12011. } else {
  12012. for (j = 0; j < jj; j++, pos += alpha01) {
  12013. y0 = y0items[j] + offset;
  12014. y1 = y1items[j];
  12015. y2 = y2items[j];
  12016. const g = y0 - (y2 + y1 >> 2);
  12017. out[pos++] = g + y2 >> shift;
  12018. out[pos++] = g >> shift;
  12019. out[pos++] = g + y1 >> shift;
  12020. }
  12021. }
  12022. if (fourComponents) {
  12023. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  12024. out[pos] = y3items[j] + offset >> shift;
  12025. }
  12026. }
  12027. } else {
  12028. for (c = 0; c < componentsCount; c++) {
  12029. var items = transformedTiles[c].items;
  12030. shift = components[c].precision - 8;
  12031. offset = (128 << shift) + 0.5;
  12032. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  12033. out[pos] = items[j] + offset >> shift;
  12034. pos += componentsCount;
  12035. }
  12036. }
  12037. }
  12038. resultImages.push(result);
  12039. }
  12040. return resultImages;
  12041. }
  12042. function initializeTile(context, tileIndex) {
  12043. var siz = context.SIZ;
  12044. var componentsCount = siz.Csiz;
  12045. var tile = context.tiles[tileIndex];
  12046. for (var c = 0; c < componentsCount; c++) {
  12047. var component = tile.components[c];
  12048. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  12049. component.quantizationParameters = qcdOrQcc;
  12050. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  12051. component.codingStyleParameters = codOrCoc;
  12052. }
  12053. tile.codingStyleDefaultParameters = context.currentTile.COD;
  12054. }
  12055. var TagTree = function TagTreeClosure() {
  12056. function TagTree(width, height) {
  12057. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12058. this.levels = [];
  12059. for (var i = 0; i < levelsLength; i++) {
  12060. var level = {
  12061. width,
  12062. height,
  12063. items: []
  12064. };
  12065. this.levels.push(level);
  12066. width = Math.ceil(width / 2);
  12067. height = Math.ceil(height / 2);
  12068. }
  12069. }
  12070. TagTree.prototype = {
  12071. reset: function TagTree_reset(i, j) {
  12072. var currentLevel = 0,
  12073. value = 0,
  12074. level;
  12075. while (currentLevel < this.levels.length) {
  12076. level = this.levels[currentLevel];
  12077. var index = i + j * level.width;
  12078. if (level.items[index] !== undefined) {
  12079. value = level.items[index];
  12080. break;
  12081. }
  12082. level.index = index;
  12083. i >>= 1;
  12084. j >>= 1;
  12085. currentLevel++;
  12086. }
  12087. currentLevel--;
  12088. level = this.levels[currentLevel];
  12089. level.items[level.index] = value;
  12090. this.currentLevel = currentLevel;
  12091. delete this.value;
  12092. },
  12093. incrementValue: function TagTree_incrementValue() {
  12094. var level = this.levels[this.currentLevel];
  12095. level.items[level.index]++;
  12096. },
  12097. nextLevel: function TagTree_nextLevel() {
  12098. var currentLevel = this.currentLevel;
  12099. var level = this.levels[currentLevel];
  12100. var value = level.items[level.index];
  12101. currentLevel--;
  12102. if (currentLevel < 0) {
  12103. this.value = value;
  12104. return false;
  12105. }
  12106. this.currentLevel = currentLevel;
  12107. level = this.levels[currentLevel];
  12108. level.items[level.index] = value;
  12109. return true;
  12110. }
  12111. };
  12112. return TagTree;
  12113. }();
  12114. var InclusionTree = function InclusionTreeClosure() {
  12115. function InclusionTree(width, height, defaultValue) {
  12116. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12117. this.levels = [];
  12118. for (var i = 0; i < levelsLength; i++) {
  12119. var items = new Uint8Array(width * height);
  12120. for (var j = 0, jj = items.length; j < jj; j++) {
  12121. items[j] = defaultValue;
  12122. }
  12123. var level = {
  12124. width,
  12125. height,
  12126. items
  12127. };
  12128. this.levels.push(level);
  12129. width = Math.ceil(width / 2);
  12130. height = Math.ceil(height / 2);
  12131. }
  12132. }
  12133. InclusionTree.prototype = {
  12134. reset: function InclusionTree_reset(i, j, stopValue) {
  12135. var currentLevel = 0;
  12136. while (currentLevel < this.levels.length) {
  12137. var level = this.levels[currentLevel];
  12138. var index = i + j * level.width;
  12139. level.index = index;
  12140. var value = level.items[index];
  12141. if (value === 0xff) {
  12142. break;
  12143. }
  12144. if (value > stopValue) {
  12145. this.currentLevel = currentLevel;
  12146. this.propagateValues();
  12147. return false;
  12148. }
  12149. i >>= 1;
  12150. j >>= 1;
  12151. currentLevel++;
  12152. }
  12153. this.currentLevel = currentLevel - 1;
  12154. return true;
  12155. },
  12156. incrementValue: function InclusionTree_incrementValue(stopValue) {
  12157. var level = this.levels[this.currentLevel];
  12158. level.items[level.index] = stopValue + 1;
  12159. this.propagateValues();
  12160. },
  12161. propagateValues: function InclusionTree_propagateValues() {
  12162. var levelIndex = this.currentLevel;
  12163. var level = this.levels[levelIndex];
  12164. var currentValue = level.items[level.index];
  12165. while (--levelIndex >= 0) {
  12166. level = this.levels[levelIndex];
  12167. level.items[level.index] = currentValue;
  12168. }
  12169. },
  12170. nextLevel: function InclusionTree_nextLevel() {
  12171. var currentLevel = this.currentLevel;
  12172. var level = this.levels[currentLevel];
  12173. var value = level.items[level.index];
  12174. level.items[level.index] = 0xff;
  12175. currentLevel--;
  12176. if (currentLevel < 0) {
  12177. return false;
  12178. }
  12179. this.currentLevel = currentLevel;
  12180. level = this.levels[currentLevel];
  12181. level.items[level.index] = value;
  12182. return true;
  12183. }
  12184. };
  12185. return InclusionTree;
  12186. }();
  12187. var BitModel = function BitModelClosure() {
  12188. var UNIFORM_CONTEXT = 17;
  12189. var RUNLENGTH_CONTEXT = 18;
  12190. var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
  12191. var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
  12192. var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
  12193. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  12194. this.width = width;
  12195. this.height = height;
  12196. let contextLabelTable;
  12197. if (subband === "HH") {
  12198. contextLabelTable = HHContextLabel;
  12199. } else if (subband === "HL") {
  12200. contextLabelTable = HLContextLabel;
  12201. } else {
  12202. contextLabelTable = LLAndLHContextsLabel;
  12203. }
  12204. this.contextLabelTable = contextLabelTable;
  12205. var coefficientCount = width * height;
  12206. this.neighborsSignificance = new Uint8Array(coefficientCount);
  12207. this.coefficentsSign = new Uint8Array(coefficientCount);
  12208. let coefficentsMagnitude;
  12209. if (mb > 14) {
  12210. coefficentsMagnitude = new Uint32Array(coefficientCount);
  12211. } else if (mb > 6) {
  12212. coefficentsMagnitude = new Uint16Array(coefficientCount);
  12213. } else {
  12214. coefficentsMagnitude = new Uint8Array(coefficientCount);
  12215. }
  12216. this.coefficentsMagnitude = coefficentsMagnitude;
  12217. this.processingFlags = new Uint8Array(coefficientCount);
  12218. var bitsDecoded = new Uint8Array(coefficientCount);
  12219. if (zeroBitPlanes !== 0) {
  12220. for (var i = 0; i < coefficientCount; i++) {
  12221. bitsDecoded[i] = zeroBitPlanes;
  12222. }
  12223. }
  12224. this.bitsDecoded = bitsDecoded;
  12225. this.reset();
  12226. }
  12227. BitModel.prototype = {
  12228. setDecoder: function BitModel_setDecoder(decoder) {
  12229. this.decoder = decoder;
  12230. },
  12231. reset: function BitModel_reset() {
  12232. this.contexts = new Int8Array(19);
  12233. this.contexts[0] = 4 << 1 | 0;
  12234. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  12235. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  12236. },
  12237. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  12238. var neighborsSignificance = this.neighborsSignificance;
  12239. var width = this.width,
  12240. height = this.height;
  12241. var left = column > 0;
  12242. var right = column + 1 < width;
  12243. var i;
  12244. if (row > 0) {
  12245. i = index - width;
  12246. if (left) {
  12247. neighborsSignificance[i - 1] += 0x10;
  12248. }
  12249. if (right) {
  12250. neighborsSignificance[i + 1] += 0x10;
  12251. }
  12252. neighborsSignificance[i] += 0x04;
  12253. }
  12254. if (row + 1 < height) {
  12255. i = index + width;
  12256. if (left) {
  12257. neighborsSignificance[i - 1] += 0x10;
  12258. }
  12259. if (right) {
  12260. neighborsSignificance[i + 1] += 0x10;
  12261. }
  12262. neighborsSignificance[i] += 0x04;
  12263. }
  12264. if (left) {
  12265. neighborsSignificance[index - 1] += 0x01;
  12266. }
  12267. if (right) {
  12268. neighborsSignificance[index + 1] += 0x01;
  12269. }
  12270. neighborsSignificance[index] |= 0x80;
  12271. },
  12272. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  12273. var decoder = this.decoder;
  12274. var width = this.width,
  12275. height = this.height;
  12276. var coefficentsMagnitude = this.coefficentsMagnitude;
  12277. var coefficentsSign = this.coefficentsSign;
  12278. var neighborsSignificance = this.neighborsSignificance;
  12279. var processingFlags = this.processingFlags;
  12280. var contexts = this.contexts;
  12281. var labels = this.contextLabelTable;
  12282. var bitsDecoded = this.bitsDecoded;
  12283. var processedInverseMask = ~1;
  12284. var processedMask = 1;
  12285. var firstMagnitudeBitMask = 2;
  12286. for (var i0 = 0; i0 < height; i0 += 4) {
  12287. for (var j = 0; j < width; j++) {
  12288. var index = i0 * width + j;
  12289. for (var i1 = 0; i1 < 4; i1++, index += width) {
  12290. var i = i0 + i1;
  12291. if (i >= height) {
  12292. break;
  12293. }
  12294. processingFlags[index] &= processedInverseMask;
  12295. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  12296. continue;
  12297. }
  12298. var contextLabel = labels[neighborsSignificance[index]];
  12299. var decision = decoder.readBit(contexts, contextLabel);
  12300. if (decision) {
  12301. var sign = this.decodeSignBit(i, j, index);
  12302. coefficentsSign[index] = sign;
  12303. coefficentsMagnitude[index] = 1;
  12304. this.setNeighborsSignificance(i, j, index);
  12305. processingFlags[index] |= firstMagnitudeBitMask;
  12306. }
  12307. bitsDecoded[index]++;
  12308. processingFlags[index] |= processedMask;
  12309. }
  12310. }
  12311. }
  12312. },
  12313. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  12314. var width = this.width,
  12315. height = this.height;
  12316. var coefficentsMagnitude = this.coefficentsMagnitude;
  12317. var coefficentsSign = this.coefficentsSign;
  12318. var contribution, sign0, sign1, significance1;
  12319. var contextLabel, decoded;
  12320. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  12321. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  12322. sign1 = coefficentsSign[index + 1];
  12323. if (significance1) {
  12324. sign0 = coefficentsSign[index - 1];
  12325. contribution = 1 - sign1 - sign0;
  12326. } else {
  12327. contribution = 1 - sign1 - sign1;
  12328. }
  12329. } else if (significance1) {
  12330. sign0 = coefficentsSign[index - 1];
  12331. contribution = 1 - sign0 - sign0;
  12332. } else {
  12333. contribution = 0;
  12334. }
  12335. var horizontalContribution = 3 * contribution;
  12336. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  12337. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  12338. sign1 = coefficentsSign[index + width];
  12339. if (significance1) {
  12340. sign0 = coefficentsSign[index - width];
  12341. contribution = 1 - sign1 - sign0 + horizontalContribution;
  12342. } else {
  12343. contribution = 1 - sign1 - sign1 + horizontalContribution;
  12344. }
  12345. } else if (significance1) {
  12346. sign0 = coefficentsSign[index - width];
  12347. contribution = 1 - sign0 - sign0 + horizontalContribution;
  12348. } else {
  12349. contribution = horizontalContribution;
  12350. }
  12351. if (contribution >= 0) {
  12352. contextLabel = 9 + contribution;
  12353. decoded = this.decoder.readBit(this.contexts, contextLabel);
  12354. } else {
  12355. contextLabel = 9 - contribution;
  12356. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  12357. }
  12358. return decoded;
  12359. },
  12360. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  12361. var decoder = this.decoder;
  12362. var width = this.width,
  12363. height = this.height;
  12364. var coefficentsMagnitude = this.coefficentsMagnitude;
  12365. var neighborsSignificance = this.neighborsSignificance;
  12366. var contexts = this.contexts;
  12367. var bitsDecoded = this.bitsDecoded;
  12368. var processingFlags = this.processingFlags;
  12369. var processedMask = 1;
  12370. var firstMagnitudeBitMask = 2;
  12371. var length = width * height;
  12372. var width4 = width * 4;
  12373. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  12374. indexNext = Math.min(length, index0 + width4);
  12375. for (var j = 0; j < width; j++) {
  12376. for (var index = index0 + j; index < indexNext; index += width) {
  12377. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  12378. continue;
  12379. }
  12380. var contextLabel = 16;
  12381. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  12382. processingFlags[index] ^= firstMagnitudeBitMask;
  12383. var significance = neighborsSignificance[index] & 127;
  12384. contextLabel = significance === 0 ? 15 : 14;
  12385. }
  12386. var bit = decoder.readBit(contexts, contextLabel);
  12387. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  12388. bitsDecoded[index]++;
  12389. processingFlags[index] |= processedMask;
  12390. }
  12391. }
  12392. }
  12393. },
  12394. runCleanupPass: function BitModel_runCleanupPass() {
  12395. var decoder = this.decoder;
  12396. var width = this.width,
  12397. height = this.height;
  12398. var neighborsSignificance = this.neighborsSignificance;
  12399. var coefficentsMagnitude = this.coefficentsMagnitude;
  12400. var coefficentsSign = this.coefficentsSign;
  12401. var contexts = this.contexts;
  12402. var labels = this.contextLabelTable;
  12403. var bitsDecoded = this.bitsDecoded;
  12404. var processingFlags = this.processingFlags;
  12405. var processedMask = 1;
  12406. var firstMagnitudeBitMask = 2;
  12407. var oneRowDown = width;
  12408. var twoRowsDown = width * 2;
  12409. var threeRowsDown = width * 3;
  12410. var iNext;
  12411. for (var i0 = 0; i0 < height; i0 = iNext) {
  12412. iNext = Math.min(i0 + 4, height);
  12413. var indexBase = i0 * width;
  12414. var checkAllEmpty = i0 + 3 < height;
  12415. for (var j = 0; j < width; j++) {
  12416. var index0 = indexBase + j;
  12417. var allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;
  12418. var i1 = 0,
  12419. index = index0;
  12420. var i = i0,
  12421. sign;
  12422. if (allEmpty) {
  12423. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  12424. if (!hasSignificantCoefficent) {
  12425. bitsDecoded[index0]++;
  12426. bitsDecoded[index0 + oneRowDown]++;
  12427. bitsDecoded[index0 + twoRowsDown]++;
  12428. bitsDecoded[index0 + threeRowsDown]++;
  12429. continue;
  12430. }
  12431. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  12432. if (i1 !== 0) {
  12433. i = i0 + i1;
  12434. index += i1 * width;
  12435. }
  12436. sign = this.decodeSignBit(i, j, index);
  12437. coefficentsSign[index] = sign;
  12438. coefficentsMagnitude[index] = 1;
  12439. this.setNeighborsSignificance(i, j, index);
  12440. processingFlags[index] |= firstMagnitudeBitMask;
  12441. index = index0;
  12442. for (var i2 = i0; i2 <= i; i2++, index += width) {
  12443. bitsDecoded[index]++;
  12444. }
  12445. i1++;
  12446. }
  12447. for (i = i0 + i1; i < iNext; i++, index += width) {
  12448. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  12449. continue;
  12450. }
  12451. var contextLabel = labels[neighborsSignificance[index]];
  12452. var decision = decoder.readBit(contexts, contextLabel);
  12453. if (decision === 1) {
  12454. sign = this.decodeSignBit(i, j, index);
  12455. coefficentsSign[index] = sign;
  12456. coefficentsMagnitude[index] = 1;
  12457. this.setNeighborsSignificance(i, j, index);
  12458. processingFlags[index] |= firstMagnitudeBitMask;
  12459. }
  12460. bitsDecoded[index]++;
  12461. }
  12462. }
  12463. }
  12464. },
  12465. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  12466. var decoder = this.decoder;
  12467. var contexts = this.contexts;
  12468. var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  12469. if (symbol !== 0xa) {
  12470. throw new JpxError("Invalid segmentation symbol");
  12471. }
  12472. }
  12473. };
  12474. return BitModel;
  12475. }();
  12476. var Transform = function TransformClosure() {
  12477. function Transform() {}
  12478. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  12479. var ll = subbands[0];
  12480. for (var i = 1, ii = subbands.length; i < ii; i++) {
  12481. ll = this.iterate(ll, subbands[i], u0, v0);
  12482. }
  12483. return ll;
  12484. };
  12485. Transform.prototype.extend = function extend(buffer, offset, size) {
  12486. var i1 = offset - 1,
  12487. j1 = offset + 1;
  12488. var i2 = offset + size - 2,
  12489. j2 = offset + size;
  12490. buffer[i1--] = buffer[j1++];
  12491. buffer[j2++] = buffer[i2--];
  12492. buffer[i1--] = buffer[j1++];
  12493. buffer[j2++] = buffer[i2--];
  12494. buffer[i1--] = buffer[j1++];
  12495. buffer[j2++] = buffer[i2--];
  12496. buffer[i1] = buffer[j1];
  12497. buffer[j2] = buffer[i2];
  12498. };
  12499. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  12500. var llWidth = ll.width,
  12501. llHeight = ll.height,
  12502. llItems = ll.items;
  12503. var width = hl_lh_hh.width;
  12504. var height = hl_lh_hh.height;
  12505. var items = hl_lh_hh.items;
  12506. var i, j, k, l, u, v;
  12507. for (k = 0, i = 0; i < llHeight; i++) {
  12508. l = i * 2 * width;
  12509. for (j = 0; j < llWidth; j++, k++, l += 2) {
  12510. items[l] = llItems[k];
  12511. }
  12512. }
  12513. llItems = ll.items = null;
  12514. var bufferPadding = 4;
  12515. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  12516. if (width === 1) {
  12517. if ((u0 & 1) !== 0) {
  12518. for (v = 0, k = 0; v < height; v++, k += width) {
  12519. items[k] *= 0.5;
  12520. }
  12521. }
  12522. } else {
  12523. for (v = 0, k = 0; v < height; v++, k += width) {
  12524. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  12525. this.extend(rowBuffer, bufferPadding, width);
  12526. this.filter(rowBuffer, bufferPadding, width);
  12527. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  12528. }
  12529. }
  12530. var numBuffers = 16;
  12531. var colBuffers = [];
  12532. for (i = 0; i < numBuffers; i++) {
  12533. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  12534. }
  12535. var b,
  12536. currentBuffer = 0;
  12537. ll = bufferPadding + height;
  12538. if (height === 1) {
  12539. if ((v0 & 1) !== 0) {
  12540. for (u = 0; u < width; u++) {
  12541. items[u] *= 0.5;
  12542. }
  12543. }
  12544. } else {
  12545. for (u = 0; u < width; u++) {
  12546. if (currentBuffer === 0) {
  12547. numBuffers = Math.min(width - u, numBuffers);
  12548. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  12549. for (b = 0; b < numBuffers; b++) {
  12550. colBuffers[b][l] = items[k + b];
  12551. }
  12552. }
  12553. currentBuffer = numBuffers;
  12554. }
  12555. currentBuffer--;
  12556. var buffer = colBuffers[currentBuffer];
  12557. this.extend(buffer, bufferPadding, height);
  12558. this.filter(buffer, bufferPadding, height);
  12559. if (currentBuffer === 0) {
  12560. k = u - numBuffers + 1;
  12561. for (l = bufferPadding; l < ll; k += width, l++) {
  12562. for (b = 0; b < numBuffers; b++) {
  12563. items[k + b] = colBuffers[b][l];
  12564. }
  12565. }
  12566. }
  12567. }
  12568. }
  12569. return {
  12570. width,
  12571. height,
  12572. items
  12573. };
  12574. };
  12575. return Transform;
  12576. }();
  12577. var IrreversibleTransform = function IrreversibleTransformClosure() {
  12578. function IrreversibleTransform() {
  12579. Transform.call(this);
  12580. }
  12581. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  12582. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  12583. var len = length >> 1;
  12584. offset = offset | 0;
  12585. var j, n, current, next;
  12586. var alpha = -1.586134342059924;
  12587. var beta = -0.052980118572961;
  12588. var gamma = 0.882911075530934;
  12589. var delta = 0.443506852043971;
  12590. var K = 1.230174104914001;
  12591. var K_ = 1 / K;
  12592. j = offset - 3;
  12593. for (n = len + 4; n--; j += 2) {
  12594. x[j] *= K_;
  12595. }
  12596. j = offset - 2;
  12597. current = delta * x[j - 1];
  12598. for (n = len + 3; n--; j += 2) {
  12599. next = delta * x[j + 1];
  12600. x[j] = K * x[j] - current - next;
  12601. if (n--) {
  12602. j += 2;
  12603. current = delta * x[j + 1];
  12604. x[j] = K * x[j] - current - next;
  12605. } else {
  12606. break;
  12607. }
  12608. }
  12609. j = offset - 1;
  12610. current = gamma * x[j - 1];
  12611. for (n = len + 2; n--; j += 2) {
  12612. next = gamma * x[j + 1];
  12613. x[j] -= current + next;
  12614. if (n--) {
  12615. j += 2;
  12616. current = gamma * x[j + 1];
  12617. x[j] -= current + next;
  12618. } else {
  12619. break;
  12620. }
  12621. }
  12622. j = offset;
  12623. current = beta * x[j - 1];
  12624. for (n = len + 1; n--; j += 2) {
  12625. next = beta * x[j + 1];
  12626. x[j] -= current + next;
  12627. if (n--) {
  12628. j += 2;
  12629. current = beta * x[j + 1];
  12630. x[j] -= current + next;
  12631. } else {
  12632. break;
  12633. }
  12634. }
  12635. if (len !== 0) {
  12636. j = offset + 1;
  12637. current = alpha * x[j - 1];
  12638. for (n = len; n--; j += 2) {
  12639. next = alpha * x[j + 1];
  12640. x[j] -= current + next;
  12641. if (n--) {
  12642. j += 2;
  12643. current = alpha * x[j + 1];
  12644. x[j] -= current + next;
  12645. } else {
  12646. break;
  12647. }
  12648. }
  12649. }
  12650. };
  12651. return IrreversibleTransform;
  12652. }();
  12653. var ReversibleTransform = function ReversibleTransformClosure() {
  12654. function ReversibleTransform() {
  12655. Transform.call(this);
  12656. }
  12657. ReversibleTransform.prototype = Object.create(Transform.prototype);
  12658. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  12659. var len = length >> 1;
  12660. offset = offset | 0;
  12661. var j, n;
  12662. for (j = offset, n = len + 1; n--; j += 2) {
  12663. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  12664. }
  12665. for (j = offset + 1, n = len; n--; j += 2) {
  12666. x[j] += x[j - 1] + x[j + 1] >> 1;
  12667. }
  12668. };
  12669. return ReversibleTransform;
  12670. }();
  12671. return JpxImage;
  12672. }();
  12673. exports.JpxImage = JpxImage;
  12674. /***/ }),
  12675. /* 21 */
  12676. /***/ (function(module, exports, __w_pdfjs_require__) {
  12677. "use strict";
  12678. Object.defineProperty(exports, "__esModule", {
  12679. value: true
  12680. });
  12681. exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  12682. var _util = __w_pdfjs_require__(2);
  12683. var _primitives = __w_pdfjs_require__(4);
  12684. var _stream = __w_pdfjs_require__(11);
  12685. var ARCFourCipher = function ARCFourCipherClosure() {
  12686. function ARCFourCipher(key) {
  12687. this.a = 0;
  12688. this.b = 0;
  12689. var s = new Uint8Array(256);
  12690. var i,
  12691. j = 0,
  12692. tmp,
  12693. keyLength = key.length;
  12694. for (i = 0; i < 256; ++i) {
  12695. s[i] = i;
  12696. }
  12697. for (i = 0; i < 256; ++i) {
  12698. tmp = s[i];
  12699. j = j + tmp + key[i % keyLength] & 0xff;
  12700. s[i] = s[j];
  12701. s[j] = tmp;
  12702. }
  12703. this.s = s;
  12704. }
  12705. ARCFourCipher.prototype = {
  12706. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  12707. var i,
  12708. n = data.length,
  12709. tmp,
  12710. tmp2;
  12711. var a = this.a,
  12712. b = this.b,
  12713. s = this.s;
  12714. var output = new Uint8Array(n);
  12715. for (i = 0; i < n; ++i) {
  12716. a = a + 1 & 0xff;
  12717. tmp = s[a];
  12718. b = b + tmp & 0xff;
  12719. tmp2 = s[b];
  12720. s[a] = tmp2;
  12721. s[b] = tmp;
  12722. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  12723. }
  12724. this.a = a;
  12725. this.b = b;
  12726. return output;
  12727. }
  12728. };
  12729. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  12730. return ARCFourCipher;
  12731. }();
  12732. exports.ARCFourCipher = ARCFourCipher;
  12733. var calculateMD5 = function calculateMD5Closure() {
  12734. var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
  12735. var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
  12736. function hash(data, offset, length) {
  12737. var h0 = 1732584193,
  12738. h1 = -271733879,
  12739. h2 = -1732584194,
  12740. h3 = 271733878;
  12741. var paddedLength = length + 72 & ~63;
  12742. var padded = new Uint8Array(paddedLength);
  12743. var i, j, n;
  12744. for (i = 0; i < length; ++i) {
  12745. padded[i] = data[offset++];
  12746. }
  12747. padded[i++] = 0x80;
  12748. n = paddedLength - 8;
  12749. while (i < n) {
  12750. padded[i++] = 0;
  12751. }
  12752. padded[i++] = length << 3 & 0xff;
  12753. padded[i++] = length >> 5 & 0xff;
  12754. padded[i++] = length >> 13 & 0xff;
  12755. padded[i++] = length >> 21 & 0xff;
  12756. padded[i++] = length >>> 29 & 0xff;
  12757. padded[i++] = 0;
  12758. padded[i++] = 0;
  12759. padded[i++] = 0;
  12760. var w = new Int32Array(16);
  12761. for (i = 0; i < paddedLength;) {
  12762. for (j = 0; j < 16; ++j, i += 4) {
  12763. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  12764. }
  12765. var a = h0,
  12766. b = h1,
  12767. c = h2,
  12768. d = h3,
  12769. f,
  12770. g;
  12771. for (j = 0; j < 64; ++j) {
  12772. if (j < 16) {
  12773. f = b & c | ~b & d;
  12774. g = j;
  12775. } else if (j < 32) {
  12776. f = d & b | ~d & c;
  12777. g = 5 * j + 1 & 15;
  12778. } else if (j < 48) {
  12779. f = b ^ c ^ d;
  12780. g = 3 * j + 5 & 15;
  12781. } else {
  12782. f = c ^ (b | ~d);
  12783. g = 7 * j & 15;
  12784. }
  12785. var tmp = d,
  12786. rotateArg = a + f + k[j] + w[g] | 0,
  12787. rotate = r[j];
  12788. d = c;
  12789. c = b;
  12790. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  12791. a = tmp;
  12792. }
  12793. h0 = h0 + a | 0;
  12794. h1 = h1 + b | 0;
  12795. h2 = h2 + c | 0;
  12796. h3 = h3 + d | 0;
  12797. }
  12798. return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
  12799. }
  12800. return hash;
  12801. }();
  12802. exports.calculateMD5 = calculateMD5;
  12803. var Word64 = function Word64Closure() {
  12804. function Word64(highInteger, lowInteger) {
  12805. this.high = highInteger | 0;
  12806. this.low = lowInteger | 0;
  12807. }
  12808. Word64.prototype = {
  12809. and: function Word64_and(word) {
  12810. this.high &= word.high;
  12811. this.low &= word.low;
  12812. },
  12813. xor: function Word64_xor(word) {
  12814. this.high ^= word.high;
  12815. this.low ^= word.low;
  12816. },
  12817. or: function Word64_or(word) {
  12818. this.high |= word.high;
  12819. this.low |= word.low;
  12820. },
  12821. shiftRight: function Word64_shiftRight(places) {
  12822. if (places >= 32) {
  12823. this.low = this.high >>> places - 32 | 0;
  12824. this.high = 0;
  12825. } else {
  12826. this.low = this.low >>> places | this.high << 32 - places;
  12827. this.high = this.high >>> places | 0;
  12828. }
  12829. },
  12830. shiftLeft: function Word64_shiftLeft(places) {
  12831. if (places >= 32) {
  12832. this.high = this.low << places - 32;
  12833. this.low = 0;
  12834. } else {
  12835. this.high = this.high << places | this.low >>> 32 - places;
  12836. this.low = this.low << places;
  12837. }
  12838. },
  12839. rotateRight: function Word64_rotateRight(places) {
  12840. var low, high;
  12841. if (places & 32) {
  12842. high = this.low;
  12843. low = this.high;
  12844. } else {
  12845. low = this.low;
  12846. high = this.high;
  12847. }
  12848. places &= 31;
  12849. this.low = low >>> places | high << 32 - places;
  12850. this.high = high >>> places | low << 32 - places;
  12851. },
  12852. not: function Word64_not() {
  12853. this.high = ~this.high;
  12854. this.low = ~this.low;
  12855. },
  12856. add: function Word64_add(word) {
  12857. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  12858. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  12859. if (lowAdd > 0xffffffff) {
  12860. highAdd += 1;
  12861. }
  12862. this.low = lowAdd | 0;
  12863. this.high = highAdd | 0;
  12864. },
  12865. copyTo: function Word64_copyTo(bytes, offset) {
  12866. bytes[offset] = this.high >>> 24 & 0xff;
  12867. bytes[offset + 1] = this.high >> 16 & 0xff;
  12868. bytes[offset + 2] = this.high >> 8 & 0xff;
  12869. bytes[offset + 3] = this.high & 0xff;
  12870. bytes[offset + 4] = this.low >>> 24 & 0xff;
  12871. bytes[offset + 5] = this.low >> 16 & 0xff;
  12872. bytes[offset + 6] = this.low >> 8 & 0xff;
  12873. bytes[offset + 7] = this.low & 0xff;
  12874. },
  12875. assign: function Word64_assign(word) {
  12876. this.high = word.high;
  12877. this.low = word.low;
  12878. }
  12879. };
  12880. return Word64;
  12881. }();
  12882. var calculateSHA256 = function calculateSHA256Closure() {
  12883. function rotr(x, n) {
  12884. return x >>> n | x << 32 - n;
  12885. }
  12886. function ch(x, y, z) {
  12887. return x & y ^ ~x & z;
  12888. }
  12889. function maj(x, y, z) {
  12890. return x & y ^ x & z ^ y & z;
  12891. }
  12892. function sigma(x) {
  12893. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  12894. }
  12895. function sigmaPrime(x) {
  12896. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  12897. }
  12898. function littleSigma(x) {
  12899. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  12900. }
  12901. function littleSigmaPrime(x) {
  12902. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  12903. }
  12904. var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
  12905. function hash(data, offset, length) {
  12906. var h0 = 0x6a09e667,
  12907. h1 = 0xbb67ae85,
  12908. h2 = 0x3c6ef372,
  12909. h3 = 0xa54ff53a,
  12910. h4 = 0x510e527f,
  12911. h5 = 0x9b05688c,
  12912. h6 = 0x1f83d9ab,
  12913. h7 = 0x5be0cd19;
  12914. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  12915. var padded = new Uint8Array(paddedLength);
  12916. var i, j, n;
  12917. for (i = 0; i < length; ++i) {
  12918. padded[i] = data[offset++];
  12919. }
  12920. padded[i++] = 0x80;
  12921. n = paddedLength - 8;
  12922. while (i < n) {
  12923. padded[i++] = 0;
  12924. }
  12925. padded[i++] = 0;
  12926. padded[i++] = 0;
  12927. padded[i++] = 0;
  12928. padded[i++] = length >>> 29 & 0xff;
  12929. padded[i++] = length >> 21 & 0xff;
  12930. padded[i++] = length >> 13 & 0xff;
  12931. padded[i++] = length >> 5 & 0xff;
  12932. padded[i++] = length << 3 & 0xff;
  12933. var w = new Uint32Array(64);
  12934. for (i = 0; i < paddedLength;) {
  12935. for (j = 0; j < 16; ++j) {
  12936. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  12937. i += 4;
  12938. }
  12939. for (j = 16; j < 64; ++j) {
  12940. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  12941. }
  12942. var a = h0,
  12943. b = h1,
  12944. c = h2,
  12945. d = h3,
  12946. e = h4,
  12947. f = h5,
  12948. g = h6,
  12949. h = h7,
  12950. t1,
  12951. t2;
  12952. for (j = 0; j < 64; ++j) {
  12953. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  12954. t2 = sigma(a) + maj(a, b, c);
  12955. h = g;
  12956. g = f;
  12957. f = e;
  12958. e = d + t1 | 0;
  12959. d = c;
  12960. c = b;
  12961. b = a;
  12962. a = t1 + t2 | 0;
  12963. }
  12964. h0 = h0 + a | 0;
  12965. h1 = h1 + b | 0;
  12966. h2 = h2 + c | 0;
  12967. h3 = h3 + d | 0;
  12968. h4 = h4 + e | 0;
  12969. h5 = h5 + f | 0;
  12970. h6 = h6 + g | 0;
  12971. h7 = h7 + h | 0;
  12972. }
  12973. return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
  12974. }
  12975. return hash;
  12976. }();
  12977. exports.calculateSHA256 = calculateSHA256;
  12978. var calculateSHA512 = function calculateSHA512Closure() {
  12979. function ch(result, x, y, z, tmp) {
  12980. result.assign(x);
  12981. result.and(y);
  12982. tmp.assign(x);
  12983. tmp.not();
  12984. tmp.and(z);
  12985. result.xor(tmp);
  12986. }
  12987. function maj(result, x, y, z, tmp) {
  12988. result.assign(x);
  12989. result.and(y);
  12990. tmp.assign(x);
  12991. tmp.and(z);
  12992. result.xor(tmp);
  12993. tmp.assign(y);
  12994. tmp.and(z);
  12995. result.xor(tmp);
  12996. }
  12997. function sigma(result, x, tmp) {
  12998. result.assign(x);
  12999. result.rotateRight(28);
  13000. tmp.assign(x);
  13001. tmp.rotateRight(34);
  13002. result.xor(tmp);
  13003. tmp.assign(x);
  13004. tmp.rotateRight(39);
  13005. result.xor(tmp);
  13006. }
  13007. function sigmaPrime(result, x, tmp) {
  13008. result.assign(x);
  13009. result.rotateRight(14);
  13010. tmp.assign(x);
  13011. tmp.rotateRight(18);
  13012. result.xor(tmp);
  13013. tmp.assign(x);
  13014. tmp.rotateRight(41);
  13015. result.xor(tmp);
  13016. }
  13017. function littleSigma(result, x, tmp) {
  13018. result.assign(x);
  13019. result.rotateRight(1);
  13020. tmp.assign(x);
  13021. tmp.rotateRight(8);
  13022. result.xor(tmp);
  13023. tmp.assign(x);
  13024. tmp.shiftRight(7);
  13025. result.xor(tmp);
  13026. }
  13027. function littleSigmaPrime(result, x, tmp) {
  13028. result.assign(x);
  13029. result.rotateRight(19);
  13030. tmp.assign(x);
  13031. tmp.rotateRight(61);
  13032. result.xor(tmp);
  13033. tmp.assign(x);
  13034. tmp.shiftRight(6);
  13035. result.xor(tmp);
  13036. }
  13037. var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
  13038. function hash(data, offset, length, mode384) {
  13039. mode384 = !!mode384;
  13040. var h0, h1, h2, h3, h4, h5, h6, h7;
  13041. if (!mode384) {
  13042. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  13043. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  13044. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  13045. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  13046. h4 = new Word64(0x510e527f, 0xade682d1);
  13047. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  13048. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  13049. h7 = new Word64(0x5be0cd19, 0x137e2179);
  13050. } else {
  13051. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  13052. h1 = new Word64(0x629a292a, 0x367cd507);
  13053. h2 = new Word64(0x9159015a, 0x3070dd17);
  13054. h3 = new Word64(0x152fecd8, 0xf70e5939);
  13055. h4 = new Word64(0x67332667, 0xffc00b31);
  13056. h5 = new Word64(0x8eb44a87, 0x68581511);
  13057. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  13058. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  13059. }
  13060. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  13061. var padded = new Uint8Array(paddedLength);
  13062. var i, j, n;
  13063. for (i = 0; i < length; ++i) {
  13064. padded[i] = data[offset++];
  13065. }
  13066. padded[i++] = 0x80;
  13067. n = paddedLength - 16;
  13068. while (i < n) {
  13069. padded[i++] = 0;
  13070. }
  13071. padded[i++] = 0;
  13072. padded[i++] = 0;
  13073. padded[i++] = 0;
  13074. padded[i++] = 0;
  13075. padded[i++] = 0;
  13076. padded[i++] = 0;
  13077. padded[i++] = 0;
  13078. padded[i++] = 0;
  13079. padded[i++] = 0;
  13080. padded[i++] = 0;
  13081. padded[i++] = 0;
  13082. padded[i++] = length >>> 29 & 0xff;
  13083. padded[i++] = length >> 21 & 0xff;
  13084. padded[i++] = length >> 13 & 0xff;
  13085. padded[i++] = length >> 5 & 0xff;
  13086. padded[i++] = length << 3 & 0xff;
  13087. var w = new Array(80);
  13088. for (i = 0; i < 80; i++) {
  13089. w[i] = new Word64(0, 0);
  13090. }
  13091. var a = new Word64(0, 0),
  13092. b = new Word64(0, 0),
  13093. c = new Word64(0, 0);
  13094. var d = new Word64(0, 0),
  13095. e = new Word64(0, 0),
  13096. f = new Word64(0, 0);
  13097. var g = new Word64(0, 0),
  13098. h = new Word64(0, 0);
  13099. var t1 = new Word64(0, 0),
  13100. t2 = new Word64(0, 0);
  13101. var tmp1 = new Word64(0, 0),
  13102. tmp2 = new Word64(0, 0),
  13103. tmp3;
  13104. for (i = 0; i < paddedLength;) {
  13105. for (j = 0; j < 16; ++j) {
  13106. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13107. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  13108. i += 8;
  13109. }
  13110. for (j = 16; j < 80; ++j) {
  13111. tmp3 = w[j];
  13112. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  13113. tmp3.add(w[j - 7]);
  13114. littleSigma(tmp1, w[j - 15], tmp2);
  13115. tmp3.add(tmp1);
  13116. tmp3.add(w[j - 16]);
  13117. }
  13118. a.assign(h0);
  13119. b.assign(h1);
  13120. c.assign(h2);
  13121. d.assign(h3);
  13122. e.assign(h4);
  13123. f.assign(h5);
  13124. g.assign(h6);
  13125. h.assign(h7);
  13126. for (j = 0; j < 80; ++j) {
  13127. t1.assign(h);
  13128. sigmaPrime(tmp1, e, tmp2);
  13129. t1.add(tmp1);
  13130. ch(tmp1, e, f, g, tmp2);
  13131. t1.add(tmp1);
  13132. t1.add(k[j]);
  13133. t1.add(w[j]);
  13134. sigma(t2, a, tmp2);
  13135. maj(tmp1, a, b, c, tmp2);
  13136. t2.add(tmp1);
  13137. tmp3 = h;
  13138. h = g;
  13139. g = f;
  13140. f = e;
  13141. d.add(t1);
  13142. e = d;
  13143. d = c;
  13144. c = b;
  13145. b = a;
  13146. tmp3.assign(t1);
  13147. tmp3.add(t2);
  13148. a = tmp3;
  13149. }
  13150. h0.add(a);
  13151. h1.add(b);
  13152. h2.add(c);
  13153. h3.add(d);
  13154. h4.add(e);
  13155. h5.add(f);
  13156. h6.add(g);
  13157. h7.add(h);
  13158. }
  13159. var result;
  13160. if (!mode384) {
  13161. result = new Uint8Array(64);
  13162. h0.copyTo(result, 0);
  13163. h1.copyTo(result, 8);
  13164. h2.copyTo(result, 16);
  13165. h3.copyTo(result, 24);
  13166. h4.copyTo(result, 32);
  13167. h5.copyTo(result, 40);
  13168. h6.copyTo(result, 48);
  13169. h7.copyTo(result, 56);
  13170. } else {
  13171. result = new Uint8Array(48);
  13172. h0.copyTo(result, 0);
  13173. h1.copyTo(result, 8);
  13174. h2.copyTo(result, 16);
  13175. h3.copyTo(result, 24);
  13176. h4.copyTo(result, 32);
  13177. h5.copyTo(result, 40);
  13178. }
  13179. return result;
  13180. }
  13181. return hash;
  13182. }();
  13183. exports.calculateSHA512 = calculateSHA512;
  13184. var calculateSHA384 = function calculateSHA384Closure() {
  13185. function hash(data, offset, length) {
  13186. return calculateSHA512(data, offset, length, true);
  13187. }
  13188. return hash;
  13189. }();
  13190. exports.calculateSHA384 = calculateSHA384;
  13191. var NullCipher = function NullCipherClosure() {
  13192. function NullCipher() {}
  13193. NullCipher.prototype = {
  13194. decryptBlock: function NullCipher_decryptBlock(data) {
  13195. return data;
  13196. }
  13197. };
  13198. return NullCipher;
  13199. }();
  13200. class AESBaseCipher {
  13201. constructor() {
  13202. if (this.constructor === AESBaseCipher) {
  13203. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  13204. }
  13205. this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
  13206. this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
  13207. this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
  13208. this._mixCol = new Uint8Array(256);
  13209. for (let i = 0; i < 256; i++) {
  13210. if (i < 128) {
  13211. this._mixCol[i] = i << 1;
  13212. } else {
  13213. this._mixCol[i] = i << 1 ^ 0x1b;
  13214. }
  13215. }
  13216. this.buffer = new Uint8Array(16);
  13217. this.bufferPosition = 0;
  13218. }
  13219. _expandKey(cipherKey) {
  13220. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  13221. }
  13222. _decrypt(input, key) {
  13223. let t, u, v;
  13224. const state = new Uint8Array(16);
  13225. state.set(input);
  13226. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13227. state[j] ^= key[k];
  13228. }
  13229. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  13230. t = state[13];
  13231. state[13] = state[9];
  13232. state[9] = state[5];
  13233. state[5] = state[1];
  13234. state[1] = t;
  13235. t = state[14];
  13236. u = state[10];
  13237. state[14] = state[6];
  13238. state[10] = state[2];
  13239. state[6] = t;
  13240. state[2] = u;
  13241. t = state[15];
  13242. u = state[11];
  13243. v = state[7];
  13244. state[15] = state[3];
  13245. state[11] = t;
  13246. state[7] = u;
  13247. state[3] = v;
  13248. for (let j = 0; j < 16; ++j) {
  13249. state[j] = this._inv_s[state[j]];
  13250. }
  13251. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13252. state[j] ^= key[k];
  13253. }
  13254. for (let j = 0; j < 16; j += 4) {
  13255. const s0 = this._mix[state[j]];
  13256. const s1 = this._mix[state[j + 1]];
  13257. const s2 = this._mix[state[j + 2]];
  13258. const s3 = this._mix[state[j + 3]];
  13259. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  13260. state[j] = t >>> 24 & 0xff;
  13261. state[j + 1] = t >> 16 & 0xff;
  13262. state[j + 2] = t >> 8 & 0xff;
  13263. state[j + 3] = t & 0xff;
  13264. }
  13265. }
  13266. t = state[13];
  13267. state[13] = state[9];
  13268. state[9] = state[5];
  13269. state[5] = state[1];
  13270. state[1] = t;
  13271. t = state[14];
  13272. u = state[10];
  13273. state[14] = state[6];
  13274. state[10] = state[2];
  13275. state[6] = t;
  13276. state[2] = u;
  13277. t = state[15];
  13278. u = state[11];
  13279. v = state[7];
  13280. state[15] = state[3];
  13281. state[11] = t;
  13282. state[7] = u;
  13283. state[3] = v;
  13284. for (let j = 0; j < 16; ++j) {
  13285. state[j] = this._inv_s[state[j]];
  13286. state[j] ^= key[j];
  13287. }
  13288. return state;
  13289. }
  13290. _encrypt(input, key) {
  13291. const s = this._s;
  13292. let t, u, v;
  13293. const state = new Uint8Array(16);
  13294. state.set(input);
  13295. for (let j = 0; j < 16; ++j) {
  13296. state[j] ^= key[j];
  13297. }
  13298. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  13299. for (let j = 0; j < 16; ++j) {
  13300. state[j] = s[state[j]];
  13301. }
  13302. v = state[1];
  13303. state[1] = state[5];
  13304. state[5] = state[9];
  13305. state[9] = state[13];
  13306. state[13] = v;
  13307. v = state[2];
  13308. u = state[6];
  13309. state[2] = state[10];
  13310. state[6] = state[14];
  13311. state[10] = v;
  13312. state[14] = u;
  13313. v = state[3];
  13314. u = state[7];
  13315. t = state[11];
  13316. state[3] = state[15];
  13317. state[7] = v;
  13318. state[11] = u;
  13319. state[15] = t;
  13320. for (let j = 0; j < 16; j += 4) {
  13321. const s0 = state[j + 0];
  13322. const s1 = state[j + 1];
  13323. const s2 = state[j + 2];
  13324. const s3 = state[j + 3];
  13325. t = s0 ^ s1 ^ s2 ^ s3;
  13326. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  13327. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  13328. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  13329. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  13330. }
  13331. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13332. state[j] ^= key[k];
  13333. }
  13334. }
  13335. for (let j = 0; j < 16; ++j) {
  13336. state[j] = s[state[j]];
  13337. }
  13338. v = state[1];
  13339. state[1] = state[5];
  13340. state[5] = state[9];
  13341. state[9] = state[13];
  13342. state[13] = v;
  13343. v = state[2];
  13344. u = state[6];
  13345. state[2] = state[10];
  13346. state[6] = state[14];
  13347. state[10] = v;
  13348. state[14] = u;
  13349. v = state[3];
  13350. u = state[7];
  13351. t = state[11];
  13352. state[3] = state[15];
  13353. state[7] = v;
  13354. state[11] = u;
  13355. state[15] = t;
  13356. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13357. state[j] ^= key[k];
  13358. }
  13359. return state;
  13360. }
  13361. _decryptBlock2(data, finalize) {
  13362. const sourceLength = data.length;
  13363. let buffer = this.buffer,
  13364. bufferLength = this.bufferPosition;
  13365. const result = [];
  13366. let iv = this.iv;
  13367. for (let i = 0; i < sourceLength; ++i) {
  13368. buffer[bufferLength] = data[i];
  13369. ++bufferLength;
  13370. if (bufferLength < 16) {
  13371. continue;
  13372. }
  13373. const plain = this._decrypt(buffer, this._key);
  13374. for (let j = 0; j < 16; ++j) {
  13375. plain[j] ^= iv[j];
  13376. }
  13377. iv = buffer;
  13378. result.push(plain);
  13379. buffer = new Uint8Array(16);
  13380. bufferLength = 0;
  13381. }
  13382. this.buffer = buffer;
  13383. this.bufferLength = bufferLength;
  13384. this.iv = iv;
  13385. if (result.length === 0) {
  13386. return new Uint8Array(0);
  13387. }
  13388. let outputLength = 16 * result.length;
  13389. if (finalize) {
  13390. const lastBlock = result[result.length - 1];
  13391. let psLen = lastBlock[15];
  13392. if (psLen <= 16) {
  13393. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  13394. if (lastBlock[i] !== psLen) {
  13395. psLen = 0;
  13396. break;
  13397. }
  13398. }
  13399. outputLength -= psLen;
  13400. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  13401. }
  13402. }
  13403. const output = new Uint8Array(outputLength);
  13404. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  13405. output.set(result[i], j);
  13406. }
  13407. return output;
  13408. }
  13409. decryptBlock(data, finalize, iv = null) {
  13410. const sourceLength = data.length;
  13411. const buffer = this.buffer;
  13412. let bufferLength = this.bufferPosition;
  13413. if (iv) {
  13414. this.iv = iv;
  13415. } else {
  13416. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  13417. buffer[bufferLength] = data[i];
  13418. }
  13419. if (bufferLength < 16) {
  13420. this.bufferLength = bufferLength;
  13421. return new Uint8Array(0);
  13422. }
  13423. this.iv = buffer;
  13424. data = data.subarray(16);
  13425. }
  13426. this.buffer = new Uint8Array(16);
  13427. this.bufferLength = 0;
  13428. this.decryptBlock = this._decryptBlock2;
  13429. return this.decryptBlock(data, finalize);
  13430. }
  13431. encrypt(data, iv) {
  13432. const sourceLength = data.length;
  13433. let buffer = this.buffer,
  13434. bufferLength = this.bufferPosition;
  13435. const result = [];
  13436. if (!iv) {
  13437. iv = new Uint8Array(16);
  13438. }
  13439. for (let i = 0; i < sourceLength; ++i) {
  13440. buffer[bufferLength] = data[i];
  13441. ++bufferLength;
  13442. if (bufferLength < 16) {
  13443. continue;
  13444. }
  13445. for (let j = 0; j < 16; ++j) {
  13446. buffer[j] ^= iv[j];
  13447. }
  13448. const cipher = this._encrypt(buffer, this._key);
  13449. iv = cipher;
  13450. result.push(cipher);
  13451. buffer = new Uint8Array(16);
  13452. bufferLength = 0;
  13453. }
  13454. this.buffer = buffer;
  13455. this.bufferLength = bufferLength;
  13456. this.iv = iv;
  13457. if (result.length === 0) {
  13458. return new Uint8Array(0);
  13459. }
  13460. const outputLength = 16 * result.length;
  13461. const output = new Uint8Array(outputLength);
  13462. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  13463. output.set(result[i], j);
  13464. }
  13465. return output;
  13466. }
  13467. }
  13468. class AES128Cipher extends AESBaseCipher {
  13469. constructor(key) {
  13470. super();
  13471. this._cyclesOfRepetition = 10;
  13472. this._keySize = 160;
  13473. this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
  13474. this._key = this._expandKey(key);
  13475. }
  13476. _expandKey(cipherKey) {
  13477. const b = 176;
  13478. const s = this._s;
  13479. const rcon = this._rcon;
  13480. const result = new Uint8Array(b);
  13481. result.set(cipherKey);
  13482. for (let j = 16, i = 1; j < b; ++i) {
  13483. let t1 = result[j - 3];
  13484. let t2 = result[j - 2];
  13485. let t3 = result[j - 1];
  13486. let t4 = result[j - 4];
  13487. t1 = s[t1];
  13488. t2 = s[t2];
  13489. t3 = s[t3];
  13490. t4 = s[t4];
  13491. t1 = t1 ^ rcon[i];
  13492. for (let n = 0; n < 4; ++n) {
  13493. result[j] = t1 ^= result[j - 16];
  13494. j++;
  13495. result[j] = t2 ^= result[j - 16];
  13496. j++;
  13497. result[j] = t3 ^= result[j - 16];
  13498. j++;
  13499. result[j] = t4 ^= result[j - 16];
  13500. j++;
  13501. }
  13502. }
  13503. return result;
  13504. }
  13505. }
  13506. exports.AES128Cipher = AES128Cipher;
  13507. class AES256Cipher extends AESBaseCipher {
  13508. constructor(key) {
  13509. super();
  13510. this._cyclesOfRepetition = 14;
  13511. this._keySize = 224;
  13512. this._key = this._expandKey(key);
  13513. }
  13514. _expandKey(cipherKey) {
  13515. const b = 240;
  13516. const s = this._s;
  13517. const result = new Uint8Array(b);
  13518. result.set(cipherKey);
  13519. let r = 1;
  13520. let t1, t2, t3, t4;
  13521. for (let j = 32, i = 1; j < b; ++i) {
  13522. if (j % 32 === 16) {
  13523. t1 = s[t1];
  13524. t2 = s[t2];
  13525. t3 = s[t3];
  13526. t4 = s[t4];
  13527. } else if (j % 32 === 0) {
  13528. t1 = result[j - 3];
  13529. t2 = result[j - 2];
  13530. t3 = result[j - 1];
  13531. t4 = result[j - 4];
  13532. t1 = s[t1];
  13533. t2 = s[t2];
  13534. t3 = s[t3];
  13535. t4 = s[t4];
  13536. t1 = t1 ^ r;
  13537. if ((r <<= 1) >= 256) {
  13538. r = (r ^ 0x1b) & 0xff;
  13539. }
  13540. }
  13541. for (let n = 0; n < 4; ++n) {
  13542. result[j] = t1 ^= result[j - 32];
  13543. j++;
  13544. result[j] = t2 ^= result[j - 32];
  13545. j++;
  13546. result[j] = t3 ^= result[j - 32];
  13547. j++;
  13548. result[j] = t4 ^= result[j - 32];
  13549. j++;
  13550. }
  13551. }
  13552. return result;
  13553. }
  13554. }
  13555. exports.AES256Cipher = AES256Cipher;
  13556. var PDF17 = function PDF17Closure() {
  13557. function compareByteArrays(array1, array2) {
  13558. if (array1.length !== array2.length) {
  13559. return false;
  13560. }
  13561. for (var i = 0; i < array1.length; i++) {
  13562. if (array1[i] !== array2[i]) {
  13563. return false;
  13564. }
  13565. }
  13566. return true;
  13567. }
  13568. function PDF17() {}
  13569. PDF17.prototype = {
  13570. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  13571. var hashData = new Uint8Array(password.length + 56);
  13572. hashData.set(password, 0);
  13573. hashData.set(ownerValidationSalt, password.length);
  13574. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  13575. var result = calculateSHA256(hashData, 0, hashData.length);
  13576. return compareByteArrays(result, ownerPassword);
  13577. },
  13578. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  13579. var hashData = new Uint8Array(password.length + 8);
  13580. hashData.set(password, 0);
  13581. hashData.set(userValidationSalt, password.length);
  13582. var result = calculateSHA256(hashData, 0, hashData.length);
  13583. return compareByteArrays(result, userPassword);
  13584. },
  13585. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  13586. var hashData = new Uint8Array(password.length + 56);
  13587. hashData.set(password, 0);
  13588. hashData.set(ownerKeySalt, password.length);
  13589. hashData.set(userBytes, password.length + ownerKeySalt.length);
  13590. var key = calculateSHA256(hashData, 0, hashData.length);
  13591. var cipher = new AES256Cipher(key);
  13592. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  13593. },
  13594. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  13595. var hashData = new Uint8Array(password.length + 8);
  13596. hashData.set(password, 0);
  13597. hashData.set(userKeySalt, password.length);
  13598. var key = calculateSHA256(hashData, 0, hashData.length);
  13599. var cipher = new AES256Cipher(key);
  13600. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  13601. }
  13602. };
  13603. return PDF17;
  13604. }();
  13605. exports.PDF17 = PDF17;
  13606. var PDF20 = function PDF20Closure() {
  13607. function concatArrays(array1, array2) {
  13608. var t = new Uint8Array(array1.length + array2.length);
  13609. t.set(array1, 0);
  13610. t.set(array2, array1.length);
  13611. return t;
  13612. }
  13613. function calculatePDF20Hash(password, input, userBytes) {
  13614. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  13615. var e = [0];
  13616. var i = 0;
  13617. while (i < 64 || e[e.length - 1] > i - 32) {
  13618. var arrayLength = password.length + k.length + userBytes.length;
  13619. var k1 = new Uint8Array(arrayLength * 64);
  13620. var array = concatArrays(password, k);
  13621. array = concatArrays(array, userBytes);
  13622. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  13623. k1.set(array, pos);
  13624. }
  13625. var cipher = new AES128Cipher(k.subarray(0, 16));
  13626. e = cipher.encrypt(k1, k.subarray(16, 32));
  13627. var remainder = 0;
  13628. for (var z = 0; z < 16; z++) {
  13629. remainder *= 256 % 3;
  13630. remainder %= 3;
  13631. remainder += (e[z] >>> 0) % 3;
  13632. remainder %= 3;
  13633. }
  13634. if (remainder === 0) {
  13635. k = calculateSHA256(e, 0, e.length);
  13636. } else if (remainder === 1) {
  13637. k = calculateSHA384(e, 0, e.length);
  13638. } else if (remainder === 2) {
  13639. k = calculateSHA512(e, 0, e.length);
  13640. }
  13641. i++;
  13642. }
  13643. return k.subarray(0, 32);
  13644. }
  13645. function PDF20() {}
  13646. function compareByteArrays(array1, array2) {
  13647. if (array1.length !== array2.length) {
  13648. return false;
  13649. }
  13650. for (var i = 0; i < array1.length; i++) {
  13651. if (array1[i] !== array2[i]) {
  13652. return false;
  13653. }
  13654. }
  13655. return true;
  13656. }
  13657. PDF20.prototype = {
  13658. hash: function PDF20_hash(password, concatBytes, userBytes) {
  13659. return calculatePDF20Hash(password, concatBytes, userBytes);
  13660. },
  13661. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  13662. var hashData = new Uint8Array(password.length + 56);
  13663. hashData.set(password, 0);
  13664. hashData.set(ownerValidationSalt, password.length);
  13665. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  13666. var result = calculatePDF20Hash(password, hashData, userBytes);
  13667. return compareByteArrays(result, ownerPassword);
  13668. },
  13669. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  13670. var hashData = new Uint8Array(password.length + 8);
  13671. hashData.set(password, 0);
  13672. hashData.set(userValidationSalt, password.length);
  13673. var result = calculatePDF20Hash(password, hashData, []);
  13674. return compareByteArrays(result, userPassword);
  13675. },
  13676. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  13677. var hashData = new Uint8Array(password.length + 56);
  13678. hashData.set(password, 0);
  13679. hashData.set(ownerKeySalt, password.length);
  13680. hashData.set(userBytes, password.length + ownerKeySalt.length);
  13681. var key = calculatePDF20Hash(password, hashData, userBytes);
  13682. var cipher = new AES256Cipher(key);
  13683. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  13684. },
  13685. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  13686. var hashData = new Uint8Array(password.length + 8);
  13687. hashData.set(password, 0);
  13688. hashData.set(userKeySalt, password.length);
  13689. var key = calculatePDF20Hash(password, hashData, []);
  13690. var cipher = new AES256Cipher(key);
  13691. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  13692. }
  13693. };
  13694. return PDF20;
  13695. }();
  13696. exports.PDF20 = PDF20;
  13697. var CipherTransform = function CipherTransformClosure() {
  13698. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  13699. this.StringCipherConstructor = stringCipherConstructor;
  13700. this.StreamCipherConstructor = streamCipherConstructor;
  13701. }
  13702. CipherTransform.prototype = {
  13703. createStream: function CipherTransform_createStream(stream, length) {
  13704. var cipher = new this.StreamCipherConstructor();
  13705. return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  13706. return cipher.decryptBlock(data, finalize);
  13707. });
  13708. },
  13709. decryptString: function CipherTransform_decryptString(s) {
  13710. var cipher = new this.StringCipherConstructor();
  13711. var data = (0, _util.stringToBytes)(s);
  13712. data = cipher.decryptBlock(data, true);
  13713. return (0, _util.bytesToString)(data);
  13714. }
  13715. };
  13716. return CipherTransform;
  13717. }();
  13718. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  13719. var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]);
  13720. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  13721. if (password) {
  13722. var passwordLength = Math.min(127, password.length);
  13723. password = password.subarray(0, passwordLength);
  13724. } else {
  13725. password = [];
  13726. }
  13727. var pdfAlgorithm;
  13728. if (revision === 6) {
  13729. pdfAlgorithm = new PDF20();
  13730. } else {
  13731. pdfAlgorithm = new PDF17();
  13732. }
  13733. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  13734. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  13735. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  13736. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  13737. }
  13738. return null;
  13739. }
  13740. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  13741. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  13742. var hashData = new Uint8Array(hashDataSize),
  13743. i = 0,
  13744. j,
  13745. n;
  13746. if (password) {
  13747. n = Math.min(32, password.length);
  13748. for (; i < n; ++i) {
  13749. hashData[i] = password[i];
  13750. }
  13751. }
  13752. j = 0;
  13753. while (i < 32) {
  13754. hashData[i++] = defaultPasswordBytes[j++];
  13755. }
  13756. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  13757. hashData[i++] = ownerPassword[j];
  13758. }
  13759. hashData[i++] = flags & 0xff;
  13760. hashData[i++] = flags >> 8 & 0xff;
  13761. hashData[i++] = flags >> 16 & 0xff;
  13762. hashData[i++] = flags >>> 24 & 0xff;
  13763. for (j = 0, n = fileId.length; j < n; ++j) {
  13764. hashData[i++] = fileId[j];
  13765. }
  13766. if (revision >= 4 && !encryptMetadata) {
  13767. hashData[i++] = 0xff;
  13768. hashData[i++] = 0xff;
  13769. hashData[i++] = 0xff;
  13770. hashData[i++] = 0xff;
  13771. }
  13772. var hash = calculateMD5(hashData, 0, i);
  13773. var keyLengthInBytes = keyLength >> 3;
  13774. if (revision >= 3) {
  13775. for (j = 0; j < 50; ++j) {
  13776. hash = calculateMD5(hash, 0, keyLengthInBytes);
  13777. }
  13778. }
  13779. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  13780. var cipher, checkData;
  13781. if (revision >= 3) {
  13782. for (i = 0; i < 32; ++i) {
  13783. hashData[i] = defaultPasswordBytes[i];
  13784. }
  13785. for (j = 0, n = fileId.length; j < n; ++j) {
  13786. hashData[i++] = fileId[j];
  13787. }
  13788. cipher = new ARCFourCipher(encryptionKey);
  13789. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  13790. n = encryptionKey.length;
  13791. var derivedKey = new Uint8Array(n),
  13792. k;
  13793. for (j = 1; j <= 19; ++j) {
  13794. for (k = 0; k < n; ++k) {
  13795. derivedKey[k] = encryptionKey[k] ^ j;
  13796. }
  13797. cipher = new ARCFourCipher(derivedKey);
  13798. checkData = cipher.encryptBlock(checkData);
  13799. }
  13800. for (j = 0, n = checkData.length; j < n; ++j) {
  13801. if (userPassword[j] !== checkData[j]) {
  13802. return null;
  13803. }
  13804. }
  13805. } else {
  13806. cipher = new ARCFourCipher(encryptionKey);
  13807. checkData = cipher.encryptBlock(defaultPasswordBytes);
  13808. for (j = 0, n = checkData.length; j < n; ++j) {
  13809. if (userPassword[j] !== checkData[j]) {
  13810. return null;
  13811. }
  13812. }
  13813. }
  13814. return encryptionKey;
  13815. }
  13816. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  13817. var hashData = new Uint8Array(32),
  13818. i = 0,
  13819. j,
  13820. n;
  13821. n = Math.min(32, password.length);
  13822. for (; i < n; ++i) {
  13823. hashData[i] = password[i];
  13824. }
  13825. j = 0;
  13826. while (i < 32) {
  13827. hashData[i++] = defaultPasswordBytes[j++];
  13828. }
  13829. var hash = calculateMD5(hashData, 0, i);
  13830. var keyLengthInBytes = keyLength >> 3;
  13831. if (revision >= 3) {
  13832. for (j = 0; j < 50; ++j) {
  13833. hash = calculateMD5(hash, 0, hash.length);
  13834. }
  13835. }
  13836. var cipher, userPassword;
  13837. if (revision >= 3) {
  13838. userPassword = ownerPassword;
  13839. var derivedKey = new Uint8Array(keyLengthInBytes),
  13840. k;
  13841. for (j = 19; j >= 0; j--) {
  13842. for (k = 0; k < keyLengthInBytes; ++k) {
  13843. derivedKey[k] = hash[k] ^ j;
  13844. }
  13845. cipher = new ARCFourCipher(derivedKey);
  13846. userPassword = cipher.encryptBlock(userPassword);
  13847. }
  13848. } else {
  13849. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  13850. userPassword = cipher.encryptBlock(ownerPassword);
  13851. }
  13852. return userPassword;
  13853. }
  13854. var identityName = _primitives.Name.get("Identity");
  13855. function CipherTransformFactory(dict, fileId, password) {
  13856. var filter = dict.get("Filter");
  13857. if (!(0, _primitives.isName)(filter, "Standard")) {
  13858. throw new _util.FormatError("unknown encryption method");
  13859. }
  13860. this.dict = dict;
  13861. var algorithm = dict.get("V");
  13862. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  13863. throw new _util.FormatError("unsupported encryption algorithm");
  13864. }
  13865. this.algorithm = algorithm;
  13866. var keyLength = dict.get("Length");
  13867. if (!keyLength) {
  13868. if (algorithm <= 3) {
  13869. keyLength = 40;
  13870. } else {
  13871. var cfDict = dict.get("CF");
  13872. var streamCryptoName = dict.get("StmF");
  13873. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  13874. cfDict.suppressEncryption = true;
  13875. var handlerDict = cfDict.get(streamCryptoName.name);
  13876. keyLength = handlerDict && handlerDict.get("Length") || 128;
  13877. if (keyLength < 40) {
  13878. keyLength <<= 3;
  13879. }
  13880. }
  13881. }
  13882. }
  13883. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  13884. throw new _util.FormatError("invalid key length");
  13885. }
  13886. var ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  13887. var userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  13888. var flags = dict.get("P");
  13889. var revision = dict.get("R");
  13890. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  13891. this.encryptMetadata = encryptMetadata;
  13892. var fileIdBytes = (0, _util.stringToBytes)(fileId);
  13893. var passwordBytes;
  13894. if (password) {
  13895. if (revision === 6) {
  13896. try {
  13897. password = (0, _util.utf8StringToString)(password);
  13898. } catch (ex) {
  13899. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  13900. }
  13901. }
  13902. passwordBytes = (0, _util.stringToBytes)(password);
  13903. }
  13904. var encryptionKey;
  13905. if (algorithm !== 5) {
  13906. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  13907. } else {
  13908. var ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  13909. var ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  13910. var uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  13911. var userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  13912. var userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  13913. var ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  13914. var userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  13915. var perms = (0, _util.stringToBytes)(dict.get("Perms"));
  13916. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  13917. }
  13918. if (!encryptionKey && !password) {
  13919. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  13920. } else if (!encryptionKey && password) {
  13921. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  13922. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  13923. }
  13924. if (!encryptionKey) {
  13925. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  13926. }
  13927. this.encryptionKey = encryptionKey;
  13928. if (algorithm >= 4) {
  13929. var cf = dict.get("CF");
  13930. if ((0, _primitives.isDict)(cf)) {
  13931. cf.suppressEncryption = true;
  13932. }
  13933. this.cf = cf;
  13934. this.stmf = dict.get("StmF") || identityName;
  13935. this.strf = dict.get("StrF") || identityName;
  13936. this.eff = dict.get("EFF") || this.stmf;
  13937. }
  13938. }
  13939. function buildObjectKey(num, gen, encryptionKey, isAes) {
  13940. var key = new Uint8Array(encryptionKey.length + 9),
  13941. i,
  13942. n;
  13943. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  13944. key[i] = encryptionKey[i];
  13945. }
  13946. key[i++] = num & 0xff;
  13947. key[i++] = num >> 8 & 0xff;
  13948. key[i++] = num >> 16 & 0xff;
  13949. key[i++] = gen & 0xff;
  13950. key[i++] = gen >> 8 & 0xff;
  13951. if (isAes) {
  13952. key[i++] = 0x73;
  13953. key[i++] = 0x41;
  13954. key[i++] = 0x6c;
  13955. key[i++] = 0x54;
  13956. }
  13957. var hash = calculateMD5(key, 0, i);
  13958. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  13959. }
  13960. function buildCipherConstructor(cf, name, num, gen, key) {
  13961. if (!(0, _primitives.isName)(name)) {
  13962. throw new _util.FormatError("Invalid crypt filter name.");
  13963. }
  13964. var cryptFilter = cf.get(name.name);
  13965. var cfm;
  13966. if (cryptFilter !== null && cryptFilter !== undefined) {
  13967. cfm = cryptFilter.get("CFM");
  13968. }
  13969. if (!cfm || cfm.name === "None") {
  13970. return function cipherTransformFactoryBuildCipherConstructorNone() {
  13971. return new NullCipher();
  13972. };
  13973. }
  13974. if (cfm.name === "V2") {
  13975. return function cipherTransformFactoryBuildCipherConstructorV2() {
  13976. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  13977. };
  13978. }
  13979. if (cfm.name === "AESV2") {
  13980. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  13981. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  13982. };
  13983. }
  13984. if (cfm.name === "AESV3") {
  13985. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  13986. return new AES256Cipher(key);
  13987. };
  13988. }
  13989. throw new _util.FormatError("Unknown crypto method");
  13990. }
  13991. CipherTransformFactory.prototype = {
  13992. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  13993. if (this.algorithm === 4 || this.algorithm === 5) {
  13994. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  13995. }
  13996. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  13997. var cipherConstructor = function buildCipherCipherConstructor() {
  13998. return new ARCFourCipher(key);
  13999. };
  14000. return new CipherTransform(cipherConstructor, cipherConstructor);
  14001. }
  14002. };
  14003. return CipherTransformFactory;
  14004. }();
  14005. exports.CipherTransformFactory = CipherTransformFactory;
  14006. /***/ }),
  14007. /* 22 */
  14008. /***/ (function(module, exports, __w_pdfjs_require__) {
  14009. "use strict";
  14010. Object.defineProperty(exports, "__esModule", {
  14011. value: true
  14012. });
  14013. exports.ColorSpace = void 0;
  14014. var _util = __w_pdfjs_require__(2);
  14015. var _primitives = __w_pdfjs_require__(4);
  14016. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  14017. const COMPONENTS = 3;
  14018. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  14019. const xRatio = w1 / w2;
  14020. const yRatio = h1 / h2;
  14021. let newIndex = 0,
  14022. oldIndex;
  14023. const xScaled = new Uint16Array(w2);
  14024. const w1Scanline = w1 * COMPONENTS;
  14025. for (let i = 0; i < w2; i++) {
  14026. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  14027. }
  14028. for (let i = 0; i < h2; i++) {
  14029. const py = Math.floor(i * yRatio) * w1Scanline;
  14030. for (let j = 0; j < w2; j++) {
  14031. oldIndex = py + xScaled[j];
  14032. dest[newIndex++] = src[oldIndex++];
  14033. dest[newIndex++] = src[oldIndex++];
  14034. dest[newIndex++] = src[oldIndex++];
  14035. newIndex += alpha01;
  14036. }
  14037. }
  14038. }
  14039. class ColorSpace {
  14040. constructor(name, numComps) {
  14041. if (this.constructor === ColorSpace) {
  14042. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  14043. }
  14044. this.name = name;
  14045. this.numComps = numComps;
  14046. }
  14047. getRgb(src, srcOffset) {
  14048. const rgb = new Uint8ClampedArray(3);
  14049. this.getRgbItem(src, srcOffset, rgb, 0);
  14050. return rgb;
  14051. }
  14052. getRgbItem(src, srcOffset, dest, destOffset) {
  14053. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  14054. }
  14055. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14056. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  14057. }
  14058. getOutputLength(inputLength, alpha01) {
  14059. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  14060. }
  14061. isPassthrough(bits) {
  14062. return false;
  14063. }
  14064. isDefaultDecode(decodeMap, bpc) {
  14065. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  14066. }
  14067. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  14068. const count = originalWidth * originalHeight;
  14069. let rgbBuf = null;
  14070. const numComponentColors = 1 << bpc;
  14071. const needsResizing = originalHeight !== height || originalWidth !== width;
  14072. if (this.isPassthrough(bpc)) {
  14073. rgbBuf = comps;
  14074. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  14075. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  14076. for (let i = 0; i < numComponentColors; i++) {
  14077. allColors[i] = i;
  14078. }
  14079. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  14080. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  14081. if (!needsResizing) {
  14082. let destPos = 0;
  14083. for (let i = 0; i < count; ++i) {
  14084. const key = comps[i] * 3;
  14085. dest[destPos++] = colorMap[key];
  14086. dest[destPos++] = colorMap[key + 1];
  14087. dest[destPos++] = colorMap[key + 2];
  14088. destPos += alpha01;
  14089. }
  14090. } else {
  14091. rgbBuf = new Uint8Array(count * 3);
  14092. let rgbPos = 0;
  14093. for (let i = 0; i < count; ++i) {
  14094. const key = comps[i] * 3;
  14095. rgbBuf[rgbPos++] = colorMap[key];
  14096. rgbBuf[rgbPos++] = colorMap[key + 1];
  14097. rgbBuf[rgbPos++] = colorMap[key + 2];
  14098. }
  14099. }
  14100. } else {
  14101. if (!needsResizing) {
  14102. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  14103. } else {
  14104. rgbBuf = new Uint8ClampedArray(count * 3);
  14105. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  14106. }
  14107. }
  14108. if (rgbBuf) {
  14109. if (needsResizing) {
  14110. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  14111. } else {
  14112. let destPos = 0,
  14113. rgbPos = 0;
  14114. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  14115. dest[destPos++] = rgbBuf[rgbPos++];
  14116. dest[destPos++] = rgbBuf[rgbPos++];
  14117. dest[destPos++] = rgbBuf[rgbPos++];
  14118. destPos += alpha01;
  14119. }
  14120. }
  14121. }
  14122. }
  14123. get usesZeroToOneRange() {
  14124. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  14125. }
  14126. static parse(cs, xref, res, pdfFunctionFactory) {
  14127. const IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
  14128. return this.fromIR(IR);
  14129. }
  14130. static fromIR(IR) {
  14131. const name = Array.isArray(IR) ? IR[0] : IR;
  14132. let whitePoint, blackPoint, gamma;
  14133. switch (name) {
  14134. case "DeviceGrayCS":
  14135. return this.singletons.gray;
  14136. case "DeviceRgbCS":
  14137. return this.singletons.rgb;
  14138. case "DeviceCmykCS":
  14139. return this.singletons.cmyk;
  14140. case "CalGrayCS":
  14141. whitePoint = IR[1];
  14142. blackPoint = IR[2];
  14143. gamma = IR[3];
  14144. return new CalGrayCS(whitePoint, blackPoint, gamma);
  14145. case "CalRGBCS":
  14146. whitePoint = IR[1];
  14147. blackPoint = IR[2];
  14148. gamma = IR[3];
  14149. const matrix = IR[4];
  14150. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  14151. case "PatternCS":
  14152. let basePatternCS = IR[1];
  14153. if (basePatternCS) {
  14154. basePatternCS = this.fromIR(basePatternCS);
  14155. }
  14156. return new PatternCS(basePatternCS);
  14157. case "IndexedCS":
  14158. const baseIndexedCS = IR[1];
  14159. const hiVal = IR[2];
  14160. const lookup = IR[3];
  14161. return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
  14162. case "AlternateCS":
  14163. const numComps = IR[1];
  14164. const alt = IR[2];
  14165. const tintFn = IR[3];
  14166. return new AlternateCS(numComps, this.fromIR(alt), tintFn);
  14167. case "LabCS":
  14168. whitePoint = IR[1];
  14169. blackPoint = IR[2];
  14170. const range = IR[3];
  14171. return new LabCS(whitePoint, blackPoint, range);
  14172. default:
  14173. throw new _util.FormatError(`Unknown colorspace name: ${name}`);
  14174. }
  14175. }
  14176. static parseToIR(cs, xref, res = null, pdfFunctionFactory) {
  14177. cs = xref.fetchIfRef(cs);
  14178. if ((0, _primitives.isName)(cs)) {
  14179. switch (cs.name) {
  14180. case "DeviceGray":
  14181. case "G":
  14182. return "DeviceGrayCS";
  14183. case "DeviceRGB":
  14184. case "RGB":
  14185. return "DeviceRgbCS";
  14186. case "DeviceCMYK":
  14187. case "CMYK":
  14188. return "DeviceCmykCS";
  14189. case "Pattern":
  14190. return ["PatternCS", null];
  14191. default:
  14192. if ((0, _primitives.isDict)(res)) {
  14193. const colorSpaces = res.get("ColorSpace");
  14194. if ((0, _primitives.isDict)(colorSpaces)) {
  14195. const resCS = colorSpaces.get(cs.name);
  14196. if (resCS) {
  14197. if ((0, _primitives.isName)(resCS)) {
  14198. return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
  14199. }
  14200. cs = resCS;
  14201. break;
  14202. }
  14203. }
  14204. }
  14205. throw new _util.FormatError(`unrecognized colorspace ${cs.name}`);
  14206. }
  14207. }
  14208. if (Array.isArray(cs)) {
  14209. const mode = xref.fetchIfRef(cs[0]).name;
  14210. let numComps, params, alt, whitePoint, blackPoint, gamma;
  14211. switch (mode) {
  14212. case "DeviceGray":
  14213. case "G":
  14214. return "DeviceGrayCS";
  14215. case "DeviceRGB":
  14216. case "RGB":
  14217. return "DeviceRgbCS";
  14218. case "DeviceCMYK":
  14219. case "CMYK":
  14220. return "DeviceCmykCS";
  14221. case "CalGray":
  14222. params = xref.fetchIfRef(cs[1]);
  14223. whitePoint = params.getArray("WhitePoint");
  14224. blackPoint = params.getArray("BlackPoint");
  14225. gamma = params.get("Gamma");
  14226. return ["CalGrayCS", whitePoint, blackPoint, gamma];
  14227. case "CalRGB":
  14228. params = xref.fetchIfRef(cs[1]);
  14229. whitePoint = params.getArray("WhitePoint");
  14230. blackPoint = params.getArray("BlackPoint");
  14231. gamma = params.getArray("Gamma");
  14232. const matrix = params.getArray("Matrix");
  14233. return ["CalRGBCS", whitePoint, blackPoint, gamma, matrix];
  14234. case "ICCBased":
  14235. const stream = xref.fetchIfRef(cs[1]);
  14236. const dict = stream.dict;
  14237. numComps = dict.get("N");
  14238. alt = dict.get("Alternate");
  14239. if (alt) {
  14240. const altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
  14241. const altCS = this.fromIR(altIR, pdfFunctionFactory);
  14242. if (altCS.numComps === numComps) {
  14243. return altIR;
  14244. }
  14245. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  14246. }
  14247. if (numComps === 1) {
  14248. return "DeviceGrayCS";
  14249. } else if (numComps === 3) {
  14250. return "DeviceRgbCS";
  14251. } else if (numComps === 4) {
  14252. return "DeviceCmykCS";
  14253. }
  14254. break;
  14255. case "Pattern":
  14256. let basePatternCS = cs[1] || null;
  14257. if (basePatternCS) {
  14258. basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);
  14259. }
  14260. return ["PatternCS", basePatternCS];
  14261. case "Indexed":
  14262. case "I":
  14263. const baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);
  14264. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  14265. let lookup = xref.fetchIfRef(cs[3]);
  14266. if ((0, _primitives.isStream)(lookup)) {
  14267. lookup = lookup.getBytes();
  14268. }
  14269. return ["IndexedCS", baseIndexedCS, hiVal, lookup];
  14270. case "Separation":
  14271. case "DeviceN":
  14272. const name = xref.fetchIfRef(cs[1]);
  14273. numComps = Array.isArray(name) ? name.length : 1;
  14274. alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
  14275. const tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
  14276. return ["AlternateCS", numComps, alt, tintFn];
  14277. case "Lab":
  14278. params = xref.fetchIfRef(cs[1]);
  14279. whitePoint = params.getArray("WhitePoint");
  14280. blackPoint = params.getArray("BlackPoint");
  14281. const range = params.getArray("Range");
  14282. return ["LabCS", whitePoint, blackPoint, range];
  14283. default:
  14284. throw new _util.FormatError(`unimplemented color space object "${mode}"`);
  14285. }
  14286. }
  14287. throw new _util.FormatError(`unrecognized color space object: "${cs}"`);
  14288. }
  14289. static isDefaultDecode(decode, numComps) {
  14290. if (!Array.isArray(decode)) {
  14291. return true;
  14292. }
  14293. if (numComps * 2 !== decode.length) {
  14294. (0, _util.warn)("The decode map is not the correct length");
  14295. return true;
  14296. }
  14297. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  14298. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  14299. return false;
  14300. }
  14301. }
  14302. return true;
  14303. }
  14304. static get singletons() {
  14305. return (0, _util.shadow)(this, "singletons", {
  14306. get gray() {
  14307. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  14308. },
  14309. get rgb() {
  14310. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  14311. },
  14312. get cmyk() {
  14313. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  14314. }
  14315. });
  14316. }
  14317. }
  14318. exports.ColorSpace = ColorSpace;
  14319. class AlternateCS extends ColorSpace {
  14320. constructor(numComps, base, tintFn) {
  14321. super("Alternate", numComps);
  14322. this.base = base;
  14323. this.tintFn = tintFn;
  14324. this.tmpBuf = new Float32Array(base.numComps);
  14325. }
  14326. getRgbItem(src, srcOffset, dest, destOffset) {
  14327. const tmpBuf = this.tmpBuf;
  14328. this.tintFn(src, srcOffset, tmpBuf, 0);
  14329. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  14330. }
  14331. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14332. const tintFn = this.tintFn;
  14333. const base = this.base;
  14334. const scale = 1 / ((1 << bits) - 1);
  14335. const baseNumComps = base.numComps;
  14336. const usesZeroToOneRange = base.usesZeroToOneRange;
  14337. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  14338. let pos = isPassthrough ? destOffset : 0;
  14339. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  14340. const numComps = this.numComps;
  14341. const scaled = new Float32Array(numComps);
  14342. const tinted = new Float32Array(baseNumComps);
  14343. let i, j;
  14344. for (i = 0; i < count; i++) {
  14345. for (j = 0; j < numComps; j++) {
  14346. scaled[j] = src[srcOffset++] * scale;
  14347. }
  14348. tintFn(scaled, 0, tinted, 0);
  14349. if (usesZeroToOneRange) {
  14350. for (j = 0; j < baseNumComps; j++) {
  14351. baseBuf[pos++] = tinted[j] * 255;
  14352. }
  14353. } else {
  14354. base.getRgbItem(tinted, 0, baseBuf, pos);
  14355. pos += baseNumComps;
  14356. }
  14357. }
  14358. if (!isPassthrough) {
  14359. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  14360. }
  14361. }
  14362. getOutputLength(inputLength, alpha01) {
  14363. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  14364. }
  14365. }
  14366. class PatternCS extends ColorSpace {
  14367. constructor(baseCS) {
  14368. super("Pattern", null);
  14369. this.base = baseCS;
  14370. }
  14371. isDefaultDecode(decodeMap, bpc) {
  14372. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  14373. }
  14374. }
  14375. class IndexedCS extends ColorSpace {
  14376. constructor(base, highVal, lookup) {
  14377. super("Indexed", 1);
  14378. this.base = base;
  14379. this.highVal = highVal;
  14380. const baseNumComps = base.numComps;
  14381. const length = baseNumComps * highVal;
  14382. if ((0, _primitives.isStream)(lookup)) {
  14383. this.lookup = new Uint8Array(length);
  14384. const bytes = lookup.getBytes(length);
  14385. this.lookup.set(bytes);
  14386. } else if ((0, _util.isString)(lookup)) {
  14387. this.lookup = new Uint8Array(length);
  14388. for (let i = 0; i < length; ++i) {
  14389. this.lookup[i] = lookup.charCodeAt(i);
  14390. }
  14391. } else if (lookup instanceof Uint8Array) {
  14392. this.lookup = lookup;
  14393. } else {
  14394. throw new _util.FormatError(`Unrecognized lookup table: ${lookup}`);
  14395. }
  14396. }
  14397. getRgbItem(src, srcOffset, dest, destOffset) {
  14398. const numComps = this.base.numComps;
  14399. const start = src[srcOffset] * numComps;
  14400. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  14401. }
  14402. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14403. const base = this.base;
  14404. const numComps = base.numComps;
  14405. const outputDelta = base.getOutputLength(numComps, alpha01);
  14406. const lookup = this.lookup;
  14407. for (let i = 0; i < count; ++i) {
  14408. const lookupPos = src[srcOffset++] * numComps;
  14409. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  14410. destOffset += outputDelta;
  14411. }
  14412. }
  14413. getOutputLength(inputLength, alpha01) {
  14414. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  14415. }
  14416. isDefaultDecode(decodeMap, bpc) {
  14417. if (!Array.isArray(decodeMap)) {
  14418. return true;
  14419. }
  14420. if (decodeMap.length !== 2) {
  14421. (0, _util.warn)("Decode map length is not correct");
  14422. return true;
  14423. }
  14424. if (!Number.isInteger(bpc) || bpc < 1) {
  14425. (0, _util.warn)("Bits per component is not correct");
  14426. return true;
  14427. }
  14428. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  14429. }
  14430. }
  14431. class DeviceGrayCS extends ColorSpace {
  14432. constructor() {
  14433. super("DeviceGray", 1);
  14434. }
  14435. getRgbItem(src, srcOffset, dest, destOffset) {
  14436. const c = src[srcOffset] * 255;
  14437. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  14438. }
  14439. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14440. const scale = 255 / ((1 << bits) - 1);
  14441. let j = srcOffset,
  14442. q = destOffset;
  14443. for (let i = 0; i < count; ++i) {
  14444. const c = scale * src[j++];
  14445. dest[q++] = c;
  14446. dest[q++] = c;
  14447. dest[q++] = c;
  14448. q += alpha01;
  14449. }
  14450. }
  14451. getOutputLength(inputLength, alpha01) {
  14452. return inputLength * (3 + alpha01);
  14453. }
  14454. }
  14455. class DeviceRgbCS extends ColorSpace {
  14456. constructor() {
  14457. super("DeviceRGB", 3);
  14458. }
  14459. getRgbItem(src, srcOffset, dest, destOffset) {
  14460. dest[destOffset] = src[srcOffset] * 255;
  14461. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  14462. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  14463. }
  14464. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14465. if (bits === 8 && alpha01 === 0) {
  14466. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  14467. return;
  14468. }
  14469. const scale = 255 / ((1 << bits) - 1);
  14470. let j = srcOffset,
  14471. q = destOffset;
  14472. for (let i = 0; i < count; ++i) {
  14473. dest[q++] = scale * src[j++];
  14474. dest[q++] = scale * src[j++];
  14475. dest[q++] = scale * src[j++];
  14476. q += alpha01;
  14477. }
  14478. }
  14479. getOutputLength(inputLength, alpha01) {
  14480. return inputLength * (3 + alpha01) / 3 | 0;
  14481. }
  14482. isPassthrough(bits) {
  14483. return bits === 8;
  14484. }
  14485. }
  14486. const DeviceCmykCS = function DeviceCmykCSClosure() {
  14487. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  14488. const c = src[srcOffset] * srcScale;
  14489. const m = src[srcOffset + 1] * srcScale;
  14490. const y = src[srcOffset + 2] * srcScale;
  14491. const k = src[srcOffset + 3] * srcScale;
  14492. dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
  14493. dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
  14494. dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
  14495. }
  14496. class DeviceCmykCS extends ColorSpace {
  14497. constructor() {
  14498. super("DeviceCMYK", 4);
  14499. }
  14500. getRgbItem(src, srcOffset, dest, destOffset) {
  14501. convertToRgb(src, srcOffset, 1, dest, destOffset);
  14502. }
  14503. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14504. const scale = 1 / ((1 << bits) - 1);
  14505. for (let i = 0; i < count; i++) {
  14506. convertToRgb(src, srcOffset, scale, dest, destOffset);
  14507. srcOffset += 4;
  14508. destOffset += 3 + alpha01;
  14509. }
  14510. }
  14511. getOutputLength(inputLength, alpha01) {
  14512. return inputLength / 4 * (3 + alpha01) | 0;
  14513. }
  14514. }
  14515. return DeviceCmykCS;
  14516. }();
  14517. const CalGrayCS = function CalGrayCSClosure() {
  14518. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  14519. const A = src[srcOffset] * scale;
  14520. const AG = A ** cs.G;
  14521. const L = cs.YW * AG;
  14522. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  14523. dest[destOffset] = val;
  14524. dest[destOffset + 1] = val;
  14525. dest[destOffset + 2] = val;
  14526. }
  14527. class CalGrayCS extends ColorSpace {
  14528. constructor(whitePoint, blackPoint, gamma) {
  14529. super("CalGray", 1);
  14530. if (!whitePoint) {
  14531. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  14532. }
  14533. blackPoint = blackPoint || [0, 0, 0];
  14534. gamma = gamma || 1;
  14535. this.XW = whitePoint[0];
  14536. this.YW = whitePoint[1];
  14537. this.ZW = whitePoint[2];
  14538. this.XB = blackPoint[0];
  14539. this.YB = blackPoint[1];
  14540. this.ZB = blackPoint[2];
  14541. this.G = gamma;
  14542. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  14543. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  14544. }
  14545. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  14546. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  14547. this.XB = this.YB = this.ZB = 0;
  14548. }
  14549. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  14550. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  14551. }
  14552. if (this.G < 1) {
  14553. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  14554. this.G = 1;
  14555. }
  14556. }
  14557. getRgbItem(src, srcOffset, dest, destOffset) {
  14558. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  14559. }
  14560. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14561. const scale = 1 / ((1 << bits) - 1);
  14562. for (let i = 0; i < count; ++i) {
  14563. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  14564. srcOffset += 1;
  14565. destOffset += 3 + alpha01;
  14566. }
  14567. }
  14568. getOutputLength(inputLength, alpha01) {
  14569. return inputLength * (3 + alpha01);
  14570. }
  14571. }
  14572. return CalGrayCS;
  14573. }();
  14574. const CalRGBCS = function CalRGBCSClosure() {
  14575. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  14576. const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  14577. const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
  14578. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  14579. const tempNormalizeMatrix = new Float32Array(3);
  14580. const tempConvertMatrix1 = new Float32Array(3);
  14581. const tempConvertMatrix2 = new Float32Array(3);
  14582. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  14583. function matrixProduct(a, b, result) {
  14584. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  14585. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  14586. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  14587. }
  14588. function convertToFlat(sourceWhitePoint, LMS, result) {
  14589. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  14590. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  14591. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  14592. }
  14593. function convertToD65(sourceWhitePoint, LMS, result) {
  14594. const D65X = 0.95047;
  14595. const D65Y = 1;
  14596. const D65Z = 1.08883;
  14597. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  14598. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  14599. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  14600. }
  14601. function sRGBTransferFunction(color) {
  14602. if (color <= 0.0031308) {
  14603. return adjustToRange(0, 1, 12.92 * color);
  14604. }
  14605. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  14606. }
  14607. function adjustToRange(min, max, value) {
  14608. return Math.max(min, Math.min(max, value));
  14609. }
  14610. function decodeL(L) {
  14611. if (L < 0) {
  14612. return -decodeL(-L);
  14613. }
  14614. if (L > 8.0) {
  14615. return ((L + 16) / 116) ** 3;
  14616. }
  14617. return L * DECODE_L_CONSTANT;
  14618. }
  14619. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  14620. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  14621. result[0] = XYZ_Flat[0];
  14622. result[1] = XYZ_Flat[1];
  14623. result[2] = XYZ_Flat[2];
  14624. return;
  14625. }
  14626. const zeroDecodeL = decodeL(0);
  14627. const X_DST = zeroDecodeL;
  14628. const X_SRC = decodeL(sourceBlackPoint[0]);
  14629. const Y_DST = zeroDecodeL;
  14630. const Y_SRC = decodeL(sourceBlackPoint[1]);
  14631. const Z_DST = zeroDecodeL;
  14632. const Z_SRC = decodeL(sourceBlackPoint[2]);
  14633. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  14634. const X_Offset = 1 - X_Scale;
  14635. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  14636. const Y_Offset = 1 - Y_Scale;
  14637. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  14638. const Z_Offset = 1 - Z_Scale;
  14639. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  14640. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  14641. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  14642. }
  14643. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  14644. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  14645. result[0] = XYZ_In[0];
  14646. result[1] = XYZ_In[1];
  14647. result[2] = XYZ_In[2];
  14648. return;
  14649. }
  14650. const LMS = result;
  14651. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  14652. const LMS_Flat = tempNormalizeMatrix;
  14653. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  14654. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  14655. }
  14656. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  14657. const LMS = result;
  14658. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  14659. const LMS_D65 = tempNormalizeMatrix;
  14660. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  14661. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  14662. }
  14663. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  14664. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  14665. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  14666. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  14667. const AGR = A ** cs.GR;
  14668. const BGG = B ** cs.GG;
  14669. const CGB = C ** cs.GB;
  14670. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  14671. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  14672. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  14673. const XYZ = tempConvertMatrix1;
  14674. XYZ[0] = X;
  14675. XYZ[1] = Y;
  14676. XYZ[2] = Z;
  14677. const XYZ_Flat = tempConvertMatrix2;
  14678. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  14679. const XYZ_Black = tempConvertMatrix1;
  14680. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  14681. const XYZ_D65 = tempConvertMatrix2;
  14682. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  14683. const SRGB = tempConvertMatrix1;
  14684. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  14685. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  14686. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  14687. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  14688. }
  14689. class CalRGBCS extends ColorSpace {
  14690. constructor(whitePoint, blackPoint, gamma, matrix) {
  14691. super("CalRGB", 3);
  14692. if (!whitePoint) {
  14693. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  14694. }
  14695. blackPoint = blackPoint || new Float32Array(3);
  14696. gamma = gamma || new Float32Array([1, 1, 1]);
  14697. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  14698. const XW = whitePoint[0];
  14699. const YW = whitePoint[1];
  14700. const ZW = whitePoint[2];
  14701. this.whitePoint = whitePoint;
  14702. const XB = blackPoint[0];
  14703. const YB = blackPoint[1];
  14704. const ZB = blackPoint[2];
  14705. this.blackPoint = blackPoint;
  14706. this.GR = gamma[0];
  14707. this.GG = gamma[1];
  14708. this.GB = gamma[2];
  14709. this.MXA = matrix[0];
  14710. this.MYA = matrix[1];
  14711. this.MZA = matrix[2];
  14712. this.MXB = matrix[3];
  14713. this.MYB = matrix[4];
  14714. this.MZB = matrix[5];
  14715. this.MXC = matrix[6];
  14716. this.MYC = matrix[7];
  14717. this.MZC = matrix[8];
  14718. if (XW < 0 || ZW < 0 || YW !== 1) {
  14719. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  14720. }
  14721. if (XB < 0 || YB < 0 || ZB < 0) {
  14722. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  14723. this.blackPoint = new Float32Array(3);
  14724. }
  14725. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  14726. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  14727. this.GR = this.GG = this.GB = 1;
  14728. }
  14729. }
  14730. getRgbItem(src, srcOffset, dest, destOffset) {
  14731. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  14732. }
  14733. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14734. const scale = 1 / ((1 << bits) - 1);
  14735. for (let i = 0; i < count; ++i) {
  14736. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  14737. srcOffset += 3;
  14738. destOffset += 3 + alpha01;
  14739. }
  14740. }
  14741. getOutputLength(inputLength, alpha01) {
  14742. return inputLength * (3 + alpha01) / 3 | 0;
  14743. }
  14744. }
  14745. return CalRGBCS;
  14746. }();
  14747. const LabCS = function LabCSClosure() {
  14748. function fn_g(x) {
  14749. let result;
  14750. if (x >= 6 / 29) {
  14751. result = x * x * x;
  14752. } else {
  14753. result = 108 / 841 * (x - 4 / 29);
  14754. }
  14755. return result;
  14756. }
  14757. function decode(value, high1, low2, high2) {
  14758. return low2 + value * (high2 - low2) / high1;
  14759. }
  14760. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  14761. let Ls = src[srcOffset];
  14762. let as = src[srcOffset + 1];
  14763. let bs = src[srcOffset + 2];
  14764. if (maxVal !== false) {
  14765. Ls = decode(Ls, maxVal, 0, 100);
  14766. as = decode(as, maxVal, cs.amin, cs.amax);
  14767. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  14768. }
  14769. if (as > cs.amax) {
  14770. as = cs.amax;
  14771. } else if (as < cs.amin) {
  14772. as = cs.amin;
  14773. }
  14774. if (bs > cs.bmax) {
  14775. bs = cs.bmax;
  14776. } else if (bs < cs.bmin) {
  14777. bs = cs.bmin;
  14778. }
  14779. const M = (Ls + 16) / 116;
  14780. const L = M + as / 500;
  14781. const N = M - bs / 200;
  14782. const X = cs.XW * fn_g(L);
  14783. const Y = cs.YW * fn_g(M);
  14784. const Z = cs.ZW * fn_g(N);
  14785. let r, g, b;
  14786. if (cs.ZW < 1) {
  14787. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  14788. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  14789. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  14790. } else {
  14791. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  14792. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  14793. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  14794. }
  14795. dest[destOffset] = Math.sqrt(r) * 255;
  14796. dest[destOffset + 1] = Math.sqrt(g) * 255;
  14797. dest[destOffset + 2] = Math.sqrt(b) * 255;
  14798. }
  14799. class LabCS extends ColorSpace {
  14800. constructor(whitePoint, blackPoint, range) {
  14801. super("Lab", 3);
  14802. if (!whitePoint) {
  14803. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  14804. }
  14805. blackPoint = blackPoint || [0, 0, 0];
  14806. range = range || [-100, 100, -100, 100];
  14807. this.XW = whitePoint[0];
  14808. this.YW = whitePoint[1];
  14809. this.ZW = whitePoint[2];
  14810. this.amin = range[0];
  14811. this.amax = range[1];
  14812. this.bmin = range[2];
  14813. this.bmax = range[3];
  14814. this.XB = blackPoint[0];
  14815. this.YB = blackPoint[1];
  14816. this.ZB = blackPoint[2];
  14817. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  14818. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  14819. }
  14820. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  14821. (0, _util.info)("Invalid BlackPoint, falling back to default");
  14822. this.XB = this.YB = this.ZB = 0;
  14823. }
  14824. if (this.amin > this.amax || this.bmin > this.bmax) {
  14825. (0, _util.info)("Invalid Range, falling back to defaults");
  14826. this.amin = -100;
  14827. this.amax = 100;
  14828. this.bmin = -100;
  14829. this.bmax = 100;
  14830. }
  14831. }
  14832. getRgbItem(src, srcOffset, dest, destOffset) {
  14833. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  14834. }
  14835. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14836. const maxVal = (1 << bits) - 1;
  14837. for (let i = 0; i < count; i++) {
  14838. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  14839. srcOffset += 3;
  14840. destOffset += 3 + alpha01;
  14841. }
  14842. }
  14843. getOutputLength(inputLength, alpha01) {
  14844. return inputLength * (3 + alpha01) / 3 | 0;
  14845. }
  14846. isDefaultDecode(decodeMap, bpc) {
  14847. return true;
  14848. }
  14849. get usesZeroToOneRange() {
  14850. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  14851. }
  14852. }
  14853. return LabCS;
  14854. }();
  14855. /***/ }),
  14856. /* 23 */
  14857. /***/ (function(module, exports, __w_pdfjs_require__) {
  14858. "use strict";
  14859. Object.defineProperty(exports, "__esModule", {
  14860. value: true
  14861. });
  14862. exports.getQuadPoints = getQuadPoints;
  14863. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  14864. var _util = __w_pdfjs_require__(2);
  14865. var _obj = __w_pdfjs_require__(9);
  14866. var _primitives = __w_pdfjs_require__(4);
  14867. var _colorspace = __w_pdfjs_require__(22);
  14868. var _core_utils = __w_pdfjs_require__(7);
  14869. var _operator_list = __w_pdfjs_require__(24);
  14870. var _stream = __w_pdfjs_require__(11);
  14871. class AnnotationFactory {
  14872. static create(xref, ref, pdfManager, idFactory) {
  14873. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory]);
  14874. }
  14875. static _create(xref, ref, pdfManager, idFactory) {
  14876. const dict = xref.fetchIfRef(ref);
  14877. if (!(0, _primitives.isDict)(dict)) {
  14878. return undefined;
  14879. }
  14880. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  14881. let subtype = dict.get("Subtype");
  14882. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  14883. const parameters = {
  14884. xref,
  14885. dict,
  14886. subtype,
  14887. id,
  14888. pdfManager
  14889. };
  14890. switch (subtype) {
  14891. case "Link":
  14892. return new LinkAnnotation(parameters);
  14893. case "Text":
  14894. return new TextAnnotation(parameters);
  14895. case "Widget":
  14896. let fieldType = (0, _core_utils.getInheritableProperty)({
  14897. dict,
  14898. key: "FT"
  14899. });
  14900. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  14901. switch (fieldType) {
  14902. case "Tx":
  14903. return new TextWidgetAnnotation(parameters);
  14904. case "Btn":
  14905. return new ButtonWidgetAnnotation(parameters);
  14906. case "Ch":
  14907. return new ChoiceWidgetAnnotation(parameters);
  14908. }
  14909. (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type.");
  14910. return new WidgetAnnotation(parameters);
  14911. case "Popup":
  14912. return new PopupAnnotation(parameters);
  14913. case "FreeText":
  14914. return new FreeTextAnnotation(parameters);
  14915. case "Line":
  14916. return new LineAnnotation(parameters);
  14917. case "Square":
  14918. return new SquareAnnotation(parameters);
  14919. case "Circle":
  14920. return new CircleAnnotation(parameters);
  14921. case "PolyLine":
  14922. return new PolylineAnnotation(parameters);
  14923. case "Polygon":
  14924. return new PolygonAnnotation(parameters);
  14925. case "Caret":
  14926. return new CaretAnnotation(parameters);
  14927. case "Ink":
  14928. return new InkAnnotation(parameters);
  14929. case "Highlight":
  14930. return new HighlightAnnotation(parameters);
  14931. case "Underline":
  14932. return new UnderlineAnnotation(parameters);
  14933. case "Squiggly":
  14934. return new SquigglyAnnotation(parameters);
  14935. case "StrikeOut":
  14936. return new StrikeOutAnnotation(parameters);
  14937. case "Stamp":
  14938. return new StampAnnotation(parameters);
  14939. case "FileAttachment":
  14940. return new FileAttachmentAnnotation(parameters);
  14941. default:
  14942. if (!subtype) {
  14943. (0, _util.warn)("Annotation is missing the required /Subtype.");
  14944. } else {
  14945. (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation.");
  14946. }
  14947. return new Annotation(parameters);
  14948. }
  14949. }
  14950. }
  14951. exports.AnnotationFactory = AnnotationFactory;
  14952. function getQuadPoints(dict, rect) {
  14953. if (!dict.has("QuadPoints")) {
  14954. return null;
  14955. }
  14956. const quadPoints = dict.getArray("QuadPoints");
  14957. if (!Array.isArray(quadPoints) || quadPoints.length % 8 > 0) {
  14958. return null;
  14959. }
  14960. const quadPointsLists = [];
  14961. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  14962. quadPointsLists.push([]);
  14963. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  14964. const x = quadPoints[j];
  14965. const y = quadPoints[j + 1];
  14966. if (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3]) {
  14967. return null;
  14968. }
  14969. quadPointsLists[i].push({
  14970. x,
  14971. y
  14972. });
  14973. }
  14974. }
  14975. return quadPointsLists;
  14976. }
  14977. function getTransformMatrix(rect, bbox, matrix) {
  14978. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  14979. if (minX === maxX || minY === maxY) {
  14980. return [1, 0, 0, 1, rect[0], rect[1]];
  14981. }
  14982. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  14983. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  14984. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  14985. }
  14986. class Annotation {
  14987. constructor(params) {
  14988. const dict = params.dict;
  14989. this.setContents(dict.get("Contents"));
  14990. this.setModificationDate(dict.get("M"));
  14991. this.setFlags(dict.get("F"));
  14992. this.setRectangle(dict.getArray("Rect"));
  14993. this.setColor(dict.getArray("C"));
  14994. this.setBorderStyle(dict);
  14995. this.setAppearance(dict);
  14996. this.data = {
  14997. annotationFlags: this.flags,
  14998. borderStyle: this.borderStyle,
  14999. color: this.color,
  15000. contents: this.contents,
  15001. hasAppearance: !!this.appearance,
  15002. id: params.id,
  15003. modificationDate: this.modificationDate,
  15004. rect: this.rectangle,
  15005. subtype: params.subtype
  15006. };
  15007. }
  15008. _hasFlag(flags, flag) {
  15009. return !!(flags & flag);
  15010. }
  15011. _isViewable(flags) {
  15012. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  15013. }
  15014. _isPrintable(flags) {
  15015. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
  15016. }
  15017. get viewable() {
  15018. if (this.flags === 0) {
  15019. return true;
  15020. }
  15021. return this._isViewable(this.flags);
  15022. }
  15023. get printable() {
  15024. if (this.flags === 0) {
  15025. return false;
  15026. }
  15027. return this._isPrintable(this.flags);
  15028. }
  15029. setContents(contents) {
  15030. this.contents = (0, _util.stringToPDFString)(contents || "");
  15031. }
  15032. setModificationDate(modificationDate) {
  15033. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  15034. }
  15035. setFlags(flags) {
  15036. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  15037. }
  15038. hasFlag(flag) {
  15039. return this._hasFlag(this.flags, flag);
  15040. }
  15041. setRectangle(rectangle) {
  15042. if (Array.isArray(rectangle) && rectangle.length === 4) {
  15043. this.rectangle = _util.Util.normalizeRect(rectangle);
  15044. } else {
  15045. this.rectangle = [0, 0, 0, 0];
  15046. }
  15047. }
  15048. setColor(color) {
  15049. const rgbColor = new Uint8ClampedArray(3);
  15050. if (!Array.isArray(color)) {
  15051. this.color = rgbColor;
  15052. return;
  15053. }
  15054. switch (color.length) {
  15055. case 0:
  15056. this.color = null;
  15057. break;
  15058. case 1:
  15059. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  15060. this.color = rgbColor;
  15061. break;
  15062. case 3:
  15063. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  15064. this.color = rgbColor;
  15065. break;
  15066. case 4:
  15067. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  15068. this.color = rgbColor;
  15069. break;
  15070. default:
  15071. this.color = rgbColor;
  15072. break;
  15073. }
  15074. }
  15075. setBorderStyle(borderStyle) {
  15076. this.borderStyle = new AnnotationBorderStyle();
  15077. if (!(0, _primitives.isDict)(borderStyle)) {
  15078. return;
  15079. }
  15080. if (borderStyle.has("BS")) {
  15081. const dict = borderStyle.get("BS");
  15082. const dictType = dict.get("Type");
  15083. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  15084. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  15085. this.borderStyle.setStyle(dict.get("S"));
  15086. this.borderStyle.setDashArray(dict.getArray("D"));
  15087. }
  15088. } else if (borderStyle.has("Border")) {
  15089. const array = borderStyle.getArray("Border");
  15090. if (Array.isArray(array) && array.length >= 3) {
  15091. this.borderStyle.setHorizontalCornerRadius(array[0]);
  15092. this.borderStyle.setVerticalCornerRadius(array[1]);
  15093. this.borderStyle.setWidth(array[2], this.rectangle);
  15094. if (array.length === 4) {
  15095. this.borderStyle.setDashArray(array[3]);
  15096. }
  15097. }
  15098. } else {
  15099. this.borderStyle.setWidth(0);
  15100. }
  15101. }
  15102. setAppearance(dict) {
  15103. this.appearance = null;
  15104. const appearanceStates = dict.get("AP");
  15105. if (!(0, _primitives.isDict)(appearanceStates)) {
  15106. return;
  15107. }
  15108. const normalAppearanceState = appearanceStates.get("N");
  15109. if ((0, _primitives.isStream)(normalAppearanceState)) {
  15110. this.appearance = normalAppearanceState;
  15111. return;
  15112. }
  15113. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  15114. return;
  15115. }
  15116. const as = dict.get("AS");
  15117. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  15118. return;
  15119. }
  15120. this.appearance = normalAppearanceState.get(as.name);
  15121. }
  15122. loadResources(keys) {
  15123. return this.appearance.dict.getAsync("Resources").then(resources => {
  15124. if (!resources) {
  15125. return undefined;
  15126. }
  15127. const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
  15128. return objectLoader.load().then(function () {
  15129. return resources;
  15130. });
  15131. });
  15132. }
  15133. getOperatorList(evaluator, task, renderForms) {
  15134. if (!this.appearance) {
  15135. return Promise.resolve(new _operator_list.OperatorList());
  15136. }
  15137. const data = this.data;
  15138. const appearanceDict = this.appearance.dict;
  15139. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  15140. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  15141. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  15142. const transform = getTransformMatrix(data.rect, bbox, matrix);
  15143. return resourcesPromise.then(resources => {
  15144. const opList = new _operator_list.OperatorList();
  15145. opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
  15146. return evaluator.getOperatorList({
  15147. stream: this.appearance,
  15148. task,
  15149. resources,
  15150. operatorList: opList
  15151. }).then(() => {
  15152. opList.addOp(_util.OPS.endAnnotation, []);
  15153. this.appearance.reset();
  15154. return opList;
  15155. });
  15156. });
  15157. }
  15158. }
  15159. exports.Annotation = Annotation;
  15160. class AnnotationBorderStyle {
  15161. constructor() {
  15162. this.width = 1;
  15163. this.style = _util.AnnotationBorderStyleType.SOLID;
  15164. this.dashArray = [3];
  15165. this.horizontalCornerRadius = 0;
  15166. this.verticalCornerRadius = 0;
  15167. }
  15168. setWidth(width, rect = [0, 0, 0, 0]) {
  15169. if ((0, _primitives.isName)(width)) {
  15170. this.width = 0;
  15171. return;
  15172. }
  15173. if (Number.isInteger(width)) {
  15174. if (width > 0) {
  15175. const maxWidth = (rect[2] - rect[0]) / 2;
  15176. const maxHeight = (rect[3] - rect[1]) / 2;
  15177. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  15178. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  15179. width = 1;
  15180. }
  15181. }
  15182. this.width = width;
  15183. }
  15184. }
  15185. setStyle(style) {
  15186. if (!(0, _primitives.isName)(style)) {
  15187. return;
  15188. }
  15189. switch (style.name) {
  15190. case "S":
  15191. this.style = _util.AnnotationBorderStyleType.SOLID;
  15192. break;
  15193. case "D":
  15194. this.style = _util.AnnotationBorderStyleType.DASHED;
  15195. break;
  15196. case "B":
  15197. this.style = _util.AnnotationBorderStyleType.BEVELED;
  15198. break;
  15199. case "I":
  15200. this.style = _util.AnnotationBorderStyleType.INSET;
  15201. break;
  15202. case "U":
  15203. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  15204. break;
  15205. default:
  15206. break;
  15207. }
  15208. }
  15209. setDashArray(dashArray) {
  15210. if (Array.isArray(dashArray) && dashArray.length > 0) {
  15211. let isValid = true;
  15212. let allZeros = true;
  15213. for (const element of dashArray) {
  15214. const validNumber = +element >= 0;
  15215. if (!validNumber) {
  15216. isValid = false;
  15217. break;
  15218. } else if (element > 0) {
  15219. allZeros = false;
  15220. }
  15221. }
  15222. if (isValid && !allZeros) {
  15223. this.dashArray = dashArray;
  15224. } else {
  15225. this.width = 0;
  15226. }
  15227. } else if (dashArray) {
  15228. this.width = 0;
  15229. }
  15230. }
  15231. setHorizontalCornerRadius(radius) {
  15232. if (Number.isInteger(radius)) {
  15233. this.horizontalCornerRadius = radius;
  15234. }
  15235. }
  15236. setVerticalCornerRadius(radius) {
  15237. if (Number.isInteger(radius)) {
  15238. this.verticalCornerRadius = radius;
  15239. }
  15240. }
  15241. }
  15242. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  15243. class MarkupAnnotation extends Annotation {
  15244. constructor(parameters) {
  15245. super(parameters);
  15246. const dict = parameters.dict;
  15247. if (dict.has("IRT")) {
  15248. const rawIRT = dict.getRaw("IRT");
  15249. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  15250. const rt = dict.get("RT");
  15251. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  15252. }
  15253. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  15254. const parent = dict.get("IRT");
  15255. this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
  15256. this.setContents(parent.get("Contents"));
  15257. this.data.contents = this.contents;
  15258. if (!parent.has("CreationDate")) {
  15259. this.data.creationDate = null;
  15260. } else {
  15261. this.setCreationDate(parent.get("CreationDate"));
  15262. this.data.creationDate = this.creationDate;
  15263. }
  15264. if (!parent.has("M")) {
  15265. this.data.modificationDate = null;
  15266. } else {
  15267. this.setModificationDate(parent.get("M"));
  15268. this.data.modificationDate = this.modificationDate;
  15269. }
  15270. this.data.hasPopup = parent.has("Popup");
  15271. if (!parent.has("C")) {
  15272. this.data.color = null;
  15273. } else {
  15274. this.setColor(parent.getArray("C"));
  15275. this.data.color = this.color;
  15276. }
  15277. } else {
  15278. this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
  15279. this.setCreationDate(dict.get("CreationDate"));
  15280. this.data.creationDate = this.creationDate;
  15281. this.data.hasPopup = dict.has("Popup");
  15282. if (!dict.has("C")) {
  15283. this.data.color = null;
  15284. }
  15285. }
  15286. }
  15287. setCreationDate(creationDate) {
  15288. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  15289. }
  15290. }
  15291. exports.MarkupAnnotation = MarkupAnnotation;
  15292. class WidgetAnnotation extends Annotation {
  15293. constructor(params) {
  15294. super(params);
  15295. const dict = params.dict;
  15296. const data = this.data;
  15297. data.annotationType = _util.AnnotationType.WIDGET;
  15298. data.fieldName = this._constructFieldName(dict);
  15299. data.fieldValue = (0, _core_utils.getInheritableProperty)({
  15300. dict,
  15301. key: "V",
  15302. getArray: true
  15303. });
  15304. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  15305. data.defaultAppearance = (0, _core_utils.getInheritableProperty)({
  15306. dict,
  15307. key: "DA"
  15308. }) || "";
  15309. const fieldType = (0, _core_utils.getInheritableProperty)({
  15310. dict,
  15311. key: "FT"
  15312. });
  15313. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  15314. this.fieldResources = (0, _core_utils.getInheritableProperty)({
  15315. dict,
  15316. key: "DR"
  15317. }) || _primitives.Dict.empty;
  15318. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  15319. dict,
  15320. key: "Ff"
  15321. });
  15322. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  15323. data.fieldFlags = 0;
  15324. }
  15325. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  15326. if (data.fieldType === "Sig") {
  15327. data.fieldValue = null;
  15328. this.setFlags(_util.AnnotationFlag.HIDDEN);
  15329. }
  15330. }
  15331. _constructFieldName(dict) {
  15332. if (!dict.has("T") && !dict.has("Parent")) {
  15333. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  15334. return "";
  15335. }
  15336. if (!dict.has("Parent")) {
  15337. return (0, _util.stringToPDFString)(dict.get("T"));
  15338. }
  15339. const fieldName = [];
  15340. if (dict.has("T")) {
  15341. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  15342. }
  15343. let loopDict = dict;
  15344. while (loopDict.has("Parent")) {
  15345. loopDict = loopDict.get("Parent");
  15346. if (!(0, _primitives.isDict)(loopDict)) {
  15347. break;
  15348. }
  15349. if (loopDict.has("T")) {
  15350. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  15351. }
  15352. }
  15353. return fieldName.join(".");
  15354. }
  15355. hasFieldFlag(flag) {
  15356. return !!(this.data.fieldFlags & flag);
  15357. }
  15358. getOperatorList(evaluator, task, renderForms) {
  15359. if (renderForms) {
  15360. return Promise.resolve(new _operator_list.OperatorList());
  15361. }
  15362. return super.getOperatorList(evaluator, task, renderForms);
  15363. }
  15364. }
  15365. class TextWidgetAnnotation extends WidgetAnnotation {
  15366. constructor(params) {
  15367. super(params);
  15368. const dict = params.dict;
  15369. this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || "");
  15370. let alignment = (0, _core_utils.getInheritableProperty)({
  15371. dict,
  15372. key: "Q"
  15373. });
  15374. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  15375. alignment = null;
  15376. }
  15377. this.data.textAlignment = alignment;
  15378. let maximumLength = (0, _core_utils.getInheritableProperty)({
  15379. dict,
  15380. key: "MaxLen"
  15381. });
  15382. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  15383. maximumLength = null;
  15384. }
  15385. this.data.maxLen = maximumLength;
  15386. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  15387. this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  15388. }
  15389. getOperatorList(evaluator, task, renderForms) {
  15390. if (renderForms || this.appearance) {
  15391. return super.getOperatorList(evaluator, task, renderForms);
  15392. }
  15393. const operatorList = new _operator_list.OperatorList();
  15394. if (!this.data.defaultAppearance) {
  15395. return Promise.resolve(operatorList);
  15396. }
  15397. const stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
  15398. return evaluator.getOperatorList({
  15399. stream,
  15400. task,
  15401. resources: this.fieldResources,
  15402. operatorList
  15403. }).then(function () {
  15404. return operatorList;
  15405. });
  15406. }
  15407. }
  15408. class ButtonWidgetAnnotation extends WidgetAnnotation {
  15409. constructor(params) {
  15410. super(params);
  15411. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  15412. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  15413. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  15414. if (this.data.checkBox) {
  15415. this._processCheckBox(params);
  15416. } else if (this.data.radioButton) {
  15417. this._processRadioButton(params);
  15418. } else if (this.data.pushButton) {
  15419. this._processPushButton(params);
  15420. } else {
  15421. (0, _util.warn)("Invalid field flags for button widget annotation");
  15422. }
  15423. }
  15424. _processCheckBox(params) {
  15425. if ((0, _primitives.isName)(this.data.fieldValue)) {
  15426. this.data.fieldValue = this.data.fieldValue.name;
  15427. }
  15428. const customAppearance = params.dict.get("AP");
  15429. if (!(0, _primitives.isDict)(customAppearance)) {
  15430. return;
  15431. }
  15432. const exportValueOptionsDict = customAppearance.get("D");
  15433. if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
  15434. return;
  15435. }
  15436. const exportValues = exportValueOptionsDict.getKeys();
  15437. const hasCorrectOptionCount = exportValues.length === 2;
  15438. if (!hasCorrectOptionCount) {
  15439. return;
  15440. }
  15441. this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
  15442. }
  15443. _processRadioButton(params) {
  15444. this.data.fieldValue = this.data.buttonValue = null;
  15445. const fieldParent = params.dict.get("Parent");
  15446. if ((0, _primitives.isDict)(fieldParent) && fieldParent.has("V")) {
  15447. const fieldParentValue = fieldParent.get("V");
  15448. if ((0, _primitives.isName)(fieldParentValue)) {
  15449. this.data.fieldValue = fieldParentValue.name;
  15450. }
  15451. }
  15452. const appearanceStates = params.dict.get("AP");
  15453. if (!(0, _primitives.isDict)(appearanceStates)) {
  15454. return;
  15455. }
  15456. const normalAppearanceState = appearanceStates.get("N");
  15457. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  15458. return;
  15459. }
  15460. for (const key of normalAppearanceState.getKeys()) {
  15461. if (key !== "Off") {
  15462. this.data.buttonValue = key;
  15463. break;
  15464. }
  15465. }
  15466. }
  15467. _processPushButton(params) {
  15468. if (!params.dict.has("A")) {
  15469. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  15470. return;
  15471. }
  15472. _obj.Catalog.parseDestDictionary({
  15473. destDict: params.dict,
  15474. resultObj: this.data,
  15475. docBaseUrl: params.pdfManager.docBaseUrl
  15476. });
  15477. }
  15478. }
  15479. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  15480. constructor(params) {
  15481. super(params);
  15482. this.data.options = [];
  15483. const options = (0, _core_utils.getInheritableProperty)({
  15484. dict: params.dict,
  15485. key: "Opt"
  15486. });
  15487. if (Array.isArray(options)) {
  15488. const xref = params.xref;
  15489. for (let i = 0, ii = options.length; i < ii; i++) {
  15490. const option = xref.fetchIfRef(options[i]);
  15491. const isOptionArray = Array.isArray(option);
  15492. this.data.options[i] = {
  15493. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  15494. displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  15495. };
  15496. }
  15497. }
  15498. if (!Array.isArray(this.data.fieldValue)) {
  15499. this.data.fieldValue = [this.data.fieldValue];
  15500. }
  15501. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  15502. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  15503. }
  15504. }
  15505. class TextAnnotation extends MarkupAnnotation {
  15506. constructor(parameters) {
  15507. const DEFAULT_ICON_SIZE = 22;
  15508. super(parameters);
  15509. const dict = parameters.dict;
  15510. this.data.annotationType = _util.AnnotationType.TEXT;
  15511. if (this.data.hasAppearance) {
  15512. this.data.name = "NoIcon";
  15513. } else {
  15514. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  15515. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  15516. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  15517. }
  15518. if (dict.has("State")) {
  15519. this.data.state = dict.get("State") || null;
  15520. this.data.stateModel = dict.get("StateModel") || null;
  15521. } else {
  15522. this.data.state = null;
  15523. this.data.stateModel = null;
  15524. }
  15525. }
  15526. }
  15527. class LinkAnnotation extends Annotation {
  15528. constructor(params) {
  15529. super(params);
  15530. this.data.annotationType = _util.AnnotationType.LINK;
  15531. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  15532. if (quadPoints) {
  15533. this.data.quadPoints = quadPoints;
  15534. }
  15535. _obj.Catalog.parseDestDictionary({
  15536. destDict: params.dict,
  15537. resultObj: this.data,
  15538. docBaseUrl: params.pdfManager.docBaseUrl
  15539. });
  15540. }
  15541. }
  15542. class PopupAnnotation extends Annotation {
  15543. constructor(parameters) {
  15544. super(parameters);
  15545. this.data.annotationType = _util.AnnotationType.POPUP;
  15546. let parentItem = parameters.dict.get("Parent");
  15547. if (!parentItem) {
  15548. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  15549. return;
  15550. }
  15551. const parentSubtype = parentItem.get("Subtype");
  15552. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  15553. const rawParent = parameters.dict.getRaw("Parent");
  15554. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  15555. const rt = parentItem.get("RT");
  15556. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  15557. parentItem = parentItem.get("IRT");
  15558. }
  15559. if (!parentItem.has("M")) {
  15560. this.data.modificationDate = null;
  15561. } else {
  15562. this.setModificationDate(parentItem.get("M"));
  15563. this.data.modificationDate = this.modificationDate;
  15564. }
  15565. if (!parentItem.has("C")) {
  15566. this.data.color = null;
  15567. } else {
  15568. this.setColor(parentItem.getArray("C"));
  15569. this.data.color = this.color;
  15570. }
  15571. if (!this.viewable) {
  15572. const parentFlags = parentItem.get("F");
  15573. if (this._isViewable(parentFlags)) {
  15574. this.setFlags(parentFlags);
  15575. }
  15576. }
  15577. this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
  15578. this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
  15579. }
  15580. }
  15581. class FreeTextAnnotation extends MarkupAnnotation {
  15582. constructor(parameters) {
  15583. super(parameters);
  15584. this.data.annotationType = _util.AnnotationType.FREETEXT;
  15585. }
  15586. }
  15587. class LineAnnotation extends MarkupAnnotation {
  15588. constructor(parameters) {
  15589. super(parameters);
  15590. this.data.annotationType = _util.AnnotationType.LINE;
  15591. this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L"));
  15592. }
  15593. }
  15594. class SquareAnnotation extends MarkupAnnotation {
  15595. constructor(parameters) {
  15596. super(parameters);
  15597. this.data.annotationType = _util.AnnotationType.SQUARE;
  15598. }
  15599. }
  15600. class CircleAnnotation extends MarkupAnnotation {
  15601. constructor(parameters) {
  15602. super(parameters);
  15603. this.data.annotationType = _util.AnnotationType.CIRCLE;
  15604. }
  15605. }
  15606. class PolylineAnnotation extends MarkupAnnotation {
  15607. constructor(parameters) {
  15608. super(parameters);
  15609. this.data.annotationType = _util.AnnotationType.POLYLINE;
  15610. const rawVertices = parameters.dict.getArray("Vertices");
  15611. this.data.vertices = [];
  15612. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  15613. this.data.vertices.push({
  15614. x: rawVertices[i],
  15615. y: rawVertices[i + 1]
  15616. });
  15617. }
  15618. }
  15619. }
  15620. class PolygonAnnotation extends PolylineAnnotation {
  15621. constructor(parameters) {
  15622. super(parameters);
  15623. this.data.annotationType = _util.AnnotationType.POLYGON;
  15624. }
  15625. }
  15626. class CaretAnnotation extends MarkupAnnotation {
  15627. constructor(parameters) {
  15628. super(parameters);
  15629. this.data.annotationType = _util.AnnotationType.CARET;
  15630. }
  15631. }
  15632. class InkAnnotation extends MarkupAnnotation {
  15633. constructor(parameters) {
  15634. super(parameters);
  15635. this.data.annotationType = _util.AnnotationType.INK;
  15636. const xref = parameters.xref;
  15637. const originalInkLists = parameters.dict.getArray("InkList");
  15638. this.data.inkLists = [];
  15639. for (let i = 0, ii = originalInkLists.length; i < ii; ++i) {
  15640. this.data.inkLists.push([]);
  15641. for (let j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
  15642. this.data.inkLists[i].push({
  15643. x: xref.fetchIfRef(originalInkLists[i][j]),
  15644. y: xref.fetchIfRef(originalInkLists[i][j + 1])
  15645. });
  15646. }
  15647. }
  15648. }
  15649. }
  15650. class HighlightAnnotation extends MarkupAnnotation {
  15651. constructor(parameters) {
  15652. super(parameters);
  15653. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  15654. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15655. if (quadPoints) {
  15656. this.data.quadPoints = quadPoints;
  15657. }
  15658. }
  15659. }
  15660. class UnderlineAnnotation extends MarkupAnnotation {
  15661. constructor(parameters) {
  15662. super(parameters);
  15663. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  15664. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15665. if (quadPoints) {
  15666. this.data.quadPoints = quadPoints;
  15667. }
  15668. }
  15669. }
  15670. class SquigglyAnnotation extends MarkupAnnotation {
  15671. constructor(parameters) {
  15672. super(parameters);
  15673. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  15674. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15675. if (quadPoints) {
  15676. this.data.quadPoints = quadPoints;
  15677. }
  15678. }
  15679. }
  15680. class StrikeOutAnnotation extends MarkupAnnotation {
  15681. constructor(parameters) {
  15682. super(parameters);
  15683. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  15684. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15685. if (quadPoints) {
  15686. this.data.quadPoints = quadPoints;
  15687. }
  15688. }
  15689. }
  15690. class StampAnnotation extends MarkupAnnotation {
  15691. constructor(parameters) {
  15692. super(parameters);
  15693. this.data.annotationType = _util.AnnotationType.STAMP;
  15694. }
  15695. }
  15696. class FileAttachmentAnnotation extends MarkupAnnotation {
  15697. constructor(parameters) {
  15698. super(parameters);
  15699. const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref);
  15700. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  15701. this.data.file = file.serializable;
  15702. }
  15703. }
  15704. /***/ }),
  15705. /* 24 */
  15706. /***/ (function(module, exports, __w_pdfjs_require__) {
  15707. "use strict";
  15708. Object.defineProperty(exports, "__esModule", {
  15709. value: true
  15710. });
  15711. exports.OperatorList = void 0;
  15712. var _util = __w_pdfjs_require__(2);
  15713. var QueueOptimizer = function QueueOptimizerClosure() {
  15714. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  15715. var state = parentState;
  15716. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  15717. var item = pattern[i];
  15718. state = state[item] || (state[item] = []);
  15719. }
  15720. state[pattern[pattern.length - 1]] = {
  15721. checkFn,
  15722. iterateFn,
  15723. processFn
  15724. };
  15725. }
  15726. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  15727. var iFirstPIMXO = iFirstSave + 2;
  15728. for (var i = 0; i < count; i++) {
  15729. var arg = argsArray[iFirstPIMXO + 4 * i];
  15730. var imageMask = arg.length === 1 && arg[0];
  15731. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  15732. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  15733. continue;
  15734. }
  15735. break;
  15736. }
  15737. return count - i;
  15738. }
  15739. var InitialState = [];
  15740. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  15741. var fnArray = context.fnArray;
  15742. var iFirstSave = context.iCurr - 3;
  15743. var pos = (i - iFirstSave) % 4;
  15744. switch (pos) {
  15745. case 0:
  15746. return fnArray[i] === _util.OPS.save;
  15747. case 1:
  15748. return fnArray[i] === _util.OPS.transform;
  15749. case 2:
  15750. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  15751. case 3:
  15752. return fnArray[i] === _util.OPS.restore;
  15753. }
  15754. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  15755. }, function foundInlineImageGroup(context, i) {
  15756. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  15757. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  15758. var MAX_WIDTH = 1000;
  15759. var IMAGE_PADDING = 1;
  15760. var fnArray = context.fnArray,
  15761. argsArray = context.argsArray;
  15762. var curr = context.iCurr;
  15763. var iFirstSave = curr - 3;
  15764. var iFirstTransform = curr - 2;
  15765. var iFirstPIIXO = curr - 1;
  15766. var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  15767. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  15768. return i - (i - iFirstSave) % 4;
  15769. }
  15770. var maxX = 0;
  15771. var map = [],
  15772. maxLineHeight = 0;
  15773. var currentX = IMAGE_PADDING,
  15774. currentY = IMAGE_PADDING;
  15775. var q;
  15776. for (q = 0; q < count; q++) {
  15777. var transform = argsArray[iFirstTransform + (q << 2)];
  15778. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  15779. if (currentX + img.width > MAX_WIDTH) {
  15780. maxX = Math.max(maxX, currentX);
  15781. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  15782. currentX = 0;
  15783. maxLineHeight = 0;
  15784. }
  15785. map.push({
  15786. transform,
  15787. x: currentX,
  15788. y: currentY,
  15789. w: img.width,
  15790. h: img.height
  15791. });
  15792. currentX += img.width + 2 * IMAGE_PADDING;
  15793. maxLineHeight = Math.max(maxLineHeight, img.height);
  15794. }
  15795. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  15796. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  15797. var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  15798. var imgRowSize = imgWidth << 2;
  15799. for (q = 0; q < count; q++) {
  15800. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  15801. var rowSize = map[q].w << 2;
  15802. var dataOffset = 0;
  15803. var offset = map[q].x + map[q].y * imgWidth << 2;
  15804. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  15805. for (var k = 0, kk = map[q].h; k < kk; k++) {
  15806. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  15807. dataOffset += rowSize;
  15808. offset += imgRowSize;
  15809. }
  15810. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  15811. while (offset >= 0) {
  15812. data[offset - 4] = data[offset];
  15813. data[offset - 3] = data[offset + 1];
  15814. data[offset - 2] = data[offset + 2];
  15815. data[offset - 1] = data[offset + 3];
  15816. data[offset + rowSize] = data[offset + rowSize - 4];
  15817. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  15818. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  15819. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  15820. offset -= imgRowSize;
  15821. }
  15822. }
  15823. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  15824. argsArray.splice(iFirstSave, count * 4, [{
  15825. width: imgWidth,
  15826. height: imgHeight,
  15827. kind: _util.ImageKind.RGBA_32BPP,
  15828. data: imgData
  15829. }, map]);
  15830. return iFirstSave + 1;
  15831. });
  15832. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  15833. var fnArray = context.fnArray;
  15834. var iFirstSave = context.iCurr - 3;
  15835. var pos = (i - iFirstSave) % 4;
  15836. switch (pos) {
  15837. case 0:
  15838. return fnArray[i] === _util.OPS.save;
  15839. case 1:
  15840. return fnArray[i] === _util.OPS.transform;
  15841. case 2:
  15842. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  15843. case 3:
  15844. return fnArray[i] === _util.OPS.restore;
  15845. }
  15846. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  15847. }, function foundImageMaskGroup(context, i) {
  15848. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  15849. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  15850. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  15851. var fnArray = context.fnArray,
  15852. argsArray = context.argsArray;
  15853. var curr = context.iCurr;
  15854. var iFirstSave = curr - 3;
  15855. var iFirstTransform = curr - 2;
  15856. var iFirstPIMXO = curr - 1;
  15857. var count = Math.floor((i - iFirstSave) / 4);
  15858. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  15859. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  15860. return i - (i - iFirstSave) % 4;
  15861. }
  15862. var q;
  15863. var isSameImage = false;
  15864. var iTransform, transformArgs;
  15865. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  15866. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  15867. isSameImage = true;
  15868. var firstTransformArg0 = argsArray[iFirstTransform][0];
  15869. var firstTransformArg3 = argsArray[iFirstTransform][3];
  15870. iTransform = iFirstTransform + 4;
  15871. var iPIMXO = iFirstPIMXO + 4;
  15872. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  15873. transformArgs = argsArray[iTransform];
  15874. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  15875. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  15876. isSameImage = false;
  15877. } else {
  15878. count = q;
  15879. }
  15880. break;
  15881. }
  15882. }
  15883. }
  15884. if (isSameImage) {
  15885. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  15886. var positions = new Float32Array(count * 2);
  15887. iTransform = iFirstTransform;
  15888. for (q = 0; q < count; q++, iTransform += 4) {
  15889. transformArgs = argsArray[iTransform];
  15890. positions[q << 1] = transformArgs[4];
  15891. positions[(q << 1) + 1] = transformArgs[5];
  15892. }
  15893. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  15894. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]);
  15895. } else {
  15896. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  15897. var images = [];
  15898. for (q = 0; q < count; q++) {
  15899. transformArgs = argsArray[iFirstTransform + (q << 2)];
  15900. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  15901. images.push({
  15902. data: maskParams.data,
  15903. width: maskParams.width,
  15904. height: maskParams.height,
  15905. transform: transformArgs
  15906. });
  15907. }
  15908. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  15909. argsArray.splice(iFirstSave, count * 4, [images]);
  15910. }
  15911. return iFirstSave + 1;
  15912. });
  15913. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  15914. var argsArray = context.argsArray;
  15915. var iFirstTransform = context.iCurr - 2;
  15916. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  15917. }, function iterateImageGroup(context, i) {
  15918. var fnArray = context.fnArray,
  15919. argsArray = context.argsArray;
  15920. var iFirstSave = context.iCurr - 3;
  15921. var pos = (i - iFirstSave) % 4;
  15922. switch (pos) {
  15923. case 0:
  15924. return fnArray[i] === _util.OPS.save;
  15925. case 1:
  15926. if (fnArray[i] !== _util.OPS.transform) {
  15927. return false;
  15928. }
  15929. var iFirstTransform = context.iCurr - 2;
  15930. var firstTransformArg0 = argsArray[iFirstTransform][0];
  15931. var firstTransformArg3 = argsArray[iFirstTransform][3];
  15932. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  15933. return false;
  15934. }
  15935. return true;
  15936. case 2:
  15937. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  15938. return false;
  15939. }
  15940. var iFirstPIXO = context.iCurr - 1;
  15941. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  15942. if (argsArray[i][0] !== firstPIXOArg0) {
  15943. return false;
  15944. }
  15945. return true;
  15946. case 3:
  15947. return fnArray[i] === _util.OPS.restore;
  15948. }
  15949. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  15950. }, function (context, i) {
  15951. var MIN_IMAGES_IN_BLOCK = 3;
  15952. var MAX_IMAGES_IN_BLOCK = 1000;
  15953. var fnArray = context.fnArray,
  15954. argsArray = context.argsArray;
  15955. var curr = context.iCurr;
  15956. var iFirstSave = curr - 3;
  15957. var iFirstTransform = curr - 2;
  15958. var iFirstPIXO = curr - 1;
  15959. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  15960. var firstTransformArg0 = argsArray[iFirstTransform][0];
  15961. var firstTransformArg3 = argsArray[iFirstTransform][3];
  15962. var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  15963. if (count < MIN_IMAGES_IN_BLOCK) {
  15964. return i - (i - iFirstSave) % 4;
  15965. }
  15966. var positions = new Float32Array(count * 2);
  15967. var iTransform = iFirstTransform;
  15968. for (var q = 0; q < count; q++, iTransform += 4) {
  15969. var transformArgs = argsArray[iTransform];
  15970. positions[q << 1] = transformArgs[4];
  15971. positions[(q << 1) + 1] = transformArgs[5];
  15972. }
  15973. var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  15974. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  15975. argsArray.splice(iFirstSave, count * 4, args);
  15976. return iFirstSave + 1;
  15977. });
  15978. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  15979. var fnArray = context.fnArray,
  15980. argsArray = context.argsArray;
  15981. var iFirstSave = context.iCurr - 4;
  15982. var pos = (i - iFirstSave) % 5;
  15983. switch (pos) {
  15984. case 0:
  15985. return fnArray[i] === _util.OPS.beginText;
  15986. case 1:
  15987. return fnArray[i] === _util.OPS.setFont;
  15988. case 2:
  15989. return fnArray[i] === _util.OPS.setTextMatrix;
  15990. case 3:
  15991. if (fnArray[i] !== _util.OPS.showText) {
  15992. return false;
  15993. }
  15994. var iFirstSetFont = context.iCurr - 3;
  15995. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  15996. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  15997. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  15998. return false;
  15999. }
  16000. return true;
  16001. case 4:
  16002. return fnArray[i] === _util.OPS.endText;
  16003. }
  16004. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  16005. }, function (context, i) {
  16006. var MIN_CHARS_IN_BLOCK = 3;
  16007. var MAX_CHARS_IN_BLOCK = 1000;
  16008. var fnArray = context.fnArray,
  16009. argsArray = context.argsArray;
  16010. var curr = context.iCurr;
  16011. var iFirstBeginText = curr - 4;
  16012. var iFirstSetFont = curr - 3;
  16013. var iFirstSetTextMatrix = curr - 2;
  16014. var iFirstShowText = curr - 1;
  16015. var iFirstEndText = curr;
  16016. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  16017. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  16018. var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  16019. if (count < MIN_CHARS_IN_BLOCK) {
  16020. return i - (i - iFirstBeginText) % 5;
  16021. }
  16022. var iFirst = iFirstBeginText;
  16023. if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
  16024. count++;
  16025. iFirst -= 5;
  16026. }
  16027. var iEndText = iFirst + 4;
  16028. for (var q = 1; q < count; q++) {
  16029. fnArray.splice(iEndText, 3);
  16030. argsArray.splice(iEndText, 3);
  16031. iEndText += 2;
  16032. }
  16033. return iEndText + 1;
  16034. });
  16035. function QueueOptimizer(queue) {
  16036. this.queue = queue;
  16037. this.state = null;
  16038. this.context = {
  16039. iCurr: 0,
  16040. fnArray: queue.fnArray,
  16041. argsArray: queue.argsArray
  16042. };
  16043. this.match = null;
  16044. this.lastProcessed = 0;
  16045. }
  16046. QueueOptimizer.prototype = {
  16047. _optimize() {
  16048. const fnArray = this.queue.fnArray;
  16049. let i = this.lastProcessed,
  16050. ii = fnArray.length;
  16051. let state = this.state;
  16052. let match = this.match;
  16053. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  16054. this.lastProcessed = ii;
  16055. return;
  16056. }
  16057. const context = this.context;
  16058. while (i < ii) {
  16059. if (match) {
  16060. const iterate = (0, match.iterateFn)(context, i);
  16061. if (iterate) {
  16062. i++;
  16063. continue;
  16064. }
  16065. i = (0, match.processFn)(context, i + 1);
  16066. ii = fnArray.length;
  16067. match = null;
  16068. state = null;
  16069. if (i >= ii) {
  16070. break;
  16071. }
  16072. }
  16073. state = (state || InitialState)[fnArray[i]];
  16074. if (!state || Array.isArray(state)) {
  16075. i++;
  16076. continue;
  16077. }
  16078. context.iCurr = i;
  16079. i++;
  16080. if (state.checkFn && !(0, state.checkFn)(context)) {
  16081. state = null;
  16082. continue;
  16083. }
  16084. match = state;
  16085. state = null;
  16086. }
  16087. this.state = state;
  16088. this.match = match;
  16089. this.lastProcessed = i;
  16090. },
  16091. push(fn, args) {
  16092. this.queue.fnArray.push(fn);
  16093. this.queue.argsArray.push(args);
  16094. this._optimize();
  16095. },
  16096. flush() {
  16097. while (this.match) {
  16098. const length = this.queue.fnArray.length;
  16099. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  16100. this.match = null;
  16101. this.state = null;
  16102. this._optimize();
  16103. }
  16104. },
  16105. reset() {
  16106. this.state = null;
  16107. this.match = null;
  16108. this.lastProcessed = 0;
  16109. }
  16110. };
  16111. return QueueOptimizer;
  16112. }();
  16113. var NullOptimizer = function NullOptimizerClosure() {
  16114. function NullOptimizer(queue) {
  16115. this.queue = queue;
  16116. }
  16117. NullOptimizer.prototype = {
  16118. push(fn, args) {
  16119. this.queue.fnArray.push(fn);
  16120. this.queue.argsArray.push(args);
  16121. },
  16122. flush() {},
  16123. reset() {}
  16124. };
  16125. return NullOptimizer;
  16126. }();
  16127. var OperatorList = function OperatorListClosure() {
  16128. var CHUNK_SIZE = 1000;
  16129. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  16130. function OperatorList(intent, streamSink, pageIndex) {
  16131. this._streamSink = streamSink;
  16132. this.fnArray = [];
  16133. this.argsArray = [];
  16134. if (streamSink && intent !== "oplist") {
  16135. this.optimizer = new QueueOptimizer(this);
  16136. } else {
  16137. this.optimizer = new NullOptimizer(this);
  16138. }
  16139. this.dependencies = Object.create(null);
  16140. this._totalLength = 0;
  16141. this.pageIndex = pageIndex;
  16142. this.intent = intent;
  16143. this.weight = 0;
  16144. this._resolved = streamSink ? null : Promise.resolve();
  16145. }
  16146. OperatorList.prototype = {
  16147. get length() {
  16148. return this.argsArray.length;
  16149. },
  16150. get ready() {
  16151. return this._resolved || this._streamSink.ready;
  16152. },
  16153. get totalLength() {
  16154. return this._totalLength + this.length;
  16155. },
  16156. addOp(fn, args) {
  16157. this.optimizer.push(fn, args);
  16158. this.weight++;
  16159. if (this._streamSink) {
  16160. if (this.weight >= CHUNK_SIZE) {
  16161. this.flush();
  16162. } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  16163. this.flush();
  16164. }
  16165. }
  16166. },
  16167. addDependency(dependency) {
  16168. if (dependency in this.dependencies) {
  16169. return;
  16170. }
  16171. this.dependencies[dependency] = true;
  16172. this.addOp(_util.OPS.dependency, [dependency]);
  16173. },
  16174. addDependencies(dependencies) {
  16175. for (var key in dependencies) {
  16176. this.addDependency(key);
  16177. }
  16178. },
  16179. addOpList(opList) {
  16180. Object.assign(this.dependencies, opList.dependencies);
  16181. for (var i = 0, ii = opList.length; i < ii; i++) {
  16182. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  16183. }
  16184. },
  16185. getIR() {
  16186. return {
  16187. fnArray: this.fnArray,
  16188. argsArray: this.argsArray,
  16189. length: this.length
  16190. };
  16191. },
  16192. get _transfers() {
  16193. const transfers = [];
  16194. const {
  16195. fnArray,
  16196. argsArray,
  16197. length
  16198. } = this;
  16199. for (let i = 0; i < length; i++) {
  16200. switch (fnArray[i]) {
  16201. case _util.OPS.paintInlineImageXObject:
  16202. case _util.OPS.paintInlineImageXObjectGroup:
  16203. case _util.OPS.paintImageMaskXObject:
  16204. const arg = argsArray[i][0];
  16205. ;
  16206. if (!arg.cached) {
  16207. transfers.push(arg.data.buffer);
  16208. }
  16209. break;
  16210. }
  16211. }
  16212. return transfers;
  16213. },
  16214. flush(lastChunk = false) {
  16215. this.optimizer.flush();
  16216. const length = this.length;
  16217. this._totalLength += length;
  16218. this._streamSink.enqueue({
  16219. fnArray: this.fnArray,
  16220. argsArray: this.argsArray,
  16221. lastChunk,
  16222. length
  16223. }, 1, this._transfers);
  16224. this.dependencies = Object.create(null);
  16225. this.fnArray.length = 0;
  16226. this.argsArray.length = 0;
  16227. this.weight = 0;
  16228. this.optimizer.reset();
  16229. }
  16230. };
  16231. return OperatorList;
  16232. }();
  16233. exports.OperatorList = OperatorList;
  16234. /***/ }),
  16235. /* 25 */
  16236. /***/ (function(module, exports, __w_pdfjs_require__) {
  16237. "use strict";
  16238. Object.defineProperty(exports, "__esModule", {
  16239. value: true
  16240. });
  16241. exports.PartialEvaluator = void 0;
  16242. var _util = __w_pdfjs_require__(2);
  16243. var _cmap = __w_pdfjs_require__(26);
  16244. var _primitives = __w_pdfjs_require__(4);
  16245. var _fonts = __w_pdfjs_require__(27);
  16246. var _encodings = __w_pdfjs_require__(30);
  16247. var _core_utils = __w_pdfjs_require__(7);
  16248. var _unicode = __w_pdfjs_require__(33);
  16249. var _standard_fonts = __w_pdfjs_require__(32);
  16250. var _pattern = __w_pdfjs_require__(36);
  16251. var _parser = __w_pdfjs_require__(10);
  16252. var _bidi = __w_pdfjs_require__(37);
  16253. var _colorspace = __w_pdfjs_require__(22);
  16254. var _stream = __w_pdfjs_require__(11);
  16255. var _glyphlist = __w_pdfjs_require__(31);
  16256. var _metrics = __w_pdfjs_require__(38);
  16257. var _function = __w_pdfjs_require__(39);
  16258. var _jpeg_stream = __w_pdfjs_require__(17);
  16259. var _murmurhash = __w_pdfjs_require__(41);
  16260. var _image_utils = __w_pdfjs_require__(42);
  16261. var _operator_list = __w_pdfjs_require__(24);
  16262. var _image = __w_pdfjs_require__(43);
  16263. var PartialEvaluator = function PartialEvaluatorClosure() {
  16264. const DefaultPartialEvaluatorOptions = {
  16265. forceDataSchema: false,
  16266. maxImageSize: -1,
  16267. disableFontFace: false,
  16268. nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE,
  16269. ignoreErrors: false,
  16270. isEvalSupported: true
  16271. };
  16272. function PartialEvaluator({
  16273. xref,
  16274. handler,
  16275. pageIndex,
  16276. idFactory,
  16277. fontCache,
  16278. builtInCMapCache,
  16279. options = null,
  16280. pdfFunctionFactory
  16281. }) {
  16282. this.xref = xref;
  16283. this.handler = handler;
  16284. this.pageIndex = pageIndex;
  16285. this.idFactory = idFactory;
  16286. this.fontCache = fontCache;
  16287. this.builtInCMapCache = builtInCMapCache;
  16288. this.options = options || DefaultPartialEvaluatorOptions;
  16289. this.pdfFunctionFactory = pdfFunctionFactory;
  16290. this.parsingType3Font = false;
  16291. this.fetchBuiltInCMap = async name => {
  16292. if (this.builtInCMapCache.has(name)) {
  16293. return this.builtInCMapCache.get(name);
  16294. }
  16295. const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", {
  16296. name
  16297. });
  16298. const reader = readableStream.getReader();
  16299. const data = await new Promise(function (resolve, reject) {
  16300. function pump() {
  16301. reader.read().then(function ({
  16302. value,
  16303. done
  16304. }) {
  16305. if (done) {
  16306. return;
  16307. }
  16308. resolve(value);
  16309. pump();
  16310. }, reject);
  16311. }
  16312. pump();
  16313. });
  16314. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  16315. this.builtInCMapCache.set(name, data);
  16316. }
  16317. return data;
  16318. };
  16319. }
  16320. var TIME_SLOT_DURATION_MS = 20;
  16321. var CHECK_TIME_EVERY = 100;
  16322. function TimeSlotManager() {
  16323. this.reset();
  16324. }
  16325. TimeSlotManager.prototype = {
  16326. check: function TimeSlotManager_check() {
  16327. if (++this.checked < CHECK_TIME_EVERY) {
  16328. return false;
  16329. }
  16330. this.checked = 0;
  16331. return this.endTime <= Date.now();
  16332. },
  16333. reset: function TimeSlotManager_reset() {
  16334. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  16335. this.checked = 0;
  16336. }
  16337. };
  16338. function normalizeBlendMode(value, parsingArray = false) {
  16339. if (Array.isArray(value)) {
  16340. for (let i = 0, ii = value.length; i < ii; i++) {
  16341. const maybeBM = normalizeBlendMode(value[i], true);
  16342. if (maybeBM) {
  16343. return maybeBM;
  16344. }
  16345. }
  16346. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  16347. return "source-over";
  16348. }
  16349. if (!(0, _primitives.isName)(value)) {
  16350. if (parsingArray) {
  16351. return null;
  16352. }
  16353. return "source-over";
  16354. }
  16355. switch (value.name) {
  16356. case "Normal":
  16357. case "Compatible":
  16358. return "source-over";
  16359. case "Multiply":
  16360. return "multiply";
  16361. case "Screen":
  16362. return "screen";
  16363. case "Overlay":
  16364. return "overlay";
  16365. case "Darken":
  16366. return "darken";
  16367. case "Lighten":
  16368. return "lighten";
  16369. case "ColorDodge":
  16370. return "color-dodge";
  16371. case "ColorBurn":
  16372. return "color-burn";
  16373. case "HardLight":
  16374. return "hard-light";
  16375. case "SoftLight":
  16376. return "soft-light";
  16377. case "Difference":
  16378. return "difference";
  16379. case "Exclusion":
  16380. return "exclusion";
  16381. case "Hue":
  16382. return "hue";
  16383. case "Saturation":
  16384. return "saturation";
  16385. case "Color":
  16386. return "color";
  16387. case "Luminosity":
  16388. return "luminosity";
  16389. }
  16390. if (parsingArray) {
  16391. return null;
  16392. }
  16393. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  16394. return "source-over";
  16395. }
  16396. var deferred = Promise.resolve();
  16397. var TILING_PATTERN = 1,
  16398. SHADING_PATTERN = 2;
  16399. PartialEvaluator.prototype = {
  16400. clone(newOptions = DefaultPartialEvaluatorOptions) {
  16401. var newEvaluator = Object.create(this);
  16402. newEvaluator.options = newOptions;
  16403. return newEvaluator;
  16404. },
  16405. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  16406. if (!(resources instanceof _primitives.Dict)) {
  16407. return false;
  16408. }
  16409. var processed = Object.create(null);
  16410. if (resources.objId) {
  16411. processed[resources.objId] = true;
  16412. }
  16413. var nodes = [resources],
  16414. xref = this.xref;
  16415. while (nodes.length) {
  16416. var node = nodes.shift();
  16417. var graphicStates = node.get("ExtGState");
  16418. if (graphicStates instanceof _primitives.Dict) {
  16419. var graphicStatesKeys = graphicStates.getKeys();
  16420. for (let i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  16421. const key = graphicStatesKeys[i];
  16422. let graphicState = graphicStates.getRaw(key);
  16423. if (graphicState instanceof _primitives.Ref) {
  16424. if (processed[graphicState.toString()]) {
  16425. continue;
  16426. }
  16427. try {
  16428. graphicState = xref.fetch(graphicState);
  16429. } catch (ex) {
  16430. if (ex instanceof _core_utils.MissingDataException) {
  16431. throw ex;
  16432. }
  16433. if (this.options.ignoreErrors) {
  16434. if (graphicState instanceof _primitives.Ref) {
  16435. processed[graphicState.toString()] = true;
  16436. }
  16437. this.handler.send("UnsupportedFeature", {
  16438. featureId: _util.UNSUPPORTED_FEATURES.unknown
  16439. });
  16440. (0, _util.warn)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  16441. continue;
  16442. }
  16443. throw ex;
  16444. }
  16445. }
  16446. if (!(graphicState instanceof _primitives.Dict)) {
  16447. continue;
  16448. }
  16449. if (graphicState.objId) {
  16450. processed[graphicState.objId] = true;
  16451. }
  16452. const bm = graphicState.get("BM");
  16453. if (bm instanceof _primitives.Name) {
  16454. if (bm.name !== "Normal") {
  16455. return true;
  16456. }
  16457. continue;
  16458. }
  16459. if (bm !== undefined && Array.isArray(bm)) {
  16460. for (let j = 0, jj = bm.length; j < jj; j++) {
  16461. if (bm[j] instanceof _primitives.Name && bm[j].name !== "Normal") {
  16462. return true;
  16463. }
  16464. }
  16465. }
  16466. }
  16467. }
  16468. var xObjects = node.get("XObject");
  16469. if (!(xObjects instanceof _primitives.Dict)) {
  16470. continue;
  16471. }
  16472. var xObjectsKeys = xObjects.getKeys();
  16473. for (let i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  16474. const key = xObjectsKeys[i];
  16475. var xObject = xObjects.getRaw(key);
  16476. if (xObject instanceof _primitives.Ref) {
  16477. if (processed[xObject.toString()]) {
  16478. continue;
  16479. }
  16480. try {
  16481. xObject = xref.fetch(xObject);
  16482. } catch (ex) {
  16483. if (ex instanceof _core_utils.MissingDataException) {
  16484. throw ex;
  16485. }
  16486. if (this.options.ignoreErrors) {
  16487. if (xObject instanceof _primitives.Ref) {
  16488. processed[xObject.toString()] = true;
  16489. }
  16490. this.handler.send("UnsupportedFeature", {
  16491. featureId: _util.UNSUPPORTED_FEATURES.unknown
  16492. });
  16493. (0, _util.warn)(`hasBlendModes - ignoring XObject: "${ex}".`);
  16494. continue;
  16495. }
  16496. throw ex;
  16497. }
  16498. }
  16499. if (!(0, _primitives.isStream)(xObject)) {
  16500. continue;
  16501. }
  16502. if (xObject.dict.objId) {
  16503. if (processed[xObject.dict.objId]) {
  16504. continue;
  16505. }
  16506. processed[xObject.dict.objId] = true;
  16507. }
  16508. var xResources = xObject.dict.get("Resources");
  16509. if (xResources instanceof _primitives.Dict && (!xResources.objId || !processed[xResources.objId])) {
  16510. nodes.push(xResources);
  16511. if (xResources.objId) {
  16512. processed[xResources.objId] = true;
  16513. }
  16514. }
  16515. }
  16516. }
  16517. return false;
  16518. },
  16519. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  16520. var dict = xobj.dict;
  16521. var matrix = dict.getArray("Matrix");
  16522. var bbox = dict.getArray("BBox");
  16523. if (Array.isArray(bbox) && bbox.length === 4) {
  16524. bbox = _util.Util.normalizeRect(bbox);
  16525. } else {
  16526. bbox = null;
  16527. }
  16528. var group = dict.get("Group");
  16529. if (group) {
  16530. var groupOptions = {
  16531. matrix,
  16532. bbox,
  16533. smask,
  16534. isolated: false,
  16535. knockout: false
  16536. };
  16537. var groupSubtype = group.get("S");
  16538. var colorSpace = null;
  16539. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  16540. groupOptions.isolated = group.get("I") || false;
  16541. groupOptions.knockout = group.get("K") || false;
  16542. if (group.has("CS")) {
  16543. colorSpace = await this.parseColorSpace({
  16544. cs: group.get("CS"),
  16545. resources
  16546. });
  16547. }
  16548. }
  16549. if (smask && smask.backdrop) {
  16550. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  16551. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  16552. }
  16553. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  16554. }
  16555. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  16556. return this.getOperatorList({
  16557. stream: xobj,
  16558. task,
  16559. resources: dict.get("Resources") || resources,
  16560. operatorList,
  16561. initialState
  16562. }).then(function () {
  16563. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  16564. if (group) {
  16565. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  16566. }
  16567. });
  16568. },
  16569. async buildPaintImageXObject({
  16570. resources,
  16571. image,
  16572. isInline = false,
  16573. operatorList,
  16574. cacheKey,
  16575. imageCache,
  16576. forceDisableNativeImageDecoder = false
  16577. }) {
  16578. var dict = image.dict;
  16579. var w = dict.get("Width", "W");
  16580. var h = dict.get("Height", "H");
  16581. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  16582. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  16583. return undefined;
  16584. }
  16585. var maxImageSize = this.options.maxImageSize;
  16586. if (maxImageSize !== -1 && w * h > maxImageSize) {
  16587. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  16588. return undefined;
  16589. }
  16590. var imageMask = dict.get("ImageMask", "IM") || false;
  16591. var imgData, args;
  16592. if (imageMask) {
  16593. var width = dict.get("Width", "W");
  16594. var height = dict.get("Height", "H");
  16595. var bitStrideLength = width + 7 >> 3;
  16596. var imgArray = image.getBytes(bitStrideLength * height, true);
  16597. var decode = dict.getArray("Decode", "D");
  16598. imgData = _image.PDFImage.createMask({
  16599. imgArray,
  16600. width,
  16601. height,
  16602. imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
  16603. inverseDecode: !!decode && decode[0] > 0
  16604. });
  16605. imgData.cached = !!cacheKey;
  16606. args = [imgData];
  16607. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  16608. if (cacheKey) {
  16609. imageCache[cacheKey] = {
  16610. fn: _util.OPS.paintImageMaskXObject,
  16611. args
  16612. };
  16613. }
  16614. return undefined;
  16615. }
  16616. var softMask = dict.get("SMask", "SM") || false;
  16617. var mask = dict.get("Mask") || false;
  16618. var SMALL_IMAGE_DIMENSIONS = 200;
  16619. if (isInline && !softMask && !mask && !(image instanceof _jpeg_stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  16620. const imageObj = new _image.PDFImage({
  16621. xref: this.xref,
  16622. res: resources,
  16623. image,
  16624. isInline,
  16625. pdfFunctionFactory: this.pdfFunctionFactory
  16626. });
  16627. imgData = imageObj.createImageData(true);
  16628. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  16629. return undefined;
  16630. }
  16631. const nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport;
  16632. let objId = `img_${this.idFactory.createObjId()}`;
  16633. if (this.parsingType3Font) {
  16634. (0, _util.assert)(nativeImageDecoderSupport === _util.NativeImageDecoding.NONE, "Type3 image resources should be completely decoded in the worker.");
  16635. objId = `${this.idFactory.getDocId()}_type3res_${objId}`;
  16636. }
  16637. if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && _image_utils.NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory) && image.maybeValidDimensions) {
  16638. return this.handler.sendWithPromise("obj", [objId, this.pageIndex, "JpegStream", image.getIR(this.options.forceDataSchema)]).then(function () {
  16639. operatorList.addDependency(objId);
  16640. args = [objId, w, h];
  16641. operatorList.addOp(_util.OPS.paintJpegXObject, args);
  16642. if (cacheKey) {
  16643. imageCache[cacheKey] = {
  16644. fn: _util.OPS.paintJpegXObject,
  16645. args
  16646. };
  16647. }
  16648. }, reason => {
  16649. (0, _util.warn)("Native JPEG decoding failed -- trying to recover: " + (reason && reason.message));
  16650. return this.buildPaintImageXObject({
  16651. resources,
  16652. image,
  16653. isInline,
  16654. operatorList,
  16655. cacheKey,
  16656. imageCache,
  16657. forceDisableNativeImageDecoder: true
  16658. });
  16659. });
  16660. }
  16661. var nativeImageDecoder = null;
  16662. if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) {
  16663. nativeImageDecoder = new _image_utils.NativeImageDecoder({
  16664. xref: this.xref,
  16665. resources,
  16666. handler: this.handler,
  16667. forceDataSchema: this.options.forceDataSchema,
  16668. pdfFunctionFactory: this.pdfFunctionFactory
  16669. });
  16670. }
  16671. operatorList.addDependency(objId);
  16672. args = [objId, w, h];
  16673. const imgPromise = _image.PDFImage.buildImage({
  16674. handler: this.handler,
  16675. xref: this.xref,
  16676. res: resources,
  16677. image,
  16678. isInline,
  16679. nativeDecoder: nativeImageDecoder,
  16680. pdfFunctionFactory: this.pdfFunctionFactory
  16681. }).then(imageObj => {
  16682. var imgData = imageObj.createImageData(false);
  16683. if (this.parsingType3Font) {
  16684. return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", imgData], [imgData.data.buffer]);
  16685. }
  16686. this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], [imgData.data.buffer]);
  16687. return undefined;
  16688. }).catch(reason => {
  16689. (0, _util.warn)("Unable to decode image: " + reason);
  16690. if (this.parsingType3Font) {
  16691. return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", null]);
  16692. }
  16693. this.handler.send("obj", [objId, this.pageIndex, "Image", null]);
  16694. return undefined;
  16695. });
  16696. if (this.parsingType3Font) {
  16697. await imgPromise;
  16698. }
  16699. operatorList.addOp(_util.OPS.paintImageXObject, args);
  16700. if (cacheKey) {
  16701. imageCache[cacheKey] = {
  16702. fn: _util.OPS.paintImageXObject,
  16703. args
  16704. };
  16705. }
  16706. return undefined;
  16707. },
  16708. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  16709. var smaskContent = smask.get("G");
  16710. var smaskOptions = {
  16711. subtype: smask.get("S").name,
  16712. backdrop: smask.get("BC")
  16713. };
  16714. var transferObj = smask.get("TR");
  16715. if ((0, _function.isPDFFunction)(transferObj)) {
  16716. const transferFn = this.pdfFunctionFactory.create(transferObj);
  16717. var transferMap = new Uint8Array(256);
  16718. var tmp = new Float32Array(1);
  16719. for (var i = 0; i < 256; i++) {
  16720. tmp[0] = i / 255;
  16721. transferFn(tmp, 0, tmp, 0);
  16722. transferMap[i] = tmp[0] * 255 | 0;
  16723. }
  16724. smaskOptions.transferMap = transferMap;
  16725. }
  16726. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  16727. },
  16728. handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  16729. const tilingOpList = new _operator_list.OperatorList();
  16730. const resourcesArray = [patternDict.get("Resources"), resources];
  16731. const patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
  16732. return this.getOperatorList({
  16733. stream: pattern,
  16734. task,
  16735. resources: patternResources,
  16736. operatorList: tilingOpList
  16737. }).then(function () {
  16738. return (0, _pattern.getTilingPatternIR)({
  16739. fnArray: tilingOpList.fnArray,
  16740. argsArray: tilingOpList.argsArray
  16741. }, patternDict, args);
  16742. }).then(function (tilingPatternIR) {
  16743. operatorList.addDependencies(tilingOpList.dependencies);
  16744. operatorList.addOp(fn, tilingPatternIR);
  16745. }, reason => {
  16746. if (reason instanceof _util.AbortException) {
  16747. return;
  16748. }
  16749. if (this.options.ignoreErrors) {
  16750. this.handler.send("UnsupportedFeature", {
  16751. featureId: _util.UNSUPPORTED_FEATURES.unknown
  16752. });
  16753. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  16754. return;
  16755. }
  16756. throw reason;
  16757. });
  16758. },
  16759. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  16760. var fontName;
  16761. if (fontArgs) {
  16762. fontArgs = fontArgs.slice();
  16763. fontName = fontArgs[0].name;
  16764. }
  16765. return this.loadFont(fontName, fontRef, resources).then(translated => {
  16766. if (!translated.font.isType3Font) {
  16767. return translated;
  16768. }
  16769. return translated.loadType3Data(this, resources, operatorList, task).then(function () {
  16770. return translated;
  16771. }).catch(reason => {
  16772. this.handler.send("UnsupportedFeature", {
  16773. featureId: _util.UNSUPPORTED_FEATURES.font
  16774. });
  16775. return new TranslatedFont("g_font_error", new _fonts.ErrorFont("Type3 font load error: " + reason), translated.font);
  16776. });
  16777. }).then(translated => {
  16778. state.font = translated.font;
  16779. translated.send(this.handler);
  16780. return translated.loadedName;
  16781. });
  16782. },
  16783. handleText(chars, state) {
  16784. const font = state.font;
  16785. const glyphs = font.charsToGlyphs(chars);
  16786. if (font.data) {
  16787. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  16788. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  16789. PartialEvaluator.buildFontPaths(font, glyphs, this.handler);
  16790. }
  16791. }
  16792. return glyphs;
  16793. },
  16794. ensureStateFont(state) {
  16795. if (state.font) {
  16796. return;
  16797. }
  16798. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  16799. if (this.options.ignoreErrors) {
  16800. this.handler.send("UnsupportedFeature", {
  16801. featureId: _util.UNSUPPORTED_FEATURES.font
  16802. });
  16803. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  16804. return;
  16805. }
  16806. throw reason;
  16807. },
  16808. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
  16809. var gStateObj = [];
  16810. var gStateKeys = gState.getKeys();
  16811. var promise = Promise.resolve();
  16812. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  16813. const key = gStateKeys[i];
  16814. const value = gState.get(key);
  16815. switch (key) {
  16816. case "Type":
  16817. break;
  16818. case "LW":
  16819. case "LC":
  16820. case "LJ":
  16821. case "ML":
  16822. case "D":
  16823. case "RI":
  16824. case "FL":
  16825. case "CA":
  16826. case "ca":
  16827. gStateObj.push([key, value]);
  16828. break;
  16829. case "Font":
  16830. promise = promise.then(() => {
  16831. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  16832. operatorList.addDependency(loadedName);
  16833. gStateObj.push([key, [loadedName, value[1]]]);
  16834. });
  16835. });
  16836. break;
  16837. case "BM":
  16838. gStateObj.push([key, normalizeBlendMode(value)]);
  16839. break;
  16840. case "SMask":
  16841. if ((0, _primitives.isName)(value, "None")) {
  16842. gStateObj.push([key, false]);
  16843. break;
  16844. }
  16845. if ((0, _primitives.isDict)(value)) {
  16846. promise = promise.then(() => {
  16847. return this.handleSMask(value, resources, operatorList, task, stateManager);
  16848. });
  16849. gStateObj.push([key, true]);
  16850. } else {
  16851. (0, _util.warn)("Unsupported SMask type");
  16852. }
  16853. break;
  16854. case "OP":
  16855. case "op":
  16856. case "OPM":
  16857. case "BG":
  16858. case "BG2":
  16859. case "UCR":
  16860. case "UCR2":
  16861. case "TR":
  16862. case "TR2":
  16863. case "HT":
  16864. case "SM":
  16865. case "SA":
  16866. case "AIS":
  16867. case "TK":
  16868. (0, _util.info)("graphic state operator " + key);
  16869. break;
  16870. default:
  16871. (0, _util.info)("Unknown graphic state operator " + key);
  16872. break;
  16873. }
  16874. }
  16875. return promise.then(function () {
  16876. if (gStateObj.length > 0) {
  16877. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  16878. }
  16879. });
  16880. },
  16881. loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {
  16882. function errorFont() {
  16883. return Promise.resolve(new TranslatedFont("g_font_error", new _fonts.ErrorFont("Font " + fontName + " is not available"), font));
  16884. }
  16885. var fontRef,
  16886. xref = this.xref;
  16887. if (font) {
  16888. if (!(0, _primitives.isRef)(font)) {
  16889. throw new _util.FormatError('The "font" object should be a reference.');
  16890. }
  16891. fontRef = font;
  16892. } else {
  16893. var fontRes = resources.get("Font");
  16894. if (fontRes) {
  16895. fontRef = fontRes.getRaw(fontName);
  16896. }
  16897. }
  16898. if (!fontRef) {
  16899. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  16900. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  16901. (0, _util.warn)(`${partialMsg}.`);
  16902. return errorFont();
  16903. }
  16904. this.handler.send("UnsupportedFeature", {
  16905. featureId: _util.UNSUPPORTED_FEATURES.font
  16906. });
  16907. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  16908. fontRef = PartialEvaluator.getFallbackFontDict();
  16909. }
  16910. if (this.fontCache.has(fontRef)) {
  16911. return this.fontCache.get(fontRef);
  16912. }
  16913. font = xref.fetchIfRef(fontRef);
  16914. if (!(0, _primitives.isDict)(font)) {
  16915. return errorFont();
  16916. }
  16917. if (font.translated) {
  16918. return font.translated;
  16919. }
  16920. var fontCapability = (0, _util.createPromiseCapability)();
  16921. var preEvaluatedFont = this.preEvaluateFont(font);
  16922. const {
  16923. descriptor,
  16924. hash
  16925. } = preEvaluatedFont;
  16926. var fontRefIsRef = (0, _primitives.isRef)(fontRef),
  16927. fontID;
  16928. if (fontRefIsRef) {
  16929. fontID = fontRef.toString();
  16930. }
  16931. if (hash && (0, _primitives.isDict)(descriptor)) {
  16932. if (!descriptor.fontAliases) {
  16933. descriptor.fontAliases = Object.create(null);
  16934. }
  16935. var fontAliases = descriptor.fontAliases;
  16936. if (fontAliases[hash]) {
  16937. var aliasFontRef = fontAliases[hash].aliasRef;
  16938. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  16939. this.fontCache.putAlias(fontRef, aliasFontRef);
  16940. return this.fontCache.get(fontRef);
  16941. }
  16942. } else {
  16943. fontAliases[hash] = {
  16944. fontID: _fonts.Font.getFontID()
  16945. };
  16946. }
  16947. if (fontRefIsRef) {
  16948. fontAliases[hash].aliasRef = fontRef;
  16949. }
  16950. fontID = fontAliases[hash].fontID;
  16951. }
  16952. if (fontRefIsRef) {
  16953. this.fontCache.put(fontRef, fontCapability.promise);
  16954. } else {
  16955. if (!fontID) {
  16956. fontID = this.idFactory.createObjId();
  16957. }
  16958. this.fontCache.put(`id_${fontID}`, fontCapability.promise);
  16959. }
  16960. (0, _util.assert)(fontID, 'The "fontID" must be defined.');
  16961. font.loadedName = `${this.idFactory.getDocId()}_f${fontID}`;
  16962. font.translated = fontCapability.promise;
  16963. var translatedPromise;
  16964. try {
  16965. translatedPromise = this.translateFont(preEvaluatedFont);
  16966. } catch (e) {
  16967. translatedPromise = Promise.reject(e);
  16968. }
  16969. translatedPromise.then(function (translatedFont) {
  16970. if (translatedFont.fontType !== undefined) {
  16971. var xrefFontStats = xref.stats.fontTypes;
  16972. xrefFontStats[translatedFont.fontType] = true;
  16973. }
  16974. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  16975. }).catch(reason => {
  16976. this.handler.send("UnsupportedFeature", {
  16977. featureId: _util.UNSUPPORTED_FEATURES.font
  16978. });
  16979. try {
  16980. var fontFile3 = descriptor && descriptor.get("FontFile3");
  16981. var subtype = fontFile3 && fontFile3.get("Subtype");
  16982. var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  16983. var xrefFontStats = xref.stats.fontTypes;
  16984. xrefFontStats[fontType] = true;
  16985. } catch (ex) {}
  16986. fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font));
  16987. });
  16988. return fontCapability.promise;
  16989. },
  16990. buildPath(operatorList, fn, args, parsingText = false) {
  16991. var lastIndex = operatorList.length - 1;
  16992. if (!args) {
  16993. args = [];
  16994. }
  16995. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  16996. if (parsingText) {
  16997. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  16998. operatorList.addOp(_util.OPS.save, null);
  16999. }
  17000. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  17001. if (parsingText) {
  17002. operatorList.addOp(_util.OPS.restore, null);
  17003. }
  17004. } else {
  17005. var opArgs = operatorList.argsArray[lastIndex];
  17006. opArgs[0].push(fn);
  17007. Array.prototype.push.apply(opArgs[1], args);
  17008. }
  17009. },
  17010. parseColorSpace({
  17011. cs,
  17012. resources
  17013. }) {
  17014. return new Promise(resolve => {
  17015. resolve(_colorspace.ColorSpace.parse(cs, this.xref, resources, this.pdfFunctionFactory));
  17016. }).catch(reason => {
  17017. if (reason instanceof _util.AbortException) {
  17018. return null;
  17019. }
  17020. if (this.options.ignoreErrors) {
  17021. this.handler.send("UnsupportedFeature", {
  17022. featureId: _util.UNSUPPORTED_FEATURES.unknown
  17023. });
  17024. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  17025. return null;
  17026. }
  17027. throw reason;
  17028. });
  17029. },
  17030. async handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
  17031. var patternName = args[args.length - 1];
  17032. var pattern;
  17033. if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) {
  17034. var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  17035. var typeNum = dict.get("PatternType");
  17036. if (typeNum === TILING_PATTERN) {
  17037. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  17038. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  17039. } else if (typeNum === SHADING_PATTERN) {
  17040. var shading = dict.get("Shading");
  17041. var matrix = dict.getArray("Matrix");
  17042. pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory);
  17043. operatorList.addOp(fn, pattern.getIR());
  17044. return undefined;
  17045. }
  17046. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  17047. }
  17048. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  17049. },
  17050. getOperatorList({
  17051. stream,
  17052. task,
  17053. resources,
  17054. operatorList,
  17055. initialState = null
  17056. }) {
  17057. resources = resources || _primitives.Dict.empty;
  17058. initialState = initialState || new EvalState();
  17059. if (!operatorList) {
  17060. throw new Error('getOperatorList: missing "operatorList" parameter');
  17061. }
  17062. var self = this;
  17063. var xref = this.xref;
  17064. let parsingText = false;
  17065. var imageCache = Object.create(null);
  17066. var xobjs = resources.get("XObject") || _primitives.Dict.empty;
  17067. var patterns = resources.get("Pattern") || _primitives.Dict.empty;
  17068. var stateManager = new StateManager(initialState);
  17069. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  17070. var timeSlotManager = new TimeSlotManager();
  17071. function closePendingRestoreOPS(argument) {
  17072. for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  17073. operatorList.addOp(_util.OPS.restore, []);
  17074. }
  17075. }
  17076. return new Promise(function promiseBody(resolve, reject) {
  17077. const next = function (promise) {
  17078. Promise.all([promise, operatorList.ready]).then(function () {
  17079. try {
  17080. promiseBody(resolve, reject);
  17081. } catch (ex) {
  17082. reject(ex);
  17083. }
  17084. }, reject);
  17085. };
  17086. task.ensureNotTerminated();
  17087. timeSlotManager.reset();
  17088. var stop,
  17089. operation = {},
  17090. i,
  17091. ii,
  17092. cs;
  17093. while (!(stop = timeSlotManager.check())) {
  17094. operation.args = null;
  17095. if (!preprocessor.read(operation)) {
  17096. break;
  17097. }
  17098. var args = operation.args;
  17099. var fn = operation.fn;
  17100. switch (fn | 0) {
  17101. case _util.OPS.paintXObject:
  17102. var name = args[0].name;
  17103. if (name && imageCache[name] !== undefined) {
  17104. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  17105. args = null;
  17106. continue;
  17107. }
  17108. next(new Promise(function (resolveXObject, rejectXObject) {
  17109. if (!name) {
  17110. throw new _util.FormatError("XObject must be referred to by name.");
  17111. }
  17112. const xobj = xobjs.get(name);
  17113. if (!xobj) {
  17114. operatorList.addOp(fn, args);
  17115. resolveXObject();
  17116. return;
  17117. }
  17118. if (!(0, _primitives.isStream)(xobj)) {
  17119. throw new _util.FormatError("XObject should be a stream");
  17120. }
  17121. const type = xobj.dict.get("Subtype");
  17122. if (!(0, _primitives.isName)(type)) {
  17123. throw new _util.FormatError("XObject should have a Name subtype");
  17124. }
  17125. if (type.name === "Form") {
  17126. stateManager.save();
  17127. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  17128. stateManager.restore();
  17129. resolveXObject();
  17130. }, rejectXObject);
  17131. return;
  17132. } else if (type.name === "Image") {
  17133. self.buildPaintImageXObject({
  17134. resources,
  17135. image: xobj,
  17136. operatorList,
  17137. cacheKey: name,
  17138. imageCache
  17139. }).then(resolveXObject, rejectXObject);
  17140. return;
  17141. } else if (type.name === "PS") {
  17142. (0, _util.info)("Ignored XObject subtype PS");
  17143. } else {
  17144. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  17145. }
  17146. resolveXObject();
  17147. }).catch(function (reason) {
  17148. if (reason instanceof _util.AbortException) {
  17149. return;
  17150. }
  17151. if (self.options.ignoreErrors) {
  17152. self.handler.send("UnsupportedFeature", {
  17153. featureId: _util.UNSUPPORTED_FEATURES.unknown
  17154. });
  17155. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  17156. return;
  17157. }
  17158. throw reason;
  17159. }));
  17160. return;
  17161. case _util.OPS.setFont:
  17162. var fontSize = args[1];
  17163. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  17164. operatorList.addDependency(loadedName);
  17165. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  17166. }));
  17167. return;
  17168. case _util.OPS.beginText:
  17169. parsingText = true;
  17170. break;
  17171. case _util.OPS.endText:
  17172. parsingText = false;
  17173. break;
  17174. case _util.OPS.endInlineImage:
  17175. var cacheKey = args[0].cacheKey;
  17176. if (cacheKey) {
  17177. var cacheEntry = imageCache[cacheKey];
  17178. if (cacheEntry !== undefined) {
  17179. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  17180. args = null;
  17181. continue;
  17182. }
  17183. }
  17184. next(self.buildPaintImageXObject({
  17185. resources,
  17186. image: args[0],
  17187. isInline: true,
  17188. operatorList,
  17189. cacheKey,
  17190. imageCache
  17191. }));
  17192. return;
  17193. case _util.OPS.showText:
  17194. if (!stateManager.state.font) {
  17195. self.ensureStateFont(stateManager.state);
  17196. continue;
  17197. }
  17198. args[0] = self.handleText(args[0], stateManager.state);
  17199. break;
  17200. case _util.OPS.showSpacedText:
  17201. if (!stateManager.state.font) {
  17202. self.ensureStateFont(stateManager.state);
  17203. continue;
  17204. }
  17205. var arr = args[0];
  17206. var combinedGlyphs = [];
  17207. var arrLength = arr.length;
  17208. var state = stateManager.state;
  17209. for (i = 0; i < arrLength; ++i) {
  17210. var arrItem = arr[i];
  17211. if ((0, _util.isString)(arrItem)) {
  17212. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  17213. } else if ((0, _util.isNum)(arrItem)) {
  17214. combinedGlyphs.push(arrItem);
  17215. }
  17216. }
  17217. args[0] = combinedGlyphs;
  17218. fn = _util.OPS.showText;
  17219. break;
  17220. case _util.OPS.nextLineShowText:
  17221. if (!stateManager.state.font) {
  17222. self.ensureStateFont(stateManager.state);
  17223. continue;
  17224. }
  17225. operatorList.addOp(_util.OPS.nextLine);
  17226. args[0] = self.handleText(args[0], stateManager.state);
  17227. fn = _util.OPS.showText;
  17228. break;
  17229. case _util.OPS.nextLineSetSpacingShowText:
  17230. if (!stateManager.state.font) {
  17231. self.ensureStateFont(stateManager.state);
  17232. continue;
  17233. }
  17234. operatorList.addOp(_util.OPS.nextLine);
  17235. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  17236. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  17237. args[0] = self.handleText(args[0], stateManager.state);
  17238. fn = _util.OPS.showText;
  17239. break;
  17240. case _util.OPS.setTextRenderingMode:
  17241. stateManager.state.textRenderingMode = args[0];
  17242. break;
  17243. case _util.OPS.setFillColorSpace:
  17244. next(self.parseColorSpace({
  17245. cs: args[0],
  17246. resources
  17247. }).then(function (colorSpace) {
  17248. if (colorSpace) {
  17249. stateManager.state.fillColorSpace = colorSpace;
  17250. }
  17251. }));
  17252. return;
  17253. case _util.OPS.setStrokeColorSpace:
  17254. next(self.parseColorSpace({
  17255. cs: args[0],
  17256. resources
  17257. }).then(function (colorSpace) {
  17258. if (colorSpace) {
  17259. stateManager.state.strokeColorSpace = colorSpace;
  17260. }
  17261. }));
  17262. return;
  17263. case _util.OPS.setFillColor:
  17264. cs = stateManager.state.fillColorSpace;
  17265. args = cs.getRgb(args, 0);
  17266. fn = _util.OPS.setFillRGBColor;
  17267. break;
  17268. case _util.OPS.setStrokeColor:
  17269. cs = stateManager.state.strokeColorSpace;
  17270. args = cs.getRgb(args, 0);
  17271. fn = _util.OPS.setStrokeRGBColor;
  17272. break;
  17273. case _util.OPS.setFillGray:
  17274. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  17275. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  17276. fn = _util.OPS.setFillRGBColor;
  17277. break;
  17278. case _util.OPS.setStrokeGray:
  17279. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  17280. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  17281. fn = _util.OPS.setStrokeRGBColor;
  17282. break;
  17283. case _util.OPS.setFillCMYKColor:
  17284. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  17285. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  17286. fn = _util.OPS.setFillRGBColor;
  17287. break;
  17288. case _util.OPS.setStrokeCMYKColor:
  17289. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  17290. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  17291. fn = _util.OPS.setStrokeRGBColor;
  17292. break;
  17293. case _util.OPS.setFillRGBColor:
  17294. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  17295. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  17296. break;
  17297. case _util.OPS.setStrokeRGBColor:
  17298. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  17299. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  17300. break;
  17301. case _util.OPS.setFillColorN:
  17302. cs = stateManager.state.fillColorSpace;
  17303. if (cs.name === "Pattern") {
  17304. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task));
  17305. return;
  17306. }
  17307. args = cs.getRgb(args, 0);
  17308. fn = _util.OPS.setFillRGBColor;
  17309. break;
  17310. case _util.OPS.setStrokeColorN:
  17311. cs = stateManager.state.strokeColorSpace;
  17312. if (cs.name === "Pattern") {
  17313. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task));
  17314. return;
  17315. }
  17316. args = cs.getRgb(args, 0);
  17317. fn = _util.OPS.setStrokeRGBColor;
  17318. break;
  17319. case _util.OPS.shadingFill:
  17320. var shadingRes = resources.get("Shading");
  17321. if (!shadingRes) {
  17322. throw new _util.FormatError("No shading resource found");
  17323. }
  17324. var shading = shadingRes.get(args[0].name);
  17325. if (!shading) {
  17326. throw new _util.FormatError("No shading object found");
  17327. }
  17328. var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory);
  17329. var patternIR = shadingFill.getIR();
  17330. args = [patternIR];
  17331. fn = _util.OPS.shadingFill;
  17332. break;
  17333. case _util.OPS.setGState:
  17334. var dictName = args[0];
  17335. var extGState = resources.get("ExtGState");
  17336. if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) {
  17337. break;
  17338. }
  17339. var gState = extGState.get(dictName.name);
  17340. next(self.setGState(resources, gState, operatorList, task, stateManager));
  17341. return;
  17342. case _util.OPS.moveTo:
  17343. case _util.OPS.lineTo:
  17344. case _util.OPS.curveTo:
  17345. case _util.OPS.curveTo2:
  17346. case _util.OPS.curveTo3:
  17347. case _util.OPS.closePath:
  17348. case _util.OPS.rectangle:
  17349. self.buildPath(operatorList, fn, args, parsingText);
  17350. continue;
  17351. case _util.OPS.markPoint:
  17352. case _util.OPS.markPointProps:
  17353. case _util.OPS.beginMarkedContent:
  17354. case _util.OPS.beginMarkedContentProps:
  17355. case _util.OPS.endMarkedContent:
  17356. case _util.OPS.beginCompat:
  17357. case _util.OPS.endCompat:
  17358. continue;
  17359. default:
  17360. if (args !== null) {
  17361. for (i = 0, ii = args.length; i < ii; i++) {
  17362. if (args[i] instanceof _primitives.Dict) {
  17363. break;
  17364. }
  17365. }
  17366. if (i < ii) {
  17367. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  17368. continue;
  17369. }
  17370. }
  17371. }
  17372. operatorList.addOp(fn, args);
  17373. }
  17374. if (stop) {
  17375. next(deferred);
  17376. return;
  17377. }
  17378. closePendingRestoreOPS();
  17379. resolve();
  17380. }).catch(reason => {
  17381. if (reason instanceof _util.AbortException) {
  17382. return;
  17383. }
  17384. if (this.options.ignoreErrors) {
  17385. this.handler.send("UnsupportedFeature", {
  17386. featureId: _util.UNSUPPORTED_FEATURES.unknown
  17387. });
  17388. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  17389. closePendingRestoreOPS();
  17390. return;
  17391. }
  17392. throw reason;
  17393. });
  17394. },
  17395. getTextContent({
  17396. stream,
  17397. task,
  17398. resources,
  17399. stateManager = null,
  17400. normalizeWhitespace = false,
  17401. combineTextItems = false,
  17402. sink,
  17403. seenStyles = Object.create(null)
  17404. }) {
  17405. resources = resources || _primitives.Dict.empty;
  17406. stateManager = stateManager || new StateManager(new TextState());
  17407. var WhitespaceRegexp = /\s/g;
  17408. var textContent = {
  17409. items: [],
  17410. styles: Object.create(null)
  17411. };
  17412. var textContentItem = {
  17413. initialized: false,
  17414. str: [],
  17415. width: 0,
  17416. height: 0,
  17417. vertical: false,
  17418. lastAdvanceWidth: 0,
  17419. lastAdvanceHeight: 0,
  17420. textAdvanceScale: 0,
  17421. spaceWidth: 0,
  17422. fakeSpaceMin: Infinity,
  17423. fakeMultiSpaceMin: Infinity,
  17424. fakeMultiSpaceMax: -0,
  17425. textRunBreakAllowed: false,
  17426. transform: null,
  17427. fontName: null
  17428. };
  17429. var SPACE_FACTOR = 0.3;
  17430. var MULTI_SPACE_FACTOR = 1.5;
  17431. var MULTI_SPACE_FACTOR_MAX = 4;
  17432. var self = this;
  17433. var xref = this.xref;
  17434. var xobjs = null;
  17435. var skipEmptyXObjs = Object.create(null);
  17436. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  17437. var textState;
  17438. function ensureTextContentItem() {
  17439. if (textContentItem.initialized) {
  17440. return textContentItem;
  17441. }
  17442. var font = textState.font;
  17443. if (!(font.loadedName in seenStyles)) {
  17444. seenStyles[font.loadedName] = true;
  17445. textContent.styles[font.loadedName] = {
  17446. fontFamily: font.fallbackName,
  17447. ascent: font.ascent,
  17448. descent: font.descent,
  17449. vertical: !!font.vertical
  17450. };
  17451. }
  17452. textContentItem.fontName = font.loadedName;
  17453. var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  17454. if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  17455. const glyphHeight = font.bbox[3] - font.bbox[1];
  17456. if (glyphHeight > 0) {
  17457. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  17458. }
  17459. }
  17460. var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  17461. textContentItem.transform = trm;
  17462. if (!font.vertical) {
  17463. textContentItem.width = 0;
  17464. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  17465. textContentItem.vertical = false;
  17466. } else {
  17467. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  17468. textContentItem.height = 0;
  17469. textContentItem.vertical = true;
  17470. }
  17471. var a = textState.textLineMatrix[0];
  17472. var b = textState.textLineMatrix[1];
  17473. var scaleLineX = Math.sqrt(a * a + b * b);
  17474. a = textState.ctm[0];
  17475. b = textState.ctm[1];
  17476. var scaleCtmX = Math.sqrt(a * a + b * b);
  17477. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  17478. textContentItem.lastAdvanceWidth = 0;
  17479. textContentItem.lastAdvanceHeight = 0;
  17480. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  17481. if (spaceWidth) {
  17482. textContentItem.spaceWidth = spaceWidth;
  17483. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  17484. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  17485. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  17486. textContentItem.textRunBreakAllowed = !font.isMonospace;
  17487. } else {
  17488. textContentItem.spaceWidth = 0;
  17489. textContentItem.fakeSpaceMin = Infinity;
  17490. textContentItem.fakeMultiSpaceMin = Infinity;
  17491. textContentItem.fakeMultiSpaceMax = 0;
  17492. textContentItem.textRunBreakAllowed = false;
  17493. }
  17494. textContentItem.initialized = true;
  17495. return textContentItem;
  17496. }
  17497. function replaceWhitespace(str) {
  17498. var i = 0,
  17499. ii = str.length,
  17500. code;
  17501. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  17502. i++;
  17503. }
  17504. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  17505. }
  17506. function runBidiTransform(textChunk) {
  17507. var str = textChunk.str.join("");
  17508. var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
  17509. return {
  17510. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  17511. dir: bidiResult.dir,
  17512. width: textChunk.width,
  17513. height: textChunk.height,
  17514. transform: textChunk.transform,
  17515. fontName: textChunk.fontName
  17516. };
  17517. }
  17518. function handleSetFont(fontName, fontRef) {
  17519. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  17520. textState.font = translated.font;
  17521. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  17522. });
  17523. }
  17524. function buildTextContentItem(chars) {
  17525. var font = textState.font;
  17526. var textChunk = ensureTextContentItem();
  17527. var width = 0;
  17528. var height = 0;
  17529. var glyphs = font.charsToGlyphs(chars);
  17530. for (var i = 0; i < glyphs.length; i++) {
  17531. var glyph = glyphs[i];
  17532. var glyphWidth = null;
  17533. if (font.vertical && glyph.vmetric) {
  17534. glyphWidth = glyph.vmetric[0];
  17535. } else {
  17536. glyphWidth = glyph.width;
  17537. }
  17538. var glyphUnicode = glyph.unicode;
  17539. var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  17540. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  17541. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  17542. }
  17543. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  17544. var charSpacing = textState.charSpacing;
  17545. if (glyph.isSpace) {
  17546. var wordSpacing = textState.wordSpacing;
  17547. charSpacing += wordSpacing;
  17548. if (wordSpacing > 0) {
  17549. addFakeSpaces(wordSpacing, textChunk.str);
  17550. }
  17551. }
  17552. var tx = 0;
  17553. var ty = 0;
  17554. if (!font.vertical) {
  17555. var w0 = glyphWidth * textState.fontMatrix[0];
  17556. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  17557. width += tx;
  17558. } else {
  17559. var w1 = glyphWidth * textState.fontMatrix[0];
  17560. ty = w1 * textState.fontSize + charSpacing;
  17561. height += ty;
  17562. }
  17563. textState.translateTextMatrix(tx, ty);
  17564. textChunk.str.push(glyphUnicode);
  17565. }
  17566. if (!font.vertical) {
  17567. textChunk.lastAdvanceWidth = width;
  17568. textChunk.width += width;
  17569. } else {
  17570. textChunk.lastAdvanceHeight = height;
  17571. textChunk.height += Math.abs(height);
  17572. }
  17573. return textChunk;
  17574. }
  17575. function addFakeSpaces(width, strBuf) {
  17576. if (width < textContentItem.fakeSpaceMin) {
  17577. return;
  17578. }
  17579. if (width < textContentItem.fakeMultiSpaceMin) {
  17580. strBuf.push(" ");
  17581. return;
  17582. }
  17583. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  17584. while (fakeSpaces-- > 0) {
  17585. strBuf.push(" ");
  17586. }
  17587. }
  17588. function flushTextContentItem() {
  17589. if (!textContentItem.initialized) {
  17590. return;
  17591. }
  17592. if (!textContentItem.vertical) {
  17593. textContentItem.width *= textContentItem.textAdvanceScale;
  17594. } else {
  17595. textContentItem.height *= textContentItem.textAdvanceScale;
  17596. }
  17597. textContent.items.push(runBidiTransform(textContentItem));
  17598. textContentItem.initialized = false;
  17599. textContentItem.str.length = 0;
  17600. }
  17601. function enqueueChunk() {
  17602. const length = textContent.items.length;
  17603. if (length > 0) {
  17604. sink.enqueue(textContent, length);
  17605. textContent.items = [];
  17606. textContent.styles = Object.create(null);
  17607. }
  17608. }
  17609. var timeSlotManager = new TimeSlotManager();
  17610. return new Promise(function promiseBody(resolve, reject) {
  17611. const next = function (promise) {
  17612. enqueueChunk();
  17613. Promise.all([promise, sink.ready]).then(function () {
  17614. try {
  17615. promiseBody(resolve, reject);
  17616. } catch (ex) {
  17617. reject(ex);
  17618. }
  17619. }, reject);
  17620. };
  17621. task.ensureNotTerminated();
  17622. timeSlotManager.reset();
  17623. var stop,
  17624. operation = {},
  17625. args = [];
  17626. while (!(stop = timeSlotManager.check())) {
  17627. args.length = 0;
  17628. operation.args = args;
  17629. if (!preprocessor.read(operation)) {
  17630. break;
  17631. }
  17632. textState = stateManager.state;
  17633. var fn = operation.fn;
  17634. args = operation.args;
  17635. var advance, diff;
  17636. switch (fn | 0) {
  17637. case _util.OPS.setFont:
  17638. var fontNameArg = args[0].name,
  17639. fontSizeArg = args[1];
  17640. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  17641. break;
  17642. }
  17643. flushTextContentItem();
  17644. textState.fontName = fontNameArg;
  17645. textState.fontSize = fontSizeArg;
  17646. next(handleSetFont(fontNameArg, null));
  17647. return;
  17648. case _util.OPS.setTextRise:
  17649. flushTextContentItem();
  17650. textState.textRise = args[0];
  17651. break;
  17652. case _util.OPS.setHScale:
  17653. flushTextContentItem();
  17654. textState.textHScale = args[0] / 100;
  17655. break;
  17656. case _util.OPS.setLeading:
  17657. flushTextContentItem();
  17658. textState.leading = args[0];
  17659. break;
  17660. case _util.OPS.moveText:
  17661. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  17662. advance = args[0] - args[1];
  17663. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  17664. textState.translateTextLineMatrix(args[0], args[1]);
  17665. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  17666. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  17667. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  17668. addFakeSpaces(diff, textContentItem.str);
  17669. break;
  17670. }
  17671. flushTextContentItem();
  17672. textState.translateTextLineMatrix(args[0], args[1]);
  17673. textState.textMatrix = textState.textLineMatrix.slice();
  17674. break;
  17675. case _util.OPS.setLeadingMoveText:
  17676. flushTextContentItem();
  17677. textState.leading = -args[1];
  17678. textState.translateTextLineMatrix(args[0], args[1]);
  17679. textState.textMatrix = textState.textLineMatrix.slice();
  17680. break;
  17681. case _util.OPS.nextLine:
  17682. flushTextContentItem();
  17683. textState.carriageReturn();
  17684. break;
  17685. case _util.OPS.setTextMatrix:
  17686. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  17687. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  17688. textState.translateTextLineMatrix(advance.width, advance.height);
  17689. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  17690. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  17691. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  17692. addFakeSpaces(diff, textContentItem.str);
  17693. break;
  17694. }
  17695. flushTextContentItem();
  17696. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  17697. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  17698. break;
  17699. case _util.OPS.setCharSpacing:
  17700. textState.charSpacing = args[0];
  17701. break;
  17702. case _util.OPS.setWordSpacing:
  17703. textState.wordSpacing = args[0];
  17704. break;
  17705. case _util.OPS.beginText:
  17706. flushTextContentItem();
  17707. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  17708. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  17709. break;
  17710. case _util.OPS.showSpacedText:
  17711. if (!stateManager.state.font) {
  17712. self.ensureStateFont(stateManager.state);
  17713. continue;
  17714. }
  17715. var items = args[0];
  17716. var offset;
  17717. for (var j = 0, jj = items.length; j < jj; j++) {
  17718. if (typeof items[j] === "string") {
  17719. buildTextContentItem(items[j]);
  17720. } else if ((0, _util.isNum)(items[j])) {
  17721. ensureTextContentItem();
  17722. advance = items[j] * textState.fontSize / 1000;
  17723. var breakTextRun = false;
  17724. if (textState.font.vertical) {
  17725. offset = advance;
  17726. textState.translateTextMatrix(0, offset);
  17727. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  17728. if (!breakTextRun) {
  17729. textContentItem.height += offset;
  17730. }
  17731. } else {
  17732. advance = -advance;
  17733. offset = advance * textState.textHScale;
  17734. textState.translateTextMatrix(offset, 0);
  17735. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  17736. if (!breakTextRun) {
  17737. textContentItem.width += offset;
  17738. }
  17739. }
  17740. if (breakTextRun) {
  17741. flushTextContentItem();
  17742. } else if (advance > 0) {
  17743. addFakeSpaces(advance, textContentItem.str);
  17744. }
  17745. }
  17746. }
  17747. break;
  17748. case _util.OPS.showText:
  17749. if (!stateManager.state.font) {
  17750. self.ensureStateFont(stateManager.state);
  17751. continue;
  17752. }
  17753. buildTextContentItem(args[0]);
  17754. break;
  17755. case _util.OPS.nextLineShowText:
  17756. if (!stateManager.state.font) {
  17757. self.ensureStateFont(stateManager.state);
  17758. continue;
  17759. }
  17760. flushTextContentItem();
  17761. textState.carriageReturn();
  17762. buildTextContentItem(args[0]);
  17763. break;
  17764. case _util.OPS.nextLineSetSpacingShowText:
  17765. if (!stateManager.state.font) {
  17766. self.ensureStateFont(stateManager.state);
  17767. continue;
  17768. }
  17769. flushTextContentItem();
  17770. textState.wordSpacing = args[0];
  17771. textState.charSpacing = args[1];
  17772. textState.carriageReturn();
  17773. buildTextContentItem(args[2]);
  17774. break;
  17775. case _util.OPS.paintXObject:
  17776. flushTextContentItem();
  17777. if (!xobjs) {
  17778. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  17779. }
  17780. var name = args[0].name;
  17781. if (name && skipEmptyXObjs[name] !== undefined) {
  17782. break;
  17783. }
  17784. next(new Promise(function (resolveXObject, rejectXObject) {
  17785. if (!name) {
  17786. throw new _util.FormatError("XObject must be referred to by name.");
  17787. }
  17788. const xobj = xobjs.get(name);
  17789. if (!xobj) {
  17790. resolveXObject();
  17791. return;
  17792. }
  17793. if (!(0, _primitives.isStream)(xobj)) {
  17794. throw new _util.FormatError("XObject should be a stream");
  17795. }
  17796. const type = xobj.dict.get("Subtype");
  17797. if (!(0, _primitives.isName)(type)) {
  17798. throw new _util.FormatError("XObject should have a Name subtype");
  17799. }
  17800. if (type.name !== "Form") {
  17801. skipEmptyXObjs[name] = true;
  17802. resolveXObject();
  17803. return;
  17804. }
  17805. const currentState = stateManager.state.clone();
  17806. const xObjStateManager = new StateManager(currentState);
  17807. const matrix = xobj.dict.getArray("Matrix");
  17808. if (Array.isArray(matrix) && matrix.length === 6) {
  17809. xObjStateManager.transform(matrix);
  17810. }
  17811. enqueueChunk();
  17812. const sinkWrapper = {
  17813. enqueueInvoked: false,
  17814. enqueue(chunk, size) {
  17815. this.enqueueInvoked = true;
  17816. sink.enqueue(chunk, size);
  17817. },
  17818. get desiredSize() {
  17819. return sink.desiredSize;
  17820. },
  17821. get ready() {
  17822. return sink.ready;
  17823. }
  17824. };
  17825. self.getTextContent({
  17826. stream: xobj,
  17827. task,
  17828. resources: xobj.dict.get("Resources") || resources,
  17829. stateManager: xObjStateManager,
  17830. normalizeWhitespace,
  17831. combineTextItems,
  17832. sink: sinkWrapper,
  17833. seenStyles
  17834. }).then(function () {
  17835. if (!sinkWrapper.enqueueInvoked) {
  17836. skipEmptyXObjs[name] = true;
  17837. }
  17838. resolveXObject();
  17839. }, rejectXObject);
  17840. }).catch(function (reason) {
  17841. if (reason instanceof _util.AbortException) {
  17842. return;
  17843. }
  17844. if (self.options.ignoreErrors) {
  17845. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  17846. return;
  17847. }
  17848. throw reason;
  17849. }));
  17850. return;
  17851. case _util.OPS.setGState:
  17852. flushTextContentItem();
  17853. var dictName = args[0];
  17854. var extGState = resources.get("ExtGState");
  17855. if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
  17856. break;
  17857. }
  17858. var gState = extGState.get(dictName.name);
  17859. if (!(0, _primitives.isDict)(gState)) {
  17860. break;
  17861. }
  17862. var gStateFont = gState.get("Font");
  17863. if (gStateFont) {
  17864. textState.fontName = null;
  17865. textState.fontSize = gStateFont[1];
  17866. next(handleSetFont(null, gStateFont[0]));
  17867. return;
  17868. }
  17869. break;
  17870. }
  17871. if (textContent.items.length >= sink.desiredSize) {
  17872. stop = true;
  17873. break;
  17874. }
  17875. }
  17876. if (stop) {
  17877. next(deferred);
  17878. return;
  17879. }
  17880. flushTextContentItem();
  17881. enqueueChunk();
  17882. resolve();
  17883. }).catch(reason => {
  17884. if (reason instanceof _util.AbortException) {
  17885. return;
  17886. }
  17887. if (this.options.ignoreErrors) {
  17888. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  17889. flushTextContentItem();
  17890. enqueueChunk();
  17891. return;
  17892. }
  17893. throw reason;
  17894. });
  17895. },
  17896. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
  17897. const xref = this.xref;
  17898. let cidToGidBytes;
  17899. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  17900. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  17901. if (properties.composite) {
  17902. var cidSystemInfo = dict.get("CIDSystemInfo");
  17903. if ((0, _primitives.isDict)(cidSystemInfo)) {
  17904. properties.cidSystemInfo = {
  17905. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  17906. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  17907. supplement: cidSystemInfo.get("Supplement")
  17908. };
  17909. }
  17910. var cidToGidMap = dict.get("CIDToGIDMap");
  17911. if ((0, _primitives.isStream)(cidToGidMap)) {
  17912. cidToGidBytes = cidToGidMap.getBytes();
  17913. }
  17914. }
  17915. var differences = [];
  17916. var baseEncodingName = null;
  17917. var encoding;
  17918. if (dict.has("Encoding")) {
  17919. encoding = dict.get("Encoding");
  17920. if ((0, _primitives.isDict)(encoding)) {
  17921. baseEncodingName = encoding.get("BaseEncoding");
  17922. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  17923. if (encoding.has("Differences")) {
  17924. var diffEncoding = encoding.get("Differences");
  17925. var index = 0;
  17926. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  17927. var data = xref.fetchIfRef(diffEncoding[j]);
  17928. if ((0, _util.isNum)(data)) {
  17929. index = data;
  17930. } else if ((0, _primitives.isName)(data)) {
  17931. differences[index++] = data.name;
  17932. } else {
  17933. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  17934. }
  17935. }
  17936. }
  17937. } else if ((0, _primitives.isName)(encoding)) {
  17938. baseEncodingName = encoding.name;
  17939. } else {
  17940. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  17941. }
  17942. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  17943. baseEncodingName = null;
  17944. }
  17945. }
  17946. if (baseEncodingName) {
  17947. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
  17948. } else {
  17949. var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
  17950. var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
  17951. encoding = _encodings.StandardEncoding;
  17952. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  17953. encoding = _encodings.WinAnsiEncoding;
  17954. }
  17955. if (isSymbolicFont) {
  17956. encoding = _encodings.MacRomanEncoding;
  17957. if (!properties.file) {
  17958. if (/Symbol/i.test(properties.name)) {
  17959. encoding = _encodings.SymbolSetEncoding;
  17960. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  17961. encoding = _encodings.ZapfDingbatsEncoding;
  17962. }
  17963. }
  17964. }
  17965. properties.defaultEncoding = encoding;
  17966. }
  17967. properties.differences = differences;
  17968. properties.baseEncodingName = baseEncodingName;
  17969. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  17970. properties.dict = dict;
  17971. return toUnicodePromise.then(toUnicode => {
  17972. properties.toUnicode = toUnicode;
  17973. return this.buildToUnicode(properties);
  17974. }).then(toUnicode => {
  17975. properties.toUnicode = toUnicode;
  17976. if (cidToGidBytes) {
  17977. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, toUnicode);
  17978. }
  17979. return properties;
  17980. });
  17981. },
  17982. _buildSimpleFontToUnicode(properties, forceGlyphs = false) {
  17983. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  17984. const toUnicode = [];
  17985. const encoding = properties.defaultEncoding.slice();
  17986. const baseEncodingName = properties.baseEncodingName;
  17987. const differences = properties.differences;
  17988. for (const charcode in differences) {
  17989. const glyphName = differences[charcode];
  17990. if (glyphName === ".notdef") {
  17991. continue;
  17992. }
  17993. encoding[charcode] = glyphName;
  17994. }
  17995. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  17996. for (const charcode in encoding) {
  17997. let glyphName = encoding[charcode];
  17998. if (glyphName === "") {
  17999. continue;
  18000. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  18001. let code = 0;
  18002. switch (glyphName[0]) {
  18003. case "G":
  18004. if (glyphName.length === 3) {
  18005. code = parseInt(glyphName.substring(1), 16);
  18006. }
  18007. break;
  18008. case "g":
  18009. if (glyphName.length === 5) {
  18010. code = parseInt(glyphName.substring(1), 16);
  18011. }
  18012. break;
  18013. case "C":
  18014. case "c":
  18015. if (glyphName.length >= 3 && glyphName.length <= 4) {
  18016. const codeStr = glyphName.substring(1);
  18017. if (forceGlyphs) {
  18018. code = parseInt(codeStr, 16);
  18019. break;
  18020. }
  18021. code = +codeStr;
  18022. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  18023. return this._buildSimpleFontToUnicode(properties, true);
  18024. }
  18025. }
  18026. break;
  18027. default:
  18028. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  18029. if (unicode !== -1) {
  18030. code = unicode;
  18031. }
  18032. }
  18033. if (code > 0 && Number.isInteger(code)) {
  18034. if (baseEncodingName && code === +charcode) {
  18035. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  18036. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  18037. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  18038. continue;
  18039. }
  18040. }
  18041. toUnicode[charcode] = String.fromCodePoint(code);
  18042. }
  18043. continue;
  18044. }
  18045. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  18046. }
  18047. return new _fonts.ToUnicodeMap(toUnicode);
  18048. },
  18049. buildToUnicode(properties) {
  18050. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  18051. if (properties.hasIncludedToUnicodeMap) {
  18052. if (!properties.composite && properties.hasEncoding) {
  18053. properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
  18054. }
  18055. return Promise.resolve(properties.toUnicode);
  18056. }
  18057. if (!properties.composite) {
  18058. return Promise.resolve(this._buildSimpleFontToUnicode(properties));
  18059. }
  18060. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
  18061. const registry = properties.cidSystemInfo.registry;
  18062. const ordering = properties.cidSystemInfo.ordering;
  18063. const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
  18064. return _cmap.CMapFactory.create({
  18065. encoding: ucs2CMapName,
  18066. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18067. useCMap: null
  18068. }).then(function (ucs2CMap) {
  18069. const cMap = properties.cMap;
  18070. const toUnicode = [];
  18071. cMap.forEach(function (charcode, cid) {
  18072. if (cid > 0xffff) {
  18073. throw new _util.FormatError("Max size of CID is 65,535");
  18074. }
  18075. const ucs2 = ucs2CMap.lookup(cid);
  18076. if (ucs2) {
  18077. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  18078. }
  18079. });
  18080. return new _fonts.ToUnicodeMap(toUnicode);
  18081. });
  18082. }
  18083. return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  18084. },
  18085. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  18086. var cmapObj = toUnicode;
  18087. if ((0, _primitives.isName)(cmapObj)) {
  18088. return _cmap.CMapFactory.create({
  18089. encoding: cmapObj,
  18090. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18091. useCMap: null
  18092. }).then(function (cmap) {
  18093. if (cmap instanceof _cmap.IdentityCMap) {
  18094. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  18095. }
  18096. return new _fonts.ToUnicodeMap(cmap.getMap());
  18097. });
  18098. } else if ((0, _primitives.isStream)(cmapObj)) {
  18099. return _cmap.CMapFactory.create({
  18100. encoding: cmapObj,
  18101. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18102. useCMap: null
  18103. }).then(function (cmap) {
  18104. if (cmap instanceof _cmap.IdentityCMap) {
  18105. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  18106. }
  18107. var map = new Array(cmap.length);
  18108. cmap.forEach(function (charCode, token) {
  18109. var str = [];
  18110. for (var k = 0; k < token.length; k += 2) {
  18111. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  18112. if ((w1 & 0xf800) !== 0xd800) {
  18113. str.push(w1);
  18114. continue;
  18115. }
  18116. k += 2;
  18117. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  18118. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  18119. }
  18120. map[charCode] = String.fromCodePoint.apply(String, str);
  18121. });
  18122. return new _fonts.ToUnicodeMap(map);
  18123. }, reason => {
  18124. if (reason instanceof _util.AbortException) {
  18125. return null;
  18126. }
  18127. if (this.options.ignoreErrors) {
  18128. this.handler.send("UnsupportedFeature", {
  18129. featureId: _util.UNSUPPORTED_FEATURES.font
  18130. });
  18131. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  18132. return null;
  18133. }
  18134. throw reason;
  18135. });
  18136. }
  18137. return Promise.resolve(null);
  18138. },
  18139. readCidToGidMap(glyphsData, toUnicode) {
  18140. var result = [];
  18141. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  18142. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  18143. const code = j >> 1;
  18144. if (glyphID === 0 && !toUnicode.has(code)) {
  18145. continue;
  18146. }
  18147. result[code] = glyphID;
  18148. }
  18149. return result;
  18150. },
  18151. extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
  18152. var xref = this.xref;
  18153. var glyphsWidths = [];
  18154. var defaultWidth = 0;
  18155. var glyphsVMetrics = [];
  18156. var defaultVMetrics;
  18157. var i, ii, j, jj, start, code, widths;
  18158. if (properties.composite) {
  18159. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  18160. widths = dict.get("W");
  18161. if (widths) {
  18162. for (i = 0, ii = widths.length; i < ii; i++) {
  18163. start = xref.fetchIfRef(widths[i++]);
  18164. code = xref.fetchIfRef(widths[i]);
  18165. if (Array.isArray(code)) {
  18166. for (j = 0, jj = code.length; j < jj; j++) {
  18167. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  18168. }
  18169. } else {
  18170. var width = xref.fetchIfRef(widths[++i]);
  18171. for (j = start; j <= code; j++) {
  18172. glyphsWidths[j] = width;
  18173. }
  18174. }
  18175. }
  18176. }
  18177. if (properties.vertical) {
  18178. var vmetrics = dict.getArray("DW2") || [880, -1000];
  18179. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  18180. vmetrics = dict.get("W2");
  18181. if (vmetrics) {
  18182. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  18183. start = xref.fetchIfRef(vmetrics[i++]);
  18184. code = xref.fetchIfRef(vmetrics[i]);
  18185. if (Array.isArray(code)) {
  18186. for (j = 0, jj = code.length; j < jj; j++) {
  18187. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  18188. }
  18189. } else {
  18190. var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  18191. for (j = start; j <= code; j++) {
  18192. glyphsVMetrics[j] = vmetric;
  18193. }
  18194. }
  18195. }
  18196. }
  18197. }
  18198. } else {
  18199. var firstChar = properties.firstChar;
  18200. widths = dict.get("Widths");
  18201. if (widths) {
  18202. j = firstChar;
  18203. for (i = 0, ii = widths.length; i < ii; i++) {
  18204. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  18205. }
  18206. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  18207. } else {
  18208. var baseFontName = dict.get("BaseFont");
  18209. if ((0, _primitives.isName)(baseFontName)) {
  18210. var metrics = this.getBaseFontMetrics(baseFontName.name);
  18211. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  18212. defaultWidth = metrics.defaultWidth;
  18213. }
  18214. }
  18215. }
  18216. var isMonospace = true;
  18217. var firstWidth = defaultWidth;
  18218. for (var glyph in glyphsWidths) {
  18219. var glyphWidth = glyphsWidths[glyph];
  18220. if (!glyphWidth) {
  18221. continue;
  18222. }
  18223. if (!firstWidth) {
  18224. firstWidth = glyphWidth;
  18225. continue;
  18226. }
  18227. if (firstWidth !== glyphWidth) {
  18228. isMonospace = false;
  18229. break;
  18230. }
  18231. }
  18232. if (isMonospace) {
  18233. properties.flags |= _fonts.FontFlags.FixedPitch;
  18234. }
  18235. properties.defaultWidth = defaultWidth;
  18236. properties.widths = glyphsWidths;
  18237. properties.defaultVMetrics = defaultVMetrics;
  18238. properties.vmetrics = glyphsVMetrics;
  18239. },
  18240. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  18241. var fontNameWoStyle = baseFontName.split("-")[0];
  18242. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  18243. },
  18244. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  18245. var defaultWidth = 0;
  18246. var widths = [];
  18247. var monospace = false;
  18248. var stdFontMap = (0, _standard_fonts.getStdFontMap)();
  18249. var lookupName = stdFontMap[name] || name;
  18250. var Metrics = (0, _metrics.getMetrics)();
  18251. if (!(lookupName in Metrics)) {
  18252. if (this.isSerifFont(name)) {
  18253. lookupName = "Times-Roman";
  18254. } else {
  18255. lookupName = "Helvetica";
  18256. }
  18257. }
  18258. var glyphWidths = Metrics[lookupName];
  18259. if ((0, _util.isNum)(glyphWidths)) {
  18260. defaultWidth = glyphWidths;
  18261. monospace = true;
  18262. } else {
  18263. widths = glyphWidths();
  18264. }
  18265. return {
  18266. defaultWidth,
  18267. monospace,
  18268. widths
  18269. };
  18270. },
  18271. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  18272. var widths = Object.create(null);
  18273. var differences = properties.differences;
  18274. var encoding = properties.defaultEncoding;
  18275. for (var charCode = 0; charCode < 256; charCode++) {
  18276. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  18277. widths[charCode] = widthsByGlyphName[differences[charCode]];
  18278. continue;
  18279. }
  18280. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  18281. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  18282. continue;
  18283. }
  18284. }
  18285. return widths;
  18286. },
  18287. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) {
  18288. var baseDict = dict;
  18289. var type = dict.get("Subtype");
  18290. if (!(0, _primitives.isName)(type)) {
  18291. throw new _util.FormatError("invalid font Subtype");
  18292. }
  18293. var composite = false;
  18294. var uint8array;
  18295. if (type.name === "Type0") {
  18296. var df = dict.get("DescendantFonts");
  18297. if (!df) {
  18298. throw new _util.FormatError("Descendant fonts are not specified");
  18299. }
  18300. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  18301. type = dict.get("Subtype");
  18302. if (!(0, _primitives.isName)(type)) {
  18303. throw new _util.FormatError("invalid font Subtype");
  18304. }
  18305. composite = true;
  18306. }
  18307. var descriptor = dict.get("FontDescriptor");
  18308. if (descriptor) {
  18309. var hash = new _murmurhash.MurmurHash3_64();
  18310. var encoding = baseDict.getRaw("Encoding");
  18311. if ((0, _primitives.isName)(encoding)) {
  18312. hash.update(encoding.name);
  18313. } else if ((0, _primitives.isRef)(encoding)) {
  18314. hash.update(encoding.toString());
  18315. } else if ((0, _primitives.isDict)(encoding)) {
  18316. var keys = encoding.getKeys();
  18317. for (var i = 0, ii = keys.length; i < ii; i++) {
  18318. var entry = encoding.getRaw(keys[i]);
  18319. if ((0, _primitives.isName)(entry)) {
  18320. hash.update(entry.name);
  18321. } else if ((0, _primitives.isRef)(entry)) {
  18322. hash.update(entry.toString());
  18323. } else if (Array.isArray(entry)) {
  18324. var diffLength = entry.length,
  18325. diffBuf = new Array(diffLength);
  18326. for (var j = 0; j < diffLength; j++) {
  18327. var diffEntry = entry[j];
  18328. if ((0, _primitives.isName)(diffEntry)) {
  18329. diffBuf[j] = diffEntry.name;
  18330. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  18331. diffBuf[j] = diffEntry.toString();
  18332. }
  18333. }
  18334. hash.update(diffBuf.join());
  18335. }
  18336. }
  18337. }
  18338. const firstChar = dict.get("FirstChar") || 0;
  18339. const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  18340. hash.update(`${firstChar}-${lastChar}`);
  18341. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  18342. if ((0, _primitives.isStream)(toUnicode)) {
  18343. var stream = toUnicode.str || toUnicode;
  18344. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  18345. hash.update(uint8array);
  18346. } else if ((0, _primitives.isName)(toUnicode)) {
  18347. hash.update(toUnicode.name);
  18348. }
  18349. var widths = dict.get("Widths") || baseDict.get("Widths");
  18350. if (widths) {
  18351. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  18352. hash.update(uint8array);
  18353. }
  18354. }
  18355. return {
  18356. descriptor,
  18357. dict,
  18358. baseDict,
  18359. composite,
  18360. type: type.name,
  18361. hash: hash ? hash.hexdigest() : ""
  18362. };
  18363. },
  18364. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) {
  18365. var baseDict = preEvaluatedFont.baseDict;
  18366. var dict = preEvaluatedFont.dict;
  18367. var composite = preEvaluatedFont.composite;
  18368. var descriptor = preEvaluatedFont.descriptor;
  18369. var type = preEvaluatedFont.type;
  18370. var maxCharIndex = composite ? 0xffff : 0xff;
  18371. var properties;
  18372. const firstChar = dict.get("FirstChar") || 0;
  18373. const lastChar = dict.get("LastChar") || maxCharIndex;
  18374. if (!descriptor) {
  18375. if (type === "Type3") {
  18376. descriptor = new _primitives.Dict(null);
  18377. descriptor.set("FontName", _primitives.Name.get(type));
  18378. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  18379. } else {
  18380. var baseFontName = dict.get("BaseFont");
  18381. if (!(0, _primitives.isName)(baseFontName)) {
  18382. throw new _util.FormatError("Base font is not specified");
  18383. }
  18384. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  18385. var metrics = this.getBaseFontMetrics(baseFontName);
  18386. var fontNameWoStyle = baseFontName.split("-")[0];
  18387. var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic);
  18388. properties = {
  18389. type,
  18390. name: baseFontName,
  18391. widths: metrics.widths,
  18392. defaultWidth: metrics.defaultWidth,
  18393. flags,
  18394. firstChar,
  18395. lastChar
  18396. };
  18397. const widths = dict.get("Widths");
  18398. return this.extractDataStructures(dict, dict, properties).then(properties => {
  18399. if (widths) {
  18400. const glyphWidths = [];
  18401. let j = firstChar;
  18402. for (let i = 0, ii = widths.length; i < ii; i++) {
  18403. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  18404. }
  18405. properties.widths = glyphWidths;
  18406. } else {
  18407. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  18408. }
  18409. return new _fonts.Font(baseFontName, null, properties);
  18410. });
  18411. }
  18412. }
  18413. var fontName = descriptor.get("FontName");
  18414. var baseFont = dict.get("BaseFont");
  18415. if ((0, _util.isString)(fontName)) {
  18416. fontName = _primitives.Name.get(fontName);
  18417. }
  18418. if ((0, _util.isString)(baseFont)) {
  18419. baseFont = _primitives.Name.get(baseFont);
  18420. }
  18421. if (type !== "Type3") {
  18422. var fontNameStr = fontName && fontName.name;
  18423. var baseFontStr = baseFont && baseFont.name;
  18424. if (fontNameStr !== baseFontStr) {
  18425. (0, _util.info)(`The FontDescriptor\'s FontName is "${fontNameStr}" but ` + `should be the same as the Font\'s BaseFont "${baseFontStr}".`);
  18426. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  18427. fontName = baseFont;
  18428. }
  18429. }
  18430. }
  18431. fontName = fontName || baseFont;
  18432. if (!(0, _primitives.isName)(fontName)) {
  18433. throw new _util.FormatError("invalid font name");
  18434. }
  18435. var fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  18436. if (fontFile) {
  18437. if (fontFile.dict) {
  18438. var subtype = fontFile.dict.get("Subtype");
  18439. if (subtype) {
  18440. subtype = subtype.name;
  18441. }
  18442. var length1 = fontFile.dict.get("Length1");
  18443. var length2 = fontFile.dict.get("Length2");
  18444. var length3 = fontFile.dict.get("Length3");
  18445. }
  18446. }
  18447. properties = {
  18448. type,
  18449. name: fontName.name,
  18450. subtype,
  18451. file: fontFile,
  18452. length1,
  18453. length2,
  18454. length3,
  18455. loadedName: baseDict.loadedName,
  18456. composite,
  18457. wideChars: composite,
  18458. fixedPitch: false,
  18459. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  18460. firstChar: firstChar || 0,
  18461. lastChar: lastChar || maxCharIndex,
  18462. bbox: descriptor.getArray("FontBBox"),
  18463. ascent: descriptor.get("Ascent"),
  18464. descent: descriptor.get("Descent"),
  18465. xHeight: descriptor.get("XHeight"),
  18466. capHeight: descriptor.get("CapHeight"),
  18467. flags: descriptor.get("Flags"),
  18468. italicAngle: descriptor.get("ItalicAngle"),
  18469. isType3Font: false
  18470. };
  18471. var cMapPromise;
  18472. if (composite) {
  18473. var cidEncoding = baseDict.get("Encoding");
  18474. if ((0, _primitives.isName)(cidEncoding)) {
  18475. properties.cidEncoding = cidEncoding.name;
  18476. }
  18477. cMapPromise = _cmap.CMapFactory.create({
  18478. encoding: cidEncoding,
  18479. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18480. useCMap: null
  18481. }).then(function (cMap) {
  18482. properties.cMap = cMap;
  18483. properties.vertical = properties.cMap.vertical;
  18484. });
  18485. } else {
  18486. cMapPromise = Promise.resolve(undefined);
  18487. }
  18488. return cMapPromise.then(() => {
  18489. return this.extractDataStructures(dict, baseDict, properties);
  18490. }).then(properties => {
  18491. this.extractWidths(dict, descriptor, properties);
  18492. if (type === "Type3") {
  18493. properties.isType3Font = true;
  18494. }
  18495. return new _fonts.Font(fontName.name, fontFile, properties);
  18496. });
  18497. }
  18498. };
  18499. PartialEvaluator.buildFontPaths = function (font, glyphs, handler) {
  18500. function buildPath(fontChar) {
  18501. if (font.renderer.hasBuiltPath(fontChar)) {
  18502. return;
  18503. }
  18504. handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]);
  18505. }
  18506. for (const glyph of glyphs) {
  18507. buildPath(glyph.fontChar);
  18508. const accent = glyph.accent;
  18509. if (accent && accent.fontChar) {
  18510. buildPath(accent.fontChar);
  18511. }
  18512. }
  18513. };
  18514. PartialEvaluator.getFallbackFontDict = function () {
  18515. if (this._fallbackFontDict) {
  18516. return this._fallbackFontDict;
  18517. }
  18518. const dict = new _primitives.Dict();
  18519. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  18520. dict.set("Type", _primitives.Name.get("FallbackType"));
  18521. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18522. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  18523. return this._fallbackFontDict = dict;
  18524. };
  18525. return PartialEvaluator;
  18526. }();
  18527. exports.PartialEvaluator = PartialEvaluator;
  18528. var TranslatedFont = function TranslatedFontClosure() {
  18529. function TranslatedFont(loadedName, font, dict) {
  18530. this.loadedName = loadedName;
  18531. this.font = font;
  18532. this.dict = dict;
  18533. this.type3Loaded = null;
  18534. this.sent = false;
  18535. }
  18536. TranslatedFont.prototype = {
  18537. send(handler) {
  18538. if (this.sent) {
  18539. return;
  18540. }
  18541. this.sent = true;
  18542. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData()]);
  18543. },
  18544. fallback(handler) {
  18545. if (!this.font.data) {
  18546. return;
  18547. }
  18548. this.font.disableFontFace = true;
  18549. const glyphs = this.font.glyphCacheValues;
  18550. PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
  18551. },
  18552. loadType3Data(evaluator, resources, parentOperatorList, task) {
  18553. if (!this.font.isType3Font) {
  18554. throw new Error("Must be a Type3 font.");
  18555. }
  18556. if (this.type3Loaded) {
  18557. return this.type3Loaded;
  18558. }
  18559. var type3Options = Object.create(evaluator.options);
  18560. type3Options.ignoreErrors = false;
  18561. type3Options.nativeImageDecoderSupport = _util.NativeImageDecoding.NONE;
  18562. var type3Evaluator = evaluator.clone(type3Options);
  18563. type3Evaluator.parsingType3Font = true;
  18564. var translatedFont = this.font;
  18565. var loadCharProcsPromise = Promise.resolve();
  18566. var charProcs = this.dict.get("CharProcs");
  18567. var fontResources = this.dict.get("Resources") || resources;
  18568. var charProcKeys = charProcs.getKeys();
  18569. var charProcOperatorList = Object.create(null);
  18570. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  18571. const key = charProcKeys[i];
  18572. loadCharProcsPromise = loadCharProcsPromise.then(function () {
  18573. var glyphStream = charProcs.get(key);
  18574. var operatorList = new _operator_list.OperatorList();
  18575. return type3Evaluator.getOperatorList({
  18576. stream: glyphStream,
  18577. task,
  18578. resources: fontResources,
  18579. operatorList
  18580. }).then(function () {
  18581. charProcOperatorList[key] = operatorList.getIR();
  18582. parentOperatorList.addDependencies(operatorList.dependencies);
  18583. }).catch(function (reason) {
  18584. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  18585. var operatorList = new _operator_list.OperatorList();
  18586. charProcOperatorList[key] = operatorList.getIR();
  18587. });
  18588. });
  18589. }
  18590. this.type3Loaded = loadCharProcsPromise.then(function () {
  18591. translatedFont.charProcOperatorList = charProcOperatorList;
  18592. });
  18593. return this.type3Loaded;
  18594. }
  18595. };
  18596. return TranslatedFont;
  18597. }();
  18598. var StateManager = function StateManagerClosure() {
  18599. function StateManager(initialState) {
  18600. this.state = initialState;
  18601. this.stateStack = [];
  18602. }
  18603. StateManager.prototype = {
  18604. save() {
  18605. var old = this.state;
  18606. this.stateStack.push(this.state);
  18607. this.state = old.clone();
  18608. },
  18609. restore() {
  18610. var prev = this.stateStack.pop();
  18611. if (prev) {
  18612. this.state = prev;
  18613. }
  18614. },
  18615. transform(args) {
  18616. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  18617. }
  18618. };
  18619. return StateManager;
  18620. }();
  18621. var TextState = function TextStateClosure() {
  18622. function TextState() {
  18623. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  18624. this.fontName = null;
  18625. this.fontSize = 0;
  18626. this.font = null;
  18627. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  18628. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  18629. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  18630. this.charSpacing = 0;
  18631. this.wordSpacing = 0;
  18632. this.leading = 0;
  18633. this.textHScale = 1;
  18634. this.textRise = 0;
  18635. }
  18636. TextState.prototype = {
  18637. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  18638. var m = this.textMatrix;
  18639. m[0] = a;
  18640. m[1] = b;
  18641. m[2] = c;
  18642. m[3] = d;
  18643. m[4] = e;
  18644. m[5] = f;
  18645. },
  18646. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  18647. var m = this.textLineMatrix;
  18648. m[0] = a;
  18649. m[1] = b;
  18650. m[2] = c;
  18651. m[3] = d;
  18652. m[4] = e;
  18653. m[5] = f;
  18654. },
  18655. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  18656. var m = this.textMatrix;
  18657. m[4] = m[0] * x + m[2] * y + m[4];
  18658. m[5] = m[1] * x + m[3] * y + m[5];
  18659. },
  18660. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  18661. var m = this.textLineMatrix;
  18662. m[4] = m[0] * x + m[2] * y + m[4];
  18663. m[5] = m[1] * x + m[3] * y + m[5];
  18664. },
  18665. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  18666. var font = this.font;
  18667. if (!font) {
  18668. return null;
  18669. }
  18670. var m = this.textLineMatrix;
  18671. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  18672. return null;
  18673. }
  18674. var txDiff = e - m[4],
  18675. tyDiff = f - m[5];
  18676. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  18677. return null;
  18678. }
  18679. var tx,
  18680. ty,
  18681. denominator = a * d - b * c;
  18682. if (font.vertical) {
  18683. tx = -tyDiff * c / denominator;
  18684. ty = tyDiff * a / denominator;
  18685. } else {
  18686. tx = txDiff * d / denominator;
  18687. ty = -txDiff * b / denominator;
  18688. }
  18689. return {
  18690. width: tx,
  18691. height: ty,
  18692. value: font.vertical ? ty : tx
  18693. };
  18694. },
  18695. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  18696. var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
  18697. return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
  18698. },
  18699. carriageReturn: function TextState_carriageReturn() {
  18700. this.translateTextLineMatrix(0, -this.leading);
  18701. this.textMatrix = this.textLineMatrix.slice();
  18702. },
  18703. clone: function TextState_clone() {
  18704. var clone = Object.create(this);
  18705. clone.textMatrix = this.textMatrix.slice();
  18706. clone.textLineMatrix = this.textLineMatrix.slice();
  18707. clone.fontMatrix = this.fontMatrix.slice();
  18708. return clone;
  18709. }
  18710. };
  18711. return TextState;
  18712. }();
  18713. var EvalState = function EvalStateClosure() {
  18714. function EvalState() {
  18715. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  18716. this.font = null;
  18717. this.textRenderingMode = _util.TextRenderingMode.FILL;
  18718. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  18719. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  18720. }
  18721. EvalState.prototype = {
  18722. clone: function CanvasExtraState_clone() {
  18723. return Object.create(this);
  18724. }
  18725. };
  18726. return EvalState;
  18727. }();
  18728. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  18729. var getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  18730. t["w"] = {
  18731. id: _util.OPS.setLineWidth,
  18732. numArgs: 1,
  18733. variableArgs: false
  18734. };
  18735. t["J"] = {
  18736. id: _util.OPS.setLineCap,
  18737. numArgs: 1,
  18738. variableArgs: false
  18739. };
  18740. t["j"] = {
  18741. id: _util.OPS.setLineJoin,
  18742. numArgs: 1,
  18743. variableArgs: false
  18744. };
  18745. t["M"] = {
  18746. id: _util.OPS.setMiterLimit,
  18747. numArgs: 1,
  18748. variableArgs: false
  18749. };
  18750. t["d"] = {
  18751. id: _util.OPS.setDash,
  18752. numArgs: 2,
  18753. variableArgs: false
  18754. };
  18755. t["ri"] = {
  18756. id: _util.OPS.setRenderingIntent,
  18757. numArgs: 1,
  18758. variableArgs: false
  18759. };
  18760. t["i"] = {
  18761. id: _util.OPS.setFlatness,
  18762. numArgs: 1,
  18763. variableArgs: false
  18764. };
  18765. t["gs"] = {
  18766. id: _util.OPS.setGState,
  18767. numArgs: 1,
  18768. variableArgs: false
  18769. };
  18770. t["q"] = {
  18771. id: _util.OPS.save,
  18772. numArgs: 0,
  18773. variableArgs: false
  18774. };
  18775. t["Q"] = {
  18776. id: _util.OPS.restore,
  18777. numArgs: 0,
  18778. variableArgs: false
  18779. };
  18780. t["cm"] = {
  18781. id: _util.OPS.transform,
  18782. numArgs: 6,
  18783. variableArgs: false
  18784. };
  18785. t["m"] = {
  18786. id: _util.OPS.moveTo,
  18787. numArgs: 2,
  18788. variableArgs: false
  18789. };
  18790. t["l"] = {
  18791. id: _util.OPS.lineTo,
  18792. numArgs: 2,
  18793. variableArgs: false
  18794. };
  18795. t["c"] = {
  18796. id: _util.OPS.curveTo,
  18797. numArgs: 6,
  18798. variableArgs: false
  18799. };
  18800. t["v"] = {
  18801. id: _util.OPS.curveTo2,
  18802. numArgs: 4,
  18803. variableArgs: false
  18804. };
  18805. t["y"] = {
  18806. id: _util.OPS.curveTo3,
  18807. numArgs: 4,
  18808. variableArgs: false
  18809. };
  18810. t["h"] = {
  18811. id: _util.OPS.closePath,
  18812. numArgs: 0,
  18813. variableArgs: false
  18814. };
  18815. t["re"] = {
  18816. id: _util.OPS.rectangle,
  18817. numArgs: 4,
  18818. variableArgs: false
  18819. };
  18820. t["S"] = {
  18821. id: _util.OPS.stroke,
  18822. numArgs: 0,
  18823. variableArgs: false
  18824. };
  18825. t["s"] = {
  18826. id: _util.OPS.closeStroke,
  18827. numArgs: 0,
  18828. variableArgs: false
  18829. };
  18830. t["f"] = {
  18831. id: _util.OPS.fill,
  18832. numArgs: 0,
  18833. variableArgs: false
  18834. };
  18835. t["F"] = {
  18836. id: _util.OPS.fill,
  18837. numArgs: 0,
  18838. variableArgs: false
  18839. };
  18840. t["f*"] = {
  18841. id: _util.OPS.eoFill,
  18842. numArgs: 0,
  18843. variableArgs: false
  18844. };
  18845. t["B"] = {
  18846. id: _util.OPS.fillStroke,
  18847. numArgs: 0,
  18848. variableArgs: false
  18849. };
  18850. t["B*"] = {
  18851. id: _util.OPS.eoFillStroke,
  18852. numArgs: 0,
  18853. variableArgs: false
  18854. };
  18855. t["b"] = {
  18856. id: _util.OPS.closeFillStroke,
  18857. numArgs: 0,
  18858. variableArgs: false
  18859. };
  18860. t["b*"] = {
  18861. id: _util.OPS.closeEOFillStroke,
  18862. numArgs: 0,
  18863. variableArgs: false
  18864. };
  18865. t["n"] = {
  18866. id: _util.OPS.endPath,
  18867. numArgs: 0,
  18868. variableArgs: false
  18869. };
  18870. t["W"] = {
  18871. id: _util.OPS.clip,
  18872. numArgs: 0,
  18873. variableArgs: false
  18874. };
  18875. t["W*"] = {
  18876. id: _util.OPS.eoClip,
  18877. numArgs: 0,
  18878. variableArgs: false
  18879. };
  18880. t["BT"] = {
  18881. id: _util.OPS.beginText,
  18882. numArgs: 0,
  18883. variableArgs: false
  18884. };
  18885. t["ET"] = {
  18886. id: _util.OPS.endText,
  18887. numArgs: 0,
  18888. variableArgs: false
  18889. };
  18890. t["Tc"] = {
  18891. id: _util.OPS.setCharSpacing,
  18892. numArgs: 1,
  18893. variableArgs: false
  18894. };
  18895. t["Tw"] = {
  18896. id: _util.OPS.setWordSpacing,
  18897. numArgs: 1,
  18898. variableArgs: false
  18899. };
  18900. t["Tz"] = {
  18901. id: _util.OPS.setHScale,
  18902. numArgs: 1,
  18903. variableArgs: false
  18904. };
  18905. t["TL"] = {
  18906. id: _util.OPS.setLeading,
  18907. numArgs: 1,
  18908. variableArgs: false
  18909. };
  18910. t["Tf"] = {
  18911. id: _util.OPS.setFont,
  18912. numArgs: 2,
  18913. variableArgs: false
  18914. };
  18915. t["Tr"] = {
  18916. id: _util.OPS.setTextRenderingMode,
  18917. numArgs: 1,
  18918. variableArgs: false
  18919. };
  18920. t["Ts"] = {
  18921. id: _util.OPS.setTextRise,
  18922. numArgs: 1,
  18923. variableArgs: false
  18924. };
  18925. t["Td"] = {
  18926. id: _util.OPS.moveText,
  18927. numArgs: 2,
  18928. variableArgs: false
  18929. };
  18930. t["TD"] = {
  18931. id: _util.OPS.setLeadingMoveText,
  18932. numArgs: 2,
  18933. variableArgs: false
  18934. };
  18935. t["Tm"] = {
  18936. id: _util.OPS.setTextMatrix,
  18937. numArgs: 6,
  18938. variableArgs: false
  18939. };
  18940. t["T*"] = {
  18941. id: _util.OPS.nextLine,
  18942. numArgs: 0,
  18943. variableArgs: false
  18944. };
  18945. t["Tj"] = {
  18946. id: _util.OPS.showText,
  18947. numArgs: 1,
  18948. variableArgs: false
  18949. };
  18950. t["TJ"] = {
  18951. id: _util.OPS.showSpacedText,
  18952. numArgs: 1,
  18953. variableArgs: false
  18954. };
  18955. t["'"] = {
  18956. id: _util.OPS.nextLineShowText,
  18957. numArgs: 1,
  18958. variableArgs: false
  18959. };
  18960. t['"'] = {
  18961. id: _util.OPS.nextLineSetSpacingShowText,
  18962. numArgs: 3,
  18963. variableArgs: false
  18964. };
  18965. t["d0"] = {
  18966. id: _util.OPS.setCharWidth,
  18967. numArgs: 2,
  18968. variableArgs: false
  18969. };
  18970. t["d1"] = {
  18971. id: _util.OPS.setCharWidthAndBounds,
  18972. numArgs: 6,
  18973. variableArgs: false
  18974. };
  18975. t["CS"] = {
  18976. id: _util.OPS.setStrokeColorSpace,
  18977. numArgs: 1,
  18978. variableArgs: false
  18979. };
  18980. t["cs"] = {
  18981. id: _util.OPS.setFillColorSpace,
  18982. numArgs: 1,
  18983. variableArgs: false
  18984. };
  18985. t["SC"] = {
  18986. id: _util.OPS.setStrokeColor,
  18987. numArgs: 4,
  18988. variableArgs: true
  18989. };
  18990. t["SCN"] = {
  18991. id: _util.OPS.setStrokeColorN,
  18992. numArgs: 33,
  18993. variableArgs: true
  18994. };
  18995. t["sc"] = {
  18996. id: _util.OPS.setFillColor,
  18997. numArgs: 4,
  18998. variableArgs: true
  18999. };
  19000. t["scn"] = {
  19001. id: _util.OPS.setFillColorN,
  19002. numArgs: 33,
  19003. variableArgs: true
  19004. };
  19005. t["G"] = {
  19006. id: _util.OPS.setStrokeGray,
  19007. numArgs: 1,
  19008. variableArgs: false
  19009. };
  19010. t["g"] = {
  19011. id: _util.OPS.setFillGray,
  19012. numArgs: 1,
  19013. variableArgs: false
  19014. };
  19015. t["RG"] = {
  19016. id: _util.OPS.setStrokeRGBColor,
  19017. numArgs: 3,
  19018. variableArgs: false
  19019. };
  19020. t["rg"] = {
  19021. id: _util.OPS.setFillRGBColor,
  19022. numArgs: 3,
  19023. variableArgs: false
  19024. };
  19025. t["K"] = {
  19026. id: _util.OPS.setStrokeCMYKColor,
  19027. numArgs: 4,
  19028. variableArgs: false
  19029. };
  19030. t["k"] = {
  19031. id: _util.OPS.setFillCMYKColor,
  19032. numArgs: 4,
  19033. variableArgs: false
  19034. };
  19035. t["sh"] = {
  19036. id: _util.OPS.shadingFill,
  19037. numArgs: 1,
  19038. variableArgs: false
  19039. };
  19040. t["BI"] = {
  19041. id: _util.OPS.beginInlineImage,
  19042. numArgs: 0,
  19043. variableArgs: false
  19044. };
  19045. t["ID"] = {
  19046. id: _util.OPS.beginImageData,
  19047. numArgs: 0,
  19048. variableArgs: false
  19049. };
  19050. t["EI"] = {
  19051. id: _util.OPS.endInlineImage,
  19052. numArgs: 1,
  19053. variableArgs: false
  19054. };
  19055. t["Do"] = {
  19056. id: _util.OPS.paintXObject,
  19057. numArgs: 1,
  19058. variableArgs: false
  19059. };
  19060. t["MP"] = {
  19061. id: _util.OPS.markPoint,
  19062. numArgs: 1,
  19063. variableArgs: false
  19064. };
  19065. t["DP"] = {
  19066. id: _util.OPS.markPointProps,
  19067. numArgs: 2,
  19068. variableArgs: false
  19069. };
  19070. t["BMC"] = {
  19071. id: _util.OPS.beginMarkedContent,
  19072. numArgs: 1,
  19073. variableArgs: false
  19074. };
  19075. t["BDC"] = {
  19076. id: _util.OPS.beginMarkedContentProps,
  19077. numArgs: 2,
  19078. variableArgs: false
  19079. };
  19080. t["EMC"] = {
  19081. id: _util.OPS.endMarkedContent,
  19082. numArgs: 0,
  19083. variableArgs: false
  19084. };
  19085. t["BX"] = {
  19086. id: _util.OPS.beginCompat,
  19087. numArgs: 0,
  19088. variableArgs: false
  19089. };
  19090. t["EX"] = {
  19091. id: _util.OPS.endCompat,
  19092. numArgs: 0,
  19093. variableArgs: false
  19094. };
  19095. t["BM"] = null;
  19096. t["BD"] = null;
  19097. t["true"] = null;
  19098. t["fa"] = null;
  19099. t["fal"] = null;
  19100. t["fals"] = null;
  19101. t["false"] = null;
  19102. t["nu"] = null;
  19103. t["nul"] = null;
  19104. t["null"] = null;
  19105. });
  19106. const MAX_INVALID_PATH_OPS = 20;
  19107. function EvaluatorPreprocessor(stream, xref, stateManager) {
  19108. this.opMap = getOPMap();
  19109. this.parser = new _parser.Parser({
  19110. lexer: new _parser.Lexer(stream, this.opMap),
  19111. xref
  19112. });
  19113. this.stateManager = stateManager;
  19114. this.nonProcessedArgs = [];
  19115. this._numInvalidPathOPS = 0;
  19116. }
  19117. EvaluatorPreprocessor.prototype = {
  19118. get savedStatesDepth() {
  19119. return this.stateManager.stateStack.length;
  19120. },
  19121. read: function EvaluatorPreprocessor_read(operation) {
  19122. var args = operation.args;
  19123. while (true) {
  19124. var obj = this.parser.getObj();
  19125. if (obj instanceof _primitives.Cmd) {
  19126. var cmd = obj.cmd;
  19127. var opSpec = this.opMap[cmd];
  19128. if (!opSpec) {
  19129. (0, _util.warn)(`Unknown command "${cmd}".`);
  19130. continue;
  19131. }
  19132. var fn = opSpec.id;
  19133. var numArgs = opSpec.numArgs;
  19134. var argsLength = args !== null ? args.length : 0;
  19135. if (!opSpec.variableArgs) {
  19136. if (argsLength !== numArgs) {
  19137. var nonProcessedArgs = this.nonProcessedArgs;
  19138. while (argsLength > numArgs) {
  19139. nonProcessedArgs.push(args.shift());
  19140. argsLength--;
  19141. }
  19142. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  19143. if (args === null) {
  19144. args = [];
  19145. }
  19146. args.unshift(nonProcessedArgs.pop());
  19147. argsLength++;
  19148. }
  19149. }
  19150. if (argsLength < numArgs) {
  19151. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  19152. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > MAX_INVALID_PATH_OPS) {
  19153. throw new _util.FormatError(`Invalid ${partialMsg}`);
  19154. }
  19155. (0, _util.warn)(`Skipping ${partialMsg}`);
  19156. if (args !== null) {
  19157. args.length = 0;
  19158. }
  19159. continue;
  19160. }
  19161. } else if (argsLength > numArgs) {
  19162. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  19163. }
  19164. this.preprocessCommand(fn, args);
  19165. operation.fn = fn;
  19166. operation.args = args;
  19167. return true;
  19168. }
  19169. if (obj === _primitives.EOF) {
  19170. return false;
  19171. }
  19172. if (obj !== null) {
  19173. if (args === null) {
  19174. args = [];
  19175. }
  19176. args.push(obj);
  19177. if (args.length > 33) {
  19178. throw new _util.FormatError("Too many arguments");
  19179. }
  19180. }
  19181. }
  19182. },
  19183. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  19184. switch (fn | 0) {
  19185. case _util.OPS.save:
  19186. this.stateManager.save();
  19187. break;
  19188. case _util.OPS.restore:
  19189. this.stateManager.restore();
  19190. break;
  19191. case _util.OPS.transform:
  19192. this.stateManager.transform(args);
  19193. break;
  19194. }
  19195. }
  19196. };
  19197. return EvaluatorPreprocessor;
  19198. }();
  19199. /***/ }),
  19200. /* 26 */
  19201. /***/ (function(module, exports, __w_pdfjs_require__) {
  19202. "use strict";
  19203. Object.defineProperty(exports, "__esModule", {
  19204. value: true
  19205. });
  19206. exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0;
  19207. var _util = __w_pdfjs_require__(2);
  19208. var _primitives = __w_pdfjs_require__(4);
  19209. var _parser = __w_pdfjs_require__(10);
  19210. var _core_utils = __w_pdfjs_require__(7);
  19211. var _stream = __w_pdfjs_require__(11);
  19212. var BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
  19213. class CMap {
  19214. constructor(builtInCMap = false) {
  19215. this.codespaceRanges = [[], [], [], []];
  19216. this.numCodespaceRanges = 0;
  19217. this._map = [];
  19218. this.name = "";
  19219. this.vertical = false;
  19220. this.useCMap = null;
  19221. this.builtInCMap = builtInCMap;
  19222. }
  19223. addCodespaceRange(n, low, high) {
  19224. this.codespaceRanges[n - 1].push(low, high);
  19225. this.numCodespaceRanges++;
  19226. }
  19227. mapCidRange(low, high, dstLow) {
  19228. while (low <= high) {
  19229. this._map[low++] = dstLow++;
  19230. }
  19231. }
  19232. mapBfRange(low, high, dstLow) {
  19233. var lastByte = dstLow.length - 1;
  19234. while (low <= high) {
  19235. this._map[low++] = dstLow;
  19236. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  19237. }
  19238. }
  19239. mapBfRangeToArray(low, high, array) {
  19240. const ii = array.length;
  19241. let i = 0;
  19242. while (low <= high && i < ii) {
  19243. this._map[low] = array[i++];
  19244. ++low;
  19245. }
  19246. }
  19247. mapOne(src, dst) {
  19248. this._map[src] = dst;
  19249. }
  19250. lookup(code) {
  19251. return this._map[code];
  19252. }
  19253. contains(code) {
  19254. return this._map[code] !== undefined;
  19255. }
  19256. forEach(callback) {
  19257. const map = this._map;
  19258. const length = map.length;
  19259. if (length <= 0x10000) {
  19260. for (let i = 0; i < length; i++) {
  19261. if (map[i] !== undefined) {
  19262. callback(i, map[i]);
  19263. }
  19264. }
  19265. } else {
  19266. for (const i in map) {
  19267. callback(i, map[i]);
  19268. }
  19269. }
  19270. }
  19271. charCodeOf(value) {
  19272. const map = this._map;
  19273. if (map.length <= 0x10000) {
  19274. return map.indexOf(value);
  19275. }
  19276. for (const charCode in map) {
  19277. if (map[charCode] === value) {
  19278. return charCode | 0;
  19279. }
  19280. }
  19281. return -1;
  19282. }
  19283. getMap() {
  19284. return this._map;
  19285. }
  19286. readCharCode(str, offset, out) {
  19287. let c = 0;
  19288. const codespaceRanges = this.codespaceRanges;
  19289. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  19290. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  19291. const codespaceRange = codespaceRanges[n];
  19292. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  19293. const low = codespaceRange[k++];
  19294. const high = codespaceRange[k++];
  19295. if (c >= low && c <= high) {
  19296. out.charcode = c;
  19297. out.length = n + 1;
  19298. return;
  19299. }
  19300. }
  19301. }
  19302. out.charcode = 0;
  19303. out.length = 1;
  19304. }
  19305. get length() {
  19306. return this._map.length;
  19307. }
  19308. get isIdentityCMap() {
  19309. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  19310. return false;
  19311. }
  19312. if (this._map.length !== 0x10000) {
  19313. return false;
  19314. }
  19315. for (let i = 0; i < 0x10000; i++) {
  19316. if (this._map[i] !== i) {
  19317. return false;
  19318. }
  19319. }
  19320. return true;
  19321. }
  19322. }
  19323. exports.CMap = CMap;
  19324. class IdentityCMap extends CMap {
  19325. constructor(vertical, n) {
  19326. super();
  19327. this.vertical = vertical;
  19328. this.addCodespaceRange(n, 0, 0xffff);
  19329. }
  19330. mapCidRange(low, high, dstLow) {
  19331. (0, _util.unreachable)("should not call mapCidRange");
  19332. }
  19333. mapBfRange(low, high, dstLow) {
  19334. (0, _util.unreachable)("should not call mapBfRange");
  19335. }
  19336. mapBfRangeToArray(low, high, array) {
  19337. (0, _util.unreachable)("should not call mapBfRangeToArray");
  19338. }
  19339. mapOne(src, dst) {
  19340. (0, _util.unreachable)("should not call mapCidOne");
  19341. }
  19342. lookup(code) {
  19343. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  19344. }
  19345. contains(code) {
  19346. return Number.isInteger(code) && code <= 0xffff;
  19347. }
  19348. forEach(callback) {
  19349. for (let i = 0; i <= 0xffff; i++) {
  19350. callback(i, i);
  19351. }
  19352. }
  19353. charCodeOf(value) {
  19354. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  19355. }
  19356. getMap() {
  19357. const map = new Array(0x10000);
  19358. for (let i = 0; i <= 0xffff; i++) {
  19359. map[i] = i;
  19360. }
  19361. return map;
  19362. }
  19363. get length() {
  19364. return 0x10000;
  19365. }
  19366. get isIdentityCMap() {
  19367. (0, _util.unreachable)("should not access .isIdentityCMap");
  19368. }
  19369. }
  19370. exports.IdentityCMap = IdentityCMap;
  19371. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  19372. function hexToInt(a, size) {
  19373. var n = 0;
  19374. for (var i = 0; i <= size; i++) {
  19375. n = n << 8 | a[i];
  19376. }
  19377. return n >>> 0;
  19378. }
  19379. function hexToStr(a, size) {
  19380. if (size === 1) {
  19381. return String.fromCharCode(a[0], a[1]);
  19382. }
  19383. if (size === 3) {
  19384. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  19385. }
  19386. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  19387. }
  19388. function addHex(a, b, size) {
  19389. var c = 0;
  19390. for (var i = size; i >= 0; i--) {
  19391. c += a[i] + b[i];
  19392. a[i] = c & 255;
  19393. c >>= 8;
  19394. }
  19395. }
  19396. function incHex(a, size) {
  19397. var c = 1;
  19398. for (var i = size; i >= 0 && c > 0; i--) {
  19399. c += a[i];
  19400. a[i] = c & 255;
  19401. c >>= 8;
  19402. }
  19403. }
  19404. var MAX_NUM_SIZE = 16;
  19405. var MAX_ENCODED_NUM_SIZE = 19;
  19406. function BinaryCMapStream(data) {
  19407. this.buffer = data;
  19408. this.pos = 0;
  19409. this.end = data.length;
  19410. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  19411. }
  19412. BinaryCMapStream.prototype = {
  19413. readByte() {
  19414. if (this.pos >= this.end) {
  19415. return -1;
  19416. }
  19417. return this.buffer[this.pos++];
  19418. },
  19419. readNumber() {
  19420. var n = 0;
  19421. var last;
  19422. do {
  19423. var b = this.readByte();
  19424. if (b < 0) {
  19425. throw new _util.FormatError("unexpected EOF in bcmap");
  19426. }
  19427. last = !(b & 0x80);
  19428. n = n << 7 | b & 0x7f;
  19429. } while (!last);
  19430. return n;
  19431. },
  19432. readSigned() {
  19433. var n = this.readNumber();
  19434. return n & 1 ? ~(n >>> 1) : n >>> 1;
  19435. },
  19436. readHex(num, size) {
  19437. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  19438. this.pos += size + 1;
  19439. },
  19440. readHexNumber(num, size) {
  19441. var last;
  19442. var stack = this.tmpBuf,
  19443. sp = 0;
  19444. do {
  19445. var b = this.readByte();
  19446. if (b < 0) {
  19447. throw new _util.FormatError("unexpected EOF in bcmap");
  19448. }
  19449. last = !(b & 0x80);
  19450. stack[sp++] = b & 0x7f;
  19451. } while (!last);
  19452. var i = size,
  19453. buffer = 0,
  19454. bufferSize = 0;
  19455. while (i >= 0) {
  19456. while (bufferSize < 8 && stack.length > 0) {
  19457. buffer = stack[--sp] << bufferSize | buffer;
  19458. bufferSize += 7;
  19459. }
  19460. num[i] = buffer & 255;
  19461. i--;
  19462. buffer >>= 8;
  19463. bufferSize -= 8;
  19464. }
  19465. },
  19466. readHexSigned(num, size) {
  19467. this.readHexNumber(num, size);
  19468. var sign = num[size] & 1 ? 255 : 0;
  19469. var c = 0;
  19470. for (var i = 0; i <= size; i++) {
  19471. c = (c & 1) << 8 | num[i];
  19472. num[i] = c >> 1 ^ sign;
  19473. }
  19474. },
  19475. readString() {
  19476. var len = this.readNumber();
  19477. var s = "";
  19478. for (var i = 0; i < len; i++) {
  19479. s += String.fromCharCode(this.readNumber());
  19480. }
  19481. return s;
  19482. }
  19483. };
  19484. function processBinaryCMap(data, cMap, extend) {
  19485. return new Promise(function (resolve, reject) {
  19486. var stream = new BinaryCMapStream(data);
  19487. var header = stream.readByte();
  19488. cMap.vertical = !!(header & 1);
  19489. var useCMap = null;
  19490. var start = new Uint8Array(MAX_NUM_SIZE);
  19491. var end = new Uint8Array(MAX_NUM_SIZE);
  19492. var char = new Uint8Array(MAX_NUM_SIZE);
  19493. var charCode = new Uint8Array(MAX_NUM_SIZE);
  19494. var tmp = new Uint8Array(MAX_NUM_SIZE);
  19495. var code;
  19496. var b;
  19497. while ((b = stream.readByte()) >= 0) {
  19498. var type = b >> 5;
  19499. if (type === 7) {
  19500. switch (b & 0x1f) {
  19501. case 0:
  19502. stream.readString();
  19503. break;
  19504. case 1:
  19505. useCMap = stream.readString();
  19506. break;
  19507. }
  19508. continue;
  19509. }
  19510. var sequence = !!(b & 0x10);
  19511. var dataSize = b & 15;
  19512. if (dataSize + 1 > MAX_NUM_SIZE) {
  19513. throw new Error("processBinaryCMap: Invalid dataSize.");
  19514. }
  19515. var ucs2DataSize = 1;
  19516. var subitemsCount = stream.readNumber();
  19517. var i;
  19518. switch (type) {
  19519. case 0:
  19520. stream.readHex(start, dataSize);
  19521. stream.readHexNumber(end, dataSize);
  19522. addHex(end, start, dataSize);
  19523. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  19524. for (i = 1; i < subitemsCount; i++) {
  19525. incHex(end, dataSize);
  19526. stream.readHexNumber(start, dataSize);
  19527. addHex(start, end, dataSize);
  19528. stream.readHexNumber(end, dataSize);
  19529. addHex(end, start, dataSize);
  19530. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  19531. }
  19532. break;
  19533. case 1:
  19534. stream.readHex(start, dataSize);
  19535. stream.readHexNumber(end, dataSize);
  19536. addHex(end, start, dataSize);
  19537. stream.readNumber();
  19538. for (i = 1; i < subitemsCount; i++) {
  19539. incHex(end, dataSize);
  19540. stream.readHexNumber(start, dataSize);
  19541. addHex(start, end, dataSize);
  19542. stream.readHexNumber(end, dataSize);
  19543. addHex(end, start, dataSize);
  19544. stream.readNumber();
  19545. }
  19546. break;
  19547. case 2:
  19548. stream.readHex(char, dataSize);
  19549. code = stream.readNumber();
  19550. cMap.mapOne(hexToInt(char, dataSize), code);
  19551. for (i = 1; i < subitemsCount; i++) {
  19552. incHex(char, dataSize);
  19553. if (!sequence) {
  19554. stream.readHexNumber(tmp, dataSize);
  19555. addHex(char, tmp, dataSize);
  19556. }
  19557. code = stream.readSigned() + (code + 1);
  19558. cMap.mapOne(hexToInt(char, dataSize), code);
  19559. }
  19560. break;
  19561. case 3:
  19562. stream.readHex(start, dataSize);
  19563. stream.readHexNumber(end, dataSize);
  19564. addHex(end, start, dataSize);
  19565. code = stream.readNumber();
  19566. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  19567. for (i = 1; i < subitemsCount; i++) {
  19568. incHex(end, dataSize);
  19569. if (!sequence) {
  19570. stream.readHexNumber(start, dataSize);
  19571. addHex(start, end, dataSize);
  19572. } else {
  19573. start.set(end);
  19574. }
  19575. stream.readHexNumber(end, dataSize);
  19576. addHex(end, start, dataSize);
  19577. code = stream.readNumber();
  19578. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  19579. }
  19580. break;
  19581. case 4:
  19582. stream.readHex(char, ucs2DataSize);
  19583. stream.readHex(charCode, dataSize);
  19584. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  19585. for (i = 1; i < subitemsCount; i++) {
  19586. incHex(char, ucs2DataSize);
  19587. if (!sequence) {
  19588. stream.readHexNumber(tmp, ucs2DataSize);
  19589. addHex(char, tmp, ucs2DataSize);
  19590. }
  19591. incHex(charCode, dataSize);
  19592. stream.readHexSigned(tmp, dataSize);
  19593. addHex(charCode, tmp, dataSize);
  19594. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  19595. }
  19596. break;
  19597. case 5:
  19598. stream.readHex(start, ucs2DataSize);
  19599. stream.readHexNumber(end, ucs2DataSize);
  19600. addHex(end, start, ucs2DataSize);
  19601. stream.readHex(charCode, dataSize);
  19602. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  19603. for (i = 1; i < subitemsCount; i++) {
  19604. incHex(end, ucs2DataSize);
  19605. if (!sequence) {
  19606. stream.readHexNumber(start, ucs2DataSize);
  19607. addHex(start, end, ucs2DataSize);
  19608. } else {
  19609. start.set(end);
  19610. }
  19611. stream.readHexNumber(end, ucs2DataSize);
  19612. addHex(end, start, ucs2DataSize);
  19613. stream.readHex(charCode, dataSize);
  19614. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  19615. }
  19616. break;
  19617. default:
  19618. reject(new Error("processBinaryCMap: Unknown type: " + type));
  19619. return;
  19620. }
  19621. }
  19622. if (useCMap) {
  19623. resolve(extend(useCMap));
  19624. return;
  19625. }
  19626. resolve(cMap);
  19627. });
  19628. }
  19629. function BinaryCMapReader() {}
  19630. BinaryCMapReader.prototype = {
  19631. process: processBinaryCMap
  19632. };
  19633. return BinaryCMapReader;
  19634. }();
  19635. var CMapFactory = function CMapFactoryClosure() {
  19636. function strToInt(str) {
  19637. var a = 0;
  19638. for (var i = 0; i < str.length; i++) {
  19639. a = a << 8 | str.charCodeAt(i);
  19640. }
  19641. return a >>> 0;
  19642. }
  19643. function expectString(obj) {
  19644. if (!(0, _util.isString)(obj)) {
  19645. throw new _util.FormatError("Malformed CMap: expected string.");
  19646. }
  19647. }
  19648. function expectInt(obj) {
  19649. if (!Number.isInteger(obj)) {
  19650. throw new _util.FormatError("Malformed CMap: expected int.");
  19651. }
  19652. }
  19653. function parseBfChar(cMap, lexer) {
  19654. while (true) {
  19655. var obj = lexer.getObj();
  19656. if ((0, _primitives.isEOF)(obj)) {
  19657. break;
  19658. }
  19659. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  19660. return;
  19661. }
  19662. expectString(obj);
  19663. var src = strToInt(obj);
  19664. obj = lexer.getObj();
  19665. expectString(obj);
  19666. var dst = obj;
  19667. cMap.mapOne(src, dst);
  19668. }
  19669. }
  19670. function parseBfRange(cMap, lexer) {
  19671. while (true) {
  19672. var obj = lexer.getObj();
  19673. if ((0, _primitives.isEOF)(obj)) {
  19674. break;
  19675. }
  19676. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  19677. return;
  19678. }
  19679. expectString(obj);
  19680. var low = strToInt(obj);
  19681. obj = lexer.getObj();
  19682. expectString(obj);
  19683. var high = strToInt(obj);
  19684. obj = lexer.getObj();
  19685. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  19686. var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  19687. cMap.mapBfRange(low, high, dstLow);
  19688. } else if ((0, _primitives.isCmd)(obj, "[")) {
  19689. obj = lexer.getObj();
  19690. var array = [];
  19691. while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
  19692. array.push(obj);
  19693. obj = lexer.getObj();
  19694. }
  19695. cMap.mapBfRangeToArray(low, high, array);
  19696. } else {
  19697. break;
  19698. }
  19699. }
  19700. throw new _util.FormatError("Invalid bf range.");
  19701. }
  19702. function parseCidChar(cMap, lexer) {
  19703. while (true) {
  19704. var obj = lexer.getObj();
  19705. if ((0, _primitives.isEOF)(obj)) {
  19706. break;
  19707. }
  19708. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  19709. return;
  19710. }
  19711. expectString(obj);
  19712. var src = strToInt(obj);
  19713. obj = lexer.getObj();
  19714. expectInt(obj);
  19715. var dst = obj;
  19716. cMap.mapOne(src, dst);
  19717. }
  19718. }
  19719. function parseCidRange(cMap, lexer) {
  19720. while (true) {
  19721. var obj = lexer.getObj();
  19722. if ((0, _primitives.isEOF)(obj)) {
  19723. break;
  19724. }
  19725. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  19726. return;
  19727. }
  19728. expectString(obj);
  19729. var low = strToInt(obj);
  19730. obj = lexer.getObj();
  19731. expectString(obj);
  19732. var high = strToInt(obj);
  19733. obj = lexer.getObj();
  19734. expectInt(obj);
  19735. var dstLow = obj;
  19736. cMap.mapCidRange(low, high, dstLow);
  19737. }
  19738. }
  19739. function parseCodespaceRange(cMap, lexer) {
  19740. while (true) {
  19741. var obj = lexer.getObj();
  19742. if ((0, _primitives.isEOF)(obj)) {
  19743. break;
  19744. }
  19745. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  19746. return;
  19747. }
  19748. if (!(0, _util.isString)(obj)) {
  19749. break;
  19750. }
  19751. var low = strToInt(obj);
  19752. obj = lexer.getObj();
  19753. if (!(0, _util.isString)(obj)) {
  19754. break;
  19755. }
  19756. var high = strToInt(obj);
  19757. cMap.addCodespaceRange(obj.length, low, high);
  19758. }
  19759. throw new _util.FormatError("Invalid codespace range.");
  19760. }
  19761. function parseWMode(cMap, lexer) {
  19762. var obj = lexer.getObj();
  19763. if (Number.isInteger(obj)) {
  19764. cMap.vertical = !!obj;
  19765. }
  19766. }
  19767. function parseCMapName(cMap, lexer) {
  19768. var obj = lexer.getObj();
  19769. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  19770. cMap.name = obj.name;
  19771. }
  19772. }
  19773. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  19774. var previous;
  19775. var embeddedUseCMap;
  19776. objLoop: while (true) {
  19777. try {
  19778. var obj = lexer.getObj();
  19779. if ((0, _primitives.isEOF)(obj)) {
  19780. break;
  19781. } else if ((0, _primitives.isName)(obj)) {
  19782. if (obj.name === "WMode") {
  19783. parseWMode(cMap, lexer);
  19784. } else if (obj.name === "CMapName") {
  19785. parseCMapName(cMap, lexer);
  19786. }
  19787. previous = obj;
  19788. } else if ((0, _primitives.isCmd)(obj)) {
  19789. switch (obj.cmd) {
  19790. case "endcmap":
  19791. break objLoop;
  19792. case "usecmap":
  19793. if ((0, _primitives.isName)(previous)) {
  19794. embeddedUseCMap = previous.name;
  19795. }
  19796. break;
  19797. case "begincodespacerange":
  19798. parseCodespaceRange(cMap, lexer);
  19799. break;
  19800. case "beginbfchar":
  19801. parseBfChar(cMap, lexer);
  19802. break;
  19803. case "begincidchar":
  19804. parseCidChar(cMap, lexer);
  19805. break;
  19806. case "beginbfrange":
  19807. parseBfRange(cMap, lexer);
  19808. break;
  19809. case "begincidrange":
  19810. parseCidRange(cMap, lexer);
  19811. break;
  19812. }
  19813. }
  19814. } catch (ex) {
  19815. if (ex instanceof _core_utils.MissingDataException) {
  19816. throw ex;
  19817. }
  19818. (0, _util.warn)("Invalid cMap data: " + ex);
  19819. continue;
  19820. }
  19821. }
  19822. if (!useCMap && embeddedUseCMap) {
  19823. useCMap = embeddedUseCMap;
  19824. }
  19825. if (useCMap) {
  19826. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  19827. }
  19828. return Promise.resolve(cMap);
  19829. }
  19830. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  19831. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  19832. cMap.useCMap = newCMap;
  19833. if (cMap.numCodespaceRanges === 0) {
  19834. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  19835. for (var i = 0; i < useCodespaceRanges.length; i++) {
  19836. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  19837. }
  19838. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  19839. }
  19840. cMap.useCMap.forEach(function (key, value) {
  19841. if (!cMap.contains(key)) {
  19842. cMap.mapOne(key, cMap.useCMap.lookup(key));
  19843. }
  19844. });
  19845. return cMap;
  19846. });
  19847. }
  19848. function createBuiltInCMap(name, fetchBuiltInCMap) {
  19849. if (name === "Identity-H") {
  19850. return Promise.resolve(new IdentityCMap(false, 2));
  19851. } else if (name === "Identity-V") {
  19852. return Promise.resolve(new IdentityCMap(true, 2));
  19853. }
  19854. if (!BUILT_IN_CMAPS.includes(name)) {
  19855. return Promise.reject(new Error("Unknown CMap name: " + name));
  19856. }
  19857. if (!fetchBuiltInCMap) {
  19858. return Promise.reject(new Error("Built-in CMap parameters are not provided."));
  19859. }
  19860. return fetchBuiltInCMap(name).then(function (data) {
  19861. var cMapData = data.cMapData,
  19862. compressionType = data.compressionType;
  19863. var cMap = new CMap(true);
  19864. if (compressionType === _util.CMapCompressionType.BINARY) {
  19865. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  19866. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  19867. });
  19868. }
  19869. if (compressionType === _util.CMapCompressionType.NONE) {
  19870. var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  19871. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  19872. }
  19873. return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported."));
  19874. });
  19875. }
  19876. return {
  19877. async create(params) {
  19878. var encoding = params.encoding;
  19879. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  19880. var useCMap = params.useCMap;
  19881. if ((0, _primitives.isName)(encoding)) {
  19882. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  19883. } else if ((0, _primitives.isStream)(encoding)) {
  19884. var cMap = new CMap();
  19885. var lexer = new _parser.Lexer(encoding);
  19886. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  19887. if (parsedCMap.isIdentityCMap) {
  19888. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  19889. }
  19890. return parsedCMap;
  19891. });
  19892. }
  19893. throw new Error("Encoding required.");
  19894. }
  19895. };
  19896. }();
  19897. exports.CMapFactory = CMapFactory;
  19898. /***/ }),
  19899. /* 27 */
  19900. /***/ (function(module, exports, __w_pdfjs_require__) {
  19901. "use strict";
  19902. Object.defineProperty(exports, "__esModule", {
  19903. value: true
  19904. });
  19905. exports.getFontType = getFontType;
  19906. exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0;
  19907. var _util = __w_pdfjs_require__(2);
  19908. var _cff_parser = __w_pdfjs_require__(28);
  19909. var _glyphlist = __w_pdfjs_require__(31);
  19910. var _encodings = __w_pdfjs_require__(30);
  19911. var _standard_fonts = __w_pdfjs_require__(32);
  19912. var _unicode = __w_pdfjs_require__(33);
  19913. var _core_utils = __w_pdfjs_require__(7);
  19914. var _font_renderer = __w_pdfjs_require__(34);
  19915. var _cmap = __w_pdfjs_require__(26);
  19916. var _stream = __w_pdfjs_require__(11);
  19917. var _type1_parser = __w_pdfjs_require__(35);
  19918. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  19919. var PDF_GLYPH_SPACE_UNITS = 1000;
  19920. var SEAC_ANALYSIS_ENABLED = true;
  19921. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  19922. var FontFlags = {
  19923. FixedPitch: 1,
  19924. Serif: 2,
  19925. Symbolic: 4,
  19926. Script: 8,
  19927. Nonsymbolic: 32,
  19928. Italic: 64,
  19929. AllCap: 65536,
  19930. SmallCap: 131072,
  19931. ForceBold: 262144
  19932. };
  19933. exports.FontFlags = FontFlags;
  19934. var MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
  19935. function adjustWidths(properties) {
  19936. if (!properties.fontMatrix) {
  19937. return;
  19938. }
  19939. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  19940. return;
  19941. }
  19942. var scale = 0.001 / properties.fontMatrix[0];
  19943. var glyphsWidths = properties.widths;
  19944. for (var glyph in glyphsWidths) {
  19945. glyphsWidths[glyph] *= scale;
  19946. }
  19947. properties.defaultWidth *= scale;
  19948. }
  19949. function adjustToUnicode(properties, builtInEncoding) {
  19950. if (properties.hasIncludedToUnicodeMap) {
  19951. return;
  19952. }
  19953. if (properties.hasEncoding) {
  19954. return;
  19955. }
  19956. if (builtInEncoding === properties.defaultEncoding) {
  19957. return;
  19958. }
  19959. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  19960. return;
  19961. }
  19962. var toUnicode = [],
  19963. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  19964. for (var charCode in builtInEncoding) {
  19965. var glyphName = builtInEncoding[charCode];
  19966. var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  19967. if (unicode !== -1) {
  19968. toUnicode[charCode] = String.fromCharCode(unicode);
  19969. }
  19970. }
  19971. properties.toUnicode.amend(toUnicode);
  19972. }
  19973. function getFontType(type, subtype) {
  19974. switch (type) {
  19975. case "Type1":
  19976. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  19977. case "CIDFontType0":
  19978. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  19979. case "OpenType":
  19980. return _util.FontType.OPENTYPE;
  19981. case "TrueType":
  19982. return _util.FontType.TRUETYPE;
  19983. case "CIDFontType2":
  19984. return _util.FontType.CIDFONTTYPE2;
  19985. case "MMType1":
  19986. return _util.FontType.MMTYPE1;
  19987. case "Type0":
  19988. return _util.FontType.TYPE0;
  19989. default:
  19990. return _util.FontType.UNKNOWN;
  19991. }
  19992. }
  19993. function recoverGlyphName(name, glyphsUnicodeMap) {
  19994. if (glyphsUnicodeMap[name] !== undefined) {
  19995. return name;
  19996. }
  19997. var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  19998. if (unicode !== -1) {
  19999. for (var key in glyphsUnicodeMap) {
  20000. if (glyphsUnicodeMap[key] === unicode) {
  20001. return key;
  20002. }
  20003. }
  20004. }
  20005. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  20006. return name;
  20007. }
  20008. var Glyph = function GlyphClosure() {
  20009. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20010. this.fontChar = fontChar;
  20011. this.unicode = unicode;
  20012. this.accent = accent;
  20013. this.width = width;
  20014. this.vmetric = vmetric;
  20015. this.operatorListId = operatorListId;
  20016. this.isSpace = isSpace;
  20017. this.isInFont = isInFont;
  20018. }
  20019. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20020. return this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  20021. };
  20022. return Glyph;
  20023. }();
  20024. var ToUnicodeMap = function ToUnicodeMapClosure() {
  20025. function ToUnicodeMap(cmap = []) {
  20026. this._map = cmap;
  20027. }
  20028. ToUnicodeMap.prototype = {
  20029. get length() {
  20030. return this._map.length;
  20031. },
  20032. forEach(callback) {
  20033. for (var charCode in this._map) {
  20034. callback(charCode, this._map[charCode].charCodeAt(0));
  20035. }
  20036. },
  20037. has(i) {
  20038. return this._map[i] !== undefined;
  20039. },
  20040. get(i) {
  20041. return this._map[i];
  20042. },
  20043. charCodeOf(value) {
  20044. const map = this._map;
  20045. if (map.length <= 0x10000) {
  20046. return map.indexOf(value);
  20047. }
  20048. for (const charCode in map) {
  20049. if (map[charCode] === value) {
  20050. return charCode | 0;
  20051. }
  20052. }
  20053. return -1;
  20054. },
  20055. amend(map) {
  20056. for (var charCode in map) {
  20057. this._map[charCode] = map[charCode];
  20058. }
  20059. }
  20060. };
  20061. return ToUnicodeMap;
  20062. }();
  20063. exports.ToUnicodeMap = ToUnicodeMap;
  20064. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  20065. function IdentityToUnicodeMap(firstChar, lastChar) {
  20066. this.firstChar = firstChar;
  20067. this.lastChar = lastChar;
  20068. }
  20069. IdentityToUnicodeMap.prototype = {
  20070. get length() {
  20071. return this.lastChar + 1 - this.firstChar;
  20072. },
  20073. forEach(callback) {
  20074. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  20075. callback(i, i);
  20076. }
  20077. },
  20078. has(i) {
  20079. return this.firstChar <= i && i <= this.lastChar;
  20080. },
  20081. get(i) {
  20082. if (this.firstChar <= i && i <= this.lastChar) {
  20083. return String.fromCharCode(i);
  20084. }
  20085. return undefined;
  20086. },
  20087. charCodeOf(v) {
  20088. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  20089. },
  20090. amend(map) {
  20091. (0, _util.unreachable)("Should not call amend()");
  20092. }
  20093. };
  20094. return IdentityToUnicodeMap;
  20095. }();
  20096. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  20097. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  20098. function writeInt16(dest, offset, num) {
  20099. dest[offset] = num >> 8 & 0xff;
  20100. dest[offset + 1] = num & 0xff;
  20101. }
  20102. function writeInt32(dest, offset, num) {
  20103. dest[offset] = num >> 24 & 0xff;
  20104. dest[offset + 1] = num >> 16 & 0xff;
  20105. dest[offset + 2] = num >> 8 & 0xff;
  20106. dest[offset + 3] = num & 0xff;
  20107. }
  20108. function writeData(dest, offset, data) {
  20109. var i, ii;
  20110. if (data instanceof Uint8Array) {
  20111. dest.set(data, offset);
  20112. } else if (typeof data === "string") {
  20113. for (i = 0, ii = data.length; i < ii; i++) {
  20114. dest[offset++] = data.charCodeAt(i) & 0xff;
  20115. }
  20116. } else {
  20117. for (i = 0, ii = data.length; i < ii; i++) {
  20118. dest[offset++] = data[i] & 0xff;
  20119. }
  20120. }
  20121. }
  20122. function OpenTypeFileBuilder(sfnt) {
  20123. this.sfnt = sfnt;
  20124. this.tables = Object.create(null);
  20125. }
  20126. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  20127. var maxPower2 = 1,
  20128. log2 = 0;
  20129. while ((maxPower2 ^ entriesCount) > maxPower2) {
  20130. maxPower2 <<= 1;
  20131. log2++;
  20132. }
  20133. var searchRange = maxPower2 * entrySize;
  20134. return {
  20135. range: searchRange,
  20136. entry: log2,
  20137. rangeShift: entrySize * entriesCount - searchRange
  20138. };
  20139. };
  20140. var OTF_HEADER_SIZE = 12;
  20141. var OTF_TABLE_ENTRY_SIZE = 16;
  20142. OpenTypeFileBuilder.prototype = {
  20143. toArray: function OpenTypeFileBuilder_toArray() {
  20144. var sfnt = this.sfnt;
  20145. var tables = this.tables;
  20146. var tablesNames = Object.keys(tables);
  20147. tablesNames.sort();
  20148. var numTables = tablesNames.length;
  20149. var i, j, jj, table, tableName;
  20150. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  20151. var tableOffsets = [offset];
  20152. for (i = 0; i < numTables; i++) {
  20153. table = tables[tablesNames[i]];
  20154. var paddedLength = (table.length + 3 & ~3) >>> 0;
  20155. offset += paddedLength;
  20156. tableOffsets.push(offset);
  20157. }
  20158. var file = new Uint8Array(offset);
  20159. for (i = 0; i < numTables; i++) {
  20160. table = tables[tablesNames[i]];
  20161. writeData(file, tableOffsets[i], table);
  20162. }
  20163. if (sfnt === "true") {
  20164. sfnt = (0, _util.string32)(0x00010000);
  20165. }
  20166. file[0] = sfnt.charCodeAt(0) & 0xff;
  20167. file[1] = sfnt.charCodeAt(1) & 0xff;
  20168. file[2] = sfnt.charCodeAt(2) & 0xff;
  20169. file[3] = sfnt.charCodeAt(3) & 0xff;
  20170. writeInt16(file, 4, numTables);
  20171. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  20172. writeInt16(file, 6, searchParams.range);
  20173. writeInt16(file, 8, searchParams.entry);
  20174. writeInt16(file, 10, searchParams.rangeShift);
  20175. offset = OTF_HEADER_SIZE;
  20176. for (i = 0; i < numTables; i++) {
  20177. tableName = tablesNames[i];
  20178. file[offset] = tableName.charCodeAt(0) & 0xff;
  20179. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  20180. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  20181. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  20182. var checksum = 0;
  20183. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  20184. var quad = (0, _core_utils.readUint32)(file, j);
  20185. checksum = checksum + quad >>> 0;
  20186. }
  20187. writeInt32(file, offset + 4, checksum);
  20188. writeInt32(file, offset + 8, tableOffsets[i]);
  20189. writeInt32(file, offset + 12, tables[tableName].length);
  20190. offset += OTF_TABLE_ENTRY_SIZE;
  20191. }
  20192. return file;
  20193. },
  20194. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  20195. if (tag in this.tables) {
  20196. throw new Error("Table " + tag + " already exists");
  20197. }
  20198. this.tables[tag] = data;
  20199. }
  20200. };
  20201. return OpenTypeFileBuilder;
  20202. }();
  20203. var Font = function FontClosure() {
  20204. function Font(name, file, properties) {
  20205. var charCode;
  20206. this.name = name;
  20207. this.loadedName = properties.loadedName;
  20208. this.isType3Font = properties.isType3Font;
  20209. this.sizes = [];
  20210. this.missingFile = false;
  20211. this.glyphCache = Object.create(null);
  20212. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  20213. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  20214. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  20215. var type = properties.type;
  20216. var subtype = properties.subtype;
  20217. this.type = type;
  20218. this.subtype = subtype;
  20219. let fallbackName = "sans-serif";
  20220. if (this.isMonospace) {
  20221. fallbackName = "monospace";
  20222. } else if (this.isSerifFont) {
  20223. fallbackName = "serif";
  20224. }
  20225. this.fallbackName = fallbackName;
  20226. this.differences = properties.differences;
  20227. this.widths = properties.widths;
  20228. this.defaultWidth = properties.defaultWidth;
  20229. this.composite = properties.composite;
  20230. this.wideChars = properties.wideChars;
  20231. this.cMap = properties.cMap;
  20232. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  20233. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  20234. this.fontMatrix = properties.fontMatrix;
  20235. this.bbox = properties.bbox;
  20236. this.defaultEncoding = properties.defaultEncoding;
  20237. this.toUnicode = properties.toUnicode;
  20238. this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
  20239. this.toFontChar = [];
  20240. if (properties.type === "Type3") {
  20241. for (charCode = 0; charCode < 256; charCode++) {
  20242. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  20243. }
  20244. this.fontType = _util.FontType.TYPE3;
  20245. return;
  20246. }
  20247. this.cidEncoding = properties.cidEncoding;
  20248. this.vertical = properties.vertical;
  20249. if (this.vertical) {
  20250. this.vmetrics = properties.vmetrics;
  20251. this.defaultVMetrics = properties.defaultVMetrics;
  20252. }
  20253. if (!file || file.isEmpty) {
  20254. if (file) {
  20255. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  20256. }
  20257. this.fallbackToSystemFont();
  20258. return;
  20259. }
  20260. [type, subtype] = getFontFileType(file, properties);
  20261. if (type !== this.type || subtype !== this.subtype) {
  20262. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  20263. }
  20264. try {
  20265. var data;
  20266. switch (type) {
  20267. case "MMType1":
  20268. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  20269. case "Type1":
  20270. case "CIDFontType0":
  20271. this.mimetype = "font/opentype";
  20272. var cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  20273. adjustWidths(properties);
  20274. data = this.convert(name, cff, properties);
  20275. break;
  20276. case "OpenType":
  20277. case "TrueType":
  20278. case "CIDFontType2":
  20279. this.mimetype = "font/opentype";
  20280. data = this.checkAndRepair(name, file, properties);
  20281. if (this.isOpenType) {
  20282. adjustWidths(properties);
  20283. type = "OpenType";
  20284. }
  20285. break;
  20286. default:
  20287. throw new _util.FormatError(`Font ${type} is not supported`);
  20288. }
  20289. } catch (e) {
  20290. (0, _util.warn)(e);
  20291. this.fallbackToSystemFont();
  20292. return;
  20293. }
  20294. this.data = data;
  20295. this.fontType = getFontType(type, subtype);
  20296. this.fontMatrix = properties.fontMatrix;
  20297. this.widths = properties.widths;
  20298. this.defaultWidth = properties.defaultWidth;
  20299. this.toUnicode = properties.toUnicode;
  20300. this.encoding = properties.baseEncoding;
  20301. this.seacMap = properties.seacMap;
  20302. }
  20303. Font.getFontID = function () {
  20304. var ID = 1;
  20305. return function Font_getFontID() {
  20306. return String(ID++);
  20307. };
  20308. }();
  20309. function int16(b0, b1) {
  20310. return (b0 << 8) + b1;
  20311. }
  20312. function writeSignedInt16(bytes, index, value) {
  20313. bytes[index + 1] = value;
  20314. bytes[index] = value >>> 8;
  20315. }
  20316. function signedInt16(b0, b1) {
  20317. var value = (b0 << 8) + b1;
  20318. return value & 1 << 15 ? value - 0x10000 : value;
  20319. }
  20320. function int32(b0, b1, b2, b3) {
  20321. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20322. }
  20323. function string16(value) {
  20324. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20325. }
  20326. function safeString16(value) {
  20327. if (value > 0x7fff) {
  20328. value = 0x7fff;
  20329. } else if (value < -0x8000) {
  20330. value = -0x8000;
  20331. }
  20332. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20333. }
  20334. function isTrueTypeFile(file) {
  20335. var header = file.peekBytes(4);
  20336. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20337. }
  20338. function isTrueTypeCollectionFile(file) {
  20339. const header = file.peekBytes(4);
  20340. return (0, _util.bytesToString)(header) === "ttcf";
  20341. }
  20342. function isOpenTypeFile(file) {
  20343. var header = file.peekBytes(4);
  20344. return (0, _util.bytesToString)(header) === "OTTO";
  20345. }
  20346. function isType1File(file) {
  20347. var header = file.peekBytes(2);
  20348. if (header[0] === 0x25 && header[1] === 0x21) {
  20349. return true;
  20350. }
  20351. if (header[0] === 0x80 && header[1] === 0x01) {
  20352. return true;
  20353. }
  20354. return false;
  20355. }
  20356. function isCFFFile(file) {
  20357. const header = file.peekBytes(4);
  20358. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20359. return true;
  20360. }
  20361. return false;
  20362. }
  20363. function getFontFileType(file, {
  20364. type,
  20365. subtype,
  20366. composite
  20367. }) {
  20368. let fileType, fileSubtype;
  20369. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20370. if (composite) {
  20371. fileType = "CIDFontType2";
  20372. } else {
  20373. fileType = "TrueType";
  20374. }
  20375. } else if (isOpenTypeFile(file)) {
  20376. if (composite) {
  20377. fileType = "CIDFontType2";
  20378. } else {
  20379. fileType = "OpenType";
  20380. }
  20381. } else if (isType1File(file)) {
  20382. if (composite) {
  20383. fileType = "CIDFontType0";
  20384. } else {
  20385. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20386. }
  20387. } else if (isCFFFile(file)) {
  20388. if (composite) {
  20389. fileType = "CIDFontType0";
  20390. fileSubtype = "CIDFontType0C";
  20391. } else {
  20392. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20393. fileSubtype = "Type1C";
  20394. }
  20395. } else {
  20396. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20397. fileType = type;
  20398. fileSubtype = subtype;
  20399. }
  20400. return [fileType, fileSubtype];
  20401. }
  20402. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20403. var toFontChar = [],
  20404. unicode;
  20405. for (var i = 0, ii = encoding.length; i < ii; i++) {
  20406. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20407. if (unicode !== -1) {
  20408. toFontChar[i] = unicode;
  20409. }
  20410. }
  20411. for (var charCode in differences) {
  20412. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20413. if (unicode !== -1) {
  20414. toFontChar[+charCode] = unicode;
  20415. }
  20416. }
  20417. return toFontChar;
  20418. }
  20419. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  20420. var newMap = Object.create(null);
  20421. var toFontChar = [];
  20422. var privateUseAreaIndex = 0;
  20423. var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20424. var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20425. for (var originalCharCode in charCodeToGlyphId) {
  20426. originalCharCode |= 0;
  20427. var glyphId = charCodeToGlyphId[originalCharCode];
  20428. if (!hasGlyph(glyphId)) {
  20429. continue;
  20430. }
  20431. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20432. privateUseAreaIndex++;
  20433. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20434. (0, _util.warn)("Ran out of space in font private use area.");
  20435. break;
  20436. }
  20437. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20438. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20439. }
  20440. var fontCharCode = nextAvailableFontCharCode++;
  20441. if (glyphId === 0) {
  20442. glyphId = newGlyphZeroId;
  20443. }
  20444. newMap[fontCharCode] = glyphId;
  20445. toFontChar[originalCharCode] = fontCharCode;
  20446. }
  20447. return {
  20448. toFontChar,
  20449. charCodeToGlyphId: newMap,
  20450. nextAvailableFontCharCode
  20451. };
  20452. }
  20453. function getRanges(glyphs, numGlyphs) {
  20454. var codes = [];
  20455. for (var charCode in glyphs) {
  20456. if (glyphs[charCode] >= numGlyphs) {
  20457. continue;
  20458. }
  20459. codes.push({
  20460. fontCharCode: charCode | 0,
  20461. glyphId: glyphs[charCode]
  20462. });
  20463. }
  20464. if (codes.length === 0) {
  20465. codes.push({
  20466. fontCharCode: 0,
  20467. glyphId: 0
  20468. });
  20469. }
  20470. codes.sort(function fontGetRangesSort(a, b) {
  20471. return a.fontCharCode - b.fontCharCode;
  20472. });
  20473. var ranges = [];
  20474. var length = codes.length;
  20475. for (var n = 0; n < length;) {
  20476. var start = codes[n].fontCharCode;
  20477. var codeIndices = [codes[n].glyphId];
  20478. ++n;
  20479. var end = start;
  20480. while (n < length && end + 1 === codes[n].fontCharCode) {
  20481. codeIndices.push(codes[n].glyphId);
  20482. ++end;
  20483. ++n;
  20484. if (end === 0xffff) {
  20485. break;
  20486. }
  20487. }
  20488. ranges.push([start, end, codeIndices]);
  20489. }
  20490. return ranges;
  20491. }
  20492. function createCmapTable(glyphs, numGlyphs) {
  20493. var ranges = getRanges(glyphs, numGlyphs);
  20494. var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  20495. var cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20496. var i, ii, j, jj;
  20497. for (i = ranges.length - 1; i >= 0; --i) {
  20498. if (ranges[i][0] <= 0xffff) {
  20499. break;
  20500. }
  20501. }
  20502. var bmpLength = i + 1;
  20503. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20504. ranges[i][1] = 0xfffe;
  20505. }
  20506. var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20507. var segCount = bmpLength + trailingRangesCount;
  20508. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20509. var startCount = "";
  20510. var endCount = "";
  20511. var idDeltas = "";
  20512. var idRangeOffsets = "";
  20513. var glyphsIds = "";
  20514. var bias = 0;
  20515. var range, start, end, codes;
  20516. for (i = 0, ii = bmpLength; i < ii; i++) {
  20517. range = ranges[i];
  20518. start = range[0];
  20519. end = range[1];
  20520. startCount += string16(start);
  20521. endCount += string16(end);
  20522. codes = range[2];
  20523. var contiguous = true;
  20524. for (j = 1, jj = codes.length; j < jj; ++j) {
  20525. if (codes[j] !== codes[j - 1] + 1) {
  20526. contiguous = false;
  20527. break;
  20528. }
  20529. }
  20530. if (!contiguous) {
  20531. var offset = (segCount - i) * 2 + bias * 2;
  20532. bias += end - start + 1;
  20533. idDeltas += string16(0);
  20534. idRangeOffsets += string16(offset);
  20535. for (j = 0, jj = codes.length; j < jj; ++j) {
  20536. glyphsIds += string16(codes[j]);
  20537. }
  20538. } else {
  20539. var startCode = codes[0];
  20540. idDeltas += string16(startCode - start & 0xffff);
  20541. idRangeOffsets += string16(0);
  20542. }
  20543. }
  20544. if (trailingRangesCount > 0) {
  20545. endCount += "\xFF\xFF";
  20546. startCount += "\xFF\xFF";
  20547. idDeltas += "\x00\x01";
  20548. idRangeOffsets += "\x00\x00";
  20549. }
  20550. var format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20551. var format31012 = "";
  20552. var header31012 = "";
  20553. if (numTables > 1) {
  20554. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20555. format31012 = "";
  20556. for (i = 0, ii = ranges.length; i < ii; i++) {
  20557. range = ranges[i];
  20558. start = range[0];
  20559. codes = range[2];
  20560. var code = codes[0];
  20561. for (j = 1, jj = codes.length; j < jj; ++j) {
  20562. if (codes[j] !== codes[j - 1] + 1) {
  20563. end = range[0] + j - 1;
  20564. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20565. start = end + 1;
  20566. code = codes[j];
  20567. }
  20568. }
  20569. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20570. }
  20571. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20572. }
  20573. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20574. }
  20575. function validateOS2Table(os2) {
  20576. var stream = new _stream.Stream(os2.data);
  20577. var version = stream.getUint16();
  20578. stream.getBytes(60);
  20579. var selection = stream.getUint16();
  20580. if (version < 4 && selection & 0x0300) {
  20581. return false;
  20582. }
  20583. var firstChar = stream.getUint16();
  20584. var lastChar = stream.getUint16();
  20585. if (firstChar > lastChar) {
  20586. return false;
  20587. }
  20588. stream.getBytes(6);
  20589. var usWinAscent = stream.getUint16();
  20590. if (usWinAscent === 0) {
  20591. return false;
  20592. }
  20593. os2.data[8] = os2.data[9] = 0;
  20594. return true;
  20595. }
  20596. function createOS2Table(properties, charstrings, override) {
  20597. override = override || {
  20598. unitsPerEm: 0,
  20599. yMax: 0,
  20600. yMin: 0,
  20601. ascent: 0,
  20602. descent: 0
  20603. };
  20604. var ulUnicodeRange1 = 0;
  20605. var ulUnicodeRange2 = 0;
  20606. var ulUnicodeRange3 = 0;
  20607. var ulUnicodeRange4 = 0;
  20608. var firstCharIndex = null;
  20609. var lastCharIndex = 0;
  20610. if (charstrings) {
  20611. for (var code in charstrings) {
  20612. code |= 0;
  20613. if (firstCharIndex > code || !firstCharIndex) {
  20614. firstCharIndex = code;
  20615. }
  20616. if (lastCharIndex < code) {
  20617. lastCharIndex = code;
  20618. }
  20619. var position = (0, _unicode.getUnicodeRangeFor)(code);
  20620. if (position < 32) {
  20621. ulUnicodeRange1 |= 1 << position;
  20622. } else if (position < 64) {
  20623. ulUnicodeRange2 |= 1 << position - 32;
  20624. } else if (position < 96) {
  20625. ulUnicodeRange3 |= 1 << position - 64;
  20626. } else if (position < 123) {
  20627. ulUnicodeRange4 |= 1 << position - 96;
  20628. } else {
  20629. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  20630. }
  20631. }
  20632. if (lastCharIndex > 0xffff) {
  20633. lastCharIndex = 0xffff;
  20634. }
  20635. } else {
  20636. firstCharIndex = 0;
  20637. lastCharIndex = 255;
  20638. }
  20639. var bbox = properties.bbox || [0, 0, 0, 0];
  20640. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  20641. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  20642. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  20643. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  20644. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  20645. typoDescent = -typoDescent;
  20646. }
  20647. var winAscent = override.yMax || typoAscent;
  20648. var winDescent = -override.yMin || -typoDescent;
  20649. return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
  20650. }
  20651. function createPostTable(properties) {
  20652. var angle = Math.floor(properties.italicAngle * 2 ** 16);
  20653. return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  20654. }
  20655. function createNameTable(name, proto) {
  20656. if (!proto) {
  20657. proto = [[], []];
  20658. }
  20659. var strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || "", proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  20660. var stringsUnicode = [];
  20661. var i, ii, j, jj, str;
  20662. for (i = 0, ii = strings.length; i < ii; i++) {
  20663. str = proto[1][i] || strings[i];
  20664. var strBufUnicode = [];
  20665. for (j = 0, jj = str.length; j < jj; j++) {
  20666. strBufUnicode.push(string16(str.charCodeAt(j)));
  20667. }
  20668. stringsUnicode.push(strBufUnicode.join(""));
  20669. }
  20670. var names = [strings, stringsUnicode];
  20671. var platforms = ["\x00\x01", "\x00\x03"];
  20672. var encodings = ["\x00\x00", "\x00\x01"];
  20673. var languages = ["\x00\x00", "\x04\x09"];
  20674. var namesRecordCount = strings.length * platforms.length;
  20675. var nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  20676. var strOffset = 0;
  20677. for (i = 0, ii = platforms.length; i < ii; i++) {
  20678. var strs = names[i];
  20679. for (j = 0, jj = strs.length; j < jj; j++) {
  20680. str = strs[j];
  20681. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  20682. nameTable += nameRecord;
  20683. strOffset += str.length;
  20684. }
  20685. }
  20686. nameTable += strings.join("") + stringsUnicode.join("");
  20687. return nameTable;
  20688. }
  20689. Font.prototype = {
  20690. name: null,
  20691. font: null,
  20692. mimetype: null,
  20693. encoding: null,
  20694. disableFontFace: false,
  20695. get renderer() {
  20696. var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  20697. return (0, _util.shadow)(this, "renderer", renderer);
  20698. },
  20699. exportData: function Font_exportData() {
  20700. var data = {};
  20701. for (var i in this) {
  20702. if (this.hasOwnProperty(i)) {
  20703. data[i] = this[i];
  20704. }
  20705. }
  20706. return data;
  20707. },
  20708. fallbackToSystemFont: function Font_fallbackToSystemFont() {
  20709. this.missingFile = true;
  20710. var charCode, unicode;
  20711. var name = this.name;
  20712. var type = this.type;
  20713. var subtype = this.subtype;
  20714. let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
  20715. var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  20716. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  20717. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  20718. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  20719. this.bold = fontName.search(/bold/gi) !== -1;
  20720. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  20721. this.black = name.search(/Black/g) !== -1;
  20722. this.remeasure = Object.keys(this.widths).length > 0;
  20723. if (isStandardFont && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  20724. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  20725. const map = [];
  20726. for (charCode in GlyphMapForStandardFonts) {
  20727. map[+charCode] = GlyphMapForStandardFonts[charCode];
  20728. }
  20729. if (/Arial-?Black/i.test(name)) {
  20730. var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  20731. for (charCode in SupplementalGlyphMapForArialBlack) {
  20732. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  20733. }
  20734. } else if (/Calibri/i.test(name)) {
  20735. const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
  20736. for (charCode in SupplementalGlyphMapForCalibri) {
  20737. map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
  20738. }
  20739. }
  20740. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  20741. if (!isIdentityUnicode) {
  20742. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20743. map[+charCode] = unicodeCharCode;
  20744. });
  20745. }
  20746. this.toFontChar = map;
  20747. this.toUnicode = new ToUnicodeMap(map);
  20748. } else if (/Symbol/i.test(fontName)) {
  20749. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20750. } else if (/Dingbats/i.test(fontName)) {
  20751. if (/Wingdings/i.test(name)) {
  20752. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  20753. }
  20754. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  20755. } else if (isStandardFont) {
  20756. this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20757. } else {
  20758. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20759. const map = [];
  20760. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  20761. if (!this.composite) {
  20762. var glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  20763. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20764. if (unicode !== -1) {
  20765. unicodeCharCode = unicode;
  20766. }
  20767. }
  20768. map[+charCode] = unicodeCharCode;
  20769. });
  20770. if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
  20771. if (/Verdana/i.test(name)) {
  20772. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  20773. for (charCode in GlyphMapForStandardFonts) {
  20774. map[+charCode] = GlyphMapForStandardFonts[charCode];
  20775. }
  20776. }
  20777. }
  20778. this.toFontChar = map;
  20779. }
  20780. this.loadedName = fontName.split("-")[0];
  20781. this.fontType = getFontType(type, subtype);
  20782. },
  20783. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  20784. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  20785. function readTables(file, numTables) {
  20786. const tables = Object.create(null);
  20787. tables["OS/2"] = null;
  20788. tables["cmap"] = null;
  20789. tables["head"] = null;
  20790. tables["hhea"] = null;
  20791. tables["hmtx"] = null;
  20792. tables["maxp"] = null;
  20793. tables["name"] = null;
  20794. tables["post"] = null;
  20795. for (let i = 0; i < numTables; i++) {
  20796. const table = readTableEntry(font);
  20797. if (!VALID_TABLES.includes(table.tag)) {
  20798. continue;
  20799. }
  20800. if (table.length === 0) {
  20801. continue;
  20802. }
  20803. tables[table.tag] = table;
  20804. }
  20805. return tables;
  20806. }
  20807. function readTableEntry(file) {
  20808. var tag = (0, _util.bytesToString)(file.getBytes(4));
  20809. var checksum = file.getInt32() >>> 0;
  20810. var offset = file.getInt32() >>> 0;
  20811. var length = file.getInt32() >>> 0;
  20812. var previousPosition = file.pos;
  20813. file.pos = file.start ? file.start : 0;
  20814. file.skip(offset);
  20815. var data = file.getBytes(length);
  20816. file.pos = previousPosition;
  20817. if (tag === "head") {
  20818. data[8] = data[9] = data[10] = data[11] = 0;
  20819. data[17] |= 0x20;
  20820. }
  20821. return {
  20822. tag,
  20823. checksum,
  20824. length,
  20825. offset,
  20826. data
  20827. };
  20828. }
  20829. function readOpenTypeHeader(ttf) {
  20830. return {
  20831. version: (0, _util.bytesToString)(ttf.getBytes(4)),
  20832. numTables: ttf.getUint16(),
  20833. searchRange: ttf.getUint16(),
  20834. entrySelector: ttf.getUint16(),
  20835. rangeShift: ttf.getUint16()
  20836. };
  20837. }
  20838. function readTrueTypeCollectionHeader(ttc) {
  20839. const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
  20840. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  20841. const majorVersion = ttc.getUint16();
  20842. const minorVersion = ttc.getUint16();
  20843. const numFonts = ttc.getInt32() >>> 0;
  20844. const offsetTable = [];
  20845. for (let i = 0; i < numFonts; i++) {
  20846. offsetTable.push(ttc.getInt32() >>> 0);
  20847. }
  20848. const header = {
  20849. ttcTag,
  20850. majorVersion,
  20851. minorVersion,
  20852. numFonts,
  20853. offsetTable
  20854. };
  20855. switch (majorVersion) {
  20856. case 1:
  20857. return header;
  20858. case 2:
  20859. header.dsigTag = ttc.getInt32() >>> 0;
  20860. header.dsigLength = ttc.getInt32() >>> 0;
  20861. header.dsigOffset = ttc.getInt32() >>> 0;
  20862. return header;
  20863. }
  20864. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  20865. }
  20866. function readTrueTypeCollectionData(ttc, fontName) {
  20867. const {
  20868. numFonts,
  20869. offsetTable
  20870. } = readTrueTypeCollectionHeader(ttc);
  20871. for (let i = 0; i < numFonts; i++) {
  20872. ttc.pos = (ttc.start || 0) + offsetTable[i];
  20873. const potentialHeader = readOpenTypeHeader(ttc);
  20874. const potentialTables = readTables(ttc, potentialHeader.numTables);
  20875. if (!potentialTables["name"]) {
  20876. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  20877. }
  20878. const nameTable = readNameTable(potentialTables["name"]);
  20879. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  20880. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  20881. const nameEntry = nameTable[j][k];
  20882. if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) {
  20883. return {
  20884. header: potentialHeader,
  20885. tables: potentialTables
  20886. };
  20887. }
  20888. }
  20889. }
  20890. }
  20891. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  20892. }
  20893. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  20894. if (!cmap) {
  20895. (0, _util.warn)("No cmap table available.");
  20896. return {
  20897. platformId: -1,
  20898. encodingId: -1,
  20899. mappings: [],
  20900. hasShortCmap: false
  20901. };
  20902. }
  20903. var segment;
  20904. var start = (font.start ? font.start : 0) + cmap.offset;
  20905. font.pos = start;
  20906. font.getUint16();
  20907. var numTables = font.getUint16();
  20908. var potentialTable;
  20909. var canBreak = false;
  20910. for (var i = 0; i < numTables; i++) {
  20911. var platformId = font.getUint16();
  20912. var encodingId = font.getUint16();
  20913. var offset = font.getInt32() >>> 0;
  20914. var useTable = false;
  20915. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  20916. continue;
  20917. }
  20918. if (platformId === 0 && encodingId === 0) {
  20919. useTable = true;
  20920. } else if (platformId === 1 && encodingId === 0) {
  20921. useTable = true;
  20922. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  20923. useTable = true;
  20924. if (!isSymbolicFont) {
  20925. canBreak = true;
  20926. }
  20927. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  20928. useTable = true;
  20929. canBreak = true;
  20930. }
  20931. if (useTable) {
  20932. potentialTable = {
  20933. platformId,
  20934. encodingId,
  20935. offset
  20936. };
  20937. }
  20938. if (canBreak) {
  20939. break;
  20940. }
  20941. }
  20942. if (potentialTable) {
  20943. font.pos = start + potentialTable.offset;
  20944. }
  20945. if (!potentialTable || font.peekByte() === -1) {
  20946. (0, _util.warn)("Could not find a preferred cmap table.");
  20947. return {
  20948. platformId: -1,
  20949. encodingId: -1,
  20950. mappings: [],
  20951. hasShortCmap: false
  20952. };
  20953. }
  20954. var format = font.getUint16();
  20955. font.getUint16();
  20956. font.getUint16();
  20957. var hasShortCmap = false;
  20958. var mappings = [];
  20959. var j, glyphId;
  20960. if (format === 0) {
  20961. for (j = 0; j < 256; j++) {
  20962. var index = font.getByte();
  20963. if (!index) {
  20964. continue;
  20965. }
  20966. mappings.push({
  20967. charCode: j,
  20968. glyphId: index
  20969. });
  20970. }
  20971. hasShortCmap = true;
  20972. } else if (format === 4) {
  20973. var segCount = font.getUint16() >> 1;
  20974. font.getBytes(6);
  20975. var segIndex,
  20976. segments = [];
  20977. for (segIndex = 0; segIndex < segCount; segIndex++) {
  20978. segments.push({
  20979. end: font.getUint16()
  20980. });
  20981. }
  20982. font.getUint16();
  20983. for (segIndex = 0; segIndex < segCount; segIndex++) {
  20984. segments[segIndex].start = font.getUint16();
  20985. }
  20986. for (segIndex = 0; segIndex < segCount; segIndex++) {
  20987. segments[segIndex].delta = font.getUint16();
  20988. }
  20989. var offsetsCount = 0;
  20990. for (segIndex = 0; segIndex < segCount; segIndex++) {
  20991. segment = segments[segIndex];
  20992. var rangeOffset = font.getUint16();
  20993. if (!rangeOffset) {
  20994. segment.offsetIndex = -1;
  20995. continue;
  20996. }
  20997. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  20998. segment.offsetIndex = offsetIndex;
  20999. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21000. }
  21001. var offsets = [];
  21002. for (j = 0; j < offsetsCount; j++) {
  21003. offsets.push(font.getUint16());
  21004. }
  21005. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21006. segment = segments[segIndex];
  21007. start = segment.start;
  21008. var end = segment.end;
  21009. var delta = segment.delta;
  21010. offsetIndex = segment.offsetIndex;
  21011. for (j = start; j <= end; j++) {
  21012. if (j === 0xffff) {
  21013. continue;
  21014. }
  21015. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21016. glyphId = glyphId + delta & 0xffff;
  21017. mappings.push({
  21018. charCode: j,
  21019. glyphId
  21020. });
  21021. }
  21022. }
  21023. } else if (format === 6) {
  21024. var firstCode = font.getUint16();
  21025. var entryCount = font.getUint16();
  21026. for (j = 0; j < entryCount; j++) {
  21027. glyphId = font.getUint16();
  21028. var charCode = firstCode + j;
  21029. mappings.push({
  21030. charCode,
  21031. glyphId
  21032. });
  21033. }
  21034. } else {
  21035. (0, _util.warn)("cmap table has unsupported format: " + format);
  21036. return {
  21037. platformId: -1,
  21038. encodingId: -1,
  21039. mappings: [],
  21040. hasShortCmap: false
  21041. };
  21042. }
  21043. mappings.sort(function (a, b) {
  21044. return a.charCode - b.charCode;
  21045. });
  21046. for (i = 1; i < mappings.length; i++) {
  21047. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21048. mappings.splice(i, 1);
  21049. i--;
  21050. }
  21051. }
  21052. return {
  21053. platformId: potentialTable.platformId,
  21054. encodingId: potentialTable.encodingId,
  21055. mappings,
  21056. hasShortCmap
  21057. };
  21058. }
  21059. function sanitizeMetrics(font, header, metrics, numGlyphs, dupFirstEntry) {
  21060. if (!header) {
  21061. if (metrics) {
  21062. metrics.data = null;
  21063. }
  21064. return;
  21065. }
  21066. font.pos = (font.start ? font.start : 0) + header.offset;
  21067. font.pos += 4;
  21068. font.pos += 2;
  21069. font.pos += 2;
  21070. font.pos += 2;
  21071. font.pos += 2;
  21072. font.pos += 2;
  21073. font.pos += 2;
  21074. font.pos += 2;
  21075. font.pos += 2;
  21076. font.pos += 2;
  21077. font.pos += 2;
  21078. font.pos += 8;
  21079. font.pos += 2;
  21080. var numOfMetrics = font.getUint16();
  21081. if (numOfMetrics > numGlyphs) {
  21082. (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")");
  21083. numOfMetrics = numGlyphs;
  21084. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21085. header.data[35] = numOfMetrics & 0x00ff;
  21086. }
  21087. var numOfSidebearings = numGlyphs - numOfMetrics;
  21088. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21089. if (numMissing > 0) {
  21090. var entries = new Uint8Array(metrics.length + numMissing * 2);
  21091. entries.set(metrics.data);
  21092. if (dupFirstEntry) {
  21093. entries[metrics.length] = metrics.data[2];
  21094. entries[metrics.length + 1] = metrics.data[3];
  21095. }
  21096. metrics.data = entries;
  21097. }
  21098. }
  21099. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21100. var glyphProfile = {
  21101. length: 0,
  21102. sizeOfInstructions: 0
  21103. };
  21104. if (sourceEnd - sourceStart <= 12) {
  21105. return glyphProfile;
  21106. }
  21107. var glyf = source.subarray(sourceStart, sourceEnd);
  21108. var contoursCount = signedInt16(glyf[0], glyf[1]);
  21109. if (contoursCount < 0) {
  21110. contoursCount = -1;
  21111. writeSignedInt16(glyf, 0, contoursCount);
  21112. dest.set(glyf, destStart);
  21113. glyphProfile.length = glyf.length;
  21114. return glyphProfile;
  21115. }
  21116. var i,
  21117. j = 10,
  21118. flagsCount = 0;
  21119. for (i = 0; i < contoursCount; i++) {
  21120. var endPoint = glyf[j] << 8 | glyf[j + 1];
  21121. flagsCount = endPoint + 1;
  21122. j += 2;
  21123. }
  21124. var instructionsStart = j;
  21125. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21126. glyphProfile.sizeOfInstructions = instructionsLength;
  21127. j += 2 + instructionsLength;
  21128. var instructionsEnd = j;
  21129. var coordinatesLength = 0;
  21130. for (i = 0; i < flagsCount; i++) {
  21131. var flag = glyf[j++];
  21132. if (flag & 0xc0) {
  21133. glyf[j - 1] = flag & 0x3f;
  21134. }
  21135. let xLength = 2;
  21136. if (flag & 2) {
  21137. xLength = 1;
  21138. } else if (flag & 16) {
  21139. xLength = 0;
  21140. }
  21141. let yLength = 2;
  21142. if (flag & 4) {
  21143. yLength = 1;
  21144. } else if (flag & 32) {
  21145. yLength = 0;
  21146. }
  21147. const xyLength = xLength + yLength;
  21148. coordinatesLength += xyLength;
  21149. if (flag & 8) {
  21150. var repeat = glyf[j++];
  21151. i += repeat;
  21152. coordinatesLength += repeat * xyLength;
  21153. }
  21154. }
  21155. if (coordinatesLength === 0) {
  21156. return glyphProfile;
  21157. }
  21158. var glyphDataLength = j + coordinatesLength;
  21159. if (glyphDataLength > glyf.length) {
  21160. return glyphProfile;
  21161. }
  21162. if (!hintsValid && instructionsLength > 0) {
  21163. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21164. dest.set([0, 0], destStart + instructionsStart);
  21165. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21166. glyphDataLength -= instructionsLength;
  21167. if (glyf.length - glyphDataLength > 3) {
  21168. glyphDataLength = glyphDataLength + 3 & ~3;
  21169. }
  21170. glyphProfile.length = glyphDataLength;
  21171. return glyphProfile;
  21172. }
  21173. if (glyf.length - glyphDataLength > 3) {
  21174. glyphDataLength = glyphDataLength + 3 & ~3;
  21175. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21176. glyphProfile.length = glyphDataLength;
  21177. return glyphProfile;
  21178. }
  21179. dest.set(glyf, destStart);
  21180. glyphProfile.length = glyf.length;
  21181. return glyphProfile;
  21182. }
  21183. function sanitizeHead(head, numGlyphs, locaLength) {
  21184. var data = head.data;
  21185. var version = int32(data[0], data[1], data[2], data[3]);
  21186. if (version >> 16 !== 1) {
  21187. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21188. data[0] = 0;
  21189. data[1] = 1;
  21190. data[2] = 0;
  21191. data[3] = 0;
  21192. }
  21193. var indexToLocFormat = int16(data[50], data[51]);
  21194. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21195. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21196. var numGlyphsPlusOne = numGlyphs + 1;
  21197. if (locaLength === numGlyphsPlusOne << 1) {
  21198. data[50] = 0;
  21199. data[51] = 0;
  21200. } else if (locaLength === numGlyphsPlusOne << 2) {
  21201. data[50] = 0;
  21202. data[51] = 1;
  21203. } else {
  21204. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21205. }
  21206. }
  21207. }
  21208. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21209. var itemSize, itemDecode, itemEncode;
  21210. if (isGlyphLocationsLong) {
  21211. itemSize = 4;
  21212. itemDecode = function fontItemDecodeLong(data, offset) {
  21213. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21214. };
  21215. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21216. data[offset] = value >>> 24 & 0xff;
  21217. data[offset + 1] = value >> 16 & 0xff;
  21218. data[offset + 2] = value >> 8 & 0xff;
  21219. data[offset + 3] = value & 0xff;
  21220. };
  21221. } else {
  21222. itemSize = 2;
  21223. itemDecode = function fontItemDecode(data, offset) {
  21224. return data[offset] << 9 | data[offset + 1] << 1;
  21225. };
  21226. itemEncode = function fontItemEncode(data, offset, value) {
  21227. data[offset] = value >> 9 & 0xff;
  21228. data[offset + 1] = value >> 1 & 0xff;
  21229. };
  21230. }
  21231. var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21232. var locaDataSize = itemSize * (1 + numGlyphsOut);
  21233. var locaData = new Uint8Array(locaDataSize);
  21234. locaData.set(loca.data.subarray(0, locaDataSize));
  21235. loca.data = locaData;
  21236. var oldGlyfData = glyf.data;
  21237. var oldGlyfDataLength = oldGlyfData.length;
  21238. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  21239. var startOffset = itemDecode(locaData, 0);
  21240. var writeOffset = 0;
  21241. var missingGlyphs = Object.create(null);
  21242. itemEncode(locaData, 0, writeOffset);
  21243. var i, j;
  21244. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21245. var endOffset = itemDecode(locaData, j);
  21246. if (endOffset === 0) {
  21247. endOffset = startOffset;
  21248. }
  21249. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  21250. endOffset = oldGlyfDataLength;
  21251. }
  21252. if (endOffset > oldGlyfDataLength) {
  21253. startOffset = endOffset;
  21254. }
  21255. var glyphProfile = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  21256. var newLength = glyphProfile.length;
  21257. if (newLength === 0) {
  21258. missingGlyphs[i] = true;
  21259. }
  21260. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21261. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21262. }
  21263. writeOffset += newLength;
  21264. itemEncode(locaData, j, writeOffset);
  21265. startOffset = endOffset;
  21266. }
  21267. if (writeOffset === 0) {
  21268. var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21269. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21270. itemEncode(locaData, j, simpleGlyph.length);
  21271. }
  21272. glyf.data = simpleGlyph;
  21273. } else if (dupFirstEntry) {
  21274. var firstEntryLength = itemDecode(locaData, itemSize);
  21275. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21276. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21277. } else {
  21278. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21279. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21280. }
  21281. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21282. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21283. } else {
  21284. glyf.data = newGlyfData.subarray(0, writeOffset);
  21285. }
  21286. return {
  21287. missingGlyphs,
  21288. maxSizeOfInstructions
  21289. };
  21290. }
  21291. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  21292. var start = (font.start ? font.start : 0) + post.offset;
  21293. font.pos = start;
  21294. var length = post.length,
  21295. end = start + length;
  21296. var version = font.getInt32();
  21297. font.getBytes(28);
  21298. var glyphNames;
  21299. var valid = true;
  21300. var i;
  21301. switch (version) {
  21302. case 0x00010000:
  21303. glyphNames = MacStandardGlyphOrdering;
  21304. break;
  21305. case 0x00020000:
  21306. var numGlyphs = font.getUint16();
  21307. if (numGlyphs !== maxpNumGlyphs) {
  21308. valid = false;
  21309. break;
  21310. }
  21311. var glyphNameIndexes = [];
  21312. for (i = 0; i < numGlyphs; ++i) {
  21313. var index = font.getUint16();
  21314. if (index >= 32768) {
  21315. valid = false;
  21316. break;
  21317. }
  21318. glyphNameIndexes.push(index);
  21319. }
  21320. if (!valid) {
  21321. break;
  21322. }
  21323. var customNames = [];
  21324. var strBuf = [];
  21325. while (font.pos < end) {
  21326. var stringLength = font.getByte();
  21327. strBuf.length = stringLength;
  21328. for (i = 0; i < stringLength; ++i) {
  21329. strBuf[i] = String.fromCharCode(font.getByte());
  21330. }
  21331. customNames.push(strBuf.join(""));
  21332. }
  21333. glyphNames = [];
  21334. for (i = 0; i < numGlyphs; ++i) {
  21335. var j = glyphNameIndexes[i];
  21336. if (j < 258) {
  21337. glyphNames.push(MacStandardGlyphOrdering[j]);
  21338. continue;
  21339. }
  21340. glyphNames.push(customNames[j - 258]);
  21341. }
  21342. break;
  21343. case 0x00030000:
  21344. break;
  21345. default:
  21346. (0, _util.warn)("Unknown/unsupported post table version " + version);
  21347. valid = false;
  21348. if (properties.defaultEncoding) {
  21349. glyphNames = properties.defaultEncoding;
  21350. }
  21351. break;
  21352. }
  21353. properties.glyphNames = glyphNames;
  21354. return valid;
  21355. }
  21356. function readNameTable(nameTable) {
  21357. var start = (font.start ? font.start : 0) + nameTable.offset;
  21358. font.pos = start;
  21359. var names = [[], []];
  21360. var length = nameTable.length,
  21361. end = start + length;
  21362. var format = font.getUint16();
  21363. var FORMAT_0_HEADER_LENGTH = 6;
  21364. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  21365. return names;
  21366. }
  21367. var numRecords = font.getUint16();
  21368. var stringsStart = font.getUint16();
  21369. var records = [];
  21370. var NAME_RECORD_LENGTH = 12;
  21371. var i, ii;
  21372. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  21373. var r = {
  21374. platform: font.getUint16(),
  21375. encoding: font.getUint16(),
  21376. language: font.getUint16(),
  21377. name: font.getUint16(),
  21378. length: font.getUint16(),
  21379. offset: font.getUint16()
  21380. };
  21381. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  21382. records.push(r);
  21383. }
  21384. }
  21385. for (i = 0, ii = records.length; i < ii; i++) {
  21386. var record = records[i];
  21387. if (record.length <= 0) {
  21388. continue;
  21389. }
  21390. var pos = start + stringsStart + record.offset;
  21391. if (pos + record.length > end) {
  21392. continue;
  21393. }
  21394. font.pos = pos;
  21395. var nameIndex = record.name;
  21396. if (record.encoding) {
  21397. var str = "";
  21398. for (var j = 0, jj = record.length; j < jj; j += 2) {
  21399. str += String.fromCharCode(font.getUint16());
  21400. }
  21401. names[1][nameIndex] = str;
  21402. } else {
  21403. names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
  21404. }
  21405. }
  21406. return names;
  21407. }
  21408. var TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
  21409. function sanitizeTTProgram(table, ttContext) {
  21410. var data = table.data;
  21411. var i = 0,
  21412. j,
  21413. n,
  21414. b,
  21415. funcId,
  21416. pc,
  21417. lastEndf = 0,
  21418. lastDeff = 0;
  21419. var stack = [];
  21420. var callstack = [];
  21421. var functionsCalled = [];
  21422. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  21423. var inFDEF = false,
  21424. ifLevel = 0,
  21425. inELSE = 0;
  21426. for (var ii = data.length; i < ii;) {
  21427. var op = data[i++];
  21428. if (op === 0x40) {
  21429. n = data[i++];
  21430. if (inFDEF || inELSE) {
  21431. i += n;
  21432. } else {
  21433. for (j = 0; j < n; j++) {
  21434. stack.push(data[i++]);
  21435. }
  21436. }
  21437. } else if (op === 0x41) {
  21438. n = data[i++];
  21439. if (inFDEF || inELSE) {
  21440. i += n * 2;
  21441. } else {
  21442. for (j = 0; j < n; j++) {
  21443. b = data[i++];
  21444. stack.push(b << 8 | data[i++]);
  21445. }
  21446. }
  21447. } else if ((op & 0xf8) === 0xb0) {
  21448. n = op - 0xb0 + 1;
  21449. if (inFDEF || inELSE) {
  21450. i += n;
  21451. } else {
  21452. for (j = 0; j < n; j++) {
  21453. stack.push(data[i++]);
  21454. }
  21455. }
  21456. } else if ((op & 0xf8) === 0xb8) {
  21457. n = op - 0xb8 + 1;
  21458. if (inFDEF || inELSE) {
  21459. i += n * 2;
  21460. } else {
  21461. for (j = 0; j < n; j++) {
  21462. b = data[i++];
  21463. stack.push(b << 8 | data[i++]);
  21464. }
  21465. }
  21466. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  21467. if (!inFDEF && !inELSE) {
  21468. funcId = stack[stack.length - 1];
  21469. if (isNaN(funcId)) {
  21470. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  21471. } else {
  21472. ttContext.functionsUsed[funcId] = true;
  21473. if (funcId in ttContext.functionsStackDeltas) {
  21474. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  21475. if (newStackLength < 0) {
  21476. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  21477. ttContext.hintsValid = false;
  21478. return;
  21479. }
  21480. stack.length = newStackLength;
  21481. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  21482. callstack.push({
  21483. data,
  21484. i,
  21485. stackTop: stack.length - 1
  21486. });
  21487. functionsCalled.push(funcId);
  21488. pc = ttContext.functionsDefined[funcId];
  21489. if (!pc) {
  21490. (0, _util.warn)("TT: CALL non-existent function");
  21491. ttContext.hintsValid = false;
  21492. return;
  21493. }
  21494. data = pc.data;
  21495. i = pc.i;
  21496. }
  21497. }
  21498. }
  21499. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  21500. if (inFDEF || inELSE) {
  21501. (0, _util.warn)("TT: nested FDEFs not allowed");
  21502. tooComplexToFollowFunctions = true;
  21503. }
  21504. inFDEF = true;
  21505. lastDeff = i;
  21506. funcId = stack.pop();
  21507. ttContext.functionsDefined[funcId] = {
  21508. data,
  21509. i
  21510. };
  21511. } else if (op === 0x2d) {
  21512. if (inFDEF) {
  21513. inFDEF = false;
  21514. lastEndf = i;
  21515. } else {
  21516. pc = callstack.pop();
  21517. if (!pc) {
  21518. (0, _util.warn)("TT: ENDF bad stack");
  21519. ttContext.hintsValid = false;
  21520. return;
  21521. }
  21522. funcId = functionsCalled.pop();
  21523. data = pc.data;
  21524. i = pc.i;
  21525. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  21526. }
  21527. } else if (op === 0x89) {
  21528. if (inFDEF || inELSE) {
  21529. (0, _util.warn)("TT: nested IDEFs not allowed");
  21530. tooComplexToFollowFunctions = true;
  21531. }
  21532. inFDEF = true;
  21533. lastDeff = i;
  21534. } else if (op === 0x58) {
  21535. ++ifLevel;
  21536. } else if (op === 0x1b) {
  21537. inELSE = ifLevel;
  21538. } else if (op === 0x59) {
  21539. if (inELSE === ifLevel) {
  21540. inELSE = 0;
  21541. }
  21542. --ifLevel;
  21543. } else if (op === 0x1c) {
  21544. if (!inFDEF && !inELSE) {
  21545. var offset = stack[stack.length - 1];
  21546. if (offset > 0) {
  21547. i += offset - 1;
  21548. }
  21549. }
  21550. }
  21551. if (!inFDEF && !inELSE) {
  21552. let stackDelta = 0;
  21553. if (op <= 0x8e) {
  21554. stackDelta = TTOpsStackDeltas[op];
  21555. } else if (op >= 0xc0 && op <= 0xdf) {
  21556. stackDelta = -1;
  21557. } else if (op >= 0xe0) {
  21558. stackDelta = -2;
  21559. }
  21560. if (op >= 0x71 && op <= 0x75) {
  21561. n = stack.pop();
  21562. if (!isNaN(n)) {
  21563. stackDelta = -n * 2;
  21564. }
  21565. }
  21566. while (stackDelta < 0 && stack.length > 0) {
  21567. stack.pop();
  21568. stackDelta++;
  21569. }
  21570. while (stackDelta > 0) {
  21571. stack.push(NaN);
  21572. stackDelta--;
  21573. }
  21574. }
  21575. }
  21576. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  21577. var content = [data];
  21578. if (i > data.length) {
  21579. content.push(new Uint8Array(i - data.length));
  21580. }
  21581. if (lastDeff > lastEndf) {
  21582. (0, _util.warn)("TT: complementing a missing function tail");
  21583. content.push(new Uint8Array([0x22, 0x2d]));
  21584. }
  21585. foldTTTable(table, content);
  21586. }
  21587. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  21588. if (ttContext.tooComplexToFollowFunctions) {
  21589. return;
  21590. }
  21591. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  21592. (0, _util.warn)("TT: more functions defined than expected");
  21593. ttContext.hintsValid = false;
  21594. return;
  21595. }
  21596. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  21597. if (j > maxFunctionDefs) {
  21598. (0, _util.warn)("TT: invalid function id: " + j);
  21599. ttContext.hintsValid = false;
  21600. return;
  21601. }
  21602. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  21603. (0, _util.warn)("TT: undefined function: " + j);
  21604. ttContext.hintsValid = false;
  21605. return;
  21606. }
  21607. }
  21608. }
  21609. function foldTTTable(table, content) {
  21610. if (content.length > 1) {
  21611. var newLength = 0;
  21612. var j, jj;
  21613. for (j = 0, jj = content.length; j < jj; j++) {
  21614. newLength += content[j].length;
  21615. }
  21616. newLength = newLength + 3 & ~3;
  21617. var result = new Uint8Array(newLength);
  21618. var pos = 0;
  21619. for (j = 0, jj = content.length; j < jj; j++) {
  21620. result.set(content[j], pos);
  21621. pos += content[j].length;
  21622. }
  21623. table.data = result;
  21624. table.length = newLength;
  21625. }
  21626. }
  21627. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  21628. var ttContext = {
  21629. functionsDefined: [],
  21630. functionsUsed: [],
  21631. functionsStackDeltas: [],
  21632. tooComplexToFollowFunctions: false,
  21633. hintsValid: true
  21634. };
  21635. if (fpgm) {
  21636. sanitizeTTProgram(fpgm, ttContext);
  21637. }
  21638. if (prep) {
  21639. sanitizeTTProgram(prep, ttContext);
  21640. }
  21641. if (fpgm) {
  21642. checkInvalidFunctions(ttContext, maxFunctionDefs);
  21643. }
  21644. if (cvt && cvt.length & 1) {
  21645. var cvtData = new Uint8Array(cvt.length + 1);
  21646. cvtData.set(cvt.data);
  21647. cvt.data = cvtData;
  21648. }
  21649. return ttContext.hintsValid;
  21650. }
  21651. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  21652. let header, tables;
  21653. if (isTrueTypeCollectionFile(font)) {
  21654. const ttcData = readTrueTypeCollectionData(font, this.name);
  21655. header = ttcData.header;
  21656. tables = ttcData.tables;
  21657. } else {
  21658. header = readOpenTypeHeader(font);
  21659. tables = readTables(font, header.numTables);
  21660. }
  21661. let cff, cffFile;
  21662. var isTrueType = !tables["CFF "];
  21663. if (!isTrueType) {
  21664. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  21665. if (header.version === "OTTO" && !isComposite || !tables["head"] || !tables["hhea"] || !tables["maxp"] || !tables["post"]) {
  21666. cffFile = new _stream.Stream(tables["CFF "].data);
  21667. cff = new CFFFont(cffFile, properties);
  21668. adjustWidths(properties);
  21669. return this.convert(name, cff, properties);
  21670. }
  21671. delete tables["glyf"];
  21672. delete tables["loca"];
  21673. delete tables["fpgm"];
  21674. delete tables["prep"];
  21675. delete tables["cvt "];
  21676. this.isOpenType = true;
  21677. } else {
  21678. if (!tables["loca"]) {
  21679. throw new _util.FormatError('Required "loca" table is not found');
  21680. }
  21681. if (!tables["glyf"]) {
  21682. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  21683. tables["glyf"] = {
  21684. tag: "glyf",
  21685. data: new Uint8Array(0)
  21686. };
  21687. }
  21688. this.isOpenType = false;
  21689. }
  21690. if (!tables["maxp"]) {
  21691. throw new _util.FormatError('Required "maxp" table is not found');
  21692. }
  21693. font.pos = (font.start || 0) + tables["maxp"].offset;
  21694. var version = font.getInt32();
  21695. const numGlyphs = font.getUint16();
  21696. let numGlyphsOut = numGlyphs + 1;
  21697. let dupFirstEntry = true;
  21698. if (numGlyphsOut > 0xffff) {
  21699. dupFirstEntry = false;
  21700. numGlyphsOut = numGlyphs;
  21701. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  21702. }
  21703. var maxFunctionDefs = 0;
  21704. var maxSizeOfInstructions = 0;
  21705. if (version >= 0x00010000 && tables["maxp"].length >= 22) {
  21706. font.pos += 8;
  21707. var maxZones = font.getUint16();
  21708. if (maxZones > 2) {
  21709. tables["maxp"].data[14] = 0;
  21710. tables["maxp"].data[15] = 2;
  21711. }
  21712. font.pos += 4;
  21713. maxFunctionDefs = font.getUint16();
  21714. font.pos += 4;
  21715. maxSizeOfInstructions = font.getUint16();
  21716. }
  21717. tables["maxp"].data[4] = numGlyphsOut >> 8;
  21718. tables["maxp"].data[5] = numGlyphsOut & 255;
  21719. var hintsValid = sanitizeTTPrograms(tables["fpgm"], tables["prep"], tables["cvt "], maxFunctionDefs);
  21720. if (!hintsValid) {
  21721. delete tables["fpgm"];
  21722. delete tables["prep"];
  21723. delete tables["cvt "];
  21724. }
  21725. sanitizeMetrics(font, tables["hhea"], tables["hmtx"], numGlyphsOut, dupFirstEntry);
  21726. if (!tables["head"]) {
  21727. throw new _util.FormatError('Required "head" table is not found');
  21728. }
  21729. sanitizeHead(tables["head"], numGlyphs, isTrueType ? tables["loca"].length : 0);
  21730. var missingGlyphs = Object.create(null);
  21731. if (isTrueType) {
  21732. var isGlyphLocationsLong = int16(tables["head"].data[50], tables["head"].data[51]);
  21733. var glyphsInfo = sanitizeGlyphLocations(tables["loca"], tables["glyf"], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  21734. missingGlyphs = glyphsInfo.missingGlyphs;
  21735. if (version >= 0x00010000 && tables["maxp"].length >= 22) {
  21736. tables["maxp"].data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  21737. tables["maxp"].data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  21738. }
  21739. }
  21740. if (!tables["hhea"]) {
  21741. throw new _util.FormatError('Required "hhea" table is not found');
  21742. }
  21743. if (tables["hhea"].data[10] === 0 && tables["hhea"].data[11] === 0) {
  21744. tables["hhea"].data[10] = 0xff;
  21745. tables["hhea"].data[11] = 0xff;
  21746. }
  21747. var metricsOverride = {
  21748. unitsPerEm: int16(tables["head"].data[18], tables["head"].data[19]),
  21749. yMax: int16(tables["head"].data[42], tables["head"].data[43]),
  21750. yMin: signedInt16(tables["head"].data[38], tables["head"].data[39]),
  21751. ascent: int16(tables["hhea"].data[4], tables["hhea"].data[5]),
  21752. descent: signedInt16(tables["hhea"].data[6], tables["hhea"].data[7])
  21753. };
  21754. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  21755. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  21756. if (tables["post"]) {
  21757. readPostScriptTable(tables["post"], properties, numGlyphs);
  21758. }
  21759. tables["post"] = {
  21760. tag: "post",
  21761. data: createPostTable(properties)
  21762. };
  21763. var charCodeToGlyphId = [],
  21764. charCode;
  21765. function hasGlyph(glyphId) {
  21766. return !missingGlyphs[glyphId];
  21767. }
  21768. if (properties.composite) {
  21769. var cidToGidMap = properties.cidToGidMap || [];
  21770. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  21771. properties.cMap.forEach(function (charCode, cid) {
  21772. if (cid > 0xffff) {
  21773. throw new _util.FormatError("Max size of CID is 65,535");
  21774. }
  21775. var glyphId = -1;
  21776. if (isCidToGidMapEmpty) {
  21777. glyphId = cid;
  21778. } else if (cidToGidMap[cid] !== undefined) {
  21779. glyphId = cidToGidMap[cid];
  21780. }
  21781. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  21782. charCodeToGlyphId[charCode] = glyphId;
  21783. }
  21784. });
  21785. } else {
  21786. var cmapTable = readCmapTable(tables["cmap"], font, this.isSymbolicFont, properties.hasEncoding);
  21787. var cmapPlatformId = cmapTable.platformId;
  21788. var cmapEncodingId = cmapTable.encodingId;
  21789. var cmapMappings = cmapTable.mappings;
  21790. var cmapMappingsLength = cmapMappings.length;
  21791. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) {
  21792. var baseEncoding = [];
  21793. if (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding") {
  21794. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  21795. }
  21796. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  21797. for (charCode = 0; charCode < 256; charCode++) {
  21798. var glyphName, standardGlyphName;
  21799. if (this.differences && charCode in this.differences) {
  21800. glyphName = this.differences[charCode];
  21801. } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") {
  21802. glyphName = baseEncoding[charCode];
  21803. } else {
  21804. glyphName = _encodings.StandardEncoding[charCode];
  21805. }
  21806. if (!glyphName) {
  21807. continue;
  21808. }
  21809. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  21810. var unicodeOrCharCode;
  21811. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  21812. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  21813. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  21814. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  21815. }
  21816. var found = false;
  21817. for (let i = 0; i < cmapMappingsLength; ++i) {
  21818. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  21819. continue;
  21820. }
  21821. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  21822. found = true;
  21823. break;
  21824. }
  21825. if (!found && properties.glyphNames) {
  21826. var glyphId = properties.glyphNames.indexOf(glyphName);
  21827. if (glyphId === -1 && standardGlyphName !== glyphName) {
  21828. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  21829. }
  21830. if (glyphId > 0 && hasGlyph(glyphId)) {
  21831. charCodeToGlyphId[charCode] = glyphId;
  21832. }
  21833. }
  21834. }
  21835. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  21836. for (let i = 0; i < cmapMappingsLength; ++i) {
  21837. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  21838. }
  21839. } else {
  21840. for (let i = 0; i < cmapMappingsLength; ++i) {
  21841. charCode = cmapMappings[i].charCode;
  21842. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  21843. charCode &= 0xff;
  21844. }
  21845. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  21846. }
  21847. }
  21848. }
  21849. if (charCodeToGlyphId.length === 0) {
  21850. charCodeToGlyphId[0] = 0;
  21851. }
  21852. let glyphZeroId = numGlyphsOut - 1;
  21853. if (!dupFirstEntry) {
  21854. glyphZeroId = 0;
  21855. }
  21856. var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  21857. this.toFontChar = newMapping.toFontChar;
  21858. tables["cmap"] = {
  21859. tag: "cmap",
  21860. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  21861. };
  21862. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"])) {
  21863. tables["OS/2"] = {
  21864. tag: "OS/2",
  21865. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  21866. };
  21867. }
  21868. if (!isTrueType) {
  21869. try {
  21870. cffFile = new _stream.Stream(tables["CFF "].data);
  21871. var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  21872. cff = parser.parse();
  21873. cff.duplicateFirstGlyph();
  21874. var compiler = new _cff_parser.CFFCompiler(cff);
  21875. tables["CFF "].data = compiler.compile();
  21876. } catch (e) {
  21877. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  21878. }
  21879. }
  21880. if (!tables["name"]) {
  21881. tables["name"] = {
  21882. tag: "name",
  21883. data: createNameTable(this.name)
  21884. };
  21885. } else {
  21886. var namePrototype = readNameTable(tables["name"]);
  21887. tables["name"].data = createNameTable(name, namePrototype);
  21888. }
  21889. var builder = new OpenTypeFileBuilder(header.version);
  21890. for (var tableTag in tables) {
  21891. builder.addTable(tableTag, tables[tableTag].data);
  21892. }
  21893. return builder.toArray();
  21894. },
  21895. convert: function Font_convert(fontName, font, properties) {
  21896. properties.fixedPitch = false;
  21897. if (properties.builtInEncoding) {
  21898. adjustToUnicode(properties, properties.builtInEncoding);
  21899. }
  21900. let glyphZeroId = 1;
  21901. if (font instanceof CFFFont) {
  21902. glyphZeroId = font.numGlyphs - 1;
  21903. }
  21904. var mapping = font.getGlyphMapping(properties);
  21905. var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  21906. this.toFontChar = newMapping.toFontChar;
  21907. var numGlyphs = font.numGlyphs;
  21908. function getCharCodes(charCodeToGlyphId, glyphId) {
  21909. var charCodes = null;
  21910. for (var charCode in charCodeToGlyphId) {
  21911. if (glyphId === charCodeToGlyphId[charCode]) {
  21912. if (!charCodes) {
  21913. charCodes = [];
  21914. }
  21915. charCodes.push(charCode | 0);
  21916. }
  21917. }
  21918. return charCodes;
  21919. }
  21920. function createCharCode(charCodeToGlyphId, glyphId) {
  21921. for (var charCode in charCodeToGlyphId) {
  21922. if (glyphId === charCodeToGlyphId[charCode]) {
  21923. return charCode | 0;
  21924. }
  21925. }
  21926. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  21927. return newMapping.nextAvailableFontCharCode++;
  21928. }
  21929. var seacs = font.seacs;
  21930. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  21931. var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  21932. var charset = font.getCharset();
  21933. var seacMap = Object.create(null);
  21934. for (var glyphId in seacs) {
  21935. glyphId |= 0;
  21936. var seac = seacs[glyphId];
  21937. var baseGlyphName = _encodings.StandardEncoding[seac[2]];
  21938. var accentGlyphName = _encodings.StandardEncoding[seac[3]];
  21939. var baseGlyphId = charset.indexOf(baseGlyphName);
  21940. var accentGlyphId = charset.indexOf(accentGlyphName);
  21941. if (baseGlyphId < 0 || accentGlyphId < 0) {
  21942. continue;
  21943. }
  21944. var accentOffset = {
  21945. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  21946. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  21947. };
  21948. var charCodes = getCharCodes(mapping, glyphId);
  21949. if (!charCodes) {
  21950. continue;
  21951. }
  21952. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  21953. var charCode = charCodes[i];
  21954. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  21955. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  21956. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  21957. seacMap[charCode] = {
  21958. baseFontCharCode,
  21959. accentFontCharCode,
  21960. accentOffset
  21961. };
  21962. }
  21963. }
  21964. properties.seacMap = seacMap;
  21965. }
  21966. var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  21967. var builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  21968. builder.addTable("CFF ", font.data);
  21969. builder.addTable("OS/2", createOS2Table(properties, newMapping.charCodeToGlyphId));
  21970. builder.addTable("cmap", createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  21971. builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00");
  21972. builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs));
  21973. builder.addTable("hmtx", function fontFieldsHmtx() {
  21974. var charstrings = font.charstrings;
  21975. var cffWidths = font.cff ? font.cff.widths : null;
  21976. var hmtx = "\x00\x00\x00\x00";
  21977. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  21978. var width = 0;
  21979. if (charstrings) {
  21980. var charstring = charstrings[i - 1];
  21981. width = "width" in charstring ? charstring.width : 0;
  21982. } else if (cffWidths) {
  21983. width = Math.ceil(cffWidths[i] || 0);
  21984. }
  21985. hmtx += string16(width) + string16(0);
  21986. }
  21987. return hmtx;
  21988. }());
  21989. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  21990. builder.addTable("name", createNameTable(fontName));
  21991. builder.addTable("post", createPostTable(properties));
  21992. return builder.toArray();
  21993. },
  21994. get spaceWidth() {
  21995. if ("_shadowWidth" in this) {
  21996. return this._shadowWidth;
  21997. }
  21998. var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  21999. var width;
  22000. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  22001. var glyphName = possibleSpaceReplacements[i];
  22002. if (glyphName in this.widths) {
  22003. width = this.widths[glyphName];
  22004. break;
  22005. }
  22006. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22007. var glyphUnicode = glyphsUnicodeMap[glyphName];
  22008. var charcode = 0;
  22009. if (this.composite) {
  22010. if (this.cMap.contains(glyphUnicode)) {
  22011. charcode = this.cMap.lookup(glyphUnicode);
  22012. }
  22013. }
  22014. if (!charcode && this.toUnicode) {
  22015. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22016. }
  22017. if (charcode <= 0) {
  22018. charcode = glyphUnicode;
  22019. }
  22020. width = this.widths[charcode];
  22021. if (width) {
  22022. break;
  22023. }
  22024. }
  22025. width = width || this.defaultWidth;
  22026. this._shadowWidth = width;
  22027. return width;
  22028. },
  22029. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  22030. var fontCharCode, width, operatorListId;
  22031. var widthCode = charcode;
  22032. if (this.cMap && this.cMap.contains(charcode)) {
  22033. widthCode = this.cMap.lookup(charcode);
  22034. }
  22035. width = this.widths[widthCode];
  22036. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  22037. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  22038. let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
  22039. if (typeof unicode === "number") {
  22040. unicode = String.fromCharCode(unicode);
  22041. }
  22042. var isInFont = charcode in this.toFontChar;
  22043. fontCharCode = this.toFontChar[charcode] || charcode;
  22044. if (this.missingFile) {
  22045. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22046. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22047. fontCharCode = 0x20;
  22048. }
  22049. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22050. }
  22051. if (this.isType3Font) {
  22052. operatorListId = fontCharCode;
  22053. }
  22054. var accent = null;
  22055. if (this.seacMap && this.seacMap[charcode]) {
  22056. isInFont = true;
  22057. var seac = this.seacMap[charcode];
  22058. fontCharCode = seac.baseFontCharCode;
  22059. accent = {
  22060. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22061. offset: seac.accentOffset
  22062. };
  22063. }
  22064. var fontChar = typeof fontCharCode === "number" ? String.fromCodePoint(fontCharCode) : "";
  22065. var glyph = this.glyphCache[charcode];
  22066. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  22067. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22068. this.glyphCache[charcode] = glyph;
  22069. }
  22070. return glyph;
  22071. },
  22072. charsToGlyphs: function Font_charsToGlyphs(chars) {
  22073. var charsCache = this.charsCache;
  22074. var glyphs, glyph, charcode;
  22075. if (charsCache) {
  22076. glyphs = charsCache[chars];
  22077. if (glyphs) {
  22078. return glyphs;
  22079. }
  22080. }
  22081. if (!charsCache) {
  22082. charsCache = this.charsCache = Object.create(null);
  22083. }
  22084. glyphs = [];
  22085. var charsCacheKey = chars;
  22086. var i = 0,
  22087. ii;
  22088. if (this.cMap) {
  22089. var c = Object.create(null);
  22090. while (i < chars.length) {
  22091. this.cMap.readCharCode(chars, i, c);
  22092. charcode = c.charcode;
  22093. var length = c.length;
  22094. i += length;
  22095. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  22096. glyph = this.charToGlyph(charcode, isSpace);
  22097. glyphs.push(glyph);
  22098. }
  22099. } else {
  22100. for (i = 0, ii = chars.length; i < ii; ++i) {
  22101. charcode = chars.charCodeAt(i);
  22102. glyph = this.charToGlyph(charcode, charcode === 0x20);
  22103. glyphs.push(glyph);
  22104. }
  22105. }
  22106. return charsCache[charsCacheKey] = glyphs;
  22107. },
  22108. get glyphCacheValues() {
  22109. return Object.values(this.glyphCache);
  22110. }
  22111. };
  22112. return Font;
  22113. }();
  22114. exports.Font = Font;
  22115. var ErrorFont = function ErrorFontClosure() {
  22116. function ErrorFont(error) {
  22117. this.error = error;
  22118. this.loadedName = "g_font_error";
  22119. this.missingFile = true;
  22120. }
  22121. ErrorFont.prototype = {
  22122. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  22123. return [];
  22124. },
  22125. exportData: function ErrorFont_exportData() {
  22126. return {
  22127. error: this.error
  22128. };
  22129. }
  22130. };
  22131. return ErrorFont;
  22132. }();
  22133. exports.ErrorFont = ErrorFont;
  22134. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  22135. var charCodeToGlyphId = Object.create(null);
  22136. var glyphId, charCode, baseEncoding;
  22137. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  22138. if (properties.baseEncodingName) {
  22139. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22140. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22141. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22142. if (glyphId >= 0) {
  22143. charCodeToGlyphId[charCode] = glyphId;
  22144. } else {
  22145. charCodeToGlyphId[charCode] = 0;
  22146. }
  22147. }
  22148. } else if (isSymbolicFont) {
  22149. for (charCode in builtInEncoding) {
  22150. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  22151. }
  22152. } else {
  22153. baseEncoding = _encodings.StandardEncoding;
  22154. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22155. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22156. if (glyphId >= 0) {
  22157. charCodeToGlyphId[charCode] = glyphId;
  22158. } else {
  22159. charCodeToGlyphId[charCode] = 0;
  22160. }
  22161. }
  22162. }
  22163. var differences = properties.differences,
  22164. glyphsUnicodeMap;
  22165. if (differences) {
  22166. for (charCode in differences) {
  22167. var glyphName = differences[charCode];
  22168. glyphId = glyphNames.indexOf(glyphName);
  22169. if (glyphId === -1) {
  22170. if (!glyphsUnicodeMap) {
  22171. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22172. }
  22173. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  22174. if (standardGlyphName !== glyphName) {
  22175. glyphId = glyphNames.indexOf(standardGlyphName);
  22176. }
  22177. }
  22178. if (glyphId >= 0) {
  22179. charCodeToGlyphId[charCode] = glyphId;
  22180. } else {
  22181. charCodeToGlyphId[charCode] = 0;
  22182. }
  22183. }
  22184. }
  22185. return charCodeToGlyphId;
  22186. }
  22187. var Type1Font = function Type1FontClosure() {
  22188. function findBlock(streamBytes, signature, startIndex) {
  22189. var streamBytesLength = streamBytes.length;
  22190. var signatureLength = signature.length;
  22191. var scanLength = streamBytesLength - signatureLength;
  22192. var i = startIndex,
  22193. j,
  22194. found = false;
  22195. while (i < scanLength) {
  22196. j = 0;
  22197. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  22198. j++;
  22199. }
  22200. if (j >= signatureLength) {
  22201. i += j;
  22202. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  22203. i++;
  22204. }
  22205. found = true;
  22206. break;
  22207. }
  22208. i++;
  22209. }
  22210. return {
  22211. found,
  22212. length: i
  22213. };
  22214. }
  22215. function getHeaderBlock(stream, suggestedLength) {
  22216. var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  22217. var streamStartPos = stream.pos;
  22218. var headerBytes, headerBytesLength, block;
  22219. try {
  22220. headerBytes = stream.getBytes(suggestedLength);
  22221. headerBytesLength = headerBytes.length;
  22222. } catch (ex) {
  22223. if (ex instanceof _core_utils.MissingDataException) {
  22224. throw ex;
  22225. }
  22226. }
  22227. if (headerBytesLength === suggestedLength) {
  22228. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  22229. if (block.found && block.length === suggestedLength) {
  22230. return {
  22231. stream: new _stream.Stream(headerBytes),
  22232. length: suggestedLength
  22233. };
  22234. }
  22235. }
  22236. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  22237. stream.pos = streamStartPos;
  22238. var SCAN_BLOCK_LENGTH = 2048;
  22239. var actualLength;
  22240. while (true) {
  22241. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  22242. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  22243. if (block.length === 0) {
  22244. break;
  22245. }
  22246. stream.pos += block.length;
  22247. if (block.found) {
  22248. actualLength = stream.pos - streamStartPos;
  22249. break;
  22250. }
  22251. }
  22252. stream.pos = streamStartPos;
  22253. if (actualLength) {
  22254. return {
  22255. stream: new _stream.Stream(stream.getBytes(actualLength)),
  22256. length: actualLength
  22257. };
  22258. }
  22259. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  22260. return {
  22261. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  22262. length: suggestedLength
  22263. };
  22264. }
  22265. function getEexecBlock(stream, suggestedLength) {
  22266. var eexecBytes = stream.getBytes();
  22267. return {
  22268. stream: new _stream.Stream(eexecBytes),
  22269. length: eexecBytes.length
  22270. };
  22271. }
  22272. function Type1Font(name, file, properties) {
  22273. var PFB_HEADER_SIZE = 6;
  22274. var headerBlockLength = properties.length1;
  22275. var eexecBlockLength = properties.length2;
  22276. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  22277. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  22278. if (pfbHeaderPresent) {
  22279. file.skip(PFB_HEADER_SIZE);
  22280. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22281. }
  22282. var headerBlock = getHeaderBlock(file, headerBlockLength);
  22283. var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  22284. headerBlockParser.extractFontHeader(properties);
  22285. if (pfbHeaderPresent) {
  22286. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  22287. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22288. }
  22289. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  22290. var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  22291. var data = eexecBlockParser.extractFontProgram(properties);
  22292. for (var info in data.properties) {
  22293. properties[info] = data.properties[info];
  22294. }
  22295. var charstrings = data.charstrings;
  22296. var type2Charstrings = this.getType2Charstrings(charstrings);
  22297. var subrs = this.getType2Subrs(data.subrs);
  22298. this.charstrings = charstrings;
  22299. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  22300. this.seacs = this.getSeacs(data.charstrings);
  22301. }
  22302. Type1Font.prototype = {
  22303. get numGlyphs() {
  22304. return this.charstrings.length + 1;
  22305. },
  22306. getCharset: function Type1Font_getCharset() {
  22307. var charset = [".notdef"];
  22308. var charstrings = this.charstrings;
  22309. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  22310. charset.push(charstrings[glyphId].glyphName);
  22311. }
  22312. return charset;
  22313. },
  22314. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  22315. var charstrings = this.charstrings;
  22316. var glyphNames = [".notdef"],
  22317. glyphId;
  22318. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  22319. glyphNames.push(charstrings[glyphId].glyphName);
  22320. }
  22321. var encoding = properties.builtInEncoding;
  22322. if (encoding) {
  22323. var builtInEncoding = Object.create(null);
  22324. for (var charCode in encoding) {
  22325. glyphId = glyphNames.indexOf(encoding[charCode]);
  22326. if (glyphId >= 0) {
  22327. builtInEncoding[charCode] = glyphId;
  22328. }
  22329. }
  22330. }
  22331. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  22332. },
  22333. hasGlyphId: function Type1Font_hasGlyphID(id) {
  22334. if (id < 0 || id >= this.numGlyphs) {
  22335. return false;
  22336. }
  22337. if (id === 0) {
  22338. return true;
  22339. }
  22340. var glyph = this.charstrings[id - 1];
  22341. return glyph.charstring.length > 0;
  22342. },
  22343. getSeacs: function Type1Font_getSeacs(charstrings) {
  22344. var i, ii;
  22345. var seacMap = [];
  22346. for (i = 0, ii = charstrings.length; i < ii; i++) {
  22347. var charstring = charstrings[i];
  22348. if (charstring.seac) {
  22349. seacMap[i + 1] = charstring.seac;
  22350. }
  22351. }
  22352. return seacMap;
  22353. },
  22354. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  22355. var type2Charstrings = [];
  22356. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  22357. type2Charstrings.push(type1Charstrings[i].charstring);
  22358. }
  22359. return type2Charstrings;
  22360. },
  22361. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  22362. var bias = 0;
  22363. var count = type1Subrs.length;
  22364. if (count < 1133) {
  22365. bias = 107;
  22366. } else if (count < 33769) {
  22367. bias = 1131;
  22368. } else {
  22369. bias = 32768;
  22370. }
  22371. var type2Subrs = [];
  22372. var i;
  22373. for (i = 0; i < bias; i++) {
  22374. type2Subrs.push([0x0b]);
  22375. }
  22376. for (i = 0; i < count; i++) {
  22377. type2Subrs.push(type1Subrs[i]);
  22378. }
  22379. return type2Subrs;
  22380. },
  22381. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  22382. var cff = new _cff_parser.CFF();
  22383. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  22384. cff.names = [name];
  22385. var topDict = new _cff_parser.CFFTopDict();
  22386. topDict.setByName("version", 391);
  22387. topDict.setByName("Notice", 392);
  22388. topDict.setByName("FullName", 393);
  22389. topDict.setByName("FamilyName", 394);
  22390. topDict.setByName("Weight", 395);
  22391. topDict.setByName("Encoding", null);
  22392. topDict.setByName("FontMatrix", properties.fontMatrix);
  22393. topDict.setByName("FontBBox", properties.bbox);
  22394. topDict.setByName("charset", null);
  22395. topDict.setByName("CharStrings", null);
  22396. topDict.setByName("Private", null);
  22397. cff.topDict = topDict;
  22398. var strings = new _cff_parser.CFFStrings();
  22399. strings.add("Version 0.11");
  22400. strings.add("See original notice");
  22401. strings.add(name);
  22402. strings.add(name);
  22403. strings.add("Medium");
  22404. cff.strings = strings;
  22405. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  22406. var count = glyphs.length;
  22407. var charsetArray = [".notdef"];
  22408. var i, ii;
  22409. for (i = 0; i < count; i++) {
  22410. const glyphName = charstrings[i].glyphName;
  22411. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  22412. if (index === -1) {
  22413. strings.add(glyphName);
  22414. }
  22415. charsetArray.push(glyphName);
  22416. }
  22417. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  22418. var charStringsIndex = new _cff_parser.CFFIndex();
  22419. charStringsIndex.add([0x8b, 0x0e]);
  22420. for (i = 0; i < count; i++) {
  22421. charStringsIndex.add(glyphs[i]);
  22422. }
  22423. cff.charStrings = charStringsIndex;
  22424. var privateDict = new _cff_parser.CFFPrivateDict();
  22425. privateDict.setByName("Subrs", null);
  22426. var fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  22427. for (i = 0, ii = fields.length; i < ii; i++) {
  22428. var field = fields[i];
  22429. if (!(field in properties.privateData)) {
  22430. continue;
  22431. }
  22432. var value = properties.privateData[field];
  22433. if (Array.isArray(value)) {
  22434. for (var j = value.length - 1; j > 0; j--) {
  22435. value[j] -= value[j - 1];
  22436. }
  22437. }
  22438. privateDict.setByName(field, value);
  22439. }
  22440. cff.topDict.privateDict = privateDict;
  22441. var subrIndex = new _cff_parser.CFFIndex();
  22442. for (i = 0, ii = subrs.length; i < ii; i++) {
  22443. subrIndex.add(subrs[i]);
  22444. }
  22445. privateDict.subrsIndex = subrIndex;
  22446. var compiler = new _cff_parser.CFFCompiler(cff);
  22447. return compiler.compile();
  22448. }
  22449. };
  22450. return Type1Font;
  22451. }();
  22452. var CFFFont = function CFFFontClosure() {
  22453. function CFFFont(file, properties) {
  22454. this.properties = properties;
  22455. var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  22456. this.cff = parser.parse();
  22457. this.cff.duplicateFirstGlyph();
  22458. var compiler = new _cff_parser.CFFCompiler(this.cff);
  22459. this.seacs = this.cff.seacs;
  22460. try {
  22461. this.data = compiler.compile();
  22462. } catch (e) {
  22463. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22464. this.data = file;
  22465. }
  22466. }
  22467. CFFFont.prototype = {
  22468. get numGlyphs() {
  22469. return this.cff.charStrings.count;
  22470. },
  22471. getCharset: function CFFFont_getCharset() {
  22472. return this.cff.charset.charset;
  22473. },
  22474. getGlyphMapping: function CFFFont_getGlyphMapping() {
  22475. var cff = this.cff;
  22476. var properties = this.properties;
  22477. var charsets = cff.charset.charset;
  22478. var charCodeToGlyphId;
  22479. var glyphId;
  22480. if (properties.composite) {
  22481. charCodeToGlyphId = Object.create(null);
  22482. let charCode;
  22483. if (cff.isCIDFont) {
  22484. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  22485. var cid = charsets[glyphId];
  22486. charCode = properties.cMap.charCodeOf(cid);
  22487. charCodeToGlyphId[charCode] = glyphId;
  22488. }
  22489. } else {
  22490. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  22491. charCode = properties.cMap.charCodeOf(glyphId);
  22492. charCodeToGlyphId[charCode] = glyphId;
  22493. }
  22494. }
  22495. return charCodeToGlyphId;
  22496. }
  22497. var encoding = cff.encoding ? cff.encoding.encoding : null;
  22498. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  22499. return charCodeToGlyphId;
  22500. },
  22501. hasGlyphId: function CFFFont_hasGlyphID(id) {
  22502. return this.cff.hasGlyphId(id);
  22503. }
  22504. };
  22505. return CFFFont;
  22506. }();
  22507. /***/ }),
  22508. /* 28 */
  22509. /***/ (function(module, exports, __w_pdfjs_require__) {
  22510. "use strict";
  22511. Object.defineProperty(exports, "__esModule", {
  22512. value: true
  22513. });
  22514. exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0;
  22515. var _util = __w_pdfjs_require__(2);
  22516. var _charsets = __w_pdfjs_require__(29);
  22517. var _encodings = __w_pdfjs_require__(30);
  22518. var MAX_SUBR_NESTING = 10;
  22519. var CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
  22520. exports.CFFStandardStrings = CFFStandardStrings;
  22521. const NUM_STANDARD_CFF_STRINGS = 391;
  22522. var CFFParser = function CFFParserClosure() {
  22523. var CharstringValidationData = [null, {
  22524. id: "hstem",
  22525. min: 2,
  22526. stackClearing: true,
  22527. stem: true
  22528. }, null, {
  22529. id: "vstem",
  22530. min: 2,
  22531. stackClearing: true,
  22532. stem: true
  22533. }, {
  22534. id: "vmoveto",
  22535. min: 1,
  22536. stackClearing: true
  22537. }, {
  22538. id: "rlineto",
  22539. min: 2,
  22540. resetStack: true
  22541. }, {
  22542. id: "hlineto",
  22543. min: 1,
  22544. resetStack: true
  22545. }, {
  22546. id: "vlineto",
  22547. min: 1,
  22548. resetStack: true
  22549. }, {
  22550. id: "rrcurveto",
  22551. min: 6,
  22552. resetStack: true
  22553. }, null, {
  22554. id: "callsubr",
  22555. min: 1,
  22556. undefStack: true
  22557. }, {
  22558. id: "return",
  22559. min: 0,
  22560. undefStack: true
  22561. }, null, null, {
  22562. id: "endchar",
  22563. min: 0,
  22564. stackClearing: true
  22565. }, null, null, null, {
  22566. id: "hstemhm",
  22567. min: 2,
  22568. stackClearing: true,
  22569. stem: true
  22570. }, {
  22571. id: "hintmask",
  22572. min: 0,
  22573. stackClearing: true
  22574. }, {
  22575. id: "cntrmask",
  22576. min: 0,
  22577. stackClearing: true
  22578. }, {
  22579. id: "rmoveto",
  22580. min: 2,
  22581. stackClearing: true
  22582. }, {
  22583. id: "hmoveto",
  22584. min: 1,
  22585. stackClearing: true
  22586. }, {
  22587. id: "vstemhm",
  22588. min: 2,
  22589. stackClearing: true,
  22590. stem: true
  22591. }, {
  22592. id: "rcurveline",
  22593. min: 8,
  22594. resetStack: true
  22595. }, {
  22596. id: "rlinecurve",
  22597. min: 8,
  22598. resetStack: true
  22599. }, {
  22600. id: "vvcurveto",
  22601. min: 4,
  22602. resetStack: true
  22603. }, {
  22604. id: "hhcurveto",
  22605. min: 4,
  22606. resetStack: true
  22607. }, null, {
  22608. id: "callgsubr",
  22609. min: 1,
  22610. undefStack: true
  22611. }, {
  22612. id: "vhcurveto",
  22613. min: 4,
  22614. resetStack: true
  22615. }, {
  22616. id: "hvcurveto",
  22617. min: 4,
  22618. resetStack: true
  22619. }];
  22620. var CharstringValidationData12 = [null, null, null, {
  22621. id: "and",
  22622. min: 2,
  22623. stackDelta: -1
  22624. }, {
  22625. id: "or",
  22626. min: 2,
  22627. stackDelta: -1
  22628. }, {
  22629. id: "not",
  22630. min: 1,
  22631. stackDelta: 0
  22632. }, null, null, null, {
  22633. id: "abs",
  22634. min: 1,
  22635. stackDelta: 0
  22636. }, {
  22637. id: "add",
  22638. min: 2,
  22639. stackDelta: -1,
  22640. stackFn: function stack_div(stack, index) {
  22641. stack[index - 2] = stack[index - 2] + stack[index - 1];
  22642. }
  22643. }, {
  22644. id: "sub",
  22645. min: 2,
  22646. stackDelta: -1,
  22647. stackFn: function stack_div(stack, index) {
  22648. stack[index - 2] = stack[index - 2] - stack[index - 1];
  22649. }
  22650. }, {
  22651. id: "div",
  22652. min: 2,
  22653. stackDelta: -1,
  22654. stackFn: function stack_div(stack, index) {
  22655. stack[index - 2] = stack[index - 2] / stack[index - 1];
  22656. }
  22657. }, null, {
  22658. id: "neg",
  22659. min: 1,
  22660. stackDelta: 0,
  22661. stackFn: function stack_div(stack, index) {
  22662. stack[index - 1] = -stack[index - 1];
  22663. }
  22664. }, {
  22665. id: "eq",
  22666. min: 2,
  22667. stackDelta: -1
  22668. }, null, null, {
  22669. id: "drop",
  22670. min: 1,
  22671. stackDelta: -1
  22672. }, null, {
  22673. id: "put",
  22674. min: 2,
  22675. stackDelta: -2
  22676. }, {
  22677. id: "get",
  22678. min: 1,
  22679. stackDelta: 0
  22680. }, {
  22681. id: "ifelse",
  22682. min: 4,
  22683. stackDelta: -3
  22684. }, {
  22685. id: "random",
  22686. min: 0,
  22687. stackDelta: 1
  22688. }, {
  22689. id: "mul",
  22690. min: 2,
  22691. stackDelta: -1,
  22692. stackFn: function stack_div(stack, index) {
  22693. stack[index - 2] = stack[index - 2] * stack[index - 1];
  22694. }
  22695. }, null, {
  22696. id: "sqrt",
  22697. min: 1,
  22698. stackDelta: 0
  22699. }, {
  22700. id: "dup",
  22701. min: 1,
  22702. stackDelta: 1
  22703. }, {
  22704. id: "exch",
  22705. min: 2,
  22706. stackDelta: 0
  22707. }, {
  22708. id: "index",
  22709. min: 2,
  22710. stackDelta: 0
  22711. }, {
  22712. id: "roll",
  22713. min: 3,
  22714. stackDelta: -2
  22715. }, null, null, null, {
  22716. id: "hflex",
  22717. min: 7,
  22718. resetStack: true
  22719. }, {
  22720. id: "flex",
  22721. min: 13,
  22722. resetStack: true
  22723. }, {
  22724. id: "hflex1",
  22725. min: 9,
  22726. resetStack: true
  22727. }, {
  22728. id: "flex1",
  22729. min: 11,
  22730. resetStack: true
  22731. }];
  22732. function CFFParser(file, properties, seacAnalysisEnabled) {
  22733. this.bytes = file.getBytes();
  22734. this.properties = properties;
  22735. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  22736. }
  22737. CFFParser.prototype = {
  22738. parse: function CFFParser_parse() {
  22739. var properties = this.properties;
  22740. var cff = new CFF();
  22741. this.cff = cff;
  22742. var header = this.parseHeader();
  22743. var nameIndex = this.parseIndex(header.endPos);
  22744. var topDictIndex = this.parseIndex(nameIndex.endPos);
  22745. var stringIndex = this.parseIndex(topDictIndex.endPos);
  22746. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  22747. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  22748. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  22749. cff.header = header.obj;
  22750. cff.names = this.parseNameIndex(nameIndex.obj);
  22751. cff.strings = this.parseStringIndex(stringIndex.obj);
  22752. cff.topDict = topDict;
  22753. cff.globalSubrIndex = globalSubrIndex.obj;
  22754. this.parsePrivateDict(cff.topDict);
  22755. cff.isCIDFont = topDict.hasName("ROS");
  22756. var charStringOffset = topDict.getByName("CharStrings");
  22757. var charStringIndex = this.parseIndex(charStringOffset).obj;
  22758. var fontMatrix = topDict.getByName("FontMatrix");
  22759. if (fontMatrix) {
  22760. properties.fontMatrix = fontMatrix;
  22761. }
  22762. var fontBBox = topDict.getByName("FontBBox");
  22763. if (fontBBox) {
  22764. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  22765. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  22766. properties.ascentScaled = true;
  22767. }
  22768. var charset, encoding;
  22769. if (cff.isCIDFont) {
  22770. var fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  22771. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  22772. var dictRaw = fdArrayIndex.get(i);
  22773. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  22774. this.parsePrivateDict(fontDict);
  22775. cff.fdArray.push(fontDict);
  22776. }
  22777. encoding = null;
  22778. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  22779. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  22780. } else {
  22781. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  22782. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  22783. }
  22784. cff.charset = charset;
  22785. cff.encoding = encoding;
  22786. var charStringsAndSeacs = this.parseCharStrings({
  22787. charStrings: charStringIndex,
  22788. localSubrIndex: topDict.privateDict.subrsIndex,
  22789. globalSubrIndex: globalSubrIndex.obj,
  22790. fdSelect: cff.fdSelect,
  22791. fdArray: cff.fdArray,
  22792. privateDict: topDict.privateDict
  22793. });
  22794. cff.charStrings = charStringsAndSeacs.charStrings;
  22795. cff.seacs = charStringsAndSeacs.seacs;
  22796. cff.widths = charStringsAndSeacs.widths;
  22797. return cff;
  22798. },
  22799. parseHeader: function CFFParser_parseHeader() {
  22800. var bytes = this.bytes;
  22801. var bytesLength = bytes.length;
  22802. var offset = 0;
  22803. while (offset < bytesLength && bytes[offset] !== 1) {
  22804. ++offset;
  22805. }
  22806. if (offset >= bytesLength) {
  22807. throw new _util.FormatError("Invalid CFF header");
  22808. }
  22809. if (offset !== 0) {
  22810. (0, _util.info)("cff data is shifted");
  22811. bytes = bytes.subarray(offset);
  22812. this.bytes = bytes;
  22813. }
  22814. var major = bytes[0];
  22815. var minor = bytes[1];
  22816. var hdrSize = bytes[2];
  22817. var offSize = bytes[3];
  22818. var header = new CFFHeader(major, minor, hdrSize, offSize);
  22819. return {
  22820. obj: header,
  22821. endPos: hdrSize
  22822. };
  22823. },
  22824. parseDict: function CFFParser_parseDict(dict) {
  22825. var pos = 0;
  22826. function parseOperand() {
  22827. var value = dict[pos++];
  22828. if (value === 30) {
  22829. return parseFloatOperand();
  22830. } else if (value === 28) {
  22831. value = dict[pos++];
  22832. value = (value << 24 | dict[pos++] << 16) >> 16;
  22833. return value;
  22834. } else if (value === 29) {
  22835. value = dict[pos++];
  22836. value = value << 8 | dict[pos++];
  22837. value = value << 8 | dict[pos++];
  22838. value = value << 8 | dict[pos++];
  22839. return value;
  22840. } else if (value >= 32 && value <= 246) {
  22841. return value - 139;
  22842. } else if (value >= 247 && value <= 250) {
  22843. return (value - 247) * 256 + dict[pos++] + 108;
  22844. } else if (value >= 251 && value <= 254) {
  22845. return -((value - 251) * 256) - dict[pos++] - 108;
  22846. }
  22847. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  22848. return NaN;
  22849. }
  22850. function parseFloatOperand() {
  22851. var str = "";
  22852. var eof = 15;
  22853. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  22854. var length = dict.length;
  22855. while (pos < length) {
  22856. var b = dict[pos++];
  22857. var b1 = b >> 4;
  22858. var b2 = b & 15;
  22859. if (b1 === eof) {
  22860. break;
  22861. }
  22862. str += lookup[b1];
  22863. if (b2 === eof) {
  22864. break;
  22865. }
  22866. str += lookup[b2];
  22867. }
  22868. return parseFloat(str);
  22869. }
  22870. var operands = [];
  22871. var entries = [];
  22872. pos = 0;
  22873. var end = dict.length;
  22874. while (pos < end) {
  22875. var b = dict[pos];
  22876. if (b <= 21) {
  22877. if (b === 12) {
  22878. b = b << 8 | dict[++pos];
  22879. }
  22880. entries.push([b, operands]);
  22881. operands = [];
  22882. ++pos;
  22883. } else {
  22884. operands.push(parseOperand());
  22885. }
  22886. }
  22887. return entries;
  22888. },
  22889. parseIndex: function CFFParser_parseIndex(pos) {
  22890. var cffIndex = new CFFIndex();
  22891. var bytes = this.bytes;
  22892. var count = bytes[pos++] << 8 | bytes[pos++];
  22893. var offsets = [];
  22894. var end = pos;
  22895. var i, ii;
  22896. if (count !== 0) {
  22897. var offsetSize = bytes[pos++];
  22898. var startPos = pos + (count + 1) * offsetSize - 1;
  22899. for (i = 0, ii = count + 1; i < ii; ++i) {
  22900. var offset = 0;
  22901. for (var j = 0; j < offsetSize; ++j) {
  22902. offset <<= 8;
  22903. offset += bytes[pos++];
  22904. }
  22905. offsets.push(startPos + offset);
  22906. }
  22907. end = offsets[count];
  22908. }
  22909. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  22910. var offsetStart = offsets[i];
  22911. var offsetEnd = offsets[i + 1];
  22912. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  22913. }
  22914. return {
  22915. obj: cffIndex,
  22916. endPos: end
  22917. };
  22918. },
  22919. parseNameIndex: function CFFParser_parseNameIndex(index) {
  22920. var names = [];
  22921. for (var i = 0, ii = index.count; i < ii; ++i) {
  22922. var name = index.get(i);
  22923. names.push((0, _util.bytesToString)(name));
  22924. }
  22925. return names;
  22926. },
  22927. parseStringIndex: function CFFParser_parseStringIndex(index) {
  22928. var strings = new CFFStrings();
  22929. for (var i = 0, ii = index.count; i < ii; ++i) {
  22930. var data = index.get(i);
  22931. strings.add((0, _util.bytesToString)(data));
  22932. }
  22933. return strings;
  22934. },
  22935. createDict: function CFFParser_createDict(Type, dict, strings) {
  22936. var cffDict = new Type(strings);
  22937. for (var i = 0, ii = dict.length; i < ii; ++i) {
  22938. var pair = dict[i];
  22939. var key = pair[0];
  22940. var value = pair[1];
  22941. cffDict.setByKey(key, value);
  22942. }
  22943. return cffDict;
  22944. },
  22945. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  22946. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  22947. return false;
  22948. }
  22949. var stackSize = state.stackSize;
  22950. var stack = state.stack;
  22951. var length = data.length;
  22952. for (var j = 0; j < length;) {
  22953. var value = data[j++];
  22954. var validationCommand = null;
  22955. if (value === 12) {
  22956. var q = data[j++];
  22957. if (q === 0) {
  22958. data[j - 2] = 139;
  22959. data[j - 1] = 22;
  22960. stackSize = 0;
  22961. } else {
  22962. validationCommand = CharstringValidationData12[q];
  22963. }
  22964. } else if (value === 28) {
  22965. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  22966. j += 2;
  22967. stackSize++;
  22968. } else if (value === 14) {
  22969. if (stackSize >= 4) {
  22970. stackSize -= 4;
  22971. if (this.seacAnalysisEnabled) {
  22972. state.seac = stack.slice(stackSize, stackSize + 4);
  22973. return false;
  22974. }
  22975. }
  22976. validationCommand = CharstringValidationData[value];
  22977. } else if (value >= 32 && value <= 246) {
  22978. stack[stackSize] = value - 139;
  22979. stackSize++;
  22980. } else if (value >= 247 && value <= 254) {
  22981. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  22982. j++;
  22983. stackSize++;
  22984. } else if (value === 255) {
  22985. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  22986. j += 4;
  22987. stackSize++;
  22988. } else if (value === 19 || value === 20) {
  22989. state.hints += stackSize >> 1;
  22990. j += state.hints + 7 >> 3;
  22991. stackSize %= 2;
  22992. validationCommand = CharstringValidationData[value];
  22993. } else if (value === 10 || value === 29) {
  22994. var subrsIndex;
  22995. if (value === 10) {
  22996. subrsIndex = localSubrIndex;
  22997. } else {
  22998. subrsIndex = globalSubrIndex;
  22999. }
  23000. if (!subrsIndex) {
  23001. validationCommand = CharstringValidationData[value];
  23002. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23003. return false;
  23004. }
  23005. var bias = 32768;
  23006. if (subrsIndex.count < 1240) {
  23007. bias = 107;
  23008. } else if (subrsIndex.count < 33900) {
  23009. bias = 1131;
  23010. }
  23011. var subrNumber = stack[--stackSize] + bias;
  23012. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23013. validationCommand = CharstringValidationData[value];
  23014. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23015. return false;
  23016. }
  23017. state.stackSize = stackSize;
  23018. state.callDepth++;
  23019. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23020. if (!valid) {
  23021. return false;
  23022. }
  23023. state.callDepth--;
  23024. stackSize = state.stackSize;
  23025. continue;
  23026. } else if (value === 11) {
  23027. state.stackSize = stackSize;
  23028. return true;
  23029. } else {
  23030. validationCommand = CharstringValidationData[value];
  23031. }
  23032. if (validationCommand) {
  23033. if (validationCommand.stem) {
  23034. state.hints += stackSize >> 1;
  23035. if (value === 3 || value === 23) {
  23036. state.hasVStems = true;
  23037. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23038. (0, _util.warn)("CFF stem hints are in wrong order");
  23039. data[j - 1] = value === 1 ? 3 : 23;
  23040. }
  23041. }
  23042. if ("min" in validationCommand) {
  23043. if (!state.undefStack && stackSize < validationCommand.min) {
  23044. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23045. return false;
  23046. }
  23047. }
  23048. if (state.firstStackClearing && validationCommand.stackClearing) {
  23049. state.firstStackClearing = false;
  23050. stackSize -= validationCommand.min;
  23051. if (stackSize >= 2 && validationCommand.stem) {
  23052. stackSize %= 2;
  23053. } else if (stackSize > 1) {
  23054. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23055. }
  23056. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  23057. state.width = stack[stackSize - 1];
  23058. }
  23059. }
  23060. if ("stackDelta" in validationCommand) {
  23061. if ("stackFn" in validationCommand) {
  23062. validationCommand.stackFn(stack, stackSize);
  23063. }
  23064. stackSize += validationCommand.stackDelta;
  23065. } else if (validationCommand.stackClearing) {
  23066. stackSize = 0;
  23067. } else if (validationCommand.resetStack) {
  23068. stackSize = 0;
  23069. state.undefStack = false;
  23070. } else if (validationCommand.undefStack) {
  23071. stackSize = 0;
  23072. state.undefStack = true;
  23073. state.firstStackClearing = false;
  23074. }
  23075. }
  23076. }
  23077. state.stackSize = stackSize;
  23078. return true;
  23079. },
  23080. parseCharStrings({
  23081. charStrings,
  23082. localSubrIndex,
  23083. globalSubrIndex,
  23084. fdSelect,
  23085. fdArray,
  23086. privateDict
  23087. }) {
  23088. var seacs = [];
  23089. var widths = [];
  23090. var count = charStrings.count;
  23091. for (var i = 0; i < count; i++) {
  23092. var charstring = charStrings.get(i);
  23093. var state = {
  23094. callDepth: 0,
  23095. stackSize: 0,
  23096. stack: [],
  23097. undefStack: true,
  23098. hints: 0,
  23099. firstStackClearing: true,
  23100. seac: null,
  23101. width: null,
  23102. hasVStems: false
  23103. };
  23104. var valid = true;
  23105. var localSubrToUse = null;
  23106. var privateDictToUse = privateDict;
  23107. if (fdSelect && fdArray.length) {
  23108. var fdIndex = fdSelect.getFDIndex(i);
  23109. if (fdIndex === -1) {
  23110. (0, _util.warn)("Glyph index is not in fd select.");
  23111. valid = false;
  23112. }
  23113. if (fdIndex >= fdArray.length) {
  23114. (0, _util.warn)("Invalid fd index for glyph index.");
  23115. valid = false;
  23116. }
  23117. if (valid) {
  23118. privateDictToUse = fdArray[fdIndex].privateDict;
  23119. localSubrToUse = privateDictToUse.subrsIndex;
  23120. }
  23121. } else if (localSubrIndex) {
  23122. localSubrToUse = localSubrIndex;
  23123. }
  23124. if (valid) {
  23125. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23126. }
  23127. if (state.width !== null) {
  23128. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23129. widths[i] = nominalWidth + state.width;
  23130. } else {
  23131. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23132. widths[i] = defaultWidth;
  23133. }
  23134. if (state.seac !== null) {
  23135. seacs[i] = state.seac;
  23136. }
  23137. if (!valid) {
  23138. charStrings.set(i, new Uint8Array([14]));
  23139. }
  23140. }
  23141. return {
  23142. charStrings,
  23143. seacs,
  23144. widths
  23145. };
  23146. },
  23147. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  23148. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23149. parentDict.setByKey(18, [0, 0]);
  23150. parentDict.privateDict = privateDict;
  23151. },
  23152. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  23153. if (!parentDict.hasName("Private")) {
  23154. this.emptyPrivateDictionary(parentDict);
  23155. return;
  23156. }
  23157. var privateOffset = parentDict.getByName("Private");
  23158. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23159. parentDict.removeByName("Private");
  23160. return;
  23161. }
  23162. var size = privateOffset[0];
  23163. var offset = privateOffset[1];
  23164. if (size === 0 || offset >= this.bytes.length) {
  23165. this.emptyPrivateDictionary(parentDict);
  23166. return;
  23167. }
  23168. var privateDictEnd = offset + size;
  23169. var dictData = this.bytes.subarray(offset, privateDictEnd);
  23170. var dict = this.parseDict(dictData);
  23171. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23172. parentDict.privateDict = privateDict;
  23173. if (!privateDict.getByName("Subrs")) {
  23174. return;
  23175. }
  23176. var subrsOffset = privateDict.getByName("Subrs");
  23177. var relativeOffset = offset + subrsOffset;
  23178. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23179. this.emptyPrivateDictionary(parentDict);
  23180. return;
  23181. }
  23182. var subrsIndex = this.parseIndex(relativeOffset);
  23183. privateDict.subrsIndex = subrsIndex.obj;
  23184. },
  23185. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  23186. if (pos === 0) {
  23187. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23188. } else if (pos === 1) {
  23189. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23190. } else if (pos === 2) {
  23191. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23192. }
  23193. var bytes = this.bytes;
  23194. var start = pos;
  23195. var format = bytes[pos++];
  23196. var charset = [".notdef"];
  23197. var id, count, i;
  23198. length -= 1;
  23199. switch (format) {
  23200. case 0:
  23201. for (i = 0; i < length; i++) {
  23202. id = bytes[pos++] << 8 | bytes[pos++];
  23203. charset.push(cid ? id : strings.get(id));
  23204. }
  23205. break;
  23206. case 1:
  23207. while (charset.length <= length) {
  23208. id = bytes[pos++] << 8 | bytes[pos++];
  23209. count = bytes[pos++];
  23210. for (i = 0; i <= count; i++) {
  23211. charset.push(cid ? id++ : strings.get(id++));
  23212. }
  23213. }
  23214. break;
  23215. case 2:
  23216. while (charset.length <= length) {
  23217. id = bytes[pos++] << 8 | bytes[pos++];
  23218. count = bytes[pos++] << 8 | bytes[pos++];
  23219. for (i = 0; i <= count; i++) {
  23220. charset.push(cid ? id++ : strings.get(id++));
  23221. }
  23222. }
  23223. break;
  23224. default:
  23225. throw new _util.FormatError("Unknown charset format");
  23226. }
  23227. var end = pos;
  23228. var raw = bytes.subarray(start, end);
  23229. return new CFFCharset(false, format, charset, raw);
  23230. },
  23231. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  23232. var encoding = Object.create(null);
  23233. var bytes = this.bytes;
  23234. var predefined = false;
  23235. var format, i, ii;
  23236. var raw = null;
  23237. function readSupplement() {
  23238. var supplementsCount = bytes[pos++];
  23239. for (i = 0; i < supplementsCount; i++) {
  23240. var code = bytes[pos++];
  23241. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23242. encoding[code] = charset.indexOf(strings.get(sid));
  23243. }
  23244. }
  23245. if (pos === 0 || pos === 1) {
  23246. predefined = true;
  23247. format = pos;
  23248. var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23249. for (i = 0, ii = charset.length; i < ii; i++) {
  23250. var index = baseEncoding.indexOf(charset[i]);
  23251. if (index !== -1) {
  23252. encoding[index] = i;
  23253. }
  23254. }
  23255. } else {
  23256. var dataStart = pos;
  23257. format = bytes[pos++];
  23258. switch (format & 0x7f) {
  23259. case 0:
  23260. var glyphsCount = bytes[pos++];
  23261. for (i = 1; i <= glyphsCount; i++) {
  23262. encoding[bytes[pos++]] = i;
  23263. }
  23264. break;
  23265. case 1:
  23266. var rangesCount = bytes[pos++];
  23267. var gid = 1;
  23268. for (i = 0; i < rangesCount; i++) {
  23269. var start = bytes[pos++];
  23270. var left = bytes[pos++];
  23271. for (var j = start; j <= start + left; j++) {
  23272. encoding[j] = gid++;
  23273. }
  23274. }
  23275. break;
  23276. default:
  23277. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23278. }
  23279. var dataEnd = pos;
  23280. if (format & 0x80) {
  23281. bytes[dataStart] &= 0x7f;
  23282. readSupplement();
  23283. }
  23284. raw = bytes.subarray(dataStart, dataEnd);
  23285. }
  23286. format = format & 0x7f;
  23287. return new CFFEncoding(predefined, format, encoding, raw);
  23288. },
  23289. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  23290. var bytes = this.bytes;
  23291. var format = bytes[pos++];
  23292. var fdSelect = [];
  23293. var i;
  23294. switch (format) {
  23295. case 0:
  23296. for (i = 0; i < length; ++i) {
  23297. var id = bytes[pos++];
  23298. fdSelect.push(id);
  23299. }
  23300. break;
  23301. case 3:
  23302. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23303. for (i = 0; i < rangesCount; ++i) {
  23304. var first = bytes[pos++] << 8 | bytes[pos++];
  23305. if (i === 0 && first !== 0) {
  23306. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23307. first = 0;
  23308. }
  23309. var fdIndex = bytes[pos++];
  23310. var next = bytes[pos] << 8 | bytes[pos + 1];
  23311. for (var j = first; j < next; ++j) {
  23312. fdSelect.push(fdIndex);
  23313. }
  23314. }
  23315. pos += 2;
  23316. break;
  23317. default:
  23318. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23319. }
  23320. if (fdSelect.length !== length) {
  23321. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23322. }
  23323. return new CFFFDSelect(format, fdSelect);
  23324. }
  23325. };
  23326. return CFFParser;
  23327. }();
  23328. exports.CFFParser = CFFParser;
  23329. var CFF = function CFFClosure() {
  23330. function CFF() {
  23331. this.header = null;
  23332. this.names = [];
  23333. this.topDict = null;
  23334. this.strings = new CFFStrings();
  23335. this.globalSubrIndex = null;
  23336. this.encoding = null;
  23337. this.charset = null;
  23338. this.charStrings = null;
  23339. this.fdArray = [];
  23340. this.fdSelect = null;
  23341. this.isCIDFont = false;
  23342. }
  23343. CFF.prototype = {
  23344. duplicateFirstGlyph: function CFF_duplicateFirstGlyph() {
  23345. if (this.charStrings.count >= 65535) {
  23346. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23347. return;
  23348. }
  23349. var glyphZero = this.charStrings.get(0);
  23350. this.charStrings.add(glyphZero);
  23351. if (this.isCIDFont) {
  23352. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23353. }
  23354. },
  23355. hasGlyphId: function CFF_hasGlyphID(id) {
  23356. if (id < 0 || id >= this.charStrings.count) {
  23357. return false;
  23358. }
  23359. var glyph = this.charStrings.get(id);
  23360. return glyph.length > 0;
  23361. }
  23362. };
  23363. return CFF;
  23364. }();
  23365. exports.CFF = CFF;
  23366. var CFFHeader = function CFFHeaderClosure() {
  23367. function CFFHeader(major, minor, hdrSize, offSize) {
  23368. this.major = major;
  23369. this.minor = minor;
  23370. this.hdrSize = hdrSize;
  23371. this.offSize = offSize;
  23372. }
  23373. return CFFHeader;
  23374. }();
  23375. exports.CFFHeader = CFFHeader;
  23376. var CFFStrings = function CFFStringsClosure() {
  23377. function CFFStrings() {
  23378. this.strings = [];
  23379. }
  23380. CFFStrings.prototype = {
  23381. get: function CFFStrings_get(index) {
  23382. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23383. return CFFStandardStrings[index];
  23384. }
  23385. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23386. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23387. }
  23388. return CFFStandardStrings[0];
  23389. },
  23390. getSID: function CFFStrings_getSID(str) {
  23391. let index = CFFStandardStrings.indexOf(str);
  23392. if (index !== -1) {
  23393. return index;
  23394. }
  23395. index = this.strings.indexOf(str);
  23396. if (index !== -1) {
  23397. return index + NUM_STANDARD_CFF_STRINGS;
  23398. }
  23399. return -1;
  23400. },
  23401. add: function CFFStrings_add(value) {
  23402. this.strings.push(value);
  23403. },
  23404. get count() {
  23405. return this.strings.length;
  23406. }
  23407. };
  23408. return CFFStrings;
  23409. }();
  23410. exports.CFFStrings = CFFStrings;
  23411. var CFFIndex = function CFFIndexClosure() {
  23412. function CFFIndex() {
  23413. this.objects = [];
  23414. this.length = 0;
  23415. }
  23416. CFFIndex.prototype = {
  23417. add: function CFFIndex_add(data) {
  23418. this.length += data.length;
  23419. this.objects.push(data);
  23420. },
  23421. set: function CFFIndex_set(index, data) {
  23422. this.length += data.length - this.objects[index].length;
  23423. this.objects[index] = data;
  23424. },
  23425. get: function CFFIndex_get(index) {
  23426. return this.objects[index];
  23427. },
  23428. get count() {
  23429. return this.objects.length;
  23430. }
  23431. };
  23432. return CFFIndex;
  23433. }();
  23434. exports.CFFIndex = CFFIndex;
  23435. var CFFDict = function CFFDictClosure() {
  23436. function CFFDict(tables, strings) {
  23437. this.keyToNameMap = tables.keyToNameMap;
  23438. this.nameToKeyMap = tables.nameToKeyMap;
  23439. this.defaults = tables.defaults;
  23440. this.types = tables.types;
  23441. this.opcodes = tables.opcodes;
  23442. this.order = tables.order;
  23443. this.strings = strings;
  23444. this.values = Object.create(null);
  23445. }
  23446. CFFDict.prototype = {
  23447. setByKey: function CFFDict_setByKey(key, value) {
  23448. if (!(key in this.keyToNameMap)) {
  23449. return false;
  23450. }
  23451. var valueLength = value.length;
  23452. if (valueLength === 0) {
  23453. return true;
  23454. }
  23455. for (var i = 0; i < valueLength; i++) {
  23456. if (isNaN(value[i])) {
  23457. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  23458. return true;
  23459. }
  23460. }
  23461. var type = this.types[key];
  23462. if (type === "num" || type === "sid" || type === "offset") {
  23463. value = value[0];
  23464. }
  23465. this.values[key] = value;
  23466. return true;
  23467. },
  23468. setByName: function CFFDict_setByName(name, value) {
  23469. if (!(name in this.nameToKeyMap)) {
  23470. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23471. }
  23472. this.values[this.nameToKeyMap[name]] = value;
  23473. },
  23474. hasName: function CFFDict_hasName(name) {
  23475. return this.nameToKeyMap[name] in this.values;
  23476. },
  23477. getByName: function CFFDict_getByName(name) {
  23478. if (!(name in this.nameToKeyMap)) {
  23479. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23480. }
  23481. var key = this.nameToKeyMap[name];
  23482. if (!(key in this.values)) {
  23483. return this.defaults[key];
  23484. }
  23485. return this.values[key];
  23486. },
  23487. removeByName: function CFFDict_removeByName(name) {
  23488. delete this.values[this.nameToKeyMap[name]];
  23489. }
  23490. };
  23491. CFFDict.createTables = function CFFDict_createTables(layout) {
  23492. var tables = {
  23493. keyToNameMap: {},
  23494. nameToKeyMap: {},
  23495. defaults: {},
  23496. types: {},
  23497. opcodes: {},
  23498. order: []
  23499. };
  23500. for (var i = 0, ii = layout.length; i < ii; ++i) {
  23501. var entry = layout[i];
  23502. var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23503. tables.keyToNameMap[key] = entry[1];
  23504. tables.nameToKeyMap[entry[1]] = key;
  23505. tables.types[key] = entry[2];
  23506. tables.defaults[key] = entry[3];
  23507. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23508. tables.order.push(key);
  23509. }
  23510. return tables;
  23511. };
  23512. return CFFDict;
  23513. }();
  23514. var CFFTopDict = function CFFTopDictClosure() {
  23515. var layout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  23516. var tables = null;
  23517. function CFFTopDict(strings) {
  23518. if (tables === null) {
  23519. tables = CFFDict.createTables(layout);
  23520. }
  23521. CFFDict.call(this, tables, strings);
  23522. this.privateDict = null;
  23523. }
  23524. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  23525. return CFFTopDict;
  23526. }();
  23527. exports.CFFTopDict = CFFTopDict;
  23528. var CFFPrivateDict = function CFFPrivateDictClosure() {
  23529. var layout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  23530. var tables = null;
  23531. function CFFPrivateDict(strings) {
  23532. if (tables === null) {
  23533. tables = CFFDict.createTables(layout);
  23534. }
  23535. CFFDict.call(this, tables, strings);
  23536. this.subrsIndex = null;
  23537. }
  23538. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  23539. return CFFPrivateDict;
  23540. }();
  23541. exports.CFFPrivateDict = CFFPrivateDict;
  23542. var CFFCharsetPredefinedTypes = {
  23543. ISO_ADOBE: 0,
  23544. EXPERT: 1,
  23545. EXPERT_SUBSET: 2
  23546. };
  23547. var CFFCharset = function CFFCharsetClosure() {
  23548. function CFFCharset(predefined, format, charset, raw) {
  23549. this.predefined = predefined;
  23550. this.format = format;
  23551. this.charset = charset;
  23552. this.raw = raw;
  23553. }
  23554. return CFFCharset;
  23555. }();
  23556. exports.CFFCharset = CFFCharset;
  23557. var CFFEncoding = function CFFEncodingClosure() {
  23558. function CFFEncoding(predefined, format, encoding, raw) {
  23559. this.predefined = predefined;
  23560. this.format = format;
  23561. this.encoding = encoding;
  23562. this.raw = raw;
  23563. }
  23564. return CFFEncoding;
  23565. }();
  23566. var CFFFDSelect = function CFFFDSelectClosure() {
  23567. function CFFFDSelect(format, fdSelect) {
  23568. this.format = format;
  23569. this.fdSelect = fdSelect;
  23570. }
  23571. CFFFDSelect.prototype = {
  23572. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  23573. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23574. return -1;
  23575. }
  23576. return this.fdSelect[glyphIndex];
  23577. }
  23578. };
  23579. return CFFFDSelect;
  23580. }();
  23581. exports.CFFFDSelect = CFFFDSelect;
  23582. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  23583. function CFFOffsetTracker() {
  23584. this.offsets = Object.create(null);
  23585. }
  23586. CFFOffsetTracker.prototype = {
  23587. isTracking: function CFFOffsetTracker_isTracking(key) {
  23588. return key in this.offsets;
  23589. },
  23590. track: function CFFOffsetTracker_track(key, location) {
  23591. if (key in this.offsets) {
  23592. throw new _util.FormatError(`Already tracking location of ${key}`);
  23593. }
  23594. this.offsets[key] = location;
  23595. },
  23596. offset: function CFFOffsetTracker_offset(value) {
  23597. for (var key in this.offsets) {
  23598. this.offsets[key] += value;
  23599. }
  23600. },
  23601. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  23602. if (!(key in this.offsets)) {
  23603. throw new _util.FormatError(`Not tracking location of ${key}`);
  23604. }
  23605. var data = output.data;
  23606. var dataOffset = this.offsets[key];
  23607. var size = 5;
  23608. for (var i = 0, ii = values.length; i < ii; ++i) {
  23609. var offset0 = i * size + dataOffset;
  23610. var offset1 = offset0 + 1;
  23611. var offset2 = offset0 + 2;
  23612. var offset3 = offset0 + 3;
  23613. var offset4 = offset0 + 4;
  23614. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23615. throw new _util.FormatError("writing to an offset that is not empty");
  23616. }
  23617. var value = values[i];
  23618. data[offset0] = 0x1d;
  23619. data[offset1] = value >> 24 & 0xff;
  23620. data[offset2] = value >> 16 & 0xff;
  23621. data[offset3] = value >> 8 & 0xff;
  23622. data[offset4] = value & 0xff;
  23623. }
  23624. }
  23625. };
  23626. return CFFOffsetTracker;
  23627. }();
  23628. var CFFCompiler = function CFFCompilerClosure() {
  23629. function CFFCompiler(cff) {
  23630. this.cff = cff;
  23631. }
  23632. CFFCompiler.prototype = {
  23633. compile: function CFFCompiler_compile() {
  23634. var cff = this.cff;
  23635. var output = {
  23636. data: [],
  23637. length: 0,
  23638. add: function CFFCompiler_add(data) {
  23639. this.data = this.data.concat(data);
  23640. this.length = this.data.length;
  23641. }
  23642. };
  23643. var header = this.compileHeader(cff.header);
  23644. output.add(header);
  23645. var nameIndex = this.compileNameIndex(cff.names);
  23646. output.add(nameIndex);
  23647. if (cff.isCIDFont) {
  23648. if (cff.topDict.hasName("FontMatrix")) {
  23649. var base = cff.topDict.getByName("FontMatrix");
  23650. cff.topDict.removeByName("FontMatrix");
  23651. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  23652. var subDict = cff.fdArray[i];
  23653. var matrix = base.slice(0);
  23654. if (subDict.hasName("FontMatrix")) {
  23655. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  23656. }
  23657. subDict.setByName("FontMatrix", matrix);
  23658. }
  23659. }
  23660. }
  23661. cff.topDict.setByName("charset", 0);
  23662. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  23663. output.add(compiled.output);
  23664. var topDictTracker = compiled.trackers[0];
  23665. var stringIndex = this.compileStringIndex(cff.strings.strings);
  23666. output.add(stringIndex);
  23667. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  23668. output.add(globalSubrIndex);
  23669. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  23670. if (cff.encoding.predefined) {
  23671. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  23672. } else {
  23673. var encoding = this.compileEncoding(cff.encoding);
  23674. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  23675. output.add(encoding);
  23676. }
  23677. }
  23678. var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  23679. topDictTracker.setEntryLocation("charset", [output.length], output);
  23680. output.add(charset);
  23681. var charStrings = this.compileCharStrings(cff.charStrings);
  23682. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  23683. output.add(charStrings);
  23684. if (cff.isCIDFont) {
  23685. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  23686. var fdSelect = this.compileFDSelect(cff.fdSelect);
  23687. output.add(fdSelect);
  23688. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  23689. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  23690. output.add(compiled.output);
  23691. var fontDictTrackers = compiled.trackers;
  23692. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  23693. }
  23694. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  23695. output.add([0]);
  23696. return output.data;
  23697. },
  23698. encodeNumber: function CFFCompiler_encodeNumber(value) {
  23699. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  23700. return this.encodeInteger(value);
  23701. }
  23702. return this.encodeFloat(value);
  23703. },
  23704. encodeFloat: function CFFCompiler_encodeFloat(num) {
  23705. var value = num.toString();
  23706. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  23707. if (m) {
  23708. var epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  23709. value = (Math.round(num * epsilon) / epsilon).toString();
  23710. }
  23711. var nibbles = "";
  23712. var i, ii;
  23713. for (i = 0, ii = value.length; i < ii; ++i) {
  23714. var a = value[i];
  23715. if (a === "e") {
  23716. nibbles += value[++i] === "-" ? "c" : "b";
  23717. } else if (a === ".") {
  23718. nibbles += "a";
  23719. } else if (a === "-") {
  23720. nibbles += "e";
  23721. } else {
  23722. nibbles += a;
  23723. }
  23724. }
  23725. nibbles += nibbles.length & 1 ? "f" : "ff";
  23726. var out = [30];
  23727. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  23728. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  23729. }
  23730. return out;
  23731. },
  23732. encodeInteger: function CFFCompiler_encodeInteger(value) {
  23733. var code;
  23734. if (value >= -107 && value <= 107) {
  23735. code = [value + 139];
  23736. } else if (value >= 108 && value <= 1131) {
  23737. value = value - 108;
  23738. code = [(value >> 8) + 247, value & 0xff];
  23739. } else if (value >= -1131 && value <= -108) {
  23740. value = -value - 108;
  23741. code = [(value >> 8) + 251, value & 0xff];
  23742. } else if (value >= -32768 && value <= 32767) {
  23743. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  23744. } else {
  23745. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  23746. }
  23747. return code;
  23748. },
  23749. compileHeader: function CFFCompiler_compileHeader(header) {
  23750. return [header.major, header.minor, header.hdrSize, header.offSize];
  23751. },
  23752. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  23753. var nameIndex = new CFFIndex();
  23754. for (var i = 0, ii = names.length; i < ii; ++i) {
  23755. var name = names[i];
  23756. var length = Math.min(name.length, 127);
  23757. var sanitizedName = new Array(length);
  23758. for (var j = 0; j < length; j++) {
  23759. var char = name[j];
  23760. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  23761. char = "_";
  23762. }
  23763. sanitizedName[j] = char;
  23764. }
  23765. sanitizedName = sanitizedName.join("");
  23766. if (sanitizedName === "") {
  23767. sanitizedName = "Bad_Font_Name";
  23768. }
  23769. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  23770. }
  23771. return this.compileIndex(nameIndex);
  23772. },
  23773. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  23774. var fontDictTrackers = [];
  23775. var fdArrayIndex = new CFFIndex();
  23776. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  23777. var fontDict = dicts[i];
  23778. if (removeCidKeys) {
  23779. fontDict.removeByName("CIDFontVersion");
  23780. fontDict.removeByName("CIDFontRevision");
  23781. fontDict.removeByName("CIDFontType");
  23782. fontDict.removeByName("CIDCount");
  23783. fontDict.removeByName("UIDBase");
  23784. }
  23785. var fontDictTracker = new CFFOffsetTracker();
  23786. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  23787. fontDictTrackers.push(fontDictTracker);
  23788. fdArrayIndex.add(fontDictData);
  23789. fontDictTracker.offset(length);
  23790. }
  23791. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  23792. return {
  23793. trackers: fontDictTrackers,
  23794. output: fdArrayIndex
  23795. };
  23796. },
  23797. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  23798. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  23799. var fontDict = dicts[i];
  23800. var privateDict = fontDict.privateDict;
  23801. if (!privateDict || !fontDict.hasName("Private")) {
  23802. throw new _util.FormatError("There must be a private dictionary.");
  23803. }
  23804. var privateDictTracker = new CFFOffsetTracker();
  23805. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  23806. var outputLength = output.length;
  23807. privateDictTracker.offset(outputLength);
  23808. if (!privateDictData.length) {
  23809. outputLength = 0;
  23810. }
  23811. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  23812. output.add(privateDictData);
  23813. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  23814. var subrs = this.compileIndex(privateDict.subrsIndex);
  23815. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  23816. output.add(subrs);
  23817. }
  23818. }
  23819. },
  23820. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  23821. var out = [];
  23822. var order = dict.order;
  23823. for (var i = 0; i < order.length; ++i) {
  23824. var key = order[i];
  23825. if (!(key in dict.values)) {
  23826. continue;
  23827. }
  23828. var values = dict.values[key];
  23829. var types = dict.types[key];
  23830. if (!Array.isArray(types)) {
  23831. types = [types];
  23832. }
  23833. if (!Array.isArray(values)) {
  23834. values = [values];
  23835. }
  23836. if (values.length === 0) {
  23837. continue;
  23838. }
  23839. for (var j = 0, jj = types.length; j < jj; ++j) {
  23840. var type = types[j];
  23841. var value = values[j];
  23842. switch (type) {
  23843. case "num":
  23844. case "sid":
  23845. out = out.concat(this.encodeNumber(value));
  23846. break;
  23847. case "offset":
  23848. var name = dict.keyToNameMap[key];
  23849. if (!offsetTracker.isTracking(name)) {
  23850. offsetTracker.track(name, out.length);
  23851. }
  23852. out = out.concat([0x1d, 0, 0, 0, 0]);
  23853. break;
  23854. case "array":
  23855. case "delta":
  23856. out = out.concat(this.encodeNumber(value));
  23857. for (var k = 1, kk = values.length; k < kk; ++k) {
  23858. out = out.concat(this.encodeNumber(values[k]));
  23859. }
  23860. break;
  23861. default:
  23862. throw new _util.FormatError(`Unknown data type of ${type}`);
  23863. }
  23864. }
  23865. out = out.concat(dict.opcodes[key]);
  23866. }
  23867. return out;
  23868. },
  23869. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  23870. var stringIndex = new CFFIndex();
  23871. for (var i = 0, ii = strings.length; i < ii; ++i) {
  23872. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  23873. }
  23874. return this.compileIndex(stringIndex);
  23875. },
  23876. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  23877. var globalSubrIndex = this.cff.globalSubrIndex;
  23878. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  23879. },
  23880. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  23881. var charStringsIndex = new CFFIndex();
  23882. for (var i = 0; i < charStrings.count; i++) {
  23883. var glyph = charStrings.get(i);
  23884. if (glyph.length === 0) {
  23885. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  23886. continue;
  23887. }
  23888. charStringsIndex.add(glyph);
  23889. }
  23890. return this.compileIndex(charStringsIndex);
  23891. },
  23892. compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) {
  23893. let out;
  23894. const numGlyphsLessNotDef = numGlyphs - 1;
  23895. if (isCIDFont) {
  23896. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  23897. } else {
  23898. const length = 1 + numGlyphsLessNotDef * 2;
  23899. out = new Uint8Array(length);
  23900. out[0] = 0;
  23901. let charsetIndex = 0;
  23902. const numCharsets = charset.charset.length;
  23903. let warned = false;
  23904. for (let i = 1; i < out.length; i += 2) {
  23905. let sid = 0;
  23906. if (charsetIndex < numCharsets) {
  23907. const name = charset.charset[charsetIndex++];
  23908. sid = strings.getSID(name);
  23909. if (sid === -1) {
  23910. sid = 0;
  23911. if (!warned) {
  23912. warned = true;
  23913. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  23914. }
  23915. }
  23916. }
  23917. out[i] = sid >> 8 & 0xff;
  23918. out[i + 1] = sid & 0xff;
  23919. }
  23920. }
  23921. return this.compileTypedArray(out);
  23922. },
  23923. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  23924. return this.compileTypedArray(encoding.raw);
  23925. },
  23926. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  23927. const format = fdSelect.format;
  23928. let out, i;
  23929. switch (format) {
  23930. case 0:
  23931. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  23932. out[0] = format;
  23933. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  23934. out[i + 1] = fdSelect.fdSelect[i];
  23935. }
  23936. break;
  23937. case 3:
  23938. const start = 0;
  23939. let lastFD = fdSelect.fdSelect[0];
  23940. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  23941. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  23942. const currentFD = fdSelect.fdSelect[i];
  23943. if (currentFD !== lastFD) {
  23944. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  23945. lastFD = currentFD;
  23946. }
  23947. }
  23948. const numRanges = (ranges.length - 3) / 3;
  23949. ranges[1] = numRanges >> 8 & 0xff;
  23950. ranges[2] = numRanges & 0xff;
  23951. ranges.push(i >> 8 & 0xff, i & 0xff);
  23952. out = new Uint8Array(ranges);
  23953. break;
  23954. }
  23955. return this.compileTypedArray(out);
  23956. },
  23957. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  23958. var out = [];
  23959. for (var i = 0, ii = data.length; i < ii; ++i) {
  23960. out[i] = data[i];
  23961. }
  23962. return out;
  23963. },
  23964. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  23965. trackers = trackers || [];
  23966. var objects = index.objects;
  23967. var count = objects.length;
  23968. if (count === 0) {
  23969. return [0, 0, 0];
  23970. }
  23971. var data = [count >> 8 & 0xff, count & 0xff];
  23972. var lastOffset = 1,
  23973. i;
  23974. for (i = 0; i < count; ++i) {
  23975. lastOffset += objects[i].length;
  23976. }
  23977. var offsetSize;
  23978. if (lastOffset < 0x100) {
  23979. offsetSize = 1;
  23980. } else if (lastOffset < 0x10000) {
  23981. offsetSize = 2;
  23982. } else if (lastOffset < 0x1000000) {
  23983. offsetSize = 3;
  23984. } else {
  23985. offsetSize = 4;
  23986. }
  23987. data.push(offsetSize);
  23988. var relativeOffset = 1;
  23989. for (i = 0; i < count + 1; i++) {
  23990. if (offsetSize === 1) {
  23991. data.push(relativeOffset & 0xff);
  23992. } else if (offsetSize === 2) {
  23993. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23994. } else if (offsetSize === 3) {
  23995. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23996. } else {
  23997. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23998. }
  23999. if (objects[i]) {
  24000. relativeOffset += objects[i].length;
  24001. }
  24002. }
  24003. for (i = 0; i < count; i++) {
  24004. if (trackers[i]) {
  24005. trackers[i].offset(data.length);
  24006. }
  24007. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  24008. data.push(objects[i][j]);
  24009. }
  24010. }
  24011. return data;
  24012. }
  24013. };
  24014. return CFFCompiler;
  24015. }();
  24016. exports.CFFCompiler = CFFCompiler;
  24017. /***/ }),
  24018. /* 29 */
  24019. /***/ (function(module, exports, __w_pdfjs_require__) {
  24020. "use strict";
  24021. Object.defineProperty(exports, "__esModule", {
  24022. value: true
  24023. });
  24024. exports.ExpertSubsetCharset = exports.ExpertCharset = exports.ISOAdobeCharset = void 0;
  24025. const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
  24026. exports.ISOAdobeCharset = ISOAdobeCharset;
  24027. const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  24028. exports.ExpertCharset = ExpertCharset;
  24029. const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
  24030. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  24031. /***/ }),
  24032. /* 30 */
  24033. /***/ (function(module, exports, __w_pdfjs_require__) {
  24034. "use strict";
  24035. Object.defineProperty(exports, "__esModule", {
  24036. value: true
  24037. });
  24038. exports.getEncoding = getEncoding;
  24039. exports.ExpertEncoding = exports.ZapfDingbatsEncoding = exports.SymbolSetEncoding = exports.MacRomanEncoding = exports.StandardEncoding = exports.WinAnsiEncoding = void 0;
  24040. const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  24041. exports.ExpertEncoding = ExpertEncoding;
  24042. const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
  24043. const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
  24044. exports.MacRomanEncoding = MacRomanEncoding;
  24045. const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
  24046. exports.StandardEncoding = StandardEncoding;
  24047. const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
  24048. exports.WinAnsiEncoding = WinAnsiEncoding;
  24049. const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
  24050. exports.SymbolSetEncoding = SymbolSetEncoding;
  24051. const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
  24052. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24053. function getEncoding(encodingName) {
  24054. switch (encodingName) {
  24055. case "WinAnsiEncoding":
  24056. return WinAnsiEncoding;
  24057. case "StandardEncoding":
  24058. return StandardEncoding;
  24059. case "MacRomanEncoding":
  24060. return MacRomanEncoding;
  24061. case "SymbolSetEncoding":
  24062. return SymbolSetEncoding;
  24063. case "ZapfDingbatsEncoding":
  24064. return ZapfDingbatsEncoding;
  24065. case "ExpertEncoding":
  24066. return ExpertEncoding;
  24067. case "MacExpertEncoding":
  24068. return MacExpertEncoding;
  24069. default:
  24070. return null;
  24071. }
  24072. }
  24073. /***/ }),
  24074. /* 31 */
  24075. /***/ (function(module, exports, __w_pdfjs_require__) {
  24076. var getLookupTableFactory = __w_pdfjs_require__(7).getLookupTableFactory;
  24077. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  24078. t["A"] = 0x0041;
  24079. t["AE"] = 0x00c6;
  24080. t["AEacute"] = 0x01fc;
  24081. t["AEmacron"] = 0x01e2;
  24082. t["AEsmall"] = 0xf7e6;
  24083. t["Aacute"] = 0x00c1;
  24084. t["Aacutesmall"] = 0xf7e1;
  24085. t["Abreve"] = 0x0102;
  24086. t["Abreveacute"] = 0x1eae;
  24087. t["Abrevecyrillic"] = 0x04d0;
  24088. t["Abrevedotbelow"] = 0x1eb6;
  24089. t["Abrevegrave"] = 0x1eb0;
  24090. t["Abrevehookabove"] = 0x1eb2;
  24091. t["Abrevetilde"] = 0x1eb4;
  24092. t["Acaron"] = 0x01cd;
  24093. t["Acircle"] = 0x24b6;
  24094. t["Acircumflex"] = 0x00c2;
  24095. t["Acircumflexacute"] = 0x1ea4;
  24096. t["Acircumflexdotbelow"] = 0x1eac;
  24097. t["Acircumflexgrave"] = 0x1ea6;
  24098. t["Acircumflexhookabove"] = 0x1ea8;
  24099. t["Acircumflexsmall"] = 0xf7e2;
  24100. t["Acircumflextilde"] = 0x1eaa;
  24101. t["Acute"] = 0xf6c9;
  24102. t["Acutesmall"] = 0xf7b4;
  24103. t["Acyrillic"] = 0x0410;
  24104. t["Adblgrave"] = 0x0200;
  24105. t["Adieresis"] = 0x00c4;
  24106. t["Adieresiscyrillic"] = 0x04d2;
  24107. t["Adieresismacron"] = 0x01de;
  24108. t["Adieresissmall"] = 0xf7e4;
  24109. t["Adotbelow"] = 0x1ea0;
  24110. t["Adotmacron"] = 0x01e0;
  24111. t["Agrave"] = 0x00c0;
  24112. t["Agravesmall"] = 0xf7e0;
  24113. t["Ahookabove"] = 0x1ea2;
  24114. t["Aiecyrillic"] = 0x04d4;
  24115. t["Ainvertedbreve"] = 0x0202;
  24116. t["Alpha"] = 0x0391;
  24117. t["Alphatonos"] = 0x0386;
  24118. t["Amacron"] = 0x0100;
  24119. t["Amonospace"] = 0xff21;
  24120. t["Aogonek"] = 0x0104;
  24121. t["Aring"] = 0x00c5;
  24122. t["Aringacute"] = 0x01fa;
  24123. t["Aringbelow"] = 0x1e00;
  24124. t["Aringsmall"] = 0xf7e5;
  24125. t["Asmall"] = 0xf761;
  24126. t["Atilde"] = 0x00c3;
  24127. t["Atildesmall"] = 0xf7e3;
  24128. t["Aybarmenian"] = 0x0531;
  24129. t["B"] = 0x0042;
  24130. t["Bcircle"] = 0x24b7;
  24131. t["Bdotaccent"] = 0x1e02;
  24132. t["Bdotbelow"] = 0x1e04;
  24133. t["Becyrillic"] = 0x0411;
  24134. t["Benarmenian"] = 0x0532;
  24135. t["Beta"] = 0x0392;
  24136. t["Bhook"] = 0x0181;
  24137. t["Blinebelow"] = 0x1e06;
  24138. t["Bmonospace"] = 0xff22;
  24139. t["Brevesmall"] = 0xf6f4;
  24140. t["Bsmall"] = 0xf762;
  24141. t["Btopbar"] = 0x0182;
  24142. t["C"] = 0x0043;
  24143. t["Caarmenian"] = 0x053e;
  24144. t["Cacute"] = 0x0106;
  24145. t["Caron"] = 0xf6ca;
  24146. t["Caronsmall"] = 0xf6f5;
  24147. t["Ccaron"] = 0x010c;
  24148. t["Ccedilla"] = 0x00c7;
  24149. t["Ccedillaacute"] = 0x1e08;
  24150. t["Ccedillasmall"] = 0xf7e7;
  24151. t["Ccircle"] = 0x24b8;
  24152. t["Ccircumflex"] = 0x0108;
  24153. t["Cdot"] = 0x010a;
  24154. t["Cdotaccent"] = 0x010a;
  24155. t["Cedillasmall"] = 0xf7b8;
  24156. t["Chaarmenian"] = 0x0549;
  24157. t["Cheabkhasiancyrillic"] = 0x04bc;
  24158. t["Checyrillic"] = 0x0427;
  24159. t["Chedescenderabkhasiancyrillic"] = 0x04be;
  24160. t["Chedescendercyrillic"] = 0x04b6;
  24161. t["Chedieresiscyrillic"] = 0x04f4;
  24162. t["Cheharmenian"] = 0x0543;
  24163. t["Chekhakassiancyrillic"] = 0x04cb;
  24164. t["Cheverticalstrokecyrillic"] = 0x04b8;
  24165. t["Chi"] = 0x03a7;
  24166. t["Chook"] = 0x0187;
  24167. t["Circumflexsmall"] = 0xf6f6;
  24168. t["Cmonospace"] = 0xff23;
  24169. t["Coarmenian"] = 0x0551;
  24170. t["Csmall"] = 0xf763;
  24171. t["D"] = 0x0044;
  24172. t["DZ"] = 0x01f1;
  24173. t["DZcaron"] = 0x01c4;
  24174. t["Daarmenian"] = 0x0534;
  24175. t["Dafrican"] = 0x0189;
  24176. t["Dcaron"] = 0x010e;
  24177. t["Dcedilla"] = 0x1e10;
  24178. t["Dcircle"] = 0x24b9;
  24179. t["Dcircumflexbelow"] = 0x1e12;
  24180. t["Dcroat"] = 0x0110;
  24181. t["Ddotaccent"] = 0x1e0a;
  24182. t["Ddotbelow"] = 0x1e0c;
  24183. t["Decyrillic"] = 0x0414;
  24184. t["Deicoptic"] = 0x03ee;
  24185. t["Delta"] = 0x2206;
  24186. t["Deltagreek"] = 0x0394;
  24187. t["Dhook"] = 0x018a;
  24188. t["Dieresis"] = 0xf6cb;
  24189. t["DieresisAcute"] = 0xf6cc;
  24190. t["DieresisGrave"] = 0xf6cd;
  24191. t["Dieresissmall"] = 0xf7a8;
  24192. t["Digammagreek"] = 0x03dc;
  24193. t["Djecyrillic"] = 0x0402;
  24194. t["Dlinebelow"] = 0x1e0e;
  24195. t["Dmonospace"] = 0xff24;
  24196. t["Dotaccentsmall"] = 0xf6f7;
  24197. t["Dslash"] = 0x0110;
  24198. t["Dsmall"] = 0xf764;
  24199. t["Dtopbar"] = 0x018b;
  24200. t["Dz"] = 0x01f2;
  24201. t["Dzcaron"] = 0x01c5;
  24202. t["Dzeabkhasiancyrillic"] = 0x04e0;
  24203. t["Dzecyrillic"] = 0x0405;
  24204. t["Dzhecyrillic"] = 0x040f;
  24205. t["E"] = 0x0045;
  24206. t["Eacute"] = 0x00c9;
  24207. t["Eacutesmall"] = 0xf7e9;
  24208. t["Ebreve"] = 0x0114;
  24209. t["Ecaron"] = 0x011a;
  24210. t["Ecedillabreve"] = 0x1e1c;
  24211. t["Echarmenian"] = 0x0535;
  24212. t["Ecircle"] = 0x24ba;
  24213. t["Ecircumflex"] = 0x00ca;
  24214. t["Ecircumflexacute"] = 0x1ebe;
  24215. t["Ecircumflexbelow"] = 0x1e18;
  24216. t["Ecircumflexdotbelow"] = 0x1ec6;
  24217. t["Ecircumflexgrave"] = 0x1ec0;
  24218. t["Ecircumflexhookabove"] = 0x1ec2;
  24219. t["Ecircumflexsmall"] = 0xf7ea;
  24220. t["Ecircumflextilde"] = 0x1ec4;
  24221. t["Ecyrillic"] = 0x0404;
  24222. t["Edblgrave"] = 0x0204;
  24223. t["Edieresis"] = 0x00cb;
  24224. t["Edieresissmall"] = 0xf7eb;
  24225. t["Edot"] = 0x0116;
  24226. t["Edotaccent"] = 0x0116;
  24227. t["Edotbelow"] = 0x1eb8;
  24228. t["Efcyrillic"] = 0x0424;
  24229. t["Egrave"] = 0x00c8;
  24230. t["Egravesmall"] = 0xf7e8;
  24231. t["Eharmenian"] = 0x0537;
  24232. t["Ehookabove"] = 0x1eba;
  24233. t["Eightroman"] = 0x2167;
  24234. t["Einvertedbreve"] = 0x0206;
  24235. t["Eiotifiedcyrillic"] = 0x0464;
  24236. t["Elcyrillic"] = 0x041b;
  24237. t["Elevenroman"] = 0x216a;
  24238. t["Emacron"] = 0x0112;
  24239. t["Emacronacute"] = 0x1e16;
  24240. t["Emacrongrave"] = 0x1e14;
  24241. t["Emcyrillic"] = 0x041c;
  24242. t["Emonospace"] = 0xff25;
  24243. t["Encyrillic"] = 0x041d;
  24244. t["Endescendercyrillic"] = 0x04a2;
  24245. t["Eng"] = 0x014a;
  24246. t["Enghecyrillic"] = 0x04a4;
  24247. t["Enhookcyrillic"] = 0x04c7;
  24248. t["Eogonek"] = 0x0118;
  24249. t["Eopen"] = 0x0190;
  24250. t["Epsilon"] = 0x0395;
  24251. t["Epsilontonos"] = 0x0388;
  24252. t["Ercyrillic"] = 0x0420;
  24253. t["Ereversed"] = 0x018e;
  24254. t["Ereversedcyrillic"] = 0x042d;
  24255. t["Escyrillic"] = 0x0421;
  24256. t["Esdescendercyrillic"] = 0x04aa;
  24257. t["Esh"] = 0x01a9;
  24258. t["Esmall"] = 0xf765;
  24259. t["Eta"] = 0x0397;
  24260. t["Etarmenian"] = 0x0538;
  24261. t["Etatonos"] = 0x0389;
  24262. t["Eth"] = 0x00d0;
  24263. t["Ethsmall"] = 0xf7f0;
  24264. t["Etilde"] = 0x1ebc;
  24265. t["Etildebelow"] = 0x1e1a;
  24266. t["Euro"] = 0x20ac;
  24267. t["Ezh"] = 0x01b7;
  24268. t["Ezhcaron"] = 0x01ee;
  24269. t["Ezhreversed"] = 0x01b8;
  24270. t["F"] = 0x0046;
  24271. t["Fcircle"] = 0x24bb;
  24272. t["Fdotaccent"] = 0x1e1e;
  24273. t["Feharmenian"] = 0x0556;
  24274. t["Feicoptic"] = 0x03e4;
  24275. t["Fhook"] = 0x0191;
  24276. t["Fitacyrillic"] = 0x0472;
  24277. t["Fiveroman"] = 0x2164;
  24278. t["Fmonospace"] = 0xff26;
  24279. t["Fourroman"] = 0x2163;
  24280. t["Fsmall"] = 0xf766;
  24281. t["G"] = 0x0047;
  24282. t["GBsquare"] = 0x3387;
  24283. t["Gacute"] = 0x01f4;
  24284. t["Gamma"] = 0x0393;
  24285. t["Gammaafrican"] = 0x0194;
  24286. t["Gangiacoptic"] = 0x03ea;
  24287. t["Gbreve"] = 0x011e;
  24288. t["Gcaron"] = 0x01e6;
  24289. t["Gcedilla"] = 0x0122;
  24290. t["Gcircle"] = 0x24bc;
  24291. t["Gcircumflex"] = 0x011c;
  24292. t["Gcommaaccent"] = 0x0122;
  24293. t["Gdot"] = 0x0120;
  24294. t["Gdotaccent"] = 0x0120;
  24295. t["Gecyrillic"] = 0x0413;
  24296. t["Ghadarmenian"] = 0x0542;
  24297. t["Ghemiddlehookcyrillic"] = 0x0494;
  24298. t["Ghestrokecyrillic"] = 0x0492;
  24299. t["Gheupturncyrillic"] = 0x0490;
  24300. t["Ghook"] = 0x0193;
  24301. t["Gimarmenian"] = 0x0533;
  24302. t["Gjecyrillic"] = 0x0403;
  24303. t["Gmacron"] = 0x1e20;
  24304. t["Gmonospace"] = 0xff27;
  24305. t["Grave"] = 0xf6ce;
  24306. t["Gravesmall"] = 0xf760;
  24307. t["Gsmall"] = 0xf767;
  24308. t["Gsmallhook"] = 0x029b;
  24309. t["Gstroke"] = 0x01e4;
  24310. t["H"] = 0x0048;
  24311. t["H18533"] = 0x25cf;
  24312. t["H18543"] = 0x25aa;
  24313. t["H18551"] = 0x25ab;
  24314. t["H22073"] = 0x25a1;
  24315. t["HPsquare"] = 0x33cb;
  24316. t["Haabkhasiancyrillic"] = 0x04a8;
  24317. t["Hadescendercyrillic"] = 0x04b2;
  24318. t["Hardsigncyrillic"] = 0x042a;
  24319. t["Hbar"] = 0x0126;
  24320. t["Hbrevebelow"] = 0x1e2a;
  24321. t["Hcedilla"] = 0x1e28;
  24322. t["Hcircle"] = 0x24bd;
  24323. t["Hcircumflex"] = 0x0124;
  24324. t["Hdieresis"] = 0x1e26;
  24325. t["Hdotaccent"] = 0x1e22;
  24326. t["Hdotbelow"] = 0x1e24;
  24327. t["Hmonospace"] = 0xff28;
  24328. t["Hoarmenian"] = 0x0540;
  24329. t["Horicoptic"] = 0x03e8;
  24330. t["Hsmall"] = 0xf768;
  24331. t["Hungarumlaut"] = 0xf6cf;
  24332. t["Hungarumlautsmall"] = 0xf6f8;
  24333. t["Hzsquare"] = 0x3390;
  24334. t["I"] = 0x0049;
  24335. t["IAcyrillic"] = 0x042f;
  24336. t["IJ"] = 0x0132;
  24337. t["IUcyrillic"] = 0x042e;
  24338. t["Iacute"] = 0x00cd;
  24339. t["Iacutesmall"] = 0xf7ed;
  24340. t["Ibreve"] = 0x012c;
  24341. t["Icaron"] = 0x01cf;
  24342. t["Icircle"] = 0x24be;
  24343. t["Icircumflex"] = 0x00ce;
  24344. t["Icircumflexsmall"] = 0xf7ee;
  24345. t["Icyrillic"] = 0x0406;
  24346. t["Idblgrave"] = 0x0208;
  24347. t["Idieresis"] = 0x00cf;
  24348. t["Idieresisacute"] = 0x1e2e;
  24349. t["Idieresiscyrillic"] = 0x04e4;
  24350. t["Idieresissmall"] = 0xf7ef;
  24351. t["Idot"] = 0x0130;
  24352. t["Idotaccent"] = 0x0130;
  24353. t["Idotbelow"] = 0x1eca;
  24354. t["Iebrevecyrillic"] = 0x04d6;
  24355. t["Iecyrillic"] = 0x0415;
  24356. t["Ifraktur"] = 0x2111;
  24357. t["Igrave"] = 0x00cc;
  24358. t["Igravesmall"] = 0xf7ec;
  24359. t["Ihookabove"] = 0x1ec8;
  24360. t["Iicyrillic"] = 0x0418;
  24361. t["Iinvertedbreve"] = 0x020a;
  24362. t["Iishortcyrillic"] = 0x0419;
  24363. t["Imacron"] = 0x012a;
  24364. t["Imacroncyrillic"] = 0x04e2;
  24365. t["Imonospace"] = 0xff29;
  24366. t["Iniarmenian"] = 0x053b;
  24367. t["Iocyrillic"] = 0x0401;
  24368. t["Iogonek"] = 0x012e;
  24369. t["Iota"] = 0x0399;
  24370. t["Iotaafrican"] = 0x0196;
  24371. t["Iotadieresis"] = 0x03aa;
  24372. t["Iotatonos"] = 0x038a;
  24373. t["Ismall"] = 0xf769;
  24374. t["Istroke"] = 0x0197;
  24375. t["Itilde"] = 0x0128;
  24376. t["Itildebelow"] = 0x1e2c;
  24377. t["Izhitsacyrillic"] = 0x0474;
  24378. t["Izhitsadblgravecyrillic"] = 0x0476;
  24379. t["J"] = 0x004a;
  24380. t["Jaarmenian"] = 0x0541;
  24381. t["Jcircle"] = 0x24bf;
  24382. t["Jcircumflex"] = 0x0134;
  24383. t["Jecyrillic"] = 0x0408;
  24384. t["Jheharmenian"] = 0x054b;
  24385. t["Jmonospace"] = 0xff2a;
  24386. t["Jsmall"] = 0xf76a;
  24387. t["K"] = 0x004b;
  24388. t["KBsquare"] = 0x3385;
  24389. t["KKsquare"] = 0x33cd;
  24390. t["Kabashkircyrillic"] = 0x04a0;
  24391. t["Kacute"] = 0x1e30;
  24392. t["Kacyrillic"] = 0x041a;
  24393. t["Kadescendercyrillic"] = 0x049a;
  24394. t["Kahookcyrillic"] = 0x04c3;
  24395. t["Kappa"] = 0x039a;
  24396. t["Kastrokecyrillic"] = 0x049e;
  24397. t["Kaverticalstrokecyrillic"] = 0x049c;
  24398. t["Kcaron"] = 0x01e8;
  24399. t["Kcedilla"] = 0x0136;
  24400. t["Kcircle"] = 0x24c0;
  24401. t["Kcommaaccent"] = 0x0136;
  24402. t["Kdotbelow"] = 0x1e32;
  24403. t["Keharmenian"] = 0x0554;
  24404. t["Kenarmenian"] = 0x053f;
  24405. t["Khacyrillic"] = 0x0425;
  24406. t["Kheicoptic"] = 0x03e6;
  24407. t["Khook"] = 0x0198;
  24408. t["Kjecyrillic"] = 0x040c;
  24409. t["Klinebelow"] = 0x1e34;
  24410. t["Kmonospace"] = 0xff2b;
  24411. t["Koppacyrillic"] = 0x0480;
  24412. t["Koppagreek"] = 0x03de;
  24413. t["Ksicyrillic"] = 0x046e;
  24414. t["Ksmall"] = 0xf76b;
  24415. t["L"] = 0x004c;
  24416. t["LJ"] = 0x01c7;
  24417. t["LL"] = 0xf6bf;
  24418. t["Lacute"] = 0x0139;
  24419. t["Lambda"] = 0x039b;
  24420. t["Lcaron"] = 0x013d;
  24421. t["Lcedilla"] = 0x013b;
  24422. t["Lcircle"] = 0x24c1;
  24423. t["Lcircumflexbelow"] = 0x1e3c;
  24424. t["Lcommaaccent"] = 0x013b;
  24425. t["Ldot"] = 0x013f;
  24426. t["Ldotaccent"] = 0x013f;
  24427. t["Ldotbelow"] = 0x1e36;
  24428. t["Ldotbelowmacron"] = 0x1e38;
  24429. t["Liwnarmenian"] = 0x053c;
  24430. t["Lj"] = 0x01c8;
  24431. t["Ljecyrillic"] = 0x0409;
  24432. t["Llinebelow"] = 0x1e3a;
  24433. t["Lmonospace"] = 0xff2c;
  24434. t["Lslash"] = 0x0141;
  24435. t["Lslashsmall"] = 0xf6f9;
  24436. t["Lsmall"] = 0xf76c;
  24437. t["M"] = 0x004d;
  24438. t["MBsquare"] = 0x3386;
  24439. t["Macron"] = 0xf6d0;
  24440. t["Macronsmall"] = 0xf7af;
  24441. t["Macute"] = 0x1e3e;
  24442. t["Mcircle"] = 0x24c2;
  24443. t["Mdotaccent"] = 0x1e40;
  24444. t["Mdotbelow"] = 0x1e42;
  24445. t["Menarmenian"] = 0x0544;
  24446. t["Mmonospace"] = 0xff2d;
  24447. t["Msmall"] = 0xf76d;
  24448. t["Mturned"] = 0x019c;
  24449. t["Mu"] = 0x039c;
  24450. t["N"] = 0x004e;
  24451. t["NJ"] = 0x01ca;
  24452. t["Nacute"] = 0x0143;
  24453. t["Ncaron"] = 0x0147;
  24454. t["Ncedilla"] = 0x0145;
  24455. t["Ncircle"] = 0x24c3;
  24456. t["Ncircumflexbelow"] = 0x1e4a;
  24457. t["Ncommaaccent"] = 0x0145;
  24458. t["Ndotaccent"] = 0x1e44;
  24459. t["Ndotbelow"] = 0x1e46;
  24460. t["Nhookleft"] = 0x019d;
  24461. t["Nineroman"] = 0x2168;
  24462. t["Nj"] = 0x01cb;
  24463. t["Njecyrillic"] = 0x040a;
  24464. t["Nlinebelow"] = 0x1e48;
  24465. t["Nmonospace"] = 0xff2e;
  24466. t["Nowarmenian"] = 0x0546;
  24467. t["Nsmall"] = 0xf76e;
  24468. t["Ntilde"] = 0x00d1;
  24469. t["Ntildesmall"] = 0xf7f1;
  24470. t["Nu"] = 0x039d;
  24471. t["O"] = 0x004f;
  24472. t["OE"] = 0x0152;
  24473. t["OEsmall"] = 0xf6fa;
  24474. t["Oacute"] = 0x00d3;
  24475. t["Oacutesmall"] = 0xf7f3;
  24476. t["Obarredcyrillic"] = 0x04e8;
  24477. t["Obarreddieresiscyrillic"] = 0x04ea;
  24478. t["Obreve"] = 0x014e;
  24479. t["Ocaron"] = 0x01d1;
  24480. t["Ocenteredtilde"] = 0x019f;
  24481. t["Ocircle"] = 0x24c4;
  24482. t["Ocircumflex"] = 0x00d4;
  24483. t["Ocircumflexacute"] = 0x1ed0;
  24484. t["Ocircumflexdotbelow"] = 0x1ed8;
  24485. t["Ocircumflexgrave"] = 0x1ed2;
  24486. t["Ocircumflexhookabove"] = 0x1ed4;
  24487. t["Ocircumflexsmall"] = 0xf7f4;
  24488. t["Ocircumflextilde"] = 0x1ed6;
  24489. t["Ocyrillic"] = 0x041e;
  24490. t["Odblacute"] = 0x0150;
  24491. t["Odblgrave"] = 0x020c;
  24492. t["Odieresis"] = 0x00d6;
  24493. t["Odieresiscyrillic"] = 0x04e6;
  24494. t["Odieresissmall"] = 0xf7f6;
  24495. t["Odotbelow"] = 0x1ecc;
  24496. t["Ogoneksmall"] = 0xf6fb;
  24497. t["Ograve"] = 0x00d2;
  24498. t["Ogravesmall"] = 0xf7f2;
  24499. t["Oharmenian"] = 0x0555;
  24500. t["Ohm"] = 0x2126;
  24501. t["Ohookabove"] = 0x1ece;
  24502. t["Ohorn"] = 0x01a0;
  24503. t["Ohornacute"] = 0x1eda;
  24504. t["Ohorndotbelow"] = 0x1ee2;
  24505. t["Ohorngrave"] = 0x1edc;
  24506. t["Ohornhookabove"] = 0x1ede;
  24507. t["Ohorntilde"] = 0x1ee0;
  24508. t["Ohungarumlaut"] = 0x0150;
  24509. t["Oi"] = 0x01a2;
  24510. t["Oinvertedbreve"] = 0x020e;
  24511. t["Omacron"] = 0x014c;
  24512. t["Omacronacute"] = 0x1e52;
  24513. t["Omacrongrave"] = 0x1e50;
  24514. t["Omega"] = 0x2126;
  24515. t["Omegacyrillic"] = 0x0460;
  24516. t["Omegagreek"] = 0x03a9;
  24517. t["Omegaroundcyrillic"] = 0x047a;
  24518. t["Omegatitlocyrillic"] = 0x047c;
  24519. t["Omegatonos"] = 0x038f;
  24520. t["Omicron"] = 0x039f;
  24521. t["Omicrontonos"] = 0x038c;
  24522. t["Omonospace"] = 0xff2f;
  24523. t["Oneroman"] = 0x2160;
  24524. t["Oogonek"] = 0x01ea;
  24525. t["Oogonekmacron"] = 0x01ec;
  24526. t["Oopen"] = 0x0186;
  24527. t["Oslash"] = 0x00d8;
  24528. t["Oslashacute"] = 0x01fe;
  24529. t["Oslashsmall"] = 0xf7f8;
  24530. t["Osmall"] = 0xf76f;
  24531. t["Ostrokeacute"] = 0x01fe;
  24532. t["Otcyrillic"] = 0x047e;
  24533. t["Otilde"] = 0x00d5;
  24534. t["Otildeacute"] = 0x1e4c;
  24535. t["Otildedieresis"] = 0x1e4e;
  24536. t["Otildesmall"] = 0xf7f5;
  24537. t["P"] = 0x0050;
  24538. t["Pacute"] = 0x1e54;
  24539. t["Pcircle"] = 0x24c5;
  24540. t["Pdotaccent"] = 0x1e56;
  24541. t["Pecyrillic"] = 0x041f;
  24542. t["Peharmenian"] = 0x054a;
  24543. t["Pemiddlehookcyrillic"] = 0x04a6;
  24544. t["Phi"] = 0x03a6;
  24545. t["Phook"] = 0x01a4;
  24546. t["Pi"] = 0x03a0;
  24547. t["Piwrarmenian"] = 0x0553;
  24548. t["Pmonospace"] = 0xff30;
  24549. t["Psi"] = 0x03a8;
  24550. t["Psicyrillic"] = 0x0470;
  24551. t["Psmall"] = 0xf770;
  24552. t["Q"] = 0x0051;
  24553. t["Qcircle"] = 0x24c6;
  24554. t["Qmonospace"] = 0xff31;
  24555. t["Qsmall"] = 0xf771;
  24556. t["R"] = 0x0052;
  24557. t["Raarmenian"] = 0x054c;
  24558. t["Racute"] = 0x0154;
  24559. t["Rcaron"] = 0x0158;
  24560. t["Rcedilla"] = 0x0156;
  24561. t["Rcircle"] = 0x24c7;
  24562. t["Rcommaaccent"] = 0x0156;
  24563. t["Rdblgrave"] = 0x0210;
  24564. t["Rdotaccent"] = 0x1e58;
  24565. t["Rdotbelow"] = 0x1e5a;
  24566. t["Rdotbelowmacron"] = 0x1e5c;
  24567. t["Reharmenian"] = 0x0550;
  24568. t["Rfraktur"] = 0x211c;
  24569. t["Rho"] = 0x03a1;
  24570. t["Ringsmall"] = 0xf6fc;
  24571. t["Rinvertedbreve"] = 0x0212;
  24572. t["Rlinebelow"] = 0x1e5e;
  24573. t["Rmonospace"] = 0xff32;
  24574. t["Rsmall"] = 0xf772;
  24575. t["Rsmallinverted"] = 0x0281;
  24576. t["Rsmallinvertedsuperior"] = 0x02b6;
  24577. t["S"] = 0x0053;
  24578. t["SF010000"] = 0x250c;
  24579. t["SF020000"] = 0x2514;
  24580. t["SF030000"] = 0x2510;
  24581. t["SF040000"] = 0x2518;
  24582. t["SF050000"] = 0x253c;
  24583. t["SF060000"] = 0x252c;
  24584. t["SF070000"] = 0x2534;
  24585. t["SF080000"] = 0x251c;
  24586. t["SF090000"] = 0x2524;
  24587. t["SF100000"] = 0x2500;
  24588. t["SF110000"] = 0x2502;
  24589. t["SF190000"] = 0x2561;
  24590. t["SF200000"] = 0x2562;
  24591. t["SF210000"] = 0x2556;
  24592. t["SF220000"] = 0x2555;
  24593. t["SF230000"] = 0x2563;
  24594. t["SF240000"] = 0x2551;
  24595. t["SF250000"] = 0x2557;
  24596. t["SF260000"] = 0x255d;
  24597. t["SF270000"] = 0x255c;
  24598. t["SF280000"] = 0x255b;
  24599. t["SF360000"] = 0x255e;
  24600. t["SF370000"] = 0x255f;
  24601. t["SF380000"] = 0x255a;
  24602. t["SF390000"] = 0x2554;
  24603. t["SF400000"] = 0x2569;
  24604. t["SF410000"] = 0x2566;
  24605. t["SF420000"] = 0x2560;
  24606. t["SF430000"] = 0x2550;
  24607. t["SF440000"] = 0x256c;
  24608. t["SF450000"] = 0x2567;
  24609. t["SF460000"] = 0x2568;
  24610. t["SF470000"] = 0x2564;
  24611. t["SF480000"] = 0x2565;
  24612. t["SF490000"] = 0x2559;
  24613. t["SF500000"] = 0x2558;
  24614. t["SF510000"] = 0x2552;
  24615. t["SF520000"] = 0x2553;
  24616. t["SF530000"] = 0x256b;
  24617. t["SF540000"] = 0x256a;
  24618. t["Sacute"] = 0x015a;
  24619. t["Sacutedotaccent"] = 0x1e64;
  24620. t["Sampigreek"] = 0x03e0;
  24621. t["Scaron"] = 0x0160;
  24622. t["Scarondotaccent"] = 0x1e66;
  24623. t["Scaronsmall"] = 0xf6fd;
  24624. t["Scedilla"] = 0x015e;
  24625. t["Schwa"] = 0x018f;
  24626. t["Schwacyrillic"] = 0x04d8;
  24627. t["Schwadieresiscyrillic"] = 0x04da;
  24628. t["Scircle"] = 0x24c8;
  24629. t["Scircumflex"] = 0x015c;
  24630. t["Scommaaccent"] = 0x0218;
  24631. t["Sdotaccent"] = 0x1e60;
  24632. t["Sdotbelow"] = 0x1e62;
  24633. t["Sdotbelowdotaccent"] = 0x1e68;
  24634. t["Seharmenian"] = 0x054d;
  24635. t["Sevenroman"] = 0x2166;
  24636. t["Shaarmenian"] = 0x0547;
  24637. t["Shacyrillic"] = 0x0428;
  24638. t["Shchacyrillic"] = 0x0429;
  24639. t["Sheicoptic"] = 0x03e2;
  24640. t["Shhacyrillic"] = 0x04ba;
  24641. t["Shimacoptic"] = 0x03ec;
  24642. t["Sigma"] = 0x03a3;
  24643. t["Sixroman"] = 0x2165;
  24644. t["Smonospace"] = 0xff33;
  24645. t["Softsigncyrillic"] = 0x042c;
  24646. t["Ssmall"] = 0xf773;
  24647. t["Stigmagreek"] = 0x03da;
  24648. t["T"] = 0x0054;
  24649. t["Tau"] = 0x03a4;
  24650. t["Tbar"] = 0x0166;
  24651. t["Tcaron"] = 0x0164;
  24652. t["Tcedilla"] = 0x0162;
  24653. t["Tcircle"] = 0x24c9;
  24654. t["Tcircumflexbelow"] = 0x1e70;
  24655. t["Tcommaaccent"] = 0x0162;
  24656. t["Tdotaccent"] = 0x1e6a;
  24657. t["Tdotbelow"] = 0x1e6c;
  24658. t["Tecyrillic"] = 0x0422;
  24659. t["Tedescendercyrillic"] = 0x04ac;
  24660. t["Tenroman"] = 0x2169;
  24661. t["Tetsecyrillic"] = 0x04b4;
  24662. t["Theta"] = 0x0398;
  24663. t["Thook"] = 0x01ac;
  24664. t["Thorn"] = 0x00de;
  24665. t["Thornsmall"] = 0xf7fe;
  24666. t["Threeroman"] = 0x2162;
  24667. t["Tildesmall"] = 0xf6fe;
  24668. t["Tiwnarmenian"] = 0x054f;
  24669. t["Tlinebelow"] = 0x1e6e;
  24670. t["Tmonospace"] = 0xff34;
  24671. t["Toarmenian"] = 0x0539;
  24672. t["Tonefive"] = 0x01bc;
  24673. t["Tonesix"] = 0x0184;
  24674. t["Tonetwo"] = 0x01a7;
  24675. t["Tretroflexhook"] = 0x01ae;
  24676. t["Tsecyrillic"] = 0x0426;
  24677. t["Tshecyrillic"] = 0x040b;
  24678. t["Tsmall"] = 0xf774;
  24679. t["Twelveroman"] = 0x216b;
  24680. t["Tworoman"] = 0x2161;
  24681. t["U"] = 0x0055;
  24682. t["Uacute"] = 0x00da;
  24683. t["Uacutesmall"] = 0xf7fa;
  24684. t["Ubreve"] = 0x016c;
  24685. t["Ucaron"] = 0x01d3;
  24686. t["Ucircle"] = 0x24ca;
  24687. t["Ucircumflex"] = 0x00db;
  24688. t["Ucircumflexbelow"] = 0x1e76;
  24689. t["Ucircumflexsmall"] = 0xf7fb;
  24690. t["Ucyrillic"] = 0x0423;
  24691. t["Udblacute"] = 0x0170;
  24692. t["Udblgrave"] = 0x0214;
  24693. t["Udieresis"] = 0x00dc;
  24694. t["Udieresisacute"] = 0x01d7;
  24695. t["Udieresisbelow"] = 0x1e72;
  24696. t["Udieresiscaron"] = 0x01d9;
  24697. t["Udieresiscyrillic"] = 0x04f0;
  24698. t["Udieresisgrave"] = 0x01db;
  24699. t["Udieresismacron"] = 0x01d5;
  24700. t["Udieresissmall"] = 0xf7fc;
  24701. t["Udotbelow"] = 0x1ee4;
  24702. t["Ugrave"] = 0x00d9;
  24703. t["Ugravesmall"] = 0xf7f9;
  24704. t["Uhookabove"] = 0x1ee6;
  24705. t["Uhorn"] = 0x01af;
  24706. t["Uhornacute"] = 0x1ee8;
  24707. t["Uhorndotbelow"] = 0x1ef0;
  24708. t["Uhorngrave"] = 0x1eea;
  24709. t["Uhornhookabove"] = 0x1eec;
  24710. t["Uhorntilde"] = 0x1eee;
  24711. t["Uhungarumlaut"] = 0x0170;
  24712. t["Uhungarumlautcyrillic"] = 0x04f2;
  24713. t["Uinvertedbreve"] = 0x0216;
  24714. t["Ukcyrillic"] = 0x0478;
  24715. t["Umacron"] = 0x016a;
  24716. t["Umacroncyrillic"] = 0x04ee;
  24717. t["Umacrondieresis"] = 0x1e7a;
  24718. t["Umonospace"] = 0xff35;
  24719. t["Uogonek"] = 0x0172;
  24720. t["Upsilon"] = 0x03a5;
  24721. t["Upsilon1"] = 0x03d2;
  24722. t["Upsilonacutehooksymbolgreek"] = 0x03d3;
  24723. t["Upsilonafrican"] = 0x01b1;
  24724. t["Upsilondieresis"] = 0x03ab;
  24725. t["Upsilondieresishooksymbolgreek"] = 0x03d4;
  24726. t["Upsilonhooksymbol"] = 0x03d2;
  24727. t["Upsilontonos"] = 0x038e;
  24728. t["Uring"] = 0x016e;
  24729. t["Ushortcyrillic"] = 0x040e;
  24730. t["Usmall"] = 0xf775;
  24731. t["Ustraightcyrillic"] = 0x04ae;
  24732. t["Ustraightstrokecyrillic"] = 0x04b0;
  24733. t["Utilde"] = 0x0168;
  24734. t["Utildeacute"] = 0x1e78;
  24735. t["Utildebelow"] = 0x1e74;
  24736. t["V"] = 0x0056;
  24737. t["Vcircle"] = 0x24cb;
  24738. t["Vdotbelow"] = 0x1e7e;
  24739. t["Vecyrillic"] = 0x0412;
  24740. t["Vewarmenian"] = 0x054e;
  24741. t["Vhook"] = 0x01b2;
  24742. t["Vmonospace"] = 0xff36;
  24743. t["Voarmenian"] = 0x0548;
  24744. t["Vsmall"] = 0xf776;
  24745. t["Vtilde"] = 0x1e7c;
  24746. t["W"] = 0x0057;
  24747. t["Wacute"] = 0x1e82;
  24748. t["Wcircle"] = 0x24cc;
  24749. t["Wcircumflex"] = 0x0174;
  24750. t["Wdieresis"] = 0x1e84;
  24751. t["Wdotaccent"] = 0x1e86;
  24752. t["Wdotbelow"] = 0x1e88;
  24753. t["Wgrave"] = 0x1e80;
  24754. t["Wmonospace"] = 0xff37;
  24755. t["Wsmall"] = 0xf777;
  24756. t["X"] = 0x0058;
  24757. t["Xcircle"] = 0x24cd;
  24758. t["Xdieresis"] = 0x1e8c;
  24759. t["Xdotaccent"] = 0x1e8a;
  24760. t["Xeharmenian"] = 0x053d;
  24761. t["Xi"] = 0x039e;
  24762. t["Xmonospace"] = 0xff38;
  24763. t["Xsmall"] = 0xf778;
  24764. t["Y"] = 0x0059;
  24765. t["Yacute"] = 0x00dd;
  24766. t["Yacutesmall"] = 0xf7fd;
  24767. t["Yatcyrillic"] = 0x0462;
  24768. t["Ycircle"] = 0x24ce;
  24769. t["Ycircumflex"] = 0x0176;
  24770. t["Ydieresis"] = 0x0178;
  24771. t["Ydieresissmall"] = 0xf7ff;
  24772. t["Ydotaccent"] = 0x1e8e;
  24773. t["Ydotbelow"] = 0x1ef4;
  24774. t["Yericyrillic"] = 0x042b;
  24775. t["Yerudieresiscyrillic"] = 0x04f8;
  24776. t["Ygrave"] = 0x1ef2;
  24777. t["Yhook"] = 0x01b3;
  24778. t["Yhookabove"] = 0x1ef6;
  24779. t["Yiarmenian"] = 0x0545;
  24780. t["Yicyrillic"] = 0x0407;
  24781. t["Yiwnarmenian"] = 0x0552;
  24782. t["Ymonospace"] = 0xff39;
  24783. t["Ysmall"] = 0xf779;
  24784. t["Ytilde"] = 0x1ef8;
  24785. t["Yusbigcyrillic"] = 0x046a;
  24786. t["Yusbigiotifiedcyrillic"] = 0x046c;
  24787. t["Yuslittlecyrillic"] = 0x0466;
  24788. t["Yuslittleiotifiedcyrillic"] = 0x0468;
  24789. t["Z"] = 0x005a;
  24790. t["Zaarmenian"] = 0x0536;
  24791. t["Zacute"] = 0x0179;
  24792. t["Zcaron"] = 0x017d;
  24793. t["Zcaronsmall"] = 0xf6ff;
  24794. t["Zcircle"] = 0x24cf;
  24795. t["Zcircumflex"] = 0x1e90;
  24796. t["Zdot"] = 0x017b;
  24797. t["Zdotaccent"] = 0x017b;
  24798. t["Zdotbelow"] = 0x1e92;
  24799. t["Zecyrillic"] = 0x0417;
  24800. t["Zedescendercyrillic"] = 0x0498;
  24801. t["Zedieresiscyrillic"] = 0x04de;
  24802. t["Zeta"] = 0x0396;
  24803. t["Zhearmenian"] = 0x053a;
  24804. t["Zhebrevecyrillic"] = 0x04c1;
  24805. t["Zhecyrillic"] = 0x0416;
  24806. t["Zhedescendercyrillic"] = 0x0496;
  24807. t["Zhedieresiscyrillic"] = 0x04dc;
  24808. t["Zlinebelow"] = 0x1e94;
  24809. t["Zmonospace"] = 0xff3a;
  24810. t["Zsmall"] = 0xf77a;
  24811. t["Zstroke"] = 0x01b5;
  24812. t["a"] = 0x0061;
  24813. t["aabengali"] = 0x0986;
  24814. t["aacute"] = 0x00e1;
  24815. t["aadeva"] = 0x0906;
  24816. t["aagujarati"] = 0x0a86;
  24817. t["aagurmukhi"] = 0x0a06;
  24818. t["aamatragurmukhi"] = 0x0a3e;
  24819. t["aarusquare"] = 0x3303;
  24820. t["aavowelsignbengali"] = 0x09be;
  24821. t["aavowelsigndeva"] = 0x093e;
  24822. t["aavowelsigngujarati"] = 0x0abe;
  24823. t["abbreviationmarkarmenian"] = 0x055f;
  24824. t["abbreviationsigndeva"] = 0x0970;
  24825. t["abengali"] = 0x0985;
  24826. t["abopomofo"] = 0x311a;
  24827. t["abreve"] = 0x0103;
  24828. t["abreveacute"] = 0x1eaf;
  24829. t["abrevecyrillic"] = 0x04d1;
  24830. t["abrevedotbelow"] = 0x1eb7;
  24831. t["abrevegrave"] = 0x1eb1;
  24832. t["abrevehookabove"] = 0x1eb3;
  24833. t["abrevetilde"] = 0x1eb5;
  24834. t["acaron"] = 0x01ce;
  24835. t["acircle"] = 0x24d0;
  24836. t["acircumflex"] = 0x00e2;
  24837. t["acircumflexacute"] = 0x1ea5;
  24838. t["acircumflexdotbelow"] = 0x1ead;
  24839. t["acircumflexgrave"] = 0x1ea7;
  24840. t["acircumflexhookabove"] = 0x1ea9;
  24841. t["acircumflextilde"] = 0x1eab;
  24842. t["acute"] = 0x00b4;
  24843. t["acutebelowcmb"] = 0x0317;
  24844. t["acutecmb"] = 0x0301;
  24845. t["acutecomb"] = 0x0301;
  24846. t["acutedeva"] = 0x0954;
  24847. t["acutelowmod"] = 0x02cf;
  24848. t["acutetonecmb"] = 0x0341;
  24849. t["acyrillic"] = 0x0430;
  24850. t["adblgrave"] = 0x0201;
  24851. t["addakgurmukhi"] = 0x0a71;
  24852. t["adeva"] = 0x0905;
  24853. t["adieresis"] = 0x00e4;
  24854. t["adieresiscyrillic"] = 0x04d3;
  24855. t["adieresismacron"] = 0x01df;
  24856. t["adotbelow"] = 0x1ea1;
  24857. t["adotmacron"] = 0x01e1;
  24858. t["ae"] = 0x00e6;
  24859. t["aeacute"] = 0x01fd;
  24860. t["aekorean"] = 0x3150;
  24861. t["aemacron"] = 0x01e3;
  24862. t["afii00208"] = 0x2015;
  24863. t["afii08941"] = 0x20a4;
  24864. t["afii10017"] = 0x0410;
  24865. t["afii10018"] = 0x0411;
  24866. t["afii10019"] = 0x0412;
  24867. t["afii10020"] = 0x0413;
  24868. t["afii10021"] = 0x0414;
  24869. t["afii10022"] = 0x0415;
  24870. t["afii10023"] = 0x0401;
  24871. t["afii10024"] = 0x0416;
  24872. t["afii10025"] = 0x0417;
  24873. t["afii10026"] = 0x0418;
  24874. t["afii10027"] = 0x0419;
  24875. t["afii10028"] = 0x041a;
  24876. t["afii10029"] = 0x041b;
  24877. t["afii10030"] = 0x041c;
  24878. t["afii10031"] = 0x041d;
  24879. t["afii10032"] = 0x041e;
  24880. t["afii10033"] = 0x041f;
  24881. t["afii10034"] = 0x0420;
  24882. t["afii10035"] = 0x0421;
  24883. t["afii10036"] = 0x0422;
  24884. t["afii10037"] = 0x0423;
  24885. t["afii10038"] = 0x0424;
  24886. t["afii10039"] = 0x0425;
  24887. t["afii10040"] = 0x0426;
  24888. t["afii10041"] = 0x0427;
  24889. t["afii10042"] = 0x0428;
  24890. t["afii10043"] = 0x0429;
  24891. t["afii10044"] = 0x042a;
  24892. t["afii10045"] = 0x042b;
  24893. t["afii10046"] = 0x042c;
  24894. t["afii10047"] = 0x042d;
  24895. t["afii10048"] = 0x042e;
  24896. t["afii10049"] = 0x042f;
  24897. t["afii10050"] = 0x0490;
  24898. t["afii10051"] = 0x0402;
  24899. t["afii10052"] = 0x0403;
  24900. t["afii10053"] = 0x0404;
  24901. t["afii10054"] = 0x0405;
  24902. t["afii10055"] = 0x0406;
  24903. t["afii10056"] = 0x0407;
  24904. t["afii10057"] = 0x0408;
  24905. t["afii10058"] = 0x0409;
  24906. t["afii10059"] = 0x040a;
  24907. t["afii10060"] = 0x040b;
  24908. t["afii10061"] = 0x040c;
  24909. t["afii10062"] = 0x040e;
  24910. t["afii10063"] = 0xf6c4;
  24911. t["afii10064"] = 0xf6c5;
  24912. t["afii10065"] = 0x0430;
  24913. t["afii10066"] = 0x0431;
  24914. t["afii10067"] = 0x0432;
  24915. t["afii10068"] = 0x0433;
  24916. t["afii10069"] = 0x0434;
  24917. t["afii10070"] = 0x0435;
  24918. t["afii10071"] = 0x0451;
  24919. t["afii10072"] = 0x0436;
  24920. t["afii10073"] = 0x0437;
  24921. t["afii10074"] = 0x0438;
  24922. t["afii10075"] = 0x0439;
  24923. t["afii10076"] = 0x043a;
  24924. t["afii10077"] = 0x043b;
  24925. t["afii10078"] = 0x043c;
  24926. t["afii10079"] = 0x043d;
  24927. t["afii10080"] = 0x043e;
  24928. t["afii10081"] = 0x043f;
  24929. t["afii10082"] = 0x0440;
  24930. t["afii10083"] = 0x0441;
  24931. t["afii10084"] = 0x0442;
  24932. t["afii10085"] = 0x0443;
  24933. t["afii10086"] = 0x0444;
  24934. t["afii10087"] = 0x0445;
  24935. t["afii10088"] = 0x0446;
  24936. t["afii10089"] = 0x0447;
  24937. t["afii10090"] = 0x0448;
  24938. t["afii10091"] = 0x0449;
  24939. t["afii10092"] = 0x044a;
  24940. t["afii10093"] = 0x044b;
  24941. t["afii10094"] = 0x044c;
  24942. t["afii10095"] = 0x044d;
  24943. t["afii10096"] = 0x044e;
  24944. t["afii10097"] = 0x044f;
  24945. t["afii10098"] = 0x0491;
  24946. t["afii10099"] = 0x0452;
  24947. t["afii10100"] = 0x0453;
  24948. t["afii10101"] = 0x0454;
  24949. t["afii10102"] = 0x0455;
  24950. t["afii10103"] = 0x0456;
  24951. t["afii10104"] = 0x0457;
  24952. t["afii10105"] = 0x0458;
  24953. t["afii10106"] = 0x0459;
  24954. t["afii10107"] = 0x045a;
  24955. t["afii10108"] = 0x045b;
  24956. t["afii10109"] = 0x045c;
  24957. t["afii10110"] = 0x045e;
  24958. t["afii10145"] = 0x040f;
  24959. t["afii10146"] = 0x0462;
  24960. t["afii10147"] = 0x0472;
  24961. t["afii10148"] = 0x0474;
  24962. t["afii10192"] = 0xf6c6;
  24963. t["afii10193"] = 0x045f;
  24964. t["afii10194"] = 0x0463;
  24965. t["afii10195"] = 0x0473;
  24966. t["afii10196"] = 0x0475;
  24967. t["afii10831"] = 0xf6c7;
  24968. t["afii10832"] = 0xf6c8;
  24969. t["afii10846"] = 0x04d9;
  24970. t["afii299"] = 0x200e;
  24971. t["afii300"] = 0x200f;
  24972. t["afii301"] = 0x200d;
  24973. t["afii57381"] = 0x066a;
  24974. t["afii57388"] = 0x060c;
  24975. t["afii57392"] = 0x0660;
  24976. t["afii57393"] = 0x0661;
  24977. t["afii57394"] = 0x0662;
  24978. t["afii57395"] = 0x0663;
  24979. t["afii57396"] = 0x0664;
  24980. t["afii57397"] = 0x0665;
  24981. t["afii57398"] = 0x0666;
  24982. t["afii57399"] = 0x0667;
  24983. t["afii57400"] = 0x0668;
  24984. t["afii57401"] = 0x0669;
  24985. t["afii57403"] = 0x061b;
  24986. t["afii57407"] = 0x061f;
  24987. t["afii57409"] = 0x0621;
  24988. t["afii57410"] = 0x0622;
  24989. t["afii57411"] = 0x0623;
  24990. t["afii57412"] = 0x0624;
  24991. t["afii57413"] = 0x0625;
  24992. t["afii57414"] = 0x0626;
  24993. t["afii57415"] = 0x0627;
  24994. t["afii57416"] = 0x0628;
  24995. t["afii57417"] = 0x0629;
  24996. t["afii57418"] = 0x062a;
  24997. t["afii57419"] = 0x062b;
  24998. t["afii57420"] = 0x062c;
  24999. t["afii57421"] = 0x062d;
  25000. t["afii57422"] = 0x062e;
  25001. t["afii57423"] = 0x062f;
  25002. t["afii57424"] = 0x0630;
  25003. t["afii57425"] = 0x0631;
  25004. t["afii57426"] = 0x0632;
  25005. t["afii57427"] = 0x0633;
  25006. t["afii57428"] = 0x0634;
  25007. t["afii57429"] = 0x0635;
  25008. t["afii57430"] = 0x0636;
  25009. t["afii57431"] = 0x0637;
  25010. t["afii57432"] = 0x0638;
  25011. t["afii57433"] = 0x0639;
  25012. t["afii57434"] = 0x063a;
  25013. t["afii57440"] = 0x0640;
  25014. t["afii57441"] = 0x0641;
  25015. t["afii57442"] = 0x0642;
  25016. t["afii57443"] = 0x0643;
  25017. t["afii57444"] = 0x0644;
  25018. t["afii57445"] = 0x0645;
  25019. t["afii57446"] = 0x0646;
  25020. t["afii57448"] = 0x0648;
  25021. t["afii57449"] = 0x0649;
  25022. t["afii57450"] = 0x064a;
  25023. t["afii57451"] = 0x064b;
  25024. t["afii57452"] = 0x064c;
  25025. t["afii57453"] = 0x064d;
  25026. t["afii57454"] = 0x064e;
  25027. t["afii57455"] = 0x064f;
  25028. t["afii57456"] = 0x0650;
  25029. t["afii57457"] = 0x0651;
  25030. t["afii57458"] = 0x0652;
  25031. t["afii57470"] = 0x0647;
  25032. t["afii57505"] = 0x06a4;
  25033. t["afii57506"] = 0x067e;
  25034. t["afii57507"] = 0x0686;
  25035. t["afii57508"] = 0x0698;
  25036. t["afii57509"] = 0x06af;
  25037. t["afii57511"] = 0x0679;
  25038. t["afii57512"] = 0x0688;
  25039. t["afii57513"] = 0x0691;
  25040. t["afii57514"] = 0x06ba;
  25041. t["afii57519"] = 0x06d2;
  25042. t["afii57534"] = 0x06d5;
  25043. t["afii57636"] = 0x20aa;
  25044. t["afii57645"] = 0x05be;
  25045. t["afii57658"] = 0x05c3;
  25046. t["afii57664"] = 0x05d0;
  25047. t["afii57665"] = 0x05d1;
  25048. t["afii57666"] = 0x05d2;
  25049. t["afii57667"] = 0x05d3;
  25050. t["afii57668"] = 0x05d4;
  25051. t["afii57669"] = 0x05d5;
  25052. t["afii57670"] = 0x05d6;
  25053. t["afii57671"] = 0x05d7;
  25054. t["afii57672"] = 0x05d8;
  25055. t["afii57673"] = 0x05d9;
  25056. t["afii57674"] = 0x05da;
  25057. t["afii57675"] = 0x05db;
  25058. t["afii57676"] = 0x05dc;
  25059. t["afii57677"] = 0x05dd;
  25060. t["afii57678"] = 0x05de;
  25061. t["afii57679"] = 0x05df;
  25062. t["afii57680"] = 0x05e0;
  25063. t["afii57681"] = 0x05e1;
  25064. t["afii57682"] = 0x05e2;
  25065. t["afii57683"] = 0x05e3;
  25066. t["afii57684"] = 0x05e4;
  25067. t["afii57685"] = 0x05e5;
  25068. t["afii57686"] = 0x05e6;
  25069. t["afii57687"] = 0x05e7;
  25070. t["afii57688"] = 0x05e8;
  25071. t["afii57689"] = 0x05e9;
  25072. t["afii57690"] = 0x05ea;
  25073. t["afii57694"] = 0xfb2a;
  25074. t["afii57695"] = 0xfb2b;
  25075. t["afii57700"] = 0xfb4b;
  25076. t["afii57705"] = 0xfb1f;
  25077. t["afii57716"] = 0x05f0;
  25078. t["afii57717"] = 0x05f1;
  25079. t["afii57718"] = 0x05f2;
  25080. t["afii57723"] = 0xfb35;
  25081. t["afii57793"] = 0x05b4;
  25082. t["afii57794"] = 0x05b5;
  25083. t["afii57795"] = 0x05b6;
  25084. t["afii57796"] = 0x05bb;
  25085. t["afii57797"] = 0x05b8;
  25086. t["afii57798"] = 0x05b7;
  25087. t["afii57799"] = 0x05b0;
  25088. t["afii57800"] = 0x05b2;
  25089. t["afii57801"] = 0x05b1;
  25090. t["afii57802"] = 0x05b3;
  25091. t["afii57803"] = 0x05c2;
  25092. t["afii57804"] = 0x05c1;
  25093. t["afii57806"] = 0x05b9;
  25094. t["afii57807"] = 0x05bc;
  25095. t["afii57839"] = 0x05bd;
  25096. t["afii57841"] = 0x05bf;
  25097. t["afii57842"] = 0x05c0;
  25098. t["afii57929"] = 0x02bc;
  25099. t["afii61248"] = 0x2105;
  25100. t["afii61289"] = 0x2113;
  25101. t["afii61352"] = 0x2116;
  25102. t["afii61573"] = 0x202c;
  25103. t["afii61574"] = 0x202d;
  25104. t["afii61575"] = 0x202e;
  25105. t["afii61664"] = 0x200c;
  25106. t["afii63167"] = 0x066d;
  25107. t["afii64937"] = 0x02bd;
  25108. t["agrave"] = 0x00e0;
  25109. t["agujarati"] = 0x0a85;
  25110. t["agurmukhi"] = 0x0a05;
  25111. t["ahiragana"] = 0x3042;
  25112. t["ahookabove"] = 0x1ea3;
  25113. t["aibengali"] = 0x0990;
  25114. t["aibopomofo"] = 0x311e;
  25115. t["aideva"] = 0x0910;
  25116. t["aiecyrillic"] = 0x04d5;
  25117. t["aigujarati"] = 0x0a90;
  25118. t["aigurmukhi"] = 0x0a10;
  25119. t["aimatragurmukhi"] = 0x0a48;
  25120. t["ainarabic"] = 0x0639;
  25121. t["ainfinalarabic"] = 0xfeca;
  25122. t["aininitialarabic"] = 0xfecb;
  25123. t["ainmedialarabic"] = 0xfecc;
  25124. t["ainvertedbreve"] = 0x0203;
  25125. t["aivowelsignbengali"] = 0x09c8;
  25126. t["aivowelsigndeva"] = 0x0948;
  25127. t["aivowelsigngujarati"] = 0x0ac8;
  25128. t["akatakana"] = 0x30a2;
  25129. t["akatakanahalfwidth"] = 0xff71;
  25130. t["akorean"] = 0x314f;
  25131. t["alef"] = 0x05d0;
  25132. t["alefarabic"] = 0x0627;
  25133. t["alefdageshhebrew"] = 0xfb30;
  25134. t["aleffinalarabic"] = 0xfe8e;
  25135. t["alefhamzaabovearabic"] = 0x0623;
  25136. t["alefhamzaabovefinalarabic"] = 0xfe84;
  25137. t["alefhamzabelowarabic"] = 0x0625;
  25138. t["alefhamzabelowfinalarabic"] = 0xfe88;
  25139. t["alefhebrew"] = 0x05d0;
  25140. t["aleflamedhebrew"] = 0xfb4f;
  25141. t["alefmaddaabovearabic"] = 0x0622;
  25142. t["alefmaddaabovefinalarabic"] = 0xfe82;
  25143. t["alefmaksuraarabic"] = 0x0649;
  25144. t["alefmaksurafinalarabic"] = 0xfef0;
  25145. t["alefmaksurainitialarabic"] = 0xfef3;
  25146. t["alefmaksuramedialarabic"] = 0xfef4;
  25147. t["alefpatahhebrew"] = 0xfb2e;
  25148. t["alefqamatshebrew"] = 0xfb2f;
  25149. t["aleph"] = 0x2135;
  25150. t["allequal"] = 0x224c;
  25151. t["alpha"] = 0x03b1;
  25152. t["alphatonos"] = 0x03ac;
  25153. t["amacron"] = 0x0101;
  25154. t["amonospace"] = 0xff41;
  25155. t["ampersand"] = 0x0026;
  25156. t["ampersandmonospace"] = 0xff06;
  25157. t["ampersandsmall"] = 0xf726;
  25158. t["amsquare"] = 0x33c2;
  25159. t["anbopomofo"] = 0x3122;
  25160. t["angbopomofo"] = 0x3124;
  25161. t["angbracketleft"] = 0x3008;
  25162. t["angbracketright"] = 0x3009;
  25163. t["angkhankhuthai"] = 0x0e5a;
  25164. t["angle"] = 0x2220;
  25165. t["anglebracketleft"] = 0x3008;
  25166. t["anglebracketleftvertical"] = 0xfe3f;
  25167. t["anglebracketright"] = 0x3009;
  25168. t["anglebracketrightvertical"] = 0xfe40;
  25169. t["angleleft"] = 0x2329;
  25170. t["angleright"] = 0x232a;
  25171. t["angstrom"] = 0x212b;
  25172. t["anoteleia"] = 0x0387;
  25173. t["anudattadeva"] = 0x0952;
  25174. t["anusvarabengali"] = 0x0982;
  25175. t["anusvaradeva"] = 0x0902;
  25176. t["anusvaragujarati"] = 0x0a82;
  25177. t["aogonek"] = 0x0105;
  25178. t["apaatosquare"] = 0x3300;
  25179. t["aparen"] = 0x249c;
  25180. t["apostrophearmenian"] = 0x055a;
  25181. t["apostrophemod"] = 0x02bc;
  25182. t["apple"] = 0xf8ff;
  25183. t["approaches"] = 0x2250;
  25184. t["approxequal"] = 0x2248;
  25185. t["approxequalorimage"] = 0x2252;
  25186. t["approximatelyequal"] = 0x2245;
  25187. t["araeaekorean"] = 0x318e;
  25188. t["araeakorean"] = 0x318d;
  25189. t["arc"] = 0x2312;
  25190. t["arighthalfring"] = 0x1e9a;
  25191. t["aring"] = 0x00e5;
  25192. t["aringacute"] = 0x01fb;
  25193. t["aringbelow"] = 0x1e01;
  25194. t["arrowboth"] = 0x2194;
  25195. t["arrowdashdown"] = 0x21e3;
  25196. t["arrowdashleft"] = 0x21e0;
  25197. t["arrowdashright"] = 0x21e2;
  25198. t["arrowdashup"] = 0x21e1;
  25199. t["arrowdblboth"] = 0x21d4;
  25200. t["arrowdbldown"] = 0x21d3;
  25201. t["arrowdblleft"] = 0x21d0;
  25202. t["arrowdblright"] = 0x21d2;
  25203. t["arrowdblup"] = 0x21d1;
  25204. t["arrowdown"] = 0x2193;
  25205. t["arrowdownleft"] = 0x2199;
  25206. t["arrowdownright"] = 0x2198;
  25207. t["arrowdownwhite"] = 0x21e9;
  25208. t["arrowheaddownmod"] = 0x02c5;
  25209. t["arrowheadleftmod"] = 0x02c2;
  25210. t["arrowheadrightmod"] = 0x02c3;
  25211. t["arrowheadupmod"] = 0x02c4;
  25212. t["arrowhorizex"] = 0xf8e7;
  25213. t["arrowleft"] = 0x2190;
  25214. t["arrowleftdbl"] = 0x21d0;
  25215. t["arrowleftdblstroke"] = 0x21cd;
  25216. t["arrowleftoverright"] = 0x21c6;
  25217. t["arrowleftwhite"] = 0x21e6;
  25218. t["arrowright"] = 0x2192;
  25219. t["arrowrightdblstroke"] = 0x21cf;
  25220. t["arrowrightheavy"] = 0x279e;
  25221. t["arrowrightoverleft"] = 0x21c4;
  25222. t["arrowrightwhite"] = 0x21e8;
  25223. t["arrowtableft"] = 0x21e4;
  25224. t["arrowtabright"] = 0x21e5;
  25225. t["arrowup"] = 0x2191;
  25226. t["arrowupdn"] = 0x2195;
  25227. t["arrowupdnbse"] = 0x21a8;
  25228. t["arrowupdownbase"] = 0x21a8;
  25229. t["arrowupleft"] = 0x2196;
  25230. t["arrowupleftofdown"] = 0x21c5;
  25231. t["arrowupright"] = 0x2197;
  25232. t["arrowupwhite"] = 0x21e7;
  25233. t["arrowvertex"] = 0xf8e6;
  25234. t["asciicircum"] = 0x005e;
  25235. t["asciicircummonospace"] = 0xff3e;
  25236. t["asciitilde"] = 0x007e;
  25237. t["asciitildemonospace"] = 0xff5e;
  25238. t["ascript"] = 0x0251;
  25239. t["ascriptturned"] = 0x0252;
  25240. t["asmallhiragana"] = 0x3041;
  25241. t["asmallkatakana"] = 0x30a1;
  25242. t["asmallkatakanahalfwidth"] = 0xff67;
  25243. t["asterisk"] = 0x002a;
  25244. t["asteriskaltonearabic"] = 0x066d;
  25245. t["asteriskarabic"] = 0x066d;
  25246. t["asteriskmath"] = 0x2217;
  25247. t["asteriskmonospace"] = 0xff0a;
  25248. t["asterisksmall"] = 0xfe61;
  25249. t["asterism"] = 0x2042;
  25250. t["asuperior"] = 0xf6e9;
  25251. t["asymptoticallyequal"] = 0x2243;
  25252. t["at"] = 0x0040;
  25253. t["atilde"] = 0x00e3;
  25254. t["atmonospace"] = 0xff20;
  25255. t["atsmall"] = 0xfe6b;
  25256. t["aturned"] = 0x0250;
  25257. t["aubengali"] = 0x0994;
  25258. t["aubopomofo"] = 0x3120;
  25259. t["audeva"] = 0x0914;
  25260. t["augujarati"] = 0x0a94;
  25261. t["augurmukhi"] = 0x0a14;
  25262. t["aulengthmarkbengali"] = 0x09d7;
  25263. t["aumatragurmukhi"] = 0x0a4c;
  25264. t["auvowelsignbengali"] = 0x09cc;
  25265. t["auvowelsigndeva"] = 0x094c;
  25266. t["auvowelsigngujarati"] = 0x0acc;
  25267. t["avagrahadeva"] = 0x093d;
  25268. t["aybarmenian"] = 0x0561;
  25269. t["ayin"] = 0x05e2;
  25270. t["ayinaltonehebrew"] = 0xfb20;
  25271. t["ayinhebrew"] = 0x05e2;
  25272. t["b"] = 0x0062;
  25273. t["babengali"] = 0x09ac;
  25274. t["backslash"] = 0x005c;
  25275. t["backslashmonospace"] = 0xff3c;
  25276. t["badeva"] = 0x092c;
  25277. t["bagujarati"] = 0x0aac;
  25278. t["bagurmukhi"] = 0x0a2c;
  25279. t["bahiragana"] = 0x3070;
  25280. t["bahtthai"] = 0x0e3f;
  25281. t["bakatakana"] = 0x30d0;
  25282. t["bar"] = 0x007c;
  25283. t["barmonospace"] = 0xff5c;
  25284. t["bbopomofo"] = 0x3105;
  25285. t["bcircle"] = 0x24d1;
  25286. t["bdotaccent"] = 0x1e03;
  25287. t["bdotbelow"] = 0x1e05;
  25288. t["beamedsixteenthnotes"] = 0x266c;
  25289. t["because"] = 0x2235;
  25290. t["becyrillic"] = 0x0431;
  25291. t["beharabic"] = 0x0628;
  25292. t["behfinalarabic"] = 0xfe90;
  25293. t["behinitialarabic"] = 0xfe91;
  25294. t["behiragana"] = 0x3079;
  25295. t["behmedialarabic"] = 0xfe92;
  25296. t["behmeeminitialarabic"] = 0xfc9f;
  25297. t["behmeemisolatedarabic"] = 0xfc08;
  25298. t["behnoonfinalarabic"] = 0xfc6d;
  25299. t["bekatakana"] = 0x30d9;
  25300. t["benarmenian"] = 0x0562;
  25301. t["bet"] = 0x05d1;
  25302. t["beta"] = 0x03b2;
  25303. t["betasymbolgreek"] = 0x03d0;
  25304. t["betdagesh"] = 0xfb31;
  25305. t["betdageshhebrew"] = 0xfb31;
  25306. t["bethebrew"] = 0x05d1;
  25307. t["betrafehebrew"] = 0xfb4c;
  25308. t["bhabengali"] = 0x09ad;
  25309. t["bhadeva"] = 0x092d;
  25310. t["bhagujarati"] = 0x0aad;
  25311. t["bhagurmukhi"] = 0x0a2d;
  25312. t["bhook"] = 0x0253;
  25313. t["bihiragana"] = 0x3073;
  25314. t["bikatakana"] = 0x30d3;
  25315. t["bilabialclick"] = 0x0298;
  25316. t["bindigurmukhi"] = 0x0a02;
  25317. t["birusquare"] = 0x3331;
  25318. t["blackcircle"] = 0x25cf;
  25319. t["blackdiamond"] = 0x25c6;
  25320. t["blackdownpointingtriangle"] = 0x25bc;
  25321. t["blackleftpointingpointer"] = 0x25c4;
  25322. t["blackleftpointingtriangle"] = 0x25c0;
  25323. t["blacklenticularbracketleft"] = 0x3010;
  25324. t["blacklenticularbracketleftvertical"] = 0xfe3b;
  25325. t["blacklenticularbracketright"] = 0x3011;
  25326. t["blacklenticularbracketrightvertical"] = 0xfe3c;
  25327. t["blacklowerlefttriangle"] = 0x25e3;
  25328. t["blacklowerrighttriangle"] = 0x25e2;
  25329. t["blackrectangle"] = 0x25ac;
  25330. t["blackrightpointingpointer"] = 0x25ba;
  25331. t["blackrightpointingtriangle"] = 0x25b6;
  25332. t["blacksmallsquare"] = 0x25aa;
  25333. t["blacksmilingface"] = 0x263b;
  25334. t["blacksquare"] = 0x25a0;
  25335. t["blackstar"] = 0x2605;
  25336. t["blackupperlefttriangle"] = 0x25e4;
  25337. t["blackupperrighttriangle"] = 0x25e5;
  25338. t["blackuppointingsmalltriangle"] = 0x25b4;
  25339. t["blackuppointingtriangle"] = 0x25b2;
  25340. t["blank"] = 0x2423;
  25341. t["blinebelow"] = 0x1e07;
  25342. t["block"] = 0x2588;
  25343. t["bmonospace"] = 0xff42;
  25344. t["bobaimaithai"] = 0x0e1a;
  25345. t["bohiragana"] = 0x307c;
  25346. t["bokatakana"] = 0x30dc;
  25347. t["bparen"] = 0x249d;
  25348. t["bqsquare"] = 0x33c3;
  25349. t["braceex"] = 0xf8f4;
  25350. t["braceleft"] = 0x007b;
  25351. t["braceleftbt"] = 0xf8f3;
  25352. t["braceleftmid"] = 0xf8f2;
  25353. t["braceleftmonospace"] = 0xff5b;
  25354. t["braceleftsmall"] = 0xfe5b;
  25355. t["bracelefttp"] = 0xf8f1;
  25356. t["braceleftvertical"] = 0xfe37;
  25357. t["braceright"] = 0x007d;
  25358. t["bracerightbt"] = 0xf8fe;
  25359. t["bracerightmid"] = 0xf8fd;
  25360. t["bracerightmonospace"] = 0xff5d;
  25361. t["bracerightsmall"] = 0xfe5c;
  25362. t["bracerighttp"] = 0xf8fc;
  25363. t["bracerightvertical"] = 0xfe38;
  25364. t["bracketleft"] = 0x005b;
  25365. t["bracketleftbt"] = 0xf8f0;
  25366. t["bracketleftex"] = 0xf8ef;
  25367. t["bracketleftmonospace"] = 0xff3b;
  25368. t["bracketlefttp"] = 0xf8ee;
  25369. t["bracketright"] = 0x005d;
  25370. t["bracketrightbt"] = 0xf8fb;
  25371. t["bracketrightex"] = 0xf8fa;
  25372. t["bracketrightmonospace"] = 0xff3d;
  25373. t["bracketrighttp"] = 0xf8f9;
  25374. t["breve"] = 0x02d8;
  25375. t["brevebelowcmb"] = 0x032e;
  25376. t["brevecmb"] = 0x0306;
  25377. t["breveinvertedbelowcmb"] = 0x032f;
  25378. t["breveinvertedcmb"] = 0x0311;
  25379. t["breveinverteddoublecmb"] = 0x0361;
  25380. t["bridgebelowcmb"] = 0x032a;
  25381. t["bridgeinvertedbelowcmb"] = 0x033a;
  25382. t["brokenbar"] = 0x00a6;
  25383. t["bstroke"] = 0x0180;
  25384. t["bsuperior"] = 0xf6ea;
  25385. t["btopbar"] = 0x0183;
  25386. t["buhiragana"] = 0x3076;
  25387. t["bukatakana"] = 0x30d6;
  25388. t["bullet"] = 0x2022;
  25389. t["bulletinverse"] = 0x25d8;
  25390. t["bulletoperator"] = 0x2219;
  25391. t["bullseye"] = 0x25ce;
  25392. t["c"] = 0x0063;
  25393. t["caarmenian"] = 0x056e;
  25394. t["cabengali"] = 0x099a;
  25395. t["cacute"] = 0x0107;
  25396. t["cadeva"] = 0x091a;
  25397. t["cagujarati"] = 0x0a9a;
  25398. t["cagurmukhi"] = 0x0a1a;
  25399. t["calsquare"] = 0x3388;
  25400. t["candrabindubengali"] = 0x0981;
  25401. t["candrabinducmb"] = 0x0310;
  25402. t["candrabindudeva"] = 0x0901;
  25403. t["candrabindugujarati"] = 0x0a81;
  25404. t["capslock"] = 0x21ea;
  25405. t["careof"] = 0x2105;
  25406. t["caron"] = 0x02c7;
  25407. t["caronbelowcmb"] = 0x032c;
  25408. t["caroncmb"] = 0x030c;
  25409. t["carriagereturn"] = 0x21b5;
  25410. t["cbopomofo"] = 0x3118;
  25411. t["ccaron"] = 0x010d;
  25412. t["ccedilla"] = 0x00e7;
  25413. t["ccedillaacute"] = 0x1e09;
  25414. t["ccircle"] = 0x24d2;
  25415. t["ccircumflex"] = 0x0109;
  25416. t["ccurl"] = 0x0255;
  25417. t["cdot"] = 0x010b;
  25418. t["cdotaccent"] = 0x010b;
  25419. t["cdsquare"] = 0x33c5;
  25420. t["cedilla"] = 0x00b8;
  25421. t["cedillacmb"] = 0x0327;
  25422. t["cent"] = 0x00a2;
  25423. t["centigrade"] = 0x2103;
  25424. t["centinferior"] = 0xf6df;
  25425. t["centmonospace"] = 0xffe0;
  25426. t["centoldstyle"] = 0xf7a2;
  25427. t["centsuperior"] = 0xf6e0;
  25428. t["chaarmenian"] = 0x0579;
  25429. t["chabengali"] = 0x099b;
  25430. t["chadeva"] = 0x091b;
  25431. t["chagujarati"] = 0x0a9b;
  25432. t["chagurmukhi"] = 0x0a1b;
  25433. t["chbopomofo"] = 0x3114;
  25434. t["cheabkhasiancyrillic"] = 0x04bd;
  25435. t["checkmark"] = 0x2713;
  25436. t["checyrillic"] = 0x0447;
  25437. t["chedescenderabkhasiancyrillic"] = 0x04bf;
  25438. t["chedescendercyrillic"] = 0x04b7;
  25439. t["chedieresiscyrillic"] = 0x04f5;
  25440. t["cheharmenian"] = 0x0573;
  25441. t["chekhakassiancyrillic"] = 0x04cc;
  25442. t["cheverticalstrokecyrillic"] = 0x04b9;
  25443. t["chi"] = 0x03c7;
  25444. t["chieuchacirclekorean"] = 0x3277;
  25445. t["chieuchaparenkorean"] = 0x3217;
  25446. t["chieuchcirclekorean"] = 0x3269;
  25447. t["chieuchkorean"] = 0x314a;
  25448. t["chieuchparenkorean"] = 0x3209;
  25449. t["chochangthai"] = 0x0e0a;
  25450. t["chochanthai"] = 0x0e08;
  25451. t["chochingthai"] = 0x0e09;
  25452. t["chochoethai"] = 0x0e0c;
  25453. t["chook"] = 0x0188;
  25454. t["cieucacirclekorean"] = 0x3276;
  25455. t["cieucaparenkorean"] = 0x3216;
  25456. t["cieuccirclekorean"] = 0x3268;
  25457. t["cieuckorean"] = 0x3148;
  25458. t["cieucparenkorean"] = 0x3208;
  25459. t["cieucuparenkorean"] = 0x321c;
  25460. t["circle"] = 0x25cb;
  25461. t["circlecopyrt"] = 0x00a9;
  25462. t["circlemultiply"] = 0x2297;
  25463. t["circleot"] = 0x2299;
  25464. t["circleplus"] = 0x2295;
  25465. t["circlepostalmark"] = 0x3036;
  25466. t["circlewithlefthalfblack"] = 0x25d0;
  25467. t["circlewithrighthalfblack"] = 0x25d1;
  25468. t["circumflex"] = 0x02c6;
  25469. t["circumflexbelowcmb"] = 0x032d;
  25470. t["circumflexcmb"] = 0x0302;
  25471. t["clear"] = 0x2327;
  25472. t["clickalveolar"] = 0x01c2;
  25473. t["clickdental"] = 0x01c0;
  25474. t["clicklateral"] = 0x01c1;
  25475. t["clickretroflex"] = 0x01c3;
  25476. t["club"] = 0x2663;
  25477. t["clubsuitblack"] = 0x2663;
  25478. t["clubsuitwhite"] = 0x2667;
  25479. t["cmcubedsquare"] = 0x33a4;
  25480. t["cmonospace"] = 0xff43;
  25481. t["cmsquaredsquare"] = 0x33a0;
  25482. t["coarmenian"] = 0x0581;
  25483. t["colon"] = 0x003a;
  25484. t["colonmonetary"] = 0x20a1;
  25485. t["colonmonospace"] = 0xff1a;
  25486. t["colonsign"] = 0x20a1;
  25487. t["colonsmall"] = 0xfe55;
  25488. t["colontriangularhalfmod"] = 0x02d1;
  25489. t["colontriangularmod"] = 0x02d0;
  25490. t["comma"] = 0x002c;
  25491. t["commaabovecmb"] = 0x0313;
  25492. t["commaaboverightcmb"] = 0x0315;
  25493. t["commaaccent"] = 0xf6c3;
  25494. t["commaarabic"] = 0x060c;
  25495. t["commaarmenian"] = 0x055d;
  25496. t["commainferior"] = 0xf6e1;
  25497. t["commamonospace"] = 0xff0c;
  25498. t["commareversedabovecmb"] = 0x0314;
  25499. t["commareversedmod"] = 0x02bd;
  25500. t["commasmall"] = 0xfe50;
  25501. t["commasuperior"] = 0xf6e2;
  25502. t["commaturnedabovecmb"] = 0x0312;
  25503. t["commaturnedmod"] = 0x02bb;
  25504. t["compass"] = 0x263c;
  25505. t["congruent"] = 0x2245;
  25506. t["contourintegral"] = 0x222e;
  25507. t["control"] = 0x2303;
  25508. t["controlACK"] = 0x0006;
  25509. t["controlBEL"] = 0x0007;
  25510. t["controlBS"] = 0x0008;
  25511. t["controlCAN"] = 0x0018;
  25512. t["controlCR"] = 0x000d;
  25513. t["controlDC1"] = 0x0011;
  25514. t["controlDC2"] = 0x0012;
  25515. t["controlDC3"] = 0x0013;
  25516. t["controlDC4"] = 0x0014;
  25517. t["controlDEL"] = 0x007f;
  25518. t["controlDLE"] = 0x0010;
  25519. t["controlEM"] = 0x0019;
  25520. t["controlENQ"] = 0x0005;
  25521. t["controlEOT"] = 0x0004;
  25522. t["controlESC"] = 0x001b;
  25523. t["controlETB"] = 0x0017;
  25524. t["controlETX"] = 0x0003;
  25525. t["controlFF"] = 0x000c;
  25526. t["controlFS"] = 0x001c;
  25527. t["controlGS"] = 0x001d;
  25528. t["controlHT"] = 0x0009;
  25529. t["controlLF"] = 0x000a;
  25530. t["controlNAK"] = 0x0015;
  25531. t["controlNULL"] = 0x0000;
  25532. t["controlRS"] = 0x001e;
  25533. t["controlSI"] = 0x000f;
  25534. t["controlSO"] = 0x000e;
  25535. t["controlSOT"] = 0x0002;
  25536. t["controlSTX"] = 0x0001;
  25537. t["controlSUB"] = 0x001a;
  25538. t["controlSYN"] = 0x0016;
  25539. t["controlUS"] = 0x001f;
  25540. t["controlVT"] = 0x000b;
  25541. t["copyright"] = 0x00a9;
  25542. t["copyrightsans"] = 0xf8e9;
  25543. t["copyrightserif"] = 0xf6d9;
  25544. t["cornerbracketleft"] = 0x300c;
  25545. t["cornerbracketlefthalfwidth"] = 0xff62;
  25546. t["cornerbracketleftvertical"] = 0xfe41;
  25547. t["cornerbracketright"] = 0x300d;
  25548. t["cornerbracketrighthalfwidth"] = 0xff63;
  25549. t["cornerbracketrightvertical"] = 0xfe42;
  25550. t["corporationsquare"] = 0x337f;
  25551. t["cosquare"] = 0x33c7;
  25552. t["coverkgsquare"] = 0x33c6;
  25553. t["cparen"] = 0x249e;
  25554. t["cruzeiro"] = 0x20a2;
  25555. t["cstretched"] = 0x0297;
  25556. t["curlyand"] = 0x22cf;
  25557. t["curlyor"] = 0x22ce;
  25558. t["currency"] = 0x00a4;
  25559. t["cyrBreve"] = 0xf6d1;
  25560. t["cyrFlex"] = 0xf6d2;
  25561. t["cyrbreve"] = 0xf6d4;
  25562. t["cyrflex"] = 0xf6d5;
  25563. t["d"] = 0x0064;
  25564. t["daarmenian"] = 0x0564;
  25565. t["dabengali"] = 0x09a6;
  25566. t["dadarabic"] = 0x0636;
  25567. t["dadeva"] = 0x0926;
  25568. t["dadfinalarabic"] = 0xfebe;
  25569. t["dadinitialarabic"] = 0xfebf;
  25570. t["dadmedialarabic"] = 0xfec0;
  25571. t["dagesh"] = 0x05bc;
  25572. t["dageshhebrew"] = 0x05bc;
  25573. t["dagger"] = 0x2020;
  25574. t["daggerdbl"] = 0x2021;
  25575. t["dagujarati"] = 0x0aa6;
  25576. t["dagurmukhi"] = 0x0a26;
  25577. t["dahiragana"] = 0x3060;
  25578. t["dakatakana"] = 0x30c0;
  25579. t["dalarabic"] = 0x062f;
  25580. t["dalet"] = 0x05d3;
  25581. t["daletdagesh"] = 0xfb33;
  25582. t["daletdageshhebrew"] = 0xfb33;
  25583. t["dalethebrew"] = 0x05d3;
  25584. t["dalfinalarabic"] = 0xfeaa;
  25585. t["dammaarabic"] = 0x064f;
  25586. t["dammalowarabic"] = 0x064f;
  25587. t["dammatanaltonearabic"] = 0x064c;
  25588. t["dammatanarabic"] = 0x064c;
  25589. t["danda"] = 0x0964;
  25590. t["dargahebrew"] = 0x05a7;
  25591. t["dargalefthebrew"] = 0x05a7;
  25592. t["dasiapneumatacyrilliccmb"] = 0x0485;
  25593. t["dblGrave"] = 0xf6d3;
  25594. t["dblanglebracketleft"] = 0x300a;
  25595. t["dblanglebracketleftvertical"] = 0xfe3d;
  25596. t["dblanglebracketright"] = 0x300b;
  25597. t["dblanglebracketrightvertical"] = 0xfe3e;
  25598. t["dblarchinvertedbelowcmb"] = 0x032b;
  25599. t["dblarrowleft"] = 0x21d4;
  25600. t["dblarrowright"] = 0x21d2;
  25601. t["dbldanda"] = 0x0965;
  25602. t["dblgrave"] = 0xf6d6;
  25603. t["dblgravecmb"] = 0x030f;
  25604. t["dblintegral"] = 0x222c;
  25605. t["dbllowline"] = 0x2017;
  25606. t["dbllowlinecmb"] = 0x0333;
  25607. t["dbloverlinecmb"] = 0x033f;
  25608. t["dblprimemod"] = 0x02ba;
  25609. t["dblverticalbar"] = 0x2016;
  25610. t["dblverticallineabovecmb"] = 0x030e;
  25611. t["dbopomofo"] = 0x3109;
  25612. t["dbsquare"] = 0x33c8;
  25613. t["dcaron"] = 0x010f;
  25614. t["dcedilla"] = 0x1e11;
  25615. t["dcircle"] = 0x24d3;
  25616. t["dcircumflexbelow"] = 0x1e13;
  25617. t["dcroat"] = 0x0111;
  25618. t["ddabengali"] = 0x09a1;
  25619. t["ddadeva"] = 0x0921;
  25620. t["ddagujarati"] = 0x0aa1;
  25621. t["ddagurmukhi"] = 0x0a21;
  25622. t["ddalarabic"] = 0x0688;
  25623. t["ddalfinalarabic"] = 0xfb89;
  25624. t["dddhadeva"] = 0x095c;
  25625. t["ddhabengali"] = 0x09a2;
  25626. t["ddhadeva"] = 0x0922;
  25627. t["ddhagujarati"] = 0x0aa2;
  25628. t["ddhagurmukhi"] = 0x0a22;
  25629. t["ddotaccent"] = 0x1e0b;
  25630. t["ddotbelow"] = 0x1e0d;
  25631. t["decimalseparatorarabic"] = 0x066b;
  25632. t["decimalseparatorpersian"] = 0x066b;
  25633. t["decyrillic"] = 0x0434;
  25634. t["degree"] = 0x00b0;
  25635. t["dehihebrew"] = 0x05ad;
  25636. t["dehiragana"] = 0x3067;
  25637. t["deicoptic"] = 0x03ef;
  25638. t["dekatakana"] = 0x30c7;
  25639. t["deleteleft"] = 0x232b;
  25640. t["deleteright"] = 0x2326;
  25641. t["delta"] = 0x03b4;
  25642. t["deltaturned"] = 0x018d;
  25643. t["denominatorminusonenumeratorbengali"] = 0x09f8;
  25644. t["dezh"] = 0x02a4;
  25645. t["dhabengali"] = 0x09a7;
  25646. t["dhadeva"] = 0x0927;
  25647. t["dhagujarati"] = 0x0aa7;
  25648. t["dhagurmukhi"] = 0x0a27;
  25649. t["dhook"] = 0x0257;
  25650. t["dialytikatonos"] = 0x0385;
  25651. t["dialytikatonoscmb"] = 0x0344;
  25652. t["diamond"] = 0x2666;
  25653. t["diamondsuitwhite"] = 0x2662;
  25654. t["dieresis"] = 0x00a8;
  25655. t["dieresisacute"] = 0xf6d7;
  25656. t["dieresisbelowcmb"] = 0x0324;
  25657. t["dieresiscmb"] = 0x0308;
  25658. t["dieresisgrave"] = 0xf6d8;
  25659. t["dieresistonos"] = 0x0385;
  25660. t["dihiragana"] = 0x3062;
  25661. t["dikatakana"] = 0x30c2;
  25662. t["dittomark"] = 0x3003;
  25663. t["divide"] = 0x00f7;
  25664. t["divides"] = 0x2223;
  25665. t["divisionslash"] = 0x2215;
  25666. t["djecyrillic"] = 0x0452;
  25667. t["dkshade"] = 0x2593;
  25668. t["dlinebelow"] = 0x1e0f;
  25669. t["dlsquare"] = 0x3397;
  25670. t["dmacron"] = 0x0111;
  25671. t["dmonospace"] = 0xff44;
  25672. t["dnblock"] = 0x2584;
  25673. t["dochadathai"] = 0x0e0e;
  25674. t["dodekthai"] = 0x0e14;
  25675. t["dohiragana"] = 0x3069;
  25676. t["dokatakana"] = 0x30c9;
  25677. t["dollar"] = 0x0024;
  25678. t["dollarinferior"] = 0xf6e3;
  25679. t["dollarmonospace"] = 0xff04;
  25680. t["dollaroldstyle"] = 0xf724;
  25681. t["dollarsmall"] = 0xfe69;
  25682. t["dollarsuperior"] = 0xf6e4;
  25683. t["dong"] = 0x20ab;
  25684. t["dorusquare"] = 0x3326;
  25685. t["dotaccent"] = 0x02d9;
  25686. t["dotaccentcmb"] = 0x0307;
  25687. t["dotbelowcmb"] = 0x0323;
  25688. t["dotbelowcomb"] = 0x0323;
  25689. t["dotkatakana"] = 0x30fb;
  25690. t["dotlessi"] = 0x0131;
  25691. t["dotlessj"] = 0xf6be;
  25692. t["dotlessjstrokehook"] = 0x0284;
  25693. t["dotmath"] = 0x22c5;
  25694. t["dottedcircle"] = 0x25cc;
  25695. t["doubleyodpatah"] = 0xfb1f;
  25696. t["doubleyodpatahhebrew"] = 0xfb1f;
  25697. t["downtackbelowcmb"] = 0x031e;
  25698. t["downtackmod"] = 0x02d5;
  25699. t["dparen"] = 0x249f;
  25700. t["dsuperior"] = 0xf6eb;
  25701. t["dtail"] = 0x0256;
  25702. t["dtopbar"] = 0x018c;
  25703. t["duhiragana"] = 0x3065;
  25704. t["dukatakana"] = 0x30c5;
  25705. t["dz"] = 0x01f3;
  25706. t["dzaltone"] = 0x02a3;
  25707. t["dzcaron"] = 0x01c6;
  25708. t["dzcurl"] = 0x02a5;
  25709. t["dzeabkhasiancyrillic"] = 0x04e1;
  25710. t["dzecyrillic"] = 0x0455;
  25711. t["dzhecyrillic"] = 0x045f;
  25712. t["e"] = 0x0065;
  25713. t["eacute"] = 0x00e9;
  25714. t["earth"] = 0x2641;
  25715. t["ebengali"] = 0x098f;
  25716. t["ebopomofo"] = 0x311c;
  25717. t["ebreve"] = 0x0115;
  25718. t["ecandradeva"] = 0x090d;
  25719. t["ecandragujarati"] = 0x0a8d;
  25720. t["ecandravowelsigndeva"] = 0x0945;
  25721. t["ecandravowelsigngujarati"] = 0x0ac5;
  25722. t["ecaron"] = 0x011b;
  25723. t["ecedillabreve"] = 0x1e1d;
  25724. t["echarmenian"] = 0x0565;
  25725. t["echyiwnarmenian"] = 0x0587;
  25726. t["ecircle"] = 0x24d4;
  25727. t["ecircumflex"] = 0x00ea;
  25728. t["ecircumflexacute"] = 0x1ebf;
  25729. t["ecircumflexbelow"] = 0x1e19;
  25730. t["ecircumflexdotbelow"] = 0x1ec7;
  25731. t["ecircumflexgrave"] = 0x1ec1;
  25732. t["ecircumflexhookabove"] = 0x1ec3;
  25733. t["ecircumflextilde"] = 0x1ec5;
  25734. t["ecyrillic"] = 0x0454;
  25735. t["edblgrave"] = 0x0205;
  25736. t["edeva"] = 0x090f;
  25737. t["edieresis"] = 0x00eb;
  25738. t["edot"] = 0x0117;
  25739. t["edotaccent"] = 0x0117;
  25740. t["edotbelow"] = 0x1eb9;
  25741. t["eegurmukhi"] = 0x0a0f;
  25742. t["eematragurmukhi"] = 0x0a47;
  25743. t["efcyrillic"] = 0x0444;
  25744. t["egrave"] = 0x00e8;
  25745. t["egujarati"] = 0x0a8f;
  25746. t["eharmenian"] = 0x0567;
  25747. t["ehbopomofo"] = 0x311d;
  25748. t["ehiragana"] = 0x3048;
  25749. t["ehookabove"] = 0x1ebb;
  25750. t["eibopomofo"] = 0x311f;
  25751. t["eight"] = 0x0038;
  25752. t["eightarabic"] = 0x0668;
  25753. t["eightbengali"] = 0x09ee;
  25754. t["eightcircle"] = 0x2467;
  25755. t["eightcircleinversesansserif"] = 0x2791;
  25756. t["eightdeva"] = 0x096e;
  25757. t["eighteencircle"] = 0x2471;
  25758. t["eighteenparen"] = 0x2485;
  25759. t["eighteenperiod"] = 0x2499;
  25760. t["eightgujarati"] = 0x0aee;
  25761. t["eightgurmukhi"] = 0x0a6e;
  25762. t["eighthackarabic"] = 0x0668;
  25763. t["eighthangzhou"] = 0x3028;
  25764. t["eighthnotebeamed"] = 0x266b;
  25765. t["eightideographicparen"] = 0x3227;
  25766. t["eightinferior"] = 0x2088;
  25767. t["eightmonospace"] = 0xff18;
  25768. t["eightoldstyle"] = 0xf738;
  25769. t["eightparen"] = 0x247b;
  25770. t["eightperiod"] = 0x248f;
  25771. t["eightpersian"] = 0x06f8;
  25772. t["eightroman"] = 0x2177;
  25773. t["eightsuperior"] = 0x2078;
  25774. t["eightthai"] = 0x0e58;
  25775. t["einvertedbreve"] = 0x0207;
  25776. t["eiotifiedcyrillic"] = 0x0465;
  25777. t["ekatakana"] = 0x30a8;
  25778. t["ekatakanahalfwidth"] = 0xff74;
  25779. t["ekonkargurmukhi"] = 0x0a74;
  25780. t["ekorean"] = 0x3154;
  25781. t["elcyrillic"] = 0x043b;
  25782. t["element"] = 0x2208;
  25783. t["elevencircle"] = 0x246a;
  25784. t["elevenparen"] = 0x247e;
  25785. t["elevenperiod"] = 0x2492;
  25786. t["elevenroman"] = 0x217a;
  25787. t["ellipsis"] = 0x2026;
  25788. t["ellipsisvertical"] = 0x22ee;
  25789. t["emacron"] = 0x0113;
  25790. t["emacronacute"] = 0x1e17;
  25791. t["emacrongrave"] = 0x1e15;
  25792. t["emcyrillic"] = 0x043c;
  25793. t["emdash"] = 0x2014;
  25794. t["emdashvertical"] = 0xfe31;
  25795. t["emonospace"] = 0xff45;
  25796. t["emphasismarkarmenian"] = 0x055b;
  25797. t["emptyset"] = 0x2205;
  25798. t["enbopomofo"] = 0x3123;
  25799. t["encyrillic"] = 0x043d;
  25800. t["endash"] = 0x2013;
  25801. t["endashvertical"] = 0xfe32;
  25802. t["endescendercyrillic"] = 0x04a3;
  25803. t["eng"] = 0x014b;
  25804. t["engbopomofo"] = 0x3125;
  25805. t["enghecyrillic"] = 0x04a5;
  25806. t["enhookcyrillic"] = 0x04c8;
  25807. t["enspace"] = 0x2002;
  25808. t["eogonek"] = 0x0119;
  25809. t["eokorean"] = 0x3153;
  25810. t["eopen"] = 0x025b;
  25811. t["eopenclosed"] = 0x029a;
  25812. t["eopenreversed"] = 0x025c;
  25813. t["eopenreversedclosed"] = 0x025e;
  25814. t["eopenreversedhook"] = 0x025d;
  25815. t["eparen"] = 0x24a0;
  25816. t["epsilon"] = 0x03b5;
  25817. t["epsilontonos"] = 0x03ad;
  25818. t["equal"] = 0x003d;
  25819. t["equalmonospace"] = 0xff1d;
  25820. t["equalsmall"] = 0xfe66;
  25821. t["equalsuperior"] = 0x207c;
  25822. t["equivalence"] = 0x2261;
  25823. t["erbopomofo"] = 0x3126;
  25824. t["ercyrillic"] = 0x0440;
  25825. t["ereversed"] = 0x0258;
  25826. t["ereversedcyrillic"] = 0x044d;
  25827. t["escyrillic"] = 0x0441;
  25828. t["esdescendercyrillic"] = 0x04ab;
  25829. t["esh"] = 0x0283;
  25830. t["eshcurl"] = 0x0286;
  25831. t["eshortdeva"] = 0x090e;
  25832. t["eshortvowelsigndeva"] = 0x0946;
  25833. t["eshreversedloop"] = 0x01aa;
  25834. t["eshsquatreversed"] = 0x0285;
  25835. t["esmallhiragana"] = 0x3047;
  25836. t["esmallkatakana"] = 0x30a7;
  25837. t["esmallkatakanahalfwidth"] = 0xff6a;
  25838. t["estimated"] = 0x212e;
  25839. t["esuperior"] = 0xf6ec;
  25840. t["eta"] = 0x03b7;
  25841. t["etarmenian"] = 0x0568;
  25842. t["etatonos"] = 0x03ae;
  25843. t["eth"] = 0x00f0;
  25844. t["etilde"] = 0x1ebd;
  25845. t["etildebelow"] = 0x1e1b;
  25846. t["etnahtafoukhhebrew"] = 0x0591;
  25847. t["etnahtafoukhlefthebrew"] = 0x0591;
  25848. t["etnahtahebrew"] = 0x0591;
  25849. t["etnahtalefthebrew"] = 0x0591;
  25850. t["eturned"] = 0x01dd;
  25851. t["eukorean"] = 0x3161;
  25852. t["euro"] = 0x20ac;
  25853. t["evowelsignbengali"] = 0x09c7;
  25854. t["evowelsigndeva"] = 0x0947;
  25855. t["evowelsigngujarati"] = 0x0ac7;
  25856. t["exclam"] = 0x0021;
  25857. t["exclamarmenian"] = 0x055c;
  25858. t["exclamdbl"] = 0x203c;
  25859. t["exclamdown"] = 0x00a1;
  25860. t["exclamdownsmall"] = 0xf7a1;
  25861. t["exclammonospace"] = 0xff01;
  25862. t["exclamsmall"] = 0xf721;
  25863. t["existential"] = 0x2203;
  25864. t["ezh"] = 0x0292;
  25865. t["ezhcaron"] = 0x01ef;
  25866. t["ezhcurl"] = 0x0293;
  25867. t["ezhreversed"] = 0x01b9;
  25868. t["ezhtail"] = 0x01ba;
  25869. t["f"] = 0x0066;
  25870. t["fadeva"] = 0x095e;
  25871. t["fagurmukhi"] = 0x0a5e;
  25872. t["fahrenheit"] = 0x2109;
  25873. t["fathaarabic"] = 0x064e;
  25874. t["fathalowarabic"] = 0x064e;
  25875. t["fathatanarabic"] = 0x064b;
  25876. t["fbopomofo"] = 0x3108;
  25877. t["fcircle"] = 0x24d5;
  25878. t["fdotaccent"] = 0x1e1f;
  25879. t["feharabic"] = 0x0641;
  25880. t["feharmenian"] = 0x0586;
  25881. t["fehfinalarabic"] = 0xfed2;
  25882. t["fehinitialarabic"] = 0xfed3;
  25883. t["fehmedialarabic"] = 0xfed4;
  25884. t["feicoptic"] = 0x03e5;
  25885. t["female"] = 0x2640;
  25886. t["ff"] = 0xfb00;
  25887. t["f_f"] = 0xfb00;
  25888. t["ffi"] = 0xfb03;
  25889. t["ffl"] = 0xfb04;
  25890. t["fi"] = 0xfb01;
  25891. t["fifteencircle"] = 0x246e;
  25892. t["fifteenparen"] = 0x2482;
  25893. t["fifteenperiod"] = 0x2496;
  25894. t["figuredash"] = 0x2012;
  25895. t["filledbox"] = 0x25a0;
  25896. t["filledrect"] = 0x25ac;
  25897. t["finalkaf"] = 0x05da;
  25898. t["finalkafdagesh"] = 0xfb3a;
  25899. t["finalkafdageshhebrew"] = 0xfb3a;
  25900. t["finalkafhebrew"] = 0x05da;
  25901. t["finalmem"] = 0x05dd;
  25902. t["finalmemhebrew"] = 0x05dd;
  25903. t["finalnun"] = 0x05df;
  25904. t["finalnunhebrew"] = 0x05df;
  25905. t["finalpe"] = 0x05e3;
  25906. t["finalpehebrew"] = 0x05e3;
  25907. t["finaltsadi"] = 0x05e5;
  25908. t["finaltsadihebrew"] = 0x05e5;
  25909. t["firsttonechinese"] = 0x02c9;
  25910. t["fisheye"] = 0x25c9;
  25911. t["fitacyrillic"] = 0x0473;
  25912. t["five"] = 0x0035;
  25913. t["fivearabic"] = 0x0665;
  25914. t["fivebengali"] = 0x09eb;
  25915. t["fivecircle"] = 0x2464;
  25916. t["fivecircleinversesansserif"] = 0x278e;
  25917. t["fivedeva"] = 0x096b;
  25918. t["fiveeighths"] = 0x215d;
  25919. t["fivegujarati"] = 0x0aeb;
  25920. t["fivegurmukhi"] = 0x0a6b;
  25921. t["fivehackarabic"] = 0x0665;
  25922. t["fivehangzhou"] = 0x3025;
  25923. t["fiveideographicparen"] = 0x3224;
  25924. t["fiveinferior"] = 0x2085;
  25925. t["fivemonospace"] = 0xff15;
  25926. t["fiveoldstyle"] = 0xf735;
  25927. t["fiveparen"] = 0x2478;
  25928. t["fiveperiod"] = 0x248c;
  25929. t["fivepersian"] = 0x06f5;
  25930. t["fiveroman"] = 0x2174;
  25931. t["fivesuperior"] = 0x2075;
  25932. t["fivethai"] = 0x0e55;
  25933. t["fl"] = 0xfb02;
  25934. t["florin"] = 0x0192;
  25935. t["fmonospace"] = 0xff46;
  25936. t["fmsquare"] = 0x3399;
  25937. t["fofanthai"] = 0x0e1f;
  25938. t["fofathai"] = 0x0e1d;
  25939. t["fongmanthai"] = 0x0e4f;
  25940. t["forall"] = 0x2200;
  25941. t["four"] = 0x0034;
  25942. t["fourarabic"] = 0x0664;
  25943. t["fourbengali"] = 0x09ea;
  25944. t["fourcircle"] = 0x2463;
  25945. t["fourcircleinversesansserif"] = 0x278d;
  25946. t["fourdeva"] = 0x096a;
  25947. t["fourgujarati"] = 0x0aea;
  25948. t["fourgurmukhi"] = 0x0a6a;
  25949. t["fourhackarabic"] = 0x0664;
  25950. t["fourhangzhou"] = 0x3024;
  25951. t["fourideographicparen"] = 0x3223;
  25952. t["fourinferior"] = 0x2084;
  25953. t["fourmonospace"] = 0xff14;
  25954. t["fournumeratorbengali"] = 0x09f7;
  25955. t["fouroldstyle"] = 0xf734;
  25956. t["fourparen"] = 0x2477;
  25957. t["fourperiod"] = 0x248b;
  25958. t["fourpersian"] = 0x06f4;
  25959. t["fourroman"] = 0x2173;
  25960. t["foursuperior"] = 0x2074;
  25961. t["fourteencircle"] = 0x246d;
  25962. t["fourteenparen"] = 0x2481;
  25963. t["fourteenperiod"] = 0x2495;
  25964. t["fourthai"] = 0x0e54;
  25965. t["fourthtonechinese"] = 0x02cb;
  25966. t["fparen"] = 0x24a1;
  25967. t["fraction"] = 0x2044;
  25968. t["franc"] = 0x20a3;
  25969. t["g"] = 0x0067;
  25970. t["gabengali"] = 0x0997;
  25971. t["gacute"] = 0x01f5;
  25972. t["gadeva"] = 0x0917;
  25973. t["gafarabic"] = 0x06af;
  25974. t["gaffinalarabic"] = 0xfb93;
  25975. t["gafinitialarabic"] = 0xfb94;
  25976. t["gafmedialarabic"] = 0xfb95;
  25977. t["gagujarati"] = 0x0a97;
  25978. t["gagurmukhi"] = 0x0a17;
  25979. t["gahiragana"] = 0x304c;
  25980. t["gakatakana"] = 0x30ac;
  25981. t["gamma"] = 0x03b3;
  25982. t["gammalatinsmall"] = 0x0263;
  25983. t["gammasuperior"] = 0x02e0;
  25984. t["gangiacoptic"] = 0x03eb;
  25985. t["gbopomofo"] = 0x310d;
  25986. t["gbreve"] = 0x011f;
  25987. t["gcaron"] = 0x01e7;
  25988. t["gcedilla"] = 0x0123;
  25989. t["gcircle"] = 0x24d6;
  25990. t["gcircumflex"] = 0x011d;
  25991. t["gcommaaccent"] = 0x0123;
  25992. t["gdot"] = 0x0121;
  25993. t["gdotaccent"] = 0x0121;
  25994. t["gecyrillic"] = 0x0433;
  25995. t["gehiragana"] = 0x3052;
  25996. t["gekatakana"] = 0x30b2;
  25997. t["geometricallyequal"] = 0x2251;
  25998. t["gereshaccenthebrew"] = 0x059c;
  25999. t["gereshhebrew"] = 0x05f3;
  26000. t["gereshmuqdamhebrew"] = 0x059d;
  26001. t["germandbls"] = 0x00df;
  26002. t["gershayimaccenthebrew"] = 0x059e;
  26003. t["gershayimhebrew"] = 0x05f4;
  26004. t["getamark"] = 0x3013;
  26005. t["ghabengali"] = 0x0998;
  26006. t["ghadarmenian"] = 0x0572;
  26007. t["ghadeva"] = 0x0918;
  26008. t["ghagujarati"] = 0x0a98;
  26009. t["ghagurmukhi"] = 0x0a18;
  26010. t["ghainarabic"] = 0x063a;
  26011. t["ghainfinalarabic"] = 0xfece;
  26012. t["ghaininitialarabic"] = 0xfecf;
  26013. t["ghainmedialarabic"] = 0xfed0;
  26014. t["ghemiddlehookcyrillic"] = 0x0495;
  26015. t["ghestrokecyrillic"] = 0x0493;
  26016. t["gheupturncyrillic"] = 0x0491;
  26017. t["ghhadeva"] = 0x095a;
  26018. t["ghhagurmukhi"] = 0x0a5a;
  26019. t["ghook"] = 0x0260;
  26020. t["ghzsquare"] = 0x3393;
  26021. t["gihiragana"] = 0x304e;
  26022. t["gikatakana"] = 0x30ae;
  26023. t["gimarmenian"] = 0x0563;
  26024. t["gimel"] = 0x05d2;
  26025. t["gimeldagesh"] = 0xfb32;
  26026. t["gimeldageshhebrew"] = 0xfb32;
  26027. t["gimelhebrew"] = 0x05d2;
  26028. t["gjecyrillic"] = 0x0453;
  26029. t["glottalinvertedstroke"] = 0x01be;
  26030. t["glottalstop"] = 0x0294;
  26031. t["glottalstopinverted"] = 0x0296;
  26032. t["glottalstopmod"] = 0x02c0;
  26033. t["glottalstopreversed"] = 0x0295;
  26034. t["glottalstopreversedmod"] = 0x02c1;
  26035. t["glottalstopreversedsuperior"] = 0x02e4;
  26036. t["glottalstopstroke"] = 0x02a1;
  26037. t["glottalstopstrokereversed"] = 0x02a2;
  26038. t["gmacron"] = 0x1e21;
  26039. t["gmonospace"] = 0xff47;
  26040. t["gohiragana"] = 0x3054;
  26041. t["gokatakana"] = 0x30b4;
  26042. t["gparen"] = 0x24a2;
  26043. t["gpasquare"] = 0x33ac;
  26044. t["gradient"] = 0x2207;
  26045. t["grave"] = 0x0060;
  26046. t["gravebelowcmb"] = 0x0316;
  26047. t["gravecmb"] = 0x0300;
  26048. t["gravecomb"] = 0x0300;
  26049. t["gravedeva"] = 0x0953;
  26050. t["gravelowmod"] = 0x02ce;
  26051. t["gravemonospace"] = 0xff40;
  26052. t["gravetonecmb"] = 0x0340;
  26053. t["greater"] = 0x003e;
  26054. t["greaterequal"] = 0x2265;
  26055. t["greaterequalorless"] = 0x22db;
  26056. t["greatermonospace"] = 0xff1e;
  26057. t["greaterorequivalent"] = 0x2273;
  26058. t["greaterorless"] = 0x2277;
  26059. t["greateroverequal"] = 0x2267;
  26060. t["greatersmall"] = 0xfe65;
  26061. t["gscript"] = 0x0261;
  26062. t["gstroke"] = 0x01e5;
  26063. t["guhiragana"] = 0x3050;
  26064. t["guillemotleft"] = 0x00ab;
  26065. t["guillemotright"] = 0x00bb;
  26066. t["guilsinglleft"] = 0x2039;
  26067. t["guilsinglright"] = 0x203a;
  26068. t["gukatakana"] = 0x30b0;
  26069. t["guramusquare"] = 0x3318;
  26070. t["gysquare"] = 0x33c9;
  26071. t["h"] = 0x0068;
  26072. t["haabkhasiancyrillic"] = 0x04a9;
  26073. t["haaltonearabic"] = 0x06c1;
  26074. t["habengali"] = 0x09b9;
  26075. t["hadescendercyrillic"] = 0x04b3;
  26076. t["hadeva"] = 0x0939;
  26077. t["hagujarati"] = 0x0ab9;
  26078. t["hagurmukhi"] = 0x0a39;
  26079. t["haharabic"] = 0x062d;
  26080. t["hahfinalarabic"] = 0xfea2;
  26081. t["hahinitialarabic"] = 0xfea3;
  26082. t["hahiragana"] = 0x306f;
  26083. t["hahmedialarabic"] = 0xfea4;
  26084. t["haitusquare"] = 0x332a;
  26085. t["hakatakana"] = 0x30cf;
  26086. t["hakatakanahalfwidth"] = 0xff8a;
  26087. t["halantgurmukhi"] = 0x0a4d;
  26088. t["hamzaarabic"] = 0x0621;
  26089. t["hamzalowarabic"] = 0x0621;
  26090. t["hangulfiller"] = 0x3164;
  26091. t["hardsigncyrillic"] = 0x044a;
  26092. t["harpoonleftbarbup"] = 0x21bc;
  26093. t["harpoonrightbarbup"] = 0x21c0;
  26094. t["hasquare"] = 0x33ca;
  26095. t["hatafpatah"] = 0x05b2;
  26096. t["hatafpatah16"] = 0x05b2;
  26097. t["hatafpatah23"] = 0x05b2;
  26098. t["hatafpatah2f"] = 0x05b2;
  26099. t["hatafpatahhebrew"] = 0x05b2;
  26100. t["hatafpatahnarrowhebrew"] = 0x05b2;
  26101. t["hatafpatahquarterhebrew"] = 0x05b2;
  26102. t["hatafpatahwidehebrew"] = 0x05b2;
  26103. t["hatafqamats"] = 0x05b3;
  26104. t["hatafqamats1b"] = 0x05b3;
  26105. t["hatafqamats28"] = 0x05b3;
  26106. t["hatafqamats34"] = 0x05b3;
  26107. t["hatafqamatshebrew"] = 0x05b3;
  26108. t["hatafqamatsnarrowhebrew"] = 0x05b3;
  26109. t["hatafqamatsquarterhebrew"] = 0x05b3;
  26110. t["hatafqamatswidehebrew"] = 0x05b3;
  26111. t["hatafsegol"] = 0x05b1;
  26112. t["hatafsegol17"] = 0x05b1;
  26113. t["hatafsegol24"] = 0x05b1;
  26114. t["hatafsegol30"] = 0x05b1;
  26115. t["hatafsegolhebrew"] = 0x05b1;
  26116. t["hatafsegolnarrowhebrew"] = 0x05b1;
  26117. t["hatafsegolquarterhebrew"] = 0x05b1;
  26118. t["hatafsegolwidehebrew"] = 0x05b1;
  26119. t["hbar"] = 0x0127;
  26120. t["hbopomofo"] = 0x310f;
  26121. t["hbrevebelow"] = 0x1e2b;
  26122. t["hcedilla"] = 0x1e29;
  26123. t["hcircle"] = 0x24d7;
  26124. t["hcircumflex"] = 0x0125;
  26125. t["hdieresis"] = 0x1e27;
  26126. t["hdotaccent"] = 0x1e23;
  26127. t["hdotbelow"] = 0x1e25;
  26128. t["he"] = 0x05d4;
  26129. t["heart"] = 0x2665;
  26130. t["heartsuitblack"] = 0x2665;
  26131. t["heartsuitwhite"] = 0x2661;
  26132. t["hedagesh"] = 0xfb34;
  26133. t["hedageshhebrew"] = 0xfb34;
  26134. t["hehaltonearabic"] = 0x06c1;
  26135. t["heharabic"] = 0x0647;
  26136. t["hehebrew"] = 0x05d4;
  26137. t["hehfinalaltonearabic"] = 0xfba7;
  26138. t["hehfinalalttwoarabic"] = 0xfeea;
  26139. t["hehfinalarabic"] = 0xfeea;
  26140. t["hehhamzaabovefinalarabic"] = 0xfba5;
  26141. t["hehhamzaaboveisolatedarabic"] = 0xfba4;
  26142. t["hehinitialaltonearabic"] = 0xfba8;
  26143. t["hehinitialarabic"] = 0xfeeb;
  26144. t["hehiragana"] = 0x3078;
  26145. t["hehmedialaltonearabic"] = 0xfba9;
  26146. t["hehmedialarabic"] = 0xfeec;
  26147. t["heiseierasquare"] = 0x337b;
  26148. t["hekatakana"] = 0x30d8;
  26149. t["hekatakanahalfwidth"] = 0xff8d;
  26150. t["hekutaarusquare"] = 0x3336;
  26151. t["henghook"] = 0x0267;
  26152. t["herutusquare"] = 0x3339;
  26153. t["het"] = 0x05d7;
  26154. t["hethebrew"] = 0x05d7;
  26155. t["hhook"] = 0x0266;
  26156. t["hhooksuperior"] = 0x02b1;
  26157. t["hieuhacirclekorean"] = 0x327b;
  26158. t["hieuhaparenkorean"] = 0x321b;
  26159. t["hieuhcirclekorean"] = 0x326d;
  26160. t["hieuhkorean"] = 0x314e;
  26161. t["hieuhparenkorean"] = 0x320d;
  26162. t["hihiragana"] = 0x3072;
  26163. t["hikatakana"] = 0x30d2;
  26164. t["hikatakanahalfwidth"] = 0xff8b;
  26165. t["hiriq"] = 0x05b4;
  26166. t["hiriq14"] = 0x05b4;
  26167. t["hiriq21"] = 0x05b4;
  26168. t["hiriq2d"] = 0x05b4;
  26169. t["hiriqhebrew"] = 0x05b4;
  26170. t["hiriqnarrowhebrew"] = 0x05b4;
  26171. t["hiriqquarterhebrew"] = 0x05b4;
  26172. t["hiriqwidehebrew"] = 0x05b4;
  26173. t["hlinebelow"] = 0x1e96;
  26174. t["hmonospace"] = 0xff48;
  26175. t["hoarmenian"] = 0x0570;
  26176. t["hohipthai"] = 0x0e2b;
  26177. t["hohiragana"] = 0x307b;
  26178. t["hokatakana"] = 0x30db;
  26179. t["hokatakanahalfwidth"] = 0xff8e;
  26180. t["holam"] = 0x05b9;
  26181. t["holam19"] = 0x05b9;
  26182. t["holam26"] = 0x05b9;
  26183. t["holam32"] = 0x05b9;
  26184. t["holamhebrew"] = 0x05b9;
  26185. t["holamnarrowhebrew"] = 0x05b9;
  26186. t["holamquarterhebrew"] = 0x05b9;
  26187. t["holamwidehebrew"] = 0x05b9;
  26188. t["honokhukthai"] = 0x0e2e;
  26189. t["hookabovecomb"] = 0x0309;
  26190. t["hookcmb"] = 0x0309;
  26191. t["hookpalatalizedbelowcmb"] = 0x0321;
  26192. t["hookretroflexbelowcmb"] = 0x0322;
  26193. t["hoonsquare"] = 0x3342;
  26194. t["horicoptic"] = 0x03e9;
  26195. t["horizontalbar"] = 0x2015;
  26196. t["horncmb"] = 0x031b;
  26197. t["hotsprings"] = 0x2668;
  26198. t["house"] = 0x2302;
  26199. t["hparen"] = 0x24a3;
  26200. t["hsuperior"] = 0x02b0;
  26201. t["hturned"] = 0x0265;
  26202. t["huhiragana"] = 0x3075;
  26203. t["huiitosquare"] = 0x3333;
  26204. t["hukatakana"] = 0x30d5;
  26205. t["hukatakanahalfwidth"] = 0xff8c;
  26206. t["hungarumlaut"] = 0x02dd;
  26207. t["hungarumlautcmb"] = 0x030b;
  26208. t["hv"] = 0x0195;
  26209. t["hyphen"] = 0x002d;
  26210. t["hypheninferior"] = 0xf6e5;
  26211. t["hyphenmonospace"] = 0xff0d;
  26212. t["hyphensmall"] = 0xfe63;
  26213. t["hyphensuperior"] = 0xf6e6;
  26214. t["hyphentwo"] = 0x2010;
  26215. t["i"] = 0x0069;
  26216. t["iacute"] = 0x00ed;
  26217. t["iacyrillic"] = 0x044f;
  26218. t["ibengali"] = 0x0987;
  26219. t["ibopomofo"] = 0x3127;
  26220. t["ibreve"] = 0x012d;
  26221. t["icaron"] = 0x01d0;
  26222. t["icircle"] = 0x24d8;
  26223. t["icircumflex"] = 0x00ee;
  26224. t["icyrillic"] = 0x0456;
  26225. t["idblgrave"] = 0x0209;
  26226. t["ideographearthcircle"] = 0x328f;
  26227. t["ideographfirecircle"] = 0x328b;
  26228. t["ideographicallianceparen"] = 0x323f;
  26229. t["ideographiccallparen"] = 0x323a;
  26230. t["ideographiccentrecircle"] = 0x32a5;
  26231. t["ideographicclose"] = 0x3006;
  26232. t["ideographiccomma"] = 0x3001;
  26233. t["ideographiccommaleft"] = 0xff64;
  26234. t["ideographiccongratulationparen"] = 0x3237;
  26235. t["ideographiccorrectcircle"] = 0x32a3;
  26236. t["ideographicearthparen"] = 0x322f;
  26237. t["ideographicenterpriseparen"] = 0x323d;
  26238. t["ideographicexcellentcircle"] = 0x329d;
  26239. t["ideographicfestivalparen"] = 0x3240;
  26240. t["ideographicfinancialcircle"] = 0x3296;
  26241. t["ideographicfinancialparen"] = 0x3236;
  26242. t["ideographicfireparen"] = 0x322b;
  26243. t["ideographichaveparen"] = 0x3232;
  26244. t["ideographichighcircle"] = 0x32a4;
  26245. t["ideographiciterationmark"] = 0x3005;
  26246. t["ideographiclaborcircle"] = 0x3298;
  26247. t["ideographiclaborparen"] = 0x3238;
  26248. t["ideographicleftcircle"] = 0x32a7;
  26249. t["ideographiclowcircle"] = 0x32a6;
  26250. t["ideographicmedicinecircle"] = 0x32a9;
  26251. t["ideographicmetalparen"] = 0x322e;
  26252. t["ideographicmoonparen"] = 0x322a;
  26253. t["ideographicnameparen"] = 0x3234;
  26254. t["ideographicperiod"] = 0x3002;
  26255. t["ideographicprintcircle"] = 0x329e;
  26256. t["ideographicreachparen"] = 0x3243;
  26257. t["ideographicrepresentparen"] = 0x3239;
  26258. t["ideographicresourceparen"] = 0x323e;
  26259. t["ideographicrightcircle"] = 0x32a8;
  26260. t["ideographicsecretcircle"] = 0x3299;
  26261. t["ideographicselfparen"] = 0x3242;
  26262. t["ideographicsocietyparen"] = 0x3233;
  26263. t["ideographicspace"] = 0x3000;
  26264. t["ideographicspecialparen"] = 0x3235;
  26265. t["ideographicstockparen"] = 0x3231;
  26266. t["ideographicstudyparen"] = 0x323b;
  26267. t["ideographicsunparen"] = 0x3230;
  26268. t["ideographicsuperviseparen"] = 0x323c;
  26269. t["ideographicwaterparen"] = 0x322c;
  26270. t["ideographicwoodparen"] = 0x322d;
  26271. t["ideographiczero"] = 0x3007;
  26272. t["ideographmetalcircle"] = 0x328e;
  26273. t["ideographmooncircle"] = 0x328a;
  26274. t["ideographnamecircle"] = 0x3294;
  26275. t["ideographsuncircle"] = 0x3290;
  26276. t["ideographwatercircle"] = 0x328c;
  26277. t["ideographwoodcircle"] = 0x328d;
  26278. t["ideva"] = 0x0907;
  26279. t["idieresis"] = 0x00ef;
  26280. t["idieresisacute"] = 0x1e2f;
  26281. t["idieresiscyrillic"] = 0x04e5;
  26282. t["idotbelow"] = 0x1ecb;
  26283. t["iebrevecyrillic"] = 0x04d7;
  26284. t["iecyrillic"] = 0x0435;
  26285. t["ieungacirclekorean"] = 0x3275;
  26286. t["ieungaparenkorean"] = 0x3215;
  26287. t["ieungcirclekorean"] = 0x3267;
  26288. t["ieungkorean"] = 0x3147;
  26289. t["ieungparenkorean"] = 0x3207;
  26290. t["igrave"] = 0x00ec;
  26291. t["igujarati"] = 0x0a87;
  26292. t["igurmukhi"] = 0x0a07;
  26293. t["ihiragana"] = 0x3044;
  26294. t["ihookabove"] = 0x1ec9;
  26295. t["iibengali"] = 0x0988;
  26296. t["iicyrillic"] = 0x0438;
  26297. t["iideva"] = 0x0908;
  26298. t["iigujarati"] = 0x0a88;
  26299. t["iigurmukhi"] = 0x0a08;
  26300. t["iimatragurmukhi"] = 0x0a40;
  26301. t["iinvertedbreve"] = 0x020b;
  26302. t["iishortcyrillic"] = 0x0439;
  26303. t["iivowelsignbengali"] = 0x09c0;
  26304. t["iivowelsigndeva"] = 0x0940;
  26305. t["iivowelsigngujarati"] = 0x0ac0;
  26306. t["ij"] = 0x0133;
  26307. t["ikatakana"] = 0x30a4;
  26308. t["ikatakanahalfwidth"] = 0xff72;
  26309. t["ikorean"] = 0x3163;
  26310. t["ilde"] = 0x02dc;
  26311. t["iluyhebrew"] = 0x05ac;
  26312. t["imacron"] = 0x012b;
  26313. t["imacroncyrillic"] = 0x04e3;
  26314. t["imageorapproximatelyequal"] = 0x2253;
  26315. t["imatragurmukhi"] = 0x0a3f;
  26316. t["imonospace"] = 0xff49;
  26317. t["increment"] = 0x2206;
  26318. t["infinity"] = 0x221e;
  26319. t["iniarmenian"] = 0x056b;
  26320. t["integral"] = 0x222b;
  26321. t["integralbottom"] = 0x2321;
  26322. t["integralbt"] = 0x2321;
  26323. t["integralex"] = 0xf8f5;
  26324. t["integraltop"] = 0x2320;
  26325. t["integraltp"] = 0x2320;
  26326. t["intersection"] = 0x2229;
  26327. t["intisquare"] = 0x3305;
  26328. t["invbullet"] = 0x25d8;
  26329. t["invcircle"] = 0x25d9;
  26330. t["invsmileface"] = 0x263b;
  26331. t["iocyrillic"] = 0x0451;
  26332. t["iogonek"] = 0x012f;
  26333. t["iota"] = 0x03b9;
  26334. t["iotadieresis"] = 0x03ca;
  26335. t["iotadieresistonos"] = 0x0390;
  26336. t["iotalatin"] = 0x0269;
  26337. t["iotatonos"] = 0x03af;
  26338. t["iparen"] = 0x24a4;
  26339. t["irigurmukhi"] = 0x0a72;
  26340. t["ismallhiragana"] = 0x3043;
  26341. t["ismallkatakana"] = 0x30a3;
  26342. t["ismallkatakanahalfwidth"] = 0xff68;
  26343. t["issharbengali"] = 0x09fa;
  26344. t["istroke"] = 0x0268;
  26345. t["isuperior"] = 0xf6ed;
  26346. t["iterationhiragana"] = 0x309d;
  26347. t["iterationkatakana"] = 0x30fd;
  26348. t["itilde"] = 0x0129;
  26349. t["itildebelow"] = 0x1e2d;
  26350. t["iubopomofo"] = 0x3129;
  26351. t["iucyrillic"] = 0x044e;
  26352. t["ivowelsignbengali"] = 0x09bf;
  26353. t["ivowelsigndeva"] = 0x093f;
  26354. t["ivowelsigngujarati"] = 0x0abf;
  26355. t["izhitsacyrillic"] = 0x0475;
  26356. t["izhitsadblgravecyrillic"] = 0x0477;
  26357. t["j"] = 0x006a;
  26358. t["jaarmenian"] = 0x0571;
  26359. t["jabengali"] = 0x099c;
  26360. t["jadeva"] = 0x091c;
  26361. t["jagujarati"] = 0x0a9c;
  26362. t["jagurmukhi"] = 0x0a1c;
  26363. t["jbopomofo"] = 0x3110;
  26364. t["jcaron"] = 0x01f0;
  26365. t["jcircle"] = 0x24d9;
  26366. t["jcircumflex"] = 0x0135;
  26367. t["jcrossedtail"] = 0x029d;
  26368. t["jdotlessstroke"] = 0x025f;
  26369. t["jecyrillic"] = 0x0458;
  26370. t["jeemarabic"] = 0x062c;
  26371. t["jeemfinalarabic"] = 0xfe9e;
  26372. t["jeeminitialarabic"] = 0xfe9f;
  26373. t["jeemmedialarabic"] = 0xfea0;
  26374. t["jeharabic"] = 0x0698;
  26375. t["jehfinalarabic"] = 0xfb8b;
  26376. t["jhabengali"] = 0x099d;
  26377. t["jhadeva"] = 0x091d;
  26378. t["jhagujarati"] = 0x0a9d;
  26379. t["jhagurmukhi"] = 0x0a1d;
  26380. t["jheharmenian"] = 0x057b;
  26381. t["jis"] = 0x3004;
  26382. t["jmonospace"] = 0xff4a;
  26383. t["jparen"] = 0x24a5;
  26384. t["jsuperior"] = 0x02b2;
  26385. t["k"] = 0x006b;
  26386. t["kabashkircyrillic"] = 0x04a1;
  26387. t["kabengali"] = 0x0995;
  26388. t["kacute"] = 0x1e31;
  26389. t["kacyrillic"] = 0x043a;
  26390. t["kadescendercyrillic"] = 0x049b;
  26391. t["kadeva"] = 0x0915;
  26392. t["kaf"] = 0x05db;
  26393. t["kafarabic"] = 0x0643;
  26394. t["kafdagesh"] = 0xfb3b;
  26395. t["kafdageshhebrew"] = 0xfb3b;
  26396. t["kaffinalarabic"] = 0xfeda;
  26397. t["kafhebrew"] = 0x05db;
  26398. t["kafinitialarabic"] = 0xfedb;
  26399. t["kafmedialarabic"] = 0xfedc;
  26400. t["kafrafehebrew"] = 0xfb4d;
  26401. t["kagujarati"] = 0x0a95;
  26402. t["kagurmukhi"] = 0x0a15;
  26403. t["kahiragana"] = 0x304b;
  26404. t["kahookcyrillic"] = 0x04c4;
  26405. t["kakatakana"] = 0x30ab;
  26406. t["kakatakanahalfwidth"] = 0xff76;
  26407. t["kappa"] = 0x03ba;
  26408. t["kappasymbolgreek"] = 0x03f0;
  26409. t["kapyeounmieumkorean"] = 0x3171;
  26410. t["kapyeounphieuphkorean"] = 0x3184;
  26411. t["kapyeounpieupkorean"] = 0x3178;
  26412. t["kapyeounssangpieupkorean"] = 0x3179;
  26413. t["karoriisquare"] = 0x330d;
  26414. t["kashidaautoarabic"] = 0x0640;
  26415. t["kashidaautonosidebearingarabic"] = 0x0640;
  26416. t["kasmallkatakana"] = 0x30f5;
  26417. t["kasquare"] = 0x3384;
  26418. t["kasraarabic"] = 0x0650;
  26419. t["kasratanarabic"] = 0x064d;
  26420. t["kastrokecyrillic"] = 0x049f;
  26421. t["katahiraprolongmarkhalfwidth"] = 0xff70;
  26422. t["kaverticalstrokecyrillic"] = 0x049d;
  26423. t["kbopomofo"] = 0x310e;
  26424. t["kcalsquare"] = 0x3389;
  26425. t["kcaron"] = 0x01e9;
  26426. t["kcedilla"] = 0x0137;
  26427. t["kcircle"] = 0x24da;
  26428. t["kcommaaccent"] = 0x0137;
  26429. t["kdotbelow"] = 0x1e33;
  26430. t["keharmenian"] = 0x0584;
  26431. t["kehiragana"] = 0x3051;
  26432. t["kekatakana"] = 0x30b1;
  26433. t["kekatakanahalfwidth"] = 0xff79;
  26434. t["kenarmenian"] = 0x056f;
  26435. t["kesmallkatakana"] = 0x30f6;
  26436. t["kgreenlandic"] = 0x0138;
  26437. t["khabengali"] = 0x0996;
  26438. t["khacyrillic"] = 0x0445;
  26439. t["khadeva"] = 0x0916;
  26440. t["khagujarati"] = 0x0a96;
  26441. t["khagurmukhi"] = 0x0a16;
  26442. t["khaharabic"] = 0x062e;
  26443. t["khahfinalarabic"] = 0xfea6;
  26444. t["khahinitialarabic"] = 0xfea7;
  26445. t["khahmedialarabic"] = 0xfea8;
  26446. t["kheicoptic"] = 0x03e7;
  26447. t["khhadeva"] = 0x0959;
  26448. t["khhagurmukhi"] = 0x0a59;
  26449. t["khieukhacirclekorean"] = 0x3278;
  26450. t["khieukhaparenkorean"] = 0x3218;
  26451. t["khieukhcirclekorean"] = 0x326a;
  26452. t["khieukhkorean"] = 0x314b;
  26453. t["khieukhparenkorean"] = 0x320a;
  26454. t["khokhaithai"] = 0x0e02;
  26455. t["khokhonthai"] = 0x0e05;
  26456. t["khokhuatthai"] = 0x0e03;
  26457. t["khokhwaithai"] = 0x0e04;
  26458. t["khomutthai"] = 0x0e5b;
  26459. t["khook"] = 0x0199;
  26460. t["khorakhangthai"] = 0x0e06;
  26461. t["khzsquare"] = 0x3391;
  26462. t["kihiragana"] = 0x304d;
  26463. t["kikatakana"] = 0x30ad;
  26464. t["kikatakanahalfwidth"] = 0xff77;
  26465. t["kiroguramusquare"] = 0x3315;
  26466. t["kiromeetorusquare"] = 0x3316;
  26467. t["kirosquare"] = 0x3314;
  26468. t["kiyeokacirclekorean"] = 0x326e;
  26469. t["kiyeokaparenkorean"] = 0x320e;
  26470. t["kiyeokcirclekorean"] = 0x3260;
  26471. t["kiyeokkorean"] = 0x3131;
  26472. t["kiyeokparenkorean"] = 0x3200;
  26473. t["kiyeoksioskorean"] = 0x3133;
  26474. t["kjecyrillic"] = 0x045c;
  26475. t["klinebelow"] = 0x1e35;
  26476. t["klsquare"] = 0x3398;
  26477. t["kmcubedsquare"] = 0x33a6;
  26478. t["kmonospace"] = 0xff4b;
  26479. t["kmsquaredsquare"] = 0x33a2;
  26480. t["kohiragana"] = 0x3053;
  26481. t["kohmsquare"] = 0x33c0;
  26482. t["kokaithai"] = 0x0e01;
  26483. t["kokatakana"] = 0x30b3;
  26484. t["kokatakanahalfwidth"] = 0xff7a;
  26485. t["kooposquare"] = 0x331e;
  26486. t["koppacyrillic"] = 0x0481;
  26487. t["koreanstandardsymbol"] = 0x327f;
  26488. t["koroniscmb"] = 0x0343;
  26489. t["kparen"] = 0x24a6;
  26490. t["kpasquare"] = 0x33aa;
  26491. t["ksicyrillic"] = 0x046f;
  26492. t["ktsquare"] = 0x33cf;
  26493. t["kturned"] = 0x029e;
  26494. t["kuhiragana"] = 0x304f;
  26495. t["kukatakana"] = 0x30af;
  26496. t["kukatakanahalfwidth"] = 0xff78;
  26497. t["kvsquare"] = 0x33b8;
  26498. t["kwsquare"] = 0x33be;
  26499. t["l"] = 0x006c;
  26500. t["labengali"] = 0x09b2;
  26501. t["lacute"] = 0x013a;
  26502. t["ladeva"] = 0x0932;
  26503. t["lagujarati"] = 0x0ab2;
  26504. t["lagurmukhi"] = 0x0a32;
  26505. t["lakkhangyaothai"] = 0x0e45;
  26506. t["lamaleffinalarabic"] = 0xfefc;
  26507. t["lamalefhamzaabovefinalarabic"] = 0xfef8;
  26508. t["lamalefhamzaaboveisolatedarabic"] = 0xfef7;
  26509. t["lamalefhamzabelowfinalarabic"] = 0xfefa;
  26510. t["lamalefhamzabelowisolatedarabic"] = 0xfef9;
  26511. t["lamalefisolatedarabic"] = 0xfefb;
  26512. t["lamalefmaddaabovefinalarabic"] = 0xfef6;
  26513. t["lamalefmaddaaboveisolatedarabic"] = 0xfef5;
  26514. t["lamarabic"] = 0x0644;
  26515. t["lambda"] = 0x03bb;
  26516. t["lambdastroke"] = 0x019b;
  26517. t["lamed"] = 0x05dc;
  26518. t["lameddagesh"] = 0xfb3c;
  26519. t["lameddageshhebrew"] = 0xfb3c;
  26520. t["lamedhebrew"] = 0x05dc;
  26521. t["lamfinalarabic"] = 0xfede;
  26522. t["lamhahinitialarabic"] = 0xfcca;
  26523. t["laminitialarabic"] = 0xfedf;
  26524. t["lamjeeminitialarabic"] = 0xfcc9;
  26525. t["lamkhahinitialarabic"] = 0xfccb;
  26526. t["lamlamhehisolatedarabic"] = 0xfdf2;
  26527. t["lammedialarabic"] = 0xfee0;
  26528. t["lammeemhahinitialarabic"] = 0xfd88;
  26529. t["lammeeminitialarabic"] = 0xfccc;
  26530. t["largecircle"] = 0x25ef;
  26531. t["lbar"] = 0x019a;
  26532. t["lbelt"] = 0x026c;
  26533. t["lbopomofo"] = 0x310c;
  26534. t["lcaron"] = 0x013e;
  26535. t["lcedilla"] = 0x013c;
  26536. t["lcircle"] = 0x24db;
  26537. t["lcircumflexbelow"] = 0x1e3d;
  26538. t["lcommaaccent"] = 0x013c;
  26539. t["ldot"] = 0x0140;
  26540. t["ldotaccent"] = 0x0140;
  26541. t["ldotbelow"] = 0x1e37;
  26542. t["ldotbelowmacron"] = 0x1e39;
  26543. t["leftangleabovecmb"] = 0x031a;
  26544. t["lefttackbelowcmb"] = 0x0318;
  26545. t["less"] = 0x003c;
  26546. t["lessequal"] = 0x2264;
  26547. t["lessequalorgreater"] = 0x22da;
  26548. t["lessmonospace"] = 0xff1c;
  26549. t["lessorequivalent"] = 0x2272;
  26550. t["lessorgreater"] = 0x2276;
  26551. t["lessoverequal"] = 0x2266;
  26552. t["lesssmall"] = 0xfe64;
  26553. t["lezh"] = 0x026e;
  26554. t["lfblock"] = 0x258c;
  26555. t["lhookretroflex"] = 0x026d;
  26556. t["lira"] = 0x20a4;
  26557. t["liwnarmenian"] = 0x056c;
  26558. t["lj"] = 0x01c9;
  26559. t["ljecyrillic"] = 0x0459;
  26560. t["ll"] = 0xf6c0;
  26561. t["lladeva"] = 0x0933;
  26562. t["llagujarati"] = 0x0ab3;
  26563. t["llinebelow"] = 0x1e3b;
  26564. t["llladeva"] = 0x0934;
  26565. t["llvocalicbengali"] = 0x09e1;
  26566. t["llvocalicdeva"] = 0x0961;
  26567. t["llvocalicvowelsignbengali"] = 0x09e3;
  26568. t["llvocalicvowelsigndeva"] = 0x0963;
  26569. t["lmiddletilde"] = 0x026b;
  26570. t["lmonospace"] = 0xff4c;
  26571. t["lmsquare"] = 0x33d0;
  26572. t["lochulathai"] = 0x0e2c;
  26573. t["logicaland"] = 0x2227;
  26574. t["logicalnot"] = 0x00ac;
  26575. t["logicalnotreversed"] = 0x2310;
  26576. t["logicalor"] = 0x2228;
  26577. t["lolingthai"] = 0x0e25;
  26578. t["longs"] = 0x017f;
  26579. t["lowlinecenterline"] = 0xfe4e;
  26580. t["lowlinecmb"] = 0x0332;
  26581. t["lowlinedashed"] = 0xfe4d;
  26582. t["lozenge"] = 0x25ca;
  26583. t["lparen"] = 0x24a7;
  26584. t["lslash"] = 0x0142;
  26585. t["lsquare"] = 0x2113;
  26586. t["lsuperior"] = 0xf6ee;
  26587. t["ltshade"] = 0x2591;
  26588. t["luthai"] = 0x0e26;
  26589. t["lvocalicbengali"] = 0x098c;
  26590. t["lvocalicdeva"] = 0x090c;
  26591. t["lvocalicvowelsignbengali"] = 0x09e2;
  26592. t["lvocalicvowelsigndeva"] = 0x0962;
  26593. t["lxsquare"] = 0x33d3;
  26594. t["m"] = 0x006d;
  26595. t["mabengali"] = 0x09ae;
  26596. t["macron"] = 0x00af;
  26597. t["macronbelowcmb"] = 0x0331;
  26598. t["macroncmb"] = 0x0304;
  26599. t["macronlowmod"] = 0x02cd;
  26600. t["macronmonospace"] = 0xffe3;
  26601. t["macute"] = 0x1e3f;
  26602. t["madeva"] = 0x092e;
  26603. t["magujarati"] = 0x0aae;
  26604. t["magurmukhi"] = 0x0a2e;
  26605. t["mahapakhhebrew"] = 0x05a4;
  26606. t["mahapakhlefthebrew"] = 0x05a4;
  26607. t["mahiragana"] = 0x307e;
  26608. t["maichattawalowleftthai"] = 0xf895;
  26609. t["maichattawalowrightthai"] = 0xf894;
  26610. t["maichattawathai"] = 0x0e4b;
  26611. t["maichattawaupperleftthai"] = 0xf893;
  26612. t["maieklowleftthai"] = 0xf88c;
  26613. t["maieklowrightthai"] = 0xf88b;
  26614. t["maiekthai"] = 0x0e48;
  26615. t["maiekupperleftthai"] = 0xf88a;
  26616. t["maihanakatleftthai"] = 0xf884;
  26617. t["maihanakatthai"] = 0x0e31;
  26618. t["maitaikhuleftthai"] = 0xf889;
  26619. t["maitaikhuthai"] = 0x0e47;
  26620. t["maitholowleftthai"] = 0xf88f;
  26621. t["maitholowrightthai"] = 0xf88e;
  26622. t["maithothai"] = 0x0e49;
  26623. t["maithoupperleftthai"] = 0xf88d;
  26624. t["maitrilowleftthai"] = 0xf892;
  26625. t["maitrilowrightthai"] = 0xf891;
  26626. t["maitrithai"] = 0x0e4a;
  26627. t["maitriupperleftthai"] = 0xf890;
  26628. t["maiyamokthai"] = 0x0e46;
  26629. t["makatakana"] = 0x30de;
  26630. t["makatakanahalfwidth"] = 0xff8f;
  26631. t["male"] = 0x2642;
  26632. t["mansyonsquare"] = 0x3347;
  26633. t["maqafhebrew"] = 0x05be;
  26634. t["mars"] = 0x2642;
  26635. t["masoracirclehebrew"] = 0x05af;
  26636. t["masquare"] = 0x3383;
  26637. t["mbopomofo"] = 0x3107;
  26638. t["mbsquare"] = 0x33d4;
  26639. t["mcircle"] = 0x24dc;
  26640. t["mcubedsquare"] = 0x33a5;
  26641. t["mdotaccent"] = 0x1e41;
  26642. t["mdotbelow"] = 0x1e43;
  26643. t["meemarabic"] = 0x0645;
  26644. t["meemfinalarabic"] = 0xfee2;
  26645. t["meeminitialarabic"] = 0xfee3;
  26646. t["meemmedialarabic"] = 0xfee4;
  26647. t["meemmeeminitialarabic"] = 0xfcd1;
  26648. t["meemmeemisolatedarabic"] = 0xfc48;
  26649. t["meetorusquare"] = 0x334d;
  26650. t["mehiragana"] = 0x3081;
  26651. t["meizierasquare"] = 0x337e;
  26652. t["mekatakana"] = 0x30e1;
  26653. t["mekatakanahalfwidth"] = 0xff92;
  26654. t["mem"] = 0x05de;
  26655. t["memdagesh"] = 0xfb3e;
  26656. t["memdageshhebrew"] = 0xfb3e;
  26657. t["memhebrew"] = 0x05de;
  26658. t["menarmenian"] = 0x0574;
  26659. t["merkhahebrew"] = 0x05a5;
  26660. t["merkhakefulahebrew"] = 0x05a6;
  26661. t["merkhakefulalefthebrew"] = 0x05a6;
  26662. t["merkhalefthebrew"] = 0x05a5;
  26663. t["mhook"] = 0x0271;
  26664. t["mhzsquare"] = 0x3392;
  26665. t["middledotkatakanahalfwidth"] = 0xff65;
  26666. t["middot"] = 0x00b7;
  26667. t["mieumacirclekorean"] = 0x3272;
  26668. t["mieumaparenkorean"] = 0x3212;
  26669. t["mieumcirclekorean"] = 0x3264;
  26670. t["mieumkorean"] = 0x3141;
  26671. t["mieumpansioskorean"] = 0x3170;
  26672. t["mieumparenkorean"] = 0x3204;
  26673. t["mieumpieupkorean"] = 0x316e;
  26674. t["mieumsioskorean"] = 0x316f;
  26675. t["mihiragana"] = 0x307f;
  26676. t["mikatakana"] = 0x30df;
  26677. t["mikatakanahalfwidth"] = 0xff90;
  26678. t["minus"] = 0x2212;
  26679. t["minusbelowcmb"] = 0x0320;
  26680. t["minuscircle"] = 0x2296;
  26681. t["minusmod"] = 0x02d7;
  26682. t["minusplus"] = 0x2213;
  26683. t["minute"] = 0x2032;
  26684. t["miribaarusquare"] = 0x334a;
  26685. t["mirisquare"] = 0x3349;
  26686. t["mlonglegturned"] = 0x0270;
  26687. t["mlsquare"] = 0x3396;
  26688. t["mmcubedsquare"] = 0x33a3;
  26689. t["mmonospace"] = 0xff4d;
  26690. t["mmsquaredsquare"] = 0x339f;
  26691. t["mohiragana"] = 0x3082;
  26692. t["mohmsquare"] = 0x33c1;
  26693. t["mokatakana"] = 0x30e2;
  26694. t["mokatakanahalfwidth"] = 0xff93;
  26695. t["molsquare"] = 0x33d6;
  26696. t["momathai"] = 0x0e21;
  26697. t["moverssquare"] = 0x33a7;
  26698. t["moverssquaredsquare"] = 0x33a8;
  26699. t["mparen"] = 0x24a8;
  26700. t["mpasquare"] = 0x33ab;
  26701. t["mssquare"] = 0x33b3;
  26702. t["msuperior"] = 0xf6ef;
  26703. t["mturned"] = 0x026f;
  26704. t["mu"] = 0x00b5;
  26705. t["mu1"] = 0x00b5;
  26706. t["muasquare"] = 0x3382;
  26707. t["muchgreater"] = 0x226b;
  26708. t["muchless"] = 0x226a;
  26709. t["mufsquare"] = 0x338c;
  26710. t["mugreek"] = 0x03bc;
  26711. t["mugsquare"] = 0x338d;
  26712. t["muhiragana"] = 0x3080;
  26713. t["mukatakana"] = 0x30e0;
  26714. t["mukatakanahalfwidth"] = 0xff91;
  26715. t["mulsquare"] = 0x3395;
  26716. t["multiply"] = 0x00d7;
  26717. t["mumsquare"] = 0x339b;
  26718. t["munahhebrew"] = 0x05a3;
  26719. t["munahlefthebrew"] = 0x05a3;
  26720. t["musicalnote"] = 0x266a;
  26721. t["musicalnotedbl"] = 0x266b;
  26722. t["musicflatsign"] = 0x266d;
  26723. t["musicsharpsign"] = 0x266f;
  26724. t["mussquare"] = 0x33b2;
  26725. t["muvsquare"] = 0x33b6;
  26726. t["muwsquare"] = 0x33bc;
  26727. t["mvmegasquare"] = 0x33b9;
  26728. t["mvsquare"] = 0x33b7;
  26729. t["mwmegasquare"] = 0x33bf;
  26730. t["mwsquare"] = 0x33bd;
  26731. t["n"] = 0x006e;
  26732. t["nabengali"] = 0x09a8;
  26733. t["nabla"] = 0x2207;
  26734. t["nacute"] = 0x0144;
  26735. t["nadeva"] = 0x0928;
  26736. t["nagujarati"] = 0x0aa8;
  26737. t["nagurmukhi"] = 0x0a28;
  26738. t["nahiragana"] = 0x306a;
  26739. t["nakatakana"] = 0x30ca;
  26740. t["nakatakanahalfwidth"] = 0xff85;
  26741. t["napostrophe"] = 0x0149;
  26742. t["nasquare"] = 0x3381;
  26743. t["nbopomofo"] = 0x310b;
  26744. t["nbspace"] = 0x00a0;
  26745. t["ncaron"] = 0x0148;
  26746. t["ncedilla"] = 0x0146;
  26747. t["ncircle"] = 0x24dd;
  26748. t["ncircumflexbelow"] = 0x1e4b;
  26749. t["ncommaaccent"] = 0x0146;
  26750. t["ndotaccent"] = 0x1e45;
  26751. t["ndotbelow"] = 0x1e47;
  26752. t["nehiragana"] = 0x306d;
  26753. t["nekatakana"] = 0x30cd;
  26754. t["nekatakanahalfwidth"] = 0xff88;
  26755. t["newsheqelsign"] = 0x20aa;
  26756. t["nfsquare"] = 0x338b;
  26757. t["ngabengali"] = 0x0999;
  26758. t["ngadeva"] = 0x0919;
  26759. t["ngagujarati"] = 0x0a99;
  26760. t["ngagurmukhi"] = 0x0a19;
  26761. t["ngonguthai"] = 0x0e07;
  26762. t["nhiragana"] = 0x3093;
  26763. t["nhookleft"] = 0x0272;
  26764. t["nhookretroflex"] = 0x0273;
  26765. t["nieunacirclekorean"] = 0x326f;
  26766. t["nieunaparenkorean"] = 0x320f;
  26767. t["nieuncieuckorean"] = 0x3135;
  26768. t["nieuncirclekorean"] = 0x3261;
  26769. t["nieunhieuhkorean"] = 0x3136;
  26770. t["nieunkorean"] = 0x3134;
  26771. t["nieunpansioskorean"] = 0x3168;
  26772. t["nieunparenkorean"] = 0x3201;
  26773. t["nieunsioskorean"] = 0x3167;
  26774. t["nieuntikeutkorean"] = 0x3166;
  26775. t["nihiragana"] = 0x306b;
  26776. t["nikatakana"] = 0x30cb;
  26777. t["nikatakanahalfwidth"] = 0xff86;
  26778. t["nikhahitleftthai"] = 0xf899;
  26779. t["nikhahitthai"] = 0x0e4d;
  26780. t["nine"] = 0x0039;
  26781. t["ninearabic"] = 0x0669;
  26782. t["ninebengali"] = 0x09ef;
  26783. t["ninecircle"] = 0x2468;
  26784. t["ninecircleinversesansserif"] = 0x2792;
  26785. t["ninedeva"] = 0x096f;
  26786. t["ninegujarati"] = 0x0aef;
  26787. t["ninegurmukhi"] = 0x0a6f;
  26788. t["ninehackarabic"] = 0x0669;
  26789. t["ninehangzhou"] = 0x3029;
  26790. t["nineideographicparen"] = 0x3228;
  26791. t["nineinferior"] = 0x2089;
  26792. t["ninemonospace"] = 0xff19;
  26793. t["nineoldstyle"] = 0xf739;
  26794. t["nineparen"] = 0x247c;
  26795. t["nineperiod"] = 0x2490;
  26796. t["ninepersian"] = 0x06f9;
  26797. t["nineroman"] = 0x2178;
  26798. t["ninesuperior"] = 0x2079;
  26799. t["nineteencircle"] = 0x2472;
  26800. t["nineteenparen"] = 0x2486;
  26801. t["nineteenperiod"] = 0x249a;
  26802. t["ninethai"] = 0x0e59;
  26803. t["nj"] = 0x01cc;
  26804. t["njecyrillic"] = 0x045a;
  26805. t["nkatakana"] = 0x30f3;
  26806. t["nkatakanahalfwidth"] = 0xff9d;
  26807. t["nlegrightlong"] = 0x019e;
  26808. t["nlinebelow"] = 0x1e49;
  26809. t["nmonospace"] = 0xff4e;
  26810. t["nmsquare"] = 0x339a;
  26811. t["nnabengali"] = 0x09a3;
  26812. t["nnadeva"] = 0x0923;
  26813. t["nnagujarati"] = 0x0aa3;
  26814. t["nnagurmukhi"] = 0x0a23;
  26815. t["nnnadeva"] = 0x0929;
  26816. t["nohiragana"] = 0x306e;
  26817. t["nokatakana"] = 0x30ce;
  26818. t["nokatakanahalfwidth"] = 0xff89;
  26819. t["nonbreakingspace"] = 0x00a0;
  26820. t["nonenthai"] = 0x0e13;
  26821. t["nonuthai"] = 0x0e19;
  26822. t["noonarabic"] = 0x0646;
  26823. t["noonfinalarabic"] = 0xfee6;
  26824. t["noonghunnaarabic"] = 0x06ba;
  26825. t["noonghunnafinalarabic"] = 0xfb9f;
  26826. t["nooninitialarabic"] = 0xfee7;
  26827. t["noonjeeminitialarabic"] = 0xfcd2;
  26828. t["noonjeemisolatedarabic"] = 0xfc4b;
  26829. t["noonmedialarabic"] = 0xfee8;
  26830. t["noonmeeminitialarabic"] = 0xfcd5;
  26831. t["noonmeemisolatedarabic"] = 0xfc4e;
  26832. t["noonnoonfinalarabic"] = 0xfc8d;
  26833. t["notcontains"] = 0x220c;
  26834. t["notelement"] = 0x2209;
  26835. t["notelementof"] = 0x2209;
  26836. t["notequal"] = 0x2260;
  26837. t["notgreater"] = 0x226f;
  26838. t["notgreaternorequal"] = 0x2271;
  26839. t["notgreaternorless"] = 0x2279;
  26840. t["notidentical"] = 0x2262;
  26841. t["notless"] = 0x226e;
  26842. t["notlessnorequal"] = 0x2270;
  26843. t["notparallel"] = 0x2226;
  26844. t["notprecedes"] = 0x2280;
  26845. t["notsubset"] = 0x2284;
  26846. t["notsucceeds"] = 0x2281;
  26847. t["notsuperset"] = 0x2285;
  26848. t["nowarmenian"] = 0x0576;
  26849. t["nparen"] = 0x24a9;
  26850. t["nssquare"] = 0x33b1;
  26851. t["nsuperior"] = 0x207f;
  26852. t["ntilde"] = 0x00f1;
  26853. t["nu"] = 0x03bd;
  26854. t["nuhiragana"] = 0x306c;
  26855. t["nukatakana"] = 0x30cc;
  26856. t["nukatakanahalfwidth"] = 0xff87;
  26857. t["nuktabengali"] = 0x09bc;
  26858. t["nuktadeva"] = 0x093c;
  26859. t["nuktagujarati"] = 0x0abc;
  26860. t["nuktagurmukhi"] = 0x0a3c;
  26861. t["numbersign"] = 0x0023;
  26862. t["numbersignmonospace"] = 0xff03;
  26863. t["numbersignsmall"] = 0xfe5f;
  26864. t["numeralsigngreek"] = 0x0374;
  26865. t["numeralsignlowergreek"] = 0x0375;
  26866. t["numero"] = 0x2116;
  26867. t["nun"] = 0x05e0;
  26868. t["nundagesh"] = 0xfb40;
  26869. t["nundageshhebrew"] = 0xfb40;
  26870. t["nunhebrew"] = 0x05e0;
  26871. t["nvsquare"] = 0x33b5;
  26872. t["nwsquare"] = 0x33bb;
  26873. t["nyabengali"] = 0x099e;
  26874. t["nyadeva"] = 0x091e;
  26875. t["nyagujarati"] = 0x0a9e;
  26876. t["nyagurmukhi"] = 0x0a1e;
  26877. t["o"] = 0x006f;
  26878. t["oacute"] = 0x00f3;
  26879. t["oangthai"] = 0x0e2d;
  26880. t["obarred"] = 0x0275;
  26881. t["obarredcyrillic"] = 0x04e9;
  26882. t["obarreddieresiscyrillic"] = 0x04eb;
  26883. t["obengali"] = 0x0993;
  26884. t["obopomofo"] = 0x311b;
  26885. t["obreve"] = 0x014f;
  26886. t["ocandradeva"] = 0x0911;
  26887. t["ocandragujarati"] = 0x0a91;
  26888. t["ocandravowelsigndeva"] = 0x0949;
  26889. t["ocandravowelsigngujarati"] = 0x0ac9;
  26890. t["ocaron"] = 0x01d2;
  26891. t["ocircle"] = 0x24de;
  26892. t["ocircumflex"] = 0x00f4;
  26893. t["ocircumflexacute"] = 0x1ed1;
  26894. t["ocircumflexdotbelow"] = 0x1ed9;
  26895. t["ocircumflexgrave"] = 0x1ed3;
  26896. t["ocircumflexhookabove"] = 0x1ed5;
  26897. t["ocircumflextilde"] = 0x1ed7;
  26898. t["ocyrillic"] = 0x043e;
  26899. t["odblacute"] = 0x0151;
  26900. t["odblgrave"] = 0x020d;
  26901. t["odeva"] = 0x0913;
  26902. t["odieresis"] = 0x00f6;
  26903. t["odieresiscyrillic"] = 0x04e7;
  26904. t["odotbelow"] = 0x1ecd;
  26905. t["oe"] = 0x0153;
  26906. t["oekorean"] = 0x315a;
  26907. t["ogonek"] = 0x02db;
  26908. t["ogonekcmb"] = 0x0328;
  26909. t["ograve"] = 0x00f2;
  26910. t["ogujarati"] = 0x0a93;
  26911. t["oharmenian"] = 0x0585;
  26912. t["ohiragana"] = 0x304a;
  26913. t["ohookabove"] = 0x1ecf;
  26914. t["ohorn"] = 0x01a1;
  26915. t["ohornacute"] = 0x1edb;
  26916. t["ohorndotbelow"] = 0x1ee3;
  26917. t["ohorngrave"] = 0x1edd;
  26918. t["ohornhookabove"] = 0x1edf;
  26919. t["ohorntilde"] = 0x1ee1;
  26920. t["ohungarumlaut"] = 0x0151;
  26921. t["oi"] = 0x01a3;
  26922. t["oinvertedbreve"] = 0x020f;
  26923. t["okatakana"] = 0x30aa;
  26924. t["okatakanahalfwidth"] = 0xff75;
  26925. t["okorean"] = 0x3157;
  26926. t["olehebrew"] = 0x05ab;
  26927. t["omacron"] = 0x014d;
  26928. t["omacronacute"] = 0x1e53;
  26929. t["omacrongrave"] = 0x1e51;
  26930. t["omdeva"] = 0x0950;
  26931. t["omega"] = 0x03c9;
  26932. t["omega1"] = 0x03d6;
  26933. t["omegacyrillic"] = 0x0461;
  26934. t["omegalatinclosed"] = 0x0277;
  26935. t["omegaroundcyrillic"] = 0x047b;
  26936. t["omegatitlocyrillic"] = 0x047d;
  26937. t["omegatonos"] = 0x03ce;
  26938. t["omgujarati"] = 0x0ad0;
  26939. t["omicron"] = 0x03bf;
  26940. t["omicrontonos"] = 0x03cc;
  26941. t["omonospace"] = 0xff4f;
  26942. t["one"] = 0x0031;
  26943. t["onearabic"] = 0x0661;
  26944. t["onebengali"] = 0x09e7;
  26945. t["onecircle"] = 0x2460;
  26946. t["onecircleinversesansserif"] = 0x278a;
  26947. t["onedeva"] = 0x0967;
  26948. t["onedotenleader"] = 0x2024;
  26949. t["oneeighth"] = 0x215b;
  26950. t["onefitted"] = 0xf6dc;
  26951. t["onegujarati"] = 0x0ae7;
  26952. t["onegurmukhi"] = 0x0a67;
  26953. t["onehackarabic"] = 0x0661;
  26954. t["onehalf"] = 0x00bd;
  26955. t["onehangzhou"] = 0x3021;
  26956. t["oneideographicparen"] = 0x3220;
  26957. t["oneinferior"] = 0x2081;
  26958. t["onemonospace"] = 0xff11;
  26959. t["onenumeratorbengali"] = 0x09f4;
  26960. t["oneoldstyle"] = 0xf731;
  26961. t["oneparen"] = 0x2474;
  26962. t["oneperiod"] = 0x2488;
  26963. t["onepersian"] = 0x06f1;
  26964. t["onequarter"] = 0x00bc;
  26965. t["oneroman"] = 0x2170;
  26966. t["onesuperior"] = 0x00b9;
  26967. t["onethai"] = 0x0e51;
  26968. t["onethird"] = 0x2153;
  26969. t["oogonek"] = 0x01eb;
  26970. t["oogonekmacron"] = 0x01ed;
  26971. t["oogurmukhi"] = 0x0a13;
  26972. t["oomatragurmukhi"] = 0x0a4b;
  26973. t["oopen"] = 0x0254;
  26974. t["oparen"] = 0x24aa;
  26975. t["openbullet"] = 0x25e6;
  26976. t["option"] = 0x2325;
  26977. t["ordfeminine"] = 0x00aa;
  26978. t["ordmasculine"] = 0x00ba;
  26979. t["orthogonal"] = 0x221f;
  26980. t["oshortdeva"] = 0x0912;
  26981. t["oshortvowelsigndeva"] = 0x094a;
  26982. t["oslash"] = 0x00f8;
  26983. t["oslashacute"] = 0x01ff;
  26984. t["osmallhiragana"] = 0x3049;
  26985. t["osmallkatakana"] = 0x30a9;
  26986. t["osmallkatakanahalfwidth"] = 0xff6b;
  26987. t["ostrokeacute"] = 0x01ff;
  26988. t["osuperior"] = 0xf6f0;
  26989. t["otcyrillic"] = 0x047f;
  26990. t["otilde"] = 0x00f5;
  26991. t["otildeacute"] = 0x1e4d;
  26992. t["otildedieresis"] = 0x1e4f;
  26993. t["oubopomofo"] = 0x3121;
  26994. t["overline"] = 0x203e;
  26995. t["overlinecenterline"] = 0xfe4a;
  26996. t["overlinecmb"] = 0x0305;
  26997. t["overlinedashed"] = 0xfe49;
  26998. t["overlinedblwavy"] = 0xfe4c;
  26999. t["overlinewavy"] = 0xfe4b;
  27000. t["overscore"] = 0x00af;
  27001. t["ovowelsignbengali"] = 0x09cb;
  27002. t["ovowelsigndeva"] = 0x094b;
  27003. t["ovowelsigngujarati"] = 0x0acb;
  27004. t["p"] = 0x0070;
  27005. t["paampssquare"] = 0x3380;
  27006. t["paasentosquare"] = 0x332b;
  27007. t["pabengali"] = 0x09aa;
  27008. t["pacute"] = 0x1e55;
  27009. t["padeva"] = 0x092a;
  27010. t["pagedown"] = 0x21df;
  27011. t["pageup"] = 0x21de;
  27012. t["pagujarati"] = 0x0aaa;
  27013. t["pagurmukhi"] = 0x0a2a;
  27014. t["pahiragana"] = 0x3071;
  27015. t["paiyannoithai"] = 0x0e2f;
  27016. t["pakatakana"] = 0x30d1;
  27017. t["palatalizationcyrilliccmb"] = 0x0484;
  27018. t["palochkacyrillic"] = 0x04c0;
  27019. t["pansioskorean"] = 0x317f;
  27020. t["paragraph"] = 0x00b6;
  27021. t["parallel"] = 0x2225;
  27022. t["parenleft"] = 0x0028;
  27023. t["parenleftaltonearabic"] = 0xfd3e;
  27024. t["parenleftbt"] = 0xf8ed;
  27025. t["parenleftex"] = 0xf8ec;
  27026. t["parenleftinferior"] = 0x208d;
  27027. t["parenleftmonospace"] = 0xff08;
  27028. t["parenleftsmall"] = 0xfe59;
  27029. t["parenleftsuperior"] = 0x207d;
  27030. t["parenlefttp"] = 0xf8eb;
  27031. t["parenleftvertical"] = 0xfe35;
  27032. t["parenright"] = 0x0029;
  27033. t["parenrightaltonearabic"] = 0xfd3f;
  27034. t["parenrightbt"] = 0xf8f8;
  27035. t["parenrightex"] = 0xf8f7;
  27036. t["parenrightinferior"] = 0x208e;
  27037. t["parenrightmonospace"] = 0xff09;
  27038. t["parenrightsmall"] = 0xfe5a;
  27039. t["parenrightsuperior"] = 0x207e;
  27040. t["parenrighttp"] = 0xf8f6;
  27041. t["parenrightvertical"] = 0xfe36;
  27042. t["partialdiff"] = 0x2202;
  27043. t["paseqhebrew"] = 0x05c0;
  27044. t["pashtahebrew"] = 0x0599;
  27045. t["pasquare"] = 0x33a9;
  27046. t["patah"] = 0x05b7;
  27047. t["patah11"] = 0x05b7;
  27048. t["patah1d"] = 0x05b7;
  27049. t["patah2a"] = 0x05b7;
  27050. t["patahhebrew"] = 0x05b7;
  27051. t["patahnarrowhebrew"] = 0x05b7;
  27052. t["patahquarterhebrew"] = 0x05b7;
  27053. t["patahwidehebrew"] = 0x05b7;
  27054. t["pazerhebrew"] = 0x05a1;
  27055. t["pbopomofo"] = 0x3106;
  27056. t["pcircle"] = 0x24df;
  27057. t["pdotaccent"] = 0x1e57;
  27058. t["pe"] = 0x05e4;
  27059. t["pecyrillic"] = 0x043f;
  27060. t["pedagesh"] = 0xfb44;
  27061. t["pedageshhebrew"] = 0xfb44;
  27062. t["peezisquare"] = 0x333b;
  27063. t["pefinaldageshhebrew"] = 0xfb43;
  27064. t["peharabic"] = 0x067e;
  27065. t["peharmenian"] = 0x057a;
  27066. t["pehebrew"] = 0x05e4;
  27067. t["pehfinalarabic"] = 0xfb57;
  27068. t["pehinitialarabic"] = 0xfb58;
  27069. t["pehiragana"] = 0x307a;
  27070. t["pehmedialarabic"] = 0xfb59;
  27071. t["pekatakana"] = 0x30da;
  27072. t["pemiddlehookcyrillic"] = 0x04a7;
  27073. t["perafehebrew"] = 0xfb4e;
  27074. t["percent"] = 0x0025;
  27075. t["percentarabic"] = 0x066a;
  27076. t["percentmonospace"] = 0xff05;
  27077. t["percentsmall"] = 0xfe6a;
  27078. t["period"] = 0x002e;
  27079. t["periodarmenian"] = 0x0589;
  27080. t["periodcentered"] = 0x00b7;
  27081. t["periodhalfwidth"] = 0xff61;
  27082. t["periodinferior"] = 0xf6e7;
  27083. t["periodmonospace"] = 0xff0e;
  27084. t["periodsmall"] = 0xfe52;
  27085. t["periodsuperior"] = 0xf6e8;
  27086. t["perispomenigreekcmb"] = 0x0342;
  27087. t["perpendicular"] = 0x22a5;
  27088. t["perthousand"] = 0x2030;
  27089. t["peseta"] = 0x20a7;
  27090. t["pfsquare"] = 0x338a;
  27091. t["phabengali"] = 0x09ab;
  27092. t["phadeva"] = 0x092b;
  27093. t["phagujarati"] = 0x0aab;
  27094. t["phagurmukhi"] = 0x0a2b;
  27095. t["phi"] = 0x03c6;
  27096. t["phi1"] = 0x03d5;
  27097. t["phieuphacirclekorean"] = 0x327a;
  27098. t["phieuphaparenkorean"] = 0x321a;
  27099. t["phieuphcirclekorean"] = 0x326c;
  27100. t["phieuphkorean"] = 0x314d;
  27101. t["phieuphparenkorean"] = 0x320c;
  27102. t["philatin"] = 0x0278;
  27103. t["phinthuthai"] = 0x0e3a;
  27104. t["phisymbolgreek"] = 0x03d5;
  27105. t["phook"] = 0x01a5;
  27106. t["phophanthai"] = 0x0e1e;
  27107. t["phophungthai"] = 0x0e1c;
  27108. t["phosamphaothai"] = 0x0e20;
  27109. t["pi"] = 0x03c0;
  27110. t["pieupacirclekorean"] = 0x3273;
  27111. t["pieupaparenkorean"] = 0x3213;
  27112. t["pieupcieuckorean"] = 0x3176;
  27113. t["pieupcirclekorean"] = 0x3265;
  27114. t["pieupkiyeokkorean"] = 0x3172;
  27115. t["pieupkorean"] = 0x3142;
  27116. t["pieupparenkorean"] = 0x3205;
  27117. t["pieupsioskiyeokkorean"] = 0x3174;
  27118. t["pieupsioskorean"] = 0x3144;
  27119. t["pieupsiostikeutkorean"] = 0x3175;
  27120. t["pieupthieuthkorean"] = 0x3177;
  27121. t["pieuptikeutkorean"] = 0x3173;
  27122. t["pihiragana"] = 0x3074;
  27123. t["pikatakana"] = 0x30d4;
  27124. t["pisymbolgreek"] = 0x03d6;
  27125. t["piwrarmenian"] = 0x0583;
  27126. t["plus"] = 0x002b;
  27127. t["plusbelowcmb"] = 0x031f;
  27128. t["pluscircle"] = 0x2295;
  27129. t["plusminus"] = 0x00b1;
  27130. t["plusmod"] = 0x02d6;
  27131. t["plusmonospace"] = 0xff0b;
  27132. t["plussmall"] = 0xfe62;
  27133. t["plussuperior"] = 0x207a;
  27134. t["pmonospace"] = 0xff50;
  27135. t["pmsquare"] = 0x33d8;
  27136. t["pohiragana"] = 0x307d;
  27137. t["pointingindexdownwhite"] = 0x261f;
  27138. t["pointingindexleftwhite"] = 0x261c;
  27139. t["pointingindexrightwhite"] = 0x261e;
  27140. t["pointingindexupwhite"] = 0x261d;
  27141. t["pokatakana"] = 0x30dd;
  27142. t["poplathai"] = 0x0e1b;
  27143. t["postalmark"] = 0x3012;
  27144. t["postalmarkface"] = 0x3020;
  27145. t["pparen"] = 0x24ab;
  27146. t["precedes"] = 0x227a;
  27147. t["prescription"] = 0x211e;
  27148. t["primemod"] = 0x02b9;
  27149. t["primereversed"] = 0x2035;
  27150. t["product"] = 0x220f;
  27151. t["projective"] = 0x2305;
  27152. t["prolongedkana"] = 0x30fc;
  27153. t["propellor"] = 0x2318;
  27154. t["propersubset"] = 0x2282;
  27155. t["propersuperset"] = 0x2283;
  27156. t["proportion"] = 0x2237;
  27157. t["proportional"] = 0x221d;
  27158. t["psi"] = 0x03c8;
  27159. t["psicyrillic"] = 0x0471;
  27160. t["psilipneumatacyrilliccmb"] = 0x0486;
  27161. t["pssquare"] = 0x33b0;
  27162. t["puhiragana"] = 0x3077;
  27163. t["pukatakana"] = 0x30d7;
  27164. t["pvsquare"] = 0x33b4;
  27165. t["pwsquare"] = 0x33ba;
  27166. t["q"] = 0x0071;
  27167. t["qadeva"] = 0x0958;
  27168. t["qadmahebrew"] = 0x05a8;
  27169. t["qafarabic"] = 0x0642;
  27170. t["qaffinalarabic"] = 0xfed6;
  27171. t["qafinitialarabic"] = 0xfed7;
  27172. t["qafmedialarabic"] = 0xfed8;
  27173. t["qamats"] = 0x05b8;
  27174. t["qamats10"] = 0x05b8;
  27175. t["qamats1a"] = 0x05b8;
  27176. t["qamats1c"] = 0x05b8;
  27177. t["qamats27"] = 0x05b8;
  27178. t["qamats29"] = 0x05b8;
  27179. t["qamats33"] = 0x05b8;
  27180. t["qamatsde"] = 0x05b8;
  27181. t["qamatshebrew"] = 0x05b8;
  27182. t["qamatsnarrowhebrew"] = 0x05b8;
  27183. t["qamatsqatanhebrew"] = 0x05b8;
  27184. t["qamatsqatannarrowhebrew"] = 0x05b8;
  27185. t["qamatsqatanquarterhebrew"] = 0x05b8;
  27186. t["qamatsqatanwidehebrew"] = 0x05b8;
  27187. t["qamatsquarterhebrew"] = 0x05b8;
  27188. t["qamatswidehebrew"] = 0x05b8;
  27189. t["qarneyparahebrew"] = 0x059f;
  27190. t["qbopomofo"] = 0x3111;
  27191. t["qcircle"] = 0x24e0;
  27192. t["qhook"] = 0x02a0;
  27193. t["qmonospace"] = 0xff51;
  27194. t["qof"] = 0x05e7;
  27195. t["qofdagesh"] = 0xfb47;
  27196. t["qofdageshhebrew"] = 0xfb47;
  27197. t["qofhebrew"] = 0x05e7;
  27198. t["qparen"] = 0x24ac;
  27199. t["quarternote"] = 0x2669;
  27200. t["qubuts"] = 0x05bb;
  27201. t["qubuts18"] = 0x05bb;
  27202. t["qubuts25"] = 0x05bb;
  27203. t["qubuts31"] = 0x05bb;
  27204. t["qubutshebrew"] = 0x05bb;
  27205. t["qubutsnarrowhebrew"] = 0x05bb;
  27206. t["qubutsquarterhebrew"] = 0x05bb;
  27207. t["qubutswidehebrew"] = 0x05bb;
  27208. t["question"] = 0x003f;
  27209. t["questionarabic"] = 0x061f;
  27210. t["questionarmenian"] = 0x055e;
  27211. t["questiondown"] = 0x00bf;
  27212. t["questiondownsmall"] = 0xf7bf;
  27213. t["questiongreek"] = 0x037e;
  27214. t["questionmonospace"] = 0xff1f;
  27215. t["questionsmall"] = 0xf73f;
  27216. t["quotedbl"] = 0x0022;
  27217. t["quotedblbase"] = 0x201e;
  27218. t["quotedblleft"] = 0x201c;
  27219. t["quotedblmonospace"] = 0xff02;
  27220. t["quotedblprime"] = 0x301e;
  27221. t["quotedblprimereversed"] = 0x301d;
  27222. t["quotedblright"] = 0x201d;
  27223. t["quoteleft"] = 0x2018;
  27224. t["quoteleftreversed"] = 0x201b;
  27225. t["quotereversed"] = 0x201b;
  27226. t["quoteright"] = 0x2019;
  27227. t["quoterightn"] = 0x0149;
  27228. t["quotesinglbase"] = 0x201a;
  27229. t["quotesingle"] = 0x0027;
  27230. t["quotesinglemonospace"] = 0xff07;
  27231. t["r"] = 0x0072;
  27232. t["raarmenian"] = 0x057c;
  27233. t["rabengali"] = 0x09b0;
  27234. t["racute"] = 0x0155;
  27235. t["radeva"] = 0x0930;
  27236. t["radical"] = 0x221a;
  27237. t["radicalex"] = 0xf8e5;
  27238. t["radoverssquare"] = 0x33ae;
  27239. t["radoverssquaredsquare"] = 0x33af;
  27240. t["radsquare"] = 0x33ad;
  27241. t["rafe"] = 0x05bf;
  27242. t["rafehebrew"] = 0x05bf;
  27243. t["ragujarati"] = 0x0ab0;
  27244. t["ragurmukhi"] = 0x0a30;
  27245. t["rahiragana"] = 0x3089;
  27246. t["rakatakana"] = 0x30e9;
  27247. t["rakatakanahalfwidth"] = 0xff97;
  27248. t["ralowerdiagonalbengali"] = 0x09f1;
  27249. t["ramiddlediagonalbengali"] = 0x09f0;
  27250. t["ramshorn"] = 0x0264;
  27251. t["ratio"] = 0x2236;
  27252. t["rbopomofo"] = 0x3116;
  27253. t["rcaron"] = 0x0159;
  27254. t["rcedilla"] = 0x0157;
  27255. t["rcircle"] = 0x24e1;
  27256. t["rcommaaccent"] = 0x0157;
  27257. t["rdblgrave"] = 0x0211;
  27258. t["rdotaccent"] = 0x1e59;
  27259. t["rdotbelow"] = 0x1e5b;
  27260. t["rdotbelowmacron"] = 0x1e5d;
  27261. t["referencemark"] = 0x203b;
  27262. t["reflexsubset"] = 0x2286;
  27263. t["reflexsuperset"] = 0x2287;
  27264. t["registered"] = 0x00ae;
  27265. t["registersans"] = 0xf8e8;
  27266. t["registerserif"] = 0xf6da;
  27267. t["reharabic"] = 0x0631;
  27268. t["reharmenian"] = 0x0580;
  27269. t["rehfinalarabic"] = 0xfeae;
  27270. t["rehiragana"] = 0x308c;
  27271. t["rekatakana"] = 0x30ec;
  27272. t["rekatakanahalfwidth"] = 0xff9a;
  27273. t["resh"] = 0x05e8;
  27274. t["reshdageshhebrew"] = 0xfb48;
  27275. t["reshhebrew"] = 0x05e8;
  27276. t["reversedtilde"] = 0x223d;
  27277. t["reviahebrew"] = 0x0597;
  27278. t["reviamugrashhebrew"] = 0x0597;
  27279. t["revlogicalnot"] = 0x2310;
  27280. t["rfishhook"] = 0x027e;
  27281. t["rfishhookreversed"] = 0x027f;
  27282. t["rhabengali"] = 0x09dd;
  27283. t["rhadeva"] = 0x095d;
  27284. t["rho"] = 0x03c1;
  27285. t["rhook"] = 0x027d;
  27286. t["rhookturned"] = 0x027b;
  27287. t["rhookturnedsuperior"] = 0x02b5;
  27288. t["rhosymbolgreek"] = 0x03f1;
  27289. t["rhotichookmod"] = 0x02de;
  27290. t["rieulacirclekorean"] = 0x3271;
  27291. t["rieulaparenkorean"] = 0x3211;
  27292. t["rieulcirclekorean"] = 0x3263;
  27293. t["rieulhieuhkorean"] = 0x3140;
  27294. t["rieulkiyeokkorean"] = 0x313a;
  27295. t["rieulkiyeoksioskorean"] = 0x3169;
  27296. t["rieulkorean"] = 0x3139;
  27297. t["rieulmieumkorean"] = 0x313b;
  27298. t["rieulpansioskorean"] = 0x316c;
  27299. t["rieulparenkorean"] = 0x3203;
  27300. t["rieulphieuphkorean"] = 0x313f;
  27301. t["rieulpieupkorean"] = 0x313c;
  27302. t["rieulpieupsioskorean"] = 0x316b;
  27303. t["rieulsioskorean"] = 0x313d;
  27304. t["rieulthieuthkorean"] = 0x313e;
  27305. t["rieultikeutkorean"] = 0x316a;
  27306. t["rieulyeorinhieuhkorean"] = 0x316d;
  27307. t["rightangle"] = 0x221f;
  27308. t["righttackbelowcmb"] = 0x0319;
  27309. t["righttriangle"] = 0x22bf;
  27310. t["rihiragana"] = 0x308a;
  27311. t["rikatakana"] = 0x30ea;
  27312. t["rikatakanahalfwidth"] = 0xff98;
  27313. t["ring"] = 0x02da;
  27314. t["ringbelowcmb"] = 0x0325;
  27315. t["ringcmb"] = 0x030a;
  27316. t["ringhalfleft"] = 0x02bf;
  27317. t["ringhalfleftarmenian"] = 0x0559;
  27318. t["ringhalfleftbelowcmb"] = 0x031c;
  27319. t["ringhalfleftcentered"] = 0x02d3;
  27320. t["ringhalfright"] = 0x02be;
  27321. t["ringhalfrightbelowcmb"] = 0x0339;
  27322. t["ringhalfrightcentered"] = 0x02d2;
  27323. t["rinvertedbreve"] = 0x0213;
  27324. t["rittorusquare"] = 0x3351;
  27325. t["rlinebelow"] = 0x1e5f;
  27326. t["rlongleg"] = 0x027c;
  27327. t["rlonglegturned"] = 0x027a;
  27328. t["rmonospace"] = 0xff52;
  27329. t["rohiragana"] = 0x308d;
  27330. t["rokatakana"] = 0x30ed;
  27331. t["rokatakanahalfwidth"] = 0xff9b;
  27332. t["roruathai"] = 0x0e23;
  27333. t["rparen"] = 0x24ad;
  27334. t["rrabengali"] = 0x09dc;
  27335. t["rradeva"] = 0x0931;
  27336. t["rragurmukhi"] = 0x0a5c;
  27337. t["rreharabic"] = 0x0691;
  27338. t["rrehfinalarabic"] = 0xfb8d;
  27339. t["rrvocalicbengali"] = 0x09e0;
  27340. t["rrvocalicdeva"] = 0x0960;
  27341. t["rrvocalicgujarati"] = 0x0ae0;
  27342. t["rrvocalicvowelsignbengali"] = 0x09c4;
  27343. t["rrvocalicvowelsigndeva"] = 0x0944;
  27344. t["rrvocalicvowelsigngujarati"] = 0x0ac4;
  27345. t["rsuperior"] = 0xf6f1;
  27346. t["rtblock"] = 0x2590;
  27347. t["rturned"] = 0x0279;
  27348. t["rturnedsuperior"] = 0x02b4;
  27349. t["ruhiragana"] = 0x308b;
  27350. t["rukatakana"] = 0x30eb;
  27351. t["rukatakanahalfwidth"] = 0xff99;
  27352. t["rupeemarkbengali"] = 0x09f2;
  27353. t["rupeesignbengali"] = 0x09f3;
  27354. t["rupiah"] = 0xf6dd;
  27355. t["ruthai"] = 0x0e24;
  27356. t["rvocalicbengali"] = 0x098b;
  27357. t["rvocalicdeva"] = 0x090b;
  27358. t["rvocalicgujarati"] = 0x0a8b;
  27359. t["rvocalicvowelsignbengali"] = 0x09c3;
  27360. t["rvocalicvowelsigndeva"] = 0x0943;
  27361. t["rvocalicvowelsigngujarati"] = 0x0ac3;
  27362. t["s"] = 0x0073;
  27363. t["sabengali"] = 0x09b8;
  27364. t["sacute"] = 0x015b;
  27365. t["sacutedotaccent"] = 0x1e65;
  27366. t["sadarabic"] = 0x0635;
  27367. t["sadeva"] = 0x0938;
  27368. t["sadfinalarabic"] = 0xfeba;
  27369. t["sadinitialarabic"] = 0xfebb;
  27370. t["sadmedialarabic"] = 0xfebc;
  27371. t["sagujarati"] = 0x0ab8;
  27372. t["sagurmukhi"] = 0x0a38;
  27373. t["sahiragana"] = 0x3055;
  27374. t["sakatakana"] = 0x30b5;
  27375. t["sakatakanahalfwidth"] = 0xff7b;
  27376. t["sallallahoualayhewasallamarabic"] = 0xfdfa;
  27377. t["samekh"] = 0x05e1;
  27378. t["samekhdagesh"] = 0xfb41;
  27379. t["samekhdageshhebrew"] = 0xfb41;
  27380. t["samekhhebrew"] = 0x05e1;
  27381. t["saraaathai"] = 0x0e32;
  27382. t["saraaethai"] = 0x0e41;
  27383. t["saraaimaimalaithai"] = 0x0e44;
  27384. t["saraaimaimuanthai"] = 0x0e43;
  27385. t["saraamthai"] = 0x0e33;
  27386. t["saraathai"] = 0x0e30;
  27387. t["saraethai"] = 0x0e40;
  27388. t["saraiileftthai"] = 0xf886;
  27389. t["saraiithai"] = 0x0e35;
  27390. t["saraileftthai"] = 0xf885;
  27391. t["saraithai"] = 0x0e34;
  27392. t["saraothai"] = 0x0e42;
  27393. t["saraueeleftthai"] = 0xf888;
  27394. t["saraueethai"] = 0x0e37;
  27395. t["saraueleftthai"] = 0xf887;
  27396. t["sarauethai"] = 0x0e36;
  27397. t["sarauthai"] = 0x0e38;
  27398. t["sarauuthai"] = 0x0e39;
  27399. t["sbopomofo"] = 0x3119;
  27400. t["scaron"] = 0x0161;
  27401. t["scarondotaccent"] = 0x1e67;
  27402. t["scedilla"] = 0x015f;
  27403. t["schwa"] = 0x0259;
  27404. t["schwacyrillic"] = 0x04d9;
  27405. t["schwadieresiscyrillic"] = 0x04db;
  27406. t["schwahook"] = 0x025a;
  27407. t["scircle"] = 0x24e2;
  27408. t["scircumflex"] = 0x015d;
  27409. t["scommaaccent"] = 0x0219;
  27410. t["sdotaccent"] = 0x1e61;
  27411. t["sdotbelow"] = 0x1e63;
  27412. t["sdotbelowdotaccent"] = 0x1e69;
  27413. t["seagullbelowcmb"] = 0x033c;
  27414. t["second"] = 0x2033;
  27415. t["secondtonechinese"] = 0x02ca;
  27416. t["section"] = 0x00a7;
  27417. t["seenarabic"] = 0x0633;
  27418. t["seenfinalarabic"] = 0xfeb2;
  27419. t["seeninitialarabic"] = 0xfeb3;
  27420. t["seenmedialarabic"] = 0xfeb4;
  27421. t["segol"] = 0x05b6;
  27422. t["segol13"] = 0x05b6;
  27423. t["segol1f"] = 0x05b6;
  27424. t["segol2c"] = 0x05b6;
  27425. t["segolhebrew"] = 0x05b6;
  27426. t["segolnarrowhebrew"] = 0x05b6;
  27427. t["segolquarterhebrew"] = 0x05b6;
  27428. t["segoltahebrew"] = 0x0592;
  27429. t["segolwidehebrew"] = 0x05b6;
  27430. t["seharmenian"] = 0x057d;
  27431. t["sehiragana"] = 0x305b;
  27432. t["sekatakana"] = 0x30bb;
  27433. t["sekatakanahalfwidth"] = 0xff7e;
  27434. t["semicolon"] = 0x003b;
  27435. t["semicolonarabic"] = 0x061b;
  27436. t["semicolonmonospace"] = 0xff1b;
  27437. t["semicolonsmall"] = 0xfe54;
  27438. t["semivoicedmarkkana"] = 0x309c;
  27439. t["semivoicedmarkkanahalfwidth"] = 0xff9f;
  27440. t["sentisquare"] = 0x3322;
  27441. t["sentosquare"] = 0x3323;
  27442. t["seven"] = 0x0037;
  27443. t["sevenarabic"] = 0x0667;
  27444. t["sevenbengali"] = 0x09ed;
  27445. t["sevencircle"] = 0x2466;
  27446. t["sevencircleinversesansserif"] = 0x2790;
  27447. t["sevendeva"] = 0x096d;
  27448. t["seveneighths"] = 0x215e;
  27449. t["sevengujarati"] = 0x0aed;
  27450. t["sevengurmukhi"] = 0x0a6d;
  27451. t["sevenhackarabic"] = 0x0667;
  27452. t["sevenhangzhou"] = 0x3027;
  27453. t["sevenideographicparen"] = 0x3226;
  27454. t["seveninferior"] = 0x2087;
  27455. t["sevenmonospace"] = 0xff17;
  27456. t["sevenoldstyle"] = 0xf737;
  27457. t["sevenparen"] = 0x247a;
  27458. t["sevenperiod"] = 0x248e;
  27459. t["sevenpersian"] = 0x06f7;
  27460. t["sevenroman"] = 0x2176;
  27461. t["sevensuperior"] = 0x2077;
  27462. t["seventeencircle"] = 0x2470;
  27463. t["seventeenparen"] = 0x2484;
  27464. t["seventeenperiod"] = 0x2498;
  27465. t["seventhai"] = 0x0e57;
  27466. t["sfthyphen"] = 0x00ad;
  27467. t["shaarmenian"] = 0x0577;
  27468. t["shabengali"] = 0x09b6;
  27469. t["shacyrillic"] = 0x0448;
  27470. t["shaddaarabic"] = 0x0651;
  27471. t["shaddadammaarabic"] = 0xfc61;
  27472. t["shaddadammatanarabic"] = 0xfc5e;
  27473. t["shaddafathaarabic"] = 0xfc60;
  27474. t["shaddakasraarabic"] = 0xfc62;
  27475. t["shaddakasratanarabic"] = 0xfc5f;
  27476. t["shade"] = 0x2592;
  27477. t["shadedark"] = 0x2593;
  27478. t["shadelight"] = 0x2591;
  27479. t["shademedium"] = 0x2592;
  27480. t["shadeva"] = 0x0936;
  27481. t["shagujarati"] = 0x0ab6;
  27482. t["shagurmukhi"] = 0x0a36;
  27483. t["shalshelethebrew"] = 0x0593;
  27484. t["shbopomofo"] = 0x3115;
  27485. t["shchacyrillic"] = 0x0449;
  27486. t["sheenarabic"] = 0x0634;
  27487. t["sheenfinalarabic"] = 0xfeb6;
  27488. t["sheeninitialarabic"] = 0xfeb7;
  27489. t["sheenmedialarabic"] = 0xfeb8;
  27490. t["sheicoptic"] = 0x03e3;
  27491. t["sheqel"] = 0x20aa;
  27492. t["sheqelhebrew"] = 0x20aa;
  27493. t["sheva"] = 0x05b0;
  27494. t["sheva115"] = 0x05b0;
  27495. t["sheva15"] = 0x05b0;
  27496. t["sheva22"] = 0x05b0;
  27497. t["sheva2e"] = 0x05b0;
  27498. t["shevahebrew"] = 0x05b0;
  27499. t["shevanarrowhebrew"] = 0x05b0;
  27500. t["shevaquarterhebrew"] = 0x05b0;
  27501. t["shevawidehebrew"] = 0x05b0;
  27502. t["shhacyrillic"] = 0x04bb;
  27503. t["shimacoptic"] = 0x03ed;
  27504. t["shin"] = 0x05e9;
  27505. t["shindagesh"] = 0xfb49;
  27506. t["shindageshhebrew"] = 0xfb49;
  27507. t["shindageshshindot"] = 0xfb2c;
  27508. t["shindageshshindothebrew"] = 0xfb2c;
  27509. t["shindageshsindot"] = 0xfb2d;
  27510. t["shindageshsindothebrew"] = 0xfb2d;
  27511. t["shindothebrew"] = 0x05c1;
  27512. t["shinhebrew"] = 0x05e9;
  27513. t["shinshindot"] = 0xfb2a;
  27514. t["shinshindothebrew"] = 0xfb2a;
  27515. t["shinsindot"] = 0xfb2b;
  27516. t["shinsindothebrew"] = 0xfb2b;
  27517. t["shook"] = 0x0282;
  27518. t["sigma"] = 0x03c3;
  27519. t["sigma1"] = 0x03c2;
  27520. t["sigmafinal"] = 0x03c2;
  27521. t["sigmalunatesymbolgreek"] = 0x03f2;
  27522. t["sihiragana"] = 0x3057;
  27523. t["sikatakana"] = 0x30b7;
  27524. t["sikatakanahalfwidth"] = 0xff7c;
  27525. t["siluqhebrew"] = 0x05bd;
  27526. t["siluqlefthebrew"] = 0x05bd;
  27527. t["similar"] = 0x223c;
  27528. t["sindothebrew"] = 0x05c2;
  27529. t["siosacirclekorean"] = 0x3274;
  27530. t["siosaparenkorean"] = 0x3214;
  27531. t["sioscieuckorean"] = 0x317e;
  27532. t["sioscirclekorean"] = 0x3266;
  27533. t["sioskiyeokkorean"] = 0x317a;
  27534. t["sioskorean"] = 0x3145;
  27535. t["siosnieunkorean"] = 0x317b;
  27536. t["siosparenkorean"] = 0x3206;
  27537. t["siospieupkorean"] = 0x317d;
  27538. t["siostikeutkorean"] = 0x317c;
  27539. t["six"] = 0x0036;
  27540. t["sixarabic"] = 0x0666;
  27541. t["sixbengali"] = 0x09ec;
  27542. t["sixcircle"] = 0x2465;
  27543. t["sixcircleinversesansserif"] = 0x278f;
  27544. t["sixdeva"] = 0x096c;
  27545. t["sixgujarati"] = 0x0aec;
  27546. t["sixgurmukhi"] = 0x0a6c;
  27547. t["sixhackarabic"] = 0x0666;
  27548. t["sixhangzhou"] = 0x3026;
  27549. t["sixideographicparen"] = 0x3225;
  27550. t["sixinferior"] = 0x2086;
  27551. t["sixmonospace"] = 0xff16;
  27552. t["sixoldstyle"] = 0xf736;
  27553. t["sixparen"] = 0x2479;
  27554. t["sixperiod"] = 0x248d;
  27555. t["sixpersian"] = 0x06f6;
  27556. t["sixroman"] = 0x2175;
  27557. t["sixsuperior"] = 0x2076;
  27558. t["sixteencircle"] = 0x246f;
  27559. t["sixteencurrencydenominatorbengali"] = 0x09f9;
  27560. t["sixteenparen"] = 0x2483;
  27561. t["sixteenperiod"] = 0x2497;
  27562. t["sixthai"] = 0x0e56;
  27563. t["slash"] = 0x002f;
  27564. t["slashmonospace"] = 0xff0f;
  27565. t["slong"] = 0x017f;
  27566. t["slongdotaccent"] = 0x1e9b;
  27567. t["smileface"] = 0x263a;
  27568. t["smonospace"] = 0xff53;
  27569. t["sofpasuqhebrew"] = 0x05c3;
  27570. t["softhyphen"] = 0x00ad;
  27571. t["softsigncyrillic"] = 0x044c;
  27572. t["sohiragana"] = 0x305d;
  27573. t["sokatakana"] = 0x30bd;
  27574. t["sokatakanahalfwidth"] = 0xff7f;
  27575. t["soliduslongoverlaycmb"] = 0x0338;
  27576. t["solidusshortoverlaycmb"] = 0x0337;
  27577. t["sorusithai"] = 0x0e29;
  27578. t["sosalathai"] = 0x0e28;
  27579. t["sosothai"] = 0x0e0b;
  27580. t["sosuathai"] = 0x0e2a;
  27581. t["space"] = 0x0020;
  27582. t["spacehackarabic"] = 0x0020;
  27583. t["spade"] = 0x2660;
  27584. t["spadesuitblack"] = 0x2660;
  27585. t["spadesuitwhite"] = 0x2664;
  27586. t["sparen"] = 0x24ae;
  27587. t["squarebelowcmb"] = 0x033b;
  27588. t["squarecc"] = 0x33c4;
  27589. t["squarecm"] = 0x339d;
  27590. t["squarediagonalcrosshatchfill"] = 0x25a9;
  27591. t["squarehorizontalfill"] = 0x25a4;
  27592. t["squarekg"] = 0x338f;
  27593. t["squarekm"] = 0x339e;
  27594. t["squarekmcapital"] = 0x33ce;
  27595. t["squareln"] = 0x33d1;
  27596. t["squarelog"] = 0x33d2;
  27597. t["squaremg"] = 0x338e;
  27598. t["squaremil"] = 0x33d5;
  27599. t["squaremm"] = 0x339c;
  27600. t["squaremsquared"] = 0x33a1;
  27601. t["squareorthogonalcrosshatchfill"] = 0x25a6;
  27602. t["squareupperlefttolowerrightfill"] = 0x25a7;
  27603. t["squareupperrighttolowerleftfill"] = 0x25a8;
  27604. t["squareverticalfill"] = 0x25a5;
  27605. t["squarewhitewithsmallblack"] = 0x25a3;
  27606. t["srsquare"] = 0x33db;
  27607. t["ssabengali"] = 0x09b7;
  27608. t["ssadeva"] = 0x0937;
  27609. t["ssagujarati"] = 0x0ab7;
  27610. t["ssangcieuckorean"] = 0x3149;
  27611. t["ssanghieuhkorean"] = 0x3185;
  27612. t["ssangieungkorean"] = 0x3180;
  27613. t["ssangkiyeokkorean"] = 0x3132;
  27614. t["ssangnieunkorean"] = 0x3165;
  27615. t["ssangpieupkorean"] = 0x3143;
  27616. t["ssangsioskorean"] = 0x3146;
  27617. t["ssangtikeutkorean"] = 0x3138;
  27618. t["ssuperior"] = 0xf6f2;
  27619. t["sterling"] = 0x00a3;
  27620. t["sterlingmonospace"] = 0xffe1;
  27621. t["strokelongoverlaycmb"] = 0x0336;
  27622. t["strokeshortoverlaycmb"] = 0x0335;
  27623. t["subset"] = 0x2282;
  27624. t["subsetnotequal"] = 0x228a;
  27625. t["subsetorequal"] = 0x2286;
  27626. t["succeeds"] = 0x227b;
  27627. t["suchthat"] = 0x220b;
  27628. t["suhiragana"] = 0x3059;
  27629. t["sukatakana"] = 0x30b9;
  27630. t["sukatakanahalfwidth"] = 0xff7d;
  27631. t["sukunarabic"] = 0x0652;
  27632. t["summation"] = 0x2211;
  27633. t["sun"] = 0x263c;
  27634. t["superset"] = 0x2283;
  27635. t["supersetnotequal"] = 0x228b;
  27636. t["supersetorequal"] = 0x2287;
  27637. t["svsquare"] = 0x33dc;
  27638. t["syouwaerasquare"] = 0x337c;
  27639. t["t"] = 0x0074;
  27640. t["tabengali"] = 0x09a4;
  27641. t["tackdown"] = 0x22a4;
  27642. t["tackleft"] = 0x22a3;
  27643. t["tadeva"] = 0x0924;
  27644. t["tagujarati"] = 0x0aa4;
  27645. t["tagurmukhi"] = 0x0a24;
  27646. t["taharabic"] = 0x0637;
  27647. t["tahfinalarabic"] = 0xfec2;
  27648. t["tahinitialarabic"] = 0xfec3;
  27649. t["tahiragana"] = 0x305f;
  27650. t["tahmedialarabic"] = 0xfec4;
  27651. t["taisyouerasquare"] = 0x337d;
  27652. t["takatakana"] = 0x30bf;
  27653. t["takatakanahalfwidth"] = 0xff80;
  27654. t["tatweelarabic"] = 0x0640;
  27655. t["tau"] = 0x03c4;
  27656. t["tav"] = 0x05ea;
  27657. t["tavdages"] = 0xfb4a;
  27658. t["tavdagesh"] = 0xfb4a;
  27659. t["tavdageshhebrew"] = 0xfb4a;
  27660. t["tavhebrew"] = 0x05ea;
  27661. t["tbar"] = 0x0167;
  27662. t["tbopomofo"] = 0x310a;
  27663. t["tcaron"] = 0x0165;
  27664. t["tccurl"] = 0x02a8;
  27665. t["tcedilla"] = 0x0163;
  27666. t["tcheharabic"] = 0x0686;
  27667. t["tchehfinalarabic"] = 0xfb7b;
  27668. t["tchehinitialarabic"] = 0xfb7c;
  27669. t["tchehmedialarabic"] = 0xfb7d;
  27670. t["tcircle"] = 0x24e3;
  27671. t["tcircumflexbelow"] = 0x1e71;
  27672. t["tcommaaccent"] = 0x0163;
  27673. t["tdieresis"] = 0x1e97;
  27674. t["tdotaccent"] = 0x1e6b;
  27675. t["tdotbelow"] = 0x1e6d;
  27676. t["tecyrillic"] = 0x0442;
  27677. t["tedescendercyrillic"] = 0x04ad;
  27678. t["teharabic"] = 0x062a;
  27679. t["tehfinalarabic"] = 0xfe96;
  27680. t["tehhahinitialarabic"] = 0xfca2;
  27681. t["tehhahisolatedarabic"] = 0xfc0c;
  27682. t["tehinitialarabic"] = 0xfe97;
  27683. t["tehiragana"] = 0x3066;
  27684. t["tehjeeminitialarabic"] = 0xfca1;
  27685. t["tehjeemisolatedarabic"] = 0xfc0b;
  27686. t["tehmarbutaarabic"] = 0x0629;
  27687. t["tehmarbutafinalarabic"] = 0xfe94;
  27688. t["tehmedialarabic"] = 0xfe98;
  27689. t["tehmeeminitialarabic"] = 0xfca4;
  27690. t["tehmeemisolatedarabic"] = 0xfc0e;
  27691. t["tehnoonfinalarabic"] = 0xfc73;
  27692. t["tekatakana"] = 0x30c6;
  27693. t["tekatakanahalfwidth"] = 0xff83;
  27694. t["telephone"] = 0x2121;
  27695. t["telephoneblack"] = 0x260e;
  27696. t["telishagedolahebrew"] = 0x05a0;
  27697. t["telishaqetanahebrew"] = 0x05a9;
  27698. t["tencircle"] = 0x2469;
  27699. t["tenideographicparen"] = 0x3229;
  27700. t["tenparen"] = 0x247d;
  27701. t["tenperiod"] = 0x2491;
  27702. t["tenroman"] = 0x2179;
  27703. t["tesh"] = 0x02a7;
  27704. t["tet"] = 0x05d8;
  27705. t["tetdagesh"] = 0xfb38;
  27706. t["tetdageshhebrew"] = 0xfb38;
  27707. t["tethebrew"] = 0x05d8;
  27708. t["tetsecyrillic"] = 0x04b5;
  27709. t["tevirhebrew"] = 0x059b;
  27710. t["tevirlefthebrew"] = 0x059b;
  27711. t["thabengali"] = 0x09a5;
  27712. t["thadeva"] = 0x0925;
  27713. t["thagujarati"] = 0x0aa5;
  27714. t["thagurmukhi"] = 0x0a25;
  27715. t["thalarabic"] = 0x0630;
  27716. t["thalfinalarabic"] = 0xfeac;
  27717. t["thanthakhatlowleftthai"] = 0xf898;
  27718. t["thanthakhatlowrightthai"] = 0xf897;
  27719. t["thanthakhatthai"] = 0x0e4c;
  27720. t["thanthakhatupperleftthai"] = 0xf896;
  27721. t["theharabic"] = 0x062b;
  27722. t["thehfinalarabic"] = 0xfe9a;
  27723. t["thehinitialarabic"] = 0xfe9b;
  27724. t["thehmedialarabic"] = 0xfe9c;
  27725. t["thereexists"] = 0x2203;
  27726. t["therefore"] = 0x2234;
  27727. t["theta"] = 0x03b8;
  27728. t["theta1"] = 0x03d1;
  27729. t["thetasymbolgreek"] = 0x03d1;
  27730. t["thieuthacirclekorean"] = 0x3279;
  27731. t["thieuthaparenkorean"] = 0x3219;
  27732. t["thieuthcirclekorean"] = 0x326b;
  27733. t["thieuthkorean"] = 0x314c;
  27734. t["thieuthparenkorean"] = 0x320b;
  27735. t["thirteencircle"] = 0x246c;
  27736. t["thirteenparen"] = 0x2480;
  27737. t["thirteenperiod"] = 0x2494;
  27738. t["thonangmonthothai"] = 0x0e11;
  27739. t["thook"] = 0x01ad;
  27740. t["thophuthaothai"] = 0x0e12;
  27741. t["thorn"] = 0x00fe;
  27742. t["thothahanthai"] = 0x0e17;
  27743. t["thothanthai"] = 0x0e10;
  27744. t["thothongthai"] = 0x0e18;
  27745. t["thothungthai"] = 0x0e16;
  27746. t["thousandcyrillic"] = 0x0482;
  27747. t["thousandsseparatorarabic"] = 0x066c;
  27748. t["thousandsseparatorpersian"] = 0x066c;
  27749. t["three"] = 0x0033;
  27750. t["threearabic"] = 0x0663;
  27751. t["threebengali"] = 0x09e9;
  27752. t["threecircle"] = 0x2462;
  27753. t["threecircleinversesansserif"] = 0x278c;
  27754. t["threedeva"] = 0x0969;
  27755. t["threeeighths"] = 0x215c;
  27756. t["threegujarati"] = 0x0ae9;
  27757. t["threegurmukhi"] = 0x0a69;
  27758. t["threehackarabic"] = 0x0663;
  27759. t["threehangzhou"] = 0x3023;
  27760. t["threeideographicparen"] = 0x3222;
  27761. t["threeinferior"] = 0x2083;
  27762. t["threemonospace"] = 0xff13;
  27763. t["threenumeratorbengali"] = 0x09f6;
  27764. t["threeoldstyle"] = 0xf733;
  27765. t["threeparen"] = 0x2476;
  27766. t["threeperiod"] = 0x248a;
  27767. t["threepersian"] = 0x06f3;
  27768. t["threequarters"] = 0x00be;
  27769. t["threequartersemdash"] = 0xf6de;
  27770. t["threeroman"] = 0x2172;
  27771. t["threesuperior"] = 0x00b3;
  27772. t["threethai"] = 0x0e53;
  27773. t["thzsquare"] = 0x3394;
  27774. t["tihiragana"] = 0x3061;
  27775. t["tikatakana"] = 0x30c1;
  27776. t["tikatakanahalfwidth"] = 0xff81;
  27777. t["tikeutacirclekorean"] = 0x3270;
  27778. t["tikeutaparenkorean"] = 0x3210;
  27779. t["tikeutcirclekorean"] = 0x3262;
  27780. t["tikeutkorean"] = 0x3137;
  27781. t["tikeutparenkorean"] = 0x3202;
  27782. t["tilde"] = 0x02dc;
  27783. t["tildebelowcmb"] = 0x0330;
  27784. t["tildecmb"] = 0x0303;
  27785. t["tildecomb"] = 0x0303;
  27786. t["tildedoublecmb"] = 0x0360;
  27787. t["tildeoperator"] = 0x223c;
  27788. t["tildeoverlaycmb"] = 0x0334;
  27789. t["tildeverticalcmb"] = 0x033e;
  27790. t["timescircle"] = 0x2297;
  27791. t["tipehahebrew"] = 0x0596;
  27792. t["tipehalefthebrew"] = 0x0596;
  27793. t["tippigurmukhi"] = 0x0a70;
  27794. t["titlocyrilliccmb"] = 0x0483;
  27795. t["tiwnarmenian"] = 0x057f;
  27796. t["tlinebelow"] = 0x1e6f;
  27797. t["tmonospace"] = 0xff54;
  27798. t["toarmenian"] = 0x0569;
  27799. t["tohiragana"] = 0x3068;
  27800. t["tokatakana"] = 0x30c8;
  27801. t["tokatakanahalfwidth"] = 0xff84;
  27802. t["tonebarextrahighmod"] = 0x02e5;
  27803. t["tonebarextralowmod"] = 0x02e9;
  27804. t["tonebarhighmod"] = 0x02e6;
  27805. t["tonebarlowmod"] = 0x02e8;
  27806. t["tonebarmidmod"] = 0x02e7;
  27807. t["tonefive"] = 0x01bd;
  27808. t["tonesix"] = 0x0185;
  27809. t["tonetwo"] = 0x01a8;
  27810. t["tonos"] = 0x0384;
  27811. t["tonsquare"] = 0x3327;
  27812. t["topatakthai"] = 0x0e0f;
  27813. t["tortoiseshellbracketleft"] = 0x3014;
  27814. t["tortoiseshellbracketleftsmall"] = 0xfe5d;
  27815. t["tortoiseshellbracketleftvertical"] = 0xfe39;
  27816. t["tortoiseshellbracketright"] = 0x3015;
  27817. t["tortoiseshellbracketrightsmall"] = 0xfe5e;
  27818. t["tortoiseshellbracketrightvertical"] = 0xfe3a;
  27819. t["totaothai"] = 0x0e15;
  27820. t["tpalatalhook"] = 0x01ab;
  27821. t["tparen"] = 0x24af;
  27822. t["trademark"] = 0x2122;
  27823. t["trademarksans"] = 0xf8ea;
  27824. t["trademarkserif"] = 0xf6db;
  27825. t["tretroflexhook"] = 0x0288;
  27826. t["triagdn"] = 0x25bc;
  27827. t["triaglf"] = 0x25c4;
  27828. t["triagrt"] = 0x25ba;
  27829. t["triagup"] = 0x25b2;
  27830. t["ts"] = 0x02a6;
  27831. t["tsadi"] = 0x05e6;
  27832. t["tsadidagesh"] = 0xfb46;
  27833. t["tsadidageshhebrew"] = 0xfb46;
  27834. t["tsadihebrew"] = 0x05e6;
  27835. t["tsecyrillic"] = 0x0446;
  27836. t["tsere"] = 0x05b5;
  27837. t["tsere12"] = 0x05b5;
  27838. t["tsere1e"] = 0x05b5;
  27839. t["tsere2b"] = 0x05b5;
  27840. t["tserehebrew"] = 0x05b5;
  27841. t["tserenarrowhebrew"] = 0x05b5;
  27842. t["tserequarterhebrew"] = 0x05b5;
  27843. t["tserewidehebrew"] = 0x05b5;
  27844. t["tshecyrillic"] = 0x045b;
  27845. t["tsuperior"] = 0xf6f3;
  27846. t["ttabengali"] = 0x099f;
  27847. t["ttadeva"] = 0x091f;
  27848. t["ttagujarati"] = 0x0a9f;
  27849. t["ttagurmukhi"] = 0x0a1f;
  27850. t["tteharabic"] = 0x0679;
  27851. t["ttehfinalarabic"] = 0xfb67;
  27852. t["ttehinitialarabic"] = 0xfb68;
  27853. t["ttehmedialarabic"] = 0xfb69;
  27854. t["tthabengali"] = 0x09a0;
  27855. t["tthadeva"] = 0x0920;
  27856. t["tthagujarati"] = 0x0aa0;
  27857. t["tthagurmukhi"] = 0x0a20;
  27858. t["tturned"] = 0x0287;
  27859. t["tuhiragana"] = 0x3064;
  27860. t["tukatakana"] = 0x30c4;
  27861. t["tukatakanahalfwidth"] = 0xff82;
  27862. t["tusmallhiragana"] = 0x3063;
  27863. t["tusmallkatakana"] = 0x30c3;
  27864. t["tusmallkatakanahalfwidth"] = 0xff6f;
  27865. t["twelvecircle"] = 0x246b;
  27866. t["twelveparen"] = 0x247f;
  27867. t["twelveperiod"] = 0x2493;
  27868. t["twelveroman"] = 0x217b;
  27869. t["twentycircle"] = 0x2473;
  27870. t["twentyhangzhou"] = 0x5344;
  27871. t["twentyparen"] = 0x2487;
  27872. t["twentyperiod"] = 0x249b;
  27873. t["two"] = 0x0032;
  27874. t["twoarabic"] = 0x0662;
  27875. t["twobengali"] = 0x09e8;
  27876. t["twocircle"] = 0x2461;
  27877. t["twocircleinversesansserif"] = 0x278b;
  27878. t["twodeva"] = 0x0968;
  27879. t["twodotenleader"] = 0x2025;
  27880. t["twodotleader"] = 0x2025;
  27881. t["twodotleadervertical"] = 0xfe30;
  27882. t["twogujarati"] = 0x0ae8;
  27883. t["twogurmukhi"] = 0x0a68;
  27884. t["twohackarabic"] = 0x0662;
  27885. t["twohangzhou"] = 0x3022;
  27886. t["twoideographicparen"] = 0x3221;
  27887. t["twoinferior"] = 0x2082;
  27888. t["twomonospace"] = 0xff12;
  27889. t["twonumeratorbengali"] = 0x09f5;
  27890. t["twooldstyle"] = 0xf732;
  27891. t["twoparen"] = 0x2475;
  27892. t["twoperiod"] = 0x2489;
  27893. t["twopersian"] = 0x06f2;
  27894. t["tworoman"] = 0x2171;
  27895. t["twostroke"] = 0x01bb;
  27896. t["twosuperior"] = 0x00b2;
  27897. t["twothai"] = 0x0e52;
  27898. t["twothirds"] = 0x2154;
  27899. t["u"] = 0x0075;
  27900. t["uacute"] = 0x00fa;
  27901. t["ubar"] = 0x0289;
  27902. t["ubengali"] = 0x0989;
  27903. t["ubopomofo"] = 0x3128;
  27904. t["ubreve"] = 0x016d;
  27905. t["ucaron"] = 0x01d4;
  27906. t["ucircle"] = 0x24e4;
  27907. t["ucircumflex"] = 0x00fb;
  27908. t["ucircumflexbelow"] = 0x1e77;
  27909. t["ucyrillic"] = 0x0443;
  27910. t["udattadeva"] = 0x0951;
  27911. t["udblacute"] = 0x0171;
  27912. t["udblgrave"] = 0x0215;
  27913. t["udeva"] = 0x0909;
  27914. t["udieresis"] = 0x00fc;
  27915. t["udieresisacute"] = 0x01d8;
  27916. t["udieresisbelow"] = 0x1e73;
  27917. t["udieresiscaron"] = 0x01da;
  27918. t["udieresiscyrillic"] = 0x04f1;
  27919. t["udieresisgrave"] = 0x01dc;
  27920. t["udieresismacron"] = 0x01d6;
  27921. t["udotbelow"] = 0x1ee5;
  27922. t["ugrave"] = 0x00f9;
  27923. t["ugujarati"] = 0x0a89;
  27924. t["ugurmukhi"] = 0x0a09;
  27925. t["uhiragana"] = 0x3046;
  27926. t["uhookabove"] = 0x1ee7;
  27927. t["uhorn"] = 0x01b0;
  27928. t["uhornacute"] = 0x1ee9;
  27929. t["uhorndotbelow"] = 0x1ef1;
  27930. t["uhorngrave"] = 0x1eeb;
  27931. t["uhornhookabove"] = 0x1eed;
  27932. t["uhorntilde"] = 0x1eef;
  27933. t["uhungarumlaut"] = 0x0171;
  27934. t["uhungarumlautcyrillic"] = 0x04f3;
  27935. t["uinvertedbreve"] = 0x0217;
  27936. t["ukatakana"] = 0x30a6;
  27937. t["ukatakanahalfwidth"] = 0xff73;
  27938. t["ukcyrillic"] = 0x0479;
  27939. t["ukorean"] = 0x315c;
  27940. t["umacron"] = 0x016b;
  27941. t["umacroncyrillic"] = 0x04ef;
  27942. t["umacrondieresis"] = 0x1e7b;
  27943. t["umatragurmukhi"] = 0x0a41;
  27944. t["umonospace"] = 0xff55;
  27945. t["underscore"] = 0x005f;
  27946. t["underscoredbl"] = 0x2017;
  27947. t["underscoremonospace"] = 0xff3f;
  27948. t["underscorevertical"] = 0xfe33;
  27949. t["underscorewavy"] = 0xfe4f;
  27950. t["union"] = 0x222a;
  27951. t["universal"] = 0x2200;
  27952. t["uogonek"] = 0x0173;
  27953. t["uparen"] = 0x24b0;
  27954. t["upblock"] = 0x2580;
  27955. t["upperdothebrew"] = 0x05c4;
  27956. t["upsilon"] = 0x03c5;
  27957. t["upsilondieresis"] = 0x03cb;
  27958. t["upsilondieresistonos"] = 0x03b0;
  27959. t["upsilonlatin"] = 0x028a;
  27960. t["upsilontonos"] = 0x03cd;
  27961. t["uptackbelowcmb"] = 0x031d;
  27962. t["uptackmod"] = 0x02d4;
  27963. t["uragurmukhi"] = 0x0a73;
  27964. t["uring"] = 0x016f;
  27965. t["ushortcyrillic"] = 0x045e;
  27966. t["usmallhiragana"] = 0x3045;
  27967. t["usmallkatakana"] = 0x30a5;
  27968. t["usmallkatakanahalfwidth"] = 0xff69;
  27969. t["ustraightcyrillic"] = 0x04af;
  27970. t["ustraightstrokecyrillic"] = 0x04b1;
  27971. t["utilde"] = 0x0169;
  27972. t["utildeacute"] = 0x1e79;
  27973. t["utildebelow"] = 0x1e75;
  27974. t["uubengali"] = 0x098a;
  27975. t["uudeva"] = 0x090a;
  27976. t["uugujarati"] = 0x0a8a;
  27977. t["uugurmukhi"] = 0x0a0a;
  27978. t["uumatragurmukhi"] = 0x0a42;
  27979. t["uuvowelsignbengali"] = 0x09c2;
  27980. t["uuvowelsigndeva"] = 0x0942;
  27981. t["uuvowelsigngujarati"] = 0x0ac2;
  27982. t["uvowelsignbengali"] = 0x09c1;
  27983. t["uvowelsigndeva"] = 0x0941;
  27984. t["uvowelsigngujarati"] = 0x0ac1;
  27985. t["v"] = 0x0076;
  27986. t["vadeva"] = 0x0935;
  27987. t["vagujarati"] = 0x0ab5;
  27988. t["vagurmukhi"] = 0x0a35;
  27989. t["vakatakana"] = 0x30f7;
  27990. t["vav"] = 0x05d5;
  27991. t["vavdagesh"] = 0xfb35;
  27992. t["vavdagesh65"] = 0xfb35;
  27993. t["vavdageshhebrew"] = 0xfb35;
  27994. t["vavhebrew"] = 0x05d5;
  27995. t["vavholam"] = 0xfb4b;
  27996. t["vavholamhebrew"] = 0xfb4b;
  27997. t["vavvavhebrew"] = 0x05f0;
  27998. t["vavyodhebrew"] = 0x05f1;
  27999. t["vcircle"] = 0x24e5;
  28000. t["vdotbelow"] = 0x1e7f;
  28001. t["vecyrillic"] = 0x0432;
  28002. t["veharabic"] = 0x06a4;
  28003. t["vehfinalarabic"] = 0xfb6b;
  28004. t["vehinitialarabic"] = 0xfb6c;
  28005. t["vehmedialarabic"] = 0xfb6d;
  28006. t["vekatakana"] = 0x30f9;
  28007. t["venus"] = 0x2640;
  28008. t["verticalbar"] = 0x007c;
  28009. t["verticallineabovecmb"] = 0x030d;
  28010. t["verticallinebelowcmb"] = 0x0329;
  28011. t["verticallinelowmod"] = 0x02cc;
  28012. t["verticallinemod"] = 0x02c8;
  28013. t["vewarmenian"] = 0x057e;
  28014. t["vhook"] = 0x028b;
  28015. t["vikatakana"] = 0x30f8;
  28016. t["viramabengali"] = 0x09cd;
  28017. t["viramadeva"] = 0x094d;
  28018. t["viramagujarati"] = 0x0acd;
  28019. t["visargabengali"] = 0x0983;
  28020. t["visargadeva"] = 0x0903;
  28021. t["visargagujarati"] = 0x0a83;
  28022. t["vmonospace"] = 0xff56;
  28023. t["voarmenian"] = 0x0578;
  28024. t["voicediterationhiragana"] = 0x309e;
  28025. t["voicediterationkatakana"] = 0x30fe;
  28026. t["voicedmarkkana"] = 0x309b;
  28027. t["voicedmarkkanahalfwidth"] = 0xff9e;
  28028. t["vokatakana"] = 0x30fa;
  28029. t["vparen"] = 0x24b1;
  28030. t["vtilde"] = 0x1e7d;
  28031. t["vturned"] = 0x028c;
  28032. t["vuhiragana"] = 0x3094;
  28033. t["vukatakana"] = 0x30f4;
  28034. t["w"] = 0x0077;
  28035. t["wacute"] = 0x1e83;
  28036. t["waekorean"] = 0x3159;
  28037. t["wahiragana"] = 0x308f;
  28038. t["wakatakana"] = 0x30ef;
  28039. t["wakatakanahalfwidth"] = 0xff9c;
  28040. t["wakorean"] = 0x3158;
  28041. t["wasmallhiragana"] = 0x308e;
  28042. t["wasmallkatakana"] = 0x30ee;
  28043. t["wattosquare"] = 0x3357;
  28044. t["wavedash"] = 0x301c;
  28045. t["wavyunderscorevertical"] = 0xfe34;
  28046. t["wawarabic"] = 0x0648;
  28047. t["wawfinalarabic"] = 0xfeee;
  28048. t["wawhamzaabovearabic"] = 0x0624;
  28049. t["wawhamzaabovefinalarabic"] = 0xfe86;
  28050. t["wbsquare"] = 0x33dd;
  28051. t["wcircle"] = 0x24e6;
  28052. t["wcircumflex"] = 0x0175;
  28053. t["wdieresis"] = 0x1e85;
  28054. t["wdotaccent"] = 0x1e87;
  28055. t["wdotbelow"] = 0x1e89;
  28056. t["wehiragana"] = 0x3091;
  28057. t["weierstrass"] = 0x2118;
  28058. t["wekatakana"] = 0x30f1;
  28059. t["wekorean"] = 0x315e;
  28060. t["weokorean"] = 0x315d;
  28061. t["wgrave"] = 0x1e81;
  28062. t["whitebullet"] = 0x25e6;
  28063. t["whitecircle"] = 0x25cb;
  28064. t["whitecircleinverse"] = 0x25d9;
  28065. t["whitecornerbracketleft"] = 0x300e;
  28066. t["whitecornerbracketleftvertical"] = 0xfe43;
  28067. t["whitecornerbracketright"] = 0x300f;
  28068. t["whitecornerbracketrightvertical"] = 0xfe44;
  28069. t["whitediamond"] = 0x25c7;
  28070. t["whitediamondcontainingblacksmalldiamond"] = 0x25c8;
  28071. t["whitedownpointingsmalltriangle"] = 0x25bf;
  28072. t["whitedownpointingtriangle"] = 0x25bd;
  28073. t["whiteleftpointingsmalltriangle"] = 0x25c3;
  28074. t["whiteleftpointingtriangle"] = 0x25c1;
  28075. t["whitelenticularbracketleft"] = 0x3016;
  28076. t["whitelenticularbracketright"] = 0x3017;
  28077. t["whiterightpointingsmalltriangle"] = 0x25b9;
  28078. t["whiterightpointingtriangle"] = 0x25b7;
  28079. t["whitesmallsquare"] = 0x25ab;
  28080. t["whitesmilingface"] = 0x263a;
  28081. t["whitesquare"] = 0x25a1;
  28082. t["whitestar"] = 0x2606;
  28083. t["whitetelephone"] = 0x260f;
  28084. t["whitetortoiseshellbracketleft"] = 0x3018;
  28085. t["whitetortoiseshellbracketright"] = 0x3019;
  28086. t["whiteuppointingsmalltriangle"] = 0x25b5;
  28087. t["whiteuppointingtriangle"] = 0x25b3;
  28088. t["wihiragana"] = 0x3090;
  28089. t["wikatakana"] = 0x30f0;
  28090. t["wikorean"] = 0x315f;
  28091. t["wmonospace"] = 0xff57;
  28092. t["wohiragana"] = 0x3092;
  28093. t["wokatakana"] = 0x30f2;
  28094. t["wokatakanahalfwidth"] = 0xff66;
  28095. t["won"] = 0x20a9;
  28096. t["wonmonospace"] = 0xffe6;
  28097. t["wowaenthai"] = 0x0e27;
  28098. t["wparen"] = 0x24b2;
  28099. t["wring"] = 0x1e98;
  28100. t["wsuperior"] = 0x02b7;
  28101. t["wturned"] = 0x028d;
  28102. t["wynn"] = 0x01bf;
  28103. t["x"] = 0x0078;
  28104. t["xabovecmb"] = 0x033d;
  28105. t["xbopomofo"] = 0x3112;
  28106. t["xcircle"] = 0x24e7;
  28107. t["xdieresis"] = 0x1e8d;
  28108. t["xdotaccent"] = 0x1e8b;
  28109. t["xeharmenian"] = 0x056d;
  28110. t["xi"] = 0x03be;
  28111. t["xmonospace"] = 0xff58;
  28112. t["xparen"] = 0x24b3;
  28113. t["xsuperior"] = 0x02e3;
  28114. t["y"] = 0x0079;
  28115. t["yaadosquare"] = 0x334e;
  28116. t["yabengali"] = 0x09af;
  28117. t["yacute"] = 0x00fd;
  28118. t["yadeva"] = 0x092f;
  28119. t["yaekorean"] = 0x3152;
  28120. t["yagujarati"] = 0x0aaf;
  28121. t["yagurmukhi"] = 0x0a2f;
  28122. t["yahiragana"] = 0x3084;
  28123. t["yakatakana"] = 0x30e4;
  28124. t["yakatakanahalfwidth"] = 0xff94;
  28125. t["yakorean"] = 0x3151;
  28126. t["yamakkanthai"] = 0x0e4e;
  28127. t["yasmallhiragana"] = 0x3083;
  28128. t["yasmallkatakana"] = 0x30e3;
  28129. t["yasmallkatakanahalfwidth"] = 0xff6c;
  28130. t["yatcyrillic"] = 0x0463;
  28131. t["ycircle"] = 0x24e8;
  28132. t["ycircumflex"] = 0x0177;
  28133. t["ydieresis"] = 0x00ff;
  28134. t["ydotaccent"] = 0x1e8f;
  28135. t["ydotbelow"] = 0x1ef5;
  28136. t["yeharabic"] = 0x064a;
  28137. t["yehbarreearabic"] = 0x06d2;
  28138. t["yehbarreefinalarabic"] = 0xfbaf;
  28139. t["yehfinalarabic"] = 0xfef2;
  28140. t["yehhamzaabovearabic"] = 0x0626;
  28141. t["yehhamzaabovefinalarabic"] = 0xfe8a;
  28142. t["yehhamzaaboveinitialarabic"] = 0xfe8b;
  28143. t["yehhamzaabovemedialarabic"] = 0xfe8c;
  28144. t["yehinitialarabic"] = 0xfef3;
  28145. t["yehmedialarabic"] = 0xfef4;
  28146. t["yehmeeminitialarabic"] = 0xfcdd;
  28147. t["yehmeemisolatedarabic"] = 0xfc58;
  28148. t["yehnoonfinalarabic"] = 0xfc94;
  28149. t["yehthreedotsbelowarabic"] = 0x06d1;
  28150. t["yekorean"] = 0x3156;
  28151. t["yen"] = 0x00a5;
  28152. t["yenmonospace"] = 0xffe5;
  28153. t["yeokorean"] = 0x3155;
  28154. t["yeorinhieuhkorean"] = 0x3186;
  28155. t["yerahbenyomohebrew"] = 0x05aa;
  28156. t["yerahbenyomolefthebrew"] = 0x05aa;
  28157. t["yericyrillic"] = 0x044b;
  28158. t["yerudieresiscyrillic"] = 0x04f9;
  28159. t["yesieungkorean"] = 0x3181;
  28160. t["yesieungpansioskorean"] = 0x3183;
  28161. t["yesieungsioskorean"] = 0x3182;
  28162. t["yetivhebrew"] = 0x059a;
  28163. t["ygrave"] = 0x1ef3;
  28164. t["yhook"] = 0x01b4;
  28165. t["yhookabove"] = 0x1ef7;
  28166. t["yiarmenian"] = 0x0575;
  28167. t["yicyrillic"] = 0x0457;
  28168. t["yikorean"] = 0x3162;
  28169. t["yinyang"] = 0x262f;
  28170. t["yiwnarmenian"] = 0x0582;
  28171. t["ymonospace"] = 0xff59;
  28172. t["yod"] = 0x05d9;
  28173. t["yoddagesh"] = 0xfb39;
  28174. t["yoddageshhebrew"] = 0xfb39;
  28175. t["yodhebrew"] = 0x05d9;
  28176. t["yodyodhebrew"] = 0x05f2;
  28177. t["yodyodpatahhebrew"] = 0xfb1f;
  28178. t["yohiragana"] = 0x3088;
  28179. t["yoikorean"] = 0x3189;
  28180. t["yokatakana"] = 0x30e8;
  28181. t["yokatakanahalfwidth"] = 0xff96;
  28182. t["yokorean"] = 0x315b;
  28183. t["yosmallhiragana"] = 0x3087;
  28184. t["yosmallkatakana"] = 0x30e7;
  28185. t["yosmallkatakanahalfwidth"] = 0xff6e;
  28186. t["yotgreek"] = 0x03f3;
  28187. t["yoyaekorean"] = 0x3188;
  28188. t["yoyakorean"] = 0x3187;
  28189. t["yoyakthai"] = 0x0e22;
  28190. t["yoyingthai"] = 0x0e0d;
  28191. t["yparen"] = 0x24b4;
  28192. t["ypogegrammeni"] = 0x037a;
  28193. t["ypogegrammenigreekcmb"] = 0x0345;
  28194. t["yr"] = 0x01a6;
  28195. t["yring"] = 0x1e99;
  28196. t["ysuperior"] = 0x02b8;
  28197. t["ytilde"] = 0x1ef9;
  28198. t["yturned"] = 0x028e;
  28199. t["yuhiragana"] = 0x3086;
  28200. t["yuikorean"] = 0x318c;
  28201. t["yukatakana"] = 0x30e6;
  28202. t["yukatakanahalfwidth"] = 0xff95;
  28203. t["yukorean"] = 0x3160;
  28204. t["yusbigcyrillic"] = 0x046b;
  28205. t["yusbigiotifiedcyrillic"] = 0x046d;
  28206. t["yuslittlecyrillic"] = 0x0467;
  28207. t["yuslittleiotifiedcyrillic"] = 0x0469;
  28208. t["yusmallhiragana"] = 0x3085;
  28209. t["yusmallkatakana"] = 0x30e5;
  28210. t["yusmallkatakanahalfwidth"] = 0xff6d;
  28211. t["yuyekorean"] = 0x318b;
  28212. t["yuyeokorean"] = 0x318a;
  28213. t["yyabengali"] = 0x09df;
  28214. t["yyadeva"] = 0x095f;
  28215. t["z"] = 0x007a;
  28216. t["zaarmenian"] = 0x0566;
  28217. t["zacute"] = 0x017a;
  28218. t["zadeva"] = 0x095b;
  28219. t["zagurmukhi"] = 0x0a5b;
  28220. t["zaharabic"] = 0x0638;
  28221. t["zahfinalarabic"] = 0xfec6;
  28222. t["zahinitialarabic"] = 0xfec7;
  28223. t["zahiragana"] = 0x3056;
  28224. t["zahmedialarabic"] = 0xfec8;
  28225. t["zainarabic"] = 0x0632;
  28226. t["zainfinalarabic"] = 0xfeb0;
  28227. t["zakatakana"] = 0x30b6;
  28228. t["zaqefgadolhebrew"] = 0x0595;
  28229. t["zaqefqatanhebrew"] = 0x0594;
  28230. t["zarqahebrew"] = 0x0598;
  28231. t["zayin"] = 0x05d6;
  28232. t["zayindagesh"] = 0xfb36;
  28233. t["zayindageshhebrew"] = 0xfb36;
  28234. t["zayinhebrew"] = 0x05d6;
  28235. t["zbopomofo"] = 0x3117;
  28236. t["zcaron"] = 0x017e;
  28237. t["zcircle"] = 0x24e9;
  28238. t["zcircumflex"] = 0x1e91;
  28239. t["zcurl"] = 0x0291;
  28240. t["zdot"] = 0x017c;
  28241. t["zdotaccent"] = 0x017c;
  28242. t["zdotbelow"] = 0x1e93;
  28243. t["zecyrillic"] = 0x0437;
  28244. t["zedescendercyrillic"] = 0x0499;
  28245. t["zedieresiscyrillic"] = 0x04df;
  28246. t["zehiragana"] = 0x305c;
  28247. t["zekatakana"] = 0x30bc;
  28248. t["zero"] = 0x0030;
  28249. t["zeroarabic"] = 0x0660;
  28250. t["zerobengali"] = 0x09e6;
  28251. t["zerodeva"] = 0x0966;
  28252. t["zerogujarati"] = 0x0ae6;
  28253. t["zerogurmukhi"] = 0x0a66;
  28254. t["zerohackarabic"] = 0x0660;
  28255. t["zeroinferior"] = 0x2080;
  28256. t["zeromonospace"] = 0xff10;
  28257. t["zerooldstyle"] = 0xf730;
  28258. t["zeropersian"] = 0x06f0;
  28259. t["zerosuperior"] = 0x2070;
  28260. t["zerothai"] = 0x0e50;
  28261. t["zerowidthjoiner"] = 0xfeff;
  28262. t["zerowidthnonjoiner"] = 0x200c;
  28263. t["zerowidthspace"] = 0x200b;
  28264. t["zeta"] = 0x03b6;
  28265. t["zhbopomofo"] = 0x3113;
  28266. t["zhearmenian"] = 0x056a;
  28267. t["zhebrevecyrillic"] = 0x04c2;
  28268. t["zhecyrillic"] = 0x0436;
  28269. t["zhedescendercyrillic"] = 0x0497;
  28270. t["zhedieresiscyrillic"] = 0x04dd;
  28271. t["zihiragana"] = 0x3058;
  28272. t["zikatakana"] = 0x30b8;
  28273. t["zinorhebrew"] = 0x05ae;
  28274. t["zlinebelow"] = 0x1e95;
  28275. t["zmonospace"] = 0xff5a;
  28276. t["zohiragana"] = 0x305e;
  28277. t["zokatakana"] = 0x30be;
  28278. t["zparen"] = 0x24b5;
  28279. t["zretroflexhook"] = 0x0290;
  28280. t["zstroke"] = 0x01b6;
  28281. t["zuhiragana"] = 0x305a;
  28282. t["zukatakana"] = 0x30ba;
  28283. t[".notdef"] = 0x0000;
  28284. t["angbracketleftbig"] = 0x2329;
  28285. t["angbracketleftBig"] = 0x2329;
  28286. t["angbracketleftbigg"] = 0x2329;
  28287. t["angbracketleftBigg"] = 0x2329;
  28288. t["angbracketrightBig"] = 0x232a;
  28289. t["angbracketrightbig"] = 0x232a;
  28290. t["angbracketrightBigg"] = 0x232a;
  28291. t["angbracketrightbigg"] = 0x232a;
  28292. t["arrowhookleft"] = 0x21aa;
  28293. t["arrowhookright"] = 0x21a9;
  28294. t["arrowlefttophalf"] = 0x21bc;
  28295. t["arrowleftbothalf"] = 0x21bd;
  28296. t["arrownortheast"] = 0x2197;
  28297. t["arrownorthwest"] = 0x2196;
  28298. t["arrowrighttophalf"] = 0x21c0;
  28299. t["arrowrightbothalf"] = 0x21c1;
  28300. t["arrowsoutheast"] = 0x2198;
  28301. t["arrowsouthwest"] = 0x2199;
  28302. t["backslashbig"] = 0x2216;
  28303. t["backslashBig"] = 0x2216;
  28304. t["backslashBigg"] = 0x2216;
  28305. t["backslashbigg"] = 0x2216;
  28306. t["bardbl"] = 0x2016;
  28307. t["bracehtipdownleft"] = 0xfe37;
  28308. t["bracehtipdownright"] = 0xfe37;
  28309. t["bracehtipupleft"] = 0xfe38;
  28310. t["bracehtipupright"] = 0xfe38;
  28311. t["braceleftBig"] = 0x007b;
  28312. t["braceleftbig"] = 0x007b;
  28313. t["braceleftbigg"] = 0x007b;
  28314. t["braceleftBigg"] = 0x007b;
  28315. t["bracerightBig"] = 0x007d;
  28316. t["bracerightbig"] = 0x007d;
  28317. t["bracerightbigg"] = 0x007d;
  28318. t["bracerightBigg"] = 0x007d;
  28319. t["bracketleftbig"] = 0x005b;
  28320. t["bracketleftBig"] = 0x005b;
  28321. t["bracketleftbigg"] = 0x005b;
  28322. t["bracketleftBigg"] = 0x005b;
  28323. t["bracketrightBig"] = 0x005d;
  28324. t["bracketrightbig"] = 0x005d;
  28325. t["bracketrightbigg"] = 0x005d;
  28326. t["bracketrightBigg"] = 0x005d;
  28327. t["ceilingleftbig"] = 0x2308;
  28328. t["ceilingleftBig"] = 0x2308;
  28329. t["ceilingleftBigg"] = 0x2308;
  28330. t["ceilingleftbigg"] = 0x2308;
  28331. t["ceilingrightbig"] = 0x2309;
  28332. t["ceilingrightBig"] = 0x2309;
  28333. t["ceilingrightbigg"] = 0x2309;
  28334. t["ceilingrightBigg"] = 0x2309;
  28335. t["circledotdisplay"] = 0x2299;
  28336. t["circledottext"] = 0x2299;
  28337. t["circlemultiplydisplay"] = 0x2297;
  28338. t["circlemultiplytext"] = 0x2297;
  28339. t["circleplusdisplay"] = 0x2295;
  28340. t["circleplustext"] = 0x2295;
  28341. t["contintegraldisplay"] = 0x222e;
  28342. t["contintegraltext"] = 0x222e;
  28343. t["coproductdisplay"] = 0x2210;
  28344. t["coproducttext"] = 0x2210;
  28345. t["floorleftBig"] = 0x230a;
  28346. t["floorleftbig"] = 0x230a;
  28347. t["floorleftbigg"] = 0x230a;
  28348. t["floorleftBigg"] = 0x230a;
  28349. t["floorrightbig"] = 0x230b;
  28350. t["floorrightBig"] = 0x230b;
  28351. t["floorrightBigg"] = 0x230b;
  28352. t["floorrightbigg"] = 0x230b;
  28353. t["hatwide"] = 0x0302;
  28354. t["hatwider"] = 0x0302;
  28355. t["hatwidest"] = 0x0302;
  28356. t["intercal"] = 0x1d40;
  28357. t["integraldisplay"] = 0x222b;
  28358. t["integraltext"] = 0x222b;
  28359. t["intersectiondisplay"] = 0x22c2;
  28360. t["intersectiontext"] = 0x22c2;
  28361. t["logicalanddisplay"] = 0x2227;
  28362. t["logicalandtext"] = 0x2227;
  28363. t["logicalordisplay"] = 0x2228;
  28364. t["logicalortext"] = 0x2228;
  28365. t["parenleftBig"] = 0x0028;
  28366. t["parenleftbig"] = 0x0028;
  28367. t["parenleftBigg"] = 0x0028;
  28368. t["parenleftbigg"] = 0x0028;
  28369. t["parenrightBig"] = 0x0029;
  28370. t["parenrightbig"] = 0x0029;
  28371. t["parenrightBigg"] = 0x0029;
  28372. t["parenrightbigg"] = 0x0029;
  28373. t["prime"] = 0x2032;
  28374. t["productdisplay"] = 0x220f;
  28375. t["producttext"] = 0x220f;
  28376. t["radicalbig"] = 0x221a;
  28377. t["radicalBig"] = 0x221a;
  28378. t["radicalBigg"] = 0x221a;
  28379. t["radicalbigg"] = 0x221a;
  28380. t["radicalbt"] = 0x221a;
  28381. t["radicaltp"] = 0x221a;
  28382. t["radicalvertex"] = 0x221a;
  28383. t["slashbig"] = 0x002f;
  28384. t["slashBig"] = 0x002f;
  28385. t["slashBigg"] = 0x002f;
  28386. t["slashbigg"] = 0x002f;
  28387. t["summationdisplay"] = 0x2211;
  28388. t["summationtext"] = 0x2211;
  28389. t["tildewide"] = 0x02dc;
  28390. t["tildewider"] = 0x02dc;
  28391. t["tildewidest"] = 0x02dc;
  28392. t["uniondisplay"] = 0x22c3;
  28393. t["unionmultidisplay"] = 0x228e;
  28394. t["unionmultitext"] = 0x228e;
  28395. t["unionsqdisplay"] = 0x2294;
  28396. t["unionsqtext"] = 0x2294;
  28397. t["uniontext"] = 0x22c3;
  28398. t["vextenddouble"] = 0x2225;
  28399. t["vextendsingle"] = 0x2223;
  28400. });
  28401. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  28402. t["space"] = 0x0020;
  28403. t["a1"] = 0x2701;
  28404. t["a2"] = 0x2702;
  28405. t["a202"] = 0x2703;
  28406. t["a3"] = 0x2704;
  28407. t["a4"] = 0x260e;
  28408. t["a5"] = 0x2706;
  28409. t["a119"] = 0x2707;
  28410. t["a118"] = 0x2708;
  28411. t["a117"] = 0x2709;
  28412. t["a11"] = 0x261b;
  28413. t["a12"] = 0x261e;
  28414. t["a13"] = 0x270c;
  28415. t["a14"] = 0x270d;
  28416. t["a15"] = 0x270e;
  28417. t["a16"] = 0x270f;
  28418. t["a105"] = 0x2710;
  28419. t["a17"] = 0x2711;
  28420. t["a18"] = 0x2712;
  28421. t["a19"] = 0x2713;
  28422. t["a20"] = 0x2714;
  28423. t["a21"] = 0x2715;
  28424. t["a22"] = 0x2716;
  28425. t["a23"] = 0x2717;
  28426. t["a24"] = 0x2718;
  28427. t["a25"] = 0x2719;
  28428. t["a26"] = 0x271a;
  28429. t["a27"] = 0x271b;
  28430. t["a28"] = 0x271c;
  28431. t["a6"] = 0x271d;
  28432. t["a7"] = 0x271e;
  28433. t["a8"] = 0x271f;
  28434. t["a9"] = 0x2720;
  28435. t["a10"] = 0x2721;
  28436. t["a29"] = 0x2722;
  28437. t["a30"] = 0x2723;
  28438. t["a31"] = 0x2724;
  28439. t["a32"] = 0x2725;
  28440. t["a33"] = 0x2726;
  28441. t["a34"] = 0x2727;
  28442. t["a35"] = 0x2605;
  28443. t["a36"] = 0x2729;
  28444. t["a37"] = 0x272a;
  28445. t["a38"] = 0x272b;
  28446. t["a39"] = 0x272c;
  28447. t["a40"] = 0x272d;
  28448. t["a41"] = 0x272e;
  28449. t["a42"] = 0x272f;
  28450. t["a43"] = 0x2730;
  28451. t["a44"] = 0x2731;
  28452. t["a45"] = 0x2732;
  28453. t["a46"] = 0x2733;
  28454. t["a47"] = 0x2734;
  28455. t["a48"] = 0x2735;
  28456. t["a49"] = 0x2736;
  28457. t["a50"] = 0x2737;
  28458. t["a51"] = 0x2738;
  28459. t["a52"] = 0x2739;
  28460. t["a53"] = 0x273a;
  28461. t["a54"] = 0x273b;
  28462. t["a55"] = 0x273c;
  28463. t["a56"] = 0x273d;
  28464. t["a57"] = 0x273e;
  28465. t["a58"] = 0x273f;
  28466. t["a59"] = 0x2740;
  28467. t["a60"] = 0x2741;
  28468. t["a61"] = 0x2742;
  28469. t["a62"] = 0x2743;
  28470. t["a63"] = 0x2744;
  28471. t["a64"] = 0x2745;
  28472. t["a65"] = 0x2746;
  28473. t["a66"] = 0x2747;
  28474. t["a67"] = 0x2748;
  28475. t["a68"] = 0x2749;
  28476. t["a69"] = 0x274a;
  28477. t["a70"] = 0x274b;
  28478. t["a71"] = 0x25cf;
  28479. t["a72"] = 0x274d;
  28480. t["a73"] = 0x25a0;
  28481. t["a74"] = 0x274f;
  28482. t["a203"] = 0x2750;
  28483. t["a75"] = 0x2751;
  28484. t["a204"] = 0x2752;
  28485. t["a76"] = 0x25b2;
  28486. t["a77"] = 0x25bc;
  28487. t["a78"] = 0x25c6;
  28488. t["a79"] = 0x2756;
  28489. t["a81"] = 0x25d7;
  28490. t["a82"] = 0x2758;
  28491. t["a83"] = 0x2759;
  28492. t["a84"] = 0x275a;
  28493. t["a97"] = 0x275b;
  28494. t["a98"] = 0x275c;
  28495. t["a99"] = 0x275d;
  28496. t["a100"] = 0x275e;
  28497. t["a101"] = 0x2761;
  28498. t["a102"] = 0x2762;
  28499. t["a103"] = 0x2763;
  28500. t["a104"] = 0x2764;
  28501. t["a106"] = 0x2765;
  28502. t["a107"] = 0x2766;
  28503. t["a108"] = 0x2767;
  28504. t["a112"] = 0x2663;
  28505. t["a111"] = 0x2666;
  28506. t["a110"] = 0x2665;
  28507. t["a109"] = 0x2660;
  28508. t["a120"] = 0x2460;
  28509. t["a121"] = 0x2461;
  28510. t["a122"] = 0x2462;
  28511. t["a123"] = 0x2463;
  28512. t["a124"] = 0x2464;
  28513. t["a125"] = 0x2465;
  28514. t["a126"] = 0x2466;
  28515. t["a127"] = 0x2467;
  28516. t["a128"] = 0x2468;
  28517. t["a129"] = 0x2469;
  28518. t["a130"] = 0x2776;
  28519. t["a131"] = 0x2777;
  28520. t["a132"] = 0x2778;
  28521. t["a133"] = 0x2779;
  28522. t["a134"] = 0x277a;
  28523. t["a135"] = 0x277b;
  28524. t["a136"] = 0x277c;
  28525. t["a137"] = 0x277d;
  28526. t["a138"] = 0x277e;
  28527. t["a139"] = 0x277f;
  28528. t["a140"] = 0x2780;
  28529. t["a141"] = 0x2781;
  28530. t["a142"] = 0x2782;
  28531. t["a143"] = 0x2783;
  28532. t["a144"] = 0x2784;
  28533. t["a145"] = 0x2785;
  28534. t["a146"] = 0x2786;
  28535. t["a147"] = 0x2787;
  28536. t["a148"] = 0x2788;
  28537. t["a149"] = 0x2789;
  28538. t["a150"] = 0x278a;
  28539. t["a151"] = 0x278b;
  28540. t["a152"] = 0x278c;
  28541. t["a153"] = 0x278d;
  28542. t["a154"] = 0x278e;
  28543. t["a155"] = 0x278f;
  28544. t["a156"] = 0x2790;
  28545. t["a157"] = 0x2791;
  28546. t["a158"] = 0x2792;
  28547. t["a159"] = 0x2793;
  28548. t["a160"] = 0x2794;
  28549. t["a161"] = 0x2192;
  28550. t["a163"] = 0x2194;
  28551. t["a164"] = 0x2195;
  28552. t["a196"] = 0x2798;
  28553. t["a165"] = 0x2799;
  28554. t["a192"] = 0x279a;
  28555. t["a166"] = 0x279b;
  28556. t["a167"] = 0x279c;
  28557. t["a168"] = 0x279d;
  28558. t["a169"] = 0x279e;
  28559. t["a170"] = 0x279f;
  28560. t["a171"] = 0x27a0;
  28561. t["a172"] = 0x27a1;
  28562. t["a173"] = 0x27a2;
  28563. t["a162"] = 0x27a3;
  28564. t["a174"] = 0x27a4;
  28565. t["a175"] = 0x27a5;
  28566. t["a176"] = 0x27a6;
  28567. t["a177"] = 0x27a7;
  28568. t["a178"] = 0x27a8;
  28569. t["a179"] = 0x27a9;
  28570. t["a193"] = 0x27aa;
  28571. t["a180"] = 0x27ab;
  28572. t["a199"] = 0x27ac;
  28573. t["a181"] = 0x27ad;
  28574. t["a200"] = 0x27ae;
  28575. t["a182"] = 0x27af;
  28576. t["a201"] = 0x27b1;
  28577. t["a183"] = 0x27b2;
  28578. t["a184"] = 0x27b3;
  28579. t["a197"] = 0x27b4;
  28580. t["a185"] = 0x27b5;
  28581. t["a194"] = 0x27b6;
  28582. t["a198"] = 0x27b7;
  28583. t["a186"] = 0x27b8;
  28584. t["a195"] = 0x27b9;
  28585. t["a187"] = 0x27ba;
  28586. t["a188"] = 0x27bb;
  28587. t["a189"] = 0x27bc;
  28588. t["a190"] = 0x27bd;
  28589. t["a191"] = 0x27be;
  28590. t["a89"] = 0x2768;
  28591. t["a90"] = 0x2769;
  28592. t["a93"] = 0x276a;
  28593. t["a94"] = 0x276b;
  28594. t["a91"] = 0x276c;
  28595. t["a92"] = 0x276d;
  28596. t["a205"] = 0x276e;
  28597. t["a85"] = 0x276f;
  28598. t["a206"] = 0x2770;
  28599. t["a86"] = 0x2771;
  28600. t["a87"] = 0x2772;
  28601. t["a88"] = 0x2773;
  28602. t["a95"] = 0x2774;
  28603. t["a96"] = 0x2775;
  28604. t[".notdef"] = 0x0000;
  28605. });
  28606. exports.getGlyphsUnicode = getGlyphsUnicode;
  28607. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  28608. /***/ }),
  28609. /* 32 */
  28610. /***/ (function(module, exports, __w_pdfjs_require__) {
  28611. "use strict";
  28612. Object.defineProperty(exports, "__esModule", {
  28613. value: true
  28614. });
  28615. exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0;
  28616. var _core_utils = __w_pdfjs_require__(7);
  28617. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  28618. t["ArialNarrow"] = "Helvetica";
  28619. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  28620. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  28621. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  28622. t["ArialBlack"] = "Helvetica";
  28623. t["ArialBlack-Bold"] = "Helvetica-Bold";
  28624. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  28625. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  28626. t["Arial-Black"] = "Helvetica";
  28627. t["Arial-Black-Bold"] = "Helvetica-Bold";
  28628. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  28629. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  28630. t["Arial"] = "Helvetica";
  28631. t["Arial-Bold"] = "Helvetica-Bold";
  28632. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  28633. t["Arial-Italic"] = "Helvetica-Oblique";
  28634. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  28635. t["Arial-BoldMT"] = "Helvetica-Bold";
  28636. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  28637. t["ArialMT"] = "Helvetica";
  28638. t["Courier-Bold"] = "Courier-Bold";
  28639. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  28640. t["Courier-Italic"] = "Courier-Oblique";
  28641. t["CourierNew"] = "Courier";
  28642. t["CourierNew-Bold"] = "Courier-Bold";
  28643. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  28644. t["CourierNew-Italic"] = "Courier-Oblique";
  28645. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  28646. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  28647. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  28648. t["CourierNewPSMT"] = "Courier";
  28649. t["Helvetica"] = "Helvetica";
  28650. t["Helvetica-Bold"] = "Helvetica-Bold";
  28651. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  28652. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  28653. t["Helvetica-Italic"] = "Helvetica-Oblique";
  28654. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  28655. t["Symbol-Bold"] = "Symbol";
  28656. t["Symbol-BoldItalic"] = "Symbol";
  28657. t["Symbol-Italic"] = "Symbol";
  28658. t["TimesNewRoman"] = "Times-Roman";
  28659. t["TimesNewRoman-Bold"] = "Times-Bold";
  28660. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  28661. t["TimesNewRoman-Italic"] = "Times-Italic";
  28662. t["TimesNewRomanPS"] = "Times-Roman";
  28663. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  28664. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  28665. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  28666. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  28667. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  28668. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  28669. t["TimesNewRomanPSMT"] = "Times-Roman";
  28670. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  28671. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  28672. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  28673. });
  28674. exports.getStdFontMap = getStdFontMap;
  28675. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  28676. t["Calibri"] = "Helvetica";
  28677. t["Calibri-Bold"] = "Helvetica-Bold";
  28678. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  28679. t["Calibri-Italic"] = "Helvetica-Oblique";
  28680. t["CenturyGothic"] = "Helvetica";
  28681. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  28682. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  28683. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  28684. t["ComicSansMS"] = "Comic Sans MS";
  28685. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  28686. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  28687. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  28688. t["LucidaConsole"] = "Courier";
  28689. t["LucidaConsole-Bold"] = "Courier-Bold";
  28690. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  28691. t["LucidaConsole-Italic"] = "Courier-Oblique";
  28692. t["LucidaSans-Demi"] = "Helvetica-Bold";
  28693. t["MS-Gothic"] = "MS Gothic";
  28694. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  28695. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  28696. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  28697. t["MS-Mincho"] = "MS Mincho";
  28698. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  28699. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  28700. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  28701. t["MS-PGothic"] = "MS PGothic";
  28702. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  28703. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  28704. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  28705. t["MS-PMincho"] = "MS PMincho";
  28706. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  28707. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  28708. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  28709. t["NuptialScript"] = "Times-Italic";
  28710. t["SegoeUISymbol"] = "Helvetica";
  28711. t["Wingdings"] = "ZapfDingbats";
  28712. t["Wingdings-Regular"] = "ZapfDingbats";
  28713. });
  28714. exports.getNonStdFontMap = getNonStdFontMap;
  28715. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  28716. t["Adobe Jenson"] = true;
  28717. t["Adobe Text"] = true;
  28718. t["Albertus"] = true;
  28719. t["Aldus"] = true;
  28720. t["Alexandria"] = true;
  28721. t["Algerian"] = true;
  28722. t["American Typewriter"] = true;
  28723. t["Antiqua"] = true;
  28724. t["Apex"] = true;
  28725. t["Arno"] = true;
  28726. t["Aster"] = true;
  28727. t["Aurora"] = true;
  28728. t["Baskerville"] = true;
  28729. t["Bell"] = true;
  28730. t["Bembo"] = true;
  28731. t["Bembo Schoolbook"] = true;
  28732. t["Benguiat"] = true;
  28733. t["Berkeley Old Style"] = true;
  28734. t["Bernhard Modern"] = true;
  28735. t["Berthold City"] = true;
  28736. t["Bodoni"] = true;
  28737. t["Bauer Bodoni"] = true;
  28738. t["Book Antiqua"] = true;
  28739. t["Bookman"] = true;
  28740. t["Bordeaux Roman"] = true;
  28741. t["Californian FB"] = true;
  28742. t["Calisto"] = true;
  28743. t["Calvert"] = true;
  28744. t["Capitals"] = true;
  28745. t["Cambria"] = true;
  28746. t["Cartier"] = true;
  28747. t["Caslon"] = true;
  28748. t["Catull"] = true;
  28749. t["Centaur"] = true;
  28750. t["Century Old Style"] = true;
  28751. t["Century Schoolbook"] = true;
  28752. t["Chaparral"] = true;
  28753. t["Charis SIL"] = true;
  28754. t["Cheltenham"] = true;
  28755. t["Cholla Slab"] = true;
  28756. t["Clarendon"] = true;
  28757. t["Clearface"] = true;
  28758. t["Cochin"] = true;
  28759. t["Colonna"] = true;
  28760. t["Computer Modern"] = true;
  28761. t["Concrete Roman"] = true;
  28762. t["Constantia"] = true;
  28763. t["Cooper Black"] = true;
  28764. t["Corona"] = true;
  28765. t["Ecotype"] = true;
  28766. t["Egyptienne"] = true;
  28767. t["Elephant"] = true;
  28768. t["Excelsior"] = true;
  28769. t["Fairfield"] = true;
  28770. t["FF Scala"] = true;
  28771. t["Folkard"] = true;
  28772. t["Footlight"] = true;
  28773. t["FreeSerif"] = true;
  28774. t["Friz Quadrata"] = true;
  28775. t["Garamond"] = true;
  28776. t["Gentium"] = true;
  28777. t["Georgia"] = true;
  28778. t["Gloucester"] = true;
  28779. t["Goudy Old Style"] = true;
  28780. t["Goudy Schoolbook"] = true;
  28781. t["Goudy Pro Font"] = true;
  28782. t["Granjon"] = true;
  28783. t["Guardian Egyptian"] = true;
  28784. t["Heather"] = true;
  28785. t["Hercules"] = true;
  28786. t["High Tower Text"] = true;
  28787. t["Hiroshige"] = true;
  28788. t["Hoefler Text"] = true;
  28789. t["Humana Serif"] = true;
  28790. t["Imprint"] = true;
  28791. t["Ionic No. 5"] = true;
  28792. t["Janson"] = true;
  28793. t["Joanna"] = true;
  28794. t["Korinna"] = true;
  28795. t["Lexicon"] = true;
  28796. t["Liberation Serif"] = true;
  28797. t["Linux Libertine"] = true;
  28798. t["Literaturnaya"] = true;
  28799. t["Lucida"] = true;
  28800. t["Lucida Bright"] = true;
  28801. t["Melior"] = true;
  28802. t["Memphis"] = true;
  28803. t["Miller"] = true;
  28804. t["Minion"] = true;
  28805. t["Modern"] = true;
  28806. t["Mona Lisa"] = true;
  28807. t["Mrs Eaves"] = true;
  28808. t["MS Serif"] = true;
  28809. t["Museo Slab"] = true;
  28810. t["New York"] = true;
  28811. t["Nimbus Roman"] = true;
  28812. t["NPS Rawlinson Roadway"] = true;
  28813. t["NuptialScript"] = true;
  28814. t["Palatino"] = true;
  28815. t["Perpetua"] = true;
  28816. t["Plantin"] = true;
  28817. t["Plantin Schoolbook"] = true;
  28818. t["Playbill"] = true;
  28819. t["Poor Richard"] = true;
  28820. t["Rawlinson Roadway"] = true;
  28821. t["Renault"] = true;
  28822. t["Requiem"] = true;
  28823. t["Rockwell"] = true;
  28824. t["Roman"] = true;
  28825. t["Rotis Serif"] = true;
  28826. t["Sabon"] = true;
  28827. t["Scala"] = true;
  28828. t["Seagull"] = true;
  28829. t["Sistina"] = true;
  28830. t["Souvenir"] = true;
  28831. t["STIX"] = true;
  28832. t["Stone Informal"] = true;
  28833. t["Stone Serif"] = true;
  28834. t["Sylfaen"] = true;
  28835. t["Times"] = true;
  28836. t["Trajan"] = true;
  28837. t["Trinité"] = true;
  28838. t["Trump Mediaeval"] = true;
  28839. t["Utopia"] = true;
  28840. t["Vale Type"] = true;
  28841. t["Bitstream Vera"] = true;
  28842. t["Vera Serif"] = true;
  28843. t["Versailles"] = true;
  28844. t["Wanted"] = true;
  28845. t["Weiss"] = true;
  28846. t["Wide Latin"] = true;
  28847. t["Windsor"] = true;
  28848. t["XITS"] = true;
  28849. });
  28850. exports.getSerifFonts = getSerifFonts;
  28851. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  28852. t["Dingbats"] = true;
  28853. t["Symbol"] = true;
  28854. t["ZapfDingbats"] = true;
  28855. });
  28856. exports.getSymbolsFonts = getSymbolsFonts;
  28857. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  28858. t[2] = 10;
  28859. t[3] = 32;
  28860. t[4] = 33;
  28861. t[5] = 34;
  28862. t[6] = 35;
  28863. t[7] = 36;
  28864. t[8] = 37;
  28865. t[9] = 38;
  28866. t[10] = 39;
  28867. t[11] = 40;
  28868. t[12] = 41;
  28869. t[13] = 42;
  28870. t[14] = 43;
  28871. t[15] = 44;
  28872. t[16] = 45;
  28873. t[17] = 46;
  28874. t[18] = 47;
  28875. t[19] = 48;
  28876. t[20] = 49;
  28877. t[21] = 50;
  28878. t[22] = 51;
  28879. t[23] = 52;
  28880. t[24] = 53;
  28881. t[25] = 54;
  28882. t[26] = 55;
  28883. t[27] = 56;
  28884. t[28] = 57;
  28885. t[29] = 58;
  28886. t[30] = 894;
  28887. t[31] = 60;
  28888. t[32] = 61;
  28889. t[33] = 62;
  28890. t[34] = 63;
  28891. t[35] = 64;
  28892. t[36] = 65;
  28893. t[37] = 66;
  28894. t[38] = 67;
  28895. t[39] = 68;
  28896. t[40] = 69;
  28897. t[41] = 70;
  28898. t[42] = 71;
  28899. t[43] = 72;
  28900. t[44] = 73;
  28901. t[45] = 74;
  28902. t[46] = 75;
  28903. t[47] = 76;
  28904. t[48] = 77;
  28905. t[49] = 78;
  28906. t[50] = 79;
  28907. t[51] = 80;
  28908. t[52] = 81;
  28909. t[53] = 82;
  28910. t[54] = 83;
  28911. t[55] = 84;
  28912. t[56] = 85;
  28913. t[57] = 86;
  28914. t[58] = 87;
  28915. t[59] = 88;
  28916. t[60] = 89;
  28917. t[61] = 90;
  28918. t[62] = 91;
  28919. t[63] = 92;
  28920. t[64] = 93;
  28921. t[65] = 94;
  28922. t[66] = 95;
  28923. t[67] = 96;
  28924. t[68] = 97;
  28925. t[69] = 98;
  28926. t[70] = 99;
  28927. t[71] = 100;
  28928. t[72] = 101;
  28929. t[73] = 102;
  28930. t[74] = 103;
  28931. t[75] = 104;
  28932. t[76] = 105;
  28933. t[77] = 106;
  28934. t[78] = 107;
  28935. t[79] = 108;
  28936. t[80] = 109;
  28937. t[81] = 110;
  28938. t[82] = 111;
  28939. t[83] = 112;
  28940. t[84] = 113;
  28941. t[85] = 114;
  28942. t[86] = 115;
  28943. t[87] = 116;
  28944. t[88] = 117;
  28945. t[89] = 118;
  28946. t[90] = 119;
  28947. t[91] = 120;
  28948. t[92] = 121;
  28949. t[93] = 122;
  28950. t[94] = 123;
  28951. t[95] = 124;
  28952. t[96] = 125;
  28953. t[97] = 126;
  28954. t[98] = 196;
  28955. t[99] = 197;
  28956. t[100] = 199;
  28957. t[101] = 201;
  28958. t[102] = 209;
  28959. t[103] = 214;
  28960. t[104] = 220;
  28961. t[105] = 225;
  28962. t[106] = 224;
  28963. t[107] = 226;
  28964. t[108] = 228;
  28965. t[109] = 227;
  28966. t[110] = 229;
  28967. t[111] = 231;
  28968. t[112] = 233;
  28969. t[113] = 232;
  28970. t[114] = 234;
  28971. t[115] = 235;
  28972. t[116] = 237;
  28973. t[117] = 236;
  28974. t[118] = 238;
  28975. t[119] = 239;
  28976. t[120] = 241;
  28977. t[121] = 243;
  28978. t[122] = 242;
  28979. t[123] = 244;
  28980. t[124] = 246;
  28981. t[125] = 245;
  28982. t[126] = 250;
  28983. t[127] = 249;
  28984. t[128] = 251;
  28985. t[129] = 252;
  28986. t[130] = 8224;
  28987. t[131] = 176;
  28988. t[132] = 162;
  28989. t[133] = 163;
  28990. t[134] = 167;
  28991. t[135] = 8226;
  28992. t[136] = 182;
  28993. t[137] = 223;
  28994. t[138] = 174;
  28995. t[139] = 169;
  28996. t[140] = 8482;
  28997. t[141] = 180;
  28998. t[142] = 168;
  28999. t[143] = 8800;
  29000. t[144] = 198;
  29001. t[145] = 216;
  29002. t[146] = 8734;
  29003. t[147] = 177;
  29004. t[148] = 8804;
  29005. t[149] = 8805;
  29006. t[150] = 165;
  29007. t[151] = 181;
  29008. t[152] = 8706;
  29009. t[153] = 8721;
  29010. t[154] = 8719;
  29011. t[156] = 8747;
  29012. t[157] = 170;
  29013. t[158] = 186;
  29014. t[159] = 8486;
  29015. t[160] = 230;
  29016. t[161] = 248;
  29017. t[162] = 191;
  29018. t[163] = 161;
  29019. t[164] = 172;
  29020. t[165] = 8730;
  29021. t[166] = 402;
  29022. t[167] = 8776;
  29023. t[168] = 8710;
  29024. t[169] = 171;
  29025. t[170] = 187;
  29026. t[171] = 8230;
  29027. t[210] = 218;
  29028. t[223] = 711;
  29029. t[224] = 321;
  29030. t[225] = 322;
  29031. t[227] = 353;
  29032. t[229] = 382;
  29033. t[234] = 253;
  29034. t[252] = 263;
  29035. t[253] = 268;
  29036. t[254] = 269;
  29037. t[258] = 258;
  29038. t[260] = 260;
  29039. t[261] = 261;
  29040. t[265] = 280;
  29041. t[266] = 281;
  29042. t[268] = 283;
  29043. t[269] = 313;
  29044. t[275] = 323;
  29045. t[276] = 324;
  29046. t[278] = 328;
  29047. t[284] = 345;
  29048. t[285] = 346;
  29049. t[286] = 347;
  29050. t[292] = 367;
  29051. t[295] = 377;
  29052. t[296] = 378;
  29053. t[298] = 380;
  29054. t[305] = 963;
  29055. t[306] = 964;
  29056. t[307] = 966;
  29057. t[308] = 8215;
  29058. t[309] = 8252;
  29059. t[310] = 8319;
  29060. t[311] = 8359;
  29061. t[312] = 8592;
  29062. t[313] = 8593;
  29063. t[337] = 9552;
  29064. t[493] = 1039;
  29065. t[494] = 1040;
  29066. t[705] = 1524;
  29067. t[706] = 8362;
  29068. t[710] = 64288;
  29069. t[711] = 64298;
  29070. t[759] = 1617;
  29071. t[761] = 1776;
  29072. t[763] = 1778;
  29073. t[775] = 1652;
  29074. t[777] = 1764;
  29075. t[778] = 1780;
  29076. t[779] = 1781;
  29077. t[780] = 1782;
  29078. t[782] = 771;
  29079. t[783] = 64726;
  29080. t[786] = 8363;
  29081. t[788] = 8532;
  29082. t[790] = 768;
  29083. t[791] = 769;
  29084. t[792] = 768;
  29085. t[795] = 803;
  29086. t[797] = 64336;
  29087. t[798] = 64337;
  29088. t[799] = 64342;
  29089. t[800] = 64343;
  29090. t[801] = 64344;
  29091. t[802] = 64345;
  29092. t[803] = 64362;
  29093. t[804] = 64363;
  29094. t[805] = 64364;
  29095. t[2424] = 7821;
  29096. t[2425] = 7822;
  29097. t[2426] = 7823;
  29098. t[2427] = 7824;
  29099. t[2428] = 7825;
  29100. t[2429] = 7826;
  29101. t[2430] = 7827;
  29102. t[2433] = 7682;
  29103. t[2678] = 8045;
  29104. t[2679] = 8046;
  29105. t[2830] = 1552;
  29106. t[2838] = 686;
  29107. t[2840] = 751;
  29108. t[2842] = 753;
  29109. t[2843] = 754;
  29110. t[2844] = 755;
  29111. t[2846] = 757;
  29112. t[2856] = 767;
  29113. t[2857] = 848;
  29114. t[2858] = 849;
  29115. t[2862] = 853;
  29116. t[2863] = 854;
  29117. t[2864] = 855;
  29118. t[2865] = 861;
  29119. t[2866] = 862;
  29120. t[2906] = 7460;
  29121. t[2908] = 7462;
  29122. t[2909] = 7463;
  29123. t[2910] = 7464;
  29124. t[2912] = 7466;
  29125. t[2913] = 7467;
  29126. t[2914] = 7468;
  29127. t[2916] = 7470;
  29128. t[2917] = 7471;
  29129. t[2918] = 7472;
  29130. t[2920] = 7474;
  29131. t[2921] = 7475;
  29132. t[2922] = 7476;
  29133. t[2924] = 7478;
  29134. t[2925] = 7479;
  29135. t[2926] = 7480;
  29136. t[2928] = 7482;
  29137. t[2929] = 7483;
  29138. t[2930] = 7484;
  29139. t[2932] = 7486;
  29140. t[2933] = 7487;
  29141. t[2934] = 7488;
  29142. t[2936] = 7490;
  29143. t[2937] = 7491;
  29144. t[2938] = 7492;
  29145. t[2940] = 7494;
  29146. t[2941] = 7495;
  29147. t[2942] = 7496;
  29148. t[2944] = 7498;
  29149. t[2946] = 7500;
  29150. t[2948] = 7502;
  29151. t[2950] = 7504;
  29152. t[2951] = 7505;
  29153. t[2952] = 7506;
  29154. t[2954] = 7508;
  29155. t[2955] = 7509;
  29156. t[2956] = 7510;
  29157. t[2958] = 7512;
  29158. t[2959] = 7513;
  29159. t[2960] = 7514;
  29160. t[2962] = 7516;
  29161. t[2963] = 7517;
  29162. t[2964] = 7518;
  29163. t[2966] = 7520;
  29164. t[2967] = 7521;
  29165. t[2968] = 7522;
  29166. t[2970] = 7524;
  29167. t[2971] = 7525;
  29168. t[2972] = 7526;
  29169. t[2974] = 7528;
  29170. t[2975] = 7529;
  29171. t[2976] = 7530;
  29172. t[2978] = 1537;
  29173. t[2979] = 1538;
  29174. t[2980] = 1539;
  29175. t[2982] = 1549;
  29176. t[2983] = 1551;
  29177. t[2984] = 1552;
  29178. t[2986] = 1554;
  29179. t[2987] = 1555;
  29180. t[2988] = 1556;
  29181. t[2990] = 1623;
  29182. t[2991] = 1624;
  29183. t[2995] = 1775;
  29184. t[2999] = 1791;
  29185. t[3002] = 64290;
  29186. t[3003] = 64291;
  29187. t[3004] = 64292;
  29188. t[3006] = 64294;
  29189. t[3007] = 64295;
  29190. t[3008] = 64296;
  29191. t[3011] = 1900;
  29192. t[3014] = 8223;
  29193. t[3015] = 8244;
  29194. t[3017] = 7532;
  29195. t[3018] = 7533;
  29196. t[3019] = 7534;
  29197. t[3075] = 7590;
  29198. t[3076] = 7591;
  29199. t[3079] = 7594;
  29200. t[3080] = 7595;
  29201. t[3083] = 7598;
  29202. t[3084] = 7599;
  29203. t[3087] = 7602;
  29204. t[3088] = 7603;
  29205. t[3091] = 7606;
  29206. t[3092] = 7607;
  29207. t[3095] = 7610;
  29208. t[3096] = 7611;
  29209. t[3099] = 7614;
  29210. t[3100] = 7615;
  29211. t[3103] = 7618;
  29212. t[3104] = 7619;
  29213. t[3107] = 8337;
  29214. t[3108] = 8338;
  29215. t[3116] = 1884;
  29216. t[3119] = 1885;
  29217. t[3120] = 1885;
  29218. t[3123] = 1886;
  29219. t[3124] = 1886;
  29220. t[3127] = 1887;
  29221. t[3128] = 1887;
  29222. t[3131] = 1888;
  29223. t[3132] = 1888;
  29224. t[3135] = 1889;
  29225. t[3136] = 1889;
  29226. t[3139] = 1890;
  29227. t[3140] = 1890;
  29228. t[3143] = 1891;
  29229. t[3144] = 1891;
  29230. t[3147] = 1892;
  29231. t[3148] = 1892;
  29232. t[3153] = 580;
  29233. t[3154] = 581;
  29234. t[3157] = 584;
  29235. t[3158] = 585;
  29236. t[3161] = 588;
  29237. t[3162] = 589;
  29238. t[3165] = 891;
  29239. t[3166] = 892;
  29240. t[3169] = 1274;
  29241. t[3170] = 1275;
  29242. t[3173] = 1278;
  29243. t[3174] = 1279;
  29244. t[3181] = 7622;
  29245. t[3182] = 7623;
  29246. t[3282] = 11799;
  29247. t[3316] = 578;
  29248. t[3379] = 42785;
  29249. t[3393] = 1159;
  29250. t[3416] = 8377;
  29251. });
  29252. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  29253. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  29254. t[227] = 322;
  29255. t[264] = 261;
  29256. t[291] = 346;
  29257. });
  29258. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  29259. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  29260. t[1] = 32;
  29261. t[4] = 65;
  29262. t[17] = 66;
  29263. t[18] = 67;
  29264. t[24] = 68;
  29265. t[28] = 69;
  29266. t[38] = 70;
  29267. t[39] = 71;
  29268. t[44] = 72;
  29269. t[47] = 73;
  29270. t[58] = 74;
  29271. t[60] = 75;
  29272. t[62] = 76;
  29273. t[68] = 77;
  29274. t[69] = 78;
  29275. t[75] = 79;
  29276. t[87] = 80;
  29277. t[89] = 81;
  29278. t[90] = 82;
  29279. t[94] = 83;
  29280. t[100] = 84;
  29281. t[104] = 85;
  29282. t[115] = 86;
  29283. t[116] = 87;
  29284. t[121] = 88;
  29285. t[122] = 89;
  29286. t[127] = 90;
  29287. t[258] = 97;
  29288. t[268] = 261;
  29289. t[271] = 98;
  29290. t[272] = 99;
  29291. t[273] = 263;
  29292. t[282] = 100;
  29293. t[286] = 101;
  29294. t[295] = 281;
  29295. t[296] = 102;
  29296. t[336] = 103;
  29297. t[346] = 104;
  29298. t[349] = 105;
  29299. t[361] = 106;
  29300. t[364] = 107;
  29301. t[367] = 108;
  29302. t[371] = 322;
  29303. t[373] = 109;
  29304. t[374] = 110;
  29305. t[381] = 111;
  29306. t[383] = 243;
  29307. t[393] = 112;
  29308. t[395] = 113;
  29309. t[396] = 114;
  29310. t[400] = 115;
  29311. t[401] = 347;
  29312. t[410] = 116;
  29313. t[437] = 117;
  29314. t[448] = 118;
  29315. t[449] = 119;
  29316. t[454] = 120;
  29317. t[455] = 121;
  29318. t[460] = 122;
  29319. t[463] = 380;
  29320. t[853] = 44;
  29321. t[855] = 58;
  29322. t[856] = 46;
  29323. t[876] = 47;
  29324. t[878] = 45;
  29325. t[882] = 45;
  29326. t[894] = 40;
  29327. t[895] = 41;
  29328. t[896] = 91;
  29329. t[897] = 93;
  29330. t[923] = 64;
  29331. t[1004] = 48;
  29332. t[1005] = 49;
  29333. t[1006] = 50;
  29334. t[1007] = 51;
  29335. t[1008] = 52;
  29336. t[1009] = 53;
  29337. t[1010] = 54;
  29338. t[1011] = 55;
  29339. t[1012] = 56;
  29340. t[1013] = 57;
  29341. t[1081] = 37;
  29342. t[1085] = 43;
  29343. t[1086] = 45;
  29344. });
  29345. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  29346. /***/ }),
  29347. /* 33 */
  29348. /***/ (function(module, exports, __w_pdfjs_require__) {
  29349. var getLookupTableFactory = __w_pdfjs_require__(7).getLookupTableFactory;
  29350. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  29351. t[63721] = 0x00a9;
  29352. t[63193] = 0x00a9;
  29353. t[63720] = 0x00ae;
  29354. t[63194] = 0x00ae;
  29355. t[63722] = 0x2122;
  29356. t[63195] = 0x2122;
  29357. t[63729] = 0x23a7;
  29358. t[63730] = 0x23a8;
  29359. t[63731] = 0x23a9;
  29360. t[63740] = 0x23ab;
  29361. t[63741] = 0x23ac;
  29362. t[63742] = 0x23ad;
  29363. t[63726] = 0x23a1;
  29364. t[63727] = 0x23a2;
  29365. t[63728] = 0x23a3;
  29366. t[63737] = 0x23a4;
  29367. t[63738] = 0x23a5;
  29368. t[63739] = 0x23a6;
  29369. t[63723] = 0x239b;
  29370. t[63724] = 0x239c;
  29371. t[63725] = 0x239d;
  29372. t[63734] = 0x239e;
  29373. t[63735] = 0x239f;
  29374. t[63736] = 0x23a0;
  29375. });
  29376. function mapSpecialUnicodeValues(code) {
  29377. if (code >= 0xfff0 && code <= 0xffff) {
  29378. return 0;
  29379. } else if (code >= 0xf600 && code <= 0xf8ff) {
  29380. return getSpecialPUASymbols()[code] || code;
  29381. } else if (code === 0x00ad) {
  29382. return 0x002d;
  29383. }
  29384. return code;
  29385. }
  29386. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  29387. var unicode = glyphsUnicodeMap[name];
  29388. if (unicode !== undefined) {
  29389. return unicode;
  29390. }
  29391. if (!name) {
  29392. return -1;
  29393. }
  29394. if (name[0] === "u") {
  29395. var nameLen = name.length, hexStr;
  29396. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  29397. hexStr = name.substring(3);
  29398. } else if (nameLen >= 5 && nameLen <= 7) {
  29399. hexStr = name.substring(1);
  29400. } else {
  29401. return -1;
  29402. }
  29403. if (hexStr === hexStr.toUpperCase()) {
  29404. unicode = parseInt(hexStr, 16);
  29405. if (unicode >= 0) {
  29406. return unicode;
  29407. }
  29408. }
  29409. }
  29410. return -1;
  29411. }
  29412. var UnicodeRanges = [
  29413. {
  29414. begin: 0x0000,
  29415. end: 0x007f
  29416. },
  29417. {
  29418. begin: 0x0080,
  29419. end: 0x00ff
  29420. },
  29421. {
  29422. begin: 0x0100,
  29423. end: 0x017f
  29424. },
  29425. {
  29426. begin: 0x0180,
  29427. end: 0x024f
  29428. },
  29429. {
  29430. begin: 0x0250,
  29431. end: 0x02af
  29432. },
  29433. {
  29434. begin: 0x02b0,
  29435. end: 0x02ff
  29436. },
  29437. {
  29438. begin: 0x0300,
  29439. end: 0x036f
  29440. },
  29441. {
  29442. begin: 0x0370,
  29443. end: 0x03ff
  29444. },
  29445. {
  29446. begin: 0x2c80,
  29447. end: 0x2cff
  29448. },
  29449. {
  29450. begin: 0x0400,
  29451. end: 0x04ff
  29452. },
  29453. {
  29454. begin: 0x0530,
  29455. end: 0x058f
  29456. },
  29457. {
  29458. begin: 0x0590,
  29459. end: 0x05ff
  29460. },
  29461. {
  29462. begin: 0xa500,
  29463. end: 0xa63f
  29464. },
  29465. {
  29466. begin: 0x0600,
  29467. end: 0x06ff
  29468. },
  29469. {
  29470. begin: 0x07c0,
  29471. end: 0x07ff
  29472. },
  29473. {
  29474. begin: 0x0900,
  29475. end: 0x097f
  29476. },
  29477. {
  29478. begin: 0x0980,
  29479. end: 0x09ff
  29480. },
  29481. {
  29482. begin: 0x0a00,
  29483. end: 0x0a7f
  29484. },
  29485. {
  29486. begin: 0x0a80,
  29487. end: 0x0aff
  29488. },
  29489. {
  29490. begin: 0x0b00,
  29491. end: 0x0b7f
  29492. },
  29493. {
  29494. begin: 0x0b80,
  29495. end: 0x0bff
  29496. },
  29497. {
  29498. begin: 0x0c00,
  29499. end: 0x0c7f
  29500. },
  29501. {
  29502. begin: 0x0c80,
  29503. end: 0x0cff
  29504. },
  29505. {
  29506. begin: 0x0d00,
  29507. end: 0x0d7f
  29508. },
  29509. {
  29510. begin: 0x0e00,
  29511. end: 0x0e7f
  29512. },
  29513. {
  29514. begin: 0x0e80,
  29515. end: 0x0eff
  29516. },
  29517. {
  29518. begin: 0x10a0,
  29519. end: 0x10ff
  29520. },
  29521. {
  29522. begin: 0x1b00,
  29523. end: 0x1b7f
  29524. },
  29525. {
  29526. begin: 0x1100,
  29527. end: 0x11ff
  29528. },
  29529. {
  29530. begin: 0x1e00,
  29531. end: 0x1eff
  29532. },
  29533. {
  29534. begin: 0x1f00,
  29535. end: 0x1fff
  29536. },
  29537. {
  29538. begin: 0x2000,
  29539. end: 0x206f
  29540. },
  29541. {
  29542. begin: 0x2070,
  29543. end: 0x209f
  29544. },
  29545. {
  29546. begin: 0x20a0,
  29547. end: 0x20cf
  29548. },
  29549. {
  29550. begin: 0x20d0,
  29551. end: 0x20ff
  29552. },
  29553. {
  29554. begin: 0x2100,
  29555. end: 0x214f
  29556. },
  29557. {
  29558. begin: 0x2150,
  29559. end: 0x218f
  29560. },
  29561. {
  29562. begin: 0x2190,
  29563. end: 0x21ff
  29564. },
  29565. {
  29566. begin: 0x2200,
  29567. end: 0x22ff
  29568. },
  29569. {
  29570. begin: 0x2300,
  29571. end: 0x23ff
  29572. },
  29573. {
  29574. begin: 0x2400,
  29575. end: 0x243f
  29576. },
  29577. {
  29578. begin: 0x2440,
  29579. end: 0x245f
  29580. },
  29581. {
  29582. begin: 0x2460,
  29583. end: 0x24ff
  29584. },
  29585. {
  29586. begin: 0x2500,
  29587. end: 0x257f
  29588. },
  29589. {
  29590. begin: 0x2580,
  29591. end: 0x259f
  29592. },
  29593. {
  29594. begin: 0x25a0,
  29595. end: 0x25ff
  29596. },
  29597. {
  29598. begin: 0x2600,
  29599. end: 0x26ff
  29600. },
  29601. {
  29602. begin: 0x2700,
  29603. end: 0x27bf
  29604. },
  29605. {
  29606. begin: 0x3000,
  29607. end: 0x303f
  29608. },
  29609. {
  29610. begin: 0x3040,
  29611. end: 0x309f
  29612. },
  29613. {
  29614. begin: 0x30a0,
  29615. end: 0x30ff
  29616. },
  29617. {
  29618. begin: 0x3100,
  29619. end: 0x312f
  29620. },
  29621. {
  29622. begin: 0x3130,
  29623. end: 0x318f
  29624. },
  29625. {
  29626. begin: 0xa840,
  29627. end: 0xa87f
  29628. },
  29629. {
  29630. begin: 0x3200,
  29631. end: 0x32ff
  29632. },
  29633. {
  29634. begin: 0x3300,
  29635. end: 0x33ff
  29636. },
  29637. {
  29638. begin: 0xac00,
  29639. end: 0xd7af
  29640. },
  29641. {
  29642. begin: 0xd800,
  29643. end: 0xdfff
  29644. },
  29645. {
  29646. begin: 0x10900,
  29647. end: 0x1091f
  29648. },
  29649. {
  29650. begin: 0x4e00,
  29651. end: 0x9fff
  29652. },
  29653. {
  29654. begin: 0xe000,
  29655. end: 0xf8ff
  29656. },
  29657. {
  29658. begin: 0x31c0,
  29659. end: 0x31ef
  29660. },
  29661. {
  29662. begin: 0xfb00,
  29663. end: 0xfb4f
  29664. },
  29665. {
  29666. begin: 0xfb50,
  29667. end: 0xfdff
  29668. },
  29669. {
  29670. begin: 0xfe20,
  29671. end: 0xfe2f
  29672. },
  29673. {
  29674. begin: 0xfe10,
  29675. end: 0xfe1f
  29676. },
  29677. {
  29678. begin: 0xfe50,
  29679. end: 0xfe6f
  29680. },
  29681. {
  29682. begin: 0xfe70,
  29683. end: 0xfeff
  29684. },
  29685. {
  29686. begin: 0xff00,
  29687. end: 0xffef
  29688. },
  29689. {
  29690. begin: 0xfff0,
  29691. end: 0xffff
  29692. },
  29693. {
  29694. begin: 0x0f00,
  29695. end: 0x0fff
  29696. },
  29697. {
  29698. begin: 0x0700,
  29699. end: 0x074f
  29700. },
  29701. {
  29702. begin: 0x0780,
  29703. end: 0x07bf
  29704. },
  29705. {
  29706. begin: 0x0d80,
  29707. end: 0x0dff
  29708. },
  29709. {
  29710. begin: 0x1000,
  29711. end: 0x109f
  29712. },
  29713. {
  29714. begin: 0x1200,
  29715. end: 0x137f
  29716. },
  29717. {
  29718. begin: 0x13a0,
  29719. end: 0x13ff
  29720. },
  29721. {
  29722. begin: 0x1400,
  29723. end: 0x167f
  29724. },
  29725. {
  29726. begin: 0x1680,
  29727. end: 0x169f
  29728. },
  29729. {
  29730. begin: 0x16a0,
  29731. end: 0x16ff
  29732. },
  29733. {
  29734. begin: 0x1780,
  29735. end: 0x17ff
  29736. },
  29737. {
  29738. begin: 0x1800,
  29739. end: 0x18af
  29740. },
  29741. {
  29742. begin: 0x2800,
  29743. end: 0x28ff
  29744. },
  29745. {
  29746. begin: 0xa000,
  29747. end: 0xa48f
  29748. },
  29749. {
  29750. begin: 0x1700,
  29751. end: 0x171f
  29752. },
  29753. {
  29754. begin: 0x10300,
  29755. end: 0x1032f
  29756. },
  29757. {
  29758. begin: 0x10330,
  29759. end: 0x1034f
  29760. },
  29761. {
  29762. begin: 0x10400,
  29763. end: 0x1044f
  29764. },
  29765. {
  29766. begin: 0x1d000,
  29767. end: 0x1d0ff
  29768. },
  29769. {
  29770. begin: 0x1d400,
  29771. end: 0x1d7ff
  29772. },
  29773. {
  29774. begin: 0xff000,
  29775. end: 0xffffd
  29776. },
  29777. {
  29778. begin: 0xfe00,
  29779. end: 0xfe0f
  29780. },
  29781. {
  29782. begin: 0xe0000,
  29783. end: 0xe007f
  29784. },
  29785. {
  29786. begin: 0x1900,
  29787. end: 0x194f
  29788. },
  29789. {
  29790. begin: 0x1950,
  29791. end: 0x197f
  29792. },
  29793. {
  29794. begin: 0x1980,
  29795. end: 0x19df
  29796. },
  29797. {
  29798. begin: 0x1a00,
  29799. end: 0x1a1f
  29800. },
  29801. {
  29802. begin: 0x2c00,
  29803. end: 0x2c5f
  29804. },
  29805. {
  29806. begin: 0x2d30,
  29807. end: 0x2d7f
  29808. },
  29809. {
  29810. begin: 0x4dc0,
  29811. end: 0x4dff
  29812. },
  29813. {
  29814. begin: 0xa800,
  29815. end: 0xa82f
  29816. },
  29817. {
  29818. begin: 0x10000,
  29819. end: 0x1007f
  29820. },
  29821. {
  29822. begin: 0x10140,
  29823. end: 0x1018f
  29824. },
  29825. {
  29826. begin: 0x10380,
  29827. end: 0x1039f
  29828. },
  29829. {
  29830. begin: 0x103a0,
  29831. end: 0x103df
  29832. },
  29833. {
  29834. begin: 0x10450,
  29835. end: 0x1047f
  29836. },
  29837. {
  29838. begin: 0x10480,
  29839. end: 0x104af
  29840. },
  29841. {
  29842. begin: 0x10800,
  29843. end: 0x1083f
  29844. },
  29845. {
  29846. begin: 0x10a00,
  29847. end: 0x10a5f
  29848. },
  29849. {
  29850. begin: 0x1d300,
  29851. end: 0x1d35f
  29852. },
  29853. {
  29854. begin: 0x12000,
  29855. end: 0x123ff
  29856. },
  29857. {
  29858. begin: 0x1d360,
  29859. end: 0x1d37f
  29860. },
  29861. {
  29862. begin: 0x1b80,
  29863. end: 0x1bbf
  29864. },
  29865. {
  29866. begin: 0x1c00,
  29867. end: 0x1c4f
  29868. },
  29869. {
  29870. begin: 0x1c50,
  29871. end: 0x1c7f
  29872. },
  29873. {
  29874. begin: 0xa880,
  29875. end: 0xa8df
  29876. },
  29877. {
  29878. begin: 0xa900,
  29879. end: 0xa92f
  29880. },
  29881. {
  29882. begin: 0xa930,
  29883. end: 0xa95f
  29884. },
  29885. {
  29886. begin: 0xaa00,
  29887. end: 0xaa5f
  29888. },
  29889. {
  29890. begin: 0x10190,
  29891. end: 0x101cf
  29892. },
  29893. {
  29894. begin: 0x101d0,
  29895. end: 0x101ff
  29896. },
  29897. {
  29898. begin: 0x102a0,
  29899. end: 0x102df
  29900. },
  29901. {
  29902. begin: 0x1f030,
  29903. end: 0x1f09f
  29904. }
  29905. ];
  29906. function getUnicodeRangeFor(value) {
  29907. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  29908. var range = UnicodeRanges[i];
  29909. if (value >= range.begin && value < range.end) {
  29910. return i;
  29911. }
  29912. }
  29913. return -1;
  29914. }
  29915. function isRTLRangeFor(value) {
  29916. var range = UnicodeRanges[13];
  29917. if (value >= range.begin && value < range.end) {
  29918. return true;
  29919. }
  29920. range = UnicodeRanges[11];
  29921. if (value >= range.begin && value < range.end) {
  29922. return true;
  29923. }
  29924. return false;
  29925. }
  29926. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  29927. t["\u00A8"] = "\u0020\u0308";
  29928. t["\u00AF"] = "\u0020\u0304";
  29929. t["\u00B4"] = "\u0020\u0301";
  29930. t["\u00B5"] = "\u03BC";
  29931. t["\u00B8"] = "\u0020\u0327";
  29932. t["\u0132"] = "\u0049\u004A";
  29933. t["\u0133"] = "\u0069\u006A";
  29934. t["\u013F"] = "\u004C\u00B7";
  29935. t["\u0140"] = "\u006C\u00B7";
  29936. t["\u0149"] = "\u02BC\u006E";
  29937. t["\u017F"] = "\u0073";
  29938. t["\u01C4"] = "\u0044\u017D";
  29939. t["\u01C5"] = "\u0044\u017E";
  29940. t["\u01C6"] = "\u0064\u017E";
  29941. t["\u01C7"] = "\u004C\u004A";
  29942. t["\u01C8"] = "\u004C\u006A";
  29943. t["\u01C9"] = "\u006C\u006A";
  29944. t["\u01CA"] = "\u004E\u004A";
  29945. t["\u01CB"] = "\u004E\u006A";
  29946. t["\u01CC"] = "\u006E\u006A";
  29947. t["\u01F1"] = "\u0044\u005A";
  29948. t["\u01F2"] = "\u0044\u007A";
  29949. t["\u01F3"] = "\u0064\u007A";
  29950. t["\u02D8"] = "\u0020\u0306";
  29951. t["\u02D9"] = "\u0020\u0307";
  29952. t["\u02DA"] = "\u0020\u030A";
  29953. t["\u02DB"] = "\u0020\u0328";
  29954. t["\u02DC"] = "\u0020\u0303";
  29955. t["\u02DD"] = "\u0020\u030B";
  29956. t["\u037A"] = "\u0020\u0345";
  29957. t["\u0384"] = "\u0020\u0301";
  29958. t["\u03D0"] = "\u03B2";
  29959. t["\u03D1"] = "\u03B8";
  29960. t["\u03D2"] = "\u03A5";
  29961. t["\u03D5"] = "\u03C6";
  29962. t["\u03D6"] = "\u03C0";
  29963. t["\u03F0"] = "\u03BA";
  29964. t["\u03F1"] = "\u03C1";
  29965. t["\u03F2"] = "\u03C2";
  29966. t["\u03F4"] = "\u0398";
  29967. t["\u03F5"] = "\u03B5";
  29968. t["\u03F9"] = "\u03A3";
  29969. t["\u0587"] = "\u0565\u0582";
  29970. t["\u0675"] = "\u0627\u0674";
  29971. t["\u0676"] = "\u0648\u0674";
  29972. t["\u0677"] = "\u06C7\u0674";
  29973. t["\u0678"] = "\u064A\u0674";
  29974. t["\u0E33"] = "\u0E4D\u0E32";
  29975. t["\u0EB3"] = "\u0ECD\u0EB2";
  29976. t["\u0EDC"] = "\u0EAB\u0E99";
  29977. t["\u0EDD"] = "\u0EAB\u0EA1";
  29978. t["\u0F77"] = "\u0FB2\u0F81";
  29979. t["\u0F79"] = "\u0FB3\u0F81";
  29980. t["\u1E9A"] = "\u0061\u02BE";
  29981. t["\u1FBD"] = "\u0020\u0313";
  29982. t["\u1FBF"] = "\u0020\u0313";
  29983. t["\u1FC0"] = "\u0020\u0342";
  29984. t["\u1FFE"] = "\u0020\u0314";
  29985. t["\u2002"] = "\u0020";
  29986. t["\u2003"] = "\u0020";
  29987. t["\u2004"] = "\u0020";
  29988. t["\u2005"] = "\u0020";
  29989. t["\u2006"] = "\u0020";
  29990. t["\u2008"] = "\u0020";
  29991. t["\u2009"] = "\u0020";
  29992. t["\u200A"] = "\u0020";
  29993. t["\u2017"] = "\u0020\u0333";
  29994. t["\u2024"] = "\u002E";
  29995. t["\u2025"] = "\u002E\u002E";
  29996. t["\u2026"] = "\u002E\u002E\u002E";
  29997. t["\u2033"] = "\u2032\u2032";
  29998. t["\u2034"] = "\u2032\u2032\u2032";
  29999. t["\u2036"] = "\u2035\u2035";
  30000. t["\u2037"] = "\u2035\u2035\u2035";
  30001. t["\u203C"] = "\u0021\u0021";
  30002. t["\u203E"] = "\u0020\u0305";
  30003. t["\u2047"] = "\u003F\u003F";
  30004. t["\u2048"] = "\u003F\u0021";
  30005. t["\u2049"] = "\u0021\u003F";
  30006. t["\u2057"] = "\u2032\u2032\u2032\u2032";
  30007. t["\u205F"] = "\u0020";
  30008. t["\u20A8"] = "\u0052\u0073";
  30009. t["\u2100"] = "\u0061\u002F\u0063";
  30010. t["\u2101"] = "\u0061\u002F\u0073";
  30011. t["\u2103"] = "\u00B0\u0043";
  30012. t["\u2105"] = "\u0063\u002F\u006F";
  30013. t["\u2106"] = "\u0063\u002F\u0075";
  30014. t["\u2107"] = "\u0190";
  30015. t["\u2109"] = "\u00B0\u0046";
  30016. t["\u2116"] = "\u004E\u006F";
  30017. t["\u2121"] = "\u0054\u0045\u004C";
  30018. t["\u2135"] = "\u05D0";
  30019. t["\u2136"] = "\u05D1";
  30020. t["\u2137"] = "\u05D2";
  30021. t["\u2138"] = "\u05D3";
  30022. t["\u213B"] = "\u0046\u0041\u0058";
  30023. t["\u2160"] = "\u0049";
  30024. t["\u2161"] = "\u0049\u0049";
  30025. t["\u2162"] = "\u0049\u0049\u0049";
  30026. t["\u2163"] = "\u0049\u0056";
  30027. t["\u2164"] = "\u0056";
  30028. t["\u2165"] = "\u0056\u0049";
  30029. t["\u2166"] = "\u0056\u0049\u0049";
  30030. t["\u2167"] = "\u0056\u0049\u0049\u0049";
  30031. t["\u2168"] = "\u0049\u0058";
  30032. t["\u2169"] = "\u0058";
  30033. t["\u216A"] = "\u0058\u0049";
  30034. t["\u216B"] = "\u0058\u0049\u0049";
  30035. t["\u216C"] = "\u004C";
  30036. t["\u216D"] = "\u0043";
  30037. t["\u216E"] = "\u0044";
  30038. t["\u216F"] = "\u004D";
  30039. t["\u2170"] = "\u0069";
  30040. t["\u2171"] = "\u0069\u0069";
  30041. t["\u2172"] = "\u0069\u0069\u0069";
  30042. t["\u2173"] = "\u0069\u0076";
  30043. t["\u2174"] = "\u0076";
  30044. t["\u2175"] = "\u0076\u0069";
  30045. t["\u2176"] = "\u0076\u0069\u0069";
  30046. t["\u2177"] = "\u0076\u0069\u0069\u0069";
  30047. t["\u2178"] = "\u0069\u0078";
  30048. t["\u2179"] = "\u0078";
  30049. t["\u217A"] = "\u0078\u0069";
  30050. t["\u217B"] = "\u0078\u0069\u0069";
  30051. t["\u217C"] = "\u006C";
  30052. t["\u217D"] = "\u0063";
  30053. t["\u217E"] = "\u0064";
  30054. t["\u217F"] = "\u006D";
  30055. t["\u222C"] = "\u222B\u222B";
  30056. t["\u222D"] = "\u222B\u222B\u222B";
  30057. t["\u222F"] = "\u222E\u222E";
  30058. t["\u2230"] = "\u222E\u222E\u222E";
  30059. t["\u2474"] = "\u0028\u0031\u0029";
  30060. t["\u2475"] = "\u0028\u0032\u0029";
  30061. t["\u2476"] = "\u0028\u0033\u0029";
  30062. t["\u2477"] = "\u0028\u0034\u0029";
  30063. t["\u2478"] = "\u0028\u0035\u0029";
  30064. t["\u2479"] = "\u0028\u0036\u0029";
  30065. t["\u247A"] = "\u0028\u0037\u0029";
  30066. t["\u247B"] = "\u0028\u0038\u0029";
  30067. t["\u247C"] = "\u0028\u0039\u0029";
  30068. t["\u247D"] = "\u0028\u0031\u0030\u0029";
  30069. t["\u247E"] = "\u0028\u0031\u0031\u0029";
  30070. t["\u247F"] = "\u0028\u0031\u0032\u0029";
  30071. t["\u2480"] = "\u0028\u0031\u0033\u0029";
  30072. t["\u2481"] = "\u0028\u0031\u0034\u0029";
  30073. t["\u2482"] = "\u0028\u0031\u0035\u0029";
  30074. t["\u2483"] = "\u0028\u0031\u0036\u0029";
  30075. t["\u2484"] = "\u0028\u0031\u0037\u0029";
  30076. t["\u2485"] = "\u0028\u0031\u0038\u0029";
  30077. t["\u2486"] = "\u0028\u0031\u0039\u0029";
  30078. t["\u2487"] = "\u0028\u0032\u0030\u0029";
  30079. t["\u2488"] = "\u0031\u002E";
  30080. t["\u2489"] = "\u0032\u002E";
  30081. t["\u248A"] = "\u0033\u002E";
  30082. t["\u248B"] = "\u0034\u002E";
  30083. t["\u248C"] = "\u0035\u002E";
  30084. t["\u248D"] = "\u0036\u002E";
  30085. t["\u248E"] = "\u0037\u002E";
  30086. t["\u248F"] = "\u0038\u002E";
  30087. t["\u2490"] = "\u0039\u002E";
  30088. t["\u2491"] = "\u0031\u0030\u002E";
  30089. t["\u2492"] = "\u0031\u0031\u002E";
  30090. t["\u2493"] = "\u0031\u0032\u002E";
  30091. t["\u2494"] = "\u0031\u0033\u002E";
  30092. t["\u2495"] = "\u0031\u0034\u002E";
  30093. t["\u2496"] = "\u0031\u0035\u002E";
  30094. t["\u2497"] = "\u0031\u0036\u002E";
  30095. t["\u2498"] = "\u0031\u0037\u002E";
  30096. t["\u2499"] = "\u0031\u0038\u002E";
  30097. t["\u249A"] = "\u0031\u0039\u002E";
  30098. t["\u249B"] = "\u0032\u0030\u002E";
  30099. t["\u249C"] = "\u0028\u0061\u0029";
  30100. t["\u249D"] = "\u0028\u0062\u0029";
  30101. t["\u249E"] = "\u0028\u0063\u0029";
  30102. t["\u249F"] = "\u0028\u0064\u0029";
  30103. t["\u24A0"] = "\u0028\u0065\u0029";
  30104. t["\u24A1"] = "\u0028\u0066\u0029";
  30105. t["\u24A2"] = "\u0028\u0067\u0029";
  30106. t["\u24A3"] = "\u0028\u0068\u0029";
  30107. t["\u24A4"] = "\u0028\u0069\u0029";
  30108. t["\u24A5"] = "\u0028\u006A\u0029";
  30109. t["\u24A6"] = "\u0028\u006B\u0029";
  30110. t["\u24A7"] = "\u0028\u006C\u0029";
  30111. t["\u24A8"] = "\u0028\u006D\u0029";
  30112. t["\u24A9"] = "\u0028\u006E\u0029";
  30113. t["\u24AA"] = "\u0028\u006F\u0029";
  30114. t["\u24AB"] = "\u0028\u0070\u0029";
  30115. t["\u24AC"] = "\u0028\u0071\u0029";
  30116. t["\u24AD"] = "\u0028\u0072\u0029";
  30117. t["\u24AE"] = "\u0028\u0073\u0029";
  30118. t["\u24AF"] = "\u0028\u0074\u0029";
  30119. t["\u24B0"] = "\u0028\u0075\u0029";
  30120. t["\u24B1"] = "\u0028\u0076\u0029";
  30121. t["\u24B2"] = "\u0028\u0077\u0029";
  30122. t["\u24B3"] = "\u0028\u0078\u0029";
  30123. t["\u24B4"] = "\u0028\u0079\u0029";
  30124. t["\u24B5"] = "\u0028\u007A\u0029";
  30125. t["\u2A0C"] = "\u222B\u222B\u222B\u222B";
  30126. t["\u2A74"] = "\u003A\u003A\u003D";
  30127. t["\u2A75"] = "\u003D\u003D";
  30128. t["\u2A76"] = "\u003D\u003D\u003D";
  30129. t["\u2E9F"] = "\u6BCD";
  30130. t["\u2EF3"] = "\u9F9F";
  30131. t["\u2F00"] = "\u4E00";
  30132. t["\u2F01"] = "\u4E28";
  30133. t["\u2F02"] = "\u4E36";
  30134. t["\u2F03"] = "\u4E3F";
  30135. t["\u2F04"] = "\u4E59";
  30136. t["\u2F05"] = "\u4E85";
  30137. t["\u2F06"] = "\u4E8C";
  30138. t["\u2F07"] = "\u4EA0";
  30139. t["\u2F08"] = "\u4EBA";
  30140. t["\u2F09"] = "\u513F";
  30141. t["\u2F0A"] = "\u5165";
  30142. t["\u2F0B"] = "\u516B";
  30143. t["\u2F0C"] = "\u5182";
  30144. t["\u2F0D"] = "\u5196";
  30145. t["\u2F0E"] = "\u51AB";
  30146. t["\u2F0F"] = "\u51E0";
  30147. t["\u2F10"] = "\u51F5";
  30148. t["\u2F11"] = "\u5200";
  30149. t["\u2F12"] = "\u529B";
  30150. t["\u2F13"] = "\u52F9";
  30151. t["\u2F14"] = "\u5315";
  30152. t["\u2F15"] = "\u531A";
  30153. t["\u2F16"] = "\u5338";
  30154. t["\u2F17"] = "\u5341";
  30155. t["\u2F18"] = "\u535C";
  30156. t["\u2F19"] = "\u5369";
  30157. t["\u2F1A"] = "\u5382";
  30158. t["\u2F1B"] = "\u53B6";
  30159. t["\u2F1C"] = "\u53C8";
  30160. t["\u2F1D"] = "\u53E3";
  30161. t["\u2F1E"] = "\u56D7";
  30162. t["\u2F1F"] = "\u571F";
  30163. t["\u2F20"] = "\u58EB";
  30164. t["\u2F21"] = "\u5902";
  30165. t["\u2F22"] = "\u590A";
  30166. t["\u2F23"] = "\u5915";
  30167. t["\u2F24"] = "\u5927";
  30168. t["\u2F25"] = "\u5973";
  30169. t["\u2F26"] = "\u5B50";
  30170. t["\u2F27"] = "\u5B80";
  30171. t["\u2F28"] = "\u5BF8";
  30172. t["\u2F29"] = "\u5C0F";
  30173. t["\u2F2A"] = "\u5C22";
  30174. t["\u2F2B"] = "\u5C38";
  30175. t["\u2F2C"] = "\u5C6E";
  30176. t["\u2F2D"] = "\u5C71";
  30177. t["\u2F2E"] = "\u5DDB";
  30178. t["\u2F2F"] = "\u5DE5";
  30179. t["\u2F30"] = "\u5DF1";
  30180. t["\u2F31"] = "\u5DFE";
  30181. t["\u2F32"] = "\u5E72";
  30182. t["\u2F33"] = "\u5E7A";
  30183. t["\u2F34"] = "\u5E7F";
  30184. t["\u2F35"] = "\u5EF4";
  30185. t["\u2F36"] = "\u5EFE";
  30186. t["\u2F37"] = "\u5F0B";
  30187. t["\u2F38"] = "\u5F13";
  30188. t["\u2F39"] = "\u5F50";
  30189. t["\u2F3A"] = "\u5F61";
  30190. t["\u2F3B"] = "\u5F73";
  30191. t["\u2F3C"] = "\u5FC3";
  30192. t["\u2F3D"] = "\u6208";
  30193. t["\u2F3E"] = "\u6236";
  30194. t["\u2F3F"] = "\u624B";
  30195. t["\u2F40"] = "\u652F";
  30196. t["\u2F41"] = "\u6534";
  30197. t["\u2F42"] = "\u6587";
  30198. t["\u2F43"] = "\u6597";
  30199. t["\u2F44"] = "\u65A4";
  30200. t["\u2F45"] = "\u65B9";
  30201. t["\u2F46"] = "\u65E0";
  30202. t["\u2F47"] = "\u65E5";
  30203. t["\u2F48"] = "\u66F0";
  30204. t["\u2F49"] = "\u6708";
  30205. t["\u2F4A"] = "\u6728";
  30206. t["\u2F4B"] = "\u6B20";
  30207. t["\u2F4C"] = "\u6B62";
  30208. t["\u2F4D"] = "\u6B79";
  30209. t["\u2F4E"] = "\u6BB3";
  30210. t["\u2F4F"] = "\u6BCB";
  30211. t["\u2F50"] = "\u6BD4";
  30212. t["\u2F51"] = "\u6BDB";
  30213. t["\u2F52"] = "\u6C0F";
  30214. t["\u2F53"] = "\u6C14";
  30215. t["\u2F54"] = "\u6C34";
  30216. t["\u2F55"] = "\u706B";
  30217. t["\u2F56"] = "\u722A";
  30218. t["\u2F57"] = "\u7236";
  30219. t["\u2F58"] = "\u723B";
  30220. t["\u2F59"] = "\u723F";
  30221. t["\u2F5A"] = "\u7247";
  30222. t["\u2F5B"] = "\u7259";
  30223. t["\u2F5C"] = "\u725B";
  30224. t["\u2F5D"] = "\u72AC";
  30225. t["\u2F5E"] = "\u7384";
  30226. t["\u2F5F"] = "\u7389";
  30227. t["\u2F60"] = "\u74DC";
  30228. t["\u2F61"] = "\u74E6";
  30229. t["\u2F62"] = "\u7518";
  30230. t["\u2F63"] = "\u751F";
  30231. t["\u2F64"] = "\u7528";
  30232. t["\u2F65"] = "\u7530";
  30233. t["\u2F66"] = "\u758B";
  30234. t["\u2F67"] = "\u7592";
  30235. t["\u2F68"] = "\u7676";
  30236. t["\u2F69"] = "\u767D";
  30237. t["\u2F6A"] = "\u76AE";
  30238. t["\u2F6B"] = "\u76BF";
  30239. t["\u2F6C"] = "\u76EE";
  30240. t["\u2F6D"] = "\u77DB";
  30241. t["\u2F6E"] = "\u77E2";
  30242. t["\u2F6F"] = "\u77F3";
  30243. t["\u2F70"] = "\u793A";
  30244. t["\u2F71"] = "\u79B8";
  30245. t["\u2F72"] = "\u79BE";
  30246. t["\u2F73"] = "\u7A74";
  30247. t["\u2F74"] = "\u7ACB";
  30248. t["\u2F75"] = "\u7AF9";
  30249. t["\u2F76"] = "\u7C73";
  30250. t["\u2F77"] = "\u7CF8";
  30251. t["\u2F78"] = "\u7F36";
  30252. t["\u2F79"] = "\u7F51";
  30253. t["\u2F7A"] = "\u7F8A";
  30254. t["\u2F7B"] = "\u7FBD";
  30255. t["\u2F7C"] = "\u8001";
  30256. t["\u2F7D"] = "\u800C";
  30257. t["\u2F7E"] = "\u8012";
  30258. t["\u2F7F"] = "\u8033";
  30259. t["\u2F80"] = "\u807F";
  30260. t["\u2F81"] = "\u8089";
  30261. t["\u2F82"] = "\u81E3";
  30262. t["\u2F83"] = "\u81EA";
  30263. t["\u2F84"] = "\u81F3";
  30264. t["\u2F85"] = "\u81FC";
  30265. t["\u2F86"] = "\u820C";
  30266. t["\u2F87"] = "\u821B";
  30267. t["\u2F88"] = "\u821F";
  30268. t["\u2F89"] = "\u826E";
  30269. t["\u2F8A"] = "\u8272";
  30270. t["\u2F8B"] = "\u8278";
  30271. t["\u2F8C"] = "\u864D";
  30272. t["\u2F8D"] = "\u866B";
  30273. t["\u2F8E"] = "\u8840";
  30274. t["\u2F8F"] = "\u884C";
  30275. t["\u2F90"] = "\u8863";
  30276. t["\u2F91"] = "\u897E";
  30277. t["\u2F92"] = "\u898B";
  30278. t["\u2F93"] = "\u89D2";
  30279. t["\u2F94"] = "\u8A00";
  30280. t["\u2F95"] = "\u8C37";
  30281. t["\u2F96"] = "\u8C46";
  30282. t["\u2F97"] = "\u8C55";
  30283. t["\u2F98"] = "\u8C78";
  30284. t["\u2F99"] = "\u8C9D";
  30285. t["\u2F9A"] = "\u8D64";
  30286. t["\u2F9B"] = "\u8D70";
  30287. t["\u2F9C"] = "\u8DB3";
  30288. t["\u2F9D"] = "\u8EAB";
  30289. t["\u2F9E"] = "\u8ECA";
  30290. t["\u2F9F"] = "\u8F9B";
  30291. t["\u2FA0"] = "\u8FB0";
  30292. t["\u2FA1"] = "\u8FB5";
  30293. t["\u2FA2"] = "\u9091";
  30294. t["\u2FA3"] = "\u9149";
  30295. t["\u2FA4"] = "\u91C6";
  30296. t["\u2FA5"] = "\u91CC";
  30297. t["\u2FA6"] = "\u91D1";
  30298. t["\u2FA7"] = "\u9577";
  30299. t["\u2FA8"] = "\u9580";
  30300. t["\u2FA9"] = "\u961C";
  30301. t["\u2FAA"] = "\u96B6";
  30302. t["\u2FAB"] = "\u96B9";
  30303. t["\u2FAC"] = "\u96E8";
  30304. t["\u2FAD"] = "\u9751";
  30305. t["\u2FAE"] = "\u975E";
  30306. t["\u2FAF"] = "\u9762";
  30307. t["\u2FB0"] = "\u9769";
  30308. t["\u2FB1"] = "\u97CB";
  30309. t["\u2FB2"] = "\u97ED";
  30310. t["\u2FB3"] = "\u97F3";
  30311. t["\u2FB4"] = "\u9801";
  30312. t["\u2FB5"] = "\u98A8";
  30313. t["\u2FB6"] = "\u98DB";
  30314. t["\u2FB7"] = "\u98DF";
  30315. t["\u2FB8"] = "\u9996";
  30316. t["\u2FB9"] = "\u9999";
  30317. t["\u2FBA"] = "\u99AC";
  30318. t["\u2FBB"] = "\u9AA8";
  30319. t["\u2FBC"] = "\u9AD8";
  30320. t["\u2FBD"] = "\u9ADF";
  30321. t["\u2FBE"] = "\u9B25";
  30322. t["\u2FBF"] = "\u9B2F";
  30323. t["\u2FC0"] = "\u9B32";
  30324. t["\u2FC1"] = "\u9B3C";
  30325. t["\u2FC2"] = "\u9B5A";
  30326. t["\u2FC3"] = "\u9CE5";
  30327. t["\u2FC4"] = "\u9E75";
  30328. t["\u2FC5"] = "\u9E7F";
  30329. t["\u2FC6"] = "\u9EA5";
  30330. t["\u2FC7"] = "\u9EBB";
  30331. t["\u2FC8"] = "\u9EC3";
  30332. t["\u2FC9"] = "\u9ECD";
  30333. t["\u2FCA"] = "\u9ED1";
  30334. t["\u2FCB"] = "\u9EF9";
  30335. t["\u2FCC"] = "\u9EFD";
  30336. t["\u2FCD"] = "\u9F0E";
  30337. t["\u2FCE"] = "\u9F13";
  30338. t["\u2FCF"] = "\u9F20";
  30339. t["\u2FD0"] = "\u9F3B";
  30340. t["\u2FD1"] = "\u9F4A";
  30341. t["\u2FD2"] = "\u9F52";
  30342. t["\u2FD3"] = "\u9F8D";
  30343. t["\u2FD4"] = "\u9F9C";
  30344. t["\u2FD5"] = "\u9FA0";
  30345. t["\u3036"] = "\u3012";
  30346. t["\u3038"] = "\u5341";
  30347. t["\u3039"] = "\u5344";
  30348. t["\u303A"] = "\u5345";
  30349. t["\u309B"] = "\u0020\u3099";
  30350. t["\u309C"] = "\u0020\u309A";
  30351. t["\u3131"] = "\u1100";
  30352. t["\u3132"] = "\u1101";
  30353. t["\u3133"] = "\u11AA";
  30354. t["\u3134"] = "\u1102";
  30355. t["\u3135"] = "\u11AC";
  30356. t["\u3136"] = "\u11AD";
  30357. t["\u3137"] = "\u1103";
  30358. t["\u3138"] = "\u1104";
  30359. t["\u3139"] = "\u1105";
  30360. t["\u313A"] = "\u11B0";
  30361. t["\u313B"] = "\u11B1";
  30362. t["\u313C"] = "\u11B2";
  30363. t["\u313D"] = "\u11B3";
  30364. t["\u313E"] = "\u11B4";
  30365. t["\u313F"] = "\u11B5";
  30366. t["\u3140"] = "\u111A";
  30367. t["\u3141"] = "\u1106";
  30368. t["\u3142"] = "\u1107";
  30369. t["\u3143"] = "\u1108";
  30370. t["\u3144"] = "\u1121";
  30371. t["\u3145"] = "\u1109";
  30372. t["\u3146"] = "\u110A";
  30373. t["\u3147"] = "\u110B";
  30374. t["\u3148"] = "\u110C";
  30375. t["\u3149"] = "\u110D";
  30376. t["\u314A"] = "\u110E";
  30377. t["\u314B"] = "\u110F";
  30378. t["\u314C"] = "\u1110";
  30379. t["\u314D"] = "\u1111";
  30380. t["\u314E"] = "\u1112";
  30381. t["\u314F"] = "\u1161";
  30382. t["\u3150"] = "\u1162";
  30383. t["\u3151"] = "\u1163";
  30384. t["\u3152"] = "\u1164";
  30385. t["\u3153"] = "\u1165";
  30386. t["\u3154"] = "\u1166";
  30387. t["\u3155"] = "\u1167";
  30388. t["\u3156"] = "\u1168";
  30389. t["\u3157"] = "\u1169";
  30390. t["\u3158"] = "\u116A";
  30391. t["\u3159"] = "\u116B";
  30392. t["\u315A"] = "\u116C";
  30393. t["\u315B"] = "\u116D";
  30394. t["\u315C"] = "\u116E";
  30395. t["\u315D"] = "\u116F";
  30396. t["\u315E"] = "\u1170";
  30397. t["\u315F"] = "\u1171";
  30398. t["\u3160"] = "\u1172";
  30399. t["\u3161"] = "\u1173";
  30400. t["\u3162"] = "\u1174";
  30401. t["\u3163"] = "\u1175";
  30402. t["\u3164"] = "\u1160";
  30403. t["\u3165"] = "\u1114";
  30404. t["\u3166"] = "\u1115";
  30405. t["\u3167"] = "\u11C7";
  30406. t["\u3168"] = "\u11C8";
  30407. t["\u3169"] = "\u11CC";
  30408. t["\u316A"] = "\u11CE";
  30409. t["\u316B"] = "\u11D3";
  30410. t["\u316C"] = "\u11D7";
  30411. t["\u316D"] = "\u11D9";
  30412. t["\u316E"] = "\u111C";
  30413. t["\u316F"] = "\u11DD";
  30414. t["\u3170"] = "\u11DF";
  30415. t["\u3171"] = "\u111D";
  30416. t["\u3172"] = "\u111E";
  30417. t["\u3173"] = "\u1120";
  30418. t["\u3174"] = "\u1122";
  30419. t["\u3175"] = "\u1123";
  30420. t["\u3176"] = "\u1127";
  30421. t["\u3177"] = "\u1129";
  30422. t["\u3178"] = "\u112B";
  30423. t["\u3179"] = "\u112C";
  30424. t["\u317A"] = "\u112D";
  30425. t["\u317B"] = "\u112E";
  30426. t["\u317C"] = "\u112F";
  30427. t["\u317D"] = "\u1132";
  30428. t["\u317E"] = "\u1136";
  30429. t["\u317F"] = "\u1140";
  30430. t["\u3180"] = "\u1147";
  30431. t["\u3181"] = "\u114C";
  30432. t["\u3182"] = "\u11F1";
  30433. t["\u3183"] = "\u11F2";
  30434. t["\u3184"] = "\u1157";
  30435. t["\u3185"] = "\u1158";
  30436. t["\u3186"] = "\u1159";
  30437. t["\u3187"] = "\u1184";
  30438. t["\u3188"] = "\u1185";
  30439. t["\u3189"] = "\u1188";
  30440. t["\u318A"] = "\u1191";
  30441. t["\u318B"] = "\u1192";
  30442. t["\u318C"] = "\u1194";
  30443. t["\u318D"] = "\u119E";
  30444. t["\u318E"] = "\u11A1";
  30445. t["\u3200"] = "\u0028\u1100\u0029";
  30446. t["\u3201"] = "\u0028\u1102\u0029";
  30447. t["\u3202"] = "\u0028\u1103\u0029";
  30448. t["\u3203"] = "\u0028\u1105\u0029";
  30449. t["\u3204"] = "\u0028\u1106\u0029";
  30450. t["\u3205"] = "\u0028\u1107\u0029";
  30451. t["\u3206"] = "\u0028\u1109\u0029";
  30452. t["\u3207"] = "\u0028\u110B\u0029";
  30453. t["\u3208"] = "\u0028\u110C\u0029";
  30454. t["\u3209"] = "\u0028\u110E\u0029";
  30455. t["\u320A"] = "\u0028\u110F\u0029";
  30456. t["\u320B"] = "\u0028\u1110\u0029";
  30457. t["\u320C"] = "\u0028\u1111\u0029";
  30458. t["\u320D"] = "\u0028\u1112\u0029";
  30459. t["\u320E"] = "\u0028\u1100\u1161\u0029";
  30460. t["\u320F"] = "\u0028\u1102\u1161\u0029";
  30461. t["\u3210"] = "\u0028\u1103\u1161\u0029";
  30462. t["\u3211"] = "\u0028\u1105\u1161\u0029";
  30463. t["\u3212"] = "\u0028\u1106\u1161\u0029";
  30464. t["\u3213"] = "\u0028\u1107\u1161\u0029";
  30465. t["\u3214"] = "\u0028\u1109\u1161\u0029";
  30466. t["\u3215"] = "\u0028\u110B\u1161\u0029";
  30467. t["\u3216"] = "\u0028\u110C\u1161\u0029";
  30468. t["\u3217"] = "\u0028\u110E\u1161\u0029";
  30469. t["\u3218"] = "\u0028\u110F\u1161\u0029";
  30470. t["\u3219"] = "\u0028\u1110\u1161\u0029";
  30471. t["\u321A"] = "\u0028\u1111\u1161\u0029";
  30472. t["\u321B"] = "\u0028\u1112\u1161\u0029";
  30473. t["\u321C"] = "\u0028\u110C\u116E\u0029";
  30474. t["\u321D"] = "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029";
  30475. t["\u321E"] = "\u0028\u110B\u1169\u1112\u116E\u0029";
  30476. t["\u3220"] = "\u0028\u4E00\u0029";
  30477. t["\u3221"] = "\u0028\u4E8C\u0029";
  30478. t["\u3222"] = "\u0028\u4E09\u0029";
  30479. t["\u3223"] = "\u0028\u56DB\u0029";
  30480. t["\u3224"] = "\u0028\u4E94\u0029";
  30481. t["\u3225"] = "\u0028\u516D\u0029";
  30482. t["\u3226"] = "\u0028\u4E03\u0029";
  30483. t["\u3227"] = "\u0028\u516B\u0029";
  30484. t["\u3228"] = "\u0028\u4E5D\u0029";
  30485. t["\u3229"] = "\u0028\u5341\u0029";
  30486. t["\u322A"] = "\u0028\u6708\u0029";
  30487. t["\u322B"] = "\u0028\u706B\u0029";
  30488. t["\u322C"] = "\u0028\u6C34\u0029";
  30489. t["\u322D"] = "\u0028\u6728\u0029";
  30490. t["\u322E"] = "\u0028\u91D1\u0029";
  30491. t["\u322F"] = "\u0028\u571F\u0029";
  30492. t["\u3230"] = "\u0028\u65E5\u0029";
  30493. t["\u3231"] = "\u0028\u682A\u0029";
  30494. t["\u3232"] = "\u0028\u6709\u0029";
  30495. t["\u3233"] = "\u0028\u793E\u0029";
  30496. t["\u3234"] = "\u0028\u540D\u0029";
  30497. t["\u3235"] = "\u0028\u7279\u0029";
  30498. t["\u3236"] = "\u0028\u8CA1\u0029";
  30499. t["\u3237"] = "\u0028\u795D\u0029";
  30500. t["\u3238"] = "\u0028\u52B4\u0029";
  30501. t["\u3239"] = "\u0028\u4EE3\u0029";
  30502. t["\u323A"] = "\u0028\u547C\u0029";
  30503. t["\u323B"] = "\u0028\u5B66\u0029";
  30504. t["\u323C"] = "\u0028\u76E3\u0029";
  30505. t["\u323D"] = "\u0028\u4F01\u0029";
  30506. t["\u323E"] = "\u0028\u8CC7\u0029";
  30507. t["\u323F"] = "\u0028\u5354\u0029";
  30508. t["\u3240"] = "\u0028\u796D\u0029";
  30509. t["\u3241"] = "\u0028\u4F11\u0029";
  30510. t["\u3242"] = "\u0028\u81EA\u0029";
  30511. t["\u3243"] = "\u0028\u81F3\u0029";
  30512. t["\u32C0"] = "\u0031\u6708";
  30513. t["\u32C1"] = "\u0032\u6708";
  30514. t["\u32C2"] = "\u0033\u6708";
  30515. t["\u32C3"] = "\u0034\u6708";
  30516. t["\u32C4"] = "\u0035\u6708";
  30517. t["\u32C5"] = "\u0036\u6708";
  30518. t["\u32C6"] = "\u0037\u6708";
  30519. t["\u32C7"] = "\u0038\u6708";
  30520. t["\u32C8"] = "\u0039\u6708";
  30521. t["\u32C9"] = "\u0031\u0030\u6708";
  30522. t["\u32CA"] = "\u0031\u0031\u6708";
  30523. t["\u32CB"] = "\u0031\u0032\u6708";
  30524. t["\u3358"] = "\u0030\u70B9";
  30525. t["\u3359"] = "\u0031\u70B9";
  30526. t["\u335A"] = "\u0032\u70B9";
  30527. t["\u335B"] = "\u0033\u70B9";
  30528. t["\u335C"] = "\u0034\u70B9";
  30529. t["\u335D"] = "\u0035\u70B9";
  30530. t["\u335E"] = "\u0036\u70B9";
  30531. t["\u335F"] = "\u0037\u70B9";
  30532. t["\u3360"] = "\u0038\u70B9";
  30533. t["\u3361"] = "\u0039\u70B9";
  30534. t["\u3362"] = "\u0031\u0030\u70B9";
  30535. t["\u3363"] = "\u0031\u0031\u70B9";
  30536. t["\u3364"] = "\u0031\u0032\u70B9";
  30537. t["\u3365"] = "\u0031\u0033\u70B9";
  30538. t["\u3366"] = "\u0031\u0034\u70B9";
  30539. t["\u3367"] = "\u0031\u0035\u70B9";
  30540. t["\u3368"] = "\u0031\u0036\u70B9";
  30541. t["\u3369"] = "\u0031\u0037\u70B9";
  30542. t["\u336A"] = "\u0031\u0038\u70B9";
  30543. t["\u336B"] = "\u0031\u0039\u70B9";
  30544. t["\u336C"] = "\u0032\u0030\u70B9";
  30545. t["\u336D"] = "\u0032\u0031\u70B9";
  30546. t["\u336E"] = "\u0032\u0032\u70B9";
  30547. t["\u336F"] = "\u0032\u0033\u70B9";
  30548. t["\u3370"] = "\u0032\u0034\u70B9";
  30549. t["\u33E0"] = "\u0031\u65E5";
  30550. t["\u33E1"] = "\u0032\u65E5";
  30551. t["\u33E2"] = "\u0033\u65E5";
  30552. t["\u33E3"] = "\u0034\u65E5";
  30553. t["\u33E4"] = "\u0035\u65E5";
  30554. t["\u33E5"] = "\u0036\u65E5";
  30555. t["\u33E6"] = "\u0037\u65E5";
  30556. t["\u33E7"] = "\u0038\u65E5";
  30557. t["\u33E8"] = "\u0039\u65E5";
  30558. t["\u33E9"] = "\u0031\u0030\u65E5";
  30559. t["\u33EA"] = "\u0031\u0031\u65E5";
  30560. t["\u33EB"] = "\u0031\u0032\u65E5";
  30561. t["\u33EC"] = "\u0031\u0033\u65E5";
  30562. t["\u33ED"] = "\u0031\u0034\u65E5";
  30563. t["\u33EE"] = "\u0031\u0035\u65E5";
  30564. t["\u33EF"] = "\u0031\u0036\u65E5";
  30565. t["\u33F0"] = "\u0031\u0037\u65E5";
  30566. t["\u33F1"] = "\u0031\u0038\u65E5";
  30567. t["\u33F2"] = "\u0031\u0039\u65E5";
  30568. t["\u33F3"] = "\u0032\u0030\u65E5";
  30569. t["\u33F4"] = "\u0032\u0031\u65E5";
  30570. t["\u33F5"] = "\u0032\u0032\u65E5";
  30571. t["\u33F6"] = "\u0032\u0033\u65E5";
  30572. t["\u33F7"] = "\u0032\u0034\u65E5";
  30573. t["\u33F8"] = "\u0032\u0035\u65E5";
  30574. t["\u33F9"] = "\u0032\u0036\u65E5";
  30575. t["\u33FA"] = "\u0032\u0037\u65E5";
  30576. t["\u33FB"] = "\u0032\u0038\u65E5";
  30577. t["\u33FC"] = "\u0032\u0039\u65E5";
  30578. t["\u33FD"] = "\u0033\u0030\u65E5";
  30579. t["\u33FE"] = "\u0033\u0031\u65E5";
  30580. t["\uFB00"] = "\u0066\u0066";
  30581. t["\uFB01"] = "\u0066\u0069";
  30582. t["\uFB02"] = "\u0066\u006C";
  30583. t["\uFB03"] = "\u0066\u0066\u0069";
  30584. t["\uFB04"] = "\u0066\u0066\u006C";
  30585. t["\uFB05"] = "\u017F\u0074";
  30586. t["\uFB06"] = "\u0073\u0074";
  30587. t["\uFB13"] = "\u0574\u0576";
  30588. t["\uFB14"] = "\u0574\u0565";
  30589. t["\uFB15"] = "\u0574\u056B";
  30590. t["\uFB16"] = "\u057E\u0576";
  30591. t["\uFB17"] = "\u0574\u056D";
  30592. t["\uFB4F"] = "\u05D0\u05DC";
  30593. t["\uFB50"] = "\u0671";
  30594. t["\uFB51"] = "\u0671";
  30595. t["\uFB52"] = "\u067B";
  30596. t["\uFB53"] = "\u067B";
  30597. t["\uFB54"] = "\u067B";
  30598. t["\uFB55"] = "\u067B";
  30599. t["\uFB56"] = "\u067E";
  30600. t["\uFB57"] = "\u067E";
  30601. t["\uFB58"] = "\u067E";
  30602. t["\uFB59"] = "\u067E";
  30603. t["\uFB5A"] = "\u0680";
  30604. t["\uFB5B"] = "\u0680";
  30605. t["\uFB5C"] = "\u0680";
  30606. t["\uFB5D"] = "\u0680";
  30607. t["\uFB5E"] = "\u067A";
  30608. t["\uFB5F"] = "\u067A";
  30609. t["\uFB60"] = "\u067A";
  30610. t["\uFB61"] = "\u067A";
  30611. t["\uFB62"] = "\u067F";
  30612. t["\uFB63"] = "\u067F";
  30613. t["\uFB64"] = "\u067F";
  30614. t["\uFB65"] = "\u067F";
  30615. t["\uFB66"] = "\u0679";
  30616. t["\uFB67"] = "\u0679";
  30617. t["\uFB68"] = "\u0679";
  30618. t["\uFB69"] = "\u0679";
  30619. t["\uFB6A"] = "\u06A4";
  30620. t["\uFB6B"] = "\u06A4";
  30621. t["\uFB6C"] = "\u06A4";
  30622. t["\uFB6D"] = "\u06A4";
  30623. t["\uFB6E"] = "\u06A6";
  30624. t["\uFB6F"] = "\u06A6";
  30625. t["\uFB70"] = "\u06A6";
  30626. t["\uFB71"] = "\u06A6";
  30627. t["\uFB72"] = "\u0684";
  30628. t["\uFB73"] = "\u0684";
  30629. t["\uFB74"] = "\u0684";
  30630. t["\uFB75"] = "\u0684";
  30631. t["\uFB76"] = "\u0683";
  30632. t["\uFB77"] = "\u0683";
  30633. t["\uFB78"] = "\u0683";
  30634. t["\uFB79"] = "\u0683";
  30635. t["\uFB7A"] = "\u0686";
  30636. t["\uFB7B"] = "\u0686";
  30637. t["\uFB7C"] = "\u0686";
  30638. t["\uFB7D"] = "\u0686";
  30639. t["\uFB7E"] = "\u0687";
  30640. t["\uFB7F"] = "\u0687";
  30641. t["\uFB80"] = "\u0687";
  30642. t["\uFB81"] = "\u0687";
  30643. t["\uFB82"] = "\u068D";
  30644. t["\uFB83"] = "\u068D";
  30645. t["\uFB84"] = "\u068C";
  30646. t["\uFB85"] = "\u068C";
  30647. t["\uFB86"] = "\u068E";
  30648. t["\uFB87"] = "\u068E";
  30649. t["\uFB88"] = "\u0688";
  30650. t["\uFB89"] = "\u0688";
  30651. t["\uFB8A"] = "\u0698";
  30652. t["\uFB8B"] = "\u0698";
  30653. t["\uFB8C"] = "\u0691";
  30654. t["\uFB8D"] = "\u0691";
  30655. t["\uFB8E"] = "\u06A9";
  30656. t["\uFB8F"] = "\u06A9";
  30657. t["\uFB90"] = "\u06A9";
  30658. t["\uFB91"] = "\u06A9";
  30659. t["\uFB92"] = "\u06AF";
  30660. t["\uFB93"] = "\u06AF";
  30661. t["\uFB94"] = "\u06AF";
  30662. t["\uFB95"] = "\u06AF";
  30663. t["\uFB96"] = "\u06B3";
  30664. t["\uFB97"] = "\u06B3";
  30665. t["\uFB98"] = "\u06B3";
  30666. t["\uFB99"] = "\u06B3";
  30667. t["\uFB9A"] = "\u06B1";
  30668. t["\uFB9B"] = "\u06B1";
  30669. t["\uFB9C"] = "\u06B1";
  30670. t["\uFB9D"] = "\u06B1";
  30671. t["\uFB9E"] = "\u06BA";
  30672. t["\uFB9F"] = "\u06BA";
  30673. t["\uFBA0"] = "\u06BB";
  30674. t["\uFBA1"] = "\u06BB";
  30675. t["\uFBA2"] = "\u06BB";
  30676. t["\uFBA3"] = "\u06BB";
  30677. t["\uFBA4"] = "\u06C0";
  30678. t["\uFBA5"] = "\u06C0";
  30679. t["\uFBA6"] = "\u06C1";
  30680. t["\uFBA7"] = "\u06C1";
  30681. t["\uFBA8"] = "\u06C1";
  30682. t["\uFBA9"] = "\u06C1";
  30683. t["\uFBAA"] = "\u06BE";
  30684. t["\uFBAB"] = "\u06BE";
  30685. t["\uFBAC"] = "\u06BE";
  30686. t["\uFBAD"] = "\u06BE";
  30687. t["\uFBAE"] = "\u06D2";
  30688. t["\uFBAF"] = "\u06D2";
  30689. t["\uFBB0"] = "\u06D3";
  30690. t["\uFBB1"] = "\u06D3";
  30691. t["\uFBD3"] = "\u06AD";
  30692. t["\uFBD4"] = "\u06AD";
  30693. t["\uFBD5"] = "\u06AD";
  30694. t["\uFBD6"] = "\u06AD";
  30695. t["\uFBD7"] = "\u06C7";
  30696. t["\uFBD8"] = "\u06C7";
  30697. t["\uFBD9"] = "\u06C6";
  30698. t["\uFBDA"] = "\u06C6";
  30699. t["\uFBDB"] = "\u06C8";
  30700. t["\uFBDC"] = "\u06C8";
  30701. t["\uFBDD"] = "\u0677";
  30702. t["\uFBDE"] = "\u06CB";
  30703. t["\uFBDF"] = "\u06CB";
  30704. t["\uFBE0"] = "\u06C5";
  30705. t["\uFBE1"] = "\u06C5";
  30706. t["\uFBE2"] = "\u06C9";
  30707. t["\uFBE3"] = "\u06C9";
  30708. t["\uFBE4"] = "\u06D0";
  30709. t["\uFBE5"] = "\u06D0";
  30710. t["\uFBE6"] = "\u06D0";
  30711. t["\uFBE7"] = "\u06D0";
  30712. t["\uFBE8"] = "\u0649";
  30713. t["\uFBE9"] = "\u0649";
  30714. t["\uFBEA"] = "\u0626\u0627";
  30715. t["\uFBEB"] = "\u0626\u0627";
  30716. t["\uFBEC"] = "\u0626\u06D5";
  30717. t["\uFBED"] = "\u0626\u06D5";
  30718. t["\uFBEE"] = "\u0626\u0648";
  30719. t["\uFBEF"] = "\u0626\u0648";
  30720. t["\uFBF0"] = "\u0626\u06C7";
  30721. t["\uFBF1"] = "\u0626\u06C7";
  30722. t["\uFBF2"] = "\u0626\u06C6";
  30723. t["\uFBF3"] = "\u0626\u06C6";
  30724. t["\uFBF4"] = "\u0626\u06C8";
  30725. t["\uFBF5"] = "\u0626\u06C8";
  30726. t["\uFBF6"] = "\u0626\u06D0";
  30727. t["\uFBF7"] = "\u0626\u06D0";
  30728. t["\uFBF8"] = "\u0626\u06D0";
  30729. t["\uFBF9"] = "\u0626\u0649";
  30730. t["\uFBFA"] = "\u0626\u0649";
  30731. t["\uFBFB"] = "\u0626\u0649";
  30732. t["\uFBFC"] = "\u06CC";
  30733. t["\uFBFD"] = "\u06CC";
  30734. t["\uFBFE"] = "\u06CC";
  30735. t["\uFBFF"] = "\u06CC";
  30736. t["\uFC00"] = "\u0626\u062C";
  30737. t["\uFC01"] = "\u0626\u062D";
  30738. t["\uFC02"] = "\u0626\u0645";
  30739. t["\uFC03"] = "\u0626\u0649";
  30740. t["\uFC04"] = "\u0626\u064A";
  30741. t["\uFC05"] = "\u0628\u062C";
  30742. t["\uFC06"] = "\u0628\u062D";
  30743. t["\uFC07"] = "\u0628\u062E";
  30744. t["\uFC08"] = "\u0628\u0645";
  30745. t["\uFC09"] = "\u0628\u0649";
  30746. t["\uFC0A"] = "\u0628\u064A";
  30747. t["\uFC0B"] = "\u062A\u062C";
  30748. t["\uFC0C"] = "\u062A\u062D";
  30749. t["\uFC0D"] = "\u062A\u062E";
  30750. t["\uFC0E"] = "\u062A\u0645";
  30751. t["\uFC0F"] = "\u062A\u0649";
  30752. t["\uFC10"] = "\u062A\u064A";
  30753. t["\uFC11"] = "\u062B\u062C";
  30754. t["\uFC12"] = "\u062B\u0645";
  30755. t["\uFC13"] = "\u062B\u0649";
  30756. t["\uFC14"] = "\u062B\u064A";
  30757. t["\uFC15"] = "\u062C\u062D";
  30758. t["\uFC16"] = "\u062C\u0645";
  30759. t["\uFC17"] = "\u062D\u062C";
  30760. t["\uFC18"] = "\u062D\u0645";
  30761. t["\uFC19"] = "\u062E\u062C";
  30762. t["\uFC1A"] = "\u062E\u062D";
  30763. t["\uFC1B"] = "\u062E\u0645";
  30764. t["\uFC1C"] = "\u0633\u062C";
  30765. t["\uFC1D"] = "\u0633\u062D";
  30766. t["\uFC1E"] = "\u0633\u062E";
  30767. t["\uFC1F"] = "\u0633\u0645";
  30768. t["\uFC20"] = "\u0635\u062D";
  30769. t["\uFC21"] = "\u0635\u0645";
  30770. t["\uFC22"] = "\u0636\u062C";
  30771. t["\uFC23"] = "\u0636\u062D";
  30772. t["\uFC24"] = "\u0636\u062E";
  30773. t["\uFC25"] = "\u0636\u0645";
  30774. t["\uFC26"] = "\u0637\u062D";
  30775. t["\uFC27"] = "\u0637\u0645";
  30776. t["\uFC28"] = "\u0638\u0645";
  30777. t["\uFC29"] = "\u0639\u062C";
  30778. t["\uFC2A"] = "\u0639\u0645";
  30779. t["\uFC2B"] = "\u063A\u062C";
  30780. t["\uFC2C"] = "\u063A\u0645";
  30781. t["\uFC2D"] = "\u0641\u062C";
  30782. t["\uFC2E"] = "\u0641\u062D";
  30783. t["\uFC2F"] = "\u0641\u062E";
  30784. t["\uFC30"] = "\u0641\u0645";
  30785. t["\uFC31"] = "\u0641\u0649";
  30786. t["\uFC32"] = "\u0641\u064A";
  30787. t["\uFC33"] = "\u0642\u062D";
  30788. t["\uFC34"] = "\u0642\u0645";
  30789. t["\uFC35"] = "\u0642\u0649";
  30790. t["\uFC36"] = "\u0642\u064A";
  30791. t["\uFC37"] = "\u0643\u0627";
  30792. t["\uFC38"] = "\u0643\u062C";
  30793. t["\uFC39"] = "\u0643\u062D";
  30794. t["\uFC3A"] = "\u0643\u062E";
  30795. t["\uFC3B"] = "\u0643\u0644";
  30796. t["\uFC3C"] = "\u0643\u0645";
  30797. t["\uFC3D"] = "\u0643\u0649";
  30798. t["\uFC3E"] = "\u0643\u064A";
  30799. t["\uFC3F"] = "\u0644\u062C";
  30800. t["\uFC40"] = "\u0644\u062D";
  30801. t["\uFC41"] = "\u0644\u062E";
  30802. t["\uFC42"] = "\u0644\u0645";
  30803. t["\uFC43"] = "\u0644\u0649";
  30804. t["\uFC44"] = "\u0644\u064A";
  30805. t["\uFC45"] = "\u0645\u062C";
  30806. t["\uFC46"] = "\u0645\u062D";
  30807. t["\uFC47"] = "\u0645\u062E";
  30808. t["\uFC48"] = "\u0645\u0645";
  30809. t["\uFC49"] = "\u0645\u0649";
  30810. t["\uFC4A"] = "\u0645\u064A";
  30811. t["\uFC4B"] = "\u0646\u062C";
  30812. t["\uFC4C"] = "\u0646\u062D";
  30813. t["\uFC4D"] = "\u0646\u062E";
  30814. t["\uFC4E"] = "\u0646\u0645";
  30815. t["\uFC4F"] = "\u0646\u0649";
  30816. t["\uFC50"] = "\u0646\u064A";
  30817. t["\uFC51"] = "\u0647\u062C";
  30818. t["\uFC52"] = "\u0647\u0645";
  30819. t["\uFC53"] = "\u0647\u0649";
  30820. t["\uFC54"] = "\u0647\u064A";
  30821. t["\uFC55"] = "\u064A\u062C";
  30822. t["\uFC56"] = "\u064A\u062D";
  30823. t["\uFC57"] = "\u064A\u062E";
  30824. t["\uFC58"] = "\u064A\u0645";
  30825. t["\uFC59"] = "\u064A\u0649";
  30826. t["\uFC5A"] = "\u064A\u064A";
  30827. t["\uFC5B"] = "\u0630\u0670";
  30828. t["\uFC5C"] = "\u0631\u0670";
  30829. t["\uFC5D"] = "\u0649\u0670";
  30830. t["\uFC5E"] = "\u0020\u064C\u0651";
  30831. t["\uFC5F"] = "\u0020\u064D\u0651";
  30832. t["\uFC60"] = "\u0020\u064E\u0651";
  30833. t["\uFC61"] = "\u0020\u064F\u0651";
  30834. t["\uFC62"] = "\u0020\u0650\u0651";
  30835. t["\uFC63"] = "\u0020\u0651\u0670";
  30836. t["\uFC64"] = "\u0626\u0631";
  30837. t["\uFC65"] = "\u0626\u0632";
  30838. t["\uFC66"] = "\u0626\u0645";
  30839. t["\uFC67"] = "\u0626\u0646";
  30840. t["\uFC68"] = "\u0626\u0649";
  30841. t["\uFC69"] = "\u0626\u064A";
  30842. t["\uFC6A"] = "\u0628\u0631";
  30843. t["\uFC6B"] = "\u0628\u0632";
  30844. t["\uFC6C"] = "\u0628\u0645";
  30845. t["\uFC6D"] = "\u0628\u0646";
  30846. t["\uFC6E"] = "\u0628\u0649";
  30847. t["\uFC6F"] = "\u0628\u064A";
  30848. t["\uFC70"] = "\u062A\u0631";
  30849. t["\uFC71"] = "\u062A\u0632";
  30850. t["\uFC72"] = "\u062A\u0645";
  30851. t["\uFC73"] = "\u062A\u0646";
  30852. t["\uFC74"] = "\u062A\u0649";
  30853. t["\uFC75"] = "\u062A\u064A";
  30854. t["\uFC76"] = "\u062B\u0631";
  30855. t["\uFC77"] = "\u062B\u0632";
  30856. t["\uFC78"] = "\u062B\u0645";
  30857. t["\uFC79"] = "\u062B\u0646";
  30858. t["\uFC7A"] = "\u062B\u0649";
  30859. t["\uFC7B"] = "\u062B\u064A";
  30860. t["\uFC7C"] = "\u0641\u0649";
  30861. t["\uFC7D"] = "\u0641\u064A";
  30862. t["\uFC7E"] = "\u0642\u0649";
  30863. t["\uFC7F"] = "\u0642\u064A";
  30864. t["\uFC80"] = "\u0643\u0627";
  30865. t["\uFC81"] = "\u0643\u0644";
  30866. t["\uFC82"] = "\u0643\u0645";
  30867. t["\uFC83"] = "\u0643\u0649";
  30868. t["\uFC84"] = "\u0643\u064A";
  30869. t["\uFC85"] = "\u0644\u0645";
  30870. t["\uFC86"] = "\u0644\u0649";
  30871. t["\uFC87"] = "\u0644\u064A";
  30872. t["\uFC88"] = "\u0645\u0627";
  30873. t["\uFC89"] = "\u0645\u0645";
  30874. t["\uFC8A"] = "\u0646\u0631";
  30875. t["\uFC8B"] = "\u0646\u0632";
  30876. t["\uFC8C"] = "\u0646\u0645";
  30877. t["\uFC8D"] = "\u0646\u0646";
  30878. t["\uFC8E"] = "\u0646\u0649";
  30879. t["\uFC8F"] = "\u0646\u064A";
  30880. t["\uFC90"] = "\u0649\u0670";
  30881. t["\uFC91"] = "\u064A\u0631";
  30882. t["\uFC92"] = "\u064A\u0632";
  30883. t["\uFC93"] = "\u064A\u0645";
  30884. t["\uFC94"] = "\u064A\u0646";
  30885. t["\uFC95"] = "\u064A\u0649";
  30886. t["\uFC96"] = "\u064A\u064A";
  30887. t["\uFC97"] = "\u0626\u062C";
  30888. t["\uFC98"] = "\u0626\u062D";
  30889. t["\uFC99"] = "\u0626\u062E";
  30890. t["\uFC9A"] = "\u0626\u0645";
  30891. t["\uFC9B"] = "\u0626\u0647";
  30892. t["\uFC9C"] = "\u0628\u062C";
  30893. t["\uFC9D"] = "\u0628\u062D";
  30894. t["\uFC9E"] = "\u0628\u062E";
  30895. t["\uFC9F"] = "\u0628\u0645";
  30896. t["\uFCA0"] = "\u0628\u0647";
  30897. t["\uFCA1"] = "\u062A\u062C";
  30898. t["\uFCA2"] = "\u062A\u062D";
  30899. t["\uFCA3"] = "\u062A\u062E";
  30900. t["\uFCA4"] = "\u062A\u0645";
  30901. t["\uFCA5"] = "\u062A\u0647";
  30902. t["\uFCA6"] = "\u062B\u0645";
  30903. t["\uFCA7"] = "\u062C\u062D";
  30904. t["\uFCA8"] = "\u062C\u0645";
  30905. t["\uFCA9"] = "\u062D\u062C";
  30906. t["\uFCAA"] = "\u062D\u0645";
  30907. t["\uFCAB"] = "\u062E\u062C";
  30908. t["\uFCAC"] = "\u062E\u0645";
  30909. t["\uFCAD"] = "\u0633\u062C";
  30910. t["\uFCAE"] = "\u0633\u062D";
  30911. t["\uFCAF"] = "\u0633\u062E";
  30912. t["\uFCB0"] = "\u0633\u0645";
  30913. t["\uFCB1"] = "\u0635\u062D";
  30914. t["\uFCB2"] = "\u0635\u062E";
  30915. t["\uFCB3"] = "\u0635\u0645";
  30916. t["\uFCB4"] = "\u0636\u062C";
  30917. t["\uFCB5"] = "\u0636\u062D";
  30918. t["\uFCB6"] = "\u0636\u062E";
  30919. t["\uFCB7"] = "\u0636\u0645";
  30920. t["\uFCB8"] = "\u0637\u062D";
  30921. t["\uFCB9"] = "\u0638\u0645";
  30922. t["\uFCBA"] = "\u0639\u062C";
  30923. t["\uFCBB"] = "\u0639\u0645";
  30924. t["\uFCBC"] = "\u063A\u062C";
  30925. t["\uFCBD"] = "\u063A\u0645";
  30926. t["\uFCBE"] = "\u0641\u062C";
  30927. t["\uFCBF"] = "\u0641\u062D";
  30928. t["\uFCC0"] = "\u0641\u062E";
  30929. t["\uFCC1"] = "\u0641\u0645";
  30930. t["\uFCC2"] = "\u0642\u062D";
  30931. t["\uFCC3"] = "\u0642\u0645";
  30932. t["\uFCC4"] = "\u0643\u062C";
  30933. t["\uFCC5"] = "\u0643\u062D";
  30934. t["\uFCC6"] = "\u0643\u062E";
  30935. t["\uFCC7"] = "\u0643\u0644";
  30936. t["\uFCC8"] = "\u0643\u0645";
  30937. t["\uFCC9"] = "\u0644\u062C";
  30938. t["\uFCCA"] = "\u0644\u062D";
  30939. t["\uFCCB"] = "\u0644\u062E";
  30940. t["\uFCCC"] = "\u0644\u0645";
  30941. t["\uFCCD"] = "\u0644\u0647";
  30942. t["\uFCCE"] = "\u0645\u062C";
  30943. t["\uFCCF"] = "\u0645\u062D";
  30944. t["\uFCD0"] = "\u0645\u062E";
  30945. t["\uFCD1"] = "\u0645\u0645";
  30946. t["\uFCD2"] = "\u0646\u062C";
  30947. t["\uFCD3"] = "\u0646\u062D";
  30948. t["\uFCD4"] = "\u0646\u062E";
  30949. t["\uFCD5"] = "\u0646\u0645";
  30950. t["\uFCD6"] = "\u0646\u0647";
  30951. t["\uFCD7"] = "\u0647\u062C";
  30952. t["\uFCD8"] = "\u0647\u0645";
  30953. t["\uFCD9"] = "\u0647\u0670";
  30954. t["\uFCDA"] = "\u064A\u062C";
  30955. t["\uFCDB"] = "\u064A\u062D";
  30956. t["\uFCDC"] = "\u064A\u062E";
  30957. t["\uFCDD"] = "\u064A\u0645";
  30958. t["\uFCDE"] = "\u064A\u0647";
  30959. t["\uFCDF"] = "\u0626\u0645";
  30960. t["\uFCE0"] = "\u0626\u0647";
  30961. t["\uFCE1"] = "\u0628\u0645";
  30962. t["\uFCE2"] = "\u0628\u0647";
  30963. t["\uFCE3"] = "\u062A\u0645";
  30964. t["\uFCE4"] = "\u062A\u0647";
  30965. t["\uFCE5"] = "\u062B\u0645";
  30966. t["\uFCE6"] = "\u062B\u0647";
  30967. t["\uFCE7"] = "\u0633\u0645";
  30968. t["\uFCE8"] = "\u0633\u0647";
  30969. t["\uFCE9"] = "\u0634\u0645";
  30970. t["\uFCEA"] = "\u0634\u0647";
  30971. t["\uFCEB"] = "\u0643\u0644";
  30972. t["\uFCEC"] = "\u0643\u0645";
  30973. t["\uFCED"] = "\u0644\u0645";
  30974. t["\uFCEE"] = "\u0646\u0645";
  30975. t["\uFCEF"] = "\u0646\u0647";
  30976. t["\uFCF0"] = "\u064A\u0645";
  30977. t["\uFCF1"] = "\u064A\u0647";
  30978. t["\uFCF2"] = "\u0640\u064E\u0651";
  30979. t["\uFCF3"] = "\u0640\u064F\u0651";
  30980. t["\uFCF4"] = "\u0640\u0650\u0651";
  30981. t["\uFCF5"] = "\u0637\u0649";
  30982. t["\uFCF6"] = "\u0637\u064A";
  30983. t["\uFCF7"] = "\u0639\u0649";
  30984. t["\uFCF8"] = "\u0639\u064A";
  30985. t["\uFCF9"] = "\u063A\u0649";
  30986. t["\uFCFA"] = "\u063A\u064A";
  30987. t["\uFCFB"] = "\u0633\u0649";
  30988. t["\uFCFC"] = "\u0633\u064A";
  30989. t["\uFCFD"] = "\u0634\u0649";
  30990. t["\uFCFE"] = "\u0634\u064A";
  30991. t["\uFCFF"] = "\u062D\u0649";
  30992. t["\uFD00"] = "\u062D\u064A";
  30993. t["\uFD01"] = "\u062C\u0649";
  30994. t["\uFD02"] = "\u062C\u064A";
  30995. t["\uFD03"] = "\u062E\u0649";
  30996. t["\uFD04"] = "\u062E\u064A";
  30997. t["\uFD05"] = "\u0635\u0649";
  30998. t["\uFD06"] = "\u0635\u064A";
  30999. t["\uFD07"] = "\u0636\u0649";
  31000. t["\uFD08"] = "\u0636\u064A";
  31001. t["\uFD09"] = "\u0634\u062C";
  31002. t["\uFD0A"] = "\u0634\u062D";
  31003. t["\uFD0B"] = "\u0634\u062E";
  31004. t["\uFD0C"] = "\u0634\u0645";
  31005. t["\uFD0D"] = "\u0634\u0631";
  31006. t["\uFD0E"] = "\u0633\u0631";
  31007. t["\uFD0F"] = "\u0635\u0631";
  31008. t["\uFD10"] = "\u0636\u0631";
  31009. t["\uFD11"] = "\u0637\u0649";
  31010. t["\uFD12"] = "\u0637\u064A";
  31011. t["\uFD13"] = "\u0639\u0649";
  31012. t["\uFD14"] = "\u0639\u064A";
  31013. t["\uFD15"] = "\u063A\u0649";
  31014. t["\uFD16"] = "\u063A\u064A";
  31015. t["\uFD17"] = "\u0633\u0649";
  31016. t["\uFD18"] = "\u0633\u064A";
  31017. t["\uFD19"] = "\u0634\u0649";
  31018. t["\uFD1A"] = "\u0634\u064A";
  31019. t["\uFD1B"] = "\u062D\u0649";
  31020. t["\uFD1C"] = "\u062D\u064A";
  31021. t["\uFD1D"] = "\u062C\u0649";
  31022. t["\uFD1E"] = "\u062C\u064A";
  31023. t["\uFD1F"] = "\u062E\u0649";
  31024. t["\uFD20"] = "\u062E\u064A";
  31025. t["\uFD21"] = "\u0635\u0649";
  31026. t["\uFD22"] = "\u0635\u064A";
  31027. t["\uFD23"] = "\u0636\u0649";
  31028. t["\uFD24"] = "\u0636\u064A";
  31029. t["\uFD25"] = "\u0634\u062C";
  31030. t["\uFD26"] = "\u0634\u062D";
  31031. t["\uFD27"] = "\u0634\u062E";
  31032. t["\uFD28"] = "\u0634\u0645";
  31033. t["\uFD29"] = "\u0634\u0631";
  31034. t["\uFD2A"] = "\u0633\u0631";
  31035. t["\uFD2B"] = "\u0635\u0631";
  31036. t["\uFD2C"] = "\u0636\u0631";
  31037. t["\uFD2D"] = "\u0634\u062C";
  31038. t["\uFD2E"] = "\u0634\u062D";
  31039. t["\uFD2F"] = "\u0634\u062E";
  31040. t["\uFD30"] = "\u0634\u0645";
  31041. t["\uFD31"] = "\u0633\u0647";
  31042. t["\uFD32"] = "\u0634\u0647";
  31043. t["\uFD33"] = "\u0637\u0645";
  31044. t["\uFD34"] = "\u0633\u062C";
  31045. t["\uFD35"] = "\u0633\u062D";
  31046. t["\uFD36"] = "\u0633\u062E";
  31047. t["\uFD37"] = "\u0634\u062C";
  31048. t["\uFD38"] = "\u0634\u062D";
  31049. t["\uFD39"] = "\u0634\u062E";
  31050. t["\uFD3A"] = "\u0637\u0645";
  31051. t["\uFD3B"] = "\u0638\u0645";
  31052. t["\uFD3C"] = "\u0627\u064B";
  31053. t["\uFD3D"] = "\u0627\u064B";
  31054. t["\uFD50"] = "\u062A\u062C\u0645";
  31055. t["\uFD51"] = "\u062A\u062D\u062C";
  31056. t["\uFD52"] = "\u062A\u062D\u062C";
  31057. t["\uFD53"] = "\u062A\u062D\u0645";
  31058. t["\uFD54"] = "\u062A\u062E\u0645";
  31059. t["\uFD55"] = "\u062A\u0645\u062C";
  31060. t["\uFD56"] = "\u062A\u0645\u062D";
  31061. t["\uFD57"] = "\u062A\u0645\u062E";
  31062. t["\uFD58"] = "\u062C\u0645\u062D";
  31063. t["\uFD59"] = "\u062C\u0645\u062D";
  31064. t["\uFD5A"] = "\u062D\u0645\u064A";
  31065. t["\uFD5B"] = "\u062D\u0645\u0649";
  31066. t["\uFD5C"] = "\u0633\u062D\u062C";
  31067. t["\uFD5D"] = "\u0633\u062C\u062D";
  31068. t["\uFD5E"] = "\u0633\u062C\u0649";
  31069. t["\uFD5F"] = "\u0633\u0645\u062D";
  31070. t["\uFD60"] = "\u0633\u0645\u062D";
  31071. t["\uFD61"] = "\u0633\u0645\u062C";
  31072. t["\uFD62"] = "\u0633\u0645\u0645";
  31073. t["\uFD63"] = "\u0633\u0645\u0645";
  31074. t["\uFD64"] = "\u0635\u062D\u062D";
  31075. t["\uFD65"] = "\u0635\u062D\u062D";
  31076. t["\uFD66"] = "\u0635\u0645\u0645";
  31077. t["\uFD67"] = "\u0634\u062D\u0645";
  31078. t["\uFD68"] = "\u0634\u062D\u0645";
  31079. t["\uFD69"] = "\u0634\u062C\u064A";
  31080. t["\uFD6A"] = "\u0634\u0645\u062E";
  31081. t["\uFD6B"] = "\u0634\u0645\u062E";
  31082. t["\uFD6C"] = "\u0634\u0645\u0645";
  31083. t["\uFD6D"] = "\u0634\u0645\u0645";
  31084. t["\uFD6E"] = "\u0636\u062D\u0649";
  31085. t["\uFD6F"] = "\u0636\u062E\u0645";
  31086. t["\uFD70"] = "\u0636\u062E\u0645";
  31087. t["\uFD71"] = "\u0637\u0645\u062D";
  31088. t["\uFD72"] = "\u0637\u0645\u062D";
  31089. t["\uFD73"] = "\u0637\u0645\u0645";
  31090. t["\uFD74"] = "\u0637\u0645\u064A";
  31091. t["\uFD75"] = "\u0639\u062C\u0645";
  31092. t["\uFD76"] = "\u0639\u0645\u0645";
  31093. t["\uFD77"] = "\u0639\u0645\u0645";
  31094. t["\uFD78"] = "\u0639\u0645\u0649";
  31095. t["\uFD79"] = "\u063A\u0645\u0645";
  31096. t["\uFD7A"] = "\u063A\u0645\u064A";
  31097. t["\uFD7B"] = "\u063A\u0645\u0649";
  31098. t["\uFD7C"] = "\u0641\u062E\u0645";
  31099. t["\uFD7D"] = "\u0641\u062E\u0645";
  31100. t["\uFD7E"] = "\u0642\u0645\u062D";
  31101. t["\uFD7F"] = "\u0642\u0645\u0645";
  31102. t["\uFD80"] = "\u0644\u062D\u0645";
  31103. t["\uFD81"] = "\u0644\u062D\u064A";
  31104. t["\uFD82"] = "\u0644\u062D\u0649";
  31105. t["\uFD83"] = "\u0644\u062C\u062C";
  31106. t["\uFD84"] = "\u0644\u062C\u062C";
  31107. t["\uFD85"] = "\u0644\u062E\u0645";
  31108. t["\uFD86"] = "\u0644\u062E\u0645";
  31109. t["\uFD87"] = "\u0644\u0645\u062D";
  31110. t["\uFD88"] = "\u0644\u0645\u062D";
  31111. t["\uFD89"] = "\u0645\u062D\u062C";
  31112. t["\uFD8A"] = "\u0645\u062D\u0645";
  31113. t["\uFD8B"] = "\u0645\u062D\u064A";
  31114. t["\uFD8C"] = "\u0645\u062C\u062D";
  31115. t["\uFD8D"] = "\u0645\u062C\u0645";
  31116. t["\uFD8E"] = "\u0645\u062E\u062C";
  31117. t["\uFD8F"] = "\u0645\u062E\u0645";
  31118. t["\uFD92"] = "\u0645\u062C\u062E";
  31119. t["\uFD93"] = "\u0647\u0645\u062C";
  31120. t["\uFD94"] = "\u0647\u0645\u0645";
  31121. t["\uFD95"] = "\u0646\u062D\u0645";
  31122. t["\uFD96"] = "\u0646\u062D\u0649";
  31123. t["\uFD97"] = "\u0646\u062C\u0645";
  31124. t["\uFD98"] = "\u0646\u062C\u0645";
  31125. t["\uFD99"] = "\u0646\u062C\u0649";
  31126. t["\uFD9A"] = "\u0646\u0645\u064A";
  31127. t["\uFD9B"] = "\u0646\u0645\u0649";
  31128. t["\uFD9C"] = "\u064A\u0645\u0645";
  31129. t["\uFD9D"] = "\u064A\u0645\u0645";
  31130. t["\uFD9E"] = "\u0628\u062E\u064A";
  31131. t["\uFD9F"] = "\u062A\u062C\u064A";
  31132. t["\uFDA0"] = "\u062A\u062C\u0649";
  31133. t["\uFDA1"] = "\u062A\u062E\u064A";
  31134. t["\uFDA2"] = "\u062A\u062E\u0649";
  31135. t["\uFDA3"] = "\u062A\u0645\u064A";
  31136. t["\uFDA4"] = "\u062A\u0645\u0649";
  31137. t["\uFDA5"] = "\u062C\u0645\u064A";
  31138. t["\uFDA6"] = "\u062C\u062D\u0649";
  31139. t["\uFDA7"] = "\u062C\u0645\u0649";
  31140. t["\uFDA8"] = "\u0633\u062E\u0649";
  31141. t["\uFDA9"] = "\u0635\u062D\u064A";
  31142. t["\uFDAA"] = "\u0634\u062D\u064A";
  31143. t["\uFDAB"] = "\u0636\u062D\u064A";
  31144. t["\uFDAC"] = "\u0644\u062C\u064A";
  31145. t["\uFDAD"] = "\u0644\u0645\u064A";
  31146. t["\uFDAE"] = "\u064A\u062D\u064A";
  31147. t["\uFDAF"] = "\u064A\u062C\u064A";
  31148. t["\uFDB0"] = "\u064A\u0645\u064A";
  31149. t["\uFDB1"] = "\u0645\u0645\u064A";
  31150. t["\uFDB2"] = "\u0642\u0645\u064A";
  31151. t["\uFDB3"] = "\u0646\u062D\u064A";
  31152. t["\uFDB4"] = "\u0642\u0645\u062D";
  31153. t["\uFDB5"] = "\u0644\u062D\u0645";
  31154. t["\uFDB6"] = "\u0639\u0645\u064A";
  31155. t["\uFDB7"] = "\u0643\u0645\u064A";
  31156. t["\uFDB8"] = "\u0646\u062C\u062D";
  31157. t["\uFDB9"] = "\u0645\u062E\u064A";
  31158. t["\uFDBA"] = "\u0644\u062C\u0645";
  31159. t["\uFDBB"] = "\u0643\u0645\u0645";
  31160. t["\uFDBC"] = "\u0644\u062C\u0645";
  31161. t["\uFDBD"] = "\u0646\u062C\u062D";
  31162. t["\uFDBE"] = "\u062C\u062D\u064A";
  31163. t["\uFDBF"] = "\u062D\u062C\u064A";
  31164. t["\uFDC0"] = "\u0645\u062C\u064A";
  31165. t["\uFDC1"] = "\u0641\u0645\u064A";
  31166. t["\uFDC2"] = "\u0628\u062D\u064A";
  31167. t["\uFDC3"] = "\u0643\u0645\u0645";
  31168. t["\uFDC4"] = "\u0639\u062C\u0645";
  31169. t["\uFDC5"] = "\u0635\u0645\u0645";
  31170. t["\uFDC6"] = "\u0633\u062E\u064A";
  31171. t["\uFDC7"] = "\u0646\u062C\u064A";
  31172. t["\uFE49"] = "\u203E";
  31173. t["\uFE4A"] = "\u203E";
  31174. t["\uFE4B"] = "\u203E";
  31175. t["\uFE4C"] = "\u203E";
  31176. t["\uFE4D"] = "\u005F";
  31177. t["\uFE4E"] = "\u005F";
  31178. t["\uFE4F"] = "\u005F";
  31179. t["\uFE80"] = "\u0621";
  31180. t["\uFE81"] = "\u0622";
  31181. t["\uFE82"] = "\u0622";
  31182. t["\uFE83"] = "\u0623";
  31183. t["\uFE84"] = "\u0623";
  31184. t["\uFE85"] = "\u0624";
  31185. t["\uFE86"] = "\u0624";
  31186. t["\uFE87"] = "\u0625";
  31187. t["\uFE88"] = "\u0625";
  31188. t["\uFE89"] = "\u0626";
  31189. t["\uFE8A"] = "\u0626";
  31190. t["\uFE8B"] = "\u0626";
  31191. t["\uFE8C"] = "\u0626";
  31192. t["\uFE8D"] = "\u0627";
  31193. t["\uFE8E"] = "\u0627";
  31194. t["\uFE8F"] = "\u0628";
  31195. t["\uFE90"] = "\u0628";
  31196. t["\uFE91"] = "\u0628";
  31197. t["\uFE92"] = "\u0628";
  31198. t["\uFE93"] = "\u0629";
  31199. t["\uFE94"] = "\u0629";
  31200. t["\uFE95"] = "\u062A";
  31201. t["\uFE96"] = "\u062A";
  31202. t["\uFE97"] = "\u062A";
  31203. t["\uFE98"] = "\u062A";
  31204. t["\uFE99"] = "\u062B";
  31205. t["\uFE9A"] = "\u062B";
  31206. t["\uFE9B"] = "\u062B";
  31207. t["\uFE9C"] = "\u062B";
  31208. t["\uFE9D"] = "\u062C";
  31209. t["\uFE9E"] = "\u062C";
  31210. t["\uFE9F"] = "\u062C";
  31211. t["\uFEA0"] = "\u062C";
  31212. t["\uFEA1"] = "\u062D";
  31213. t["\uFEA2"] = "\u062D";
  31214. t["\uFEA3"] = "\u062D";
  31215. t["\uFEA4"] = "\u062D";
  31216. t["\uFEA5"] = "\u062E";
  31217. t["\uFEA6"] = "\u062E";
  31218. t["\uFEA7"] = "\u062E";
  31219. t["\uFEA8"] = "\u062E";
  31220. t["\uFEA9"] = "\u062F";
  31221. t["\uFEAA"] = "\u062F";
  31222. t["\uFEAB"] = "\u0630";
  31223. t["\uFEAC"] = "\u0630";
  31224. t["\uFEAD"] = "\u0631";
  31225. t["\uFEAE"] = "\u0631";
  31226. t["\uFEAF"] = "\u0632";
  31227. t["\uFEB0"] = "\u0632";
  31228. t["\uFEB1"] = "\u0633";
  31229. t["\uFEB2"] = "\u0633";
  31230. t["\uFEB3"] = "\u0633";
  31231. t["\uFEB4"] = "\u0633";
  31232. t["\uFEB5"] = "\u0634";
  31233. t["\uFEB6"] = "\u0634";
  31234. t["\uFEB7"] = "\u0634";
  31235. t["\uFEB8"] = "\u0634";
  31236. t["\uFEB9"] = "\u0635";
  31237. t["\uFEBA"] = "\u0635";
  31238. t["\uFEBB"] = "\u0635";
  31239. t["\uFEBC"] = "\u0635";
  31240. t["\uFEBD"] = "\u0636";
  31241. t["\uFEBE"] = "\u0636";
  31242. t["\uFEBF"] = "\u0636";
  31243. t["\uFEC0"] = "\u0636";
  31244. t["\uFEC1"] = "\u0637";
  31245. t["\uFEC2"] = "\u0637";
  31246. t["\uFEC3"] = "\u0637";
  31247. t["\uFEC4"] = "\u0637";
  31248. t["\uFEC5"] = "\u0638";
  31249. t["\uFEC6"] = "\u0638";
  31250. t["\uFEC7"] = "\u0638";
  31251. t["\uFEC8"] = "\u0638";
  31252. t["\uFEC9"] = "\u0639";
  31253. t["\uFECA"] = "\u0639";
  31254. t["\uFECB"] = "\u0639";
  31255. t["\uFECC"] = "\u0639";
  31256. t["\uFECD"] = "\u063A";
  31257. t["\uFECE"] = "\u063A";
  31258. t["\uFECF"] = "\u063A";
  31259. t["\uFED0"] = "\u063A";
  31260. t["\uFED1"] = "\u0641";
  31261. t["\uFED2"] = "\u0641";
  31262. t["\uFED3"] = "\u0641";
  31263. t["\uFED4"] = "\u0641";
  31264. t["\uFED5"] = "\u0642";
  31265. t["\uFED6"] = "\u0642";
  31266. t["\uFED7"] = "\u0642";
  31267. t["\uFED8"] = "\u0642";
  31268. t["\uFED9"] = "\u0643";
  31269. t["\uFEDA"] = "\u0643";
  31270. t["\uFEDB"] = "\u0643";
  31271. t["\uFEDC"] = "\u0643";
  31272. t["\uFEDD"] = "\u0644";
  31273. t["\uFEDE"] = "\u0644";
  31274. t["\uFEDF"] = "\u0644";
  31275. t["\uFEE0"] = "\u0644";
  31276. t["\uFEE1"] = "\u0645";
  31277. t["\uFEE2"] = "\u0645";
  31278. t["\uFEE3"] = "\u0645";
  31279. t["\uFEE4"] = "\u0645";
  31280. t["\uFEE5"] = "\u0646";
  31281. t["\uFEE6"] = "\u0646";
  31282. t["\uFEE7"] = "\u0646";
  31283. t["\uFEE8"] = "\u0646";
  31284. t["\uFEE9"] = "\u0647";
  31285. t["\uFEEA"] = "\u0647";
  31286. t["\uFEEB"] = "\u0647";
  31287. t["\uFEEC"] = "\u0647";
  31288. t["\uFEED"] = "\u0648";
  31289. t["\uFEEE"] = "\u0648";
  31290. t["\uFEEF"] = "\u0649";
  31291. t["\uFEF0"] = "\u0649";
  31292. t["\uFEF1"] = "\u064A";
  31293. t["\uFEF2"] = "\u064A";
  31294. t["\uFEF3"] = "\u064A";
  31295. t["\uFEF4"] = "\u064A";
  31296. t["\uFEF5"] = "\u0644\u0622";
  31297. t["\uFEF6"] = "\u0644\u0622";
  31298. t["\uFEF7"] = "\u0644\u0623";
  31299. t["\uFEF8"] = "\u0644\u0623";
  31300. t["\uFEF9"] = "\u0644\u0625";
  31301. t["\uFEFA"] = "\u0644\u0625";
  31302. t["\uFEFB"] = "\u0644\u0627";
  31303. t["\uFEFC"] = "\u0644\u0627";
  31304. });
  31305. function reverseIfRtl(chars) {
  31306. var charsLength = chars.length;
  31307. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  31308. return chars;
  31309. }
  31310. var s = "";
  31311. for (var ii = charsLength - 1; ii >= 0; ii--) {
  31312. s += chars[ii];
  31313. }
  31314. return s;
  31315. }
  31316. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  31317. exports.reverseIfRtl = reverseIfRtl;
  31318. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  31319. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  31320. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  31321. /***/ }),
  31322. /* 34 */
  31323. /***/ (function(module, exports, __w_pdfjs_require__) {
  31324. "use strict";
  31325. Object.defineProperty(exports, "__esModule", {
  31326. value: true
  31327. });
  31328. exports.FontRendererFactory = void 0;
  31329. var _util = __w_pdfjs_require__(2);
  31330. var _cff_parser = __w_pdfjs_require__(28);
  31331. var _glyphlist = __w_pdfjs_require__(31);
  31332. var _encodings = __w_pdfjs_require__(30);
  31333. var _stream = __w_pdfjs_require__(11);
  31334. var FontRendererFactory = function FontRendererFactoryClosure() {
  31335. function getLong(data, offset) {
  31336. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  31337. }
  31338. function getUshort(data, offset) {
  31339. return data[offset] << 8 | data[offset + 1];
  31340. }
  31341. function getSubroutineBias(subrs) {
  31342. const numSubrs = subrs.length;
  31343. let bias = 32768;
  31344. if (numSubrs < 1240) {
  31345. bias = 107;
  31346. } else if (numSubrs < 33900) {
  31347. bias = 1131;
  31348. }
  31349. return bias;
  31350. }
  31351. function parseCmap(data, start, end) {
  31352. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  31353. var format = getUshort(data, start + offset);
  31354. var ranges, p, i;
  31355. if (format === 4) {
  31356. getUshort(data, start + offset + 2);
  31357. var segCount = getUshort(data, start + offset + 6) >> 1;
  31358. p = start + offset + 14;
  31359. ranges = [];
  31360. for (i = 0; i < segCount; i++, p += 2) {
  31361. ranges[i] = {
  31362. end: getUshort(data, p)
  31363. };
  31364. }
  31365. p += 2;
  31366. for (i = 0; i < segCount; i++, p += 2) {
  31367. ranges[i].start = getUshort(data, p);
  31368. }
  31369. for (i = 0; i < segCount; i++, p += 2) {
  31370. ranges[i].idDelta = getUshort(data, p);
  31371. }
  31372. for (i = 0; i < segCount; i++, p += 2) {
  31373. var idOffset = getUshort(data, p);
  31374. if (idOffset === 0) {
  31375. continue;
  31376. }
  31377. ranges[i].ids = [];
  31378. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  31379. ranges[i].ids[j] = getUshort(data, p + idOffset);
  31380. idOffset += 2;
  31381. }
  31382. }
  31383. return ranges;
  31384. } else if (format === 12) {
  31385. getLong(data, start + offset + 4);
  31386. var groups = getLong(data, start + offset + 12);
  31387. p = start + offset + 16;
  31388. ranges = [];
  31389. for (i = 0; i < groups; i++) {
  31390. ranges.push({
  31391. start: getLong(data, p),
  31392. end: getLong(data, p + 4),
  31393. idDelta: getLong(data, p + 8) - getLong(data, p)
  31394. });
  31395. p += 12;
  31396. }
  31397. return ranges;
  31398. }
  31399. throw new _util.FormatError(`unsupported cmap: ${format}`);
  31400. }
  31401. function parseCff(data, start, end, seacAnalysisEnabled) {
  31402. var properties = {};
  31403. var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  31404. var cff = parser.parse();
  31405. return {
  31406. glyphs: cff.charStrings.objects,
  31407. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  31408. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  31409. isCFFCIDFont: cff.isCIDFont,
  31410. fdSelect: cff.fdSelect,
  31411. fdArray: cff.fdArray
  31412. };
  31413. }
  31414. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  31415. var itemSize, itemDecode;
  31416. if (isGlyphLocationsLong) {
  31417. itemSize = 4;
  31418. itemDecode = function fontItemDecodeLong(data, offset) {
  31419. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  31420. };
  31421. } else {
  31422. itemSize = 2;
  31423. itemDecode = function fontItemDecode(data, offset) {
  31424. return data[offset] << 9 | data[offset + 1] << 1;
  31425. };
  31426. }
  31427. var glyphs = [];
  31428. var startOffset = itemDecode(loca, 0);
  31429. for (var j = itemSize; j < loca.length; j += itemSize) {
  31430. var endOffset = itemDecode(loca, j);
  31431. glyphs.push(glyf.subarray(startOffset, endOffset));
  31432. startOffset = endOffset;
  31433. }
  31434. return glyphs;
  31435. }
  31436. function lookupCmap(ranges, unicode) {
  31437. var code = unicode.codePointAt(0),
  31438. gid = 0;
  31439. var l = 0,
  31440. r = ranges.length - 1;
  31441. while (l < r) {
  31442. var c = l + r + 1 >> 1;
  31443. if (code < ranges[c].start) {
  31444. r = c - 1;
  31445. } else {
  31446. l = c;
  31447. }
  31448. }
  31449. if (ranges[l].start <= code && code <= ranges[l].end) {
  31450. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  31451. }
  31452. return {
  31453. charCode: code,
  31454. glyphId: gid
  31455. };
  31456. }
  31457. function compileGlyf(code, cmds, font) {
  31458. function moveTo(x, y) {
  31459. cmds.push({
  31460. cmd: "moveTo",
  31461. args: [x, y]
  31462. });
  31463. }
  31464. function lineTo(x, y) {
  31465. cmds.push({
  31466. cmd: "lineTo",
  31467. args: [x, y]
  31468. });
  31469. }
  31470. function quadraticCurveTo(xa, ya, x, y) {
  31471. cmds.push({
  31472. cmd: "quadraticCurveTo",
  31473. args: [xa, ya, x, y]
  31474. });
  31475. }
  31476. var i = 0;
  31477. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  31478. var flags;
  31479. var x = 0,
  31480. y = 0;
  31481. i += 10;
  31482. if (numberOfContours < 0) {
  31483. do {
  31484. flags = code[i] << 8 | code[i + 1];
  31485. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  31486. i += 4;
  31487. var arg1, arg2;
  31488. if (flags & 0x01) {
  31489. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  31490. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  31491. i += 4;
  31492. } else {
  31493. arg1 = code[i++];
  31494. arg2 = code[i++];
  31495. }
  31496. if (flags & 0x02) {
  31497. x = arg1;
  31498. y = arg2;
  31499. } else {
  31500. x = 0;
  31501. y = 0;
  31502. }
  31503. var scaleX = 1,
  31504. scaleY = 1,
  31505. scale01 = 0,
  31506. scale10 = 0;
  31507. if (flags & 0x08) {
  31508. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  31509. i += 2;
  31510. } else if (flags & 0x40) {
  31511. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  31512. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  31513. i += 4;
  31514. } else if (flags & 0x80) {
  31515. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  31516. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  31517. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  31518. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  31519. i += 8;
  31520. }
  31521. var subglyph = font.glyphs[glyphIndex];
  31522. if (subglyph) {
  31523. cmds.push({
  31524. cmd: "save"
  31525. });
  31526. cmds.push({
  31527. cmd: "transform",
  31528. args: [scaleX, scale01, scale10, scaleY, x, y]
  31529. });
  31530. compileGlyf(subglyph, cmds, font);
  31531. cmds.push({
  31532. cmd: "restore"
  31533. });
  31534. }
  31535. } while (flags & 0x20);
  31536. } else {
  31537. var endPtsOfContours = [];
  31538. var j, jj;
  31539. for (j = 0; j < numberOfContours; j++) {
  31540. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  31541. i += 2;
  31542. }
  31543. var instructionLength = code[i] << 8 | code[i + 1];
  31544. i += 2 + instructionLength;
  31545. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  31546. var points = [];
  31547. while (points.length < numberOfPoints) {
  31548. flags = code[i++];
  31549. var repeat = 1;
  31550. if (flags & 0x08) {
  31551. repeat += code[i++];
  31552. }
  31553. while (repeat-- > 0) {
  31554. points.push({
  31555. flags
  31556. });
  31557. }
  31558. }
  31559. for (j = 0; j < numberOfPoints; j++) {
  31560. switch (points[j].flags & 0x12) {
  31561. case 0x00:
  31562. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  31563. i += 2;
  31564. break;
  31565. case 0x02:
  31566. x -= code[i++];
  31567. break;
  31568. case 0x12:
  31569. x += code[i++];
  31570. break;
  31571. }
  31572. points[j].x = x;
  31573. }
  31574. for (j = 0; j < numberOfPoints; j++) {
  31575. switch (points[j].flags & 0x24) {
  31576. case 0x00:
  31577. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  31578. i += 2;
  31579. break;
  31580. case 0x04:
  31581. y -= code[i++];
  31582. break;
  31583. case 0x24:
  31584. y += code[i++];
  31585. break;
  31586. }
  31587. points[j].y = y;
  31588. }
  31589. var startPoint = 0;
  31590. for (i = 0; i < numberOfContours; i++) {
  31591. var endPoint = endPtsOfContours[i];
  31592. var contour = points.slice(startPoint, endPoint + 1);
  31593. if (contour[0].flags & 1) {
  31594. contour.push(contour[0]);
  31595. } else if (contour[contour.length - 1].flags & 1) {
  31596. contour.unshift(contour[contour.length - 1]);
  31597. } else {
  31598. var p = {
  31599. flags: 1,
  31600. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  31601. y: (contour[0].y + contour[contour.length - 1].y) / 2
  31602. };
  31603. contour.unshift(p);
  31604. contour.push(p);
  31605. }
  31606. moveTo(contour[0].x, contour[0].y);
  31607. for (j = 1, jj = contour.length; j < jj; j++) {
  31608. if (contour[j].flags & 1) {
  31609. lineTo(contour[j].x, contour[j].y);
  31610. } else if (contour[j + 1].flags & 1) {
  31611. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  31612. j++;
  31613. } else {
  31614. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  31615. }
  31616. }
  31617. startPoint = endPoint + 1;
  31618. }
  31619. }
  31620. }
  31621. function compileCharString(code, cmds, font, glyphId) {
  31622. var stack = [];
  31623. var x = 0,
  31624. y = 0;
  31625. var stems = 0;
  31626. function moveTo(x, y) {
  31627. cmds.push({
  31628. cmd: "moveTo",
  31629. args: [x, y]
  31630. });
  31631. }
  31632. function lineTo(x, y) {
  31633. cmds.push({
  31634. cmd: "lineTo",
  31635. args: [x, y]
  31636. });
  31637. }
  31638. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  31639. cmds.push({
  31640. cmd: "bezierCurveTo",
  31641. args: [x1, y1, x2, y2, x, y]
  31642. });
  31643. }
  31644. function parse(code) {
  31645. var i = 0;
  31646. while (i < code.length) {
  31647. var stackClean = false;
  31648. var v = code[i++];
  31649. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  31650. switch (v) {
  31651. case 1:
  31652. stems += stack.length >> 1;
  31653. stackClean = true;
  31654. break;
  31655. case 3:
  31656. stems += stack.length >> 1;
  31657. stackClean = true;
  31658. break;
  31659. case 4:
  31660. y += stack.pop();
  31661. moveTo(x, y);
  31662. stackClean = true;
  31663. break;
  31664. case 5:
  31665. while (stack.length > 0) {
  31666. x += stack.shift();
  31667. y += stack.shift();
  31668. lineTo(x, y);
  31669. }
  31670. break;
  31671. case 6:
  31672. while (stack.length > 0) {
  31673. x += stack.shift();
  31674. lineTo(x, y);
  31675. if (stack.length === 0) {
  31676. break;
  31677. }
  31678. y += stack.shift();
  31679. lineTo(x, y);
  31680. }
  31681. break;
  31682. case 7:
  31683. while (stack.length > 0) {
  31684. y += stack.shift();
  31685. lineTo(x, y);
  31686. if (stack.length === 0) {
  31687. break;
  31688. }
  31689. x += stack.shift();
  31690. lineTo(x, y);
  31691. }
  31692. break;
  31693. case 8:
  31694. while (stack.length > 0) {
  31695. xa = x + stack.shift();
  31696. ya = y + stack.shift();
  31697. xb = xa + stack.shift();
  31698. yb = ya + stack.shift();
  31699. x = xb + stack.shift();
  31700. y = yb + stack.shift();
  31701. bezierCurveTo(xa, ya, xb, yb, x, y);
  31702. }
  31703. break;
  31704. case 10:
  31705. n = stack.pop();
  31706. subrCode = null;
  31707. if (font.isCFFCIDFont) {
  31708. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  31709. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  31710. const fontDict = font.fdArray[fdIndex];
  31711. let subrs;
  31712. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  31713. subrs = fontDict.privateDict.subrsIndex.objects;
  31714. }
  31715. if (subrs) {
  31716. n += getSubroutineBias(subrs);
  31717. subrCode = subrs[n];
  31718. }
  31719. } else {
  31720. (0, _util.warn)("Invalid fd index for glyph index.");
  31721. }
  31722. } else {
  31723. subrCode = font.subrs[n + font.subrsBias];
  31724. }
  31725. if (subrCode) {
  31726. parse(subrCode);
  31727. }
  31728. break;
  31729. case 11:
  31730. return;
  31731. case 12:
  31732. v = code[i++];
  31733. switch (v) {
  31734. case 34:
  31735. xa = x + stack.shift();
  31736. xb = xa + stack.shift();
  31737. y1 = y + stack.shift();
  31738. x = xb + stack.shift();
  31739. bezierCurveTo(xa, y, xb, y1, x, y1);
  31740. xa = x + stack.shift();
  31741. xb = xa + stack.shift();
  31742. x = xb + stack.shift();
  31743. bezierCurveTo(xa, y1, xb, y, x, y);
  31744. break;
  31745. case 35:
  31746. xa = x + stack.shift();
  31747. ya = y + stack.shift();
  31748. xb = xa + stack.shift();
  31749. yb = ya + stack.shift();
  31750. x = xb + stack.shift();
  31751. y = yb + stack.shift();
  31752. bezierCurveTo(xa, ya, xb, yb, x, y);
  31753. xa = x + stack.shift();
  31754. ya = y + stack.shift();
  31755. xb = xa + stack.shift();
  31756. yb = ya + stack.shift();
  31757. x = xb + stack.shift();
  31758. y = yb + stack.shift();
  31759. bezierCurveTo(xa, ya, xb, yb, x, y);
  31760. stack.pop();
  31761. break;
  31762. case 36:
  31763. xa = x + stack.shift();
  31764. y1 = y + stack.shift();
  31765. xb = xa + stack.shift();
  31766. y2 = y1 + stack.shift();
  31767. x = xb + stack.shift();
  31768. bezierCurveTo(xa, y1, xb, y2, x, y2);
  31769. xa = x + stack.shift();
  31770. xb = xa + stack.shift();
  31771. y3 = y2 + stack.shift();
  31772. x = xb + stack.shift();
  31773. bezierCurveTo(xa, y2, xb, y3, x, y);
  31774. break;
  31775. case 37:
  31776. var x0 = x,
  31777. y0 = y;
  31778. xa = x + stack.shift();
  31779. ya = y + stack.shift();
  31780. xb = xa + stack.shift();
  31781. yb = ya + stack.shift();
  31782. x = xb + stack.shift();
  31783. y = yb + stack.shift();
  31784. bezierCurveTo(xa, ya, xb, yb, x, y);
  31785. xa = x + stack.shift();
  31786. ya = y + stack.shift();
  31787. xb = xa + stack.shift();
  31788. yb = ya + stack.shift();
  31789. x = xb;
  31790. y = yb;
  31791. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  31792. x += stack.shift();
  31793. } else {
  31794. y += stack.shift();
  31795. }
  31796. bezierCurveTo(xa, ya, xb, yb, x, y);
  31797. break;
  31798. default:
  31799. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  31800. }
  31801. break;
  31802. case 14:
  31803. if (stack.length >= 4) {
  31804. var achar = stack.pop();
  31805. var bchar = stack.pop();
  31806. y = stack.pop();
  31807. x = stack.pop();
  31808. cmds.push({
  31809. cmd: "save"
  31810. });
  31811. cmds.push({
  31812. cmd: "translate",
  31813. args: [x, y]
  31814. });
  31815. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  31816. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  31817. cmds.push({
  31818. cmd: "restore"
  31819. });
  31820. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  31821. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  31822. }
  31823. return;
  31824. case 18:
  31825. stems += stack.length >> 1;
  31826. stackClean = true;
  31827. break;
  31828. case 19:
  31829. stems += stack.length >> 1;
  31830. i += stems + 7 >> 3;
  31831. stackClean = true;
  31832. break;
  31833. case 20:
  31834. stems += stack.length >> 1;
  31835. i += stems + 7 >> 3;
  31836. stackClean = true;
  31837. break;
  31838. case 21:
  31839. y += stack.pop();
  31840. x += stack.pop();
  31841. moveTo(x, y);
  31842. stackClean = true;
  31843. break;
  31844. case 22:
  31845. x += stack.pop();
  31846. moveTo(x, y);
  31847. stackClean = true;
  31848. break;
  31849. case 23:
  31850. stems += stack.length >> 1;
  31851. stackClean = true;
  31852. break;
  31853. case 24:
  31854. while (stack.length > 2) {
  31855. xa = x + stack.shift();
  31856. ya = y + stack.shift();
  31857. xb = xa + stack.shift();
  31858. yb = ya + stack.shift();
  31859. x = xb + stack.shift();
  31860. y = yb + stack.shift();
  31861. bezierCurveTo(xa, ya, xb, yb, x, y);
  31862. }
  31863. x += stack.shift();
  31864. y += stack.shift();
  31865. lineTo(x, y);
  31866. break;
  31867. case 25:
  31868. while (stack.length > 6) {
  31869. x += stack.shift();
  31870. y += stack.shift();
  31871. lineTo(x, y);
  31872. }
  31873. xa = x + stack.shift();
  31874. ya = y + stack.shift();
  31875. xb = xa + stack.shift();
  31876. yb = ya + stack.shift();
  31877. x = xb + stack.shift();
  31878. y = yb + stack.shift();
  31879. bezierCurveTo(xa, ya, xb, yb, x, y);
  31880. break;
  31881. case 26:
  31882. if (stack.length % 2) {
  31883. x += stack.shift();
  31884. }
  31885. while (stack.length > 0) {
  31886. xa = x;
  31887. ya = y + stack.shift();
  31888. xb = xa + stack.shift();
  31889. yb = ya + stack.shift();
  31890. x = xb;
  31891. y = yb + stack.shift();
  31892. bezierCurveTo(xa, ya, xb, yb, x, y);
  31893. }
  31894. break;
  31895. case 27:
  31896. if (stack.length % 2) {
  31897. y += stack.shift();
  31898. }
  31899. while (stack.length > 0) {
  31900. xa = x + stack.shift();
  31901. ya = y;
  31902. xb = xa + stack.shift();
  31903. yb = ya + stack.shift();
  31904. x = xb + stack.shift();
  31905. y = yb;
  31906. bezierCurveTo(xa, ya, xb, yb, x, y);
  31907. }
  31908. break;
  31909. case 28:
  31910. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  31911. i += 2;
  31912. break;
  31913. case 29:
  31914. n = stack.pop() + font.gsubrsBias;
  31915. subrCode = font.gsubrs[n];
  31916. if (subrCode) {
  31917. parse(subrCode);
  31918. }
  31919. break;
  31920. case 30:
  31921. while (stack.length > 0) {
  31922. xa = x;
  31923. ya = y + stack.shift();
  31924. xb = xa + stack.shift();
  31925. yb = ya + stack.shift();
  31926. x = xb + stack.shift();
  31927. y = yb + (stack.length === 1 ? stack.shift() : 0);
  31928. bezierCurveTo(xa, ya, xb, yb, x, y);
  31929. if (stack.length === 0) {
  31930. break;
  31931. }
  31932. xa = x + stack.shift();
  31933. ya = y;
  31934. xb = xa + stack.shift();
  31935. yb = ya + stack.shift();
  31936. y = yb + stack.shift();
  31937. x = xb + (stack.length === 1 ? stack.shift() : 0);
  31938. bezierCurveTo(xa, ya, xb, yb, x, y);
  31939. }
  31940. break;
  31941. case 31:
  31942. while (stack.length > 0) {
  31943. xa = x + stack.shift();
  31944. ya = y;
  31945. xb = xa + stack.shift();
  31946. yb = ya + stack.shift();
  31947. y = yb + stack.shift();
  31948. x = xb + (stack.length === 1 ? stack.shift() : 0);
  31949. bezierCurveTo(xa, ya, xb, yb, x, y);
  31950. if (stack.length === 0) {
  31951. break;
  31952. }
  31953. xa = x;
  31954. ya = y + stack.shift();
  31955. xb = xa + stack.shift();
  31956. yb = ya + stack.shift();
  31957. x = xb + stack.shift();
  31958. y = yb + (stack.length === 1 ? stack.shift() : 0);
  31959. bezierCurveTo(xa, ya, xb, yb, x, y);
  31960. }
  31961. break;
  31962. default:
  31963. if (v < 32) {
  31964. throw new _util.FormatError(`unknown operator: ${v}`);
  31965. }
  31966. if (v < 247) {
  31967. stack.push(v - 139);
  31968. } else if (v < 251) {
  31969. stack.push((v - 247) * 256 + code[i++] + 108);
  31970. } else if (v < 255) {
  31971. stack.push(-(v - 251) * 256 - code[i++] - 108);
  31972. } else {
  31973. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  31974. i += 4;
  31975. }
  31976. break;
  31977. }
  31978. if (stackClean) {
  31979. stack.length = 0;
  31980. }
  31981. }
  31982. }
  31983. parse(code);
  31984. }
  31985. const NOOP = [];
  31986. class CompiledFont {
  31987. constructor(fontMatrix) {
  31988. if (this.constructor === CompiledFont) {
  31989. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  31990. }
  31991. this.fontMatrix = fontMatrix;
  31992. this.compiledGlyphs = Object.create(null);
  31993. this.compiledCharCodeToGlyphId = Object.create(null);
  31994. }
  31995. getPathJs(unicode) {
  31996. const cmap = lookupCmap(this.cmap, unicode);
  31997. let fn = this.compiledGlyphs[cmap.glyphId];
  31998. if (!fn) {
  31999. fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
  32000. this.compiledGlyphs[cmap.glyphId] = fn;
  32001. }
  32002. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  32003. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  32004. }
  32005. return fn;
  32006. }
  32007. compileGlyph(code, glyphId) {
  32008. if (!code || code.length === 0 || code[0] === 14) {
  32009. return NOOP;
  32010. }
  32011. let fontMatrix = this.fontMatrix;
  32012. if (this.isCFFCIDFont) {
  32013. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  32014. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  32015. const fontDict = this.fdArray[fdIndex];
  32016. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  32017. } else {
  32018. (0, _util.warn)("Invalid fd index for glyph index.");
  32019. }
  32020. }
  32021. const cmds = [];
  32022. cmds.push({
  32023. cmd: "save"
  32024. });
  32025. cmds.push({
  32026. cmd: "transform",
  32027. args: fontMatrix.slice()
  32028. });
  32029. cmds.push({
  32030. cmd: "scale",
  32031. args: ["size", "-size"]
  32032. });
  32033. this.compileGlyphImpl(code, cmds, glyphId);
  32034. cmds.push({
  32035. cmd: "restore"
  32036. });
  32037. return cmds;
  32038. }
  32039. compileGlyphImpl() {
  32040. (0, _util.unreachable)("Children classes should implement this.");
  32041. }
  32042. hasBuiltPath(unicode) {
  32043. const cmap = lookupCmap(this.cmap, unicode);
  32044. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  32045. }
  32046. }
  32047. class TrueTypeCompiled extends CompiledFont {
  32048. constructor(glyphs, cmap, fontMatrix) {
  32049. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  32050. this.glyphs = glyphs;
  32051. this.cmap = cmap;
  32052. }
  32053. compileGlyphImpl(code, cmds) {
  32054. compileGlyf(code, cmds, this);
  32055. }
  32056. }
  32057. class Type2Compiled extends CompiledFont {
  32058. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  32059. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  32060. this.glyphs = cffInfo.glyphs;
  32061. this.gsubrs = cffInfo.gsubrs || [];
  32062. this.subrs = cffInfo.subrs || [];
  32063. this.cmap = cmap;
  32064. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  32065. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  32066. this.subrsBias = getSubroutineBias(this.subrs);
  32067. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  32068. this.fdSelect = cffInfo.fdSelect;
  32069. this.fdArray = cffInfo.fdArray;
  32070. }
  32071. compileGlyphImpl(code, cmds, glyphId) {
  32072. compileCharString(code, cmds, this, glyphId);
  32073. }
  32074. }
  32075. return {
  32076. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  32077. var data = new Uint8Array(font.data);
  32078. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  32079. var numTables = getUshort(data, 4);
  32080. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  32081. var tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  32082. var offset = getLong(data, p + 8);
  32083. var length = getLong(data, p + 12);
  32084. switch (tag) {
  32085. case "cmap":
  32086. cmap = parseCmap(data, offset, offset + length);
  32087. break;
  32088. case "glyf":
  32089. glyf = data.subarray(offset, offset + length);
  32090. break;
  32091. case "loca":
  32092. loca = data.subarray(offset, offset + length);
  32093. break;
  32094. case "head":
  32095. unitsPerEm = getUshort(data, offset + 18);
  32096. indexToLocFormat = getUshort(data, offset + 50);
  32097. break;
  32098. case "CFF ":
  32099. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  32100. break;
  32101. }
  32102. }
  32103. if (glyf) {
  32104. var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  32105. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  32106. }
  32107. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  32108. }
  32109. };
  32110. }();
  32111. exports.FontRendererFactory = FontRendererFactory;
  32112. /***/ }),
  32113. /* 35 */
  32114. /***/ (function(module, exports, __w_pdfjs_require__) {
  32115. "use strict";
  32116. Object.defineProperty(exports, "__esModule", {
  32117. value: true
  32118. });
  32119. exports.Type1Parser = void 0;
  32120. var _encodings = __w_pdfjs_require__(30);
  32121. var _core_utils = __w_pdfjs_require__(7);
  32122. var _stream = __w_pdfjs_require__(11);
  32123. var _util = __w_pdfjs_require__(2);
  32124. var HINTING_ENABLED = false;
  32125. var Type1CharString = function Type1CharStringClosure() {
  32126. var COMMAND_MAP = {
  32127. hstem: [1],
  32128. vstem: [3],
  32129. vmoveto: [4],
  32130. rlineto: [5],
  32131. hlineto: [6],
  32132. vlineto: [7],
  32133. rrcurveto: [8],
  32134. callsubr: [10],
  32135. flex: [12, 35],
  32136. drop: [12, 18],
  32137. endchar: [14],
  32138. rmoveto: [21],
  32139. hmoveto: [22],
  32140. vhcurveto: [30],
  32141. hvcurveto: [31]
  32142. };
  32143. function Type1CharString() {
  32144. this.width = 0;
  32145. this.lsb = 0;
  32146. this.flexing = false;
  32147. this.output = [];
  32148. this.stack = [];
  32149. }
  32150. Type1CharString.prototype = {
  32151. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  32152. var count = encoded.length;
  32153. var error = false;
  32154. var wx, sbx, subrNumber;
  32155. for (var i = 0; i < count; i++) {
  32156. var value = encoded[i];
  32157. if (value < 32) {
  32158. if (value === 12) {
  32159. value = (value << 8) + encoded[++i];
  32160. }
  32161. switch (value) {
  32162. case 1:
  32163. if (!HINTING_ENABLED) {
  32164. this.stack = [];
  32165. break;
  32166. }
  32167. error = this.executeCommand(2, COMMAND_MAP.hstem);
  32168. break;
  32169. case 3:
  32170. if (!HINTING_ENABLED) {
  32171. this.stack = [];
  32172. break;
  32173. }
  32174. error = this.executeCommand(2, COMMAND_MAP.vstem);
  32175. break;
  32176. case 4:
  32177. if (this.flexing) {
  32178. if (this.stack.length < 1) {
  32179. error = true;
  32180. break;
  32181. }
  32182. var dy = this.stack.pop();
  32183. this.stack.push(0, dy);
  32184. break;
  32185. }
  32186. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  32187. break;
  32188. case 5:
  32189. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  32190. break;
  32191. case 6:
  32192. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  32193. break;
  32194. case 7:
  32195. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  32196. break;
  32197. case 8:
  32198. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  32199. break;
  32200. case 9:
  32201. this.stack = [];
  32202. break;
  32203. case 10:
  32204. if (this.stack.length < 1) {
  32205. error = true;
  32206. break;
  32207. }
  32208. subrNumber = this.stack.pop();
  32209. if (!subrs[subrNumber]) {
  32210. error = true;
  32211. break;
  32212. }
  32213. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  32214. break;
  32215. case 11:
  32216. return error;
  32217. case 13:
  32218. if (this.stack.length < 2) {
  32219. error = true;
  32220. break;
  32221. }
  32222. wx = this.stack.pop();
  32223. sbx = this.stack.pop();
  32224. this.lsb = sbx;
  32225. this.width = wx;
  32226. this.stack.push(wx, sbx);
  32227. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  32228. break;
  32229. case 14:
  32230. this.output.push(COMMAND_MAP.endchar[0]);
  32231. break;
  32232. case 21:
  32233. if (this.flexing) {
  32234. break;
  32235. }
  32236. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  32237. break;
  32238. case 22:
  32239. if (this.flexing) {
  32240. this.stack.push(0);
  32241. break;
  32242. }
  32243. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  32244. break;
  32245. case 30:
  32246. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  32247. break;
  32248. case 31:
  32249. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  32250. break;
  32251. case (12 << 8) + 0:
  32252. this.stack = [];
  32253. break;
  32254. case (12 << 8) + 1:
  32255. if (!HINTING_ENABLED) {
  32256. this.stack = [];
  32257. break;
  32258. }
  32259. error = this.executeCommand(2, COMMAND_MAP.vstem);
  32260. break;
  32261. case (12 << 8) + 2:
  32262. if (!HINTING_ENABLED) {
  32263. this.stack = [];
  32264. break;
  32265. }
  32266. error = this.executeCommand(2, COMMAND_MAP.hstem);
  32267. break;
  32268. case (12 << 8) + 6:
  32269. if (seacAnalysisEnabled) {
  32270. this.seac = this.stack.splice(-4, 4);
  32271. error = this.executeCommand(0, COMMAND_MAP.endchar);
  32272. } else {
  32273. error = this.executeCommand(4, COMMAND_MAP.endchar);
  32274. }
  32275. break;
  32276. case (12 << 8) + 7:
  32277. if (this.stack.length < 4) {
  32278. error = true;
  32279. break;
  32280. }
  32281. this.stack.pop();
  32282. wx = this.stack.pop();
  32283. var sby = this.stack.pop();
  32284. sbx = this.stack.pop();
  32285. this.lsb = sbx;
  32286. this.width = wx;
  32287. this.stack.push(wx, sbx, sby);
  32288. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  32289. break;
  32290. case (12 << 8) + 12:
  32291. if (this.stack.length < 2) {
  32292. error = true;
  32293. break;
  32294. }
  32295. var num2 = this.stack.pop();
  32296. var num1 = this.stack.pop();
  32297. this.stack.push(num1 / num2);
  32298. break;
  32299. case (12 << 8) + 16:
  32300. if (this.stack.length < 2) {
  32301. error = true;
  32302. break;
  32303. }
  32304. subrNumber = this.stack.pop();
  32305. var numArgs = this.stack.pop();
  32306. if (subrNumber === 0 && numArgs === 3) {
  32307. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  32308. this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
  32309. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  32310. this.flexing = false;
  32311. this.stack.push(flexArgs[15], flexArgs[16]);
  32312. } else if (subrNumber === 1 && numArgs === 0) {
  32313. this.flexing = true;
  32314. }
  32315. break;
  32316. case (12 << 8) + 17:
  32317. break;
  32318. case (12 << 8) + 33:
  32319. this.stack = [];
  32320. break;
  32321. default:
  32322. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  32323. break;
  32324. }
  32325. if (error) {
  32326. break;
  32327. }
  32328. continue;
  32329. } else if (value <= 246) {
  32330. value = value - 139;
  32331. } else if (value <= 250) {
  32332. value = (value - 247) * 256 + encoded[++i] + 108;
  32333. } else if (value <= 254) {
  32334. value = -((value - 251) * 256) - encoded[++i] - 108;
  32335. } else {
  32336. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  32337. }
  32338. this.stack.push(value);
  32339. }
  32340. return error;
  32341. },
  32342. executeCommand(howManyArgs, command, keepStack) {
  32343. var stackLength = this.stack.length;
  32344. if (howManyArgs > stackLength) {
  32345. return true;
  32346. }
  32347. var start = stackLength - howManyArgs;
  32348. for (var i = start; i < stackLength; i++) {
  32349. var value = this.stack[i];
  32350. if (Number.isInteger(value)) {
  32351. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  32352. } else {
  32353. value = 65536 * value | 0;
  32354. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  32355. }
  32356. }
  32357. this.output.push.apply(this.output, command);
  32358. if (keepStack) {
  32359. this.stack.splice(start, howManyArgs);
  32360. } else {
  32361. this.stack.length = 0;
  32362. }
  32363. return false;
  32364. }
  32365. };
  32366. return Type1CharString;
  32367. }();
  32368. var Type1Parser = function Type1ParserClosure() {
  32369. var EEXEC_ENCRYPT_KEY = 55665;
  32370. var CHAR_STRS_ENCRYPT_KEY = 4330;
  32371. function isHexDigit(code) {
  32372. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  32373. }
  32374. function decrypt(data, key, discardNumber) {
  32375. if (discardNumber >= data.length) {
  32376. return new Uint8Array(0);
  32377. }
  32378. var r = key | 0,
  32379. c1 = 52845,
  32380. c2 = 22719,
  32381. i,
  32382. j;
  32383. for (i = 0; i < discardNumber; i++) {
  32384. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  32385. }
  32386. var count = data.length - discardNumber;
  32387. var decrypted = new Uint8Array(count);
  32388. for (i = discardNumber, j = 0; j < count; i++, j++) {
  32389. var value = data[i];
  32390. decrypted[j] = value ^ r >> 8;
  32391. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  32392. }
  32393. return decrypted;
  32394. }
  32395. function decryptAscii(data, key, discardNumber) {
  32396. var r = key | 0,
  32397. c1 = 52845,
  32398. c2 = 22719;
  32399. var count = data.length,
  32400. maybeLength = count >>> 1;
  32401. var decrypted = new Uint8Array(maybeLength);
  32402. var i, j;
  32403. for (i = 0, j = 0; i < count; i++) {
  32404. var digit1 = data[i];
  32405. if (!isHexDigit(digit1)) {
  32406. continue;
  32407. }
  32408. i++;
  32409. var digit2;
  32410. while (i < count && !isHexDigit(digit2 = data[i])) {
  32411. i++;
  32412. }
  32413. if (i < count) {
  32414. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  32415. decrypted[j++] = value ^ r >> 8;
  32416. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  32417. }
  32418. }
  32419. return Array.prototype.slice.call(decrypted, discardNumber, j);
  32420. }
  32421. function isSpecial(c) {
  32422. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  32423. }
  32424. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  32425. if (encrypted) {
  32426. var data = stream.getBytes();
  32427. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  32428. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  32429. }
  32430. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  32431. this.stream = stream;
  32432. this.nextChar();
  32433. }
  32434. Type1Parser.prototype = {
  32435. readNumberArray: function Type1Parser_readNumberArray() {
  32436. this.getToken();
  32437. var array = [];
  32438. while (true) {
  32439. var token = this.getToken();
  32440. if (token === null || token === "]" || token === "}") {
  32441. break;
  32442. }
  32443. array.push(parseFloat(token || 0));
  32444. }
  32445. return array;
  32446. },
  32447. readNumber: function Type1Parser_readNumber() {
  32448. var token = this.getToken();
  32449. return parseFloat(token || 0);
  32450. },
  32451. readInt: function Type1Parser_readInt() {
  32452. var token = this.getToken();
  32453. return parseInt(token || 0, 10) | 0;
  32454. },
  32455. readBoolean: function Type1Parser_readBoolean() {
  32456. var token = this.getToken();
  32457. return token === "true" ? 1 : 0;
  32458. },
  32459. nextChar: function Type1_nextChar() {
  32460. return this.currentChar = this.stream.getByte();
  32461. },
  32462. getToken: function Type1Parser_getToken() {
  32463. var comment = false;
  32464. var ch = this.currentChar;
  32465. while (true) {
  32466. if (ch === -1) {
  32467. return null;
  32468. }
  32469. if (comment) {
  32470. if (ch === 0x0a || ch === 0x0d) {
  32471. comment = false;
  32472. }
  32473. } else if (ch === 0x25) {
  32474. comment = true;
  32475. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  32476. break;
  32477. }
  32478. ch = this.nextChar();
  32479. }
  32480. if (isSpecial(ch)) {
  32481. this.nextChar();
  32482. return String.fromCharCode(ch);
  32483. }
  32484. var token = "";
  32485. do {
  32486. token += String.fromCharCode(ch);
  32487. ch = this.nextChar();
  32488. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  32489. return token;
  32490. },
  32491. readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) {
  32492. if (lenIV === -1) {
  32493. return bytes;
  32494. }
  32495. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  32496. },
  32497. extractFontProgram: function Type1Parser_extractFontProgram(properties) {
  32498. var stream = this.stream;
  32499. var subrs = [],
  32500. charstrings = [];
  32501. var privateData = Object.create(null);
  32502. privateData["lenIV"] = 4;
  32503. var program = {
  32504. subrs: [],
  32505. charstrings: [],
  32506. properties: {
  32507. privateData
  32508. }
  32509. };
  32510. var token, length, data, lenIV, encoded;
  32511. while ((token = this.getToken()) !== null) {
  32512. if (token !== "/") {
  32513. continue;
  32514. }
  32515. token = this.getToken();
  32516. switch (token) {
  32517. case "CharStrings":
  32518. this.getToken();
  32519. this.getToken();
  32520. this.getToken();
  32521. this.getToken();
  32522. while (true) {
  32523. token = this.getToken();
  32524. if (token === null || token === "end") {
  32525. break;
  32526. }
  32527. if (token !== "/") {
  32528. continue;
  32529. }
  32530. var glyph = this.getToken();
  32531. length = this.readInt();
  32532. this.getToken();
  32533. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  32534. lenIV = program.properties.privateData["lenIV"];
  32535. encoded = this.readCharStrings(data, lenIV);
  32536. this.nextChar();
  32537. token = this.getToken();
  32538. if (token === "noaccess") {
  32539. this.getToken();
  32540. }
  32541. charstrings.push({
  32542. glyph,
  32543. encoded
  32544. });
  32545. }
  32546. break;
  32547. case "Subrs":
  32548. this.readInt();
  32549. this.getToken();
  32550. while (this.getToken() === "dup") {
  32551. var index = this.readInt();
  32552. length = this.readInt();
  32553. this.getToken();
  32554. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  32555. lenIV = program.properties.privateData["lenIV"];
  32556. encoded = this.readCharStrings(data, lenIV);
  32557. this.nextChar();
  32558. token = this.getToken();
  32559. if (token === "noaccess") {
  32560. this.getToken();
  32561. }
  32562. subrs[index] = encoded;
  32563. }
  32564. break;
  32565. case "BlueValues":
  32566. case "OtherBlues":
  32567. case "FamilyBlues":
  32568. case "FamilyOtherBlues":
  32569. var blueArray = this.readNumberArray();
  32570. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  32571. program.properties.privateData[token] = blueArray;
  32572. }
  32573. break;
  32574. case "StemSnapH":
  32575. case "StemSnapV":
  32576. program.properties.privateData[token] = this.readNumberArray();
  32577. break;
  32578. case "StdHW":
  32579. case "StdVW":
  32580. program.properties.privateData[token] = this.readNumberArray()[0];
  32581. break;
  32582. case "BlueShift":
  32583. case "lenIV":
  32584. case "BlueFuzz":
  32585. case "BlueScale":
  32586. case "LanguageGroup":
  32587. case "ExpansionFactor":
  32588. program.properties.privateData[token] = this.readNumber();
  32589. break;
  32590. case "ForceBold":
  32591. program.properties.privateData[token] = this.readBoolean();
  32592. break;
  32593. }
  32594. }
  32595. for (var i = 0; i < charstrings.length; i++) {
  32596. glyph = charstrings[i].glyph;
  32597. encoded = charstrings[i].encoded;
  32598. var charString = new Type1CharString();
  32599. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  32600. var output = charString.output;
  32601. if (error) {
  32602. output = [14];
  32603. }
  32604. const charStringObject = {
  32605. glyphName: glyph,
  32606. charstring: output,
  32607. width: charString.width,
  32608. lsb: charString.lsb,
  32609. seac: charString.seac
  32610. };
  32611. if (glyph === ".notdef") {
  32612. program.charstrings.unshift(charStringObject);
  32613. } else {
  32614. program.charstrings.push(charStringObject);
  32615. }
  32616. if (properties.builtInEncoding) {
  32617. const index = properties.builtInEncoding.indexOf(glyph);
  32618. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  32619. properties.widths[index] = charString.width;
  32620. }
  32621. }
  32622. }
  32623. return program;
  32624. },
  32625. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  32626. var token;
  32627. while ((token = this.getToken()) !== null) {
  32628. if (token !== "/") {
  32629. continue;
  32630. }
  32631. token = this.getToken();
  32632. switch (token) {
  32633. case "FontMatrix":
  32634. var matrix = this.readNumberArray();
  32635. properties.fontMatrix = matrix;
  32636. break;
  32637. case "Encoding":
  32638. var encodingArg = this.getToken();
  32639. var encoding;
  32640. if (!/^\d+$/.test(encodingArg)) {
  32641. encoding = (0, _encodings.getEncoding)(encodingArg);
  32642. } else {
  32643. encoding = [];
  32644. var size = parseInt(encodingArg, 10) | 0;
  32645. this.getToken();
  32646. for (var j = 0; j < size; j++) {
  32647. token = this.getToken();
  32648. while (token !== "dup" && token !== "def") {
  32649. token = this.getToken();
  32650. if (token === null) {
  32651. return;
  32652. }
  32653. }
  32654. if (token === "def") {
  32655. break;
  32656. }
  32657. var index = this.readInt();
  32658. this.getToken();
  32659. var glyph = this.getToken();
  32660. encoding[index] = glyph;
  32661. this.getToken();
  32662. }
  32663. }
  32664. properties.builtInEncoding = encoding;
  32665. break;
  32666. case "FontBBox":
  32667. var fontBBox = this.readNumberArray();
  32668. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  32669. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  32670. properties.ascentScaled = true;
  32671. break;
  32672. }
  32673. }
  32674. }
  32675. };
  32676. return Type1Parser;
  32677. }();
  32678. exports.Type1Parser = Type1Parser;
  32679. /***/ }),
  32680. /* 36 */
  32681. /***/ (function(module, exports, __w_pdfjs_require__) {
  32682. "use strict";
  32683. Object.defineProperty(exports, "__esModule", {
  32684. value: true
  32685. });
  32686. exports.getTilingPatternIR = getTilingPatternIR;
  32687. exports.Pattern = void 0;
  32688. var _util = __w_pdfjs_require__(2);
  32689. var _colorspace = __w_pdfjs_require__(22);
  32690. var _primitives = __w_pdfjs_require__(4);
  32691. var _core_utils = __w_pdfjs_require__(7);
  32692. var ShadingType = {
  32693. FUNCTION_BASED: 1,
  32694. AXIAL: 2,
  32695. RADIAL: 3,
  32696. FREE_FORM_MESH: 4,
  32697. LATTICE_FORM_MESH: 5,
  32698. COONS_PATCH_MESH: 6,
  32699. TENSOR_PATCH_MESH: 7
  32700. };
  32701. var Pattern = function PatternClosure() {
  32702. function Pattern() {
  32703. (0, _util.unreachable)("should not call Pattern constructor");
  32704. }
  32705. Pattern.prototype = {
  32706. getPattern: function Pattern_getPattern(ctx) {
  32707. (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`);
  32708. }
  32709. };
  32710. Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) {
  32711. var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  32712. var type = dict.get("ShadingType");
  32713. try {
  32714. switch (type) {
  32715. case ShadingType.AXIAL:
  32716. case ShadingType.RADIAL:
  32717. return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory);
  32718. case ShadingType.FREE_FORM_MESH:
  32719. case ShadingType.LATTICE_FORM_MESH:
  32720. case ShadingType.COONS_PATCH_MESH:
  32721. case ShadingType.TENSOR_PATCH_MESH:
  32722. return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory);
  32723. default:
  32724. throw new _util.FormatError("Unsupported ShadingType: " + type);
  32725. }
  32726. } catch (ex) {
  32727. if (ex instanceof _core_utils.MissingDataException) {
  32728. throw ex;
  32729. }
  32730. handler.send("UnsupportedFeature", {
  32731. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  32732. });
  32733. (0, _util.warn)(ex);
  32734. return new Shadings.Dummy();
  32735. }
  32736. };
  32737. return Pattern;
  32738. }();
  32739. exports.Pattern = Pattern;
  32740. var Shadings = {};
  32741. Shadings.SMALL_NUMBER = 1e-6;
  32742. Shadings.RadialAxial = function RadialAxialClosure() {
  32743. function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) {
  32744. this.matrix = matrix;
  32745. this.coordsArr = dict.getArray("Coords");
  32746. this.shadingType = dict.get("ShadingType");
  32747. this.type = "Pattern";
  32748. var cs = dict.get("ColorSpace", "CS");
  32749. cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
  32750. this.cs = cs;
  32751. const bbox = dict.getArray("BBox");
  32752. if (Array.isArray(bbox) && bbox.length === 4) {
  32753. this.bbox = _util.Util.normalizeRect(bbox);
  32754. } else {
  32755. this.bbox = null;
  32756. }
  32757. var t0 = 0.0,
  32758. t1 = 1.0;
  32759. if (dict.has("Domain")) {
  32760. var domainArr = dict.getArray("Domain");
  32761. t0 = domainArr[0];
  32762. t1 = domainArr[1];
  32763. }
  32764. var extendStart = false,
  32765. extendEnd = false;
  32766. if (dict.has("Extend")) {
  32767. var extendArr = dict.getArray("Extend");
  32768. extendStart = extendArr[0];
  32769. extendEnd = extendArr[1];
  32770. }
  32771. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  32772. var x1 = this.coordsArr[0];
  32773. var y1 = this.coordsArr[1];
  32774. var r1 = this.coordsArr[2];
  32775. var x2 = this.coordsArr[3];
  32776. var y2 = this.coordsArr[4];
  32777. var r2 = this.coordsArr[5];
  32778. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  32779. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  32780. (0, _util.warn)("Unsupported radial gradient.");
  32781. }
  32782. }
  32783. this.extendStart = extendStart;
  32784. this.extendEnd = extendEnd;
  32785. var fnObj = dict.get("Function");
  32786. var fn = pdfFunctionFactory.createFromArray(fnObj);
  32787. const NUMBER_OF_SAMPLES = 10;
  32788. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  32789. var colorStops = this.colorStops = [];
  32790. if (t0 >= t1 || step <= 0) {
  32791. (0, _util.info)("Bad shading domain.");
  32792. return;
  32793. }
  32794. var color = new Float32Array(cs.numComps),
  32795. ratio = new Float32Array(1);
  32796. var rgbColor;
  32797. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  32798. ratio[0] = t0 + i * step;
  32799. fn(ratio, 0, color, 0);
  32800. rgbColor = cs.getRgb(color, 0);
  32801. var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  32802. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  32803. }
  32804. var background = "transparent";
  32805. if (dict.has("Background")) {
  32806. rgbColor = cs.getRgb(dict.get("Background"), 0);
  32807. background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  32808. }
  32809. if (!extendStart) {
  32810. colorStops.unshift([0, background]);
  32811. colorStops[1][0] += Shadings.SMALL_NUMBER;
  32812. }
  32813. if (!extendEnd) {
  32814. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  32815. colorStops.push([1, background]);
  32816. }
  32817. this.colorStops = colorStops;
  32818. }
  32819. RadialAxial.prototype = {
  32820. getIR: function RadialAxial_getIR() {
  32821. var coordsArr = this.coordsArr;
  32822. var shadingType = this.shadingType;
  32823. var type, p0, p1, r0, r1;
  32824. if (shadingType === ShadingType.AXIAL) {
  32825. p0 = [coordsArr[0], coordsArr[1]];
  32826. p1 = [coordsArr[2], coordsArr[3]];
  32827. r0 = null;
  32828. r1 = null;
  32829. type = "axial";
  32830. } else if (shadingType === ShadingType.RADIAL) {
  32831. p0 = [coordsArr[0], coordsArr[1]];
  32832. p1 = [coordsArr[3], coordsArr[4]];
  32833. r0 = coordsArr[2];
  32834. r1 = coordsArr[5];
  32835. type = "radial";
  32836. } else {
  32837. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  32838. }
  32839. var matrix = this.matrix;
  32840. if (matrix) {
  32841. p0 = _util.Util.applyTransform(p0, matrix);
  32842. p1 = _util.Util.applyTransform(p1, matrix);
  32843. if (shadingType === ShadingType.RADIAL) {
  32844. var scale = _util.Util.singularValueDecompose2dScale(matrix);
  32845. r0 *= scale[0];
  32846. r1 *= scale[1];
  32847. }
  32848. }
  32849. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  32850. }
  32851. };
  32852. return RadialAxial;
  32853. }();
  32854. Shadings.Mesh = function MeshClosure() {
  32855. function MeshStreamReader(stream, context) {
  32856. this.stream = stream;
  32857. this.context = context;
  32858. this.buffer = 0;
  32859. this.bufferLength = 0;
  32860. var numComps = context.numComps;
  32861. this.tmpCompsBuf = new Float32Array(numComps);
  32862. var csNumComps = context.colorSpace.numComps;
  32863. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  32864. }
  32865. MeshStreamReader.prototype = {
  32866. get hasData() {
  32867. if (this.stream.end) {
  32868. return this.stream.pos < this.stream.end;
  32869. }
  32870. if (this.bufferLength > 0) {
  32871. return true;
  32872. }
  32873. var nextByte = this.stream.getByte();
  32874. if (nextByte < 0) {
  32875. return false;
  32876. }
  32877. this.buffer = nextByte;
  32878. this.bufferLength = 8;
  32879. return true;
  32880. },
  32881. readBits: function MeshStreamReader_readBits(n) {
  32882. var buffer = this.buffer;
  32883. var bufferLength = this.bufferLength;
  32884. if (n === 32) {
  32885. if (bufferLength === 0) {
  32886. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  32887. }
  32888. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  32889. var nextByte = this.stream.getByte();
  32890. this.buffer = nextByte & (1 << bufferLength) - 1;
  32891. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  32892. }
  32893. if (n === 8 && bufferLength === 0) {
  32894. return this.stream.getByte();
  32895. }
  32896. while (bufferLength < n) {
  32897. buffer = buffer << 8 | this.stream.getByte();
  32898. bufferLength += 8;
  32899. }
  32900. bufferLength -= n;
  32901. this.bufferLength = bufferLength;
  32902. this.buffer = buffer & (1 << bufferLength) - 1;
  32903. return buffer >> bufferLength;
  32904. },
  32905. align: function MeshStreamReader_align() {
  32906. this.buffer = 0;
  32907. this.bufferLength = 0;
  32908. },
  32909. readFlag: function MeshStreamReader_readFlag() {
  32910. return this.readBits(this.context.bitsPerFlag);
  32911. },
  32912. readCoordinate: function MeshStreamReader_readCoordinate() {
  32913. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  32914. var xi = this.readBits(bitsPerCoordinate);
  32915. var yi = this.readBits(bitsPerCoordinate);
  32916. var decode = this.context.decode;
  32917. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  32918. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  32919. },
  32920. readComponents: function MeshStreamReader_readComponents() {
  32921. var numComps = this.context.numComps;
  32922. var bitsPerComponent = this.context.bitsPerComponent;
  32923. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  32924. var decode = this.context.decode;
  32925. var components = this.tmpCompsBuf;
  32926. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  32927. var ci = this.readBits(bitsPerComponent);
  32928. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  32929. }
  32930. var color = this.tmpCsCompsBuf;
  32931. if (this.context.colorFn) {
  32932. this.context.colorFn(components, 0, color, 0);
  32933. }
  32934. return this.context.colorSpace.getRgb(color, 0);
  32935. }
  32936. };
  32937. function decodeType4Shading(mesh, reader) {
  32938. var coords = mesh.coords;
  32939. var colors = mesh.colors;
  32940. var operators = [];
  32941. var ps = [];
  32942. var verticesLeft = 0;
  32943. while (reader.hasData) {
  32944. var f = reader.readFlag();
  32945. var coord = reader.readCoordinate();
  32946. var color = reader.readComponents();
  32947. if (verticesLeft === 0) {
  32948. if (!(0 <= f && f <= 2)) {
  32949. throw new _util.FormatError("Unknown type4 flag");
  32950. }
  32951. switch (f) {
  32952. case 0:
  32953. verticesLeft = 3;
  32954. break;
  32955. case 1:
  32956. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  32957. verticesLeft = 1;
  32958. break;
  32959. case 2:
  32960. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  32961. verticesLeft = 1;
  32962. break;
  32963. }
  32964. operators.push(f);
  32965. }
  32966. ps.push(coords.length);
  32967. coords.push(coord);
  32968. colors.push(color);
  32969. verticesLeft--;
  32970. reader.align();
  32971. }
  32972. mesh.figures.push({
  32973. type: "triangles",
  32974. coords: new Int32Array(ps),
  32975. colors: new Int32Array(ps)
  32976. });
  32977. }
  32978. function decodeType5Shading(mesh, reader, verticesPerRow) {
  32979. var coords = mesh.coords;
  32980. var colors = mesh.colors;
  32981. var ps = [];
  32982. while (reader.hasData) {
  32983. var coord = reader.readCoordinate();
  32984. var color = reader.readComponents();
  32985. ps.push(coords.length);
  32986. coords.push(coord);
  32987. colors.push(color);
  32988. }
  32989. mesh.figures.push({
  32990. type: "lattice",
  32991. coords: new Int32Array(ps),
  32992. colors: new Int32Array(ps),
  32993. verticesPerRow
  32994. });
  32995. }
  32996. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  32997. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  32998. var TRIANGLE_DENSITY = 20;
  32999. var getB = function getBClosure() {
  33000. function buildB(count) {
  33001. var lut = [];
  33002. for (var i = 0; i <= count; i++) {
  33003. var t = i / count,
  33004. t_ = 1 - t;
  33005. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  33006. }
  33007. return lut;
  33008. }
  33009. var cache = [];
  33010. return function getB(count) {
  33011. if (!cache[count]) {
  33012. cache[count] = buildB(count);
  33013. }
  33014. return cache[count];
  33015. };
  33016. }();
  33017. function buildFigureFromPatch(mesh, index) {
  33018. var figure = mesh.figures[index];
  33019. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  33020. var coords = mesh.coords,
  33021. colors = mesh.colors;
  33022. var pi = figure.coords;
  33023. var ci = figure.colors;
  33024. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  33025. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  33026. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  33027. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  33028. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  33029. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  33030. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  33031. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  33032. var verticesPerRow = splitXBy + 1;
  33033. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  33034. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  33035. var k = 0;
  33036. var cl = new Uint8Array(3),
  33037. cr = new Uint8Array(3);
  33038. var c0 = colors[ci[0]],
  33039. c1 = colors[ci[1]],
  33040. c2 = colors[ci[2]],
  33041. c3 = colors[ci[3]];
  33042. var bRow = getB(splitYBy),
  33043. bCol = getB(splitXBy);
  33044. for (var row = 0; row <= splitYBy; row++) {
  33045. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  33046. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  33047. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  33048. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  33049. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  33050. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  33051. for (var col = 0; col <= splitXBy; col++, k++) {
  33052. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  33053. continue;
  33054. }
  33055. var x = 0,
  33056. y = 0;
  33057. var q = 0;
  33058. for (var i = 0; i <= 3; i++) {
  33059. for (var j = 0; j <= 3; j++, q++) {
  33060. var m = bRow[row][i] * bCol[col][j];
  33061. x += coords[pi[q]][0] * m;
  33062. y += coords[pi[q]][1] * m;
  33063. }
  33064. }
  33065. figureCoords[k] = coords.length;
  33066. coords.push([x, y]);
  33067. figureColors[k] = colors.length;
  33068. var newColor = new Uint8Array(3);
  33069. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  33070. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  33071. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  33072. colors.push(newColor);
  33073. }
  33074. }
  33075. figureCoords[0] = pi[0];
  33076. figureColors[0] = ci[0];
  33077. figureCoords[splitXBy] = pi[3];
  33078. figureColors[splitXBy] = ci[1];
  33079. figureCoords[verticesPerRow * splitYBy] = pi[12];
  33080. figureColors[verticesPerRow * splitYBy] = ci[2];
  33081. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  33082. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  33083. mesh.figures[index] = {
  33084. type: "lattice",
  33085. coords: figureCoords,
  33086. colors: figureColors,
  33087. verticesPerRow
  33088. };
  33089. }
  33090. function decodeType6Shading(mesh, reader) {
  33091. var coords = mesh.coords;
  33092. var colors = mesh.colors;
  33093. var ps = new Int32Array(16);
  33094. var cs = new Int32Array(4);
  33095. while (reader.hasData) {
  33096. var f = reader.readFlag();
  33097. if (!(0 <= f && f <= 3)) {
  33098. throw new _util.FormatError("Unknown type6 flag");
  33099. }
  33100. var i, ii;
  33101. var pi = coords.length;
  33102. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  33103. coords.push(reader.readCoordinate());
  33104. }
  33105. var ci = colors.length;
  33106. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  33107. colors.push(reader.readComponents());
  33108. }
  33109. var tmp1, tmp2, tmp3, tmp4;
  33110. switch (f) {
  33111. case 0:
  33112. ps[12] = pi + 3;
  33113. ps[13] = pi + 4;
  33114. ps[14] = pi + 5;
  33115. ps[15] = pi + 6;
  33116. ps[8] = pi + 2;
  33117. ps[11] = pi + 7;
  33118. ps[4] = pi + 1;
  33119. ps[7] = pi + 8;
  33120. ps[0] = pi;
  33121. ps[1] = pi + 11;
  33122. ps[2] = pi + 10;
  33123. ps[3] = pi + 9;
  33124. cs[2] = ci + 1;
  33125. cs[3] = ci + 2;
  33126. cs[0] = ci;
  33127. cs[1] = ci + 3;
  33128. break;
  33129. case 1:
  33130. tmp1 = ps[12];
  33131. tmp2 = ps[13];
  33132. tmp3 = ps[14];
  33133. tmp4 = ps[15];
  33134. ps[12] = tmp4;
  33135. ps[13] = pi + 0;
  33136. ps[14] = pi + 1;
  33137. ps[15] = pi + 2;
  33138. ps[8] = tmp3;
  33139. ps[11] = pi + 3;
  33140. ps[4] = tmp2;
  33141. ps[7] = pi + 4;
  33142. ps[0] = tmp1;
  33143. ps[1] = pi + 7;
  33144. ps[2] = pi + 6;
  33145. ps[3] = pi + 5;
  33146. tmp1 = cs[2];
  33147. tmp2 = cs[3];
  33148. cs[2] = tmp2;
  33149. cs[3] = ci;
  33150. cs[0] = tmp1;
  33151. cs[1] = ci + 1;
  33152. break;
  33153. case 2:
  33154. tmp1 = ps[15];
  33155. tmp2 = ps[11];
  33156. ps[12] = ps[3];
  33157. ps[13] = pi + 0;
  33158. ps[14] = pi + 1;
  33159. ps[15] = pi + 2;
  33160. ps[8] = ps[7];
  33161. ps[11] = pi + 3;
  33162. ps[4] = tmp2;
  33163. ps[7] = pi + 4;
  33164. ps[0] = tmp1;
  33165. ps[1] = pi + 7;
  33166. ps[2] = pi + 6;
  33167. ps[3] = pi + 5;
  33168. tmp1 = cs[3];
  33169. cs[2] = cs[1];
  33170. cs[3] = ci;
  33171. cs[0] = tmp1;
  33172. cs[1] = ci + 1;
  33173. break;
  33174. case 3:
  33175. ps[12] = ps[0];
  33176. ps[13] = pi + 0;
  33177. ps[14] = pi + 1;
  33178. ps[15] = pi + 2;
  33179. ps[8] = ps[1];
  33180. ps[11] = pi + 3;
  33181. ps[4] = ps[2];
  33182. ps[7] = pi + 4;
  33183. ps[0] = ps[3];
  33184. ps[1] = pi + 7;
  33185. ps[2] = pi + 6;
  33186. ps[3] = pi + 5;
  33187. cs[2] = cs[0];
  33188. cs[3] = ci;
  33189. cs[0] = cs[1];
  33190. cs[1] = ci + 1;
  33191. break;
  33192. }
  33193. ps[5] = coords.length;
  33194. coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
  33195. ps[6] = coords.length;
  33196. coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
  33197. ps[9] = coords.length;
  33198. coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
  33199. ps[10] = coords.length;
  33200. coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
  33201. mesh.figures.push({
  33202. type: "patch",
  33203. coords: new Int32Array(ps),
  33204. colors: new Int32Array(cs)
  33205. });
  33206. }
  33207. }
  33208. function decodeType7Shading(mesh, reader) {
  33209. var coords = mesh.coords;
  33210. var colors = mesh.colors;
  33211. var ps = new Int32Array(16);
  33212. var cs = new Int32Array(4);
  33213. while (reader.hasData) {
  33214. var f = reader.readFlag();
  33215. if (!(0 <= f && f <= 3)) {
  33216. throw new _util.FormatError("Unknown type7 flag");
  33217. }
  33218. var i, ii;
  33219. var pi = coords.length;
  33220. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  33221. coords.push(reader.readCoordinate());
  33222. }
  33223. var ci = colors.length;
  33224. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  33225. colors.push(reader.readComponents());
  33226. }
  33227. var tmp1, tmp2, tmp3, tmp4;
  33228. switch (f) {
  33229. case 0:
  33230. ps[12] = pi + 3;
  33231. ps[13] = pi + 4;
  33232. ps[14] = pi + 5;
  33233. ps[15] = pi + 6;
  33234. ps[8] = pi + 2;
  33235. ps[9] = pi + 13;
  33236. ps[10] = pi + 14;
  33237. ps[11] = pi + 7;
  33238. ps[4] = pi + 1;
  33239. ps[5] = pi + 12;
  33240. ps[6] = pi + 15;
  33241. ps[7] = pi + 8;
  33242. ps[0] = pi;
  33243. ps[1] = pi + 11;
  33244. ps[2] = pi + 10;
  33245. ps[3] = pi + 9;
  33246. cs[2] = ci + 1;
  33247. cs[3] = ci + 2;
  33248. cs[0] = ci;
  33249. cs[1] = ci + 3;
  33250. break;
  33251. case 1:
  33252. tmp1 = ps[12];
  33253. tmp2 = ps[13];
  33254. tmp3 = ps[14];
  33255. tmp4 = ps[15];
  33256. ps[12] = tmp4;
  33257. ps[13] = pi + 0;
  33258. ps[14] = pi + 1;
  33259. ps[15] = pi + 2;
  33260. ps[8] = tmp3;
  33261. ps[9] = pi + 9;
  33262. ps[10] = pi + 10;
  33263. ps[11] = pi + 3;
  33264. ps[4] = tmp2;
  33265. ps[5] = pi + 8;
  33266. ps[6] = pi + 11;
  33267. ps[7] = pi + 4;
  33268. ps[0] = tmp1;
  33269. ps[1] = pi + 7;
  33270. ps[2] = pi + 6;
  33271. ps[3] = pi + 5;
  33272. tmp1 = cs[2];
  33273. tmp2 = cs[3];
  33274. cs[2] = tmp2;
  33275. cs[3] = ci;
  33276. cs[0] = tmp1;
  33277. cs[1] = ci + 1;
  33278. break;
  33279. case 2:
  33280. tmp1 = ps[15];
  33281. tmp2 = ps[11];
  33282. ps[12] = ps[3];
  33283. ps[13] = pi + 0;
  33284. ps[14] = pi + 1;
  33285. ps[15] = pi + 2;
  33286. ps[8] = ps[7];
  33287. ps[9] = pi + 9;
  33288. ps[10] = pi + 10;
  33289. ps[11] = pi + 3;
  33290. ps[4] = tmp2;
  33291. ps[5] = pi + 8;
  33292. ps[6] = pi + 11;
  33293. ps[7] = pi + 4;
  33294. ps[0] = tmp1;
  33295. ps[1] = pi + 7;
  33296. ps[2] = pi + 6;
  33297. ps[3] = pi + 5;
  33298. tmp1 = cs[3];
  33299. cs[2] = cs[1];
  33300. cs[3] = ci;
  33301. cs[0] = tmp1;
  33302. cs[1] = ci + 1;
  33303. break;
  33304. case 3:
  33305. ps[12] = ps[0];
  33306. ps[13] = pi + 0;
  33307. ps[14] = pi + 1;
  33308. ps[15] = pi + 2;
  33309. ps[8] = ps[1];
  33310. ps[9] = pi + 9;
  33311. ps[10] = pi + 10;
  33312. ps[11] = pi + 3;
  33313. ps[4] = ps[2];
  33314. ps[5] = pi + 8;
  33315. ps[6] = pi + 11;
  33316. ps[7] = pi + 4;
  33317. ps[0] = ps[3];
  33318. ps[1] = pi + 7;
  33319. ps[2] = pi + 6;
  33320. ps[3] = pi + 5;
  33321. cs[2] = cs[0];
  33322. cs[3] = ci;
  33323. cs[0] = cs[1];
  33324. cs[1] = ci + 1;
  33325. break;
  33326. }
  33327. mesh.figures.push({
  33328. type: "patch",
  33329. coords: new Int32Array(ps),
  33330. colors: new Int32Array(cs)
  33331. });
  33332. }
  33333. }
  33334. function updateBounds(mesh) {
  33335. var minX = mesh.coords[0][0],
  33336. minY = mesh.coords[0][1],
  33337. maxX = minX,
  33338. maxY = minY;
  33339. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  33340. var x = mesh.coords[i][0],
  33341. y = mesh.coords[i][1];
  33342. minX = minX > x ? x : minX;
  33343. minY = minY > y ? y : minY;
  33344. maxX = maxX < x ? x : maxX;
  33345. maxY = maxY < y ? y : maxY;
  33346. }
  33347. mesh.bounds = [minX, minY, maxX, maxY];
  33348. }
  33349. function packData(mesh) {
  33350. var i, ii, j, jj;
  33351. var coords = mesh.coords;
  33352. var coordsPacked = new Float32Array(coords.length * 2);
  33353. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  33354. var xy = coords[i];
  33355. coordsPacked[j++] = xy[0];
  33356. coordsPacked[j++] = xy[1];
  33357. }
  33358. mesh.coords = coordsPacked;
  33359. var colors = mesh.colors;
  33360. var colorsPacked = new Uint8Array(colors.length * 3);
  33361. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  33362. var c = colors[i];
  33363. colorsPacked[j++] = c[0];
  33364. colorsPacked[j++] = c[1];
  33365. colorsPacked[j++] = c[2];
  33366. }
  33367. mesh.colors = colorsPacked;
  33368. var figures = mesh.figures;
  33369. for (i = 0, ii = figures.length; i < ii; i++) {
  33370. var figure = figures[i],
  33371. ps = figure.coords,
  33372. cs = figure.colors;
  33373. for (j = 0, jj = ps.length; j < jj; j++) {
  33374. ps[j] *= 2;
  33375. cs[j] *= 3;
  33376. }
  33377. }
  33378. }
  33379. function Mesh(stream, matrix, xref, res, pdfFunctionFactory) {
  33380. if (!(0, _primitives.isStream)(stream)) {
  33381. throw new _util.FormatError("Mesh data is not a stream");
  33382. }
  33383. var dict = stream.dict;
  33384. this.matrix = matrix;
  33385. this.shadingType = dict.get("ShadingType");
  33386. this.type = "Pattern";
  33387. const bbox = dict.getArray("BBox");
  33388. if (Array.isArray(bbox) && bbox.length === 4) {
  33389. this.bbox = _util.Util.normalizeRect(bbox);
  33390. } else {
  33391. this.bbox = null;
  33392. }
  33393. var cs = dict.get("ColorSpace", "CS");
  33394. cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
  33395. this.cs = cs;
  33396. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  33397. var fnObj = dict.get("Function");
  33398. var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  33399. this.coords = [];
  33400. this.colors = [];
  33401. this.figures = [];
  33402. var decodeContext = {
  33403. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  33404. bitsPerComponent: dict.get("BitsPerComponent"),
  33405. bitsPerFlag: dict.get("BitsPerFlag"),
  33406. decode: dict.getArray("Decode"),
  33407. colorFn: fn,
  33408. colorSpace: cs,
  33409. numComps: fn ? 1 : cs.numComps
  33410. };
  33411. var reader = new MeshStreamReader(stream, decodeContext);
  33412. var patchMesh = false;
  33413. switch (this.shadingType) {
  33414. case ShadingType.FREE_FORM_MESH:
  33415. decodeType4Shading(this, reader);
  33416. break;
  33417. case ShadingType.LATTICE_FORM_MESH:
  33418. var verticesPerRow = dict.get("VerticesPerRow") | 0;
  33419. if (verticesPerRow < 2) {
  33420. throw new _util.FormatError("Invalid VerticesPerRow");
  33421. }
  33422. decodeType5Shading(this, reader, verticesPerRow);
  33423. break;
  33424. case ShadingType.COONS_PATCH_MESH:
  33425. decodeType6Shading(this, reader);
  33426. patchMesh = true;
  33427. break;
  33428. case ShadingType.TENSOR_PATCH_MESH:
  33429. decodeType7Shading(this, reader);
  33430. patchMesh = true;
  33431. break;
  33432. default:
  33433. (0, _util.unreachable)("Unsupported mesh type.");
  33434. break;
  33435. }
  33436. if (patchMesh) {
  33437. updateBounds(this);
  33438. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  33439. buildFigureFromPatch(this, i);
  33440. }
  33441. }
  33442. updateBounds(this);
  33443. packData(this);
  33444. }
  33445. Mesh.prototype = {
  33446. getIR: function Mesh_getIR() {
  33447. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  33448. }
  33449. };
  33450. return Mesh;
  33451. }();
  33452. Shadings.Dummy = function DummyClosure() {
  33453. function Dummy() {
  33454. this.type = "Pattern";
  33455. }
  33456. Dummy.prototype = {
  33457. getIR: function Dummy_getIR() {
  33458. return ["Dummy"];
  33459. }
  33460. };
  33461. return Dummy;
  33462. }();
  33463. function getTilingPatternIR(operatorList, dict, args) {
  33464. const matrix = dict.getArray("Matrix");
  33465. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  33466. const xstep = dict.get("XStep");
  33467. const ystep = dict.get("YStep");
  33468. const paintType = dict.get("PaintType");
  33469. const tilingType = dict.get("TilingType");
  33470. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  33471. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  33472. }
  33473. return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  33474. }
  33475. /***/ }),
  33476. /* 37 */
  33477. /***/ (function(module, exports, __w_pdfjs_require__) {
  33478. "use strict";
  33479. Object.defineProperty(exports, "__esModule", {
  33480. value: true
  33481. });
  33482. exports.bidi = bidi;
  33483. var _util = __w_pdfjs_require__(2);
  33484. var baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
  33485. var arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
  33486. function isOdd(i) {
  33487. return (i & 1) !== 0;
  33488. }
  33489. function isEven(i) {
  33490. return (i & 1) === 0;
  33491. }
  33492. function findUnequal(arr, start, value) {
  33493. for (var j = start, jj = arr.length; j < jj; ++j) {
  33494. if (arr[j] !== value) {
  33495. return j;
  33496. }
  33497. }
  33498. return j;
  33499. }
  33500. function setValues(arr, start, end, value) {
  33501. for (var j = start; j < end; ++j) {
  33502. arr[j] = value;
  33503. }
  33504. }
  33505. function reverseValues(arr, start, end) {
  33506. for (var i = start, j = end - 1; i < j; ++i, --j) {
  33507. var temp = arr[i];
  33508. arr[i] = arr[j];
  33509. arr[j] = temp;
  33510. }
  33511. }
  33512. function createBidiText(str, isLTR, vertical = false) {
  33513. let dir = "ltr";
  33514. if (vertical) {
  33515. dir = "ttb";
  33516. } else if (!isLTR) {
  33517. dir = "rtl";
  33518. }
  33519. return {
  33520. str,
  33521. dir
  33522. };
  33523. }
  33524. var chars = [];
  33525. var types = [];
  33526. function bidi(str, startLevel, vertical) {
  33527. var isLTR = true;
  33528. var strLength = str.length;
  33529. if (strLength === 0 || vertical) {
  33530. return createBidiText(str, isLTR, vertical);
  33531. }
  33532. chars.length = strLength;
  33533. types.length = strLength;
  33534. var numBidi = 0;
  33535. var i, ii;
  33536. for (i = 0; i < strLength; ++i) {
  33537. chars[i] = str.charAt(i);
  33538. var charCode = str.charCodeAt(i);
  33539. var charType = "L";
  33540. if (charCode <= 0x00ff) {
  33541. charType = baseTypes[charCode];
  33542. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  33543. charType = "R";
  33544. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  33545. charType = arabicTypes[charCode & 0xff];
  33546. if (!charType) {
  33547. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  33548. }
  33549. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  33550. charType = "AL";
  33551. }
  33552. if (charType === "R" || charType === "AL" || charType === "AN") {
  33553. numBidi++;
  33554. }
  33555. types[i] = charType;
  33556. }
  33557. if (numBidi === 0) {
  33558. isLTR = true;
  33559. return createBidiText(str, isLTR);
  33560. }
  33561. if (startLevel === -1) {
  33562. if (numBidi / strLength < 0.3) {
  33563. isLTR = true;
  33564. startLevel = 0;
  33565. } else {
  33566. isLTR = false;
  33567. startLevel = 1;
  33568. }
  33569. }
  33570. var levels = [];
  33571. for (i = 0; i < strLength; ++i) {
  33572. levels[i] = startLevel;
  33573. }
  33574. var e = isOdd(startLevel) ? "R" : "L";
  33575. var sor = e;
  33576. var eor = sor;
  33577. var lastType = sor;
  33578. for (i = 0; i < strLength; ++i) {
  33579. if (types[i] === "NSM") {
  33580. types[i] = lastType;
  33581. } else {
  33582. lastType = types[i];
  33583. }
  33584. }
  33585. lastType = sor;
  33586. var t;
  33587. for (i = 0; i < strLength; ++i) {
  33588. t = types[i];
  33589. if (t === "EN") {
  33590. types[i] = lastType === "AL" ? "AN" : "EN";
  33591. } else if (t === "R" || t === "L" || t === "AL") {
  33592. lastType = t;
  33593. }
  33594. }
  33595. for (i = 0; i < strLength; ++i) {
  33596. t = types[i];
  33597. if (t === "AL") {
  33598. types[i] = "R";
  33599. }
  33600. }
  33601. for (i = 1; i < strLength - 1; ++i) {
  33602. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  33603. types[i] = "EN";
  33604. }
  33605. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  33606. types[i] = types[i - 1];
  33607. }
  33608. }
  33609. for (i = 0; i < strLength; ++i) {
  33610. if (types[i] === "EN") {
  33611. var j;
  33612. for (j = i - 1; j >= 0; --j) {
  33613. if (types[j] !== "ET") {
  33614. break;
  33615. }
  33616. types[j] = "EN";
  33617. }
  33618. for (j = i + 1; j < strLength; ++j) {
  33619. if (types[j] !== "ET") {
  33620. break;
  33621. }
  33622. types[j] = "EN";
  33623. }
  33624. }
  33625. }
  33626. for (i = 0; i < strLength; ++i) {
  33627. t = types[i];
  33628. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  33629. types[i] = "ON";
  33630. }
  33631. }
  33632. lastType = sor;
  33633. for (i = 0; i < strLength; ++i) {
  33634. t = types[i];
  33635. if (t === "EN") {
  33636. types[i] = lastType === "L" ? "L" : "EN";
  33637. } else if (t === "R" || t === "L") {
  33638. lastType = t;
  33639. }
  33640. }
  33641. for (i = 0; i < strLength; ++i) {
  33642. if (types[i] === "ON") {
  33643. var end = findUnequal(types, i + 1, "ON");
  33644. var before = sor;
  33645. if (i > 0) {
  33646. before = types[i - 1];
  33647. }
  33648. var after = eor;
  33649. if (end + 1 < strLength) {
  33650. after = types[end + 1];
  33651. }
  33652. if (before !== "L") {
  33653. before = "R";
  33654. }
  33655. if (after !== "L") {
  33656. after = "R";
  33657. }
  33658. if (before === after) {
  33659. setValues(types, i, end, before);
  33660. }
  33661. i = end - 1;
  33662. }
  33663. }
  33664. for (i = 0; i < strLength; ++i) {
  33665. if (types[i] === "ON") {
  33666. types[i] = e;
  33667. }
  33668. }
  33669. for (i = 0; i < strLength; ++i) {
  33670. t = types[i];
  33671. if (isEven(levels[i])) {
  33672. if (t === "R") {
  33673. levels[i] += 1;
  33674. } else if (t === "AN" || t === "EN") {
  33675. levels[i] += 2;
  33676. }
  33677. } else {
  33678. if (t === "L" || t === "AN" || t === "EN") {
  33679. levels[i] += 1;
  33680. }
  33681. }
  33682. }
  33683. var highestLevel = -1;
  33684. var lowestOddLevel = 99;
  33685. var level;
  33686. for (i = 0, ii = levels.length; i < ii; ++i) {
  33687. level = levels[i];
  33688. if (highestLevel < level) {
  33689. highestLevel = level;
  33690. }
  33691. if (lowestOddLevel > level && isOdd(level)) {
  33692. lowestOddLevel = level;
  33693. }
  33694. }
  33695. for (level = highestLevel; level >= lowestOddLevel; --level) {
  33696. var start = -1;
  33697. for (i = 0, ii = levels.length; i < ii; ++i) {
  33698. if (levels[i] < level) {
  33699. if (start >= 0) {
  33700. reverseValues(chars, start, i);
  33701. start = -1;
  33702. }
  33703. } else if (start < 0) {
  33704. start = i;
  33705. }
  33706. }
  33707. if (start >= 0) {
  33708. reverseValues(chars, start, levels.length);
  33709. }
  33710. }
  33711. for (i = 0, ii = chars.length; i < ii; ++i) {
  33712. var ch = chars[i];
  33713. if (ch === "<" || ch === ">") {
  33714. chars[i] = "";
  33715. }
  33716. }
  33717. return createBidiText(chars.join(""), isLTR);
  33718. }
  33719. /***/ }),
  33720. /* 38 */
  33721. /***/ (function(module, exports, __w_pdfjs_require__) {
  33722. "use strict";
  33723. Object.defineProperty(exports, "__esModule", {
  33724. value: true
  33725. });
  33726. exports.getMetrics = void 0;
  33727. var _core_utils = __w_pdfjs_require__(7);
  33728. var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  33729. t["Courier"] = 600;
  33730. t["Courier-Bold"] = 600;
  33731. t["Courier-BoldOblique"] = 600;
  33732. t["Courier-Oblique"] = 600;
  33733. t["Helvetica"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  33734. t["space"] = 278;
  33735. t["exclam"] = 278;
  33736. t["quotedbl"] = 355;
  33737. t["numbersign"] = 556;
  33738. t["dollar"] = 556;
  33739. t["percent"] = 889;
  33740. t["ampersand"] = 667;
  33741. t["quoteright"] = 222;
  33742. t["parenleft"] = 333;
  33743. t["parenright"] = 333;
  33744. t["asterisk"] = 389;
  33745. t["plus"] = 584;
  33746. t["comma"] = 278;
  33747. t["hyphen"] = 333;
  33748. t["period"] = 278;
  33749. t["slash"] = 278;
  33750. t["zero"] = 556;
  33751. t["one"] = 556;
  33752. t["two"] = 556;
  33753. t["three"] = 556;
  33754. t["four"] = 556;
  33755. t["five"] = 556;
  33756. t["six"] = 556;
  33757. t["seven"] = 556;
  33758. t["eight"] = 556;
  33759. t["nine"] = 556;
  33760. t["colon"] = 278;
  33761. t["semicolon"] = 278;
  33762. t["less"] = 584;
  33763. t["equal"] = 584;
  33764. t["greater"] = 584;
  33765. t["question"] = 556;
  33766. t["at"] = 1015;
  33767. t["A"] = 667;
  33768. t["B"] = 667;
  33769. t["C"] = 722;
  33770. t["D"] = 722;
  33771. t["E"] = 667;
  33772. t["F"] = 611;
  33773. t["G"] = 778;
  33774. t["H"] = 722;
  33775. t["I"] = 278;
  33776. t["J"] = 500;
  33777. t["K"] = 667;
  33778. t["L"] = 556;
  33779. t["M"] = 833;
  33780. t["N"] = 722;
  33781. t["O"] = 778;
  33782. t["P"] = 667;
  33783. t["Q"] = 778;
  33784. t["R"] = 722;
  33785. t["S"] = 667;
  33786. t["T"] = 611;
  33787. t["U"] = 722;
  33788. t["V"] = 667;
  33789. t["W"] = 944;
  33790. t["X"] = 667;
  33791. t["Y"] = 667;
  33792. t["Z"] = 611;
  33793. t["bracketleft"] = 278;
  33794. t["backslash"] = 278;
  33795. t["bracketright"] = 278;
  33796. t["asciicircum"] = 469;
  33797. t["underscore"] = 556;
  33798. t["quoteleft"] = 222;
  33799. t["a"] = 556;
  33800. t["b"] = 556;
  33801. t["c"] = 500;
  33802. t["d"] = 556;
  33803. t["e"] = 556;
  33804. t["f"] = 278;
  33805. t["g"] = 556;
  33806. t["h"] = 556;
  33807. t["i"] = 222;
  33808. t["j"] = 222;
  33809. t["k"] = 500;
  33810. t["l"] = 222;
  33811. t["m"] = 833;
  33812. t["n"] = 556;
  33813. t["o"] = 556;
  33814. t["p"] = 556;
  33815. t["q"] = 556;
  33816. t["r"] = 333;
  33817. t["s"] = 500;
  33818. t["t"] = 278;
  33819. t["u"] = 556;
  33820. t["v"] = 500;
  33821. t["w"] = 722;
  33822. t["x"] = 500;
  33823. t["y"] = 500;
  33824. t["z"] = 500;
  33825. t["braceleft"] = 334;
  33826. t["bar"] = 260;
  33827. t["braceright"] = 334;
  33828. t["asciitilde"] = 584;
  33829. t["exclamdown"] = 333;
  33830. t["cent"] = 556;
  33831. t["sterling"] = 556;
  33832. t["fraction"] = 167;
  33833. t["yen"] = 556;
  33834. t["florin"] = 556;
  33835. t["section"] = 556;
  33836. t["currency"] = 556;
  33837. t["quotesingle"] = 191;
  33838. t["quotedblleft"] = 333;
  33839. t["guillemotleft"] = 556;
  33840. t["guilsinglleft"] = 333;
  33841. t["guilsinglright"] = 333;
  33842. t["fi"] = 500;
  33843. t["fl"] = 500;
  33844. t["endash"] = 556;
  33845. t["dagger"] = 556;
  33846. t["daggerdbl"] = 556;
  33847. t["periodcentered"] = 278;
  33848. t["paragraph"] = 537;
  33849. t["bullet"] = 350;
  33850. t["quotesinglbase"] = 222;
  33851. t["quotedblbase"] = 333;
  33852. t["quotedblright"] = 333;
  33853. t["guillemotright"] = 556;
  33854. t["ellipsis"] = 1000;
  33855. t["perthousand"] = 1000;
  33856. t["questiondown"] = 611;
  33857. t["grave"] = 333;
  33858. t["acute"] = 333;
  33859. t["circumflex"] = 333;
  33860. t["tilde"] = 333;
  33861. t["macron"] = 333;
  33862. t["breve"] = 333;
  33863. t["dotaccent"] = 333;
  33864. t["dieresis"] = 333;
  33865. t["ring"] = 333;
  33866. t["cedilla"] = 333;
  33867. t["hungarumlaut"] = 333;
  33868. t["ogonek"] = 333;
  33869. t["caron"] = 333;
  33870. t["emdash"] = 1000;
  33871. t["AE"] = 1000;
  33872. t["ordfeminine"] = 370;
  33873. t["Lslash"] = 556;
  33874. t["Oslash"] = 778;
  33875. t["OE"] = 1000;
  33876. t["ordmasculine"] = 365;
  33877. t["ae"] = 889;
  33878. t["dotlessi"] = 278;
  33879. t["lslash"] = 222;
  33880. t["oslash"] = 611;
  33881. t["oe"] = 944;
  33882. t["germandbls"] = 611;
  33883. t["Idieresis"] = 278;
  33884. t["eacute"] = 556;
  33885. t["abreve"] = 556;
  33886. t["uhungarumlaut"] = 556;
  33887. t["ecaron"] = 556;
  33888. t["Ydieresis"] = 667;
  33889. t["divide"] = 584;
  33890. t["Yacute"] = 667;
  33891. t["Acircumflex"] = 667;
  33892. t["aacute"] = 556;
  33893. t["Ucircumflex"] = 722;
  33894. t["yacute"] = 500;
  33895. t["scommaaccent"] = 500;
  33896. t["ecircumflex"] = 556;
  33897. t["Uring"] = 722;
  33898. t["Udieresis"] = 722;
  33899. t["aogonek"] = 556;
  33900. t["Uacute"] = 722;
  33901. t["uogonek"] = 556;
  33902. t["Edieresis"] = 667;
  33903. t["Dcroat"] = 722;
  33904. t["commaaccent"] = 250;
  33905. t["copyright"] = 737;
  33906. t["Emacron"] = 667;
  33907. t["ccaron"] = 500;
  33908. t["aring"] = 556;
  33909. t["Ncommaaccent"] = 722;
  33910. t["lacute"] = 222;
  33911. t["agrave"] = 556;
  33912. t["Tcommaaccent"] = 611;
  33913. t["Cacute"] = 722;
  33914. t["atilde"] = 556;
  33915. t["Edotaccent"] = 667;
  33916. t["scaron"] = 500;
  33917. t["scedilla"] = 500;
  33918. t["iacute"] = 278;
  33919. t["lozenge"] = 471;
  33920. t["Rcaron"] = 722;
  33921. t["Gcommaaccent"] = 778;
  33922. t["ucircumflex"] = 556;
  33923. t["acircumflex"] = 556;
  33924. t["Amacron"] = 667;
  33925. t["rcaron"] = 333;
  33926. t["ccedilla"] = 500;
  33927. t["Zdotaccent"] = 611;
  33928. t["Thorn"] = 667;
  33929. t["Omacron"] = 778;
  33930. t["Racute"] = 722;
  33931. t["Sacute"] = 667;
  33932. t["dcaron"] = 643;
  33933. t["Umacron"] = 722;
  33934. t["uring"] = 556;
  33935. t["threesuperior"] = 333;
  33936. t["Ograve"] = 778;
  33937. t["Agrave"] = 667;
  33938. t["Abreve"] = 667;
  33939. t["multiply"] = 584;
  33940. t["uacute"] = 556;
  33941. t["Tcaron"] = 611;
  33942. t["partialdiff"] = 476;
  33943. t["ydieresis"] = 500;
  33944. t["Nacute"] = 722;
  33945. t["icircumflex"] = 278;
  33946. t["Ecircumflex"] = 667;
  33947. t["adieresis"] = 556;
  33948. t["edieresis"] = 556;
  33949. t["cacute"] = 500;
  33950. t["nacute"] = 556;
  33951. t["umacron"] = 556;
  33952. t["Ncaron"] = 722;
  33953. t["Iacute"] = 278;
  33954. t["plusminus"] = 584;
  33955. t["brokenbar"] = 260;
  33956. t["registered"] = 737;
  33957. t["Gbreve"] = 778;
  33958. t["Idotaccent"] = 278;
  33959. t["summation"] = 600;
  33960. t["Egrave"] = 667;
  33961. t["racute"] = 333;
  33962. t["omacron"] = 556;
  33963. t["Zacute"] = 611;
  33964. t["Zcaron"] = 611;
  33965. t["greaterequal"] = 549;
  33966. t["Eth"] = 722;
  33967. t["Ccedilla"] = 722;
  33968. t["lcommaaccent"] = 222;
  33969. t["tcaron"] = 317;
  33970. t["eogonek"] = 556;
  33971. t["Uogonek"] = 722;
  33972. t["Aacute"] = 667;
  33973. t["Adieresis"] = 667;
  33974. t["egrave"] = 556;
  33975. t["zacute"] = 500;
  33976. t["iogonek"] = 222;
  33977. t["Oacute"] = 778;
  33978. t["oacute"] = 556;
  33979. t["amacron"] = 556;
  33980. t["sacute"] = 500;
  33981. t["idieresis"] = 278;
  33982. t["Ocircumflex"] = 778;
  33983. t["Ugrave"] = 722;
  33984. t["Delta"] = 612;
  33985. t["thorn"] = 556;
  33986. t["twosuperior"] = 333;
  33987. t["Odieresis"] = 778;
  33988. t["mu"] = 556;
  33989. t["igrave"] = 278;
  33990. t["ohungarumlaut"] = 556;
  33991. t["Eogonek"] = 667;
  33992. t["dcroat"] = 556;
  33993. t["threequarters"] = 834;
  33994. t["Scedilla"] = 667;
  33995. t["lcaron"] = 299;
  33996. t["Kcommaaccent"] = 667;
  33997. t["Lacute"] = 556;
  33998. t["trademark"] = 1000;
  33999. t["edotaccent"] = 556;
  34000. t["Igrave"] = 278;
  34001. t["Imacron"] = 278;
  34002. t["Lcaron"] = 556;
  34003. t["onehalf"] = 834;
  34004. t["lessequal"] = 549;
  34005. t["ocircumflex"] = 556;
  34006. t["ntilde"] = 556;
  34007. t["Uhungarumlaut"] = 722;
  34008. t["Eacute"] = 667;
  34009. t["emacron"] = 556;
  34010. t["gbreve"] = 556;
  34011. t["onequarter"] = 834;
  34012. t["Scaron"] = 667;
  34013. t["Scommaaccent"] = 667;
  34014. t["Ohungarumlaut"] = 778;
  34015. t["degree"] = 400;
  34016. t["ograve"] = 556;
  34017. t["Ccaron"] = 722;
  34018. t["ugrave"] = 556;
  34019. t["radical"] = 453;
  34020. t["Dcaron"] = 722;
  34021. t["rcommaaccent"] = 333;
  34022. t["Ntilde"] = 722;
  34023. t["otilde"] = 556;
  34024. t["Rcommaaccent"] = 722;
  34025. t["Lcommaaccent"] = 556;
  34026. t["Atilde"] = 667;
  34027. t["Aogonek"] = 667;
  34028. t["Aring"] = 667;
  34029. t["Otilde"] = 778;
  34030. t["zdotaccent"] = 500;
  34031. t["Ecaron"] = 667;
  34032. t["Iogonek"] = 278;
  34033. t["kcommaaccent"] = 500;
  34034. t["minus"] = 584;
  34035. t["Icircumflex"] = 278;
  34036. t["ncaron"] = 556;
  34037. t["tcommaaccent"] = 278;
  34038. t["logicalnot"] = 584;
  34039. t["odieresis"] = 556;
  34040. t["udieresis"] = 556;
  34041. t["notequal"] = 549;
  34042. t["gcommaaccent"] = 556;
  34043. t["eth"] = 556;
  34044. t["zcaron"] = 500;
  34045. t["ncommaaccent"] = 556;
  34046. t["onesuperior"] = 333;
  34047. t["imacron"] = 278;
  34048. t["Euro"] = 556;
  34049. });
  34050. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  34051. t["space"] = 278;
  34052. t["exclam"] = 333;
  34053. t["quotedbl"] = 474;
  34054. t["numbersign"] = 556;
  34055. t["dollar"] = 556;
  34056. t["percent"] = 889;
  34057. t["ampersand"] = 722;
  34058. t["quoteright"] = 278;
  34059. t["parenleft"] = 333;
  34060. t["parenright"] = 333;
  34061. t["asterisk"] = 389;
  34062. t["plus"] = 584;
  34063. t["comma"] = 278;
  34064. t["hyphen"] = 333;
  34065. t["period"] = 278;
  34066. t["slash"] = 278;
  34067. t["zero"] = 556;
  34068. t["one"] = 556;
  34069. t["two"] = 556;
  34070. t["three"] = 556;
  34071. t["four"] = 556;
  34072. t["five"] = 556;
  34073. t["six"] = 556;
  34074. t["seven"] = 556;
  34075. t["eight"] = 556;
  34076. t["nine"] = 556;
  34077. t["colon"] = 333;
  34078. t["semicolon"] = 333;
  34079. t["less"] = 584;
  34080. t["equal"] = 584;
  34081. t["greater"] = 584;
  34082. t["question"] = 611;
  34083. t["at"] = 975;
  34084. t["A"] = 722;
  34085. t["B"] = 722;
  34086. t["C"] = 722;
  34087. t["D"] = 722;
  34088. t["E"] = 667;
  34089. t["F"] = 611;
  34090. t["G"] = 778;
  34091. t["H"] = 722;
  34092. t["I"] = 278;
  34093. t["J"] = 556;
  34094. t["K"] = 722;
  34095. t["L"] = 611;
  34096. t["M"] = 833;
  34097. t["N"] = 722;
  34098. t["O"] = 778;
  34099. t["P"] = 667;
  34100. t["Q"] = 778;
  34101. t["R"] = 722;
  34102. t["S"] = 667;
  34103. t["T"] = 611;
  34104. t["U"] = 722;
  34105. t["V"] = 667;
  34106. t["W"] = 944;
  34107. t["X"] = 667;
  34108. t["Y"] = 667;
  34109. t["Z"] = 611;
  34110. t["bracketleft"] = 333;
  34111. t["backslash"] = 278;
  34112. t["bracketright"] = 333;
  34113. t["asciicircum"] = 584;
  34114. t["underscore"] = 556;
  34115. t["quoteleft"] = 278;
  34116. t["a"] = 556;
  34117. t["b"] = 611;
  34118. t["c"] = 556;
  34119. t["d"] = 611;
  34120. t["e"] = 556;
  34121. t["f"] = 333;
  34122. t["g"] = 611;
  34123. t["h"] = 611;
  34124. t["i"] = 278;
  34125. t["j"] = 278;
  34126. t["k"] = 556;
  34127. t["l"] = 278;
  34128. t["m"] = 889;
  34129. t["n"] = 611;
  34130. t["o"] = 611;
  34131. t["p"] = 611;
  34132. t["q"] = 611;
  34133. t["r"] = 389;
  34134. t["s"] = 556;
  34135. t["t"] = 333;
  34136. t["u"] = 611;
  34137. t["v"] = 556;
  34138. t["w"] = 778;
  34139. t["x"] = 556;
  34140. t["y"] = 556;
  34141. t["z"] = 500;
  34142. t["braceleft"] = 389;
  34143. t["bar"] = 280;
  34144. t["braceright"] = 389;
  34145. t["asciitilde"] = 584;
  34146. t["exclamdown"] = 333;
  34147. t["cent"] = 556;
  34148. t["sterling"] = 556;
  34149. t["fraction"] = 167;
  34150. t["yen"] = 556;
  34151. t["florin"] = 556;
  34152. t["section"] = 556;
  34153. t["currency"] = 556;
  34154. t["quotesingle"] = 238;
  34155. t["quotedblleft"] = 500;
  34156. t["guillemotleft"] = 556;
  34157. t["guilsinglleft"] = 333;
  34158. t["guilsinglright"] = 333;
  34159. t["fi"] = 611;
  34160. t["fl"] = 611;
  34161. t["endash"] = 556;
  34162. t["dagger"] = 556;
  34163. t["daggerdbl"] = 556;
  34164. t["periodcentered"] = 278;
  34165. t["paragraph"] = 556;
  34166. t["bullet"] = 350;
  34167. t["quotesinglbase"] = 278;
  34168. t["quotedblbase"] = 500;
  34169. t["quotedblright"] = 500;
  34170. t["guillemotright"] = 556;
  34171. t["ellipsis"] = 1000;
  34172. t["perthousand"] = 1000;
  34173. t["questiondown"] = 611;
  34174. t["grave"] = 333;
  34175. t["acute"] = 333;
  34176. t["circumflex"] = 333;
  34177. t["tilde"] = 333;
  34178. t["macron"] = 333;
  34179. t["breve"] = 333;
  34180. t["dotaccent"] = 333;
  34181. t["dieresis"] = 333;
  34182. t["ring"] = 333;
  34183. t["cedilla"] = 333;
  34184. t["hungarumlaut"] = 333;
  34185. t["ogonek"] = 333;
  34186. t["caron"] = 333;
  34187. t["emdash"] = 1000;
  34188. t["AE"] = 1000;
  34189. t["ordfeminine"] = 370;
  34190. t["Lslash"] = 611;
  34191. t["Oslash"] = 778;
  34192. t["OE"] = 1000;
  34193. t["ordmasculine"] = 365;
  34194. t["ae"] = 889;
  34195. t["dotlessi"] = 278;
  34196. t["lslash"] = 278;
  34197. t["oslash"] = 611;
  34198. t["oe"] = 944;
  34199. t["germandbls"] = 611;
  34200. t["Idieresis"] = 278;
  34201. t["eacute"] = 556;
  34202. t["abreve"] = 556;
  34203. t["uhungarumlaut"] = 611;
  34204. t["ecaron"] = 556;
  34205. t["Ydieresis"] = 667;
  34206. t["divide"] = 584;
  34207. t["Yacute"] = 667;
  34208. t["Acircumflex"] = 722;
  34209. t["aacute"] = 556;
  34210. t["Ucircumflex"] = 722;
  34211. t["yacute"] = 556;
  34212. t["scommaaccent"] = 556;
  34213. t["ecircumflex"] = 556;
  34214. t["Uring"] = 722;
  34215. t["Udieresis"] = 722;
  34216. t["aogonek"] = 556;
  34217. t["Uacute"] = 722;
  34218. t["uogonek"] = 611;
  34219. t["Edieresis"] = 667;
  34220. t["Dcroat"] = 722;
  34221. t["commaaccent"] = 250;
  34222. t["copyright"] = 737;
  34223. t["Emacron"] = 667;
  34224. t["ccaron"] = 556;
  34225. t["aring"] = 556;
  34226. t["Ncommaaccent"] = 722;
  34227. t["lacute"] = 278;
  34228. t["agrave"] = 556;
  34229. t["Tcommaaccent"] = 611;
  34230. t["Cacute"] = 722;
  34231. t["atilde"] = 556;
  34232. t["Edotaccent"] = 667;
  34233. t["scaron"] = 556;
  34234. t["scedilla"] = 556;
  34235. t["iacute"] = 278;
  34236. t["lozenge"] = 494;
  34237. t["Rcaron"] = 722;
  34238. t["Gcommaaccent"] = 778;
  34239. t["ucircumflex"] = 611;
  34240. t["acircumflex"] = 556;
  34241. t["Amacron"] = 722;
  34242. t["rcaron"] = 389;
  34243. t["ccedilla"] = 556;
  34244. t["Zdotaccent"] = 611;
  34245. t["Thorn"] = 667;
  34246. t["Omacron"] = 778;
  34247. t["Racute"] = 722;
  34248. t["Sacute"] = 667;
  34249. t["dcaron"] = 743;
  34250. t["Umacron"] = 722;
  34251. t["uring"] = 611;
  34252. t["threesuperior"] = 333;
  34253. t["Ograve"] = 778;
  34254. t["Agrave"] = 722;
  34255. t["Abreve"] = 722;
  34256. t["multiply"] = 584;
  34257. t["uacute"] = 611;
  34258. t["Tcaron"] = 611;
  34259. t["partialdiff"] = 494;
  34260. t["ydieresis"] = 556;
  34261. t["Nacute"] = 722;
  34262. t["icircumflex"] = 278;
  34263. t["Ecircumflex"] = 667;
  34264. t["adieresis"] = 556;
  34265. t["edieresis"] = 556;
  34266. t["cacute"] = 556;
  34267. t["nacute"] = 611;
  34268. t["umacron"] = 611;
  34269. t["Ncaron"] = 722;
  34270. t["Iacute"] = 278;
  34271. t["plusminus"] = 584;
  34272. t["brokenbar"] = 280;
  34273. t["registered"] = 737;
  34274. t["Gbreve"] = 778;
  34275. t["Idotaccent"] = 278;
  34276. t["summation"] = 600;
  34277. t["Egrave"] = 667;
  34278. t["racute"] = 389;
  34279. t["omacron"] = 611;
  34280. t["Zacute"] = 611;
  34281. t["Zcaron"] = 611;
  34282. t["greaterequal"] = 549;
  34283. t["Eth"] = 722;
  34284. t["Ccedilla"] = 722;
  34285. t["lcommaaccent"] = 278;
  34286. t["tcaron"] = 389;
  34287. t["eogonek"] = 556;
  34288. t["Uogonek"] = 722;
  34289. t["Aacute"] = 722;
  34290. t["Adieresis"] = 722;
  34291. t["egrave"] = 556;
  34292. t["zacute"] = 500;
  34293. t["iogonek"] = 278;
  34294. t["Oacute"] = 778;
  34295. t["oacute"] = 611;
  34296. t["amacron"] = 556;
  34297. t["sacute"] = 556;
  34298. t["idieresis"] = 278;
  34299. t["Ocircumflex"] = 778;
  34300. t["Ugrave"] = 722;
  34301. t["Delta"] = 612;
  34302. t["thorn"] = 611;
  34303. t["twosuperior"] = 333;
  34304. t["Odieresis"] = 778;
  34305. t["mu"] = 611;
  34306. t["igrave"] = 278;
  34307. t["ohungarumlaut"] = 611;
  34308. t["Eogonek"] = 667;
  34309. t["dcroat"] = 611;
  34310. t["threequarters"] = 834;
  34311. t["Scedilla"] = 667;
  34312. t["lcaron"] = 400;
  34313. t["Kcommaaccent"] = 722;
  34314. t["Lacute"] = 611;
  34315. t["trademark"] = 1000;
  34316. t["edotaccent"] = 556;
  34317. t["Igrave"] = 278;
  34318. t["Imacron"] = 278;
  34319. t["Lcaron"] = 611;
  34320. t["onehalf"] = 834;
  34321. t["lessequal"] = 549;
  34322. t["ocircumflex"] = 611;
  34323. t["ntilde"] = 611;
  34324. t["Uhungarumlaut"] = 722;
  34325. t["Eacute"] = 667;
  34326. t["emacron"] = 556;
  34327. t["gbreve"] = 611;
  34328. t["onequarter"] = 834;
  34329. t["Scaron"] = 667;
  34330. t["Scommaaccent"] = 667;
  34331. t["Ohungarumlaut"] = 778;
  34332. t["degree"] = 400;
  34333. t["ograve"] = 611;
  34334. t["Ccaron"] = 722;
  34335. t["ugrave"] = 611;
  34336. t["radical"] = 549;
  34337. t["Dcaron"] = 722;
  34338. t["rcommaaccent"] = 389;
  34339. t["Ntilde"] = 722;
  34340. t["otilde"] = 611;
  34341. t["Rcommaaccent"] = 722;
  34342. t["Lcommaaccent"] = 611;
  34343. t["Atilde"] = 722;
  34344. t["Aogonek"] = 722;
  34345. t["Aring"] = 722;
  34346. t["Otilde"] = 778;
  34347. t["zdotaccent"] = 500;
  34348. t["Ecaron"] = 667;
  34349. t["Iogonek"] = 278;
  34350. t["kcommaaccent"] = 556;
  34351. t["minus"] = 584;
  34352. t["Icircumflex"] = 278;
  34353. t["ncaron"] = 611;
  34354. t["tcommaaccent"] = 333;
  34355. t["logicalnot"] = 584;
  34356. t["odieresis"] = 611;
  34357. t["udieresis"] = 611;
  34358. t["notequal"] = 549;
  34359. t["gcommaaccent"] = 611;
  34360. t["eth"] = 611;
  34361. t["zcaron"] = 500;
  34362. t["ncommaaccent"] = 611;
  34363. t["onesuperior"] = 333;
  34364. t["imacron"] = 278;
  34365. t["Euro"] = 556;
  34366. });
  34367. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  34368. t["space"] = 278;
  34369. t["exclam"] = 333;
  34370. t["quotedbl"] = 474;
  34371. t["numbersign"] = 556;
  34372. t["dollar"] = 556;
  34373. t["percent"] = 889;
  34374. t["ampersand"] = 722;
  34375. t["quoteright"] = 278;
  34376. t["parenleft"] = 333;
  34377. t["parenright"] = 333;
  34378. t["asterisk"] = 389;
  34379. t["plus"] = 584;
  34380. t["comma"] = 278;
  34381. t["hyphen"] = 333;
  34382. t["period"] = 278;
  34383. t["slash"] = 278;
  34384. t["zero"] = 556;
  34385. t["one"] = 556;
  34386. t["two"] = 556;
  34387. t["three"] = 556;
  34388. t["four"] = 556;
  34389. t["five"] = 556;
  34390. t["six"] = 556;
  34391. t["seven"] = 556;
  34392. t["eight"] = 556;
  34393. t["nine"] = 556;
  34394. t["colon"] = 333;
  34395. t["semicolon"] = 333;
  34396. t["less"] = 584;
  34397. t["equal"] = 584;
  34398. t["greater"] = 584;
  34399. t["question"] = 611;
  34400. t["at"] = 975;
  34401. t["A"] = 722;
  34402. t["B"] = 722;
  34403. t["C"] = 722;
  34404. t["D"] = 722;
  34405. t["E"] = 667;
  34406. t["F"] = 611;
  34407. t["G"] = 778;
  34408. t["H"] = 722;
  34409. t["I"] = 278;
  34410. t["J"] = 556;
  34411. t["K"] = 722;
  34412. t["L"] = 611;
  34413. t["M"] = 833;
  34414. t["N"] = 722;
  34415. t["O"] = 778;
  34416. t["P"] = 667;
  34417. t["Q"] = 778;
  34418. t["R"] = 722;
  34419. t["S"] = 667;
  34420. t["T"] = 611;
  34421. t["U"] = 722;
  34422. t["V"] = 667;
  34423. t["W"] = 944;
  34424. t["X"] = 667;
  34425. t["Y"] = 667;
  34426. t["Z"] = 611;
  34427. t["bracketleft"] = 333;
  34428. t["backslash"] = 278;
  34429. t["bracketright"] = 333;
  34430. t["asciicircum"] = 584;
  34431. t["underscore"] = 556;
  34432. t["quoteleft"] = 278;
  34433. t["a"] = 556;
  34434. t["b"] = 611;
  34435. t["c"] = 556;
  34436. t["d"] = 611;
  34437. t["e"] = 556;
  34438. t["f"] = 333;
  34439. t["g"] = 611;
  34440. t["h"] = 611;
  34441. t["i"] = 278;
  34442. t["j"] = 278;
  34443. t["k"] = 556;
  34444. t["l"] = 278;
  34445. t["m"] = 889;
  34446. t["n"] = 611;
  34447. t["o"] = 611;
  34448. t["p"] = 611;
  34449. t["q"] = 611;
  34450. t["r"] = 389;
  34451. t["s"] = 556;
  34452. t["t"] = 333;
  34453. t["u"] = 611;
  34454. t["v"] = 556;
  34455. t["w"] = 778;
  34456. t["x"] = 556;
  34457. t["y"] = 556;
  34458. t["z"] = 500;
  34459. t["braceleft"] = 389;
  34460. t["bar"] = 280;
  34461. t["braceright"] = 389;
  34462. t["asciitilde"] = 584;
  34463. t["exclamdown"] = 333;
  34464. t["cent"] = 556;
  34465. t["sterling"] = 556;
  34466. t["fraction"] = 167;
  34467. t["yen"] = 556;
  34468. t["florin"] = 556;
  34469. t["section"] = 556;
  34470. t["currency"] = 556;
  34471. t["quotesingle"] = 238;
  34472. t["quotedblleft"] = 500;
  34473. t["guillemotleft"] = 556;
  34474. t["guilsinglleft"] = 333;
  34475. t["guilsinglright"] = 333;
  34476. t["fi"] = 611;
  34477. t["fl"] = 611;
  34478. t["endash"] = 556;
  34479. t["dagger"] = 556;
  34480. t["daggerdbl"] = 556;
  34481. t["periodcentered"] = 278;
  34482. t["paragraph"] = 556;
  34483. t["bullet"] = 350;
  34484. t["quotesinglbase"] = 278;
  34485. t["quotedblbase"] = 500;
  34486. t["quotedblright"] = 500;
  34487. t["guillemotright"] = 556;
  34488. t["ellipsis"] = 1000;
  34489. t["perthousand"] = 1000;
  34490. t["questiondown"] = 611;
  34491. t["grave"] = 333;
  34492. t["acute"] = 333;
  34493. t["circumflex"] = 333;
  34494. t["tilde"] = 333;
  34495. t["macron"] = 333;
  34496. t["breve"] = 333;
  34497. t["dotaccent"] = 333;
  34498. t["dieresis"] = 333;
  34499. t["ring"] = 333;
  34500. t["cedilla"] = 333;
  34501. t["hungarumlaut"] = 333;
  34502. t["ogonek"] = 333;
  34503. t["caron"] = 333;
  34504. t["emdash"] = 1000;
  34505. t["AE"] = 1000;
  34506. t["ordfeminine"] = 370;
  34507. t["Lslash"] = 611;
  34508. t["Oslash"] = 778;
  34509. t["OE"] = 1000;
  34510. t["ordmasculine"] = 365;
  34511. t["ae"] = 889;
  34512. t["dotlessi"] = 278;
  34513. t["lslash"] = 278;
  34514. t["oslash"] = 611;
  34515. t["oe"] = 944;
  34516. t["germandbls"] = 611;
  34517. t["Idieresis"] = 278;
  34518. t["eacute"] = 556;
  34519. t["abreve"] = 556;
  34520. t["uhungarumlaut"] = 611;
  34521. t["ecaron"] = 556;
  34522. t["Ydieresis"] = 667;
  34523. t["divide"] = 584;
  34524. t["Yacute"] = 667;
  34525. t["Acircumflex"] = 722;
  34526. t["aacute"] = 556;
  34527. t["Ucircumflex"] = 722;
  34528. t["yacute"] = 556;
  34529. t["scommaaccent"] = 556;
  34530. t["ecircumflex"] = 556;
  34531. t["Uring"] = 722;
  34532. t["Udieresis"] = 722;
  34533. t["aogonek"] = 556;
  34534. t["Uacute"] = 722;
  34535. t["uogonek"] = 611;
  34536. t["Edieresis"] = 667;
  34537. t["Dcroat"] = 722;
  34538. t["commaaccent"] = 250;
  34539. t["copyright"] = 737;
  34540. t["Emacron"] = 667;
  34541. t["ccaron"] = 556;
  34542. t["aring"] = 556;
  34543. t["Ncommaaccent"] = 722;
  34544. t["lacute"] = 278;
  34545. t["agrave"] = 556;
  34546. t["Tcommaaccent"] = 611;
  34547. t["Cacute"] = 722;
  34548. t["atilde"] = 556;
  34549. t["Edotaccent"] = 667;
  34550. t["scaron"] = 556;
  34551. t["scedilla"] = 556;
  34552. t["iacute"] = 278;
  34553. t["lozenge"] = 494;
  34554. t["Rcaron"] = 722;
  34555. t["Gcommaaccent"] = 778;
  34556. t["ucircumflex"] = 611;
  34557. t["acircumflex"] = 556;
  34558. t["Amacron"] = 722;
  34559. t["rcaron"] = 389;
  34560. t["ccedilla"] = 556;
  34561. t["Zdotaccent"] = 611;
  34562. t["Thorn"] = 667;
  34563. t["Omacron"] = 778;
  34564. t["Racute"] = 722;
  34565. t["Sacute"] = 667;
  34566. t["dcaron"] = 743;
  34567. t["Umacron"] = 722;
  34568. t["uring"] = 611;
  34569. t["threesuperior"] = 333;
  34570. t["Ograve"] = 778;
  34571. t["Agrave"] = 722;
  34572. t["Abreve"] = 722;
  34573. t["multiply"] = 584;
  34574. t["uacute"] = 611;
  34575. t["Tcaron"] = 611;
  34576. t["partialdiff"] = 494;
  34577. t["ydieresis"] = 556;
  34578. t["Nacute"] = 722;
  34579. t["icircumflex"] = 278;
  34580. t["Ecircumflex"] = 667;
  34581. t["adieresis"] = 556;
  34582. t["edieresis"] = 556;
  34583. t["cacute"] = 556;
  34584. t["nacute"] = 611;
  34585. t["umacron"] = 611;
  34586. t["Ncaron"] = 722;
  34587. t["Iacute"] = 278;
  34588. t["plusminus"] = 584;
  34589. t["brokenbar"] = 280;
  34590. t["registered"] = 737;
  34591. t["Gbreve"] = 778;
  34592. t["Idotaccent"] = 278;
  34593. t["summation"] = 600;
  34594. t["Egrave"] = 667;
  34595. t["racute"] = 389;
  34596. t["omacron"] = 611;
  34597. t["Zacute"] = 611;
  34598. t["Zcaron"] = 611;
  34599. t["greaterequal"] = 549;
  34600. t["Eth"] = 722;
  34601. t["Ccedilla"] = 722;
  34602. t["lcommaaccent"] = 278;
  34603. t["tcaron"] = 389;
  34604. t["eogonek"] = 556;
  34605. t["Uogonek"] = 722;
  34606. t["Aacute"] = 722;
  34607. t["Adieresis"] = 722;
  34608. t["egrave"] = 556;
  34609. t["zacute"] = 500;
  34610. t["iogonek"] = 278;
  34611. t["Oacute"] = 778;
  34612. t["oacute"] = 611;
  34613. t["amacron"] = 556;
  34614. t["sacute"] = 556;
  34615. t["idieresis"] = 278;
  34616. t["Ocircumflex"] = 778;
  34617. t["Ugrave"] = 722;
  34618. t["Delta"] = 612;
  34619. t["thorn"] = 611;
  34620. t["twosuperior"] = 333;
  34621. t["Odieresis"] = 778;
  34622. t["mu"] = 611;
  34623. t["igrave"] = 278;
  34624. t["ohungarumlaut"] = 611;
  34625. t["Eogonek"] = 667;
  34626. t["dcroat"] = 611;
  34627. t["threequarters"] = 834;
  34628. t["Scedilla"] = 667;
  34629. t["lcaron"] = 400;
  34630. t["Kcommaaccent"] = 722;
  34631. t["Lacute"] = 611;
  34632. t["trademark"] = 1000;
  34633. t["edotaccent"] = 556;
  34634. t["Igrave"] = 278;
  34635. t["Imacron"] = 278;
  34636. t["Lcaron"] = 611;
  34637. t["onehalf"] = 834;
  34638. t["lessequal"] = 549;
  34639. t["ocircumflex"] = 611;
  34640. t["ntilde"] = 611;
  34641. t["Uhungarumlaut"] = 722;
  34642. t["Eacute"] = 667;
  34643. t["emacron"] = 556;
  34644. t["gbreve"] = 611;
  34645. t["onequarter"] = 834;
  34646. t["Scaron"] = 667;
  34647. t["Scommaaccent"] = 667;
  34648. t["Ohungarumlaut"] = 778;
  34649. t["degree"] = 400;
  34650. t["ograve"] = 611;
  34651. t["Ccaron"] = 722;
  34652. t["ugrave"] = 611;
  34653. t["radical"] = 549;
  34654. t["Dcaron"] = 722;
  34655. t["rcommaaccent"] = 389;
  34656. t["Ntilde"] = 722;
  34657. t["otilde"] = 611;
  34658. t["Rcommaaccent"] = 722;
  34659. t["Lcommaaccent"] = 611;
  34660. t["Atilde"] = 722;
  34661. t["Aogonek"] = 722;
  34662. t["Aring"] = 722;
  34663. t["Otilde"] = 778;
  34664. t["zdotaccent"] = 500;
  34665. t["Ecaron"] = 667;
  34666. t["Iogonek"] = 278;
  34667. t["kcommaaccent"] = 556;
  34668. t["minus"] = 584;
  34669. t["Icircumflex"] = 278;
  34670. t["ncaron"] = 611;
  34671. t["tcommaaccent"] = 333;
  34672. t["logicalnot"] = 584;
  34673. t["odieresis"] = 611;
  34674. t["udieresis"] = 611;
  34675. t["notequal"] = 549;
  34676. t["gcommaaccent"] = 611;
  34677. t["eth"] = 611;
  34678. t["zcaron"] = 500;
  34679. t["ncommaaccent"] = 611;
  34680. t["onesuperior"] = 333;
  34681. t["imacron"] = 278;
  34682. t["Euro"] = 556;
  34683. });
  34684. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  34685. t["space"] = 278;
  34686. t["exclam"] = 278;
  34687. t["quotedbl"] = 355;
  34688. t["numbersign"] = 556;
  34689. t["dollar"] = 556;
  34690. t["percent"] = 889;
  34691. t["ampersand"] = 667;
  34692. t["quoteright"] = 222;
  34693. t["parenleft"] = 333;
  34694. t["parenright"] = 333;
  34695. t["asterisk"] = 389;
  34696. t["plus"] = 584;
  34697. t["comma"] = 278;
  34698. t["hyphen"] = 333;
  34699. t["period"] = 278;
  34700. t["slash"] = 278;
  34701. t["zero"] = 556;
  34702. t["one"] = 556;
  34703. t["two"] = 556;
  34704. t["three"] = 556;
  34705. t["four"] = 556;
  34706. t["five"] = 556;
  34707. t["six"] = 556;
  34708. t["seven"] = 556;
  34709. t["eight"] = 556;
  34710. t["nine"] = 556;
  34711. t["colon"] = 278;
  34712. t["semicolon"] = 278;
  34713. t["less"] = 584;
  34714. t["equal"] = 584;
  34715. t["greater"] = 584;
  34716. t["question"] = 556;
  34717. t["at"] = 1015;
  34718. t["A"] = 667;
  34719. t["B"] = 667;
  34720. t["C"] = 722;
  34721. t["D"] = 722;
  34722. t["E"] = 667;
  34723. t["F"] = 611;
  34724. t["G"] = 778;
  34725. t["H"] = 722;
  34726. t["I"] = 278;
  34727. t["J"] = 500;
  34728. t["K"] = 667;
  34729. t["L"] = 556;
  34730. t["M"] = 833;
  34731. t["N"] = 722;
  34732. t["O"] = 778;
  34733. t["P"] = 667;
  34734. t["Q"] = 778;
  34735. t["R"] = 722;
  34736. t["S"] = 667;
  34737. t["T"] = 611;
  34738. t["U"] = 722;
  34739. t["V"] = 667;
  34740. t["W"] = 944;
  34741. t["X"] = 667;
  34742. t["Y"] = 667;
  34743. t["Z"] = 611;
  34744. t["bracketleft"] = 278;
  34745. t["backslash"] = 278;
  34746. t["bracketright"] = 278;
  34747. t["asciicircum"] = 469;
  34748. t["underscore"] = 556;
  34749. t["quoteleft"] = 222;
  34750. t["a"] = 556;
  34751. t["b"] = 556;
  34752. t["c"] = 500;
  34753. t["d"] = 556;
  34754. t["e"] = 556;
  34755. t["f"] = 278;
  34756. t["g"] = 556;
  34757. t["h"] = 556;
  34758. t["i"] = 222;
  34759. t["j"] = 222;
  34760. t["k"] = 500;
  34761. t["l"] = 222;
  34762. t["m"] = 833;
  34763. t["n"] = 556;
  34764. t["o"] = 556;
  34765. t["p"] = 556;
  34766. t["q"] = 556;
  34767. t["r"] = 333;
  34768. t["s"] = 500;
  34769. t["t"] = 278;
  34770. t["u"] = 556;
  34771. t["v"] = 500;
  34772. t["w"] = 722;
  34773. t["x"] = 500;
  34774. t["y"] = 500;
  34775. t["z"] = 500;
  34776. t["braceleft"] = 334;
  34777. t["bar"] = 260;
  34778. t["braceright"] = 334;
  34779. t["asciitilde"] = 584;
  34780. t["exclamdown"] = 333;
  34781. t["cent"] = 556;
  34782. t["sterling"] = 556;
  34783. t["fraction"] = 167;
  34784. t["yen"] = 556;
  34785. t["florin"] = 556;
  34786. t["section"] = 556;
  34787. t["currency"] = 556;
  34788. t["quotesingle"] = 191;
  34789. t["quotedblleft"] = 333;
  34790. t["guillemotleft"] = 556;
  34791. t["guilsinglleft"] = 333;
  34792. t["guilsinglright"] = 333;
  34793. t["fi"] = 500;
  34794. t["fl"] = 500;
  34795. t["endash"] = 556;
  34796. t["dagger"] = 556;
  34797. t["daggerdbl"] = 556;
  34798. t["periodcentered"] = 278;
  34799. t["paragraph"] = 537;
  34800. t["bullet"] = 350;
  34801. t["quotesinglbase"] = 222;
  34802. t["quotedblbase"] = 333;
  34803. t["quotedblright"] = 333;
  34804. t["guillemotright"] = 556;
  34805. t["ellipsis"] = 1000;
  34806. t["perthousand"] = 1000;
  34807. t["questiondown"] = 611;
  34808. t["grave"] = 333;
  34809. t["acute"] = 333;
  34810. t["circumflex"] = 333;
  34811. t["tilde"] = 333;
  34812. t["macron"] = 333;
  34813. t["breve"] = 333;
  34814. t["dotaccent"] = 333;
  34815. t["dieresis"] = 333;
  34816. t["ring"] = 333;
  34817. t["cedilla"] = 333;
  34818. t["hungarumlaut"] = 333;
  34819. t["ogonek"] = 333;
  34820. t["caron"] = 333;
  34821. t["emdash"] = 1000;
  34822. t["AE"] = 1000;
  34823. t["ordfeminine"] = 370;
  34824. t["Lslash"] = 556;
  34825. t["Oslash"] = 778;
  34826. t["OE"] = 1000;
  34827. t["ordmasculine"] = 365;
  34828. t["ae"] = 889;
  34829. t["dotlessi"] = 278;
  34830. t["lslash"] = 222;
  34831. t["oslash"] = 611;
  34832. t["oe"] = 944;
  34833. t["germandbls"] = 611;
  34834. t["Idieresis"] = 278;
  34835. t["eacute"] = 556;
  34836. t["abreve"] = 556;
  34837. t["uhungarumlaut"] = 556;
  34838. t["ecaron"] = 556;
  34839. t["Ydieresis"] = 667;
  34840. t["divide"] = 584;
  34841. t["Yacute"] = 667;
  34842. t["Acircumflex"] = 667;
  34843. t["aacute"] = 556;
  34844. t["Ucircumflex"] = 722;
  34845. t["yacute"] = 500;
  34846. t["scommaaccent"] = 500;
  34847. t["ecircumflex"] = 556;
  34848. t["Uring"] = 722;
  34849. t["Udieresis"] = 722;
  34850. t["aogonek"] = 556;
  34851. t["Uacute"] = 722;
  34852. t["uogonek"] = 556;
  34853. t["Edieresis"] = 667;
  34854. t["Dcroat"] = 722;
  34855. t["commaaccent"] = 250;
  34856. t["copyright"] = 737;
  34857. t["Emacron"] = 667;
  34858. t["ccaron"] = 500;
  34859. t["aring"] = 556;
  34860. t["Ncommaaccent"] = 722;
  34861. t["lacute"] = 222;
  34862. t["agrave"] = 556;
  34863. t["Tcommaaccent"] = 611;
  34864. t["Cacute"] = 722;
  34865. t["atilde"] = 556;
  34866. t["Edotaccent"] = 667;
  34867. t["scaron"] = 500;
  34868. t["scedilla"] = 500;
  34869. t["iacute"] = 278;
  34870. t["lozenge"] = 471;
  34871. t["Rcaron"] = 722;
  34872. t["Gcommaaccent"] = 778;
  34873. t["ucircumflex"] = 556;
  34874. t["acircumflex"] = 556;
  34875. t["Amacron"] = 667;
  34876. t["rcaron"] = 333;
  34877. t["ccedilla"] = 500;
  34878. t["Zdotaccent"] = 611;
  34879. t["Thorn"] = 667;
  34880. t["Omacron"] = 778;
  34881. t["Racute"] = 722;
  34882. t["Sacute"] = 667;
  34883. t["dcaron"] = 643;
  34884. t["Umacron"] = 722;
  34885. t["uring"] = 556;
  34886. t["threesuperior"] = 333;
  34887. t["Ograve"] = 778;
  34888. t["Agrave"] = 667;
  34889. t["Abreve"] = 667;
  34890. t["multiply"] = 584;
  34891. t["uacute"] = 556;
  34892. t["Tcaron"] = 611;
  34893. t["partialdiff"] = 476;
  34894. t["ydieresis"] = 500;
  34895. t["Nacute"] = 722;
  34896. t["icircumflex"] = 278;
  34897. t["Ecircumflex"] = 667;
  34898. t["adieresis"] = 556;
  34899. t["edieresis"] = 556;
  34900. t["cacute"] = 500;
  34901. t["nacute"] = 556;
  34902. t["umacron"] = 556;
  34903. t["Ncaron"] = 722;
  34904. t["Iacute"] = 278;
  34905. t["plusminus"] = 584;
  34906. t["brokenbar"] = 260;
  34907. t["registered"] = 737;
  34908. t["Gbreve"] = 778;
  34909. t["Idotaccent"] = 278;
  34910. t["summation"] = 600;
  34911. t["Egrave"] = 667;
  34912. t["racute"] = 333;
  34913. t["omacron"] = 556;
  34914. t["Zacute"] = 611;
  34915. t["Zcaron"] = 611;
  34916. t["greaterequal"] = 549;
  34917. t["Eth"] = 722;
  34918. t["Ccedilla"] = 722;
  34919. t["lcommaaccent"] = 222;
  34920. t["tcaron"] = 317;
  34921. t["eogonek"] = 556;
  34922. t["Uogonek"] = 722;
  34923. t["Aacute"] = 667;
  34924. t["Adieresis"] = 667;
  34925. t["egrave"] = 556;
  34926. t["zacute"] = 500;
  34927. t["iogonek"] = 222;
  34928. t["Oacute"] = 778;
  34929. t["oacute"] = 556;
  34930. t["amacron"] = 556;
  34931. t["sacute"] = 500;
  34932. t["idieresis"] = 278;
  34933. t["Ocircumflex"] = 778;
  34934. t["Ugrave"] = 722;
  34935. t["Delta"] = 612;
  34936. t["thorn"] = 556;
  34937. t["twosuperior"] = 333;
  34938. t["Odieresis"] = 778;
  34939. t["mu"] = 556;
  34940. t["igrave"] = 278;
  34941. t["ohungarumlaut"] = 556;
  34942. t["Eogonek"] = 667;
  34943. t["dcroat"] = 556;
  34944. t["threequarters"] = 834;
  34945. t["Scedilla"] = 667;
  34946. t["lcaron"] = 299;
  34947. t["Kcommaaccent"] = 667;
  34948. t["Lacute"] = 556;
  34949. t["trademark"] = 1000;
  34950. t["edotaccent"] = 556;
  34951. t["Igrave"] = 278;
  34952. t["Imacron"] = 278;
  34953. t["Lcaron"] = 556;
  34954. t["onehalf"] = 834;
  34955. t["lessequal"] = 549;
  34956. t["ocircumflex"] = 556;
  34957. t["ntilde"] = 556;
  34958. t["Uhungarumlaut"] = 722;
  34959. t["Eacute"] = 667;
  34960. t["emacron"] = 556;
  34961. t["gbreve"] = 556;
  34962. t["onequarter"] = 834;
  34963. t["Scaron"] = 667;
  34964. t["Scommaaccent"] = 667;
  34965. t["Ohungarumlaut"] = 778;
  34966. t["degree"] = 400;
  34967. t["ograve"] = 556;
  34968. t["Ccaron"] = 722;
  34969. t["ugrave"] = 556;
  34970. t["radical"] = 453;
  34971. t["Dcaron"] = 722;
  34972. t["rcommaaccent"] = 333;
  34973. t["Ntilde"] = 722;
  34974. t["otilde"] = 556;
  34975. t["Rcommaaccent"] = 722;
  34976. t["Lcommaaccent"] = 556;
  34977. t["Atilde"] = 667;
  34978. t["Aogonek"] = 667;
  34979. t["Aring"] = 667;
  34980. t["Otilde"] = 778;
  34981. t["zdotaccent"] = 500;
  34982. t["Ecaron"] = 667;
  34983. t["Iogonek"] = 278;
  34984. t["kcommaaccent"] = 500;
  34985. t["minus"] = 584;
  34986. t["Icircumflex"] = 278;
  34987. t["ncaron"] = 556;
  34988. t["tcommaaccent"] = 278;
  34989. t["logicalnot"] = 584;
  34990. t["odieresis"] = 556;
  34991. t["udieresis"] = 556;
  34992. t["notequal"] = 549;
  34993. t["gcommaaccent"] = 556;
  34994. t["eth"] = 556;
  34995. t["zcaron"] = 500;
  34996. t["ncommaaccent"] = 556;
  34997. t["onesuperior"] = 333;
  34998. t["imacron"] = 278;
  34999. t["Euro"] = 556;
  35000. });
  35001. t["Symbol"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35002. t["space"] = 250;
  35003. t["exclam"] = 333;
  35004. t["universal"] = 713;
  35005. t["numbersign"] = 500;
  35006. t["existential"] = 549;
  35007. t["percent"] = 833;
  35008. t["ampersand"] = 778;
  35009. t["suchthat"] = 439;
  35010. t["parenleft"] = 333;
  35011. t["parenright"] = 333;
  35012. t["asteriskmath"] = 500;
  35013. t["plus"] = 549;
  35014. t["comma"] = 250;
  35015. t["minus"] = 549;
  35016. t["period"] = 250;
  35017. t["slash"] = 278;
  35018. t["zero"] = 500;
  35019. t["one"] = 500;
  35020. t["two"] = 500;
  35021. t["three"] = 500;
  35022. t["four"] = 500;
  35023. t["five"] = 500;
  35024. t["six"] = 500;
  35025. t["seven"] = 500;
  35026. t["eight"] = 500;
  35027. t["nine"] = 500;
  35028. t["colon"] = 278;
  35029. t["semicolon"] = 278;
  35030. t["less"] = 549;
  35031. t["equal"] = 549;
  35032. t["greater"] = 549;
  35033. t["question"] = 444;
  35034. t["congruent"] = 549;
  35035. t["Alpha"] = 722;
  35036. t["Beta"] = 667;
  35037. t["Chi"] = 722;
  35038. t["Delta"] = 612;
  35039. t["Epsilon"] = 611;
  35040. t["Phi"] = 763;
  35041. t["Gamma"] = 603;
  35042. t["Eta"] = 722;
  35043. t["Iota"] = 333;
  35044. t["theta1"] = 631;
  35045. t["Kappa"] = 722;
  35046. t["Lambda"] = 686;
  35047. t["Mu"] = 889;
  35048. t["Nu"] = 722;
  35049. t["Omicron"] = 722;
  35050. t["Pi"] = 768;
  35051. t["Theta"] = 741;
  35052. t["Rho"] = 556;
  35053. t["Sigma"] = 592;
  35054. t["Tau"] = 611;
  35055. t["Upsilon"] = 690;
  35056. t["sigma1"] = 439;
  35057. t["Omega"] = 768;
  35058. t["Xi"] = 645;
  35059. t["Psi"] = 795;
  35060. t["Zeta"] = 611;
  35061. t["bracketleft"] = 333;
  35062. t["therefore"] = 863;
  35063. t["bracketright"] = 333;
  35064. t["perpendicular"] = 658;
  35065. t["underscore"] = 500;
  35066. t["radicalex"] = 500;
  35067. t["alpha"] = 631;
  35068. t["beta"] = 549;
  35069. t["chi"] = 549;
  35070. t["delta"] = 494;
  35071. t["epsilon"] = 439;
  35072. t["phi"] = 521;
  35073. t["gamma"] = 411;
  35074. t["eta"] = 603;
  35075. t["iota"] = 329;
  35076. t["phi1"] = 603;
  35077. t["kappa"] = 549;
  35078. t["lambda"] = 549;
  35079. t["mu"] = 576;
  35080. t["nu"] = 521;
  35081. t["omicron"] = 549;
  35082. t["pi"] = 549;
  35083. t["theta"] = 521;
  35084. t["rho"] = 549;
  35085. t["sigma"] = 603;
  35086. t["tau"] = 439;
  35087. t["upsilon"] = 576;
  35088. t["omega1"] = 713;
  35089. t["omega"] = 686;
  35090. t["xi"] = 493;
  35091. t["psi"] = 686;
  35092. t["zeta"] = 494;
  35093. t["braceleft"] = 480;
  35094. t["bar"] = 200;
  35095. t["braceright"] = 480;
  35096. t["similar"] = 549;
  35097. t["Euro"] = 750;
  35098. t["Upsilon1"] = 620;
  35099. t["minute"] = 247;
  35100. t["lessequal"] = 549;
  35101. t["fraction"] = 167;
  35102. t["infinity"] = 713;
  35103. t["florin"] = 500;
  35104. t["club"] = 753;
  35105. t["diamond"] = 753;
  35106. t["heart"] = 753;
  35107. t["spade"] = 753;
  35108. t["arrowboth"] = 1042;
  35109. t["arrowleft"] = 987;
  35110. t["arrowup"] = 603;
  35111. t["arrowright"] = 987;
  35112. t["arrowdown"] = 603;
  35113. t["degree"] = 400;
  35114. t["plusminus"] = 549;
  35115. t["second"] = 411;
  35116. t["greaterequal"] = 549;
  35117. t["multiply"] = 549;
  35118. t["proportional"] = 713;
  35119. t["partialdiff"] = 494;
  35120. t["bullet"] = 460;
  35121. t["divide"] = 549;
  35122. t["notequal"] = 549;
  35123. t["equivalence"] = 549;
  35124. t["approxequal"] = 549;
  35125. t["ellipsis"] = 1000;
  35126. t["arrowvertex"] = 603;
  35127. t["arrowhorizex"] = 1000;
  35128. t["carriagereturn"] = 658;
  35129. t["aleph"] = 823;
  35130. t["Ifraktur"] = 686;
  35131. t["Rfraktur"] = 795;
  35132. t["weierstrass"] = 987;
  35133. t["circlemultiply"] = 768;
  35134. t["circleplus"] = 768;
  35135. t["emptyset"] = 823;
  35136. t["intersection"] = 768;
  35137. t["union"] = 768;
  35138. t["propersuperset"] = 713;
  35139. t["reflexsuperset"] = 713;
  35140. t["notsubset"] = 713;
  35141. t["propersubset"] = 713;
  35142. t["reflexsubset"] = 713;
  35143. t["element"] = 713;
  35144. t["notelement"] = 713;
  35145. t["angle"] = 768;
  35146. t["gradient"] = 713;
  35147. t["registerserif"] = 790;
  35148. t["copyrightserif"] = 790;
  35149. t["trademarkserif"] = 890;
  35150. t["product"] = 823;
  35151. t["radical"] = 549;
  35152. t["dotmath"] = 250;
  35153. t["logicalnot"] = 713;
  35154. t["logicaland"] = 603;
  35155. t["logicalor"] = 603;
  35156. t["arrowdblboth"] = 1042;
  35157. t["arrowdblleft"] = 987;
  35158. t["arrowdblup"] = 603;
  35159. t["arrowdblright"] = 987;
  35160. t["arrowdbldown"] = 603;
  35161. t["lozenge"] = 494;
  35162. t["angleleft"] = 329;
  35163. t["registersans"] = 790;
  35164. t["copyrightsans"] = 790;
  35165. t["trademarksans"] = 786;
  35166. t["summation"] = 713;
  35167. t["parenlefttp"] = 384;
  35168. t["parenleftex"] = 384;
  35169. t["parenleftbt"] = 384;
  35170. t["bracketlefttp"] = 384;
  35171. t["bracketleftex"] = 384;
  35172. t["bracketleftbt"] = 384;
  35173. t["bracelefttp"] = 494;
  35174. t["braceleftmid"] = 494;
  35175. t["braceleftbt"] = 494;
  35176. t["braceex"] = 494;
  35177. t["angleright"] = 329;
  35178. t["integral"] = 274;
  35179. t["integraltp"] = 686;
  35180. t["integralex"] = 686;
  35181. t["integralbt"] = 686;
  35182. t["parenrighttp"] = 384;
  35183. t["parenrightex"] = 384;
  35184. t["parenrightbt"] = 384;
  35185. t["bracketrighttp"] = 384;
  35186. t["bracketrightex"] = 384;
  35187. t["bracketrightbt"] = 384;
  35188. t["bracerighttp"] = 494;
  35189. t["bracerightmid"] = 494;
  35190. t["bracerightbt"] = 494;
  35191. t["apple"] = 790;
  35192. });
  35193. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35194. t["space"] = 250;
  35195. t["exclam"] = 333;
  35196. t["quotedbl"] = 408;
  35197. t["numbersign"] = 500;
  35198. t["dollar"] = 500;
  35199. t["percent"] = 833;
  35200. t["ampersand"] = 778;
  35201. t["quoteright"] = 333;
  35202. t["parenleft"] = 333;
  35203. t["parenright"] = 333;
  35204. t["asterisk"] = 500;
  35205. t["plus"] = 564;
  35206. t["comma"] = 250;
  35207. t["hyphen"] = 333;
  35208. t["period"] = 250;
  35209. t["slash"] = 278;
  35210. t["zero"] = 500;
  35211. t["one"] = 500;
  35212. t["two"] = 500;
  35213. t["three"] = 500;
  35214. t["four"] = 500;
  35215. t["five"] = 500;
  35216. t["six"] = 500;
  35217. t["seven"] = 500;
  35218. t["eight"] = 500;
  35219. t["nine"] = 500;
  35220. t["colon"] = 278;
  35221. t["semicolon"] = 278;
  35222. t["less"] = 564;
  35223. t["equal"] = 564;
  35224. t["greater"] = 564;
  35225. t["question"] = 444;
  35226. t["at"] = 921;
  35227. t["A"] = 722;
  35228. t["B"] = 667;
  35229. t["C"] = 667;
  35230. t["D"] = 722;
  35231. t["E"] = 611;
  35232. t["F"] = 556;
  35233. t["G"] = 722;
  35234. t["H"] = 722;
  35235. t["I"] = 333;
  35236. t["J"] = 389;
  35237. t["K"] = 722;
  35238. t["L"] = 611;
  35239. t["M"] = 889;
  35240. t["N"] = 722;
  35241. t["O"] = 722;
  35242. t["P"] = 556;
  35243. t["Q"] = 722;
  35244. t["R"] = 667;
  35245. t["S"] = 556;
  35246. t["T"] = 611;
  35247. t["U"] = 722;
  35248. t["V"] = 722;
  35249. t["W"] = 944;
  35250. t["X"] = 722;
  35251. t["Y"] = 722;
  35252. t["Z"] = 611;
  35253. t["bracketleft"] = 333;
  35254. t["backslash"] = 278;
  35255. t["bracketright"] = 333;
  35256. t["asciicircum"] = 469;
  35257. t["underscore"] = 500;
  35258. t["quoteleft"] = 333;
  35259. t["a"] = 444;
  35260. t["b"] = 500;
  35261. t["c"] = 444;
  35262. t["d"] = 500;
  35263. t["e"] = 444;
  35264. t["f"] = 333;
  35265. t["g"] = 500;
  35266. t["h"] = 500;
  35267. t["i"] = 278;
  35268. t["j"] = 278;
  35269. t["k"] = 500;
  35270. t["l"] = 278;
  35271. t["m"] = 778;
  35272. t["n"] = 500;
  35273. t["o"] = 500;
  35274. t["p"] = 500;
  35275. t["q"] = 500;
  35276. t["r"] = 333;
  35277. t["s"] = 389;
  35278. t["t"] = 278;
  35279. t["u"] = 500;
  35280. t["v"] = 500;
  35281. t["w"] = 722;
  35282. t["x"] = 500;
  35283. t["y"] = 500;
  35284. t["z"] = 444;
  35285. t["braceleft"] = 480;
  35286. t["bar"] = 200;
  35287. t["braceright"] = 480;
  35288. t["asciitilde"] = 541;
  35289. t["exclamdown"] = 333;
  35290. t["cent"] = 500;
  35291. t["sterling"] = 500;
  35292. t["fraction"] = 167;
  35293. t["yen"] = 500;
  35294. t["florin"] = 500;
  35295. t["section"] = 500;
  35296. t["currency"] = 500;
  35297. t["quotesingle"] = 180;
  35298. t["quotedblleft"] = 444;
  35299. t["guillemotleft"] = 500;
  35300. t["guilsinglleft"] = 333;
  35301. t["guilsinglright"] = 333;
  35302. t["fi"] = 556;
  35303. t["fl"] = 556;
  35304. t["endash"] = 500;
  35305. t["dagger"] = 500;
  35306. t["daggerdbl"] = 500;
  35307. t["periodcentered"] = 250;
  35308. t["paragraph"] = 453;
  35309. t["bullet"] = 350;
  35310. t["quotesinglbase"] = 333;
  35311. t["quotedblbase"] = 444;
  35312. t["quotedblright"] = 444;
  35313. t["guillemotright"] = 500;
  35314. t["ellipsis"] = 1000;
  35315. t["perthousand"] = 1000;
  35316. t["questiondown"] = 444;
  35317. t["grave"] = 333;
  35318. t["acute"] = 333;
  35319. t["circumflex"] = 333;
  35320. t["tilde"] = 333;
  35321. t["macron"] = 333;
  35322. t["breve"] = 333;
  35323. t["dotaccent"] = 333;
  35324. t["dieresis"] = 333;
  35325. t["ring"] = 333;
  35326. t["cedilla"] = 333;
  35327. t["hungarumlaut"] = 333;
  35328. t["ogonek"] = 333;
  35329. t["caron"] = 333;
  35330. t["emdash"] = 1000;
  35331. t["AE"] = 889;
  35332. t["ordfeminine"] = 276;
  35333. t["Lslash"] = 611;
  35334. t["Oslash"] = 722;
  35335. t["OE"] = 889;
  35336. t["ordmasculine"] = 310;
  35337. t["ae"] = 667;
  35338. t["dotlessi"] = 278;
  35339. t["lslash"] = 278;
  35340. t["oslash"] = 500;
  35341. t["oe"] = 722;
  35342. t["germandbls"] = 500;
  35343. t["Idieresis"] = 333;
  35344. t["eacute"] = 444;
  35345. t["abreve"] = 444;
  35346. t["uhungarumlaut"] = 500;
  35347. t["ecaron"] = 444;
  35348. t["Ydieresis"] = 722;
  35349. t["divide"] = 564;
  35350. t["Yacute"] = 722;
  35351. t["Acircumflex"] = 722;
  35352. t["aacute"] = 444;
  35353. t["Ucircumflex"] = 722;
  35354. t["yacute"] = 500;
  35355. t["scommaaccent"] = 389;
  35356. t["ecircumflex"] = 444;
  35357. t["Uring"] = 722;
  35358. t["Udieresis"] = 722;
  35359. t["aogonek"] = 444;
  35360. t["Uacute"] = 722;
  35361. t["uogonek"] = 500;
  35362. t["Edieresis"] = 611;
  35363. t["Dcroat"] = 722;
  35364. t["commaaccent"] = 250;
  35365. t["copyright"] = 760;
  35366. t["Emacron"] = 611;
  35367. t["ccaron"] = 444;
  35368. t["aring"] = 444;
  35369. t["Ncommaaccent"] = 722;
  35370. t["lacute"] = 278;
  35371. t["agrave"] = 444;
  35372. t["Tcommaaccent"] = 611;
  35373. t["Cacute"] = 667;
  35374. t["atilde"] = 444;
  35375. t["Edotaccent"] = 611;
  35376. t["scaron"] = 389;
  35377. t["scedilla"] = 389;
  35378. t["iacute"] = 278;
  35379. t["lozenge"] = 471;
  35380. t["Rcaron"] = 667;
  35381. t["Gcommaaccent"] = 722;
  35382. t["ucircumflex"] = 500;
  35383. t["acircumflex"] = 444;
  35384. t["Amacron"] = 722;
  35385. t["rcaron"] = 333;
  35386. t["ccedilla"] = 444;
  35387. t["Zdotaccent"] = 611;
  35388. t["Thorn"] = 556;
  35389. t["Omacron"] = 722;
  35390. t["Racute"] = 667;
  35391. t["Sacute"] = 556;
  35392. t["dcaron"] = 588;
  35393. t["Umacron"] = 722;
  35394. t["uring"] = 500;
  35395. t["threesuperior"] = 300;
  35396. t["Ograve"] = 722;
  35397. t["Agrave"] = 722;
  35398. t["Abreve"] = 722;
  35399. t["multiply"] = 564;
  35400. t["uacute"] = 500;
  35401. t["Tcaron"] = 611;
  35402. t["partialdiff"] = 476;
  35403. t["ydieresis"] = 500;
  35404. t["Nacute"] = 722;
  35405. t["icircumflex"] = 278;
  35406. t["Ecircumflex"] = 611;
  35407. t["adieresis"] = 444;
  35408. t["edieresis"] = 444;
  35409. t["cacute"] = 444;
  35410. t["nacute"] = 500;
  35411. t["umacron"] = 500;
  35412. t["Ncaron"] = 722;
  35413. t["Iacute"] = 333;
  35414. t["plusminus"] = 564;
  35415. t["brokenbar"] = 200;
  35416. t["registered"] = 760;
  35417. t["Gbreve"] = 722;
  35418. t["Idotaccent"] = 333;
  35419. t["summation"] = 600;
  35420. t["Egrave"] = 611;
  35421. t["racute"] = 333;
  35422. t["omacron"] = 500;
  35423. t["Zacute"] = 611;
  35424. t["Zcaron"] = 611;
  35425. t["greaterequal"] = 549;
  35426. t["Eth"] = 722;
  35427. t["Ccedilla"] = 667;
  35428. t["lcommaaccent"] = 278;
  35429. t["tcaron"] = 326;
  35430. t["eogonek"] = 444;
  35431. t["Uogonek"] = 722;
  35432. t["Aacute"] = 722;
  35433. t["Adieresis"] = 722;
  35434. t["egrave"] = 444;
  35435. t["zacute"] = 444;
  35436. t["iogonek"] = 278;
  35437. t["Oacute"] = 722;
  35438. t["oacute"] = 500;
  35439. t["amacron"] = 444;
  35440. t["sacute"] = 389;
  35441. t["idieresis"] = 278;
  35442. t["Ocircumflex"] = 722;
  35443. t["Ugrave"] = 722;
  35444. t["Delta"] = 612;
  35445. t["thorn"] = 500;
  35446. t["twosuperior"] = 300;
  35447. t["Odieresis"] = 722;
  35448. t["mu"] = 500;
  35449. t["igrave"] = 278;
  35450. t["ohungarumlaut"] = 500;
  35451. t["Eogonek"] = 611;
  35452. t["dcroat"] = 500;
  35453. t["threequarters"] = 750;
  35454. t["Scedilla"] = 556;
  35455. t["lcaron"] = 344;
  35456. t["Kcommaaccent"] = 722;
  35457. t["Lacute"] = 611;
  35458. t["trademark"] = 980;
  35459. t["edotaccent"] = 444;
  35460. t["Igrave"] = 333;
  35461. t["Imacron"] = 333;
  35462. t["Lcaron"] = 611;
  35463. t["onehalf"] = 750;
  35464. t["lessequal"] = 549;
  35465. t["ocircumflex"] = 500;
  35466. t["ntilde"] = 500;
  35467. t["Uhungarumlaut"] = 722;
  35468. t["Eacute"] = 611;
  35469. t["emacron"] = 444;
  35470. t["gbreve"] = 500;
  35471. t["onequarter"] = 750;
  35472. t["Scaron"] = 556;
  35473. t["Scommaaccent"] = 556;
  35474. t["Ohungarumlaut"] = 722;
  35475. t["degree"] = 400;
  35476. t["ograve"] = 500;
  35477. t["Ccaron"] = 667;
  35478. t["ugrave"] = 500;
  35479. t["radical"] = 453;
  35480. t["Dcaron"] = 722;
  35481. t["rcommaaccent"] = 333;
  35482. t["Ntilde"] = 722;
  35483. t["otilde"] = 500;
  35484. t["Rcommaaccent"] = 667;
  35485. t["Lcommaaccent"] = 611;
  35486. t["Atilde"] = 722;
  35487. t["Aogonek"] = 722;
  35488. t["Aring"] = 722;
  35489. t["Otilde"] = 722;
  35490. t["zdotaccent"] = 444;
  35491. t["Ecaron"] = 611;
  35492. t["Iogonek"] = 333;
  35493. t["kcommaaccent"] = 500;
  35494. t["minus"] = 564;
  35495. t["Icircumflex"] = 333;
  35496. t["ncaron"] = 500;
  35497. t["tcommaaccent"] = 278;
  35498. t["logicalnot"] = 564;
  35499. t["odieresis"] = 500;
  35500. t["udieresis"] = 500;
  35501. t["notequal"] = 549;
  35502. t["gcommaaccent"] = 500;
  35503. t["eth"] = 500;
  35504. t["zcaron"] = 444;
  35505. t["ncommaaccent"] = 500;
  35506. t["onesuperior"] = 300;
  35507. t["imacron"] = 278;
  35508. t["Euro"] = 500;
  35509. });
  35510. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35511. t["space"] = 250;
  35512. t["exclam"] = 333;
  35513. t["quotedbl"] = 555;
  35514. t["numbersign"] = 500;
  35515. t["dollar"] = 500;
  35516. t["percent"] = 1000;
  35517. t["ampersand"] = 833;
  35518. t["quoteright"] = 333;
  35519. t["parenleft"] = 333;
  35520. t["parenright"] = 333;
  35521. t["asterisk"] = 500;
  35522. t["plus"] = 570;
  35523. t["comma"] = 250;
  35524. t["hyphen"] = 333;
  35525. t["period"] = 250;
  35526. t["slash"] = 278;
  35527. t["zero"] = 500;
  35528. t["one"] = 500;
  35529. t["two"] = 500;
  35530. t["three"] = 500;
  35531. t["four"] = 500;
  35532. t["five"] = 500;
  35533. t["six"] = 500;
  35534. t["seven"] = 500;
  35535. t["eight"] = 500;
  35536. t["nine"] = 500;
  35537. t["colon"] = 333;
  35538. t["semicolon"] = 333;
  35539. t["less"] = 570;
  35540. t["equal"] = 570;
  35541. t["greater"] = 570;
  35542. t["question"] = 500;
  35543. t["at"] = 930;
  35544. t["A"] = 722;
  35545. t["B"] = 667;
  35546. t["C"] = 722;
  35547. t["D"] = 722;
  35548. t["E"] = 667;
  35549. t["F"] = 611;
  35550. t["G"] = 778;
  35551. t["H"] = 778;
  35552. t["I"] = 389;
  35553. t["J"] = 500;
  35554. t["K"] = 778;
  35555. t["L"] = 667;
  35556. t["M"] = 944;
  35557. t["N"] = 722;
  35558. t["O"] = 778;
  35559. t["P"] = 611;
  35560. t["Q"] = 778;
  35561. t["R"] = 722;
  35562. t["S"] = 556;
  35563. t["T"] = 667;
  35564. t["U"] = 722;
  35565. t["V"] = 722;
  35566. t["W"] = 1000;
  35567. t["X"] = 722;
  35568. t["Y"] = 722;
  35569. t["Z"] = 667;
  35570. t["bracketleft"] = 333;
  35571. t["backslash"] = 278;
  35572. t["bracketright"] = 333;
  35573. t["asciicircum"] = 581;
  35574. t["underscore"] = 500;
  35575. t["quoteleft"] = 333;
  35576. t["a"] = 500;
  35577. t["b"] = 556;
  35578. t["c"] = 444;
  35579. t["d"] = 556;
  35580. t["e"] = 444;
  35581. t["f"] = 333;
  35582. t["g"] = 500;
  35583. t["h"] = 556;
  35584. t["i"] = 278;
  35585. t["j"] = 333;
  35586. t["k"] = 556;
  35587. t["l"] = 278;
  35588. t["m"] = 833;
  35589. t["n"] = 556;
  35590. t["o"] = 500;
  35591. t["p"] = 556;
  35592. t["q"] = 556;
  35593. t["r"] = 444;
  35594. t["s"] = 389;
  35595. t["t"] = 333;
  35596. t["u"] = 556;
  35597. t["v"] = 500;
  35598. t["w"] = 722;
  35599. t["x"] = 500;
  35600. t["y"] = 500;
  35601. t["z"] = 444;
  35602. t["braceleft"] = 394;
  35603. t["bar"] = 220;
  35604. t["braceright"] = 394;
  35605. t["asciitilde"] = 520;
  35606. t["exclamdown"] = 333;
  35607. t["cent"] = 500;
  35608. t["sterling"] = 500;
  35609. t["fraction"] = 167;
  35610. t["yen"] = 500;
  35611. t["florin"] = 500;
  35612. t["section"] = 500;
  35613. t["currency"] = 500;
  35614. t["quotesingle"] = 278;
  35615. t["quotedblleft"] = 500;
  35616. t["guillemotleft"] = 500;
  35617. t["guilsinglleft"] = 333;
  35618. t["guilsinglright"] = 333;
  35619. t["fi"] = 556;
  35620. t["fl"] = 556;
  35621. t["endash"] = 500;
  35622. t["dagger"] = 500;
  35623. t["daggerdbl"] = 500;
  35624. t["periodcentered"] = 250;
  35625. t["paragraph"] = 540;
  35626. t["bullet"] = 350;
  35627. t["quotesinglbase"] = 333;
  35628. t["quotedblbase"] = 500;
  35629. t["quotedblright"] = 500;
  35630. t["guillemotright"] = 500;
  35631. t["ellipsis"] = 1000;
  35632. t["perthousand"] = 1000;
  35633. t["questiondown"] = 500;
  35634. t["grave"] = 333;
  35635. t["acute"] = 333;
  35636. t["circumflex"] = 333;
  35637. t["tilde"] = 333;
  35638. t["macron"] = 333;
  35639. t["breve"] = 333;
  35640. t["dotaccent"] = 333;
  35641. t["dieresis"] = 333;
  35642. t["ring"] = 333;
  35643. t["cedilla"] = 333;
  35644. t["hungarumlaut"] = 333;
  35645. t["ogonek"] = 333;
  35646. t["caron"] = 333;
  35647. t["emdash"] = 1000;
  35648. t["AE"] = 1000;
  35649. t["ordfeminine"] = 300;
  35650. t["Lslash"] = 667;
  35651. t["Oslash"] = 778;
  35652. t["OE"] = 1000;
  35653. t["ordmasculine"] = 330;
  35654. t["ae"] = 722;
  35655. t["dotlessi"] = 278;
  35656. t["lslash"] = 278;
  35657. t["oslash"] = 500;
  35658. t["oe"] = 722;
  35659. t["germandbls"] = 556;
  35660. t["Idieresis"] = 389;
  35661. t["eacute"] = 444;
  35662. t["abreve"] = 500;
  35663. t["uhungarumlaut"] = 556;
  35664. t["ecaron"] = 444;
  35665. t["Ydieresis"] = 722;
  35666. t["divide"] = 570;
  35667. t["Yacute"] = 722;
  35668. t["Acircumflex"] = 722;
  35669. t["aacute"] = 500;
  35670. t["Ucircumflex"] = 722;
  35671. t["yacute"] = 500;
  35672. t["scommaaccent"] = 389;
  35673. t["ecircumflex"] = 444;
  35674. t["Uring"] = 722;
  35675. t["Udieresis"] = 722;
  35676. t["aogonek"] = 500;
  35677. t["Uacute"] = 722;
  35678. t["uogonek"] = 556;
  35679. t["Edieresis"] = 667;
  35680. t["Dcroat"] = 722;
  35681. t["commaaccent"] = 250;
  35682. t["copyright"] = 747;
  35683. t["Emacron"] = 667;
  35684. t["ccaron"] = 444;
  35685. t["aring"] = 500;
  35686. t["Ncommaaccent"] = 722;
  35687. t["lacute"] = 278;
  35688. t["agrave"] = 500;
  35689. t["Tcommaaccent"] = 667;
  35690. t["Cacute"] = 722;
  35691. t["atilde"] = 500;
  35692. t["Edotaccent"] = 667;
  35693. t["scaron"] = 389;
  35694. t["scedilla"] = 389;
  35695. t["iacute"] = 278;
  35696. t["lozenge"] = 494;
  35697. t["Rcaron"] = 722;
  35698. t["Gcommaaccent"] = 778;
  35699. t["ucircumflex"] = 556;
  35700. t["acircumflex"] = 500;
  35701. t["Amacron"] = 722;
  35702. t["rcaron"] = 444;
  35703. t["ccedilla"] = 444;
  35704. t["Zdotaccent"] = 667;
  35705. t["Thorn"] = 611;
  35706. t["Omacron"] = 778;
  35707. t["Racute"] = 722;
  35708. t["Sacute"] = 556;
  35709. t["dcaron"] = 672;
  35710. t["Umacron"] = 722;
  35711. t["uring"] = 556;
  35712. t["threesuperior"] = 300;
  35713. t["Ograve"] = 778;
  35714. t["Agrave"] = 722;
  35715. t["Abreve"] = 722;
  35716. t["multiply"] = 570;
  35717. t["uacute"] = 556;
  35718. t["Tcaron"] = 667;
  35719. t["partialdiff"] = 494;
  35720. t["ydieresis"] = 500;
  35721. t["Nacute"] = 722;
  35722. t["icircumflex"] = 278;
  35723. t["Ecircumflex"] = 667;
  35724. t["adieresis"] = 500;
  35725. t["edieresis"] = 444;
  35726. t["cacute"] = 444;
  35727. t["nacute"] = 556;
  35728. t["umacron"] = 556;
  35729. t["Ncaron"] = 722;
  35730. t["Iacute"] = 389;
  35731. t["plusminus"] = 570;
  35732. t["brokenbar"] = 220;
  35733. t["registered"] = 747;
  35734. t["Gbreve"] = 778;
  35735. t["Idotaccent"] = 389;
  35736. t["summation"] = 600;
  35737. t["Egrave"] = 667;
  35738. t["racute"] = 444;
  35739. t["omacron"] = 500;
  35740. t["Zacute"] = 667;
  35741. t["Zcaron"] = 667;
  35742. t["greaterequal"] = 549;
  35743. t["Eth"] = 722;
  35744. t["Ccedilla"] = 722;
  35745. t["lcommaaccent"] = 278;
  35746. t["tcaron"] = 416;
  35747. t["eogonek"] = 444;
  35748. t["Uogonek"] = 722;
  35749. t["Aacute"] = 722;
  35750. t["Adieresis"] = 722;
  35751. t["egrave"] = 444;
  35752. t["zacute"] = 444;
  35753. t["iogonek"] = 278;
  35754. t["Oacute"] = 778;
  35755. t["oacute"] = 500;
  35756. t["amacron"] = 500;
  35757. t["sacute"] = 389;
  35758. t["idieresis"] = 278;
  35759. t["Ocircumflex"] = 778;
  35760. t["Ugrave"] = 722;
  35761. t["Delta"] = 612;
  35762. t["thorn"] = 556;
  35763. t["twosuperior"] = 300;
  35764. t["Odieresis"] = 778;
  35765. t["mu"] = 556;
  35766. t["igrave"] = 278;
  35767. t["ohungarumlaut"] = 500;
  35768. t["Eogonek"] = 667;
  35769. t["dcroat"] = 556;
  35770. t["threequarters"] = 750;
  35771. t["Scedilla"] = 556;
  35772. t["lcaron"] = 394;
  35773. t["Kcommaaccent"] = 778;
  35774. t["Lacute"] = 667;
  35775. t["trademark"] = 1000;
  35776. t["edotaccent"] = 444;
  35777. t["Igrave"] = 389;
  35778. t["Imacron"] = 389;
  35779. t["Lcaron"] = 667;
  35780. t["onehalf"] = 750;
  35781. t["lessequal"] = 549;
  35782. t["ocircumflex"] = 500;
  35783. t["ntilde"] = 556;
  35784. t["Uhungarumlaut"] = 722;
  35785. t["Eacute"] = 667;
  35786. t["emacron"] = 444;
  35787. t["gbreve"] = 500;
  35788. t["onequarter"] = 750;
  35789. t["Scaron"] = 556;
  35790. t["Scommaaccent"] = 556;
  35791. t["Ohungarumlaut"] = 778;
  35792. t["degree"] = 400;
  35793. t["ograve"] = 500;
  35794. t["Ccaron"] = 722;
  35795. t["ugrave"] = 556;
  35796. t["radical"] = 549;
  35797. t["Dcaron"] = 722;
  35798. t["rcommaaccent"] = 444;
  35799. t["Ntilde"] = 722;
  35800. t["otilde"] = 500;
  35801. t["Rcommaaccent"] = 722;
  35802. t["Lcommaaccent"] = 667;
  35803. t["Atilde"] = 722;
  35804. t["Aogonek"] = 722;
  35805. t["Aring"] = 722;
  35806. t["Otilde"] = 778;
  35807. t["zdotaccent"] = 444;
  35808. t["Ecaron"] = 667;
  35809. t["Iogonek"] = 389;
  35810. t["kcommaaccent"] = 556;
  35811. t["minus"] = 570;
  35812. t["Icircumflex"] = 389;
  35813. t["ncaron"] = 556;
  35814. t["tcommaaccent"] = 333;
  35815. t["logicalnot"] = 570;
  35816. t["odieresis"] = 500;
  35817. t["udieresis"] = 556;
  35818. t["notequal"] = 549;
  35819. t["gcommaaccent"] = 500;
  35820. t["eth"] = 500;
  35821. t["zcaron"] = 444;
  35822. t["ncommaaccent"] = 556;
  35823. t["onesuperior"] = 300;
  35824. t["imacron"] = 278;
  35825. t["Euro"] = 500;
  35826. });
  35827. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35828. t["space"] = 250;
  35829. t["exclam"] = 389;
  35830. t["quotedbl"] = 555;
  35831. t["numbersign"] = 500;
  35832. t["dollar"] = 500;
  35833. t["percent"] = 833;
  35834. t["ampersand"] = 778;
  35835. t["quoteright"] = 333;
  35836. t["parenleft"] = 333;
  35837. t["parenright"] = 333;
  35838. t["asterisk"] = 500;
  35839. t["plus"] = 570;
  35840. t["comma"] = 250;
  35841. t["hyphen"] = 333;
  35842. t["period"] = 250;
  35843. t["slash"] = 278;
  35844. t["zero"] = 500;
  35845. t["one"] = 500;
  35846. t["two"] = 500;
  35847. t["three"] = 500;
  35848. t["four"] = 500;
  35849. t["five"] = 500;
  35850. t["six"] = 500;
  35851. t["seven"] = 500;
  35852. t["eight"] = 500;
  35853. t["nine"] = 500;
  35854. t["colon"] = 333;
  35855. t["semicolon"] = 333;
  35856. t["less"] = 570;
  35857. t["equal"] = 570;
  35858. t["greater"] = 570;
  35859. t["question"] = 500;
  35860. t["at"] = 832;
  35861. t["A"] = 667;
  35862. t["B"] = 667;
  35863. t["C"] = 667;
  35864. t["D"] = 722;
  35865. t["E"] = 667;
  35866. t["F"] = 667;
  35867. t["G"] = 722;
  35868. t["H"] = 778;
  35869. t["I"] = 389;
  35870. t["J"] = 500;
  35871. t["K"] = 667;
  35872. t["L"] = 611;
  35873. t["M"] = 889;
  35874. t["N"] = 722;
  35875. t["O"] = 722;
  35876. t["P"] = 611;
  35877. t["Q"] = 722;
  35878. t["R"] = 667;
  35879. t["S"] = 556;
  35880. t["T"] = 611;
  35881. t["U"] = 722;
  35882. t["V"] = 667;
  35883. t["W"] = 889;
  35884. t["X"] = 667;
  35885. t["Y"] = 611;
  35886. t["Z"] = 611;
  35887. t["bracketleft"] = 333;
  35888. t["backslash"] = 278;
  35889. t["bracketright"] = 333;
  35890. t["asciicircum"] = 570;
  35891. t["underscore"] = 500;
  35892. t["quoteleft"] = 333;
  35893. t["a"] = 500;
  35894. t["b"] = 500;
  35895. t["c"] = 444;
  35896. t["d"] = 500;
  35897. t["e"] = 444;
  35898. t["f"] = 333;
  35899. t["g"] = 500;
  35900. t["h"] = 556;
  35901. t["i"] = 278;
  35902. t["j"] = 278;
  35903. t["k"] = 500;
  35904. t["l"] = 278;
  35905. t["m"] = 778;
  35906. t["n"] = 556;
  35907. t["o"] = 500;
  35908. t["p"] = 500;
  35909. t["q"] = 500;
  35910. t["r"] = 389;
  35911. t["s"] = 389;
  35912. t["t"] = 278;
  35913. t["u"] = 556;
  35914. t["v"] = 444;
  35915. t["w"] = 667;
  35916. t["x"] = 500;
  35917. t["y"] = 444;
  35918. t["z"] = 389;
  35919. t["braceleft"] = 348;
  35920. t["bar"] = 220;
  35921. t["braceright"] = 348;
  35922. t["asciitilde"] = 570;
  35923. t["exclamdown"] = 389;
  35924. t["cent"] = 500;
  35925. t["sterling"] = 500;
  35926. t["fraction"] = 167;
  35927. t["yen"] = 500;
  35928. t["florin"] = 500;
  35929. t["section"] = 500;
  35930. t["currency"] = 500;
  35931. t["quotesingle"] = 278;
  35932. t["quotedblleft"] = 500;
  35933. t["guillemotleft"] = 500;
  35934. t["guilsinglleft"] = 333;
  35935. t["guilsinglright"] = 333;
  35936. t["fi"] = 556;
  35937. t["fl"] = 556;
  35938. t["endash"] = 500;
  35939. t["dagger"] = 500;
  35940. t["daggerdbl"] = 500;
  35941. t["periodcentered"] = 250;
  35942. t["paragraph"] = 500;
  35943. t["bullet"] = 350;
  35944. t["quotesinglbase"] = 333;
  35945. t["quotedblbase"] = 500;
  35946. t["quotedblright"] = 500;
  35947. t["guillemotright"] = 500;
  35948. t["ellipsis"] = 1000;
  35949. t["perthousand"] = 1000;
  35950. t["questiondown"] = 500;
  35951. t["grave"] = 333;
  35952. t["acute"] = 333;
  35953. t["circumflex"] = 333;
  35954. t["tilde"] = 333;
  35955. t["macron"] = 333;
  35956. t["breve"] = 333;
  35957. t["dotaccent"] = 333;
  35958. t["dieresis"] = 333;
  35959. t["ring"] = 333;
  35960. t["cedilla"] = 333;
  35961. t["hungarumlaut"] = 333;
  35962. t["ogonek"] = 333;
  35963. t["caron"] = 333;
  35964. t["emdash"] = 1000;
  35965. t["AE"] = 944;
  35966. t["ordfeminine"] = 266;
  35967. t["Lslash"] = 611;
  35968. t["Oslash"] = 722;
  35969. t["OE"] = 944;
  35970. t["ordmasculine"] = 300;
  35971. t["ae"] = 722;
  35972. t["dotlessi"] = 278;
  35973. t["lslash"] = 278;
  35974. t["oslash"] = 500;
  35975. t["oe"] = 722;
  35976. t["germandbls"] = 500;
  35977. t["Idieresis"] = 389;
  35978. t["eacute"] = 444;
  35979. t["abreve"] = 500;
  35980. t["uhungarumlaut"] = 556;
  35981. t["ecaron"] = 444;
  35982. t["Ydieresis"] = 611;
  35983. t["divide"] = 570;
  35984. t["Yacute"] = 611;
  35985. t["Acircumflex"] = 667;
  35986. t["aacute"] = 500;
  35987. t["Ucircumflex"] = 722;
  35988. t["yacute"] = 444;
  35989. t["scommaaccent"] = 389;
  35990. t["ecircumflex"] = 444;
  35991. t["Uring"] = 722;
  35992. t["Udieresis"] = 722;
  35993. t["aogonek"] = 500;
  35994. t["Uacute"] = 722;
  35995. t["uogonek"] = 556;
  35996. t["Edieresis"] = 667;
  35997. t["Dcroat"] = 722;
  35998. t["commaaccent"] = 250;
  35999. t["copyright"] = 747;
  36000. t["Emacron"] = 667;
  36001. t["ccaron"] = 444;
  36002. t["aring"] = 500;
  36003. t["Ncommaaccent"] = 722;
  36004. t["lacute"] = 278;
  36005. t["agrave"] = 500;
  36006. t["Tcommaaccent"] = 611;
  36007. t["Cacute"] = 667;
  36008. t["atilde"] = 500;
  36009. t["Edotaccent"] = 667;
  36010. t["scaron"] = 389;
  36011. t["scedilla"] = 389;
  36012. t["iacute"] = 278;
  36013. t["lozenge"] = 494;
  36014. t["Rcaron"] = 667;
  36015. t["Gcommaaccent"] = 722;
  36016. t["ucircumflex"] = 556;
  36017. t["acircumflex"] = 500;
  36018. t["Amacron"] = 667;
  36019. t["rcaron"] = 389;
  36020. t["ccedilla"] = 444;
  36021. t["Zdotaccent"] = 611;
  36022. t["Thorn"] = 611;
  36023. t["Omacron"] = 722;
  36024. t["Racute"] = 667;
  36025. t["Sacute"] = 556;
  36026. t["dcaron"] = 608;
  36027. t["Umacron"] = 722;
  36028. t["uring"] = 556;
  36029. t["threesuperior"] = 300;
  36030. t["Ograve"] = 722;
  36031. t["Agrave"] = 667;
  36032. t["Abreve"] = 667;
  36033. t["multiply"] = 570;
  36034. t["uacute"] = 556;
  36035. t["Tcaron"] = 611;
  36036. t["partialdiff"] = 494;
  36037. t["ydieresis"] = 444;
  36038. t["Nacute"] = 722;
  36039. t["icircumflex"] = 278;
  36040. t["Ecircumflex"] = 667;
  36041. t["adieresis"] = 500;
  36042. t["edieresis"] = 444;
  36043. t["cacute"] = 444;
  36044. t["nacute"] = 556;
  36045. t["umacron"] = 556;
  36046. t["Ncaron"] = 722;
  36047. t["Iacute"] = 389;
  36048. t["plusminus"] = 570;
  36049. t["brokenbar"] = 220;
  36050. t["registered"] = 747;
  36051. t["Gbreve"] = 722;
  36052. t["Idotaccent"] = 389;
  36053. t["summation"] = 600;
  36054. t["Egrave"] = 667;
  36055. t["racute"] = 389;
  36056. t["omacron"] = 500;
  36057. t["Zacute"] = 611;
  36058. t["Zcaron"] = 611;
  36059. t["greaterequal"] = 549;
  36060. t["Eth"] = 722;
  36061. t["Ccedilla"] = 667;
  36062. t["lcommaaccent"] = 278;
  36063. t["tcaron"] = 366;
  36064. t["eogonek"] = 444;
  36065. t["Uogonek"] = 722;
  36066. t["Aacute"] = 667;
  36067. t["Adieresis"] = 667;
  36068. t["egrave"] = 444;
  36069. t["zacute"] = 389;
  36070. t["iogonek"] = 278;
  36071. t["Oacute"] = 722;
  36072. t["oacute"] = 500;
  36073. t["amacron"] = 500;
  36074. t["sacute"] = 389;
  36075. t["idieresis"] = 278;
  36076. t["Ocircumflex"] = 722;
  36077. t["Ugrave"] = 722;
  36078. t["Delta"] = 612;
  36079. t["thorn"] = 500;
  36080. t["twosuperior"] = 300;
  36081. t["Odieresis"] = 722;
  36082. t["mu"] = 576;
  36083. t["igrave"] = 278;
  36084. t["ohungarumlaut"] = 500;
  36085. t["Eogonek"] = 667;
  36086. t["dcroat"] = 500;
  36087. t["threequarters"] = 750;
  36088. t["Scedilla"] = 556;
  36089. t["lcaron"] = 382;
  36090. t["Kcommaaccent"] = 667;
  36091. t["Lacute"] = 611;
  36092. t["trademark"] = 1000;
  36093. t["edotaccent"] = 444;
  36094. t["Igrave"] = 389;
  36095. t["Imacron"] = 389;
  36096. t["Lcaron"] = 611;
  36097. t["onehalf"] = 750;
  36098. t["lessequal"] = 549;
  36099. t["ocircumflex"] = 500;
  36100. t["ntilde"] = 556;
  36101. t["Uhungarumlaut"] = 722;
  36102. t["Eacute"] = 667;
  36103. t["emacron"] = 444;
  36104. t["gbreve"] = 500;
  36105. t["onequarter"] = 750;
  36106. t["Scaron"] = 556;
  36107. t["Scommaaccent"] = 556;
  36108. t["Ohungarumlaut"] = 722;
  36109. t["degree"] = 400;
  36110. t["ograve"] = 500;
  36111. t["Ccaron"] = 667;
  36112. t["ugrave"] = 556;
  36113. t["radical"] = 549;
  36114. t["Dcaron"] = 722;
  36115. t["rcommaaccent"] = 389;
  36116. t["Ntilde"] = 722;
  36117. t["otilde"] = 500;
  36118. t["Rcommaaccent"] = 667;
  36119. t["Lcommaaccent"] = 611;
  36120. t["Atilde"] = 667;
  36121. t["Aogonek"] = 667;
  36122. t["Aring"] = 667;
  36123. t["Otilde"] = 722;
  36124. t["zdotaccent"] = 389;
  36125. t["Ecaron"] = 667;
  36126. t["Iogonek"] = 389;
  36127. t["kcommaaccent"] = 500;
  36128. t["minus"] = 606;
  36129. t["Icircumflex"] = 389;
  36130. t["ncaron"] = 556;
  36131. t["tcommaaccent"] = 278;
  36132. t["logicalnot"] = 606;
  36133. t["odieresis"] = 500;
  36134. t["udieresis"] = 556;
  36135. t["notequal"] = 549;
  36136. t["gcommaaccent"] = 500;
  36137. t["eth"] = 500;
  36138. t["zcaron"] = 389;
  36139. t["ncommaaccent"] = 556;
  36140. t["onesuperior"] = 300;
  36141. t["imacron"] = 278;
  36142. t["Euro"] = 500;
  36143. });
  36144. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  36145. t["space"] = 250;
  36146. t["exclam"] = 333;
  36147. t["quotedbl"] = 420;
  36148. t["numbersign"] = 500;
  36149. t["dollar"] = 500;
  36150. t["percent"] = 833;
  36151. t["ampersand"] = 778;
  36152. t["quoteright"] = 333;
  36153. t["parenleft"] = 333;
  36154. t["parenright"] = 333;
  36155. t["asterisk"] = 500;
  36156. t["plus"] = 675;
  36157. t["comma"] = 250;
  36158. t["hyphen"] = 333;
  36159. t["period"] = 250;
  36160. t["slash"] = 278;
  36161. t["zero"] = 500;
  36162. t["one"] = 500;
  36163. t["two"] = 500;
  36164. t["three"] = 500;
  36165. t["four"] = 500;
  36166. t["five"] = 500;
  36167. t["six"] = 500;
  36168. t["seven"] = 500;
  36169. t["eight"] = 500;
  36170. t["nine"] = 500;
  36171. t["colon"] = 333;
  36172. t["semicolon"] = 333;
  36173. t["less"] = 675;
  36174. t["equal"] = 675;
  36175. t["greater"] = 675;
  36176. t["question"] = 500;
  36177. t["at"] = 920;
  36178. t["A"] = 611;
  36179. t["B"] = 611;
  36180. t["C"] = 667;
  36181. t["D"] = 722;
  36182. t["E"] = 611;
  36183. t["F"] = 611;
  36184. t["G"] = 722;
  36185. t["H"] = 722;
  36186. t["I"] = 333;
  36187. t["J"] = 444;
  36188. t["K"] = 667;
  36189. t["L"] = 556;
  36190. t["M"] = 833;
  36191. t["N"] = 667;
  36192. t["O"] = 722;
  36193. t["P"] = 611;
  36194. t["Q"] = 722;
  36195. t["R"] = 611;
  36196. t["S"] = 500;
  36197. t["T"] = 556;
  36198. t["U"] = 722;
  36199. t["V"] = 611;
  36200. t["W"] = 833;
  36201. t["X"] = 611;
  36202. t["Y"] = 556;
  36203. t["Z"] = 556;
  36204. t["bracketleft"] = 389;
  36205. t["backslash"] = 278;
  36206. t["bracketright"] = 389;
  36207. t["asciicircum"] = 422;
  36208. t["underscore"] = 500;
  36209. t["quoteleft"] = 333;
  36210. t["a"] = 500;
  36211. t["b"] = 500;
  36212. t["c"] = 444;
  36213. t["d"] = 500;
  36214. t["e"] = 444;
  36215. t["f"] = 278;
  36216. t["g"] = 500;
  36217. t["h"] = 500;
  36218. t["i"] = 278;
  36219. t["j"] = 278;
  36220. t["k"] = 444;
  36221. t["l"] = 278;
  36222. t["m"] = 722;
  36223. t["n"] = 500;
  36224. t["o"] = 500;
  36225. t["p"] = 500;
  36226. t["q"] = 500;
  36227. t["r"] = 389;
  36228. t["s"] = 389;
  36229. t["t"] = 278;
  36230. t["u"] = 500;
  36231. t["v"] = 444;
  36232. t["w"] = 667;
  36233. t["x"] = 444;
  36234. t["y"] = 444;
  36235. t["z"] = 389;
  36236. t["braceleft"] = 400;
  36237. t["bar"] = 275;
  36238. t["braceright"] = 400;
  36239. t["asciitilde"] = 541;
  36240. t["exclamdown"] = 389;
  36241. t["cent"] = 500;
  36242. t["sterling"] = 500;
  36243. t["fraction"] = 167;
  36244. t["yen"] = 500;
  36245. t["florin"] = 500;
  36246. t["section"] = 500;
  36247. t["currency"] = 500;
  36248. t["quotesingle"] = 214;
  36249. t["quotedblleft"] = 556;
  36250. t["guillemotleft"] = 500;
  36251. t["guilsinglleft"] = 333;
  36252. t["guilsinglright"] = 333;
  36253. t["fi"] = 500;
  36254. t["fl"] = 500;
  36255. t["endash"] = 500;
  36256. t["dagger"] = 500;
  36257. t["daggerdbl"] = 500;
  36258. t["periodcentered"] = 250;
  36259. t["paragraph"] = 523;
  36260. t["bullet"] = 350;
  36261. t["quotesinglbase"] = 333;
  36262. t["quotedblbase"] = 556;
  36263. t["quotedblright"] = 556;
  36264. t["guillemotright"] = 500;
  36265. t["ellipsis"] = 889;
  36266. t["perthousand"] = 1000;
  36267. t["questiondown"] = 500;
  36268. t["grave"] = 333;
  36269. t["acute"] = 333;
  36270. t["circumflex"] = 333;
  36271. t["tilde"] = 333;
  36272. t["macron"] = 333;
  36273. t["breve"] = 333;
  36274. t["dotaccent"] = 333;
  36275. t["dieresis"] = 333;
  36276. t["ring"] = 333;
  36277. t["cedilla"] = 333;
  36278. t["hungarumlaut"] = 333;
  36279. t["ogonek"] = 333;
  36280. t["caron"] = 333;
  36281. t["emdash"] = 889;
  36282. t["AE"] = 889;
  36283. t["ordfeminine"] = 276;
  36284. t["Lslash"] = 556;
  36285. t["Oslash"] = 722;
  36286. t["OE"] = 944;
  36287. t["ordmasculine"] = 310;
  36288. t["ae"] = 667;
  36289. t["dotlessi"] = 278;
  36290. t["lslash"] = 278;
  36291. t["oslash"] = 500;
  36292. t["oe"] = 667;
  36293. t["germandbls"] = 500;
  36294. t["Idieresis"] = 333;
  36295. t["eacute"] = 444;
  36296. t["abreve"] = 500;
  36297. t["uhungarumlaut"] = 500;
  36298. t["ecaron"] = 444;
  36299. t["Ydieresis"] = 556;
  36300. t["divide"] = 675;
  36301. t["Yacute"] = 556;
  36302. t["Acircumflex"] = 611;
  36303. t["aacute"] = 500;
  36304. t["Ucircumflex"] = 722;
  36305. t["yacute"] = 444;
  36306. t["scommaaccent"] = 389;
  36307. t["ecircumflex"] = 444;
  36308. t["Uring"] = 722;
  36309. t["Udieresis"] = 722;
  36310. t["aogonek"] = 500;
  36311. t["Uacute"] = 722;
  36312. t["uogonek"] = 500;
  36313. t["Edieresis"] = 611;
  36314. t["Dcroat"] = 722;
  36315. t["commaaccent"] = 250;
  36316. t["copyright"] = 760;
  36317. t["Emacron"] = 611;
  36318. t["ccaron"] = 444;
  36319. t["aring"] = 500;
  36320. t["Ncommaaccent"] = 667;
  36321. t["lacute"] = 278;
  36322. t["agrave"] = 500;
  36323. t["Tcommaaccent"] = 556;
  36324. t["Cacute"] = 667;
  36325. t["atilde"] = 500;
  36326. t["Edotaccent"] = 611;
  36327. t["scaron"] = 389;
  36328. t["scedilla"] = 389;
  36329. t["iacute"] = 278;
  36330. t["lozenge"] = 471;
  36331. t["Rcaron"] = 611;
  36332. t["Gcommaaccent"] = 722;
  36333. t["ucircumflex"] = 500;
  36334. t["acircumflex"] = 500;
  36335. t["Amacron"] = 611;
  36336. t["rcaron"] = 389;
  36337. t["ccedilla"] = 444;
  36338. t["Zdotaccent"] = 556;
  36339. t["Thorn"] = 611;
  36340. t["Omacron"] = 722;
  36341. t["Racute"] = 611;
  36342. t["Sacute"] = 500;
  36343. t["dcaron"] = 544;
  36344. t["Umacron"] = 722;
  36345. t["uring"] = 500;
  36346. t["threesuperior"] = 300;
  36347. t["Ograve"] = 722;
  36348. t["Agrave"] = 611;
  36349. t["Abreve"] = 611;
  36350. t["multiply"] = 675;
  36351. t["uacute"] = 500;
  36352. t["Tcaron"] = 556;
  36353. t["partialdiff"] = 476;
  36354. t["ydieresis"] = 444;
  36355. t["Nacute"] = 667;
  36356. t["icircumflex"] = 278;
  36357. t["Ecircumflex"] = 611;
  36358. t["adieresis"] = 500;
  36359. t["edieresis"] = 444;
  36360. t["cacute"] = 444;
  36361. t["nacute"] = 500;
  36362. t["umacron"] = 500;
  36363. t["Ncaron"] = 667;
  36364. t["Iacute"] = 333;
  36365. t["plusminus"] = 675;
  36366. t["brokenbar"] = 275;
  36367. t["registered"] = 760;
  36368. t["Gbreve"] = 722;
  36369. t["Idotaccent"] = 333;
  36370. t["summation"] = 600;
  36371. t["Egrave"] = 611;
  36372. t["racute"] = 389;
  36373. t["omacron"] = 500;
  36374. t["Zacute"] = 556;
  36375. t["Zcaron"] = 556;
  36376. t["greaterequal"] = 549;
  36377. t["Eth"] = 722;
  36378. t["Ccedilla"] = 667;
  36379. t["lcommaaccent"] = 278;
  36380. t["tcaron"] = 300;
  36381. t["eogonek"] = 444;
  36382. t["Uogonek"] = 722;
  36383. t["Aacute"] = 611;
  36384. t["Adieresis"] = 611;
  36385. t["egrave"] = 444;
  36386. t["zacute"] = 389;
  36387. t["iogonek"] = 278;
  36388. t["Oacute"] = 722;
  36389. t["oacute"] = 500;
  36390. t["amacron"] = 500;
  36391. t["sacute"] = 389;
  36392. t["idieresis"] = 278;
  36393. t["Ocircumflex"] = 722;
  36394. t["Ugrave"] = 722;
  36395. t["Delta"] = 612;
  36396. t["thorn"] = 500;
  36397. t["twosuperior"] = 300;
  36398. t["Odieresis"] = 722;
  36399. t["mu"] = 500;
  36400. t["igrave"] = 278;
  36401. t["ohungarumlaut"] = 500;
  36402. t["Eogonek"] = 611;
  36403. t["dcroat"] = 500;
  36404. t["threequarters"] = 750;
  36405. t["Scedilla"] = 500;
  36406. t["lcaron"] = 300;
  36407. t["Kcommaaccent"] = 667;
  36408. t["Lacute"] = 556;
  36409. t["trademark"] = 980;
  36410. t["edotaccent"] = 444;
  36411. t["Igrave"] = 333;
  36412. t["Imacron"] = 333;
  36413. t["Lcaron"] = 611;
  36414. t["onehalf"] = 750;
  36415. t["lessequal"] = 549;
  36416. t["ocircumflex"] = 500;
  36417. t["ntilde"] = 500;
  36418. t["Uhungarumlaut"] = 722;
  36419. t["Eacute"] = 611;
  36420. t["emacron"] = 444;
  36421. t["gbreve"] = 500;
  36422. t["onequarter"] = 750;
  36423. t["Scaron"] = 500;
  36424. t["Scommaaccent"] = 500;
  36425. t["Ohungarumlaut"] = 722;
  36426. t["degree"] = 400;
  36427. t["ograve"] = 500;
  36428. t["Ccaron"] = 667;
  36429. t["ugrave"] = 500;
  36430. t["radical"] = 453;
  36431. t["Dcaron"] = 722;
  36432. t["rcommaaccent"] = 389;
  36433. t["Ntilde"] = 667;
  36434. t["otilde"] = 500;
  36435. t["Rcommaaccent"] = 611;
  36436. t["Lcommaaccent"] = 556;
  36437. t["Atilde"] = 611;
  36438. t["Aogonek"] = 611;
  36439. t["Aring"] = 611;
  36440. t["Otilde"] = 722;
  36441. t["zdotaccent"] = 389;
  36442. t["Ecaron"] = 611;
  36443. t["Iogonek"] = 333;
  36444. t["kcommaaccent"] = 444;
  36445. t["minus"] = 675;
  36446. t["Icircumflex"] = 333;
  36447. t["ncaron"] = 500;
  36448. t["tcommaaccent"] = 278;
  36449. t["logicalnot"] = 675;
  36450. t["odieresis"] = 500;
  36451. t["udieresis"] = 500;
  36452. t["notequal"] = 549;
  36453. t["gcommaaccent"] = 500;
  36454. t["eth"] = 500;
  36455. t["zcaron"] = 389;
  36456. t["ncommaaccent"] = 500;
  36457. t["onesuperior"] = 300;
  36458. t["imacron"] = 278;
  36459. t["Euro"] = 500;
  36460. });
  36461. t["ZapfDingbats"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  36462. t["space"] = 278;
  36463. t["a1"] = 974;
  36464. t["a2"] = 961;
  36465. t["a202"] = 974;
  36466. t["a3"] = 980;
  36467. t["a4"] = 719;
  36468. t["a5"] = 789;
  36469. t["a119"] = 790;
  36470. t["a118"] = 791;
  36471. t["a117"] = 690;
  36472. t["a11"] = 960;
  36473. t["a12"] = 939;
  36474. t["a13"] = 549;
  36475. t["a14"] = 855;
  36476. t["a15"] = 911;
  36477. t["a16"] = 933;
  36478. t["a105"] = 911;
  36479. t["a17"] = 945;
  36480. t["a18"] = 974;
  36481. t["a19"] = 755;
  36482. t["a20"] = 846;
  36483. t["a21"] = 762;
  36484. t["a22"] = 761;
  36485. t["a23"] = 571;
  36486. t["a24"] = 677;
  36487. t["a25"] = 763;
  36488. t["a26"] = 760;
  36489. t["a27"] = 759;
  36490. t["a28"] = 754;
  36491. t["a6"] = 494;
  36492. t["a7"] = 552;
  36493. t["a8"] = 537;
  36494. t["a9"] = 577;
  36495. t["a10"] = 692;
  36496. t["a29"] = 786;
  36497. t["a30"] = 788;
  36498. t["a31"] = 788;
  36499. t["a32"] = 790;
  36500. t["a33"] = 793;
  36501. t["a34"] = 794;
  36502. t["a35"] = 816;
  36503. t["a36"] = 823;
  36504. t["a37"] = 789;
  36505. t["a38"] = 841;
  36506. t["a39"] = 823;
  36507. t["a40"] = 833;
  36508. t["a41"] = 816;
  36509. t["a42"] = 831;
  36510. t["a43"] = 923;
  36511. t["a44"] = 744;
  36512. t["a45"] = 723;
  36513. t["a46"] = 749;
  36514. t["a47"] = 790;
  36515. t["a48"] = 792;
  36516. t["a49"] = 695;
  36517. t["a50"] = 776;
  36518. t["a51"] = 768;
  36519. t["a52"] = 792;
  36520. t["a53"] = 759;
  36521. t["a54"] = 707;
  36522. t["a55"] = 708;
  36523. t["a56"] = 682;
  36524. t["a57"] = 701;
  36525. t["a58"] = 826;
  36526. t["a59"] = 815;
  36527. t["a60"] = 789;
  36528. t["a61"] = 789;
  36529. t["a62"] = 707;
  36530. t["a63"] = 687;
  36531. t["a64"] = 696;
  36532. t["a65"] = 689;
  36533. t["a66"] = 786;
  36534. t["a67"] = 787;
  36535. t["a68"] = 713;
  36536. t["a69"] = 791;
  36537. t["a70"] = 785;
  36538. t["a71"] = 791;
  36539. t["a72"] = 873;
  36540. t["a73"] = 761;
  36541. t["a74"] = 762;
  36542. t["a203"] = 762;
  36543. t["a75"] = 759;
  36544. t["a204"] = 759;
  36545. t["a76"] = 892;
  36546. t["a77"] = 892;
  36547. t["a78"] = 788;
  36548. t["a79"] = 784;
  36549. t["a81"] = 438;
  36550. t["a82"] = 138;
  36551. t["a83"] = 277;
  36552. t["a84"] = 415;
  36553. t["a97"] = 392;
  36554. t["a98"] = 392;
  36555. t["a99"] = 668;
  36556. t["a100"] = 668;
  36557. t["a89"] = 390;
  36558. t["a90"] = 390;
  36559. t["a93"] = 317;
  36560. t["a94"] = 317;
  36561. t["a91"] = 276;
  36562. t["a92"] = 276;
  36563. t["a205"] = 509;
  36564. t["a85"] = 509;
  36565. t["a206"] = 410;
  36566. t["a86"] = 410;
  36567. t["a87"] = 234;
  36568. t["a88"] = 234;
  36569. t["a95"] = 334;
  36570. t["a96"] = 334;
  36571. t["a101"] = 732;
  36572. t["a102"] = 544;
  36573. t["a103"] = 544;
  36574. t["a104"] = 910;
  36575. t["a106"] = 667;
  36576. t["a107"] = 760;
  36577. t["a108"] = 760;
  36578. t["a112"] = 776;
  36579. t["a111"] = 595;
  36580. t["a110"] = 694;
  36581. t["a109"] = 626;
  36582. t["a120"] = 788;
  36583. t["a121"] = 788;
  36584. t["a122"] = 788;
  36585. t["a123"] = 788;
  36586. t["a124"] = 788;
  36587. t["a125"] = 788;
  36588. t["a126"] = 788;
  36589. t["a127"] = 788;
  36590. t["a128"] = 788;
  36591. t["a129"] = 788;
  36592. t["a130"] = 788;
  36593. t["a131"] = 788;
  36594. t["a132"] = 788;
  36595. t["a133"] = 788;
  36596. t["a134"] = 788;
  36597. t["a135"] = 788;
  36598. t["a136"] = 788;
  36599. t["a137"] = 788;
  36600. t["a138"] = 788;
  36601. t["a139"] = 788;
  36602. t["a140"] = 788;
  36603. t["a141"] = 788;
  36604. t["a142"] = 788;
  36605. t["a143"] = 788;
  36606. t["a144"] = 788;
  36607. t["a145"] = 788;
  36608. t["a146"] = 788;
  36609. t["a147"] = 788;
  36610. t["a148"] = 788;
  36611. t["a149"] = 788;
  36612. t["a150"] = 788;
  36613. t["a151"] = 788;
  36614. t["a152"] = 788;
  36615. t["a153"] = 788;
  36616. t["a154"] = 788;
  36617. t["a155"] = 788;
  36618. t["a156"] = 788;
  36619. t["a157"] = 788;
  36620. t["a158"] = 788;
  36621. t["a159"] = 788;
  36622. t["a160"] = 894;
  36623. t["a161"] = 838;
  36624. t["a163"] = 1016;
  36625. t["a164"] = 458;
  36626. t["a196"] = 748;
  36627. t["a165"] = 924;
  36628. t["a192"] = 748;
  36629. t["a166"] = 918;
  36630. t["a167"] = 927;
  36631. t["a168"] = 928;
  36632. t["a169"] = 928;
  36633. t["a170"] = 834;
  36634. t["a171"] = 873;
  36635. t["a172"] = 828;
  36636. t["a173"] = 924;
  36637. t["a162"] = 924;
  36638. t["a174"] = 917;
  36639. t["a175"] = 930;
  36640. t["a176"] = 931;
  36641. t["a177"] = 463;
  36642. t["a178"] = 883;
  36643. t["a179"] = 836;
  36644. t["a193"] = 836;
  36645. t["a180"] = 867;
  36646. t["a199"] = 867;
  36647. t["a181"] = 696;
  36648. t["a200"] = 696;
  36649. t["a182"] = 874;
  36650. t["a201"] = 874;
  36651. t["a183"] = 760;
  36652. t["a184"] = 946;
  36653. t["a197"] = 771;
  36654. t["a185"] = 865;
  36655. t["a194"] = 771;
  36656. t["a198"] = 888;
  36657. t["a186"] = 967;
  36658. t["a195"] = 888;
  36659. t["a187"] = 831;
  36660. t["a188"] = 873;
  36661. t["a189"] = 927;
  36662. t["a190"] = 970;
  36663. t["a191"] = 918;
  36664. });
  36665. });
  36666. exports.getMetrics = getMetrics;
  36667. /***/ }),
  36668. /* 39 */
  36669. /***/ (function(module, exports, __w_pdfjs_require__) {
  36670. "use strict";
  36671. Object.defineProperty(exports, "__esModule", {
  36672. value: true
  36673. });
  36674. exports.isPDFFunction = isPDFFunction;
  36675. exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0;
  36676. var _util = __w_pdfjs_require__(2);
  36677. var _primitives = __w_pdfjs_require__(4);
  36678. var _ps_parser = __w_pdfjs_require__(40);
  36679. class PDFFunctionFactory {
  36680. constructor({
  36681. xref,
  36682. isEvalSupported = true
  36683. }) {
  36684. this.xref = xref;
  36685. this.isEvalSupported = isEvalSupported !== false;
  36686. }
  36687. create(fn) {
  36688. return PDFFunction.parse({
  36689. xref: this.xref,
  36690. isEvalSupported: this.isEvalSupported,
  36691. fn
  36692. });
  36693. }
  36694. createFromArray(fnObj) {
  36695. return PDFFunction.parseArray({
  36696. xref: this.xref,
  36697. isEvalSupported: this.isEvalSupported,
  36698. fnObj
  36699. });
  36700. }
  36701. }
  36702. exports.PDFFunctionFactory = PDFFunctionFactory;
  36703. function toNumberArray(arr) {
  36704. if (!Array.isArray(arr)) {
  36705. return null;
  36706. }
  36707. const length = arr.length;
  36708. for (let i = 0; i < length; i++) {
  36709. if (typeof arr[i] !== "number") {
  36710. const result = new Array(length);
  36711. for (let i = 0; i < length; i++) {
  36712. result[i] = +arr[i];
  36713. }
  36714. return result;
  36715. }
  36716. }
  36717. return arr;
  36718. }
  36719. var PDFFunction = function PDFFunctionClosure() {
  36720. const CONSTRUCT_SAMPLED = 0;
  36721. const CONSTRUCT_INTERPOLATED = 2;
  36722. const CONSTRUCT_STICHED = 3;
  36723. const CONSTRUCT_POSTSCRIPT = 4;
  36724. return {
  36725. getSampleArray(size, outputSize, bps, stream) {
  36726. var i, ii;
  36727. var length = 1;
  36728. for (i = 0, ii = size.length; i < ii; i++) {
  36729. length *= size[i];
  36730. }
  36731. length *= outputSize;
  36732. var array = new Array(length);
  36733. var codeSize = 0;
  36734. var codeBuf = 0;
  36735. var sampleMul = 1.0 / (2.0 ** bps - 1);
  36736. var strBytes = stream.getBytes((length * bps + 7) / 8);
  36737. var strIdx = 0;
  36738. for (i = 0; i < length; i++) {
  36739. while (codeSize < bps) {
  36740. codeBuf <<= 8;
  36741. codeBuf |= strBytes[strIdx++];
  36742. codeSize += 8;
  36743. }
  36744. codeSize -= bps;
  36745. array[i] = (codeBuf >> codeSize) * sampleMul;
  36746. codeBuf &= (1 << codeSize) - 1;
  36747. }
  36748. return array;
  36749. },
  36750. getIR({
  36751. xref,
  36752. isEvalSupported,
  36753. fn
  36754. }) {
  36755. var dict = fn.dict;
  36756. if (!dict) {
  36757. dict = fn;
  36758. }
  36759. var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
  36760. var typeNum = dict.get("FunctionType");
  36761. var typeFn = types[typeNum];
  36762. if (!typeFn) {
  36763. throw new _util.FormatError("Unknown type of function");
  36764. }
  36765. return typeFn.call(this, {
  36766. xref,
  36767. isEvalSupported,
  36768. fn,
  36769. dict
  36770. });
  36771. },
  36772. fromIR({
  36773. xref,
  36774. isEvalSupported,
  36775. IR
  36776. }) {
  36777. var type = IR[0];
  36778. switch (type) {
  36779. case CONSTRUCT_SAMPLED:
  36780. return this.constructSampledFromIR({
  36781. xref,
  36782. isEvalSupported,
  36783. IR
  36784. });
  36785. case CONSTRUCT_INTERPOLATED:
  36786. return this.constructInterpolatedFromIR({
  36787. xref,
  36788. isEvalSupported,
  36789. IR
  36790. });
  36791. case CONSTRUCT_STICHED:
  36792. return this.constructStichedFromIR({
  36793. xref,
  36794. isEvalSupported,
  36795. IR
  36796. });
  36797. default:
  36798. return this.constructPostScriptFromIR({
  36799. xref,
  36800. isEvalSupported,
  36801. IR
  36802. });
  36803. }
  36804. },
  36805. parse({
  36806. xref,
  36807. isEvalSupported,
  36808. fn
  36809. }) {
  36810. const IR = this.getIR({
  36811. xref,
  36812. isEvalSupported,
  36813. fn
  36814. });
  36815. return this.fromIR({
  36816. xref,
  36817. isEvalSupported,
  36818. IR
  36819. });
  36820. },
  36821. parseArray({
  36822. xref,
  36823. isEvalSupported,
  36824. fnObj
  36825. }) {
  36826. if (!Array.isArray(fnObj)) {
  36827. return this.parse({
  36828. xref,
  36829. isEvalSupported,
  36830. fn: fnObj
  36831. });
  36832. }
  36833. var fnArray = [];
  36834. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  36835. fnArray.push(this.parse({
  36836. xref,
  36837. isEvalSupported,
  36838. fn: xref.fetchIfRef(fnObj[j])
  36839. }));
  36840. }
  36841. return function (src, srcOffset, dest, destOffset) {
  36842. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  36843. fnArray[i](src, srcOffset, dest, destOffset + i);
  36844. }
  36845. };
  36846. },
  36847. constructSampled({
  36848. xref,
  36849. isEvalSupported,
  36850. fn,
  36851. dict
  36852. }) {
  36853. function toMultiArray(arr) {
  36854. var inputLength = arr.length;
  36855. var out = [];
  36856. var index = 0;
  36857. for (var i = 0; i < inputLength; i += 2) {
  36858. out[index] = [arr[i], arr[i + 1]];
  36859. ++index;
  36860. }
  36861. return out;
  36862. }
  36863. var domain = toNumberArray(dict.getArray("Domain"));
  36864. var range = toNumberArray(dict.getArray("Range"));
  36865. if (!domain || !range) {
  36866. throw new _util.FormatError("No domain or range");
  36867. }
  36868. var inputSize = domain.length / 2;
  36869. var outputSize = range.length / 2;
  36870. domain = toMultiArray(domain);
  36871. range = toMultiArray(range);
  36872. var size = toNumberArray(dict.getArray("Size"));
  36873. var bps = dict.get("BitsPerSample");
  36874. var order = dict.get("Order") || 1;
  36875. if (order !== 1) {
  36876. (0, _util.info)("No support for cubic spline interpolation: " + order);
  36877. }
  36878. var encode = toNumberArray(dict.getArray("Encode"));
  36879. if (!encode) {
  36880. encode = [];
  36881. for (var i = 0; i < inputSize; ++i) {
  36882. encode.push([0, size[i] - 1]);
  36883. }
  36884. } else {
  36885. encode = toMultiArray(encode);
  36886. }
  36887. var decode = toNumberArray(dict.getArray("Decode"));
  36888. if (!decode) {
  36889. decode = range;
  36890. } else {
  36891. decode = toMultiArray(decode);
  36892. }
  36893. var samples = this.getSampleArray(size, outputSize, bps, fn);
  36894. return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
  36895. },
  36896. constructSampledFromIR({
  36897. xref,
  36898. isEvalSupported,
  36899. IR
  36900. }) {
  36901. function interpolate(x, xmin, xmax, ymin, ymax) {
  36902. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  36903. }
  36904. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  36905. var m = IR[1];
  36906. var domain = IR[2];
  36907. var encode = IR[3];
  36908. var decode = IR[4];
  36909. var samples = IR[5];
  36910. var size = IR[6];
  36911. var n = IR[7];
  36912. var range = IR[9];
  36913. var cubeVertices = 1 << m;
  36914. var cubeN = new Float64Array(cubeVertices);
  36915. var cubeVertex = new Uint32Array(cubeVertices);
  36916. var i, j;
  36917. for (j = 0; j < cubeVertices; j++) {
  36918. cubeN[j] = 1;
  36919. }
  36920. var k = n,
  36921. pos = 1;
  36922. for (i = 0; i < m; ++i) {
  36923. var domain_2i = domain[i][0];
  36924. var domain_2i_1 = domain[i][1];
  36925. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  36926. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  36927. var size_i = size[i];
  36928. e = Math.min(Math.max(e, 0), size_i - 1);
  36929. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  36930. var n0 = e0 + 1 - e;
  36931. var n1 = e - e0;
  36932. var offset0 = e0 * k;
  36933. var offset1 = offset0 + k;
  36934. for (j = 0; j < cubeVertices; j++) {
  36935. if (j & pos) {
  36936. cubeN[j] *= n1;
  36937. cubeVertex[j] += offset1;
  36938. } else {
  36939. cubeN[j] *= n0;
  36940. cubeVertex[j] += offset0;
  36941. }
  36942. }
  36943. k *= size_i;
  36944. pos <<= 1;
  36945. }
  36946. for (j = 0; j < n; ++j) {
  36947. var rj = 0;
  36948. for (i = 0; i < cubeVertices; i++) {
  36949. rj += samples[cubeVertex[i] + j] * cubeN[i];
  36950. }
  36951. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  36952. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  36953. }
  36954. };
  36955. },
  36956. constructInterpolated({
  36957. xref,
  36958. isEvalSupported,
  36959. fn,
  36960. dict
  36961. }) {
  36962. var c0 = toNumberArray(dict.getArray("C0")) || [0];
  36963. var c1 = toNumberArray(dict.getArray("C1")) || [1];
  36964. var n = dict.get("N");
  36965. var length = c0.length;
  36966. var diff = [];
  36967. for (var i = 0; i < length; ++i) {
  36968. diff.push(c1[i] - c0[i]);
  36969. }
  36970. return [CONSTRUCT_INTERPOLATED, c0, diff, n];
  36971. },
  36972. constructInterpolatedFromIR({
  36973. xref,
  36974. isEvalSupported,
  36975. IR
  36976. }) {
  36977. var c0 = IR[1];
  36978. var diff = IR[2];
  36979. var n = IR[3];
  36980. var length = diff.length;
  36981. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  36982. var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  36983. for (var j = 0; j < length; ++j) {
  36984. dest[destOffset + j] = c0[j] + x * diff[j];
  36985. }
  36986. };
  36987. },
  36988. constructStiched({
  36989. xref,
  36990. isEvalSupported,
  36991. fn,
  36992. dict
  36993. }) {
  36994. var domain = toNumberArray(dict.getArray("Domain"));
  36995. if (!domain) {
  36996. throw new _util.FormatError("No domain");
  36997. }
  36998. var inputSize = domain.length / 2;
  36999. if (inputSize !== 1) {
  37000. throw new _util.FormatError("Bad domain for stiched function");
  37001. }
  37002. var fnRefs = dict.get("Functions");
  37003. var fns = [];
  37004. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  37005. fns.push(this.parse({
  37006. xref,
  37007. isEvalSupported,
  37008. fn: xref.fetchIfRef(fnRefs[i])
  37009. }));
  37010. }
  37011. var bounds = toNumberArray(dict.getArray("Bounds"));
  37012. var encode = toNumberArray(dict.getArray("Encode"));
  37013. return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
  37014. },
  37015. constructStichedFromIR({
  37016. xref,
  37017. isEvalSupported,
  37018. IR
  37019. }) {
  37020. var domain = IR[1];
  37021. var bounds = IR[2];
  37022. var encode = IR[3];
  37023. var fns = IR[4];
  37024. var tmpBuf = new Float32Array(1);
  37025. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  37026. var clip = function constructStichedFromIRClip(v, min, max) {
  37027. if (v > max) {
  37028. v = max;
  37029. } else if (v < min) {
  37030. v = min;
  37031. }
  37032. return v;
  37033. };
  37034. var v = clip(src[srcOffset], domain[0], domain[1]);
  37035. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  37036. if (v < bounds[i]) {
  37037. break;
  37038. }
  37039. }
  37040. var dmin = domain[0];
  37041. if (i > 0) {
  37042. dmin = bounds[i - 1];
  37043. }
  37044. var dmax = domain[1];
  37045. if (i < bounds.length) {
  37046. dmax = bounds[i];
  37047. }
  37048. var rmin = encode[2 * i];
  37049. var rmax = encode[2 * i + 1];
  37050. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  37051. fns[i](tmpBuf, 0, dest, destOffset);
  37052. };
  37053. },
  37054. constructPostScript({
  37055. xref,
  37056. isEvalSupported,
  37057. fn,
  37058. dict
  37059. }) {
  37060. var domain = toNumberArray(dict.getArray("Domain"));
  37061. var range = toNumberArray(dict.getArray("Range"));
  37062. if (!domain) {
  37063. throw new _util.FormatError("No domain.");
  37064. }
  37065. if (!range) {
  37066. throw new _util.FormatError("No range.");
  37067. }
  37068. var lexer = new _ps_parser.PostScriptLexer(fn);
  37069. var parser = new _ps_parser.PostScriptParser(lexer);
  37070. var code = parser.parse();
  37071. return [CONSTRUCT_POSTSCRIPT, domain, range, code];
  37072. },
  37073. constructPostScriptFromIR({
  37074. xref,
  37075. isEvalSupported,
  37076. IR
  37077. }) {
  37078. var domain = IR[1];
  37079. var range = IR[2];
  37080. var code = IR[3];
  37081. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  37082. const compiled = new PostScriptCompiler().compile(code, domain, range);
  37083. if (compiled) {
  37084. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  37085. }
  37086. }
  37087. (0, _util.info)("Unable to compile PS function");
  37088. var numOutputs = range.length >> 1;
  37089. var numInputs = domain.length >> 1;
  37090. var evaluator = new PostScriptEvaluator(code);
  37091. var cache = Object.create(null);
  37092. var MAX_CACHE_SIZE = 2048 * 4;
  37093. var cache_available = MAX_CACHE_SIZE;
  37094. var tmpBuf = new Float32Array(numInputs);
  37095. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  37096. var i, value;
  37097. var key = "";
  37098. var input = tmpBuf;
  37099. for (i = 0; i < numInputs; i++) {
  37100. value = src[srcOffset + i];
  37101. input[i] = value;
  37102. key += value + "_";
  37103. }
  37104. var cachedValue = cache[key];
  37105. if (cachedValue !== undefined) {
  37106. dest.set(cachedValue, destOffset);
  37107. return;
  37108. }
  37109. var output = new Float32Array(numOutputs);
  37110. var stack = evaluator.execute(input);
  37111. var stackIndex = stack.length - numOutputs;
  37112. for (i = 0; i < numOutputs; i++) {
  37113. value = stack[stackIndex + i];
  37114. var bound = range[i * 2];
  37115. if (value < bound) {
  37116. value = bound;
  37117. } else {
  37118. bound = range[i * 2 + 1];
  37119. if (value > bound) {
  37120. value = bound;
  37121. }
  37122. }
  37123. output[i] = value;
  37124. }
  37125. if (cache_available > 0) {
  37126. cache_available--;
  37127. cache[key] = output;
  37128. }
  37129. dest.set(output, destOffset);
  37130. };
  37131. }
  37132. };
  37133. }();
  37134. function isPDFFunction(v) {
  37135. var fnDict;
  37136. if (typeof v !== "object") {
  37137. return false;
  37138. } else if ((0, _primitives.isDict)(v)) {
  37139. fnDict = v;
  37140. } else if ((0, _primitives.isStream)(v)) {
  37141. fnDict = v.dict;
  37142. } else {
  37143. return false;
  37144. }
  37145. return fnDict.has("FunctionType");
  37146. }
  37147. var PostScriptStack = function PostScriptStackClosure() {
  37148. var MAX_STACK_SIZE = 100;
  37149. function PostScriptStack(initialStack) {
  37150. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  37151. }
  37152. PostScriptStack.prototype = {
  37153. push: function PostScriptStack_push(value) {
  37154. if (this.stack.length >= MAX_STACK_SIZE) {
  37155. throw new Error("PostScript function stack overflow.");
  37156. }
  37157. this.stack.push(value);
  37158. },
  37159. pop: function PostScriptStack_pop() {
  37160. if (this.stack.length <= 0) {
  37161. throw new Error("PostScript function stack underflow.");
  37162. }
  37163. return this.stack.pop();
  37164. },
  37165. copy: function PostScriptStack_copy(n) {
  37166. if (this.stack.length + n >= MAX_STACK_SIZE) {
  37167. throw new Error("PostScript function stack overflow.");
  37168. }
  37169. var stack = this.stack;
  37170. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  37171. stack.push(stack[i]);
  37172. }
  37173. },
  37174. index: function PostScriptStack_index(n) {
  37175. this.push(this.stack[this.stack.length - n - 1]);
  37176. },
  37177. roll: function PostScriptStack_roll(n, p) {
  37178. var stack = this.stack;
  37179. var l = stack.length - n;
  37180. var r = stack.length - 1,
  37181. c = l + (p - Math.floor(p / n) * n),
  37182. i,
  37183. j,
  37184. t;
  37185. for (i = l, j = r; i < j; i++, j--) {
  37186. t = stack[i];
  37187. stack[i] = stack[j];
  37188. stack[j] = t;
  37189. }
  37190. for (i = l, j = c - 1; i < j; i++, j--) {
  37191. t = stack[i];
  37192. stack[i] = stack[j];
  37193. stack[j] = t;
  37194. }
  37195. for (i = c, j = r; i < j; i++, j--) {
  37196. t = stack[i];
  37197. stack[i] = stack[j];
  37198. stack[j] = t;
  37199. }
  37200. }
  37201. };
  37202. return PostScriptStack;
  37203. }();
  37204. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  37205. function PostScriptEvaluator(operators) {
  37206. this.operators = operators;
  37207. }
  37208. PostScriptEvaluator.prototype = {
  37209. execute: function PostScriptEvaluator_execute(initialStack) {
  37210. var stack = new PostScriptStack(initialStack);
  37211. var counter = 0;
  37212. var operators = this.operators;
  37213. var length = operators.length;
  37214. var operator, a, b;
  37215. while (counter < length) {
  37216. operator = operators[counter++];
  37217. if (typeof operator === "number") {
  37218. stack.push(operator);
  37219. continue;
  37220. }
  37221. switch (operator) {
  37222. case "jz":
  37223. b = stack.pop();
  37224. a = stack.pop();
  37225. if (!a) {
  37226. counter = b;
  37227. }
  37228. break;
  37229. case "j":
  37230. a = stack.pop();
  37231. counter = a;
  37232. break;
  37233. case "abs":
  37234. a = stack.pop();
  37235. stack.push(Math.abs(a));
  37236. break;
  37237. case "add":
  37238. b = stack.pop();
  37239. a = stack.pop();
  37240. stack.push(a + b);
  37241. break;
  37242. case "and":
  37243. b = stack.pop();
  37244. a = stack.pop();
  37245. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  37246. stack.push(a && b);
  37247. } else {
  37248. stack.push(a & b);
  37249. }
  37250. break;
  37251. case "atan":
  37252. a = stack.pop();
  37253. stack.push(Math.atan(a));
  37254. break;
  37255. case "bitshift":
  37256. b = stack.pop();
  37257. a = stack.pop();
  37258. if (a > 0) {
  37259. stack.push(a << b);
  37260. } else {
  37261. stack.push(a >> b);
  37262. }
  37263. break;
  37264. case "ceiling":
  37265. a = stack.pop();
  37266. stack.push(Math.ceil(a));
  37267. break;
  37268. case "copy":
  37269. a = stack.pop();
  37270. stack.copy(a);
  37271. break;
  37272. case "cos":
  37273. a = stack.pop();
  37274. stack.push(Math.cos(a));
  37275. break;
  37276. case "cvi":
  37277. a = stack.pop() | 0;
  37278. stack.push(a);
  37279. break;
  37280. case "cvr":
  37281. break;
  37282. case "div":
  37283. b = stack.pop();
  37284. a = stack.pop();
  37285. stack.push(a / b);
  37286. break;
  37287. case "dup":
  37288. stack.copy(1);
  37289. break;
  37290. case "eq":
  37291. b = stack.pop();
  37292. a = stack.pop();
  37293. stack.push(a === b);
  37294. break;
  37295. case "exch":
  37296. stack.roll(2, 1);
  37297. break;
  37298. case "exp":
  37299. b = stack.pop();
  37300. a = stack.pop();
  37301. stack.push(a ** b);
  37302. break;
  37303. case "false":
  37304. stack.push(false);
  37305. break;
  37306. case "floor":
  37307. a = stack.pop();
  37308. stack.push(Math.floor(a));
  37309. break;
  37310. case "ge":
  37311. b = stack.pop();
  37312. a = stack.pop();
  37313. stack.push(a >= b);
  37314. break;
  37315. case "gt":
  37316. b = stack.pop();
  37317. a = stack.pop();
  37318. stack.push(a > b);
  37319. break;
  37320. case "idiv":
  37321. b = stack.pop();
  37322. a = stack.pop();
  37323. stack.push(a / b | 0);
  37324. break;
  37325. case "index":
  37326. a = stack.pop();
  37327. stack.index(a);
  37328. break;
  37329. case "le":
  37330. b = stack.pop();
  37331. a = stack.pop();
  37332. stack.push(a <= b);
  37333. break;
  37334. case "ln":
  37335. a = stack.pop();
  37336. stack.push(Math.log(a));
  37337. break;
  37338. case "log":
  37339. a = stack.pop();
  37340. stack.push(Math.log(a) / Math.LN10);
  37341. break;
  37342. case "lt":
  37343. b = stack.pop();
  37344. a = stack.pop();
  37345. stack.push(a < b);
  37346. break;
  37347. case "mod":
  37348. b = stack.pop();
  37349. a = stack.pop();
  37350. stack.push(a % b);
  37351. break;
  37352. case "mul":
  37353. b = stack.pop();
  37354. a = stack.pop();
  37355. stack.push(a * b);
  37356. break;
  37357. case "ne":
  37358. b = stack.pop();
  37359. a = stack.pop();
  37360. stack.push(a !== b);
  37361. break;
  37362. case "neg":
  37363. a = stack.pop();
  37364. stack.push(-a);
  37365. break;
  37366. case "not":
  37367. a = stack.pop();
  37368. if ((0, _util.isBool)(a)) {
  37369. stack.push(!a);
  37370. } else {
  37371. stack.push(~a);
  37372. }
  37373. break;
  37374. case "or":
  37375. b = stack.pop();
  37376. a = stack.pop();
  37377. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  37378. stack.push(a || b);
  37379. } else {
  37380. stack.push(a | b);
  37381. }
  37382. break;
  37383. case "pop":
  37384. stack.pop();
  37385. break;
  37386. case "roll":
  37387. b = stack.pop();
  37388. a = stack.pop();
  37389. stack.roll(a, b);
  37390. break;
  37391. case "round":
  37392. a = stack.pop();
  37393. stack.push(Math.round(a));
  37394. break;
  37395. case "sin":
  37396. a = stack.pop();
  37397. stack.push(Math.sin(a));
  37398. break;
  37399. case "sqrt":
  37400. a = stack.pop();
  37401. stack.push(Math.sqrt(a));
  37402. break;
  37403. case "sub":
  37404. b = stack.pop();
  37405. a = stack.pop();
  37406. stack.push(a - b);
  37407. break;
  37408. case "true":
  37409. stack.push(true);
  37410. break;
  37411. case "truncate":
  37412. a = stack.pop();
  37413. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  37414. stack.push(a);
  37415. break;
  37416. case "xor":
  37417. b = stack.pop();
  37418. a = stack.pop();
  37419. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  37420. stack.push(a !== b);
  37421. } else {
  37422. stack.push(a ^ b);
  37423. }
  37424. break;
  37425. default:
  37426. throw new _util.FormatError(`Unknown operator ${operator}`);
  37427. }
  37428. }
  37429. return stack.stack;
  37430. }
  37431. };
  37432. return PostScriptEvaluator;
  37433. }();
  37434. exports.PostScriptEvaluator = PostScriptEvaluator;
  37435. var PostScriptCompiler = function PostScriptCompilerClosure() {
  37436. function AstNode(type) {
  37437. this.type = type;
  37438. }
  37439. AstNode.prototype.visit = function (visitor) {
  37440. (0, _util.unreachable)("abstract method");
  37441. };
  37442. function AstArgument(index, min, max) {
  37443. AstNode.call(this, "args");
  37444. this.index = index;
  37445. this.min = min;
  37446. this.max = max;
  37447. }
  37448. AstArgument.prototype = Object.create(AstNode.prototype);
  37449. AstArgument.prototype.visit = function (visitor) {
  37450. visitor.visitArgument(this);
  37451. };
  37452. function AstLiteral(number) {
  37453. AstNode.call(this, "literal");
  37454. this.number = number;
  37455. this.min = number;
  37456. this.max = number;
  37457. }
  37458. AstLiteral.prototype = Object.create(AstNode.prototype);
  37459. AstLiteral.prototype.visit = function (visitor) {
  37460. visitor.visitLiteral(this);
  37461. };
  37462. function AstBinaryOperation(op, arg1, arg2, min, max) {
  37463. AstNode.call(this, "binary");
  37464. this.op = op;
  37465. this.arg1 = arg1;
  37466. this.arg2 = arg2;
  37467. this.min = min;
  37468. this.max = max;
  37469. }
  37470. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  37471. AstBinaryOperation.prototype.visit = function (visitor) {
  37472. visitor.visitBinaryOperation(this);
  37473. };
  37474. function AstMin(arg, max) {
  37475. AstNode.call(this, "max");
  37476. this.arg = arg;
  37477. this.min = arg.min;
  37478. this.max = max;
  37479. }
  37480. AstMin.prototype = Object.create(AstNode.prototype);
  37481. AstMin.prototype.visit = function (visitor) {
  37482. visitor.visitMin(this);
  37483. };
  37484. function AstVariable(index, min, max) {
  37485. AstNode.call(this, "var");
  37486. this.index = index;
  37487. this.min = min;
  37488. this.max = max;
  37489. }
  37490. AstVariable.prototype = Object.create(AstNode.prototype);
  37491. AstVariable.prototype.visit = function (visitor) {
  37492. visitor.visitVariable(this);
  37493. };
  37494. function AstVariableDefinition(variable, arg) {
  37495. AstNode.call(this, "definition");
  37496. this.variable = variable;
  37497. this.arg = arg;
  37498. }
  37499. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  37500. AstVariableDefinition.prototype.visit = function (visitor) {
  37501. visitor.visitVariableDefinition(this);
  37502. };
  37503. function ExpressionBuilderVisitor() {
  37504. this.parts = [];
  37505. }
  37506. ExpressionBuilderVisitor.prototype = {
  37507. visitArgument(arg) {
  37508. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  37509. },
  37510. visitVariable(variable) {
  37511. this.parts.push("v", variable.index);
  37512. },
  37513. visitLiteral(literal) {
  37514. this.parts.push(literal.number);
  37515. },
  37516. visitBinaryOperation(operation) {
  37517. this.parts.push("(");
  37518. operation.arg1.visit(this);
  37519. this.parts.push(" ", operation.op, " ");
  37520. operation.arg2.visit(this);
  37521. this.parts.push(")");
  37522. },
  37523. visitVariableDefinition(definition) {
  37524. this.parts.push("var ");
  37525. definition.variable.visit(this);
  37526. this.parts.push(" = ");
  37527. definition.arg.visit(this);
  37528. this.parts.push(";");
  37529. },
  37530. visitMin(max) {
  37531. this.parts.push("Math.min(");
  37532. max.arg.visit(this);
  37533. this.parts.push(", ", max.max, ")");
  37534. },
  37535. toString() {
  37536. return this.parts.join("");
  37537. }
  37538. };
  37539. function buildAddOperation(num1, num2) {
  37540. if (num2.type === "literal" && num2.number === 0) {
  37541. return num1;
  37542. }
  37543. if (num1.type === "literal" && num1.number === 0) {
  37544. return num2;
  37545. }
  37546. if (num2.type === "literal" && num1.type === "literal") {
  37547. return new AstLiteral(num1.number + num2.number);
  37548. }
  37549. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  37550. }
  37551. function buildMulOperation(num1, num2) {
  37552. if (num2.type === "literal") {
  37553. if (num2.number === 0) {
  37554. return new AstLiteral(0);
  37555. } else if (num2.number === 1) {
  37556. return num1;
  37557. } else if (num1.type === "literal") {
  37558. return new AstLiteral(num1.number * num2.number);
  37559. }
  37560. }
  37561. if (num1.type === "literal") {
  37562. if (num1.number === 0) {
  37563. return new AstLiteral(0);
  37564. } else if (num1.number === 1) {
  37565. return num2;
  37566. }
  37567. }
  37568. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  37569. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  37570. return new AstBinaryOperation("*", num1, num2, min, max);
  37571. }
  37572. function buildSubOperation(num1, num2) {
  37573. if (num2.type === "literal") {
  37574. if (num2.number === 0) {
  37575. return num1;
  37576. } else if (num1.type === "literal") {
  37577. return new AstLiteral(num1.number - num2.number);
  37578. }
  37579. }
  37580. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  37581. return num2.arg2;
  37582. }
  37583. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  37584. }
  37585. function buildMinOperation(num1, max) {
  37586. if (num1.min >= max) {
  37587. return new AstLiteral(max);
  37588. } else if (num1.max <= max) {
  37589. return num1;
  37590. }
  37591. return new AstMin(num1, max);
  37592. }
  37593. function PostScriptCompiler() {}
  37594. PostScriptCompiler.prototype = {
  37595. compile: function PostScriptCompiler_compile(code, domain, range) {
  37596. var stack = [];
  37597. var i, ii;
  37598. var instructions = [];
  37599. var inputSize = domain.length >> 1,
  37600. outputSize = range.length >> 1;
  37601. var lastRegister = 0;
  37602. var n, j;
  37603. var num1, num2, ast1, ast2, tmpVar, item;
  37604. for (i = 0; i < inputSize; i++) {
  37605. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  37606. }
  37607. for (i = 0, ii = code.length; i < ii; i++) {
  37608. item = code[i];
  37609. if (typeof item === "number") {
  37610. stack.push(new AstLiteral(item));
  37611. continue;
  37612. }
  37613. switch (item) {
  37614. case "add":
  37615. if (stack.length < 2) {
  37616. return null;
  37617. }
  37618. num2 = stack.pop();
  37619. num1 = stack.pop();
  37620. stack.push(buildAddOperation(num1, num2));
  37621. break;
  37622. case "cvr":
  37623. if (stack.length < 1) {
  37624. return null;
  37625. }
  37626. break;
  37627. case "mul":
  37628. if (stack.length < 2) {
  37629. return null;
  37630. }
  37631. num2 = stack.pop();
  37632. num1 = stack.pop();
  37633. stack.push(buildMulOperation(num1, num2));
  37634. break;
  37635. case "sub":
  37636. if (stack.length < 2) {
  37637. return null;
  37638. }
  37639. num2 = stack.pop();
  37640. num1 = stack.pop();
  37641. stack.push(buildSubOperation(num1, num2));
  37642. break;
  37643. case "exch":
  37644. if (stack.length < 2) {
  37645. return null;
  37646. }
  37647. ast1 = stack.pop();
  37648. ast2 = stack.pop();
  37649. stack.push(ast1, ast2);
  37650. break;
  37651. case "pop":
  37652. if (stack.length < 1) {
  37653. return null;
  37654. }
  37655. stack.pop();
  37656. break;
  37657. case "index":
  37658. if (stack.length < 1) {
  37659. return null;
  37660. }
  37661. num1 = stack.pop();
  37662. if (num1.type !== "literal") {
  37663. return null;
  37664. }
  37665. n = num1.number;
  37666. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  37667. return null;
  37668. }
  37669. ast1 = stack[stack.length - n - 1];
  37670. if (ast1.type === "literal" || ast1.type === "var") {
  37671. stack.push(ast1);
  37672. break;
  37673. }
  37674. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  37675. stack[stack.length - n - 1] = tmpVar;
  37676. stack.push(tmpVar);
  37677. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  37678. break;
  37679. case "dup":
  37680. if (stack.length < 1) {
  37681. return null;
  37682. }
  37683. if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
  37684. num1 = stack.pop();
  37685. stack.push(buildMinOperation(num1, code[i + 1]));
  37686. i += 6;
  37687. break;
  37688. }
  37689. ast1 = stack[stack.length - 1];
  37690. if (ast1.type === "literal" || ast1.type === "var") {
  37691. stack.push(ast1);
  37692. break;
  37693. }
  37694. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  37695. stack[stack.length - 1] = tmpVar;
  37696. stack.push(tmpVar);
  37697. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  37698. break;
  37699. case "roll":
  37700. if (stack.length < 2) {
  37701. return null;
  37702. }
  37703. num2 = stack.pop();
  37704. num1 = stack.pop();
  37705. if (num2.type !== "literal" || num1.type !== "literal") {
  37706. return null;
  37707. }
  37708. j = num2.number;
  37709. n = num1.number;
  37710. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  37711. return null;
  37712. }
  37713. j = (j % n + n) % n;
  37714. if (j === 0) {
  37715. break;
  37716. }
  37717. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  37718. break;
  37719. default:
  37720. return null;
  37721. }
  37722. }
  37723. if (stack.length !== outputSize) {
  37724. return null;
  37725. }
  37726. var result = [];
  37727. instructions.forEach(function (instruction) {
  37728. var statementBuilder = new ExpressionBuilderVisitor();
  37729. instruction.visit(statementBuilder);
  37730. result.push(statementBuilder.toString());
  37731. });
  37732. stack.forEach(function (expr, i) {
  37733. var statementBuilder = new ExpressionBuilderVisitor();
  37734. expr.visit(statementBuilder);
  37735. var min = range[i * 2],
  37736. max = range[i * 2 + 1];
  37737. var out = [statementBuilder.toString()];
  37738. if (min > expr.min) {
  37739. out.unshift("Math.max(", min, ", ");
  37740. out.push(")");
  37741. }
  37742. if (max < expr.max) {
  37743. out.unshift("Math.min(", max, ", ");
  37744. out.push(")");
  37745. }
  37746. out.unshift("dest[destOffset + ", i, "] = ");
  37747. out.push(";");
  37748. result.push(out.join(""));
  37749. });
  37750. return result.join("\n");
  37751. }
  37752. };
  37753. return PostScriptCompiler;
  37754. }();
  37755. exports.PostScriptCompiler = PostScriptCompiler;
  37756. /***/ }),
  37757. /* 40 */
  37758. /***/ (function(module, exports, __w_pdfjs_require__) {
  37759. "use strict";
  37760. Object.defineProperty(exports, "__esModule", {
  37761. value: true
  37762. });
  37763. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  37764. var _util = __w_pdfjs_require__(2);
  37765. var _primitives = __w_pdfjs_require__(4);
  37766. var _core_utils = __w_pdfjs_require__(7);
  37767. class PostScriptParser {
  37768. constructor(lexer) {
  37769. this.lexer = lexer;
  37770. this.operators = [];
  37771. this.token = null;
  37772. this.prev = null;
  37773. }
  37774. nextToken() {
  37775. this.prev = this.token;
  37776. this.token = this.lexer.getToken();
  37777. }
  37778. accept(type) {
  37779. if (this.token.type === type) {
  37780. this.nextToken();
  37781. return true;
  37782. }
  37783. return false;
  37784. }
  37785. expect(type) {
  37786. if (this.accept(type)) {
  37787. return true;
  37788. }
  37789. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  37790. }
  37791. parse() {
  37792. this.nextToken();
  37793. this.expect(PostScriptTokenTypes.LBRACE);
  37794. this.parseBlock();
  37795. this.expect(PostScriptTokenTypes.RBRACE);
  37796. return this.operators;
  37797. }
  37798. parseBlock() {
  37799. while (true) {
  37800. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  37801. this.operators.push(this.prev.value);
  37802. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  37803. this.operators.push(this.prev.value);
  37804. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  37805. this.parseCondition();
  37806. } else {
  37807. return;
  37808. }
  37809. }
  37810. }
  37811. parseCondition() {
  37812. const conditionLocation = this.operators.length;
  37813. this.operators.push(null, null);
  37814. this.parseBlock();
  37815. this.expect(PostScriptTokenTypes.RBRACE);
  37816. if (this.accept(PostScriptTokenTypes.IF)) {
  37817. this.operators[conditionLocation] = this.operators.length;
  37818. this.operators[conditionLocation + 1] = "jz";
  37819. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  37820. const jumpLocation = this.operators.length;
  37821. this.operators.push(null, null);
  37822. const endOfTrue = this.operators.length;
  37823. this.parseBlock();
  37824. this.expect(PostScriptTokenTypes.RBRACE);
  37825. this.expect(PostScriptTokenTypes.IFELSE);
  37826. this.operators[jumpLocation] = this.operators.length;
  37827. this.operators[jumpLocation + 1] = "j";
  37828. this.operators[conditionLocation] = endOfTrue;
  37829. this.operators[conditionLocation + 1] = "jz";
  37830. } else {
  37831. throw new _util.FormatError("PS Function: error parsing conditional.");
  37832. }
  37833. }
  37834. }
  37835. exports.PostScriptParser = PostScriptParser;
  37836. const PostScriptTokenTypes = {
  37837. LBRACE: 0,
  37838. RBRACE: 1,
  37839. NUMBER: 2,
  37840. OPERATOR: 3,
  37841. IF: 4,
  37842. IFELSE: 5
  37843. };
  37844. const PostScriptToken = function PostScriptTokenClosure() {
  37845. const opCache = Object.create(null);
  37846. class PostScriptToken {
  37847. constructor(type, value) {
  37848. this.type = type;
  37849. this.value = value;
  37850. }
  37851. static getOperator(op) {
  37852. const opValue = opCache[op];
  37853. if (opValue) {
  37854. return opValue;
  37855. }
  37856. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  37857. }
  37858. static get LBRACE() {
  37859. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  37860. }
  37861. static get RBRACE() {
  37862. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  37863. }
  37864. static get IF() {
  37865. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  37866. }
  37867. static get IFELSE() {
  37868. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  37869. }
  37870. }
  37871. return PostScriptToken;
  37872. }();
  37873. class PostScriptLexer {
  37874. constructor(stream) {
  37875. this.stream = stream;
  37876. this.nextChar();
  37877. this.strBuf = [];
  37878. }
  37879. nextChar() {
  37880. return this.currentChar = this.stream.getByte();
  37881. }
  37882. getToken() {
  37883. let comment = false;
  37884. let ch = this.currentChar;
  37885. while (true) {
  37886. if (ch < 0) {
  37887. return _primitives.EOF;
  37888. }
  37889. if (comment) {
  37890. if (ch === 0x0a || ch === 0x0d) {
  37891. comment = false;
  37892. }
  37893. } else if (ch === 0x25) {
  37894. comment = true;
  37895. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  37896. break;
  37897. }
  37898. ch = this.nextChar();
  37899. }
  37900. switch (ch | 0) {
  37901. case 0x30:
  37902. case 0x31:
  37903. case 0x32:
  37904. case 0x33:
  37905. case 0x34:
  37906. case 0x35:
  37907. case 0x36:
  37908. case 0x37:
  37909. case 0x38:
  37910. case 0x39:
  37911. case 0x2b:
  37912. case 0x2d:
  37913. case 0x2e:
  37914. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  37915. case 0x7b:
  37916. this.nextChar();
  37917. return PostScriptToken.LBRACE;
  37918. case 0x7d:
  37919. this.nextChar();
  37920. return PostScriptToken.RBRACE;
  37921. }
  37922. const strBuf = this.strBuf;
  37923. strBuf.length = 0;
  37924. strBuf[0] = String.fromCharCode(ch);
  37925. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  37926. strBuf.push(String.fromCharCode(ch));
  37927. }
  37928. const str = strBuf.join("");
  37929. switch (str.toLowerCase()) {
  37930. case "if":
  37931. return PostScriptToken.IF;
  37932. case "ifelse":
  37933. return PostScriptToken.IFELSE;
  37934. default:
  37935. return PostScriptToken.getOperator(str);
  37936. }
  37937. }
  37938. getNumber() {
  37939. let ch = this.currentChar;
  37940. const strBuf = this.strBuf;
  37941. strBuf.length = 0;
  37942. strBuf[0] = String.fromCharCode(ch);
  37943. while ((ch = this.nextChar()) >= 0) {
  37944. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  37945. strBuf.push(String.fromCharCode(ch));
  37946. } else {
  37947. break;
  37948. }
  37949. }
  37950. const value = parseFloat(strBuf.join(""));
  37951. if (isNaN(value)) {
  37952. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  37953. }
  37954. return value;
  37955. }
  37956. }
  37957. exports.PostScriptLexer = PostScriptLexer;
  37958. /***/ }),
  37959. /* 41 */
  37960. /***/ (function(module, exports, __w_pdfjs_require__) {
  37961. "use strict";
  37962. Object.defineProperty(exports, "__esModule", {
  37963. value: true
  37964. });
  37965. exports.MurmurHash3_64 = void 0;
  37966. var _util = __w_pdfjs_require__(2);
  37967. const SEED = 0xc3d2e1f0;
  37968. const MASK_HIGH = 0xffff0000;
  37969. const MASK_LOW = 0xffff;
  37970. class MurmurHash3_64 {
  37971. constructor(seed) {
  37972. this.h1 = seed ? seed & 0xffffffff : SEED;
  37973. this.h2 = seed ? seed & 0xffffffff : SEED;
  37974. }
  37975. update(input) {
  37976. let data, length;
  37977. if ((0, _util.isString)(input)) {
  37978. data = new Uint8Array(input.length * 2);
  37979. length = 0;
  37980. for (let i = 0, ii = input.length; i < ii; i++) {
  37981. const code = input.charCodeAt(i);
  37982. if (code <= 0xff) {
  37983. data[length++] = code;
  37984. } else {
  37985. data[length++] = code >>> 8;
  37986. data[length++] = code & 0xff;
  37987. }
  37988. }
  37989. } else if ((0, _util.isArrayBuffer)(input)) {
  37990. data = input;
  37991. length = data.byteLength;
  37992. } else {
  37993. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  37994. }
  37995. const blockCounts = length >> 2;
  37996. const tailLength = length - blockCounts * 4;
  37997. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  37998. let k1 = 0,
  37999. k2 = 0;
  38000. let h1 = this.h1,
  38001. h2 = this.h2;
  38002. const C1 = 0xcc9e2d51,
  38003. C2 = 0x1b873593;
  38004. const C1_LOW = C1 & MASK_LOW,
  38005. C2_LOW = C2 & MASK_LOW;
  38006. for (let i = 0; i < blockCounts; i++) {
  38007. if (i & 1) {
  38008. k1 = dataUint32[i];
  38009. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  38010. k1 = k1 << 15 | k1 >>> 17;
  38011. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  38012. h1 ^= k1;
  38013. h1 = h1 << 13 | h1 >>> 19;
  38014. h1 = h1 * 5 + 0xe6546b64;
  38015. } else {
  38016. k2 = dataUint32[i];
  38017. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  38018. k2 = k2 << 15 | k2 >>> 17;
  38019. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  38020. h2 ^= k2;
  38021. h2 = h2 << 13 | h2 >>> 19;
  38022. h2 = h2 * 5 + 0xe6546b64;
  38023. }
  38024. }
  38025. k1 = 0;
  38026. switch (tailLength) {
  38027. case 3:
  38028. k1 ^= data[blockCounts * 4 + 2] << 16;
  38029. case 2:
  38030. k1 ^= data[blockCounts * 4 + 1] << 8;
  38031. case 1:
  38032. k1 ^= data[blockCounts * 4];
  38033. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  38034. k1 = k1 << 15 | k1 >>> 17;
  38035. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  38036. if (blockCounts & 1) {
  38037. h1 ^= k1;
  38038. } else {
  38039. h2 ^= k1;
  38040. }
  38041. }
  38042. this.h1 = h1;
  38043. this.h2 = h2;
  38044. }
  38045. hexdigest() {
  38046. let h1 = this.h1,
  38047. h2 = this.h2;
  38048. h1 ^= h2 >>> 1;
  38049. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  38050. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  38051. h1 ^= h2 >>> 1;
  38052. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  38053. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  38054. h1 ^= h2 >>> 1;
  38055. const hex1 = (h1 >>> 0).toString(16),
  38056. hex2 = (h2 >>> 0).toString(16);
  38057. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  38058. }
  38059. }
  38060. exports.MurmurHash3_64 = MurmurHash3_64;
  38061. /***/ }),
  38062. /* 42 */
  38063. /***/ (function(module, exports, __w_pdfjs_require__) {
  38064. "use strict";
  38065. Object.defineProperty(exports, "__esModule", {
  38066. value: true
  38067. });
  38068. exports.NativeImageDecoder = void 0;
  38069. var _colorspace = __w_pdfjs_require__(22);
  38070. var _jpeg_stream = __w_pdfjs_require__(17);
  38071. var _stream = __w_pdfjs_require__(11);
  38072. class NativeImageDecoder {
  38073. constructor({
  38074. xref,
  38075. resources,
  38076. handler,
  38077. forceDataSchema = false,
  38078. pdfFunctionFactory
  38079. }) {
  38080. this.xref = xref;
  38081. this.resources = resources;
  38082. this.handler = handler;
  38083. this.forceDataSchema = forceDataSchema;
  38084. this.pdfFunctionFactory = pdfFunctionFactory;
  38085. }
  38086. canDecode(image) {
  38087. return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory) && image.maybeValidDimensions;
  38088. }
  38089. decode(image) {
  38090. const dict = image.dict;
  38091. let colorSpace = dict.get("ColorSpace", "CS");
  38092. colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory);
  38093. return this.handler.sendWithPromise("JpegDecode", [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function ({
  38094. data,
  38095. width,
  38096. height
  38097. }) {
  38098. return new _stream.Stream(data, 0, data.length, dict);
  38099. });
  38100. }
  38101. static isSupported(image, xref, res, pdfFunctionFactory) {
  38102. const dict = image.dict;
  38103. if (dict.has("DecodeParms") || dict.has("DP")) {
  38104. return false;
  38105. }
  38106. const cs = _colorspace.ColorSpace.parse(dict.get("ColorSpace", "CS"), xref, res, pdfFunctionFactory);
  38107. return (cs.name === "DeviceGray" || cs.name === "DeviceRGB") && cs.isDefaultDecode(dict.getArray("Decode", "D"));
  38108. }
  38109. static isDecodable(image, xref, res, pdfFunctionFactory) {
  38110. const dict = image.dict;
  38111. if (dict.has("DecodeParms") || dict.has("DP")) {
  38112. return false;
  38113. }
  38114. const cs = _colorspace.ColorSpace.parse(dict.get("ColorSpace", "CS"), xref, res, pdfFunctionFactory);
  38115. const bpc = dict.get("BitsPerComponent", "BPC") || 1;
  38116. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray("Decode", "D"), bpc);
  38117. }
  38118. }
  38119. exports.NativeImageDecoder = NativeImageDecoder;
  38120. /***/ }),
  38121. /* 43 */
  38122. /***/ (function(module, exports, __w_pdfjs_require__) {
  38123. "use strict";
  38124. Object.defineProperty(exports, "__esModule", {
  38125. value: true
  38126. });
  38127. exports.PDFImage = void 0;
  38128. var _util = __w_pdfjs_require__(2);
  38129. var _primitives = __w_pdfjs_require__(4);
  38130. var _colorspace = __w_pdfjs_require__(22);
  38131. var _stream = __w_pdfjs_require__(11);
  38132. var _jpeg_stream = __w_pdfjs_require__(17);
  38133. var _jpx = __w_pdfjs_require__(20);
  38134. var PDFImage = function PDFImageClosure() {
  38135. function handleImageData(image, nativeDecoder) {
  38136. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  38137. return nativeDecoder.decode(image).catch(reason => {
  38138. (0, _util.warn)("Native image decoding failed -- trying to recover: " + (reason && reason.message));
  38139. return image;
  38140. });
  38141. }
  38142. return Promise.resolve(image);
  38143. }
  38144. function decodeAndClamp(value, addend, coefficient, max) {
  38145. value = addend + value * coefficient;
  38146. if (value < 0) {
  38147. value = 0;
  38148. } else if (value > max) {
  38149. value = max;
  38150. }
  38151. return value;
  38152. }
  38153. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  38154. var length = w2 * h2;
  38155. let dest;
  38156. if (bpc <= 8) {
  38157. dest = new Uint8Array(length);
  38158. } else if (bpc <= 16) {
  38159. dest = new Uint16Array(length);
  38160. } else {
  38161. dest = new Uint32Array(length);
  38162. }
  38163. var xRatio = w1 / w2;
  38164. var yRatio = h1 / h2;
  38165. var i,
  38166. j,
  38167. py,
  38168. newIndex = 0,
  38169. oldIndex;
  38170. var xScaled = new Uint16Array(w2);
  38171. var w1Scanline = w1;
  38172. for (i = 0; i < w2; i++) {
  38173. xScaled[i] = Math.floor(i * xRatio);
  38174. }
  38175. for (i = 0; i < h2; i++) {
  38176. py = Math.floor(i * yRatio) * w1Scanline;
  38177. for (j = 0; j < w2; j++) {
  38178. oldIndex = py + xScaled[j];
  38179. dest[newIndex++] = src[oldIndex];
  38180. }
  38181. }
  38182. return dest;
  38183. }
  38184. function PDFImage({
  38185. xref,
  38186. res,
  38187. image,
  38188. isInline = false,
  38189. smask = null,
  38190. mask = null,
  38191. isMask = false,
  38192. pdfFunctionFactory
  38193. }) {
  38194. this.image = image;
  38195. var dict = image.dict;
  38196. const filter = dict.get("Filter");
  38197. if ((0, _primitives.isName)(filter)) {
  38198. switch (filter.name) {
  38199. case "JPXDecode":
  38200. var jpxImage = new _jpx.JpxImage();
  38201. jpxImage.parseImageProperties(image.stream);
  38202. image.stream.reset();
  38203. image.width = jpxImage.width;
  38204. image.height = jpxImage.height;
  38205. image.bitsPerComponent = jpxImage.bitsPerComponent;
  38206. image.numComps = jpxImage.componentsCount;
  38207. break;
  38208. case "JBIG2Decode":
  38209. image.bitsPerComponent = 1;
  38210. image.numComps = 1;
  38211. break;
  38212. }
  38213. }
  38214. let width = dict.get("Width", "W");
  38215. let height = dict.get("Height", "H");
  38216. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  38217. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  38218. width = image.width;
  38219. height = image.height;
  38220. }
  38221. if (width < 1 || height < 1) {
  38222. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  38223. }
  38224. this.width = width;
  38225. this.height = height;
  38226. this.interpolate = dict.get("Interpolate", "I") || false;
  38227. this.imageMask = dict.get("ImageMask", "IM") || false;
  38228. this.matte = dict.get("Matte") || false;
  38229. var bitsPerComponent = image.bitsPerComponent;
  38230. if (!bitsPerComponent) {
  38231. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  38232. if (!bitsPerComponent) {
  38233. if (this.imageMask) {
  38234. bitsPerComponent = 1;
  38235. } else {
  38236. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  38237. }
  38238. }
  38239. }
  38240. this.bpc = bitsPerComponent;
  38241. if (!this.imageMask) {
  38242. var colorSpace = dict.get("ColorSpace", "CS");
  38243. if (!colorSpace) {
  38244. (0, _util.info)("JPX images (which do not require color spaces)");
  38245. switch (image.numComps) {
  38246. case 1:
  38247. colorSpace = _primitives.Name.get("DeviceGray");
  38248. break;
  38249. case 3:
  38250. colorSpace = _primitives.Name.get("DeviceRGB");
  38251. break;
  38252. case 4:
  38253. colorSpace = _primitives.Name.get("DeviceCMYK");
  38254. break;
  38255. default:
  38256. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  38257. }
  38258. }
  38259. const resources = isInline ? res : null;
  38260. this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory);
  38261. this.numComps = this.colorSpace.numComps;
  38262. }
  38263. this.decode = dict.getArray("Decode", "D");
  38264. this.needsDecode = false;
  38265. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  38266. this.needsDecode = true;
  38267. var max = (1 << bitsPerComponent) - 1;
  38268. this.decodeCoefficients = [];
  38269. this.decodeAddends = [];
  38270. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  38271. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  38272. var dmin = this.decode[i];
  38273. var dmax = this.decode[i + 1];
  38274. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  38275. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  38276. }
  38277. }
  38278. if (smask) {
  38279. this.smask = new PDFImage({
  38280. xref,
  38281. res,
  38282. image: smask,
  38283. isInline,
  38284. pdfFunctionFactory
  38285. });
  38286. } else if (mask) {
  38287. if ((0, _primitives.isStream)(mask)) {
  38288. var maskDict = mask.dict,
  38289. imageMask = maskDict.get("ImageMask", "IM");
  38290. if (!imageMask) {
  38291. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  38292. } else {
  38293. this.mask = new PDFImage({
  38294. xref,
  38295. res,
  38296. image: mask,
  38297. isInline,
  38298. isMask: true,
  38299. pdfFunctionFactory
  38300. });
  38301. }
  38302. } else {
  38303. this.mask = mask;
  38304. }
  38305. }
  38306. }
  38307. PDFImage.buildImage = function ({
  38308. handler,
  38309. xref,
  38310. res,
  38311. image,
  38312. isInline = false,
  38313. nativeDecoder = null,
  38314. pdfFunctionFactory
  38315. }) {
  38316. var imagePromise = handleImageData(image, nativeDecoder);
  38317. var smaskPromise;
  38318. var maskPromise;
  38319. var smask = image.dict.get("SMask");
  38320. var mask = image.dict.get("Mask");
  38321. if (smask) {
  38322. smaskPromise = handleImageData(smask, nativeDecoder);
  38323. maskPromise = Promise.resolve(null);
  38324. } else {
  38325. smaskPromise = Promise.resolve(null);
  38326. if (mask) {
  38327. if ((0, _primitives.isStream)(mask)) {
  38328. maskPromise = handleImageData(mask, nativeDecoder);
  38329. } else if (Array.isArray(mask)) {
  38330. maskPromise = Promise.resolve(mask);
  38331. } else {
  38332. (0, _util.warn)("Unsupported mask format.");
  38333. maskPromise = Promise.resolve(null);
  38334. }
  38335. } else {
  38336. maskPromise = Promise.resolve(null);
  38337. }
  38338. }
  38339. return Promise.all([imagePromise, smaskPromise, maskPromise]).then(function ([imageData, smaskData, maskData]) {
  38340. return new PDFImage({
  38341. xref,
  38342. res,
  38343. image: imageData,
  38344. isInline,
  38345. smask: smaskData,
  38346. mask: maskData,
  38347. pdfFunctionFactory
  38348. });
  38349. });
  38350. };
  38351. PDFImage.createMask = function ({
  38352. imgArray,
  38353. width,
  38354. height,
  38355. imageIsFromDecodeStream,
  38356. inverseDecode
  38357. }) {
  38358. var computedLength = (width + 7 >> 3) * height;
  38359. var actualLength = imgArray.byteLength;
  38360. var haveFullData = computedLength === actualLength;
  38361. var data, i;
  38362. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  38363. data = imgArray;
  38364. } else if (!inverseDecode) {
  38365. data = new Uint8ClampedArray(actualLength);
  38366. data.set(imgArray);
  38367. } else {
  38368. data = new Uint8ClampedArray(computedLength);
  38369. data.set(imgArray);
  38370. for (i = actualLength; i < computedLength; i++) {
  38371. data[i] = 0xff;
  38372. }
  38373. }
  38374. if (inverseDecode) {
  38375. for (i = 0; i < actualLength; i++) {
  38376. data[i] ^= 0xff;
  38377. }
  38378. }
  38379. return {
  38380. data,
  38381. width,
  38382. height
  38383. };
  38384. };
  38385. PDFImage.prototype = {
  38386. get drawWidth() {
  38387. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  38388. },
  38389. get drawHeight() {
  38390. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  38391. },
  38392. decodeBuffer(buffer) {
  38393. var bpc = this.bpc;
  38394. var numComps = this.numComps;
  38395. var decodeAddends = this.decodeAddends;
  38396. var decodeCoefficients = this.decodeCoefficients;
  38397. var max = (1 << bpc) - 1;
  38398. var i, ii;
  38399. if (bpc === 1) {
  38400. for (i = 0, ii = buffer.length; i < ii; i++) {
  38401. buffer[i] = +!buffer[i];
  38402. }
  38403. return;
  38404. }
  38405. var index = 0;
  38406. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  38407. for (var j = 0; j < numComps; j++) {
  38408. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  38409. index++;
  38410. }
  38411. }
  38412. },
  38413. getComponents(buffer) {
  38414. var bpc = this.bpc;
  38415. if (bpc === 8) {
  38416. return buffer;
  38417. }
  38418. var width = this.width;
  38419. var height = this.height;
  38420. var numComps = this.numComps;
  38421. var length = width * height * numComps;
  38422. var bufferPos = 0;
  38423. let output;
  38424. if (bpc <= 8) {
  38425. output = new Uint8Array(length);
  38426. } else if (bpc <= 16) {
  38427. output = new Uint16Array(length);
  38428. } else {
  38429. output = new Uint32Array(length);
  38430. }
  38431. var rowComps = width * numComps;
  38432. var max = (1 << bpc) - 1;
  38433. var i = 0,
  38434. ii,
  38435. buf;
  38436. if (bpc === 1) {
  38437. var mask, loop1End, loop2End;
  38438. for (var j = 0; j < height; j++) {
  38439. loop1End = i + (rowComps & ~7);
  38440. loop2End = i + rowComps;
  38441. while (i < loop1End) {
  38442. buf = buffer[bufferPos++];
  38443. output[i] = buf >> 7 & 1;
  38444. output[i + 1] = buf >> 6 & 1;
  38445. output[i + 2] = buf >> 5 & 1;
  38446. output[i + 3] = buf >> 4 & 1;
  38447. output[i + 4] = buf >> 3 & 1;
  38448. output[i + 5] = buf >> 2 & 1;
  38449. output[i + 6] = buf >> 1 & 1;
  38450. output[i + 7] = buf & 1;
  38451. i += 8;
  38452. }
  38453. if (i < loop2End) {
  38454. buf = buffer[bufferPos++];
  38455. mask = 128;
  38456. while (i < loop2End) {
  38457. output[i++] = +!!(buf & mask);
  38458. mask >>= 1;
  38459. }
  38460. }
  38461. }
  38462. } else {
  38463. var bits = 0;
  38464. buf = 0;
  38465. for (i = 0, ii = length; i < ii; ++i) {
  38466. if (i % rowComps === 0) {
  38467. buf = 0;
  38468. bits = 0;
  38469. }
  38470. while (bits < bpc) {
  38471. buf = buf << 8 | buffer[bufferPos++];
  38472. bits += 8;
  38473. }
  38474. var remainingBits = bits - bpc;
  38475. let value = buf >> remainingBits;
  38476. if (value < 0) {
  38477. value = 0;
  38478. } else if (value > max) {
  38479. value = max;
  38480. }
  38481. output[i] = value;
  38482. buf = buf & (1 << remainingBits) - 1;
  38483. bits = remainingBits;
  38484. }
  38485. }
  38486. return output;
  38487. },
  38488. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  38489. var smask = this.smask;
  38490. var mask = this.mask;
  38491. var alphaBuf, sw, sh, i, ii, j;
  38492. if (smask) {
  38493. sw = smask.width;
  38494. sh = smask.height;
  38495. alphaBuf = new Uint8ClampedArray(sw * sh);
  38496. smask.fillGrayBuffer(alphaBuf);
  38497. if (sw !== width || sh !== height) {
  38498. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  38499. }
  38500. } else if (mask) {
  38501. if (mask instanceof PDFImage) {
  38502. sw = mask.width;
  38503. sh = mask.height;
  38504. alphaBuf = new Uint8ClampedArray(sw * sh);
  38505. mask.numComps = 1;
  38506. mask.fillGrayBuffer(alphaBuf);
  38507. for (i = 0, ii = sw * sh; i < ii; ++i) {
  38508. alphaBuf[i] = 255 - alphaBuf[i];
  38509. }
  38510. if (sw !== width || sh !== height) {
  38511. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  38512. }
  38513. } else if (Array.isArray(mask)) {
  38514. alphaBuf = new Uint8ClampedArray(width * height);
  38515. var numComps = this.numComps;
  38516. for (i = 0, ii = width * height; i < ii; ++i) {
  38517. var opacity = 0;
  38518. var imageOffset = i * numComps;
  38519. for (j = 0; j < numComps; ++j) {
  38520. var color = image[imageOffset + j];
  38521. var maskOffset = j * 2;
  38522. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  38523. opacity = 255;
  38524. break;
  38525. }
  38526. }
  38527. alphaBuf[i] = opacity;
  38528. }
  38529. } else {
  38530. throw new _util.FormatError("Unknown mask format.");
  38531. }
  38532. }
  38533. if (alphaBuf) {
  38534. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  38535. rgbaBuf[j] = alphaBuf[i];
  38536. }
  38537. } else {
  38538. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  38539. rgbaBuf[j] = 255;
  38540. }
  38541. }
  38542. },
  38543. undoPreblend(buffer, width, height) {
  38544. var matte = this.smask && this.smask.matte;
  38545. if (!matte) {
  38546. return;
  38547. }
  38548. var matteRgb = this.colorSpace.getRgb(matte, 0);
  38549. var matteR = matteRgb[0];
  38550. var matteG = matteRgb[1];
  38551. var matteB = matteRgb[2];
  38552. var length = width * height * 4;
  38553. for (var i = 0; i < length; i += 4) {
  38554. var alpha = buffer[i + 3];
  38555. if (alpha === 0) {
  38556. buffer[i] = 255;
  38557. buffer[i + 1] = 255;
  38558. buffer[i + 2] = 255;
  38559. continue;
  38560. }
  38561. var k = 255 / alpha;
  38562. buffer[i] = (buffer[i] - matteR) * k + matteR;
  38563. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  38564. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  38565. }
  38566. },
  38567. createImageData(forceRGBA = false) {
  38568. var drawWidth = this.drawWidth;
  38569. var drawHeight = this.drawHeight;
  38570. var imgData = {
  38571. width: drawWidth,
  38572. height: drawHeight,
  38573. kind: 0,
  38574. data: null
  38575. };
  38576. var numComps = this.numComps;
  38577. var originalWidth = this.width;
  38578. var originalHeight = this.height;
  38579. var bpc = this.bpc;
  38580. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  38581. var imgArray;
  38582. if (!forceRGBA) {
  38583. var kind;
  38584. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  38585. kind = _util.ImageKind.GRAYSCALE_1BPP;
  38586. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  38587. kind = _util.ImageKind.RGB_24BPP;
  38588. }
  38589. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  38590. imgData.kind = kind;
  38591. imgArray = this.getImageBytes(originalHeight * rowBytes);
  38592. if (this.image instanceof _stream.DecodeStream) {
  38593. imgData.data = imgArray;
  38594. } else {
  38595. var newArray = new Uint8ClampedArray(imgArray.length);
  38596. newArray.set(imgArray);
  38597. imgData.data = newArray;
  38598. }
  38599. if (this.needsDecode) {
  38600. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  38601. var buffer = imgData.data;
  38602. for (var i = 0, ii = buffer.length; i < ii; i++) {
  38603. buffer[i] ^= 0xff;
  38604. }
  38605. }
  38606. return imgData;
  38607. }
  38608. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  38609. let imageLength = originalHeight * rowBytes;
  38610. switch (this.colorSpace.name) {
  38611. case "DeviceGray":
  38612. imageLength *= 3;
  38613. case "DeviceRGB":
  38614. case "DeviceCMYK":
  38615. imgData.kind = _util.ImageKind.RGB_24BPP;
  38616. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  38617. return imgData;
  38618. }
  38619. }
  38620. }
  38621. imgArray = this.getImageBytes(originalHeight * rowBytes);
  38622. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  38623. var comps = this.getComponents(imgArray);
  38624. var alpha01, maybeUndoPreblend;
  38625. if (!forceRGBA && !this.smask && !this.mask) {
  38626. imgData.kind = _util.ImageKind.RGB_24BPP;
  38627. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  38628. alpha01 = 0;
  38629. maybeUndoPreblend = false;
  38630. } else {
  38631. imgData.kind = _util.ImageKind.RGBA_32BPP;
  38632. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  38633. alpha01 = 1;
  38634. maybeUndoPreblend = true;
  38635. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  38636. }
  38637. if (this.needsDecode) {
  38638. this.decodeBuffer(comps);
  38639. }
  38640. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  38641. if (maybeUndoPreblend) {
  38642. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  38643. }
  38644. return imgData;
  38645. },
  38646. fillGrayBuffer(buffer) {
  38647. var numComps = this.numComps;
  38648. if (numComps !== 1) {
  38649. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  38650. }
  38651. var width = this.width;
  38652. var height = this.height;
  38653. var bpc = this.bpc;
  38654. var rowBytes = width * numComps * bpc + 7 >> 3;
  38655. var imgArray = this.getImageBytes(height * rowBytes);
  38656. var comps = this.getComponents(imgArray);
  38657. var i, length;
  38658. if (bpc === 1) {
  38659. length = width * height;
  38660. if (this.needsDecode) {
  38661. for (i = 0; i < length; ++i) {
  38662. buffer[i] = comps[i] - 1 & 255;
  38663. }
  38664. } else {
  38665. for (i = 0; i < length; ++i) {
  38666. buffer[i] = -comps[i] & 255;
  38667. }
  38668. }
  38669. return;
  38670. }
  38671. if (this.needsDecode) {
  38672. this.decodeBuffer(comps);
  38673. }
  38674. length = width * height;
  38675. var scale = 255 / ((1 << bpc) - 1);
  38676. for (i = 0; i < length; ++i) {
  38677. buffer[i] = scale * comps[i];
  38678. }
  38679. },
  38680. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  38681. this.image.reset();
  38682. this.image.drawWidth = drawWidth || this.width;
  38683. this.image.drawHeight = drawHeight || this.height;
  38684. this.image.forceRGB = !!forceRGB;
  38685. return this.image.getBytes(length, true);
  38686. }
  38687. };
  38688. return PDFImage;
  38689. }();
  38690. exports.PDFImage = PDFImage;
  38691. /***/ }),
  38692. /* 44 */
  38693. /***/ (function(module, exports, __w_pdfjs_require__) {
  38694. "use strict";
  38695. Object.defineProperty(exports, "__esModule", {
  38696. value: true
  38697. });
  38698. exports.isNodeJS = void 0;
  38699. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions["nw"] && !process.versions["electron"];
  38700. exports.isNodeJS = isNodeJS;
  38701. /***/ }),
  38702. /* 45 */
  38703. /***/ (function(module, exports, __w_pdfjs_require__) {
  38704. "use strict";
  38705. Object.defineProperty(exports, "__esModule", {
  38706. value: true
  38707. });
  38708. exports.MessageHandler = void 0;
  38709. var _util = __w_pdfjs_require__(2);
  38710. const CallbackKind = {
  38711. UNKNOWN: 0,
  38712. DATA: 1,
  38713. ERROR: 2
  38714. };
  38715. const StreamKind = {
  38716. UNKNOWN: 0,
  38717. CANCEL: 1,
  38718. CANCEL_COMPLETE: 2,
  38719. CLOSE: 3,
  38720. ENQUEUE: 4,
  38721. ERROR: 5,
  38722. PULL: 6,
  38723. PULL_COMPLETE: 7,
  38724. START_COMPLETE: 8
  38725. };
  38726. function wrapReason(reason) {
  38727. if (typeof reason !== "object" || reason === null) {
  38728. return reason;
  38729. }
  38730. switch (reason.name) {
  38731. case "AbortException":
  38732. return new _util.AbortException(reason.message);
  38733. case "MissingPDFException":
  38734. return new _util.MissingPDFException(reason.message);
  38735. case "UnexpectedResponseException":
  38736. return new _util.UnexpectedResponseException(reason.message, reason.status);
  38737. case "UnknownErrorException":
  38738. return new _util.UnknownErrorException(reason.message, reason.details);
  38739. default:
  38740. return new _util.UnknownErrorException(reason.message, reason.toString());
  38741. }
  38742. }
  38743. class MessageHandler {
  38744. constructor(sourceName, targetName, comObj) {
  38745. this.sourceName = sourceName;
  38746. this.targetName = targetName;
  38747. this.comObj = comObj;
  38748. this.callbackId = 1;
  38749. this.streamId = 1;
  38750. this.postMessageTransfers = true;
  38751. this.streamSinks = Object.create(null);
  38752. this.streamControllers = Object.create(null);
  38753. this.callbackCapabilities = Object.create(null);
  38754. this.actionHandler = Object.create(null);
  38755. this._onComObjOnMessage = event => {
  38756. const data = event.data;
  38757. if (data.targetName !== this.sourceName) {
  38758. return;
  38759. }
  38760. if (data.stream) {
  38761. this._processStreamMessage(data);
  38762. return;
  38763. }
  38764. if (data.callback) {
  38765. const callbackId = data.callbackId;
  38766. const capability = this.callbackCapabilities[callbackId];
  38767. if (!capability) {
  38768. throw new Error(`Cannot resolve callback ${callbackId}`);
  38769. }
  38770. delete this.callbackCapabilities[callbackId];
  38771. if (data.callback === CallbackKind.DATA) {
  38772. capability.resolve(data.data);
  38773. } else if (data.callback === CallbackKind.ERROR) {
  38774. capability.reject(wrapReason(data.reason));
  38775. } else {
  38776. throw new Error("Unexpected callback case");
  38777. }
  38778. return;
  38779. }
  38780. const action = this.actionHandler[data.action];
  38781. if (!action) {
  38782. throw new Error(`Unknown action from worker: ${data.action}`);
  38783. }
  38784. if (data.callbackId) {
  38785. const sourceName = this.sourceName;
  38786. const targetName = data.sourceName;
  38787. new Promise(function (resolve) {
  38788. resolve(action(data.data));
  38789. }).then(function (result) {
  38790. comObj.postMessage({
  38791. sourceName,
  38792. targetName,
  38793. callback: CallbackKind.DATA,
  38794. callbackId: data.callbackId,
  38795. data: result
  38796. });
  38797. }, function (reason) {
  38798. comObj.postMessage({
  38799. sourceName,
  38800. targetName,
  38801. callback: CallbackKind.ERROR,
  38802. callbackId: data.callbackId,
  38803. reason: wrapReason(reason)
  38804. });
  38805. });
  38806. return;
  38807. }
  38808. if (data.streamId) {
  38809. this._createStreamSink(data);
  38810. return;
  38811. }
  38812. action(data.data);
  38813. };
  38814. comObj.addEventListener("message", this._onComObjOnMessage);
  38815. }
  38816. on(actionName, handler) {
  38817. const ah = this.actionHandler;
  38818. if (ah[actionName]) {
  38819. throw new Error(`There is already an actionName called "${actionName}"`);
  38820. }
  38821. ah[actionName] = handler;
  38822. }
  38823. send(actionName, data, transfers) {
  38824. this._postMessage({
  38825. sourceName: this.sourceName,
  38826. targetName: this.targetName,
  38827. action: actionName,
  38828. data
  38829. }, transfers);
  38830. }
  38831. sendWithPromise(actionName, data, transfers) {
  38832. const callbackId = this.callbackId++;
  38833. const capability = (0, _util.createPromiseCapability)();
  38834. this.callbackCapabilities[callbackId] = capability;
  38835. try {
  38836. this._postMessage({
  38837. sourceName: this.sourceName,
  38838. targetName: this.targetName,
  38839. action: actionName,
  38840. callbackId,
  38841. data
  38842. }, transfers);
  38843. } catch (ex) {
  38844. capability.reject(ex);
  38845. }
  38846. return capability.promise;
  38847. }
  38848. sendWithStream(actionName, data, queueingStrategy, transfers) {
  38849. const streamId = this.streamId++;
  38850. const sourceName = this.sourceName;
  38851. const targetName = this.targetName;
  38852. const comObj = this.comObj;
  38853. return new ReadableStream({
  38854. start: controller => {
  38855. const startCapability = (0, _util.createPromiseCapability)();
  38856. this.streamControllers[streamId] = {
  38857. controller,
  38858. startCall: startCapability,
  38859. pullCall: null,
  38860. cancelCall: null,
  38861. isClosed: false
  38862. };
  38863. this._postMessage({
  38864. sourceName,
  38865. targetName,
  38866. action: actionName,
  38867. streamId,
  38868. data,
  38869. desiredSize: controller.desiredSize
  38870. }, transfers);
  38871. return startCapability.promise;
  38872. },
  38873. pull: controller => {
  38874. const pullCapability = (0, _util.createPromiseCapability)();
  38875. this.streamControllers[streamId].pullCall = pullCapability;
  38876. comObj.postMessage({
  38877. sourceName,
  38878. targetName,
  38879. stream: StreamKind.PULL,
  38880. streamId,
  38881. desiredSize: controller.desiredSize
  38882. });
  38883. return pullCapability.promise;
  38884. },
  38885. cancel: reason => {
  38886. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  38887. const cancelCapability = (0, _util.createPromiseCapability)();
  38888. this.streamControllers[streamId].cancelCall = cancelCapability;
  38889. this.streamControllers[streamId].isClosed = true;
  38890. comObj.postMessage({
  38891. sourceName,
  38892. targetName,
  38893. stream: StreamKind.CANCEL,
  38894. streamId,
  38895. reason: wrapReason(reason)
  38896. });
  38897. return cancelCapability.promise;
  38898. }
  38899. }, queueingStrategy);
  38900. }
  38901. _createStreamSink(data) {
  38902. const self = this;
  38903. const action = this.actionHandler[data.action];
  38904. const streamId = data.streamId;
  38905. const sourceName = this.sourceName;
  38906. const targetName = data.sourceName;
  38907. const comObj = this.comObj;
  38908. const streamSink = {
  38909. enqueue(chunk, size = 1, transfers) {
  38910. if (this.isCancelled) {
  38911. return;
  38912. }
  38913. const lastDesiredSize = this.desiredSize;
  38914. this.desiredSize -= size;
  38915. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  38916. this.sinkCapability = (0, _util.createPromiseCapability)();
  38917. this.ready = this.sinkCapability.promise;
  38918. }
  38919. self._postMessage({
  38920. sourceName,
  38921. targetName,
  38922. stream: StreamKind.ENQUEUE,
  38923. streamId,
  38924. chunk
  38925. }, transfers);
  38926. },
  38927. close() {
  38928. if (this.isCancelled) {
  38929. return;
  38930. }
  38931. this.isCancelled = true;
  38932. comObj.postMessage({
  38933. sourceName,
  38934. targetName,
  38935. stream: StreamKind.CLOSE,
  38936. streamId
  38937. });
  38938. delete self.streamSinks[streamId];
  38939. },
  38940. error(reason) {
  38941. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  38942. if (this.isCancelled) {
  38943. return;
  38944. }
  38945. this.isCancelled = true;
  38946. comObj.postMessage({
  38947. sourceName,
  38948. targetName,
  38949. stream: StreamKind.ERROR,
  38950. streamId,
  38951. reason: wrapReason(reason)
  38952. });
  38953. },
  38954. sinkCapability: (0, _util.createPromiseCapability)(),
  38955. onPull: null,
  38956. onCancel: null,
  38957. isCancelled: false,
  38958. desiredSize: data.desiredSize,
  38959. ready: null
  38960. };
  38961. streamSink.sinkCapability.resolve();
  38962. streamSink.ready = streamSink.sinkCapability.promise;
  38963. this.streamSinks[streamId] = streamSink;
  38964. new Promise(function (resolve) {
  38965. resolve(action(data.data, streamSink));
  38966. }).then(function () {
  38967. comObj.postMessage({
  38968. sourceName,
  38969. targetName,
  38970. stream: StreamKind.START_COMPLETE,
  38971. streamId,
  38972. success: true
  38973. });
  38974. }, function (reason) {
  38975. comObj.postMessage({
  38976. sourceName,
  38977. targetName,
  38978. stream: StreamKind.START_COMPLETE,
  38979. streamId,
  38980. reason: wrapReason(reason)
  38981. });
  38982. });
  38983. }
  38984. _processStreamMessage(data) {
  38985. const streamId = data.streamId;
  38986. const sourceName = this.sourceName;
  38987. const targetName = data.sourceName;
  38988. const comObj = this.comObj;
  38989. switch (data.stream) {
  38990. case StreamKind.START_COMPLETE:
  38991. if (data.success) {
  38992. this.streamControllers[streamId].startCall.resolve();
  38993. } else {
  38994. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  38995. }
  38996. break;
  38997. case StreamKind.PULL_COMPLETE:
  38998. if (data.success) {
  38999. this.streamControllers[streamId].pullCall.resolve();
  39000. } else {
  39001. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  39002. }
  39003. break;
  39004. case StreamKind.PULL:
  39005. if (!this.streamSinks[streamId]) {
  39006. comObj.postMessage({
  39007. sourceName,
  39008. targetName,
  39009. stream: StreamKind.PULL_COMPLETE,
  39010. streamId,
  39011. success: true
  39012. });
  39013. break;
  39014. }
  39015. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  39016. this.streamSinks[streamId].sinkCapability.resolve();
  39017. }
  39018. this.streamSinks[streamId].desiredSize = data.desiredSize;
  39019. const {
  39020. onPull
  39021. } = this.streamSinks[data.streamId];
  39022. new Promise(function (resolve) {
  39023. resolve(onPull && onPull());
  39024. }).then(function () {
  39025. comObj.postMessage({
  39026. sourceName,
  39027. targetName,
  39028. stream: StreamKind.PULL_COMPLETE,
  39029. streamId,
  39030. success: true
  39031. });
  39032. }, function (reason) {
  39033. comObj.postMessage({
  39034. sourceName,
  39035. targetName,
  39036. stream: StreamKind.PULL_COMPLETE,
  39037. streamId,
  39038. reason: wrapReason(reason)
  39039. });
  39040. });
  39041. break;
  39042. case StreamKind.ENQUEUE:
  39043. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  39044. if (this.streamControllers[streamId].isClosed) {
  39045. break;
  39046. }
  39047. this.streamControllers[streamId].controller.enqueue(data.chunk);
  39048. break;
  39049. case StreamKind.CLOSE:
  39050. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  39051. if (this.streamControllers[streamId].isClosed) {
  39052. break;
  39053. }
  39054. this.streamControllers[streamId].isClosed = true;
  39055. this.streamControllers[streamId].controller.close();
  39056. this._deleteStreamController(streamId);
  39057. break;
  39058. case StreamKind.ERROR:
  39059. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  39060. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  39061. this._deleteStreamController(streamId);
  39062. break;
  39063. case StreamKind.CANCEL_COMPLETE:
  39064. if (data.success) {
  39065. this.streamControllers[streamId].cancelCall.resolve();
  39066. } else {
  39067. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  39068. }
  39069. this._deleteStreamController(streamId);
  39070. break;
  39071. case StreamKind.CANCEL:
  39072. if (!this.streamSinks[streamId]) {
  39073. break;
  39074. }
  39075. const {
  39076. onCancel
  39077. } = this.streamSinks[data.streamId];
  39078. new Promise(function (resolve) {
  39079. resolve(onCancel && onCancel(wrapReason(data.reason)));
  39080. }).then(function () {
  39081. comObj.postMessage({
  39082. sourceName,
  39083. targetName,
  39084. stream: StreamKind.CANCEL_COMPLETE,
  39085. streamId,
  39086. success: true
  39087. });
  39088. }, function (reason) {
  39089. comObj.postMessage({
  39090. sourceName,
  39091. targetName,
  39092. stream: StreamKind.CANCEL_COMPLETE,
  39093. streamId,
  39094. reason: wrapReason(reason)
  39095. });
  39096. });
  39097. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  39098. this.streamSinks[streamId].isCancelled = true;
  39099. delete this.streamSinks[streamId];
  39100. break;
  39101. default:
  39102. throw new Error("Unexpected stream case");
  39103. }
  39104. }
  39105. async _deleteStreamController(streamId) {
  39106. await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  39107. return capability && capability.promise;
  39108. }));
  39109. delete this.streamControllers[streamId];
  39110. }
  39111. _postMessage(message, transfers) {
  39112. if (transfers && this.postMessageTransfers) {
  39113. this.comObj.postMessage(message, transfers);
  39114. } else {
  39115. this.comObj.postMessage(message);
  39116. }
  39117. }
  39118. destroy() {
  39119. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  39120. }
  39121. }
  39122. exports.MessageHandler = MessageHandler;
  39123. /***/ }),
  39124. /* 46 */
  39125. /***/ (function(module, exports, __w_pdfjs_require__) {
  39126. "use strict";
  39127. Object.defineProperty(exports, "__esModule", {
  39128. value: true
  39129. });
  39130. exports.PDFWorkerStream = void 0;
  39131. var _util = __w_pdfjs_require__(2);
  39132. class PDFWorkerStream {
  39133. constructor(msgHandler) {
  39134. this._msgHandler = msgHandler;
  39135. this._contentLength = null;
  39136. this._fullRequestReader = null;
  39137. this._rangeRequestReaders = [];
  39138. }
  39139. getFullReader() {
  39140. (0, _util.assert)(!this._fullRequestReader);
  39141. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  39142. return this._fullRequestReader;
  39143. }
  39144. getRangeReader(begin, end) {
  39145. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  39146. this._rangeRequestReaders.push(reader);
  39147. return reader;
  39148. }
  39149. cancelAllRequests(reason) {
  39150. if (this._fullRequestReader) {
  39151. this._fullRequestReader.cancel(reason);
  39152. }
  39153. const readers = this._rangeRequestReaders.slice(0);
  39154. readers.forEach(function (reader) {
  39155. reader.cancel(reason);
  39156. });
  39157. }
  39158. }
  39159. exports.PDFWorkerStream = PDFWorkerStream;
  39160. class PDFWorkerStreamReader {
  39161. constructor(msgHandler) {
  39162. this._msgHandler = msgHandler;
  39163. this.onProgress = null;
  39164. this._contentLength = null;
  39165. this._isRangeSupported = false;
  39166. this._isStreamingSupported = false;
  39167. const readableStream = this._msgHandler.sendWithStream("GetReader");
  39168. this._reader = readableStream.getReader();
  39169. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  39170. this._isStreamingSupported = data.isStreamingSupported;
  39171. this._isRangeSupported = data.isRangeSupported;
  39172. this._contentLength = data.contentLength;
  39173. });
  39174. }
  39175. get headersReady() {
  39176. return this._headersReady;
  39177. }
  39178. get contentLength() {
  39179. return this._contentLength;
  39180. }
  39181. get isStreamingSupported() {
  39182. return this._isStreamingSupported;
  39183. }
  39184. get isRangeSupported() {
  39185. return this._isRangeSupported;
  39186. }
  39187. async read() {
  39188. const {
  39189. value,
  39190. done
  39191. } = await this._reader.read();
  39192. if (done) {
  39193. return {
  39194. value: undefined,
  39195. done: true
  39196. };
  39197. }
  39198. return {
  39199. value: value.buffer,
  39200. done: false
  39201. };
  39202. }
  39203. cancel(reason) {
  39204. this._reader.cancel(reason);
  39205. }
  39206. }
  39207. class PDFWorkerStreamRangeReader {
  39208. constructor(begin, end, msgHandler) {
  39209. this._msgHandler = msgHandler;
  39210. this.onProgress = null;
  39211. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  39212. begin,
  39213. end
  39214. });
  39215. this._reader = readableStream.getReader();
  39216. }
  39217. get isStreamingSupported() {
  39218. return false;
  39219. }
  39220. async read() {
  39221. const {
  39222. value,
  39223. done
  39224. } = await this._reader.read();
  39225. if (done) {
  39226. return {
  39227. value: undefined,
  39228. done: true
  39229. };
  39230. }
  39231. return {
  39232. value: value.buffer,
  39233. done: false
  39234. };
  39235. }
  39236. cancel(reason) {
  39237. this._reader.cancel(reason);
  39238. }
  39239. }
  39240. /***/ })
  39241. /******/ ]);
  39242. });
  39243. //# sourceMappingURL=pdf.worker.js.map